react-native-live-widgets 1.1.0 → 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.
- package/CHANGELOG.md +20 -0
- package/README.md +76 -10
- package/android/build.gradle +14 -20
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/com/reactnativeliveactivity/bridge/LiveActivityModule.kt +5 -1
- package/android/src/main/java/com/reactnativeliveactivity/liveactivity/LiveActivityHeadlessTaskService.kt +8 -0
- package/android/src/main/java/com/reactnativeliveactivity/liveactivity/LiveActivityReceiver.kt +4 -1
- package/android/src/main/java/com/reactnativeliveactivity/renderer/DynamicWidgetCanvasRenderer.kt +29 -3
- package/android/src/main/java/com/reactnativeliveactivity/storage/DynamicWidgetStateStore.kt +26 -1
- package/android/src/main/java/com/reactnativeliveactivity/widgets/DynamicHomeScreenWidgetProvider.kt +51 -15
- package/android/src/main/res/layout/rn_live_widget_host.xml +64 -74
- package/docs/GUIDE-EN.md +109 -7
- package/docs/GUIDE-VI.md +109 -7
- package/docs/index.html +440 -0
- package/docs/llms-full.txt +132 -0
- package/docs/llms.txt +88 -0
- package/ios/Models/DynamicLayoutModels.swift +5 -0
- package/ios/Widgets/DynamicHomeScreenWidget.swift +2 -3
- package/lib/builder.d.ts.map +1 -1
- package/lib/builder.js +29 -19
- package/lib/builder.js.map +1 -1
- package/lib/dispatcher.d.ts +7 -0
- package/lib/dispatcher.d.ts.map +1 -1
- package/lib/dispatcher.js +11 -0
- package/lib/dispatcher.js.map +1 -1
- package/lib/hooks.d.ts +66 -0
- package/lib/hooks.d.ts.map +1 -0
- package/lib/hooks.js +166 -0
- package/lib/hooks.js.map +1 -0
- package/lib/index.d.ts +32 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +115 -8
- package/lib/index.js.map +1 -1
- package/lib/jsx.d.ts +79 -0
- package/lib/jsx.d.ts.map +1 -0
- package/lib/jsx.js +196 -0
- package/lib/jsx.js.map +1 -0
- package/lib/preview.d.ts +54 -0
- package/lib/preview.d.ts.map +1 -0
- package/lib/preview.js +466 -0
- package/lib/preview.js.map +1 -0
- package/lib/types.d.ts +8 -0
- package/lib/types.d.ts.map +1 -1
- package/package.json +3 -1
- package/src/builder.ts +29 -19
- package/src/dispatcher.ts +17 -0
- package/src/hooks.ts +223 -0
- package/src/index.ts +137 -13
- package/src/jsx.tsx +296 -0
- package/src/preview.tsx +719 -0
- package/src/react-ambient.d.ts +10 -0
- package/src/react-native-env.d.ts +43 -0
- package/src/types.ts +8 -0
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
// Ambient declaration for react module imports
|
|
2
|
+
declare module 'react' {
|
|
3
|
+
export type ReactNode = any;
|
|
4
|
+
export type ReactElement<P = any, T = any> = {
|
|
5
|
+
type: T;
|
|
6
|
+
props: P;
|
|
7
|
+
key: any;
|
|
8
|
+
};
|
|
9
|
+
export type FC<P = {}> = ((props: P) => any) & { displayName?: string };
|
|
10
|
+
export function useState<T>(initialState: T | (() => T)): [T, (val: T | ((prev: T) => T)) => void];
|
|
11
|
+
export function useEffect(effect: () => void | (() => void), deps?: readonly any[]): void;
|
|
12
|
+
export function useRef<T>(initialValue: T): { current: T };
|
|
13
|
+
export function useCallback<T extends (...args: any[]) => any>(callback: T, deps: readonly any[]): T;
|
|
14
|
+
export function isValidElement(object: any): boolean;
|
|
15
|
+
export const Children: {
|
|
16
|
+
forEach(children: any, fn: (child: any, index: number) => void): void;
|
|
17
|
+
map<T, C>(children: C | readonly C[], fn: (child: C, index: number) => T): T[];
|
|
18
|
+
count(children: any): number;
|
|
19
|
+
only<C>(children: C): C;
|
|
20
|
+
toArray(children: any): any[];
|
|
21
|
+
};
|
|
22
|
+
export const Fragment: any;
|
|
23
|
+
const React: any;
|
|
24
|
+
export default React;
|
|
25
|
+
}
|
|
26
|
+
|
|
1
27
|
// Ambient declaration for react-native to ensure compile safety across all environments
|
|
2
28
|
declare module 'react-native' {
|
|
3
29
|
export interface PlatformOSType {
|
|
@@ -26,4 +52,21 @@ declare module 'react-native' {
|
|
|
26
52
|
registerHeadlessTask(taskKey: string, task: () => (taskData: any) => Promise<void>): void;
|
|
27
53
|
}
|
|
28
54
|
export const AppRegistry: AppRegistry;
|
|
55
|
+
|
|
56
|
+
export type ViewStyle = Record<string, any>;
|
|
57
|
+
export type TextStyle = Record<string, any>;
|
|
58
|
+
export type ImageStyle = Record<string, any>;
|
|
59
|
+
|
|
60
|
+
export const View: any;
|
|
61
|
+
export const Text: any;
|
|
62
|
+
export const Image: any;
|
|
63
|
+
export const TouchableOpacity: any;
|
|
64
|
+
export const StyleSheet: {
|
|
65
|
+
create<T extends Record<string, any>>(styles: T): T;
|
|
66
|
+
[key: string]: any;
|
|
67
|
+
};
|
|
68
|
+
export const Dimensions: {
|
|
69
|
+
get(dim: 'window' | 'screen'): { width: number; height: number; scale: number; fontScale: number };
|
|
70
|
+
[key: string]: any;
|
|
71
|
+
};
|
|
29
72
|
}
|
package/src/types.ts
CHANGED
|
@@ -43,6 +43,8 @@ export interface ContainerProps {
|
|
|
43
43
|
spacing?: number;
|
|
44
44
|
backgroundColor?: DynamicColor;
|
|
45
45
|
borderRadius?: number;
|
|
46
|
+
/** Alias bo góc theo cú pháp SwiftUI (tự động ánh xạ sang borderRadius) */
|
|
47
|
+
cornerRadius?: number;
|
|
46
48
|
borderColor?: DynamicColor;
|
|
47
49
|
borderWidth?: number;
|
|
48
50
|
alignment?: 'leading' | 'center' | 'trailing' | string;
|
|
@@ -135,6 +137,7 @@ export interface ProgressNode extends BaseNode {
|
|
|
135
137
|
height?: number;
|
|
136
138
|
/** Bo góc thanh. Mặc định bo tròn hoàn toàn */
|
|
137
139
|
borderRadius?: number;
|
|
140
|
+
cornerRadius?: number;
|
|
138
141
|
|
|
139
142
|
// ── 3. Màu sắc & Gradient ───────────────────────────────────
|
|
140
143
|
/** Màu thanh khi lấp đầy (dạng '#RRGGBB' hoặc { light, dark }) */
|
|
@@ -197,6 +200,7 @@ export interface ImageNode extends BaseNode {
|
|
|
197
200
|
padding?: number;
|
|
198
201
|
/** Bo góc ảnh (đặt bằng width / 2 để tạo ảnh Avatar tròn) */
|
|
199
202
|
borderRadius?: number;
|
|
203
|
+
cornerRadius?: number;
|
|
200
204
|
/** Độ dày viền quanh ảnh (ví dụ viền Avatar) */
|
|
201
205
|
borderWidth?: number;
|
|
202
206
|
/** Màu viền quanh ảnh */
|
|
@@ -240,6 +244,7 @@ export interface ButtonNode extends BaseNode {
|
|
|
240
244
|
paddingHorizontal?: number;
|
|
241
245
|
paddingVertical?: number;
|
|
242
246
|
borderRadius?: number;
|
|
247
|
+
cornerRadius?: number;
|
|
243
248
|
fullWidth?: boolean;
|
|
244
249
|
/** Tiêu đề hiển thị khi nút ở trạng thái đã tick (dùng với actionId 'toggle:<key>') */
|
|
245
250
|
checkedTitle?: string;
|
|
@@ -374,6 +379,7 @@ export interface BadgeNode extends BaseNode {
|
|
|
374
379
|
paddingHorizontal?: number;
|
|
375
380
|
paddingVertical?: number;
|
|
376
381
|
borderRadius?: number;
|
|
382
|
+
cornerRadius?: number;
|
|
377
383
|
};
|
|
378
384
|
}
|
|
379
385
|
|
|
@@ -576,6 +582,8 @@ export interface WidgetRemoteConfig {
|
|
|
576
582
|
headers?: Record<string, string>;
|
|
577
583
|
/** Chu kỳ tự động gọi lại API tính bằng phút (mặc định 15 phút) */
|
|
578
584
|
refreshIntervalMinutes?: number;
|
|
585
|
+
/** Alias ngắn gọn cho refreshIntervalMinutes */
|
|
586
|
+
intervalMinutes?: number;
|
|
579
587
|
}
|
|
580
588
|
|
|
581
589
|
export interface LiveActivityPushTokens {
|