@fastkit/color-scheme
Advanced tools
Comparing version
@@ -1,5 +0,4 @@ | ||
import { Color } from '@fastkit/color'; | ||
import { ColorSource } from '@fastkit/color'; | ||
import { ColorSource, Color } from '@fastkit/color'; | ||
declare interface Bucket<RN, T, G, C, J> { | ||
interface Bucket<RN, T, G, C, J> { | ||
/** | ||
@@ -101,19 +100,23 @@ * Returns the index of the first occurrence of a value in an array, or -1 if it is not present. | ||
export declare const BULTIN_COLOR_VARIANTS: readonly ["contained", "outlined", "inverted", "plain"]; | ||
export declare type BultinColorVariant = typeof BULTIN_COLOR_VARIANTS[number]; | ||
export declare const COLOR_SCOPE_DEFAULTS_KEYS: readonly ["default", "disabled"]; | ||
export declare interface ColorPaletteBucket<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey, T = ColorPaletteItem<TN, PN, SN, VN, OK>, C = ColorPaletteContext<TN, PN, SN, VN, OK>, J = ColorPaletteItemJSON<PN>[]> extends Bucket<PN, T, Color, C, J> { | ||
sources: ColorPaletteContext<TN, PN, SN, VN, OK>[]; | ||
ctx: C; | ||
type ColorScopeOptionalKey<T extends string | readonly string[] = string> = T extends string ? T : T[number]; | ||
interface ColorPaletteItemContext<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> { | ||
readonly scheme: ColorScheme<TN, PN, SN, VN, OK>; | ||
readonly theme: ColorTheme<TN, PN, SN, VN, OK>; | ||
readonly palette: ColorPaletteBucket<TN, PN, SN, VN, OK>; | ||
} | ||
export declare interface ColorPaletteContext<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> { | ||
type ColorPaletteItemResolver<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = (ctx: ColorPaletteItemContext<TN, PN, SN, VN, OK>) => ColorSource; | ||
type ColorPaletteItemSource<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = [PN, ColorSource | ColorPaletteItemResolver<TN, PN, SN, VN, OK>]; | ||
type ColorPaletteItemJSON<PN extends string = string> = { | ||
name: PN; | ||
value: string; | ||
}; | ||
interface ColorPaletteContext<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> { | ||
readonly scheme: ColorScheme<TN, PN, SN, VN, OK>; | ||
readonly theme: ColorTheme<TN, PN, SN, VN, OK>; | ||
} | ||
export declare type ColorPaletteItem<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
interface ColorPaletteBucket<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey, T = ColorPaletteItem<TN, PN, SN, VN, OK>, C = ColorPaletteContext<TN, PN, SN, VN, OK>, J = ColorPaletteItemJSON<PN>[]> extends Bucket<PN, T, Color, C, J> { | ||
sources: ColorPaletteContext<TN, PN, SN, VN, OK>[]; | ||
ctx: C; | ||
} | ||
type ColorPaletteItem<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
readonly source: ColorPaletteItemSource<TN, PN, SN, VN, OK>; | ||
@@ -128,4 +131,3 @@ readonly name: PN; | ||
}; | ||
export declare interface ColorPaletteItemContext<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> { | ||
interface ColorScopesContext<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> { | ||
readonly scheme: ColorScheme<TN, PN, SN, VN, OK>; | ||
@@ -135,48 +137,35 @@ readonly theme: ColorTheme<TN, PN, SN, VN, OK>; | ||
} | ||
export declare type ColorPaletteItemJSON<PN extends string = string> = { | ||
name: PN; | ||
value: string; | ||
}; | ||
export declare type ColorPaletteItemResolver<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = (ctx: ColorPaletteItemContext<TN, PN, SN, VN, OK>) => ColorSource; | ||
export declare type ColorPaletteItemSource<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = [PN, ColorSource | ColorPaletteItemResolver<TN, PN, SN, VN, OK>]; | ||
export declare interface ColorScheme<TN extends string, PN extends string, SN extends string, VN extends string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> extends ColorSchemeInfo<TN, PN, SN, VN> { | ||
readonly variantSources: ColorVariantSource<VN>[]; | ||
readonly optionals: OK[]; | ||
readonly source: ColorSchemeSource<TN, PN, SN, VN, OK>; | ||
readonly themes: ColorThemeBucket<TN, PN, SN, VN, OK>; | ||
readonly scopeResolvers: ColorScopeResolvers<TN, PN, SN, VN, OK>; | ||
toJSON(): ColorSchemeJSON<TN, PN, SN, VN, OK>; | ||
interface ColorScopesBucket<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey, T = ColorScope<TN, PN, SN, VN, OK>, C = ColorScopesContext<TN, PN, SN, VN, OK>, J = ColorScopeJSON<SN, OK>[]> extends Bucket<SN, T, T, C, J> { | ||
sources: ColorScopeSource<TN, PN, SN, VN, OK>[]; | ||
ctx: C; | ||
} | ||
export declare interface ColorSchemeInfo<TN extends string, PN extends string, SN extends string, VN extends string> { | ||
readonly defaultTheme: TN; | ||
readonly themeNames: TN[]; | ||
readonly paletteNames: PN[]; | ||
readonly scopeNames: SN[]; | ||
readonly variants: VN[]; | ||
interface ColorScopeContext<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> { | ||
readonly scheme: ColorScheme<TN, PN, SN, VN, OK>; | ||
readonly theme: ColorTheme<TN, PN, SN, VN, OK>; | ||
readonly palette: ColorPaletteBucket<TN, PN, SN, VN, OK>; | ||
readonly scopes: ColorScopesBucket<TN, PN, SN, VN, OK>; | ||
} | ||
export declare function colorSchemeInfoByScheme<TN extends string, PN extends string, SN extends string, VN extends string>(scheme: ColorScheme<TN, PN, SN, VN, string>): ColorSchemeInfo<TN, PN, SN, VN>; | ||
export declare interface ColorSchemeJSON<TN extends string, PN extends string, SN extends string, VN extends string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> { | ||
optionals?: OK[]; | ||
themeNames: TN[]; | ||
paletteNames: PN[]; | ||
scopeNames: SN[]; | ||
variants: VN[]; | ||
themes: ColorThemeJSON<TN, PN, SN, VN, OK>[]; | ||
} | ||
export declare interface ColorSchemeSource<TN extends string, PN extends string, SN extends string, VN extends string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> { | ||
readonly variants?: readonly RawColorVariantSource<VN>[]; | ||
readonly optionals?: readonly OK[]; | ||
readonly scopeResolvers?: ColorScopeResolvers<TN, PN, SN, VN, OK> | (() => ColorScopeResolvers<TN, PN, SN, VN, OK>); | ||
readonly themes: ColorThemeSource<TN, PN, SN, VN, OK>[]; | ||
} | ||
export declare type ColorScope<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
type ColorScopeResolverResult = ColorSource | void | null | false; | ||
type ColorScopeResolver<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = (ctx: ColorScopeContext<TN, PN, SN, VN, OK> & ColorScope<TN, PN, SN, VN, OK>) => ColorScopeResolverResult; | ||
type ColorScopeResolvers<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
[K in OK]?: ColorScopeResolver<TN, PN, SN, VN, OK> | null | false; | ||
}; | ||
type ColorScopeOptionalValueMap<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey, T extends ColorSource | ColorScopeResolver<TN, PN, SN, VN, OK> = ColorSource | ColorScopeResolver<TN, PN, SN, VN, OK>> = { | ||
readonly [K in OK]?: T; | ||
}; | ||
type ColorScopeSource<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = [SN, ColorSource | ColorScopeResolver<TN, PN, SN, VN, OK>] | [ | ||
SN, | ||
ColorSource | ColorScopeResolver<TN, PN, SN, VN, OK>, | ||
ColorScopeOptionalValueMap<TN, PN, SN, VN, OK, ColorSource | ColorScopeResolver<TN, PN, SN, VN, OK>> | ||
]; | ||
type ColorScopeJSON<SN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
name: SN; | ||
main: string; | ||
} & { | ||
[K in OK]?: string; | ||
}; | ||
type ColorScopeOptionals<OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
readonly [K in OK]?: Color; | ||
}; | ||
type ColorScope<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
readonly scheme: ColorScheme<TN, PN, SN, VN, OK>; | ||
@@ -193,11 +182,14 @@ readonly theme: ColorTheme<TN, PN, SN, VN, OK>; | ||
} & ColorScopeOptionals<OK>; | ||
export declare interface ColorScopeContext<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> { | ||
readonly scheme: ColorScheme<TN, PN, SN, VN, OK>; | ||
readonly theme: ColorTheme<TN, PN, SN, VN, OK>; | ||
readonly palette: ColorPaletteBucket<TN, PN, SN, VN, OK>; | ||
readonly scopes: ColorScopesBucket<TN, PN, SN, VN, OK>; | ||
} | ||
export declare type ColorScopeDefault<TN extends string, PN extends string, SN extends string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
type ColorScopeDefaultSource<OK extends ColorScopeOptionalKey = ColorScopeOptionalKey, T extends ColorSource = ColorSource> = [T] | [ | ||
T, | ||
{ | ||
readonly [K in OK]?: T; | ||
} | ||
]; | ||
type ColorScopeDefaultJSON<OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
main: string; | ||
} & { | ||
[K in OK]?: string; | ||
}; | ||
type ColorScopeDefault<TN extends string, PN extends string, SN extends string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
theme: ColorTheme<TN, PN, SN, VN, OK>; | ||
@@ -211,82 +203,38 @@ palette: ColorPaletteBucket<TN, PN, SN, VN, OK>; | ||
}; | ||
export declare type ColorScopeDefaultJSON<OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
main: string; | ||
} & { | ||
[K in OK]?: string; | ||
}; | ||
export declare type ColorScopeDefaultResolver<TN extends string, PN extends string, SN extends string, VN extends string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = (ctx: ColorScopeDefault<TN, PN, SN, VN, OK>) => ColorScopeDefaultSource<OK> | null | false | void; | ||
export declare type ColorScopeDefaults<TN extends string, PN extends string, SN extends string, VN extends string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
[K in ColorScopeDefaultsKey]?: ColorScopeDefault<TN, PN, SN, VN, OK>; | ||
} & { | ||
toJSON(): ColorScopeDefaultsJSON<OK>; | ||
}; | ||
export declare type ColorScopeDefaultsJSON<OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
[K in ColorScopeDefaultsKey]?: ColorScopeDefaultJSON<OK>; | ||
}; | ||
export declare type ColorScopeDefaultsKey = typeof COLOR_SCOPE_DEFAULTS_KEYS[number]; | ||
export declare type ColorScopeDefaultSource<OK extends ColorScopeOptionalKey = ColorScopeOptionalKey, T extends ColorSource = ColorSource> = [T] | [ | ||
T, | ||
{ | ||
readonly [K in OK]?: T; | ||
} | ||
]; | ||
export declare type ColorScopeDefaultsResolver<TN extends string, PN extends string, SN extends string, VN extends string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = (ctx: { | ||
type ColorScopeDefaultResolver<TN extends string, PN extends string, SN extends string, VN extends string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = (ctx: ColorScopeDefault<TN, PN, SN, VN, OK>) => ColorScopeDefaultSource<OK> | null | false | void; | ||
type ColorScopeDefaultsResolver<TN extends string, PN extends string, SN extends string, VN extends string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = (ctx: { | ||
theme: ColorTheme<TN, PN, SN, VN, OK>; | ||
palette: ColorPaletteBucket<TN, PN, SN, VN, OK>; | ||
}) => ColorScopeDefaultsSource<TN, PN, SN, VN, OK> | null | false | void; | ||
export declare type ColorScopeDefaultsSource<TN extends string, PN extends string, SN extends string, VN extends string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
declare const COLOR_SCOPE_DEFAULTS_KEYS: readonly ["default", "disabled"]; | ||
type ColorScopeDefaultsKey = (typeof COLOR_SCOPE_DEFAULTS_KEYS)[number]; | ||
type ColorScopeDefaultsSource<TN extends string, PN extends string, SN extends string, VN extends string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
[K in ColorScopeDefaultsKey]?: ColorScopeDefaultSource<OK> | ColorScopeDefaultResolver<TN, PN, SN, VN, OK>; | ||
}; | ||
export declare type ColorScopeJSON<SN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
name: SN; | ||
main: string; | ||
type ColorScopeDefaultsJSON<OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
[K in ColorScopeDefaultsKey]?: ColorScopeDefaultJSON<OK>; | ||
}; | ||
type ColorScopeDefaults<TN extends string, PN extends string, SN extends string, VN extends string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
[K in ColorScopeDefaultsKey]?: ColorScopeDefault<TN, PN, SN, VN, OK>; | ||
} & { | ||
[K in OK]?: string; | ||
toJSON(): ColorScopeDefaultsJSON<OK>; | ||
}; | ||
export declare type ColorScopeOptionalKey<T extends string | readonly string[] = string> = T extends string ? T : T[number]; | ||
export declare type ColorScopeOptionals<OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
readonly [K in OK]?: Color; | ||
interface ColorThemeSource<TN extends string, PN extends string, SN extends string, VN extends string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> { | ||
readonly name: TN; | ||
readonly palette?: ColorPaletteItemSource<TN, PN, SN, VN, OK>[]; | ||
readonly scopes?: ColorScopeSource<TN, PN, SN, VN, OK>[]; | ||
readonly scopeDefaults?: ColorScopeDefaultsSource<TN, PN, SN, VN, OK> | ColorScopeDefaultsResolver<TN, PN, SN, VN, OK>; | ||
readonly scopeResolvers?: ColorScopeResolvers<TN, PN, SN, VN, OK> | (() => ColorScopeResolvers<TN, PN, SN, VN, OK>); | ||
} | ||
type ColorThemeJSON<TN extends string, PN extends string, SN extends string, VN extends string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
name: TN; | ||
palette: ColorPaletteItemJSON<PN>[]; | ||
scopes: ColorScopeJSON<SN, OK>[]; | ||
scopeDefaults?: ColorScopeDefaultsJSON<OK>; | ||
}; | ||
export declare type ColorScopeOptionalValueMap<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey, T extends ColorSource | ColorScopeResolver<TN, PN, SN, VN, OK> = ColorSource | ColorScopeResolver<TN, PN, SN, VN, OK>> = { | ||
readonly [K in OK]?: T; | ||
}; | ||
export declare type ColorScopeResolver<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = (ctx: ColorScopeContext<TN, PN, SN, VN, OK> & ColorScope<TN, PN, SN, VN, OK>) => ColorScopeResolverResult; | ||
export declare type ColorScopeResolverResult = ColorSource | void | null | false; | ||
export declare type ColorScopeResolvers<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
[K in OK]?: ColorScopeResolver<TN, PN, SN, VN, OK> | null | false; | ||
}; | ||
export declare interface ColorScopesBucket<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey, T = ColorScope<TN, PN, SN, VN, OK>, C = ColorScopesContext<TN, PN, SN, VN, OK>, J = ColorScopeJSON<SN, OK>[]> extends Bucket<SN, T, T, C, J> { | ||
sources: ColorScopeSource<TN, PN, SN, VN, OK>[]; | ||
ctx: C; | ||
} | ||
export declare interface ColorScopesContext<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> { | ||
interface ColorThemeContext<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> { | ||
readonly scheme: ColorScheme<TN, PN, SN, VN, OK>; | ||
readonly theme: ColorTheme<TN, PN, SN, VN, OK>; | ||
readonly palette: ColorPaletteBucket<TN, PN, SN, VN, OK>; | ||
readonly themes: ColorThemeBucket<TN, PN, SN, VN, OK>; | ||
} | ||
export declare type ColorScopeSource<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = [SN, ColorSource | ColorScopeResolver<TN, PN, SN, VN, OK>] | [ | ||
SN, | ||
ColorSource | ColorScopeResolver<TN, PN, SN, VN, OK>, | ||
ColorScopeOptionalValueMap<TN, PN, SN, VN, OK, ColorSource | ColorScopeResolver<TN, PN, SN, VN, OK>> | ||
]; | ||
export declare type ColorTheme<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
type ColorTheme<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
readonly source: ColorThemeSource<TN, PN, SN, VN, OK>; | ||
@@ -306,60 +254,61 @@ readonly ctx: ColorThemeContext<TN, PN, SN, VN, OK>; | ||
}; | ||
export declare interface ColorThemeBucket<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey, T = ColorTheme<TN, PN, SN, VN, OK>, C = ColorThemesContext<TN, PN, SN, VN, OK>, J = ColorThemeJSON<TN, PN, SN, VN, OK>[]> extends Bucket<TN, T, T, C, J> { | ||
interface ColorThemesContext<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> { | ||
readonly scheme: ColorScheme<TN, PN, SN, VN, OK>; | ||
} | ||
interface ColorThemeBucket<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey, T = ColorTheme<TN, PN, SN, VN, OK>, C = ColorThemesContext<TN, PN, SN, VN, OK>, J = ColorThemeJSON<TN, PN, SN, VN, OK>[]> extends Bucket<TN, T, T, C, J> { | ||
sources: ColorThemeSource<TN, PN, SN, VN, OK>[]; | ||
ctx: C; | ||
} | ||
export declare interface ColorThemeContext<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> { | ||
readonly scheme: ColorScheme<TN, PN, SN, VN, OK>; | ||
readonly themes: ColorThemeBucket<TN, PN, SN, VN, OK>; | ||
declare const BULTIN_COLOR_VARIANTS: readonly ["contained", "outlined", "inverted", "plain"]; | ||
type BultinColorVariant = (typeof BULTIN_COLOR_VARIANTS)[number]; | ||
interface ColorVariantSource<VN extends string> { | ||
readonly name: VN; | ||
from?: BultinColorVariant; | ||
scss?: string | Promise<string> | ((scope: TemplateScope) => string | Promise<string>); | ||
} | ||
export declare type ColorThemeJSON<TN extends string, PN extends string, SN extends string, VN extends string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> = { | ||
name: TN; | ||
palette: ColorPaletteItemJSON<PN>[]; | ||
scopes: ColorScopeJSON<SN, OK>[]; | ||
scopeDefaults?: ColorScopeDefaultsJSON<OK>; | ||
}; | ||
export declare interface ColorThemesContext<TN extends string = string, PN extends string = string, SN extends string = string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> { | ||
readonly scheme: ColorScheme<TN, PN, SN, VN, OK>; | ||
} | ||
export declare interface ColorThemeSource<TN extends string, PN extends string, SN extends string, VN extends string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> { | ||
readonly name: TN; | ||
readonly palette?: ColorPaletteItemSource<TN, PN, SN, VN, OK>[]; | ||
readonly scopes?: ColorScopeSource<TN, PN, SN, VN, OK>[]; | ||
readonly scopeDefaults?: ColorScopeDefaultsSource<TN, PN, SN, VN, OK> | ColorScopeDefaultsResolver<TN, PN, SN, VN, OK>; | ||
type RawColorVariantSource<VN extends string> = VN | ColorVariantSource<VN>; | ||
interface ColorSchemeSource<TN extends string, PN extends string, SN extends string, VN extends string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> { | ||
readonly variants?: readonly RawColorVariantSource<VN>[]; | ||
readonly optionals?: readonly OK[]; | ||
readonly scopeResolvers?: ColorScopeResolvers<TN, PN, SN, VN, OK> | (() => ColorScopeResolvers<TN, PN, SN, VN, OK>); | ||
readonly themes: ColorThemeSource<TN, PN, SN, VN, OK>[]; | ||
} | ||
export declare type ColorVariant = ExtractKeys<ColorVariantSettings, '__ColorVariant__'>; | ||
export declare interface ColorVariantSettings { | ||
interface ColorSchemeJSON<TN extends string, PN extends string, SN extends string, VN extends string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> { | ||
optionals?: OK[]; | ||
themeNames: TN[]; | ||
paletteNames: PN[]; | ||
scopeNames: SN[]; | ||
variants: VN[]; | ||
themes: ColorThemeJSON<TN, PN, SN, VN, OK>[]; | ||
} | ||
export declare interface ColorVariantSource<VN extends string> { | ||
readonly name: VN; | ||
from?: BultinColorVariant; | ||
scss?: string | Promise<string> | ((scope: TemplateScope) => string | Promise<string>); | ||
interface ColorSchemeInfo<TN extends string, PN extends string, SN extends string, VN extends string> { | ||
readonly defaultTheme: TN; | ||
readonly themeNames: TN[]; | ||
readonly paletteNames: PN[]; | ||
readonly scopeNames: SN[]; | ||
readonly variants: VN[]; | ||
} | ||
export declare function createColorScheme<TN extends string, PN extends string, SN extends string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey>(source: ColorSchemeSource<TN, PN, SN, VN, OK>): ColorScheme<TN, PN, SN, VN, OK>; | ||
declare type ExtractKeys<T extends object, D> = keyof T extends never ? D : keyof T; | ||
export declare type PaletteName = ExtractKeys<PaletteSettings, '__PaletteName__'>; | ||
export declare interface PaletteSettings { | ||
declare function colorSchemeInfoByScheme<TN extends string, PN extends string, SN extends string, VN extends string>(scheme: ColorScheme<TN, PN, SN, VN, string>): ColorSchemeInfo<TN, PN, SN, VN>; | ||
interface ColorScheme<TN extends string, PN extends string, SN extends string, VN extends string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey> extends ColorSchemeInfo<TN, PN, SN, VN> { | ||
readonly variantSources: ColorVariantSource<VN>[]; | ||
readonly optionals: OK[]; | ||
readonly source: ColorSchemeSource<TN, PN, SN, VN, OK>; | ||
readonly themes: ColorThemeBucket<TN, PN, SN, VN, OK>; | ||
readonly scopeResolvers: ColorScopeResolvers<TN, PN, SN, VN, OK>; | ||
toJSON(): ColorSchemeJSON<TN, PN, SN, VN, OK>; | ||
} | ||
export declare type RawColorVariantSource<VN extends string> = VN | ColorVariantSource<VN>; | ||
export declare type ScopeName = ExtractKeys<ScopeSettings, '__ScopeName__'>; | ||
export declare interface ScopeSettings { | ||
interface ThemeSettings { | ||
} | ||
export declare interface TemplateScope { | ||
interface PaletteSettings { | ||
} | ||
interface ScopeSettings { | ||
} | ||
interface ColorVariantSettings { | ||
} | ||
type ExtractKeys<T extends object, D> = keyof T extends never ? D : keyof T; | ||
type ThemeName = ExtractKeys<ThemeSettings, '__ThemeName__'>; | ||
type PaletteName = ExtractKeys<PaletteSettings, '__PaletteName__'>; | ||
type ScopeName = ExtractKeys<ScopeSettings, '__ScopeName__'>; | ||
type ColorVariant = ExtractKeys<ColorVariantSettings, '__ColorVariant__'>; | ||
interface TemplateScope { | ||
scheme: ColorScheme<any, any, any, any>; | ||
@@ -373,7 +322,4 @@ scssValues: string; | ||
export declare type ThemeName = ExtractKeys<ThemeSettings, '__ThemeName__'>; | ||
declare function createColorScheme<TN extends string, PN extends string, SN extends string, VN extends string = string, OK extends ColorScopeOptionalKey = ColorScopeOptionalKey>(source: ColorSchemeSource<TN, PN, SN, VN, OK>): ColorScheme<TN, PN, SN, VN, OK>; | ||
export declare interface ThemeSettings { | ||
} | ||
export { } | ||
export { BULTIN_COLOR_VARIANTS, BultinColorVariant, COLOR_SCOPE_DEFAULTS_KEYS, ColorPaletteBucket, ColorPaletteContext, ColorPaletteItem, ColorPaletteItemContext, ColorPaletteItemJSON, ColorPaletteItemResolver, ColorPaletteItemSource, ColorScheme, ColorSchemeInfo, ColorSchemeJSON, ColorSchemeSource, ColorScope, ColorScopeContext, ColorScopeDefault, ColorScopeDefaultJSON, ColorScopeDefaultResolver, ColorScopeDefaultSource, ColorScopeDefaults, ColorScopeDefaultsJSON, ColorScopeDefaultsKey, ColorScopeDefaultsResolver, ColorScopeDefaultsSource, ColorScopeJSON, ColorScopeOptionalKey, ColorScopeOptionalValueMap, ColorScopeOptionals, ColorScopeResolver, ColorScopeResolverResult, ColorScopeResolvers, ColorScopeSource, ColorScopesBucket, ColorScopesContext, ColorTheme, ColorThemeBucket, ColorThemeContext, ColorThemeJSON, ColorThemeSource, ColorThemesContext, ColorVariant, ColorVariantSettings, ColorVariantSource, PaletteName, PaletteSettings, RawColorVariantSource, ScopeName, ScopeSettings, TemplateScope, ThemeName, ThemeSettings, colorSchemeInfoByScheme, createColorScheme }; |
{ | ||
"name": "@fastkit/color-scheme", | ||
"version": "0.12.8", | ||
"version": "0.12.9", | ||
"description": "An implementation to control the schema associated with \"color\".", | ||
"keywords": [ | ||
"fastkit", | ||
"color" | ||
], | ||
"homepage": "https://github.com/dadajam4/fastkit/tree/main/packages/color-scheme#readme", | ||
"bugs": { | ||
"url": "https://github.com/dadajam4/fastkit/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/dadajam4/fastkit.git" | ||
}, | ||
"license": "MIT", | ||
"author": "dadajam4", | ||
"type": "module", | ||
"exports": { | ||
"./package.json": "./package.json", | ||
".": { | ||
"types": "./dist/color-scheme.d.ts", | ||
"import": { | ||
"default": "./dist/color-scheme.mjs" | ||
} | ||
}, | ||
"./plugboy-dts-preserve": { | ||
"types": "./dist/plugboy-dts-preserve.d.ts", | ||
"import": { | ||
"default": "./dist/plugboy-dts-preserve.mjs" | ||
} | ||
}, | ||
"./*": "./dist/*" | ||
}, | ||
"main": "./dist/color-scheme.mjs", | ||
"types": "./dist/color-scheme.d.ts", | ||
"typesVersions": { | ||
"*": { | ||
".": [ | ||
"./dist/color-scheme.d.ts" | ||
], | ||
"plugboy-dts-preserve": [ | ||
"./dist/plugboy-dts-preserve.d.ts" | ||
] | ||
} | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"dependencies": { | ||
"@fastkit/color": "0.12.9", | ||
"@fastkit/tiny-logger": "0.12.9" | ||
}, | ||
"devDependencies": { | ||
"@fastkit/plugboy": "0.0.1" | ||
}, | ||
"peerDependencies": { | ||
"@fastkit/plugboy": "0.0.1" | ||
}, | ||
"buildOptions": { | ||
@@ -16,30 +72,13 @@ "name": "ColorScheme" | ||
}, | ||
"main": "./dist/color-scheme.mjs", | ||
"exports": { | ||
".": "./dist/color-scheme.mjs", | ||
"./dist/*": "./dist/*", | ||
"./package.json": "./package.json" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"types": "dist/color-scheme.d.ts", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/dadajam4/fastkit.git" | ||
}, | ||
"keywords": [ | ||
"fastkit", | ||
"color" | ||
], | ||
"author": "dadajam4", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/dadajam4/fastkit/issues" | ||
}, | ||
"homepage": "https://github.com/dadajam4/fastkit/tree/main/packages/color-scheme#readme", | ||
"dependencies": { | ||
"@fastkit/color": "0.12.8", | ||
"@fastkit/tiny-logger": "0.12.8" | ||
"scripts": { | ||
"build": "plugboy build", | ||
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist", | ||
"eslint": "eslint . --ext ts,tsx,js,vue,html,yaml", | ||
"eslint:fix": "eslint . --ext ts,tsx,js,vue,html,yaml --fix", | ||
"format": "pnpm run eslint:fix", | ||
"lint": "pnpm run eslint", | ||
"stub": "plugboy stub", | ||
"test": "vitest run", | ||
"typecheck": "tsc --noEmit" | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
101167
138.62%10
100%1481
72.81%Yes
NaN3
50%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
Updated
Updated