xote 6.1.2 → 6.3.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 +9 -9
- package/dist/xote.mjs +1489 -1328
- 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 +85 -118
- package/src/XoteJSX.res.mjs +89 -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,
|
|
@@ -156,6 +158,17 @@ module Elements = {
|
|
|
156
158
|
onMouseMove?: Dom.event => unit,
|
|
157
159
|
onMouseUp?: Dom.event => unit,
|
|
158
160
|
onContextMenu?: Dom.event => unit,
|
|
161
|
+
/* Pointer event handlers */
|
|
162
|
+
onPointerDown?: Dom.event => unit,
|
|
163
|
+
onPointerMove?: Dom.event => unit,
|
|
164
|
+
onPointerUp?: Dom.event => unit,
|
|
165
|
+
onPointerCancel?: Dom.event => unit,
|
|
166
|
+
onPointerEnter?: Dom.event => unit,
|
|
167
|
+
onPointerLeave?: Dom.event => unit,
|
|
168
|
+
onPointerOver?: Dom.event => unit,
|
|
169
|
+
onPointerOut?: Dom.event => unit,
|
|
170
|
+
onGotPointerCapture?: Dom.event => unit,
|
|
171
|
+
onLostPointerCapture?: Dom.event => unit,
|
|
159
172
|
/* Drag-and-drop event handlers */
|
|
160
173
|
onDrag?: Dom.event => unit,
|
|
161
174
|
onDragStart?: Dom.event => unit,
|
|
@@ -168,64 +181,6 @@ module Elements = {
|
|
|
168
181
|
children?: element,
|
|
169
182
|
}
|
|
170
183
|
|
|
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
184
|
/* Helper to add optional attribute to attrs array */
|
|
230
185
|
let addAttr = (attrs, opt, key, converter) => {
|
|
231
186
|
switch opt {
|
|
@@ -237,80 +192,80 @@ module Elements = {
|
|
|
237
192
|
/* Helper to add optional int attribute */
|
|
238
193
|
let addIntAttr = (attrs, opt, key) => {
|
|
239
194
|
switch opt {
|
|
240
|
-
| Some(v) => attrs->Array.push(
|
|
195
|
+
| Some(v) => attrs->Array.push(View.attr(key, Int.toString(v)))
|
|
241
196
|
| None => ()
|
|
242
197
|
}
|
|
243
198
|
}
|
|
244
199
|
|
|
245
200
|
/* Convert props to attrs array */
|
|
246
|
-
let propsToAttrs = (props): array<(string,
|
|
201
|
+
let propsToAttrs = (props): array<(string, View.attrValue)> => {
|
|
247
202
|
let attrs = []
|
|
248
203
|
|
|
249
204
|
/* 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",
|
|
205
|
+
addAttr(attrs, props.id, "id", RuntimeJsxProp.toStringAttr)
|
|
206
|
+
addAttr(attrs, props.class, "class", RuntimeJsxProp.toStringAttr)
|
|
207
|
+
addAttr(attrs, props.style, "style", RuntimeJsxProp.toStringAttr)
|
|
208
|
+
addAttr(attrs, props.title, "title", RuntimeJsxProp.toStringAttr)
|
|
254
209
|
|
|
255
210
|
/* 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",
|
|
211
|
+
addAttr(attrs, props.type_, "type", RuntimeJsxProp.toStringAttr)
|
|
212
|
+
addAttr(attrs, props.name, "name", RuntimeJsxProp.toStringAttr)
|
|
213
|
+
addAttr(attrs, props.value, "value", RuntimeJsxProp.toStringAttr)
|
|
214
|
+
addAttr(attrs, props.placeholder, "placeholder", RuntimeJsxProp.toStringAttr)
|
|
215
|
+
addAttr(attrs, props.disabled, "disabled", RuntimeJsxProp.toBoolAttr)
|
|
216
|
+
addAttr(attrs, props.checked, "checked", RuntimeJsxProp.toBoolAttr)
|
|
217
|
+
addAttr(attrs, props.required, "required", RuntimeJsxProp.toBoolAttr)
|
|
218
|
+
addAttr(attrs, props.readOnly, "readonly", RuntimeJsxProp.toBoolAttr)
|
|
264
219
|
addIntAttr(attrs, props.maxLength, "maxlength")
|
|
265
220
|
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",
|
|
221
|
+
addAttr(attrs, props.min, "min", RuntimeJsxProp.toStringAttr)
|
|
222
|
+
addAttr(attrs, props.max, "max", RuntimeJsxProp.toStringAttr)
|
|
223
|
+
addAttr(attrs, props.step, "step", RuntimeJsxProp.toStringAttr)
|
|
224
|
+
addAttr(attrs, props.pattern, "pattern", RuntimeJsxProp.toStringAttr)
|
|
225
|
+
addAttr(attrs, props.autoComplete, "autocomplete", RuntimeJsxProp.toStringAttr)
|
|
226
|
+
addAttr(attrs, props.multiple, "multiple", RuntimeJsxProp.toBoolAttr)
|
|
227
|
+
addAttr(attrs, props.accept, "accept", RuntimeJsxProp.toStringAttr)
|
|
273
228
|
addIntAttr(attrs, props.rows, "rows")
|
|
274
229
|
addIntAttr(attrs, props.cols, "cols")
|
|
275
|
-
addAttr(attrs, props.autofocus, "autofocus",
|
|
276
|
-
addAttr(attrs, props.action, "action",
|
|
277
|
-
addAttr(attrs, props.method, "method",
|
|
230
|
+
addAttr(attrs, props.autofocus, "autofocus", RuntimeJsxProp.toBoolAttr)
|
|
231
|
+
addAttr(attrs, props.action, "action", RuntimeJsxProp.toStringAttr)
|
|
232
|
+
addAttr(attrs, props.method, "method", RuntimeJsxProp.toStringAttr)
|
|
278
233
|
|
|
279
234
|
/* Label attributes */
|
|
280
|
-
addAttr(attrs, props.for_, "for",
|
|
235
|
+
addAttr(attrs, props.for_, "for", RuntimeJsxProp.toStringAttr)
|
|
281
236
|
|
|
282
237
|
/* Link attributes */
|
|
283
|
-
addAttr(attrs, props.href, "href",
|
|
284
|
-
addAttr(attrs, props.target, "target",
|
|
238
|
+
addAttr(attrs, props.href, "href", RuntimeJsxProp.toStringAttr)
|
|
239
|
+
addAttr(attrs, props.target, "target", RuntimeJsxProp.toStringAttr)
|
|
285
240
|
|
|
286
241
|
/* 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",
|
|
242
|
+
addAttr(attrs, props.src, "src", RuntimeJsxProp.toStringAttr)
|
|
243
|
+
addAttr(attrs, props.alt, "alt", RuntimeJsxProp.toStringAttr)
|
|
244
|
+
addAttr(attrs, props.width, "width", RuntimeJsxProp.toStringAttr)
|
|
245
|
+
addAttr(attrs, props.height, "height", RuntimeJsxProp.toStringAttr)
|
|
291
246
|
|
|
292
247
|
/* 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",
|
|
248
|
+
addAttr(attrs, props.draggable, "draggable", RuntimeJsxProp.toBoolAttr)
|
|
249
|
+
addAttr(attrs, props.hidden, "hidden", RuntimeJsxProp.toBoolAttr)
|
|
250
|
+
addAttr(attrs, props.contentEditable, "contenteditable", RuntimeJsxProp.toBoolAttr)
|
|
251
|
+
addAttr(attrs, props.spellcheck, "spellcheck", RuntimeJsxProp.toBoolAttr)
|
|
297
252
|
|
|
298
253
|
/* Accessibility attributes */
|
|
299
|
-
addAttr(attrs, props.role, "role",
|
|
254
|
+
addAttr(attrs, props.role, "role", RuntimeJsxProp.toStringAttr)
|
|
300
255
|
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",
|
|
256
|
+
addAttr(attrs, props.ariaLabel, "aria-label", RuntimeJsxProp.toStringAttr)
|
|
257
|
+
addAttr(attrs, props.ariaHidden, "aria-hidden", RuntimeJsxProp.toBoolAttr)
|
|
258
|
+
addAttr(attrs, props.ariaExpanded, "aria-expanded", RuntimeJsxProp.toBoolAttr)
|
|
259
|
+
addAttr(attrs, props.ariaSelected, "aria-selected", RuntimeJsxProp.toBoolAttr)
|
|
305
260
|
|
|
306
261
|
/* Data attributes */
|
|
307
262
|
switch props.data {
|
|
308
|
-
| Some(
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
263
|
+
| Some(dataObj) => {
|
|
264
|
+
ignore(dataObj)
|
|
265
|
+
let entries: array<(string, Obj.t)> = %raw(`Object.entries(dataObj)`)
|
|
266
|
+
entries->Array.forEach(((key, value)) => {
|
|
267
|
+
attrs->Array.push(RuntimeJsxProp.toStringAttr("data-" ++ key, value))->ignore
|
|
268
|
+
})
|
|
314
269
|
}
|
|
315
270
|
| None => ()
|
|
316
271
|
}
|
|
@@ -344,6 +299,16 @@ module Elements = {
|
|
|
344
299
|
addEvent(events, props.onMouseMove, "mousemove")
|
|
345
300
|
addEvent(events, props.onMouseUp, "mouseup")
|
|
346
301
|
addEvent(events, props.onContextMenu, "contextmenu")
|
|
302
|
+
addEvent(events, props.onPointerDown, "pointerdown")
|
|
303
|
+
addEvent(events, props.onPointerMove, "pointermove")
|
|
304
|
+
addEvent(events, props.onPointerUp, "pointerup")
|
|
305
|
+
addEvent(events, props.onPointerCancel, "pointercancel")
|
|
306
|
+
addEvent(events, props.onPointerEnter, "pointerenter")
|
|
307
|
+
addEvent(events, props.onPointerLeave, "pointerleave")
|
|
308
|
+
addEvent(events, props.onPointerOver, "pointerover")
|
|
309
|
+
addEvent(events, props.onPointerOut, "pointerout")
|
|
310
|
+
addEvent(events, props.onGotPointerCapture, "gotpointercapture")
|
|
311
|
+
addEvent(events, props.onLostPointerCapture, "lostpointercapture")
|
|
347
312
|
addEvent(events, props.onDrag, "drag")
|
|
348
313
|
addEvent(events, props.onDragStart, "dragstart")
|
|
349
314
|
addEvent(events, props.onDragEnd, "dragend")
|
|
@@ -366,7 +331,7 @@ module Elements = {
|
|
|
366
331
|
|
|
367
332
|
/* Create an element from a tag string and props */
|
|
368
333
|
let createElement = (tag: string, props): element => {
|
|
369
|
-
|
|
334
|
+
View.Element({
|
|
370
335
|
tag,
|
|
371
336
|
attrs: propsToAttrs(props),
|
|
372
337
|
events: propsToEvents(props),
|
|
@@ -380,8 +345,10 @@ module Elements = {
|
|
|
380
345
|
let jsxs = jsx
|
|
381
346
|
|
|
382
347
|
let jsxKeyed = (tag: string, props, ~key: option<string>=?, _: unit): element => {
|
|
383
|
-
|
|
384
|
-
jsx(tag, props)
|
|
348
|
+
switch key {
|
|
349
|
+
| Some(key) => View.Keyed({key, identity: Obj.magic(props), child: jsx(tag, props)})
|
|
350
|
+
| None => jsx(tag, props)
|
|
351
|
+
}
|
|
385
352
|
}
|
|
386
353
|
|
|
387
354
|
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
|
}
|
|
@@ -185,6 +140,16 @@ function propsToEvents(props) {
|
|
|
185
140
|
addEvent(events, props.onMouseMove, "mousemove");
|
|
186
141
|
addEvent(events, props.onMouseUp, "mouseup");
|
|
187
142
|
addEvent(events, props.onContextMenu, "contextmenu");
|
|
143
|
+
addEvent(events, props.onPointerDown, "pointerdown");
|
|
144
|
+
addEvent(events, props.onPointerMove, "pointermove");
|
|
145
|
+
addEvent(events, props.onPointerUp, "pointerup");
|
|
146
|
+
addEvent(events, props.onPointerCancel, "pointercancel");
|
|
147
|
+
addEvent(events, props.onPointerEnter, "pointerenter");
|
|
148
|
+
addEvent(events, props.onPointerLeave, "pointerleave");
|
|
149
|
+
addEvent(events, props.onPointerOver, "pointerover");
|
|
150
|
+
addEvent(events, props.onPointerOut, "pointerout");
|
|
151
|
+
addEvent(events, props.onGotPointerCapture, "gotpointercapture");
|
|
152
|
+
addEvent(events, props.onLostPointerCapture, "lostpointercapture");
|
|
188
153
|
addEvent(events, props.onDrag, "drag");
|
|
189
154
|
addEvent(events, props.onDragStart, "dragstart");
|
|
190
155
|
addEvent(events, props.onDragEnd, "dragend");
|
|
@@ -221,13 +186,19 @@ function createElement(tag, props) {
|
|
|
221
186
|
let jsx$1 = createElement;
|
|
222
187
|
|
|
223
188
|
function jsxKeyed$1(tag, props, key, param) {
|
|
224
|
-
|
|
189
|
+
if (key !== undefined) {
|
|
190
|
+
return {
|
|
191
|
+
TAG: "Keyed",
|
|
192
|
+
key: key,
|
|
193
|
+
identity: props,
|
|
194
|
+
child: createElement(tag, props)
|
|
195
|
+
};
|
|
196
|
+
} else {
|
|
197
|
+
return createElement(tag, props);
|
|
198
|
+
}
|
|
225
199
|
}
|
|
226
200
|
|
|
227
201
|
let Elements = {
|
|
228
|
-
isReactiveProp: isReactiveProp,
|
|
229
|
-
convertAttrValue: convertAttrValue,
|
|
230
|
-
convertBoolAttrValue: convertBoolAttrValue,
|
|
231
202
|
addAttr: addAttr,
|
|
232
203
|
addIntAttr: addIntAttr,
|
|
233
204
|
propsToAttrs: propsToAttrs,
|
|
@@ -241,14 +212,14 @@ let Elements = {
|
|
|
241
212
|
jsxsKeyed: jsxKeyed$1
|
|
242
213
|
};
|
|
243
214
|
|
|
244
|
-
let
|
|
215
|
+
let Prop;
|
|
245
216
|
|
|
246
217
|
let jsxs = jsx;
|
|
247
218
|
|
|
248
219
|
let jsxsKeyed = jsxKeyed;
|
|
249
220
|
|
|
250
221
|
export {
|
|
251
|
-
|
|
222
|
+
Prop,
|
|
252
223
|
jsx,
|
|
253
224
|
jsxs,
|
|
254
225
|
jsxKeyed,
|
|
@@ -258,4 +229,4 @@ export {
|
|
|
258
229
|
$$null,
|
|
259
230
|
Elements,
|
|
260
231
|
}
|
|
261
|
-
/*
|
|
232
|
+
/* View-Xote Not a pure module */
|