@marktiderman/genesis-ui-native 3.5.1 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -7
- package/dist/{chunk-LBVD7XXL.js → chunk-2Z72MYHB.js} +627 -20
- package/dist/chunk-2Z72MYHB.js.map +1 -0
- package/dist/chunk-4OQOJ2OC.js +80 -0
- package/dist/chunk-4OQOJ2OC.js.map +1 -0
- package/dist/{chunk-6KWEAGRD.js → chunk-6PGLX6ET.js} +101 -6
- package/dist/chunk-6PGLX6ET.js.map +1 -0
- package/dist/{chunk-ONH2PCGH.js → chunk-AGTBABAH.js} +9 -15
- package/dist/chunk-AGTBABAH.js.map +1 -0
- package/dist/{chunk-ABVSSJNT.js → chunk-FUMSL7VZ.js} +198 -168
- package/dist/chunk-FUMSL7VZ.js.map +1 -0
- package/dist/{chunk-GHYUNNNU.js → chunk-NDXNSSM6.js} +175 -93
- package/dist/chunk-NDXNSSM6.js.map +1 -0
- package/dist/chunk-SEJ6RBP7.js +361 -0
- package/dist/chunk-SEJ6RBP7.js.map +1 -0
- package/dist/{chunk-D5RKSPMH.js → chunk-ZRQAFFTN.js} +4 -3
- package/dist/chunk-ZRQAFFTN.js.map +1 -0
- package/dist/components/index.d.ts +331 -4
- package/dist/components/index.js +5 -5
- package/dist/data/index.d.ts +68 -4
- package/dist/data/index.js +231 -30
- package/dist/data/index.js.map +1 -1
- package/dist/hooks/index.d.ts +60 -1
- package/dist/hooks/index.js +2 -3
- package/dist/icons/lucide.d.ts +1 -1
- package/dist/icons/lucide.js +7 -1
- package/dist/icons/lucide.js.map +1 -1
- package/dist/{inbox-page-BEarNEIP.d.ts → inbox-page-B7_Oi2fS.d.ts} +2 -44
- package/dist/index.d.ts +8 -5
- package/dist/index.js +8 -8
- package/dist/layouts/index.d.ts +40 -51
- package/dist/layouts/index.js +5 -4
- package/dist/{native-modules-PwnGltOU.d.ts → native-modules-Cl3zw3kh.d.ts} +27 -1
- package/package.json +78 -4
- package/src/__tests__/doctor-rules.test.ts +60 -0
- package/src/__tests__/native-modules-lists.test.tsx +1 -0
- package/src/components/__tests__/composer-bar.test.tsx +55 -0
- package/src/components/__tests__/gallery-card.test.tsx +59 -0
- package/src/components/__tests__/gallery-grid.test.tsx +160 -0
- package/src/components/__tests__/lightbox-resnap.test.tsx +50 -0
- package/src/components/__tests__/lightbox-zoom.test.ts +33 -0
- package/src/components/__tests__/lightbox.test.tsx +141 -0
- package/src/components/__tests__/live-indicator.test.tsx +72 -0
- package/src/components/__tests__/rating.test.tsx +82 -0
- package/src/components/__tests__/thread-list.test.tsx +156 -0
- package/src/components/composer-bar.tsx +198 -0
- package/src/components/drawer.tsx +15 -9
- package/src/components/gallery-card.tsx +109 -0
- package/src/components/gallery-grid.tsx +285 -0
- package/src/components/gallery-layout.ts +2 -0
- package/src/components/gallery-types.ts +2 -0
- package/src/components/index.ts +44 -0
- package/src/components/lightbox-zoom.tsx +282 -0
- package/src/components/lightbox.tsx +342 -0
- package/src/components/live-indicator.tsx +139 -0
- package/src/components/rating.tsx +128 -0
- package/src/components/skeleton.tsx +9 -4
- package/src/components/thread-list.tsx +427 -0
- package/src/components/toast.tsx +7 -4
- package/src/data/NativeConflictSheet.tsx +181 -0
- package/src/data/NativeResourceForm.tsx +15 -1
- package/src/data/index.ts +2 -0
- package/src/data/resource-view/NativeRecordView.tsx +85 -8
- package/src/data/resource-view/NativeResourceView.tsx +79 -32
- package/src/data/resource-view/__tests__/native-record-view.test.tsx +95 -1
- package/src/data/resource-view/__tests__/native-resource-gallery.test.tsx +125 -0
- package/src/hooks/__tests__/use-motion.test.tsx +106 -0
- package/src/hooks/__tests__/use-thread-jump.test.tsx +88 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/use-motion.ts +128 -0
- package/src/hooks/use-thread-jump.ts +110 -0
- package/src/icon-names.ts +6 -0
- package/src/icons/lucide.ts +12 -0
- package/src/layouts/__tests__/inbox-page.test.tsx +6 -0
- package/src/layouts/__tests__/thread-page.test.tsx +114 -14
- package/src/layouts/inbox-page.tsx +6 -55
- package/src/layouts/index.ts +2 -0
- package/src/layouts/thread-page.tsx +326 -262
- package/src/native-modules.tsx +16 -2
- package/dist/chunk-6KWEAGRD.js.map +0 -1
- package/dist/chunk-7PCWEY6R.js +0 -27
- package/dist/chunk-7PCWEY6R.js.map +0 -1
- package/dist/chunk-ABVSSJNT.js.map +0 -1
- package/dist/chunk-D5RKSPMH.js.map +0 -1
- package/dist/chunk-GHYUNNNU.js.map +0 -1
- package/dist/chunk-LBVD7XXL.js.map +0 -1
- package/dist/chunk-ONH2PCGH.js.map +0 -1
- package/dist/chunk-Z3AQYVUA.js +0 -36
- package/dist/chunk-Z3AQYVUA.js.map +0 -1
package/README.md
CHANGED
|
@@ -163,6 +163,39 @@ import { AuthScreen, appleProvider } from "@marktiderman/genesis-ui-native/layou
|
|
|
163
163
|
asks with `Alert.alert` (a destructive button) and then calls `deleteMyAccount(supabase)` from
|
|
164
164
|
`@marktiderman/genesis-supabase`. The example and the SQL it needs are in that package's README.
|
|
165
165
|
|
|
166
|
+
## Motion
|
|
167
|
+
|
|
168
|
+
Motion is defined once, in `@marktiderman/genesis-design-system`'s motion tokens (`resolveMotion`):
|
|
169
|
+
durations (`press`, `fast`, `base`, `ui`, `pulse`, …), easings (`out`, `swift`, `inOut`, `decelerate`)
|
|
170
|
+
and springs (`snappy`, `smooth`, `bouncy`). Web reads them as the design system's `--ds-dur-*` and
|
|
171
|
+
`--ds-ease-*` variables; on the phone, `useMotion()` gives the same tokens with the OS's Reduce
|
|
172
|
+
Motion applied, and `animateMotion` turns them into a Reanimated animation on the JS thread. Under
|
|
173
|
+
Reduce Motion it returns the final value, so nothing moves. Inside a worklet (a gesture's `onEnd`),
|
|
174
|
+
or when you need a completion callback (a worklet), build the config with `motionSpring` or
|
|
175
|
+
`motionTiming(motion, duration, Easing)` and call Reanimated yourself. Under Reduce Motion the
|
|
176
|
+
springs are stiff and critically damped, so they settle in a few frames. Pass the
|
|
177
|
+
brand's level (`useMotion({ level })`) until a provider carries it; without it, `calm`. A repeating
|
|
178
|
+
animation checks `motion.reduced` first. Drawer, Toast and Skeleton read their durations from the
|
|
179
|
+
tokens.
|
|
180
|
+
|
|
181
|
+
```tsx
|
|
182
|
+
import { animateMotion, useGenesisModules, useMotion } from "@marktiderman/genesis-ui-native";
|
|
183
|
+
|
|
184
|
+
function useSnapBack(offset: { value: number }) {
|
|
185
|
+
const { reanimated } = useGenesisModules();
|
|
186
|
+
const motion = useMotion();
|
|
187
|
+
return (velocity: number) => {
|
|
188
|
+
if (!reanimated) return;
|
|
189
|
+
offset.value = animateMotion(reanimated, motion, 0, { spring: "snappy", velocity });
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
The doctor's `motion-uses-tokens` rule warns on new code that writes a non-zero duration or spring as
|
|
195
|
+
a number literal in the config of `withTiming`, `withSpring`, `Animated.timing` or `Animated.spring`,
|
|
196
|
+
or in a Reanimated layout animation's `.duration()` / `.damping()` / `.stiffness()`. A named
|
|
197
|
+
constant, a config held in a variable, and a first argument containing parentheses aren't caught.
|
|
198
|
+
|
|
166
199
|
## Inbox and thread: `InboxPage` and `ThreadPage`
|
|
167
200
|
|
|
168
201
|
Two generic layouts for conversations (support tickets, direct messages, comment threads), in
|
|
@@ -174,13 +207,44 @@ Two generic layouts for conversations (support tickets, direct messages, comment
|
|
|
174
207
|
VoiceOver / TalkBack custom actions and on long press (a menu); for the swipe gesture itself,
|
|
175
208
|
fill the `swipeable` slot with react-native-gesture-handler's `ReanimatedSwipeable`. Slots:
|
|
176
209
|
`row`, `swipeable`, `header`, `footer`, `empty`.
|
|
177
|
-
- **`ThreadPage`**:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
210
|
+
- **`ThreadPage`**: one conversation, built from the two atoms below.
|
|
211
|
+
- **The list:**
|
|
212
|
+
- messages oldest first (mine trailing in the tint, theirs leading on `surface`), and
|
|
213
|
+
`kind: "event"` rows as centred, muted lines;
|
|
214
|
+
- attachments, and a read receipt under my newest message the other side has read (`readAt`);
|
|
215
|
+
- holds its place while earlier messages load (by themselves near the top, and with the
|
|
216
|
+
"Load earlier" button, which VoiceOver needs);
|
|
217
|
+
- follows the newest only when you're at the bottom, with a "Jump to latest" pill when you
|
|
218
|
+
aren't;
|
|
219
|
+
- `firstUnreadId` (a "New messages" divider), and `jumpTo` with `onLoadUntil` (go to a
|
|
220
|
+
message: it waits for `loading`, highlights the message for two seconds and announces it;
|
|
221
|
+
one that can't be found is announced and the list goes back to the newest);
|
|
222
|
+
- `loading` (a skeleton, not the empty state) and `updating` (a quiet "Updating…" line under
|
|
223
|
+
the header region while fresher rows arrive, announced once).
|
|
224
|
+
- **Send states** are data: `sending`, `pending` (queued offline), `paused` (sign in to send),
|
|
225
|
+
`failed` and `conflict`, with `onRetry` and `onDiscard` (also VoiceOver actions; Discard only
|
|
226
|
+
on a message that hasn't gone). An internal note (`tone: "internal"`) says so to VoiceOver. Keep each
|
|
227
|
+
message's `id` the same across refreshes (a cache, then the server), or the list jumps.
|
|
228
|
+
- **The composer** grows as you type, has a 44pt send button, stays editable while sending, and
|
|
229
|
+
takes `modes` with a tone: an `internal` mode ("Internal note") edges the bar and the note it
|
|
230
|
+
sends in the `warning` role. `above` and `trailing` take a reply preview and a mic.
|
|
231
|
+
- **Keyboard:** with `GenesisModules.keyboardAvoidingView` (react-native-keyboard-controller's,
|
|
232
|
+
1.21 or later) the composer follows the keyboard frame by frame and the page finds its own
|
|
233
|
+
offset (`automaticOffset`); without it, React Native's `KeyboardAvoidingView` with
|
|
234
|
+
`keyboardVerticalOffset` (100 on iOS by default; `height` on Android). Dragging the list
|
|
235
|
+
dismisses the keyboard. The header region stays put. **Upgrading:** an app that already sets
|
|
236
|
+
up keyboard-controller for forms (`keyboardScroll`) passes its `KeyboardAvoidingView` as
|
|
237
|
+
`keyboardAvoidingView` too; a development warning says when it's missing.
|
|
238
|
+
- **Read-only:** `composer={null}`, with a `closedNotice`.
|
|
239
|
+
- **Slots:** `message`, `event`, `attachment`, `readReceipt`, `unreadDivider`, `composer`,
|
|
240
|
+
`composerAccessory`, `headerRegion` (pinned above the list: a ticket's status and assignee),
|
|
241
|
+
`header` (scrolls with the messages), `earlier`, `empty`.
|
|
242
|
+
- **`NativeThreadList`**: the list on its own, for a thread of your own. It renders the rows it's
|
|
243
|
+
given and never fetches. FlashList v2's chat mode when the app passed `list`, else FlatList.
|
|
244
|
+
`useThreadJump` is its jump on its own. The doctor's `threads-use-thread-list` rule warns on a
|
|
245
|
+
hand-built inverted or bottom-started list.
|
|
246
|
+
- **`NativeComposerBar`**: the composer on its own. It takes `leading`, `trailing` and `above`
|
|
247
|
+
slots, and `modes`.
|
|
184
248
|
|
|
185
249
|
`getInboxPageStackOptions()` and `getThreadPageStackOptions()` compose the header.
|
|
186
250
|
`@marktiderman/genesis-support/native` feeds both for a person's support reports.
|