jaxs 0.4.2 → 0.4.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
@@ -291,7 +291,6 @@ declare module "types" {
291
291
  };
292
292
  export interface Renderable {
293
293
  render: (renderKit: RenderKit, parentElement?: JaxsElement) => JaxsNode[];
294
- isSvg: boolean;
295
294
  }
296
295
  export type StaticTemplate = () => Renderable;
297
296
  export type TypedTemplate<T> = (props: Props<T>) => Renderable;
@@ -421,7 +420,7 @@ declare module "rendering/dom/tag" {
421
420
  declare module "rendering/dom/svg" {
422
421
  import type { TagAttributes, JaxsElement } from "types";
423
422
  export const namespace = "http://www.w3.org/2000/svg";
424
- export const isSvgTag: (tagType: string) => tagType is "svg";
423
+ export const isSvgTag: (tagType: string, attributeNamespace?: string) => boolean;
425
424
  export const createSvgNode: (type: string, attributes: TagAttributes, document: Document) => JaxsElement;
426
425
  export const elementIsSvg: (element: JaxsElement) => boolean;
427
426
  }
@@ -432,7 +431,6 @@ declare module "rendering/templates/text" {
432
431
  import { Renderable, TextValue, RenderKit } from "types";
433
432
  export class TextTemplate implements Renderable {
434
433
  value: string;
435
- isSvg: boolean;
436
434
  constructor(content: TextValue);
437
435
  render(renderKit: RenderKit): Text[];
438
436
  }
@@ -444,13 +442,9 @@ declare module "rendering/templates/children/text" {
444
442
  export const textNode: (content: TextValue) => TextTemplate;
445
443
  export const replaceTextNodes: (child: TextValue | Renderable) => Renderable | TextTemplate;
446
444
  }
447
- declare module "rendering/templates/children/svg" {
448
- import { Renderable } from "types";
449
- export const withSvgFlag: (isSvg: boolean) => (template: Renderable) => Renderable;
450
- }
451
445
  declare module "rendering/templates/children/normalize" {
452
- import { JsxCollection, Renderable, AttributesWithChildren } from "types";
453
- export const normalizeJsxChildren: (jsxChildren: JsxCollection, isSvg: boolean) => Renderable[];
446
+ import { JsxCollection, AttributesWithChildren } from "types";
447
+ export const normalizeJsxChildren: (jsxChildren: JsxCollection) => (import("types").Renderable | import("rendering/templates/text").TextTemplate)[];
454
448
  export const normalizeToArray: <T>(children: T | T[]) => T[];
455
449
  export const ensureJsxChildrenArray: <T>(maybeChildren?: JsxCollection, attributes?: AttributesWithChildren<T>) => JsxCollection;
456
450
  }
@@ -468,8 +462,7 @@ declare module "rendering/templates/children" {
468
462
  export class Children implements Renderable {
469
463
  collection: Renderable[];
470
464
  parentElement?: JaxsElement;
471
- isSvg: boolean;
472
- constructor(jsxChildren: JsxCollection, isSvg?: boolean);
465
+ constructor(jsxChildren: JsxCollection);
473
466
  render(renderKit: RenderKit, parentElement: JaxsElement | undefined): JaxsNode[];
474
467
  generateDom(renderKit: RenderKit): JaxsNode[];
475
468
  attachToParent(dom: JaxsNodes): void;
@@ -496,7 +489,7 @@ declare module "rendering/templates/tag" {
496
489
  props: Props<T>;
497
490
  children: Children;
498
491
  isSvg: boolean;
499
- constructor(tagType: string, props: Props<T>, children?: JsxCollection, isSvg?: boolean);
492
+ constructor(tagType: string, props: Props<T>, children?: JsxCollection);
500
493
  render(renderKit: RenderKit): JaxsNode[];
501
494
  generateDom(renderKit: RenderKit): import("types").JaxsElement;
502
495
  generateHtmlDom(renderKit: RenderKit): import("types").JaxsElement;
package/dist/jaxs.js CHANGED
@@ -1,66 +1,129 @@
1
1
  const tt = (e, t) => t.createElement(e), et = (e, t) => {
2
2
  for (const s in t) {
3
3
  if (s === "__self") continue;
4
- const n = t[s].toString();
5
- s === "value" ? e.value = n : e.setAttribute(s, n);
4
+ const r = t[s].toString();
5
+ s === "value" ? e.value = r : e.setAttribute(s, r);
6
6
  }
7
7
  }, st = (e, t, s) => {
8
- const n = {};
9
- for (const r in t) {
10
- const o = t[r], a = (h) => s(o, h);
11
- e.addEventListener(r, a), n[r] = {
12
- domEvent: r,
8
+ const r = {};
9
+ for (const n in t) {
10
+ const o = t[n], c = (h) => s(o, h);
11
+ e.addEventListener(n, c), r[n] = {
12
+ domEvent: n,
13
13
  busEvent: o,
14
- listener: a
14
+ listener: c
15
15
  };
16
16
  }
17
- e.eventMaps = n;
18
- }, nt = (e, t, s, n) => {
19
- const r = tt(e, n.document);
20
- return et(r, t), st(r, s, n.publish), r;
21
- }, N = "http://www.w3.org/2000/svg", rt = (e) => e === "svg", ot = (e, t, s) => {
22
- const n = s.createElementNS(N, e);
23
- for (const r in t)
24
- r === "__self" || r === "xmlns" || n.setAttributeNS(null, r, t[r].toString());
25
- return n;
26
- }, it = (e) => e.namespaceURI === N, at = (e, t) => t.createTextNode(e);
17
+ e.eventMaps = r;
18
+ }, rt = (e, t, s, r) => {
19
+ const n = tt(e, r.document);
20
+ return et(n, t), st(n, s, r.publish), n;
21
+ }, E = "http://www.w3.org/2000/svg", nt = {
22
+ animate: !0,
23
+ animateMotion: !0,
24
+ animateTransform: !0,
25
+ circle: !0,
26
+ clipPath: !0,
27
+ defs: !0,
28
+ desc: !0,
29
+ ellipse: !0,
30
+ feBlend: !0,
31
+ feColorMatrix: !0,
32
+ feComponentTransfer: !0,
33
+ feComposite: !0,
34
+ feConvolveMatrix: !0,
35
+ feDiffuseLighting: !0,
36
+ feDisplacementMap: !0,
37
+ feDistantLight: !0,
38
+ feDropShadow: !0,
39
+ feFlood: !0,
40
+ feFuncA: !0,
41
+ feFuncB: !0,
42
+ feFuncG: !0,
43
+ feFuncR: !0,
44
+ feGaussianBlur: !0,
45
+ feImage: !0,
46
+ feMerge: !0,
47
+ feMergeNode: !0,
48
+ feMorphology: !0,
49
+ feOffset: !0,
50
+ fePointLight: !0,
51
+ feSpecularLighting: !0,
52
+ feSpotLight: !0,
53
+ feTile: !0,
54
+ feTurbulence: !0,
55
+ filter: !0,
56
+ foreignObject: !0,
57
+ g: !0,
58
+ image: !0,
59
+ line: !0,
60
+ linearGradient: !0,
61
+ marker: !0,
62
+ mask: !0,
63
+ metadata: !0,
64
+ mpath: !0,
65
+ path: !0,
66
+ pattern: !0,
67
+ polygon: !0,
68
+ polyline: !0,
69
+ radialGradient: !0,
70
+ rect: !0,
71
+ script: !0,
72
+ set: !0,
73
+ stop: !0,
74
+ style: !0,
75
+ svg: !0,
76
+ switch: !0,
77
+ symbol: !0,
78
+ text: !0,
79
+ textPath: !0,
80
+ title: !0,
81
+ tspan: !0,
82
+ use: !0,
83
+ view: !0
84
+ }, ot = (e, t) => !!(nt[e] || e === "a" && t === E), it = (e, t, s) => {
85
+ const r = s.createElementNS(E, e);
86
+ for (const n in t)
87
+ n === "__self" || n === "xmlns" || r.setAttributeNS(null, n, t[n].toString());
88
+ return r;
89
+ }, ut = (e) => e.namespaceURI === E, at = (e, t) => t.createTextNode(e);
27
90
  class ct {
28
91
  constructor(t) {
29
- this.value = t.toString(), this.isSvg = !1;
92
+ this.value = t.toString();
30
93
  }
31
94
  render(t) {
32
95
  const s = at(this.value, t.document);
33
96
  return s.__jsx = "TextNode", [s];
34
97
  }
35
98
  }
36
- const ut = (e) => typeof e == "string" || typeof e == "number", ht = (e) => new ct(e), lt = (e) => ut(e) ? ht(e) : e, dt = (e) => (t) => (t && (t.isSvg = t.isSvg || e), t), pt = (e, t) => mt(e).map(lt).flat().map(dt(t)), mt = (e) => Array.isArray(e) ? e.flat() : e ? [e] : [], j = (e, t = {}) => e || t.children || [], bt = (e, t = "") => {
37
- const s = {}, n = {};
38
- for (const r in e) {
39
- const o = e[r];
40
- if (r.match(/^on.+/i)) {
41
- const a = r.slice(2).toLowerCase();
42
- n[a] = o ? o.toString() : "";
99
+ const ht = (e) => typeof e == "string" || typeof e == "number", lt = (e) => new ct(e), dt = (e) => ht(e) ? lt(e) : e, pt = (e) => mt(e).map(dt).flat(), mt = (e) => Array.isArray(e) ? e.flat() : e ? [e] : [], j = (e, t = {}) => e || t.children || [], ft = (e, t = "") => {
100
+ const s = {}, r = {};
101
+ for (const n in e) {
102
+ const o = e[n];
103
+ if (n.match(/^on.+/i)) {
104
+ const c = n.slice(2).toLowerCase();
105
+ r[c] = o ? o.toString() : "";
43
106
  } else {
44
107
  if (o === !1) continue;
45
- r === "__source" ? s.__source = e.__source : s[r] = ft(r, o, t);
108
+ n === "__source" ? s.__source = e.__source : s[n] = bt(n, o, t);
46
109
  }
47
110
  }
48
111
  return {
49
112
  attributes: s,
50
- events: n
113
+ events: r
51
114
  };
52
- }, ft = (e, t, s = "") => t == null ? s : t.toString(), vt = (e, t) => {
53
- const s = e || {}, n = j(t, s);
54
- return s.children = s.children || n, s;
55
- }, k = (e, t, s = []) => e.reduce(gt(t), s).flat(), gt = (e) => (t, s) => s ? Array.isArray(s) ? k(s, e, t) : (s.render(e).forEach((n) => t.push(n)), t) : t;
56
- class O {
57
- constructor(t, s = !1) {
58
- this.collection = pt(t, s), this.isSvg = s;
115
+ }, bt = (e, t, s = "") => t == null ? s : t.toString(), vt = (e, t) => {
116
+ const s = e || {}, r = j(t, s);
117
+ return s.children = s.children || r, s;
118
+ }, k = (e, t, s = []) => e.reduce(gt(t), s).flat(), gt = (e) => (t, s) => s ? Array.isArray(s) ? k(s, e, t) : (s.render(e).forEach((r) => t.push(r)), t) : t;
119
+ class M {
120
+ constructor(t) {
121
+ this.collection = pt(t);
59
122
  }
60
123
  render(t, s) {
61
124
  this.parentElement = s;
62
- const n = this.generateDom(t);
63
- return this.attachToParent(n), n;
125
+ const r = this.generateDom(t);
126
+ return this.attachToParent(r), r;
64
127
  }
65
128
  generateDom(t) {
66
129
  return k(this.collection, t);
@@ -68,7 +131,7 @@ class O {
68
131
  attachToParent(t) {
69
132
  if (this.parentElement === void 0) return;
70
133
  const s = this.parentElement;
71
- t.forEach((n) => s.appendChild(n));
134
+ t.forEach((r) => s.appendChild(r));
72
135
  }
73
136
  }
74
137
  class yt {
@@ -80,20 +143,20 @@ class yt {
80
143
  }
81
144
  sourceKey() {
82
145
  if (this.attributes.__source) {
83
- const { fileName: t, lineNumber: s, columnNumber: n } = this.attributes.__source;
84
- return `${t}:${s}:${n}`;
146
+ const { fileName: t, lineNumber: s, columnNumber: r } = this.attributes.__source;
147
+ return `${t}:${s}:${r}`;
85
148
  }
86
149
  }
87
150
  createKeyFromAttributes() {
88
- const t = this.attributes.id ? `#${this.attributes.id}` : "", s = this.attributes.type ? `[type=${this.attributes.type}]` : "", n = this.attributes.name ? `[name=${this.attributes.name}]` : "";
89
- return `${this.type}${t}${s}${n}`;
151
+ const t = this.attributes.id ? `#${this.attributes.id}` : "", s = this.attributes.type ? `[type=${this.attributes.type}]` : "", r = this.attributes.name ? `[name=${this.attributes.name}]` : "";
152
+ return `${this.type}${t}${s}${r}`;
90
153
  }
91
154
  }
92
155
  class Et {
93
- constructor(t, s, n = [], r = !1) {
156
+ constructor(t, s, r = []) {
94
157
  this.type = t;
95
- const { events: o, attributes: a } = bt(s);
96
- this.events = o, this.attributes = a, this.isSvg = r || rt(this.type), this.children = new O(n, this.isSvg);
158
+ const { events: n, attributes: o } = ft(s);
159
+ this.events = n, this.attributes = o, this.isSvg = ot(this.type, this.attributes.xmlns), this.children = new M(r);
97
160
  }
98
161
  render(t) {
99
162
  const s = this.generateDom(t);
@@ -103,7 +166,7 @@ class Et {
103
166
  return this.isSvg ? this.generateSvgDom(t) : this.generateHtmlDom(t);
104
167
  }
105
168
  generateHtmlDom(t) {
106
- const s = nt(
169
+ const s = rt(
107
170
  this.type,
108
171
  this.attributes,
109
172
  this.events,
@@ -112,21 +175,21 @@ class Et {
112
175
  return s.__jsx = this.jsxKey(), s;
113
176
  }
114
177
  generateSvgDom(t) {
115
- const s = ot(this.type, this.attributes, t.document);
178
+ const s = it(this.type, this.attributes, t.document);
116
179
  return s.__jsx = this.jsxKey(), s;
117
180
  }
118
181
  jsxKey() {
119
182
  return new yt(this.type, this.attributes).generate();
120
183
  }
121
184
  }
122
- const At = (e, t, ...s) => typeof e == "string" ? new Et(e, t, s) : e(vt(t, s));
123
- At.fragment = (e, t) => {
185
+ const xt = (e, t, ...s) => typeof e == "string" ? new Et(e, t, s) : e(vt(t, s));
186
+ xt.fragment = (e, t) => {
124
187
  const s = j(t, e);
125
- return new O(s);
188
+ return new M(s);
126
189
  };
127
- class St {
128
- constructor(t, s, n) {
129
- this.template = t, this.selector = s, this.renderKit = n, this.dom = [];
190
+ class At {
191
+ constructor(t, s, r) {
192
+ this.template = t, this.selector = s, this.renderKit = r, this.dom = [];
130
193
  }
131
194
  renderAndAttach(t) {
132
195
  this.parentElement = this.getParentElement(), this.dom = this.render({ ...t, parent: this.parentElement }), this.parentElement && this.attach();
@@ -143,65 +206,65 @@ class St {
143
206
  return this.renderKit.document.querySelector(this.selector);
144
207
  }
145
208
  }
146
- const xt = (e, t, s) => {
147
- const n = new St(e, t, s);
148
- return n.renderAndAttach(s), n;
149
- }, $ = "go-to-href", m = "navigation:location-change", M = "navigation:route-change", wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
209
+ const wt = (e, t, s) => {
210
+ const r = new At(e, t, s);
211
+ return r.renderAndAttach(s), r;
212
+ }, O = "go-to-href", m = "navigation:location-change", F = "navigation:route-change", St = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
150
213
  __proto__: null,
151
- linkNavigationEvent: $,
214
+ linkNavigationEvent: O,
152
215
  locationChangeEvent: m,
153
- routeChangeEvent: M
154
- }, Symbol.toStringTag, { value: "Module" })), F = (e) => {
216
+ routeChangeEvent: F
217
+ }, Symbol.toStringTag, { value: "Module" })), T = (e) => {
155
218
  e.createRecord("route", {
156
219
  host: "",
157
220
  path: "",
158
221
  query: {}
159
222
  });
160
- }, T = (e) => {
223
+ }, $ = (e) => {
161
224
  const t = e.closest("[href]");
162
225
  return t && t.getAttribute("href") || "";
163
226
  }, D = (e, { publish: t, window: s }) => {
164
227
  s.history.pushState(null, "", e), t(m, null);
165
- }, U = (e, t) => {
228
+ }, L = (e, t) => {
166
229
  if (!e || !e.target) return;
167
230
  e.preventDefault();
168
- const s = T(e.target);
231
+ const s = $(e.target);
169
232
  D(s, t);
170
- }, z = (e) => e.replace(/^\?/, "").split("&").reduce((t, s) => {
233
+ }, B = (e) => e.replace(/^\?/, "").split("&").reduce((t, s) => {
171
234
  if (!s) return t;
172
- const n = s.split("=");
173
- return t[n[0]] = n[1], t;
174
- }, {}), L = (e, t) => {
175
- const { state: s, publish: n, window: r } = t, { host: o, pathname: a, search: h } = r.location, i = a, d = z(h), u = {
235
+ const r = s.split("=");
236
+ return t[r[0]] = r[1], t;
237
+ }, {}), P = (e, t) => {
238
+ const { state: s, publish: r, window: n } = t, { host: o, pathname: c, search: h } = n.location, i = c, d = B(h), a = {
176
239
  host: o,
177
240
  path: i,
178
241
  query: d
179
242
  };
180
- s.store("route").update(u), n(M, u);
181
- }, B = (e) => {
243
+ s.store("route").update(a), r(F, a);
244
+ }, U = (e) => {
182
245
  const { subscribe: t } = e;
183
- t($, U);
184
- }, P = (e) => {
185
- const { publish: t, subscribe: s, state: n, window: r } = e;
186
- F(n), r.addEventListener("popstate", () => t(m, null)), s(m, L);
246
+ t(O, L);
247
+ }, z = (e) => {
248
+ const { publish: t, subscribe: s, state: r, window: n } = e;
249
+ T(r), n.addEventListener("popstate", () => t(m, null)), s(m, P);
187
250
  }, V = (e) => {
188
251
  setTimeout(() => e.publish(m, null), 0);
189
252
  }, K = (e) => {
190
- P(e), B(e), V(e);
253
+ z(e), U(e), V(e);
191
254
  }, _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
192
255
  __proto__: null,
193
256
  publishLocation: V,
194
257
  startNavigation: K,
195
- subscribeToHistoryChange: P,
196
- subscribeToNavigation: B
258
+ subscribeToHistoryChange: z,
259
+ subscribeToNavigation: U
197
260
  }, Symbol.toStringTag, { value: "Module" }));
198
261
  class R {
199
- constructor({ window: t, document: s, publish: n, subscribe: r, bus: o, state: a, renderKit: h }) {
200
- this.window = t, this.document = s, this.publish = n, this.subscribe = r, this.bus = o, this.state = a, this.renderKit = h, this.roots = [];
262
+ constructor({ window: t, document: s, publish: r, subscribe: n, bus: o, state: c, renderKit: h }) {
263
+ this.window = t, this.document = s, this.publish = r, this.subscribe = n, this.bus = o, this.state = c, this.renderKit = h, this.roots = [];
201
264
  }
202
265
  render(t, s) {
203
- const n = xt(t, s, this.renderKit);
204
- return this.roots.push(n), n;
266
+ const r = wt(t, s, this.renderKit);
267
+ return this.roots.push(r), r;
205
268
  }
206
269
  startNavigation() {
207
270
  K(this);
@@ -215,17 +278,17 @@ class q {
215
278
  constructor() {
216
279
  this.lookup = {};
217
280
  }
218
- add(t, s, n) {
281
+ add(t, s, r) {
219
282
  this.ensureArrayFor(t);
220
- const r = {
283
+ const n = {
221
284
  listener: s,
222
- index: n,
285
+ index: r,
223
286
  matcher: t
224
287
  };
225
- return this.lookup[t].push(r), () => this.remove(r);
288
+ return this.lookup[t].push(n), () => this.remove(n);
226
289
  }
227
290
  remove(t) {
228
- this.lookup[t.matcher] && (this.lookup[t.matcher] = this.lookup[t.matcher].reduce((s, n) => (n !== t && s.push(n), s), []));
291
+ this.lookup[t.matcher] && (this.lookup[t.matcher] = this.lookup[t.matcher].reduce((s, r) => (r !== t && s.push(r), s), []));
229
292
  }
230
293
  matches(t) {
231
294
  return this.lookup[t] || [];
@@ -238,16 +301,16 @@ class J {
238
301
  constructor() {
239
302
  this.lookup = [];
240
303
  }
241
- add(t, s, n) {
242
- const r = {
304
+ add(t, s, r) {
305
+ const n = {
243
306
  listener: s,
244
- index: n,
307
+ index: r,
245
308
  matcher: t
246
309
  };
247
- return this.lookup.push(r), () => this.remove(r);
310
+ return this.lookup.push(n), () => this.remove(n);
248
311
  }
249
312
  remove(t) {
250
- this.lookup = this.lookup.reduce((s, n) => (n !== t && s.push(n), s), []);
313
+ this.lookup = this.lookup.reduce((s, r) => (r !== t && s.push(r), s), []);
251
314
  }
252
315
  matches(t) {
253
316
  return this.lookup.filter(
@@ -260,23 +323,23 @@ class H {
260
323
  this.exactSubscriptions = new q(), this.fuzzySubscriptions = new J(), this.currentIndex = 0;
261
324
  }
262
325
  subscribe(t, s) {
263
- let n;
264
- return typeof t == "string" ? n = this.exactSubscriptions.add(
326
+ let r;
327
+ return typeof t == "string" ? r = this.exactSubscriptions.add(
265
328
  t,
266
329
  s,
267
330
  this.currentIndex
268
- ) : n = this.fuzzySubscriptions.add(
331
+ ) : r = this.fuzzySubscriptions.add(
269
332
  t,
270
333
  s,
271
334
  this.currentIndex
272
- ), this.currentIndex += 1, n;
335
+ ), this.currentIndex += 1, r;
273
336
  }
274
337
  publish(t, s) {
275
338
  [
276
339
  ...this.exactSubscriptions.matches(t),
277
340
  ...this.fuzzySubscriptions.matches(t)
278
- ].sort((r, o) => r.index - o.index).forEach((r) => {
279
- r.listener(s, this.listenerOptions(t));
341
+ ].sort((n, o) => n.index - o.index).forEach((n) => {
342
+ n.listener(s, this.listenerOptions(t));
280
343
  });
281
344
  }
282
345
  addListenerOptions(t) {
@@ -294,8 +357,8 @@ const I = () => {
294
357
  const e = new H();
295
358
  return {
296
359
  bus: e,
297
- publish: (n, r) => e.publish(n, r),
298
- subscribe: (n, r) => e.subscribe(n, r)
360
+ publish: (r, n) => e.publish(r, n),
361
+ subscribe: (r, n) => e.subscribe(r, n)
299
362
  };
300
363
  }, me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
301
364
  __proto__: null,
@@ -303,14 +366,14 @@ const I = () => {
303
366
  FuzzySubscriptions: J,
304
367
  JaxsBus: H,
305
368
  createBus: I
306
- }, Symbol.toStringTag, { value: "Module" })), b = (e) => Array.isArray(e), g = (e) => e !== null && !b(e) && typeof e == "object", Nt = (e, t) => e === t, jt = (e, t) => Object.keys(e).length === Object.keys(t).length, kt = (e, t) => !(g(e) && g(t)) || !jt(e, t) ? !1 : Object.keys(e).every((s) => {
307
- const n = e[s], r = t[s];
308
- return E(n, r);
309
- }), Ot = (e, t) => !(b(e) && b(t)) || e.length !== t.length ? !1 : e.every((s, n) => {
310
- const r = t[n];
311
- return E(s, r);
312
- }), E = (e, t) => g(e) ? kt(e, t) : b(e) ? Ot(e, t) : Nt(e, t);
313
- class f {
369
+ }, Symbol.toStringTag, { value: "Module" })), f = (e) => Array.isArray(e), g = (e) => e !== null && !f(e) && typeof e == "object", Nt = (e, t) => e === t, jt = (e, t) => Object.keys(e).length === Object.keys(t).length, kt = (e, t) => !(g(e) && g(t)) || !jt(e, t) ? !1 : Object.keys(e).every((s) => {
370
+ const r = e[s], n = t[s];
371
+ return x(r, n);
372
+ }), Mt = (e, t) => !(f(e) && f(t)) || e.length !== t.length ? !1 : e.every((s, r) => {
373
+ const n = t[r];
374
+ return x(s, n);
375
+ }), x = (e, t) => g(e) ? kt(e, t) : f(e) ? Mt(e, t) : Nt(e, t);
376
+ class b {
314
377
  constructor(t) {
315
378
  this.store = t;
316
379
  }
@@ -324,9 +387,9 @@ class f {
324
387
  return this.store.value;
325
388
  }
326
389
  addUpdaterFunction(t, s) {
327
- this.constructor.prototype[t] = (...n) => {
328
- const r = s(this.value, ...n);
329
- this.update(r);
390
+ this.constructor.prototype[t] = (...r) => {
391
+ const n = s(this.value, ...r);
392
+ this.update(n);
330
393
  };
331
394
  }
332
395
  addUpdaterFunctions(t) {
@@ -334,11 +397,11 @@ class f {
334
397
  this.addUpdaterFunction(s, t[s]);
335
398
  }
336
399
  }
337
- class A extends f {
400
+ class A extends b {
338
401
  addUpdaterFunction(t, s) {
339
- this.constructor.prototype[t] = (...n) => {
340
- const r = s(this.value, ...n);
341
- this.update(r);
402
+ this.constructor.prototype[t] = (...r) => {
403
+ const n = s(this.value, ...r);
404
+ this.update(n);
342
405
  };
343
406
  }
344
407
  push(t) {
@@ -367,13 +430,13 @@ class A extends f {
367
430
  s.sort(t), this.update(s);
368
431
  }
369
432
  insertAt(t, s) {
370
- const n = [...this.value];
371
- n.splice(t, 0, s), this.update(n);
433
+ const r = [...this.value];
434
+ r.splice(t, 0, s), this.update(r);
372
435
  }
373
436
  }
374
437
  class y {
375
438
  constructor(t) {
376
- this.name = t.name, this.parent = t.parent, this._value = t.value, this.initialState = structuredClone(t.value), this.updater = new f(this);
439
+ this.name = t.name, this.parent = t.parent, this._value = t.value, this.initialState = structuredClone(t.value), this.updater = new b(this);
377
440
  }
378
441
  get value() {
379
442
  return this._value;
@@ -389,7 +452,7 @@ class y {
389
452
  this.updateValue(t);
390
453
  }
391
454
  updateValue(t) {
392
- E(this._value, t) || (this._value = t, this.parent.notify(this.name));
455
+ x(this._value, t) || (this._value = t, this.parent.notify(this.name));
393
456
  }
394
457
  getUpdatedValue(t) {
395
458
  return t(this.value);
@@ -404,7 +467,7 @@ class y {
404
467
  this.updater instanceof A && this.updater.addSorter(t, s);
405
468
  }
406
469
  }
407
- class Q extends f {
470
+ class G extends b {
408
471
  toggle() {
409
472
  const t = !this.value;
410
473
  this.update(t);
@@ -416,48 +479,48 @@ class Q extends f {
416
479
  this.update(!1);
417
480
  }
418
481
  addUpdaterFunction(t, s) {
419
- this.constructor.prototype[t] = (...n) => {
420
- const r = s(this.value, ...n);
421
- this.update(r);
482
+ this.constructor.prototype[t] = (...r) => {
483
+ const n = s(this.value, ...r);
484
+ this.update(n);
422
485
  };
423
486
  }
424
487
  }
425
- class W extends f {
488
+ class C extends b {
426
489
  addUpdaterFunction(t, s) {
427
- this.constructor.prototype[t] = (...n) => {
428
- const r = s(this.value, ...n);
429
- this.update(r);
490
+ this.constructor.prototype[t] = (...r) => {
491
+ const n = s(this.value, ...r);
492
+ this.update(n);
430
493
  };
431
494
  }
432
495
  updateAttribute(t, s) {
433
- const n = { ...this.value };
434
- n[t] = s, this.update(n);
496
+ const r = { ...this.value };
497
+ r[t] = s, this.update(r);
435
498
  }
436
499
  }
437
- const S = "state";
438
- class G {
500
+ const w = "state";
501
+ class Q {
439
502
  constructor(t) {
440
- this.publisher = t, this.stores = {}, this.eventNamePrefix = S, this.notifications = /* @__PURE__ */ new Set(), this.inTransaction = !1;
503
+ this.publisher = t, this.stores = {}, this.eventNamePrefix = w, this.notifications = /* @__PURE__ */ new Set(), this.inTransaction = !1;
441
504
  }
442
505
  create(t, s) {
443
- const n = new y({
506
+ const r = new y({
444
507
  name: t,
445
508
  parent: this,
446
509
  value: s
447
510
  });
448
- return this.stores[t] = n, n;
511
+ return this.stores[t] = r, r;
449
512
  }
450
513
  createBoolean(t, s) {
451
- const n = this.create(t, s);
452
- return n.updater = new Q(n), n;
514
+ const r = this.create(t, s);
515
+ return r.updater = new G(r), r;
453
516
  }
454
517
  createRecord(t, s) {
455
- const n = this.create(t, s);
456
- return n.updater = new W(n), n;
518
+ const r = this.create(t, s);
519
+ return r.updater = new C(r), r;
457
520
  }
458
521
  createList(t, s) {
459
- const n = this.create(t, s);
460
- return n.updater = new A(n), n;
522
+ const r = this.create(t, s);
523
+ return r.updater = new A(r), r;
461
524
  }
462
525
  store(t) {
463
526
  return this.stores[t] || new y({
@@ -470,7 +533,7 @@ class G {
470
533
  return this.store(t).value;
471
534
  }
472
535
  getAll(t) {
473
- return t.reduce((s, n) => (s[n] = this.get(n), s), {});
536
+ return t.reduce((s, r) => (s[r] = this.get(r), s), {});
474
537
  }
475
538
  notify(t) {
476
539
  this.inTransaction ? this.notifications.add(t) : this.publish(t);
@@ -496,17 +559,17 @@ class G {
496
559
  return `${this.eventNamePrefix}:${t}`;
497
560
  }
498
561
  }
499
- const X = (e) => new G(e), be = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
562
+ const W = (e) => new Q(e), fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
500
563
  __proto__: null,
501
- State: G,
564
+ State: Q,
502
565
  Store: y,
503
- StoreUpdaterBoolean: Q,
566
+ StoreUpdaterBoolean: G,
504
567
  StoreUpdaterList: A,
505
- StoreUpdaterObject: W,
506
- createState: X,
507
- eventName: S
568
+ StoreUpdaterObject: C,
569
+ createState: W,
570
+ eventName: w
508
571
  }, Symbol.toStringTag, { value: "Module" }));
509
- class $t {
572
+ class Ot {
510
573
  constructor(t) {
511
574
  this.setupDomEnvironment(t);
512
575
  }
@@ -525,11 +588,11 @@ class $t {
525
588
  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);
526
589
  }
527
590
  setupBus() {
528
- const { publish: t, subscribe: s, bus: n } = I();
529
- this.publish = t, this.subscribe = s, this.bus = n;
591
+ const { publish: t, subscribe: s, bus: r } = I();
592
+ this.publish = t, this.subscribe = s, this.bus = r;
530
593
  }
531
594
  setupState() {
532
- this.state = X(this.publish);
595
+ this.state = W(this.publish);
533
596
  }
534
597
  addBusOptions() {
535
598
  this.bus.addListenerOptions({
@@ -548,94 +611,94 @@ class $t {
548
611
  };
549
612
  }
550
613
  }
551
- const fe = (e = {}) => {
552
- const s = new $t(e).setup();
614
+ const be = (e = {}) => {
615
+ const s = new Ot(e).setup();
553
616
  return s.startNavigation(), s;
554
617
  };
555
- var c = /* @__PURE__ */ ((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))(c || {});
618
+ var u = /* @__PURE__ */ ((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))(u || {});
556
619
  const ve = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
557
620
  __proto__: null,
558
- ChangeInstructionTypes: c
559
- }, Symbol.toStringTag, { value: "Module" })), Mt = (e, t) => ({
621
+ ChangeInstructionTypes: u
622
+ }, Symbol.toStringTag, { value: "Module" })), Ft = (e, t) => ({
560
623
  source: e,
561
624
  target: t,
562
- type: c.changeText,
625
+ type: u.changeText,
563
626
  data: {}
564
- }), Ft = (e, t) => ({
627
+ }), Tt = (e, t) => ({
565
628
  source: e,
566
629
  target: t,
567
- type: c.replaceNode,
630
+ type: u.replaceNode,
568
631
  data: {}
569
- }), Tt = (e, t, s) => ({
632
+ }), $t = (e, t, s) => ({
570
633
  source: e,
571
634
  target: t,
572
635
  data: s,
573
- type: c.removeAttribute
636
+ type: u.removeAttribute
574
637
  }), Dt = (e, t, s) => ({
575
638
  source: e,
576
639
  target: t,
577
640
  data: s,
578
- type: c.addAttribute
579
- }), Ut = (e, t, s) => ({
641
+ type: u.addAttribute
642
+ }), Lt = (e, t, s) => ({
580
643
  source: e,
581
644
  target: t,
582
645
  data: s,
583
- type: c.updateAttribute
584
- }), zt = (e, t, s) => ({
646
+ type: u.updateAttribute
647
+ }), Bt = (e, t, s) => ({
585
648
  source: e,
586
649
  target: t,
587
650
  data: s,
588
- type: c.removeEvent
589
- }), Lt = (e, t, s) => ({
651
+ type: u.removeEvent
652
+ }), Pt = (e, t, s) => ({
590
653
  source: e,
591
654
  target: t,
592
655
  data: s,
593
- type: c.addEvent
594
- }), Bt = (e, t, s) => ({
656
+ type: u.addEvent
657
+ }), Ut = (e, t, s) => ({
595
658
  source: e,
596
659
  target: t,
597
660
  data: s,
598
- type: c.updateEvent
599
- }), x = (e) => ({
661
+ type: u.updateEvent
662
+ }), S = (e) => ({
600
663
  source: e,
601
664
  target: e,
602
665
  // for type crap only
603
- type: c.removeNode,
666
+ type: u.removeNode,
604
667
  data: {}
605
668
  }), v = (e, t) => ({
606
669
  target: e,
607
670
  source: e,
608
671
  // for type crap only
609
- type: c.insertNode,
672
+ type: u.insertNode,
610
673
  data: t
611
- }), Pt = (e, t, s) => ({
674
+ }), zt = (e, t, s) => ({
612
675
  source: e,
613
676
  target: t,
614
- type: c.changeValue,
677
+ type: u.changeValue,
615
678
  data: s
616
- }), Vt = (e, t) => e.type > t.type ? 1 : e.type < t.type ? -1 : 0, w = { index: -1 };
679
+ }), Vt = (e, t) => e.type > t.type ? 1 : e.type < t.type ? -1 : 0, _ = { index: -1 };
617
680
  class Kt {
618
681
  constructor() {
619
682
  this.map = {};
620
683
  }
621
684
  populate(t) {
622
- t.forEach((s, n) => {
623
- const r = s.__jsx;
624
- r && (this.map[r] = this.map[r] || [], this.map[r].push({
685
+ t.forEach((s, r) => {
686
+ const n = s.__jsx;
687
+ n && (this.map[n] = this.map[n] || [], this.map[n].push({
625
688
  element: s,
626
- index: n
689
+ index: r
627
690
  }));
628
691
  });
629
692
  }
630
693
  pullMatch(t) {
631
694
  const s = t && t.__jsx;
632
- return !s || !(this.map[s] && this.map[s].length) ? w : this.map[s].shift();
695
+ return !s || !(this.map[s] && this.map[s].length) ? _ : this.map[s].shift();
633
696
  }
634
697
  clear(t) {
635
698
  const s = t && t.__jsx;
636
699
  if (!(s && this.map[s] && this.map[s].length)) return;
637
- const n = this.map[s];
638
- this.map[s] = n.reduce((r, o) => (o.element !== t && r.push(o), r), []);
700
+ const r = this.map[s];
701
+ this.map[s] = r.reduce((n, o) => (o.element !== t && n.push(o), n), []);
639
702
  }
640
703
  check(t) {
641
704
  const s = t && t.__jsx;
@@ -645,46 +708,46 @@ class Kt {
645
708
  return Object.values(this.map).flat();
646
709
  }
647
710
  }
648
- const _ = (e) => {
711
+ const N = (e) => {
649
712
  const t = new Kt();
650
713
  return t.populate(e), t;
651
- }, Y = (e, t, s = !1) => {
652
- const n = [], r = e.attributes, o = r.length, a = t.attributes, h = a.length;
653
- let i, d, u;
714
+ }, X = (e, t, s = !1) => {
715
+ const r = [], n = e.attributes, o = n.length, c = t.attributes, h = c.length;
716
+ let i, d, a;
654
717
  for (i = 0; i < o; i++) {
655
- u = null;
656
- const l = r.item(i);
718
+ a = null;
719
+ const l = n.item(i);
657
720
  if (l) {
658
721
  for (d = 0; d < h; d++) {
659
- const p = a.item(d);
722
+ const p = c.item(d);
660
723
  if (p && l.name == p.name) {
661
- u = p;
724
+ a = p;
662
725
  break;
663
726
  }
664
727
  }
665
- u ? l.value !== u.value && n.push(
666
- Ut(e, t, {
728
+ a ? l.value !== a.value && r.push(
729
+ Lt(e, t, {
667
730
  name: l.name,
668
- value: u.value,
731
+ value: a.value,
669
732
  isSvg: s
670
733
  })
671
- ) : n.push(
672
- Tt(e, t, { name: l.name, isSvg: s })
734
+ ) : r.push(
735
+ $t(e, t, { name: l.name, isSvg: s })
673
736
  );
674
737
  }
675
738
  }
676
739
  for (i = 0; i < h; i++) {
677
- u = null;
678
- const l = a.item(i);
740
+ a = null;
741
+ const l = c.item(i);
679
742
  if (l) {
680
743
  for (d = 0; d < o; d++) {
681
- const p = r.item(d);
744
+ const p = n.item(d);
682
745
  if (p && p.name == l.name) {
683
- u = p;
746
+ a = p;
684
747
  break;
685
748
  }
686
749
  }
687
- u || n.push(
750
+ a || r.push(
688
751
  Dt(e, t, {
689
752
  name: l.name,
690
753
  value: l.value,
@@ -693,27 +756,27 @@ const _ = (e) => {
693
756
  );
694
757
  }
695
758
  }
696
- return n;
759
+ return r;
697
760
  }, Rt = (e, t) => {
698
- const s = [], n = e.eventMaps, r = t.eventMaps, o = Object.keys(n), a = Object.keys(r);
761
+ const s = [], r = e.eventMaps, n = t.eventMaps, o = Object.keys(r), c = Object.keys(n);
699
762
  return o.forEach((h) => {
700
- const i = n[h], d = r[h];
763
+ const i = r[h], d = n[h];
701
764
  d ? d.busEvent !== i.busEvent && s.push(
702
- Bt(e, t, {
765
+ Ut(e, t, {
703
766
  name: h,
704
767
  targetValue: d.listener,
705
768
  sourceValue: i.listener
706
769
  })
707
770
  ) : s.push(
708
- zt(e, t, {
771
+ Bt(e, t, {
709
772
  name: i.domEvent,
710
773
  value: i.listener
711
774
  })
712
775
  );
713
- }), a.forEach((h) => {
714
- const i = n[h], d = r[h];
776
+ }), c.forEach((h) => {
777
+ const i = r[h], d = n[h];
715
778
  i || s.push(
716
- Lt(e, t, {
779
+ Pt(e, t, {
717
780
  name: d.domEvent,
718
781
  value: d.listener
719
782
  })
@@ -722,37 +785,37 @@ const _ = (e) => {
722
785
  }, qt = (e) => e.tagName !== "INPUT", Jt = (e, t) => e.value === t.value, Ht = (e, t) => {
723
786
  if (qt(e) || Jt(e, t))
724
787
  return [];
725
- const s = e, n = t;
726
- return [Pt(s, n, { name: "value", value: n.value })];
788
+ const s = e, r = t;
789
+ return [zt(s, r, { name: "value", value: r.value })];
727
790
  }, It = (e, t) => {
728
- const s = Y(e, t), n = Rt(e, t), r = Ht(e, t);
729
- return s.concat(n).concat(r);
730
- }, Qt = (e, t) => Y(e, t, !0), Wt = (e, t) => e.textContent !== t.textContent ? [Mt(e, t)] : [], Gt = (e, t, s) => {
731
- let n = [];
732
- if (e.nodeType === 1 && it(e)) {
733
- const r = e, o = t, a = Qt(r, o), h = s(
734
- r.childNodes,
791
+ const s = X(e, t), r = Rt(e, t), n = Ht(e, t);
792
+ return s.concat(r).concat(n);
793
+ }, Gt = (e, t) => X(e, t, !0), Ct = (e, t) => e.textContent !== t.textContent ? [Ft(e, t)] : [], Qt = (e, t, s) => {
794
+ let r = [];
795
+ if (e.nodeType === 1 && ut(e)) {
796
+ const n = e, o = t, c = Gt(n, o), h = s(
797
+ n.childNodes,
735
798
  o.childNodes,
736
- r
799
+ n
737
800
  );
738
- n = a.concat(h);
801
+ r = c.concat(h);
739
802
  } else if (e.nodeType === 1) {
740
- const r = e, o = t, a = It(r, o), h = s(
741
- r.childNodes,
803
+ const n = e, o = t, c = It(n, o), h = s(
804
+ n.childNodes,
742
805
  o.childNodes,
743
- r
806
+ n
744
807
  );
745
- n = a.concat(h);
746
- } else e.nodeType === 3 && (n = Wt(e, t));
747
- return n;
748
- }, Z = (e, t, s) => {
749
- const n = [], r = Xt(e, t), o = _(e), a = _(t), h = [];
808
+ r = c.concat(h);
809
+ } else e.nodeType === 3 && (r = Ct(e, t));
810
+ return r;
811
+ }, Y = (e, t, s) => {
812
+ const r = [], n = Wt(e, t), o = N(e), c = N(t), h = [];
750
813
  let i = 0;
751
- for (; i < r; i++) {
752
- const u = e[i], l = t[i];
753
- if (l && a.check(l)) {
814
+ for (; i < n; i++) {
815
+ const a = e[i], l = t[i];
816
+ if (l && c.check(l)) {
754
817
  const p = o.pullMatch(l);
755
- a.clear(l), p.element ? (p.index !== i && n.push(
818
+ c.clear(l), p.element ? (p.index !== i && r.push(
756
819
  v(p.element, {
757
820
  parent: s,
758
821
  index: i
@@ -760,35 +823,35 @@ const _ = (e) => {
760
823
  ), h.push({
761
824
  source: p.element,
762
825
  target: l
763
- })) : u ? a.check(u) ? n.push(
826
+ })) : a ? c.check(a) ? r.push(
764
827
  v(l, { parent: s, index: i })
765
- ) : (o.clear(u), n.push(
766
- Ft(u, l)
767
- )) : n.push(
828
+ ) : (o.clear(a), r.push(
829
+ Tt(a, l)
830
+ )) : r.push(
768
831
  v(l, { parent: s, index: i })
769
832
  );
770
- } else u && o.pullMatch(u).element && n.push(x(u));
833
+ } else a && o.pullMatch(a).element && r.push(S(a));
771
834
  }
772
- o.remaining().forEach(({ element: u }) => {
773
- n.push(x(u));
835
+ o.remaining().forEach(({ element: a }) => {
836
+ r.push(S(a));
774
837
  });
775
838
  const d = h.reduce(
776
- (u, { source: l, target: p }) => u.concat(
777
- Gt(l, p, Z)
839
+ (a, { source: l, target: p }) => a.concat(
840
+ Qt(l, p, Y)
778
841
  ),
779
842
  []
780
843
  );
781
- return n.concat(d).sort(Vt);
782
- }, Xt = (e, t) => {
783
- const s = e.length, n = t.length;
784
- return s > n ? s : n;
785
- }, Yt = (e, t, s) => {
786
- Z(e, t, s).forEach((r) => {
787
- Zt(r);
844
+ return r.concat(d).sort(Vt);
845
+ }, Wt = (e, t) => {
846
+ const s = e.length, r = t.length;
847
+ return s > r ? s : r;
848
+ }, Xt = (e, t, s) => {
849
+ Y(e, t, s).forEach((n) => {
850
+ Yt(n);
788
851
  });
852
+ }, Yt = (e) => {
853
+ (he[e.type] || Zt)(e);
789
854
  }, Zt = (e) => {
790
- (he[e.type] || Ct)(e);
791
- }, Ct = (e) => {
792
855
  }, te = (e) => {
793
856
  const { source: t, target: s } = e;
794
857
  t.nodeValue = s.textContent;
@@ -796,47 +859,47 @@ const _ = (e) => {
796
859
  const { source: t } = e;
797
860
  t.remove();
798
861
  }, se = (e) => {
799
- const { target: t, data: s } = e, { parent: n, index: r } = s, o = n.childNodes[r];
800
- o ? o && o !== t && n.insertBefore(t, o) : n.appendChild(t);
801
- }, ne = (e) => {
862
+ const { target: t, data: s } = e, { parent: r, index: n } = s, o = r.childNodes[n];
863
+ o ? o && o !== t && r.insertBefore(t, o) : r.appendChild(t);
864
+ }, re = (e) => {
802
865
  const { source: t, target: s } = e;
803
866
  t.replaceWith(s);
804
- }, re = (e) => {
805
- const { source: t, data: s } = e, { name: n, isSvg: r } = s;
806
- r ? t.removeAttributeNS(null, n) : t.removeAttribute(n);
807
- }, C = (e) => {
808
- const { source: t, data: s } = e, { name: n, value: r, isSvg: o } = s;
809
- o ? t.setAttributeNS(null, n, r) : t.setAttribute(n, r);
867
+ }, ne = (e) => {
868
+ const { source: t, data: s } = e, { name: r, isSvg: n } = s;
869
+ n ? t.removeAttributeNS(null, r) : t.removeAttribute(r);
870
+ }, Z = (e) => {
871
+ const { source: t, data: s } = e, { name: r, value: n, isSvg: o } = s;
872
+ o ? t.setAttributeNS(null, r, n) : t.setAttribute(r, n);
810
873
  }, oe = (e) => {
811
- C(e);
874
+ Z(e);
812
875
  }, ie = (e) => {
813
- const t = e.data, s = e.source, { name: n, value: r } = t;
814
- s.removeEventListener(n, r);
876
+ const t = e.data, s = e.source, { name: r, value: n } = t;
877
+ s.removeEventListener(r, n);
878
+ }, ue = (e) => {
879
+ const t = e.data, s = e.source, { name: r, value: n } = t;
880
+ s.addEventListener(r, n);
815
881
  }, ae = (e) => {
816
- const t = e.data, s = e.source, { name: n, value: r } = t;
817
- s.addEventListener(n, r);
882
+ const t = e.data, s = e.source, { name: r, sourceValue: n, targetValue: o } = t;
883
+ s.removeEventListener(r, n), s.addEventListener(r, o);
818
884
  }, ce = (e) => {
819
- const t = e.data, s = e.source, { name: n, sourceValue: r, targetValue: o } = t;
820
- s.removeEventListener(n, r), s.addEventListener(n, o);
821
- }, ue = (e) => {
822
- const t = e.data, s = e.source, { value: n } = t;
823
- s.value = n;
885
+ const t = e.data, s = e.source, { value: r } = t;
886
+ s.value = r;
824
887
  }, he = {
825
- [c.changeText]: te,
826
- [c.removeNode]: ee,
827
- [c.insertNode]: se,
828
- [c.replaceNode]: ne,
829
- [c.removeAttribute]: re,
830
- [c.addAttribute]: C,
831
- [c.updateAttribute]: oe,
832
- [c.removeEvent]: ie,
833
- [c.addEvent]: ae,
834
- [c.updateEvent]: ce,
835
- [c.changeValue]: ue
888
+ [u.changeText]: te,
889
+ [u.removeNode]: ee,
890
+ [u.insertNode]: se,
891
+ [u.replaceNode]: re,
892
+ [u.removeAttribute]: ne,
893
+ [u.addAttribute]: Z,
894
+ [u.updateAttribute]: oe,
895
+ [u.removeEvent]: ie,
896
+ [u.addEvent]: ue,
897
+ [u.updateEvent]: ae,
898
+ [u.changeValue]: ce
836
899
  };
837
900
  class le {
838
- constructor({ Template: t, subscriptions: s, attributes: n, viewModel: r }) {
839
- this.Template = t, this.viewModel = r, this.attributes = n, this.subscriptions = s, this.dom = [], this.parentElement = null;
901
+ constructor({ Template: t, subscriptions: s, attributes: r, viewModel: n }) {
902
+ this.Template = t, this.viewModel = n, this.attributes = r, this.subscriptions = s, this.dom = [], this.parentElement = null;
840
903
  }
841
904
  render(t) {
842
905
  return this.parentElement = t.parent, this.renderKit = t, this.subscribeForRerender(), this.dom = this.generateDom(t), this.dom;
@@ -847,8 +910,8 @@ class le {
847
910
  ...this.viewModel(
848
911
  t.state.getAll(this.subscriptions)
849
912
  )
850
- }, n = this.Template(s);
851
- return n ? n.render(t) : [];
913
+ }, r = this.Template(s);
914
+ return r ? r.render(t) : [];
852
915
  }
853
916
  rerender() {
854
917
  if (!this.parentElement && this.dom[0]) {
@@ -856,7 +919,7 @@ class le {
856
919
  this.parentElement = s;
857
920
  }
858
921
  const t = this.generateDom(this.renderKit);
859
- Yt(this.dom, t, this.parentElement), this.parentElement && (this.dom = Array.from(this.parentElement.childNodes));
922
+ Xt(this.dom, t, this.parentElement), this.parentElement && (this.dom = Array.from(this.parentElement.childNodes));
860
923
  }
861
924
  subscribeForRerender() {
862
925
  const { subscribe: t } = this.renderKit;
@@ -865,31 +928,31 @@ class le {
865
928
  });
866
929
  }
867
930
  eventName(t) {
868
- return `${S}:${t}`;
931
+ return `${w}:${t}`;
869
932
  }
870
933
  }
871
934
  const de = (e) => e, ge = ({
872
935
  Template: e,
873
936
  viewModel: t,
874
937
  subscriptions: s
875
- }) => (s = s || [], t = t || de, (n) => new le({ Template: e, viewModel: t, subscriptions: s, attributes: n })), ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
938
+ }) => (s = s || [], t = t || de, (r) => new le({ Template: e, viewModel: t, subscriptions: s, attributes: r })), ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
876
939
  __proto__: null,
877
- createRouteState: F,
878
- events: wt,
879
- extractQueryParams: z,
880
- findHref: T,
940
+ createRouteState: T,
941
+ events: St,
942
+ extractQueryParams: B,
943
+ findHref: $,
881
944
  navigate: D,
882
- onLinkClick: U,
883
- onLocationChange: L,
945
+ onLinkClick: L,
946
+ onLocationChange: P,
884
947
  start: _t
885
948
  }, Symbol.toStringTag, { value: "Module" }));
886
949
  export {
887
950
  ve as JaxsTypes,
888
951
  pe as appBuilding,
889
952
  ge as bind,
890
- fe as createApp,
891
- At as jsx,
953
+ be as createApp,
954
+ xt as jsx,
892
955
  me as messageBus,
893
956
  ye as navigation,
894
- be as state
957
+ fe as state
895
958
  };
package/dist/jaxs.umd.cjs CHANGED
@@ -1 +1 @@
1
- (function(m,b){typeof exports=="object"&&typeof module<"u"?b(exports):typeof define=="function"&&define.amd?define(["exports"],b):(m=typeof globalThis<"u"?globalThis:m||self,b(m.jaxs={}))})(this,function(m){"use strict";const b=(e,t)=>t.createElement(e),nt=(e,t)=>{for(const s in t){if(s==="__self")continue;const n=t[s].toString();s==="value"?e.value=n:e.setAttribute(s,n)}},rt=(e,t,s)=>{const n={};for(const r in t){const o=t[r],c=h=>s(o,h);e.addEventListener(r,c),n[r]={domEvent:r,busEvent:o,listener:c}}e.eventMaps=n},ot=(e,t,s,n)=>{const r=b(e,n.document);return nt(r,t),rt(r,s,n.publish),r},x="http://www.w3.org/2000/svg",it=e=>e==="svg",at=(e,t,s)=>{const n=s.createElementNS(x,e);for(const r in t)r==="__self"||r==="xmlns"||n.setAttributeNS(null,r,t[r].toString());return n},ct=e=>e.namespaceURI===x,ut=(e,t)=>t.createTextNode(e);class ht{constructor(t){this.value=t.toString(),this.isSvg=!1}render(t){const s=ut(this.value,t.document);return s.__jsx="TextNode",[s]}}const lt=e=>typeof e=="string"||typeof e=="number",dt=e=>new ht(e),pt=e=>lt(e)?dt(e):e,mt=e=>t=>(t&&(t.isSvg=t.isSvg||e),t),bt=(e,t)=>ft(e).map(pt).flat().map(mt(t)),ft=e=>Array.isArray(e)?e.flat():e?[e]:[],N=(e,t={})=>e||t.children||[],vt=(e,t="")=>{const s={},n={};for(const r in e){const o=e[r];if(r.match(/^on.+/i)){const c=r.slice(2).toLowerCase();n[c]=o?o.toString():""}else{if(o===!1)continue;r==="__source"?s.__source=e.__source:s[r]=gt(r,o,t)}}return{attributes:s,events:n}},gt=(e,t,s="")=>t==null?s:t.toString(),yt=(e,t)=>{const s=e||{},n=N(t,s);return s.children=s.children||n,s},j=(e,t,s=[])=>e.reduce(Et(t),s).flat(),Et=e=>(t,s)=>s?Array.isArray(s)?j(s,e,t):(s.render(e).forEach(n=>t.push(n)),t):t;class k{constructor(t,s=!1){this.collection=bt(t,s),this.isSvg=s}render(t,s){this.parentElement=s;const n=this.generateDom(t);return this.attachToParent(n),n}generateDom(t){return j(this.collection,t)}attachToParent(t){if(this.parentElement===void 0)return;const s=this.parentElement;t.forEach(n=>s.appendChild(n))}}class St{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 At{constructor(t,s,n=[],r=!1){this.type=t;const{events:o,attributes:c}=vt(s);this.events=o,this.attributes=c,this.isSvg=r||it(this.type),this.children=new k(n,this.isSvg)}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=ot(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 St(this.type,this.attributes).generate()}}const O=(e,t,...s)=>typeof e=="string"?new At(e,t,s):e(yt(t,s));O.fragment=(e,t)=>{const s=N(t,e);return new k(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 _t=(e,t,s)=>{const n=new wt(e,t,s);return n.renderAndAttach(s),n},T="go-to-href",f="navigation:location-change",$="navigation:route-change",xt=Object.freeze(Object.defineProperty({__proto__:null,linkNavigationEvent:T,locationChangeEvent:f,routeChangeEvent:$},Symbol.toStringTag,{value:"Module"})),M=e=>{e.createRecord("route",{host:"",path:"",query:{}})},F=e=>{const t=e.closest("[href]");return t&&t.getAttribute("href")||""},D=(e,{publish:t,window:s})=>{s.history.pushState(null,"",e),t(f,null)},U=(e,t)=>{if(!e||!e.target)return;e.preventDefault();const s=F(e.target);D(s,t)},z=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:o,pathname:c,search:h}=r.location,i=c,d=z(h),u={host:o,path:i,query:d};s.store("route").update(u),n($,u)},P=e=>{const{subscribe:t}=e;t(T,U)},B=e=>{const{publish:t,subscribe:s,state:n,window:r}=e;M(n),r.addEventListener("popstate",()=>t(f,null)),s(f,L)},V=e=>{setTimeout(()=>e.publish(f,null),0)},K=e=>{B(e),P(e),V(e)},Nt=Object.freeze(Object.defineProperty({__proto__:null,publishLocation:V,startNavigation:K,subscribeToHistoryChange:B,subscribeToNavigation:P},Symbol.toStringTag,{value:"Module"}));class R{constructor({window:t,document:s,publish:n,subscribe:r,bus:o,state:c,renderKit:h}){this.window=t,this.document=s,this.publish=n,this.subscribe=r,this.bus=o,this.state=c,this.renderKit=h,this.roots=[]}render(t,s){const n=_t(t,s,this.renderKit);return this.roots.push(n),n}startNavigation(){K(this)}}const jt=Object.freeze(Object.defineProperty({__proto__:null,App:R},Symbol.toStringTag,{value:"Module"}));class q{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 J{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 H{constructor(){this.exactSubscriptions=new q,this.fuzzySubscriptions=new J,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,o)=>r.index-o.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 I=()=>{const e=new H;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:q,FuzzySubscriptions:J,JaxsBus:H,createBus:I},Symbol.toStringTag,{value:"Module"})),v=e=>Array.isArray(e),y=e=>e!==null&&!v(e)&&typeof e=="object",Ot=(e,t)=>e===t,Tt=(e,t)=>Object.keys(e).length===Object.keys(t).length,$t=(e,t)=>!(y(e)&&y(t))||!Tt(e,t)?!1:Object.keys(e).every(s=>{const n=e[s],r=t[s];return E(n,r)}),Mt=(e,t)=>!(v(e)&&v(t))||e.length!==t.length?!1:e.every((s,n)=>{const r=t[n];return E(s,r)}),E=(e,t)=>y(e)?$t(e,t):v(e)?Mt(e,t):Ot(e,t);class g{constructor(t){this.store=t}update(t){this.store.update(t)}reset(){this.store.update(this.store.initialState)}get value(){return this.store.value}addUpdaterFunction(t,s){this.constructor.prototype[t]=(...n)=>{const r=s(this.value,...n);this.update(r)}}addUpdaterFunctions(t){for(const s in t)this.addUpdaterFunction(s,t[s])}}class S extends g{addUpdaterFunction(t,s){this.constructor.prototype[t]=(...n)=>{const r=s(this.value,...n);this.update(r)}}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)}}class A{constructor(t){this.name=t.name,this.parent=t.parent,this._value=t.value,this.initialState=structuredClone(t.value),this.updater=new g(this)}get value(){return this._value}set value(t){throw new Error("Cannot set value directly. Use an updater!")}update(t){if(typeof t=="function"){const s=this.getUpdatedValue(t);this.updateValue(s)}else this.updateValue(t)}updateValue(t){E(this._value,t)||(this._value=t,this.parent.notify(this.name))}getUpdatedValue(t){return t(this.value)}addUpdaters(t){this.updater.addUpdaterFunctions(t)}addUpdater(t,s){this.updater.addUpdaterFunction(t,s)}addSorter(t,s){this.updater instanceof S&&this.updater.addSorter(t,s)}}class Q extends g{toggle(){const t=!this.value;this.update(t)}setTrue(){this.update(!0)}setFalse(){this.update(!1)}addUpdaterFunction(t,s){this.constructor.prototype[t]=(...n)=>{const r=s(this.value,...n);this.update(r)}}}class W extends g{addUpdaterFunction(t,s){this.constructor.prototype[t]=(...n)=>{const r=s(this.value,...n);this.update(r)}}updateAttribute(t,s){const n={...this.value};n[t]=s,this.update(n)}}const w="state";class G{constructor(t){this.publisher=t,this.stores={},this.eventNamePrefix=w,this.notifications=new Set,this.inTransaction=!1}create(t,s){const n=new A({name:t,parent:this,value:s});return this.stores[t]=n,n}createBoolean(t,s){const n=this.create(t,s);return n.updater=new Q(n),n}createRecord(t,s){const n=this.create(t,s);return n.updater=new W(n),n}createList(t,s){const n=this.create(t,s);return n.updater=new S(n),n}store(t){return this.stores[t]||new A({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 X=e=>new G(e),Ft=Object.freeze(Object.defineProperty({__proto__:null,State:G,Store:A,StoreUpdaterBoolean:Q,StoreUpdaterList:S,StoreUpdaterObject:W,createState:X,eventName:w},Symbol.toStringTag,{value:"Module"}));class Dt{constructor(t){this.setupDomEnvironment(t)}setup(){return this.setupBus(),this.setupState(),this.addBusOptions(),this.setRenderKit(),new R({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}=I();this.publish=t,this.subscribe=s,this.bus=n}setupState(){this.state=X(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 Ut=(e={})=>{const s=new Dt(e).setup();return s.startNavigation(),s};var a=(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))(a||{});const zt=Object.freeze(Object.defineProperty({__proto__:null,ChangeInstructionTypes:a},Symbol.toStringTag,{value:"Module"})),Lt=(e,t)=>({source:e,target:t,type:a.changeText,data:{}}),Pt=(e,t)=>({source:e,target:t,type:a.replaceNode,data:{}}),Bt=(e,t,s)=>({source:e,target:t,data:s,type:a.removeAttribute}),Vt=(e,t,s)=>({source:e,target:t,data:s,type:a.addAttribute}),Kt=(e,t,s)=>({source:e,target:t,data:s,type:a.updateAttribute}),Rt=(e,t,s)=>({source:e,target:t,data:s,type:a.removeEvent}),qt=(e,t,s)=>({source:e,target:t,data:s,type:a.addEvent}),Jt=(e,t,s)=>({source:e,target:t,data:s,type:a.updateEvent}),Y=e=>({source:e,target:e,type:a.removeNode,data:{}}),_=(e,t)=>({target:e,source:e,type:a.insertNode,data:t}),Ht=(e,t,s)=>({source:e,target:t,type:a.changeValue,data:s}),It=(e,t)=>e.type>t.type?1:e.type<t.type?-1:0,Z={index:-1};class Qt{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)?Z: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,o)=>(o.element!==t&&r.push(o),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 C=e=>{const t=new Qt;return t.populate(e),t},tt=(e,t,s=!1)=>{const n=[],r=e.attributes,o=r.length,c=t.attributes,h=c.length;let i,d,u;for(i=0;i<o;i++){u=null;const l=r.item(i);if(l){for(d=0;d<h;d++){const p=c.item(d);if(p&&l.name==p.name){u=p;break}}u?l.value!==u.value&&n.push(Kt(e,t,{name:l.name,value:u.value,isSvg:s})):n.push(Bt(e,t,{name:l.name,isSvg:s}))}}for(i=0;i<h;i++){u=null;const l=c.item(i);if(l){for(d=0;d<o;d++){const p=r.item(d);if(p&&p.name==l.name){u=p;break}}u||n.push(Vt(e,t,{name:l.name,value:l.value,isSvg:s}))}}return n},Wt=(e,t)=>{const s=[],n=e.eventMaps,r=t.eventMaps,o=Object.keys(n),c=Object.keys(r);return o.forEach(h=>{const i=n[h],d=r[h];d?d.busEvent!==i.busEvent&&s.push(Jt(e,t,{name:h,targetValue:d.listener,sourceValue:i.listener})):s.push(Rt(e,t,{name:i.domEvent,value:i.listener}))}),c.forEach(h=>{const i=n[h],d=r[h];i||s.push(qt(e,t,{name:d.domEvent,value:d.listener}))}),s},Gt=e=>e.tagName!=="INPUT",Xt=(e,t)=>e.value===t.value,Yt=(e,t)=>{if(Gt(e)||Xt(e,t))return[];const s=e,n=t;return[Ht(s,n,{name:"value",value:n.value})]},Zt=(e,t)=>{const s=tt(e,t),n=Wt(e,t),r=Yt(e,t);return s.concat(n).concat(r)},Ct=(e,t)=>tt(e,t,!0),te=(e,t)=>e.textContent!==t.textContent?[Lt(e,t)]:[],ee=(e,t,s)=>{let n=[];if(e.nodeType===1&&ct(e)){const r=e,o=t,c=Ct(r,o),h=s(r.childNodes,o.childNodes,r);n=c.concat(h)}else if(e.nodeType===1){const r=e,o=t,c=Zt(r,o),h=s(r.childNodes,o.childNodes,r);n=c.concat(h)}else e.nodeType===3&&(n=te(e,t));return n},et=(e,t,s)=>{const n=[],r=se(e,t),o=C(e),c=C(t),h=[];let i=0;for(;i<r;i++){const u=e[i],l=t[i];if(l&&c.check(l)){const p=o.pullMatch(l);c.clear(l),p.element?(p.index!==i&&n.push(_(p.element,{parent:s,index:i})),h.push({source:p.element,target:l})):u?c.check(u)?n.push(_(l,{parent:s,index:i})):(o.clear(u),n.push(Pt(u,l))):n.push(_(l,{parent:s,index:i}))}else u&&o.pullMatch(u).element&&n.push(Y(u))}o.remaining().forEach(({element:u})=>{n.push(Y(u))});const d=h.reduce((u,{source:l,target:p})=>u.concat(ee(l,p,et)),[]);return n.concat(d).sort(It)},se=(e,t)=>{const s=e.length,n=t.length;return s>n?s:n},ne=(e,t,s)=>{et(e,t,s).forEach(r=>{re(r)})},re=e=>{(fe[e.type]||oe)(e)},oe=e=>{},ie=e=>{const{source:t,target:s}=e;t.nodeValue=s.textContent},ae=e=>{const{source:t}=e;t.remove()},ce=e=>{const{target:t,data:s}=e,{parent:n,index:r}=s,o=n.childNodes[r];o?o&&o!==t&&n.insertBefore(t,o):n.appendChild(t)},ue=e=>{const{source:t,target:s}=e;t.replaceWith(s)},he=e=>{const{source:t,data:s}=e,{name:n,isSvg:r}=s;r?t.removeAttributeNS(null,n):t.removeAttribute(n)},st=e=>{const{source:t,data:s}=e,{name:n,value:r,isSvg:o}=s;o?t.setAttributeNS(null,n,r):t.setAttribute(n,r)},le=e=>{st(e)},de=e=>{const t=e.data,s=e.source,{name:n,value:r}=t;s.removeEventListener(n,r)},pe=e=>{const t=e.data,s=e.source,{name:n,value:r}=t;s.addEventListener(n,r)},me=e=>{const t=e.data,s=e.source,{name:n,sourceValue:r,targetValue:o}=t;s.removeEventListener(n,r),s.addEventListener(n,o)},be=e=>{const t=e.data,s=e.source,{value:n}=t;s.value=n},fe={[a.changeText]:ie,[a.removeNode]:ae,[a.insertNode]:ce,[a.replaceNode]:ue,[a.removeAttribute]:he,[a.addAttribute]:st,[a.updateAttribute]:le,[a.removeEvent]:de,[a.addEvent]:pe,[a.updateEvent]:me,[a.changeValue]:be};class ve{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 s=this.dom[0].parentElement;this.parentElement=s}const t=this.generateDom(this.renderKit);ne(this.dom,t,this.parentElement),this.parentElement&&(this.dom=Array.from(this.parentElement.childNodes))}subscribeForRerender(){const{subscribe:t}=this.renderKit;this.subscriptions.forEach(s=>{t(this.eventName(s),()=>this.rerender())})}eventName(t){return`${w}:${t}`}}const ge=e=>e,ye=({Template:e,viewModel:t,subscriptions:s})=>(s=s||[],t=t||ge,n=>new ve({Template:e,viewModel:t,subscriptions:s,attributes:n})),Ee=Object.freeze(Object.defineProperty({__proto__:null,createRouteState:M,events:xt,extractQueryParams:z,findHref:F,navigate:D,onLinkClick:U,onLocationChange:L,start:Nt},Symbol.toStringTag,{value:"Module"}));m.JaxsTypes=zt,m.appBuilding=jt,m.bind=ye,m.createApp=Ut,m.jsx=O,m.messageBus=kt,m.navigation=Ee,m.state=Ft,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
1
+ (function(m,f){typeof exports=="object"&&typeof module<"u"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):(m=typeof globalThis<"u"?globalThis:m||self,f(m.jaxs={}))})(this,function(m){"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();s==="value"?e.value=n:e.setAttribute(s,n)}},rt=(e,t,s)=>{const n={};for(const r in t){const o=t[r],c=h=>s(o,h);e.addEventListener(r,c),n[r]={domEvent:r,busEvent:o,listener:c}}e.eventMaps=n},ot=(e,t,s,n)=>{const r=f(e,n.document);return nt(r,t),rt(r,s,n.publish),r},y="http://www.w3.org/2000/svg",it={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)=>!!(it[e]||e==="a"&&t===y),at=(e,t,s)=>{const n=s.createElementNS(y,e);for(const r in t)r==="__self"||r==="xmlns"||n.setAttributeNS(null,r,t[r].toString());return n},ct=e=>e.namespaceURI===y,ht=(e,t)=>t.createTextNode(e);class lt{constructor(t){this.value=t.toString()}render(t){const s=ht(this.value,t.document);return s.__jsx="TextNode",[s]}}const dt=e=>typeof e=="string"||typeof e=="number",pt=e=>new lt(e),mt=e=>dt(e)?pt(e):e,ft=e=>bt(e).map(mt).flat(),bt=e=>Array.isArray(e)?e.flat():e?[e]:[],N=(e,t={})=>e||t.children||[],vt=(e,t="")=>{const s={},n={};for(const r in e){const o=e[r];if(r.match(/^on.+/i)){const c=r.slice(2).toLowerCase();n[c]=o?o.toString():""}else{if(o===!1)continue;r==="__source"?s.__source=e.__source:s[r]=gt(r,o,t)}}return{attributes:s,events:n}},gt=(e,t,s="")=>t==null?s:t.toString(),yt=(e,t)=>{const s=e||{},n=N(t,s);return s.children=s.children||n,s},j=(e,t,s=[])=>e.reduce(Et(t),s).flat(),Et=e=>(t,s)=>s?Array.isArray(s)?j(s,e,t):(s.render(e).forEach(n=>t.push(n)),t):t;class k{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 j(this.collection,t)}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 wt{constructor(t,s,n=[]){this.type=t;const{events:r,attributes:o}=vt(s);this.events=r,this.attributes=o,this.isSvg=ut(this.type,this.attributes.xmlns),this.children=new k(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=ot(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 M=(e,t,...s)=>typeof e=="string"?new wt(e,t,s):e(yt(t,s));M.fragment=(e,t)=>{const s=N(t,e);return new k(s)};class xt{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 St=(e,t,s)=>{const n=new xt(e,t,s);return n.renderAndAttach(s),n},O="go-to-href",b="navigation:location-change",T="navigation:route-change",_t=Object.freeze(Object.defineProperty({__proto__:null,linkNavigationEvent:O,locationChangeEvent:b,routeChangeEvent:T},Symbol.toStringTag,{value:"Module"})),F=e=>{e.createRecord("route",{host:"",path:"",query:{}})},$=e=>{const t=e.closest("[href]");return t&&t.getAttribute("href")||""},D=(e,{publish:t,window:s})=>{s.history.pushState(null,"",e),t(b,null)},L=(e,t)=>{if(!e||!e.target)return;e.preventDefault();const s=$(e.target);D(s,t)},P=e=>e.replace(/^\?/,"").split("&").reduce((t,s)=>{if(!s)return t;const n=s.split("=");return t[n[0]]=n[1],t},{}),B=(e,t)=>{const{state:s,publish:n,window:r}=t,{host:o,pathname:c,search:h}=r.location,i=c,d=P(h),a={host:o,path:i,query:d};s.store("route").update(a),n(T,a)},U=e=>{const{subscribe:t}=e;t(O,L)},z=e=>{const{publish:t,subscribe:s,state:n,window:r}=e;F(n),r.addEventListener("popstate",()=>t(b,null)),s(b,B)},V=e=>{setTimeout(()=>e.publish(b,null),0)},K=e=>{z(e),U(e),V(e)},Nt=Object.freeze(Object.defineProperty({__proto__:null,publishLocation:V,startNavigation:K,subscribeToHistoryChange:z,subscribeToNavigation:U},Symbol.toStringTag,{value:"Module"}));class R{constructor({window:t,document:s,publish:n,subscribe:r,bus:o,state:c,renderKit:h}){this.window=t,this.document=s,this.publish=n,this.subscribe=r,this.bus=o,this.state=c,this.renderKit=h,this.roots=[]}render(t,s){const n=St(t,s,this.renderKit);return this.roots.push(n),n}startNavigation(){K(this)}}const jt=Object.freeze(Object.defineProperty({__proto__:null,App:R},Symbol.toStringTag,{value:"Module"}));class q{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 J{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 H{constructor(){this.exactSubscriptions=new q,this.fuzzySubscriptions=new J,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,o)=>r.index-o.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 I=()=>{const e=new H;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:q,FuzzySubscriptions:J,JaxsBus:H,createBus:I},Symbol.toStringTag,{value:"Module"})),v=e=>Array.isArray(e),E=e=>e!==null&&!v(e)&&typeof e=="object",Mt=(e,t)=>e===t,Ot=(e,t)=>Object.keys(e).length===Object.keys(t).length,Tt=(e,t)=>!(E(e)&&E(t))||!Ot(e,t)?!1:Object.keys(e).every(s=>{const n=e[s],r=t[s];return A(n,r)}),Ft=(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)?Tt(e,t):v(e)?Ft(e,t):Mt(e,t);class g{constructor(t){this.store=t}update(t){this.store.update(t)}reset(){this.store.update(this.store.initialState)}get value(){return this.store.value}addUpdaterFunction(t,s){this.constructor.prototype[t]=(...n)=>{const r=s(this.value,...n);this.update(r)}}addUpdaterFunctions(t){for(const s in t)this.addUpdaterFunction(s,t[s])}}class w extends g{addUpdaterFunction(t,s){this.constructor.prototype[t]=(...n)=>{const r=s(this.value,...n);this.update(r)}}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)}}class x{constructor(t){this.name=t.name,this.parent=t.parent,this._value=t.value,this.initialState=structuredClone(t.value),this.updater=new g(this)}get value(){return this._value}set value(t){throw new Error("Cannot set value directly. Use an updater!")}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)}addUpdaters(t){this.updater.addUpdaterFunctions(t)}addUpdater(t,s){this.updater.addUpdaterFunction(t,s)}addSorter(t,s){this.updater instanceof w&&this.updater.addSorter(t,s)}}class G extends g{toggle(){const t=!this.value;this.update(t)}setTrue(){this.update(!0)}setFalse(){this.update(!1)}addUpdaterFunction(t,s){this.constructor.prototype[t]=(...n)=>{const r=s(this.value,...n);this.update(r)}}}class C extends g{addUpdaterFunction(t,s){this.constructor.prototype[t]=(...n)=>{const r=s(this.value,...n);this.update(r)}}updateAttribute(t,s){const n={...this.value};n[t]=s,this.update(n)}}const S="state";class Q{constructor(t){this.publisher=t,this.stores={},this.eventNamePrefix=S,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}createBoolean(t,s){const n=this.create(t,s);return n.updater=new G(n),n}createRecord(t,s){const n=this.create(t,s);return n.updater=new C(n),n}createList(t,s){const n=this.create(t,s);return n.updater=new w(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 W=e=>new Q(e),$t=Object.freeze(Object.defineProperty({__proto__:null,State:Q,Store:x,StoreUpdaterBoolean:G,StoreUpdaterList:w,StoreUpdaterObject:C,createState:W,eventName:S},Symbol.toStringTag,{value:"Module"}));class Dt{constructor(t){this.setupDomEnvironment(t)}setup(){return this.setupBus(),this.setupState(),this.addBusOptions(),this.setRenderKit(),new R({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}=I();this.publish=t,this.subscribe=s,this.bus=n}setupState(){this.state=W(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 Lt=(e={})=>{const s=new Dt(e).setup();return s.startNavigation(),s};var u=(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))(u||{});const Pt=Object.freeze(Object.defineProperty({__proto__:null,ChangeInstructionTypes:u},Symbol.toStringTag,{value:"Module"})),Bt=(e,t)=>({source:e,target:t,type:u.changeText,data:{}}),Ut=(e,t)=>({source:e,target:t,type:u.replaceNode,data:{}}),zt=(e,t,s)=>({source:e,target:t,data:s,type:u.removeAttribute}),Vt=(e,t,s)=>({source:e,target:t,data:s,type:u.addAttribute}),Kt=(e,t,s)=>({source:e,target:t,data:s,type:u.updateAttribute}),Rt=(e,t,s)=>({source:e,target:t,data:s,type:u.removeEvent}),qt=(e,t,s)=>({source:e,target:t,data:s,type:u.addEvent}),Jt=(e,t,s)=>({source:e,target:t,data:s,type:u.updateEvent}),X=e=>({source:e,target:e,type:u.removeNode,data:{}}),_=(e,t)=>({target:e,source:e,type:u.insertNode,data:t}),Ht=(e,t,s)=>({source:e,target:t,type:u.changeValue,data:s}),It=(e,t)=>e.type>t.type?1:e.type<t.type?-1:0,Y={index:-1};class Gt{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)?Y: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,o)=>(o.element!==t&&r.push(o),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 Z=e=>{const t=new Gt;return t.populate(e),t},tt=(e,t,s=!1)=>{const n=[],r=e.attributes,o=r.length,c=t.attributes,h=c.length;let i,d,a;for(i=0;i<o;i++){a=null;const l=r.item(i);if(l){for(d=0;d<h;d++){const p=c.item(d);if(p&&l.name==p.name){a=p;break}}a?l.value!==a.value&&n.push(Kt(e,t,{name:l.name,value:a.value,isSvg:s})):n.push(zt(e,t,{name:l.name,isSvg:s}))}}for(i=0;i<h;i++){a=null;const l=c.item(i);if(l){for(d=0;d<o;d++){const p=r.item(d);if(p&&p.name==l.name){a=p;break}}a||n.push(Vt(e,t,{name:l.name,value:l.value,isSvg:s}))}}return n},Ct=(e,t)=>{const s=[],n=e.eventMaps,r=t.eventMaps,o=Object.keys(n),c=Object.keys(r);return o.forEach(h=>{const i=n[h],d=r[h];d?d.busEvent!==i.busEvent&&s.push(Jt(e,t,{name:h,targetValue:d.listener,sourceValue:i.listener})):s.push(Rt(e,t,{name:i.domEvent,value:i.listener}))}),c.forEach(h=>{const i=n[h],d=r[h];i||s.push(qt(e,t,{name:d.domEvent,value:d.listener}))}),s},Qt=e=>e.tagName!=="INPUT",Wt=(e,t)=>e.value===t.value,Xt=(e,t)=>{if(Qt(e)||Wt(e,t))return[];const s=e,n=t;return[Ht(s,n,{name:"value",value:n.value})]},Yt=(e,t)=>{const s=tt(e,t),n=Ct(e,t),r=Xt(e,t);return s.concat(n).concat(r)},Zt=(e,t)=>tt(e,t,!0),te=(e,t)=>e.textContent!==t.textContent?[Bt(e,t)]:[],ee=(e,t,s)=>{let n=[];if(e.nodeType===1&&ct(e)){const r=e,o=t,c=Zt(r,o),h=s(r.childNodes,o.childNodes,r);n=c.concat(h)}else if(e.nodeType===1){const r=e,o=t,c=Yt(r,o),h=s(r.childNodes,o.childNodes,r);n=c.concat(h)}else e.nodeType===3&&(n=te(e,t));return n},et=(e,t,s)=>{const n=[],r=se(e,t),o=Z(e),c=Z(t),h=[];let i=0;for(;i<r;i++){const a=e[i],l=t[i];if(l&&c.check(l)){const p=o.pullMatch(l);c.clear(l),p.element?(p.index!==i&&n.push(_(p.element,{parent:s,index:i})),h.push({source:p.element,target:l})):a?c.check(a)?n.push(_(l,{parent:s,index:i})):(o.clear(a),n.push(Ut(a,l))):n.push(_(l,{parent:s,index:i}))}else a&&o.pullMatch(a).element&&n.push(X(a))}o.remaining().forEach(({element:a})=>{n.push(X(a))});const d=h.reduce((a,{source:l,target:p})=>a.concat(ee(l,p,et)),[]);return n.concat(d).sort(It)},se=(e,t)=>{const s=e.length,n=t.length;return s>n?s:n},ne=(e,t,s)=>{et(e,t,s).forEach(r=>{re(r)})},re=e=>{(be[e.type]||oe)(e)},oe=e=>{},ie=e=>{const{source:t,target:s}=e;t.nodeValue=s.textContent},ue=e=>{const{source:t}=e;t.remove()},ae=e=>{const{target:t,data:s}=e,{parent:n,index:r}=s,o=n.childNodes[r];o?o&&o!==t&&n.insertBefore(t,o):n.appendChild(t)},ce=e=>{const{source:t,target:s}=e;t.replaceWith(s)},he=e=>{const{source:t,data:s}=e,{name:n,isSvg:r}=s;r?t.removeAttributeNS(null,n):t.removeAttribute(n)},st=e=>{const{source:t,data:s}=e,{name:n,value:r,isSvg:o}=s;o?t.setAttributeNS(null,n,r):t.setAttribute(n,r)},le=e=>{st(e)},de=e=>{const t=e.data,s=e.source,{name:n,value:r}=t;s.removeEventListener(n,r)},pe=e=>{const t=e.data,s=e.source,{name:n,value:r}=t;s.addEventListener(n,r)},me=e=>{const t=e.data,s=e.source,{name:n,sourceValue:r,targetValue:o}=t;s.removeEventListener(n,r),s.addEventListener(n,o)},fe=e=>{const t=e.data,s=e.source,{value:n}=t;s.value=n},be={[u.changeText]:ie,[u.removeNode]:ue,[u.insertNode]:ae,[u.replaceNode]:ce,[u.removeAttribute]:he,[u.addAttribute]:st,[u.updateAttribute]:le,[u.removeEvent]:de,[u.addEvent]:pe,[u.updateEvent]:me,[u.changeValue]:fe};class ve{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 s=this.dom[0].parentElement;this.parentElement=s}const t=this.generateDom(this.renderKit);ne(this.dom,t,this.parentElement),this.parentElement&&(this.dom=Array.from(this.parentElement.childNodes))}subscribeForRerender(){const{subscribe:t}=this.renderKit;this.subscriptions.forEach(s=>{t(this.eventName(s),()=>this.rerender())})}eventName(t){return`${S}:${t}`}}const ge=e=>e,ye=({Template:e,viewModel:t,subscriptions:s})=>(s=s||[],t=t||ge,n=>new ve({Template:e,viewModel:t,subscriptions:s,attributes:n})),Ee=Object.freeze(Object.defineProperty({__proto__:null,createRouteState:F,events:_t,extractQueryParams:P,findHref:$,navigate:D,onLinkClick:L,onLocationChange:B,start:Nt},Symbol.toStringTag,{value:"Module"}));m.JaxsTypes=Pt,m.appBuilding=jt,m.bind=ye,m.createApp=Lt,m.jsx=M,m.messageBus=kt,m.navigation=Ee,m.state=$t,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
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.4.2",
5
+ "version": "0.4.3",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "build": "vite build && npm run build:types",