ezh 0.2.0 → 0.2.1

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/lib/elements.js DELETED
@@ -1,1256 +0,0 @@
1
- import { Z, Q, O, R } from './RbTree';
2
- const S = {
3
- 'ariaAtomic': 'aria-atomic',
4
- 'ariaAutoComplete': 'aria-autocomplete',
5
- 'ariaBrailleLabel': 'aria-braillelabel',
6
- 'ariaBrailleRoleDescription': 'aria-brailleroledescription',
7
- 'ariaBusy': 'aria-busy',
8
- 'ariaChecked': 'aria-checked',
9
- 'ariaColCount': 'aria-colcount',
10
- 'ariaColIndex': 'aria-colindex',
11
- 'ariaColIndexText': 'aria-colindextext',
12
- 'ariaColSpan': 'aria-colspan',
13
- 'ariaCurrent': 'aria-current',
14
- 'ariaDescription': 'aria-description',
15
- 'ariaDisabled': 'aria-disabled',
16
- 'ariaExpanded': 'aria-expanded',
17
- 'ariaHasPopup': 'aria-haspopup',
18
- 'ariaHidden': 'aria-hidden',
19
- 'ariaInvalid': 'aria-invalid',
20
- 'ariaKeyShortcuts': 'aria-keyshortcuts',
21
- 'ariaLabel': 'aria-label',
22
- 'ariaLevel': 'aria-level',
23
- 'ariaLive': 'aria-live',
24
- 'ariaModal': 'aria-modal',
25
- 'ariaMultiLine': 'aria-multiline',
26
- 'ariaMultiSelectable': 'aria-multiselectable',
27
- 'ariaOrientation': 'aria-orientation',
28
- 'ariaPlaceholder': 'aria-placeholder',
29
- 'ariaPosInSet': 'aria-posinset',
30
- 'ariaPressed': 'aria-pressed',
31
- 'ariaReadOnly': 'aria-readonly',
32
- 'ariaRequired': 'aria-required',
33
- 'ariaRoleDescription': 'aria-roledescription',
34
- 'ariaRowCount': 'aria-rowcount',
35
- 'ariaRowIndex': 'aria-rowindex',
36
- 'ariaRowIndexText': 'aria-rowindextext',
37
- 'ariaRowSpan': 'aria-rowspan',
38
- 'ariaSelected': 'aria-selected',
39
- 'ariaSetSize': 'aria-setsize',
40
- 'ariaSort': 'aria-sort',
41
- 'ariaValueMax': 'aria-valuemax',
42
- 'ariaValueMin': 'aria-valuemin',
43
- 'ariaValueNow': 'aria-valuenow',
44
- 'ariaValueText': 'aria-valuetext',
45
- 'alignmentBaseline': 'alignment-baseline',
46
- 'annotationXml': 'annotation-xml',
47
- 'baselineShift': 'baseline-shift',
48
- 'clipPath': 'clip-path',
49
- 'clipRule': 'clip-rule',
50
- 'colorInterpolation': 'color-interpolation',
51
- 'colorInterpolationFilters': 'color-interpolation-filters',
52
- 'colorProfile': 'color-profile',
53
- 'colorRendering': 'color-rendering',
54
- 'dominantBaseline': 'dominant-baseline',
55
- 'enableBackground': 'enable-background',
56
- 'fillOpacity': 'fill-opacity',
57
- 'fillRule': 'fill-rule',
58
- 'floodColor': 'flood-color',
59
- 'floodOpacity': 'flood-opacity',
60
- 'fontFamily': 'font-family',
61
- 'fontSize': 'font-size',
62
- 'fontSizeAdjust': 'font-size-adjust',
63
- 'fontStretch': 'font-stretch',
64
- 'fontStyle': 'font-style',
65
- 'fontVariant': 'font-variant',
66
- 'fontWeight': 'font-weight',
67
- 'glyphOrientationHorizontal': 'glyph-orientation-horizontal',
68
- 'glyphOrientationVertical': 'glyph-orientation-vertical',
69
- 'imageRendering': 'image-rendering',
70
- 'letterSpacing': 'letter-spacing',
71
- 'lightingColor': 'lighting-color',
72
- 'markerEnd': 'marker-end',
73
- 'markerMid': 'marker-mid',
74
- 'markerStart': 'marker-start',
75
- 'pointerEvents': 'pointer-events',
76
- 'shapeRendering': 'shape-rendering',
77
- 'stopColor': 'stop-color',
78
- 'stopOpacity': 'stop-opacity',
79
- 'strokeDasharray': 'stroke-dasharray',
80
- 'strokeDashoffset': 'stroke-dashoffset',
81
- 'strokeLinecap': 'stroke-linecap',
82
- 'strokeLinejoin': 'stroke-linejoin',
83
- 'strokeMiterlimit': 'stroke-miterlimit',
84
- 'strokeOpacity': 'stroke-opacity',
85
- 'strokeWidth': 'stroke-width',
86
- 'style': 'style',
87
- 'textAnchor': 'text-anchor',
88
- 'textDecoration': 'text-decoration',
89
- 'textRendering': 'text-rendering',
90
- 'unicodeBidi': 'unicode-bidi',
91
- 'vectorEffect': 'vector-effect',
92
- 'wordSpacing': 'word-spacing',
93
- 'writingMode': 'writing-mode',
94
- };
95
- const a2 = {};
96
- const U = [];
97
- Object.freeze(a2);
98
- Object.freeze(U);
99
- const A = () => false;
100
- const v = [];
101
- const x = new Set();
102
- const a3 = new R();
103
- const af = new R();
104
- const aq = [];
105
- const ar = [];
106
- const at = {
107
- id: '',
108
- index: 0,
109
- firstElement: null,
110
- attachTo: A,
111
- move: A,
112
- detachFrom: A,
113
- update: A,
114
- refresh: A,
115
- release: A,
116
- version: 1,
117
- markChanged: A,
118
- watchMountChange: A,
119
- };
120
- let B = '';
121
- let ah = 20000;
122
- let H = 0;
123
- let au = 0;
124
- let I = undefined;
125
- const E = new R();
126
- export const m = new Map();
127
- export let o = at;
128
- export let J = 1;
129
- const aE = (w, aU) => {
130
- return document.createElement(w);
131
- };
132
- let a5 = aE;
133
- const av = {
134
- 'svg': (w, K) => {
135
- K.a4();
136
- return document.createElementNS('http://www.w3.org/2000/svg', w);
137
- },
138
- 'math': (w, K) => {
139
- K.a4();
140
- return document.createElementNS('http://www.w3.org/1998/Math/MathML', w);
141
- },
142
- 'foreignObject': (w, K) => {
143
- if (w !== 'foreignObject') {
144
- return document.createElement(w);
145
- }
146
- K.a4();
147
- return document.createElementNS('http://www.w3.org/2000/svg', w);
148
- },
149
- };
150
- const ai = () => {
151
- if (++au >= H) {
152
- for (const element of x) {
153
- x.delete(element);
154
- if (element.id) {
155
- element.release();
156
- }
157
- else {
158
- if (--au < H) {
159
- x.add(element);
160
- break;
161
- }
162
- }
163
- }
164
- }
165
- else {
166
- x.add(Object.create(at));
167
- }
168
- if (I) {
169
- I = setTimeout(ai, ah);
170
- }
171
- };
172
- const aw = (parent, l) => {
173
- const ax = ['', l];
174
- while (parent.constructor !== ag) {
175
- ax.push(parent.id);
176
- parent = parent.parent;
177
- }
178
- return ax.reverse().join(',');
179
- };
180
- const aF = () => {
181
- let element;
182
- while (element = E.ap(true)) {
183
- const { id, newChildren, parent } = element;
184
- if (newChildren) {
185
- if (parent && aj(parent)) {
186
- element.refresh(newChildren);
187
- parent.currentBefore = undefined;
188
- }
189
- else if (element.version) {
190
- a3._(id, element);
191
- }
192
- }
193
- }
194
- J++;
195
- for (const { parent, element } of v) {
196
- if (element.parent !== parent) {
197
- if (!af.ad() && aj(parent)) {
198
- const a1 = !element.parent;
199
- const a6 = aw(parent, element.id);
200
- af.ae((key, value) => {
201
- if (key.startsWith(a6)) {
202
- value.z(value.a0, a1);
203
- return Q;
204
- }
205
- return O;
206
- }, a6);
207
- }
208
- }
209
- if (!element.parent) {
210
- if (H) {
211
- x.add(element);
212
- }
213
- else {
214
- element.release();
215
- }
216
- }
217
- }
218
- v.length = 0;
219
- };
220
- const L = (children, f = [], from = 0) => {
221
- let a = children[from];
222
- for (;;) {
223
- if (a && a.id !== undefined) {
224
- f.push(a);
225
- }
226
- else if (a !== null && a !== undefined) {
227
- switch (typeof a) {
228
- case 'object':
229
- L(a, f);
230
- break;
231
- case 'function':
232
- a = a();
233
- continue;
234
- case 'boolean':
235
- case 'number':
236
- case 'bigint':
237
- a = '' + a;
238
- default:
239
- f.push(new ak('', a));
240
- }
241
- }
242
- if (++from < children.length) {
243
- a = children[from];
244
- }
245
- else {
246
- break;
247
- }
248
- }
249
- return f;
250
- };
251
- const a7 = (y, children, parent) => {
252
- let f;
253
- const length = y.length;
254
- let newChildren = children;
255
- let b = 0;
256
- while (b < length) {
257
- const ay = y[b];
258
- if (ay !== newChildren[b]) {
259
- if (b === newChildren.length) {
260
- return newChildren;
261
- }
262
- const a = newChildren[b];
263
- if (!a || a.id === undefined) {
264
- newChildren = L(newChildren, newChildren.slice(0, b), b);
265
- continue;
266
- }
267
- else if (f !== newChildren) {
268
- break;
269
- }
270
- }
271
- if (!f && ay.parent !== parent) {
272
- f = y;
273
- }
274
- b++;
275
- }
276
- if (b === newChildren.length) {
277
- return f;
278
- }
279
- return newChildren === children ? L(newChildren, y.slice(0, b), b) : newChildren;
280
- };
281
- const aj = (element) => {
282
- let parent = element;
283
- do {
284
- if (parent.parent === parent) {
285
- return true;
286
- }
287
- parent = parent.parent;
288
- } while (parent);
289
- return false;
290
- };
291
- const a8 = (y, newChildren, parent, aG) => {
292
- let b, h;
293
- let a;
294
- if (newChildren !== y && y.length) {
295
- const al = [];
296
- let r;
297
- h = newChildren.length;
298
- b = 10000000;
299
- while (--h >= 0) {
300
- a = newChildren[h];
301
- if (a.parent === parent) {
302
- const az = h - a.index;
303
- if (az === b) {
304
- r.C++;
305
- a.index = h;
306
- }
307
- else {
308
- r = {
309
- from: a.index,
310
- to: h,
311
- C: 1,
312
- };
313
- b = az;
314
- a.index = -al.push(r);
315
- }
316
- }
317
- else if (b !== 10000000) {
318
- b = 10000000;
319
- }
320
- }
321
- const am = [];
322
- h = y.length - 1;
323
- while (h >= 0) {
324
- a = y[h];
325
- if (a.index < 0) {
326
- r = al[-a.index - 1];
327
- am.push(r);
328
- h -= r.C;
329
- }
330
- else {
331
- a.detachFrom(parent);
332
- h--;
333
- }
334
- }
335
- let M;
336
- let a9;
337
- let aa = 0;
338
- h = newChildren.length - 1;
339
- while (h >= 0) {
340
- a = newChildren[h];
341
- if (a.parent !== parent) {
342
- a.index = h--;
343
- a.attachTo(parent);
344
- }
345
- else {
346
- r = al[-a.index - 1];
347
- a9 = r.C;
348
- M = am[aa];
349
- a.index = h;
350
- if (!aG) {
351
- if (M === r) {
352
- aa++;
353
- h -= r.C;
354
- parent.currentBefore = undefined;
355
- continue;
356
- }
357
- if (M.from > r.from) {
358
- b = aa;
359
- do {
360
- a9 -= M.C;
361
- M = am[++b];
362
- } while (M.from > r.from && a9 > 0);
363
- if (a9 > 0) {
364
- h -= r.C;
365
- parent.currentBefore = undefined;
366
- aa = b;
367
- continue;
368
- }
369
- }
370
- }
371
- b = h - r.C;
372
- do {
373
- a.move();
374
- } while (--h > b && (a = newChildren[h]));
375
- }
376
- }
377
- }
378
- else {
379
- for (h = newChildren.length - 1; h >= 0; h--) {
380
- a = newChildren[h];
381
- a.index = h;
382
- if (parent !== a.parent) {
383
- a.attachTo(parent);
384
- }
385
- }
386
- }
387
- parent.currentBefore = undefined;
388
- };
389
- class ak {
390
- constructor(id, text) {
391
- this.id = id;
392
- this.index = 0;
393
- this.ab = text;
394
- }
395
- id;
396
- parent;
397
- index;
398
- firstElement;
399
- attachTo(target) {
400
- if (!this.firstElement) {
401
- this.firstElement = document.createTextNode(this.ab);
402
- }
403
- const { parent, firstElement, index } = this;
404
- if (this.id) {
405
- if (!parent) {
406
- x.delete(this);
407
- }
408
- else {
409
- v.push({ parent, element: this });
410
- firstElement.remove();
411
- }
412
- }
413
- this.parent = target;
414
- let p = target.currentBefore;
415
- if (p === undefined) {
416
- p = target.findNextSiblingElement(index);
417
- }
418
- target.element.insertBefore(firstElement, p);
419
- target.currentBefore = firstElement;
420
- }
421
- move() {
422
- const { parent, index, firstElement } = this;
423
- let p = parent.currentBefore;
424
- if (p === undefined) {
425
- p = parent.findNextSiblingElement(index);
426
- }
427
- parent.element.insertBefore(firstElement, p);
428
- parent.currentBefore = firstElement;
429
- }
430
- detachFrom(target) {
431
- if (this.parent === target) {
432
- this.firstElement.remove();
433
- this.parent = undefined;
434
- if (this.id) {
435
- v.push({ parent: target, element: this });
436
- }
437
- }
438
- }
439
- update(text) {
440
- if (this.ab !== text) {
441
- this.ab = text;
442
- if (this.firstElement) {
443
- this.firstElement.nodeValue = text;
444
- }
445
- }
446
- return false;
447
- }
448
- refresh() { }
449
- release(target) {
450
- if (this.parent === target) {
451
- if (target) {
452
- this.firstElement.remove();
453
- }
454
- m.delete(this.id);
455
- }
456
- }
457
- ab;
458
- }
459
- export class aH {
460
- constructor(id, children, aI) {
461
- this.id = id;
462
- this.index = 0;
463
- this.newChildren = this.d = aI ? L(children) : (children || U);
464
- }
465
- id;
466
- parent;
467
- index;
468
- newChildren;
469
- currentBefore;
470
- get element() {
471
- return this.parent.element;
472
- }
473
- get firstElement() {
474
- const { d } = this;
475
- for (let b = 0; b < d.length; b++) {
476
- const e = d[b].firstElement;
477
- if (e) {
478
- return e;
479
- }
480
- }
481
- return null;
482
- }
483
- attachTo(target) {
484
- const { parent, d, newChildren } = this;
485
- if (!parent) {
486
- x.delete(this);
487
- }
488
- else {
489
- v.push({ parent, element: this });
490
- for (let b = d.length - 1; b >= 0; b--) {
491
- d[b].detachFrom(this);
492
- }
493
- }
494
- this.parent = target;
495
- const children = newChildren || d;
496
- for (let b = children.length - 1; b >= 0; b--) {
497
- const a = children[b];
498
- a.index = b;
499
- a.attachTo(this);
500
- }
501
- target.currentBefore = this.currentBefore;
502
- this.currentBefore = undefined;
503
- this.d = children;
504
- this.newChildren = undefined;
505
- }
506
- move() {
507
- const { d, newChildren } = this;
508
- if (newChildren) {
509
- a8(d, newChildren, this, true);
510
- this.d = newChildren;
511
- this.newChildren = undefined;
512
- }
513
- else {
514
- for (let b = d.length - 1; b >= 0; b--) {
515
- d[b].move();
516
- }
517
- this.currentBefore = undefined;
518
- }
519
- }
520
- detachFrom(target) {
521
- if (this.parent === target) {
522
- const { d } = this;
523
- for (const a of d) {
524
- a.detachFrom(this);
525
- }
526
- this.parent = undefined;
527
- v.push({ parent: target, element: this });
528
- }
529
- }
530
- update(n, children) {
531
- if (children) {
532
- const newChildren = a7(this.d, children, this);
533
- if (newChildren) {
534
- this.newChildren = newChildren;
535
- return true;
536
- }
537
- }
538
- return false;
539
- }
540
- refresh(newChildren) {
541
- a8(this.d, newChildren, this);
542
- this.d = newChildren;
543
- this.newChildren = undefined;
544
- }
545
- release(target) {
546
- if (this.parent === target) {
547
- if (target) {
548
- const { d } = this;
549
- for (const a of d) {
550
- a.detachFrom(this);
551
- }
552
- }
553
- m.delete(this.id);
554
- }
555
- }
556
- findNextSiblingElement(index) {
557
- const children = this.newChildren || this.d;
558
- let e;
559
- let b = index + 1;
560
- let a = children[b];
561
- while (a) {
562
- e = a.firstElement;
563
- if (e) {
564
- return e;
565
- }
566
- a = children[++b];
567
- }
568
- e = this.parent.currentBefore;
569
- return e !== undefined ? e : this.parent.findNextSiblingElement(this.index);
570
- }
571
- d;
572
- }
573
- export class aJ {
574
- constructor(id, tag, props, children, check, mutableChild) {
575
- this.id = id;
576
- this.index = 0;
577
- this.firstElement = this.element = a5(tag, this);
578
- this.newChildren = this.d = mutableChild ? L(children) : (children || U);
579
- if (props) {
580
- this.n = a2;
581
- this.s = -1;
582
- if (tag === 'select') {
583
- const an = this.element;
584
- const ao = props;
585
- const c = ao.value;
586
- if (c) {
587
- ao.value = undefined;
588
- const aK = this.refresh;
589
- this.refresh = (newChildren) => {
590
- a8(this.d, newChildren, this);
591
- this.d = newChildren;
592
- this.newChildren = undefined;
593
- if (Array.isArray(c)) {
594
- const a$ = c;
595
- const [state, V, N] = a$;
596
- an.value = N;
597
- const z = a$[3] = (u) => state[V] = u.target.value;
598
- an.addEventListener('change', z);
599
- }
600
- else {
601
- an.value = c;
602
- }
603
- ao.value = c;
604
- this.refresh = aK;
605
- };
606
- }
607
- }
608
- this.update(props);
609
- this.s = check ?? 0;
610
- }
611
- else {
612
- this.n = props;
613
- this.s = 0;
614
- }
615
- }
616
- id;
617
- element;
618
- parent;
619
- newChildren;
620
- index;
621
- currentBefore;
622
- firstElement;
623
- attachTo(target) {
624
- const { parent, element, newChildren, index } = this;
625
- if (!parent) {
626
- x.delete(this);
627
- }
628
- else {
629
- v.push({ parent, element: this });
630
- element.remove();
631
- }
632
- this.parent = target;
633
- if (newChildren) {
634
- this.refresh(newChildren);
635
- }
636
- let p = target.currentBefore;
637
- if (p === undefined) {
638
- p = target.findNextSiblingElement(index);
639
- }
640
- target.element.insertBefore(element, p);
641
- target.currentBefore = element;
642
- }
643
- move() {
644
- const { parent, newChildren, index, element } = this;
645
- if (newChildren) {
646
- this.refresh(newChildren);
647
- }
648
- let p = parent.currentBefore;
649
- if (p === undefined) {
650
- p = parent.findNextSiblingElement(index);
651
- }
652
- parent.element.insertBefore(element, p);
653
- parent.currentBefore = element;
654
- }
655
- detachFrom(target) {
656
- if (this.parent === target) {
657
- this.element.remove();
658
- this.parent = undefined;
659
- v.push({ parent: target, element: this });
660
- }
661
- }
662
- update(props, children) {
663
- const { element, n, s } = this;
664
- if (n && s) {
665
- this.n = props;
666
- let j = s;
667
- for (const key in props) {
668
- const c = props[key];
669
- const g = n[key];
670
- if (c !== g) {
671
- if (c !== null && c !== undefined) {
672
- switch (typeof c) {
673
- case 'string': {
674
- const W = S[key];
675
- if (!W) {
676
- element[key] = c;
677
- }
678
- else {
679
- element.setAttribute(W, c);
680
- }
681
- break;
682
- }
683
- case 'number':
684
- case 'boolean':
685
- case 'function': {
686
- element[key] = c;
687
- break;
688
- }
689
- default: {
690
- if (Array.isArray(c)) {
691
- const [state, V, N] = c;
692
- if (g) {
693
- const [aL, aM, aN, a_] = g;
694
- if (aN !== N && element[key] !== N) {
695
- element[key] = N;
696
- }
697
- if (aL === state && aM === V) {
698
- c[3] = a_;
699
- }
700
- else {
701
- const z = c[3] = (u) => state[V] = u.target[key];
702
- element.removeEventListener('change', a_);
703
- element.addEventListener('change', z);
704
- }
705
- }
706
- else {
707
- element[key] = N;
708
- const z = c[3] = (u) => state[V] = u.target[key];
709
- element.addEventListener('change', z);
710
- }
711
- break;
712
- }
713
- if (key === 'style') {
714
- if (!g) {
715
- const style = element.style;
716
- const q = {};
717
- let j = 0;
718
- for (const k in c) {
719
- const X = c[k];
720
- q[k] = X;
721
- j++;
722
- style[k] = X;
723
- }
724
- props[key] = q;
725
- q.j = j;
726
- break;
727
- }
728
- const style = element.style;
729
- const q = {};
730
- let j = 0;
731
- let F = g.j;
732
- for (const k in c) {
733
- const G = c[k];
734
- q[k] = G;
735
- if (k in g) {
736
- F--;
737
- }
738
- j++;
739
- if (G !== g[key]) {
740
- style[k] = G;
741
- }
742
- }
743
- props[key] = q;
744
- q.j = j;
745
- if (F) {
746
- for (const k in g) {
747
- if (!(k in c)) {
748
- style[k] = null;
749
- if (!--F) {
750
- break;
751
- }
752
- }
753
- }
754
- }
755
- break;
756
- }
757
- element[key] = c;
758
- }
759
- }
760
- }
761
- else {
762
- switch (typeof g) {
763
- case 'string': {
764
- const W = S[key];
765
- if (!W) {
766
- this.element[key] = c;
767
- }
768
- else {
769
- this.element.removeAttribute(W);
770
- }
771
- break;
772
- }
773
- case 'object': {
774
- if (g) {
775
- if (Array.isArray(g)) {
776
- element.removeEventListener('change', g[3]);
777
- }
778
- else if (g === a2) {
779
- element[key] = c;
780
- }
781
- }
782
- else {
783
- element[key] = c;
784
- }
785
- break;
786
- }
787
- default: {
788
- element[key] = c;
789
- }
790
- }
791
- }
792
- }
793
- if (!--j) {
794
- break;
795
- }
796
- }
797
- }
798
- if (children) {
799
- const newChildren = a7(this.d, children, this);
800
- if (newChildren) {
801
- this.newChildren = newChildren;
802
- return true;
803
- }
804
- }
805
- return false;
806
- }
807
- refresh(newChildren) {
808
- a8(this.d, newChildren, this);
809
- this.d = newChildren;
810
- this.newChildren = undefined;
811
- }
812
- release(target) {
813
- if (this.parent === target) {
814
- if (target) {
815
- this.element.remove();
816
- }
817
- const { d } = this;
818
- for (const a of d) {
819
- a.release(this);
820
- }
821
- m.delete(this.id);
822
- }
823
- }
824
- findNextSiblingElement(index) {
825
- const children = this.newChildren || this.d;
826
- let e;
827
- let b = index + 1;
828
- let a = children[b];
829
- while (a) {
830
- e = a.firstElement;
831
- if (e) {
832
- return e;
833
- }
834
- a = children[++b];
835
- }
836
- return null;
837
- }
838
- a4() {
839
- this.update = this.aO;
840
- }
841
- aO(props, children) {
842
- const { element, n, s } = this;
843
- if (n && s) {
844
- this.n = props;
845
- let j = s;
846
- for (const key in props) {
847
- const c = props[key];
848
- const g = n[key];
849
- if (c !== g) {
850
- if (c !== null && c !== undefined) {
851
- switch (typeof c) {
852
- case 'string': {
853
- element.setAttribute(S[key] ?? key, c);
854
- break;
855
- }
856
- case 'number':
857
- case 'boolean': {
858
- element.setAttribute(S[key] ?? key, '' + c);
859
- break;
860
- }
861
- case 'function': {
862
- element[key] = c;
863
- break;
864
- }
865
- default: {
866
- if (key === 'style') {
867
- if (!g) {
868
- const style = element.style;
869
- const q = {};
870
- let j = 0;
871
- for (const k in c) {
872
- const X = c[k];
873
- q[k] = X;
874
- j++;
875
- style[k] = X;
876
- }
877
- props[key] = q;
878
- q.j = j;
879
- break;
880
- }
881
- const style = element.style;
882
- const q = {};
883
- let j = 0;
884
- let F = g.j;
885
- for (const k in c) {
886
- const G = c[k];
887
- q[k] = G;
888
- if (k in g) {
889
- F--;
890
- }
891
- j++;
892
- if (G !== g[key]) {
893
- style[k] = G;
894
- }
895
- }
896
- props[key] = q;
897
- q.j = j;
898
- if (F) {
899
- for (const k in g) {
900
- if (!(k in c)) {
901
- style[k] = null;
902
- if (!--F) {
903
- break;
904
- }
905
- }
906
- }
907
- }
908
- break;
909
- }
910
- element[key] = c;
911
- }
912
- }
913
- }
914
- else {
915
- const aP = typeof g;
916
- switch (aP) {
917
- case 'string':
918
- case 'number':
919
- case 'boolean': {
920
- element.removeAttribute(S[key] ?? key);
921
- break;
922
- }
923
- default: {
924
- element[key] = c;
925
- }
926
- }
927
- }
928
- }
929
- if (!--j) {
930
- break;
931
- }
932
- }
933
- }
934
- if (children) {
935
- const newChildren = a7(this.d, children, this);
936
- if (newChildren) {
937
- this.newChildren = newChildren;
938
- return true;
939
- }
940
- }
941
- return false;
942
- }
943
- n;
944
- d;
945
- s;
946
- }
947
- export class aA {
948
- constructor(id, entry, props, children, check, mutableChild) {
949
- this.id = id;
950
- this.index = 0;
951
- this.version = 1;
952
- this.aB = entry;
953
- this.n = props;
954
- this.newChildren = this.d = mutableChild ? L(children) : (children || U);
955
- this.s = check ?? 0;
956
- }
957
- id;
958
- parent;
959
- newChildren;
960
- index;
961
- version;
962
- get firstElement() {
963
- return this.i?.firstElement || null;
964
- }
965
- attachTo(target) {
966
- const { parent, newChildren, i } = this;
967
- this.parent = target;
968
- if (newChildren) {
969
- this.refresh(newChildren);
970
- }
971
- else if (i) {
972
- i.index = this.index;
973
- i.attachTo(target);
974
- }
975
- if (!parent) {
976
- x.delete(this);
977
- }
978
- else {
979
- v.push({ parent, element: this });
980
- }
981
- }
982
- move() {
983
- const { newChildren, i } = this;
984
- if (newChildren) {
985
- this.refresh(newChildren);
986
- }
987
- else if (i) {
988
- i.index = this.index;
989
- i.move();
990
- }
991
- }
992
- detachFrom(target) {
993
- if (this.parent === target) {
994
- this.i?.detachFrom(target);
995
- this.parent = undefined;
996
- v.push({ parent: target, element: this });
997
- }
998
- }
999
- update(props, children) {
1000
- const { n, d, s } = this;
1001
- this.n = props;
1002
- if (children) {
1003
- const newChildren = a7(d, children, this.parent);
1004
- if (newChildren) {
1005
- this.newChildren = newChildren;
1006
- return true;
1007
- }
1008
- }
1009
- if (!this.newChildren && s) {
1010
- let j = s;
1011
- for (const key in n) {
1012
- if (n[key] !== props[key]) {
1013
- this.newChildren = d;
1014
- return true;
1015
- }
1016
- if (!--j) {
1017
- break;
1018
- }
1019
- }
1020
- }
1021
- return false;
1022
- }
1023
- refresh(newChildren) {
1024
- const { id, parent, i, index } = this;
1025
- const aQ = o;
1026
- o = this;
1027
- let t = this.aB(this.n || a2, newChildren);
1028
- if (t !== i) {
1029
- switch (typeof t) {
1030
- case 'boolean':
1031
- case 'number':
1032
- case 'bigint':
1033
- t = '' + t;
1034
- case 'string':
1035
- t = new ak('', t);
1036
- this.i = t;
1037
- t.index = index;
1038
- t.attachTo(parent);
1039
- i?.detachFrom(parent);
1040
- break;
1041
- default:
1042
- if (t) {
1043
- this.i = t;
1044
- t.index = index;
1045
- t.attachTo(parent);
1046
- i?.detachFrom(parent);
1047
- if (!a3.ad()) {
1048
- a3.ae((Y, com) => {
1049
- if (!Y.startsWith(id)) {
1050
- return O;
1051
- }
1052
- if (com.parent && aj(com.parent)) {
1053
- E._(Y, com);
1054
- return Q;
1055
- }
1056
- return Z;
1057
- }, id);
1058
- }
1059
- }
1060
- else {
1061
- this.i = undefined;
1062
- i?.detachFrom(parent);
1063
- }
1064
- }
1065
- }
1066
- else if (i) {
1067
- if (i.parent !== parent) {
1068
- i.index = index;
1069
- i.attachTo(parent);
1070
- }
1071
- else if (i.index !== index) {
1072
- i.index = index;
1073
- i.move();
1074
- }
1075
- }
1076
- this.d = newChildren;
1077
- this.newChildren = undefined;
1078
- o = aQ;
1079
- }
1080
- release(target) {
1081
- if (this.parent === target) {
1082
- this.i?.release(target);
1083
- this.parent = undefined;
1084
- if (this.newChildren) {
1085
- a3.delete(this.id);
1086
- }
1087
- m.delete(this.id);
1088
- }
1089
- }
1090
- markChanged() {
1091
- if (!this.newChildren) {
1092
- this.newChildren = this.d;
1093
- return true;
1094
- }
1095
- return false;
1096
- }
1097
- watchMountChange(aR, z, a0) {
1098
- const a6 = aw(this.parent, this.id);
1099
- af._(a6 + aR, { z, a0 }, true);
1100
- }
1101
- aB;
1102
- n;
1103
- d;
1104
- s;
1105
- i;
1106
- }
1107
- class ag {
1108
- constructor(id, rootElement) {
1109
- this.id = id;
1110
- this.element = rootElement;
1111
- this.parent = this;
1112
- }
1113
- id;
1114
- element;
1115
- parent;
1116
- currentBefore;
1117
- findNextSiblingElement(aX) {
1118
- return null;
1119
- }
1120
- render(entry) {
1121
- if (!this.ac) {
1122
- this.ac = new aA(this.id, entry, null, U);
1123
- m.set(this.id, this.ac);
1124
- this.ac.attachTo(this);
1125
- J++;
1126
- }
1127
- }
1128
- ac;
1129
- }
1130
- export const addComReader = (readerRecord, key) => {
1131
- if (o.id) {
1132
- let D = readerRecord[key];
1133
- if (!D) {
1134
- D = new Map();
1135
- readerRecord[key] = D;
1136
- }
1137
- D.set(o.id, o.version);
1138
- }
1139
- };
1140
- export let refreshComReaders = (readerRecord, key) => {
1141
- const D = readerRecord[key];
1142
- if (D) {
1143
- for (const [Y, version] of D) {
1144
- const com = m.get(Y);
1145
- if (com?.version === version && com.markChanged()) {
1146
- if (E.ad()) {
1147
- queueMicrotask(aF);
1148
- }
1149
- E._(Y, com);
1150
- }
1151
- }
1152
- D.clear();
1153
- }
1154
- };
1155
- export const aC = (replace) => refreshComReaders = replace;
1156
- export const configGC = (waitIntervals, interval = 20000) => {
1157
- if (waitIntervals >= 0 && interval >= 1000) {
1158
- ah = interval;
1159
- if (H) {
1160
- clearTimeout(I);
1161
- }
1162
- if (waitIntervals) {
1163
- I = setTimeout(ai, ah);
1164
- }
1165
- else if (I) {
1166
- I = undefined;
1167
- for (let b = 0; b < H; b++) {
1168
- ai();
1169
- }
1170
- }
1171
- H = waitIntervals;
1172
- return true;
1173
- }
1174
- return false;
1175
- };
1176
- const aS = () => {
1177
- B = ar.pop();
1178
- };
1179
- export var $ezh;
1180
- (function ($ezh) {
1181
- $ezh.render = (rootElement, entry) => {
1182
- const id = (aq.length || '') + '|';
1183
- const aD = new ag(id, rootElement);
1184
- aq.push(aD);
1185
- aD.render(entry);
1186
- };
1187
- $ezh.$ = (id, tag, props, children, check, mutableChild) => {
1188
- const l = `${o.id}${id}${B}`;
1189
- let element = m.get(l);
1190
- if (element) {
1191
- if ((props || children) && element.update(props, children)) {
1192
- E._(l, element);
1193
- }
1194
- return element;
1195
- }
1196
- element = new aJ(l, tag, props, children, check, mutableChild);
1197
- m.set(l, element);
1198
- return element;
1199
- };
1200
- $ezh.$c = (id, entry, props, children, check, mutableChild) => {
1201
- const l = `${o.id}${id}${B}`;
1202
- let element = m.get(l);
1203
- if (element) {
1204
- if ((props || children) && element.update(props, children)) {
1205
- E._(l, element);
1206
- }
1207
- return element;
1208
- }
1209
- element = new aA(l, entry, props, children, check, mutableChild);
1210
- m.set(l, element);
1211
- return element;
1212
- };
1213
- $ezh.$f = (id, children, mutableChild) => {
1214
- const l = `${o.id}${id}${B}`;
1215
- let element = m.get(l);
1216
- if (element) {
1217
- if (children && element.update(null, children)) {
1218
- E._(l, element);
1219
- }
1220
- return element;
1221
- }
1222
- element = new aH(l, children, mutableChild);
1223
- m.set(l, element);
1224
- return element;
1225
- };
1226
- $ezh.$k = (key) => {
1227
- ar.push(B);
1228
- B = `${B || '{'}${key}}`;
1229
- return aS;
1230
- };
1231
- $ezh.$n = (ns) => {
1232
- const aT = a5;
1233
- a5 = av[ns];
1234
- return () => {
1235
- a5 = aT;
1236
- };
1237
- };
1238
- $ezh.$s = (cb, element) => {
1239
- cb();
1240
- return element;
1241
- };
1242
- $ezh.$t = (id, text, mayChange) => {
1243
- const l = `${o.id}${id}${B}`;
1244
- let element = m.get(l);
1245
- if (element) {
1246
- if (mayChange) {
1247
- element.update(text);
1248
- }
1249
- return element;
1250
- }
1251
- element = new ak(l, text);
1252
- m.set(element.id, element);
1253
- return element;
1254
- };
1255
- })($ezh || ($ezh = {}));
1256
- //# sourceMappingURL=elements.js.map