@ng-native/components 0.0.1 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +78 -1
  3. package/dist/activity-indicator.d.ts +41 -0
  4. package/dist/activity-indicator.js +66 -0
  5. package/dist/activity-indicator.js.map +1 -0
  6. package/dist/animated-style.d.ts +31 -0
  7. package/dist/animated-style.js +102 -0
  8. package/dist/animated-style.js.map +1 -0
  9. package/dist/animated.d.ts +125 -0
  10. package/dist/animated.js +538 -0
  11. package/dist/animated.js.map +1 -0
  12. package/dist/animation.d.ts +40 -0
  13. package/dist/animation.js +20 -0
  14. package/dist/animation.js.map +1 -0
  15. package/dist/animations-web.d.ts +8 -0
  16. package/dist/animations-web.js +31 -0
  17. package/dist/animations-web.js.map +1 -0
  18. package/dist/animations.d.ts +7 -0
  19. package/dist/animations.js +58 -0
  20. package/dist/animations.js.map +1 -0
  21. package/dist/controlled-model.d.ts +33 -0
  22. package/dist/controlled-model.js +47 -0
  23. package/dist/controlled-model.js.map +1 -0
  24. package/dist/easing.d.ts +21 -0
  25. package/dist/easing.js +50 -0
  26. package/dist/easing.js.map +1 -0
  27. package/dist/events.d.ts +169 -0
  28. package/dist/events.js +2 -0
  29. package/dist/events.js.map +1 -0
  30. package/dist/gesture-backend.d.ts +26 -0
  31. package/dist/gesture-backend.js +14 -0
  32. package/dist/gesture-backend.js.map +1 -0
  33. package/dist/gesture-dispatch.d.ts +67 -0
  34. package/dist/gesture-dispatch.js +106 -0
  35. package/dist/gesture-dispatch.js.map +1 -0
  36. package/dist/gestures.d.ts +23 -0
  37. package/dist/gestures.js +164 -0
  38. package/dist/gestures.js.map +1 -0
  39. package/dist/height-index.d.ts +31 -0
  40. package/dist/height-index.js +80 -0
  41. package/dist/height-index.js.map +1 -0
  42. package/dist/image-background.d.ts +32 -0
  43. package/dist/image-background.js +80 -0
  44. package/dist/image-background.js.map +1 -0
  45. package/dist/image.d.ts +79 -0
  46. package/dist/image.js +155 -0
  47. package/dist/image.js.map +1 -0
  48. package/dist/index.d.ts +38 -0
  49. package/dist/index.js +39 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/input-accessory-view.d.ts +16 -0
  52. package/dist/input-accessory-view.js +29 -0
  53. package/dist/input-accessory-view.js.map +1 -0
  54. package/dist/keyboard-avoiding-view.d.ts +79 -0
  55. package/dist/keyboard-avoiding-view.js +172 -0
  56. package/dist/keyboard-avoiding-view.js.map +1 -0
  57. package/dist/keyboard-dock.d.ts +126 -0
  58. package/dist/keyboard-dock.js +327 -0
  59. package/dist/keyboard-dock.js.map +1 -0
  60. package/dist/keyboard-taps.d.ts +12 -0
  61. package/dist/keyboard-taps.js +51 -0
  62. package/dist/keyboard-taps.js.map +1 -0
  63. package/dist/modal.d.ts +56 -0
  64. package/dist/modal.js +102 -0
  65. package/dist/modal.js.map +1 -0
  66. package/dist/native-gesture.d.ts +21 -0
  67. package/dist/native-gesture.js +56 -0
  68. package/dist/native-gesture.js.map +1 -0
  69. package/dist/native-ref.d.ts +7 -0
  70. package/dist/native-ref.js +13 -0
  71. package/dist/native-ref.js.map +1 -0
  72. package/dist/pressable.d.ts +220 -0
  73. package/dist/pressable.js +484 -0
  74. package/dist/pressable.js.map +1 -0
  75. package/dist/reanimated.d.ts +19 -0
  76. package/dist/reanimated.js +111 -0
  77. package/dist/reanimated.js.map +1 -0
  78. package/dist/refresh-control.d.ts +50 -0
  79. package/dist/refresh-control.js +103 -0
  80. package/dist/refresh-control.js.map +1 -0
  81. package/dist/safe-area-provider.d.ts +11 -0
  82. package/dist/safe-area-provider.js +70 -0
  83. package/dist/safe-area-provider.js.map +1 -0
  84. package/dist/safe-area-view.d.ts +22 -0
  85. package/dist/safe-area-view.js +77 -0
  86. package/dist/safe-area-view.js.map +1 -0
  87. package/dist/safe-area.d.ts +12 -0
  88. package/dist/safe-area.js +27 -0
  89. package/dist/safe-area.js.map +1 -0
  90. package/dist/scroll-view-props.d.ts +89 -0
  91. package/dist/scroll-view-props.js +153 -0
  92. package/dist/scroll-view-props.js.map +1 -0
  93. package/dist/scroll-view.d.ts +95 -0
  94. package/dist/scroll-view.js +181 -0
  95. package/dist/scroll-view.js.map +1 -0
  96. package/dist/section-list.d.ts +146 -0
  97. package/dist/section-list.js +300 -0
  98. package/dist/section-list.js.map +1 -0
  99. package/dist/sticky-headers.d.ts +41 -0
  100. package/dist/sticky-headers.js +118 -0
  101. package/dist/sticky-headers.js.map +1 -0
  102. package/dist/swipe-refresh-layout.d.ts +51 -0
  103. package/dist/swipe-refresh-layout.js +162 -0
  104. package/dist/swipe-refresh-layout.js.map +1 -0
  105. package/dist/switch.d.ts +54 -0
  106. package/dist/switch.js +110 -0
  107. package/dist/switch.js.map +1 -0
  108. package/dist/template-slot.d.ts +18 -0
  109. package/dist/template-slot.js +30 -0
  110. package/dist/template-slot.js.map +1 -0
  111. package/dist/text-input.d.ts +168 -0
  112. package/dist/text-input.js +312 -0
  113. package/dist/text-input.js.map +1 -0
  114. package/dist/text.d.ts +70 -0
  115. package/dist/text.js +111 -0
  116. package/dist/text.js.map +1 -0
  117. package/dist/touchable-opacity.d.ts +36 -0
  118. package/dist/touchable-opacity.js +76 -0
  119. package/dist/touchable-opacity.js.map +1 -0
  120. package/dist/transforms.d.ts +2 -0
  121. package/dist/transforms.js +17 -0
  122. package/dist/transforms.js.map +1 -0
  123. package/dist/view-base.d.ts +332 -0
  124. package/dist/view-base.js +534 -0
  125. package/dist/view-base.js.map +1 -0
  126. package/dist/view.d.ts +12 -0
  127. package/dist/view.js +18 -0
  128. package/dist/view.js.map +1 -0
  129. package/dist/virtual-list.d.ts +530 -0
  130. package/dist/virtual-list.js +1150 -0
  131. package/dist/virtual-list.js.map +1 -0
  132. package/dist/worklet-scroll.d.ts +13 -0
  133. package/dist/worklet-scroll.js +49 -0
  134. package/dist/worklet-scroll.js.map +1 -0
  135. package/dist/worklet-style.d.ts +13 -0
  136. package/dist/worklet-style.js +47 -0
  137. package/dist/worklet-style.js.map +1 -0
  138. package/dist/worklets.d.ts +89 -0
  139. package/dist/worklets.js +42 -0
  140. package/dist/worklets.js.map +1 -0
  141. package/dist/written-props.d.ts +6 -0
  142. package/dist/written-props.js +180 -0
  143. package/dist/written-props.js.map +1 -0
  144. package/package.json +88 -3
