@puredesktop/create-app 2.1.0 → 2.1.2

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.
@@ -1,31 +1,122 @@
1
- import { bridge } from '@puredesktop/puredesktop-ui-bridge/bridge/client'
2
- import { PLATFORM_BRIDGE_METHODS } from '@puredesktop/puredesktop-ui-bridge/bridge/methods'
3
- import { APP_SLUG } from '../constants'
4
- import type { AppSettings } from '../types'
5
-
6
- export { bridge }
7
-
8
- const STANDALONE_SETTINGS_KEY = 'puredesktop:{{APP_SLUG}}:settings'
9
-
10
- export function isStandaloneDevMode(): boolean {
11
- return import.meta.env.DEV && window.parent === window
12
- }
13
-
14
- function readStandaloneSettings(): AppSettings {
15
- try {
16
- const raw = window.localStorage.getItem(STANDALONE_SETTINGS_KEY)
17
- return raw ? (JSON.parse(raw) as AppSettings) : {}
18
- } catch {
19
- return {}
20
- }
21
- }
22
-
23
- export async function fetchAppSettings(): Promise<AppSettings> {
24
- if (isStandaloneDevMode()) {
25
- return readStandaloneSettings()
26
- }
27
-
28
- return bridge.call<AppSettings>(PLATFORM_BRIDGE_METHODS.SETTINGS_APP_GET, [
29
- APP_SLUG,
30
- ])
31
- }
1
+ import { bridge } from '@puredesktop/puredesktop-ui-bridge/bridge/client'
2
+ import {
3
+ getPlatformAppSettings,
4
+ updatePlatformAppSettings,
5
+ } from '@puredesktop/puredesktop-ui-bridge/bridge/appSettings'
6
+ import {
7
+ getPlatformPreferences,
8
+ patchPlatformPreferences,
9
+ } from '@puredesktop/puredesktop-ui-bridge/bridge/preferences'
10
+ import { networkFetch } from '@puredesktop/puredesktop-ui-bridge/bridge/network'
11
+ import {
12
+ createPlatformFolder,
13
+ deletePlatformFile,
14
+ listPlatformFiles,
15
+ readPlatformFileBinary,
16
+ readPlatformFileBinaryDataUrl,
17
+ readPlatformFilePreview,
18
+ readPlatformFilePreviewUrl,
19
+ readPlatformTextFile,
20
+ renamePlatformFile,
21
+ writePlatformFileBinary,
22
+ writePlatformTextFile,
23
+ } from '@puredesktop/puredesktop-ui-bridge/bridge/fs'
24
+ import {
25
+ openPlatformFileDialog,
26
+ openPlatformFolderDialog,
27
+ openPlatformImageDialog,
28
+ savePlatformFolderDialog,
29
+ } from '@puredesktop/puredesktop-ui-bridge/bridge/dialog'
30
+ import {
31
+ readPlatformStorageJson,
32
+ writePlatformStorageJson,
33
+ } from '@puredesktop/puredesktop-ui-bridge/bridge/storage'
34
+ import { APP_SLUG } from '../constants'
35
+ import type { AppSettings } from '../types'
36
+ import type {
37
+ PlatformNetworkFetchRequest,
38
+ PlatformNetworkFetchResponse,
39
+ } from '@puredesktop/puredesktop-ui-bridge/bridge/network'
40
+ import type {
41
+ PlatformFileCreateFolderResult,
42
+ PlatformFileDeleteResult,
43
+ PlatformFileEntry,
44
+ PlatformFileListResult,
45
+ PlatformFilePreviewUrlResult,
46
+ PlatformFileReadBinaryResult,
47
+ PlatformFileReadPreviewResult,
48
+ PlatformFileRenameResult,
49
+ PlatformFileWriteResult,
50
+ } from '@puredesktop/puredesktop-ui-bridge/bridge/fs'
51
+ import type {
52
+ PlatformStorageJsonReadResult,
53
+ PlatformStorageJsonRequest,
54
+ PlatformStorageJsonWriteRequest,
55
+ PlatformStorageJsonWriteResult,
56
+ } from '@puredesktop/puredesktop-ui-bridge/bridge/storage'
57
+
58
+ export {
59
+ getPlatformAppSettings,
60
+ updatePlatformAppSettings,
61
+ getPlatformPreferences,
62
+ patchPlatformPreferences,
63
+ networkFetch,
64
+ createPlatformFolder,
65
+ deletePlatformFile,
66
+ listPlatformFiles,
67
+ readPlatformFileBinary,
68
+ readPlatformFileBinaryDataUrl,
69
+ readPlatformFilePreview,
70
+ readPlatformFilePreviewUrl,
71
+ readPlatformTextFile,
72
+ renamePlatformFile,
73
+ writePlatformFileBinary,
74
+ writePlatformTextFile,
75
+ openPlatformFileDialog,
76
+ openPlatformFolderDialog,
77
+ openPlatformImageDialog,
78
+ savePlatformFolderDialog,
79
+ readPlatformStorageJson,
80
+ writePlatformStorageJson,
81
+ bridge,
82
+ }
83
+ export type {
84
+ PlatformNetworkFetchRequest,
85
+ PlatformNetworkFetchResponse,
86
+ PlatformFileCreateFolderResult,
87
+ PlatformFileDeleteResult,
88
+ PlatformFileEntry,
89
+ PlatformFileListResult,
90
+ PlatformFilePreviewUrlResult,
91
+ PlatformFileReadBinaryResult,
92
+ PlatformFileReadPreviewResult,
93
+ PlatformFileRenameResult,
94
+ PlatformFileWriteResult,
95
+ PlatformStorageJsonReadResult,
96
+ PlatformStorageJsonRequest,
97
+ PlatformStorageJsonWriteRequest,
98
+ PlatformStorageJsonWriteResult,
99
+ }
100
+
101
+ const STANDALONE_SETTINGS_KEY = 'puredesktop:{{APP_SLUG}}:settings'
102
+
103
+ export function isStandaloneDevMode(): boolean {
104
+ return import.meta.env.DEV && window.parent === window
105
+ }
106
+
107
+ function readStandaloneSettings(): AppSettings {
108
+ try {
109
+ const raw = window.localStorage.getItem(STANDALONE_SETTINGS_KEY)
110
+ return raw ? (JSON.parse(raw) as AppSettings) : {}
111
+ } catch {
112
+ return {}
113
+ }
114
+ }
115
+
116
+ export async function fetchAppSettings(): Promise<AppSettings> {
117
+ if (isStandaloneDevMode()) {
118
+ return readStandaloneSettings()
119
+ }
120
+
121
+ return getPlatformAppSettings(APP_SLUG) as Promise<AppSettings>
122
+ }
@@ -1,6 +1,6 @@
1
- import styled from 'styled-components'
2
- import { Heading } from '@puredesktop/puredesktop-ui-bridge/components/common/typography/Heading'
3
- import { Text } from '@puredesktop/puredesktop-ui-bridge/components/common/typography/Text'
1
+ import styled from 'styled-components'
2
+ import { Heading } from '@puredesktop/puredesktop-ui-bridge/components/common/typography/Heading'
3
+ import { Text } from '@puredesktop/puredesktop-ui-bridge/components/common/typography/Text'
4
4
  import type { AppSettings } from '../types'
5
5
 
6
6
  const Root = styled.div`
@@ -22,10 +22,10 @@ export function AppShell({ settings }: AppShellProps): React.ReactElement {
22
22
  <Text>
23
23
  Start building in <code>src/components/AppShell.tsx</code>. Bridge boot
24
24
  is wired — AppFrame, settings load, and standalone browser dev all work.
25
- </Text>
26
- {Object.keys(settings).length > 0 ? (
27
- <Text meta>Loaded {Object.keys(settings).length} setting key(s).</Text>
28
- ) : null}
25
+ </Text>
26
+ {Object.keys(settings).length > 0 ? (
27
+ <Text meta>Loaded {Object.keys(settings).length} setting key(s).</Text>
28
+ ) : null}
29
29
  </Root>
30
30
  )
31
31
  }