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