@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.
Files changed (48) hide show
  1. package/README.md +13 -3
  2. package/dist/{block-Iga-mCeC.d.ts → block-BfJT3F6B.d.ts} +3 -3
  3. package/dist/{blocks-BQY_df3j.d.ts → blocks-DoY_Z-Lh.d.ts} +69 -7
  4. package/dist/{chunk-6BT4PTGH.js → chunk-6UVWYJPZ.js} +15 -5
  5. package/dist/chunk-6UVWYJPZ.js.map +1 -0
  6. package/dist/{chunk-EWHO5WQU.js → chunk-JWIBRHDE.js} +21 -9
  7. package/dist/chunk-JWIBRHDE.js.map +1 -0
  8. package/dist/{chunk-YIF4BFQH.js → chunk-JZHDEU4Q.js} +130 -13
  9. package/dist/chunk-JZHDEU4Q.js.map +1 -0
  10. package/dist/devtools.d.ts +101 -8
  11. package/dist/devtools.js +180 -104
  12. package/dist/devtools.js.map +1 -1
  13. package/dist/index.d.ts +5 -5
  14. package/dist/index.js +4 -5
  15. package/dist/index.js.map +1 -1
  16. package/dist/observability.d.ts +14 -8
  17. package/dist/observability.js +3 -3
  18. package/dist/persist.d.ts +1 -1
  19. package/dist/push.d.ts +4 -4
  20. package/dist/push.js +1 -1
  21. package/dist/push.js.map +1 -1
  22. package/dist/{query--ihYsJWC.d.ts → query-DJFrykK_.d.ts} +38 -2
  23. package/dist/{screen-boundary-B8DlsLwb.d.ts → screen-boundary-Da3qleNz.d.ts} +5 -1
  24. package/dist/updates.d.ts +3 -3
  25. package/dist/updates.js +6 -6
  26. package/dist/updates.js.map +1 -1
  27. package/package.json +50 -8
  28. package/src/app.tsx +2 -1
  29. package/src/blocks.tsx +20 -5
  30. package/src/devtools/block.tsx +281 -152
  31. package/src/devtools/index.ts +4 -3
  32. package/src/devtools/settings.ts +50 -0
  33. package/src/devtools/slots.ts +15 -0
  34. package/src/errors.tsx +144 -13
  35. package/src/index.ts +4 -0
  36. package/src/observability/block.tsx +1 -1
  37. package/src/observability/index.ts +1 -1
  38. package/src/observability/scrub.ts +22 -4
  39. package/src/push/block.tsx +1 -1
  40. package/src/screen-boundary.tsx +13 -2
  41. package/src/updates/block.tsx +7 -5
  42. package/src/updates/index.ts +1 -1
  43. package/src/updates/signature.ts +52 -3
  44. package/dist/chunk-65P7RU4V.js +0 -49
  45. package/dist/chunk-65P7RU4V.js.map +0 -1
  46. package/dist/chunk-6BT4PTGH.js.map +0 -1
  47. package/dist/chunk-EWHO5WQU.js.map +0 -1
  48. 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.11.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-features": "^0.9.0"
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.16.0",
156
- "@marktiderman/genesis-design-system": "^1.12.0",
157
- "@marktiderman/genesis-ui-native": "^3.12.0",
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.105.0",
160
- "@tanstack/query-persist-client-core": "5.105.0",
161
- "@tanstack/react-query": "5.105.0",
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-features/blocks";
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-features/blocks`) with the two things only a native
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-features/blocks";
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
- * Calls each row's `useSubtitle` hook, so call it unconditionally at the top
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
- return mergeBlockSettings(sections, rows, subtitles, options);
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: [] };