diff --git a/website/package-lock.json b/website/package-lock.json index 2c6b94be4..a7f44333c 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -20,7 +20,7 @@ "mapillary-js": "^4.1.2", "maplibre-gl": "^6.15.0", "sanitize-html": "^2.17.0", - "sortablejs": "^1.15.6" + "sortablejs": "^1.15.7" }, "devDependencies": { "@fontsource-variable/inter": "^5.2.8", @@ -39,7 +39,7 @@ "@types/mapbox__tilebelt": "^1.0.4", "@types/node": "^22.15.30", "@types/sanitize-html": "^2.16.0", - "@types/sortablejs": "^1.15.8", + "@types/sortablejs": "^1.15.9", "@typescript-eslint/eslint-plugin": "^8.33.1", "@typescript-eslint/parser": "^8.33.1", "bits-ui": "^2.17.2", @@ -2762,6 +2762,8 @@ }, "node_modules/@types/sortablejs": { "version": "1.15.9", + "resolved": "https://registry.npmjs.org/@types/sortablejs/-/sortablejs-1.15.9.tgz", + "integrity": "sha512-7HP+rZGE2p886PKV9c9OJzLBI6BBJu1O7lJGYnPyG3fS4/duUCcngkNCjsLwIMV+WMqANe3tt4irrXHSIe68OQ==", "dev": true, "license": "MIT" }, @@ -5599,6 +5601,8 @@ }, "node_modules/sortablejs": { "version": "1.15.7", + "resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.15.7.tgz", + "integrity": "sha512-Kk8wLQPlS+yi1ZEf48a4+fzHa4yxjC30M/Sr2AnQu+f/MPwvvX9XjZ6OWejiz8crBsLwSq8GHqaxaET7u6ux0A==", "license": "MIT" }, "node_modules/source-map-js": { diff --git a/website/package.json b/website/package.json index f397cbbf8..85fd17a71 100644 --- a/website/package.json +++ b/website/package.json @@ -33,7 +33,7 @@ "@types/mapbox__tilebelt": "^1.0.4", "@types/node": "^22.15.30", "@types/sanitize-html": "^2.16.0", - "@types/sortablejs": "^1.15.8", + "@types/sortablejs": "^1.15.9", "@typescript-eslint/eslint-plugin": "^8.33.1", "@typescript-eslint/parser": "^8.33.1", "bits-ui": "^2.17.2", @@ -80,6 +80,6 @@ "mapillary-js": "^4.1.2", "maplibre-gl": "^6.15.0", "sanitize-html": "^2.17.0", - "sortablejs": "^1.15.6" + "sortablejs": "^1.15.7" } } diff --git a/website/src/lib/components/file-list/sortable-file-list.ts b/website/src/lib/components/file-list/sortable-file-list.ts index 045d57b63..2a7fe6d7b 100644 --- a/website/src/lib/components/file-list/sortable-file-list.ts +++ b/website/src/lib/components/file-list/sortable-file-list.ts @@ -1,5 +1,6 @@ import { isMac } from '$lib/utils'; -import Sortable, { type Direction } from 'sortablejs/Sortable'; +import Sortable from './sortable'; +import type { Direction } from 'sortablejs'; import { get, writable } from 'svelte/store'; import { tick } from 'svelte'; import { engine, type MoveTarget, type Selection } from '$lib/engine'; @@ -258,7 +259,7 @@ export class SortableFileList { } } - updateToSelection(e: Sortable.SortableEvent) { + updateToSelection(e: Sortable.SortableEvent & { originalEvent?: MouseEvent }) { if (!this._sortable) return; if (this._updatingSelection || this._applying) return; this._updatingSelection = true; diff --git a/website/src/lib/components/file-list/sortable.ts b/website/src/lib/components/file-list/sortable.ts new file mode 100644 index 000000000..e138d8a4c --- /dev/null +++ b/website/src/lib/components/file-list/sortable.ts @@ -0,0 +1,7 @@ +import Sortable, { MultiDrag } from 'sortablejs'; + +// The ESM build leaves out the MultiDrag plugin. Mounting it twice throws, so it is done here +// rather than in a module that hot reloading runs again. +Sortable.mount(new MultiDrag()); + +export default Sortable; diff --git a/website/src/lib/components/map/street-view-control/mapillary.ts b/website/src/lib/components/map/street-view-control/mapillary.ts index b081e2813..9cd228f1e 100644 --- a/website/src/lib/components/map/street-view-control/mapillary.ts +++ b/website/src/lib/components/map/street-view-control/mapillary.ts @@ -5,7 +5,7 @@ import { type MapLayerMouseEvent, type VectorSourceSpecification, } from 'maplibre-gl'; -import { Viewer, type ViewerBearingEvent } from 'mapillary-js/dist/mapillary.module'; +import { Viewer, type ViewerBearingEvent } from 'mapillary-js'; import 'mapillary-js/dist/mapillary.css'; import { mapCursor, MapCursorState } from '$lib/state/map-cursor'; import { ANCHOR_LAYER_KEY } from '$lib/components/map/style'; diff --git a/website/vite.config.ts b/website/vite.config.ts index 0fdebafa5..6ba129dd3 100644 --- a/website/vite.config.ts +++ b/website/vite.config.ts @@ -47,4 +47,8 @@ export default defineConfig({ wasm(), sveltekit(), ], + ssr: { + // their main entry is UMD, which has no named exports in Node: bundle their ESM build instead + noExternal: ['mapillary-js', 'sortablejs'], + }, });