@etsoo/materialui 1.5.21 → 1.5.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,13 @@
1
+ import { HTMLAttributes } from "react";
2
+ /**
3
+ * Custom HTML element properties
4
+ * 自定义 HTML 元素属性
5
+ */
6
+ export type HtmlDivProps = HTMLAttributes<HTMLElement>;
1
7
  /**
2
8
  * Custom HTML element that sanitizes and displays HTML content
3
9
  * 自定义 HTML 元素,用于清理和显示 HTML 内容
4
10
  * @param props Properties
5
11
  * @returns Component
6
12
  */
7
- export declare function HtmlDiv(props: React.PropsWithChildren<HTMLElement>): import("react/jsx-runtime").JSX.Element;
13
+ export declare function HtmlDiv(props: HtmlDivProps): import("react/jsx-runtime").JSX.Element;
@@ -17,6 +17,7 @@ class HtmlDivElement extends HTMLElement {
17
17
  const wrapper = document.createElement("div");
18
18
  if (this.textContent) {
19
19
  wrapper.innerHTML = dompurify_1.default.sanitize(this.textContent);
20
+ this.textContent = null; // Clear the textContent to avoid duplication
20
21
  }
21
22
  shadow.appendChild(wrapper);
22
23
  }
@@ -1,7 +1,13 @@
1
+ import { HTMLAttributes } from "react";
2
+ /**
3
+ * Custom HTML element properties
4
+ * 自定义 HTML 元素属性
5
+ */
6
+ export type HtmlDivProps = HTMLAttributes<HTMLElement>;
1
7
  /**
2
8
  * Custom HTML element that sanitizes and displays HTML content
3
9
  * 自定义 HTML 元素,用于清理和显示 HTML 内容
4
10
  * @param props Properties
5
11
  * @returns Component
6
12
  */
7
- export declare function HtmlDiv(props: React.PropsWithChildren<HTMLElement>): import("react/jsx-runtime").JSX.Element;
13
+ export declare function HtmlDiv(props: HtmlDivProps): import("react/jsx-runtime").JSX.Element;
@@ -11,6 +11,7 @@ class HtmlDivElement extends HTMLElement {
11
11
  const wrapper = document.createElement("div");
12
12
  if (this.textContent) {
13
13
  wrapper.innerHTML = DOMPurify.sanitize(this.textContent);
14
+ this.textContent = null; // Clear the textContent to avoid duplication
14
15
  }
15
16
  shadow.appendChild(wrapper);
16
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.5.21",
3
+ "version": "1.5.23",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
package/src/global.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  declare namespace JSX {
2
2
  interface IntrinsicElements {
3
- "html-div": HTMLElement;
3
+ "html-div": React.HTMLAttributes<HTMLElement>;
4
4
  }
5
5
  }
@@ -1,4 +1,5 @@
1
1
  import DOMPurify from "dompurify";
2
+ import { HTMLAttributes } from "react";
2
3
 
3
4
  class HtmlDivElement extends HTMLElement {
4
5
  constructor() {
@@ -13,6 +14,7 @@ class HtmlDivElement extends HTMLElement {
13
14
  const wrapper = document.createElement("div");
14
15
  if (this.textContent) {
15
16
  wrapper.innerHTML = DOMPurify.sanitize(this.textContent);
17
+ this.textContent = null; // Clear the textContent to avoid duplication
16
18
  }
17
19
 
18
20
  shadow.appendChild(wrapper);
@@ -24,13 +26,19 @@ if (!customElements.get("html-div")) {
24
26
  customElements.define("html-div", HtmlDivElement);
25
27
  }
26
28
 
29
+ /**
30
+ * Custom HTML element properties
31
+ * 自定义 HTML 元素属性
32
+ */
33
+ export type HtmlDivProps = HTMLAttributes<HTMLElement>;
34
+
27
35
  /**
28
36
  * Custom HTML element that sanitizes and displays HTML content
29
37
  * 自定义 HTML 元素,用于清理和显示 HTML 内容
30
38
  * @param props Properties
31
39
  * @returns Component
32
40
  */
33
- export function HtmlDiv(props: React.PropsWithChildren<HTMLElement>) {
41
+ export function HtmlDiv(props: HtmlDivProps) {
34
42
  // Destruct
35
43
  const { children, ...rest } = props;
36
44