jaxs 0.6.2 → 0.7.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/dist/jaxs.d.ts +725 -943
- package/dist/jaxs.js +794 -1039
- package/dist/jaxs.umd.cjs +1 -1157
- package/package.json +3 -3
package/dist/jaxs.umd.cjs
CHANGED
|
@@ -1,1157 +1 @@
|
|
|
1
|
-
;(function (p, f) {
|
|
2
|
-
typeof exports == 'object' && typeof module < 'u'
|
|
3
|
-
? f(exports)
|
|
4
|
-
: typeof define == 'function' && define.amd
|
|
5
|
-
? define(['exports'], f)
|
|
6
|
-
: ((p = typeof globalThis < 'u' ? globalThis : p || self),
|
|
7
|
-
f((p.jaxs = {})))
|
|
8
|
-
})(this, function (p) {
|
|
9
|
-
'use strict'
|
|
10
|
-
const f = (e, t) => t.createElement(e),
|
|
11
|
-
nt = (e, t) => {
|
|
12
|
-
for (const s in t) {
|
|
13
|
-
if (s === '__self') continue
|
|
14
|
-
const n = t[s].toString()
|
|
15
|
-
if (s === 'value') {
|
|
16
|
-
const r = e
|
|
17
|
-
r.value !== n && (r.value = n)
|
|
18
|
-
} else e.setAttribute(s, n)
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
rt = (e, t, s) => {
|
|
22
|
-
const n = {}
|
|
23
|
-
for (const r in t) {
|
|
24
|
-
const o = t[r],
|
|
25
|
-
a = (l) => s(o, l)
|
|
26
|
-
e.addEventListener(r, a),
|
|
27
|
-
(n[r] = { domEvent: r, busEvent: o, listener: a })
|
|
28
|
-
}
|
|
29
|
-
e.eventMaps = n
|
|
30
|
-
},
|
|
31
|
-
ot = (e, t, s, n) => {
|
|
32
|
-
const r = f(e, n.document)
|
|
33
|
-
return nt(r, t), rt(r, s, n.publish), r
|
|
34
|
-
},
|
|
35
|
-
g = 'http://www.w3.org/2000/svg',
|
|
36
|
-
it = {
|
|
37
|
-
animate: !0,
|
|
38
|
-
animateMotion: !0,
|
|
39
|
-
animateTransform: !0,
|
|
40
|
-
circle: !0,
|
|
41
|
-
clipPath: !0,
|
|
42
|
-
defs: !0,
|
|
43
|
-
desc: !0,
|
|
44
|
-
ellipse: !0,
|
|
45
|
-
feBlend: !0,
|
|
46
|
-
feColorMatrix: !0,
|
|
47
|
-
feComponentTransfer: !0,
|
|
48
|
-
feComposite: !0,
|
|
49
|
-
feConvolveMatrix: !0,
|
|
50
|
-
feDiffuseLighting: !0,
|
|
51
|
-
feDisplacementMap: !0,
|
|
52
|
-
feDistantLight: !0,
|
|
53
|
-
feDropShadow: !0,
|
|
54
|
-
feFlood: !0,
|
|
55
|
-
feFuncA: !0,
|
|
56
|
-
feFuncB: !0,
|
|
57
|
-
feFuncG: !0,
|
|
58
|
-
feFuncR: !0,
|
|
59
|
-
feGaussianBlur: !0,
|
|
60
|
-
feImage: !0,
|
|
61
|
-
feMerge: !0,
|
|
62
|
-
feMergeNode: !0,
|
|
63
|
-
feMorphology: !0,
|
|
64
|
-
feOffset: !0,
|
|
65
|
-
fePointLight: !0,
|
|
66
|
-
feSpecularLighting: !0,
|
|
67
|
-
feSpotLight: !0,
|
|
68
|
-
feTile: !0,
|
|
69
|
-
feTurbulence: !0,
|
|
70
|
-
filter: !0,
|
|
71
|
-
foreignObject: !0,
|
|
72
|
-
g: !0,
|
|
73
|
-
image: !0,
|
|
74
|
-
line: !0,
|
|
75
|
-
linearGradient: !0,
|
|
76
|
-
marker: !0,
|
|
77
|
-
mask: !0,
|
|
78
|
-
metadata: !0,
|
|
79
|
-
mpath: !0,
|
|
80
|
-
path: !0,
|
|
81
|
-
pattern: !0,
|
|
82
|
-
polygon: !0,
|
|
83
|
-
polyline: !0,
|
|
84
|
-
radialGradient: !0,
|
|
85
|
-
rect: !0,
|
|
86
|
-
script: !0,
|
|
87
|
-
set: !0,
|
|
88
|
-
stop: !0,
|
|
89
|
-
style: !0,
|
|
90
|
-
svg: !0,
|
|
91
|
-
switch: !0,
|
|
92
|
-
symbol: !0,
|
|
93
|
-
text: !0,
|
|
94
|
-
textPath: !0,
|
|
95
|
-
title: !0,
|
|
96
|
-
tspan: !0,
|
|
97
|
-
use: !0,
|
|
98
|
-
view: !0,
|
|
99
|
-
},
|
|
100
|
-
ut = (e, t) => !!(it[e] || (e === 'a' && t === g)),
|
|
101
|
-
at = (e, t, s) => {
|
|
102
|
-
const n = s.createElementNS(g, e)
|
|
103
|
-
for (const r in t)
|
|
104
|
-
r === '__self' ||
|
|
105
|
-
r === 'xmlns' ||
|
|
106
|
-
n.setAttributeNS(null, r, t[r].toString())
|
|
107
|
-
return n
|
|
108
|
-
},
|
|
109
|
-
ct = (e) => e.namespaceURI === g,
|
|
110
|
-
lt = (e, t) => t.createTextNode(e)
|
|
111
|
-
class ht {
|
|
112
|
-
constructor(t) {
|
|
113
|
-
this.value = t.toString()
|
|
114
|
-
}
|
|
115
|
-
render(t) {
|
|
116
|
-
const s = lt(this.value, t.document)
|
|
117
|
-
return (s.__jsx = 'TextNode'), [s]
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
const dt = (e) => typeof e == 'string' || typeof e == 'number',
|
|
121
|
-
pt = (e) => new ht(e),
|
|
122
|
-
mt = (e) => (dt(e) ? pt(e) : e),
|
|
123
|
-
ft = (e) => bt(e).map(mt).flat(),
|
|
124
|
-
bt = (e) => (Array.isArray(e) ? e.flat() : e ? [e] : []),
|
|
125
|
-
N = (e, t = {}) => e || t.children || [],
|
|
126
|
-
vt = (e, t = '') => {
|
|
127
|
-
const s = {},
|
|
128
|
-
n = {}
|
|
129
|
-
for (const r in e) {
|
|
130
|
-
const o = e[r]
|
|
131
|
-
if (r.match(/^on.+/i)) {
|
|
132
|
-
const a = r.slice(2).toLowerCase()
|
|
133
|
-
n[a] = o ? o.toString() : ''
|
|
134
|
-
} else {
|
|
135
|
-
if (o === !1) continue
|
|
136
|
-
r === '__source' ? (s.__source = e.__source) : (s[r] = gt(r, o, t))
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return { attributes: s, events: n }
|
|
140
|
-
},
|
|
141
|
-
gt = (e, t, s = '') => (t == null ? s : t.toString()),
|
|
142
|
-
yt = (e, t) => {
|
|
143
|
-
const s = e || {},
|
|
144
|
-
n = N(t, s)
|
|
145
|
-
return (s.children = s.children || n), s
|
|
146
|
-
},
|
|
147
|
-
j = (e, t, s, n = []) => e.reduce(Et(t, s), n).flat(),
|
|
148
|
-
Et = (e, t) => (s, n) =>
|
|
149
|
-
n
|
|
150
|
-
? Array.isArray(n)
|
|
151
|
-
? j(n, e, t, s)
|
|
152
|
-
: (n.render(e, t).forEach((r) => s.push(r)), s)
|
|
153
|
-
: s
|
|
154
|
-
class O {
|
|
155
|
-
constructor(t) {
|
|
156
|
-
this.collection = ft(t)
|
|
157
|
-
}
|
|
158
|
-
render(t, s) {
|
|
159
|
-
this.parentElement = s
|
|
160
|
-
const n = this.generateDom(t)
|
|
161
|
-
return this.attachToParent(n), n
|
|
162
|
-
}
|
|
163
|
-
generateDom(t) {
|
|
164
|
-
return j(this.collection, t, this.parentElement)
|
|
165
|
-
}
|
|
166
|
-
attachToParent(t) {
|
|
167
|
-
if (this.parentElement === void 0) return
|
|
168
|
-
const s = this.parentElement
|
|
169
|
-
t.forEach((n) => s.appendChild(n))
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
class xt {
|
|
173
|
-
constructor(t, s) {
|
|
174
|
-
;(this.type = t), (this.attributes = s)
|
|
175
|
-
}
|
|
176
|
-
generate() {
|
|
177
|
-
return (
|
|
178
|
-
this.attributes.key ||
|
|
179
|
-
this.sourceKey() ||
|
|
180
|
-
this.createKeyFromAttributes()
|
|
181
|
-
)
|
|
182
|
-
}
|
|
183
|
-
sourceKey() {
|
|
184
|
-
if (this.attributes.__source) {
|
|
185
|
-
const {
|
|
186
|
-
fileName: t,
|
|
187
|
-
lineNumber: s,
|
|
188
|
-
columnNumber: n,
|
|
189
|
-
} = this.attributes.__source
|
|
190
|
-
return `${t}:${s}:${n}`
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
createKeyFromAttributes() {
|
|
194
|
-
const t = this.attributes.id ? `#${this.attributes.id}` : '',
|
|
195
|
-
s = this.attributes.type ? `[type=${this.attributes.type}]` : '',
|
|
196
|
-
n = this.attributes.name ? `[name=${this.attributes.name}]` : ''
|
|
197
|
-
return `${this.type}${t}${s}${n}`
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
class At {
|
|
201
|
-
constructor(t, s, n = []) {
|
|
202
|
-
this.type = t
|
|
203
|
-
const { events: r, attributes: o } = vt(s)
|
|
204
|
-
;(this.events = r),
|
|
205
|
-
(this.attributes = o),
|
|
206
|
-
(this.isSvg = ut(this.type, this.attributes.xmlns)),
|
|
207
|
-
(this.children = new O(n))
|
|
208
|
-
}
|
|
209
|
-
render(t) {
|
|
210
|
-
const s = this.generateDom(t)
|
|
211
|
-
return s ? (this.children.render(t, s), [s]) : []
|
|
212
|
-
}
|
|
213
|
-
generateDom(t) {
|
|
214
|
-
return this.isSvg ? this.generateSvgDom(t) : this.generateHtmlDom(t)
|
|
215
|
-
}
|
|
216
|
-
generateHtmlDom(t) {
|
|
217
|
-
const s = ot(this.type, this.attributes, this.events, t)
|
|
218
|
-
return (s.__jsx = this.jsxKey()), s
|
|
219
|
-
}
|
|
220
|
-
generateSvgDom(t) {
|
|
221
|
-
const s = at(this.type, this.attributes, t.document)
|
|
222
|
-
return (s.__jsx = this.jsxKey()), s
|
|
223
|
-
}
|
|
224
|
-
jsxKey() {
|
|
225
|
-
return new xt(this.type, this.attributes).generate()
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
const M = (e, t, ...s) =>
|
|
229
|
-
typeof e == 'string' ? new At(e, t, s) : e(yt(t, s))
|
|
230
|
-
M.fragment = (e, t) => {
|
|
231
|
-
const s = N(t, e)
|
|
232
|
-
return new O(s)
|
|
233
|
-
}
|
|
234
|
-
class _t {
|
|
235
|
-
constructor(t, s, n) {
|
|
236
|
-
;(this.template = t),
|
|
237
|
-
(this.selector = s),
|
|
238
|
-
(this.renderKit = n),
|
|
239
|
-
(this.dom = [])
|
|
240
|
-
}
|
|
241
|
-
renderAndAttach(t) {
|
|
242
|
-
;(this.parentElement = this.getParentElement()),
|
|
243
|
-
(this.dom = this.render({ ...t, parent: this.parentElement })),
|
|
244
|
-
this.parentElement && this.attach()
|
|
245
|
-
}
|
|
246
|
-
render(t) {
|
|
247
|
-
return this.template.render(t)
|
|
248
|
-
}
|
|
249
|
-
attach() {
|
|
250
|
-
this.parentElement && (this.parentElement.innerHTML = ''),
|
|
251
|
-
this.dom.forEach((t) => {
|
|
252
|
-
this.parentElement && this.parentElement.appendChild(t)
|
|
253
|
-
})
|
|
254
|
-
}
|
|
255
|
-
getParentElement() {
|
|
256
|
-
return this.renderKit.document.querySelector(this.selector)
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
const wt = (e, t, s) => {
|
|
260
|
-
const n = new _t(e, t, s)
|
|
261
|
-
return n.renderAndAttach(s), n
|
|
262
|
-
},
|
|
263
|
-
T = 'go-to-href',
|
|
264
|
-
k = 'go-to',
|
|
265
|
-
b = 'navigation:location-change',
|
|
266
|
-
$ = 'navigation:route-change',
|
|
267
|
-
St = Object.freeze(
|
|
268
|
-
Object.defineProperty(
|
|
269
|
-
{
|
|
270
|
-
__proto__: null,
|
|
271
|
-
linkNavigationEvent: T,
|
|
272
|
-
locationChangeEvent: b,
|
|
273
|
-
navigationEvent: k,
|
|
274
|
-
routeChangeEvent: $,
|
|
275
|
-
},
|
|
276
|
-
Symbol.toStringTag,
|
|
277
|
-
{ value: 'Module' },
|
|
278
|
-
),
|
|
279
|
-
),
|
|
280
|
-
P = (e) => {
|
|
281
|
-
e.create('route', { host: '', path: '', query: {} })
|
|
282
|
-
},
|
|
283
|
-
D = (e) => {
|
|
284
|
-
const t = e.closest('[href]')
|
|
285
|
-
return (t && t.getAttribute('href')) || ''
|
|
286
|
-
},
|
|
287
|
-
y = (e, { publish: t, window: s }) => {
|
|
288
|
-
s.history.pushState(null, '', e), t(b, null)
|
|
289
|
-
},
|
|
290
|
-
F = (e, t) => {
|
|
291
|
-
if (!e || !e.target) return
|
|
292
|
-
e.preventDefault()
|
|
293
|
-
const s = D(e.target)
|
|
294
|
-
y(s, t)
|
|
295
|
-
},
|
|
296
|
-
L = (e) =>
|
|
297
|
-
e
|
|
298
|
-
.replace(/^\?/, '')
|
|
299
|
-
.split('&')
|
|
300
|
-
.reduce((t, s) => {
|
|
301
|
-
if (!s) return t
|
|
302
|
-
const n = s.split('=')
|
|
303
|
-
return (t[n[0]] = n[1]), t
|
|
304
|
-
}, {}),
|
|
305
|
-
z = (e, t) => {
|
|
306
|
-
const { state: s, publish: n, window: r } = t,
|
|
307
|
-
{ host: o, pathname: a, search: l } = r.location,
|
|
308
|
-
u = a,
|
|
309
|
-
d = L(l),
|
|
310
|
-
c = { host: o, path: u, query: d }
|
|
311
|
-
s.store('route').update(c), n($, c)
|
|
312
|
-
},
|
|
313
|
-
B = (e) => {
|
|
314
|
-
const { subscribe: t } = e
|
|
315
|
-
t(T, F),
|
|
316
|
-
t(k, (s, n) => {
|
|
317
|
-
y(s, n)
|
|
318
|
-
})
|
|
319
|
-
},
|
|
320
|
-
V = (e) => {
|
|
321
|
-
const { publish: t, subscribe: s, state: n, window: r } = e
|
|
322
|
-
P(n), r.addEventListener('popstate', () => t(b, null)), s(b, z)
|
|
323
|
-
},
|
|
324
|
-
K = (e) => {
|
|
325
|
-
setTimeout(() => e.publish(b, null), 0)
|
|
326
|
-
},
|
|
327
|
-
R = (e) => {
|
|
328
|
-
V(e), B(e), K(e)
|
|
329
|
-
},
|
|
330
|
-
Nt = Object.freeze(
|
|
331
|
-
Object.defineProperty(
|
|
332
|
-
{
|
|
333
|
-
__proto__: null,
|
|
334
|
-
publishLocation: K,
|
|
335
|
-
startNavigation: R,
|
|
336
|
-
subscribeToHistoryChange: V,
|
|
337
|
-
subscribeToNavigation: B,
|
|
338
|
-
},
|
|
339
|
-
Symbol.toStringTag,
|
|
340
|
-
{ value: 'Module' },
|
|
341
|
-
),
|
|
342
|
-
)
|
|
343
|
-
class U {
|
|
344
|
-
constructor({
|
|
345
|
-
window: t,
|
|
346
|
-
document: s,
|
|
347
|
-
publish: n,
|
|
348
|
-
subscribe: r,
|
|
349
|
-
bus: o,
|
|
350
|
-
state: a,
|
|
351
|
-
renderKit: l,
|
|
352
|
-
}) {
|
|
353
|
-
;(this.window = t),
|
|
354
|
-
(this.document = s),
|
|
355
|
-
(this.publish = n),
|
|
356
|
-
(this.subscribe = r),
|
|
357
|
-
(this.bus = o),
|
|
358
|
-
(this.state = a),
|
|
359
|
-
(this.renderKit = l),
|
|
360
|
-
(this.roots = [])
|
|
361
|
-
}
|
|
362
|
-
render(t, s) {
|
|
363
|
-
const n = wt(t, s, this.renderKit)
|
|
364
|
-
return this.roots.push(n), n
|
|
365
|
-
}
|
|
366
|
-
startNavigation() {
|
|
367
|
-
R(this)
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
const jt = Object.freeze(
|
|
371
|
-
Object.defineProperty({ __proto__: null, App: U }, Symbol.toStringTag, {
|
|
372
|
-
value: 'Module',
|
|
373
|
-
}),
|
|
374
|
-
)
|
|
375
|
-
class q {
|
|
376
|
-
constructor() {
|
|
377
|
-
this.lookup = {}
|
|
378
|
-
}
|
|
379
|
-
add(t, s, n) {
|
|
380
|
-
this.ensureArrayFor(t)
|
|
381
|
-
const r = { listener: s, index: n, matcher: t }
|
|
382
|
-
return this.lookup[t].push(r), () => this.remove(r)
|
|
383
|
-
}
|
|
384
|
-
remove(t) {
|
|
385
|
-
this.lookup[t.matcher] &&
|
|
386
|
-
(this.lookup[t.matcher] = this.lookup[t.matcher].reduce(
|
|
387
|
-
(s, n) => (n !== t && s.push(n), s),
|
|
388
|
-
[],
|
|
389
|
-
))
|
|
390
|
-
}
|
|
391
|
-
matches(t) {
|
|
392
|
-
return this.lookup[t] || []
|
|
393
|
-
}
|
|
394
|
-
ensureArrayFor(t) {
|
|
395
|
-
this.lookup[t] || (this.lookup[t] = [])
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
class I {
|
|
399
|
-
constructor() {
|
|
400
|
-
this.lookup = []
|
|
401
|
-
}
|
|
402
|
-
add(t, s, n) {
|
|
403
|
-
const r = { listener: s, index: n, matcher: t }
|
|
404
|
-
return this.lookup.push(r), () => this.remove(r)
|
|
405
|
-
}
|
|
406
|
-
remove(t) {
|
|
407
|
-
this.lookup = this.lookup.reduce((s, n) => (n !== t && s.push(n), s), [])
|
|
408
|
-
}
|
|
409
|
-
matches(t) {
|
|
410
|
-
return this.lookup.filter((s) => s.matcher.test(t))
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
class J {
|
|
414
|
-
constructor() {
|
|
415
|
-
;(this.exactSubscriptions = new q()),
|
|
416
|
-
(this.fuzzySubscriptions = new I()),
|
|
417
|
-
(this.currentIndex = 0)
|
|
418
|
-
}
|
|
419
|
-
subscribe(t, s) {
|
|
420
|
-
let n
|
|
421
|
-
return (
|
|
422
|
-
typeof t == 'string'
|
|
423
|
-
? (n = this.exactSubscriptions.add(t, s, this.currentIndex))
|
|
424
|
-
: (n = this.fuzzySubscriptions.add(t, s, this.currentIndex)),
|
|
425
|
-
(this.currentIndex += 1),
|
|
426
|
-
n
|
|
427
|
-
)
|
|
428
|
-
}
|
|
429
|
-
publish(t, s) {
|
|
430
|
-
;[
|
|
431
|
-
...this.exactSubscriptions.matches(t),
|
|
432
|
-
...this.fuzzySubscriptions.matches(t),
|
|
433
|
-
]
|
|
434
|
-
.sort((r, o) => r.index - o.index)
|
|
435
|
-
.forEach((r) => {
|
|
436
|
-
r.listener(s, this.listenerOptions(t))
|
|
437
|
-
})
|
|
438
|
-
}
|
|
439
|
-
addListenerOptions(t) {
|
|
440
|
-
this.options = t
|
|
441
|
-
}
|
|
442
|
-
listenerOptions(t) {
|
|
443
|
-
return { eventName: t, ...this.options, publish: this.publish.bind(this) }
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
const H = () => {
|
|
447
|
-
const e = new J()
|
|
448
|
-
return {
|
|
449
|
-
bus: e,
|
|
450
|
-
publish: (n, r) => e.publish(n, r),
|
|
451
|
-
subscribe: (n, r) => e.subscribe(n, r),
|
|
452
|
-
}
|
|
453
|
-
},
|
|
454
|
-
Ot = Object.freeze(
|
|
455
|
-
Object.defineProperty(
|
|
456
|
-
{
|
|
457
|
-
__proto__: null,
|
|
458
|
-
ExactSubscriptions: q,
|
|
459
|
-
FuzzySubscriptions: I,
|
|
460
|
-
JaxsBus: J,
|
|
461
|
-
createBus: H,
|
|
462
|
-
},
|
|
463
|
-
Symbol.toStringTag,
|
|
464
|
-
{ value: 'Module' },
|
|
465
|
-
),
|
|
466
|
-
),
|
|
467
|
-
v = (e) => Array.isArray(e),
|
|
468
|
-
E = (e) => e !== null && !v(e) && typeof e == 'object',
|
|
469
|
-
Mt = (e, t) => e === t,
|
|
470
|
-
Tt = (e, t) => Object.keys(e).length === Object.keys(t).length,
|
|
471
|
-
kt = (e, t) =>
|
|
472
|
-
!(E(e) && E(t)) || !Tt(e, t)
|
|
473
|
-
? !1
|
|
474
|
-
: Object.keys(e).every((s) => {
|
|
475
|
-
const n = e[s],
|
|
476
|
-
r = t[s]
|
|
477
|
-
return x(n, r)
|
|
478
|
-
}),
|
|
479
|
-
$t = (e, t) =>
|
|
480
|
-
!(v(e) && v(t)) || e.length !== t.length
|
|
481
|
-
? !1
|
|
482
|
-
: e.every((s, n) => {
|
|
483
|
-
const r = t[n]
|
|
484
|
-
return x(s, r)
|
|
485
|
-
}),
|
|
486
|
-
x = (e, t) => (E(e) ? kt(e, t) : v(e) ? $t(e, t) : Mt(e, t))
|
|
487
|
-
class A {
|
|
488
|
-
constructor(t) {
|
|
489
|
-
;(this.name = t.name),
|
|
490
|
-
(this.parent = t.parent),
|
|
491
|
-
(this._value = t.value),
|
|
492
|
-
(this.initialValue = structuredClone(t.value))
|
|
493
|
-
}
|
|
494
|
-
get value() {
|
|
495
|
-
return this._value
|
|
496
|
-
}
|
|
497
|
-
set value(t) {
|
|
498
|
-
throw new Error('Cannot set value directly. Use an updater!')
|
|
499
|
-
}
|
|
500
|
-
reset() {
|
|
501
|
-
this._value = this.initialValue
|
|
502
|
-
}
|
|
503
|
-
update(t) {
|
|
504
|
-
if (typeof t == 'function') {
|
|
505
|
-
const s = this.getUpdatedValue(t)
|
|
506
|
-
this.updateValue(s)
|
|
507
|
-
} else this.updateValue(t)
|
|
508
|
-
}
|
|
509
|
-
updateValue(t) {
|
|
510
|
-
x(this._value, t) || ((this._value = t), this.parent.notify(this.name))
|
|
511
|
-
}
|
|
512
|
-
getUpdatedValue(t) {
|
|
513
|
-
return t(this.value)
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
class _ {
|
|
517
|
-
constructor(t) {
|
|
518
|
-
this.store = t
|
|
519
|
-
}
|
|
520
|
-
update(t) {
|
|
521
|
-
this.store.update(t)
|
|
522
|
-
}
|
|
523
|
-
reset() {
|
|
524
|
-
this.store.update(this.store.initialValue)
|
|
525
|
-
}
|
|
526
|
-
get value() {
|
|
527
|
-
return this.store.value
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
class Pt extends _ {
|
|
531
|
-
updateAttribute(t, s) {
|
|
532
|
-
const n = { ...this.value }
|
|
533
|
-
;(n[t] = s), this.update(n)
|
|
534
|
-
}
|
|
535
|
-
resetAttribute(t) {
|
|
536
|
-
const s = { ...this.value },
|
|
537
|
-
n = this.store.initialValue[t]
|
|
538
|
-
;(s[t] = n), this.update(s)
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
const Dt = (e) => new Pt(e)
|
|
542
|
-
class Ft extends _ {
|
|
543
|
-
push(t) {
|
|
544
|
-
const s = [...this.value, t]
|
|
545
|
-
this.update(s)
|
|
546
|
-
}
|
|
547
|
-
pop() {
|
|
548
|
-
const t = [...this.value],
|
|
549
|
-
s = t.pop()
|
|
550
|
-
return this.update(t), s
|
|
551
|
-
}
|
|
552
|
-
unshift(t) {
|
|
553
|
-
const s = [t, ...this.value]
|
|
554
|
-
this.update(s)
|
|
555
|
-
}
|
|
556
|
-
shift() {
|
|
557
|
-
const t = [...this.value],
|
|
558
|
-
s = t.shift()
|
|
559
|
-
return this.update(t), s
|
|
560
|
-
}
|
|
561
|
-
addSorter(t, s) {
|
|
562
|
-
this[t] = () => {
|
|
563
|
-
this.sortBy(s)
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
sortBy(t) {
|
|
567
|
-
const s = [...this.value]
|
|
568
|
-
s.sort(t), this.update(s)
|
|
569
|
-
}
|
|
570
|
-
insertAt(t, s) {
|
|
571
|
-
const n = [...this.value]
|
|
572
|
-
n.splice(t, 0, s), this.update(n)
|
|
573
|
-
}
|
|
574
|
-
remove(t) {
|
|
575
|
-
const s = this.value.reduce((n, r) => (r !== t && n.push(r), n), [])
|
|
576
|
-
this.update(s)
|
|
577
|
-
}
|
|
578
|
-
removeBy(t) {
|
|
579
|
-
const s = this.value.reduce((n, r) => (t(r) || n.push(r), n), [])
|
|
580
|
-
this.update(s)
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
const Lt = (e) => new Ft(e)
|
|
584
|
-
class zt extends _ {
|
|
585
|
-
toggle() {
|
|
586
|
-
const t = !this.value
|
|
587
|
-
this.update(t)
|
|
588
|
-
}
|
|
589
|
-
setTrue() {
|
|
590
|
-
this.update(!0)
|
|
591
|
-
}
|
|
592
|
-
setFalse() {
|
|
593
|
-
this.update(!1)
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
const Bt = { object: Dt, list: Lt, boolean: (e) => new zt(e) },
|
|
597
|
-
w = 'state'
|
|
598
|
-
class G {
|
|
599
|
-
constructor(t) {
|
|
600
|
-
;(this.publisher = t),
|
|
601
|
-
(this.stores = {}),
|
|
602
|
-
(this.eventNamePrefix = w),
|
|
603
|
-
(this.notifications = new Set()),
|
|
604
|
-
(this.inTransaction = !1)
|
|
605
|
-
}
|
|
606
|
-
create(t, s) {
|
|
607
|
-
const n = new A({ name: t, parent: this, value: s })
|
|
608
|
-
return (this.stores[t] = n), n
|
|
609
|
-
}
|
|
610
|
-
store(t) {
|
|
611
|
-
return this.stores[t] || new A({ name: t, parent: this, value: void 0 })
|
|
612
|
-
}
|
|
613
|
-
get(t) {
|
|
614
|
-
return this.store(t).value
|
|
615
|
-
}
|
|
616
|
-
getAll(t) {
|
|
617
|
-
return t.reduce((s, n) => ((s[n] = this.get(n)), s), {})
|
|
618
|
-
}
|
|
619
|
-
notify(t) {
|
|
620
|
-
this.inTransaction ? this.notifications.add(t) : this.publish(t)
|
|
621
|
-
}
|
|
622
|
-
update(t, s) {
|
|
623
|
-
this.store(t).update(s)
|
|
624
|
-
}
|
|
625
|
-
transaction(t) {
|
|
626
|
-
;(this.inTransaction = !0),
|
|
627
|
-
t(this.stores),
|
|
628
|
-
(this.inTransaction = !1),
|
|
629
|
-
this.publishAll()
|
|
630
|
-
}
|
|
631
|
-
publishAll() {
|
|
632
|
-
this.notifications.forEach((t) => {
|
|
633
|
-
this.publish(t)
|
|
634
|
-
}),
|
|
635
|
-
this.notifications.clear()
|
|
636
|
-
}
|
|
637
|
-
publish(t) {
|
|
638
|
-
this.publisher(this.event(t), { state: this, store: this.store(t) })
|
|
639
|
-
}
|
|
640
|
-
event(t) {
|
|
641
|
-
return `${this.eventNamePrefix}:${t}`
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
const C = (e) => new G(e),
|
|
645
|
-
Vt = Object.freeze(
|
|
646
|
-
Object.defineProperty(
|
|
647
|
-
{
|
|
648
|
-
__proto__: null,
|
|
649
|
-
State: G,
|
|
650
|
-
Store: A,
|
|
651
|
-
createState: C,
|
|
652
|
-
eventName: w,
|
|
653
|
-
updaters: Bt,
|
|
654
|
-
},
|
|
655
|
-
Symbol.toStringTag,
|
|
656
|
-
{ value: 'Module' },
|
|
657
|
-
),
|
|
658
|
-
)
|
|
659
|
-
class Kt {
|
|
660
|
-
constructor(t) {
|
|
661
|
-
this.setupDomEnvironment(t)
|
|
662
|
-
}
|
|
663
|
-
setup() {
|
|
664
|
-
return (
|
|
665
|
-
this.setupBus(),
|
|
666
|
-
this.setupState(),
|
|
667
|
-
this.addBusOptions(),
|
|
668
|
-
this.setRenderKit(),
|
|
669
|
-
new U({
|
|
670
|
-
window: this.window,
|
|
671
|
-
document: this.document,
|
|
672
|
-
publish: this.publish,
|
|
673
|
-
subscribe: this.subscribe,
|
|
674
|
-
bus: this.bus,
|
|
675
|
-
state: this.state,
|
|
676
|
-
renderKit: this.renderKit,
|
|
677
|
-
})
|
|
678
|
-
)
|
|
679
|
-
}
|
|
680
|
-
setupDomEnvironment(t) {
|
|
681
|
-
t.window
|
|
682
|
-
? ((this.window = t.window), (this.document = this.window.document))
|
|
683
|
-
: t.document
|
|
684
|
-
? ((this.window = t.document.defaultView),
|
|
685
|
-
(this.document = t.document))
|
|
686
|
-
: ((this.window = window), (this.document = document))
|
|
687
|
-
}
|
|
688
|
-
setupBus() {
|
|
689
|
-
const { publish: t, subscribe: s, bus: n } = H()
|
|
690
|
-
;(this.publish = t), (this.subscribe = s), (this.bus = n)
|
|
691
|
-
}
|
|
692
|
-
setupState() {
|
|
693
|
-
this.state = C(this.publish)
|
|
694
|
-
}
|
|
695
|
-
addBusOptions() {
|
|
696
|
-
this.bus.addListenerOptions({
|
|
697
|
-
state: this.state,
|
|
698
|
-
document: this.document,
|
|
699
|
-
window: this.window,
|
|
700
|
-
})
|
|
701
|
-
}
|
|
702
|
-
setRenderKit() {
|
|
703
|
-
this.renderKit = {
|
|
704
|
-
publish: this.publish,
|
|
705
|
-
subscribe: this.subscribe,
|
|
706
|
-
state: this.state,
|
|
707
|
-
document: this.document,
|
|
708
|
-
window: this.window,
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
const Rt = (e = {}) => {
|
|
713
|
-
const s = new Kt(e).setup()
|
|
714
|
-
return s.startNavigation(), s
|
|
715
|
-
}
|
|
716
|
-
var i = ((e) => (
|
|
717
|
-
(e[(e.removeNode = 0)] = 'removeNode'),
|
|
718
|
-
(e[(e.insertNode = 1)] = 'insertNode'),
|
|
719
|
-
(e[(e.replaceNode = 2)] = 'replaceNode'),
|
|
720
|
-
(e[(e.removeAttribute = 3)] = 'removeAttribute'),
|
|
721
|
-
(e[(e.addAttribute = 4)] = 'addAttribute'),
|
|
722
|
-
(e[(e.updateAttribute = 5)] = 'updateAttribute'),
|
|
723
|
-
(e[(e.removeEvent = 6)] = 'removeEvent'),
|
|
724
|
-
(e[(e.addEvent = 7)] = 'addEvent'),
|
|
725
|
-
(e[(e.updateEvent = 8)] = 'updateEvent'),
|
|
726
|
-
(e[(e.changeValue = 9)] = 'changeValue'),
|
|
727
|
-
(e[(e.changeText = 10)] = 'changeText'),
|
|
728
|
-
e
|
|
729
|
-
))(i || {})
|
|
730
|
-
const Ut = Object.freeze(
|
|
731
|
-
Object.defineProperty(
|
|
732
|
-
{ __proto__: null, ChangeInstructionTypes: i },
|
|
733
|
-
Symbol.toStringTag,
|
|
734
|
-
{ value: 'Module' },
|
|
735
|
-
),
|
|
736
|
-
),
|
|
737
|
-
qt = (e, t) => ({ source: e, target: t, type: i.changeText, data: {} }),
|
|
738
|
-
It = (e, t) => ({ source: e, target: t, type: i.replaceNode, data: {} }),
|
|
739
|
-
Jt = (e, t, s) => ({
|
|
740
|
-
source: e,
|
|
741
|
-
target: t,
|
|
742
|
-
data: s,
|
|
743
|
-
type: i.removeAttribute,
|
|
744
|
-
}),
|
|
745
|
-
Ht = (e, t, s) => ({ source: e, target: t, data: s, type: i.addAttribute }),
|
|
746
|
-
Gt = (e, t, s) => ({
|
|
747
|
-
source: e,
|
|
748
|
-
target: t,
|
|
749
|
-
data: s,
|
|
750
|
-
type: i.updateAttribute,
|
|
751
|
-
}),
|
|
752
|
-
Ct = (e, t, s) => ({ source: e, target: t, data: s, type: i.removeEvent }),
|
|
753
|
-
Qt = (e, t, s) => ({ source: e, target: t, data: s, type: i.addEvent }),
|
|
754
|
-
Wt = (e, t, s) => ({ source: e, target: t, data: s, type: i.updateEvent }),
|
|
755
|
-
Q = (e) => ({ source: e, target: e, type: i.removeNode, data: {} }),
|
|
756
|
-
S = (e, t) => ({ target: e, source: e, type: i.insertNode, data: t }),
|
|
757
|
-
Xt = (e, t, s) => ({ source: e, target: t, type: i.changeValue, data: s }),
|
|
758
|
-
Yt = (e, t) => (e.type > t.type ? 1 : e.type < t.type ? -1 : 0),
|
|
759
|
-
W = { index: -1 }
|
|
760
|
-
class Zt {
|
|
761
|
-
constructor() {
|
|
762
|
-
this.map = {}
|
|
763
|
-
}
|
|
764
|
-
populate(t) {
|
|
765
|
-
t.forEach((s, n) => {
|
|
766
|
-
const r = s.__jsx
|
|
767
|
-
r &&
|
|
768
|
-
((this.map[r] = this.map[r] || []),
|
|
769
|
-
this.map[r].push({ element: s, index: n }))
|
|
770
|
-
})
|
|
771
|
-
}
|
|
772
|
-
pullMatch(t) {
|
|
773
|
-
const s = t && t.__jsx
|
|
774
|
-
return !s || !(this.map[s] && this.map[s].length)
|
|
775
|
-
? W
|
|
776
|
-
: this.map[s].shift()
|
|
777
|
-
}
|
|
778
|
-
clear(t) {
|
|
779
|
-
const s = t && t.__jsx
|
|
780
|
-
if (!(s && this.map[s] && this.map[s].length)) return
|
|
781
|
-
const n = this.map[s]
|
|
782
|
-
this.map[s] = n.reduce((r, o) => (o.element !== t && r.push(o), r), [])
|
|
783
|
-
}
|
|
784
|
-
check(t) {
|
|
785
|
-
const s = t && t.__jsx
|
|
786
|
-
return s && this.map[s] ? this.map[s].length > 0 : !1
|
|
787
|
-
}
|
|
788
|
-
remaining() {
|
|
789
|
-
return Object.values(this.map).flat()
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
const X = (e) => {
|
|
793
|
-
const t = new Zt()
|
|
794
|
-
return t.populate(e), t
|
|
795
|
-
},
|
|
796
|
-
Y = (e, t, s = !1) => {
|
|
797
|
-
const n = [],
|
|
798
|
-
r = e.attributes,
|
|
799
|
-
o = r.length,
|
|
800
|
-
a = t.attributes,
|
|
801
|
-
l = a.length
|
|
802
|
-
let u, d, c
|
|
803
|
-
for (u = 0; u < o; u++) {
|
|
804
|
-
c = null
|
|
805
|
-
const h = r.item(u)
|
|
806
|
-
if (h) {
|
|
807
|
-
for (d = 0; d < l; d++) {
|
|
808
|
-
const m = a.item(d)
|
|
809
|
-
if (m && h.name == m.name) {
|
|
810
|
-
c = m
|
|
811
|
-
break
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
c
|
|
815
|
-
? h.value !== c.value &&
|
|
816
|
-
n.push(Gt(e, t, { name: h.name, value: c.value, isSvg: s }))
|
|
817
|
-
: n.push(Jt(e, t, { name: h.name, isSvg: s }))
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
for (u = 0; u < l; u++) {
|
|
821
|
-
c = null
|
|
822
|
-
const h = a.item(u)
|
|
823
|
-
if (h) {
|
|
824
|
-
for (d = 0; d < o; d++) {
|
|
825
|
-
const m = r.item(d)
|
|
826
|
-
if (m && m.name == h.name) {
|
|
827
|
-
c = m
|
|
828
|
-
break
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
c || n.push(Ht(e, t, { name: h.name, value: h.value, isSvg: s }))
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
return n
|
|
835
|
-
},
|
|
836
|
-
te = (e, t) => {
|
|
837
|
-
const s = [],
|
|
838
|
-
n = e.eventMaps,
|
|
839
|
-
r = t.eventMaps,
|
|
840
|
-
o = Object.keys(n),
|
|
841
|
-
a = Object.keys(r)
|
|
842
|
-
return (
|
|
843
|
-
o.forEach((l) => {
|
|
844
|
-
const u = n[l],
|
|
845
|
-
d = r[l]
|
|
846
|
-
d
|
|
847
|
-
? d.busEvent !== u.busEvent &&
|
|
848
|
-
s.push(
|
|
849
|
-
Wt(e, t, {
|
|
850
|
-
name: l,
|
|
851
|
-
targetValue: d.listener,
|
|
852
|
-
sourceValue: u.listener,
|
|
853
|
-
}),
|
|
854
|
-
)
|
|
855
|
-
: s.push(Ct(e, t, { name: u.domEvent, value: u.listener }))
|
|
856
|
-
}),
|
|
857
|
-
a.forEach((l) => {
|
|
858
|
-
const u = n[l],
|
|
859
|
-
d = r[l]
|
|
860
|
-
u || s.push(Qt(e, t, { name: d.domEvent, value: d.listener }))
|
|
861
|
-
}),
|
|
862
|
-
s
|
|
863
|
-
)
|
|
864
|
-
},
|
|
865
|
-
ee = (e) => e.tagName !== 'INPUT',
|
|
866
|
-
se = (e, t) => e.value === t.value,
|
|
867
|
-
ne = (e, t) => {
|
|
868
|
-
if (ee(e) || se(e, t)) return []
|
|
869
|
-
const s = e,
|
|
870
|
-
n = t
|
|
871
|
-
return [Xt(s, n, { name: 'value', value: n.value })]
|
|
872
|
-
},
|
|
873
|
-
re = (e, t) => {
|
|
874
|
-
const s = Y(e, t),
|
|
875
|
-
n = te(e, t),
|
|
876
|
-
r = ne(e, t)
|
|
877
|
-
return s.concat(n).concat(r)
|
|
878
|
-
},
|
|
879
|
-
oe = (e, t) => Y(e, t, !0),
|
|
880
|
-
ie = (e, t) => (e.textContent !== t.textContent ? [qt(e, t)] : []),
|
|
881
|
-
ue = (e, t, s) => {
|
|
882
|
-
let n = []
|
|
883
|
-
if (e.nodeType === 1 && ct(e)) {
|
|
884
|
-
const r = e,
|
|
885
|
-
o = t,
|
|
886
|
-
a = oe(r, o),
|
|
887
|
-
l = s(r.childNodes, o.childNodes, r)
|
|
888
|
-
n = a.concat(l)
|
|
889
|
-
} else if (e.nodeType === 1) {
|
|
890
|
-
const r = e,
|
|
891
|
-
o = t,
|
|
892
|
-
a = re(r, o),
|
|
893
|
-
l = s(r.childNodes, o.childNodes, r)
|
|
894
|
-
n = a.concat(l)
|
|
895
|
-
} else e.nodeType === 3 && (n = ie(e, t))
|
|
896
|
-
return n
|
|
897
|
-
},
|
|
898
|
-
Z = (e, t, s) => {
|
|
899
|
-
const n = [],
|
|
900
|
-
r = ae(e, t),
|
|
901
|
-
o = X(e),
|
|
902
|
-
a = X(t),
|
|
903
|
-
l = []
|
|
904
|
-
let u = 0
|
|
905
|
-
for (; u < r; u++) {
|
|
906
|
-
const c = e[u],
|
|
907
|
-
h = t[u]
|
|
908
|
-
if (h && a.check(h)) {
|
|
909
|
-
const m = o.pullMatch(h)
|
|
910
|
-
a.clear(h),
|
|
911
|
-
m.element
|
|
912
|
-
? (m.index !== u && n.push(S(m.element, { parent: s, index: u })),
|
|
913
|
-
l.push({ source: m.element, target: h }))
|
|
914
|
-
: c
|
|
915
|
-
? a.check(c)
|
|
916
|
-
? n.push(S(h, { parent: s, index: u }))
|
|
917
|
-
: (o.clear(c), n.push(It(c, h)))
|
|
918
|
-
: n.push(S(h, { parent: s, index: u }))
|
|
919
|
-
} else c && o.pullMatch(c).element && n.push(Q(c))
|
|
920
|
-
}
|
|
921
|
-
o.remaining().forEach(({ element: c }) => {
|
|
922
|
-
n.push(Q(c))
|
|
923
|
-
})
|
|
924
|
-
const d = l.reduce(
|
|
925
|
-
(c, { source: h, target: m }) => c.concat(ue(h, m, Z)),
|
|
926
|
-
[],
|
|
927
|
-
)
|
|
928
|
-
return n.concat(d).sort(Yt)
|
|
929
|
-
},
|
|
930
|
-
ae = (e, t) => {
|
|
931
|
-
const s = e.length,
|
|
932
|
-
n = t.length
|
|
933
|
-
return s > n ? s : n
|
|
934
|
-
},
|
|
935
|
-
ce = (e, t, s) => {
|
|
936
|
-
const n = Z(e, t, s)
|
|
937
|
-
return (
|
|
938
|
-
n.forEach((r) => {
|
|
939
|
-
le(r)
|
|
940
|
-
}),
|
|
941
|
-
n
|
|
942
|
-
)
|
|
943
|
-
},
|
|
944
|
-
le = (e) => {
|
|
945
|
-
;(Ae[e.type] || he)(e)
|
|
946
|
-
},
|
|
947
|
-
he = (e) => {},
|
|
948
|
-
de = (e) => {
|
|
949
|
-
const { source: t, target: s } = e
|
|
950
|
-
t.nodeValue = s.textContent
|
|
951
|
-
},
|
|
952
|
-
pe = (e) => {
|
|
953
|
-
const { source: t } = e
|
|
954
|
-
t.remove()
|
|
955
|
-
},
|
|
956
|
-
me = (e) => {
|
|
957
|
-
const { target: t, data: s } = e,
|
|
958
|
-
{ parent: n, index: r } = s,
|
|
959
|
-
o = n.childNodes[r]
|
|
960
|
-
o ? o && o !== t && n.insertBefore(t, o) : n.appendChild(t)
|
|
961
|
-
},
|
|
962
|
-
fe = (e) => {
|
|
963
|
-
const { source: t, target: s } = e
|
|
964
|
-
t.replaceWith(s)
|
|
965
|
-
},
|
|
966
|
-
be = (e) => {
|
|
967
|
-
const { source: t, data: s } = e,
|
|
968
|
-
{ name: n, isSvg: r } = s
|
|
969
|
-
r ? t.removeAttributeNS(null, n) : t.removeAttribute(n)
|
|
970
|
-
},
|
|
971
|
-
tt = (e) => {
|
|
972
|
-
const { source: t, data: s } = e,
|
|
973
|
-
{ name: n, value: r, isSvg: o } = s
|
|
974
|
-
o ? t.setAttributeNS(null, n, r) : t.setAttribute(n, r)
|
|
975
|
-
},
|
|
976
|
-
ve = (e) => {
|
|
977
|
-
tt(e)
|
|
978
|
-
},
|
|
979
|
-
ge = (e) => {
|
|
980
|
-
const t = e.data,
|
|
981
|
-
s = e.source,
|
|
982
|
-
{ name: n, value: r } = t
|
|
983
|
-
s.removeEventListener(n, r)
|
|
984
|
-
},
|
|
985
|
-
ye = (e) => {
|
|
986
|
-
const t = e.data,
|
|
987
|
-
s = e.source,
|
|
988
|
-
{ name: n, value: r } = t
|
|
989
|
-
s.addEventListener(n, r)
|
|
990
|
-
},
|
|
991
|
-
Ee = (e) => {
|
|
992
|
-
const t = e.data,
|
|
993
|
-
s = e.source,
|
|
994
|
-
{ name: n, sourceValue: r, targetValue: o } = t
|
|
995
|
-
s.removeEventListener(n, r), s.addEventListener(n, o)
|
|
996
|
-
},
|
|
997
|
-
xe = (e) => {
|
|
998
|
-
const t = e.data,
|
|
999
|
-
s = e.source,
|
|
1000
|
-
{ value: n } = t
|
|
1001
|
-
s.value = n
|
|
1002
|
-
},
|
|
1003
|
-
Ae = {
|
|
1004
|
-
[i.changeText]: de,
|
|
1005
|
-
[i.removeNode]: pe,
|
|
1006
|
-
[i.insertNode]: me,
|
|
1007
|
-
[i.replaceNode]: fe,
|
|
1008
|
-
[i.removeAttribute]: be,
|
|
1009
|
-
[i.addAttribute]: tt,
|
|
1010
|
-
[i.updateAttribute]: ve,
|
|
1011
|
-
[i.removeEvent]: ge,
|
|
1012
|
-
[i.addEvent]: ye,
|
|
1013
|
-
[i.updateEvent]: Ee,
|
|
1014
|
-
[i.changeValue]: xe,
|
|
1015
|
-
},
|
|
1016
|
-
_e = (e, t, s) => {
|
|
1017
|
-
const n = [...t]
|
|
1018
|
-
return (
|
|
1019
|
-
e.forEach((r) => {
|
|
1020
|
-
we(r, n, s)
|
|
1021
|
-
}),
|
|
1022
|
-
n
|
|
1023
|
-
)
|
|
1024
|
-
},
|
|
1025
|
-
we = (e, t, s) => {
|
|
1026
|
-
const n = Oe[e.type]
|
|
1027
|
-
n && n(e, t, s)
|
|
1028
|
-
},
|
|
1029
|
-
Se = (e, t) => {
|
|
1030
|
-
const { source: s } = e,
|
|
1031
|
-
n = t.indexOf(s)
|
|
1032
|
-
n >= 0 && t.splice(n, 1)
|
|
1033
|
-
},
|
|
1034
|
-
Ne = (e, t, s) => {
|
|
1035
|
-
const { target: n } = e,
|
|
1036
|
-
r = e.data,
|
|
1037
|
-
{ index: o, parent: a } = r
|
|
1038
|
-
s === a && t.splice(o, 0, n)
|
|
1039
|
-
},
|
|
1040
|
-
je = (e, t) => {
|
|
1041
|
-
const { target: s, source: n } = e,
|
|
1042
|
-
r = t.indexOf(n)
|
|
1043
|
-
r >= 0 && (t[r] = s)
|
|
1044
|
-
},
|
|
1045
|
-
Oe = { [i.removeNode]: Se, [i.insertNode]: Ne, [i.replaceNode]: je }
|
|
1046
|
-
class Me {
|
|
1047
|
-
constructor({
|
|
1048
|
-
Template: t,
|
|
1049
|
-
subscriptions: s,
|
|
1050
|
-
attributes: n,
|
|
1051
|
-
viewModel: r,
|
|
1052
|
-
}) {
|
|
1053
|
-
;(this.Template = t),
|
|
1054
|
-
(this.viewModel = r),
|
|
1055
|
-
(this.attributes = n),
|
|
1056
|
-
(this.subscriptions = s),
|
|
1057
|
-
(this.dom = []),
|
|
1058
|
-
(this.parentElement = null)
|
|
1059
|
-
}
|
|
1060
|
-
render(t) {
|
|
1061
|
-
return (
|
|
1062
|
-
(this.parentElement = t.parent),
|
|
1063
|
-
(this.renderKit = t),
|
|
1064
|
-
this.subscribeForRerender(),
|
|
1065
|
-
(this.dom = this.generateDom(t)),
|
|
1066
|
-
this.dom
|
|
1067
|
-
)
|
|
1068
|
-
}
|
|
1069
|
-
generateDom(t) {
|
|
1070
|
-
const s = {
|
|
1071
|
-
...this.attributes,
|
|
1072
|
-
...this.viewModel(t.state.getAll(this.subscriptions)),
|
|
1073
|
-
},
|
|
1074
|
-
n = this.Template(s)
|
|
1075
|
-
return n ? n.render(t) : []
|
|
1076
|
-
}
|
|
1077
|
-
rerender() {
|
|
1078
|
-
if (!this.parentElement && this.dom[0]) {
|
|
1079
|
-
const n = this.dom[0].parentElement
|
|
1080
|
-
this.parentElement = n
|
|
1081
|
-
}
|
|
1082
|
-
const t = this.generateDom(this.renderKit),
|
|
1083
|
-
s = ce(this.dom, t, this.parentElement)
|
|
1084
|
-
this.dom = _e(s, this.dom, this.parentElement)
|
|
1085
|
-
}
|
|
1086
|
-
subscribeForRerender() {
|
|
1087
|
-
const { subscribe: t } = this.renderKit
|
|
1088
|
-
this.subscriptions.forEach((s) => {
|
|
1089
|
-
t(this.eventName(s), () => this.rerender())
|
|
1090
|
-
})
|
|
1091
|
-
}
|
|
1092
|
-
eventName(t) {
|
|
1093
|
-
return `${w}:${t}`
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
const Te = (e) => e,
|
|
1097
|
-
et = ({ Template: e, viewModel: t, subscriptions: s }) => (
|
|
1098
|
-
(s = s || []),
|
|
1099
|
-
(t = t || Te),
|
|
1100
|
-
(n) =>
|
|
1101
|
-
new Me({ Template: e, viewModel: t, subscriptions: s, attributes: n })
|
|
1102
|
-
),
|
|
1103
|
-
ke = Object.freeze(
|
|
1104
|
-
Object.defineProperty(
|
|
1105
|
-
{
|
|
1106
|
-
__proto__: null,
|
|
1107
|
-
createRouteState: P,
|
|
1108
|
-
events: St,
|
|
1109
|
-
extractQueryParams: L,
|
|
1110
|
-
findHref: D,
|
|
1111
|
-
navigate: y,
|
|
1112
|
-
onLinkClick: F,
|
|
1113
|
-
onLocationChange: z,
|
|
1114
|
-
start: Nt,
|
|
1115
|
-
},
|
|
1116
|
-
Symbol.toStringTag,
|
|
1117
|
-
{ value: 'Module' },
|
|
1118
|
-
),
|
|
1119
|
-
),
|
|
1120
|
-
$e =
|
|
1121
|
-
(e) =>
|
|
1122
|
-
({ path: t }) =>
|
|
1123
|
-
t === e,
|
|
1124
|
-
Pe = () => !0,
|
|
1125
|
-
st =
|
|
1126
|
-
(e) =>
|
|
1127
|
-
({ route: t }) => {
|
|
1128
|
-
const s = e.find((n) => n.match(t))
|
|
1129
|
-
return s && s.Partial
|
|
1130
|
-
},
|
|
1131
|
-
De = Object.freeze(
|
|
1132
|
-
Object.defineProperty(
|
|
1133
|
-
{ __proto__: null, buildRouter: st, catchAll: Pe, exactPathMatch: $e },
|
|
1134
|
-
Symbol.toStringTag,
|
|
1135
|
-
{ value: 'Module' },
|
|
1136
|
-
),
|
|
1137
|
-
),
|
|
1138
|
-
Fe = () => ({ render: (e, t) => [] }),
|
|
1139
|
-
Le = (e) => {
|
|
1140
|
-
const t = st(e)
|
|
1141
|
-
return et({
|
|
1142
|
-
Template: ({ route: n }) => (t({ route: n }) || Fe)(),
|
|
1143
|
-
subscriptions: ['route'],
|
|
1144
|
-
})
|
|
1145
|
-
}
|
|
1146
|
-
;(p.JaxsTypes = Ut),
|
|
1147
|
-
(p.appBuilding = jt),
|
|
1148
|
-
(p.bind = et),
|
|
1149
|
-
(p.createApp = Rt),
|
|
1150
|
-
(p.jsx = M),
|
|
1151
|
-
(p.messageBus = Ot),
|
|
1152
|
-
(p.navigation = ke),
|
|
1153
|
-
(p.routedView = Le),
|
|
1154
|
-
(p.routing = De),
|
|
1155
|
-
(p.state = Vt),
|
|
1156
|
-
Object.defineProperty(p, Symbol.toStringTag, { value: 'Module' })
|
|
1157
|
-
})
|
|
1
|
+
(function(p,f){typeof exports=="object"&&typeof module<"u"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):(p=typeof globalThis<"u"?globalThis:p||self,f(p.jaxs={}))})(this,function(p){"use strict";const f=(e,t)=>t.createElement(e),nt=(e,t)=>{for(const s in t){if(s==="__self")continue;const n=t[s].toString();if(s==="value"){const r=e;r.value!==n&&(r.value=n)}else e.setAttribute(s,n)}},rt=(e,t,s)=>{const n={};for(const r in t){const i=t[r],a=l=>s(i,l);e.addEventListener(r,a),n[r]={domEvent:r,busEvent:i,listener:a}}e.eventMaps=n},it=(e,t,s,n)=>{const r=f(e,n.document);return nt(r,t),rt(r,s,n.publish),r},g="http://www.w3.org/2000/svg",ot={animate:!0,animateMotion:!0,animateTransform:!0,circle:!0,clipPath:!0,defs:!0,desc:!0,ellipse:!0,feBlend:!0,feColorMatrix:!0,feComponentTransfer:!0,feComposite:!0,feConvolveMatrix:!0,feDiffuseLighting:!0,feDisplacementMap:!0,feDistantLight:!0,feDropShadow:!0,feFlood:!0,feFuncA:!0,feFuncB:!0,feFuncG:!0,feFuncR:!0,feGaussianBlur:!0,feImage:!0,feMerge:!0,feMergeNode:!0,feMorphology:!0,feOffset:!0,fePointLight:!0,feSpecularLighting:!0,feSpotLight:!0,feTile:!0,feTurbulence:!0,filter:!0,foreignObject:!0,g:!0,image:!0,line:!0,linearGradient:!0,marker:!0,mask:!0,metadata:!0,mpath:!0,path:!0,pattern:!0,polygon:!0,polyline:!0,radialGradient:!0,rect:!0,script:!0,set:!0,stop:!0,style:!0,svg:!0,switch:!0,symbol:!0,text:!0,textPath:!0,title:!0,tspan:!0,use:!0,view:!0},ut=(e,t)=>!!(ot[e]||e==="a"&&t===g),at=(e,t,s)=>{const n=s.createElementNS(g,e);for(const r in t)r==="__self"||r==="xmlns"||n.setAttributeNS(null,r,t[r].toString());return n},ct=e=>e.namespaceURI===g,lt=(e,t)=>t.createTextNode(e);class ht{constructor(t){this.value=t.toString()}render(t){const s=lt(this.value,t.document);return s.__jsx="TextNode",[s]}}const dt=e=>typeof e=="string"||typeof e=="number",pt=e=>new ht(e),mt=e=>dt(e)?pt(e):e,ft=e=>bt(e).map(mt).flat(),bt=e=>Array.isArray(e)?e.flat():e?[e]:[],S=(e,t={})=>e||t.children||[],vt=(e,t="")=>{const s={},n={};for(const r in e){const i=e[r];if(r.match(/^on.+/i)){const a=r.slice(2).toLowerCase();n[a]=i?i.toString():""}else{if(i===!1)continue;r==="__source"?s.__source=e.__source:s[r]=gt(r,i,t)}}return{attributes:s,events:n}},gt=(e,t,s="")=>t==null?s:t.toString(),yt=(e,t)=>{const s=e||{},n=S(t,s);return s.children=s.children||n,s},T=(e,t,s,n=[])=>e.reduce(Et(t,s),n).flat(),Et=(e,t)=>(s,n)=>n?Array.isArray(n)?T(n,e,t,s):(n.render(e,t).forEach(r=>s.push(r)),s):s;class j{constructor(t){this.collection=ft(t)}render(t,s){this.parentElement=s;const n=this.generateDom(t);return this.attachToParent(n),n}generateDom(t){return T(this.collection,t,this.parentElement)}attachToParent(t){if(this.parentElement===void 0)return;const s=this.parentElement;t.forEach(n=>s.appendChild(n))}}class At{constructor(t,s){this.type=t,this.attributes=s}generate(){return this.attributes.key||this.sourceKey()||this.createKeyFromAttributes()}sourceKey(){if(this.attributes.__source){const{fileName:t,lineNumber:s,columnNumber:n}=this.attributes.__source;return`${t}:${s}:${n}`}}createKeyFromAttributes(){const t=this.attributes.id?`#${this.attributes.id}`:"",s=this.attributes.type?`[type=${this.attributes.type}]`:"",n=this.attributes.name?`[name=${this.attributes.name}]`:"";return`${this.type}${t}${s}${n}`}}class xt{constructor(t,s,n=[]){this.type=t;const{events:r,attributes:i}=vt(s);this.events=r,this.attributes=i,this.isSvg=ut(this.type,this.attributes.xmlns),this.children=new j(n)}render(t){const s=this.generateDom(t);return s?(this.children.render(t,s),[s]):[]}generateDom(t){return this.isSvg?this.generateSvgDom(t):this.generateHtmlDom(t)}generateHtmlDom(t){const s=it(this.type,this.attributes,this.events,t);return s.__jsx=this.jsxKey(),s}generateSvgDom(t){const s=at(this.type,this.attributes,t.document);return s.__jsx=this.jsxKey(),s}jsxKey(){return new At(this.type,this.attributes).generate()}}const O=(e,t,...s)=>typeof e=="string"?new xt(e,t,s):e(yt(t,s));O.fragment=(e,t)=>{const s=S(t,e);return new j(s)};class wt{constructor(t,s,n){this.template=t,this.selector=s,this.renderKit=n,this.dom=[]}renderAndAttach(t){this.parentElement=this.getParentElement(),this.dom=this.render({...t,parent:this.parentElement}),this.parentElement&&this.attach()}render(t){return this.template.render(t)}attach(){this.parentElement&&(this.parentElement.innerHTML=""),this.dom.forEach(t=>{this.parentElement&&this.parentElement.appendChild(t)})}getParentElement(){return this.renderKit.document.querySelector(this.selector)}}const Nt=(e,t,s)=>{const n=new wt(e,t,s);return n.renderAndAttach(s),n},M="go-to-href",k="go-to",b="navigation:location-change",$="navigation:route-change",_t=Object.freeze(Object.defineProperty({__proto__:null,linkNavigationEvent:M,locationChangeEvent:b,navigationEvent:k,routeChangeEvent:$},Symbol.toStringTag,{value:"Module"})),D=e=>{e.create("route",{host:"",path:"",query:{}})},P=e=>{const t=e.closest("[href]");return t&&t.getAttribute("href")||""},y=(e,{publish:t,window:s})=>{s.history.pushState(null,"",e),t(b,null)},V=(e,t)=>{if(!e||!e.target)return;e.preventDefault();const s=P(e.target);y(s,t)},F=e=>e.replace(/^\?/,"").split("&").reduce((t,s)=>{if(!s)return t;const n=s.split("=");return t[n[0]]=n[1],t},{}),L=(e,t)=>{const{state:s,publish:n,window:r}=t,{host:i,pathname:a,search:l}=r.location,u=a,d=F(l),c={host:i,path:u,query:d};s.store("route").update(c),n($,c)},z=e=>{const{subscribe:t}=e;t(M,V),t(k,(s,n)=>{y(s,n)})},B=e=>{const{publish:t,subscribe:s,state:n,window:r}=e;D(n),r.addEventListener("popstate",()=>t(b,null)),s(b,L)},K=e=>{setTimeout(()=>e.publish(b,null),0)},R=e=>{B(e),z(e),K(e)},St=Object.freeze(Object.defineProperty({__proto__:null,publishLocation:K,startNavigation:R,subscribeToHistoryChange:B,subscribeToNavigation:z},Symbol.toStringTag,{value:"Module"}));class U{constructor({window:t,document:s,publish:n,subscribe:r,bus:i,state:a,renderKit:l}){this.window=t,this.document=s,this.publish=n,this.subscribe=r,this.bus=i,this.state=a,this.renderKit=l,this.roots=[]}render(t,s){const n=Nt(t,s,this.renderKit);return this.roots.push(n),n}startNavigation(){R(this)}}const Tt=Object.freeze(Object.defineProperty({__proto__:null,App:U},Symbol.toStringTag,{value:"Module"}));class C{constructor(){this.lookup={}}add(t,s,n){this.ensureArrayFor(t);const r={listener:s,index:n,matcher:t};return this.lookup[t].push(r),()=>this.remove(r)}remove(t){this.lookup[t.matcher]&&(this.lookup[t.matcher]=this.lookup[t.matcher].reduce((s,n)=>(n!==t&&s.push(n),s),[]))}matches(t){return this.lookup[t]||[]}ensureArrayFor(t){this.lookup[t]||(this.lookup[t]=[])}}class I{constructor(){this.lookup=[]}add(t,s,n){const r={listener:s,index:n,matcher:t};return this.lookup.push(r),()=>this.remove(r)}remove(t){this.lookup=this.lookup.reduce((s,n)=>(n!==t&&s.push(n),s),[])}matches(t){return this.lookup.filter(s=>s.matcher.test(t))}}class jt{constructor({publish:t,event:s,payload:n,timer:r}){this.setNewTimeout=()=>{this.stopped||setTimeout(()=>{this.publishEvent(),this.setNewTimeout()},this.calculateNextTime())},this.calculateNextTime=()=>this.timer({timeDiff:this.diff(),callCount:this.callCount,stop:this.stop}),this.publish=t,this.event=s,this.payload=n||null,this.stop=this.stopTimeout.bind(this),this.stopped=!1,this.timer=r,this.startedAt=new Date().getTime(),this.callCount=0}start(){this.setNewTimeout()}diff(){return new Date().getTime()-this.startedAt}stopTimeout(){this.stopped=!0,this.timeoutId&&clearTimeout(this.timeoutId)}publishEvent(){this.stopped||(this.callCount+=1,this.publish(this.event,this.payload))}}const Ot=e=>{const{offset:t,period:s}=e,n=({callCount:r})=>t&&r==0?t:s;return{event:e.event,publish:e.publish,payload:e.payload,timer:n}},Mt=e=>{let t;"timer"in e?t=e:t=Ot(e);const s=new jt(t);return s.start(),s.stop};class q{constructor(){this.exactSubscriptions=new C,this.fuzzySubscriptions=new I,this.currentIndex=0}subscribe(t,s){let n;return typeof t=="string"?n=this.exactSubscriptions.add(t,s,this.currentIndex):n=this.fuzzySubscriptions.add(t,s,this.currentIndex),this.currentIndex+=1,n}publish(t,s){[...this.exactSubscriptions.matches(t),...this.fuzzySubscriptions.matches(t)].sort((r,i)=>r.index-i.index).forEach(r=>{r.listener(s,this.listenerOptions(t))})}addListenerOptions(t){this.options=t}listenerOptions(t){return{eventName:t,...this.options,publish:this.publish.bind(this)}}}const J=()=>{const e=new q;return{bus:e,publish:(n,r)=>e.publish(n,r),subscribe:(n,r)=>e.subscribe(n,r)}},kt=Object.freeze(Object.defineProperty({__proto__:null,ExactSubscriptions:C,FuzzySubscriptions:I,JaxsBus:q,createBus:J,publishPeriodically:Mt},Symbol.toStringTag,{value:"Module"})),v=e=>Array.isArray(e),E=e=>e!==null&&!v(e)&&typeof e=="object",$t=(e,t)=>e===t,Dt=(e,t)=>Object.keys(e).length===Object.keys(t).length,Pt=(e,t)=>!(E(e)&&E(t))||!Dt(e,t)?!1:Object.keys(e).every(s=>{const n=e[s],r=t[s];return A(n,r)}),Vt=(e,t)=>!(v(e)&&v(t))||e.length!==t.length?!1:e.every((s,n)=>{const r=t[n];return A(s,r)}),A=(e,t)=>E(e)?Pt(e,t):v(e)?Vt(e,t):$t(e,t);class x{constructor(t){this.name=t.name,this.parent=t.parent,this._value=t.value,this.initialValue=structuredClone(t.value)}get value(){return this._value}set value(t){throw new Error("Cannot set value directly. Use an updater!")}reset(){this._value=this.initialValue}update(t){if(typeof t=="function"){const s=this.getUpdatedValue(t);this.updateValue(s)}else this.updateValue(t)}updateValue(t){A(this._value,t)||(this._value=t,this.parent.notify(this.name))}getUpdatedValue(t){return t(this.value)}}class w{constructor(t){this.store=t}update(t){this.store.update(t)}reset(){this.store.update(this.store.initialValue)}get value(){return this.store.value}}class Ft extends w{updateAttribute(t,s){const n={...this.value};n[t]=s,this.update(n)}updateDynamicAttribute(t,s){this.isKey(t)&&this.isValueType(t,s)&&this.updateAttribute(t,s)}isKey(t){return t in this.store.initialValue}isValueType(t,s){return typeof this.store.initialValue[t]==typeof s}resetAttribute(t){const s={...this.value},n=this.store.initialValue[t];s[t]=n,this.update(s)}}const Lt=e=>new Ft(e);class zt extends w{push(t){const s=[...this.value,t];this.update(s)}pop(){const t=[...this.value],s=t.pop();return this.update(t),s}unshift(t){const s=[t,...this.value];this.update(s)}shift(){const t=[...this.value],s=t.shift();return this.update(t),s}addSorter(t,s){this[t]=()=>{this.sortBy(s)}}sortBy(t){const s=[...this.value];s.sort(t),this.update(s)}insertAt(t,s){const n=[...this.value];n.splice(t,0,s),this.update(n)}remove(t){const s=this.value.reduce((n,r)=>(r!==t&&n.push(r),n),[]);this.update(s)}removeBy(t){const s=this.value.reduce((n,r)=>(t(r)||n.push(r),n),[]);this.update(s)}}const Bt=e=>new zt(e);class Kt extends w{toggle(){const t=!this.value;this.update(t)}setTrue(){this.update(!0)}setFalse(){this.update(!1)}}const Rt={object:Lt,list:Bt,boolean:e=>new Kt(e)},N="state";class G{constructor(t){this.publisher=t,this.stores={},this.eventNamePrefix=N,this.notifications=new Set,this.inTransaction=!1}create(t,s){const n=new x({name:t,parent:this,value:s});return this.stores[t]=n,n}store(t){return this.stores[t]||new x({name:t,parent:this,value:void 0})}get(t){return this.store(t).value}getAll(t){return t.reduce((s,n)=>(s[n]=this.get(n),s),{})}notify(t){this.inTransaction?this.notifications.add(t):this.publish(t)}update(t,s){this.store(t).update(s)}transaction(t){this.inTransaction=!0,t(this.stores),this.inTransaction=!1,this.publishAll()}publishAll(){this.notifications.forEach(t=>{this.publish(t)}),this.notifications.clear()}publish(t){this.publisher(this.event(t),{state:this,store:this.store(t)})}event(t){return`${this.eventNamePrefix}:${t}`}}const H=e=>new G(e),Ut=Object.freeze(Object.defineProperty({__proto__:null,State:G,Store:x,createState:H,eventName:N,updaters:Rt},Symbol.toStringTag,{value:"Module"}));class Ct{constructor(t){this.setupDomEnvironment(t)}setup(){return this.setupBus(),this.setupState(),this.addBusOptions(),this.setRenderKit(),new U({window:this.window,document:this.document,publish:this.publish,subscribe:this.subscribe,bus:this.bus,state:this.state,renderKit:this.renderKit})}setupDomEnvironment(t){t.window?(this.window=t.window,this.document=this.window.document):t.document?(this.window=t.document.defaultView,this.document=t.document):(this.window=window,this.document=document)}setupBus(){const{publish:t,subscribe:s,bus:n}=J();this.publish=t,this.subscribe=s,this.bus=n}setupState(){this.state=H(this.publish)}addBusOptions(){this.bus.addListenerOptions({state:this.state,document:this.document,window:this.window})}setRenderKit(){this.renderKit={publish:this.publish,subscribe:this.subscribe,state:this.state,document:this.document,window:this.window}}}const It=(e={})=>{const s=new Ct(e).setup();return s.startNavigation(),s};var o=(e=>(e[e.removeNode=0]="removeNode",e[e.insertNode=1]="insertNode",e[e.replaceNode=2]="replaceNode",e[e.removeAttribute=3]="removeAttribute",e[e.addAttribute=4]="addAttribute",e[e.updateAttribute=5]="updateAttribute",e[e.removeEvent=6]="removeEvent",e[e.addEvent=7]="addEvent",e[e.updateEvent=8]="updateEvent",e[e.changeValue=9]="changeValue",e[e.changeText=10]="changeText",e))(o||{});const qt=Object.freeze(Object.defineProperty({__proto__:null,ChangeInstructionTypes:o},Symbol.toStringTag,{value:"Module"})),Jt=(e,t)=>({source:e,target:t,type:o.changeText,data:{}}),Gt=(e,t)=>({source:e,target:t,type:o.replaceNode,data:{}}),Ht=(e,t,s)=>({source:e,target:t,data:s,type:o.removeAttribute}),Qt=(e,t,s)=>({source:e,target:t,data:s,type:o.addAttribute}),Wt=(e,t,s)=>({source:e,target:t,data:s,type:o.updateAttribute}),Xt=(e,t,s)=>({source:e,target:t,data:s,type:o.removeEvent}),Yt=(e,t,s)=>({source:e,target:t,data:s,type:o.addEvent}),Zt=(e,t,s)=>({source:e,target:t,data:s,type:o.updateEvent}),Q=e=>({source:e,target:e,type:o.removeNode,data:{}}),_=(e,t)=>({target:e,source:e,type:o.insertNode,data:t}),te=(e,t,s)=>({source:e,target:t,type:o.changeValue,data:s}),ee=(e,t)=>e.type>t.type?1:e.type<t.type?-1:0,W={index:-1};class se{constructor(){this.map={}}populate(t){t.forEach((s,n)=>{const r=s.__jsx;r&&(this.map[r]=this.map[r]||[],this.map[r].push({element:s,index:n}))})}pullMatch(t){const s=t&&t.__jsx;return!s||!(this.map[s]&&this.map[s].length)?W:this.map[s].shift()}clear(t){const s=t&&t.__jsx;if(!(s&&this.map[s]&&this.map[s].length))return;const n=this.map[s];this.map[s]=n.reduce((r,i)=>(i.element!==t&&r.push(i),r),[])}check(t){const s=t&&t.__jsx;return s&&this.map[s]?this.map[s].length>0:!1}remaining(){return Object.values(this.map).flat()}}const X=e=>{const t=new se;return t.populate(e),t},Y=(e,t,s=!1)=>{const n=[],r=e.attributes,i=r.length,a=t.attributes,l=a.length;let u,d,c;for(u=0;u<i;u++){c=null;const h=r.item(u);if(h){for(d=0;d<l;d++){const m=a.item(d);if(m&&h.name==m.name){c=m;break}}c?h.value!==c.value&&n.push(Wt(e,t,{name:h.name,value:c.value,isSvg:s})):n.push(Ht(e,t,{name:h.name,isSvg:s}))}}for(u=0;u<l;u++){c=null;const h=a.item(u);if(h){for(d=0;d<i;d++){const m=r.item(d);if(m&&m.name==h.name){c=m;break}}c||n.push(Qt(e,t,{name:h.name,value:h.value,isSvg:s}))}}return n},ne=(e,t)=>{const s=[],n=e.eventMaps,r=t.eventMaps,i=Object.keys(n),a=Object.keys(r);return i.forEach(l=>{const u=n[l],d=r[l];d?d.busEvent!==u.busEvent&&s.push(Zt(e,t,{name:l,targetValue:d.listener,sourceValue:u.listener})):s.push(Xt(e,t,{name:u.domEvent,value:u.listener}))}),a.forEach(l=>{const u=n[l],d=r[l];u||s.push(Yt(e,t,{name:d.domEvent,value:d.listener}))}),s},re=e=>e.tagName!=="INPUT",ie=(e,t)=>e.value===t.value,oe=(e,t)=>{if(re(e)||ie(e,t))return[];const s=e,n=t;return[te(s,n,{name:"value",value:n.value})]},ue=(e,t)=>{const s=Y(e,t),n=ne(e,t),r=oe(e,t);return s.concat(n).concat(r)},ae=(e,t)=>Y(e,t,!0),ce=(e,t)=>e.textContent!==t.textContent?[Jt(e,t)]:[],le=(e,t,s)=>{let n=[];if(e.nodeType===1&&ct(e)){const r=e,i=t,a=ae(r,i),l=s(r.childNodes,i.childNodes,r);n=a.concat(l)}else if(e.nodeType===1){const r=e,i=t,a=ue(r,i),l=s(r.childNodes,i.childNodes,r);n=a.concat(l)}else e.nodeType===3&&(n=ce(e,t));return n},Z=(e,t,s)=>{const n=[],r=he(e,t),i=X(e),a=X(t),l=[];let u=0;for(;u<r;u++){const c=e[u],h=t[u];if(h&&a.check(h)){const m=i.pullMatch(h);a.clear(h),m.element?(m.index!==u&&n.push(_(m.element,{parent:s,index:u})),l.push({source:m.element,target:h})):c?a.check(c)?n.push(_(h,{parent:s,index:u})):(i.clear(c),n.push(Gt(c,h))):n.push(_(h,{parent:s,index:u}))}else c&&i.pullMatch(c).element&&n.push(Q(c))}i.remaining().forEach(({element:c})=>{n.push(Q(c))});const d=l.reduce((c,{source:h,target:m})=>c.concat(le(h,m,Z)),[]);return n.concat(d).sort(ee)},he=(e,t)=>{const s=e.length,n=t.length;return s>n?s:n},de=(e,t,s)=>{const n=Z(e,t,s);return n.forEach(r=>{pe(r)}),n},pe=e=>{(_e[e.type]||me)(e)},me=e=>{},fe=e=>{const{source:t,target:s}=e;t.nodeValue=s.textContent},be=e=>{const{source:t}=e;t.remove()},ve=e=>{const{target:t,data:s}=e,{parent:n,index:r}=s,i=n.childNodes[r];i?i&&i!==t&&n.insertBefore(t,i):n.appendChild(t)},ge=e=>{const{source:t,target:s}=e;t.replaceWith(s)},ye=e=>{const{source:t,data:s}=e,{name:n,isSvg:r}=s;r?t.removeAttributeNS(null,n):t.removeAttribute(n)},tt=e=>{const{source:t,data:s}=e,{name:n,value:r,isSvg:i}=s;i?t.setAttributeNS(null,n,r):t.setAttribute(n,r)},Ee=e=>{tt(e)},Ae=e=>{const t=e.data,s=e.source,{name:n,value:r}=t;s.removeEventListener(n,r)},xe=e=>{const t=e.data,s=e.source,{name:n,value:r}=t;s.addEventListener(n,r)},we=e=>{const t=e.data,s=e.source,{name:n,sourceValue:r,targetValue:i}=t;s.removeEventListener(n,r),s.addEventListener(n,i)},Ne=e=>{const t=e.data,s=e.source,{value:n}=t;s.value=n},_e={[o.changeText]:fe,[o.removeNode]:be,[o.insertNode]:ve,[o.replaceNode]:ge,[o.removeAttribute]:ye,[o.addAttribute]:tt,[o.updateAttribute]:Ee,[o.removeEvent]:Ae,[o.addEvent]:xe,[o.updateEvent]:we,[o.changeValue]:Ne},Se=(e,t,s)=>{const n=[...t];return e.forEach(r=>{Te(r,n,s)}),n},Te=(e,t,s)=>{const n=ke[e.type];n&&n(e,t,s)},je=(e,t)=>{const{source:s}=e,n=t.indexOf(s);n>=0&&t.splice(n,1)},Oe=(e,t,s)=>{const{target:n}=e,r=e.data,{index:i,parent:a}=r;s===a&&t.splice(i,0,n)},Me=(e,t)=>{const{target:s,source:n}=e,r=t.indexOf(n);r>=0&&(t[r]=s)},ke={[o.removeNode]:je,[o.insertNode]:Oe,[o.replaceNode]:Me};class $e{constructor({Template:t,subscriptions:s,attributes:n,viewModel:r}){this.Template=t,this.viewModel=r,this.attributes=n,this.subscriptions=s,this.dom=[],this.parentElement=null}render(t){return this.parentElement=t.parent,this.renderKit=t,this.subscribeForRerender(),this.dom=this.generateDom(t),this.dom}generateDom(t){const s={...this.attributes,...this.viewModel(t.state.getAll(this.subscriptions))},n=this.Template(s);return n?n.render(t):[]}rerender(){if(!this.parentElement&&this.dom[0]){const n=this.dom[0].parentElement;this.parentElement=n}const t=this.generateDom(this.renderKit),s=de(this.dom,t,this.parentElement);this.dom=Se(s,this.dom,this.parentElement)}subscribeForRerender(){const{subscribe:t}=this.renderKit;this.subscriptions.forEach(s=>{t(this.eventName(s),()=>this.rerender())})}eventName(t){return`${N}:${t}`}}const De=e=>e,et=({Template:e,viewModel:t,subscriptions:s})=>(s=s||[],t=t||De,n=>new $e({Template:e,viewModel:t,subscriptions:s,attributes:n})),Pe=Object.freeze(Object.defineProperty({__proto__:null,createRouteState:D,events:_t,extractQueryParams:F,findHref:P,navigate:y,onLinkClick:V,onLocationChange:L,start:St},Symbol.toStringTag,{value:"Module"})),Ve=e=>({path:t})=>t===e,Fe=()=>!0,st=e=>({route:t})=>{const s=e.find(n=>n.match(t));return s&&s.Partial},Le=Object.freeze(Object.defineProperty({__proto__:null,buildRouter:st,catchAll:Fe,exactPathMatch:Ve},Symbol.toStringTag,{value:"Module"})),ze=()=>({render:(e,t)=>[]}),Be=e=>{const t=st(e);return et({Template:({route:n})=>(t({route:n})||ze)(),subscriptions:["route"]})};p.JaxsTypes=qt,p.appBuilding=Tt,p.bind=et,p.createApp=It,p.jsx=O,p.messageBus=kt,p.navigation=Pe,p.routedView=Be,p.routing=Le,p.state=Ut,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|