@rasenjs/html 0.1.1-alpha

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.
@@ -0,0 +1,258 @@
1
+ import { Mountable, PropValue } from '@rasenjs/core';
2
+
3
+ /**
4
+ * 字符串渲染器类型定义
5
+ */
6
+
7
+ /**
8
+ * 字符串渲染宿主
9
+ * 用于收集渲染结果
10
+ */
11
+ interface StringHost {
12
+ /**
13
+ * 收集的 HTML 片段
14
+ */
15
+ fragments: string[];
16
+ /**
17
+ * 添加 HTML 片段
18
+ */
19
+ append(html: string): void;
20
+ /**
21
+ * 获取完整的 HTML 字符串
22
+ */
23
+ toString(): string;
24
+ }
25
+ /**
26
+ * 创建字符串宿主
27
+ */
28
+ declare function createStringHost(): StringHost;
29
+ /**
30
+ * 字符串渲染的 Mountable 类型
31
+ * @deprecated 使用 Mountable<StringHost> 替代
32
+ */
33
+ type StringMountFunction = Mountable<StringHost>;
34
+
35
+ /**
36
+ * htmlContext 组件 - 提供 HTML 渲染上下文
37
+ */
38
+
39
+ /**
40
+ * 创建字符串渲染上下文
41
+ */
42
+ declare function stringContext(props: {
43
+ children: Array<Mountable<StringHost>>;
44
+ }): Mountable<StringHost>;
45
+ /**
46
+ * 将组件渲染为 HTML 字符串
47
+ *
48
+ * 这是 SSR 的主要入口
49
+ */
50
+ declare function renderToString(component: Mountable<StringHost>): string;
51
+ /**
52
+ * 将多个组件渲染为 HTML 字符串
53
+ */
54
+ declare function renderToStringMultiple(components: Mountable<StringHost>[]): string;
55
+
56
+ /**
57
+ * element 组件 - 通用 HTML 元素组件(字符串版本)
58
+ *
59
+ * SSR 场景下不需要响应式更新,直接取值渲染
60
+ */
61
+ declare const element: (props: {
62
+ tag: string;
63
+ id?: PropValue<string>;
64
+ className?: PropValue<string>;
65
+ style?: PropValue<Record<string, string | number>>;
66
+ attrs?: PropValue<Record<string, string | number | boolean>>;
67
+ /** Text content or child mount functions (including reactive text functions) */
68
+ children?: PropValue<string> | Array<string | (() => string | number) | Mountable<StringHost>>;
69
+ value?: PropValue<string | number>;
70
+ }) => Mountable<StringHost>;
71
+
72
+ /**
73
+ * html 组件 - 用于插入原始 HTML 内容(字符串版本)
74
+ *
75
+ * SSR 场景下不需要响应式更新,直接取值渲染。
76
+ * 直接将 HTML 字符串输出,不创建额外的包裹元素。
77
+ *
78
+ * 安全提示:请确保传入的 HTML 内容是可信的,因为它会直接插入到输出中
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * // 静态 HTML - 直接插入
83
+ * div({}, html({ content: '<p>paragraph</p><span>text</span>' }))
84
+ * // 结果: <div><p>paragraph</p><span>text</span></div>
85
+ * ```
86
+ */
87
+ declare const html: (props: {
88
+ /** 原始 HTML 内容 */
89
+ content: PropValue<string>;
90
+ }) => Mountable<StringHost>;
91
+
92
+ interface BaseProps {
93
+ id?: PropValue<string>;
94
+ class?: PropValue<string>;
95
+ className?: PropValue<string>;
96
+ style?: PropValue<Record<string, string | number>>;
97
+ attrs?: PropValue<Record<string, string | number | boolean>>;
98
+ /** Text content or child mount functions */
99
+ children?: PropValue<string> | Array<string | (() => string | number) | Mountable<StringHost>>;
100
+ }
101
+ /** Child type - 响应式文本函数优先匹配 */
102
+ type Child = string | (() => string | number) | Mountable<StringHost>;
103
+ declare const div: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
104
+ declare const span: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
105
+ declare const button: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
106
+ declare const a: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
107
+ declare const p: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
108
+ declare const h1: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
109
+ declare const h2: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
110
+ declare const h3: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
111
+ declare const h4: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
112
+ declare const h5: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
113
+ declare const h6: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
114
+ declare const ul: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
115
+ declare const ol: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
116
+ declare const li: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
117
+ declare const form: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
118
+ declare const label: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
119
+ declare const select: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
120
+ declare const table: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
121
+ declare const thead: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
122
+ declare const tbody: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
123
+ declare const tfoot: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
124
+ declare const tr: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
125
+ declare const th: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
126
+ declare const td: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
127
+ declare const section: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
128
+ declare const article: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
129
+ declare const header: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
130
+ declare const footer: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
131
+ declare const nav: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
132
+ declare const main: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
133
+ declare const aside: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
134
+ declare const pre: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
135
+ declare const code: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
136
+ declare const blockquote: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
137
+ declare const strong: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
138
+ declare const em: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
139
+ declare const small: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
140
+ declare const mark: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
141
+ declare const del: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
142
+ declare const ins: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
143
+ declare const sub: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
144
+ declare const sup: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
145
+ declare const svg: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
146
+ declare const br: () => Mountable<StringHost>;
147
+ declare const hr: () => Mountable<StringHost>;
148
+ /**
149
+ * input component
150
+ */
151
+ declare const input: (props: BaseProps & {
152
+ type?: PropValue<string>;
153
+ value?: PropValue<string | any>;
154
+ placeholder?: PropValue<string>;
155
+ disabled?: PropValue<boolean>;
156
+ }) => Mountable<StringHost>;
157
+ /**
158
+ * img component
159
+ */
160
+ declare const img: (props: BaseProps & {
161
+ src?: PropValue<string>;
162
+ alt?: PropValue<string>;
163
+ width?: PropValue<string | number>;
164
+ height?: PropValue<string | number>;
165
+ }) => Mountable<StringHost>;
166
+ /**
167
+ * textarea component
168
+ */
169
+ declare const textarea: (props: BaseProps & {
170
+ value?: PropValue<string>;
171
+ placeholder?: PropValue<string>;
172
+ disabled?: PropValue<boolean>;
173
+ rows?: PropValue<number>;
174
+ cols?: PropValue<number>;
175
+ }) => Mountable<StringHost>;
176
+ /**
177
+ * option component
178
+ */
179
+ declare const option: (props: BaseProps & {
180
+ value?: PropValue<string | number>;
181
+ selected?: PropValue<boolean>;
182
+ }) => Mountable<StringHost>;
183
+ /**
184
+ * video component
185
+ */
186
+ declare const video: (props: BaseProps & {
187
+ src?: PropValue<string>;
188
+ poster?: PropValue<string>;
189
+ controls?: PropValue<boolean>;
190
+ autoplay?: PropValue<boolean>;
191
+ loop?: PropValue<boolean>;
192
+ muted?: PropValue<boolean>;
193
+ }) => Mountable<StringHost>;
194
+ /**
195
+ * audio component
196
+ */
197
+ declare const audio: (props: BaseProps & {
198
+ src?: PropValue<string>;
199
+ controls?: PropValue<boolean>;
200
+ autoplay?: PropValue<boolean>;
201
+ loop?: PropValue<boolean>;
202
+ muted?: PropValue<boolean>;
203
+ }) => Mountable<StringHost>;
204
+ /**
205
+ * source component
206
+ */
207
+ declare const source: (props: BaseProps & {
208
+ src?: PropValue<string>;
209
+ type?: PropValue<string>;
210
+ }) => Mountable<StringHost>;
211
+ /**
212
+ * iframe component
213
+ */
214
+ declare const iframe: (props: BaseProps & {
215
+ src?: PropValue<string>;
216
+ width?: PropValue<string | number>;
217
+ height?: PropValue<string | number>;
218
+ frameborder?: PropValue<string | number>;
219
+ allowfullscreen?: PropValue<boolean>;
220
+ }) => Mountable<StringHost>;
221
+ /**
222
+ * canvas component (SSR only renders empty canvas tag)
223
+ */
224
+ declare const canvas: (props: BaseProps & {
225
+ width?: PropValue<string | number>;
226
+ height?: PropValue<string | number>;
227
+ }) => Mountable<StringHost>;
228
+
229
+ /**
230
+ * 转义 HTML 特殊字符,防止 XSS
231
+ */
232
+ declare function escapeHtml(text: string): string;
233
+ /**
234
+ * 转义属性值
235
+ */
236
+ declare function escapeAttr(value: string): string;
237
+ /**
238
+ * 将属性值转换为字符串
239
+ */
240
+ declare function stringifyAttr(name: string, value: string | number | boolean | null | undefined): string;
241
+ /**
242
+ * 将样式对象转换为 style 属性字符串
243
+ */
244
+ declare function stringifyStyle(styles: Record<string, string | number | null | undefined>): string;
245
+ /**
246
+ * 将类名数组或对象转换为 class 属性字符串
247
+ */
248
+ declare function stringifyClass(className: string | string[] | Record<string, boolean> | undefined): string;
249
+ /**
250
+ * 自闭合标签列表
251
+ */
252
+ declare const VOID_ELEMENTS: Set<string>;
253
+ /**
254
+ * 判断是否为自闭合标签
255
+ */
256
+ declare function isVoidElement(tag: string): boolean;
257
+
258
+ export { type StringHost, type StringMountFunction, VOID_ELEMENTS, a, article, aside, audio, blockquote, br, button, canvas, code, createStringHost, del, div, element, em, escapeAttr, escapeHtml, footer, form, h1, h2, h3, h4, h5, h6, header, hr, html, iframe, img, input, ins, isVoidElement, label, li, main, mark, nav, ol, option, p, pre, renderToString, renderToStringMultiple, section, select, small, source, span, stringContext, stringifyAttr, stringifyClass, stringifyStyle, strong, sub, sup, svg, table, tbody, td, textarea, tfoot, th, thead, tr, ul, video };
@@ -0,0 +1,258 @@
1
+ import { Mountable, PropValue } from '@rasenjs/core';
2
+
3
+ /**
4
+ * 字符串渲染器类型定义
5
+ */
6
+
7
+ /**
8
+ * 字符串渲染宿主
9
+ * 用于收集渲染结果
10
+ */
11
+ interface StringHost {
12
+ /**
13
+ * 收集的 HTML 片段
14
+ */
15
+ fragments: string[];
16
+ /**
17
+ * 添加 HTML 片段
18
+ */
19
+ append(html: string): void;
20
+ /**
21
+ * 获取完整的 HTML 字符串
22
+ */
23
+ toString(): string;
24
+ }
25
+ /**
26
+ * 创建字符串宿主
27
+ */
28
+ declare function createStringHost(): StringHost;
29
+ /**
30
+ * 字符串渲染的 Mountable 类型
31
+ * @deprecated 使用 Mountable<StringHost> 替代
32
+ */
33
+ type StringMountFunction = Mountable<StringHost>;
34
+
35
+ /**
36
+ * htmlContext 组件 - 提供 HTML 渲染上下文
37
+ */
38
+
39
+ /**
40
+ * 创建字符串渲染上下文
41
+ */
42
+ declare function stringContext(props: {
43
+ children: Array<Mountable<StringHost>>;
44
+ }): Mountable<StringHost>;
45
+ /**
46
+ * 将组件渲染为 HTML 字符串
47
+ *
48
+ * 这是 SSR 的主要入口
49
+ */
50
+ declare function renderToString(component: Mountable<StringHost>): string;
51
+ /**
52
+ * 将多个组件渲染为 HTML 字符串
53
+ */
54
+ declare function renderToStringMultiple(components: Mountable<StringHost>[]): string;
55
+
56
+ /**
57
+ * element 组件 - 通用 HTML 元素组件(字符串版本)
58
+ *
59
+ * SSR 场景下不需要响应式更新,直接取值渲染
60
+ */
61
+ declare const element: (props: {
62
+ tag: string;
63
+ id?: PropValue<string>;
64
+ className?: PropValue<string>;
65
+ style?: PropValue<Record<string, string | number>>;
66
+ attrs?: PropValue<Record<string, string | number | boolean>>;
67
+ /** Text content or child mount functions (including reactive text functions) */
68
+ children?: PropValue<string> | Array<string | (() => string | number) | Mountable<StringHost>>;
69
+ value?: PropValue<string | number>;
70
+ }) => Mountable<StringHost>;
71
+
72
+ /**
73
+ * html 组件 - 用于插入原始 HTML 内容(字符串版本)
74
+ *
75
+ * SSR 场景下不需要响应式更新,直接取值渲染。
76
+ * 直接将 HTML 字符串输出,不创建额外的包裹元素。
77
+ *
78
+ * 安全提示:请确保传入的 HTML 内容是可信的,因为它会直接插入到输出中
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * // 静态 HTML - 直接插入
83
+ * div({}, html({ content: '<p>paragraph</p><span>text</span>' }))
84
+ * // 结果: <div><p>paragraph</p><span>text</span></div>
85
+ * ```
86
+ */
87
+ declare const html: (props: {
88
+ /** 原始 HTML 内容 */
89
+ content: PropValue<string>;
90
+ }) => Mountable<StringHost>;
91
+
92
+ interface BaseProps {
93
+ id?: PropValue<string>;
94
+ class?: PropValue<string>;
95
+ className?: PropValue<string>;
96
+ style?: PropValue<Record<string, string | number>>;
97
+ attrs?: PropValue<Record<string, string | number | boolean>>;
98
+ /** Text content or child mount functions */
99
+ children?: PropValue<string> | Array<string | (() => string | number) | Mountable<StringHost>>;
100
+ }
101
+ /** Child type - 响应式文本函数优先匹配 */
102
+ type Child = string | (() => string | number) | Mountable<StringHost>;
103
+ declare const div: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
104
+ declare const span: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
105
+ declare const button: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
106
+ declare const a: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
107
+ declare const p: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
108
+ declare const h1: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
109
+ declare const h2: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
110
+ declare const h3: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
111
+ declare const h4: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
112
+ declare const h5: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
113
+ declare const h6: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
114
+ declare const ul: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
115
+ declare const ol: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
116
+ declare const li: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
117
+ declare const form: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
118
+ declare const label: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
119
+ declare const select: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
120
+ declare const table: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
121
+ declare const thead: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
122
+ declare const tbody: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
123
+ declare const tfoot: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
124
+ declare const tr: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
125
+ declare const th: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
126
+ declare const td: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
127
+ declare const section: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
128
+ declare const article: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
129
+ declare const header: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
130
+ declare const footer: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
131
+ declare const nav: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
132
+ declare const main: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
133
+ declare const aside: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
134
+ declare const pre: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
135
+ declare const code: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
136
+ declare const blockquote: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
137
+ declare const strong: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
138
+ declare const em: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
139
+ declare const small: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
140
+ declare const mark: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
141
+ declare const del: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
142
+ declare const ins: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
143
+ declare const sub: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
144
+ declare const sup: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
145
+ declare const svg: (propsOrChild?: BaseProps | Child, ...restChildren: Child[]) => Mountable<StringHost>;
146
+ declare const br: () => Mountable<StringHost>;
147
+ declare const hr: () => Mountable<StringHost>;
148
+ /**
149
+ * input component
150
+ */
151
+ declare const input: (props: BaseProps & {
152
+ type?: PropValue<string>;
153
+ value?: PropValue<string | any>;
154
+ placeholder?: PropValue<string>;
155
+ disabled?: PropValue<boolean>;
156
+ }) => Mountable<StringHost>;
157
+ /**
158
+ * img component
159
+ */
160
+ declare const img: (props: BaseProps & {
161
+ src?: PropValue<string>;
162
+ alt?: PropValue<string>;
163
+ width?: PropValue<string | number>;
164
+ height?: PropValue<string | number>;
165
+ }) => Mountable<StringHost>;
166
+ /**
167
+ * textarea component
168
+ */
169
+ declare const textarea: (props: BaseProps & {
170
+ value?: PropValue<string>;
171
+ placeholder?: PropValue<string>;
172
+ disabled?: PropValue<boolean>;
173
+ rows?: PropValue<number>;
174
+ cols?: PropValue<number>;
175
+ }) => Mountable<StringHost>;
176
+ /**
177
+ * option component
178
+ */
179
+ declare const option: (props: BaseProps & {
180
+ value?: PropValue<string | number>;
181
+ selected?: PropValue<boolean>;
182
+ }) => Mountable<StringHost>;
183
+ /**
184
+ * video component
185
+ */
186
+ declare const video: (props: BaseProps & {
187
+ src?: PropValue<string>;
188
+ poster?: PropValue<string>;
189
+ controls?: PropValue<boolean>;
190
+ autoplay?: PropValue<boolean>;
191
+ loop?: PropValue<boolean>;
192
+ muted?: PropValue<boolean>;
193
+ }) => Mountable<StringHost>;
194
+ /**
195
+ * audio component
196
+ */
197
+ declare const audio: (props: BaseProps & {
198
+ src?: PropValue<string>;
199
+ controls?: PropValue<boolean>;
200
+ autoplay?: PropValue<boolean>;
201
+ loop?: PropValue<boolean>;
202
+ muted?: PropValue<boolean>;
203
+ }) => Mountable<StringHost>;
204
+ /**
205
+ * source component
206
+ */
207
+ declare const source: (props: BaseProps & {
208
+ src?: PropValue<string>;
209
+ type?: PropValue<string>;
210
+ }) => Mountable<StringHost>;
211
+ /**
212
+ * iframe component
213
+ */
214
+ declare const iframe: (props: BaseProps & {
215
+ src?: PropValue<string>;
216
+ width?: PropValue<string | number>;
217
+ height?: PropValue<string | number>;
218
+ frameborder?: PropValue<string | number>;
219
+ allowfullscreen?: PropValue<boolean>;
220
+ }) => Mountable<StringHost>;
221
+ /**
222
+ * canvas component (SSR only renders empty canvas tag)
223
+ */
224
+ declare const canvas: (props: BaseProps & {
225
+ width?: PropValue<string | number>;
226
+ height?: PropValue<string | number>;
227
+ }) => Mountable<StringHost>;
228
+
229
+ /**
230
+ * 转义 HTML 特殊字符,防止 XSS
231
+ */
232
+ declare function escapeHtml(text: string): string;
233
+ /**
234
+ * 转义属性值
235
+ */
236
+ declare function escapeAttr(value: string): string;
237
+ /**
238
+ * 将属性值转换为字符串
239
+ */
240
+ declare function stringifyAttr(name: string, value: string | number | boolean | null | undefined): string;
241
+ /**
242
+ * 将样式对象转换为 style 属性字符串
243
+ */
244
+ declare function stringifyStyle(styles: Record<string, string | number | null | undefined>): string;
245
+ /**
246
+ * 将类名数组或对象转换为 class 属性字符串
247
+ */
248
+ declare function stringifyClass(className: string | string[] | Record<string, boolean> | undefined): string;
249
+ /**
250
+ * 自闭合标签列表
251
+ */
252
+ declare const VOID_ELEMENTS: Set<string>;
253
+ /**
254
+ * 判断是否为自闭合标签
255
+ */
256
+ declare function isVoidElement(tag: string): boolean;
257
+
258
+ export { type StringHost, type StringMountFunction, VOID_ELEMENTS, a, article, aside, audio, blockquote, br, button, canvas, code, createStringHost, del, div, element, em, escapeAttr, escapeHtml, footer, form, h1, h2, h3, h4, h5, h6, header, hr, html, iframe, img, input, ins, isVoidElement, label, li, main, mark, nav, ol, option, p, pre, renderToString, renderToStringMultiple, section, select, small, source, span, stringContext, stringifyAttr, stringifyClass, stringifyStyle, strong, sub, sup, svg, table, tbody, td, textarea, tfoot, th, thead, tr, ul, video };