@marktiderman/genesis-native 0.11.0 → 0.13.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 +13 -3
- package/dist/{block-Iga-mCeC.d.ts → block-BfJT3F6B.d.ts} +3 -3
- package/dist/{blocks-BQY_df3j.d.ts → blocks-DoY_Z-Lh.d.ts} +69 -7
- package/dist/{chunk-6BT4PTGH.js → chunk-6UVWYJPZ.js} +15 -5
- package/dist/chunk-6UVWYJPZ.js.map +1 -0
- package/dist/{chunk-EWHO5WQU.js → chunk-JWIBRHDE.js} +21 -9
- package/dist/chunk-JWIBRHDE.js.map +1 -0
- package/dist/{chunk-YIF4BFQH.js → chunk-JZHDEU4Q.js} +130 -13
- package/dist/chunk-JZHDEU4Q.js.map +1 -0
- package/dist/devtools.d.ts +101 -8
- package/dist/devtools.js +180 -104
- package/dist/devtools.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/observability.d.ts +14 -8
- package/dist/observability.js +3 -3
- package/dist/persist.d.ts +1 -1
- package/dist/push.d.ts +4 -4
- package/dist/push.js +1 -1
- package/dist/push.js.map +1 -1
- package/dist/{query--ihYsJWC.d.ts → query-DJFrykK_.d.ts} +38 -2
- package/dist/{screen-boundary-B8DlsLwb.d.ts → screen-boundary-Da3qleNz.d.ts} +5 -1
- package/dist/updates.d.ts +3 -3
- package/dist/updates.js +6 -6
- package/dist/updates.js.map +1 -1
- package/package.json +50 -8
- package/src/app.tsx +2 -1
- package/src/blocks.tsx +20 -5
- package/src/devtools/block.tsx +281 -152
- package/src/devtools/index.ts +4 -3
- package/src/devtools/settings.ts +50 -0
- package/src/devtools/slots.ts +15 -0
- package/src/errors.tsx +144 -13
- package/src/index.ts +4 -0
- package/src/observability/block.tsx +1 -1
- package/src/observability/index.ts +1 -1
- package/src/observability/scrub.ts +22 -4
- package/src/push/block.tsx +1 -1
- package/src/screen-boundary.tsx +13 -2
- package/src/updates/block.tsx +7 -5
- package/src/updates/index.ts +1 -1
- package/src/updates/signature.ts +52 -3
- package/dist/chunk-65P7RU4V.js +0 -49
- package/dist/chunk-65P7RU4V.js.map +0 -1
- package/dist/chunk-6BT4PTGH.js.map +0 -1
- package/dist/chunk-EWHO5WQU.js.map +0 -1
- package/dist/chunk-YIF4BFQH.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marktiderman/genesis-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"README.md"
|
|
108
108
|
],
|
|
109
109
|
"dependencies": {
|
|
110
|
-
"@marktiderman/genesis-
|
|
110
|
+
"@marktiderman/genesis-config": "^0.12.0"
|
|
111
111
|
},
|
|
112
112
|
"peerDependencies": {
|
|
113
113
|
"@marktiderman/genesis-core": ">=2.11.0 <3.0.0",
|
|
@@ -152,13 +152,13 @@
|
|
|
152
152
|
}
|
|
153
153
|
},
|
|
154
154
|
"devDependencies": {
|
|
155
|
-
"@marktiderman/genesis-core": "^2.
|
|
156
|
-
"@marktiderman/genesis-design-system": "^1.
|
|
157
|
-
"@marktiderman/genesis-ui-native": "^3.
|
|
155
|
+
"@marktiderman/genesis-core": "^2.20.0",
|
|
156
|
+
"@marktiderman/genesis-design-system": "^1.13.0",
|
|
157
|
+
"@marktiderman/genesis-ui-native": "^3.15.0",
|
|
158
158
|
"@supabase/supabase-js": "^2.118.0",
|
|
159
|
-
"@tanstack/query-async-storage-persister": "5.
|
|
160
|
-
"@tanstack/query-persist-client-core": "5.
|
|
161
|
-
"@tanstack/react-query": "5.
|
|
159
|
+
"@tanstack/query-async-storage-persister": "5.107.1",
|
|
160
|
+
"@tanstack/query-persist-client-core": "5.107.1",
|
|
161
|
+
"@tanstack/react-query": "5.107.1",
|
|
162
162
|
"@testing-library/react": "^16.3.2",
|
|
163
163
|
"@types/react": "^19.2.14",
|
|
164
164
|
"expo": "~58.0.19",
|
|
@@ -374,6 +374,48 @@
|
|
|
374
374
|
"why": "The boot, the fatal screen with retry, the cache and the session gate are one root; rebuilding them by hand loses the error handling."
|
|
375
375
|
}
|
|
376
376
|
]
|
|
377
|
+
},
|
|
378
|
+
"settings": {
|
|
379
|
+
"namespace": "devtools",
|
|
380
|
+
"keys": {
|
|
381
|
+
"overlay": {
|
|
382
|
+
"type": "boolean",
|
|
383
|
+
"default": true,
|
|
384
|
+
"summary": "The Development overlay in development and preview builds. Off hides it; no setting turns it on in a production build."
|
|
385
|
+
},
|
|
386
|
+
"shakeToOpen": {
|
|
387
|
+
"type": "boolean",
|
|
388
|
+
"default": true,
|
|
389
|
+
"requires": [
|
|
390
|
+
"devtools.overlay"
|
|
391
|
+
],
|
|
392
|
+
"summary": "Shake to open the overlay (development and preview builds)."
|
|
393
|
+
},
|
|
394
|
+
"hold": {
|
|
395
|
+
"type": "boolean",
|
|
396
|
+
"default": true,
|
|
397
|
+
"requires": [
|
|
398
|
+
"devtools.overlay"
|
|
399
|
+
],
|
|
400
|
+
"summary": "A three-finger hold opens the overlay."
|
|
401
|
+
},
|
|
402
|
+
"flags": {
|
|
403
|
+
"type": "boolean",
|
|
404
|
+
"default": true,
|
|
405
|
+
"requires": [
|
|
406
|
+
"devtools.overlay"
|
|
407
|
+
],
|
|
408
|
+
"summary": "Show the app's switches and flags in the overlay."
|
|
409
|
+
},
|
|
410
|
+
"signOut": {
|
|
411
|
+
"type": "boolean",
|
|
412
|
+
"default": true,
|
|
413
|
+
"requires": [
|
|
414
|
+
"devtools.overlay"
|
|
415
|
+
],
|
|
416
|
+
"summary": "Offer Sign out in the overlay."
|
|
417
|
+
}
|
|
418
|
+
}
|
|
377
419
|
}
|
|
378
420
|
},
|
|
379
421
|
"scripts": {
|
package/src/app.tsx
CHANGED
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
import { SessionProvider, createSessionStore, type AuthClientLike } from "./auth";
|
|
63
63
|
import { useHeldLink, type HeldLinkAuth, type LinkHold } from "./held-link";
|
|
64
64
|
import { connectQueryLifecycle, createNativeQueryClient, reportQueryErrors, type QueryLifecycleOptions, type QueryPersistence } from "./query";
|
|
65
|
-
import { resolveBlocks } from "@marktiderman/genesis-
|
|
65
|
+
import { resolveBlocks } from "@marktiderman/genesis-config/blocks";
|
|
66
66
|
import { BlocksProvider, reportToBlocks, type NativeBlock } from "./blocks";
|
|
67
67
|
import type { DevtoolsSlots } from "./devtools/slots";
|
|
68
68
|
// Types only: the block's code is in the `/updates` entry and arrives with the `updates` prop.
|
|
@@ -620,6 +620,7 @@ const SLOT_NAMES: Record<keyof NativeAppSlots, true> = {
|
|
|
620
620
|
updateBanner: true,
|
|
621
621
|
whatsNew: true,
|
|
622
622
|
devtoolsFeedback: true,
|
|
623
|
+
devtoolsDiagnostics: true,
|
|
623
624
|
pushPrompt: true,
|
|
624
625
|
};
|
|
625
626
|
const NATIVE_APP_SLOT_NAMES: readonly string[] = Object.keys(SLOT_NAMES);
|
package/src/blocks.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Blocks on native: `defineBlock` declarations (from
|
|
3
|
-
* `@marktiderman/genesis-
|
|
3
|
+
* `@marktiderman/genesis-config/blocks`) with the two things only a native
|
|
4
4
|
* shell can run, boot steps behind the splash and a root around the screens.
|
|
5
5
|
* `<GenesisNativeApp blocks={[…]}>` resolves them once, runs their steps,
|
|
6
6
|
* mounts their roots, puts their slot fills under the app's own `slots`, and
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { createContext, useContext, type ComponentType, type ReactNode } from "react";
|
|
10
10
|
import type { SlotPropsFor, Slots } from "@marktiderman/genesis-core/slots";
|
|
11
|
-
import type { BlockDef, BlockSettingsRow, Contributed, ResolvedBlocks } from "@marktiderman/genesis-
|
|
11
|
+
import type { BlockDef, BlockSettingsRow, Contributed, ResolvedBlocks } from "@marktiderman/genesis-config/blocks";
|
|
12
12
|
import type { BootStep } from "./boot";
|
|
13
13
|
import type { ErrorReport } from "./errors";
|
|
14
14
|
import type { NativeAppSlots } from "./app";
|
|
@@ -37,6 +37,12 @@ export interface NativeBlock<Id extends string = string> extends BlockDef<Id, Co
|
|
|
37
37
|
* throw is ignored.
|
|
38
38
|
*/
|
|
39
39
|
readonly onError?: (error: Error, report: ErrorReport) => void;
|
|
40
|
+
/**
|
|
41
|
+
* "Report this" on the fatal and screen error screens: the support block opens its feedback form
|
|
42
|
+
* with the error attached. `app`: the app's screens were replaced by the fatal screen, and are
|
|
43
|
+
* remounting ("Try again") as this is called.
|
|
44
|
+
*/
|
|
45
|
+
readonly reportProblem?: (error: Error, where: { kind: "app" | "screen" }) => void;
|
|
40
46
|
}
|
|
41
47
|
|
|
42
48
|
/** @internal Hand an error to each block's `onError`; one that throws never stops the rest. */
|
|
@@ -56,6 +62,11 @@ const BlocksContext = createContext<ResolvedBlocks<NativeBlock> | null>(null);
|
|
|
56
62
|
/** @internal Provided by GenesisNativeApp. */
|
|
57
63
|
export const BlocksProvider = BlocksContext.Provider;
|
|
58
64
|
|
|
65
|
+
/** @internal The resolved blocks, or null outside GenesisNativeApp (an error screen must never throw for want of them). */
|
|
66
|
+
export function useOptionalBlocks(): ResolvedBlocks<NativeBlock> | null {
|
|
67
|
+
return useContext(BlocksContext);
|
|
68
|
+
}
|
|
69
|
+
|
|
59
70
|
/**
|
|
60
71
|
* The resolved blocks: their ids, nav entries, Settings rows, routes and the
|
|
61
72
|
* rest, each tagged with its FeatureId. Throws outside `GenesisNativeApp`.
|
|
@@ -99,7 +110,8 @@ export interface UseBlockSettingsOptions {
|
|
|
99
110
|
* at the end of the section its `section` names (by `order`, then block
|
|
100
111
|
* order), and a section no one has yet is added after the rest.
|
|
101
112
|
*
|
|
102
|
-
*
|
|
113
|
+
* A row whose `useShown` hook says false is left out. Calls each row's `useSubtitle` and
|
|
114
|
+
* `useShown` hooks, so call it unconditionally at the top
|
|
103
115
|
* of the Settings screen. The blocks are fixed for the life of the app, so
|
|
104
116
|
* the hooks run in the same order on every render.
|
|
105
117
|
*
|
|
@@ -113,18 +125,21 @@ export function useBlockSettings<R extends SettingsRowLike>(
|
|
|
113
125
|
const rows = blocks?.settings ?? [];
|
|
114
126
|
// The same hooks in the same order every render: `rows` never changes once the shell has resolved it.
|
|
115
127
|
const subtitles = rows.map((row) => row.useSubtitle?.());
|
|
116
|
-
|
|
128
|
+
const shown = rows.map((row) => row.useShown?.() ?? true);
|
|
129
|
+
return mergeBlockSettings(sections, rows, subtitles, options, shown);
|
|
117
130
|
}
|
|
118
131
|
|
|
119
|
-
/** The merge `useBlockSettings` does, without hooks (subtitles already read). @stability Beta */
|
|
132
|
+
/** The merge `useBlockSettings` does, without hooks (subtitles and `shown` already read; a row shown false is left out). @stability Beta */
|
|
120
133
|
export function mergeBlockSettings<R extends SettingsRowLike>(
|
|
121
134
|
sections: readonly BlockSettingsSection<R>[],
|
|
122
135
|
rows: readonly Contributed<BlockSettingsRow>[],
|
|
123
136
|
subtitles: readonly (string | null | undefined)[] = [],
|
|
124
137
|
options: UseBlockSettingsOptions = {},
|
|
138
|
+
shown: readonly boolean[] = [],
|
|
125
139
|
): BlockSettingsSection<R | SettingsRowLike>[] {
|
|
126
140
|
const out: BlockSettingsSection<R | SettingsRowLike>[] = sections.map((s) => ({ ...s, rows: [...s.rows] }));
|
|
127
141
|
rows.forEach((row, i) => {
|
|
142
|
+
if (shown[i] === false) return;
|
|
128
143
|
let section = out.find((s) => s.id === row.section);
|
|
129
144
|
if (!section) {
|
|
130
145
|
section = { id: row.section, title: options.sectionTitles?.[row.section] ?? row.section, rows: [] };
|