Update gitignore (sorry)

This commit is contained in:
olcxja 2026-05-10 14:02:17 +02:00
commit cca8b02fea
6604 changed files with 1219661 additions and 4 deletions

46
electron/node_modules/electron-window-state/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,46 @@
import * as Electron from 'electron'
declare function windowStateKeeper(opts: windowStateKeeper.Options): windowStateKeeper.State;
declare namespace windowStateKeeper {
interface Options {
/** The height that should be returned if no file exists yet. Defaults to `600`. */
defaultHeight?: number;
/** The width that should be returned if no file exists yet. Defaults to `800`. */
defaultWidth?: number;
fullScreen?: boolean;
/** The path where the state file should be written to. Defaults to `app.getPath('userData')`. */
path?: string;
/** The name of file. Defaults to `window-state.json`. */
file?: string;
/** Should we automatically maximize the window, if it was last closed maximized. Defaults to `true`. */
maximize?: boolean;
}
interface State {
displayBounds: {
height: number;
width: number;
};
/** The saved height of loaded state. `defaultHeight` if the state has not been saved yet. */
height: number;
/** true if the window state was saved while the window was in full screen mode. `undefined` if the state has not been saved yet. */
isFullScreen: boolean;
/** `true` if the window state was saved while the window was maximized. `undefined` if the state has not been saved yet. */
isMaximized: boolean;
/** Register listeners on the given `BrowserWindow` for events that are related to size or position changes (resize, move). It will also restore the window's maximized or full screen state. When the window is closed we automatically remove the listeners and save the state. */
manage: (window: Electron.BrowserWindow) => void;
/** Saves the current state of the given `BrowserWindow`. This exists mostly for legacy purposes, and in most cases it's better to just use `manage()`. */
saveState: (window: Electron.BrowserWindow) => void;
/** Removes all listeners of the managed `BrowserWindow` in case it does not need to be managed anymore. */
unmanage: () => void;
/** The saved width of loaded state. `defaultWidth` if the state has not been saved yet. */
width: number;
/** The saved x coordinate of the loaded state. `undefined` if the state has not been saved yet. */
x: number;
/** The saved y coordinate of the loaded state. `undefined` if the state has not been saved yet. */
y: number;
}
}
export = windowStateKeeper;

186
electron/node_modules/electron-window-state/index.js generated vendored Normal file
View file

@ -0,0 +1,186 @@
'use strict';
const path = require('path');
const electron = require('electron');
const jsonfile = require('jsonfile');
const mkdirp = require('mkdirp');
module.exports = function (options) {
const app = electron.app || electron.remote.app;
const screen = electron.screen || electron.remote.screen;
let state;
let winRef;
let stateChangeTimer;
const eventHandlingDelay = 100;
const config = Object.assign({
file: 'window-state.json',
path: app.getPath('userData'),
maximize: true,
fullScreen: true
}, options);
const fullStoreFileName = path.join(config.path, config.file);
function isNormal(win) {
return !win.isMaximized() && !win.isMinimized() && !win.isFullScreen();
}
function hasBounds() {
return state &&
Number.isInteger(state.x) &&
Number.isInteger(state.y) &&
Number.isInteger(state.width) && state.width > 0 &&
Number.isInteger(state.height) && state.height > 0;
}
function resetStateToDefault() {
const displayBounds = screen.getPrimaryDisplay().bounds;
// Reset state to default values on the primary display
state = {
width: config.defaultWidth || 800,
height: config.defaultHeight || 600,
x: 0,
y: 0,
displayBounds
};
}
function windowWithinBounds(bounds) {
return (
state.x >= bounds.x &&
state.y >= bounds.y &&
state.x + state.width <= bounds.x + bounds.width &&
state.y + state.height <= bounds.y + bounds.height
);
}
function ensureWindowVisibleOnSomeDisplay() {
const visible = screen.getAllDisplays().some(display => {
return windowWithinBounds(display.bounds);
});
if (!visible) {
// Window is partially or fully not visible now.
// Reset it to safe defaults.
return resetStateToDefault();
}
}
function validateState() {
const isValid = state && (hasBounds() || state.isMaximized || state.isFullScreen);
if (!isValid) {
state = null;
return;
}
if (hasBounds() && state.displayBounds) {
ensureWindowVisibleOnSomeDisplay();
}
}
function updateState(win) {
win = win || winRef;
if (!win) {
return;
}
// Don't throw an error when window was closed
try {
const winBounds = win.getBounds();
if (isNormal(win)) {
state.x = winBounds.x;
state.y = winBounds.y;
state.width = winBounds.width;
state.height = winBounds.height;
}
state.isMaximized = win.isMaximized();
state.isFullScreen = win.isFullScreen();
state.displayBounds = screen.getDisplayMatching(winBounds).bounds;
} catch (err) {}
}
function saveState(win) {
// Update window state only if it was provided
if (win) {
updateState(win);
}
// Save state
try {
mkdirp.sync(path.dirname(fullStoreFileName));
jsonfile.writeFileSync(fullStoreFileName, state);
} catch (err) {
// Don't care
}
}
function stateChangeHandler() {
// Handles both 'resize' and 'move'
clearTimeout(stateChangeTimer);
stateChangeTimer = setTimeout(updateState, eventHandlingDelay);
}
function closeHandler() {
updateState();
}
function closedHandler() {
// Unregister listeners and save state
unmanage();
saveState();
}
function manage(win) {
if (config.maximize && state.isMaximized) {
win.maximize();
}
if (config.fullScreen && state.isFullScreen) {
win.setFullScreen(true);
}
win.on('resize', stateChangeHandler);
win.on('move', stateChangeHandler);
win.on('close', closeHandler);
win.on('closed', closedHandler);
winRef = win;
}
function unmanage() {
if (winRef) {
winRef.removeListener('resize', stateChangeHandler);
winRef.removeListener('move', stateChangeHandler);
clearTimeout(stateChangeTimer);
winRef.removeListener('close', closeHandler);
winRef.removeListener('closed', closedHandler);
winRef = null;
}
}
// Load previous state
try {
state = jsonfile.readFileSync(fullStoreFileName);
} catch (err) {
// Don't care
}
// Check state validity
validateState();
// Set state fallback values
state = Object.assign({
width: config.defaultWidth || 800,
height: config.defaultHeight || 600
}, state);
return {
get x() { return state.x; },
get y() { return state.y; },
get width() { return state.width; },
get height() { return state.height; },
get displayBounds() { return state.displayBounds; },
get isMaximized() { return state.isMaximized; },
get isFullScreen() { return state.isFullScreen; },
saveState,
unmanage,
manage,
resetStateToDefault
};
};

