mol_view_tree2_lib 1.0.213 → 1.0.215

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/web.js CHANGED
@@ -2020,7 +2020,7 @@ var $;
2020
2020
  "use strict";
2021
2021
  var $;
2022
2022
  (function ($) {
2023
- const class_regex = /^[$A-Z][$\w<>\[\]()"'?|]+$/;
2023
+ const class_regex = /^[$A-Z][$\w<>\[\]()"'?|,]+$/;
2024
2024
  function $mol_view_tree2_class_match(klass) {
2025
2025
  if (!klass?.type)
2026
2026
  return false;
@@ -2732,7 +2732,7 @@ var $;
2732
2732
  'color': 'gray',
2733
2733
  });
2734
2734
  $.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
2735
- 'margin-left': '13px'
2735
+ 'margin-inline-start': '13px'
2736
2736
  });
2737
2737
  class Stack extends Array {
2738
2738
  // [ Symbol.toPrimitive ]() {
@@ -3592,14 +3592,14 @@ var $;
3592
3592
  reuse: if (existen) {
3593
3593
  if (!existen.temp)
3594
3594
  break reuse;
3595
- if (existen.task !== task) {
3596
- cause = 'task';
3597
- break reuse;
3598
- }
3599
3595
  if (existen.host !== host) {
3600
3596
  cause = 'host';
3601
3597
  break reuse;
3602
3598
  }
3599
+ if (existen.task !== task) {
3600
+ cause = 'task';
3601
+ break reuse;
3602
+ }
3603
3603
  if (!$mol_compare_deep(existen.args, args)) {
3604
3604
  cause = 'args';
3605
3605
  break reuse;
@@ -4036,6 +4036,48 @@ var $;
4036
4036
  $.$mol_dom_context = self;
4037
4037
  })($ || ($ = {}));
4038
4038
 
4039
+ ;
4040
+ "use strict";
4041
+ var $;
4042
+ (function ($) {
4043
+ class $mol_storage extends $mol_object2 {
4044
+ /** Is storage a long term. */
4045
+ static persisted(next) {
4046
+ return false;
4047
+ }
4048
+ /** Total storage quota in bytes. */
4049
+ static total() {
4050
+ return 0;
4051
+ }
4052
+ /** Total storage usage in bytes. */
4053
+ static used() {
4054
+ return 0;
4055
+ }
4056
+ /** Minimum available free space in bytes. */
4057
+ static free() {
4058
+ return this.total() - this.used();
4059
+ }
4060
+ /** Fulfillness of storage. */
4061
+ static portion() {
4062
+ const total = this.total();
4063
+ if (!total)
4064
+ return 1;
4065
+ return this.used() / total;
4066
+ }
4067
+ /**
4068
+ * Fulfillness logarithmic level.
4069
+ * `0` - empty
4070
+ * `1` - half free
4071
+ * `2` - quart free
4072
+ * `Infinity` - fulfilled
4073
+ */
4074
+ static level() {
4075
+ return Math.floor(-Math.log2(1 - this.portion()));
4076
+ }
4077
+ }
4078
+ $.$mol_storage = $mol_storage;
4079
+ })($ || ($ = {}));
4080
+
4039
4081
  ;
4040
4082
  "use strict";
4041
4083
  var $;
@@ -4186,7 +4228,56 @@ var $;
4186
4228
  "use strict";
4187
4229
  var $;
4188
4230
  (function ($) {
4189
- class $mol_storage extends $mol_object2 {
4231
+ class $mol_after_timeout extends $mol_object2 {
4232
+ delay;
4233
+ task;
4234
+ id;
4235
+ constructor(delay, task) {
4236
+ super();
4237
+ this.delay = delay;
4238
+ this.task = task;
4239
+ this.id = setTimeout(task, delay);
4240
+ }
4241
+ destructor() {
4242
+ clearTimeout(this.id);
4243
+ }
4244
+ }
4245
+ $.$mol_after_timeout = $mol_after_timeout;
4246
+ })($ || ($ = {}));
4247
+
4248
+ ;
4249
+ "use strict";
4250
+ var $;
4251
+ (function ($) {
4252
+ /** State of time moment */
4253
+ class $mol_state_time extends $mol_object {
4254
+ static task(precision, reset) {
4255
+ if (precision) {
4256
+ return new $mol_after_timeout(precision, () => this.task(precision, null));
4257
+ }
4258
+ else {
4259
+ return new $mol_after_frame(() => this.task(precision, null));
4260
+ }
4261
+ }
4262
+ static now(precision) {
4263
+ this.task(precision);
4264
+ return Date.now();
4265
+ }
4266
+ }
4267
+ __decorate([
4268
+ $mol_mem_key
4269
+ ], $mol_state_time, "task", null);
4270
+ __decorate([
4271
+ $mol_mem_key
4272
+ ], $mol_state_time, "now", null);
4273
+ $.$mol_state_time = $mol_state_time;
4274
+ })($ || ($ = {}));
4275
+
4276
+ ;
4277
+ "use strict";
4278
+ var $;
4279
+ (function ($) {
4280
+ class $mol_storage_web extends $mol_storage {
4190
4281
  static native() {
4191
4282
  return this.$.$mol_dom_context.navigator.storage ?? {
4192
4283
  persisted: async () => false,
@@ -4214,19 +4305,40 @@ var $;
4214
4305
  return next ?? $mol_wire_sync(native).persisted();
4215
4306
  }
4216
4307
  static estimate() {
4308
+ $mol_state_time.now(1000);
4217
4309
  return $mol_wire_sync(this.native() ?? {}).estimate();
4218
4310
  }
4311
+ static total() {
4312
+ return this.estimate().quota ?? 0;
4313
+ }
4314
+ static used() {
4315
+ return this.estimate().usage ?? 0;
4316
+ }
4317
+ static free() {
4318
+ const { usage = 0, quota = 0 } = this.estimate();
4319
+ return quota - usage;
4320
+ }
4321
+ static portion() {
4322
+ const { usage = 0, quota = 0 } = this.estimate();
4323
+ if (!quota)
4324
+ return 1;
4325
+ return usage / quota;
4326
+ }
4219
4327
  static dir() {
4220
4328
  return $mol_wire_sync(this.native()).getDirectory();
4221
4329
  }
4222
4330
  }
4223
4331
  __decorate([
4224
4332
  $mol_mem
4225
- ], $mol_storage, "native", null);
4333
+ ], $mol_storage_web, "native", null);
4226
4334
  __decorate([
4227
4335
  $mol_mem
4228
- ], $mol_storage, "persisted", null);
4229
- $.$mol_storage = $mol_storage;
4336
+ ], $mol_storage_web, "persisted", null);
4337
+ __decorate([
4338
+ $mol_mem
4339
+ ], $mol_storage_web, "estimate", null);
4340
+ $.$mol_storage_web = $mol_storage_web;
4341
+ $.$mol_storage = $.$mol_storage_web;
4230
4342
  })($ || ($ = {}));
