bc-deeplib 2.4.1 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/deeplib.d.ts +4 -1
- package/dist/deeplib.js +11 -12
- package/dist/deeplib.js.map +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/deeplib.d.ts
CHANGED
|
@@ -767,7 +767,10 @@ declare module 'bc-deeplib/screens/main_menu' {
|
|
|
767
767
|
}
|
|
768
768
|
declare module 'bc-deeplib/utilities/common' {
|
|
769
769
|
export type DeepMergeOptions = {
|
|
770
|
+
/** Concatenate arrays instead of replacing them. */
|
|
770
771
|
concatArrays?: boolean;
|
|
772
|
+
/** Only merge matching keys. */
|
|
773
|
+
matchingOnly?: boolean;
|
|
771
774
|
};
|
|
772
775
|
/**
|
|
773
776
|
* Deeply merges two values into a new value.
|
|
@@ -852,7 +855,7 @@ declare module 'bc-deeplib/utilities/elements/elements' {
|
|
|
852
855
|
function elementCreateCustom(options: Omit<Custom, 'type'>): HTMLElement;
|
|
853
856
|
function elementCreateInput(options: Input): HTMLElement;
|
|
854
857
|
function elementCreateLabel(options: Omit<Label, 'type'>): HTMLElement;
|
|
855
|
-
function elementCreateDropdown(options: Omit<Dropdown, 'type'>):
|
|
858
|
+
function elementCreateDropdown(options: Omit<Dropdown, 'type'>): HTMLLabelElement | HTMLDivElement;
|
|
856
859
|
function elementCreateTooltip(): HTMLDivElement;
|
|
857
860
|
function elementGetTooltip(): HTMLElement | undefined;
|
|
858
861
|
function elementSetTooltip(text: string): boolean;
|
package/dist/deeplib.js
CHANGED
|
@@ -271,7 +271,7 @@ var BaseModule = class {
|
|
|
271
271
|
const defaults = this.defaultSettings;
|
|
272
272
|
if (!storage || !defaults) return;
|
|
273
273
|
if (Object.entries(this.defaultSettings).length === 0) return;
|
|
274
|
-
target[storage] = deepMerge(this.defaultSettings, target[storage], { concatArrays: false });
|
|
274
|
+
target[storage] = deepMerge(this.defaultSettings, target[storage], { concatArrays: false, matchingOnly: true });
|
|
275
275
|
}
|
|
276
276
|
/**
|
|
277
277
|
* Provides default settings for this module.
|
|
@@ -1439,7 +1439,7 @@ function isPlainObject(value) {
|
|
|
1439
1439
|
return value !== null && typeof value === "object" && Object.getPrototypeOf(value) === Object.prototype && !Array.isArray(value);
|
|
1440
1440
|
}
|
|
1441
1441
|
__name(isPlainObject, "isPlainObject");
|
|
1442
|
-
function deepMerge(target, source, options = { concatArrays: true }) {
|
|
1442
|
+
function deepMerge(target, source, options = { concatArrays: true, matchingOnly: false }) {
|
|
1443
1443
|
if (target === void 0) return source;
|
|
1444
1444
|
if (source === void 0) return target;
|
|
1445
1445
|
if (Array.isArray(target) && Array.isArray(source) && options.concatArrays) {
|
|
@@ -1447,10 +1447,9 @@ function deepMerge(target, source, options = { concatArrays: true }) {
|
|
|
1447
1447
|
}
|
|
1448
1448
|
if (isPlainObject(target) && isPlainObject(source)) {
|
|
1449
1449
|
const result = { ...target };
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
}
|
|
1450
|
+
const keys = options.matchingOnly ? Object.keys(source).filter((k) => k in target) : Object.keys(source);
|
|
1451
|
+
for (const key of keys) {
|
|
1452
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") continue;
|
|
1454
1453
|
result[key] = key in target ? deepMerge(target[key], source[key], options) : source[key];
|
|
1455
1454
|
}
|
|
1456
1455
|
return result;
|
|
@@ -1481,7 +1480,7 @@ function exportToGlobal(name, value) {
|
|
|
1481
1480
|
current[keys[keys.length - 1]] = value;
|
|
1482
1481
|
}
|
|
1483
1482
|
__name(exportToGlobal, "exportToGlobal");
|
|
1484
|
-
function
|
|
1483
|
+
function hasGetter(obj, prop) {
|
|
1485
1484
|
while (obj && obj !== Object.prototype) {
|
|
1486
1485
|
const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
1487
1486
|
if (descriptor?.get) return true;
|
|
@@ -1489,8 +1488,8 @@ function hasGetter3(obj, prop) {
|
|
|
1489
1488
|
}
|
|
1490
1489
|
return false;
|
|
1491
1490
|
}
|
|
1492
|
-
__name(
|
|
1493
|
-
function
|
|
1491
|
+
__name(hasGetter, "hasGetter");
|
|
1492
|
+
function hasSetter(obj, prop) {
|
|
1494
1493
|
while (obj && obj !== Object.prototype) {
|
|
1495
1494
|
const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
1496
1495
|
if (descriptor?.set) return true;
|
|
@@ -1498,7 +1497,7 @@ function hasSetter3(obj, prop) {
|
|
|
1498
1497
|
}
|
|
1499
1498
|
return false;
|
|
1500
1499
|
}
|
|
1501
|
-
__name(
|
|
1500
|
+
__name(hasSetter, "hasSetter");
|
|
1502
1501
|
var byteToKB = /* @__PURE__ */ __name((nByte) => Math.round(nByte / 100) / 10, "byteToKB");
|
|
1503
1502
|
|
|
1504
1503
|
// src/utilities/elements/elements.ts
|
|
@@ -3155,8 +3154,8 @@ export {
|
|
|
3155
3154
|
exportToGlobal,
|
|
3156
3155
|
getModule,
|
|
3157
3156
|
getText,
|
|
3158
|
-
|
|
3159
|
-
|
|
3157
|
+
hasGetter,
|
|
3158
|
+
hasSetter,
|
|
3160
3159
|
initMod,
|
|
3161
3160
|
layout,
|
|
3162
3161
|
logger,
|