Refactor routing in App component to enhance navigation and improve error handling by integrating dynamic routes and updating the NotFound route.

This commit is contained in:
becarta
2025-05-23 12:43:00 +02:00
parent f40db0f5c9
commit a544759a3b
11127 changed files with 1647032 additions and 0 deletions

3
node_modules/hast-util-to-parse5/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export { toParse5 } from "./lib/index.js";
export type Options = import('./lib/index.js').Options;
export type Space = import('./lib/index.js').Space;

6
node_modules/hast-util-to-parse5/index.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
/**
* @typedef {import('./lib/index.js').Options} Options
* @typedef {import('./lib/index.js').Space} Space
*/
export {toParse5} from './lib/index.js'

43
node_modules/hast-util-to-parse5/lib/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,43 @@
/**
* Transform a hast tree to a `parse5` AST.
*
* @param {Nodes} tree
* Tree to transform.
* @param {Options | null | undefined} [options]
* Configuration (optional).
* @returns {Parse5Nodes}
* `parse5` node.
*/
export function toParse5(tree: Nodes, options?: Options | null | undefined): Parse5Nodes;
export type Comment = import('hast').Comment;
export type Doctype = import('hast').Doctype;
export type Element = import('hast').Element;
export type Nodes = import('hast').Nodes;
export type Root = import('hast').Root;
export type RootContent = import('hast').RootContent;
export type Text = import('hast').Text;
export type Parse5Document = import('parse5').DefaultTreeAdapterMap['document'];
export type Parse5Fragment = import('parse5').DefaultTreeAdapterMap['documentFragment'];
export type Parse5Element = import('parse5').DefaultTreeAdapterMap['element'];
export type Parse5Nodes = import('parse5').DefaultTreeAdapterMap['node'];
export type Parse5Doctype = import('parse5').DefaultTreeAdapterMap['documentType'];
export type Parse5Comment = import('parse5').DefaultTreeAdapterMap['commentNode'];
export type Parse5Text = import('parse5').DefaultTreeAdapterMap['textNode'];
export type Parse5Parent = import('parse5').DefaultTreeAdapterMap['parentNode'];
export type Parse5Attribute = import('parse5').Token.Attribute;
export type Schema = import('property-information').Schema;
/**
* Configuration.
*/
export type Options = {
/**
* Which space the document is in (default: `'html'`).
*
* When an `<svg>` element is found in the HTML space, this package already
* automatically switches to and from the SVG space when entering and exiting
* it.
*/
space?: Space | null | undefined;
};
export type Parse5Content = Exclude<Parse5Nodes, Parse5Document | Parse5Fragment>;
export type Space = 'html' | 'svg';