4231
4343
 
4232
4344
  ;
@@ -4326,27 +4438,6 @@ var $;
4326
4438
  $.$mol_action = $mol_wire_method;
4327
4439
  })($ || ($ = {}));
4328
4440
 
4329
- ;
4330
- "use strict";
4331
- var $;
4332
- (function ($) {
4333
- class $mol_after_timeout extends $mol_object2 {
4334
- delay;
4335
- task;
4336
- id;
4337
- constructor(delay, task) {
4338
- super();
4339
- this.delay = delay;
4340
- this.task = task;
4341
- this.id = setTimeout(task, delay);
4342
- }
4343
- destructor() {
4344
- clearTimeout(this.id);
4345
- }
4346
- }
4347
- $.$mol_after_timeout = $mol_after_timeout;
4348
- })($ || ($ = {}));
4349
-
4350
4441
  ;
4351
4442
  "use strict";
4352
4443
  var $;
@@ -5452,6 +5543,19 @@ var $;
5452
5543
  static lang(next) {
5453
5544
  return this.$.$mol_state_local.value('locale', next) || $mol_dom_context.navigator.language.replace(/-.*/, '') || this.lang_default();
5454
5545
  }
5546
+ static langs_rtl() {
5547
+ return ['ar', 'he', 'fa', 'ur', 'yi', 'ps', 'ug', 'sd'];
5548
+ }
5549
+ static direction() {
5550
+ const lang = this.lang();
5551
+ try {
5552
+ return new Intl.Locale(lang).getTextInfo().direction ?? 'ltr';
5553
+ }
5554
+ catch (e) {
5555
+ $mol_fail_log(e);
5556
+ return this.langs_rtl().includes(lang) ? 'rtl' : 'ltr';
5557
+ }
5558
+ }
5455
5559
  static source(lang) {
5456
5560
  return JSON.parse(this.$.$mol_file.relative(`web.locale=${lang}.json`).text().toString());
5457
5561
  }
@@ -5492,6 +5596,9 @@ var $;
5492
5596
  __decorate([
5493
5597
  $mol_mem
5494
5598
  ], $mol_locale, "lang", null);
5599
+ __decorate([
5600
+ $mol_mem
5601
+ ], $mol_locale, "direction", null);
5495
5602
  __decorate([
5496
5603
  $mol_mem_key
5497
5604
  ], $mol_locale, "source", null);