Comparing version 4.0.2 to 4.1.0
@@ -33,5 +33,9 @@ import type { ThemeUICSSProperties } from '@theme-ui/css'; | ||
}; | ||
type DotPath<T> = keyof { | ||
[K in keyof T as `${Extract<K, string>}.${Extract<keyof T[K], string>}`]: undefined; | ||
}; | ||
type ValueOf<T> = T[keyof T]; | ||
type DotPath<T> = ValueOf<{ | ||
[K in keyof T]: `${Extract<K, string | number>}.${Extract<keyof T[K], string | number>}`; | ||
}>; | ||
type DotPathOrKeyOf<T> = ValueOf<{ | ||
[K in keyof T]: T[K] extends Record<string | number, string> ? `${Extract<K, string | number>}.${Extract<keyof T[K], string | number>}` : K; | ||
}>; | ||
export type Variant = DotPath<AllVariantSets>; | ||
@@ -48,3 +52,3 @@ export type Sx = { | ||
type MaybeTokensObjectFromScale<Key extends Scales[keyof Scales]> = Key extends keyof DripsyFinalTheme ? DripsyFinalTheme[Key] : never; | ||
type MaybeTokenOptionsFromScale<Key extends Scales[keyof Scales] | undefined> = Key extends Scales[keyof Scales] ? MaybeTokensObjectFromScale<Key> extends Record<string, unknown> ? `${Extract<keyof MaybeTokensObjectFromScale<Key>, string>}` : undefined : undefined; | ||
type MaybeTokenOptionsFromScale<Key extends Scales[keyof Scales] | undefined> = Key extends Scales[keyof Scales] ? MaybeTokensObjectFromScale<Key> extends Record<string, unknown> ? `${Exclude<DotPathOrKeyOf<MaybeTokensObjectFromScale<Key>>, symbol>}` : undefined : undefined; | ||
type MaybeTokenFromStyleKey<StyleKey extends StyleableSxProperties> = MaybeScaleFromStyleKeyOrAlias<StyleKey> extends undefined ? undefined : MaybeTokenOptionsFromScale<MaybeScaleFromStyleKeyOrAlias<StyleKey>>; | ||
@@ -51,0 +55,0 @@ export type MaybeVariantsFromThemeKey<ThemeKey extends keyof DripsyFinalTheme | undefined> = ThemeKey extends keyof DripsyFinalTheme ? DripsyFinalTheme[ThemeKey] extends Record<string, unknown> ? Extract<keyof DripsyFinalTheme[ThemeKey], string> : undefined : undefined; |
@@ -14,2 +14,3 @@ import { makeTheme, } from './declarations'; | ||
flex: 1, | ||
color: '$nested.100', | ||
shadowOffset: { | ||
@@ -25,2 +26,6 @@ height: 10, | ||
$text: 'color', | ||
$nested: { | ||
100: 'red', | ||
200: 'blue', | ||
}, | ||
}, | ||
@@ -27,0 +32,0 @@ space: { |
@@ -6,2 +6,19 @@ # Change Log | ||
# [4.1.0](https://github.com/nandorojo/dripsy/compare/v4.0.0...v4.1.0) (2023-04-12) | ||
### Bug Fixes | ||
* pressable types ([a33a05c](https://github.com/nandorojo/dripsy/commit/a33a05cb62f4d4ae8640e67c123d77fb551be746)) | ||
* transforms ([f662761](https://github.com/nandorojo/dripsy/commit/f662761a205480e4f04f7e8ce51b7cfe331eeeda)) | ||
### Features | ||
* dot path theme tokens ([e8272cd](https://github.com/nandorojo/dripsy/commit/e8272cd46261a34554c16fd370a536c5514e1312)) | ||
## [4.0.2](https://github.com/nandorojo/dripsy/compare/v4.0.0...v4.0.2) (2023-04-05) | ||
@@ -8,0 +25,0 @@ |
{ | ||
"name": "dripsy", | ||
"version": "4.0.2", | ||
"version": "4.1.0", | ||
"description": "🍷 A super-simple responsive design system for React Native Web.", | ||
@@ -89,3 +89,3 @@ "main": "build/index.js", | ||
"sideEffects": false, | ||
"gitHead": "ec4e56f10a2c9790d8790f550f8cb45654709171" | ||
"gitHead": "e8272cd46261a34554c16fd370a536c5514e1312" | ||
} |
@@ -149,9 +149,32 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ | ||
type DotPath<T> = keyof { | ||
[K in keyof T as `${Extract<K, string>}.${Extract< | ||
keyof T[K], | ||
string | ||
>}`]: undefined | ||
} | ||
type ValueOf<T> = T[keyof T] | ||
type DotPath<T> = ValueOf< | ||
{ | ||
[K in keyof T]: `${Extract<K, string | number>}.${Extract< | ||
keyof T[K], | ||
string | number | ||
>}` | ||
} | ||
> | ||
type DotPathOrKeyOf<T> = ValueOf< | ||
{ | ||
[K in keyof T]: T[K] extends Record<string | number, string> | ||
? `${Extract<K, string | number>}.${Extract<keyof T[K], string | number>}` | ||
: K | ||
} | ||
> | ||
type DotPathOrKeyofTest = AssertEqual< | ||
DotPathOrKeyOf<TestTheme['colors']>, | ||
'$nested.100' | ||
> | ||
type DotPathColors = DotPathOrKeyOf<{ | ||
$here: { | ||
100: 1 | ||
} | ||
}> | ||
export type Variant = DotPath<AllVariantSets> | ||
@@ -183,2 +206,3 @@ | ||
flex: 1, | ||
color: '$nested.100', | ||
shadowOffset: { | ||
@@ -248,2 +272,6 @@ height: 10, | ||
$text: 'color', | ||
$nested: { | ||
100: 'red', | ||
200: 'blue', | ||
}, | ||
}, | ||
@@ -270,3 +298,2 @@ space: { | ||
// remember to comment this out before pushing | ||
// declare module './declarations' { | ||
@@ -292,3 +319,4 @@ // // @ts-expect-error leave this here so we remember to comment out lol | ||
? MaybeTokensObjectFromScale<Key> extends Record<string, unknown> | ||
? `${Extract<keyof MaybeTokensObjectFromScale<Key>, string>}` | ||
? // ? `${Extract<keyof MaybeTokensObjectFromScale<Key>, string>}` | ||
`${Exclude<DotPathOrKeyOf<MaybeTokensObjectFromScale<Key>>, symbol>}` | ||
: undefined | ||
@@ -308,6 +336,6 @@ : undefined | ||
type MaybeTokenOptionsFromStyleKeyTest = AssertEqual< | ||
MaybeTokenFromStyleKey<'bg'>, | ||
keyof DripsyFinalTheme['colors'] | ||
> | ||
// type MaybeTokenOptionsFromStyleKeyTest = AssertEqual< | ||
// MaybeTokenFromStyleKey<'bg'>, | ||
// keyof DripsyFinalTheme['colors'] | ||
// > | ||
@@ -314,0 +342,0 @@ // type MaybeTokenOptionsFromStyleKeyTest2 = AssertEqual< |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
301845
4490