react-native-live-widgets 1.1.1 → 1.2.0

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 (46) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +73 -9
  3. package/android/src/main/java/com/reactnativeliveactivity/bridge/LiveActivityModule.kt +5 -1
  4. package/android/src/main/java/com/reactnativeliveactivity/storage/DynamicWidgetStateStore.kt +5 -1
  5. package/docs/GUIDE-EN.md +91 -7
  6. package/docs/GUIDE-VI.md +91 -7
  7. package/docs/index.html +37 -2
  8. package/docs/llms-full.txt +20 -6
  9. package/docs/llms.txt +29 -7
  10. package/ios/Models/DynamicLayoutModels.swift +5 -0
  11. package/ios/Widgets/DynamicHomeScreenWidget.swift +2 -3
  12. package/lib/builder.d.ts.map +1 -1
  13. package/lib/builder.js +29 -19
  14. package/lib/builder.js.map +1 -1
  15. package/lib/dispatcher.d.ts +7 -0
  16. package/lib/dispatcher.d.ts.map +1 -1
  17. package/lib/dispatcher.js +11 -0
  18. package/lib/dispatcher.js.map +1 -1
  19. package/lib/hooks.d.ts +66 -0
  20. package/lib/hooks.d.ts.map +1 -0
  21. package/lib/hooks.js +166 -0
  22. package/lib/hooks.js.map +1 -0
  23. package/lib/index.d.ts +32 -7
  24. package/lib/index.d.ts.map +1 -1
  25. package/lib/index.js +115 -8
  26. package/lib/index.js.map +1 -1
  27. package/lib/jsx.d.ts +79 -0
  28. package/lib/jsx.d.ts.map +1 -0
  29. package/lib/jsx.js +196 -0
  30. package/lib/jsx.js.map +1 -0
  31. package/lib/preview.d.ts +54 -0
  32. package/lib/preview.d.ts.map +1 -0
  33. package/lib/preview.js +466 -0
  34. package/lib/preview.js.map +1 -0
  35. package/lib/types.d.ts +8 -0
  36. package/lib/types.d.ts.map +1 -1
  37. package/package.json +2 -1
  38. package/src/builder.ts +29 -19
  39. package/src/dispatcher.ts +17 -0
  40. package/src/hooks.ts +223 -0
  41. package/src/index.ts +137 -13
  42. package/src/jsx.tsx +296 -0
  43. package/src/preview.tsx +719 -0
  44. package/src/react-ambient.d.ts +10 -0
  45. package/src/react-native-env.d.ts +43 -0
  46. package/src/types.ts +8 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to `react-native-live-widgets` will be documented in this file.
4
4
 
5
+ ## [1.2.0] - 2026-11-16
6
+ ### Added
7
+ - **JSX / TSX Declarative DSL**: Support building Widgets and Live Activities directly using intuitive React JSX syntax (`<VStack>`, `<HStack>`, `<ZStack>`, `<Grid>`, `<Text>`, `<Button>`, `<Badge>`, `<Progress>`, `<Timer>`, `<Image>`, `<Spacer>`, `<Divider>`) instead of nested function calls `UI.VStack(...)`.
8
+ - **In-App Widget Preview (`<WidgetPreview>` / `<VoltraWidgetPreview>`)**: Live component to render, preview, and test widget layouts and interactive button clicks directly inside your React Native screens with accurate device sizes (`small`, `medium`, `large`, `lockScreen`).
9
+ - **Seamless JSX Auto-Conversion**: `Widget.setLayout(...)` and `LiveActivity.start(...)` now accept JSX elements directly and convert them automatically into native `LayoutNode` JSON trees.
10
+
11
+ ## [1.1.2] - 2026-11-16
12
+ ### Added
13
+ - **React Hooks (Fast Refresh Resilient)**: Added `useWidgetAction`, `useLiveActivity`, and `useWidgetState` hooks with automatic lifecycle cleanup and Hot Reload resilience.
14
+ - **API Overload & Aliases**: Added `Widget.onWidgetAction`, `LiveActivity.registerActionHandler`, `Widget.update`, `cornerRadius` alias for `borderRadius`, and normalized `intervalMinutes` <-> `refreshIntervalMinutes` across TypeScript, Android (Kotlin), and iOS (Swift).
15
+
16
+ ### Documentation
17
+ - **Complete Documentation Synchronization**: Standardized function signatures, props, and code snippets across `README.md`, `GUIDE-VI.md`, `GUIDE-EN.md`, `docs/index.html`, `llms.txt`, and Agent Skill.
18
+
5
19
  ## [1.1.1] - 2026-11-16
6
20
  ### Fixed
7
21
  - **Android Widget Interaction Crash**: Added `android.permission.WAKE_LOCK` and safely wrapped `HeadlessJsTaskService` wake lock acquisition to prevent `SecurityException` on widget tap events.
package/README.md CHANGED
@@ -91,7 +91,8 @@ Until now, adding **Live Activities** or **Home Screen Widgets** to a React Nati
91
91
 
92
92
  `react-native-live-widgets` solves this with a **Declarative TypeScript UI DSL**:
93
93
  - 🚫 **No SwiftUI / Kotlin coding required** for custom screens.
