nodeskini 1.0.0

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 (215) hide show
  1. package/README.md +31 -0
  2. package/client/archive/bundle.js +11528 -0
  3. package/client/archive/golem.html +60 -0
  4. package/client/archive/golemClient.js +595 -0
  5. package/client/archive/golembundle.js +11634 -0
  6. package/client/archive/sequencer.html +43 -0
  7. package/client/archive/sequenceurClient.js +815 -0
  8. package/client/archive/stylegolem.css +158 -0
  9. package/client/archive/stylesequenceur.css +204 -0
  10. package/client/clientListe/Sortable-master/.circleci/config.yml +33 -0
  11. package/client/clientListe/Sortable-master/.editorconfig +15 -0
  12. package/client/clientListe/Sortable-master/.github/ISSUE_TEMPLATE/bug-report.md +73 -0
  13. package/client/clientListe/Sortable-master/.github/ISSUE_TEMPLATE/custom-template.md +48 -0
  14. package/client/clientListe/Sortable-master/.github/ISSUE_TEMPLATE/feature-request.md +41 -0
  15. package/client/clientListe/Sortable-master/.jshintrc +25 -0
  16. package/client/clientListe/Sortable-master/.testcaferc.json +7 -0
  17. package/client/clientListe/Sortable-master/CONTRIBUTING.md +26 -0
  18. package/client/clientListe/Sortable-master/LICENSE +21 -0
  19. package/client/clientListe/Sortable-master/README.md +813 -0
  20. package/client/clientListe/Sortable-master/Sortable.js +3709 -0
  21. package/client/clientListe/Sortable-master/Sortable.min.js +2 -0
  22. package/client/clientListe/Sortable-master/Sortable.min.old.js +2 -0
  23. package/client/clientListe/Sortable-master/Sortable.min.old.old.js +2 -0
  24. package/client/clientListe/Sortable-master/babel.config.js +27 -0
  25. package/client/clientListe/Sortable-master/bower.json +30 -0
  26. package/client/clientListe/Sortable-master/entry/entry-complete.js +8 -0
  27. package/client/clientListe/Sortable-master/entry/entry-core.js +19 -0
  28. package/client/clientListe/Sortable-master/entry/entry-defaults.js +19 -0
  29. package/client/clientListe/Sortable-master/index.html +460 -0
  30. package/client/clientListe/Sortable-master/modular/sortable.complete.esm.js +3701 -0
  31. package/client/clientListe/Sortable-master/modular/sortable.core.esm.js +3698 -0
  32. package/client/clientListe/Sortable-master/modular/sortable.esm.js +3699 -0
  33. package/client/clientListe/Sortable-master/package-lock.json +5704 -0
  34. package/client/clientListe/Sortable-master/package.json +56 -0
  35. package/client/clientListe/Sortable-master/plugins/AutoScroll/AutoScroll.js +270 -0
  36. package/client/clientListe/Sortable-master/plugins/AutoScroll/README.md +80 -0
  37. package/client/clientListe/Sortable-master/plugins/AutoScroll/index.js +1 -0
  38. package/client/clientListe/Sortable-master/plugins/MultiDrag/MultiDrag.js +617 -0
  39. package/client/clientListe/Sortable-master/plugins/MultiDrag/README.md +96 -0
  40. package/client/clientListe/Sortable-master/plugins/MultiDrag/index.js +1 -0
  41. package/client/clientListe/Sortable-master/plugins/OnSpill/OnSpill.js +79 -0
  42. package/client/clientListe/Sortable-master/plugins/OnSpill/README.md +60 -0
  43. package/client/clientListe/Sortable-master/plugins/OnSpill/index.js +1 -0
  44. package/client/clientListe/Sortable-master/plugins/README.md +178 -0
  45. package/client/clientListe/Sortable-master/plugins/Swap/README.md +55 -0
  46. package/client/clientListe/Sortable-master/plugins/Swap/Swap.js +90 -0
  47. package/client/clientListe/Sortable-master/plugins/Swap/index.js +1 -0
  48. package/client/clientListe/Sortable-master/scripts/banner.js +8 -0
  49. package/client/clientListe/Sortable-master/scripts/build.js +17 -0
  50. package/client/clientListe/Sortable-master/scripts/esm-build.js +28 -0
  51. package/client/clientListe/Sortable-master/scripts/minify.js +11 -0
  52. package/client/clientListe/Sortable-master/scripts/test-compat.js +30 -0
  53. package/client/clientListe/Sortable-master/scripts/test.js +21 -0
  54. package/client/clientListe/Sortable-master/scripts/umd-build.js +15 -0
  55. package/client/clientListe/Sortable-master/src/Animation.js +175 -0
  56. package/client/clientListe/Sortable-master/src/BrowserInfo.js +12 -0
  57. package/client/clientListe/Sortable-master/src/EventDispatcher.js +57 -0
  58. package/client/clientListe/Sortable-master/src/PluginManager.js +87 -0
  59. package/client/clientListe/Sortable-master/src/Sortable.js +1971 -0
  60. package/client/clientListe/Sortable-master/src/utils.js +556 -0
  61. package/client/clientListe/Sortable-master/st/app.js +224 -0
  62. package/client/clientListe/Sortable-master/st/iframe/frame.html +32 -0
  63. package/client/clientListe/Sortable-master/st/iframe/index.html +49 -0
  64. package/client/clientListe/Sortable-master/st/logo.png +0 -0
  65. package/client/clientListe/Sortable-master/st/og-image.png +0 -0
  66. package/client/clientListe/Sortable-master/st/prettify/prettify.css +1 -0
  67. package/client/clientListe/Sortable-master/st/prettify/prettify.js +46 -0
  68. package/client/clientListe/Sortable-master/st/prettify/run_prettify.js +64 -0
  69. package/client/clientListe/Sortable-master/st/saucelabs.svg +1 -0
  70. package/client/clientListe/Sortable-master/st/theme.css +254 -0
  71. package/client/clientListe/Sortable-master/tests/Sortable.compat.test.js +39 -0
  72. package/client/clientListe/Sortable-master/tests/Sortable.test.js +386 -0
  73. package/client/clientListe/Sortable-master/tests/dual-list.html +34 -0
  74. package/client/clientListe/Sortable-master/tests/empty-list.html +30 -0
  75. package/client/clientListe/Sortable-master/tests/filter.html +27 -0
  76. package/client/clientListe/Sortable-master/tests/handles.html +27 -0
  77. package/client/clientListe/Sortable-master/tests/nested.html +67 -0
  78. package/client/clientListe/Sortable-master/tests/single-list.html +25 -0
  79. package/client/clientListe/Sortable-master/tests/style.css +18 -0
  80. package/client/clientListe/clientListe.html +148 -0
  81. package/client/clientListe/clientListe.js +1508 -0
  82. package/client/clientListe/clientListebundle.js +13164 -0
  83. package/client/clientListe/images/poubelle.png +0 -0
  84. package/client/clientListe/images/start.png +0 -0
  85. package/client/clientListe/images/stop.png +0 -0
  86. package/client/clientListe/images/submit.png +0 -0
  87. package/client/clientListe/sortable-theme-bootstrap.css +90 -0
  88. package/client/configurateur/configReact.js +273 -0
  89. package/client/configurateur/configReactbundle.js +295 -0
  90. package/client/configurateur/configurateur.css +95 -0
  91. package/client/configurateur/configurateur.html +48 -0
  92. package/client/configurateur/lib/jexcel.css +755 -0
  93. package/client/configurateur/lib/jexcel.js +14970 -0
  94. package/client/configurateur/lib/jsuites.css +2801 -0
  95. package/client/configurateur/lib/jsuites.js +11822 -0
  96. package/client/configurateur/lib/react-dom.production.min.js +239 -0
  97. package/client/configurateur/lib/react.production.min.js +32 -0
  98. package/client/configurateur/src/configReact.js +247 -0
  99. package/client/controleur/clientcontroleur.js +536 -0
  100. package/client/controleur/clientcontroleur.test.js +282 -0
  101. package/client/controleur/controleur.html +51 -0
  102. package/client/controleur/controleurbundle.js +565 -0
  103. package/client/controleur/stylecontroleur.css +236 -0
  104. package/client/controleurHH/controleurHH.html +71 -0
  105. package/client/controleurHH/controleurHH.js +252 -0
  106. package/client/controleurHH/styles/index.css +320 -0
  107. package/client/controleurHH/styles/material.css +11552 -0
  108. package/client/parametrage/paramReact.js +473 -0
  109. package/client/parametrage/paramReactbundle.js +500 -0
  110. package/client/parametrage/parametrage.css +111 -0
  111. package/client/parametrage/parametrage.html +163 -0
  112. package/client/parametrage/src/paramReact.js +459 -0
  113. package/client/score/hash.js +83 -0
  114. package/client/score/p5.min.js +3 -0
  115. package/client/score/parto1.js +1171 -0
  116. package/client/score/parto1bundle.js +1181 -0
  117. package/client/score/processing.min.js +431 -0
  118. package/client/score/score.html +15 -0
  119. package/client/score/score.js +34 -0
  120. package/client/simulateurListe/simulateurFork.js +750 -0
  121. package/client/simulateurListe/simulateurFork.mjs +681 -0
  122. package/client/simulateurListe/simulateurForkSansReorg.js +569 -0
  123. package/client/simulateurListe/simulateurListe.js +628 -0
  124. package/myReact/archive/Nodeemitvaluedlocal1.hh.js +52 -0
  125. package/myReact/archive/abort-parNode.js +79 -0
  126. package/myReact/archive/abroNode.js +169 -0
  127. package/myReact/archive/abroNode2.js +80 -0
  128. package/myReact/archive/atom.compile.hh.js +51 -0
  129. package/myReact/archive/await-countNode.js +67 -0
  130. package/myReact/archive/await-nowvalNode.js +44 -0
  131. package/myReact/archive/callHH.js +96 -0
  132. package/myReact/archive/emit-if2.hh.compiled.js +113 -0
  133. package/myReact/archive/every1Node.js +35 -0
  134. package/myReact/archive/if-runNode.js +74 -0
  135. package/myReact/archive/if1Node.js +43 -0
  136. package/myReact/archive/makeawait.js +0 -0
  137. package/myReact/archive/myReact.old.js +684 -0
  138. package/myReact/archive/orchestration.js +281 -0
  139. package/myReact/archive/orchestration1.js +132 -0
  140. package/myReact/archive/orchestration1.xml +465 -0
  141. package/myReact/archive/orchestration2.js +161 -0
  142. package/myReact/archive/orchestrationHH.mano.js +280 -0
  143. package/myReact/archive/orchestrationHHTest.js +428 -0
  144. package/myReact/archive/orchestrationHHTest.xml +234 -0
  145. package/myReact/archive/orchestrationHHTestRun.js +104 -0
  146. package/myReact/archive/orchestrationHHTestRun.xml +34 -0
  147. package/myReact/archive/orchestrationTest0.js +178 -0
  148. package/myReact/archive/orchestrationTest1.js +181 -0
  149. package/myReact/archive/orchestrationTest2.js +281 -0
  150. package/myReact/archive/run3pointsNode.js +59 -0
  151. package/myReact/archive/runNode.js +123 -0
  152. package/myReact/archive/runNode2.js +91 -0
  153. package/myReact/archive/testAwait1.js +141 -0
  154. package/myReact/archive/testAwait1.xml +86 -0
  155. package/myReact/archive/testEvery1.js +122 -0
  156. package/myReact/archive/testEvery1.xml +79 -0
  157. package/myReact/archive/testHH1.js +135 -0
  158. package/myReact/archive/testHH1.xml +86 -0
  159. package/myReact/archive/testHH1revu.js +104 -0
  160. package/myReact/archive/testHH2.js +122 -0
  161. package/myReact/archive/testHH2.xml +79 -0
  162. package/myReact/archive/testHH3.js +130 -0
  163. package/myReact/archive/testHH3.xml +86 -0
  164. package/myReact/archive/testHHabort.js +121 -0
  165. package/myReact/archive/testHHabort.xml +83 -0
  166. package/myReact/archive/testMakeawait.js +202 -0
  167. package/myReact/archive/testRun1.js +168 -0
  168. package/myReact/archive/testRun1.xml +142 -0
  169. package/myReact/archive/titi.js +28 -0
  170. package/myReact/archive/titi.xml +110 -0
  171. package/myReact/archive/toto.js +73 -0
  172. package/myReact/archive/toto.xml +198 -0
  173. package/myReact/archive/trap-await-parallelNode.js +123 -0
  174. package/myReact/inutiles/hiver2022.xml +804 -0
  175. package/myReact/inutiles/hopeNode.xml +459 -0
  176. package/myReact/inutiles/mars2022.xml +871 -0
  177. package/myReact/inutiles/mystique1.xml +318 -0
  178. package/myReact/inutiles/mystiqueOSC.xml +277 -0
  179. package/myReact/inutiles/opus5Node.xml +1271 -0
  180. package/myReact/inutiles/opus5NodeLinux.xml +1241 -0
  181. package/myReact/inutiles/orchestrationHH.xml +541 -0
  182. package/myReact/inutiles/orchestrationHH2.xml +547 -0
  183. package/myReact/inutiles/testHH.xml +95 -0
  184. package/myReact/inutiles/trouveLaPercuTenor.xml +349 -0
  185. package/myReact/myReact.js +744 -0
  186. package/myReact/myReact.min.js +1 -0
  187. package/myReact/orchestrationHH.js +311 -0
  188. package/myReact/orchestrationHH.mjs +436 -0
  189. package/myReact/orchestrationHH.mjs.map +1 -0
  190. package/package.json +46 -0
  191. package/serveur/OSCandMidi.mjs +361 -0
  192. package/serveur/computeScore.mjs +415 -0
  193. package/serveur/controleDAW.mjs +1149 -0
  194. package/serveur/defaultSession.csv +2 -0
  195. package/serveur/defaultSkiniParametres.js +119 -0
  196. package/serveur/gameOSC.mjs +96 -0
  197. package/serveur/groupeClientsSons.mjs +1014 -0
  198. package/serveur/ipConfig.json +24 -0
  199. package/serveur/ipConfig127.json +19 -0
  200. package/serveur/ipConfig75.json +17 -0
  201. package/serveur/ipConfigBH.json +19 -0
  202. package/serveur/ipConfigLocal.json +19 -0
  203. package/serveur/midiConfig.json +26 -0
  204. package/serveur/midiConfigBH.json +26 -0
  205. package/serveur/midiConfigVoid.json +3 -0
  206. package/serveur/midimix.mjs +570 -0
  207. package/serveur/saveParam.mjs +159 -0
  208. package/serveur/skiniParametres.good.js +132 -0
  209. package/serveur/skiniParametres.js +106 -0
  210. package/serveur/utilsHHSkini.hh.js +64 -0
  211. package/serveur/utilsSkini.mjs +137 -0
  212. package/serveur/websocketServer.mjs +2052 -0
  213. package/serveur/workerInterfaceZ.mjs +327 -0
  214. package/serveur/workerSynchro.mjs +49 -0
  215. package/skini.mjs +141 -0
