diff --git a/addon/amp.d.ts b/addon/amp.d.ts new file mode 100644 index 00000000..311d9557 --- /dev/null +++ b/addon/amp.d.ts @@ -0,0 +1,5 @@ +import {NanoRenderer} from '../types/nano'; + +export interface AmpAddon {} + +export function addon(nano: NanoRenderer); diff --git a/addon/array.d.ts b/addon/array.d.ts new file mode 100644 index 00000000..acb225ef --- /dev/null +++ b/addon/array.d.ts @@ -0,0 +1,5 @@ +import {NanoRenderer} from '../types/nano'; + +export interface ArrayAddon {} + +export function addon(nano: NanoRenderer); diff --git a/addon/cache.d.ts b/addon/cache.d.ts new file mode 100644 index 00000000..ebbcc224 --- /dev/null +++ b/addon/cache.d.ts @@ -0,0 +1,8 @@ +import {NanoRenderer} from '../types/nano'; +import {CssLikeObject} from '../types/common'; + +export interface CacheAddon { + cache(css: CssLikeObject): string; +} + +export function addon(nano: NanoRenderer); diff --git a/addon/dsheet.d.ts b/addon/dsheet.d.ts new file mode 100644 index 00000000..005f9a82 --- /dev/null +++ b/addon/dsheet.d.ts @@ -0,0 +1,8 @@ +import {NanoRenderer} from '../types/nano'; +import {CssLikeObject} from '../types/common'; + +export interface DsheetAddon { + dsheet(map: object, block?: string): object; +} + +export function addon(nano: NanoRenderer); diff --git a/addon/extract.d.ts b/addon/extract.d.ts new file mode 100644 index 00000000..c5306151 --- /dev/null +++ b/addon/extract.d.ts @@ -0,0 +1,5 @@ +import {NanoRenderer} from '../types/nano'; + +export interface ExtractAddon {} + +export function addon(nano: NanoRenderer); diff --git a/addon/global.d.ts b/addon/global.d.ts new file mode 100644 index 00000000..5762b0ae --- /dev/null +++ b/addon/global.d.ts @@ -0,0 +1,8 @@ +import {NanoRenderer} from '../types/nano'; +import {CssLikeObject} from '../types/common'; + +export interface GlobalAddon { + global(css: CssLikeObject); +} + +export function addon(nano: NanoRenderer); diff --git a/addon/googleFont.d.ts b/addon/googleFont.d.ts new file mode 100644 index 00000000..7b894f92 --- /dev/null +++ b/addon/googleFont.d.ts @@ -0,0 +1,8 @@ +import {NanoRenderer} from '../types/nano'; +import {CssLikeObject} from '../types/common'; + +export interface GoogleFontAddon { + googleFont(font: string, weights: number | string | (number | string)[], subsets: string | string[]); +} + +export function addon(nano: NanoRenderer); diff --git a/addon/hydrate.d.ts b/addon/hydrate.d.ts new file mode 100644 index 00000000..831bf732 --- /dev/null +++ b/addon/hydrate.d.ts @@ -0,0 +1,7 @@ +import {NanoRenderer} from '../types/nano'; + +export interface HydrateAddon { + hydrate(sh: HTMLStyleElement); +} + +export function addon(nano: NanoRenderer); diff --git a/index.d.ts b/index.d.ts index 52b0bb41..f3e0dc51 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,50 +1,3 @@ import {CreateNano} from './types/nano'; -import {UnitsAddon} from './types/addon/units'; -import {DruleAddon} from './types/addon/drule'; -import {SheetAddon} from './types/addon/sheet'; -import {AtomsAddon} from './types/addon/atoms'; -import {EmmetAddon} from './types/addon/emmet'; -import {SheetPreset} from './types/preset/sheet'; -import {KeyframesAddon} from './types/addon/keyframes'; - export * from './types/nano'; - -declare module 'nano-css' { - export const create: CreateNano; -} - -// Addons - -declare module 'nano-css/addon/rule' { - export const addon: RuleAddon; -} - -declare module 'nano-css/addon/rdule' { - export const addon: DruleAddon; -} - -declare module 'nano-css/addon/sheet' { - export const addon: SheetAddon; -} - -declare module 'nano-css/addon/units' { - export const addon: UnitsAddon; -} - -declare module 'nano-css/addon/atoms' { - export const addon: AtomsAddon; -} - -declare module 'nano-css/addon/emmet' { - export const addon: EmmetAddon; -} - -declare module 'nano-css/addon/keyframes' { - export const addon: KeyframesAddon; -} - -// Presets - -declare module 'nano-css/preset/sheet' { - export const preset: SheetPreset; -} +export const create: CreateNano; diff --git a/types/demo.ts b/types/demo.ts index d5ba2569..3d65443e 100644 --- a/types/demo.ts +++ b/types/demo.ts @@ -1,4 +1,4 @@ -import {create} from './nano'; +import {create} from '..'; const nano = create(); diff --git a/types/nano.d.ts b/types/nano.d.ts index a709235e..99590335 100644 --- a/types/nano.d.ts +++ b/types/nano.d.ts @@ -8,6 +8,14 @@ import {EmmetAddon} from '../addon/emmet'; import {SheetAddon} from '../addon/sheet'; import {UnitsAddon} from '../addon/units'; import {KeyframesAddon} from '../addon/keyframes'; +import {AmpAddon} from '../addon/amp'; +import {ArrayAddon} from '../addon/array'; +import {CacheAddon} from '../addon/cache'; +import {DsheetAddon} from '../addon/dsheet'; +import {ExtractAddon} from '../addon/extract'; +import {GlobalAddon} from '../addon/global'; +import {GoogleFontAddon} from '../addon/googleFont'; +import {HydrateAddon} from '../addon/hydrate'; export type Addons = RuleAddon & SheetAddon & @@ -17,7 +25,15 @@ export type Addons = RuleAddon & DecoratorAddon & EmmetAddon & CSSOMAddon & - VCSSOMAddon; + VCSSOMAddon & + ArrayAddon & + CacheAddon & + DsheetAddon & + ExtractAddon & + GlobalAddon & + GoogleFontAddon & + HydrateAddon & + AmpAddon; /** * nano-css main object. @@ -123,4 +139,3 @@ export interface NanoOptions { } export type CreateNano = (options?: NanoOptions) => NanoRenderer; -export const create: CreateNano;