From 832c0745ff2449ff8a02888f8cf16f426905c267 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Tue, 22 Nov 2022 23:28:15 +0900 Subject: [PATCH] Fix imports --- README.md | 11 +++++++++++ packages/yoshiki/.npmignore | 4 +--- packages/yoshiki/index.ts | 2 +- packages/yoshiki/native.ts | 2 +- packages/yoshiki/package.json | 2 +- packages/yoshiki/src/native/generator.tsx | 16 ++++++++++++++-- packages/yoshiki/src/type.ts | 4 +++- packages/yoshiki/tsconfig.json | 2 +- packages/yoshiki/web.ts | 2 +- 9 files changed, 34 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 54297c9..2050c40 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,17 @@ - Atomic CSS generation - SSR support +## Installation + +As any other npm package, simply run + +``yarn add yoshiki`` + +or + +``npm install --save yoshiki`` + + ## Usage ```tsx diff --git a/packages/yoshiki/.npmignore b/packages/yoshiki/.npmignore index c6c0147..7572a78 100644 --- a/packages/yoshiki/.npmignore +++ b/packages/yoshiki/.npmignore @@ -1,4 +1,2 @@ +package.tgz tsconfig.tsbuildinfo -/index.ts -/web.ts -/native.ts diff --git a/packages/yoshiki/index.ts b/packages/yoshiki/index.ts index 61423ec..4520e6d 100644 --- a/packages/yoshiki/index.ts +++ b/packages/yoshiki/index.ts @@ -3,4 +3,4 @@ // Licensed under the MIT license. See LICENSE file in the project root for details. // -export * from "./src"; +export * from "./dist"; diff --git a/packages/yoshiki/native.ts b/packages/yoshiki/native.ts index 30164d1..266f5a2 100644 --- a/packages/yoshiki/native.ts +++ b/packages/yoshiki/native.ts @@ -3,4 +3,4 @@ // Licensed under the MIT license. See LICENSE file in the project root for details. // -export * from "./src/native"; +export * from "./dist/native"; diff --git a/packages/yoshiki/package.json b/packages/yoshiki/package.json index dd792c2..04be442 100644 --- a/packages/yoshiki/package.json +++ b/packages/yoshiki/package.json @@ -1,6 +1,6 @@ { "name": "yoshiki", - "version": "0.1.1", + "version": "0.1.4", "author": "Zoe Roux (https://github.com/AnonymusRaccoon)", "license": "MIT", "keywords": [ diff --git a/packages/yoshiki/src/native/generator.tsx b/packages/yoshiki/src/native/generator.tsx index 56538b3..5be6cae 100644 --- a/packages/yoshiki/src/native/generator.tsx +++ b/packages/yoshiki/src/native/generator.tsx @@ -5,14 +5,26 @@ import { ViewStyle, TextStyle, ImageStyle, useWindowDimensions } from "react-native"; import { breakpoints, Theme, useTheme } from "../theme"; -import { AtLeastOne, Breakpoints, WithState, YoshikiStyle, hasState } from "../type"; +import { + AtLeastOne, + Breakpoints, + FilterOr, + WithState, + YoshikiStyle, + hasState, + Length, +} from "../type"; import { isBreakpoints } from "../utils"; import { shorthandsFn } from "../shorthands"; export type EnhancedStyle = { [key in keyof Properties]: YoshikiStyle; } & { - [key in keyof typeof shorthandsFn]?: Parameters[0]; + [key in keyof typeof shorthandsFn]?: FilterOr< + Parameters[0], + Length, + number + >; }; const useBreakpoint = (): number => { diff --git a/packages/yoshiki/src/type.ts b/packages/yoshiki/src/type.ts index d506cbc..5d4e3c7 100644 --- a/packages/yoshiki/src/type.ts +++ b/packages/yoshiki/src/type.ts @@ -33,7 +33,9 @@ export type Length = { a: 1 }; export type CssProperties = _CssProperties<0 | Length>; type FilterOrNever = T extends Filter ? Filter : never; -type FilterOr = [FilterOrNever] extends [never] ? T : Filter; +export type FilterOr = [FilterOrNever] extends [never] + ? T + : Replacement; type CombineWithLength = { [key in keyof A & keyof B]?: FilterOr<(A & B)[key], Length>; diff --git a/packages/yoshiki/tsconfig.json b/packages/yoshiki/tsconfig.json index f4a017e..e79fa2f 100755 --- a/packages/yoshiki/tsconfig.json +++ b/packages/yoshiki/tsconfig.json @@ -19,5 +19,5 @@ "outDir": "dist/" }, "include": ["src/**/*.ts", "src/**/*.tsx"], - "exclude": ["node_modules"] + "exclude": ["node_modules", "dist"] } diff --git a/packages/yoshiki/web.ts b/packages/yoshiki/web.ts index cf1c7c8..7c73a9b 100644 --- a/packages/yoshiki/web.ts +++ b/packages/yoshiki/web.ts @@ -3,4 +3,4 @@ // Licensed under the MIT license. See LICENSE file in the project root for details. // -export * from "./src/web"; +export * from "./dist/web";