94
- - 🎨 **100% Declarative UI in React Native (`UI.VStack`, `UI.HStack`, `UI.Text`, `UI.Button`, `UI.Progress`, `UI.Image`)**.
94
+ - 🎨 **Dual UI Syntax**: Choose between **React JSX/TSX (`<VStack>`, `<Text>`, `<Button>`)** or **Functional DSL (`UI.VStack(...)`)**.
95
+ - 📱 **In-App Widget Preview (`<WidgetPreview>`)**: Preview and test widget interactions directly on your app screen.
95
96
  - 🚀 **Full Expo & EAS Build Support** via automated Expo Config Plugin (`app.plugin.js`).
96
97
  - ⚡ **Interactive Buttons**: Tap buttons on the Home Screen Widget to run native Swift extensions or wake up TypeScript handlers.
97
98
  - 🔄 **Realtime Data Sync (`SharedStorage`)**: Single source of truth across Main App, Lock Screen, and Home Screen.
@@ -113,17 +114,32 @@ Until now, adding **Live Activities** or **Home Screen Widgets** to a React Nati
113
114
  - **Checklist & Toggles**: Toggle checkboxes and switch states without opening the app (`actionId: "toggle:<key>"`).
114
115
  - **Dark & Light Mode**: Declarative color tokens `{ light: '#FFF', dark: '#0F172A' }`.
115
116
 
116
- ### 3. ⚡ Bi-directional Action Dispatcher (TypeScript + Native)
117
- - Tap a widget button outside on the Home Screen to trigger a registered TypeScript function:
117
+ ### 3. ⚡ React Hooks & Fast Refresh Resilient
118
+ - **`useWidgetAction(actionId, callback)`**: Automatically registers and cleans up widget button tap listeners on unmount. 100% resilient to React Native Fast Refresh / Hot Reloading!
119
+ ```tsx
120
+ useWidgetAction('action_checkin', async (payload) => {
121
+ console.log('Action triggered from Home Screen Widget:', payload);
122
+ });
123
+ ```
124
+ - **`useLiveActivity()`**: Track activity state, push tokens, and control start / update / end directly in React components.
125
+ - **`useWidgetState(key, initialValue)`**: Synchronize local component state with Widget Shared Storage and trigger instant OS re-renders.
126
+
127
+ ### 4. ⚡ Bi-directional Action Dispatcher (TypeScript + Native)
128
+ - Imperative action registration for background services:
118
129
  ```ts
119
130
  LiveActivity.registerAction('action_checkin', async (payload) => {
120
- // Runs inside React Native JS engine!
121
- console.log('Action triggered from Home Screen Widget:', payload);
131
+ console.log('Action triggered:', payload);
132
+ });
133
+ // Or listen globally to all widget actions:
134
+ Widget.onWidgetAction((actionId, payload) => {
135
+ console.log(`Action ${actionId} received`, payload);
122
136
  });
123
137
  ```
124
- - **App-Killed Protection**: Native fallback ensures UI responds instantly and persists data even if the main app is terminated.
138
+ - **App-Killed Background Support**:
139
+ - **Android**: Supports `LiveActivity.registerBackgroundActionHandler()` via Headless JS tasks and instant native state persistence in `DynamicWidgetStateStore`.
140
+ - **iOS**: Apple sandboxes widget extensions when the main app is force-killed. Button taps update native App Group state directly; JavaScript callbacks resume automatically when the app is reopened.
125
141
 
126
- ### 4. 🌐 Background Remote API Sync (Zero Code Backend)
142
+ ### 5. 🌐 Background Remote API Sync (Zero Code Backend)
127
143
  - Configure an API endpoint with `Widget.setRemoteConfig`:
128
144
  ```ts
129
145
  await Widget.setRemoteConfig('main', {
@@ -251,7 +267,7 @@ await LiveActivity.start({
251
267
  )
252
268
  },
253
269
  lockScreen: UI.VStack(
254
- { padding: 16, backgroundColor: '#0F172A', cornerRadius: 16 },
270
+ { padding: 16, backgroundColor: '#0F172A', borderRadius: 16 },
255
271
  UI.HStack(
256
272
  { justifyContent: 'spaceBetween' },
257
273
  UI.Text('KPI Quý 4: Đạt 86% mục tiêu', { fontSize: 14, fontWeight: 'bold', color: '#FFFFFF' }),
@@ -282,7 +298,7 @@ await SharedStorage.set('revenue_month', '4.85 Tỷ đ', APP_GROUP);
282
298
  // Build Declarative Layout
283
299
  await Widget.setLayout('main', {
284
300
  large: UI.VStack(
285
- { padding: 16, backgroundColor: '#0B132B', cornerRadius: 20 },
301
+ { padding: 16, backgroundColor: '#0B132B', borderRadius: 20 },
286
302
  UI.HStack(
287
303
  { justifyContent: 'spaceBetween' },
288
304
  UI.Text('TỔNG QUAN ĐIỀU HÀNH (KPI & BIỂU ĐỒ)', { fontSize: 11, color: '#38BDF8', fontWeight: 'bold' }),
@@ -309,6 +325,54 @@ await Widget.setLayout('main', {
309
325
  await Widget.reloadAll();
310
326
  ```
311
327
 