338
node_modules/hast-util-to-parse5/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,338 @@
/**
* @typedef {import('hast').Comment} Comment
* @typedef {import('hast').Doctype} Doctype
* @typedef {import('hast').Element} Element
* @typedef {import('hast').Nodes} Nodes
* @typedef {import('hast').Root} Root
* @typedef {import('hast').RootContent} RootContent
* @typedef {import('hast').Text} Text
*
* @typedef {import('parse5').DefaultTreeAdapterMap['document']} Parse5Document
* @typedef {import('parse5').DefaultTreeAdapterMap['documentFragment']} Parse5Fragment
* @typedef {import('parse5').DefaultTreeAdapterMap['element']} Parse5Element
* @typedef {import('parse5').DefaultTreeAdapterMap['node']} Parse5Nodes
* @typedef {import('parse5').DefaultTreeAdapterMap['documentType']} Parse5Doctype
* @typedef {import('parse5').DefaultTreeAdapterMap['commentNode']} Parse5Comment
* @typedef {import('parse5').DefaultTreeAdapterMap['textNode']} Parse5Text
* @typedef {import('parse5').DefaultTreeAdapterMap['parentNode']} Parse5Parent
* @typedef {import('parse5').Token.Attribute} Parse5Attribute
*
* @typedef {import('property-information').Schema} Schema
*/
/**
* @typedef Options
* Configuration.
* @property {Space | null | undefined} [space='html']
* Which space the document is in (default: `'html'`).
*
* When an `<svg>` element is found in the HTML space, this package already
* automatically switches to and from the SVG space when entering and exiting
* it.
*
* @typedef {Exclude<Parse5Nodes, Parse5Document | Parse5Fragment>} Parse5Content
*
* @typedef {'html' | 'svg'} Space
*/
import {stringify as commas} from 'comma-separated-tokens'
import {ok as assert} from 'devlop'
import {find, html, svg} from 'property-information'
import {stringify as spaces} from 'space-separated-tokens'
import {webNamespaces} from 'web-namespaces'
import {zwitch} from 'zwitch'
/** @type {Options} */
const emptyOptions = {}
const own = {}.hasOwnProperty
const one = zwitch('type', {handlers: {root, element, text, comment, doctype}})
/**
* Transform a hast tree to a `parse5` AST.
*
* @param {Nodes} tree
* Tree to transform.
* @param {Options | null | undefined} [options]
* Configuration (optional).
* @returns {Parse5Nodes}
* `parse5` node.
*/
export function toParse5(tree, options) {
const settings = options || emptyOptions
const space = settings.space
return one(tree, space === 'svg' ? svg : html)
}
/**
* @param {Root} node
* Node (hast) to transform.
* @param {Schema} schema
* Current schema.
* @returns {Parse5Document}
* Parse5 node.
*/
function root(node, schema) {
/** @type {Parse5Document} */
const result = {
nodeName: '#document',
// @ts-expect-error: `parse5` uses enums, which are actually strings.
mode: (node.data || {}).quirksMode ? 'quirks' : 'no-quirks',
childNodes: []
}
result.childNodes = all(node.children, result, schema)
patch(node, result)
return result
}
/**
* @param {Root} node
* Node (hast) to transform.
* @param {Schema} schema
* Current schema.
* @returns {Parse5Fragment}
* Parse5 node.
*/
function fragment(node, schema) {
/** @type {Parse5Fragment} */
const result = {nodeName: '#document-fragment', childNodes: []}
result.childNodes = all(node.children, result, schema)
patch(node, result)
return result
}
/**
* @param {Doctype} node
* Node (hast) to transform.
* @returns {Parse5Doctype}
* Parse5 node.
*/
function doctype(node) {
/** @type {Parse5Doctype} */
const result = {
nodeName: '#documentType',
name: 'html',
publicId: '',
systemId: '',
parentNode: null
}
patch(node, result)
return result
}
/**
* @param {Text} node
* Node (hast) to transform.
* @returns {Parse5Text}
* Parse5 node.
*/
function text(node) {
/** @type {Parse5Text} */
const result = {
nodeName: '#text',
value: node.value,
parentNode: null
}
patch(node, result)
return result
}
/**
* @param {Comment} node
* Node (hast) to transform.
* @returns {Parse5Comment}
* Parse5 node.
*/
function comment(node) {
/** @type {Parse5Comment} */
const result = {
nodeName: '#comment',
data: node.value,
parentNode: null
}
patch(node, result)
return result
}
/**
* @param {Element} node
* Node (hast) to transform.
* @param {Schema} schema
* Current schema.
* @returns {Parse5Element}
* Parse5 node.
*/
function element(node, schema) {
const parentSchema = schema
let currentSchema = parentSchema
if (
node.type === 'element' &&
node.tagName.toLowerCase() === 'svg' &&
parentSchema.space === 'html'
) {
currentSchema = svg
}
/** @type {Array<Parse5Attribute>} */
const attrs = []
/** @type {string} */
let prop
if (node.properties) {
for (prop in node.properties) {
if (prop !== 'children' && own.call(node.properties, prop)) {
const result = createProperty(
currentSchema,
prop,
node.properties[prop]
)
if (result) {
attrs.push(result)
}
}
}
}
const space = currentSchema.space
// `html` and `svg` both have a space.
assert(space)
/** @type {Parse5Element} */
const result = {
nodeName: node.tagName,
tagName: node.tagName,
attrs,
// @ts-expect-error: `parse5` types are wrong.
namespaceURI: webNamespaces[space],
childNodes: [],
parentNode: null
}
result.childNodes = all(node.children, result, currentSchema)
patch(node, result)
if (node.tagName === 'template' && node.content) {
// @ts-expect-error: `parse5` types are wrong.
result.content = fragment(node.content, currentSchema)
}
return result
}
/**
* Handle a property.
*
* @param {Schema} schema
* Current schema.
* @param {string} prop
* Key.
* @param {Array<number | string> | boolean | number | string | null | undefined} value
* hast property value.
* @returns {Parse5Attribute | undefined}
* Field for runtime, optional.
*/
function createProperty(schema, prop, value) {
const info = find(schema, prop)
// Ignore nullish and `NaN` values.
if (
value === false ||
value === null ||
value === undefined ||
(typeof value === 'number' && Number.isNaN(value)) ||
(!value && info.boolean)
) {
return
}
if (Array.isArray(value)) {
// Accept `array`.
// Most props are space-separated.
value = info.commaSeparated ? commas(value) : spaces(value)
}
/** @type {Parse5Attribute} */
const attribute = {
name: info.attribute,
value: value === true ? '' : String(value)
}
if (info.space && info.space !== 'html' && info.space !== 'svg') {
const index = attribute.name.indexOf(':')
if (index < 0) {
attribute.prefix = ''
} else {
attribute.name = attribute.name.slice(index + 1)
attribute.prefix = info.attribute.slice(0, index)
}
attribute.namespace = webNamespaces[info.space]
}
return attribute
}
/**
* Transform all hast nodes.
*
* @param {Array<RootContent>} children
* List of children.
* @param {Parse5Parent} parentNode
* `parse5` parent node.
* @param {Schema} schema
* Current schema.
* @returns {Array<Parse5Content>}
* Transformed children.
*/
function all(children, parentNode, schema) {
let index = -1
/** @type {Array<Parse5Content>} */
const results = []
if (children) {
while (++index < children.length) {
/** @type {Parse5Content} */
const child = one(children[index], schema)
child.parentNode = parentNode
results.push(child)
}
}
return results
}
/**
* Add position info from `from` to `to`.
*
* @param {Nodes} from
* hast node.
* @param {Parse5Nodes} to
* `parse5` node.
* @returns {undefined}
* Nothing.
*/
function patch(from, to) {
const position = from.position
if (position && position.start && position.end) {
assert(typeof position.start.offset === 'number')
assert(typeof position.end.offset === 'number')
to.sourceCodeLocation = {
startLine: position.start.line,
startCol: position.start.column,
startOffset: position.start.offset,
endLine: position.end.line,
endCol: position.end.column,
endOffset: position.end.offset
}
}
}

22
node_modules/hast-util-to-parse5/license generated vendored Normal file
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.

View File

@@ -0,0 +1,7 @@
export { find } from "./lib/find.js";
export { hastToReact } from "./lib/hast-to-react.js";
export { normalize } from "./lib/normalize.js";
export const html: import("./lib/util/schema.js").Schema;
export const svg: import("./lib/util/schema.js").Schema;
export type Info = import('./lib/util/info.js').Info;
export type Schema = import('./lib/util/schema.js').Schema;

