Repository navigation
refactor(core)!: drop SortableJS dependency - #2634
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2634 +/- ##
========================================
Coverage 100.0% 100.0%
========================================
Files 201 202 +1
Lines 27058 27472 +414
Branches 9483 9588 +105
========================================
+ Hits 27058 27472 +414
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
converting to Draft since I mainly want to see if all tests are passing, if confirmed then I'll probably close the branch and just resurrect it in our next major version in 2027-Q1. I mainly wanted to use my leftover copilot tokens before the next month rolls in cc @zewa666 EDIT After trying it on my linux laptop, I had to patch a few things for Firefox Linux, and also told the AI to patch for any Safari issues as well. Now it's still shaving 10Kb from my zip file but it's now increased from 100 loc to 350 loc (as per codecov), probably still worth it but quite different compared to the original AI assumption 🤔 EDIT 2 hmm I found some more issues with touch not working, and some issues with Firefox Linux, it works fine with touch with SortableJS though.... EDIT 3 hmm ok I think I managed to fix all issues, in the end it's decreasing my zip by ~9Kb now, which is probably still worth it, considering that it's a lighter approach (SortableJS was created when ES6/HTML5 just came out), but I would certainly hold on this until our next major release. It could be good to get feedback on the matter. Only thing I couldn't try is Safari/MacOS but I did ask the AI to cover it too and it's also missing animation when dragging but that is barely noticeable Cheers |
angular-slickgrid
aurelia-slickgrid
slickgrid-react
slickgrid-vue
@slickgrid-universal/angular-row-detail-plugin
@slickgrid-universal/aurelia-row-detail-plugin
@slickgrid-universal/react-row-detail-plugin
@slickgrid-universal/vue-row-detail-plugin
@slickgrid-universal/binding
@slickgrid-universal/common
@slickgrid-universal/composite-editor-component
@slickgrid-universal/custom-footer-component
@slickgrid-universal/custom-tooltip-plugin
@slickgrid-universal/empty-warning-component
@slickgrid-universal/event-pub-sub
@slickgrid-universal/excel-export
@slickgrid-universal/graphql
@slickgrid-universal/odata
@slickgrid-universal/pagination-component
@slickgrid-universal/pdf-export
@slickgrid-universal/row-detail-view-plugin
@slickgrid-universal/rxjs-observable
@slickgrid-universal/sql
@slickgrid-universal/text-export
@slickgrid-universal/utils
@slickgrid-universal/vanilla-bundle
@slickgrid-universal/vanilla-force-bundle
@slickgrid-universal/web-mcp
commit: |
Final part of the SortableJS removal (port of ghiscoding/slickgrid-universal#2634). Column reordering and draggable grouping now run on the built-in native HTML5 drag & drop engines in slick.interactions.js; the project has zero runtime dependencies. - package.json: remove the `dependencies` block (sortablejs was the only entry); package-lock.json drops the root and vite-demo sortablejs entries (a transitive sortablejs entry remains only through vite-demo's dependency on the published slickgrid@5.x package and will disappear on the next release) - remove the SortableJS `<script>` tags (CDN + local fallback) from 107 example pages and 5 test pages, including the pages added since this change was first written (auto header height, variable row height, quirk repro pages, and the RTL example's sortablejs-rtl fork, which the RTL-aware native engine replaces); delete examples/sortable-cdn-fallback.js - example-external-headersort.html keeps its SortableJS tag: it demonstrates an external library plugged in through the `enableColumnReorder` hook and calls `Sortable.create()` itself - quirk-sticky-column-reorder.cy.ts: its harness no longer loads sortablejs - src/global.d.ts: drop the `Sortable` global declaration and its type import - eslint.config.mjs: drop the `Sortable` global - vite-demo: remove the sortablejs dependency and the `window.Sortable` shim - scripts/builds.mjs: remove a stale SortableJS-related comment - README: the SortableJS requirement note and the Dependency section become a zero-runtime-dependencies note (historical v3 jQueryUI->SortableJS references are left as history) - docs/in-depth/migration-v6.md: list the changed getSetupColumnReorder() return value - the `.slick-sortable-placeholder` / `.slick-droppable-sortitem-hover` CSS class names are intentionally kept so consumers' custom CSS keeps working BREAKING CHANGE: SortableJS is no longer used nor required. Consumers who load SlickGrid via script tags can remove their SortableJS `<script>` include; the `window.Sortable` global is no longer read. Column reordering now requires `slick.interactions.js` to be loaded (it already was in every example). The `SlickDraggableGrouping.getSetupColumnReorder()` return shape changed in the previous commit as part of the same effort. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…drop) (#1243) Part 3 of the SortableJS removal (port of ghiscoding/slickgrid-universal#2634). The SlickDraggableGrouping plugin now runs entirely on the native drag engines; nothing in src/ uses SortableJS anymore (the dependency itself is removed in the next and final part). - add `setupDropzonePillDrag()` to slick.interactions.ts: native pill reordering inside the grouping dropzone (RTL-aware), column-header drop acceptance via the dataTransfer column id, with Firefox/Linux mouse and touch fallbacks - rewire slick.draggablegrouping.ts: `getSetupColumnReorder()` runs `setupColumnReorderDrag` on the header row or on each docking region, auto-scrolls the docking scrollbar when the grid has one, and applies the drag with `reconcileColumnOrder()`; the dropzone uses `setupDropzonePillDrag`, and the hand-rolled dragover/dragenter/dragleave dropzone listeners fold into engine callbacks - fix: a header reorder on a grouping page no longer deletes hidden columns from the grid (the old toArray() read-back only listed rendered headers); new test in example-draggable-grouping.cy.ts - grouping pills are created with `draggable=true` (required for the native HTML5 pill drag) - a header drop is handled by both the dropzone's native `drop` and the reorder engine's fallback `onDrop` path, deduplicated by handleGroupByDrop's existing columnAllowed guard - BREAKING: `getSetupColumnReorder()` now returns `{ columnReorderDragInstance }` (a `{ destroy() }` instance) instead of `{ sortableLeftInstance, sortableCenterInstance, sortableRightInstance }` - behavior deltas: no spurious onColumnsReordered after a grouping drop; grouping pages now respect `unorderableColumnCssClass` (the old filter was commented out); pill drags only reapply grouping when the order changed Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Final part of the SortableJS removal (port of ghiscoding/slickgrid-universal#2634). Column reordering and draggable grouping now run on the built-in native HTML5 drag & drop engines in slick.interactions.js; the project has zero runtime dependencies. - package.json: remove the `dependencies` block (sortablejs was the only entry); package-lock.json drops the root and vite-demo sortablejs entries (a transitive sortablejs entry remains only through vite-demo's dependency on the published slickgrid@5.x package and will disappear on the next release) - remove the SortableJS `<script>` tags (CDN + local fallback) from 107 example pages and 5 test pages, including the pages added since this change was first written (auto header height, variable row height, quirk repro pages, and the RTL example's sortablejs-rtl fork, which the RTL-aware native engine replaces); delete examples/sortable-cdn-fallback.js - example-external-headersort.html keeps its SortableJS tag: it demonstrates an external library plugged in through the `enableColumnReorder` hook and calls `Sortable.create()` itself - quirk-sticky-column-reorder.cy.ts: its harness no longer loads sortablejs - src/global.d.ts: drop the `Sortable` global declaration and its type import - eslint.config.mjs: drop the `Sortable` global - vite-demo: remove the sortablejs dependency and the `window.Sortable` shim - scripts/builds.mjs: remove a stale SortableJS-related comment - README: the SortableJS requirement note and the Dependency section become a zero-runtime-dependencies note (historical v3 jQueryUI->SortableJS references are left as history) - docs/in-depth/migration-v6.md: list the changed getSetupColumnReorder() return value - the `.slick-sortable-placeholder` / `.slick-droppable-sortitem-hover` CSS class names are intentionally kept so consumers' custom CSS keeps working BREAKING CHANGE: SortableJS is no longer used nor required. Consumers who load SlickGrid via script tags can remove their SortableJS `<script>` include; the `window.Sortable` global is no longer read. Column reordering now requires `slick.interactions.js` to be loaded (it already was in every example). The `SlickDraggableGrouping.getSetupColumnReorder()` return shape changed in the previous commit as part of the same effort. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…5 drag & drop for column header reorder (#1242) * refactor: replace SortableJS with native HTML5 drag & drop for column header reorder Port of slickgrid-universal's column reorder engine (ghiscoding/slickgrid-universal#2634) adapted to this repo. The grid no longer needs SortableJS for header column reordering; the SlickDraggableGrouping plugin still uses it (to be ported next), so the dependency itself stays for now. - add `setupColumnReorderDrag()` to slick.interactions.ts: native HTML5 drag with live DOM reordering during dragover, browser-edge auto-scroll (10 px every 30 ms, as in #1286), Firefox/Linux mouse fallback, touch fallback with a manual drag ghost, RTL-aware insertion, and dropzone hooks for draggable grouping - the engine takes a list of header containers: the header row, or the left, centre and right docking regions of a pinned grid. A column only moves within its own container, so it never crosses a pinned boundary (the three Sortable lists were unconnected too) - add `reconcileColumnOrder()`: each reorderable header hands its column slot to the header that took its place, so hidden, non-reorderable and other-band columns keep their indices whatever the band order in the DOM - rewire slick.grid.ts: drop the sortablejs type import and the three Sortable instances; setupColumnReorder() runs on the engine and reconcileColumnOrder() - the drag finalizes on `drop` as well as `dragend` (SortableJS finalized on drop; without this, drag sources that skip dragend leave the DOM reordered without setColumns/onColumnsReordered ever running) - a hovered header is passed once the pointer is far enough into it for the dragged header to land under the pointer: SortableJS's eager swap, without flip-flopping between headers of unequal widths. The decision uses the current geometry only, so headers that scroll under the pointer during a drag cannot invert it - the scroll position restored after the reorder is read from the scroller, because the drop can be handled before a pending scroll event updates the cached `scrollLeft` - reword the comment of the hidden-column reorder test (already enabled on next-v6) - remove a redundant spec-level @4tw/cypress-drag-drop import in example-grid-menu.cy.ts that re-registered the plugin's drag command over the shared HTML5 DnD overwrite Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: drop SortableJS from SlickDraggableGrouping (native drag & drop) (#1243) Part 3 of the SortableJS removal (port of ghiscoding/slickgrid-universal#2634). The SlickDraggableGrouping plugin now runs entirely on the native drag engines; nothing in src/ uses SortableJS anymore (the dependency itself is removed in the next and final part). - add `setupDropzonePillDrag()` to slick.interactions.ts: native pill reordering inside the grouping dropzone (RTL-aware), column-header drop acceptance via the dataTransfer column id, with Firefox/Linux mouse and touch fallbacks - rewire slick.draggablegrouping.ts: `getSetupColumnReorder()` runs `setupColumnReorderDrag` on the header row or on each docking region, auto-scrolls the docking scrollbar when the grid has one, and applies the drag with `reconcileColumnOrder()`; the dropzone uses `setupDropzonePillDrag`, and the hand-rolled dragover/dragenter/dragleave dropzone listeners fold into engine callbacks - fix: a header reorder on a grouping page no longer deletes hidden columns from the grid (the old toArray() read-back only listed rendered headers); new test in example-draggable-grouping.cy.ts - grouping pills are created with `draggable=true` (required for the native HTML5 pill drag) - a header drop is handled by both the dropzone's native `drop` and the reorder engine's fallback `onDrop` path, deduplicated by handleGroupByDrop's existing columnAllowed guard - BREAKING: `getSetupColumnReorder()` now returns `{ columnReorderDragInstance }` (a `{ destroy() }` instance) instead of `{ sortableLeftInstance, sortableCenterInstance, sortableRightInstance }` - behavior deltas: no spurious onColumnsReordered after a grouping drop; grouping pages now respect `unorderableColumnCssClass` (the old filter was commented out); pill drags only reapply grouping when the order changed Co-authored-by: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Final part of the SortableJS removal (port of ghiscoding/slickgrid-universal#2634). Column reordering and draggable grouping now run on the built-in native HTML5 drag & drop engines in slick.interactions.js; the project has zero runtime dependencies. - package.json: remove the `dependencies` block (sortablejs was the only entry); package-lock.json drops the root and vite-demo sortablejs entries (a transitive sortablejs entry remains only through vite-demo's dependency on the published slickgrid@5.x package and will disappear on the next release) - remove the SortableJS `<script>` tags (CDN + local fallback) from 107 example pages and 5 test pages, including the pages added since this change was first written (auto header height, variable row height, quirk repro pages, and the RTL example's sortablejs-rtl fork, which the RTL-aware native engine replaces); delete examples/sortable-cdn-fallback.js - example-external-headersort.html keeps its SortableJS tag: it demonstrates an external library plugged in through the `enableColumnReorder` hook and calls `Sortable.create()` itself - quirk-sticky-column-reorder.cy.ts: its harness no longer loads sortablejs - src/global.d.ts: drop the `Sortable` global declaration and its type import - eslint.config.mjs: drop the `Sortable` global - vite-demo: remove the sortablejs dependency and the `window.Sortable` shim - scripts/builds.mjs: remove a stale SortableJS-related comment - README: the SortableJS requirement note and the Dependency section become a zero-runtime-dependencies note (historical v3 jQueryUI->SortableJS references are left as history) - docs/in-depth/migration-v6.md: list the changed getSetupColumnReorder() return value - the `.slick-sortable-placeholder` / `.slick-droppable-sortitem-hover` CSS class names are intentionally kept so consumers' custom CSS keeps working BREAKING CHANGE: SortableJS is no longer used nor required. Consumers who load SlickGrid via script tags can remove their SortableJS `<script>` include; the `window.Sortable` global is no longer read. Column reordering now requires `slick.interactions.js` to be loaded (it already was in every example). The `SlickDraggableGrouping.getSetupColumnReorder()` return shape changed in the previous commit as part of the same effort. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Final part of the SortableJS removal (port of ghiscoding/slickgrid-universal#2634). Column reordering and draggable grouping now run on the built-in native HTML5 drag & drop engines in slick.interactions.js; the project has zero runtime dependencies. - package.json: remove the `dependencies` block (sortablejs was the only entry); package-lock.json drops the root and vite-demo sortablejs entries (a transitive sortablejs entry remains only through vite-demo's dependency on the published slickgrid@5.x package and will disappear on the next release) - remove the SortableJS `<script>` tags (CDN + local fallback) from 107 example pages and 5 test pages, including the pages added since this change was first written (auto header height, variable row height, quirk repro pages, and the RTL example's sortablejs-rtl fork, which the RTL-aware native engine replaces); delete examples/sortable-cdn-fallback.js - example-external-headersort.html keeps its SortableJS tag: it demonstrates an external library plugged in through the `enableColumnReorder` hook and calls `Sortable.create()` itself - quirk-sticky-column-reorder.cy.ts: its harness no longer loads sortablejs - src/global.d.ts: drop the `Sortable` global declaration and its type import - eslint.config.mjs: drop the `Sortable` global - vite-demo: remove the sortablejs dependency and the `window.Sortable` shim - scripts/builds.mjs: remove a stale SortableJS-related comment - README: the SortableJS requirement note and the Dependency section become a zero-runtime-dependencies note (historical v3 jQueryUI->SortableJS references are left as history) - docs/in-depth/migration-v6.md: list the changed getSetupColumnReorder() return value - the `.slick-sortable-placeholder` / `.slick-droppable-sortitem-hover` CSS class names are intentionally kept so consumers' custom CSS keeps working BREAKING CHANGE: SortableJS is no longer used nor required. Consumers who load SlickGrid via script tags can remove their SortableJS `<script>` include; the `window.Sortable` global is no longer read. Column reordering now requires `slick.interactions.js` to be loaded (it already was in every example). The `SlickDraggableGrouping.getSetupColumnReorder()` return shape changed in the previous commit as part of the same effort. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
vibe coded with mostly copilot Claude Sonnet 4.6
I first tried to migrate from SortableJS to
@formkit/drag-and-dropin another branchrefactor/formkit-dndbut copilot suggested to actually drop the use of any external dependency and just use native code by adding about~350 locnow ~440 loc after all fixes. Note that this wouldn't get merged until the next major version (next year) since that could impact some E2E tests (I had to add a custom Cypress drag command to make my E2E tests pass) and some small UI differences too (e.g. no more drag animation)Comparing the build size of my Salesforce standalone script zip file, dropping SortableJS drops the file size by about
10Kb~9Kb (as a comparison, when I tried to migrate to@formkit/drag-and-drop, that only dropped by about ~2.5Kb, and there's still some touch issues with that approach/branch, so dropping SortableJS entirely and going native has a much larger impact for the decrease in size).