mol_plot_all 1.2.1691 → 1.2.1693

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/node.mjs CHANGED
@@ -2404,6 +2404,250 @@ var $;
2404
2404
 
2405
2405
  ;
2406
2406
  "use strict";
2407
+ var $;
2408
+ (function ($) {
2409
+ $.$mol_theme = $mol_style_prop('mol_theme', [
2410
+ 'back',
2411
+ 'hover',
2412
+ 'card',
2413
+ 'current',
2414
+ 'special',
2415
+ 'text',
2416
+ 'control',
2417
+ 'shade',
2418
+ 'line',
2419
+ 'focus',
2420
+ 'field',
2421
+ 'image',
2422
+ 'spirit',
2423
+ ]);
2424
+ })($ || ($ = {}));
2425
+
2426
+ ;
2427
+ "use strict";
2428
+ var $;
2429
+ (function ($) {
2430
+ $mol_style_attach("mol/theme/theme.css", ":root {\n\t--mol_theme_hue: 240deg;\n\t--mol_theme_hue_spread: 90deg;\n\tcolor-scheme: dark light;\n}\n\n:root, :where([mol_theme]) {\n\tcolor: var(--mol_theme_text);\n\tfill: var(--mol_theme_text);\n\tbackground-color: var(--mol_theme_back);\n}\n\t\n:root, [mol_theme=\"$mol_theme_dark\"], :where([mol_theme=\"$mol_theme_dark\"]) [mol_theme] {\n\n\t--mol_theme_luma: -1;\n\t--mol_theme_image: invert(1) hue-rotate( 180deg );\n\t--mol_theme_spirit: hsl( 0deg, 0%, 0%, .75 );\n\n\t--mol_theme_back: hsl( var(--mol_theme_hue), 20%, 10% );\n\t--mol_theme_card: hsl( var(--mol_theme_hue), 50%, 20%, .25 );\n\t--mol_theme_field: hsl( var(--mol_theme_hue), 50%, 8%, .25 );\n\t--mol_theme_hover: hsl( var(--mol_theme_hue), 0%, 50%, .1 );\n\t\n\t--mol_theme_text: hsl( var(--mol_theme_hue), 0%, 80% );\n\t--mol_theme_shade: hsl( var(--mol_theme_hue), 0%, 60%, 1 );\n\t--mol_theme_line: hsl( var(--mol_theme_hue), 0%, 50%, .25 );\n\t--mol_theme_focus: hsl( calc( var(--mol_theme_hue) + 180deg ), 100%, 65% );\n\t\n\t--mol_theme_control: hsl( var(--mol_theme_hue), 60%, 65% );\n\t--mol_theme_current: hsl( calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ), 60%, 65% );\n\t--mol_theme_special: hsl( calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ), 60%, 65% );\n\n} @supports( color: oklch( 0% 0 0deg ) ) {\n:root, [mol_theme=\"$mol_theme_dark\"], :where([mol_theme=\"$mol_theme_dark\"]) [mol_theme] {\n\t\n\t--mol_theme_back: oklch( 20% .03 var(--mol_theme_hue) );\n\t--mol_theme_card: oklch( 30% .05 var(--mol_theme_hue) / .25 );\n\t--mol_theme_field: oklch( 15% 0 var(--mol_theme_hue) / .25 );\n\t--mol_theme_hover: oklch( 70% 0 var(--mol_theme_hue) / .1 );\n\t\n\t--mol_theme_text: oklch( 80% 0 var(--mol_theme_hue) );\n\t--mol_theme_shade: oklch( 60% 0 var(--mol_theme_hue) );\n\t--mol_theme_line: oklch( 60% 0 var(--mol_theme_hue) / .25 );\n\t--mol_theme_focus: oklch( 80% .2 calc( var(--mol_theme_hue) + 180deg ) );\n\t\n\t--mol_theme_control: oklch( 70% .1 var(--mol_theme_hue) );\n\t--mol_theme_current: oklch( 70% .2 calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ) );\n\t--mol_theme_special: oklch( 70% .2 calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ) );\n\n} }\n\n[mol_theme=\"$mol_theme_light\"], :where([mol_theme=\"$mol_theme_light\"]) [mol_theme] {\n\t\n\t--mol_theme_luma: 1;\n\t--mol_theme_image: none;\n\t--mol_theme_spirit: hsl( 0deg, 0%, 100%, .75 );\n\t\n\t--mol_theme_back: hsl( var(--mol_theme_hue), 20%, 92% );\n\t--mol_theme_card: hsl( var(--mol_theme_hue), 50%, 100%, .5 );\n\t--mol_theme_field: hsl( var(--mol_theme_hue), 50%, 100%, .75 );\n\t--mol_theme_hover: hsl( var(--mol_theme_hue), 0%, 50%, .1 );\n\t\n\t--mol_theme_text: hsl( var(--mol_theme_hue), 0%, 0% );\n\t--mol_theme_shade: hsl( var(--mol_theme_hue), 0%, 40%, 1 );\n\t--mol_theme_line: hsl( var(--mol_theme_hue), 0%, 50%, .25 );\n\t--mol_theme_focus: hsl( calc( var(--mol_theme_hue) + 180deg ), 100%, 40% );\n\t\n\t--mol_theme_control: hsl( var(--mol_theme_hue), 80%, 30% );\n\t--mol_theme_current: hsl( calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ), 80%, 30% );\n\t--mol_theme_special: hsl( calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ), 80%, 30% );\n\n} @supports( color: oklch( 0% 0 0deg ) ) {\n[mol_theme=\"$mol_theme_light\"], :where([mol_theme=\"$mol_theme_light\"]) [mol_theme] {\n\t--mol_theme_back: oklch( 92% .01 var(--mol_theme_hue) );\n\t--mol_theme_card: oklch( 99% .01 var(--mol_theme_hue) / .5 );\n\t--mol_theme_field: oklch( 100% 0 var(--mol_theme_hue) / .5 );\n\t--mol_theme_hover: oklch( 50% 0 var(--mol_theme_hue) / .1 );\n\t\n\t--mol_theme_text: oklch( 20% 0 var(--mol_theme_hue) );\n\t--mol_theme_shade: oklch( 60% 0 var(--mol_theme_hue) );\n\t--mol_theme_line: oklch( 50% 0 var(--mol_theme_hue) / .25 );\n\t--mol_theme_focus: oklch( 60% .2 calc( var(--mol_theme_hue) + 180deg ) );\n\t\n\t--mol_theme_control: oklch( 40% .15 var(--mol_theme_hue) );\n\t--mol_theme_current: oklch( 50% .2 calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ) );\n\t--mol_theme_special: oklch( 50% .2 calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ) );\n\n} }\n\n:where( :root, [mol_theme=\"$mol_theme_dark\"] ) [mol_theme=\"$mol_theme_base\"] {\n\t--mol_theme_back: oklch( 25% .075 var(--mol_theme_hue) );\n\t--mol_theme_card: oklch( 35% .1 var(--mol_theme_hue) / .25 );\n}\n:where( [mol_theme=\"$mol_theme_light\"] ) [mol_theme=\"$mol_theme_base\"] {\n\t--mol_theme_back: oklch( 85% .075 var(--mol_theme_hue) );\n\t--mol_theme_card: oklch( 98% .03 var(--mol_theme_hue) / .25 );\n}\n\n:where( :root, [mol_theme=\"$mol_theme_dark\"] ) [mol_theme=\"$mol_theme_current\"] {\n\t--mol_theme_back: oklch( 25% .05 calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ) );\n\t--mol_theme_card: oklch( 35% .1 calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ) / .25 );\n}\n:where( [mol_theme=\"$mol_theme_light\"] ) [mol_theme=\"$mol_theme_current\"] {\n\t--mol_theme_back: oklch( 85% .05 calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ) );\n\t--mol_theme_card: oklch( 98% .03 calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ) / .25 );\n}\n\n:where( :root, [mol_theme=\"$mol_theme_dark\"] ) [mol_theme=\"$mol_theme_special\"] {\n\t--mol_theme_back: oklch( 25% .05 calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ) );\n\t--mol_theme_card: oklch( 35% .1 calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ) / .25 );\n}\n:where( [mol_theme=\"$mol_theme_light\"] ) [mol_theme=\"$mol_theme_special\"] {\n\t--mol_theme_back: oklch( 85% .05 calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ) );\n\t--mol_theme_card: oklch( 98% .03 calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ) / .25 );\n}\n\n:where( :root, [mol_theme=\"$mol_theme_dark\"] ) [mol_theme=\"$mol_theme_accent\"] {\n\t--mol_theme_back: oklch( 35% .1 calc( var(--mol_theme_hue) + 180deg ) );\n\t--mol_theme_card: oklch( 45% .15 calc( var(--mol_theme_hue) + 180deg ) / .25 );\n}\n:where( [mol_theme=\"$mol_theme_light\"] ) [mol_theme=\"$mol_theme_accent\"] {\n\t--mol_theme_back: oklch( 83% .1 calc( var(--mol_theme_hue) + 180deg ) );\n\t--mol_theme_card: oklch( 98% .03 calc( var(--mol_theme_hue) + 180deg ) / .25 );\n}\n\n");
2431
+ })($ || ($ = {}));
2432
+
2433
+ ;
2434
+ "use strict";
2435
+
2436
+ ;
2437
+ "use strict";
2438
+ var $;
2439
+ (function ($) {
2440
+ $.$mol_gap = $mol_style_prop('mol_gap', [
2441
+ 'page',
2442
+ 'block',
2443
+ 'text',
2444
+ 'emoji',
2445
+ 'round',
2446
+ 'space',
2447
+ 'blur',
2448
+ ]);
2449
+ })($ || ($ = {}));
2450
+
2451
+ ;
2452
+ "use strict";
2453
+ var $;
2454
+ (function ($) {
2455
+ $mol_style_attach("mol/gap/gap.css", ":root {\n\t--mol_gap_page: 3rem;\n\t--mol_gap_block: .75rem;\n\t--mol_gap_text: .5rem .75rem;\n\t--mol_gap_emoji: .5rem;\n\t--mol_gap_round: .25rem;\n\t--mol_gap_space: .25rem;\n\t--mol_gap_blur: .5rem;\n}\n");
2456
+ })($ || ($ = {}));
2457
+
2458
+ ;
2459
+ "use strict";
2460
+ var $;
2461
+ (function ($) {
2462
+ function $mol_dom_render_children(el, childNodes) {
2463
+ const node_set = new Set(childNodes);
2464
+ let nextNode = el.firstChild;
2465
+ for (let view of childNodes) {
2466
+ if (view == null)
2467
+ continue;
2468
+ if (view instanceof $mol_dom_context.Node) {
2469
+ while (true) {
2470
+ if (!nextNode) {
2471
+ el.appendChild(view);
2472
+ break;
2473
+ }
2474
+ if (nextNode == view) {
2475
+ nextNode = nextNode.nextSibling;
2476
+ break;
2477
+ }
2478
+ else {
2479
+ if (node_set.has(nextNode)) {
2480
+ el.insertBefore(view, nextNode);
2481
+ break;
2482
+ }
2483
+ else {
2484
+ const nn = nextNode.nextSibling;
2485
+ el.removeChild(nextNode);
2486
+ nextNode = nn;
2487
+ }
2488
+ }
2489
+ }
2490
+ }
2491
+ else {
2492
+ if (nextNode && nextNode.nodeName === '#text') {
2493
+ const str = String(view);
2494
+ if (nextNode.nodeValue !== str)
2495
+ nextNode.nodeValue = str;
2496
+ nextNode = nextNode.nextSibling;
2497
+ }
2498
+ else {
2499
+ const textNode = $mol_dom_context.document.createTextNode(String(view));
2500
+ el.insertBefore(textNode, nextNode);
2501
+ }
2502
+ }
2503
+ }
2504
+ while (nextNode) {
2505
+ const currNode = nextNode;
2506
+ nextNode = currNode.nextSibling;
2507
+ el.removeChild(currNode);
2508
+ }
2509
+ }
2510
+ $.$mol_dom_render_children = $mol_dom_render_children;
2511
+ })($ || ($ = {}));
2512
+
2513
+ ;
2514
+ "use strict";
2515
+
2516
+ ;
2517
+ "use strict";
2518
+ var $;
2519
+ (function ($) {
2520
+ $.$mol_jsx_prefix = '';
2521
+ $.$mol_jsx_crumbs = '';
2522
+ $.$mol_jsx_booked = null;
2523
+ $.$mol_jsx_document = {
2524
+ getElementById: () => null,
2525
+ createElementNS: (space, name) => $mol_dom_context.document.createElementNS(space, name),
2526
+ createDocumentFragment: () => $mol_dom_context.document.createDocumentFragment(),
2527
+ };
2528
+ $.$mol_jsx_frag = '';
2529
+ function $mol_jsx(Elem, props, ...childNodes) {
2530
+ const id = props && props.id || '';
2531
+ const guid = id ? $.$mol_jsx_prefix ? $.$mol_jsx_prefix + '/' + id : id : $.$mol_jsx_prefix;
2532
+ const crumbs_self = id ? $.$mol_jsx_crumbs.replace(/(\S+)/g, `$1_${id.replace(/\/.*/i, '')}`) : $.$mol_jsx_crumbs;
2533
+ if (Elem && $.$mol_jsx_booked) {
2534
+ if ($.$mol_jsx_booked.has(id)) {
2535
+ $mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(guid)}`));
2536
+ }
2537
+ else {
2538
+ $.$mol_jsx_booked.add(id);
2539
+ }
2540
+ }
2541
+ let node = guid ? $.$mol_jsx_document.getElementById(guid) : null;
2542
+ if ($.$mol_jsx_prefix) {
2543
+ const prefix_ext = $.$mol_jsx_prefix;
2544
+ const booked_ext = $.$mol_jsx_booked;
2545
+ const crumbs_ext = $.$mol_jsx_crumbs;
2546
+ for (const field in props) {
2547
+ const func = props[field];
2548
+ if (typeof func !== 'function')
2549
+ continue;
2550
+ const wrapper = function (...args) {
2551
+ const prefix = $.$mol_jsx_prefix;
2552
+ const booked = $.$mol_jsx_booked;
2553
+ const crumbs = $.$mol_jsx_crumbs;
2554
+ try {
2555
+ $.$mol_jsx_prefix = prefix_ext;
2556
+ $.$mol_jsx_booked = booked_ext;
2557
+ $.$mol_jsx_crumbs = crumbs_ext;
2558
+ return func.call(this, ...args);
2559
+ }
2560
+ finally {
2561
+ $.$mol_jsx_prefix = prefix;
2562
+ $.$mol_jsx_booked = booked;
2563
+ $.$mol_jsx_crumbs = crumbs;
2564
+ }
2565
+ };
2566
+ $mol_func_name_from(wrapper, func);
2567
+ props[field] = wrapper;
2568
+ }
2569
+ }
2570
+ if (typeof Elem !== 'string') {
2571
+ if ('prototype' in Elem) {
2572
+ const view = node && node[String(Elem)] || new Elem;
2573
+ Object.assign(view, props);
2574
+ view[Symbol.toStringTag] = guid;
2575
+ view.childNodes = childNodes;
2576
+ if (!view.ownerDocument)
2577
+ view.ownerDocument = $.$mol_jsx_document;
2578
+ view.className = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
2579
+ node = view.valueOf();
2580
+ node[String(Elem)] = view;
2581
+ return node;
2582
+ }
2583
+ else {
2584
+ const prefix = $.$mol_jsx_prefix;
2585
+ const booked = $.$mol_jsx_booked;
2586
+ const crumbs = $.$mol_jsx_crumbs;
2587
+ try {
2588
+ $.$mol_jsx_prefix = guid;
2589
+ $.$mol_jsx_booked = new Set;
2590
+ $.$mol_jsx_crumbs = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
2591
+ return Elem(props, ...childNodes);
2592
+ }
2593
+ finally {
2594
+ $.$mol_jsx_prefix = prefix;
2595
+ $.$mol_jsx_booked = booked;
2596
+ $.$mol_jsx_crumbs = crumbs;
2597
+ }
2598
+ }
2599
+ }
2600
+ if (!node) {
2601
+ node = Elem
2602
+ ? $.$mol_jsx_document.createElementNS(props?.xmlns ?? 'http://www.w3.org/1999/xhtml', Elem)
2603
+ : $.$mol_jsx_document.createDocumentFragment();
2604
+ }
2605
+ $mol_dom_render_children(node, [].concat(...childNodes));
2606
+ if (!Elem)
2607
+ return node;
2608
+ if (guid)
2609
+ node.id = guid;
2610
+ for (const key in props) {
2611
+ if (key === 'id')
2612
+ continue;
2613
+ if (typeof props[key] === 'string') {
2614
+ if (typeof node[key] === 'string')
2615
+ node[key] = props[key];
2616
+ node.setAttribute(key, props[key]);
2617
+ }
2618
+ else if (props[key] &&
2619
+ typeof props[key] === 'object' &&
2620
+ Reflect.getPrototypeOf(props[key]) === Reflect.getPrototypeOf({})) {
2621
+ if (typeof node[key] === 'object') {
2622
+ Object.assign(node[key], props[key]);
2623
+ continue;
2624
+ }
2625
+ }
2626
+ else {
2627
+ node[key] = props[key];
2628
+ }
2629
+ }
2630
+ if ($.$mol_jsx_crumbs)
2631
+ node.className = (props?.['class'] ? props['class'] + ' ' : '') + crumbs_self;
2632
+ return node;
2633
+ }
2634
+ $.$mol_jsx = $mol_jsx;
2635
+ })($ || ($ = {}));
2636
+
2637
+ ;
2638
+ "use strict";
2639
+ var $;
2640
+ (function ($) {
2641
+ class $mol_window extends $mol_object {
2642
+ static size() {
2643
+ return {
2644
+ width: 1024,
2645
+ height: 768,
2646
+ };
2647
+ }
2648
+ }
2649
+ $.$mol_window = $mol_window;
2650
+ })($ || ($ = {}));
2407
2651
 
2408
2652
  ;
2409
2653
  "use strict";
@@ -2685,1477 +2929,66 @@ var $;
2685
2929
  if ($mol_wire_auto()?.temp) {
2686
2930
  return atom.once();
2687
2931
  }
2688
- else {
2689
- return atom.sync();
2690
- }
2691
- }
2692
- return atom.resync(args);
2693
- }
2694
- };
2695
- Reflect.defineProperty(descr2.value, 'name', { value: orig.name + ' ' });
2696
- Reflect.defineProperty(descr2.value, 'length', { value: orig.length });
2697
- Object.assign(descr2.value, { orig });
2698
- Reflect.defineProperty(host, field, descr2);
2699
- return descr2;
2700
- }
2701
- $.$mol_wire_solo = $mol_wire_solo;
2702
- })($ || ($ = {}));
2703
-
2704
- ;
2705
- "use strict";
2706
- var $;
2707
- (function ($) {
2708
- function $mol_wire_plex(host, field, descr) {
2709
- if (!descr)
2710
- descr = Reflect.getOwnPropertyDescriptor(host, field);
2711
- const orig = descr?.value ?? host[field];
2712
- const sup = Reflect.getPrototypeOf(host);
2713
- if (typeof sup[field] === 'function') {
2714
- Object.defineProperty(orig, 'name', { value: sup[field].name });
2715
- }
2716
- const descr2 = {
2717
- ...descr,
2718
- value: function (...args) {
2719
- let atom = $mol_wire_atom.plex(this, orig, args[0]);
2720
- if ((args.length === 1) || (args[1] === undefined)) {
2721
- if (!$mol_wire_fiber.warm)
2722
- return atom.result();
2723
- if ($mol_wire_auto()?.temp) {
2724
- return atom.once();
2725
- }
2726
- else {
2727
- return atom.sync();
2728
- }
2729
- }
2730
- return atom.resync(args);
2731
- }
2732
- };
2733
- Reflect.defineProperty(descr2.value, 'name', { value: orig.name + ' ' });
2734
- Reflect.defineProperty(descr2.value, 'length', { value: orig.length });
2735
- Object.assign(descr2.value, { orig });
2736
- Reflect.defineProperty(host, field, descr2);
2737
- return descr2;
2738
- }
2739
- $.$mol_wire_plex = $mol_wire_plex;
2740
- })($ || ($ = {}));
2741
-
2742
- ;
2743
- "use strict";
2744
- var $;
2745
- (function ($) {
2746
- $.$mol_mem = $mol_wire_solo;
2747
- $.$mol_mem_key = $mol_wire_plex;
2748
- })($ || ($ = {}));
2749
-
2750
- ;
2751
- "use strict";
2752
- var $;
2753
- (function ($) {
2754
- $.$mol_action = $mol_wire_method;
2755
- })($ || ($ = {}));
2756
-
2757
- ;
2758
- "use strict";
2759
- var $;
2760
- (function ($) {
2761
- class $mol_state_arg extends $mol_object {
2762
- prefix;
2763
- static prolog = '';
2764
- static separator = ' ';
2765
- static href(next) {
2766
- return next || process.argv.slice(2).join(' ');
2767
- }
2768
- static href_normal() {
2769
- return this.link({});
2770
- }
2771
- static dict(next) {
2772
- if (next !== void 0)
2773
- this.href(this.make_link(next));
2774
- var href = this.href();
2775
- var chunks = href.split(' ');
2776
- var params = {};
2777
- chunks.forEach(chunk => {
2778
- if (!chunk)
2779
- return;
2780
- var vals = chunk.split('=').map(decodeURIComponent);
2781
- params[vals.shift()] = vals.join('=');
2782
- });
2783
- return params;
2784
- }
2785
- static value(key, next) {
2786
- if (next === void 0)
2787
- return this.dict()[key] ?? null;
2788
- this.href(this.link({ [key]: next }));
2789
- return next;
2790
- }
2791
- static link(next) {
2792
- const params = {};
2793
- var prev = this.dict();
2794
- for (var key in prev) {
2795
- params[key] = prev[key];
2796
- }
2797
- for (var key in next) {
2798
- params[key] = next[key];
2799
- }
2800
- return this.make_link(params);
2801
- }
2802
- static make_link(next) {
2803
- const chunks = [];
2804
- for (const key in next) {
2805
- if (next[key] !== null) {
2806
- chunks.push([key, next[key]].map(encodeURIComponent).join('='));
2807
- }
2808
- }
2809
- return chunks.join(' ');
2810
- }
2811
- static go(next) {
2812
- this.href(this.link(next));
2813
- }
2814
- static commit() { }
2815
- constructor(prefix = '') {
2816
- super();
2817
- this.prefix = prefix;
2818
- }
2819
- value(key, next) {
2820
- return this.constructor.value(this.prefix + key, next);
2821
- }
2822
- sub(postfix) {
2823
- return new this.constructor(this.prefix + postfix + '.');
2824
- }
2825
- link(next) {
2826
- const prefix = this.prefix;
2827
- const dict = {};
2828
- for (var key in next) {
2829
- dict[prefix + key] = next[key];
2830
- }
2831
- return this.constructor.link(dict);
2832
- }
2833
- }
2834
- __decorate([
2835
- $mol_mem
2836
- ], $mol_state_arg, "href", null);
2837
- __decorate([
2838
- $mol_mem
2839
- ], $mol_state_arg, "href_normal", null);
2840
- __decorate([
2841
- $mol_mem
2842
- ], $mol_state_arg, "dict", null);
2843
- __decorate([
2844
- $mol_mem_key
2845
- ], $mol_state_arg, "value", null);
2846
- __decorate([
2847
- $mol_action
2848
- ], $mol_state_arg, "go", null);
2849
- $.$mol_state_arg = $mol_state_arg;
2850
- })($ || ($ = {}));
2851
-
2852
- ;
2853
- "use strict";
2854
- var $;
2855
- (function ($) {
2856
- class $mol_media extends $mol_object2 {
2857
- static match(query, next) {
2858
- if (next !== undefined)
2859
- return next;
2860
- const res = this.$.$mol_dom_context.matchMedia?.(query) ?? {};
2861
- res.onchange = () => this.match(query, res.matches);
2862
- return res.matches;
2863
- }
2864
- }
2865
- __decorate([
2866
- $mol_mem_key
2867
- ], $mol_media, "match", null);
2868
- $.$mol_media = $mol_media;
2869
- })($ || ($ = {}));
2870
-
2871
- ;
2872
- "use strict";
2873
- var $;
2874
- (function ($) {
2875
- function $mol_wire_solid() {
2876
- let current = $mol_wire_auto();
2877
- if (current.temp)
2878
- current = current.host;
2879
- if (current.reap !== nothing) {
2880
- current?.sub_on(sub, sub.data.length);
2881
- }
2882
- current.reap = nothing;
2883
- }
2884
- $.$mol_wire_solid = $mol_wire_solid;
2885
- const nothing = () => { };
2886
- const sub = new $mol_wire_pub_sub;
2887
- })($ || ($ = {}));
2888
-
2889
- ;
2890
- "use strict";
2891
- var $;
2892
- (function ($) {
2893
- $.$mol_mem_persist = $mol_wire_solid;
2894
- })($ || ($ = {}));
2895
-
2896
- ;
2897
- "use strict";
2898
- var $;
2899
- (function ($) {
2900
- function $mol_wire_probe(task, def) {
2901
- const warm = $mol_wire_fiber.warm;
2902
- try {
2903
- $mol_wire_fiber.warm = false;
2904
- const res = task();
2905
- if (res === undefined)
2906
- return def;
2907
- return res;
2908
- }
2909
- finally {
2910
- $mol_wire_fiber.warm = warm;
2911
- }
2912
- }
2913
- $.$mol_wire_probe = $mol_wire_probe;
2914
- })($ || ($ = {}));
2915
-
2916
- ;
2917
- "use strict";
2918
- var $;
2919
- (function ($) {
2920
- $.$mol_mem_cached = $mol_wire_probe;
2921
- })($ || ($ = {}));
2922
-
2923
- ;
2924
- "use strict";
2925
- var $;
2926
- (function ($) {
2927
- function $mol_wait_user_async() {
2928
- return new Promise(done => $mol_dom.addEventListener('click', function onclick() {
2929
- $mol_dom.removeEventListener('click', onclick);
2930
- done(null);
2931
- }));
2932
- }
2933
- $.$mol_wait_user_async = $mol_wait_user_async;
2934
- function $mol_wait_user() {
2935
- return this.$mol_wire_sync(this).$mol_wait_user_async();
2936
- }
2937
- $.$mol_wait_user = $mol_wait_user;
2938
- })($ || ($ = {}));
2939
-
2940
- ;
2941
- "use strict";
2942
- var $;
2943
- (function ($) {
2944
- class $mol_storage extends $mol_object2 {
2945
- static native() {
2946
- return this.$.$mol_dom_context.navigator.storage ?? {
2947
- persisted: async () => false,
2948
- persist: async () => false,
2949
- estimate: async () => ({}),
2950
- getDirectory: async () => null,
2951
- };
2952
- }
2953
- static persisted(next, cache) {
2954
- $mol_mem_persist();
2955
- if (cache)
2956
- return Boolean(next);
2957
- const native = this.native();
2958
- if (next && !$mol_mem_cached(() => this.persisted())) {
2959
- this.$.$mol_wait_user_async()
2960
- .then(() => native.persist())
2961
- .then(actual => {
2962
- setTimeout(() => this.persisted(actual, 'cache'), 5000);
2963
- if (actual)
2964
- this.$.$mol_log3_done({ place: `$mol_storage`, message: `Persist: Yes` });
2965
- else
2966
- this.$.$mol_log3_fail({ place: `$mol_storage`, message: `Persist: No` });
2967
- });
2968
- }
2969
- return next ?? $mol_wire_sync(native).persisted();
2970
- }
2971
- static estimate() {
2972
- return $mol_wire_sync(this.native() ?? {}).estimate();
2973
- }
2974
- static dir() {
2975
- return $mol_wire_sync(this.native()).getDirectory();
2976
- }
2977
- }
2978
- __decorate([
2979
- $mol_mem
2980
- ], $mol_storage, "native", null);
2981
- __decorate([
2982
- $mol_mem
2983
- ], $mol_storage, "persisted", null);
2984
- $.$mol_storage = $mol_storage;
2985
- })($ || ($ = {}));
2986
-
2987
- ;
2988
- "use strict";
2989
- var $;
2990
- (function ($) {
2991
- class $mol_state_local extends $mol_object {
2992
- static 'native()';
2993
- static native() {
2994
- if (this['native()'])
2995
- return this['native()'];
2996
- check: try {
2997
- const native = $mol_dom_context.localStorage;
2998
- if (!native)
2999
- break check;
3000
- native.setItem('', '');
3001
- native.removeItem('');
3002
- return this['native()'] = native;
3003
- }
3004
- catch (error) {
3005
- console.warn(error);
3006
- }
3007
- return this['native()'] = {
3008
- getItem(key) {
3009
- return this[':' + key];
3010
- },
3011
- setItem(key, value) {
3012
- this[':' + key] = value;
3013
- },
3014
- removeItem(key) {
3015
- this[':' + key] = void 0;
3016
- }
3017
- };
3018
- }
3019
- static changes(next) { return next; }
3020
- static value(key, next) {
3021
- this.changes();
3022
- if (next === void 0)
3023
- return JSON.parse(this.native().getItem(key) || 'null');
3024
- if (next === null) {
3025
- this.native().removeItem(key);
3026
- }
3027
- else {
3028
- this.native().setItem(key, JSON.stringify(next));
3029
- this.$.$mol_storage.persisted(true);
3030
- }
3031
- return next;
3032
- }
3033
- prefix() { return ''; }
3034
- value(key, next) {
3035
- return $mol_state_local.value(this.prefix() + '.' + key, next);
3036
- }
3037
- }
3038
- __decorate([
3039
- $mol_mem
3040
- ], $mol_state_local, "changes", null);
3041
- __decorate([
3042
- $mol_mem_key
3043
- ], $mol_state_local, "value", null);
3044
- $.$mol_state_local = $mol_state_local;
3045
- })($ || ($ = {}));
3046
-
3047
- ;
3048
- "use strict";
3049
- var $;
3050
- (function ($) {
3051
- function $mol_const(value) {
3052
- const getter = (() => value);
3053
- getter['()'] = value;
3054
- getter[Symbol.toStringTag] = value;
3055
- getter[$mol_dev_format_head] = () => $mol_dev_format_span({}, '()=> ', $mol_dev_format_auto(value));
3056
- return getter;
3057
- }
3058
- $.$mol_const = $mol_const;
3059
- })($ || ($ = {}));
3060
-
3061
- ;
3062
- "use strict";
3063
- var $;
3064
- (function ($) {
3065
- function $mol_wire_async(obj) {
3066
- let fiber;
3067
- const temp = $mol_wire_task.getter(obj);
3068
- return new Proxy(obj, {
3069
- get(obj, field) {
3070
- const val = obj[field];
3071
- if (typeof val !== 'function')
3072
- return val;
3073
- let fiber;
3074
- const temp = $mol_wire_task.getter(val);
3075
- return function $mol_wire_async(...args) {
3076
- fiber?.destructor();
3077
- fiber = temp(obj, args);
3078
- return fiber.async();
3079
- };
3080
- },
3081
- apply(obj, self, args) {
3082
- fiber?.destructor();
3083
- fiber = temp(self, args);
3084
- return fiber.async();
3085
- },
3086
- });
3087
- }
3088
- $.$mol_wire_async = $mol_wire_async;
3089
- })($ || ($ = {}));
3090
-
3091
- ;
3092
- "use strict";
3093
- var $;
3094
- (function ($) {
3095
- class $mol_lock extends $mol_object {
3096
- promise = null;
3097
- async wait() {
3098
- let next = () => { };
3099
- let destructed = false;
3100
- const task = $mol_wire_auto();
3101
- if (!task)
3102
- return next;
3103
- const destructor = task.destructor.bind(task);
3104
- task.destructor = () => {
3105
- destructor();
3106
- destructed = true;
3107
- next();
3108
- };
3109
- let promise;
3110
- do {
3111
- promise = this.promise;
3112
- await promise;
3113
- if (destructed)
3114
- return next;
3115
- } while (promise !== this.promise);
3116
- this.promise = new Promise(done => { next = done; });
3117
- return next;
3118
- }
3119
- grab() { return $mol_wire_sync(this).wait(); }
3120
- }
3121
- $.$mol_lock = $mol_lock;
3122
- })($ || ($ = {}));
3123
-
3124
- ;
3125
- "use strict";
3126
- var $;
3127
- (function ($) {
3128
- function $mol_compare_array(a, b) {
3129
- if (a === b)
3130
- return true;
3131
- if (Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
3132
- return false;
3133
- if (a.length !== b.length)
3134
- return false;
3135
- for (let i = 0; i < a.length; i++)
3136
- if (a[i] !== b[i])
3137
- return false;
3138
- return true;
3139
- }
3140
- $.$mol_compare_array = $mol_compare_array;
3141
- })($ || ($ = {}));
3142
-
3143
- ;
3144
- "use strict";
3145
-
3146
- ;
3147
- "use strict";
3148
- var $;
3149
- (function ($) {
3150
- const decoders = {};
3151
- function $mol_charset_decode(buffer, encoding = 'utf8') {
3152
- let decoder = decoders[encoding];
3153
- if (!decoder)
3154
- decoder = decoders[encoding] = new TextDecoder(encoding);
3155
- return decoder.decode(buffer);
3156
- }
3157
- $.$mol_charset_decode = $mol_charset_decode;
3158
- })($ || ($ = {}));
3159
-
3160
- ;
3161
- "use strict";
3162
- var $;
3163
- (function ($) {
3164
- let buf = new Uint8Array(2 ** 12);
3165
- function $mol_charset_buffer(size) {
3166
- if (buf.byteLength < size)
3167
- buf = new Uint8Array(size);
3168
- return buf;
3169
- }
3170
- $.$mol_charset_buffer = $mol_charset_buffer;
3171
- })($ || ($ = {}));
3172
-
3173
- ;
3174
- "use strict";
3175
- var $;
3176
- (function ($) {
3177
- function $mol_charset_encode(str) {
3178
- const buf = $mol_charset_buffer(str.length * 3);
3179
- return buf.slice(0, $mol_charset_encode_to(str, buf));
3180
- }
3181
- $.$mol_charset_encode = $mol_charset_encode;
3182
- function $mol_charset_encode_to(str, buf, from = 0) {
3183
- let pos = from;
3184
- for (let i = 0; i < str.length; i++) {
3185
- let code = str.charCodeAt(i);
3186
- if (code < 0x80) {
3187
- buf[pos++] = code;
3188
- }
3189
- else if (code < 0x800) {
3190
- buf[pos++] = 0xc0 | (code >> 6);
3191
- buf[pos++] = 0x80 | (code & 0x3f);
3192
- }
3193
- else if (code < 0xd800 || code >= 0xe000) {
3194
- buf[pos++] = 0xe0 | (code >> 12);
3195
- buf[pos++] = 0x80 | ((code >> 6) & 0x3f);
3196
- buf[pos++] = 0x80 | (code & 0x3f);
3197
- }
3198
- else {
3199
- const point = ((code - 0xd800) << 10) + str.charCodeAt(++i) + 0x2400;
3200
- buf[pos++] = 0xf0 | (point >> 18);
3201
- buf[pos++] = 0x80 | ((point >> 12) & 0x3f);
3202
- buf[pos++] = 0x80 | ((point >> 6) & 0x3f);
3203
- buf[pos++] = 0x80 | (point & 0x3f);
3204
- }
3205
- }
3206
- return pos - from;
3207
- }
3208
- $.$mol_charset_encode_to = $mol_charset_encode_to;
3209
- function $mol_charset_encode_size(str) {
3210
- let size = 0;
3211
- for (let i = 0; i < str.length; i++) {
3212
- let code = str.charCodeAt(i);
3213
- if (code < 0x80)
3214
- size += 1;
3215
- else if (code < 0x800)
3216
- size += 2;
3217
- else if (code < 0xd800 || code >= 0xe000)
3218
- size += 3;
3219
- else
3220
- size += 4;
3221
- }
3222
- return size;
3223
- }
3224
- $.$mol_charset_encode_size = $mol_charset_encode_size;
3225
- })($ || ($ = {}));
3226
-
3227
- ;
3228
- "use strict";
3229
- var $;
3230
- (function ($) {
3231
- class $mol_file_transaction extends $mol_object {
3232
- path() { return ''; }
3233
- modes() { return []; }
3234
- write(options) {
3235
- throw new Error('Not implemented');
3236
- }
3237
- read() {
3238
- throw new Error('Not implemented');
3239
- }
3240
- truncate(size) {
3241
- throw new Error('Not implemented');
3242
- }
3243
- flush() {
3244
- throw new Error('Not implemented');
3245
- }
3246
- close() {
3247
- throw new Error('Not implemented');
3248
- }
3249
- destructor() {
3250
- this.close();
3251
- }
3252
- }
3253
- $.$mol_file_transaction = $mol_file_transaction;
3254
- })($ || ($ = {}));
3255
-
3256
- ;
3257
- "use strict";
3258
- var $;
3259
- (function ($) {
3260
- let file_modes;
3261
- (function (file_modes) {
3262
- file_modes[file_modes["create"] = $node.fs.constants.O_CREAT] = "create";
3263
- file_modes[file_modes["exists_truncate"] = $node.fs.constants.O_TRUNC] = "exists_truncate";
3264
- file_modes[file_modes["exists_fail"] = $node.fs.constants.O_EXCL] = "exists_fail";
3265
- file_modes[file_modes["read_only"] = $node.fs.constants.O_RDONLY] = "read_only";
3266
- file_modes[file_modes["write_only"] = $node.fs.constants.O_WRONLY] = "write_only";
3267
- file_modes[file_modes["read_write"] = $node.fs.constants.O_RDWR] = "read_write";
3268
- file_modes[file_modes["append"] = $node.fs.constants.O_APPEND] = "append";
3269
- })(file_modes || (file_modes = {}));
3270
- function mode_mask(modes) {
3271
- return modes.reduce((res, mode) => res | file_modes[mode], 0);
3272
- }
3273
- class $mol_file_transaction_node extends $mol_file_transaction {
3274
- descr() {
3275
- $mol_wire_solid();
3276
- return $node.fs.openSync(this.path(), mode_mask(this.modes()));
3277
- }
3278
- write({ buffer, offset = 0, length, position = null }) {
3279
- if (Array.isArray(buffer)) {
3280
- return $node.fs.writevSync(this.descr(), buffer, position ?? undefined);
3281
- }
3282
- if (typeof buffer === 'string') {
3283
- return $node.fs.writeSync(this.descr(), buffer, position);
3284
- }
3285
- length = length ?? buffer.byteLength;
3286
- return $node.fs.writeSync(this.descr(), buffer, offset, length, position);
3287
- }
3288
- truncate(size) {
3289
- $node.fs.ftruncateSync(this.descr());
3290
- }
3291
- read() {
3292
- return $mol_file_node_buffer_normalize($node.fs.readFileSync(this.descr()));
3293
- }
3294
- flush() {
3295
- $node.fs.fsyncSync(this.descr());
3296
- }
3297
- close() {
3298
- $node.fs.closeSync(this.descr());
3299
- }
3300
- }
3301
- __decorate([
3302
- $mol_mem
3303
- ], $mol_file_transaction_node.prototype, "descr", null);
3304
- $.$mol_file_transaction_node = $mol_file_transaction_node;
3305
- $.$mol_file_transaction = $mol_file_transaction_node;
3306
- })($ || ($ = {}));
3307
-
3308
- ;
3309
- "use strict";
3310
- var $;
3311
- (function ($) {
3312
- class $mol_file_base extends $mol_object {
3313
- static absolute(path) {
3314
- return this.make({
3315
- path: $mol_const(path)
3316
- });
3317
- }
3318
- static relative(path) {
3319
- throw new Error('Not implemented yet');
3320
- }
3321
- static base = '';
3322
- path() {
3323
- return '.';
3324
- }
3325
- parent() {
3326
- return this.resolve('..');
3327
- }
3328
- exists_cut() { return this.exists(); }
3329
- root() {
3330
- const path = this.path();
3331
- const base = this.constructor.base;
3332
- return base.startsWith(path) || this == this.parent();
3333
- }
3334
- stat(next, virt) {
3335
- const path = this.path();
3336
- const parent = this.parent();
3337
- if (!this.root()) {
3338
- parent.version();
3339
- }
3340
- parent.watcher();
3341
- if (virt)
3342
- return next ?? null;
3343
- return next ?? this.info(path);
3344
- }
3345
- static changed = new Set;
3346
- static frame = null;
3347
- static changed_add(type, path) {
3348
- if (/([\/\\]\.|___$)/.test(path))
3349
- return;
3350
- const file = this.relative(path.at(-1) === '/' ? path.slice(0, -1) : path);
3351
- this.changed.add(file);
3352
- if (!this.watching)
3353
- return;
3354
- this.frame?.destructor();
3355
- this.frame = new this.$.$mol_after_timeout(this.watch_debounce(), () => {
3356
- if (!this.watching)
3357
- return;
3358
- this.watching = false;
3359
- $mol_wire_async(this).flush();
3360
- });
3361
- }
3362
- static watch_debounce() { return 500; }
3363
- static flush() {
3364
- for (const file of this.changed) {
3365
- const parent = file.parent();
3366
- try {
3367
- if ($mol_wire_probe(() => parent.sub()))
3368
- parent.sub(null);
3369
- file.reset();
3370
- }
3371
- catch (error) {
3372
- if ($mol_fail_catch(error))
3373
- $mol_fail_log(error);
3374
- }
3375
- }
3376
- this.changed.clear();
3377
- this.watching = true;
3378
- }
3379
- static watching = true;
3380
- static lock = new $mol_lock;
3381
- static watch_off(path) {
3382
- this.watching = false;
3383
- this.flush();
3384
- this.watching = false;
3385
- this.changed.add(this.absolute(path));
3386
- }
3387
- static unwatched(side_effect, affected_dir) {
3388
- const unlock = this.lock.grab();
3389
- this.watch_off(affected_dir);
3390
- try {
3391
- const result = side_effect();
3392
- this.flush();
3393
- unlock();
3394
- return result;
3395
- }
3396
- catch (e) {
3397
- if (!$mol_promise_like(e)) {
3398
- this.flush();
3399
- unlock();
3400
- }
3401
- $mol_fail_hidden(e);
3402
- }
3403
- }
3404
- reset() {
3405
- this.stat(null);
3406
- }
3407
- modified() { return this.stat()?.mtime ?? null; }
3408
- version() {
3409
- const next = this.stat()?.mtime.getTime().toString(36).toUpperCase() ?? '';
3410
- return next;
3411
- }
3412
- info(path) { return null; }
3413
- ensure() { }
3414
- drop() { }
3415
- copy(to) { }
3416
- read() { return new Uint8Array; }
3417
- write(buffer) { }
3418
- kids() {
3419
- return [];
3420
- }
3421
- readable(opts) {
3422
- return new ReadableStream;
3423
- }
3424
- writable(opts) {
3425
- return new WritableStream;
3426
- }
3427
- buffer(next) {
3428
- let readed = new Uint8Array();
3429
- if (next === undefined) {
3430
- if (this.version())
3431
- readed = this.read();
3432
- }
3433
- const prev = $mol_mem_cached(() => this.buffer());
3434
- const changed = prev === undefined || !$mol_compare_array(prev, next ?? readed);
3435
- if (prev !== undefined && changed) {
3436
- this.$.$mol_log3_rise({
3437
- place: `$mol_file_node.buffer()`,
3438
- message: 'Changed',
3439
- path: this.relate(),
3440
- });
3441
- }
3442
- if (next === undefined)
3443
- return changed ? readed : prev;
3444
- if (!changed && this.exists())
3445
- return prev;
3446
- this.parent().exists(true);
3447
- this.stat(this.stat_make(next.length), 'virt');
3448
- this.write(next);
3449
- return next;
3450
- }
3451
- stat_make(size) {
3452
- const now = new Date();
3453
- return {
3454
- type: 'file',
3455
- size,
3456
- atime: now,
3457
- mtime: now,
3458
- ctime: now,
3459
- };
3460
- }
3461
- clone(to) {
3462
- if (!this.exists())
3463
- return null;
3464
- const target = this.constructor.absolute(to);
3465
- try {
3466
- this.version();
3467
- target.parent().exists(true);
3468
- this.copy(to);
3469
- target.reset();
3470
- return target;
3471
- }
3472
- catch (error) {
3473
- if ($mol_fail_catch(error)) {
3474
- console.error(error);
3475
- }
3476
- }
3477
- return null;
3478
- }
3479
- watcher() {
3480
- return {
3481
- destructor() { }
3482
- };
3483
- }
3484
- exists(next) {
3485
- const exists = Boolean(this.stat());
3486
- if (next === undefined)
3487
- return exists;
3488
- if (next === exists)
3489
- return exists;
3490
- if (next) {
3491
- this.parent().exists(true);
3492
- this.ensure();
3493
- }
3494
- else {
3495
- this.drop();
3496
- }
3497
- this.reset();
3498
- return next;
3499
- }
3500
- type() {
3501
- return this.stat()?.type ?? '';
3502
- }
3503
- name() {
3504
- return this.path().replace(/^.*\//, '');
3505
- }
3506
- ext() {
3507
- const match = /((?:\.\w+)+)$/.exec(this.path());
3508
- return match ? match[1].substring(1) : '';
3509
- }
3510
- text(next, virt) {
3511
- if (next !== undefined)
3512
- this.exists();
3513
- return this.text_int(next, virt);
3514
- }
3515
- text_int(next, virt) {
3516
- if (virt) {
3517
- this.stat(this.stat_make(0), 'virt');
3518
- return next;
3519
- }
3520
- if (next === undefined) {
3521
- return $mol_charset_decode(this.buffer());
3522
- }
3523
- else {
3524
- const buffer = $mol_charset_encode(next);
3525
- this.buffer(buffer);
3526
- return next;
3527
- }
3528
- }
3529
- sub(reset) {
3530
- if (!this.exists())
3531
- return [];
3532
- if (this.type() !== 'dir')
3533
- return [];
3534
- this.version();
3535
- return this.kids().filter(file => file.exists());
3536
- }
3537
- resolve(path) {
3538
- throw new Error('implement');
3539
- }
3540
- relate(base = this.constructor.relative('.')) {
3541
- const base_path = base.path();
3542
- const path = this.path();
3543
- return path.startsWith(base_path) ? path.slice(base_path.length) : path;
3544
- }
3545
- find(include, exclude) {
3546
- const found = [];
3547
- const sub = this.sub();
3548
- for (const child of sub) {
3549
- const child_path = child.path();
3550
- if (exclude && child_path.match(exclude))
3551
- continue;
3552
- if (!include || child_path.match(include))
3553
- found.push(child);
3554
- if (child.type() === 'dir') {
3555
- const sub_child = child.find(include, exclude);
3556
- for (const child of sub_child)
3557
- found.push(child);
3558
- }
3559
- }
3560
- return found;
3561
- }
3562
- size() {
3563
- switch (this.type()) {
3564
- case 'file': return this.stat()?.size ?? 0;
3565
- default: return 0;
3566
- }
3567
- }
3568
- toJSON() {
3569
- return this.path();
3570
- }
3571
- open(...modes) {
3572
- return this.$.$mol_file_transaction.make({
3573
- path: () => this.path(),
3574
- modes: () => modes
3575
- });
3576
- }
3577
- }
3578
- __decorate([
3579
- $mol_action
3580
- ], $mol_file_base.prototype, "exists_cut", null);
3581
- __decorate([
3582
- $mol_mem
3583
- ], $mol_file_base.prototype, "stat", null);
3584
- __decorate([
3585
- $mol_mem
3586
- ], $mol_file_base.prototype, "modified", null);
3587
- __decorate([
3588
- $mol_mem
3589
- ], $mol_file_base.prototype, "version", null);
3590
- __decorate([
3591
- $mol_mem_key
3592
- ], $mol_file_base.prototype, "readable", null);
3593
- __decorate([
3594
- $mol_mem_key
3595
- ], $mol_file_base.prototype, "writable", null);
3596
- __decorate([
3597
- $mol_mem
3598
- ], $mol_file_base.prototype, "buffer", null);
3599
- __decorate([
3600
- $mol_action
3601
- ], $mol_file_base.prototype, "stat_make", null);
3602
- __decorate([
3603
- $mol_mem_key
3604
- ], $mol_file_base.prototype, "clone", null);
3605
- __decorate([
3606
- $mol_mem
3607
- ], $mol_file_base.prototype, "exists", null);
3608
- __decorate([
3609
- $mol_mem
3610
- ], $mol_file_base.prototype, "type", null);
3611
- __decorate([
3612
- $mol_mem
3613
- ], $mol_file_base.prototype, "text_int", null);
3614
- __decorate([
3615
- $mol_mem
3616
- ], $mol_file_base.prototype, "sub", null);
3617
- __decorate([
3618
- $mol_mem
3619
- ], $mol_file_base.prototype, "size", null);
3620
- __decorate([
3621
- $mol_action
3622
- ], $mol_file_base.prototype, "open", null);
3623
- __decorate([
3624
- $mol_mem_key
3625
- ], $mol_file_base, "absolute", null);
3626
- __decorate([
3627
- $mol_action
3628
- ], $mol_file_base, "flush", null);
3629
- __decorate([
3630
- $mol_action
3631
- ], $mol_file_base, "watch_off", null);
3632
- $.$mol_file_base = $mol_file_base;
3633
- })($ || ($ = {}));
3634
-
3635
- ;
3636
- "use strict";
3637
- var $;
3638
- (function ($) {
3639
- class $mol_file extends $mol_file_base {
3640
- }
3641
- $.$mol_file = $mol_file;
3642
- })($ || ($ = {}));
3643
-
3644
- ;
3645
- "use strict";
3646
- var $;
3647
- (function ($) {
3648
- function stat_convert(stat) {
3649
- if (!stat)
3650
- return null;
3651
- let type;
3652
- if (stat.isDirectory())
3653
- type = 'dir';
3654
- if (stat.isFile())
3655
- type = 'file';
3656
- if (stat.isSymbolicLink())
3657
- type = 'link';
3658
- if (!type)
3659
- return $mol_fail(new Error(`Unsupported file type`));
3660
- return {
3661
- type,
3662
- size: Number(stat.size),
3663
- atime: stat.atime,
3664
- mtime: stat.mtime,
3665
- ctime: stat.ctime
3666
- };
3667
- }
3668
- function $mol_file_node_buffer_normalize(buf) {
3669
- return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
3670
- }
3671
- $.$mol_file_node_buffer_normalize = $mol_file_node_buffer_normalize;
3672
- class $mol_file_node extends $mol_file {
3673
- static relative(path) {
3674
- return this.absolute($node.path.resolve(this.base, path).replace(/\\/g, '/'));
3675
- }
3676
- watcher(reset) {
3677
- const path = this.path();
3678
- const root = this.root();
3679
- if (!root && !this.exists())
3680
- return super.watcher();
3681
- let watcher;
3682
- try {
3683
- watcher = $node.fs.watch(path);
3684
- }
3685
- catch (error) {
3686
- if (!(error instanceof Error))
3687
- error = new Error('Unknown watch error', { cause: error });
3688
- error.message += '\n' + path;
3689
- if (root || error.code !== 'ENOENT') {
3690
- this.$.$mol_fail_log(error);
3691
- }
3692
- return super.watcher();
3693
- }
3694
- watcher.on('change', (type, name) => {
3695
- if (!name)
3696
- return;
3697
- const path = $node.path.join(this.path(), name.toString());
3698
- this.constructor.changed_add(type, path);
3699
- });
3700
- watcher.on('error', e => this.$.$mol_fail_log(e));
3701
- let destructed = false;
3702
- watcher.on('close', () => {
3703
- if (!destructed)
3704
- setTimeout(() => $mol_wire_async(this).watcher(null), 500);
3705
- });
3706
- return {
3707
- destructor() {
3708
- destructed = true;
3709
- watcher.close();
3710
- }
3711
- };
3712
- }
3713
- info(path) {
3714
- try {
3715
- return stat_convert($node.fs.statSync(path));
3716
- }
3717
- catch (error) {
3718
- if (this.$.$mol_fail_catch(error)) {
3719
- if (error.code === 'ENOENT')
3720
- return null;
3721
- if (error.code === 'EPERM')
3722
- return null;
3723
- error.message += '\n' + path;
3724
- this.$.$mol_fail_hidden(error);
3725
- }
3726
- }
3727
- return null;
3728
- }
3729
- ensure() {
3730
- const path = this.path();
3731
- try {
3732
- $node.fs.mkdirSync(path, { recursive: true });
3733
- return null;
3734
- }
3735
- catch (e) {
3736
- if (this.$.$mol_fail_catch(e)) {
3737
- if (e.code === 'EEXIST')
3738
- return null;
3739
- e.message += '\n' + path;
3740
- this.$.$mol_fail_hidden(e);
3741
- }
3742
- }
3743
- }
3744
- copy(to) {
3745
- $node.fs.copyFileSync(this.path(), to);
3746
- }
3747
- drop() {
3748
- $node.fs.unlinkSync(this.path());
3749
- }
3750
- read() {
3751
- const path = this.path();
3752
- try {
3753
- return $mol_file_node_buffer_normalize($node.fs.readFileSync(path));
3754
- }
3755
- catch (error) {
3756
- if (!$mol_promise_like(error)) {
3757
- error.message += '\n' + path;
3758
- }
3759
- $mol_fail_hidden(error);
3760
- }
3761
- }
3762
- write(buffer) {
3763
- const path = this.path();
3764
- try {
3765
- $node.fs.writeFileSync(path, buffer);
3766
- }
3767
- catch (error) {
3768
- if (this.$.$mol_fail_catch(error)) {
3769
- error.message += '\n' + path;
3770
- }
3771
- return this.$.$mol_fail_hidden(error);
3772
- }
3773
- }
3774
- kids() {
3775
- const path = this.path();
3776
- try {
3777
- const kids = $node.fs.readdirSync(path)
3778
- .filter(name => !/^\.+$/.test(name))
3779
- .map(name => this.resolve(name));
3780
- return kids;
3781
- }
3782
- catch (e) {
3783
- if (this.$.$mol_fail_catch(e)) {
3784
- if (e.code === 'ENOENT')
3785
- return [];
3786
- e.message += '\n' + path;
3787
- }
3788
- $mol_fail_hidden(e);
3789
- }
3790
- }
3791
- resolve(path) {
3792
- return this.constructor
3793
- .relative($node.path.join(this.path(), path));
3794
- }
3795
- relate(base = this.constructor.relative('.')) {
3796
- return $node.path.relative(base.path(), this.path()).replace(/\\/g, '/');
3797
- }
3798
- readable(opts) {
3799
- const { Readable } = $node['node:stream'];
3800
- const stream = $node.fs.createReadStream(this.path(), {
3801
- flags: 'r',
3802
- autoClose: true,
3803
- start: opts?.start,
3804
- end: opts?.end,
3805
- encoding: 'binary',
3806
- });
3807
- return Readable.toWeb(stream);
3808
- }
3809
- writable(opts) {
3810
- const { Writable } = $node['node:stream'];
3811
- const stream = $node.fs.createWriteStream(this.path(), {
3812
- flags: 'w+',
3813
- autoClose: true,
3814
- start: opts?.start,
3815
- encoding: 'binary',
3816
- });
3817
- return Writable.toWeb(stream);
3818
- }
3819
- }
3820
- __decorate([
3821
- $mol_mem
3822
- ], $mol_file_node.prototype, "watcher", null);
3823
- __decorate([
3824
- $mol_action
3825
- ], $mol_file_node.prototype, "info", null);
3826
- __decorate([
3827
- $mol_action
3828
- ], $mol_file_node.prototype, "ensure", null);
3829
- __decorate([
3830
- $mol_action
3831
- ], $mol_file_node.prototype, "copy", null);
3832
- __decorate([
3833
- $mol_action
3834
- ], $mol_file_node.prototype, "drop", null);
3835
- __decorate([
3836
- $mol_action
3837
- ], $mol_file_node.prototype, "read", null);
3838
- __decorate([
3839
- $mol_action
3840
- ], $mol_file_node.prototype, "write", null);
3841
- __decorate([
3842
- $mol_mem_key
3843
- ], $mol_file_node.prototype, "readable", null);
3844
- __decorate([
3845
- $mol_mem
3846
- ], $mol_file_node.prototype, "writable", null);
3847
- $.$mol_file_node = $mol_file_node;
3848
- $.$mol_file = $mol_file_node;
3849
- })($ || ($ = {}));
3850
-
3851
- ;
3852
- "use strict";
3853
- var $;
3854
- (function ($) {
3855
- class $mol_state_local_node extends $mol_state_local {
3856
- static dir() {
3857
- const base = process.env.XDG_DATA_HOME || ($node.os.homedir() + '/.local/share');
3858
- return $mol_file.absolute(base).resolve('./mol_state_local');
3859
- }
3860
- static value(key, next) {
3861
- const file = this.dir().resolve(encodeURIComponent(key) + '.json');
3862
- if (next === null) {
3863
- file.exists(false);
3864
- return null;
3865
- }
3866
- const arg = next === undefined ? undefined : JSON.stringify(next);
3867
- return JSON.parse(file.text(arg) || 'null');
3868
- }
3869
- }
3870
- __decorate([
3871
- $mol_mem
3872
- ], $mol_state_local_node, "dir", null);
3873
- __decorate([
3874
- $mol_mem_key
3875
- ], $mol_state_local_node, "value", null);
3876
- $.$mol_state_local_node = $mol_state_local_node;
3877
- $.$mol_state_local = $mol_state_local_node;
3878
- })($ || ($ = {}));
3879
-
3880
- ;
3881
- "use strict";
3882
- var $;
3883
- (function ($) {
3884
- function parse(theme) {
3885
- if (theme === 'true')
3886
- return true;
3887
- if (theme === 'false')
3888
- return false;
3889
- return null;
3890
- }
3891
- function $mol_lights(next) {
3892
- const arg = parse(this.$mol_state_arg.value('mol_lights'));
3893
- const base = this.$mol_media.match('(prefers-color-scheme: light)');
3894
- if (next === undefined) {
3895
- return arg ?? this.$mol_state_local.value('$mol_lights') ?? base;
3896
- }
3897
- else {
3898
- if (arg === null) {
3899
- this.$mol_state_local.value('$mol_lights', next === base ? null : next);
3900
- }
3901
- else {
3902
- this.$mol_state_arg.value('mol_lights', String(next));
3903
- }
3904
- return next;
3905
- }
3906
- }
3907
- $.$mol_lights = $mol_lights;
3908
- })($ || ($ = {}));
3909
-
3910
- ;
3911
- "use strict";
3912
- var $;
3913
- (function ($) {
3914
- $.$mol_theme = $mol_style_prop('mol_theme', [
3915
- 'back',
3916
- 'hover',
3917
- 'card',
3918
- 'current',
3919
- 'special',
3920
- 'text',
3921
- 'control',
3922
- 'shade',
3923
- 'line',
3924
- 'focus',
3925
- 'field',
3926
- 'image',
3927
- 'spirit',
3928
- ]);
3929
- })($ || ($ = {}));
3930
-
3931
- ;
3932
- "use strict";
3933
- var $;
3934
- (function ($) {
3935
- $mol_style_attach("mol/theme/theme.css", ":root {\n\t--mol_theme_hue: 240deg;\n\t--mol_theme_hue_spread: 90deg;\n\tcolor-scheme: dark light;\n}\n\n:where([mol_theme]) {\n\tcolor: var(--mol_theme_text);\n\tfill: var(--mol_theme_text);\n\tbackground-color: var(--mol_theme_back);\n}\n\t\n:root, [mol_theme=\"$mol_theme_dark\"], :where([mol_theme=\"$mol_theme_dark\"]) [mol_theme] {\n\n\t--mol_theme_luma: -1;\n\t--mol_theme_image: invert(1) hue-rotate( 180deg );\n\t--mol_theme_spirit: hsl( 0deg, 0%, 0%, .75 );\n\n\t--mol_theme_back: hsl( var(--mol_theme_hue), 20%, 10% );\n\t--mol_theme_card: hsl( var(--mol_theme_hue), 50%, 20%, .25 );\n\t--mol_theme_field: hsl( var(--mol_theme_hue), 50%, 8%, .25 );\n\t--mol_theme_hover: hsl( var(--mol_theme_hue), 0%, 50%, .1 );\n\t\n\t--mol_theme_text: hsl( var(--mol_theme_hue), 0%, 80% );\n\t--mol_theme_shade: hsl( var(--mol_theme_hue), 0%, 60%, 1 );\n\t--mol_theme_line: hsl( var(--mol_theme_hue), 0%, 50%, .25 );\n\t--mol_theme_focus: hsl( calc( var(--mol_theme_hue) + 180deg ), 100%, 65% );\n\t\n\t--mol_theme_control: hsl( var(--mol_theme_hue), 60%, 65% );\n\t--mol_theme_current: hsl( calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ), 60%, 65% );\n\t--mol_theme_special: hsl( calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ), 60%, 65% );\n\n} @supports( color: oklch( 0% 0 0deg ) ) {\n:root, [mol_theme=\"$mol_theme_dark\"], :where([mol_theme=\"$mol_theme_dark\"]) [mol_theme] {\n\t\n\t--mol_theme_back: oklch( 20% .03 var(--mol_theme_hue) );\n\t--mol_theme_card: oklch( 30% .05 var(--mol_theme_hue) / .25 );\n\t--mol_theme_field: oklch( 15% 0 var(--mol_theme_hue) / .25 );\n\t--mol_theme_hover: oklch( 70% 0 var(--mol_theme_hue) / .1 );\n\t\n\t--mol_theme_text: oklch( 80% 0 var(--mol_theme_hue) );\n\t--mol_theme_shade: oklch( 60% 0 var(--mol_theme_hue) );\n\t--mol_theme_line: oklch( 60% 0 var(--mol_theme_hue) / .25 );\n\t--mol_theme_focus: oklch( 80% .2 calc( var(--mol_theme_hue) + 180deg ) );\n\t\n\t--mol_theme_control: oklch( 70% .1 var(--mol_theme_hue) );\n\t--mol_theme_current: oklch( 70% .2 calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ) );\n\t--mol_theme_special: oklch( 70% .2 calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ) );\n\n} }\n\n[mol_theme=\"$mol_theme_light\"], :where([mol_theme=\"$mol_theme_light\"]) [mol_theme] {\n\t\n\t--mol_theme_luma: 1;\n\t--mol_theme_image: none;\n\t--mol_theme_spirit: hsl( 0deg, 0%, 100%, .75 );\n\t\n\t--mol_theme_back: hsl( var(--mol_theme_hue), 20%, 92% );\n\t--mol_theme_card: hsl( var(--mol_theme_hue), 50%, 100%, .5 );\n\t--mol_theme_field: hsl( var(--mol_theme_hue), 50%, 100%, .75 );\n\t--mol_theme_hover: hsl( var(--mol_theme_hue), 0%, 50%, .1 );\n\t\n\t--mol_theme_text: hsl( var(--mol_theme_hue), 0%, 0% );\n\t--mol_theme_shade: hsl( var(--mol_theme_hue), 0%, 40%, 1 );\n\t--mol_theme_line: hsl( var(--mol_theme_hue), 0%, 50%, .25 );\n\t--mol_theme_focus: hsl( calc( var(--mol_theme_hue) + 180deg ), 100%, 40% );\n\t\n\t--mol_theme_control: hsl( var(--mol_theme_hue), 80%, 30% );\n\t--mol_theme_current: hsl( calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ), 80%, 30% );\n\t--mol_theme_special: hsl( calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ), 80%, 30% );\n\n} @supports( color: oklch( 0% 0 0deg ) ) {\n[mol_theme=\"$mol_theme_light\"], :where([mol_theme=\"$mol_theme_light\"]) [mol_theme] {\n\t--mol_theme_back: oklch( 92% .01 var(--mol_theme_hue) );\n\t--mol_theme_card: oklch( 99% .01 var(--mol_theme_hue) / .5 );\n\t--mol_theme_field: oklch( 100% 0 var(--mol_theme_hue) / .5 );\n\t--mol_theme_hover: oklch( 50% 0 var(--mol_theme_hue) / .1 );\n\t\n\t--mol_theme_text: oklch( 20% 0 var(--mol_theme_hue) );\n\t--mol_theme_shade: oklch( 60% 0 var(--mol_theme_hue) );\n\t--mol_theme_line: oklch( 50% 0 var(--mol_theme_hue) / .25 );\n\t--mol_theme_focus: oklch( 60% .2 calc( var(--mol_theme_hue) + 180deg ) );\n\t\n\t--mol_theme_control: oklch( 40% .15 var(--mol_theme_hue) );\n\t--mol_theme_current: oklch( 50% .2 calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ) );\n\t--mol_theme_special: oklch( 50% .2 calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ) );\n\n} }\n\n:where( :root, [mol_theme=\"$mol_theme_dark\"] ) [mol_theme=\"$mol_theme_base\"] {\n\t--mol_theme_back: oklch( 25% .075 var(--mol_theme_hue) );\n\t--mol_theme_card: oklch( 35% .1 var(--mol_theme_hue) / .25 );\n}\n:where( [mol_theme=\"$mol_theme_light\"] ) [mol_theme=\"$mol_theme_base\"] {\n\t--mol_theme_back: oklch( 85% .075 var(--mol_theme_hue) );\n\t--mol_theme_card: oklch( 98% .03 var(--mol_theme_hue) / .25 );\n}\n\n:where( :root, [mol_theme=\"$mol_theme_dark\"] ) [mol_theme=\"$mol_theme_current\"] {\n\t--mol_theme_back: oklch( 25% .05 calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ) );\n\t--mol_theme_card: oklch( 35% .1 calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ) / .25 );\n}\n:where( [mol_theme=\"$mol_theme_light\"] ) [mol_theme=\"$mol_theme_current\"] {\n\t--mol_theme_back: oklch( 85% .05 calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ) );\n\t--mol_theme_card: oklch( 98% .03 calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ) / .25 );\n}\n\n:where( :root, [mol_theme=\"$mol_theme_dark\"] ) [mol_theme=\"$mol_theme_special\"] {\n\t--mol_theme_back: oklch( 25% .05 calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ) );\n\t--mol_theme_card: oklch( 35% .1 calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ) / .25 );\n}\n:where( [mol_theme=\"$mol_theme_light\"] ) [mol_theme=\"$mol_theme_special\"] {\n\t--mol_theme_back: oklch( 85% .05 calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ) );\n\t--mol_theme_card: oklch( 98% .03 calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ) / .25 );\n}\n\n:where( :root, [mol_theme=\"$mol_theme_dark\"] ) [mol_theme=\"$mol_theme_accent\"] {\n\t--mol_theme_back: oklch( 35% .1 calc( var(--mol_theme_hue) + 180deg ) );\n\t--mol_theme_card: oklch( 45% .15 calc( var(--mol_theme_hue) + 180deg ) / .25 );\n}\n:where( [mol_theme=\"$mol_theme_light\"] ) [mol_theme=\"$mol_theme_accent\"] {\n\t--mol_theme_back: oklch( 83% .1 calc( var(--mol_theme_hue) + 180deg ) );\n\t--mol_theme_card: oklch( 98% .03 calc( var(--mol_theme_hue) + 180deg ) / .25 );\n}\n\n");
3936
- })($ || ($ = {}));
3937
-
3938
- ;
3939
- "use strict";
3940
- var $;
3941
- (function ($) {
3942
- $mol_style_attach('$mol_theme_lights', `:root { --mol_theme_back: oklch( ${$$.$mol_lights() ? 92 : 20}% .01 var(--mol_theme_hue) ) }`);
3943
- })($ || ($ = {}));
3944
-
3945
- ;
3946
- "use strict";
3947
- var $;
3948
- (function ($) {
3949
- $.$mol_gap = $mol_style_prop('mol_gap', [
3950
- 'page',
3951
- 'block',
3952
- 'text',
3953
- 'emoji',
3954
- 'round',
3955
- 'space',
3956
- 'blur',
3957
- ]);
3958
- })($ || ($ = {}));
3959
-
3960
- ;
3961
- "use strict";
3962
- var $;
3963
- (function ($) {
3964
- $mol_style_attach("mol/gap/gap.css", ":root {\n\t--mol_gap_page: 3rem;\n\t--mol_gap_block: .75rem;\n\t--mol_gap_text: .5rem .75rem;\n\t--mol_gap_emoji: .5rem;\n\t--mol_gap_round: .25rem;\n\t--mol_gap_space: .25rem;\n\t--mol_gap_blur: .5rem;\n}\n");
3965
- })($ || ($ = {}));
3966
-
3967
- ;
3968
- "use strict";
3969
- var $;
3970
- (function ($) {
3971
- function $mol_dom_render_children(el, childNodes) {
3972
- const node_set = new Set(childNodes);
3973
- let nextNode = el.firstChild;
3974
- for (let view of childNodes) {
3975
- if (view == null)
3976
- continue;
3977
- if (view instanceof $mol_dom_context.Node) {
3978
- while (true) {
3979
- if (!nextNode) {
3980
- el.appendChild(view);
3981
- break;
3982
- }
3983
- if (nextNode == view) {
3984
- nextNode = nextNode.nextSibling;
3985
- break;
3986
- }
3987
- else {
3988
- if (node_set.has(nextNode)) {
3989
- el.insertBefore(view, nextNode);
3990
- break;
3991
- }
3992
- else {
3993
- const nn = nextNode.nextSibling;
3994
- el.removeChild(nextNode);
3995
- nextNode = nn;
3996
- }
3997
- }
3998
- }
3999
- }
4000
- else {
4001
- if (nextNode && nextNode.nodeName === '#text') {
4002
- const str = String(view);
4003
- if (nextNode.nodeValue !== str)
4004
- nextNode.nodeValue = str;
4005
- nextNode = nextNode.nextSibling;
4006
- }
4007
- else {
4008
- const textNode = $mol_dom_context.document.createTextNode(String(view));
4009
- el.insertBefore(textNode, nextNode);
2932
+ else {
2933
+ return atom.sync();
2934
+ }
4010
2935
  }
2936
+ return atom.resync(args);
4011
2937
  }
4012
- }
4013
- while (nextNode) {
4014
- const currNode = nextNode;
4015
- nextNode = currNode.nextSibling;
4016
- el.removeChild(currNode);
4017
- }
2938
+ };
2939
+ Reflect.defineProperty(descr2.value, 'name', { value: orig.name + ' ' });
2940
+ Reflect.defineProperty(descr2.value, 'length', { value: orig.length });
2941
+ Object.assign(descr2.value, { orig });
2942
+ Reflect.defineProperty(host, field, descr2);
2943
+ return descr2;
4018
2944
  }
4019
- $.$mol_dom_render_children = $mol_dom_render_children;
2945
+ $.$mol_wire_solo = $mol_wire_solo;
4020
2946
  })($ || ($ = {}));
4021
2947
 
4022
- ;
4023
- "use strict";
4024
-
4025
2948
  ;
4026
2949
  "use strict";
4027
2950
  var $;
4028
2951
  (function ($) {
4029
- $.$mol_jsx_prefix = '';
4030
- $.$mol_jsx_crumbs = '';
4031
- $.$mol_jsx_booked = null;
4032
- $.$mol_jsx_document = {
4033
- getElementById: () => null,
4034
- createElementNS: (space, name) => $mol_dom_context.document.createElementNS(space, name),
4035
- createDocumentFragment: () => $mol_dom_context.document.createDocumentFragment(),
4036
- };
4037
- $.$mol_jsx_frag = '';
4038
- function $mol_jsx(Elem, props, ...childNodes) {
4039
- const id = props && props.id || '';
4040
- const guid = id ? $.$mol_jsx_prefix ? $.$mol_jsx_prefix + '/' + id : id : $.$mol_jsx_prefix;
4041
- const crumbs_self = id ? $.$mol_jsx_crumbs.replace(/(\S+)/g, `$1_${id.replace(/\/.*/i, '')}`) : $.$mol_jsx_crumbs;
4042
- if (Elem && $.$mol_jsx_booked) {
4043
- if ($.$mol_jsx_booked.has(id)) {
4044
- $mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(guid)}`));
4045
- }
4046
- else {
4047
- $.$mol_jsx_booked.add(id);
4048
- }
2952
+ function $mol_wire_plex(host, field, descr) {
2953
+ if (!descr)
2954
+ descr = Reflect.getOwnPropertyDescriptor(host, field);
2955
+ const orig = descr?.value ?? host[field];
2956
+ const sup = Reflect.getPrototypeOf(host);
2957
+ if (typeof sup[field] === 'function') {
2958
+ Object.defineProperty(orig, 'name', { value: sup[field].name });
4049
2959
  }
4050
- let node = guid ? $.$mol_jsx_document.getElementById(guid) : null;
4051
- if ($.$mol_jsx_prefix) {
4052
- const prefix_ext = $.$mol_jsx_prefix;
4053
- const booked_ext = $.$mol_jsx_booked;
4054
- const crumbs_ext = $.$mol_jsx_crumbs;
4055
- for (const field in props) {
4056
- const func = props[field];
4057
- if (typeof func !== 'function')
4058
- continue;
4059
- const wrapper = function (...args) {
4060
- const prefix = $.$mol_jsx_prefix;
4061
- const booked = $.$mol_jsx_booked;
4062
- const crumbs = $.$mol_jsx_crumbs;
4063
- try {
4064
- $.$mol_jsx_prefix = prefix_ext;
4065
- $.$mol_jsx_booked = booked_ext;
4066
- $.$mol_jsx_crumbs = crumbs_ext;
4067
- return func.call(this, ...args);
2960
+ const descr2 = {
2961
+ ...descr,
2962
+ value: function (...args) {
2963
+ let atom = $mol_wire_atom.plex(this, orig, args[0]);
2964
+ if ((args.length === 1) || (args[1] === undefined)) {
2965
+ if (!$mol_wire_fiber.warm)
2966
+ return atom.result();
2967
+ if ($mol_wire_auto()?.temp) {
2968
+ return atom.once();
4068
2969
  }
4069
- finally {
4070
- $.$mol_jsx_prefix = prefix;
4071
- $.$mol_jsx_booked = booked;
4072
- $.$mol_jsx_crumbs = crumbs;
2970
+ else {
2971
+ return atom.sync();
4073
2972
  }
4074
- };
4075
- $mol_func_name_from(wrapper, func);
4076
- props[field] = wrapper;
4077
- }
4078
- }
4079
- if (typeof Elem !== 'string') {
4080
- if ('prototype' in Elem) {
4081
- const view = node && node[String(Elem)] || new Elem;
4082
- Object.assign(view, props);
4083
- view[Symbol.toStringTag] = guid;
4084
- view.childNodes = childNodes;
4085
- if (!view.ownerDocument)
4086
- view.ownerDocument = $.$mol_jsx_document;
4087
- view.className = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
4088
- node = view.valueOf();
4089
- node[String(Elem)] = view;
4090
- return node;
4091
- }
4092
- else {
4093
- const prefix = $.$mol_jsx_prefix;
4094
- const booked = $.$mol_jsx_booked;
4095
- const crumbs = $.$mol_jsx_crumbs;
4096
- try {
4097
- $.$mol_jsx_prefix = guid;
4098
- $.$mol_jsx_booked = new Set;
4099
- $.$mol_jsx_crumbs = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
4100
- return Elem(props, ...childNodes);
4101
- }
4102
- finally {
4103
- $.$mol_jsx_prefix = prefix;
4104
- $.$mol_jsx_booked = booked;
4105
- $.$mol_jsx_crumbs = crumbs;
4106
- }
4107
- }
4108
- }
4109
- if (!node) {
4110
- node = Elem
4111
- ? $.$mol_jsx_document.createElementNS(props?.xmlns ?? 'http://www.w3.org/1999/xhtml', Elem)
4112
- : $.$mol_jsx_document.createDocumentFragment();
4113
- }
4114
- $mol_dom_render_children(node, [].concat(...childNodes));
4115
- if (!Elem)
4116
- return node;
4117
- if (guid)
4118
- node.id = guid;
4119
- for (const key in props) {
4120
- if (key === 'id')
4121
- continue;
4122
- if (typeof props[key] === 'string') {
4123
- if (typeof node[key] === 'string')
4124
- node[key] = props[key];
4125
- node.setAttribute(key, props[key]);
4126
- }
4127
- else if (props[key] &&
4128
- typeof props[key] === 'object' &&
4129
- Reflect.getPrototypeOf(props[key]) === Reflect.getPrototypeOf({})) {
4130
- if (typeof node[key] === 'object') {
4131
- Object.assign(node[key], props[key]);
4132
- continue;
4133
2973
  }
2974
+ return atom.resync(args);
4134
2975
  }
4135
- else {
4136
- node[key] = props[key];
4137
- }
4138
- }
4139
- if ($.$mol_jsx_crumbs)
4140
- node.className = (props?.['class'] ? props['class'] + ' ' : '') + crumbs_self;
4141
- return node;
2976
+ };
2977
+ Reflect.defineProperty(descr2.value, 'name', { value: orig.name + ' ' });
2978
+ Reflect.defineProperty(descr2.value, 'length', { value: orig.length });
2979
+ Object.assign(descr2.value, { orig });
2980
+ Reflect.defineProperty(host, field, descr2);
2981
+ return descr2;
4142
2982
  }
4143
- $.$mol_jsx = $mol_jsx;
2983
+ $.$mol_wire_plex = $mol_wire_plex;
4144
2984
  })($ || ($ = {}));
4145
2985
 
4146
2986
  ;
4147
2987
  "use strict";
4148
2988
  var $;
4149
2989
  (function ($) {
4150
- class $mol_window extends $mol_object {
4151
- static size() {
4152
- return {
4153
- width: 1024,
4154
- height: 768,
4155
- };
4156
- }
4157
- }
4158
- $.$mol_window = $mol_window;
2990
+ $.$mol_mem = $mol_wire_solo;
2991
+ $.$mol_mem_key = $mol_wire_plex;
4159
2992
  })($ || ($ = {}));
4160
2993
 
4161
2994
  ;
@@ -4274,6 +3107,26 @@ var $;
4274
3107
  $.$mol_dom_qname = $mol_dom_qname;
4275
3108
  })($ || ($ = {}));
4276
3109
 
3110
+ ;
3111
+ "use strict";
3112
+ var $;
3113
+ (function ($) {
3114
+ function $mol_wire_probe(task, def) {
3115
+ const warm = $mol_wire_fiber.warm;
3116
+ try {
3117
+ $mol_wire_fiber.warm = false;
3118
+ const res = task();
3119
+ if (res === undefined)
3120
+ return def;
3121
+ return res;
3122
+ }
3123
+ finally {
3124
+ $mol_wire_fiber.warm = warm;
3125
+ }
3126
+ }
3127
+ $.$mol_wire_probe = $mol_wire_probe;
3128
+ })($ || ($ = {}));
3129
+
4277
3130
  ;
4278
3131
  "use strict";
4279
3132
  var $;
@@ -4290,6 +3143,38 @@ var $;
4290
3143
  $.$mol_wire_watch = $mol_wire_watch;
4291
3144
  })($ || ($ = {}));
