mol_tree2 1.0.930 → 1.0.932

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.test.js CHANGED
@@ -647,610 +647,10 @@ var $;
647
647
  "use strict";
648
648
  var $;
649
649
  (function ($) {
650
- class $mol_view_tree2_error extends Error {
651
- spans;
652
- constructor(message, spans) {
653
- super(message);
654
- this.spans = spans;
655
- }
656
- toJSON() {
657
- return {
658
- message: this.message,
659
- spans: this.spans
660
- };
661
- }
662
- }
663
- $.$mol_view_tree2_error = $mol_view_tree2_error;
664
- class $mol_view_tree2_error_suggestions {
665
- suggestions;
666
- constructor(suggestions) {
667
- this.suggestions = suggestions;
668
- }
669
- toString() {
670
- return this.suggestions.map(suggestion => `\`${suggestion}\``).join(', ');
671
- }
672
- toJSON() {
673
- return this.suggestions;
674
- }
675
- }
676
- $.$mol_view_tree2_error_suggestions = $mol_view_tree2_error_suggestions;
677
- function $mol_view_tree2_error_str(strings, ...parts) {
678
- const spans = [];
679
- for (const part of parts) {
680
- if (part instanceof $mol_span)
681
- spans.push(part);
682
- if (Array.isArray(part) && part.length > 0 && part[0] instanceof $mol_span)
683
- spans.push(...part);
684
- }
685
- return new $mol_view_tree2_error(join(strings, parts), spans);
686
- }
687
- $.$mol_view_tree2_error_str = $mol_view_tree2_error_str;
688
- function join(strings, objects) {
689
- let result = '';
690
- let obj_pos = 0;
691
- let obj_len = objects.length;
692
- for (const str of strings) {
693
- result += str;
694
- if (obj_pos < obj_len) {
695
- const obj = objects[obj_pos++];
696
- if (Array.isArray(obj))
697
- result += obj.map(item => `\`${item}\``).join(', ');
698
- else
699
- result += `\`${String(obj)}\``;
700
- }
701
- }
702
- return result;
703
- }
704
- })($ || ($ = {}));
705
-
706
- ;
707
- "use strict";
708
- var $;
709
- (function ($) {
710
- function $mol_view_tree2_child(tree) {
711
- if (tree.kids.length === 0) {
712
- return this.$mol_fail($mol_view_tree2_error_str `Required one child at ${tree.span}`);
713
- }
714
- if (tree.kids.length > 1) {
715
- return this.$mol_fail($mol_view_tree2_error_str `Should be only one child at ${tree.span}`);
716
- }
717
- return tree.kids[0];
718
- }
719
- $.$mol_view_tree2_child = $mol_view_tree2_child;
720
- })($ || ($ = {}));
721
-
722
- ;
723
- "use strict";
724
- var $;
725
- (function ($) {
726
- function $mol_view_tree2_classes(defs) {
727
- return defs.clone(defs.hack({
728
- '-': () => []
729
- }));
730
- }
731
- $.$mol_view_tree2_classes = $mol_view_tree2_classes;
732
- })($ || ($ = {}));
733
-
734
- ;
735
- "use strict";
736
- var $;
737
- (function ($) {
738
- function $mol_view_tree2_normalize(defs) {
739
- return defs.clone($mol_view_tree2_classes(defs).kids.map(cl => cl.clone([
740
- this.$mol_view_tree2_class_super(cl).clone(this.$mol_view_tree2_class_props(cl))
741
- ])));
742
- }
743
- $.$mol_view_tree2_normalize = $mol_view_tree2_normalize;
744
- })($ || ($ = {}));
745
-
746
- ;
747
- "use strict";
748
-
749
- ;
750
- "use strict";
751
-
752
- ;
753
- "use strict";
754
-
755
- ;
756
- "use strict";
757
-
758
- ;
759
- "use strict";
760
-
761
- ;
762
- "use strict";
763
- var $;
764
- (function ($) {
765
- class $mol_regexp extends RegExp {
766
- groups;
767
- constructor(source, flags = 'gsu', groups = []) {
768
- super(source, flags);
769
- this.groups = groups;
770
- }
771
- *[Symbol.matchAll](str) {
772
- const index = this.lastIndex;
773
- this.lastIndex = 0;
774
- try {
775
- while (this.lastIndex < str.length) {
776
- const found = this.exec(str);
777
- if (!found)
778
- break;
779
- yield found;
780
- }
781
- }
782
- finally {
783
- this.lastIndex = index;
784
- }
785
- }
786
- [Symbol.match](str) {
787
- const res = [...this[Symbol.matchAll](str)].filter(r => r.groups).map(r => r[0]);
788
- if (!res.length)
789
- return null;
790
- return res;
791
- }
792
- [Symbol.split](str) {
793
- const res = [];
794
- let token_last = null;
795
- for (let token of this[Symbol.matchAll](str)) {
796
- if (token.groups && (token_last ? token_last.groups : true))
797
- res.push('');
798
- res.push(token[0]);
799
- token_last = token;
800
- }
801
- if (!res.length)
802
- res.push('');
803
- return res;
804
- }
805
- test(str) {
806
- return Boolean(str.match(this));
807
- }
808
- exec(str) {
809
- const from = this.lastIndex;
810
- if (from >= str.length)
811
- return null;
812
- const res = super.exec(str);
813
- if (res === null) {
814
- this.lastIndex = str.length;
815
- if (!str)
816
- return null;
817
- return Object.assign([str.slice(from)], {
818
- index: from,
819
- input: str,
820
- });
821
- }
822
- if (from === this.lastIndex) {
823
- $mol_fail(new Error('Captured empty substring'));
824
- }
825
- const groups = {};
826
- const skipped = str.slice(from, this.lastIndex - res[0].length);
827
- if (skipped) {
828
- this.lastIndex = this.lastIndex - res[0].length;
829
- return Object.assign([skipped], {
830
- index: from,
831
- input: res.input,
832
- });
833
- }
834
- for (let i = 0; i < this.groups.length; ++i) {
835
- const group = this.groups[i];
836
- groups[group] = groups[group] || res[i + 1] || '';
837
- }
838
- return Object.assign(res, { groups });
839
- }
840
- generate(params) {
841
- return null;
842
- }
843
- get native() {
844
- return new RegExp(this.source, this.flags);
845
- }
846
- static repeat(source, min = 0, max = Number.POSITIVE_INFINITY) {
847
- const regexp = $mol_regexp.from(source);
848
- const upper = Number.isFinite(max) ? max : '';
849
- const str = `(?:${regexp.source}){${min},${upper}}?`;
850
- const regexp2 = new $mol_regexp(str, regexp.flags, regexp.groups);
851
- regexp2.generate = params => {
852
- const res = regexp.generate(params);
853
- if (res)
854
- return res;
855
- if (min > 0)
856
- return res;
857
- return '';
858
- };
859
- return regexp2;
860
- }
861
- static repeat_greedy(source, min = 0, max = Number.POSITIVE_INFINITY) {
862
- const regexp = $mol_regexp.from(source);
863
- const upper = Number.isFinite(max) ? max : '';
864
- const str = `(?:${regexp.source}){${min},${upper}}`;
865
- const regexp2 = new $mol_regexp(str, regexp.flags, regexp.groups);
866
- regexp2.generate = params => {
867
- const res = regexp.generate(params);
868
- if (res)
869
- return res;
870
- if (min > 0)
871
- return res;
872
- return '';
873
- };
874
- return regexp2;
875
- }
876
- static vary(sources) {
877
- const groups = [];
878
- const chunks = sources.map(source => {
879
- const regexp = $mol_regexp.from(source);
880
- groups.push(...regexp.groups);
881
- return regexp.source;
882
- });
883
- return new $mol_regexp(`(?:${chunks.join('|')})`, '', groups);
884
- }
885
- static optional(source) {
886
- return $mol_regexp.repeat_greedy(source, 0, 1);
887
- }
888
- static force_after(source) {
889
- const regexp = $mol_regexp.from(source);
890
- return new $mol_regexp(`(?=${regexp.source})`, regexp.flags, regexp.groups);
891
- }
892
- static forbid_after(source) {
893
- const regexp = $mol_regexp.from(source);
894
- return new $mol_regexp(`(?!${regexp.source})`, regexp.flags, regexp.groups);
895
- }
896
- static from(source, { ignoreCase, multiline } = {
897
- ignoreCase: false,
898
- multiline: false,
899
- }) {
900
- let flags = 'gsu';
901
- if (multiline)
902
- flags += 'm';
903
- if (ignoreCase)
904
- flags += 'i';
905
- if (typeof source === 'number') {
906
- const src = `\\u{${source.toString(16)}}`;
907
- const regexp = new $mol_regexp(src, flags);
908
- regexp.generate = () => src;
909
- return regexp;
910
- }
911
- if (typeof source === 'string') {
912
- const src = source.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
913
- const regexp = new $mol_regexp(src, flags);
914
- regexp.generate = () => source;
915
- return regexp;
916
- }
917
- else if (source instanceof $mol_regexp) {
918
- const regexp = new $mol_regexp(source.source, flags, source.groups);
919
- regexp.generate = params => source.generate(params);
920
- return regexp;
921
- }
922
- if (source instanceof RegExp) {
923
- const test = new RegExp('|' + source.source);
924
- const groups = Array.from({ length: test.exec('').length - 1 }, (_, i) => String(i + 1));
925
- const regexp = new $mol_regexp(source.source, source.flags, groups);
926
- regexp.generate = () => '';
927
- return regexp;
928
- }
929
- if (Array.isArray(source)) {
930
- const patterns = source.map(src => Array.isArray(src)
931
- ? $mol_regexp.optional(src)
932
- : $mol_regexp.from(src));
933
- const chunks = patterns.map(pattern => pattern.source);
934
- const groups = [];
935
- let index = 0;
936
- for (const pattern of patterns) {
937
- for (let group of pattern.groups) {
938
- if (Number(group) >= 0) {
939
- groups.push(String(index++));
940
- }
941
- else {
942
- groups.push(group);
943
- }
944
- }
945
- }
946
- const regexp = new $mol_regexp(chunks.join(''), flags, groups);
947
- regexp.generate = params => {
948
- let res = '';
949
- for (const pattern of patterns) {
950
- let sub = pattern.generate(params);
951
- if (sub === null)
952
- return '';
953
- res += sub;
954
- }
955
- return res;
956
- };
957
- return regexp;
958
- }
959
- else {
960
- const groups = [];
961
- const chunks = Object.keys(source).map(name => {
962
- groups.push(name);
963
- const regexp = $mol_regexp.from(source[name]);
964
- groups.push(...regexp.groups);
965
- return `(${regexp.source})`;
966
- });
967
- const regexp = new $mol_regexp(`(?:${chunks.join('|')})`, flags, groups);
968
- const validator = new RegExp('^' + regexp.source + '$', flags);
969
- regexp.generate = (params) => {
970
- for (let option in source) {
971
- if (option in params) {
972
- if (typeof params[option] === 'boolean') {
973
- if (!params[option])
974
- continue;
975
- }
976
- else {
977
- const str = String(params[option]);
978
- if (str.match(validator))
979
- return str;
980
- $mol_fail(new Error(`Wrong param: ${option}=${str}`));
981
- }
982
- }
983
- else {
984
- if (typeof source[option] !== 'object')
985
- continue;
986
- }
987
- const res = $mol_regexp.from(source[option]).generate(params);
988
- if (res)
989
- return res;
990
- }
991
- return null;
992
- };
993
- return regexp;
994
- }
995
- }
996
- static unicode_only(...category) {
997
- return new $mol_regexp(`\\p{${category.join('=')}}`);
998
- }
999
- static unicode_except(...category) {
1000
- return new $mol_regexp(`\\P{${category.join('=')}}`);
1001
- }
1002
- static char_range(from, to) {
1003
- return new $mol_regexp(`${$mol_regexp.from(from).source}-${$mol_regexp.from(to).source}`);
1004
- }
1005
- static char_only(...allowed) {
1006
- const regexp = allowed.map(f => $mol_regexp.from(f).source).join('');
1007
- return new $mol_regexp(`[${regexp}]`);
1008
- }
1009
- static char_except(...forbidden) {
1010
- const regexp = forbidden.map(f => $mol_regexp.from(f).source).join('');
1011
- return new $mol_regexp(`[^${regexp}]`);
1012
- }
1013
- static decimal_only = $mol_regexp.from(/\d/gsu);
1014
- static decimal_except = $mol_regexp.from(/\D/gsu);
1015
- static latin_only = $mol_regexp.from(/\w/gsu);
1016
- static latin_except = $mol_regexp.from(/\W/gsu);
1017
- static space_only = $mol_regexp.from(/\s/gsu);
1018
- static space_except = $mol_regexp.from(/\S/gsu);
1019
- static word_break_only = $mol_regexp.from(/\b/gsu);
1020
- static word_break_except = $mol_regexp.from(/\B/gsu);
1021
- static tab = $mol_regexp.from(/\t/gsu);
1022
- static slash_back = $mol_regexp.from(/\\/gsu);
1023
- static nul = $mol_regexp.from(/\0/gsu);
1024
- static char_any = $mol_regexp.from(/./gsu);
1025
- static begin = $mol_regexp.from(/^/gsu);
1026
- static end = $mol_regexp.from(/$/gsu);
1027
- static or = $mol_regexp.from(/|/gsu);
1028
- static line_end = $mol_regexp.from({
1029
- win_end: [['\r'], '\n'],
1030
- mac_end: '\r',
1031
- });
1032
- }
1033
- $.$mol_regexp = $mol_regexp;
1034
- })($ || ($ = {}));
1035
-
1036
- ;
1037
- "use strict";
1038
- var $;
1039
- (function ($) {
1040
- const { begin, end, latin_only, or, optional, repeat_greedy } = $mol_regexp;
1041
- $.$mol_view_tree2_prop_signature = $mol_regexp.from([
1042
- begin,
1043
- { name: repeat_greedy(latin_only, 1) },
1044
- { key: optional(['*', repeat_greedy(latin_only, 0)]) },
1045
- { next: optional(['?', repeat_greedy(latin_only, 0)]) },
1046
- end,
1047
- ]);
1048
- })($ || ($ = {}));
1049
-
1050
- ;
1051
- "use strict";
1052
- var $;
1053
- (function ($) {
1054
- function $mol_view_tree2_prop_parts(prop) {
1055
- const groups = [...prop.type.matchAll($mol_view_tree2_prop_signature)][0]?.groups;
1056
- if (!groups) {
1057
- this.$mol_fail($mol_view_tree2_error_str `Required prop like some*? at ${prop.span}`);
1058
- }
1059
- return {
1060
- name: groups.name,
1061
- key: groups.key,
1062
- next: groups.next ? '?' : ''
1063
- };
1064
- }
1065
- $.$mol_view_tree2_prop_parts = $mol_view_tree2_prop_parts;
1066
- })($ || ($ = {}));
1067
-
1068
- ;
1069
- "use strict";
1070
- var $;
1071
- (function ($) {
1072
- const regular_regex = /^\w+$/;
1073
- function $mol_view_tree2_prop_quote(name) {
1074
- if (regular_regex.test(name.value))
1075
- return name;
1076
- return name.data(JSON.stringify(name.value));
1077
- }
1078
- $.$mol_view_tree2_prop_quote = $mol_view_tree2_prop_quote;
1079
- })($ || ($ = {}));
1080
-
1081
- ;
1082
- "use strict";
1083
- var $;
1084
- (function ($) {
1085
- const class_regex = /^[$A-Z][$\w<>\[\]()"'?|]+$/;
1086
- function $mol_view_tree2_class_match(klass) {
1087
- if (!klass?.type)
1088
- return false;
1089
- if (klass.type === 'NaN' || klass.type === 'Infinity')
1090
- return false;
1091
- return class_regex.test(klass.type);
1092
- }
1093
- $.$mol_view_tree2_class_match = $mol_view_tree2_class_match;
1094
- })($ || ($ = {}));
1095
-
1096
- ;
1097
- "use strict";
1098
- var $;
1099
- (function ($) {
1100
- const err = $mol_view_tree2_error_str;
1101
- function $mol_view_tree2_class_super(klass) {
1102
- if (!$mol_view_tree2_class_match(klass))
1103
- return this.$mol_fail(err `Wrong class name at ${klass.span}`);
1104
- const superclass = klass.kids.length === 1 ? klass.kids[0] : undefined;
1105
- if (!superclass)
1106
- return this.$mol_fail(err `No super class at ${klass.span}`);
1107
- if (!$mol_view_tree2_class_match(superclass))
1108
- return this.$mol_fail(err `Wrong super class name ${JSON.stringify(superclass.type).replace(/(^"|"$)/g, "")} at ${superclass.span}`);
1109
- return superclass;
1110
- }
1111
- $.$mol_view_tree2_class_super = $mol_view_tree2_class_super;
1112
- })($ || ($ = {}));
1113
-
1114
- ;
1115
- "use strict";
1116
- var $;
1117
- (function ($) {
1118
- const err = $mol_view_tree2_error_str;
1119
- function $mol_view_tree2_class_props(klass) {
1120
- let props = this.$mol_view_tree2_class_super(klass);
1121
- props = props.clone(props.hack({
1122
- '': (node, belt) => {
1123
- const normal = node.type.replace(/!\w+/, '*');
1124
- if (node.type === normal)
1125
- return [node.clone(node.hack(belt))];
1126
- return [node.struct(normal, node.hack(belt))];
1127
- }
1128
- }));
1129
- const props_inner = {};
1130
- const add_inner = (prop) => {
1131
- const { name } = this.$mol_view_tree2_prop_parts(prop);
1132
- const prev = props_inner[name];
1133
- if (prev && prev.kids[0]?.toString() !== prop.kids[0]?.toString()) {
1134
- this.$mol_fail(err `Need an equal default values at ${prev.span} vs ${prop.span}`);
1135
- }
1136
- props_inner[name] = prop;
1137
- };
1138
- const upper = (operator, belt, context) => {
1139
- const prop = this.$mol_view_tree2_child(operator);
1140
- const defs = prop.hack(belt, { factory: prop });
1141
- if (defs.length)
1142
- add_inner(prop.clone(defs));
1143
- return [operator.clone([prop.clone([])])];
1144
- };
1145
- const props_root = props.hack({
1146
- '<=': upper,
1147
- '<=>': upper,
1148
- '^': (operator, belt, context) => {
1149
- if (operator.kids.length === 0)
1150
- return [operator];
1151
- return upper(operator, belt, context);
1152
- },
1153
- '': (left, belt, context) => {
1154
- let right;
1155
- const operator = left.kids[0];
1156
- if (operator?.type === '=>' && context.factory) {
1157
- right = operator.kids[0];
1158
- if (!right)
1159
- this.$mol_fail(err `Need a child ${operator.span}`);
1160
- if (!context.factory)
1161
- this.$mol_fail(err `Need a parent ${left.span}`);
1162
- add_inner(right.clone([
1163
- right.struct('=', [
1164
- context.factory.struct(context.factory.type.replace(/\*.*/, '*'), [left.clone([])]),
1165
- ]),
1166
- ]));
1167
- }
1168
- if (right)
1169
- context = { factory: right.clone([]) };
1170
- else if (operator && !context.factory && $mol_view_tree2_class_match(operator)) {
1171
- context = { factory: left.clone([]) };
1172
- }
1173
- const hacked = left.clone(left.hack(belt, context));
1174
- return [hacked];
1175
- }
1176
- }, { factory: undefined });
1177
- for (const prop of props_root)
1178
- add_inner(prop);
1179
- return Object.values(props_inner);
1180
- }
1181
- $.$mol_view_tree2_class_props = $mol_view_tree2_class_props;
1182
- })($ || ($ = {}));
1183
-
1184
- ;
1185
- "use strict";
1186
- var $;
1187
- (function ($) {
1188
- const err = $mol_view_tree2_error_str;
1189
- function $mol_view_tree2_value_type(val) {
1190
- switch (val.type) {
1191
- case 'true': return 'bool';
1192
- case 'false': return 'bool';
1193
- case 'null': return 'null';
1194
- case '*': return 'dict';
1195
- case '@': return 'locale';
1196
- case '': return 'string';
1197
- case '<=': return 'get';
1198
- case '<=>': return 'bind';
1199
- case '=>': return 'put';
1200
- }
1201
- const first_char = val.type && val.type[0];
1202
- if (first_char === '/')
1203
- return 'list';
1204
- if (Number(val.type).toString() == val.type)
1205
- return 'number';
1206
- if (/^[$A-Z]/.test(first_char))
1207
- return 'object';
1208
- return this.$mol_fail(err `Unknown value type ${val.type} at ${val.span}`);
1209
- }
1210
- $.$mol_view_tree2_value_type = $mol_view_tree2_value_type;
1211
- })($ || ($ = {}));
1212
-
1213
- ;
1214
- "use strict";
1215
- var $;
1216
- (function ($) {
1217
- const err = $mol_view_tree2_error_str;
1218
- function $mol_view_tree2_value(value) {
1219
- const type = value.type;
1220
- const kids = value.kids;
1221
- if (type === '') {
1222
- if (kids.length === 0)
1223
- return value.data(JSON.stringify(value.value));
1224
- return value.data(JSON.stringify(kids.map(node => node.value).join('\n')));
1225
- }
1226
- if (kids.length !== 0)
1227
- return this.$mol_fail(err `Kids are not allowed at ${value.span}, use ${example}`);
1228
- if (type === 'false' || type === 'true')
1229
- return value.data(type);
1230
- if (type === 'null')
1231
- return value.data(type);
1232
- if (Number(type).toString() === type.replace(/^\+/, ''))
1233
- return value.data(type);
1234
- return this.$mol_fail(err `Value ${value.toString()} not allowed at ${value.span}, use ${example}`);
1235
- }
1236
- $.$mol_view_tree2_value = $mol_view_tree2_value;
1237
- const example = new $mol_view_tree2_error_suggestions([
1238
- 'false',
1239
- 'true',
1240
- '123',
1241
- 'null',
1242
- '\\some'
1243
- ]);
1244
- })($ || ($ = {}));
1245
-
1246
- ;
1247
- "use strict";
1248
- var $;
1249
- (function ($) {
1250
- function $mol_view_tree2_value_number(type) {
650
+ function $mol_tree2_js_is_number(type) {
1251
651
  return type.match(/[\+\-]*NaN/) || !Number.isNaN(Number(type));
1252
652
  }
1253
- $.$mol_view_tree2_value_number = $mol_view_tree2_value_number;
653
+ $.$mol_tree2_js_is_number = $mol_tree2_js_is_number;
1254
654
  })($ || ($ = {}));
1255
655
 
1256
656
  ;
@@ -1458,7 +858,7 @@ var $;
1458
858
  return [
1459
859
  input.data(input.type),
1460
860
  ];
1461
- if ($mol_view_tree2_value_number(input.type))
861
+ if ($mol_tree2_js_is_number(input.type))
1462
862
  return [
1463
863
  input.data(input.type)
1464
864
  ];
@@ -2339,6 +1739,9 @@ var $;
2339
1739
  ;
2340
1740
  "use strict";
2341
1741
 
1742
+ ;
1743
+ "use strict";
1744
+
2342
1745
  ;
2343
1746
  "use strict";
2344
1747
  var $;
@@ -5066,7 +4469,7 @@ var $;
5066
4469
  .hack({
5067
4470
  'bar': (input, belt) => [input.struct('777', input.hack(belt))],
5068
4471
  });
5069
- $mol_assert_equal(res.toString(), 'foo 777 xxx\n');
4472
+ $mol_assert_equal(res.map(String), ['foo 777 xxx\n']);
5070
4473
  },
5071
4474
  });
