You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP

@aesthetic/types

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aesthetic/types - npm Package Compare versions

Comparing version

to
0.6.2

@@ -61,5 +61,6 @@ import CSSType from 'csstype';

}
export declare type Unit = string;
export declare type Unit = '%' | 'ch' | 'cm' | 'em' | 'ex' | 'in' | 'lh' | 'mm' | 'pc' | 'pt' | 'px' | 'rem' | 'vh' | 'vmax' | 'vmin' | 'vw';
export declare type UnitValue = string;
export declare type UnitFactory = (property: NativeProperty) => Unit | undefined;
export declare type VariablesMap<T = Value> = Record<string, T>;
//# sourceMappingURL=css.d.ts.map

@@ -1,14 +0,14 @@

import { CSS, FontFace, Import, Keyframes, NativeProperty, Properties, Property, Rule, Unit, UnitFactory, Value, VariablesMap } from './css';
import { CSS, FontFace, Import, Keyframes, NativeProperty, Properties, Property, Unit, UnitFactory, Value, VariablesMap } from './css';
import { ClassName, ColorScheme, ContrastLevel, Direction } from './ui';
export interface CacheItem {
className: string;
export interface CacheItem<Output> {
result: Output;
rank?: number;
}
export declare type CacheState = Record<string, CacheItem[]>;
export interface CacheManager {
read: (key: string, minimumRank?: number) => CacheItem | null;
write: (key: string, item: CacheItem) => void;
export declare type CacheState<Output> = Record<string, CacheItem<Output>[]>;
export interface CacheManager<Output> {
read: (key: string, minimumRank?: number) => CacheItem<Output> | null;
write: (key: string, item: CacheItem<Output>) => void;
}
export declare type AddPropertyCallback = <K extends Property>(property: K, value: NonNullable<Properties[K]>) => void;
export declare type PropertyHandler<V> = (value: NonNullable<V>, add: AddPropertyCallback, engine: Engine<unknown>) => void;
export declare type PropertyHandler<V> = (value: NonNullable<V>, add: AddPropertyCallback, engine: AnyEngine) => void;
export declare type PropertyHandlerMap = {

@@ -27,3 +27,3 @@ [P in Property]?: PropertyHandler<NonNullable<Properties[P]>>;

cssText: CSS;
cssVariables: VariablesMap<string>;
cssVariables: VariablesMap;
textContent: CSS;

@@ -57,12 +57,12 @@ type: number;

}
export interface RenderResultVariant<T> {
export interface RenderResultVariant<Output> {
types: string[];
result: T;
result: Output;
}
export interface RenderResult<T> {
result: T;
variants: RenderResultVariant<T>[];
export interface RenderResult<Output> {
result: Output;
variants: RenderResultVariant<Output>[];
}
export interface EngineOptions {
cacheManager?: CacheManager;
export interface EngineOptions<Output> {
cacheManager?: CacheManager<Output>;
customProperties?: PropertyHandlerMap;

@@ -75,5 +75,5 @@ direction?: Direction;

}
export interface Engine<T> {
export interface Engine<Input, Output> {
readonly atomic: boolean;
cacheManager?: CacheManager;
cacheManager?: CacheManager<Output>;
customProperties?: PropertyHandlerMap;

@@ -88,17 +88,18 @@ direction: Direction;

prefersContrastLevel: (level: ContrastLevel) => boolean;
renderDeclaration: <K extends Property>(property: K, value: NonNullable<Properties[K]>, options?: RenderOptions) => T;
renderDeclaration: <K extends Property>(property: K, value: NonNullable<Properties[K]>, options?: RenderOptions) => Output;
renderFontFace: (fontFace: FontFace, options?: RenderOptions) => string;
renderImport: (path: Import | string, options?: RenderOptions) => string;
renderKeyframes: (keyframes: Keyframes, animationName?: string, options?: RenderOptions) => string;
renderRule: (rule: Rule, options?: RenderOptions) => RenderResult<T>;
renderRuleGrouped: (rule: Rule, options?: RenderOptions) => RenderResult<T>;
renderVariable: (name: string, value: Value, options?: RenderOptions) => T;
renderRule: (rule: Input, options?: RenderOptions) => RenderResult<Output>;
renderRuleGrouped: (rule: Input, options?: RenderOptions) => RenderResult<Output>;
renderVariable: (name: string, value: Value, options?: RenderOptions) => Output;
setDirection: (direction: Direction) => void;
setRootVariables: (variables: VariablesMap) => void;
setTheme: (results: T[]) => void;
setTheme: (results: Output[]) => void;
}
export declare type AnyEngine = Engine<any, any>;
declare global {
namespace NodeJS {
interface Global {
AESTHETIC_CUSTOM_ENGINE: Engine<any>;
AESTHETIC_CUSTOM_ENGINE: AnyEngine;
}

@@ -105,0 +106,0 @@ }

{
"name": "@aesthetic/types",
"version": "0.6.1",
"version": "0.6.2",
"description": "Reusable TypeScript types for Aesthetic packages.",

@@ -39,3 +39,3 @@ "keywords": [

},
"gitHead": "864068a1c3e4f6562bc2f920bca3de52d47bc19b"
"gitHead": "1d7a8aee700f68a11bd98c7a3b3d45d2ef3f789c"
}

@@ -103,6 +103,24 @@ // eslint-disable-next-line import/no-unresolved

export type Unit = string;
export type Unit =
| '%'
| 'ch'
| 'cm'
| 'em'
| 'ex'
| 'in'
| 'lh'
| 'mm'
| 'pc'
| 'pt'
| 'px'
| 'rem'
| 'vh'
| 'vmax'
| 'vmin'
| 'vw';
export type UnitValue = string;
export type UnitFactory = (property: NativeProperty) => Unit | undefined;
export type VariablesMap<T = Value> = Record<string, T>;

@@ -9,3 +9,2 @@ import {

Property,
Rule,
Unit,

@@ -20,12 +19,12 @@ UnitFactory,

export interface CacheItem {
className: string;
export interface CacheItem<Output> {
result: Output;
rank?: number;
}
export type CacheState = Record<string, CacheItem[]>;
export type CacheState<Output> = Record<string, CacheItem<Output>[]>;
export interface CacheManager {
read: (key: string, minimumRank?: number) => CacheItem | null;
write: (key: string, item: CacheItem) => void;
export interface CacheManager<Output> {
read: (key: string, minimumRank?: number) => CacheItem<Output> | null;
write: (key: string, item: CacheItem<Output>) => void;
}

@@ -43,3 +42,3 @@

add: AddPropertyCallback,
engine: Engine<unknown>,
engine: AnyEngine,
) => void;

@@ -68,3 +67,3 @@

cssText: CSS;
cssVariables: VariablesMap<string>;
cssVariables: VariablesMap;
textContent: CSS;

@@ -110,14 +109,14 @@ type: number;

export interface RenderResultVariant<T> {
export interface RenderResultVariant<Output> {
types: string[];
result: T;
result: Output;
}
export interface RenderResult<T> {
result: T;
variants: RenderResultVariant<T>[];
export interface RenderResult<Output> {
result: Output;
variants: RenderResultVariant<Output>[];
}
export interface EngineOptions {
cacheManager?: CacheManager;
export interface EngineOptions<Output> {
cacheManager?: CacheManager<Output>;
customProperties?: PropertyHandlerMap;

@@ -131,5 +130,5 @@ direction?: Direction;

export interface Engine<T> {
export interface Engine<Input, Output> {
readonly atomic: boolean;
cacheManager?: CacheManager;
cacheManager?: CacheManager<Output>;
customProperties?: PropertyHandlerMap;

@@ -150,3 +149,3 @@ direction: Direction;

options?: RenderOptions,
) => T;
) => Output;
renderFontFace: (fontFace: FontFace, options?: RenderOptions) => string;

@@ -159,18 +158,20 @@ renderImport: (path: Import | string, options?: RenderOptions) => string;

) => string;
renderRule: (rule: Rule, options?: RenderOptions) => RenderResult<T>;
renderRuleGrouped: (rule: Rule, options?: RenderOptions) => RenderResult<T>;
renderVariable: (name: string, value: Value, options?: RenderOptions) => T;
renderRule: (rule: Input, options?: RenderOptions) => RenderResult<Output>;
renderRuleGrouped: (rule: Input, options?: RenderOptions) => RenderResult<Output>;
renderVariable: (name: string, value: Value, options?: RenderOptions) => Output;
setDirection: (direction: Direction) => void;
setRootVariables: (variables: VariablesMap) => void;
setTheme: (results: T[]) => void;
setTheme: (results: Output[]) => void;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type AnyEngine = Engine<any, any>;
declare global {
namespace NodeJS {
interface Global {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
AESTHETIC_CUSTOM_ENGINE: Engine<any>;
AESTHETIC_CUSTOM_ENGINE: AnyEngine;
}
}
}