@@ -0,0 +1,220 @@
1
+ import type { Insets, TouchEvent } from './events.ts';
2
+ import { ViewBase } from './view-base.ts';
3
+ import * as i0 from "@angular/core";
4
+ /** What a press handler receives: RN's `{nativeEvent}` shape, passed straight through. */
5
+ export type PressEvent = TouchEvent;
6
+ /**
7
+ * Android's ripple, drawn natively. `foreground` paints it over the content rather than behind.
8
+ */
9
+ export interface AndroidRipple {
10
+ readonly color?: string | number;
11
+ readonly borderless?: boolean;
12
+ readonly radius?: number;
13
+ readonly foreground?: boolean;
14
+ }
15
+ /** What `rippleDrawable` builds: Android's `RippleAndroid` drawable description. */
16
+ interface RippleDrawable {
17
+ readonly type: 'RippleAndroid';
18
+ readonly color: unknown;
19
+ readonly borderless: boolean;
20
+ readonly rippleRadius: number | undefined;
21
+ }
22
+ /**
23
+ * The press machine, and the base of every primitive that takes a touch.
24
+ *
25
+ * It declares no host bindings of its own, because `Text` extends it and a host binding runs on
26
+ * every element that carries it, on every pass. The controls bind theirs through `ControlBase`.
27
+ */
28
+ export declare abstract class TouchableBase extends ViewBase {
29
+ /** Ignore touches entirely. */
30
+ readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
31
+ /**
32
+ * How far outside the hit area a touch may wander before the press is cancelled. Native's
33
+ * `hitSlop` grows the area a touch can start in; this grows the area it may move within.
34
+ */
35
+ readonly pressRetentionOffset: import("@angular/core").InputSignal<number | Insets | undefined>;
36
+ /** Milliseconds a touch must be held before `(longPress)` fires. */
37
+ readonly delayLongPress: import("@angular/core").InputSignalWithTransform<number, unknown>;
38
+ /** Milliseconds between the touch landing and `(pressIn)`, so a scroll can start first. */
39
+ readonly delayPressIn: import("@angular/core").InputSignalWithTransform<number, unknown>;
40
+ /** Milliseconds between the touch lifting and `(pressOut)`. */
41
+ readonly delayPressOut: import("@angular/core").InputSignalWithTransform<number, unknown>;
42
+ /** The pressed state lasts at least this long, so a quick tap still shows it. */
43
+ readonly minPressDuration: import("@angular/core").InputSignalWithTransform<number, unknown>;
44
+ /** Whether a scrolling ancestor may take the gesture away mid-press. */
45
+ readonly cancelable: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
46
+ /** Android: a native ripple on press. */
47
+ readonly androidRipple: import("@angular/core").InputSignal<AndroidRipple | undefined>;
48
+ /** The touch lifted inside the press area. Not fired after a `(longPress)` that has a listener. */
49
+ readonly press: import("@angular/core").OutputEmitterRef<TouchEvent>;
50
+ readonly pressIn: import("@angular/core").OutputEmitterRef<TouchEvent>;
51
+ readonly pressOut: import("@angular/core").OutputEmitterRef<TouchEvent>;
52
+ /**
53
+ * The touch has been held for `delayLongPress`. With no listener there is no long press, as in
54
+ * React Native, so a slow tap is still a `press`.
55
+ */
56
+ readonly longPress: import("@angular/core").OutputEmitterRef<TouchEvent>;
57
+ /** Whether a press is in progress, for the pressed look. */
58
+ readonly pressed: import("@angular/core").WritableSignal<boolean>;
59
+ /**
60
+ * Whether a pointer is over the control, which on this platform means an iPad with a trackpad
61
+ * or a mouse. Always false on a phone, because a phone never sends a pointer event.
62
+ *
63
+ * Opted into by exactly the elements that opt into being measured, which is the same question
64
+ * asked twice: is this a control, or is it a piece of text that merely inherits the machinery.
65
+ * Registering on everything was the first attempt and put two props on every paragraph on
66
+ * screen, which is the most numerous node in an app paying for a state a label cannot use.
67
+ */
68
+ readonly hovered: import("@angular/core").WritableSignal<boolean>;
69
+ protected rippleBackground(): RippleDrawable | undefined;
70
+ protected rippleForeground(): RippleDrawable | undefined;
71
+ private drawn;
72
+ private drawable;
73
+ /**
74
+ * The drawable description Android's `ReactDrawableHelper` reads.
75
+ *
76
+ * `color` goes through the engine the way every other colour prop does, and has to: the helper
77
+ * switches on the value's runtime type and takes a number or a platform-colour map, and anything
78
+ * else - a `'#ff0000'` written at the call site, say - falls through to `null` and the ripple
79
+ * draws in the theme's own `colorControlHighlight` instead. Nothing is logged and nothing throws,
80
+ * so the ripple appears and is simply the wrong colour. RN's own `TouchableNativeFeedback.Ripple`
81
+ * calls `processColor` here for the same reason.
82
+ */
83
+ private rippleDrawable;
84
+ /** Where the touch started, so a drag can be told apart from a tap. */
85
+ private origin;
86
+ /** The control's own size, from its last layout. Null until it has been measured once. */
87
+ private size;
88
+ private cancelled;
89
+ private longPressed;
90
+ /** How many `(longPress)` listeners there are; the long-press clock only runs with one. */
91
+ private longPressListeners;
92
+ private pressedAt;
93
+ private pressInTimer;
94
+ private longPressTimer;
95
+ private pressOutTimer;
96
+ constructor();
97
+ /** Called as a press starts and ends, for a subclass that shows it natively. `Text` does. */
98
+ protected pressedChanged(_pressed: boolean): void;
99
+ /** Whether a touch starting on this node should be claimed. `Text` narrows it. */
100
+ protected claims(): boolean;
101
+ /**
102
+ * Whether the control's size should be tracked. Native only measures a view that asks, so
103
+ * this must not be true for every `<text>`: a pressable text opts in, a label never does.
104
+ */
105
+ protected measures(): boolean;
106
+ /**
107
+ * Whether a touch this far from where it started is still on the control.
108
+ *
109
+ * Distance from the origin is the wrong question on anything large: a thumb tap on a full-width
110
+ * button easily travels twenty points without ever leaving it, and cancelling there reads as
111
+ * "the button doesn't work", intermittently and only for some people. What matters is whether
112
+ * the finger is still within the control plus its hit slop, plus the slop RN allows.
113
+ *
114
+ * The touch began somewhere inside the control but we do not know where, so the bound is the
115
+ * full extent rather than half of it. That errs towards keeping the press, which is the right
116
+ * way to be wrong: a press that survives a drag the user meant as a scroll is a smaller sin
117
+ * than a tap that does nothing.
118
+ */
119
+ private stillOnControl;
120
+ /**
121
+ * A lifecycle hook rather than `inject(DestroyRef).onDestroy`: Angular registers a hook once per
122
+ * directive type, where the callback was a closure and a lookup for every instance - and every
123
+ * `<text>` on screen is one.
124
+ */
125
+ ngOnDestroy(): void;
126
+ private stopResponding;
127
+ private stopLayout;
128
+ private stopHover;
129
+ ngOnInit(): void;
130
+ ngOnChanges(): void;
131
+ /**
132
+ * Join the responder negotiation, once this is something a touch can press.
133
+ *
134
+ * Behind `measures()` for the same reason as layout and hover: a `<text>` is the commonest node
135
+ * on screen and almost never a control, and registering every one cost a handler object, six
136
+ * closures and a responder entry apiece for a touch it would have refused anyway.
137
+ */
138
+ private respondIfNeeded;
139
+ /**
140
+ * `onLayout` is opted into by the engine as soon as something listens for it, which is the only
141
+ * way the native side reports a view's size at all, and the reason it is only asked for once
142
+ * `measures()` says so - a `<text>` answers that from an input, and most of them say no.
143
+ *
144
+ * Called from the lifecycle rather than watched by an effect. An effect per element is an
145
+ * allocation and a scheduler entry for every pressable and every piece of text on screen, to
146
+ * notice a change these two hooks already see.
147
+ */
148
+ /**
149
+ * Hover, on the same terms and behind the same question.
150
+ *
151
+ * Fabric will not dispatch a pointer event to a view whose props have not asked for one, and
152
+ * the engine writes those props when something listens - so listening is the whole opt-in. The
153
+ * gate is `measures()`, which is not what its name is about but is the right question underneath
154
+ * it: is this an actual control, or a piece of text that merely inherits the machinery. A label
155
+ * says no, and two props on every paragraph on screen is not a cost worth paying for a hover
156
+ * state a label has no use for.
157
+ *
158
+ * Never true on a phone, which sends no pointer events at all. This is the one thing an iPad
159
+ * with a trackpad has that a phone does not.
160
+ */
161
+ private hoverIfNeeded;
162
+ private measureIfNeeded;
163
+ private onGrant;
164
+ /** `pressIn`, and the long-press clock starts from here. */
165
+ private activate;
166
+ private onMove;
167
+ private onRelease;
168
+ private onTerminate;
169
+ /** `pressOut`, no sooner than `minPressDuration` after `pressIn` and after `delayPressOut`. */
170
+ private deactivate;
171
+ private clearTimers;
172
+ static ɵfac: i0.ɵɵFactoryDeclaration<TouchableBase, never>;
173
+ static ɵdir: i0.ɵɵDirectiveDeclaration<TouchableBase, never, never, { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "pressRetentionOffset": { "alias": "pressRetentionOffset"; "required": false; "isSignal": true; }; "delayLongPress": { "alias": "delayLongPress"; "required": false; "isSignal": true; }; "delayPressIn": { "alias": "delayPressIn"; "required": false; "isSignal": true; }; "delayPressOut": { "alias": "delayPressOut"; "required": false; "isSignal": true; }; "minPressDuration": { "alias": "minPressDuration"; "required": false; "isSignal": true; }; "cancelable": { "alias": "cancelable"; "required": false; "isSignal": true; }; "androidRipple": { "alias": "android_ripple"; "required": false; "isSignal": true; }; }, { "press": "press"; "pressIn": "pressIn"; "pressOut": "pressOut"; "longPress": "longPress"; }, never, never, true, never>;
174
+ }
175
+ /**
176
+ * A touchable that is a control: `Pressable`, `TouchableOpacity` and `PressBehavior`.
177
+ *
178
+ * The three host bindings every control needs live here rather than on `TouchableBase`, which
179
+ * `Text` extends: the state that follows `disabled`, and the Android ripple. Controls are few
180
+ * enough on a screen to pay for a binding on every pass; texts are not.
181
+ */
182
+ export declare abstract class ControlBase extends TouchableBase {
183
+ static ɵfac: i0.ɵɵFactoryDeclaration<ControlBase, never>;
184
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ControlBase, never, never, {}, {}, never, never, true, never>;
185
+ }
186
+ /**
187
+ * The press machine on its own, for a component that wants to be pressable rather than to
188
+ * contain something that is.
189
+ *
190
+ * No selector: this is only ever a `hostDirectives` entry. A component listing it gets the whole
191
+ * of `TouchableBase` on its own host node - the responder negotiation, the press rectangle, the
192
+ * delays and the long-press timer - instead of wrapping a `<pressable>` and paying for a second
193
+ * native view.
194
+ *
195
+ * It provides `TouchableBase`, so a primitive on the same node can `inject(TouchableBase)` and
196
+ * read `pressed` without caring whether it landed on this or on a real `<pressable>`.
197
+ */
198
+ export declare class PressBehavior extends ControlBase {
199
+ protected accessibleByDefault(): boolean;
200
+ protected focusableByDefault(): boolean;
201
+ protected disabledForAccessibility(): boolean;
202
+ static ɵfac: i0.ɵɵFactoryDeclaration<PressBehavior, never>;
203
+ static ɵdir: i0.ɵɵDirectiveDeclaration<PressBehavior, never, never, {}, {}, never, never, true, never>;
204
+ }
205
+ /**
206
+ * A view that responds to presses. RN's `Pressable`, with the same configuration: hit slop,
207
+ * retention offset, press-in and press-out delays, long press, and an Android ripple.
208
+ *
209
+ * `pressed` is a public signal, so a template can style from it through a template reference:
210
+ * `<pressable #p [style.opacity]="p.pressed() ? 0.5 : 1">`.
211
+ */
212
+ export declare class Pressable extends ControlBase {
213
+ /** `Pressable.js`: a control is an accessibility element, and focusable, unless refused. */
214
+ protected accessibleByDefault(): boolean;
215
+ protected focusableByDefault(): boolean;
216
+ protected disabledForAccessibility(): boolean;
217
+ static ɵfac: i0.ɵɵFactoryDeclaration<Pressable, never>;
218
+ static ɵdir: i0.ɵɵDirectiveDeclaration<Pressable, "pressable", ["pressable"], {}, {}, never, never, true, never>;
219
+ }
220
+ export {};