xote 4.4.0 → 4.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
+ import * as Signals from "rescript-signals/src/Signals.res.mjs";
3
4
  import * as Core__Option from "@rescript/core/src/Core__Option.res.mjs";
4
5
  import * as Xote__Component from "./Xote__Component.res.mjs";
5
6
  import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
@@ -53,6 +54,29 @@ function convertAttrValue(key, value) {
53
54
  }
54
55
  }
55
56
 
57
+ function convertBoolAttrValue(key, value) {
58
+ if (typeof value === "function") {
59
+ return Xote__Component.computedAttr(key, () => {
60
+ if (value()) {
61
+ return "true";
62
+ } else {
63
+ return "false";
64
+ }
65
+ });
66
+ }
67
+ if (!(typeof value === "object" && Core__Option.isSome(value.id))) {
68
+ return Xote__Component.attr(key, value ? "true" : "false");
69
+ }
70
+ let strSignal = Signals.Computed.make(() => {
71
+ if (Signals.Signal.get(value)) {
72
+ return "true";
73
+ } else {
74
+ return "false";
75
+ }
76
+ }, undefined);
77
+ return Xote__Component.signalAttr(key, strSignal);
78
+ }
79
+
56
80
  function propsToAttrs(props) {
57
81
  let attrs = [];
58
82
  let v = props.id;
@@ -83,129 +107,117 @@ function propsToAttrs(props) {
83
107
  if (v$6 !== undefined) {
84
108
  attrs.push(convertAttrValue("placeholder", Primitive_option.valFromOption(v$6)));
85
109
  }
86
- let match = props.disabled;
87
- if (match !== undefined && match) {
88
- attrs.push(Xote__Component.attr("disabled", "true"));
89
- }
90
- let match$1 = props.checked;
91
- if (match$1 !== undefined && match$1) {
92
- attrs.push(Xote__Component.attr("checked", "true"));
93
- }
94
- let match$2 = props.required;
95
- if (match$2 !== undefined && match$2) {
96
- attrs.push(Xote__Component.attr("required", "true"));
97
- }
98
- let match$3 = props.readOnly;
99
- if (match$3 !== undefined && match$3) {
100
- attrs.push(Xote__Component.attr("readonly", "true"));
101
- }
102
- let v$7 = props.maxLength;
110
+ let v$7 = props.disabled;
103
111
  if (v$7 !== undefined) {
104
- attrs.push(Xote__Component.attr("maxlength", v$7.toString()));
112
+ attrs.push(convertBoolAttrValue("disabled", Primitive_option.valFromOption(v$7)));
105
113
  }
106
- let v$8 = props.minLength;
114
+ let v$8 = props.checked;
107
115
  if (v$8 !== undefined) {
108
- attrs.push(Xote__Component.attr("minlength", v$8.toString()));
116
+ attrs.push(convertBoolAttrValue("checked", Primitive_option.valFromOption(v$8)));
109
117
  }
110
- let v$9 = props.min;
118
+ let v$9 = props.required;
111
119
  if (v$9 !== undefined) {
112
- attrs.push(convertAttrValue("min", Primitive_option.valFromOption(v$9)));
120
+ attrs.push(convertBoolAttrValue("required", Primitive_option.valFromOption(v$9)));
113
121
  }
114
- let v$10 = props.max;
122
+ let v$10 = props.readOnly;
115
123
  if (v$10 !== undefined) {
116
- attrs.push(convertAttrValue("max", Primitive_option.valFromOption(v$10)));
124
+ attrs.push(convertBoolAttrValue("readonly", Primitive_option.valFromOption(v$10)));
117
125
  }
118
- let v$11 = props.step;
126
+ let v$11 = props.maxLength;
119
127
  if (v$11 !== undefined) {
120
- attrs.push(convertAttrValue("step", Primitive_option.valFromOption(v$11)));
128
+ attrs.push(Xote__Component.attr("maxlength", v$11.toString()));
121
129
  }
122
- let v$12 = props.pattern;
130
+ let v$12 = props.minLength;
123
131
  if (v$12 !== undefined) {
124
- attrs.push(convertAttrValue("pattern", Primitive_option.valFromOption(v$12)));
132
+ attrs.push(Xote__Component.attr("minlength", v$12.toString()));
125
133
  }
126
- let v$13 = props.autoComplete;
134
+ let v$13 = props.min;
127
135
  if (v$13 !== undefined) {
128
- attrs.push(convertAttrValue("autocomplete", Primitive_option.valFromOption(v$13)));
136
+ attrs.push(convertAttrValue("min", Primitive_option.valFromOption(v$13)));
129
137
  }
130
- let match$4 = props.multiple;
131
- if (match$4 !== undefined && match$4) {
132
- attrs.push(Xote__Component.attr("multiple", "true"));
133
- }
134
- let v$14 = props.accept;
138
+ let v$14 = props.max;
135
139
  if (v$14 !== undefined) {
136
- attrs.push(convertAttrValue("accept", Primitive_option.valFromOption(v$14)));
140
+ attrs.push(convertAttrValue("max", Primitive_option.valFromOption(v$14)));
137
141
  }
138
- let v$15 = props.rows;
142
+ let v$15 = props.step;
139
143
  if (v$15 !== undefined) {
140
- attrs.push(Xote__Component.attr("rows", v$15.toString()));
144
+ attrs.push(convertAttrValue("step", Primitive_option.valFromOption(v$15)));
141
145
  }
142
- let v$16 = props.cols;
146
+ let v$16 = props.pattern;
143
147
  if (v$16 !== undefined) {
144
- attrs.push(Xote__Component.attr("cols", v$16.toString()));
148
+ attrs.push(convertAttrValue("pattern", Primitive_option.valFromOption(v$16)));
145
149
  }
146
- let v$17 = props.for;
150
+ let v$17 = props.autoComplete;
147
151
  if (v$17 !== undefined) {
148
- attrs.push(convertAttrValue("for", Primitive_option.valFromOption(v$17)));
152
+ attrs.push(convertAttrValue("autocomplete", Primitive_option.valFromOption(v$17)));
149
153
  }
150
- let v$18 = props.href;
154
+ let v$18 = props.multiple;
151
155
  if (v$18 !== undefined) {
152
- attrs.push(convertAttrValue("href", Primitive_option.valFromOption(v$18)));
156
+ attrs.push(convertBoolAttrValue("multiple", Primitive_option.valFromOption(v$18)));
153
157
  }
154
- let v$19 = props.target;
158
+ let v$19 = props.accept;
155
159
  if (v$19 !== undefined) {
156
- attrs.push(convertAttrValue("target", Primitive_option.valFromOption(v$19)));
160
+ attrs.push(convertAttrValue("accept", Primitive_option.valFromOption(v$19)));
157
161
  }
158
- let v$20 = props.src;
162
+ let v$20 = props.rows;
159
163
  if (v$20 !== undefined) {
160
- attrs.push(convertAttrValue("src", Primitive_option.valFromOption(v$20)));
164
+ attrs.push(Xote__Component.attr("rows", v$20.toString()));
161
165
  }
162
- let v$21 = props.alt;
166
+ let v$21 = props.cols;
163
167
  if (v$21 !== undefined) {
164
- attrs.push(convertAttrValue("alt", Primitive_option.valFromOption(v$21)));
168
+ attrs.push(Xote__Component.attr("cols", v$21.toString()));
165
169
  }
166
- let v$22 = props.width;
170
+ let v$22 = props.for;
167
171
  if (v$22 !== undefined) {
168
- attrs.push(convertAttrValue("width", Primitive_option.valFromOption(v$22)));
172
+ attrs.push(convertAttrValue("for", Primitive_option.valFromOption(v$22)));
169
173
  }
170
- let v$23 = props.height;
174
+ let v$23 = props.href;
171
175
  if (v$23 !== undefined) {
172
- attrs.push(convertAttrValue("height", Primitive_option.valFromOption(v$23)));
176
+ attrs.push(convertAttrValue("href", Primitive_option.valFromOption(v$23)));
173
177
  }
174
- let v$24 = props.role;
178
+ let v$24 = props.target;
175
179
  if (v$24 !== undefined) {
176
- attrs.push(convertAttrValue("role", Primitive_option.valFromOption(v$24)));
180
+ attrs.push(convertAttrValue("target", Primitive_option.valFromOption(v$24)));
177
181
  }
178
- let v$25 = props.tabIndex;
182
+ let v$25 = props.src;
179
183
  if (v$25 !== undefined) {
180
- attrs.push(Xote__Component.attr("tabindex", v$25.toString()));
184
+ attrs.push(convertAttrValue("src", Primitive_option.valFromOption(v$25)));
181
185
  }
182
- let v$26 = props["aria-label"];
186
+ let v$26 = props.alt;
183
187
  if (v$26 !== undefined) {
184
- attrs.push(convertAttrValue("aria-label", Primitive_option.valFromOption(v$26)));
188
+ attrs.push(convertAttrValue("alt", Primitive_option.valFromOption(v$26)));
185
189
  }
186
- let match$5 = props["aria-hidden"];
187
- if (match$5 !== undefined) {
188
- if (match$5) {
189
- attrs.push(Xote__Component.attr("aria-hidden", "true"));
190
- } else {
191
- attrs.push(Xote__Component.attr("aria-hidden", "false"));
192
- }
190
+ let v$27 = props.width;
191
+ if (v$27 !== undefined) {
192
+ attrs.push(convertAttrValue("width", Primitive_option.valFromOption(v$27)));
193
193
  }
194
- let match$6 = props["aria-expanded"];
195
- if (match$6 !== undefined) {
196
- if (match$6) {
197
- attrs.push(Xote__Component.attr("aria-expanded", "true"));
198
- } else {
199
- attrs.push(Xote__Component.attr("aria-expanded", "false"));
200
- }
194
+ let v$28 = props.height;
195
+ if (v$28 !== undefined) {
196
+ attrs.push(convertAttrValue("height", Primitive_option.valFromOption(v$28)));
201
197
  }
202
- let match$7 = props["aria-selected"];
203
- if (match$7 !== undefined) {
204
- if (match$7) {
205
- attrs.push(Xote__Component.attr("aria-selected", "true"));
206
- } else {
207
- attrs.push(Xote__Component.attr("aria-selected", "false"));
208
- }
198
+ let v$29 = props.role;
199
+ if (v$29 !== undefined) {
200
+ attrs.push(convertAttrValue("role", Primitive_option.valFromOption(v$29)));
201
+ }
202
+ let v$30 = props.tabIndex;
203
+ if (v$30 !== undefined) {
204
+ attrs.push(Xote__Component.attr("tabindex", v$30.toString()));
205
+ }
206
+ let v$31 = props["aria-label"];
207
+ if (v$31 !== undefined) {
208
+ attrs.push(convertAttrValue("aria-label", Primitive_option.valFromOption(v$31)));
209
+ }
210
+ let v$32 = props["aria-hidden"];
211
+ if (v$32 !== undefined) {
212
+ attrs.push(convertBoolAttrValue("aria-hidden", Primitive_option.valFromOption(v$32)));
213
+ }
214
+ let v$33 = props["aria-expanded"];
215
+ if (v$33 !== undefined) {
216
+ attrs.push(convertBoolAttrValue("aria-expanded", Primitive_option.valFromOption(v$33)));
217
+ }
218
+ let v$34 = props["aria-selected"];
219
+ if (v$34 !== undefined) {
220
+ attrs.push(convertBoolAttrValue("aria-selected", Primitive_option.valFromOption(v$34)));
209
221
  }
210
222
  let _dataObj = props.data;
211
223
  if (_dataObj !== undefined) {
@@ -330,6 +342,7 @@ let Elements = {
330
342
  signal: signal,
331
343
  computed: computed,
332
344
  convertAttrValue: convertAttrValue,
345
+ convertBoolAttrValue: convertBoolAttrValue,
333
346
  propsToAttrs: propsToAttrs,
334
347
  propsToEvents: propsToEvents,
335
348
  getChildren: getChildren,
@@ -353,4 +366,4 @@ export {
353
366
  $$null,
354
367
  Elements,
355
368
  }
356
- /* Xote__Component Not a pure module */
369
+ /* Signals Not a pure module */