@vanilla-extract/sprinkles
Advanced tools
Comparing version 1.3.3 to 1.4.0
@@ -17,3 +17,3 @@ 'use strict'; | ||
function normalizeValue(value) { | ||
if (typeof value === 'string' || typeof value === 'number') { | ||
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { | ||
if (!conditions.defaultCondition) { | ||
@@ -67,3 +67,3 @@ throw new Error('No default condition'); | ||
function mapValue(value, mapFn) { | ||
if (typeof value === 'string' || typeof value === 'number') { | ||
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { | ||
if (!conditions.defaultCondition) { | ||
@@ -70,0 +70,0 @@ throw new Error('No default condition'); |
@@ -17,3 +17,3 @@ 'use strict'; | ||
function normalizeValue(value) { | ||
if (typeof value === 'string' || typeof value === 'number') { | ||
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { | ||
if (!conditions.defaultCondition) { | ||
@@ -67,3 +67,3 @@ throw new Error('No default condition'); | ||
function mapValue(value, mapFn) { | ||
if (typeof value === 'string' || typeof value === 'number') { | ||
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { | ||
if (!conditions.defaultCondition) { | ||
@@ -70,0 +70,0 @@ throw new Error('No default condition'); |
@@ -13,3 +13,3 @@ import { addRecipe } from '@vanilla-extract/css/recipe'; | ||
function normalizeValue(value) { | ||
if (typeof value === 'string' || typeof value === 'number') { | ||
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { | ||
if (!conditions.defaultCondition) { | ||
@@ -63,3 +63,3 @@ throw new Error('No default condition'); | ||
function mapValue(value, mapFn) { | ||
if (typeof value === 'string' || typeof value === 'number') { | ||
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { | ||
if (!conditions.defaultCondition) { | ||
@@ -66,0 +66,0 @@ throw new Error('No default condition'); |
import { ResponsiveArrayByMaxLength, RequiredResponsiveArrayByMaxLength } from './types'; | ||
declare type ExtractValue<Value extends string | number | Partial<Record<string, string | number>> | ResponsiveArrayByMaxLength<number, string | number | null>> = Value extends ResponsiveArrayByMaxLength<number, string | number | null> ? NonNullable<Value[number]> : Value extends Partial<Record<string, string | number>> ? NonNullable<Value[keyof Value]> : Value; | ||
declare type ExtractValue<Value extends string | number | boolean | Partial<Record<string, string | number | boolean>> | ResponsiveArrayByMaxLength<number, string | number | boolean | null>> = Value extends ResponsiveArrayByMaxLength<number, string | number | boolean | null> ? NonNullable<Value[number]> : Value extends Partial<Record<string, string | number | boolean>> ? NonNullable<Value[keyof Value]> : Value; | ||
declare type Conditions<ConditionName extends string> = { | ||
@@ -12,11 +12,11 @@ conditions: { | ||
declare type ExtractConditionNames<SprinklesProperties extends Conditions<string>> = SprinklesProperties['conditions']['conditionNames'][number]; | ||
export declare type ConditionalValue<SprinklesProperties extends Conditions<string>, Value extends string | number> = (ExtractDefaultCondition<SprinklesProperties> extends false ? never : Value) | Partial<Record<ExtractConditionNames<SprinklesProperties>, Value>> | (SprinklesProperties['conditions']['responsiveArray'] extends { | ||
export declare type ConditionalValue<SprinklesProperties extends Conditions<string>, Value extends string | number | boolean> = (ExtractDefaultCondition<SprinklesProperties> extends false ? never : Value) | Partial<Record<ExtractConditionNames<SprinklesProperties>, Value>> | (SprinklesProperties['conditions']['responsiveArray'] extends { | ||
length: number; | ||
} ? ResponsiveArrayByMaxLength<SprinklesProperties['conditions']['responsiveArray']['length'], Value> : never); | ||
declare type RequiredConditionalObject<RequiredConditionName extends string, OptionalConditionNames extends string, Value extends string | number> = Record<RequiredConditionName, Value> & Partial<Record<OptionalConditionNames, Value>>; | ||
export declare type RequiredConditionalValue<SprinklesProperties extends Conditions<string>, Value extends string | number> = ExtractDefaultCondition<SprinklesProperties> extends false ? never : Value | RequiredConditionalObject<Exclude<ExtractDefaultCondition<SprinklesProperties>, false>, Exclude<ExtractConditionNames<SprinklesProperties>, ExtractDefaultCondition<SprinklesProperties>>, Value> | (SprinklesProperties['conditions']['responsiveArray'] extends { | ||
declare type RequiredConditionalObject<RequiredConditionName extends string, OptionalConditionNames extends string, Value extends string | number | boolean> = Record<RequiredConditionName, Value> & Partial<Record<OptionalConditionNames, Value>>; | ||
export declare type RequiredConditionalValue<SprinklesProperties extends Conditions<string>, Value extends string | number | boolean> = ExtractDefaultCondition<SprinklesProperties> extends false ? never : Value | RequiredConditionalObject<Exclude<ExtractDefaultCondition<SprinklesProperties>, false>, Exclude<ExtractConditionNames<SprinklesProperties>, ExtractDefaultCondition<SprinklesProperties>>, Value> | (SprinklesProperties['conditions']['responsiveArray'] extends { | ||
length: number; | ||
} ? RequiredResponsiveArrayByMaxLength<SprinklesProperties['conditions']['responsiveArray']['length'], Value> : never); | ||
export declare function createNormalizeValueFn<SprinklesProperties extends Conditions<string>>(properties: SprinklesProperties): <Value extends string | number>(value: ConditionalValue<SprinklesProperties, Value>) => Partial<Record<ExtractConditionNames<SprinklesProperties>, Value>>; | ||
export declare function createMapValueFn<SprinklesProperties extends Conditions<string>>(properties: SprinklesProperties): <OutputValue extends string | number | boolean | null | undefined, Value extends ConditionalValue<SprinklesProperties, string | number>>(value: Value, fn: (inputValue: ExtractValue<Value>, key: ExtractConditionNames<SprinklesProperties>) => OutputValue) => Value extends string | number ? OutputValue : Partial<Record<ExtractConditionNames<SprinklesProperties>, OutputValue>>; | ||
export declare function createNormalizeValueFn<SprinklesProperties extends Conditions<string>>(properties: SprinklesProperties): <Value extends string | number | boolean>(value: ConditionalValue<SprinklesProperties, Value>) => Partial<Record<ExtractConditionNames<SprinklesProperties>, Value>>; | ||
export declare function createMapValueFn<SprinklesProperties extends Conditions<string>>(properties: SprinklesProperties): <OutputValue extends string | number | boolean | null | undefined, Value extends ConditionalValue<SprinklesProperties, string | number | boolean>>(value: Value, fn: (inputValue: ExtractValue<Value>, key: ExtractConditionNames<SprinklesProperties>) => OutputValue) => Value extends string | number | boolean ? OutputValue : Partial<Record<ExtractConditionNames<SprinklesProperties>, OutputValue>>; | ||
export {}; |
{ | ||
"name": "@vanilla-extract/sprinkles", | ||
"version": "1.3.3", | ||
"version": "1.4.0", | ||
"description": "Zero-runtime atomic CSS framework for vanilla-extract", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
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
80160