-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 🎸 add CSSOM and VCSSOM TypeScript typings
- Loading branch information
Showing
5 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export interface CSSOMRule extends CSSRule { | ||
index: number; | ||
style: CSSStyleDeclaration; | ||
styleMap: any; | ||
} | ||
|
||
export interface AddonCSSOM { | ||
/** | ||
* @param selector CSS rule selector string. | ||
* @param prelude Media query at-rule prelude string. | ||
*/ | ||
createRule(selector: string, prelude: string): CSSOMRule; | ||
} | ||
|
||
export function addon<Nano extends {sh: HTMLStyleElement}>(nano: Nano): Nano & AddonCSSOM; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {AddonCSSOM} from './cssom'; | ||
import {Css} from './vcssom/cssToTree'; | ||
|
||
export interface VSheet { | ||
diff(css: Css); | ||
} | ||
|
||
export interface AddonVCSSOM { | ||
VSheet: new () => VSheet; | ||
} | ||
|
||
export function addon<Nano extends AddonCSSOM>(nano: Nano): Nano & AddonVCSSOM; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {CssLikeObject} from '../../types/common'; | ||
|
||
export interface Css { | ||
[key: string]: CssLikeObject[keyof CssLikeObject] | Css; | ||
} | ||
|
||
export interface Tree { | ||
[atRulePrelude: string]: { | ||
[selector: string]: { | ||
[property: string]: CssLikeObject; | ||
}; | ||
}; | ||
} | ||
|
||
export function cssToTree(css: Css): Tree; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import {CSSOMRule} from '../cssom'; | ||
|
||
export function removeRule(sh: CSSStyleSheet, rule: CSSOMRule); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters