html-react-parser
Advanced tools
Comparing version 5.0.3 to 5.0.4
@@ -1,3 +0,8 @@ | ||
export type Attributes = Record<string, string>; | ||
export type Props = Record<string, string | boolean> & { | ||
declare const valueOnlyInputs: { | ||
readonly reset: true; | ||
readonly submit: true; | ||
}; | ||
export type ValueOnlyInputsKeys = keyof typeof valueOnlyInputs; | ||
export type Attributes = Record<PropertyKey, string>; | ||
export type Props = Record<PropertyKey, string | boolean> & { | ||
dangerouslySetInnerHTML?: { | ||
@@ -7,3 +12,3 @@ __html: string; | ||
key?: string | number; | ||
style?: Record<string, string>; | ||
style?: Record<PropertyKey, string>; | ||
}; | ||
@@ -18,2 +23,3 @@ /** | ||
export default function attributesToProps(attributes?: Attributes, nodeName?: string): Props; | ||
export {}; | ||
//# sourceMappingURL=attributes-to-props.d.ts.map |
@@ -23,4 +23,3 @@ "use strict"; | ||
var props = {}; | ||
var isInputValueOnly = Boolean(attributes.type && | ||
valueOnlyInputs[attributes.type]); | ||
var isInputValueOnly = Boolean(attributes.type && valueOnlyInputs[attributes.type]); | ||
for (var attributeName in attributes) { | ||
@@ -27,0 +26,0 @@ var attributeValue = attributes[attributeName]; |
@@ -12,3 +12,3 @@ import type { Element } from 'html-dom-parser'; | ||
*/ | ||
export declare function isCustomComponent(tagName: string, props?: Record<string, any>): boolean; | ||
export declare function isCustomComponent(tagName: string, props?: Record<PropertyKey, any>): boolean; | ||
/** | ||
@@ -28,3 +28,3 @@ * Sets style prop. | ||
*/ | ||
export declare const ELEMENTS_WITH_NO_TEXT_CHILDREN: Set<string>; | ||
export declare const ELEMENTS_WITH_NO_TEXT_CHILDREN: Set<"colgroup" | "head" | "html" | "table" | "tbody" | "tfoot" | "thead" | "tr" | "frameset">; | ||
/** | ||
@@ -31,0 +31,0 @@ * Checks if the given node can contain text nodes |
{ | ||
"name": "html-react-parser", | ||
"version": "5.0.3", | ||
"version": "5.0.4", | ||
"description": "HTML to React parser.", | ||
@@ -56,3 +56,3 @@ "author": "Mark <mark@remarkablemark.org>", | ||
"domhandler": "5.0.3", | ||
"html-dom-parser": "5.0.3", | ||
"html-dom-parser": "5.0.4", | ||
"react-property": "2.0.2", | ||
@@ -70,7 +70,7 @@ "style-to-js": "1.1.8" | ||
"@types/benchmark": "2.1.4", | ||
"@types/jest": "29.5.6", | ||
"@types/jest": "29.5.7", | ||
"@types/react": "18.2.33", | ||
"@types/react-dom": "18.2.14", | ||
"@typescript-eslint/eslint-plugin": "6.9.0", | ||
"@typescript-eslint/parser": "6.9.0", | ||
"@typescript-eslint/eslint-plugin": "6.9.1", | ||
"@typescript-eslint/parser": "6.9.1", | ||
"benchmark": "2.1.4", | ||
@@ -87,3 +87,3 @@ "eslint": "8.52.0", | ||
"react-dom": "18.2.0", | ||
"rollup": "4.1.5", | ||
"rollup": "4.2.0", | ||
"size-limit": "10.0.1", | ||
@@ -90,0 +90,0 @@ "ts-jest": "29.1.1", |
@@ -30,3 +30,3 @@ # html-react-parser | ||
[Replit](https://replit.com/@remarkablemark/html-react-parser) | [JSFiddle](https://jsfiddle.net/remarkablemark/7v86d800/) | [CodeSandbox](https://codesandbox.io/s/940pov1l4w) | [TypeScript](https://codesandbox.io/s/html-react-parser-z0kp6) | [Examples](https://github.com/remarkablemark/html-react-parser/tree/master/examples) | ||
[Replit](https://replit.com/@remarkablemark/html-react-parser) | [JSFiddle](https://jsfiddle.net/remarkablemark/7v86d800/) | [CodeSandbox](https://codesandbox.io/s/940pov1l4w) | [TypeScript](https://codesandbox.io/s/html-react-parser-z0kp6) | [Vite](https://codesandbox.io/p/sandbox/html-react-parser-fg2jpw) | [Examples](https://github.com/remarkablemark/html-react-parser/tree/master/examples) | ||
@@ -33,0 +33,0 @@ <details> |
@@ -25,5 +25,7 @@ import { | ||
export type Attributes = Record<string, string>; | ||
export type ValueOnlyInputsKeys = keyof typeof valueOnlyInputs; | ||
export type Props = Record<string, string | boolean> & { | ||
export type Attributes = Record<PropertyKey, string>; | ||
export type Props = Record<PropertyKey, string | boolean> & { | ||
dangerouslySetInnerHTML?: { | ||
@@ -33,3 +35,3 @@ __html: string; | ||
key?: string | number; | ||
style?: Record<string, string>; | ||
style?: Record<PropertyKey, string>; | ||
}; | ||
@@ -51,4 +53,3 @@ | ||
const isInputValueOnly = Boolean( | ||
attributes.type && | ||
valueOnlyInputs[attributes.type as keyof typeof valueOnlyInputs], | ||
attributes.type && valueOnlyInputs[attributes.type as ValueOnlyInputsKeys], | ||
); | ||
@@ -55,0 +56,0 @@ |
@@ -16,4 +16,7 @@ import { version } from 'react'; | ||
'missing-glyph', | ||
]); | ||
] as const); | ||
type ReservedSvgMathmlElements = | ||
typeof RESERVED_SVG_MATHML_ELEMENTS extends Set<infer T> ? T : never; | ||
/** | ||
@@ -30,3 +33,3 @@ * Check if a tag is a custom component. | ||
tagName: string, | ||
props?: Record<string, any>, | ||
props?: Record<PropertyKey, any>, | ||
): boolean { | ||
@@ -41,3 +44,3 @@ if (tagName.indexOf('-') === -1) { | ||
// https://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts | ||
if (RESERVED_SVG_MATHML_ELEMENTS.has(tagName)) { | ||
if (RESERVED_SVG_MATHML_ELEMENTS.has(tagName as ReservedSvgMathmlElements)) { | ||
return false; | ||
@@ -94,4 +97,7 @@ } | ||
'frameset', | ||
]); | ||
] as const); | ||
type ElementsWithNoTextChildren = | ||
typeof ELEMENTS_WITH_NO_TEXT_CHILDREN extends Set<infer T> ? T : never; | ||
/** | ||
@@ -104,3 +110,3 @@ * Checks if the given node can contain text nodes | ||
export const canTextBeChildOfNode = (node: Element) => | ||
!ELEMENTS_WITH_NO_TEXT_CHILDREN.has(node.name); | ||
!ELEMENTS_WITH_NO_TEXT_CHILDREN.has(node.name as ElementsWithNoTextChildren); | ||
@@ -107,0 +113,0 @@ /** |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
464473
3656
+ Addedhtml-dom-parser@5.0.4(transitive)
- Removedhtml-dom-parser@5.0.3(transitive)
Updatedhtml-dom-parser@5.0.4