Skip to content

Commit

Permalink
Invoke react-dnd-multi-backend differently to hopefully fix npm peer …
Browse files Browse the repository at this point in the history
…deps weirdness
  • Loading branch information
nomcopter committed Aug 3, 2022
1 parent 64e3d26 commit 6290fed
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 44 deletions.
49 changes: 26 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,22 @@
"main": "lib/index.js",
"style": "lib/react-mosaic.css",
"typings": "lib/index.d.ts",
"sideEffects": [
"*.css"
],
"repository": {
"type": "git",
"url": "https://github.com/nomcopter/react-mosaic.git"
},
"funding": "https://github.com/nomcopter/react-mosaic?sponsor=1",
"keywords": [
"ui",
"react",
"component",
"typescript",
"tiling-window-manager",
"window-manager"
],
"sideEffects": [
"*.css"
],
"scripts": {
"build": "npm-run-all clean -lp build:**",
"build:ts": "tsc -p tsconfig-build.json",
Expand All @@ -29,7 +37,18 @@
"fix": "npm-run-all -lp fix:**",
"fix:format": "yarn run prettier:run --write",
"fix:lint": "yarn run test:lint --fix",
"version": "yarn run bundle && git add -A docs/"
"version": "npm-run-all test bundle && git add -A docs/"
},
"dependencies": {
"classnames": "^2.3.1",
"immutability-helper": "^3.1.1",
"lodash": "^4.17.21",
"prop-types": "^15.8.1",
"react-dnd": "^14.0.5",
"react-dnd-html5-backend": "^14.1.0",
"react-dnd-multi-backend": "^6.0.2",
"react-dnd-touch-backend": "^14.1.1",
"uuid": "^3.4.0"
},
"devDependencies": {
"@blueprintjs/core": "^4.7.0",
Expand Down Expand Up @@ -77,26 +96,10 @@
"webpack-dev-server": "^2.11.5",
"yarn-deduplicate": "^3.1.0"
},
"dependencies": {
"classnames": "^2.3.1",
"immutability-helper": "^3.1.1",
"lodash": "^4.17.21",
"prop-types": "^15.8.1",
"react-dnd": "^14.0.5",
"react-dnd-html5-backend": "^14.1.0",
"react-dnd-multi-backend": "^6.0.2",
"react-dnd-touch-backend": "^14.1.1",
"uuid": "^3.4.0"
},
"peerDependencies": {
"react": "16 - 18"
},
"keywords": [
"ui",
"react",
"component",
"typescript",
"tiling-window-manager",
"window-manager"
]
"resolutions": {
"dnd-core": "14.0.1"
}
}
14 changes: 4 additions & 10 deletions src/Mosaic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import countBy from 'lodash/countBy';
import keys from 'lodash/keys';
import pickBy from 'lodash/pickBy';
import React from 'react';
import { Backends, DndProvider } from 'react-dnd-multi-backend';
import { DndProvider } from 'react-dnd';
import MultiBackend from 'react-dnd-multi-backend';
import HTML5ToTouch from 'react-dnd-multi-backend/dist/cjs/HTML5toTouch';
import { v4 as uuid } from 'uuid';

Expand Down Expand Up @@ -213,19 +214,12 @@ export class MosaicWithoutDragDropContext<T extends MosaicKey = string> extends
}
}

const FixedDndProvider = DndProvider as React.FC<{
context?: any;
debugMode?: boolean | undefined;
options: Backends;
children?: React.ReactNode;
}>;

export class Mosaic<T extends MosaicKey = string> extends React.PureComponent<MosaicProps<T>> {
render() {
return (
<FixedDndProvider options={HTML5ToTouch}>
<DndProvider backend={MultiBackend} options={HTML5ToTouch}>
<MosaicWithoutDragDropContext<T> {...this.props} />
</FixedDndProvider>
</DndProvider>
);
}
}
13 changes: 2 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1730,7 +1730,7 @@ diffie-hellman@^5.0.0:
miller-rabin "^4.0.0"
randombytes "^2.0.0"

[email protected]:
[email protected], dnd-core@^10.0.2:
version "14.0.1"
resolved "https://registry.yarnpkg.com/dnd-core/-/dnd-core-14.0.1.tgz#76d000e41c494983210fb20a48b835f81a203c2e"
integrity sha512-+PVS2VPTgKFPYWo3vAFEA8WPbTf7/xo43TifH9G8S1KqnrQu0o77A3unrF5yOugy4mIz7K5wAVFHUcha7wsz6A==
Expand All @@ -1739,15 +1739,6 @@ [email protected]:
"@react-dnd/invariant" "^2.0.0"
redux "^4.1.1"

dnd-core@^10.0.2:
version "10.0.2"
resolved "https://registry.yarnpkg.com/dnd-core/-/dnd-core-10.0.2.tgz#051dc119682ea1185622f954667670d3d5f6a574"
integrity sha512-PrxEjxF0+6Y1n1n1Z9hSWZ1tvnDXv9syL+BccV1r1RC08uWNsyetf8AnWmUF3NgYPwy0HKQJwTqGkZK+1NlaFA==
dependencies:
"@react-dnd/asap" "^4.0.0"
"@react-dnd/invariant" "^2.0.0"
redux "^4.0.4"

dnd-multi-backend@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/dnd-multi-backend/-/dnd-multi-backend-6.0.0.tgz#4ed68229a3f6f1fb9e9bc45b4034e8330005280d"
Expand Down Expand Up @@ -5287,7 +5278,7 @@ reduce-function-call@^1.0.1:
dependencies:
balanced-match "^0.4.2"

redux@^4.0.4, redux@^4.1.1:
redux@^4.1.1:
version "4.1.2"
resolved "https://registry.yarnpkg.com/redux/-/redux-4.1.2.tgz#140f35426d99bb4729af760afcf79eaaac407104"
integrity sha512-SH8PglcebESbd/shgf6mii6EIoRM0zrQyjcuQ+ojmfxjTtE0z9Y8pa62iA/OJ58qjP6j27uyW4kUF4jl/jd6sw==
Expand Down

0 comments on commit 6290fed

Please sign in to comment.