View File

@@ -0,0 +1,18 @@
/**
* @typedef {import('./lib/util/info.js').Info} Info
* @typedef {import('./lib/util/schema.js').Schema} Schema
*/
import {merge} from './lib/util/merge.js'
import {xlink} from './lib/xlink.js'
import {xml} from './lib/xml.js'
import {xmlns} from './lib/xmlns.js'
import {aria} from './lib/aria.js'
import {html as htmlBase} from './lib/html.js'
import {svg as svgBase} from './lib/svg.js'
export {find} from './lib/find.js'
export {hastToReact} from './lib/hast-to-react.js'
export {normalize} from './lib/normalize.js'
export const html = merge([xml, xlink, xmlns, aria, htmlBase], 'html')
export const svg = merge([xml, xlink, xmlns, aria, svgBase], 'svg')

View File

@@ -0,0 +1 @@
export const aria: import("./util/schema.js").Schema;

View File

@@ -0,0 +1,59 @@
import {booleanish, number, spaceSeparated} from './util/types.js'
import {create} from './util/create.js'
export const aria = create({
transform(_, prop) {
return prop === 'role' ? prop : 'aria-' + prop.slice(4).toLowerCase()
},
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
}
})

View File

@@ -0,0 +1,8 @@
/**
* @param {Schema} schema
* @param {string} value
* @returns {Info}
*/
export function find(schema: Schema, value: string): Info;
export type Schema = import('./util/schema.js').Schema;
import { Info } from './util/info.js';

View File

@@ -0,0 +1,68 @@
/**
* @typedef {import('./util/schema.js').Schema} Schema
*/
import {normalize} from './normalize.js'
import {DefinedInfo} from './util/defined-info.js'
import {Info} from './util/info.js'
const valid = /^data[-\w.:]+$/i
const dash = /-[a-z]/g
const cap = /[A-Z]/g
/**
* @param {Schema} schema
* @param {string} value
* @returns {Info}
*/
export function find(schema, value) {
const normal = normalize(value)
let prop = value
let 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) === '-') {
// Turn it into a property.
const rest = value.slice(5).replace(dash, camelcase)
prop = 'data' + rest.charAt(0).toUpperCase() + rest.slice(1)
} else {
// Turn it into an attribute.
const rest = value.slice(4)
if (!dash.test(rest)) {
let dashes = rest.replace(cap, kebab)
if (dashes.charAt(0) !== '-') {
dashes = '-' + dashes
}
value = 'data' + dashes
}
}
Type = DefinedInfo
}
return new Type(prop, value)
}
/**
* @param {string} $0
* @returns {string}
*/
function kebab($0) {
return '-' + $0.toLowerCase()
}
/**
* @param {string} $0
* @returns {string}
*/
function camelcase($0) {
return $0.charAt(1).toUpperCase()
}

View File

@@ -0,0 +1,10 @@
/**
* `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
* `hastToReact`, if it is, then use the corresponding value,
* otherwise, use the hast property.
*
* @type {Record<string, string>}
*/
export const hastToReact: Record<string, string>;

View File

@@ -0,0 +1,28 @@
/**
* `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
* `hastToReact`, if it is, then use the corresponding value,
* otherwise, use the hast property.
*
* @type {Record<string, string>}
*/
export const hastToReact = {
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'
}

View File

@@ -0,0 +1 @@
export const html: import("./util/schema.js").Schema;

View File

@@ -0,0 +1,322 @@
import {
boolean,
overloadedBoolean,
booleanish,
number,
spaceSeparated,
commaSeparated
} from './util/types.js'
import {create} from './util/create.js'
import {caseInsensitiveTransform} from './util/case-insensitive-transform.js'
export const html = 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,
blocking: spaceSeparated,
capture: null,
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,
fetchPriority: 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: null,
inert: boolean,
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,
onBeforeMatch: null,
onBeforePrint: null,
onBeforeToggle: null,
onBeforeUnload: null,
onBlur: null,
onCancel: null,
onCanPlay: null,
onCanPlayThrough: null,
onChange: null,
onClick: null,
onClose: null,
onContextLost: null,
onContextMenu: null,
onContextRestored: 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,
onScrollEnd: 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,
popover: null,
popoverTarget: null,
popoverTargetAction: null,
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,
shadowRootClonable: boolean,
shadowRootDelegatesFocus: boolean,
shadowRootMode: null,
shape: null,
size: number,
sizes: null,
slot: null,
span: number,
spellCheck: booleanish,
src: null,
srcDoc: null,
srcLang: null,
srcSet: null,
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,
writingSuggestions: 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
}
})

View File

@@ -0,0 +1,5 @@
/**
* @param {string} value
* @returns {string}
*/
export function normalize(value: string): string;

View File

@@ -0,0 +1,7 @@
/**
* @param {string} value
* @returns {string}
*/
export function normalize(value) {
return value.toLowerCase()
}

View File

@@ -0,0 +1 @@
export const svg: import("./util/schema.js").Schema;

View File

@@ -0,0 +1,567 @@
import {
boolean,
number,
spaceSeparated,
commaSeparated,
commaOrSpaceSeparated
} from './util/types.js'
import {create} from './util/create.js'
import {caseSensitiveTransform} from './util/case-sensitive-transform.js'
export const svg = 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',
transformOrigin: 'transform-origin',
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,
transformOrigin: 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
}
})

