electron-react-titlebar
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -8,3 +8,3 @@ module.exports = { | ||
], | ||
"plugins": ["@typescript-eslint"], | ||
"plugins": ["@typescript-eslint", "prettier"], | ||
"parser": "@typescript-eslint/parser", | ||
@@ -17,4 +17,5 @@ "parserOptions": { | ||
"rules": { | ||
"prettier/prettier": "error", | ||
}, | ||
"ignorePatterns": ["*.js", "*.d.ts"] | ||
} |
@@ -1,4 +0,3 @@ | ||
module.export = { | ||
module.exports = { | ||
"printWidth": 120, | ||
"trailingComma": "es5", | ||
"tabWidth": 2, | ||
@@ -5,0 +4,0 @@ "semi": false, |
{ | ||
"name": "electron-react-titlebar", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "A github desktop style title bar component for electron.", | ||
@@ -37,25 +37,26 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@babel/core": "^7.15.5", | ||
"@babel/eslint-parser": "^7.15.7", | ||
"@babel/preset-env": "^7.15.6", | ||
"@babel/preset-react": "^7.14.5", | ||
"@babel/preset-typescript": "^7.15.0", | ||
"@types/electron": "^1.6.10", | ||
"@types/lodash": "^4.14.175", | ||
"@types/react": "^17.0.26", | ||
"@types/react-virtualized": "^9.21.13", | ||
"@typescript-eslint/eslint-plugin": "^4.32.0", | ||
"@typescript-eslint/parser": "^4.32.0", | ||
"babel-loader": "^8.2.2", | ||
"electron": "^15.1.0", | ||
"eslint": "^7.32.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-import": "^2.24.2", | ||
"eslint-plugin-react": "^7.26.1", | ||
"prettier": "^2.4.1", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2", | ||
"typescript": "^4.4.3", | ||
"webpack": "^5.56.0", | ||
"webpack-cli": "^4.8.0", | ||
"@babel/core": "^7.18.2", | ||
"@babel/eslint-parser": "^7.18.2", | ||
"@babel/preset-env": "^7.18.2", | ||
"@babel/preset-react": "^7.17.12", | ||
"@babel/preset-typescript": "^7.17.12", | ||
"@types/lodash": "^4.14.182", | ||
"@types/react": "^17.*", | ||
"@types/react-virtualized": "^9.21.21", | ||
"@types/react-window": "^1.8.5", | ||
"@typescript-eslint/eslint-plugin": "^5.27.1", | ||
"@typescript-eslint/parser": "^5.27.1", | ||
"babel-loader": "^8.2.5", | ||
"electron": "^19.0.4", | ||
"eslint": "^8.17.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"eslint-plugin-react": "^7.30.0", | ||
"prettier": "^2.6.2", | ||
"react": "^17.*", | ||
"react-dom": "^17.*", | ||
"typescript": "^4.7.3", | ||
"webpack": "^5.73.0", | ||
"webpack-cli": "^4.9.2", | ||
"webpack-node-externals": "^3.0.0" | ||
@@ -66,4 +67,4 @@ }, | ||
"lodash": "^4.17.21", | ||
"react-virtualized": "^9.22.3" | ||
"react-window": "^1.8.7" | ||
} | ||
} |
@@ -13,4 +13,6 @@ import { ipcMain, BrowserWindow, WebContents } from 'electron' | ||
export const initialize = (): void => { | ||
ipcMain.handle('electron-react-titlebar/initialize', (event, browserWindowId): number | undefined => { | ||
const browserWindow = browserWindowId ? BrowserWindow.fromId(browserWindowId) : BrowserWindow.fromWebContents(event.sender) | ||
ipcMain.handle('electron-react-titlebar/initialize', (event, browserWindowId: number): number | undefined => { | ||
const browserWindow = browserWindowId | ||
? BrowserWindow.fromId(browserWindowId) | ||
: BrowserWindow.fromWebContents(event.sender) | ||
if (browserWindow) { | ||
@@ -23,4 +25,6 @@ setupEventListener(browserWindow, event.sender) | ||
ipcMain.on('electron-react-titlebar/maximumize/set', (event, browserWindowId) => { | ||
const browserWindow = browserWindowId ? BrowserWindow.fromId(browserWindowId) : BrowserWindow.fromWebContents(event.sender) | ||
ipcMain.on('electron-react-titlebar/maximumize/set', (event, browserWindowId: number) => { | ||
const browserWindow = browserWindowId | ||
? BrowserWindow.fromId(browserWindowId) | ||
: BrowserWindow.fromWebContents(event.sender) | ||
if (browserWindow?.isMaximizable()) { | ||
@@ -35,11 +39,15 @@ if (browserWindow.isMaximized()) { | ||
ipcMain.on('electron-react-titlebar/minimumize/set', (event, browserWindowId) => { | ||
const browserWindow = browserWindowId ? BrowserWindow.fromId(browserWindowId) : BrowserWindow.fromWebContents(event.sender) | ||
ipcMain.on('electron-react-titlebar/minimumize/set', (event, browserWindowId: number) => { | ||
const browserWindow = browserWindowId | ||
? BrowserWindow.fromId(browserWindowId) | ||
: BrowserWindow.fromWebContents(event.sender) | ||
browserWindow?.minimize() | ||
}) | ||
ipcMain.on('electron-react-titlebar/close', (event, browserWindowId) => { | ||
const browserWindow = browserWindowId ? BrowserWindow.fromId(browserWindowId) : BrowserWindow.fromWebContents(event.sender) | ||
ipcMain.on('electron-react-titlebar/close', (event, browserWindowId: number) => { | ||
const browserWindow = browserWindowId | ||
? BrowserWindow.fromId(browserWindowId) | ||
: BrowserWindow.fromWebContents(event.sender) | ||
browserWindow?.close() | ||
}) | ||
} |
@@ -7,9 +7,7 @@ import { isEqual } from 'lodash' | ||
export function reduxSet<T>(obj: Obj<T>, path: (string | number)[], val: CommonTypes ): Obj<T> | CommonTypes { | ||
export function reduxSet<T>(obj: Obj<T>, path: (string | number)[], val: CommonTypes): Obj<T> | CommonTypes { | ||
const [prop, ...restPath] = path | ||
if (typeof prop === 'undefined') { | ||
if (!isEqual(obj, val)) | ||
return val | ||
else | ||
return obj | ||
if (!isEqual(obj, val)) return val | ||
else return obj | ||
} | ||
@@ -26,7 +24,3 @@ let before | ||
if (Array.isArray(obj)) { | ||
result = [ | ||
...obj.slice(0, prop as number), | ||
after, | ||
...obj.slice((prop as number) + 1, obj.length) | ||
] as T[] | ||
result = [...obj.slice(0, prop as number), after, ...obj.slice((prop as number) + 1, obj.length)] as T[] | ||
} else { | ||
@@ -33,0 +27,0 @@ result = { |
@@ -21,4 +21,5 @@ { | ||
"outDir": "dist", | ||
"skipLibCheck": true, | ||
}, | ||
"include": ["./src/**/*"] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
81976
1205
25
+ Addedreact-window@^1.8.7
+ Addedmemoize-one@5.2.1(transitive)
+ Addedreact-window@1.8.11(transitive)
- Removedreact-virtualized@^9.22.3
- Removedclsx@1.2.1(transitive)
- Removedcsstype@3.1.3(transitive)
- Removeddom-helpers@5.2.1(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedreact-is@16.13.1(transitive)
- Removedreact-lifecycles-compat@3.0.4(transitive)
- Removedreact-virtualized@9.22.6(transitive)