1 line
2.9 KiB
JSON
1 line
2.9 KiB
JSON
{"ast":null,"code":"import { mixNumber } from 'motion-dom';\nimport { moveItem } from 'motion-utils';\nfunction checkReorder(order, value, offset, velocity) {\n if (!velocity) return order;\n const index = order.findIndex(item => item.value === value);\n if (index === -1) return order;\n const nextOffset = velocity > 0 ? 1 : -1;\n const nextItem = order[index + nextOffset];\n if (!nextItem) return order;\n const item = order[index];\n const nextLayout = nextItem.layout;\n const nextItemCenter = mixNumber(nextLayout.min, nextLayout.max, 0.5);\n if (nextOffset === 1 && item.layout.max + offset > nextItemCenter || nextOffset === -1 && item.layout.min + offset < nextItemCenter) {\n return moveItem(order, index, index + nextOffset);\n }\n return order;\n}\nexport { checkReorder };","map":{"version":3,"names":["mixNumber","moveItem","checkReorder","order","value","offset","velocity","index","findIndex","item","nextOffset","nextItem","nextLayout","layout","nextItemCenter","min","max"],"sources":["/home/gnx/Desktop/ETB/ETB-FrontEnd/node_modules/framer-motion/dist/es/components/Reorder/utils/check-reorder.mjs"],"sourcesContent":["import { mixNumber } from 'motion-dom';\nimport { moveItem } from 'motion-utils';\n\nfunction checkReorder(order, value, offset, velocity) {\n if (!velocity)\n return order;\n const index = order.findIndex((item) => item.value === value);\n if (index === -1)\n return order;\n const nextOffset = velocity > 0 ? 1 : -1;\n const nextItem = order[index + nextOffset];\n if (!nextItem)\n return order;\n const item = order[index];\n const nextLayout = nextItem.layout;\n const nextItemCenter = mixNumber(nextLayout.min, nextLayout.max, 0.5);\n if ((nextOffset === 1 && item.layout.max + offset > nextItemCenter) ||\n (nextOffset === -1 && item.layout.min + offset < nextItemCenter)) {\n return moveItem(order, index, index + nextOffset);\n }\n return order;\n}\n\nexport { checkReorder };\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,YAAY;AACtC,SAASC,QAAQ,QAAQ,cAAc;AAEvC,SAASC,YAAYA,CAACC,KAAK,EAAEC,KAAK,EAAEC,MAAM,EAAEC,QAAQ,EAAE;EAClD,IAAI,CAACA,QAAQ,EACT,OAAOH,KAAK;EAChB,MAAMI,KAAK,GAAGJ,KAAK,CAACK,SAAS,CAAEC,IAAI,IAAKA,IAAI,CAACL,KAAK,KAAKA,KAAK,CAAC;EAC7D,IAAIG,KAAK,KAAK,CAAC,CAAC,EACZ,OAAOJ,KAAK;EAChB,MAAMO,UAAU,GAAGJ,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;EACxC,MAAMK,QAAQ,GAAGR,KAAK,CAACI,KAAK,GAAGG,UAAU,CAAC;EAC1C,IAAI,CAACC,QAAQ,EACT,OAAOR,KAAK;EAChB,MAAMM,IAAI,GAAGN,KAAK,CAACI,KAAK,CAAC;EACzB,MAAMK,UAAU,GAAGD,QAAQ,CAACE,MAAM;EAClC,MAAMC,cAAc,GAAGd,SAAS,CAACY,UAAU,CAACG,GAAG,EAAEH,UAAU,CAACI,GAAG,EAAE,GAAG,CAAC;EACrE,IAAKN,UAAU,KAAK,CAAC,IAAID,IAAI,CAACI,MAAM,CAACG,GAAG,GAAGX,MAAM,GAAGS,cAAc,IAC7DJ,UAAU,KAAK,CAAC,CAAC,IAAID,IAAI,CAACI,MAAM,CAACE,GAAG,GAAGV,MAAM,GAAGS,cAAe,EAAE;IAClE,OAAOb,QAAQ,CAACE,KAAK,EAAEI,KAAK,EAAEA,KAAK,GAAGG,UAAU,CAAC;EACrD;EACA,OAAOP,KAAK;AAChB;AAEA,SAASD,YAAY","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]} |