@puredesktop/create-app 2.1.4 → 2.1.6
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/bin/create-puredesktop-app.mjs +319 -319
- package/package.json +1 -1
- package/template/README.md +52 -52
- package/template/agents.md +11 -11
- package/template/docs/README.md +30 -30
- package/template/docs/agent.md +58 -58
- package/template/docs/app-lifecycle.md +60 -60
- package/template/docs/bridge/README.md +84 -84
- package/template/docs/bridge/dialog.md +56 -56
- package/template/docs/bridge/fs.md +95 -95
- package/template/docs/bridge/network.md +38 -38
- package/template/docs/bridge/settings.md +63 -63
- package/template/docs/bridge/storage.md +48 -48
- package/template/docs/plugin-manifest.md +104 -104
- package/template/docs/theme-vars.md +138 -138
- package/template/docs/tool-handlers.md +122 -122
- package/template/docs/ui-and-components.md +57 -56
- package/template/package.json +10 -10
- package/template/plugin.json +20 -20
- package/template/src/App.tsx +4 -4
- package/template/src/bridge/platformBridge.ts +122 -122
- package/template/src/components/AppShell.tsx +9 -9
|
@@ -1,122 +1,122 @@
|
|
|
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
|
+
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,12 +22,12 @@ 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 size="sm" tone="secondary">
|
|
28
|
-
Loaded {Object.keys(settings).length} setting key(s).
|
|
29
|
-
</Text>
|
|
30
|
-
) : null}
|
|
25
|
+
</Text>
|
|
26
|
+
{Object.keys(settings).length > 0 ? (
|
|
27
|
+
<Text size="sm" tone="secondary">
|
|
28
|
+
Loaded {Object.keys(settings).length} setting key(s).
|
|
29
|
+
</Text>
|
|
30
|
+
) : null}
|
|
31
31
|
</Root>
|
|
32
32
|
)
|
|
33
33
|
}
|