xote 6.1.2 → 6.2.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/README.md +90 -10
- package/dist/xote.cjs +10 -10
- package/dist/xote.mjs +1491 -1330
- package/dist/xote.umd.js +8 -8
- package/package.json +16 -1
- package/rescript.json +2 -0
- package/src/Html.res +13 -13
- package/src/Html.res.mjs +13 -13
- package/src/Hydration.res +134 -79
- package/src/Hydration.res.mjs +255 -186
- package/src/Node.res +2 -594
- package/src/Node.res.mjs +31 -535
- package/src/Prop.res +16 -0
- package/src/Prop.res.mjs +35 -0
- package/src/ReactiveProp.res +2 -14
- package/src/ReactiveProp.res.mjs +7 -20
- package/src/Route.res +4 -0
- package/src/Route.res.mjs +9 -0
- package/src/Router.res +25 -49
- package/src/Router.res.mjs +22 -34
- package/src/RuntimeAttr.res +21 -0
- package/src/RuntimeAttr.res.mjs +42 -0
- package/src/RuntimeDom.res +95 -0
- package/src/RuntimeDom.res.mjs +101 -0
- package/src/RuntimeHtml.res +27 -0
- package/src/RuntimeHtml.res.mjs +34 -0
- package/src/RuntimeHydrationMarkers.res +24 -0
- package/src/RuntimeHydrationMarkers.res.mjs +68 -0
- package/src/RuntimeJsxProp.res +46 -0
- package/src/RuntimeJsxProp.res.mjs +52 -0
- package/src/RuntimeOwner.res +43 -0
- package/src/RuntimeOwner.res.mjs +51 -0
- package/src/SSR.res +25 -93
- package/src/SSR.res.mjs +59 -126
- package/src/SSRState.res +3 -0
- package/src/SSRState.res.mjs +8 -2
- package/src/View.res +599 -0
- package/src/View.res.mjs +614 -0
- package/src/XoteJSX.res +64 -118
- package/src/XoteJSX.res.mjs +79 -118
package/src/XoteJSX.res
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
module
|
|
1
|
+
module Prop = Prop
|
|
2
2
|
|
|
3
3
|
/* ReScript JSX transform type aliases */
|
|
4
|
-
type element =
|
|
4
|
+
type element = View.node
|
|
5
5
|
|
|
6
6
|
type component<'props> = 'props => element
|
|
7
7
|
|
|
@@ -11,7 +11,7 @@ type componentLike<'props, 'return> = 'props => 'return
|
|
|
11
11
|
* This ensures component functions (which may create effects/computeds) are not
|
|
12
12
|
* evaluated during a Computed context, which would incorrectly track their
|
|
13
13
|
* dependencies as belonging to the outer computed. */
|
|
14
|
-
let jsx = (component: component<'props>, props: 'props): element =>
|
|
14
|
+
let jsx = (component: component<'props>, props: 'props): element => View.LazyComponent(
|
|
15
15
|
() => component(props),
|
|
16
16
|
)
|
|
17
17
|
|
|
@@ -23,8 +23,10 @@ let jsxKeyed = (
|
|
|
23
23
|
~key: option<string>=?,
|
|
24
24
|
_: unit,
|
|
25
25
|
): element => {
|
|
26
|
-
|
|
27
|
-
jsx(component, props)
|
|
26
|
+
switch key {
|
|
27
|
+
| Some(key) => View.Keyed({key, identity: Obj.magic(props), child: jsx(component, props)})
|
|
28
|
+
| None => jsx(component, props)
|
|
29
|
+
}
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
let jsxsKeyed = jsxKeyed
|
|
@@ -35,19 +37,19 @@ type fragmentProps = {children?: element}
|
|
|
35
37
|
let jsxFragment = (props: fragmentProps): element => {
|
|
36
38
|
switch props.children {
|
|
37
39
|
| Some(child) => child
|
|
38
|
-
| None =>
|
|
40
|
+
| None => View.fragment([])
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/* Element converters for JSX expressions */
|
|
43
|
-
let array = (children: array<element>): element =>
|
|
45
|
+
let array = (children: array<element>): element => View.fragment(children)
|
|
44
46
|
|
|
45
|
-
let null = (): element =>
|
|
47
|
+
let null = (): element => View.text("")
|
|
46
48
|
|
|
47
49
|
/* Elements module for lowercase HTML tags */
|
|
48
50
|
module Elements = {
|
|
49
|
-
/* Props type for HTML elements - accepts both raw values and
|
|
50
|
-
* This allows ergonomic JSX like class="foo" while also supporting class={
|
|
51
|
+
/* Props type for HTML elements - accepts both raw values and Prop.t for flexibility
|
|
52
|
+
* This allows ergonomic JSX like class="foo" while also supporting class={Prop.reactive(signal)}
|
|
51
53
|
*/
|
|
52
54
|
type props<
|
|
53
55
|
'id,
|
|
@@ -89,7 +91,7 @@ module Elements = {
|
|
|
89
91
|
'action,
|
|
90
92
|
'method,
|
|
91
93
|
> = {
|
|
92
|
-
/* Standard attributes - accept raw strings or
|
|
94
|
+
/* Standard attributes - accept raw strings or Prop.t<string> */
|
|
93
95
|
id?: 'id,
|
|
94
96
|
class?: 'class,
|
|
95
97
|
style?: 'style,
|
|
@@ -168,64 +170,6 @@ module Elements = {
|
|
|
168
170
|
children?: element,
|
|
169
171
|
}
|
|
170
172
|
|
|
171
|
-
/* Helper to detect if a value is a ReactiveProp variant (checks for Static/Reactive tags) */
|
|
172
|
-
let isReactiveProp = (value: 'a): bool => {
|
|
173
|
-
ignore(value)
|
|
174
|
-
%raw(`value && typeof value === 'object' && ('TAG' in value) && (value.TAG === 'Static' || value.TAG === 'Reactive')`)
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/* Helper to convert string attribute value (supports raw string, ReactiveProp, Signal, or computed function) */
|
|
178
|
-
let convertAttrValue = (key: string, value: 'a): (string, Node.attrValue) => {
|
|
179
|
-
if isReactiveProp(value) {
|
|
180
|
-
// It's a ReactiveProp variant - pattern match on it
|
|
181
|
-
let rp: ReactiveProp.t<string> = Obj.magic(value)
|
|
182
|
-
switch rp {
|
|
183
|
-
| Static(s) => Node.attr(key, s)
|
|
184
|
-
| Reactive(signal) => Node.signalAttr(key, signal)
|
|
185
|
-
}
|
|
186
|
-
} else if typeof(value) == #function {
|
|
187
|
-
// It's a computed function (for backward compatibility)
|
|
188
|
-
let f: unit => string = Obj.magic(value)
|
|
189
|
-
Node.computedAttr(key, f)
|
|
190
|
-
} else if typeof(value) == #object {
|
|
191
|
-
// It's a raw signal (for backward compatibility)
|
|
192
|
-
let sig: Signal.t<string> = Obj.magic(value)
|
|
193
|
-
Node.signalAttr(key, sig)
|
|
194
|
-
} else {
|
|
195
|
-
// It's a raw string
|
|
196
|
-
let s: string = Obj.magic(value)
|
|
197
|
-
Node.attr(key, s)
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/* Helper to convert boolean attribute value (supports raw bool, ReactiveProp, Signal, or computed function) */
|
|
202
|
-
let convertBoolAttrValue = (key: string, value: 'a): (string, Node.attrValue) => {
|
|
203
|
-
if isReactiveProp(value) {
|
|
204
|
-
// It's a ReactiveProp variant - pattern match on it
|
|
205
|
-
let rp: ReactiveProp.t<bool> = Obj.magic(value)
|
|
206
|
-
switch rp {
|
|
207
|
-
| Static(b) => Node.attr(key, b ? "true" : "false")
|
|
208
|
-
| Reactive(signal) => {
|
|
209
|
-
let strSignal = Computed.make(() => Signal.get(signal) ? "true" : "false")
|
|
210
|
-
Node.signalAttr(key, strSignal)
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
} else if typeof(value) == #function {
|
|
214
|
-
// It's a computed function that returns bool (for backward compatibility)
|
|
215
|
-
let f: unit => bool = Obj.magic(value)
|
|
216
|
-
Node.computedAttr(key, () => f() ? "true" : "false")
|
|
217
|
-
} else if typeof(value) == #object {
|
|
218
|
-
// It's a raw signal (for backward compatibility)
|
|
219
|
-
let sig: Signal.t<bool> = Obj.magic(value)
|
|
220
|
-
let strSignal = Computed.make(() => Signal.get(sig) ? "true" : "false")
|
|
221
|
-
Node.signalAttr(key, strSignal)
|
|
222
|
-
} else {
|
|
223
|
-
// It's a raw bool
|
|
224
|
-
let b: bool = Obj.magic(value)
|
|
225
|
-
Node.attr(key, b ? "true" : "false")
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
173
|
/* Helper to add optional attribute to attrs array */
|
|
230
174
|
let addAttr = (attrs, opt, key, converter) => {
|
|
231
175
|
switch opt {
|
|
@@ -237,80 +181,80 @@ module Elements = {
|
|
|
237
181
|
/* Helper to add optional int attribute */
|
|
238
182
|
let addIntAttr = (attrs, opt, key) => {
|
|
239
183
|
switch opt {
|
|
240
|
-
| Some(v) => attrs->Array.push(
|
|
184
|
+
| Some(v) => attrs->Array.push(View.attr(key, Int.toString(v)))
|
|
241
185
|
| None => ()
|
|
242
186
|
}
|
|
243
187
|
}
|
|
244
188
|
|
|
245
189
|
/* Convert props to attrs array */
|
|
246
|
-
let propsToAttrs = (props): array<(string,
|
|
190
|
+
let propsToAttrs = (props): array<(string, View.attrValue)> => {
|
|
247
191
|
let attrs = []
|
|
248
192
|
|
|
249
193
|
/* Standard attributes */
|
|
250
|
-
addAttr(attrs, props.id, "id",
|
|
251
|
-
addAttr(attrs, props.class, "class",
|
|
252
|
-
addAttr(attrs, props.style, "style",
|
|
253
|
-
addAttr(attrs, props.title, "title",
|
|
194
|
+
addAttr(attrs, props.id, "id", RuntimeJsxProp.toStringAttr)
|
|
195
|
+
addAttr(attrs, props.class, "class", RuntimeJsxProp.toStringAttr)
|
|
196
|
+
addAttr(attrs, props.style, "style", RuntimeJsxProp.toStringAttr)
|
|
197
|
+
addAttr(attrs, props.title, "title", RuntimeJsxProp.toStringAttr)
|
|
254
198
|
|
|
255
199
|
/* Form/Input attributes */
|
|
256
|
-
addAttr(attrs, props.type_, "type",
|
|
257
|
-
addAttr(attrs, props.name, "name",
|
|
258
|
-
addAttr(attrs, props.value, "value",
|
|
259
|
-
addAttr(attrs, props.placeholder, "placeholder",
|
|
260
|
-
addAttr(attrs, props.disabled, "disabled",
|
|
261
|
-
addAttr(attrs, props.checked, "checked",
|
|
262
|
-
addAttr(attrs, props.required, "required",
|
|
263
|
-
addAttr(attrs, props.readOnly, "readonly",
|
|
200
|
+
addAttr(attrs, props.type_, "type", RuntimeJsxProp.toStringAttr)
|
|
201
|
+
addAttr(attrs, props.name, "name", RuntimeJsxProp.toStringAttr)
|
|
202
|
+
addAttr(attrs, props.value, "value", RuntimeJsxProp.toStringAttr)
|
|
203
|
+
addAttr(attrs, props.placeholder, "placeholder", RuntimeJsxProp.toStringAttr)
|
|
204
|
+
addAttr(attrs, props.disabled, "disabled", RuntimeJsxProp.toBoolAttr)
|
|
205
|
+
addAttr(attrs, props.checked, "checked", RuntimeJsxProp.toBoolAttr)
|
|
206
|
+
addAttr(attrs, props.required, "required", RuntimeJsxProp.toBoolAttr)
|
|
207
|
+
addAttr(attrs, props.readOnly, "readonly", RuntimeJsxProp.toBoolAttr)
|
|
264
208
|
addIntAttr(attrs, props.maxLength, "maxlength")
|
|
265
209
|
addIntAttr(attrs, props.minLength, "minlength")
|
|
266
|
-
addAttr(attrs, props.min, "min",
|
|
267
|
-
addAttr(attrs, props.max, "max",
|
|
268
|
-
addAttr(attrs, props.step, "step",
|
|
269
|
-
addAttr(attrs, props.pattern, "pattern",
|
|
270
|
-
addAttr(attrs, props.autoComplete, "autocomplete",
|
|
271
|
-
addAttr(attrs, props.multiple, "multiple",
|
|
272
|
-
addAttr(attrs, props.accept, "accept",
|
|
210
|
+
addAttr(attrs, props.min, "min", RuntimeJsxProp.toStringAttr)
|
|
211
|
+
addAttr(attrs, props.max, "max", RuntimeJsxProp.toStringAttr)
|
|
212
|
+
addAttr(attrs, props.step, "step", RuntimeJsxProp.toStringAttr)
|
|
213
|
+
addAttr(attrs, props.pattern, "pattern", RuntimeJsxProp.toStringAttr)
|
|
214
|
+
addAttr(attrs, props.autoComplete, "autocomplete", RuntimeJsxProp.toStringAttr)
|
|
215
|
+
addAttr(attrs, props.multiple, "multiple", RuntimeJsxProp.toBoolAttr)
|
|
216
|
+
addAttr(attrs, props.accept, "accept", RuntimeJsxProp.toStringAttr)
|
|
273
217
|
addIntAttr(attrs, props.rows, "rows")
|
|
274
218
|
addIntAttr(attrs, props.cols, "cols")
|
|
275
|
-
addAttr(attrs, props.autofocus, "autofocus",
|
|
276
|
-
addAttr(attrs, props.action, "action",
|
|
277
|
-
addAttr(attrs, props.method, "method",
|
|
219
|
+
addAttr(attrs, props.autofocus, "autofocus", RuntimeJsxProp.toBoolAttr)
|
|
220
|
+
addAttr(attrs, props.action, "action", RuntimeJsxProp.toStringAttr)
|
|
221
|
+
addAttr(attrs, props.method, "method", RuntimeJsxProp.toStringAttr)
|
|
278
222
|
|
|
279
223
|
/* Label attributes */
|
|
280
|
-
addAttr(attrs, props.for_, "for",
|
|
224
|
+
addAttr(attrs, props.for_, "for", RuntimeJsxProp.toStringAttr)
|
|
281
225
|
|
|
282
226
|
/* Link attributes */
|
|
283
|
-
addAttr(attrs, props.href, "href",
|
|
284
|
-
addAttr(attrs, props.target, "target",
|
|
227
|
+
addAttr(attrs, props.href, "href", RuntimeJsxProp.toStringAttr)
|
|
228
|
+
addAttr(attrs, props.target, "target", RuntimeJsxProp.toStringAttr)
|
|
285
229
|
|
|
286
230
|
/* Image attributes */
|
|
287
|
-
addAttr(attrs, props.src, "src",
|
|
288
|
-
addAttr(attrs, props.alt, "alt",
|
|
289
|
-
addAttr(attrs, props.width, "width",
|
|
290
|
-
addAttr(attrs, props.height, "height",
|
|
231
|
+
addAttr(attrs, props.src, "src", RuntimeJsxProp.toStringAttr)
|
|
232
|
+
addAttr(attrs, props.alt, "alt", RuntimeJsxProp.toStringAttr)
|
|
233
|
+
addAttr(attrs, props.width, "width", RuntimeJsxProp.toStringAttr)
|
|
234
|
+
addAttr(attrs, props.height, "height", RuntimeJsxProp.toStringAttr)
|
|
291
235
|
|
|
292
236
|
/* Global attributes */
|
|
293
|
-
addAttr(attrs, props.draggable, "draggable",
|
|
294
|
-
addAttr(attrs, props.hidden, "hidden",
|
|
295
|
-
addAttr(attrs, props.contentEditable, "contenteditable",
|
|
296
|
-
addAttr(attrs, props.spellcheck, "spellcheck",
|
|
237
|
+
addAttr(attrs, props.draggable, "draggable", RuntimeJsxProp.toBoolAttr)
|
|
238
|
+
addAttr(attrs, props.hidden, "hidden", RuntimeJsxProp.toBoolAttr)
|
|
239
|
+
addAttr(attrs, props.contentEditable, "contenteditable", RuntimeJsxProp.toBoolAttr)
|
|
240
|
+
addAttr(attrs, props.spellcheck, "spellcheck", RuntimeJsxProp.toBoolAttr)
|
|
297
241
|
|
|
298
242
|
/* Accessibility attributes */
|
|
299
|
-
addAttr(attrs, props.role, "role",
|
|
243
|
+
addAttr(attrs, props.role, "role", RuntimeJsxProp.toStringAttr)
|
|
300
244
|
addIntAttr(attrs, props.tabIndex, "tabindex")
|
|
301
|
-
addAttr(attrs, props.ariaLabel, "aria-label",
|
|
302
|
-
addAttr(attrs, props.ariaHidden, "aria-hidden",
|
|
303
|
-
addAttr(attrs, props.ariaExpanded, "aria-expanded",
|
|
304
|
-
addAttr(attrs, props.ariaSelected, "aria-selected",
|
|
245
|
+
addAttr(attrs, props.ariaLabel, "aria-label", RuntimeJsxProp.toStringAttr)
|
|
246
|
+
addAttr(attrs, props.ariaHidden, "aria-hidden", RuntimeJsxProp.toBoolAttr)
|
|
247
|
+
addAttr(attrs, props.ariaExpanded, "aria-expanded", RuntimeJsxProp.toBoolAttr)
|
|
248
|
+
addAttr(attrs, props.ariaSelected, "aria-selected", RuntimeJsxProp.toBoolAttr)
|
|
305
249
|
|
|
306
250
|
/* Data attributes */
|
|
307
251
|
switch props.data {
|
|
308
|
-
| Some(
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
252
|
+
| Some(dataObj) => {
|
|
253
|
+
ignore(dataObj)
|
|
254
|
+
let entries: array<(string, Obj.t)> = %raw(`Object.entries(dataObj)`)
|
|
255
|
+
entries->Array.forEach(((key, value)) => {
|
|
256
|
+
attrs->Array.push(RuntimeJsxProp.toStringAttr("data-" ++ key, value))->ignore
|
|
257
|
+
})
|
|
314
258
|
}
|
|
315
259
|
| None => ()
|
|
316
260
|
}
|
|
@@ -366,7 +310,7 @@ module Elements = {
|
|
|
366
310
|
|
|
367
311
|
/* Create an element from a tag string and props */
|
|
368
312
|
let createElement = (tag: string, props): element => {
|
|
369
|
-
|
|
313
|
+
View.Element({
|
|
370
314
|
tag,
|
|
371
315
|
attrs: propsToAttrs(props),
|
|
372
316
|
events: propsToEvents(props),
|
|
@@ -380,8 +324,10 @@ module Elements = {
|
|
|
380
324
|
let jsxs = jsx
|
|
381
325
|
|
|
382
326
|
let jsxKeyed = (tag: string, props, ~key: option<string>=?, _: unit): element => {
|
|
383
|
-
|
|
384
|
-
jsx(tag, props)
|
|
327
|
+
switch key {
|
|
328
|
+
| Some(key) => View.Keyed({key, identity: Obj.magic(props), child: jsx(tag, props)})
|
|
329
|
+
| None => jsx(tag, props)
|
|
330
|
+
}
|
|
385
331
|
}
|
|
386
332
|
|
|
387
333
|
let jsxsKeyed = jsxKeyed
|
package/src/XoteJSX.res.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
4
|
-
import * as Signal$Xote from "./Signal.res.mjs";
|
|
5
|
-
import * as Computed$Xote from "./Computed.res.mjs";
|
|
3
|
+
import * as View$Xote from "./View.res.mjs";
|
|
6
4
|
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
|
|
5
|
+
import * as RuntimeJsxProp$Xote from "./RuntimeJsxProp.res.mjs";
|
|
7
6
|
|
|
8
7
|
function jsx(component, props) {
|
|
9
8
|
return {
|
|
@@ -13,10 +12,22 @@ function jsx(component, props) {
|
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
function jsxKeyed(component, props, key, param) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
if (key !== undefined) {
|
|
16
|
+
return {
|
|
17
|
+
TAG: "Keyed",
|
|
18
|
+
key: key,
|
|
19
|
+
identity: props,
|
|
20
|
+
child: {
|
|
21
|
+
TAG: "LazyComponent",
|
|
22
|
+
_0: () => component(props)
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
} else {
|
|
26
|
+
return {
|
|
27
|
+
TAG: "LazyComponent",
|
|
28
|
+
_0: () => component(props)
|
|
29
|
+
};
|
|
30
|
+
}
|
|
20
31
|
}
|
|
21
32
|
|
|
22
33
|
function jsxFragment(props) {
|
|
@@ -24,71 +35,14 @@ function jsxFragment(props) {
|
|
|
24
35
|
if (child !== undefined) {
|
|
25
36
|
return child;
|
|
26
37
|
} else {
|
|
27
|
-
return
|
|
38
|
+
return View$Xote.fragment([]);
|
|
28
39
|
}
|
|
29
40
|
}
|
|
30
41
|
|
|
31
|
-
let array =
|
|
42
|
+
let array = View$Xote.fragment;
|
|
32
43
|
|
|
33
44
|
function $$null() {
|
|
34
|
-
return
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function isReactiveProp(value) {
|
|
38
|
-
return (value && typeof value === 'object' && ('TAG' in value) && (value.TAG === 'Static' || value.TAG === 'Reactive'));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function convertAttrValue(key, value) {
|
|
42
|
-
if (isReactiveProp(value)) {
|
|
43
|
-
if (value.TAG === "Reactive") {
|
|
44
|
-
return Node$Xote.signalAttr(key, value._0);
|
|
45
|
-
} else {
|
|
46
|
-
return Node$Xote.attr(key, value._0);
|
|
47
|
-
}
|
|
48
|
-
} else if (typeof value === "function") {
|
|
49
|
-
return Node$Xote.computedAttr(key, value);
|
|
50
|
-
} else if (typeof value === "object") {
|
|
51
|
-
return Node$Xote.signalAttr(key, value);
|
|
52
|
-
} else {
|
|
53
|
-
return Node$Xote.attr(key, value);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function convertBoolAttrValue(key, value) {
|
|
58
|
-
if (isReactiveProp(value)) {
|
|
59
|
-
if (value.TAG !== "Reactive") {
|
|
60
|
-
return Node$Xote.attr(key, value._0 ? "true" : "false");
|
|
61
|
-
}
|
|
62
|
-
let signal = value._0;
|
|
63
|
-
let strSignal = Computed$Xote.make(() => {
|
|
64
|
-
if (Signal$Xote.get(signal)) {
|
|
65
|
-
return "true";
|
|
66
|
-
} else {
|
|
67
|
-
return "false";
|
|
68
|
-
}
|
|
69
|
-
}, undefined, undefined);
|
|
70
|
-
return Node$Xote.signalAttr(key, strSignal);
|
|
71
|
-
}
|
|
72
|
-
if (typeof value === "function") {
|
|
73
|
-
return Node$Xote.computedAttr(key, () => {
|
|
74
|
-
if (value()) {
|
|
75
|
-
return "true";
|
|
76
|
-
} else {
|
|
77
|
-
return "false";
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
if (typeof value !== "object") {
|
|
82
|
-
return Node$Xote.attr(key, value ? "true" : "false");
|
|
83
|
-
}
|
|
84
|
-
let strSignal$1 = Computed$Xote.make(() => {
|
|
85
|
-
if (Signal$Xote.get(value)) {
|
|
86
|
-
return "true";
|
|
87
|
-
} else {
|
|
88
|
-
return "false";
|
|
89
|
-
}
|
|
90
|
-
}, undefined, undefined);
|
|
91
|
-
return Node$Xote.signalAttr(key, strSignal$1);
|
|
45
|
+
return View$Xote.text("");
|
|
92
46
|
}
|
|
93
47
|
|
|
94
48
|
function addAttr(attrs, opt, key, converter) {
|
|
@@ -100,61 +54,62 @@ function addAttr(attrs, opt, key, converter) {
|
|
|
100
54
|
|
|
101
55
|
function addIntAttr(attrs, opt, key) {
|
|
102
56
|
if (opt !== undefined) {
|
|
103
|
-
attrs.push(
|
|
57
|
+
attrs.push(View$Xote.attr(key, opt.toString()));
|
|
104
58
|
return;
|
|
105
59
|
}
|
|
106
60
|
}
|
|
107
61
|
|
|
108
62
|
function propsToAttrs(props) {
|
|
109
63
|
let attrs = [];
|
|
110
|
-
addAttr(attrs, props.id, "id",
|
|
111
|
-
addAttr(attrs, props.class, "class",
|
|
112
|
-
addAttr(attrs, props.style, "style",
|
|
113
|
-
addAttr(attrs, props.title, "title",
|
|
114
|
-
addAttr(attrs, props.type, "type",
|
|
115
|
-
addAttr(attrs, props.name, "name",
|
|
116
|
-
addAttr(attrs, props.value, "value",
|
|
117
|
-
addAttr(attrs, props.placeholder, "placeholder",
|
|
118
|
-
addAttr(attrs, props.disabled, "disabled",
|
|
119
|
-
addAttr(attrs, props.checked, "checked",
|
|
120
|
-
addAttr(attrs, props.required, "required",
|
|
121
|
-
addAttr(attrs, props.readOnly, "readonly",
|
|
64
|
+
addAttr(attrs, props.id, "id", RuntimeJsxProp$Xote.toStringAttr);
|
|
65
|
+
addAttr(attrs, props.class, "class", RuntimeJsxProp$Xote.toStringAttr);
|
|
66
|
+
addAttr(attrs, props.style, "style", RuntimeJsxProp$Xote.toStringAttr);
|
|
67
|
+
addAttr(attrs, props.title, "title", RuntimeJsxProp$Xote.toStringAttr);
|
|
68
|
+
addAttr(attrs, props.type, "type", RuntimeJsxProp$Xote.toStringAttr);
|
|
69
|
+
addAttr(attrs, props.name, "name", RuntimeJsxProp$Xote.toStringAttr);
|
|
70
|
+
addAttr(attrs, props.value, "value", RuntimeJsxProp$Xote.toStringAttr);
|
|
71
|
+
addAttr(attrs, props.placeholder, "placeholder", RuntimeJsxProp$Xote.toStringAttr);
|
|
72
|
+
addAttr(attrs, props.disabled, "disabled", RuntimeJsxProp$Xote.toBoolAttr);
|
|
73
|
+
addAttr(attrs, props.checked, "checked", RuntimeJsxProp$Xote.toBoolAttr);
|
|
74
|
+
addAttr(attrs, props.required, "required", RuntimeJsxProp$Xote.toBoolAttr);
|
|
75
|
+
addAttr(attrs, props.readOnly, "readonly", RuntimeJsxProp$Xote.toBoolAttr);
|
|
122
76
|
addIntAttr(attrs, props.maxLength, "maxlength");
|
|
123
77
|
addIntAttr(attrs, props.minLength, "minlength");
|
|
124
|
-
addAttr(attrs, props.min, "min",
|
|
125
|
-
addAttr(attrs, props.max, "max",
|
|
126
|
-
addAttr(attrs, props.step, "step",
|
|
127
|
-
addAttr(attrs, props.pattern, "pattern",
|
|
128
|
-
addAttr(attrs, props.autoComplete, "autocomplete",
|
|
129
|
-
addAttr(attrs, props.multiple, "multiple",
|
|
130
|
-
addAttr(attrs, props.accept, "accept",
|
|
78
|
+
addAttr(attrs, props.min, "min", RuntimeJsxProp$Xote.toStringAttr);
|
|
79
|
+
addAttr(attrs, props.max, "max", RuntimeJsxProp$Xote.toStringAttr);
|
|
80
|
+
addAttr(attrs, props.step, "step", RuntimeJsxProp$Xote.toStringAttr);
|
|
81
|
+
addAttr(attrs, props.pattern, "pattern", RuntimeJsxProp$Xote.toStringAttr);
|
|
82
|
+
addAttr(attrs, props.autoComplete, "autocomplete", RuntimeJsxProp$Xote.toStringAttr);
|
|
83
|
+
addAttr(attrs, props.multiple, "multiple", RuntimeJsxProp$Xote.toBoolAttr);
|
|
84
|
+
addAttr(attrs, props.accept, "accept", RuntimeJsxProp$Xote.toStringAttr);
|
|
131
85
|
addIntAttr(attrs, props.rows, "rows");
|
|
132
86
|
addIntAttr(attrs, props.cols, "cols");
|
|
133
|
-
addAttr(attrs, props.autofocus, "autofocus",
|
|
134
|
-
addAttr(attrs, props.action, "action",
|
|
135
|
-
addAttr(attrs, props.method, "method",
|
|
136
|
-
addAttr(attrs, props.for, "for",
|
|
137
|
-
addAttr(attrs, props.href, "href",
|
|
138
|
-
addAttr(attrs, props.target, "target",
|
|
139
|
-
addAttr(attrs, props.src, "src",
|
|
140
|
-
addAttr(attrs, props.alt, "alt",
|
|
141
|
-
addAttr(attrs, props.width, "width",
|
|
142
|
-
addAttr(attrs, props.height, "height",
|
|
143
|
-
addAttr(attrs, props.draggable, "draggable",
|
|
144
|
-
addAttr(attrs, props.hidden, "hidden",
|
|
145
|
-
addAttr(attrs, props.contentEditable, "contenteditable",
|
|
146
|
-
addAttr(attrs, props.spellcheck, "spellcheck",
|
|
147
|
-
addAttr(attrs, props.role, "role",
|
|
87
|
+
addAttr(attrs, props.autofocus, "autofocus", RuntimeJsxProp$Xote.toBoolAttr);
|
|
88
|
+
addAttr(attrs, props.action, "action", RuntimeJsxProp$Xote.toStringAttr);
|
|
89
|
+
addAttr(attrs, props.method, "method", RuntimeJsxProp$Xote.toStringAttr);
|
|
90
|
+
addAttr(attrs, props.for, "for", RuntimeJsxProp$Xote.toStringAttr);
|
|
91
|
+
addAttr(attrs, props.href, "href", RuntimeJsxProp$Xote.toStringAttr);
|
|
92
|
+
addAttr(attrs, props.target, "target", RuntimeJsxProp$Xote.toStringAttr);
|
|
93
|
+
addAttr(attrs, props.src, "src", RuntimeJsxProp$Xote.toStringAttr);
|
|
94
|
+
addAttr(attrs, props.alt, "alt", RuntimeJsxProp$Xote.toStringAttr);
|
|
95
|
+
addAttr(attrs, props.width, "width", RuntimeJsxProp$Xote.toStringAttr);
|
|
96
|
+
addAttr(attrs, props.height, "height", RuntimeJsxProp$Xote.toStringAttr);
|
|
97
|
+
addAttr(attrs, props.draggable, "draggable", RuntimeJsxProp$Xote.toBoolAttr);
|
|
98
|
+
addAttr(attrs, props.hidden, "hidden", RuntimeJsxProp$Xote.toBoolAttr);
|
|
99
|
+
addAttr(attrs, props.contentEditable, "contenteditable", RuntimeJsxProp$Xote.toBoolAttr);
|
|
100
|
+
addAttr(attrs, props.spellcheck, "spellcheck", RuntimeJsxProp$Xote.toBoolAttr);
|
|
101
|
+
addAttr(attrs, props.role, "role", RuntimeJsxProp$Xote.toStringAttr);
|
|
148
102
|
addIntAttr(attrs, props.tabIndex, "tabindex");
|
|
149
|
-
addAttr(attrs, props["aria-label"], "aria-label",
|
|
150
|
-
addAttr(attrs, props["aria-hidden"], "aria-hidden",
|
|
151
|
-
addAttr(attrs, props["aria-expanded"], "aria-expanded",
|
|
152
|
-
addAttr(attrs, props["aria-selected"], "aria-selected",
|
|
153
|
-
let
|
|
154
|
-
if (
|
|
155
|
-
(
|
|
156
|
-
|
|
157
|
-
|
|
103
|
+
addAttr(attrs, props["aria-label"], "aria-label", RuntimeJsxProp$Xote.toStringAttr);
|
|
104
|
+
addAttr(attrs, props["aria-hidden"], "aria-hidden", RuntimeJsxProp$Xote.toBoolAttr);
|
|
105
|
+
addAttr(attrs, props["aria-expanded"], "aria-expanded", RuntimeJsxProp$Xote.toBoolAttr);
|
|
106
|
+
addAttr(attrs, props["aria-selected"], "aria-selected", RuntimeJsxProp$Xote.toBoolAttr);
|
|
107
|
+
let dataObj = props.data;
|
|
108
|
+
if (dataObj !== undefined) {
|
|
109
|
+
let entries = (Object.entries(dataObj));
|
|
110
|
+
entries.forEach(param => {
|
|
111
|
+
attrs.push(RuntimeJsxProp$Xote.toStringAttr("data-" + param[0], param[1]));
|
|
112
|
+
});
|
|
158
113
|
}
|
|
159
114
|
return attrs;
|
|
160
115
|
}
|
|
@@ -221,13 +176,19 @@ function createElement(tag, props) {
|
|
|
221
176
|
let jsx$1 = createElement;
|
|
222
177
|
|
|
223
178
|
function jsxKeyed$1(tag, props, key, param) {
|
|
224
|
-
|
|
179
|
+
if (key !== undefined) {
|
|
180
|
+
return {
|
|
181
|
+
TAG: "Keyed",
|
|
182
|
+
key: key,
|
|
183
|
+
identity: props,
|
|
184
|
+
child: createElement(tag, props)
|
|
185
|
+
};
|
|
186
|
+
} else {
|
|
187
|
+
return createElement(tag, props);
|
|
188
|
+
}
|
|
225
189
|
}
|
|
226
190
|
|
|
227
191
|
let Elements = {
|
|
228
|
-
isReactiveProp: isReactiveProp,
|
|
229
|
-
convertAttrValue: convertAttrValue,
|
|
230
|
-
convertBoolAttrValue: convertBoolAttrValue,
|
|
231
192
|
addAttr: addAttr,
|
|
232
193
|
addIntAttr: addIntAttr,
|
|
233
194
|
propsToAttrs: propsToAttrs,
|
|
@@ -241,14 +202,14 @@ let Elements = {
|
|
|
241
202
|
jsxsKeyed: jsxKeyed$1
|
|
242
203
|
};
|
|
243
204
|
|
|
244
|
-
let
|
|
205
|
+
let Prop;
|
|
245
206
|
|
|
246
207
|
let jsxs = jsx;
|
|
247
208
|
|
|
248
209
|
let jsxsKeyed = jsxKeyed;
|
|
249
210
|
|
|
250
211
|
export {
|
|
251
|
-
|
|
212
|
+
Prop,
|
|
252
213
|
jsx,
|
|
253
214
|
jsxs,
|
|
254
215
|
jsxKeyed,
|
|
@@ -258,4 +219,4 @@ export {
|
|
|
258
219
|
$$null,
|
|
259
220
|
Elements,
|
|
260
221
|
}
|
|
261
|
-
/*
|
|
222
|
+
/* View-Xote Not a pure module */
|