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
|
@@ -0,0 +1,671 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DeskForge UI - Type Definitions Summary
|
|
3
|
+
*
|
|
4
|
+
* All exported types, interfaces, and type aliases
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
# DeskForge UI - Type System Reference
|
|
8
|
+
|
|
9
|
+
## Core Types
|
|
10
|
+
|
|
11
|
+
### DFNode
|
|
12
|
+
```typescript
|
|
13
|
+
interface DFNode {
|
|
14
|
+
id: string // Generated unique ID
|
|
15
|
+
type: string // Component type name
|
|
16
|
+
props: Record<string, unknown> // All component props
|
|
17
|
+
children: DFNode[] // Child nodes
|
|
18
|
+
key: string | number | null // For list diffing
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### StyleObject
|
|
23
|
+
```typescript
|
|
24
|
+
interface StyleObject {
|
|
25
|
+
// Layout
|
|
26
|
+
flex?: number
|
|
27
|
+
flexDirection?: 'row' | 'column'
|
|
28
|
+
justifyContent?: 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around'
|
|
29
|
+
alignItems?: 'flex-start' | 'center' | 'flex-end' | 'stretch'
|
|
30
|
+
alignSelf?: 'auto' | 'flex-start' | 'center' | 'flex-end' | 'stretch'
|
|
31
|
+
flexWrap?: 'wrap' | 'nowrap'
|
|
32
|
+
flexGrow?: number
|
|
33
|
+
flexShrink?: number
|
|
34
|
+
flexBasis?: number | string
|
|
35
|
+
gap?: number
|
|
36
|
+
rowGap?: number
|
|
37
|
+
columnGap?: number
|
|
38
|
+
|
|
39
|
+
// Spacing
|
|
40
|
+
margin?: number
|
|
41
|
+
marginTop?: number
|
|
42
|
+
marginBottom?: number
|
|
43
|
+
marginLeft?: number
|
|
44
|
+
marginRight?: number
|
|
45
|
+
marginHorizontal?: number
|
|
46
|
+
marginVertical?: number
|
|
47
|
+
padding?: number
|
|
48
|
+
paddingTop?: number
|
|
49
|
+
paddingBottom?: number
|
|
50
|
+
paddingLeft?: number
|
|
51
|
+
paddingRight?: number
|
|
52
|
+
paddingHorizontal?: number
|
|
53
|
+
paddingVertical?: number
|
|
54
|
+
|
|
55
|
+
// Dimensions
|
|
56
|
+
width?: number | string
|
|
57
|
+
height?: number | string
|
|
58
|
+
minWidth?: number | string
|
|
59
|
+
maxWidth?: number | string
|
|
60
|
+
minHeight?: number | string
|
|
61
|
+
maxHeight?: number | string
|
|
62
|
+
|
|
63
|
+
// Appearance
|
|
64
|
+
backgroundColor?: string
|
|
65
|
+
borderRadius?: number
|
|
66
|
+
borderTopLeftRadius?: number
|
|
67
|
+
borderTopRightRadius?: number
|
|
68
|
+
borderBottomLeftRadius?: number
|
|
69
|
+
borderBottomRightRadius?: number
|
|
70
|
+
borderWidth?: number
|
|
71
|
+
borderTopWidth?: number
|
|
72
|
+
borderBottomWidth?: number
|
|
73
|
+
borderLeftWidth?: number
|
|
74
|
+
borderRightWidth?: number
|
|
75
|
+
borderColor?: string
|
|
76
|
+
borderTopColor?: string
|
|
77
|
+
borderBottomColor?: string
|
|
78
|
+
borderLeftColor?: string
|
|
79
|
+
borderRightColor?: string
|
|
80
|
+
opacity?: number
|
|
81
|
+
overflow?: 'visible' | 'hidden' | 'scroll'
|
|
82
|
+
zIndex?: number
|
|
83
|
+
shadowColor?: string
|
|
84
|
+
shadowOpacity?: number
|
|
85
|
+
shadowRadius?: number
|
|
86
|
+
shadowOffset?: { width: number; height: number }
|
|
87
|
+
elevation?: number
|
|
88
|
+
|
|
89
|
+
// Typography
|
|
90
|
+
fontSize?: number
|
|
91
|
+
fontWeight?: 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900'
|
|
92
|
+
fontFamily?: string
|
|
93
|
+
color?: string
|
|
94
|
+
textAlign?: 'left' | 'center' | 'right' | 'justify'
|
|
95
|
+
lineHeight?: number
|
|
96
|
+
letterSpacing?: number
|
|
97
|
+
textDecorationLine?: 'none' | 'underline' | 'line-through' | 'underline line-through'
|
|
98
|
+
textTransform?: 'none' | 'capitalize' | 'uppercase' | 'lowercase'
|
|
99
|
+
includeFontPadding?: boolean
|
|
100
|
+
|
|
101
|
+
// Position
|
|
102
|
+
position?: 'absolute' | 'relative'
|
|
103
|
+
top?: number
|
|
104
|
+
bottom?: number
|
|
105
|
+
left?: number
|
|
106
|
+
right?: number
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Component Types
|
|
113
|
+
|
|
114
|
+
### PressHandlers
|
|
115
|
+
```typescript
|
|
116
|
+
interface PressHandlers {
|
|
117
|
+
onPress?: () => void
|
|
118
|
+
onLongPress?: () => void
|
|
119
|
+
onPressIn?: () => void
|
|
120
|
+
onPressOut?: () => void
|
|
121
|
+
disabled?: boolean
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### TextInputProps
|
|
126
|
+
```typescript
|
|
127
|
+
interface TextInputProps {
|
|
128
|
+
value?: string
|
|
129
|
+
placeholder?: string
|
|
130
|
+
onChangeText?: (text: string) => void
|
|
131
|
+
onFocus?: () => void
|
|
132
|
+
onBlur?: () => void
|
|
133
|
+
keyboardType?: 'default' | 'numeric' | 'email-address' | 'phone-pad'
|
|
134
|
+
returnKeyType?: string
|
|
135
|
+
placeholderTextColor?: string
|
|
136
|
+
numberOfLines?: number
|
|
137
|
+
multiline?: boolean
|
|
138
|
+
editable?: boolean
|
|
139
|
+
maxLength?: number
|
|
140
|
+
autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters'
|
|
141
|
+
autoCorrect?: boolean
|
|
142
|
+
secureTextEntry?: boolean
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### ScrollViewProps
|
|
147
|
+
```typescript
|
|
148
|
+
interface ScrollViewProps {
|
|
149
|
+
horizontal?: boolean
|
|
150
|
+
showsVerticalScrollIndicator?: boolean
|
|
151
|
+
showsHorizontalScrollIndicator?: boolean
|
|
152
|
+
bounces?: boolean
|
|
153
|
+
decelerationRate?: number | 'fast' | 'normal'
|
|
154
|
+
pagingEnabled?: boolean
|
|
155
|
+
onScroll?: (offset: { x: number; y: number }) => void
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### FlatListProps
|
|
160
|
+
```typescript
|
|
161
|
+
interface FlatListProps {
|
|
162
|
+
ItemSeparatorComponent?: () => DFNode
|
|
163
|
+
ListHeaderComponent?: DFNode
|
|
164
|
+
ListFooterComponent?: DFNode
|
|
165
|
+
ListEmptyComponent?: DFNode
|
|
166
|
+
initialNumToRender?: number
|
|
167
|
+
onScroll?: (offset: { x: number; y: number }) => void
|
|
168
|
+
onEndReached?: () => void
|
|
169
|
+
onEndReachedThreshold?: number
|
|
170
|
+
horizontal?: boolean
|
|
171
|
+
showsVerticalScrollIndicator?: boolean
|
|
172
|
+
bounces?: boolean
|
|
173
|
+
numColumns?: number
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### SectionListProps
|
|
178
|
+
```typescript
|
|
179
|
+
interface SectionListProps {
|
|
180
|
+
ItemSeparatorComponent?: () => DFNode
|
|
181
|
+
SectionSeparatorComponent?: () => DFNode
|
|
182
|
+
ListHeaderComponent?: DFNode
|
|
183
|
+
ListFooterComponent?: DFNode
|
|
184
|
+
ListEmptyComponent?: DFNode
|
|
185
|
+
initialNumToRender?: number
|
|
186
|
+
onScroll?: (offset: { x: number; y: number }) => void
|
|
187
|
+
bounces?: boolean
|
|
188
|
+
showsVerticalScrollIndicator?: boolean
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
interface Section<T> {
|
|
192
|
+
title: string
|
|
193
|
+
data: T[]
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### SafeAreaViewProps
|
|
198
|
+
```typescript
|
|
199
|
+
interface SafeAreaViewProps {
|
|
200
|
+
edges?: ('top' | 'bottom' | 'left' | 'right')[]
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### KeyboardAvoidingViewProps
|
|
205
|
+
```typescript
|
|
206
|
+
interface KeyboardAvoidingViewProps {
|
|
207
|
+
behavior?: 'height' | 'padding' | 'position'
|
|
208
|
+
enabled?: boolean
|
|
209
|
+
keyboardVerticalOffset?: number
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### ModalProps
|
|
214
|
+
```typescript
|
|
215
|
+
interface ModalProps {
|
|
216
|
+
animationType?: 'fade' | 'slide' | 'none'
|
|
217
|
+
transparent?: boolean
|
|
218
|
+
statusBarTranslucent?: boolean
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### ActivityIndicatorProps
|
|
223
|
+
```typescript
|
|
224
|
+
interface ActivityIndicatorProps {
|
|
225
|
+
color?: string
|
|
226
|
+
size?: 'small' | 'large' | number
|
|
227
|
+
hidesWhenStopped?: boolean
|
|
228
|
+
animating?: boolean
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### SwitchProps
|
|
233
|
+
```typescript
|
|
234
|
+
interface SwitchProps {
|
|
235
|
+
onTintColor?: string
|
|
236
|
+
offTintColor?: string
|
|
237
|
+
thumbTintColor?: string
|
|
238
|
+
disabled?: boolean
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### SliderProps
|
|
243
|
+
```typescript
|
|
244
|
+
interface SliderProps {
|
|
245
|
+
value?: number
|
|
246
|
+
minimumValue?: number
|
|
247
|
+
maximumValue?: number
|
|
248
|
+
step?: number
|
|
249
|
+
onValueChange?: (value: number) => void
|
|
250
|
+
onSlidingComplete?: (value: number) => void
|
|
251
|
+
minimumTrackTintColor?: string
|
|
252
|
+
maximumTrackTintColor?: string
|
|
253
|
+
thumbTintColor?: string
|
|
254
|
+
disabled?: boolean
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### CheckBoxProps
|
|
259
|
+
```typescript
|
|
260
|
+
interface CheckBoxProps {
|
|
261
|
+
tintColor?: string
|
|
262
|
+
onTintColor?: string
|
|
263
|
+
disabled?: boolean
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### StatusBarProps
|
|
268
|
+
```typescript
|
|
269
|
+
interface StatusBarProps {
|
|
270
|
+
backgroundColor?: string
|
|
271
|
+
barStyle?: 'light-content' | 'dark-content'
|
|
272
|
+
hidden?: boolean
|
|
273
|
+
translucent?: boolean
|
|
274
|
+
networkActivityIndicatorVisible?: boolean
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### ImageSource
|
|
279
|
+
```typescript
|
|
280
|
+
type ImageSource = string | { uri: string }
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Platform Types
|
|
286
|
+
|
|
287
|
+
### PlatformOS
|
|
288
|
+
```typescript
|
|
289
|
+
type PlatformOS = 'windows' | 'macos' | 'linux' | 'ios' | 'android'
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### PlatformSelectOptions
|
|
293
|
+
```typescript
|
|
294
|
+
interface PlatformSelectOptions<T> {
|
|
295
|
+
ios?: T
|
|
296
|
+
android?: T
|
|
297
|
+
windows?: T
|
|
298
|
+
macos?: T
|
|
299
|
+
linux?: T
|
|
300
|
+
web?: T
|
|
301
|
+
native?: T
|
|
302
|
+
default?: T
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## State Management Types
|
|
309
|
+
|
|
310
|
+
### State<T>
|
|
311
|
+
```typescript
|
|
312
|
+
// Returns reactive proxy of T
|
|
313
|
+
State<T>(initial: T): T
|
|
314
|
+
|
|
315
|
+
// Mutations trigger automatic re-renders
|
|
316
|
+
const state = State({ count: 0 })
|
|
317
|
+
state.count++ // Reactivity magic
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Computed<T>
|
|
321
|
+
```typescript
|
|
322
|
+
interface ComputedRef<T> {
|
|
323
|
+
value: T // Auto-updated
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
Computed<T>(fn: () => T): ComputedRef<T>
|
|
327
|
+
|
|
328
|
+
const doubled = Computed(() => state.count * 2)
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Watch
|
|
332
|
+
```typescript
|
|
333
|
+
interface WatchHandle {
|
|
334
|
+
stop: () => void
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
Watch<T>(
|
|
338
|
+
source: () => T,
|
|
339
|
+
callback: (newValue: T, oldValue: T) => void,
|
|
340
|
+
scheduler?: any
|
|
341
|
+
): WatchHandle
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### Effect
|
|
345
|
+
```typescript
|
|
346
|
+
interface EffectHandle {
|
|
347
|
+
stop: () => void
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
Effect(
|
|
351
|
+
fn: () => void | (() => void),
|
|
352
|
+
scheduler?: any
|
|
353
|
+
): EffectHandle
|
|
354
|
+
|
|
355
|
+
// Optional cleanup
|
|
356
|
+
Effect(() => {
|
|
357
|
+
console.log('effect')
|
|
358
|
+
return () => console.log('cleanup')
|
|
359
|
+
})
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### Ref<T>
|
|
363
|
+
```typescript
|
|
364
|
+
interface RefObject<T> {
|
|
365
|
+
value: T
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
Ref<T>(initial: T): RefObject<T>
|
|
369
|
+
|
|
370
|
+
const ref = Ref(initialValue)
|
|
371
|
+
ref.value = newValue
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
## Component Function Signatures
|
|
377
|
+
|
|
378
|
+
### Base Components
|
|
379
|
+
|
|
380
|
+
```typescript
|
|
381
|
+
View(style: StyleObject, children: DFNode[]): DFNode
|
|
382
|
+
|
|
383
|
+
Text(content: string | number, style?: StyleObject): DFNode
|
|
384
|
+
|
|
385
|
+
Pressable(
|
|
386
|
+
style: StyleObject,
|
|
387
|
+
handlers: PressHandlers,
|
|
388
|
+
children: DFNode[]
|
|
389
|
+
): DFNode
|
|
390
|
+
|
|
391
|
+
Button(
|
|
392
|
+
title: string,
|
|
393
|
+
style: StyleObject,
|
|
394
|
+
handlers: PressHandlers
|
|
395
|
+
): DFNode
|
|
396
|
+
|
|
397
|
+
TouchableOpacity(
|
|
398
|
+
style: StyleObject,
|
|
399
|
+
handlers: PressHandlers,
|
|
400
|
+
children: DFNode[]
|
|
401
|
+
): DFNode
|
|
402
|
+
|
|
403
|
+
Image(source: ImageSource, style?: StyleObject): DFNode
|
|
404
|
+
|
|
405
|
+
TextInput(style: StyleObject, props: TextInputProps): DFNode
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
### List Components
|
|
409
|
+
|
|
410
|
+
```typescript
|
|
411
|
+
ScrollView(
|
|
412
|
+
style: StyleObject,
|
|
413
|
+
children: DFNode[],
|
|
414
|
+
props?: ScrollViewProps
|
|
415
|
+
): DFNode
|
|
416
|
+
|
|
417
|
+
FlatList<T>(
|
|
418
|
+
data: T[],
|
|
419
|
+
renderItem: (item: T, index: number) => DFNode,
|
|
420
|
+
style?: StyleObject,
|
|
421
|
+
props?: FlatListProps
|
|
422
|
+
): DFNode
|
|
423
|
+
|
|
424
|
+
SectionList<T>(
|
|
425
|
+
sections: Section<T>[],
|
|
426
|
+
renderItem: (item: T) => DFNode,
|
|
427
|
+
renderSectionHeader: (title: string) => DFNode,
|
|
428
|
+
style?: StyleObject,
|
|
429
|
+
props?: SectionListProps
|
|
430
|
+
): DFNode
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
### Layout Components
|
|
434
|
+
|
|
435
|
+
```typescript
|
|
436
|
+
SafeAreaView(
|
|
437
|
+
style: StyleObject,
|
|
438
|
+
children: DFNode[],
|
|
439
|
+
props?: SafeAreaViewProps
|
|
440
|
+
): DFNode
|
|
441
|
+
|
|
442
|
+
KeyboardAvoidingView(
|
|
443
|
+
style: StyleObject,
|
|
444
|
+
children: DFNode[],
|
|
445
|
+
props?: KeyboardAvoidingViewProps
|
|
446
|
+
): DFNode
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
### Overlay Components
|
|
450
|
+
|
|
451
|
+
```typescript
|
|
452
|
+
Modal(
|
|
453
|
+
visible: boolean,
|
|
454
|
+
onClose: () => void,
|
|
455
|
+
style: StyleObject,
|
|
456
|
+
children: DFNode[],
|
|
457
|
+
props?: ModalProps
|
|
458
|
+
): DFNode
|
|
459
|
+
|
|
460
|
+
ActivityIndicator(
|
|
461
|
+
style?: StyleObject,
|
|
462
|
+
props?: ActivityIndicatorProps
|
|
463
|
+
): DFNode
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
### Input Components
|
|
467
|
+
|
|
468
|
+
```typescript
|
|
469
|
+
Switch(
|
|
470
|
+
value: boolean,
|
|
471
|
+
onValueChange: (value: boolean) => void,
|
|
472
|
+
props?: SwitchProps
|
|
473
|
+
): DFNode
|
|
474
|
+
|
|
475
|
+
Slider(
|
|
476
|
+
style: StyleObject,
|
|
477
|
+
props: SliderProps
|
|
478
|
+
): DFNode
|
|
479
|
+
|
|
480
|
+
CheckBox(
|
|
481
|
+
value: boolean,
|
|
482
|
+
onValueChange: (value: boolean) => void,
|
|
483
|
+
style?: StyleObject,
|
|
484
|
+
props?: CheckBoxProps
|
|
485
|
+
): DFNode
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
### Platform Components
|
|
489
|
+
|
|
490
|
+
```typescript
|
|
491
|
+
StatusBar(props: StatusBarProps): DFNode
|
|
492
|
+
|
|
493
|
+
Platform.OS: PlatformOS
|
|
494
|
+
|
|
495
|
+
Platform.select<T>(options: PlatformSelectOptions<T>): T
|
|
496
|
+
Platform.desktop(node: DFNode): DFNode | null
|
|
497
|
+
Platform.mobile(node: DFNode): DFNode | null
|
|
498
|
+
Platform.any(node: DFNode): DFNode
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
---
|
|
502
|
+
|
|
503
|
+
## Utility Types
|
|
504
|
+
|
|
505
|
+
### StyleSheet
|
|
506
|
+
|
|
507
|
+
```typescript
|
|
508
|
+
StyleSheet.create<T extends Record<string, StyleObject>>(
|
|
509
|
+
styles: T
|
|
510
|
+
): Readonly<T>
|
|
511
|
+
|
|
512
|
+
const styles = StyleSheet.create({
|
|
513
|
+
container: { flex: 1 }, // Type: StyleObject
|
|
514
|
+
button: { padding: 12 }, // Type: StyleObject
|
|
515
|
+
})
|
|
516
|
+
// Result type: Readonly<{ container: StyleObject, button: StyleObject }>
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
---
|
|
520
|
+
|
|
521
|
+
## Union Types
|
|
522
|
+
|
|
523
|
+
### Flex Direction
|
|
524
|
+
```typescript
|
|
525
|
+
type FlexDirection = 'row' | 'column'
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
### Justify Content
|
|
529
|
+
```typescript
|
|
530
|
+
type JustifyContent = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around'
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
### Align Items
|
|
534
|
+
```typescript
|
|
535
|
+
type AlignItems = 'flex-start' | 'center' | 'flex-end' | 'stretch'
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
### Text Align
|
|
539
|
+
```typescript
|
|
540
|
+
type TextAlign = 'left' | 'center' | 'right' | 'justify'
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
### Position
|
|
544
|
+
```typescript
|
|
545
|
+
type Position = 'absolute' | 'relative'
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
### Overflow
|
|
549
|
+
```typescript
|
|
550
|
+
type Overflow = 'visible' | 'hidden' | 'scroll'
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
### Font Weight
|
|
554
|
+
```typescript
|
|
555
|
+
type FontWeight = 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900'
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
---
|
|
559
|
+
|
|
560
|
+
## Generic Types
|
|
561
|
+
|
|
562
|
+
### FlatList Generic
|
|
563
|
+
|
|
564
|
+
```typescript
|
|
565
|
+
// Can render any type
|
|
566
|
+
FlatList<User>(users, (user) => renderUser(user))
|
|
567
|
+
FlatList<Post>(posts, (post) => renderPost(post))
|
|
568
|
+
FlatList<Message>(messages, (msg) => renderMsg(msg))
|
|
569
|
+
|
|
570
|
+
interface User { id: string; name: string }
|
|
571
|
+
interface Post { id: string; content: string }
|
|
572
|
+
interface Message { id: string; text: string }
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
### SectionList Generic
|
|
576
|
+
|
|
577
|
+
```typescript
|
|
578
|
+
// Can group any type
|
|
579
|
+
SectionList<Comment>(
|
|
580
|
+
commentSections,
|
|
581
|
+
(comment) => renderComment(comment),
|
|
582
|
+
(title) => renderHeader(title)
|
|
583
|
+
)
|
|
584
|
+
|
|
585
|
+
interface Comment { id: string; text: string }
|
|
586
|
+
interface CommentSection extends Section<Comment> {
|
|
587
|
+
title: string // Section title
|
|
588
|
+
data: Comment[] // Comments in section
|
|
589
|
+
}
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
### Computed Generic
|
|
593
|
+
|
|
594
|
+
```typescript
|
|
595
|
+
// Infer type from function
|
|
596
|
+
const count = State({ value: 0 })
|
|
597
|
+
const doubled = Computed(() => count.value * 2) // number
|
|
598
|
+
|
|
599
|
+
const items = State({ list: [] as string[] })
|
|
600
|
+
const count = Computed(() => items.list.length) // number
|
|
601
|
+
|
|
602
|
+
const isEven = Computed(() => count % 2 === 0) // boolean
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
---
|
|
606
|
+
|
|
607
|
+
## Complete Import Example
|
|
608
|
+
|
|
609
|
+
```typescript
|
|
610
|
+
import type {
|
|
611
|
+
DFNode,
|
|
612
|
+
StyleObject,
|
|
613
|
+
PressHandlers,
|
|
614
|
+
TextInputProps,
|
|
615
|
+
ScrollViewProps,
|
|
616
|
+
FlatListProps,
|
|
617
|
+
SectionListProps,
|
|
618
|
+
Section,
|
|
619
|
+
SafeAreaViewProps,
|
|
620
|
+
KeyboardAvoidingViewProps,
|
|
621
|
+
ModalProps,
|
|
622
|
+
ActivityIndicatorProps,
|
|
623
|
+
SwitchProps,
|
|
624
|
+
SliderProps,
|
|
625
|
+
CheckBoxProps,
|
|
626
|
+
StatusBarProps,
|
|
627
|
+
ImageSource,
|
|
628
|
+
PlatformOS,
|
|
629
|
+
PlatformSelectOptions,
|
|
630
|
+
} from 'deskforge'
|
|
631
|
+
|
|
632
|
+
import type {
|
|
633
|
+
ComputedRef,
|
|
634
|
+
WatchHandle,
|
|
635
|
+
EffectHandle,
|
|
636
|
+
RefObject,
|
|
637
|
+
} from 'deskforge/state'
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
---
|
|
641
|
+
|
|
642
|
+
## Type Safety
|
|
643
|
+
|
|
644
|
+
All components are fully typed for maximum type safety:
|
|
645
|
+
|
|
646
|
+
```typescript
|
|
647
|
+
// ✅ Type-safe
|
|
648
|
+
const styles = StyleSheet.create({
|
|
649
|
+
container: { flex: 1, backgroundColor: '#fff' }
|
|
650
|
+
})
|
|
651
|
+
|
|
652
|
+
View(styles.container, [
|
|
653
|
+
Text('Hello', { fontSize: 16, color: 'red' })
|
|
654
|
+
])
|
|
655
|
+
|
|
656
|
+
// ❌ Type error
|
|
657
|
+
View({ foo: 'bar' }) // Invalid style property
|
|
658
|
+
Text('Hello', { invalid: true }) // Invalid style
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
---
|
|
662
|
+
|
|
663
|
+
## Summary
|
|
664
|
+
|
|
665
|
+
- ✅ All types fully typed
|
|
666
|
+
- ✅ Generics for flexibility
|
|
667
|
+
- ✅ Unions for clarity
|
|
668
|
+
- ✅ Interfaces for structure
|
|
669
|
+
- ✅ No `any` types
|
|
670
|
+
- ✅ Full IntelliSense support
|
|
671
|
+
- ✅ Compile-time safety
|