native-document 1.0.124 → 1.0.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/native-document.components.min.js +53 -16
- package/dist/native-document.dev.js +33 -22
- package/dist/native-document.dev.js.map +1 -1
- package/dist/native-document.min.js +1 -1
- package/package.json +1 -1
- package/src/components/BaseComponent.js +1 -1
- package/src/components/context-menu/ContextMenu.js +1 -1
- package/src/components/menu/Menu.js +5 -0
- package/src/components/menu/MenuDivider.js +1 -1
- package/src/components/menu/MenuItem.js +20 -0
- package/src/core/elements/anchor/anchor-with-sentinel.js +5 -1
- package/src/core/elements/anchor/anchor.js +2 -5
- package/src/core/elements/control/for-each-array.js +6 -9
- package/src/core/wrappers/DocumentObserver.js +13 -6
- package/src/core/wrappers/HtmlElementWrapper.js +5 -1
- package/src/router/RouterComponent.js +2 -0
- package/src/ui/components/button/Button.js +8 -0
- package/src/ui/components/button/button.css +0 -0
- package/src/ui/index.js +0 -0
- package/src/ui/theme.js +5 -0
- package/src/ui/tokens/vars.css +0 -0
|
@@ -14,7 +14,7 @@ var NativeComponents = (function (exports) {
|
|
|
14
14
|
if(this.$element) {
|
|
15
15
|
return this.$element.nd;
|
|
16
16
|
}
|
|
17
|
-
this.$storeElement(this.
|
|
17
|
+
this.$storeElement(this.toNdElement());
|
|
18
18
|
return this.$element?.nd;
|
|
19
19
|
}
|
|
20
20
|
});
|
|
@@ -474,6 +474,16 @@ var NativeComponents = (function (exports) {
|
|
|
474
474
|
unmounted: new WeakMap(),
|
|
475
475
|
unmountedSupposedSize: 0,
|
|
476
476
|
observer: null,
|
|
477
|
+
initObserver: () => {
|
|
478
|
+
if(DocumentObserver.observer) {
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
DocumentObserver.observer = new MutationObserver(DocumentObserver.checkMutation);
|
|
482
|
+
DocumentObserver.observer.observe(document.body, {
|
|
483
|
+
childList: true,
|
|
484
|
+
subtree: true,
|
|
485
|
+
});
|
|
486
|
+
},
|
|
477
487
|
|
|
478
488
|
executeMountedCallback(node) {
|
|
479
489
|
const data = DocumentObserver.mounted.get(node);
|
|
@@ -521,6 +531,7 @@ var NativeComponents = (function (exports) {
|
|
|
521
531
|
},
|
|
522
532
|
|
|
523
533
|
checkMutation: function(mutationsList) {
|
|
534
|
+
console.log('mutationsList', mutationsList);
|
|
524
535
|
for(const mutation of mutationsList) {
|
|
525
536
|
if(DocumentObserver.mountedSupposedSize > 0) {
|
|
526
537
|
for(const node of mutation.addedNodes) {
|
|
@@ -559,6 +570,8 @@ var NativeComponents = (function (exports) {
|
|
|
559
570
|
let mountedRegistered = false;
|
|
560
571
|
let unmountedRegistered = false;
|
|
561
572
|
|
|
573
|
+
DocumentObserver.initObserver();
|
|
574
|
+
|
|
562
575
|
let data = {
|
|
563
576
|
inDom,
|
|
564
577
|
mounted: null,
|
|
@@ -636,12 +649,6 @@ var NativeComponents = (function (exports) {
|
|
|
636
649
|
}
|
|
637
650
|
};
|
|
638
651
|
|
|
639
|
-
DocumentObserver.observer = new MutationObserver(DocumentObserver.checkMutation);
|
|
640
|
-
DocumentObserver.observer.observe(document.body, {
|
|
641
|
-
childList: true,
|
|
642
|
-
subtree: true,
|
|
643
|
-
});
|
|
644
|
-
|
|
645
652
|
function NDElement(element) {
|
|
646
653
|
this.$element = element;
|
|
647
654
|
}
|
|
@@ -2354,9 +2361,11 @@ var NativeComponents = (function (exports) {
|
|
|
2354
2361
|
function AnchorWithSentinel(name) {
|
|
2355
2362
|
const instance = Reflect.construct(DocumentFragment, [], AnchorWithSentinel);
|
|
2356
2363
|
const sentinel = document.createComment((name || '') + ' Anchor Sentinel');
|
|
2364
|
+
const anchorStart = document.createComment('Anchor Start : '+name);
|
|
2365
|
+
const anchorEnd = document.createComment('/ Anchor End '+name);
|
|
2357
2366
|
const events = {};
|
|
2358
2367
|
|
|
2359
|
-
instance.
|
|
2368
|
+
instance.append(anchorStart, sentinel, anchorEnd);
|
|
2360
2369
|
|
|
2361
2370
|
const observer = new MutationObserver(() => {
|
|
2362
2371
|
if (sentinel.parentNode !== instance && !(sentinel.parentNode instanceof DocumentFragment)) {
|
|
@@ -2368,6 +2377,8 @@ var NativeComponents = (function (exports) {
|
|
|
2368
2377
|
|
|
2369
2378
|
|
|
2370
2379
|
instance.$sentinel = sentinel;
|
|
2380
|
+
instance.$start = anchorStart;
|
|
2381
|
+
instance.$end = anchorEnd;
|
|
2371
2382
|
instance.$observer = observer;
|
|
2372
2383
|
instance.$events = events;
|
|
2373
2384
|
|
|
@@ -2471,11 +2482,8 @@ var NativeComponents = (function (exports) {
|
|
|
2471
2482
|
|
|
2472
2483
|
anchorFragment.__Anchor__ = true;
|
|
2473
2484
|
|
|
2474
|
-
const anchorStart =
|
|
2475
|
-
const anchorEnd =
|
|
2476
|
-
|
|
2477
|
-
anchorFragment.appendChild(anchorStart);
|
|
2478
|
-
anchorFragment.appendChild(anchorEnd);
|
|
2485
|
+
const anchorStart = anchorFragment.$start;
|
|
2486
|
+
const anchorEnd = anchorFragment.$end;
|
|
2479
2487
|
|
|
2480
2488
|
anchorFragment.nativeInsertBefore = anchorFragment.insertBefore;
|
|
2481
2489
|
anchorFragment.nativeAppendChild = anchorFragment.appendChild;
|
|
@@ -2999,7 +3007,11 @@ var NativeComponents = (function (exports) {
|
|
|
2999
3007
|
|
|
3000
3008
|
return (attr, children) => createElement(attr, children)
|
|
3001
3009
|
}
|
|
3002
|
-
return (
|
|
3010
|
+
return (children, name = '') => {
|
|
3011
|
+
const anchor = Anchor(name);
|
|
3012
|
+
anchor.append(children);
|
|
3013
|
+
return anchor;
|
|
3014
|
+
};
|
|
3003
3015
|
}
|
|
3004
3016
|
|
|
3005
3017
|
function NodeCloner($element) {
|
|
@@ -5800,7 +5812,7 @@ var NativeComponents = (function (exports) {
|
|
|
5800
5812
|
};
|
|
5801
5813
|
|
|
5802
5814
|
function MenuDivider() {
|
|
5803
|
-
if(!this instanceof MenuDivider) {
|
|
5815
|
+
if(!(this instanceof MenuDivider)) {
|
|
5804
5816
|
return new MenuDivider();
|
|
5805
5817
|
}
|
|
5806
5818
|
|
|
@@ -5882,6 +5894,11 @@ var NativeComponents = (function (exports) {
|
|
|
5882
5894
|
Menu.defaultTemplate = template.menu;
|
|
5883
5895
|
};
|
|
5884
5896
|
|
|
5897
|
+
Menu.prototype.title = function(title) {
|
|
5898
|
+
this.$description.title = title;
|
|
5899
|
+
return this;
|
|
5900
|
+
};
|
|
5901
|
+
|
|
5885
5902
|
Menu.prototype.orientation = function(orientation) {
|
|
5886
5903
|
this.$description.orientation = orientation;
|
|
5887
5904
|
return this;
|
|
@@ -5936,7 +5953,7 @@ var NativeComponents = (function (exports) {
|
|
|
5936
5953
|
|
|
5937
5954
|
function ContextMenu(config = {}) {
|
|
5938
5955
|
if(!(this instanceof ContextMenu)) {
|
|
5939
|
-
return ContextMenu(config);
|
|
5956
|
+
return new ContextMenu(config);
|
|
5940
5957
|
}
|
|
5941
5958
|
Menu.call(this, config);
|
|
5942
5959
|
|
|
@@ -5999,6 +6016,16 @@ var NativeComponents = (function (exports) {
|
|
|
5999
6016
|
|
|
6000
6017
|
this.$description = {
|
|
6001
6018
|
items: [],
|
|
6019
|
+
link: null,
|
|
6020
|
+
target: null,
|
|
6021
|
+
label: null,
|
|
6022
|
+
icon: null,
|
|
6023
|
+
shortcut: null,
|
|
6024
|
+
disabled: false,
|
|
6025
|
+
selected: false,
|
|
6026
|
+
value: null,
|
|
6027
|
+
data: null,
|
|
6028
|
+
render: null,
|
|
6002
6029
|
...config
|
|
6003
6030
|
};
|
|
6004
6031
|
|
|
@@ -6018,6 +6045,16 @@ var NativeComponents = (function (exports) {
|
|
|
6018
6045
|
return this;
|
|
6019
6046
|
};
|
|
6020
6047
|
|
|
6048
|
+
MenuItem.prototype.link = function(link) {
|
|
6049
|
+
this.$description.link = link;
|
|
6050
|
+
return this;
|
|
6051
|
+
};
|
|
6052
|
+
|
|
6053
|
+
MenuItem.prototype.target = function(target) {
|
|
6054
|
+
this.$description.target = target;
|
|
6055
|
+
return this;
|
|
6056
|
+
};
|
|
6057
|
+
|
|
6021
6058
|
MenuItem.prototype.icon = function(icon) {
|
|
6022
6059
|
this.$description.icon = icon;
|
|
6023
6060
|
return this;
|
|
@@ -146,6 +146,16 @@ var NativeDocument = (function (exports) {
|
|
|
146
146
|
unmounted: new WeakMap(),
|
|
147
147
|
unmountedSupposedSize: 0,
|
|
148
148
|
observer: null,
|
|
149
|
+
initObserver: () => {
|
|
150
|
+
if(DocumentObserver.observer) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
DocumentObserver.observer = new MutationObserver(DocumentObserver.checkMutation);
|
|
154
|
+
DocumentObserver.observer.observe(document.body, {
|
|
155
|
+
childList: true,
|
|
156
|
+
subtree: true,
|
|
157
|
+
});
|
|
158
|
+
},
|
|
149
159
|
|
|
150
160
|
executeMountedCallback(node) {
|
|
151
161
|
const data = DocumentObserver.mounted.get(node);
|
|
@@ -193,6 +203,7 @@ var NativeDocument = (function (exports) {
|
|
|
193
203
|
},
|
|
194
204
|
|
|
195
205
|
checkMutation: function(mutationsList) {
|
|
206
|
+
console.log('mutationsList', mutationsList);
|
|
196
207
|
for(const mutation of mutationsList) {
|
|
197
208
|
if(DocumentObserver.mountedSupposedSize > 0) {
|
|
198
209
|
for(const node of mutation.addedNodes) {
|
|
@@ -231,6 +242,8 @@ var NativeDocument = (function (exports) {
|
|
|
231
242
|
let mountedRegistered = false;
|
|
232
243
|
let unmountedRegistered = false;
|
|
233
244
|
|
|
245
|
+
DocumentObserver.initObserver();
|
|
246
|
+
|
|
234
247
|
let data = {
|
|
235
248
|
inDom,
|
|
236
249
|
mounted: null,
|
|
@@ -308,12 +321,6 @@ var NativeDocument = (function (exports) {
|
|
|
308
321
|
}
|
|
309
322
|
};
|
|
310
323
|
|
|
311
|
-
DocumentObserver.observer = new MutationObserver(DocumentObserver.checkMutation);
|
|
312
|
-
DocumentObserver.observer.observe(document.body, {
|
|
313
|
-
childList: true,
|
|
314
|
-
subtree: true,
|
|
315
|
-
});
|
|
316
|
-
|
|
317
324
|
let PluginsManager$1 = null;
|
|
318
325
|
|
|
319
326
|
{
|
|
@@ -2200,9 +2207,11 @@ var NativeDocument = (function (exports) {
|
|
|
2200
2207
|
function AnchorWithSentinel(name) {
|
|
2201
2208
|
const instance = Reflect.construct(DocumentFragment, [], AnchorWithSentinel);
|
|
2202
2209
|
const sentinel = document.createComment((name || '') + ' Anchor Sentinel');
|
|
2210
|
+
const anchorStart = document.createComment('Anchor Start : '+name);
|
|
2211
|
+
const anchorEnd = document.createComment('/ Anchor End '+name);
|
|
2203
2212
|
const events = {};
|
|
2204
2213
|
|
|
2205
|
-
instance.
|
|
2214
|
+
instance.append(anchorStart, sentinel, anchorEnd);
|
|
2206
2215
|
|
|
2207
2216
|
const observer = new MutationObserver(() => {
|
|
2208
2217
|
if (sentinel.parentNode !== instance && !(sentinel.parentNode instanceof DocumentFragment)) {
|
|
@@ -2214,6 +2223,8 @@ var NativeDocument = (function (exports) {
|
|
|
2214
2223
|
|
|
2215
2224
|
|
|
2216
2225
|
instance.$sentinel = sentinel;
|
|
2226
|
+
instance.$start = anchorStart;
|
|
2227
|
+
instance.$end = anchorEnd;
|
|
2217
2228
|
instance.$observer = observer;
|
|
2218
2229
|
instance.$events = events;
|
|
2219
2230
|
|
|
@@ -2317,11 +2328,8 @@ var NativeDocument = (function (exports) {
|
|
|
2317
2328
|
|
|
2318
2329
|
anchorFragment.__Anchor__ = true;
|
|
2319
2330
|
|
|
2320
|
-
const anchorStart =
|
|
2321
|
-
const anchorEnd =
|
|
2322
|
-
|
|
2323
|
-
anchorFragment.appendChild(anchorStart);
|
|
2324
|
-
anchorFragment.appendChild(anchorEnd);
|
|
2331
|
+
const anchorStart = anchorFragment.$start;
|
|
2332
|
+
const anchorEnd = anchorFragment.$end;
|
|
2325
2333
|
|
|
2326
2334
|
anchorFragment.nativeInsertBefore = anchorFragment.insertBefore;
|
|
2327
2335
|
anchorFragment.nativeAppendChild = anchorFragment.appendChild;
|
|
@@ -2968,7 +2976,11 @@ var NativeDocument = (function (exports) {
|
|
|
2968
2976
|
|
|
2969
2977
|
return (attr, children) => createElement(attr, children)
|
|
2970
2978
|
}
|
|
2971
|
-
return (
|
|
2979
|
+
return (children, name = '') => {
|
|
2980
|
+
const anchor = Anchor(name);
|
|
2981
|
+
anchor.append(children);
|
|
2982
|
+
return anchor;
|
|
2983
|
+
};
|
|
2972
2984
|
}
|
|
2973
2985
|
|
|
2974
2986
|
function NodeCloner($element) {
|
|
@@ -5085,9 +5097,6 @@ var NativeDocument = (function (exports) {
|
|
|
5085
5097
|
|
|
5086
5098
|
const clear = (items) => {
|
|
5087
5099
|
element.removeChildren();
|
|
5088
|
-
clearCacheOnly(items);
|
|
5089
|
-
};
|
|
5090
|
-
const clearCacheOnly = (items) => {
|
|
5091
5100
|
cleanCache(items);
|
|
5092
5101
|
lastNumberOfItems = 0;
|
|
5093
5102
|
};
|
|
@@ -5125,7 +5134,7 @@ var NativeDocument = (function (exports) {
|
|
|
5125
5134
|
};
|
|
5126
5135
|
|
|
5127
5136
|
const createAndCache = (item) => {
|
|
5128
|
-
const child = callback(item, null);
|
|
5137
|
+
const child = ElementCreator.getChild(callback(item, null));
|
|
5129
5138
|
{
|
|
5130
5139
|
if(!child) {
|
|
5131
5140
|
throw new NativeDocumentError("ForEachArray child can't be null or undefined!");
|
|
@@ -5137,7 +5146,7 @@ var NativeDocument = (function (exports) {
|
|
|
5137
5146
|
|
|
5138
5147
|
const createWithIndexAndCache = (item, indexKey) => {
|
|
5139
5148
|
const indexObserver = Observable(indexKey);
|
|
5140
|
-
const child = callback(item, indexObserver);
|
|
5149
|
+
const child = ElementCreator.getChild(callback(item, indexObserver));
|
|
5141
5150
|
{
|
|
5142
5151
|
if(!child) {
|
|
5143
5152
|
throw new NativeDocumentError("ForEachArray child can't be null or undefined!");
|
|
@@ -5214,13 +5223,13 @@ var NativeDocument = (function (exports) {
|
|
|
5214
5223
|
element.appendChildRaw(Actions.toFragment(items));
|
|
5215
5224
|
},
|
|
5216
5225
|
replace: (items) => {
|
|
5217
|
-
|
|
5218
|
-
element.
|
|
5226
|
+
clear(items);
|
|
5227
|
+
element.appendChildRaw(Actions.toFragment(items));
|
|
5219
5228
|
},
|
|
5220
5229
|
set: () => {
|
|
5221
5230
|
const items = data.val();
|
|
5222
|
-
|
|
5223
|
-
element.
|
|
5231
|
+
clear(items);
|
|
5232
|
+
element.appendChildRaw(Actions.toFragment(items));
|
|
5224
5233
|
},
|
|
5225
5234
|
reOrder: (items) => {
|
|
5226
5235
|
let child = null;
|
|
@@ -6910,6 +6919,7 @@ var NativeDocument = (function (exports) {
|
|
|
6910
6919
|
anchor = Anchor(path);
|
|
6911
6920
|
anchor.appendChild(node);
|
|
6912
6921
|
}
|
|
6922
|
+
console.log(anchor);
|
|
6913
6923
|
$routeInstanceAnchors.set(node, anchor);
|
|
6914
6924
|
return anchor;
|
|
6915
6925
|
};
|
|
@@ -6919,6 +6929,7 @@ var NativeDocument = (function (exports) {
|
|
|
6919
6929
|
$lastNodeInserted.remove();
|
|
6920
6930
|
}
|
|
6921
6931
|
};
|
|
6932
|
+
|
|
6922
6933
|
const cleanContainer = () => {
|
|
6923
6934
|
container.nodeValue = '';
|
|
6924
6935
|
removeLastNodeInserted();
|