jaxs 0.4.3 → 0.5.0

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