craft-native 0.0.88 → 0.0.89
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/api/window.d.ts +33 -0
- package/dist/cli.js +1 -1
- package/dist/index.cjs +5 -2
- package/dist/index.js +5 -2
- package/package.json +1 -1
package/dist/api/window.d.ts
CHANGED
|
@@ -49,6 +49,15 @@ export interface WindowState {
|
|
|
49
49
|
* Window creation options
|
|
50
50
|
*/
|
|
51
51
|
export interface WindowCreateOptions {
|
|
52
|
+
/**
|
|
53
|
+
* A stable name for this window, so opening it twice reaches the same one.
|
|
54
|
+
*
|
|
55
|
+
* Without it every `create()` gets a fresh generated id and the host has no
|
|
56
|
+
* way to tell "open Settings" from "open a second Settings" — which is what
|
|
57
|
+
* Cmd+, pressed twice looks like from here. Name the window and the second
|
|
58
|
+
* call brings the first forward instead.
|
|
59
|
+
*/
|
|
60
|
+
id?: string;
|
|
52
61
|
/** Window title */
|
|
53
62
|
title?: string;
|
|
54
63
|
/** Window width */
|
|
@@ -93,6 +102,14 @@ export interface WindowCreateOptions {
|
|
|
93
102
|
skipTaskbar?: boolean;
|
|
94
103
|
/** Whether titlebar is hidden */
|
|
95
104
|
titlebarHidden?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Whether the Web Inspector is available in this window.
|
|
107
|
+
*
|
|
108
|
+
* Defaults to off for a window opened from the page: an app built with
|
|
109
|
+
* `--no-devtools` should not grow a right-click Inspect Element by opening
|
|
110
|
+
* its own Settings.
|
|
111
|
+
*/
|
|
112
|
+
devTools?: boolean;
|
|
96
113
|
/** Draw native macOS sidebar material behind a web-rendered sidebar */
|
|
97
114
|
webSidebarMaterial?: boolean;
|
|
98
115
|
/** Width of the native material backdrop behind a web-rendered sidebar */
|
|
@@ -101,6 +118,22 @@ export interface WindowCreateOptions {
|
|
|
101
118
|
webSidebarMaterialOpacity?: number;
|
|
102
119
|
/** Draw that material behind the whole web view instead of a leading strip */
|
|
103
120
|
webWindowMaterial?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Whether Craft draws its own controls beside the window buttons — the
|
|
123
|
+
* sidebar toggle and two history arrows. Defaults to on for a window with a
|
|
124
|
+
* web material behind it, which otherwise has nothing up there at all. Turn
|
|
125
|
+
* it off in a page that draws its own history row.
|
|
126
|
+
*/
|
|
127
|
+
chromeControls?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Whether the page's storage — `localStorage`, IndexedDB, cookies — survives
|
|
130
|
+
* a quit and is shared with the app's other windows.
|
|
131
|
+
*
|
|
132
|
+
* Off by default: the ephemeral store costs no disk I/O at startup. Any app
|
|
133
|
+
* that keeps a preference wants it on, and a *second* window that keeps one
|
|
134
|
+
* must have it on, or it writes where the first window cannot read.
|
|
135
|
+
*/
|
|
136
|
+
persistentStorage?: boolean;
|
|
104
137
|
/** Titlebar style (macOS) */
|
|
105
138
|
titlebarStyle?: 'default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover';
|
|
106
139
|
/** Vibrancy effect (macOS) */
|
package/dist/cli.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -2612,9 +2612,12 @@ class WindowManager {
|
|
|
2612
2612
|
return this._windows.get(id);
|
|
2613
2613
|
}
|
|
2614
2614
|
async create(options = {}) {
|
|
2615
|
-
const id = `window_${++this._idCounter}_${Date.now()}`;
|
|
2615
|
+
const id = options.id || `window_${++this._idCounter}_${Date.now()}`;
|
|
2616
|
+
const existing = this._windows.get(id);
|
|
2616
2617
|
const bridge = getBridge();
|
|
2617
|
-
await bridge.request("window.create", {
|
|
2618
|
+
await bridge.request("window.create", { ...options, id });
|
|
2619
|
+
if (existing)
|
|
2620
|
+
return existing;
|
|
2618
2621
|
const win = new Window(id);
|
|
2619
2622
|
this._windows.set(id, win);
|
|
2620
2623
|
return win;
|
package/dist/index.js
CHANGED
|
@@ -2373,9 +2373,12 @@ class WindowManager {
|
|
|
2373
2373
|
return this._windows.get(id);
|
|
2374
2374
|
}
|
|
2375
2375
|
async create(options = {}) {
|
|
2376
|
-
const id = `window_${++this._idCounter}_${Date.now()}`;
|
|
2376
|
+
const id = options.id || `window_${++this._idCounter}_${Date.now()}`;
|
|
2377
|
+
const existing = this._windows.get(id);
|
|
2377
2378
|
const bridge = getBridge();
|
|
2378
|
-
await bridge.request("window.create", {
|
|
2379
|
+
await bridge.request("window.create", { ...options, id });
|
|
2380
|
+
if (existing)
|
|
2381
|
+
return existing;
|
|
2379
2382
|
const win = new Window(id);
|
|
2380
2383
|
this._windows.set(id, win);
|
|
2381
2384
|
return win;
|