native-document 1.0.77 → 1.0.78

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.
Files changed (125) hide show
  1. package/dist/native-document.components.min.js +158 -130
  2. package/dist/native-document.dev.js +191 -144
  3. package/dist/native-document.dev.js.map +1 -1
  4. package/dist/native-document.devtools.min.js +1 -1
  5. package/dist/native-document.min.js +1 -1
  6. package/package.json +1 -1
  7. package/rollup.config.js +0 -16
  8. package/src/components/$traits/HasItems.js +1 -1
  9. package/src/components/accordion/Accordion.js +2 -2
  10. package/src/components/accordion/AccordionItem.js +2 -2
  11. package/src/components/alert/Alert.js +2 -2
  12. package/src/components/avatar/Avatar.js +2 -2
  13. package/src/components/badge/Badge.js +2 -2
  14. package/src/components/breadcrumb/BreadCrumb.js +2 -2
  15. package/src/components/button/Button.js +2 -2
  16. package/src/components/card/Card.js +1 -1
  17. package/src/components/context-menu/ContextMenu.js +2 -2
  18. package/src/components/context-menu/ContextMenuGroup.js +1 -1
  19. package/src/components/context-menu/ContextMenuItem.js +1 -1
  20. package/src/components/divider/Divider.js +1 -1
  21. package/src/components/dropdown/Dropdown.js +2 -2
  22. package/src/components/dropdown/DropdownDivider.js +1 -1
  23. package/src/components/dropdown/DropdownGroup.js +1 -1
  24. package/src/components/dropdown/DropdownItem.js +1 -1
  25. package/src/components/dropdown/DropdownTrigger.js +1 -1
  26. package/src/components/form/FormControl.js +5 -5
  27. package/src/components/form/field/DefaultRender.js +2 -2
  28. package/src/components/form/field/Field.js +4 -4
  29. package/src/components/form/field/FieldCollection.js +5 -5
  30. package/src/components/form/field/types/CheckboxField.js +1 -1
  31. package/src/components/form/field/types/ColorField.js +1 -1
  32. package/src/components/form/field/types/DateField.js +1 -1
  33. package/src/components/form/field/types/EmailField.js +1 -1
  34. package/src/components/form/field/types/FileField.js +1 -1
  35. package/src/components/form/field/types/ImageField.js +1 -1
  36. package/src/components/form/field/types/NumberField.js +1 -1
  37. package/src/components/form/field/types/PasswordField.js +1 -1
  38. package/src/components/form/field/types/RadioField.js +1 -1
  39. package/src/components/form/field/types/StringField.js +1 -1
  40. package/src/components/form/field/types/TelField.js +1 -1
  41. package/src/components/form/field/types/TimeField.js +1 -1
  42. package/src/components/form/field/types/UrlField.js +1 -1
  43. package/src/components/form/validation/Validation.js +1 -1
  44. package/src/components/list/List.js +4 -4
  45. package/src/components/list/ListGroup.js +2 -2
  46. package/src/components/list/ListItem.js +2 -2
  47. package/src/components/menu/Menu.js +3 -3
  48. package/src/components/menu/MenuDivider.js +1 -1
  49. package/src/components/menu/MenuGroup.js +2 -2
  50. package/src/components/menu/MenuItem.js +2 -2
  51. package/src/components/modal/Modal.js +2 -2
  52. package/src/components/pagination/Pagination.js +2 -2
  53. package/src/components/popover/Popover.js +2 -2
  54. package/src/components/popover/PopoverFooter.js +1 -1
  55. package/src/components/popover/PopoverHeader.js +1 -1
  56. package/src/components/progress/Progress.js +3 -3
  57. package/src/components/slider/Slider.js +2 -2
  58. package/src/components/splitter/Splitter.js +3 -4
  59. package/src/components/splitter/SplitterPanel.js +1 -1
  60. package/src/components/stepper/Stepper.js +3 -3
  61. package/src/components/stepper/StepperStep.js +2 -2
  62. package/src/components/switch/Switch.js +2 -2
  63. package/src/components/table/ColumnGroup.js +1 -1
  64. package/src/components/table/DataTable.js +1 -1
  65. package/src/components/table/SimpleTable.js +1 -1
  66. package/src/components/tabs/Tabs.js +2 -2
  67. package/src/components/toast/Toast.js +2 -2
  68. package/src/components/tooltip/prototypes.js +1 -1
  69. package/src/core/data/MemoryManager.js +1 -2
  70. package/src/core/data/Observable.js +1 -1
  71. package/src/core/data/ObservableArray.js +4 -4
  72. package/src/core/data/ObservableItem.js +5 -5
  73. package/src/core/data/observable-helpers/array.js +2 -2
  74. package/src/core/data/observable-helpers/batch.js +2 -2
  75. package/src/core/data/observable-helpers/computed.js +6 -6
  76. package/src/core/data/observable-helpers/object.js +2 -2
  77. package/src/core/elements/anchor.js +3 -3
  78. package/src/core/elements/content-formatter.js +1 -1
  79. package/src/core/elements/control/for-each-array.js +5 -6
  80. package/src/core/elements/control/for-each.js +7 -7
  81. package/src/core/elements/control/show-if.js +5 -5
  82. package/src/core/elements/control/show-when.js +2 -2
  83. package/src/core/elements/control/switch.js +4 -4
  84. package/src/core/elements/description-list.js +1 -1
  85. package/src/core/elements/form.js +1 -1
  86. package/src/core/elements/html5-semantics.js +1 -1
  87. package/src/core/elements/img.js +3 -3
  88. package/src/core/elements/index.js +1 -1
  89. package/src/core/elements/interactive.js +1 -1
  90. package/src/core/elements/list.js +1 -1
  91. package/src/core/elements/medias.js +1 -1
  92. package/src/core/elements/meta-data.js +1 -1
  93. package/src/core/elements/table.js +1 -1
  94. package/src/core/utils/EventEmitter.js +1 -1
  95. package/src/core/utils/args-types.js +2 -2
  96. package/src/core/utils/filters/standard.js +1 -1
  97. package/src/core/utils/filters/utils.js +1 -1
  98. package/src/core/utils/prototypes.js +2 -2
  99. package/src/core/utils/validator.js +5 -5
  100. package/src/core/wrappers/AttributesWrapper.js +3 -3
  101. package/src/core/wrappers/DocumentObserver.js +0 -1
  102. package/src/core/wrappers/ElementCreator.js +3 -3
  103. package/src/core/wrappers/HtmlElementWrapper.js +2 -2
  104. package/src/core/wrappers/NDElement.js +3 -3
  105. package/src/core/wrappers/NdPrototype.js +1 -1
  106. package/src/core/wrappers/SingletonView.js +1 -1
  107. package/src/core/wrappers/prototypes/attributes-extensions.js +4 -4
  108. package/src/core/wrappers/prototypes/bind-class-extensions.js +4 -4
  109. package/src/core/wrappers/prototypes/nd-element-extensions.js +6 -6
  110. package/src/devtools/app/App.js +2 -2
  111. package/src/devtools/hrm/ComponentRegistry.js +2 -2
  112. package/src/devtools/plugin.js +1 -1
  113. package/src/devtools/widget/DevToolsWidget.js +2 -2
  114. package/src/router/Route.js +1 -1
  115. package/src/router/RouteGroupHelper.js +1 -1
  116. package/src/router/Router.js +4 -4
  117. package/src/router/RouterComponent.js +1 -1
  118. package/src/router/link.js +4 -4
  119. package/src/router/modes/HistoryRouter.js +1 -1
  120. package/types/control-flow.d.ts +0 -1
  121. package/types/filters/dates.d.ts +1 -1
  122. package/types/filters/types.d.ts +1 -1
  123. package/utils.js +3 -3
  124. package/jsconfig.json +0 -15
  125. /package/src/{core → router}/errors/RouterError.js +0 -0