328
+ ### 3. Build Widgets with React JSX / TSX Syntax
329
+
330
+ Prefer JSX over nested functions? Build layouts using clean, declarative JSX with full `style` prop & array flattening support:
331
+
332
+ ```tsx
333
+ import { Widget, VStack, HStack, Text, Badge, Progress, Button } from 'react-native-live-widgets';
334
+
335
+ await Widget.setLayout('main', {
336
+ medium: (
337
+ <VStack padding={16} backgroundColor="#0F172A" borderRadius={16}>
338
+ <HStack justifyContent="spaceBetween">
339
+ <Text fontSize={14} fontWeight="bold" color="#FFFFFF">Vào ca sáng</Text>
340
+ <Badge text="07:54 (Hợp lệ)" backgroundColor="#064E3B" textColor="#6EE7B7" />
341
+ </HStack>
342
+ <Progress value={0.75} style="segmented" segments={4} tintColor="#38BDF8" height={8} />
343
+ <Button title="Làm mới dữ liệu" actionId="refresh" fullWidth />
344
+ </VStack>
345
+ )
346
+ });
347
+ ```
348
+
349
+ ### 4. In-App Live Widget Preview (`<WidgetPreview>` / `<VoltraWidgetPreview>`)
350
+
351
+ Test and preview widgets directly inside your app screens with pixel-accurate OS container frames and real-time button clicks:
352
+
353
+ ```tsx
354
+ import { WidgetPreview, VStack, HStack, Text, Button } from 'react-native-live-widgets';
355
+
356
+ export function WidgetDemoScreen() {
357
+ return (
358
+ <WidgetPreview
359
+ size="medium" // 'small' | 'medium' | 'large' | 'lockScreen'
360
+ showBadge={true}
361
+ interactiveSizeSwitch={true} // Quick tabs to test small / medium / large
362
+ onAction={(actionId) => console.log('Tapped action:', actionId)}
363
+ >
364
+ <VStack padding={16} backgroundColor="#0F172A" borderRadius={20}>
365
+ <HStack justifyContent="spaceBetween">
366
+ <Text fontSize={14} fontWeight="bold" color="#FFFFFF">KPI Tuần</Text>
367
+ <Text fontSize={12} color="#38BDF8">86%</Text>
368
+ </HStack>
369
+ <Button title="Check-in ngay" actionId="checkin" fullWidth />
370
+ </VStack>
371
+ </WidgetPreview>
372
+ );
373
+ }
374
+ ```
375
+
312
376
  ---
313
377
 
314
378
  ## 📊 Platform Feature Parity Matrix
@@ -289,7 +289,11 @@ class LiveActivityModule(private val reactContext: ReactApplicationContext) :
289
289
  val wKey = key.removePrefix("widget_remote_config_")
290
290
  runCatching {
291
291
  val cfg = JSONObject(value)
292
- val mins = cfg.optInt("refreshIntervalMinutes", 15).coerceAtLeast(1)
292
+ val mins = if (cfg.has("refreshIntervalMinutes")) {
293
+ cfg.optInt("refreshIntervalMinutes", 15)
294
+ } else {
295
+ cfg.optInt("intervalMinutes", 15)
296
+ }.coerceAtLeast(1)
293
297
  DynamicWidgetStateStore.scheduleBackgroundWidgetSync(reactContext, wKey, mins)
294
298
  }
295
299
  }
@@ -262,7 +262,11 @@ object DynamicWidgetStateStore {
262
262
  }
263
263
  saveState(context, state)
264
264
 
265
- val intervalMins = config.optInt("refreshIntervalMinutes", 15).coerceAtLeast(1)
265
+ val intervalMins = if (config.has("refreshIntervalMinutes")) {
266
+ config.optInt("refreshIntervalMinutes", 15)
267
+ } else {
268
+ config.optInt("intervalMinutes", 15)
269
+ }.coerceAtLeast(1)
266
270
  scheduleBackgroundWidgetSync(context, widgetKey, intervalMins)
