jsx-dom-runtime
Advanced tools
Comparing version 0.52.0-beta.0 to 0.52.0
@@ -51,3 +51,6 @@ /// <reference lib="dom" /> | ||
export const properties: Set<string>; | ||
export const extensions: Map<string, (node: HTMLElement | SVGElement | MathMLElement, value?: any) => void>; | ||
export const extensions: Map< | ||
string, | ||
(node: HTMLElement | SVGElement | MathMLElement, value: any, key: string) => void | ||
>; | ||
@@ -61,3 +64,3 @@ export const xhtmlNS = 'http://www.w3.org/1999/xhtml'; | ||
Text, | ||
(text: T) => void | ||
(content: T) => void | ||
] | ||
@@ -218,2 +221,12 @@ | ||
'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both' | ||
/** | ||
* Defines a string value that labels the current element, which is intended to be converted into Braille. | ||
* @see aria-label. | ||
*/ | ||
'aria-braillelabel'?: string | ||
/** | ||
* Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille. | ||
* @see aria-roledescription. | ||
*/ | ||
'aria-brailleroledescription'?: string | ||
/** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */ | ||
@@ -497,3 +510,3 @@ 'aria-busy'?: boolean | 'true' | 'false' | ||
id?: string | ||
inert?: boolean | 'inert' | '' | ||
inert?: boolean | '' | ||
lang?: string | ||
@@ -625,3 +638,4 @@ placeholder?: string | ||
'flood-opacity'?: SVGProperties['floodOpacity'] | ||
focusable?: number | string | ||
focusable?: 'true' | 'false' | 'auto' | ||
focusHighlight?: 'auto' | 'none' | ||
'font-family'?: SVGProperties['fontFamily'] | ||
@@ -970,4 +984,4 @@ 'font-size'?: SVGProperties['fontSize'] | ||
interface HTMLButtonElementAttributes extends HTMLAttributes<HTMLButtonElement> { | ||
autofocus?: boolean | 'autofocus' | ''; | ||
disabled?: boolean | 'disabled' | ''; | ||
autofocus?: boolean | ''; | ||
disabled?: boolean | ''; | ||
form?: string | ||
@@ -977,3 +991,3 @@ formAction?: string | ||
formMethod?: string | ||
formNoValidate?: boolean | 'formnovalidate' | '' | ||
formNoValidate?: boolean | '' | ||
formTarget?: string | ||
@@ -1000,3 +1014,3 @@ name?: string; | ||
interface HTMLDetailsElementAttributes extends HTMLAttributes<HTMLDetailsElement> { | ||
open?: boolean | 'open' | ''; | ||
open?: boolean | ''; | ||
ontoggle?: TEventHandler<HTMLDetailsElement>; | ||
@@ -1011,3 +1025,3 @@ } | ||
interface HTMLDialogElementAttributes extends HTMLAttributes<HTMLDialogElement> { | ||
open?: boolean | 'open' | ''; | ||
open?: boolean | ''; | ||
ontoggle?: TEventHandler<HTMLDialogElement>; | ||
@@ -1026,3 +1040,3 @@ onclose?: TEventHandler<HTMLDialogElement>; | ||
interface HTMLFieldSetElementAttributes extends HTMLAttributes<HTMLFieldSetElement> { | ||
disabled?: boolean | 'disabled' | ''; | ||
disabled?: boolean | ''; | ||
form?: string | ||
@@ -1039,3 +1053,3 @@ name?: string; | ||
name?: string; | ||
noValidate?: boolean | 'novalidate' | ''; | ||
noValidate?: boolean | ''; | ||
target?: string | ||
@@ -1046,2 +1060,5 @@ } | ||
manifest?: string | ||
/** @deprecated */ | ||
version?: string | ||
xmlns?: string | ||
} | ||
@@ -1102,7 +1119,7 @@ | ||
autocomplete?: string; | ||
autofocus?: boolean | 'autofocus' | ''; | ||
autofocus?: boolean | ''; | ||
capture?: boolean | 'user' | 'environment' | '' | ||
checked?: boolean | 'checked' | ''; | ||
crossOrigin?: boolean | '' | 'anonymous' | 'use-credentials'; | ||
disabled?: boolean | 'disabled' | ''; | ||
disabled?: boolean | ''; | ||
dirName?: string; | ||
@@ -1114,3 +1131,3 @@ enterKeyHint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send'; | ||
formMethod?: string | ||
formNoValidate?: boolean | 'formnovalidate' | '' | ||
formNoValidate?: boolean | '' | ||
formTarget?: string | ||
@@ -1123,8 +1140,8 @@ height?: number | string | ||
minLength?: number | `${number}`; | ||
multiple?: boolean | 'multiple' | ''; | ||
multiple?: boolean | ''; | ||
name?: string; | ||
pattern?: string; | ||
placeholder?: string; | ||
readOnly?: boolean | 'readonly' | ''; | ||
required?: boolean | 'required' | ''; | ||
readOnly?: boolean | ''; | ||
required?: boolean | ''; | ||
size?: number | `${number}`; | ||
@@ -1173,3 +1190,3 @@ src?: string | ||
crossOrigin?: boolean | '' | 'anonymous' | 'use-credentials'; | ||
disabled?: boolean | 'disabled' | ''; | ||
disabled?: boolean | ''; | ||
href?: string | ||
@@ -1200,7 +1217,7 @@ hreflang?: string; | ||
interface HTMLMediaAttributes<T> extends HTMLAttributes<T> { | ||
autoplay?: boolean | 'autoplay' | ''; | ||
controls?: boolean | 'controls' | ''; | ||
autoplay?: boolean | ''; | ||
controls?: boolean | ''; | ||
controlsList?: 'nodownload' | 'nofullscreen' | 'noremoteplayback' | ||
crossOrigin?: boolean | '' | 'anonymous' | 'use-credentials'; | ||
loop?: boolean | 'loop' | ''; | ||
loop?: boolean | ''; | ||
mediaGroup?: string | ||
@@ -1245,3 +1262,3 @@ preload?: 'none' | 'metadata' | 'auto'; | ||
interface HTMLOListElementAttributes extends HTMLAttributes<HTMLOListElement> { | ||
reversed?: boolean | 'reversed' | ''; | ||
reversed?: boolean | ''; | ||
start?: number | `${number}`; | ||
@@ -1252,3 +1269,3 @@ type?: '1' | 'a' | 'A' | 'i' | 'I'; | ||
interface HTMLOptGroupElementAttributes extends HTMLAttributes<HTMLOptGroupElement> { | ||
disabled?: boolean | 'disabled' | ''; | ||
disabled?: boolean | ''; | ||
label?: string; | ||
@@ -1258,5 +1275,5 @@ } | ||
interface HTMLOptionElementAttributes extends HTMLAttributes<HTMLOptionElement> { | ||
disabled?: boolean | 'disabled' | ''; | ||
disabled?: boolean | ''; | ||
label?: string; | ||
selected?: boolean | 'selected' | ''; | ||
selected?: boolean | ''; | ||
value?: number | string; | ||
@@ -1283,9 +1300,9 @@ } | ||
interface HTMLScriptElementAttributes extends HTMLAttributes<HTMLScriptElement> { | ||
async?: boolean | 'async' | '' | ||
async?: boolean | '' | ||
/** @deprecated */ | ||
charset?: string; | ||
crossOrigin?: boolean | '' | 'anonymous' | 'use-credentials'; | ||
defer?: boolean | 'defer' | ''; | ||
defer?: boolean | ''; | ||
integrity?: string | ||
noModule?: boolean | 'nomodule' | '' | ||
noModule?: boolean | '' | ||
nonce?: string | ||
@@ -1300,8 +1317,8 @@ referrerPolicy?: ReferrerPolicy; | ||
autocomplete?: string; | ||
autofocus?: boolean | 'autofocus' | ''; | ||
disabled?: boolean | 'disabled' | ''; | ||
autofocus?: boolean | ''; | ||
disabled?: boolean | ''; | ||
form?: string | ||
multiple?: boolean | 'multiple' | ''; | ||
multiple?: boolean | ''; | ||
name?: string; | ||
required?: boolean | 'required' | ''; | ||
required?: boolean | ''; | ||
size?: number | `${number}`; | ||
@@ -1384,6 +1401,6 @@ value?: number | string; | ||
autocomplete?: string; | ||
autofocus?: boolean | 'autofocus' | ''; | ||
autofocus?: boolean | ''; | ||
cols?: number | `${number}`; | ||
dirName?: string; | ||
disabled?: boolean | 'disabled' | ''; | ||
disabled?: boolean | ''; | ||
form?: string | ||
@@ -1394,4 +1411,4 @@ maxLength?: number | `${number}`; | ||
placeholder?: string; | ||
readOnly?: boolean | 'readonly' | ''; | ||
required?: boolean | 'required' | ''; | ||
readOnly?: boolean | ''; | ||
required?: boolean | ''; | ||
rows?: number | `${number}`; | ||
@@ -1506,3 +1523,3 @@ value?: number | string; | ||
height?: number | string; | ||
playsInline?: boolean | 'playsinline' | ''; | ||
playsInline?: boolean | ''; | ||
poster?: string; | ||
@@ -1520,3 +1537,3 @@ width?: number | string; | ||
allowpopups?: boolean | ||
autofocus?: boolean | 'autofocus' | ''; | ||
autofocus?: boolean | ''; | ||
autosize?: boolean | ||
@@ -1523,0 +1540,0 @@ blinkfeatures?: string |
@@ -1,4 +0,4 @@ | ||
const appendChildren = (node, children) => { | ||
const appendChildren = (children, node) => { | ||
if (Array.isArray(children)) { | ||
children.some(child => appendChildren(node, child)); | ||
children.some(child => appendChildren(child, node)); | ||
} else if (children != null && children !== false) { | ||
@@ -11,3 +11,3 @@ node.append(children); | ||
const fragment = new DocumentFragment(); | ||
appendChildren(fragment, children); | ||
appendChildren(children, fragment); | ||
return fragment; | ||
@@ -29,3 +29,3 @@ }; | ||
if (extensions.has(key)) { | ||
extensions.get(key)(node, val); | ||
extensions.get(key)(node, val, key); | ||
} else if (key === 'style') { | ||
@@ -51,3 +51,3 @@ if (typeof val === 'string') { | ||
} | ||
appendChildren(tag === 'template' ? node.content : node, props.children); | ||
appendChildren(props.children, tag === 'template' ? node.content : node); | ||
if (val = props.ref) { | ||
@@ -81,3 +81,5 @@ if (typeof val === 'function') { | ||
return [text, content => { | ||
text.textContent = content; | ||
if (initContent !== content) { | ||
text.textContent = initContent = content; | ||
} | ||
}]; | ||
@@ -84,0 +86,0 @@ }; |
{ | ||
"name": "jsx-dom-runtime", | ||
"version": "0.52.0-beta.0", | ||
"version": "0.52.0", | ||
"description": "A tiny in 500 bytes library to JSX syntax templates for DOM. Support HTML, SVG and MathML tags", | ||
@@ -20,7 +20,2 @@ "type": "module", | ||
}, | ||
"./extensions/*": { | ||
"types": "./extensions/*.d.ts", | ||
"import": "./extensions/*.js", | ||
"require": "./extensions/*.cjs" | ||
}, | ||
"./babel-preset": "./babel-preset/index.cjs", | ||
@@ -41,3 +36,3 @@ "./package.json": "./package.json" | ||
"@babel/plugin-syntax-jsx": "^7.21.4", | ||
"@babel/types": "^7.21.5", | ||
"@babel/types": "^7.22.3", | ||
"csstype": "^3.1.2", | ||
@@ -51,3 +46,3 @@ "html-tags": "^3.3.1", | ||
"devDependencies": { | ||
"@babel/core": "^7.21.8", | ||
"@babel/core": "^7.22.1", | ||
"@babel/preset-typescript": "^7.21.5", | ||
@@ -62,5 +57,5 @@ "@evilmartians/lefthook": "^1.4.0", | ||
"@types/svg-tags": "^1.0.0", | ||
"@types/testing-library__jest-dom": "^5.14.5", | ||
"@typescript-eslint/eslint-plugin": "^5.59.6", | ||
"@typescript-eslint/parser": "^5.59.6", | ||
"@types/testing-library__jest-dom": "^5.14.6", | ||
"@typescript-eslint/eslint-plugin": "^5.59.7", | ||
"@typescript-eslint/parser": "^5.59.7", | ||
"babel-jest": "^29.5.0", | ||
@@ -77,3 +72,2 @@ "eslint": "^8.41.0", | ||
"babel-preset", | ||
"extensions", | ||
"jsx-runtime", | ||
@@ -80,0 +74,0 @@ "index.d.ts" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
82706
2169
8
Updated@babel/types@^7.22.3