@aesthetic/sss
Advanced tools
Comparing version 0.2.3 to 0.3.0
@@ -468,9 +468,13 @@ import { objectLoop, toArray, isObject, arrayLoop, hyphenate } from '@aesthetic/utils'; | ||
this.validateDeclarations(variants, '@variants'); | ||
objectLoop(variants, function (object, type) { | ||
var block = _this9.parseLocalBlock(new Block(type), object); | ||
objectLoop(variants, function (variant, parentType) { | ||
objectLoop(variant, function (object, subType) { | ||
var type = parentType + "_" + subType; | ||
parent.addVariant(block); | ||
var block = _this9.parseLocalBlock(new Block(type), object); | ||
_this9.emit('block:variant', parent, type, block, { | ||
specificity: 0 | ||
parent.addVariant(block); | ||
_this9.emit('block:variant', parent, type, block, { | ||
specificity: 0 | ||
}); | ||
}); | ||
@@ -477,0 +481,0 @@ }); |
@@ -472,9 +472,13 @@ 'use strict'; | ||
this.validateDeclarations(variants, '@variants'); | ||
utils.objectLoop(variants, function (object, type) { | ||
var block = _this9.parseLocalBlock(new Block(type), object); | ||
utils.objectLoop(variants, function (variant, parentType) { | ||
utils.objectLoop(variant, function (object, subType) { | ||
var type = parentType + "_" + subType; | ||
parent.addVariant(block); | ||
var block = _this9.parseLocalBlock(new Block(type), object); | ||
_this9.emit('block:variant', parent, type, block, { | ||
specificity: 0 | ||
parent.addVariant(block); | ||
_this9.emit('block:variant', parent, type, block, { | ||
specificity: 0 | ||
}); | ||
}); | ||
@@ -481,0 +485,0 @@ }); |
import { Property, Variables } from '@aesthetic/types'; | ||
import Block from './Block'; | ||
import { BlockConditionListener, BlockListener, BlockNestedListener, BlockPropertyListener, ClassNameListener, FallbackProperties, FontFace, FontFaceListener, ImportListener, Keyframes, KeyframesListener, LocalBlock, Rule, RuleListener, VariableListener } from './types'; | ||
import { BlockConditionListener, BlockListener, BlockNestedListener, BlockPropertyListener, ClassNameListener, FallbackProperties, FontFace, FontFaceListener, ImportListener, Keyframes, KeyframesListener, LocalBlock, Rule, RuleListener, VariableListener, LocalBlockMap, LocalBlockVariants } from './types'; | ||
export declare const SELECTOR: RegExp; | ||
@@ -28,5 +28,3 @@ export declare type Handler = (...args: any[]) => void; | ||
parseBlock(parent: Block<T>, object: Rule): Block<T>; | ||
parseConditionalBlock(parent: Block<T>, conditions: { | ||
[key: string]: LocalBlock; | ||
}, type: 'media' | 'supports'): void; | ||
parseConditionalBlock(parent: Block<T>, conditions: LocalBlockMap, type: 'media' | 'supports'): void; | ||
parseFallbackProperties(parent: Block<T>, fallbacks: FallbackProperties): void; | ||
@@ -39,5 +37,3 @@ parseFontFace: (object: FontFace, fontFamily?: string | undefined) => string; | ||
parseVariables(parent: Block<T> | null, variables: Variables): void; | ||
parseVariants(parent: Block<T>, variants: { | ||
[key: string]: LocalBlock; | ||
}): void; | ||
parseVariants(parent: Block<T>, variants: LocalBlockVariants): void; | ||
/** | ||
@@ -44,0 +40,0 @@ * Execute the defined event listener with the arguments. |
@@ -119,5 +119,3 @@ import { CSST, FontFace as BaseFontFace, Keyframes as BaseKeyframes, Declarations, Property, Value, Variables } from '@aesthetic/types'; | ||
export declare type Rule = Declarations<Properties>; | ||
export interface RuleMap<T> { | ||
[selector: string]: T; | ||
} | ||
export declare type RuleMap<T> = Record<string, T>; | ||
export interface FontFace extends BaseFontFace { | ||
@@ -149,16 +147,10 @@ local?: string[]; | ||
'@fallbacks'?: FallbackProperties; | ||
'@media'?: { | ||
[mediaQuery: string]: LocalBlock; | ||
}; | ||
'@selectors'?: { | ||
[selector: string]: LocalBlock; | ||
}; | ||
'@supports'?: { | ||
[featureQuery: string]: LocalBlock; | ||
}; | ||
'@media'?: LocalBlockMap; | ||
'@selectors'?: LocalBlockMap; | ||
'@supports'?: LocalBlockMap; | ||
'@variables'?: Variables; | ||
'@variants'?: { | ||
[variant: string]: LocalBlock; | ||
}; | ||
'@variants'?: LocalBlockVariants; | ||
}; | ||
export declare type LocalBlockMap = Record<string, LocalBlock>; | ||
export declare type LocalBlockVariants = Record<string, LocalBlockMap>; | ||
export declare type LocalBlockNeverize<T> = { | ||
@@ -173,9 +165,5 @@ [K in keyof T]: K extends keyof LocalBlock ? T[K] : never; | ||
export interface GlobalStyleSheet { | ||
'@font-face'?: { | ||
[fontFamily: string]: FontFace | FontFace[]; | ||
}; | ||
'@font-face'?: Record<string, FontFace | FontFace[]>; | ||
'@import'?: (string | Import)[]; | ||
'@keyframes'?: { | ||
[animationName: string]: Keyframes; | ||
}; | ||
'@keyframes'?: Record<string, Keyframes>; | ||
'@page'?: Page; | ||
@@ -182,0 +170,0 @@ '@root'?: LocalBlock; |
{ | ||
"name": "@aesthetic/sss", | ||
"version": "0.2.3", | ||
"version": "0.3.0", | ||
"description": "A strict, type-safe, and structure-safe component style sheet format.", | ||
@@ -28,6 +28,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@aesthetic/types": "^0.1.2", | ||
"@aesthetic/utils": "^0.2.1" | ||
"@aesthetic/types": "^0.2.0", | ||
"@aesthetic/utils": "^0.3.0" | ||
}, | ||
"gitHead": "2c71e131ff87e7ba95b780d631210d4456d04c7a" | ||
"gitHead": "4ad762397a9e6b7d3cc2b83d8fc7b3d1172a197b" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
76854
1433
+ Added@aesthetic/types@0.2.1(transitive)
+ Added@aesthetic/utils@0.3.0(transitive)
- Removed@aesthetic/types@0.1.2(transitive)
- Removed@aesthetic/utils@0.2.1(transitive)
Updated@aesthetic/types@^0.2.0
Updated@aesthetic/utils@^0.3.0