Skip to content

Commit 8fe4e0e

Browse files
package updated.
1 parent b301c3b commit 8fe4e0e

10 files changed

Lines changed: 33 additions & 53 deletions

package-lock.json

Lines changed: 16 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@
7676
"@rollup/plugin-typescript": "^12.1.2",
7777
"@types/tinycolor2": "^1.4.6",
7878
"babel-preset-es2015": "^6.24.1",
79-
"electron": "^36.3.2",
80-
"electronmon": "^2.0.3",
79+
"electron": "^41.0.3",
80+
"electronmon": "^2.0.4",
8181
"mime-types": "^3.0.1",
8282
"node-polyfill-webpack-plugin": "^4.1.0",
8383
"prettier": "3.5.3",
@@ -88,8 +88,5 @@
8888
"typescript": "^5.8.3",
8989
"webpack": "^5.99.6",
9090
"webpack-cli": "^6.0.1"
91-
},
92-
"dependencies": {
93-
"tiny-essentials": "^1.24.2"
9491
}
9592
}

src/global/Utils.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { isJsonObject } from 'tiny-essentials';
2-
31
/**
42
* An extended error object that may contain additional metadata.
53
*
@@ -118,7 +116,7 @@ export function deepClone(obj) {
118116
* @throws {Error} If any value in `eventNames` (for keys that exist in `list`) is not a string.
119117
*/
120118
export const checkEventsList = (eventNames, list) => {
121-
if (!isJsonObject(eventNames)) throw new TypeError('Expected "eventNames" to be an object.');
119+
if (typeof eventNames !== 'object') throw new TypeError('Expected "eventNames" to be an object.');
122120
for (const key in list) {
123121
// @ts-ignore
124122
if (typeof eventNames[key] !== 'undefined' && typeof eventNames[key] !== 'string')

src/main/TinyElectronNotification.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { readdir, unlink } from 'node:fs/promises';
33
import { join } from 'node:path';
44

55
import { BrowserWindow, Notification } from 'electron';
6-
import { isJsonObject } from 'tiny-essentials';
76

87
import TinyIpcResponder from './TinyIpcResponder.mjs';
98
import { NotificationEvents } from '../global/Events.mjs';
@@ -170,7 +169,7 @@ class TinyElectronNotification {
170169
/** @param {NotificationConstructorOptions} data */
171170
(event, data, res) => {
172171
const win = this.#getWin(event);
173-
if (win && isJsonObject(data) && typeof data.tag === 'string') {
172+
if (win && typeof data === 'object' && typeof data.tag === 'string') {
174173
/** @type {Electron.NotificationConstructorOptions} */
175174
const newData = {
176175
...Object.fromEntries(Object.entries(data).filter(([key]) => !['tag'].includes(key))),

src/main/TinyElectronRoot.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { EventEmitter } from 'events';
55
import { app, BrowserWindow, ipcMain, session, powerMonitor, Tray } from 'electron';
66
import { release, platform } from 'node:os';
77

8-
import { isJsonObject } from 'tiny-essentials';
98
import { AppEvents, RootEvents } from '../global/Events.mjs';
109
import { checkEventsList, deepClone, serializeError } from '../global/Utils.mjs';
1110
import TinyWinInstance from './TinyWinInstance.mjs';
@@ -762,7 +761,8 @@ class TinyElectronRoot {
762761
isMain = false,
763762
} = {}) {
764763
// Validate input
765-
if (!isJsonObject(appDetails)) throw new TypeError('Expected "appDetails" to be a object.');
764+
if (typeof appDetails !== 'object')
765+
throw new TypeError('Expected "appDetails" to be a object.');
766766
if (typeof isMain !== 'boolean') throw new TypeError('Expected "isMain" to be a boolean.');
767767
if (typeof needsMaximize !== 'boolean')
768768
throw new TypeError('Expected "needsMaximize" to be a boolean.');
@@ -778,7 +778,7 @@ class TinyElectronRoot {
778778
let cfg;
779779
if (typeof fileId === 'string' && !this.#winFile.hasId(fileId)) this.#winFile.loadFile(fileId);
780780
if (typeof fileId === 'string') {
781-
if (!isJsonObject(config))
781+
if (typeof config !== 'object')
782782
throw new Error('[Window Creation Error] Expected "config" to be an object.');
783783

784784
cfg = deepClone(config);
@@ -1666,7 +1666,7 @@ class TinyElectronRoot {
16661666
}
16671667

16681668
// Validate `ops`
1669-
if (ops !== undefined && !isJsonObject(ops))
1669+
if (ops !== undefined && typeof ops !== 'object')
16701670
throw new TypeError('Expected "ops" to be an object.');
16711671

16721672
// Load by URL or file

src/main/TinyWinInstance.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { BrowserWindow, shell } from 'electron';
22
import { EventEmitter } from 'events';
3-
import { isJsonObject } from 'tiny-essentials';
43
import { AppEvents, RootEvents } from '../global/Events.mjs';
54
import { checkEventsList } from '../global/Utils.mjs';
65

@@ -653,7 +652,7 @@ class TinyWinInstance {
653652
if (typeof setProxy !== 'function')
654653
throw new Error(`[Window Creation Error] 'setProxy' must be a setProxy.`);
655654

656-
if (!isJsonObject(config))
655+
if (typeof config !== 'object')
657656
throw new Error('[Window Creation Error] Expected "config" to be an object.');
658657

659658
if (typeof isMaximized !== 'boolean')

src/main/TinyWindowFile.mjs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { readFileSync } from 'fs';
2-
import { isJsonObject } from 'tiny-essentials';
32

43
/**
54
* @typedef {{ width: number; height: number; x?: number; y?: number; }} Bounds
@@ -42,7 +41,7 @@ class TinyWindowFile {
4241
loadFile(initFile, { bounds = { width: 1200, height: 700 } } = {}) {
4342
if (typeof initFile !== 'string') throw new TypeError('Expected "initFile" to be a string.');
4443

45-
if (!isJsonObject(bounds)) throw new TypeError('Expected "bounds" to be an object.');
44+
if (typeof bounds !== 'object') throw new TypeError('Expected "bounds" to be an object.');
4645
if (typeof bounds.width !== 'number' || typeof bounds.height !== 'number')
4746
throw new TypeError('Expected "bounds" with numeric width and height.');
4847
if (
@@ -55,12 +54,12 @@ class TinyWindowFile {
5554
let data = {};
5655
try {
5756
const raw = JSON.parse(readFileSync(initFile, 'utf8'));
58-
if (isJsonObject(raw)) data = raw;
57+
if (typeof raw === 'object') data = raw;
5958
} catch {
6059
data = {};
6160
}
6261

63-
const rawBounds = isJsonObject(data.bounds) ? data.bounds : bounds;
62+
const rawBounds = typeof data.bounds === 'object' ? data.bounds : bounds;
6463
const finalBounds = {
6564
width: typeof rawBounds.width === 'number' ? rawBounds.width : bounds.width,
6665
height: typeof rawBounds.height === 'number' ? rawBounds.height : bounds.height,

src/preload/TinyElectronClient.mjs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { EventEmitter } from 'events';
22
import { ipcRenderer, contextBridge } from 'electron';
3-
import { isJsonObject } from 'tiny-essentials';
43
import { AppEvents, RootEvents } from '../global/Events.mjs';
54
import { checkEventsList, deserializeError } from '../global/Utils.mjs';
65
import TinyIpcRequestManager from './TinyIpcRequestManager.mjs';
@@ -1468,7 +1467,7 @@ class TinyElectronClient {
14681467
getConfig.then(
14691468
/** @param {WindowDataResult} data */ (data) => {
14701469
if (
1471-
isJsonObject(data.bounds) &&
1470+
typeof data.bounds === 'object' &&
14721471
typeof data.bounds.x === 'number' &&
14731472
typeof data.bounds.x === 'number' &&
14741473
typeof data.bounds.height === 'number' &&
@@ -1503,7 +1502,7 @@ class TinyElectronClient {
15031502
entries.length > 0 && typeof entries[0].type === 'string' ? entries[0].type : null;
15041503

15051504
// Fix values
1506-
if (isJsonObject(windowFirstConfig.bounds)) {
1505+
if (windowFirstConfig.bounds !== null && typeof windowFirstConfig.bounds === 'object') {
15071506
if (
15081507
this.getChangeCount('position') < 1 &&
15091508
typeof windowFirstConfig.bounds.x === 'number' &&

src/preload/TinyElectronNotification.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { ipcRenderer, contextBridge } from 'electron';
22
import { EventEmitter } from 'events';
3-
import { isJsonObject } from 'tiny-essentials';
43
import TinyIpcRequestManager from './TinyIpcRequestManager.mjs';
54
import { NotificationEvents } from '../global/Events.mjs';
65
import { checkEventsList } from '../global/Utils.mjs';
@@ -77,7 +76,7 @@ class TinyElectronNotification {
7776
*/
7877
create(arg) {
7978
return new Promise((resolve, reject) => {
80-
if (!isJsonObject(arg)) throw new TypeError('Argument "arg" must be a non-null object.');
79+
if (typeof arg !== 'object') throw new TypeError('Argument "arg" must be a non-null object.');
8180
if (!('tag' in arg)) throw new Error('Notification "tag" is required.');
8281
if (typeof arg.tag !== 'string' || arg.tag.trim() === '')
8382
throw new Error('Notification "tag" must be a non-empty string.');

src/preload/TinyWindowFrameManager.mjs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { isJsonObject } from 'tiny-essentials';
21
import {
32
getDefaultWindowFrameRoot,
43
getDefaultWindowFrameStyle,
@@ -195,7 +194,7 @@ class TinyWindowFrameManager {
195194
if (typeof windowRoot !== 'string' || !windowRoot.trim())
196195
throw new Error('windowRoot must be a non-empty string.');
197196

198-
if (!isJsonObject(icons)) throw new Error('icons must be a object.');
197+
if (typeof icons !== 'object') throw new Error('icons must be a object.');
199198
const requiredIcons = ['minimize', 'maximize', 'unmaximize', 'close'];
200199
requiredIcons.forEach((key) => {
201200
// @ts-ignore
@@ -204,7 +203,7 @@ class TinyWindowFrameManager {
204203
}
205204
});
206205

207-
if (!isJsonObject(classes)) throw new Error('classes must be a object.');
206+
if (typeof classes !== 'object') throw new Error('classes must be a object.');
208207
const requiredClasses = ['blur', 'focus', 'fullscreen', 'maximized'];
209208
requiredClasses.forEach((key) => {
210209
// @ts-ignore

0 commit comments

Comments
 (0)