From a19eeb98e26928e82385e9200d8d206eb1d83297 Mon Sep 17 00:00:00 2001 From: Ira Hopkinson Date: Fri, 5 Apr 2024 07:43:56 +1300 Subject: [PATCH] update `rc-dock` (#833) - remove `rc-tabs` patch - no longer needed - update `patch-package` --- package-lock.json | 164 ++++++++++++------ package.json | 34 +--- ...dock+3.2.18.patch => rc-dock+3.2.19.patch} | 22 +-- patches/rc-tabs+11.16.1.patch | 39 ----- 4 files changed, 126 insertions(+), 133 deletions(-) rename patches/{rc-dock+3.2.18.patch => rc-dock+3.2.19.patch} (99%) delete mode 100644 patches/rc-tabs+11.16.1.patch diff --git a/package-lock.json b/package-lock.json index e46ac341ab..26829a8d9d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,7 +34,7 @@ "node-localstorage": "^3.0.5", "platform-bible-react": "file:./lib/platform-bible-react", "platform-bible-utils": "file:./lib/platform-bible-utils", - "rc-dock": "^3.2.18", + "rc-dock": "^3.2.19", "react": "^18.2.0", "react-data-grid": "^7.0.0-beta.42", "react-dom": "^18.2.0", @@ -110,7 +110,7 @@ "mini-css-extract-plugin": "^2.8.0", "node-loader": "^2.0.0", "nodemon": "^3.1.0", - "patch-package": "^7.0.2", + "patch-package": "^8.0.0", "prettier": "^3.2.5", "prettier-plugin-jsdoc": "^1.3.0", "react-refresh": "^0.14.0", @@ -12335,8 +12335,9 @@ "dev": true }, "node_modules/classnames": { - "version": "2.3.2", - "license": "MIT" + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz", + "integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==" }, "node_modules/clean-css": { "version": "5.3.2", @@ -19834,11 +19835,35 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, + "node_modules/json-stable-stringify": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.1.1.tgz", + "integrity": "sha512-SU/971Kt5qVQfJpyDveVhQ/vya+5hvrjClFOcr8c0Fq5aODJjMwutrOfCU+eCnVD5gpx1Q3fEqkyom77zH1iIg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.5", + "isarray": "^2.0.5", + "jsonify": "^0.0.1", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "dev": true, "license": "MIT" }, + "node_modules/json-stable-stringify/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, "node_modules/json-stringify-safe": { "version": "5.0.1", "dev": true, @@ -19869,6 +19894,15 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/jsonify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", + "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/jsx-ast-utils": { "version": "3.3.5", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", @@ -22024,9 +22058,9 @@ } }, "node_modules/patch-package": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-7.0.2.tgz", - "integrity": "sha512-PMYfL8LXxGIRmxXLqlEaBxzKPu7/SdP13ld6GSfAUJUZRmBDPp8chZs0dpzaAFn9TSPnFiMwkC6PJt6pBiAl8Q==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-8.0.0.tgz", + "integrity": "sha512-da8BVIhzjtgScwDJ2TtKsfT5JFWz1hYoBl9rUQ1f38MC2HwnEIkK8VN3dKMKcP7P7bvvgzNDbfNHtx3MsQb5vA==", "dev": true, "dependencies": { "@yarnpkg/lockfile": "^1.1.0", @@ -22035,6 +22069,7 @@ "cross-spawn": "^7.0.3", "find-yarn-workspace-root": "^2.0.0", "fs-extra": "^9.0.0", + "json-stable-stringify": "^1.0.2", "klaw-sync": "^6.0.0", "minimist": "^1.2.6", "open": "^7.4.2", @@ -24090,28 +24125,30 @@ } }, "node_modules/rc-dock": { - "version": "3.2.18", - "license": "Apache-2.0", + "version": "3.2.19", + "resolved": "https://registry.npmjs.org/rc-dock/-/rc-dock-3.2.19.tgz", + "integrity": "sha512-onjYMYw4IEzf5LbQyQt+a2mSJ58oxAgpu29CD8/rexR5IWjTsa3amxyF+CxHy2+wtqCDzi/qsDsJglH/k6Bx9g==", "dependencies": { - "classnames": "^2.3.1", + "classnames": "^2.5.1", "lodash": "^4.17.21", - "rc-dropdown": "^3.2.2", - "rc-menu": "^9.3.0", + "rc-dropdown": "~4.0.1", + "rc-menu": "~9.8.4", "rc-new-window": "^0.1.13", - "rc-tabs": "^11.10.5" + "rc-tabs": "~11.16.1" }, "peerDependencies": { - "react": ">=15.0.0", - "react-dom": ">=15.0.0" + "react": ">=17.0.0", + "react-dom": ">=17.0.0" } }, "node_modules/rc-dropdown": { - "version": "3.6.2", - "license": "MIT", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/rc-dropdown/-/rc-dropdown-4.0.1.tgz", + "integrity": "sha512-OdpXuOcme1rm45cR0Jzgfl1otzmU4vuBVb+etXM8vcaULGokAKVpKlw8p6xzspG7jGd/XxShvq+N3VNEfk/l5g==", "dependencies": { - "@babel/runtime": "^7.10.1", + "@babel/runtime": "^7.18.3", "classnames": "^2.2.6", - "rc-trigger": "^5.0.4", + "rc-trigger": "^5.3.1", "rc-util": "^5.17.0" }, "peerDependencies": { @@ -24120,8 +24157,9 @@ } }, "node_modules/rc-menu": { - "version": "9.8.2", - "license": "MIT", + "version": "9.8.4", + "resolved": "https://registry.npmjs.org/rc-menu/-/rc-menu-9.8.4.tgz", + "integrity": "sha512-lmw2j8I2fhdIzHmC9ajfImfckt0WDb2KVJJBBRIsxPEw2kGkEfjLMUoB1NgiNT/Q5cC8PdjGOGQjHJIJMwyNMw==", "dependencies": { "@babel/runtime": "^7.10.1", "classnames": "2.x", @@ -24209,20 +24247,6 @@ "react-dom": ">=16.9.0" } }, - "node_modules/rc-tabs/node_modules/rc-dropdown": { - "version": "4.0.1", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.18.3", - "classnames": "^2.2.6", - "rc-trigger": "^5.3.1", - "rc-util": "^5.17.0" - }, - "peerDependencies": { - "react": ">=16.11.0", - "react-dom": ">=16.11.0" - } - }, "node_modules/rc-tabs/node_modules/rc-menu": { "version": "9.6.4", "license": "MIT", @@ -37880,7 +37904,9 @@ "dev": true }, "classnames": { - "version": "2.3.2" + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz", + "integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==" }, "clean-css": { "version": "5.3.2", @@ -43229,6 +43255,26 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, + "json-stable-stringify": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.1.1.tgz", + "integrity": "sha512-SU/971Kt5qVQfJpyDveVhQ/vya+5hvrjClFOcr8c0Fq5aODJjMwutrOfCU+eCnVD5gpx1Q3fEqkyom77zH1iIg==", + "dev": true, + "requires": { + "call-bind": "^1.0.5", + "isarray": "^2.0.5", + "jsonify": "^0.0.1", + "object-keys": "^1.1.1" + }, + "dependencies": { + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + } + } + }, "json-stable-stringify-without-jsonify": { "version": "1.0.1", "dev": true @@ -43254,6 +43300,12 @@ "graceful-fs": "^4.1.6" } }, + "jsonify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", + "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", + "dev": true + }, "jsx-ast-utils": { "version": "3.3.5", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", @@ -44821,9 +44873,9 @@ } }, "patch-package": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-7.0.2.tgz", - "integrity": "sha512-PMYfL8LXxGIRmxXLqlEaBxzKPu7/SdP13ld6GSfAUJUZRmBDPp8chZs0dpzaAFn9TSPnFiMwkC6PJt6pBiAl8Q==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-8.0.0.tgz", + "integrity": "sha512-da8BVIhzjtgScwDJ2TtKsfT5JFWz1hYoBl9rUQ1f38MC2HwnEIkK8VN3dKMKcP7P7bvvgzNDbfNHtx3MsQb5vA==", "dev": true, "requires": { "@yarnpkg/lockfile": "^1.1.0", @@ -44832,6 +44884,7 @@ "cross-spawn": "^7.0.3", "find-yarn-workspace-root": "^2.0.0", "fs-extra": "^9.0.0", + "json-stable-stringify": "^1.0.2", "klaw-sync": "^6.0.0", "minimist": "^1.2.6", "open": "^7.4.2", @@ -46232,27 +46285,33 @@ } }, "rc-dock": { - "version": "3.2.18", + "version": "3.2.19", + "resolved": "https://registry.npmjs.org/rc-dock/-/rc-dock-3.2.19.tgz", + "integrity": "sha512-onjYMYw4IEzf5LbQyQt+a2mSJ58oxAgpu29CD8/rexR5IWjTsa3amxyF+CxHy2+wtqCDzi/qsDsJglH/k6Bx9g==", "requires": { - "classnames": "^2.3.1", + "classnames": "^2.5.1", "lodash": "^4.17.21", - "rc-dropdown": "^3.2.2", - "rc-menu": "^9.3.0", + "rc-dropdown": "~4.0.1", + "rc-menu": "~9.8.4", "rc-new-window": "^0.1.13", - "rc-tabs": "^11.10.5" + "rc-tabs": "~11.16.1" } }, "rc-dropdown": { - "version": "3.6.2", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/rc-dropdown/-/rc-dropdown-4.0.1.tgz", + "integrity": "sha512-OdpXuOcme1rm45cR0Jzgfl1otzmU4vuBVb+etXM8vcaULGokAKVpKlw8p6xzspG7jGd/XxShvq+N3VNEfk/l5g==", "requires": { - "@babel/runtime": "^7.10.1", + "@babel/runtime": "^7.18.3", "classnames": "^2.2.6", - "rc-trigger": "^5.0.4", + "rc-trigger": "^5.3.1", "rc-util": "^5.17.0" } }, "rc-menu": { - "version": "9.8.2", + "version": "9.8.4", + "resolved": "https://registry.npmjs.org/rc-menu/-/rc-menu-9.8.4.tgz", + "integrity": "sha512-lmw2j8I2fhdIzHmC9ajfImfckt0WDb2KVJJBBRIsxPEw2kGkEfjLMUoB1NgiNT/Q5cC8PdjGOGQjHJIJMwyNMw==", "requires": { "@babel/runtime": "^7.10.1", "classnames": "2.x", @@ -46308,15 +46367,6 @@ "rc-util": "^5.5.0" }, "dependencies": { - "rc-dropdown": { - "version": "4.0.1", - "requires": { - "@babel/runtime": "^7.18.3", - "classnames": "^2.2.6", - "rc-trigger": "^5.3.1", - "rc-util": "^5.17.0" - } - }, "rc-menu": { "version": "9.6.4", "requires": { diff --git a/package.json b/package.json index 972d6a3c25..fe256d0cea 100644 --- a/package.json +++ b/package.json @@ -87,19 +87,10 @@ "storybook:build": "storybook build" }, "lint-staged": { - "*.{cjs,js,jsx,ts,tsx}": [ - "prettier --write", - "cross-env NODE_ENV=development eslint --cache" - ], - "*.json": [ - "prettier --parser json --write" - ], - "*.{css,scss}": [ - "stylelint --fix --allow-empty-input" - ], - "*.{html,md,yml}": [ - "prettier --single-quote --write" - ] + "*.{cjs,js,jsx,ts,tsx}": ["prettier --write", "cross-env NODE_ENV=development eslint --cache"], + "*.json": ["prettier --parser json --write"], + "*.{css,scss}": ["stylelint --fix --allow-empty-input"], + "*.{html,md,yml}": ["prettier --single-quote --write"] }, "browserslist": [], "dependencies": { @@ -125,7 +116,7 @@ "node-localstorage": "^3.0.5", "platform-bible-react": "file:./lib/platform-bible-react", "platform-bible-utils": "file:./lib/platform-bible-utils", - "rc-dock": "^3.2.18", + "rc-dock": "^3.2.19", "react": "^18.2.0", "react-data-grid": "^7.0.0-beta.42", "react-dom": "^18.2.0", @@ -201,7 +192,7 @@ "mini-css-extract-plugin": "^2.8.0", "node-loader": "^2.0.0", "nodemon": "^3.1.0", - "patch-package": "^7.0.2", + "patch-package": "^8.0.0", "prettier": "^3.2.5", "prettier-plugin-jsdoc": "^1.3.0", "react-refresh": "^0.14.0", @@ -238,19 +229,10 @@ "npm": ">=7.x" }, "electronmon": { - "patterns": [ - "!**/**", - "src/main/**", - "src/node/**", - "src/shared/**" - ], + "patterns": ["!**/**", "src/main/**", "src/node/**", "src/shared/**"], "logLevel": "quiet" }, - "workspaces": [ - "lib/*", - "extensions", - "extensions/src/*" - ], + "workspaces": ["lib/*", "extensions", "extensions/src/*"], "volta": { "node": "20.11.1" } diff --git a/patches/rc-dock+3.2.18.patch b/patches/rc-dock+3.2.19.patch similarity index 99% rename from patches/rc-dock+3.2.18.patch rename to patches/rc-dock+3.2.19.patch index 308d943fec..3cb29ffeeb 100644 --- a/patches/rc-dock+3.2.18.patch +++ b/patches/rc-dock+3.2.19.patch @@ -4,12 +4,12 @@ index 2a7a4bc..ad0da92 100644 +++ b/node_modules/rc-dock/README.md @@ -122,7 +122,7 @@ dockMove(source: TabData | PanelData, target: string | TabData | PanelData | Box find PanelData or TabData by id - + ```typescript -find(id: string): PanelData | TabData; +find(id: string | ((item: PanelData | TabData | BoxData) => boolean), filter?: Filter): PanelData | TabData | BoxData | undefined; ``` - + ### updateTab [🗎](https://ticlo.github.io/rc-dock/classes/docklayout.docklayout-1.html#updatetab) diff --git a/node_modules/rc-dock/es/Algorithm.d.ts b/node_modules/rc-dock/es/Algorithm.d.ts index e886078..f6db041 100644 @@ -160,12 +160,12 @@ index f0844eb..9f2e63b 100644 @@ -79,14 +79,18 @@ export function nextZIndex(current?: number): number { return ++_zCount; } - + +function compareFindId(item: PanelData | TabData | BoxData, id: string | ((item: PanelData | TabData | BoxData) => boolean)): boolean { + return item && (typeof id === 'function' ? id(item) : item.id === id); +} + - + -function findInPanel(panel: PanelData, id: string, filter: Filter): PanelData | TabData | undefined { - if (panel.id === id && (filter & Filter.Panel)) { +function findInPanel(panel: PanelData, id: string | ((item: PanelData | TabData | BoxData) => boolean), filter: Filter): PanelData | TabData | undefined { @@ -182,7 +182,7 @@ index f0844eb..9f2e63b 100644 @@ -94,9 +98,9 @@ function findInPanel(panel: PanelData, id: string, filter: Filter): PanelData | return undefined; } - + -function findInBox(box: BoxData | undefined, id: string, filter: Filter): PanelData | TabData | BoxData | undefined { +function findInBox(box: BoxData | undefined, id: string | ((item: PanelData | TabData | BoxData) => boolean), filter: Filter): PanelData | TabData | BoxData | undefined { let result: PanelData | TabData | BoxData | undefined; @@ -193,12 +193,12 @@ index f0844eb..9f2e63b 100644 if (!box?.children) { @@ -133,7 +137,7 @@ export enum Filter { } - - + + -export function find(layout: LayoutData, id: string, filter: Filter = Filter.AnyTabPanel): PanelData | TabData | BoxData | undefined { +export function find(layout: LayoutData, id: string | ((item: PanelData | TabData | BoxData) => boolean), filter: Filter = Filter.AnyTabPanel): PanelData | TabData | BoxData | undefined { let result: PanelData | TabData | BoxData | undefined; - + if (filter & Filter.Docked) { diff --git a/node_modules/rc-dock/src/DockData.ts b/node_modules/rc-dock/src/DockData.ts index b71c201..7dd9cb9 100644 @@ -210,7 +210,7 @@ index b71c201..7dd9cb9 100644 */ - find(id: string, filter?: Filter): PanelData | TabData | BoxData | undefined; + find(id: string | ((item: PanelData | TabData | BoxData) => boolean), filter?: Filter): PanelData | TabData | BoxData | undefined; - + /** * Update a tab with new TabData diff --git a/node_modules/rc-dock/src/DockLayout.tsx b/node_modules/rc-dock/src/DockLayout.tsx @@ -219,10 +219,10 @@ index fcaea36..472c6b6 100644 +++ b/node_modules/rc-dock/src/DockLayout.tsx @@ -277,7 +277,7 @@ export class DockLayout extends DockPortalManager implements DockContext { } - + /** @inheritDoc */ - find(id: string, filter?: Algorithm.Filter): PanelData | TabData | BoxData | undefined { + find(id: string | ((item: PanelData | TabData | BoxData) => boolean), filter?: Algorithm.Filter): PanelData | TabData | BoxData | undefined { return Algorithm.find(this.getLayout(), id, filter); } - + diff --git a/patches/rc-tabs+11.16.1.patch b/patches/rc-tabs+11.16.1.patch deleted file mode 100644 index 8bd967c9d9..0000000000 --- a/patches/rc-tabs+11.16.1.patch +++ /dev/null @@ -1,39 +0,0 @@ -diff --git a/node_modules/rc-tabs/es/TabNavList/index.js b/node_modules/rc-tabs/es/TabNavList/index.js -index 60d1095..9c3de28 100644 ---- a/node_modules/rc-tabs/es/TabNavList/index.js -+++ b/node_modules/rc-tabs/es/TabNavList/index.js -@@ -5,7 +5,8 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; - import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; - import _typeof from "@babel/runtime/helpers/esm/typeof"; - import * as React from 'react'; --import { useState, useRef, useEffect } from 'react'; -+import { useCallback, useState, useRef, useEffect } from 'react'; -+import debounce from 'lodash/debounce'; - import classNames from 'classnames'; - import raf from "rc-util/es/raf"; - import ResizeObserver from 'rc-resize-observer'; -@@ -419,9 +420,22 @@ function TabNavList(props, ref) { - onListHolderResize(); - }, [rtl, tabBarGutter, activeKey, tabs.map(function (tab) { - return tab.key; -- }).join('_')]); // ========================= Render ======================== -+ }).join('_')]); - -- var hasDropdown = !!hiddenTabs.length; -+ var _useState17 = useState(), -+ _useState18 = _slicedToArray(_useState17, 2), -+ hasDropdown = _useState18[0], -+ setHasDropdown = _useState18[1]; -+ -+ var debounceHasDropdown = useCallback(debounce(function (_hasDropdown) { -+ setHasDropdown(_hasDropdown); -+ }, 30), []); -+ -+ useEffect(function () { -+ debounceHasDropdown(!!hiddenTabs.length) -+ }, [hiddenTabs]); -+ -+ // ========================= Render ======================== - var wrapPrefix = "".concat(prefixCls, "-nav-wrap"); - var pingLeft; - var pingRight;