native-document 1.0.115 → 1.0.117

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.
@@ -773,21 +773,6 @@ var NativeComponents = (function (exports) {
773
773
  return this.shadow('closed', style);
774
774
  };
775
775
 
776
- /**
777
- * Attaches a template binding to the element by hydrating it with the specified method.
778
- *
779
- * @param {string} methodName - Name of the hydration method to call
780
- * @param {BindingHydrator} bindingHydrator - Template binding with $hydrate method
781
- * @returns {HTMLElement} The underlying HTML element
782
- * @example
783
- * const onClick = $binder.attach((event, data) => console.log(data));
784
- * element.nd.attach('onClick', onClick);
785
- */
786
- NDElement.prototype.attach = function(methodName, bindingHydrator) {
787
- bindingHydrator.$hydrate(this.$element, methodName);
788
- return this.$element;
789
- };
790
-
791
776
  /**
792
777
  * Extends the current NDElement instance with custom methods.
793
778
  * Methods are bound to the instance and available for chaining.
@@ -1016,150 +1001,6 @@ var NativeComponents = (function (exports) {
1016
1001
  }
1017
1002
  };
1018
1003
 
1019
- function Anchor(name, isUniqueChild = false) {
1020
- const anchorFragment = document.createDocumentFragment();
1021
- anchorFragment.__Anchor__ = true;
1022
-
1023
- const anchorStart = document.createComment('Anchor Start : '+name);
1024
- const anchorEnd = document.createComment('/ Anchor End '+name);
1025
-
1026
- anchorFragment.appendChild(anchorStart);
1027
- anchorFragment.appendChild(anchorEnd);
1028
-
1029
- anchorFragment.nativeInsertBefore = anchorFragment.insertBefore;
1030
- anchorFragment.nativeAppendChild = anchorFragment.appendChild;
1031
- anchorFragment.nativeAppend = anchorFragment.append;
1032
-
1033
- const isParentUniqueChild = isUniqueChild
1034
- ? () => true
1035
- : (parent) => (parent.firstChild === anchorStart && parent.lastChild === anchorEnd);
1036
-
1037
- const insertBefore = function(parent, child, target) {
1038
- const childElement = Validator.isElement(child) ? child : ElementCreator.getChild(child);
1039
- if(parent === anchorFragment) {
1040
- parent.nativeInsertBefore(childElement, target);
1041
- return;
1042
- }
1043
- if(isParentUniqueChild(parent) && target === anchorEnd) {
1044
- parent.append(childElement, target);
1045
- return;
1046
- }
1047
- parent.insertBefore(childElement, target);
1048
- };
1049
-
1050
- anchorFragment.appendElement = function(child, before = null) {
1051
- const parentNode = anchorStart.parentNode;
1052
- const targetBefore = before || anchorEnd;
1053
- if(parentNode === anchorFragment) {
1054
- parentNode.nativeInsertBefore(child, targetBefore);
1055
- return;
1056
- }
1057
- parentNode?.insertBefore(child, targetBefore);
1058
- };
1059
-
1060
- anchorFragment.appendChild = function(child, before = null) {
1061
- const parent = anchorEnd.parentNode;
1062
- if(!parent) {
1063
- DebugManager.error('Anchor', 'Anchor : parent not found', child);
1064
- return;
1065
- }
1066
- before = before ?? anchorEnd;
1067
- insertBefore(parent, child, before);
1068
- };
1069
-
1070
- anchorFragment.append = function(...args ) {
1071
- return anchorFragment.appendChild(args);
1072
- };
1073
-
1074
- anchorFragment.removeChildren = function() {
1075
- const parent = anchorEnd.parentNode;
1076
- if(parent === anchorFragment) {
1077
- return;
1078
- }
1079
- if(isParentUniqueChild(parent)) {
1080
- parent.replaceChildren(anchorStart, anchorEnd);
1081
- return;
1082
- }
1083
-
1084
- let itemToRemove = anchorStart.nextSibling, tempItem;
1085
- while(itemToRemove && itemToRemove !== anchorEnd) {
1086
- tempItem = itemToRemove.nextSibling;
1087
- itemToRemove.remove();
1088
- itemToRemove = tempItem;
1089
- }
1090
- };
1091
-
1092
- anchorFragment.remove = function() {
1093
- const parent = anchorEnd.parentNode;
1094
- if(parent === anchorFragment) {
1095
- return;
1096
- }
1097
- if(isParentUniqueChild(parent)) {
1098
- parent.replaceChildren(anchorStart, anchorEnd);
1099
- return;
1100
- }
1101
- let itemToRemove = anchorStart.nextSibling, tempItem;
1102
- while(itemToRemove && itemToRemove !== anchorEnd) {
1103
- tempItem = itemToRemove.nextSibling;
1104
- anchorFragment.nativeAppend(itemToRemove);
1105
- itemToRemove = tempItem;
1106
- }
1107
- };
1108
-
1109
- anchorFragment.removeWithAnchors = function() {
1110
- anchorFragment.removeChildren();
1111
- anchorStart.remove();
1112
- anchorEnd.remove();
1113
- };
1114
-
1115
- anchorFragment.replaceContent = function(child) {
1116
- const childElement = Validator.isElement(child) ? child : ElementCreator.getChild(child);
1117
- const parent = anchorEnd.parentNode;
1118
- if(!parent) {
1119
- return;
1120
- }
1121
- if(isParentUniqueChild(parent)) {
1122
- parent.replaceChildren(anchorStart, childElement, anchorEnd);
1123
- return;
1124
- }
1125
- anchorFragment.removeChildren();
1126
- parent.insertBefore(childElement, anchorEnd);
1127
- };
1128
-
1129
- anchorFragment.setContent = anchorFragment.replaceContent;
1130
-
1131
- anchorFragment.insertBefore = function(child, anchor = null) {
1132
- anchorFragment.appendChild(child, anchor);
1133
- };
1134
-
1135
- anchorFragment.endElement = function() {
1136
- return anchorEnd;
1137
- };
1138
-
1139
- anchorFragment.startElement = function() {
1140
- return anchorStart;
1141
- };
1142
- anchorFragment.restore = function() {
1143
- anchorFragment.appendChild(anchorFragment);
1144
- };
1145
- anchorFragment.clear = anchorFragment.remove;
1146
- anchorFragment.detach = anchorFragment.remove;
1147
-
1148
- anchorFragment.getByIndex = function(index) {
1149
- let currentNode = anchorStart;
1150
- for(let i = 0; i <= index; i++) {
1151
- if(!currentNode.nextSibling) {
1152
- return null;
1153
- }
1154
- currentNode = currentNode.nextSibling;
1155
- }
1156
- return currentNode !== anchorStart ? currentNode : null;
1157
- };
1158
-
1159
- return anchorFragment;
1160
- }
1161
- DocumentFragment.prototype.setAttribute = () => {};
1162
-
1163
1004
  const BOOLEAN_ATTRIBUTES = new Set([
1164
1005
  'checked',
1165
1006
  'selected',
@@ -2793,7 +2634,6 @@ var NativeComponents = (function (exports) {
2793
2634
  bindAttributeWithObservable(element, attributeName, this);
2794
2635
  };
2795
2636
 
2796
- const $nodeCache = new Map();
2797
2637
  let $textNodeCache = null;
2798
2638
 
2799
2639
  const ElementCreator = {
@@ -2823,7 +2663,7 @@ var NativeComponents = (function (exports) {
2823
2663
  * @param {{$hydrate: Function}} item
2824
2664
  * @returns {Text}
2825
2665
  */
2826
- createHydratableNode(parent, item) {
2666
+ createHydratableNode: (parent, item) => {
2827
2667
  const text = ElementCreator.createTextNode();
2828
2668
  item.$hydrate(text);
2829
2669
  return text;
@@ -2835,7 +2675,7 @@ var NativeComponents = (function (exports) {
2835
2675
  * @param {*} value
2836
2676
  * @returns {Text}
2837
2677
  */
2838
- createStaticTextNode(parent, value) {
2678
+ createStaticTextNode: (parent, value) => {
2839
2679
  let text = ElementCreator.createTextNode();
2840
2680
  text.nodeValue = value;
2841
2681
  parent && parent.appendChild(text);
@@ -2847,15 +2687,10 @@ var NativeComponents = (function (exports) {
2847
2687
  * @returns {HTMLElement|DocumentFragment}
2848
2688
  */
2849
2689
  createElement: (name) => {
2850
- if(name) {
2851
- const cacheNode = $nodeCache.get(name);
2852
- if(cacheNode) {
2853
- return cacheNode.cloneNode();
2854
- }
2855
- const node = document.createElement(name);
2856
- $nodeCache.set(name, node);
2857
- return node.cloneNode();
2858
- }
2690
+ const node = document.createElement(name);
2691
+ return node.cloneNode();
2692
+ },
2693
+ createFragment: (name) => {
2859
2694
  return Anchor('Fragment');
2860
2695
  },
2861
2696
  bindTextNode: (textNode, value) => {
@@ -2871,9 +2706,9 @@ var NativeComponents = (function (exports) {
2871
2706
  * @param {*} children
2872
2707
  * @param {HTMLElement|DocumentFragment} parent
2873
2708
  */
2874
- processChildren(children, parent) {
2709
+ processChildren: (children, parent) => {
2875
2710
  if(children === null) return;
2876
- let child = this.getChild(children);
2711
+ let child = ElementCreator.getChild(children);
2877
2712
  if(child) {
2878
2713
  parent.appendChild(child);
2879
2714
  }
@@ -2917,97 +2752,241 @@ var NativeComponents = (function (exports) {
2917
2752
  processStyleAttribute: bindStyleAttribute,
2918
2753
  };
2919
2754
 
2920
- const EVENTS = [
2921
- "Click",
2922
- "DblClick",
2923
- "MouseDown",
2924
- "MouseEnter",
2925
- "MouseLeave",
2926
- "MouseMove",
2927
- "MouseOut",
2928
- "MouseOver",
2929
- "MouseUp",
2930
- "Wheel",
2931
- "KeyDown",
2932
- "KeyPress",
2933
- "KeyUp",
2934
- "Blur",
2935
- "Change",
2936
- "Focus",
2937
- "Input",
2938
- "Invalid",
2939
- "Reset",
2940
- "Search",
2941
- "Select",
2942
- "Submit",
2943
- "Drag",
2944
- "DragEnd",
2945
- "DragEnter",
2946
- "DragLeave",
2947
- "DragOver",
2948
- "DragStart",
2949
- "Drop",
2950
- "AfterPrint",
2951
- "BeforePrint",
2952
- "BeforeUnload",
2953
- "Error",
2954
- "HashChange",
2955
- "Load",
2956
- "Offline",
2957
- "Online",
2958
- "PageHide",
2959
- "PageShow",
2960
- "Resize",
2961
- "Scroll",
2962
- "Unload",
2963
- "Abort",
2964
- "CanPlay",
2965
- "CanPlayThrough",
2966
- "DurationChange",
2967
- "Emptied",
2968
- "Ended",
2969
- "LoadedData",
2970
- "LoadedMetadata",
2971
- "LoadStart",
2972
- "Pause",
2973
- "Play",
2974
- "Playing",
2975
- "Progress",
2976
- "RateChange",
2977
- "Seeked",
2978
- "Seeking",
2979
- "Stalled",
2980
- "Suspend",
2981
- "TimeUpdate",
2982
- "VolumeChange",
2983
- "Waiting",
2755
+ function Anchor(name, isUniqueChild = false) {
2756
+ const anchorFragment = document.createDocumentFragment();
2757
+ anchorFragment.__Anchor__ = true;
2984
2758
 
2985
- "TouchCancel",
2986
- "TouchEnd",
2987
- "TouchMove",
2988
- "TouchStart",
2989
- "AnimationEnd",
2990
- "AnimationIteration",
2991
- "AnimationStart",
2992
- "TransitionEnd",
2993
- "Copy",
2994
- "Cut",
2995
- "Paste",
2996
- "FocusIn",
2997
- "FocusOut",
2998
- "ContextMenu"
2999
- ];
2759
+ const anchorStart = document.createComment('Anchor Start : '+name);
2760
+ const anchorEnd = document.createComment('/ Anchor End '+name);
3000
2761
 
3001
- const EVENTS_WITH_PREVENT = [
3002
- "Click",
3003
- "DblClick",
3004
- "MouseDown",
3005
- "MouseUp",
3006
- "Wheel",
3007
- "KeyDown",
3008
- "KeyPress",
3009
- "Invalid",
3010
- "Reset",
2762
+ anchorFragment.appendChild(anchorStart);
2763
+ anchorFragment.appendChild(anchorEnd);
2764
+
2765
+ anchorFragment.nativeInsertBefore = anchorFragment.insertBefore;
2766
+ anchorFragment.nativeAppendChild = anchorFragment.appendChild;
2767
+ anchorFragment.nativeAppend = anchorFragment.append;
2768
+
2769
+ const isParentUniqueChild = isUniqueChild
2770
+ ? () => true
2771
+ : (parent) => (parent.firstChild === anchorStart && parent.lastChild === anchorEnd);
2772
+
2773
+ const insertBefore = function(parent, child, target) {
2774
+ const childElement = Validator.isElement(child) ? child : ElementCreator.getChild(child);
2775
+ if(parent === anchorFragment) {
2776
+ parent.nativeInsertBefore(childElement, target);
2777
+ return;
2778
+ }
2779
+ if(isParentUniqueChild(parent) && target === anchorEnd) {
2780
+ parent.append(childElement, target);
2781
+ return;
2782
+ }
2783
+ parent.insertBefore(childElement, target);
2784
+ };
2785
+
2786
+ anchorFragment.appendElement = function(child, before = null) {
2787
+ const parentNode = anchorStart.parentNode;
2788
+ const targetBefore = before || anchorEnd;
2789
+ if(parentNode === anchorFragment) {
2790
+ parentNode.nativeInsertBefore(child, targetBefore);
2791
+ return;
2792
+ }
2793
+ parentNode?.insertBefore(child, targetBefore);
2794
+ };
2795
+
2796
+ anchorFragment.appendChild = function(child, before = null) {
2797
+ const parent = anchorEnd.parentNode;
2798
+ if(!parent) {
2799
+ DebugManager.error('Anchor', 'Anchor : parent not found', child);
2800
+ return;
2801
+ }
2802
+ before = before ?? anchorEnd;
2803
+ insertBefore(parent, child, before);
2804
+ };
2805
+
2806
+ anchorFragment.append = function(...args ) {
2807
+ return anchorFragment.appendChild(args);
2808
+ };
2809
+
2810
+ anchorFragment.removeChildren = function() {
2811
+ const parent = anchorEnd.parentNode;
2812
+ if(parent === anchorFragment) {
2813
+ return;
2814
+ }
2815
+ if(isParentUniqueChild(parent)) {
2816
+ parent.replaceChildren(anchorStart, anchorEnd);
2817
+ return;
2818
+ }
2819
+
2820
+ let itemToRemove = anchorStart.nextSibling, tempItem;
2821
+ while(itemToRemove && itemToRemove !== anchorEnd) {
2822
+ tempItem = itemToRemove.nextSibling;
2823
+ itemToRemove.remove();
2824
+ itemToRemove = tempItem;
2825
+ }
2826
+ };
2827
+
2828
+ anchorFragment.remove = function() {
2829
+ const parent = anchorEnd.parentNode;
2830
+ if(parent === anchorFragment) {
2831
+ return;
2832
+ }
2833
+ if(isParentUniqueChild(parent)) {
2834
+ parent.replaceChildren(anchorStart, anchorEnd);
2835
+ return;
2836
+ }
2837
+ let itemToRemove = anchorStart.nextSibling, tempItem;
2838
+ while(itemToRemove && itemToRemove !== anchorEnd) {
2839
+ tempItem = itemToRemove.nextSibling;
2840
+ anchorFragment.nativeAppend(itemToRemove);
2841
+ itemToRemove = tempItem;
2842
+ }
2843
+ };
2844
+
2845
+ anchorFragment.removeWithAnchors = function() {
2846
+ anchorFragment.removeChildren();
2847
+ anchorStart.remove();
2848
+ anchorEnd.remove();
2849
+ };
2850
+
2851
+ anchorFragment.replaceContent = function(child) {
2852
+ const childElement = Validator.isElement(child) ? child : ElementCreator.getChild(child);
2853
+ const parent = anchorEnd.parentNode;
2854
+ if(!parent) {
2855
+ return;
2856
+ }
2857
+ if(isParentUniqueChild(parent)) {
2858
+ parent.replaceChildren(anchorStart, childElement, anchorEnd);
2859
+ return;
2860
+ }
2861
+ anchorFragment.removeChildren();
2862
+ parent.insertBefore(childElement, anchorEnd);
2863
+ };
2864
+
2865
+ anchorFragment.setContent = anchorFragment.replaceContent;
2866
+
2867
+ anchorFragment.insertBefore = function(child, anchor = null) {
2868
+ anchorFragment.appendChild(child, anchor);
2869
+ };
2870
+
2871
+ anchorFragment.endElement = function() {
2872
+ return anchorEnd;
2873
+ };
2874
+
2875
+ anchorFragment.startElement = function() {
2876
+ return anchorStart;
2877
+ };
2878
+ anchorFragment.restore = function() {
2879
+ anchorFragment.appendChild(anchorFragment);
2880
+ };
2881
+ anchorFragment.clear = anchorFragment.remove;
2882
+ anchorFragment.detach = anchorFragment.remove;
2883
+
2884
+ anchorFragment.getByIndex = function(index) {
2885
+ let currentNode = anchorStart;
2886
+ for(let i = 0; i <= index; i++) {
2887
+ if(!currentNode.nextSibling) {
2888
+ return null;
2889
+ }
2890
+ currentNode = currentNode.nextSibling;
2891
+ }
2892
+ return currentNode !== anchorStart ? currentNode : null;
2893
+ };
2894
+
2895
+ return anchorFragment;
2896
+ }
2897
+ DocumentFragment.prototype.setAttribute = () => {};
2898
+
2899
+ const EVENTS = [
2900
+ "Click",
2901
+ "DblClick",
2902
+ "MouseDown",
2903
+ "MouseEnter",
2904
+ "MouseLeave",
2905
+ "MouseMove",
2906
+ "MouseOut",
2907
+ "MouseOver",
2908
+ "MouseUp",
2909
+ "Wheel",
2910
+ "KeyDown",
2911
+ "KeyPress",
2912
+ "KeyUp",
2913
+ "Blur",
2914
+ "Change",
2915
+ "Focus",
2916
+ "Input",
2917
+ "Invalid",
2918
+ "Reset",
2919
+ "Search",
2920
+ "Select",
2921
+ "Submit",
2922
+ "Drag",
2923
+ "DragEnd",
2924
+ "DragEnter",
2925
+ "DragLeave",
2926
+ "DragOver",
2927
+ "DragStart",
2928
+ "Drop",
2929
+ "AfterPrint",
2930
+ "BeforePrint",
2931
+ "BeforeUnload",
2932
+ "Error",
2933
+ "HashChange",
2934
+ "Load",
2935
+ "Offline",
2936
+ "Online",
2937
+ "PageHide",
2938
+ "PageShow",
2939
+ "Resize",
2940
+ "Scroll",
2941
+ "Unload",
2942
+ "Abort",
2943
+ "CanPlay",
2944
+ "CanPlayThrough",
2945
+ "DurationChange",
2946
+ "Emptied",
2947
+ "Ended",
2948
+ "LoadedData",
2949
+ "LoadedMetadata",
2950
+ "LoadStart",
2951
+ "Pause",
2952
+ "Play",
2953
+ "Playing",
2954
+ "Progress",
2955
+ "RateChange",
2956
+ "Seeked",
2957
+ "Seeking",
2958
+ "Stalled",
2959
+ "Suspend",
2960
+ "TimeUpdate",
2961
+ "VolumeChange",
2962
+ "Waiting",
2963
+
2964
+ "TouchCancel",
2965
+ "TouchEnd",
2966
+ "TouchMove",
2967
+ "TouchStart",
2968
+ "AnimationEnd",
2969
+ "AnimationIteration",
2970
+ "AnimationStart",
2971
+ "TransitionEnd",
2972
+ "Copy",
2973
+ "Cut",
2974
+ "Paste",
2975
+ "FocusIn",
2976
+ "FocusOut",
2977
+ "ContextMenu"
2978
+ ];
2979
+
2980
+ const EVENTS_WITH_PREVENT = [
2981
+ "Click",
2982
+ "DblClick",
2983
+ "MouseDown",
2984
+ "MouseUp",
2985
+ "Wheel",
2986
+ "KeyDown",
2987
+ "KeyPress",
2988
+ "Invalid",
2989
+ "Reset",
3011
2990
  "Submit",
3012
2991
  "DragOver",
3013
2992
  "Drop",
@@ -3211,32 +3190,187 @@ var NativeComponents = (function (exports) {
3211
3190
  let withValidation = (fn) => fn;
3212
3191
 
3213
3192
  const normalizeComponentArgs = function(props, children = null) {
3214
- if(Array.isArray(props) || typeof props !== 'object' || props === null || props.constructor.name !== 'Object' || props.$hydrate) { // IF it's not a JSON
3193
+ if(props && children) {
3194
+ return { props, children };
3195
+ }
3196
+ if(typeof props !== 'object' || Array.isArray(props) || props === null || props.constructor.name !== 'Object' || props.$hydrate) { // IF it's not a JSON
3215
3197
  return { props: children, children: props }
3216
3198
  }
3217
- return { props, children };
3199
+ return { props, children };
3200
+ };
3201
+
3202
+ /**
3203
+ *
3204
+ * @param {*} value
3205
+ * @returns {Text}
3206
+ */
3207
+ const createTextNode = (value) => {
3208
+ return (Validator.isObservable(value))
3209
+ ? ElementCreator.createObservableNode(null, value)
3210
+ : ElementCreator.createStaticTextNode(null, value);
3211
+ };
3212
+
3213
+
3214
+ const createHtmlElement = (element, _attributes, _children = null) => {
3215
+ let { props: attributes, children = null } = normalizeComponentArgs(_attributes, _children);
3216
+
3217
+ ElementCreator.processAttributes(element, attributes);
3218
+ ElementCreator.processChildren(children, element);
3219
+ return element;
3220
+ };
3221
+
3222
+ /**
3223
+ *
3224
+ * @param {string} name
3225
+ * @param {?Function=} customWrapper
3226
+ * @returns {Function}
3227
+ */
3228
+ function HtmlElementWrapper(name, customWrapper = null) {
3229
+ if(name) {
3230
+ if(customWrapper) {
3231
+ let node = null;
3232
+ let createElement = (attr, children) => {
3233
+ node = document.createElement(name);
3234
+ createElement = (attr, children) => {
3235
+ return createHtmlElement(customWrapper(node.cloneNode()), attr, children);
3236
+ };
3237
+ return createHtmlElement(customWrapper(node.cloneNode()), attr, children); };
3238
+
3239
+ return (attr, children) => createElement(attr, children)
3240
+ }
3241
+
3242
+ let node = null;
3243
+ let createElement = (attr, children) => {
3244
+ node = document.createElement(name);
3245
+ createElement = (attr, children) => {
3246
+ return createHtmlElement(node.cloneNode(), attr, children);
3247
+ };
3248
+ return createHtmlElement(node.cloneNode(), attr, children);
3249
+ };
3250
+
3251
+ return (attr, children) => createElement(attr, children)
3252
+ }
3253
+ return () => Anchor('');
3254
+ }
3255
+
3256
+ function NodeCloner($element) {
3257
+ this.$element = $element;
3258
+ this.$classes = null;
3259
+ this.$styles = null;
3260
+ this.$attrs = null;
3261
+ this.$ndMethods = null;
3262
+ }
3263
+
3264
+
3265
+ /**
3266
+ * Attaches a template binding to the element by hydrating it with the specified method.
3267
+ *
3268
+ * @param {string} methodName - Name of the hydration method to call
3269
+ * @param {BindingHydrator} bindingHydrator - Template binding with $hydrate method
3270
+ * @returns {HTMLElement} The underlying HTML element
3271
+ * @example
3272
+ * const onClick = $binder.attach((event, data) => console.log(data));
3273
+ * element.nd.attach('onClick', onClick);
3274
+ */
3275
+ NDElement.prototype.attach = function(methodName, bindingHydrator) {
3276
+ if(typeof bindingHydrator === 'function') {
3277
+ const element = this.$element;
3278
+ element.nodeCloner = element.nodeCloner || new NodeCloner(element);
3279
+ element.nodeCloner.attach(methodName, bindingHydrator);
3280
+ return element;
3281
+ }
3282
+ bindingHydrator.$hydrate(this.$element, methodName);
3283
+ return this.$element;
3284
+ };
3285
+
3286
+ NodeCloner.prototype.__$isNodeCloner = true;
3287
+
3288
+ const buildProperties = (cache, properties, data) => {
3289
+ for(const key in properties) {
3290
+ cache[key] = properties[key].apply(null, data);
3291
+ }
3292
+ return cache;
3293
+ };
3294
+
3295
+ NodeCloner.prototype.resolve = function() {
3296
+ if(this.$content) {
3297
+ return;
3298
+ }
3299
+ const steps = [];
3300
+ if(this.$ndMethods) {
3301
+ steps.push((clonedNode, data) => {
3302
+ for(const methodName in this.$ndMethods) {
3303
+ clonedNode.nd[methodName](this.$ndMethods[methodName].bind(clonedNode, ...data));
3304
+ }
3305
+ });
3306
+ }
3307
+ if(this.$classes) {
3308
+ const cache = {};
3309
+ steps.push((clonedNode, data) => {
3310
+ ElementCreator.processClassAttribute(clonedNode, buildProperties(cache, this.$classes, data));
3311
+ });
3312
+ }
3313
+ if(this.$styles) {
3314
+ const cache = {};
3315
+ steps.push((clonedNode, data) => {
3316
+ ElementCreator.processStyleAttribute(clonedNode, buildProperties(cache, this.$styles, data));
3317
+ });
3318
+ }
3319
+ if(this.$attrs) {
3320
+ const cache = {};
3321
+ steps.push((clonedNode, data) => {
3322
+ ElementCreator.processAttributes(clonedNode, buildProperties(cache, this.$attrs, data));
3323
+ });
3324
+ }
3325
+
3326
+ const stepsCount = steps.length;
3327
+ const $element = this.$element;
3328
+
3329
+ this.cloneNode = (data) => {
3330
+ const clonedNode = $element.cloneNode(false);
3331
+ for(let i = 0; i < stepsCount; i++) {
3332
+ steps[i](clonedNode, data);
3333
+ }
3334
+ return clonedNode;
3335
+ };
3336
+ };
3337
+
3338
+ NodeCloner.prototype.cloneNode = function(data) {
3339
+ return this.$element.cloneNode(false);
3340
+ };
3341
+
3342
+ NodeCloner.prototype.attach = function(methodName, callback) {
3343
+ this.$ndMethods = this.$ndMethods || {};
3344
+ this.$ndMethods[methodName] = callback;
3345
+ return this;
3346
+ };
3347
+
3348
+ NodeCloner.prototype.text = function(value) {
3349
+ this.$content = value;
3350
+ if(typeof value === 'function') {
3351
+ this.cloneNode = (data) => createTextNode(value.apply(null, data));
3352
+ return this;
3353
+ }
3354
+ this.cloneNode = (data) => createTextNode(data[0][value]);
3355
+ return this;
3356
+ };
3357
+
3358
+ NodeCloner.prototype.attr = function(attrName, value) {
3359
+ if(attrName === 'class') {
3360
+ this.$classes = this.$classes || {};
3361
+ this.$classes[value.property] = value.value;
3362
+ return this;
3363
+ }
3364
+ if(attrName === 'style') {
3365
+ this.$styles = this.$styles || {};
3366
+ this.$styles[value.property] = value.value;
3367
+ return this;
3368
+ }
3369
+ this.$attrs = this.$attrs || {};
3370
+ this.$attrs[attrName] = value.value;
3371
+ return this;
3218
3372
  };
3219
3373
 
3220
- function createHtmlElement($tagName, customWrapper, _attributes, _children = null) {
3221
- let { props: attributes, children = null } = normalizeComponentArgs(_attributes, _children);
3222
- let element = ElementCreator.createElement($tagName);
3223
- let finalElement = (customWrapper && typeof customWrapper === 'function') ? customWrapper(element) : element;
3224
-
3225
- ElementCreator.processAttributes(finalElement, attributes);
3226
- ElementCreator.processChildren(children, finalElement);
3227
- return finalElement;
3228
- }
3229
-
3230
- /**
3231
- *
3232
- * @param {string} name
3233
- * @param {?Function=} customWrapper
3234
- * @returns {Function}
3235
- */
3236
- function HtmlElementWrapper(name, customWrapper = null) {
3237
- return createHtmlElement.bind(null, name, customWrapper);
3238
- }
3239
-
3240
3374
  DocumentFragment.prototype.__IS_FRAGMENT = true;
3241
3375
 
3242
3376
  Function.prototype.args = function(...args) {
@@ -4001,501 +4135,18 @@ var NativeComponents = (function (exports) {
4001
4135
  return observable;
4002
4136
  };
4003
4137
 
4004
- /**
4005
- * Creates a `<div>` element.
4006
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLDivElement}
4007
- */
4008
- HtmlElementWrapper('div');
4009
-
4010
- /**
4011
- * Creates a `<span>` element.
4012
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLSpanElement}
4013
- */
4014
- HtmlElementWrapper('span');
4015
-
4016
- /**
4017
- * Creates a `<label>` element.
4018
- * @type {function(LabelAttributes=, NdChild|NdChild[]=): HTMLLabelElement}
4019
- */
4020
- HtmlElementWrapper('label');
4021
-
4022
- /**
4023
- * Creates a `<p>` element.
4024
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLParagraphElement}
4025
- */
4026
- HtmlElementWrapper('p');
4027
-
4028
- /**
4029
- * Creates a `<strong>` element.
4030
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4031
- */
4032
- HtmlElementWrapper('strong');
4033
-
4034
- /**
4035
- * Creates a `<h1>` element.
4036
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLHeadingElement}
4037
- */
4038
- HtmlElementWrapper('h1');
4039
-
4040
- /**
4041
- * Creates a `<h2>` element.
4042
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLHeadingElement}
4043
- */
4044
- HtmlElementWrapper('h2');
4045
-
4046
- /**
4047
- * Creates a `<h3>` element.
4048
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLHeadingElement}
4049
- */
4050
- HtmlElementWrapper('h3');
4051
-
4052
- /**
4053
- * Creates a `<h4>` element.
4054
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLHeadingElement}
4055
- */
4056
- HtmlElementWrapper('h4');
4057
-
4058
- /**
4059
- * Creates a `<h5>` element.
4060
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLHeadingElement}
4061
- */
4062
- HtmlElementWrapper('h5');
4063
-
4064
- /**
4065
- * Creates a `<h6>` element.
4066
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLHeadingElement}
4067
- */
4068
- HtmlElementWrapper('h6');
4069
-
4070
- /**
4071
- * Creates a `<br>` element.
4072
- * @type {function(GlobalAttributes=): HTMLBRElement}
4073
- */
4074
- HtmlElementWrapper('br');
4075
-
4076
- /**
4077
- * Creates an `<a>` element.
4078
- * @type {function(AnchorAttributes=, NdChild|NdChild[]=): HTMLAnchorElement}
4079
- */
4080
- HtmlElementWrapper('a');
4081
-
4082
- /**
4083
- * Creates a `<pre>` element.
4084
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLPreElement}
4085
- */
4086
- HtmlElementWrapper('pre');
4087
-
4088
- /**
4089
- * Creates a `<code>` element.
4090
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4091
- */
4092
- HtmlElementWrapper('code');
4093
-
4094
- /**
4095
- * Creates a `<blockquote>` element.
4096
- * @type {function(GlobalAttributes & { cite?: string }=, NdChild|NdChild[]=): HTMLQuoteElement}
4097
- */
4098
- HtmlElementWrapper('blockquote');
4099
-
4100
- /**
4101
- * Creates an `<hr>` element.
4102
- * @type {function(GlobalAttributes=): HTMLHRElement}
4103
- */
4104
- HtmlElementWrapper('hr');
4105
-
4106
- /**
4107
- * Creates an `<em>` element.
4108
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4109
- */
4110
- HtmlElementWrapper('em');
4111
-
4112
- /**
4113
- * Creates a `<small>` element.
4114
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4115
- */
4116
- HtmlElementWrapper('small');
4117
-
4118
- /**
4119
- * Creates a `<mark>` element.
4120
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4121
- */
4122
- HtmlElementWrapper('mark');
4123
-
4124
- /**
4125
- * Creates a `<del>` element.
4126
- * @type {function(ModAttributes=, NdChild|NdChild[]=): HTMLModElement}
4127
- */
4128
- HtmlElementWrapper('del');
4129
-
4130
- /**
4131
- * Creates an `<ins>` element.
4132
- * @type {function(ModAttributes=, NdChild|NdChild[]=): HTMLModElement}
4133
- */
4134
- HtmlElementWrapper('ins');
4135
-
4136
- /**
4137
- * Creates a `<sub>` element.
4138
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4139
- */
4140
- HtmlElementWrapper('sub');
4141
-
4142
- /**
4143
- * Creates a `<sup>` element.
4144
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4145
- */
4146
- HtmlElementWrapper('sup');
4147
-
4148
- /**
4149
- * Creates an `<abbr>` element.
4150
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4151
- */
4152
- HtmlElementWrapper('abbr');
4153
-
4154
- /**
4155
- * Creates a `<cite>` element.
4156
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4157
- */
4158
- HtmlElementWrapper('cite');
4159
-
4160
- /**
4161
- * Creates a `<q>` element.
4162
- * @type {function(GlobalAttributes & { cite?: string }=, NdChild|NdChild[]=): HTMLQuoteElement}
4163
- */
4164
- HtmlElementWrapper('q');
4165
-
4166
- /**
4167
- * Creates a `<dl>` element.
4168
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLDListElement}
4169
- */
4170
- HtmlElementWrapper('dl');
4171
-
4172
- /**
4173
- * Creates a `<dt>` element.
4174
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4175
- */
4176
- HtmlElementWrapper('dt');
4177
-
4178
- /**
4179
- * Creates a `<dd>` element.
4180
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4181
- */
4182
- HtmlElementWrapper('dd');
4183
-
4184
- /**
4185
- * Creates a `<form>` element.
4186
- * Extended with fluent methods: `.submit()`, `.post()`, `.get()`, `.multipartFormData()`.
4187
- * @type {function(FormAttributes=, NdChild|NdChild[]=): HTMLFormElement & {
4188
- * submit: (actionOrFn: string | ((e: SubmitEvent) => void)) => HTMLFormElement,
4189
- * post: (action: string) => HTMLFormElement,
4190
- * get: (action: string) => HTMLFormElement,
4191
- * multipartFormData: () => HTMLFormElement,
4192
- * }}
4193
- */
4194
- HtmlElementWrapper('form', function(el) {
4195
-
4196
- el.submit = function(action) {
4197
- if(typeof action === 'function') {
4198
- el.onSubmit((e) => {
4199
- e.preventDefault();
4200
- action(e);
4201
- });
4202
- return el;
4203
- }
4204
- this.setAttribute('action', action);
4205
- return el;
4206
- };
4207
- el.multipartFormData = function() {
4208
- this.setAttribute('enctype', 'multipart/form-data');
4209
- return el;
4210
- };
4211
- el.post = function(action) {
4212
- this.setAttribute('method', 'post');
4213
- this.setAttribute('action', action);
4214
- return el;
4215
- };
4216
- el.get = function(action) {
4217
- this.setAttribute('method', 'get');
4218
- this.setAttribute('action', action);
4219
- };
4220
- return el;
4221
- });
4222
-
4223
- /**
4224
- * Creates an `<input>` element.
4225
- * @type {function(InputAttributes=): HTMLInputElement}
4226
- */
4227
- HtmlElementWrapper('input');
4228
-
4229
- /**
4230
- * Creates a `<textarea>` element.
4231
- * @type {function(TextAreaAttributes=, NdChild|NdChild[]=): HTMLTextAreaElement}
4232
- */
4233
- HtmlElementWrapper('textarea');
4234
-
4235
- /**
4236
- * Creates a `<select>` element.
4237
- * @type {function(SelectAttributes=, NdChild|NdChild[]=): HTMLSelectElement}
4238
- */
4239
- HtmlElementWrapper('select');
4240
-
4241
- /**
4242
- * Creates a `<fieldset>` element.
4243
- * @type {function(GlobalAttributes & { disabled?: Observable<boolean>|boolean }=, NdChild|NdChild[]=): HTMLFieldSetElement}
4244
- */
4245
- HtmlElementWrapper('fieldset');
4246
-
4247
- /**
4248
- * Creates an `<option>` element.
4249
- * @type {function(OptionAttributes=, NdChild|NdChild[]=): HTMLOptionElement}
4250
- */
4251
- HtmlElementWrapper('option');
4252
-
4253
- /**
4254
- * Creates a `<legend>` element.
4255
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLLegendElement}
4256
- */
4257
- HtmlElementWrapper('legend');
4258
-
4259
- /**
4260
- * Creates a `<datalist>` element.
4261
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLDataListElement}
4262
- */
4263
- HtmlElementWrapper('datalist');
4264
-
4265
- /**
4266
- * Creates an `<output>` element.
4267
- * @type {function(OutputAttributes=, NdChild|NdChild[]=): HTMLOutputElement}
4268
- */
4269
- HtmlElementWrapper('output');
4270
-
4271
- /**
4272
- * Creates a `<progress>` element.
4273
- * @type {function(ProgressAttributes=, NdChild|NdChild[]=): HTMLProgressElement}
4274
- */
4275
- HtmlElementWrapper('progress');
4276
-
4277
- /**
4278
- * Creates a `<meter>` element.
4279
- * @type {function(MeterAttributes=, NdChild|NdChild[]=): HTMLMeterElement}
4280
- */
4281
- HtmlElementWrapper('meter');
4282
-
4283
4138
  /**
4284
4139
  * Creates a `<button>` element.
4285
4140
  * @type {function(ButtonAttributes=, NdChild|NdChild[]=): HTMLButtonElement}
4286
4141
  */
4287
4142
  const Button$1 = HtmlElementWrapper('button');
4288
4143
 
4289
- /**
4290
- * Creates a `<main>` element.
4291
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4292
- */
4293
- HtmlElementWrapper('main');
4294
-
4295
- /**
4296
- * Creates a `<section>` element.
4297
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4298
- */
4299
- HtmlElementWrapper('section');
4300
-
4301
- /**
4302
- * Creates an `<article>` element.
4303
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4304
- */
4305
- HtmlElementWrapper('article');
4306
-
4307
- /**
4308
- * Creates an `<aside>` element.
4309
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4310
- */
4311
- HtmlElementWrapper('aside');
4312
-
4313
- /**
4314
- * Creates a `<nav>` element.
4315
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4316
- */
4317
- HtmlElementWrapper('nav');
4318
-
4319
- /**
4320
- * Creates a `<figure>` element.
4321
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4322
- */
4323
- HtmlElementWrapper('figure');
4324
-
4325
- /**
4326
- * Creates a `<figcaption>` element.
4327
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4328
- */
4329
- HtmlElementWrapper('figcaption');
4330
-
4331
- /**
4332
- * Creates a `<header>` element.
4333
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4334
- */
4335
- HtmlElementWrapper('header');
4336
-
4337
- /**
4338
- * Creates a `<footer>` element.
4339
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4340
- */
4341
- HtmlElementWrapper('footer');
4342
-
4343
- /**
4344
- * Creates an `<img>` element.
4345
- * @type {function(ImgAttributes=): HTMLImageElement}
4346
- */
4347
- HtmlElementWrapper('img');
4348
-
4349
- /**
4350
- * Creates a `<details>` element.
4351
- * @type {function(DetailsAttributes=, NdChild|NdChild[]=): HTMLDetailsElement}
4352
- */
4353
- HtmlElementWrapper('details');
4354
-
4355
- /**
4356
- * Creates a `<summary>` element.
4357
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4358
- */
4359
- HtmlElementWrapper('summary');
4360
-
4361
- /**
4362
- * Creates a `<dialog>` element.
4363
- * @type {function(DialogAttributes=, NdChild|NdChild[]=): HTMLDialogElement}
4364
- */
4365
- HtmlElementWrapper('dialog');
4366
-
4367
- /**
4368
- * Creates a `<menu>` element.
4369
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLMenuElement}
4370
- */
4371
- HtmlElementWrapper('menu');
4372
-
4373
- /**
4374
- * Creates an `<ol>` element.
4375
- * @type {function(OlAttributes=, NdChild|NdChild[]=): HTMLOListElement}
4376
- */
4377
- HtmlElementWrapper('ol');
4378
-
4379
- /**
4380
- * Creates a `<ul>` element.
4381
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLUListElement}
4382
- */
4383
- HtmlElementWrapper('ul');
4384
-
4385
- /**
4386
- * Creates a `<li>` element.
4387
- * @type {function(GlobalAttributes & { value?: number }=, NdChild|NdChild[]=): HTMLLIElement}
4388
- */
4389
- HtmlElementWrapper('li');
4390
-
4391
- /**
4392
- * Creates an `<audio>` element.
4393
- * @type {function(AudioAttributes=, NdChild|NdChild[]=): HTMLAudioElement}
4394
- */
4395
- HtmlElementWrapper('audio');
4396
-
4397
- /**
4398
- * Creates a `<video>` element.
4399
- * @type {function(VideoAttributes=, NdChild|NdChild[]=): HTMLVideoElement}
4400
- */
4401
- HtmlElementWrapper('video');
4402
-
4403
- /**
4404
- * Creates a `<source>` element.
4405
- * @type {function(SourceAttributes=): HTMLSourceElement}
4406
- */
4407
- HtmlElementWrapper('source');
4408
-
4409
- /**
4410
- * Creates a `<track>` element.
4411
- * @type {function(TrackAttributes=): HTMLTrackElement}
4412
- */
4413
- HtmlElementWrapper('track');
4414
-
4415
- /**
4416
- * Creates a `<canvas>` element.
4417
- * @type {function(CanvasAttributes=, NdChild|NdChild[]=): HTMLCanvasElement}
4418
- */
4419
- HtmlElementWrapper('canvas');
4420
-
4421
- /**
4422
- * Creates an `<svg>` element.
4423
- * @type {function(SvgAttributes=, NdChild|NdChild[]=): SVGSVGElement}
4424
- */
4425
- HtmlElementWrapper('svg');
4426
-
4427
- /**
4428
- * Creates a `<time>` element.
4429
- * @type {function(TimeAttributes=, NdChild|NdChild[]=): HTMLTimeElement}
4430
- */
4431
- HtmlElementWrapper('time');
4432
-
4433
- /**
4434
- * Creates a `<data>` element.
4435
- * @type {function(GlobalAttributes & { value?: Observable<string>|string }=, NdChild|NdChild[]=): HTMLDataElement}
4436
- */
4437
- HtmlElementWrapper('data');
4438
-
4439
- /**
4440
- * Creates an `<address>` element.
4441
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4442
- */
4443
- HtmlElementWrapper('address');
4444
-
4445
- /**
4446
- * Creates a `<kbd>` element.
4447
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4448
- */
4449
- HtmlElementWrapper('kbd');
4450
-
4451
- /**
4452
- * Creates a `<samp>` element.
4453
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4454
- */
4455
- HtmlElementWrapper('samp');
4456
-
4457
- /**
4458
- * Creates a `<var>` element.
4459
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLElement}
4460
- */
4461
- HtmlElementWrapper('var');
4462
-
4463
- /**
4464
- * Creates a `<wbr>` element.
4465
- * @type {function(GlobalAttributes=): HTMLElement}
4466
- */
4467
- HtmlElementWrapper('wbr');
4468
-
4469
- /**
4470
- * Creates a `<caption>` element.
4471
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLTableCaptionElement}
4472
- */
4473
- HtmlElementWrapper('caption');
4474
-
4475
4144
  /**
4476
4145
  * Creates a `<table>` element.
4477
4146
  * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLTableElement}
4478
4147
  */
4479
4148
  const Table = HtmlElementWrapper('table');
4480
4149
 
4481
- /**
4482
- * Creates a `<thead>` element.
4483
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLTableSectionElement}
4484
- */
4485
- HtmlElementWrapper('thead');
4486
-
4487
- /**
4488
- * Creates a `<tfoot>` element.
4489
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLTableSectionElement}
4490
- */
4491
- HtmlElementWrapper('tfoot');
4492
-
4493
- /**
4494
- * Creates a `<tbody>` element.
4495
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLTableSectionElement}
4496
- */
4497
- HtmlElementWrapper('tbody');
4498
-
4499
4150
  /**
4500
4151
  * Creates a `<tr>` element.
4501
4152
  * @type {function(GlobalAttributes=, NdChild|NdChild[]=): HTMLTableRowElement}
@@ -4520,19 +4171,6 @@ var NativeComponents = (function (exports) {
4520
4171
  */
4521
4172
  const THeadCell$1 = Th;
4522
4173
 
4523
- /**
4524
- * Creates a `<td>` element.
4525
- * @type {function(TdAttributes=, NdChild|NdChild[]=): HTMLTableCellElement}
4526
- */
4527
- HtmlElementWrapper('td');
4528
-
4529
- /**
4530
- * Creates an empty `DocumentFragment` wrapper.
4531
- * Useful for grouping elements without adding a DOM node.
4532
- * @type {function(GlobalAttributes=, NdChild|NdChild[]=): DocumentFragment}
4533
- */
4534
- HtmlElementWrapper('');
4535
-
4536
4174
  /**
4537
4175
  * Represents an individual item within an Accordion component
4538
4176
  * @param {{ id?: string|number, title?: string, icon?: string, collapsible?: boolean, content?: ValidChildren, renderHeader?: Function, renderContent?: Function, render?: Function, expanded?: Observable<boolean>, disabled?: boolean }} config - Configuration object