@gaozh1024/rn-kit 0.3.3 → 0.4.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/README.md +377 -13
- package/TAILWIND_SETUP.md +1 -0
- package/dist/index.d.mts +270 -15
- package/dist/index.d.ts +270 -15
- package/dist/index.js +2700 -1054
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2674 -1038
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ import { ZodError, z, ZodSchema } from 'zod';
|
|
|
4
4
|
export { z } from 'zod';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import * as React$1 from 'react';
|
|
7
|
-
import React__default from 'react';
|
|
7
|
+
import React__default, { ReactNode, ErrorInfo } from 'react';
|
|
8
8
|
export { useMutation, useQuery } from '@tanstack/react-query';
|
|
9
9
|
import { ViewProps, ScrollViewProps, TextProps, PressableProps, StyleProp, TextStyle, ImageSourcePropType, ImageStyle, ListRenderItem, ViewStyle, TextInputProps, TextInput, StatusBarProps, StatusBarStyle } from 'react-native';
|
|
10
10
|
import { LinearGradientProps } from 'expo-linear-gradient';
|
|
@@ -460,6 +460,11 @@ declare function useTheme(): ThemeContextValue;
|
|
|
460
460
|
|
|
461
461
|
interface ThemeColorTokens {
|
|
462
462
|
primary: string;
|
|
463
|
+
success: string;
|
|
464
|
+
warning: string;
|
|
465
|
+
error: string;
|
|
466
|
+
info: string;
|
|
467
|
+
muted: string;
|
|
463
468
|
primarySurface: string;
|
|
464
469
|
background: string;
|
|
465
470
|
card: string;
|
|
@@ -639,6 +644,55 @@ declare function useAsyncState<T = any>(): {
|
|
|
639
644
|
reset: () => void;
|
|
640
645
|
};
|
|
641
646
|
|
|
647
|
+
/**
|
|
648
|
+
* Logger 核心类型
|
|
649
|
+
*/
|
|
650
|
+
type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
651
|
+
type LogSource = 'logger' | 'console';
|
|
652
|
+
interface LogEntry {
|
|
653
|
+
id: string;
|
|
654
|
+
level: LogLevel;
|
|
655
|
+
message: string;
|
|
656
|
+
namespace?: string;
|
|
657
|
+
data?: unknown;
|
|
658
|
+
timestamp: number;
|
|
659
|
+
source: LogSource;
|
|
660
|
+
}
|
|
661
|
+
type LoggerTransport = (entry: LogEntry) => void;
|
|
662
|
+
interface LoggerLike {
|
|
663
|
+
log: (level: LogLevel, message: string, data?: unknown, namespace?: string) => void;
|
|
664
|
+
debug: (message: string, data?: unknown, namespace?: string) => void;
|
|
665
|
+
info: (message: string, data?: unknown, namespace?: string) => void;
|
|
666
|
+
warn: (message: string, data?: unknown, namespace?: string) => void;
|
|
667
|
+
error: (message: string, data?: unknown, namespace?: string) => void;
|
|
668
|
+
}
|
|
669
|
+
interface ConsoleTransportOptions {
|
|
670
|
+
useAnsiColors?: boolean;
|
|
671
|
+
consoleRef?: Pick<Console, 'debug' | 'info' | 'log' | 'warn' | 'error'>;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
declare const LOG_LEVEL_WEIGHT: Record<LogLevel, number>;
|
|
675
|
+
declare function shouldLog(currentLevel: LogLevel, nextLevel: LogLevel): boolean;
|
|
676
|
+
declare function createLogEntry(input: {
|
|
677
|
+
level: LogLevel;
|
|
678
|
+
message: string;
|
|
679
|
+
data?: unknown;
|
|
680
|
+
namespace?: string;
|
|
681
|
+
source?: LogEntry['source'];
|
|
682
|
+
}): LogEntry;
|
|
683
|
+
declare function formatLogTime(timestamp: number): string;
|
|
684
|
+
declare function stringifyLogData(data: unknown): string;
|
|
685
|
+
declare function normalizeConsoleArgs(args: unknown[]): {
|
|
686
|
+
message: string;
|
|
687
|
+
data: unknown;
|
|
688
|
+
};
|
|
689
|
+
declare function serializeLogEntries(entries: LogEntry[]): string;
|
|
690
|
+
|
|
691
|
+
declare function createConsoleTransport(options?: ConsoleTransportOptions): LoggerTransport;
|
|
692
|
+
|
|
693
|
+
declare function setGlobalLogger(logger: LoggerLike | null): void;
|
|
694
|
+
declare function getGlobalLogger(): LoggerLike | null;
|
|
695
|
+
|
|
642
696
|
/**
|
|
643
697
|
* @fileoverview API 类型定义模块
|
|
644
698
|
* @module core/api/types
|
|
@@ -662,6 +716,33 @@ interface ApiErrorContext {
|
|
|
662
716
|
}
|
|
663
717
|
type ApiErrorHandler = (error: AppError, context: ApiErrorContext) => void | Promise<void>;
|
|
664
718
|
type ApiBusinessErrorParser = (data: unknown, response: Response) => AppError | null;
|
|
719
|
+
type ApiLogStage = 'request' | 'response' | 'error';
|
|
720
|
+
interface ApiLogEvent {
|
|
721
|
+
stage: ApiLogStage;
|
|
722
|
+
endpointName: string;
|
|
723
|
+
path: string;
|
|
724
|
+
method: ApiMethod;
|
|
725
|
+
url: string;
|
|
726
|
+
input?: unknown;
|
|
727
|
+
response?: Response;
|
|
728
|
+
responseData?: unknown;
|
|
729
|
+
statusCode?: number;
|
|
730
|
+
durationMs?: number;
|
|
731
|
+
error?: AppError;
|
|
732
|
+
}
|
|
733
|
+
type ApiLogTransport = (event: ApiLogEvent) => void | Promise<void>;
|
|
734
|
+
interface ApiObservabilityConfig {
|
|
735
|
+
enabled?: boolean;
|
|
736
|
+
transports?: ApiLogTransport[];
|
|
737
|
+
logger?: LoggerLike | null;
|
|
738
|
+
namespace?: string;
|
|
739
|
+
includeInput?: boolean;
|
|
740
|
+
includeResponseData?: boolean;
|
|
741
|
+
sanitize?: (value: unknown, meta: {
|
|
742
|
+
stage: ApiLogStage;
|
|
743
|
+
field: 'input' | 'responseData' | 'error';
|
|
744
|
+
}) => unknown;
|
|
745
|
+
}
|
|
665
746
|
/**
|
|
666
747
|
* API 端点配置接口
|
|
667
748
|
* @template TInput - 请求输入数据的类型
|
|
@@ -715,6 +796,8 @@ interface ApiConfig<TEndpoints extends Record<string, ApiEndpointConfig<any, any
|
|
|
715
796
|
parseBusinessError?: ApiBusinessErrorParser;
|
|
716
797
|
/** 全局错误监听器(可选) */
|
|
717
798
|
onError?: ApiErrorHandler;
|
|
799
|
+
/** 开发可观测性配置(可选) */
|
|
800
|
+
observability?: ApiObservabilityConfig;
|
|
718
801
|
}
|
|
719
802
|
|
|
720
803
|
/**
|
|
@@ -756,6 +839,8 @@ declare function createAPI<TEndpoints extends Record<string, ApiEndpointConfig<a
|
|
|
756
839
|
[K in keyof TEndpoints]: (input?: any) => Promise<any>;
|
|
757
840
|
};
|
|
758
841
|
|
|
842
|
+
declare function createApiLoggerTransport(config?: Pick<ApiObservabilityConfig, 'logger' | 'namespace' | 'sanitize' | 'includeInput' | 'includeResponseData'>): ApiLogTransport;
|
|
843
|
+
|
|
759
844
|
/**
|
|
760
845
|
* @fileoverview 内存存储实现模块
|
|
761
846
|
* @module core/storage/memory-storage
|
|
@@ -1073,6 +1158,8 @@ interface AppViewProps extends ViewProps {
|
|
|
1073
1158
|
flex?: boolean | number;
|
|
1074
1159
|
/** 是否使用水平排列(flex-direction: row) */
|
|
1075
1160
|
row?: boolean;
|
|
1161
|
+
/** 是否允许换行 */
|
|
1162
|
+
wrap?: boolean;
|
|
1076
1163
|
/** 是否居中显示(items-center justify-center) */
|
|
1077
1164
|
center?: boolean;
|
|
1078
1165
|
/** 是否两端对齐(justify-between) */
|
|
@@ -1128,7 +1215,7 @@ interface AppViewProps extends ViewProps {
|
|
|
1128
1215
|
* </AppView>
|
|
1129
1216
|
* ```
|
|
1130
1217
|
*/
|
|
1131
|
-
declare function AppView({ flex, row, center, between, items, justify, p, px, py, gap, bg, surface, rounded, className, children, style, ...props }: AppViewProps): react_jsx_runtime.JSX.Element;
|
|
1218
|
+
declare function AppView({ flex, row, wrap, center, between, items, justify, p, px, py, gap, bg, surface, rounded, className, children, style, ...props }: AppViewProps): react_jsx_runtime.JSX.Element;
|
|
1132
1219
|
|
|
1133
1220
|
interface AppScrollViewProps extends ScrollViewProps {
|
|
1134
1221
|
/** 是否使用 flex 布局 */
|
|
@@ -1149,11 +1236,13 @@ interface AppScrollViewProps extends ScrollViewProps {
|
|
|
1149
1236
|
rounded?: string;
|
|
1150
1237
|
/** 自定义类名 */
|
|
1151
1238
|
className?: string;
|
|
1239
|
+
/** 点击非输入区域时是否收起键盘 */
|
|
1240
|
+
dismissKeyboardOnPressOutside?: boolean;
|
|
1152
1241
|
}
|
|
1153
1242
|
/**
|
|
1154
1243
|
* AppScrollView - 带 Tailwind/快捷布局能力的滚动容器
|
|
1155
1244
|
*/
|
|
1156
|
-
declare function AppScrollView({ flex, bg, p, px, py, gap, surface, rounded, className, children, style, ...props }: AppScrollViewProps): react_jsx_runtime.JSX.Element;
|
|
1245
|
+
declare function AppScrollView({ flex, bg, p, px, py, gap, surface, rounded, className, dismissKeyboardOnPressOutside, children, style, ...props }: AppScrollViewProps): react_jsx_runtime.JSX.Element;
|
|
1157
1246
|
|
|
1158
1247
|
/**
|
|
1159
1248
|
* AppText 组件属性接口
|
|
@@ -1245,6 +1334,15 @@ interface AppPressableProps extends PressableProps {
|
|
|
1245
1334
|
*/
|
|
1246
1335
|
declare function AppPressable({ className, pressedClassName, children, ...props }: AppPressableProps): react_jsx_runtime.JSX.Element;
|
|
1247
1336
|
|
|
1337
|
+
interface KeyboardDismissViewProps extends AppViewProps {
|
|
1338
|
+
/** 是否启用点击空白收起键盘 */
|
|
1339
|
+
enabled?: boolean;
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1342
|
+
* KeyboardDismissView - 点击空白区域时自动收起键盘
|
|
1343
|
+
*/
|
|
1344
|
+
declare function KeyboardDismissView({ enabled, children, ...props }: KeyboardDismissViewProps): react_jsx_runtime.JSX.Element;
|
|
1345
|
+
|
|
1248
1346
|
/**
|
|
1249
1347
|
* Row 组件属性接口
|
|
1250
1348
|
*/
|
|
@@ -1413,8 +1511,12 @@ interface SafeScreenProps extends ViewProps {
|
|
|
1413
1511
|
right?: boolean;
|
|
1414
1512
|
/** 背景颜色 */
|
|
1415
1513
|
bg?: string;
|
|
1514
|
+
/** 语义化背景 */
|
|
1515
|
+
surface?: 'background' | 'card' | 'muted';
|
|
1416
1516
|
/** 是否使用 flex: 1 */
|
|
1417
1517
|
flex?: boolean;
|
|
1518
|
+
/** 点击非输入区域时是否收起键盘 */
|
|
1519
|
+
dismissKeyboardOnPressOutside?: boolean;
|
|
1418
1520
|
/** 自定义样式类 */
|
|
1419
1521
|
className?: string;
|
|
1420
1522
|
/** 子元素 */
|
|
@@ -1430,7 +1532,7 @@ interface SafeScreenProps extends ViewProps {
|
|
|
1430
1532
|
* </SafeScreen>
|
|
1431
1533
|
* ```
|
|
1432
1534
|
*/
|
|
1433
|
-
declare function SafeScreen({ top, bottom, left, right, bg, flex, className, children, style, ...props }: SafeScreenProps): react_jsx_runtime.JSX.Element;
|
|
1535
|
+
declare function SafeScreen({ top, bottom, left, right, bg, surface, flex, dismissKeyboardOnPressOutside, className, children, style, ...props }: SafeScreenProps): react_jsx_runtime.JSX.Element;
|
|
1434
1536
|
/**
|
|
1435
1537
|
* 页面容器组件 - 包含安全区域和基础布局
|
|
1436
1538
|
*
|
|
@@ -1461,19 +1563,22 @@ declare function SafeBottom({ children, className, ...props }: Omit<SafeScreenPr
|
|
|
1461
1563
|
/**
|
|
1462
1564
|
* AppButton 组件属性接口
|
|
1463
1565
|
*/
|
|
1566
|
+
type AppButtonColor = 'primary' | 'secondary' | 'success' | 'warning' | 'info' | 'error' | 'danger' | 'muted';
|
|
1464
1567
|
interface AppButtonProps {
|
|
1465
1568
|
/** 按钮样式变体:solid(实心)、outline(描边)、ghost(透明) */
|
|
1466
1569
|
variant?: 'solid' | 'outline' | 'ghost';
|
|
1467
1570
|
/** 按钮尺寸:sm(小)、md(中)、lg(大) */
|
|
1468
1571
|
size?: 'sm' | 'md' | 'lg';
|
|
1469
1572
|
/** 按钮颜色主题 */
|
|
1470
|
-
color?:
|
|
1573
|
+
color?: AppButtonColor;
|
|
1471
1574
|
/** 是否显示加载状态 */
|
|
1472
1575
|
loading?: boolean;
|
|
1473
1576
|
/** 是否禁用 */
|
|
1474
1577
|
disabled?: boolean;
|
|
1475
1578
|
/** 点击回调 */
|
|
1476
1579
|
onPress?: () => void;
|
|
1580
|
+
/** 点击前是否先收起键盘 */
|
|
1581
|
+
dismissKeyboardOnPress?: boolean;
|
|
1477
1582
|
/** 按钮内容 */
|
|
1478
1583
|
children: React.ReactNode;
|
|
1479
1584
|
/** 自定义类名 */
|
|
@@ -1503,6 +1608,9 @@ interface AppButtonProps {
|
|
|
1503
1608
|
* // 不同颜色
|
|
1504
1609
|
* <AppButton color="primary">主题色</AppButton>
|
|
1505
1610
|
* <AppButton color="secondary">次要色</AppButton>
|
|
1611
|
+
* <AppButton color="success">成功操作</AppButton>
|
|
1612
|
+
* <AppButton color="warning">警告操作</AppButton>
|
|
1613
|
+
* <AppButton color="info">提示操作</AppButton>
|
|
1506
1614
|
* <AppButton color="danger">危险操作</AppButton>
|
|
1507
1615
|
*
|
|
1508
1616
|
* // 加载状态
|
|
@@ -1522,7 +1630,7 @@ interface AppButtonProps {
|
|
|
1522
1630
|
* </AppButton>
|
|
1523
1631
|
* ```
|
|
1524
1632
|
*/
|
|
1525
|
-
declare function AppButton({ variant, size, color, loading, disabled, onPress, children, className, }: AppButtonProps): react_jsx_runtime.JSX.Element;
|
|
1633
|
+
declare function AppButton({ variant, size, color, loading, disabled, onPress, dismissKeyboardOnPress, children, className, }: AppButtonProps): react_jsx_runtime.JSX.Element;
|
|
1526
1634
|
|
|
1527
1635
|
/**
|
|
1528
1636
|
* Toast 组件属性接口
|
|
@@ -1534,6 +1642,8 @@ interface ToastProps {
|
|
|
1534
1642
|
type?: 'success' | 'error' | 'warning' | 'info';
|
|
1535
1643
|
/** 是否显示 */
|
|
1536
1644
|
visible?: boolean;
|
|
1645
|
+
/** 测试 ID */
|
|
1646
|
+
testID?: string;
|
|
1537
1647
|
}
|
|
1538
1648
|
/**
|
|
1539
1649
|
* Toast - 轻提示组件
|
|
@@ -1564,7 +1674,7 @@ interface ToastProps {
|
|
|
1564
1674
|
* showToast({ message: '操作成功', type: 'success' });
|
|
1565
1675
|
* ```
|
|
1566
1676
|
*/
|
|
1567
|
-
declare function Toast({ message, type, visible }: ToastProps): react_jsx_runtime.JSX.Element | null;
|
|
1677
|
+
declare function Toast({ message, type, visible, testID }: ToastProps): react_jsx_runtime.JSX.Element | null;
|
|
1568
1678
|
|
|
1569
1679
|
/**
|
|
1570
1680
|
* Alert 按钮配置
|
|
@@ -1608,6 +1718,8 @@ interface LoadingProps {
|
|
|
1608
1718
|
visible?: boolean;
|
|
1609
1719
|
/** 测试 ID */
|
|
1610
1720
|
testID?: string;
|
|
1721
|
+
/** 超时后关闭回调 */
|
|
1722
|
+
onClose?: () => void;
|
|
1611
1723
|
}
|
|
1612
1724
|
/**
|
|
1613
1725
|
* Loading - 加载指示器组件
|
|
@@ -1650,7 +1762,7 @@ interface LoadingProps {
|
|
|
1650
1762
|
* );
|
|
1651
1763
|
* ```
|
|
1652
1764
|
*/
|
|
1653
|
-
declare function Loading({ text, color, overlay, visible, testID }: LoadingProps): react_jsx_runtime.JSX.Element | null;
|
|
1765
|
+
declare function Loading({ text, color, overlay, visible, testID, onClose, }: LoadingProps): react_jsx_runtime.JSX.Element | null;
|
|
1654
1766
|
|
|
1655
1767
|
/**
|
|
1656
1768
|
* Progress 组件属性接口
|
|
@@ -1696,6 +1808,14 @@ declare function Progress({ value, max, size, color, testID, className, barClass
|
|
|
1696
1808
|
* Card 组件属性接口
|
|
1697
1809
|
*/
|
|
1698
1810
|
interface CardProps extends ViewProps {
|
|
1811
|
+
/** 内边距 */
|
|
1812
|
+
p?: number;
|
|
1813
|
+
/** 水平内边距 */
|
|
1814
|
+
px?: number;
|
|
1815
|
+
/** 垂直内边距 */
|
|
1816
|
+
py?: number;
|
|
1817
|
+
/** 子元素间距 */
|
|
1818
|
+
gap?: number;
|
|
1699
1819
|
/** Tailwind / NativeWind 类名 */
|
|
1700
1820
|
className?: string;
|
|
1701
1821
|
/** 是否禁用阴影 */
|
|
@@ -1708,7 +1828,7 @@ interface CardProps extends ViewProps {
|
|
|
1708
1828
|
/**
|
|
1709
1829
|
* Card - 卡片容器组件,支持浅色/深色主题
|
|
1710
1830
|
*/
|
|
1711
|
-
declare function Card({ children, className, style, noShadow, noBorder, noRadius, ...props }: CardProps): react_jsx_runtime.JSX.Element;
|
|
1831
|
+
declare function Card({ children, p, px, py, gap, className, style, noShadow, noBorder, noRadius, ...props }: CardProps): react_jsx_runtime.JSX.Element;
|
|
1712
1832
|
|
|
1713
1833
|
/** 图标尺寸类型 */
|
|
1714
1834
|
type IconSize = number | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
@@ -2017,6 +2137,7 @@ interface AppInputProps extends Omit<TextInputProps, 'editable'> {
|
|
|
2017
2137
|
* AppInput - 输入框组件,支持浅色/深色主题
|
|
2018
2138
|
*/
|
|
2019
2139
|
declare const AppInput: React$1.ForwardRefExoticComponent<AppInputProps & React$1.RefAttributes<TextInput>>;
|
|
2140
|
+
declare const AppTextInput: React$1.ForwardRefExoticComponent<AppInputProps & React$1.RefAttributes<TextInput>>;
|
|
2020
2141
|
|
|
2021
2142
|
/**
|
|
2022
2143
|
* Checkbox 组件属性接口
|
|
@@ -2157,6 +2278,47 @@ interface SelectProps {
|
|
|
2157
2278
|
*/
|
|
2158
2279
|
declare function Select({ value, onChange, options, placeholder, multiple, searchable, onSearch, disabled, clearable, singleSelectTitle, multipleSelectTitle, searchPlaceholder, emptyText, selectedCountText, confirmText, className, }: SelectProps): react_jsx_runtime.JSX.Element;
|
|
2159
2280
|
|
|
2281
|
+
type PickerValue = string | number;
|
|
2282
|
+
interface PickerOption {
|
|
2283
|
+
label: string;
|
|
2284
|
+
value: PickerValue;
|
|
2285
|
+
disabled?: boolean;
|
|
2286
|
+
}
|
|
2287
|
+
interface PickerColumn {
|
|
2288
|
+
key: string;
|
|
2289
|
+
title?: string;
|
|
2290
|
+
options: PickerOption[];
|
|
2291
|
+
}
|
|
2292
|
+
interface PickerRenderFooterContext {
|
|
2293
|
+
close: () => void;
|
|
2294
|
+
setTempValues: (values: PickerValue[]) => void;
|
|
2295
|
+
tempValues: PickerValue[];
|
|
2296
|
+
}
|
|
2297
|
+
interface PickerProps {
|
|
2298
|
+
value?: PickerValue[];
|
|
2299
|
+
onChange?: (values: PickerValue[]) => void;
|
|
2300
|
+
columns: PickerColumn[];
|
|
2301
|
+
placeholder?: string;
|
|
2302
|
+
disabled?: boolean;
|
|
2303
|
+
className?: string;
|
|
2304
|
+
pickerTitle?: string;
|
|
2305
|
+
cancelText?: string;
|
|
2306
|
+
confirmText?: string;
|
|
2307
|
+
triggerIconName?: string;
|
|
2308
|
+
renderDisplayText?: (selectedOptions: Array<PickerOption | undefined>) => string;
|
|
2309
|
+
renderFooter?: (context: PickerRenderFooterContext) => React.ReactNode;
|
|
2310
|
+
tempValue?: PickerValue[];
|
|
2311
|
+
defaultTempValue?: PickerValue[];
|
|
2312
|
+
onTempChange?: (values: PickerValue[]) => void;
|
|
2313
|
+
onOpen?: () => void;
|
|
2314
|
+
rowHeight?: number;
|
|
2315
|
+
visibleRows?: number;
|
|
2316
|
+
}
|
|
2317
|
+
/**
|
|
2318
|
+
* Picker - 通用多列滚轮选择器,适用于日期、省市区等多列选择场景
|
|
2319
|
+
*/
|
|
2320
|
+
declare function Picker({ value, onChange, columns, placeholder, disabled, className, pickerTitle, cancelText, confirmText, triggerIconName, renderDisplayText, renderFooter, tempValue, defaultTempValue, onTempChange, onOpen, rowHeight, visibleRows, }: PickerProps): react_jsx_runtime.JSX.Element;
|
|
2321
|
+
|
|
2160
2322
|
/**
|
|
2161
2323
|
* DatePicker 组件属性接口
|
|
2162
2324
|
*/
|
|
@@ -2183,7 +2345,7 @@ interface DatePickerProps {
|
|
|
2183
2345
|
confirmText?: string;
|
|
2184
2346
|
/** 弹窗标题文案 */
|
|
2185
2347
|
pickerTitle?: string;
|
|
2186
|
-
/**
|
|
2348
|
+
/** 兼容保留:旧版弹窗顶部日期格式 */
|
|
2187
2349
|
pickerDateFormat?: string;
|
|
2188
2350
|
/** 年列标题 */
|
|
2189
2351
|
yearLabel?: string;
|
|
@@ -2199,9 +2361,9 @@ interface DatePickerProps {
|
|
|
2199
2361
|
maxDateText?: string;
|
|
2200
2362
|
}
|
|
2201
2363
|
/**
|
|
2202
|
-
* DatePicker -
|
|
2364
|
+
* DatePicker - 日期滚轮选择器,保留日期封装并复用通用 Picker
|
|
2203
2365
|
*/
|
|
2204
|
-
declare function DatePicker({ value, onChange, placeholder, disabled, format, minDate, maxDate, className, cancelText, confirmText, pickerTitle, pickerDateFormat, yearLabel, monthLabel, dayLabel, todayText, minDateText, maxDateText, }: DatePickerProps): react_jsx_runtime.JSX.Element;
|
|
2366
|
+
declare function DatePicker({ value, onChange, placeholder, disabled, format, minDate, maxDate, className, cancelText, confirmText, pickerTitle, pickerDateFormat: _pickerDateFormat, yearLabel, monthLabel, dayLabel, todayText, minDateText, maxDateText, }: DatePickerProps): react_jsx_runtime.JSX.Element;
|
|
2205
2367
|
|
|
2206
2368
|
interface FormItemProps {
|
|
2207
2369
|
name: string;
|
|
@@ -2978,6 +3140,7 @@ interface AppHeaderProps {
|
|
|
2978
3140
|
* 应用头部组件
|
|
2979
3141
|
*
|
|
2980
3142
|
* iOS 风格的顶部导航栏,标题始终居中,不受左右按钮影响
|
|
3143
|
+
* 内部会自动注入聚焦态透明状态栏,让顶部状态栏区域跟随 Header 背景显示
|
|
2981
3144
|
*
|
|
2982
3145
|
* @example
|
|
2983
3146
|
* ```tsx
|
|
@@ -3273,6 +3436,59 @@ interface AppStatusBarProps extends Omit<StatusBarProps, 'barStyle' | 'backgroun
|
|
|
3273
3436
|
declare function AppStatusBar({ barStyle, backgroundColor, translucent, ...props }: AppStatusBarProps): react_jsx_runtime.JSX.Element;
|
|
3274
3437
|
declare function AppFocusedStatusBar(props: AppStatusBarProps): react_jsx_runtime.JSX.Element | null;
|
|
3275
3438
|
|
|
3439
|
+
interface LoggerExportPayload {
|
|
3440
|
+
entries: LogEntry[];
|
|
3441
|
+
serialized: string;
|
|
3442
|
+
}
|
|
3443
|
+
interface LoggerProviderProps {
|
|
3444
|
+
children: ReactNode;
|
|
3445
|
+
enabled?: boolean;
|
|
3446
|
+
level?: LogLevel;
|
|
3447
|
+
maxEntries?: number;
|
|
3448
|
+
overlayEnabled?: boolean;
|
|
3449
|
+
defaultExpanded?: boolean;
|
|
3450
|
+
consoleEnabled?: boolean;
|
|
3451
|
+
transports?: LoggerTransport[];
|
|
3452
|
+
exportEnabled?: boolean;
|
|
3453
|
+
onExport?: (payload: LoggerExportPayload) => void;
|
|
3454
|
+
}
|
|
3455
|
+
interface LoggerContextType {
|
|
3456
|
+
entries: LogEntry[];
|
|
3457
|
+
enabled: boolean;
|
|
3458
|
+
level: LogLevel;
|
|
3459
|
+
clear: () => void;
|
|
3460
|
+
log: (level: LogLevel, message: string, data?: unknown, namespace?: string) => void;
|
|
3461
|
+
debug: (message: string, data?: unknown, namespace?: string) => void;
|
|
3462
|
+
info: (message: string, data?: unknown, namespace?: string) => void;
|
|
3463
|
+
warn: (message: string, data?: unknown, namespace?: string) => void;
|
|
3464
|
+
error: (message: string, data?: unknown, namespace?: string) => void;
|
|
3465
|
+
}
|
|
3466
|
+
interface ScopedLoggerContextType extends Omit<LoggerContextType, 'log' | 'debug' | 'info' | 'warn' | 'error'> {
|
|
3467
|
+
namespace?: string;
|
|
3468
|
+
log: (level: LogLevel, message: string, data?: unknown) => void;
|
|
3469
|
+
debug: (message: string, data?: unknown) => void;
|
|
3470
|
+
info: (message: string, data?: unknown) => void;
|
|
3471
|
+
warn: (message: string, data?: unknown) => void;
|
|
3472
|
+
error: (message: string, data?: unknown) => void;
|
|
3473
|
+
}
|
|
3474
|
+
|
|
3475
|
+
interface ErrorBoundaryFallbackRenderProps {
|
|
3476
|
+
error: Error;
|
|
3477
|
+
reset: () => void;
|
|
3478
|
+
}
|
|
3479
|
+
interface AppErrorBoundaryProps {
|
|
3480
|
+
children: ReactNode;
|
|
3481
|
+
enabled?: boolean;
|
|
3482
|
+
title?: string;
|
|
3483
|
+
description?: string;
|
|
3484
|
+
showDetails?: boolean;
|
|
3485
|
+
resetText?: string;
|
|
3486
|
+
fallback?: ReactNode | ((props: ErrorBoundaryFallbackRenderProps) => ReactNode);
|
|
3487
|
+
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
3488
|
+
onReset?: () => void;
|
|
3489
|
+
resetKeys?: unknown[];
|
|
3490
|
+
}
|
|
3491
|
+
|
|
3276
3492
|
/**
|
|
3277
3493
|
* AppProvider Props
|
|
3278
3494
|
*/
|
|
@@ -3288,6 +3504,10 @@ interface AppProviderProps extends Omit<NavigationProviderProps, 'children'> {
|
|
|
3288
3504
|
enableOverlay?: boolean;
|
|
3289
3505
|
/** 是否启用主题(默认 true) */
|
|
3290
3506
|
enableTheme?: boolean;
|
|
3507
|
+
/** 是否启用开发日志基础设施(默认开发环境开启) */
|
|
3508
|
+
enableLogger?: boolean;
|
|
3509
|
+
/** 是否启用 React 错误边界(默认开发环境开启) */
|
|
3510
|
+
enableErrorBoundary?: boolean;
|
|
3291
3511
|
/** 是否启用全局状态栏管理(默认 true) */
|
|
3292
3512
|
enableStatusBar?: boolean;
|
|
3293
3513
|
/** 是否启用安全区域(默认 true) */
|
|
@@ -3302,6 +3522,10 @@ interface AppProviderProps extends Omit<NavigationProviderProps, 'children'> {
|
|
|
3302
3522
|
isDark?: boolean;
|
|
3303
3523
|
/** 全局状态栏配置 */
|
|
3304
3524
|
statusBarProps?: AppStatusBarProps;
|
|
3525
|
+
/** Logger Provider 配置 */
|
|
3526
|
+
loggerProps?: Omit<LoggerProviderProps, 'children'>;
|
|
3527
|
+
/** Error Boundary 配置 */
|
|
3528
|
+
errorBoundaryProps?: Omit<AppErrorBoundaryProps, 'children'>;
|
|
3305
3529
|
}
|
|
3306
3530
|
/**
|
|
3307
3531
|
* 统一应用 Provider
|
|
@@ -3400,13 +3624,15 @@ interface AppProviderProps extends Omit<NavigationProviderProps, 'children'> {
|
|
|
3400
3624
|
* }
|
|
3401
3625
|
* ```
|
|
3402
3626
|
*/
|
|
3403
|
-
declare function AppProvider({ children, enableNavigation, enableOverlay, enableTheme, enableStatusBar, enableSafeArea, lightTheme, darkTheme, defaultDark, isDark, statusBarProps, ...navigationProps }: AppProviderProps): react_jsx_runtime.JSX.Element;
|
|
3627
|
+
declare function AppProvider({ children, enableNavigation, enableOverlay, enableTheme, enableLogger, enableErrorBoundary, enableStatusBar, enableSafeArea, lightTheme, darkTheme, defaultDark, isDark, statusBarProps, loggerProps, errorBoundaryProps, ...navigationProps }: AppProviderProps): react_jsx_runtime.JSX.Element;
|
|
3404
3628
|
|
|
3405
3629
|
/**
|
|
3406
3630
|
* Overlay Provider Props
|
|
3407
3631
|
*/
|
|
3408
3632
|
interface OverlayProviderProps {
|
|
3409
3633
|
children: React__default.ReactNode;
|
|
3634
|
+
loggerProps?: Omit<LoggerProviderProps, 'children'>;
|
|
3635
|
+
errorBoundaryProps?: Omit<AppErrorBoundaryProps, 'children'>;
|
|
3410
3636
|
}
|
|
3411
3637
|
/**
|
|
3412
3638
|
* 统一 Overlay Provider
|
|
@@ -3414,7 +3640,7 @@ interface OverlayProviderProps {
|
|
|
3414
3640
|
* 整合:LoadingProvider + ToastProvider + AlertProvider
|
|
3415
3641
|
* 提供全局 Loading、Toast、Alert 功能
|
|
3416
3642
|
*/
|
|
3417
|
-
declare function OverlayProvider({ children }: OverlayProviderProps): react_jsx_runtime.JSX.Element;
|
|
3643
|
+
declare function OverlayProvider({ children, loggerProps, errorBoundaryProps }: OverlayProviderProps): react_jsx_runtime.JSX.Element;
|
|
3418
3644
|
|
|
3419
3645
|
/**
|
|
3420
3646
|
* Loading 子系统类型定义
|
|
@@ -3584,4 +3810,33 @@ interface AlertContextType {
|
|
|
3584
3810
|
*/
|
|
3585
3811
|
declare function useAlert(): AlertContextType;
|
|
3586
3812
|
|
|
3587
|
-
|
|
3813
|
+
declare function LoggerProvider({ children, enabled, level, maxEntries, overlayEnabled, defaultExpanded, consoleEnabled, transports, exportEnabled, onExport, }: LoggerProviderProps): react_jsx_runtime.JSX.Element;
|
|
3814
|
+
|
|
3815
|
+
declare function useLogger(namespace?: string): ScopedLoggerContextType;
|
|
3816
|
+
|
|
3817
|
+
interface LogOverlayProps {
|
|
3818
|
+
entries: LogEntry[];
|
|
3819
|
+
onClear: () => void;
|
|
3820
|
+
defaultExpanded?: boolean;
|
|
3821
|
+
exportEnabled?: boolean;
|
|
3822
|
+
onExport?: (payload: LoggerExportPayload) => void;
|
|
3823
|
+
}
|
|
3824
|
+
declare function LogOverlay({ entries, onClear, defaultExpanded, exportEnabled, onExport, }: LogOverlayProps): react_jsx_runtime.JSX.Element;
|
|
3825
|
+
|
|
3826
|
+
declare const LoggerContext: React$1.Context<LoggerContextType | null>;
|
|
3827
|
+
|
|
3828
|
+
interface AppErrorBoundaryState {
|
|
3829
|
+
error: Error | null;
|
|
3830
|
+
}
|
|
3831
|
+
declare class AppErrorBoundary extends React__default.Component<AppErrorBoundaryProps, AppErrorBoundaryState> {
|
|
3832
|
+
static contextType: React__default.Context<LoggerContextType | null>;
|
|
3833
|
+
context: React__default.ContextType<typeof LoggerContext>;
|
|
3834
|
+
state: AppErrorBoundaryState;
|
|
3835
|
+
static getDerivedStateFromError(error: Error): AppErrorBoundaryState;
|
|
3836
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
3837
|
+
componentDidUpdate(prevProps: AppErrorBoundaryProps): void;
|
|
3838
|
+
handleReset: () => void;
|
|
3839
|
+
render(): string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
3840
|
+
}
|
|
3841
|
+
|
|
3842
|
+
export { ActionIcons, Alert, type AlertContextType, type AlertOptions, type AlertProps, type ApiBusinessErrorParser, type ApiConfig, type ApiEndpointConfig, type ApiErrorContext, type ApiErrorHandler, type ApiLogEvent, type ApiLogStage, type ApiLogTransport, type ApiMethod, type ApiObservabilityConfig, AppButton, type AppButtonProps, type AppError, AppErrorBoundary, type AppErrorBoundaryProps, AppFocusedStatusBar, AppHeader, type AppHeaderProps, AppImage, type AppImageProps, AppInput, type AppInputProps, AppList, type AppListProps, type AppNavigation, AppPressable, type AppPressableProps, AppProvider, type AppProviderProps, AppScreen, AppScrollView, type AppScrollViewProps, AppStatusBar, type AppStatusBarProps, AppText, AppTextInput, type AppTextProps, AppView, type AppViewProps, BottomTabBar, Card, type CardProps, Center, type CenterProps, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, Col, type ColProps, type ColorPalette$1 as ColorPalette, type ColorToken, type ConsoleTransportOptions, type CustomBottomTabBarProps, DatePicker, type DatePickerProps, DrawerContent, type DrawerContentProps, type DrawerItem, type DrawerNavigation, DrawerNavigator, type DrawerNavigatorProps, type DrawerOptions, type DrawerParamList, type DrawerRouteConfig, type DrawerScreenOptions, type DrawerScreenProps, type ErrorBoundaryFallbackRenderProps, ErrorCode, FileIcons, type FormErrors, type FormGroupOption, FormItem, type FormItemProps, GradientView, type GradientViewProps, Icon, type IconProps, type IconSize, type InfiniteFetchParams, type InfiniteFetchResult, KeyboardDismissView, type KeyboardDismissViewProps, LOG_LEVEL_WEIGHT, type LinkingConfig, Loading, type LoadingContextType, type LoadingProps, type LoadingState, type LogEntry, type LogLevel, LogOverlay, type LogSource, type LoggerContextType, type LoggerExportPayload, type LoggerLike, LoggerProvider, type LoggerProviderProps, type LoggerTransport, MemoryStorage, NavigationIcons, NavigationProvider, type NavigationProviderProps, type Orientation, OverlayProvider, type OverlayProviderProps, PageDrawer, type PageDrawerProps, type PaginationParams, type PaginationResult, type ParamListBase, type PathConfig, Picker, type PickerColumn, type PickerOption, type PickerProps, type PickerValue, Progress, type ProgressProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, type RgbObject, type RouteConfig, Row, type RowProps, SafeBottom, SafeScreen, type SafeScreenProps, type ScopedLoggerContextType, Select, type SelectOption, type SelectProps, Slider, type SliderProps, type StackNavigation, StackNavigator, type StackNavigatorProps, type StackParamList, type StackRouteConfig, type StackScreenOptions, type StackScreenProps, StatusIcons, Switch, type SwitchProps, type TabBarOptions, type TabNavigation, TabNavigator, type TabNavigatorProps, type TabParamList, type TabRouteConfig, type TabScreenOptions, type TabScreenProps, type Theme, type ColorPalette as ThemeColorPalette, type ThemeConfig, ThemeProvider, Toast, type ToastContextType, type ToastItem, type ToastProps, type ToastType, type UseAsyncState, type UseDimensionsReturn, type UseFormOptions, type UseInfiniteOptions, type UseInfiniteReturn, type UseKeyboardReturn, type UseOrientationReturn, type UsePageDrawerReturn, type UsePaginationOptions, type UsePaginationReturn, type UseRefreshReturn, type UseToggleActions, adjustBrightness, capitalize, clamp, cn, createAPI, createApiLoggerTransport, createConsoleTransport, createDrawerScreens, createLogEntry, createNavigationTheme, createStackScreens, createTabScreens, createTheme, deepMerge, enhanceError, formatCurrency, formatDate, formatLogTime, formatNumber, formatPercent, formatRelativeTime, generateColorPalette, getGlobalLogger, getThemeColors, getValidationErrors, hexToRgb, isDevelopment, isValidEmail, isValidPhone, mapHttpStatus, normalizeConsoleArgs, omit, pick, rgbToHex, serializeLogEntries, setGlobalLogger, shouldLog, slugify, storage, stringifyLogData, truncate, useAlert, useAsyncState, useBackHandler, useDebounce, useDimensions, useDrawerNavigation, useForm, useInfinite, useKeyboard, useLoading, useLogger, useMemoizedFn, useNavigation, useNavigationState, useOrientation, usePageDrawer, usePagination, usePrevious, useRefresh, useRequest, useRoute, useSetState, useStackNavigation, useStorage, useTabNavigation, useTheme, useThemeColors, useThrottle, useToast, useToggle, useUpdateEffect };
|