-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
656dcb5
commit dd3921c
Showing
7 changed files
with
85 additions
and
53 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
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
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
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
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,39 @@ | ||
export class UiClassList { | ||
private _classList: Set<string> | ||
|
||
public constructor(...classList: string[]) { | ||
this._classList = new Set(classList) | ||
} | ||
|
||
public add(className: string): void { | ||
this._classList.add(className) | ||
} | ||
|
||
public remove(className: string): void { | ||
this._classList.delete(className) | ||
} | ||
|
||
public has(className: string): boolean { | ||
return this._classList.has(className) | ||
} | ||
|
||
public toggle(className: string): void { | ||
if (this.has(className)) { | ||
this.remove(className) | ||
} else { | ||
this.add(className) | ||
} | ||
} | ||
|
||
public clear(): void { | ||
this._classList.clear() | ||
} | ||
|
||
public toArray(): string[] { | ||
return Array.from(this._classList) | ||
} | ||
|
||
public toString(): string { | ||
return Array.from(this._classList).join(" ") | ||
} | ||
} |
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
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