diff --git a/examples/expo-example/src/app.tsx b/examples/expo-example/src/app.tsx index 8b6f434..165dae4 100644 --- a/examples/expo-example/src/app.tsx +++ b/examples/expo-example/src/app.tsx @@ -12,7 +12,7 @@ const CustomBox = ({ color, ...props }: { color: string } & Stylable) => { const { css } = useYoshiki(); return ( - + Text inside the custom black box. ); @@ -26,7 +26,7 @@ const BoxWithoutProps = (props: Stylable) => { {...css( { backgroundColor: { xs: "#00ff00", md: "#ff0000" }, - hover: { alignContent: "center" }, + hover: { alignContent: "center", alignItems: "center" }, press: { alignContent: "center" }, focus: { alignContent: "center" }, }, @@ -34,13 +34,9 @@ const BoxWithoutProps = (props: Stylable) => { )} > Text inside the box without props (green on small screens, red on bigs) diff --git a/examples/next-example/src/pages/_app.tsx b/examples/next-example/src/pages/_app.tsx index 2cf3f62..9a9a8da 100644 --- a/examples/next-example/src/pages/_app.tsx +++ b/examples/next-example/src/pages/_app.tsx @@ -3,9 +3,9 @@ // Licensed under the MIT license. See LICENSE file in the project root for details. // -import { Theme, ThemeProvider, useYoshiki } from "yoshiki"; +import { Theme, ThemeProvider } from "yoshiki"; +import { useYoshiki, useMobileHover } from "yoshiki/web"; import { AppProps } from "next/app"; -import { useMobileHover } from "yoshiki"; declare module "yoshiki" { export interface Theme { diff --git a/examples/next-example/src/pages/_document.tsx b/examples/next-example/src/pages/_document.tsx index e464e33..0b0efe4 100644 --- a/examples/next-example/src/pages/_document.tsx +++ b/examples/next-example/src/pages/_document.tsx @@ -3,7 +3,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for details. // -import { StyleRegistryProvider, createStyleRegistry } from "yoshiki"; +import { StyleRegistryProvider, createStyleRegistry } from "yoshiki/web"; import Document, { DocumentContext } from "next/document"; Document.getInitialProps = async (ctx: DocumentContext) => { diff --git a/examples/next-example/src/pages/index.tsx b/examples/next-example/src/pages/index.tsx index 80a4c1f..efc4408 100644 --- a/examples/next-example/src/pages/index.tsx +++ b/examples/next-example/src/pages/index.tsx @@ -5,7 +5,7 @@ import Head from "next/head"; import Image from "next/image"; -import { useYoshiki, Stylable } from "yoshiki"; +import { useYoshiki, Stylable } from "yoshiki/web"; import { ReactNode } from "react"; const Box = ({ children, ...props }: { children?: ReactNode } & Stylable) => { diff --git a/packages/yoshiki/src/index.ts b/packages/yoshiki/src/index.ts index 1d7b11f..ae8ef0d 100644 --- a/packages/yoshiki/src/index.ts +++ b/packages/yoshiki/src/index.ts @@ -3,14 +3,38 @@ // Licensed under the MIT license. See LICENSE file in the project root for details. // -export { type Theme, breakpoints, useTheme, ThemeProvider } from "./theme"; +import { + useYoshiki as useWebYoshiki, + type Stylable as WebStylable, + type StylableHoverable as WebStylableHoverable, +} from "./web"; +import type { + Stylable as NativeStylable, + StylableHoverable as NativeStylableHoverable, +} from "./native"; -export { - useYoshiki, - useStyleRegistry, - StyleRegistryProvider, - createStyleRegistry, - type Stylable, - useMobileHover, - Pressable -} from "./react"; +import { YsStyleProps } from "./native/generator"; +import { Theme } from "./theme"; +import { WithState, EnhancedStyle } from "./type"; +import type { ViewStyle, ImageStyle, TextStyle } from "react-native"; + +export const useYoshiki = (): { + css: < + Style extends ViewStyle | TextStyle | ImageStyle, + State extends Partial>> | Record, + >( + style: EnhancedStyle