jaxs 0.7.2 → 0.8.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/dist/jaxs.umd.cjs CHANGED
@@ -7,33 +7,37 @@
7
7
  f((p.jaxs = {})))
8
8
  })(this, function (p) {
9
9
  'use strict'
10
- const f = (e, t) => t.createElement(e),
11
- nt = (e, t) => {
10
+ const f = (e) => typeof e == 'string',
11
+ v = (e) => Array.isArray(e),
12
+ g = (e) => e !== null && !v(e) && typeof e == 'object',
13
+ rt = (e, t) => t.createElement(e),
14
+ it = (e, t) => {
12
15
  for (const s in t) {
13
16
  if (s === '__self') continue
14
17
  const n = t[s].toString()
15
18
  if (s === 'value') {
16
19
  const r = e
17
20
  r.value !== n && (r.value = n)
18
- } else e.setAttribute(s, n)
21
+ } else
22
+ f(n) && n.trim() === '' ? e.removeAttribute(s) : e.setAttribute(s, n)
19
23
  }
20
24
  },
21
- rt = (e, t, s) => {
25
+ ot = (e, t, s) => {
22
26
  const n = {}
23
27
  for (const r in t) {
24
28
  const i = t[r],
25
- a = (l) => s(i, l)
29
+ a = (c) => s(i, c)
26
30
  e.addEventListener(r, a),
27
31
  (n[r] = { domEvent: r, busEvent: i, listener: a })
28
32
  }
29
33
  e.eventMaps = n
30
34
  },
31
- it = (e, t, s, n) => {
32
- const r = f(e, n.document)
33
- return nt(r, t), rt(r, s, n.publish), r
35
+ ut = (e, t, s, n) => {
36
+ const r = rt(e, n.document)
37
+ return it(r, t), ot(r, s, n.publish), r
34
38
  },
35
- g = 'http://www.w3.org/2000/svg',
36
- ot = {
39
+ y = 'http://www.w3.org/2000/svg',
40
+ at = {
37
41
  animate: !0,
38
42
  animateMotion: !0,
39
43
  animateTransform: !0,
@@ -97,33 +101,33 @@
97
101
  use: !0,
98
102
  view: !0,
99
103
  },
100
- ut = (e, t) => !!(ot[e] || (e === 'a' && t === g)),
101
- at = (e, t, s) => {
102
- const n = s.createElementNS(g, e)
104
+ ct = (e, t) => !!(at[e] || (e === 'a' && t === y)),
105
+ lt = (e, t, s) => {
106
+ const n = s.createElementNS(y, e)
103
107
  for (const r in t)
104
108
  r === '__self' ||
105
109
  r === 'xmlns' ||
106
110
  n.setAttributeNS(null, r, t[r].toString())
107
111
  return n
108
112
  },
109
- ct = (e) => e.namespaceURI === g,
110
- lt = (e, t) => t.createTextNode(e)
111
- class ht {
113
+ ht = (e) => e.namespaceURI === y,
114
+ dt = (e, t) => t.createTextNode(e)
115
+ class pt {
112
116
  constructor(t) {
113
117
  this.value = t.toString()
114
118
  }
115
119
  render(t) {
116
- const s = lt(this.value, t.document)
120
+ const s = dt(this.value, t.document)
117
121
  return (s.__jsx = 'TextNode'), [s]
118
122
  }
119
123
  }
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
- S = (e, t = {}) => e || t.children || [],
126
- vt = (e, t = '') => {
124
+ const mt = (e) => typeof e == 'string' || typeof e == 'number',
125
+ ft = (e) => new pt(e),
126
+ bt = (e) => (mt(e) ? ft(e) : e),
127
+ S = (e) => vt(e).map(bt).flat(),
128
+ vt = (e) => (Array.isArray(e) ? e.flat() : e ? [e] : []),
129
+ T = (e, t = {}) => S(e || t.children || []),
130
+ gt = (e, t = '') => {
127
131
  const s = {},
128
132
  n = {}
129
133
  for (const r in e) {
@@ -133,27 +137,27 @@
133
137
  n[a] = i ? i.toString() : ''
134
138
  } else {
135
139
  if (i === !1) continue
136
- r === '__source' ? (s.__source = e.__source) : (s[r] = gt(r, i, t))
140
+ r === '__source' ? (s.__source = e.__source) : (s[r] = yt(r, i, t))
137
141
  }
138
142
  }
139
143
  return { attributes: s, events: n }
140
144
  },
141
- gt = (e, t, s = '') => (t == null ? s : t.toString()),
142
- yt = (e, t) => {
145
+ yt = (e, t, s = '') => (t == null ? s : t.toString()),
146
+ Et = (e, t) => {
143
147
  const s = e || {},
144
- n = S(t, s)
148
+ n = T(t, s)
145
149
  return (s.children = s.children || n), s
146
150
  },
147
- T = (e, t, s, n = []) => e.reduce(Et(t, s), n).flat(),
148
- Et = (e, t) => (s, n) =>
151
+ j = (e, t, s, n = []) => e.reduce(At(t, s), n).flat(),
152
+ At = (e, t) => (s, n) =>
149
153
  n
150
154
  ? Array.isArray(n)
151
- ? T(n, e, t, s)
155
+ ? j(n, e, t, s)
152
156
  : (n.render(e, t).forEach((r) => s.push(r)), s)
153
157
  : s
154
- class j {
158
+ class O {
155
159
  constructor(t) {
156
- this.collection = ft(t)
160
+ this.collection = S(t)
157
161
  }
158
162
  render(t, s) {
159
163
  this.parentElement = s
@@ -161,7 +165,7 @@
161
165
  return this.attachToParent(n), n
162
166
  }
163
167
  generateDom(t) {
164
- return T(this.collection, t, this.parentElement)
168
+ return j(this.collection, t, this.parentElement)
165
169
  }
166
170
  attachToParent(t) {
167
171
  if (this.parentElement === void 0) return
@@ -169,7 +173,7 @@
169
173
  t.forEach((n) => s.appendChild(n))
170
174
  }
171
175
  }
172
- class At {
176
+ class xt {
173
177
  constructor(t, s) {
174
178
  ;(this.type = t), (this.attributes = s)
175
179
  }
@@ -197,14 +201,14 @@
197
201
  return `${this.type}${t}${s}${n}`
198
202
  }
199
203
  }
200
- class xt {
204
+ class wt {
201
205
  constructor(t, s, n = []) {
202
206
  this.type = t
203
- const { events: r, attributes: i } = vt(s)
207
+ const { events: r, attributes: i } = gt(s)
204
208
  ;(this.events = r),
205
209
  (this.attributes = i),
206
- (this.isSvg = ut(this.type, this.attributes.xmlns)),
207
- (this.children = new j(n))
210
+ (this.isSvg = ct(this.type, this.attributes.xmlns)),
211
+ (this.children = new O(n))
208
212
  }
209
213
  render(t) {
210
214
  const s = this.generateDom(t)
@@ -214,24 +218,24 @@
214
218
  return this.isSvg ? this.generateSvgDom(t) : this.generateHtmlDom(t)
215
219
  }
216
220
  generateHtmlDom(t) {
217
- const s = it(this.type, this.attributes, this.events, t)
221
+ const s = ut(this.type, this.attributes, this.events, t)
218
222
  return (s.__jsx = this.jsxKey()), s
219
223
  }
220
224
  generateSvgDom(t) {
221
- const s = at(this.type, this.attributes, t.document)
225
+ const s = lt(this.type, this.attributes, t.document)
222
226
  return (s.__jsx = this.jsxKey()), s
223
227
  }
224
228
  jsxKey() {
225
- return new At(this.type, this.attributes).generate()
229
+ return new xt(this.type, this.attributes).generate()
226
230
  }
227
231
  }
228
- const O = (e, t, ...s) =>
229
- typeof e == 'string' ? new xt(e, t, s) : e(yt(t, s))
230
- O.fragment = (e, t) => {
231
- const s = S(t, e)
232
- return new j(s)
232
+ const M = (e, t, ...s) =>
233
+ typeof e == 'string' ? new wt(e, t, s) : e(Et(t, s))
234
+ M.fragment = (e, t) => {
235
+ const s = T(t, e)
236
+ return new O(s)
233
237
  }
234
- class wt {
238
+ class Nt {
235
239
  constructor(t, s, n) {
236
240
  ;(this.template = t),
237
241
  (this.selector = s),
@@ -256,44 +260,45 @@
256
260
  return this.renderKit.document.querySelector(this.selector)
257
261
  }
258
262
  }
259
- const Nt = (e, t, s) => {
260
- const n = new wt(e, t, s)
263
+ const _t = (e, t, s) => {
264
+ const n = new Nt(e, t, s)
261
265
  return n.renderAndAttach(s), n
262
266
  },
263
- M = 'go-to-href',
264
- k = 'go-to',
267
+ k = 'go-to-href',
268
+ $ = 'go-to',
265
269
  b = 'navigation:location-change',
266
- $ = 'navigation:route-change',
267
- _t = Object.freeze(
270
+ D = 'navigation:route-change',
271
+ St = Object.freeze(
268
272
  Object.defineProperty(
269
273
  {
270
274
  __proto__: null,
271
- linkNavigationEvent: M,
275
+ linkNavigationEvent: k,
272
276
  locationChangeEvent: b,
273
- navigationEvent: k,
274
- routeChangeEvent: $,
277
+ navigationEvent: $,
278
+ routeChangeEvent: D,
275
279
  },
276
280
  Symbol.toStringTag,
277
281
  { value: 'Module' },
278
282
  ),
279
283
  ),
280
- D = (e) => {
284
+ P = (e) => {
281
285
  e.create('route', { host: '', path: '', query: {} })
282
286
  },
283
- P = (e) => {
287
+ V = (e) => {
284
288
  const t = e.closest('[href]')
285
289
  return (t && t.getAttribute('href')) || ''
286
290
  },
287
- y = (e, { publish: t, window: s }) => {
291
+ E = ({ payload: e, publish: t, window: s }) => {
288
292
  s.history.pushState(null, '', e), t(b, null)
289
293
  },
290
- V = (e, t) => {
291
- if (!e || !e.target) return
292
- e.preventDefault()
293
- const s = P(e.target)
294
- y(s, t)
294
+ F = (e) => {
295
+ const t = e.payload
296
+ if (!t || !t.target) return
297
+ t.preventDefault()
298
+ const s = V(t.target)
299
+ E({ ...e, payload: s })
295
300
  },
296
- F = (e) =>
301
+ L = (e) =>
297
302
  e
298
303
  .replace(/^\?/, '')
299
304
  .split('&')
@@ -302,45 +307,45 @@
302
307
  const n = s.split('=')
303
308
  return (t[n[0]] = n[1]), t
304
309
  }, {}),
305
- L = (e, t) => {
306
- const { state: s, publish: n, window: r } = t,
307
- { host: i, pathname: a, search: l } = r.location,
308
- u = a,
309
- d = F(l),
310
- c = { host: i, path: u, query: d }
311
- s.store('route').update(c), n($, c)
312
- },
313
310
  z = (e) => {
311
+ const { state: t, publish: s, window: n } = e,
312
+ { host: r, pathname: i, search: a } = n.location,
313
+ c = i,
314
+ u = L(a),
315
+ h = { host: r, path: c, query: u }
316
+ t.store('route').update(h), s(D, h)
317
+ },
318
+ B = (e) => {
314
319
  const { subscribe: t } = e
315
- t(M, V),
316
- t(k, (s, n) => {
317
- y(s, n)
320
+ t(k, F),
321
+ t($, (s) => {
322
+ E(s)
318
323
  })
319
324
  },
320
- B = (e) => {
325
+ K = (e) => {
321
326
  const { publish: t, subscribe: s, state: n, window: r } = e
322
- D(n), r.addEventListener('popstate', () => t(b, null)), s(b, L)
327
+ P(n), r.addEventListener('popstate', () => t(b, null)), s(b, z)
323
328
  },
324
- K = (e) => {
329
+ R = (e) => {
325
330
  setTimeout(() => e.publish(b, null), 0)
326
331
  },
327
- R = (e) => {
328
- B(e), z(e), K(e)
332
+ U = (e) => {
333
+ K(e), B(e), R(e)
329
334
  },
330
- St = Object.freeze(
335
+ Tt = Object.freeze(
331
336
  Object.defineProperty(
332
337
  {
333
338
  __proto__: null,
334
- publishLocation: K,
335
- startNavigation: R,
336
- subscribeToHistoryChange: B,
337
- subscribeToNavigation: z,
339
+ publishLocation: R,
340
+ startNavigation: U,
341
+ subscribeToHistoryChange: K,
342
+ subscribeToNavigation: B,
338
343
  },
339
344
  Symbol.toStringTag,
340
345
  { value: 'Module' },
341
346
  ),
342
347
  )
343
- class U {
348
+ class C {
344
349
  constructor({
345
350
  window: t,
346
351
  document: s,
@@ -348,7 +353,7 @@
348
353
  subscribe: r,
349
354
  bus: i,
350
355
  state: a,
351
- renderKit: l,
356
+ renderKit: c,
352
357
  }) {
353
358
  ;(this.window = t),
354
359
  (this.document = s),
@@ -356,23 +361,23 @@
356
361
  (this.subscribe = r),
357
362
  (this.bus = i),
358
363
  (this.state = a),
359
- (this.renderKit = l),
364
+ (this.renderKit = c),
360
365
  (this.roots = [])
361
366
  }
362
367
  render(t, s) {
363
- const n = Nt(t, s, this.renderKit)
368
+ const n = _t(t, s, this.renderKit)
364
369
  return this.roots.push(n), n
365
370
  }
366
371
  startNavigation() {
367
- R(this)
372
+ U(this)
368
373
  }
369
374
  }
370
- const Tt = Object.freeze(
371
- Object.defineProperty({ __proto__: null, App: U }, Symbol.toStringTag, {
375
+ const jt = Object.freeze(
376
+ Object.defineProperty({ __proto__: null, App: C }, Symbol.toStringTag, {
372
377
  value: 'Module',
373
378
  }),
374
379
  )
375
- class C {
380
+ class I {
376
381
  constructor() {
377
382
  this.lookup = {}
378
383
  }
@@ -395,7 +400,7 @@
395
400
  this.lookup[t] || (this.lookup[t] = [])
396
401
  }
397
402
  }
398
- class I {
403
+ class q {
399
404
  constructor() {
400
405
  this.lookup = []
401
406
  }
@@ -410,7 +415,7 @@
410
415
  return this.lookup.filter((s) => s.matcher.test(t))
411
416
  }
412
417
  }
413
- class jt {
418
+ class Ot {
414
419
  constructor({ publish: t, event: s, payload: n, timer: r }) {
415
420
  ;(this.setNewTimeout = () => {
416
421
  this.stopped ||
@@ -447,7 +452,7 @@
447
452
  ((this.callCount += 1), this.publish(this.event, this.payload))
448
453
  }
449
454
  }
450
- const Ot = (e) => {
455
+ const Mt = (e) => {
451
456
  const { offset: t, period: s } = e,
452
457
  n = ({ callCount: r }) => (t && r == 0 ? t : s)
453
458
  return {
@@ -457,16 +462,16 @@
457
462
  timer: n,
458
463
  }
459
464
  },
460
- Mt = (e) => {
465
+ kt = (e) => {
461
466
  let t
462
- 'timer' in e ? (t = e) : (t = Ot(e))
463
- const s = new jt(t)
467
+ 'timer' in e ? (t = e) : (t = Mt(e))
468
+ const s = new Ot(t)
464
469
  return s.start(), s.stop
465
470
  }
466
- class q {
471
+ class J {
467
472
  constructor() {
468
- ;(this.exactSubscriptions = new C()),
469
- (this.fuzzySubscriptions = new I()),
473
+ ;(this.exactSubscriptions = new I()),
474
+ (this.fuzzySubscriptions = new q()),
470
475
  (this.currentIndex = 0)
471
476
  }
472
477
  subscribe(t, s) {
@@ -486,58 +491,61 @@
486
491
  ]
487
492
  .sort((r, i) => r.index - i.index)
488
493
  .forEach((r) => {
489
- r.listener(s, this.listenerOptions(t))
494
+ r.listener(this.listenerOptions(t, s))
490
495
  })
491
496
  }
492
497
  addListenerOptions(t) {
493
498
  this.options = t
494
499
  }
495
- listenerOptions(t) {
496
- return { eventName: t, ...this.options, publish: this.publish.bind(this) }
500
+ listenerOptions(t, s) {
501
+ return {
502
+ eventName: t,
503
+ ...this.options,
504
+ publish: this.publish.bind(this),
505
+ payload: s,
506
+ }
497
507
  }
498
508
  }
499
- const J = () => {
500
- const e = new q()
509
+ const G = () => {
510
+ const e = new J()
501
511
  return {
502
512
  bus: e,
503
513
  publish: (n, r) => e.publish(n, r),
504
514
  subscribe: (n, r) => e.subscribe(n, r),
505
515
  }
506
516
  },
507
- kt = Object.freeze(
517
+ $t = Object.freeze(
508
518
  Object.defineProperty(
509
519
  {
510
520
  __proto__: null,
511
- ExactSubscriptions: C,
512
- FuzzySubscriptions: I,
513
- JaxsBus: q,
514
- createBus: J,
515
- publishPeriodically: Mt,
521
+ ExactSubscriptions: I,
522
+ FuzzySubscriptions: q,
523
+ JaxsBus: J,
524
+ createBus: G,
525
+ publishPeriodically: kt,
516
526
  },
517
527
  Symbol.toStringTag,
518
528
  { value: 'Module' },
519
529
  ),
520
530
  ),
521
- v = (e) => Array.isArray(e),
522
- E = (e) => e !== null && !v(e) && typeof e == 'object',
523
- $t = (e, t) => e === t,
524
- Dt = (e, t) => Object.keys(e).length === Object.keys(t).length,
525
- Pt = (e, t) =>
526
- !(E(e) && E(t)) || !Dt(e, t)
531
+ Dt = (e, t) => e === t,
532
+ Pt = (e, t) => Object.keys(e).length === Object.keys(t).length,
533
+ Vt = (e, t) =>
534
+ !(g(e) && g(t)) || !Pt(e, t)
527
535
  ? !1
528
536
  : Object.keys(e).every((s) => {
529
537
  const n = e[s],
530
538
  r = t[s]
531
539
  return A(n, r)
532
540
  }),
533
- Vt = (e, t) =>
541
+ Ft = (e, t) =>
534
542
  !(v(e) && v(t)) || e.length !== t.length
535
543
  ? !1
536
544
  : e.every((s, n) => {
537
545
  const r = t[n]
538
546
  return A(s, r)
539
547
  }),
540
- A = (e, t) => (E(e) ? Pt(e, t) : v(e) ? Vt(e, t) : $t(e, t))
548
+ A = (e, t) => (g(e) ? Vt(e, t) : v(e) ? Ft(e, t) : Dt(e, t))
541
549
  class x {
542
550
  constructor(t) {
543
551
  ;(this.name = t.name),
@@ -581,7 +589,7 @@
581
589
  return this.store.value
582
590
  }
583
591
  }
584
- class Ft extends w {
592
+ class Lt extends w {
585
593
  updateAttribute(t, s) {
586
594
  const n = { ...this.value }
587
595
  ;(n[t] = s), this.update(n)
@@ -601,8 +609,8 @@
601
609
  ;(s[t] = n), this.update(s)
602
610
  }
603
611
  }
604
- const Lt = (e) => new Ft(e)
605
- class zt extends w {
612
+ const zt = (e) => new Lt(e)
613
+ class Bt extends w {
606
614
  push(t) {
607
615
  const s = [...this.value, t]
608
616
  this.update(s)
@@ -643,8 +651,8 @@
643
651
  this.update(s)
644
652
  }
645
653
  }
646
- const Bt = (e) => new zt(e)
647
- class Kt extends w {
654
+ const Kt = (e) => new Bt(e)
655
+ class Rt extends w {
648
656
  toggle() {
649
657
  const t = !this.value
650
658
  this.update(t)
@@ -656,9 +664,9 @@
656
664
  this.update(!1)
657
665
  }
658
666
  }
659
- const Rt = { object: Lt, list: Bt, boolean: (e) => new Kt(e) },
667
+ const Ut = { object: zt, list: Kt, boolean: (e) => new Rt(e) },
660
668
  N = 'state'
661
- class G {
669
+ class H {
662
670
  constructor(t) {
663
671
  ;(this.publisher = t),
664
672
  (this.stores = {}),
@@ -704,22 +712,22 @@
704
712
  return `${this.eventNamePrefix}:${t}`
705
713
  }
706
714
  }
707
- const H = (e) => new G(e),
708
- Ut = Object.freeze(
715
+ const Q = (e) => new H(e),
716
+ Ct = Object.freeze(
709
717
  Object.defineProperty(
710
718
  {
711
719
  __proto__: null,
712
- State: G,
720
+ State: H,
713
721
  Store: x,
714
- createState: H,
722
+ createState: Q,
715
723
  eventName: N,
716
- updaters: Rt,
724
+ updaters: Ut,
717
725
  },
718
726
  Symbol.toStringTag,
719
727
  { value: 'Module' },
720
728
  ),
721
729
  )
722
- class Ct {
730
+ class It {
723
731
  constructor(t) {
724
732
  this.setupDomEnvironment(t)
725
733
  }
@@ -729,7 +737,7 @@
729
737
  this.setupState(),
730
738
  this.addBusOptions(),
731
739
  this.setRenderKit(),
732
- new U({
740
+ new C({
733
741
  window: this.window,
734
742
  document: this.document,
735
743
  publish: this.publish,
@@ -749,11 +757,11 @@
749
757
  : ((this.window = window), (this.document = document))
750
758
  }
751
759
  setupBus() {
752
- const { publish: t, subscribe: s, bus: n } = J()
760
+ const { publish: t, subscribe: s, bus: n } = G()
753
761
  ;(this.publish = t), (this.subscribe = s), (this.bus = n)
754
762
  }
755
763
  setupState() {
756
- this.state = H(this.publish)
764
+ this.state = Q(this.publish)
757
765
  }
758
766
  addBusOptions() {
759
767
  this.bus.addListenerOptions({
@@ -772,8 +780,8 @@
772
780
  }
773
781
  }
774
782
  }
775
- const It = (e = {}) => {
776
- const s = new Ct(e).setup()
783
+ const qt = (e = {}) => {
784
+ const s = new It(e).setup()
777
785
  return s.startNavigation(), s
778
786
  }
779
787
  var o = ((e) => (
@@ -790,37 +798,37 @@
790
798
  (e[(e.changeText = 10)] = 'changeText'),
791
799
  e
792
800
  ))(o || {})
793
- const qt = Object.freeze(
801
+ const Jt = Object.freeze(
794
802
  Object.defineProperty(
795
803
  { __proto__: null, ChangeInstructionTypes: o },
796
804
  Symbol.toStringTag,
797
805
  { value: 'Module' },
798
806
  ),
799
807
  ),
800
- Jt = (e, t) => ({ source: e, target: t, type: o.changeText, data: {} }),
801
- Gt = (e, t) => ({ source: e, target: t, type: o.replaceNode, data: {} }),
802
- Ht = (e, t, s) => ({
808
+ Gt = (e, t) => ({ source: e, target: t, type: o.changeText, data: {} }),
809
+ Ht = (e, t) => ({ source: e, target: t, type: o.replaceNode, data: {} }),
810
+ Qt = (e, t, s) => ({
803
811
  source: e,
804
812
  target: t,
805
813
  data: s,
806
814
  type: o.removeAttribute,
807
815
  }),
808
- Qt = (e, t, s) => ({ source: e, target: t, data: s, type: o.addAttribute }),
809
- Wt = (e, t, s) => ({
816
+ Wt = (e, t, s) => ({ source: e, target: t, data: s, type: o.addAttribute }),
817
+ Xt = (e, t, s) => ({
810
818
  source: e,
811
819
  target: t,
812
820
  data: s,
813
821
  type: o.updateAttribute,
814
822
  }),
815
- Xt = (e, t, s) => ({ source: e, target: t, data: s, type: o.removeEvent }),
816
- Yt = (e, t, s) => ({ source: e, target: t, data: s, type: o.addEvent }),
817
- Zt = (e, t, s) => ({ source: e, target: t, data: s, type: o.updateEvent }),
818
- Q = (e) => ({ source: e, target: e, type: o.removeNode, data: {} }),
823
+ Yt = (e, t, s) => ({ source: e, target: t, data: s, type: o.removeEvent }),
824
+ Zt = (e, t, s) => ({ source: e, target: t, data: s, type: o.addEvent }),
825
+ te = (e, t, s) => ({ source: e, target: t, data: s, type: o.updateEvent }),
826
+ W = (e) => ({ source: e, target: e, type: o.removeNode, data: {} }),
819
827
  _ = (e, t) => ({ target: e, source: e, type: o.insertNode, data: t }),
820
- te = (e, t, s) => ({ source: e, target: t, type: o.changeValue, data: s }),
821
- ee = (e, t) => (e.type > t.type ? 1 : e.type < t.type ? -1 : 0),
822
- W = { index: -1 }
823
- class se {
828
+ ee = (e, t, s) => ({ source: e, target: t, type: o.changeValue, data: s }),
829
+ se = (e, t) => (e.type > t.type ? 1 : e.type < t.type ? -1 : 0),
830
+ X = { index: -1 }
831
+ class ne {
824
832
  constructor() {
825
833
  this.map = {}
826
834
  }
@@ -835,7 +843,7 @@
835
843
  pullMatch(t) {
836
844
  const s = t && t.__jsx
837
845
  return !s || !(this.map[s] && this.map[s].length)
838
- ? W
846
+ ? X
839
847
  : this.map[s].shift()
840
848
  }
841
849
  clear(t) {
@@ -852,261 +860,261 @@
852
860
  return Object.values(this.map).flat()
853
861
  }
854
862
  }
855
- const X = (e) => {
856
- const t = new se()
863
+ const Y = (e) => {
864
+ const t = new ne()
857
865
  return t.populate(e), t
858
866
  },
859
- Y = (e, t, s = !1) => {
867
+ Z = (e, t, s = !1) => {
860
868
  const n = [],
861
869
  r = e.attributes,
862
870
  i = r.length,
863
871
  a = t.attributes,
864
- l = a.length
865
- let u, d, c
872
+ c = a.length
873
+ let u, h, d
866
874
  for (u = 0; u < i; u++) {
867
- c = null
868
- const h = r.item(u)
869
- if (h) {
870
- for (d = 0; d < l; d++) {
871
- const m = a.item(d)
872
- if (m && h.name == m.name) {
873
- c = m
875
+ d = null
876
+ const l = r.item(u)
877
+ if (l) {
878
+ for (h = 0; h < c; h++) {
879
+ const m = a.item(h)
880
+ if (m && l.name == m.name) {
881
+ d = m
874
882
  break
875
883
  }
876
884
  }
877
- c
878
- ? h.value !== c.value &&
879
- n.push(Wt(e, t, { name: h.name, value: c.value, isSvg: s }))
880
- : n.push(Ht(e, t, { name: h.name, isSvg: s }))
885
+ d
886
+ ? l.value !== d.value &&
887
+ n.push(Xt(e, t, { name: l.name, value: d.value, isSvg: s }))
888
+ : n.push(Qt(e, t, { name: l.name, isSvg: s }))
881
889
  }
882
890
  }
883
- for (u = 0; u < l; u++) {
884
- c = null
885
- const h = a.item(u)
886
- if (h) {
887
- for (d = 0; d < i; d++) {
888
- const m = r.item(d)
889
- if (m && m.name == h.name) {
890
- c = m
891
+ for (u = 0; u < c; u++) {
892
+ d = null
893
+ const l = a.item(u)
894
+ if (l) {
895
+ for (h = 0; h < i; h++) {
896
+ const m = r.item(h)
897
+ if (m && m.name == l.name) {
898
+ d = m
891
899
  break
892
900
  }
893
901
  }
894
- c || n.push(Qt(e, t, { name: h.name, value: h.value, isSvg: s }))
902
+ d || n.push(Wt(e, t, { name: l.name, value: l.value, isSvg: s }))
895
903
  }
896
904
  }
897
905
  return n
898
906
  },
899
- ne = (e, t) => {
907
+ re = (e, t) => {
900
908
  const s = [],
901
909
  n = e.eventMaps,
902
910
  r = t.eventMaps,
903
911
  i = Object.keys(n),
904
912
  a = Object.keys(r)
905
913
  return (
906
- i.forEach((l) => {
907
- const u = n[l],
908
- d = r[l]
909
- d
910
- ? d.busEvent !== u.busEvent &&
914
+ i.forEach((c) => {
915
+ const u = n[c],
916
+ h = r[c]
917
+ h
918
+ ? h.busEvent !== u.busEvent &&
911
919
  s.push(
912
- Zt(e, t, {
913
- name: l,
914
- targetValue: d.listener,
920
+ te(e, t, {
921
+ name: c,
922
+ targetValue: h.listener,
915
923
  sourceValue: u.listener,
916
924
  }),
917
925
  )
918
- : s.push(Xt(e, t, { name: u.domEvent, value: u.listener }))
926
+ : s.push(Yt(e, t, { name: u.domEvent, value: u.listener }))
919
927
  }),
920
- a.forEach((l) => {
921
- const u = n[l],
922
- d = r[l]
923
- u || s.push(Yt(e, t, { name: d.domEvent, value: d.listener }))
928
+ a.forEach((c) => {
929
+ const u = n[c],
930
+ h = r[c]
931
+ u || s.push(Zt(e, t, { name: h.domEvent, value: h.listener }))
924
932
  }),
925
933
  s
926
934
  )
927
935
  },
928
- re = (e) => e.tagName !== 'INPUT',
929
- ie = (e, t) => e.value === t.value,
930
- oe = (e, t) => {
931
- if (re(e) || ie(e, t)) return []
936
+ ie = (e) => e.tagName !== 'INPUT',
937
+ oe = (e, t) => e.value === t.value,
938
+ ue = (e, t) => {
939
+ if (ie(e) || oe(e, t)) return []
932
940
  const s = e,
933
941
  n = t
934
- return [te(s, n, { name: 'value', value: n.value })]
942
+ return [ee(s, n, { name: 'value', value: n.value })]
935
943
  },
936
- ue = (e, t) => {
937
- const s = Y(e, t),
938
- n = ne(e, t),
939
- r = oe(e, t)
944
+ ae = (e, t) => {
945
+ const s = Z(e, t),
946
+ n = re(e, t),
947
+ r = ue(e, t)
940
948
  return s.concat(n).concat(r)
941
949
  },
942
- ae = (e, t) => Y(e, t, !0),
943
- ce = (e, t) => (e.textContent !== t.textContent ? [Jt(e, t)] : []),
944
- le = (e, t, s) => {
950
+ ce = (e, t) => Z(e, t, !0),
951
+ le = (e, t) => (e.textContent !== t.textContent ? [Gt(e, t)] : []),
952
+ he = (e, t, s) => {
945
953
  let n = []
946
- if (e.nodeType === 1 && ct(e)) {
954
+ if (e.nodeType === 1 && ht(e)) {
947
955
  const r = e,
948
956
  i = t,
949
- a = ae(r, i),
950
- l = s(r.childNodes, i.childNodes, r)
951
- n = a.concat(l)
957
+ a = ce(r, i),
958
+ c = s(r.childNodes, i.childNodes, r)
959
+ n = a.concat(c)
952
960
  } else if (e.nodeType === 1) {
953
961
  const r = e,
954
962
  i = t,
955
- a = ue(r, i),
956
- l = s(r.childNodes, i.childNodes, r)
957
- n = a.concat(l)
958
- } else e.nodeType === 3 && (n = ce(e, t))
963
+ a = ae(r, i),
964
+ c = s(r.childNodes, i.childNodes, r)
965
+ n = a.concat(c)
966
+ } else e.nodeType === 3 && (n = le(e, t))
959
967
  return n
960
968
  },
961
- Z = (e, t, s) => {
969
+ tt = (e, t, s) => {
962
970
  const n = [],
963
- r = he(e, t),
964
- i = X(e),
965
- a = X(t),
966
- l = []
971
+ r = de(e, t),
972
+ i = Y(e),
973
+ a = Y(t),
974
+ c = []
967
975
  let u = 0
968
976
  for (; u < r; u++) {
969
- const c = e[u],
970
- h = t[u]
971
- if (h && a.check(h)) {
972
- const m = i.pullMatch(h)
973
- a.clear(h),
977
+ const d = e[u],
978
+ l = t[u]
979
+ if (l && a.check(l)) {
980
+ const m = i.pullMatch(l)
981
+ a.clear(l),
974
982
  m.element
975
983
  ? (m.index !== u && n.push(_(m.element, { parent: s, index: u })),
976
- l.push({ source: m.element, target: h }))
977
- : c
978
- ? a.check(c)
979
- ? n.push(_(h, { parent: s, index: u }))
980
- : (i.clear(c), n.push(Gt(c, h)))
981
- : n.push(_(h, { parent: s, index: u }))
982
- } else c && i.pullMatch(c).element && n.push(Q(c))
984
+ c.push({ source: m.element, target: l }))
985
+ : d
986
+ ? a.check(d)
987
+ ? n.push(_(l, { parent: s, index: u }))
988
+ : (i.clear(d), n.push(Ht(d, l)))
989
+ : n.push(_(l, { parent: s, index: u }))
990
+ } else d && i.pullMatch(d).element && n.push(W(d))
983
991
  }
984
- i.remaining().forEach(({ element: c }) => {
985
- n.push(Q(c))
992
+ i.remaining().forEach(({ element: d }) => {
993
+ n.push(W(d))
986
994
  })
987
- const d = l.reduce(
988
- (c, { source: h, target: m }) => c.concat(le(h, m, Z)),
995
+ const h = c.reduce(
996
+ (d, { source: l, target: m }) => d.concat(he(l, m, tt)),
989
997
  [],
990
998
  )
991
- return n.concat(d).sort(ee)
999
+ return n.concat(h).sort(se)
992
1000
  },
993
- he = (e, t) => {
1001
+ de = (e, t) => {
994
1002
  const s = e.length,
995
1003
  n = t.length
996
1004
  return s > n ? s : n
997
1005
  },
998
- de = (e, t, s) => {
999
- const n = Z(e, t, s)
1006
+ pe = (e, t, s) => {
1007
+ const n = tt(e, t, s)
1000
1008
  return (
1001
1009
  n.forEach((r) => {
1002
- pe(r)
1010
+ me(r)
1003
1011
  }),
1004
1012
  n
1005
1013
  )
1006
1014
  },
1007
- pe = (e) => {
1008
- ;(_e[e.type] || me)(e)
1015
+ me = (e) => {
1016
+ ;(Se[e.type] || fe)(e)
1009
1017
  },
1010
- me = (e) => {},
1011
- fe = (e) => {
1018
+ fe = (e) => {},
1019
+ be = (e) => {
1012
1020
  const { source: t, target: s } = e
1013
1021
  t.nodeValue = s.textContent
1014
1022
  },
1015
- be = (e) => {
1023
+ ve = (e) => {
1016
1024
  const { source: t } = e
1017
1025
  t.remove()
1018
1026
  },
1019
- ve = (e) => {
1027
+ ge = (e) => {
1020
1028
  const { target: t, data: s } = e,
1021
1029
  { parent: n, index: r } = s,
1022
1030
  i = n.childNodes[r]
1023
1031
  i ? i && i !== t && n.insertBefore(t, i) : n.appendChild(t)
1024
1032
  },
1025
- ge = (e) => {
1033
+ ye = (e) => {
1026
1034
  const { source: t, target: s } = e
1027
1035
  t.replaceWith(s)
1028
1036
  },
1029
- ye = (e) => {
1037
+ Ee = (e) => {
1030
1038
  const { source: t, data: s } = e,
1031
1039
  { name: n, isSvg: r } = s
1032
1040
  r ? t.removeAttributeNS(null, n) : t.removeAttribute(n)
1033
1041
  },
1034
- tt = (e) => {
1042
+ et = (e) => {
1035
1043
  const { source: t, data: s } = e,
1036
1044
  { name: n, value: r, isSvg: i } = s
1037
1045
  i ? t.setAttributeNS(null, n, r) : t.setAttribute(n, r)
1038
1046
  },
1039
- Ee = (e) => {
1040
- tt(e)
1041
- },
1042
1047
  Ae = (e) => {
1048
+ et(e)
1049
+ },
1050
+ xe = (e) => {
1043
1051
  const t = e.data,
1044
1052
  s = e.source,
1045
1053
  { name: n, value: r } = t
1046
1054
  s.removeEventListener(n, r)
1047
1055
  },
1048
- xe = (e) => {
1056
+ we = (e) => {
1049
1057
  const t = e.data,
1050
1058
  s = e.source,
1051
1059
  { name: n, value: r } = t
1052
1060
  s.addEventListener(n, r)
1053
1061
  },
1054
- we = (e) => {
1062
+ Ne = (e) => {
1055
1063
  const t = e.data,
1056
1064
  s = e.source,
1057
1065
  { name: n, sourceValue: r, targetValue: i } = t
1058
1066
  s.removeEventListener(n, r), s.addEventListener(n, i)
1059
1067
  },
1060
- Ne = (e) => {
1068
+ _e = (e) => {
1061
1069
  const t = e.data,
1062
1070
  s = e.source,
1063
1071
  { value: n } = t
1064
1072
  s.value = n
1065
1073
  },
1066
- _e = {
1067
- [o.changeText]: fe,
1068
- [o.removeNode]: be,
1069
- [o.insertNode]: ve,
1070
- [o.replaceNode]: ge,
1071
- [o.removeAttribute]: ye,
1072
- [o.addAttribute]: tt,
1073
- [o.updateAttribute]: Ee,
1074
- [o.removeEvent]: Ae,
1075
- [o.addEvent]: xe,
1076
- [o.updateEvent]: we,
1077
- [o.changeValue]: Ne,
1074
+ Se = {
1075
+ [o.changeText]: be,
1076
+ [o.removeNode]: ve,
1077
+ [o.insertNode]: ge,
1078
+ [o.replaceNode]: ye,
1079
+ [o.removeAttribute]: Ee,
1080
+ [o.addAttribute]: et,
1081
+ [o.updateAttribute]: Ae,
1082
+ [o.removeEvent]: xe,
1083
+ [o.addEvent]: we,
1084
+ [o.updateEvent]: Ne,
1085
+ [o.changeValue]: _e,
1078
1086
  },
1079
- Se = (e, t, s) => {
1087
+ Te = (e, t, s) => {
1080
1088
  const n = [...t]
1081
1089
  return (
1082
1090
  e.forEach((r) => {
1083
- Te(r, n, s)
1091
+ je(r, n, s)
1084
1092
  }),
1085
1093
  n
1086
1094
  )
1087
1095
  },
1088
- Te = (e, t, s) => {
1089
- const n = ke[e.type]
1096
+ je = (e, t, s) => {
1097
+ const n = $e[e.type]
1090
1098
  n && n(e, t, s)
1091
1099
  },
1092
- je = (e, t) => {
1100
+ Oe = (e, t) => {
1093
1101
  const { source: s } = e,
1094
1102
  n = t.indexOf(s)
1095
1103
  n >= 0 && t.splice(n, 1)
1096
1104
  },
1097
- Oe = (e, t, s) => {
1105
+ Me = (e, t, s) => {
1098
1106
  const { target: n } = e,
1099
1107
  r = e.data,
1100
1108
  { index: i, parent: a } = r
1101
1109
  s === a && t.splice(i, 0, n)
1102
1110
  },
1103
- Me = (e, t) => {
1111
+ ke = (e, t) => {
1104
1112
  const { target: s, source: n } = e,
1105
1113
  r = t.indexOf(n)
1106
1114
  r >= 0 && (t[r] = s)
1107
1115
  },
1108
- ke = { [o.removeNode]: je, [o.insertNode]: Oe, [o.replaceNode]: Me }
1109
- class $e {
1116
+ $e = { [o.removeNode]: Oe, [o.insertNode]: Me, [o.replaceNode]: ke }
1117
+ class De {
1110
1118
  constructor({
1111
1119
  Template: t,
1112
1120
  subscriptions: s,
@@ -1143,8 +1151,8 @@
1143
1151
  this.parentElement = n
1144
1152
  }
1145
1153
  const t = this.generateDom(this.renderKit),
1146
- s = de(this.dom, t, this.parentElement)
1147
- this.dom = Se(s, this.dom, this.parentElement)
1154
+ s = pe(this.dom, t, this.parentElement)
1155
+ this.dom = Te(s, this.dom, this.parentElement)
1148
1156
  }
1149
1157
  subscribeForRerender() {
1150
1158
  const { subscribe: t } = this.renderKit
@@ -1156,36 +1164,19 @@
1156
1164
  return `${N}:${t}`
1157
1165
  }
1158
1166
  }
1159
- const De = (e) => e,
1160
- et = ({ Template: e, viewModel: t, subscriptions: s }) => (
1167
+ const Pe = (e) => e,
1168
+ st = ({ Template: e, viewModel: t, subscriptions: s }) => (
1161
1169
  (s = s || []),
1162
- (t = t || De),
1170
+ (t = t || Pe),
1163
1171
  (n) =>
1164
- new $e({ Template: e, viewModel: t, subscriptions: s, attributes: n })
1165
- ),
1166
- Pe = Object.freeze(
1167
- Object.defineProperty(
1168
- {
1169
- __proto__: null,
1170
- createRouteState: D,
1171
- events: _t,
1172
- extractQueryParams: F,
1173
- findHref: P,
1174
- navigate: y,
1175
- onLinkClick: V,
1176
- onLocationChange: L,
1177
- start: St,
1178
- },
1179
- Symbol.toStringTag,
1180
- { value: 'Module' },
1181
- ),
1172
+ new De({ Template: e, viewModel: t, subscriptions: s, attributes: n })
1182
1173
  ),
1183
1174
  Ve =
1184
1175
  (e) =>
1185
1176
  ({ path: t }) =>
1186
1177
  t === e,
1187
1178
  Fe = () => !0,
1188
- st =
1179
+ nt =
1189
1180
  (e) =>
1190
1181
  ({ route: t }) => {
1191
1182
  const s = e.find((n) => n.match(t))
@@ -1193,28 +1184,45 @@
1193
1184
  },
1194
1185
  Le = Object.freeze(
1195
1186
  Object.defineProperty(
1196
- { __proto__: null, buildRouter: st, catchAll: Fe, exactPathMatch: Ve },
1187
+ { __proto__: null, buildRouter: nt, catchAll: Fe, exactPathMatch: Ve },
1197
1188
  Symbol.toStringTag,
1198
1189
  { value: 'Module' },
1199
1190
  ),
1200
1191
  ),
1201
1192
  ze = () => ({ render: (e, t) => [] }),
1202
1193
  Be = (e) => {
1203
- const t = st(e)
1204
- return et({
1194
+ const t = nt(e)
1195
+ return st({
1205
1196
  Template: ({ route: n }) => (t({ route: n }) || ze)(),
1206
1197
  subscriptions: ['route'],
1207
1198
  })
1208
- }
1209
- ;(p.JaxsTypes = qt),
1210
- (p.appBuilding = Tt),
1211
- (p.bind = et),
1212
- (p.createApp = It),
1213
- (p.jsx = O),
1214
- (p.messageBus = kt),
1215
- (p.navigation = Pe),
1199
+ },
1200
+ Ke = Object.freeze(
1201
+ Object.defineProperty(
1202
+ {
1203
+ __proto__: null,
1204
+ createRouteState: P,
1205
+ events: St,
1206
+ extractQueryParams: L,
1207
+ findHref: V,
1208
+ navigate: E,
1209
+ onLinkClick: F,
1210
+ onLocationChange: z,
1211
+ start: Tt,
1212
+ },
1213
+ Symbol.toStringTag,
1214
+ { value: 'Module' },
1215
+ ),
1216
+ )
1217
+ ;(p.JaxsTypes = Jt),
1218
+ (p.appBuilding = jt),
1219
+ (p.bind = st),
1220
+ (p.createApp = qt),
1221
+ (p.jsx = M),
1222
+ (p.messageBus = $t),
1223
+ (p.navigation = Ke),
1216
1224
  (p.routedView = Be),
1217
1225
  (p.routing = Le),
1218
- (p.state = Ut),
1226
+ (p.state = Ct),
1219
1227
  Object.defineProperty(p, Symbol.toStringTag, { value: 'Module' })
1220
1228
  })