@stacksjs/desktop 0.2.46 → 0.2.54
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/index.js +23 -2
- package/dist/index.js.map +4 -4
- package/dist/types.d.ts +10 -3
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1722,6 +1722,9 @@ function hasNativeDialogSupport() {
|
|
|
1722
1722
|
function isBrowser2() {
|
|
1723
1723
|
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
1724
1724
|
}
|
|
1725
|
+
function shouldAutoResolveInTest() {
|
|
1726
|
+
return typeof process !== "undefined" && (process.env.BUN_TEST === "1" || false);
|
|
1727
|
+
}
|
|
1725
1728
|
var activeModals = [];
|
|
1726
1729
|
function generateModalId() {
|
|
1727
1730
|
return `modal-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
@@ -1868,6 +1871,12 @@ async function showModal(options) {
|
|
|
1868
1871
|
firstButton.focus();
|
|
1869
1872
|
}
|
|
1870
1873
|
} catch {}
|
|
1874
|
+
if (shouldAutoResolveInTest()) {
|
|
1875
|
+
setTimeout(() => {
|
|
1876
|
+
if (activeModals.includes(state))
|
|
1877
|
+
closeModal(state, options.defaultButton ?? 0, false);
|
|
1878
|
+
}, 0);
|
|
1879
|
+
}
|
|
1871
1880
|
} catch {
|
|
1872
1881
|
console.log(`[stx-modal] ${options.type?.toUpperCase() || "INFO"}: ${options.title || "Modal"}`);
|
|
1873
1882
|
console.log(`[stx-modal] ${options.message}`);
|
|
@@ -2639,6 +2648,17 @@ function getDesktopConfig() {
|
|
|
2639
2648
|
function resetDesktopConfig() {
|
|
2640
2649
|
currentConfig = {};
|
|
2641
2650
|
}
|
|
2651
|
+
function prepareSidebarConfig(options) {
|
|
2652
|
+
if (!options.sidebarConfig)
|
|
2653
|
+
return;
|
|
2654
|
+
const config = { ...options.sidebarConfig };
|
|
2655
|
+
if (config.variant === "desktop") {
|
|
2656
|
+
config.material = config.material ?? "sidebar";
|
|
2657
|
+
config.backgroundEffect = config.backgroundEffect ?? "shimmer";
|
|
2658
|
+
config.allowsVibrancy = config.allowsVibrancy ?? true;
|
|
2659
|
+
}
|
|
2660
|
+
return config;
|
|
2661
|
+
}
|
|
2642
2662
|
var DEFAULT_SEARCH_PATHS = [
|
|
2643
2663
|
join(process3.env.HOME || "", ".bun/bin/craft"),
|
|
2644
2664
|
join(process3.env.HOME || "", "Code/Tools/craft/packages/zig/zig-out/bin/craft"),
|
|
@@ -2782,6 +2802,7 @@ async function openDevWindow(port, options = {}) {
|
|
|
2782
2802
|
const { createApp } = await import("ts-craft");
|
|
2783
2803
|
console.log("\u26A1 Opening native window via ts-craft\u2026");
|
|
2784
2804
|
const useSystemTray = !options.nativeSidebar;
|
|
2805
|
+
const sidebarConfig = prepareSidebarConfig(options);
|
|
2785
2806
|
const app = createApp({
|
|
2786
2807
|
url,
|
|
2787
2808
|
craftPath: getCraftBinaryPath(),
|
|
@@ -2796,7 +2817,7 @@ async function openDevWindow(port, options = {}) {
|
|
|
2796
2817
|
devTools: true,
|
|
2797
2818
|
nativeSidebar: options.nativeSidebar ?? false,
|
|
2798
2819
|
sidebarWidth: options.sidebarWidth ?? 260,
|
|
2799
|
-
sidebarConfig
|
|
2820
|
+
sidebarConfig
|
|
2800
2821
|
}
|
|
2801
2822
|
});
|
|
2802
2823
|
const id = `dev-window-${port}`;
|
|
@@ -6356,4 +6377,4 @@ export {
|
|
|
6356
6377
|
AVAILABLE_COMPONENTS
|
|
6357
6378
|
};
|
|
6358
6379
|
|
|
6359
|
-
//# debugId=
|
|
6380
|
+
//# debugId=60918F66F823BDB064756E2164756E21
|