ReviewOS

also looking at this

craft-native/craft

feat: finish native customization and platform seams

#401
Merged glennmichael123 wants to merge codex/issues-388-400-344 into main
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.

packages/typescript/src/__tests__/bridge-integration.test.tsmodified+8-0
Changes to packages/typescript/src/__tests__/bridge-integration.test.ts
@@ -35,6 +35,8 @@ describe('Bridge Type Definitions', () => {
3535 version: '1.0.0',
3636 platform: 'macos',
3737 }),
38 setAppearance: async (_appearance: 'light' | 'dark' | 'system') => {},
39 getAppearance: async () => 'light',
3840 },
3941 }
4042
@@ -87,6 +89,8 @@ describe('Bridge Type Definitions', () => {
8789 version: '1.0.0',
8890 platform: 'macos',
8991 }),
92 setAppearance: async (_appearance: 'light' | 'dark' | 'system') => {},
93 getAppearance: async () => 'light',
9094 }
9195
9296 expect(typeof mockApp.hideDockIcon).toBe('function')
@@ -292,6 +296,8 @@ describe('Bridge API Method Signatures', () => {
292296 version: '1.0.0',
293297 platform: 'macos',
294298 }),
299 setAppearance: async (_appearance: 'light' | 'dark' | 'system') => {},
300 getAppearance: async () => 'light',
295301 }
296302
297303 const info = await mockApp.getInfo()
@@ -334,6 +340,8 @@ describe('Window Global Type Augmentation', () => {
334340 version: '1.0.0',
335341 platform: 'macos',
336342 }),
343 setAppearance: async (_appearance: 'light' | 'dark' | 'system') => {},
344 getAppearance: async () => 'light',
337345 },
338346 } as CraftBridgeAPI,
339347 }
packages/typescript/src/api/app.tsmodified+2-2
Changes to packages/typescript/src/api/app.ts
@@ -629,14 +629,14 @@ class AppManager {
629629 // ==========================================================================
630630
631631 /**
632 * Set app appearance (macOS)
632 * Set the app appearance on native hosts.
633633 */
634634 async setAppearance(appearance: 'light' | 'dark' | 'system'): Promise<void> {
635635 await this._call('setAppearance', { appearance })
636636 }
637637
638638 /**
639 * Get current appearance
639 * Get the current effective Light/Dark appearance.
640640 */
641641 async getAppearance(): Promise<'light' | 'dark'> {
642642 return this._call('getAppearance')
packages/typescript/src/types.tsmodified+6-0
Changes to packages/typescript/src/types.ts
@@ -761,6 +761,12 @@ export interface CraftAppAPI {
761761 * Get application information
762762 */
763763 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'>
764770}
765771
766772/**