@etsoo/materialui 1.5.21 → 1.5.22

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,14 @@
1
+ /**
2
+ * Custom HTML element properties
3
+ * 自定义 HTML 元素属性
4
+ */
5
+ export type HtmlDivProps = Omit<HTMLElement, "children"> & {
6
+ children: React.ReactNode;
7
+ };
1
8
  /**
2
9
  * Custom HTML element that sanitizes and displays HTML content
3
10
  * 自定义 HTML 元素,用于清理和显示 HTML 内容
4
11
  * @param props Properties
5
12
  * @returns Component
6
13
  */
7
- export declare function HtmlDiv(props: React.PropsWithChildren<HTMLElement>): import("react/jsx-runtime").JSX.Element;
14
+ 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,14 @@
1
+ /**
2
+ * Custom HTML element properties
3
+ * 自定义 HTML 元素属性
4
+ */
5
+ export type HtmlDivProps = Omit<HTMLElement, "children"> & {
6
+ children: React.ReactNode;
7
+ };
1
8
  /**
2
9
  * Custom HTML element that sanitizes and displays HTML content
3
10
  * 自定义 HTML 元素,用于清理和显示 HTML 内容
4
11
  * @param props Properties
5
12
  * @returns Component
6
13
  */
7
- export declare function HtmlDiv(props: React.PropsWithChildren<HTMLElement>): import("react/jsx-runtime").JSX.Element;
14
+ 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.22",
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";
4
4
  }
5
5
  }
@@ -13,6 +13,7 @@ class HtmlDivElement extends HTMLElement {
13
13
  const wrapper = document.createElement("div");
14
14
  if (this.textContent) {
15
15
  wrapper.innerHTML = DOMPurify.sanitize(this.textContent);
16
+ this.textContent = null; // Clear the textContent to avoid duplication
16
17
  }
17
18
 
18
19
  shadow.appendChild(wrapper);
@@ -24,13 +25,21 @@ if (!customElements.get("html-div")) {
24
25
  customElements.define("html-div", HtmlDivElement);
25
26
  }
26
27
 
28
+ /**
29
+ * Custom HTML element properties
30
+ * 自定义 HTML 元素属性
31
+ */
32
+ export type HtmlDivProps = Omit<HTMLElement, "children"> & {
33
+ children: React.ReactNode;
34
+ };
35
+
27
36
  /**
28
37
  * Custom HTML element that sanitizes and displays HTML content
29
38
  * 自定义 HTML 元素,用于清理和显示 HTML 内容
30
39
  * @param props Properties
31
40
  * @returns Component
32
41
  */
33
- export function HtmlDiv(props: React.PropsWithChildren<HTMLElement>) {
42
+ export function HtmlDiv(props: HtmlDivProps) {
34
43
  // Destruct
35
44
  const { children, ...rest } = props;
36
45