also looking at this
feat: finish native customization and platform seams
#401
21 files
+707
-17
Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.
| @@ -35,6 +35,8 @@ describe('Bridge Type Definitions', () => { | ||
| 35 | 35 | version: '1.0.0', |
| 36 | 36 | platform: 'macos', |
| 37 | 37 | }), |
| 38 | setAppearance: async (_appearance: 'light' | 'dark' | 'system') => {}, | |
| 39 | getAppearance: async () => 'light', | |
| 38 | 40 | }, |
| 39 | 41 | } |
| 40 | 42 | |
| @@ -87,6 +89,8 @@ describe('Bridge Type Definitions', () => { | ||
| 87 | 89 | version: '1.0.0', |
| 88 | 90 | platform: 'macos', |
| 89 | 91 | }), |
| 92 | setAppearance: async (_appearance: 'light' | 'dark' | 'system') => {}, | |
| 93 | getAppearance: async () => 'light', | |
| 90 | 94 | } |
| 91 | 95 | |
| 92 | 96 | expect(typeof mockApp.hideDockIcon).toBe('function') |
| @@ -292,6 +296,8 @@ describe('Bridge API Method Signatures', () => { | ||
| 292 | 296 | version: '1.0.0', |
| 293 | 297 | platform: 'macos', |
| 294 | 298 | }), |
| 299 | setAppearance: async (_appearance: 'light' | 'dark' | 'system') => {}, | |
| 300 | getAppearance: async () => 'light', | |
| 295 | 301 | } |
| 296 | 302 | |
| 297 | 303 | const info = await mockApp.getInfo() |
| @@ -334,6 +340,8 @@ describe('Window Global Type Augmentation', () => { | ||
| 334 | 340 | version: '1.0.0', |
| 335 | 341 | platform: 'macos', |
| 336 | 342 | }), |
| 343 | setAppearance: async (_appearance: 'light' | 'dark' | 'system') => {}, | |
| 344 | getAppearance: async () => 'light', | |
| 337 | 345 | }, |
| 338 | 346 | } as CraftBridgeAPI, |
| 339 | 347 | } |
| @@ -629,14 +629,14 @@ class AppManager { | ||
| 629 | 629 | // ========================================================================== |
| 630 | 630 | |
| 631 | 631 | /** |
| 632 | * Set app appearance (macOS) | |
| 632 | * Set the app appearance on native hosts. | |
| 633 | 633 | */ |
| 634 | 634 | async setAppearance(appearance: 'light' | 'dark' | 'system'): Promise<void> { |
| 635 | 635 | await this._call('setAppearance', { appearance }) |
| 636 | 636 | } |
| 637 | 637 | |
| 638 | 638 | /** |
| 639 | * Get current appearance | |
| 639 | * Get the current effective Light/Dark appearance. | |
| 640 | 640 | */ |
| 641 | 641 | async getAppearance(): Promise<'light' | 'dark'> { |
| 642 | 642 | return this._call('getAppearance') |
| @@ -761,6 +761,12 @@ export interface CraftAppAPI { | ||
| 761 | 761 | * Get application information |
| 762 | 762 | */ |
| 763 | 763 | getInfo(): Promise<AppInfo> |
| 764 | ||
| 765 | /** Pin every native surface to Light, Dark, or the system setting. */ | |
| 766 | setAppearance(appearance: 'light' | 'dark' | 'system'): Promise<void> | |
| 767 | ||
| 768 | /** Read the app's effective Light/Dark appearance. */ | |
| 769 | getAppearance(): Promise<'light' | 'dark'> | |
| 764 | 770 | } |
| 765 | 771 | |
| 766 | 772 | /** |