mol_plot_all 1.2.915 → 1.2.916

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/web.test.js CHANGED
@@ -85,7 +85,7 @@ var $;
85
85
  },
86
86
  });
87
87
  })($ || ($ = {}));
88
- //mol/test/test.test.ts
88
+
89
89
  ;
90
90
  "use strict";
91
91
  var $;
@@ -94,22 +94,22 @@ var $;
94
94
  }
95
95
  $.$mol_test_complete = $mol_test_complete;
96
96
  })($ || ($ = {}));
97
- //mol/test/test.web.test.ts
97
+
98
98
  ;
99
99
  "use strict";
100
- //mol/type/error/error.ts
100
+
101
101
  ;
102
102
  "use strict";
103
- //mol/type/assert/assert.ts
103
+
104
104
  ;
105
105
  "use strict";
106
- //mol/type/assert/assert.test.ts
106
+
107
107
  ;
108
108
  "use strict";
109
- //mol/type/partial/deep/deep.ts
109
+
110
110
  ;
111
111
  "use strict";
112
- //mol/type/partial/deep/deep.test.ts
112
+
113
113
  ;
114
114
  "use strict";
115
115
  var $;
@@ -230,7 +230,7 @@ var $;
230
230
  }
231
231
  $.$mol_jsx = $mol_jsx;
232
232
  })($ || ($ = {}));
233
- //mol/jsx/jsx.ts
233
+
234
234
  ;
235
235
  "use strict";
236
236
  var $;
@@ -320,7 +320,7 @@ var $;
320
320
  },
321
321
  });
322
322
  })($ || ($ = {}));
323
- //mol/jsx/jsx.test.tsx
323
+
324
324
  ;
325
325
  "use strict";
326
326
  var $;
@@ -445,7 +445,7 @@ var $;
445
445
  }
446
446
  $.$mol_range2_array = $mol_range2_array;
447
447
  })($ || ($ = {}));
448
- //mol/range2/range2.ts
448
+
449
449
  ;
450
450
  "use strict";
451
451
  var $;
@@ -605,7 +605,7 @@ var $;
605
605
  }
606
606
  });
607
607
  })($ || ($ = {}));
608
- //mol/range2/range2.test.ts
608
+
609
609
  ;
610
610
  "use strict";
611
611
  var $;
@@ -719,7 +719,7 @@ var $;
719
719
  },
720
720
  });
721
721
  })($ || ($ = {}));
722
- //mol/compare/deep/deep.test.tsx
722
+
723
723
  ;
724
724
  "use strict";
725
725
  var $;
@@ -804,7 +804,7 @@ var $;
804
804
  }
805
805
  };
806
806
  })($ || ($ = {}));
807
- //mol/assert/assert.ts
807
+
808
808
  ;
809
809
  "use strict";
810
810
  var $;
@@ -842,16 +842,16 @@ var $;
842
842
  },
843
843
  });
844
844
  })($ || ($ = {}));
845
- //mol/assert/assert.test.ts
845
+
846
846
  ;
847
847
  "use strict";
848
- //mol/type/equals/equals.ts
848
+
849
849
  ;
850
850
  "use strict";
851
- //mol/type/equals/equals.test.ts
851
+
852
852
  ;
853
853
  "use strict";
854
- //mol/type/keys/extract/extract.test.ts
854
+
855
855
  ;
856
856
  "use strict";
857
857
  var $;
@@ -865,7 +865,7 @@ var $;
865
865
  $.$mol_log3_area = () => () => { };
866
866
  });
867
867
  })($ || ($ = {}));
868
- //mol/log3/log3.test.ts
868
+
869
869
  ;
870
870
  "use strict";
871
871
  var $;
@@ -879,7 +879,7 @@ var $;
879
879
  },
880
880
  });
881
881
  })($ || ($ = {}));
882
- //mol/func/name/name.test.ts
882
+
883
883
  ;
884
884
  "use strict";
885
885
  var $;
@@ -942,10 +942,10 @@ var $;
942
942
  },
943
943
  });
944
944
  })($ || ($ = {}));
945
- //mol/delegate/delegate.test.ts
945
+
946
946
  ;
947
947
  "use strict";
948
- //mol/type/writable/writable.test.ts
948
+
949
949
  ;
950
950
  "use strict";
951
951
  var $;
@@ -964,7 +964,7 @@ var $;
964
964
  },
965
965
  });
966
966
  })($ || ($ = {}));
967
- //mol/object/object.test.ts
967
+
968
968
  ;
969
969
  "use strict";
970
970
  var $;
@@ -1022,7 +1022,7 @@ var $;
1022
1022
  },
1023
1023
  });
1024
1024
  })($ || ($ = {}));
1025
- //mol/wire/pub/sub/sub.test.ts
1025
+
1026
1026
  ;
1027
1027
  "use strict";
1028
1028
  var $;
@@ -1060,7 +1060,7 @@ var $;
1060
1060
  }
1061
1061
  $.$mol_after_mock_timeout = $mol_after_mock_timeout;
1062
1062
  })($ || ($ = {}));
1063
- //mol/after/mock/mock.test.ts
1063
+
1064
1064
  ;
1065
1065
  "use strict";
1066
1066
  var $;
@@ -1069,7 +1069,7 @@ var $;
1069
1069
  $.$mol_after_frame = $mol_after_mock_commmon;
1070
1070
  });
1071
1071
  })($ || ($ = {}));
1072
- //mol/after/frame/frame.test.ts
1072
+
1073
1073
  ;
1074
1074
  "use strict";
1075
1075
  var $;
@@ -1151,10 +1151,10 @@ var $;
1151
1151
  },
1152
1152
  });
1153
1153
  })($ || ($ = {}));
1154
- //mol/wire/fiber/fiber.test.ts
1154
+
1155
1155
  ;
1156
1156
  "use strict";
1157
- //mol/type/tail/tail.test.ts
1157
+
1158
1158
  ;
1159
1159
  "use strict";
1160
1160
  var $;
@@ -1173,7 +1173,7 @@ var $;
1173
1173
  }
1174
1174
  $.$mol_promise = $mol_promise;
1175
1175
  })($ || ($ = {}));
1176
- //mol/promise/promise/promise.ts
1176
+
1177
1177
  ;
1178
1178
  "use strict";
1179
1179
  var $;
@@ -1182,7 +1182,7 @@ var $;
1182
1182
  $.$mol_after_timeout = $mol_after_mock_timeout;
1183
1183
  });
1184
1184
  })($ || ($ = {}));
1185
- //mol/after/timeout/timeout.test.ts
1185
+
1186
1186
  ;
1187
1187
  "use strict";
1188
1188
  var $;
@@ -1208,7 +1208,7 @@ var $;
1208
1208
  }
1209
1209
  $.$mol_wire_sync = $mol_wire_sync;
1210
1210
  })($ || ($ = {}));
1211
- //mol/wire/sync/sync.ts
1211
+
1212
1212
  ;
1213
1213
  "use strict";
1214
1214
  var $;
@@ -1226,7 +1226,7 @@ var $;
1226
1226
  },
1227
1227
  });
1228
1228
  })($ || ($ = {}));
1229
- //mol/wire/sync/sync.test.ts
1229
+
1230
1230
  ;
1231
1231
  "use strict";
1232
1232
  var $;
@@ -1244,7 +1244,7 @@ var $;
1244
1244
  }
1245
1245
  $.$mol_wait_timeout = $mol_wait_timeout;
1246
1246
  })($ || ($ = {}));
1247
- //mol/wait/timeout/timeout.ts
1247
+
1248
1248
  ;
1249
1249
  "use strict";
1250
1250
  var $;
@@ -1297,7 +1297,7 @@ var $;
1297
1297
  },
1298
1298
  });
1299
1299
  })($ || ($ = {}));
1300
- //mol/wire/async/async.test.ts
1300
+
1301
1301
  ;
1302
1302
  "use strict";
1303
1303
  var $;
@@ -1770,7 +1770,7 @@ var $;
1770
1770
  },
1771
1771
  });
1772
1772
  })($ || ($ = {}));
1773
- //mol/wire/solo/solo.test.ts
1773
+
1774
1774
  ;
1775
1775
  "use strict";
1776
1776
  var $;
@@ -1885,7 +1885,7 @@ var $;
1885
1885
  },
1886
1886
  });
1887
1887
  })($ || ($ = {}));
1888
- //mol/wire/plex/plex.test.ts
1888
+
1889
1889
  ;
1890
1890
  "use strict";
1891
1891
  var $;
@@ -1911,7 +1911,144 @@ var $;
1911
1911
  },
1912
1912
  });
1913
1913
  })($ || ($ = {}));