View File

@@ -0,0 +1,6 @@
/**
* @param {Record<string, string>} attributes
* @param {string} property
* @returns {string}
*/
export function caseInsensitiveTransform(attributes: Record<string, string>, property: string): string;

View File

@@ -0,0 +1,10 @@
import {caseSensitiveTransform} from './case-sensitive-transform.js'
/**
* @param {Record<string, string>} attributes
* @param {string} property
* @returns {string}
*/
export function caseInsensitiveTransform(attributes, property) {
return caseSensitiveTransform(attributes, property.toLowerCase())
}

View File

@@ -0,0 +1,6 @@
/**
* @param {Record<string, string>} attributes
* @param {string} attribute
* @returns {string}
*/
export function caseSensitiveTransform(attributes: Record<string, string>, attribute: string): string;

View File

@@ -0,0 +1,8 @@
/**
* @param {Record<string, string>} attributes
* @param {string} attribute
* @returns {string}
*/
export function caseSensitiveTransform(attributes, attribute) {
return attribute in attributes ? attributes[attribute] : attribute
}

View File

@@ -0,0 +1,16 @@
/**
* @param {Definition} definition
* @returns {Schema}
*/
export function create(definition: Definition): Schema;
export type Properties = import('./schema.js').Properties;
export type Normal = import('./schema.js').Normal;
export type Attributes = Record<string, string>;
export type Definition = {
properties: Record<string, number | null>;
transform: (attributes: Attributes, property: string) => string;
space?: string;
attributes?: Attributes;
mustUseProperty?: Array<string>;
};
import { Schema } from './schema.js';

View File

@@ -0,0 +1,58 @@
/**
* @typedef {import('./schema.js').Properties} Properties
* @typedef {import('./schema.js').Normal} Normal
*
* @typedef {Record<string, string>} Attributes
*
* @typedef {Object} Definition
* @property {Record<string, number|null>} properties
* @property {(attributes: Attributes, property: string) => string} transform
* @property {string} [space]
* @property {Attributes} [attributes]
* @property {Array<string>} [mustUseProperty]
*/
import {normalize} from '../normalize.js'
import {Schema} from './schema.js'
import {DefinedInfo} from './defined-info.js'
const own = {}.hasOwnProperty
/**
* @param {Definition} definition
* @returns {Schema}
*/
export function create(definition) {
/** @type {Properties} */
const property = {}
/** @type {Normal} */
const normal = {}
/** @type {string} */
let prop
for (prop in definition.properties) {
if (own.call(definition.properties, prop)) {
const value = definition.properties[prop]
const info = new DefinedInfo(
prop,
definition.transform(definition.attributes || {}, prop),
value,
definition.space
)
if (
definition.mustUseProperty &&
definition.mustUseProperty.includes(prop)
) {
info.mustUseProperty = true
}
property[prop] = info
normal[normalize(prop)] = prop
normal[normalize(info.attribute)] = prop
}
}
return new Schema(property, normal, definition.space)
}

View File

@@ -0,0 +1,11 @@
export class DefinedInfo extends Info {
/**
* @constructor
* @param {string} property
* @param {string} attribute
* @param {number|null} [mask]
* @param {string} [space]
*/
constructor(property: string, attribute: string, mask?: number | null | undefined, space?: string | undefined);
}
import { Info } from './info.js';

View File

@@ -0,0 +1,44 @@
import {Info} from './info.js'
import * as types from './types.js'
/** @type {Array<keyof types>} */
// @ts-expect-error: hush.
const checks = Object.keys(types)
export class DefinedInfo extends Info {
/**
* @constructor
* @param {string} property
* @param {string} attribute
* @param {number|null} [mask]
* @param {string} [space]
*/
constructor(property, attribute, mask, space) {
let index = -1
super(property, attribute)
mark(this, 'space', space)
if (typeof mask === 'number') {
while (++index < checks.length) {
const check = checks[index]
mark(this, checks[index], (mask & types[check]) === types[check])
}
}
}
}
DefinedInfo.prototype.defined = true
/**
* @param {DefinedInfo} values
* @param {string} key
* @param {unknown} value
*/
function mark(values, key, value) {
if (value) {
// @ts-expect-error: assume `value` matches the expected value of `key`.
values[key] = value
}
}

View File

@@ -0,0 +1,23 @@
export class Info {
/**
* @constructor
* @param {string} property
* @param {string} attribute
*/
constructor(property: string, attribute: string);
/** @type {string} */
property: string;
/** @type {string} */
attribute: string;
/** @type {string|null} */
space: string | null;
boolean: boolean;
booleanish: boolean;
overloadedBoolean: boolean;
number: boolean;
commaSeparated: boolean;
spaceSeparated: boolean;
commaOrSpaceSeparated: boolean;
mustUseProperty: boolean;
defined: boolean;
}

View File

@@ -0,0 +1,25 @@
export class Info {
/**
* @constructor
* @param {string} property
* @param {string} attribute
*/
constructor(property, attribute) {
/** @type {string} */
this.property = property
/** @type {string} */
this.attribute = attribute
}
}
/** @type {string|null} */
Info.prototype.space = null
Info.prototype.boolean = false
Info.prototype.booleanish = false
Info.prototype.overloadedBoolean = false
Info.prototype.number = false
Info.prototype.commaSeparated = false
Info.prototype.spaceSeparated = false
Info.prototype.commaOrSpaceSeparated = false
Info.prototype.mustUseProperty = false
Info.prototype.defined = false

View File

