craft-native 0.0.85 → 0.0.87

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.
@@ -97,8 +97,10 @@ export interface WindowCreateOptions {
97
97
  webSidebarMaterial?: boolean;
98
98
  /** Width of the native material backdrop behind a web-rendered sidebar */
99
99
  webSidebarWidth?: number;
100
- /** White/dark tint opacity over the native material backdrop */
100
+ /** White/dark tint opacity over the native material backdrop (sidebar span only) */
101
101
  webSidebarMaterialOpacity?: number;
102
+ /** Draw that material behind the whole web view instead of a leading strip */
103
+ webWindowMaterial?: boolean;
102
104
  /** Titlebar style (macOS) */
103
105
  titlebarStyle?: 'default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover';
104
106
  /** Vibrancy effect (macOS) */
@@ -332,6 +334,15 @@ export declare class Window {
332
334
  * Set vibrancy effect (macOS)
333
335
  */
334
336
  setVibrancy(vibrancy: WindowCreateOptions['vibrancy'] | null): Promise<void>;
337
+ /**
338
+ * Pin the window to light or dark, or hand it back to the OS (macOS).
339
+ *
340
+ * Everything native around the page — a material backdrop, a vibrancy view,
341
+ * the window buttons — resolves against the *window's* appearance. An app
342
+ * with its own light/dark control is the only thing that knows which it
343
+ * picked, so it has to say, or the page and its window disagree.
344
+ */
345
+ setAppearance(appearance: 'light' | 'dark' | 'system'): Promise<void>;
335
346
  /**
336
347
  * Where the platform's window buttons are — read, not written.
337
348
  *
@@ -454,6 +465,8 @@ declare class WindowManager {
454
465
  setBackgroundColor: (color: string) => Promise<void>;
455
466
  /** Set current window vibrancy (macOS) */
456
467
  setVibrancy: (vibrancy: WindowCreateOptions['vibrancy'] | null) => Promise<void>;
468
+ /** Pin the current window to light or dark, or follow the OS (macOS) */
469
+ setAppearance: (appearance: 'light' | 'dark' | 'system') => Promise<void>;
457
470
  /** Set current window resizable */
458
471
  setResizable: (resizable: boolean) => Promise<void>;
459
472
  /** Start moving current window from a native pointer event */
package/dist/cli.js CHANGED
@@ -4191,7 +4191,7 @@ function craftBinaryNotFoundMessage(triedPath) {
4191
4191
  `);
4192
4192
  }
4193
4193
  // package.json
4194
- var version = "0.0.85";
4194
+ var version = "0.0.87";
4195
4195
 
4196
4196
  // bin/cli.ts
4197
4197
  var spawnedFrom = process6.env[CRAFT_CLI_SPAWN_MARKER];
package/dist/index.cjs CHANGED
@@ -2532,6 +2532,9 @@ class Window {
2532
2532
  async setVibrancy(vibrancy) {
2533
2533
  await this._call("setVibrancy", { vibrancy });
2534
2534
  }
2535
+ async setAppearance(appearance) {
2536
+ await this._call("setAppearance", { appearance });
2537
+ }
2535
2538
  get windowControls() {
2536
2539
  return globalThis.craft?.windowControls;
2537
2540
  }
@@ -2631,6 +2634,7 @@ class WindowManager {
2631
2634
  setOpacity = (opacity) => this.current.setOpacity(opacity);
2632
2635
  setBackgroundColor = (color) => this.current.setBackgroundColor(color);
2633
2636
  setVibrancy = (vibrancy) => this.current.setVibrancy(vibrancy);
2637
+ setAppearance = (appearance) => this.current.setAppearance(appearance);
2634
2638
  setResizable = (resizable) => this.current.setResizable(resizable);
2635
2639
  startDrag = () => this.current.startDrag();
2636
2640
  getState = () => this.current.getState();
@@ -10749,7 +10753,9 @@ class CraftApp {
10749
10753
  args.push("--keep-running");
10750
10754
  else if (window3?.keepRunning === false)
10751
10755
  args.push("--quit-on-close");
10752
- if (window3?.webSidebarMaterial) {
10756
+ if (window3?.webWindowMaterial) {
10757
+ args.push("--web-window-material");
10758
+ } else if (window3?.webSidebarMaterial) {
10753
10759
  args.push("--web-sidebar-material");
10754
10760
  if (window3?.webSidebarWidth)
10755
10761
  args.push("--web-sidebar-width", String(window3.webSidebarWidth));
package/dist/index.js CHANGED
@@ -2302,6 +2302,9 @@ class Window {
2302
2302
  async setVibrancy(vibrancy) {
2303
2303
  await this._call("setVibrancy", { vibrancy });
2304
2304
  }
2305
+ async setAppearance(appearance) {
2306
+ await this._call("setAppearance", { appearance });
2307
+ }
2305
2308
  get windowControls() {
2306
2309
  return globalThis.craft?.windowControls;
2307
2310
  }
@@ -2401,6 +2404,7 @@ class WindowManager {
2401
2404
  setOpacity = (opacity) => this.current.setOpacity(opacity);
2402
2405
  setBackgroundColor = (color) => this.current.setBackgroundColor(color);
2403
2406
  setVibrancy = (vibrancy) => this.current.setVibrancy(vibrancy);
2407
+ setAppearance = (appearance) => this.current.setAppearance(appearance);
2404
2408
  setResizable = (resizable) => this.current.setResizable(resizable);
2405
2409
  startDrag = () => this.current.startDrag();
2406
2410
  getState = () => this.current.getState();
@@ -10519,7 +10523,9 @@ class CraftApp {
10519
10523
  args.push("--keep-running");
10520
10524
  else if (window3?.keepRunning === false)
10521
10525
  args.push("--quit-on-close");
10522
- if (window3?.webSidebarMaterial) {
10526
+ if (window3?.webWindowMaterial) {
10527
+ args.push("--web-window-material");
10528
+ } else if (window3?.webSidebarMaterial) {
10523
10529
  args.push("--web-sidebar-material");
10524
10530
  if (window3?.webSidebarWidth)
10525
10531
  args.push("--web-sidebar-width", String(window3.webSidebarWidth));
package/dist/types.d.ts CHANGED
@@ -201,9 +201,31 @@ export interface WindowOptions {
201
201
  /**
202
202
  * White/dark native tint opacity over the sidebar material.
203
203
  * Higher values reduce desktop bleed-through while keeping subtle vibrancy.
204
+ *
205
+ * `webSidebarMaterial` only — a `webWindowMaterial` window carries no native
206
+ * tint, because the page is the only thing that knows its colour scheme.
204
207
  * @default 0.78
205
208
  */
206
209
  webSidebarMaterialOpacity?: number;
210
+ /**
211
+ * Draw that same material behind the *whole* web view rather than a leading
212
+ * strip, with nothing opaque beside it.
213
+ *
214
+ * Where `webSidebarMaterial` is Finder — vibrancy under the sidebar, a solid
215
+ * pane beside it — this is System Settings: one material behind everything,
216
+ * and the page's own cards are the only things with edges.
217
+ *
218
+ * Two differences follow, and both are the point rather than side effects:
219
+ * the window is not pinned to light (so `darkMode` and the system setting
220
+ * reach the material, and the page's `prefers-color-scheme` agrees with it),
221
+ * and no native tint is drawn (the page washes the material with its own
222
+ * translucent background, which is the only wash that knows whether the page
223
+ * is light or dark).
224
+ *
225
+ * Wins over `webSidebarMaterial` when both are set.
226
+ * @default false
227
+ */
228
+ webWindowMaterial?: boolean;
207
229
  /**
208
230
  * Use native macOS sidebar (Finder-style with vibrancy)
209
231
  * Creates a split view with NSOutlineView sidebar and WebView content
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "craft-native",
3
- "version": "0.0.85",
3
+ "version": "0.0.87",
4
4
  "type": "module",
5
5
  "description": "Build desktop apps with web languages - TypeScript SDK for Craft",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",