highmark-cli 0.0.138 → 0.0.140

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 (92) hide show
  1. package/bin/action/publish.js +2 -0
  2. package/bin/constants.js +6 -2
  3. package/bin/handler/liveReload.js +18 -0
  4. package/bin/importer.js +7 -4
  5. package/bin/operation/copyCheckmark.js +32 -0
  6. package/bin/operation/copyClient.js +5 -5
  7. package/bin/operation/markdownHTML.js +31 -9
  8. package/bin/operation/markdownStylesCSS.js +17 -10
  9. package/bin/operation/server.js +7 -10
  10. package/bin/router/static.js +17 -0
  11. package/checkmark.svg +12 -0
  12. package/client.js +6126 -1527
  13. package/css/loading.css +32 -32
  14. package/lib/client.js +48 -6
  15. package/lib/constants.js +28 -12
  16. package/lib/createMethods.js +64 -0
  17. package/lib/customEventTypes.js +9 -1
  18. package/lib/eventTypes.js +5 -1
  19. package/lib/localStorage.js +56 -0
  20. package/lib/mixins/fullsrean.js +63 -0
  21. package/lib/mixins/touch.js +101 -32
  22. package/lib/selectors.js +5 -9
  23. package/lib/state.js +133 -0
  24. package/lib/styles.js +78 -0
  25. package/lib/utilities/element.js +11 -11
  26. package/lib/utilities/fullScreen.js +16 -0
  27. package/lib/utilities/orientation.js +39 -0
  28. package/lib/view/button/closeMenu.js +121 -0
  29. package/lib/view/button/fullScreen.js +121 -0
  30. package/lib/view/button/zoomMenuIn.js +121 -0
  31. package/lib/view/button/zoomMenuOut.js +121 -0
  32. package/lib/view/button.js +160 -0
  33. package/lib/view/checkbox.js +193 -0
  34. package/lib/view/div/buttons.js +215 -0
  35. package/lib/view/div/checkbox/invertColours.js +151 -0
  36. package/lib/view/div/checkbox/restoreNativeGestures.js +147 -0
  37. package/lib/view/div/checkbox.js +220 -0
  38. package/lib/view/div/checkboxes.js +211 -0
  39. package/lib/view/div/menu.js +122 -28
  40. package/lib/view/div/overlay.js +639 -0
  41. package/lib/view/div/preloader.js +204 -0
  42. package/lib/view/{div/leaf.js → div.js} +21 -32
  43. package/lib/view/element.js +164 -0
  44. package/lib/view/span.js +182 -0
  45. package/lib/view/svg/closeMenu.js +138 -0
  46. package/lib/view/svg/fullScreen.js +138 -0
  47. package/lib/view/svg/zoomMenuIn.js +146 -0
  48. package/lib/view/svg/zoomMenuOut.js +141 -0
  49. package/lib/view/svg.js +184 -0
  50. package/lib/view.js +23 -396
  51. package/package.json +3 -2
  52. package/src/client.js +34 -8
  53. package/src/constants.js +7 -3
  54. package/src/createMethods.js +66 -0
  55. package/src/customEventTypes.js +2 -0
  56. package/src/eventTypes.js +1 -0
  57. package/src/localStorage.js +48 -0
  58. package/src/mixins/fullsrean.js +75 -0
  59. package/src/mixins/touch.js +98 -39
  60. package/src/selectors.js +1 -2
  61. package/src/state.js +130 -0
  62. package/src/styles.js +18 -0
  63. package/src/utilities/element.js +18 -15
  64. package/src/utilities/fullScreen.js +8 -0
  65. package/src/utilities/orientation.js +34 -0
  66. package/src/view/button/closeMenu.js +16 -0
  67. package/src/view/button/fullScreen.js +16 -0
  68. package/src/view/button/zoomMenuIn.js +16 -0
  69. package/src/view/button/zoomMenuOut.js +16 -0
  70. package/src/view/button.js +38 -0
  71. package/src/view/checkbox.js +68 -0
  72. package/src/view/div/buttons.js +39 -0
  73. package/src/view/div/checkbox/invertColours.js +33 -0
  74. package/src/view/div/checkbox/restoreNativeGestures.js +29 -0
  75. package/src/view/div/checkbox.js +45 -0
  76. package/src/view/div/checkboxes.js +36 -0
  77. package/src/view/div/menu.js +83 -26
  78. package/src/view/div/overlay.js +547 -0
  79. package/src/view/div/preloader.js +25 -0
  80. package/src/view/{div/leaf.js → div.js} +13 -21
  81. package/src/view/element.js +16 -0
  82. package/src/view/span.js +22 -0
  83. package/src/view/svg/closeMenu.js +19 -0
  84. package/src/view/svg/fullScreen.js +19 -0
  85. package/src/view/svg/zoomMenuIn.js +20 -0
  86. package/src/view/svg/zoomMenuOut.js +19 -0
  87. package/src/view/svg.js +24 -0
  88. package/src/view.js +20 -482
  89. package/lib/style.js +0 -13
  90. package/lib/utilities/tree.js +0 -55
  91. package/src/style.js +0 -3
  92. package/src/utilities/tree.js +0 -29
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ import SVG from "../svg";
4
+
5
+ export default class ZoomMenuInSVG extends SVG {
6
+ childElements() {
7
+ return (
8
+
9
+ <g>
10
+ <rect x="3" y="10" width="19" height="5"/>
11
+ <rect x="10" y="3" width="5" height="19"/>
12
+ </g>
13
+
14
+ );
15
+ }
16
+
17
+ static defaultProperties = {
18
+ className: "zoom-menu-in"
19
+ };
20
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ import SVG from "../svg";
4
+
5
+ export default class ZoomMenuOutSVG extends SVG {
6
+ childElements() {
7
+ return (
8
+
9
+ <g>
10
+ <rect x="3" y="10" width="19" height="5"/>
11
+ </g>
12
+
13
+ );
14
+ }
15
+
16
+ static defaultProperties = {
17
+ className: "zoom-menu-out"
18
+ };
19
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ import withStyle from "easy-with-style"; ///
4
+
5
+ import Element from "./element";
6
+
7
+ import { svgFill } from "../styles";
8
+
9
+ class FontSizeSVG extends Element {
10
+ static tagName = "svg";
11
+
12
+ static defaultProperties = {
13
+ viewBox: "0 0 25 25"
14
+ };
15
+ }
16
+
17
+ export default withStyle(FontSizeSVG)`
18
+
19
+ fill: ${svgFill};
20
+ stroke: none;
21
+ display: block;
22
+ pointer-events: none;
23
+
24
+ `;
package/src/view.js CHANGED
@@ -1,514 +1,52 @@
1
1
  "use strict";
2
2
 
3
- import withStyle from "easy-with-style";
3
+ import withStyle from "easy-with-style"; ///
4
4
 
5
- import { keyCodes } from "necessary";
6
- import { Element, window } from "easy";
7
-
8
- import LeafDiv from "./view/div/leaf";
5
+ import Element from "./view/element";
9
6
  import MenuDiv from "./view/div/menu";
10
- import touchMixins from "./mixins/touch";
11
-
12
- import { leafNodesFromNodeList } from "./utilities/tree";
13
- import { elementsFromDOMElements } from "./utilities/element";
14
- import { VIEW_CHILD_DIVS_SELECTOR } from "./selectors";
15
- import { SHOW_DELAY, ZOOM_RATIO, SCROLL_DELAY, UP_DIRECTION, DECELERATION, DOWN_DIRECTION, MENU_DIV_SWIPE_BOTTOM } from "./constants";
16
-
17
- const { ENTER_KEY_CODE,
18
- ESCAPE_KEY_CODE,
19
- BACKSPACE_KEY_CODE,
20
- ARROW_UP_KEY_CODE,
21
- ARROW_DOWN_KEY_CODE,
22
- ARROW_LEFT_KEY_CODE,
23
- ARROW_RIGHT_KEY_CODE } = keyCodes;
7
+ import OverlayDiv from "./view/div/overlay";
8
+ import PreloaderDiv from "./view/div/preloader";
24
9
 
25
10
  class View extends Element {
26
- doubleTapCustomHandler = (event, element) => {
27
- this.enableNativeGestures();
28
- }
29
-
30
- pinchStartCustomHandler = (event, element) => {
31
- const nativeGesturesEnabled = this.areNativeGesturesEnabled();
32
-
33
- if (nativeGesturesEnabled) {
34
- return;
35
- }
36
-
37
- const zoom = this.getZoom(),
38
- startZoom = zoom; ///
39
-
40
- this.setStartZoom(startZoom);
41
- }
42
-
43
- pinchMoveCustomHandler = (event, element, ratio) => {
44
- const nativeGesturesEnabled = this.areNativeGesturesEnabled();
45
-
46
- if (nativeGesturesEnabled) {
47
- return;
48
- }
49
-
50
- const startZoom = this.getStartZoom(),
51
- zoom = startZoom * Math.sqrt(ratio);
52
-
53
- this.setZoom(zoom);
54
-
55
- this.zoom(zoom);
56
- }
57
-
58
- swipeRightCustomHandler = (event, element) => {
59
- const nativeGesturesEnabled = this.areNativeGesturesEnabled();
60
-
61
- if (nativeGesturesEnabled) {
62
- return;
63
- }
64
-
65
- this.showLeftLeafDiv();
66
- }
67
-
68
- swipeLeftCustomHandler = (event, element) => {
69
- const nativeGesturesEnabled = this.areNativeGesturesEnabled();
70
-
71
- if (nativeGesturesEnabled) {
72
- return;
73
- }
74
-
75
- this.showRightLeftDiv();
76
- }
77
-
78
- swipeDownCustomHandler = (event, element, top, left, speed) => {
79
- const nativeGesturesEnabled = this.areNativeGesturesEnabled();
80
-
81
- if (nativeGesturesEnabled) {
82
- return;
83
- }
84
-
85
- const direction = DOWN_DIRECTION;
86
-
87
- this.scroll(speed, direction);
88
- }
89
-
90
- swipeUpCustomHandler = (event, element, top, left, speed) => {
91
- const nativeGesturesEnabled = this.areNativeGesturesEnabled();
92
-
93
- if (nativeGesturesEnabled) {
94
- return;
95
- }
96
-
97
- const height = this.getHeight(),
98
- bottom = height - top;
99
-
100
- if (bottom < MENU_DIV_SWIPE_BOTTOM) {
101
- this.showMenuDiv();
102
-
103
- return;
104
- }
105
-
106
- const direction = UP_DIRECTION;
107
-
108
- this.scroll(speed, direction);
109
- }
110
-
111
- dragStartCustomHandler = (event, element) => {
112
- const nativeGesturesEnabled = this.areNativeGesturesEnabled();
113
-
114
- if (nativeGesturesEnabled) {
115
- return;
116
- }
117
-
118
- const scrollTop = this.getScrollTop(),
119
- startScrollTop = scrollTop; ///
120
-
121
- this.setStartScrollTop(startScrollTop);
122
- }
123
-
124
- dragDownCustomHandler = (event, element, top, left) => {
125
- const nativeGesturesEnabled = this.areNativeGesturesEnabled();
126
-
127
- if (nativeGesturesEnabled) {
128
- return;
129
- }
130
-
131
- const startScrollTop = this.getStartScrollTop(),
132
- scrollTop = startScrollTop - top;
133
-
134
- this.setScrollTop(scrollTop);
135
- }
136
-
137
- dragUpCustomHandler = (event, element, top, left) => {
138
- const nativeGesturesEnabled = this.areNativeGesturesEnabled();
139
-
140
- if (nativeGesturesEnabled) {
141
- return;
142
- }
143
-
144
- const startScrollTop = this.getStartScrollTop(),
145
- scrollTop = startScrollTop - top;
146
-
147
- this.setScrollTop(scrollTop);
148
- }
149
-
150
- tapCustomHandler = (event, element) => {
151
-
152
- alert("view tap...")
153
-
154
- this.disableNativeGestures();
155
- }
156
-
157
- keyDownHandler = (event, element) => {
158
- const { keyCode } = event;
159
-
160
- switch (keyCode) {
161
- case ENTER_KEY_CODE:
162
- case ARROW_RIGHT_KEY_CODE: {
163
- this.showRightLeftDiv();
164
-
165
- break;
166
- }
167
-
168
- case BACKSPACE_KEY_CODE:
169
- case ARROW_LEFT_KEY_CODE: {
170
- this.showLeftLeafDiv();
171
-
172
- break;
173
- }
174
-
175
- case ESCAPE_KEY_CODE: {
176
- ///
177
-
178
- break;
179
- }
180
-
181
- case ARROW_UP_KEY_CODE: {
182
- this.showFirstLeftDiv();
183
-
184
- break;
185
- }
186
-
187
- case ARROW_DOWN_KEY_CODE: {
188
- this.showLastLeafDiv();
189
-
190
- break;
191
- }
192
- }
193
- }
194
-
195
- zoomOut() {
196
- let zoom = this.getZoom();
197
-
198
- zoom /= ZOOM_RATIO;
199
-
200
- this.setZoom(zoom);
201
-
202
- this.zoom(zoom);
203
- }
204
-
205
- zoomIn() {
206
- let zoom = this.getZoom();
207
-
208
- zoom *= ZOOM_RATIO;
209
-
210
- this.setZoom(zoom);
211
-
212
- this.zoom(zoom);
213
- }
214
-
215
- zoom(zoom) {
216
- const displayedLeafDiv = this.findDisplayedLeafDiv();
217
-
218
- displayedLeafDiv.zoom(zoom);
219
- }
220
-
221
- scroll(speed, direction) {
222
- let scrollTop = this.getScrollTop();
223
-
224
- scrollTop += speed * SCROLL_DELAY;
225
-
226
- this.setScrollTop(scrollTop);
227
-
228
- let interval = this.getInterval();
229
-
230
- if (interval !== null) {
231
- clearInterval(interval);
232
- }
233
-
234
- interval = setInterval(() => {
235
- speed = speed - direction * DECELERATION;
236
-
237
- if ((speed * direction) < 0) {
238
- clearInterval(interval);
239
-
240
- interval = null;
241
-
242
- this.setInterval(interval);
243
- }
244
-
245
- let scrollTop = this.getScrollTop();
246
-
247
- scrollTop += speed * SCROLL_DELAY;
248
-
249
- this.setScrollTop(scrollTop);
250
- }, SCROLL_DELAY);
251
-
252
- this.setInterval(interval);
253
- }
254
-
255
- showFirstLeftDiv() {
256
- const displayedLeafDiv = this.findDisplayedLeafDiv(),
257
- leafDivs = this.getLeafDivs(),
258
- index = leafDivs.indexOf(displayedLeafDiv),
259
- nextIndex = 0,
260
- previousIndex = index; ///
261
-
262
- this.showNextLeafDiv(nextIndex, previousIndex);
263
- }
264
-
265
- showLeftLeafDiv() {
266
- const displayedLeafDiv = this.findDisplayedLeafDiv(),
267
- leafDivs = this.getLeafDivs(),
268
- index = leafDivs.indexOf(displayedLeafDiv),
269
- nextIndex = index - 1,
270
- previousIndex = index; ///
271
-
272
- this.showNextLeafDiv(nextIndex, previousIndex);
273
- }
274
-
275
- showRightLeftDiv() {
276
- const displayedLeafDiv = this.findDisplayedLeafDiv(),
277
- leafDivs = this.getLeafDivs(),
278
- index = leafDivs.indexOf(displayedLeafDiv),
279
- nextIndex = index + 1,
280
- previousIndex = index; ///
281
-
282
- this.showNextLeafDiv(nextIndex, previousIndex);
283
- }
284
-
285
- showLastLeafDiv() {
286
- const displayedLeafDiv = this.findDisplayedLeafDiv(),
287
- leafDivs = this.getLeafDivs(),
288
- index = leafDivs.indexOf(displayedLeafDiv),
289
- leafDivsLength = leafDivs.length,
290
- nextIndex = leafDivsLength - 1,
291
- previousIndex = index; ///
292
-
293
- this.showNextLeafDiv(nextIndex, previousIndex);
294
- }
295
-
296
- showNextLeafDiv(nextIndex, previousIndex) {
297
- const leafDivs = this.getLeafDivs(),
298
- leafDivsLength = leafDivs.length,
299
- previousLeafDiv = leafDivs[previousIndex];
300
-
301
- if ((nextIndex === -1) || (nextIndex === previousIndex) || (nextIndex === leafDivsLength)) {
302
- return;
303
- }
304
-
305
- previousLeafDiv.hide();
306
-
307
- const nextLeafDiv = leafDivs[nextIndex],
308
- zoom = this.getZoom();
309
-
310
- nextLeafDiv.zoom(zoom);
311
-
312
- setTimeout(() => {
313
- const scrollTop = 0;
314
-
315
- nextLeafDiv.setScrollTop(scrollTop);
316
-
317
- nextLeafDiv.show();
318
- }, SHOW_DELAY);
319
- }
320
-
321
- enableNativeGestures() {
322
- this.addClass("native-gestures");
323
- }
324
-
325
- disableNativeGestures() {
326
- this.removeClass("native-gestures");
327
- }
328
-
329
- forEachLeafDiv(callback) {
330
- const leafDivs = this.getLeafDivs();
331
-
332
- leafDivs.forEach(callback);
333
- }
334
-
335
- findDisplayedLeafDiv() {
336
- const leafDivs = this.getLeafDivs(),
337
- displayedLeafDiv = leafDivs.find((leafDiv) => {
338
- const displayed = leafDiv.isDisplayed();
339
-
340
- if (displayed) {
341
- return true;
342
- }
343
- });
344
-
345
- return displayedLeafDiv;
346
- }
347
-
348
- retrieveLeafDivs() {
349
- const viewChildDivDOMElementNodeList = document.querySelectorAll(VIEW_CHILD_DIVS_SELECTOR),
350
- viewChildDivDOMElements = leafNodesFromNodeList(viewChildDivDOMElementNodeList), ///
351
- leafDivs = elementsFromDOMElements(viewChildDivDOMElements, LeafDiv);
352
-
353
- return leafDivs;
354
- }
355
-
356
- getZoom() {
357
- const { zoom } = this.getState();
358
-
359
- return zoom;
360
- }
361
-
362
- setZoom(zoom) {
363
- this.updateState({
364
- zoom
365
- });
366
- }
367
-
368
- getLeafDivs() {
369
- const { leafDivs } = this.getState();
370
-
371
- return leafDivs;
372
- }
373
-
374
- setLeftDivs(leafDivs) {
375
- this.updateState({
376
- leafDivs
377
- });
378
- }
379
-
380
- getInterval() {
381
- const { interval } = this.getState();
382
-
383
- return interval;
384
- }
385
-
386
- setInterval(interval) {
387
- this.updateState({
388
- interval
389
- });
390
- }
391
-
392
- getStartZoom() {
393
- const { startZoom } = this.getState();
394
-
395
- return startZoom;
396
- }
397
-
398
- setStartZoom(startZoom) {
399
- this.updateState({
400
- startZoom
401
- });
402
- }
403
-
404
- getStartScrollTop() {
405
- const { startScrollTop } = this.getState();
406
-
407
- return startScrollTop;
408
- }
409
-
410
- setStartScrollTop(startScrollTop) {
411
- this.updateState({
412
- startScrollTop
413
- });
414
- }
415
-
416
- areNativeGesturesEnabled() {
417
- const nativeGesturesEnabled = this.hasClass("native-gestures");
418
-
419
- return nativeGesturesEnabled;
420
- }
421
-
422
- setInitialState() {
423
- const zoom = 1,
424
- leafDivs = this.retrieveLeafDivs(),
425
- interval = null,
426
- startZoom = null,
427
- startScrollTop = null;
428
-
429
- this.setState({
430
- zoom,
431
- leafDivs,
432
- interval,
433
- startZoom,
434
- startScrollTop
435
- });
436
- }
437
-
438
- didMount() {
439
- this.enableTouch();
440
-
441
- this.onCustomTap(this.tapCustomHandler);
442
- this.onCustomDragUp(this.dragUpCustomHandler);
443
- this.onCustomDragDown(this.dragDownCustomHandler);
444
- this.onCustomDragStart(this.dragStartCustomHandler);
445
- this.onCustomSwipeUp(this.swipeUpCustomHandler);
446
- this.onCustomSwipeDown(this.swipeDownCustomHandler);
447
- this.onCustomSwipeLeft(this.swipeLeftCustomHandler);
448
- this.onCustomSwipeRight(this.swipeRightCustomHandler);
449
- this.onCustomPinchMove(this.pinchMoveCustomHandler);
450
- this.onCustomPinchStart(this.pinchStartCustomHandler);
451
- this.onCustomDoubleTap(this.doubleTapCustomHandler);
452
-
453
- window.onKeyDown(this.keyDownHandler);
454
- }
455
-
456
- willUnmount() {
457
- this.offCustomTap(this.tapCustomHandler);
458
- this.offCustomDragUp(this.dragUpCustomHandler);
459
- this.offCustomDragDown(this.dragDownCustomHandler);
460
- this.offCustomDragStart(this.dragStartCustomHandler);
461
- this.offCustomSwipeUp(this.swipeUpCustomHandler);
462
- this.offCustomSwipeDown(this.swipeDownCustomHandler);
463
- this.offCustomSwipeLeft(this.swipeLeftCustomHandler);
464
- this.offCustomSwipeRight(this.swipeRightCustomHandler);
465
- this.offCustomPinchMove(this.pinchMoveCustomHandler);
466
- this.offCustomPinchStart(this.pinchStartCustomHandler);
467
- this.offCustomDoubleTap(this.doubleTapCustomHandler);
468
-
469
- this.disableTouch();
470
-
471
- window.offKeyDown(this.keyDownHandler);
11
+ updateZoom() {
12
+ this.updateMenuDivZoom();
13
+ this.updateOverlayDivZoom();
472
14
  }
473
15
 
474
16
  childElements() {
475
- return (
17
+ const { divDOMElements } = this.properties;
476
18
 
19
+ return ([
20
+
21
+ <PreloaderDiv/>,
22
+ <OverlayDiv divDOMElements={divDOMElements} />,
477
23
  <MenuDiv/>
478
24
 
479
- );
25
+ ]);
480
26
  }
481
27
 
482
28
  initialise() {
483
29
  this.assignContext();
484
30
 
485
- this.setInitialState();
486
-
487
- this.forEachLeafDiv((leafDiv, index) => {
488
- (index === 0) ?
489
- leafDiv.show() :
490
- leafDiv.hide();
491
- });
31
+ this.show();
492
32
  }
493
33
 
494
34
  static tagName = "div";
495
35
 
36
+ static ignoredProperties = [
37
+ "divDOMElements"
38
+ ];
39
+
496
40
  static defaultProperties = {
497
41
  className: "view"
498
42
  };
499
43
  }
500
44
 
501
- Object.assign(View.prototype, touchMixins);
502
-
503
45
  export default withStyle(View)`
504
46
 
505
47
  width: 100%;
506
48
  height: 100%;
507
- overflow: hidden;
508
- touch-action: none;
509
-
510
- .native-gestures {
511
- touch-action: auto;
512
- }
49
+ align-items: stretch;
50
+ flex-direction: column;
513
51
 
514
52
  `;
package/lib/style.js DELETED
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "menuDivHeight", {
6
- enumerable: true,
7
- get: function() {
8
- return menuDivHeight;
9
- }
10
- });
11
- var menuDivHeight = "256px";
12
-
13
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9zdHlsZS5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuZXhwb3J0IGNvbnN0IG1lbnVEaXZIZWlnaHQgPSBcIjI1NnB4XCI7XG4iXSwibmFtZXMiOlsibWVudURpdkhlaWdodCJdLCJyYW5nZU1hcHBpbmdzIjoiOzs7Ozs7Ozs7OyIsIm1hcHBpbmdzIjoiQUFBQTs7OzsrQkFFYUE7OztlQUFBQTs7O0FBQU4sSUFBTUEsZ0JBQWdCIn0=
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "leafNodesFromNodeList", {
6
- enumerable: true,
7
- get: function() {
8
- return leafNodesFromNodeList;
9
- }
10
- });
11
- var _necessary = require("necessary");
12
- function _array_like_to_array(arr, len) {
13
- if (len == null || len > arr.length) len = arr.length;
14
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
15
- return arr2;
16
- }
17
- function _array_without_holes(arr) {
18
- if (Array.isArray(arr)) return _array_like_to_array(arr);
19
- }
20
- function _iterable_to_array(iter) {
21
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
22
- }
23
- function _non_iterable_spread() {
24
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
25
- }
26
- function _to_consumable_array(arr) {
27
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
28
- }
29
- function _unsupported_iterable_to_array(o, minLen) {
30
- if (!o) return;
31
- if (typeof o === "string") return _array_like_to_array(o, minLen);
32
- var n = Object.prototype.toString.call(o).slice(8, -1);
33
- if (n === "Object" && o.constructor) n = o.constructor.name;
34
- if (n === "Map" || n === "Set") return Array.from(n);
35
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
36
- }
37
- var filter = _necessary.arrayUtilities.filter;
38
- function leafNodesFromNodeList(nodeList) {
39
- var nodes = _to_consumable_array(nodeList);
40
- filter(nodes, function(node) {
41
- var childNodeList = node.childNodes, childNodes = _to_consumable_array(childNodeList), childNodesIncludesNodes = nodes.some(function(node) {
42
- var childNodesIncludesNode = childNodes.includes(node);
43
- if (childNodesIncludesNode) {
44
- return true;
45
- }
46
- });
47
- if (!childNodesIncludesNodes) {
48
- return true;
49
- }
50
- });
51
- var leafNodes = nodes; ///
52
- return leafNodes;
53
- }
54
-
55
- //# sourceMappingUR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
7
- export function leafNodesFromNodeList(nodeList) {
8
- const nodes = [ ...nodeList ];
9
-
10
- filter(nodes, (node) => {
11
- const { childNodes: childNodeList } = node,
12
- childNodes = [ ...childNodeList ],
13
- childNodesIncludesNodes = nodes.some((node) => {
14
- const childNodesIncludesNode = childNodes.includes(node);
15
-
16
- if (childNodesIncludesNode) {
17
- return true;
18
- }
19
- });
20
-
21
- if (!childNodesIncludesNodes) {
22
- return true;
23
- }
24
- });
25
-
26
- const leafNodes = nodes; ///
27
-
28
- return leafNodes;
29
- }