{"_id":"@adityapurwa/draggable-helper","_rev":"4-a98ed52000a9547caebca9d72a732799","name":"@adityapurwa/draggable-helper","dist-tags":{"latest":"5.0.8"},"versions":{"5.0.5":{"name":"@adityapurwa/draggable-helper","version":"5.0.5","description":"To simplify drag and drop.","main":"dist/draggable-helper.cjs.js","scripts":{"build":"rollup --config","watch":"rollup --config --watch"},"author":{"name":"phphe","email":"phphe@outlook.com","url":"https://github.com/phphe"},"contributors":[{"name":"Aditya Purwa","url":"https://github.com/adityapurwa"}],"bugs":{"url":"https://github.com/phphe/draggable-helper/issues"},"repository":{"type":"git","url":"git+https://github.com/adityapurwa/draggable-helper.git"},"devDependencies":{"@babel/preset-typescript":"^7.10.1","@rollup/plugin-babel":"^5.2.1","@rollup/plugin-typescript":"^6.0.0","prettier":"^2.1.2","rogo":"^2.0.2","rollup-plugin-typescript2":"^0.27.1","typescript":"^3.9.5"},"dependencies":{"@babel/runtime":"^7.7.7","drag-event-service":"^1.1.7","helper-js":"^2.0.0"},"license":"MIT","gitHead":"9693a9d89c9b853305d7fb941abca2f5740bfac2","homepage":"https://github.com/adityapurwa/draggable-helper#readme","_id":"@adityapurwa/draggable-helper@5.0.5","_nodeVersion":"12.15.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-tmq65QJtrIThV+bBj72sUhKM86A3C7oa+QFHfhdLwz15Tc2mDAiAZPV9rE8O8r2QAhtYe0UyM7cVsDngwlo95g==","shasum":"cddc189359c8045c337fabee06581e8048d15b9b","tarball":"https://registry.npmjs.org/@adityapurwa/draggable-helper/-/draggable-helper-5.0.5.tgz","fileCount":5,"unpackedSize":45062,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfaeINCRA9TVsSAnZWagAAe44P/1+KT6uM3NpXtCL/i255\nnpTbF8VCf+S2IVoMBJNFkLwgZyeBfHFf2moDrU33HD7QoLbE/KNQT9ImyIKA\ncW51CoPYCzdOifxYdj/laSQSxt55RgUVsEMWUacFl6ebkTxL9Pf2ITUdWvbb\nQoBTyEIW/AZg7VFtc7eoaUW+vq1+JSkRm0DshZ24RnFyH7XlYtCTrxE9BY5Z\n78TLvbm8pAZYwpnkmKBIsSQJisGI7DpPXQaZtDCaNFHFwjEIpITi6+ZU7nC4\nXNDOGzOuHokz5YDVo79N6EdYfm0F8qTrF2wjZxwTWGZokIh19te30ewtn5ur\nkRoneUuJFbH/CZ0j9NnPpgIdgHdE7DcgFfOYc/jQ7Mx9pdJuCRZgW/R17ycf\no3MbOTQakkzldXC7uiaSDDvvS1PoqCWdxUgEAVWnHQd3WJ3WevxOiaFuylnr\nrirtRF/OIGPo50DcKbYUZ9ZIP8Tun5E2J+MRR7Y2GI9AKLtGga/A/ScpLdVR\nVsUs5PPwfe/8Xe6idBsxhfH0zqZVfh4YXOcwpIHPu22w4MweRrEOHoDDA9L9\nCJ/GXDgcoZQ+W1rPkMwy1jS8mOvZbECfypEwO3LC/AuhYHSHUN9Pgh/NlrL3\n6Fmm73gLWyEb3in4QE2iwE7i9c9gzGSWPl9dqpCsOGMtEqlrkKm8VwB7XcS7\ntCyD\r\n=jbRc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC29NKmU/BVzfhYn89bH9RInMmGyfWja8PaiXPkiid2mAIhAPEkj4GzhgHN3X6O6M1fE0DLGJhTv6Rd/wim9Qt29NEI"}]},"maintainers":[{"name":"adityapurwa","email":"adityapurwa@windowslive.com"}],"_npmUser":{"name":"adityapurwa","email":"adityapurwa@windowslive.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/draggable-helper_5.0.5_1600774668812_0.2887392908644859"},"_hasShrinkwrap":false},"5.0.6":{"name":"@adityapurwa/draggable-helper","version":"5.0.6","description":"To simplify drag and drop.","main":"dist/draggable-helper.cjs.js","types":"dist/index.d.ts","scripts":{"build":"rollup --config && tsc -d --emitDeclarationOnly --declarationDir dist","watch":"rollup --config --watch"},"author":{"name":"phphe","email":"phphe@outlook.com","url":"https://github.com/phphe"},"contributors":[{"name":"Aditya Purwa","url":"https://github.com/adityapurwa"}],"bugs":{"url":"https://github.com/phphe/draggable-helper/issues"},"repository":{"type":"git","url":"git+https://github.com/adityapurwa/draggable-helper.git"},"devDependencies":{"@babel/preset-typescript":"^7.10.1","@rollup/plugin-babel":"^5.2.1","@rollup/plugin-typescript":"^6.0.0","prettier":"^2.1.2","rogo":"^2.0.2","rollup-plugin-typescript2":"^0.27.1","typescript":"^3.9.5"},"dependencies":{"@babel/runtime":"^7.7.7","drag-event-service":"^1.1.7","helper-js":"^2.0.0"},"license":"MIT","gitHead":"b849590f0ce0d64cc384319ecf5a3e1977d5298c","homepage":"https://github.com/adityapurwa/draggable-helper#readme","_id":"@adityapurwa/draggable-helper@5.0.6","_nodeVersion":"12.15.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-CZSXmgVBPVKFMxfc6w6YUX3ouzDEp5eB5N/mGijP6NndHlRbmhnsvohxs00+hitJLWodtjI96cQ4yW4wRfSlqw==","shasum":"8235a722d64d4c695beb07e217cecdf9a5d718eb","tarball":"https://registry.npmjs.org/@adityapurwa/draggable-helper/-/draggable-helper-5.0.6.tgz","fileCount":6,"unpackedSize":47507,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfauLpCRA9TVsSAnZWagAAdzQP/1HPo1ht18DHi9leS0zP\nAH+SjNVpoobGfY6NFWHSpZyQkj3ox84h0JGacz+r+uddzYfJ4Fu6LbY2KEvC\nHOByW28wLYxZnMtf1qUar5m0i1NEr+NWJxLLQC2CF0ZadBsNzWeMTz44pEp6\nNakzw210QGOgu1DZ/ASW9vvneu7m+5ZkaLx4S9fs35nPiGCLupAWHn/wgiqh\niBaEKC33KiP13CaD+UIJaXpgQ/W4i2ZFCqRChLvEUaYVgos0YjS8B4umli5K\ngkbxu3pyZalFCzMh1YeI9oYczePM3FRs/krp7dEDfJM72dRyUdgAgbY5zvyH\nHGG6daT2qz9v7CMPStE8oFA4sBLNwFkL/78WmxXOHfOfltkQsrK/dGh20B5o\nTcsMkzfEvFnFFEHEB9bnp034xEYAEyzZ6CDSpMz9sXsWbO6PwnmDZFSvtM8a\nI1M1jvYvWZvrwzGzyVLKjA65+DN3MhpRj9hQg7lhBScyQc8AWpbiTjGC79kQ\nSR9w4YPA9YlknFhmCsuy7W5bwte/7tLz1nDokYmiV0z95w+EZKJ5BZN/YL+R\nhDIIHE06BCY5W8Gsigfg2YkR0zrA50Door1CaVc6stbfAs3RYA1XY7Tk70QZ\nLutwEZWe+GpoVNIS1sPDVsz28Bn6J5PGpSFgtmNBAlu3MX4dE/deqAOZzHMv\nqE+k\r\n=3Eu3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCkZ6iGZVz9f4Ek0fzz3YmKAMqhdizsOKKFJHMsjYKGvAIgaWqlq/E6AjWBwmcEi/5VM5jdmocubRZZpNifp4/2S70="}]},"maintainers":[{"name":"adityapurwa","email":"adityapurwa@windowslive.com"}],"_npmUser":{"name":"adityapurwa","email":"adityapurwa@windowslive.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/draggable-helper_5.0.6_1600840425426_0.5224913804336322"},"_hasShrinkwrap":false},"5.0.7":{"name":"@adityapurwa/draggable-helper","version":"5.0.7","description":"To simplify drag and drop.","main":"dist/draggable-helper.cjs.js","types":"dist/index.d.ts","scripts":{"build":"rollup --config && tsc -d --emitDeclarationOnly --declarationDir dist","watch":"rollup --config --watch"},"author":{"name":"phphe","email":"phphe@outlook.com","url":"https://github.com/phphe"},"contributors":[{"name":"Aditya Purwa","url":"https://github.com/adityapurwa"}],"bugs":{"url":"https://github.com/phphe/draggable-helper/issues"},"repository":{"type":"git","url":"git+https://github.com/adityapurwa/draggable-helper.git"},"devDependencies":{"@babel/preset-typescript":"^7.10.1","@rollup/plugin-babel":"^5.2.1","@rollup/plugin-typescript":"^6.0.0","prettier":"^2.1.2","rogo":"^2.0.2","rollup-plugin-typescript2":"^0.27.1","typescript":"^3.9.5"},"dependencies":{"@babel/runtime":"^7.7.7","drag-event-service":"^1.1.7","helper-js":"^2.0.0"},"license":"MIT","gitHead":"d93d5cb7931f18289483f82a491095d309eea53d","homepage":"https://github.com/adityapurwa/draggable-helper#readme","_id":"@adityapurwa/draggable-helper@5.0.7","_nodeVersion":"12.15.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-aOKH6H/Qn784uxqJYnKylGnqFRnEJ+Nay33HBf/1nDbvh30PY1WcZfcqdWCnqW9ii+KHJ9fe1N1q3ka6D5TXkw==","shasum":"64715dc1569621ed8d1715b22044432c175a606c","tarball":"https://registry.npmjs.org/@adityapurwa/draggable-helper/-/draggable-helper-5.0.7.tgz","fileCount":6,"unpackedSize":47588,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfczUYCRA9TVsSAnZWagAA9xAP/3w/MUgun4nl0FaUH8c8\nxyIShrYQgPveqZJf+Td2J2xUMP7CfhCHGJb/0RsIlJsmuyUar3qSlopAkX/E\nxn8k8lMRW2ZlxoB0CcSo3Z0oCVaFk2UbUIrCX6yjK/KHqtwmveC7yKtVKUjg\nITLLHeOfT53adgXnrHtWSvRhbdzezUF8HSqApbgzSacDjS0M4wO25+J+A065\nJNDyfa/B4bFpNJA3uhMCkt9Ydvq1RlcC8y7pmug8Ab1QMYmZB2/m6eExMVxP\nZ/1yYP1ziUv7FgTyOc71L+ZKkVtu8Xph0oYaZMNBdru+uUIXucDIjDRx3rCu\nQh0x8UsAvVF3+iEUX9SwFETyf62Vx61s5ZNGvgbc/G/0gqmxZLJKm2S1Uex9\n+lA5VKHKAmpI7sqOYmeSkMKexIc2tdZ0+r21jzcebH6CqWnmkRU6u7+/Za0J\nYy65Lkpl9tuXVS+46y182xuA/23gMl5XDgwXysSb0UsBTgbvAnS9UOHm2bAx\nZrCnCKq5bzdDRiofFGYwfuUuB6gSJSB4RqSnoGn0e7ERgtBF0aocAcHUnDws\n243nAkvrx93aBL6M+uVazP9joH1Eo5U9eD0LtlGXbDv6eGOptn/mK3x5iHV5\nA1+Dazc1OqR6p75VB6rypsoURzmcDV+yJmslPTlvVnm60wGfuQo20+AbVFW4\nm4JI\r\n=9t5g\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCQxbcFBP74b0NdDU33wpvMGMEGrNtQliUjj1y3uQcjZAIgJit4RrSG0w45wnsLFaltOtuUgEpPb3/WvK8Un+O3v9Y="}]},"maintainers":[{"name":"adityapurwa","email":"adityapurwa@windowslive.com"}],"_npmUser":{"name":"adityapurwa","email":"adityapurwa@windowslive.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/draggable-helper_5.0.7_1601385752153_0.2169576872770027"},"_hasShrinkwrap":false},"5.0.8":{"name":"@adityapurwa/draggable-helper","version":"5.0.8","description":"To simplify drag and drop.","main":"dist/draggable-helper.cjs.js","types":"dist/index.d.ts","scripts":{"build":"rollup --config && tsc -d --emitDeclarationOnly --declarationDir dist","watch":"rollup --config --watch"},"author":{"name":"phphe","email":"phphe@outlook.com","url":"https://github.com/phphe"},"contributors":[{"name":"Aditya Purwa","url":"https://github.com/adityapurwa"}],"bugs":{"url":"https://github.com/phphe/draggable-helper/issues"},"repository":{"type":"git","url":"git+https://github.com/adityapurwa/draggable-helper.git"},"devDependencies":{"@babel/preset-typescript":"^7.10.1","@rollup/plugin-babel":"^5.2.1","@rollup/plugin-typescript":"^6.0.0","prettier":"^2.1.2","rogo":"^2.0.2","rollup-plugin-typescript2":"^0.27.1","typescript":"^3.9.5"},"dependencies":{"@babel/runtime":"^7.7.7","drag-event-service":"^1.1.7","helper-js":"^2.0.0"},"license":"MIT","gitHead":"39f1abcf13350f356ea239c403cce3ac5b019893","homepage":"https://github.com/adityapurwa/draggable-helper#readme","_id":"@adityapurwa/draggable-helper@5.0.8","_nodeVersion":"12.15.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-9aJQSTCbBianlz8kbTNweBI8fmcQxowaVH2FaaeZgqmjGZ460qpz0NGopZpLM+OMUqdznW0BrXKFO3GqS5D+6Q==","shasum":"6a9de0a22bdec56160b66638062a201a0b109199","tarball":"https://registry.npmjs.org/@adityapurwa/draggable-helper/-/draggable-helper-5.0.8.tgz","fileCount":6,"unpackedSize":47618,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfdLJKCRA9TVsSAnZWagAAuXsP/3hKV4s0//chH9LQqLOn\nbCeZyfjN+7jC+V2lFLi2nOGFeyFkcRZ5ddT0RUBGUesLhmV52Pr6pUW9GnWh\nKd+9uL9TtmPNpeBfMNrp6tARK3yBJz4tAqJ5fxdNRMLHwAfZ3ZNnIaKAk3nQ\nF0vuF09IbU3r5k6EUfdlLw37uw8lSSec6SQagCcmYfEW/2r2NPjBWTjVwt/7\ndD0+z8cR6InfdRqseB959foeqZZ9KpMVnhk683D/XfODN7LEkv/24FFgjb60\nQALSlaXfaerzjm/Aj7/uXNBrG/9E8kIeccc2AzeH78xyDSZAcdAjv+SLm/Wi\nz49p61STdIADqSxqvYueWs5NpLDesm6TCxlUYuUekOAAeUJLI9qxwmPdUTB8\nHC7NByAh4ZaqXz0K/Q8XLDklVoZM2+2oISTTjtVuKz4WV/1mtWOqIY0dxtXI\ndFEpfa4axHaWiNlK2kydNkz6KoCYLYqI2pGGd9uStjy7ZRYJu6e8Gx8iQBeM\ntlob4RhScu+Di/Rq/z5ZwLIYlP6ptJ+nOeZTobNU2GgYG43BMIAkj0XLR6wm\nC17oLaP/LckxoMQ73hLkLPDA1PEgJFl6wZnelhjN8vOp45nvoyQS1S0n7f9Z\nHHO7kRBbZLDl3BGW1Qj8gIjYeok7ajpw3AqoSNDKFupECnyFmLTFmtfpj4NA\nI+la\r\n=fb+w\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAU52RNTjn7Z03hJLKIDkT9Q8xyR0F4ZViTvRgBpuQDeAiBROYfE2f9p/v0fyEZufahrEHKIKOl51V3FGQj30P0twQ=="}]},"maintainers":[{"name":"adityapurwa","email":"adityapurwa@windowslive.com"}],"_npmUser":{"name":"adityapurwa","email":"adityapurwa@windowslive.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/draggable-helper_5.0.8_1601483338295_0.8675763801074552"},"_hasShrinkwrap":false}},"time":{"created":"2020-09-22T11:37:48.777Z","5.0.5":"2020-09-22T11:37:48.918Z","modified":"2022-04-04T11:30:56.578Z","5.0.6":"2020-09-23T05:53:45.599Z","5.0.7":"2020-09-29T13:22:32.271Z","5.0.8":"2020-09-30T16:28:58.450Z"},"maintainers":[{"name":"adityapurwa","email":"adityapurwa@windowslive.com"}],"description":"To simplify drag and drop.","homepage":"https://github.com/adityapurwa/draggable-helper#readme","repository":{"type":"git","url":"git+https://github.com/adityapurwa/draggable-helper.git"},"contributors":[{"name":"Aditya Purwa","url":"https://github.com/adityapurwa"}],"author":{"name":"phphe","email":"phphe@outlook.com","url":"https://github.com/phphe"},"bugs":{"url":"https://github.com/phphe/draggable-helper/issues"},"license":"MIT","readme":"# Version 5 is written with Typescript, so you can try read code directly. Follow documentation is for version 4. The documentation for newest version 5 is being written...\n\n# draggable-helper\nA js library to simplify your drag and drop functions. Start with a element, it will expose hooks(drag, moving, drop). You can stop drag, moving and drop by conditions. You can set minTranslate. Its code is easy, you can check source code.\n## features\n* support touch simplify(single touch)\n* to prevent page scrolling when touch\n* expose hooks(drag, moving, drop)\n* prevent drag and moving by return false in hook\n* set min translate to trigger drag\n* set the style of dragging element\n* set the class of dragging element\n* move the element or move a cloned one\n* check if event is triggered by mouse left button\n* to prevent text be selected when dragging\n* Advance usage: bind to parent element, make children element as trigger element or moved element. Check example.\n\n## install\n```sh\nnpm install draggable-helper\n```\n## usage & api\n```js\nimport draggableHelper from 'draggable-helper'\n// dragHandlerEl will be added mouse and touch event listener\nconst {destroy, options} = draggableHelper(HTMLElement dragHandlerEl, Object opt = {})\n// opt\n// opt will pass to hook, so you can attach custom data into opt, such the data of the element\n// startEvent is mousedown or touchstart\nopt = {\n  // [Object] style, set the style of dragging element\n  // getStyle(store, opt), set the style of dragging element\n  // [String] draggingClass, default dragging, set the class of dragging element\n  // [Boolean] clone, move the element or move a cloned one\n  // minTranslate default 10, unit px\n  // getEl(dragHandlerEl, store, opt), optional, get the el that will be moved. default is dragHandlerEl\n  // afterGetEl(store, opt)\n  // [Boolean] triggerBySelf if trigger only by dragHandlerEl self, can not be triggered by children\n  // hook, before drag start\n  // [Boolean] opt.restoreDOMManuallyOndrop the changed DOM will be restored automatically on drop. This disable it and pass restoreDOM function into store.\n  beforeDrag(startEvent, moveEvent, store, opt){\n    // when trigger drag, the position must be moved, so there are two event. startEvent also can be accessed by store.startEvent\n    // The dragged element at this time has not yet been obtained, store.el is null. 此时要移动的元素还没有获得到, 即store.el是空.\n    // return false to prevent drag\n  },\n  // hook, when drag start\n  drag(startEvent, moveEvent, store, opt){\n    // when trigger drag, the position must be moved, so there are two event. startEvent also can be accessed by store.startEvent\n    // return false to prevent drag\n  },\n  // hook, when mouse moving\n  moving: (moveEvent, store, opt) => {\n    // return false to prevent moving\n  },\n  // hook, when drop\n  drop: (endEvent, store, opt) => {\n  },\n}\n// store. life cycle: drag-end\nstore = {\n  el // the moving el\n  originalEl // the original moving el, used when clone\n  initialMouse\n  initialPosition // relative to offsetParent\n  mouse\n  move\n  movedCount // start from 0\n  startEvent // mousedown or touchstart event\n  endEvent,\n  restoreDOM() // function if opt.restoreDOMManuallyOndrop else null\n}\n```\n## Example\n### Advance usage: bind to parent element\nAdvance usage: bind to parent element, make children element as trigger element or moved element.\n```js\nimport draggableHelper from 'draggable-helper'\nconst {destroy, options} = draggableHelper(document.body, {\n  drag(startEvent, moveEvent, store, opt) {\n    // check trigger el\n    if (startEvent.target not has class 'your trigger class') {\n      return false\n    }\n  },\n  // get the element which will be moved\n  getEl: (dragHandlerEl, store, opt) => get the el which will be moved by `store.startEvent.target`\n})\n```\n## prevent drag\nIn follow case, drag event will be prevented.\n* Event target element is follow\n```js\nconst IGNORE_TRIGGERS = ['INPUT','TEXTAREA', 'SELECT', 'OPTGROUP', 'OPTION']\n```\n* Event target has class `undraggable` or its ancestor till dragHandlerEl has.\n* opt.beforeDrag or opt.drag return false\n\n## demo\n[jsfiddle](https://jsfiddle.net/phphe/t694kpua/19/)\n","readmeFilename":"README.MD"}