@@ -0,0 +1,556 @@
1
+ import { IE11OrLess } from './BrowserInfo.js';
2
+ import Sortable from './Sortable.js';
3
+
4
+ const captureMode = {
5
+ capture: false,
6
+ passive: false
7
+ };
8
+
9
+ function on(el, event, fn) {
10
+ el.addEventListener(event, fn, !IE11OrLess && captureMode);
11
+ }
12
+
13
+
14
+ function off(el, event, fn) {
15
+ el.removeEventListener(event, fn, !IE11OrLess && captureMode);
16
+ }
17
+
18
+ function matches(/**HTMLElement*/el, /**String*/selector) {
19
+ if (!selector) return;
20
+
21
+ selector[0] === '>' && (selector = selector.substring(1));
22
+
23
+ if (el) {
24
+ try {
25
+ if (el.matches) {
26
+ return el.matches(selector);
27
+ } else if (el.msMatchesSelector) {
28
+ return el.msMatchesSelector(selector);
29
+ } else if (el.webkitMatchesSelector) {
30
+ return el.webkitMatchesSelector(selector);
31
+ }
32
+ } catch(_) {
33
+ return false;
34
+ }
35
+ }
36
+
37
+ return false;
38
+ }
39
+
40
+ function getParentOrHost(el) {
41
+ return (el.host && el !== document && el.host.nodeType)
42
+ ? el.host
43
+ : el.parentNode;
44
+ }
45
+
46
+ function closest(/**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx, includeCTX) {
47
+ if (el) {
48
+ ctx = ctx || document;
49
+
50
+ do {
51
+ if (
52
+ selector != null &&
53
+ (
54
+ selector[0] === '>' ?
55
+ el.parentNode === ctx && matches(el, selector) :
56
+ matches(el, selector)
57
+ ) ||
58
+ includeCTX && el === ctx
59
+ ) {
60
+ return el;
61
+ }
62
+
63
+ if (el === ctx) break;
64
+ /* jshint boss:true */
65
+ } while (el = getParentOrHost(el));
66
+ }
67
+
68
+ return null;
69
+ }
70
+
71
+ const R_SPACE = /\s+/g;
72
+
73
+ function toggleClass(el, name, state) {
74
+ if (el && name) {
75
+ if (el.classList) {
76
+ el.classList[state ? 'add' : 'remove'](name);
77
+ }
78
+ else {
79
+ let className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
80
+ el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
81
+ }
82
+ }
83
+ }
84
+
85
+
86
+ function css(el, prop, val) {
87
+ let style = el && el.style;
88
+
89
+ if (style) {
90
+ if (val === void 0) {
91
+ if (document.defaultView && document.defaultView.getComputedStyle) {
92
+ val = document.defaultView.getComputedStyle(el, '');
93
+ }
94
+ else if (el.currentStyle) {
95
+ val = el.currentStyle;
96
+ }
97
+
98
+ return prop === void 0 ? val : val[prop];
99
+ }
100
+ else {
101
+ if (!(prop in style) && prop.indexOf('webkit') === -1) {
102
+ prop = '-webkit-' + prop;
103
+ }
104
+
105
+ style[prop] = val + (typeof val === 'string' ? '' : 'px');
106
+ }
107
+ }
108
+ }
109
+
110
+ function matrix(el, selfOnly) {
111
+ let appliedTransforms = '';
112
+ if (typeof(el) === 'string') {
113
+ appliedTransforms = el;
114
+ } else {
115
+ do {
116
+ let transform = css(el, 'transform');
117
+
118
+ if (transform && transform !== 'none') {
119
+ appliedTransforms = transform + ' ' + appliedTransforms;
120
+ }
121
+ /* jshint boss:true */
122
+ } while (!selfOnly && (el = el.parentNode));
123
+ }
124
+
125
+ const matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
126
+ /*jshint -W056 */
127
+ return matrixFn && (new matrixFn(appliedTransforms));
128
+ }
129
+
130
+
131
+ function find(ctx, tagName, iterator) {
132
+ if (ctx) {
133
+ let list = ctx.getElementsByTagName(tagName), i = 0, n = list.length;
134
+
135
+ if (iterator) {
136
+ for (; i < n; i++) {
137
+ iterator(list[i], i);
138
+ }
139
+ }
140
+
141
+ return list;
142
+ }
143
+
144
+ return [];
145
+ }
146
+
147
+
148
+
149
+ function getWindowScrollingElement() {
150
+ let scrollingElement = document.scrollingElement;
151
+
152
+ if (scrollingElement) {
153
+ return scrollingElement
154
+ } else {
155
+ return document.documentElement
156
+ }
157
+ }
158
+
159
+
160
+ /**
161
+ * Returns the "bounding client rect" of given element
162
+ * @param {HTMLElement} el The element whose boundingClientRect is wanted
163
+ * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container
164
+ * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr
165
+ * @param {[Boolean]} undoScale Whether the container's scale() should be undone
166
+ * @param {[HTMLElement]} container The parent the element will be placed in
167
+ * @return {Object} The boundingClientRect of el, with specified adjustments
168
+ */
169
+ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {
170
+ if (!el.getBoundingClientRect && el !== window) return;
171
+
172
+ let elRect,
173
+ top,
174
+ left,
175
+ bottom,
176
+ right,
177
+ height,
178
+ width;
179
+
180
+ if (el !== window && el !== getWindowScrollingElement()) {
181
+ elRect = el.getBoundingClientRect();
182
+ top = elRect.top;
183
+ left = elRect.left;
184
+ bottom = elRect.bottom;
185
+ right = elRect.right;
186
+ height = elRect.height;
187
+ width = elRect.width;
188
+ } else {
189
+ top = 0;
190
+ left = 0;
191
+ bottom = window.innerHeight;
192
+ right = window.innerWidth;
193
+ height = window.innerHeight;
194
+ width = window.innerWidth;
195
+ }
196
+
197
+ if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {
198
+ // Adjust for translate()
199
+ container = container || el.parentNode;
200
+
201
+ // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)
202
+ // Not needed on <= IE11
203
+ if (!IE11OrLess) {
204
+ do {
205
+ if (
206
+ container &&
207
+ container.getBoundingClientRect &&
208
+ (
209
+ css(container, 'transform') !== 'none' ||
210
+ relativeToNonStaticParent &&
211
+ css(container, 'position') !== 'static'
212
+ )
213
+ ) {
214
+ let containerRect = container.getBoundingClientRect();
215
+
216
+ // Set relative to edges of padding box of container
217
+ top -= containerRect.top + parseInt(css(container, 'border-top-width'));
218
+ left -= containerRect.left + parseInt(css(container, 'border-left-width'));
219
+ bottom = top + elRect.height;
220
+ right = left + elRect.width;
221
+
222
+ break;
223
+ }
224
+ /* jshint boss:true */
225
+ } while (container = container.parentNode);
226
+ }
227
+ }
228
+
229
+ if (undoScale && el !== window) {
230
+ // Adjust for scale()
231
+ let elMatrix = matrix(container || el),
232
+ scaleX = elMatrix && elMatrix.a,
233
+ scaleY = elMatrix && elMatrix.d;
234
+
235
+ if (elMatrix) {
236
+ top /= scaleY;
237
+ left /= scaleX;
238
+
239
+ width /= scaleX;
240
+ height /= scaleY;
241
+
242
+ bottom = top + height;
243
+ right = left + width;
244
+ }
245
+ }
246
+
247
+ return {
248
+ top: top,
249
+ left: left,
250
+ bottom: bottom,
251
+ right: right,
252
+ width: width,
253
+ height: height
254
+ };
255
+ }
256
+
257
+ /**
258
+ * Checks if a side of an element is scrolled past a side of its parents
259
+ * @param {HTMLElement} el The element who's side being scrolled out of view is in question
260
+ * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')
261
+ * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')
262
+ * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
263
+ */
264
+ function isScrolledPast(el, elSide, parentSide) {
265
+ let parent = getParentAutoScrollElement(el, true),
266
+ elSideVal = getRect(el)[elSide];
267
+
268
+ /* jshint boss:true */
269
+ while (parent) {
270
+ let parentSideVal = getRect(parent)[parentSide],
271
+ visible;
272
+
273
+ if (parentSide === 'top' || parentSide === 'left') {
274
+ visible = elSideVal >= parentSideVal;
275
+ } else {
276
+ visible = elSideVal <= parentSideVal;
277
+ }
278
+
279
+ if (!visible) return parent;
280
+
281
+ if (parent === getWindowScrollingElement()) break;
282
+
283
+ parent = getParentAutoScrollElement(parent, false);
284
+ }
285
+
286
+ return false;
287
+ }
288
+
289
+
290
+
291
+ /**
292
+ * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)
293
+ * and non-draggable elements
294
+ * @param {HTMLElement} el The parent element
295
+ * @param {Number} childNum The index of the child
296
+ * @param {Object} options Parent Sortable's options
297
+ * @return {HTMLElement} The child at index childNum, or null if not found
298
+ */
299
+ function getChild(el, childNum, options) {
300
+ let currentChild = 0,
301
+ i = 0,
302
+ children = el.children;
303
+
304
+ while (i < children.length) {
305
+ if (
306
+ children[i].style.display !== 'none' &&
307
+ children[i] !== Sortable.ghost &&
308
+ children[i] !== Sortable.dragged &&
309
+ closest(children[i], options.draggable, el, false)
310
+ ) {
311
+ if (currentChild === childNum) {
312
+ return children[i];
313
+ }
314
+ currentChild++;
315
+ }
316
+
317
+ i++;
318
+ }
319
+ return null;
320
+ }
321
+
322
+ /**
323
+ * Gets the last child in the el, ignoring ghostEl or invisible elements (clones)
324
+ * @param {HTMLElement} el Parent element
325
+ * @param {selector} selector Any other elements that should be ignored
326
+ * @return {HTMLElement} The last child, ignoring ghostEl
327
+ */
328
+ function lastChild(el, selector) {
329
+ let last = el.lastElementChild;
330
+
331
+ while (
332
+ last &&
333
+ (
334
+ last === Sortable.ghost ||
335
+ css(last, 'display') === 'none' ||
336
+ selector && !matches(last, selector)
337
+ )
338
+ ) {
339
+ last = last.previousElementSibling;
340
+ }
341
+
342
+ return last || null;
343
+ }
344
+
345
+
346
+ /**
347
+ * Returns the index of an element within its parent for a selected set of
348
+ * elements
349
+ * @param {HTMLElement} el
350
+ * @param {selector} selector
351
+ * @return {number}
352
+ */
353
+ function index(el, selector) {
354
+ let index = 0;
355
+
356
+ if (!el || !el.parentNode) {
357
+ return -1;
358
+ }
359
+
360
+ /* jshint boss:true */
361
+ while (el = el.previousElementSibling) {
362
+ if ((el.nodeName.toUpperCase() !== 'TEMPLATE') && el !== Sortable.clone && (!selector || matches(el, selector))) {
363
+ index++;
364
+ }
365
+ }
366
+
367
+ return index;
368
+ }
369
+
370
+ /**
371
+ * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.
372
+ * The value is returned in real pixels.
373
+ * @param {HTMLElement} el
374
+ * @return {Array} Offsets in the format of [left, top]
375
+ */
376
+ function getRelativeScrollOffset(el) {
377
+ let offsetLeft = 0,
378
+ offsetTop = 0,
379
+ winScroller = getWindowScrollingElement();
380
+
381
+ if (el) {
382
+ do {
383
+ let elMatrix = matrix(el),
384
+ scaleX = elMatrix.a,
385
+ scaleY = elMatrix.d;
386
+
387
+ offsetLeft += el.scrollLeft * scaleX;
388
+ offsetTop += el.scrollTop * scaleY;
389
+ } while (el !== winScroller && (el = el.parentNode));
390
+ }
391
+
392
+ return [offsetLeft, offsetTop];
393
+ }
394
+
395
+ /**
396
+ * Returns the index of the object within the given array
397
+ * @param {Array} arr Array that may or may not hold the object
398
+ * @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find
399
+ * @return {Number} The index of the object in the array, or -1
400
+ */
401
+ function indexOfObject(arr, obj) {
402
+ for (let i in arr) {
403
+ if (!arr.hasOwnProperty(i)) continue;
404
+ for (let key in obj) {
405
+ if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);
406
+ }
407
+ }
408
+ return -1;
409
+ }
410
+
411
+
412
+ function getParentAutoScrollElement(el, includeSelf) {
413
+ // skip to window
414
+ if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();
415
+
416
+ let elem = el;
417
+ let gotSelf = false;
418
+ do {
419
+ // we don't need to get elem css if it isn't even overflowing in the first place (performance)
420
+ if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {
421
+ let elemCSS = css(elem);
422
+ if (
423
+ elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') ||
424
+ elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')
425
+ ) {
426
+ if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();
427
+
428
+ if (gotSelf || includeSelf) return elem;
429
+ gotSelf = true;
430
+ }
431
+ }
432
+ /* jshint boss:true */
433
+ } while (elem = elem.parentNode);
434
+
435
+ return getWindowScrollingElement();
436
+ }
437
+
438
+ function extend(dst, src) {
439
+ if (dst && src) {
440
+ for (let key in src) {
441
+ if (src.hasOwnProperty(key)) {
442
+ dst[key] = src[key];
443
+ }
444
+ }
445
+ }
446
+
447
+ return dst;
448
+ }
449
+
450
+
451
+ function isRectEqual(rect1, rect2) {
452
+ return Math.round(rect1.top) === Math.round(rect2.top) &&
453
+ Math.round(rect1.left) === Math.round(rect2.left) &&
454
+ Math.round(rect1.height) === Math.round(rect2.height) &&
455
+ Math.round(rect1.width) === Math.round(rect2.width);
456
+ }
457
+
458
+
459
+ let _throttleTimeout;
460
+ function throttle(callback, ms) {
461
+ return function () {
462
+ if (!_throttleTimeout) {
463
+ let args = arguments,
464
+ _this = this;
465
+
466
+ if (args.length === 1) {
467
+ callback.call(_this, args[0]);
468
+ } else {
469
+ callback.apply(_this, args);
470
+ }
471
+
472
+ _throttleTimeout = setTimeout(function () {
473
+ _throttleTimeout = void 0;
474
+ }, ms);
475
+ }
476
+ };
477
+ }
478
+
479
+
480
+ function cancelThrottle() {
481
+ clearTimeout(_throttleTimeout);
482
+ _throttleTimeout = void 0;
483
+ }
484
+
485
+
486
+ function scrollBy(el, x, y) {
487
+ el.scrollLeft += x;
488
+ el.scrollTop += y;
489
+ }
490
+
491
+
492
+ function clone(el) {
493
+ let Polymer = window.Polymer;
494
+ let $ = window.jQuery || window.Zepto;
495
+
496
+ if (Polymer && Polymer.dom) {
497
+ return Polymer.dom(el).cloneNode(true);
498
+ }
499
+ else if ($) {
500
+ return $(el).clone(true)[0];
501
+ }
502
+ else {
503
+ return el.cloneNode(true);
504
+ }
505
+ }
506
+
507
+
508
+ function setRect(el, rect) {
509
+ css(el, 'position', 'absolute');
510
+ css(el, 'top', rect.top);
511
+ css(el, 'left', rect.left);
512
+ css(el, 'width', rect.width);
513
+ css(el, 'height', rect.height);
514
+ }
515
+
516
+ function unsetRect(el) {
517
+ css(el, 'position', '');
518
+ css(el, 'top', '');
519
+ css(el, 'left', '');
520
+ css(el, 'width', '');
521
+ css(el, 'height', '');
522
+ }
523
+
524
+
525
+ const expando = 'Sortable' + (new Date).getTime();
526
+
527
+
528
+ export {
529
+ on,
530
+ off,
531
+ matches,
532
+ getParentOrHost,
533
+ closest,
534
+ toggleClass,
535
+ css,
536
+ matrix,
537
+ find,
538
+ getWindowScrollingElement,
539
+ getRect,
540
+ isScrolledPast,
541
+ getChild,
542
+ lastChild,
543
+ index,
544
+ getRelativeScrollOffset,
545
+ indexOfObject,
546
+ getParentAutoScrollElement,
547
+ extend,
548
+ isRectEqual,
549
+ throttle,
550
+ cancelThrottle,
551
+ scrollBy,
552
+ clone,
553
+ setRect,
554
+ unsetRect,
555
+ expando
556
+ };