From 70125d5644ecc80ff332e6eb5570e3ba08c05c13 Mon Sep 17 00:00:00 2001 From: Ulrich-Matthias Schäfer Date: Sun, 3 Sep 2023 08:53:28 +0200 Subject: support css vars (fixes #1230) --- svg.js.d.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'svg.js.d.ts') diff --git a/svg.js.d.ts b/svg.js.d.ts index 8a9133a..57a665c 100644 --- a/svg.js.d.ts +++ b/svg.js.d.ts @@ -10,6 +10,11 @@ declare type CSSStyleName = Exclude< 'parentRule' | 'length' > +// create our own style declaration that includes css vars +export interface CSSStyleDeclarationWithVars extends CSSStyleDeclaration { + [key: `--${string}`]: string +} + declare module '@svgdotjs/svg.js' { function SVG(): Svg /** @@ -1160,11 +1165,16 @@ declare module '@svgdotjs/svg.js' { toggleClass(name: string): this // prototype method register in css.js - css(): Partial - css(style: T): CSSStyleDeclaration[T] - css(style: T): Partial - css(style: T, val: CSSStyleDeclaration[T]): this - css(style: Partial): this + css(): Partial + css(style: T): CSSStyleDeclarationWithVars[T] + css( + style: T + ): Partial + css( + style: T, + val: CSSStyleDeclarationWithVars[T] + ): this + css(style: Partial): this show(): this hide(): this visible(): boolean -- cgit v1.2.3