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.
- package/COMPLETION_REPORT.md +426 -0
- package/COMPONENT_API.md +529 -0
- package/DELIVERY_SUMMARY.md +455 -0
- package/IMPLEMENTATION_GUIDE.md +385 -0
- package/IMPORT_GUIDE.md +404 -0
- package/QUICK_REFERENCE.md +352 -0
- package/README.md +245 -31
- package/README_UI_COMPLETE.md +395 -0
- package/TYPE_DEFINITIONS.md +671 -0
- package/UI_GETTING_STARTED.md +523 -0
- package/examples/deskforge-app/App.ts +7 -11
- package/examples/deskforge-app/screens/CounterApp.ts +181 -0
- package/examples/deskforge-app/screens/GalleryApp.ts +267 -0
- package/examples/deskforge-app/screens/NotesApp.ts +376 -0
- package/examples/deskforge-app/screens/SettingsApp.ts +226 -0
- package/examples/deskforge-app/screens/TodoApp.ts +288 -0
- package/examples/deskforge-app/screens/index.ts +50 -0
- package/package.json +1 -1
- package/packages/cli/dist/commands/start.d.ts +7 -1
- package/packages/cli/dist/commands/start.d.ts.map +1 -1
- package/packages/cli/dist/commands/start.js +75 -21
- package/packages/cli/dist/commands/start.js.map +1 -1
- package/packages/cli/src/commands/start.ts +93 -21
- package/packages/cli/test/start.test.js +24 -0
- package/packages/core/dist/index.d.ts +1 -0
- package/packages/core/dist/index.d.ts.map +1 -1
- package/packages/core/dist/index.js +1 -0
- package/packages/core/dist/index.js.map +1 -1
- package/packages/core/dist/style/StyleObject.d.ts +115 -0
- package/packages/core/dist/style/StyleObject.d.ts.map +1 -0
- package/packages/core/dist/style/StyleObject.js +6 -0
- package/packages/core/dist/style/StyleObject.js.map +1 -0
- package/packages/core/dist/style/StyleSheet.d.ts +7 -0
- package/packages/core/dist/style/StyleSheet.d.ts.map +1 -0
- package/packages/core/dist/style/StyleSheet.js +13 -0
- package/packages/core/dist/style/StyleSheet.js.map +1 -0
- package/packages/core/dist/style/index.d.ts +3 -0
- package/packages/core/dist/style/index.d.ts.map +1 -0
- package/packages/core/dist/style/index.js +21 -0
- package/packages/core/dist/style/index.js.map +1 -0
- package/packages/core/src/index.ts +2 -1
- package/packages/core/src/style/StyleObject.ts +134 -0
- package/packages/core/src/style/StyleSheet.ts +19 -0
- package/packages/core/src/style/index.ts +5 -0
- package/packages/db/src/db.ts +4 -4
- package/packages/deskforge/src/index.ts +95 -0
- package/packages/file/dist/file.d.ts +1 -1
- package/packages/file/dist/file.d.ts.map +1 -1
- package/packages/file/dist/file.js +75 -3
- package/packages/file/dist/file.js.map +1 -1
- package/packages/file/src/file.ts +96 -4
- package/packages/file/test/file.test.js +23 -0
- package/packages/router/dist/index.d.ts +1 -0
- package/packages/router/dist/index.d.ts.map +1 -1
- package/packages/router/dist/index.js +1 -0
- package/packages/router/dist/index.js.map +1 -1
- package/packages/router/dist/navigation.d.ts +23 -0
- package/packages/router/dist/navigation.d.ts.map +1 -0
- package/packages/router/dist/navigation.js +61 -0
- package/packages/router/dist/navigation.js.map +1 -0
- package/packages/router/src/index.ts +2 -1
- package/packages/router/src/navigation.ts +86 -0
- package/packages/router/test/router.test.js +21 -1
- package/packages/theme/src/theme.ts +23 -0
- package/packages/ui/src/base/Button.ts +67 -0
- package/packages/ui/src/base/Image.ts +59 -0
- package/packages/ui/src/base/Pressable.ts +69 -0
- package/packages/ui/src/base/Text.ts +42 -0
- package/packages/ui/src/base/TextInput.ts +113 -0
- package/packages/ui/src/base/TouchableOpacity.ts +52 -0
- package/packages/ui/src/base/View.ts +43 -0
- package/packages/ui/src/index.ts +40 -25
- package/packages/ui/src/input/CheckBox.ts +69 -0
- package/packages/ui/src/input/Slider.ts +19 -2
- package/packages/ui/src/input/Switch.ts +68 -0
- package/packages/ui/src/layout/KeyboardAvoidingView.ts +65 -0
- package/packages/ui/src/layout/SafeAreaView.ts +58 -0
- package/packages/ui/src/list/FlatList.ts +111 -0
- package/packages/ui/src/list/ScrollView.ts +80 -0
- package/packages/ui/src/list/SectionList.ts +120 -0
- package/packages/ui/src/overlay/ActivityIndicator.ts +70 -0
- package/packages/ui/src/overlay/Modal.ts +28 -6
- package/packages/ui/src/platform/Platform.ts +119 -0
- package/packages/ui/src/platform/StatusBar.ts +63 -0
package/COMPONENT_API.md
ADDED
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component API Reference
|
|
3
|
+
*
|
|
4
|
+
* Quick reference for all DeskForge UI component signatures.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
# DeskForge UI Components - API Reference
|
|
8
|
+
|
|
9
|
+
## Base Components
|
|
10
|
+
|
|
11
|
+
### View
|
|
12
|
+
|
|
13
|
+
Primary flex container. All layout uses View.
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
View(style: StyleObject, children: DFNode[]): DFNode
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Example:**
|
|
20
|
+
```typescript
|
|
21
|
+
View({ flex: 1, backgroundColor: '#fff' }, [
|
|
22
|
+
Text('Hello'),
|
|
23
|
+
])
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
### Text
|
|
29
|
+
|
|
30
|
+
Renders text content.
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
Text(content: string | number, style?: StyleObject): DFNode
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Example:**
|
|
37
|
+
```typescript
|
|
38
|
+
Text('Hello World', { fontSize: 16, fontWeight: 'bold' })
|
|
39
|
+
Text(42, { color: '#0077ff' })
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
### Pressable
|
|
45
|
+
|
|
46
|
+
Tappable container with press handlers.
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
Pressable(
|
|
50
|
+
style: StyleObject,
|
|
51
|
+
handlers: PressHandlers,
|
|
52
|
+
children: DFNode[]
|
|
53
|
+
): DFNode
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Handlers:**
|
|
57
|
+
- `onPress: () => void` — Fired on tap
|
|
58
|
+
- `onLongPress: () => void` — Fired after 500ms hold
|
|
59
|
+
- `onPressIn: () => void` — Press starts
|
|
60
|
+
- `onPressOut: () => void` — Press ends
|
|
61
|
+
- `disabled: boolean` — Disable all handlers
|
|
62
|
+
|
|
63
|
+
**Example:**
|
|
64
|
+
```typescript
|
|
65
|
+
Pressable({ padding: 12 }, {
|
|
66
|
+
onPress: () => console.log('tapped'),
|
|
67
|
+
}, [
|
|
68
|
+
Text('Press me'),
|
|
69
|
+
])
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### Button
|
|
75
|
+
|
|
76
|
+
Quick button shorthand combining Text + Pressable.
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
Button(
|
|
80
|
+
title: string,
|
|
81
|
+
style: StyleObject,
|
|
82
|
+
handlers: PressHandlers
|
|
83
|
+
): DFNode
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Example:**
|
|
87
|
+
```typescript
|
|
88
|
+
Button('Submit', { backgroundColor: '#0077ff', padding: 12 }, {
|
|
89
|
+
onPress: () => handleSubmit(),
|
|
90
|
+
})
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
### TouchableOpacity
|
|
96
|
+
|
|
97
|
+
Like Pressable with opacity anProperty 'navigate' does not exist on type 'typeof Router'.imation.
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
TouchableOpacity(
|
|
101
|
+
style: StyleObject,
|
|
102
|
+
handlers: PressHandlers,
|
|
103
|
+
children: DFNode[]
|
|
104
|
+
): DFNode
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
### Image
|
|
110
|
+
|
|
111
|
+
Display image from path or URI.
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
Image(source: string | { uri: string }, style?: StyleObject): DFNode
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Example:**
|
|
118
|
+
```typescript
|
|
119
|
+
Image('/assets/logo.png', { width: 100, height: 100 })
|
|
120
|
+
Image({ uri: 'https://example.com/image.png' }, { width: 200 })
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
### TextInput
|
|
126
|
+
|
|
127
|
+
Text input field.
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
TextInput(style: StyleObject, props: TextInputProps): DFNode
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Props:**
|
|
134
|
+
- `value?: string` — Current value
|
|
135
|
+
- `placeholder?: string` — Placeholder text
|
|
136
|
+
- `onChangeText?: (text: string) => void` — Text change callback
|
|
137
|
+
- `keyboardType?: 'default' | 'numeric' | 'email-address' | 'phone-pad'`
|
|
138
|
+
- `multiline?: boolean` — Allow multiple lines
|
|
139
|
+
- `maxLength?: number` — Max characters
|
|
140
|
+
- `secureTextEntry?: boolean` — Hide text (password)
|
|
141
|
+
|
|
142
|
+
**Example:**
|
|
143
|
+
```typescript
|
|
144
|
+
TextInput({ flex: 1, padding: 12, borderWidth: 1, borderColor: '#ccc' }, {
|
|
145
|
+
placeholder: 'Enter email',
|
|
146
|
+
keyboardType: 'email-address',
|
|
147
|
+
value: email,
|
|
148
|
+
onChangeText: setEmail,
|
|
149
|
+
})
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## List Components
|
|
155
|
+
|
|
156
|
+
### ScrollView
|
|
157
|
+
|
|
158
|
+
Scrollable container.
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
ScrollView(
|
|
162
|
+
style: StyleObject,
|
|
163
|
+
children: DFNode[],
|
|
164
|
+
props?: ScrollViewProps
|
|
165
|
+
): DFNode
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Props:**
|
|
169
|
+
- `horizontal?: boolean` — Horizontal scroll
|
|
170
|
+
- `bounces?: boolean` — Bounce effect
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
### FlatList
|
|
175
|
+
|
|
176
|
+
Virtualized list for performance.
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
FlatList<T>(
|
|
180
|
+
data: T[],
|
|
181
|
+
renderItem: (item: T, index: number) => DFNode,
|
|
182
|
+
style?: StyleObject,
|
|
183
|
+
props?: FlatListProps
|
|
184
|
+
): DFNode
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**Props:**
|
|
188
|
+
- `ItemSeparatorComponent?: () => DFNode` — Separator between items
|
|
189
|
+
- `ListHeaderComponent?: DFNode` — Header component
|
|
190
|
+
- `ListFooterComponent?: DFNode` — Footer component
|
|
191
|
+
- `ListEmptyComponent?: DFNode` — Empty state
|
|
192
|
+
- `onEndReached?: () => void` — Fired at end of list
|
|
193
|
+
- `onEndReachedThreshold?: number` — Distance to trigger onEndReached
|
|
194
|
+
- `horizontal?: boolean` — Horizontal scroll
|
|
195
|
+
- `numColumns?: number` — Column count for grid
|
|
196
|
+
|
|
197
|
+
**Example:**
|
|
198
|
+
```typescript
|
|
199
|
+
FlatList(
|
|
200
|
+
items,
|
|
201
|
+
(item) => Text(item.name, { padding: 12 }),
|
|
202
|
+
{ flex: 1 },
|
|
203
|
+
{
|
|
204
|
+
onEndReached: () => loadMore(),
|
|
205
|
+
numColumns: 2,
|
|
206
|
+
}
|
|
207
|
+
)
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
### SectionList
|
|
213
|
+
|
|
214
|
+
Grouped/sectioned list.
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
SectionList<T>(
|
|
218
|
+
sections: Section<T>[],
|
|
219
|
+
renderItem: (item: T) => DFNode,
|
|
220
|
+
renderSectionHeader: (title: string) => DFNode,
|
|
221
|
+
style?: StyleObject,
|
|
222
|
+
props?: SectionListProps
|
|
223
|
+
): DFNode
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Layout Components
|
|
229
|
+
|
|
230
|
+
### SafeAreaView
|
|
231
|
+
|
|
232
|
+
Respects notch and safe areas on mobile.
|
|
233
|
+
|
|
234
|
+
```typescript
|
|
235
|
+
SafeAreaView(
|
|
236
|
+
style: StyleObject,
|
|
237
|
+
children: DFNode[],
|
|
238
|
+
props?: SafeAreaViewProps
|
|
239
|
+
): DFNode
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
### KeyboardAvoidingView
|
|
245
|
+
|
|
246
|
+
Adjusts layout when keyboard appears.
|
|
247
|
+
|
|
248
|
+
```typescript
|
|
249
|
+
KeyboardAvoidingView(
|
|
250
|
+
style: StyleObject,
|
|
251
|
+
children: DFNode[],
|
|
252
|
+
props?: KeyboardAvoidingViewProps
|
|
253
|
+
): DFNode
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
**Props:**
|
|
257
|
+
- `behavior?: 'height' | 'padding' | 'position'`
|
|
258
|
+
- `enabled?: boolean`
|
|
259
|
+
- `keyboardVerticalOffset?: number`
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## Overlay Components
|
|
264
|
+
|
|
265
|
+
### Modal
|
|
266
|
+
|
|
267
|
+
Full-screen overlay modal.
|
|
268
|
+
|
|
269
|
+
```typescript
|
|
270
|
+
Modal(
|
|
271
|
+
visible: boolean,
|
|
272
|
+
onClose: () => void,
|
|
273
|
+
style: StyleObject,
|
|
274
|
+
children: DFNode[],
|
|
275
|
+
props?: ModalProps
|
|
276
|
+
): DFNode
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**Props:**
|
|
280
|
+
- `animationType?: 'fade' | 'slide' | 'none'`
|
|
281
|
+
- `transparent?: boolean`
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
### ActivityIndicator
|
|
286
|
+
|
|
287
|
+
Loading spinner.
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
ActivityIndicator(
|
|
291
|
+
style?: StyleObject,
|
|
292
|
+
props?: ActivityIndicatorProps
|
|
293
|
+
): DFNode
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
**Props:**
|
|
297
|
+
- `color?: string` — Indicator color
|
|
298
|
+
- `size?: 'small' | 'large' | number` — Size
|
|
299
|
+
- `animating?: boolean` — Animation state
|
|
300
|
+
- `hidesWhenStopped?: boolean` — Hide when not animating
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## Input Components
|
|
305
|
+
|
|
306
|
+
### Switch
|
|
307
|
+
|
|
308
|
+
Toggle on/off switch.
|
|
309
|
+
|
|
310
|
+
```typescript
|
|
311
|
+
Switch(
|
|
312
|
+
value: boolean,
|
|
313
|
+
onValueChange: (value: boolean) => void,
|
|
314
|
+
props?: SwitchProps
|
|
315
|
+
): DFNode
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
**Props:**
|
|
319
|
+
- `onTintColor?: string` — Color when on
|
|
320
|
+
- `offTintColor?: string` — Color when off
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
### Slider
|
|
325
|
+
|
|
326
|
+
Range input slider.
|
|
327
|
+
|
|
328
|
+
```typescript
|
|
329
|
+
Slider(
|
|
330
|
+
style: StyleObject,
|
|
331
|
+
props: SliderProps
|
|
332
|
+
): DFNode
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
**Props:**
|
|
336
|
+
- `value?: number` — Current value
|
|
337
|
+
- `minimumValue?: number` — Min value
|
|
338
|
+
- `maximumValue?: number` — Max value
|
|
339
|
+
- `step?: number` — Step size
|
|
340
|
+
- `onValueChange?: (value: number) => void` — Drag callback
|
|
341
|
+
- `onSlidingComplete?: (value: number) => void` — Release callback
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
### CheckBox
|
|
346
|
+
|
|
347
|
+
Checkbox input.
|
|
348
|
+
|
|
349
|
+
```typescript
|
|
350
|
+
CheckBox(
|
|
351
|
+
value: boolean,
|
|
352
|
+
onValueChange: (value: boolean) => void,
|
|
353
|
+
style?: StyleObject,
|
|
354
|
+
props?: CheckBoxProps
|
|
355
|
+
): DFNode
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
## Platform Components
|
|
361
|
+
|
|
362
|
+
### StatusBar
|
|
363
|
+
|
|
364
|
+
System status bar (mobile).
|
|
365
|
+
|
|
366
|
+
```typescript
|
|
367
|
+
StatusBar(props: StatusBarProps): DFNode
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
**Props:**
|
|
371
|
+
- `backgroundColor?: string` — Bar color
|
|
372
|
+
- `barStyle?: 'light-content' | 'dark-content'` — Icon color
|
|
373
|
+
- `hidden?: boolean` — Hide status bar
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
377
|
+
### Platform
|
|
378
|
+
|
|
379
|
+
Cross-platform utilities.
|
|
380
|
+
|
|
381
|
+
```typescript
|
|
382
|
+
Platform.OS: 'windows' | 'macos' | 'linux' | 'ios' | 'android'
|
|
383
|
+
|
|
384
|
+
Platform.select<T>(options: {
|
|
385
|
+
ios?: T
|
|
386
|
+
android?: T
|
|
387
|
+
windows?: T
|
|
388
|
+
macos?: T
|
|
389
|
+
linux?: T
|
|
390
|
+
default?: T
|
|
391
|
+
}): T
|
|
392
|
+
|
|
393
|
+
Platform.desktop(node: DFNode): DFNode | null
|
|
394
|
+
Platform.mobile(node: DFNode): DFNode | null
|
|
395
|
+
Platform.any(node: DFNode): DFNode
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
**Example:**
|
|
399
|
+
```typescript
|
|
400
|
+
if (Platform.OS === 'ios') { /* iOS code */ }
|
|
401
|
+
|
|
402
|
+
const padding = Platform.select({
|
|
403
|
+
ios: 12,
|
|
404
|
+
android: 8,
|
|
405
|
+
default: 10,
|
|
406
|
+
})
|
|
407
|
+
|
|
408
|
+
Platform.desktop(DesktopOnlyComponent)
|
|
409
|
+
Platform.mobile(MobileOnlyComponent)
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
## Style Object
|
|
415
|
+
|
|
416
|
+
All style properties from React Native are supported:
|
|
417
|
+
|
|
418
|
+
```typescript
|
|
419
|
+
interface StyleObject {
|
|
420
|
+
// Layout
|
|
421
|
+
flex?: number
|
|
422
|
+
flexDirection?: 'row' | 'column'
|
|
423
|
+
justifyContent?: 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around'
|
|
424
|
+
alignItems?: 'flex-start' | 'center' | 'flex-end' | 'stretch'
|
|
425
|
+
gap?: number
|
|
426
|
+
|
|
427
|
+
// Spacing
|
|
428
|
+
margin?: number
|
|
429
|
+
marginHorizontal?: number
|
|
430
|
+
marginVertical?: number
|
|
431
|
+
padding?: number
|
|
432
|
+
paddingHorizontal?: number
|
|
433
|
+
paddingVertical?: number
|
|
434
|
+
|
|
435
|
+
// Dimensions
|
|
436
|
+
width?: number | string
|
|
437
|
+
height?: number | string
|
|
438
|
+
|
|
439
|
+
// Appearance
|
|
440
|
+
backgroundColor?: string
|
|
441
|
+
borderRadius?: number
|
|
442
|
+
borderWidth?: number
|
|
443
|
+
borderColor?: string
|
|
444
|
+
opacity?: number
|
|
445
|
+
|
|
446
|
+
// Typography
|
|
447
|
+
fontSize?: number
|
|
448
|
+
fontWeight?: 'normal' | 'bold' | '100' | '200' | ... | '900'
|
|
449
|
+
color?: string
|
|
450
|
+
textAlign?: 'left' | 'center' | 'right'
|
|
451
|
+
|
|
452
|
+
// Position
|
|
453
|
+
position?: 'absolute' | 'relative'
|
|
454
|
+
top?: number
|
|
455
|
+
bottom?: number
|
|
456
|
+
left?: number
|
|
457
|
+
right?: number
|
|
458
|
+
|
|
459
|
+
// Shadow
|
|
460
|
+
shadowColor?: string
|
|
461
|
+
shadowOpacity?: number
|
|
462
|
+
shadowRadius?: number
|
|
463
|
+
elevation?: number
|
|
464
|
+
}
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
## State Management
|
|
470
|
+
|
|
471
|
+
```typescript
|
|
472
|
+
import { State, Computed, Watch, Effect, Ref } from 'deskforge/state'
|
|
473
|
+
|
|
474
|
+
// Reactive state - direct mutations
|
|
475
|
+
const state = State({ count: 0 })
|
|
476
|
+
state.count++ // Automatic update
|
|
477
|
+
|
|
478
|
+
// Computed derived values
|
|
479
|
+
const doubled = Computed(() => state.count * 2)
|
|
480
|
+
|
|
481
|
+
// Watch changes
|
|
482
|
+
Watch(() => state.count, (newVal, oldVal) => {})
|
|
483
|
+
|
|
484
|
+
// Side effects
|
|
485
|
+
Effect(() => {
|
|
486
|
+
console.log('count changed')
|
|
487
|
+
return () => console.log('cleanup')
|
|
488
|
+
})
|
|
489
|
+
|
|
490
|
+
// Immutable ref
|
|
491
|
+
const ref = Ref(initialValue)
|
|
492
|
+
ref.value = newValue
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
---
|
|
496
|
+
|
|
497
|
+
## StyleSheet
|
|
498
|
+
|
|
499
|
+
```typescript
|
|
500
|
+
import { StyleSheet } from 'deskforge'
|
|
501
|
+
|
|
502
|
+
const styles = StyleSheet.create({
|
|
503
|
+
container: { flex: 1, backgroundColor: '#fff' },
|
|
504
|
+
title: { fontSize: 20, fontWeight: 'bold' },
|
|
505
|
+
})
|
|
506
|
+
|
|
507
|
+
// Use styles
|
|
508
|
+
View(styles.container, [...])
|
|
509
|
+
Text('Title', styles.title)
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
---
|
|
513
|
+
|
|
514
|
+
## Complete Import
|
|
515
|
+
|
|
516
|
+
```typescript
|
|
517
|
+
import {
|
|
518
|
+
View, Text, Pressable, Button, TouchableOpacity,
|
|
519
|
+
Image, TextInput,
|
|
520
|
+
ScrollView, FlatList, SectionList,
|
|
521
|
+
SafeAreaView, KeyboardAvoidingView,
|
|
522
|
+
Modal, ActivityIndicator,
|
|
523
|
+
Switch, Slider, CheckBox,
|
|
524
|
+
StatusBar, Platform,
|
|
525
|
+
StyleSheet, createNode,
|
|
526
|
+
} from 'deskforge'
|
|
527
|
+
|
|
528
|
+
import { State, Computed, Watch, Effect, Ref } from 'deskforge/state'
|
|
529
|
+
```
|