ainsley
Index
Interfaces
Type aliases
- AinsleyAST
- AinsleyChild
- AinsleyChildren
- AinsleyGenerateIteratorContext
- AinsleyLeaf
- AinsleyPropertyOrPlaceholder
- AinsleyRule
- AinsleyVariation
- AinsleyVariations
- CfgLoc
Variables
Functions
- ainsleyChildrenToAst
- ainsleyPropertyToAst
- ainsleyRuleToAst
- ainsleyToAst
- buildVariable
- combinations
- defaultGetConfig
- embed
- findConfigs
- flatten
- formatError
- generate
- generateFromAst
- getFlatConfig
- isObject
- minify
- minifyRaw
- parseVariable
- searchForUsages
- toAST
- validate
Object literals
Type aliases
AinsleyAST
Ƭ AinsleyAST: AinsleyASTNode[]
Defined in generate/index.ts:16
AinsleyChild
Ƭ AinsleyChild: Ainsley | AinsleyLeaf
Defined in types.ts:12
AinsleyChildren
Ƭ AinsleyChildren: AinsleyChild[]
Defined in types.ts:16
AinsleyGenerateIteratorContext
Ƭ AinsleyGenerateIteratorContext: [string, string, string | number, number]
Defined in generate/index.ts:196
AinsleyLeaf
Ƭ AinsleyLeaf: AinsleyRule | AinsleyPropertyOrPlaceholder | string
Defined in types.ts:11
AinsleyPropertyOrPlaceholder
Ƭ AinsleyPropertyOrPlaceholder: [string, AinsleyAbbreviationMapObject]
Defined in types.ts:6
AinsleyRule
Ƭ AinsleyRule: [string, Array‹[string, string | number]›]
Defined in types.ts:5
AinsleyVariation
Ƭ AinsleyVariation: Array‹[string, string]›
Defined in types.ts:13
AinsleyVariations
Ƭ AinsleyVariations: AinsleyVariation[]
Defined in types.ts:15
CfgLoc
Ƭ CfgLoc: [AinsleyChildren, number]
Defined in flatten/index.ts:7
Variables
Const
ITERATOR_REGEX
• ITERATOR_REGEX: "{[a-zA-Z0-9_-]+}" = "{[a-zA-Z0-9_-]+}"
Defined in generate/index.ts:18
Const
ITERATOR_SEARCH
• ITERATOR_SEARCH: RegExp‹› = new RegExp(ITERATOR_REGEX, 'g')
Defined in generate/index.ts:35
Const
MODIFIERS
• MODIFIERS: "?+" = "?+"
Defined in minify/index.ts:188
Let
csso
• csso: any = (globalThis as { csso?: any })?.csso
Defined in minify/index.ts:8
Const
iteratorRegex
• iteratorRegex: RegExp‹› = /{[a-z]+}/gi
Defined in minify/index.ts:214
Functions
Const
ainsleyChildrenToAst
▸ ainsleyChildrenToAst(ainsleyChildren
: AinsleyChildren, options
: AinsleyGenerateOptions, variables
: AinsleyVariableMap): AinsleyAST
Defined in generate/index.ts:169
Parameters:
Name | Type |
---|---|
ainsleyChildren | AinsleyChildren |
options | AinsleyGenerateOptions |
variables | AinsleyVariableMap |
Returns: AinsleyAST
Const
ainsleyPropertyToAst
▸ ainsleyPropertyToAst(ainsleyProperty
: AinsleyPropertyOrPlaceholder, options
: AinsleyGenerateOptions): AinsleyAST
Defined in generate/index.ts:266
Parameters:
Name | Type |
---|---|
ainsleyProperty | AinsleyPropertyOrPlaceholder |
options | AinsleyGenerateOptions |
Returns: AinsleyAST
Const
ainsleyRuleToAst
▸ ainsleyRuleToAst(ainsleyRule
: AinsleyRule, options
: AinsleyGenerateOptions, variables
: AinsleyVariableMap): AinsleyAST
Defined in generate/index.ts:198
Parameters:
Name | Type |
---|---|
ainsleyRule | AinsleyRule |
options | AinsleyGenerateOptions |
variables | AinsleyVariableMap |
Returns: AinsleyAST
Const
ainsleyToAst
▸ ainsleyToAst(ainsley
: Ainsley, options
: AinsleyGenerateOptions, inheritedVariables
: AinsleyVariableMap): AinsleyAST
Defined in generate/index.ts:124
Parameters:
Name | Type |
---|---|
ainsley | Ainsley |
options | AinsleyGenerateOptions |
inheritedVariables | AinsleyVariableMap |
Returns: AinsleyAST
Const
buildVariable
▸ buildVariable(mod
: number, base
: string): string
Defined in minify/index.ts:196
Parameters:
Name | Type |
---|---|
mod | number |
base | string |
Returns: string
Const
combinations
▸ combinations‹T›(mods
: T[][]): T[][]
Defined in utils/index.ts:4
Type parameters:
▪ T
Parameters:
Name | Type |
---|---|
mods | T[][] |
Returns: T[][]
Const
defaultGetConfig
▸ defaultGetConfig(ref
: string): Promise‹AinsleyChild›
Defined in flatten/index.ts:50
Parameters:
Name | Type |
---|---|
ref | string |
Returns: Promise‹AinsleyChild›
Const
embed
▸ embed(css
: string, id?
: undefined | string): void
Defined in embed/index.ts:2
Parameters:
Name | Type |
---|---|
css | string |
id? | undefined | string |
Returns: void
Const
findConfigs
▸ findConfigs(ainsley
: Ainsley): CfgLoc[]
Defined in flatten/index.ts:8
Parameters:
Name | Type |
---|---|
ainsley | Ainsley |
Returns: CfgLoc[]
Const
flatten
▸ flatten(configWithPlugins
: Ainsley, getConfig
: defaultGetConfig): Promise‹Ainsley›
Defined in flatten/index.ts:27
Parameters:
Name | Type | Default |
---|---|---|
configWithPlugins | Ainsley | - |
getConfig | defaultGetConfig | defaultGetConfig |
Returns: Promise‹Ainsley›
Const
formatError
▸ formatError(error
: ErrorObject): string
Defined in validate/index.ts:28
Parameters:
Name | Type |
---|---|
error | ErrorObject |
Returns: string
Const
generate
▸ generate(ainsley
: Ainsley, options
: Partial‹AinsleyGenerateOptions›): string
Defined in generate/index.ts:37
Parameters:
Name | Type | Default |
---|---|---|
ainsley | Ainsley | - |
options | Partial‹AinsleyGenerateOptions› | {} |
Returns: string
Const
generateFromAst
▸ generateFromAst(ainsleyRules
: AinsleyAST, options
: AinsleyGenerateOptions): string
Defined in generate/index.ts:58
Parameters:
Name | Type |
---|---|
ainsleyRules | AinsleyAST |
options | AinsleyGenerateOptions |
Returns: string
Const
getFlatConfig
▸ getFlatConfig(ref
: string, getConfig
: function): Promise‹AinsleyChild›
Defined in flatten/index.ts:68
Parameters:
▪ ref: string
▪ getConfig: function
▸ (config
: string): Promise‹AinsleyChild›
Parameters:
Name | Type |
---|---|
config | string |
Returns: Promise‹AinsleyChild›
Const
isObject
▸ isObject(val
: unknown): boolean
Defined in utils/index.ts:1
Parameters:
Name | Type |
---|---|
val | unknown |
Returns: boolean
Const
minify
▸ minify(ainsley
: Ainsley): Ainsley
Defined in minify/index.ts:27
Parameters:
Name | Type |
---|---|
ainsley | Ainsley |
Returns: Ainsley
Const
minifyRaw
▸ minifyRaw(rawCSS
: string): any
Defined in minify/index.ts:199
Parameters:
Name | Type |
---|---|
rawCSS | string |
Returns: any
Const
parseVariable
▸ parseVariable(variable
: string): [number, string]
Defined in generate/index.ts:291
Parameters:
Name | Type |
---|---|
variable | string |
Returns: [number, string]
▸ parseVariable(variable
: string): [number, string]
Defined in minify/index.ts:190
Parameters:
Name | Type |
---|---|
variable | string |
Returns: [number, string]
Const
searchForUsages
▸ searchForUsages(arr
: Array‹unknown | string | Record‹string, unknown››, set
: Set‹string›): Set‹string›
Defined in minify/index.ts:215
Parameters:
Name | Type | Default |
---|---|---|
arr | Array‹unknown | string | Record‹string, unknown›› | - |
set | Set‹string› | new Set() |
Returns: Set‹string›
Const
toAST
▸ toAST(ainsley
: Ainsley, definedVariables
: Set‹string›, parent?
: ASTNode): ASTNode[]
Defined in minify/index.ts:239
Parameters:
Name | Type |
---|---|
ainsley | Ainsley |
definedVariables | Set‹string› |
parent? | ASTNode |
Returns: ASTNode[]
Const
validate
▸ validate(maybeAinsley
: unknown): string[]
Defined in validate/index.ts:5
Parameters:
Name | Type |
---|---|
maybeAinsley | unknown |
Returns: string[]
Object literals
Const
DEFAULT_OPTIONS
▪ DEFAULT_OPTIONS: object
Defined in generate/index.ts:19
abbreviateProperty
▸ abbreviateProperty(propertyName
: string): [string, string]
Defined in generate/index.ts:26
Parameters:
Name | Type |
---|---|
propertyName | string |
Returns: [string, string]
addPropertyToSelector
▸ addPropertyToSelector(selector
: string, propertyAbbreviation
: string): string
Defined in generate/index.ts:22
Parameters:
Name | Type |
---|---|
selector | string |
propertyAbbreviation | string |
Returns: string
addValueToSelector
▸ addValueToSelector(selector
: string, valueAbbreviation
: string): string
Defined in generate/index.ts:24
Parameters:
Name | Type |
---|---|
selector | string |
valueAbbreviation | string |
Returns: string
addVariationToSelector
▸ addVariationToSelector(selector
: string, variationAbbreviation
: string): string
Defined in generate/index.ts:20
Parameters:
Name | Type |
---|---|
selector | string |
variationAbbreviation | string |
Returns: string
Const
schema
▪ schema: object
Defined in validate/index.ts:32
$schema
• $schema: string = "http://json-schema.org/draft-07/schema#"
Defined in validate/index.ts:33
type
• type: string = "object"
Defined in validate/index.ts:158
▪ definitions: object
Defined in validate/index.ts:34
Primitive: object
- anyOf: object[] = [ { "type": "string" }, { "type": "number" } ]
▪ properties: object
Defined in validate/index.ts:46
children: object
type: string = "array"
items: object
- anyOf: (object | object | object | object)[] = [ { "items": [ { "type": "string" }, { "items": { "items": [ { "type": "string" }, { "$ref": "#/definitions/Primitive" } ], "minItems": 2, "maxItems": 2, "type": "array" }, "type": "array" } ], "minItems": 2, "maxItems": 2, "type": "array" }, { "items": [ { "type": "string" }, { "anyOf": [ { "type": "object", "additionalProperties": { "$ref": "#/definitions/Primitive" } }, { "type": "array", "items": { "anyOf": [ { "$ref": "#/definitions/Primitive" }, { "items": [ { "$ref": "#/definitions/Primitive" }, { "$ref": "#/definitions/Primitive" } ], "minItems": 2, "maxItems": 2, "type": "array" } ] } } ] } ], "minItems": 2, "maxItems": 2, "type": "array" }, { "type": "string" }, { "$ref": "#" } ]
variables: object
type: string = "object"
additionalProperties: object
type: string = "object"
additionalProperties: object
- $ref: string = "#/definitions/Primitive"
variations: object
type: string = "array"
items: object
type: string = "array"
items: object
items: object[] = [ { "type": "string" }, { "type": "string" } ]
maxItems: number = 2
minItems: number = 2
type: string = "array"