@vanilla-extract/sprinkles
Advanced tools
Comparing version 0.0.0-dts-bundle-202283041239 to 0.0.0-experimental-macros-20236175227
@@ -5,3 +5,3 @@ interface ResponsiveArray<Length extends number, Value> extends ReadonlyArray<Value> { | ||
} | ||
declare type ResponsiveArrayByMaxLength<MaxLength extends number, Value> = [ | ||
type ResponsiveArrayByMaxLength<MaxLength extends number, Value> = [ | ||
never, | ||
@@ -17,3 +17,3 @@ ResponsiveArray<1, Value | null>, | ||
][MaxLength]; | ||
declare type ConditionalPropertyValue = { | ||
type ConditionalPropertyValue = { | ||
defaultClass: string | undefined; | ||
@@ -24,3 +24,3 @@ conditions: { | ||
}; | ||
declare type ConditionalWithResponsiveArrayProperty = { | ||
type ConditionalWithResponsiveArrayProperty = { | ||
responsiveArray: Array<string>; | ||
@@ -31,3 +31,3 @@ values: { | ||
}; | ||
declare type ConditionalProperty = { | ||
type ConditionalProperty = { | ||
values: { | ||
@@ -37,3 +37,3 @@ [valueName: string]: ConditionalPropertyValue; | ||
}; | ||
declare type UnconditionalProperty = { | ||
type UnconditionalProperty = { | ||
values: { | ||
@@ -45,6 +45,6 @@ [valueName: string]: { | ||
}; | ||
declare type ShorthandProperty = { | ||
type ShorthandProperty = { | ||
mappings: Array<string>; | ||
}; | ||
declare type SprinklesProperties = { | ||
type SprinklesProperties = { | ||
styles: { | ||
@@ -55,11 +55,11 @@ [property: string]: ConditionalWithResponsiveArrayProperty | ConditionalProperty | ShorthandProperty | UnconditionalProperty; | ||
declare type ResponsiveArrayVariant<RA extends { | ||
type ResponsiveArrayVariant<RA extends { | ||
length: number; | ||
}, Values extends string | number | symbol> = ResponsiveArrayByMaxLength<RA['length'], Values | null>; | ||
declare type ConditionalStyle<Values extends { | ||
type ConditionalStyle<Values extends { | ||
[key: string]: ConditionalPropertyValue; | ||
}> = (Values[keyof Values]['defaultClass'] extends string ? keyof Values : never) | { | ||
[Condition in keyof Values[keyof Values]['conditions']]?: keyof Values; | ||
}; | ||
declare type ConditionalStyleWithResponsiveArray<Values extends { | ||
} | undefined; | ||
type ConditionalStyleWithResponsiveArray<Values extends { | ||
[key: string]: ConditionalPropertyValue; | ||
@@ -69,10 +69,10 @@ }, RA extends { | ||
}> = ConditionalStyle<Values> | ResponsiveArrayVariant<RA, keyof Values>; | ||
declare type ChildSprinkleProps<Sprinkles extends SprinklesProperties['styles']> = { | ||
[Prop in keyof Sprinkles]?: Sprinkles[Prop] extends ConditionalWithResponsiveArrayProperty ? ConditionalStyleWithResponsiveArray<Sprinkles[Prop]['values'], Sprinkles[Prop]['responsiveArray']> : Sprinkles[Prop] extends ConditionalProperty ? ConditionalStyle<Sprinkles[Prop]['values']> : Sprinkles[Prop] extends ShorthandProperty ? Sprinkles[Sprinkles[Prop]['mappings'][number]] extends ConditionalWithResponsiveArrayProperty ? ConditionalStyleWithResponsiveArray<Sprinkles[Sprinkles[Prop]['mappings'][number]]['values'], Sprinkles[Sprinkles[Prop]['mappings'][number]]['responsiveArray']> : Sprinkles[Sprinkles[Prop]['mappings'][number]] extends ConditionalProperty ? ConditionalStyle<Sprinkles[Sprinkles[Prop]['mappings'][number]]['values']> : Sprinkles[Sprinkles[Prop]['mappings'][number]] extends UnconditionalProperty ? keyof Sprinkles[Sprinkles[Prop]['mappings'][number]]['values'] : never : Sprinkles[Prop] extends UnconditionalProperty ? keyof Sprinkles[Prop]['values'] : never; | ||
type ChildSprinkleProps<Sprinkles extends SprinklesProperties['styles']> = { | ||
[Prop in keyof Sprinkles]?: Sprinkles[Prop] extends ConditionalWithResponsiveArrayProperty ? ConditionalStyleWithResponsiveArray<Sprinkles[Prop]['values'], Sprinkles[Prop]['responsiveArray']> : Sprinkles[Prop] extends ConditionalProperty ? ConditionalStyle<Sprinkles[Prop]['values']> : Sprinkles[Prop] extends ShorthandProperty ? Sprinkles[Sprinkles[Prop]['mappings'][number]] extends ConditionalWithResponsiveArrayProperty ? ConditionalStyleWithResponsiveArray<Sprinkles[Sprinkles[Prop]['mappings'][number]]['values'], Sprinkles[Sprinkles[Prop]['mappings'][number]]['responsiveArray']> : Sprinkles[Sprinkles[Prop]['mappings'][number]] extends ConditionalProperty ? ConditionalStyle<Sprinkles[Sprinkles[Prop]['mappings'][number]]['values']> : Sprinkles[Sprinkles[Prop]['mappings'][number]] extends UnconditionalProperty ? keyof Sprinkles[Sprinkles[Prop]['mappings'][number]]['values'] | undefined : never : Sprinkles[Prop] extends UnconditionalProperty ? keyof Sprinkles[Prop]['values'] | undefined : never; | ||
}; | ||
declare type SprinkleProps<Args extends ReadonlyArray<any>> = Args extends [ | ||
type SprinkleProps<Args extends ReadonlyArray<any>> = Args extends [ | ||
infer L, | ||
...infer R | ||
] ? (L extends SprinklesProperties ? ChildSprinkleProps<L['styles']> : never) & SprinkleProps<R> : {}; | ||
declare type SprinklesFn<Args extends ReadonlyArray<SprinklesProperties>> = ((props: SprinkleProps<Args>) => string) & { | ||
type SprinklesFn<Args extends ReadonlyArray<SprinklesProperties>> = ((props: SprinkleProps<Args>) => string) & { | ||
properties: Set<keyof SprinkleProps<Args>>; | ||
@@ -79,0 +79,0 @@ }; |
@@ -5,11 +5,10 @@ 'use strict'; | ||
var createSprinkles$1 = require('../../dist/createSprinkles-9b4ec8a2.cjs.dev.js'); | ||
var createSprinkles$1 = require('../../dist/createSprinkles-66f18835.cjs.dev.js'); | ||
var composeStyles = classList => classList; | ||
var createSprinkles = function createSprinkles() { | ||
return createSprinkles$1.createSprinkles(composeStyles)(...arguments); | ||
}; | ||
/** @deprecated - Use `createSprinkles` */ | ||
var createAtomsFn = createSprinkles; | ||
@@ -16,0 +15,0 @@ |
@@ -5,11 +5,10 @@ 'use strict'; | ||
var createSprinkles$1 = require('../../dist/createSprinkles-2115f858.cjs.prod.js'); | ||
var createSprinkles$1 = require('../../dist/createSprinkles-e5dcc3fa.cjs.prod.js'); | ||
var composeStyles = classList => classList; | ||
var createSprinkles = function createSprinkles() { | ||
return createSprinkles$1.createSprinkles(composeStyles)(...arguments); | ||
}; | ||
/** @deprecated - Use `createSprinkles` */ | ||
var createAtomsFn = createSprinkles; | ||
@@ -16,0 +15,0 @@ |
@@ -1,12 +0,11 @@ | ||
import { c as createSprinkles$1 } from '../../dist/createSprinkles-29d354c5.esm.js'; | ||
import { c as createSprinkles$1 } from '../../dist/createSprinkles-c8550e00.esm.js'; | ||
var composeStyles = classList => classList; | ||
var createSprinkles = function createSprinkles() { | ||
return createSprinkles$1(composeStyles)(...arguments); | ||
}; | ||
/** @deprecated - Use `createSprinkles` */ | ||
var createAtomsFn = createSprinkles; | ||
export { createAtomsFn, createSprinkles }; |
@@ -9,3 +9,3 @@ interface ResponsiveArray<Length extends number, Value> extends ReadonlyArray<Value> { | ||
} | ||
declare type ResponsiveArrayByMaxLength<MaxLength extends number, Value> = [ | ||
type ResponsiveArrayByMaxLength<MaxLength extends number, Value> = [ | ||
never, | ||
@@ -21,3 +21,3 @@ ResponsiveArray<1, Value | null>, | ||
][MaxLength]; | ||
declare type RequiredResponsiveArrayByMaxLength<MaxLength extends number, Value> = [ | ||
type RequiredResponsiveArrayByMaxLength<MaxLength extends number, Value> = [ | ||
never, | ||
@@ -34,4 +34,4 @@ RequiredResponsiveArray<1, Value | null>, | ||
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> = { | ||
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; | ||
type Conditions<ConditionName extends string> = { | ||
conditions: { | ||
@@ -43,9 +43,9 @@ defaultCondition: ConditionName | false; | ||
}; | ||
declare type ExtractDefaultCondition<SprinklesProperties extends Conditions<string>> = SprinklesProperties['conditions']['defaultCondition']; | ||
declare type ExtractConditionNames<SprinklesProperties extends Conditions<string>> = SprinklesProperties['conditions']['conditionNames'][number]; | ||
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 { | ||
type ExtractDefaultCondition<SprinklesProperties extends Conditions<string>> = SprinklesProperties['conditions']['defaultCondition']; | ||
type ExtractConditionNames<SprinklesProperties extends Conditions<string>> = SprinklesProperties['conditions']['conditionNames'][number]; | ||
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 | boolean> = Record<RequiredConditionName, Value> & Partial<Record<OptionalConditionNames, Value>>; | ||
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 { | ||
type RequiredConditionalObject<RequiredConditionName extends string, OptionalConditionNames extends string, Value extends string | number | boolean> = Record<RequiredConditionName, Value> & Partial<Record<OptionalConditionNames, Value>>; | ||
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; | ||
@@ -52,0 +52,0 @@ } ? RequiredResponsiveArrayByMaxLength<SprinklesProperties['conditions']['responsiveArray']['length'], Value> : never); |
@@ -11,7 +11,5 @@ 'use strict'; | ||
} = properties; | ||
if (!conditions) { | ||
throw new Error('Styles have no conditions'); | ||
} | ||
function normalizeValue(value) { | ||
@@ -22,3 +20,2 @@ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { | ||
} | ||
return { | ||
@@ -28,3 +25,2 @@ [conditions.defaultCondition]: value | ||
} | ||
if (Array.isArray(value)) { | ||
@@ -34,5 +30,3 @@ if (!('responsiveArray' in conditions)) { | ||
} | ||
var returnValue = {}; | ||
for (var index in conditions.responsiveArray) { | ||
@@ -43,9 +37,6 @@ if (value[index] != null) { | ||
} | ||
return returnValue; | ||
} | ||
return value; | ||
} | ||
return recipe.addRecipe(normalizeValue, { | ||
@@ -63,9 +54,6 @@ importPath: '@vanilla-extract/sprinkles/createUtils', | ||
} = properties; | ||
if (!conditions) { | ||
throw new Error('Styles have no conditions'); | ||
} | ||
var normalizeValue = createNormalizeValueFn(properties); | ||
function mapValue(value, mapFn) { | ||
@@ -76,9 +64,6 @@ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { | ||
} | ||
return mapFn(value, conditions.defaultCondition); | ||
} | ||
var normalizedObject = Array.isArray(value) ? normalizeValue(value) : value; | ||
var mappedObject = {}; | ||
for (var _key in normalizedObject) { | ||
@@ -89,6 +74,4 @@ if (normalizedObject[_key] != null) { | ||
} | ||
return mappedObject; | ||
} | ||
return recipe.addRecipe(mapValue, { | ||
@@ -95,0 +78,0 @@ importPath: '@vanilla-extract/sprinkles/createUtils', |
@@ -11,7 +11,5 @@ 'use strict'; | ||
} = properties; | ||
if (!conditions) { | ||
throw new Error('Styles have no conditions'); | ||
} | ||
function normalizeValue(value) { | ||
@@ -22,3 +20,2 @@ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { | ||
} | ||
return { | ||
@@ -28,3 +25,2 @@ [conditions.defaultCondition]: value | ||
} | ||
if (Array.isArray(value)) { | ||
@@ -34,5 +30,3 @@ if (!('responsiveArray' in conditions)) { | ||
} | ||
var returnValue = {}; | ||
for (var index in conditions.responsiveArray) { | ||
@@ -43,9 +37,6 @@ if (value[index] != null) { | ||
} | ||
return returnValue; | ||
} | ||
return value; | ||
} | ||
return recipe.addRecipe(normalizeValue, { | ||
@@ -63,9 +54,6 @@ importPath: '@vanilla-extract/sprinkles/createUtils', | ||
} = properties; | ||
if (!conditions) { | ||
throw new Error('Styles have no conditions'); | ||
} | ||
var normalizeValue = createNormalizeValueFn(properties); | ||
function mapValue(value, mapFn) { | ||
@@ -76,9 +64,6 @@ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { | ||
} | ||
return mapFn(value, conditions.defaultCondition); | ||
} | ||
var normalizedObject = Array.isArray(value) ? normalizeValue(value) : value; | ||
var mappedObject = {}; | ||
for (var _key in normalizedObject) { | ||
@@ -89,6 +74,4 @@ if (normalizedObject[_key] != null) { | ||
} | ||
return mappedObject; | ||
} | ||
return recipe.addRecipe(mapValue, { | ||
@@ -95,0 +78,0 @@ importPath: '@vanilla-extract/sprinkles/createUtils', |
@@ -7,7 +7,5 @@ import { addRecipe } from '@vanilla-extract/css/recipe'; | ||
} = properties; | ||
if (!conditions) { | ||
throw new Error('Styles have no conditions'); | ||
} | ||
function normalizeValue(value) { | ||
@@ -18,3 +16,2 @@ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { | ||
} | ||
return { | ||
@@ -24,3 +21,2 @@ [conditions.defaultCondition]: value | ||
} | ||
if (Array.isArray(value)) { | ||
@@ -30,5 +26,3 @@ if (!('responsiveArray' in conditions)) { | ||
} | ||
var returnValue = {}; | ||
for (var index in conditions.responsiveArray) { | ||
@@ -39,9 +33,6 @@ if (value[index] != null) { | ||
} | ||
return returnValue; | ||
} | ||
return value; | ||
} | ||
return addRecipe(normalizeValue, { | ||
@@ -59,9 +50,6 @@ importPath: '@vanilla-extract/sprinkles/createUtils', | ||
} = properties; | ||
if (!conditions) { | ||
throw new Error('Styles have no conditions'); | ||
} | ||
var normalizeValue = createNormalizeValueFn(properties); | ||
function mapValue(value, mapFn) { | ||
@@ -72,9 +60,6 @@ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { | ||
} | ||
return mapFn(value, conditions.defaultCondition); | ||
} | ||
var normalizedObject = Array.isArray(value) ? normalizeValue(value) : value; | ||
var mappedObject = {}; | ||
for (var _key in normalizedObject) { | ||
@@ -85,6 +70,4 @@ if (normalizedObject[_key] != null) { | ||
} | ||
return mappedObject; | ||
} | ||
return addRecipe(mapValue, { | ||
@@ -91,0 +74,0 @@ importPath: '@vanilla-extract/sprinkles/createUtils', |
@@ -11,4 +11,4 @@ import { CSSProperties, StyleRule } from '@vanilla-extract/css'; | ||
} | ||
declare type ResponsiveArrayConfig<Value> = ResponsiveArray<2 | 3 | 4 | 5 | 6 | 7 | 8, Value>; | ||
declare type ResponsiveArrayByMaxLength<MaxLength extends number, Value> = [ | ||
type ResponsiveArrayConfig<Value> = ResponsiveArray<2 | 3 | 4 | 5 | 6 | 7 | 8, Value>; | ||
type ResponsiveArrayByMaxLength<MaxLength extends number, Value> = [ | ||
never, | ||
@@ -24,3 +24,3 @@ ResponsiveArray<1, Value | null>, | ||
][MaxLength]; | ||
declare type RequiredResponsiveArrayByMaxLength<MaxLength extends number, Value> = [ | ||
type RequiredResponsiveArrayByMaxLength<MaxLength extends number, Value> = [ | ||
never, | ||
@@ -36,3 +36,3 @@ RequiredResponsiveArray<1, Value | null>, | ||
][MaxLength]; | ||
declare type ConditionalPropertyValue = { | ||
type ConditionalPropertyValue = { | ||
defaultClass: string | undefined; | ||
@@ -43,3 +43,3 @@ conditions: { | ||
}; | ||
declare type ConditionalWithResponsiveArrayProperty = { | ||
type ConditionalWithResponsiveArrayProperty = { | ||
responsiveArray: Array<string>; | ||
@@ -50,3 +50,3 @@ values: { | ||
}; | ||
declare type ConditionalProperty = { | ||
type ConditionalProperty = { | ||
values: { | ||
@@ -56,3 +56,3 @@ [valueName: string]: ConditionalPropertyValue; | ||
}; | ||
declare type UnconditionalProperty = { | ||
type UnconditionalProperty = { | ||
values: { | ||
@@ -64,6 +64,6 @@ [valueName: string]: { | ||
}; | ||
declare type ShorthandProperty = { | ||
type ShorthandProperty = { | ||
mappings: Array<string>; | ||
}; | ||
declare type SprinklesProperties = { | ||
type SprinklesProperties = { | ||
styles: { | ||
@@ -74,11 +74,11 @@ [property: string]: ConditionalWithResponsiveArrayProperty | ConditionalProperty | ShorthandProperty | UnconditionalProperty; | ||
declare type ResponsiveArrayVariant<RA extends { | ||
type ResponsiveArrayVariant<RA extends { | ||
length: number; | ||
}, Values extends string | number | symbol> = ResponsiveArrayByMaxLength<RA['length'], Values | null>; | ||
declare type ConditionalStyle<Values extends { | ||
type ConditionalStyle<Values extends { | ||
[key: string]: ConditionalPropertyValue; | ||
}> = (Values[keyof Values]['defaultClass'] extends string ? keyof Values : never) | { | ||
[Condition in keyof Values[keyof Values]['conditions']]?: keyof Values; | ||
}; | ||
declare type ConditionalStyleWithResponsiveArray<Values extends { | ||
} | undefined; | ||
type ConditionalStyleWithResponsiveArray<Values extends { | ||
[key: string]: ConditionalPropertyValue; | ||
@@ -88,15 +88,15 @@ }, RA extends { | ||
}> = ConditionalStyle<Values> | ResponsiveArrayVariant<RA, keyof Values>; | ||
declare type ChildSprinkleProps<Sprinkles extends SprinklesProperties['styles']> = { | ||
[Prop in keyof Sprinkles]?: Sprinkles[Prop] extends ConditionalWithResponsiveArrayProperty ? ConditionalStyleWithResponsiveArray<Sprinkles[Prop]['values'], Sprinkles[Prop]['responsiveArray']> : Sprinkles[Prop] extends ConditionalProperty ? ConditionalStyle<Sprinkles[Prop]['values']> : Sprinkles[Prop] extends ShorthandProperty ? Sprinkles[Sprinkles[Prop]['mappings'][number]] extends ConditionalWithResponsiveArrayProperty ? ConditionalStyleWithResponsiveArray<Sprinkles[Sprinkles[Prop]['mappings'][number]]['values'], Sprinkles[Sprinkles[Prop]['mappings'][number]]['responsiveArray']> : Sprinkles[Sprinkles[Prop]['mappings'][number]] extends ConditionalProperty ? ConditionalStyle<Sprinkles[Sprinkles[Prop]['mappings'][number]]['values']> : Sprinkles[Sprinkles[Prop]['mappings'][number]] extends UnconditionalProperty ? keyof Sprinkles[Sprinkles[Prop]['mappings'][number]]['values'] : never : Sprinkles[Prop] extends UnconditionalProperty ? keyof Sprinkles[Prop]['values'] : never; | ||
type ChildSprinkleProps<Sprinkles extends SprinklesProperties['styles']> = { | ||
[Prop in keyof Sprinkles]?: Sprinkles[Prop] extends ConditionalWithResponsiveArrayProperty ? ConditionalStyleWithResponsiveArray<Sprinkles[Prop]['values'], Sprinkles[Prop]['responsiveArray']> : Sprinkles[Prop] extends ConditionalProperty ? ConditionalStyle<Sprinkles[Prop]['values']> : Sprinkles[Prop] extends ShorthandProperty ? Sprinkles[Sprinkles[Prop]['mappings'][number]] extends ConditionalWithResponsiveArrayProperty ? ConditionalStyleWithResponsiveArray<Sprinkles[Sprinkles[Prop]['mappings'][number]]['values'], Sprinkles[Sprinkles[Prop]['mappings'][number]]['responsiveArray']> : Sprinkles[Sprinkles[Prop]['mappings'][number]] extends ConditionalProperty ? ConditionalStyle<Sprinkles[Sprinkles[Prop]['mappings'][number]]['values']> : Sprinkles[Sprinkles[Prop]['mappings'][number]] extends UnconditionalProperty ? keyof Sprinkles[Sprinkles[Prop]['mappings'][number]]['values'] | undefined : never : Sprinkles[Prop] extends UnconditionalProperty ? keyof Sprinkles[Prop]['values'] | undefined : never; | ||
}; | ||
declare type SprinkleProps<Args extends ReadonlyArray<any>> = Args extends [ | ||
type SprinkleProps<Args extends ReadonlyArray<any>> = Args extends [ | ||
infer L, | ||
...infer R | ||
] ? (L extends SprinklesProperties ? ChildSprinkleProps<L['styles']> : never) & SprinkleProps<R> : {}; | ||
declare type SprinklesFn<Args extends ReadonlyArray<SprinklesProperties>> = ((props: SprinkleProps<Args>) => string) & { | ||
type SprinklesFn<Args extends ReadonlyArray<SprinklesProperties>> = ((props: SprinkleProps<Args>) => string) & { | ||
properties: Set<keyof SprinkleProps<Args>>; | ||
}; | ||
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> = { | ||
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; | ||
type Conditions<ConditionName extends string> = { | ||
conditions: { | ||
@@ -108,9 +108,9 @@ defaultCondition: ConditionName | false; | ||
}; | ||
declare type ExtractDefaultCondition<SprinklesProperties extends Conditions<string>> = SprinklesProperties['conditions']['defaultCondition']; | ||
declare type ExtractConditionNames<SprinklesProperties extends Conditions<string>> = SprinklesProperties['conditions']['conditionNames'][number]; | ||
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 { | ||
type ExtractDefaultCondition<SprinklesProperties extends Conditions<string>> = SprinklesProperties['conditions']['defaultCondition']; | ||
type ExtractConditionNames<SprinklesProperties extends Conditions<string>> = SprinklesProperties['conditions']['conditionNames'][number]; | ||
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 | boolean> = Record<RequiredConditionName, Value> & Partial<Record<OptionalConditionNames, Value>>; | ||
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 { | ||
type RequiredConditionalObject<RequiredConditionName extends string, OptionalConditionNames extends string, Value extends string | number | boolean> = Record<RequiredConditionName, Value> & Partial<Record<OptionalConditionNames, Value>>; | ||
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; | ||
@@ -121,11 +121,13 @@ } ? RequiredResponsiveArrayByMaxLength<SprinklesProperties['conditions']['responsiveArray']['length'], Value> : never); | ||
declare type ConditionKey = '@media' | '@supports' | '@container' | 'selector'; | ||
declare type Condition = Partial<Record<ConditionKey, string>>; | ||
declare type BaseConditions = { | ||
type ConditionKey = '@media' | '@supports' | '@container' | 'selector'; | ||
type Condition = Partial<Record<ConditionKey, string>>; | ||
type BaseConditions = { | ||
[conditionName: string]: Condition; | ||
}; | ||
declare type AtomicProperties = { | ||
type AtomicCSSProperties = { | ||
[Property in keyof CSSProperties]?: Record<string, CSSProperties[Property] | Omit<StyleRule, ConditionKey>> | ReadonlyArray<CSSProperties[Property]>; | ||
}; | ||
declare type ShorthandOptions<Properties extends AtomicProperties, Shorthands extends { | ||
type AtomicCustomProperties = Record<string, Record<string | number, Omit<StyleRule, ConditionKey>>>; | ||
type AtomicProperties = AtomicCSSProperties | AtomicCustomProperties; | ||
type ShorthandOptions<Properties extends AtomicProperties, Shorthands extends { | ||
[shorthandName: string]: Array<keyof Properties>; | ||
@@ -135,6 +137,7 @@ }> = { | ||
}; | ||
declare type UnconditionalAtomicOptions<Properties extends AtomicProperties> = { | ||
type UnconditionalAtomicOptions<Properties extends AtomicProperties> = { | ||
'@layer'?: string; | ||
properties: Properties; | ||
}; | ||
declare type ResponsiveArrayOptions<Conditions extends { | ||
type ResponsiveArrayOptions<Conditions extends { | ||
[conditionName: string]: Condition; | ||
@@ -146,3 +149,3 @@ }, ResponsiveLength extends number> = { | ||
}; | ||
declare type ConditionalAtomicOptions<Properties extends AtomicProperties, Conditions extends { | ||
type ConditionalAtomicOptions<Properties extends AtomicProperties, Conditions extends { | ||
[conditionName: string]: Condition; | ||
@@ -153,6 +156,6 @@ }, DefaultCondition extends keyof Conditions | Array<keyof Conditions> | false> = UnconditionalAtomicOptions<Properties> & { | ||
}; | ||
declare type Values<Property, Result> = { | ||
type Values<Property, Result> = { | ||
[Value in Property extends ReadonlyArray<any> ? Property[number] : Property extends Array<any> ? Property[number] : keyof Property]: Result; | ||
}; | ||
declare type UnconditionalAtomicStyles<Properties extends AtomicProperties> = { | ||
type UnconditionalAtomicStyles<Properties extends AtomicProperties> = { | ||
conditions: never; | ||
@@ -167,3 +170,3 @@ styles: { | ||
}; | ||
declare type ConditionalAtomicStyles<Properties extends AtomicProperties, Conditions extends { | ||
type ConditionalAtomicStyles<Properties extends AtomicProperties, Conditions extends { | ||
[conditionName: string]: Condition; | ||
@@ -186,3 +189,3 @@ }, DefaultCondition extends keyof Conditions | Array<keyof Conditions> | false> = { | ||
}; | ||
declare type ConditionalWithResponsiveArrayAtomicStyles<Properties extends AtomicProperties, Conditions extends { | ||
type ConditionalWithResponsiveArrayAtomicStyles<Properties extends AtomicProperties, Conditions extends { | ||
[conditionName: string]: Condition; | ||
@@ -211,3 +214,3 @@ }, ResponsiveLength extends number, DefaultCondition extends keyof Conditions | Array<keyof Conditions> | false> = { | ||
}; | ||
declare type ShorthandAtomicStyles<Shorthands extends { | ||
type ShorthandAtomicStyles<Shorthands extends { | ||
[shorthandName: string]: Array<string | number | symbol>; | ||
@@ -234,2 +237,3 @@ }> = { | ||
declare function createSprinkles<Args extends ReadonlyArray<SprinklesProperties>>(...config: Args): SprinklesFn<Args>; | ||
declare const createSprinkles$: typeof createSprinkles; | ||
/** @deprecated - Use `defineProperties` */ | ||
@@ -240,2 +244,2 @@ declare const createAtomicStyles: typeof defineProperties; | ||
export { ConditionalValue, RequiredConditionalValue, ResponsiveArray, createAtomicStyles, createAtomsFn, createMapValueFn, createNormalizeValueFn, createSprinkles, defineProperties }; | ||
export { ConditionalValue, RequiredConditionalValue, ResponsiveArray, createAtomicStyles, createAtomsFn, createMapValueFn, createNormalizeValueFn, createSprinkles, createSprinkles$, defineProperties }; |
@@ -8,3 +8,3 @@ 'use strict'; | ||
var fileScope = require('@vanilla-extract/css/fileScope'); | ||
var createSprinkles$1 = require('./createSprinkles-9b4ec8a2.cjs.dev.js'); | ||
var createSprinkles$1 = require('./createSprinkles-66f18835.cjs.dev.js'); | ||
var createUtils_dist_vanillaExtractSprinklesCreateUtils = require('../createUtils/dist/vanilla-extract-sprinkles-createUtils.cjs.dev.js'); | ||
@@ -19,3 +19,2 @@ | ||
})) : {}; | ||
var _loop = function _loop(key) { | ||
@@ -26,7 +25,5 @@ var property = options.properties[key]; | ||
}; | ||
if ('responsiveArray' in options) { | ||
styles[key].responsiveArray = options.responsiveArray; | ||
} | ||
var processValue = (valueName, value) => { | ||
@@ -39,3 +36,2 @@ if ('conditions' in options) { | ||
var defaultClasses = []; | ||
for (var _conditionName in options.conditions) { | ||
@@ -46,3 +42,2 @@ var styleValue = typeof value === 'object' ? value : { | ||
var condition = options.conditions[_conditionName]; | ||
if (condition['@supports']) { | ||
@@ -55,3 +50,2 @@ styleValue = { | ||
} | ||
if (condition['@container']) { | ||
@@ -64,3 +58,2 @@ styleValue = { | ||
} | ||
if (condition['@media']) { | ||
@@ -73,3 +66,2 @@ styleValue = { | ||
} | ||
if (condition.selector) { | ||
@@ -82,6 +74,11 @@ styleValue = { | ||
} | ||
if (options['@layer']) { | ||
styleValue = { | ||
'@layer': { | ||
[options['@layer']]: styleValue | ||
} | ||
}; | ||
} | ||
var className = css.style(styleValue, "".concat(key, "_").concat(String(valueName), "_").concat(_conditionName)); | ||
styles[key].values[valueName].conditions[_conditionName] = className; | ||
if (defaultConditions.indexOf(_conditionName) > -1) { | ||
@@ -91,3 +88,2 @@ defaultClasses.push(className); | ||
} | ||
if (defaultClasses.length > 0) { | ||
@@ -100,3 +96,9 @@ styles[key].values[valueName].defaultClass = defaultClasses.join(' '); | ||
}; | ||
if (options['@layer']) { | ||
_styleValue = { | ||
'@layer': { | ||
[options['@layer']]: _styleValue | ||
} | ||
}; | ||
} | ||
styles[key].values[valueName] = { | ||
@@ -107,3 +109,2 @@ defaultClass: css.style(_styleValue, "".concat(key, "_").concat(String(valueName))) | ||
}; | ||
if (Array.isArray(property)) { | ||
@@ -120,7 +121,5 @@ for (var value of property) { | ||
}; | ||
for (var key in options.properties) { | ||
_loop(key); | ||
} | ||
var conditions = 'conditions' in options ? { | ||
@@ -136,5 +135,3 @@ defaultCondition: options.defaultCondition, | ||
} | ||
var mockComposeStyles = classList => classList; | ||
function createSprinkles() { | ||
@@ -144,3 +141,2 @@ for (var _len = arguments.length, config = new Array(_len), _key = 0; _key < _len; _key++) { | ||
} | ||
// When using Sprinkles with the runtime (e.g. within a jest test) | ||
@@ -157,7 +153,8 @@ // `style` can be called (only for composition) outside of a fileScope. | ||
} | ||
var createSprinkles$ = createSprinkles; | ||
/** @deprecated - Use `defineProperties` */ | ||
var createAtomicStyles = defineProperties; | ||
var createAtomicStyles = defineProperties; | ||
/** @deprecated - Use `createSprinkles` */ | ||
var createAtomsFn = createSprinkles; | ||
@@ -170,2 +167,3 @@ | ||
exports.createSprinkles = createSprinkles; | ||
exports.createSprinkles$ = createSprinkles$; | ||
exports.defineProperties = defineProperties; |
@@ -8,3 +8,3 @@ 'use strict'; | ||
var fileScope = require('@vanilla-extract/css/fileScope'); | ||
var createSprinkles$1 = require('./createSprinkles-2115f858.cjs.prod.js'); | ||
var createSprinkles$1 = require('./createSprinkles-e5dcc3fa.cjs.prod.js'); | ||
var createUtils_dist_vanillaExtractSprinklesCreateUtils = require('../createUtils/dist/vanilla-extract-sprinkles-createUtils.cjs.prod.js'); | ||
@@ -19,3 +19,2 @@ | ||
})) : {}; | ||
var _loop = function _loop(key) { | ||
@@ -26,7 +25,5 @@ var property = options.properties[key]; | ||
}; | ||
if ('responsiveArray' in options) { | ||
styles[key].responsiveArray = options.responsiveArray; | ||
} | ||
var processValue = (valueName, value) => { | ||
@@ -39,3 +36,2 @@ if ('conditions' in options) { | ||
var defaultClasses = []; | ||
for (var _conditionName in options.conditions) { | ||
@@ -46,3 +42,2 @@ var styleValue = typeof value === 'object' ? value : { | ||
var condition = options.conditions[_conditionName]; | ||
if (condition['@supports']) { | ||
@@ -55,3 +50,2 @@ styleValue = { | ||
} | ||
if (condition['@container']) { | ||
@@ -64,3 +58,2 @@ styleValue = { | ||
} | ||
if (condition['@media']) { | ||
@@ -73,3 +66,2 @@ styleValue = { | ||
} | ||
if (condition.selector) { | ||
@@ -82,6 +74,11 @@ styleValue = { | ||
} | ||
if (options['@layer']) { | ||
styleValue = { | ||
'@layer': { | ||
[options['@layer']]: styleValue | ||
} | ||
}; | ||
} | ||
var className = css.style(styleValue, "".concat(key, "_").concat(String(valueName), "_").concat(_conditionName)); | ||
styles[key].values[valueName].conditions[_conditionName] = className; | ||
if (defaultConditions.indexOf(_conditionName) > -1) { | ||
@@ -91,3 +88,2 @@ defaultClasses.push(className); | ||
} | ||
if (defaultClasses.length > 0) { | ||
@@ -100,3 +96,9 @@ styles[key].values[valueName].defaultClass = defaultClasses.join(' '); | ||
}; | ||
if (options['@layer']) { | ||
_styleValue = { | ||
'@layer': { | ||
[options['@layer']]: _styleValue | ||
} | ||
}; | ||
} | ||
styles[key].values[valueName] = { | ||
@@ -107,3 +109,2 @@ defaultClass: css.style(_styleValue, "".concat(key, "_").concat(String(valueName))) | ||
}; | ||
if (Array.isArray(property)) { | ||
@@ -120,7 +121,5 @@ for (var value of property) { | ||
}; | ||
for (var key in options.properties) { | ||
_loop(key); | ||
} | ||
var conditions = 'conditions' in options ? { | ||
@@ -136,5 +135,3 @@ defaultCondition: options.defaultCondition, | ||
} | ||
var mockComposeStyles = classList => classList; | ||
function createSprinkles() { | ||
@@ -144,3 +141,2 @@ for (var _len = arguments.length, config = new Array(_len), _key = 0; _key < _len; _key++) { | ||
} | ||
// When using Sprinkles with the runtime (e.g. within a jest test) | ||
@@ -157,7 +153,8 @@ // `style` can be called (only for composition) outside of a fileScope. | ||
} | ||
var createSprinkles$ = createSprinkles; | ||
/** @deprecated - Use `defineProperties` */ | ||
var createAtomicStyles = defineProperties; | ||
var createAtomicStyles = defineProperties; | ||
/** @deprecated - Use `createSprinkles` */ | ||
var createAtomsFn = createSprinkles; | ||
@@ -170,2 +167,3 @@ | ||
exports.createSprinkles = createSprinkles; | ||
exports.createSprinkles$ = createSprinkles$; | ||
exports.defineProperties = defineProperties; |
import { composeStyles, style } from '@vanilla-extract/css'; | ||
import { addRecipe } from '@vanilla-extract/css/recipe'; | ||
import { hasFileScope } from '@vanilla-extract/css/fileScope'; | ||
import { c as createSprinkles$1 } from './createSprinkles-29d354c5.esm.js'; | ||
import { c as createSprinkles$1 } from './createSprinkles-c8550e00.esm.js'; | ||
export { createMapValueFn, createNormalizeValueFn } from '../createUtils/dist/vanilla-extract-sprinkles-createUtils.esm.js'; | ||
@@ -14,3 +14,2 @@ | ||
})) : {}; | ||
var _loop = function _loop(key) { | ||
@@ -21,7 +20,5 @@ var property = options.properties[key]; | ||
}; | ||
if ('responsiveArray' in options) { | ||
styles[key].responsiveArray = options.responsiveArray; | ||
} | ||
var processValue = (valueName, value) => { | ||
@@ -34,3 +31,2 @@ if ('conditions' in options) { | ||
var defaultClasses = []; | ||
for (var _conditionName in options.conditions) { | ||
@@ -41,3 +37,2 @@ var styleValue = typeof value === 'object' ? value : { | ||
var condition = options.conditions[_conditionName]; | ||
if (condition['@supports']) { | ||
@@ -50,3 +45,2 @@ styleValue = { | ||
} | ||
if (condition['@container']) { | ||
@@ -59,3 +53,2 @@ styleValue = { | ||
} | ||
if (condition['@media']) { | ||
@@ -68,3 +61,2 @@ styleValue = { | ||
} | ||
if (condition.selector) { | ||
@@ -77,6 +69,11 @@ styleValue = { | ||
} | ||
if (options['@layer']) { | ||
styleValue = { | ||
'@layer': { | ||
[options['@layer']]: styleValue | ||
} | ||
}; | ||
} | ||
var className = style(styleValue, "".concat(key, "_").concat(String(valueName), "_").concat(_conditionName)); | ||
styles[key].values[valueName].conditions[_conditionName] = className; | ||
if (defaultConditions.indexOf(_conditionName) > -1) { | ||
@@ -86,3 +83,2 @@ defaultClasses.push(className); | ||
} | ||
if (defaultClasses.length > 0) { | ||
@@ -95,3 +91,9 @@ styles[key].values[valueName].defaultClass = defaultClasses.join(' '); | ||
}; | ||
if (options['@layer']) { | ||
_styleValue = { | ||
'@layer': { | ||
[options['@layer']]: _styleValue | ||
} | ||
}; | ||
} | ||
styles[key].values[valueName] = { | ||
@@ -102,3 +104,2 @@ defaultClass: style(_styleValue, "".concat(key, "_").concat(String(valueName))) | ||
}; | ||
if (Array.isArray(property)) { | ||
@@ -115,7 +116,5 @@ for (var value of property) { | ||
}; | ||
for (var key in options.properties) { | ||
_loop(key); | ||
} | ||
var conditions = 'conditions' in options ? { | ||
@@ -131,5 +130,3 @@ defaultCondition: options.defaultCondition, | ||
} | ||
var mockComposeStyles = classList => classList; | ||
function createSprinkles() { | ||
@@ -139,3 +136,2 @@ for (var _len = arguments.length, config = new Array(_len), _key = 0; _key < _len; _key++) { | ||
} | ||
// When using Sprinkles with the runtime (e.g. within a jest test) | ||
@@ -152,9 +148,10 @@ // `style` can be called (only for composition) outside of a fileScope. | ||
} | ||
var createSprinkles$ = createSprinkles; | ||
/** @deprecated - Use `defineProperties` */ | ||
var createAtomicStyles = defineProperties; | ||
var createAtomicStyles = defineProperties; | ||
/** @deprecated - Use `createSprinkles` */ | ||
var createAtomsFn = createSprinkles; | ||
export { createAtomicStyles, createAtomsFn, createSprinkles, defineProperties }; | ||
export { createAtomicStyles, createAtomsFn, createSprinkles, createSprinkles$, defineProperties }; |
{ | ||
"name": "@vanilla-extract/sprinkles", | ||
"version": "0.0.0-dts-bundle-202283041239", | ||
"version": "0.0.0-experimental-macros-20236175227", | ||
"description": "Zero-runtime atomic CSS framework for vanilla-extract", | ||
@@ -43,7 +43,7 @@ "sideEffects": false, | ||
"peerDependencies": { | ||
"@vanilla-extract/css": "^0.0.0-dts-bundle-202283041239" | ||
"@vanilla-extract/css": "^0.0.0-experimental-macros-20236175227" | ||
}, | ||
"devDependencies": { | ||
"@vanilla-extract/css": "^0.0.0-dts-bundle-202283041239" | ||
"@vanilla-extract/css": "^0.0.0-experimental-macros-20236175227" | ||
} | ||
} |
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
90407
1559