deploy: v0.12 fix 存档key名

This commit is contained in:
2026-06-24 03:09:02 +00:00
parent 7a08d49fe3
commit e0a5281119
58743 changed files with 7297269 additions and 39505 deletions
+212
View File
@@ -0,0 +1,212 @@
'use strict'
var find = require('property-information/find')
var normalize = require('property-information/normalize')
var parseSelector = require('hast-util-parse-selector')
var spaces = require('space-separated-tokens').parse
var commas = require('comma-separated-tokens').parse
module.exports = factory
var own = {}.hasOwnProperty
function factory(schema, defaultTagName, caseSensitive) {
var adjust = caseSensitive ? createAdjustMap(caseSensitive) : null
return h
// Hyperscript compatible DSL for creating virtual hast trees.
function h(selector, properties) {
var node = parseSelector(selector, defaultTagName)
var children = Array.prototype.slice.call(arguments, 2)
var name = node.tagName.toLowerCase()
var property
node.tagName = adjust && own.call(adjust, name) ? adjust[name] : name
if (properties && isChildren(properties, node)) {
children.unshift(properties)
properties = null
}
if (properties) {
for (property in properties) {
addProperty(node.properties, property, properties[property])
}
}
addChild(node.children, children)
if (node.tagName === 'template') {
node.content = {type: 'root', children: node.children}
node.children = []
}
return node
}
function addProperty(properties, key, value) {
var info
var property
var result
// Ignore nullish and NaN values.
if (value === null || value === undefined || value !== value) {
return
}
info = find(schema, key)
property = info.property
result = value
// Handle list values.
if (typeof result === 'string') {
if (info.spaceSeparated) {
result = spaces(result)
} else if (info.commaSeparated) {
result = commas(result)
} else if (info.commaOrSpaceSeparated) {
result = spaces(commas(result).join(' '))
}
}
// Accept `object` on style.
if (property === 'style' && typeof value !== 'string') {
result = style(result)
}
// Class-names (which can be added both on the `selector` and here).
if (property === 'className' && properties.className) {
result = properties.className.concat(result)
}
properties[property] = parsePrimitives(info, property, result)
}
}
function isChildren(value, node) {
return (
typeof value === 'string' ||
'length' in value ||
isNode(node.tagName, value)
)
}
function isNode(tagName, value) {
var type = value.type
if (tagName === 'input' || !type || typeof type !== 'string') {
return false
}
if (typeof value.children === 'object' && 'length' in value.children) {
return true
}
type = type.toLowerCase()
if (tagName === 'button') {
return (
type !== 'menu' &&
type !== 'submit' &&
type !== 'reset' &&
type !== 'button'
)
}
return 'value' in value
}
function addChild(nodes, value) {
var index
var length
if (typeof value === 'string' || typeof value === 'number') {
nodes.push({type: 'text', value: String(value)})
return
}
if (typeof value === 'object' && 'length' in value) {
index = -1
length = value.length
while (++index < length) {
addChild(nodes, value[index])
}
return
}
if (typeof value !== 'object' || !('type' in value)) {
throw new Error('Expected node, nodes, or string, got `' + value + '`')
}
nodes.push(value)
}
// Parse a (list of) primitives.
function parsePrimitives(info, name, value) {
var index
var length
var result
if (typeof value !== 'object' || !('length' in value)) {
return parsePrimitive(info, name, value)
}
length = value.length
index = -1
result = []
while (++index < length) {
result[index] = parsePrimitive(info, name, value[index])
}
return result
}
// Parse a single primitives.
function parsePrimitive(info, name, value) {
var result = value
if (info.number || info.positiveNumber) {
if (!isNaN(result) && result !== '') {
result = Number(result)
}
} else if (info.boolean || info.overloadedBoolean) {
// Accept `boolean` and `string`.
if (
typeof result === 'string' &&
(result === '' || normalize(value) === normalize(name))
) {
result = true
}
}
return result
}
function style(value) {
var result = []
var key
for (key in value) {
result.push([key, value[key]].join(': '))
}
return result.join('; ')
}
function createAdjustMap(values) {
var length = values.length
var index = -1
var result = {}
var value
while (++index < length) {
value = values[index]
result[value.toLowerCase()] = value
}
return result
}
+9
View File
@@ -0,0 +1,9 @@
'use strict'
var schema = require('property-information/html')
var factory = require('./factory')
var html = factory(schema, 'div')
html.displayName = 'html'
module.exports = html
+29
View File
@@ -0,0 +1,29 @@
// TypeScript Version: 3.5
import {Element, Properties, Node} from 'hast'
/**
* DSL to create virtual hast trees for HTML or SVG
*
* @param selector Simple CSS selector
* @param children (Lists of) child nodes
*/
declare function hastscript(
selector?: string,
children?: string | Node | Array<string | Node>
): Element
/**
* DSL to create virtual hast trees for HTML or SVG
*
* @param selector Simple CSS selector
* @param properties Map of properties
* @param children (Lists of) child nodes
*/
declare function hastscript(
selector?: string,
properties?: Properties,
children?: string | Node | Array<string | Node>
): Element
export = hastscript
+3
View File
@@ -0,0 +1,3 @@
'use strict'
module.exports = require('./html')
+22
View File
@@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
+15
View File
@@ -0,0 +1,15 @@
# Installation
> `npm install --save @types/hast`
# Summary
This package contains type definitions for hast (https://github.com/syntax-tree/hast).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/hast/v2.
### Additional Details
* Last updated: Tue, 30 Jan 2024 21:35:45 GMT
* Dependencies: [@types/unist](https://npmjs.com/package/@types/unist)
# Credits
These definitions were written by [lukeggchapman](https://github.com/lukeggchapman), [Junyoung Choi](https://github.com/rokt33r), and [Christian Murphy](https://github.com/ChristianMurphy).
+154
View File
@@ -0,0 +1,154 @@
import { Literal as UnistLiteral, Node as UnistNode, Parent as UnistParent } from "unist";
export { UnistNode as Node };
/**
* This map registers all node types that may be used as top-level content in the document.
*
* These types are accepted inside `root` nodes.
*
* This interface can be augmented to register custom node types.
*
* @example
* declare module 'hast' {
* interface RootContentMap {
* // Allow using raw nodes defined by `rehype-raw`.
* raw: Raw;
* }
* }
*/
export interface RootContentMap {
comment: Comment;
doctype: DocType;
element: Element;
text: Text;
}
/**
* This map registers all node types that may be used as content in an element.
*
* These types are accepted inside `element` nodes.
*
* This interface can be augmented to register custom node types.
*
* @example
* declare module 'hast' {
* interface RootContentMap {
* custom: Custom;
* }
* }
*/
export interface ElementContentMap {
comment: Comment;
element: Element;
text: Text;
}
export type Content = RootContent | ElementContent;
export type RootContent = RootContentMap[keyof RootContentMap];
export type ElementContent = ElementContentMap[keyof ElementContentMap];
/**
* Node in hast containing other nodes.
*/
export interface Parent extends UnistParent {
/**
* List representing the children of a node.
*/
children: Content[];
}
/**
* Nodes in hast containing a value.
*/
export interface Literal extends UnistLiteral {
value: string;
}
/**
* Root represents a document.
* Can be used as the root of a tree, or as a value of the
* content field on a 'template' Element, never as a child.
*/
export interface Root extends Parent {
/**
* Represents this variant of a Node.
*/
type: "root";
/**
* List representing the children of a node.
*/
children: RootContent[];
}
/**
* Element represents an HTML Element.
*/
export interface Element extends Parent {
/**
* Represents this variant of a Node.
*/
type: "element";
/**
* Represents the elements local name.
*/
tagName: string;
/**
* Represents information associated with the element.
*/
properties?: Properties | undefined;
/**
* If the tagName field is 'template', a content field can be present.
*/
content?: Root | undefined;
/**
* List representing the children of a node.
*/
children: ElementContent[];
}
/**
* Represents information associated with an element.
*/
export interface Properties {
[PropertyName: string]: boolean | number | string | null | undefined | Array<string | number>;
}
/**
* Represents an HTML DocumentType.
*/
export interface DocType extends UnistNode {
/**
* Represents this variant of a Node.
*/
type: "doctype";
name: string;
}
/**
* Represents an HTML Comment.
*/
export interface Comment extends Literal {
/**
* Represents this variant of a Literal.
*/
type: "comment";
}
/**
* Represents an HTML Text.
*/
export interface Text extends Literal {
/**
* Represents this variant of a Literal.
*/
type: "text";
}
@@ -0,0 +1,21 @@
MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
@@ -0,0 +1,122 @@
# Installation
> `npm install --save @types/unist`
# Summary
This package contains type definitions for unist (https://github.com/syntax-tree/unist).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist/v2.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist/v2/index.d.ts)
````ts
/**
* Syntactic units in unist syntax trees are called nodes.
*
* @typeParam TData Information from the ecosystem. Useful for more specific {@link Node.data}.
*/
export interface Node<TData extends object = Data> {
/**
* The variant of a node.
*/
type: string;
/**
* Information from the ecosystem.
*/
data?: TData | undefined;
/**
* Location of a node in a source document.
* Must not be present if a node is generated.
*/
position?: Position | undefined;
}
/**
* Information associated by the ecosystem with the node.
* Space is guaranteed to never be specified by unist or specifications
* implementing unist.
*/
export interface Data {
[key: string]: unknown;
}
/**
* Location of a node in a source file.
*/
export interface Position {
/**
* Place of the first character of the parsed source region.
*/
start: Point;
/**
* Place of the first character after the parsed source region.
*/
end: Point;
/**
* Start column at each index (plus start line) in the source region,
* for elements that span multiple lines.
*/
indent?: number[] | undefined;
}
/**
* One place in a source file.
*/
export interface Point {
/**
* Line in a source file (1-indexed integer).
*/
line: number;
/**
* Column in a source file (1-indexed integer).
*/
column: number;
/**
* Character in a source file (0-indexed integer).
*/
offset?: number | undefined;
}
/**
* Util for extracting type of {@link Node.data}
*
* @typeParam TNode Specific node type such as {@link Node} with {@link Data}, {@link Literal}, etc.
*
* @example `NodeData<Node<{ key: string }>>` -> `{ key: string }`
*/
export type NodeData<TNode extends Node<object>> = TNode extends Node<infer TData> ? TData : never;
/**
* Nodes containing other nodes.
*
* @typeParam ChildNode Node item of {@link Parent.children}
*/
export interface Parent<ChildNode extends Node<object> = Node, TData extends object = NodeData<ChildNode>>
extends Node<TData>
{
/**
* List representing the children of a node.
*/
children: ChildNode[];
}
/**
* Nodes containing a value.
*
* @typeParam Value Specific value type of {@link Literal.value} such as `string` for `Text` node
*/
export interface Literal<Value = unknown, TData extends object = Data> extends Node<TData> {
value: Value;
}
````
### Additional Details
* Last updated: Thu, 15 Aug 2024 02:18:53 GMT
* Dependencies: none
# Credits
These definitions were written by [bizen241](https://github.com/bizen241), [Jun Lu](https://github.com/lujun2), [Hernan Rajchert](https://github.com/hrajchert), [Titus Wormer](https://github.com/wooorm), [Junyoung Choi](https://github.com/rokt33r), [Ben Moon](https://github.com/GuiltyDolphin), and [JounQin](https://github.com/JounQin).
@@ -0,0 +1,103 @@
/**
* Syntactic units in unist syntax trees are called nodes.
*
* @typeParam TData Information from the ecosystem. Useful for more specific {@link Node.data}.
*/
export interface Node<TData extends object = Data> {
/**
* The variant of a node.
*/
type: string;
/**
* Information from the ecosystem.
*/
data?: TData | undefined;
/**
* Location of a node in a source document.
* Must not be present if a node is generated.
*/
position?: Position | undefined;
}
/**
* Information associated by the ecosystem with the node.
* Space is guaranteed to never be specified by unist or specifications
* implementing unist.
*/
export interface Data {
[key: string]: unknown;
}
/**
* Location of a node in a source file.
*/
export interface Position {
/**
* Place of the first character of the parsed source region.
*/
start: Point;
/**
* Place of the first character after the parsed source region.
*/
end: Point;
/**
* Start column at each index (plus start line) in the source region,
* for elements that span multiple lines.
*/
indent?: number[] | undefined;
}
/**
* One place in a source file.
*/
export interface Point {
/**
* Line in a source file (1-indexed integer).
*/
line: number;
/**
* Column in a source file (1-indexed integer).
*/
column: number;
/**
* Character in a source file (0-indexed integer).
*/
offset?: number | undefined;
}
/**
* Util for extracting type of {@link Node.data}
*
* @typeParam TNode Specific node type such as {@link Node} with {@link Data}, {@link Literal}, etc.
*
* @example `NodeData<Node<{ key: string }>>` -> `{ key: string }`
*/
export type NodeData<TNode extends Node<object>> = TNode extends Node<infer TData> ? TData : never;
/**
* Nodes containing other nodes.
*
* @typeParam ChildNode Node item of {@link Parent.children}
*/
export interface Parent<ChildNode extends Node<object> = Node, TData extends object = NodeData<ChildNode>>
extends Node<TData>
{
/**
* List representing the children of a node.
*/
children: ChildNode[];
}
/**
* Nodes containing a value.
*
* @typeParam Value Specific value type of {@link Literal.value} such as `string` for `Text` node
*/
export interface Literal<Value = unknown, TData extends object = Data> extends Node<TData> {
value: Value;
}
@@ -0,0 +1,55 @@
{
"name": "@types/unist",
"version": "2.0.11",
"description": "TypeScript definitions for unist",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist",
"license": "MIT",
"contributors": [
{
"name": "bizen241",
"githubUsername": "bizen241",
"url": "https://github.com/bizen241"
},
{
"name": "Jun Lu",
"githubUsername": "lujun2",
"url": "https://github.com/lujun2"
},
{
"name": "Hernan Rajchert",
"githubUsername": "hrajchert",
"url": "https://github.com/hrajchert"
},
{
"name": "Titus Wormer",
"githubUsername": "wooorm",
"url": "https://github.com/wooorm"
},
{
"name": "Junyoung Choi",
"githubUsername": "rokt33r",
"url": "https://github.com/rokt33r"
},
{
"name": "Ben Moon",
"githubUsername": "GuiltyDolphin",
"url": "https://github.com/GuiltyDolphin"
},
{
"name": "JounQin",
"githubUsername": "JounQin",
"url": "https://github.com/JounQin"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/unist"
},
"scripts": {},
"dependencies": {},
"typesPublisherContentHash": "6e36525a6db49ae5517fe0751796ca8f6c65099098415046d4f1ad6c2ef1a33c",
"typeScriptVersion": "4.8"
}
+37
View File
@@ -0,0 +1,37 @@
{
"name": "@types/hast",
"version": "2.3.10",
"description": "TypeScript definitions for hast",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/hast",
"license": "MIT",
"contributors": [
{
"name": "lukeggchapman",
"githubUsername": "lukeggchapman",
"url": "https://github.com/lukeggchapman"
},
{
"name": "Junyoung Choi",
"githubUsername": "rokt33r",
"url": "https://github.com/rokt33r"
},
{
"name": "Christian Murphy",
"githubUsername": "ChristianMurphy",
"url": "https://github.com/ChristianMurphy"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/hast"
},
"scripts": {},
"dependencies": {
"@types/unist": "^2"
},
"typesPublisherContentHash": "2bd336f07db8b00ba446e1e8ab1ef035ebc1061b629c2479b2fddb06b5418707",
"typeScriptVersion": "4.6"
}
+52
View File
@@ -0,0 +1,52 @@
'use strict'
exports.parse = parse
exports.stringify = stringify
var comma = ','
var space = ' '
var empty = ''
// Parse comma-separated tokens to an array.
function parse(value) {
var values = []
var input = String(value || empty)
var index = input.indexOf(comma)
var lastIndex = 0
var end = false
var val
while (!end) {
if (index === -1) {
index = input.length
end = true
}
val = input.slice(lastIndex, index).trim()
if (val || !end) {
values.push(val)
}
lastIndex = index + 1
index = input.indexOf(comma, lastIndex)
}
return values
}
// Compile an array to comma-separated tokens.
// `options.padLeft` (default: `true`) pads a space left of each token, and
// `options.padRight` (default: `false`) pads a space to the right of each token.
function stringify(values, options) {
var settings = options || {}
var left = settings.padLeft === false ? empty : space
var right = settings.padRight ? space : empty
// Ensure the last empty entry is seen.
if (values[values.length - 1] === empty) {
values = values.concat(empty)
}
return values.join(right + comma + left).trim()
}
+22
View File
@@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,67 @@
{
"name": "comma-separated-tokens",
"version": "1.0.8",
"description": "Parse and stringify comma-separated tokens",
"license": "MIT",
"keywords": [
"dom",
"html",
"comma",
"separated",
"tokens",
"parse",
"stringify"
],
"repository": "wooorm/comma-separated-tokens",
"bugs": "https://github.com/wooorm/comma-separated-tokens/issues",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
],
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^15.0.0",
"prettier": "^1.0.0",
"remark-cli": "^7.0.0",
"remark-preset-wooorm": "^6.0.0",
"tape": "^4.0.0",
"tinyify": "^2.0.0",
"xo": "^0.25.0"
},
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s commaSeparatedTokens -o comma-separated-tokens.js",
"build-mangle": "browserify . -s commaSeparatedTokens -p tinyify -o comma-separated-tokens.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": false,
"semi": false,
"trailingComma": "none"
},
"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"comma-separated-tokens.js"
]
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
+87
View File
@@ -0,0 +1,87 @@
# comma-separated-tokens
[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
Parse and stringify comma-separated tokens according to the [spec][].
## Install
[npm][]:
```sh
npm install comma-separated-tokens
```
## Use
```js
var commaSeparated = require('comma-separated-tokens')
commaSeparated.parse(' a ,b,,d d ') //=> ['a', 'b', '', 'd d']
commaSeparated.stringify(['a', 'b', '', 'd d']) //=> 'a, b, , d d'
```
## API
### `commaSeparated.parse(value)`
Parse comma-separated tokens (`string`) to an array of strings, according
to the [spec][].
### `commaSeparated.stringify(values[, options])`
Compile an array of strings to comma-separated tokens (`string`).
Handles empty items at start or end correctly.
Note that its not possible to specify initial or final whitespace per value.
##### `options`
###### `options.padLeft`
Whether to pad a space before a token (`boolean`, default: `true`).
###### `options.padRight`
Whether to pad a space after a token (`boolean`, default: `false`).
## Related
* [`collapse-white-space`](https://github.com/wooorm/collapse-white-space)
— Replace multiple white-space characters with a single space
* [`property-information`](https://github.com/wooorm/property-information)
— Information on HTML properties
* [`space-separated-tokens`](https://github.com/wooorm/space-separated-tokens)
— Parse/stringify space-separated tokens
## License
[MIT][license] © [Titus Wormer][author]
<!-- Definitions -->
[build-badge]: https://img.shields.io/travis/wooorm/comma-separated-tokens.svg
[build]: https://travis-ci.org/wooorm/comma-separated-tokens
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/comma-separated-tokens.svg
[coverage]: https://codecov.io/github/wooorm/comma-separated-tokens
[downloads-badge]: https://img.shields.io/npm/dm/comma-separated-tokens.svg
[downloads]: https://www.npmjs.com/package/comma-separated-tokens
[size-badge]: https://img.shields.io/bundlephobia/minzip/comma-separated-tokens.svg
[size]: https://bundlephobia.com/result?p=comma-separated-tokens
[npm]: https://docs.npmjs.com/cli/install
[license]: license
[author]: https://wooorm.com
[spec]: https://html.spec.whatwg.org/#comma-separated-tokens
+65
View File
@@ -0,0 +1,65 @@
'use strict'
var normalize = require('./normalize')
var DefinedInfo = require('./lib/util/defined-info')
var Info = require('./lib/util/info')
var data = 'data'
module.exports = find
var valid = /^data[-\w.:]+$/i
var dash = /-[a-z]/g
var cap = /[A-Z]/g
function find(schema, value) {
var normal = normalize(value)
var prop = value
var Type = Info
if (normal in schema.normal) {
return schema.property[schema.normal[normal]]
}
if (normal.length > 4 && normal.slice(0, 4) === data && valid.test(value)) {
// Attribute or property.
if (value.charAt(4) === '-') {
prop = datasetToProperty(value)
} else {
value = datasetToAttribute(value)
}
Type = DefinedInfo
}
return new Type(prop, value)
}
function datasetToProperty(attribute) {
var value = attribute.slice(5).replace(dash, camelcase)
return data + value.charAt(0).toUpperCase() + value.slice(1)
}
function datasetToAttribute(property) {
var value = property.slice(4)
if (dash.test(value)) {
return property
}
value = value.replace(cap, kebab)
if (value.charAt(0) !== '-') {
value = '-' + value
}
return data + value
}
function kebab($0) {
return '-' + $0.toLowerCase()
}
function camelcase($0) {
return $0.charAt(1).toUpperCase()
}
@@ -0,0 +1,19 @@
{
"classId": "classID",
"dataType": "datatype",
"itemId": "itemID",
"strokeDashArray": "strokeDasharray",
"strokeDashOffset": "strokeDashoffset",
"strokeLineCap": "strokeLinecap",
"strokeLineJoin": "strokeLinejoin",
"strokeMiterLimit": "strokeMiterlimit",
"typeOf": "typeof",
"xLinkActuate": "xlinkActuate",
"xLinkArcRole": "xlinkArcrole",
"xLinkHref": "xlinkHref",
"xLinkRole": "xlinkRole",
"xLinkShow": "xlinkShow",
"xLinkTitle": "xlinkTitle",
"xLinkType": "xlinkType",
"xmlnsXLink": "xmlnsXlink"
}
+10
View File
@@ -0,0 +1,10 @@
'use strict'
var merge = require('./lib/util/merge')
var xlink = require('./lib/xlink')
var xml = require('./lib/xml')
var xmlns = require('./lib/xmlns')
var aria = require('./lib/aria')
var html = require('./lib/html')
module.exports = merge([xml, xlink, xmlns, aria, html])
+6
View File
@@ -0,0 +1,6 @@
'use strict'
exports.html = require('./html')
exports.svg = require('./svg')
exports.normalize = require('./normalize')
exports.find = require('./find')
+67
View File
@@ -0,0 +1,67 @@
'use strict'
var types = require('./util/types')
var create = require('./util/create')
var booleanish = types.booleanish
var number = types.number
var spaceSeparated = types.spaceSeparated
module.exports = create({
transform: ariaTransform,
properties: {
ariaActiveDescendant: null,
ariaAtomic: booleanish,
ariaAutoComplete: null,
ariaBusy: booleanish,
ariaChecked: booleanish,
ariaColCount: number,
ariaColIndex: number,
ariaColSpan: number,
ariaControls: spaceSeparated,
ariaCurrent: null,
ariaDescribedBy: spaceSeparated,
ariaDetails: null,
ariaDisabled: booleanish,
ariaDropEffect: spaceSeparated,
ariaErrorMessage: null,
ariaExpanded: booleanish,
ariaFlowTo: spaceSeparated,
ariaGrabbed: booleanish,
ariaHasPopup: null,
ariaHidden: booleanish,
ariaInvalid: null,
ariaKeyShortcuts: null,
ariaLabel: null,
ariaLabelledBy: spaceSeparated,
ariaLevel: number,
ariaLive: null,
ariaModal: booleanish,
ariaMultiLine: booleanish,
ariaMultiSelectable: booleanish,
ariaOrientation: null,
ariaOwns: spaceSeparated,
ariaPlaceholder: null,
ariaPosInSet: number,
ariaPressed: booleanish,
ariaReadOnly: booleanish,
ariaRelevant: null,
ariaRequired: booleanish,
ariaRoleDescription: spaceSeparated,
ariaRowCount: number,
ariaRowIndex: number,
ariaRowSpan: number,
ariaSelected: booleanish,
ariaSetSize: number,
ariaSort: null,
ariaValueMax: number,
ariaValueMin: number,
ariaValueNow: number,
ariaValueText: null,
role: null
}
})
function ariaTransform(_, prop) {
return prop === 'role' ? prop : 'aria-' + prop.slice(4).toLowerCase()
}
+309
View File
@@ -0,0 +1,309 @@
'use strict'
var types = require('./util/types')
var create = require('./util/create')
var caseInsensitiveTransform = require('./util/case-insensitive-transform')
var boolean = types.boolean
var overloadedBoolean = types.overloadedBoolean
var booleanish = types.booleanish
var number = types.number
var spaceSeparated = types.spaceSeparated
var commaSeparated = types.commaSeparated
module.exports = create({
space: 'html',
attributes: {
acceptcharset: 'accept-charset',
classname: 'class',
htmlfor: 'for',
httpequiv: 'http-equiv'
},
transform: caseInsensitiveTransform,
mustUseProperty: ['checked', 'multiple', 'muted', 'selected'],
properties: {
// Standard Properties.
abbr: null,
accept: commaSeparated,
acceptCharset: spaceSeparated,
accessKey: spaceSeparated,
action: null,
allow: null,
allowFullScreen: boolean,
allowPaymentRequest: boolean,
allowUserMedia: boolean,
alt: null,
as: null,
async: boolean,
autoCapitalize: null,
autoComplete: spaceSeparated,
autoFocus: boolean,
autoPlay: boolean,
capture: boolean,
charSet: null,
checked: boolean,
cite: null,
className: spaceSeparated,
cols: number,
colSpan: null,
content: null,
contentEditable: booleanish,
controls: boolean,
controlsList: spaceSeparated,
coords: number | commaSeparated,
crossOrigin: null,
data: null,
dateTime: null,
decoding: null,
default: boolean,
defer: boolean,
dir: null,
dirName: null,
disabled: boolean,
download: overloadedBoolean,
draggable: booleanish,
encType: null,
enterKeyHint: null,
form: null,
formAction: null,
formEncType: null,
formMethod: null,
formNoValidate: boolean,
formTarget: null,
headers: spaceSeparated,
height: number,
hidden: boolean,
high: number,
href: null,
hrefLang: null,
htmlFor: spaceSeparated,
httpEquiv: spaceSeparated,
id: null,
imageSizes: null,
imageSrcSet: commaSeparated,
inputMode: null,
integrity: null,
is: null,
isMap: boolean,
itemId: null,
itemProp: spaceSeparated,
itemRef: spaceSeparated,
itemScope: boolean,
itemType: spaceSeparated,
kind: null,
label: null,
lang: null,
language: null,
list: null,
loading: null,
loop: boolean,
low: number,
manifest: null,
max: null,
maxLength: number,
media: null,
method: null,
min: null,
minLength: number,
multiple: boolean,
muted: boolean,
name: null,
nonce: null,
noModule: boolean,
noValidate: boolean,
onAbort: null,
onAfterPrint: null,
onAuxClick: null,
onBeforePrint: null,
onBeforeUnload: null,
onBlur: null,
onCancel: null,
onCanPlay: null,
onCanPlayThrough: null,
onChange: null,
onClick: null,
onClose: null,
onContextMenu: null,
onCopy: null,
onCueChange: null,
onCut: null,
onDblClick: null,
onDrag: null,
onDragEnd: null,
onDragEnter: null,
onDragExit: null,
onDragLeave: null,
onDragOver: null,
onDragStart: null,
onDrop: null,
onDurationChange: null,
onEmptied: null,
onEnded: null,
onError: null,
onFocus: null,
onFormData: null,
onHashChange: null,
onInput: null,
onInvalid: null,
onKeyDown: null,
onKeyPress: null,
onKeyUp: null,
onLanguageChange: null,
onLoad: null,
onLoadedData: null,
onLoadedMetadata: null,
onLoadEnd: null,
onLoadStart: null,
onMessage: null,
onMessageError: null,
onMouseDown: null,
onMouseEnter: null,
onMouseLeave: null,
onMouseMove: null,
onMouseOut: null,
onMouseOver: null,
onMouseUp: null,
onOffline: null,
onOnline: null,
onPageHide: null,
onPageShow: null,
onPaste: null,
onPause: null,
onPlay: null,
onPlaying: null,
onPopState: null,
onProgress: null,
onRateChange: null,
onRejectionHandled: null,
onReset: null,
onResize: null,
onScroll: null,
onSecurityPolicyViolation: null,
onSeeked: null,
onSeeking: null,
onSelect: null,
onSlotChange: null,
onStalled: null,
onStorage: null,
onSubmit: null,
onSuspend: null,
onTimeUpdate: null,
onToggle: null,
onUnhandledRejection: null,
onUnload: null,
onVolumeChange: null,
onWaiting: null,
onWheel: null,
open: boolean,
optimum: number,
pattern: null,
ping: spaceSeparated,
placeholder: null,
playsInline: boolean,
poster: null,
preload: null,
readOnly: boolean,
referrerPolicy: null,
rel: spaceSeparated,
required: boolean,
reversed: boolean,
rows: number,
rowSpan: number,
sandbox: spaceSeparated,
scope: null,
scoped: boolean,
seamless: boolean,
selected: boolean,
shape: null,
size: number,
sizes: null,
slot: null,
span: number,
spellCheck: booleanish,
src: null,
srcDoc: null,
srcLang: null,
srcSet: commaSeparated,
start: number,
step: null,
style: null,
tabIndex: number,
target: null,
title: null,
translate: null,
type: null,
typeMustMatch: boolean,
useMap: null,
value: booleanish,
width: number,
wrap: null,
// Legacy.
// See: https://html.spec.whatwg.org/#other-elements,-attributes-and-apis
align: null, // Several. Use CSS `text-align` instead,
aLink: null, // `<body>`. Use CSS `a:active {color}` instead
archive: spaceSeparated, // `<object>`. List of URIs to archives
axis: null, // `<td>` and `<th>`. Use `scope` on `<th>`
background: null, // `<body>`. Use CSS `background-image` instead
bgColor: null, // `<body>` and table elements. Use CSS `background-color` instead
border: number, // `<table>`. Use CSS `border-width` instead,
borderColor: null, // `<table>`. Use CSS `border-color` instead,
bottomMargin: number, // `<body>`
cellPadding: null, // `<table>`
cellSpacing: null, // `<table>`
char: null, // Several table elements. When `align=char`, sets the character to align on
charOff: null, // Several table elements. When `char`, offsets the alignment
classId: null, // `<object>`
clear: null, // `<br>`. Use CSS `clear` instead
code: null, // `<object>`
codeBase: null, // `<object>`
codeType: null, // `<object>`
color: null, // `<font>` and `<hr>`. Use CSS instead
compact: boolean, // Lists. Use CSS to reduce space between items instead
declare: boolean, // `<object>`
event: null, // `<script>`
face: null, // `<font>`. Use CSS instead
frame: null, // `<table>`
frameBorder: null, // `<iframe>`. Use CSS `border` instead
hSpace: number, // `<img>` and `<object>`
leftMargin: number, // `<body>`
link: null, // `<body>`. Use CSS `a:link {color: *}` instead
longDesc: null, // `<frame>`, `<iframe>`, and `<img>`. Use an `<a>`
lowSrc: null, // `<img>`. Use a `<picture>`
marginHeight: number, // `<body>`
marginWidth: number, // `<body>`
noResize: boolean, // `<frame>`
noHref: boolean, // `<area>`. Use no href instead of an explicit `nohref`
noShade: boolean, // `<hr>`. Use background-color and height instead of borders
noWrap: boolean, // `<td>` and `<th>`
object: null, // `<applet>`
profile: null, // `<head>`
prompt: null, // `<isindex>`
rev: null, // `<link>`
rightMargin: number, // `<body>`
rules: null, // `<table>`
scheme: null, // `<meta>`
scrolling: booleanish, // `<frame>`. Use overflow in the child context
standby: null, // `<object>`
summary: null, // `<table>`
text: null, // `<body>`. Use CSS `color` instead
topMargin: number, // `<body>`
valueType: null, // `<param>`
version: null, // `<html>`. Use a doctype.
vAlign: null, // Several. Use CSS `vertical-align` instead
vLink: null, // `<body>`. Use CSS `a:visited {color}` instead
vSpace: number, // `<img>` and `<object>`
// Non-standard Properties.
allowTransparency: null,
autoCorrect: null,
autoSave: null,
disablePictureInPicture: boolean,
disableRemotePlayback: boolean,
prefix: null,
property: null,
results: number,
security: null,
unselectable: null
}
})
+567
View File
@@ -0,0 +1,567 @@
'use strict'
var types = require('./util/types')
var create = require('./util/create')
var caseSensitiveTransform = require('./util/case-sensitive-transform')
var boolean = types.boolean
var number = types.number
var spaceSeparated = types.spaceSeparated
var commaSeparated = types.commaSeparated
var commaOrSpaceSeparated = types.commaOrSpaceSeparated
module.exports = create({
space: 'svg',
attributes: {
accentHeight: 'accent-height',
alignmentBaseline: 'alignment-baseline',
arabicForm: 'arabic-form',
baselineShift: 'baseline-shift',
capHeight: 'cap-height',
className: 'class',
clipPath: 'clip-path',
clipRule: 'clip-rule',
colorInterpolation: 'color-interpolation',
colorInterpolationFilters: 'color-interpolation-filters',
colorProfile: 'color-profile',
colorRendering: 'color-rendering',
crossOrigin: 'crossorigin',
dataType: 'datatype',
dominantBaseline: 'dominant-baseline',
enableBackground: 'enable-background',
fillOpacity: 'fill-opacity',
fillRule: 'fill-rule',
floodColor: 'flood-color',
floodOpacity: 'flood-opacity',
fontFamily: 'font-family',
fontSize: 'font-size',
fontSizeAdjust: 'font-size-adjust',
fontStretch: 'font-stretch',
fontStyle: 'font-style',
fontVariant: 'font-variant',
fontWeight: 'font-weight',
glyphName: 'glyph-name',
glyphOrientationHorizontal: 'glyph-orientation-horizontal',
glyphOrientationVertical: 'glyph-orientation-vertical',
hrefLang: 'hreflang',
horizAdvX: 'horiz-adv-x',
horizOriginX: 'horiz-origin-x',
horizOriginY: 'horiz-origin-y',
imageRendering: 'image-rendering',
letterSpacing: 'letter-spacing',
lightingColor: 'lighting-color',
markerEnd: 'marker-end',
markerMid: 'marker-mid',
markerStart: 'marker-start',
navDown: 'nav-down',
navDownLeft: 'nav-down-left',
navDownRight: 'nav-down-right',
navLeft: 'nav-left',
navNext: 'nav-next',
navPrev: 'nav-prev',
navRight: 'nav-right',
navUp: 'nav-up',
navUpLeft: 'nav-up-left',
navUpRight: 'nav-up-right',
onAbort: 'onabort',
onActivate: 'onactivate',
onAfterPrint: 'onafterprint',
onBeforePrint: 'onbeforeprint',
onBegin: 'onbegin',
onCancel: 'oncancel',
onCanPlay: 'oncanplay',
onCanPlayThrough: 'oncanplaythrough',
onChange: 'onchange',
onClick: 'onclick',
onClose: 'onclose',
onCopy: 'oncopy',
onCueChange: 'oncuechange',
onCut: 'oncut',
onDblClick: 'ondblclick',
onDrag: 'ondrag',
onDragEnd: 'ondragend',
onDragEnter: 'ondragenter',
onDragExit: 'ondragexit',
onDragLeave: 'ondragleave',
onDragOver: 'ondragover',
onDragStart: 'ondragstart',
onDrop: 'ondrop',
onDurationChange: 'ondurationchange',
onEmptied: 'onemptied',
onEnd: 'onend',
onEnded: 'onended',
onError: 'onerror',
onFocus: 'onfocus',
onFocusIn: 'onfocusin',
onFocusOut: 'onfocusout',
onHashChange: 'onhashchange',
onInput: 'oninput',
onInvalid: 'oninvalid',
onKeyDown: 'onkeydown',
onKeyPress: 'onkeypress',
onKeyUp: 'onkeyup',
onLoad: 'onload',
onLoadedData: 'onloadeddata',
onLoadedMetadata: 'onloadedmetadata',
onLoadStart: 'onloadstart',
onMessage: 'onmessage',
onMouseDown: 'onmousedown',
onMouseEnter: 'onmouseenter',
onMouseLeave: 'onmouseleave',
onMouseMove: 'onmousemove',
onMouseOut: 'onmouseout',
onMouseOver: 'onmouseover',
onMouseUp: 'onmouseup',
onMouseWheel: 'onmousewheel',
onOffline: 'onoffline',
onOnline: 'ononline',
onPageHide: 'onpagehide',
onPageShow: 'onpageshow',
onPaste: 'onpaste',
onPause: 'onpause',
onPlay: 'onplay',
onPlaying: 'onplaying',
onPopState: 'onpopstate',
onProgress: 'onprogress',
onRateChange: 'onratechange',
onRepeat: 'onrepeat',
onReset: 'onreset',
onResize: 'onresize',
onScroll: 'onscroll',
onSeeked: 'onseeked',
onSeeking: 'onseeking',
onSelect: 'onselect',
onShow: 'onshow',
onStalled: 'onstalled',
onStorage: 'onstorage',
onSubmit: 'onsubmit',
onSuspend: 'onsuspend',
onTimeUpdate: 'ontimeupdate',
onToggle: 'ontoggle',
onUnload: 'onunload',
onVolumeChange: 'onvolumechange',
onWaiting: 'onwaiting',
onZoom: 'onzoom',
overlinePosition: 'overline-position',
overlineThickness: 'overline-thickness',
paintOrder: 'paint-order',
panose1: 'panose-1',
pointerEvents: 'pointer-events',
referrerPolicy: 'referrerpolicy',
renderingIntent: 'rendering-intent',
shapeRendering: 'shape-rendering',
stopColor: 'stop-color',
stopOpacity: 'stop-opacity',
strikethroughPosition: 'strikethrough-position',
strikethroughThickness: 'strikethrough-thickness',
strokeDashArray: 'stroke-dasharray',
strokeDashOffset: 'stroke-dashoffset',
strokeLineCap: 'stroke-linecap',
strokeLineJoin: 'stroke-linejoin',
strokeMiterLimit: 'stroke-miterlimit',
strokeOpacity: 'stroke-opacity',
strokeWidth: 'stroke-width',
tabIndex: 'tabindex',
textAnchor: 'text-anchor',
textDecoration: 'text-decoration',
textRendering: 'text-rendering',
typeOf: 'typeof',
underlinePosition: 'underline-position',
underlineThickness: 'underline-thickness',
unicodeBidi: 'unicode-bidi',
unicodeRange: 'unicode-range',
unitsPerEm: 'units-per-em',
vAlphabetic: 'v-alphabetic',
vHanging: 'v-hanging',
vIdeographic: 'v-ideographic',
vMathematical: 'v-mathematical',
vectorEffect: 'vector-effect',
vertAdvY: 'vert-adv-y',
vertOriginX: 'vert-origin-x',
vertOriginY: 'vert-origin-y',
wordSpacing: 'word-spacing',
writingMode: 'writing-mode',
xHeight: 'x-height',
// These were camelcased in Tiny. Now lowercased in SVG 2
playbackOrder: 'playbackorder',
timelineBegin: 'timelinebegin'
},
transform: caseSensitiveTransform,
properties: {
about: commaOrSpaceSeparated,
accentHeight: number,
accumulate: null,
additive: null,
alignmentBaseline: null,
alphabetic: number,
amplitude: number,
arabicForm: null,
ascent: number,
attributeName: null,
attributeType: null,
azimuth: number,
bandwidth: null,
baselineShift: null,
baseFrequency: null,
baseProfile: null,
bbox: null,
begin: null,
bias: number,
by: null,
calcMode: null,
capHeight: number,
className: spaceSeparated,
clip: null,
clipPath: null,
clipPathUnits: null,
clipRule: null,
color: null,
colorInterpolation: null,
colorInterpolationFilters: null,
colorProfile: null,
colorRendering: null,
content: null,
contentScriptType: null,
contentStyleType: null,
crossOrigin: null,
cursor: null,
cx: null,
cy: null,
d: null,
dataType: null,
defaultAction: null,
descent: number,
diffuseConstant: number,
direction: null,
display: null,
dur: null,
divisor: number,
dominantBaseline: null,
download: boolean,
dx: null,
dy: null,
edgeMode: null,
editable: null,
elevation: number,
enableBackground: null,
end: null,
event: null,
exponent: number,
externalResourcesRequired: null,
fill: null,
fillOpacity: number,
fillRule: null,
filter: null,
filterRes: null,
filterUnits: null,
floodColor: null,
floodOpacity: null,
focusable: null,
focusHighlight: null,
fontFamily: null,
fontSize: null,
fontSizeAdjust: null,
fontStretch: null,
fontStyle: null,
fontVariant: null,
fontWeight: null,
format: null,
fr: null,
from: null,
fx: null,
fy: null,
g1: commaSeparated,
g2: commaSeparated,
glyphName: commaSeparated,
glyphOrientationHorizontal: null,
glyphOrientationVertical: null,
glyphRef: null,
gradientTransform: null,
gradientUnits: null,
handler: null,
hanging: number,
hatchContentUnits: null,
hatchUnits: null,
height: null,
href: null,
hrefLang: null,
horizAdvX: number,
horizOriginX: number,
horizOriginY: number,
id: null,
ideographic: number,
imageRendering: null,
initialVisibility: null,
in: null,
in2: null,
intercept: number,
k: number,
k1: number,
k2: number,
k3: number,
k4: number,
kernelMatrix: commaOrSpaceSeparated,
kernelUnitLength: null,
keyPoints: null, // SEMI_COLON_SEPARATED
keySplines: null, // SEMI_COLON_SEPARATED
keyTimes: null, // SEMI_COLON_SEPARATED
kerning: null,
lang: null,
lengthAdjust: null,
letterSpacing: null,
lightingColor: null,
limitingConeAngle: number,
local: null,
markerEnd: null,
markerMid: null,
markerStart: null,
markerHeight: null,
markerUnits: null,
markerWidth: null,
mask: null,
maskContentUnits: null,
maskUnits: null,
mathematical: null,
max: null,
media: null,
mediaCharacterEncoding: null,
mediaContentEncodings: null,
mediaSize: number,
mediaTime: null,
method: null,
min: null,
mode: null,
name: null,
navDown: null,
navDownLeft: null,
navDownRight: null,
navLeft: null,
navNext: null,
navPrev: null,
navRight: null,
navUp: null,
navUpLeft: null,
navUpRight: null,
numOctaves: null,
observer: null,
offset: null,
onAbort: null,
onActivate: null,
onAfterPrint: null,
onBeforePrint: null,
onBegin: null,
onCancel: null,
onCanPlay: null,
onCanPlayThrough: null,
onChange: null,
onClick: null,
onClose: null,
onCopy: null,
onCueChange: null,
onCut: null,
onDblClick: null,
onDrag: null,
onDragEnd: null,
onDragEnter: null,
onDragExit: null,
onDragLeave: null,
onDragOver: null,
onDragStart: null,
onDrop: null,
onDurationChange: null,
onEmptied: null,
onEnd: null,
onEnded: null,
onError: null,
onFocus: null,
onFocusIn: null,
onFocusOut: null,
onHashChange: null,
onInput: null,
onInvalid: null,
onKeyDown: null,
onKeyPress: null,
onKeyUp: null,
onLoad: null,
onLoadedData: null,
onLoadedMetadata: null,
onLoadStart: null,
onMessage: null,
onMouseDown: null,
onMouseEnter: null,
onMouseLeave: null,
onMouseMove: null,
onMouseOut: null,
onMouseOver: null,
onMouseUp: null,
onMouseWheel: null,
onOffline: null,
onOnline: null,
onPageHide: null,
onPageShow: null,
onPaste: null,
onPause: null,
onPlay: null,
onPlaying: null,
onPopState: null,
onProgress: null,
onRateChange: null,
onRepeat: null,
onReset: null,
onResize: null,
onScroll: null,
onSeeked: null,
onSeeking: null,
onSelect: null,
onShow: null,
onStalled: null,
onStorage: null,
onSubmit: null,
onSuspend: null,
onTimeUpdate: null,
onToggle: null,
onUnload: null,
onVolumeChange: null,
onWaiting: null,
onZoom: null,
opacity: null,
operator: null,
order: null,
orient: null,
orientation: null,
origin: null,
overflow: null,
overlay: null,
overlinePosition: number,
overlineThickness: number,
paintOrder: null,
panose1: null,
path: null,
pathLength: number,
patternContentUnits: null,
patternTransform: null,
patternUnits: null,
phase: null,
ping: spaceSeparated,
pitch: null,
playbackOrder: null,
pointerEvents: null,
points: null,
pointsAtX: number,
pointsAtY: number,
pointsAtZ: number,
preserveAlpha: null,
preserveAspectRatio: null,
primitiveUnits: null,
propagate: null,
property: commaOrSpaceSeparated,
r: null,
radius: null,
referrerPolicy: null,
refX: null,
refY: null,
rel: commaOrSpaceSeparated,
rev: commaOrSpaceSeparated,
renderingIntent: null,
repeatCount: null,
repeatDur: null,
requiredExtensions: commaOrSpaceSeparated,
requiredFeatures: commaOrSpaceSeparated,
requiredFonts: commaOrSpaceSeparated,
requiredFormats: commaOrSpaceSeparated,
resource: null,
restart: null,
result: null,
rotate: null,
rx: null,
ry: null,
scale: null,
seed: null,
shapeRendering: null,
side: null,
slope: null,
snapshotTime: null,
specularConstant: number,
specularExponent: number,
spreadMethod: null,
spacing: null,
startOffset: null,
stdDeviation: null,
stemh: null,
stemv: null,
stitchTiles: null,
stopColor: null,
stopOpacity: null,
strikethroughPosition: number,
strikethroughThickness: number,
string: null,
stroke: null,
strokeDashArray: commaOrSpaceSeparated,
strokeDashOffset: null,
strokeLineCap: null,
strokeLineJoin: null,
strokeMiterLimit: number,
strokeOpacity: number,
strokeWidth: null,
style: null,
surfaceScale: number,
syncBehavior: null,
syncBehaviorDefault: null,
syncMaster: null,
syncTolerance: null,
syncToleranceDefault: null,
systemLanguage: commaOrSpaceSeparated,
tabIndex: number,
tableValues: null,
target: null,
targetX: number,
targetY: number,
textAnchor: null,
textDecoration: null,
textRendering: null,
textLength: null,
timelineBegin: null,
title: null,
transformBehavior: null,
type: null,
typeOf: commaOrSpaceSeparated,
to: null,
transform: null,
u1: null,
u2: null,
underlinePosition: number,
underlineThickness: number,
unicode: null,
unicodeBidi: null,
unicodeRange: null,
unitsPerEm: number,
values: null,
vAlphabetic: number,
vMathematical: number,
vectorEffect: null,
vHanging: number,
vIdeographic: number,
version: null,
vertAdvY: number,
vertOriginX: number,
vertOriginY: number,
viewBox: null,
viewTarget: null,
visibility: null,
width: null,
widths: null,
wordSpacing: null,
writingMode: null,
x: null,
x1: null,
x2: null,
xChannelSelector: null,
xHeight: number,
y: null,
y1: null,
y2: null,
yChannelSelector: null,
z: null,
zoomAndPan: null
}
})
@@ -0,0 +1,9 @@
'use strict'
var caseSensitiveTransform = require('./case-sensitive-transform')
module.exports = caseInsensitiveTransform
function caseInsensitiveTransform(attributes, property) {
return caseSensitiveTransform(attributes, property.toLowerCase())
}
@@ -0,0 +1,7 @@
'use strict'
module.exports = caseSensitiveTransform
function caseSensitiveTransform(attributes, attribute) {
return attribute in attributes ? attributes[attribute] : attribute
}
@@ -0,0 +1,39 @@
'use strict'
var normalize = require('../../normalize')
var Schema = require('./schema')
var DefinedInfo = require('./defined-info')
module.exports = create
function create(definition) {
var space = definition.space
var mustUseProperty = definition.mustUseProperty || []
var attributes = definition.attributes || {}
var props = definition.properties
var transform = definition.transform
var property = {}
var normal = {}
var prop
var info
for (prop in props) {
info = new DefinedInfo(
prop,
transform(attributes, prop),
props[prop],
space
)
if (mustUseProperty.indexOf(prop) !== -1) {
info.mustUseProperty = true
}
property[prop] = info
normal[normalize(prop)] = prop
normal[normalize(info.attribute)] = prop
}
return new Schema(property, normal, space)
}
@@ -0,0 +1,40 @@
'use strict'
var Info = require('./info')
var types = require('./types')
module.exports = DefinedInfo
DefinedInfo.prototype = new Info()
DefinedInfo.prototype.defined = true
var checks = [
'boolean',
'booleanish',
'overloadedBoolean',
'number',
'commaSeparated',
'spaceSeparated',
'commaOrSpaceSeparated'
]
var checksLength = checks.length
function DefinedInfo(property, attribute, mask, space) {
var index = -1
var check
mark(this, 'space', space)
Info.call(this, property, attribute)
while (++index < checksLength) {
check = checks[index]
mark(this, check, (mask & types[check]) === types[check])
}
}
function mark(values, key, value) {
if (value) {
values[key] = value
}
}
@@ -0,0 +1,23 @@
'use strict'
module.exports = Info
var proto = Info.prototype
proto.space = null
proto.attribute = null
proto.property = null
proto.boolean = false
proto.booleanish = false
proto.overloadedBoolean = false
proto.number = false
proto.commaSeparated = false
proto.spaceSeparated = false
proto.commaOrSpaceSeparated = false
proto.mustUseProperty = false
proto.defined = false
function Info(property, attribute) {
this.property = property
this.attribute = attribute
}
@@ -0,0 +1,28 @@
'use strict'
var xtend = require('xtend')
var Schema = require('./schema')
module.exports = merge
function merge(definitions) {
var length = definitions.length
var property = []
var normal = []
var index = -1
var info
var space
while (++index < length) {
info = definitions[index]
property.push(info.property)
normal.push(info.normal)
space = info.space
}
return new Schema(
xtend.apply(null, property),
xtend.apply(null, normal),
space
)
}
@@ -0,0 +1,18 @@
'use strict'
module.exports = Schema
var proto = Schema.prototype
proto.space = null
proto.normal = {}
proto.property = {}
function Schema(property, normal, space) {
this.property = property
this.normal = normal
if (space) {
this.space = space
}
}
@@ -0,0 +1,15 @@
'use strict'
var powers = 0
exports.boolean = increment()
exports.booleanish = increment()
exports.overloadedBoolean = increment()
exports.number = increment()
exports.spaceSeparated = increment()
exports.commaSeparated = increment()
exports.commaOrSpaceSeparated = increment()
function increment() {
return Math.pow(2, ++powers)
}
+21
View File
@@ -0,0 +1,21 @@
'use strict'
var create = require('./util/create')
module.exports = create({
space: 'xlink',
transform: xlinkTransform,
properties: {
xLinkActuate: null,
xLinkArcRole: null,
xLinkHref: null,
xLinkRole: null,
xLinkShow: null,
xLinkTitle: null,
xLinkType: null
}
})
function xlinkTransform(_, prop) {
return 'xlink:' + prop.slice(5).toLowerCase()
}
+17
View File
@@ -0,0 +1,17 @@
'use strict'
var create = require('./util/create')
module.exports = create({
space: 'xml',
transform: xmlTransform,
properties: {
xmlLang: null,
xmlBase: null,
xmlSpace: null
}
})
function xmlTransform(_, prop) {
return 'xml:' + prop.slice(3).toLowerCase()
}
+16
View File
@@ -0,0 +1,16 @@
'use strict'
var create = require('./util/create')
var caseInsensitiveTransform = require('./util/case-insensitive-transform')
module.exports = create({
space: 'xmlns',
attributes: {
xmlnsxlink: 'xmlns:xlink'
},
transform: caseInsensitiveTransform,
properties: {
xmlns: null,
xmlnsXLink: null
}
})
+22
View File
@@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2015 Titus Wormer <mailto:tituswormer@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,7 @@
'use strict'
module.exports = normalize
function normalize(value) {
return value.toLowerCase()
}
+102
View File
@@ -0,0 +1,102 @@
{
"name": "property-information",
"version": "5.6.0",
"description": "Information for HTML properties",
"license": "MIT",
"keywords": [
"html",
"property",
"attribute",
"information",
"info"
],
"repository": "wooorm/property-information",
"bugs": "https://github.com/wooorm/property-information/issues",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"Dustin Deus <deusdustin@gmail.com> (http://starptech.de)",
"Andrew Burgess <andrew@andrewburgess.io>"
],
"files": [
"index.js",
"hast-to-react.json",
"html.js",
"svg.js",
"normalize.js",
"find.js",
"lib/"
],
"dependencies": {
"xtend": "^4.0.0"
},
"devDependencies": {
"alpha-sort": "^3.0.0",
"arr-union": "^3.0.0",
"bail": "^1.0.0",
"browserify": "^17.0.0",
"concat-stream": "^2.0.0",
"html-element-attributes": "^2.0.0",
"html-event-attributes": "^1.0.0",
"mdast-zone": "^4.0.0",
"nyc": "^15.0.0",
"object.values": "^1.0.0",
"prettier": "^2.0.0",
"remark-cli": "^9.0.0-alpha.1",
"remark-preset-wooorm": "^8.0.0",
"svg-element-attributes": "^1.0.0",
"svg-event-attributes": "^1.0.0",
"tape": "^5.0.0",
"tinyify": "^3.0.0",
"unist-builder": "^2.0.0",
"xo": "^0.33.0"
},
"scripts": {
"generate": "node script/generate-react && node script/generate-exceptions",
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
"build-bundle": "browserify index.js -s propertyInformation > property-information.js",
"build-mangle": "browserify index.js -s propertyInformation -p tinyify > property-information.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run generate && npm run format && npm run build && npm run test-coverage"
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
},
"prettier": {
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": false,
"semi": false,
"trailingComma": "none"
},
"xo": {
"prettier": true,
"esnext": false,
"rules": {
"unicorn/no-fn-reference-in-iterator": "off",
"unicorn/prefer-exponentiation-operator": "off",
"unicorn/prefer-includes": "off",
"guard-for-in": "off",
"prefer-exponentiation-operator": "off"
},
"ignore": [
"property-information.js"
]
},
"remarkConfig": {
"plugins": [
"./script/list",
"preset-wooorm"
]
}
}
+943
View File
@@ -0,0 +1,943 @@
# property-information
[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
Info for properties and attributes on the web-platform (HTML, SVG, ARIA, XML,
XMLNS, XLink).
This package follows a sensible naming scheme as defined by [hast][].
## Install
[npm][]:
```sh
npm install property-information
```
## Contents
* [Use](#use)
* [API](#api)
* [`propertyInformation.find(schema, name)`](#propertyinformationfindschema-name)
* [`propertyInformation.normalize(name)`](#propertyinformationnormalizename)
* [`propertyInformation.html`](#propertyinformationhtml)
* [`propertyInformation.svg`](#propertyinformationsvg)
* [`hastToReact`](#hasttoreact)
* [Support](#support)
* [Related](#related)
* [License](#license)
## Use
```js
var info = require('property-information')
console.log(info.find(info.html, 'className'))
// Or: info.find(info.html, 'class')
console.log(info.find(info.svg, 'horiz-adv-x'))
// Or: info.find(info.svg, 'horizAdvX')
console.log(info.find(info.svg, 'xlink:arcrole'))
// Or: info.find(info.svg, 'xLinkArcRole')
console.log(info.find(info.html, 'xmlLang'))
// Or: info.find(info.html, 'xml:lang')
console.log(info.find(info.html, 'ariaValueNow'))
// Or: info.find(info.html, 'aria-valuenow')
```
Yields:
```js
{ space: 'html',
attribute: 'class',
property: 'className',
spaceSeparated: true }
{ space: 'svg',
attribute: 'horiz-adv-x',
property: 'horizAdvX',
number: true }
{ space: 'xlink', attribute: 'xlink:arcrole', property: 'xLinkArcrole' }
{ space: 'xml', attribute: 'xml:lang', property: 'xmlLang' }
{ attribute: 'aria-valuenow', property: 'ariaValueNow', number: true }
```
## API
### `propertyInformation.find(schema, name)`
Look up info on a property.
In most cases, the given `schema` contains info on the property.
All standard, most legacy, and some non-standard properties are supported.
For these cases, the returned [`Info`][info] has hints about value of the
property.
`name` can be a [valid data attribute or property][data], in which case an
[`Info`][info] object with the correctly cased `attribute` and `property` is
returned.
`name` can be an unknown attribute, in which case an [`Info`][info] object
with `attribute` and `property` set to the given name is returned.
It is not recommended to provide unsupported legacy or recently specced
properties.
#### Parameters
* `schema` ([`Schema`][schema])
— Either `propertyInformation.html` or `propertyInformation.svg`
* `name` (`string`)
— An attribute-like or property-like name that is passed through
[`normalize`][normalize] to find the correct info
#### Returns
[`Info`][info].
#### Note
`find` can be accessed directly from `require('property-information/find')` as
well.
#### Example
Aside from the aforementioned example, which shows known HTML, SVG, XML, XLink,
and ARIA support, data properties, and attributes are also supported:
```js
console.log(info.find(info.html, 'data-date-of-birth'))
// Or: info.find(info.html, 'dataDateOfBirth')
```
Yields:
```js
{ attribute: 'data-date-of-birth', property: 'dataDateOfBirth' }
```
Unknown values are passed through untouched:
```js
console.log(info.find(info.html, 'un-Known'))
```
Yields:
```js
{ attribute: 'un-Known', property: 'un-Known' }
```
### `propertyInformation.normalize(name)`
Get the cleaned case-insensitive form of an attribute or a property.
#### Parameters
* `name` (`string`) — An attribute-like or property-like name
#### Returns
`string` that can be used to look up the properly cased property in a
[`Schema`][schema].
#### Note
`normalize` can be accessed directly from
`require('property-information/normalize')` as well.
#### Example
```js
info.html.normal[info.normalize('for')] // => 'htmlFor'
info.svg.normal[info.normalize('VIEWBOX')] // => 'viewBox'
info.html.normal[info.normalize('unknown')] // => undefined
info.html.normal[info.normalize('accept-charset')] // => 'acceptCharset'
```
### `propertyInformation.html`
### `propertyInformation.svg`
[`Schema`][schema] for either HTML or SVG, containing info on properties from
the primary space (HTML or SVG) and related embedded spaces (ARIA, XML, XMLNS,
XLink).
#### Note
`html` and `svg` can be accessed directly from
`require('property-information/html')` and `require('property-information/svg')`
as well.
#### Example
```js
console.log(info.html.property.htmlFor)
console.log(info.svg.property.viewBox)
console.log(info.html.property.unknown)
```
Yields:
```js
{ space: 'html',
attribute: 'for',
property: 'htmlFor',
spaceSeparated: true }
{ space: 'svg', attribute: 'viewBox', property: 'viewBox' }
undefined
```
#### `Schema`
A schema for a primary space.
* `space` (`'html'` or `'svg'`) — Primary space of the schema
* `normal` (`Object.<string>`) — Object mapping normalized attributes and
properties to properly cased properties
* `property` ([`Object.<Info>`][info]) — Object mapping properties to info
#### `Info`
Info on a property.
* `space` (`'html'`, `'svg'`, `'xml'`, `'xlink'`, `'xmlns'`, optional)
— [Space][namespace] of the property
* `attribute` (`string`) — Attribute name for the property that could be used
in markup (for example: `'aria-describedby'`, `'allowfullscreen'`,
`'xml:lang'`, `'for'`, or `'charoff'`)
* `property` (`string`) — JavaScript-style camel-cased name, based on the
DOM, but sometimes different (for example: `'ariaDescribedBy'`,
`'allowFullScreen'`, `'xmlLang'`, `'htmlFor'`, `'charOff'`)
* `boolean` (`boolean`) — The property is `boolean`.
The default value of this property is false, so it can be omitted
* `booleanish` (`boolean`) — The property is a `boolean`.
The default value of this property is something other than false, so
`false` must persist.
The value can hold a string (as is the case with `ariaChecked` and its
`'mixed'` value)
* `overloadedBoolean` (`boolean`) — The property is `boolean`.
The default value of this property is false, so it can be omitted.
The value can hold a string (as is the case with `download` as its value
reflects the name to use for the downloaded file)
* `number` (`boolean`) — The property is `number`.
These values can sometimes hold a string
* `spaceSeparated` (`boolean`) — The property is a list separated by spaces
(for example, `className`)
* `commaSeparated` (`boolean`) — The property is a list separated by commas
(for example, `srcSet`)
* `commaOrSpaceSeparated` (`boolean`) — The property is a list separated by
commas or spaces (for example, `strokeDashArray`)
* `mustUseProperty` (`boolean`) — If a DOM is used, setting the property
should be used for the change to take effect (this is true only for
`'checked'`, `'multiple'`, `'muted'`, and `'selected'`)
* `defined` (`boolean`) — The property is [defined by a space](#support).
This is true for values in HTML (including data and ARIA), SVG, XML,
XMLNS, and XLink.
These values can only be accessed through `find`.
### `hastToReact`
> Accessible through `require('property-information/hast-to-react.json')`
[hast][] is close to [React][], but differs in a couple of cases.
To get a React property from a hast property, check if it is in
[`hast-to-react`][hast-to-react] (`Object.<string>`), if it is, then use the
corresponding value, otherwise, use the hast property.
## Support
<!--list start-->
| Property | Attribute | Space |
| ---------------------------- | ------------------------------ | ------------- |
| `aLink` | `alink` | `html` |
| `abbr` | `abbr` | `html` |
| `about` | `about` | `svg` |
| `accentHeight` | `accent-height` | `svg` |
| `accept` | `accept` | `html` |
| `acceptCharset` | `accept-charset` | `html` |
| `accessKey` | `accesskey` | `html` |
| `accumulate` | `accumulate` | `svg` |
| `action` | `action` | `html` |
| `additive` | `additive` | `svg` |
| `align` | `align` | `html` |
| `alignmentBaseline` | `alignment-baseline` | `svg` |
| `allow` | `allow` | `html` |
| `allowFullScreen` | `allowfullscreen` | `html` |
| `allowPaymentRequest` | `allowpaymentrequest` | `html` |
| `allowTransparency` | `allowtransparency` | `html` |
| `allowUserMedia` | `allowusermedia` | `html` |
| `alphabetic` | `alphabetic` | `svg` |
| `alt` | `alt` | `html` |
| `amplitude` | `amplitude` | `svg` |
| `arabicForm` | `arabic-form` | `svg` |
| `archive` | `archive` | `html` |
| `ariaActiveDescendant` | `aria-activedescendant` | |
| `ariaAtomic` | `aria-atomic` | |
| `ariaAutoComplete` | `aria-autocomplete` | |
| `ariaBusy` | `aria-busy` | |
| `ariaChecked` | `aria-checked` | |
| `ariaColCount` | `aria-colcount` | |
| `ariaColIndex` | `aria-colindex` | |
| `ariaColSpan` | `aria-colspan` | |
| `ariaControls` | `aria-controls` | |
| `ariaCurrent` | `aria-current` | |
| `ariaDescribedBy` | `aria-describedby` | |
| `ariaDetails` | `aria-details` | |
| `ariaDisabled` | `aria-disabled` | |
| `ariaDropEffect` | `aria-dropeffect` | |
| `ariaErrorMessage` | `aria-errormessage` | |
| `ariaExpanded` | `aria-expanded` | |
| `ariaFlowTo` | `aria-flowto` | |
| `ariaGrabbed` | `aria-grabbed` | |
| `ariaHasPopup` | `aria-haspopup` | |
| `ariaHidden` | `aria-hidden` | |
| `ariaInvalid` | `aria-invalid` | |
| `ariaKeyShortcuts` | `aria-keyshortcuts` | |
| `ariaLabel` | `aria-label` | |
| `ariaLabelledBy` | `aria-labelledby` | |
| `ariaLevel` | `aria-level` | |
| `ariaLive` | `aria-live` | |
| `ariaModal` | `aria-modal` | |
| `ariaMultiLine` | `aria-multiline` | |
| `ariaMultiSelectable` | `aria-multiselectable` | |
| `ariaOrientation` | `aria-orientation` | |
| `ariaOwns` | `aria-owns` | |
| `ariaPlaceholder` | `aria-placeholder` | |
| `ariaPosInSet` | `aria-posinset` | |
| `ariaPressed` | `aria-pressed` | |
| `ariaReadOnly` | `aria-readonly` | |
| `ariaRelevant` | `aria-relevant` | |
| `ariaRequired` | `aria-required` | |
| `ariaRoleDescription` | `aria-roledescription` | |
| `ariaRowCount` | `aria-rowcount` | |
| `ariaRowIndex` | `aria-rowindex` | |
| `ariaRowSpan` | `aria-rowspan` | |
| `ariaSelected` | `aria-selected` | |
| `ariaSetSize` | `aria-setsize` | |
| `ariaSort` | `aria-sort` | |
| `ariaValueMax` | `aria-valuemax` | |
| `ariaValueMin` | `aria-valuemin` | |
| `ariaValueNow` | `aria-valuenow` | |
| `ariaValueText` | `aria-valuetext` | |
| `as` | `as` | `html` |
| `ascent` | `ascent` | `svg` |
| `async` | `async` | `html` |
| `attributeName` | `attributeName` | `svg` |
| `attributeType` | `attributeType` | `svg` |
| `autoCapitalize` | `autocapitalize` | `html` |
| `autoComplete` | `autocomplete` | `html` |
| `autoCorrect` | `autocorrect` | `html` |
| `autoFocus` | `autofocus` | `html` |
| `autoPlay` | `autoplay` | `html` |
| `autoSave` | `autosave` | `html` |
| `axis` | `axis` | `html` |
| `azimuth` | `azimuth` | `svg` |
| `background` | `background` | `html` |
| `bandwidth` | `bandwidth` | `svg` |
| `baseFrequency` | `baseFrequency` | `svg` |
| `baseProfile` | `baseProfile` | `svg` |
| `baselineShift` | `baseline-shift` | `svg` |
| `bbox` | `bbox` | `svg` |
| `begin` | `begin` | `svg` |
| `bgColor` | `bgcolor` | `html` |
| `bias` | `bias` | `svg` |
| `border` | `border` | `html` |
| `borderColor` | `bordercolor` | `html` |
| `bottomMargin` | `bottommargin` | `html` |
| `by` | `by` | `svg` |
| `calcMode` | `calcMode` | `svg` |
| `capHeight` | `cap-height` | `svg` |
| `capture` | `capture` | `html` |
| `cellPadding` | `cellpadding` | `html` |
| `cellSpacing` | `cellspacing` | `html` |
| `char` | `char` | `html` |
| `charOff` | `charoff` | `html` |
| `charSet` | `charset` | `html` |
| `checked` | `checked` | `html` |
| `cite` | `cite` | `html` |
| `classId` | `classid` | `html` |
| `className` | `class` | `svg`, `html` |
| `clear` | `clear` | `html` |
| `clip` | `clip` | `svg` |
| `clipPath` | `clip-path` | `svg` |
| `clipPathUnits` | `clipPathUnits` | `svg` |
| `clipRule` | `clip-rule` | `svg` |
| `code` | `code` | `html` |
| `codeBase` | `codebase` | `html` |
| `codeType` | `codetype` | `html` |
| `colSpan` | `colspan` | `html` |
| `color` | `color` | `svg`, `html` |
| `colorInterpolation` | `color-interpolation` | `svg` |
| `colorInterpolationFilters` | `color-interpolation-filters` | `svg` |
| `colorProfile` | `color-profile` | `svg` |
| `colorRendering` | `color-rendering` | `svg` |
| `cols` | `cols` | `html` |
| `compact` | `compact` | `html` |
| `content` | `content` | `svg`, `html` |
| `contentEditable` | `contenteditable` | `html` |
| `contentScriptType` | `contentScriptType` | `svg` |
| `contentStyleType` | `contentStyleType` | `svg` |
| `controls` | `controls` | `html` |
| `controlsList` | `controlslist` | `html` |
| `coords` | `coords` | `html` |
| `crossOrigin` | `crossorigin` | `svg`, `html` |
| `cursor` | `cursor` | `svg` |
| `cx` | `cx` | `svg` |
| `cy` | `cy` | `svg` |
| `d` | `d` | `svg` |
| `data` | `data` | `html` |
| `dataType` | `datatype` | `svg` |
| `dateTime` | `datetime` | `html` |
| `declare` | `declare` | `html` |
| `decoding` | `decoding` | `html` |
| `default` | `default` | `html` |
| `defaultAction` | `defaultAction` | `svg` |
| `defer` | `defer` | `html` |
| `descent` | `descent` | `svg` |
| `diffuseConstant` | `diffuseConstant` | `svg` |
| `dir` | `dir` | `html` |
| `dirName` | `dirname` | `html` |
| `direction` | `direction` | `svg` |
| `disablePictureInPicture` | `disablepictureinpicture` | `html` |
| `disableRemotePlayback` | `disableremoteplayback` | `html` |
| `disabled` | `disabled` | `html` |
| `display` | `display` | `svg` |
| `divisor` | `divisor` | `svg` |
| `dominantBaseline` | `dominant-baseline` | `svg` |
| `download` | `download` | `svg`, `html` |
| `draggable` | `draggable` | `html` |
| `dur` | `dur` | `svg` |
| `dx` | `dx` | `svg` |
| `dy` | `dy` | `svg` |
| `edgeMode` | `edgeMode` | `svg` |
| `editable` | `editable` | `svg` |
| `elevation` | `elevation` | `svg` |
| `enableBackground` | `enable-background` | `svg` |
| `encType` | `enctype` | `html` |
| `end` | `end` | `svg` |
| `enterKeyHint` | `enterkeyhint` | `html` |
| `event` | `event` | `svg`, `html` |
| `exponent` | `exponent` | `svg` |
| `externalResourcesRequired` | `externalResourcesRequired` | `svg` |
| `face` | `face` | `html` |
| `fill` | `fill` | `svg` |
| `fillOpacity` | `fill-opacity` | `svg` |
| `fillRule` | `fill-rule` | `svg` |
| `filter` | `filter` | `svg` |
| `filterRes` | `filterRes` | `svg` |
| `filterUnits` | `filterUnits` | `svg` |
| `floodColor` | `flood-color` | `svg` |
| `floodOpacity` | `flood-opacity` | `svg` |
| `focusHighlight` | `focusHighlight` | `svg` |
| `focusable` | `focusable` | `svg` |
| `fontFamily` | `font-family` | `svg` |
| `fontSize` | `font-size` | `svg` |
| `fontSizeAdjust` | `font-size-adjust` | `svg` |
| `fontStretch` | `font-stretch` | `svg` |
| `fontStyle` | `font-style` | `svg` |
| `fontVariant` | `font-variant` | `svg` |
| `fontWeight` | `font-weight` | `svg` |
| `form` | `form` | `html` |
| `formAction` | `formaction` | `html` |
| `formEncType` | `formenctype` | `html` |
| `formMethod` | `formmethod` | `html` |
| `formNoValidate` | `formnovalidate` | `html` |
| `formTarget` | `formtarget` | `html` |
| `format` | `format` | `svg` |
| `fr` | `fr` | `svg` |
| `frame` | `frame` | `html` |
| `frameBorder` | `frameborder` | `html` |
| `from` | `from` | `svg` |
| `fx` | `fx` | `svg` |
| `fy` | `fy` | `svg` |
| `g1` | `g1` | `svg` |
| `g2` | `g2` | `svg` |
| `glyphName` | `glyph-name` | `svg` |
| `glyphOrientationHorizontal` | `glyph-orientation-horizontal` | `svg` |
| `glyphOrientationVertical` | `glyph-orientation-vertical` | `svg` |
| `glyphRef` | `glyphRef` | `svg` |
| `gradientTransform` | `gradientTransform` | `svg` |
| `gradientUnits` | `gradientUnits` | `svg` |
| `hSpace` | `hspace` | `html` |
| `handler` | `handler` | `svg` |
| `hanging` | `hanging` | `svg` |
| `hatchContentUnits` | `hatchContentUnits` | `svg` |
| `hatchUnits` | `hatchUnits` | `svg` |
| `headers` | `headers` | `html` |
| `height` | `height` | `svg`, `html` |
| `hidden` | `hidden` | `html` |
| `high` | `high` | `html` |
| `horizAdvX` | `horiz-adv-x` | `svg` |
| `horizOriginX` | `horiz-origin-x` | `svg` |
| `horizOriginY` | `horiz-origin-y` | `svg` |
| `href` | `href` | `svg`, `html` |
| `hrefLang` | `hreflang` | `svg`, `html` |
| `htmlFor` | `for` | `html` |
| `httpEquiv` | `http-equiv` | `html` |
| `id` | `id` | `svg`, `html` |
| `ideographic` | `ideographic` | `svg` |
| `imageRendering` | `image-rendering` | `svg` |
| `imageSizes` | `imagesizes` | `html` |
| `imageSrcSet` | `imagesrcset` | `html` |
| `in` | `in` | `svg` |
| `in2` | `in2` | `svg` |
| `initialVisibility` | `initialVisibility` | `svg` |
| `inputMode` | `inputmode` | `html` |
| `integrity` | `integrity` | `html` |
| `intercept` | `intercept` | `svg` |
| `is` | `is` | `html` |
| `isMap` | `ismap` | `html` |
| `itemId` | `itemid` | `html` |
| `itemProp` | `itemprop` | `html` |
| `itemRef` | `itemref` | `html` |
| `itemScope` | `itemscope` | `html` |
| `itemType` | `itemtype` | `html` |
| `k` | `k` | `svg` |
| `k1` | `k1` | `svg` |
| `k2` | `k2` | `svg` |
| `k3` | `k3` | `svg` |
| `k4` | `k4` | `svg` |
| `kernelMatrix` | `kernelMatrix` | `svg` |
| `kernelUnitLength` | `kernelUnitLength` | `svg` |
| `kerning` | `kerning` | `svg` |
| `keyPoints` | `keyPoints` | `svg` |
| `keySplines` | `keySplines` | `svg` |
| `keyTimes` | `keyTimes` | `svg` |
| `kind` | `kind` | `html` |
| `label` | `label` | `html` |
| `lang` | `lang` | `svg`, `html` |
| `language` | `language` | `html` |
| `leftMargin` | `leftmargin` | `html` |
| `lengthAdjust` | `lengthAdjust` | `svg` |
| `letterSpacing` | `letter-spacing` | `svg` |
| `lightingColor` | `lighting-color` | `svg` |
| `limitingConeAngle` | `limitingConeAngle` | `svg` |
| `link` | `link` | `html` |
| `list` | `list` | `html` |
| `loading` | `loading` | `html` |
| `local` | `local` | `svg` |
| `longDesc` | `longdesc` | `html` |
| `loop` | `loop` | `html` |
| `low` | `low` | `html` |
| `lowSrc` | `lowsrc` | `html` |
| `manifest` | `manifest` | `html` |
| `marginHeight` | `marginheight` | `html` |
| `marginWidth` | `marginwidth` | `html` |
| `markerEnd` | `marker-end` | `svg` |
| `markerHeight` | `markerHeight` | `svg` |
| `markerMid` | `marker-mid` | `svg` |
| `markerStart` | `marker-start` | `svg` |
| `markerUnits` | `markerUnits` | `svg` |
| `markerWidth` | `markerWidth` | `svg` |
| `mask` | `mask` | `svg` |
| `maskContentUnits` | `maskContentUnits` | `svg` |
| `maskUnits` | `maskUnits` | `svg` |
| `mathematical` | `mathematical` | `svg` |
| `max` | `max` | `svg`, `html` |
| `maxLength` | `maxlength` | `html` |
| `media` | `media` | `svg`, `html` |
| `mediaCharacterEncoding` | `mediaCharacterEncoding` | `svg` |
| `mediaContentEncodings` | `mediaContentEncodings` | `svg` |
| `mediaSize` | `mediaSize` | `svg` |
| `mediaTime` | `mediaTime` | `svg` |
| `method` | `method` | `svg`, `html` |
| `min` | `min` | `svg`, `html` |
| `minLength` | `minlength` | `html` |
| `mode` | `mode` | `svg` |
| `multiple` | `multiple` | `html` |
| `muted` | `muted` | `html` |
| `name` | `name` | `svg`, `html` |
| `navDown` | `nav-down` | `svg` |
| `navDownLeft` | `nav-down-left` | `svg` |
| `navDownRight` | `nav-down-right` | `svg` |
| `navLeft` | `nav-left` | `svg` |
| `navNext` | `nav-next` | `svg` |
| `navPrev` | `nav-prev` | `svg` |
| `navRight` | `nav-right` | `svg` |
| `navUp` | `nav-up` | `svg` |
| `navUpLeft` | `nav-up-left` | `svg` |
| `navUpRight` | `nav-up-right` | `svg` |
| `noHref` | `nohref` | `html` |
| `noModule` | `nomodule` | `html` |
| `noResize` | `noresize` | `html` |
| `noShade` | `noshade` | `html` |
| `noValidate` | `novalidate` | `html` |
| `noWrap` | `nowrap` | `html` |
| `nonce` | `nonce` | `html` |
| `numOctaves` | `numOctaves` | `svg` |
| `object` | `object` | `html` |
| `observer` | `observer` | `svg` |
| `offset` | `offset` | `svg` |
| `onAbort` | `onabort` | `svg`, `html` |
| `onActivate` | `onactivate` | `svg` |
| `onAfterPrint` | `onafterprint` | `svg`, `html` |
| `onAuxClick` | `onauxclick` | `html` |
| `onBeforePrint` | `onbeforeprint` | `svg`, `html` |
| `onBeforeUnload` | `onbeforeunload` | `html` |
| `onBegin` | `onbegin` | `svg` |
| `onBlur` | `onblur` | `html` |
| `onCanPlay` | `oncanplay` | `svg`, `html` |
| `onCanPlayThrough` | `oncanplaythrough` | `svg`, `html` |
| `onCancel` | `oncancel` | `svg`, `html` |
| `onChange` | `onchange` | `svg`, `html` |
| `onClick` | `onclick` | `svg`, `html` |
| `onClose` | `onclose` | `svg`, `html` |
| `onContextMenu` | `oncontextmenu` | `html` |
| `onCopy` | `oncopy` | `svg`, `html` |
| `onCueChange` | `oncuechange` | `svg`, `html` |
| `onCut` | `oncut` | `svg`, `html` |
| `onDblClick` | `ondblclick` | `svg`, `html` |
| `onDrag` | `ondrag` | `svg`, `html` |
| `onDragEnd` | `ondragend` | `svg`, `html` |
| `onDragEnter` | `ondragenter` | `svg`, `html` |
| `onDragExit` | `ondragexit` | `svg`, `html` |
| `onDragLeave` | `ondragleave` | `svg`, `html` |
| `onDragOver` | `ondragover` | `svg`, `html` |
| `onDragStart` | `ondragstart` | `svg`, `html` |
| `onDrop` | `ondrop` | `svg`, `html` |
| `onDurationChange` | `ondurationchange` | `svg`, `html` |
| `onEmptied` | `onemptied` | `svg`, `html` |
| `onEnd` | `onend` | `svg` |
| `onEnded` | `onended` | `svg`, `html` |
| `onError` | `onerror` | `svg`, `html` |
| `onFocus` | `onfocus` | `svg`, `html` |
| `onFocusIn` | `onfocusin` | `svg` |
| `onFocusOut` | `onfocusout` | `svg` |
| `onFormData` | `onformdata` | `html` |
| `onHashChange` | `onhashchange` | `svg`, `html` |
| `onInput` | `oninput` | `svg`, `html` |
| `onInvalid` | `oninvalid` | `svg`, `html` |
| `onKeyDown` | `onkeydown` | `svg`, `html` |
| `onKeyPress` | `onkeypress` | `svg`, `html` |
| `onKeyUp` | `onkeyup` | `svg`, `html` |
| `onLanguageChange` | `onlanguagechange` | `html` |
| `onLoad` | `onload` | `svg`, `html` |
| `onLoadEnd` | `onloadend` | `html` |
| `onLoadStart` | `onloadstart` | `svg`, `html` |
| `onLoadedData` | `onloadeddata` | `svg`, `html` |
| `onLoadedMetadata` | `onloadedmetadata` | `svg`, `html` |
| `onMessage` | `onmessage` | `svg`, `html` |
| `onMessageError` | `onmessageerror` | `html` |
| `onMouseDown` | `onmousedown` | `svg`, `html` |
| `onMouseEnter` | `onmouseenter` | `svg`, `html` |
| `onMouseLeave` | `onmouseleave` | `svg`, `html` |
| `onMouseMove` | `onmousemove` | `svg`, `html` |
| `onMouseOut` | `onmouseout` | `svg`, `html` |
| `onMouseOver` | `onmouseover` | `svg`, `html` |
| `onMouseUp` | `onmouseup` | `svg`, `html` |
| `onMouseWheel` | `onmousewheel` | `svg` |
| `onOffline` | `onoffline` | `svg`, `html` |
| `onOnline` | `ononline` | `svg`, `html` |
| `onPageHide` | `onpagehide` | `svg`, `html` |
| `onPageShow` | `onpageshow` | `svg`, `html` |
| `onPaste` | `onpaste` | `svg`, `html` |
| `onPause` | `onpause` | `svg`, `html` |
| `onPlay` | `onplay` | `svg`, `html` |
| `onPlaying` | `onplaying` | `svg`, `html` |
| `onPopState` | `onpopstate` | `svg`, `html` |
| `onProgress` | `onprogress` | `svg`, `html` |
| `onRateChange` | `onratechange` | `svg`, `html` |
| `onRejectionHandled` | `onrejectionhandled` | `html` |
| `onRepeat` | `onrepeat` | `svg` |
| `onReset` | `onreset` | `svg`, `html` |
| `onResize` | `onresize` | `svg`, `html` |
| `onScroll` | `onscroll` | `svg`, `html` |
| `onSecurityPolicyViolation` | `onsecuritypolicyviolation` | `html` |
| `onSeeked` | `onseeked` | `svg`, `html` |
| `onSeeking` | `onseeking` | `svg`, `html` |
| `onSelect` | `onselect` | `svg`, `html` |
| `onShow` | `onshow` | `svg` |
| `onSlotChange` | `onslotchange` | `html` |
| `onStalled` | `onstalled` | `svg`, `html` |
| `onStorage` | `onstorage` | `svg`, `html` |
| `onSubmit` | `onsubmit` | `svg`, `html` |
| `onSuspend` | `onsuspend` | `svg`, `html` |
| `onTimeUpdate` | `ontimeupdate` | `svg`, `html` |
| `onToggle` | `ontoggle` | `svg`, `html` |
| `onUnhandledRejection` | `onunhandledrejection` | `html` |
| `onUnload` | `onunload` | `svg`, `html` |
| `onVolumeChange` | `onvolumechange` | `svg`, `html` |
| `onWaiting` | `onwaiting` | `svg`, `html` |
| `onWheel` | `onwheel` | `html` |
| `onZoom` | `onzoom` | `svg` |
| `opacity` | `opacity` | `svg` |
| `open` | `open` | `html` |
| `operator` | `operator` | `svg` |
| `optimum` | `optimum` | `html` |
| `order` | `order` | `svg` |
| `orient` | `orient` | `svg` |
| `orientation` | `orientation` | `svg` |
| `origin` | `origin` | `svg` |
| `overflow` | `overflow` | `svg` |
| `overlay` | `overlay` | `svg` |
| `overlinePosition` | `overline-position` | `svg` |
| `overlineThickness` | `overline-thickness` | `svg` |
| `paintOrder` | `paint-order` | `svg` |
| `panose1` | `panose-1` | `svg` |
| `path` | `path` | `svg` |
| `pathLength` | `pathLength` | `svg` |
| `pattern` | `pattern` | `html` |
| `patternContentUnits` | `patternContentUnits` | `svg` |
| `patternTransform` | `patternTransform` | `svg` |
| `patternUnits` | `patternUnits` | `svg` |
| `phase` | `phase` | `svg` |
| `ping` | `ping` | `svg`, `html` |
| `pitch` | `pitch` | `svg` |
| `placeholder` | `placeholder` | `html` |
| `playbackOrder` | `playbackorder` | `svg` |
| `playsInline` | `playsinline` | `html` |
| `pointerEvents` | `pointer-events` | `svg` |
| `points` | `points` | `svg` |
| `pointsAtX` | `pointsAtX` | `svg` |
| `pointsAtY` | `pointsAtY` | `svg` |
| `pointsAtZ` | `pointsAtZ` | `svg` |
| `poster` | `poster` | `html` |
| `prefix` | `prefix` | `html` |
| `preload` | `preload` | `html` |
| `preserveAlpha` | `preserveAlpha` | `svg` |
| `preserveAspectRatio` | `preserveAspectRatio` | `svg` |
| `primitiveUnits` | `primitiveUnits` | `svg` |
| `profile` | `profile` | `html` |
| `prompt` | `prompt` | `html` |
| `propagate` | `propagate` | `svg` |
| `property` | `property` | `svg`, `html` |
| `r` | `r` | `svg` |
| `radius` | `radius` | `svg` |
| `readOnly` | `readonly` | `html` |
| `refX` | `refX` | `svg` |
| `refY` | `refY` | `svg` |
| `referrerPolicy` | `referrerpolicy` | `svg`, `html` |
| `rel` | `rel` | `svg`, `html` |
| `renderingIntent` | `rendering-intent` | `svg` |
| `repeatCount` | `repeatCount` | `svg` |
| `repeatDur` | `repeatDur` | `svg` |
| `required` | `required` | `html` |
| `requiredExtensions` | `requiredExtensions` | `svg` |
| `requiredFeatures` | `requiredFeatures` | `svg` |
| `requiredFonts` | `requiredFonts` | `svg` |
| `requiredFormats` | `requiredFormats` | `svg` |
| `resource` | `resource` | `svg` |
| `restart` | `restart` | `svg` |
| `result` | `result` | `svg` |
| `results` | `results` | `html` |
| `rev` | `rev` | `svg`, `html` |
| `reversed` | `reversed` | `html` |
| `rightMargin` | `rightmargin` | `html` |
| `role` | `role` | |
| `rotate` | `rotate` | `svg` |
| `rowSpan` | `rowspan` | `html` |
| `rows` | `rows` | `html` |
| `rules` | `rules` | `html` |
| `rx` | `rx` | `svg` |
| `ry` | `ry` | `svg` |
| `sandbox` | `sandbox` | `html` |
| `scale` | `scale` | `svg` |
| `scheme` | `scheme` | `html` |
| `scope` | `scope` | `html` |
| `scoped` | `scoped` | `html` |
| `scrolling` | `scrolling` | `html` |
| `seamless` | `seamless` | `html` |
| `security` | `security` | `html` |
| `seed` | `seed` | `svg` |
| `selected` | `selected` | `html` |
| `shape` | `shape` | `html` |
| `shapeRendering` | `shape-rendering` | `svg` |
| `side` | `side` | `svg` |
| `size` | `size` | `html` |
| `sizes` | `sizes` | `html` |
| `slope` | `slope` | `svg` |
| `slot` | `slot` | `html` |
| `snapshotTime` | `snapshotTime` | `svg` |
| `spacing` | `spacing` | `svg` |
| `span` | `span` | `html` |
| `specularConstant` | `specularConstant` | `svg` |
| `specularExponent` | `specularExponent` | `svg` |
| `spellCheck` | `spellcheck` | `html` |
| `spreadMethod` | `spreadMethod` | `svg` |
| `src` | `src` | `html` |
| `srcDoc` | `srcdoc` | `html` |
| `srcLang` | `srclang` | `html` |
| `srcSet` | `srcset` | `html` |
| `standby` | `standby` | `html` |
| `start` | `start` | `html` |
| `startOffset` | `startOffset` | `svg` |
| `stdDeviation` | `stdDeviation` | `svg` |
| `stemh` | `stemh` | `svg` |
| `stemv` | `stemv` | `svg` |
| `step` | `step` | `html` |
| `stitchTiles` | `stitchTiles` | `svg` |
| `stopColor` | `stop-color` | `svg` |
| `stopOpacity` | `stop-opacity` | `svg` |
| `strikethroughPosition` | `strikethrough-position` | `svg` |
| `strikethroughThickness` | `strikethrough-thickness` | `svg` |
| `string` | `string` | `svg` |
| `stroke` | `stroke` | `svg` |
| `strokeDashArray` | `stroke-dasharray` | `svg` |
| `strokeDashOffset` | `stroke-dashoffset` | `svg` |
| `strokeLineCap` | `stroke-linecap` | `svg` |
| `strokeLineJoin` | `stroke-linejoin` | `svg` |
| `strokeMiterLimit` | `stroke-miterlimit` | `svg` |
| `strokeOpacity` | `stroke-opacity` | `svg` |
| `strokeWidth` | `stroke-width` | `svg` |
| `style` | `style` | `svg`, `html` |
| `summary` | `summary` | `html` |
| `surfaceScale` | `surfaceScale` | `svg` |
| `syncBehavior` | `syncBehavior` | `svg` |
| `syncBehaviorDefault` | `syncBehaviorDefault` | `svg` |
| `syncMaster` | `syncMaster` | `svg` |
| `syncTolerance` | `syncTolerance` | `svg` |
| `syncToleranceDefault` | `syncToleranceDefault` | `svg` |
| `systemLanguage` | `systemLanguage` | `svg` |
| `tabIndex` | `tabindex` | `svg`, `html` |
| `tableValues` | `tableValues` | `svg` |
| `target` | `target` | `svg`, `html` |
| `targetX` | `targetX` | `svg` |
| `targetY` | `targetY` | `svg` |
| `text` | `text` | `html` |
| `textAnchor` | `text-anchor` | `svg` |
| `textDecoration` | `text-decoration` | `svg` |
| `textLength` | `textLength` | `svg` |
| `textRendering` | `text-rendering` | `svg` |
| `timelineBegin` | `timelinebegin` | `svg` |
| `title` | `title` | `svg`, `html` |
| `to` | `to` | `svg` |
| `topMargin` | `topmargin` | `html` |
| `transform` | `transform` | `svg` |
| `transformBehavior` | `transformBehavior` | `svg` |
| `translate` | `translate` | `html` |
| `type` | `type` | `svg`, `html` |
| `typeMustMatch` | `typemustmatch` | `html` |
| `typeOf` | `typeof` | `svg` |
| `u1` | `u1` | `svg` |
| `u2` | `u2` | `svg` |
| `underlinePosition` | `underline-position` | `svg` |
| `underlineThickness` | `underline-thickness` | `svg` |
| `unicode` | `unicode` | `svg` |
| `unicodeBidi` | `unicode-bidi` | `svg` |
| `unicodeRange` | `unicode-range` | `svg` |
| `unitsPerEm` | `units-per-em` | `svg` |
| `unselectable` | `unselectable` | `html` |
| `useMap` | `usemap` | `html` |
| `vAlign` | `valign` | `html` |
| `vAlphabetic` | `v-alphabetic` | `svg` |
| `vHanging` | `v-hanging` | `svg` |
| `vIdeographic` | `v-ideographic` | `svg` |
| `vLink` | `vlink` | `html` |
| `vMathematical` | `v-mathematical` | `svg` |
| `vSpace` | `vspace` | `html` |
| `value` | `value` | `html` |
| `valueType` | `valuetype` | `html` |
| `values` | `values` | `svg` |
| `vectorEffect` | `vector-effect` | `svg` |
| `version` | `version` | `svg`, `html` |
| `vertAdvY` | `vert-adv-y` | `svg` |
| `vertOriginX` | `vert-origin-x` | `svg` |
| `vertOriginY` | `vert-origin-y` | `svg` |
| `viewBox` | `viewBox` | `svg` |
| `viewTarget` | `viewTarget` | `svg` |
| `visibility` | `visibility` | `svg` |
| `width` | `width` | `svg`, `html` |
| `widths` | `widths` | `svg` |
| `wordSpacing` | `word-spacing` | `svg` |
| `wrap` | `wrap` | `html` |
| `writingMode` | `writing-mode` | `svg` |
| `x` | `x` | `svg` |
| `x1` | `x1` | `svg` |
| `x2` | `x2` | `svg` |
| `xChannelSelector` | `xChannelSelector` | `svg` |
| `xHeight` | `x-height` | `svg` |
| `xLinkActuate` | `xlink:actuate` | `xlink` |
| `xLinkArcRole` | `xlink:arcrole` | `xlink` |
| `xLinkHref` | `xlink:href` | `xlink` |
| `xLinkRole` | `xlink:role` | `xlink` |
| `xLinkShow` | `xlink:show` | `xlink` |
| `xLinkTitle` | `xlink:title` | `xlink` |
| `xLinkType` | `xlink:type` | `xlink` |
| `xmlBase` | `xml:base` | `xml` |
| `xmlLang` | `xml:lang` | `xml` |
| `xmlSpace` | `xml:space` | `xml` |
| `xmlns` | `xmlns` | `xmlns` |
| `xmlnsXLink` | `xmlns:xlink` | `xmlns` |
| `y` | `y` | `svg` |
| `y1` | `y1` | `svg` |
| `y2` | `y2` | `svg` |
| `yChannelSelector` | `yChannelSelector` | `svg` |
| `z` | `z` | `svg` |
| `zoomAndPan` | `zoomAndPan` | `svg` |
<!--list end-->
## Related
* [`web-namespaces`][namespace]
— List of web namespaces
* [`space-separated-tokens`](https://github.com/wooorm/space-separated-tokens)
— Parse/stringify space-separated tokens
* [`comma-separated-tokens`](https://github.com/wooorm/comma-separated-tokens)
— Parse/stringify comma-separated tokens
* [`html-tag-names`](https://github.com/wooorm/html-tag-names)
— List of HTML tags
* [`mathml-tag-names`](https://github.com/wooorm/mathml-tag-names)
— List of MathML tags
* [`svg-tag-names`](https://github.com/wooorm/svg-tag-names)
— List of SVG tags
* [`html-void-elements`](https://github.com/wooorm/html-void-elements)
— List of void HTML tag-names
* [`svg-element-attributes`](https://github.com/wooorm/svg-element-attributes)
— Map of SVG elements to allowed attributes
* [`html-element-attributes`](https://github.com/wooorm/html-element-attributes)
— Map of HTML elements to allowed attributes
* [`aria-attributes`](https://github.com/wooorm/aria-attributes)
— List of ARIA attributes
## License
[MIT][license] © [Titus Wormer][author]
Derivative work based on [React][source] licensed under
[BSD-3-Clause-Clear][source-license], © 2013-2015, Facebook, Inc.
[build-badge]: https://img.shields.io/travis/wooorm/property-information.svg
[build]: https://travis-ci.org/wooorm/property-information
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/property-information.svg
[coverage]: https://codecov.io/github/wooorm/property-information
[downloads-badge]: https://img.shields.io/npm/dm/property-information.svg
[downloads]: https://www.npmjs.com/package/property-information
[size-badge]: https://img.shields.io/bundlephobia/minzip/property-information.svg
[size]: https://bundlephobia.com/result?p=property-information
[npm]: https://docs.npmjs.com/cli/install
[author]: https://wooorm.com
[license]: license
[source]: https://github.com/facebook/react/blob/f445dd9/src/renderers/dom/shared/HTMLDOMPropertyConfig.js
[source-license]: https://github.com/facebook/react/blob/88cdc27/LICENSE
[data]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset
[namespace]: https://github.com/wooorm/web-namespaces
[info]: #info
[schema]: #schema
[normalize]: #propertyinformationnormalizename
[react]: https://github.com/facebook/react
[hast-to-react]: hast-to-react.json
[hast]: https://github.com/syntax-tree/hast#propertyname
+10
View File
@@ -0,0 +1,10 @@
'use strict'
var merge = require('./lib/util/merge')
var xlink = require('./lib/xlink')
var xml = require('./lib/xml')
var xmlns = require('./lib/xmlns')
var aria = require('./lib/aria')
var svg = require('./lib/svg')
module.exports = merge([xml, xlink, xmlns, aria, svg])
+17
View File
@@ -0,0 +1,17 @@
'use strict'
exports.parse = parse
exports.stringify = stringify
var empty = ''
var space = ' '
var whiteSpace = /[ \t\n\r\f]+/g
function parse(value) {
var input = String(value || empty).trim()
return input === empty ? [] : input.split(whiteSpace)
}
function stringify(values) {
return values.join(space).trim()
}
+22
View File
@@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,73 @@
{
"name": "space-separated-tokens",
"version": "1.1.5",
"description": "Parse and stringify space-separated tokens",
"license": "MIT",
"keywords": [
"dom",
"html",
"space",
"separated",
"tokens",
"parse",
"stringify"
],
"repository": "wooorm/space-separated-tokens",
"bugs": "https://github.com/wooorm/space-separated-tokens/issues",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
},
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
],
"devDependencies": {
"browserify": "^16.0.0",
"nyc": "^15.0.0",
"prettier": "^1.0.0",
"remark-cli": "^7.0.0",
"remark-preset-wooorm": "^6.0.0",
"tape": "^4.0.0",
"tinyify": "^2.0.0",
"xo": "^0.25.0"
},
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s spaceSeparatedTokens -o space-separated-tokens.js",
"build-mangle": "browserify . -s spaceSeparatedTokens -p tinyify -o space-separated-tokens.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": false,
"semi": false,
"trailingComma": "none"
},
"xo": {
"prettier": true,
"esnext": false,
"ignore": [
"space-separated-tokens.js"
]
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
+94
View File
@@ -0,0 +1,94 @@
# space-separated-tokens
[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
Parse and stringify space-separated tokens according to the [spec][].
## Install
[npm][]:
```sh
npm install space-separated-tokens
```
## Usage
```js
var spaceSeparated = require('space-separated-tokens')
spaceSeparated.parse(' foo\tbar\nbaz ')
//=> ['foo', 'bar', 'baz']
spaceSeparated.stringify(['foo', 'bar', 'baz'])
//=> 'foo bar baz'
```
## API
### `spaceSeparated.parse(value)`
Parse space-separated tokens to an array of strings, according to the [spec][].
###### Parameters
* `value` (`string`) — space-separated tokens
###### Returns
`Array.<string>` — List of tokens.
### `spaceSeparated.stringify(values)`
Serialize an array of strings to space-separated tokens.
Note that its not possible to specify empty or whitespace only values.
###### Parameters
* `values` (`Array.<string>`) — List of tokens
###### Returns
`string` — Space-separated tokens.
## Related
* [`collapse-white-space`](https://github.com/wooorm/collapse-white-space)
— Replace multiple white-space characters with a single space
* [`property-information`](https://github.com/wooorm/property-information)
— Information on HTML properties
* [`comma-separated-tokens`](https://github.com/wooorm/comma-separated-tokens)
— Parse/stringify comma-separated tokens
## License
[MIT][license] © [Titus Wormer][author]
<!-- Definition -->
[build-badge]: https://img.shields.io/travis/wooorm/space-separated-tokens.svg
[build]: https://travis-ci.org/wooorm/space-separated-tokens
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/space-separated-tokens.svg
[coverage]: https://codecov.io/github/wooorm/space-separated-tokens
[downloads-badge]: https://img.shields.io/npm/dm/space-separated-tokens.svg
[downloads]: https://www.npmjs.com/package/space-separated-tokens
[size-badge]: https://img.shields.io/bundlephobia/minzip/space-separated-tokens.svg
[size]: https://bundlephobia.com/result?p=space-separated-tokens
[npm]: https://docs.npmjs.com/cli/install
[license]: license
[author]: https://wooorm.com
[spec]: https://html.spec.whatwg.org/#space-separated-tokens
+101
View File
@@ -0,0 +1,101 @@
{
"name": "hastscript",
"version": "6.0.0",
"description": "hast utility to create trees",
"license": "MIT",
"keywords": [
"unist",
"hast",
"hast-util",
"util",
"utility",
"html",
"rehype",
"vdom",
"virtual",
"dom",
"hyperscript",
"dsl"
],
"repository": "syntax-tree/hastscript",
"bugs": "https://github.com/syntax-tree/hastscript/issues",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
},
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"types": "index.d.ts",
"files": [
"index.d.ts",
"svg.d.ts",
"index.js",
"factory.js",
"html.js",
"svg.js",
"svg-case-sensitive-tag-names.json"
],
"dependencies": {
"@types/hast": "^2.0.0",
"comma-separated-tokens": "^1.0.0",
"hast-util-parse-selector": "^2.0.0",
"property-information": "^5.0.0",
"space-separated-tokens": "^1.0.0"
},
"devDependencies": {
"browserify": "^16.0.0",
"dtslint": "^3.0.0",
"nyc": "^15.0.0",
"prettier": "^2.0.0",
"remark-cli": "^8.0.0",
"remark-preset-wooorm": "^7.0.0",
"svg-tag-names": "^2.0.0",
"tape": "^5.0.0",
"tinyify": "^2.0.0",
"xo": "^0.32.0"
},
"scripts": {
"generate": "node build",
"format": "remark . -qfo && prettier . --write && xo --fix",
"build-bundle": "browserify . -s hastscript > hastscript.js",
"build-mangle": "browserify . -s hastscript -p tinyify > hastscript.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test-types": "dtslint .",
"test": "npm run generate && npm run format && npm run build && npm run test-coverage && npm run test-types"
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
},
"prettier": {
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": false,
"semi": false,
"trailingComma": "none"
},
"xo": {
"prettier": true,
"esnext": false,
"rules": {
"unicorn/prefer-number-properties": "off",
"no-self-compare": "off",
"guard-for-in": "off"
},
"ignores": [
"hastscript.js"
]
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
+328
View File
@@ -0,0 +1,328 @@
# hastscript
[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
[![Sponsors][sponsors-badge]][collective]
[![Backers][backers-badge]][collective]
[![Chat][chat-badge]][chat]
[**hast**][hast] utility to create [*trees*][tree] in HTML or SVG.
Similar to [`hyperscript`][hyperscript], [`virtual-dom/h`][virtual-hyperscript],
[`React.createElement`][react], and [Vues `createElement`][vue],
but for [**hast**][hast].
Use [`unist-builder`][u] to create any [**unist**][unist] tree.
## Install
[npm][]:
```sh
npm install hastscript
```
## Use
```js
var h = require('hastscript')
var s = require('hastscript/svg')
// Children as an array:
console.log(
h('.foo#some-id', [
h('span', 'some text'),
h('input', {type: 'text', value: 'foo'}),
h('a.alpha', {class: 'bravo charlie', download: 'download'}, [
'delta',
'echo'
])
])
)
// Children as arguments:
console.log(
h(
'form',
{method: 'POST'},
h('input', {type: 'text', name: 'foo'}),
h('input', {type: 'text', name: 'bar'}),
h('input', {type: 'submit', value: 'send'})
)
)
// SVG:
console.log(
s('svg', {xmlns: 'http://www.w3.org/2000/svg', viewbox: '0 0 500 500'}, [
s('title', 'SVG `<circle>` element'),
s('circle', {cx: 120, cy: 120, r: 100})
])
)
```
Yields:
```js
{
type: 'element',
tagName: 'div',
properties: {className: ['foo'], id: 'some-id'},
children: [
{
type: 'element',
tagName: 'span',
properties: {},
children: [{type: 'text', value: 'some text'}]
},
{
type: 'element',
tagName: 'input',
properties: {type: 'text', value: 'foo'},
children: []
},
{
type: 'element',
tagName: 'a',
properties: {className: ['alpha', 'bravo', 'charlie'], download: true},
children: [{type: 'text', value: 'delta'}, {type: 'text', value: 'echo'}]
}
]
}
{
type: 'element',
tagName: 'form',
properties: {method: 'POST'},
children: [
{
type: 'element',
tagName: 'input',
properties: {type: 'text', name: 'foo'},
children: []
},
{
type: 'element',
tagName: 'input',
properties: {type: 'text', name: 'bar'},
children: []
},
{
type: 'element',
tagName: 'input',
properties: {type: 'submit', value: 'send'},
children: []
}
]
}
{
type: 'element',
tagName: 'svg',
properties: {xmlns: 'http://www.w3.org/2000/svg', viewBox: '0 0 500 500'},
children: [
{
type: 'element',
tagName: 'title',
properties: {},
children: [{type: 'text', value: 'SVG `<circle>` element'}]
},
{
type: 'element',
tagName: 'circle',
properties: {cx: 120, cy: 120, r: 100},
children: []
}
]
}
```
## API
### `h(selector?[, properties][, ...children])`
### `s(selector?[, properties][, ...children])`
DSL to create virtual [**hast**][hast] [*trees*][tree] for HTML or SVG.
##### Parameters
###### `selector`
Simple CSS selector (`string`, optional).
Can contain a tag name (`foo`), IDs (`#bar`), and classes (`.baz`).
If there is no tag name in the selector, `h` defaults to a `div` element,
and `s` to a `g` element.
`selector` is parsed by [`hast-util-parse-selector`][parse-selector].
###### `properties`
Map of properties (`Object.<*>`, optional).
###### `children`
(Lists of) child nodes (`string`, `Node`, `Array.<string|Node>`, optional).
When strings are encountered, they are mapped to [`text`][text] nodes.
##### Returns
[`Element`][element].
## Security
Use of `hastscript` can open you up to a [cross-site scripting (XSS)][xss]
attack as values are injected into the syntax tree.
The following example shows how a script is injected that runs when loaded in a
browser.
```js
var tree = {type: 'root', children: []}
tree.children.push(h('script', 'alert(1)'))
```
Yields:
```html
<script>alert(1)</script>
```
The following example shows how an image is injected that fails loading and
therefore runs code in a browser.
```js
var tree = {type: 'root', children: []}
// Somehow someone injected these properties instead of an expected `src` and
// `alt`:
var otherProps = {src: 'x', onError: 'alert(2)'}
tree.children.push(h('img', {src: 'default.png', ...otherProps}))
```
Yields:
```html
<img src="x" onerror="alert(2)">
```
The following example shows how code can run in a browser because someone stored
an object in a database instead of the expected string.
```js
var tree = {type: 'root', children: []}
// Somehow this isnt the expected `'wooorm'`.
var username = {
type: 'element',
tagName: 'script',
children: [{type: 'text', value: 'alert(3)'}]
}
tree.children.push(h('span.handle', username))
```
Yields:
```html
<span class="handle"><script>alert(3)</script></span>
```
Either do not use user input in `hastscript` or use
[`hast-util-santize`][sanitize].
## Related
* [`unist-builder`](https://github.com/syntax-tree/unist-builder)
— Create any unist tree
* [`xastscript`](https://github.com/syntax-tree/xastscript)
— Create a xast tree
* [`hast-to-hyperscript`](https://github.com/syntax-tree/hast-to-hyperscript)
— Convert a Node to React, Virtual DOM, Hyperscript, and more
* [`hast-util-from-dom`](https://github.com/syntax-tree/hast-util-from-dom)
— Transform a DOM tree to hast
* [`hast-util-select`](https://github.com/syntax-tree/hast-util-select)
`querySelector`, `querySelectorAll`, and `matches`
* [`hast-util-to-html`](https://github.com/syntax-tree/hast-util-to-html)
— Stringify nodes to HTML
* [`hast-util-to-dom`](https://github.com/syntax-tree/hast-util-to-dom)
— Transform to a DOM tree
## Contribute
See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get
started.
See [`support.md`][support] for ways to get help.
This project has a [code of conduct][coc].
By interacting with this repository, organization, or community you agree to
abide by its terms.
## License
[MIT][license] © [Titus Wormer][author]
<!-- Definitions -->
[build-badge]: https://img.shields.io/travis/syntax-tree/hastscript.svg
[build]: https://travis-ci.org/syntax-tree/hastscript
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/hastscript.svg
[coverage]: https://codecov.io/github/syntax-tree/hastscript
[downloads-badge]: https://img.shields.io/npm/dm/hastscript.svg
[downloads]: https://www.npmjs.com/package/hastscript
[size-badge]: https://img.shields.io/bundlephobia/minzip/hastscript.svg
[size]: https://bundlephobia.com/result?p=hastscript
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
[collective]: https://opencollective.com/unified
[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg
[chat]: https://spectrum.chat/unified/syntax-tree
[npm]: https://docs.npmjs.com/cli/install
[license]: license
[author]: https://wooorm.com
[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md
[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md
[hyperscript]: https://github.com/dominictarr/hyperscript
[virtual-hyperscript]: https://github.com/Matt-Esch/virtual-dom/tree/HEAD/virtual-hyperscript
[react]: https://reactjs.org/docs/glossary.html#react-elements
[vue]: https://vuejs.org/v2/guide/render-function.html#createElement-Arguments
[unist]: https://github.com/syntax-tree/unist
[tree]: https://github.com/syntax-tree/unist#tree
[hast]: https://github.com/syntax-tree/hast
[element]: https://github.com/syntax-tree/hast#element
[text]: https://github.com/syntax-tree/hast#text
[u]: https://github.com/syntax-tree/unist-builder
[parse-selector]: https://github.com/syntax-tree/hast-util-parse-selector
[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting
[sanitize]: https://github.com/syntax-tree/hast-util-sanitize
+41
View File
@@ -0,0 +1,41 @@
[
"altGlyph",
"altGlyphDef",
"altGlyphItem",
"animateColor",
"animateMotion",
"animateTransform",
"clipPath",
"feBlend",
"feColorMatrix",
"feComponentTransfer",
"feComposite",
"feConvolveMatrix",
"feDiffuseLighting",
"feDisplacementMap",
"feDistantLight",
"feDropShadow",
"feFlood",
"feFuncA",
"feFuncB",
"feFuncG",
"feFuncR",
"feGaussianBlur",
"feImage",
"feMerge",
"feMergeNode",
"feMorphology",
"feOffset",
"fePointLight",
"feSpecularLighting",
"feSpotLight",
"feTile",
"feTurbulence",
"foreignObject",
"glyphRef",
"linearGradient",
"radialGradient",
"solidColor",
"textArea",
"textPath"
]
+5
View File
@@ -0,0 +1,5 @@
// TypeScript Version: 3.5
import hastscript = require('hastscript')
export = hastscript
+10
View File
@@ -0,0 +1,10 @@
'use strict'
var schema = require('property-information/svg')
var caseSensitive = require('./svg-case-sensitive-tag-names.json')
var factory = require('./factory')
var svg = factory(schema, 'g', caseSensitive)
svg.displayName = 'svg'
module.exports = svg