1914
- //mol/wire/probe/probe.test.ts
1914
+
1915
+ ;
1916
+ "use strict";
1917
+ var $;
1918
+ (function ($) {
1919
+ $mol_test({
1920
+ 'Primitives'() {
1921
+ $mol_assert_equal($mol_key(null), 'null');
1922
+ $mol_assert_equal($mol_key(false), 'false');
1923
+ $mol_assert_equal($mol_key(true), 'true');
1924
+ $mol_assert_equal($mol_key(0), '0');
1925
+ $mol_assert_equal($mol_key(1n << 64n), '18446744073709551616n');
1926
+ $mol_assert_equal($mol_key(''), '""');
1927
+ },
1928
+ 'Array & POJO'() {
1929
+ $mol_assert_equal($mol_key([null]), '[null]');
1930
+ $mol_assert_equal($mol_key({ foo: 0 }), '{"foo":0}');
1931
+ $mol_assert_equal($mol_key({ foo: [false] }), '{"foo":[false]}');
1932
+ },
1933
+ 'Uint8Array'() {
1934
+ $mol_assert_equal($mol_key(new Uint8Array([1, 2])), '[1,2]');
1935
+ $mol_assert_equal($mol_key([new Uint8Array([1, 2])]), '[[1,2]]');
1936
+ $mol_assert_equal($mol_key({ foo: new Uint8Array([1, 2]) }), '{"foo":[1,2]}');
1937
+ },
1938
+ 'Function'() {
1939
+ const func = () => { };
1940
+ $mol_assert_equal($mol_key(func), $mol_key(func));
1941
+ $mol_assert_unique($mol_key(func), $mol_key(() => { }));
1942
+ },
1943
+ 'Objects'() {
1944
+ class User {
1945
+ }
1946
+ const jin = new User();
1947
+ $mol_assert_equal($mol_key(jin), $mol_key(jin));
1948
+ $mol_assert_unique($mol_key(jin), $mol_key(new User()));
1949
+ },
1950
+ 'Elements'() {
1951
+ const foo = $mol_jsx("div", null, "bar");
1952
+ $mol_assert_equal($mol_key(foo), $mol_key(foo));
1953
+ $mol_assert_unique($mol_key(foo), $mol_key($mol_jsx("div", null, "bar")));
1954
+ },
1955
+ 'Custom JSON representation'() {
1956
+ class User {
1957
+ name;
1958
+ age;
1959
+ constructor(name, age) {
1960
+ this.name = name;
1961
+ this.age = age;
1962
+ }
1963
+ toJSON() { return { name: this.name }; }
1964
+ }
1965
+ $mol_assert_equal($mol_key(new User('jin', 18)), '{"name":"jin"}');
1966
+ },
1967
+ 'Special native classes'() {
1968
+ $mol_assert_equal($mol_key(new Date('xyz')), 'null');
1969
+ $mol_assert_equal($mol_key(new Date('2001-01-02T03:04:05.678Z')), '"2001-01-02T03:04:05.678Z"');
1970
+ $mol_assert_equal($mol_key(/./), '"/./"');
1971
+ $mol_assert_equal($mol_key(/\./gimsu), '"/\\\\./gimsu"');
1972
+ },
1973
+ });
1974
+ })($ || ($ = {}));
1975
+
1976
+ ;
1977
+ "use strict";
1978
+
1979
+ ;
1980
+ "use strict";
1981
+ var $;
1982
+ (function ($) {
1983
+ class $mol_wire_log extends $mol_object2 {
1984
+ static watch(task) {
1985
+ return task;
1986
+ }
1987
+ static track(fiber) {
1988
+ const prev = $mol_wire_probe(() => this.track(fiber));
1989
+ let next;
1990
+ try {
1991
+ next = fiber.sync();
1992
+ }
1993
+ finally {
1994
+ for (const pub of fiber.pub_list) {
1995
+ if (pub instanceof $mol_wire_fiber) {
1996
+ this.track(pub);
1997
+ }
1998
+ }
1999
+ }
2000
+ if (fiber.host === this)
2001
+ return next;
2002
+ if ($mol_compare_deep(prev, next)) {
2003
+ this.$.$mol_log3_rise({
2004
+ message: '💧 Same',
2005
+ place: fiber,
2006
+ });
2007
+ }
2008
+ else if (prev !== undefined) {
2009
+ this.$.$mol_log3_rise({
2010
+ message: '🔥 Next',
2011
+ place: fiber,
2012
+ prev,
2013
+ });
2014
+ }
2015
+ return next;
2016
+ }
2017
+ static active() {
2018
+ try {
2019
+ this.watch()?.();
2020
+ }
2021
+ catch (error) {
2022
+ $mol_fail_log(error);
2023
+ }
2024
+ finally {
2025
+ for (const pub of $mol_wire_auto().pub_list) {
2026
+ if (pub instanceof $mol_wire_fiber) {
2027
+ this.track(pub);
2028
+ }
2029
+ }
2030
+ }
2031
+ }
2032
+ }
2033
+ __decorate([
2034
+ $mol_mem
2035
+ ], $mol_wire_log, "watch", null);
2036
+ __decorate([
2037
+ $mol_mem_key
2038
+ ], $mol_wire_log, "track", null);
2039
+ __decorate([
2040
+ $mol_mem
2041
+ ], $mol_wire_log, "active", null);
2042
+ $.$mol_wire_log = $mol_wire_log;
2043
+ })($ || ($ = {}));
2044
+
2045
+ ;
2046
+ "use strict";
2047
+ var $;
2048
+ (function ($) {
2049
+ $mol_wire_log.active();
2050
+ })($ || ($ = {}));
2051
+
1915
2052
  ;
1916
2053
  "use strict";
1917
2054
  var $;
@@ -1920,7 +2057,7 @@ var $;
1920
2057
  $.$mol_after_tick = $mol_after_mock_commmon;
1921
2058
  });
1922
2059
  })($ || ($ = {}));
1923
- //mol/after/tick/tick.test.ts
2060
+
1924
2061
  ;
1925
2062
  "use strict";
1926
2063
  var $;
@@ -1936,7 +2073,7 @@ var $;
1936
2073
  },
1937
2074
  });
1938
2075
  })($ || ($ = {}));
1939
- //mol/maybe/maybe.test.ts
2076
+
1940
2077
  ;
1941
2078
  "use strict";
1942
2079
  var $;
@@ -2054,7 +2191,7 @@ var $;
2054
2191
  },
2055
2192
  });
2056
2193
  })($ || ($ = {}));
2057
- //mol/wrapper/wrapper.test.ts
2194
+
2058
2195
  ;
2059
2196
  "use strict";
2060
2197
  var $;
@@ -2079,164 +2216,27 @@ var $;
2079
2216
  },
2080
2217
  });
2081
2218
  })($ || ($ = {}));
2082
- //mol/memo/memo.test.ts
2219
+
2083
2220
  ;
2084
2221
  "use strict";
2085
2222
  var $;