22
electron/node_modules/electron-window-state/license generated vendored Normal file
View file

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 Jakub Szwacz
Copyright (c) Marcel Wiehle <marcel@wiehle.me> (http://marcel.wiehle.me)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -0,0 +1,48 @@
{
"name": "electron-window-state",
"version": "5.0.3",
"description": "Simple module that helps to save and restore size and position of Electron windows.",
"license": "MIT",
"repository": "mawie81/electron-window-state",
"main": "index.js",
"author": "Marcel Wiehle",
"engines": {
"node": ">=8.0.0"
},
"scripts": {
"test": "xo && ava"
},
"keywords": [
"electron"
],
"files": [
"index.js",
"index.d.ts"
],
"dependencies": {
"jsonfile": "^4.0.0",
"mkdirp": "^0.5.1"
},
"devDependencies": {
"ava": "^0.25.0",
"mockery": "^2.1.0",
"sinon": "^6.1.5",
"xo": "^0.22.0"
},
"xo": {
"space": true,
"ignores": [
"index.d.ts"
],
"rules": {
"brace-style": [
2,
"1tbs",
{
"allowSingleLine": true
}
],
"prefer-object-spread": 0
}
}
}

139
electron/node_modules/electron-window-state/readme.md generated vendored Normal file
View file

@ -0,0 +1,139 @@
# electron-window-state [![Build Status](https://travis-ci.org/mawie81/electron-window-state.svg)](https://travis-ci.org/mawie81/electron-window-state)
> A library to store and restore window sizes and positions for your
[Electron](http://electron.atom.io) app
*Heavily influenced by the implementation in [electron-boilerplate](https://github.com/szwacz/electron-boilerplate).*
## Install
```
$ npm install --save electron-window-state
```
## Usage
```js
const windowStateKeeper = require('electron-window-state');
let win;
app.on('ready', function () {
// Load the previous state with fallback to defaults
let mainWindowState = windowStateKeeper({
defaultWidth: 1000,
defaultHeight: 800
});
// Create the window using the state information
win = new BrowserWindow({
'x': mainWindowState.x,
'y': mainWindowState.y,
'width': mainWindowState.width,
'height': mainWindowState.height
});
// Let us register listeners on the window, so we can update the state
// automatically (the listeners will be removed when the window is closed)
// and restore the maximized or full screen state
mainWindowState.manage(win);
});
```
Please do not set `useContentSize` to `true` at creating `BrowserWindow` instance
because it changes how to calculate window size.
## API
#### windowStateKeeper(opts)
Note: Don't call this function before the `ready` event is fired.
##### opts
`defaultWidth` - *Number*
The width that should be returned if no file exists yet. Defaults to `800`.
`defaultHeight` - *Number*
The height that should be returned if no file exists yet. Defaults to `600`.
`path` - *String*
The path where the state file should be written to. Defaults to
`app.getPath('userData')`
`file` - *String*
The name of file. Defaults to `window-state.json`
`maximize` - *Boolean*
Should we automatically maximize the window, if it was last closed
maximized. Defaults to `true`
`fullScreen` - *Boolean*
Should we automatically restore the window to full screen, if it was last
closed full screen. Defaults to `true`
### state object
```js
const windowState = windowStateKeeper({
defaultWidth: 1000,
defaultHeight: 800
});
```
`x` - *Number*
The saved `x` coordinate of the loaded state. `undefined` if the state has not
been saved yet.
`y` - *Number*
The saved `y` coordinate of the loaded state. `undefined` if the state has not
been saved yet.
`width` - *Number*
The saved `width` of loaded state. `defaultWidth` if the state has not been
saved yet.
`height` - *Number*
The saved `heigth` of loaded state. `defaultHeight` if the state has not been
saved yet.
`isMaximized` - *Boolean*
`true` if the window state was saved while the window was maximized.
`undefined` if the state has not been saved yet.
`isFullScreen` - *Boolean*
`true` if the window state was saved while the window was in full screen
mode. `undefined` if the state has not been saved yet.
`manage(window)` - *Function*
Register listeners on the given `BrowserWindow` for events that are
related to size or position changes (`resize`, `move`). It will also restore
the window's maximized or full screen state.
When the window is closed we automatically remove the listeners and save the
state.
`unmanage` - *Function*
Removes all listeners of the managed `BrowserWindow` in case it does not
need to be managed anymore.
`saveState(window)` - *Function*
Saves the current state of the given `BrowserWindow`. This exists mostly for
legacy purposes, and in most cases it's better to just use `manage`.
## License
MIT © [Marcel Wiehle](http://marcel.wiehle.me)