4292
3145
 
3146
+ ;
3147
+ "use strict";
3148
+ var $;
3149
+ (function ($) {
3150
+ function $mol_const(value) {
3151
+ const getter = (() => value);
3152
+ getter['()'] = value;
3153
+ getter[Symbol.toStringTag] = value;
3154
+ getter[$mol_dev_format_head] = () => $mol_dev_format_span({}, '()=> ', $mol_dev_format_auto(value));
3155
+ return getter;
3156
+ }
3157
+ $.$mol_const = $mol_const;
3158
+ })($ || ($ = {}));
3159
+
3160
+ ;
3161
+ "use strict";
3162
+ var $;
3163
+ (function ($) {
3164
+ function $mol_wire_solid() {
3165
+ let current = $mol_wire_auto();
3166
+ if (current.temp)
3167
+ current = current.host;
3168
+ if (current.reap !== nothing) {
3169
+ current?.sub_on(sub, sub.data.length);
3170
+ }
3171
+ current.reap = nothing;
3172
+ }
3173
+ $.$mol_wire_solid = $mol_wire_solid;
3174
+ const nothing = () => { };
3175
+ const sub = new $mol_wire_pub_sub;
3176
+ })($ || ($ = {}));
3177
+
4293
3178
  ;
4294
3179
  "use strict";
