Skip to content

Commit

Permalink
$mol_style_func: fixed types
Browse files Browse the repository at this point in the history
  • Loading branch information
jin committed Dec 2, 2023
1 parent af12660 commit 1a42760
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
32 changes: 16 additions & 16 deletions style/func/func.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ namespace $ {
}

static clamp(
min: $mol_style_unit< any >,
mid: $mol_style_unit< any >,
max: $mol_style_unit< any >,
min: $mol_style_unit_str< any >,
mid: $mol_style_unit_str< any >,
max: $mol_style_unit_str< any >,
) {
return new $mol_style_func(
'clamp',
Expand All @@ -99,7 +99,7 @@ namespace $ {
}

static linear(
...breakpoints : Array<number | [number, number | $mol_style_unit<'%'>]>
...breakpoints : Array<number | [number, number | $mol_style_unit_str<'%'>]>
){
return new $mol_style_func(
"linear",
Expand All @@ -126,23 +126,23 @@ namespace $ {
return new $mol_style_func( 'steps', [ value, step_position ] )
}

static blur(value?: $mol_style_unit<$mol_style_unit_length>){
static blur(value?: $mol_style_unit_str<$mol_style_unit_length>){
return new $mol_style_func( 'blur', value ?? "" );
}

static brightness(value?: number | $mol_style_unit<'%'>){
static brightness(value?: number | $mol_style_unit_str<'%'>){
return new $mol_style_func( 'brightness', value ?? "" );
}

static contrast(value?: number | $mol_style_unit<'%'>){
static contrast(value?: number | $mol_style_unit_str<'%'>){
return new $mol_style_func( 'contrast', value ?? "" );
}

static drop_shadow(
color: $mol_style_properties_color,
x_offset: $mol_style_unit<$mol_style_unit_length>,
y_offset: $mol_style_unit<$mol_style_unit_length>,
blur_radius?: $mol_style_unit<$mol_style_unit_length>
x_offset: $mol_style_unit_str<$mol_style_unit_length>,
y_offset: $mol_style_unit_str<$mol_style_unit_length>,
blur_radius?: $mol_style_unit_str<$mol_style_unit_length>
) {
return new $mol_style_func(
"drop-shadow",
Expand All @@ -152,27 +152,27 @@ namespace $ {
);
}

static grayscale(value?: number | $mol_style_unit<'%'>){
static grayscale(value?: number | $mol_style_unit_str<'%'>){
return new $mol_style_func( 'grayscale', value ?? "" );
}

static hue_rotate(value?: 0 | $mol_style_unit<$mol_style_unit_angle>){
static hue_rotate(value?: 0 | $mol_style_unit_str<$mol_style_unit_angle>){
return new $mol_style_func( 'hue-rotate', value ?? "")
}

static invert(value?: number | $mol_style_unit<'%'>){
static invert(value?: number | $mol_style_unit_str<'%'>){
return new $mol_style_func( 'invert', value ?? "" );
}

static opacity(value?: number | $mol_style_unit<'%'>){
static opacity(value?: number | $mol_style_unit_str<'%'>){
return new $mol_style_func( 'opacity', value ?? "" );
}

static sepia(value?: number | $mol_style_unit<'%'>){
static sepia(value?: number | $mol_style_unit_str<'%'>){
return new $mol_style_func( 'sepia', value ?? "" );
}

static saturate(value?: number | $mol_style_unit<'%'>){
static saturate(value?: number | $mol_style_unit_str<'%'>){
return new $mol_style_func( 'saturate', value ?? "" );
}

Expand Down
1 change: 1 addition & 0 deletions style/unit/unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace $ {
export type $mol_style_unit_time = 's' | 'ms'

export type $mol_style_unit_any = $mol_style_unit_length | $mol_style_unit_angle | $mol_style_unit_time
export type $mol_style_unit_str< Quanity extends $mol_style_unit_any > = `${number}${Quanity}`

/**
* CSS Units
Expand Down

0 comments on commit 1a42760

Please sign in to comment.