@lotics/app-sdk 0.100.1 → 0.101.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 (108) hide show
  1. package/AGENTS.md +32 -47
  2. package/dist/agent_stream.d.ts +131 -0
  3. package/dist/ask_ai.d.ts +27 -0
  4. package/dist/attachments.d.ts +58 -0
  5. package/dist/chunk-ARV5FAU5.js +1132 -0
  6. package/dist/comments.d.ts +89 -0
  7. package/dist/error_report.d.ts +9 -0
  8. package/dist/folder_pick.d.ts +8 -0
  9. package/dist/geolocation.d.ts +42 -0
  10. package/dist/hooks.d.ts +251 -0
  11. package/dist/{src/index.d.ts → index.d.ts} +13 -22
  12. package/dist/index.js +31331 -0
  13. package/dist/index.js.LEGAL.txt +11 -0
  14. package/dist/members.d.ts +32 -0
  15. package/dist/mock.d.ts +37 -0
  16. package/dist/mount.d.ts +19 -0
  17. package/dist/new_record.d.ts +37 -0
  18. package/dist/open_app.d.ts +12 -0
  19. package/dist/open_external.d.ts +10 -0
  20. package/dist/overlay.d.ts +25 -0
  21. package/dist/queries.d.ts +231 -0
  22. package/dist/recording.d.ts +47 -0
  23. package/dist/recording_state.d.ts +43 -0
  24. package/dist/rename_file.d.ts +13 -0
  25. package/dist/router.d.ts +10 -0
  26. package/dist/router.js +97 -0
  27. package/dist/row.d.ts +87 -0
  28. package/dist/rpc.d.ts +114 -0
  29. package/dist/select.d.ts +24 -0
  30. package/dist/shared_types.d.ts +8 -0
  31. package/dist/store.d.ts +43 -0
  32. package/dist/types.d.ts +36 -0
  33. package/dist/upload/optimize.d.ts +30 -0
  34. package/dist/upload/pipeline.d.ts +36 -0
  35. package/dist/upload/transport.d.ts +19 -0
  36. package/dist/url_params.d.ts +55 -0
  37. package/dist/use_recents.d.ts +15 -0
  38. package/dist/{src/use_url_state.d.ts → use_url_state.d.ts} +0 -2
  39. package/dist/viewer.d.ts +41 -0
  40. package/dist/written.d.ts +79 -0
  41. package/docs/ai.md +74 -133
  42. package/docs/data_fetching.md +209 -290
  43. package/docs/files.md +61 -51
  44. package/docs/members_and_options.md +92 -62
  45. package/docs/mutations.md +136 -205
  46. package/docs/navigation_and_state.md +26 -35
  47. package/docs/queries.md +144 -207
  48. package/docs/recipes.md +21 -45
  49. package/docs/runtime.md +74 -137
  50. package/docs/security.md +8 -11
  51. package/docs/workflows.md +189 -174
  52. package/package.json +27 -28
  53. package/dist/src/agent_stream.d.ts +0 -200
  54. package/dist/src/agent_stream.js +0 -314
  55. package/dist/src/ask_ai.d.ts +0 -40
  56. package/dist/src/ask_ai.js +0 -35
  57. package/dist/src/attachments.d.ts +0 -68
  58. package/dist/src/attachments.js +0 -93
  59. package/dist/src/comments.d.ts +0 -127
  60. package/dist/src/comments.js +0 -192
  61. package/dist/src/download.js +0 -54
  62. package/dist/src/geolocation.d.ts +0 -64
  63. package/dist/src/geolocation.js +0 -96
  64. package/dist/src/hooks.d.ts +0 -781
  65. package/dist/src/hooks.js +0 -860
  66. package/dist/src/index.js +0 -34
  67. package/dist/src/members.d.ts +0 -105
  68. package/dist/src/members.js +0 -62
  69. package/dist/src/mock.d.ts +0 -118
  70. package/dist/src/mock.js +0 -124
  71. package/dist/src/mount.d.ts +0 -47
  72. package/dist/src/mount.js +0 -34
  73. package/dist/src/new_record.d.ts +0 -74
  74. package/dist/src/new_record.js +0 -117
  75. package/dist/src/open_app.d.ts +0 -15
  76. package/dist/src/open_app.js +0 -18
  77. package/dist/src/open_external.d.ts +0 -16
  78. package/dist/src/open_external.js +0 -19
  79. package/dist/src/recording.d.ts +0 -59
  80. package/dist/src/recording.js +0 -30
  81. package/dist/src/recording_state.d.ts +0 -59
  82. package/dist/src/recording_state.js +0 -94
  83. package/dist/src/router.d.ts +0 -17
  84. package/dist/src/router.js +0 -144
  85. package/dist/src/row.d.ts +0 -159
  86. package/dist/src/row.js +0 -254
  87. package/dist/src/rpc.d.ts +0 -207
  88. package/dist/src/rpc.js +0 -904
  89. package/dist/src/select.d.ts +0 -48
  90. package/dist/src/select.js +0 -40
  91. package/dist/src/types.d.ts +0 -115
  92. package/dist/src/types.js +0 -1
  93. package/dist/src/upload/optimize.d.ts +0 -54
  94. package/dist/src/upload/optimize.js +0 -207
  95. package/dist/src/upload/pipeline.d.ts +0 -55
  96. package/dist/src/upload/pipeline.js +0 -52
  97. package/dist/src/upload/transport.d.ts +0 -42
  98. package/dist/src/upload/transport.js +0 -128
  99. package/dist/src/url_params.d.ts +0 -93
  100. package/dist/src/url_params.js +0 -215
  101. package/dist/src/use_optimistic.d.ts +0 -27
  102. package/dist/src/use_optimistic.js +0 -27
  103. package/dist/src/use_recents.d.ts +0 -19
  104. package/dist/src/use_recents.js +0 -71
  105. package/dist/src/use_url_state.js +0 -73
  106. package/dist/src/viewer.d.ts +0 -26
  107. package/dist/src/viewer.js +0 -47
  108. /package/dist/{src/download.d.ts → download.d.ts} +0 -0
