malinajs 0.7.1-alpha → 0.7.2-a1

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/runtime.js CHANGED
@@ -1,1123 +1,1248 @@
1
1
  let __app_onerror = console.error;
2
2
 
3
-
4
3
  const configure = (option) => {
5
- __app_onerror = option.onerror;
4
+ __app_onerror = option.onerror;
6
5
  };
7
6
 
8
-
9
7
  const isFunction = fn => typeof fn == 'function';
10
8
 
9
+ const isObject = d => typeof d == 'object';
11
10
 
12
11
  const safeCall = fn => {
13
- try {
14
- return fn?.();
15
- } catch (e) {
16
- __app_onerror(e);
17
- }
12
+ try {
13
+ return fn?.();
14
+ } catch (e) {
15
+ __app_onerror(e);
16
+ }
18
17
  };
19
18
 
20
- function WatchObject(fn, cb) {
21
- this.fn = fn;
22
- this.cb = cb;
23
- this.value = NaN;
24
- this.ro = false;
25
- this.cmp = null;
26
- }
27
-
19
+ const safeGroupCall = list => {
20
+ try {
21
+ list?.forEach(fn => fn?.());
22
+ } catch (e) {
23
+ __app_onerror(e);
24
+ }
25
+ };
28
26
 
29
- const cd_watchObject = (fn, cb, option) => {
30
- let w = new WatchObject(fn, cb);
31
- option && Object.assign(w, option);
32
- return w;
27
+ const safeCallMount = (mountList, destroyList) => {
28
+ mountList.forEach(fn => {
29
+ let r = safeCall(fn);
30
+ r && destroyList.push(r);
31
+ });
33
32
  };
34
33
 
34
+ let current_destroyList, current_mountList, current_cd, destroyResults;
35
+ const $onDestroy = fn => fn && current_destroyList.push(fn);
36
+ const $onMount = fn => current_mountList.push(fn);
35
37
 
36
- function $watch(cd, fn, callback, w) {
37
- w = cd_watchObject(fn, callback, w);
38
- cd.watchers.push(w);
39
- return w;
40
- }
41
- function $watchReadOnly(cd, fn, callback) {
42
- return $watch(cd, fn, callback, {ro: true});
38
+ function WatchObject(fn, cb) {
39
+ this.fn = fn;
40
+ this.cb = cb;
41
+ this.value = NaN;
42
+ this.cmp = null;
43
43
  }
44
- function addEvent(cd, el, event, callback) {
45
- if(!callback) return;
46
- el.addEventListener(event, callback);
47
- cd_onDestroy(cd, () => {
48
- el.removeEventListener(event, callback);
49
- });
44
+
45
+ function $watch(fn, callback, option) {
46
+ let w = new WatchObject(fn, callback);
47
+ option && Object.assign(w, option);
48
+ current_cd.watchers.push(w);
49
+ return w;
50
50
  }
51
- function cd_onDestroy(cd, fn) {
52
- if(fn) cd._d.push(fn);
51
+
52
+ function addEvent(el, event, callback) {
53
+ if(!callback) return;
54
+ el.addEventListener(event, callback);
55
+
56
+ $onDestroy(() => {
57
+ el.removeEventListener(event, callback);
58
+ });
53
59
  }
54
- function $$removeItem(array, item) {
55
- let i = array.indexOf(item);
56
- if(i>=0) array.splice(i, 1);
60
+
61
+ function removeItem(array, item) {
62
+ let i = array.indexOf(item);
63
+ if(i >= 0) array.splice(i, 1);
57
64
  }
65
+
58
66
  function $ChangeDetector(parent) {
59
- this.parent = parent;
60
- this.children = [];
61
- this.watchers = [];
62
- this._d = [];
63
- this.prefix = [];
67
+ this.parent = parent;
68
+ this.children = [];
69
+ this.watchers = [];
70
+ this.prefix = [];
64
71
  }
65
- $ChangeDetector.prototype.new = function() {
66
- var cd = new $ChangeDetector(this);
67
- this.children.push(cd);
68
- return cd;
69
- };
70
-
71
- $ChangeDetector.prototype.destroy = function(option) {
72
- cd_destroy$1(this, option);
73
- };
74
72
 
75
73
  const cd_component = cd => {
76
- while(cd.parent) cd = cd.parent;
77
- return cd.component;
74
+ while(cd.parent) cd = cd.parent;
75
+ return cd.component;
78
76
  };
79
77
 
80
78
  const cd_new = () => new $ChangeDetector();
81
79
 
82
80
  const cd_attach = (parent, cd) => {
83
- if(cd) {
84
- cd.parent = parent;
85
- parent.children.push(cd);
86
- }
81
+ if(cd) {
82
+ cd.parent = parent;
83
+ parent.children.push(cd);
84
+ }
87
85
  };
88
86
 
89
- let destroyResults = null;
90
-
91
- const cd_destroy$1 = (cd, option) => {
92
- if(option !== false && cd.parent) $$removeItem(cd.parent.children, cd);
93
- cd.watchers.length = 0;
94
- cd.prefix.length = 0;
95
- cd._d.forEach(fn => {
96
- let p = safeCall(fn);
97
- p && destroyResults && destroyResults.push(p);
98
- });
99
- cd._d.length = 0;
100
- cd.children.map(cd => cd.destroy(false));
101
- cd.children.length = 0;
102
- };
87
+ const cd_detach = cd => removeItem(cd.parent.children, cd);
103
88
 
104
89
  const isArray = (a) => Array.isArray(a);
105
90
 
106
- const compareArray = (a, b) => {
107
- let a0 = isArray(a);
108
- let a1 = isArray(b);
109
- if(a0 !== a1) return true;
110
- if(!a0) return a !== b;
111
- if(a.length !== b.length) return true;
112
- for(let i=0;i<a.length;i++) {
113
- if(a[i] !== b[i]) return true;
114
- }
115
- return false;
91
+ const _compareArray = (a, b) => {
92
+ let a0 = isArray(a);
93
+ let a1 = isArray(b);
94
+ if(a0 !== a1) return true;
95
+ if(!a0) return a !== b;
96
+ if(a.length !== b.length) return true;
97
+ for(let i = 0; i < a.length; i++) {
98
+ if(a[i] !== b[i]) return true;
99
+ }
100
+ return false;
116
101
  };
117
102
 
118
103
 
119
- function $$compareArray(w, value) {
120
- if(!compareArray(w.value, value)) return 0;
121
- if(isArray(value)) w.value = value.slice();
122
- else w.value = value;
123
- w.cb(w.value);
124
- return w.ro ? 0 : 1;
104
+ function compareArray(w, value) {
105
+ if(!_compareArray(w.value, value)) return 0;
106
+ if(isArray(value)) w.value = value.slice();
107
+ else w.value = value;
108
+ w.cb(w.value);
125
109
  }
126
110
 
127
- const compareDeep = (a, b, lvl) => {
128
- if(lvl < 0 || !a || !b) return a !== b;
129
- if(a === b) return false;
130
- let o0 = typeof(a) == 'object';
131
- let o1 = typeof(b) == 'object';
132
- if(!(o0 && o1)) return a !== b;
133
-
134
- let a0 = isArray(a);
135
- let a1 = isArray(b);
136
- if(a0 !== a1) return true;
137
-
138
- if(a0) {
139
- if(a.length !== b.length) return true;
140
- for(let i=0;i<a.length;i++) {
141
- if(compareDeep(a[i], b[i], lvl-1)) return true;
142
- }
143
- } else {
144
- let set = {};
145
- for(let k in a) {
146
- if(compareDeep(a[k], b[k], lvl-1)) return true;
147
- set[k] = true;
148
- }
149
- for(let k in b) {
150
- if(set[k]) continue;
151
- return true;
152
- }
111
+
112
+ const _compareDeep = (a, b, lvl) => {
113
+ if(lvl < 0 || !a || !b) return a !== b;
114
+ if(a === b) return false;
115
+ let o0 = isObject(a);
116
+ let o1 = isObject(b);
117
+ if(!(o0 && o1)) return a !== b;
118
+
119
+ let a0 = isArray(a);
120
+ let a1 = isArray(b);
121
+ if(a0 !== a1) return true;
122
+
123
+ if(a0) {
124
+ if(a.length !== b.length) return true;
125
+ for(let i = 0; i < a.length; i++) {
126
+ if(_compareDeep(a[i], b[i], lvl - 1)) return true;
127
+ }
128
+ } else {
129
+ let set = {};
130
+ for(let k in a) {
131
+ if(_compareDeep(a[k], b[k], lvl - 1)) return true;
132
+ set[k] = true;
153
133
  }
134
+ for(let k in b) {
135
+ if(set[k]) continue;
136
+ return true;
137
+ }
138
+ }
154
139
 
155
- return false;
140
+ return false;
156
141
  };
157
142
 
158
143
  function cloneDeep(d, lvl) {
159
- if(lvl < 0 || !d) return d;
160
-
161
- if(typeof(d) == 'object') {
162
- if(d instanceof Date) return d;
163
- if(d instanceof Element) return d;
164
- if(isArray(d)) return d.map(i => cloneDeep(i, lvl-1));
165
- let r = {};
166
- for(let k in d) r[k] = cloneDeep(d[k], lvl-1);
167
- return r;
168
- }
169
- return d;
144
+ if(lvl < 0 || !d) return d;
145
+
146
+ if(isObject(d)) {
147
+ if(d instanceof Date) return d;
148
+ if(d instanceof Element) return d;
149
+ if(isArray(d)) return d.map(i => cloneDeep(i, lvl - 1));
150
+ let r = {};
151
+ for(let k in d) r[k] = cloneDeep(d[k], lvl - 1);
152
+ return r;
153
+ }
154
+ return d;
170
155
  }
171
- const $$cloneDeep = function(d) {
172
- return cloneDeep(d, 10);
173
- };
174
156
 
175
- function $$deepComparator(depth) {
176
- return function(w, value) {
177
- let diff = compareDeep(w.value, value, depth);
178
- diff && (w.value = cloneDeep(value, depth), !w.idle && w.cb(value));
179
- w.idle = false;
180
- return !w.ro && diff ? 1 : 0;
181
- };
157
+
158
+ function deepComparator(depth) {
159
+ return function(w, value) {
160
+ let diff = _compareDeep(w.value, value, depth);
161
+ diff && (w.value = cloneDeep(value, depth), !w.idle && w.cb(value));
162
+ w.idle = false;
163
+ };
182
164
  }
183
- const $$compareDeep = $$deepComparator(10);
165
+
166
+ const compareDeep = deepComparator(10);
184
167
 
185
168
 
186
169
  const keyComparator = (w, value) => {
187
- let diff = false;
188
- for(let k in value) {
189
- if(w.value[k] != value[k]) diff = true;
190
- w.value[k] = value[k];
191
- }
192
- diff && !w.idle && w.cb(value);
193
- w.idle = false;
194
- return !w.ro && diff ? 1 : 0;
170
+ let diff = false;
171
+ for(let k in value) {
172
+ if(w.value[k] != value[k]) diff = true;
173
+ w.value[k] = value[k];
174
+ }
175
+ diff && !w.idle && w.cb(value);
176
+ w.idle = false;
195
177
  };
196
178
 
197
179
 
198
180
  const fire = w => {
199
- if(w.cmp) w.cmp(w, w.fn());
200
- else {
201
- w.value = w.fn();
202
- w.cb(w.value);
203
- }
181
+ if(w.cmp) w.cmp(w, w.fn());
182
+ else {
183
+ w.value = w.fn();
184
+ w.cb(w.value);
185
+ }
204
186
  };
205
187
 
206
- function $digest($cd) {
207
- let loop = 10;
208
- let w;
209
- while(loop >= 0) {
210
- let changes = 0;
211
- let index = 0;
212
- let queue = [];
213
- let i, value, cd = $cd;
214
- while(cd) {
215
- for(i=0;i<cd.prefix.length;i++) cd.prefix[i]();
216
- for(i=0;i<cd.watchers.length;i++) {
217
- w = cd.watchers[i];
218
- value = w.fn();
219
- if(w.value !== value) {
220
- if(w.cmp) {
221
- changes += w.cmp(w, value);
222
- } else {
223
- w.value = value;
224
- if(!w.ro) changes++;
225
- w.cb(w.value);
226
- }
227
- }
228
- } if(cd.children.length) queue.push.apply(queue, cd.children);
229
- cd = queue[index++];
188
+ function $digest($cd, flag) {
189
+ let loop = 10;
190
+ let w;
191
+ while(loop >= 0) {
192
+ let index = 0;
193
+ let queue = [];
194
+ let i, value, cd = $cd, changes = 0;
195
+ while(cd) {
196
+ for(i = 0; i < cd.prefix.length; i++) cd.prefix[i]();
197
+ for(i = 0; i < cd.watchers.length; i++) {
198
+ w = cd.watchers[i];
199
+ value = w.fn();
200
+ if(w.value !== value) {
201
+ flag[0] = 0;
202
+ if(w.cmp) {
203
+ w.cmp(w, value);
204
+ } else {
205
+ w.cb(w.value = value);
206
+ }
207
+ changes += flag[0];
230
208
  }
231
- loop--;
232
- if(!changes) break;
209
+ }
210
+ if(cd.children.length) queue.push.apply(queue, cd.children);
211
+ cd = queue[index++];
233
212
  }
234
- if(loop < 0) __app_onerror('Infinity changes: ', w);
213
+ loop--;
214
+ if(!changes) break;
215
+ }
216
+ if(loop < 0) __app_onerror('Infinity changes: ', w);
235
217
  }
236
218
 
237
219
  let templatecache = {};
238
220
  let templatecacheSvg = {};
239
221
 
240
- const childNodes = 'childNodes';
241
- const firstChild = 'firstChild';
242
-
243
222
  let noop = a => a;
244
223
 
245
224
  const insertAfter = (label, node) => {
246
- label.parentNode.insertBefore(node, label.nextSibling);
225
+ label.parentNode.insertBefore(node, label.nextSibling);
247
226
  };
248
227
 
249
228
  const createTextNode = (text) => document.createTextNode(text);
250
229
 
251
- const $$htmlToFragment = (html, option) => {
252
- let result = templatecache[html];
253
- if(!result) {
254
- let t = document.createElement('template');
255
- t.innerHTML = html.replace(/<>/g, '<!---->');
256
- result = t.content;
257
- if(!(option & 2) && result.firstChild == result.lastChild) result = result.firstChild;
258
- templatecache[html] = result;
259
- }
230
+ const htmlToFragment = (html, option) => {
231
+ let result = templatecache[html];
232
+ if(!result) {
233
+ let t = document.createElement('template');
234
+ t.innerHTML = html.replace(/<>/g, '<!---->');
235
+ result = t.content;
236
+ if(!(option & 2) && result.firstChild == result.lastChild) result = result.firstChild;
237
+ templatecache[html] = result;
238
+ }
260
239
 
261
- return option & 1 ? result.cloneNode(true) : result;
240
+ return option & 1 ? result.cloneNode(true) : result;
262
241
  };
263
242
 
264
- const $$htmlToFragmentClean = (html, option) => {
265
- let result = templatecache[html];
266
- if(!result) {
267
- let t = document.createElement('template');
268
- t.innerHTML = html.replace(/<>/g, '<!---->');
269
- result = t.content;
270
-
271
- let it = document.createNodeIterator(result, 128);
272
- let n;
273
- while(n = it.nextNode()) {
274
- if(!n.nodeValue) n.parentNode.replaceChild(document.createTextNode(''), n);
275
- }
276
- if(!(option & 2) && result.firstChild == result.lastChild) result = result.firstChild;
277
- templatecache[html] = result;
243
+ const htmlToFragmentClean = (html, option) => {
244
+ let result = templatecache[html];
245
+ if(!result) {
246
+ let t = document.createElement('template');
247
+ t.innerHTML = html.replace(/<>/g, '<!---->');
248
+ result = t.content;
249
+
250
+ let it = document.createNodeIterator(result, 128);
251
+ let n;
252
+ while(n = it.nextNode()) {
253
+ if(!n.nodeValue) n.parentNode.replaceChild(document.createTextNode(''), n);
278
254
  }
279
255
 
280
- return option & 1 ? result.cloneNode(true) : result;
256
+ if(!(option & 2) && result.firstChild == result.lastChild) result = result.firstChild;
257
+ templatecache[html] = result;
258
+ }
259
+
260
+ return option & 1 ? result.cloneNode(true) : result;
281
261
  };
282
262
 
283
263
 
284
264
  function svgToFragment(content) {
285
- if(templatecacheSvg[content]) return templatecacheSvg[content].cloneNode(true);
286
- let t = document.createElement('template');
287
- t.innerHTML = '<svg>' + content + '</svg>';
288
-
289
- let result = document.createDocumentFragment();
290
- let svg = t.content[firstChild];
291
- while(svg[firstChild]) result.appendChild(svg[firstChild]);
292
- templatecacheSvg[content] = result.cloneNode(true);
293
- return result;
265
+ if(templatecacheSvg[content]) return templatecacheSvg[content].cloneNode(true);
266
+ let t = document.createElement('template');
267
+ t.innerHTML = '<svg>' + content + '</svg>';
268
+
269
+ let result = document.createDocumentFragment();
270
+ let svg = t.content.firstChild;
271
+ while(svg.firstChild) result.appendChild(svg.firstChild);
272
+ templatecacheSvg[content] = result.cloneNode(true);
273
+ return result;
294
274
  }
295
275
 
276
+
296
277
  const iterNodes = (el, last, fn) => {
297
- let next;
298
- while(el) {
299
- next = el.nextSibling;
300
- fn(el);
301
- if(el == last) break;
302
- el = next;
303
- }
278
+ let next;
279
+ while(el) {
280
+ next = el.nextSibling;
281
+ fn(el);
282
+ if(el == last) break;
283
+ el = next;
284
+ }
304
285
  };
305
286
 
306
287
 
307
- const $$removeElements = (el, last) => iterNodes(el, last, n => n.remove());
288
+ const removeElements = (el, last) => iterNodes(el, last, n => n.remove());
308
289
 
309
290
 
310
291
  function removeElementsBetween(el, stop) {
311
- let next;
312
- el = el.nextSibling;
313
- while(el) {
314
- next = el.nextSibling;
315
- if(el == stop) break;
316
- el.remove();
317
- el = next;
318
- }
292
+ let next;
293
+ el = el.nextSibling;
294
+ while(el) {
295
+ next = el.nextSibling;
296
+ if(el == stop) break;
297
+ el.remove();
298
+ el = next;
299
+ }
319
300
  }
301
+
320
302
  const getFinalLabel = n => {
321
- if(n.nextSibling) return n.nextSibling;
322
- let e = document.createTextNode('');
323
- n.parentNode.appendChild(e);
324
- return e;
303
+ if(n.nextSibling) return n.nextSibling;
304
+ let e = document.createTextNode('');
305
+ n.parentNode.appendChild(e);
306
+ return e;
325
307
  };
326
308
 
327
309
 
328
310
  const resolvedPromise = Promise.resolve();
329
311
 
330
312
  function $tick(fn) {
331
- fn && resolvedPromise.then(fn);
332
- return resolvedPromise;
313
+ fn && resolvedPromise.then(fn);
314
+ return resolvedPromise;
333
315
  }
334
316
 
335
- function $makeEmitter(option) {
336
- return (name, detail) => {
337
- let fn = option.events[name];
338
- if(!fn) return;
339
- let e = document.createEvent('CustomEvent');
340
- e.initCustomEvent(name, false, false, detail);
341
- fn(e);
342
- };
343
- }
344
317
 
345
- function $$addEventForComponent(list, event, fn) {
346
- let prev = list[event];
347
- if(prev) {
348
- if(prev._list) prev._list.push(fn);
349
- else {
350
- function handler(e) {
351
- handler._list.forEach(fn => {
352
- fn(e);
353
- });
354
- }
355
- handler._list = [prev, fn];
356
- list[event] = handler;
357
- }
358
- } else list[event] = fn;
318
+ function makeEmitter(option) {
319
+ return (name, detail) => {
320
+ let fn = option.events?.[name];
321
+ if(!fn) return;
322
+ let e = document.createEvent('CustomEvent');
323
+ e.initCustomEvent(name, false, false, detail);
324
+ fn(e);
325
+ };
359
326
  }
360
327
 
361
- let current_component, $context;
362
-
363
- const $onDestroy = fn => current_component._d.push(fn);
364
- const $onMount = fn => current_component._m.push(fn);
365
-
366
-
367
- const $base = {
368
- a: ($component) => {
369
- let $cd = cd_new();
370
- $cd.component = $component;
371
- $onDestroy(() => $cd.destroy());
372
-
373
- let planned;
374
- let apply = r => {
375
- if(planned) return r;
376
- planned = true;
377
- $tick(() => {
378
- try {
379
- $digest($cd);
380
- } finally {
381
- planned = false;
382
- }
383
- });
384
- return r;
385
- };
386
-
387
- $component.$cd = $cd;
388
- $component.apply = apply;
389
- $component.push = apply;
390
- },
391
- b: ($component) => {
392
- safeCall(() => $digest($component.$cd));
393
- }
394
- };
395
328
 
329
+ let current_component;
396
330
 
397
- const makeComponent = (init, $base) => {
398
- return ($option={}) => {
399
- let prev = current_component;
400
- $context = $option.context || {};
401
- let $component = current_component = {
402
- $option,
403
- destroy: () => $component._d.map(safeCall),
404
- context: $context,
405
- exported: {},
406
- _d: [],
407
- _m: []
408
- };
409
- $base?.a($component);
410
331
 
411
- try {
412
- $component.$dom = init($option, $component.apply);
413
- $base?.b($component);
414
- } finally {
415
- current_component = prev;
416
- $context = null;
417
- }
332
+ const makeApply = () => {
333
+ let $cd = current_component.$cd = current_cd = cd_new();
334
+ $cd.component = current_component;
418
335
 
419
- $component._d.push(...$component._m.map(safeCall));
420
- return $component;
421
- };
422
- };
336
+ let planned, flag = [0];
337
+ let apply = r => {
338
+ flag[0]++;
339
+ if(planned) return r;
340
+ planned = true;
341
+ $tick(() => {
342
+ try {
343
+ $digest($cd, flag);
344
+ } finally {
345
+ planned = false;
346
+ }
347
+ });
348
+ return r;
349
+ };
423
350
 
351
+ current_component.$apply = apply;
352
+ current_component.$push = apply;
353
+ apply();
354
+ return apply;
355
+ };
424
356
 
425
- const callComponent = (context, component, option={}, propFn, cmp, setter, classFn) => {
426
- option.context = {...context};
427
- let $component, parentWatch, childWatch, cd;
428
-
429
- if(propFn) {
430
- if(cmp) {
431
- cd = cd_new();
432
- parentWatch = $watch(cd, propFn, value => {
433
- option.props = value;
434
- if($component) {
435
- $component.push?.();
436
- childWatch && (childWatch.idle = true);
437
- $component.apply?.();
438
- }
439
- }, {ro: true, value: {}, cmp});
440
- fire(parentWatch);
441
- } else option.props = propFn();
442
- }
443
357
 
444
- if(classFn) {
445
- cd = cd || cd_new();
446
- fire($watch(cd, classFn, value => {
447
- option.$class = value;
448
- $component?.apply?.();
449
- }, {ro: true, value: {}, cmp: keyComparator}));
450
- }
358
+ const makeComponent = (init) => {
359
+ return ($option = {}) => {
360
+ let prev_component = current_component,
361
+ prev_cd = current_cd,
362
+ $component = current_component = { $option };
363
+ current_cd = null;
451
364
 
452
- let anchors = option.anchor;
453
- if(anchors) {
454
- for(let name in anchors) {
455
- let a = anchors[name];
456
- let fn = a.$;
457
- if(fn) {
458
- cd = cd || cd_new();
459
- anchors[name] = el => {
460
- let $cd = cd_new();
461
- cd_attach(cd, $cd);
462
- fn($cd, el);
463
- return () => cd_destroy$1($cd);
464
- };
465
- }
466
- }
365
+ try {
366
+ $component.$dom = init($option);
367
+ } finally {
368
+ current_component = prev_component;
369
+ current_cd = prev_cd;
467
370
  }
468
371
 
469
- $component = safeCall(() => component(option));
470
- if(setter && $component?.exportedProps) {
471
- childWatch = $watch($component.$cd, $component.exportedProps, value => {
472
- setter(value);
473
- cd_component(cd).apply();
474
- }, {ro: true, idle: true, value: parentWatch.value, cmp});
475
- }
476
- return {
477
- $cd: cd,
478
- $dom: $component.$dom,
479
- destroy: $component.destroy,
480
- $component
481
- };
372
+ return $component;
373
+ };
482
374
  };
483
375
 
484
376
 
485
- const attachDynComponent = (parentCD, label, exp, bind) => {
486
- let active, $cd, $dom, destroy, finalLabel = getFinalLabel(label);
487
- cd_onDestroy(parentCD, () => destroy?.());
488
- $watch(parentCD, exp, (component) => {
489
- destroy?.();
490
- if($cd) cd_destroy$1($cd);
491
- if(active) removeElementsBetween(label, finalLabel);
377
+ const callComponent = (component, context, option = {}) => {
378
+ option.context = { ...context };
379
+ let $component = safeCall(() => component(option));
380
+ if($component instanceof Node) $component = { $dom: $component };
381
+ return $component;
382
+ };
492
383
 
493
- if(component) {
494
- ({$cd, $dom, destroy} = bind(component));
495
- cd_attach(parentCD, $cd);
496
- insertAfter(label, $dom);
497
- active = true;
498
- } else {
499
- destroy = null;
500
- $cd = null;
501
- active = false;
502
- }
384
+
385
+ const callComponentDyn = (component, context, option = {}, propFn, cmp, setter, classFn) => {
386
+ let $component, parentWatch;
387
+
388
+ if(propFn) {
389
+ parentWatch = $watch(propFn, value => {
390
+ $component.$push?.(value);
391
+ $component.$apply?.();
392
+ }, { value: {}, idle: true, cmp });
393
+ fire(parentWatch);
394
+ option.props = parentWatch.value;
395
+ }
396
+
397
+ if(classFn) {
398
+ fire($watch(classFn, value => {
399
+ option.$class = value;
400
+ $component?.$apply?.();
401
+ }, { value: {}, cmp: keyComparator }));
402
+ }
403
+
404
+ $component = callComponent(component, context, option);
405
+ if(setter && $component?.$exportedProps) {
406
+ let parentCD = current_cd, w = new WatchObject($component.$exportedProps, value => {
407
+ setter(value);
408
+ cd_component(parentCD).$apply();
409
+ $component.$push(parentWatch.fn());
410
+ $component.$apply();
503
411
  });
412
+ Object.assign(w, { idle: true, cmp, value: parentWatch.value });
413
+ $component.$cd.watchers.push(w);
414
+ }
415
+
416
+ return $component;
417
+ };
418
+
419
+
420
+ const attachDynComponent = (label, exp, bind) => {
421
+ let parentCD = current_cd;
422
+ let active, destroyList, $cd, $dom, finalLabel = getFinalLabel(label);
423
+ const destroy = () => safeGroupCall(destroyList);
424
+ $onDestroy(destroy);
425
+
426
+ $watch(exp, (component) => {
427
+ destroy();
428
+ if($cd) cd_detach($cd);
429
+ if(active) removeElementsBetween(label, finalLabel);
430
+
431
+ if(component) {
432
+ destroyList = current_destroyList = [];
433
+ current_mountList = [];
434
+ $cd = current_cd = cd_new();
435
+ try {
436
+ $dom = bind(component).$dom;
437
+ cd_attach(parentCD, $cd);
438
+ insertAfter(label, $dom);
439
+ safeCallMount(current_mountList, destroyList);
440
+ } finally {
441
+ current_destroyList = current_mountList = current_cd = null;
442
+ }
443
+ active = true;
444
+ } else {
445
+ $cd = null;
446
+ active = false;
447
+ destroyList = null;
448
+ }
449
+ });
504
450
  };
505
451
 
506
452
 
507
453
  const autoSubscribe = (...list) => {
508
- list.forEach(i => {
509
- if(i.subscribe) {
510
- let unsub = i.subscribe(current_component.apply);
511
- if(isFunction(unsub)) cd_onDestroy(current_component, unsub);
512
- }
513
- });
454
+ list.forEach(i => {
455
+ if(isFunction(i.subscribe)) {
456
+ let unsub = i.subscribe(current_component.$apply);
457
+ if(isFunction(unsub)) $onDestroy(unsub);
458
+ }
459
+ });
514
460
  };
515
461
 
516
462
 
517
463
  const addStyles = (id, content) => {
518
- if(document.head.querySelector('style#' + id)) return;
519
- let style = document.createElement('style');
520
- style.id = id;
521
- style.innerHTML = content;
522
- document.head.appendChild(style);
464
+ if(document.head.querySelector('style#' + id)) return;
465
+ let style = document.createElement('style');
466
+ style.id = id;
467
+ style.innerHTML = content;
468
+ document.head.appendChild(style);
523
469
  };
524
470
 
525
471
 
526
472
  const addClass = (el, className) => el.classList.add(className);
527
473
 
528
474
 
529
- const bindClass = (cd, element, fn, className) => {
530
- $watch(cd, fn, value => {
531
- if(value) addClass(element, className);
532
- else element.classList.remove(className);
533
- }, {ro: true, value: false});
475
+ const bindClass = (element, fn, className) => {
476
+ $watch(fn, value => {
477
+ if(value) addClass(element, className);
478
+ else element.classList.remove(className);
479
+ }, { value: false });
534
480
  };
535
481
 
536
482
 
537
483
  const setClassToElement = (element, value) => bindAttributeBase(element, 'class', value);
538
484
 
539
485
 
540
- const bindClassExp = (cd, element, fn) => {
541
- $watch(cd, fn, value => setClassToElement(element, value), {ro: true, value: ''});
486
+ const bindClassExp = (element, fn) => {
487
+ $watch(fn, value => setClassToElement(element, value), { value: '' });
542
488
  };
543
489
 
544
490
 
545
- const bindText = (cd, element, fn) => {
546
- $watchReadOnly(cd, () => '' + fn(), value => {
547
- element.textContent = value;
548
- });
491
+ const bindText = (element, fn) => {
492
+ $watch(() => '' + fn(), value => {
493
+ element.textContent = value;
494
+ });
549
495
  };
550
496
 
551
497
 
552
- const bindStyle = (cd, element, name, fn) => {
553
- $watchReadOnly(cd, fn, (value) => {
554
- element.style[name] = value;
555
- });
498
+ const bindStyle = (element, name, fn) => {
499
+ $watch(fn, (value) => {
500
+ element.style.setProperty(name, value);
501
+ });
556
502
  };
557
503
 
558
504
 
559
505
  const bindAttributeBase = (element, name, value) => {
560
- if(value != null) element.setAttribute(name, value);
561
- else element.removeAttribute(name);
506
+ if(value != null) element.setAttribute(name, value);
507
+ else element.removeAttribute(name);
562
508
  };
563
509
 
564
510
 
565
- const bindAttribute = (cd, element, name, fn) => {
566
- $watchReadOnly(cd, () => '' + fn(), value => bindAttributeBase(element, name, value));
511
+ const bindAttribute = (element, name, fn) => {
512
+ $watch(() => {
513
+ let v = fn();
514
+ return v == null ? v : '' + v;
515
+ }, value => bindAttributeBase(element, name, value));
567
516
  };
568
517
 
569
518
 
570
- const bindAction = (cd, element, action, fn, subscribe) => {
571
- $tick(() => {
572
- let handler, value;
573
- if(fn) {
574
- value = fn();
575
- handler = action.apply(null, [element].concat(value));
576
- } else handler = action(element);
577
- cd_onDestroy(cd, handler?.destroy);
578
- subscribe?.(cd, fn, handler, value);
579
- });
519
+ const bindAction = (element, action, fn, subscribe) => {
520
+ let handler, value;
521
+ if(fn) {
522
+ value = fn();
523
+ handler = action.apply(null, [element].concat(value));
524
+ } else handler = action(element);
525
+ if(isFunction(handler)) $onDestroy(handler);
526
+ else {
527
+ $onDestroy(handler?.destroy);
528
+ subscribe?.(fn, handler, value);
529
+ handler?.init && $onMount(handler.init);
530
+ }
580
531
  };
581
532
 
582
533
 
583
- const __bindActionSubscribe = (cd, fn, handler, value) => {
584
- if(handler?.update && fn) {
585
- $watch(cd, fn, args => {
586
- handler.update.apply(handler, args);
587
- }, {cmp: $$deepComparator(1), value: cloneDeep(value, 1) });
588
- }
534
+ const __bindActionSubscribe = (fn, handler, value) => {
535
+ if(handler?.update && fn) {
536
+ $watch(fn, args => {
537
+ handler.update.apply(handler, args);
538
+ }, { cmp: deepComparator(1), value: cloneDeep(value, 1) });
539
+ }
589
540
  };
590
541
 
591
542
 
592
- const bindInput = (cd, element, name, get, set) => {
593
- let w = $watchReadOnly(cd, name == 'checked' ? () => !!get() : get, value => {
594
- element[name] = value == null ? '' : value;
595
- });
596
- addEvent(cd, element, 'input', () => {
597
- set(w.value = element[name]);
598
- });
543
+ const bindInput = (element, name, get, set) => {
544
+ let w = $watch(name == 'checked' ? () => !!get() : get, value => {
545
+ element[name] = value == null ? '' : value;
546
+ });
547
+ addEvent(element, 'input', () => {
548
+ set(w.value = element[name]);
549
+ });
599
550
  };
600
551
 
601
552
 
602
553
  const makeClassResolver = ($option, classMap, metaClass, mainName) => {
603
- if(!$option.$class) $option.$class = {};
604
- if(!mainName && metaClass.main) mainName = 'main';
605
- return (line, defaults) => {
606
- let result = {};
607
- if(defaults) result[defaults] = 1;
608
- line.trim().split(/\s+/).forEach(name => {
609
- let meta;
610
- if(name[0] == '$') {
611
- name = name.substring(1);
612
- meta = true;
613
- }
614
- let h = metaClass[name] || meta;
615
- if(h) {
616
- let className = ($option.$class[name === mainName ? '$$main' : name] || '').trim();
617
- if(className) {
618
- result[className] = 1;
619
- } else if(h !== true) {
620
- result[name] = 1;
621
- result[h] = 1;
622
- }
623
- }
624
- let h2 = classMap[name];
625
- if(h2) {
626
- result[name] = 1;
627
- result[h2] = 1;
628
- } else if(!h) {
629
- result[name] = 1;
630
- }
631
- });
632
- return Object.keys(result).join(' ');
633
- }
554
+ if(!$option.$class) $option.$class = {};
555
+ if(!mainName && metaClass.main) mainName = 'main';
556
+ return (line, defaults) => {
557
+ let result = {};
558
+ if(defaults) result[defaults] = 1;
559
+ line.trim().split(/\s+/).forEach(name => {
560
+ let meta;
561
+ if(name[0] == '$') {
562
+ name = name.substring(1);
563
+ meta = true;
564
+ }
565
+ let h = metaClass[name] || meta;
566
+ if(h) {
567
+ let className = ($option.$class[name === mainName ? '$$main' : name] || '').trim();
568
+ if(className) {
569
+ result[className] = 1;
570
+ } else if(h !== true) {
571
+ result[name] = 1;
572
+ result[h] = 1;
573
+ }
574
+ }
575
+ let h2 = classMap[name];
576
+ if(h2) {
577
+ result[name] = 1;
578
+ result[h2] = 1;
579
+ } else if(!h) {
580
+ result[name] = 1;
581
+ }
582
+ });
583
+ return Object.keys(result).join(' ');
584
+ };
634
585
  };
635
586
 
636
587
 
637
- const makeExternalProperty = ($component, name, getter, setter) => {
638
- Object.defineProperty($component, name, {
639
- get: getter,
640
- set: v => {setter(v); $component.apply();}
641
- });
588
+ const makeExternalProperty = (name, getter, setter) => {
589
+ let $component = current_component;
590
+ Object.defineProperty($component, name, {
591
+ get: getter,
592
+ set: v => { setter(v); $component.$apply(); }
593
+ });
642
594
  };
643
595
 
644
596
 
645
- const eachDefaultKey = (item, index, array) => typeof array[0] === 'object' ? item : index;
597
+ const attachAnchor = ($option, el, name) => {
598
+ $option.anchor?.[name || 'default']?.(el);
599
+ };
646
600
 
647
601
 
648
- const attachAnchor = ($option, $cd, el, name) => {
649
- let fn = $option.anchor?.[name || 'default'];
650
- if(fn) cd_onDestroy($cd, fn(el));
602
+ const makeAnchor = (fn) => {
603
+ let parentCD = current_cd;
604
+ return ($dom) => {
605
+ let prev = current_cd, $cd = current_cd = cd_new();
606
+ cd_attach(parentCD, $cd);
607
+ $onDestroy(() => cd_detach($cd));
608
+ try {
609
+ fn($dom);
610
+ } finally {
611
+ current_cd = prev;
612
+ }
613
+ };
651
614
  };
652
615
 
653
616
 
654
- const spreadAttributes = (cd, el, fn) => {
655
- const props = Object.getOwnPropertyDescriptors(el.__proto__);
656
- let prev = {};
657
- const set = (k, v) => {
658
- if(k == 'style') el.style.cssText = v;
659
- else if(props[k]?.set) el[k] = v;
660
- else bindAttributeBase(el, k, v);
661
- };
662
- const apply = (state) => {
663
- for(let k in state) {
664
- let value = state[k];
665
- if(prev[k] != value) {
666
- set(k, value);
667
- prev[k] = value;
668
- }
669
- }
670
- for(let k in prev) {
671
- if(!(k in state)) {
672
- set(k, null);
673
- delete prev[k];
674
- }
675
- }
676
- };
677
- $watch(cd, fn, apply, {cmp: (_, state) => {
678
- apply(state);
679
- return 0;
680
- }});
617
+ const spreadAttributes = (el, fn) => {
618
+ const props = Object.getOwnPropertyDescriptors(el.__proto__);
619
+ let prev = {};
620
+ const set = (k, v) => {
621
+ if(k == 'style') el.style.cssText = v;
622
+ else if(props[k]?.set) el[k] = v;
623
+ else bindAttributeBase(el, k, v);
624
+ };
625
+ const apply = (state) => {
626
+ for(let k in state) {
627
+ let value = state[k];
628
+ if(prev[k] != value) {
629
+ set(k, value);
630
+ prev[k] = value;
631
+ }
632
+ }
633
+ for(let k in prev) {
634
+ if(!(k in state)) {
635
+ set(k, null);
636
+ delete prev[k];
637
+ }
638
+ }
639
+ };
640
+ $watch(fn, apply, {
641
+ cmp: (_, state) => {
642
+ apply(state);
643
+ return 0;
644
+ }
645
+ });
681
646
  };
682
647
 
683
648
 
684
649
  const callExportedFragment = (childComponent, name, slot, events, props, cmp) => {
685
- let $cd, r;
686
- if(cmp) {
687
- $cd = cd_new();
688
- let fn = props, result;
689
- props = () => result;
690
- let w = $watch($cd, fn, (props) => {
691
- result = props;
692
- r?.push();
693
- }, {value: {}, cmp});
694
- fire(w);
695
- }
696
- let fn = childComponent.exported[name];
697
- r = fn(props, events, slot);
698
- r.$cd = $cd;
699
- return r;
650
+ let push, $dom;
651
+ if(cmp) {
652
+ let result;
653
+ let w = $watch(props, (value) => {
654
+ result = value;
655
+ push?.();
656
+ }, { value: {}, cmp });
657
+ fire(w);
658
+ props = () => result;
659
+ }
660
+ let fn = childComponent.$exported?.[name];
661
+ ([$dom, push] = fn(props, events, slot));
662
+ return $dom;
700
663
  };
701
664
 
702
665
 
703
- const exportFragment = (childCD, name, fn) => {
704
- cd_component(childCD).exported[name] = (props, events, slot) => {
705
- let {$cd, $dom} = fn(props, events || {}, slot);
706
- cd_attach(childCD, $cd);
707
- let apply = cd_component(childCD).apply;
708
- return {
709
- $dom,
710
- destroy: () => $cd.destroy(),
711
- push: () => apply?.()
712
- };
713
- };
666
+ const exportFragment = (component, name, fn) => {
667
+ let childCD = current_cd;
668
+ if(!component.$exported) component.$exported = {};
669
+ component.$exported[name] = (props, events, slot) => {
670
+ let prev = current_cd, apply;
671
+ if(childCD) {
672
+ let $cd = current_cd = cd_new();
673
+ cd_attach(childCD, $cd);
674
+ $onDestroy(() => cd_detach($cd));
675
+ apply = component.$apply;
676
+ apply();
677
+ } else {
678
+ current_cd = null;
679
+ }
680
+
681
+ try {
682
+ return [fn(props, events || {}, slot), apply];
683
+ } finally {
684
+ current_cd = prev;
685
+ }
686
+ };
714
687
  };
715
688
 
716
689
 
717
- const prefixPush = ($cd, fn) => {
718
- $cd.prefix.push(fn);
719
- fn();
690
+ const prefixPush = fn => {
691
+ current_cd.prefix.push(fn);
692
+ fn();
720
693
  };
721
694
 
722
695
 
723
- const unwrapProps = (cd, props, fn) => {
724
- if(props) {
725
- if(isFunction(props)) prefixPush(cd, () => fn(props()));
726
- else fn(props);
727
- }
696
+ const unwrapProps = (props, fn) => {
697
+ if(props) {
698
+ if(isFunction(props)) prefixPush(() => fn(props()));
699
+ else fn(props);
700
+ }
728
701
  };
729
702
 
730
703
 
731
704
  const makeBlock = (fr, fn) => {
732
- return (v) => {
733
- let $dom = fr.cloneNode(true), $cd = cd_new();
734
- fn($cd, $dom, v);
735
- return {$cd, $dom};
736
- }
705
+ return (v) => {
706
+ let $dom = fr.cloneNode(true);
707
+ fn?.($dom, v);
708
+ return $dom;
709
+ };
737
710
  };
738
711
 
739
712
 
740
- const makeBlockBound = (parentCD, fr, fn) => {
741
- return () => {
742
- let $dom = fr.cloneNode(true), $cd = cd_new();
743
- fn($cd, $dom);
744
- cd_attach(parentCD, $cd);
745
- return {
746
- $dom,
747
- destroy: () => cd_destroy$1($cd)
748
- };
713
+ const makeBlockBound = (fr, fn) => {
714
+ let parentCD = current_cd;
715
+ return () => {
716
+ let $dom = fr.cloneNode(true), prev = current_cd, $cd = current_cd = cd_new();
717
+ cd_attach(parentCD, $cd);
718
+ $onDestroy(() => cd_detach($cd));
719
+ try {
720
+ fn($dom);
721
+ return $dom;
722
+ } finally {
723
+ current_cd = prev;
749
724
  }
725
+ };
750
726
  };
751
727
 
752
728
 
753
- const makeStaticBlock = (fr, fn) => {
754
- return () => {
755
- let $dom = fr.cloneNode(true);
756
- fn?.($dom);
757
- return {$dom};
758
- }
759
- };
760
-
761
- const attachBlock = (cdo, label, block) => {
762
- if(!block) return;
763
- cd_onDestroy(cdo, block.destroy);
764
- cd_attach(cdo, block.$cd);
765
- insertAfter(label, block.$dom);
729
+ const attachBlock = (label, $dom) => {
730
+ if(!$dom) return;
731
+ insertAfter(label, $dom.$dom || $dom);
766
732
  };
767
733
 
768
-
769
734
  const mergeEvents = (...callbacks) => {
770
- callbacks = callbacks.filter(i => i);
771
- return (e) => callbacks.forEach(cb => cb(e));
735
+ callbacks = callbacks.filter(i => i);
736
+ return (e) => callbacks.forEach(cb => cb(e));
772
737
  };
773
738
 
739
+ const mergeAllEvents = ($events, local) => {
740
+ let result = Object.assign({}, $events);
741
+ for(let e in local) {
742
+ if(result[e]) result[e] = mergeEvents($events[e], local[e]);
743
+ else result[e] = local[e];
744
+ }
745
+ return result;
746
+ };
774
747
 
775
748
  const makeRootEvent = (root) => {
776
- let events = {}, nodes = [];
749
+ let events = {}, nodes = [];
750
+
751
+ if(root.nodeType == 11) {
752
+ let n = root.firstElementChild;
753
+ while(n) {
754
+ nodes.push(n);
755
+ n = n.nextElementSibling;
756
+ }
757
+ } else nodes = [root];
777
758
 
778
- if(root.nodeType == 11) {
779
- let n = root.firstElementChild;
780
- while(n) {
781
- nodes.push(n);
782
- n = n.nextElementSibling;
759
+ $onDestroy(() => {
760
+ for(let eventName in events) {
761
+ nodes.forEach(n => n.removeEventListener(eventName, events[eventName]));
762
+ }
763
+ });
764
+ return (target, eventName, callback) => {
765
+ const key = `_$$${eventName}`;
766
+ if(!events[eventName]) {
767
+ let handler = events[eventName] = ($event) => {
768
+ let top = $event.currentTarget;
769
+ let el = $event.target;
770
+ while(el) {
771
+ el[key]?.($event);
772
+ if(el == top || $event.cancelBubble) break;
773
+ el = el.parentNode;
783
774
  }
784
- } else nodes = [root];
775
+ };
776
+ nodes.forEach(n => n.addEventListener(eventName, handler));
777
+ }
778
+ target[key] = callback;
779
+ };
780
+ };
785
781
 
786
- $onDestroy(() => {
787
- for(let eventName in events) {
788
- nodes.forEach(n => n.removeEventListener(eventName, events[eventName]));
782
+ const mount = (label, component, option) => {
783
+ let app, first, last, destroyList = current_destroyList = [];
784
+ current_mountList = [];
785
+ try {
786
+ app = component(option);
787
+ let $dom = app.$dom;
788
+ delete app.$dom;
789
+ if($dom.nodeType == 11) {
790
+ first = $dom.firstChild;
791
+ last = $dom.lastChild;
792
+ } else first = last = $dom;
793
+ label.appendChild($dom);
794
+ safeCallMount(current_mountList, destroyList);
795
+ } finally {
796
+ current_destroyList = current_mountList = null;
797
+ }
798
+ app.destroy = () => {
799
+ safeGroupCall(destroyList);
800
+ removeElements(first, last);
801
+ };
802
+ return app;
803
+ };
804
+
805
+ const mountStatic = (label, component, option) => {
806
+ current_destroyList = [];
807
+ current_mountList = [];
808
+ try {
809
+ let app = component(option);
810
+ label.appendChild(app.$dom);
811
+ safeGroupCall(current_mountList);
812
+ return app;
813
+ } finally {
814
+ current_destroyList = current_mountList = null;
815
+ }
816
+ };
817
+
818
+ const refer = (active, line) => {
819
+ let result = [], i, v;
820
+ const code = (x, d) => x.charCodeAt() - d;
821
+
822
+ for(i = 0; i < line.length; i++) {
823
+ let a = line[i];
824
+ switch (a) {
825
+ case '>':
826
+ active = active.firstChild;
827
+ break;
828
+ case '+':
829
+ active = active.firstChild;
830
+ case '.':
831
+ result.push(active);
832
+ break;
833
+ case '!':
834
+ v = code(line[++i], 48) * 42 + code(line[++i], 48);
835
+ while(v--) active = active.nextSibling;
836
+ break;
837
+ case '#':
838
+ active = result[code(line[++i], 48) * 26 + code(line[++i], 48)];
839
+ break;
840
+ default:
841
+ v = code(a, 0);
842
+ if(v >= 97) active = result[v - 97];
843
+ else {
844
+ v -= 48;
845
+ while(v--) active = active.nextSibling;
789
846
  }
790
- });
791
- return (target, eventName, callback) => {
792
- const key = `_$$${eventName}`;
793
- if(!events[eventName]) {
794
- let handler = events[eventName] = ($event) => {
795
- let top = $event.currentTarget;
796
- let el = $event.target;
797
- while(el) {
798
- el[key]?.($event);
799
- if(el == top || $event.cancelBubble) break;
800
- el = el.parentNode;
801
- }
802
- };
803
- nodes.forEach(n => n.addEventListener(eventName, handler));
804
- } target[key] = callback;
805
847
  }
848
+ }
849
+ return result;
806
850
  };
807
851
 
808
- function $$htmlBlock($cd, tag, fn) {
809
- let lastElement;
810
- let create = (html) => {
811
- let fr;
812
- if(tag.parentElement instanceof SVGElement) fr = svgToFragment(html);
813
- else fr = $$htmlToFragment(html, 3);
814
- lastElement = fr.lastChild;
815
- insertAfter(tag, fr);
816
- };
817
- let destroy = () => {
818
- if(!lastElement) return;
819
- $$removeElements(tag.nextSibling, lastElement);
820
- lastElement = null;
821
- };
822
- if($cd) {
823
- $watch($cd, fn, (html) => {
824
- destroy();
825
- if(html) create(html);
826
- }, {ro: true});
827
- } else create(fn());
852
+ let create = (tag, html) => {
853
+ let fr;
854
+ if(tag.parentElement instanceof SVGElement) {
855
+ let t = document.createElement('template');
856
+ t.innerHTML = '<svg>' + html + '</svg>';
857
+ fr = t.content.firstChild;
858
+ } else {
859
+ let t = document.createElement('template');
860
+ t.innerHTML = html;
861
+ fr = t.content;
862
+ }
863
+ let lastElement = fr.lastChild;
864
+ insertAfter(tag, fr);
865
+ return lastElement;
866
+ };
867
+
868
+ function htmlBlock(tag, fn) {
869
+ let lastElement;
870
+ let destroy = () => {
871
+ if(!lastElement) return;
872
+ removeElements(tag.nextSibling, lastElement);
873
+ lastElement = null;
874
+ };
875
+ $watch(fn, (html) => {
876
+ destroy();
877
+ if(html) lastElement = create(tag, html);
878
+ });
828
879
  }
829
880
 
830
- function ifBlock(parentCD, label, fn, build, buildElse) {
831
- let first, last, $cd, destroy;
832
- cd_onDestroy(parentCD, () => destroy?.());
881
+ function htmlBlockStatic(tag, value) {
882
+ create(tag, value);
883
+ }
833
884
 
834
- function createBlock(builder) {
835
- let $dom;
836
- ({$cd, destroy, $dom} = builder());
837
- cd_attach(parentCD, $cd);
838
- if($dom.nodeType == 11) {
839
- first = $dom[firstChild];
840
- last = $dom.lastChild;
841
- } else first = last = $dom;
842
- insertAfter(label, $dom);
885
+ function ifBlock(label, fn, parts, parentLabel) {
886
+ let first, last, $cd, destroyList, parentCD = current_cd;
887
+ $onDestroy(() => safeGroupCall(destroyList));
888
+
889
+ function createBlock(builder) {
890
+ let $dom;
891
+ destroyList = current_destroyList = [];
892
+ let mountList = current_mountList = [];
893
+ $cd = current_cd = cd_new();
894
+ try {
895
+ $dom = builder();
896
+ } finally {
897
+ current_destroyList = current_mountList = current_cd = null;
843
898
  }
844
- function destroyBlock() {
845
- if(!first) return;
846
- destroyResults = [];
847
- destroy?.();
848
- destroy = null;
849
- if($cd) {
850
- cd_destroy$1($cd);
851
- $cd = null;
852
- }
853
- if(destroyResults.length) {
854
- let f = first, l = last;
855
- Promise.allSettled(destroyResults).then(() => {
856
- $$removeElements(f, l);
857
- });
858
- } else $$removeElements(first, last);
859
- first = last = null;
860
- destroyResults = null;
899
+ cd_attach(parentCD, $cd);
900
+ if($dom.nodeType == 11) {
901
+ first = $dom.firstChild;
902
+ last = $dom.lastChild;
903
+ } else first = last = $dom;
904
+ if(parentLabel) label.appendChild($dom);
905
+ else insertAfter(label, $dom);
906
+ safeCallMount(mountList, destroyList);
907
+ }
908
+
909
+ function destroyBlock() {
910
+ if(!first) return;
911
+ destroyResults = [];
912
+ safeGroupCall(destroyList);
913
+ destroyList.length = 0;
914
+ if($cd) {
915
+ cd_detach($cd);
916
+ $cd = null;
861
917
  }
862
- $watch(parentCD, fn, (value) => {
863
- if(value) {
864
- destroyBlock();
865
- createBlock(build);
866
- } else {
867
- destroyBlock();
868
- if(buildElse) createBlock(buildElse);
869
- }
870
- });
918
+ if(destroyResults.length) {
919
+ let f = first, l = last;
920
+ Promise.allSettled(destroyResults).then(() => {
921
+ removeElements(f, l);
922
+ });
923
+ } else removeElements(first, last);
924
+ first = last = null;
925
+ destroyResults = null;
926
+ }
927
+
928
+ $watch(fn, (value) => {
929
+ destroyBlock();
930
+ if(value != null) createBlock(parts[value]);
931
+ });
871
932
  }
872
933
 
873
- function ifBlockReadOnly(component, label, fn, build, buildElse) {
874
- function createBlock(builder) {
875
- let {destroy, $dom} = builder();
876
- cd_onDestroy(component, destroy);
877
- insertAfter(label, $dom);
878
- }
879
- if(fn()) createBlock(build);
880
- else if(buildElse) createBlock(buildElse);
934
+
935
+ function ifBlockReadOnly(label, fn, parts) {
936
+ let value = fn();
937
+ if(value != null) insertAfter(label, parts[value]());
881
938
  }
882
939
 
883
- function $$awaitBlock(parentCD, label, relation, fn, build_main, build_then, build_catch) {
884
- let first, last, $cd, destroy, promise, status = 0;
885
- cd_onDestroy(parentCD, () => destroy?.());
886
-
887
- function destroyBlock() {
888
- if(!first) return;
889
- destroy?.();
890
- destroy = null;
891
- if($cd) {
892
- cd_destroy($cd);
893
- $cd = null;
894
- }
895
- $$removeElements(first, last);
896
- first = last = null;
940
+ function awaitBlock(label, relation, fn, build_main, build_then, build_catch) {
941
+ let parentCD = current_cd, first, last, $cd, promise, destroyList, status = 0;
942
+ $onDestroy(() => safeGroupCall(destroyList));
943
+
944
+ function destroyBlock() {
945
+ if(!first) return;
946
+
947
+ safeGroupCall(destroyList);
948
+ destroyList.length = 0;
949
+ if($cd) {
950
+ cd_detach($cd);
951
+ $cd = null;
897
952
  }
898
- function render(builder, value) {
899
- destroyBlock();
953
+ removeElements(first, last);
954
+ first = last = null;
955
+ }
900
956
 
901
- let $dom;
902
- ({$cd, destroy, $dom} = builder(value));
903
- cd_attach(parentCD, $cd);
904
- if($dom.nodeType == 11) {
905
- first = $dom[firstChild];
906
- last = $dom.lastChild;
907
- } else first = last = $dom;
908
- insertAfter(label, $dom);
909
- cd_component(parentCD).apply();
957
+ function render(builder, value) {
958
+ destroyBlock();
959
+
960
+ if(!builder) return;
961
+ destroyList = current_destroyList = [];
962
+ $cd = current_cd = cd_new();
963
+ let $dom, mountList = current_mountList = [];
964
+ try {
965
+ $dom = builder(value);
966
+ } finally {
967
+ current_destroyList = current_mountList = current_cd = null;
910
968
  }
911
- $watch(parentCD, relation, () => {
912
- let p = fn();
913
- if(status !== 1) render(build_main);
914
- status = 1;
915
- if(p && p instanceof Promise) {
916
- promise = p;
917
- promise.then(value => {
918
- status = 2;
919
- if(promise !== p) return;
920
- render(build_then, value);
921
- }).catch(value => {
922
- status = 3;
923
- if(promise !== p) return;
924
- render(build_catch, value);
925
- });
926
- }
927
- }, {ro: true, value: [], cmp: keyComparator});
969
+ cd_attach(parentCD, $cd);
970
+ if($dom.nodeType == 11) {
971
+ first = $dom.firstChild;
972
+ last = $dom.lastChild;
973
+ } else first = last = $dom;
974
+ insertAfter(label, $dom);
975
+ safeCallMount(mountList, destroyList);
976
+ cd_component(parentCD).$apply();
977
+ }
978
+
979
+ $watch(relation, () => {
980
+ let p = fn();
981
+ if(status !== 1) render(build_main);
982
+ status = 1;
983
+ if(p && p instanceof Promise) {
984
+ promise = p;
985
+ promise.then(value => {
986
+ status = 2;
987
+ if(promise !== p) return;
988
+ render(build_then, value);
989
+ }).catch(value => {
990
+ status = 3;
991
+ if(promise !== p) return;
992
+ render(build_catch, value);
993
+ });
994
+ }
995
+ }, { value: [], cmp: keyComparator });
928
996
  }
929
997
 
998
+ const eachDefaultKey = (item, index, array) => isObject(array[0]) ? item : index;
999
+
1000
+
930
1001
  const makeEachBlock = (fr, fn) => {
931
- return (item, index) => {
932
- let $dom = fr.cloneNode(true), $cd = cd_new();
933
- let rebind = fn($cd, $dom, item, index);
934
- return {$cd, $dom, rebind};
935
- }
1002
+ return (item, index) => {
1003
+ let $dom = fr.cloneNode(true);
1004
+ return [$dom, fn($dom, item, index)];
1005
+ };
936
1006
  };
937
1007
 
938
1008
 
939
- const makeStaticEachBlock = (fr, fn) => {
940
- return (item, index) => {
941
- let $dom = fr.cloneNode(true);
942
- let rebind = fn($dom, item, index);
943
- return {$dom, rebind};
944
- }
1009
+ const makeEachSingleBlock = (fn) => {
1010
+ return (item, index) => {
1011
+ let [rebind, component] = fn(item, index);
1012
+ return [component.$dom, rebind];
1013
+ };
945
1014
  };
946
1015
 
947
1016
 
948
- const makeEachSingleBlock = (fn) => {
949
- return (item, index) => {
950
- let [rebind, component] = fn(item, index);
951
- let {$cd, destroy, $dom} = component;
952
- return {$cd, destroy, $dom, rebind};
1017
+ const makeEachElseBlock = (fn) => {
1018
+ return (label, onlyChild, parentCD) => {
1019
+ let first, last;
1020
+ let destroyList = current_destroyList = [];
1021
+ let $cd = current_cd = cd_new();
1022
+ current_mountList = [];
1023
+ try {
1024
+ let $dom = fn();
1025
+ if($dom.nodeType == 11) {
1026
+ first = $dom.firstChild;
1027
+ last = $dom.lastChild;
1028
+ } else first = last = $dom;
1029
+ cd_attach(parentCD, $cd);
1030
+ if(onlyChild) label.appendChild($dom);
1031
+ else attachBlock(label, $dom);
1032
+ safeCallMount(current_mountList, destroyList);
1033
+ } finally {
1034
+ current_destroyList = current_mountList = current_cd = null;
953
1035
  }
1036
+
1037
+ return () => {
1038
+ removeElements(first, last);
1039
+ cd_detach($cd);
1040
+ safeGroupCall(destroyList);
1041
+ };
1042
+ };
954
1043
  };
955
1044
 
956
1045
 
957
- function $$eachBlock($parentCD, label, onlyChild, fn, getKey, bind) {
958
- let eachCD = cd_new();
959
- cd_attach($parentCD, eachCD);
1046
+ function $$eachBlock(label, onlyChild, fn, getKey, bind, buildElseBlock) {
1047
+ let parentCD = current_cd;
1048
+ let eachCD = cd_new();
1049
+ cd_attach(parentCD, eachCD);
1050
+
1051
+ let mapping = new Map();
1052
+ let lastNode, vi = 0, p_promise = 0, p_destroy = 0, elseBlock;
1053
+
1054
+ const destroyAll = () => {
1055
+ p_destroy && safeCall(() => mapping.forEach(ctx => ctx.d?.forEach(fn => fn())));
1056
+ mapping.clear();
1057
+ };
1058
+
1059
+ $onDestroy(destroyAll);
1060
+ buildElseBlock && $onDestroy(() => elseBlock?.());
1061
+
1062
+ $watch(fn, (array) => {
1063
+ if(!array) array = [];
1064
+ if(typeof (array) == 'number') array = [...Array(array)].map((_, i) => i + 1);
1065
+ else if(!isArray(array)) array = [];
1066
+
1067
+ let newMapping = new Map();
1068
+ let prevNode, parentNode;
1069
+ if(onlyChild) {
1070
+ prevNode = null;
1071
+ parentNode = label;
1072
+ } else {
1073
+ prevNode = label;
1074
+ parentNode = label.parentNode;
1075
+ }
1076
+
1077
+ if(mapping.size) {
1078
+ let ctx, count = 0;
1079
+ vi++;
1080
+ for(let i = 0; i < array.length; i++) {
1081
+ ctx = mapping.get(getKey(array[i], i, array));
1082
+ if(ctx) {
1083
+ ctx.a = vi;
1084
+ count++;
1085
+ }
1086
+ }
1087
+
1088
+ if(!count && lastNode) {
1089
+ destroyResults = [];
1090
+ eachCD.children.length = 0;
1091
+ destroyAll();
960
1092
 
961
- let mapping = new Map();
962
- let lastNode, vi = 0;
1093
+ if(destroyResults.length) {
1094
+ p_promise = 1;
1095
+ let removedNodes = [];
1096
+ iterNodes(onlyChild ? label.firstChild : label.nextSibling, lastNode, n => {
1097
+ n.$$removing = true;
1098
+ removedNodes.push(n);
1099
+ });
1100
+ Promise.allSettled(destroyResults).then(() => removedNodes.forEach(n => n.remove()));
1101
+ } else {
1102
+ if(onlyChild) label.textContent = '';
1103
+ else removeElements(label.nextSibling, lastNode);
1104
+ }
963
1105
 
964
- $watch(eachCD, fn, (array) => {
965
- if(!array) array = [];
966
- if(typeof(array) == 'number') array = [...Array(array)].map((_,i) => i + 1);
967
- else if(!isArray(array)) array = [];
1106
+ destroyResults = null;
1107
+ } else if(count < mapping.size) {
1108
+ eachCD.children = [];
1109
+ destroyResults = [];
1110
+ let removedNodes = [];
1111
+ mapping.forEach(ctx => {
1112
+ if(ctx.a == vi) {
1113
+ ctx.$cd && eachCD.children.push(ctx.$cd);
1114
+ return;
1115
+ }
1116
+ safeGroupCall(ctx.d);
1117
+ iterNodes(ctx.first, ctx.last, n => removedNodes.push(n));
1118
+ });
968
1119
 
969
- let newMapping = new Map();
970
- let prevNode, parentNode;
971
- if(onlyChild) {
972
- prevNode = null;
973
- parentNode = label;
1120
+ if(destroyResults.length) {
1121
+ p_promise = 1;
1122
+ removedNodes.forEach(n => n.$$removing = true);
1123
+ Promise.allSettled(destroyResults).then(() => removedNodes.forEach(n => n.remove()));
974
1124
  } else {
975
- prevNode = label;
976
- parentNode = label.parentNode;
1125
+ removedNodes.forEach(n => n.remove());
977
1126
  }
1127
+ destroyResults = null;
1128
+ }
1129
+ }
978
1130
 
979
- if(mapping.size) {
980
- let ctx, count = 0;
981
- vi++;
982
- for(let i=0;i<array.length;i++) {
983
- ctx = mapping.get(getKey(array[i], i, array));
984
- if(ctx) {
985
- ctx.a = vi;
986
- count++;
987
- }
988
- }
1131
+ if(elseBlock && array.length) {
1132
+ elseBlock();
1133
+ elseBlock = null;
1134
+ }
989
1135
 
990
- if(!count && lastNode) {
991
- destroyResults = [];
992
- eachCD.children.forEach(cd => cd_destroy$1(cd, false));
993
- eachCD.children.length = 0;
994
- mapping.forEach(ctx => ctx.destroy?.());
995
- mapping.clear();
996
-
997
- if(destroyResults.length) {
998
- let removedNodes = [];
999
- iterNodes(onlyChild ? label.firstChild : label.nextSibling, lastNode, n => {
1000
- n.$$removing = true;
1001
- removedNodes.push(n);
1002
- });
1003
- Promise.allSettled(destroyResults).then(() => removedNodes.forEach(n => n.remove()));
1004
- } else {
1005
- if(onlyChild) label.textContent = '';
1006
- else $$removeElements(label.nextSibling, lastNode);
1007
- }
1008
-
1009
- destroyResults = null;
1010
- } else if(count < mapping.size) {
1011
- eachCD.children = [];
1012
- destroyResults = [];
1013
- let removedNodes = [];
1014
- mapping.forEach(ctx => {
1015
- if(ctx.a == vi) {
1016
- ctx.$cd && eachCD.children.push(ctx.$cd);
1017
- return;
1018
- }
1019
- ctx.$cd && cd_destroy$1(ctx.$cd, false);
1020
- ctx.destroy?.();
1021
- iterNodes(ctx.first, ctx.last, n => {
1022
- n.$$removing = true;
1023
- removedNodes.push(n);
1024
- });
1025
- });
1026
-
1027
- if(destroyResults.length) {
1028
- Promise.allSettled(destroyResults).then(() => removedNodes.forEach(n => n.remove()));
1029
- } else {
1030
- removedNodes.forEach(n => n.remove());
1031
- }
1032
- destroyResults = null;
1136
+ let i, item, next_ctx, ctx, nextEl, key;
1137
+ for(i = 0; i < array.length; i++) {
1138
+ item = array[i];
1139
+ key = getKey(item, i, array);
1140
+ if(next_ctx) {
1141
+ ctx = next_ctx;
1142
+ next_ctx = null;
1143
+ } else ctx = mapping.get(key);
1144
+ if(ctx) {
1145
+ nextEl = i == 0 && onlyChild ? parentNode.firstChild : prevNode.nextSibling;
1146
+ if(p_promise) while(nextEl && nextEl.$$removing) nextEl = nextEl.nextSibling;
1147
+ if(nextEl != ctx.first) {
1148
+ let insert = true;
1149
+
1150
+ if(ctx.first == ctx.last && (i + 1 < array.length) && prevNode?.nextSibling) {
1151
+ next_ctx = mapping.get(getKey(array[i + 1], i + 1, array));
1152
+ if(next_ctx && prevNode.nextSibling.nextSibling === next_ctx.first) {
1153
+ parentNode.replaceChild(ctx.first, prevNode.nextSibling);
1154
+ insert = false;
1155
+ }
1156
+ }
1157
+
1158
+ if(insert) {
1159
+ let insertBefore = prevNode?.nextSibling;
1160
+ let next, el = ctx.first;
1161
+ while(el) {
1162
+ next = el.nextSibling;
1163
+ parentNode.insertBefore(el, insertBefore);
1164
+ if(el == ctx.last) break;
1165
+ el = next;
1033
1166
  }
1167
+ }
1168
+ }
1169
+ ctx.rebind?.(item, i);
1170
+ } else {
1171
+ let $dom, rebind,
1172
+ d = current_destroyList = [],
1173
+ m = current_mountList = [],
1174
+ $cd = current_cd = cd_new();
1175
+ try {
1176
+ ([$dom, rebind] = bind(item, i));
1177
+ } finally {
1178
+ current_destroyList = current_mountList = current_cd = null;
1179
+ }
1180
+ ctx = { $cd, rebind };
1181
+ cd_attach(eachCD, $cd);
1182
+ if($dom.nodeType == 11) {
1183
+ ctx.first = $dom.firstChild;
1184
+ ctx.last = $dom.lastChild;
1185
+ } else ctx.first = ctx.last = $dom;
1186
+ parentNode.insertBefore($dom, prevNode?.nextSibling);
1187
+ safeCallMount(m, d);
1188
+ if(d.length) {
1189
+ ctx.d = d;
1190
+ p_destroy = 1;
1034
1191
  }
1192
+ }
1193
+ prevNode = ctx.last;
1194
+ newMapping.set(key, ctx);
1195
+ }
1196
+ lastNode = prevNode;
1197
+ mapping.clear();
1198
+ mapping = newMapping;
1035
1199
 
1036
- let i, item, next_ctx, ctx, nextEl, key;
1037
- for(i=0;i<array.length;i++) {
1038
- item = array[i];
1039
- key = getKey(item, i, array);
1040
- if(next_ctx) {
1041
- ctx = next_ctx;
1042
- next_ctx = null;
1043
- } else ctx = mapping.get(key);
1044
- if(ctx) {
1045
- nextEl = i == 0 && onlyChild ? parentNode[firstChild] : prevNode.nextSibling;
1046
- while(nextEl && nextEl.$$removing) nextEl = nextEl.nextSibling;
1047
- if(nextEl != ctx.first) {
1048
- let insert = true;
1049
-
1050
- if(ctx.first == ctx.last && (i + 1 < array.length) && prevNode?.nextSibling) {
1051
- next_ctx = mapping.get(getKey(array[i + 1], i + 1, array));
1052
- if(next_ctx && prevNode.nextSibling.nextSibling === next_ctx.first) {
1053
- parentNode.replaceChild(ctx.first, prevNode.nextSibling);
1054
- insert = false;
1055
- }
1056
- }
1057
-
1058
- if(insert) {
1059
- let insertBefore = prevNode?.nextSibling;
1060
- let next, el = ctx.first;
1061
- while(el) {
1062
- next = el.nextSibling;
1063
- parentNode.insertBefore(el, insertBefore);
1064
- if(el == ctx.last) break;
1065
- el = next;
1066
- }
1067
- }
1068
- }
1069
- ctx.rebind?.(i, item);
1070
- } else {
1071
- let $dom;
1072
- ({$dom, ...ctx} = bind(item, i));
1073
- cd_attach(eachCD, ctx.$cd);
1074
- if($dom.nodeType == 11) {
1075
- ctx.first = $dom[firstChild];
1076
- ctx.last = $dom.lastChild;
1077
- } else ctx.first = ctx.last = $dom;
1078
- parentNode.insertBefore($dom, prevNode?.nextSibling);
1079
- }
1080
- prevNode = ctx.last;
1081
- newMapping.set(key, ctx);
1082
- } lastNode = prevNode;
1083
- mapping.clear();
1084
- mapping = newMapping;
1085
- }, {ro: true, cmp: $$compareArray});
1200
+ if(!array.length && !elseBlock && buildElseBlock) {
1201
+ elseBlock = buildElseBlock(label, onlyChild, parentCD);
1202
+ }
1203
+ }, { cmp: compareArray });
1086
1204
  }
1087
1205
 
1088
1206
  const invokeSlotBase = ($component, slotName, $context, props, placeholder) => {
1089
- let $slot = $component.$option.slots?.[slotName || 'default'];
1090
- return $slot ? $slot($component, $context, props) : placeholder?.();
1207
+ let $slot = $component.$option.slots?.[slotName || 'default'];
1208
+ return $slot ? $slot($component, $context, props) : placeholder?.();
1091
1209
  };
1092
1210
 
1093
-
1094
1211
  const invokeSlot = ($component, slotName, $context, propsFn, placeholder, cmp) => {
1095
- let $slot = $component.$option.slots?.[slotName || 'default'];
1096
-
1097
- if($slot) {
1098
- let push, w, result;
1099
- w = cd_watchObject(propsFn, value => push?.(value), {ro: true, value: {}, cmp});
1100
- fire(w);
1101
- ({push, ...result} = $slot($component, $context, w.value));
1102
- if(push) {
1103
- result.$cd = cd_new();
1104
- result.$cd.watchers.push(w);
1105
- }
1106
- return result;
1107
- } else return placeholder?.();
1212
+ let $slot = $component.$option.slots?.[slotName || 'default'];
1213
+
1214
+ if($slot) {
1215
+ let push, w = new WatchObject(propsFn, value => push(value));
1216
+ Object.assign(w, { value: {}, cmp, idle: true });
1217
+ fire(w);
1218
+ let $dom = $slot($component, $context, w.value);
1219
+ if($dom.$dom) {
1220
+ if($dom.push) {
1221
+ push = $dom.push;
1222
+ current_cd.watchers.push(w);
1223
+ }
1224
+ $dom = $dom.$dom;
1225
+ }
1226
+ return $dom;
1227
+ } else return placeholder?.();
1108
1228
  };
1109
1229
 
1110
-
1111
- const makeSlot = (parentCD, fr, fn) => {
1112
- return (callerComponent, $context, props) => {
1113
- let $dom = fr.cloneNode(true), $cd = cd_new();
1114
- cd_attach(parentCD, $cd);
1115
- return {
1116
- $dom,
1117
- destroy: () => cd_destroy$1($cd),
1118
- push: fn($cd, $dom, $context, callerComponent, props)
1119
- };
1120
- };
1230
+ const makeSlot = (fr, fn) => {
1231
+ let parentCD = current_cd;
1232
+ return (callerComponent, $context, props) => {
1233
+ let $dom = fr.cloneNode(true), prev = current_cd;
1234
+ if(parentCD) {
1235
+ let $cd = current_cd = cd_new();
1236
+ cd_attach(parentCD, $cd);
1237
+ $onDestroy(() => cd_detach($cd));
1238
+ cd_component(parentCD).$apply();
1239
+ } else current_cd = null;
1240
+ try {
1241
+ return { $dom, push: fn($dom, $context, callerComponent, props) };
1242
+ } finally {
1243
+ current_cd = prev;
1244
+ }
1245
+ };
1121
1246
  };
1122
1247
 
1123
- export { $$addEventForComponent, $$awaitBlock, $$cloneDeep, $$compareArray, $$compareDeep, $$deepComparator, $$eachBlock, $$htmlBlock, $$htmlToFragment, $$htmlToFragmentClean, $$removeElements, $$removeItem, $base, $context, $digest, $makeEmitter, $onDestroy, $onMount, $tick, $watch, $watchReadOnly, __app_onerror, __bindActionSubscribe, addClass, addEvent, addStyles, attachAnchor, attachBlock, attachDynComponent, autoSubscribe, bindAction, bindAttribute, bindAttributeBase, bindClass, bindClassExp, bindInput, bindStyle, bindText, callComponent, callExportedFragment, cd_attach, cd_component, cd_destroy$1 as cd_destroy, cd_new, cd_onDestroy, cd_watchObject, childNodes, cloneDeep, configure, createTextNode, current_component, destroyResults, eachDefaultKey, exportFragment, fire, firstChild, getFinalLabel, ifBlock, ifBlockReadOnly, insertAfter, invokeSlot, invokeSlotBase, isArray, isFunction, iterNodes, keyComparator, makeBlock, makeBlockBound, makeClassResolver, makeComponent, makeEachBlock, makeEachSingleBlock, makeExternalProperty, makeRootEvent, makeSlot, makeStaticBlock, makeStaticEachBlock, mergeEvents, noop, prefixPush, removeElementsBetween, setClassToElement, spreadAttributes, svgToFragment, unwrapProps };
1248
+ export { $$eachBlock, $digest, $onDestroy, $onMount, $tick, $watch, WatchObject, __app_onerror, __bindActionSubscribe, addClass, addEvent, addStyles, attachAnchor, attachBlock, attachDynComponent, autoSubscribe, awaitBlock, bindAction, bindAttribute, bindAttributeBase, bindClass, bindClassExp, bindInput, bindStyle, bindText, callComponent, callComponentDyn, callExportedFragment, cd_attach, cd_component, cd_detach, cd_new, cloneDeep, compareArray, compareDeep, configure, createTextNode, current_cd, current_component, current_destroyList, current_mountList, deepComparator, destroyResults, eachDefaultKey, exportFragment, fire, getFinalLabel, htmlBlock, htmlBlockStatic, htmlToFragment, htmlToFragmentClean, ifBlock, ifBlockReadOnly, insertAfter, invokeSlot, invokeSlotBase, isArray, isFunction, iterNodes, keyComparator, makeAnchor, makeApply, makeBlock, makeBlockBound, makeClassResolver, makeComponent, makeEachBlock, makeEachElseBlock, makeEachSingleBlock, makeEmitter, makeExternalProperty, makeRootEvent, makeSlot, mergeAllEvents, mergeEvents, mount, mountStatic, noop, prefixPush, refer, removeElements, removeElementsBetween, removeItem, setClassToElement, spreadAttributes, svgToFragment, unwrapProps };