@@ -0,0 +1,9 @@
/**
* @param {Schema[]} definitions
* @param {string} [space]
* @returns {Schema}
*/
export function merge(definitions: Schema[], space?: string | undefined): Schema;
export type Properties = import('./schema.js').Properties;
export type Normal = import('./schema.js').Normal;
import { Schema } from './schema.js';

View File

@@ -0,0 +1,26 @@
/**
* @typedef {import('./schema.js').Properties} Properties
* @typedef {import('./schema.js').Normal} Normal
*/
import {Schema} from './schema.js'
/**
* @param {Schema[]} definitions
* @param {string} [space]
* @returns {Schema}
*/
export function merge(definitions, space) {
/** @type {Properties} */
const property = {}
/** @type {Normal} */
const normal = {}
let index = -1
while (++index < definitions.length) {
Object.assign(property, definitions[index].property)
Object.assign(normal, definitions[index].normal)
}
return new Schema(property, normal, space)
}

View File

@@ -0,0 +1,20 @@
/**
* @typedef {import('./info.js').Info} Info
* @typedef {Record<string, Info>} Properties
* @typedef {Record<string, string>} Normal
*/
export class Schema {
/**
* @constructor
* @param {Properties} property
* @param {Normal} normal
* @param {string} [space]
*/
constructor(property: Properties, normal: Normal, space?: string | undefined);
property: Properties;
normal: Normal;
space: string | null;
}
export type Info = import('./info.js').Info;
export type Properties = Record<string, Info>;
export type Normal = Record<string, string>;

View File

@@ -0,0 +1,28 @@
/**
* @typedef {import('./info.js').Info} Info
* @typedef {Record<string, Info>} Properties
* @typedef {Record<string, string>} Normal
*/
export class Schema {
/**
* @constructor
* @param {Properties} property
* @param {Normal} normal
* @param {string} [space]
*/
constructor(property, normal, space) {
this.property = property
this.normal = normal
if (space) {
this.space = space
}
}
}
/** @type {Properties} */
Schema.prototype.property = {}
/** @type {Normal} */
Schema.prototype.normal = {}
/** @type {string|null} */
Schema.prototype.space = null

View File

@@ -0,0 +1,7 @@
export const boolean: number;
export const booleanish: number;
export const overloadedBoolean: number;
export const number: number;
export const spaceSeparated: number;
export const commaSeparated: number;
export const commaOrSpaceSeparated: number;

View File

@@ -0,0 +1,13 @@
let powers = 0
export const boolean = increment()
export const booleanish = increment()
export const overloadedBoolean = increment()
export const number = increment()
export const spaceSeparated = increment()
export const commaSeparated = increment()
export const commaOrSpaceSeparated = increment()
function increment() {
return 2 ** ++powers
}

View File

@@ -0,0 +1 @@
export const xlink: import("./util/schema.js").Schema;

View File

@@ -0,0 +1,17 @@
import {create} from './util/create.js'
export const xlink = create({
space: 'xlink',
transform(_, prop) {
return 'xlink:' + prop.slice(5).toLowerCase()
},
properties: {
xLinkActuate: null,
xLinkArcRole: null,
xLinkHref: null,
xLinkRole: null,
xLinkShow: null,
xLinkTitle: null,
xLinkType: null
}
})

View File

@@ -0,0 +1 @@
export const xml: import("./util/schema.js").Schema;

View File

@@ -0,0 +1,9 @@
import {create} from './util/create.js'
export const xml = create({
space: 'xml',
transform(_, prop) {
return 'xml:' + prop.slice(3).toLowerCase()
},
properties: {xmlLang: null, xmlBase: null, xmlSpace: null}
})

View File

@@ -0,0 +1 @@
export const xmlns: import("./util/schema.js").Schema;

View File

@@ -0,0 +1,9 @@
import {create} from './util/create.js'
import {caseInsensitiveTransform} from './util/case-insensitive-transform.js'
export const xmlns = create({
space: 'xmlns',
attributes: {xmlnsxlink: 'xmlns:xlink'},
transform: caseInsensitiveTransform,
properties: {xmlns: null, xmlnsXLink: null}
})

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.

View File

@@ -0,0 +1,93 @@
{
"name": "property-information",
"version": "6.5.0",
"description": "Info on the properties and attributes of the web platform",
"license": "MIT",
"keywords": [
"html",
"svg",
"aria",
"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>"
],
"sideEffects": false,
"type": "module",
"main": "index.js",
"types": "index.d.ts",
"files": [
"lib/",
"index.d.ts",
"index.js"
],
"devDependencies": {
"@types/mdast": "^4.0.0",
"@types/node": "^20.0.0",
"alpha-sort": "^5.0.0",
"c8": "^9.0.0",
"html-element-attributes": "^3.0.0",
"html-event-attributes": "^2.0.0",
"mdast-zone": "^6.0.0",
"prettier": "^3.0.0",
"remark-cli": "^11.0.0",
"remark-preset-wooorm": "^9.0.0",
"svg-element-attributes": "^2.0.0",
"svg-event-attributes": "^2.0.0",
"type-coverage": "^2.0.0",
"typescript": "^5.0.0",
"undici": "^6.0.0",
"unist-builder": "^4.0.0",
"xo": "^0.58.0"
},
"scripts": {
"prepack": "npm run build && npm run format",
"generate": "node --conditions development script/generate-react.js && node --conditions development script/generate-exceptions.js",
"build": "tsc --build --clean && tsc --build && type-coverage",
"format": "remark . -qfo && prettier . -w --log-level warn && xo --fix",
"test-api": "node --conditions development test.js",
"test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api",
"test": "npm run generate && npm run build && npm run format && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": false,
"semi": false,
"trailingComma": "none"
},
"xo": {
"prettier": true,
"rules": {
"logical-assignment-operators": "off",
"no-bitwise": "off",
"unicorn/prefer-string-replace-all": "off",
"unicorn/prevent-abbreviations": "off"
}
},
"remarkConfig": {
"plugins": [
"preset-wooorm",
"./script/list.js"
]
},
"typeCoverage": {
"atLeast": 100,
"detail": true,
"strict": true,
"ignoreCatch": true
}
}