@@ -256,16 +256,16 @@ var NativeComponents = (function (exports) {
256
256
  return this.$build();
257
257
  };
258
258
 
259
- let DebugManager = {};
259
+ let DebugManager$1 = {};
260
260
  {
261
- DebugManager = {
261
+ DebugManager$1 = {
262
262
  log() {},
263
263
  warn() {},
264
264
  error() {},
265
265
  disable() {}
266
266
  };
267
267
  }
268
- var DebugManager$1 = DebugManager;
268
+ var DebugManager = DebugManager$1;
269
269
 
270
270
  const MemoryManager = (function() {
271
271
 
@@ -314,7 +314,7 @@ var NativeComponents = (function (exports) {
314
314
  }
315
315
  }
316
316
  if (cleanedCount > 0) {
317
- DebugManager$1.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
317
+ DebugManager.log('Memory Auto Clean', `🧹 Cleaned ${cleanedCount} orphaned observables`);
318
318
  }
319
319
  }
320
320
  };
@@ -428,7 +428,7 @@ var NativeComponents = (function (exports) {
428
428
  try{
429
429
  callback.call(plugin, ...data);
430
430
  } catch (error) {
431
- DebugManager$1.error('Plugin Manager', `Error in plugin ${plugin.$name} for event ${eventName}`, error);
431
+ DebugManager.error('Plugin Manager', `Error in plugin ${plugin.$name} for event ${eventName}`, error);
432
432
  }
433
433
  }
434
434
  }
@@ -732,7 +732,7 @@ var NativeComponents = (function (exports) {
732
732
  ObservableItem.prototype.subscribe = function(callback, target = null) {
733
733
  this.$listeners = this.$listeners ?? [];
734
734
  if (this.$isCleanedUp) {
735
- DebugManager$1.warn('Observable subscription', '⚠️ Attempted to subscribe to a cleaned up observable.');
735
+ DebugManager.warn('Observable subscription', '⚠️ Attempted to subscribe to a cleaned up observable.');
736
736
  return () => {};
737
737
  }
738
738
  if (typeof callback !== 'function') {
@@ -1108,17 +1108,17 @@ var NativeComponents = (function (exports) {
1108
1108
  const method = methods[name];
1109
1109
 
1110
1110
  if (typeof method !== 'function') {
1111
- DebugManager$1.warn('NDElement.extend', `"${name}" is not a function, skipping`);
1111
+ DebugManager.warn('NDElement.extend', `"${name}" is not a function, skipping`);
1112
1112
  continue;
1113
1113
  }
1114
1114
 
1115
1115
  if (protectedMethods.has(name)) {
1116
- DebugManager$1.error('NDElement.extend', `Cannot override protected method "${name}"`);
1116
+ DebugManager.error('NDElement.extend', `Cannot override protected method "${name}"`);
1117
1117
  throw new NativeDocumentError(`Cannot override protected method "${name}"`);
1118
1118
  }
1119
1119
 
1120
1120
  if (NDElement.prototype[name]) {
1121
- DebugManager$1.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
1121
+ DebugManager.warn('NDElement.extend', `Overwriting existing prototype method "${name}"`);
1122
1122
  }
1123
1123
 
1124
1124
  NDElement.prototype[name] = method;
@@ -1308,7 +1308,7 @@ var NativeComponents = (function (exports) {
1308
1308
  anchorFragment.appendChild = function(child, before = null) {
1309
1309
  const parent = anchorEnd.parentNode;
1310
1310
  if(!parent) {
1311
- DebugManager$1.error('Anchor', 'Anchor : parent not found', child);
1311
+ DebugManager.error('Anchor', 'Anchor : parent not found', child);
1312
1312
  return;
1313
1313
  }
1314
1314
  before = before ?? anchorEnd;
@@ -1404,7 +1404,38 @@ var NativeComponents = (function (exports) {
1404
1404
  return anchorFragment;
1405
1405
  }
1406
1406
 
1407
- const BOOLEAN_ATTRIBUTES = ['checked', 'selected', 'disabled', 'readonly', 'required', 'autofocus', 'multiple', 'autocomplete', 'hidden', 'contenteditable', 'spellcheck', 'translate', 'draggable', 'async', 'defer', 'autoplay', 'controls', 'loop', 'muted', 'download', 'reversed', 'open', 'default', 'formnovalidate', 'novalidate', 'scoped', 'itemscope', 'allowfullscreen', 'allowpaymentrequest', 'playsinline'];
1407
+ const BOOLEAN_ATTRIBUTES = new Set([
1408
+ 'checked',
1409
+ 'selected',
1410
+ 'disabled',
1411
+ 'readonly',
1412
+ 'required',
1413
+ 'autofocus',
1414
+ 'multiple',
1415
+ 'autocomplete',
1416
+ 'hidden',
1417
+ 'contenteditable',
1418
+ 'spellcheck',
1419
+ 'translate',
1420
+ 'draggable',
1421
+ 'async',
1422
+ 'defer',
1423
+ 'autoplay',
1424
+ 'controls',
1425
+ 'loop',
1426
+ 'muted',
1427
+ 'download',
1428
+ 'reversed',
1429
+ 'open',
1430
+ 'default',
1431
+ 'formnovalidate',
1432
+ 'novalidate',
1433
+ 'scoped',
1434
+ 'itemscope',
1435
+ 'allowfullscreen',
1436
+ 'allowpaymentrequest',
1437
+ 'playsinline'
1438
+ ]);
1408
1439
 
1409
1440
  /**
1410
1441
  *
@@ -1592,6 +1623,12 @@ var NativeComponents = (function (exports) {
1592
1623
  }
1593
1624
  }
1594
1625
 
1626
+ const NdBindings = {
1627
+ class: (element, value) => bindClassAttribute(element, value),
1628
+ style: (element, value) => bindStyleAttribute(element, value),
1629
+ };
1630
+
1631
+
1595
1632
  /**
1596
1633
  *
1597
1634
  * @param {HTMLElement} element
@@ -1605,41 +1642,27 @@ var NativeComponents = (function (exports) {
1605
1642
 
1606
1643
  for(let key in attributes) {
1607
1644
  const attributeName = key.toLowerCase();
1608
- let value = attributes[attributeName];
1609
- if(value === null || value === undefined) {
1645
+ let value = attributes[key];
1646
+ if(value == null) {
1610
1647
  continue;
1611
1648
  }
1612
1649
  if(value.handleNdAttribute) {
1613
1650
  value.handleNdAttribute(element, attributeName, value);
1614
1651
  continue;
1615
1652
  }
1616
- if(Validator.isString(value)) {
1617
- element.setAttribute(attributeName, value);
1618
- return;
1619
- }
1620
- if(attributeName === 'class' && Validator.isObject(value)) {
1621
- bindClassAttribute(element, value);
1622
- continue;
1623
- }
1624
- if(attributeName === 'style' && Validator.isObject(value)) {
1625
- bindStyleAttribute(element, value);
1626
- continue;
1653
+ if(typeof value === 'object') {
1654
+ const binding = NdBindings[attributeName];
1655
+ if(binding) {
1656
+ binding(element, value);
1657
+ continue;
1658
+ }
1627
1659
  }
1628
- if(BOOLEAN_ATTRIBUTES.includes(attributeName)) {
1660
+ if(BOOLEAN_ATTRIBUTES.has(attributeName)) {
1629
1661
  bindBooleanAttribute(element, attributeName, value);
1630
1662
  continue;
1631
1663
  }
1632
- if(Validator.isObservable(value)) {
1633
- bindAttributeWithObservable(element, attributeName, value);
1634
- continue;
1635
- }
1636
- if(value.$hydrate) {
1637
- value.$hydrate(element, attributeName);
1638
- continue;
1639
- }
1640
1664
 
1641
1665
  element.setAttribute(attributeName, value);
1642
-
1643
1666
  }
1644
1667
  return element;
1645
1668
  }
@@ -1700,8 +1723,16 @@ var NativeComponents = (function (exports) {
1700
1723
  element.setAttribute(attributeName, this);
1701
1724
  };
1702
1725
 
1726
+ Number.prototype.handleNdAttribute = function(element, attributeName) {
1727
+ element.setAttribute(attributeName, this);
1728
+ };
1729
+
1730
+ Boolean.prototype.handleNdAttribute = function(element, attrName) {
1731
+ bindBooleanAttribute(element, attrName, this);
1732
+ };
1733
+
1703
1734
  ObservableItem.prototype.handleNdAttribute = function(element, attributeName) {
1704
- if(BOOLEAN_ATTRIBUTES.includes(attributeName)) {
1735
+ if(BOOLEAN_ATTRIBUTES.has(attributeName)) {
1705
1736
  bindBooleanAttribute(element, attributeName, this);
1706
1737
  return;
1707
1738
  }
@@ -1791,22 +1822,14 @@ var NativeComponents = (function (exports) {
1791
1822
  PluginsManager.emit('AfterProcessChildren', parent);
1792
1823
  },
1793
1824
  getChild(child) {
1794
- if(child == null) {
1795
- return null;
1796
- }
1797
- if(child.toNdElement) {
1798
- do {
1799
- child = child.toNdElement();
1800
- if(Validator.isElement(child)) {
1801
- return child;
1802
- }
1803
- if(child == null) {
1804
- return null;
1805
- }
1806
- } while (child.toNdElement);
1825
+ while (child?.toNdElement) {
1826
+ child = child.toNdElement();
1827
+
1828
+ if (Validator.isElement(child)) return child;
1829
+ if (!child) return null;
1807
1830
  }
1808
1831
 
1809
- return ElementCreator.createStaticTextNode(null, child);
1832
+ return child ? ElementCreator.createStaticTextNode(null, child) : null;
1810
1833
  },
1811
1834
  /**
1812
1835
  *
@@ -2145,6 +2168,8 @@ var NativeComponents = (function (exports) {
2145
2168
  return createHtmlElement.bind(null, name.toLowerCase(), customWrapper);
2146
2169
  }
2147
2170
 
2171
+ w;
2172
+
2148
2173
  Function.prototype.args = function(...args) {
2149
2174
  return withValidation(this);
2150
2175
  };
@@ -2284,6 +2309,9 @@ var NativeComponents = (function (exports) {
2284
2309
  });
2285
2310
 
2286
2311
  ObservableArray.prototype.clear = function() {
2312
+ if(this.$currentValue.length === 0) {
2313
+ return;
2314
+ }
2287
2315
  this.$currentValue.length = 0;
2288
2316
  this.trigger({ action: 'clear' });
2289
2317
  return true;
@@ -8647,87 +8675,6 @@ var NativeComponents = (function (exports) {
8647
8675
  Spinner.prototype.$build = function() {};
8648
8676
  Spinner.prototype.toNdElement = function() {};
8649
8677
 
8650
- function SplitterPanel(content, config = {}) {
8651
- if(!(this instanceof SplitterPanel)) {
8652
- return new SplitterPanel(content, config);
8653
- }
8654
-
8655
- if (typeof content === 'object' && !content.tagName) {
8656
- config = content;
8657
- content = config.content || null;
8658
- }
8659
-
8660
- this.$description = {
8661
- content: content || null,
8662
- size: null,
8663
- minSize: null,
8664
- maxSize: null,
8665
- collapsible: false,
8666
- collapsed: false,
8667
- resizable: true,
8668
- data: null,
8669
- render: null,
8670
- ...config
8671
- };
8672
- }
8673
-
8674
- BaseComponent.extends(SplitterPanel, BaseComponent);
8675
-
8676
- SplitterPanel.defaultTemplate = null;
8677
-
8678
- SplitterPanel.use = function(template) {
8679
- SplitterPanel.defaultTemplate = template.splitterPanel;
8680
- };
8681
-
8682
- SplitterPanel.prototype.content = function(content) {
8683
- this.$description.content = content;
8684
- return this;
8685
- };
8686
-
8687
- SplitterPanel.prototype.size = function(size) {
8688
- this.$description.size = size;
8689
- return this;
8690
- };
8691
-
8692
- SplitterPanel.prototype.minSize = function(size) {
8693
- this.$description.minSize = size;
8694
- return this;
8695
- };
8696
-
8697
- SplitterPanel.prototype.maxSize = function(size) {
8698
- this.$description.maxSize = size;
8699
- return this;
8700
- };
8701
-
8702
- SplitterPanel.prototype.collapsible = function(collapsible = true) {
8703
- this.$description.collapsible = collapsible;
8704
- return this;
8705
- };
8706
-
8707
- SplitterPanel.prototype.collapsed = function(collapsed = true) {
8708
- this.$description.collapsed = collapsed;
8709
- return this;
8710
- };
8711
-
8712
- SplitterPanel.prototype.resizable = function(resizable = true) {
8713
- this.$description.resizable = resizable;
8714
- return this;
8715
- };
8716
-
8717
- SplitterPanel.prototype.fixed = function() {
8718
- return this.resizable(false);
8719
- };
8720
-
8721
- SplitterPanel.prototype.data = function(data) {
8722
- this.$description.data = data;
8723
- return this;
8724
- };
8725
-
8726
- SplitterPanel.prototype.render = function(renderFn) {
8727
- this.$description.render = renderFn;
8728
- return this;
8729
- };
8730
-
8731
8678
  function Splitter(config = {}) {
8732
8679
  if(!(this instanceof Splitter)) {
8733
8680
  return new Splitter(config);
@@ -8819,6 +8766,87 @@ var NativeComponents = (function (exports) {
8819
8766
  return this;
8820
8767
  };
8821
8768
 
8769
+ function SplitterPanel(content, config = {}) {
8770
+ if(!(this instanceof SplitterPanel)) {
8771
+ return new SplitterPanel(content, config);
8772
+ }
8773
+
8774
+ if (typeof content === 'object' && !content.tagName) {
8775
+ config = content;
8776
+ content = config.content || null;
8777
+ }
8778
+
8779
+ this.$description = {
8780
+ content: content || null,
8781
+ size: null,
8782
+ minSize: null,
8783
+ maxSize: null,
8784
+ collapsible: false,
8785
+ collapsed: false,
8786
+ resizable: true,
8787
+ data: null,
8788
+ render: null,
8789
+ ...config
8790
+ };
8791
+ }
8792
+
8793
+ BaseComponent.extends(SplitterPanel, BaseComponent);
8794
+
8795
+ SplitterPanel.defaultTemplate = null;
8796
+
8797
+ SplitterPanel.use = function(template) {
8798
+ SplitterPanel.defaultTemplate = template.splitterPanel;
8799
+ };
8800
+
8801
+ SplitterPanel.prototype.content = function(content) {
8802
+ this.$description.content = content;
8803
+ return this;
8804
+ };
8805
+
8806
+ SplitterPanel.prototype.size = function(size) {
8807
+ this.$description.size = size;
8808
+ return this;
8809
+ };
8810
+
8811
+ SplitterPanel.prototype.minSize = function(size) {
8812
+ this.$description.minSize = size;
8813
+ return this;
8814
+ };
8815
+
8816
+ SplitterPanel.prototype.maxSize = function(size) {
8817
+ this.$description.maxSize = size;
8818
+ return this;
8819
+ };
8820
+
8821
+ SplitterPanel.prototype.collapsible = function(collapsible = true) {
8822
+ this.$description.collapsible = collapsible;
8823
+ return this;
8824
+ };
8825
+
8826
+ SplitterPanel.prototype.collapsed = function(collapsed = true) {
8827
+ this.$description.collapsed = collapsed;
8828
+ return this;
8829
+ };
8830
+
8831
+ SplitterPanel.prototype.resizable = function(resizable = true) {
8832
+ this.$description.resizable = resizable;
8833
+ return this;
8834
+ };
8835
+
8836
+ SplitterPanel.prototype.fixed = function() {
8837
+ return this.resizable(false);
8838
+ };
8839
+
8840
+ SplitterPanel.prototype.data = function(data) {
8841
+ this.$description.data = data;
8842
+ return this;
8843
+ };
8844
+
8845
+ SplitterPanel.prototype.render = function(renderFn) {
8846
+ this.$description.render = renderFn;
8847
+ return this;
8848
+ };
8849
+
8822
8850
  function Stepper(config = {}) {
8823
8851
  if(!(this instanceof Stepper)) {
8824
8852
  return new Stepper(config);