@@ -1,13 +1,8 @@
1
1
  # Navigation & client state
2
2
 
3
3
  How an app's screens and view-state live in the URL, and how small client-side
4
- state persists across sessions. Covers **`AppRouter`** (multi-screen in-app
5
- routing from the `@lotics/app-sdk/router` entry), **`useUrlState`** + the
6
- **`urlParam`** codecs (a typed, declared slice of filters/search/sort/tab kept
7
- in the address bar), and **`useRecents`** (a localStorage-backed recently-used
8
- list). Read this when an app has more than one screen, when a filtered view
9
- must survive refresh or be shareable as a link, or when a picker should
10
- remember what the user chose last.
4
+ state persists across sessions: **`AppRouter`**, **`useUrlState`** + the
5
+ **`urlParam`** codecs, **`useRecents`**, and **`useFolderPick`**.
11
6
 
12
7
  ## The two URL layers
13
8
 
@@ -24,14 +19,8 @@ Neither is server state — `useUrlState` values are *client* state that you fee
24
19
  into a query's *server* params (see [named-query params](./queries.md) and the
25
20
  [data-fetching hooks](./data_fetching.md) they drive).
26
21
 
27
- The embedded-vs-standalone distinction below is the runtime's: embedded means
28
- the app runs in an iframe inside the Lotics host, standalone means it runs on
29
- its own app-host page (see [runtime](./runtime.md)). Both mechanisms
30
- expose the same API in both modes with no per-mode code (the few behavioral
31
- differences — embedded first-paint hydration, cross-screen persistence — are
32
- flagged below); mode is detected automatically (from the `lotics_host` param
33
- the host puts on the iframe src — `isEmbedded()` from the main entry exposes it
34
- if you need it).
22
+ Both mechanisms expose one API embedded and standalone ([runtime](./runtime.md));
23
+ the few differences are flagged below.
35
24
 
36
25
  ## `AppRouter` — in-app routing
37
26
 
