ctrl-fx 0.0.1 → 0.1.1

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,916 @@
1
+ import {
2
+ async,
3
+ isEffect,
4
+ pure
5
+ } from "./chunk-KNHJPAIU.js";
6
+
7
+ // src/dom/nodeid.ts
8
+ function nodeId(value) {
9
+ return {
10
+ _tag: "node_id",
11
+ value,
12
+ eq(that) {
13
+ return this.value === that.value;
14
+ }
15
+ };
16
+ }
17
+ function isNodeId(value) {
18
+ if (value) {
19
+ if (typeof value === "object") {
20
+ if (Object.prototype.hasOwnProperty.call(value, "_tag")) {
21
+ const tag = value["_tag"];
22
+ if (tag) {
23
+ return tag === "node_id";
24
+ }
25
+ }
26
+ }
27
+ }
28
+ return false;
29
+ }
30
+ function findNodeId(items) {
31
+ return items.find(isNodeId);
32
+ }
33
+
34
+ // src/dom/attrs.ts
35
+ function attr(name, value) {
36
+ return {
37
+ name,
38
+ value
39
+ };
40
+ }
41
+ function prop(name, value) {
42
+ return { name, value };
43
+ }
44
+ function normalizeAttrArg(arg) {
45
+ if (Array.isArray(arg)) {
46
+ return { name: arg[0], value: arg[1] };
47
+ } else if (typeof arg === "object") {
48
+ return arg;
49
+ } else {
50
+ return { name: arg };
51
+ }
52
+ }
53
+ function normalizeAttrArgs(args) {
54
+ const attrs = [];
55
+ args.forEach((arg) => {
56
+ if (!isNodeId(arg)) {
57
+ attrs.push(normalizeAttrArg(arg));
58
+ }
59
+ });
60
+ return attrs;
61
+ }
62
+ function getId(attrs) {
63
+ const id2 = attrs.find((a) => a.name.toLowerCase() === "id");
64
+ return id2 ? id2.value : void 0;
65
+ }
66
+ function id(value) {
67
+ return attr("id", value);
68
+ }
69
+ function typeAttr(value) {
70
+ return attr("type", value);
71
+ }
72
+ function cssVars(vars) {
73
+ return attr(
74
+ "style",
75
+ Object.entries(vars).map(([k, v]) => `${k}: ${v}`).join("; ")
76
+ );
77
+ }
78
+
79
+ // src/dom/events.ts
80
+ var eventTypes = [
81
+ "blur",
82
+ "change",
83
+ "click",
84
+ "dblclick",
85
+ "focus",
86
+ "keydown",
87
+ "keyup",
88
+ "mouseenter",
89
+ "mouseleave",
90
+ "mousemove",
91
+ "scroll",
92
+ "scrollend",
93
+ "submit",
94
+ "textinput",
95
+ "touchstart",
96
+ "touchmove",
97
+ "touchend",
98
+ "touchcancel",
99
+ "wheel"
100
+ ];
101
+ function eventSupport() {
102
+ return {
103
+ ...blurFocusSupport(),
104
+ ...changeSupport(),
105
+ ...clickSupport(),
106
+ ...customEventSupport(),
107
+ ...keySupport(),
108
+ ...dblClickSupport(),
109
+ ...mouseSupport(),
110
+ ...mouseMoveSupport(),
111
+ ...scrollSupport(),
112
+ ...submitSupport(),
113
+ ...wheelSupport(),
114
+ ...textInputSupport(),
115
+ ...touchSupport()
116
+ };
117
+ }
118
+ function customEventSupport() {
119
+ return {
120
+ onEvent(eventName, effect, options) {
121
+ return {
122
+ ...this,
123
+ eventListeners: [
124
+ ...this.eventListeners,
125
+ { _type: "custom", eventName, effect, options: options || {} }
126
+ ]
127
+ };
128
+ }
129
+ };
130
+ }
131
+ function blurFocusSupport() {
132
+ return {
133
+ onFocus(effect, options) {
134
+ return {
135
+ ...this,
136
+ eventListeners: [
137
+ ...this.eventListeners,
138
+ { _type: "focus", effect, options: options || {} }
139
+ ]
140
+ };
141
+ },
142
+ onBlur(effect, options) {
143
+ return {
144
+ ...this,
145
+ eventListeners: [
146
+ ...this.eventListeners,
147
+ { _type: "blur", effect, options: options || {} }
148
+ ]
149
+ };
150
+ }
151
+ };
152
+ }
153
+ function changeSupport() {
154
+ return {
155
+ onChange(effect, options) {
156
+ return {
157
+ ...this,
158
+ eventListeners: [
159
+ ...this.eventListeners,
160
+ { _type: "change", effect, options: options || {} }
161
+ ]
162
+ };
163
+ }
164
+ };
165
+ }
166
+ function clickSupport() {
167
+ return {
168
+ onClick(effect, options) {
169
+ return {
170
+ ...this,
171
+ eventListeners: [
172
+ ...this.eventListeners,
173
+ { _type: "click", effect, options: options || {} }
174
+ ]
175
+ };
176
+ }
177
+ };
178
+ }
179
+ function dblClickSupport() {
180
+ return {
181
+ onDblClick(effect, options) {
182
+ return {
183
+ ...this,
184
+ eventListeners: [
185
+ ...this.eventListeners,
186
+ { _type: "dblclick", effect, options: options || {} }
187
+ ]
188
+ };
189
+ }
190
+ };
191
+ }
192
+ function mouseMoveSupport() {
193
+ return {
194
+ onMouseMove(effect, options) {
195
+ return {
196
+ ...this,
197
+ eventListeners: [
198
+ ...this.eventListeners,
199
+ { _type: "mousemove", effect, options: options || {} }
200
+ ]
201
+ };
202
+ }
203
+ };
204
+ }
205
+ function wheelSupport() {
206
+ return {
207
+ onWheel(effect, options) {
208
+ return {
209
+ ...this,
210
+ eventListeners: [
211
+ ...this.eventListeners,
212
+ { _type: "wheel", effect, options: options || {} }
213
+ ]
214
+ };
215
+ }
216
+ };
217
+ }
218
+ function mouseSupport() {
219
+ return {
220
+ onMouseEnter(effect, options) {
221
+ return {
222
+ ...this,
223
+ eventListeners: [
224
+ ...this.eventListeners,
225
+ { _type: "mouseenter", effect, options: options || {} }
226
+ ]
227
+ };
228
+ },
229
+ onMouseLeave(effect, options) {
230
+ return {
231
+ ...this,
232
+ eventListeners: [
233
+ ...this.eventListeners,
234
+ { _type: "mouseleave", effect, options: options || {} }
235
+ ]
236
+ };
237
+ }
238
+ };
239
+ }
240
+ function submitSupport() {
241
+ return {
242
+ onSubmit(effect, options) {
243
+ return {
244
+ ...this,
245
+ eventListeners: [
246
+ ...this.eventListeners,
247
+ { _type: "submit", effect, options: options || {} }
248
+ ]
249
+ };
250
+ }
251
+ };
252
+ }
253
+ function scrollSupport() {
254
+ return {
255
+ onScroll(effect, options) {
256
+ return {
257
+ ...this,
258
+ eventListeners: [
259
+ ...this.eventListeners,
260
+ { _type: "scroll", effect, options: options || {} }
261
+ ]
262
+ };
263
+ },
264
+ onScrollEnd(effect, options) {
265
+ return {
266
+ ...this,
267
+ eventListeners: [
268
+ ...this.eventListeners,
269
+ { _type: "scrollend", effect, options: options || {} }
270
+ ]
271
+ };
272
+ }
273
+ };
274
+ }
275
+ function touchSupport() {
276
+ return {
277
+ onTouchStart(effect, options) {
278
+ return {
279
+ ...this,
280
+ eventListeners: [
281
+ ...this.eventListeners,
282
+ { _type: "touchstart", effect, options: options || {} }
283
+ ]
284
+ };
285
+ },
286
+ onTouchMove(effect, options) {
287
+ return {
288
+ ...this,
289
+ eventListeners: [
290
+ ...this.eventListeners,
291
+ { _type: "touchmove", effect, options: options || {} }
292
+ ]
293
+ };
294
+ },
295
+ onTouchEnd(effect, options) {
296
+ return {
297
+ ...this,
298
+ eventListeners: [
299
+ ...this.eventListeners,
300
+ { _type: "touchend", effect, options: options || {} }
301
+ ]
302
+ };
303
+ },
304
+ onTouchCancel(effect, options) {
305
+ return {
306
+ ...this,
307
+ eventListeners: [
308
+ ...this.eventListeners,
309
+ { _type: "touchcancel", effect, options: options || {} }
310
+ ]
311
+ };
312
+ }
313
+ };
314
+ }
315
+ function keySupport() {
316
+ return {
317
+ onKeyDown(effect, options) {
318
+ return {
319
+ ...this,
320
+ eventListeners: [
321
+ ...this.eventListeners,
322
+ { _type: "keydown", effect, options: options || {} }
323
+ ]
324
+ };
325
+ },
326
+ onKeyUp(effect, options) {
327
+ return {
328
+ ...this,
329
+ eventListeners: [
330
+ ...this.eventListeners,
331
+ { _type: "keyup", effect, options: options || {} }
332
+ ]
333
+ };
334
+ }
335
+ };
336
+ }
337
+ function textInputSupport() {
338
+ return {
339
+ onTextInput(effect, options) {
340
+ return {
341
+ ...this,
342
+ eventListeners: [
343
+ ...this.eventListeners,
344
+ { _type: "textinput", effect, options: options || {} }
345
+ ]
346
+ };
347
+ }
348
+ };
349
+ }
350
+ function preventDefault(effect) {
351
+ return async(effect, 0).as({ preventDefault: true });
352
+ }
353
+ function stopPropagation(effect) {
354
+ return async(effect, 0).as({ stopPropagation: true });
355
+ }
356
+ function stopPropagationAndPreventDefault(effect) {
357
+ return async(effect, 0).as({ stopPropagation: true, preventDefault: true });
358
+ }
359
+ var windowContainerEventTypes = ["resize", "popstate", "locationchange", "online", "offline"];
360
+ var documentContainerEventTypes = ["keydown", "keyup", "visibilitychange"];
361
+ var containerEventTypes = [
362
+ ...windowContainerEventTypes,
363
+ ...documentContainerEventTypes
364
+ ];
365
+
366
+ // src/dom/views.ts
367
+ function nodeGroup(...nodes) {
368
+ return {
369
+ _type: "NodeGroup",
370
+ nodes,
371
+ containerListeners: [],
372
+ onResize(effect) {
373
+ return {
374
+ ...this,
375
+ containerListeners: [
376
+ ...this.containerListeners,
377
+ {
378
+ _type: "resize",
379
+ onChange: effect,
380
+ options: {}
381
+ }
382
+ ]
383
+ };
384
+ },
385
+ onPopState(effect) {
386
+ return {
387
+ ...this,
388
+ containerListeners: [
389
+ ...this.containerListeners,
390
+ {
391
+ _type: "popstate",
392
+ onChange: effect,
393
+ options: {}
394
+ }
395
+ ]
396
+ };
397
+ },
398
+ onLocationChange(effect) {
399
+ return {
400
+ ...this,
401
+ containerListeners: [
402
+ ...this.containerListeners,
403
+ {
404
+ _type: "locationchange",
405
+ onChange: effect,
406
+ options: {}
407
+ }
408
+ ]
409
+ };
410
+ },
411
+ onKeyDown(effect) {
412
+ return {
413
+ ...this,
414
+ containerListeners: [
415
+ ...this.containerListeners,
416
+ {
417
+ _type: "keydown",
418
+ effect,
419
+ options: {}
420
+ }
421
+ ]
422
+ };
423
+ },
424
+ onKeyUp(effect) {
425
+ return {
426
+ ...this,
427
+ containerListeners: [
428
+ ...this.containerListeners,
429
+ { _type: "keyup", effect, options: {} }
430
+ ]
431
+ };
432
+ },
433
+ onVisibilityChange(effect) {
434
+ return {
435
+ ...this,
436
+ containerListeners: [
437
+ ...this.containerListeners,
438
+ { _type: "visibilitychange", onChange: effect, options: {} }
439
+ ]
440
+ };
441
+ },
442
+ onOnline(effect) {
443
+ return {
444
+ ...this,
445
+ containerListeners: [
446
+ ...this.containerListeners,
447
+ { _type: "online", effect, options: {} }
448
+ ]
449
+ };
450
+ },
451
+ onOffline(effect) {
452
+ return {
453
+ ...this,
454
+ containerListeners: [
455
+ ...this.containerListeners,
456
+ { _type: "offline", effect, options: {} }
457
+ ]
458
+ };
459
+ },
460
+ renderEffects: [],
461
+ onRender(...effects) {
462
+ return {
463
+ ...this,
464
+ renderEffects: effects
465
+ };
466
+ }
467
+ };
468
+ }
469
+ function _(...nodes) {
470
+ return nodeGroup(...nodes);
471
+ }
472
+ function view(id2, nodes) {
473
+ return (params) => ({
474
+ _type: "View",
475
+ nodeId: typeof id2 === "string" ? nodeId(id2) : id2,
476
+ params,
477
+ nodes: (params2) => {
478
+ const nodeOrNodeGroup = nodes(params2);
479
+ return isNodeGroup(nodeOrNodeGroup) ? nodeOrNodeGroup : _(nodeOrNodeGroup);
480
+ }
481
+ });
482
+ }
483
+ function fixedView(id2) {
484
+ return (nodes) => ({
485
+ _type: "View",
486
+ nodeId: typeof id2 === "string" ? nodeId(id2) : id2,
487
+ params: void 0,
488
+ nodes: () => isNodeGroup(nodes) ? nodes : _(nodes)
489
+ });
490
+ }
491
+ function isNodeGroup(value) {
492
+ if (value === null || value === void 0) {
493
+ return false;
494
+ }
495
+ if (typeof value !== "object") {
496
+ return false;
497
+ }
498
+ return Object.prototype.hasOwnProperty.call(value, "_type") && // eslint-disable-next-line @typescript-eslint/no-explicit-any
499
+ value["_type"] === "NodeGroup" && Object.prototype.hasOwnProperty.call(value, "nodes") && Object.prototype.hasOwnProperty.call(value, "containerListeners");
500
+ }
501
+
502
+ // src/dom/components.ts
503
+ function componentElem(component2, nodeId2, params) {
504
+ const resolvedComponent = params !== void 0 ? { ...component2, params } : component2;
505
+ return {
506
+ _type: "Component",
507
+ nodeId: nodeId2,
508
+ component: resolvedComponent,
509
+ componentEventListeners: [],
510
+ onEvent(eventListener) {
511
+ const eventListeners = this.componentEventListeners;
512
+ return {
513
+ ...this,
514
+ componentEventListeners: [...eventListeners, eventListener]
515
+ };
516
+ }
517
+ };
518
+ }
519
+ function toComponent(view2, initialState, params, css) {
520
+ return {
521
+ _type: "Component",
522
+ params,
523
+ css,
524
+ initialState(params2) {
525
+ const result = initialState(params2);
526
+ if (isEffect(result)) {
527
+ return result;
528
+ } else {
529
+ return pure(result);
530
+ }
531
+ },
532
+ view(state, params2) {
533
+ const result = view2(state, params2);
534
+ if (typeof result === "object" && result._type === "NodeGroup") {
535
+ return result;
536
+ } else {
537
+ return nodeGroup(result);
538
+ }
539
+ }
540
+ };
541
+ }
542
+ function toSimpleComponent(view2, initialState, css) {
543
+ return {
544
+ _type: "Component",
545
+ css,
546
+ initialState: () => {
547
+ if (isEffect(initialState)) {
548
+ return initialState;
549
+ } else {
550
+ return pure(initialState);
551
+ }
552
+ },
553
+ view: (state) => {
554
+ const result = view2(state);
555
+ if (typeof result === "object" && result["_type"] === "NodeGroup") {
556
+ return result;
557
+ } else {
558
+ return nodeGroup(result);
559
+ }
560
+ },
561
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
562
+ params: void 0
563
+ };
564
+ }
565
+ function component(...args) {
566
+ if (args.length <= 3 && (args.length < 3 || typeof args[2] === "string" || args[2] === void 0)) {
567
+ const [view2, initialState, css] = args;
568
+ return toSimpleComponent(view2, initialState, css);
569
+ } else {
570
+ const [view2, initialState, params, css] = args;
571
+ return toComponent(
572
+ view2,
573
+ initialState,
574
+ params,
575
+ css
576
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
577
+ );
578
+ }
579
+ }
580
+
581
+ // src/utils/apply.ts
582
+ function applySupport() {
583
+ return {
584
+ apply(f) {
585
+ return f(this);
586
+ },
587
+ applyIf(condition, f) {
588
+ return condition ? f(this) : this;
589
+ }
590
+ };
591
+ }
592
+
593
+ // src/dom/elems.ts
594
+ function propSupport() {
595
+ return {
596
+ prop(name, value) {
597
+ return {
598
+ ...this,
599
+ props: [...this.props, { name, value }],
600
+ ...propSupport()
601
+ };
602
+ }
603
+ };
604
+ }
605
+ function makeNonVoidElement(tag) {
606
+ return (...attrs) => {
607
+ return (...children) => {
608
+ return {
609
+ _type: "Element",
610
+ tag,
611
+ nodeId: findNodeId(attrs),
612
+ attrs: normalizeAttrArgs(attrs),
613
+ props: [],
614
+ children,
615
+ eventListeners: [],
616
+ ...eventSupport(),
617
+ ...propSupport(),
618
+ ...applySupport()
619
+ };
620
+ };
621
+ };
622
+ }
623
+ function makeVoidElement(tag) {
624
+ return (...attrs) => {
625
+ return {
626
+ _type: "Element",
627
+ tag,
628
+ nodeId: findNodeId(attrs),
629
+ attrs: normalizeAttrArgs(attrs),
630
+ props: [],
631
+ eventListeners: [],
632
+ ...eventSupport(),
633
+ ...propSupport(),
634
+ ...applySupport()
635
+ };
636
+ };
637
+ }
638
+
639
+ // src/dom/index.ts
640
+ function makeDom() {
641
+ const functions = {
642
+ br: makeVoidElement("br"),
643
+ hr: makeVoidElement("hr"),
644
+ img: makeVoidElement("img"),
645
+ input: makeVoidElement("input"),
646
+ a: makeNonVoidElement("a"),
647
+ abbr: makeNonVoidElement("abbr"),
648
+ address: makeNonVoidElement("address"),
649
+ article: makeNonVoidElement("article"),
650
+ aside: makeNonVoidElement("aside"),
651
+ b: makeNonVoidElement("b"),
652
+ blockquote: makeNonVoidElement("blockquote"),
653
+ button: makeNonVoidElement("button"),
654
+ cite: makeNonVoidElement("cite"),
655
+ code: makeNonVoidElement("code"),
656
+ dd: makeNonVoidElement("dd"),
657
+ details: makeNonVoidElement("details"),
658
+ div: makeNonVoidElement("div"),
659
+ dl: makeNonVoidElement("dl"),
660
+ dt: makeNonVoidElement("dt"),
661
+ em: makeNonVoidElement("em"),
662
+ fieldset: makeNonVoidElement("fieldset"),
663
+ figcaption: makeNonVoidElement("figcaption"),
664
+ figure: makeNonVoidElement("figure"),
665
+ footer: makeNonVoidElement("footer"),
666
+ form: makeNonVoidElement("form"),
667
+ h1: makeNonVoidElement("h1"),
668
+ h2: makeNonVoidElement("h2"),
669
+ h3: makeNonVoidElement("h3"),
670
+ h4: makeNonVoidElement("h4"),
671
+ h5: makeNonVoidElement("h5"),
672
+ h6: makeNonVoidElement("h6"),
673
+ header: makeNonVoidElement("header"),
674
+ i: makeNonVoidElement("i"),
675
+ kbd: makeNonVoidElement("kbd"),
676
+ label: makeNonVoidElement("label"),
677
+ li: makeNonVoidElement("li"),
678
+ main: makeNonVoidElement("main"),
679
+ mark: makeNonVoidElement("mark"),
680
+ nav: makeNonVoidElement("nav"),
681
+ ol: makeNonVoidElement(
682
+ "ol"
683
+ ),
684
+ option: makeNonVoidElement(
685
+ "option"
686
+ ),
687
+ p: makeNonVoidElement("p"),
688
+ pre: makeNonVoidElement("pre"),
689
+ q: makeNonVoidElement("q"),
690
+ s: makeNonVoidElement("s"),
691
+ section: makeNonVoidElement("section"),
692
+ select: makeNonVoidElement("select"),
693
+ small: makeNonVoidElement("small"),
694
+ span: makeNonVoidElement("span"),
695
+ strong: makeNonVoidElement("strong"),
696
+ sub: makeNonVoidElement("sub"),
697
+ summary: makeNonVoidElement("summary"),
698
+ sup: makeNonVoidElement("sup"),
699
+ table: makeNonVoidElement("table"),
700
+ tbody: makeNonVoidElement("tbody"),
701
+ td: makeNonVoidElement("td"),
702
+ textarea: makeNonVoidElement("textarea"),
703
+ tfoot: makeNonVoidElement("tfoot"),
704
+ th: makeNonVoidElement("th"),
705
+ thead: makeNonVoidElement("thead"),
706
+ time: makeNonVoidElement("time"),
707
+ tr: makeNonVoidElement("tr"),
708
+ u: makeNonVoidElement("u"),
709
+ ul: makeNonVoidElement(
710
+ "ul"
711
+ ),
712
+ svg: makeNonVoidElement("svg/svg"),
713
+ circle: makeVoidElement("svg/circle"),
714
+ ellipse: makeVoidElement(
715
+ "svg/ellipse"
716
+ ),
717
+ image: makeVoidElement("svg/image"),
718
+ line: makeVoidElement("svg/line"),
719
+ polyline: makeVoidElement(
720
+ "svg/polyline"
721
+ ),
722
+ polygon: makeVoidElement(
723
+ "svg/polygon"
724
+ ),
725
+ path: makeVoidElement("svg/path"),
726
+ rect: makeVoidElement("svg/rect"),
727
+ use: makeVoidElement("svg/use"),
728
+ element: (tag) => makeNonVoidElement(tag),
729
+ nodeGroup,
730
+ _,
731
+ fixedView
732
+ };
733
+ return {
734
+ ...functions,
735
+ a_: functions.a(),
736
+ a__: (...attrs) => functions.a(...attrs)(),
737
+ abbr_: functions.abbr(),
738
+ abbr__: (...attrs) => functions.abbr(...attrs)(),
739
+ address_: functions.address(),
740
+ address__: (...attrs) => functions.address(...attrs)(),
741
+ article_: functions.article(),
742
+ article__: (...attrs) => functions.article(...attrs)(),
743
+ aside_: functions.aside(),
744
+ aside__: (...attrs) => functions.aside(...attrs)(),
745
+ b_: functions.b(),
746
+ b__: (...attrs) => functions.b(...attrs)(),
747
+ blockquote_: functions.blockquote(),
748
+ blockquote__: (...attrs) => functions.blockquote(...attrs)(),
749
+ button_: functions.button(),
750
+ button__: (...attrs) => functions.button(...attrs)(),
751
+ cite_: functions.cite(),
752
+ cite__: (...attrs) => functions.cite(...attrs)(),
753
+ code_: functions.code(),
754
+ code__: (...attrs) => functions.code(...attrs)(),
755
+ dd_: functions.dd(),
756
+ dd__: (...attrs) => functions.dd(...attrs)(),
757
+ details_: functions.details(),
758
+ details__: (...attrs) => functions.details(...attrs)(),
759
+ div_: functions.div(),
760
+ div__: (...attrs) => functions.div(...attrs)(),
761
+ dl_: functions.dl(),
762
+ dl__: (...attrs) => functions.dl(...attrs)(),
763
+ dt_: functions.dt(),
764
+ dt__: (...attrs) => functions.dt(...attrs)(),
765
+ em_: functions.em(),
766
+ em__: (...attrs) => functions.em(...attrs)(),
767
+ fieldset_: functions.fieldset(),
768
+ fieldset__: (...attrs) => functions.fieldset(...attrs)(),
769
+ figcaption_: functions.figcaption(),
770
+ figcaption__: (...attrs) => functions.figcaption(...attrs)(),
771
+ figure_: functions.figure(),
772
+ figure__: (...attrs) => functions.figure(...attrs)(),
773
+ footer_: functions.footer(),
774
+ footer__: (...attrs) => functions.footer(...attrs)(),
775
+ form_: functions.form(),
776
+ form__: (...attrs) => functions.form(...attrs)(),
777
+ h1_: functions.h1(),
778
+ h1__: (...attrs) => functions.h1(...attrs)(),
779
+ h2_: functions.h2(),
780
+ h2__: (...attrs) => functions.h2(...attrs)(),
781
+ h3_: functions.h3(),
782
+ h3__: (...attrs) => functions.h3(...attrs)(),
783
+ h4_: functions.h4(),
784
+ h4__: (...attrs) => functions.h4(...attrs)(),
785
+ h5_: functions.h5(),
786
+ h5__: (...attrs) => functions.h5(...attrs)(),
787
+ h6_: functions.h6(),
788
+ h6__: (...attrs) => functions.h6(...attrs)(),
789
+ header_: functions.header(),
790
+ header__: (...attrs) => functions.header(...attrs)(),
791
+ i_: functions.i(),
792
+ i__: (...attrs) => functions.i(...attrs)(),
793
+ kbd_: functions.kbd(),
794
+ kbd__: (...attrs) => functions.kbd(...attrs)(),
795
+ label_: functions.label(),
796
+ label__: (...attrs) => functions.label(...attrs)(),
797
+ li_: functions.li(),
798
+ li__: (...attrs) => functions.li(...attrs)(),
799
+ main_: functions.main(),
800
+ main__: (...attrs) => functions.main(...attrs)(),
801
+ mark_: functions.mark(),
802
+ mark__: (...attrs) => functions.mark(...attrs)(),
803
+ nav_: functions.nav(),
804
+ nav__: (...attrs) => functions.nav(...attrs)(),
805
+ ol_: functions.ol(),
806
+ ol__: (...attrs) => functions.ol(...attrs)(),
807
+ option_: functions.option(),
808
+ option__: (...attrs) => functions.option(...attrs)(),
809
+ p_: functions.p(),
810
+ p__: (...attrs) => functions.p(...attrs)(),
811
+ pre_: functions.pre(),
812
+ pre__: (...attrs) => functions.pre(...attrs)(),
813
+ q_: functions.q(),
814
+ q__: (...attrs) => functions.q(...attrs)(),
815
+ s_: functions.s(),
816
+ s__: (...attrs) => functions.s(...attrs)(),
817
+ section_: functions.section(),
818
+ section__: (...attrs) => functions.section(...attrs)(),
819
+ select_: functions.select(),
820
+ select__: (...attrs) => functions.select(...attrs)(),
821
+ small_: functions.small(),
822
+ small__: (...attrs) => functions.small(...attrs)(),
823
+ span_: functions.span(),
824
+ span__: (...attrs) => functions.span(...attrs)(),
825
+ strong_: functions.strong(),
826
+ strong__: (...attrs) => functions.strong(...attrs)(),
827
+ sub_: functions.sub(),
828
+ sub__: (...attrs) => functions.sub(...attrs)(),
829
+ summary_: functions.summary(),
830
+ summary__: (...attrs) => functions.summary(...attrs)(),
831
+ sup_: functions.sup(),
832
+ sup__: (...attrs) => functions.sup(...attrs)(),
833
+ svg_: functions.svg(),
834
+ svg__: (...attrs) => functions.svg(...attrs)(),
835
+ table_: functions.table(),
836
+ table__: (...attrs) => functions.table(...attrs)(),
837
+ tbody_: functions.tbody(),
838
+ tbody__: (...attrs) => functions.tbody(...attrs)(),
839
+ td_: functions.td(),
840
+ td__: (...attrs) => functions.td(...attrs)(),
841
+ textarea_: functions.textarea(),
842
+ textarea__: (...attrs) => functions.textarea(...attrs)(),
843
+ tfoot_: functions.tfoot(),
844
+ tfoot__: (...attrs) => functions.tfoot(...attrs)(),
845
+ th_: functions.th(),
846
+ th__: (...attrs) => functions.th(...attrs)(),
847
+ thead_: functions.thead(),
848
+ thead__: (...attrs) => functions.thead(...attrs)(),
849
+ time_: functions.time(),
850
+ time__: (...attrs) => functions.time(...attrs)(),
851
+ tr_: functions.tr(),
852
+ tr__: (...attrs) => functions.tr(...attrs)(),
853
+ u_: functions.u(),
854
+ u__: (...attrs) => functions.u(...attrs)(),
855
+ ul_: functions.ul(),
856
+ ul__: (...attrs) => functions.ul(...attrs)(),
857
+ view(nodeId2, nodes) {
858
+ return view(nodeId2, nodes);
859
+ },
860
+ componentElem(comp, nodeId2, params) {
861
+ return componentElem(comp, nodeId2, params);
862
+ }
863
+ };
864
+ }
865
+ function foldNode(node, cases) {
866
+ if (typeof node === "string") {
867
+ return cases.onText(node);
868
+ }
869
+ switch (node._type) {
870
+ case "Component":
871
+ return cases.onComponent(node);
872
+ case "View":
873
+ return cases.onView(node);
874
+ case "Element":
875
+ switch (node.tag) {
876
+ case "br":
877
+ case "hr":
878
+ case "img":
879
+ case "input":
880
+ case "svg/circle":
881
+ case "svg/ellipse":
882
+ case "svg/image":
883
+ case "svg/line":
884
+ case "svg/polyline":
885
+ case "svg/polygon":
886
+ case "svg/path":
887
+ case "svg/rect":
888
+ case "svg/use":
889
+ return cases.onVoidElement(node);
890
+ default:
891
+ return cases.onNonVoidElement(
892
+ node
893
+ );
894
+ }
895
+ }
896
+ }
897
+
898
+ export {
899
+ nodeId,
900
+ attr,
901
+ prop,
902
+ getId,
903
+ id,
904
+ typeAttr,
905
+ cssVars,
906
+ eventTypes,
907
+ preventDefault,
908
+ stopPropagation,
909
+ stopPropagationAndPreventDefault,
910
+ containerEventTypes,
911
+ component,
912
+ makeDom,
913
+ foldNode,
914
+ nodeGroup,
915
+ isNodeGroup
916
+ };