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