native-document 1.0.38 → 1.0.40

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.
@@ -243,7 +243,7 @@ var NativeDocument = (function (exports) {
243
243
  });
244
244
 
245
245
  ObservableItem.prototype.__$isObservable = true;
246
-
246
+ const DEFAULT_OPERATIONS = {};
247
247
  const noneTrigger = function() {};
248
248
  ObservableItem.prototype.triggerFirstListener = function(operations) {
249
249
  this.$listeners[0](this.$currentValue, this.$previousValue, operations || {});
@@ -973,6 +973,11 @@ var NativeDocument = (function (exports) {
973
973
  };
974
974
  }
975
975
 
976
+ var validator = /*#__PURE__*/Object.freeze({
977
+ __proto__: null,
978
+ default: Validator
979
+ });
980
+
976
981
  function Anchor(name, isUniqueChild = false) {
977
982
  const element = document.createDocumentFragment();
978
983
 
@@ -993,7 +998,7 @@ var NativeDocument = (function (exports) {
993
998
  parent.nativeInsertBefore(element, target);
994
999
  return;
995
1000
  }
996
- if(isParentUniqueChild(parent) || target === anchorEnd) {
1001
+ if(isParentUniqueChild(parent) && target === anchorEnd) {
997
1002
  parent.append(element, target);
998
1003
  return;
999
1004
  }
@@ -1045,11 +1050,11 @@ var NativeDocument = (function (exports) {
1045
1050
  return;
1046
1051
  }
1047
1052
  if(isParentUniqueChild(parent)) {
1048
- parent.replaceChildren(anchorEnd, anchorEnd);
1053
+ parent.replaceChildren(anchorStart, anchorEnd);
1049
1054
  return;
1050
1055
  }
1051
1056
  let itemToRemove = anchorStart.nextSibling, tempItem;
1052
- while(itemToRemove !== anchorEnd) {
1057
+ while(itemToRemove && itemToRemove !== anchorEnd) {
1053
1058
  tempItem = itemToRemove.nextSibling;
1054
1059
  element.nativeAppendChild(itemToRemove);
1055
1060
  itemToRemove = tempItem;
@@ -1281,6 +1286,9 @@ var NativeDocument = (function (exports) {
1281
1286
  for(let key in attributes) {
1282
1287
  const attributeName = key.toLowerCase();
1283
1288
  let value = attributes[attributeName];
1289
+ if(value === null || value === undefined) {
1290
+ continue;
1291
+ }
1284
1292
  if(Validator.isString(value)) {
1285
1293
  value = value.resolveObservableTemplate ? value.resolveObservableTemplate() : value;
1286
1294
  if(Validator.isString(value)) {
@@ -2052,14 +2060,6 @@ var NativeDocument = (function (exports) {
2052
2060
  const data = {};
2053
2061
  for(const key in initialValue) {
2054
2062
  const itemValue = initialValue[key];
2055
- if(Validator.isJson(itemValue)) {
2056
- data[key] = Observable.init(itemValue);
2057
- continue;
2058
- }
2059
- else if(Validator.isArray(itemValue)) {
2060
- data[key] = Observable.array(itemValue);
2061
- continue;
2062
- }
2063
2063
  data[key] = Observable(itemValue);
2064
2064
  }
2065
2065
 
@@ -2078,7 +2078,7 @@ var NativeDocument = (function (exports) {
2078
2078
  return result;
2079
2079
  };
2080
2080
  const $clone = function() {
2081
-
2081
+ return Observable.init($val());
2082
2082
  };
2083
2083
  const $updateWith = function(values) {
2084
2084
  Observable.update(proxy, values);
@@ -3892,6 +3892,7 @@ var NativeDocument = (function (exports) {
3892
3892
  exports.PluginsManager = PluginsManager;
3893
3893
  exports.Store = Store;
3894
3894
  exports.TemplateCloner = TemplateCloner;
3895
+ exports.Validator = validator;
3895
3896
  exports.classPropertyAccumulator = classPropertyAccumulator;
3896
3897
  exports.createTextNode = createTextNode;
3897
3898
  exports.cssPropertyAccumulator = cssPropertyAccumulator;