xote 6.3.0 → 7.0.0-beta.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.
- package/README.md +132 -33
- package/dist/RuntimeAttr.res-Cr5Qmz0i.js +1 -0
- package/dist/RuntimeAttr.res-DAZkL5CF.mjs +539 -0
- package/dist/RuntimeHydrationMarkers.res-C5-ieaOS.js +1 -0
- package/dist/RuntimeHydrationMarkers.res-DHikAvHr.mjs +6 -0
- package/dist/RuntimeJsxProp.res-A6N-qWoK.js +1 -0
- package/dist/RuntimeJsxProp.res-D3W5GXqT.mjs +64 -0
- package/dist/Stdlib_Array-1YCQzU_Y.mjs +22 -0
- package/dist/Stdlib_Array-BeBVUIuY.js +1 -0
- package/dist/View.res-C36--SJD.js +1 -0
- package/dist/View.res-SuqJrQPC.mjs +777 -0
- package/dist/client.cjs +1 -0
- package/dist/client.mjs +131 -0
- package/dist/hydration.cjs +1 -0
- package/dist/hydration.mjs +385 -0
- package/dist/mdx.cjs +1 -0
- package/dist/mdx.mjs +50 -0
- package/dist/router.cjs +1 -0
- package/dist/router.mjs +276 -0
- package/dist/ssr.cjs +17 -0
- package/dist/ssr.mjs +321 -0
- package/dist/xote.cjs +1 -17
- package/dist/xote.mjs +1450 -2459
- package/dist/xote.umd.js +1 -17
- package/package.json +42 -10
- package/rescript.json +2 -2
- package/src/Mdx.res +77 -0
- package/src/Mdx.res.mjs +93 -0
- package/src/Router.res +62 -8
- package/src/Router.res.mjs +60 -6
- package/src/RuntimeDom.res +7 -0
- package/src/RuntimeDom.res.mjs +8 -0
- package/src/RuntimeJsxProp.res +5 -8
- package/src/RuntimeJsxProp.res.mjs +9 -10
- package/src/RuntimeValue.res +35 -0
- package/src/RuntimeValue.res.mjs +67 -0
- package/src/SSRState.res +1 -4
- package/src/SSRState.res.mjs +4 -10
- package/src/View.res +233 -39
- package/src/View.res.mjs +309 -32
- package/src/XoteJSX.res +214 -0
- package/src/XoteJSX.res.mjs +63 -0
- package/src/jsx-dev-runtime.mjs +7 -0
- package/src/jsx-runtime.mjs +276 -0
- package/src/Node.res +0 -2
- package/src/Node.res.mjs +0 -82
- package/src/ReactiveProp.res +0 -2
- package/src/ReactiveProp.res.mjs +0 -19
package/src/View.res.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
+
import * as Core__Type from "@rescript/core/src/Core__Type.res.mjs";
|
|
4
|
+
import * as Core__Array from "@rescript/core/src/Core__Array.res.mjs";
|
|
3
5
|
import * as Effect$Xote from "./Effect.res.mjs";
|
|
4
6
|
import * as Signal$Xote from "./Signal.res.mjs";
|
|
5
7
|
import * as Stdlib_Dict from "@rescript/runtime/lib/es6/Stdlib_Dict.js";
|
|
@@ -8,6 +10,7 @@ import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
|
8
10
|
import * as RuntimeDom$Xote from "./RuntimeDom.res.mjs";
|
|
9
11
|
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
|
|
10
12
|
import * as RuntimeOwner$Xote from "./RuntimeOwner.res.mjs";
|
|
13
|
+
import * as RuntimeValue$Xote from "./RuntimeValue.res.mjs";
|
|
11
14
|
|
|
12
15
|
function $$static(key, value) {
|
|
13
16
|
return [
|
|
@@ -56,25 +59,37 @@ function disposeElement(el) {
|
|
|
56
59
|
if (owner !== undefined) {
|
|
57
60
|
RuntimeOwner$Xote.disposeOwner(owner);
|
|
58
61
|
}
|
|
59
|
-
|
|
60
|
-
childNodes.forEach(disposeElement);
|
|
62
|
+
RuntimeDom$Xote.childNodesToArray(el).forEach(disposeElement);
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
function shallowEqualIdentity(a, b) {
|
|
64
66
|
if (a === b) {
|
|
65
67
|
return true;
|
|
66
68
|
}
|
|
67
|
-
|
|
69
|
+
let match = Core__Type.Classify.classify(a);
|
|
70
|
+
let match$1 = Core__Type.Classify.classify(b);
|
|
71
|
+
if (typeof match !== "object") {
|
|
68
72
|
return false;
|
|
69
73
|
}
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
if (match.TAG !== "Object") {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
if (typeof match$1 !== "object") {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
if (match$1.TAG !== "Object") {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
let objB = match$1._0;
|
|
84
|
+
let objA = match._0;
|
|
85
|
+
let keysA = Object.keys(objA);
|
|
86
|
+
let keysB = Object.keys(objB);
|
|
72
87
|
if (keysA.length !== keysB.length) {
|
|
73
88
|
return false;
|
|
74
89
|
} else {
|
|
75
90
|
return keysA.every(key => {
|
|
76
|
-
let match =
|
|
77
|
-
let match$1 =
|
|
91
|
+
let match = objA[key];
|
|
92
|
+
let match$1 = objB[key];
|
|
78
93
|
if (match !== undefined && match$1 !== undefined) {
|
|
79
94
|
return Primitive_option.valFromOption(match) === Primitive_option.valFromOption(match$1);
|
|
80
95
|
} else {
|
|
@@ -91,22 +106,19 @@ function clearKeyedItems(keyedItems) {
|
|
|
91
106
|
}
|
|
92
107
|
|
|
93
108
|
function getKeyedChildren(children) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
109
|
+
if (children.length === 0) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
let keyedChildren = Core__Array.filterMap(children, child => {
|
|
113
|
+
if (child.TAG === "Keyed") {
|
|
114
|
+
return {
|
|
115
|
+
key: child.key,
|
|
116
|
+
identity: child.identity,
|
|
117
|
+
child: child.child
|
|
118
|
+
};
|
|
102
119
|
}
|
|
103
|
-
keyedChildren.push({
|
|
104
|
-
key: child.key,
|
|
105
|
-
identity: child.identity,
|
|
106
|
-
child: child.child
|
|
107
|
-
});
|
|
108
120
|
});
|
|
109
|
-
if (
|
|
121
|
+
if (keyedChildren.length === children.length) {
|
|
110
122
|
return keyedChildren;
|
|
111
123
|
}
|
|
112
124
|
}
|
|
@@ -302,8 +314,7 @@ function render(_node) {
|
|
|
302
314
|
reconcileKeyedChildren(keyedChildren, keyedItems, container);
|
|
303
315
|
} else {
|
|
304
316
|
clearKeyedItems(keyedItems);
|
|
305
|
-
|
|
306
|
-
childNodes.forEach(disposeElement);
|
|
317
|
+
RuntimeDom$Xote.childNodesToArray(container).forEach(disposeElement);
|
|
307
318
|
container.innerHTML = "";
|
|
308
319
|
children.forEach(child => {
|
|
309
320
|
let childEl = render(child);
|
|
@@ -502,6 +513,13 @@ function float(value) {
|
|
|
502
513
|
};
|
|
503
514
|
}
|
|
504
515
|
|
|
516
|
+
function bool(value) {
|
|
517
|
+
return {
|
|
518
|
+
TAG: "Text",
|
|
519
|
+
_0: value ? "true" : "false"
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
|
|
505
523
|
function fragment(children) {
|
|
506
524
|
return {
|
|
507
525
|
TAG: "Fragment",
|
|
@@ -516,6 +534,18 @@ function signalFragment(signal) {
|
|
|
516
534
|
};
|
|
517
535
|
}
|
|
518
536
|
|
|
537
|
+
function childrenToArray(child) {
|
|
538
|
+
if (child !== undefined) {
|
|
539
|
+
if (child.TAG === "Fragment") {
|
|
540
|
+
return child._0;
|
|
541
|
+
} else {
|
|
542
|
+
return [child];
|
|
543
|
+
}
|
|
544
|
+
} else {
|
|
545
|
+
return [];
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
|
|
519
549
|
function each(signal, renderItem) {
|
|
520
550
|
let nodesSignal = Computed$Xote.make(() => Signal$Xote.get(signal).map(renderItem), undefined, undefined);
|
|
521
551
|
return {
|
|
@@ -533,10 +563,151 @@ function eachWithKey(signal, keyFn, renderItem) {
|
|
|
533
563
|
};
|
|
534
564
|
}
|
|
535
565
|
|
|
566
|
+
function make(props) {
|
|
567
|
+
let match = props.each;
|
|
568
|
+
let match$1 = props.by;
|
|
569
|
+
if (match.TAG === "Reactive") {
|
|
570
|
+
let signal = match._0;
|
|
571
|
+
if (match$1 !== undefined) {
|
|
572
|
+
return {
|
|
573
|
+
TAG: "KeyedList",
|
|
574
|
+
signal: signal,
|
|
575
|
+
keyFn: match$1,
|
|
576
|
+
renderItem: props.render
|
|
577
|
+
};
|
|
578
|
+
} else {
|
|
579
|
+
return each(signal, props.render);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
let items = match._0;
|
|
583
|
+
if (match$1 !== undefined) {
|
|
584
|
+
return {
|
|
585
|
+
TAG: "Fragment",
|
|
586
|
+
_0: items.map(item => ({
|
|
587
|
+
TAG: "Keyed",
|
|
588
|
+
key: match$1(item),
|
|
589
|
+
identity: item,
|
|
590
|
+
child: props.render(item)
|
|
591
|
+
}))
|
|
592
|
+
};
|
|
593
|
+
} else {
|
|
594
|
+
return {
|
|
595
|
+
TAG: "Fragment",
|
|
596
|
+
_0: items.map(props.render)
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
let For = {
|
|
602
|
+
make: make
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
function make$1(props) {
|
|
606
|
+
let items = props.each;
|
|
607
|
+
if (items.TAG === "Reactive") {
|
|
608
|
+
return {
|
|
609
|
+
TAG: "KeyedList",
|
|
610
|
+
signal: items._0,
|
|
611
|
+
keyFn: props.by,
|
|
612
|
+
renderItem: props.render
|
|
613
|
+
};
|
|
614
|
+
} else {
|
|
615
|
+
return {
|
|
616
|
+
TAG: "Fragment",
|
|
617
|
+
_0: items._0.map(item => ({
|
|
618
|
+
TAG: "Keyed",
|
|
619
|
+
key: props.by(item),
|
|
620
|
+
identity: item,
|
|
621
|
+
child: props.render(item)
|
|
622
|
+
}))
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
let KeyedFor = {
|
|
628
|
+
make: make$1
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
function make$2(props) {
|
|
632
|
+
let signal = props.when_;
|
|
633
|
+
if (signal.TAG !== "Reactive") {
|
|
634
|
+
if (signal._0) {
|
|
635
|
+
return {
|
|
636
|
+
TAG: "Fragment",
|
|
637
|
+
_0: childrenToArray(props.children)
|
|
638
|
+
};
|
|
639
|
+
} else {
|
|
640
|
+
return {
|
|
641
|
+
TAG: "Fragment",
|
|
642
|
+
_0: childrenToArray(props.fallback)
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
let signal$1 = signal._0;
|
|
647
|
+
return {
|
|
648
|
+
TAG: "SignalFragment",
|
|
649
|
+
_0: Computed$Xote.make(() => {
|
|
650
|
+
if (Signal$Xote.get(signal$1)) {
|
|
651
|
+
return childrenToArray(props.children);
|
|
652
|
+
} else {
|
|
653
|
+
return childrenToArray(props.fallback);
|
|
654
|
+
}
|
|
655
|
+
}, undefined, undefined)
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
let Show = {
|
|
660
|
+
make: make$2
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
function renderValue(props, value) {
|
|
664
|
+
if (value !== undefined) {
|
|
665
|
+
return [props.render(Primitive_option.valFromOption(value))];
|
|
666
|
+
} else {
|
|
667
|
+
return childrenToArray(props.fallback);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
function make$3(props) {
|
|
672
|
+
let value = props.value;
|
|
673
|
+
if (value.TAG !== "Reactive") {
|
|
674
|
+
return {
|
|
675
|
+
TAG: "Fragment",
|
|
676
|
+
_0: renderValue(props, value._0)
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
let signal = value._0;
|
|
680
|
+
return {
|
|
681
|
+
TAG: "SignalFragment",
|
|
682
|
+
_0: Computed$Xote.make(() => renderValue(props, Signal$Xote.get(signal)), undefined, undefined)
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
let Maybe = {
|
|
687
|
+
renderValue: renderValue,
|
|
688
|
+
make: make$3
|
|
689
|
+
};
|
|
690
|
+
|
|
691
|
+
function make$4(props) {
|
|
692
|
+
let value = props.value;
|
|
693
|
+
if (value.TAG !== "Reactive") {
|
|
694
|
+
return props.render(value._0);
|
|
695
|
+
}
|
|
696
|
+
let signal = value._0;
|
|
697
|
+
return {
|
|
698
|
+
TAG: "SignalFragment",
|
|
699
|
+
_0: Computed$Xote.make(() => [props.render(Signal$Xote.get(signal))], undefined, undefined)
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
let Value = {
|
|
704
|
+
make: make$4
|
|
705
|
+
};
|
|
706
|
+
|
|
536
707
|
function element(tag, attrsOpt, eventsOpt, childrenOpt, param) {
|
|
537
|
-
let attrs = attrsOpt !== undefined ? attrsOpt : []
|
|
538
|
-
let events = eventsOpt !== undefined ? eventsOpt : []
|
|
539
|
-
let children = childrenOpt !== undefined ? childrenOpt : []
|
|
708
|
+
let attrs = attrsOpt !== undefined ? attrsOpt : [];
|
|
709
|
+
let events = eventsOpt !== undefined ? eventsOpt : [];
|
|
710
|
+
let children = childrenOpt !== undefined ? childrenOpt : [];
|
|
540
711
|
return {
|
|
541
712
|
TAG: "Element",
|
|
542
713
|
tag: tag,
|
|
@@ -568,25 +739,119 @@ function mountById(node, containerId) {
|
|
|
568
739
|
}
|
|
569
740
|
}
|
|
570
741
|
|
|
742
|
+
function valuePrimitive(value, stringify) {
|
|
743
|
+
if (RuntimeValue$Xote.isReactiveProp(value)) {
|
|
744
|
+
if (value.TAG !== "Reactive") {
|
|
745
|
+
return {
|
|
746
|
+
TAG: "Text",
|
|
747
|
+
_0: stringify(value._0)
|
|
748
|
+
};
|
|
749
|
+
}
|
|
750
|
+
let signal = value._0;
|
|
751
|
+
return {
|
|
752
|
+
TAG: "SignalText",
|
|
753
|
+
_0: Computed$Xote.make(() => stringify(Signal$Xote.get(signal)), undefined, undefined)
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
let match = Core__Type.Classify.classify(value);
|
|
757
|
+
if (typeof match !== "object") {
|
|
758
|
+
return {
|
|
759
|
+
TAG: "Text",
|
|
760
|
+
_0: ""
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
switch (match.TAG) {
|
|
764
|
+
case "Object" :
|
|
765
|
+
return {
|
|
766
|
+
TAG: "SignalText",
|
|
767
|
+
_0: Computed$Xote.make(() => stringify(Signal$Xote.get(value)), undefined, undefined)
|
|
768
|
+
};
|
|
769
|
+
case "Function" :
|
|
770
|
+
return signalText(() => stringify(value()));
|
|
771
|
+
default:
|
|
772
|
+
return {
|
|
773
|
+
TAG: "Text",
|
|
774
|
+
_0: stringify(value)
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
function renderValuePrimitiveProps(props, stringify) {
|
|
780
|
+
let match = RuntimeValue$Xote.getField(props, "children");
|
|
781
|
+
let match$1 = RuntimeValue$Xote.getField(props, "value");
|
|
782
|
+
if (match !== undefined) {
|
|
783
|
+
return valuePrimitive(Primitive_option.valFromOption(match), stringify);
|
|
784
|
+
} else if (match$1 !== undefined) {
|
|
785
|
+
return valuePrimitive(Primitive_option.valFromOption(match$1), stringify);
|
|
786
|
+
} else {
|
|
787
|
+
return {
|
|
788
|
+
TAG: "Text",
|
|
789
|
+
_0: ""
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
function make$5(props) {
|
|
795
|
+
return renderValuePrimitiveProps(props, value => value);
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
let Text = {
|
|
799
|
+
make: make$5
|
|
800
|
+
};
|
|
801
|
+
|
|
802
|
+
function make$6(props) {
|
|
803
|
+
return renderValuePrimitiveProps(props, value => value.toString());
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
let Int = {
|
|
807
|
+
make: make$6
|
|
808
|
+
};
|
|
809
|
+
|
|
810
|
+
function make$7(props) {
|
|
811
|
+
return renderValuePrimitiveProps(props, value => value.toString());
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
let Float = {
|
|
815
|
+
make: make$7
|
|
816
|
+
};
|
|
817
|
+
|
|
818
|
+
function toString(value) {
|
|
819
|
+
if (value) {
|
|
820
|
+
return "true";
|
|
821
|
+
} else {
|
|
822
|
+
return "false";
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
function make$8(props) {
|
|
827
|
+
return renderValuePrimitiveProps(props, toString);
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
let Bool = {
|
|
831
|
+
toString: toString,
|
|
832
|
+
make: make$8
|
|
833
|
+
};
|
|
834
|
+
|
|
571
835
|
let DOM;
|
|
572
836
|
|
|
573
837
|
let Reactivity;
|
|
574
838
|
|
|
839
|
+
let Core;
|
|
840
|
+
|
|
575
841
|
let attr = $$static;
|
|
576
842
|
|
|
577
843
|
let signalAttr = signal;
|
|
578
844
|
|
|
579
845
|
let computedAttr = computed;
|
|
580
846
|
|
|
581
|
-
let list = each;
|
|
582
|
-
|
|
583
|
-
let keyedList = eachWithKey;
|
|
584
|
-
|
|
585
847
|
let empty = $$null;
|
|
586
848
|
|
|
849
|
+
let isReactiveProp = RuntimeValue$Xote.isReactiveProp;
|
|
850
|
+
|
|
587
851
|
export {
|
|
588
852
|
DOM,
|
|
589
853
|
Reactivity,
|
|
854
|
+
Core,
|
|
590
855
|
Attributes,
|
|
591
856
|
attr,
|
|
592
857
|
signalAttr,
|
|
@@ -599,16 +864,28 @@ export {
|
|
|
599
864
|
signalFloat,
|
|
600
865
|
int,
|
|
601
866
|
float,
|
|
867
|
+
bool,
|
|
602
868
|
fragment,
|
|
603
869
|
signalFragment,
|
|
870
|
+
childrenToArray,
|
|
604
871
|
each,
|
|
605
|
-
list,
|
|
606
872
|
eachWithKey,
|
|
607
|
-
|
|
873
|
+
For,
|
|
874
|
+
KeyedFor,
|
|
875
|
+
Show,
|
|
876
|
+
Maybe,
|
|
877
|
+
Value,
|
|
608
878
|
element,
|
|
609
879
|
$$null,
|
|
610
880
|
empty,
|
|
611
881
|
mount,
|
|
612
882
|
mountById,
|
|
883
|
+
isReactiveProp,
|
|
884
|
+
valuePrimitive,
|
|
885
|
+
renderValuePrimitiveProps,
|
|
886
|
+
Text,
|
|
887
|
+
Int,
|
|
888
|
+
Float,
|
|
889
|
+
Bool,
|
|
613
890
|
}
|
|
614
891
|
/* RuntimeDom-Xote Not a pure module */
|
package/src/XoteJSX.res
CHANGED
|
@@ -90,6 +90,70 @@ module Elements = {
|
|
|
90
90
|
'autofocus,
|
|
91
91
|
'action,
|
|
92
92
|
'method,
|
|
93
|
+
/* SVG props */
|
|
94
|
+
'xmlns,
|
|
95
|
+
'xmlnsXlink,
|
|
96
|
+
'version,
|
|
97
|
+
'viewBox,
|
|
98
|
+
'preserveAspectRatio,
|
|
99
|
+
'd,
|
|
100
|
+
'pathLength,
|
|
101
|
+
'cx,
|
|
102
|
+
'cy,
|
|
103
|
+
'r,
|
|
104
|
+
'rx,
|
|
105
|
+
'ry,
|
|
106
|
+
'x,
|
|
107
|
+
'y,
|
|
108
|
+
'x1,
|
|
109
|
+
'y1,
|
|
110
|
+
'x2,
|
|
111
|
+
'y2,
|
|
112
|
+
'fx,
|
|
113
|
+
'fy,
|
|
114
|
+
'dx,
|
|
115
|
+
'dy,
|
|
116
|
+
'points,
|
|
117
|
+
'transform,
|
|
118
|
+
'transformOrigin,
|
|
119
|
+
'fill,
|
|
120
|
+
'fillOpacity,
|
|
121
|
+
'fillRule,
|
|
122
|
+
'stroke,
|
|
123
|
+
'strokeWidth,
|
|
124
|
+
'strokeLinecap,
|
|
125
|
+
'strokeLinejoin,
|
|
126
|
+
'strokeDasharray,
|
|
127
|
+
'strokeDashoffset,
|
|
128
|
+
'strokeOpacity,
|
|
129
|
+
'strokeMiterlimit,
|
|
130
|
+
'opacity,
|
|
131
|
+
'color,
|
|
132
|
+
'visibility,
|
|
133
|
+
'vectorEffect,
|
|
134
|
+
'pointerEvents,
|
|
135
|
+
'clipPath,
|
|
136
|
+
'clipRule,
|
|
137
|
+
'mask,
|
|
138
|
+
'filter,
|
|
139
|
+
'textAnchor,
|
|
140
|
+
'dominantBaseline,
|
|
141
|
+
'fontFamily,
|
|
142
|
+
'fontSize,
|
|
143
|
+
'fontWeight,
|
|
144
|
+
'letterSpacing,
|
|
145
|
+
'wordSpacing,
|
|
146
|
+
'textDecoration,
|
|
147
|
+
'offset,
|
|
148
|
+
'stopColor,
|
|
149
|
+
'stopOpacity,
|
|
150
|
+
'gradientUnits,
|
|
151
|
+
'gradientTransform,
|
|
152
|
+
'spreadMethod,
|
|
153
|
+
'markerStart,
|
|
154
|
+
'markerMid,
|
|
155
|
+
'markerEnd,
|
|
156
|
+
'xlinkHref,
|
|
93
157
|
> = {
|
|
94
158
|
/* Standard attributes - accept raw strings or Prop.t<string> */
|
|
95
159
|
id?: 'id,
|
|
@@ -143,6 +207,77 @@ module Elements = {
|
|
|
143
207
|
@as("aria-selected") ariaSelected?: 'ariaSelected,
|
|
144
208
|
/* Data attributes */
|
|
145
209
|
data?: Obj.t,
|
|
210
|
+
/* SVG attributes - root */
|
|
211
|
+
xmlns?: 'xmlns,
|
|
212
|
+
@as("xmlns:xlink") xmlnsXlink?: 'xmlnsXlink,
|
|
213
|
+
version?: 'version,
|
|
214
|
+
viewBox?: 'viewBox,
|
|
215
|
+
preserveAspectRatio?: 'preserveAspectRatio,
|
|
216
|
+
/* SVG attributes - path/shape geometry */
|
|
217
|
+
d?: 'd,
|
|
218
|
+
pathLength?: 'pathLength,
|
|
219
|
+
cx?: 'cx,
|
|
220
|
+
cy?: 'cy,
|
|
221
|
+
r?: 'r,
|
|
222
|
+
rx?: 'rx,
|
|
223
|
+
ry?: 'ry,
|
|
224
|
+
x?: 'x,
|
|
225
|
+
y?: 'y,
|
|
226
|
+
x1?: 'x1,
|
|
227
|
+
y1?: 'y1,
|
|
228
|
+
x2?: 'x2,
|
|
229
|
+
y2?: 'y2,
|
|
230
|
+
fx?: 'fx,
|
|
231
|
+
fy?: 'fy,
|
|
232
|
+
dx?: 'dx,
|
|
233
|
+
dy?: 'dy,
|
|
234
|
+
points?: 'points,
|
|
235
|
+
transform?: 'transform,
|
|
236
|
+
@as("transform-origin") transformOrigin?: 'transformOrigin,
|
|
237
|
+
/* SVG attributes - presentation */
|
|
238
|
+
fill?: 'fill,
|
|
239
|
+
@as("fill-opacity") fillOpacity?: 'fillOpacity,
|
|
240
|
+
@as("fill-rule") fillRule?: 'fillRule,
|
|
241
|
+
stroke?: 'stroke,
|
|
242
|
+
@as("stroke-width") strokeWidth?: 'strokeWidth,
|
|
243
|
+
@as("stroke-linecap") strokeLinecap?: 'strokeLinecap,
|
|
244
|
+
@as("stroke-linejoin") strokeLinejoin?: 'strokeLinejoin,
|
|
245
|
+
@as("stroke-dasharray") strokeDasharray?: 'strokeDasharray,
|
|
246
|
+
@as("stroke-dashoffset") strokeDashoffset?: 'strokeDashoffset,
|
|
247
|
+
@as("stroke-opacity") strokeOpacity?: 'strokeOpacity,
|
|
248
|
+
@as("stroke-miterlimit") strokeMiterlimit?: 'strokeMiterlimit,
|
|
249
|
+
opacity?: 'opacity,
|
|
250
|
+
color?: 'color,
|
|
251
|
+
visibility?: 'visibility,
|
|
252
|
+
@as("vector-effect") vectorEffect?: 'vectorEffect,
|
|
253
|
+
@as("pointer-events") pointerEvents?: 'pointerEvents,
|
|
254
|
+
/* SVG attributes - clipping/masking/filter */
|
|
255
|
+
@as("clip-path") clipPath?: 'clipPath,
|
|
256
|
+
@as("clip-rule") clipRule?: 'clipRule,
|
|
257
|
+
mask?: 'mask,
|
|
258
|
+
filter?: 'filter,
|
|
259
|
+
/* SVG attributes - text */
|
|
260
|
+
@as("text-anchor") textAnchor?: 'textAnchor,
|
|
261
|
+
@as("dominant-baseline") dominantBaseline?: 'dominantBaseline,
|
|
262
|
+
@as("font-family") fontFamily?: 'fontFamily,
|
|
263
|
+
@as("font-size") fontSize?: 'fontSize,
|
|
264
|
+
@as("font-weight") fontWeight?: 'fontWeight,
|
|
265
|
+
@as("letter-spacing") letterSpacing?: 'letterSpacing,
|
|
266
|
+
@as("word-spacing") wordSpacing?: 'wordSpacing,
|
|
267
|
+
@as("text-decoration") textDecoration?: 'textDecoration,
|
|
268
|
+
/* SVG attributes - gradient/stop */
|
|
269
|
+
offset?: 'offset,
|
|
270
|
+
@as("stop-color") stopColor?: 'stopColor,
|
|
271
|
+
@as("stop-opacity") stopOpacity?: 'stopOpacity,
|
|
272
|
+
gradientUnits?: 'gradientUnits,
|
|
273
|
+
gradientTransform?: 'gradientTransform,
|
|
274
|
+
spreadMethod?: 'spreadMethod,
|
|
275
|
+
/* SVG attributes - markers */
|
|
276
|
+
@as("marker-start") markerStart?: 'markerStart,
|
|
277
|
+
@as("marker-mid") markerMid?: 'markerMid,
|
|
278
|
+
@as("marker-end") markerEnd?: 'markerEnd,
|
|
279
|
+
/* SVG attributes - xlink (legacy) */
|
|
280
|
+
@as("xlink:href") xlinkHref?: 'xlinkHref,
|
|
146
281
|
/* Event handlers */
|
|
147
282
|
onClick?: Dom.event => unit,
|
|
148
283
|
onInput?: Dom.event => unit,
|
|
@@ -258,6 +393,85 @@ module Elements = {
|
|
|
258
393
|
addAttr(attrs, props.ariaExpanded, "aria-expanded", RuntimeJsxProp.toBoolAttr)
|
|
259
394
|
addAttr(attrs, props.ariaSelected, "aria-selected", RuntimeJsxProp.toBoolAttr)
|
|
260
395
|
|
|
396
|
+
/* SVG attributes - root */
|
|
397
|
+
addAttr(attrs, props.xmlns, "xmlns", RuntimeJsxProp.toStringAttr)
|
|
398
|
+
addAttr(attrs, props.xmlnsXlink, "xmlns:xlink", RuntimeJsxProp.toStringAttr)
|
|
399
|
+
addAttr(attrs, props.version, "version", RuntimeJsxProp.toStringAttr)
|
|
400
|
+
addAttr(attrs, props.viewBox, "viewBox", RuntimeJsxProp.toStringAttr)
|
|
401
|
+
addAttr(attrs, props.preserveAspectRatio, "preserveAspectRatio", RuntimeJsxProp.toStringAttr)
|
|
402
|
+
|
|
403
|
+
/* SVG attributes - geometry */
|
|
404
|
+
addAttr(attrs, props.d, "d", RuntimeJsxProp.toStringAttr)
|
|
405
|
+
addAttr(attrs, props.pathLength, "pathLength", RuntimeJsxProp.toStringAttr)
|
|
406
|
+
addAttr(attrs, props.cx, "cx", RuntimeJsxProp.toStringAttr)
|
|
407
|
+
addAttr(attrs, props.cy, "cy", RuntimeJsxProp.toStringAttr)
|
|
408
|
+
addAttr(attrs, props.r, "r", RuntimeJsxProp.toStringAttr)
|
|
409
|
+
addAttr(attrs, props.rx, "rx", RuntimeJsxProp.toStringAttr)
|
|
410
|
+
addAttr(attrs, props.ry, "ry", RuntimeJsxProp.toStringAttr)
|
|
411
|
+
addAttr(attrs, props.x, "x", RuntimeJsxProp.toStringAttr)
|
|
412
|
+
addAttr(attrs, props.y, "y", RuntimeJsxProp.toStringAttr)
|
|
413
|
+
addAttr(attrs, props.x1, "x1", RuntimeJsxProp.toStringAttr)
|
|
414
|
+
addAttr(attrs, props.y1, "y1", RuntimeJsxProp.toStringAttr)
|
|
415
|
+
addAttr(attrs, props.x2, "x2", RuntimeJsxProp.toStringAttr)
|
|
416
|
+
addAttr(attrs, props.y2, "y2", RuntimeJsxProp.toStringAttr)
|
|
417
|
+
addAttr(attrs, props.fx, "fx", RuntimeJsxProp.toStringAttr)
|
|
418
|
+
addAttr(attrs, props.fy, "fy", RuntimeJsxProp.toStringAttr)
|
|
419
|
+
addAttr(attrs, props.dx, "dx", RuntimeJsxProp.toStringAttr)
|
|
420
|
+
addAttr(attrs, props.dy, "dy", RuntimeJsxProp.toStringAttr)
|
|
421
|
+
addAttr(attrs, props.points, "points", RuntimeJsxProp.toStringAttr)
|
|
422
|
+
addAttr(attrs, props.transform, "transform", RuntimeJsxProp.toStringAttr)
|
|
423
|
+
addAttr(attrs, props.transformOrigin, "transform-origin", RuntimeJsxProp.toStringAttr)
|
|
424
|
+
|
|
425
|
+
/* SVG attributes - presentation */
|
|
426
|
+
addAttr(attrs, props.fill, "fill", RuntimeJsxProp.toStringAttr)
|
|
427
|
+
addAttr(attrs, props.fillOpacity, "fill-opacity", RuntimeJsxProp.toStringAttr)
|
|
428
|
+
addAttr(attrs, props.fillRule, "fill-rule", RuntimeJsxProp.toStringAttr)
|
|
429
|
+
addAttr(attrs, props.stroke, "stroke", RuntimeJsxProp.toStringAttr)
|
|
430
|
+
addAttr(attrs, props.strokeWidth, "stroke-width", RuntimeJsxProp.toStringAttr)
|
|
431
|
+
addAttr(attrs, props.strokeLinecap, "stroke-linecap", RuntimeJsxProp.toStringAttr)
|
|
432
|
+
addAttr(attrs, props.strokeLinejoin, "stroke-linejoin", RuntimeJsxProp.toStringAttr)
|
|
433
|
+
addAttr(attrs, props.strokeDasharray, "stroke-dasharray", RuntimeJsxProp.toStringAttr)
|
|
434
|
+
addAttr(attrs, props.strokeDashoffset, "stroke-dashoffset", RuntimeJsxProp.toStringAttr)
|
|
435
|
+
addAttr(attrs, props.strokeOpacity, "stroke-opacity", RuntimeJsxProp.toStringAttr)
|
|
436
|
+
addAttr(attrs, props.strokeMiterlimit, "stroke-miterlimit", RuntimeJsxProp.toStringAttr)
|
|
437
|
+
addAttr(attrs, props.opacity, "opacity", RuntimeJsxProp.toStringAttr)
|
|
438
|
+
addAttr(attrs, props.color, "color", RuntimeJsxProp.toStringAttr)
|
|
439
|
+
addAttr(attrs, props.visibility, "visibility", RuntimeJsxProp.toStringAttr)
|
|
440
|
+
addAttr(attrs, props.vectorEffect, "vector-effect", RuntimeJsxProp.toStringAttr)
|
|
441
|
+
addAttr(attrs, props.pointerEvents, "pointer-events", RuntimeJsxProp.toStringAttr)
|
|
442
|
+
|
|
443
|
+
/* SVG attributes - clipping/masking/filter */
|
|
444
|
+
addAttr(attrs, props.clipPath, "clip-path", RuntimeJsxProp.toStringAttr)
|
|
445
|
+
addAttr(attrs, props.clipRule, "clip-rule", RuntimeJsxProp.toStringAttr)
|
|
446
|
+
addAttr(attrs, props.mask, "mask", RuntimeJsxProp.toStringAttr)
|
|
447
|
+
addAttr(attrs, props.filter, "filter", RuntimeJsxProp.toStringAttr)
|
|
448
|
+
|
|
449
|
+
/* SVG attributes - text */
|
|
450
|
+
addAttr(attrs, props.textAnchor, "text-anchor", RuntimeJsxProp.toStringAttr)
|
|
451
|
+
addAttr(attrs, props.dominantBaseline, "dominant-baseline", RuntimeJsxProp.toStringAttr)
|
|
452
|
+
addAttr(attrs, props.fontFamily, "font-family", RuntimeJsxProp.toStringAttr)
|
|
453
|
+
addAttr(attrs, props.fontSize, "font-size", RuntimeJsxProp.toStringAttr)
|
|
454
|
+
addAttr(attrs, props.fontWeight, "font-weight", RuntimeJsxProp.toStringAttr)
|
|
455
|
+
addAttr(attrs, props.letterSpacing, "letter-spacing", RuntimeJsxProp.toStringAttr)
|
|
456
|
+
addAttr(attrs, props.wordSpacing, "word-spacing", RuntimeJsxProp.toStringAttr)
|
|
457
|
+
addAttr(attrs, props.textDecoration, "text-decoration", RuntimeJsxProp.toStringAttr)
|
|
458
|
+
|
|
459
|
+
/* SVG attributes - gradient/stop */
|
|
460
|
+
addAttr(attrs, props.offset, "offset", RuntimeJsxProp.toStringAttr)
|
|
461
|
+
addAttr(attrs, props.stopColor, "stop-color", RuntimeJsxProp.toStringAttr)
|
|
462
|
+
addAttr(attrs, props.stopOpacity, "stop-opacity", RuntimeJsxProp.toStringAttr)
|
|
463
|
+
addAttr(attrs, props.gradientUnits, "gradientUnits", RuntimeJsxProp.toStringAttr)
|
|
464
|
+
addAttr(attrs, props.gradientTransform, "gradientTransform", RuntimeJsxProp.toStringAttr)
|
|
465
|
+
addAttr(attrs, props.spreadMethod, "spreadMethod", RuntimeJsxProp.toStringAttr)
|
|
466
|
+
|
|
467
|
+
/* SVG attributes - markers */
|
|
468
|
+
addAttr(attrs, props.markerStart, "marker-start", RuntimeJsxProp.toStringAttr)
|
|
469
|
+
addAttr(attrs, props.markerMid, "marker-mid", RuntimeJsxProp.toStringAttr)
|
|
470
|
+
addAttr(attrs, props.markerEnd, "marker-end", RuntimeJsxProp.toStringAttr)
|
|
471
|
+
|
|
472
|
+
/* SVG attributes - xlink (legacy) */
|
|
473
|
+
addAttr(attrs, props.xlinkHref, "xlink:href", RuntimeJsxProp.toStringAttr)
|
|
474
|
+
|
|
261
475
|
/* Data attributes */
|
|
262
476
|
switch props.data {
|
|
263
477
|
| Some(dataObj) => {
|