5072
4475
  })($ || ($ = {}));
@@ -5147,339 +4550,40 @@ var $;
5147
4550
  ;
5148
4551
  "use strict";
5149
4552
 
4553
+ ;
4554
+ "use strict";
4555
+
4556
+ ;
4557
+ "use strict";
4558
+
4559
+ ;
4560
+ "use strict";
4561
+
4562
+ ;
4563
+ "use strict";
4564
+
5150
4565
  ;
5151
4566
  "use strict";
5152
4567
  var $;
5153
4568
  (function ($) {
5154
- $mol_test({
5155
- 'escape'() {
5156
- const specials = $mol_regexp.from('.*+?^${}()|[]\\');
5157
- $mol_assert_equal(specials.source, '\\.\\*\\+\\?\\^\\$\\{\\}\\(\\)\\|\\[\\]\\\\');
5158
- },
5159
- 'char code'() {
5160
- const space = $mol_regexp.from(32);
5161
- $mol_assert_like(' '.match(space), [' ']);
5162
- },
5163
- 'repeat fixed'() {
5164
- const { repeat, decimal_only: digit } = $mol_regexp;
5165
- const year = repeat(digit, 4, 4);
5166
- $mol_assert_like('#2020#'.match(year), ['2020']);
5167
- },
5168
- 'greedy repeat'() {
5169
- const { repeat, repeat_greedy, latin_only: letter } = $mol_regexp;
5170
- $mol_assert_like('abc'.match(repeat(letter, 1, 2)), ['a', 'b', 'c']);
5171
- $mol_assert_like('abc'.match(repeat_greedy(letter, 1, 2)), ['ab', 'c']);
5172
- },
5173
- 'repeat range'() {
5174
- const { repeat_greedy, decimal_only: digit } = $mol_regexp;
5175
- const year = repeat_greedy(digit, 2, 4);
5176
- $mol_assert_like('#2#'.match(year), null);
5177
- $mol_assert_like('#20#'.match(year), ['20']);
5178
- $mol_assert_like('#2020#'.match(year), ['2020']);
5179
- $mol_assert_like('#20201#'.match(year), ['2020']);
5180
- },
5181
- 'repeat from'() {
5182
- const { repeat_greedy, latin_only: letter } = $mol_regexp;
5183
- const name = repeat_greedy(letter, 2);
5184
- $mol_assert_like('##'.match(name), null);
5185
- $mol_assert_like('#a#'.match(name), null);
5186
- $mol_assert_like('#ab#'.match(name), ['ab']);
5187
- $mol_assert_like('#abc#'.match(name), ['abc']);
5188
- },
5189
- 'from string'() {
5190
- const regexp = $mol_regexp.from('[\\d]');
5191
- $mol_assert_equal(regexp.source, '\\[\\\\d\\]');
5192
- $mol_assert_equal(regexp.flags, 'gsu');
5193
- },
5194
- 'from regexp'() {
5195
- const regexp = $mol_regexp.from(/[\d]/i);
5196
- $mol_assert_equal(regexp.source, '[\\d]');
5197
- $mol_assert_equal(regexp.flags, 'i');
5198
- },
5199
- 'split'() {
5200
- const regexp = $mol_regexp.from(';');
5201
- $mol_assert_like('aaa;bbb;ccc'.split(regexp), ['aaa', ';', 'bbb', ';', 'ccc']);
5202
- $mol_assert_like('aaa;;ccc'.split(regexp), ['aaa', ';', '', ';', 'ccc']);
5203
- $mol_assert_like('aaa'.split(regexp), ['aaa']);
5204
- $mol_assert_like(''.split(regexp), ['']);
5205
- },
5206
- 'test for matching'() {
5207
- const regexp = $mol_regexp.from('foo');
5208
- $mol_assert_like(regexp.test(''), false);
5209
- $mol_assert_like(regexp.test('fo'), false);
5210
- $mol_assert_like(regexp.test('foo'), true);
5211
- $mol_assert_like(regexp.test('foobar'), true);
5212
- $mol_assert_like(regexp.test('barfoo'), true);
5213
- },
5214
- 'case ignoring'() {
5215
- const xxx = $mol_regexp.from('x', { ignoreCase: true });
5216
- $mol_assert_like(xxx.flags, 'gisu');
5217
- $mol_assert_like(xxx.exec('xx')[0], 'x');
5218
- $mol_assert_like(xxx.exec('XX')[0], 'X');
5219
- },
5220
- 'multiline mode'() {
5221
- const { end, from } = $mol_regexp;
5222
- const xxx = from(['x', end], { multiline: true });
5223
- $mol_assert_like(xxx.exec('x\ny')[0], 'x');
5224
- $mol_assert_like(xxx.flags, 'gmsu');
5225
- },
5226
- 'flags override'() {
5227
- const triplet = $mol_regexp.from($mol_regexp.from(/.../, { ignoreCase: true }), { multiline: true });
5228
- $mol_assert_like(triplet.toString(), '/.../gmsu');
5229
- },
5230
- 'sequence'() {
5231
- const { begin, end, decimal_only: digit, repeat, from } = $mol_regexp;
5232
- const year = repeat(digit, 4, 4);
5233
- const dash = '-';
5234
- const month = repeat(digit, 2, 2);
5235
- const day = repeat(digit, 2, 2);
5236
- const date = from([begin, year, dash, month, dash, day, end]);
5237
- $mol_assert_like(date.exec('2020-01-02')[0], '2020-01-02');
5238
- },
5239
- 'optional'() {
5240
- const name = $mol_regexp.from(['A', ['4']]);
5241
- $mol_assert_equal('AB'.match(name)[0], 'A');
5242
- $mol_assert_equal('A4'.match(name)[0], 'A4');
5243
- },
5244
- 'anon variants'() {
5245
- const name = $mol_regexp.from(['A', $mol_regexp.vary(['4', '5'])]);
5246
- $mol_assert_equal('AB'.match(name), null);
5247
- $mol_assert_equal('A4'.match(name)[0], 'A4');
5248
- $mol_assert_equal('A5'.match(name)[0], 'A5');
5249
- },
5250
- 'only groups'() {
5251
- const regexp = $mol_regexp.from({ dog: '@' });
5252
- $mol_assert_like([...'#'.matchAll(regexp)][0].groups, undefined);
5253
- $mol_assert_like([...'@'.matchAll(regexp)][0].groups, { dog: '@' });
5254
- },
5255
- 'catch skipped'() {
5256
- const regexp = $mol_regexp.from(/(@)(\d?)/g);
5257
- $mol_assert_like([...'[[@]]'.matchAll(regexp)].map(f => [...f]), [
5258
- ['[['],
5259
- ['@', '@', ''],
5260
- [']]'],
5261
- ]);
5262
- },
5263
- 'enum variants'() {
5264
- let Sex;
5265
- (function (Sex) {
5266
- Sex["male"] = "male";
5267
- Sex["female"] = "female";
5268
- })(Sex || (Sex = {}));
5269
- const sexism = $mol_regexp.from(Sex);
5270
- $mol_assert_like([...''.matchAll(sexism)].length, 0);
5271
- $mol_assert_like([...'trans'.matchAll(sexism)][0].groups, undefined);
5272
- $mol_assert_like([...'male'.matchAll(sexism)][0].groups, { male: 'male', female: '' });
5273
- $mol_assert_like([...'female'.matchAll(sexism)][0].groups, { male: '', female: 'female' });
5274
- },
5275
- 'recursive only groups'() {
5276
- let Sex;
5277
- (function (Sex) {
5278
- Sex["male"] = "male";
5279
- Sex["female"] = "female";
5280
- })(Sex || (Sex = {}));
5281
- const sexism = $mol_regexp.from({ Sex });
5282
- $mol_assert_like([...''.matchAll(sexism)].length, 0);
5283
- $mol_assert_like([...'male'.matchAll(sexism)][0].groups, { Sex: 'male', male: 'male', female: '' });
5284
- $mol_assert_like([...'female'.matchAll(sexism)][0].groups, { Sex: 'female', male: '', female: 'female' });
5285
- },
5286
- 'sequence with groups'() {
5287
- const { begin, end, decimal_only: digit, repeat, from } = $mol_regexp;
5288
- const year = repeat(digit, 4, 4);
5289
- const dash = '-';
5290
- const month = repeat(digit, 2, 2);
5291
- const day = repeat(digit, 2, 2);
5292
- const regexp = from([begin, { year }, dash, { month }, dash, { day }, end]);
5293
- const found = [...'2020-01-02'.matchAll(regexp)];
5294
- $mol_assert_like(found[0].groups, {
5295
- year: '2020',
5296
- month: '01',
5297
- day: '02',
5298
- });
5299
- },
5300
- 'sequence with groups of mixed type'() {
5301
- const prefix = '/';
5302
- const postfix = '/';
5303
- const regexp = $mol_regexp.from([{ prefix }, /(\w+)/, { postfix }, /([gumi]*)/]);
5304
- $mol_assert_like([...'/foo/mi'.matchAll(regexp)], [
5305
- Object.assign(["/foo/mi", "/", "foo", "/", "mi"], {
5306
- groups: {
5307
- prefix: '/',
5308
- postfix: '/',
5309
- },
5310
- index: 0,
5311
- input: "/",
5312
- }),
5313
- ]);
5314
- },
5315
- 'recursive sequence with groups'() {
5316
- const { begin, end, decimal_only: digit, repeat, from } = $mol_regexp;
5317
- const year = repeat(digit, 4, 4);
5318
- const dash = '-';
5319
- const month = repeat(digit, 2, 2);
5320
- const day = repeat(digit, 2, 2);
5321
- const regexp = from([
5322
- begin, { date: [{ year }, dash, { month }] }, dash, { day }, end
5323
- ]);
5324
- const found = [...'2020-01-02'.matchAll(regexp)];
5325
- $mol_assert_like(found[0].groups, {
5326
- date: '2020-01',
5327
- year: '2020',
5328
- month: '01',
5329
- day: '02',
5330
- });
5331
- },
5332
- 'parse multiple'() {
5333
- const { decimal_only: digit, from } = $mol_regexp;
5334
- const regexp = from({ digit });
5335
- $mol_assert_like([...'123'.matchAll(regexp)].map(f => f.groups), [
5336
- { digit: '1' },
5337
- { digit: '2' },
5338
- { digit: '3' },
5339
- ]);
5340
- },
5341
- 'named variants'() {
5342
- const { begin, or, end, from } = $mol_regexp;
5343
- const sexism = from([
5344
- begin, 'sex = ', { sex: ['male', or, 'female'] }, end
5345
- ]);
5346
- $mol_assert_like([...'sex = male'.matchAll(sexism)][0].groups, { sex: 'male' });
5347
- $mol_assert_like([...'sex = female'.matchAll(sexism)][0].groups, { sex: 'female' });
5348
- $mol_assert_like([...'sex = malefemale'.matchAll(sexism)][0].groups, undefined);
5349
- },
5350
- 'force after'() {
5351
- const { latin_only: letter, force_after, from } = $mol_regexp;
5352
- const regexp = from([letter, force_after('.')]);
5353
- $mol_assert_like('x.'.match(regexp), ['x']);
5354
- $mol_assert_like('x,'.match(regexp), null);
5355
- },
5356
- 'forbid after'() {
5357
- const { latin_only: letter, forbid_after, from } = $mol_regexp;
5358
- const regexp = from([letter, forbid_after('.')]);
5359
- $mol_assert_like('x.'.match(regexp), null);
5360
- $mol_assert_like('x,'.match(regexp), ['x']);
5361
- },
5362
- 'char except'() {
5363
- const { char_except, latin_only, tab } = $mol_regexp;
5364
- const name = char_except(latin_only, tab);
5365
- $mol_assert_like('a'.match(name), null);
5366
- $mol_assert_like('\t'.match(name), null);
5367
- $mol_assert_like('('.match(name), ['(']);
5368
- },
5369
- 'unicode only'() {
5370
- const { unicode_only, from } = $mol_regexp;
5371
- const name = from([
5372
- unicode_only('Script', 'Cyrillic'),
5373
- unicode_only('Hex_Digit'),
5374
- ]);
5375
- $mol_assert_like('FF'.match(name), null);
5376
- $mol_assert_like('ФG'.match(name), null);
5377
- $mol_assert_like('ФF'.match(name), ['ФF']);
5378
- },
5379
- 'generate by optional with inner group'() {
5380
- const { begin, end, from } = $mol_regexp;
5381
- const animals = from([begin, '#', ['^', { dog: '@' }], end]);
5382
- $mol_assert_equal(animals.generate({}), '#');
5383
- $mol_assert_equal(animals.generate({ dog: false }), '#');
5384
- $mol_assert_equal(animals.generate({ dog: true }), '#^@');
5385
- $mol_assert_fail(() => animals.generate({ dog: '$' }), 'Wrong param: dog=$');
5386
- },
5387
- 'generate by optional with inner group with variants'() {
5388
- const { begin, end, from } = $mol_regexp;
5389
- const animals = from([begin, '#', ['^', { animal: { dog: '@', fox: '&' } }], end]);
5390
- $mol_assert_equal(animals.generate({}), '#');
5391
- $mol_assert_equal(animals.generate({ dog: true }), '#^@');
5392
- $mol_assert_equal(animals.generate({ fox: true }), '#^&');
5393
- $mol_assert_fail(() => animals.generate({ dog: '$' }), 'Wrong param: dog=$');
5394
- },
5395
- 'complex example'() {
5396
- const { begin, end, char_only, char_range, latin_only, slash_back, repeat_greedy, from, } = $mol_regexp;
5397
- const atom_char = char_only(latin_only, "!#$%&'*+/=?^`{|}~-");
5398
- const atom = repeat_greedy(atom_char, 1);
5399
- const dot_atom = from([atom, repeat_greedy(['.', atom])]);
5400
- const name_letter = char_only(char_range(0x01, 0x08), 0x0b, 0x0c, char_range(0x0e, 0x1f), 0x21, char_range(0x23, 0x5b), char_range(0x5d, 0x7f));
5401
- const quoted_pair = from([
5402
- slash_back,
5403
- char_only(char_range(0x01, 0x09), 0x0b, 0x0c, char_range(0x0e, 0x7f))
5404
- ]);
5405
- const name = repeat_greedy({ name_letter, quoted_pair });
5406
- const quoted_name = from(['"', { name }, '"']);
5407
- const local_part = from({ dot_atom, quoted_name });
5408
- const domain = dot_atom;
5409
- const mail = from([begin, local_part, '@', { domain }, end]);
5410
- $mol_assert_equal('foo..bar@example.org'.match(mail), null);
5411
- $mol_assert_equal('foo..bar"@example.org'.match(mail), null);
5412
- $mol_assert_like([...'foo.bar@example.org'.matchAll(mail)][0].groups, {
5413
- dot_atom: "foo.bar",
5414
- quoted_name: "",
5415
- name: "",
5416
- name_letter: "",
5417
- quoted_pair: "",
5418
- domain: "example.org",
5419
- });
5420
- $mol_assert_like([...'"foo..bar"@example.org'.matchAll(mail)][0].groups, {
5421
- dot_atom: "",
5422
- quoted_name: '"foo..bar"',
5423
- name: "foo..bar",
5424
- name_letter: "r",
5425
- quoted_pair: "",
5426
- domain: "example.org",
5427
- });
5428
- $mol_assert_equal(mail.generate({ dot_atom: 'foo.bar', domain: 'example.org' }), 'foo.bar@example.org');
5429
- $mol_assert_equal(mail.generate({ name: 'foo..bar', domain: 'example.org' }), '"foo..bar"@example.org');
5430
- $mol_assert_fail(() => mail.generate({ dot_atom: 'foo..bar', domain: 'example.org' }), 'Wrong param: dot_atom=foo..bar');
5431
- },
5432
- });
4569
+ function $mol_data_setup(value, config) {
4570
+ return Object.assign(value, {
4571
+ config,
4572
+ Value: null
4573
+ });
4574
+ }
4575
+ $.$mol_data_setup = $mol_data_setup;
5433
4576
  })($ || ($ = {}));
5434
4577
 
5435
4578
  ;
5436
4579
  "use strict";
5437
4580
  var $;
