@puredesktop/create-app 2.1.5 → 2.1.7

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,56 +1,56 @@
1
- # Dialog
2
-
3
- Permission: `filesystem`
4
-
5
- Dialog helpers open shell-native file and folder pickers.
6
-
7
- Import from the generated app bridge:
8
-
9
- ```ts
10
- import {
11
- openPlatformFileDialog,
12
- openPlatformFolderDialog,
13
- openPlatformImageDialog,
14
- savePlatformFolderDialog,
15
- } from '../../src/bridge/platformBridge'
16
- ```
17
-
18
- ## openPlatformFolderDialog
19
-
20
- Opens a folder picker.
21
-
22
- ```ts
23
- const folderPath = await openPlatformFolderDialog()
24
- ```
25
-
26
- Returns the selected absolute folder path, or `null` when cancelled.
27
-
28
- ## savePlatformFolderDialog
29
-
30
- Opens a folder picker configured for choosing a parent directory.
31
-
32
- ```ts
33
- const parentPath = await savePlatformFolderDialog()
34
- ```
35
-
36
- Returns the selected absolute folder path, or `null` when cancelled.
37
-
38
- ## openPlatformImageDialog
39
-
40
- Opens an image file picker.
41
-
42
- ```ts
43
- const imagePath = await openPlatformImageDialog()
44
- ```
45
-
46
- Returns the selected absolute image path, or `null` when cancelled.
47
-
48
- ## openPlatformFileDialog
49
-
50
- Opens a text/document file picker.
51
-
52
- ```ts
53
- const filePath = await openPlatformFileDialog()
54
- ```
55
-
56
- Returns the selected absolute file path, or `null` when cancelled.
1
+ # Dialog
2
+
3
+ Permission: `filesystem`
4
+
5
+ Dialog helpers open shell-native file and folder pickers.
6
+
7
+ Import from the generated app bridge:
8
+
9
+ ```ts
10
+ import {
11
+ openPlatformFileDialog,
12
+ openPlatformFolderDialog,
13
+ openPlatformImageDialog,
14
+ savePlatformFolderDialog,
15
+ } from '../../src/bridge/platformBridge'
16
+ ```
17
+
18
+ ## openPlatformFolderDialog
19
+
20
+ Opens a folder picker.
21
+
22
+ ```ts
23
+ const folderPath = await openPlatformFolderDialog()
24
+ ```
25
+
26
+ Returns the selected absolute folder path, or `null` when cancelled.
27
+
28
+ ## savePlatformFolderDialog
29
+
30
+ Opens a folder picker configured for choosing a parent directory.
31
+
32
+ ```ts
33
+ const parentPath = await savePlatformFolderDialog()
34
+ ```
35
+
36
+ Returns the selected absolute folder path, or `null` when cancelled.
37
+
38
+ ## openPlatformImageDialog
39
+
40
+ Opens an image file picker.
41
+
42
+ ```ts
43
+ const imagePath = await openPlatformImageDialog()
44
+ ```
45
+
46
+ Returns the selected absolute image path, or `null` when cancelled.
47
+
48
+ ## openPlatformFileDialog
49
+
50
+ Opens a text/document file picker.
51
+
52
+ ```ts
53
+ const filePath = await openPlatformFileDialog()
54
+ ```
55
+
56
+ Returns the selected absolute file path, or `null` when cancelled.
@@ -1,95 +1,95 @@
1
- # Filesystem
2
-
3
- Permission: `filesystem`
4
-
5
- Filesystem helpers read, write, list, rename, delete, and preview files through
6
- the shell.
7
-
8
- Import from the generated app bridge:
9
-
10
- ```ts
11
- import {
12
- createPlatformFolder,
13
- deletePlatformFile,
14
- listPlatformFiles,
15
- readPlatformTextFile,
16
- renamePlatformFile,
17
- writePlatformTextFile,
18
- } from '../../src/bridge/platformBridge'
19
- ```
20
-
21
- ## listPlatformFiles
22
-
23
- Lists a folder.
24
-
25
- ```ts
26
- const listing = await listPlatformFiles('/absolute/folder')
27
- ```
28
-
29
- Returns:
30
-
31
- - `rootPath`: listed folder path.
32
- - `parentPath`: parent folder path or `null`.
33
- - `entries`: file and folder entries with `path`, `name`, `kind`, size,
34
- modified time, MIME type, extension, and directory flag.
35
-
36
- ## readPlatformTextFile
37
-
38
- Reads a text file.
39
-
40
- ```ts
41
- const content = await readPlatformTextFile('/absolute/file.md')
42
- ```
43
-
44
- Returns the file contents as a string.
45
-
46
- ## writePlatformTextFile
47
-
48
- Writes a text file.
49
-
50
- ```ts
51
- await writePlatformTextFile('/absolute/file.md', '# Notes\n')
52
- ```
53
-
54
- Returns `{ ok: true }`.
55
-
56
- ## createPlatformFolder
57
-
58
- Creates a folder under a parent directory.
59
-
60
- ```ts
61
- const folder = await createPlatformFolder('/absolute/parent', 'Project')
62
- ```
63
-
64
- Returns `{ path }` for the created folder.
65
-
66
- ## renamePlatformFile
67
-
68
- Renames a file or folder within its current parent directory.
69
-
70
- ```ts
71
- const renamed = await renamePlatformFile('/absolute/file.md', 'renamed.md')
72
- ```
73
-
74
- Returns `{ path }` for the renamed path.
75
-
76
- ## deletePlatformFile
77
-
78
- Deletes a file or folder.
79
-
80
- ```ts
81
- await deletePlatformFile('/absolute/file.md')
82
- await deletePlatformFile('/absolute/folder', true)
83
- ```
84
-
85
- Pass `true` for recursive folder deletion. Returns `{ ok: true }`.
86
-
87
- ## Preview And Binary Helpers
88
-
89
- The same domain also exports:
90
-
91
- - `readPlatformFilePreview(path, maxBytes?)`
92
- - `readPlatformFilePreviewUrl(path)`
93
- - `readPlatformFileBinary(path, maxBytes?)`
94
- - `readPlatformFileBinaryDataUrl(path, maxBytes?)`
95
- - `writePlatformFileBinary(path, base64)`
1
+ # Filesystem
2
+
3
+ Permission: `filesystem`
4
+
5
+ Filesystem helpers read, write, list, rename, delete, and preview files through
6
+ the shell.
7
+
8
+ Import from the generated app bridge:
9
+
10
+ ```ts
11
+ import {
12
+ createPlatformFolder,
13
+ deletePlatformFile,
14
+ listPlatformFiles,
15
+ readPlatformTextFile,
16
+ renamePlatformFile,
17
+ writePlatformTextFile,
18
+ } from '../../src/bridge/platformBridge'
19
+ ```
20
+
21
+ ## listPlatformFiles
22
+
23
+ Lists a folder.
24
+
25
+ ```ts
26
+ const listing = await listPlatformFiles('/absolute/folder')
27
+ ```
28
+
29
+ Returns:
30
+
31
+ - `rootPath`: listed folder path.
32
+ - `parentPath`: parent folder path or `null`.
33
+ - `entries`: file and folder entries with `path`, `name`, `kind`, size,
34
+ modified time, MIME type, extension, and directory flag.
35
+
36
+ ## readPlatformTextFile
37
+
38
+ Reads a text file.
39
+
40
+ ```ts
41
+ const content = await readPlatformTextFile('/absolute/file.md')
42
+ ```
43
+
44
+ Returns the file contents as a string.
45
+
46
+ ## writePlatformTextFile
47
+
48
+ Writes a text file.
49
+
50
+ ```ts
51
+ await writePlatformTextFile('/absolute/file.md', '# Notes\n')
52
+ ```
53
+
54
+ Returns `{ ok: true }`.
55
+
56
+ ## createPlatformFolder
57
+
58
+ Creates a folder under a parent directory.
59
+
60
+ ```ts
61
+ const folder = await createPlatformFolder('/absolute/parent', 'Project')
62
+ ```
63
+
64
+ Returns `{ path }` for the created folder.
65
+
66
+ ## renamePlatformFile
67
+
68
+ Renames a file or folder within its current parent directory.
69
+
70
+ ```ts
71
+ const renamed = await renamePlatformFile('/absolute/file.md', 'renamed.md')
72
+ ```
73
+
74
+ Returns `{ path }` for the renamed path.
75
+
76
+ ## deletePlatformFile
77
+
78
+ Deletes a file or folder.
79
+
80
+ ```ts
81
+ await deletePlatformFile('/absolute/file.md')
82
+ await deletePlatformFile('/absolute/folder', true)
83
+ ```
84
+
85
+ Pass `true` for recursive folder deletion. Returns `{ ok: true }`.
86
+
87
+ ## Preview And Binary Helpers
88
+
89
+ The same domain also exports:
90
+
91
+ - `readPlatformFilePreview(path, maxBytes?)`
92
+ - `readPlatformFilePreviewUrl(path)`
93
+ - `readPlatformFileBinary(path, maxBytes?)`
94
+ - `readPlatformFileBinaryDataUrl(path, maxBytes?)`
95
+ - `writePlatformFileBinary(path, base64)`
@@ -1,38 +1,38 @@
1
- # Network
2
-
3
- Permission: `network`
4
-
5
- Use `networkFetch` for HTTP(S) requests through the shell.
6
-
7
- Import from the generated app bridge:
8
-
9
- ```ts
10
- import { networkFetch } from '../../src/bridge/platformBridge'
11
- ```
12
-
13
- Example:
14
-
15
- ```ts
16
- const response = await networkFetch({
17
- url: 'https://example.com/api/items',
18
- method: 'GET',
19
- })
20
-
21
- if (!response.ok) {
22
- throw new Error(`Request failed with ${response.status}`)
23
- }
24
- ```
25
-
26
- Request fields:
27
-
28
- - `url`: HTTP or HTTPS URL.
29
- - `method`: optional, defaults to `GET`.
30
- - `headers`: optional string map.
31
- - `body`: optional string.
32
-
33
- Response fields:
34
-
35
- - `status`: HTTP status code.
36
- - `ok`: `true` for 2xx responses.
37
- - `headers`: response headers as a string map.
38
- - `body`: response body as text.
1
+ # Network
2
+
3
+ Permission: `network`
4
+
5
+ Use `networkFetch` for HTTP(S) requests through the shell.
6
+
7
+ Import from the generated app bridge:
8
+
9
+ ```ts
10
+ import { networkFetch } from '../../src/bridge/platformBridge'
11
+ ```
12
+
13
+ Example:
14
+
15
+ ```ts
16
+ const response = await networkFetch({
17
+ url: 'https://example.com/api/items',
18
+ method: 'GET',
19
+ })
20
+
21
+ if (!response.ok) {
22
+ throw new Error(`Request failed with ${response.status}`)
23
+ }
24
+ ```
25
+
26
+ Request fields:
27
+
28
+ - `url`: HTTP or HTTPS URL.
29
+ - `method`: optional, defaults to `GET`.
30
+ - `headers`: optional string map.
31
+ - `body`: optional string.
32
+
33
+ Response fields:
34
+
35
+ - `status`: HTTP status code.
36
+ - `ok`: `true` for 2xx responses.
37
+ - `headers`: response headers as a string map.
38
+ - `body`: response body as text.
@@ -1,63 +1,63 @@
1
- # Settings
2
-
3
- Permission: `settings`
4
-
5
- Settings helpers read and update user preferences through the shell. App
6
- settings are stored inside user preferences under the current app's slug.
7
-
8
- Import from the generated app bridge:
9
-
10
- ```ts
11
- import {
12
- getPlatformAppSettings,
13
- getPlatformPreferences,
14
- patchPlatformPreferences,
15
- updatePlatformAppSettings,
16
- } from '../../src/bridge/platformBridge'
17
- ```
18
-
19
- ## getPlatformAppSettings
20
-
21
- Reads settings for the current app slug.
22
-
23
- ```ts
24
- const settings = await getPlatformAppSettings(APP_SLUG)
25
- ```
26
-
27
- The shell allows plugin frames to access only their own app settings.
28
-
29
- ## updatePlatformAppSettings
30
-
31
- Patches settings for the current app slug.
32
-
33
- ```ts
34
- const next = await updatePlatformAppSettings({
35
- appSlug: APP_SLUG,
36
- patch: { workspacePath: '/absolute/folder' },
37
- })
38
- ```
39
-
40
- Returns the merged app settings object.
41
-
42
- ## getPlatformPreferences
43
-
44
- Reads shell user preferences.
45
-
46
- ```ts
47
- const prefs = await getPlatformPreferences()
48
- ```
49
-
50
- Common fields include the working directory, theme, app settings, user profile,
51
- and agent defaults.
52
-
53
- ## patchPlatformPreferences
54
-
55
- Patches shell user preferences.
56
-
57
- ```ts
58
- const next = await patchPlatformPreferences({
59
- theme: 'dark',
60
- })
61
- ```
62
-
63
- Returns the merged user preferences object.
1
+ # Settings
2
+
3
+ Permission: `settings`
4
+
5
+ Settings helpers read and update user preferences through the shell. App
6
+ settings are stored inside user preferences under the current app's slug.
7
+
8
+ Import from the generated app bridge:
9
+
10
+ ```ts
11
+ import {
12
+ getPlatformAppSettings,
13
+ getPlatformPreferences,
14
+ patchPlatformPreferences,
15
+ updatePlatformAppSettings,
16
+ } from '../../src/bridge/platformBridge'
17
+ ```
18
+
19
+ ## getPlatformAppSettings
20
+
21
+ Reads settings for the current app slug.
22
+
23
+ ```ts
24
+ const settings = await getPlatformAppSettings(APP_SLUG)
25
+ ```
26
+
27
+ The shell allows plugin frames to access only their own app settings.
28
+
29
+ ## updatePlatformAppSettings
30
+
31
+ Patches settings for the current app slug.
32
+
33
+ ```ts
34
+ const next = await updatePlatformAppSettings({
35
+ appSlug: APP_SLUG,
36
+ patch: { workspacePath: '/absolute/folder' },
37
+ })
38
+ ```
39
+
40
+ Returns the merged app settings object.
41
+
42
+ ## getPlatformPreferences
43
+
44
+ Reads shell user preferences.
45
+
46
+ ```ts
47
+ const prefs = await getPlatformPreferences()
48
+ ```
49
+
50
+ Common fields include the working directory, theme, app settings, user profile,
51
+ and agent defaults.
52
+
53
+ ## patchPlatformPreferences
54
+
55
+ Patches shell user preferences.
56
+
57
+ ```ts
58
+ const next = await patchPlatformPreferences({
59
+ theme: 'dark',
60
+ })
61
+ ```
62
+
63
+ Returns the merged user preferences object.
@@ -1,48 +1,48 @@
1
- # Storage
2
-
3
- Permission: `filesystem`
4
-
5
- Storage helpers read and write JSON files in the shell-managed PureDesktop data
6
- folder. These helpers use the same bridge path as the exposed
7
- `storage.readJson` and `storage.writeJson` methods.
8
-
9
- Import from the generated app bridge:
10
-
11
- ```ts
12
- import {
13
- readPlatformStorageJson,
14
- writePlatformStorageJson,
15
- } from '../../src/bridge/platformBridge'
16
- ```
17
-
18
- ## readPlatformStorageJson
19
-
20
- Reads an app JSON store file.
21
-
22
- ```ts
23
- const result = await readPlatformStorageJson({
24
- appSlug: APP_SLUG,
25
- fileName: 'items.json',
26
- })
27
- ```
28
-
29
- Returns:
30
-
31
- - `path`: resolved storage path.
32
- - `value`: parsed JSON value, or `null` when the file is absent.
33
-
34
- ## writePlatformStorageJson
35
-
36
- Writes an app JSON store file.
37
-
38
- ```ts
39
- await writePlatformStorageJson({
40
- appSlug: APP_SLUG,
41
- fileName: 'items.json',
42
- value: { items: [] },
43
- })
44
- ```
45
-
46
- Returns `{ path, ok: true }`.
47
-
48
- Storage file names must be file names ending with `.json`.
1
+ # Storage
2
+
3
+ Permission: `filesystem`
4
+
5
+ Storage helpers read and write JSON files in the shell-managed PureDesktop data
6
+ folder. These helpers use the same bridge path as the exposed
7
+ `storage.readJson` and `storage.writeJson` methods.
8
+
9
+ Import from the generated app bridge:
10
+
11
+ ```ts
12
+ import {
13
+ readPlatformStorageJson,
14
+ writePlatformStorageJson,
15
+ } from '../../src/bridge/platformBridge'
16
+ ```
17
+
18
+ ## readPlatformStorageJson
19
+
20
+ Reads an app JSON store file.
21
+
22
+ ```ts
23
+ const result = await readPlatformStorageJson({
24
+ appSlug: APP_SLUG,
25
+ fileName: 'items.json',
26
+ })
27
+ ```
28
+
29
+ Returns:
30
+
31
+ - `path`: resolved storage path.
32
+ - `value`: parsed JSON value, or `null` when the file is absent.
33
+
34
+ ## writePlatformStorageJson
35
+
36
+ Writes an app JSON store file.
37
+
38
+ ```ts
39
+ await writePlatformStorageJson({
40
+ appSlug: APP_SLUG,
41
+ fileName: 'items.json',
42
+ value: { items: [] },
43
+ })
44
+ ```
45
+
46
+ Returns `{ path, ok: true }`.
47
+
48
+ Storage file names must be file names ending with `.json`.