2086
2223
  (function ($) {
2087
2224
  $mol_test({
2088
- 'Primitives'() {
2089
- $mol_assert_equal($mol_key(null), 'null');
2090
- $mol_assert_equal($mol_key(false), 'false');
2091
- $mol_assert_equal($mol_key(true), 'true');
2092
- $mol_assert_equal($mol_key(0), '0');
2093
- $mol_assert_equal($mol_key(1n << 64n), '18446744073709551616n');
2094
- $mol_assert_equal($mol_key(''), '""');
2095
- },
2096
- 'Array & POJO'() {
2097
- $mol_assert_equal($mol_key([null]), '[null]');
2098
- $mol_assert_equal($mol_key({ foo: 0 }), '{"foo":0}');
2099
- $mol_assert_equal($mol_key({ foo: [false] }), '{"foo":[false]}');
2100
- },
2101
- 'Uint8Array'() {
2102
- $mol_assert_equal($mol_key(new Uint8Array([1, 2])), '[1,2]');
2103
- $mol_assert_equal($mol_key([new Uint8Array([1, 2])]), '[[1,2]]');
2104
- $mol_assert_equal($mol_key({ foo: new Uint8Array([1, 2]) }), '{"foo":[1,2]}');
2105
- },
2106
- 'Function'() {
2107
- const func = () => { };
2108
- $mol_assert_equal($mol_key(func), $mol_key(func));
2109
- $mol_assert_unique($mol_key(func), $mol_key(() => { }));
2110
- },
2111
- 'Objects'() {
2112
- class User {
2113
- }
2114
- const jin = new User();
2115
- $mol_assert_equal($mol_key(jin), $mol_key(jin));
2116
- $mol_assert_unique($mol_key(jin), $mol_key(new User()));
2117
- },
2118
- 'Elements'() {
2119
- const foo = $mol_jsx("div", null, "bar");
2120
- $mol_assert_equal($mol_key(foo), $mol_key(foo));
2121
- $mol_assert_unique($mol_key(foo), $mol_key($mol_jsx("div", null, "bar")));
2122
- },
2123
- 'Custom JSON representation'() {
2124
- class User {
2125
- name;
2126
- age;
2127
- constructor(name, age) {
2128
- this.name = name;
2129
- this.age = age;
2130
- }
2131
- toJSON() { return { name: this.name }; }
2132
- }
2133
- $mol_assert_equal($mol_key(new User('jin', 18)), '{"name":"jin"}');
2134
- },
2135
- 'Special native classes'() {
2136
- $mol_assert_equal($mol_key(new Date('xyz')), 'null');
2137
- $mol_assert_equal($mol_key(new Date('2001-01-02T03:04:05.678Z')), '"2001-01-02T03:04:05.678Z"');
2138
- $mol_assert_equal($mol_key(/./), '"/./"');
2139
- $mol_assert_equal($mol_key(/\./gimsu), '"/\\\\./gimsu"');
2225
+ 'const returns stored value'() {
2226
+ const foo = { bar: $mol_const(Math.random()) };
2227
+ $mol_assert_equal(foo.bar(), foo.bar());
2228
+ $mol_assert_equal(foo.bar(), foo.bar['()']);
2140
2229
  },
2141
2230
  });
2142
2231
  })($ || ($ = {}));
2143
- //mol/key/key.test.tsx
2144
- ;
2145
- "use strict";
2146
- //mol/type/foot/foot.test.ts
2232
+
2147
2233
  ;
2148
2234
  "use strict";
2149
2235
  var $;
2150
- (function ($) {
2151
- class $mol_wire_log extends $mol_object2 {
2152
- static watch(task) {
2153
- return task;
2154
- }
2155
- static track(fiber) {
2156
- const prev = $mol_wire_probe(() => this.track(fiber));
2157
- let next;
2158
- try {
2159
- next = fiber.sync();
2160
- }
2161
- finally {
2162
- for (const pub of fiber.pub_list) {
2163
- if (pub instanceof $mol_wire_fiber) {
2164
- this.track(pub);
2165
- }
2166
- }
2167
- }
2168
- if (fiber.host === this)
2169
- return next;
2170
- if ($mol_compare_deep(prev, next)) {
2171
- this.$.$mol_log3_rise({
2172
- message: '💧 Same',
2173
- place: fiber,
2174
- });
2175
- }
2176
- else if (prev !== undefined) {
2177
- this.$.$mol_log3_rise({
2178
- message: '🔥 Next',
2179
- place: fiber,
2180
- prev,
2181
- });
2182
- }
2183
- return next;
2184
- }
2185
- static active() {
2186
- try {
2187
- this.watch()?.();
2188
- }
2189
- catch (error) {
2190
- $mol_fail_log(error);
2191
- }
2192
- finally {
2193
- for (const pub of $mol_wire_auto().pub_list) {
2194
- if (pub instanceof $mol_wire_fiber) {
2195
- this.track(pub);
2196
- }
2197
- }
2198
- }
2199
- }
2200
- }
2201
- __decorate([
2202
- $mol_mem
2203
- ], $mol_wire_log, "watch", null);
2204
- __decorate([
2205
- $mol_mem_key
2206
- ], $mol_wire_log, "track", null);
2207
- __decorate([
2208
- $mol_mem
2209
- ], $mol_wire_log, "active", null);
2210
- $.$mol_wire_log = $mol_wire_log;
2211
- })($ || ($ = {}));
2212
- //mol/wire/log/log.ts
2213
- ;
2214
- "use strict";
2215
- var $;
2216
- (function ($) {
2217
- $mol_wire_log.active();
2218
- })($ || ($ = {}));
2219
- //mol/wire/atom/atom.test.ts
2220
- ;
2221
- "use strict";
2222
- var $;
2223
- (function ($) {
2224
- $mol_test({
2225
- 'const returns stored value'() {
2226
- const foo = { bar: $mol_const(Math.random()) };
2227
- $mol_assert_equal(foo.bar(), foo.bar());
2228
- $mol_assert_equal(foo.bar(), foo.bar['()']);
2229
- },
2230
- });
2231
- })($ || ($ = {}));
2232
- //mol/const/const.test.ts
2233
- ;
2234
- "use strict";
2235
- var $;
2236
- (function ($_1) {
2237
- $mol_test({
2238
- 'id auto generation'($) {
2239
- class $mol_view_test_item extends $mol_view {
2236
+ (function ($_1) {
2237
+ $mol_test({
2238
+ 'id auto generation'($) {
2239
+ class $mol_view_test_item extends $mol_view {
2240
2240
  }
2241
2241
  class $mol_view_test_block extends $mol_view {
2242
2242
  static $ = $;
@@ -2337,1577 +2337,25 @@ var $;
2337
2337
  },
2338
2338
  });
2339
2339
  })($ || ($ = {}));
2340
- //mol/view/view/view.test.ts
2341
- ;
2342
- "use strict";
2343
- var $;
2344
- (function ($) {
2345
- class $mol_view_tree_test_simple extends $mol_view {
2346
- some() {
2347
- return 1;
2348
- }
2349
- bool() {
2350
- return true;
2351
- }
2352
- str() {
2353
- return "test";
2354
- }
2355
- arr() {
2356
- return [];
2357
- }
2358
- arr_string() {
2359
- return [];
2360
- }
2361
- }
2362
- $.$mol_view_tree_test_simple = $mol_view_tree_test_simple;
2363
- })($ || ($ = {}));
2364
- //mol/view/tree/test/-view.tree/simple.test.view.tree.ts
2365
- ;
2366
- "use strict";
2367
- var $;
2368
- (function ($) {
2369
- class $mol_view_tree_test_binding extends $mol_view {
2370
- value(next) {
2371
- return this.task_title_new(next);
2372
- }
2373
- enabled() {
2374
- return this.head_complete_enabled();
2375
- }
2376
- task_title_new(next) {
2377
- if (next !== undefined)
2378
- return next;
2379
- return "123";
2380
- }
2381
- head_complete_enabled() {
2382
- return false;
2383
- }
2384
- }
2385
- __decorate([
2386
- $mol_mem
2387
- ], $mol_view_tree_test_binding.prototype, "task_title_new", null);
2388
- $.$mol_view_tree_test_binding = $mol_view_tree_test_binding;
2389
- })($ || ($ = {}));
2390
- //mol/view/tree/test/-view.tree/binding.test.view.tree.ts
2391
- ;
2392
- "use strict";
2393
- var $;
2394
- (function ($) {
2395
- class $mol_view_tree_test_attributes_super extends $mol_view {
2396
- some() {
2397
- return {
2398
- a: 0,
2399
- b: 2
2400
- };
2401
- }
2402
- }
2403
- $.$mol_view_tree_test_attributes_super = $mol_view_tree_test_attributes_super;
2404
- class $mol_view_tree_test_attributes extends $mol_view_tree_test_attributes_super {
2405
- some() {
2406
- return {
2407
- ...super.some(),
2408
- a: 1
2409
- };
2410
- }
2411
- }
2412
- $.$mol_view_tree_test_attributes = $mol_view_tree_test_attributes;
2413
- })($ || ($ = {}));
2414
- //mol/view/tree/test/-view.tree/attributes.test.view.tree.ts
2415
- ;
2416
- "use strict";
2417
- var $;
2418
- (function ($) {
2419
- class $mol_view_tree_test_attributes_subcomponent extends $mol_view {
2420
- Page(id) {
2421
- const obj = new this.$.$mol_view_tree_test_attributes_subcomponent_page();
2422
- obj.Sub = () => this.page(id);
2423
- return obj;
2424
- }
2425
- page(id) {
2426
- return null;
2427
- }
2428
- }
2429
- __decorate([
2430
- $mol_mem_key
2431
- ], $mol_view_tree_test_attributes_subcomponent.prototype, "Page", null);
2432
- $.$mol_view_tree_test_attributes_subcomponent = $mol_view_tree_test_attributes_subcomponent;
2433
- class $mol_view_tree_test_attributes_subcomponent_page extends $mol_view {
2434
- Sub() {
2435
- return null;
2436
- }
2437
- }
2438
- $.$mol_view_tree_test_attributes_subcomponent_page = $mol_view_tree_test_attributes_subcomponent_page;
2439
- })($ || ($ = {}));
2440
- //mol/view/tree/test/-view.tree/subcomponent.test.view.tree.ts
2441
- ;
2442
- "use strict";
2443
- var $;
2444
- (function ($) {
2445
- class $mol_view_tree_test_binding_right extends $mol_view {
2446
- outer_width(v) {
2447
- return this.Test().width(v);
2448
- }
2449
- Test() {
2450
- const obj = new this.$.$mol_view_tree_test_binding_right_test();
2451
- return obj;
2452
- }
2453
- }
2454
- __decorate([
2455
- $mol_mem
2456
- ], $mol_view_tree_test_binding_right.prototype, "Test", null);
2457
- $.$mol_view_tree_test_binding_right = $mol_view_tree_test_binding_right;
2458
- class $mol_view_tree_test_binding_right_test extends $mol_view {
2459
- width(next) {
2460
- if (next !== undefined)
2461
- return next;
2462
- return 0;
2463
- }
2464
- }
2465
- __decorate([
2466
- $mol_mem
2467
- ], $mol_view_tree_test_binding_right_test.prototype, "width", null);
2468
- $.$mol_view_tree_test_binding_right_test = $mol_view_tree_test_binding_right_test;
2469
- })($ || ($ = {}));
2470
- //mol/view/tree/test/-view.tree/binding_right.test.view.tree.ts
2471
- ;
2472
- "use strict";
2473
- var $;
2474
- (function ($_1) {
2475
- var $$;
2476
- (function ($$) {
2477
- $mol_test({
2478
- 'simple props'($) {
2479
- const app = $mol_view_tree_test_simple.make({ $ });
2480
- $mol_assert_equal(app.some(), 1);
2481
- $mol_assert_equal(app.bool(), true);
2482
- $mol_assert_equal(app.str(), 'test');
2483
- $mol_assert_ok(Array.isArray(app.arr()));
2484
- $mol_assert_ok(Array.isArray(app.arr_string()));
2485
- },
2486
- 'default value'($) {
2487
- const app = $mol_view_tree_test_binding.make({ $ });
2488
- $mol_assert_equal(app.value(), '123');
2489
- },
2490
- 'both binding'($) {
2491
- const app = $mol_view_tree_test_binding.make({ $ });
2492
- $mol_assert_ok(app.value() !== '1');
2493
- app.value('1');
2494
- $mol_assert_equal(app.value(), '1');
2495
- },
2496
- 'left binding'($) {
2497
- const app = $mol_view_tree_test_binding.make({ $ });
2498
- $mol_assert_not(app.head_complete_enabled());
2499
- $mol_assert_not(app.enabled());
2500
- },
2501
- 'sub component'($) {
2502
- const app = $mol_view_tree_test_binding_right.make({ $ });
2503
- $mol_assert_ok(app.Test() instanceof $mol_view_tree_test_binding_right_test);
2504
- },
2505
- 'right binding - change owner property'($) {
2506
- const app = $mol_view_tree_test_binding_right.make({ $ });
2507
- const val = 123;
2508
- $mol_assert_ok(app.outer_width() !== val);
2509
- $mol_assert_ok(app.Test().width() !== val);
2510
- app.outer_width(val);
2511
- $mol_assert_equal(app.outer_width(), val);
2512
- $mol_assert_equal(app.Test().width(), val);
2513
- },
2514
- 'right binding - change part property'($) {
2515
- const app = $mol_view_tree_test_binding_right.make({ $ });
2516
- const val = 123;
2517
- $mol_assert_ok(app.outer_width() !== val);
2518
- $mol_assert_ok(app.Test().width() !== val);
2519
- app.Test().width(val);
2520
- $mol_assert_equal(app.Test().width(), val);
2521
- $mol_assert_equal(app.outer_width(), val);
2522
- },
2523
- 'attributes merging'($) {
2524
- const app = $mol_view_tree_test_attributes.make({ $ });
2525
- $mol_assert_like(app.some(), { a: 1, b: 2 });
2526
- },
2527
- 'subcomponent indexed'($) {
2528
- const app = $mol_view_tree_test_attributes_subcomponent.make({ $ });
2529
- const val = 123;
2530
- app.page = (index) => index;
2531
- $mol_assert_equal(app.Page(val).Sub(), val);
2532
- },
2533
- });
2534
- })($$ = $_1.$$ || ($_1.$$ = {}));
2535
- })($ || ($ = {}));
2536
- //mol/view/tree/test/tree.test.ts
2340
+
2537
2341
  ;
2538
2342
  "use strict";
2539
2343
  var $;
2540
2344
  (function ($) {
2541
- $.$mol_tree_convert = Symbol('$mol_tree_convert');
2542
- class $mol_tree extends $mol_object2 {
2543
- type;
2544
- data;
2545
- sub;
2546
- baseUri;
2547
- row;
2548
- col;
2549
- length;
2550
- constructor(config = {}) {
2551
- super();
2552
- this.type = config.type || '';
2553
- if (config.value !== undefined) {
2554
- var sub = $mol_tree.values(config.value);
2555
- if (config.type || sub.length > 1) {
2556
- this.sub = [...sub, ...(config.sub || [])];
2557
- this.data = config.data || '';
2558
- }
2559
- else {
2560
- this.data = sub[0].data;
2561
- this.sub = config.sub || [];
2562
- }
2563
- }
2564
- else {
2565
- this.data = config.data || '';
2566
- this.sub = config.sub || [];
2567
- }
2568
- this.baseUri = config.baseUri || '';
2569
- this.row = config.row || 0;
2570
- this.col = config.col || 0;
2571
- this.length = config.length || 0;
2572
- }
2573
- static values(str, baseUri) {
2574
- return str.split('\n').map((data, index) => new $mol_tree({
2575
- data: data,
2576
- baseUri: baseUri,
2577
- row: index + 1,
2578
- length: data.length,
2579
- }));
2580
- }
2581
- clone(config = {}) {
2582
- return new $mol_tree({
2583
- type: ('type' in config) ? config.type : this.type,
2584
- data: ('data' in config) ? config.data : this.data,
2585
- sub: ('sub' in config) ? config.sub : this.sub,
2586
- baseUri: ('baseUri' in config) ? config.baseUri : this.baseUri,
2587
- row: ('row' in config) ? config.row : this.row,
2588
- col: ('col' in config) ? config.col : this.col,
2589
- length: ('length' in config) ? config.length : this.length,
2590
- value: config.value
2591
- });
2592
- }
2593
- make(config) {
2594
- return new $mol_tree({
2595
- baseUri: this.baseUri,
2596
- row: this.row,
2597
- col: this.col,
2598
- length: this.length,
2599
- ...config,
2600
- });
2601
- }
2602
- make_data(value, sub) {
2603
- return this.make({ value, sub });
2604
- }
2605
- make_struct(type, sub) {
2606
- return this.make({ type, sub });
2607
- }
2608
- static fromString(str, baseUri) {
2609
- var root = new $mol_tree({ baseUri: baseUri });
2610
- var stack = [root];
2611
- var row = 0;
2612
- var prefix = str.replace(/^\n?(\t*)[\s\S]*/, '$1');
2613
- var lines = str.replace(new RegExp('^\\t{0,' + prefix.length + '}', 'mg'), '').split('\n');
2614
- lines.forEach(line => {
2615
- ++row;
2616
- var chunks = /^(\t*)((?:[^\n\t\\ ]+ *)*)(\\[^\n]*)?(.*?)(?:$|\n)/m.exec(line);
2617
- if (!chunks || chunks[4])
2618
- return this.$.$mol_fail(new Error(`Syntax error at ${baseUri}:${row}\n${line}`));
2619
- var indent = chunks[1];
2620
- var path = chunks[2];
2621
- var data = chunks[3];
2622
- var deep = indent.length;
2623
- var types = path ? path.replace(/ $/, '').split(/ +/) : [];
2624
- if (stack.length <= deep)
2625
- return this.$.$mol_fail(new Error(`Too many tabs at ${baseUri}:${row}\n${line}`));
2626
- stack.length = deep + 1;
2627
- var parent = stack[deep];
2628
- let col = deep;
2629
- types.forEach(type => {
2630
- if (!type)
2631
- return this.$.$mol_fail(new Error(`Unexpected space symbol ${baseUri}:${row}\n${line}`));
2632
- var next = new $mol_tree({ type, baseUri, row, col, length: type.length });
2633
- const parent_sub = parent.sub;
2634
- parent_sub.push(next);
2635
- parent = next;
2636
- col += type.length + 1;
2637
- });
2638
- if (data) {
2639
- var next = new $mol_tree({ data: data.substring(1), baseUri, row, col, length: data.length });
2640
- const parent_sub = parent.sub;
2641
- parent_sub.push(next);
2642
- parent = next;
2643
- }
2644
- stack.push(parent);
2645
- });
2646
- return root;
2647
- }
2648
- static fromJSON(json, baseUri = '') {
2649
- switch (true) {
2650
- case typeof json === 'boolean':
2651
- case typeof json === 'number':
2652
- case json === null:
2653
- return new $mol_tree({
2654
- type: String(json),
2655
- baseUri: baseUri
2656
- });
2657
- case typeof json === 'string':
2658
- return new $mol_tree({
2659
- value: json,
2660
- baseUri: baseUri
2661
- });
2662
- case Array.isArray(json):
2663
- return new $mol_tree({
2664
- type: "/",
2665
- sub: json.map(json => $mol_tree.fromJSON(json, baseUri))
2666
- });
2667
- case json instanceof Date:
2668
- return new $mol_tree({
2669
- value: json.toISOString(),
2670
- baseUri: baseUri
2671
- });
2672
- default:
2673
- if (typeof json[$.$mol_tree_convert] === 'function') {
2674
- return json[$.$mol_tree_convert]();
2675
- }
2676
- if (typeof json.toJSON === 'function') {
2677
- return $mol_tree.fromJSON(json.toJSON());
2678
- }
2679
- if (json instanceof Error) {
2680
- const { name, message, stack } = json;
2681
- json = { ...json, name, message, stack };
2682
- }
2683
- var sub = [];
2684
- for (var key in json) {
2685
- if (json[key] === undefined)
2686
- continue;
2687
- const subsub = $mol_tree.fromJSON(json[key], baseUri);
2688
- if (/^[^\n\t\\ ]+$/.test(key)) {
2689
- var child = new $mol_tree({
2690
- type: key,
2691
- baseUri: baseUri,
2692
- sub: [subsub],
2693
- });
2694
- }
2695
- else {
2696
- var child = new $mol_tree({
2697
- value: key,
2698
- baseUri: baseUri,
2699
- sub: [subsub],
2700
- });
2701
- }
2702
- sub.push(child);
2703
- }
2704
- return new $mol_tree({
2705
- type: "*",
2706
- sub: sub,
2707
- baseUri: baseUri
2708
- });
2709
- }
2710
- }
2711
- get uri() {
2712
- return this.baseUri + '#' + this.row + ':' + this.col;
2713
- }
2714
- toString(prefix = '') {
2715
- var output = '';
2716
- if (this.type.length) {
2717
- if (!prefix.length) {
2718
- prefix = "\t";
2719
- }
2720
- output += this.type;
2721
- if (this.sub.length == 1) {
2722
- return output + ' ' + this.sub[0].toString(prefix);
2723
- }
2724
- output += "\n";
2725
- }
2726
- else if (this.data.length || prefix.length) {
2727
- output += "\\" + this.data + "\n";
2728
- }
2729
- for (var child of this.sub) {
2730
- output += prefix;
2731
- output += child.toString(prefix + "\t");
2732
- }
2733
- return output;
2734
- }
2735
- toJSON() {
2736
- if (!this.type)
2737
- return this.value;
2738
- if (this.type === 'true')
2739
- return true;
2740
- if (this.type === 'false')
2741
- return false;
2742
- if (this.type === 'null')
2743
- return null;
2744
- if (this.type === '*') {
2745
- var obj = {};
2746
- for (var child of this.sub) {
2747
- if (child.type === '-')
2748
- continue;
2749
- var key = child.type || child.clone({ sub: child.sub.slice(0, child.sub.length - 1) }).value;
2750
- var val = child.sub[child.sub.length - 1].toJSON();
2751
- if (val !== undefined)
2752
- obj[key] = val;
2753
- }
2754
- return obj;
2755
- }
2756
- if (this.type === '/') {
2757
- var res = [];
2758
- this.sub.forEach(child => {
2759
- if (child.type === '-')
2760
- return;
2761
- var val = child.toJSON();
2762
- if (val !== undefined)
2763
- res.push(val);
2764
- });
2765
- return res;
2766
- }
2767
- if (this.type === 'time') {
2768
- return new Date(this.value);
2769
- }
2770
- const numb = Number(this.type);
2771
- if (!Number.isNaN(numb) || this.type === 'NaN')
2772
- return numb;
2773
- throw new Error(`Unknown type (${this.type}) at ${this.uri}`);
2774
- }
2775
- get value() {
2776
- var values = [];
2777
- for (var child of this.sub) {
2778
- if (child.type)
2779
- continue;
2780
- values.push(child.value);
2781
- }
2782
- return this.data + values.join("\n");
2783
- }
2784
- insert(value, ...path) {
2785
- if (path.length === 0)
2786
- return value;
2787
- const type = path[0];
2788
- if (typeof type === 'string') {
2789
- let replaced = false;
2790
- const sub = this.sub.map((item, index) => {
2791
- if (item.type !== type)
2792
- return item;
2793
- replaced = true;
2794
- return item.insert(value, ...path.slice(1));
2795
- });
2796
- if (!replaced)
2797
- sub.push(new $mol_tree({ type }).insert(value, ...path.slice(1)));
2798
- return this.clone({ sub });
2799
- }
2800
- else if (typeof type === 'number') {
2801
- const sub = this.sub.slice();
2802
- sub[type] = (sub[type] || new $mol_tree).insert(value, ...path.slice(1));
2803
- return this.clone({ sub });
2804
- }
2805
- else {
2806
- return this.clone({ sub: ((this.sub.length === 0) ? [new $mol_tree()] : this.sub).map(item => item.insert(value, ...path.slice(1))) });
2807
- }
2808
- }
2809
- select(...path) {
2810
- var next = [this];
2811
- for (var type of path) {
2812
- if (!next.length)
2813
- break;
2814
- var prev = next;
2815
- next = [];
2816
- for (var item of prev) {
2817
- switch (typeof (type)) {
2818
- case 'string':
2819
- for (var child of item.sub) {
2820
- if (!type || (child.type == type)) {
2821
- next.push(child);
2822
- }
2823
- }
2824
- break;
2825
- case 'number':
2826
- if (type < item.sub.length)
2827
- next.push(item.sub[type]);
2828
- break;
2829
- default: next.push(...item.sub);
2830
- }
2831
- }
2832
- }
2833
- return new $mol_tree({ sub: next });
2834
- }
2835
- filter(path, value) {
2836
- var sub = this.sub.filter(function (item) {
2837
- var found = item.select(...path);
2838
- if (value == null) {
2839
- return Boolean(found.sub.length);
2840
- }
2841
- else {
2842
- return found.sub.some(child => child.value == value);
2843
- }
2844
- });
2845
- return new $mol_tree({ sub: sub });
2846
- }
2847
- transform(visit, stack = []) {
2848
- const sub_stack = [this, ...stack];
2849
- return visit(sub_stack, () => this.sub.map(node => node.transform(visit, sub_stack)).filter(n => n));
2850
- }
2851
- hack(context) {
2852
- const sub = [].concat(...this.sub.map(child => {
2853
- const handle = context[child.type] || context[''];
2854
- if (!handle)
2855
- $mol_fail(child.error('Handler not defined'));
2856
- return handle(child, context);
2857
- }));
2858
- return this.clone({ sub });
2859
- }
2860
- error(message) {
2861
- return new Error(`${message}:\n${this} ${this.baseUri}:${this.row}:${this.col}`);
2862
- }
2863
- }
2864
- $.$mol_tree = $mol_tree;
2865
- })($ || ($ = {}));
2866
- //mol/tree/tree.ts
2867
- ;
2868
- "use strict";
2869
- var $;
2870
- (function ($_1) {
2871
2345
  $mol_test({
2872
- 'tree parsing'() {
2873
- $mol_assert_equal($mol_tree.fromString("foo\nbar\n").sub.length, 2);
2874
- $mol_assert_equal($mol_tree.fromString("foo\nbar\n").sub[1].type, "bar");
2875
- $mol_assert_equal($mol_tree.fromString("foo\n\n\n").sub.length, 1);
2876
- $mol_assert_equal($mol_tree.fromString("=foo\n\\bar\n").sub.length, 2);
2877
- $mol_assert_equal($mol_tree.fromString("=foo\n\\bar\n").sub[1].data, "bar");
2878
- $mol_assert_equal($mol_tree.fromString("foo bar \\pol").sub[0].sub[0].sub[0].data, "pol");
2879
- $mol_assert_equal($mol_tree.fromString("foo bar\n\t\\pol\n\t\\men").sub[0].sub[0].sub[1].data, "men");
2880
- $mol_assert_equal($mol_tree.fromString('foo bar \\text\n').toString(), 'foo bar \\text\n');
2881
- },
2882
- 'inserting'() {
2883
- $mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, 'a', 'b', 'c').toString(), 'a b \\\n');
2884
- $mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, 'a', 'b', 'c', 'd').toString(), 'a b c \\\n');
2885
- $mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, 0, 0, 0).toString(), 'a b \\\n');
2886
- $mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, 0, 0, 0, 0).toString(), 'a b \\\n\t\\\n');
2887
- $mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, null, null, null).toString(), 'a b \\\n');
2888
- $mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, null, null, null, null).toString(), 'a b \\\n\t\\\n');
2889
- },
2890
- 'fromJSON'() {
2891
- $mol_assert_equal($mol_tree.fromJSON([]).toString(), '/\n');
2892
- $mol_assert_equal($mol_tree.fromJSON([false, true]).toString(), '/\n\tfalse\n\ttrue\n');
2893
- $mol_assert_equal($mol_tree.fromJSON([0, 1, 2.3]).toString(), '/\n\t0\n\t1\n\t2.3\n');
2894
- $mol_assert_equal($mol_tree.fromJSON(['', 'foo', 'bar\nbaz']).toString(), '/\n\t\\\n\t\\foo\n\t\\\n\t\t\\bar\n\t\t\\baz\n');
2895
- $mol_assert_equal($mol_tree.fromJSON({ 'foo': false, 'bar\nbaz': 'lol' }).toString(), '*\n\tfoo false\n\t\\\n\t\t\\bar\n\t\t\\baz\n\t\t\\lol\n');
2896
- },
2897
- 'toJSON'() {
2898
- $mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n').sub[0]), '[]');
2899
- $mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n\tfalse\n\ttrue\n').sub[0]), '[false,true]');
2900
- $mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n\t0\n\t1\n\t2.3\n').sub[0]), '[0,1,2.3]');
2901
- $mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n\t\\\n\t\\foo\n\t\\\n\t\t\\bar\n\t\t\\baz\n').sub[0]), '["","foo","bar\\nbaz"]');
2902
- $mol_assert_equal(JSON.stringify($mol_tree.fromString('*\n\tfoo false\n\t\\\n\t\t\\bar\n\t\t\\baz\n\t\t\\lol\n').sub[0]), '{"foo":false,"bar\\nbaz":"lol"}');
2903
- },
2904
- 'hack'() {
2905
- const res = $mol_tree.fromString(`foo bar xxx`).hack({
2906
- '': (tree, context) => [tree.hack(context)],
2907
- 'bar': (tree, context) => [tree.hack(context).clone({ type: '777' })],
2908
- });
2909
- $mol_assert_equal(res.toString(), new $mol_tree({ type: 'foo 777 xxx' }).toString());
2346
+ 'Vector limiting'() {
2347
+ let point = new $mol_vector_3d(7, 10, 13);
2348
+ const res = point.limited([[1, 5], [15, 20], [5, 10]]);
2349
+ $mol_assert_equal(res.x, 5);
2350
+ $mol_assert_equal(res.y, 15);
2351
+ $mol_assert_equal(res.z, 10);
2910
2352
  },
2911
- 'errors handling'($) {
2912
- const errors = [];
2913
- class Tree extends $mol_tree {
2914
- static $ = $.$mol_ambient({
2915
- $mol_fail: error => errors.push(error.message)
2916
- });
2917
- }
2918
- Tree.fromString(`
2919
- \t \tfoo
2920
- bar \\data
2921
- `, 'test');
2922
- $mol_assert_like(errors, ['Syntax error at test:2\n \tfoo']);
2923
- },
2924
- });
2925
- })($ || ($ = {}));
2926
- //mol/tree/tree.test.ts
2927
- ;
2928
- "use strict";
2929
- var $;
2930
- (function ($) {
2931
- $.$mol_mem_persist = $mol_wire_solid;
2932
- })($ || ($ = {}));
2933
- //mol/mem/persist/persist.ts
2934
- ;
2935
- "use strict";
2936
- var $;
2937
- (function ($) {
2938
- class $mol_storage extends $mol_object2 {
2939
- static native() {
2940
- return this.$.$mol_dom_context.navigator.storage ?? {
2941
- persisted: async () => false,
2942
- persist: async () => false,
2943
- estimate: async () => ({}),
2944
- getDirectory: async () => null,
2945
- };
2946
- }
2947
- static persisted(next, cache) {
2948
- $mol_mem_persist();
2949
- if (cache)
2950
- return Boolean(next);
2951
- const native = this.native();
2952
- if (next && !$mol_mem_cached(() => this.persisted())) {
2953
- native.persist().then(actual => {
2954
- setTimeout(() => this.persisted(actual, 'cache'), 5000);
2955
- if (actual)
2956
- this.$.$mol_log3_done({ place: `$mol_storage`, message: `Persist: Yes` });
2957
- else
2958
- this.$.$mol_log3_fail({ place: `$mol_storage`, message: `Persist: No` });
2959
- });
2960
- }
2961
- return next ?? $mol_wire_sync(native).persisted();
2962
- }
2963
- static estimate() {
2964
- return $mol_wire_sync(this.native() ?? {}).estimate();
2965
- }
2966
- static dir() {
2967
- return $mol_wire_sync(this.native()).getDirectory();
2968
- }
2969
- }
2970
- __decorate([
2971
- $mol_mem
2972
- ], $mol_storage, "native", null);
2973
- __decorate([
2974
- $mol_mem
2975
- ], $mol_storage, "persisted", null);
2976
- $.$mol_storage = $mol_storage;
2977
- })($ || ($ = {}));
2978
- //mol/storage/storage.ts
2979
- ;
2980
- "use strict";
2981
- var $;
2982
- (function ($) {
2983
- class $mol_state_local extends $mol_object {
2984
- static 'native()';
2985
- static native() {
2986
- if (this['native()'])
2987
- return this['native()'];
2988
- check: try {
2989
- const native = $mol_dom_context.localStorage;
2990
- if (!native)
2991
- break check;
2992
- native.setItem('', '');
2993
- native.removeItem('');
2994
- return this['native()'] = native;
2995
- }
2996
- catch (error) {
2997
- console.warn(error);
2998
- }
2999
- return this['native()'] = {
3000
- getItem(key) {
3001
- return this[':' + key];
3002
- },
3003
- setItem(key, value) {
3004
- this[':' + key] = value;
3005
- },
3006
- removeItem(key) {
3007
- this[':' + key] = void 0;
3008
- }
3009
- };
3010
- }
3011
- static changes(next) { return next; }
3012
- static value(key, next) {
3013
- this.changes();
3014
- if (next === void 0)
3015
- return JSON.parse(this.native().getItem(key) || 'null');
3016
- if (next === null) {
3017
- this.native().removeItem(key);
3018
- }
3019
- else {
3020
- this.native().setItem(key, JSON.stringify(next));
3021
- this.$.$mol_storage.persisted(true);
3022
- }
3023
- return next;
3024
- }
3025
- prefix() { return ''; }
3026
- value(key, next) {
3027
- return $mol_state_local.value(this.prefix() + '.' + key, next);
3028
- }
3029
- }
3030
- __decorate([
3031
- $mol_mem
3032
- ], $mol_state_local, "changes", null);
3033
- __decorate([
3034
- $mol_mem_key
3035
- ], $mol_state_local, "value", null);
3036
- $.$mol_state_local = $mol_state_local;
3037
- })($ || ($ = {}));
3038
- //mol/state/local/local.ts
3039
- ;
3040
- "use strict";
3041
- var $;
3042
- (function ($) {
3043
- self.addEventListener('storage', event => $.$mol_state_local.changes(event));
3044
- })($ || ($ = {}));
3045
- //mol/state/local/local.web.ts
3046
- ;
3047
- "use strict";
3048
- var $;
3049
- (function ($) {
3050
- $mol_test({
3051
- 'local get set delete'() {
3052
- var key = '$mol_state_local_test:' + Math.random();
3053
- $mol_assert_equal($mol_state_local.value(key), null);
3054
- $mol_state_local.value(key, 123);
3055
- $mol_assert_equal($mol_state_local.value(key), 123);
3056
- $mol_state_local.value(key, null);
3057
- $mol_assert_equal($mol_state_local.value(key), null);
3058
- },
3059
- });
3060
- })($ || ($ = {}));
3061
- //mol/state/local/local.test.ts
3062
- ;
3063
- "use strict";
3064
- var $;
3065
- (function ($) {
3066
- $mol_test_mocks.push(context => {
3067
- class $mol_state_local_mock extends $mol_state_local {
3068
- static state = {};
3069
- static value(key, next = this.state[key]) {
3070
- return this.state[key] = (next || null);
3071
- }
3072
- }
3073
- __decorate([
3074
- $mol_mem_key
3075
- ], $mol_state_local_mock, "value", null);
3076
- context.$mol_state_local = $mol_state_local_mock;
3077
- });
3078
- })($ || ($ = {}));
3079
- //mol/state/local/local.mock.test.ts
3080
- ;
3081
- "use strict";
3082
- //mol/charset/encoding/encoding.ts
3083
- ;
3084
- "use strict";
3085
- var $;
3086
- (function ($) {
3087
- const decoders = {};
3088
- function $mol_charset_decode(buffer, encoding = 'utf8') {
3089
- let decoder = decoders[encoding];
3090
- if (!decoder)
3091
- decoder = decoders[encoding] = new TextDecoder(encoding);
3092
- return decoder.decode(buffer);
3093
- }
3094
- $.$mol_charset_decode = $mol_charset_decode;
3095
- })($ || ($ = {}));
3096
- //mol/charset/decode/decode.ts
3097
- ;
3098
- "use strict";
3099
- var $;
3100
- (function ($) {
3101
- $mol_test({
3102
- 'decode utf8 string'() {
3103
- const str = 'Hello, ΧΨΩЫ';
3104
- const encoded = new Uint8Array([72, 101, 108, 108, 111, 44, 32, 206, 167, 206, 168, 206, 169, 208, 171]);
3105
- $mol_assert_equal($mol_charset_decode(encoded), str);
3106
- $mol_assert_equal($mol_charset_decode(encoded, 'utf8'), str);
3107
- },
3108
- 'decode empty string'() {
3109
- const encoded = new Uint8Array([]);
3110
- $mol_assert_equal($mol_charset_decode(encoded), '');
3111
- },
3112
- });
3113
- })($ || ($ = {}));
3114
- //mol/charset/decode/decode.test.ts
3115
- ;
3116
- "use strict";
3117
- //node/node.ts
3118
- ;
3119
- "use strict";
3120
- var $node = $node || {};
3121
- //node/node.web.ts
3122
- ;
3123
- "use strict";
3124
- var $;
3125
- (function ($) {
3126
- const TextEncoder = globalThis.TextEncoder ?? $node.util.TextEncoder;
3127
- const encoder = new TextEncoder();
3128
- function $mol_charset_encode(value) {
3129
- return encoder.encode(value);
3130
- }
3131
- $.$mol_charset_encode = $mol_charset_encode;
3132
- })($ || ($ = {}));
3133
- //mol/charset/encode/encode.ts
3134
- ;
3135
- "use strict";
3136
- var $;
3137
- (function ($) {
3138
- $mol_test({
3139
- 'encode utf8 string'() {
3140
- const str = 'Hello, ΧΨΩЫ';
3141
- const encoded = new Uint8Array([72, 101, 108, 108, 111, 44, 32, 206, 167, 206, 168, 206, 169, 208, 171]);
3142
- $mol_assert_like($mol_charset_encode(str), encoded);
3143
- },
3144
- });
3145
- })($ || ($ = {}));
3146
- //mol/charset/encode/encode.test.ts
3147
- ;
3148
- "use strict";
3149
- var $;
3150
- (function ($) {
3151
- class $mol_file_not_found extends Error {
3152
- }
3153
- $.$mol_file_not_found = $mol_file_not_found;
3154
- class $mol_file extends $mol_object {
3155
- static absolute(path) {
3156
- throw new Error('Not implemented yet');
3157
- }
3158
- static relative(path) {
3159
- throw new Error('Not implemented yet');
3160
- }
3161
- static base = '';
3162
- path() {
3163
- return '.';
3164
- }
3165
- parent() {
3166
- return this.resolve('..');
3167
- }
3168
- reset() {
3169
- try {
3170
- this.stat(null);
3171
- }
3172
- catch (error) {
3173
- if (error instanceof $mol_file_not_found)
3174
- return;
3175
- return $mol_fail_hidden(error);
3176
- }
3177
- }
3178
- version() {
3179
- return this.stat()?.mtime.getTime().toString(36).toUpperCase() ?? '';
3180
- }
3181
- watcher() {
3182
- console.warn('$mol_file_web.watcher() not implemented');
3183
- return {
3184
- destructor() { }
3185
- };
3186
- }
3187
- exists(next) {
3188
- let exists = Boolean(this.stat());
3189
- if (next === undefined)
3190
- return exists;
3191
- if (next === exists)
3192
- return exists;
3193
- if (next)
3194
- this.parent().exists(true);
3195
- this.ensure();
3196
- this.reset();
3197
- return next;
3198
- }
3199
- type() {
3200
- return this.stat()?.type ?? '';
3201
- }
3202
- name() {
3203
- return this.path().replace(/^.*\//, '');
3204
- }
3205
- ext() {
3206
- const match = /((?:\.\w+)+)$/.exec(this.path());
3207
- return match ? match[1].substring(1) : '';
3208
- }
3209
- text(next, virt) {
3210
- if (virt) {
3211
- const now = new Date;
3212
- this.stat({
3213
- type: 'file',
3214
- size: 0,
3215
- atime: now,
3216
- mtime: now,
3217
- ctime: now,
3218
- }, 'virt');
3219
- return next;
3220
- }
3221
- if (next === undefined) {
3222
- return $mol_charset_decode(this.buffer(undefined));
3223
- }
3224
- else {
3225
- const buffer = next === undefined ? undefined : $mol_charset_encode(next);
3226
- this.buffer(buffer);
3227
- return next;
3228
- }
3229
- }
3230
- find(include, exclude) {
3231
- const found = [];
3232
- const sub = this.sub();
3233
- for (const child of sub) {
3234
- const child_path = child.path();
3235
- if (exclude && child_path.match(exclude))
3236
- continue;
3237
- if (!include || child_path.match(include))
3238
- found.push(child);
3239
- if (child.type() === 'dir') {
3240
- const sub_child = child.find(include, exclude);
3241
- for (const child of sub_child)
3242
- found.push(child);
3243
- }
3244
- }
3245
- return found;
3246
- }
3247
- size() {
3248
- switch (this.type()) {
3249
- case 'file': return this.stat()?.size ?? 0;
3250
- default: return 0;
3251
- }
3252
- }
3253
- }
3254
- __decorate([
3255
- $mol_mem
3256
- ], $mol_file.prototype, "exists", null);
3257
- __decorate([
3258
- $mol_mem
3259
- ], $mol_file.prototype, "text", null);
3260
- __decorate([
3261
- $mol_mem_key
3262
- ], $mol_file, "absolute", null);
3263
- $.$mol_file = $mol_file;
3264
- })($ || ($ = {}));
3265
- //mol/file/file.ts
3266
- ;
3267
- "use strict";
3268
- var $;
3269
- (function ($) {
3270
- $.$mol_action = $mol_wire_method;
3271
- })($ || ($ = {}));
3272
- //mol/action/action.ts
3273
- ;
3274
- "use strict";
3275
- var $;
3276
- (function ($) {
3277
- function $mol_dom_parse(text, type = 'application/xhtml+xml') {
3278
- const parser = new $mol_dom_context.DOMParser();
3279
- const doc = parser.parseFromString(text, type);
3280
- const error = doc.getElementsByTagName('parsererror');
3281
- if (error.length)
3282
- throw new Error(error[0].textContent);
3283
- return doc;
3284
- }
3285
- $.$mol_dom_parse = $mol_dom_parse;
3286
- })($ || ($ = {}));
3287
- //mol/dom/parse/parse.ts
3288
- ;
3289
- "use strict";
3290
- var $;
3291
- (function ($) {
3292
- class $mol_fetch_response extends $mol_object2 {
3293
- native;
3294
- constructor(native) {
3295
- super();
3296
- this.native = native;
3297
- }
3298
- status() {
3299
- const types = ['unknown', 'inform', 'success', 'redirect', 'wrong', 'failed'];
3300
- return types[Math.floor(this.native.status / 100)];
3301
- }
3302
- code() {
3303
- return this.native.status;
3304
- }
3305
- message() {
3306
- return this.native.statusText || `HTTP Error ${this.code()}`;
3307
- }
3308
- headers() {
3309
- return this.native.headers;
3310
- }
3311
- mime() {
3312
- return this.headers().get('content-type');
3313
- }
3314
- stream() {
3315
- return this.native.body;
3316
- }
3317
- text() {
3318
- const buffer = this.buffer();
3319
- const native = this.native;
3320
- const mime = native.headers.get('content-type') || '';
3321
- const [, charset] = /charset=(.*)/.exec(mime) || [, 'utf-8'];
3322
- const decoder = new TextDecoder(charset);
3323
- return decoder.decode(buffer);
3324
- }
3325
- json() {
3326
- return $mol_wire_sync(this.native).json();
3327
- }
3328
- buffer() {
3329
- return $mol_wire_sync(this.native).arrayBuffer();
3330
- }
3331
- xml() {
3332
- return $mol_dom_parse(this.text(), 'application/xml');
3333
- }
3334
- xhtml() {
3335
- return $mol_dom_parse(this.text(), 'application/xhtml+xml');
3336
- }
3337
- html() {
3338
- return $mol_dom_parse(this.text(), 'text/html');
3339
- }
3340
- }
3341
- __decorate([
3342
- $mol_action
3343
- ], $mol_fetch_response.prototype, "stream", null);
3344
- __decorate([
3345
- $mol_action
3346
- ], $mol_fetch_response.prototype, "text", null);
3347
- __decorate([
3348
- $mol_action
3349
- ], $mol_fetch_response.prototype, "buffer", null);
3350
- __decorate([
3351
- $mol_action
3352
- ], $mol_fetch_response.prototype, "xml", null);
3353
- __decorate([
3354
- $mol_action
3355
- ], $mol_fetch_response.prototype, "xhtml", null);
3356
- __decorate([
3357
- $mol_action
3358
- ], $mol_fetch_response.prototype, "html", null);
3359
- $.$mol_fetch_response = $mol_fetch_response;
3360
- class $mol_fetch extends $mol_object2 {
3361
- static request(input, init = {}) {
3362
- const native = globalThis.fetch ?? $node['undici'].fetch;
3363
- const controller = new AbortController();
3364
- let done = false;
3365
- const promise = native(input, {
3366
- ...init,
3367
- signal: controller.signal,
3368
- }).finally(() => {
3369
- done = true;
3370
- });
3371
- return Object.assign(promise, {
3372
- destructor: () => {
3373
- if (!done && !controller.signal.aborted)
3374
- controller.abort();
3375
- },
3376
- });
3377
- }
3378
- static response(input, init) {
3379
- return new $mol_fetch_response($mol_wire_sync(this).request(input, init));
3380
- }
3381
- static success(input, init) {
3382
- const response = this.response(input, init);
3383
- if (response.status() === 'success')
3384
- return response;
3385
- throw new Error(response.message());
3386
- }
3387
- static stream(input, init) {
3388
- return this.success(input, init).stream();
3389
- }
3390
- static text(input, init) {
3391
- return this.success(input, init).text();
3392
- }
3393
- static json(input, init) {
3394
- return this.success(input, init).json();
3395
- }
3396
- static buffer(input, init) {
3397
- return this.success(input, init).buffer();
3398
- }
3399
- static xml(input, init) {
3400
- return this.success(input, init).xml();
3401
- }
3402
- static xhtml(input, init) {
3403
- return this.success(input, init).xhtml();
3404
- }
3405
- static html(input, init) {
3406
- return this.success(input, init).html();
3407
- }
3408
- }
3409
- __decorate([
3410
- $mol_action
3411
- ], $mol_fetch, "response", null);
3412
- __decorate([
3413
- $mol_action
3414
- ], $mol_fetch, "success", null);
3415
- __decorate([
3416
- $mol_action
3417
- ], $mol_fetch, "stream", null);
3418
- __decorate([
3419
- $mol_action
3420
- ], $mol_fetch, "text", null);
3421
- __decorate([
3422
- $mol_action
3423
- ], $mol_fetch, "json", null);
3424
- __decorate([
3425
- $mol_action
3426
- ], $mol_fetch, "buffer", null);
3427
- __decorate([
3428
- $mol_action
3429
- ], $mol_fetch, "xml", null);
3430
- __decorate([
3431
- $mol_action
3432
- ], $mol_fetch, "xhtml", null);
3433
- __decorate([
3434
- $mol_action
3435
- ], $mol_fetch, "html", null);
3436
- $.$mol_fetch = $mol_fetch;
3437
- })($ || ($ = {}));
3438
- //mol/fetch/fetch.ts
3439
- ;
3440
- "use strict";
3441
- var $;
3442
- (function ($) {
3443
- class $mol_file_web extends $mol_file {
3444
- static absolute(path) {
3445
- return this.make({
3446
- path: $mol_const(path)
3447
- });
3448
- }
3449
- static relative(path) {
3450
- return this.absolute(new URL(path, this.base).toString());
3451
- }
3452
- static base = $mol_dom_context.document?.currentScript
3453
- ? new URL('.', $mol_dom_context.document.currentScript['src']).toString()
3454
- : '';
3455
- buffer(next) {
3456
- if (next !== undefined)
3457
- throw new Error(`Saving content not supported: ${this.path}`);
3458
- const response = $mol_fetch.response(this.path());
3459
- if (response.native.status === 404)
3460
- throw new $mol_file_not_found(`File not found: ${this.path()}`);
3461
- return new Uint8Array(response.buffer());
3462
- }
3463
- stat(next, virt) {
3464
- let stat = next;
3465
- if (next === undefined) {
3466
- const content = this.text();
3467
- const ctime = new Date();
3468
- stat = {
3469
- type: 'file',
3470
- size: content.length,
3471
- ctime,
3472
- atime: ctime,
3473
- mtime: ctime
3474
- };
3475
- }
3476
- this.parent().watcher();
3477
- return stat;
3478
- }
3479
- resolve(path) {
3480
- let res = this.path() + '/' + path;
3481
- while (true) {
3482
- let prev = res;
3483
- res = res.replace(/\/[^\/.]+\/\.\.\//, '/');
3484
- if (prev === res)
3485
- break;
3486
- }
3487
- return this.constructor.absolute(res);
3488
- }
3489
- ensure() {
3490
- throw new Error('$mol_file_web.ensure() not implemented');
3491
- }
3492
- sub() {
3493
- throw new Error('$mol_file_web.sub() not implemented');
3494
- }
3495
- relate(base = this.constructor.relative('.')) {
3496
- throw new Error('$mol_file_web.relate() not implemented');
3497
- }
3498
- append(next) {
3499
- throw new Error('$mol_file_web.append() not implemented');
3500
- }
3501
- }
3502
- __decorate([
3503
- $mol_mem
3504
- ], $mol_file_web.prototype, "buffer", null);
3505
- __decorate([
3506
- $mol_mem
3507
- ], $mol_file_web.prototype, "stat", null);
3508
- __decorate([
3509
- $mol_mem
3510
- ], $mol_file_web.prototype, "sub", null);
3511
- __decorate([
3512
- $mol_mem_key
3513
- ], $mol_file_web, "absolute", null);
3514
- $.$mol_file_web = $mol_file_web;
3515
- $.$mol_file = $mol_file_web;
3516
- })($ || ($ = {}));
3517
- //mol/file/file.web.ts
3518
- ;
3519
- "use strict";
3520
- var $;
3521
- (function ($) {
3522
- class $mol_locale extends $mol_object {
3523
- static lang_default() {
3524
- return 'en';
3525
- }
3526
- static lang(next) {
3527
- return this.$.$mol_state_local.value('locale', next) || $mol_dom_context.navigator.language.replace(/-.*/, '') || this.lang_default();
3528
- }
3529
- static source(lang) {
3530
- return JSON.parse(this.$.$mol_file.relative(`web.locale=${lang}.json`).text().toString());
3531
- }
3532
- static texts(lang, next) {
3533
- if (next)
3534
- return next;
3535
- try {
3536
- return this.source(lang).valueOf();
3537
- }
3538
- catch (error) {
3539
- if ($mol_fail_catch(error)) {
3540
- const def = this.lang_default();
3541
- if (lang === def)
3542
- throw error;
3543
- }
3544
- }
3545
- return {};
3546
- }
3547
- static text(key) {
3548
- const lang = this.lang();
3549
- const target = this.texts(lang)[key];
3550
- if (target)
3551
- return target;
3552
- this.warn(key);
3553
- const en = this.texts('en')[key];
3554
- if (!en)
3555
- return key;
3556
- return en;
3557
- }
3558
- static warn(key) {
3559
- console.warn(`Not translated to "${this.lang()}": ${key}`);
3560
- return null;
3561
- }
3562
- }
3563
- __decorate([
3564
- $mol_mem
3565
- ], $mol_locale, "lang_default", null);
3566
- __decorate([
3567
- $mol_mem
3568
- ], $mol_locale, "lang", null);
3569
- __decorate([
3570
- $mol_mem_key
3571
- ], $mol_locale, "source", null);
3572
- __decorate([
3573
- $mol_mem_key
3574
- ], $mol_locale, "texts", null);
3575
- __decorate([
3576
- $mol_mem_key
3577
- ], $mol_locale, "text", null);
3578
- __decorate([
3579
- $mol_mem_key
3580
- ], $mol_locale, "warn", null);
3581
- $.$mol_locale = $mol_locale;
3582
- })($ || ($ = {}));
3583
- //mol/locale/locale.ts
3584
- ;
3585
- "use strict";
3586
- var $;
3587
- (function ($_1) {
3588
- $mol_test_mocks.push($ => {
3589
- class $mol_locale_mock extends $mol_locale {
3590
- lang(next = 'en') { return next; }
3591
- static source(lang) {
3592
- return {};
3593
- }
3594
- }
3595
- __decorate([
3596
- $mol_mem
3597
- ], $mol_locale_mock.prototype, "lang", null);
3598
- __decorate([
3599
- $mol_mem_key
3600
- ], $mol_locale_mock, "source", null);
3601
- $.$mol_locale = $mol_locale_mock;
3602
- });
3603
- })($ || ($ = {}));
3604
- //mol/locale/locale.test.ts
3605
- ;
3606
- "use strict";
3607
- var $;
3608
- (function ($) {
3609
- function $mol_view_tree_trim_remarks(def) {
3610
- return def.transform(([node], sub) => (node.type === '-') ? null : node.clone({ sub: sub() }));
3611
- }
3612
- $.$mol_view_tree_trim_remarks = $mol_view_tree_trim_remarks;
3613
- function $mol_view_tree_classes(defs) {
3614
- return $mol_view_tree_trim_remarks(defs);
3615
- }
3616
- $.$mol_view_tree_classes = $mol_view_tree_classes;
3617
- function $mol_view_tree_class_name(val) {
3618
- return val.type;
3619
- }
3620
- $.$mol_view_tree_class_name = $mol_view_tree_class_name;
3621
- function $mol_view_tree_super_name(val) {
3622
- if (val.sub.length != 1)
3623
- throw val.error('Wrong sub count');
3624
- return val.sub[0].type;
3625
- }
3626
- $.$mol_view_tree_super_name = $mol_view_tree_super_name;
3627
- function $mol_view_tree_class_props(def) {
3628
- const props = {};
3629
- const catch_prop = (prop, type = '') => {
3630
- let def = prop;
3631
- if (type === '=>') {
3632
- if (prop.sub[0])
3633
- throw prop.error('Right binding can not have default value');
3634
- }
3635
- else {
3636
- if (prop.sub.length === 0)
3637
- return;
3638
- if (prop.sub[0].type === '-')
3639
- return;
3640
- props[prop.type] = props[prop.type];
3641
- def = prop.clone({
3642
- sub: [prop.sub[0].transform(([node, ...stack], sub) => {
3643
- if (['<=', '<=>', '=>'].indexOf(node.type) === -1)
3644
- return node.clone({ sub: sub() });
3645
- catch_prop(node.sub[0], node.type);
3646
- return node.clone({
3647
- sub: [node.sub[0].clone({
3648
- sub: []
3649
- })]
3650
- });
3651
- })]
3652
- });
3653
- }
3654
- if (props[prop.type]) {
3655
- if (props[prop.type].toString() !== def.toString()) {
3656
- throw def.error('Property already defined with another default value' + props[prop.type].error('').message + '\n---');
3657
- }
3658
- }
3659
- else {
3660
- props[prop.type] = def;
3661
- }
3662
- };
3663
- def.sub[0].sub.map(sub => catch_prop(sub));
3664
- return def.clone({
3665
- type: '',
3666
- sub: Object.keys(props).map(name => props[name]),
3667
- });
3668
- }
3669
- $.$mol_view_tree_class_props = $mol_view_tree_class_props;
3670
- function $mol_view_tree_prop_name(prop) {
3671
- return (prop.type.match(/^\w+/) || [])[0] || '';
3672
- }
3673
- $.$mol_view_tree_prop_name = $mol_view_tree_prop_name;
3674
- function $mol_view_tree_prop_key(prop) {
3675
- return (prop.type.match(/!(\w+)$/) || [])[1] || '';
3676
- }
3677
- $.$mol_view_tree_prop_key = $mol_view_tree_prop_key;
3678
- function $mol_view_tree_prop_next(prop) {
3679
- return (prop.type.match(/\?(\w+)$/) || [])[1] || '';
3680
- }
3681
- $.$mol_view_tree_prop_next = $mol_view_tree_prop_next;
3682
- function $mol_view_tree_prop_value(prop) {
3683
- if (prop.sub.length != 1)
3684
- throw prop.error(`Wrong sub count (${prop.sub.length})`);
3685
- return prop.sub[0];
3686
- }
3687
- $.$mol_view_tree_prop_value = $mol_view_tree_prop_value;
3688
- function $mol_view_tree_value_type(val) {
3689
- switch (val.type) {
3690
- case 'true': return 'bool';
3691
- case 'false': return 'bool';
3692
- case 'null': return 'null';
3693
- case '*': return 'dict';
3694
- case '@': return 'locale';
3695
- case '': return 'string';
3696
- case '<=': return 'get';
3697
- case '<=>': return 'bind';
3698
- case '=>': return 'put';
3699
- }
3700
- switch (val.type[0]) {
3701
- case '/': return 'list';
3702
- case '$': return 'object';
3703
- }
3704
- if (Number(val.type).toString() == val.type)
3705
- return 'number';
3706
- throw val.error('Wrong value');
3707
- }
3708
- $.$mol_view_tree_value_type = $mol_view_tree_value_type;
3709
- function $mol_view_tree_compile(tree) {
3710
- const splittedUri = tree.uri.split(/[#\\\/]/);
3711
- splittedUri.pop();
3712
- const fileName = splittedUri.pop();
3713
- const SourceNode = (row, col, fileName, text) => text;
3714
- var content = [];
3715
- var locales = {};
3716
- for (let def of $mol_view_tree_classes(tree).sub) {
3717
- if (!/^\$\w+$/.test(def.type))
3718
- throw def.error('Wrong component name');
3719
- const parent = def.sub[0];
3720
- const members = {};
3721
- for (let param of $mol_view_tree_class_props(def).sub) {
3722
- try {
3723
- var needSet = false;
3724
- var needCache = false;
3725
- if (param.type === '<=>') {
3726
- param = param.sub[0];
3727
- }
3728
- if (param.type === '<=') {
3729
- param = param.sub[0];
3730
- }
3731
- var propName = /(.*?)(?:\!(\w+))?(?:\?(\w+))?$/.exec(param.type);
3732
- if (propName[3]) {
3733
- needSet = true;
3734
- needCache = true;
3735
- }
3736
- const getValue = (value, definition) => {
3737
- try {
3738
- switch (true) {
3739
- case (value.type === ''):
3740
- return [JSON.stringify(value.value)];
3741
- case (value.type === '@'):
3742
- const key = `${def.type}_${param.type.replace(/[?!].*/, '')}`;
3743
- locales[key] = value.value;
3744
- return [`this.$.$mol_locale.text( ${JSON.stringify(key)} )`];
3745
- case (value.type === '-'):
3746
- return null;
3747
- case (value.type[0] === '/'):
3748
- const item_type = value.type.substring(1);
3749
- var items = [];
3750
- value.sub.forEach(item => {
3751
- if (item.type === '-')
3752
- return;
3753
- if (item.type === '^') {
3754
- items.push(`...super.${param.type}()`);
3755
- return;
3756
- }
3757
- var val = getValue(item);
3758
- if (val)
3759
- items.push(val.join(""));
3760
- });
3761
- return [`[`, items.join(' , '), `]`, (item_type ? ` as ( ${item_type} )[]` : ` as any[]`)];
3762
- case (value.type[0] === '$'):
3763
- if (!definition)
3764
- throw value.error('Objects should be bound');
3765
- needCache = true;
3766
- const overs = [];
3767
- value.sub.forEach(over => {
3768
- if (/^[-\/]?$/.test(over.type))
3769
- return '';
3770
- var overName = /(.*?)(?:\!(\w+))?(?:\?(\w+))?$/.exec(over.type);
3771
- var ns = needSet;
3772
- if (over.sub[0].type === '=>') {
3773
- if (over.sub[0].sub.length === 1) {
3774
- const [, own_name, own_key, own_next] = /(.*?)(?:\!(\w+))?(?:\?(\w+))?$/.exec(over.sub[0].sub[0].type);
3775
- let own_args = [];
3776
- if (own_key)
3777
- own_args.push(` ${own_key} : any `);
3778
- if (own_next)
3779
- own_args.push(` ${own_next}? : any `);
3780
- let [, their_name, ...their_args] = /(.*?)(?:\!(\w+))?(?:\?(\w+))?$/.exec(over.type);
3781
- their_args = their_args.filter(Boolean);
3782
- members[own_name] = [`\t${own_name}(${own_args.join(',')}) {\n\t\treturn this.${propName[1]}(${propName[2] || ''}).${their_name}( ${their_args.join(' , ')} )\n\t}\n\n`];
3783
- return;
3784
- }
3785
- }
3786
- var v = getValue(over.sub[0]);
3787
- let args = [];
3788
- if (overName[2])
3789
- args.push(` ${overName[2]} : any `);
3790
- if (overName[3])
3791
- args.push(` ${overName[3]}? : any `);
3792
- overs.push(...['\t\t\tobj.', SourceNode(over.row, over.col, fileName, overName[1]), ' = (', args.join(','), ') => ', ...(v || []), '\n']);
3793
- needSet = ns;
3794
- });
3795
- const object_args = value.select('/', '').sub.map(arg => getValue(arg)).join(' , ');
3796
- return ['(( obj )=>{\n', ...overs, '\t\t\treturn obj\n\t\t})( new this.$.', SourceNode(value.row, value.col, fileName, value.type), '( ', object_args, ' ) )'];
3797
- case (value.type === '*'):
3798
- const opts = [];
3799
- for (const opt of value.sub) {
3800
- if (opt.type === '-')
3801
- continue;
3802
- if (opt.type === '^') {
3803
- opts.push(`\t\t\t...super.${param.type}() ,\n`);
3804
- continue;
3805
- }
3806
- const key = /(.*?)(?:\?(\w+))?$/.exec(opt.type);
3807
- const ns = needSet;
3808
- const v = getValue(opt.sub[0]);
3809
- const arg = key[2] ? ` ( ${key[2]}? : any )=> ` : '';
3810
- opts.push(...[
3811
- '\t\t\t"',
3812
- SourceNode(opt.row, opt.col, fileName, key[1] + '" : '),
3813
- arg,
3814
- ' ',
3815
- ...(v || []),
3816
- ' ,\n'
3817
- ]);
3818
- needSet = ns;
3819
- }
3820
- return ['({\n', opts.join(''), '\t\t})'];
3821
- case (value.type === '<=>'):
3822
- if (value.sub.length === 1) {
3823
- var type = /(.*?)(?:\!(\w+))?(?:\?(\w+))$/.exec(value.sub[0].type);
3824
- return ['this.' + type[1] + '(' + (type[2] ? type[2] + ' ,' : '') + ' ' + type[3] + ' )'];
3825
- }
3826
- break;
3827
- case (value.type === '<='):
3828
- if (value.sub.length === 1) {
3829
- var type = /(.*?)(?:\!(\w+))?(?:\?(\w+))?$/.exec(value.sub[0].type);
3830
- return ['this.' + type[1] + '(' + (type[2] ? type[2] : '') + ')'];
3831
- }
3832
- break;
3833
- }
3834
- switch (value.type) {
3835
- case 'true':
3836
- case 'false':
3837
- return [value.type];
3838
- case 'null':
3839
- return ['null as any'];
3840
- }
3841
- if (Number(value.type).toString() == value.type)
3842
- return [value.type];
3843
- throw value.error('Wrong value');
3844
- }
3845
- catch (err) {
3846
- throw err;
3847
- }
3848
- };
3849
- if (param.sub.length > 1)
3850
- throw new Error('Too more sub');
3851
- param.sub.forEach(child => {
3852
- var val = getValue(child, true);
3853
- if (!val)
3854
- return;
3855
- var args = [];
3856
- if (propName[2])
3857
- args.push(` ${propName[2]} : any `);
3858
- if (propName[3])
3859
- args.push(` ${propName[3]}? : any , force? : $${''}mol_mem_force `);
3860
- if (needSet)
3861
- val = [
3862
- `( ${propName[3]} !== void 0 ) ? ${propName[3]} : `,
3863
- ...val
3864
- ];
3865
- val = ['return ', ...val];
3866
- let decl = ['\t', SourceNode(param.row, param.col, fileName, propName[1]), '(', args.join(','), ') {\n\t\t', ...val, '\n\t}\n\n'];
3867
- if (needCache) {
3868
- if (propName[2])
3869
- decl = ['\t@ $', 'mol_mem_key\n', ...decl];
3870
- else
3871
- decl = ['\t@ $', 'mol_mem\n', ...decl];
3872
- }
3873
- decl = ['\t/**\n\t * ```\n', param.toString().trim().replace(/^/mg, '\t * '), '\n\t * ```\n\t **/\n', ...decl];
3874
- members[propName[1]] = decl;
3875
- });
3876
- }
3877
- catch (err) {
3878
- throw err;
3879
- }
3880
- }
3881
- var body = Object.keys(members).reduce(function (acc, name) {
3882
- const items = members[name] ? members[name] : ['\t', name, '() { return null as any }\n\t}\n'];
3883
- return [...acc, ...items];
3884
- }, []);
3885
- var classes = ['namespace $ { export class ', SourceNode(def.row, def.col, fileName, def.type), ' extends ', SourceNode(parent.row, parent.col, fileName, parent.type), ' {\n\n', ...body, '} }\n'];
3886
- content = [...content, ...classes];
3887
- }
3888
- return { script: content.join(''), locales };
3889
- }
3890
- $.$mol_view_tree_compile = $mol_view_tree_compile;
3891
- })($ || ($ = {}));
3892
- //mol/view/tree/tree.ts
3893
- ;
3894
- "use strict";
3895
- var $;
3896
- (function ($) {
3897
- $mol_test({
3898
- 'Vector limiting'() {
3899
- let point = new $mol_vector_3d(7, 10, 13);
3900
- const res = point.limited([[1, 5], [15, 20], [5, 10]]);
3901
- $mol_assert_equal(res.x, 5);
3902
- $mol_assert_equal(res.y, 15);
3903
- $mol_assert_equal(res.z, 10);
3904
- },
3905
- 'Vector adding scalar'() {
3906
- let point = new $mol_vector_3d(1, 2, 3);
3907
- let res = point.added0(5);
3908
- $mol_assert_equal(res.x, 6);
3909
- $mol_assert_equal(res.y, 7);
3910
- $mol_assert_equal(res.z, 8);
2353
+ 'Vector adding scalar'() {
2354
+ let point = new $mol_vector_3d(1, 2, 3);
2355
+ let res = point.added0(5);
2356
+ $mol_assert_equal(res.x, 6);
2357
+ $mol_assert_equal(res.y, 7);
2358
+ $mol_assert_equal(res.z, 8);
3911
2359
  },
3912
2360
  'Vector adding vector'() {
3913
2361
  let point = new $mol_vector_3d(1, 2, 3);
@@ -3979,6 +2427,9 @@ var $;
3979
2427
  },
3980
2428
  });
3981
2429
  })($ || ($ = {}));
3982
- //mol/vector/vector.test.ts
2430
+
2431
+ ;
2432
+ "use strict";
2433
+
3983
2434
 
3984
2435
  //# sourceMappingURL=web.test.js.map