jaxs 0.6.0 → 0.6.2

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