;
diff --git a/src/runtime/native/reanimated.ts b/src/native/reanimated.ts
similarity index 100%
rename from src/runtime/native/reanimated.ts
rename to src/native/reanimated.ts
diff --git a/src/runtime/native/styles/calculate-props.ts b/src/native/styles/calculate-props.ts
similarity index 97%
rename from src/runtime/native/styles/calculate-props.ts
rename to src/native/styles/calculate-props.ts
index a24bd77..c23b939 100644
--- a/src/runtime/native/styles/calculate-props.ts
+++ b/src/native/styles/calculate-props.ts
@@ -3,9 +3,11 @@ import type {
InlineVariable,
StyleDeclaration,
StyleRule,
-} from "../../../compiler";
-import { applyValue, getDeepPath, Specificity as S } from "../../utils";
+} from "react-native-css/compiler";
+import { Specificity as S } from "react-native-css/utilities";
+
import type { RenderGuard } from "../conditions/guards";
+import { applyValue, getDeepPath } from "../objects";
import {
VAR_SYMBOL,
type Getter,
diff --git a/src/runtime/native/styles/constants.ts b/src/native/styles/constants.ts
similarity index 100%
rename from src/runtime/native/styles/constants.ts
rename to src/native/styles/constants.ts
diff --git a/src/runtime/native/styles/defaults.ts b/src/native/styles/defaults.ts
similarity index 100%
rename from src/runtime/native/styles/defaults.ts
rename to src/native/styles/defaults.ts
diff --git a/src/runtime/native/styles/functions/animation-timing.ts b/src/native/styles/functions/animation-timing.ts
similarity index 100%
rename from src/runtime/native/styles/functions/animation-timing.ts
rename to src/native/styles/functions/animation-timing.ts
diff --git a/src/runtime/native/styles/functions/calc.ts b/src/native/styles/functions/calc.ts
similarity index 100%
rename from src/runtime/native/styles/functions/calc.ts
rename to src/native/styles/functions/calc.ts
diff --git a/src/runtime/native/styles/functions/filters.ts b/src/native/styles/functions/filters.ts
similarity index 97%
rename from src/runtime/native/styles/functions/filters.ts
rename to src/native/styles/functions/filters.ts
index 672bc5e..17def28 100644
--- a/src/runtime/native/styles/functions/filters.ts
+++ b/src/native/styles/functions/filters.ts
@@ -1,4 +1,5 @@
-import { isStyleDescriptorArray } from "../../../utils";
+import { isStyleDescriptorArray } from "react-native-css/utilities";
+
import type { StyleFunctionResolver } from "../resolve";
import { shorthandHandler } from "../shorthands/_handler";
diff --git a/src/runtime/native/styles/functions/index.ts b/src/native/styles/functions/index.ts
similarity index 100%
rename from src/runtime/native/styles/functions/index.ts
rename to src/native/styles/functions/index.ts
diff --git a/src/runtime/native/styles/functions/numeric-functions.ts b/src/native/styles/functions/numeric-functions.ts
similarity index 100%
rename from src/runtime/native/styles/functions/numeric-functions.ts
rename to src/native/styles/functions/numeric-functions.ts
diff --git a/src/runtime/native/styles/functions/platform-functions.ts b/src/native/styles/functions/platform-functions.ts
similarity index 100%
rename from src/runtime/native/styles/functions/platform-functions.ts
rename to src/native/styles/functions/platform-functions.ts
diff --git a/src/runtime/native/styles/functions/string-functions.ts b/src/native/styles/functions/string-functions.ts
similarity index 100%
rename from src/runtime/native/styles/functions/string-functions.ts
rename to src/native/styles/functions/string-functions.ts
diff --git a/src/runtime/native/styles/functions/transform-functions.ts b/src/native/styles/functions/transform-functions.ts
similarity index 97%
rename from src/runtime/native/styles/functions/transform-functions.ts
rename to src/native/styles/functions/transform-functions.ts
index 3ae1f12..c9826db 100644
--- a/src/runtime/native/styles/functions/transform-functions.ts
+++ b/src/native/styles/functions/transform-functions.ts
@@ -1,4 +1,5 @@
-import { isStyleDescriptorArray } from "../../../utils";
+import { isStyleDescriptorArray } from "react-native-css/utilities";
+
import type { StyleFunctionResolver } from "../resolve";
export const scale: StyleFunctionResolver = (resolveValue, descriptor) => {
diff --git a/src/runtime/native/styles/index.ts b/src/native/styles/index.ts
similarity index 97%
rename from src/runtime/native/styles/index.ts
rename to src/native/styles/index.ts
index 0a2f553..1ee9b24 100644
--- a/src/runtime/native/styles/index.ts
+++ b/src/native/styles/index.ts
@@ -1,6 +1,7 @@
/* eslint-disable */
-import type { InlineVariable, StyleRule } from "../../../compiler";
-import { specificityCompareFn } from "../../utils";
+import type { InlineVariable, StyleRule } from "react-native-css/compiler";
+import { specificityCompareFn } from "react-native-css/utilities";
+
import { getInteractionHandler } from "../react/interaction";
import type { ComponentState, Config } from "../react/useNativeCss";
import {
diff --git a/src/runtime/native/styles/line-height.ts b/src/native/styles/line-height.ts
similarity index 100%
rename from src/runtime/native/styles/line-height.ts
rename to src/native/styles/line-height.ts
diff --git a/src/runtime/native/styles/resolve.ts b/src/native/styles/resolve.ts
similarity index 99%
rename from src/runtime/native/styles/resolve.ts
rename to src/native/styles/resolve.ts
index 03ea005..c536d0c 100644
--- a/src/runtime/native/styles/resolve.ts
+++ b/src/native/styles/resolve.ts
@@ -4,7 +4,8 @@ import type {
InlineVariable,
StyleDescriptor,
StyleFunction,
-} from "../../../compiler";
+} from "react-native-css/compiler";
+
import type { RenderGuard } from "../conditions/guards";
import { type Getter, type VariableContextValue } from "../reactivity";
import type { calculateProps } from "./calculate-props";
diff --git a/src/runtime/native/styles/shorthands/_handler.ts b/src/native/styles/shorthands/_handler.ts
similarity index 96%
rename from src/runtime/native/styles/shorthands/_handler.ts
rename to src/native/styles/shorthands/_handler.ts
index 48debf3..1bc71a1 100644
--- a/src/runtime/native/styles/shorthands/_handler.ts
+++ b/src/native/styles/shorthands/_handler.ts
@@ -1,6 +1,7 @@
/* eslint-disable */
-import { setDeepPath } from "../../../utils/objects";
-import { isStyleDescriptorArray } from "../../../utils/style-value";
+import { isStyleDescriptorArray } from "react-native-css/utilities";
+
+import { setDeepPath } from "../../objects";
import { ShortHandSymbol } from "../constants";
import { defaultValues } from "../defaults";
import type { StyleResolver } from "../resolve";
diff --git a/src/runtime/native/styles/shorthands/animation.ts b/src/native/styles/shorthands/animation.ts
similarity index 95%
rename from src/runtime/native/styles/shorthands/animation.ts
rename to src/native/styles/shorthands/animation.ts
index 72cc114..0d7eddb 100644
--- a/src/runtime/native/styles/shorthands/animation.ts
+++ b/src/native/styles/shorthands/animation.ts
@@ -1,7 +1,7 @@
/* eslint-disable */
-import { StyleCollection } from "react-native-css/style-collection";
+import { StyleCollection } from "react-native-css/native-internal";
-import { applyShorthand } from "../../../utils";
+import { applyShorthand } from "../../objects";
import type { StyleFunctionResolver } from "../resolve";
import { shorthandHandler } from "./_handler";
diff --git a/src/runtime/native/styles/shorthands/border.ts b/src/native/styles/shorthands/border.ts
similarity index 100%
rename from src/runtime/native/styles/shorthands/border.ts
rename to src/native/styles/shorthands/border.ts
diff --git a/src/runtime/native/styles/shorthands/box-shadow.ts b/src/native/styles/shorthands/box-shadow.ts
similarity index 92%
rename from src/runtime/native/styles/shorthands/box-shadow.ts
rename to src/native/styles/shorthands/box-shadow.ts
index f3f814b..f65a937 100644
--- a/src/runtime/native/styles/shorthands/box-shadow.ts
+++ b/src/native/styles/shorthands/box-shadow.ts
@@ -1,5 +1,6 @@
-import type { StyleDescriptor } from "../../../../compiler";
-import { isStyleDescriptorArray } from "../../../utils";
+import type { StyleDescriptor } from "react-native-css/compiler";
+import { isStyleDescriptorArray } from "react-native-css/utilities";
+
import type { StyleFunctionResolver } from "../resolve";
import { shorthandHandler } from "./_handler";
diff --git a/src/runtime/native/styles/shorthands/index.ts b/src/native/styles/shorthands/index.ts
similarity index 100%
rename from src/runtime/native/styles/shorthands/index.ts
rename to src/native/styles/shorthands/index.ts
diff --git a/src/runtime/native/styles/shorthands/text-shadow.ts b/src/native/styles/shorthands/text-shadow.ts
similarity index 100%
rename from src/runtime/native/styles/shorthands/text-shadow.ts
rename to src/native/styles/shorthands/text-shadow.ts
diff --git a/src/runtime/native/styles/shorthands/transform.ts b/src/native/styles/shorthands/transform.ts
similarity index 100%
rename from src/runtime/native/styles/shorthands/transform.ts
rename to src/native/styles/shorthands/transform.ts
diff --git a/src/runtime/native/styles/units.ts b/src/native/styles/units.ts
similarity index 100%
rename from src/runtime/native/styles/units.ts
rename to src/native/styles/units.ts
diff --git a/src/runtime/native/styles/variables.ts b/src/native/styles/variables.ts
similarity index 91%
rename from src/runtime/native/styles/variables.ts
rename to src/native/styles/variables.ts
index ecbe447..af3d6ee 100644
--- a/src/runtime/native/styles/variables.ts
+++ b/src/native/styles/variables.ts
@@ -1,10 +1,10 @@
+import type { StyleDescriptor, StyleFunction } from "react-native-css/compiler";
import {
rootVariables,
universalVariables,
-} from "react-native-css/style-collection";
+} from "react-native-css/native-internal";
+import { isStyleDescriptorArray } from "react-native-css/utilities";
-import type { StyleDescriptor, StyleFunction } from "../../../compiler";
-import { isStyleDescriptorArray } from "../../utils";
import { VAR_SYMBOL, type Getter } from "../reactivity";
import type { ResolveValueOptions, SimpleResolveValue } from "./resolve";
diff --git a/src/runtime/runtime.native.ts b/src/runtime.native.ts
similarity index 100%
rename from src/runtime/runtime.native.ts
rename to src/runtime.native.ts
diff --git a/src/runtime/runtime.ts b/src/runtime.ts
similarity index 100%
rename from src/runtime/runtime.ts
rename to src/runtime.ts
diff --git a/src/runtime/runtime.types.ts b/src/runtime.types.ts
similarity index 76%
rename from src/runtime/runtime.types.ts
rename to src/runtime.types.ts
index 08214b4..6e8f9ad 100644
--- a/src/runtime/runtime.types.ts
+++ b/src/runtime.types.ts
@@ -1,5 +1,13 @@
-/* eslint-disable */
-import type { ComponentProps, ComponentType, ReactElement } from "react";
+/* eslint-disable @typescript-eslint/no-explicit-any */
+import type {
+ ClassicComponentClass,
+ ComponentClass,
+ ComponentProps,
+ ComponentType,
+ ForwardRefExoticComponent,
+ FunctionComponent,
+ ReactElement,
+} from "react";
import type {
ColorSchemeName,
ImageStyle,
@@ -7,8 +15,7 @@ import type {
ViewStyle,
} from "react-native";
-import type { ComponentPropsDotNotation, ReactComponent } from "./utils";
-import type { DotNotation, ResolveDotPath } from "./utils/dot-notation.types";
+import type { DotNotation, ResolveDotPath } from "react-native-css/utilities";
/******************************** API ********************************/
@@ -38,7 +45,7 @@ export type StyledProps> = P & {
};
export type Styled = <
- const C extends ReactComponent,
+ const C extends ReactComponent,
const M extends StyledConfiguration,
>(
component: C,
@@ -47,7 +54,7 @@ export type Styled = <
) => StyledComponent;
type StyledComponent<
- C extends ReactComponent,
+ C extends ReactComponent,
M extends StyledConfiguration,
> = ComponentType<
ComponentProps & {
@@ -62,7 +69,7 @@ type StyledComponent<
>;
export type StyledConfiguration<
- C extends ReactComponent,
+ C extends ReactComponent,
K extends string = string,
> = Record<
K,
@@ -71,10 +78,10 @@ export type StyledConfiguration<
| StyledConfigurationObject | false>
>;
-type StyledConfigurationObject<
- C extends ReactComponent,
+interface StyledConfigurationObject<
+ C extends ReactComponent,
T extends ComponentPropsDotNotation | false,
-> = {
+> {
target: T;
nativeStyleMapping?: T extends false
? NativeStyleMapping>
@@ -87,7 +94,7 @@ type StyledConfigurationObject<
ResolveDotPath>,
ComponentProps
>;
-};
+}
type NativeStyleMapping = T extends object
? {
@@ -98,9 +105,22 @@ type NativeStyleMapping = T extends object
}
: Record>;
-export type StyledOptions = {
+export interface StyledOptions {
passThrough?: boolean;
-};
+}
+
+/*************************** React Helpers ***************************/
+
+export type ReactComponent =
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
+ | ClassicComponentClass
+ | ComponentClass
+ | FunctionComponent
+ | ForwardRefExoticComponent
;
+
+export type ComponentPropsDotNotation = DotNotation<
+ ComponentProps
+>;
/******************************** Styles ********************************/
@@ -124,7 +144,7 @@ export type RNStyle = ViewStyle & TextStyle & ImageStyle;
/******************************** Globals ********************************/
-export type ColorScheme = {
+export interface ColorScheme {
get: () => ColorSchemeName;
set: (value: ColorSchemeName) => void;
-};
+}
diff --git a/src/runtime/index.ts b/src/runtime/index.ts
deleted file mode 100644
index 97a8d1e..0000000
--- a/src/runtime/index.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * An opinionated runtime for React Native CSS.
- * @module
- */
-
-export * from "./runtime";
-export type * from "./runtime.types";
diff --git a/src/runtime/native/injection.ts b/src/runtime/native/injection.ts
new file mode 100644
index 0000000..e69de29
diff --git a/src/runtime/utils/components.ts b/src/runtime/utils/components.ts
deleted file mode 100644
index 5fbb444..0000000
--- a/src/runtime/utils/components.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/* eslint-disable */
-const ForwardRefSymbol = Symbol.for("react.forward_ref");
-export function getComponentType(component: any) {
- switch (typeof component) {
- case "function":
- case "object":
- return "$$typeof" in component && component.$$typeof === ForwardRefSymbol
- ? "forwardRef"
- : component.prototype?.isReactComponent
- ? "class"
- : typeof component;
- default:
- return "unknown";
- }
-}
diff --git a/src/runtime/utils/index.ts b/src/runtime/utils/index.ts
deleted file mode 100644
index 755eb3d..0000000
--- a/src/runtime/utils/index.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export * from "./objects";
-export * from "./components";
-export * from "./specificity";
-export * from "./style-value";
-export * from "./utils.types";
diff --git a/src/runtime/utils/utils.types.ts b/src/runtime/utils/utils.types.ts
deleted file mode 100644
index 9a54a7e..0000000
--- a/src/runtime/utils/utils.types.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/* eslint-disable */
-import type {
- ClassicComponentClass,
- ComponentClass,
- ComponentProps,
- ForwardRefExoticComponent,
- FunctionComponent,
-} from "react";
-
-import type { DotNotation } from "./dot-notation.types";
-
-export type ReactComponent =
- | ClassicComponentClass
- | ComponentClass
- | FunctionComponent
- | ForwardRefExoticComponent
;
-
-export type ComponentPropsDotNotation> =
- DotNotation>;
diff --git a/src/runtime/utils/dot-notation.types.ts b/src/utilities/dot-notation.types.ts
similarity index 100%
rename from src/runtime/utils/dot-notation.types.ts
rename to src/utilities/dot-notation.types.ts
diff --git a/src/utilities/index.ts b/src/utilities/index.ts
new file mode 100644
index 0000000..0c95da6
--- /dev/null
+++ b/src/utilities/index.ts
@@ -0,0 +1,3 @@
+export * from "./specificity";
+export * from "./style-descriptor";
+export * from "./dot-notation.types";
diff --git a/src/runtime/utils/specificity.ts b/src/utilities/specificity.ts
similarity index 95%
rename from src/runtime/utils/specificity.ts
rename to src/utilities/specificity.ts
index 760f643..342f0a3 100644
--- a/src/runtime/utils/specificity.ts
+++ b/src/utilities/specificity.ts
@@ -1,5 +1,5 @@
/* eslint-disable */
-import type { SpecificityArray, StyleRule } from "../../compiler";
+import type { SpecificityArray, StyleRule } from "../compiler";
import type { InlineStyleRecord } from "../runtime.types";
export const Specificity = {
diff --git a/src/runtime/utils/style-value.ts b/src/utilities/style-descriptor.ts
similarity index 87%
rename from src/runtime/utils/style-value.ts
rename to src/utilities/style-descriptor.ts
index 2daca9e..1310d62 100644
--- a/src/runtime/utils/style-value.ts
+++ b/src/utilities/style-descriptor.ts
@@ -1,4 +1,4 @@
-import type { StyleDescriptor, StyleFunction } from "../../compiler";
+import type { StyleDescriptor, StyleFunction } from "react-native-css/compiler";
export function isStyleDescriptorArray(
value: unknown,
diff --git a/src/runtime/web/api.tsx b/src/web/api.tsx
similarity index 96%
rename from src/runtime/web/api.tsx
rename to src/web/api.tsx
index 189c249..d0ff6e2 100644
--- a/src/runtime/web/api.tsx
+++ b/src/web/api.tsx
@@ -12,8 +12,9 @@ import type {
StyledConfiguration,
StyledOptions,
StyledProps,
-} from "../runtime.types";
-import type { ReactComponent } from "../utils";
+} from "react-native-css";
+
+import type { ReactComponent } from "../runtime.types";
import { assignStyle } from "./assign-style";
export const styled = <
@@ -88,7 +89,7 @@ export function vars(variables: Record) {
}
export function VariableContextProvider(
- props: PropsWithChildren<{ value: Record<`--${string}`, string> }>,
+ props: PropsWithChildren<{ value: Record<`--${string}`, string | number> }>,
) {
const style = useMemo(() => {
return {
diff --git a/src/runtime/web/assign-style.ts b/src/web/assign-style.ts
similarity index 100%
rename from src/runtime/web/assign-style.ts
rename to src/web/assign-style.ts
diff --git a/src/runtime/web/index.ts b/src/web/index.ts
similarity index 100%
rename from src/runtime/web/index.ts
rename to src/web/index.ts
diff --git a/src/runtime/web/metro.ts b/src/web/metro.ts
similarity index 100%
rename from src/runtime/web/metro.ts
rename to src/web/metro.ts
diff --git a/yarn.lock b/yarn.lock
index 8092387..2a525ec 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2284,7 +2284,7 @@ __metadata:
languageName: node
linkType: hard
-"@expo/metro-config@npm:0.21.11, @expo/metro-config@npm:~0.21.11, @expo/metro-config@npm:~0.21.8":
+"@expo/metro-config@npm:0.21.11, @expo/metro-config@npm:~0.21.11":
version: 0.21.11
resolution: "@expo/metro-config@npm:0.21.11"
dependencies:
@@ -2352,6 +2352,40 @@ __metadata:
languageName: node
linkType: hard
+"@expo/metro-config@npm:~0.21.8":
+ version: 0.21.10
+ resolution: "@expo/metro-config@npm:0.21.10"
+ dependencies:
+ "@babel/code-frame": "npm:^7.20.0"
+ "@babel/core": "npm:^7.20.0"
+ "@babel/generator": "npm:^7.20.5"
+ "@expo/config": "npm:~12.0.7"
+ "@expo/env": "npm:~2.0.6"
+ "@expo/json-file": "npm:~10.0.6"
+ "@expo/metro": "npm:~0.1.1"
+ "@expo/spawn-async": "npm:^1.7.2"
+ browserslist: "npm:^4.25.0"
+ chalk: "npm:^4.1.0"
+ debug: "npm:^4.3.2"
+ dotenv: "npm:~16.4.5"
+ dotenv-expand: "npm:~11.0.6"
+ getenv: "npm:^2.0.0"
+ glob: "npm:^10.4.2"
+ hermes-parser: "npm:^0.29.1"
+ jsc-safe-url: "npm:^0.2.4"
+ lightningcss: "npm:~1.27.0"
+ minimatch: "npm:^9.0.0"
+ postcss: "npm:~8.4.32"
+ resolve-from: "npm:^5.0.0"
+ peerDependencies:
+ expo: "*"
+ peerDependenciesMeta:
+ expo:
+ optional: true
+ checksum: 10c0/a95ccadb674a5185a11ca3cf8ee9c3a4e414f3ee979307a422d5a38f727988194e30450463e502cb3c00050530202c5f46b58273db257b6ee0a46f8f9d047ba9
+ languageName: node
+ linkType: hard
+
"@expo/metro-runtime@npm:~6.1.1":
version: 6.1.1
resolution: "@expo/metro-runtime@npm:6.1.1"
@@ -6540,7 +6574,7 @@ __metadata:
languageName: node
linkType: hard
-"expo-file-system@npm:~19.0.10, expo-file-system@npm:~19.0.8":
+"expo-file-system@npm:~19.0.10":
version: 19.0.10
resolution: "expo-file-system@npm:19.0.10"
peerDependencies:
@@ -6550,6 +6584,16 @@ __metadata:
languageName: node
linkType: hard
+"expo-file-system@npm:~19.0.8":
+ version: 19.0.9
+ resolution: "expo-file-system@npm:19.0.9"
+ peerDependencies:
+ expo: "*"
+ react-native: "*"
+ checksum: 10c0/bb49e603a116e163765d35a8c13a2cd86667dc2e3899add964e8ce2e18f78a6405fb353fafb45a8010990b07da6cfe2bbfcf933978423fed2fcd948e8ce7e909
+ languageName: node
+ linkType: hard
+
"expo-font@npm:~14.0.7":
version: 14.0.7
resolution: "expo-font@npm:14.0.7"
@@ -11132,6 +11176,7 @@ __metadata:
react-dom: "npm:19.1.0"
react-native: "npm:0.81.1"
react-native-builder-bob: "npm:^0.40.13"
+ react-native-css: "link:../"
react-native-monorepo-config: "npm:^0.1.9"
react-native-reanimated: "npm:4.0.2"
react-native-web: "npm:~0.21.1"
@@ -11140,6 +11185,12 @@ __metadata:
languageName: unknown
linkType: soft
+"react-native-css@link:../::locator=react-native-css-example%40workspace%3Aexample":
+ version: 0.0.0-use.local
+ resolution: "react-native-css@link:../::locator=react-native-css-example%40workspace%3Aexample"
+ languageName: node
+ linkType: soft
+
"react-native-css@workspace:.":
version: 0.0.0-use.local
resolution: "react-native-css@workspace:."