4295
3180
  var $;
@@ -4375,6 +3260,36 @@ var $;
4375
3260
  $.$mol_dom_render_fields = $mol_dom_render_fields;
4376
3261
  })($ || ($ = {}));
4377
3262
 
3263
+ ;
3264
+ "use strict";
3265
+ var $;
3266
+ (function ($) {
3267
+ function $mol_wire_async(obj) {
3268
+ let fiber;
3269
+ const temp = $mol_wire_task.getter(obj);
3270
+ return new Proxy(obj, {
3271
+ get(obj, field) {
3272
+ const val = obj[field];
3273
+ if (typeof val !== 'function')
3274
+ return val;
3275
+ let fiber;
3276
+ const temp = $mol_wire_task.getter(val);
3277
+ return function $mol_wire_async(...args) {
3278
+ fiber?.destructor();
3279
+ fiber = temp(obj, args);
3280
+ return fiber.async();
3281
+ };
3282
+ },
3283
+ apply(obj, self, args) {
3284
+ fiber?.destructor();
3285
+ fiber = temp(self, args);
3286
+ return fiber.async();
3287
+ },
3288
+ });
3289
+ }
3290
+ $.$mol_wire_async = $mol_wire_async;
3291
+ })($ || ($ = {}));
3292
+
4378
3293
  ;
4379
3294
  "use strict";
4380
3295
 
@@ -5754,6 +4669,13 @@ var $;
5754
4669
  ($mol_mem(($.$mol_plot_pane.prototype), "dimensions_viewport"));
5755
4670
 
5756
4671
 
4672
+ ;
4673
+ "use strict";
4674
+ var $;
4675
+ (function ($) {
4676
+ $.$mol_mem_cached = $mol_wire_probe;
4677
+ })($ || ($ = {}));
4678
+
5757
4679
  ;
5758
4680
  ($.$mol_svg_group) = class $mol_svg_group extends ($.$mol_svg) {
5759
4681
  dom_name(){