svg-element-attributes
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -1,93 +0,6 @@ | ||
export var svgElementAttributes: { | ||
'*': string[] | ||
a: string[] | ||
altGlyph: string[] | ||
animate: string[] | ||
animateColor: string[] | ||
animateMotion: string[] | ||
animateTransform: string[] | ||
animation: string[] | ||
audio: string[] | ||
canvas: string[] | ||
circle: string[] | ||
clipPath: string[] | ||
'color-profile': string[] | ||
cursor: string[] | ||
defs: string[] | ||
desc: string[] | ||
discard: string[] | ||
ellipse: string[] | ||
feBlend: string[] | ||
feColorMatrix: string[] | ||
feComponentTransfer: string[] | ||
feComposite: string[] | ||
feConvolveMatrix: string[] | ||
feDiffuseLighting: string[] | ||
feDisplacementMap: string[] | ||
feDistantLight: string[] | ||
feDropShadow: string[] | ||
feFlood: string[] | ||
feFuncA: string[] | ||
feFuncB: string[] | ||
feFuncG: string[] | ||
feFuncR: string[] | ||
feGaussianBlur: string[] | ||
feImage: string[] | ||
feMerge: string[] | ||
feMergeNode: string[] | ||
feMorphology: string[] | ||
feOffset: string[] | ||
fePointLight: string[] | ||
feSpecularLighting: string[] | ||
feSpotLight: string[] | ||
feTile: string[] | ||
feTurbulence: string[] | ||
filter: string[] | ||
font: string[] | ||
'font-face': string[] | ||
'font-face-format': string[] | ||
'font-face-name': string[] | ||
'font-face-uri': string[] | ||
foreignObject: string[] | ||
g: string[] | ||
glyph: string[] | ||
glyphRef: string[] | ||
handler: string[] | ||
hkern: string[] | ||
iframe: string[] | ||
image: string[] | ||
line: string[] | ||
linearGradient: string[] | ||
listener: string[] | ||
marker: string[] | ||
mask: string[] | ||
metadata: string[] | ||
'missing-glyph': string[] | ||
mpath: string[] | ||
path: string[] | ||
pattern: string[] | ||
polygon: string[] | ||
polyline: string[] | ||
prefetch: string[] | ||
radialGradient: string[] | ||
rect: string[] | ||
script: string[] | ||
set: string[] | ||
stop: string[] | ||
style: string[] | ||
svg: string[] | ||
switch: string[] | ||
symbol: string[] | ||
tbreak: string[] | ||
text: string[] | ||
textArea: string[] | ||
textPath: string[] | ||
title: string[] | ||
tref: string[] | ||
tspan: string[] | ||
unknown: string[] | ||
use: string[] | ||
video: string[] | ||
view: string[] | ||
vkern: string[] | ||
} | ||
/** | ||
* Map of SVG elements to allowed attributes. | ||
* | ||
* @type {Record<string, Array<string>>} | ||
*/ | ||
export const svgElementAttributes: Record<string, Array<string>> |
{ | ||
"name": "svg-element-attributes", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Map of SVG elements to allowed attributes", | ||
@@ -34,23 +34,23 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@types/concat-stream": "^1.6.0", | ||
"@types/hast": "^2.3.1", | ||
"@types/node": "^14.14.37", | ||
"@types/tape": "^4.13.0", | ||
"alpha-sort": "^4.0.0", | ||
"@types/concat-stream": "^1.0.0", | ||
"@types/hast": "^2.0.0", | ||
"@types/node": "^16.0.0", | ||
"@types/tape": "^4.0.0", | ||
"aria-attributes": "^2.0.0", | ||
"bail": "^2.0.0", | ||
"c8": "^7.0.0", | ||
"concat-stream": "^2.0.0", | ||
"hast-util-is-event-handler": "^1.0.0", | ||
"hast-util-select": "^4.0.0", | ||
"hast-util-to-string": "^1.0.0", | ||
"hast-util-is-event-handler": "^2.0.0", | ||
"hast-util-select": "^5.0.0", | ||
"hast-util-to-string": "^2.0.0", | ||
"prettier": "^2.0.0", | ||
"rehype-parse": "^7.0.0", | ||
"remark-cli": "^9.0.0", | ||
"remark-preset-wooorm": "^8.0.0", | ||
"rimraf": "^3.0.2", | ||
"rehype-parse": "^8.0.0", | ||
"remark-cli": "^10.0.0", | ||
"remark-preset-wooorm": "^9.0.0", | ||
"rimraf": "^3.0.0", | ||
"tape": "^5.0.0", | ||
"type-coverage": "^2.17.0", | ||
"typescript": "^4.2.3", | ||
"unified": "^9.0.0", | ||
"xo": "^0.38.0" | ||
"type-coverage": "^2.0.0", | ||
"typescript": "^4.0.0", | ||
"unified": "^10.0.0", | ||
"xo": "^0.46.0" | ||
}, | ||
@@ -77,5 +77,2 @@ "scripts": { | ||
"rules": { | ||
"import/no-mutable-exports": "off", | ||
"no-var": "off", | ||
"prefer-arrow-callback": "off", | ||
"unicorn/no-array-for-each": "off", | ||
@@ -82,0 +79,0 @@ "unicorn/no-array-callback-reference": "off" |
102
readme.md
@@ -9,16 +9,40 @@ # svg-element-attributes | ||
Map of SVG elements to allowed attributes. | ||
Also contains global attributes under `'*'`. | ||
Includes attributes from [SVG 1.1][1.1], [SVG Tiny 1.2][1.2], and [SVG 2][2.0]. | ||
## Contents | ||
> **Note**: Does not include ARIA attributes (`role`, `aria-*`), `xml:*` or | ||
> `xlink:*` attributes, event attributes (`on*`), or `ev:event`. | ||
* [What is this?](#what-is-this) | ||
* [When should I use this?](#when-should-i-use-this) | ||
* [Install](#install) | ||
* [Use](#use) | ||
* [API](#api) | ||
* [`svgElementAttributes`](#svgelementattributes) | ||
* [Types](#types) | ||
* [Compatibility](#compatibility) | ||
* [Security](#security) | ||
* [Related](#related) | ||
* [Contribute](#contribute) | ||
* [License](#license) | ||
## What is this? | ||
This is a map of tag names to lists of allowed attributes. | ||
Global attributes are stored at the special tag name `*`. | ||
All attributes from [SVG 1.1][1.1], [SVG Tiny 1.2][1.2], and [SVG 2][2.0] are | ||
included. | ||
> 👉 **Note**: Includes deprecated attributes. | ||
> 👉 **Note**: ARIA (`role`, `aria-*`), event (`ev:event`, `on*`), or `xml:*` | ||
> and `xlink:*` attributes are not included. | ||
## When should I use this? | ||
You can use this to figure out if certain attributes are allowed on certain | ||
SVG elements. | ||
## Install | ||
This package is ESM only: Node 12+ is needed to use it and it must be `import`ed | ||
instead of `require`d. | ||
This package is [ESM only][esm]. | ||
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]: | ||
[npm][]: | ||
```sh | ||
@@ -28,2 +52,16 @@ npm install svg-element-attributes | ||
In Deno with [Skypack][]: | ||
```js | ||
import {svgElementAttributes} from 'https://cdn.skypack.dev/svg-element-attributes@2?dts' | ||
``` | ||
In browsers with [Skypack][]: | ||
```html | ||
<script type="module"> | ||
import {svgElementAttributes} from 'https://cdn.skypack.dev/svg-element-attributes@2?min' | ||
</script> | ||
``` | ||
## Use | ||
@@ -75,7 +113,41 @@ | ||
`Object.<Array.<string>>` — Map of tag names to an array of attribute names. | ||
Map of lowercase SVG elements to allowed attributes | ||
(`Record<string, Array<string>>`). | ||
The object contains one special key: `'*'`, which contains global attributes | ||
that apply to all SVG elements. | ||
## Types | ||
This package is fully typed with [TypeScript][]. | ||
## Compatibility | ||
This package is at least compatible with all maintained versions of Node.js. | ||
As of now, that is Node.js 12.20+, 14.14+, and 16.0+. | ||
It also works in Deno and modern browsers. | ||
## Security | ||
This package is safe. | ||
## Related | ||
* [`wooorm/web-namespaces`](https://github.com/wooorm/web-namespaces) | ||
— list of web namespaces | ||
* [`wooorm/html-tag-names`](https://github.com/wooorm/html-tag-names) | ||
— list of HTML tag names | ||
* [`wooorm/mathml-tag-names`](https://github.com/wooorm/mathml-tag-names) | ||
— list of MathML tag names | ||
* [`wooorm/svg-tag-names`](https://github.com/wooorm/svg-tag-names) | ||
— list of SVG tag names | ||
* [`wooorm/html-void-elements`](https://github.com/wooorm/html-void-elements) | ||
— list of void HTML tag names | ||
* [`wooorm/html-element-attributes`](https://github.com/wooorm/html-element-attributes) | ||
— map of HTML elements to attributes | ||
* [`wooorm/aria-attributes`](https://github.com/wooorm/aria-attributes) | ||
— list of ARIA attributes | ||
## Contribute | ||
Yes please! | ||
See [How to Contribute to Open Source][contribute]. | ||
## License | ||
@@ -105,2 +177,4 @@ | ||
[skypack]: https://www.skypack.dev | ||
[license]: license | ||
@@ -110,2 +184,8 @@ | ||
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c | ||
[typescript]: https://www.typescriptlang.org | ||
[contribute]: https://opensource.guide/how-to-contribute/ | ||
[1.1]: https://www.w3.org/TR/SVG/attindex.html | ||
@@ -112,0 +192,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
90172
191
0
4241