native-document 1.0.154 → 1.0.156

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.
@@ -34,7 +34,7 @@ var NativeComponents = (function (exports) {
34
34
  VALID_TYPES[COMMON_NODE_TYPES.DOCUMENT_FRAGMENT] = true;
35
35
  VALID_TYPES[COMMON_NODE_TYPES.COMMENT] = true;
36
36
 
37
- const Validator$1 = {
37
+ const Validator = {
38
38
  isObservable(value) {
39
39
  return value && (value.__$isObservable || value.__$Observable);
40
40
  },
@@ -51,7 +51,7 @@ var NativeComponents = (function (exports) {
51
51
  return value?.__isProxy__
52
52
  },
53
53
  isObservableOrProxy(value) {
54
- return Validator$1.isObservable(value) || Validator$1.isProxy(value);
54
+ return Validator.isObservable(value) || Validator.isProxy(value);
55
55
  },
56
56
  isAnchor(value) {
57
57
  return value?.__Anchor__
@@ -134,8 +134,8 @@ var NativeComponents = (function (exports) {
134
134
  if(!data) {
135
135
  return false;
136
136
  }
137
- return Validator$1.isObject(data)
138
- && Object.values(data).some(value => Validator$1.isObservable(value));
137
+ return Validator.isObject(data)
138
+ && Object.values(data).some(value => Validator.isObservable(value));
139
139
  },
140
140
  /**
141
141
  * Check if the data contains an observable reference.
@@ -158,7 +158,7 @@ var NativeComponents = (function (exports) {
158
158
  };
159
159
 
160
160
  const cssPropertyAccumulator = function(initialValue = {}) {
161
- let data = Validator$1.isString(initialValue) ? initialValue.split(';').filter(Boolean) : initialValue;
161
+ let data = Validator.isString(initialValue) ? initialValue.split(';').filter(Boolean) : initialValue;
162
162
 
163
163
  return {
164
164
  add(key, value) {
@@ -166,7 +166,7 @@ var NativeComponents = (function (exports) {
166
166
  data.push(key+': '+value);
167
167
  return;
168
168
  }
169
- if(Validator$1.isObject(key)) {
169
+ if(Validator.isObject(key)) {
170
170
  value = key;
171
171
  for(const property in value) {
172
172
  data[property] = value[property];
@@ -185,11 +185,11 @@ var NativeComponents = (function (exports) {
185
185
  };
186
186
 
187
187
  const classPropertyAccumulator = function(initialValue = []) {
188
- let data = Validator$1.isString(initialValue) ? initialValue.split(" ").filter(Boolean) : initialValue;
188
+ let data = Validator.isString(initialValue) ? initialValue.split(" ").filter(Boolean) : initialValue;
189
189
 
190
190
  return {
191
191
  add(key, value = true) {
192
- if(Validator$1.isJson(key)) {
192
+ if(Validator.isJson(key)) {
193
193
  for(const property in key) {
194
194
  if(key[property]) {
195
195
  data[property] = key[property];
@@ -347,7 +347,7 @@ var NativeComponents = (function (exports) {
347
347
  }
348
348
 
349
349
  // Observables - keep the référence
350
- if (Validator$1.isObservable(value)) {
350
+ if (Validator.isObservable(value)) {
351
351
  onObservableFound && onObservableFound(value);
352
352
  return value;
353
353
  }
@@ -425,7 +425,7 @@ var NativeComponents = (function (exports) {
425
425
  * @class ObservableItem
426
426
  */
427
427
  function ObservableItem(value, configs = null) {
428
- value = Validator$1.isObservable(value) ? value.val() : value;
428
+ value = Validator.isObservable(value) ? value.val() : value;
429
429
 
430
430
  this.$previousValue = null;
431
431
  this.$currentValue = value;
@@ -439,7 +439,7 @@ var NativeComponents = (function (exports) {
439
439
  if(configs) {
440
440
  this.configs = configs;
441
441
  if(configs.reset) {
442
- this.$initialValue = Validator$1.isObject(value) ? deepClone(value) : value;
442
+ this.$initialValue = Validator.isObject(value) ? deepClone(value) : value;
443
443
  }
444
444
  }
445
445
  }
@@ -657,7 +657,7 @@ var NativeComponents = (function (exports) {
657
657
  if(!watchValueList) {
658
658
  watchValueList = callback;
659
659
  this.$watchers.set(value, callback);
660
- } else if(!Validator$1.isArray(watchValueList.list)) {
660
+ } else if(!Validator.isArray(watchValueList.list)) {
661
661
  watchValueList = [watchValueList, callback];
662
662
  callback = (value) => {
663
663
  for(let i = 0, length = watchValueList.length; i < length; i++) {
@@ -758,7 +758,7 @@ var NativeComponents = (function (exports) {
758
758
  */
759
759
  ObservableItem.prototype.get = function(key) {
760
760
  const item = this.$currentValue[key];
761
- return Validator$1.isObservable(item) ? item.val() : item;
761
+ return Validator.isObservable(item) ? item.val() : item;
762
762
  };
763
763
 
764
764
 
@@ -775,7 +775,7 @@ var NativeComponents = (function (exports) {
775
775
  * a.equals(10); // false
776
776
  */
777
777
  ObservableItem.prototype.equals = function(other) {
778
- if(Validator$1.isObservable(other)) {
778
+ if(Validator.isObservable(other)) {
779
779
  return this.$currentValue === other.$currentValue;
780
780
  }
781
781
  return this.$currentValue === other;
@@ -820,7 +820,7 @@ var NativeComponents = (function (exports) {
820
820
  if(!this.configs?.reset) {
821
821
  return;
822
822
  }
823
- const resetValue = (Validator$1.isObject(this.$initialValue))
823
+ const resetValue = (Validator.isObject(this.$initialValue))
824
824
  ? deepClone(this.$initialValue, (observable) => {
825
825
  observable.reset();
826
826
  })
@@ -877,10 +877,10 @@ var NativeComponents = (function (exports) {
877
877
  };
878
878
 
879
879
  function createMultiSourceFilter(sources, callbackFn){
880
- const observables = sources.filter(Validator$1.isObservable);
880
+ const observables = sources.filter(Validator.isObservable);
881
881
 
882
882
  const getValues = () => sources.map(src =>
883
- Validator$1.isObservable(src) ? src.val() : src
883
+ Validator.isObservable(src) ? src.val() : src
884
884
  );
885
885
 
886
886
  return {
@@ -1168,7 +1168,7 @@ var NativeComponents = (function (exports) {
1168
1168
  const filterCallbacks = {};
1169
1169
 
1170
1170
  for (const [key, rawPredicate] of Object.entries(predicates)) {
1171
- const predicate = Validator$1.isObservable(rawPredicate) ? match(rawPredicate, false) : rawPredicate;
1171
+ const predicate = Validator.isObservable(rawPredicate) ? match(rawPredicate, false) : rawPredicate;
1172
1172
  if (predicate && typeof predicate === 'object' && 'callback' in predicate) {
1173
1173
  filterCallbacks[key] = predicate.callback;
1174
1174
 
@@ -1383,10 +1383,10 @@ var NativeComponents = (function (exports) {
1383
1383
  if(Array.isArray(itemValue)) {
1384
1384
  if(configs?.deep !== false) {
1385
1385
  const mappedItemValue = itemValue.map(item => {
1386
- if(Validator$1.isJson(item)) {
1386
+ if(Validator.isJson(item)) {
1387
1387
  return new ObservableObject(item, configs);
1388
1388
  }
1389
- if(Validator$1.isArray(item)) {
1389
+ if(Validator.isArray(item)) {
1390
1390
  return new ObservableArray(item, configs);
1391
1391
  }
1392
1392
  return new ObservableItem(item, configs);
@@ -1397,7 +1397,7 @@ var NativeComponents = (function (exports) {
1397
1397
  this.$observables[key] = new ObservableArray(itemValue, configs);
1398
1398
  continue;
1399
1399
  }
1400
- if(Validator$1.isObservable(itemValue) || Validator$1.isProxy(itemValue)) {
1400
+ if(Validator.isObservable(itemValue) || Validator.isProxy(itemValue)) {
1401
1401
  this.$observables[key] = itemValue;
1402
1402
  continue;
1403
1403
  }
@@ -1409,21 +1409,21 @@ var NativeComponents = (function (exports) {
1409
1409
  const result = {};
1410
1410
  for(const key in this.$observables) {
1411
1411
  const dataItem = this.$observables[key];
1412
- if(Validator$1.isObservable(dataItem)) {
1412
+ if(Validator.isObservable(dataItem)) {
1413
1413
  let value = dataItem.val();
1414
1414
  if(Array.isArray(value)) {
1415
1415
  value = value.map(item => {
1416
- if(Validator$1.isObservable(item)) {
1416
+ if(Validator.isObservable(item)) {
1417
1417
  return item.val();
1418
1418
  }
1419
- if(Validator$1.isProxy(item)) {
1419
+ if(Validator.isProxy(item)) {
1420
1420
  return item.$value;
1421
1421
  }
1422
1422
  return item;
1423
1423
  });
1424
1424
  }
1425
1425
  result[key] = value;
1426
- } else if(Validator$1.isProxy(dataItem)) {
1426
+ } else if(Validator.isProxy(dataItem)) {
1427
1427
  result[key] = dataItem.$value;
1428
1428
  } else {
1429
1429
  result[key] = dataItem;
@@ -1435,10 +1435,10 @@ var NativeComponents = (function (exports) {
1435
1435
 
1436
1436
  ObservableObject.prototype.get = function(property) {
1437
1437
  const item = this.$observables[property];
1438
- if(Validator$1.isObservable(item)) {
1438
+ if(Validator.isObservable(item)) {
1439
1439
  return item.val();
1440
1440
  }
1441
- if(Validator$1.isProxy(item)) {
1441
+ if(Validator.isProxy(item)) {
1442
1442
  return item.$value;
1443
1443
  }
1444
1444
  return item;
@@ -1446,7 +1446,7 @@ var NativeComponents = (function (exports) {
1446
1446
  ObservableObject.prototype.$get = ObservableObject.prototype.get;
1447
1447
 
1448
1448
  ObservableObject.prototype.set = function(newData) {
1449
- const data = Validator$1.isProxy(newData) ? newData.$value : newData;
1449
+ const data = Validator.isProxy(newData) ? newData.$value : newData;
1450
1450
  const configs = this.configs;
1451
1451
 
1452
1452
  for(const key in data) {
@@ -1454,15 +1454,15 @@ var NativeComponents = (function (exports) {
1454
1454
  const newValueOrigin = newData[key];
1455
1455
  const newValue = data[key];
1456
1456
 
1457
- if(Validator$1.isObservable(targetItem)) {
1458
- if(!Validator$1.isArray(newValue)) {
1457
+ if(Validator.isObservable(targetItem)) {
1458
+ if(!Validator.isArray(newValue)) {
1459
1459
  targetItem.set(newValue);
1460
1460
  continue;
1461
1461
  }
1462
1462
  const firstElementFromOriginalValue = newValueOrigin.at(0);
1463
- if(Validator$1.isObservable(firstElementFromOriginalValue) || Validator$1.isProxy(firstElementFromOriginalValue)) {
1463
+ if(Validator.isObservable(firstElementFromOriginalValue) || Validator.isProxy(firstElementFromOriginalValue)) {
1464
1464
  const newValues = newValue.map(item => {
1465
- if(Validator$1.isProxy(firstElementFromOriginalValue)) {
1465
+ if(Validator.isProxy(firstElementFromOriginalValue)) {
1466
1466
  return new ObservableObject(item, configs);
1467
1467
  }
1468
1468
  return ObservableItem(item, configs);
@@ -1473,7 +1473,7 @@ var NativeComponents = (function (exports) {
1473
1473
  targetItem.set([...newValue]);
1474
1474
  continue;
1475
1475
  }
1476
- if(Validator$1.isProxy(targetItem)) {
1476
+ if(Validator.isProxy(targetItem)) {
1477
1477
  targetItem.update(newValue);
1478
1478
  continue;
1479
1479
  }
@@ -2099,7 +2099,7 @@ var NativeComponents = (function (exports) {
2099
2099
  Observable.batch = function(callback) {
2100
2100
  const $observer = Observable(0);
2101
2101
  const batch = function() {
2102
- if(Validator$1.isAsyncFunction(callback)) {
2102
+ if(Validator.isAsyncFunction(callback)) {
2103
2103
  return (callback(...arguments)).then(() => {
2104
2104
  $observer.trigger();
2105
2105
  }).catch(error => { throw error; });
@@ -2137,8 +2137,8 @@ var NativeComponents = (function (exports) {
2137
2137
  const getValues = () => dependencies.map((item) => item.val());
2138
2138
  const updatedValue = nextTick(() => observable.set(callback(...getValues())));
2139
2139
 
2140
- if(Validator$1.isFunction(dependencies)) {
2141
- if(!Validator$1.isObservable(dependencies.$observer)) {
2140
+ if(Validator.isFunction(dependencies)) {
2141
+ if(!Validator.isObservable(dependencies.$observer)) {
2142
2142
  throw new NativeDocumentError('Observable.computed : dependencies must be valid batch function');
2143
2143
  }
2144
2144
  dependencies.$observer.subscribe(updatedValue);
@@ -2146,7 +2146,7 @@ var NativeComponents = (function (exports) {
2146
2146
  }
2147
2147
 
2148
2148
  dependencies.forEach(dependency => {
2149
- if(Validator$1.isProxy(dependency)) {
2149
+ if(Validator.isProxy(dependency)) {
2150
2150
  dependency.$observables.forEach((observable) => {
2151
2151
  observable.subscribe(updatedValue);
2152
2152
  });
@@ -2190,7 +2190,7 @@ var NativeComponents = (function (exports) {
2190
2190
  if(data?.__$Observable) {
2191
2191
  return data.val();
2192
2192
  }
2193
- if(Validator$1.isProxy(data)) {
2193
+ if(Validator.isProxy(data)) {
2194
2194
  return data.$value;
2195
2195
  }
2196
2196
  return data;
@@ -2320,7 +2320,7 @@ var NativeComponents = (function (exports) {
2320
2320
  const bindBooleanAttribute = (element, attributeName, value) => {
2321
2321
  const isObservable = value.__$isObservable;
2322
2322
  const defaultValue = isObservable? value.val() : value;
2323
- if(Validator$1.isBoolean(defaultValue)) {
2323
+ if(Validator.isBoolean(defaultValue)) {
2324
2324
  element[attributeName] = defaultValue;
2325
2325
  }
2326
2326
  else {
@@ -2484,7 +2484,7 @@ var NativeComponents = (function (exports) {
2484
2484
  if(child.toNdElement) {
2485
2485
  do {
2486
2486
  child = child.toNdElement();
2487
- if(Validator$1.isElement(child)) {
2487
+ if(Validator.isElement(child)) {
2488
2488
  return child;
2489
2489
  }
2490
2490
  } while (child.toNdElement);
@@ -2563,7 +2563,7 @@ var NativeComponents = (function (exports) {
2563
2563
  anchor.getParent = () => parent;
2564
2564
 
2565
2565
  anchor.appendChild = (child) => {
2566
- child = Validator$1.isElement(child) ? child : ElementCreator.getChild(child);
2566
+ child = Validator.isElement(child) ? child : ElementCreator.getChild(child);
2567
2567
  parent.appendChild(child);
2568
2568
  };
2569
2569
 
@@ -2572,7 +2572,7 @@ var NativeComponents = (function (exports) {
2572
2572
  anchor.appendRaw = anchor.appendChildRaw;
2573
2573
 
2574
2574
  anchor.insertAtStart = (child) => {
2575
- child = Validator$1.isElement(child) ? child : ElementCreator.getChild(child);
2575
+ child = Validator.isElement(child) ? child : ElementCreator.getChild(child);
2576
2576
  parent.firstChild ? parent.insertBefore(child, parent.firstChild) : parent.appendChild(child);
2577
2577
  };
2578
2578
  anchor.insertAtStartRaw = (child) => {
@@ -2586,7 +2586,7 @@ var NativeComponents = (function (exports) {
2586
2586
  };
2587
2587
 
2588
2588
  anchor.replaceContent = function(content) {
2589
- const child = Validator$1.isElement(content) ? content : ElementCreator.getChild(content);
2589
+ const child = Validator.isElement(content) ? content : ElementCreator.getChild(content);
2590
2590
  parent.replaceChildren(child);
2591
2591
  };
2592
2592
 
@@ -2596,7 +2596,7 @@ var NativeComponents = (function (exports) {
2596
2596
  anchor.setContent = anchor.replaceContent;
2597
2597
 
2598
2598
  anchor.insertBefore = (child, anchor) => {
2599
- child = Validator$1.isElement(child) ? child : ElementCreator.getChild(child);
2599
+ child = Validator.isElement(child) ? child : ElementCreator.getChild(child);
2600
2600
  parent.insertBefore(child, anchor);
2601
2601
  };
2602
2602
  anchor.insertBeforeRaw = (child, anchor) => {
@@ -2640,7 +2640,7 @@ var NativeComponents = (function (exports) {
2640
2640
  ? () => true: (parent) => (parent.firstChild === anchorStart && parent.lastChild === anchorEnd);
2641
2641
 
2642
2642
  const insertBefore = (parent, child, target) => {
2643
- const childElement = Validator$1.isElement(child) ? child : ElementCreator.getChild(child);
2643
+ const childElement = Validator.isElement(child) ? child : ElementCreator.getChild(child);
2644
2644
  insertBeforeRaw(parent, childElement, target);
2645
2645
  };
2646
2646
 
@@ -2690,7 +2690,7 @@ var NativeComponents = (function (exports) {
2690
2690
  anchorFragment.appendRaw = anchorFragment.appendChildRaw;
2691
2691
 
2692
2692
  anchorFragment.insertAtStart = function(child) {
2693
- child = Validator$1.isElement(child) ? child : ElementCreator.getChild(child);
2693
+ child = Validator.isElement(child) ? child : ElementCreator.getChild(child);
2694
2694
  anchorFragment.insertAtStartRaw(child);
2695
2695
  };
2696
2696
 
@@ -2747,7 +2747,7 @@ var NativeComponents = (function (exports) {
2747
2747
  anchorFragment.delete = anchorFragment.removeWithAnchors;
2748
2748
 
2749
2749
  anchorFragment.replaceContent = function(child) {
2750
- const childElement = Validator$1.isElement(child) ? child : ElementCreator.getChild(child);
2750
+ const childElement = Validator.isElement(child) ? child : ElementCreator.getChild(child);
2751
2751
  anchorFragment.replaceContentRaw(childElement);
2752
2752
  };
2753
2753
 
@@ -2815,7 +2815,7 @@ var NativeComponents = (function (exports) {
2815
2815
  * ShowIf(isVisible, Div({}, 'Hello World'));
2816
2816
  */
2817
2817
  const ShowIf = function(condition, child, { comment = null, shouldKeepInCache = true} = {}) {
2818
- if(!Validator$1.isObservable(condition)) {
2818
+ if(!Validator.isObservable(condition)) {
2819
2819
  if(typeof condition === "boolean") {
2820
2820
  return condition ? ElementCreator.getChild(child) : null;
2821
2821
  }
@@ -2830,7 +2830,7 @@ var NativeComponents = (function (exports) {
2830
2830
  return childElement;
2831
2831
  }
2832
2832
  childElement = ElementCreator.getChild(child);
2833
- if(Validator$1.isFragment(childElement)) {
2833
+ if(Validator.isFragment(childElement)) {
2834
2834
  childElement = Array.from(childElement.childNodes);
2835
2835
  }
2836
2836
  return childElement;
@@ -7085,7 +7085,7 @@ var NativeComponents = (function (exports) {
7085
7085
  }
7086
7086
  else if (typeof condition === 'function') {
7087
7087
  isRequired = condition(allValues);
7088
- } else if (Validator$1.isObservable(condition)) {
7088
+ } else if (Validator.isObservable(condition)) {
7089
7089
  isRequired = condition.val();
7090
7090
  } else {
7091
7091
  isRequired = !!condition;
@@ -7278,7 +7278,7 @@ var NativeComponents = (function (exports) {
7278
7278
 
7279
7279
  Field.prototype.model = function(observable) {
7280
7280
  this.$description.value = observable;
7281
- this.$description.initialValue = Validator$1.isObservable(observable)
7281
+ this.$description.initialValue = Validator.isObservable(observable)
7282
7282
  ? observable.val()
7283
7283
  : observable;
7284
7284
  return this;
@@ -7287,7 +7287,7 @@ var NativeComponents = (function (exports) {
7287
7287
  Field.prototype.bind = Field.prototype.model;
7288
7288
 
7289
7289
  Field.prototype.errors = function(errors) {
7290
- if(!Validator$1.isObservable(errors)) {
7290
+ if(!Validator.isObservable(errors)) {
7291
7291
  throw new Error('Errors must be an observable');
7292
7292
  }
7293
7293
  this.$description.errors = errors;
@@ -7336,12 +7336,12 @@ var NativeComponents = (function (exports) {
7336
7336
 
7337
7337
  Field.prototype.value = function() {
7338
7338
  const value = this.$model();
7339
- return Validator$1.isObservable(value) ? value.val() : value;
7339
+ return Validator.isObservable(value) ? value.val() : value;
7340
7340
  };
7341
7341
 
7342
7342
  Field.prototype.setValue = function(newValue) {
7343
7343
  const value = this.$model();
7344
- if(Validator$1.isObservable(value)) {
7344
+ if(Validator.isObservable(value)) {
7345
7345
  value.set(newValue);
7346
7346
  return this;
7347
7347
  }
@@ -7411,7 +7411,7 @@ var NativeComponents = (function (exports) {
7411
7411
 
7412
7412
  Field.prototype.reset = function() {
7413
7413
  const value = this.$model();
7414
- if(Validator$1.isObservable(value)) {
7414
+ if(Validator.isObservable(value)) {
7415
7415
  value.set(this.$description.initialValue ?? this.$description.defaultValue ?? null);
7416
7416
  }
7417
7417
 
@@ -7513,7 +7513,7 @@ var NativeComponents = (function (exports) {
7513
7513
  return;
7514
7514
  }
7515
7515
 
7516
- if(Validator$1.isObservable(dataSource)) {
7516
+ if(Validator.isObservable(dataSource)) {
7517
7517
  field.model(dataSource);
7518
7518
  return;
7519
7519
  }
@@ -8171,7 +8171,7 @@ var NativeComponents = (function (exports) {
8171
8171
 
8172
8172
  CheckboxField.prototype.checked = function() {
8173
8173
  const checked = this.$description.checked;
8174
- if(Validator$1.isObservable(checked)) {
8174
+ if(Validator.isObservable(checked)) {
8175
8175
  return checked.val();
8176
8176
  }
8177
8177
  return checked;
@@ -8217,7 +8217,7 @@ var NativeComponents = (function (exports) {
8217
8217
 
8218
8218
  RadioField.prototype.checked = function() {
8219
8219
  const checked = this.$description.checked;
8220
- if(Validator$1.isObservable(checked)) {
8220
+ if(Validator.isObservable(checked)) {
8221
8221
  return checked.val();
8222
8222
  }
8223
8223
  return checked;
@@ -9302,7 +9302,7 @@ var NativeComponents = (function (exports) {
9302
9302
  };
9303
9303
 
9304
9304
  this.$description.value.interceptMutations((items) =>
9305
- items.map(item => Validator$1.isObservable(item) ? item : $$1.object(item))
9305
+ items.map(item => Validator.isObservable(item) ? item : $$1.object(item))
9306
9306
  );
9307
9307
  }
9308
9308
 
@@ -9348,10 +9348,10 @@ var NativeComponents = (function (exports) {
9348
9348
  };
9349
9349
 
9350
9350
  FieldCollection.prototype.model = function(observable) {
9351
- if(Validator$1.isObservable(observable)) {
9351
+ if(Validator.isObservable(observable)) {
9352
9352
  this.$description.value = observable;
9353
9353
  this.$description.value.interceptMutations((items) =>
9354
- items.map(item => Validator$1.isObservable(item) ? item : $$1.object(item))
9354
+ items.map(item => Validator.isObservable(item) ? item : $$1.object(item))
9355
9355
  );
9356
9356
  return this;
9357
9357
  }
@@ -9366,7 +9366,7 @@ var NativeComponents = (function (exports) {
9366
9366
  const raw = this.$description.defaultItem
9367
9367
  ? this.$description.defaultItem()
9368
9368
  : {};
9369
- const item = Validator$1.isObservable(raw) ? raw : $$1.object(raw);
9369
+ const item = Validator.isObservable(raw) ? raw : $$1.object(raw);
9370
9370
 
9371
9371
  this.$description.value.push(item);
9372
9372
  this.emit('add', item);
@@ -9391,7 +9391,7 @@ var NativeComponents = (function (exports) {
9391
9391
 
9392
9392
  FieldCollection.prototype.value = function() {
9393
9393
  return this.$description.value.map(item =>
9394
- Validator$1.isObservable(item) ? item.val() : item
9394
+ Validator.isObservable(item) ? item.val() : item
9395
9395
  );
9396
9396
  };
9397
9397
 
@@ -9914,7 +9914,7 @@ var NativeComponents = (function (exports) {
9914
9914
 
9915
9915
  ListItem.prototype.selectable = function() {
9916
9916
  this.$description.selectable = true;
9917
- if(Validator$1.isObservable(this.$description.selected)) {
9917
+ if(Validator.isObservable(this.$description.selected)) {
9918
9918
  return this;
9919
9919
  }
9920
9920
  this.$description.selected = $(false);
@@ -9922,7 +9922,7 @@ var NativeComponents = (function (exports) {
9922
9922
  };
9923
9923
 
9924
9924
  ListItem.prototype.selected = function(selected = true) {
9925
- if(Validator$1.isObservable(this.$description.selected)) {
9925
+ if(Validator.isObservable(this.$description.selected)) {
9926
9926
  this.$description.selected.set(selected);
9927
9927
  return this;
9928
9928
  }
@@ -11714,6 +11714,18 @@ var NativeComponents = (function (exports) {
11714
11714
  const Row = HStack;
11715
11715
  const Col = VStack;
11716
11716
 
11717
+ let withValidation = (fn) => fn;
11718
+
11719
+ const normalizeComponentArgs = function(props, children = null) {
11720
+ if(props && children) {
11721
+ return { props, children };
11722
+ }
11723
+ if(typeof props !== 'object' || Array.isArray(props) || props === null || props.constructor.name !== 'Object' || props.$hydrate) { // IF it's not a JSON
11724
+ return { props: children, children: props }
11725
+ }
11726
+ return { props, children };
11727
+ };
11728
+
11717
11729
  const EVENTS = [
11718
11730
  "Click",
11719
11731
  "DblClick",
@@ -12005,16 +12017,178 @@ var NativeComponents = (function (exports) {
12005
12017
  }
12006
12018
  });
12007
12019
 
12008
- const normalizeComponentArgs = function(props, children = null) {
12009
- if(props && children) {
12010
- return { props, children };
12020
+ DocumentFragment.prototype.__IS_FRAGMENT = true;
12021
+
12022
+ Function.prototype.args = function(...args) {
12023
+ return withValidation(this);
12024
+ };
12025
+
12026
+ Function.prototype.errorBoundary = function(callback) {
12027
+ const handler = (...args) => {
12028
+ try {
12029
+ return this.apply(this, args);
12030
+ } catch(e) {
12031
+ return callback(e, {caller: handler, args: args });
12032
+ }
12033
+ };
12034
+ return handler;
12035
+ };
12036
+
12037
+ NDElement.$getChild = ElementCreator.getChild;
12038
+
12039
+ String.prototype.toNdElement = function () {
12040
+ return ElementCreator.createStaticTextNode(null, this);
12041
+ };
12042
+
12043
+ Number.prototype.toNdElement = function () {
12044
+ return ElementCreator.createStaticTextNode(null, this.toString());
12045
+ };
12046
+
12047
+ Element.prototype.toNdElement = function () {
12048
+ return this;
12049
+ };
12050
+ Text.prototype.toNdElement = function () {
12051
+ return this;
12052
+ };
12053
+ Comment.prototype.toNdElement = function () {
12054
+ return this;
12055
+ };
12056
+ Document.prototype.toNdElement = function () {
12057
+ return this;
12058
+ };
12059
+ DocumentFragment.prototype.toNdElement = function () {
12060
+ return this;
12061
+ };
12062
+
12063
+ ObservableItem.prototype.toNdElement = function () {
12064
+ return ElementCreator.createObservableNode(null, this);
12065
+ };
12066
+
12067
+ ObservableChecker.prototype.toNdElement = ObservableItem.prototype.toNdElement;
12068
+
12069
+ NDElement.prototype.toNdElement = function () {
12070
+ const element = this.$element ?? this.$build?.() ?? this.build?.() ?? null;
12071
+ if(this.$attachements) {
12072
+ if(!this.$attachements.contains(this.$element)) {
12073
+ this.$attachements.append(this.$element);
12074
+ }
12075
+ return this.$attachements;
12011
12076
  }
12012
- if(typeof props !== 'object' || Array.isArray(props) || props === null || props.constructor.name !== 'Object' || props.$hydrate) { // IF it's not a JSON
12013
- return { props: children, children: props }
12077
+ return element;
12078
+ };
12079
+
12080
+ Array.prototype.toNdElement = function () {
12081
+ const fragment = document.createDocumentFragment();
12082
+ for(let i = 0, length = this.length; i < length; i++) {
12083
+ const child = ElementCreator.getChild(this[i]);
12084
+ if(child === null) continue;
12085
+ fragment.appendChild(child);
12014
12086
  }
12015
- return { props, children };
12087
+ return fragment;
12088
+ };
12089
+
12090
+ Function.prototype.toNdElement = function () {
12091
+ const child = this;
12092
+ return ElementCreator.getChild(child());
12093
+ };
12094
+
12095
+ /**
12096
+ * @param {HTMLElement} el
12097
+ * @param {number} timeout
12098
+ */
12099
+ const waitForVisualEnd = (el, timeout = 1000) => {
12100
+ return new Promise((resolve) => {
12101
+ let isResolved = false;
12102
+
12103
+ const cleanupAndResolve = (e) => {
12104
+ if (e && e.target !== el) return;
12105
+ if (isResolved) return;
12106
+
12107
+ isResolved = true;
12108
+ el.removeEventListener('transitionend', cleanupAndResolve);
12109
+ el.removeEventListener('animationend', cleanupAndResolve);
12110
+ clearTimeout(timer);
12111
+ resolve();
12112
+ };
12113
+
12114
+ el.addEventListener('transitionend', cleanupAndResolve);
12115
+ el.addEventListener('animationend', cleanupAndResolve);
12116
+
12117
+ const timer = setTimeout(cleanupAndResolve, timeout);
12118
+
12119
+ const style = window.getComputedStyle(el);
12120
+ const hasTransition = style.transitionDuration !== '0s';
12121
+ const hasAnimation = style.animationDuration !== '0s';
12122
+
12123
+ if (!hasTransition && !hasAnimation) {
12124
+ cleanupAndResolve();
12125
+ }
12126
+ });
12016
12127
  };
12017
12128
 
12129
+ NDElement.prototype.transitionOut = function(transitionName) {
12130
+ const exitClass = transitionName + '-exit';
12131
+ const el = this.$element;
12132
+ this.beforeUnmount('transition-exit', async function() {
12133
+ el.classes.add(exitClass);
12134
+ await waitForVisualEnd(el);
12135
+ el.classes.remove(exitClass);
12136
+ });
12137
+ return this;
12138
+ };
12139
+
12140
+ NDElement.prototype.transitionIn = function(transitionName) {
12141
+ const startClass = transitionName + '-enter-from';
12142
+ const endClass = transitionName + '-enter-to';
12143
+
12144
+ const el = this.$element;
12145
+
12146
+ el.classes.add(startClass);
12147
+
12148
+ this.mounted(() => {
12149
+ requestAnimationFrame(() => {
12150
+ requestAnimationFrame(() => {
12151
+ el.classes.remove(startClass);
12152
+ el.classes.add(endClass);
12153
+
12154
+ waitForVisualEnd(el).then(() => {
12155
+ el.classes.remove(endClass);
12156
+ });
12157
+ });
12158
+ });
12159
+ });
12160
+ return this;
12161
+ };
12162
+
12163
+
12164
+ NDElement.prototype.transition = function (transitionName) {
12165
+ this.transitionIn(transitionName);
12166
+ this.transitionOut(transitionName);
12167
+ return this;
12168
+ };
12169
+
12170
+ NDElement.prototype.animate = function(animationName) {
12171
+ const el = this.$element;
12172
+ el.classes.add(animationName);
12173
+
12174
+ waitForVisualEnd(el).then(() => {
12175
+ el.classes.remove(animationName);
12176
+ });
12177
+
12178
+ return this;
12179
+ };
12180
+
12181
+ ObservableItem.prototype.handleNdAttribute = function(element, attributeName) {
12182
+ if(BOOLEAN_ATTRIBUTES.has(attributeName)) {
12183
+ bindBooleanAttribute(element, attributeName, this);
12184
+ return;
12185
+ }
12186
+
12187
+ bindAttributeWithObservable(element, attributeName, this);
12188
+ };
12189
+
12190
+ ObservableChecker.prototype.handleNdAttribute = ObservableItem.prototype.handleNdAttribute;
12191
+
12018
12192
  const createHtmlElement = (element, _attributes, _children = null) => {
12019
12193
  let { props: attributes, children = null } = normalizeComponentArgs(_attributes, _children);
12020
12194
 
@@ -12743,7 +12917,7 @@ var NativeComponents = (function (exports) {
12743
12917
  };
12744
12918
 
12745
12919
  Splitter.prototype.panels = function(panels) {
12746
- if(Validator$1.isObservable(this.$description.panels)) {
12920
+ if(Validator.isObservable(this.$description.panels)) {
12747
12921
  this.$description.panels.clear();
12748
12922
  } else {
12749
12923
  this.$description.panels = [];
@@ -13546,161 +13720,6 @@ var NativeComponents = (function (exports) {
13546
13720
  return this;
13547
13721
  };
13548
13722
 
13549
- NDElement.$getChild = ElementCreator.getChild;
13550
-
13551
- String.prototype.toNdElement = function () {
13552
- return ElementCreator.createStaticTextNode(null, this);
13553
- };
13554
-
13555
- Number.prototype.toNdElement = function () {
13556
- return ElementCreator.createStaticTextNode(null, this.toString());
13557
- };
13558
-
13559
- Element.prototype.toNdElement = function () {
13560
- return this;
13561
- };
13562
- Text.prototype.toNdElement = function () {
13563
- return this;
13564
- };
13565
- Comment.prototype.toNdElement = function () {
13566
- return this;
13567
- };
13568
- Document.prototype.toNdElement = function () {
13569
- return this;
13570
- };
13571
- DocumentFragment.prototype.toNdElement = function () {
13572
- return this;
13573
- };
13574
-
13575
- ObservableItem.prototype.toNdElement = function () {
13576
- return ElementCreator.createObservableNode(null, this);
13577
- };
13578
-
13579
- ObservableChecker.prototype.toNdElement = ObservableItem.prototype.toNdElement;
13580
-
13581
- NDElement.prototype.toNdElement = function () {
13582
- const element = this.$element ?? this.$build?.() ?? this.build?.() ?? null;
13583
- if(this.$attachements) {
13584
- if(!this.$attachements.contains(this.$element)) {
13585
- this.$attachements.append(this.$element);
13586
- }
13587
- return this.$attachements;
13588
- }
13589
- return element;
13590
- };
13591
-
13592
- Array.prototype.toNdElement = function () {
13593
- const fragment = document.createDocumentFragment();
13594
- for(let i = 0, length = this.length; i < length; i++) {
13595
- const child = ElementCreator.getChild(this[i]);
13596
- if(child === null) continue;
13597
- fragment.appendChild(child);
13598
- }
13599
- return fragment;
13600
- };
13601
-
13602
- Function.prototype.toNdElement = function () {
13603
- const child = this;
13604
- return ElementCreator.getChild(child());
13605
- };
13606
-
13607
- /**
13608
- * @param {HTMLElement} el
13609
- * @param {number} timeout
13610
- */
13611
- const waitForVisualEnd = (el, timeout = 1000) => {
13612
- return new Promise((resolve) => {
13613
- let isResolved = false;
13614
-
13615
- const cleanupAndResolve = (e) => {
13616
- if (e && e.target !== el) return;
13617
- if (isResolved) return;
13618
-
13619
- isResolved = true;
13620
- el.removeEventListener('transitionend', cleanupAndResolve);
13621
- el.removeEventListener('animationend', cleanupAndResolve);
13622
- clearTimeout(timer);
13623
- resolve();
13624
- };
13625
-
13626
- el.addEventListener('transitionend', cleanupAndResolve);
13627
- el.addEventListener('animationend', cleanupAndResolve);
13628
-
13629
- const timer = setTimeout(cleanupAndResolve, timeout);
13630
-
13631
- const style = window.getComputedStyle(el);
13632
- const hasTransition = style.transitionDuration !== '0s';
13633
- const hasAnimation = style.animationDuration !== '0s';
13634
-
13635
- if (!hasTransition && !hasAnimation) {
13636
- cleanupAndResolve();
13637
- }
13638
- });
13639
- };
13640
-
13641
- NDElement.prototype.transitionOut = function(transitionName) {
13642
- const exitClass = transitionName + '-exit';
13643
- const el = this.$element;
13644
- this.beforeUnmount('transition-exit', async function() {
13645
- el.classes.add(exitClass);
13646
- await waitForVisualEnd(el);
13647
- el.classes.remove(exitClass);
13648
- });
13649
- return this;
13650
- };
13651
-
13652
- NDElement.prototype.transitionIn = function(transitionName) {
13653
- const startClass = transitionName + '-enter-from';
13654
- const endClass = transitionName + '-enter-to';
13655
-
13656
- const el = this.$element;
13657
-
13658
- el.classes.add(startClass);
13659
-
13660
- this.mounted(() => {
13661
- requestAnimationFrame(() => {
13662
- requestAnimationFrame(() => {
13663
- el.classes.remove(startClass);
13664
- el.classes.add(endClass);
13665
-
13666
- waitForVisualEnd(el).then(() => {
13667
- el.classes.remove(endClass);
13668
- });
13669
- });
13670
- });
13671
- });
13672
- return this;
13673
- };
13674
-
13675
-
13676
- NDElement.prototype.transition = function (transitionName) {
13677
- this.transitionIn(transitionName);
13678
- this.transitionOut(transitionName);
13679
- return this;
13680
- };
13681
-
13682
- NDElement.prototype.animate = function(animationName) {
13683
- const el = this.$element;
13684
- el.classes.add(animationName);
13685
-
13686
- waitForVisualEnd(el).then(() => {
13687
- el.classes.remove(animationName);
13688
- });
13689
-
13690
- return this;
13691
- };
13692
-
13693
- ObservableItem.prototype.handleNdAttribute = function(element, attributeName) {
13694
- if(BOOLEAN_ATTRIBUTES.has(attributeName)) {
13695
- bindBooleanAttribute(element, attributeName, this);
13696
- return;
13697
- }
13698
-
13699
- bindAttributeWithObservable(element, attributeName, this);
13700
- };
13701
-
13702
- ObservableChecker.prototype.handleNdAttribute = ObservableItem.prototype.handleNdAttribute;
13703
-
13704
13723
  function ColumnGroup(title, props = {}) {
13705
13724
  this.$description = {
13706
13725
  header: title,