@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,59 +1,60 @@
1
- # UI And Components
2
-
3
- The generated app starts intentionally small. Build the real workflow in
4
- `src/components/AppShell.tsx` and move domain logic into `src/lib/` as it grows.
5
-
6
- ## AppFrame
7
-
8
- Every render path in `src/App.tsx` uses `AppFrame`. This gives the iframe the
9
- PureDesktop reset, theme CSS variables, and shell-compatible surface styling.
10
-
11
- ## Component Shape
12
-
13
- Start with controlled, simple components:
14
-
15
- ```text
16
- src/
17
- components/
18
- AppShell.tsx
19
- ItemList.tsx
20
- ItemDetail.tsx
21
- lib/
22
- items.ts
23
- items.test.ts
24
- ```
25
-
26
- Keep app state close to the workflow until a shared hook or reducer removes real
27
- duplication.
28
-
29
- ## Platform Components
30
-
31
- Import shared UI from `@puredesktop/puredesktop-ui-bridge/components/...` before
32
- creating custom primitives.
1
+ # UI And Components
2
+
3
+ The generated app starts intentionally small. Build the real workflow in
4
+ `src/components/AppShell.tsx` and move domain logic into `src/lib/` as it grows.
5
+
6
+ ## AppFrame
7
+
8
+ Every render path in `src/App.tsx` uses `AppFrame`. This gives the iframe the
9
+ PureDesktop reset, theme CSS variables, and shell-compatible surface styling.
10
+
11
+ ## Component Shape
12
+
13
+ Start with controlled, simple components:
14
+
15
+ ```text
16
+ src/
17
+ components/
18
+ AppShell.tsx
19
+ ItemList.tsx
20
+ ItemDetail.tsx
21
+ lib/
22
+ items.ts
23
+ items.test.ts
24
+ ```
25
+
26
+ Keep app state close to the workflow until a shared hook or reducer removes real
27
+ duplication.
28
+
29
+ ## Platform Components
30
+
31
+ Import shared UI by exact exported package paths before creating custom
32
+ primitives. Do not invent component folders.
33
33
 
34
34
  Useful starting points:
35
35
 
36
- - `AppFrame`
37
- - `EmptyState`
38
- - `Heading`
39
- - `Text`
40
-
41
- ## Styling
42
-
43
- Use styled-components and platform CSS variables:
44
-
45
- ```ts
46
- const Root = styled.div`
47
- display: flex;
48
- flex-direction: column;
49
- gap: var(--platform-spacing-md);
50
- color: var(--platform-colors-text);
51
- background: var(--platform-colors-bg);
52
- `
53
- ```
54
-
55
- Use app-local CSS variables only for app-specific meaning, for example
56
- `--{{APP_SLUG}}-accent`.
57
-
58
- See [Theme CSS variables](./theme-vars.md) for the generated list of available
59
- platform variables by domain.
36
+ - `AppFrame` from `@puredesktop/puredesktop-ui-bridge/components/common/containers/AppFrame`
37
+ - `EmptyState` from `@puredesktop/puredesktop-ui-bridge/components/common/feedback/EmptyState`
38
+ - `Heading` from `@puredesktop/puredesktop-ui-bridge/components/common/typography/Heading`
39
+ - `Text` from `@puredesktop/puredesktop-ui-bridge/components/common/typography/Text`
40
+ - `Button` from `@puredesktop/puredesktop-ui-bridge/components/common/buttons/Button`
41
+
42
+ ## Styling
43
+
44
+ Use styled-components and platform CSS variables:
45
+
46
+ ```ts
47
+ const Root = styled.div`
48
+ display: flex;
49
+ flex-direction: column;
50
+ gap: var(--platform-spacing-md);
51
+ color: var(--platform-colors-text);
52
+ background: var(--platform-colors-bg);
53
+ `
54
+ ```
55
+
56
+ Use app-local CSS variables only for app-specific meaning, for example
57
+ `--{{APP_SLUG}}-accent`.
58
+
59
+ See [Theme CSS variables](./theme-vars.md) for the generated list of available
60
+ platform variables by domain.
@@ -3,16 +3,16 @@
3
3
  "private": true,
