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.
- package/README.md +31 -0
- package/client/archive/bundle.js +11528 -0
- package/client/archive/golem.html +60 -0
- package/client/archive/golemClient.js +595 -0
- package/client/archive/golembundle.js +11634 -0
- package/client/archive/sequencer.html +43 -0
- package/client/archive/sequenceurClient.js +815 -0
- package/client/archive/stylegolem.css +158 -0
- package/client/archive/stylesequenceur.css +204 -0
- package/client/clientListe/Sortable-master/.circleci/config.yml +33 -0
- package/client/clientListe/Sortable-master/.editorconfig +15 -0
- package/client/clientListe/Sortable-master/.github/ISSUE_TEMPLATE/bug-report.md +73 -0
- package/client/clientListe/Sortable-master/.github/ISSUE_TEMPLATE/custom-template.md +48 -0
- package/client/clientListe/Sortable-master/.github/ISSUE_TEMPLATE/feature-request.md +41 -0
- package/client/clientListe/Sortable-master/.jshintrc +25 -0
- package/client/clientListe/Sortable-master/.testcaferc.json +7 -0
- package/client/clientListe/Sortable-master/CONTRIBUTING.md +26 -0
- package/client/clientListe/Sortable-master/LICENSE +21 -0
- package/client/clientListe/Sortable-master/README.md +813 -0
- package/client/clientListe/Sortable-master/Sortable.js +3709 -0
- package/client/clientListe/Sortable-master/Sortable.min.js +2 -0
- package/client/clientListe/Sortable-master/Sortable.min.old.js +2 -0
- package/client/clientListe/Sortable-master/Sortable.min.old.old.js +2 -0
- package/client/clientListe/Sortable-master/babel.config.js +27 -0
- package/client/clientListe/Sortable-master/bower.json +30 -0
- package/client/clientListe/Sortable-master/entry/entry-complete.js +8 -0
- package/client/clientListe/Sortable-master/entry/entry-core.js +19 -0
- package/client/clientListe/Sortable-master/entry/entry-defaults.js +19 -0
- package/client/clientListe/Sortable-master/index.html +460 -0
- package/client/clientListe/Sortable-master/modular/sortable.complete.esm.js +3701 -0
- package/client/clientListe/Sortable-master/modular/sortable.core.esm.js +3698 -0
- package/client/clientListe/Sortable-master/modular/sortable.esm.js +3699 -0
- package/client/clientListe/Sortable-master/package-lock.json +5704 -0
- package/client/clientListe/Sortable-master/package.json +56 -0
- package/client/clientListe/Sortable-master/plugins/AutoScroll/AutoScroll.js +270 -0
- package/client/clientListe/Sortable-master/plugins/AutoScroll/README.md +80 -0
- package/client/clientListe/Sortable-master/plugins/AutoScroll/index.js +1 -0
- package/client/clientListe/Sortable-master/plugins/MultiDrag/MultiDrag.js +617 -0
- package/client/clientListe/Sortable-master/plugins/MultiDrag/README.md +96 -0
- package/client/clientListe/Sortable-master/plugins/MultiDrag/index.js +1 -0
- package/client/clientListe/Sortable-master/plugins/OnSpill/OnSpill.js +79 -0
- package/client/clientListe/Sortable-master/plugins/OnSpill/README.md +60 -0
- package/client/clientListe/Sortable-master/plugins/OnSpill/index.js +1 -0
- package/client/clientListe/Sortable-master/plugins/README.md +178 -0
- package/client/clientListe/Sortable-master/plugins/Swap/README.md +55 -0
- package/client/clientListe/Sortable-master/plugins/Swap/Swap.js +90 -0
- package/client/clientListe/Sortable-master/plugins/Swap/index.js +1 -0
- package/client/clientListe/Sortable-master/scripts/banner.js +8 -0
- package/client/clientListe/Sortable-master/scripts/build.js +17 -0
- package/client/clientListe/Sortable-master/scripts/esm-build.js +28 -0
- package/client/clientListe/Sortable-master/scripts/minify.js +11 -0
- package/client/clientListe/Sortable-master/scripts/test-compat.js +30 -0
- package/client/clientListe/Sortable-master/scripts/test.js +21 -0
- package/client/clientListe/Sortable-master/scripts/umd-build.js +15 -0
- package/client/clientListe/Sortable-master/src/Animation.js +175 -0
- package/client/clientListe/Sortable-master/src/BrowserInfo.js +12 -0
- package/client/clientListe/Sortable-master/src/EventDispatcher.js +57 -0
- package/client/clientListe/Sortable-master/src/PluginManager.js +87 -0
- package/client/clientListe/Sortable-master/src/Sortable.js +1971 -0
- package/client/clientListe/Sortable-master/src/utils.js +556 -0
- package/client/clientListe/Sortable-master/st/app.js +224 -0
- package/client/clientListe/Sortable-master/st/iframe/frame.html +32 -0
- package/client/clientListe/Sortable-master/st/iframe/index.html +49 -0
- package/client/clientListe/Sortable-master/st/logo.png +0 -0
- package/client/clientListe/Sortable-master/st/og-image.png +0 -0
- package/client/clientListe/Sortable-master/st/prettify/prettify.css +1 -0
- package/client/clientListe/Sortable-master/st/prettify/prettify.js +46 -0
- package/client/clientListe/Sortable-master/st/prettify/run_prettify.js +64 -0
- package/client/clientListe/Sortable-master/st/saucelabs.svg +1 -0
- package/client/clientListe/Sortable-master/st/theme.css +254 -0
- package/client/clientListe/Sortable-master/tests/Sortable.compat.test.js +39 -0
- package/client/clientListe/Sortable-master/tests/Sortable.test.js +386 -0
- package/client/clientListe/Sortable-master/tests/dual-list.html +34 -0
- package/client/clientListe/Sortable-master/tests/empty-list.html +30 -0
- package/client/clientListe/Sortable-master/tests/filter.html +27 -0
- package/client/clientListe/Sortable-master/tests/handles.html +27 -0
- package/client/clientListe/Sortable-master/tests/nested.html +67 -0
- package/client/clientListe/Sortable-master/tests/single-list.html +25 -0
- package/client/clientListe/Sortable-master/tests/style.css +18 -0
- package/client/clientListe/clientListe.html +148 -0
- package/client/clientListe/clientListe.js +1508 -0
- package/client/clientListe/clientListebundle.js +13164 -0
- package/client/clientListe/images/poubelle.png +0 -0
- package/client/clientListe/images/start.png +0 -0
- package/client/clientListe/images/stop.png +0 -0
- package/client/clientListe/images/submit.png +0 -0
- package/client/clientListe/sortable-theme-bootstrap.css +90 -0
- package/client/configurateur/configReact.js +273 -0
- package/client/configurateur/configReactbundle.js +295 -0
- package/client/configurateur/configurateur.css +95 -0
- package/client/configurateur/configurateur.html +48 -0
- package/client/configurateur/lib/jexcel.css +755 -0
- package/client/configurateur/lib/jexcel.js +14970 -0
- package/client/configurateur/lib/jsuites.css +2801 -0
- package/client/configurateur/lib/jsuites.js +11822 -0
- package/client/configurateur/lib/react-dom.production.min.js +239 -0
- package/client/configurateur/lib/react.production.min.js +32 -0
- package/client/configurateur/src/configReact.js +247 -0
- package/client/controleur/clientcontroleur.js +536 -0
- package/client/controleur/clientcontroleur.test.js +282 -0
- package/client/controleur/controleur.html +51 -0
- package/client/controleur/controleurbundle.js +565 -0
- package/client/controleur/stylecontroleur.css +236 -0
- package/client/controleurHH/controleurHH.html +71 -0
- package/client/controleurHH/controleurHH.js +252 -0
- package/client/controleurHH/styles/index.css +320 -0
- package/client/controleurHH/styles/material.css +11552 -0
- package/client/parametrage/paramReact.js +473 -0
- package/client/parametrage/paramReactbundle.js +500 -0
- package/client/parametrage/parametrage.css +111 -0
- package/client/parametrage/parametrage.html +163 -0
- package/client/parametrage/src/paramReact.js +459 -0
- package/client/score/hash.js +83 -0
- package/client/score/p5.min.js +3 -0
- package/client/score/parto1.js +1171 -0
- package/client/score/parto1bundle.js +1181 -0
- package/client/score/processing.min.js +431 -0
- package/client/score/score.html +15 -0
- package/client/score/score.js +34 -0
- package/client/simulateurListe/simulateurFork.js +750 -0
- package/client/simulateurListe/simulateurFork.mjs +681 -0
- package/client/simulateurListe/simulateurForkSansReorg.js +569 -0
- package/client/simulateurListe/simulateurListe.js +628 -0
- package/myReact/archive/Nodeemitvaluedlocal1.hh.js +52 -0
- package/myReact/archive/abort-parNode.js +79 -0
- package/myReact/archive/abroNode.js +169 -0
- package/myReact/archive/abroNode2.js +80 -0
- package/myReact/archive/atom.compile.hh.js +51 -0
- package/myReact/archive/await-countNode.js +67 -0
- package/myReact/archive/await-nowvalNode.js +44 -0
- package/myReact/archive/callHH.js +96 -0
- package/myReact/archive/emit-if2.hh.compiled.js +113 -0
- package/myReact/archive/every1Node.js +35 -0
- package/myReact/archive/if-runNode.js +74 -0
- package/myReact/archive/if1Node.js +43 -0
- package/myReact/archive/makeawait.js +0 -0
- package/myReact/archive/myReact.old.js +684 -0
- package/myReact/archive/orchestration.js +281 -0
- package/myReact/archive/orchestration1.js +132 -0
- package/myReact/archive/orchestration1.xml +465 -0
- package/myReact/archive/orchestration2.js +161 -0
- package/myReact/archive/orchestrationHH.mano.js +280 -0
- package/myReact/archive/orchestrationHHTest.js +428 -0
- package/myReact/archive/orchestrationHHTest.xml +234 -0
- package/myReact/archive/orchestrationHHTestRun.js +104 -0
- package/myReact/archive/orchestrationHHTestRun.xml +34 -0
- package/myReact/archive/orchestrationTest0.js +178 -0
- package/myReact/archive/orchestrationTest1.js +181 -0
- package/myReact/archive/orchestrationTest2.js +281 -0
- package/myReact/archive/run3pointsNode.js +59 -0
- package/myReact/archive/runNode.js +123 -0
- package/myReact/archive/runNode2.js +91 -0
- package/myReact/archive/testAwait1.js +141 -0
- package/myReact/archive/testAwait1.xml +86 -0
- package/myReact/archive/testEvery1.js +122 -0
- package/myReact/archive/testEvery1.xml +79 -0
- package/myReact/archive/testHH1.js +135 -0
- package/myReact/archive/testHH1.xml +86 -0
- package/myReact/archive/testHH1revu.js +104 -0
- package/myReact/archive/testHH2.js +122 -0
- package/myReact/archive/testHH2.xml +79 -0
- package/myReact/archive/testHH3.js +130 -0
- package/myReact/archive/testHH3.xml +86 -0
- package/myReact/archive/testHHabort.js +121 -0
- package/myReact/archive/testHHabort.xml +83 -0
- package/myReact/archive/testMakeawait.js +202 -0
- package/myReact/archive/testRun1.js +168 -0
- package/myReact/archive/testRun1.xml +142 -0
- package/myReact/archive/titi.js +28 -0
- package/myReact/archive/titi.xml +110 -0
- package/myReact/archive/toto.js +73 -0
- package/myReact/archive/toto.xml +198 -0
- package/myReact/archive/trap-await-parallelNode.js +123 -0
- package/myReact/inutiles/hiver2022.xml +804 -0
- package/myReact/inutiles/hopeNode.xml +459 -0
- package/myReact/inutiles/mars2022.xml +871 -0
- package/myReact/inutiles/mystique1.xml +318 -0
- package/myReact/inutiles/mystiqueOSC.xml +277 -0
- package/myReact/inutiles/opus5Node.xml +1271 -0
- package/myReact/inutiles/opus5NodeLinux.xml +1241 -0
- package/myReact/inutiles/orchestrationHH.xml +541 -0
- package/myReact/inutiles/orchestrationHH2.xml +547 -0
- package/myReact/inutiles/testHH.xml +95 -0
- package/myReact/inutiles/trouveLaPercuTenor.xml +349 -0
- package/myReact/myReact.js +744 -0
- package/myReact/myReact.min.js +1 -0
- package/myReact/orchestrationHH.js +311 -0
- package/myReact/orchestrationHH.mjs +436 -0
- package/myReact/orchestrationHH.mjs.map +1 -0
- package/package.json +46 -0
- package/serveur/OSCandMidi.mjs +361 -0
- package/serveur/computeScore.mjs +415 -0
- package/serveur/controleDAW.mjs +1149 -0
- package/serveur/defaultSession.csv +2 -0
- package/serveur/defaultSkiniParametres.js +119 -0
- package/serveur/gameOSC.mjs +96 -0
- package/serveur/groupeClientsSons.mjs +1014 -0
- package/serveur/ipConfig.json +24 -0
- package/serveur/ipConfig127.json +19 -0
- package/serveur/ipConfig75.json +17 -0
- package/serveur/ipConfigBH.json +19 -0
- package/serveur/ipConfigLocal.json +19 -0
- package/serveur/midiConfig.json +26 -0
- package/serveur/midiConfigBH.json +26 -0
- package/serveur/midiConfigVoid.json +3 -0
- package/serveur/midimix.mjs +570 -0
- package/serveur/saveParam.mjs +159 -0
- package/serveur/skiniParametres.good.js +132 -0
- package/serveur/skiniParametres.js +106 -0
- package/serveur/utilsHHSkini.hh.js +64 -0
- package/serveur/utilsSkini.mjs +137 -0
- package/serveur/websocketServer.mjs +2052 -0
- package/serveur/workerInterfaceZ.mjs +327 -0
- package/serveur/workerSynchro.mjs +49 -0
- package/skini.mjs +141 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { getChild } from '../../src/utils.js';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const drop = function({
|
|
5
|
+
originalEvent,
|
|
6
|
+
putSortable,
|
|
7
|
+
dragEl,
|
|
8
|
+
activeSortable,
|
|
9
|
+
dispatchSortableEvent,
|
|
10
|
+
hideGhostForTarget,
|
|
11
|
+
unhideGhostForTarget
|
|
12
|
+
}) {
|
|
13
|
+
if (!originalEvent) return;
|
|
14
|
+
let toSortable = putSortable || activeSortable;
|
|
15
|
+
hideGhostForTarget();
|
|
16
|
+
let touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;
|
|
17
|
+
let target = document.elementFromPoint(touch.clientX, touch.clientY);
|
|
18
|
+
unhideGhostForTarget();
|
|
19
|
+
if (toSortable && !toSortable.el.contains(target)) {
|
|
20
|
+
dispatchSortableEvent('spill');
|
|
21
|
+
this.onSpill({ dragEl, putSortable });
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function Revert() {}
|
|
26
|
+
|
|
27
|
+
Revert.prototype = {
|
|
28
|
+
startIndex: null,
|
|
29
|
+
dragStart({ oldDraggableIndex }) {
|
|
30
|
+
this.startIndex = oldDraggableIndex;
|
|
31
|
+
},
|
|
32
|
+
onSpill({ dragEl, putSortable }) {
|
|
33
|
+
this.sortable.captureAnimationState();
|
|
34
|
+
if (putSortable) {
|
|
35
|
+
putSortable.captureAnimationState();
|
|
36
|
+
}
|
|
37
|
+
let nextSibling = getChild(this.sortable.el, this.startIndex, this.options);
|
|
38
|
+
|
|
39
|
+
if (nextSibling) {
|
|
40
|
+
this.sortable.el.insertBefore(dragEl, nextSibling);
|
|
41
|
+
} else {
|
|
42
|
+
this.sortable.el.appendChild(dragEl);
|
|
43
|
+
}
|
|
44
|
+
this.sortable.animateAll();
|
|
45
|
+
if (putSortable) {
|
|
46
|
+
putSortable.animateAll();
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
drop
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
Object.assign(Revert, {
|
|
53
|
+
pluginName: 'revertOnSpill'
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
function Remove() {}
|
|
58
|
+
|
|
59
|
+
Remove.prototype = {
|
|
60
|
+
onSpill({ dragEl, putSortable }) {
|
|
61
|
+
const parentSortable = putSortable || this.sortable;
|
|
62
|
+
parentSortable.captureAnimationState();
|
|
63
|
+
dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);
|
|
64
|
+
parentSortable.animateAll();
|
|
65
|
+
},
|
|
66
|
+
drop
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
Object.assign(Remove, {
|
|
70
|
+
pluginName: 'removeOnSpill'
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
export default [Remove, Revert];
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
Remove as RemoveOnSpill,
|
|
78
|
+
Revert as RevertOnSpill
|
|
79
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# OnSpill Plugins
|
|
2
|
+
This file contains two seperate plugins, RemoveOnSpill and RevertOnSpill. They can be imported individually, or the default export (an array of both plugins) can be passed to `Sortable.mount` as well.
|
|
3
|
+
|
|
4
|
+
**These plugins are default plugins, and are included in the default UMD and ESM builds of Sortable**
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Mounting
|
|
11
|
+
```js
|
|
12
|
+
import { Sortable, OnSpill } from 'sortablejs/modular/sortable.core.esm';
|
|
13
|
+
|
|
14
|
+
Sortable.mount(OnSpill);
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## RevertOnSpill Plugin
|
|
22
|
+
This plugin, when enabled, will cause the dragged item to be reverted to it's original position if it is spilled (ie. it is dropped outside of a valid Sortable drop target)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Options
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
new Sortable(el, {
|
|
31
|
+
revertOnSpill: true, // Enable plugin
|
|
32
|
+
// Called when item is spilled
|
|
33
|
+
onSpill: function(/**Event*/evt) {
|
|
34
|
+
evt.item // The spilled item
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## RemoveOnSpill Plugin
|
|
44
|
+
This plugin, when enabled, will cause the dragged item to be removed from the DOM if it is spilled (ie. it is dropped outside of a valid Sortable drop target)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
### Options
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
new Sortable(el, {
|
|
54
|
+
removeOnSpill: true, // Enable plugin
|
|
55
|
+
// Called when item is spilled
|
|
56
|
+
onSpill: function(/**Event*/evt) {
|
|
57
|
+
evt.item // The spilled item
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, RemoveOnSpill, RevertOnSpill } from './OnSpill.js';
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# Creating Sortable Plugins
|
|
2
|
+
Sortable plugins are plugins that can be directly mounted to the Sortable class. They are a powerful way of modifying the default behaviour of Sortable beyond what simply using events alone allows. To mount your plugin to Sortable, it must pass a constructor function to the `Sortable.mount` function. This constructor function will be called (with the `new` keyword in front of it) whenever a Sortable instance with your plugin enabled is initialized. The constructor function will be called with the parameters `sortable` and `el`, which is the HTMLElement that the Sortable is being initialized on. This means that there will be a new instance of your plugin each time it is enabled in a Sortable.
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Constructor Parameters
|
|
6
|
+
|
|
7
|
+
`sortable: Sortable` — The sortable that the plugin is being initialized on
|
|
8
|
+
|
|
9
|
+
`el: HTMLElement` — The element that the sortable is being initialized on
|
|
10
|
+
|
|
11
|
+
`options: Object` — The options object that the user has passed into Sortable (not merged with defaults yet)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Static Properties
|
|
15
|
+
The constructor function passed to `Sortable.mount` may contain several static properties and methods. The following static properties may be defined:
|
|
16
|
+
|
|
17
|
+
`pluginName: String` (Required)
|
|
18
|
+
The name of the option that the user will use in their sortable's options to enable the plugin. Should start with a lower case and be camel-cased. For example: `'multiDrag'`. This is also the property name that the plugin's instance will be under in a sortable instance (ex. `sortableInstance.multiDrag`).
|
|
19
|
+
|
|
20
|
+
`utils: Object`
|
|
21
|
+
Object containing functions that will be added to the `Sortable.utils` static object on the Sortable class.
|
|
22
|
+
|
|
23
|
+
`eventOptions(eventName: String): Function`
|
|
24
|
+
A function that is called whenever Sortable fires an event. This function should return an object to be combined with the event object that Sortable will emit. The function will be called in the context of the instance of the plugin on the Sortable that is firing the event (ie. the `this` keyword will be the plugin instance).
|
|
25
|
+
|
|
26
|
+
`initializeByDefault: Boolean`
|
|
27
|
+
Determines whether or not the plugin will always be initialized on every new Sortable instance. If this option is enabled, it does not mean that by default the plugin will be enabled on the Sortable - this must still be done in the options via the plugin's `pluginName`, or it can be enabled by default if your plugin specifies it's pluginName as a default option that is truthy. Since the plugin will already be initialized on every Sortable instance, it can also be enabled dynamically via `sortableInstance.option('pluginName', true)`.
|
|
28
|
+
It is a good idea to have this option set to `false` if the plugin modifies the behaviour of Sortable in such a way that enabling or disabling the plugin dynamically could cause it to break. Likewise, this option should be disabled if the plugin should only be instantiated on Sortables in which that plugin is enabled.
|
|
29
|
+
This option defaults to `true`.
|
|
30
|
+
|
|
31
|
+
`optionListeners: Object`
|
|
32
|
+
An object that may contain event listeners that are fired when a specific option is updated.
|
|
33
|
+
These listeners are useful because the user's provided options are not necessarily unchanging once the plugin is initialized, and could be changed dynamically via the `option()` method.
|
|
34
|
+
The listener will be fired in the context of the instance of the plugin that it is being changed in (ie. the `this` keyword will be the instance of your plugin).
|
|
35
|
+
The name of the method should match the name of the option it listens for. The new value of the option will be passed in as an argument, and any returned value will be what the option is stored as. If no value is returned, the option will be stored as the value the user provided.
|
|
36
|
+
|
|
37
|
+
Example:
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
Plugin.name = 'generateTitle';
|
|
41
|
+
Plugin.optionListeners = {
|
|
42
|
+
// Listen for option 'generateTitle'
|
|
43
|
+
generateTitle: function(title) {
|
|
44
|
+
// Store the option in all caps
|
|
45
|
+
return title.toUpperCase();
|
|
46
|
+
|
|
47
|
+
// OR save it to this instance of your plugin as a private field.
|
|
48
|
+
// This way it can be accessed in events, but will not modify the user's options.
|
|
49
|
+
this.titleAllCaps = title.toUpperCase();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Plugin Options
|
|
56
|
+
Plugins may have custom default options or may override the defaults of other options. In order to do this, there must be a `defaults` object on the initialized plugin. This can be set in the plugin's prototype, or during the initialization of the plugin (when the `el` is available). For example:
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
function myPlugin(sortable, el, options) {
|
|
60
|
+
this.defaults = {
|
|
61
|
+
color: el.style.backgroundColor
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
Sortable.mount(myPlugin);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
## Plugin Events
|
|
70
|
+
|
|
71
|
+
### Context
|
|
72
|
+
The events will be fired in the context of their own parent object (ie. context is not changed), however the plugin instance's Sortable instance is available under `this.sortable`. Likewise, the options are available under `this.options`.
|
|
73
|
+
|
|
74
|
+
### Event List
|
|
75
|
+
The following table contains details on the events that a plugin may handle in the prototype of the plugin's constructor function.
|
|
76
|
+
|
|
77
|
+
| Event Name | Description | Cancelable? | Cancel Behaviour | Event Type | Custom Event Object Properties |
|
|
78
|
+
|---------------------------|------------------------------------------------------------------------------------------------------------------|-------------|----------------------------------------------------|------------|-------------------------------------------------------------------------|
|
|
79
|
+
| filter | Fired when the element is filtered, and dragging is therefore canceled | No | - | Normal | None |
|
|
80
|
+
| delayStart | Fired when the delay starts, even if there is no delay | Yes | Cancels sorting | Normal | None |
|
|
81
|
+
| delayEnded | Fired when the delay ends, even if there is no delay | Yes | Cancels sorting | Normal | None |
|
|
82
|
+
| setupClone | Fired when Sortable clones the dragged element | Yes | Cancels normal clone setup | Normal | None |
|
|
83
|
+
| dragStart | Fired when the dragging is first started | Yes | Cancels sorting | Normal | None |
|
|
84
|
+
| clone | Fired when the clone is inserted into the DOM (if `removeCloneOnHide: false`). Tick after dragStart. | Yes | Cancels normal clone insertion & hiding | Normal | None |
|
|
85
|
+
| dragStarted | Fired tick after dragStart | No | - | Normal | None |
|
|
86
|
+
| dragOver | Fired when the user drags over a sortable | Yes | Cancels normal dragover behaviour | DragOver | None |
|
|
87
|
+
| dragOverValid | Fired when the user drags over a sortable that the dragged item can be inserted into | Yes | Cancels normal valid dragover behaviour | DragOver | None |
|
|
88
|
+
| revert | Fired when the dragged item is reverted to it's original position when entering it's `sort:false` root | Yes | Cancels normal reverting, but is still completed() | DragOver | None |
|
|
89
|
+
| dragOverCompleted | Fired when dragOver is completed (ie. bubbling is disabled). To check if inserted, use `inserted` even property. | No | - | DragOver | `insertion: Boolean` — Whether or not the dragged element was inserted |
|
|
90
|
+
| dragOverAnimationCapture | Fired right before the animation state is captured in dragOver | No | - | DragOver | None |
|
|
91
|
+
| dragOverAnimationComplete | Fired after the animation is completed after a dragOver insertion | No | - | DragOver | None |
|
|
92
|
+
| drop | Fired on drop | Yes | Cancels normal drop behavior | Normal | None |
|
|
93
|
+
| nulling | Fired when the plugin should preform cleanups, once all drop events have fired | No | - | Normal | None |
|
|
94
|
+
| destroy | Fired when Sortable is destroyed | No | - | Normal | None |
|
|
95
|
+
|
|
96
|
+
### Global Events
|
|
97
|
+
Normally, an event will only be fired in a plugin if the plugin is enabled on the Sortable from which the event is being fired. However, it sometimes may be desirable for a plugin to listen in on an event from Sortables in which it is not enabled on. This is possible with global events. For an event to be global, simply add the suffix 'Global' to the event's name (casing matters) (eg. `dragStartGlobal`).
|
|
98
|
+
Please note that your plugin must be initialized on any Sortable from which it expects to recieve events, and that includes global events. In other words, you will want to keep the `initializeByDefault` option as it's default `true` value if your plugin needs to recieve events from Sortables it is not enabled on.
|
|
99
|
+
Please also note that if both normal and global event handlers are set, the global event handler will always be fired before the regular one.
|
|
100
|
+
|
|
101
|
+
### Event Object
|
|
102
|
+
An object with the following properties is passed as an argument to each plugin event when it is fired.
|
|
103
|
+
|
|
104
|
+
#### Properties:
|
|
105
|
+
|
|
106
|
+
`dragEl: HTMLElement` — The element being dragged
|
|
107
|
+
|
|
108
|
+
`parentEl: HTMLElement` — The element that the dragged element is currently in
|
|
109
|
+
|
|
110
|
+
`ghostEl: HTMLElement|undefined` — If using fallback, the element dragged under the cursor (undefined until after `dragStarted` plugin event)
|
|
111
|
+
|
|
112
|
+
`rootEl: HTMLElement` — The element that the dragged element originated from
|
|
113
|
+
|
|
114
|
+
`nextEl: HTMLElement` — The original next sibling of dragEl
|
|
115
|
+
|
|
116
|
+
`cloneEl: HTMLElement|undefined` — The clone element (undefined until after `setupClone` plugin event)
|
|
117
|
+
|
|
118
|
+
`cloneHidden: Boolean` — Whether or not the clone is hidden
|
|
119
|
+
|
|
120
|
+
`dragStarted: Boolean` — Boolean indicating whether or not the dragStart event has fired
|
|
121
|
+
|
|
122
|
+
`putSortable: Sortable|undefined` — The element that dragEl is dragged into from it's root, otherwise undefined
|
|
123
|
+
|
|
124
|
+
`activeSortable: Sortable` — The active Sortable instance
|
|
125
|
+
|
|
126
|
+
`originalEvent: Event` — The original HTML event corresponding to the Sortable event
|
|
127
|
+
|
|
128
|
+
`oldIndex: Number` — The old index of dragEl
|
|
129
|
+
|
|
130
|
+
`oldDraggableIndex: Number` — The old index of dragEl, only counting draggable elements
|
|
131
|
+
|
|
132
|
+
`newIndex: Number` — The new index of dragEl
|
|
133
|
+
|
|
134
|
+
`newDraggableIndex: Number` — The new index of dragEl, only counting draggable elements
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
#### Methods:
|
|
138
|
+
|
|
139
|
+
`cloneNowHidden()` — Function to be called if the plugin has hidden the clone
|
|
140
|
+
|
|
141
|
+
`cloneNowShown()` — Function to be called if the plugin has shown the clone
|
|
142
|
+
|
|
143
|
+
`hideGhostForTarget()` — Hides the fallback ghost element if CSS pointer-events are not available. Call this before using document.elementFromPoint at the mouse position.
|
|
144
|
+
|
|
145
|
+
`unhideGhostForTarget()` — Unhides the ghost element. To be called after `hideGhostForTarget()`.
|
|
146
|
+
|
|
147
|
+
`dispatchSortableEvent(eventName: String)` — Function that can be used to emit an event on the current sortable while sorting, with all usual event properties set (eg. indexes, rootEl, cloneEl, originalEvent, etc.).
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
### DragOverEvent Object
|
|
151
|
+
This event is passed to dragover events, and extends the normal event object.
|
|
152
|
+
|
|
153
|
+
#### Properties:
|
|
154
|
+
|
|
155
|
+
`isOwner: Boolean` — Whether or not the dragged over sortable currently contains the dragged element
|
|
156
|
+
|
|
157
|
+
`axis: String` — Direction of the dragged over sortable, `'vertical'` or `'horizontal'`
|
|
158
|
+
|
|
159
|
+
`revert: Boolean` — Whether or not the dragged element is being reverted to it's original position from another position
|
|
160
|
+
|
|
161
|
+
`dragRect: DOMRect` — DOMRect of the dragged element
|
|
162
|
+
|
|
163
|
+
`targetRect: DOMRect` — DOMRect of the target element
|
|
164
|
+
|
|
165
|
+
`canSort: Boolean` — Whether or not sorting is enabled in the dragged over sortable
|
|
166
|
+
|
|
167
|
+
`fromSortable: Sortable` — The sortable that the dragged element is coming from
|
|
168
|
+
|
|
169
|
+
`target: HTMLElement` — The sortable item that is being dragged over
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
#### Methods:
|
|
173
|
+
|
|
174
|
+
`onMove(target: HTMLElement, after: Boolean): Boolean|Number` — Calls the `onMove` function the user specified in the options
|
|
175
|
+
|
|
176
|
+
`changed()` — Fires the `onChange` event with event properties preconfigured
|
|
177
|
+
|
|
178
|
+
`completed(insertion: Boolean)` — Should be called when dragover has "completed", meaning bubbling should be stopped. If `insertion` is `true`, Sortable will treat it as if the dragged element was inserted into the sortable, and hide/show clone, set ghost class, animate, etc.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
## Swap Plugin
|
|
2
|
+
This plugin modifies the behaviour of Sortable to allow for items to be swapped with eachother rather than sorted. Once dragging starts, the user can drag over other items and there will be no change in the elements. However, the item that the user drops on will be swapped with the originally dragged item.
|
|
3
|
+
|
|
4
|
+
Demo: https://jsbin.com/yejehog/edit?html,js,output
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Mounting
|
|
11
|
+
```js
|
|
12
|
+
import { Sortable, Swap } from 'sortablejs/modular/sortable.core.esm';
|
|
13
|
+
|
|
14
|
+
Sortable.mount(new Swap());
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Options
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
new Sortable(el, {
|
|
25
|
+
swap: true, // Enable swap mode
|
|
26
|
+
swapClass: "sortable-swap-highlight" // Class name for swap item (if swap mode is enabled)
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
#### `swapClass` option
|
|
35
|
+
Class name for the item to be swapped with, if swap mode is enabled. Defaults to `sortable-swap-highlight`.
|
|
36
|
+
|
|
37
|
+
```css
|
|
38
|
+
.highlighted {
|
|
39
|
+
background-color: #9AB6F1;
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
Sortable.create(list, {
|
|
45
|
+
swap: true,
|
|
46
|
+
swapClass: "highlighted"
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Event Properties
|
|
55
|
+
- swapItem:`HTMLElement|undefined` — The element that the dragged element was swapped with
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import {
|
|
2
|
+
toggleClass,
|
|
3
|
+
index
|
|
4
|
+
} from '../../src/utils.js';
|
|
5
|
+
|
|
6
|
+
let lastSwapEl;
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
function SwapPlugin() {
|
|
10
|
+
function Swap() {
|
|
11
|
+
this.defaults = {
|
|
12
|
+
swapClass: 'sortable-swap-highlight'
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
Swap.prototype = {
|
|
17
|
+
dragStart({ dragEl }) {
|
|
18
|
+
lastSwapEl = dragEl;
|
|
19
|
+
},
|
|
20
|
+
dragOverValid({ completed, target, onMove, activeSortable, changed, cancel }) {
|
|
21
|
+
if (!activeSortable.options.swap) return;
|
|
22
|
+
let el = this.sortable.el,
|
|
23
|
+
options = this.options;
|
|
24
|
+
if (target && target !== el) {
|
|
25
|
+
let prevSwapEl = lastSwapEl;
|
|
26
|
+
if (onMove(target) !== false) {
|
|
27
|
+
toggleClass(target, options.swapClass, true);
|
|
28
|
+
lastSwapEl = target;
|
|
29
|
+
} else {
|
|
30
|
+
lastSwapEl = null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (prevSwapEl && prevSwapEl !== lastSwapEl) {
|
|
34
|
+
toggleClass(prevSwapEl, options.swapClass, false);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
changed();
|
|
38
|
+
|
|
39
|
+
completed(true);
|
|
40
|
+
cancel();
|
|
41
|
+
},
|
|
42
|
+
drop({ activeSortable, putSortable, dragEl }) {
|
|
43
|
+
let toSortable = (putSortable || this.sortable);
|
|
44
|
+
let options = this.options;
|
|
45
|
+
lastSwapEl && toggleClass(lastSwapEl, options.swapClass, false);
|
|
46
|
+
if (lastSwapEl && (options.swap || putSortable && putSortable.options.swap)) {
|
|
47
|
+
if (dragEl !== lastSwapEl) {
|
|
48
|
+
toSortable.captureAnimationState();
|
|
49
|
+
if (toSortable !== activeSortable) activeSortable.captureAnimationState();
|
|
50
|
+
swapNodes(dragEl, lastSwapEl);
|
|
51
|
+
|
|
52
|
+
toSortable.animateAll();
|
|
53
|
+
if (toSortable !== activeSortable) activeSortable.animateAll();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
nulling() {
|
|
58
|
+
lastSwapEl = null;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
return Object.assign(Swap, {
|
|
63
|
+
pluginName: 'swap',
|
|
64
|
+
eventProperties() {
|
|
65
|
+
return {
|
|
66
|
+
swapItem: lastSwapEl
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
function swapNodes(n1, n2) {
|
|
74
|
+
let p1 = n1.parentNode,
|
|
75
|
+
p2 = n2.parentNode,
|
|
76
|
+
i1, i2;
|
|
77
|
+
|
|
78
|
+
if (!p1 || !p2 || p1.isEqualNode(n2) || p2.isEqualNode(n1)) return;
|
|
79
|
+
|
|
80
|
+
i1 = index(n1);
|
|
81
|
+
i2 = index(n2);
|
|
82
|
+
|
|
83
|
+
if (p1.isEqualNode(p2) && i1 < i2) {
|
|
84
|
+
i2++;
|
|
85
|
+
}
|
|
86
|
+
p1.insertBefore(n2, p1.children[i1]);
|
|
87
|
+
p2.insertBefore(n1, p2.children[i2]);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export default SwapPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Swap.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import babel from 'rollup-plugin-babel';
|
|
2
|
+
import json from 'rollup-plugin-json';
|
|
3
|
+
import resolve from 'rollup-plugin-node-resolve';
|
|
4
|
+
import banner from './banner.js';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
output: {
|
|
9
|
+
banner,
|
|
10
|
+
name: 'Sortable'
|
|
11
|
+
},
|
|
12
|
+
plugins: [
|
|
13
|
+
json(),
|
|
14
|
+
babel(),
|
|
15
|
+
resolve()
|
|
16
|
+
]
|
|
17
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import build from './build.js';
|
|
2
|
+
|
|
3
|
+
export default ([
|
|
4
|
+
{
|
|
5
|
+
input: 'entry/entry-core.js',
|
|
6
|
+
output: Object.assign({}, build.output, {
|
|
7
|
+
file: 'modular/sortable.core.esm.js',
|
|
8
|
+
format: 'esm'
|
|
9
|
+
})
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
input: 'entry/entry-defaults.js',
|
|
13
|
+
output: Object.assign({}, build.output, {
|
|
14
|
+
file: 'modular/sortable.esm.js',
|
|
15
|
+
format: 'esm'
|
|
16
|
+
})
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
input: 'entry/entry-complete.js',
|
|
20
|
+
output: Object.assign({}, build.output, {
|
|
21
|
+
file: 'modular/sortable.complete.esm.js',
|
|
22
|
+
format: 'esm'
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
]).map(config => {
|
|
26
|
+
let buildCopy = { ...build };
|
|
27
|
+
return Object.assign(buildCopy, config);
|
|
28
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const UglifyJS = require('uglify-js'),
|
|
2
|
+
fs = require('fs'),
|
|
3
|
+
package = require('../package.json');
|
|
4
|
+
|
|
5
|
+
const banner = `/*! Sortable ${ package.version } - ${ package.license } | ${ package.repository.url } */\n`;
|
|
6
|
+
|
|
7
|
+
fs.writeFileSync(
|
|
8
|
+
`./Sortable.min.js`,
|
|
9
|
+
banner + UglifyJS.minify(fs.readFileSync(`./Sortable.js`, 'utf8')).code,
|
|
10
|
+
'utf8'
|
|
11
|
+
);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const createTestCafe = require('testcafe');
|
|
2
|
+
// Testcafe cannot test on IE < 11
|
|
3
|
+
// Testcafe testing on Chrome Android is currently broken (https://github.com/DevExpress/testcafe/issues/3948)
|
|
4
|
+
const browsers = [
|
|
5
|
+
'saucelabs:Internet Explorer@11.285:Windows 10',
|
|
6
|
+
'saucelabs:MicrosoftEdge@16.16299:Windows 10',
|
|
7
|
+
'saucelabs:iPhone XS Simulator@12.2',
|
|
8
|
+
'saucelabs:Safari@12.0:macOS 10.14',
|
|
9
|
+
'chrome:headless',
|
|
10
|
+
'firefox:headless'
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
let testcafe;
|
|
14
|
+
let runner;
|
|
15
|
+
let failedCount;
|
|
16
|
+
|
|
17
|
+
createTestCafe(null, 8000, 8001).then((tc) => {
|
|
18
|
+
testcafe = tc;
|
|
19
|
+
runner = tc.createRunner();
|
|
20
|
+
return runner
|
|
21
|
+
.src('./tests/Sortable.compat.test.js')
|
|
22
|
+
.browsers(browsers)
|
|
23
|
+
.run();
|
|
24
|
+
}).then((actualFailedCount) => {
|
|
25
|
+
// https://testcafe-discuss.devexpress.com/t/why-circleci-marked-build-as-green-even-if-this-build-contain-failed-test/726/2
|
|
26
|
+
failedCount = actualFailedCount;
|
|
27
|
+
return testcafe.close();
|
|
28
|
+
}).then(() => process.exit(failedCount));
|
|
29
|
+
|
|
30
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const createTestCafe = require('testcafe');
|
|
2
|
+
|
|
3
|
+
let testcafe;
|
|
4
|
+
let runner;
|
|
5
|
+
let failedCount;
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
createTestCafe().then((tc) => {
|
|
9
|
+
testcafe = tc;
|
|
10
|
+
runner = tc.createRunner();
|
|
11
|
+
return runner
|
|
12
|
+
.src('./tests/Sortable.test.js')
|
|
13
|
+
.browsers('chrome:headless')
|
|
14
|
+
.concurrency(3)
|
|
15
|
+
.run();
|
|
16
|
+
}).then((actualFailedCount) => {
|
|
17
|
+
failedCount = actualFailedCount;
|
|
18
|
+
console.log('FAILED COUNT', actualFailedCount)
|
|
19
|
+
return testcafe.close();
|
|
20
|
+
}).then(() => process.exit(failedCount));
|
|
21
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import build from './build.js';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export default ([
|
|
5
|
+
{
|
|
6
|
+
input: 'entry/entry-complete.js',
|
|
7
|
+
output: Object.assign({}, build.output, {
|
|
8
|
+
file: './Sortable.js',
|
|
9
|
+
format: 'umd'
|
|
10
|
+
})
|
|
11
|
+
}
|
|
12
|
+
]).map(config => {
|
|
13
|
+
let buildCopy = { ...build };
|
|
14
|
+
return Object.assign(buildCopy, config);
|
|
15
|
+
});
|