jaxs 0.9.1 → 0.9.3

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 CHANGED
@@ -51,6 +51,12 @@ export declare const ArrayModifiers: {
51
51
  ) => T[]
52
52
  insertAt: <T>(originalCollection: T[], index: number, item: T) => T[]
53
53
  appendIfUnique: <T>(originalCollection: T[], item: T) => T[]
54
+ push: <T>(array: T[], item: T) => number
55
+ pop: <T>(array: T[]) => T
56
+ unshift: <T>(array: T[], item: T) => number
57
+ shift: <T>(array: T[]) => T
58
+ sortBy: <T>(array: T[], sorter: (a: T, b: T) => number) => T[]
59
+ includes: <T>(array: T[], item: T) => boolean
54
60
  }
55
61
 
56
62
  declare type AttributeInstructionData = {
@@ -454,6 +460,8 @@ export declare const ListStore: {
454
460
  reset: <T>(store: Store<T[]>) => void
455
461
  includes: <T>(store: Store<T[]>, value: T) => boolean
456
462
  appendIfUnique: <T>(store: Store<T[]>, item: T) => void
463
+ findBy: <T>(store: Store<T[]>, matcherFunction: (value: T) => boolean) => T
464
+ replace: <T>(store: Store<T[]>, original: T, replacement: T) => void
457
465
  }
458
466
 
459
467
  declare const locationChangeEvent = 'navigation:location-change'
@@ -735,6 +743,8 @@ declare class StoreUpdaterList<T> {
735
743
  removeBy(matcherFunction: (value: T) => boolean): void
736
744
  includes(value: T): boolean
737
745
  appendIfUnique(item: T): void
746
+ findBy(matcherFunction: (value: T) => boolean): T
747
+ replace(original: T, replacement: T): void
738
748
  }
739
749
 
740
750
  declare class StoreUpdaterObject<T extends object> {
package/dist/jaxs.js CHANGED
@@ -1,5 +1,11 @@
1
- const O = (e, t) => e.reduce((s, r) => (r !== t && s.push(r), s), []),
2
- M = (e, t) => e.reduce((s, r) => (t(r) || s.push(r), s), []),
1
+ const O = (e, t) => {
2
+ for (let s = e.length - 1; s >= 0; s--) e[s] === t && e.splice(s, 1)
3
+ return e
4
+ },
5
+ M = (e, t) => {
6
+ for (let s = e.length - 1; s >= 0; s--) t(e[s]) && e.splice(s, 1)
7
+ return e
8
+ },
3
9
  k = (e, t, s) => (e.splice(t, 0, s), e),
4
10
  $ = (e, t) => (e.includes(t) || e.push(t), e),
5
11
  Ve = {
@@ -7,6 +13,18 @@ const O = (e, t) => e.reduce((s, r) => (r !== t && s.push(r), s), []),
7
13
  removeBy: M,
8
14
  insertAt: k,
9
15
  appendIfUnique: $,
16
+ push: (e, t) => e.push(t),
17
+ // mutates
18
+ pop: (e) => e.pop(),
19
+ // mutates
20
+ unshift: (e, t) => e.unshift(t),
21
+ // mutates
22
+ shift: (e) => e.shift(),
23
+ // mutates
24
+ sortBy: (e, t) => e.sort(t),
25
+ // mutates
26
+ includes: (e, t) => e.includes(t),
27
+ // reader
10
28
  }
11
29
  class ct {
12
30
  constructor(t) {
@@ -101,6 +119,14 @@ class lt {
101
119
  const s = this.value
102
120
  $(s, t), this.update(s)
103
121
  }
122
+ findBy(t) {
123
+ return this.value.find(t)
124
+ }
125
+ replace(t, s) {
126
+ const r = this.value,
127
+ n = r.indexOf(t)
128
+ n !== -1 && ((r[n] = s), this.update(r))
129
+ }
104
130
  }
105
131
  const m = (e) => new lt(e),
106
132
  ze = {
@@ -115,6 +141,8 @@ const m = (e) => new lt(e),
115
141
  reset: (e) => m(e).reset(),
116
142
  includes: (e, t) => m(e).includes(t),
117
143
  appendIfUnique: (e, t) => m(e).appendIfUnique(t),
144
+ findBy: (e, t) => m(e).findBy(t),
145
+ replace: (e, t, s) => m(e).replace(t, s),
118
146
  }
119
147
  class ht {
120
148
  constructor(t) {
@@ -165,15 +193,15 @@ const b = (e) => new ht(e),
165
193
  },
166
194
  dt = (e) => typeof e == 'boolean',
167
195
  pt = (e) => typeof e == 'number',
168
- D = (e) => typeof e == 'string',
196
+ B = (e) => typeof e == 'string',
169
197
  v = (e) => Array.isArray(e),
170
- y = (e) => e !== null && !v(e) && typeof e == 'object',
198
+ g = (e) => e !== null && !v(e) && typeof e == 'object',
171
199
  Re = {
172
200
  boolean: dt,
173
201
  number: pt,
174
- string: D,
202
+ string: B,
175
203
  array: v,
176
- object: y,
204
+ object: g,
177
205
  },
178
206
  mt = (e, t) => t.createElement(e),
179
207
  ft = (e, t) => {
@@ -184,7 +212,7 @@ const b = (e) => new ht(e),
184
212
  const n = e
185
213
  n.value !== r && (n.value = r)
186
214
  } else
187
- D(r) && r.trim() === '' ? e.removeAttribute(s) : e.setAttribute(s, r)
215
+ B(r) && r.trim() === '' ? e.removeAttribute(s) : e.setAttribute(s, r)
188
216
  }
189
217
  },
190
218
  bt = (e, t, s) => {
@@ -206,7 +234,7 @@ const b = (e) => new ht(e),
206
234
  return ft(n, t), bt(n, s, r.publish), n
207
235
  },
208
236
  w = 'http://www.w3.org/2000/svg',
209
- gt = {
237
+ yt = {
210
238
  animate: !0,
211
239
  animateMotion: !0,
212
240
  animateTransform: !0,
@@ -270,7 +298,7 @@ const b = (e) => new ht(e),
270
298
  use: !0,
271
299
  view: !0,
272
300
  },
273
- yt = (e, t) => !!(gt[e] || (e === 'a' && t === w)),
301
+ gt = (e, t) => !!(yt[e] || (e === 'a' && t === w)),
274
302
  Et = (e, t, s) => {
275
303
  const r = s.createElementNS(w, e)
276
304
  for (const n in t)
@@ -293,9 +321,9 @@ class wt {
293
321
  const Nt = (e) => typeof e == 'string' || typeof e == 'number',
294
322
  _t = (e) => new wt(e),
295
323
  St = (e) => (Nt(e) ? _t(e) : e),
296
- P = (e) => Tt(e).map(St).flat(),
324
+ D = (e) => Tt(e).map(St).flat(),
297
325
  Tt = (e) => (Array.isArray(e) ? e.flat() : e ? [e] : []),
298
- F = (e, t = {}) => P(e || t.children || []),
326
+ P = (e, t = {}) => D(e || t.children || []),
299
327
  jt = (e, t = '') => {
300
328
  const s = {},
301
329
  r = {}
@@ -317,19 +345,19 @@ const Nt = (e) => typeof e == 'string' || typeof e == 'number',
317
345
  Ot = (e, t, s = '') => (t == null ? s : t.toString()),
318
346
  Mt = (e, t) => {
319
347
  const s = e || {},
320
- r = F(t, s)
348
+ r = P(t, s)
321
349
  return (s.children = s.children || r), s
322
350
  },
323
- B = (e, t, s, r = []) => e.reduce(kt(t, s), r).flat(),
351
+ F = (e, t, s, r = []) => e.reduce(kt(t, s), r).flat(),
324
352
  kt = (e, t) => (s, r) =>
325
353
  r
326
354
  ? Array.isArray(r)
327
- ? B(r, e, t, s)
355
+ ? F(r, e, t, s)
328
356
  : (r.render(e, t).forEach((n) => s.push(n)), s)
329
357
  : s
330
358
  class V {
331
359
  constructor(t) {
332
- this.collection = P(t)
360
+ this.collection = D(t)
333
361
  }
334
362
  render(t, s) {
335
363
  this.parentElement = s
@@ -337,7 +365,7 @@ class V {
337
365
  return this.attachToParent(r), r
338
366
  }
339
367
  generateDom(t) {
340
- return B(this.collection, t, this.parentElement)
368
+ return F(this.collection, t, this.parentElement)
341
369
  }
342
370
  attachToParent(t) {
343
371
  if (this.parentElement === void 0) return
@@ -371,13 +399,13 @@ class $t {
371
399
  return `${this.type}${t}${s}${r}`
372
400
  }
373
401
  }
374
- class Dt {
402
+ class Bt {
375
403
  constructor(t, s, r = []) {
376
404
  this.type = t
377
405
  const { events: n, attributes: i } = jt(s)
378
406
  ;(this.events = n),
379
407
  (this.attributes = i),
380
- (this.isSvg = yt(this.type, this.attributes.xmlns)),
408
+ (this.isSvg = gt(this.type, this.attributes.xmlns)),
381
409
  (this.children = new V(r))
382
410
  }
383
411
  render(t) {
@@ -399,13 +427,13 @@ class Dt {
399
427
  return new $t(this.type, this.attributes).generate()
400
428
  }
401
429
  }
402
- const Pt = (e, t, ...s) =>
403
- typeof e == 'string' ? new Dt(e, t, s) : e(Mt(t, s))
404
- Pt.fragment = (e, t) => {
405
- const s = F(t, e)
430
+ const Dt = (e, t, ...s) =>
431
+ typeof e == 'string' ? new Bt(e, t, s) : e(Mt(t, s))
432
+ Dt.fragment = (e, t) => {
433
+ const s = P(t, e)
406
434
  return new V(s)
407
435
  }
408
- class Ft {
436
+ class Pt {
409
437
  constructor(t, s, r) {
410
438
  ;(this.template = t),
411
439
  (this.selector = s),
@@ -430,20 +458,20 @@ class Ft {
430
458
  return this.renderKit.document.querySelector(this.selector)
431
459
  }
432
460
  }
433
- const Bt = (e, t, s) => {
434
- const r = new Ft(e, t, s)
461
+ const Ft = (e, t, s) => {
462
+ const r = new Pt(e, t, s)
435
463
  return r.renderAndAttach(s), r
436
464
  },
437
465
  L = 'go-to-href',
438
466
  z = 'go-to',
439
- g = 'navigation:location-change',
467
+ y = 'navigation:location-change',
440
468
  K = 'navigation:route-change',
441
469
  Vt = /* @__PURE__ */ Object.freeze(
442
470
  /* @__PURE__ */ Object.defineProperty(
443
471
  {
444
472
  __proto__: null,
445
473
  linkNavigationEvent: L,
446
- locationChangeEvent: g,
474
+ locationChangeEvent: y,
447
475
  navigationEvent: z,
448
476
  routeChangeEvent: K,
449
477
  },
@@ -463,7 +491,7 @@ const Bt = (e, t, s) => {
463
491
  return (t && t.getAttribute('href')) || ''
464
492
  },
465
493
  N = ({ payload: e, publish: t, window: s }) => {
466
- s.history.pushState(null, '', e), t(g, null)
494
+ s.history.pushState(null, '', e), t(y, null)
467
495
  },
468
496
  q = (e) => {
469
497
  const t = e.payload
@@ -481,7 +509,7 @@ const Bt = (e, t, s) => {
481
509
  const r = s.split('=')
482
510
  return (t[r[0]] = r[1]), t
483
511
  }, {}),
484
- C = (e) => {
512
+ J = (e) => {
485
513
  const { state: t, publish: s, window: r } = e,
486
514
  { host: n, pathname: i, search: a } = r.location,
487
515
  c = i,
@@ -493,31 +521,31 @@ const Bt = (e, t, s) => {
493
521
  }
494
522
  t.store('route').update(h), s(K, h)
495
523
  },
496
- J = (e) => {
524
+ G = (e) => {
497
525
  const { subscribe: t } = e
498
526
  t(L, q),
499
527
  t(z, (s) => {
500
528
  N(s)
501
529
  })
502
530
  },
503
- G = (e) => {
531
+ H = (e) => {
504
532
  const { publish: t, subscribe: s, state: r, window: n } = e
505
- R(r), n.addEventListener('popstate', () => t(g, null)), s(g, C)
533
+ R(r), n.addEventListener('popstate', () => t(y, null)), s(y, J)
506
534
  },
507
- H = (e) => {
508
- setTimeout(() => e.publish(g, null), 0)
535
+ C = (e) => {
536
+ setTimeout(() => e.publish(y, null), 0)
509
537
  },
510
538
  Q = (e) => {
511
- G(e), J(e), H(e)
539
+ H(e), G(e), C(e)
512
540
  },
513
541
  Lt = /* @__PURE__ */ Object.freeze(
514
542
  /* @__PURE__ */ Object.defineProperty(
515
543
  {
516
544
  __proto__: null,
517
- publishLocation: H,
545
+ publishLocation: C,
518
546
  startNavigation: Q,
519
- subscribeToHistoryChange: G,
520
- subscribeToNavigation: J,
547
+ subscribeToHistoryChange: H,
548
+ subscribeToNavigation: G,
521
549
  },
522
550
  Symbol.toStringTag,
523
551
  { value: 'Module' },
@@ -543,7 +571,7 @@ class W {
543
571
  (this.roots = [])
544
572
  }
545
573
  render(t, s) {
546
- const r = Bt(t, s, this.renderKit)
574
+ const r = Ft(t, s, this.renderKit)
547
575
  return this.roots.push(r), r
548
576
  }
549
577
  startNavigation() {
@@ -722,7 +750,7 @@ const tt = () => {
722
750
  Ut = (e, t) => e === t,
723
751
  qt = (e, t) => Object.keys(e).length === Object.keys(t).length,
724
752
  et = (e, t) =>
725
- !(y(e) && y(t)) || !qt(e, t)
753
+ !(g(e) && g(t)) || !qt(e, t)
726
754
  ? !1
727
755
  : Object.keys(e).every((s) => {
728
756
  const r = e[s],
@@ -736,7 +764,7 @@ const tt = () => {
736
764
  const n = t[r]
737
765
  return E(s, n)
738
766
  }),
739
- E = (e, t) => (y(e) ? et(e, t) : v(e) ? st(e, t) : Ut(e, t)),
767
+ E = (e, t) => (g(e) ? et(e, t) : v(e) ? st(e, t) : Ut(e, t)),
740
768
  Ie = {
741
769
  objects: et,
742
770
  arrays: st,
@@ -833,7 +861,7 @@ class rt {
833
861
  }
834
862
  }
835
863
  const nt = (e) => new rt(e),
836
- Ce = /* @__PURE__ */ Object.freeze(
864
+ Je = /* @__PURE__ */ Object.freeze(
837
865
  /* @__PURE__ */ Object.defineProperty(
838
866
  {
839
867
  __proto__: null,
@@ -898,7 +926,7 @@ class It {
898
926
  }
899
927
  }
900
928
  }
901
- const Je = (e = {}) => {
929
+ const Ge = (e = {}) => {
902
930
  const s = new It(e).setup()
903
931
  return s.startNavigation(), s
904
932
  }
@@ -916,7 +944,7 @@ var o = /* @__PURE__ */ ((e) => (
916
944
  (e[(e.changeText = 10)] = 'changeText'),
917
945
  e
918
946
  ))(o || {})
919
- const Ge = /* @__PURE__ */ Object.freeze(
947
+ const He = /* @__PURE__ */ Object.freeze(
920
948
  /* @__PURE__ */ Object.defineProperty(
921
949
  {
922
950
  __proto__: null,
@@ -926,25 +954,25 @@ const Ge = /* @__PURE__ */ Object.freeze(
926
954
  { value: 'Module' },
927
955
  ),
928
956
  ),
929
- Ct = (e, t) => ({
957
+ Jt = (e, t) => ({
930
958
  source: e,
931
959
  target: t,
932
960
  type: o.changeText,
933
961
  data: {},
934
962
  }),
935
- Jt = (e, t) => ({
963
+ Gt = (e, t) => ({
936
964
  source: e,
937
965
  target: t,
938
966
  type: o.replaceNode,
939
967
  data: {},
940
968
  }),
941
- Gt = (e, t, s) => ({
969
+ Ht = (e, t, s) => ({
942
970
  source: e,
943
971
  target: t,
944
972
  data: s,
945
973
  type: o.removeAttribute,
946
974
  }),
947
- Ht = (e, t, s) => ({
975
+ Ct = (e, t, s) => ({
948
976
  source: e,
949
977
  target: t,
950
978
  data: s,
@@ -1060,7 +1088,7 @@ const j = (e) => {
1060
1088
  isSvg: s,
1061
1089
  }),
1062
1090
  )
1063
- : r.push(Gt(e, t, { name: l.name, isSvg: s }))
1091
+ : r.push(Ht(e, t, { name: l.name, isSvg: s }))
1064
1092
  }
1065
1093
  }
1066
1094
  for (u = 0; u < c; u++) {
@@ -1076,7 +1104,7 @@ const j = (e) => {
1076
1104
  }
1077
1105
  d ||
1078
1106
  r.push(
1079
- Ht(e, t, {
1107
+ Ct(e, t, {
1080
1108
  name: l.name,
1081
1109
  value: l.value,
1082
1110
  isSvg: s,
@@ -1141,7 +1169,7 @@ const j = (e) => {
1141
1169
  return s.concat(r).concat(n)
1142
1170
  },
1143
1171
  ue = (e, t) => it(e, t, !0),
1144
- ae = (e, t) => (e.textContent !== t.textContent ? [Ct(e, t)] : []),
1172
+ ae = (e, t) => (e.textContent !== t.textContent ? [Jt(e, t)] : []),
1145
1173
  ce = (e, t, s) => {
1146
1174
  let r = []
1147
1175
  if (e.nodeType === 1 && At(e)) {
@@ -1187,7 +1215,7 @@ const j = (e) => {
1187
1215
  : d
1188
1216
  ? a.check(d)
1189
1217
  ? r.push(A(l, { parent: s, index: u }))
1190
- : (i.clear(d), r.push(Jt(d, l)))
1218
+ : (i.clear(d), r.push(Gt(d, l)))
1191
1219
  : r.push(A(l, { parent: s, index: u }))
1192
1220
  } else d && i.pullMatch(d).element && r.push(S(d))
1193
1221
  }
@@ -1236,7 +1264,7 @@ const j = (e) => {
1236
1264
  const { source: t, target: s } = e
1237
1265
  t.replaceWith(s)
1238
1266
  },
1239
- ge = (e) => {
1267
+ ye = (e) => {
1240
1268
  const { source: t, data: s } = e,
1241
1269
  { name: r, isSvg: n } = s
1242
1270
  n ? t.removeAttributeNS(null, r) : t.removeAttribute(r)
@@ -1246,7 +1274,7 @@ const j = (e) => {
1246
1274
  { name: r, value: n, isSvg: i } = s
1247
1275
  i ? t.setAttributeNS(null, r, n) : t.setAttribute(r, n)
1248
1276
  },
1249
- ye = (e) => {
1277
+ ge = (e) => {
1250
1278
  ut(e)
1251
1279
  },
1252
1280
  Ee = (e) => {
@@ -1278,9 +1306,9 @@ const j = (e) => {
1278
1306
  [o.removeNode]: fe,
1279
1307
  [o.insertNode]: be,
1280
1308
  [o.replaceNode]: ve,
1281
- [o.removeAttribute]: ge,
1309
+ [o.removeAttribute]: ye,
1282
1310
  [o.addAttribute]: ut,
1283
- [o.updateAttribute]: ye,
1311
+ [o.updateAttribute]: ge,
1284
1312
  [o.removeEvent]: Ee,
1285
1313
  [o.addEvent]: Ae,
1286
1314
  [o.updateEvent]: xe,
@@ -1366,42 +1394,42 @@ class ke {
1366
1394
  }
1367
1395
  }
1368
1396
  const $e = (e) => e,
1369
- De = ({ Template: e, viewModel: t, subscriptions: s }) => (
1397
+ Be = ({ Template: e, viewModel: t, subscriptions: s }) => (
1370
1398
  (s = s || []),
1371
1399
  (t = t || $e),
1372
1400
  (r) =>
1373
1401
  new ke({ Template: e, viewModel: t, subscriptions: s, attributes: r })
1374
1402
  ),
1375
- Pe =
1403
+ De =
1376
1404
  (e) =>
1377
1405
  ({ path: t }) =>
1378
1406
  t === e,
1379
- Fe = () => !0,
1407
+ Pe = () => !0,
1380
1408
  at =
1381
1409
  (e) =>
1382
1410
  ({ route: t }) => {
1383
1411
  const s = e.find((r) => r.match(t))
1384
1412
  return s && s.Partial
1385
1413
  },
1386
- He = /* @__PURE__ */ Object.freeze(
1414
+ Ce = /* @__PURE__ */ Object.freeze(
1387
1415
  /* @__PURE__ */ Object.defineProperty(
1388
1416
  {
1389
1417
  __proto__: null,
1390
1418
  buildRouter: at,
1391
- catchAll: Fe,
1392
- exactPathMatch: Pe,
1419
+ catchAll: Pe,
1420
+ exactPathMatch: De,
1393
1421
  },
1394
1422
  Symbol.toStringTag,
1395
1423
  { value: 'Module' },
1396
1424
  ),
1397
1425
  ),
1398
- Be = () => ({
1426
+ Fe = () => ({
1399
1427
  render: (e, t) => [],
1400
1428
  }),
1401
1429
  Qe = (e) => {
1402
1430
  const t = at(e)
1403
- return De({
1404
- Template: ({ route: r }) => (t({ route: r }) || Be)(),
1431
+ return Be({
1432
+ Template: ({ route: r }) => (t({ route: r }) || Fe)(),
1405
1433
  subscriptions: ['route'],
1406
1434
  })
1407
1435
  },
@@ -1415,7 +1443,7 @@ const $e = (e) => e,
1415
1443
  findHref: U,
1416
1444
  navigate: N,
1417
1445
  onLinkClick: q,
1418
- onLocationChange: C,
1446
+ onLocationChange: J,
1419
1447
  start: Lt,
1420
1448
  },
1421
1449
  Symbol.toStringTag,
@@ -1427,16 +1455,16 @@ export {
1427
1455
  Le as BooleanStore,
1428
1456
  Ie as Equality,
1429
1457
  Re as Is,
1430
- Ge as JaxsTypes,
1458
+ He as JaxsTypes,
1431
1459
  ze as ListStore,
1432
1460
  Ke as RecordStore,
1433
1461
  Ue as appBuilding,
1434
- De as bind,
1435
- Je as createApp,
1436
- Pt as jsx,
1462
+ Be as bind,
1463
+ Ge as createApp,
1464
+ Dt as jsx,
1437
1465
  qe as messageBus,
1438
1466
  We as navigation,
1439
1467
  Qe as routedView,
1440
- He as routing,
1441
- Ce as state,
1468
+ Ce as routing,
1469
+ Je as state,
1442
1470
  }
package/dist/jaxs.umd.cjs CHANGED
@@ -7,11 +7,28 @@
7
7
  b((l.jaxs = {})))
8
8
  })(this, function (l) {
9
9
  'use strict'
10
- const b = (e, t) => e.reduce((s, r) => (r !== t && s.push(r), s), []),
11
- j = (e, t) => e.reduce((s, r) => (t(r) || s.push(r), s), []),
10
+ const b = (e, t) => {
11
+ for (let s = e.length - 1; s >= 0; s--) e[s] === t && e.splice(s, 1)
12
+ return e
13
+ },
14
+ j = (e, t) => {
15
+ for (let s = e.length - 1; s >= 0; s--) t(e[s]) && e.splice(s, 1)
16
+ return e
17
+ },
12
18
  O = (e, t, s) => (e.splice(t, 0, s), e),
13
19
  M = (e, t) => (e.includes(t) || e.push(t), e),
14
- dt = { remove: b, removeBy: j, insertAt: O, appendIfUnique: M }
20
+ dt = {
21
+ remove: b,
22
+ removeBy: j,
23
+ insertAt: O,
24
+ appendIfUnique: M,
25
+ push: (e, t) => e.push(t),
26
+ pop: (e) => e.pop(),
27
+ unshift: (e, t) => e.unshift(t),
28
+ shift: (e) => e.shift(),
29
+ sortBy: (e, t) => e.sort(t),
30
+ includes: (e, t) => e.includes(t),
31
+ }
15
32
  class pt {
16
33
  constructor(t) {
17
34
  this.store = t
@@ -43,7 +60,7 @@
43
60
  }
44
61
  }
45
62
  const v = (e) => new pt(e),
46
- mt = {
63
+ ft = {
47
64
  toggle: (e) => v(e).toggle(),
48
65
  setTrue: (e) => v(e).setTrue(),
49
66
  setFalse: (e) => v(e).setFalse(),
@@ -51,7 +68,7 @@
51
68
  isTrue: (e) => v(e).isTrue(),
52
69
  isFalse: (e) => v(e).isFalse(),
53
70
  }
54
- class ft {
71
+ class mt {
55
72
  constructor(t) {
56
73
  this.store = t
57
74
  }
@@ -105,20 +122,30 @@
105
122
  const s = this.value
106
123
  M(s, t), this.update(s)
107
124
  }
125
+ findBy(t) {
126
+ return this.value.find(t)
127
+ }
128
+ replace(t, s) {
129
+ const r = this.value,
130
+ n = r.indexOf(t)
131
+ n !== -1 && ((r[n] = s), this.update(r))
132
+ }
108
133
  }
109
- const f = (e) => new ft(e),
134
+ const m = (e) => new mt(e),
110
135
  bt = {
111
- push: (e, t) => f(e).push(t),
112
- pop: (e) => f(e).pop(),
113
- unshift: (e, t) => f(e).unshift(t),
114
- shift: (e) => f(e).shift(),
115
- sortBy: (e, t) => f(e).sortBy(t),
116
- insertAt: (e, t, s) => f(e).insertAt(t, s),
117
- remove: (e, t) => f(e).remove(t),
118
- removeBy: (e, t) => f(e).removeBy(t),
119
- reset: (e) => f(e).reset(),
120
- includes: (e, t) => f(e).includes(t),
121
- appendIfUnique: (e, t) => f(e).appendIfUnique(t),
136
+ push: (e, t) => m(e).push(t),
137
+ pop: (e) => m(e).pop(),
138
+ unshift: (e, t) => m(e).unshift(t),
139
+ shift: (e) => m(e).shift(),
140
+ sortBy: (e, t) => m(e).sortBy(t),
141
+ insertAt: (e, t, s) => m(e).insertAt(t, s),
142
+ remove: (e, t) => m(e).remove(t),
143
+ removeBy: (e, t) => m(e).removeBy(t),
144
+ reset: (e) => m(e).reset(),
145
+ includes: (e, t) => m(e).includes(t),
146
+ appendIfUnique: (e, t) => m(e).appendIfUnique(t),
147
+ findBy: (e, t) => m(e).findBy(t),
148
+ replace: (e, t, s) => m(e).replace(t, s),
122
149
  }
123
150
  class vt {
124
151
  constructor(t) {
@@ -159,20 +186,20 @@
159
186
  return !!this.value[t]
160
187
  }
161
188
  }
162
- const g = (e) => new vt(e),
163
- gt = {
164
- reset: (e) => g(e).reset(),
165
- resetAttribute: (e, t) => g(e).resetAttribute(t),
166
- updateAttribute: (e, t, s) => g(e).updateAttribute(t, s),
167
- updateAttributes: (e, t) => g(e).updateAttributes(t),
168
- attributeTruthy: (e, t) => g(e).attributeTruthy(t),
189
+ const y = (e) => new vt(e),
190
+ yt = {
191
+ reset: (e) => y(e).reset(),
192
+ resetAttribute: (e, t) => y(e).resetAttribute(t),
193
+ updateAttribute: (e, t, s) => y(e).updateAttribute(t, s),
194
+ updateAttributes: (e, t) => y(e).updateAttributes(t),
195
+ attributeTruthy: (e, t) => y(e).attributeTruthy(t),
169
196
  },
170
- yt = (e) => typeof e == 'boolean',
197
+ gt = (e) => typeof e == 'boolean',
171
198
  Et = (e) => typeof e == 'number',
172
199
  k = (e) => typeof e == 'string',
173
- y = (e) => Array.isArray(e),
174
- A = (e) => e !== null && !y(e) && typeof e == 'object',
175
- At = { boolean: yt, number: Et, string: k, array: y, object: A },
200
+ g = (e) => Array.isArray(e),
201
+ A = (e) => e !== null && !g(e) && typeof e == 'object',
202
+ At = { boolean: gt, number: Et, string: k, array: g, object: A },
176
203
  wt = (e, t) => t.createElement(e),
177
204
  Nt = (e, t) => {
178
205
  for (const s in t) {
@@ -285,11 +312,11 @@
285
312
  }
286
313
  }
287
314
  const $t = (e) => typeof e == 'string' || typeof e == 'number',
288
- Dt = (e) => new kt(e),
289
- Pt = (e) => ($t(e) ? Dt(e) : e),
290
- $ = (e) => Bt(e).map(Pt).flat(),
291
- Bt = (e) => (Array.isArray(e) ? e.flat() : e ? [e] : []),
292
- D = (e, t = {}) => $(e || t.children || []),
315
+ Bt = (e) => new kt(e),
316
+ Dt = (e) => ($t(e) ? Bt(e) : e),
317
+ $ = (e) => Pt(e).map(Dt).flat(),
318
+ Pt = (e) => (Array.isArray(e) ? e.flat() : e ? [e] : []),
319
+ B = (e, t = {}) => $(e || t.children || []),
293
320
  Ft = (e, t = '') => {
294
321
  const s = {},
295
322
  r = {}
@@ -308,17 +335,17 @@
308
335
  Vt = (e, t, s = '') => (t == null ? s : t.toString()),
309
336
  Lt = (e, t) => {
310
337
  const s = e || {},
311
- r = D(t, s)
338
+ r = B(t, s)
312
339
  return (s.children = s.children || r), s
313
340
  },
314
- P = (e, t, s, r = []) => e.reduce(zt(t, s), r).flat(),
341
+ D = (e, t, s, r = []) => e.reduce(zt(t, s), r).flat(),
315
342
  zt = (e, t) => (s, r) =>
316
343
  r
317
344
  ? Array.isArray(r)
318
- ? P(r, e, t, s)
345
+ ? D(r, e, t, s)
319
346
  : (r.render(e, t).forEach((n) => s.push(n)), s)
320
347
  : s
321
- class B {
348
+ class P {
322
349
  constructor(t) {
323
350
  this.collection = $(t)
324
351
  }
@@ -328,7 +355,7 @@
328
355
  return this.attachToParent(r), r
329
356
  }
330
357
  generateDom(t) {
331
- return P(this.collection, t, this.parentElement)
358
+ return D(this.collection, t, this.parentElement)
332
359
  }
333
360
  attachToParent(t) {
334
361
  if (this.parentElement === void 0) return
@@ -371,7 +398,7 @@
371
398
  ;(this.events = n),
372
399
  (this.attributes = i),
373
400
  (this.isSvg = Tt(this.type, this.attributes.xmlns)),
374
- (this.children = new B(r))
401
+ (this.children = new P(r))
375
402
  }
376
403
  render(t) {
377
404
  const s = this.generateDom(t)
@@ -395,8 +422,8 @@
395
422
  const F = (e, t, ...s) =>
396
423
  typeof e == 'string' ? new Rt(e, t, s) : e(Lt(t, s))
397
424
  F.fragment = (e, t) => {
398
- const s = D(t, e)
399
- return new B(s)
425
+ const s = B(t, e)
426
+ return new P(s)
400
427
  }
401
428
  class Ut {
402
429
  constructor(t, s, r) {
@@ -478,31 +505,31 @@
478
505
  d = { host: n, path: c, query: u }
479
506
  t.store('route').update(d), s(z, d)
480
507
  },
481
- C = (e) => {
508
+ J = (e) => {
482
509
  const { subscribe: t } = e
483
510
  t(V, U),
484
511
  t(L, (s) => {
485
512
  S(s)
486
513
  })
487
514
  },
488
- J = (e) => {
515
+ G = (e) => {
489
516
  const { publish: t, subscribe: s, state: r, window: n } = e
490
517
  K(r), n.addEventListener('popstate', () => t(E, null)), s(E, I)
491
518
  },
492
- G = (e) => {
519
+ H = (e) => {
493
520
  setTimeout(() => e.publish(E, null), 0)
494
521
  },
495
- H = (e) => {
496
- J(e), C(e), G(e)
522
+ C = (e) => {
523
+ G(e), J(e), H(e)
497
524
  },
498
- Ct = Object.freeze(
525
+ Jt = Object.freeze(
499
526
  Object.defineProperty(
500
527
  {
501
528
  __proto__: null,
502
- publishLocation: G,
503
- startNavigation: H,
504
- subscribeToHistoryChange: J,
505
- subscribeToNavigation: C,
529
+ publishLocation: H,
530
+ startNavigation: C,
531
+ subscribeToHistoryChange: G,
532
+ subscribeToNavigation: J,
506
533
  },
507
534
  Symbol.toStringTag,
508
535
  { value: 'Module' },
@@ -532,10 +559,10 @@
532
559
  return this.roots.push(r), r
533
560
  }
534
561
  startNavigation() {
535
- H(this)
562
+ C(this)
536
563
  }
537
564
  }
538
- const Jt = Object.freeze(
565
+ const Gt = Object.freeze(
539
566
  Object.defineProperty({ __proto__: null, App: Q }, Symbol.toStringTag, {
540
567
  value: 'Module',
541
568
  }),
@@ -578,7 +605,7 @@
578
605
  return this.lookup.filter((s) => s.matcher.test(t))
579
606
  }
580
607
  }
581
- class Gt {
608
+ class Ht {
582
609
  constructor({ publish: t, event: s, payload: r, timer: n }) {
583
610
  ;(this.setNewTimeout = () => {
584
611
  this.stopped ||
@@ -615,7 +642,7 @@
615
642
  ((this.callCount += 1), this.publish(this.event, this.payload))
616
643
  }
617
644
  }
618
- const Ht = (e) => {
645
+ const Ct = (e) => {
619
646
  const { offset: t, period: s } = e,
620
647
  r = ({ callCount: n }) => (t && n == 0 ? t : s)
621
648
  return {
@@ -627,8 +654,8 @@
627
654
  },
628
655
  Qt = (e) => {
629
656
  let t
630
- 'timer' in e ? (t = e) : (t = Ht(e))
631
- const s = new Gt(t)
657
+ 'timer' in e ? (t = e) : (t = Ct(e))
658
+ const s = new Ht(t)
632
659
  return s.start(), s.stop
633
660
  }
634
661
  class Y {
@@ -702,13 +729,13 @@
702
729
  return w(r, n)
703
730
  }),
704
731
  et = (e, t) =>
705
- !(y(e) && y(t)) || e.length !== t.length
732
+ !(g(e) && g(t)) || e.length !== t.length
706
733
  ? !1
707
734
  : e.every((s, r) => {
708
735
  const n = t[r]
709
736
  return w(s, n)
710
737
  }),
711
- w = (e, t) => (A(e) ? tt(e, t) : y(e) ? et(e, t) : Xt(e, t)),
738
+ w = (e, t) => (A(e) ? tt(e, t) : g(e) ? et(e, t) : Xt(e, t)),
712
739
  Zt = { objects: tt, arrays: et, equal: w }
713
740
  class _ {
714
741
  constructor(t) {
@@ -895,7 +922,7 @@
895
922
  de = (e, t, s) => ({ source: e, target: t, type: o.changeValue, data: s }),
896
923
  pe = (e, t) => (e.type > t.type ? 1 : e.type < t.type ? -1 : 0),
897
924
  it = { index: -1 }
898
- class me {
925
+ class fe {
899
926
  constructor() {
900
927
  this.map = {}
901
928
  }
@@ -928,7 +955,7 @@
928
955
  }
929
956
  }
930
957
  const ot = (e) => {
931
- const t = new me()
958
+ const t = new fe()
932
959
  return t.populate(e), t
933
960
  },
934
961
  ut = (e, t, s = !1) => {
@@ -943,9 +970,9 @@
943
970
  const h = n.item(u)
944
971
  if (h) {
945
972
  for (d = 0; d < c; d++) {
946
- const m = a.item(d)
947
- if (m && h.name == m.name) {
948
- p = m
973
+ const f = a.item(d)
974
+ if (f && h.name == f.name) {
975
+ p = f
949
976
  break
950
977
  }
951
978
  }
@@ -960,9 +987,9 @@
960
987
  const h = a.item(u)
961
988
  if (h) {
962
989
  for (d = 0; d < i; d++) {
963
- const m = n.item(d)
964
- if (m && m.name == h.name) {
965
- p = m
990
+ const f = n.item(d)
991
+ if (f && f.name == h.name) {
992
+ p = f
966
993
  break
967
994
  }
968
995
  }
@@ -971,7 +998,7 @@
971
998
  }
972
999
  return r
973
1000
  },
974
- fe = (e, t) => {
1001
+ me = (e, t) => {
975
1002
  const s = [],
976
1003
  r = e.eventMaps,
977
1004
  n = t.eventMaps,
@@ -1002,16 +1029,16 @@
1002
1029
  },
1003
1030
  be = (e) => e.tagName !== 'INPUT',
1004
1031
  ve = (e, t) => e.value === t.value,
1005
- ge = (e, t) => {
1032
+ ye = (e, t) => {
1006
1033
  if (be(e) || ve(e, t)) return []
1007
1034
  const s = e,
1008
1035
  r = t
1009
1036
  return [de(s, r, { name: 'value', value: r.value })]
1010
1037
  },
1011
- ye = (e, t) => {
1038
+ ge = (e, t) => {
1012
1039
  const s = ut(e, t),
1013
- r = fe(e, t),
1014
- n = ge(e, t)
1040
+ r = me(e, t),
1041
+ n = ye(e, t)
1015
1042
  return s.concat(r).concat(n)
1016
1043
  },
1017
1044
  Ee = (e, t) => ut(e, t, !0),
@@ -1027,7 +1054,7 @@
1027
1054
  } else if (e.nodeType === 1) {
1028
1055
  const n = e,
1029
1056
  i = t,
1030
- a = ye(n, i),
1057
+ a = ge(n, i),
1031
1058
  c = s(n.childNodes, i.childNodes, n)
1032
1059
  r = a.concat(c)
1033
1060
  } else e.nodeType === 3 && (r = Ae(e, t))
@@ -1044,11 +1071,11 @@
1044
1071
  const p = e[u],
1045
1072
  h = t[u]
1046
1073
  if (h && a.check(h)) {
1047
- const m = i.pullMatch(h)
1074
+ const f = i.pullMatch(h)
1048
1075
  a.clear(h),
1049
- m.element
1050
- ? (m.index !== u && r.push(T(m.element, { parent: s, index: u })),
1051
- c.push({ source: m.element, target: h }))
1076
+ f.element
1077
+ ? (f.index !== u && r.push(T(f.element, { parent: s, index: u })),
1078
+ c.push({ source: f.element, target: h }))
1052
1079
  : p
1053
1080
  ? a.check(p)
1054
1081
  ? r.push(T(h, { parent: s, index: u }))
@@ -1060,7 +1087,7 @@
1060
1087
  r.push(nt(p))
1061
1088
  })
1062
1089
  const d = c.reduce(
1063
- (p, { source: h, target: m }) => p.concat(we(h, m, at)),
1090
+ (p, { source: h, target: f }) => p.concat(we(h, f, at)),
1064
1091
  [],
1065
1092
  )
1066
1093
  return r.concat(d).sort(pe)
@@ -1114,19 +1141,19 @@
1114
1141
  $e = (e) => {
1115
1142
  ct(e)
1116
1143
  },
1117
- De = (e) => {
1144
+ Be = (e) => {
1118
1145
  const t = e.data,
1119
1146
  s = e.source,
1120
1147
  { name: r, value: n } = t
1121
1148
  s.removeEventListener(r, n)
1122
1149
  },
1123
- Pe = (e) => {
1150
+ De = (e) => {
1124
1151
  const t = e.data,
1125
1152
  s = e.source,
1126
1153
  { name: r, value: n } = t
1127
1154
  s.addEventListener(r, n)
1128
1155
  },
1129
- Be = (e) => {
1156
+ Pe = (e) => {
1130
1157
  const t = e.data,
1131
1158
  s = e.source,
1132
1159
  { name: r, sourceValue: n, targetValue: i } = t
@@ -1146,9 +1173,9 @@
1146
1173
  [o.removeAttribute]: ke,
1147
1174
  [o.addAttribute]: ct,
1148
1175
  [o.updateAttribute]: $e,
1149
- [o.removeEvent]: De,
1150
- [o.addEvent]: Pe,
1151
- [o.updateEvent]: Be,
1176
+ [o.removeEvent]: Be,
1177
+ [o.addEvent]: De,
1178
+ [o.updateEvent]: Pe,
1152
1179
  [o.changeValue]: Fe,
1153
1180
  },
1154
1181
  Le = (e, t, s) => {
@@ -1231,27 +1258,27 @@
1231
1258
  return `${x}:${t}`
1232
1259
  }
1233
1260
  }
1234
- const Ce = (e) => e,
1261
+ const Je = (e) => e,
1235
1262
  lt = ({ Template: e, viewModel: t, subscriptions: s }) => (
1236
1263
  (s = s || []),
1237
- (t = t || Ce),
1264
+ (t = t || Je),
1238
1265
  (r) =>
1239
1266
  new Ie({ Template: e, viewModel: t, subscriptions: s, attributes: r })
1240
1267
  ),
1241
- Je =
1268
+ Ge =
1242
1269
  (e) =>
1243
1270
  ({ path: t }) =>
1244
1271
  t === e,
1245
- Ge = () => !0,
1272
+ He = () => !0,
1246
1273
  ht =
1247
1274
  (e) =>
1248
1275
  ({ route: t }) => {
1249
1276
  const s = e.find((r) => r.match(t))
1250
1277
  return s && s.Partial
1251
1278
  },
1252
- He = Object.freeze(
1279
+ Ce = Object.freeze(
1253
1280
  Object.defineProperty(
1254
- { __proto__: null, buildRouter: ht, catchAll: Ge, exactPathMatch: Je },
1281
+ { __proto__: null, buildRouter: ht, catchAll: He, exactPathMatch: Ge },
1255
1282
  Symbol.toStringTag,
1256
1283
  { value: 'Module' },
1257
1284
  ),
@@ -1275,27 +1302,27 @@
1275
1302
  navigate: S,
1276
1303
  onLinkClick: U,
1277
1304
  onLocationChange: I,
1278
- start: Ct,
1305
+ start: Jt,
1279
1306
  },
1280
1307
  Symbol.toStringTag,
1281
1308
  { value: 'Module' },
1282
1309
  ),
1283
1310
  )
1284
1311
  ;(l.ArrayModifiers = dt),
1285
- (l.BooleanStore = mt),
1312
+ (l.BooleanStore = ft),
1286
1313
  (l.Equality = Zt),
1287
1314
  (l.Is = At),
1288
1315
  (l.JaxsTypes = re),
1289
1316
  (l.ListStore = bt),
1290
- (l.RecordStore = gt),
1291
- (l.appBuilding = Jt),
1317
+ (l.RecordStore = yt),
1318
+ (l.appBuilding = Gt),
1292
1319
  (l.bind = lt),
1293
1320
  (l.createApp = se),
1294
1321
  (l.jsx = F),
1295
1322
  (l.messageBus = Wt),
1296
1323
  (l.navigation = Xe),
1297
1324
  (l.routedView = We),
1298
- (l.routing = He),
1325
+ (l.routing = Ce),
1299
1326
  (l.state = te),
1300
1327
  Object.defineProperty(l, Symbol.toStringTag, { value: 'Module' })
1301
1328
  })
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "jaxs",
3
3
  "description": "Modular J/TSX application framework",
4
4
  "private": false,
5
- "version": "0.9.1",
5
+ "version": "0.9.3",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "build": "vite build; npm run lint",