deskforge 1.0.0 → 1.0.1

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.
Files changed (84) hide show
  1. package/COMPLETION_REPORT.md +426 -0
  2. package/COMPONENT_API.md +529 -0
  3. package/DELIVERY_SUMMARY.md +455 -0
  4. package/IMPLEMENTATION_GUIDE.md +385 -0
  5. package/IMPORT_GUIDE.md +404 -0
  6. package/QUICK_REFERENCE.md +352 -0
  7. package/README.md +245 -31
  8. package/README_UI_COMPLETE.md +395 -0
  9. package/TYPE_DEFINITIONS.md +671 -0
  10. package/UI_GETTING_STARTED.md +523 -0
  11. package/examples/deskforge-app/App.ts +7 -11
  12. package/examples/deskforge-app/screens/CounterApp.ts +181 -0
  13. package/examples/deskforge-app/screens/GalleryApp.ts +267 -0
  14. package/examples/deskforge-app/screens/NotesApp.ts +376 -0
  15. package/examples/deskforge-app/screens/SettingsApp.ts +226 -0
  16. package/examples/deskforge-app/screens/TodoApp.ts +288 -0
  17. package/examples/deskforge-app/screens/index.ts +50 -0
  18. package/package.json +1 -1
  19. package/packages/cli/dist/commands/start.d.ts +7 -1
  20. package/packages/cli/dist/commands/start.d.ts.map +1 -1
  21. package/packages/cli/dist/commands/start.js +75 -21
  22. package/packages/cli/dist/commands/start.js.map +1 -1
  23. package/packages/cli/src/commands/start.ts +93 -21
  24. package/packages/cli/test/start.test.js +24 -0
  25. package/packages/core/dist/index.d.ts +1 -0
  26. package/packages/core/dist/index.d.ts.map +1 -1
  27. package/packages/core/dist/index.js +1 -0
  28. package/packages/core/dist/index.js.map +1 -1
  29. package/packages/core/dist/style/StyleObject.d.ts +115 -0
  30. package/packages/core/dist/style/StyleObject.d.ts.map +1 -0
  31. package/packages/core/dist/style/StyleObject.js +6 -0
  32. package/packages/core/dist/style/StyleObject.js.map +1 -0
  33. package/packages/core/dist/style/StyleSheet.d.ts +7 -0
  34. package/packages/core/dist/style/StyleSheet.d.ts.map +1 -0
  35. package/packages/core/dist/style/StyleSheet.js +13 -0
  36. package/packages/core/dist/style/StyleSheet.js.map +1 -0
  37. package/packages/core/dist/style/index.d.ts +3 -0
  38. package/packages/core/dist/style/index.d.ts.map +1 -0
  39. package/packages/core/dist/style/index.js +21 -0
  40. package/packages/core/dist/style/index.js.map +1 -0
  41. package/packages/core/src/index.ts +2 -1
  42. package/packages/core/src/style/StyleObject.ts +134 -0
  43. package/packages/core/src/style/StyleSheet.ts +19 -0
  44. package/packages/core/src/style/index.ts +5 -0
  45. package/packages/db/src/db.ts +4 -4
  46. package/packages/deskforge/src/index.ts +95 -0
  47. package/packages/file/dist/file.d.ts +1 -1
  48. package/packages/file/dist/file.d.ts.map +1 -1
  49. package/packages/file/dist/file.js +75 -3
  50. package/packages/file/dist/file.js.map +1 -1
  51. package/packages/file/src/file.ts +96 -4
  52. package/packages/file/test/file.test.js +23 -0
  53. package/packages/router/dist/index.d.ts +1 -0
  54. package/packages/router/dist/index.d.ts.map +1 -1
  55. package/packages/router/dist/index.js +1 -0
  56. package/packages/router/dist/index.js.map +1 -1
  57. package/packages/router/dist/navigation.d.ts +23 -0
  58. package/packages/router/dist/navigation.d.ts.map +1 -0
  59. package/packages/router/dist/navigation.js +61 -0
  60. package/packages/router/dist/navigation.js.map +1 -0
  61. package/packages/router/src/index.ts +2 -1
  62. package/packages/router/src/navigation.ts +86 -0
  63. package/packages/router/test/router.test.js +21 -1
  64. package/packages/theme/src/theme.ts +23 -0
  65. package/packages/ui/src/base/Button.ts +67 -0
  66. package/packages/ui/src/base/Image.ts +59 -0
  67. package/packages/ui/src/base/Pressable.ts +69 -0
  68. package/packages/ui/src/base/Text.ts +42 -0
  69. package/packages/ui/src/base/TextInput.ts +113 -0
  70. package/packages/ui/src/base/TouchableOpacity.ts +52 -0
  71. package/packages/ui/src/base/View.ts +43 -0
  72. package/packages/ui/src/index.ts +40 -25
  73. package/packages/ui/src/input/CheckBox.ts +69 -0
  74. package/packages/ui/src/input/Slider.ts +19 -2
  75. package/packages/ui/src/input/Switch.ts +68 -0
  76. package/packages/ui/src/layout/KeyboardAvoidingView.ts +65 -0
  77. package/packages/ui/src/layout/SafeAreaView.ts +58 -0
  78. package/packages/ui/src/list/FlatList.ts +111 -0
  79. package/packages/ui/src/list/ScrollView.ts +80 -0
  80. package/packages/ui/src/list/SectionList.ts +120 -0
  81. package/packages/ui/src/overlay/ActivityIndicator.ts +70 -0
  82. package/packages/ui/src/overlay/Modal.ts +28 -6
  83. package/packages/ui/src/platform/Platform.ts +119 -0
  84. package/packages/ui/src/platform/StatusBar.ts +63 -0
