Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use typed list of elements #4

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@
"version": "0.1.0"
},
"dependencies": {
"stylis": "^4.0.0"
"html-tags": "^3.1.0",
"stylis": "^4.0.0",
"svg-tag-names": "^2.0.1"
},
"peerDependencies": {
"effector": "^20.15.6",
Expand Down
9 changes: 8 additions & 1 deletion src/elements.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
export const domElements = [
import htmlTags from 'html-tags';
import svgTags from 'svg-tag-names';

export type DOMTag = keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap;

export const domElements = [...htmlTags, ...svgTags] as DOMTag[];

export const domElements1 = [
'a',
'abbr',
'address',
Expand Down
12 changes: 12 additions & 0 deletions types/svg-tag-names.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* eslint-disable import/no-default-export */
declare module 'svg-tag-names' {
const tags: keyof SVGElementTagNameMap;

export default tags;
}

declare module 'html-tags' {
const tags: keyof HTMLElementTagNameMap;

export default tags;
}
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5079,6 +5079,11 @@ html-tags@^1.0.0:
resolved "https://registry.yarnpkg.com/html-tags/-/html-tags-1.2.0.tgz#c78de65b5663aa597989dd2b7ab49200d7e4db98"
integrity sha1-x43mW1Zjqll5id0rerSSANfk25g=

html-tags@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/html-tags/-/html-tags-3.1.0.tgz#7b5e6f7e665e9fb41f30007ed9e0d41e97fb2140"
integrity sha512-1qYz89hW3lFDEazhjW0yVAV87lw8lVkrJocr72XmBkMKsoSVJCQx3W8BXsC7hO2qAt8BoVjYjtAcZ9perqGnNg==

htmlnano@^0.2.2:
version "0.2.5"
resolved "https://registry.yarnpkg.com/htmlnano/-/htmlnano-0.2.5.tgz#134fd9548c7cbe51c8508ce434a3f9488cff1b0b"
Expand Down Expand Up @@ -9410,6 +9415,11 @@ supports-hyperlinks@^2.0.0:
has-flag "^4.0.0"
supports-color "^7.0.0"

svg-tag-names@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/svg-tag-names/-/svg-tag-names-2.0.1.tgz#acf5655faaa2e4b173007599226b906be1b38a29"
integrity sha512-BEZ508oR+X/b5sh7bT0RqDJ7GhTpezjj3P1D4kugrOaPs6HijviWksoQ63PS81vZn0QCjZmVKjHDBniTo+Domg==

svgo@^1.0.0, svgo@^1.3.2:
version "1.3.2"
resolved "https://registry.yarnpkg.com/svgo/-/svgo-1.3.2.tgz#b6dc511c063346c9e415b81e43401145b96d4167"
Expand Down