View File

@@ -0,0 +1,993 @@
# property-information
[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
Info on the properties and attributes of the web platform (HTML, SVG, ARIA, XML,
XMLNS, XLink).
## Contents
* [What is this?](#what-is-this)
* [When should I use this?](#when-should-i-use-this)
* [Install](#install)
* [Use](#use)
* [API](#api)
* [`find(schema, name)`](#findschema-name)
* [`normalize(name)`](#normalizename)
* [`html`](#html)
* [`svg`](#svg)
* [`hastToReact`](#hasttoreact)
* [Types](#types)
* [Compatibility](#compatibility)
* [Support](#support)
* [Security](#security)
* [Related](#related)
* [Contribute](#contribute)
* [License](#license)
## What is this?
This package contains lots of info on all the properties and attributes found
on the web platform.
It includes data on HTML, SVG, ARIA, XML, XMLNS, and XLink.
The names of the properties follow [hast][]s sensible naming scheme.
It includes info on what data types attributes hold, such as whether theyre
booleans or contain lists of space separated numbers.
## When should I use this?
You can use this package if youre working with hast, which is an AST for HTML,
or have goals related to ASTs, such as figuring out which properties or
attributes are valid, or what data types they hold.
## Install
This package is [ESM only][esm].
In Node.js (version 14.14+, 16.0+), install with [npm][]:
```sh
npm install property-information
```
In Deno with [`esm.sh`][esmsh]:
```js
import * as propertyInformation from 'https://esm.sh/property-information@6'
```
In browsers with [`esm.sh`][esmsh]:
```html
<script type="module">
import * as propertyInformation from 'https://esm.sh/property-information@6?bundle'
</script>
```
## Use
```js
import {html, svg, find, normalize} from 'property-information'
console.log(find(html, 'className'))
// Or: find(html, 'class')
console.log(find(svg, 'horiz-adv-x'))
// Or: find(svg, 'horizAdvX')
console.log(find(svg, 'xlink:arcrole'))
// Or: find(svg, 'xLinkArcRole')
console.log(find(html, 'xmlLang'))
// Or: find(html, 'xml:lang')
console.log(find(html, 'ariaValueNow'))
// Or: find(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
This package exports the identifiers `html`, `svg`, `find`, `normalize`,
and `hastToReact`.
There is no default export.
### `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 the value of the
property.
`name` can also 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 the `html` or `svg` export
* `name` (`string`)
— an attribute-like or property-like name that is passed through
[`normalize`][normalize] to find the correct info
#### Returns
[`Info`][info].
#### 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(find(html, 'data-date-of-birth'))
// Or: find(html, 'dataDateOfBirth')
// => {attribute: 'data-date-of-birth', property: 'dataDateOfBirth'}
```
Unknown values are passed through untouched:
```js
console.log(find(html, 'un-Known'))
// => {attribute: 'un-Known', property: 'un-Known'}
```
### `normalize(name)`
Get the cleaned case insensitive form of an attribute or property.
#### Parameters
* `name` (`string`)
— an attribute-like or property-like name
#### Returns
`string` that can be used to look up the properly cased property on a
[`Schema`][schema].
#### Example
```js
html.normal[normalize('for')] // => 'htmlFor'
svg.normal[normalize('VIEWBOX')] // => 'viewBox'
html.normal[normalize('unknown')] // => undefined
html.normal[normalize('accept-charset')] // => 'acceptCharset'
```
### `html`
### `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).
#### Example
```js
console.log(html.property.htmlFor)
// => {space: 'html', attribute: 'for', property: 'htmlFor' spaceSeparated: true}
console.log(svg.property.viewBox)
// => {space: 'svg', attribute: 'viewBox', property: 'viewBox'}
console.log(html.property.unknown)
// => undefined
```
#### `Schema`
A schema for a primary space.
* `space` (`'html'` or `'svg'`)
— primary space of the schema
* `normal` (`Record<string, string>`)
— object mapping normalized attributes and properties to properly cased
properties
* `property` ([`Record<string, 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 a `boolean` (for example: `hidden`).
These properties have an on state when defined and an off state when not
defined
* `booleanish` (`boolean`)
— the property is like a `boolean` (for example: `draggable`)
These properties have both an on and off state when defined, and another
state when not defined
* `overloadedBoolean` (`boolean`)
— the property is like a `boolean` (for example: `download`)
These properties have an on state plus more states when defined and an off
state when not defined
* `number` (`boolean`)
— the property is a `number` (for example: `height`)
* `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 spaces or commas (for example:
`strokeDashArray`)
* `mustUseProperty` (`boolean`)
— useful when working with the DOM, in which case this property has to be
changed as a field on the element, rather than through `setAttribute`
(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.
Undefined properties can only be found through `find`
### `hastToReact`
[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 `hastToReact`
(`Record<string, string>`), if it is, then use the corresponding value,
otherwise, use the hast property.
## Types
This package is fully typed with [TypeScript][].
It exports the additional types `Info` and `Schema`.
## Compatibility
This package is at least compatible with all maintained versions of Node.js.
As of now, that is Node.js 14.14+ and 16.0+.
It also works in Deno and modern browsers.
## 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` |
| `blocking` | `blocking` | `html` |
| `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` |
| `fetchPriority` | `fetchpriority` | `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` |
| `inert` | `inert` | `html` |
| `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` |
| `onBeforeMatch` | `onbeforematch` | `html` |
| `onBeforePrint` | `onbeforeprint` | `svg`, `html` |
| `onBeforeToggle` | `onbeforetoggle` | `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` |
| `onContextLost` | `oncontextlost` | `html` |
| `onContextMenu` | `oncontextmenu` | `html` |
| `onContextRestored` | `oncontextrestored` | `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` |
| `onScrollEnd` | `onscrollend` | `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` |
| `popover` | `popover` | `html` |
| `popoverTarget` | `popovertarget` | `html` |
| `popoverTargetAction` | `popovertargetaction` | `html` |
| `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` |
| `shadowRootClonable` | `shadowrootclonable` | `html` |
| `shadowRootDelegatesFocus` | `shadowrootdelegatesfocus` | `html` |
| `shadowRootMode` | `shadowrootmode` | `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` |
| `transformOrigin` | `transform-origin` | `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` |
| `writingSuggestions` | `writingsuggestions` | `html` |
| `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-->
## Security
This package is safe.
## Related
* [`wooorm/web-namespaces`][namespace]
— list of web namespaces
* [`wooorm/space-separated-tokens`](https://github.com/wooorm/space-separated-tokens)
— parse/stringify space separated tokens
* [`wooorm/comma-separated-tokens`](https://github.com/wooorm/comma-separated-tokens)
— parse/stringify comma separated tokens
* [`wooorm/html-tag-names`](https://github.com/wooorm/html-tag-names)
— list of HTML tag names
* [`wooorm/mathml-tag-names`](https://github.com/wooorm/mathml-tag-names)
— list of MathML tag names
* [`wooorm/svg-tag-names`](https://github.com/wooorm/svg-tag-names)
— list of SVG tag names
* [`wooorm/html-void-elements`](https://github.com/wooorm/html-void-elements)
— list of void HTML tag names
* [`wooorm/svg-element-attributes`](https://github.com/wooorm/svg-element-attributes)
— map of SVG elements to allowed attributes
* [`wooorm/html-element-attributes`](https://github.com/wooorm/html-element-attributes)
— map of HTML elements to allowed attributes
* [`wooorm/aria-attributes`](https://github.com/wooorm/aria-attributes)
— list of ARIA attributes
## Contribute
Yes please!
See [How to Contribute to Open Source][contribute].
## License
[MIT][license] © [Titus Wormer][author]
Derivative work based on [React][source] licensed under
[MIT][source-license], © Facebook, Inc.
[build-badge]: https://github.com/wooorm/property-information/workflows/main/badge.svg
[build]: https://github.com/wooorm/property-information/actions
[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
[esmsh]: https://esm.sh
[author]: https://wooorm.com
[license]: license
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[typescript]: https://www.typescriptlang.org
[contribute]: https://opensource.guide/how-to-contribute/
[source]: https://github.com/facebook/react/blob/8ec2ed4089/packages/react-dom/src/shared/DOMProperty.js
[source-license]: https://github.com/facebook/react/blob/8ec2ed4089/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]: #normalizename
[react]: https://github.com/facebook/react
[hast]: https://github.com/syntax-tree/hast#propertyname

87
node_modules/hast-util-to-parse5/package.json generated vendored Normal file
View File

@@ -0,0 +1,87 @@
{
"name": "hast-util-to-parse5",
"version": "8.0.0",
"description": "hast utility to transform to a `parse5` AST",
"license": "MIT",
"keywords": [
"unist",
"hast",
"hast-util",
"util",
"utility",
"html",
"parse5",
"ast",
"tree"
],
"repository": "syntax-tree/hast-util-to-parse5",
"bugs": "https://github.com/syntax-tree/hast-util-to-parse5/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)"
],
"sideEffects": false,
"type": "module",
"exports": "./index.js",
"files": [
"lib/",
"index.d.ts",
"index.js"
],
"dependencies": {
"@types/hast": "^3.0.0",
"comma-separated-tokens": "^2.0.0",
"devlop": "^1.0.0",
"property-information": "^6.0.0",
"space-separated-tokens": "^2.0.0",
"web-namespaces": "^2.0.0",
"zwitch": "^2.0.0"
},
"devDependencies": {
"@types/json-stringify-safe": "^5.0.0",
"@types/node": "^20.0.0",
"c8": "^8.0.0",
"json-stringify-safe": "^5.0.0",
"parse5": "^7.0.0",
"prettier": "^3.0.0",
"remark-cli": "^11.0.0",
"remark-preset-wooorm": "^9.0.0",
"type-coverage": "^2.0.0",
"typescript": "^5.0.0",
"xo": "^0.55.0"
},
"scripts": {
"prepack": "npm run build && npm run format",
"build": "tsc --build --clean && tsc --build && type-coverage",
"format": "remark . -qfo && prettier . -w --log-level warn && xo --fix",
"test-api": "node --conditions development test.js",
"test-coverage": "c8 --100 --reporter lcov npm run test-api",
"test": "npm run build && npm run format && npm run test-coverage"
},
"prettier": {
"bracketSpacing": false,
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false
},
"remarkConfig": {
"plugins": [
"remark-preset-wooorm"
]
},
"typeCoverage": {
"atLeast": 100,
"detail": true,
"ignoreCatch": true,
"strict": true
},
"xo": {
"prettier": true
}
}

244
node_modules/hast-util-to-parse5/readme.md generated vendored Normal file
View File

@@ -0,0 +1,244 @@
# hast-util-to-parse5
[![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][] utility to transform to a [`parse5`][parse5] [AST][parse5-node].
## Contents
* [What is this?](#what-is-this)
* [When should I use this?](#when-should-i-use-this)
* [Install](#install)
* [Use](#use)
* [API](#api)
* [`toParse5(tree[, options])`](#toparse5tree-options)
* [`Options`](#options)
* [`Space`](#space)
* [Types](#types)
* [Compatibility](#compatibility)
* [Security](#security)
* [Related](#related)
* [Contribute](#contribute)
* [License](#license)
## What is this?
This package is a utility that can turn a hast syntax tree into a `parse5` AST.
Why not use a Parse5 adapter, you might ask?
Well, because its more code weight to use adapters, and more fragile.
## When should I use this?
This package is useful when working with `parse5`, and for some reason want to
generate its AST again.
The inverse utility, [`hast-util-from-parse5`][hast-util-from-parse5], is more
likely what you want.
## Install
This package is [ESM only][esm].
In Node.js (version 16+), install with [npm][]:
```sh
npm install hast-util-to-parse5
```
In Deno with [`esm.sh`][esmsh]:
```js
import {toParse5} from 'https://esm.sh/hast-util-to-parse5@8'
```
In browsers with [`esm.sh`][esmsh]:
```html
<script type="module">
import {toParse5} from 'https://esm.sh/hast-util-to-parse5@8?bundle'
</script>
```
## Use
```js
import {toParse5} from 'hast-util-to-parse5'
const tree = toParse5({
type: 'element',
tagName: 'h1',
properties: {},
children: [{type: 'text', value: 'World!'}]
})
console.log(tree)
```
Yields:
```js
{ nodeName: 'h1',
tagName: 'h1',
attrs: [],
namespaceURI: 'http://www.w3.org/1999/xhtml',
childNodes: [ { nodeName: '#text', value: 'World!', parentNode: [Circular] } ] }
```
## API
This package exports the identifier [`toParse5`][api-to-parse5].
There is no default export.
### `toParse5(tree[, options])`
Transform a hast tree to a `parse5` AST.
###### Parameters
* `tree` ([`HastNode`][hast-node])
— tree to transform
* `options` ([`Options`][api-options], optional)
— configuration
###### Returns
`parse5` node ([`Parse5Node`][parse5-node]).
### `Options`
Configuration (TypeScript type).
###### Fields
* `space` ([`Space`][api-space], optional)
— which space the document is in
### `Space`
Namespace (TypeScript type).
###### Type
```ts
type Space = 'html' | 'svg'
```
## Types
This package is fully typed with [TypeScript][].
It exports the additional types [`Options`][api-options] and
[`Space`][api-space].
## Compatibility
Projects maintained by the unified collective are compatible with maintained
versions of Node.js.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line, `hast-util-to-parse5@^8`,
compatible with Node.js 16.
## Security
Use of `hast-util-to-parse5` can open you up to a
[cross-site scripting (XSS)][xss] attack if the hast tree is unsafe.
## Related
* [`hast-util-from-parse5`](https://github.com/syntax-tree/hast-util-from-parse5)
— transform from Parse5s AST to hast
* [`hast-util-to-nlcst`](https://github.com/syntax-tree/hast-util-to-nlcst)
— transform hast to nlcst
* [`hast-util-to-mdast`](https://github.com/syntax-tree/hast-util-to-mdast)
— transform hast to mdast
* [`hast-util-to-xast`](https://github.com/syntax-tree/hast-util-to-xast)
— transform hast to xast
* [`mdast-util-to-hast`](https://github.com/syntax-tree/mdast-util-to-hast)
— transform mdast to hast
* [`mdast-util-to-nlcst`](https://github.com/syntax-tree/mdast-util-to-nlcst)
— transform mdast to nlcst
## Contribute
See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] 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://github.com/syntax-tree/hast-util-to-parse5/workflows/main/badge.svg
[build]: https://github.com/syntax-tree/hast-util-to-parse5/actions
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/hast-util-to-parse5.svg
[coverage]: https://codecov.io/github/syntax-tree/hast-util-to-parse5
[downloads-badge]: https://img.shields.io/npm/dm/hast-util-to-parse5.svg
[downloads]: https://www.npmjs.com/package/hast-util-to-parse5
[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=hast-util-to-parse5
[size]: https://bundlejs.com/?q=hast-util-to-parse5
[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-discussions-success.svg
[chat]: https://github.com/syntax-tree/unist/discussions
[npm]: https://docs.npmjs.com/cli/install
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[esmsh]: https://esm.sh
[typescript]: https://www.typescriptlang.org
[license]: license
[author]: https://wooorm.com
[health]: https://github.com/syntax-tree/.github
[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md
[support]: https://github.com/syntax-tree/.github/blob/main/support.md
[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting
[hast]: https://github.com/syntax-tree/hast
[hast-node]: https://github.com/syntax-tree/hast#nodes
[parse5]: https://github.com/inikulin/parse5
[parse5-node]: https://github.com/inikulin/parse5/blob/master/packages/parse5/lib/tree-adapters/default.ts
[hast-util-from-parse5]: https://github.com/syntax-tree/hast-util-from-parse5
[api-to-parse5]: #toparse5tree-options
[api-options]: #options
[api-space]: #space