267
271
  } catch (_: Exception) {
268
272
  stampSyncTimeOnly(context)
package/docs/GUIDE-EN.md CHANGED
@@ -68,7 +68,7 @@ git clone https://github.com/React-Native-Vu/LiveWidgetsExampleExpo.git
68
68
  cd LiveWidgetsExampleExpo
69
69
  npm install
70
70
  npx expo prebuild
71
- npm run setup:widgets
71
+ npx react-native-live-widgets init
72
72
  npx expo run:ios # or npx expo run:android
73
73
  ```
74
74
 
@@ -237,7 +237,7 @@ async function ensureAndroidNotificationPermission() {
237
237
  ```
238
238
 
239
239
  #### 5. Step 4: Adding & Resizing Home Screen Widgets on Android (`small` / `medium` / `large`)
240
- 1. After calling `Widget.update('main', { small, medium, large })` in your app, go to the Android Home Screen.
240
+ 1. After calling `Widget.setLayout('main', { small, medium, large })` (or alias `Widget.update(...)`) in your app, go to the Android Home Screen.
241
241
  2. **Long-press an empty area** on the Home Screen -> Tap **Widgets** -> Find your app -> Drag **Live Widgets** onto the Home Screen.
242
242
  3. **Responsive Family Switching (`small` / `medium` / `large`):** Long-press the placed widget and release to show the resize handles:
243
243
  - Resize to **2×2 cells** (`width < 210dp`): Automatically renders the **`small`** layout (1:1 square aspect ratio).
@@ -313,9 +313,86 @@ import { LiveActivity, Widget, SharedStorage, UI } from 'react-native-live-widge
313
313
 
314
314
  ---
315
315
 
316
- ## 4. Declarative UI Engine (`UI.*`)
316
+ ## 4. Declarative UI Engine
317
317
 
318
- ### `UI.StyleSheet` & Reusable Styling (`StyleProp`)
318
+ The library supports **2 dual UI authoring styles** side-by-side depending on your preferences:
319
+ 1. **Style 1: React JSX / TSX Components (`<VStack>`, `<Text>`, `<Button>`)** — Write widgets exactly like building standard React Native components. Fully supports the standard `style` prop, conditional style arrays, and nested hierarchies.
320
+ 2. **Style 2: Functional DSL (`UI.VStack(...)`)** — Concise and functional, with zero JSX tags to import.
321
+
322
+ Both styles compile down automatically to the exact same native engine (SwiftUI on iOS and 2D Canvas on Android).
323
+
324
+ ---
325
+
326
+ ### Style 1: Building Widgets with JSX / TSX Components
327
+
328
+ ```tsx
329
+ import React from 'react';
330
+ import { StyleSheet } from 'react-native';
331
+ import { Widget, VStack, HStack, Text, Badge, Progress, Button } from 'react-native-live-widgets';
332
+
333
+ export const MyWidgetLayout = (
334
+ <VStack style={styles.card}>
335
+ <HStack style={styles.header}>
336
+ <Text style={styles.title}>Shift Check-in</Text>
337
+ <Badge text="07:54 (Valid)" backgroundColor="#064E3B" textColor="#6EE7B7" />
338
+ </HStack>
339
+ <Progress value={0.75} style="segmented" segments={4} tintColor="#38BDF8" height={8} />
340
+ <Button title="Refresh Data" actionId="refresh" fullWidth />
341
+ </VStack>
342
+ );
343
+
344
+ const styles = StyleSheet.create({
345
+ card: {
346
+ padding: 16,
347
+ backgroundColor: '#0F172A',
348
+ borderRadius: 16,
349
+ },
350
+ header: {
351
+ justifyContent: 'space-between',
352
+ marginBottom: 8,
353
+ },
354
+ title: {
355
+ fontSize: 14,
356
+ fontWeight: 'bold',
357
+ color: '#FFFFFF',
358
+ },
359
+ });
360
+ ```
361
+
362
+ ---
363
+
364
+ ### In-App Widget Preview (`<WidgetPreview>` / `<VoltraWidgetPreview>`)
365
+
366
+ Embed a realistic, pixel-accurate widget mockup inside any app screen to test layout bounds and button click interactions without leaving your application:
367
+
368
+ ```tsx
369
+ import { WidgetPreview, VStack, HStack, Text, Button } from 'react-native-live-widgets';
370
+
371
+ export function PreviewScreen() {
372
+ return (
373
+ <WidgetPreview
374
+ size="medium" // 'small' | 'medium' | 'large' | 'lockScreen'
375
+ showBadge={true} // Shows 'Medium • 338×158'
376
+ interactiveSizeSwitch={true} // Quick tabs to switch small / medium / large
377
+ onAction={(actionId) => {
378
+ console.log('Action tapped inside preview:', actionId);
379
+ }}
380
+ >
381
+ <VStack padding={16} backgroundColor="#0F172A" borderRadius={20}>
382
+ <HStack justifyContent="spaceBetween">
383
+ <Text fontSize={14} fontWeight="bold" color="#FFFFFF">Project Progress</Text>
384
+ <Text fontSize={12} color="#38BDF8">75%</Text>
385
+ </HStack>
386
+ <Button title="Update" actionId="refresh" fullWidth />
387
+ </VStack>
388
+ </WidgetPreview>
389
+ );
390
+ }
391
+ ```
392
+
393
+ ---
394
+
395
+ ### Style 2: Functional DSL (`UI.StyleSheet` & Reusable Styling)
319
396
  Just like React Native's `StyleSheet.create`, you can define reusable styles to keep your widget layouts modular and clean, supporting conditional style arrays:
320
397
 
321
398
  ```typescript
@@ -746,14 +823,21 @@ if (isSupported) {
746
823
  When the user swipes away (force-kills) the main app, the React Native JS thread stops. To keep your Widget updated with live server data autonomously:
747
824
 
748
825
  ```typescript
749
- await Widget.setRemoteConfig({
826
+ // Full standard signature:
827
+ await Widget.setRemoteConfig('main', {
750
828
  url: 'https://api.yourcompany.com/v1/widget-summary',
751
829
  method: 'GET',
752
830
  headers: {
753
831
  Authorization: `Bearer ${accessToken}`,
754
832
  },
755
- intervalMinutes: 15, // OS-scheduled background sync every 15 minutes
756
- });
833
+ refreshIntervalMinutes: 15, // OS-scheduled background sync (alias: intervalMinutes)
834
+ }, APP_GROUP);
835
+
836
+ // Or convenient shorthand (defaults to widgetKey = 'main'):
837
+ await Widget.setRemoteConfig({
838
+ url: 'https://api.yourcompany.com/v1/widget-summary',
839
+ refreshIntervalMinutes: 15,
840
+ }, APP_GROUP);
757
841
  ```
758
842
 
759
843
  - **How it works:**
package/docs/GUIDE-VI.md CHANGED
@@ -68,7 +68,7 @@ git clone https://github.com/React-Native-Vu/LiveWidgetsExampleExpo.git
68
68
  cd LiveWidgetsExampleExpo
69
69
  npm install
70
70
  npx expo prebuild
71
- npm run setup:widgets
71
+ npx react-native-live-widgets init
72
72
  npx expo run:ios # hoặc npx expo run:android
73
73
  ```
74
74
 
@@ -237,7 +237,7 @@ async function ensureAndroidNotificationPermission() {
237
237
  ```
238
238
 
239
239
  #### 5. Bước 4: Cách thêm và kéo giãn Home Screen Widget trên Android (`small` / `medium` / `large`)
240
- 1. Sau khi gọi `Widget.update('main', { small, medium, large })` trong app, ra màn hình chính (Home Screen) của Android.
240
+ 1. Sau khi gọi `Widget.setLayout('main', { small, medium, large })` (hoặc alias `Widget.update(...)`) trong app, ra màn hình chính (Home Screen) của Android.
241
241
  2. **Nhấn giữ vào khoảng trống** trên màn hình chính -> Chọn **Widgets (Tiện ích)** -> Tìm ứng dụng của bạn -> Kéo **Live Widgets** ra màn hình.
242
242
  3. **Thay đổi kích thước tự động (Responsive Sizing):** Nhấn giữ vào Widget trên màn hình chính rồi thả tay ra để xuất hiện khung viền 4 chấm tròn:
243
243
  - Kéo thu nhỏ về **2×2 ô** (`chiều rộng < 210dp`): Tự động hiển thị giao diện **`small`** (tỷ lệ vuông 1:1).
@@ -315,7 +315,84 @@ import { LiveActivity, Widget, SharedStorage, UI } from 'react-native-live-widge
315
315
 
316
316
  ## 4. Xây dựng Giao diện Động (Declarative UI Engine)
317
317
 
318
- ### `UI.StyleSheet` & Tái sử dụng Style (`StyleProp`)
318
+ Thư viện hỗ trợ song song **2 phong cách viết giao diện** tùy theo sở thích và thói quen của bạn:
319
+ 1. **Phong cách 1: Dạng JSX / TSX (`<VStack>`, `<Text>`, `<Button>`)** — Giống hệt như viết Component trong React Native, trực quan và dễ bảo trì khi layout lồng ghép nhiều tầng. Hỗ trợ đầy đủ thuộc tính `style` và mảng style có điều kiện.
320
+ 2. **Phong cách 2: Dạng Hàm lồng nhau (`UI.VStack(...)`)** — Phong cách Functional gọn gàng, không cần import nhiều thẻ JSX.
321
+
322
+ Cả 2 cách đều được biên dịch tự động sang cùng một kiến trúc Native (SwiftUI trên iOS và 2D Canvas trên Android).
323
+
324
+ ---
325
+
326
+ ### Phong cách 1: Xây dựng bằng JSX / TSX Component
327
+
328
+ ```tsx
329
+ import React from 'react';
330
+ import { StyleSheet } from 'react-native';
331
+ import { Widget, VStack, HStack, Text, Badge, Progress, Button } from 'react-native-live-widgets';
332
+
333
+ export const MyWidgetLayout = (
334
+ <VStack style={styles.card}>
335
+ <HStack style={styles.header}>
336
+ <Text style={styles.title}>Vào ca sáng</Text>
337
+ <Badge text="07:54 (Hợp lệ)" backgroundColor="#064E3B" textColor="#6EE7B7" />
338
+ </HStack>
339
+ <Progress value={0.75} style="segmented" segments={4} tintColor="#38BDF8" height={8} />
340
+ <Button title="Làm mới dữ liệu" actionId="refresh" fullWidth />
341
+ </VStack>
342
+ );
343
+
344
+ const styles = StyleSheet.create({
345
+ card: {
346
+ padding: 16,
347
+ backgroundColor: '#0F172A',
348
+ borderRadius: 16,
349
+ },
350
+ header: {
351
+ justifyContent: 'space-between',
352
+ marginBottom: 8,
353
+ },
354
+ title: {
355
+ fontSize: 14,
356
+ fontWeight: 'bold',
357
+ color: '#FFFFFF',
358
+ },
359
+ });
360
+ ```
361
+
362
+ ---
363
+
364
+ ### Xem Trước Widget Trong App (`<WidgetPreview>` / `<VoltraWidgetPreview>`)
365
+
366
+ Bạn có thể nhúng widget vào trực tiếp bất kỳ màn hình nào của ứng dụng để xem trước giao diện và bấm thử các nút tương tác mà không cần phải thoát ra Home Screen:
367
+
368
+ ```tsx
369
+ import { WidgetPreview, VStack, HStack, Text, Button } from 'react-native-live-widgets';
370
+
371
+ export function PreviewScreen() {
372
+ return (
373
+ <WidgetPreview
374
+ size="medium" // 'small' | 'medium' | 'large' | 'lockScreen'
375
+ showBadge={true} // Hiển thị 'Medium • 338×158'
376
+ interactiveSizeSwitch={true} // Bật thanh tab để chuyển nhanh small/medium/large
377
+ onAction={(actionId) => {
378
+ console.log('Action được bấm trên widget:', actionId);
379
+ }}
380
+ >
381
+ <VStack padding={16} backgroundColor="#0F172A" borderRadius={20}>
382
+ <HStack justifyContent="spaceBetween">
383
+ <Text fontSize={14} fontWeight="bold" color="#FFFFFF">Tiến độ công việc</Text>
384
+ <Text fontSize={12} color="#38BDF8">75%</Text>
385
+ </HStack>
386
+ <Button title="Cập nhật" actionId="refresh" fullWidth />
387
+ </VStack>
388
+ </WidgetPreview>
389
+ );
390
+ }
391
+ ```
392
+
393
+ ---
394
+
395
+ ### Phong cách 2: Dạng Hàm (`UI.StyleSheet` & Functional DSL)
319
396
  Tương tự như `StyleSheet.create` trong React Native, bạn có thể gom nhóm các style định dạng lại để tái sử dụng nhiều nơi, giữ code sạch sẽ và hỗ trợ truyền mảng style có điều kiện:
320
397
 
321
398
  ```typescript
@@ -744,17 +821,24 @@ if (isSupported) {
744
821
 
745
822
  ## 7. Đồng bộ API Ngầm cho Widget kể cả khi Kill App (`Widget.setRemoteConfig`)
746
823
 
747
- Khi ứng dụng bị người dùng vuốt tắt hoàn toàn (Kill App), JavaScript thread của React Native sẽ dừng. Để Widget vẫn luôn có dữ liệu mới từ Server:
824
+ Khi ứng dụng bị người dùng vuốt tắt hoàn toàn (Kill App), JavaScript thread của React Native sẽ dừng. Để Widget vẫn luôn tự động gọi API lấy dữ liệu mới từ Server:
748
825
 
749
826
  ```typescript
750
- await Widget.setRemoteConfig({
827
+ // Cú pháp tiêu chuẩn đầy đủ:
828
+ await Widget.setRemoteConfig('main', {
751
829
  url: 'https://api.yourcompany.com/v1/widget-summary',
752
830
  method: 'GET',
753
831
  headers: {
754
832
  Authorization: `Bearer ${accessToken}`,
755
833
  },
756
- intervalMinutes: 15, // Tự động đồng bộ mỗi 15 phút ở tầng OS (WidgetKit Timeline / Android AlarmManager)
757
- });
834
+ refreshIntervalMinutes: 15, // Chu kỳ gọi ngầm ở tầng OS (alias: intervalMinutes)
835
+ }, APP_GROUP);
836
+
837
+ // Hoặc cú pháp ngắn gọn (mặc định widgetKey = 'main'):
838
+ await Widget.setRemoteConfig({
839
+ url: 'https://api.yourcompany.com/v1/widget-summary',
840
+ refreshIntervalMinutes: 15,
841
+ }, APP_GROUP);
758
842
  ```
759
843
 
760
844
  - **Cách hoạt động:**
package/docs/index.html CHANGED
@@ -316,11 +316,46 @@ Widget.reload('main', {
316
316
  })
317
317
  });
318
318
 
319
- // Lắng nghe khi người dùng bấm nút trên mặt Widget
320
- LiveActivity.registerActionHandler((actionId) => {
319
+ // Cách 1: Dùng React Hook (Khuyến nghị - An toàn tuyệt đối với Fast Refresh)
320
+ useWidgetAction('INCREMENT', () => {
321
+ setCounter(c => c + 1);
322
+ });
323
+
324
+ // Cách 2: Lắng nghe toàn cục Imperative
325
+ Widget.onWidgetAction((actionId) => {
321
326
  if (actionId === 'INCREMENT') {
322
327
  setCounter(c => c + 1);
323
328
  }
329
+ });</code></pre>
330
+ </div>
331
+
332
+ <!-- Card: JSX Syntax & In-App Widget Preview -->
333
+ <div class="bg-cardBg border border-cardBorder rounded-xl p-4 space-y-3">
334
+ <div class="flex items-center justify-between">
335
+ <span class="text-sm font-semibold text-white">✨ Cú pháp JSX / TSX & Xem Trước Widget Trong App (&lt;WidgetPreview&gt;)</span>
336
+ <span class="text-xs text-sky-400 bg-sky-500/10 px-2 py-0.5 rounded">v1.2.0 JSX</span>
337
+ </div>
338
+ <pre><code class="language-typescript">import { WidgetPreview, VStack, HStack, Text, Badge, Button } from 'react-native-live-widgets';
339
+
340
+ // 1. Nhúng khung xem trước trực tiếp trên màn hình App (hỗ trợ small, medium, large)
341
+ &lt;WidgetPreview size="medium" showBadge interactiveSizeSwitch onAction={(id) => alert(id)}&gt;
342
+ &lt;VStack padding={16} backgroundColor="#0F172A" borderRadius={16}&gt;
343
+ &lt;HStack justifyContent="spaceBetween"&gt;
344
+ &lt;Text fontSize={14} fontWeight="bold" color="#FFFFFF"&gt;Ca làm sáng&lt;/Text&gt;
345
+ &lt;Badge text="07:54 (Hợp lệ)" backgroundColor="#064E3B" textColor="#6EE7B7" /&gt;
346
+ &lt;/HStack&gt;
347
+ &lt;Button title="Làm mới dữ liệu" actionId="refresh" fullWidth /&gt;
348
+ &lt;/VStack&gt;
349
+ &lt;/WidgetPreview&gt;
350
+
351
+ // 2. Cập nhật Widget ra Home Screen bằng JSX trực tiếp:
352
+ await Widget.setLayout('main', {
353
+ medium: (
354
+ &lt;VStack padding={16} backgroundColor="#0F172A" borderRadius={16}&gt;
355
+ &lt;Text fontSize={14} color="#FFF"&gt;Xin chào Trần Tuấn Vũ&lt;/Text&gt;
356
+ &lt;Button title="Check-in" actionId="checkin" /&gt;
357
+ &lt;/VStack&gt;
358
+ )
324
359
  });</code></pre>
325
360
  </div>
326
361
  </div>
@@ -67,14 +67,28 @@ export interface WidgetRemoteConfig {
67
67
  - `LiveActivity.start(options: StartActivityOptions): Promise<string>`: Starts an activity, returns `activityId`.
68
68
  - `LiveActivity.update(options: { activityId?: string; layout?: WidgetNode; dynamicIsland?: ... }): Promise<void>`
69
69
  - `LiveActivity.end(options: { activityId?: string; dismissalPolicy?: 'immediate'|'default' }): Promise<void>`
70
- - `LiveActivity.endAll(): Promise<void>`
71
- - `LiveActivity.getAllPushTokens(): Promise<{ devicePushToken: string; pushToStartToken: string; activityUpdateToken: string }>`
70
+ - `LiveActivity.endAll(): Promise<boolean>`
71
+ - `LiveActivity.getAllPushTokens(activityId?: string): Promise<LiveActivityPushTokens>`
72
+ - `LiveActivity.registerAction(actionId: string, handler: ActionHandler): () => void`
72
73
  - `LiveActivity.registerActionHandler(handler: (actionId: string, payload?: any) => void): () => void`
73
- - `Widget.setLayout(widgetKey: string, config: WidgetLayoutConfig, appGroup?: string): Promise<void>`
74
- - `Widget.reload(widgetKey?: string): Promise<void>`
75
- - `Widget.reloadAll(): Promise<void>`
76
- - `Widget.setRemoteConfig(config: WidgetRemoteConfig, widgetKey?: string, appGroup?: string): Promise<void>`
74
+ - `Widget.setLayout(widgetKey: string, config: WidgetLayoutConfig, appGroup?: string): Promise<boolean>` (alias: `Widget.update`)
75
+ - `Widget.reload(widgetKey?: string): Promise<boolean>`
76
+ - `Widget.reloadAll(): Promise<boolean>`
77
+ - `Widget.setRemoteConfig(widgetKey: string, config: WidgetRemoteConfig, appGroup?: string): Promise<boolean>` (supports shorthand `Widget.setRemoteConfig(config, appGroup?)`)
78
+ - `Widget.onWidgetAction(handler: (actionId: string, payload?: any) => void): () => void`
77
79
  - `Widget.requestPin(): Promise<boolean>`: Android only.
80
+
81
+ ### React Hooks (Fast Refresh Resilient)
82
+ - `useWidgetAction(actionIdOrCallback: string | ((actionId: string, payload?: any) => void), handler?: ActionHandler): void`
83
+ - `useLiveActivity(initialActivityId?: string): UseLiveActivityResult`
84
+ - `useWidgetState<T>(key: string, initialValue: T, appGroup?: string): [T, (val: T | ((prev: T) => T)) => Promise<void>, () => Promise<void>]`
85
+
86
+ ### In-App Widget Preview Component
87
+ - `<WidgetPreview size="small"|"medium"|"large"|"lockScreen" layout={node} showBadge interactiveSizeSwitch onAction={(actionId) => ...} />` (alias: `<VoltraWidgetPreview>`)
88
+
89
+ ### Dual UI Authoring Syntax
90
+ - **JSX Components**: `<VStack>`, `<HStack>`, `<ZStack>`, `<Grid>`, `<Text>`, `<Button>`, `<Badge>`, `<Progress>`, `<Timer>`, `<Image>`, `<Spacer>`, `<Divider>`, `<Link>`, `<Equalizer>`, `<Gauge>`, `<Chart>`. Fully supports `style` props, StyleSheet objects, and conditional style arrays!
91
+ - **Functional DSL**: `UI.VStack(...)`, `UI.HStack(...)`, `UI.Text(...)`, `UI.Button(...)`, etc.
78
92
  - `SharedStorage.setAppGroup(appGroup: string): void`
79
93
  - `SharedStorage.set(key: string, value: string, appGroup?: string): Promise<void>`
80
94
  - `SharedStorage.get(key: string, appGroup?: string): Promise<string | null>`
package/docs/llms.txt CHANGED
@@ -26,25 +26,47 @@ Write 100% Declarative TypeScript (`UI.*`) in your React Native code. Automatica
26
26
  npx react-native-live-widgets init --group group.com.yourcompany.app
27
27
  ```
28
28
 
29
+ ### Dual UI Authoring Syntax: JSX Components & Functional DSL
30
+ Widgets can be built with **EITHER** JSX elements or Functional DSL:
31
+ - **JSX / TSX Elements**: `<VStack>`, `<HStack>`, `<ZStack>`, `<Grid>`, `<Text>`, `<Button>`, `<Badge>`, `<Progress>`, `<Timer>`, `<Equalizer>`, `<Image>`, `<Spacer>`, `<Divider>`, `<Link>`. Fully supports `style` props, StyleSheet objects, and conditional style arrays!
32
+ - **Functional DSL**: `UI.VStack(...)`, `UI.HStack(...)`, `UI.Text(...)`, `UI.Button(...)`, etc.
33
+ - **In-App Widget Preview**: `<WidgetPreview size="medium" showBadge interactiveSizeSwitch>{jsxLayout}</WidgetPreview>` (alias: `<VoltraWidgetPreview>`).
34
+
29
35
  ### Key Declarative UI DSL Methods
30
36
  - `UI.VStack(options, ...children)` / `UI.HStack(options, ...children)`: Flex containers with `spacing`, `padding`, `backgroundColor`, `borderRadius`, `alignment`.
31
37
  - `UI.Text(content, { color, fontSize, fontWeight: 'bold'|'heavy'|'medium'|'regular', maxLines })`
32
38
  - `UI.Timer(timestampMs, { mode: 'countdown'|'timer'|'relative', color, fontSize })`: Zero-battery native hardware clock.
33
39
  - `UI.Progress(options)`: Supports `style: 'bar' | 'segmented' | 'circular'`, `value` (0.0 to 1.0), `tintColor`, `trackColor`.
34
40
  - `UI.Equalizer({ isPlaying: true, barCount: 4, tintColor, height })`: Realtime animated audio waveform on Dynamic Island & lock screen.
35
- - `UI.Image({ url, base64, systemName, width, height, cornerRadius, contentMode })`: Auto-cached remote images, base64 data, or SF Symbols.
36
- - `UI.Button({ title, actionId, backgroundColor, color, fontSize })`: Interactive widget button triggering `AppIntents` (iOS 17+) and `BroadcastReceiver` (Android).
41
+ - `UI.Image({ url, base64, systemName, width, height, borderRadius, contentMode })`: Auto-cached remote images, base64 data, or SF Symbols (supports `cornerRadius` as alias).
42
+ - `UI.Button('Title', { actionId, ... })` or `UI.Button({ title, actionId, ... })`: Interactive widget button triggering `AppIntents` (iOS 17+) and `BroadcastReceiver` (Android).
43
+ - `UI.Badge('Text', { ... })` or `UI.Badge({ text, ... })`: Metric badges.
37
44
  - `UI.Gauge(value, { size, tintColor, trackColor, label, valueText })`: 240° KPI circular gauge.
38
45
  - `UI.Chart(dataPoints, { style: 'bar'|'line', labels, tintColor, height })`: Lightweight trend sparklines.
39
46
 
40
- ### Bidirectional Two-Way Action Handling
47
+ ### React Hooks (Fast Refresh Resilient)
48
+ ```typescript
49
+ import { useWidgetAction, useLiveActivity, useWidgetState } from 'react-native-live-widgets';
50
+
51
+ // 1. Hook: Listen to widget button interactions (safe with Fast Refresh)
52
+ useWidgetAction('INCREMENT', () => {
53
+ setCount(c => c + 1);
54
+ });
55
+
56
+ // 2. Hook: Manage Live Activity lifecycle
57
+ const { activityId, isActive, start, update, end } = useLiveActivity();
58
+
59
+ // 3. Hook: Two-way state sync with Widget SharedStorage
60
+ const [counter, setCounter] = useWidgetState('widget_counter', 0);
61
+ ```
62
+
63
+ ### Imperative Action Handling
41
64
  ```typescript
42
- import { LiveActivity, Widget } from 'react-native-live-widgets';
65
+ import { Widget, LiveActivity } from 'react-native-live-widgets';
43
66
 
44
- // Listen to widget button interactions inside App.tsx
45
- const unsubscribe = LiveActivity.registerActionHandler((actionId, payload) => {
67
+ // Listen to widget button interactions imperatively
68
+ const unsubscribe = Widget.onWidgetAction((actionId, payload) => {
46
69
  if (actionId === 'INCREMENT') {
47
- // Update local state and trigger widget redraw
48
70
  Widget.reload('main');
49
71
  }
50
72
  });
@@ -119,6 +119,11 @@ public struct WidgetRemoteConfigDTO: Codable {
119
119
  public let method: String?
120
120
  public let headers: [String: String]?
121
121
  public let refreshIntervalMinutes: Int?
122
+ public let intervalMinutes: Int?
123
+
124
+ public var effectiveIntervalMinutes: Int {
125
+ return refreshIntervalMinutes ?? intervalMinutes ?? 15
126
+ }
122
127
  }
123
128
 
124
129
  public struct InteractiveWidgetState: Codable {
@@ -110,9 +110,8 @@ public struct DynamicWidgetProvider: TimelineProvider {
110
110
  let configKey = "widget_remote_config_\(widgetKey)"
111
111
  if let json = Self.readSharedString(forKey: configKey, appGroup: appGroup),
112
112
  let data = json.data(using: .utf8),
113
- let config = try? JSONDecoder().decode(WidgetRemoteConfigDTO.self, from: data),
114
- let mins = config.refreshIntervalMinutes, mins >= 1 {
115
- return mins
113
+ let config = try? JSONDecoder().decode(WidgetRemoteConfigDTO.self, from: data) {
114
+ return max(1, config.effectiveIntervalMinutes)
116
115
  }
117
116
  return 15
118
117
  }
@@ -1 +1 @@
1
- {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,UAAU,EACV,SAAS,EACT,cAAc,EACd,UAAU,EACV,WAAW,EACX,aAAa,EACb,cAAc,EACd,SAAS,EACT,QAAQ,EACR,SAAS,EACT,UAAU,EACV,SAAS,EACT,UAAU,EACV,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,UAAU,EACV,SAAS,EACT,QAAQ,EACR,SAAS,EACT,SAAS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