@@ -0,0 +1,181 @@
1
+ /**
2
+ * Counter App - Complete Example
3
+ *
4
+ * Demonstrates basic State reactivity, Pressable handlers,
5
+ * and simple component composition.
6
+ */
7
+
8
+ import {
9
+ View,
10
+ Text,
11
+ Pressable,
12
+ Button,
13
+ StyleSheet,
14
+ } from '@deskforge/ui/src'
15
+ import { State, Computed } from '@deskforge/state/src'
16
+
17
+ /**
18
+ * Style definitions
19
+ */
20
+ const styles = StyleSheet.create({
21
+ container: {
22
+ flex: 1,
23
+ backgroundColor: '#f8f9fc',
24
+ justifyContent: 'center',
25
+ alignItems: 'center',
26
+ padding: 20,
27
+ },
28
+ card: {
29
+ backgroundColor: '#ffffff',
30
+ borderRadius: 20,
31
+ padding: 40,
32
+ shadowColor: '#000000',
33
+ shadowOpacity: 0.1,
34
+ shadowRadius: 10,
35
+ elevation: 8,
36
+ alignItems: 'center',
37
+ minWidth: 280,
38
+ },
39
+ title: {
40
+ fontSize: 24,
41
+ fontWeight: 'bold',
42
+ color: '#111111',
43
+ marginBottom: 20,
44
+ },
45
+ counterDisplay: {
46
+ fontSize: 64,
47
+ fontWeight: 'bold',
48
+ color: '#0077ff',
49
+ marginBottom: 30,
50
+ minHeight: 80,
51
+ },
52
+ label: {
53
+ fontSize: 14,
54
+ color: '#999999',
55
+ marginBottom: 20,
56
+ },
57
+ buttonRow: {
58
+ flexDirection: 'row',
59
+ gap: 12,
60
+ marginTop: 20,
61
+ },
62
+ button: {
63
+ flex: 1,
64
+ paddingHorizontal: 16,
65
+ paddingVertical: 12,
66
+ borderRadius: 8,
67
+ minHeight: 48,
68
+ justifyContent: 'center',
69
+ alignItems: 'center',
70
+ },
71
+ incrementButton: {
72
+ backgroundColor: '#2ecc71',
73
+ },
74
+ decrementButton: {
75
+ backgroundColor: '#e74c3c',
76
+ },
77
+ resetButton: {
78
+ backgroundColor: '#95a5a6',
79
+ marginTop: 12,
80
+ },
81
+ buttonText: {
82
+ color: '#ffffff',
83
+ fontWeight: 'bold',
84
+ fontSize: 16,
85
+ },
86
+ statusText: {
87
+ fontSize: 14,
88
+ color: '#666666',
89
+ marginTop: 20,
90
+ fontStyle: 'italic',
91
+ },
92
+ })
93
+
94
+ /**
95
+ * CounterApp - Main component
96
+ *
97
+ * Simple counter demonstrating State reactivity and button handlers.
98
+ * Shows how State mutations automatically trigger re-renders.
99
+ */
100
+ export const CounterApp = () => {
101
+ // Reactive state - mutate directly, no setState needed
102
+ const state = State({
103
+ count: 0,
104
+ })
105
+
106
+ // Computed value - automatically updates when count changes
107
+ const isEven = Computed(() => state.count % 2 === 0)
108
+
109
+ // Handlers
110
+ const increment = () => {
111
+ state.count++
112
+ }
113
+
114
+ const decrement = () => {
115
+ state.count--
116
+ }
117
+
118
+ const reset = () => {
119
+ state.count = 0
120
+ }
121
+
122
+ return View(styles.container, [
123
+ View(styles.card, [
124
+ Text('Counter App', styles.title),
125
+
126
+ // Counter display
127
+ Text(String(state.count), styles.counterDisplay),
128
+
129
+ // Status
130
+ Text(
131
+ `The count is ${isEven.value ? 'even' : 'odd'}`,
132
+ styles.statusText
133
+ ),
134
+
135
+ // Increment/Decrement buttons
136
+ View(styles.buttonRow, [
137
+ Pressable(
138
+ {
139
+ ...styles.button,
140
+ ...styles.decrementButton,
141
+ },
142
+ {
143
+ onPress: decrement,
144
+ },
145
+ [
146
+ Text('−', { fontSize: 28, color: '#ffffff' }),
147
+ ]
148
+ ),
149
+
150
+ Pressable(
151
+ {
152
+ ...styles.button,
153
+ ...styles.incrementButton,
154
+ },
155
+ {
156
+ onPress: increment,
157
+ },
158
+ [
159
+ Text('+', { fontSize: 28, color: '#ffffff' }),
160
+ ]
161
+ ),
162
+ ]),
163
+
164
+ // Reset button
165
+ Pressable(
166
+ {
167
+ ...styles.button,
168
+ ...styles.resetButton,
169
+ },
170
+ {
171
+ onPress: reset,
172
+ },
173
+ [
174
+ Text('Reset', styles.buttonText),
175
+ ]
176
+ ),
177
+ ]),
178
+ ])
179
+ }
180
+
181
+ export default CounterApp
@@ -0,0 +1,267 @@
1
+ /**
2
+ * Gallery App - Complete Example
3
+ *
4
+ * Demonstrates Image component, FlatList with images,
5
+ * Modal for full-screen preview, and image gallery patterns.
6
+ */
7
+
8
+ import {
9
+ View,
10
+ Text,
11
+ Image,
12
+ Pressable,
13
+ FlatList,
14
+ Modal,
15
+ ActivityIndicator,
16
+ StyleSheet,
17
+ } from '@deskforge/ui/src'
18
+ import { State } from '@deskforge/state/src'
19
+
20
+ /**
21
+ * Image item structure
22
+ */
23
+ interface GalleryImage {
24
+ id: string
25
+ title: string
26
+ uri: string
27
+ width: number
28
+ height: number
29
+ }
30
+
31
+ /**
32
+ * Style definitions
33
+ */
34
+ const styles = StyleSheet.create({
35
+ container: {
36
+ flex: 1,
37
+ backgroundColor: '#f8f9fc',
38
+ },
39
+ header: {
40
+ paddingHorizontal: 16,
41
+ paddingVertical: 12,
42
+ backgroundColor: '#ffffff',
43
+ borderBottomWidth: 1,
44
+ borderBottomColor: '#e2e8f0',
45
+ },
46
+ headerTitle: {
47
+ fontSize: 20,
48
+ fontWeight: 'bold',
49
+ color: '#111111',
50
+ },
51
+ galleryGrid: {
52
+ padding: 8,
53
+ },
54
+ gridRow: {
55
+ flexDirection: 'row',
56
+ gap: 8,
57
+ marginBottom: 8,
58
+ },
59
+ thumbnail: {
60
+ flex: 1,
61
+ aspectRatio: 1,
62
+ borderRadius: 8,
63
+ overflow: 'hidden',
64
+ backgroundColor: '#e2e8f0',
65
+ },
66
+ thumbnailImage: {
67
+ width: '100%',
68
+ height: '100%',
69
+ },
70
+ modalOverlay: {
71
+ flex: 1,
72
+ backgroundColor: 'rgba(0, 0, 0, 0.95)',
73
+ justifyContent: 'center',
74
+ alignItems: 'center',
75
+ },
76
+ modalContent: {
77
+ width: '100%',
78
+ height: '100%',
79
+ justifyContent: 'center',
80
+ alignItems: 'center',
81
+ paddingVertical: 40,
82
+ },
83
+ fullscreenImage: {
84
+ width: '90%',
85
+ height: '70%',
86
+ borderRadius: 12,
87
+ },
88
+ modalTitle: {
89
+ fontSize: 18,
90
+ fontWeight: 'bold',
91
+ color: '#ffffff',
92
+ marginTop: 20,
93
+ textAlign: 'center',
94
+ },
95
+ closeButton: {
96
+ position: 'absolute',
97
+ top: 16,
98
+ right: 16,
99
+ width: 40,
100
+ height: 40,
101
+ backgroundColor: 'rgba(255, 255, 255, 0.2)',
102
+ borderRadius: 20,
103
+ justifyContent: 'center',
104
+ alignItems: 'center',
105
+ },
106
+ closeButtonText: {
107
+ fontSize: 28,
108
+ color: '#ffffff',
109
+ },
110
+ })
111
+
112
+ /**
113
+ * GalleryApp - Main component
114
+ *
115
+ * Image gallery with grid layout and full-screen preview modal.
116
+ */
117
+ export const GalleryApp = () => {
118
+ const state = State({
119
+ images: [
120
+ {
121
+ id: '1',
122
+ title: 'Sunset',
123
+ uri: 'https://images.unsplash.com/photo-1495567720989-cebddd5913d8?w=400&h=400&fit=crop',
124
+ width: 400,
125
+ height: 400,
126
+ },
127
+ {
128
+ id: '2',
129
+ title: 'Mountain',
130
+ uri: 'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=400&h=400&fit=crop',
131
+ width: 400,
132
+ height: 400,
133
+ },
134
+ {
135
+ id: '3',
136
+ title: 'Ocean',
137
+ uri: 'https://images.unsplash.com/photo-1505142468610-359e7d316be0?w=400&h=400&fit=crop',
138
+ width: 400,
139
+ height: 400,
140
+ },
141
+ {
142
+ id: '4',
143
+ title: 'Forest',
144
+ uri: 'https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=400&h=400&fit=crop',
145
+ width: 400,
146
+ height: 400,
147
+ },
148
+ {
149
+ id: '5',
150
+ title: 'Desert',
151
+ uri: 'https://images.unsplash.com/photo-1469854523086-cc02fe5d8800?w=400&h=400&fit=crop',
152
+ width: 400,
153
+ height: 400,
154
+ },
155
+ {
156
+ id: '6',
157
+ title: 'City',
158
+ uri: 'https://images.unsplash.com/photo-1480714378408-67cf0d13bc1b?w=400&h=400&fit=crop',
159
+ width: 400,
160
+ height: 400,
161
+ },
162
+ ] as GalleryImage[],
163
+ selectedImage: null as GalleryImage | null,
164
+ showPreview: false,
165
+ loading: false,
166
+ })
167
+
168
+ /**
169
+ * Open image preview
170
+ */
171
+ const openPreview = (image: GalleryImage) => {
172
+ state.selectedImage = image
173
+ state.showPreview = true
174
+ }
175
+
176
+ /**
177
+ * Close image preview
178
+ */
179
+ const closePreview = () => {
180
+ state.showPreview = false
181
+ state.selectedImage = null
182
+ }
183
+
184
+ /**
185
+ * Render grid row with 2 images
186
+ */
187
+ const renderGridRow = (items: GalleryImage[]) => {
188
+ const firstImage = items[0]
189
+ const secondImage = items[1]
190
+
191
+ return View(styles.gridRow, [
192
+ firstImage
193
+ ? Pressable(
194
+ styles.thumbnail,
195
+ {
196
+ onPress: () => openPreview(firstImage),
197
+ },
198
+ [
199
+ Image(firstImage.uri, styles.thumbnailImage),
200
+ ]
201
+ )
202
+ : View(styles.thumbnail, []),
203
+
204
+ secondImage
205
+ ? Pressable(
206
+ styles.thumbnail,
207
+ {
208
+ onPress: () => openPreview(secondImage),
209
+ },
210
+ [
211
+ Image(secondImage.uri, styles.thumbnailImage),
212
+ ]
213
+ )
214
+ : View(styles.thumbnail, []),
215
+ ])
216
+ }
217
+
218
+ /**
219
+ * Convert flat array to pairs for grid
220
+ */
221
+ const imageRows = []
222
+ for (let i = 0; i < state.images.length; i += 2) {
223
+ imageRows.push(state.images.slice(i, i + 2))
224
+ }
225
+
226
+ return View(styles.container, [
227
+ // Header
228
+ View(styles.header, [
229
+ Text('Gallery', styles.headerTitle),
230
+ ]),
231
+
232
+ // Grid
233
+ FlatList(
234
+ imageRows,
235
+ renderGridRow,
236
+ styles.galleryGrid
237
+ ),
238
+
239
+ // Preview modal
240
+ Modal([
241
+ Pressable(
242
+ styles.closeButton,
243
+ {
244
+ onPress: closePreview,
245
+ },
246
+ [
247
+ Text('×', styles.closeButtonText),
248
+ ]
249
+ ),
250
+
251
+ View(styles.modalContent, [
252
+ state.selectedImage
253
+ ? Image(state.selectedImage.uri, styles.fullscreenImage)
254
+ : ActivityIndicator({ margin: 20 }, { animating: true }),
255
+
256
+ state.selectedImage
257
+ ? Text(state.selectedImage.title, styles.modalTitle)
258
+ : null,
259
+ ].filter(Boolean) as any),
260
+ ], {
261
+ open: state.showPreview,
262
+ onClose: closePreview,
263
+ }),
264
+ ])
265
+ }
266
+
267
+ export default GalleryApp