4
4
  "version": "0.1.0",
5
5
  "type": "module",
6
- "scripts": {
7
- "dev": "vite",
8
- "build": "vite build",
9
- "typecheck": "tsc -p tsconfig.json --noEmit",
10
- "puredesktop:check": "node scripts/validate-puredesktop-app.mjs"
11
- },
12
- "dependencies": {
13
- "@puredesktop/puredesktop-ui-bridge": "2.1.4",
14
- "react": "^19.1.0",
15
- "react-dom": "^19.1.0",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build",
9
+ "typecheck": "tsc -p tsconfig.json --noEmit",
10
+ "puredesktop:check": "node scripts/validate-puredesktop-app.mjs"
11
+ },
12
+ "dependencies": {
13
+ "@puredesktop/puredesktop-ui-bridge": "2.1.7",
14
+ "react": "^19.1.0",
15
+ "react-dom": "^19.1.0",
16
16
  "styled-components": "^6.1.18"
17
17
  },
18
18
  "devDependencies": {
@@ -1,20 +1,20 @@
1
- {
2
- "schemaVersion": 1,
3
- "id": "{{PLUGIN_ID}}",
4
- "name": "{{APP_TITLE}}",
5
- "permissions": ["network", "settings", "agents"],
6
- "entrypoint": {
7
- "kind": "dev-url",
8
- "url": "http://localhost:{{APP_PORT}}"
9
- },
10
- "app": {
11
- "id": "plugin.{{APP_SLUG}}",
12
- "slug": "{{APP_SLUG}}",
13
- "name": "{{APP_TITLE}}",
14
- "navigationLabel": "{{APP_TITLE}}",
15
- "productName": "pure.{{APP_SLUG}}",
16
- "kind": "{{APP_SLUG}}",
17
- "description": "{{APP_TITLE}} - built with PureDesktop.",
18
- "usePureDesktopAiPanel": true
19
- }
20
- }
1
+ {
2
+ "schemaVersion": 1,
3
+ "id": "{{PLUGIN_ID}}",
4
+ "name": "{{APP_TITLE}}",
5
+ "permissions": ["network", "settings", "agents"],
6
+ "entrypoint": {
7
+ "kind": "dev-url",
8
+ "url": "http://localhost:{{APP_PORT}}"
9
+ },
10
+ "app": {
11
+ "id": "plugin.{{APP_SLUG}}",
12
+ "slug": "{{APP_SLUG}}",
13
+ "name": "{{APP_TITLE}}",
14
+ "navigationLabel": "{{APP_TITLE}}",
15
+ "productName": "pure.{{APP_SLUG}}",
16
+ "kind": "{{APP_SLUG}}",
17
+ "description": "{{APP_TITLE}} - built with PureDesktop.",
18
+ "usePureDesktopAiPanel": true
19
+ }
20
+ }
@@ -1,5 +1,5 @@
1
- import { AppFrame } from '@puredesktop/puredesktop-ui-bridge/components/common/containers/AppFrame'
2
- import { EmptyState } from '@puredesktop/puredesktop-ui-bridge/components/common/feedback/EmptyState'
1
+ import { AppFrame } from '@puredesktop/puredesktop-ui-bridge/components/common/containers/AppFrame'
2
+ import { EmptyState } from '@puredesktop/puredesktop-ui-bridge/components/common/feedback/EmptyState'
3
3
  import { usePlatformBridge } from '@puredesktop/puredesktop-ui-bridge/bridge/react/usePlatformBridge'
4
4
  import { AppShell } from './components/AppShell'
5
5
  import { isStandaloneDevMode } from './bridge/platformBridge'
@@ -33,8 +33,8 @@ export function App(): React.ReactElement {
33
33
  bootError
34
34
  ? bootError.message
35
35
  : booting
36
- ? 'Loading...'
37
- : 'Waiting for PureDesktop shell bridge...'
36
+ ? 'Loading...'
37
+ : 'Waiting for PureDesktop shell bridge...'
38
38
  }
39
39
  />
40
40
  </AppFrame>
@@ -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
  }