@codbex/harmonia 1.11.0 → 1.11.1
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/harmonia.esm.js +76 -27
- package/dist/harmonia.esm.min.js +2 -2
- package/dist/harmonia.esm.min.js.map +3 -3
- package/dist/harmonia.js +76 -27
- package/dist/harmonia.min.js +2 -2
- package/dist/harmonia.min.js.map +3 -3
- package/package.json +1 -1
package/dist/harmonia.esm.js
CHANGED
|
@@ -9342,8 +9342,13 @@ function split_default(Alpine) {
|
|
|
9342
9342
|
if (!storageKey) return;
|
|
9343
9343
|
if (saveTimer) clearTimeout(saveTimer);
|
|
9344
9344
|
saveTimer = setTimeout(() => {
|
|
9345
|
+
const usable = usableSize();
|
|
9346
|
+
if (usable <= 0) {
|
|
9347
|
+
saveTimer = null;
|
|
9348
|
+
return;
|
|
9349
|
+
}
|
|
9345
9350
|
const visible = panels.filter((p) => !p.hidden);
|
|
9346
|
-
const sizes = visible.map((p) => p.size /
|
|
9351
|
+
const sizes = visible.map((p) => p.size / usable);
|
|
9347
9352
|
localStorage.setItem(storageKey, JSON.stringify(sizes));
|
|
9348
9353
|
saveTimer = null;
|
|
9349
9354
|
}, SAVE_DELAY);
|
|
@@ -9378,26 +9383,44 @@ function split_default(Alpine) {
|
|
|
9378
9383
|
const total = usableSize();
|
|
9379
9384
|
if (!initialized) {
|
|
9380
9385
|
initialized = true;
|
|
9381
|
-
const
|
|
9382
|
-
|
|
9383
|
-
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
|
-
|
|
9390
|
-
|
|
9391
|
-
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
if (p.explicit) {
|
|
9395
|
-
p.size = p.declaredSize;
|
|
9386
|
+
const anyRestore = visible.some((p) => p.restoreFraction != null);
|
|
9387
|
+
if (anyRestore) {
|
|
9388
|
+
const restoreFractionSum = visible.reduce((sum, p) => sum + (p.restoreFraction ?? 0), 0);
|
|
9389
|
+
const remainingSpace = total * (1 - restoreFractionSum);
|
|
9390
|
+
const nonRestorePanels = visible.filter((p) => p.restoreFraction == null);
|
|
9391
|
+
const nonRestoreDeclaredTotal = nonRestorePanels.reduce((s, p) => s + (p.declaredSize ?? 0), 0);
|
|
9392
|
+
visible.forEach((p) => {
|
|
9393
|
+
if (p.restoreFraction != null) {
|
|
9394
|
+
p.size = p.restoreFraction * total;
|
|
9395
|
+
p.explicit = true;
|
|
9396
|
+
p.restoreFraction = null;
|
|
9397
|
+
} else if (nonRestoreDeclaredTotal > 0) {
|
|
9398
|
+
p.size = (p.declaredSize ?? 0) / nonRestoreDeclaredTotal * remainingSpace;
|
|
9396
9399
|
} else {
|
|
9397
|
-
p.size =
|
|
9400
|
+
p.size = nonRestorePanels.length > 0 ? remainingSpace / nonRestorePanels.length : 0;
|
|
9398
9401
|
}
|
|
9399
|
-
p.size = Math.min(Math.max(p.size ?? share, p.min), p.max);
|
|
9400
9402
|
});
|
|
9403
|
+
} else {
|
|
9404
|
+
const stored = loadSizes();
|
|
9405
|
+
if (stored && stored.length === visible.length) {
|
|
9406
|
+
visible.forEach((p, i) => {
|
|
9407
|
+
p.size = stored[i] * usableSize();
|
|
9408
|
+
p.explicit = true;
|
|
9409
|
+
});
|
|
9410
|
+
} else {
|
|
9411
|
+
const explicitTotal = visible.filter((p) => p.explicit).reduce((sum, p) => sum + p.declaredSize, 0);
|
|
9412
|
+
const autoPanels = visible.filter((p) => !p.explicit);
|
|
9413
|
+
const remaining = total - explicitTotal;
|
|
9414
|
+
const share = autoPanels.length ? remaining / autoPanels.length : 0;
|
|
9415
|
+
visible.forEach((p) => {
|
|
9416
|
+
if (p.explicit) {
|
|
9417
|
+
p.size = p.declaredSize;
|
|
9418
|
+
} else {
|
|
9419
|
+
p.size = share;
|
|
9420
|
+
}
|
|
9421
|
+
p.size = Math.min(Math.max(p.size ?? share, p.min), p.max);
|
|
9422
|
+
});
|
|
9423
|
+
}
|
|
9401
9424
|
}
|
|
9402
9425
|
}
|
|
9403
9426
|
visible.forEach((p) => {
|
|
@@ -9410,6 +9433,10 @@ function split_default(Alpine) {
|
|
|
9410
9433
|
let delta = total - currentTotal;
|
|
9411
9434
|
if (Math.abs(delta) < DELTA_ABS) {
|
|
9412
9435
|
visible.forEach((p) => p.apply());
|
|
9436
|
+
if (total > 0)
|
|
9437
|
+
visible.forEach((p) => {
|
|
9438
|
+
p.savedFraction = p.size / total;
|
|
9439
|
+
});
|
|
9413
9440
|
return;
|
|
9414
9441
|
}
|
|
9415
9442
|
let flexible = visible.filter((p) => {
|
|
@@ -9443,6 +9470,10 @@ function split_default(Alpine) {
|
|
|
9443
9470
|
if (Math.abs(consumed) < DELTA_ABS) break;
|
|
9444
9471
|
}
|
|
9445
9472
|
visible.forEach((p) => p.apply());
|
|
9473
|
+
if (total > 0)
|
|
9474
|
+
visible.forEach((p) => {
|
|
9475
|
+
p.savedFraction = p.size / total;
|
|
9476
|
+
});
|
|
9446
9477
|
};
|
|
9447
9478
|
let layoutFrame = null;
|
|
9448
9479
|
const queueLayout = () => {
|
|
@@ -9477,7 +9508,6 @@ function split_default(Alpine) {
|
|
|
9477
9508
|
queueLayout();
|
|
9478
9509
|
},
|
|
9479
9510
|
panelHidden() {
|
|
9480
|
-
initialized = false;
|
|
9481
9511
|
refreshGutters();
|
|
9482
9512
|
queueLayout();
|
|
9483
9513
|
},
|
|
@@ -9488,6 +9518,9 @@ function split_default(Alpine) {
|
|
|
9488
9518
|
panelChange() {
|
|
9489
9519
|
queueLayout();
|
|
9490
9520
|
},
|
|
9521
|
+
resetInit() {
|
|
9522
|
+
initialized = false;
|
|
9523
|
+
},
|
|
9491
9524
|
normalize,
|
|
9492
9525
|
saveSizes
|
|
9493
9526
|
};
|
|
@@ -9651,6 +9684,9 @@ function split_default(Alpine) {
|
|
|
9651
9684
|
max: split._h_split.normalize(el.getAttribute("data-max")) ?? Infinity,
|
|
9652
9685
|
collapsed: false,
|
|
9653
9686
|
prevSize: null,
|
|
9687
|
+
prevHiddenFraction: null,
|
|
9688
|
+
savedFraction: null,
|
|
9689
|
+
restoreFraction: null,
|
|
9654
9690
|
apply() {
|
|
9655
9691
|
el.style.flexBasis = `${this.size.toFixed(2)}px`;
|
|
9656
9692
|
if (split._h_split.state.isBorder) {
|
|
@@ -9755,7 +9791,7 @@ function split_default(Alpine) {
|
|
|
9755
9791
|
gutter.addEventListener("pointerdown", drag);
|
|
9756
9792
|
const collapse = () => {
|
|
9757
9793
|
if (panel.collapsed) return;
|
|
9758
|
-
panel.prevSize = panel.size;
|
|
9794
|
+
panel.prevSize = panel.size > (panel.min ?? 0) ? panel.size : panel.declaredSize;
|
|
9759
9795
|
panel.size = panel.min ?? 0;
|
|
9760
9796
|
panel.collapsed = true;
|
|
9761
9797
|
panel.explicit = true;
|
|
@@ -9779,19 +9815,32 @@ function split_default(Alpine) {
|
|
|
9779
9815
|
panel.explicit = true;
|
|
9780
9816
|
split._h_split.panelChange();
|
|
9781
9817
|
};
|
|
9818
|
+
const setState = () => {
|
|
9819
|
+
if (panel.hidden) {
|
|
9820
|
+
el.classList.add("hidden");
|
|
9821
|
+
} else {
|
|
9822
|
+
el.classList.remove("hidden");
|
|
9823
|
+
}
|
|
9824
|
+
split._h_split.panelHidden();
|
|
9825
|
+
};
|
|
9826
|
+
setState();
|
|
9782
9827
|
const observer = new MutationObserver((mutations) => {
|
|
9783
9828
|
mutations.forEach((mutation) => {
|
|
9784
9829
|
if (mutation.attributeName === "data-gutterless") {
|
|
9785
9830
|
gutterless = el.getAttribute("data-gutterless") === "true";
|
|
9786
9831
|
split._h_split.gutterHidden();
|
|
9787
9832
|
} else if (mutation.attributeName === "data-hidden") {
|
|
9788
|
-
|
|
9789
|
-
if (panel.hidden) {
|
|
9790
|
-
|
|
9791
|
-
} else {
|
|
9792
|
-
|
|
9833
|
+
const newHidden = el.getAttribute("data-hidden") === "true";
|
|
9834
|
+
if (!panel.hidden && newHidden) {
|
|
9835
|
+
panel.prevHiddenFraction = panel.savedFraction;
|
|
9836
|
+
} else if (panel.hidden && !newHidden) {
|
|
9837
|
+
if (panel.prevHiddenFraction != null) {
|
|
9838
|
+
panel.restoreFraction = panel.prevHiddenFraction;
|
|
9839
|
+
}
|
|
9840
|
+
split._h_split.resetInit();
|
|
9793
9841
|
}
|
|
9794
|
-
|
|
9842
|
+
panel.hidden = newHidden;
|
|
9843
|
+
setState();
|
|
9795
9844
|
} else if (mutation.attributeName === "data-locked") {
|
|
9796
9845
|
panel.setLocked();
|
|
9797
9846
|
} else {
|
|
@@ -11579,7 +11628,7 @@ function tree_default(Alpine) {
|
|
|
11579
11628
|
}
|
|
11580
11629
|
|
|
11581
11630
|
// package.json
|
|
11582
|
-
var version = "1.11.
|
|
11631
|
+
var version = "1.11.1";
|
|
11583
11632
|
|
|
11584
11633
|
// src/utils/theme.js
|
|
11585
11634
|
var colorSchemeKey = "codbex.harmonia.colorMode";
|