-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: scope the svgStyle to prevent style bleeding
- Loading branch information
1 parent
bdea68f
commit 9a86367
Showing
6 changed files
with
103 additions
and
74 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
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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
/** Simple function to generate a random id. It is "unique" in the sense "the chance for collision is small enough", but not universally unique. */ | ||
export function randomId(seed: number = Math.random() * 36 * 36 * 36 * 36 * 36 * 36 * 36) { | ||
return Math.round(seed).toString(36).padStart(7, '0') | ||
/** | ||
* Simple function to generate a random id. It is "unique" in the sense "the chance for collision is small enough", but not universally unique. | ||
* The generated id will start with a letter in order to be a valid css selector. | ||
*/ | ||
export function randomId(random = Math.random) { | ||
return [26, 36, 36, 36, 36, 36, 36].map(x => Math.floor(random() * x + (36 - x)).toString(36)).join('') | ||
} |