@symbiote-native/angular 3.3.0 → 3.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/babel-register-composed.cjs +1 -0
- package/build/angular/accessibility-inputs.d.ts +2 -1
- package/build/angular/accessibility-inputs.js +4 -1
- package/build/angular/accessibility-inputs.js.map +1 -1
- package/build/angular/callback-host.d.ts +1 -1
- package/build/angular/callback-host.js +57 -9
- package/build/angular/callback-host.js.map +1 -1
- package/build/angular/components/flat-list/flat-list-handle.d.ts +35 -0
- package/build/angular/components/flat-list/flat-list-handle.js +48 -0
- package/build/angular/components/flat-list/flat-list-handle.js.map +1 -0
- package/build/angular/components/flat-list/flat-list-template.d.ts +1 -1
- package/build/angular/components/flat-list/flat-list-template.js +16 -0
- package/build/angular/components/flat-list/flat-list-template.js.map +1 -1
- package/build/angular/components/flat-list/index.d.ts +6 -30
- package/build/angular/components/flat-list/index.js +6 -36
- package/build/angular/components/flat-list/index.js.map +1 -1
- package/build/angular/components/image-inputs.d.ts +4 -0
- package/build/angular/components/image-inputs.js +81 -0
- package/build/angular/components/image-inputs.js.map +1 -0
- package/build/angular/components/image-props-resolve.d.ts +3 -0
- package/build/angular/components/image-props-resolve.js +133 -0
- package/build/angular/components/image-props-resolve.js.map +1 -0
- package/build/angular/components/image-shared.d.ts +8 -6
- package/build/angular/components/image-shared.js +23 -212
- package/build/angular/components/image-shared.js.map +1 -1
- package/build/angular/components/input-accessory-view-props.d.ts +4 -4
- package/build/angular/components/keyboard-avoiding-view/index.d.ts +3 -6
- package/build/angular/components/keyboard-avoiding-view/index.js +29 -56
- package/build/angular/components/keyboard-avoiding-view/index.js.map +1 -1
- package/build/angular/components/layout-conformance-props.d.ts +4 -0
- package/build/angular/components/layout-conformance-props.js +2 -0
- package/build/angular/components/layout-conformance-props.js.map +1 -0
- package/build/angular/components/modal/index.d.ts +6 -5
- package/build/angular/components/modal/index.js +17 -2
- package/build/angular/components/modal/index.js.map +1 -1
- package/build/angular/components/refresh-control-props.d.ts +7 -7
- package/build/angular/components/scroll-view-props.d.ts +8 -5
- package/build/angular/components/section-list/index.d.ts +17 -8
- package/build/angular/components/section-list/index.js +37 -28
- package/build/angular/components/section-list/index.js.map +1 -1
- package/build/angular/components/touchable-props.d.ts +2 -2
- package/build/angular/components/virtualized-list/cell-renderer-context.d.ts +12 -0
- package/build/angular/components/virtualized-list/cell-renderer-context.js +16 -0
- package/build/angular/components/virtualized-list/cell-renderer-context.js.map +1 -0
- package/build/angular/components/virtualized-list/directives.d.ts +26 -6
- package/build/angular/components/virtualized-list/directives.js +59 -5
- package/build/angular/components/virtualized-list/directives.js.map +1 -1
- package/build/angular/components/virtualized-list/index.d.ts +19 -15
- package/build/angular/components/virtualized-list/index.js +91 -61
- package/build/angular/components/virtualized-list/index.js.map +1 -1
- package/build/angular/components/virtualized-list/list-bags.d.ts +5 -1
- package/build/angular/components/virtualized-list/list-bags.js +31 -19
- package/build/angular/components/virtualized-list/list-bags.js.map +1 -1
- package/build/angular/components/virtualized-list/list-effects.d.ts +2 -2
- package/build/angular/components/virtualized-list/list-effects.js +17 -27
- package/build/angular/components/virtualized-list/list-effects.js.map +1 -1
- package/build/angular/components/virtualized-list/list-handle.d.ts +4 -1
- package/build/angular/components/virtualized-list/list-handle.js +13 -3
- package/build/angular/components/virtualized-list/list-handle.js.map +1 -1
- package/build/angular/components/virtualized-list/list-inputs.d.ts +19 -5
- package/build/angular/components/virtualized-list/list-inputs.js +47 -4
- package/build/angular/components/virtualized-list/list-inputs.js.map +1 -1
- package/build/angular/components/virtualized-list/list-props.d.ts +9 -3
- package/build/angular/components/virtualized-list/list-rows.d.ts +25 -0
- package/build/angular/components/virtualized-list/list-rows.js +25 -0
- package/build/angular/components/virtualized-list/list-rows.js.map +1 -0
- package/build/angular/components/virtualized-list/list-styles.d.ts +4 -0
- package/build/angular/components/virtualized-list/list-styles.js +10 -2
- package/build/angular/components/virtualized-list/list-styles.js.map +1 -1
- package/build/angular/components/virtualized-list/list-template.d.ts +1 -1
- package/build/angular/components/virtualized-list/list-template.js +159 -73
- package/build/angular/components/virtualized-list/list-template.js.map +1 -1
- package/build/angular/components/virtualized-list/nested-scope.d.ts +6 -0
- package/build/angular/components/virtualized-list/nested-scope.js +17 -0
- package/build/angular/components/virtualized-list/nested-scope.js.map +1 -0
- package/build/angular/components/virtualized-section-list/directives.d.ts +21 -9
- package/build/angular/components/virtualized-section-list/directives.js +8 -28
- package/build/angular/components/virtualized-section-list/directives.js.map +1 -1
- package/build/angular/components/virtualized-section-list/index.d.ts +39 -60
- package/build/angular/components/virtualized-section-list/index.js +67 -33
- package/build/angular/components/virtualized-section-list/index.js.map +1 -1
- package/build/angular/components/virtualized-section-list/section-cell.d.ts +29 -0
- package/build/angular/components/virtualized-section-list/section-cell.js +82 -0
- package/build/angular/components/virtualized-section-list/section-cell.js.map +1 -0
- package/build/angular/components/virtualized-section-list/section-list-props.d.ts +56 -0
- package/build/angular/components/virtualized-section-list/section-list-props.js +3 -0
- package/build/angular/components/virtualized-section-list/section-list-props.js.map +1 -0
- package/build/angular/components/virtualized-section-list/section-list-template.d.ts +1 -1
- package/build/angular/components/virtualized-section-list/section-list-template.js +34 -26
- package/build/angular/components/virtualized-section-list/section-list-template.js.map +1 -1
- package/build/angular/components.d.ts +7 -3
- package/build/angular/components.js +2 -1
- package/build/angular/components.js.map +1 -1
- package/build/angular/element-base.d.ts +17 -1
- package/build/angular/element-base.js +33 -1
- package/build/angular/element-base.js.map +1 -1
- package/build/angular/element-props.d.ts +7 -7
- package/build/angular/element-text-input-native.d.ts +27 -0
- package/build/angular/element-text-input-native.js +52 -0
- package/build/angular/element-text-input-native.js.map +1 -0
- package/build/angular/elements-controls.d.ts +8 -2
- package/build/angular/elements-controls.js +13 -1
- package/build/angular/elements-controls.js.map +1 -1
- package/build/angular/elements-layout.d.ts +20 -3
- package/build/angular/elements-layout.js +37 -3
- package/build/angular/elements-layout.js.map +1 -1
- package/build/angular/elements-press.d.ts +10 -3
- package/build/angular/elements-press.js +13 -1
- package/build/angular/elements-press.js.map +1 -1
- package/build/angular/elements.d.ts +3 -3
- package/build/angular/elements.js +3 -2
- package/build/angular/elements.js.map +1 -1
- package/build/angular/index.d.ts +14 -7
- package/build/angular/index.js +21 -25
- package/build/angular/index.js.map +1 -1
- package/build/angular/modules/animated/create-animated-component.d.ts +1 -1
- package/build/angular/modules/animated/create-animated-component.js +1 -1
- package/build/angular/modules/animated/create-animated-component.js.map +1 -1
- package/build/angular/modules/animated/index.d.ts +54 -41
- package/build/angular/modules/animated/index.js +2 -26
- package/build/angular/modules/animated/index.js.map +1 -1
- package/build/angular/modules/app-registry/index.d.ts +3 -3
- package/build/angular/modules/app-registry/index.js +2 -2
- package/build/angular/modules/app-registry/index.js.map +1 -1
- package/build/angular/modules/status-bar/index.d.ts +9 -5
- package/build/angular/modules/status-bar/index.js +21 -10
- package/build/angular/modules/status-bar/index.js.map +1 -1
- package/build/angular/primitives/index.d.ts +4 -0
- package/build/angular/primitives/index.js +12 -0
- package/build/angular/primitives/index.js.map +1 -1
- package/build/angular/services/color-scheme.service.d.ts +1 -1
- package/package.json +6 -6
- package/src/accessibility-inputs.ts +3 -0
- package/src/callback-host.ts +56 -8
- package/src/components/flat-list/flat-list-handle.ts +64 -0
- package/src/components/flat-list/flat-list-template.ts +16 -0
- package/src/components/flat-list/index.ts +6 -48
- package/src/components/image-inputs.ts +94 -0
- package/src/components/image-props-resolve.ts +172 -0
- package/src/components/image-shared.ts +26 -291
- package/src/components/input-accessory-view-props.ts +12 -8
- package/src/components/keyboard-avoiding-view/index.ts +39 -79
- package/src/components/layout-conformance-props.ts +8 -0
- package/src/components/modal/index.ts +42 -20
- package/src/components/refresh-control-props.ts +29 -25
- package/src/components/scroll-view-props.ts +84 -76
- package/src/components/section-list/index.ts +34 -37
- package/src/components/touchable-props.ts +6 -2
- package/src/components/virtualized-list/cell-renderer-context.ts +36 -0
- package/src/components/virtualized-list/directives.ts +84 -8
- package/src/components/virtualized-list/index.ts +118 -85
- package/src/components/virtualized-list/list-bags.ts +38 -19
- package/src/components/virtualized-list/list-effects.ts +20 -32
- package/src/components/virtualized-list/list-handle.ts +17 -4
- package/src/components/virtualized-list/list-inputs.ts +47 -0
- package/src/components/virtualized-list/list-props.ts +57 -50
- package/src/components/virtualized-list/list-rows.ts +66 -0
- package/src/components/virtualized-list/list-styles.ts +30 -1
- package/src/components/virtualized-list/list-template.ts +159 -73
- package/src/components/virtualized-list/nested-scope.ts +22 -0
- package/src/components/virtualized-section-list/directives.ts +41 -40
- package/src/components/virtualized-section-list/index.ts +114 -118
- package/src/components/virtualized-section-list/section-cell.ts +109 -0
- package/src/components/virtualized-section-list/section-list-props.ts +79 -0
- package/src/components/virtualized-section-list/section-list-template.ts +34 -26
- package/src/components.ts +8 -0
- package/src/element-base.ts +17 -0
- package/src/element-props.ts +35 -33
- package/src/element-text-input-native.ts +31 -0
- package/src/elements-controls.ts +9 -1
- package/src/elements-layout.ts +27 -0
- package/src/elements-press.ts +10 -2
- package/src/elements.ts +3 -0
- package/src/index.ts +72 -22
- package/src/modules/animated/index.ts +2 -47
- package/src/modules/app-registry/index.ts +3 -1
- package/src/modules/status-bar/index.ts +24 -11
- package/src/primitives/index.ts +7 -0
- package/src/services/color-scheme.service.ts +1 -1
package/src/callback-host.ts
CHANGED
|
@@ -40,14 +40,25 @@ const CALLBACK_INPUTS = [
|
|
|
40
40
|
'onAccessibilityEscape',
|
|
41
41
|
'onAccessibilityTap',
|
|
42
42
|
'onBlur',
|
|
43
|
+
'onBlurCapture',
|
|
43
44
|
'onChangeText',
|
|
45
|
+
'onClickCapture',
|
|
44
46
|
'onContentSizeChange',
|
|
45
47
|
'onEndEditing',
|
|
46
48
|
'onError',
|
|
47
49
|
'onFocus',
|
|
50
|
+
'onFocusCapture',
|
|
48
51
|
'onHoverIn',
|
|
49
52
|
'onHoverOut',
|
|
53
|
+
'onKeyDown',
|
|
54
|
+
'onKeyDownCapture',
|
|
50
55
|
'onKeyPress',
|
|
56
|
+
'onKeyUp',
|
|
57
|
+
'onKeyUpCapture',
|
|
58
|
+
'onKeyboardDidHide',
|
|
59
|
+
'onKeyboardDidShow',
|
|
60
|
+
'onKeyboardWillHide',
|
|
61
|
+
'onKeyboardWillShow',
|
|
51
62
|
'onLayout',
|
|
52
63
|
'onLoad',
|
|
53
64
|
'onLoadEnd',
|
|
@@ -73,6 +84,7 @@ const CALLBACK_INPUTS = [
|
|
|
73
84
|
'onResponderStart',
|
|
74
85
|
'onResponderTerminate',
|
|
75
86
|
'onResponderTerminationRequest',
|
|
87
|
+
'onScrollAnimationEnd',
|
|
76
88
|
'onScrollBeginDrag',
|
|
77
89
|
'onScrollEndDrag',
|
|
78
90
|
'onScrollToTop',
|
|
@@ -80,6 +92,14 @@ const CALLBACK_INPUTS = [
|
|
|
80
92
|
'onStartShouldSetResponder',
|
|
81
93
|
'onStartShouldSetResponderCapture',
|
|
82
94
|
'onSubmitEditing',
|
|
95
|
+
'onTouchCancel',
|
|
96
|
+
'onTouchCancelCapture',
|
|
97
|
+
'onTouchEnd',
|
|
98
|
+
'onTouchEndCapture',
|
|
99
|
+
'onTouchMove',
|
|
100
|
+
'onTouchMoveCapture',
|
|
101
|
+
'onTouchStart',
|
|
102
|
+
'onTouchStartCapture',
|
|
83
103
|
'onValueChange',
|
|
84
104
|
] as const;
|
|
85
105
|
|
|
@@ -95,15 +115,19 @@ const CALLBACK_INPUTS = [
|
|
|
95
115
|
*/
|
|
96
116
|
export const CALLBACK_ATTRIBUTE_SELECTOR =
|
|
97
117
|
'[onAccessibilityAction],[onAccessibilityEscape],[onAccessibilityTap],[onBlur],' +
|
|
98
|
-
'[
|
|
99
|
-
'[
|
|
118
|
+
'[onBlurCapture],[onChangeText],[onClickCapture],[onContentSizeChange],[onEndEditing],[onError],' +
|
|
119
|
+
'[onFocus],[onFocusCapture],[onHoverIn],[onHoverOut],' +
|
|
120
|
+
'[onKeyDown],[onKeyDownCapture],[onKeyPress],[onKeyUp],[onKeyUpCapture],' +
|
|
121
|
+
'[onKeyboardDidHide],[onKeyboardDidShow],[onKeyboardWillHide],[onKeyboardWillShow],' +
|
|
122
|
+
'[onLayout],[onLoad],[onLoadEnd],[onLoadStart],[onLongPress],[onMagicTap],' +
|
|
100
123
|
'[onMomentumScrollBegin],[onMomentumScrollEnd],[onMoveShouldSetResponder],' +
|
|
101
124
|
'[onMoveShouldSetResponderCapture],[onPartialLoad],[onPress],[onPressIn],[onPressMove],' +
|
|
102
125
|
'[onPressOut],[onProgress],[onRefresh],[onResponderEnd],[onResponderGrant],[onResponderMove],' +
|
|
103
126
|
'[onResponderReject],[onResponderRelease],[onResponderStart],[onResponderTerminate],' +
|
|
104
|
-
'[onResponderTerminationRequest],[onScrollBeginDrag],[onScrollEndDrag],[onScrollToTop],' +
|
|
127
|
+
'[onResponderTerminationRequest],[onScrollAnimationEnd],[onScrollBeginDrag],[onScrollEndDrag],[onScrollToTop],' +
|
|
105
128
|
'[onSelectionChange],[onStartShouldSetResponder],[onStartShouldSetResponderCapture],' +
|
|
106
|
-
'[onSubmitEditing],[
|
|
129
|
+
'[onSubmitEditing],[onTouchCancel],[onTouchCancelCapture],[onTouchEnd],[onTouchEndCapture],' +
|
|
130
|
+
'[onTouchMove],[onTouchMoveCapture],[onTouchStart],[onTouchStartCapture],[onValueChange]';
|
|
107
131
|
|
|
108
132
|
/** Exported for the guard alone — the decorator below must spell its own list for ngtsc. */
|
|
109
133
|
export const CALLBACK_INPUT_NAMES: readonly string[] = CALLBACK_INPUTS;
|
|
@@ -111,15 +135,19 @@ export const CALLBACK_INPUT_NAMES: readonly string[] = CALLBACK_INPUTS;
|
|
|
111
135
|
@Directive({
|
|
112
136
|
selector:
|
|
113
137
|
'[onAccessibilityAction],[onAccessibilityEscape],[onAccessibilityTap],[onBlur],' +
|
|
114
|
-
'[
|
|
115
|
-
'[
|
|
138
|
+
'[onBlurCapture],[onClickCapture],[onContentSizeChange],[onEndEditing],[onError],' +
|
|
139
|
+
'[onFocus],[onFocusCapture],[onHoverIn],[onHoverOut],' +
|
|
140
|
+
'[onKeyDown],[onKeyDownCapture],[onKeyPress],[onKeyUp],[onKeyUpCapture],' +
|
|
141
|
+
'[onKeyboardDidHide],[onKeyboardDidShow],[onKeyboardWillHide],' +
|
|
142
|
+
'[onKeyboardWillShow],[onLayout],[onLoad],[onLoadEnd],[onLoadStart],[onLongPress],[onMagicTap],' +
|
|
116
143
|
'[onMomentumScrollBegin],[onMomentumScrollEnd],[onMoveShouldSetResponder],' +
|
|
117
144
|
'[onMoveShouldSetResponderCapture],[onPartialLoad],[onPress],[onPressIn],[onPressMove],' +
|
|
118
145
|
'[onPressOut],[onProgress],[onRefresh],[onResponderEnd],[onResponderGrant],[onResponderMove],' +
|
|
119
146
|
'[onResponderReject],[onResponderRelease],[onResponderStart],[onResponderTerminate],' +
|
|
120
|
-
'[onResponderTerminationRequest],[onScrollBeginDrag],[onScrollEndDrag],[onScrollToTop],' +
|
|
147
|
+
'[onResponderTerminationRequest],[onScrollAnimationEnd],[onScrollBeginDrag],[onScrollEndDrag],[onScrollToTop],' +
|
|
121
148
|
'[onSelectionChange],[onStartShouldSetResponder],[onStartShouldSetResponderCapture],' +
|
|
122
|
-
'[onSubmitEditing],[
|
|
149
|
+
'[onSubmitEditing],[onTouchCancel],[onTouchCancelCapture],[onTouchEnd],[onTouchEndCapture],' +
|
|
150
|
+
'[onTouchMove],[onTouchMoveCapture],[onTouchStart],[onTouchStartCapture],[onValueChange]',
|
|
123
151
|
// DECLARED, and this is not an optimisation — it is what makes withholding the tag directives
|
|
124
152
|
// possible at all. `ɵɵproperty` on an element no directive claimed ends in `setDomProperty`, which
|
|
125
153
|
// runs `validateAgainstEventProperties` and THROWS NG0306 on any name beginning with `on`
|
|
@@ -136,13 +164,24 @@ export const CALLBACK_INPUT_NAMES: readonly string[] = CALLBACK_INPUTS;
|
|
|
136
164
|
'onAccessibilityEscape',
|
|
137
165
|
'onAccessibilityTap',
|
|
138
166
|
'onBlur',
|
|
167
|
+
'onBlurCapture',
|
|
168
|
+
'onClickCapture',
|
|
139
169
|
'onContentSizeChange',
|
|
140
170
|
'onEndEditing',
|
|
141
171
|
'onError',
|
|
142
172
|
'onFocus',
|
|
173
|
+
'onFocusCapture',
|
|
143
174
|
'onHoverIn',
|
|
144
175
|
'onHoverOut',
|
|
176
|
+
'onKeyDown',
|
|
177
|
+
'onKeyDownCapture',
|
|
145
178
|
'onKeyPress',
|
|
179
|
+
'onKeyUp',
|
|
180
|
+
'onKeyUpCapture',
|
|
181
|
+
'onKeyboardDidHide',
|
|
182
|
+
'onKeyboardDidShow',
|
|
183
|
+
'onKeyboardWillHide',
|
|
184
|
+
'onKeyboardWillShow',
|
|
146
185
|
'onLayout',
|
|
147
186
|
'onLoad',
|
|
148
187
|
'onLoadEnd',
|
|
@@ -168,6 +207,7 @@ export const CALLBACK_INPUT_NAMES: readonly string[] = CALLBACK_INPUTS;
|
|
|
168
207
|
'onResponderStart',
|
|
169
208
|
'onResponderTerminate',
|
|
170
209
|
'onResponderTerminationRequest',
|
|
210
|
+
'onScrollAnimationEnd',
|
|
171
211
|
'onScrollBeginDrag',
|
|
172
212
|
'onScrollEndDrag',
|
|
173
213
|
'onScrollToTop',
|
|
@@ -175,6 +215,14 @@ export const CALLBACK_INPUT_NAMES: readonly string[] = CALLBACK_INPUTS;
|
|
|
175
215
|
'onStartShouldSetResponder',
|
|
176
216
|
'onStartShouldSetResponderCapture',
|
|
177
217
|
'onSubmitEditing',
|
|
218
|
+
'onTouchCancel',
|
|
219
|
+
'onTouchCancelCapture',
|
|
220
|
+
'onTouchEnd',
|
|
221
|
+
'onTouchEndCapture',
|
|
222
|
+
'onTouchMove',
|
|
223
|
+
'onTouchMoveCapture',
|
|
224
|
+
'onTouchStart',
|
|
225
|
+
'onTouchStartCapture',
|
|
178
226
|
'onValueChange',
|
|
179
227
|
],
|
|
180
228
|
standalone: true,
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// The imperative scroll surface of the list, handed through to the list inside it
|
|
2
|
+
|
|
3
|
+
import { Directive } from '@angular/core';
|
|
4
|
+
import type {
|
|
5
|
+
IScrollViewHandle,
|
|
6
|
+
IVirtualizedListHandle,
|
|
7
|
+
} from '@symbiote-native/components';
|
|
8
|
+
import type { ISymbioteNode } from '@symbiote-native/engine';
|
|
9
|
+
import { ListInputsBase } from '../virtualized-list/list-inputs';
|
|
10
|
+
|
|
11
|
+
@Directive()
|
|
12
|
+
export abstract class FlatListHandleBase<ItemT>
|
|
13
|
+
extends ListInputsBase<ItemT>
|
|
14
|
+
implements IVirtualizedListHandle
|
|
15
|
+
{
|
|
16
|
+
// The composed inner list, whichever branch rendered, its instance is the scroll handle
|
|
17
|
+
protected abstract readonly listRef?: IVirtualizedListHandle;
|
|
18
|
+
|
|
19
|
+
scrollToOffset(params: { offset: number; animated?: boolean }): void {
|
|
20
|
+
this.listRef?.scrollToOffset(params);
|
|
21
|
+
}
|
|
22
|
+
scrollToIndex(params: {
|
|
23
|
+
index: number;
|
|
24
|
+
animated?: boolean;
|
|
25
|
+
viewOffset?: number;
|
|
26
|
+
viewPosition?: number;
|
|
27
|
+
}): void {
|
|
28
|
+
this.listRef?.scrollToIndex(params);
|
|
29
|
+
}
|
|
30
|
+
scrollToItem(params: {
|
|
31
|
+
item: unknown;
|
|
32
|
+
animated?: boolean;
|
|
33
|
+
viewPosition?: number;
|
|
34
|
+
}): void {
|
|
35
|
+
this.listRef?.scrollToItem(params);
|
|
36
|
+
}
|
|
37
|
+
scrollToEnd(params?: { animated?: boolean }): void {
|
|
38
|
+
this.listRef?.scrollToEnd(params);
|
|
39
|
+
}
|
|
40
|
+
flashScrollIndicators(): void {
|
|
41
|
+
this.listRef?.flashScrollIndicators();
|
|
42
|
+
}
|
|
43
|
+
getNativeScrollRef(): ISymbioteNode | null {
|
|
44
|
+
return this.listRef?.getNativeScrollRef() ?? null;
|
|
45
|
+
}
|
|
46
|
+
getScrollableNode(): IScrollViewHandle | null {
|
|
47
|
+
return this.listRef?.getScrollableNode() ?? null;
|
|
48
|
+
}
|
|
49
|
+
getScrollResponder(): IScrollViewHandle | null {
|
|
50
|
+
return this.listRef?.getScrollResponder() ?? null;
|
|
51
|
+
}
|
|
52
|
+
getScrollNode(): ISymbioteNode | null {
|
|
53
|
+
return this.listRef?.getScrollNode() ?? null;
|
|
54
|
+
}
|
|
55
|
+
getScrollRef(): ISymbioteNode | null {
|
|
56
|
+
return this.listRef?.getScrollRef() ?? null;
|
|
57
|
+
}
|
|
58
|
+
recordInteraction(): void {
|
|
59
|
+
this.listRef?.recordInteraction();
|
|
60
|
+
}
|
|
61
|
+
setNativeProps(props: Record<string, unknown>): void {
|
|
62
|
+
this.listRef?.setNativeProps(props);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -31,6 +31,7 @@ export const FLAT_LIST_TEMPLATE = `
|
|
|
31
31
|
[maxToRenderPerBatch]="maxToRenderPerBatch"
|
|
32
32
|
[updateCellsBatchingPeriod]="updateCellsBatchingPeriod"
|
|
33
33
|
[windowSize]="windowSize"
|
|
34
|
+
[disableVirtualization]="disableVirtualization"
|
|
34
35
|
[stickyHeaderIndices]="stickyHeaderIndices"
|
|
35
36
|
[maintainVisibleContentPosition]="maintainVisibleContentPosition"
|
|
36
37
|
[onScroll]="onScroll"
|
|
@@ -38,15 +39,21 @@ export const FLAT_LIST_TEMPLATE = `
|
|
|
38
39
|
[onScrollEndDrag]="onScrollEndDrag"
|
|
39
40
|
[onMomentumScrollBegin]="onMomentumScrollBegin"
|
|
40
41
|
[onMomentumScrollEnd]="onMomentumScrollEnd"
|
|
42
|
+
[onContentSizeChange]="onContentSizeChange"
|
|
41
43
|
[scrollEventThrottle]="scrollEventThrottle"
|
|
42
44
|
[keyboardShouldPersistTaps]="keyboardShouldPersistTaps"
|
|
43
45
|
[keyboardDismissMode]="keyboardDismissMode"
|
|
44
46
|
[removeClippedSubviews]="resolvedRemoveClippedSubviews"
|
|
45
47
|
[nestedScrollEnabled]="nestedScrollEnabled"
|
|
48
|
+
[stickyHeaderHiddenOnScroll]="stickyHeaderHiddenOnScroll"
|
|
49
|
+
[innerViewRef]="innerViewRef"
|
|
46
50
|
[testID]="testID"
|
|
47
51
|
[nativeID]="nativeID"
|
|
48
52
|
[style]="resolvedStyle"
|
|
49
53
|
[contentContainerStyle]="contentContainerStyle"
|
|
54
|
+
[listHeaderComponentStyle]="listHeaderComponentStyle"
|
|
55
|
+
[listFooterComponentStyle]="listFooterComponentStyle"
|
|
56
|
+
[cellRendererTemplate]="cellRendererTpl"
|
|
50
57
|
${LIST_ACCESSIBILITY_FORWARD}
|
|
51
58
|
>
|
|
52
59
|
<ng-template vListItem let-row let-separators="separators">
|
|
@@ -55,6 +62,7 @@ export const FLAT_LIST_TEMPLATE = `
|
|
|
55
62
|
<view [style]="columnCellStyle">
|
|
56
63
|
<ng-container
|
|
57
64
|
[vListOutlet]="itemDir?.templateRef"
|
|
65
|
+
[vListOutletComponent]="itemComponent"
|
|
58
66
|
[vListOutletContext]="cell.context"
|
|
59
67
|
></ng-container>
|
|
60
68
|
</view>
|
|
@@ -119,6 +127,7 @@ export const FLAT_LIST_TEMPLATE = `
|
|
|
119
127
|
[maxToRenderPerBatch]="maxToRenderPerBatch"
|
|
120
128
|
[updateCellsBatchingPeriod]="updateCellsBatchingPeriod"
|
|
121
129
|
[windowSize]="windowSize"
|
|
130
|
+
[disableVirtualization]="disableVirtualization"
|
|
122
131
|
[stickyHeaderIndices]="stickyHeaderIndices"
|
|
123
132
|
[maintainVisibleContentPosition]="maintainVisibleContentPosition"
|
|
124
133
|
[onScroll]="onScroll"
|
|
@@ -126,16 +135,23 @@ export const FLAT_LIST_TEMPLATE = `
|
|
|
126
135
|
[onScrollEndDrag]="onScrollEndDrag"
|
|
127
136
|
[onMomentumScrollBegin]="onMomentumScrollBegin"
|
|
128
137
|
[onMomentumScrollEnd]="onMomentumScrollEnd"
|
|
138
|
+
[onContentSizeChange]="onContentSizeChange"
|
|
129
139
|
[scrollEventThrottle]="scrollEventThrottle"
|
|
130
140
|
[keyboardShouldPersistTaps]="keyboardShouldPersistTaps"
|
|
131
141
|
[keyboardDismissMode]="keyboardDismissMode"
|
|
132
142
|
[removeClippedSubviews]="resolvedRemoveClippedSubviews"
|
|
133
143
|
[nestedScrollEnabled]="nestedScrollEnabled"
|
|
144
|
+
[stickyHeaderHiddenOnScroll]="stickyHeaderHiddenOnScroll"
|
|
145
|
+
[innerViewRef]="innerViewRef"
|
|
134
146
|
[testID]="testID"
|
|
135
147
|
[nativeID]="nativeID"
|
|
136
148
|
[style]="resolvedStyle"
|
|
137
149
|
[contentContainerStyle]="contentContainerStyle"
|
|
150
|
+
[listHeaderComponentStyle]="listHeaderComponentStyle"
|
|
151
|
+
[listFooterComponentStyle]="listFooterComponentStyle"
|
|
152
|
+
[cellRendererTemplate]="cellRendererTpl"
|
|
138
153
|
[itemTemplate]="itemDir?.templateRef"
|
|
154
|
+
[listItemComponent]="listItemComponent"
|
|
139
155
|
[itemSeparatorTemplate]="separatorDir?.templateRef"
|
|
140
156
|
${LIST_ACCESSIBILITY_FORWARD}
|
|
141
157
|
>
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
} from '@angular/core';
|
|
17
17
|
import {
|
|
18
18
|
SINGLE_COLUMN,
|
|
19
|
+
arrayLikeLength,
|
|
19
20
|
chunkIntoRows,
|
|
20
21
|
expandRowViewability,
|
|
21
22
|
firstItemOfRow,
|
|
@@ -23,7 +24,6 @@ import {
|
|
|
23
24
|
removeClippedSubviewsOrDefault,
|
|
24
25
|
rowKeyExtractor,
|
|
25
26
|
type IRow,
|
|
26
|
-
type IScrollViewHandle,
|
|
27
27
|
type ISeparators,
|
|
28
28
|
type IViewabilityConfigCallbackPair,
|
|
29
29
|
type IViewableItemsChangedInfo,
|
|
@@ -35,7 +35,6 @@ import {
|
|
|
35
35
|
flattenStyle,
|
|
36
36
|
resolveClassName,
|
|
37
37
|
type IStyleProp,
|
|
38
|
-
type ISymbioteNode,
|
|
39
38
|
type IViewStyle,
|
|
40
39
|
} from '@symbiote-native/engine';
|
|
41
40
|
import {
|
|
@@ -50,7 +49,7 @@ import {
|
|
|
50
49
|
type IVListSeparatorContext,
|
|
51
50
|
} from '../virtualized-list';
|
|
52
51
|
import { VListOutletDirective } from '../virtualized-list/directives';
|
|
53
|
-
import {
|
|
52
|
+
import { FlatListHandleBase } from './flat-list-handle';
|
|
54
53
|
import { provideGateDemand } from '../../gate-demand';
|
|
55
54
|
import {
|
|
56
55
|
stableAnchorStyle,
|
|
@@ -151,7 +150,7 @@ export type IFlatListInputs<ItemT> = Omit<
|
|
|
151
150
|
template: FLAT_LIST_TEMPLATE,
|
|
152
151
|
})
|
|
153
152
|
export class FlatList<ItemT = unknown>
|
|
154
|
-
extends
|
|
153
|
+
extends FlatListHandleBase<ItemT>
|
|
155
154
|
implements IFlatListInputs<ItemT>, IVirtualizedListHandle, DoCheck, OnChanges
|
|
156
155
|
{
|
|
157
156
|
@Input({ required: true }) data!: readonly ItemT[];
|
|
@@ -166,8 +165,7 @@ export class FlatList<ItemT = unknown>
|
|
|
166
165
|
);
|
|
167
166
|
}
|
|
168
167
|
|
|
169
|
-
|
|
170
|
-
@ViewChild(VirtualizedList) private listRef?: VirtualizedList;
|
|
168
|
+
@ViewChild(VirtualizedList) protected override listRef?: VirtualizedList;
|
|
171
169
|
|
|
172
170
|
// This component's own host, the anchor `class="..."` resolves onto, not the inner list's
|
|
173
171
|
private readonly elementRef = inject(ElementRef);
|
|
@@ -213,7 +211,7 @@ export class FlatList<ItemT = unknown>
|
|
|
213
211
|
? chunkIntoRows(this.data, this.columns)
|
|
214
212
|
: [];
|
|
215
213
|
dlog(
|
|
216
|
-
`Angular FlatList over ${this.data
|
|
214
|
+
`Angular FlatList over ${arrayLikeLength(this.data)} items, ${this.columns} column(s)`,
|
|
217
215
|
);
|
|
218
216
|
}
|
|
219
217
|
if (
|
|
@@ -225,7 +223,7 @@ export class FlatList<ItemT = unknown>
|
|
|
225
223
|
}
|
|
226
224
|
|
|
227
225
|
getFlatItem = (_data: unknown, index: number): ItemT => this.data[index];
|
|
228
|
-
getFlatCount = (_data: unknown): number => this.data
|
|
226
|
+
getFlatCount = (_data: unknown): number => arrayLikeLength(this.data);
|
|
229
227
|
|
|
230
228
|
// With several columns the virtualized stream is rows
|
|
231
229
|
getRow = (_data: unknown, index: number): IRow<ItemT> => this.rows[index];
|
|
@@ -291,44 +289,4 @@ export class FlatList<ItemT = unknown>
|
|
|
291
289
|
: undefined,
|
|
292
290
|
};
|
|
293
291
|
}
|
|
294
|
-
|
|
295
|
-
scrollToOffset(params: { offset: number; animated?: boolean }): void {
|
|
296
|
-
this.listRef?.scrollToOffset(params);
|
|
297
|
-
}
|
|
298
|
-
scrollToIndex(params: {
|
|
299
|
-
index: number;
|
|
300
|
-
animated?: boolean;
|
|
301
|
-
viewOffset?: number;
|
|
302
|
-
viewPosition?: number;
|
|
303
|
-
}): void {
|
|
304
|
-
this.listRef?.scrollToIndex(params);
|
|
305
|
-
}
|
|
306
|
-
scrollToItem(params: {
|
|
307
|
-
item: unknown;
|
|
308
|
-
animated?: boolean;
|
|
309
|
-
viewPosition?: number;
|
|
310
|
-
}): void {
|
|
311
|
-
this.listRef?.scrollToItem(params);
|
|
312
|
-
}
|
|
313
|
-
scrollToEnd(params?: { animated?: boolean }): void {
|
|
314
|
-
this.listRef?.scrollToEnd(params);
|
|
315
|
-
}
|
|
316
|
-
flashScrollIndicators(): void {
|
|
317
|
-
this.listRef?.flashScrollIndicators();
|
|
318
|
-
}
|
|
319
|
-
getNativeScrollRef(): IScrollViewHandle | null {
|
|
320
|
-
return this.listRef?.getNativeScrollRef() ?? null;
|
|
321
|
-
}
|
|
322
|
-
getScrollableNode(): IScrollViewHandle | null {
|
|
323
|
-
return this.listRef?.getScrollableNode() ?? null;
|
|
324
|
-
}
|
|
325
|
-
getScrollResponder(): IScrollViewHandle | null {
|
|
326
|
-
return this.listRef?.getScrollResponder() ?? null;
|
|
327
|
-
}
|
|
328
|
-
getScrollNode(): ISymbioteNode | null {
|
|
329
|
-
return this.listRef?.getScrollNode() ?? null;
|
|
330
|
-
}
|
|
331
|
-
recordInteraction(): void {
|
|
332
|
-
this.listRef?.recordInteraction();
|
|
333
|
-
}
|
|
334
292
|
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// The input and output names of `Animated.Image`, kept apart from the prop fold so the list reads
|
|
2
|
+
// as one table
|
|
3
|
+
|
|
4
|
+
export const IMAGE_INPUTS = [
|
|
5
|
+
'source',
|
|
6
|
+
'defaultSource',
|
|
7
|
+
'loadingIndicatorSource',
|
|
8
|
+
'style',
|
|
9
|
+
'resizeMode',
|
|
10
|
+
'resizeMethod',
|
|
11
|
+
'resizeMultiplier',
|
|
12
|
+
'tintColor',
|
|
13
|
+
'blurRadius',
|
|
14
|
+
'capInsets',
|
|
15
|
+
'fadeDuration',
|
|
16
|
+
'progressiveRenderingEnabled',
|
|
17
|
+
'src',
|
|
18
|
+
'srcSet',
|
|
19
|
+
'alt',
|
|
20
|
+
'width',
|
|
21
|
+
'height',
|
|
22
|
+
'crossOrigin',
|
|
23
|
+
'referrerPolicy',
|
|
24
|
+
'testID',
|
|
25
|
+
'nativeID',
|
|
26
|
+
'accessible',
|
|
27
|
+
'accessibilityLabel',
|
|
28
|
+
'accessibilityHint',
|
|
29
|
+
'accessibilityRole',
|
|
30
|
+
'accessibilityState',
|
|
31
|
+
'accessibilityValue',
|
|
32
|
+
'accessibilityActions',
|
|
33
|
+
'accessibilityLabelledBy',
|
|
34
|
+
'importantForAccessibility',
|
|
35
|
+
'accessibilityLiveRegion',
|
|
36
|
+
'screenReaderFocusable',
|
|
37
|
+
'accessibilityViewIsModal',
|
|
38
|
+
'accessibilityElementsHidden',
|
|
39
|
+
'accessibilityIgnoresInvertColors',
|
|
40
|
+
'accessibilityLanguage',
|
|
41
|
+
'accessibilityRespondsToUserInteraction',
|
|
42
|
+
'accessibilityShowsLargeContentViewer',
|
|
43
|
+
'accessibilityLargeContentTitle',
|
|
44
|
+
'role',
|
|
45
|
+
'ariaLabel: aria-label',
|
|
46
|
+
'ariaLabelledBy: aria-labelledby',
|
|
47
|
+
'ariaLive: aria-live',
|
|
48
|
+
'ariaHidden: aria-hidden',
|
|
49
|
+
'ariaBusy: aria-busy',
|
|
50
|
+
'ariaChecked: aria-checked',
|
|
51
|
+
'ariaDisabled: aria-disabled',
|
|
52
|
+
'ariaExpanded: aria-expanded',
|
|
53
|
+
'ariaSelected: aria-selected',
|
|
54
|
+
'ariaModal: aria-modal',
|
|
55
|
+
'ariaValueMax: aria-valuemax',
|
|
56
|
+
'ariaValueMin: aria-valuemin',
|
|
57
|
+
'ariaValueNow: aria-valuenow',
|
|
58
|
+
'ariaValueText: aria-valuetext',
|
|
59
|
+
'onAccessibilityAction',
|
|
60
|
+
'onAccessibilityTap',
|
|
61
|
+
'onMagicTap',
|
|
62
|
+
'onAccessibilityEscape',
|
|
63
|
+
'onLoadStart',
|
|
64
|
+
'onLoad',
|
|
65
|
+
'onLoadEnd',
|
|
66
|
+
'onError',
|
|
67
|
+
'onProgress',
|
|
68
|
+
'onPartialLoad',
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
type IImageOutput =
|
|
72
|
+
| 'accessibilityAction'
|
|
73
|
+
| 'accessibilityTap'
|
|
74
|
+
| 'magicTap'
|
|
75
|
+
| 'accessibilityEscape'
|
|
76
|
+
| 'loadStart'
|
|
77
|
+
| 'load'
|
|
78
|
+
| 'loadEnd'
|
|
79
|
+
| 'error'
|
|
80
|
+
| 'progress'
|
|
81
|
+
| 'partialLoad';
|
|
82
|
+
|
|
83
|
+
export const IMAGE_OUTPUTS: IImageOutput[] = [
|
|
84
|
+
'accessibilityAction',
|
|
85
|
+
'accessibilityTap',
|
|
86
|
+
'magicTap',
|
|
87
|
+
'accessibilityEscape',
|
|
88
|
+
'loadStart',
|
|
89
|
+
'load',
|
|
90
|
+
'loadEnd',
|
|
91
|
+
'error',
|
|
92
|
+
'progress',
|
|
93
|
+
'partialLoad',
|
|
94
|
+
];
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// Narrows the untyped `Animated.Image` input bag into the props `renderImage` takes
|
|
2
|
+
import {
|
|
3
|
+
renderImage,
|
|
4
|
+
resolveAccessibilityProps,
|
|
5
|
+
type IImageSourceProp,
|
|
6
|
+
type IResizeMode,
|
|
7
|
+
} from '@symbiote-native/components';
|
|
8
|
+
import {
|
|
9
|
+
isBoolean,
|
|
10
|
+
isNumber,
|
|
11
|
+
isProcessableColor,
|
|
12
|
+
isString,
|
|
13
|
+
type IStyleProp,
|
|
14
|
+
type ISymbioteEvent,
|
|
15
|
+
type IViewStyle,
|
|
16
|
+
} from '@symbiote-native/engine';
|
|
17
|
+
|
|
18
|
+
type IGuard = (value: unknown) => boolean;
|
|
19
|
+
|
|
20
|
+
function isAny(): boolean {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Input key -> the guard its value must pass. A union, object or handler is checked by Angular's
|
|
25
|
+
// template type check, so it gets `isAny` and goes through as it came
|
|
26
|
+
const PASSTHROUGH_GUARDS: Readonly<Record<string, IGuard>> = {
|
|
27
|
+
resizeMethod: isAny,
|
|
28
|
+
resizeMultiplier: isNumber,
|
|
29
|
+
blurRadius: isNumber,
|
|
30
|
+
capInsets: isAny,
|
|
31
|
+
fadeDuration: isNumber,
|
|
32
|
+
progressiveRenderingEnabled: isBoolean,
|
|
33
|
+
testID: isString,
|
|
34
|
+
nativeID: isString,
|
|
35
|
+
accessible: isBoolean,
|
|
36
|
+
accessibilityLabel: isString,
|
|
37
|
+
accessibilityHint: isString,
|
|
38
|
+
accessibilityRole: isAny,
|
|
39
|
+
accessibilityState: isAny,
|
|
40
|
+
accessibilityValue: isAny,
|
|
41
|
+
accessibilityActions: isAny,
|
|
42
|
+
accessibilityLabelledBy: isAny,
|
|
43
|
+
importantForAccessibility: isAny,
|
|
44
|
+
accessibilityLiveRegion: isAny,
|
|
45
|
+
screenReaderFocusable: isBoolean,
|
|
46
|
+
accessibilityViewIsModal: isBoolean,
|
|
47
|
+
accessibilityElementsHidden: isBoolean,
|
|
48
|
+
accessibilityIgnoresInvertColors: isBoolean,
|
|
49
|
+
accessibilityLanguage: isString,
|
|
50
|
+
accessibilityRespondsToUserInteraction: isBoolean,
|
|
51
|
+
accessibilityShowsLargeContentViewer: isBoolean,
|
|
52
|
+
accessibilityLargeContentTitle: isString,
|
|
53
|
+
role: isAny,
|
|
54
|
+
ariaLabel: isString,
|
|
55
|
+
ariaLabelledBy: isString,
|
|
56
|
+
ariaLive: isAny,
|
|
57
|
+
ariaHidden: isBoolean,
|
|
58
|
+
ariaBusy: isBoolean,
|
|
59
|
+
ariaChecked: isAny,
|
|
60
|
+
ariaDisabled: isBoolean,
|
|
61
|
+
ariaExpanded: isBoolean,
|
|
62
|
+
ariaSelected: isBoolean,
|
|
63
|
+
ariaModal: isBoolean,
|
|
64
|
+
ariaValueMax: isNumber,
|
|
65
|
+
ariaValueMin: isNumber,
|
|
66
|
+
ariaValueNow: isNumber,
|
|
67
|
+
ariaValueText: isString,
|
|
68
|
+
onAccessibilityAction: isAny,
|
|
69
|
+
onAccessibilityTap: isAny,
|
|
70
|
+
onMagicTap: isAny,
|
|
71
|
+
onAccessibilityEscape: isAny,
|
|
72
|
+
onLoadStart: isAny,
|
|
73
|
+
onLoad: isAny,
|
|
74
|
+
onLoadEnd: isAny,
|
|
75
|
+
onError: isAny,
|
|
76
|
+
onProgress: isAny,
|
|
77
|
+
onPartialLoad: isAny,
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// The name a template binds -> the `aria-*` prop RN spells
|
|
81
|
+
const ARIA_PROP_NAMES: Readonly<Record<string, string>> = {
|
|
82
|
+
ariaLabel: 'aria-label',
|
|
83
|
+
ariaLabelledBy: 'aria-labelledby',
|
|
84
|
+
ariaLive: 'aria-live',
|
|
85
|
+
ariaHidden: 'aria-hidden',
|
|
86
|
+
ariaBusy: 'aria-busy',
|
|
87
|
+
ariaChecked: 'aria-checked',
|
|
88
|
+
ariaDisabled: 'aria-disabled',
|
|
89
|
+
ariaExpanded: 'aria-expanded',
|
|
90
|
+
ariaSelected: 'aria-selected',
|
|
91
|
+
ariaModal: 'aria-modal',
|
|
92
|
+
ariaValueMax: 'aria-valuemax',
|
|
93
|
+
ariaValueMin: 'aria-valuemin',
|
|
94
|
+
ariaValueNow: 'aria-valuenow',
|
|
95
|
+
ariaValueText: 'aria-valuetext',
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const RESIZE_MODES = [
|
|
99
|
+
'cover',
|
|
100
|
+
'contain',
|
|
101
|
+
'stretch',
|
|
102
|
+
'repeat',
|
|
103
|
+
'center',
|
|
104
|
+
'none',
|
|
105
|
+
] as const satisfies readonly IResizeMode[];
|
|
106
|
+
|
|
107
|
+
function narrowTo<T>(
|
|
108
|
+
value: unknown,
|
|
109
|
+
guard: (candidate: unknown) => candidate is T,
|
|
110
|
+
): T | undefined {
|
|
111
|
+
return guard(value) ? value : undefined;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function isSource(value: unknown): value is IImageSourceProp {
|
|
115
|
+
return (
|
|
116
|
+
typeof value === 'number' || (typeof value === 'object' && value !== null)
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function isStyle(value: unknown): value is IStyleProp<IViewStyle> {
|
|
121
|
+
return typeof value === 'object' && value !== null;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function isCrossOrigin(
|
|
125
|
+
value: unknown,
|
|
126
|
+
): value is 'anonymous' | 'use-credentials' {
|
|
127
|
+
return value === 'anonymous' || value === 'use-credentials';
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function isImageEventCallback(
|
|
131
|
+
value: unknown,
|
|
132
|
+
): value is (event: ISymbioteEvent) => void {
|
|
133
|
+
return typeof value === 'function';
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// An animated bag may carry the RN `aria-*` spelling instead of the name a template binds
|
|
137
|
+
function inputValue(input: Record<string, unknown>, key: string): unknown {
|
|
138
|
+
const rnName = ARIA_PROP_NAMES[key];
|
|
139
|
+
return input[key] ?? (rnName === undefined ? undefined : input[rnName]);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function passthroughOf(
|
|
143
|
+
input: Record<string, unknown>,
|
|
144
|
+
): Record<string, unknown> {
|
|
145
|
+
const passthrough: Record<string, unknown> = {};
|
|
146
|
+
for (const [key, guard] of Object.entries(PASSTHROUGH_GUARDS)) {
|
|
147
|
+
const value = inputValue(input, key);
|
|
148
|
+
passthrough[ARIA_PROP_NAMES[key] ?? key] = guard(value) ? value : undefined;
|
|
149
|
+
}
|
|
150
|
+
return passthrough;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function resolveImageProps(
|
|
154
|
+
input: Record<string, unknown>,
|
|
155
|
+
): Record<string, unknown> {
|
|
156
|
+
return renderImage({
|
|
157
|
+
source: narrowTo(input['source'], isSource),
|
|
158
|
+
defaultSource: narrowTo(input['defaultSource'], isSource),
|
|
159
|
+
loadingIndicatorSource: narrowTo(input['loadingIndicatorSource'], isSource),
|
|
160
|
+
style: narrowTo(input['style'], isStyle),
|
|
161
|
+
resizeMode: RESIZE_MODES.find(mode => mode === input['resizeMode']),
|
|
162
|
+
tintColor: narrowTo(input['tintColor'], isProcessableColor),
|
|
163
|
+
src: narrowTo(input['src'], isString),
|
|
164
|
+
srcSet: narrowTo(input['srcSet'], isString),
|
|
165
|
+
alt: narrowTo(input['alt'], isString),
|
|
166
|
+
width: narrowTo(input['width'], isNumber),
|
|
167
|
+
height: narrowTo(input['height'], isNumber),
|
|
168
|
+
crossOrigin: narrowTo(input['crossOrigin'], isCrossOrigin),
|
|
169
|
+
referrerPolicy: narrowTo(input['referrerPolicy'], isString),
|
|
170
|
+
passthrough: resolveAccessibilityProps(passthroughOf(input)),
|
|
171
|
+
}).props;
|
|
172
|
+
}
|