@lynx-js/lynx-ui-common 0.0.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/LICENSE +201 -0
- package/README.md +28 -0
- package/dist/const/BaseScrollEventsMapping.d.ts +2 -0
- package/dist/const/BaseScrollEventsMapping.d.ts.map +1 -0
- package/dist/const/BaseScrollEventsMapping.jsx +13 -0
- package/dist/const/BaseScrollEventsMapping.jsx.map +1 -0
- package/dist/const/BaseUIEventsMapping.d.ts +4 -0
- package/dist/const/BaseUIEventsMapping.d.ts.map +1 -0
- package/dist/const/BaseUIEventsMapping.jsx +24 -0
- package/dist/const/BaseUIEventsMapping.jsx.map +1 -0
- package/dist/const/index.d.ts +3 -0
- package/dist/const/index.d.ts.map +1 -0
- package/dist/const/index.jsx +2 -0
- package/dist/hooks/docs/useBounce.jsx +0 -0
- package/dist/hooks/docs/useRefresh.jsx +0 -0
- package/dist/hooks/index.d.ts +19 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.jsx +73 -0
- package/dist/hooks/index.jsx.map +1 -0
- package/dist/hooks/useBounce.d.ts +26 -0
- package/dist/hooks/useBounce.d.ts.map +1 -0
- package/dist/hooks/useBounce.jsx +383 -0
- package/dist/hooks/useBounce.jsx.map +1 -0
- package/dist/hooks/useGCCollector.d.ts +18 -0
- package/dist/hooks/useGCCollector.d.ts.map +1 -0
- package/dist/hooks/useGCCollector.jsx +48 -0
- package/dist/hooks/useGCCollector.jsx.map +1 -0
- package/dist/hooks/useGlobalEventListener.d.ts +9 -0
- package/dist/hooks/useGlobalEventListener.d.ts.map +1 -0
- package/dist/hooks/useGlobalEventListener.jsx +19 -0
- package/dist/hooks/useGlobalEventListener.jsx.map +1 -0
- package/dist/hooks/useLatest.d.ts +6 -0
- package/dist/hooks/useLatest.d.ts.map +1 -0
- package/dist/hooks/useLatest.jsx +9 -0
- package/dist/hooks/useLatest.jsx.map +1 -0
- package/dist/hooks/useMemoizedFn.d.ts +8 -0
- package/dist/hooks/useMemoizedFn.d.ts.map +1 -0
- package/dist/hooks/useMemoizedFn.jsx +15 -0
- package/dist/hooks/useMemoizedFn.jsx.map +1 -0
- package/dist/hooks/usePrevious.d.ts +16 -0
- package/dist/hooks/usePrevious.d.ts.map +1 -0
- package/dist/hooks/usePrevious.jsx +11 -0
- package/dist/hooks/usePrevious.jsx.map +1 -0
- package/dist/hooks/useRefresh.d.ts +24 -0
- package/dist/hooks/useRefresh.d.ts.map +1 -0
- package/dist/hooks/useRefresh.jsx +554 -0
- package/dist/hooks/useRefresh.jsx.map +1 -0
- package/dist/hooks/useRegisteredEvents.d.ts +19 -0
- package/dist/hooks/useRegisteredEvents.d.ts.map +1 -0
- package/dist/hooks/useRegisteredEvents.jsx +24 -0
- package/dist/hooks/useRegisteredEvents.jsx.map +1 -0
- package/dist/hooks/useUnmount.d.ts +2 -0
- package/dist/hooks/useUnmount.d.ts.map +1 -0
- package/dist/hooks/useUnmount.jsx +11 -0
- package/dist/hooks/useUnmount.jsx.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.jsx +6 -0
- package/dist/reactive/hooks/useReactiveValue.d.ts +22 -0
- package/dist/reactive/hooks/useReactiveValue.d.ts.map +1 -0
- package/dist/reactive/hooks/useReactiveValue.jsx +75 -0
- package/dist/reactive/hooks/useReactiveValue.jsx.map +1 -0
- package/dist/reactive/hooks/useReactiveValueChange.d.ts +4 -0
- package/dist/reactive/hooks/useReactiveValueChange.d.ts.map +1 -0
- package/dist/reactive/hooks/useReactiveValueChange.jsx +7 -0
- package/dist/reactive/hooks/useReactiveValueChange.jsx.map +1 -0
- package/dist/reactive/hooks/useReactiveValueEvent.d.ts +5 -0
- package/dist/reactive/hooks/useReactiveValueEvent.d.ts.map +1 -0
- package/dist/reactive/hooks/useReactiveValueEvent.jsx +15 -0
- package/dist/reactive/hooks/useReactiveValueEvent.jsx.map +1 -0
- package/dist/reactive/index.d.ts +6 -0
- package/dist/reactive/index.d.ts.map +1 -0
- package/dist/reactive/index.jsx +5 -0
- package/dist/reactive/types.d.ts +17 -0
- package/dist/reactive/types.d.ts.map +1 -0
- package/dist/reactive/types.jsx +0 -0
- package/dist/reactive/updateReactive.d.ts +4 -0
- package/dist/reactive/updateReactive.d.ts.map +1 -0
- package/dist/reactive/updateReactive.jsx +8 -0
- package/dist/reactive/updateReactive.jsx.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.jsx +0 -0
- package/dist/types/interfaces/BaseScrollEvents.d.ts +40 -0
- package/dist/types/interfaces/BaseScrollEvents.d.ts.map +1 -0
- package/dist/types/interfaces/BaseScrollEvents.jsx +0 -0
- package/dist/types/interfaces/BaseUIEvents.d.ts +132 -0
- package/dist/types/interfaces/BaseUIEvents.d.ts.map +1 -0
- package/dist/types/interfaces/BaseUIEvents.jsx +0 -0
- package/dist/types/interfaces/BaseUIProps.d.ts +19 -0
- package/dist/types/interfaces/BaseUIProps.d.ts.map +1 -0
- package/dist/types/interfaces/BaseUIProps.jsx +0 -0
- package/dist/types/interfaces/BounceableInterface.d.ts +120 -0
- package/dist/types/interfaces/BounceableInterface.d.ts.map +1 -0
- package/dist/types/interfaces/BounceableInterface.jsx +0 -0
- package/dist/types/interfaces/EventMTSInterface.d.ts +1 -0
- package/dist/types/interfaces/EventMTSInterface.d.ts.map +1 -0
- package/dist/types/interfaces/EventMTSInterface.jsx +0 -0
- package/dist/types/interfaces/LazyInterface.d.ts +72 -0
- package/dist/types/interfaces/LazyInterface.d.ts.map +1 -0
- package/dist/types/interfaces/LazyInterface.jsx +0 -0
- package/dist/types/interfaces/RefreshInterface.d.ts +98 -0
- package/dist/types/interfaces/RefreshInterface.d.ts.map +1 -0
- package/dist/types/interfaces/RefreshInterface.jsx +10 -0
- package/dist/types/interfaces/RefreshInterface.jsx.map +1 -0
- package/dist/types/interfaces/index.d.ts +36 -0
- package/dist/types/interfaces/index.d.ts.map +1 -0
- package/dist/types/interfaces/index.jsx +0 -0
- package/dist/utils/common.d.ts +15 -0
- package/dist/utils/common.d.ts.map +1 -0
- package/dist/utils/common.jsx +12 -0
- package/dist/utils/common.jsx.map +1 -0
- package/dist/utils/common.test.jsx +55 -0
- package/dist/utils/common.test.jsx.map +1 -0
- package/dist/utils/convertToPx.d.ts +4 -0
- package/dist/utils/convertToPx.d.ts.map +1 -0
- package/dist/utils/convertToPx.jsx +20 -0
- package/dist/utils/convertToPx.jsx.map +1 -0
- package/dist/utils/delayFrames.d.ts +2 -0
- package/dist/utils/delayFrames.d.ts.map +1 -0
- package/dist/utils/delayFrames.jsx +12 -0
- package/dist/utils/delayFrames.jsx.map +1 -0
- package/dist/utils/getEventDetail.d.ts +23 -0
- package/dist/utils/getEventDetail.d.ts.map +1 -0
- package/dist/utils/getEventDetail.jsx +7 -0
- package/dist/utils/getEventDetail.jsx.map +1 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.jsx +12 -0
- package/dist/utils/interpolation.d.ts +40 -0
- package/dist/utils/interpolation.d.ts.map +1 -0
- package/dist/utils/interpolation.jsx +86 -0
- package/dist/utils/interpolation.jsx.map +1 -0
- package/dist/utils/interpolationJS.d.ts +39 -0
- package/dist/utils/interpolationJS.d.ts.map +1 -0
- package/dist/utils/interpolationJS.jsx +80 -0
- package/dist/utils/interpolationJS.jsx.map +1 -0
- package/dist/utils/log.d.ts +3 -0
- package/dist/utils/log.d.ts.map +1 -0
- package/dist/utils/log.jsx +10 -0
- package/dist/utils/log.jsx.map +1 -0
- package/dist/utils/mainThreadify.d.ts +2 -0
- package/dist/utils/mainThreadify.d.ts.map +1 -0
- package/dist/utils/mainThreadify.jsx +11 -0
- package/dist/utils/mainThreadify.jsx.map +1 -0
- package/dist/utils/popoverUtils.d.ts +3 -0
- package/dist/utils/popoverUtils.d.ts.map +1 -0
- package/dist/utils/popoverUtils.jsx +12 -0
- package/dist/utils/popoverUtils.jsx.map +1 -0
- package/dist/utils/renderContentWithExtraProps.d.ts +5 -0
- package/dist/utils/renderContentWithExtraProps.d.ts.map +1 -0
- package/dist/utils/renderContentWithExtraProps.jsx +10 -0
- package/dist/utils/renderContentWithExtraProps.jsx.map +1 -0
- package/dist/utils/selector.d.ts +36 -0
- package/dist/utils/selector.d.ts.map +1 -0
- package/dist/utils/selector.jsx +85 -0
- package/dist/utils/selector.jsx.map +1 -0
- package/dist/utils/selector.test.jsx +215 -0
- package/dist/utils/selector.test.jsx.map +1 -0
- package/dist/utils/version.d.ts +6 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.jsx +28 -0
- package/dist/utils/version.jsx.map +1 -0
- package/dist/utils/version.test.jsx +77 -0
- package/dist/utils/version.test.jsx.map +1 -0
- package/package.json +52 -0
- package/src/const/BaseScrollEventsMapping.ts +14 -0
- package/src/const/BaseUIEventsMapping.ts +25 -0
- package/src/const/index.ts +6 -0
- package/src/hooks/docs/useBounce.mdx +2 -0
- package/src/hooks/docs/useRefresh.mdx +2 -0
- package/src/hooks/index.ts +96 -0
- package/src/hooks/useBounce.tsx +814 -0
- package/src/hooks/useGCCollector.tsx +76 -0
- package/src/hooks/useGlobalEventListener.ts +50 -0
- package/src/hooks/useLatest.ts +16 -0
- package/src/hooks/useMemoizedFn.ts +35 -0
- package/src/hooks/usePrevious.ts +28 -0
- package/src/hooks/useRefresh.ts +1054 -0
- package/src/hooks/useRegisteredEvents.ts +69 -0
- package/src/hooks/useUnmount.ts +18 -0
- package/src/index.tsx +25 -0
- package/src/reactive/hooks/useReactiveValue.ts +132 -0
- package/src/reactive/hooks/useReactiveValueChange.ts +15 -0
- package/src/reactive/hooks/useReactiveValueEvent.ts +26 -0
- package/src/reactive/index.ts +20 -0
- package/src/reactive/types.ts +29 -0
- package/src/reactive/updateReactive.ts +16 -0
- package/src/types/index.ts +5 -0
- package/src/types/interfaces/BaseScrollEvents.ts +47 -0
- package/src/types/interfaces/BaseUIEvents.ts +142 -0
- package/src/types/interfaces/BaseUIProps.ts +22 -0
- package/src/types/interfaces/BounceableInterface.ts +125 -0
- package/src/types/interfaces/EventMTSInterface.ts +35 -0
- package/src/types/interfaces/LazyInterface.tsx +78 -0
- package/src/types/interfaces/RefreshInterface.ts +105 -0
- package/src/types/interfaces/index.ts +44 -0
- package/src/utils/common.test.ts +64 -0
- package/src/utils/common.ts +35 -0
- package/src/utils/convertToPx.ts +32 -0
- package/src/utils/delayFrames.ts +24 -0
- package/src/utils/getEventDetail.ts +36 -0
- package/src/utils/index.ts +16 -0
- package/src/utils/interpolation.ts +222 -0
- package/src/utils/interpolationJS.ts +212 -0
- package/src/utils/log.ts +16 -0
- package/src/utils/mainThreadify.ts +17 -0
- package/src/utils/popoverUtils.ts +25 -0
- package/src/utils/renderContentWithExtraProps.ts +20 -0
- package/src/utils/selector.test.ts +237 -0
- package/src/utils/selector.ts +222 -0
- package/src/utils/version.test.ts +98 -0
- package/src/utils/version.ts +50 -0
- package/tsconfig.docs.json +7 -0
- package/tsconfig.json +12 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { CommonEvent, LynxBindCatchEvent, LynxEvent, Target } from '@lynx-js/types';
|
|
2
|
+
export interface BaseUITouchEvents {
|
|
3
|
+
/**
|
|
4
|
+
* Send when a touch event is interrupted or cancelled before it is completed.
|
|
5
|
+
* @zh 当触摸事件在完成前被中断或取消时发送。
|
|
6
|
+
* @iOS
|
|
7
|
+
* @Android
|
|
8
|
+
* @Harmony
|
|
9
|
+
* @eventProperty
|
|
10
|
+
*/
|
|
11
|
+
onTouchCancel?: (e: LynxEvent<Target>['TouchCancel']) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Send when a touch-point is placed on the UI.
|
|
14
|
+
* @zh 当触摸点放置在 UI 上时发送。
|
|
15
|
+
* @iOS
|
|
16
|
+
* @Android
|
|
17
|
+
* @Harmony
|
|
18
|
+
* @eventProperty
|
|
19
|
+
*/
|
|
20
|
+
onTouchStart?: (e: LynxEvent<Target>['TouchStart']) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Send when a touch-point is removed from the UI.
|
|
23
|
+
* @zh 当触摸点从 UI 上移除时发送。
|
|
24
|
+
* @iOS
|
|
25
|
+
* @Android
|
|
26
|
+
* @Harmony
|
|
27
|
+
* @eventProperty
|
|
28
|
+
*/
|
|
29
|
+
onTouchEnd?: (e: LynxEvent<Target>['TouchEnd']) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Send when a touch-point is moving on the UI.
|
|
32
|
+
* @zh 当触摸点在 UI 上移动时发送。
|
|
33
|
+
* @iOS
|
|
34
|
+
* @Android
|
|
35
|
+
* @Harmony
|
|
36
|
+
* @eventProperty
|
|
37
|
+
*/
|
|
38
|
+
onTouchMove?: (e: LynxEvent<Target>['TouchMove']) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Send when a touch-point is held on the UI for a period of time.
|
|
41
|
+
* @zh 当触摸点在 UI 上按住一段时间后发送。
|
|
42
|
+
* @iOS
|
|
43
|
+
* @Android
|
|
44
|
+
* @Harmony
|
|
45
|
+
* @eventProperty
|
|
46
|
+
*/
|
|
47
|
+
onLongPress?: (e: LynxEvent<Target>['LongPress']) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Send when a touch-point is tapped on the UI.
|
|
50
|
+
* @zh 当触摸点在 UI 上轻触时发送。
|
|
51
|
+
* @iOS
|
|
52
|
+
* @Android
|
|
53
|
+
* @Harmony
|
|
54
|
+
* @eventProperty
|
|
55
|
+
*/
|
|
56
|
+
onTap?: (e: LynxBindCatchEvent<Target>['Tap']) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Same as onTouchCancel, but stops the event from propagating to parent elements.
|
|
59
|
+
* @zh 与 onTouchCancel 相同,但会阻止事件冒泡。
|
|
60
|
+
* @iOS
|
|
61
|
+
* @Android
|
|
62
|
+
* @Harmony
|
|
63
|
+
* @eventProperty
|
|
64
|
+
*/
|
|
65
|
+
catchTouchCancel?: (e: LynxEvent<Target>['TouchCancel']) => void;
|
|
66
|
+
/**
|
|
67
|
+
* Same as onTouchStart, but stops the event from propagating to parent elements.
|
|
68
|
+
* @zh 与 onTouchStart 相同,但会阻止事件冒泡。
|
|
69
|
+
* @iOS
|
|
70
|
+
* @Android
|
|
71
|
+
* @Harmony
|
|
72
|
+
* @eventProperty
|
|
73
|
+
*/
|
|
74
|
+
catchTouchStart?: (e: LynxEvent<Target>['TouchStart']) => void;
|
|
75
|
+
/**
|
|
76
|
+
* Same as onTouchEnd, but stops the event from propagating to parent elements.
|
|
77
|
+
* @zh 与 onTouchEnd 相同,但会阻止事件冒泡。
|
|
78
|
+
* @iOS
|
|
79
|
+
* @Android
|
|
80
|
+
* @Harmony
|
|
81
|
+
* @eventProperty
|
|
82
|
+
*/
|
|
83
|
+
catchTouchEnd?: (e: LynxEvent<Target>['TouchEnd']) => void;
|
|
84
|
+
/**
|
|
85
|
+
* Same as onTouchMove, but stops the event from propagating to parent elements.
|
|
86
|
+
* @zh 与 onTouchMove 相同,但会阻止事件冒泡。
|
|
87
|
+
* @iOS
|
|
88
|
+
* @Android
|
|
89
|
+
* @Harmony
|
|
90
|
+
* @eventProperty
|
|
91
|
+
*/
|
|
92
|
+
catchTouchMove?: (e: LynxEvent<Target>['TouchMove']) => void;
|
|
93
|
+
/**
|
|
94
|
+
* Same as onLongPress, but stops the event from propagating to parent elements.
|
|
95
|
+
* @zh 与 onLongPress 相同,但会阻止事件冒泡。
|
|
96
|
+
* @iOS
|
|
97
|
+
* @Android
|
|
98
|
+
* @Harmony
|
|
99
|
+
* @eventProperty
|
|
100
|
+
*/
|
|
101
|
+
catchLongPress?: (e: LynxEvent<Target>['LongPress']) => void;
|
|
102
|
+
}
|
|
103
|
+
export interface BaseUIExposureEvents {
|
|
104
|
+
/**
|
|
105
|
+
* Exposure event for UI
|
|
106
|
+
* @zh UI 的曝光事件。
|
|
107
|
+
* @iOS
|
|
108
|
+
* @Android
|
|
109
|
+
* @Harmony
|
|
110
|
+
*/
|
|
111
|
+
onUIAppear?: (e: CommonEvent) => void;
|
|
112
|
+
/**
|
|
113
|
+
* Disappear event for UI
|
|
114
|
+
* @zh UI 的消失事件。
|
|
115
|
+
* @iOS
|
|
116
|
+
* @Android
|
|
117
|
+
* @Harmony
|
|
118
|
+
*/
|
|
119
|
+
onUIDisappear?: (e: CommonEvent) => void;
|
|
120
|
+
}
|
|
121
|
+
export interface BaseUILayoutEvents {
|
|
122
|
+
/**
|
|
123
|
+
* Send when UI has changed viewport size.
|
|
124
|
+
* @zh 当 UI 视口大小改变时发送。
|
|
125
|
+
* @iOS
|
|
126
|
+
* @Android
|
|
127
|
+
* @Harmony
|
|
128
|
+
* @eventProperty
|
|
129
|
+
*/
|
|
130
|
+
onLayoutChange?: (e: LynxEvent<Target>['LayoutChange']) => void;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=BaseUIEvents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseUIEvents.d.ts","sourceRoot":"","sources":["../../../src/types/interfaces/BaseUIEvents.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,MAAM,EACP,MAAM,gBAAgB,CAAA;AAEvB,MAAM,WAAW,iBAAiB;IAChC;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,KAAK,IAAI,CAAA;IAC7D;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,KAAK,IAAI,CAAA;IAC3D;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,KAAK,IAAI,CAAA;IACvD;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,KAAK,IAAI,CAAA;IACzD;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,KAAK,IAAI,CAAA;IACzD;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,CAAA;IACtD;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,KAAK,IAAI,CAAA;IAChE;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,KAAK,IAAI,CAAA;IAC9D;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,KAAK,IAAI,CAAA;IAC1D;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,KAAK,IAAI,CAAA;IAC5D;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,KAAK,IAAI,CAAA;CAC7D;AAED,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,IAAI,CAAA;IACrC;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,IAAI,CAAA;CACzC;AACD,MAAM,WAAW,kBAAkB;IACjC;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,KAAK,IAAI,CAAA;CAChE"}
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface BaseUIExposureProps {
|
|
2
|
+
/**
|
|
3
|
+
* exposure-scene for global exposure
|
|
4
|
+
* @zh 用于全局曝光的 exposure-scene
|
|
5
|
+
* @iOS
|
|
6
|
+
* @Android
|
|
7
|
+
* @Harmony
|
|
8
|
+
*/
|
|
9
|
+
exposureScene?: string;
|
|
10
|
+
/**
|
|
11
|
+
* exposure-id for global exposure
|
|
12
|
+
* @zh 用于全局曝光的 exposure-id
|
|
13
|
+
* @iOS
|
|
14
|
+
* @Android
|
|
15
|
+
* @Harmony
|
|
16
|
+
*/
|
|
17
|
+
exposureID?: string;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=BaseUIProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseUIProps.d.ts","sourceRoot":"","sources":["../../../src/types/interfaces/BaseUIProps.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,mBAAmB;IAClC;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB"}
|
|
File without changes
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { ReactElement } from '@lynx-js/react';
|
|
2
|
+
export interface scrollToBouncesInfo {
|
|
3
|
+
direction: 'upper' | 'lower';
|
|
4
|
+
}
|
|
5
|
+
export interface BounceableBasicProps {
|
|
6
|
+
/**
|
|
7
|
+
* Whether to enable bounce effect
|
|
8
|
+
* @zh 是否开启回弹效果
|
|
9
|
+
* @iOS
|
|
10
|
+
* @Android
|
|
11
|
+
* @Harmony
|
|
12
|
+
*/
|
|
13
|
+
enableBounces: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Trigger bounces effect during fling
|
|
16
|
+
* @zh 在快速滑动(fling)时触发回弹效果
|
|
17
|
+
* @defaultValue false
|
|
18
|
+
* @iOS
|
|
19
|
+
* @Android
|
|
20
|
+
* @Harmony
|
|
21
|
+
*/
|
|
22
|
+
enableBounceEventInFling?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The threshold distance of upper bounces, in pixels, when triggering the scrollToBounces event
|
|
25
|
+
* @zh 触发 `scrollToBounces` 事件时,上部回弹的阈值距离(单位:px)
|
|
26
|
+
* @defaultValue 0
|
|
27
|
+
* @iOS
|
|
28
|
+
* @Android
|
|
29
|
+
* @Harmony
|
|
30
|
+
*/
|
|
31
|
+
startBounceTriggerDistance?: number;
|
|
32
|
+
/**
|
|
33
|
+
* The threshold distance of lower bounces, in pixels, when triggering the scrollToBounces event
|
|
34
|
+
* @zh 触发 `scrollToBounces` 事件时,下部回弹的阈值距离(单位:px)
|
|
35
|
+
* @defaultValue 0
|
|
36
|
+
* @iOS
|
|
37
|
+
* @Android
|
|
38
|
+
* @Harmony
|
|
39
|
+
*/
|
|
40
|
+
endBounceTriggerDistance?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Content of upper bounces view, which will be displayed during the upper bouncing effect.
|
|
43
|
+
* @zh 上部回弹视图的内容,将在上部回弹效果期间显示。
|
|
44
|
+
* @iOS
|
|
45
|
+
* @Android
|
|
46
|
+
* @Harmony
|
|
47
|
+
*/
|
|
48
|
+
upperBounceItem?: ReactElement;
|
|
49
|
+
/**
|
|
50
|
+
* Content of lower bounces view, which will be displayed during the lower bouncing effect.
|
|
51
|
+
* @zh 下部回弹视图的内容,将在下部回弹效果期间显示。
|
|
52
|
+
* @iOS
|
|
53
|
+
* @Android
|
|
54
|
+
* @Harmony
|
|
55
|
+
*/
|
|
56
|
+
lowerBounceItem?: ReactElement;
|
|
57
|
+
/**
|
|
58
|
+
* Whether the scrollable container can bounce when the content area of the scrollable container is smaller than the viewport area.
|
|
59
|
+
* @zh 当可滚动容器的内容区域小于视口区域时,是否允许容器回弹。
|
|
60
|
+
* @defaultValue true
|
|
61
|
+
* @iOS
|
|
62
|
+
* @Android
|
|
63
|
+
* @Harmony
|
|
64
|
+
*/
|
|
65
|
+
alwaysBouncing?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* The direction of the bounce effect. 'both' for bouncing on both ends, 'none' to disable bounce, and 'upper'/'lower' for bouncing on either end
|
|
68
|
+
* @zh 回弹效果的方向。'both' 表示两端都回弹,'none' 表示禁用回弹,'upper'/'lower' 表示只在上端或下端回弹。
|
|
69
|
+
* @defaultValue 'both'
|
|
70
|
+
* @iOS
|
|
71
|
+
* @Android
|
|
72
|
+
* @Harmony
|
|
73
|
+
*/
|
|
74
|
+
singleSidedBounce?: 'upper' | 'lower' | 'both' | 'iOSBounces' | 'none';
|
|
75
|
+
/**
|
|
76
|
+
* Unit: px. Optional size hint for bounce effect. Recommended when used in List or <list/>.
|
|
77
|
+
* @zh 单位:px。可选的回弹效果尺寸提示。在列表或 `<list/>` 中使用时推荐设置。
|
|
78
|
+
* @Android
|
|
79
|
+
* @iOS
|
|
80
|
+
* @Harmony
|
|
81
|
+
*/
|
|
82
|
+
estimatedHeight?: number;
|
|
83
|
+
/**
|
|
84
|
+
* Unit: px. Optional size hint for bounce effect. Recommended when used in List or <list/>.
|
|
85
|
+
* @zh 单位:px。可选的回弹效果尺寸提示。在列表或 `<list/>` 中使用时推荐设置。
|
|
86
|
+
* @Android
|
|
87
|
+
* @iOS
|
|
88
|
+
* @Harmony
|
|
89
|
+
*/
|
|
90
|
+
estimatedWidth?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Display debug logs. Open it when you find a bug.
|
|
93
|
+
* @zh 显示调试日志。当您发现错误时,请打开此选项。
|
|
94
|
+
* @defaultValue false
|
|
95
|
+
* @iOS
|
|
96
|
+
* @Android
|
|
97
|
+
* @Harmony
|
|
98
|
+
*/
|
|
99
|
+
debugLog?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* requestAnimationFrame don't work under lynx version 2.15.2. This switch should be opened when the version is higher than 2.15.2.
|
|
102
|
+
* @zh `requestAnimationFrame` 在 lynx 2.15.2 以下版本中不起作用。当版本高于 2.15.2 时,应打开此开关。
|
|
103
|
+
* @defaultValue false
|
|
104
|
+
* @iOS
|
|
105
|
+
* @Android
|
|
106
|
+
* @Harmony
|
|
107
|
+
*/
|
|
108
|
+
validAnimationVersion?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* When bounces effect is triggered and the bounce distance is larger than startBounceDistance or endBounceDistance on the upper or lower side, the scrollToBounces event will be triggered.
|
|
111
|
+
* @zh 当触发回弹效果并且回弹距离在上侧或下侧大于 `startBounceDistance` 或 `endBounceDistance` 时,将触发 `scrollToBounces` 事件。
|
|
112
|
+
* @defaultValue 0
|
|
113
|
+
* @eventProperty
|
|
114
|
+
* @iOS
|
|
115
|
+
* @Android
|
|
116
|
+
* @Harmony
|
|
117
|
+
*/
|
|
118
|
+
onScrollToBounces?: (e: scrollToBouncesInfo) => void;
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=BounceableInterface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BounceableInterface.d.ts","sourceRoot":"","sources":["../../../src/types/interfaces/BounceableInterface.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,OAAO,GAAG,OAAO,CAAA;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,aAAa,EAAE,OAAO,CAAA;IACtB;;;;;;;OAOG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC;;;;;;;OAOG;IACH,0BAA0B,CAAC,EAAE,MAAM,CAAA;IACnC;;;;;;;OAOG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,YAAY,CAAA;IAC9B;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,YAAY,CAAA;IAC9B;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,GAAG,MAAM,CAAA;IACtE;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;;;;OAOG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B;;;;;;;;OAQG;IACH,iBAAiB,CAAC,EAAE,CAAC,CAAC,EAAE,mBAAmB,KAAK,IAAI,CAAA;CACrD"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=EventMTSInterface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventMTSInterface.d.ts","sourceRoot":"","sources":["../../../src/types/interfaces/EventMTSInterface.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { CSSProperties } from '@lynx-js/types';
|
|
2
|
+
export interface EnableLazyMode {
|
|
3
|
+
/**
|
|
4
|
+
* When enabled, only the items that are about to enter the viewport are rendered, reducing initial load time and memory usage; remaining items are rendered as they approach visibility during scroll.
|
|
5
|
+
* @zh 启用懒渲染。只有当用户滚动到可见区域时,才会渲染 items,从而减少初始加载时间和内存使用。
|
|
6
|
+
* @defaultValue true
|
|
7
|
+
* @Android
|
|
8
|
+
* @iOS
|
|
9
|
+
*/
|
|
10
|
+
enableLazy: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Be used to mark the exposure timing of lazy loading. Please ensure that it is unique throughout the page.
|
|
13
|
+
* @zh 用于标记懒加载的曝光时机。请确保在整个页面中是唯一的。
|
|
14
|
+
* @defaultValue undefined
|
|
15
|
+
* @Android
|
|
16
|
+
* @iOS
|
|
17
|
+
*/
|
|
18
|
+
scene: string;
|
|
19
|
+
/**
|
|
20
|
+
* Estimated height and width of the items need to be set.
|
|
21
|
+
* @zh 需要设置项目的预估高度和宽度。
|
|
22
|
+
* @defaultValue undefined
|
|
23
|
+
* @Android
|
|
24
|
+
* @iOS
|
|
25
|
+
*/
|
|
26
|
+
estimatedItemStyle: CSSProperties;
|
|
27
|
+
/**
|
|
28
|
+
* exposure-screen-margin-top
|
|
29
|
+
* @zh 曝光屏幕上边距
|
|
30
|
+
* @defaultValue '10px'
|
|
31
|
+
* @Android
|
|
32
|
+
* @iOS
|
|
33
|
+
*/
|
|
34
|
+
exposureTop?: `${number}px` | `${number}rpx`;
|
|
35
|
+
/**
|
|
36
|
+
* exposure-screen-margin-bottom
|
|
37
|
+
* @zh 曝光屏幕下边距
|
|
38
|
+
* @defaultValue '10px'
|
|
39
|
+
* @Android
|
|
40
|
+
* @iOS
|
|
41
|
+
*/
|
|
42
|
+
exposureBottom?: `${number}px` | `${number}rpx`;
|
|
43
|
+
/**
|
|
44
|
+
* exposure-screen-margin-left
|
|
45
|
+
* @zh 曝光屏幕左边距
|
|
46
|
+
* @defaultValue '10px'
|
|
47
|
+
* @Android
|
|
48
|
+
* @iOS
|
|
49
|
+
*/
|
|
50
|
+
exposureLeft?: `${number}px` | `${number}rpx`;
|
|
51
|
+
/**
|
|
52
|
+
* exposure-screen-margin-right
|
|
53
|
+
* @zh 曝光屏幕右边距
|
|
54
|
+
* @defaultValue '10px'
|
|
55
|
+
* @Android
|
|
56
|
+
* @iOS
|
|
57
|
+
*/
|
|
58
|
+
exposureRight?: `${number}px` | `${number}rpx`;
|
|
59
|
+
/**
|
|
60
|
+
* Estimated first screen item count for lazy rendering. Remaining children will complete rendering based on exposure. When this estimate is small, it may cause a blank screen phenomenon where some nodes exist on the first screen.
|
|
61
|
+
* @zh 懒加载的首屏预估 item 数量。剩余子节点将根据曝光情况完成渲染。当此预估值较小时,可能会导致首屏存在部分节点白屏的现象。
|
|
62
|
+
* @defaultValue 1
|
|
63
|
+
* @Android
|
|
64
|
+
* @iOS
|
|
65
|
+
*/
|
|
66
|
+
firstScreenItemCount?: number;
|
|
67
|
+
}
|
|
68
|
+
export interface DisableLazyMode {
|
|
69
|
+
enableLazy: false;
|
|
70
|
+
}
|
|
71
|
+
export type LazyOptions = EnableLazyMode | DisableLazyMode;
|
|
72
|
+
//# sourceMappingURL=LazyInterface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LazyInterface.d.ts","sourceRoot":"","sources":["../../../src/types/interfaces/LazyInterface.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnD,MAAM,WAAW,cAAc;IAC7B;;;;;;OAMG;IACH,UAAU,EAAE,OAAO,CAAA;IACnB;;;;;;OAMG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;;;;OAMG;IACH,kBAAkB,EAAE,aAAa,CAAA;IACjC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,GAAG,MAAM,IAAI,GAAG,GAAG,MAAM,KAAK,CAAA;IAC5C;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,GAAG,MAAM,IAAI,GAAG,GAAG,MAAM,KAAK,CAAA;IAC/C;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,GAAG,MAAM,IAAI,GAAG,GAAG,MAAM,KAAK,CAAA;IAC7C;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,GAAG,MAAM,IAAI,GAAG,GAAG,MAAM,KAAK,CAAA;IAC9C;;;;;;OAMG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,KAAK,CAAA;CAClB;AAED,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG,eAAe,CAAA"}
|
|
File without changes
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { ReactElement } from '@lynx-js/react';
|
|
2
|
+
export interface RefreshEvent {
|
|
3
|
+
triggeredBy: 'startRefresh' | 'drag';
|
|
4
|
+
}
|
|
5
|
+
export interface refreshOffsetEvent {
|
|
6
|
+
offset: number;
|
|
7
|
+
headerSize: number;
|
|
8
|
+
isDragging: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface headerReleased {
|
|
11
|
+
offset: number;
|
|
12
|
+
headerSize: number;
|
|
13
|
+
}
|
|
14
|
+
export declare enum RefreshState {
|
|
15
|
+
IDLE = 0,// Hide
|
|
16
|
+
OVER_DRAG_RELEASE = 1,// Drag over refresh header size and release
|
|
17
|
+
REFRESHING = 2,// During refresh
|
|
18
|
+
DRAGGING = 3
|
|
19
|
+
}
|
|
20
|
+
export interface RefreshStateChange {
|
|
21
|
+
/**
|
|
22
|
+
* Status of refreshHeader
|
|
23
|
+
* @zh 刷新头的状态
|
|
24
|
+
* @Android
|
|
25
|
+
* @iOS
|
|
26
|
+
* @Harmony
|
|
27
|
+
*/
|
|
28
|
+
state: RefreshState;
|
|
29
|
+
}
|
|
30
|
+
export interface RefreshProps {
|
|
31
|
+
/**
|
|
32
|
+
* Enable refresh
|
|
33
|
+
* @zh 启用刷新
|
|
34
|
+
* @Android
|
|
35
|
+
* @iOS
|
|
36
|
+
* @Harmony
|
|
37
|
+
*/
|
|
38
|
+
enableRefresh: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* header children
|
|
41
|
+
* @zh 头部内容
|
|
42
|
+
* @Android
|
|
43
|
+
* @iOS
|
|
44
|
+
* @Harmony
|
|
45
|
+
*/
|
|
46
|
+
headerContent: ReactElement;
|
|
47
|
+
/**
|
|
48
|
+
* Display debug logs. Open it when you find a bug.
|
|
49
|
+
* @zh 显示调试日志。当您发现错误时请打开它。
|
|
50
|
+
* @defaultValue false
|
|
51
|
+
* @Android
|
|
52
|
+
* @iOS
|
|
53
|
+
* @Harmony
|
|
54
|
+
*/
|
|
55
|
+
debugLog?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* requestAnimationFrame don't work under lynx version 2.15.2. This switch should be opened when the version is higher than 2.15.2.
|
|
58
|
+
* @zh requestAnimationFrame 在 lynx 2.15.2 以下版本中不起作用。当版本高于 2.15.2 时,应打开此开关。
|
|
59
|
+
* @defaultValue false
|
|
60
|
+
* @Android
|
|
61
|
+
* @iOS
|
|
62
|
+
* @Harmony
|
|
63
|
+
*/
|
|
64
|
+
validAnimationVersion?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Send when refresh started.
|
|
67
|
+
* @zh 刷新开始时发送。
|
|
68
|
+
* @Android
|
|
69
|
+
* @iOS
|
|
70
|
+
* @Harmony
|
|
71
|
+
*/
|
|
72
|
+
onStartRefresh?: (e: RefreshEvent) => void;
|
|
73
|
+
/**
|
|
74
|
+
* Send when header shows and moves.
|
|
75
|
+
* @zh 当头部显示和移动时发送。
|
|
76
|
+
* @Android
|
|
77
|
+
* @iOS
|
|
78
|
+
* @Harmony
|
|
79
|
+
*/
|
|
80
|
+
onRefreshOffsetChange?: (e: refreshOffsetEvent) => void;
|
|
81
|
+
/**
|
|
82
|
+
* Send during refresh dragging and header is visible.
|
|
83
|
+
* @zh 在刷新拖动期间并且头部可见时发送。
|
|
84
|
+
* @Android
|
|
85
|
+
* @iOS
|
|
86
|
+
* @Harmony
|
|
87
|
+
*/
|
|
88
|
+
onRefreshStateChange?: (e: RefreshStateChange) => void;
|
|
89
|
+
/**
|
|
90
|
+
* Send when drag is end.
|
|
91
|
+
* @zh 拖动结束时发送。
|
|
92
|
+
* @Android
|
|
93
|
+
* @iOS
|
|
94
|
+
* @Harmony
|
|
95
|
+
*/
|
|
96
|
+
onHeaderReleased?: (e: headerReleased) => void;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=RefreshInterface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefreshInterface.d.ts","sourceRoot":"","sources":["../../../src/types/interfaces/RefreshInterface.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,cAAc,GAAG,MAAM,CAAA;CACrC;AACD,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,OAAO,CAAA;CACpB;AACD,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,oBAAY,YAAY;IACtB,IAAI,IAAI,CAAE,OAAO;IACjB,iBAAiB,IAAI,CAAE,4CAA4C;IACnE,UAAU,IAAI,CAAE,iBAAiB;IACjC,QAAQ,IAAI;CACb;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;;OAMG;IACH,KAAK,EAAE,YAAY,CAAA;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B;;;;;;OAMG;IACH,aAAa,EAAE,OAAO,CAAA;IACtB;;;;;;OAMG;IACH,aAAa,EAAE,YAAY,CAAA;IAC3B;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;;;;OAOG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,KAAK,IAAI,CAAA;IAC1C;;;;;;OAMG;IACH,qBAAqB,CAAC,EAAE,CAAC,CAAC,EAAE,kBAAkB,KAAK,IAAI,CAAA;IACvD;;;;;;OAMG;IACH,oBAAoB,CAAC,EAAE,CAAC,CAAC,EAAE,kBAAkB,KAAK,IAAI,CAAA;IACtD;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAA;CAC/C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var RefreshInterface_RefreshState = /*#__PURE__*/ function(RefreshState) {
|
|
2
|
+
RefreshState[RefreshState["IDLE"] = 0] = "IDLE";
|
|
3
|
+
RefreshState[RefreshState["OVER_DRAG_RELEASE"] = 1] = "OVER_DRAG_RELEASE";
|
|
4
|
+
RefreshState[RefreshState["REFRESHING"] = 2] = "REFRESHING";
|
|
5
|
+
RefreshState[RefreshState["DRAGGING"] = 3] = "DRAGGING";
|
|
6
|
+
return RefreshState;
|
|
7
|
+
}({});
|
|
8
|
+
export { RefreshInterface_RefreshState as RefreshState };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=RefreshInterface.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types/interfaces/RefreshInterface.jsx","sources":["webpack://@lynx-js/lynx-ui-common/./src/types/interfaces/RefreshInterface.ts"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport type { ReactElement } from '@lynx-js/react'\n\nexport interface RefreshEvent {\n triggeredBy: 'startRefresh' | 'drag'\n}\nexport interface refreshOffsetEvent {\n offset: number\n headerSize: number\n isDragging: boolean\n}\nexport interface headerReleased {\n offset: number\n headerSize: number\n}\n\nexport enum RefreshState {\n IDLE = 0, // Hide\n OVER_DRAG_RELEASE = 1, // Drag over refresh header size and release\n REFRESHING = 2, // During refresh\n DRAGGING = 3, // Dragging\n}\n\nexport interface RefreshStateChange {\n /**\n * Status of refreshHeader\n * @zh 刷新头的状态\n * @Android\n * @iOS\n * @Harmony\n */\n state: RefreshState\n}\n\nexport interface RefreshProps {\n /**\n * Enable refresh\n * @zh 启用刷新\n * @Android\n * @iOS\n * @Harmony\n */\n enableRefresh: boolean\n /**\n * header children\n * @zh 头部内容\n * @Android\n * @iOS\n * @Harmony\n */\n headerContent: ReactElement\n /**\n * Display debug logs. Open it when you find a bug.\n * @zh 显示调试日志。当您发现错误时请打开它。\n * @defaultValue false\n * @Android\n * @iOS\n * @Harmony\n */\n debugLog?: boolean\n /**\n * requestAnimationFrame don't work under lynx version 2.15.2. This switch should be opened when the version is higher than 2.15.2.\n * @zh requestAnimationFrame 在 lynx 2.15.2 以下版本中不起作用。当版本高于 2.15.2 时,应打开此开关。\n * @defaultValue false\n * @Android\n * @iOS\n * @Harmony\n */\n validAnimationVersion?: boolean\n /**\n * Send when refresh started.\n * @zh 刷新开始时发送。\n * @Android\n * @iOS\n * @Harmony\n */\n onStartRefresh?: (e: RefreshEvent) => void\n /**\n * Send when header shows and moves.\n * @zh 当头部显示和移动时发送。\n * @Android\n * @iOS\n * @Harmony\n */\n onRefreshOffsetChange?: (e: refreshOffsetEvent) => void\n /**\n * Send during refresh dragging and header is visible.\n * @zh 在刷新拖动期间并且头部可见时发送。\n * @Android\n * @iOS\n * @Harmony\n */\n onRefreshStateChange?: (e: RefreshStateChange) => void\n /**\n * Send when drag is end.\n * @zh 拖动结束时发送。\n * @Android\n * @iOS\n * @Harmony\n */\n onHeaderReleased?: (e: headerReleased) => void\n}\n"],"names":["RefreshState"],"mappings":"AAmBO,IAAKA,gCAAYA,WAAAA,GAAAA,SAAZA,YAAY;;;;;WAAZA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { CSSProperties } from '@lynx-js/types';
|
|
2
|
+
export type * from './BaseScrollEvents';
|
|
3
|
+
export type * from './BaseUIEvents';
|
|
4
|
+
export type * from './BaseUIProps';
|
|
5
|
+
export type * from './BounceableInterface';
|
|
6
|
+
export type * from './LazyInterface';
|
|
7
|
+
export type * from './RefreshInterface';
|
|
8
|
+
export interface Point {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
}
|
|
12
|
+
export interface Rect {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
left: number;
|
|
16
|
+
top: number;
|
|
17
|
+
}
|
|
18
|
+
export interface ComponentBasicProps {
|
|
19
|
+
/**
|
|
20
|
+
* className
|
|
21
|
+
* @zh 类名
|
|
22
|
+
* @Android
|
|
23
|
+
* @iOS
|
|
24
|
+
* @Harmony
|
|
25
|
+
*/
|
|
26
|
+
className?: string;
|
|
27
|
+
/**
|
|
28
|
+
* style
|
|
29
|
+
* @zh 样式
|
|
30
|
+
* @Android
|
|
31
|
+
* @iOS
|
|
32
|
+
* @Harmony
|
|
33
|
+
*/
|
|
34
|
+
style?: CSSProperties;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/interfaces/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnD,mBAAmB,oBAAoB,CAAA;AACvC,mBAAmB,gBAAgB,CAAA;AACnC,mBAAmB,eAAe,CAAA;AAClC,mBAAmB,uBAAuB,CAAA;AAC1C,mBAAmB,iBAAiB,CAAA;AACpC,mBAAmB,oBAAoB,CAAA;AAEvC,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;CACZ;AAGD,MAAM,WAAW,mBAAmB;IAClC;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB"}
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lodash like get, accessing object by path. Otherwise return defaultValue
|
|
3
|
+
* Where path can be 'a[0].b.c', 'a.0.b.c' or ['a','0','b','c']
|
|
4
|
+
* @param obj Object to get property from
|
|
5
|
+
* @param path Path of property
|
|
6
|
+
* @param defaultValue Optional. Default value
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function get(obj: unknown, path: string, defaultValue?: unknown): unknown;
|
|
10
|
+
/**
|
|
11
|
+
* Empty function that does nothing.
|
|
12
|
+
* Useful as a default callback or placeholder function.
|
|
13
|
+
*/
|
|
14
|
+
export declare const noop: () => void;
|
|
15
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAWA;;;;;;;GAOG;AACH,wBAAgB,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,WAOrE;AAED;;;GAGG;AACH,eAAO,MAAM,IAAI,QAAO,IAEvB,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function _basePath(path) {
|
|
2
|
+
if (Array.isArray(path)) return path;
|
|
3
|
+
return path.replace(/\[/g, '.').replace(/\]/g, '').split('.');
|
|
4
|
+
}
|
|
5
|
+
function get(obj, path, defaultValue) {
|
|
6
|
+
if ('object' != typeof obj) return defaultValue;
|
|
7
|
+
return _basePath(path).reduce((o, k)=>o?.[k], obj) ?? defaultValue;
|
|
8
|
+
}
|
|
9
|
+
const noop = ()=>{};
|
|
10
|
+
export { get, noop };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=common.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils/common.jsx","sources":["webpack://@lynx-js/lynx-ui-common/./src/utils/common.ts"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nfunction _basePath(path: unknown[] | string) {\n if (Array.isArray(path)) {\n return path\n }\n return path.replace(/\\[/g, '.').replace(/\\]/g, '').split('.')\n}\n\n/**\n * Lodash like get, accessing object by path. Otherwise return defaultValue\n * Where path can be 'a[0].b.c', 'a.0.b.c' or ['a','0','b','c']\n * @param obj Object to get property from\n * @param path Path of property\n * @param defaultValue Optional. Default value\n * @returns\n */\nexport function get(obj: unknown, path: string, defaultValue?: unknown) {\n if (typeof obj !== 'object') {\n return defaultValue\n }\n // @ts-expect-error: o is unknown\n return _basePath(path).reduce((o: unknown, k: string) => o?.[k], obj)\n ?? defaultValue\n}\n\n/**\n * Empty function that does nothing.\n * Useful as a default callback or placeholder function.\n */\nexport const noop = (): void => {\n // Intentionally empty\n}\n"],"names":["_basePath","path","Array","get","obj","defaultValue","o","k","noop"],"mappings":"AAIA,SAASA,UAAUC,IAAwB;IACzC,IAAIC,MAAM,OAAO,CAACD,OAChB,OAAOA;IAET,OAAOA,KAAK,OAAO,CAAC,OAAO,KAAK,OAAO,CAAC,OAAO,IAAI,KAAK,CAAC;AAC3D;AAUO,SAASE,IAAIC,GAAY,EAAEH,IAAY,EAAEI,YAAsB;IACpE,IAAI,AAAe,YAAf,OAAOD,KACT,OAAOC;IAGT,OAAOL,UAAUC,MAAM,MAAM,CAAC,CAACK,GAAYC,IAAcD,GAAG,CAACC,EAAE,EAAEH,QAC5DC;AACP;AAMO,MAAMG,OAAO,KAEpB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { get, noop } from "./common.jsx";
|
|
3
|
+
describe('common utils', ()=>{
|
|
4
|
+
describe('get', ()=>{
|
|
5
|
+
const testObj = {
|
|
6
|
+
a: {
|
|
7
|
+
b: {
|
|
8
|
+
c: 'value'
|
|
9
|
+
},
|
|
10
|
+
arr: [
|
|
11
|
+
{
|
|
12
|
+
nested: 'array-value'
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
nullValue: null,
|
|
17
|
+
undefinedValue: void 0
|
|
18
|
+
};
|
|
19
|
+
it('should return value for dot notation path', ()=>{
|
|
20
|
+
expect(get(testObj, 'a.b.c')).toBe('value');
|
|
21
|
+
});
|
|
22
|
+
it('should return value for bracket notation path', ()=>{
|
|
23
|
+
expect(get(testObj, 'a[b][c]')).toBe('value');
|
|
24
|
+
});
|
|
25
|
+
it('should return value for array index path', ()=>{
|
|
26
|
+
expect(get(testObj, 'a.arr[0].nested')).toBe('array-value');
|
|
27
|
+
expect(get(testObj, 'a.arr.0.nested')).toBe('array-value');
|
|
28
|
+
});
|
|
29
|
+
it('should return default value when path does not exist', ()=>{
|
|
30
|
+
expect(get(testObj, 'a.b.d', 'default')).toBe('default');
|
|
31
|
+
expect(get(testObj, 'x.y.z', 'default')).toBe('default');
|
|
32
|
+
});
|
|
33
|
+
it('should return undefined when no default value is provided and path does not exist', ()=>{
|
|
34
|
+
expect(get(testObj, 'a.b.d')).toBeUndefined();
|
|
35
|
+
});
|
|
36
|
+
it('should handle null and undefined values', ()=>{
|
|
37
|
+
expect(get(testObj, 'nullValue.something', 'default')).toBe('default');
|
|
38
|
+
expect(get(testObj, 'undefinedValue.something', 'default')).toBe('default');
|
|
39
|
+
});
|
|
40
|
+
it('should return default value when input is not an object', ()=>{
|
|
41
|
+
expect(get(null, 'any.path', 'default')).toBe('default');
|
|
42
|
+
expect(get(void 0, 'any.path', 'default')).toBe('default');
|
|
43
|
+
expect(get('string', 'any.path', 'default')).toBe('default');
|
|
44
|
+
expect(get(123, 'any.path', 'default')).toBe('default');
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
describe('noop', ()=>{
|
|
48
|
+
it('should be a function that returns undefined', ()=>{
|
|
49
|
+
expect(typeof noop).toBe('function');
|
|
50
|
+
expect(noop()).toBeUndefined();
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=common.test.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils/common.test.jsx","sources":["webpack://@lynx-js/lynx-ui-common/./src/utils/common.test.ts"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport { describe, it, expect } from 'vitest'\nimport { get, noop } from './common'\n\ndescribe('common utils', () => {\n describe('get', () => {\n const testObj = {\n a: {\n b: {\n c: 'value',\n },\n arr: [{ nested: 'array-value' }],\n },\n nullValue: null,\n undefinedValue: undefined,\n }\n\n it('should return value for dot notation path', () => {\n expect(get(testObj, 'a.b.c')).toBe('value')\n })\n\n it('should return value for bracket notation path', () => {\n expect(get(testObj, 'a[b][c]')).toBe('value')\n })\n\n it('should return value for array index path', () => {\n expect(get(testObj, 'a.arr[0].nested')).toBe('array-value')\n expect(get(testObj, 'a.arr.0.nested')).toBe('array-value')\n })\n\n it('should return default value when path does not exist', () => {\n expect(get(testObj, 'a.b.d', 'default')).toBe('default')\n expect(get(testObj, 'x.y.z', 'default')).toBe('default')\n })\n\n it('should return undefined when no default value is provided and path does not exist', () => {\n expect(get(testObj, 'a.b.d')).toBeUndefined()\n })\n\n it('should handle null and undefined values', () => {\n expect(get(testObj, 'nullValue.something', 'default')).toBe('default')\n expect(get(testObj, 'undefinedValue.something', 'default')).toBe(\n 'default',\n )\n })\n\n it('should return default value when input is not an object', () => {\n expect(get(null, 'any.path', 'default')).toBe('default')\n expect(get(undefined, 'any.path', 'default')).toBe('default')\n expect(get('string', 'any.path', 'default')).toBe('default')\n expect(get(123, 'any.path', 'default')).toBe('default')\n })\n })\n\n describe('noop', () => {\n it('should be a function that returns undefined', () => {\n expect(typeof noop).toBe('function')\n expect(noop()).toBeUndefined()\n })\n })\n})\n"],"names":["describe","testObj","undefined","it","expect","get","noop"],"mappings":";;AAOAA,SAAS,gBAAgB;IACvBA,SAAS,OAAO;QACd,MAAMC,UAAU;YACd,GAAG;gBACD,GAAG;oBACD,GAAG;gBACL;gBACA,KAAK;oBAAC;wBAAE,QAAQ;oBAAc;iBAAE;YAClC;YACA,WAAW;YACX,gBAAgBC;QAClB;QAEAC,GAAG,6CAA6C;YAC9CC,OAAOC,IAAIJ,SAAS,UAAU,IAAI,CAAC;QACrC;QAEAE,GAAG,iDAAiD;YAClDC,OAAOC,IAAIJ,SAAS,YAAY,IAAI,CAAC;QACvC;QAEAE,GAAG,4CAA4C;YAC7CC,OAAOC,IAAIJ,SAAS,oBAAoB,IAAI,CAAC;YAC7CG,OAAOC,IAAIJ,SAAS,mBAAmB,IAAI,CAAC;QAC9C;QAEAE,GAAG,wDAAwD;YACzDC,OAAOC,IAAIJ,SAAS,SAAS,YAAY,IAAI,CAAC;YAC9CG,OAAOC,IAAIJ,SAAS,SAAS,YAAY,IAAI,CAAC;QAChD;QAEAE,GAAG,qFAAqF;YACtFC,OAAOC,IAAIJ,SAAS,UAAU,aAAa;QAC7C;QAEAE,GAAG,2CAA2C;YAC5CC,OAAOC,IAAIJ,SAAS,uBAAuB,YAAY,IAAI,CAAC;YAC5DG,OAAOC,IAAIJ,SAAS,4BAA4B,YAAY,IAAI,CAC9D;QAEJ;QAEAE,GAAG,2DAA2D;YAC5DC,OAAOC,IAAI,MAAM,YAAY,YAAY,IAAI,CAAC;YAC9CD,OAAOC,IAAIH,QAAW,YAAY,YAAY,IAAI,CAAC;YACnDE,OAAOC,IAAI,UAAU,YAAY,YAAY,IAAI,CAAC;YAClDD,OAAOC,IAAI,KAAK,YAAY,YAAY,IAAI,CAAC;QAC/C;IACF;IAEAL,SAAS,QAAQ;QACfG,GAAG,+CAA+C;YAChDC,OAAO,OAAOE,MAAM,IAAI,CAAC;YACzBF,OAAOE,QAAQ,aAAa;QAC9B;IACF;AACF"}
|