summaryrefslogtreecommitdiffstats
path: root/svg.js.d.ts
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2023-09-03 08:53:28 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2023-09-03 08:53:28 +0200
commit70125d5644ecc80ff332e6eb5570e3ba08c05c13 (patch)
tree27edb25472e06fdcc69593b73490369076f114b1 /svg.js.d.ts
parentdd884bc205e1b476497af3fd8cabcdf85c95125e (diff)
downloadsvg.js-70125d5644ecc80ff332e6eb5570e3ba08c05c13.tar.gz
svg.js-70125d5644ecc80ff332e6eb5570e3ba08c05c13.zip
support css vars (fixes #1230)
Diffstat (limited to 'svg.js.d.ts')
-rw-r--r--svg.js.d.ts20
1 files changed, 15 insertions, 5 deletions
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<CSSStyleDeclaration>
- css<T extends CSSStyleName>(style: T): CSSStyleDeclaration[T]
- css<T extends CSSStyleName[]>(style: T): Partial<CSSStyleDeclaration>
- css<T extends CSSStyleName>(style: T, val: CSSStyleDeclaration[T]): this
- css(style: Partial<CSSStyleDeclaration>): this
+ css(): Partial<CSSStyleDeclarationWithVars>
+ css<T extends CSSStyleName>(style: T): CSSStyleDeclarationWithVars[T]
+ css<T extends CSSStyleName[]>(
+ style: T
+ ): Partial<CSSStyleDeclarationWithVars>
+ css<T extends CSSStyleName>(
+ style: T,
+ val: CSSStyleDeclarationWithVars[T]
+ ): this
+ css(style: Partial<CSSStyleDeclarationWithVars>): this
show(): this
hide(): this
visible(): boolean