@@ -57,12 +46,9 @@ export default function App() {
57
46
  routes, and splats all work. Inside the tree, use react-router normally:
58
47
  `useNavigate`, `useParams`, `useLocation`, `<Link>`, `<Outlet>`.
59
48
 
60
- - **Separate entry, optional peer.** `AppRouter` ships from
61
- `@lotics/app-sdk/router` (signature: `dist/src/router.d.ts`) so apps that
62
- don't route never pull react-router into their bundle. `react-router`
63
- (`^7 || ^8` — the canonical package; the `react-router-dom` shim's tree also
64
- satisfies it) is an **optional peer dependency** — an app that imports the
65
- router entry must install it itself; nothing else in the SDK needs it.
49
+ - **Its own entry.** `AppRouter` ships from `@lotics/app-sdk/router`
50
+ (signature: `dist/router.d.ts`), apart from the hooks; its
51
+ `react-router` peer is `^7 || ^8`.
66
52
  - **An address no route claims says so.** `AppRouter` appends a catch-all at
67
53
  every level of the tree, so such a path renders a not-found screen — a
68
54
  message naming the path and a link to the first route — instead of an empty
@@ -140,7 +126,7 @@ yourself; undeclared keys are already preserved automatically (see below).
140
126
 
141
127
  Save a declared slice of view-state into the address bar so a filtered view
142
128
  survives refresh and is shareable/bookmarkable as a link. Exported from the
143
- main entry (signature: `dist/src/use_url_state.d.ts`):
129
+ main entry (signature: `dist/use_url_state.d.ts`):
144
130
 
145
131
  ```tsx
146
132
  import { urlParam, useUrlState } from "@lotics/app-sdk";
@@ -157,8 +143,6 @@ setFilters({ status: "won" }); // merge into the address bar → ?status=won
157
143
  setFilters({ page: 2 }); // merge; replaces in place — no history entry
158
144
  ```
159
145
 
160
- Semantics — each of these is load-bearing:
161
-
162
146
  - **The URL is the only store.** `filters` is decoded fresh from the current
163
147
  params each render — don't mirror it into `useState`; there is no second
164
148
  copy to drift.
@@ -204,7 +188,7 @@ required — absent (or unparseable) decodes to `fallback`, and a value equal to
204
188
  `fallback` is kept out of the URL. Equality for `withDefault` compares dates by
205
189
  timestamp and arrays element-wise, so `withDefault([])` and
206
190
  `withDefault(new Date(...))` behave correctly. Types are in
207
- `dist/src/url_params.d.ts`.
191
+ `dist/url_params.d.ts`.
208
192
 
209
193
  | Builder | Decoded type | URL form | Decode rules |
210
194
  | --- | --- | --- | --- |
@@ -264,7 +248,7 @@ A small, most-recent-first list persisted across sessions — the "recently
264
248
  used" affordance a search box or picker shows when focused but empty (pair it
265
249
  with a combobox's recent-options slot; see the picker pattern in
266
250
  [data fetching](./data_fetching.md)). Exported from the main entry (signature:
267
- `dist/src/use_recents.d.ts`):
251
+ `dist/use_recents.d.ts`):
268
252
 
269
253
  ```tsx
270
254
  const { recents, remember, forget, clear } = useRecents<Item>("item-picker", {
@@ -300,13 +284,20 @@ default `JSON.stringify`) and `max` (default **5**).
300
284
  live; a tab sees them only when a hook next mounts (or its `key` changes).
301
285
  Concurrent tabs last-write-win.
302
286
 
303
- ## Shipped symbols
287
+ ## `useFolderPick` — the folder a viewer works inside
288
+
289
+ A screen scoped to one row of another table — a project, a branch, a season —
290
+ keeps which one the viewer works inside by its record id, per folder table:
291
+
292
+ ```tsx
293
+ const { picked, pick } = useFolderPick(projectsTableId);
294
+ // picked: undefined while it is read, null where none is picked, else the row's id
295
+ pick("rec_…"); // or pick(null) to leave for the list of folders
296
+ ```
304
297
 
305
- | Symbol | Entry | Signature |
306
- | --- | --- | --- |
307
- | `AppRouter` | `@lotics/app-sdk/router` | `dist/src/router.d.ts` |
308
- | `useUrlState`, `UrlStateShape`, `UrlStateValues` | `@lotics/app-sdk` | `dist/src/use_url_state.d.ts` |
309
- | `urlParam`, `UrlParamCodec`, `OptionalUrlParamCodec`, `UrlParams`, `UrlParamValue` | `@lotics/app-sdk` | `dist/src/url_params.d.ts` |
310
- | `useRecents`, `RecentsApi`, `RecentsOptions` | `@lotics/app-sdk` | `dist/src/use_recents.d.ts` |
311
- | `isEmbedded` | `@lotics/app-sdk` | `dist/src/rpc.d.ts` |
312
- | `openApp` | `@lotics/app-sdk` | `dist/src/open_app.d.ts` |
298
+ - **The host keeps it for the viewer**, so every app of theirs scoped to the
299
+ same table opens in the same folder — each app is served from its own origin,
300
+ and only the host sees them all. Standalone, the app's own origin keeps it.
301
+ - **An id only.** Read the row itself for its name and picture, and drop the
302
+ pick (`pick(null)`) when that read finds no row: a folder deleted, or no
303
+ longer the viewer's to read.