5438
- (function ($_1) {
5439
- function get_parts(str) {
5440
- return $$.$mol_view_tree2_prop_parts($mol_tree2.struct(str));
5441
- }
4581
+ (function ($) {
5442
4582
  $mol_test({
5443
- 'wrong order'($) {
5444
- $mol_assert_fail(() => {
5445
- get_parts('some_bla?*');
5446
- }, 'Required prop like some*? at `?#1:1/0`');
4583
+ 'config by value'() {
4584
+ const N = $mol_data_setup((a) => a, 5);
4585
+ $mol_assert_equal(N.config, 5);
5447
4586
  },
5448
- 'empty'($) {
5449
- $mol_assert_fail(() => {
5450
- get_parts('');
5451
- }, 'Required prop like some*? at `?#1:1/0`');
5452
- },
5453
- 'prop in upper case'($) {
5454
- const parts = get_parts('Close_icon');
5455
- $mol_assert_equal(parts.name, 'Close_icon');
5456
- $mol_assert_equal(parts.key, '');
5457
- $mol_assert_equal(parts.next, '');
5458
- },
5459
- 'prop with index'($) {
5460
- const parts = get_parts('some_bla*');
5461
- $mol_assert_equal(parts.name, 'some_bla');
5462
- $mol_assert_equal(parts.key, '*');
5463
- $mol_assert_equal(parts.next, '');
5464
- },
5465
- 'prop with index and value'($) {
5466
- const parts = get_parts('some_bla*?');
5467
- $mol_assert_equal(parts.name, 'some_bla');
5468
- $mol_assert_equal(parts.key, '*');
5469
- $mol_assert_equal(parts.next, '?');
5470
- },
5471
- 'legacy indexed'($) {
5472
- const parts = get_parts('Some*default');
5473
- $mol_assert_equal(parts.name, 'Some');
5474
- $mol_assert_equal(parts.key, '*default');
5475
- $mol_assert_equal(parts.next, '');
5476
- },
5477
- 'legacy indexed value'($) {
5478
- const parts = get_parts('Some*k?v');
5479
- $mol_assert_equal(parts.name, 'Some');
5480
- $mol_assert_equal(parts.key, '*k');
5481
- $mol_assert_equal(parts.next, '?');
5482
- }
5483
4587
  });
5484
4588
  })($ || ($ = {}));
5485
4589
 
@@ -5487,3359 +4591,10 @@ var $;
5487
4591
  "use strict";
5488
4592
  var $;
5489
4593
  (function ($) {
5490
- class $mol_window extends $mol_object {
5491
- static size() {
5492
- return {
5493
- width: 1024,
5494
- height: 768,
5495
- };
5496
- }
4594
+ function $mol_func_is_class(func) {
4595
+ return Object.getOwnPropertyDescriptor(func, 'prototype')?.writable === false;
5497
4596
  }
5498
- $.$mol_window = $mol_window;
5499
- })($ || ($ = {}));
5500
-
5501
- ;
5502
- "use strict";
5503
-
5504
- ;
5505
- "use strict";
5506
-
5507
- ;
5508
- "use strict";
5509
- var $;
5510
- (function ($) {
5511
- function $mol_wire_solo(host, field, descr) {
5512
- if (!descr)
5513
- descr = Reflect.getOwnPropertyDescriptor(host, field);
5514
- const orig = descr?.value ?? host[field];
5515
- const sup = Reflect.getPrototypeOf(host);
5516
- if (typeof sup[field] === 'function') {
5517
- Object.defineProperty(orig, 'name', { value: sup[field].name });
5518
- }
5519
- const descr2 = {
5520
- ...descr,
5521
- value: function (...args) {
5522
- let atom = $mol_wire_atom.solo(this, orig);
5523
- if ((args.length === 0) || (args[0] === undefined)) {
5524
- if (!$mol_wire_fiber.warm)
5525
- return atom.result();
5526
- if ($mol_wire_auto()?.temp) {
5527
- return atom.once();
5528
- }
5529
- else {
5530
- return atom.sync();
5531
- }
5532
- }
5533
- return atom.resync(args);
5534
- }
5535
- };
5536
- Reflect.defineProperty(descr2.value, 'name', { value: orig.name + ' ' });
5537
- Reflect.defineProperty(descr2.value, 'length', { value: orig.length });
5538
- Object.assign(descr2.value, { orig });
5539
- Reflect.defineProperty(host, field, descr2);
5540
- return descr2;
5541
- }
5542
- $.$mol_wire_solo = $mol_wire_solo;
5543
- })($ || ($ = {}));
5544
-
5545
- ;
5546
- "use strict";
5547
- var $;
5548
- (function ($_1) {
5549
- $mol_test({
5550
- 'Cached channel'($) {
5551
- class App extends $mol_object2 {
5552
- static $ = $;
5553
- static value(next = 1) {
5554
- return next + 1;
5555
- }
5556
- }
5557
- __decorate([
5558
- $mol_wire_solo
5559
- ], App, "value", null);
5560
- $mol_assert_equal(App.value(), 2);
5561
- App.value(2);
5562
- $mol_assert_equal(App.value(), 3);
5563
- },
5564
- 'Read Pushed'($) {
5565
- class App extends $mol_object2 {
5566
- static $ = $;
5567
- static value(next = 0) {
5568
- return next;
5569
- }
5570
- }
5571
- __decorate([
5572
- $mol_wire_solo
5573
- ], App, "value", null);
5574
- $mol_assert_equal(App.value(1), 1);
5575
- $mol_assert_equal(App.value(), 1);
5576
- },
5577
- 'Mem overrides mem'($) {
5578
- class Base extends $mol_object2 {
5579
- static $ = $;
5580
- static value(next = 1) {
5581
- return next + 1;
5582
- }
5583
- }
5584
- __decorate([
5585
- $mol_wire_solo
5586
- ], Base, "value", null);
5587
- class Middle extends Base {
5588
- static value(next) {
5589
- return super.value(next) + 1;
5590
- }
5591
- }
5592
- __decorate([
5593
- $mol_wire_solo
5594
- ], Middle, "value", null);
5595
- class App extends Middle {
5596
- static value(next) {
5597
- return super.value(next) * 3;
5598
- }
5599
- }
5600
- __decorate([
5601
- $mol_wire_solo
5602
- ], App, "value", null);
5603
- $mol_assert_equal(App.value(), 9);
5604
- $mol_assert_equal(App.value(5), 21);
5605
- $mol_assert_equal(App.value(), 21);
5606
- },
5607
- 'Auto recalculation of cached values'($) {
5608
- class App extends $mol_object2 {
5609
- static $ = $;
5610
- static xxx(next) {
5611
- return next || 1;
5612
- }
5613
- static yyy() {
5614
- return this.xxx() + 1;
5615
- }
5616
- static zzz() {
5617
- return this.yyy() + 1;
5618
- }
5619
- }
5620
- __decorate([
5621
- $mol_wire_solo
5622
- ], App, "xxx", null);
5623
- __decorate([
5624
- $mol_wire_solo
5625
- ], App, "yyy", null);
5626
- __decorate([
5627
- $mol_wire_solo
5628
- ], App, "zzz", null);
5629
- $mol_assert_equal(App.yyy(), 2);
5630
- $mol_assert_equal(App.zzz(), 3);
5631
- App.xxx(5);
5632
- $mol_assert_equal(App.zzz(), 7);
5633
- },
5634
- 'Skip recalculation when actually no dependency changes'($) {
5635
- const log = [];
5636
- class App extends $mol_object2 {
5637
- static $ = $;
5638
- static xxx(next) {
5639
- log.push('xxx');
5640
- return next || 1;
5641
- }
5642
- static yyy() {
5643
- log.push('yyy');
5644
- return [Math.sign(this.xxx())];
5645
- }
5646
- static zzz() {
5647
- log.push('zzz');
5648
- return this.yyy()[0] + 1;
5649
- }
5650
- }
5651
- __decorate([
5652
- $mol_wire_solo
5653
- ], App, "xxx", null);
5654
- __decorate([
5655
- $mol_wire_solo
5656
- ], App, "yyy", null);
5657
- __decorate([
5658
- $mol_wire_solo
5659
- ], App, "zzz", null);
5660
- App.zzz();
5661
- $mol_assert_like(log, ['zzz', 'yyy', 'xxx']);
5662
- App.xxx(5);
5663
- $mol_assert_like(log, ['zzz', 'yyy', 'xxx', 'xxx']);
5664
- App.zzz();
5665
- $mol_assert_like(log, ['zzz', 'yyy', 'xxx', 'xxx', 'yyy']);
5666
- },
5667
- 'Flow: Auto'($) {
5668
- class App extends $mol_object2 {
5669
- static get $() { return $; }
5670
- static source(next = 1) { return next; }
5671
- static condition(next = true) { return next; }
5672
- static counter = 0;
5673
- static result() {
5674
- const res = this.condition() ? this.source() : 0;
5675
- return res + this.counter++;
5676
- }
5677
- }
5678
- __decorate([
5679
- $mol_wire_solo
5680
- ], App, "source", null);
5681
- __decorate([
5682
- $mol_wire_solo
5683
- ], App, "condition", null);
5684
- __decorate([
5685
- $mol_wire_solo
5686
- ], App, "result", null);
5687
- $mol_assert_equal(App.result(), 1);
5688
- $mol_assert_equal(App.counter, 1);
5689
- App.source(10);
5690
- $mol_assert_equal(App.result(), 11);
5691
- $mol_assert_equal(App.counter, 2);
5692
- App.condition(false);
5693
- $mol_assert_equal(App.result(), 2);
5694
- $mol_assert_equal(App.counter, 3);
5695
- $mol_wire_fiber.sync();
5696
- $mol_assert_equal(App.source(), 1);
5697
- App.source(20);
5698
- $mol_assert_equal(App.result(), 2);
5699
- $mol_assert_equal(App.counter, 3);
5700
- App.condition(true);
5701
- $mol_assert_equal(App.result(), 23);
5702
- $mol_assert_equal(App.counter, 4);
5703
- },
5704
- 'Dupes: Equality'($) {
5705
- let counter = 0;
5706
- class App extends $mol_object2 {
5707
- static $ = $;
5708
- static foo(next) {
5709
- return next ?? { numbs: [1] };
5710
- }
5711
- static bar() {
5712
- return { ...this.foo(), count: ++counter };
5713
- }
5714
- }
5715
- __decorate([
5716
- $mol_wire_solo
5717
- ], App, "foo", null);
5718
- __decorate([
5719
- $mol_wire_solo
5720
- ], App, "bar", null);
5721
- $mol_assert_like(App.bar(), { numbs: [1], count: 1 });
5722
- App.foo({ numbs: [1] });
5723
- $mol_assert_like(App.bar(), { numbs: [1], count: 1 });
5724
- App.foo({ numbs: [2] });
5725
- $mol_assert_like(App.bar(), { numbs: [2], count: 2 });
5726
- },
5727
- 'Cycle: Fail'($) {
5728
- class App extends $mol_object2 {
5729
- static $ = $;
5730
- static foo() {
5731
- return this.bar() + 1;
5732
- }
5733
- static bar() {
5734
- return this.foo() + 1;
5735
- }
5736
- static test() {
5737
- $mol_assert_fail(() => App.foo(), 'Circular subscription');
5738
- }
5739
- }
5740
- __decorate([
5741
- $mol_wire_solo
5742
- ], App, "foo", null);
5743
- __decorate([
5744
- $mol_wire_solo
5745
- ], App, "bar", null);
5746
- __decorate([
5747
- $mol_wire_method
5748
- ], App, "test", null);
5749
- App.test();
5750
- },
5751
- 'Different order of pull and push'($) {
5752
- class App extends $mol_object2 {
5753
- static $ = $;
5754
- static store(next = 0) {
5755
- return next;
5756
- }
5757
- static fast(next) {
5758
- return this.store(next);
5759
- }
5760
- static slow(next) {
5761
- if (next !== undefined)
5762
- this.slow();
5763
- return this.store(next);
5764
- }
5765
- }
5766
- __decorate([
5767
- $mol_wire_solo
5768
- ], App, "store", null);
5769
- __decorate([
5770
- $mol_wire_solo
5771
- ], App, "fast", null);
5772
- __decorate([
5773
- $mol_wire_solo
5774
- ], App, "slow", null);
5775
- App.fast();
5776
- $mol_assert_equal(App.slow(666), 666);
5777
- $mol_assert_equal(App.fast(), App.slow(), 666);
5778
- App.store(777);
5779
- $mol_assert_equal(App.fast(), App.slow(), 777);
5780
- },
5781
- 'Actions inside invariant'($) {
5782
- class App extends $mol_object2 {
5783
- static $ = $;
5784
- static count(next = 0) {
5785
- return next;
5786
- }
5787
- static count2() {
5788
- return this.count();
5789
- }
5790
- static res() {
5791
- const count = this.count2();
5792
- if (!count)
5793
- this.count(count + 1);
5794
- return count + 1;
5795
- }
5796
- }
5797
- __decorate([
5798
- $mol_wire_solo
5799
- ], App, "count", null);
5800
- __decorate([
5801
- $mol_wire_solo
5802
- ], App, "count2", null);
5803
- __decorate([
5804
- $mol_wire_solo
5805
- ], App, "res", null);
5806
- $mol_assert_like(App.res(), 1);
5807
- App.count(5);
5808
- $mol_assert_like(App.res(), 6);
5809
- },
5810
- async 'Toggle with async'($) {
5811
- class App extends $mol_object2 {
5812
- static $ = $;
5813
- static checked(next = false) {
5814
- $$.$mol_wait_timeout(0);
5815
- return next;
5816
- }
5817
- static toggle() {
5818
- const prev = this.checked();
5819
- $mol_assert_unique(this.checked(!prev), prev);
5820
- }
5821
- static res() {
5822
- return this.checked();
5823
- }
5824
- static test() {
5825
- $mol_assert_equal(App.res(), false);
5826
- App.toggle();
5827
- $mol_assert_equal(App.res(), true);
5828
- }
5829
- }
5830
- __decorate([
5831
- $mol_wire_solo
5832
- ], App, "checked", null);
5833
- __decorate([
5834
- $mol_wire_method
5835
- ], App, "toggle", null);
5836
- __decorate([
5837
- $mol_wire_solo
5838
- ], App, "res", null);
5839
- __decorate([
5840
- $mol_wire_method
5841
- ], App, "test", null);
5842
- await $mol_wire_async(App).test();
5843
- },
5844
- 'Restore after error'($) {
5845
- class App extends $mol_object2 {
5846
- static get $() { return $; }
5847
- static condition(next = false) { return next; }
5848
- static broken() {
5849
- if (this.condition()) {
5850
- $mol_fail(new Error('test error'));
5851
- }
5852
- return 1;
5853
- }
5854
- static result() {
5855
- return this.broken();
5856
- }
5857
- }
5858
- __decorate([
5859
- $mol_wire_solo
5860
- ], App, "condition", null);
5861
- __decorate([
5862
- $mol_wire_solo
5863
- ], App, "broken", null);
5864
- __decorate([
5865
- $mol_wire_solo
5866
- ], App, "result", null);
5867
- $mol_assert_equal(App.result(), 1);
5868
- App.condition(true);
5869
- $mol_assert_fail(() => App.result(), 'test error');
5870
- App.condition(false);
5871
- $mol_assert_equal(App.result(), 1);
5872
- },
5873
- async 'Wait for data'($) {
5874
- class App extends $mol_object2 {
5875
- static $ = $;
5876
- static async source() {
5877
- return 'Jin';
5878
- }
5879
- static middle() {
5880
- return $mol_wire_sync(this).source();
5881
- }
5882
- static target() {
5883
- return this.middle();
5884
- }
5885
- static test() {
5886
- $mol_assert_equal(App.target(), 'Jin');
5887
- }
5888
- }
5889
- __decorate([
5890
- $mol_wire_solo
5891
- ], App, "middle", null);
5892
- __decorate([
5893
- $mol_wire_solo
5894
- ], App, "target", null);
5895
- __decorate([
5896
- $mol_wire_method
5897
- ], App, "test", null);
5898
- await $mol_wire_async(App).test();
5899
- },
5900
- 'Auto destroy on long alone'($) {
5901
- let destroyed = false;
5902
- class App extends $mol_object2 {
5903
- static $ = $;
5904
- static showing(next = true) {
5905
- return next;
5906
- }
5907
- static details() {
5908
- return {
5909
- destructor() {
5910
- destroyed = true;
5911
- }
5912
- };
5913
- }
5914
- static render() {
5915
- return this.showing() ? this.details() : null;
5916
- }
5917
- }
5918
- __decorate([
5919
- $mol_wire_solo
5920
- ], App, "showing", null);
5921
- __decorate([
5922
- $mol_wire_solo
5923
- ], App, "details", null);
5924
- __decorate([
5925
- $mol_wire_solo
5926
- ], App, "render", null);
5927
- const details = App.render();
5928
- $mol_assert_ok(details);
5929
- App.showing(false);
5930
- $mol_assert_not(App.render());
5931
- App.showing(true);
5932
- $mol_assert_equal(App.render(), details);
5933
- $mol_wire_fiber.sync();
5934
- $mol_assert_not(destroyed);
5935
- App.showing(false);
5936
- $mol_wire_fiber.sync();
5937
- $mol_assert_ok(destroyed);
5938
- App.showing(true);
5939
- $mol_assert_unique(App.render(), details);
5940
- },
5941
- async 'Hold pubs while wait async task'($) {
5942
- class App extends $mol_object2 {
5943
- static $ = $;
5944
- static counter = 0;
5945
- static resets(next) {
5946
- return ($mol_wire_probe(() => this.resets()) ?? -1) + 1;
5947
- }
5948
- static async wait() { }
5949
- static value() {
5950
- return ++this.counter;
5951
- }
5952
- static result() {
5953
- if (this.resets())
5954
- $mol_wire_sync(this).wait();
5955
- return this.value();
5956
- }
5957
- static test() {
5958
- }
5959
- }
5960
- __decorate([
5961
- $mol_wire_solo
5962
- ], App, "resets", null);
5963
- __decorate([
5964
- $mol_wire_solo
5965
- ], App, "value", null);
5966
- __decorate([
5967
- $mol_wire_solo
5968
- ], App, "result", null);
5969
- __decorate([
5970
- $mol_wire_method
5971
- ], App, "test", null);
5972
- $mol_assert_equal(App.result(), 1);
5973
- App.resets(null);
5974
- $mol_wire_fiber.sync();
5975
- $mol_assert_equal(await $mol_wire_async(App).result(), 1);
5976
- },
5977
- 'Owned value has js-path name'() {
5978
- class App extends $mol_object2 {
5979
- static title() {
5980
- return new $mol_object2;
5981
- }
5982
- }
5983
- __decorate([
5984
- $mol_wire_solo
5985
- ], App, "title", null);
5986
- $mol_assert_equal(`${App.title()}`, 'App.title<>');
5987
- },
5988
- 'Unsubscribe from temp pubs on complete'($) {
5989
- class Random extends $mol_object2 {
5990
- static $ = $;
5991
- static seed() {
5992
- return Math.random();
5993
- }
5994
- static resets(next) {
5995
- return Math.random();
5996
- }
5997
- static value() {
5998
- this.resets();
5999
- return this.seed();
6000
- }
6001
- }
6002
- __decorate([
6003
- $mol_wire_method
6004
- ], Random, "seed", null);
6005
- __decorate([
6006
- $mol_wire_solo
6007
- ], Random, "resets", null);
6008
- __decorate([
6009
- $mol_wire_solo
6010
- ], Random, "value", null);
6011
- const first = Random.value();
6012
- Random.resets(null);
6013
- $mol_assert_unique(Random.value(), first);
6014
- },
6015
- });
6016
- })($ || ($ = {}));
6017
-
6018
- ;
6019
- "use strict";
6020
- var $;
6021
- (function ($) {
6022
- function $mol_wire_plex(host, field, descr) {
6023
- if (!descr)
6024
- descr = Reflect.getOwnPropertyDescriptor(host, field);
6025
- const orig = descr?.value ?? host[field];
6026
- const sup = Reflect.getPrototypeOf(host);
6027
- if (typeof sup[field] === 'function') {
6028
- Object.defineProperty(orig, 'name', { value: sup[field].name });
6029
- }
6030
- const descr2 = {
6031
- ...descr,
6032
- value: function (...args) {
6033
- let atom = $mol_wire_atom.plex(this, orig, args[0]);
6034
- if ((args.length === 1) || (args[1] === undefined)) {
6035
- if (!$mol_wire_fiber.warm)
6036
- return atom.result();
6037
- if ($mol_wire_auto()?.temp) {
6038
- return atom.once();
6039
- }
6040
- else {
6041
- return atom.sync();
6042
- }
6043
- }
6044
- return atom.resync(args);
6045
- }
6046
- };
6047
- Reflect.defineProperty(descr2.value, 'name', { value: orig.name + ' ' });
6048
- Reflect.defineProperty(descr2.value, 'length', { value: orig.length });
6049
- Object.assign(descr2.value, { orig });
6050
- Reflect.defineProperty(host, field, descr2);
6051
- return descr2;
6052
- }
6053
- $.$mol_wire_plex = $mol_wire_plex;
6054
- })($ || ($ = {}));
6055
-
6056
- ;
6057
- "use strict";
6058
- var $;
6059
- (function ($_1) {
6060
- $mol_test({
6061
- async 'Error caching'($) {
6062
- const next_cached = 123;
6063
- class Some extends $mol_object2 {
6064
- static $ = $;
6065
- static data(id, next) {
6066
- if (next)
6067
- return next;
6068
- setTimeout(() => {
6069
- $mol_wire_async(this).data(id, next_cached);
6070
- }, 10);
6071
- $mol_fail_hidden(new Promise(() => { }));
6072
- }
6073
- static run() {
6074
- return this.data('1');
6075
- }
6076
- }
6077
- __decorate([
6078
- $mol_wire_plex
6079
- ], Some, "data", null);
6080
- __decorate([
6081
- $mol_wire_method
6082
- ], Some, "run", null);
6083
- const val = await $mol_wire_async(Some).run();
6084
- $mol_assert_equal(val, next_cached);
6085
- },
6086
- 'Memoize by single simple key'($) {
6087
- class Team extends $mol_object2 {
6088
- static $ = $;
6089
- static user_name(user, next) {
6090
- return next ?? user;
6091
- }
6092
- static user_names() {
6093
- return [
6094
- this.user_name('jin'),
6095
- this.user_name('john'),
6096
- ];
6097
- }
6098
- }
6099
- __decorate([
6100
- $mol_wire_plex
6101
- ], Team, "user_name", null);
6102
- __decorate([
6103
- $mol_wire_solo
6104
- ], Team, "user_names", null);
6105
- $mol_assert_like(Team.user_names(), ['jin', 'john']);
6106
- Team.user_name('jin', 'JIN');
6107
- $mol_assert_like(Team.user_names(), ['JIN', 'john']);
6108
- },
6109
- 'Memoize by single complex key'($) {
6110
- class Map extends $mol_object2 {
6111
- static $ = $;
6112
- static tile(pos) {
6113
- return new String(`/tile=${pos}`);
6114
- }
6115
- static test() {
6116
- $mol_assert_like(this.tile([0, 1]), new String('/tile=0,1'));
6117
- $mol_assert_equal(this.tile([0, 1]), this.tile([0, 1]));
6118
- }
6119
- }
6120
- __decorate([
6121
- $mol_wire_plex
6122
- ], Map, "tile", null);
6123
- __decorate([
6124
- $mol_wire_method
6125
- ], Map, "test", null);
6126
- Map.test();
6127
- },
6128
- 'Owned value has js-path name'() {
6129
- class App extends $mol_object2 {
6130
- static like(friend) {
6131
- return new $mol_object2;
6132
- }
6133
- static relation([friend, props]) {
6134
- return new $mol_object2;
6135
- }
6136
- }
6137
- __decorate([
6138
- $mol_wire_plex
6139
- ], App, "like", null);
6140
- __decorate([
6141
- $mol_wire_plex
6142
- ], App, "relation", null);
6143
- $mol_assert_equal(`${App.like(123)}`, 'App.like<123>');
6144
- $mol_assert_equal(`${App.relation([123, [456]])}`, 'App.relation<[123,[456]]>');
6145
- },
6146
- 'Deep deps'($) {
6147
- class Fib extends $mol_object2 {
6148
- static $ = $;
6149
- static sums = 0;
6150
- static value(index, next) {
6151
- if (next)
6152
- return next;
6153
- if (index < 2)
6154
- return 1;
6155
- ++this.sums;
6156
- return this.value(index - 1) + this.value(index - 2);
6157
- }
6158
- }
6159
- __decorate([
6160
- $mol_wire_plex
6161
- ], Fib, "value", null);
6162
- $mol_assert_equal(Fib.value(4), 5);
6163
- $mol_assert_equal(Fib.sums, 3);
6164
- Fib.value(1, 2);
6165
- $mol_assert_equal(Fib.value(4), 8);
6166
- $mol_assert_equal(Fib.sums, 6);
6167
- },
6168
- });
6169
- })($ || ($ = {}));
6170
-
6171
- ;
6172
- "use strict";
6173
- var $;
6174
- (function ($) {
6175
- function $mol_wire_probe(task, def) {
6176
- const warm = $mol_wire_fiber.warm;
6177
- try {
6178
- $mol_wire_fiber.warm = false;
6179
- const res = task();
6180
- if (res === undefined)
6181
- return def;
6182
- return res;
6183
- }
6184
- finally {
6185
- $mol_wire_fiber.warm = warm;
6186
- }
6187
- }
6188
- $.$mol_wire_probe = $mol_wire_probe;
6189
- })($ || ($ = {}));
6190
-
6191
- ;
6192
- "use strict";
6193
- var $;
6194
- (function ($) {
6195
- $mol_test({
6196
- 'Previous value'() {
6197
- class Cache extends $mol_object2 {
6198
- static store(next) {
6199
- if (!next)
6200
- return {};
6201
- return {
6202
- ...$mol_wire_probe(() => this.store()) ?? {},
6203
- ...next,
6204
- };
6205
- }
6206
- }
6207
- __decorate([
6208
- $mol_wire_solo
6209
- ], Cache, "store", null);
6210
- $mol_assert_like(Cache.store(), {});
6211
- $mol_assert_like(Cache.store({ foo: 666 }), { foo: 666 });
6212
- $mol_assert_like(Cache.store({ bar: 777 }), { foo: 666, bar: 777 });
6213
- },
6214
- });
6215
- })($ || ($ = {}));
6216
-
6217
- ;
6218
- "use strict";
6219
- var $;
6220
- (function ($) {
6221
- $.$mol_mem = $mol_wire_solo;
6222
- $.$mol_mem_key = $mol_wire_plex;
6223
- })($ || ($ = {}));
6224
-
6225
- ;
6226
- "use strict";
6227
- var $;
6228
- (function ($) {
6229
- class $mol_view_selection extends $mol_object {
6230
- static focused(next, notify) {
6231
- const parents = [];
6232
- let element = next?.[0] ?? $mol_dom_context.document.activeElement;
6233
- while (element) {
6234
- parents.push(element);
6235
- element = element.parentNode;
6236
- }
6237
- if (!next || notify)
6238
- return parents;
6239
- new $mol_after_tick(() => {
6240
- const element = this.focused()[0];
6241
- if (element)
6242
- element.focus();
6243
- else
6244
- $mol_dom_context.blur();
6245
- });
6246
- return parents;
6247
- }
6248
- }
6249
- __decorate([
6250
- $mol_mem
6251
- ], $mol_view_selection, "focused", null);
6252
- $.$mol_view_selection = $mol_view_selection;
6253
- })($ || ($ = {}));
6254
-
6255
- ;
6256
- "use strict";
6257
- var $;
6258
- (function ($) {
6259
- class $mol_wrapper extends $mol_object2 {
6260
- static wrap;
6261
- static run(task) {
6262
- return this.func(task)();
6263
- }
6264
- static func(func) {
6265
- return this.wrap(func);
6266
- }
6267
- static get class() {
6268
- return (Class) => {
6269
- const construct = (target, args) => new Class(...args);
6270
- const handler = {
6271
- construct: this.func(construct)
6272
- };
6273
- handler[Symbol.toStringTag] = Class.name + '#';
6274
- return new Proxy(Class, handler);
6275
- };
6276
- }
6277
- static get method() {
6278
- return (obj, name, descr) => {
6279
- descr.value = this.func(descr.value);
6280
- return descr;
6281
- };
6282
- }
6283
- static get field() {
6284
- return (obj, name, descr) => {
6285
- descr.get = descr.set = this.func(descr.get);
6286
- return descr;
6287
- };
6288
- }
6289
- }
6290
- $.$mol_wrapper = $mol_wrapper;
6291
- })($ || ($ = {}));
6292
-
6293
- ;
6294
- "use strict";
6295
- var $;
6296
- (function ($) {
6297
- $mol_test({
6298
- 'run callback'() {
6299
- class Plus1 extends $mol_wrapper {
6300
- static wrap(task) {
6301
- return function (...args) {
6302
- return task.call(this, ...args) + 1;
6303
- };
6304
- }
6305
- }
6306
- $mol_assert_equal(Plus1.run(() => 2), 3);
6307
- },
6308
- 'wrap function'() {
6309
- class Plus1 extends $mol_wrapper {
6310
- static wrap(task) {
6311
- return function (...args) {
6312
- return task.call(this, ...args) + 1;
6313
- };
6314
- }
6315
- }
6316
- const obj = {
6317
- level: 2,
6318
- pow: Plus1.func(function (a) {
6319
- return a ** this.level;
6320
- })
6321
- };
6322
- $mol_assert_equal(obj.pow(2), 5);
6323
- },
6324
- 'decorate field getter'() {
6325
- class Plus1 extends $mol_wrapper {
6326
- static last = 0;
6327
- static wrap(task) {
6328
- return function (...args) {
6329
- return Plus1.last = (task.call(this, ...args) || 0) + 1;
6330
- };
6331
- }
6332
- }
6333
- class Foo {
6334
- static get two() {
6335
- return 1;
6336
- }
6337
- static set two(next) { }
6338
- }
6339
- __decorate([
6340
- Plus1.field
6341
- ], Foo, "two", null);
6342
- $mol_assert_equal(Foo.two, 2);
6343
- Foo.two = 3;
6344
- $mol_assert_equal(Plus1.last, 2);
6345
- $mol_assert_equal(Foo.two, 2);
6346
- },
6347
- 'decorate instance method'() {
6348
- class Plus1 extends $mol_wrapper {
6349
- static wrap(task) {
6350
- return function (...args) {
6351
- return task.call(this, ...args) + 1;
6352
- };
6353
- }
6354
- }
6355
- class Foo1 {
6356
- level = 2;
6357
- pow(a) {
6358
- return a ** this.level;
6359
- }
6360
- }
6361
- __decorate([
6362
- Plus1.method
6363
- ], Foo1.prototype, "pow", null);
6364
- const Foo2 = Foo1;
6365
- const foo = new Foo2;
6366
- $mol_assert_equal(foo.pow(2), 5);
6367
- },
6368
- 'decorate static method'() {
6369
- class Plus1 extends $mol_wrapper {
6370
- static wrap(task) {
6371
- return function (...args) {
6372
- return task.call(this, ...args) + 1;
6373
- };
6374
- }
6375
- }
6376
- class Foo {
6377
- static level = 2;
6378
- static pow(a) {
6379
- return a ** this.level;
6380
- }
6381
- }
6382
- __decorate([
6383
- Plus1.method
6384
- ], Foo, "pow", null);
6385
- $mol_assert_equal(Foo.pow(2), 5);
6386
- },
6387
- 'decorate class'() {
6388
- class BarInc extends $mol_wrapper {
6389
- static wrap(task) {
6390
- return function (...args) {
6391
- const foo = task.call(this, ...args);
6392
- foo.bar++;
6393
- return foo;
6394
- };
6395
- }
6396
- }
6397
- let Foo = class Foo {
6398
- bar;
6399
- constructor(bar) {
6400
- this.bar = bar;
6401
- }
6402
- };
6403
- Foo = __decorate([
6404
- BarInc.class
6405
- ], Foo);
6406
- $mol_assert_equal(new Foo(2).bar, 3);
6407
- },
6408
- });
6409
- })($ || ($ = {}));
6410
-
6411
- ;
6412
- "use strict";
6413
- var $;
6414
- (function ($) {
6415
- class $mol_memo extends $mol_wrapper {
6416
- static wrap(task) {
6417
- const store = new WeakMap();
6418
- const fun = function (next) {
6419
- if (next === undefined && store.has(this))
6420
- return store.get(this);
6421
- const val = task.call(this, next) ?? next;
6422
- store.set(this, val);
6423
- return val;
6424
- };
6425
- Reflect.defineProperty(fun, 'name', { value: task.name + ' ' });
6426
- return fun;
6427
- }
6428
- }
6429
- $.$mol_memo = $mol_memo;
6430
- })($ || ($ = {}));
6431
-
6432
- ;
6433
- "use strict";
6434
- var $;
6435
- (function ($) {
6436
- $mol_test({
6437
- 'memoize field'() {
6438
- class Foo {
6439
- static one = 1;
6440
- static get two() {
6441
- return ++this.one;
6442
- }
6443
- static set two(next) { }
6444
- }
6445
- __decorate([
6446
- $mol_memo.field
6447
- ], Foo, "two", null);
6448
- $mol_assert_equal(Foo.two, 2);
6449
- $mol_assert_equal(Foo.two, 2);
6450
- Foo.two = 3;
6451
- $mol_assert_equal(Foo.two, 3);
6452
- $mol_assert_equal(Foo.two, 3);
6453
- },
6454
- });
6455
- })($ || ($ = {}));
6456
-
6457
- ;
6458
- "use strict";
6459
- var $;
6460
- (function ($) {
6461
- function $mol_dom_qname(name) {
6462
- return name.replace(/\W/g, '').replace(/^(?=\d+)/, '_');
6463
- }
6464
- $.$mol_dom_qname = $mol_dom_qname;
6465
- })($ || ($ = {}));
6466
-
6467
- ;
6468
- "use strict";
6469
- var $;
6470
- (function ($) {
6471
- $.$mol_key_store = new WeakMap();
6472
- const TypedArray = Object.getPrototypeOf(Uint8Array);
6473
- function $mol_key(value) {
6474
- if (typeof value === 'bigint')
6475
- return value.toString() + 'n';
6476
- if (typeof value === 'symbol')
6477
- return value.description;
6478
- if (!value)
6479
- return JSON.stringify(value);
6480
- if (typeof value !== 'object' && typeof value !== 'function')
6481
- return JSON.stringify(value);
6482
- return JSON.stringify(value, (field, value) => {
6483
- if (typeof value === 'bigint')
6484
- return value.toString() + 'n';
6485
- if (typeof value === 'symbol')
6486
- return value.description;
6487
- if (!value)
6488
- return value;
6489
- if (typeof value !== 'object' && typeof value !== 'function')
6490
- return value;
6491
- if (Array.isArray(value))
6492
- return value;
6493
- const proto = Reflect.getPrototypeOf(value);
6494
- if (!proto)
6495
- return value;
6496
- if (Reflect.getPrototypeOf(proto) === null)
6497
- return value;
6498
- if ('toJSON' in value)
6499
- return value;
6500
- if (value instanceof RegExp)
6501
- return value.toString();
6502
- if (value instanceof TypedArray)
6503
- return [...value];
6504
- let key = $.$mol_key_store.get(value);
6505
- if (key)
6506
- return key;
6507
- key = $mol_guid();
6508
- $.$mol_key_store.set(value, key);
6509
- return key;
6510
- });
6511
- }
6512
- $.$mol_key = $mol_key;
6513
- })($ || ($ = {}));
6514
-
6515
- ;
6516
- "use strict";
6517
- var $;
6518
- (function ($) {
6519
- $mol_test({
6520
- 'Primitives'() {
6521
- $mol_assert_equal($mol_key(null), 'null');
6522
- $mol_assert_equal($mol_key(false), 'false');
6523
- $mol_assert_equal($mol_key(true), 'true');
6524
- $mol_assert_equal($mol_key(0), '0');
6525
- $mol_assert_equal($mol_key(1n << 64n), '18446744073709551616n');
6526
- $mol_assert_equal($mol_key(''), '""');
6527
- },
6528
- 'Array & POJO'() {
6529
- $mol_assert_equal($mol_key([null]), '[null]');
6530
- $mol_assert_equal($mol_key({ foo: 0 }), '{"foo":0}');
6531
- $mol_assert_equal($mol_key({ foo: [false] }), '{"foo":[false]}');
6532
- },
6533
- 'Uint8Array'() {
6534
- $mol_assert_equal($mol_key(new Uint8Array([1, 2])), '[1,2]');
6535
- $mol_assert_equal($mol_key([new Uint8Array([1, 2])]), '[[1,2]]');
6536
- $mol_assert_equal($mol_key({ foo: new Uint8Array([1, 2]) }), '{"foo":[1,2]}');
6537
- },
6538
- 'Function'() {
6539
- const func = () => { };
6540
- $mol_assert_equal($mol_key(func), $mol_key(func));
6541
- $mol_assert_unique($mol_key(func), $mol_key(() => { }));
6542
- },
6543
- 'Objects'() {
6544
- class User {
6545
- }
6546
- const jin = new User();
6547
- $mol_assert_equal($mol_key(jin), $mol_key(jin));
6548
- $mol_assert_unique($mol_key(jin), $mol_key(new User()));
6549
- },
6550
- 'Elements'() {
6551
- const foo = $mol_jsx("div", null, "bar");
6552
- $mol_assert_equal($mol_key(foo), $mol_key(foo));
6553
- $mol_assert_unique($mol_key(foo), $mol_key($mol_jsx("div", null, "bar")));
6554
- },
6555
- 'Custom JSON representation'() {
6556
- class User {
6557
- name;
6558
- age;
6559
- constructor(name, age) {
6560
- this.name = name;
6561
- this.age = age;
6562
- }
6563
- toJSON() { return { name: this.name }; }
6564
- }
6565
- $mol_assert_equal($mol_key(new User('jin', 18)), '{"name":"jin"}');
6566
- },
6567
- 'Special native classes'() {
6568
- $mol_assert_equal($mol_key(new Date('xyz')), 'null');
6569
- $mol_assert_equal($mol_key(new Date('2001-01-02T03:04:05.678Z')), '"2001-01-02T03:04:05.678Z"');
6570
- $mol_assert_equal($mol_key(/./), '"/./"');
6571
- $mol_assert_equal($mol_key(/\./gimsu), '"/\\\\./gimsu"');
6572
- },
6573
- });
6574
- })($ || ($ = {}));
6575
-
6576
- ;
6577
- "use strict";
6578
- var $;
6579
- (function ($) {
6580
- class $mol_after_frame extends $mol_after_timeout {
6581
- task;
6582
- constructor(task) {
6583
- super(16, task);
6584
- this.task = task;
6585
- }
6586
- }
6587
- $.$mol_after_frame = $mol_after_frame;
6588
- })($ || ($ = {}));
6589
-
6590
- ;
6591
- "use strict";
6592
- var $;
6593
- (function ($_1) {
6594
- $mol_test_mocks.push($ => {
6595
- $.$mol_after_frame = $mol_after_mock_commmon;
6596
- });
6597
- })($ || ($ = {}));
6598
-
6599
- ;
6600
- "use strict";
6601
-
6602
- ;
6603
- "use strict";
6604
-
6605
- ;
6606
- "use strict";
6607
- var $;
6608
- (function ($) {
6609
- class $mol_wire_log extends $mol_object2 {
6610
- static watch(task) {
6611
- return task;
6612
- }
6613
- static track(fiber) {
6614
- const prev = $mol_wire_probe(() => this.track(fiber));
6615
- let next;
6616
- try {
6617
- next = fiber.sync();
6618
- }
6619
- finally {
6620
- for (const pub of fiber.pub_list) {
6621
- if (pub instanceof $mol_wire_fiber) {
6622
- this.track(pub);
6623
- }
6624
- }
6625
- }
6626
- if (fiber.host === this)
6627
- return next;
6628
- if ($mol_compare_deep(prev, next)) {
6629
- this.$.$mol_log3_rise({
6630
- message: '💧 Same',
6631
- place: fiber,
6632
- });
6633
- }
6634
- else if (prev !== undefined) {
6635
- this.$.$mol_log3_rise({
6636
- message: '🔥 Next',
6637
- place: fiber,
6638
- prev,
6639
- });
6640
- }
6641
- return next;
6642
- }
6643
- static active() {
6644
- try {
6645
- this.watch()?.();
6646
- }
6647
- catch (error) {
6648
- $mol_fail_log(error);
6649
- }
6650
- finally {
6651
- for (const pub of $mol_wire_auto().pub_list) {
6652
- if (pub instanceof $mol_wire_fiber) {
6653
- this.track(pub);
6654
- }
6655
- }
6656
- }
6657
- }
6658
- }
6659
- __decorate([
6660
- $mol_mem
6661
- ], $mol_wire_log, "watch", null);
6662
- __decorate([
6663
- $mol_mem_key
6664
- ], $mol_wire_log, "track", null);
6665
- __decorate([
6666
- $mol_mem
6667
- ], $mol_wire_log, "active", null);
6668
- $.$mol_wire_log = $mol_wire_log;
6669
- })($ || ($ = {}));
6670
-
6671
- ;
6672
- "use strict";
6673
- var $;
6674
- (function ($) {
6675
- class $mol_wire_atom extends $mol_wire_fiber {
6676
- static solo(host, task) {
6677
- const field = task.name + '<>';
6678
- const existen = Object.getOwnPropertyDescriptor(host ?? task, field)?.value;
6679
- if (existen)
6680
- return existen;
6681
- const prefix = host?.[Symbol.toStringTag] ?? (host instanceof Function ? $$.$mol_func_name(host) : host);
6682
- const key = prefix + ('.' + field);
6683
- const fiber = new $mol_wire_atom(key, task, host, []);
6684
- (host ?? task)[field] = fiber;
6685
- return fiber;
6686
- }
6687
- static plex(host, task, key) {
6688
- const field = task.name + '<>';
6689
- let dict = Object.getOwnPropertyDescriptor(host ?? task, field)?.value;
6690
- const prefix = host?.[Symbol.toStringTag] ?? (host instanceof Function ? $$.$mol_func_name(host) : host);
6691
- const key_str = $mol_key(key);
6692
- if (dict) {
6693
- const existen = dict.get(key_str);
6694
- if (existen)
6695
- return existen;
6696
- }
6697
- else {
6698
- dict = (host ?? task)[field] = new Map();
6699
- }
6700
- const id = prefix + ('.' + task.name) + ('<' + key_str.replace(/^"|"$/g, "'") + '>');
6701
- const fiber = new $mol_wire_atom(id, task, host, [key]);
6702
- dict.set(key_str, fiber);
6703
- return fiber;
6704
- }
6705
- static watching = new Set();
6706
- static watcher = null;
6707
- static watch() {
6708
- $mol_wire_atom.watcher = new $mol_after_frame($mol_wire_atom.watch);
6709
- for (const atom of $mol_wire_atom.watching) {
6710
- if (atom.cursor === $mol_wire_cursor.final) {
6711
- $mol_wire_atom.watching.delete(atom);
6712
- }
6713
- else {
6714
- atom.cursor = $mol_wire_cursor.stale;
6715
- atom.fresh();
6716
- }
6717
- }
6718
- }
6719
- watch() {
6720
- if (!$mol_wire_atom.watcher) {
6721
- $mol_wire_atom.watcher = new $mol_after_frame($mol_wire_atom.watch);
6722
- }
6723
- $mol_wire_atom.watching.add(this);
6724
- }
6725
- resync(args) {
6726
- return this.put(this.task.call(this.host, ...args));
6727
- }
6728
- once() {
6729
- return this.sync();
6730
- }
6731
- channel() {
6732
- return Object.assign((next) => {
6733
- if (next !== undefined)
6734
- return this.resync([...this.args, next]);
6735
- if (!$mol_wire_fiber.warm)
6736
- return this.result();
6737
- if ($mol_wire_auto()?.temp) {
6738
- return this.once();
6739
- }
6740
- else {
6741
- return this.sync();
6742
- }
6743
- }, { atom: this });
6744
- }
6745
- destructor() {
6746
- super.destructor();
6747
- if (this.pub_from === 0) {
6748
- ;
6749
- (this.host ?? this.task)[this.field()] = null;
6750
- }
6751
- else {
6752
- ;
6753
- (this.host ?? this.task)[this.field()].delete($mol_key(this.args[0]));
6754
- }
6755
- }
6756
- put(next) {
6757
- const prev = this.cache;
6758
- update: if (next !== prev) {
6759
- try {
6760
- if ($mol_compare_deep(prev, next))
6761
- break update;
6762
- }
6763
- catch (error) {
6764
- $mol_fail_log(error);
6765
- }
6766
- if ($mol_owning_check(this, prev)) {
6767
- prev.destructor();
6768
- }
6769
- if ($mol_owning_catch(this, next)) {
6770
- try {
6771
- next[Symbol.toStringTag] = this[Symbol.toStringTag];
6772
- }
6773
- catch {
6774
- Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
6775
- }
6776
- }
6777
- if (!this.sub_empty)
6778
- this.emit();
6779
- }
6780
- this.cache = next;
6781
- this.cursor = $mol_wire_cursor.fresh;
6782
- if ($mol_promise_like(next))
6783
- return next;
6784
- this.complete_pubs();
6785
- return next;
6786
- }
6787
- }
6788
- __decorate([
6789
- $mol_wire_method
6790
- ], $mol_wire_atom.prototype, "resync", null);
6791
- __decorate([
6792
- $mol_wire_method
6793
- ], $mol_wire_atom.prototype, "once", null);
6794
- $.$mol_wire_atom = $mol_wire_atom;
6795
- })($ || ($ = {}));
6796
-
6797
- ;
6798
- "use strict";
6799
- var $;
6800
- (function ($) {
6801
- $mol_wire_log.active();
6802
- })($ || ($ = {}));
6803
-
6804
- ;
6805
- "use strict";
6806
- var $;
6807
- (function ($) {
6808
- function $mol_wire_watch() {
6809
- const atom = $mol_wire_auto();
6810
- if (atom instanceof $mol_wire_atom) {
6811
- atom.watch();
6812
- }
6813
- else {
6814
- $mol_fail(new Error('Atom is required for watching'));
6815
- }
6816
- }
6817
- $.$mol_wire_watch = $mol_wire_watch;
6818
- })($ || ($ = {}));
6819
-
6820
- ;
6821
- "use strict";
6822
- var $;
6823
- (function ($) {
6824
- function $mol_const(value) {
6825
- const getter = (() => value);
6826
- getter['()'] = value;
6827
- getter[Symbol.toStringTag] = value;
6828
- getter[$mol_dev_format_head] = () => $mol_dev_format_span({}, '()=> ', $mol_dev_format_auto(value));
6829
- return getter;
6830
- }
6831
- $.$mol_const = $mol_const;
6832
- })($ || ($ = {}));
6833
-
6834
- ;
6835
- "use strict";
6836
- var $;
6837
- (function ($) {
6838
- $mol_test({
6839
- 'const returns stored value'() {
6840
- const foo = { bar: $mol_const(Math.random()) };
6841
- $mol_assert_equal(foo.bar(), foo.bar());
6842
- $mol_assert_equal(foo.bar(), foo.bar['()']);
6843
- },
6844
- });
6845
- })($ || ($ = {}));
6846
-
6847
- ;
6848
- "use strict";
6849
- var $;
6850
- (function ($) {
6851
- function $mol_wire_solid() {
6852
- let current = $mol_wire_auto();
6853
- if (current.temp)
6854
- current = current.host;
6855
- if (current.reap !== nothing) {
6856
- current?.sub_on(sub, sub.data.length);
6857
- }
6858
- current.reap = nothing;
6859
- }
6860
- $.$mol_wire_solid = $mol_wire_solid;
6861
- const nothing = () => { };
6862
- const sub = new $mol_wire_pub_sub;
6863
- })($ || ($ = {}));
6864
-
6865
- ;
6866
- "use strict";
6867
- var $;
6868
- (function ($) {
6869
- function $mol_dom_render_attributes(el, attrs) {
6870
- for (let name in attrs) {
6871
- let val = attrs[name];
6872
- if (val === undefined) {
6873
- continue;
6874
- }
6875
- else if (val === null || val === false) {
6876
- if (!el.hasAttribute(name))
6877
- continue;
6878
- el.removeAttribute(name);
6879
- }
6880
- else {
6881
- const str = String(val);
6882
- if (el.getAttribute(name) === str)
6883
- continue;
6884
- el.setAttribute(name, str);
6885
- }
6886
- }
6887
- }
6888
- $.$mol_dom_render_attributes = $mol_dom_render_attributes;
6889
- })($ || ($ = {}));
6890
-
6891
- ;
6892
- "use strict";
6893
- var $;
6894
- (function ($) {
6895
- function $mol_dom_render_events(el, events, passive = false) {
6896
- for (let name in events) {
6897
- el.addEventListener(name, events[name], { passive });
6898
- }
6899
- }
6900
- $.$mol_dom_render_events = $mol_dom_render_events;
6901
- })($ || ($ = {}));
6902
-
6903
- ;
6904
- "use strict";
6905
- var $;
6906
- (function ($) {
6907
- function $mol_dom_render_styles(el, styles) {
6908
- for (let name in styles) {
6909
- let val = styles[name];
6910
- const style = el.style;
6911
- const kebab = (name) => name.replace(/[A-Z]/g, letter => '-' + letter.toLowerCase());
6912
- if (typeof val === 'number') {
6913
- style.setProperty(kebab(name), `${val}px`);
6914
- }
6915
- else {
6916
- style.setProperty(kebab(name), val);
6917
- }
6918
- }
6919
- }
6920
- $.$mol_dom_render_styles = $mol_dom_render_styles;
6921
- })($ || ($ = {}));
6922
-
6923
- ;
6924
- "use strict";
6925
- var $;
6926
- (function ($) {
6927
- function $mol_dom_render_fields(el, fields) {
6928
- for (let key in fields) {
6929
- const val = fields[key];
6930
- if (val === undefined)
6931
- continue;
6932
- if (val === el[key])
6933
- continue;
6934
- el[key] = val;
6935
- }
6936
- }
6937
- $.$mol_dom_render_fields = $mol_dom_render_fields;
6938
- })($ || ($ = {}));
6939
-
6940
- ;
6941
- "use strict";
6942
-
6943
- ;
6944
- "use strict";
6945
-
6946
- ;
6947
- "use strict";
6948
-
6949
- ;
6950
- "use strict";
6951
- var $;
6952
- (function ($) {
6953
- function $mol_style_attach(id, text) {
6954
- const doc = $mol_dom_context.document;
6955
- if (!doc)
6956
- return null;
6957
- const elid = `$mol_style_attach:${id}`;
6958
- let el = doc.getElementById(elid);
6959
- if (!el) {
6960
- el = doc.createElement('style');
6961
- el.id = elid;
6962
- doc.head.appendChild(el);
6963
- }
6964
- if (el.innerHTML != text)
6965
- el.innerHTML = text;
6966
- return el;
6967
- }
6968
- $.$mol_style_attach = $mol_style_attach;
6969
- })($ || ($ = {}));
6970
-
6971
- ;
6972
- "use strict";
6973
- var $;
6974
- (function ($) {
6975
- class $mol_decor {
6976
- value;
6977
- constructor(value) {
6978
- this.value = value;
6979
- }
6980
- prefix() { return ''; }
6981
- valueOf() { return this.value; }
6982
- postfix() { return ''; }
6983
- toString() {
6984
- return `${this.prefix()}${this.valueOf()}${this.postfix()}`;
6985
- }
6986
- }
6987
- $.$mol_decor = $mol_decor;
6988
- })($ || ($ = {}));
6989
-
6990
- ;
6991
- "use strict";
6992
- var $;
6993
- (function ($) {
6994
- class $mol_style_unit extends $mol_decor {
6995
- literal;
6996
- constructor(value, literal) {
6997
- super(value);
6998
- this.literal = literal;
6999
- }
7000
- postfix() {
7001
- return this.literal;
7002
- }
7003
- static per(value) { return `${value}%`; }
7004
- static px(value) { return `${value}px`; }
7005
- static mm(value) { return `${value}mm`; }
7006
- static cm(value) { return `${value}cm`; }
7007
- static Q(value) { return `${value}Q`; }
7008
- static in(value) { return `${value}in`; }
7009
- static pc(value) { return `${value}pc`; }
7010
- static pt(value) { return `${value}pt`; }
7011
- static cap(value) { return `${value}cap`; }
7012
- static ch(value) { return `${value}ch`; }
7013
- static em(value) { return `${value}em`; }
7014
- static rem(value) { return `${value}rem`; }
7015
- static ex(value) { return `${value}ex`; }
7016
- static ic(value) { return `${value}ic`; }
7017
- static lh(value) { return `${value}lh`; }
7018
- static rlh(value) { return `${value}rlh`; }
7019
- static vh(value) { return `${value}vh`; }
7020
- static vw(value) { return `${value}vw`; }
7021
- static vi(value) { return `${value}vi`; }
7022
- static vb(value) { return `${value}vb`; }
7023
- static vmin(value) { return `${value}vmin`; }
7024
- static vmax(value) { return `${value}vmax`; }
7025
- static deg(value) { return `${value}deg`; }
7026
- static rad(value) { return `${value}rad`; }
7027
- static grad(value) { return `${value}grad`; }
7028
- static turn(value) { return `${value}turn`; }
7029
- static s(value) { return `${value}s`; }
7030
- static ms(value) { return `${value}ms`; }
7031
- }
7032
- $.$mol_style_unit = $mol_style_unit;
7033
- })($ || ($ = {}));
7034
-
7035
- ;
7036
- "use strict";
7037
- var $;
7038
- (function ($) {
7039
- const { per } = $mol_style_unit;
7040
- class $mol_style_func extends $mol_decor {
7041
- name;
7042
- constructor(name, value) {
7043
- super(value);
7044
- this.name = name;
7045
- }
7046
- prefix() { return this.name + '('; }
7047
- postfix() { return ')'; }
7048
- static linear_gradient(value) {
7049
- return new $mol_style_func('linear-gradient', value);
7050
- }
7051
- static calc(value) {
7052
- return new $mol_style_func('calc', value);
7053
- }
7054
- static vary(name, defaultValue) {
7055
- return new $mol_style_func('var', defaultValue ? [name, defaultValue] : name);
7056
- }
7057
- static url(href) {
7058
- return new $mol_style_func('url', JSON.stringify(href));
7059
- }
7060
- static hsla(hue, saturation, lightness, alpha) {
7061
- return new $mol_style_func('hsla', [hue, per(saturation), per(lightness), alpha]);
7062
- }
7063
- static clamp(min, mid, max) {
7064
- return new $mol_style_func('clamp', [min, mid, max]);
7065
- }
7066
- static rgba(red, green, blue, alpha) {
7067
- return new $mol_style_func('rgba', [red, green, blue, alpha]);
7068
- }
7069
- static scale(zoom) {
7070
- return new $mol_style_func('scale', [zoom]);
7071
- }
7072
- static linear(...breakpoints) {
7073
- return new $mol_style_func("linear", breakpoints.map((e) => Array.isArray(e)
7074
- ? String(e[0]) +
7075
- " " +
7076
- (typeof e[1] === "number" ? e[1] + "%" : e[1].toString())
7077
- : String(e)));
7078
- }
7079
- static cubic_bezier(x1, y1, x2, y2) {
7080
- return new $mol_style_func('cubic-bezier', [x1, y1, x2, y2]);
7081
- }
7082
- static steps(value, step_position) {
7083
- return new $mol_style_func('steps', [value, step_position]);
7084
- }
7085
- static blur(value) {
7086
- return new $mol_style_func('blur', value ?? "");
7087
- }
7088
- static brightness(value) {
7089
- return new $mol_style_func('brightness', value ?? "");
7090
- }
7091
- static contrast(value) {
7092
- return new $mol_style_func('contrast', value ?? "");
7093
- }
7094
- static drop_shadow(color, x_offset, y_offset, blur_radius) {
7095
- return new $mol_style_func("drop-shadow", blur_radius
7096
- ? [color, x_offset, y_offset, blur_radius]
7097
- : [color, x_offset, y_offset]);
7098
- }
7099
- static grayscale(value) {
7100
- return new $mol_style_func('grayscale', value ?? "");
7101
- }
7102
- static hue_rotate(value) {
7103
- return new $mol_style_func('hue-rotate', value ?? "");
7104
- }
7105
- static invert(value) {
7106
- return new $mol_style_func('invert', value ?? "");
7107
- }
7108
- static opacity(value) {
7109
- return new $mol_style_func('opacity', value ?? "");
7110
- }
7111
- static sepia(value) {
7112
- return new $mol_style_func('sepia', value ?? "");
7113
- }
7114
- static saturate(value) {
7115
- return new $mol_style_func('saturate', value ?? "");
7116
- }
7117
- }
7118
- $.$mol_style_func = $mol_style_func;
7119
- })($ || ($ = {}));
7120
-
7121
- ;
7122
- "use strict";
7123
-
7124
- ;
7125
- "use strict";
7126
- var $;
7127
- (function ($) {
7128
- function $mol_style_prop(prefix, keys) {
7129
- const record = keys.reduce((rec, key) => {
7130
- rec[key] = $mol_style_func.vary(`--${prefix}_${key}`);
7131
- return rec;
7132
- }, {});
7133
- return record;
7134
- }
7135
- $.$mol_style_prop = $mol_style_prop;
7136
- })($ || ($ = {}));
7137
-
7138
- ;
7139
- "use strict";
7140
- var $;
7141
- (function ($) {
7142
- $.$mol_theme = $mol_style_prop('mol_theme', [
7143
- 'back',
7144
- 'hover',
7145
- 'card',
7146
- 'current',
7147
- 'special',
7148
- 'text',
7149
- 'control',
7150
- 'shade',
7151
- 'line',
7152
- 'focus',
7153
- 'field',
7154
- 'image',
7155
- ]);
7156
- })($ || ($ = {}));
7157
-
7158
- ;
7159
- "use strict";
7160
- var $;
7161
- (function ($) {
7162
- $mol_style_attach("mol/theme/theme.css", ":root {\n\t--mol_theme_hue: 210deg;\n\t--mol_theme_hue_spread: 90deg;\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\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\t/* --mol_theme_back: oklch( 20% .03 var(--mol_theme_hue) );\n\t--mol_theme_card: oklch( 35% .05 var(--mol_theme_hue) / .25 );\n\t--mol_theme_field: oklch( 0% 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( 50% 0 var(--mol_theme_hue) / .2 );\n\t--mol_theme_focus: oklch( 80% .2 calc( var(--mol_theme_hue) + 120deg ) );\n\t\n\t--mol_theme_control: oklch( 70% .1 var(--mol_theme_hue) );\n\t--mol_theme_current: oklch( 80% .2 calc( var(--mol_theme_hue) - 60deg ) );\n\t--mol_theme_special: oklch( 80% .3 calc( var(--mol_theme_hue) + 60deg ) ); */\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\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\t\n\t/* --mol_theme_back: oklch( 93% .01 var(--mol_theme_hue) );\n\t--mol_theme_card: oklch( 100% .02 var(--mol_theme_hue) / .25 );\n\t--mol_theme_field: oklch( 100% 0 var(--mol_theme_hue) / .5 );\n\t--mol_theme_hover: oklch( 70% 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( 70% 0 var(--mol_theme_hue) / .2 );\n\t--mol_theme_focus: oklch( 20% .8 calc( var(--mol_theme_hue) + 120deg ) );\n\t\n\t--mol_theme_control: oklch( 45% .25 var(--mol_theme_hue) );\n\t--mol_theme_current: oklch( 45% .5 calc( var(--mol_theme_hue) - 60deg ) );\n\t--mol_theme_special: oklch( 45% .5 calc( var(--mol_theme_hue) + 60deg ) ); */\n\n}\n\n:where( :root, [mol_theme=\"$mol_theme_dark\"] ) [mol_theme=\"$mol_theme_base\"] {\n\t--mol_theme_back: hsl( var(--mol_theme_hue), 50%, 30% );\n\t--mol_theme_card: hsl( var(--mol_theme_hue), 40%, 20%, .25 );\n\t/* --mol_theme_back: oklch( 25% .05 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: hsl( var(--mol_theme_hue), 50%, 80% );\n\t--mol_theme_card: hsl( var(--mol_theme_hue), 80%, 95%, .25 );\n\t/* --mol_theme_back: oklch( 95% .02 var(--mol_theme_hue) );\n\t--mol_theme_card: oklch( 80% .05 var(--mol_theme_hue) / .25 ); */\n}\n\n:where( :root, [mol_theme=\"$mol_theme_dark\"] ) [mol_theme=\"$mol_theme_accent\"] {\n\t--mol_theme_back: hsl( calc( var(--mol_theme_hue) + 180deg ), 90%, 30% );\n\t--mol_theme_card: hsl( calc( var(--mol_theme_hue) + 180deg ), 80%, 20%, .25 );\n\t/* --mol_theme_back: oklch( 40% .2 calc( var(--mol_theme_hue) + 120deg ) );\n\t--mol_theme_card: oklch( 50% .3 calc( var(--mol_theme_hue) + 120deg ) / .25 ); */\n}\n:where( [mol_theme=\"$mol_theme_light\"] ) [mol_theme=\"$mol_theme_accent\"] {\n\t--mol_theme_back: hsl( calc( var(--mol_theme_hue) + 180deg ), 90%, 75% );\n\t--mol_theme_card: hsl( calc( var(--mol_theme_hue) + 180deg ), 80%, 90%, .25 );\n\t/* --mol_theme_back: oklch( 90% .03 calc( var(--mol_theme_hue) + 120deg ) );\n\t--mol_theme_card: oklch( 80% .05 calc( var(--mol_theme_hue) + 120deg ) / .25 ); */\n}\n\n:where( :root, [mol_theme=\"$mol_theme_dark\"] ) [mol_theme=\"$mol_theme_current\"] {\n\t--mol_theme_back: hsl( calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ), 50%, 30% );\n\t--mol_theme_card: hsl( calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ), 40%, 20%, .25 );\n\t/* --mol_theme_back: oklch( 25% .05 calc( var(--mol_theme_hue) - 60deg ) );\n\t--mol_theme_card: oklch( 35% .1 calc( var(--mol_theme_hue) - 60deg ) / .25 ); */\n}\n:where( [mol_theme=\"$mol_theme_light\"] ) [mol_theme=\"$mol_theme_current\"] {\n\t--mol_theme_back: hsl( calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ), 50%, 92% );\n\t--mol_theme_card: hsl( calc( var(--mol_theme_hue) - var(--mol_theme_hue_spread) ), 80%, 100%, .5 );\n\t/* --mol_theme_back: oklch( 95% .02 calc( var(--mol_theme_hue) - 60deg ) );\n\t--mol_theme_card: oklch( 80% .05 calc( var(--mol_theme_hue) - 60deg ) / .25 ); */\n}\n\n:where( :root, [mol_theme=\"$mol_theme_dark\"] ) [mol_theme=\"$mol_theme_special\"] {\n\t--mol_theme_back: hsl( calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ), 50%, 30% );\n\t--mol_theme_card: hsl( calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ), 40%, 20%, .25 );\n\t/* --mol_theme_back: oklch( 25% .05 calc( var(--mol_theme_hue) + 60deg ) );\n\t--mol_theme_card: oklch( 35% .1 calc( var(--mol_theme_hue) + 60deg ) / .25 ); */\n}\n:where( [mol_theme=\"$mol_theme_light\"] ) [mol_theme=\"$mol_theme_special\"] {\n\t--mol_theme_back: hsl( calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ), 50%, 92% );\n\t--mol_theme_card: hsl( calc( var(--mol_theme_hue) + var(--mol_theme_hue_spread) ), 80%, 100%, .5 );\n\t/* --mol_theme_back: oklch( 95% .02 calc( var(--mol_theme_hue) + 60deg ) );\n\t--mol_theme_card: oklch( 80% .05 calc( var(--mol_theme_hue) + 60deg ) / .25 ); */\n}\n");
7163
- })($ || ($ = {}));
7164
-
7165
- ;
7166
- "use strict";
7167
- var $;
7168
- (function ($) {
7169
- $.$mol_gap = $mol_style_prop('mol_gap', [
7170
- 'block',
7171
- 'text',
7172
- 'round',
7173
- 'space',
7174
- 'blur',
7175
- ]);
7176
- })($ || ($ = {}));
7177
-
7178
- ;
7179
- "use strict";
7180
- var $;
7181
- (function ($) {
7182
- $mol_style_attach("mol/gap/gap.css", ":root {\n\t--mol_gap_block: .75rem;\n\t--mol_gap_text: .5rem .75rem;\n\t--mol_gap_round: .25rem;\n\t--mol_gap_space: .25rem;\n\t--mol_gap_blur: .5rem;\n}\n");
7183
- })($ || ($ = {}));
7184
-
7185
- ;
7186
- "use strict";
7187
- var $;
7188
- (function ($) {
7189
- function $mol_view_visible_width() {
7190
- return $mol_window.size().width;
7191
- }
7192
- $.$mol_view_visible_width = $mol_view_visible_width;
7193
- function $mol_view_visible_height() {
7194
- return $mol_window.size().height;
7195
- }
7196
- $.$mol_view_visible_height = $mol_view_visible_height;
7197
- function $mol_view_state_key(suffix) {
7198
- return suffix;
7199
- }
7200
- $.$mol_view_state_key = $mol_view_state_key;
7201
- class $mol_view extends $mol_object {
7202
- static Root(id) {
7203
- return new this;
7204
- }
7205
- autorun() {
7206
- try {
7207
- this.dom_tree();
7208
- document.title = this.title();
7209
- }
7210
- catch (error) {
7211
- $mol_fail_log(error);
7212
- }
7213
- }
7214
- static autobind() {
7215
- const nodes = $mol_dom_context.document.querySelectorAll('[mol_view_root]:not([mol_view_root=""])');
7216
- for (let i = nodes.length - 1; i >= 0; --i) {
7217
- const name = nodes.item(i).getAttribute('mol_view_root');
7218
- const View = $[name];
7219
- if (!View) {
7220
- console.error(`Can not attach view. Class not found: ${name}`);
7221
- continue;
7222
- }
7223
- const view = View.Root(i);
7224
- view.dom_node(nodes.item(i));
7225
- view.autorun();
7226
- }
7227
- }
7228
- title() {
7229
- return this.toString().match(/.*\.(\w+)/)?.[1] ?? this.toString();
7230
- }
7231
- focused(next) {
7232
- let node = this.dom_node();
7233
- const value = $mol_view_selection.focused(next === undefined ? undefined : (next ? [node] : []));
7234
- return value.indexOf(node) !== -1;
7235
- }
7236
- state_key(suffix = '') {
7237
- return this.$.$mol_view_state_key(suffix);
7238
- }
7239
- dom_name() {
7240
- return $mol_dom_qname(this.constructor.toString()) || 'div';
7241
- }
7242
- dom_name_space() { return 'http://www.w3.org/1999/xhtml'; }
7243
- sub() {
7244
- return [];
7245
- }
7246
- sub_visible() {
7247
- return this.sub();
7248
- }
7249
- minimal_width() {
7250
- let min = 0;
7251
- try {
7252
- const sub = this.sub();
7253
- if (!sub)
7254
- return 0;
7255
- sub.forEach(view => {
7256
- if (view instanceof $mol_view) {
7257
- min = Math.max(min, view.minimal_width());
7258
- }
7259
- });
7260
- }
7261
- catch (error) {
7262
- $mol_fail_log(error);
7263
- return 24;
7264
- }
7265
- return min;
7266
- }
7267
- maximal_width() {
7268
- return this.minimal_width();
7269
- }
7270
- minimal_height() {
7271
- let min = 0;
7272
- try {
7273
- for (const view of this.sub() ?? []) {
7274
- if (view instanceof $mol_view) {
7275
- min = Math.max(min, view.minimal_height());
7276
- }
7277
- }
7278
- }
7279
- catch (error) {
7280
- $mol_fail_log(error);
7281
- return 24;
7282
- }
7283
- return min;
7284
- }
7285
- static watchers = new Set();
7286
- view_rect() {
7287
- if ($mol_wire_probe(() => this.view_rect()) === undefined) {
7288
- $mol_wire_watch();
7289
- return null;
7290
- }
7291
- else {
7292
- const { width, height, left, right, top, bottom } = this.dom_node().getBoundingClientRect();
7293
- return { width, height, left, right, top, bottom };
7294
- }
7295
- }
7296
- dom_id() {
7297
- return this.toString().replace(/</g, '(').replace(/>/g, ')').replaceAll(/"/g, "'");
7298
- }
7299
- dom_node_external(next) {
7300
- const node = next ?? $mol_dom_context.document.createElementNS(this.dom_name_space(), this.dom_name());
7301
- const id = this.dom_id();
7302
- node.setAttribute('id', id);
7303
- node.toString = $mol_const('<#' + id + '>');
7304
- return node;
7305
- }
7306
- dom_node(next) {
7307
- $mol_wire_solid();
7308
- const node = this.dom_node_external(next);
7309
- $mol_dom_render_attributes(node, this.attr_static());
7310
- const events = this.event_async();
7311
- $mol_dom_render_events(node, events);
7312
- return node;
7313
- }
7314
- dom_final() {
7315
- this.render();
7316
- const sub = this.sub_visible();
7317
- if (!sub)
7318
- return;
7319
- for (const el of sub) {
7320
- if (el && typeof el === 'object' && 'dom_final' in el) {
7321
- el['dom_final']();
7322
- }
7323
- }
7324
- return this.dom_node();
7325
- }
7326
- dom_tree(next) {
7327
- const node = this.dom_node(next);
7328
- render: try {
7329
- $mol_dom_render_attributes(node, { mol_view_error: null });
7330
- try {
7331
- this.render();
7332
- }
7333
- finally {
7334
- for (let plugin of this.plugins()) {
7335
- if (plugin instanceof $mol_plugin) {
7336
- plugin.dom_tree();
7337
- }
7338
- }
7339
- }
7340
- }
7341
- catch (error) {
7342
- $mol_fail_log(error);
7343
- const mol_view_error = $mol_promise_like(error) ? 'Promise' : error.name || error.constructor.name;
7344
- $mol_dom_render_attributes(node, { mol_view_error });
7345
- if ($mol_promise_like(error))
7346
- break render;
7347
- try {
7348
- const message = error.message || error;
7349
- node.innerText = message.replace(/^|$/mg, '\xA0\xA0');
7350
- }
7351
- catch { }
7352
- }
7353
- try {
7354
- this.auto();
7355
- }
7356
- catch (error) {
7357
- $mol_fail_log(error);
7358
- }
7359
- return node;
7360
- }
7361
- dom_node_actual() {
7362
- const node = this.dom_node();
7363
- $mol_dom_render_styles(node, this.style_size());
7364
- const attr = this.attr();
7365
- const style = this.style();
7366
- $mol_dom_render_attributes(node, attr);
7367
- $mol_dom_render_styles(node, style);
7368
- return node;
7369
- }
7370
- auto() {
7371
- return null;
7372
- }
7373
- render() {
7374
- const node = this.dom_node_actual();
7375
- const sub = this.sub_visible();
7376
- if (!sub)
7377
- return;
7378
- const nodes = sub.map(child => {
7379
- if (child == null)
7380
- return null;
7381
- return (child instanceof $mol_view)
7382
- ? child.dom_node()
7383
- : child instanceof $mol_dom_context.Node
7384
- ? child
7385
- : String(child);
7386
- });
7387
- $mol_dom_render_children(node, nodes);
7388
- for (const el of sub)
7389
- if (el && typeof el === 'object' && 'dom_tree' in el)
7390
- el['dom_tree']();
7391
- $mol_dom_render_fields(node, this.field());
7392
- }
7393
- static view_classes() {
7394
- const proto = this.prototype;
7395
- let current = proto;
7396
- const classes = [];
7397
- while (current) {
7398
- if (current.constructor.name !== classes.at(-1)?.name) {
7399
- classes.push(current.constructor);
7400
- }
7401
- if (!(current instanceof $mol_view))
7402
- break;
7403
- current = Object.getPrototypeOf(current);
7404
- }
7405
- return classes;
7406
- }
7407
- static _view_names;
7408
- static view_names(suffix) {
7409
- let cache = Reflect.getOwnPropertyDescriptor(this, '_view_names')?.value;
7410
- if (!cache)
7411
- cache = this._view_names = new Map;
7412
- const cached = cache.get(suffix);
7413
- if (cached)
7414
- return cached;
7415
- const names = [];
7416
- const suffix2 = '_' + suffix[0].toLowerCase() + suffix.substring(1);
7417
- for (const Class of this.view_classes()) {
7418
- if (suffix in Class.prototype)
7419
- names.push(this.$.$mol_func_name(Class) + suffix2);
7420
- else
7421
- break;
7422
- }
7423
- cache.set(suffix, names);
7424
- return names;
7425
- }
7426
- view_names_owned() {
7427
- const names = [];
7428
- let owner = $mol_owning_get(this);
7429
- if (!(owner?.host instanceof $mol_view))
7430
- return names;
7431
- const suffix = owner.task.name.trim();
7432
- const suffix2 = '_' + suffix[0].toLowerCase() + suffix.substring(1);
7433
- names.push(...owner.host.constructor.view_names(suffix));
7434
- for (let prefix of owner.host.view_names_owned()) {
7435
- names.push(prefix + suffix2);
7436
- }
7437
- return names;
7438
- }
7439
- view_names() {
7440
- const names = new Set();
7441
- for (let name of this.view_names_owned())
7442
- names.add(name);
7443
- for (let Class of this.constructor.view_classes()) {
7444
- const name = this.$.$mol_func_name(Class);
7445
- if (name)
7446
- names.add(name);
7447
- }
7448
- return names;
7449
- }
7450
- theme(next = null) {
7451
- return next;
7452
- }
7453
- attr_static() {
7454
- let attrs = {};
7455
- for (let name of this.view_names())
7456
- attrs[name.replace(/\$/g, '').replace(/^(?=\d)/, '_').toLowerCase()] = '';
7457
- return attrs;
7458
- }
7459
- attr() {
7460
- return {
7461
- mol_theme: this.theme() ?? undefined,
7462
- };
7463
- }
7464
- style_size() {
7465
- return {
7466
- minHeight: this.minimal_height(),
7467
- minWidth: this.minimal_width(),
7468
- };
7469
- }
7470
- style() {
7471
- return {};
7472
- }
7473
- field() {
7474
- return {};
7475
- }
7476
- event() {
7477
- return {};
7478
- }
7479
- event_async() {
7480
- return { ...$mol_wire_async(this.event()) };
7481
- }
7482
- plugins() {
7483
- return [];
7484
- }
7485
- [$mol_dev_format_head]() {
7486
- return $mol_dev_format_span({}, $mol_dev_format_native(this));
7487
- }
7488
- *view_find(check, path = []) {
7489
- if (check(this))
7490
- return yield [...path, this];
7491
- try {
7492
- for (const item of this.sub()) {
7493
- if (item instanceof $mol_view) {
7494
- yield* item.view_find(check, [...path, this]);
7495
- }
7496
- }
7497
- }
7498
- catch (error) {
7499
- if ($mol_promise_like(error))
7500
- $mol_fail_hidden(error);
7501
- $mol_fail_log(error);
7502
- }
7503
- }
7504
- force_render(path) {
7505
- const kids = this.sub();
7506
- const index = kids.findIndex(item => {
7507
- if (item instanceof $mol_view) {
7508
- return path.has(item);
7509
- }
7510
- else {
7511
- return false;
7512
- }
7513
- });
7514
- if (index >= 0) {
7515
- kids[index].force_render(path);
7516
- }
7517
- }
7518
- ensure_visible(view, align = "start") {
7519
- const path = this.view_find(v => v === view).next().value;
7520
- this.force_render(new Set(path));
7521
- try {
7522
- this.dom_final();
7523
- }
7524
- catch (err) {
7525
- $mol_fail_log(err);
7526
- }
7527
- view.dom_node().scrollIntoView({ block: align });
7528
- }
7529
- bring() {
7530
- const win = this.$.$mol_dom_context;
7531
- if (win.parent !== win.self && !win.document.hasFocus())
7532
- return;
7533
- new this.$.$mol_after_timeout(0, () => {
7534
- this.focused(true);
7535
- });
7536
- }
7537
- destructor() {
7538
- const node = $mol_wire_probe(() => this.dom_node());
7539
- if (!node)
7540
- return;
7541
- const events = $mol_wire_probe(() => this.event_async());
7542
- if (!events)
7543
- return;
7544
- for (let event_name in events) {
7545
- node.removeEventListener(event_name, events[event_name]);
7546
- }
7547
- }
7548
- }
7549
- __decorate([
7550
- $mol_mem
7551
- ], $mol_view.prototype, "autorun", null);
7552
- __decorate([
7553
- $mol_mem
7554
- ], $mol_view.prototype, "title", null);
7555
- __decorate([
7556
- $mol_mem
7557
- ], $mol_view.prototype, "focused", null);
7558
- __decorate([
7559
- $mol_memo.method
7560
- ], $mol_view.prototype, "dom_name", null);
7561
- __decorate([
7562
- $mol_mem
7563
- ], $mol_view.prototype, "minimal_width", null);
7564
- __decorate([
7565
- $mol_mem
7566
- ], $mol_view.prototype, "minimal_height", null);
7567
- __decorate([
7568
- $mol_mem
7569
- ], $mol_view.prototype, "view_rect", null);
7570
- __decorate([
7571
- $mol_memo.method
7572
- ], $mol_view.prototype, "dom_id", null);
7573
- __decorate([
7574
- $mol_mem
7575
- ], $mol_view.prototype, "dom_node", null);
7576
- __decorate([
7577
- $mol_mem
7578
- ], $mol_view.prototype, "dom_final", null);
7579
- __decorate([
7580
- $mol_mem
7581
- ], $mol_view.prototype, "dom_tree", null);
7582
- __decorate([
7583
- $mol_mem
7584
- ], $mol_view.prototype, "dom_node_actual", null);
7585
- __decorate([
7586
- $mol_mem
7587
- ], $mol_view.prototype, "render", null);
7588
- __decorate([
7589
- $mol_memo.method
7590
- ], $mol_view.prototype, "view_names_owned", null);
7591
- __decorate([
7592
- $mol_memo.method
7593
- ], $mol_view.prototype, "view_names", null);
7594
- __decorate([
7595
- $mol_mem
7596
- ], $mol_view.prototype, "theme", null);
7597
- __decorate([
7598
- $mol_mem
7599
- ], $mol_view.prototype, "event_async", null);
7600
- __decorate([
7601
- $mol_mem_key
7602
- ], $mol_view, "Root", null);
7603
- __decorate([
7604
- $mol_mem
7605
- ], $mol_view, "autobind", null);
7606
- __decorate([
7607
- $mol_memo.method
7608
- ], $mol_view, "view_classes", null);
7609
- $.$mol_view = $mol_view;
7610
- })($ || ($ = {}));
7611
-
7612
- ;
7613
- "use strict";
7614
- var $;
7615
- (function ($) {
7616
- $mol_style_attach("mol/view/view/view.css", "[mol_view] {\n\ttransition-property: height, width, min-height, min-width, max-width, max-height, transform;\n\ttransition-duration: .2s;\n\ttransition-timing-function: ease-out;\n\t-webkit-appearance: none;\n\tbox-sizing: border-box;\n\tdisplay: flex;\n\tflex-shrink: 0;\n\tcontain: style;\n\tscrollbar-color: var(--mol_theme_line) transparent;\n\tscrollbar-width: thin;\n}\t\n\n[mol_view]::selection {\n\tbackground: var(--mol_theme_line);\n}\t\n\n[mol_view]::-webkit-scrollbar {\n\twidth: .25rem;\n\theight: .25rem;\n}\n\n[mol_view]::-webkit-scrollbar-corner {\n\tbackground-color: var(--mol_theme_line);\n}\n\n[mol_view]::-webkit-scrollbar-track {\n\tbackground-color: transparent;\n}\n\n[mol_view]::-webkit-scrollbar-thumb {\n\tbackground-color: var(--mol_theme_line);\n\tborder-radius: var(--mol_gap_round);\n}\n\n[mol_view] > * {\n\tword-break: inherit;\n}\n\n[mol_view_root] {\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 100%;\n\theight: 100%;\n\tbox-sizing: border-box;\n\tfont-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;\n\tfont-size: 1rem;\n\tline-height: 1.5rem;\n\tbackground: var(--mol_theme_back);\n\tcolor: var(--mol_theme_text);\n\tcontain: unset; /** Fixes bg ignoring when applied to body on Chrome */\n\ttab-size: 4;\n\toverscroll-behavior: contain; /** Disable navigation gestures **/\n}\n\n@media print {\n\t[mol_view_root] {\n\t\theight: auto;\n\t}\n}\n\n[mol_view][mol_view_error]:not([mol_view_error=\"Promise\"]) {\n\tbackground-image: repeating-linear-gradient(\n\t\t-45deg,\n\t\t#f92323,\n\t\t#f92323 .5rem,\n\t\t#ff3d3d .5rem,\n\t\t#ff3d3d 1.5rem\n\t);\n\tcolor: black;\n\talign-items: center;\n\tjustify-content: center;\n}\n\n@keyframes mol_view_wait {\n\tfrom {\n\t\topacity: .25;\n\t}\n\t20% {\n\t\topacity: .75;\n\t}\n\tto {\n\t\topacity: .25;\n\t}\n}\n\n:where([mol_view][mol_view_error=\"Promise\"]) {\n\tbackground: var(--mol_theme_hover);\n}\n\n[mol_view][mol_view_error=\"Promise\"] {\n\tanimation: mol_view_wait 1s steps(20,end) infinite;\n}\n");
7617
- })($ || ($ = {}));
7618
-
7619
- ;
7620
- "use strict";
7621
- var $;
7622
- (function ($_1) {
7623
- $mol_test({
7624
- 'id auto generation'($) {
7625
- class $mol_view_test_item extends $mol_view {
7626
- }
7627
- class $mol_view_test_block extends $mol_view {
7628
- static $ = $;
7629
- element(id) {
7630
- return new $mol_view_test_item();
7631
- }
7632
- }
7633
- __decorate([
7634
- $mol_mem_key
7635
- ], $mol_view_test_block.prototype, "element", null);
7636
- var x = $mol_view_test_block.Root(0);
7637
- $mol_assert_equal(x.dom_node().id, '$mol_view_test_block.Root(0)');
7638
- $mol_assert_equal(x.element(0).dom_node().id, '$mol_view_test_block.Root(0).element(0)');
7639
- },
7640
- 'caching ref to dom node'($) {
7641
- var x = new class extends $mol_view {
7642
- };
7643
- x.$ = $;
7644
- $mol_assert_equal(x.dom_node(), x.dom_node());
7645
- },
7646
- 'content render'($) {
7647
- class $mol_view_test extends $mol_view {
7648
- sub() {
7649
- return ['lol', 5];
7650
- }
7651
- }
7652
- var x = new $mol_view_test();
7653
- x.$ = $;
7654
- var node = x.dom_tree();
7655
- $mol_assert_equal(node.innerHTML, 'lol5');
7656
- },
7657
- 'bem attributes generation'($) {
7658
- class $mol_view_test_item extends $mol_view {
7659
- }
7660
- class $mol_view_test_block extends $mol_view {
7661
- Element(id) {
7662
- return new $mol_view_test_item();
7663
- }
7664
- }
7665
- __decorate([
7666
- $mol_mem_key
7667
- ], $mol_view_test_block.prototype, "Element", null);
7668
- var x = new $mol_view_test_block();
7669
- x.$ = $;
7670
- $mol_assert_equal(x.dom_node().getAttribute('mol_view_test_block'), '');
7671
- $mol_assert_equal(x.dom_node().getAttribute('mol_view'), '');
7672
- $mol_assert_equal(x.Element(0).dom_node().getAttribute('mol_view_test_block_element'), '');
7673
- $mol_assert_equal(x.Element(0).dom_node().getAttribute('mol_view_test_item'), '');
7674
- $mol_assert_equal(x.Element(0).dom_node().getAttribute('mol_view'), '');
7675
- },
7676
- 'render custom attributes'($) {
7677
- class $mol_view_test extends $mol_view {
7678
- attr() {
7679
- return {
7680
- 'href': '#haha',
7681
- 'required': true,
7682
- 'hidden': false,
7683
- };
7684
- }
7685
- }
7686
- var x = new $mol_view_test();
7687
- x.$ = $;
7688
- var node = x.dom_tree();
7689
- $mol_assert_equal(node.getAttribute('href'), '#haha');
7690
- $mol_assert_equal(node.getAttribute('required'), 'true');
7691
- $mol_assert_equal(node.getAttribute('hidden'), null);
7692
- },
7693
- 'render custom fields'($) {
7694
- class $mol_view_test extends $mol_view {
7695
- field() {
7696
- return {
7697
- 'hidden': true
7698
- };
7699
- }
7700
- }
7701
- var x = new $mol_view_test();
7702
- x.$ = $;
7703
- var node = x.dom_tree();
7704
- $mol_assert_equal(node.hidden, true);
7705
- },
7706
- 'attach event handlers'($) {
7707
- var clicked = false;
7708
- class $mol_view_test extends $mol_view {
7709
- event() {
7710
- return {
7711
- 'click': (next) => this.event_click(next)
7712
- };
7713
- }
7714
- event_click(next) {
7715
- clicked = true;
7716
- }
7717
- }
7718
- var x = new $mol_view_test();
7719
- x.$ = $;
7720
- var node = x.dom_node();
7721
- node.click();
7722
- $mol_assert_ok(clicked);
7723
- },
7724
- });
7725
- })($ || ($ = {}));
7726
-
7727
- ;
7728
- "use strict";
7729
- var $;
7730
- (function ($) {
7731
- class $mol_plugin extends $mol_view {
7732
- dom_node_external(next) {
7733
- return next ?? $mol_owning_get(this).host.dom_node();
7734
- }
7735
- render() {
7736
- this.dom_node_actual();
7737
- }
7738
- }
7739
- $.$mol_plugin = $mol_plugin;
7740
- })($ || ($ = {}));
7741
-
7742
- ;
7743
- ($.$mol_hotkey) = class $mol_hotkey extends ($.$mol_plugin) {
7744
- keydown(next){
7745
- if(next !== undefined) return next;
7746
- return null;
7747
- }
7748
- event(){
7749
- return {...(super.event()), "keydown": (next) => (this.keydown(next))};
7750
- }
7751
- key(){
7752
- return {};
7753
- }
7754
- mod_ctrl(){
7755
- return false;
7756
- }
7757
- mod_alt(){
7758
- return false;
7759
- }
7760
- mod_shift(){
7761
- return false;
7762
- }
7763
- };
7764
- ($mol_mem(($.$mol_hotkey.prototype), "keydown"));
7765
-
7766
-
7767
- ;
7768
- "use strict";
7769
- var $;
7770
- (function ($) {
7771
- let $mol_keyboard_code;
7772
- (function ($mol_keyboard_code) {
7773
- $mol_keyboard_code[$mol_keyboard_code["backspace"] = 8] = "backspace";
7774
- $mol_keyboard_code[$mol_keyboard_code["tab"] = 9] = "tab";
7775
- $mol_keyboard_code[$mol_keyboard_code["enter"] = 13] = "enter";
7776
- $mol_keyboard_code[$mol_keyboard_code["shift"] = 16] = "shift";
7777
- $mol_keyboard_code[$mol_keyboard_code["ctrl"] = 17] = "ctrl";
7778
- $mol_keyboard_code[$mol_keyboard_code["alt"] = 18] = "alt";
7779
- $mol_keyboard_code[$mol_keyboard_code["pause"] = 19] = "pause";
7780
- $mol_keyboard_code[$mol_keyboard_code["capsLock"] = 20] = "capsLock";
7781
- $mol_keyboard_code[$mol_keyboard_code["escape"] = 27] = "escape";
7782
- $mol_keyboard_code[$mol_keyboard_code["space"] = 32] = "space";
7783
- $mol_keyboard_code[$mol_keyboard_code["pageUp"] = 33] = "pageUp";
7784
- $mol_keyboard_code[$mol_keyboard_code["pageDown"] = 34] = "pageDown";
7785
- $mol_keyboard_code[$mol_keyboard_code["end"] = 35] = "end";
7786
- $mol_keyboard_code[$mol_keyboard_code["home"] = 36] = "home";
7787
- $mol_keyboard_code[$mol_keyboard_code["left"] = 37] = "left";
7788
- $mol_keyboard_code[$mol_keyboard_code["up"] = 38] = "up";
7789
- $mol_keyboard_code[$mol_keyboard_code["right"] = 39] = "right";
7790
- $mol_keyboard_code[$mol_keyboard_code["down"] = 40] = "down";
7791
- $mol_keyboard_code[$mol_keyboard_code["insert"] = 45] = "insert";
7792
- $mol_keyboard_code[$mol_keyboard_code["delete"] = 46] = "delete";
7793
- $mol_keyboard_code[$mol_keyboard_code["key0"] = 48] = "key0";
7794
- $mol_keyboard_code[$mol_keyboard_code["key1"] = 49] = "key1";
7795
- $mol_keyboard_code[$mol_keyboard_code["key2"] = 50] = "key2";
7796
- $mol_keyboard_code[$mol_keyboard_code["key3"] = 51] = "key3";
7797
- $mol_keyboard_code[$mol_keyboard_code["key4"] = 52] = "key4";
7798
- $mol_keyboard_code[$mol_keyboard_code["key5"] = 53] = "key5";
7799
- $mol_keyboard_code[$mol_keyboard_code["key6"] = 54] = "key6";
7800
- $mol_keyboard_code[$mol_keyboard_code["key7"] = 55] = "key7";
7801
- $mol_keyboard_code[$mol_keyboard_code["key8"] = 56] = "key8";
7802
- $mol_keyboard_code[$mol_keyboard_code["key9"] = 57] = "key9";
7803
- $mol_keyboard_code[$mol_keyboard_code["A"] = 65] = "A";
7804
- $mol_keyboard_code[$mol_keyboard_code["B"] = 66] = "B";
7805
- $mol_keyboard_code[$mol_keyboard_code["C"] = 67] = "C";
7806
- $mol_keyboard_code[$mol_keyboard_code["D"] = 68] = "D";
7807
- $mol_keyboard_code[$mol_keyboard_code["E"] = 69] = "E";
7808
- $mol_keyboard_code[$mol_keyboard_code["F"] = 70] = "F";
7809
- $mol_keyboard_code[$mol_keyboard_code["G"] = 71] = "G";
7810
- $mol_keyboard_code[$mol_keyboard_code["H"] = 72] = "H";
7811
- $mol_keyboard_code[$mol_keyboard_code["I"] = 73] = "I";
7812
- $mol_keyboard_code[$mol_keyboard_code["J"] = 74] = "J";
7813
- $mol_keyboard_code[$mol_keyboard_code["K"] = 75] = "K";
7814
- $mol_keyboard_code[$mol_keyboard_code["L"] = 76] = "L";
7815
- $mol_keyboard_code[$mol_keyboard_code["M"] = 77] = "M";
7816
- $mol_keyboard_code[$mol_keyboard_code["N"] = 78] = "N";
7817
- $mol_keyboard_code[$mol_keyboard_code["O"] = 79] = "O";
7818
- $mol_keyboard_code[$mol_keyboard_code["P"] = 80] = "P";
7819
- $mol_keyboard_code[$mol_keyboard_code["Q"] = 81] = "Q";
7820
- $mol_keyboard_code[$mol_keyboard_code["R"] = 82] = "R";
7821
- $mol_keyboard_code[$mol_keyboard_code["S"] = 83] = "S";
7822
- $mol_keyboard_code[$mol_keyboard_code["T"] = 84] = "T";
7823
- $mol_keyboard_code[$mol_keyboard_code["U"] = 85] = "U";
7824
- $mol_keyboard_code[$mol_keyboard_code["V"] = 86] = "V";
7825
- $mol_keyboard_code[$mol_keyboard_code["W"] = 87] = "W";
7826
- $mol_keyboard_code[$mol_keyboard_code["X"] = 88] = "X";
7827
- $mol_keyboard_code[$mol_keyboard_code["Y"] = 89] = "Y";
7828
- $mol_keyboard_code[$mol_keyboard_code["Z"] = 90] = "Z";
7829
- $mol_keyboard_code[$mol_keyboard_code["metaLeft"] = 91] = "metaLeft";
7830
- $mol_keyboard_code[$mol_keyboard_code["metaRight"] = 92] = "metaRight";
7831
- $mol_keyboard_code[$mol_keyboard_code["select"] = 93] = "select";
7832
- $mol_keyboard_code[$mol_keyboard_code["numpad0"] = 96] = "numpad0";
7833
- $mol_keyboard_code[$mol_keyboard_code["numpad1"] = 97] = "numpad1";
7834
- $mol_keyboard_code[$mol_keyboard_code["numpad2"] = 98] = "numpad2";
7835
- $mol_keyboard_code[$mol_keyboard_code["numpad3"] = 99] = "numpad3";
7836
- $mol_keyboard_code[$mol_keyboard_code["numpad4"] = 100] = "numpad4";
7837
- $mol_keyboard_code[$mol_keyboard_code["numpad5"] = 101] = "numpad5";
7838
- $mol_keyboard_code[$mol_keyboard_code["numpad6"] = 102] = "numpad6";
7839
- $mol_keyboard_code[$mol_keyboard_code["numpad7"] = 103] = "numpad7";
7840
- $mol_keyboard_code[$mol_keyboard_code["numpad8"] = 104] = "numpad8";
7841
- $mol_keyboard_code[$mol_keyboard_code["numpad9"] = 105] = "numpad9";
7842
- $mol_keyboard_code[$mol_keyboard_code["multiply"] = 106] = "multiply";
7843
- $mol_keyboard_code[$mol_keyboard_code["add"] = 107] = "add";
7844
- $mol_keyboard_code[$mol_keyboard_code["subtract"] = 109] = "subtract";
7845
- $mol_keyboard_code[$mol_keyboard_code["decimal"] = 110] = "decimal";
7846
- $mol_keyboard_code[$mol_keyboard_code["divide"] = 111] = "divide";
7847
- $mol_keyboard_code[$mol_keyboard_code["F1"] = 112] = "F1";
7848
- $mol_keyboard_code[$mol_keyboard_code["F2"] = 113] = "F2";
7849
- $mol_keyboard_code[$mol_keyboard_code["F3"] = 114] = "F3";
7850
- $mol_keyboard_code[$mol_keyboard_code["F4"] = 115] = "F4";
7851
- $mol_keyboard_code[$mol_keyboard_code["F5"] = 116] = "F5";
7852
- $mol_keyboard_code[$mol_keyboard_code["F6"] = 117] = "F6";
7853
- $mol_keyboard_code[$mol_keyboard_code["F7"] = 118] = "F7";
7854
- $mol_keyboard_code[$mol_keyboard_code["F8"] = 119] = "F8";
7855
- $mol_keyboard_code[$mol_keyboard_code["F9"] = 120] = "F9";
7856
- $mol_keyboard_code[$mol_keyboard_code["F10"] = 121] = "F10";
7857
- $mol_keyboard_code[$mol_keyboard_code["F11"] = 122] = "F11";
7858
- $mol_keyboard_code[$mol_keyboard_code["F12"] = 123] = "F12";
7859
- $mol_keyboard_code[$mol_keyboard_code["numLock"] = 144] = "numLock";
7860
- $mol_keyboard_code[$mol_keyboard_code["scrollLock"] = 145] = "scrollLock";
7861
- $mol_keyboard_code[$mol_keyboard_code["semicolon"] = 186] = "semicolon";
7862
- $mol_keyboard_code[$mol_keyboard_code["equals"] = 187] = "equals";
7863
- $mol_keyboard_code[$mol_keyboard_code["comma"] = 188] = "comma";
7864
- $mol_keyboard_code[$mol_keyboard_code["dash"] = 189] = "dash";
7865
- $mol_keyboard_code[$mol_keyboard_code["period"] = 190] = "period";
7866
- $mol_keyboard_code[$mol_keyboard_code["forwardSlash"] = 191] = "forwardSlash";
7867
- $mol_keyboard_code[$mol_keyboard_code["graveAccent"] = 192] = "graveAccent";
7868
- $mol_keyboard_code[$mol_keyboard_code["bracketOpen"] = 219] = "bracketOpen";
7869
- $mol_keyboard_code[$mol_keyboard_code["slashBack"] = 220] = "slashBack";
7870
- $mol_keyboard_code[$mol_keyboard_code["slashBackLeft"] = 226] = "slashBackLeft";
7871
- $mol_keyboard_code[$mol_keyboard_code["bracketClose"] = 221] = "bracketClose";
7872
- $mol_keyboard_code[$mol_keyboard_code["quoteSingle"] = 222] = "quoteSingle";
7873
- })($mol_keyboard_code = $.$mol_keyboard_code || ($.$mol_keyboard_code = {}));
7874
- })($ || ($ = {}));
7875
-
7876
- ;
7877
- "use strict";
7878
-
7879
- ;
7880
- "use strict";
7881
- var $;
7882
- (function ($) {
7883
- var $$;
7884
- (function ($$) {
7885
- class $mol_hotkey extends $.$mol_hotkey {
7886
- key() {
7887
- return super.key();
7888
- }
7889
- keydown(event) {
7890
- if (!event)
7891
- return;
7892
- if (event.defaultPrevented)
7893
- return;
7894
- let name = $mol_keyboard_code[event.keyCode];
7895
- if (this.mod_ctrl() !== (event.ctrlKey || event.metaKey))
7896
- return;
7897
- if (this.mod_alt() !== event.altKey)
7898
- return;
7899
- if (this.mod_shift() !== event.shiftKey)
7900
- return;
7901
- const handle = this.key()[name];
7902
- if (handle)
7903
- handle(event);
7904
- }
7905
- }
7906
- $$.$mol_hotkey = $mol_hotkey;
7907
- })($$ = $.$$ || ($.$$ = {}));
7908
- })($ || ($ = {}));
7909
-
7910
- ;
7911
- ($.$mol_string) = class $mol_string extends ($.$mol_view) {
7912
- selection_watcher(){
7913
- return null;
7914
- }
7915
- error_report(){
7916
- return null;
7917
- }
7918
- disabled(){
7919
- return false;
7920
- }
7921
- value(next){
7922
- if(next !== undefined) return next;
7923
- return "";
7924
- }
7925
- value_changed(next){
7926
- return (this.value(next));
7927
- }
7928
- hint(){
7929
- return "";
7930
- }
7931
- hint_visible(){
7932
- return (this.hint());
7933
- }
7934
- spellcheck(){
7935
- return true;
7936
- }
7937
- autocomplete_native(){
7938
- return "";
7939
- }
7940
- selection_end(){
7941
- return 0;
7942
- }
7943
- selection_start(){
7944
- return 0;
7945
- }
7946
- keyboard(){
7947
- return "text";
7948
- }
7949
- enter(){
7950
- return "go";
7951
- }
7952
- length_max(){
7953
- return +Infinity;
7954
- }
7955
- type(next){
7956
- if(next !== undefined) return next;
7957
- return "text";
7958
- }
7959
- event_change(next){
7960
- if(next !== undefined) return next;
7961
- return null;
7962
- }
7963
- submit_with_ctrl(){
7964
- return false;
7965
- }
7966
- submit(next){
7967
- if(next !== undefined) return next;
7968
- return null;
7969
- }
7970
- Submit(){
7971
- const obj = new this.$.$mol_hotkey();
7972
- (obj.mod_ctrl) = () => ((this.submit_with_ctrl()));
7973
- (obj.key) = () => ({"enter": (next) => (this.submit(next))});
7974
- return obj;
7975
- }
7976
- dom_name(){
7977
- return "input";
7978
- }
7979
- enabled(){
7980
- return true;
7981
- }
7982
- minimal_height(){
7983
- return 40;
7984
- }
7985
- autocomplete(){
7986
- return false;
7987
- }
7988
- selection(next){
7989
- if(next !== undefined) return next;
7990
- return [0, 0];
7991
- }
7992
- auto(){
7993
- return [(this.selection_watcher()), (this.error_report())];
7994
- }
7995
- field(){
7996
- return {
7997
- ...(super.field()),
7998
- "disabled": (this.disabled()),
7999
- "value": (this.value_changed()),
8000
- "placeholder": (this.hint_visible()),
8001
- "spellcheck": (this.spellcheck()),
8002
- "autocomplete": (this.autocomplete_native()),
8003
- "selectionEnd": (this.selection_end()),
8004
- "selectionStart": (this.selection_start()),
8005
- "inputMode": (this.keyboard()),
8006
- "enterkeyhint": (this.enter())
8007
- };
8008
- }
8009
- attr(){
8010
- return {
8011
- ...(super.attr()),
8012
- "maxlength": (this.length_max()),
8013
- "type": (this.type())
8014
- };
8015
- }
8016
- event(){
8017
- return {...(super.event()), "input": (next) => (this.event_change(next))};
8018
- }
8019
- plugins(){
8020
- return [(this.Submit())];
8021
- }
8022
- };
8023
- ($mol_mem(($.$mol_string.prototype), "value"));
8024
- ($mol_mem(($.$mol_string.prototype), "type"));
8025
- ($mol_mem(($.$mol_string.prototype), "event_change"));
8026
- ($mol_mem(($.$mol_string.prototype), "submit"));
8027
- ($mol_mem(($.$mol_string.prototype), "Submit"));
8028
- ($mol_mem(($.$mol_string.prototype), "selection"));
8029
-
8030
-
8031
- ;
8032
- "use strict";
8033
- var $;
8034
- (function ($) {
8035
- $.$mol_action = $mol_wire_method;
8036
- })($ || ($ = {}));
8037
-
8038
- ;
8039
- "use strict";
8040
- var $;
8041
- (function ($) {
8042
- class $mol_dom_listener extends $mol_object {
8043
- _node;
8044
- _event;
8045
- _handler;
8046
- _config;
8047
- constructor(_node, _event, _handler, _config = { passive: true }) {
8048
- super();
8049
- this._node = _node;
8050
- this._event = _event;
8051
- this._handler = _handler;
8052
- this._config = _config;
8053
- this._node.addEventListener(this._event, this._handler, this._config);
8054
- }
8055
- destructor() {
8056
- this._node.removeEventListener(this._event, this._handler, this._config);
8057
- super.destructor();
8058
- }
8059
- }
8060
- $.$mol_dom_listener = $mol_dom_listener;
8061
- })($ || ($ = {}));
8062
-
8063
- ;
8064
- "use strict";
8065
- var $;
8066
- (function ($) {
8067
- $.$mol_layer = $mol_style_prop('mol_layer', [
8068
- 'hover',
8069
- 'focus',
8070
- 'speck',
8071
- 'float',
8072
- 'popup',
8073
- ]);
8074
- })($ || ($ = {}));
8075
-
8076
- ;
8077
- "use strict";
8078
- var $;
8079
- (function ($) {
8080
- $mol_style_attach("mol/layer/layer.css", ":root {\n\t--mol_layer_hover: 1;\n\t--mol_layer_focus: 2;\n\t--mol_layer_speck: 3;\n\t--mol_layer_float: 4;\n\t--mol_layer_popup: 5;\n}\n");
8081
- })($ || ($ = {}));
8082
-
8083
- ;
8084
- "use strict";
8085
-
8086
- ;
8087
- "use strict";
8088
-
8089
- ;
8090
- "use strict";
8091
-
8092
- ;
8093
- "use strict";
8094
- var $;
8095
- (function ($) {
8096
- var $$;
8097
- (function ($$) {
8098
- class $mol_string extends $.$mol_string {
8099
- event_change(next) {
8100
- if (!next)
8101
- return;
8102
- const el = next.target;
8103
- const from = el.selectionStart;
8104
- const to = el.selectionEnd;
8105
- try {
8106
- el.value = this.value_changed(el.value);
8107
- }
8108
- catch (error) {
8109
- const el = this.dom_node();
8110
- if (error instanceof Error) {
8111
- el.setCustomValidity(error.message);
8112
- el.reportValidity();
8113
- }
8114
- $mol_fail_hidden(error);
8115
- }
8116
- if (to === null)
8117
- return;
8118
- el.selectionEnd = to;
8119
- el.selectionStart = from;
8120
- this.selection_change(next);
8121
- }
8122
- error_report() {
8123
- try {
8124
- if (this.focused())
8125
- this.value();
8126
- }
8127
- catch (error) {
8128
- const el = this.dom_node();
8129
- if (error instanceof Error) {
8130
- el.setCustomValidity(error.message);
8131
- el.reportValidity();
8132
- }
8133
- }
8134
- }
8135
- hint_visible() {
8136
- return (this.enabled() ? this.hint() : '') || ' ';
8137
- }
8138
- disabled() {
8139
- return !this.enabled();
8140
- }
8141
- autocomplete_native() {
8142
- return this.autocomplete() ? 'on' : 'off';
8143
- }
8144
- selection_watcher() {
8145
- return new $mol_dom_listener(this.$.$mol_dom_context.document, 'selectionchange', $mol_wire_async(event => this.selection_change(event)));
8146
- }
8147
- selection_change(event) {
8148
- const el = this.dom_node();
8149
- if (el !== this.$.$mol_dom_context.document.activeElement)
8150
- return;
8151
- const [from, to] = this.selection([
8152
- el.selectionStart,
8153
- el.selectionEnd,
8154
- ]);
8155
- el.selectionEnd = to;
8156
- el.selectionStart = from;
8157
- if (to !== from && el.selectionEnd === el.selectionStart) {
8158
- el.selectionEnd = to;
8159
- }
8160
- }
8161
- selection_start() {
8162
- const el = this.dom_node();
8163
- if (el.selectionStart === null)
8164
- return undefined;
8165
- return this.selection()[0];
8166
- }
8167
- selection_end() {
8168
- const el = this.dom_node();
8169
- if (el.selectionEnd === null)
8170
- return undefined;
8171
- return this.selection()[1];
8172
- }
8173
- }
8174
- __decorate([
8175
- $mol_action
8176
- ], $mol_string.prototype, "event_change", null);
8177
- __decorate([
8178
- $mol_mem
8179
- ], $mol_string.prototype, "error_report", null);
8180
- __decorate([
8181
- $mol_mem
8182
- ], $mol_string.prototype, "selection_watcher", null);
8183
- $$.$mol_string = $mol_string;
8184
- })($$ = $.$$ || ($.$$ = {}));
8185
- })($ || ($ = {}));
8186
-
8187
- ;
8188
- "use strict";
8189
- var $;
8190
- (function ($) {
8191
- $mol_style_attach("mol/string/string.view.css", "[mol_string] {\n\tbox-sizing: border-box;\n\toutline-offset: 0;\n\tborder: none;\n\tborder-radius: var(--mol_gap_round);\n\twhite-space: pre-line;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\tpadding: var(--mol_gap_text);\n\ttext-align: left;\n\tposition: relative;\n\tfont: inherit;\n\tflex: 1 1 auto;\n\tbackground: transparent;\n\tmin-width: 0;\n\tcolor: inherit;\n\tbackground: var(--mol_theme_field);\n}\n\n[mol_string]:disabled:not(:placeholder-shown) {\n\tbackground-color: transparent;\n\tcolor: var(--mol_theme_text);\n}\n\n[mol_string]:where(:not(:disabled)) {\n\tbox-shadow: inset 0 0 0 1px var(--mol_theme_line);\n}\n\n[mol_string]:where(:not(:disabled)):hover {\n\tbox-shadow: inset 0 0 0 2px var(--mol_theme_line);\n\tz-index: var(--mol_layer_hover);\n}\n\n[mol_string]:focus {\n\toutline: none;\n\tz-index: var(--mol_layer_focus);\n\tcolor: var(--mol_theme_text);\n\tbox-shadow: inset 0 0 0 1px var(--mol_theme_focus);\n}\n\n[mol_string]::placeholder {\n\tcolor: var(--mol_theme_shade);\n}\n\n[mol_string]::-ms-clear {\n\tdisplay: none;\n}\n");
8192
- })($ || ($ = {}));
8193
-
8194
- ;
8195
- ($.$mol_paragraph) = class $mol_paragraph extends ($.$mol_view) {
8196
- line_height(){
8197
- return 24;
8198
- }
8199
- letter_width(){
8200
- return 7;
8201
- }
8202
- width_limit(){
8203
- return +Infinity;
8204
- }
8205
- row_width(){
8206
- return 0;
8207
- }
8208
- sub(){
8209
- return [(this.title())];
8210
- }
8211
- };
8212
-
8213
-
8214
- ;
8215
- "use strict";
8216
-
8217
- ;
8218
- "use strict";
8219
- var $;
8220
- (function ($) {
8221
- var $$;
8222
- (function ($$) {
8223
- class $mol_paragraph extends $.$mol_paragraph {
8224
- maximal_width() {
8225
- let width = 0;
8226
- const letter = this.letter_width();
8227
- for (const kid of this.sub()) {
8228
- if (!kid)
8229
- continue;
8230
- if (kid instanceof $mol_view) {
8231
- width += kid.maximal_width();
8232
- }
8233
- else if (typeof kid !== 'object') {
8234
- width += String(kid).length * letter;
8235
- }
8236
- }
8237
- return width;
8238
- }
8239
- width_limit() {
8240
- return this.$.$mol_window.size().width;
8241
- }
8242
- minimal_width() {
8243
- return this.letter_width();
8244
- }
8245
- row_width() {
8246
- return Math.max(Math.min(this.width_limit(), this.maximal_width()), this.letter_width());
8247
- }
8248
- minimal_height() {
8249
- return Math.max(1, Math.ceil(this.maximal_width() / this.row_width())) * this.line_height();
8250
- }
8251
- }
8252
- __decorate([
8253
- $mol_mem
8254
- ], $mol_paragraph.prototype, "maximal_width", null);
8255
- __decorate([
8256
- $mol_mem
8257
- ], $mol_paragraph.prototype, "row_width", null);
8258
- __decorate([
8259
- $mol_mem
8260
- ], $mol_paragraph.prototype, "minimal_height", null);
8261
- $$.$mol_paragraph = $mol_paragraph;
8262
- })($$ = $.$$ || ($.$$ = {}));
8263
- })($ || ($ = {}));
8264
-
8265
- ;
8266
- "use strict";
8267
- var $;
8268
- (function ($) {
8269
- $mol_style_attach("mol/paragraph/paragraph.view.css", ":where([mol_paragraph]) {\n\tmargin: 0;\n\tmax-width: 100%;\n}\n");
8270
- })($ || ($ = {}));
8271
-
8272
- ;
8273
- ($.$mol_dimmer) = class $mol_dimmer extends ($.$mol_paragraph) {
8274
- parts(){
8275
- return [];
8276
- }
8277
- string(id){
8278
- return "";
8279
- }
8280
- haystack(){
8281
- return "";
8282
- }
8283
- needle(){
8284
- return "";
8285
- }
8286
- sub(){
8287
- return (this.parts());
8288
- }
8289
- Low(id){
8290
- const obj = new this.$.$mol_paragraph();
8291
- (obj.sub) = () => ([(this.string(id))]);
8292
- return obj;
8293
- }
8294
- High(id){
8295
- const obj = new this.$.$mol_paragraph();
8296
- (obj.sub) = () => ([(this.string(id))]);
8297
- return obj;
8298
- }
8299
- };
8300
- ($mol_mem_key(($.$mol_dimmer.prototype), "Low"));
8301
- ($mol_mem_key(($.$mol_dimmer.prototype), "High"));
8302
-
8303
-
8304
- ;
8305
- "use strict";
8306
- var $;
8307
- (function ($) {
8308
- var $$;
8309
- (function ($$) {
8310
- $mol_test({
8311
- 'Empty needle'() {
8312
- const app = new $mol_dimmer;
8313
- app.needle = () => ' ';
8314
- app.haystack = () => 'foo bar';
8315
- $mol_assert_like(app.strings(), ['foo bar']);
8316
- },
8317
- 'Empty haystack'() {
8318
- const app = new $mol_dimmer;
8319
- app.needle = () => 'foo bar';
8320
- app.haystack = () => '';
8321
- $mol_assert_like(app.strings(), ['']);
8322
- },
8323
- 'Not found'() {
8324
- const app = new $mol_dimmer;
8325
- app.needle = () => 'foo';
8326
- app.haystack = () => ' bar ';
8327
- $mol_assert_like(app.strings(), [' bar ']);
8328
- },
8329
- 'One found'() {
8330
- const app = new $mol_dimmer;
8331
- app.needle = () => 'foo';
8332
- app.haystack = () => ' barfoo ';
8333
- $mol_assert_like(app.strings(), [' bar', 'foo', ' ']);
8334
- },
8335
- 'Multiple found'() {
8336
- const app = new $mol_dimmer;
8337
- app.needle = () => 'foo';
8338
- app.haystack = () => ' foobarfoo foo';
8339
- $mol_assert_like(app.strings(), [' ', 'foo', 'bar', 'foo', ' ', 'foo']);
8340
- },
8341
- 'Fuzzy search'() {
8342
- const app = new $mol_dimmer;
8343
- app.needle = () => 'foo bar';
8344
- app.haystack = () => ' barfoo ';
8345
- $mol_assert_like(app.strings(), [' ', 'bar', '', 'foo', ' ']);
8346
- },
8347
- });
8348
- })($$ = $.$$ || ($.$$ = {}));
8349
- })($ || ($ = {}));
8350
-
8351
- ;
8352
- "use strict";
8353
-
8354
- ;
8355
- "use strict";
8356
- var $;
8357
- (function ($) {
8358
- var $$;
8359
- (function ($$) {
8360
- class $mol_dimmer extends $.$mol_dimmer {
8361
- parts() {
8362
- const needle = this.needle();
8363
- if (needle.length < 2)
8364
- return [this.haystack()];
8365
- let chunks = [];
8366
- let strings = this.strings();
8367
- for (let index = 0; index < strings.length; index++) {
8368
- if (strings[index] === '')
8369
- continue;
8370
- chunks.push((index % 2) ? this.High(index) : this.Low(index));
8371
- }
8372
- return chunks;
8373
- }
8374
- strings() {
8375
- const options = this.needle().split(/\s+/g).filter(Boolean);
8376
- if (!options.length)
8377
- return [this.haystack()];
8378
- const variants = { ...options };
8379
- const regexp = $mol_regexp.from({ needle: variants }, { ignoreCase: true });
8380
- return this.haystack().split(regexp);
8381
- }
8382
- string(index) {
8383
- return this.strings()[index];
8384
- }
8385
- *view_find(check, path = []) {
8386
- if (check(this, this.haystack())) {
8387
- yield [...path, this];
8388
- }
8389
- }
8390
- }
8391
- __decorate([
8392
- $mol_mem
8393
- ], $mol_dimmer.prototype, "strings", null);
8394
- $$.$mol_dimmer = $mol_dimmer;
8395
- })($$ = $.$$ || ($.$$ = {}));
8396
- })($ || ($ = {}));
8397
-
8398
- ;
8399
- "use strict";
8400
- var $;
8401
- (function ($) {
8402
- $mol_style_attach("mol/dimmer/dimmer.view.css", "[mol_dimmer] {\n\tdisplay: block;\n\tmax-width: 100%;\n}\n\n[mol_dimmer_low] {\n\tdisplay: inline;\n\topacity: 0.8;\n}\n\n[mol_dimmer_high] {\n\tdisplay: inline;\n\tcolor: var(--mol_theme_focus);\n\ttext-shadow: 0 0;\n}\n");
8403
- })($ || ($ = {}));
8404
-
8405
- ;
8406
- ($.$mol_speck) = class $mol_speck extends ($.$mol_view) {
8407
- theme(){
8408
- return "$mol_theme_accent";
8409
- }
8410
- value(){
8411
- return null;
8412
- }
8413
- attr(){
8414
- return {...(super.attr()), "mol_theme": (this.theme())};
8415
- }
8416
- style(){
8417
- return {...(super.style()), "minHeight": "1em"};
8418
- }
8419
- sub(){
8420
- return [(this.value())];
8421
- }
8422
- };
8423
-
8424
-
8425
- ;
8426
- "use strict";
8427
- var $;
8428
- (function ($) {
8429
- $mol_style_attach("mol/speck/speck.view.css", "[mol_speck] {\n\tfont-size: .625rem;\n\tborder-radius: 1rem;\n\tmargin: -0.5rem -0.25rem;\n\talign-self: flex-start;\n\tmin-height: 1em;\n\tmin-width: .5em;\n\tvertical-align: sub;\n\tpadding: .25em .5em;\n\tposition: absolute;\n\tz-index: var(--mol_layer_speck);\n\ttext-align: center;\n\tline-height: 1;\n\tdisplay: inline-block;\n\twhite-space: nowrap;\n\ttext-overflow: ellipsis;\n\tuser-select: none;\n}\n");
8430
- })($ || ($ = {}));
8431
-
8432
- ;
8433
- "use strict";
8434
-
8435
- ;
8436
- ($.$mol_button) = class $mol_button extends ($.$mol_view) {
8437
- event_activate(next){
8438
- if(next !== undefined) return next;
8439
- return null;
8440
- }
8441
- clicks(next){
8442
- if(next !== undefined) return next;
8443
- return null;
8444
- }
8445
- event_key_press(next){
8446
- if(next !== undefined) return next;
8447
- return null;
8448
- }
8449
- disabled(){
8450
- return false;
8451
- }
8452
- tab_index(){
8453
- return 0;
8454
- }
8455
- hint(){
8456
- return "";
8457
- }
8458
- hint_safe(){
8459
- return (this.hint());
8460
- }
8461
- error(){
8462
- return "";
8463
- }
8464
- enabled(){
8465
- return true;
8466
- }
8467
- click(next){
8468
- if(next !== undefined) return next;
8469
- return null;
8470
- }
8471
- event_click(next){
8472
- if(next !== undefined) return next;
8473
- return null;
8474
- }
8475
- event(){
8476
- return {
8477
- ...(super.event()),
8478
- "click": (next) => (this.event_activate(next)),
8479
- "dblclick": (next) => (this.clicks(next)),
8480
- "keydown": (next) => (this.event_key_press(next))
8481
- };
8482
- }
8483
- attr(){
8484
- return {
8485
- ...(super.attr()),
8486
- "disabled": (this.disabled()),
8487
- "role": "button",
8488
- "tabindex": (this.tab_index()),
8489
- "title": (this.hint_safe())
8490
- };
8491
- }
8492
- sub(){
8493
- return [(this.title())];
8494
- }
8495
- Speck(){
8496
- const obj = new this.$.$mol_speck();
8497
- (obj.value) = () => ((this.error()));
8498
- return obj;
8499
- }
8500
- };
8501
- ($mol_mem(($.$mol_button.prototype), "event_activate"));
8502
- ($mol_mem(($.$mol_button.prototype), "clicks"));
8503
- ($mol_mem(($.$mol_button.prototype), "event_key_press"));
8504
- ($mol_mem(($.$mol_button.prototype), "click"));
8505
- ($mol_mem(($.$mol_button.prototype), "event_click"));
8506
- ($mol_mem(($.$mol_button.prototype), "Speck"));
8507
-
8508
-
8509
- ;
8510
- "use strict";
8511
- var $;
8512
- (function ($_1) {
8513
- var $$;
8514
- (function ($$) {
8515
- $mol_test({
8516
- 'handle clicks by default'($) {
8517
- let clicked = false;
8518
- const clicker = $mol_button.make({
8519
- $,
8520
- click: (event) => { clicked = true; },
8521
- });
8522
- const element = clicker.dom_tree();
8523
- const event = $mol_dom_context.document.createEvent('mouseevent');
8524
- event.initEvent('click', true, true);
8525
- element.dispatchEvent(event);
8526
- $mol_assert_ok(clicked);
8527
- },
8528
- 'no handle clicks if disabled'($) {
8529
- let clicked = false;
8530
- const clicker = $mol_button.make({
8531
- $,
8532
- click: (event) => { clicked = true; },
8533
- enabled: () => false,
8534
- });
8535
- const element = clicker.dom_tree();
8536
- const event = $mol_dom_context.document.createEvent('mouseevent');
8537
- event.initEvent('click', true, true);
8538
- element.dispatchEvent(event);
8539
- $mol_assert_not(clicked);
8540
- },
8541
- async 'Store error'($) {
8542
- const clicker = $mol_button.make({
8543
- $,
8544
- click: (event) => $.$mol_fail(new Error('Test error')),
8545
- });
8546
- const event = $mol_dom_context.document.createEvent('mouseevent');
8547
- $mol_assert_fail(() => clicker.event_activate(event), 'Test error');
8548
- await Promise.resolve();
8549
- $mol_assert_equal(clicker.status()[0].message, 'Test error');
8550
- },
8551
- });
8552
- })($$ = $_1.$$ || ($_1.$$ = {}));
8553
- })($ || ($ = {}));
8554
-
8555
- ;
8556
- "use strict";
8557
-
8558
- ;
8559
- "use strict";
8560
- var $;
8561
- (function ($) {
8562
- var $$;
8563
- (function ($$) {
8564
- class $mol_button extends $.$mol_button {
8565
- status(next = [null]) { return next; }
8566
- disabled() {
8567
- return !this.enabled();
8568
- }
8569
- event_activate(next) {
8570
- if (!next)
8571
- return;
8572
- if (!this.enabled())
8573
- return;
8574
- try {
8575
- this.event_click(next);
8576
- this.click(next);
8577
- this.status([null]);
8578
- }
8579
- catch (error) {
8580
- Promise.resolve().then(() => this.status([error]));
8581
- $mol_fail_hidden(error);
8582
- }
8583
- }
8584
- event_key_press(event) {
8585
- if (event.keyCode === $mol_keyboard_code.enter) {
8586
- return this.event_activate(event);
8587
- }
8588
- }
8589
- tab_index() {
8590
- return this.enabled() ? super.tab_index() : -1;
8591
- }
8592
- error() {
8593
- const [error] = this.status();
8594
- if (!error)
8595
- return '';
8596
- if (error instanceof Promise) {
8597
- return $mol_fail_hidden(error);
8598
- }
8599
- return String(error.message ?? error);
8600
- }
8601
- hint_safe() {
8602
- try {
8603
- return this.hint();
8604
- }
8605
- catch (error) {
8606
- $mol_fail_log(error);
8607
- return '';
8608
- }
8609
- }
8610
- sub_visible() {
8611
- return [
8612
- ...this.error() ? [this.Speck()] : [],
8613
- ...this.sub(),
8614
- ];
8615
- }
8616
- }
8617
- __decorate([
8618
- $mol_mem
8619
- ], $mol_button.prototype, "status", null);
8620
- $$.$mol_button = $mol_button;
8621
- })($$ = $.$$ || ($.$$ = {}));
8622
- })($ || ($ = {}));
8623
-
8624
- ;
8625
- "use strict";
8626
- var $;
8627
- (function ($) {
8628
- $mol_style_attach("mol/button/button.view.css", "[mol_button] {\n\tborder: none;\n\tfont: inherit;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\ttext-decoration: inherit;\n\tcursor: inherit;\n\tposition: relative;\n\tbox-sizing: border-box;\n\tword-break: normal;\n\tcursor: default;\n\tuser-select: none;\n\tborder-radius: var(--mol_gap_round);\n\tbackground: transparent;\n\tcolor: inherit;\n}\n\n[mol_button]:where(:not(:disabled)):hover {\n\tz-index: var(--mol_layer_hover);\n}\n\n[mol_button]:focus-visible {\n\toutline: none;\n\tz-index: var(--mol_layer_focus);\n}\n");
8629
- })($ || ($ = {}));
8630
-
8631
- ;
8632
- ($.$mol_button_typed) = class $mol_button_typed extends ($.$mol_button) {
8633
- minimal_height(){
8634
- return 40;
8635
- }
8636
- minimal_width(){
8637
- return 40;
8638
- }
8639
- };
8640
-
8641
-
8642
- ;
8643
- "use strict";
8644
- var $;
8645
- (function ($) {
8646
- $mol_style_attach("mol/button/typed/typed.view.css", "[mol_button_typed] {\n\talign-content: center;\n\talign-items: center;\n\tpadding: var(--mol_gap_text);\n\tborder-radius: var(--mol_gap_round);\n\tgap: var(--mol_gap_space);\n\tuser-select: none;\n\tcursor: pointer;\n}\n\n[mol_button_typed][disabled] {\n\tpointer-events: none;\n}\n\n[mol_button_typed]:hover ,\n[mol_button_typed]:focus-visible {\n\tbox-shadow: inset 0 0 0 10rem var(--mol_theme_hover);\n}\n\n[mol_button_typed]:active {\n\tcolor: var(--mol_theme_focus);\n}\n\n");
8647
- })($ || ($ = {}));
8648
-
8649
- ;
8650
- "use strict";
8651
-
8652
- ;
8653
- ($.$mol_button_minor) = class $mol_button_minor extends ($.$mol_button_typed) {};
8654
-
8655
-
8656
- ;
8657
- "use strict";
8658
- var $;
8659
- (function ($) {
8660
- $mol_style_attach("mol/button/minor/minor.view.css", "[mol_button_minor] {\n\tcolor: var(--mol_theme_control);\n}\n\n[mol_button_minor][disabled] {\n\tcolor: var(--mol_theme_shade);\n}\n");
8661
- })($ || ($ = {}));
8662
-
8663
- ;
8664
- "use strict";
8665
-
8666
- ;
8667
- "use strict";
8668
- var $;
8669
- (function ($_1) {
8670
- var $$;
8671
- (function ($$) {
8672
- const d = '$';
8673
- const file_name = '/mol/view/tree2/class/props.test.ts';
8674
- function normalize($, src, dest) {
8675
- const mod = $.$mol_tree2_from_string(src, file_name);
8676
- const input = $.$mol_view_tree2_class_props(mod.kids[0]).join('');
8677
- const output = dest ? $$.$mol_tree2_from_string(dest, 'reference').toString() : '';
8678
- return { input, output };
8679
- }
8680
- $mol_test({
8681
- 'dupes merge'($) {
8682
- const src = `
8683
- ${d}my_test ${d}my_super
8684
- query? \\
8685
- Query $mol_string
8686
- value? <=> query? \\
8687
- Suggest_label ${d}mol_dimmer
8688
- needle <= query? \\
8689
- key * escape? <=> clear? null
8690
- Clear ${d}mol_button_minor
8691
- click?event <=> clear?event null
8692
- `;
8693
- const dest = `
8694
- query? \\
8695
- clear?event null
8696
- Query $mol_string value? <=> query?
8697
- Suggest_label $mol_dimmer
8698
- needle <= query?
8699
- key * escape? <=> clear?
8700
- Clear $mol_button_minor click?event <=> clear?event
8701
- `;
8702
- const res = normalize($, src, dest);
8703
- $mol_assert_equal(res.input, res.output);
8704
- },
8705
- 'left and bidi common'($) {
8706
- const src = `
8707
- ${d}my_test ${d}my_super
8708
- title @ \\title
8709
- sub2 /
8710
- <= Close_icon ${d}mol_icon_cross
8711
- sub /
8712
- <= Title ${d}mol_view
8713
- sub /
8714
- <= title
8715
- <= Close ${d}mol_button
8716
- title \\close
8717
- click?event <=> close?event null
8718
- `;
8719
- const dest = `
8720
- Close_icon ${d}mol_icon_cross
8721
- Title ${d}mol_view sub / <= title
8722
- close?event null
8723
- Close ${d}mol_button
8724
- title \\close
8725
- click?event <=> close?event
8726
- title @ \\title
8727
- sub2 / <= Close_icon
8728
- sub /
8729
- <= Title
8730
- <= Close
8731
- `;
8732
- const res = normalize($, src, dest);
8733
- $mol_assert_equal(res.input, res.output);
8734
- },
8735
- 'right bind levels'($) {
8736
- const src = `
8737
- ${d}my_test ${d}my_super
8738
- Dog ${d}mol_view_tree2_class_test_dog
8739
- Mouth => Dog_mouth
8740
- animation => dog_animation
8741
- plugins /
8742
- <= Human* ${d}mol_view_tree2_class_test_human
8743
- Mouth => Human_mouth
8744
- animation => human_animation
8745
- text => human_text
8746
- `;
8747
- const dest = `
8748
- Dog_mouth = Dog Mouth
8749
- dog_animation = Dog_mouth animation
8750
- Human_mouth = Human* Mouth
8751
- human_animation = Human_mouth animation
8752
- human_text = human_animation text
8753
- Human* $mol_view_tree2_class_test_human Mouth => Human_mouth animation => human_animation text => human_text
8754
- Dog $mol_view_tree2_class_test_dog Mouth => Dog_mouth animation => dog_animation
8755
- plugins / <= Human*
8756
- `;
8757
- const res = normalize($, src, dest);
8758
- $mol_assert_equal(res.input, res.output);
8759
- },
8760
- 'good right bind dupes'($) {
8761
- const src = `
8762
- ${d}my_test ${d}my_super
8763
- Suggest_label ${d}mol_dimmer
8764
- clear? => clear?
8765
- Clear ${d}mol_button_minor
8766
- click?e <=> clear?e
8767
- `;
8768
- const dest = `
8769
- clear? = Suggest_label clear?
8770
- Suggest_label $mol_dimmer clear? => clear?
8771
- Clear $mol_button_minor click?e <=> clear?e
8772
- `;
8773
- const res = normalize($, src, dest);
8774
- $mol_assert_equal(res.input, res.output);
8775
- },
8776
- 'conflicting right bind dupes'($) {
8777
- const src = `
8778
- ${d}my_test ${d}my_super
8779
- Suggest_label ${d}mol_dimmer
8780
- clear => clear
8781
- Clear ${d}mol_button_minor
8782
- click?event <=> clear?event null
8783
- `;
8784
- $mol_assert_fail(() => normalize($, src).input, `Need an equal default values at \`/mol/view/tree2/class/props.test.ts#4:16/5\` vs \`/mol/view/tree2/class/props.test.ts#6:23/11\`
8785
- <=>
8786
- /mol/view/tree2/class/props.test.ts#6:19/3
8787
- click?event
8788
- /mol/view/tree2/class/props.test.ts#6:7/11
8789
- $mol_button_minor
8790
- /mol/view/tree2/class/props.test.ts#5:12/17
8791
- Clear
8792
- /mol/view/tree2/class/props.test.ts#5:6/5`);
8793
- },
8794
- });
8795
- })($$ = $_1.$$ || ($_1.$$ = {}));
8796
- })($ || ($ = {}));
8797
-
8798
- ;
8799
- "use strict";
8800
-
8801
- ;
8802
- "use strict";
8803
-
8804
- ;
8805
- "use strict";
8806
-
8807
- ;
8808
- "use strict";
8809
-
8810
- ;
8811
- "use strict";
8812
- var $;
8813
- (function ($) {
8814
- function $mol_data_setup(value, config) {
8815
- return Object.assign(value, {
8816
- config,
8817
- Value: null
8818
- });
8819
- }
8820
- $.$mol_data_setup = $mol_data_setup;
8821
- })($ || ($ = {}));
8822
-
8823
- ;
8824
- "use strict";
8825
- var $;
8826
- (function ($) {
8827
- $mol_test({
8828
- 'config by value'() {
8829
- const N = $mol_data_setup((a) => a, 5);
8830
- $mol_assert_equal(N.config, 5);
8831
- },
8832
- });
8833
- })($ || ($ = {}));
8834
-
8835
- ;
8836
- "use strict";
8837
- var $;
8838
- (function ($) {
8839
- function $mol_func_is_class(func) {
8840
- return Object.getOwnPropertyDescriptor(func, 'prototype')?.writable === false;
8841
- }
8842
- $.$mol_func_is_class = $mol_func_is_class;
4597
+ $.$mol_func_is_class = $mol_func_is_class;
8843
4598
  })($ || ($ = {}));
8844
4599
 
8845
4600
  ;
@@ -8876,6 +4631,12 @@ var $;
8876
4631
  ;
8877
4632
  "use strict";
8878
4633
 
4634
+ ;
4635
+ "use strict";
4636
+
4637
+ ;
4638
+ "use strict";
4639
+
8879
4640
  ;
8880
4641
  "use strict";
8881
4642
  var $;