@rhi-zone/rainbow-ui 0.2.0-alpha.0
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.
- package/dist/elements.d.ts +95 -0
- package/dist/elements.js +118 -0
- package/dist/elements.test.d.ts +1 -0
- package/dist/form-state.d.ts +173 -0
- package/dist/form-state.js +98 -0
- package/dist/form-state.test.d.ts +1 -0
- package/dist/html-C8SnQjvU.js +238 -0
- package/dist/html.d.ts +499 -0
- package/dist/html.js +90 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +72 -0
- package/dist/keybinds.d.ts +103 -0
- package/dist/widget.d.ts +420 -0
- package/dist/widget.js +347 -0
- package/dist/widget.test.d.ts +7 -0
- package/package.json +44 -0
package/dist/html.d.ts
ADDED
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @busiless/ui/html
|
|
3
|
+
*
|
|
4
|
+
* Type-safe DOM element factories. Each factory returns a distinct nominal
|
|
5
|
+
* type so TypeScript can enforce HTML content model constraints: passing a
|
|
6
|
+
* TdEl where FlowContent is expected is a type error.
|
|
7
|
+
*
|
|
8
|
+
* Straight port of rhi-zone/crescent lib/html/init.lua, adapted for DOM
|
|
9
|
+
* construction rather than server-side string rendering.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* import * as h from '@busiless/ui/html'
|
|
13
|
+
* const card = h.div({ class: 'card' }, h.p({}, 'hello'), h.a({ href: '/about' }, 'About'))
|
|
14
|
+
*/
|
|
15
|
+
/** Nominal wrapper pairing a tag literal type with the underlying DOM node. */
|
|
16
|
+
export type El<Tag extends string, N extends HTMLElement | SVGElement = HTMLElement> = {
|
|
17
|
+
readonly _tag: Tag;
|
|
18
|
+
readonly node: N;
|
|
19
|
+
};
|
|
20
|
+
export type HtmlEl = El<"html", HTMLHtmlElement>;
|
|
21
|
+
export type HeadEl = El<"head", HTMLHeadElement>;
|
|
22
|
+
export type BodyEl = El<"body", HTMLBodyElement>;
|
|
23
|
+
export type DivEl = El<"div", HTMLDivElement>;
|
|
24
|
+
export type SectionEl = El<"section", HTMLElement>;
|
|
25
|
+
export type ArticleEl = El<"article", HTMLElement>;
|
|
26
|
+
export type AsideEl = El<"aside", HTMLElement>;
|
|
27
|
+
export type HeaderEl = El<"header", HTMLElement>;
|
|
28
|
+
export type FooterEl = El<"footer", HTMLElement>;
|
|
29
|
+
export type MainEl = El<"main", HTMLElement>;
|
|
30
|
+
export type NavEl = El<"nav", HTMLElement>;
|
|
31
|
+
export type H1El = El<"h1", HTMLHeadingElement>;
|
|
32
|
+
export type H2El = El<"h2", HTMLHeadingElement>;
|
|
33
|
+
export type H3El = El<"h3", HTMLHeadingElement>;
|
|
34
|
+
export type H4El = El<"h4", HTMLHeadingElement>;
|
|
35
|
+
export type H5El = El<"h5", HTMLHeadingElement>;
|
|
36
|
+
export type H6El = El<"h6", HTMLHeadingElement>;
|
|
37
|
+
export type PEl = El<"p", HTMLParagraphElement>;
|
|
38
|
+
export type SpanEl = El<"span", HTMLSpanElement>;
|
|
39
|
+
export type AEl = El<"a", HTMLAnchorElement>;
|
|
40
|
+
export type EmEl = El<"em", HTMLElement>;
|
|
41
|
+
export type StrongEl = El<"strong", HTMLElement>;
|
|
42
|
+
export type CodeEl = El<"code", HTMLElement>;
|
|
43
|
+
export type PreEl = El<"pre", HTMLPreElement>;
|
|
44
|
+
export type BlockquoteEl = El<"blockquote", HTMLElement>;
|
|
45
|
+
export type IEl = El<"i", HTMLElement>;
|
|
46
|
+
export type BEl = El<"b", HTMLElement>;
|
|
47
|
+
export type SmallEl = El<"small", HTMLElement>;
|
|
48
|
+
export type AbbrEl = El<"abbr", HTMLElement>;
|
|
49
|
+
export type BrEl = El<"br", HTMLBRElement>;
|
|
50
|
+
export type HrEl = El<"hr", HTMLHRElement>;
|
|
51
|
+
export type ImgEl = El<"img", HTMLImageElement>;
|
|
52
|
+
export type UlEl = El<"ul", HTMLUListElement>;
|
|
53
|
+
export type OlEl = El<"ol", HTMLOListElement>;
|
|
54
|
+
export type LiEl = El<"li", HTMLLIElement>;
|
|
55
|
+
export type DlEl = El<"dl", HTMLDListElement>;
|
|
56
|
+
export type DtEl = El<"dt", HTMLElement>;
|
|
57
|
+
export type DdEl = El<"dd", HTMLElement>;
|
|
58
|
+
export type TableEl = El<"table", HTMLTableElement>;
|
|
59
|
+
export type TheadEl = El<"thead", HTMLTableSectionElement>;
|
|
60
|
+
export type TbodyEl = El<"tbody", HTMLTableSectionElement>;
|
|
61
|
+
export type TfootEl = El<"tfoot", HTMLTableSectionElement>;
|
|
62
|
+
export type TrEl = El<"tr", HTMLTableRowElement>;
|
|
63
|
+
export type ThEl = El<"th", HTMLTableCellElement>;
|
|
64
|
+
export type TdEl = El<"td", HTMLTableCellElement>;
|
|
65
|
+
export type FormEl = El<"form", HTMLFormElement>;
|
|
66
|
+
export type InputEl = El<"input", HTMLInputElement>;
|
|
67
|
+
export type LabelEl = El<"label", HTMLLabelElement>;
|
|
68
|
+
export type FieldsetEl = El<"fieldset", HTMLFieldSetElement>;
|
|
69
|
+
export type SelectEl = El<"select", HTMLSelectElement>;
|
|
70
|
+
export type OptionEl = El<"option", HTMLOptionElement>;
|
|
71
|
+
export type TextareaEl = El<"textarea", HTMLTextAreaElement>;
|
|
72
|
+
export type ButtonEl = El<"button", HTMLButtonElement>;
|
|
73
|
+
export type IframeEl = El<"iframe", HTMLIFrameElement>;
|
|
74
|
+
export type VideoEl = El<"video", HTMLVideoElement>;
|
|
75
|
+
export type AudioEl = El<"audio", HTMLAudioElement>;
|
|
76
|
+
export type SourceEl = El<"source", HTMLSourceElement>;
|
|
77
|
+
export type CanvasEl = El<"canvas", HTMLCanvasElement>;
|
|
78
|
+
export type SvgEl = El<"svg", SVGSVGElement>;
|
|
79
|
+
export type CircleEl = El<"circle", SVGCircleElement>;
|
|
80
|
+
export type EllipseEl = El<"ellipse", SVGEllipseElement>;
|
|
81
|
+
export type RectEl = El<"rect", SVGRectElement>;
|
|
82
|
+
export type LineEl = El<"line", SVGLineElement>;
|
|
83
|
+
export type PolylineEl = El<"polyline", SVGPolylineElement>;
|
|
84
|
+
export type PolygonEl = El<"polygon", SVGPolygonElement>;
|
|
85
|
+
export type PathEl = El<"path", SVGPathElement>;
|
|
86
|
+
export type TextEl = El<"text", SVGTextElement>;
|
|
87
|
+
export type TspanEl = El<"tspan", SVGTSpanElement>;
|
|
88
|
+
export type GEl = El<"g", SVGGElement>;
|
|
89
|
+
export type DefsEl = El<"defs", SVGDefsElement>;
|
|
90
|
+
export type SymbolEl = El<"symbol", SVGSymbolElement>;
|
|
91
|
+
export type UseEl = El<"use", SVGUseElement>;
|
|
92
|
+
export type ClipPathEl = El<"clipPath", SVGClipPathElement>;
|
|
93
|
+
export type MaskEl = El<"mask", SVGMaskElement>;
|
|
94
|
+
export type LinearGradientEl = El<"linearGradient", SVGLinearGradientElement>;
|
|
95
|
+
export type RadialGradientEl = El<"radialGradient", SVGRadialGradientElement>;
|
|
96
|
+
export type StopEl = El<"stop", SVGStopElement>;
|
|
97
|
+
export type PatternEl = El<"pattern", SVGPatternElement>;
|
|
98
|
+
export type SvgImageEl = El<"image", SVGImageElement>;
|
|
99
|
+
export type ForeignObjectEl = El<"foreignObject", SVGForeignObjectElement>;
|
|
100
|
+
export type StyleEl = El<"style", HTMLStyleElement>;
|
|
101
|
+
export type ScriptEl = El<"script", HTMLScriptElement>;
|
|
102
|
+
export type MetaEl = El<"meta", HTMLMetaElement>;
|
|
103
|
+
export type LinkEl = El<"link", HTMLLinkElement>;
|
|
104
|
+
export type TitleEl = El<"title", HTMLTitleElement>;
|
|
105
|
+
export type HeadContent = MetaEl | LinkEl | ScriptEl | StyleEl | TitleEl;
|
|
106
|
+
export type PhrasingContent = SpanEl | AEl | EmEl | StrongEl | CodeEl | IEl | BEl | SmallEl | AbbrEl | ImgEl | BrEl | InputEl | ButtonEl | LabelEl | SelectEl | TextareaEl;
|
|
107
|
+
export type HeadingContent = H1El | H2El | H3El | H4El | H5El | H6El;
|
|
108
|
+
export type SectioningContent = SectionEl | ArticleEl | AsideEl | NavEl;
|
|
109
|
+
export type EmbeddedContent = ImgEl | VideoEl | AudioEl | IframeEl | CanvasEl | SvgEl;
|
|
110
|
+
export type FlowContent = DivEl | PEl | PreEl | BlockquoteEl | UlEl | OlEl | DlEl | TableEl | FormEl | FieldsetEl | HeaderEl | FooterEl | MainEl | HrEl | HeadingContent | SectioningContent | PhrasingContent | EmbeddedContent;
|
|
111
|
+
export type TableSectionContent = TheadEl | TbodyEl | TfootEl;
|
|
112
|
+
export type RowContent = TrEl;
|
|
113
|
+
export type CellContent = TdEl | ThEl;
|
|
114
|
+
export type ListItemContent = LiEl;
|
|
115
|
+
export type SelectContent = OptionEl;
|
|
116
|
+
export type DefinitionListContent = DtEl | DdEl;
|
|
117
|
+
export type SvgContent = CircleEl | EllipseEl | RectEl | LineEl | PolylineEl | PolygonEl | PathEl | TextEl | TspanEl | GEl | DefsEl | SymbolEl | UseEl | ClipPathEl | MaskEl | LinearGradientEl | RadialGradientEl | StopEl | PatternEl | SvgImageEl | ForeignObjectEl;
|
|
118
|
+
export type AnyEl = FlowContent | HeadContent | RowContent | CellContent | ListItemContent | SelectContent | SourceEl | TableSectionContent | DefinitionListContent | HtmlEl | HeadEl | BodyEl | SvgContent;
|
|
119
|
+
export type GlobalAttrs = {
|
|
120
|
+
id?: string;
|
|
121
|
+
class?: string;
|
|
122
|
+
style?: string;
|
|
123
|
+
title?: string;
|
|
124
|
+
hidden?: boolean;
|
|
125
|
+
tabindex?: number;
|
|
126
|
+
[key: `data-${string}`]: string | undefined;
|
|
127
|
+
};
|
|
128
|
+
export type AAttrs = GlobalAttrs & {
|
|
129
|
+
href?: string;
|
|
130
|
+
target?: string;
|
|
131
|
+
rel?: string;
|
|
132
|
+
download?: string;
|
|
133
|
+
};
|
|
134
|
+
export type ButtonAttrs = GlobalAttrs & {
|
|
135
|
+
type?: string;
|
|
136
|
+
name?: string;
|
|
137
|
+
value?: string;
|
|
138
|
+
disabled?: boolean;
|
|
139
|
+
form?: string;
|
|
140
|
+
};
|
|
141
|
+
export type FormAttrs = GlobalAttrs & {
|
|
142
|
+
action?: string;
|
|
143
|
+
method?: string;
|
|
144
|
+
enctype?: string;
|
|
145
|
+
};
|
|
146
|
+
export type ImgAttrs = GlobalAttrs & {
|
|
147
|
+
src: string;
|
|
148
|
+
alt: string;
|
|
149
|
+
width?: string;
|
|
150
|
+
height?: string;
|
|
151
|
+
loading?: string;
|
|
152
|
+
};
|
|
153
|
+
export type InputAttrs = GlobalAttrs & {
|
|
154
|
+
type?: string;
|
|
155
|
+
name?: string;
|
|
156
|
+
value?: string;
|
|
157
|
+
placeholder?: string;
|
|
158
|
+
required?: boolean;
|
|
159
|
+
disabled?: boolean;
|
|
160
|
+
checked?: boolean;
|
|
161
|
+
readonly?: boolean;
|
|
162
|
+
};
|
|
163
|
+
export type LabelAttrs = GlobalAttrs & {
|
|
164
|
+
for?: string;
|
|
165
|
+
};
|
|
166
|
+
export type LinkAttrs = {
|
|
167
|
+
rel: string;
|
|
168
|
+
href?: string;
|
|
169
|
+
type?: string;
|
|
170
|
+
media?: string;
|
|
171
|
+
id?: string;
|
|
172
|
+
class?: string;
|
|
173
|
+
};
|
|
174
|
+
export type MetaAttrs = {
|
|
175
|
+
name?: string;
|
|
176
|
+
content?: string;
|
|
177
|
+
charset?: string;
|
|
178
|
+
"http-equiv"?: string;
|
|
179
|
+
};
|
|
180
|
+
export type OptionAttrs = GlobalAttrs & {
|
|
181
|
+
value?: string;
|
|
182
|
+
selected?: boolean;
|
|
183
|
+
disabled?: boolean;
|
|
184
|
+
};
|
|
185
|
+
export type ScriptAttrs = {
|
|
186
|
+
src?: string;
|
|
187
|
+
type?: string;
|
|
188
|
+
async?: boolean;
|
|
189
|
+
defer?: boolean;
|
|
190
|
+
id?: string;
|
|
191
|
+
};
|
|
192
|
+
export type SelectAttrs = GlobalAttrs & {
|
|
193
|
+
name?: string;
|
|
194
|
+
multiple?: boolean;
|
|
195
|
+
required?: boolean;
|
|
196
|
+
disabled?: boolean;
|
|
197
|
+
};
|
|
198
|
+
export type TextareaAttrs = GlobalAttrs & {
|
|
199
|
+
name?: string;
|
|
200
|
+
rows?: number;
|
|
201
|
+
cols?: number;
|
|
202
|
+
placeholder?: string;
|
|
203
|
+
required?: boolean;
|
|
204
|
+
disabled?: boolean;
|
|
205
|
+
readonly?: boolean;
|
|
206
|
+
};
|
|
207
|
+
export type VideoAttrs = GlobalAttrs & {
|
|
208
|
+
src?: string;
|
|
209
|
+
controls?: boolean;
|
|
210
|
+
autoplay?: boolean;
|
|
211
|
+
loop?: boolean;
|
|
212
|
+
muted?: boolean;
|
|
213
|
+
width?: string;
|
|
214
|
+
height?: string;
|
|
215
|
+
};
|
|
216
|
+
export type AudioAttrs = GlobalAttrs & {
|
|
217
|
+
src?: string;
|
|
218
|
+
controls?: boolean;
|
|
219
|
+
autoplay?: boolean;
|
|
220
|
+
loop?: boolean;
|
|
221
|
+
muted?: boolean;
|
|
222
|
+
};
|
|
223
|
+
export type SourceAttrs = {
|
|
224
|
+
src?: string;
|
|
225
|
+
type?: string;
|
|
226
|
+
srcset?: string;
|
|
227
|
+
media?: string;
|
|
228
|
+
};
|
|
229
|
+
export type ThAttrs = GlobalAttrs & {
|
|
230
|
+
colspan?: number;
|
|
231
|
+
rowspan?: number;
|
|
232
|
+
scope?: string;
|
|
233
|
+
};
|
|
234
|
+
export type TdAttrs = GlobalAttrs & {
|
|
235
|
+
colspan?: number;
|
|
236
|
+
rowspan?: number;
|
|
237
|
+
};
|
|
238
|
+
export type OlAttrs = GlobalAttrs & {
|
|
239
|
+
start?: number;
|
|
240
|
+
};
|
|
241
|
+
export type SvgAttrs = {
|
|
242
|
+
id?: string;
|
|
243
|
+
class?: string;
|
|
244
|
+
style?: string;
|
|
245
|
+
width?: string;
|
|
246
|
+
height?: string;
|
|
247
|
+
viewBox?: string;
|
|
248
|
+
xmlns?: string;
|
|
249
|
+
};
|
|
250
|
+
export type IframeAttrs = GlobalAttrs & {
|
|
251
|
+
src?: string;
|
|
252
|
+
width?: string;
|
|
253
|
+
height?: string;
|
|
254
|
+
name?: string;
|
|
255
|
+
};
|
|
256
|
+
type SvgCoreAttrs = {
|
|
257
|
+
id?: string;
|
|
258
|
+
class?: string;
|
|
259
|
+
style?: string;
|
|
260
|
+
};
|
|
261
|
+
type SvgPresentationAttrs = {
|
|
262
|
+
fill?: string;
|
|
263
|
+
stroke?: string;
|
|
264
|
+
"stroke-width"?: string | number;
|
|
265
|
+
"stroke-linecap"?: string;
|
|
266
|
+
"stroke-linejoin"?: string;
|
|
267
|
+
"stroke-dasharray"?: string;
|
|
268
|
+
"stroke-dashoffset"?: string | number;
|
|
269
|
+
opacity?: string | number;
|
|
270
|
+
"fill-opacity"?: string | number;
|
|
271
|
+
"stroke-opacity"?: string | number;
|
|
272
|
+
transform?: string;
|
|
273
|
+
"clip-path"?: string;
|
|
274
|
+
mask?: string;
|
|
275
|
+
filter?: string;
|
|
276
|
+
};
|
|
277
|
+
export type CircleAttrs = SvgCoreAttrs & SvgPresentationAttrs & {
|
|
278
|
+
cx?: string | number;
|
|
279
|
+
cy?: string | number;
|
|
280
|
+
r?: string | number;
|
|
281
|
+
};
|
|
282
|
+
export type EllipseAttrs = SvgCoreAttrs & SvgPresentationAttrs & {
|
|
283
|
+
cx?: string | number;
|
|
284
|
+
cy?: string | number;
|
|
285
|
+
rx?: string | number;
|
|
286
|
+
ry?: string | number;
|
|
287
|
+
};
|
|
288
|
+
export type RectAttrs = SvgCoreAttrs & SvgPresentationAttrs & {
|
|
289
|
+
x?: string | number;
|
|
290
|
+
y?: string | number;
|
|
291
|
+
width?: string | number;
|
|
292
|
+
height?: string | number;
|
|
293
|
+
rx?: string | number;
|
|
294
|
+
ry?: string | number;
|
|
295
|
+
};
|
|
296
|
+
export type LineAttrs = SvgCoreAttrs & SvgPresentationAttrs & {
|
|
297
|
+
x1?: string | number;
|
|
298
|
+
y1?: string | number;
|
|
299
|
+
x2?: string | number;
|
|
300
|
+
y2?: string | number;
|
|
301
|
+
};
|
|
302
|
+
export type PolylineAttrs = SvgCoreAttrs & SvgPresentationAttrs & {
|
|
303
|
+
points?: string;
|
|
304
|
+
};
|
|
305
|
+
export type PolygonAttrs = SvgCoreAttrs & SvgPresentationAttrs & {
|
|
306
|
+
points?: string;
|
|
307
|
+
};
|
|
308
|
+
export type PathAttrs = SvgCoreAttrs & SvgPresentationAttrs & {
|
|
309
|
+
d?: string;
|
|
310
|
+
};
|
|
311
|
+
export type TextAttrs = SvgCoreAttrs & SvgPresentationAttrs & {
|
|
312
|
+
x?: string | number;
|
|
313
|
+
y?: string | number;
|
|
314
|
+
dx?: string | number;
|
|
315
|
+
dy?: string | number;
|
|
316
|
+
"text-anchor"?: string;
|
|
317
|
+
"font-size"?: string | number;
|
|
318
|
+
"font-family"?: string;
|
|
319
|
+
"font-weight"?: string;
|
|
320
|
+
};
|
|
321
|
+
export type TspanAttrs = SvgCoreAttrs & SvgPresentationAttrs & {
|
|
322
|
+
x?: string | number;
|
|
323
|
+
y?: string | number;
|
|
324
|
+
dx?: string | number;
|
|
325
|
+
dy?: string | number;
|
|
326
|
+
};
|
|
327
|
+
export type GAttrs = SvgCoreAttrs & SvgPresentationAttrs;
|
|
328
|
+
export type DefsAttrs = SvgCoreAttrs;
|
|
329
|
+
export type SymbolAttrs = SvgCoreAttrs & {
|
|
330
|
+
viewBox?: string;
|
|
331
|
+
width?: string | number;
|
|
332
|
+
height?: string | number;
|
|
333
|
+
};
|
|
334
|
+
export type UseAttrs = SvgCoreAttrs & SvgPresentationAttrs & {
|
|
335
|
+
href?: string;
|
|
336
|
+
x?: string | number;
|
|
337
|
+
y?: string | number;
|
|
338
|
+
width?: string | number;
|
|
339
|
+
height?: string | number;
|
|
340
|
+
};
|
|
341
|
+
export type ClipPathAttrs = SvgCoreAttrs & {
|
|
342
|
+
clipPathUnits?: string;
|
|
343
|
+
};
|
|
344
|
+
export type MaskAttrs = SvgCoreAttrs & {
|
|
345
|
+
x?: string | number;
|
|
346
|
+
y?: string | number;
|
|
347
|
+
width?: string | number;
|
|
348
|
+
height?: string | number;
|
|
349
|
+
maskUnits?: string;
|
|
350
|
+
maskContentUnits?: string;
|
|
351
|
+
};
|
|
352
|
+
export type LinearGradientAttrs = SvgCoreAttrs & {
|
|
353
|
+
x1?: string | number;
|
|
354
|
+
y1?: string | number;
|
|
355
|
+
x2?: string | number;
|
|
356
|
+
y2?: string | number;
|
|
357
|
+
gradientUnits?: string;
|
|
358
|
+
gradientTransform?: string;
|
|
359
|
+
spreadMethod?: string;
|
|
360
|
+
href?: string;
|
|
361
|
+
};
|
|
362
|
+
export type RadialGradientAttrs = SvgCoreAttrs & {
|
|
363
|
+
cx?: string | number;
|
|
364
|
+
cy?: string | number;
|
|
365
|
+
r?: string | number;
|
|
366
|
+
fx?: string | number;
|
|
367
|
+
fy?: string | number;
|
|
368
|
+
gradientUnits?: string;
|
|
369
|
+
gradientTransform?: string;
|
|
370
|
+
spreadMethod?: string;
|
|
371
|
+
href?: string;
|
|
372
|
+
};
|
|
373
|
+
export type StopAttrs = SvgCoreAttrs & {
|
|
374
|
+
offset?: string | number;
|
|
375
|
+
"stop-color"?: string;
|
|
376
|
+
"stop-opacity"?: string | number;
|
|
377
|
+
};
|
|
378
|
+
export type PatternAttrs = SvgCoreAttrs & {
|
|
379
|
+
x?: string | number;
|
|
380
|
+
y?: string | number;
|
|
381
|
+
width?: string | number;
|
|
382
|
+
height?: string | number;
|
|
383
|
+
patternUnits?: string;
|
|
384
|
+
patternTransform?: string;
|
|
385
|
+
viewBox?: string;
|
|
386
|
+
href?: string;
|
|
387
|
+
};
|
|
388
|
+
export type SvgImageAttrs = SvgCoreAttrs & SvgPresentationAttrs & {
|
|
389
|
+
href?: string;
|
|
390
|
+
x?: string | number;
|
|
391
|
+
y?: string | number;
|
|
392
|
+
width?: string | number;
|
|
393
|
+
height?: string | number;
|
|
394
|
+
preserveAspectRatio?: string;
|
|
395
|
+
};
|
|
396
|
+
export type ForeignObjectAttrs = SvgCoreAttrs & {
|
|
397
|
+
x?: string | number;
|
|
398
|
+
y?: string | number;
|
|
399
|
+
width?: string | number;
|
|
400
|
+
height?: string | number;
|
|
401
|
+
};
|
|
402
|
+
export declare const htmlEl: (attrs: GlobalAttrs & {
|
|
403
|
+
lang?: string;
|
|
404
|
+
}, ...children: (HeadEl | BodyEl)[]) => HtmlEl;
|
|
405
|
+
export declare const head: (attrs: GlobalAttrs, ...children: HeadContent[]) => HeadEl;
|
|
406
|
+
export declare const body: (attrs: GlobalAttrs, ...children: FlowContent[]) => BodyEl;
|
|
407
|
+
export declare const meta: (attrs: MetaAttrs) => MetaEl;
|
|
408
|
+
export declare const link: (attrs: LinkAttrs) => LinkEl;
|
|
409
|
+
export declare const script: (attrs: ScriptAttrs, content?: string) => ScriptEl;
|
|
410
|
+
export declare const style: (attrs: GlobalAttrs, content: string) => StyleEl;
|
|
411
|
+
export declare const title_: (attrs: GlobalAttrs, content: string) => TitleEl;
|
|
412
|
+
export declare const div: (attrs: GlobalAttrs, ...children: (FlowContent | string)[]) => DivEl;
|
|
413
|
+
export declare const section: (attrs: GlobalAttrs, ...children: (FlowContent | string)[]) => SectionEl;
|
|
414
|
+
export declare const article: (attrs: GlobalAttrs, ...children: (FlowContent | string)[]) => ArticleEl;
|
|
415
|
+
export declare const aside: (attrs: GlobalAttrs, ...children: (FlowContent | string)[]) => AsideEl;
|
|
416
|
+
export declare const header: (attrs: GlobalAttrs, ...children: (FlowContent | string)[]) => HeaderEl;
|
|
417
|
+
export declare const footer: (attrs: GlobalAttrs, ...children: (FlowContent | string)[]) => FooterEl;
|
|
418
|
+
export declare const main: (attrs: GlobalAttrs, ...children: (FlowContent | string)[]) => MainEl;
|
|
419
|
+
export declare const nav: (attrs: GlobalAttrs, ...children: (FlowContent | string)[]) => NavEl;
|
|
420
|
+
export declare const h1: (attrs: GlobalAttrs, ...children: (PhrasingContent | string)[]) => H1El;
|
|
421
|
+
export declare const h2: (attrs: GlobalAttrs, ...children: (PhrasingContent | string)[]) => H2El;
|
|
422
|
+
export declare const h3: (attrs: GlobalAttrs, ...children: (PhrasingContent | string)[]) => H3El;
|
|
423
|
+
export declare const h4: (attrs: GlobalAttrs, ...children: (PhrasingContent | string)[]) => H4El;
|
|
424
|
+
export declare const h5: (attrs: GlobalAttrs, ...children: (PhrasingContent | string)[]) => H5El;
|
|
425
|
+
export declare const h6: (attrs: GlobalAttrs, ...children: (PhrasingContent | string)[]) => H6El;
|
|
426
|
+
export declare const p: (attrs: GlobalAttrs, ...children: (PhrasingContent | string)[]) => PEl;
|
|
427
|
+
export declare const a: (attrs: AAttrs, ...children: (PhrasingContent | string)[]) => AEl;
|
|
428
|
+
export declare const span: (attrs: GlobalAttrs, ...children: (PhrasingContent | string)[]) => SpanEl;
|
|
429
|
+
export declare const em: (attrs: GlobalAttrs, ...children: (PhrasingContent | string)[]) => EmEl;
|
|
430
|
+
export declare const strong: (attrs: GlobalAttrs, ...children: (PhrasingContent | string)[]) => StrongEl;
|
|
431
|
+
export declare const code: (attrs: GlobalAttrs, ...children: (PhrasingContent | string)[]) => CodeEl;
|
|
432
|
+
export declare const pre: (attrs: GlobalAttrs, ...children: (PhrasingContent | string)[]) => PreEl;
|
|
433
|
+
export declare const blockquote: (attrs: GlobalAttrs, ...children: (FlowContent | string)[]) => BlockquoteEl;
|
|
434
|
+
export declare const i: (attrs: GlobalAttrs, ...children: (PhrasingContent | string)[]) => IEl;
|
|
435
|
+
export declare const b: (attrs: GlobalAttrs, ...children: (PhrasingContent | string)[]) => BEl;
|
|
436
|
+
export declare const small: (attrs: GlobalAttrs, ...children: (PhrasingContent | string)[]) => SmallEl;
|
|
437
|
+
export declare const abbr: (attrs: GlobalAttrs & {
|
|
438
|
+
title?: string;
|
|
439
|
+
}, ...children: (PhrasingContent | string)[]) => AbbrEl;
|
|
440
|
+
/** Pre-instantiated <br>. Creates a new DOM node each call to avoid insertion-move semantics. */
|
|
441
|
+
export declare const br: () => BrEl;
|
|
442
|
+
export declare const hr: (attrs?: GlobalAttrs) => HrEl;
|
|
443
|
+
export declare const img: (attrs: ImgAttrs) => ImgEl;
|
|
444
|
+
export declare const ul: (attrs: GlobalAttrs, ...children: ListItemContent[]) => UlEl;
|
|
445
|
+
export declare const ol: (attrs: OlAttrs, ...children: ListItemContent[]) => OlEl;
|
|
446
|
+
export declare const li: (attrs: GlobalAttrs, ...children: (FlowContent | string)[]) => LiEl;
|
|
447
|
+
export declare const dl: (attrs: GlobalAttrs, ...children: (DtEl | DdEl)[]) => DlEl;
|
|
448
|
+
export declare const dt: (attrs: GlobalAttrs, ...children: (PhrasingContent | string)[]) => DtEl;
|
|
449
|
+
export declare const dd: (attrs: GlobalAttrs, ...children: (FlowContent | string)[]) => DdEl;
|
|
450
|
+
export declare const table: (attrs: GlobalAttrs, ...children: TableSectionContent[]) => TableEl;
|
|
451
|
+
export declare const thead: (attrs: GlobalAttrs, ...children: RowContent[]) => TheadEl;
|
|
452
|
+
export declare const tbody: (attrs: GlobalAttrs, ...children: RowContent[]) => TbodyEl;
|
|
453
|
+
export declare const tfoot: (attrs: GlobalAttrs, ...children: RowContent[]) => TfootEl;
|
|
454
|
+
export declare const tr: (attrs: GlobalAttrs, ...children: CellContent[]) => TrEl;
|
|
455
|
+
export declare const th: (attrs: ThAttrs, ...children: (PhrasingContent | string)[]) => ThEl;
|
|
456
|
+
export declare const td: (attrs: TdAttrs, ...children: (FlowContent | string)[]) => TdEl;
|
|
457
|
+
export declare const form: (attrs: FormAttrs, ...children: (FlowContent | string)[]) => FormEl;
|
|
458
|
+
export declare const input: (attrs: InputAttrs) => InputEl;
|
|
459
|
+
export declare const label: (attrs: LabelAttrs, ...children: (PhrasingContent | string)[]) => LabelEl;
|
|
460
|
+
export declare const fieldset: (attrs: GlobalAttrs, ...children: (FlowContent | string)[]) => FieldsetEl;
|
|
461
|
+
export declare const select: (attrs: SelectAttrs, ...children: SelectContent[]) => SelectEl;
|
|
462
|
+
export declare const option: (attrs: OptionAttrs, content?: string) => OptionEl;
|
|
463
|
+
export declare const textarea: (attrs: TextareaAttrs, content?: string) => TextareaEl;
|
|
464
|
+
export declare const button: (attrs: ButtonAttrs, ...children: (PhrasingContent | string)[]) => ButtonEl;
|
|
465
|
+
export declare const iframe: (attrs: IframeAttrs) => IframeEl;
|
|
466
|
+
export declare const video: (attrs: VideoAttrs, ...children: (SourceEl | string)[]) => VideoEl;
|
|
467
|
+
export declare const audio: (attrs: AudioAttrs, ...children: (SourceEl | string)[]) => AudioEl;
|
|
468
|
+
export declare const source: (attrs: SourceAttrs) => SourceEl;
|
|
469
|
+
export declare const canvas: (attrs: GlobalAttrs & {
|
|
470
|
+
width?: string;
|
|
471
|
+
height?: string;
|
|
472
|
+
}) => CanvasEl;
|
|
473
|
+
export declare const svg: (attrs: SvgAttrs, ...children: (SvgContent | string)[]) => SvgEl;
|
|
474
|
+
export declare const circle: (attrs: CircleAttrs) => CircleEl;
|
|
475
|
+
export declare const ellipse: (attrs: EllipseAttrs) => EllipseEl;
|
|
476
|
+
export declare const rect: (attrs: RectAttrs) => RectEl;
|
|
477
|
+
export declare const line: (attrs: LineAttrs) => LineEl;
|
|
478
|
+
export declare const polyline: (attrs: PolylineAttrs) => PolylineEl;
|
|
479
|
+
export declare const polygon: (attrs: PolygonAttrs) => PolygonEl;
|
|
480
|
+
export declare const path: (attrs: PathAttrs) => PathEl;
|
|
481
|
+
export declare const svgText: (attrs: TextAttrs, ...children: (TspanEl | string)[]) => TextEl;
|
|
482
|
+
export declare const tspan: (attrs: TspanAttrs, ...children: (TspanEl | string)[]) => TspanEl;
|
|
483
|
+
export declare const g: (attrs: GAttrs, ...children: (SvgContent | string)[]) => GEl;
|
|
484
|
+
export declare const defs: (attrs: DefsAttrs, ...children: SvgContent[]) => DefsEl;
|
|
485
|
+
export declare const symbol: (attrs: SymbolAttrs, ...children: SvgContent[]) => SymbolEl;
|
|
486
|
+
export declare const use: (attrs: UseAttrs) => UseEl;
|
|
487
|
+
export declare const clipPath: (attrs: ClipPathAttrs, ...children: SvgContent[]) => ClipPathEl;
|
|
488
|
+
export declare const mask: (attrs: MaskAttrs, ...children: SvgContent[]) => MaskEl;
|
|
489
|
+
export declare const linearGradient: (attrs: LinearGradientAttrs, ...children: StopEl[]) => LinearGradientEl;
|
|
490
|
+
export declare const radialGradient: (attrs: RadialGradientAttrs, ...children: StopEl[]) => RadialGradientEl;
|
|
491
|
+
export declare const stop: (attrs: StopAttrs) => StopEl;
|
|
492
|
+
export declare const pattern: (attrs: PatternAttrs, ...children: SvgContent[]) => PatternEl;
|
|
493
|
+
export declare const svgImage: (attrs: SvgImageAttrs) => SvgImageEl;
|
|
494
|
+
export declare const foreignObject: (attrs: ForeignObjectAttrs, ...children: (FlowContent | string)[]) => ForeignObjectEl;
|
|
495
|
+
/** Escape HTML special characters. Useful for building safe attribute values. */
|
|
496
|
+
export declare function text(s: string): string;
|
|
497
|
+
/** Wrap a string as a DOM text node (for cases where AnyEl is required). */
|
|
498
|
+
export declare function textNode(s: string): Text;
|
|
499
|
+
export {};
|
package/dist/html.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { a as e, b as t, c as l, d as o, e as i, f as r, g as d, j as n, k as p, l as c, m as h, n as b, p as m, q as g, r as f, u, v, w as x, x as y, y as k, z as j, A as q, B as G, C as w, D as E, E as I, F as N, G as O, H as P, I as T, J as _, K as z, L as A, M as B, N as C, O as D, P as F, Q as H, R as J, i as K, S as L, T as M, U as Q, V as R, W as S, X as U, Y as V, Z as W, _ as X, $ as Y, o as Z, a0 as $, a1 as aa, a2 as sa, a3 as ea, a4 as ta, a5 as la, a6 as oa, a7 as ia, a8 as ra, a9 as da, s as na, aa as pa, ab as ca, ac as ha, ad as ba, ae as ma, af as ga, ag as fa, ah as ua, ai as va, aj as xa, ak as ya, al as ka, am as ja, an as qa, ao as Ga, t as wa, ap as Ea, aq as Ia, ar as Na, as as Oa, at as Pa, au as Ta, av as _a, aw as za, ax as Aa } from "./html-C8SnQjvU.js";
|
|
2
|
+
export {
|
|
3
|
+
e as a,
|
|
4
|
+
t as abbr,
|
|
5
|
+
l as article,
|
|
6
|
+
o as aside,
|
|
7
|
+
i as audio,
|
|
8
|
+
r as b,
|
|
9
|
+
d as blockquote,
|
|
10
|
+
n as body,
|
|
11
|
+
p as br,
|
|
12
|
+
c as button,
|
|
13
|
+
h as canvas,
|
|
14
|
+
b as circle,
|
|
15
|
+
m as clipPath,
|
|
16
|
+
g as code,
|
|
17
|
+
f as dd,
|
|
18
|
+
u as defs,
|
|
19
|
+
v as div,
|
|
20
|
+
x as dl,
|
|
21
|
+
y as dt,
|
|
22
|
+
k as ellipse,
|
|
23
|
+
j as em,
|
|
24
|
+
q as fieldset,
|
|
25
|
+
G as footer,
|
|
26
|
+
w as foreignObject,
|
|
27
|
+
E as form,
|
|
28
|
+
I as g,
|
|
29
|
+
N as h1,
|
|
30
|
+
O as h2,
|
|
31
|
+
P as h3,
|
|
32
|
+
T as h4,
|
|
33
|
+
_ as h5,
|
|
34
|
+
z as h6,
|
|
35
|
+
A as head,
|
|
36
|
+
B as header,
|
|
37
|
+
C as hr,
|
|
38
|
+
D as htmlEl,
|
|
39
|
+
F as i,
|
|
40
|
+
H as iframe,
|
|
41
|
+
J as img,
|
|
42
|
+
K as input,
|
|
43
|
+
L as label,
|
|
44
|
+
M as li,
|
|
45
|
+
Q as line,
|
|
46
|
+
R as linearGradient,
|
|
47
|
+
S as link,
|
|
48
|
+
U as main,
|
|
49
|
+
V as mask,
|
|
50
|
+
W as meta,
|
|
51
|
+
X as nav,
|
|
52
|
+
Y as ol,
|
|
53
|
+
Z as option,
|
|
54
|
+
$ as p,
|
|
55
|
+
aa as path,
|
|
56
|
+
sa as pattern,
|
|
57
|
+
ea as polygon,
|
|
58
|
+
ta as polyline,
|
|
59
|
+
la as pre,
|
|
60
|
+
oa as radialGradient,
|
|
61
|
+
ia as rect,
|
|
62
|
+
ra as script,
|
|
63
|
+
da as section,
|
|
64
|
+
na as select,
|
|
65
|
+
pa as small,
|
|
66
|
+
ca as source,
|
|
67
|
+
ha as span,
|
|
68
|
+
ba as stop,
|
|
69
|
+
ma as strong,
|
|
70
|
+
ga as style,
|
|
71
|
+
fa as svg,
|
|
72
|
+
ua as svgImage,
|
|
73
|
+
va as svgText,
|
|
74
|
+
xa as symbol,
|
|
75
|
+
ya as table,
|
|
76
|
+
ka as tbody,
|
|
77
|
+
ja as td,
|
|
78
|
+
qa as text,
|
|
79
|
+
Ga as textNode,
|
|
80
|
+
wa as textarea,
|
|
81
|
+
Ea as tfoot,
|
|
82
|
+
Ia as th,
|
|
83
|
+
Na as thead,
|
|
84
|
+
Oa as title_,
|
|
85
|
+
Pa as tr,
|
|
86
|
+
Ta as tspan,
|
|
87
|
+
_a as ul,
|
|
88
|
+
za as use,
|
|
89
|
+
Aa as video
|
|
90
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * as html from "./html.js";
|
|
2
|
+
export * from "./widget.js";
|
|
3
|
+
export * from "./form-state.js";
|
|
4
|
+
export * from "./keybinds.js";
|
|
5
|
+
export { attrString, attrNumber, attrBoolean, attrJson, attrsFrom, defineElement } from "./elements.js";
|
|
6
|
+
export type { AttrSchema, PrimitiveAttrSchema } from "./elements.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { h as g } from "./html-C8SnQjvU.js";
|
|
2
|
+
import { above as l, beside as p, bindAttr as f, bindCheckbox as x, bindClass as S, bindInput as w, bindSelect as W, bindShow as v, bindText as y, checkboxWidget as k, concat as C, dynamic as E, each as F, eachKeyed as A, focus as I, foldWidget as K, inputWidget as L, map as N, mount as B, narrow as D, numberInputWidget as J, on as T, register as V, selectWidget as j, show as q, stack as z, subscribe as G, subscribeNow as H, template as M, textareaWidget as O, watchAll as P, withScope as Q } from "./widget.js";
|
|
3
|
+
import { createForm as U, createFormState as X, isDirty as Y, isFormValid as Z, shouldShowError as _ } from "./form-state.js";
|
|
4
|
+
import { signal as a } from "@rhi-zone/rainbow";
|
|
5
|
+
import { attrBoolean as ee, attrJson as te, attrNumber as ne, attrString as ie, attrsFrom as oe, defineElement as re } from "./elements.js";
|
|
6
|
+
function c(e, n, t, r, i) {
|
|
7
|
+
const o = e(
|
|
8
|
+
n,
|
|
9
|
+
() => r(t.get()),
|
|
10
|
+
i
|
|
11
|
+
), s = t.subscribe(() => {
|
|
12
|
+
});
|
|
13
|
+
return () => {
|
|
14
|
+
s(), o();
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function b(e) {
|
|
18
|
+
const n = a(e.get());
|
|
19
|
+
function t(i) {
|
|
20
|
+
const o = i;
|
|
21
|
+
n.set(o.detail.bindings);
|
|
22
|
+
}
|
|
23
|
+
return e.addEventListener("change", t), [n, () => e.removeEventListener("change", t)];
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
l as above,
|
|
27
|
+
ee as attrBoolean,
|
|
28
|
+
te as attrJson,
|
|
29
|
+
ne as attrNumber,
|
|
30
|
+
ie as attrString,
|
|
31
|
+
oe as attrsFrom,
|
|
32
|
+
p as beside,
|
|
33
|
+
f as bindAttr,
|
|
34
|
+
x as bindCheckbox,
|
|
35
|
+
S as bindClass,
|
|
36
|
+
w as bindInput,
|
|
37
|
+
W as bindSelect,
|
|
38
|
+
v as bindShow,
|
|
39
|
+
y as bindText,
|
|
40
|
+
b as bindingsStoreSignal,
|
|
41
|
+
k as checkboxWidget,
|
|
42
|
+
C as concat,
|
|
43
|
+
U as createForm,
|
|
44
|
+
X as createFormState,
|
|
45
|
+
re as defineElement,
|
|
46
|
+
E as dynamic,
|
|
47
|
+
F as each,
|
|
48
|
+
A as eachKeyed,
|
|
49
|
+
I as focus,
|
|
50
|
+
K as foldWidget,
|
|
51
|
+
g as html,
|
|
52
|
+
L as inputWidget,
|
|
53
|
+
Y as isDirty,
|
|
54
|
+
Z as isFormValid,
|
|
55
|
+
c as keybindsContext,
|
|
56
|
+
N as map,
|
|
57
|
+
B as mount,
|
|
58
|
+
D as narrow,
|
|
59
|
+
J as numberInputWidget,
|
|
60
|
+
T as on,
|
|
61
|
+
V as register,
|
|
62
|
+
j as selectWidget,
|
|
63
|
+
_ as shouldShowError,
|
|
64
|
+
q as show,
|
|
65
|
+
z as stack,
|
|
66
|
+
G as subscribe,
|
|
67
|
+
H as subscribeNow,
|
|
68
|
+
M as template,
|
|
69
|
+
O as textareaWidget,
|
|
70
|
+
P as watchAll,
|
|
71
|
+
Q as withScope
|
|
72
|
+
};
|