@protobase/ui 0.113.1 → 0.114.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 (192) hide show
  1. package/dist/account/messages.d.ts +2 -2
  2. package/dist/app/app.d.ts +4 -1
  3. package/dist/app/app.js +9 -7
  4. package/dist/app/charts/messages.d.ts +2 -2
  5. package/dist/app/comments/messages.d.ts +2 -2
  6. package/dist/app/confirm-sign-in-messages.d.ts +2 -2
  7. package/dist/app/create/messages.d.ts +2 -2
  8. package/dist/app/delete/messages.d.ts +2 -2
  9. package/dist/app/displays/messages.d.ts +2 -2
  10. package/dist/app/displays/virtual-cards.js +1 -0
  11. package/dist/app/embedded-list/messages.d.ts +2 -2
  12. package/dist/app/export/messages.d.ts +2 -2
  13. package/dist/app/field-messages.d.ts +2 -2
  14. package/dist/app/field-types/workflow/messages.d.ts +2 -2
  15. package/dist/app/field-types/workflow-page/messages.d.ts +2 -2
  16. package/dist/app/field-types/workflow-run/messages.d.ts +2 -2
  17. package/dist/app/first-frame.d.ts +13 -0
  18. package/dist/app/first-frame.js +23 -0
  19. package/dist/app/focus/messages.d.ts +2 -2
  20. package/dist/app/gallery/gallery-layout.d.ts +2 -2
  21. package/dist/app/gallery/messages.d.ts +2 -2
  22. package/dist/app/hand-order/messages.d.ts +2 -2
  23. package/dist/app/import/messages.d.ts +2 -2
  24. package/dist/app/index.html +0 -17
  25. package/dist/app/list-messages.d.ts +2 -2
  26. package/dist/app/main.js +19 -7
  27. package/dist/app/messages.d.ts +2 -2
  28. package/dist/app/pages/messages.d.ts +2 -2
  29. package/dist/app/record-chart/messages.d.ts +2 -2
  30. package/dist/app/record-messages.d.ts +2 -2
  31. package/dist/app/record-mode/shown-layout.d.ts +1 -1
  32. package/dist/app/record-row/messages.d.ts +2 -2
  33. package/dist/app/record-row/record-row.js +1 -0
  34. package/dist/app/refresh-mark.d.ts +2 -1
  35. package/dist/app/refresh-mark.js +3 -1
  36. package/dist/app/reveal-when-loaded.d.ts +8 -2
  37. package/dist/app/reveal-when-loaded.js +12 -5
  38. package/dist/app/runtime/messages.d.ts +2 -2
  39. package/dist/app/saved/messages.d.ts +2 -2
  40. package/dist/app/searches/messages.d.ts +2 -2
  41. package/dist/app/splash-hold.d.ts +0 -1
  42. package/dist/app/splash-hold.js +1 -1
  43. package/dist/app/start-screen.d.ts +0 -9
  44. package/dist/app/start-screen.js +1 -10
  45. package/dist/app/ui-ready.d.ts +11 -0
  46. package/dist/app/ui-ready.js +12 -0
  47. package/dist/app-shell/app-shell.js +3 -1
  48. package/dist/app-shell/close-sidebar.d.ts +10 -0
  49. package/dist/app-shell/close-sidebar.js +17 -0
  50. package/dist/app-shell/drawer.d.ts +7 -1
  51. package/dist/app-shell/drawer.js +26 -7
  52. package/dist/app-shell/index.d.ts +2 -1
  53. package/dist/app-shell/index.js +2 -1
  54. package/dist/app-shell/messages.d.ts +2 -2
  55. package/dist/app-shell/top-bar.js +4 -4
  56. package/dist/assistant-dock/messages.d.ts +2 -2
  57. package/dist/auth/messages.d.ts +2 -2
  58. package/dist/calls/messages.d.ts +2 -2
  59. package/dist/chat/messages.d.ts +2 -2
  60. package/dist/data/query-keys.d.ts +6 -0
  61. package/dist/data/query-keys.js +10 -0
  62. package/dist/data/start-cache/cached-plugins.d.ts +6 -0
  63. package/dist/data/start-cache/cached-plugins.js +10 -0
  64. package/dist/data-grid/data-grid.js +1 -0
  65. package/dist/data-grid/messages.d.ts +2 -2
  66. package/dist/data-grid/row-source.d.ts +5 -0
  67. package/dist/data-grid/use-paged-rows.d.ts +5 -3
  68. package/dist/data-grid/use-paged-rows.js +21 -6
  69. package/dist/filter-panel/messages.d.ts +2 -2
  70. package/dist/index.d.ts +4 -1
  71. package/dist/index.js +4 -1
  72. package/dist/inline-child-table/messages.d.ts +2 -2
  73. package/dist/live/grid-loader.d.ts +1 -0
  74. package/dist/live/grid-loader.js +3 -1
  75. package/dist/live/use-live-rows.js +1 -0
  76. package/dist/mocks/orders.d.ts +1 -1
  77. package/dist/notifications/bell/messages.d.ts +2 -2
  78. package/dist/organizations/members-page.js +13 -7
  79. package/dist/organizations/messages.d.ts +2 -2
  80. package/dist/organizations/use-organizations.d.ts +4 -1
  81. package/dist/organizations/use-organizations.js +25 -19
  82. package/dist/package.js +1 -1
  83. package/dist/plugins/plugin-source.d.ts +24 -4
  84. package/dist/plugins/plugin-source.js +48 -14
  85. package/dist/plugins/use-plugin-loads.d.ts +3 -1
  86. package/dist/plugins/use-plugin-loads.js +24 -7
  87. package/dist/primitives/skeleton.js +1 -0
  88. package/dist/roles/use-active-role.d.ts +4 -1
  89. package/dist/roles/use-active-role.js +18 -13
  90. package/dist/shell/assets/api-provider-BJJrOoO4.js +2 -0
  91. package/dist/shell/assets/app-VoTi41IN.js +16 -0
  92. package/dist/shell/assets/badge-OU9hb6yQ.js +2 -0
  93. package/dist/shell/assets/checkbox-DFfK432Y.js +2 -0
  94. package/dist/shell/assets/createLucideIcon-DGm8SdFI.js +2 -0
  95. package/dist/shell/assets/display-value-CIH2qfgQ.js +2 -0
  96. package/dist/shell/assets/{field-badge-3QmjR1r3.js → field-badge-DX2Mc_fH.js} +2 -2
  97. package/dist/shell/assets/{graph-view-CIk96BRv.js → graph-view-CY9LPr0B.js} +2 -2
  98. package/dist/shell/assets/{html-viewer-ATz2AVBi.js → html-viewer-BPGMH_GA.js} +2 -2
  99. package/dist/shell/assets/{in-place-form-frfvnKaj.js → in-place-form-RWSQGEg4.js} +2 -2
  100. package/dist/shell/assets/index-Bzb-O7ER.js +2 -0
  101. package/dist/shell/assets/index-HnFovy2Q.css +2 -0
  102. package/dist/shell/assets/{intl-cache-bXVNV0Yq.js → intl-cache-D4doUjK1.js} +2 -2
  103. package/dist/shell/assets/{lib-d3-interpolate-Cl0dHO4f.js → lib-d3-interpolate-D3u38iyJ.js} +2 -2
  104. package/dist/shell/assets/{lib-d3-transition-DUHAGQ8z.js → lib-d3-transition-BUpPvFvt.js} +2 -2
  105. package/dist/shell/assets/{lib-d3-zoom-gQh2osrj.js → lib-d3-zoom-BF7SPKNh.js} +2 -2
  106. package/dist/shell/assets/{lib-vis.gl-react-maplibre-CU7gWYjg.js → lib-vis.gl-react-maplibre-C7-0xNFC.js} +2 -2
  107. package/dist/shell/assets/{lib-xyflow-react-DGg_5r7u.js → lib-xyflow-react-CKyW7szC.js} +2 -2
  108. package/dist/shell/assets/maplibre-9ViQO48S.js +2 -0
  109. package/dist/shell/assets/{markdown-content-mNJHzGOa.js → markdown-content-DTB9RQDs.js} +2 -2
  110. package/dist/shell/assets/{record-map-BsXXSshB.js → record-map-CVqCWtfe.js} +2 -2
  111. package/dist/shell/assets/{records-map-D8EBzOu8.js → records-map-ClYSxrVR.js} +2 -2
  112. package/dist/shell/assets/{run-trace-view-Tf6Jwd46.js → run-trace-view-CN16MiXg.js} +2 -2
  113. package/dist/shell/assets/search-picker-BGpvJQRD.js +2 -0
  114. package/dist/shell/assets/shared-protobase-ui-BC8LqGQB.js +2 -0
  115. package/dist/shell/assets/step-catalog-CZY0ZpCC.js +2 -0
  116. package/dist/shell/assets/step-panel-DhD80lsJ.js +2 -0
  117. package/dist/shell/assets/use-app-address-B4Uk3nWy.js +2 -0
  118. package/dist/shell/assets/{use-meta-BqEqOLNe.js → use-meta-D5kYywHm.js} +2 -2
  119. package/dist/shell/assets/{use-sibling-page-Dm7aUfaa.js → use-sibling-page-BJ81HcOP.js} +3 -3
  120. package/dist/shell/assets/value-badge-Dpd8dRqq.js +2 -0
  121. package/dist/shell/assets/{vendor-WWp_xlp2.js → vendor-3etemhgS.js} +4 -4
  122. package/dist/shell/assets/{workflow-canvas-B8ciy9xI.js → workflow-canvas-C1nGpi5w.js} +2 -2
  123. package/dist/shell/assets/{workflow-graph-editor-QT-3e-M9.js → workflow-graph-editor-DAJa4lq6.js} +2 -2
  124. package/dist/shell/assets/workflow-workbench-HramVZEJ.js +4 -0
  125. package/dist/shell/assets/{workflows-Bku4o2su.js → workflows-DlvOln9v.js} +2 -2
  126. package/dist/shell/assets/{workflows-start-kl7rSSay.js → workflows-start-QUKfwFqf.js} +2 -2
  127. package/dist/shell/index.html +16 -19
  128. package/dist/shell/protobase.shell.json +2 -2
  129. package/dist/shell/protobase.sw.js +2 -2
  130. package/dist/shell-source-maps/assets/api-provider-BJJrOoO4.js.map +1 -0
  131. package/dist/shell-source-maps/assets/app-VoTi41IN.js.map +1 -0
  132. package/dist/shell-source-maps/assets/{badge-ChHXC28D.js.map → badge-OU9hb6yQ.js.map} +1 -1
  133. package/dist/shell-source-maps/assets/{checkbox-COOOlJPG.js.map → checkbox-DFfK432Y.js.map} +1 -1
  134. package/dist/shell-source-maps/assets/createLucideIcon-DGm8SdFI.js.map +1 -0
  135. package/dist/shell-source-maps/assets/display-value-CIH2qfgQ.js.map +1 -0
  136. package/dist/shell-source-maps/assets/{field-badge-3QmjR1r3.js.map → field-badge-DX2Mc_fH.js.map} +1 -1
  137. package/dist/shell-source-maps/assets/{graph-view-CIk96BRv.js.map → graph-view-CY9LPr0B.js.map} +1 -1
  138. package/dist/shell-source-maps/assets/{html-viewer-ATz2AVBi.js.map → html-viewer-BPGMH_GA.js.map} +1 -1
  139. package/dist/shell-source-maps/assets/{in-place-form-frfvnKaj.js.map → in-place-form-RWSQGEg4.js.map} +1 -1
  140. package/dist/shell-source-maps/assets/index-Bzb-O7ER.js.map +1 -0
  141. package/dist/shell-source-maps/assets/{intl-cache-bXVNV0Yq.js.map → intl-cache-D4doUjK1.js.map} +1 -1
  142. package/dist/shell-source-maps/assets/{lib-d3-interpolate-Cl0dHO4f.js.map → lib-d3-interpolate-D3u38iyJ.js.map} +1 -1
  143. package/dist/shell-source-maps/assets/{lib-d3-transition-DUHAGQ8z.js.map → lib-d3-transition-BUpPvFvt.js.map} +1 -1
  144. package/dist/shell-source-maps/assets/{lib-d3-zoom-gQh2osrj.js.map → lib-d3-zoom-BF7SPKNh.js.map} +1 -1
  145. package/dist/shell-source-maps/assets/{lib-vis.gl-react-maplibre-CU7gWYjg.js.map → lib-vis.gl-react-maplibre-C7-0xNFC.js.map} +1 -1
  146. package/dist/shell-source-maps/assets/{lib-xyflow-react-DGg_5r7u.js.map → lib-xyflow-react-CKyW7szC.js.map} +1 -1
  147. package/dist/shell-source-maps/assets/{maplibre-BufRSV4y.js.map → maplibre-9ViQO48S.js.map} +1 -1
  148. package/dist/shell-source-maps/assets/{markdown-content-mNJHzGOa.js.map → markdown-content-DTB9RQDs.js.map} +1 -1
  149. package/dist/shell-source-maps/assets/{record-map-BsXXSshB.js.map → record-map-CVqCWtfe.js.map} +1 -1
  150. package/dist/shell-source-maps/assets/{records-map-D8EBzOu8.js.map → records-map-ClYSxrVR.js.map} +1 -1
  151. package/dist/shell-source-maps/assets/{run-trace-view-Tf6Jwd46.js.map → run-trace-view-CN16MiXg.js.map} +1 -1
  152. package/dist/shell-source-maps/assets/{search-picker-BHmYOFF8.js.map → search-picker-BGpvJQRD.js.map} +1 -1
  153. package/dist/shell-source-maps/assets/shared-protobase-ui-BC8LqGQB.js.map +1 -0
  154. package/dist/shell-source-maps/assets/{step-catalog-DZNovnPL.js.map → step-catalog-CZY0ZpCC.js.map} +1 -1
  155. package/dist/shell-source-maps/assets/{step-panel-3aRZ2Dlj.js.map → step-panel-DhD80lsJ.js.map} +1 -1
  156. package/dist/shell-source-maps/assets/{use-app-address-B6k3dkV0.js.map → use-app-address-B4Uk3nWy.js.map} +1 -1
  157. package/dist/shell-source-maps/assets/{use-meta-BqEqOLNe.js.map → use-meta-D5kYywHm.js.map} +1 -1
  158. package/dist/shell-source-maps/assets/{use-sibling-page-Dm7aUfaa.js.map → use-sibling-page-BJ81HcOP.js.map} +1 -1
  159. package/dist/shell-source-maps/assets/{value-badge-BKLV4otJ.js.map → value-badge-Dpd8dRqq.js.map} +1 -1
  160. package/dist/shell-source-maps/assets/{vendor-WWp_xlp2.js.map → vendor-3etemhgS.js.map} +1 -1
  161. package/dist/shell-source-maps/assets/{workflow-canvas-B8ciy9xI.js.map → workflow-canvas-C1nGpi5w.js.map} +1 -1
  162. package/dist/shell-source-maps/assets/{workflow-graph-editor-QT-3e-M9.js.map → workflow-graph-editor-DAJa4lq6.js.map} +1 -1
  163. package/dist/shell-source-maps/assets/{workflow-workbench-C5eHhxQh.js.map → workflow-workbench-HramVZEJ.js.map} +1 -1
  164. package/dist/shell-source-maps/assets/{workflows-Bku4o2su.js.map → workflows-DlvOln9v.js.map} +1 -1
  165. package/dist/shell-source-maps/assets/{workflows-start-kl7rSSay.js.map → workflows-start-QUKfwFqf.js.map} +1 -1
  166. package/dist/status/messages.d.ts +2 -2
  167. package/dist/styles.css +14 -0
  168. package/package.json +5 -5
  169. package/dist/app/hold-start-for-first-loads.d.ts +0 -12
  170. package/dist/app/hold-start-for-first-loads.js +0 -43
  171. package/dist/shell/assets/api-provider-CcDtTh0D.js +0 -2
  172. package/dist/shell/assets/app-C1xWr51x.js +0 -16
  173. package/dist/shell/assets/badge-ChHXC28D.js +0 -2
  174. package/dist/shell/assets/checkbox-COOOlJPG.js +0 -2
  175. package/dist/shell/assets/display-value-fDiKbfJO.js +0 -2
  176. package/dist/shell/assets/index-BkCaPeOq.css +0 -2
  177. package/dist/shell/assets/index-C4cMQVG2.js +0 -2
  178. package/dist/shell/assets/maplibre-BufRSV4y.js +0 -2
  179. package/dist/shell/assets/messages-ClKBpZlk.js +0 -2
  180. package/dist/shell/assets/search-picker-BHmYOFF8.js +0 -2
  181. package/dist/shell/assets/shared-protobase-ui-C1jBhoci.js +0 -2
  182. package/dist/shell/assets/step-catalog-DZNovnPL.js +0 -2
  183. package/dist/shell/assets/step-panel-3aRZ2Dlj.js +0 -2
  184. package/dist/shell/assets/use-app-address-B6k3dkV0.js +0 -2
  185. package/dist/shell/assets/value-badge-BKLV4otJ.js +0 -2
  186. package/dist/shell/assets/workflow-workbench-C5eHhxQh.js +0 -4
  187. package/dist/shell-source-maps/assets/api-provider-CcDtTh0D.js.map +0 -1
  188. package/dist/shell-source-maps/assets/app-C1xWr51x.js.map +0 -1
  189. package/dist/shell-source-maps/assets/display-value-fDiKbfJO.js.map +0 -1
  190. package/dist/shell-source-maps/assets/index-C4cMQVG2.js.map +0 -1
  191. package/dist/shell-source-maps/assets/messages-ClKBpZlk.js.map +0 -1
  192. package/dist/shell-source-maps/assets/shared-protobase-ui-C1jBhoci.js.map +0 -1
@@ -42,7 +42,7 @@ const TopBar = ({ breadcrumb, titleStatus, onNavigate, onBack, actions, onMenu,
42
42
  }, [search]);
43
43
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("header", {
44
44
  ref,
45
- className: cn(sticky ? "sticky top-0 z-30 max-md:fixed max-md:left-[var(--pb-safe-left)] max-md:right-[var(--pb-safe-right)]" : "relative", "flex shrink-0 items-center gap-[4px] border-b bg-background pt-[calc(var(--pb-safe-top)+1.5px)] pr-[8px] pb-[1.5px] pl-[16px] md:h-[calc(3rem+var(--pb-safe-top))] md:gap-4 md:px-5 md:pt-[var(--pb-safe-top)] md:pb-0"),
45
+ className: cn(sticky ? "sticky top-0 z-30 max-md:fixed max-md:left-[var(--pb-safe-left)] max-md:right-[var(--pb-safe-right)]" : "relative", "flex shrink-0 items-center gap-[4px] border-b bg-background pt-[calc(var(--pb-safe-top)+1.5px)] pr-[8px] pb-[1.5px] pl-[16px] h-[calc(3rem+var(--pb-safe-top))] md:gap-4 md:px-5 md:pt-[var(--pb-safe-top)] md:pb-0"),
46
46
  children: [
47
47
  onMenu && /* @__PURE__ */ jsx("button", {
48
48
  type: "button",
@@ -75,8 +75,8 @@ const TopBar = ({ breadcrumb, titleStatus, onNavigate, onBack, actions, onMenu,
75
75
  parts: breadcrumb,
76
76
  onNavigate
77
77
  }),
78
- titleStatus && /* @__PURE__ */ jsx("span", {
79
- className: "flex shrink-0 items-center",
78
+ /* @__PURE__ */ jsx("span", {
79
+ className: "flex shrink-0 items-center empty:hidden",
80
80
  children: titleStatus
81
81
  }),
82
82
  /* @__PURE__ */ jsxs("div", {
@@ -128,7 +128,7 @@ const TopBar = ({ breadcrumb, titleStatus, onNavigate, onBack, actions, onMenu,
128
128
  ]
129
129
  }), sticky && /* @__PURE__ */ jsx("div", {
130
130
  "aria-hidden": true,
131
- className: "h-[var(--pb-sticky-top)] shrink-0 md:hidden"
131
+ className: "h-[var(--pb-sticky-top,calc(3rem+var(--pb-safe-top)))] shrink-0 md:hidden"
132
132
  })] });
133
133
  };
134
134
  //#endregion
@@ -1,7 +1,7 @@
1
1
  import { MessageValue } from "../locale/messages.js";
2
2
  //#region src/assistant-dock/messages.d.ts
3
3
  export declare const text: {
4
- (id: "reconnecting" | "askQuestion" | "assistant" | "empty" | "noAnswer" | "backendNoAnswer" | "couldNotDraw" | "cannotShowLive", values?: Record<string, MessageValue>): string;
5
- rich(id: "reconnecting" | "askQuestion" | "assistant" | "empty" | "noAnswer" | "backendNoAnswer" | "couldNotDraw" | "cannotShowLive", values: Record<string, MessageValue | import("react").ReactNode>): import("react").ReactNode;
4
+ (id: "reconnecting" | "empty" | "askQuestion" | "assistant" | "noAnswer" | "backendNoAnswer" | "couldNotDraw" | "cannotShowLive", values?: Record<string, MessageValue>): string;
5
+ rich(id: "reconnecting" | "empty" | "askQuestion" | "assistant" | "noAnswer" | "backendNoAnswer" | "couldNotDraw" | "cannotShowLive", values: Record<string, MessageValue | import("react").ReactNode>): import("react").ReactNode;
6
6
  };
7
7
  //#endregion
@@ -1,7 +1,7 @@
1
1
  import { MessageValue } from "../locale/messages.js";
2
2
  //#region src/auth/messages.d.ts
3
3
  export declare const text: {
4
- (id: "signIn" | "or" | "reload" | "yourName" | "continue" | "signOut" | "loading" | "noAnswer" | "tooManyRequests" | "email" | "code" | "setPassword" | "password" | "newPassword" | "verify" | "admin" | "cannotReach" | "tryAgain" | "passwordChanged" | "backupCode" | "passwordOptional" | "backToSignIn" | "useAnotherAddress" | "checkEmail" | "newCodeSent" | "sendNewCode" | "sendNewCodeIn" | "signInCodeDescription" | "signInCodeSent" | "signUpCodeDescription" | "signUpCodeSent" | "noAdminTitle" | "noAdminDescription" | "noAdminExplanation" | "copyCommand" | "firstAdminExplanation" | "firstAdminLink" | "tooManyAttempts" | "resetTitle" | "resetDescription" | "sendResetLink" | "resetSent" | "linkExpiredTitle" | "linkExpiredExplanation" | "sendNewLink" | "passwordsDiffer" | "choosePassword" | "atLeast" | "useAtLeast" | "passwordTooLong" | "repeatPassword" | "signingInWith" | "takingYouTo" | "providerNotOffered" | "turnOnTwoFactor" | "addPasskey" | "requiredForEveryAccount" | "passkeyExplanation" | "couldNotReadAccount" | "signInTitle" | "runsOnProtobase" | "continueWith" | "signInWithPasskey" | "passkeyFor" | "emailSignInCode" | "usePassword" | "forgotPassword" | "newHere" | "haveAccount" | "createAnAccount" | "browse" | "notNow" | "detailsTitle" | "detailsDescription" | "codeWasRight" | "withoutPassword" | "createAccount" | "codeToConfirm" | "emailCode" | "browseWithoutAccount" | "staffTitle" | "staffUnavailable" | "signInAsPerson" | "forStaffOf" | "theirEmail" | "reason" | "reasonExample" | "staffExplanation" | "totpInstruction" | "otpInstruction" | "backupInstruction" | "twoFactorTitle" | "twoFactorDescription" | "codeToFinish" | "trustBrowser" | "trustBrowserFor" | "useAuthenticator" | "emailCodeInstead" | "useBackupCode", values?: Record<string, MessageValue>): string;
5
- rich(id: "signIn" | "or" | "reload" | "yourName" | "continue" | "signOut" | "loading" | "noAnswer" | "tooManyRequests" | "email" | "code" | "setPassword" | "password" | "newPassword" | "verify" | "admin" | "cannotReach" | "tryAgain" | "passwordChanged" | "backupCode" | "passwordOptional" | "backToSignIn" | "useAnotherAddress" | "checkEmail" | "newCodeSent" | "sendNewCode" | "sendNewCodeIn" | "signInCodeDescription" | "signInCodeSent" | "signUpCodeDescription" | "signUpCodeSent" | "noAdminTitle" | "noAdminDescription" | "noAdminExplanation" | "copyCommand" | "firstAdminExplanation" | "firstAdminLink" | "tooManyAttempts" | "resetTitle" | "resetDescription" | "sendResetLink" | "resetSent" | "linkExpiredTitle" | "linkExpiredExplanation" | "sendNewLink" | "passwordsDiffer" | "choosePassword" | "atLeast" | "useAtLeast" | "passwordTooLong" | "repeatPassword" | "signingInWith" | "takingYouTo" | "providerNotOffered" | "turnOnTwoFactor" | "addPasskey" | "requiredForEveryAccount" | "passkeyExplanation" | "couldNotReadAccount" | "signInTitle" | "runsOnProtobase" | "continueWith" | "signInWithPasskey" | "passkeyFor" | "emailSignInCode" | "usePassword" | "forgotPassword" | "newHere" | "haveAccount" | "createAnAccount" | "browse" | "notNow" | "detailsTitle" | "detailsDescription" | "codeWasRight" | "withoutPassword" | "createAccount" | "codeToConfirm" | "emailCode" | "browseWithoutAccount" | "staffTitle" | "staffUnavailable" | "signInAsPerson" | "forStaffOf" | "theirEmail" | "reason" | "reasonExample" | "staffExplanation" | "totpInstruction" | "otpInstruction" | "backupInstruction" | "twoFactorTitle" | "twoFactorDescription" | "codeToFinish" | "trustBrowser" | "trustBrowserFor" | "useAuthenticator" | "emailCodeInstead" | "useBackupCode", values: Record<string, MessageValue | import("react").ReactNode>): import("react").ReactNode;
4
+ (id: "signIn" | "or" | "reload" | "yourName" | "continue" | "signOut" | "loading" | "noAnswer" | "tooManyRequests" | "code" | "setPassword" | "email" | "password" | "newPassword" | "verify" | "admin" | "cannotReach" | "tryAgain" | "passwordChanged" | "backupCode" | "passwordOptional" | "backToSignIn" | "useAnotherAddress" | "checkEmail" | "newCodeSent" | "sendNewCode" | "sendNewCodeIn" | "signInCodeDescription" | "signInCodeSent" | "signUpCodeDescription" | "signUpCodeSent" | "noAdminTitle" | "noAdminDescription" | "noAdminExplanation" | "copyCommand" | "firstAdminExplanation" | "firstAdminLink" | "tooManyAttempts" | "resetTitle" | "resetDescription" | "sendResetLink" | "resetSent" | "linkExpiredTitle" | "linkExpiredExplanation" | "sendNewLink" | "passwordsDiffer" | "choosePassword" | "atLeast" | "useAtLeast" | "passwordTooLong" | "repeatPassword" | "signingInWith" | "takingYouTo" | "providerNotOffered" | "turnOnTwoFactor" | "addPasskey" | "requiredForEveryAccount" | "passkeyExplanation" | "couldNotReadAccount" | "signInTitle" | "runsOnProtobase" | "continueWith" | "signInWithPasskey" | "passkeyFor" | "emailSignInCode" | "usePassword" | "forgotPassword" | "newHere" | "haveAccount" | "createAnAccount" | "browse" | "notNow" | "detailsTitle" | "detailsDescription" | "codeWasRight" | "withoutPassword" | "createAccount" | "codeToConfirm" | "emailCode" | "browseWithoutAccount" | "staffTitle" | "staffUnavailable" | "signInAsPerson" | "forStaffOf" | "theirEmail" | "reason" | "reasonExample" | "staffExplanation" | "totpInstruction" | "otpInstruction" | "backupInstruction" | "twoFactorTitle" | "twoFactorDescription" | "codeToFinish" | "trustBrowser" | "trustBrowserFor" | "useAuthenticator" | "emailCodeInstead" | "useBackupCode", values?: Record<string, MessageValue>): string;
5
+ rich(id: "signIn" | "or" | "reload" | "yourName" | "continue" | "signOut" | "loading" | "noAnswer" | "tooManyRequests" | "code" | "setPassword" | "email" | "password" | "newPassword" | "verify" | "admin" | "cannotReach" | "tryAgain" | "passwordChanged" | "backupCode" | "passwordOptional" | "backToSignIn" | "useAnotherAddress" | "checkEmail" | "newCodeSent" | "sendNewCode" | "sendNewCodeIn" | "signInCodeDescription" | "signInCodeSent" | "signUpCodeDescription" | "signUpCodeSent" | "noAdminTitle" | "noAdminDescription" | "noAdminExplanation" | "copyCommand" | "firstAdminExplanation" | "firstAdminLink" | "tooManyAttempts" | "resetTitle" | "resetDescription" | "sendResetLink" | "resetSent" | "linkExpiredTitle" | "linkExpiredExplanation" | "sendNewLink" | "passwordsDiffer" | "choosePassword" | "atLeast" | "useAtLeast" | "passwordTooLong" | "repeatPassword" | "signingInWith" | "takingYouTo" | "providerNotOffered" | "turnOnTwoFactor" | "addPasskey" | "requiredForEveryAccount" | "passkeyExplanation" | "couldNotReadAccount" | "signInTitle" | "runsOnProtobase" | "continueWith" | "signInWithPasskey" | "passkeyFor" | "emailSignInCode" | "usePassword" | "forgotPassword" | "newHere" | "haveAccount" | "createAnAccount" | "browse" | "notNow" | "detailsTitle" | "detailsDescription" | "codeWasRight" | "withoutPassword" | "createAccount" | "codeToConfirm" | "emailCode" | "browseWithoutAccount" | "staffTitle" | "staffUnavailable" | "signInAsPerson" | "forStaffOf" | "theirEmail" | "reason" | "reasonExample" | "staffExplanation" | "totpInstruction" | "otpInstruction" | "backupInstruction" | "twoFactorTitle" | "twoFactorDescription" | "codeToFinish" | "trustBrowser" | "trustBrowserFor" | "useAuthenticator" | "emailCodeInstead" | "useBackupCode", values: Record<string, MessageValue | import("react").ReactNode>): import("react").ReactNode;
6
6
  };
7
7
  //#endregion
@@ -1,7 +1,7 @@
1
1
  import { MessageValue } from "../locale/messages.js";
2
2
  //#region src/calls/messages.d.ts
3
3
  export declare const text: {
4
- (id: "muted" | "accept" | "join" | "people" | "waiting" | "joinCall" | "leave" | "denied" | "ended" | "refused" | "unavailable" | "you" | "decline" | "startCall" | "inProgress" | "microphone" | "camera" | "shareScreen" | "stopSharing" | "alone" | "connecting" | "reconnecting" | "full" | "removed" | "callAgain" | "noMicrophone" | "noCamera" | "noDevices" | "cannotConnect" | "poorConnection" | "goodConnection" | "sharing" | "youAreSharing" | "speaking" | "preview" | "guestName" | "askToJoin" | "someone" | "guests" | "waitingGuest" | "admit" | "deny" | "remove" | "revoke" | "newLink" | "copyLink" | "copied" | "guestLinks" | "noLinks" | "inLobby" | "guestsInCall" | "guestsMaySend" | "sendAll" | "sendCamera" | "sendMicrophone" | "linkUntil" | "linkUntilEnd" | "linkLasts" | "forAnHour" | "addressesVisible" | "guestRefused" | "close" | "yourName" | "guestIntro" | "continue" | "youLeft", values?: Record<string, MessageValue>): string;
5
- rich(id: "muted" | "accept" | "join" | "people" | "waiting" | "joinCall" | "leave" | "denied" | "ended" | "refused" | "unavailable" | "you" | "decline" | "startCall" | "inProgress" | "microphone" | "camera" | "shareScreen" | "stopSharing" | "alone" | "connecting" | "reconnecting" | "full" | "removed" | "callAgain" | "noMicrophone" | "noCamera" | "noDevices" | "cannotConnect" | "poorConnection" | "goodConnection" | "sharing" | "youAreSharing" | "speaking" | "preview" | "guestName" | "askToJoin" | "someone" | "guests" | "waitingGuest" | "admit" | "deny" | "remove" | "revoke" | "newLink" | "copyLink" | "copied" | "guestLinks" | "noLinks" | "inLobby" | "guestsInCall" | "guestsMaySend" | "sendAll" | "sendCamera" | "sendMicrophone" | "linkUntil" | "linkUntilEnd" | "linkLasts" | "forAnHour" | "addressesVisible" | "guestRefused" | "close" | "yourName" | "guestIntro" | "continue" | "youLeft", values: Record<string, MessageValue | import("react").ReactNode>): import("react").ReactNode;
4
+ (id: "accept" | "join" | "people" | "leave" | "denied" | "ended" | "refused" | "unavailable" | "muted" | "you" | "decline" | "startCall" | "inProgress" | "joinCall" | "microphone" | "camera" | "shareScreen" | "stopSharing" | "alone" | "connecting" | "reconnecting" | "full" | "removed" | "callAgain" | "noMicrophone" | "noCamera" | "noDevices" | "cannotConnect" | "poorConnection" | "goodConnection" | "sharing" | "youAreSharing" | "speaking" | "preview" | "guestName" | "waiting" | "askToJoin" | "someone" | "guests" | "waitingGuest" | "admit" | "deny" | "remove" | "revoke" | "newLink" | "copyLink" | "copied" | "guestLinks" | "noLinks" | "inLobby" | "guestsInCall" | "guestsMaySend" | "sendAll" | "sendCamera" | "sendMicrophone" | "linkUntil" | "linkUntilEnd" | "linkLasts" | "forAnHour" | "addressesVisible" | "guestRefused" | "close" | "yourName" | "guestIntro" | "continue" | "youLeft", values?: Record<string, MessageValue>): string;
5
+ rich(id: "accept" | "join" | "people" | "leave" | "denied" | "ended" | "refused" | "unavailable" | "muted" | "you" | "decline" | "startCall" | "inProgress" | "joinCall" | "microphone" | "camera" | "shareScreen" | "stopSharing" | "alone" | "connecting" | "reconnecting" | "full" | "removed" | "callAgain" | "noMicrophone" | "noCamera" | "noDevices" | "cannotConnect" | "poorConnection" | "goodConnection" | "sharing" | "youAreSharing" | "speaking" | "preview" | "guestName" | "waiting" | "askToJoin" | "someone" | "guests" | "waitingGuest" | "admit" | "deny" | "remove" | "revoke" | "newLink" | "copyLink" | "copied" | "guestLinks" | "noLinks" | "inLobby" | "guestsInCall" | "guestsMaySend" | "sendAll" | "sendCamera" | "sendMicrophone" | "linkUntil" | "linkUntilEnd" | "linkLasts" | "forAnHour" | "addressesVisible" | "guestRefused" | "close" | "yourName" | "guestIntro" | "continue" | "youLeft", values: Record<string, MessageValue | import("react").ReactNode>): import("react").ReactNode;
6
6
  };
7
7
  //#endregion
@@ -1,7 +1,7 @@
1
1
  import { MessageValue } from "../locale/messages.js";
2
2
  //#region src/chat/messages.d.ts
3
3
  export declare const text: {
4
- (id: "send" | "message" | "today" | "working" | "yesterday" | "newMessages" | "loadEarlier", values?: Record<string, MessageValue>): string;
5
- rich(id: "send" | "message" | "today" | "working" | "yesterday" | "newMessages" | "loadEarlier", values: Record<string, MessageValue | import("react").ReactNode>): import("react").ReactNode;
4
+ (id: "send" | "message" | "today" | "yesterday" | "newMessages" | "loadEarlier" | "working", values?: Record<string, MessageValue>): string;
5
+ rich(id: "send" | "message" | "today" | "yesterday" | "newMessages" | "loadEarlier" | "working", values: Record<string, MessageValue | import("react").ReactNode>): import("react").ReactNode;
6
6
  };
7
7
  //#endregion
@@ -2,6 +2,12 @@ import { PlanRead } from "@protobase/layout";
2
2
  //#region src/data/query-keys.d.ts
3
3
  export declare const keys: {
4
4
  meta: readonly ["meta"];
5
+ /** The role the session acts with and the roles it may switch to. */
6
+ activeRole: readonly ["session", "active-role"];
7
+ /** The organization the session works in and the person's organizations. */
8
+ organizations: readonly ["session", "organizations"];
9
+ /** The members of the organization `id`, with their roles, for its members page. */
10
+ organizationMembers: (id: string) => readonly ["session", "members", string];
5
11
  /** A source's `/meta`, as far as the app draws it: its URL, and the resources the app lists for it. */
6
12
  sourceMeta: (url: string, resources: readonly string[]) => readonly ["source-meta", string, string];
7
13
  /** Every `/meta` query of the source at `url`. */
@@ -1,6 +1,16 @@
1
1
  //#region src/data/query-keys.ts
2
2
  const keys = {
3
3
  meta: ["meta"],
4
+ /** The role the session acts with and the roles it may switch to. */
5
+ activeRole: ["session", "active-role"],
6
+ /** The organization the session works in and the person's organizations. */
7
+ organizations: ["session", "organizations"],
8
+ /** The members of the organization `id`, with their roles, for its members page. */
9
+ organizationMembers: (id) => [
10
+ "session",
11
+ "members",
12
+ id
13
+ ],
4
14
  /** A source's `/meta`, as far as the app draws it: its URL, and the resources the app lists for it. */
5
15
  sourceMeta: (url, resources) => [
6
16
  "source-meta",
@@ -0,0 +1,6 @@
1
+ import { StartCache } from "./start-cache.js";
2
+ import { PluginRef } from "@protobase/client";
3
+ //#region src/data/start-cache/cached-plugins.d.ts
4
+ /** The plugins the start cache's `/meta` names, for the signed-in person it was kept for: the app loads them before it draws. */
5
+ export declare const cachedPlugins: (cache: StartCache | undefined) => PluginRef[];
6
+ //#endregion
@@ -0,0 +1,10 @@
1
+ import { keys } from "../query-keys.js";
2
+ //#region src/data/start-cache/cached-plugins.ts
3
+ /** The plugins the start cache's `/meta` names, for the signed-in person it was kept for: the app loads them before it draws. */
4
+ const cachedPlugins = (cache) => {
5
+ const session = cache?.session();
6
+ if (!session) return [];
7
+ return ((cache?.queries(`user:${session.user.id}`)?.state.queries.find((query) => JSON.stringify(query.queryKey) === JSON.stringify(keys.meta)))?.state.data)?.plugins ?? [];
8
+ };
9
+ //#endregion
10
+ export { cachedPlugins };
@@ -79,6 +79,7 @@ const DataGrid = ({ columns: given, source, naturalSort, initialScrollIndex = 0,
79
79
  total,
80
80
  rowAt: sourceRowAt ? rowAt : void 0,
81
81
  loadRows: source.loadRows,
82
+ cachedRows: source.cachedRows,
82
83
  revision: source.revision,
83
84
  latencyMs
84
85
  }, firstIndex, lastIndex);
@@ -1,7 +1,7 @@
1
1
  import { MessageValue } from "../locale/messages.js";
2
2
  //#region src/data-grid/messages.d.ts
3
3
  export declare const text: {
4
- (id: "row" | "no" | "shownIn" | "new" | "unsortable" | "columnMenu" | "unpin" | "pinToLeft" | "resizeColumn" | "selected" | "clearSelection" | "noRowsSelected" | "selectRow" | "rowActions" | "move" | "reorderInstructions" | "pickedUp" | "isOver" | "droppedAt" | "putBack" | "cancelled", values?: Record<string, MessageValue>): string;
5
- rich(id: "row" | "no" | "shownIn" | "new" | "unsortable" | "columnMenu" | "unpin" | "pinToLeft" | "resizeColumn" | "selected" | "clearSelection" | "noRowsSelected" | "selectRow" | "rowActions" | "move" | "reorderInstructions" | "pickedUp" | "isOver" | "droppedAt" | "putBack" | "cancelled", values: Record<string, MessageValue | import("react").ReactNode>): import("react").ReactNode;
4
+ (id: "row" | "new" | "no" | "shownIn" | "pickedUp" | "cancelled" | "unsortable" | "columnMenu" | "unpin" | "pinToLeft" | "resizeColumn" | "selected" | "clearSelection" | "noRowsSelected" | "selectRow" | "rowActions" | "move" | "reorderInstructions" | "isOver" | "droppedAt" | "putBack", values?: Record<string, MessageValue>): string;
5
+ rich(id: "row" | "new" | "no" | "shownIn" | "pickedUp" | "cancelled" | "unsortable" | "columnMenu" | "unpin" | "pinToLeft" | "resizeColumn" | "selected" | "clearSelection" | "noRowsSelected" | "selectRow" | "rowActions" | "move" | "reorderInstructions" | "isOver" | "droppedAt" | "putBack", values: Record<string, MessageValue | import("react").ReactNode>): import("react").ReactNode;
6
6
  };
7
7
  //#endregion
@@ -8,6 +8,11 @@ export type RowSource = {
8
8
  loadRows?: (start: number, count: number) => Promise<GridRow[]>;
9
9
  /** Changes when the rows were refetched: the pages on screen are loaded again in place, the others when next shown. */
10
10
  revision?: number;
11
+ /**
12
+ * The rows from `start` (a multiple of the page size) a live server's source already holds, such as from the start
13
+ * cache, read at once: the first draw shows them, and `loadRows` refreshes them in place.
14
+ */
15
+ cachedRows?: (start: number) => GridRow[] | undefined;
11
16
  };
12
17
  export declare const createRowSource: (total: number, rowAt: (index: number) => GridRow) => RowSource;
13
18
  /** Mocks a filtered view: `total` rows sampled evenly from `base`, each forced to satisfy the filter. */
@@ -6,13 +6,15 @@ type Loading = {
6
6
  total: number;
7
7
  rowAt?: (index: number) => GridRow;
8
8
  loadRows?: RowSource['loadRows'];
9
+ cachedRows?: RowSource['cachedRows'];
9
10
  revision?: number;
10
11
  latencyMs: number;
11
12
  };
12
13
  /**
13
14
  * Serves rows by absolute index. Mock sources compute rows (after `latencyMs`, or at once when 0);
14
- * live sources load pages through `loadRows`. Unloaded rows read as undefined, so fast scrolling shows skeletons. A new
15
- * `revision` loads the pages on screen again, showing the rows they held until the new ones arrive.
15
+ * live sources load pages through `loadRows`, starting from the pages `cachedRows` already holds, which show at once and
16
+ * are loaded again in place. Unloaded rows read as undefined, so fast scrolling shows skeletons. A new `revision` loads
17
+ * the pages on screen again, showing the rows they held until the new ones arrive.
16
18
  */
17
- export declare const usePagedRows: ({ total, rowAt, loadRows, revision, latencyMs }: Loading, start: number, end: number) => (index: number) => GridRow | undefined;
19
+ export declare const usePagedRows: ({ total, rowAt, loadRows, cachedRows, revision, latencyMs }: Loading, start: number, end: number) => (index: number) => GridRow | undefined;
18
20
  //#endregion
@@ -6,18 +6,28 @@ const gridPageSize = 40;
6
6
  const pageLength = (total, page) => Math.max(0, Math.min(40, total - page * 40));
7
7
  /**
8
8
  * Serves rows by absolute index. Mock sources compute rows (after `latencyMs`, or at once when 0);
9
- * live sources load pages through `loadRows`. Unloaded rows read as undefined, so fast scrolling shows skeletons. A new
10
- * `revision` loads the pages on screen again, showing the rows they held until the new ones arrive.
9
+ * live sources load pages through `loadRows`, starting from the pages `cachedRows` already holds, which show at once and
10
+ * are loaded again in place. Unloaded rows read as undefined, so fast scrolling shows skeletons. A new `revision` loads
11
+ * the pages on screen again, showing the rows they held until the new ones arrive.
11
12
  */
12
- const usePagedRows = ({ total, rowAt, loadRows, revision, latencyMs }, start, end) => {
13
+ const usePagedRows = ({ total, rowAt, loadRows, cachedRows, revision, latencyMs }, start, end) => {
13
14
  const cache = useMemo(() => createPageCache(40, 60), [rowAt, loadRows]);
15
+ const seeded = useRef(/* @__PURE__ */ new Set());
16
+ const seed = (index) => {
17
+ const page = Math.floor(index / 40);
18
+ if (!cachedRows || cache.hasPage(page)) return;
19
+ const rows = cachedRows(page * 40);
20
+ if (!rows) return;
21
+ cache.setPage(page, rows);
22
+ seeded.current.add(page);
23
+ };
14
24
  const [version, setVersion] = useState(0);
15
25
  const firstPage = Math.floor(start / 40);
16
26
  const lastPage = Math.floor(end / 40);
17
27
  const synchronous = !loadRows && latencyMs === 0;
18
28
  useEffect(() => {
19
29
  if (synchronous) return;
20
- const pages = pagesForRange(firstPage * 40, lastPage * 40, 40).filter((page) => !cache.hasPage(page));
30
+ const pages = pagesForRange(firstPage * 40, lastPage * 40, 40).filter((page) => !cache.hasPage(page) || seeded.current.delete(page));
21
31
  const length = (page) => pageLength(total, page);
22
32
  const store = (page, rows) => {
23
33
  cache.setPage(page, rows);
@@ -62,11 +72,16 @@ const usePagedRows = ({ total, rowAt, loadRows, revision, latencyMs }, start, en
62
72
  lastPage,
63
73
  total
64
74
  ]);
65
- return useCallback((index) => synchronous ? rowAt(index) : cache.get(index), [
75
+ return useCallback((index) => {
76
+ if (synchronous) return rowAt(index);
77
+ seed(index);
78
+ return cache.get(index);
79
+ }, [
66
80
  cache,
67
81
  synchronous,
68
82
  rowAt,
69
- version
83
+ version,
84
+ cachedRows
70
85
  ]);
71
86
  };
72
87
  //#endregion
@@ -1,7 +1,7 @@
1
1
  import { MessageValue } from "../locale/messages.js";
2
2
  //#region src/filter-panel/messages.d.ts
3
3
  export declare const text: {
4
- (id: "date" | "remove" | "noMatches" | "today" | "maximum" | "minimum" | "yesterday" | "24h" | "7d" | "30d" | "90d" | "month" | "year" | "quarter" | "unknownPreset" | "unsupported" | "clearAll" | "searchIn" | "moreFilters" | "filters" | "showOnly", values?: Record<string, MessageValue>): string;
5
- rich(id: "date" | "remove" | "noMatches" | "today" | "maximum" | "minimum" | "yesterday" | "24h" | "7d" | "30d" | "90d" | "month" | "year" | "quarter" | "unknownPreset" | "unsupported" | "clearAll" | "searchIn" | "moreFilters" | "filters" | "showOnly", values: Record<string, MessageValue | import("react").ReactNode>): import("react").ReactNode;
4
+ (id: "date" | "remove" | "noMatches" | "year" | "month" | "today" | "yesterday" | "maximum" | "minimum" | "24h" | "7d" | "30d" | "90d" | "quarter" | "unknownPreset" | "unsupported" | "clearAll" | "searchIn" | "moreFilters" | "filters" | "showOnly", values?: Record<string, MessageValue>): string;
5
+ rich(id: "date" | "remove" | "noMatches" | "year" | "month" | "today" | "yesterday" | "maximum" | "minimum" | "24h" | "7d" | "30d" | "90d" | "quarter" | "unknownPreset" | "unsupported" | "clearAll" | "searchIn" | "moreFilters" | "filters" | "showOnly", values: Record<string, MessageValue | import("react").ReactNode>): import("react").ReactNode;
6
6
  };
7
7
  //#endregion
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ import { RecordMark } from "./app-shell/nav.js";
5
5
  import { LogoMark } from "./app-shell/logo-mark.js";
6
6
  import { ShellLogoProps } from "./app-shell/logo.js";
7
7
  import { logoTapEvent } from "./app-shell/logo-tap.js";
8
+ import { closeSidebarEvent } from "./app-shell/close-sidebar.js";
8
9
  import { PushState } from "./notifications/push/web-push.js";
9
10
  import { ActionCard, ActionCardProps, CardAction, CardTone } from "./action-card/action-card.js";
10
11
  import { FieldList } from "./action-card/field-list.js";
@@ -18,6 +19,7 @@ import { MarksHook } from "./app/marks/marks-hook.js";
18
19
  import { FileViewer, FileViewerProps, SiblingFile, ViewedFile, fileNamed } from "./app/file-viewers/file-viewer.js";
19
20
  import { ActionContext, ActionHandler, BeforeSignInProps, ProjectUi, definePlugin, defineUi } from "./app/pages/project-ui.js";
20
21
  import { PluginInfo, usePlugin } from "./plugins/plugin-context.js";
22
+ import { pluginsChangedEvent } from "./plugins/plugin-source.js";
21
23
  import { App, AppProps } from "./app/app.js";
22
24
  import { MetaData } from "./data/meta-data.js";
23
25
  import { CurrentAddress, ListAddress, ListChange } from "./app/current-address.js";
@@ -120,5 +122,6 @@ import { useFieldControl } from "./primitives/field-control.js";
120
122
  import { Section } from "./record-view/section.js";
121
123
  import { RecordPicker, RecordPickerProps } from "./app/record-picker.js";
122
124
  import { Spinner } from "./primitives/spinner.js";
125
+ import { uiReadyEvent } from "./app/ui-ready.js";
123
126
  import { useQuery, useQueryClient } from "@tanstack/react-query";
124
- export { ActionCard, type ActionCardProps, type ActionContext, type ActionHandler, ActionInputError, type ActionInputProps, ApiProvider, type ApiProviderProps, App, AppLink, AppMark, type AppMarkProps, type AppProps, AssistantDock, type AssistantDockProps, AuthLayout, type AuthLayoutProps, AvailabilityMark, type BackendData, type BackendRefresh, type BeforeSignInProps, type BoardDrop, type BoardDropContext, type BoardDropUndo, type BoardDropWrite, Button, type ButtonProps, CallMark, type CallMarkProps, CallView, type CallViewProps, type CardAction, type CardTone, Carousel, type CarouselImage, type CarouselProps, type ChatAuthor, ChatDivider, type ChatDividerProps, ChatMessage, type ChatMessageProps, ChatThread, type ChatThreadProps, type ChoiceOption, Choices, type ChoicesProps, CodeForm, type CodeFormProps, CompactTable, type CompactTableProps, type ComponentRead, type ComponentReads, type ComponentSelect, Composer, type ComposerProps, type CreateForm, type CreateFormOptions, type CurrentAddress, Dialog, type DialogProps, type DiffLine, DiffView, type DiffViewProps, type Drop, type DropRule, Field, FieldBadge, FieldList, type FieldProps, type FieldWidget, type FieldWidgetEditorProps, type FieldWidgetProps, FileReadError, type FileViewer, type FileViewerProps, type FocusAction, FocusActions, FocusNotice, type FocusNoticeProps, FocusPage, type FocusPageProps, FocusPanel, type FocusPanelProps, type FocusRecord, type FocusSize, FocusSlot, type FocusSlotProps, type FocusZone, Form, type FormProps, type FrameLink, type FrameScripts, HtmlFrame, InPlaceForm, type InPlaceFormProps, Input, type InputProps, type LayoutRecord, type LinkAddress, type ListAddress, type ListChange, type ListDisplay, type ListDisplayRow, LogoMark, Markdown, type MarkdownContentProps as MarkdownProps, type MarksHook, type Member, type MembersResult, MentionBox, type MentionBoxProps, type MentionDraft, MentionedText, MenuSelect, type MenuSelectProps, type MetaData, type NoticeLevel, OtpInput, type OtpInputProps, PartView, type PatchFile, type PeopleSearch, type PickedUser, type PickerGroup, type PickerItem, type PluginInfo, type Presence, type PresenceHook, type ProjectUi, type PushState, RecordCall, type RecordCallProps, type RecordCardProps, RecordLink, type RecordMark, RecordPicker, type RecordPickerProps, ResendCodeButton, type ResendCodeButtonProps, ResponsiveDialog, type ResponsiveDialogProps, RouteLink, type RouteTarget, SearchPicker, type SearchPickerProps, Section, Segmented, type SegmentedOption, type SegmentedProps, Select, type SelectProps, type ShellLogoProps, type SiblingFile, type SiblingPage, SidePanel, type SidePanelProps, SignInPrompt, type SignInPromptProps, type SignedInUser, Spinner, StatusMark, type StatusMarkProps, type Step, StepList, type StepState, Textarea, type TextareaProps, type TitleReader, type TitleRule, ToneEdge, type ViewedFile, allowDelayMs, buttonClass, chatDayLabel, definePlugin, defineUi, diffStats, emptyDraft, fileNamed, isConflict, isFramed, logoTapEvent, mentionedIds, mergeUi, parseDiff, parsePatch, pluginApi, protobaseVersion, sameChatDay, siblingPage, statusRefreshMs, uiFromModule, useApiToken, useAppAddress, useArmedAfterFocus, useAssistant, useAssistantClient, useBackendData, useClient, useComponentReads, useComponentSelect, useCreateForm, useFacets, useFieldControl, useFileText, useFocusPage, useFocusRecord, useFocusZoneFilled, useGuardedPress, useHistogram, useInbox, useLayoutRecord, useList, useListDisplay, useMarkNotificationsRead, useMembers, useMeta, useOwnStatus, usePlugin, usePresence, usePushNotifications, useQuery, useQueryClient, useRecord, useRecordCallAddress, useRecordCalls, useResourceClient, useSeries, useSiblingPage, useSignedInUser, useStatuses, useUnreadNotifications, useUpdateRecord };
127
+ export { ActionCard, type ActionCardProps, type ActionContext, type ActionHandler, ActionInputError, type ActionInputProps, ApiProvider, type ApiProviderProps, App, AppLink, AppMark, type AppMarkProps, type AppProps, AssistantDock, type AssistantDockProps, AuthLayout, type AuthLayoutProps, AvailabilityMark, type BackendData, type BackendRefresh, type BeforeSignInProps, type BoardDrop, type BoardDropContext, type BoardDropUndo, type BoardDropWrite, Button, type ButtonProps, CallMark, type CallMarkProps, CallView, type CallViewProps, type CardAction, type CardTone, Carousel, type CarouselImage, type CarouselProps, type ChatAuthor, ChatDivider, type ChatDividerProps, ChatMessage, type ChatMessageProps, ChatThread, type ChatThreadProps, type ChoiceOption, Choices, type ChoicesProps, CodeForm, type CodeFormProps, CompactTable, type CompactTableProps, type ComponentRead, type ComponentReads, type ComponentSelect, Composer, type ComposerProps, type CreateForm, type CreateFormOptions, type CurrentAddress, Dialog, type DialogProps, type DiffLine, DiffView, type DiffViewProps, type Drop, type DropRule, Field, FieldBadge, FieldList, type FieldProps, type FieldWidget, type FieldWidgetEditorProps, type FieldWidgetProps, FileReadError, type FileViewer, type FileViewerProps, type FocusAction, FocusActions, FocusNotice, type FocusNoticeProps, FocusPage, type FocusPageProps, FocusPanel, type FocusPanelProps, type FocusRecord, type FocusSize, FocusSlot, type FocusSlotProps, type FocusZone, Form, type FormProps, type FrameLink, type FrameScripts, HtmlFrame, InPlaceForm, type InPlaceFormProps, Input, type InputProps, type LayoutRecord, type LinkAddress, type ListAddress, type ListChange, type ListDisplay, type ListDisplayRow, LogoMark, Markdown, type MarkdownContentProps as MarkdownProps, type MarksHook, type Member, type MembersResult, MentionBox, type MentionBoxProps, type MentionDraft, MentionedText, MenuSelect, type MenuSelectProps, type MetaData, type NoticeLevel, OtpInput, type OtpInputProps, PartView, type PatchFile, type PeopleSearch, type PickedUser, type PickerGroup, type PickerItem, type PluginInfo, type Presence, type PresenceHook, type ProjectUi, type PushState, RecordCall, type RecordCallProps, type RecordCardProps, RecordLink, type RecordMark, RecordPicker, type RecordPickerProps, ResendCodeButton, type ResendCodeButtonProps, ResponsiveDialog, type ResponsiveDialogProps, RouteLink, type RouteTarget, SearchPicker, type SearchPickerProps, Section, Segmented, type SegmentedOption, type SegmentedProps, Select, type SelectProps, type ShellLogoProps, type SiblingFile, type SiblingPage, SidePanel, type SidePanelProps, SignInPrompt, type SignInPromptProps, type SignedInUser, Spinner, StatusMark, type StatusMarkProps, type Step, StepList, type StepState, Textarea, type TextareaProps, type TitleReader, type TitleRule, ToneEdge, type ViewedFile, allowDelayMs, buttonClass, chatDayLabel, closeSidebarEvent, definePlugin, defineUi, diffStats, emptyDraft, fileNamed, isConflict, isFramed, logoTapEvent, mentionedIds, mergeUi, parseDiff, parsePatch, pluginApi, pluginsChangedEvent, protobaseVersion, sameChatDay, siblingPage, statusRefreshMs, uiFromModule, uiReadyEvent, useApiToken, useAppAddress, useArmedAfterFocus, useAssistant, useAssistantClient, useBackendData, useClient, useComponentReads, useComponentSelect, useCreateForm, useFacets, useFieldControl, useFileText, useFocusPage, useFocusRecord, useFocusZoneFilled, useGuardedPress, useHistogram, useInbox, useLayoutRecord, useList, useListDisplay, useMarkNotificationsRead, useMembers, useMeta, useOwnStatus, usePlugin, usePresence, usePushNotifications, useQuery, useQueryClient, useRecord, useRecordCallAddress, useRecordCalls, useResourceClient, useSeries, useSiblingPage, useSignedInUser, useStatuses, useUnreadNotifications, useUpdateRecord };
package/dist/index.js CHANGED
@@ -38,6 +38,7 @@ import { Composer } from "./chat/composer.js";
38
38
  import { diffStats, parseDiff } from "./diff-view/diff.js";
39
39
  import { DiffView } from "./diff-view/diff-view.js";
40
40
  import { parsePatch } from "./diff-view/patch.js";
41
+ import { closeSidebarEvent } from "./app-shell/close-sidebar.js";
41
42
  import { LogoMark } from "./app-shell/logo-mark.js";
42
43
  import { AppMark } from "./app-shell/app-mark.js";
43
44
  import { logoTapEvent } from "./app-shell/logo-tap.js";
@@ -55,6 +56,7 @@ import { uiFromModule } from "./app/pages/ui-from-module.js";
55
56
  import { mergeUi } from "./app/pages/merge-ui.js";
56
57
  import { usePlugin } from "./plugins/plugin-context.js";
57
58
  import { pluginApi, protobaseVersion } from "./plugins/plugin-api.js";
59
+ import { pluginsChangedEvent } from "./plugins/plugin-source.js";
58
60
  import { useApiToken } from "./auth/use-api-token.js";
59
61
  import { useSignedInUser } from "./auth/use-signed-in-user.js";
60
62
  import { CallView } from "./calls/call-view.js";
@@ -76,6 +78,7 @@ import { useFocusPage } from "./focus-page/focus-context.js";
76
78
  import { FocusPage } from "./focus-page/focus-page.js";
77
79
  import { FocusActions, FocusNotice, FocusPanel, FocusSlot, useFocusZoneFilled } from "./focus-page/focus-parts.js";
78
80
  import { isConflict, useUpdateRecord } from "./data/use-update-record.js";
81
+ import { uiReadyEvent } from "./app/ui-ready.js";
79
82
  import { App } from "./app/app.js";
80
83
  import { HtmlFrame } from "./app/file-viewers/html-frame.js";
81
84
  import { siblingPage } from "./app/file-viewers/sibling-page.js";
@@ -92,4 +95,4 @@ import { Choices } from "./primitives/choices.js";
92
95
  import { InPlaceForm } from "./app/create/in-place-form.js";
93
96
  import { RecordPicker } from "./app/record-picker.js";
94
97
  import { useQuery, useQueryClient } from "@tanstack/react-query";
95
- export { ActionCard, ActionInputError, ApiProvider, App, AppLink, AppMark, AssistantDock, AuthLayout, AvailabilityMark, Button, CallMark, CallView, Carousel, ChatDivider, ChatMessage, ChatThread, Choices, CodeForm, CompactTable, Composer, Dialog, DiffView, Field, FieldBadge, FieldList, FileReadError, FocusActions, FocusNotice, FocusPage, FocusPanel, FocusSlot, Form, HtmlFrame, InPlaceForm, Input, LogoMark, Markdown, MentionBox, MentionedText, MenuSelect, OtpInput, PartView, RecordCall, RecordLink, RecordPicker, ResendCodeButton, ResponsiveDialog, RouteLink, SearchPicker, Section, Segmented, Select, SidePanel, SignInPrompt, Spinner, StatusMark, StepList, Textarea, ToneEdge, allowDelayMs, buttonClass, chatDayLabel, definePlugin, defineUi, diffStats, emptyDraft, fileNamed, isConflict, isFramed, logoTapEvent, mentionedIds, mergeUi, parseDiff, parsePatch, pluginApi, protobaseVersion, sameChatDay, siblingPage, statusRefreshMs, uiFromModule, useApiToken, useAppAddress, useArmedAfterFocus, useAssistant, useAssistantClient, useBackendData, useClient, useComponentReads, useComponentSelect, useCreateForm, useFacets, useFieldControl, useFileText, useFocusPage, useFocusRecord, useFocusZoneFilled, useGuardedPress, useHistogram, useInbox, useLayoutRecord, useList, useListDisplay, useMarkNotificationsRead, useMembers, useMeta, useOwnStatus, usePlugin, usePresence, usePushNotifications, useQuery, useQueryClient, useRecord, useRecordCallAddress, useRecordCalls, useResourceClient, useSeries, useSiblingPage, useSignedInUser, useStatuses, useUnreadNotifications, useUpdateRecord };
98
+ export { ActionCard, ActionInputError, ApiProvider, App, AppLink, AppMark, AssistantDock, AuthLayout, AvailabilityMark, Button, CallMark, CallView, Carousel, ChatDivider, ChatMessage, ChatThread, Choices, CodeForm, CompactTable, Composer, Dialog, DiffView, Field, FieldBadge, FieldList, FileReadError, FocusActions, FocusNotice, FocusPage, FocusPanel, FocusSlot, Form, HtmlFrame, InPlaceForm, Input, LogoMark, Markdown, MentionBox, MentionedText, MenuSelect, OtpInput, PartView, RecordCall, RecordLink, RecordPicker, ResendCodeButton, ResponsiveDialog, RouteLink, SearchPicker, Section, Segmented, Select, SidePanel, SignInPrompt, Spinner, StatusMark, StepList, Textarea, ToneEdge, allowDelayMs, buttonClass, chatDayLabel, closeSidebarEvent, definePlugin, defineUi, diffStats, emptyDraft, fileNamed, isConflict, isFramed, logoTapEvent, mentionedIds, mergeUi, parseDiff, parsePatch, pluginApi, pluginsChangedEvent, protobaseVersion, sameChatDay, siblingPage, statusRefreshMs, uiFromModule, uiReadyEvent, useApiToken, useAppAddress, useArmedAfterFocus, useAssistant, useAssistantClient, useBackendData, useClient, useComponentReads, useComponentSelect, useCreateForm, useFacets, useFieldControl, useFileText, useFocusPage, useFocusRecord, useFocusZoneFilled, useGuardedPress, useHistogram, useInbox, useLayoutRecord, useList, useListDisplay, useMarkNotificationsRead, useMembers, useMeta, useOwnStatus, usePlugin, usePresence, usePushNotifications, useQuery, useQueryClient, useRecord, useRecordCallAddress, useRecordCalls, useResourceClient, useSeries, useSiblingPage, useSignedInUser, useStatuses, useUnreadNotifications, useUpdateRecord };
@@ -1,7 +1,7 @@
1
1
  import { MessageValue } from "../locale/messages.js";
2
2
  //#region src/inline-child-table/messages.d.ts
3
3
  export declare const text: {
4
- (id: "line" | "pickedUp" | "cancelled" | "instructions" | "over" | "dropped" | "droppedAtStart" | "addLine" | "noLines" | "moveUp" | "moveDown" | "removeLine" | "dragToReorder" | "actionsFor", values?: Record<string, MessageValue>): string;
5
- rich(id: "line" | "pickedUp" | "cancelled" | "instructions" | "over" | "dropped" | "droppedAtStart" | "addLine" | "noLines" | "moveUp" | "moveDown" | "removeLine" | "dragToReorder" | "actionsFor", values: Record<string, MessageValue | import("react").ReactNode>): import("react").ReactNode;
4
+ (id: "line" | "instructions" | "pickedUp" | "over" | "dropped" | "droppedAtStart" | "cancelled" | "addLine" | "noLines" | "moveUp" | "moveDown" | "removeLine" | "dragToReorder" | "actionsFor", values?: Record<string, MessageValue>): string;
5
+ rich(id: "line" | "instructions" | "pickedUp" | "over" | "dropped" | "droppedAtStart" | "cancelled" | "addLine" | "noLines" | "moveUp" | "moveDown" | "removeLine" | "dragToReorder" | "actionsFor", values: Record<string, MessageValue | import("react").ReactNode>): import("react").ReactNode;
6
6
  };
7
7
  //#endregion
@@ -32,5 +32,6 @@ export type LoadedPage = {
32
32
  export declare const createGridLoader: ({ queryClient, client, resources, views, model, columns, filter, orderBy, related }: GridLoaderOptions) => {
33
33
  page: (number: number) => Promise<LoadedPage>;
34
34
  loadRows: (start: number) => Promise<GridRow[]>;
35
+ cachedRows: (start: number) => GridRow[] | undefined;
35
36
  };
36
37
  //#endregion
@@ -89,9 +89,11 @@ const createGridLoader = ({ queryClient, client, resources, views, model, column
89
89
  queryFn: () => fetchPage(number)
90
90
  });
91
91
  const loadRows = async (start) => (await page(Math.floor(start / 40))).rows;
92
+ const cachedRows = (start) => queryClient.getQueryData(pageKey(Math.floor(start / 40)))?.rows;
92
93
  return {
93
94
  page,
94
- loadRows
95
+ loadRows,
96
+ cachedRows
95
97
  };
96
98
  };
97
99
  //#endregion
@@ -57,6 +57,7 @@ const useLiveRows = ({ resources, views, model, columns, filter, orderBy, relate
57
57
  source: useMemo(() => first.data ? {
58
58
  total: first.data.total,
59
59
  loadRows: loader.loadRows,
60
+ cachedRows: loader.cachedRows,
60
61
  revision: first.dataUpdatedAt
61
62
  } : void 0, [
62
63
  first.data,
@@ -12,7 +12,7 @@ export declare const orderAt: (index: number) => {
12
12
  country: "GB" | "NL" | "DE";
13
13
  status: "cancelled" | "draft" | "confirmed" | "picking" | "shipped" | "delivered";
14
14
  totalCents: number;
15
- discount: 0 | 15 | 5 | 10;
15
+ discount: 0 | 15 | 10 | 5;
16
16
  paid: boolean;
17
17
  createdAt: number;
18
18
  owner: "u2" | "u5" | "u8";
@@ -1,7 +1,7 @@
1
1
  import { MessageValue } from "../../locale/messages.js";
2
2
  //#region src/notifications/bell/messages.d.ts
3
3
  export declare const text: {
4
- (id: "unread" | "empty" | "tryAgain" | "showMore" | "turnOn" | "turnOff" | "notifications" | "notificationsUnread" | "notificationsManyUnread" | "markAllRead" | "loadFailed" | "pushOff" | "pushOn" | "pushBlocked" | "pushRegistrationFailed" | "pushNoTokenApns" | "pushNoTokenFcm" | "pushRefused" | "pushFailed" | "pushOffNotStored", values?: Record<string, MessageValue>): string;
5
- rich(id: "unread" | "empty" | "tryAgain" | "showMore" | "turnOn" | "turnOff" | "notifications" | "notificationsUnread" | "notificationsManyUnread" | "markAllRead" | "loadFailed" | "pushOff" | "pushOn" | "pushBlocked" | "pushRegistrationFailed" | "pushNoTokenApns" | "pushNoTokenFcm" | "pushRefused" | "pushFailed" | "pushOffNotStored", values: Record<string, MessageValue | import("react").ReactNode>): import("react").ReactNode;
4
+ (id: "unread" | "empty" | "tryAgain" | "showMore" | "turnOn" | "turnOff" | "loadFailed" | "notifications" | "notificationsUnread" | "notificationsManyUnread" | "markAllRead" | "pushOff" | "pushOn" | "pushBlocked" | "pushRegistrationFailed" | "pushNoTokenApns" | "pushNoTokenFcm" | "pushRefused" | "pushFailed" | "pushOffNotStored", values?: Record<string, MessageValue>): string;
5
+ rich(id: "unread" | "empty" | "tryAgain" | "showMore" | "turnOn" | "turnOff" | "loadFailed" | "notifications" | "notificationsUnread" | "notificationsManyUnread" | "markAllRead" | "pushOff" | "pushOn" | "pushBlocked" | "pushRegistrationFailed" | "pushNoTokenApns" | "pushNoTokenFcm" | "pushRefused" | "pushFailed" | "pushOffNotStored", values: Record<string, MessageValue | import("react").ReactNode>): import("react").ReactNode;
6
6
  };
7
7
  //#endregion
@@ -1,6 +1,7 @@
1
1
  import { Spinner } from "../primitives/spinner.js";
2
2
  import { Button } from "../primitives/button.js";
3
3
  import { useAuth } from "../auth/auth-provider.js";
4
+ import { keys } from "../data/query-keys.js";
4
5
  import { authMessage } from "../auth/auth-messages.js";
5
6
  import { StatusMark } from "../status/status-mark.js";
6
7
  import { PageHeader } from "../app-shell/page-header.js";
@@ -11,9 +12,10 @@ import { AppRolesPicker } from "./app-roles-picker.js";
11
12
  import { grantableRoles, organizationRoleLabel } from "./organization-paths.js";
12
13
  import { PersonRow } from "../people/person-row.js";
13
14
  import { presenceOf } from "../presence/presence.js";
14
- import { useCallback, useEffect, useState } from "react";
15
+ import { useCallback } from "react";
15
16
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
16
17
  import { AuthError } from "@protobase/client";
18
+ import { useQuery } from "@tanstack/react-query";
17
19
  //#region src/organizations/members-page.tsx
18
20
  /** The organization roles the person may set: owners every one, admins those below owner. */
19
21
  const assignableOrganizationRoles = (current) => current?.role === "owner" ? [
@@ -83,13 +85,17 @@ const MemberRow = ({ member, current, status, presence, onChanged }) => {
83
85
  */
84
86
  const MembersPage = ({ current, statuses, presence }) => {
85
87
  const { session } = useAuth();
86
- const [members, setMembers] = useState();
87
- const [error, setError] = useState();
88
88
  const organizationId = current?.organization?.id;
89
- const load = useCallback(() => {
90
- if (organizationId) session.organizations.members(organizationId).then(setMembers, (failure) => setError(failure instanceof AuthError ? authMessage(failure) : text("couldNotReadMembers")));
91
- }, [session, organizationId]);
92
- useEffect(load, [load]);
89
+ const query = useQuery({
90
+ queryKey: keys.organizationMembers(organizationId ?? ""),
91
+ queryFn: () => session.organizations.members(organizationId),
92
+ enabled: Boolean(organizationId),
93
+ retry: false
94
+ });
95
+ const members = query.data;
96
+ const error = query.error ? query.error instanceof AuthError ? authMessage(query.error) : text("couldNotReadMembers") : void 0;
97
+ const { refetch } = query;
98
+ const load = useCallback(() => void refetch(), [refetch]);
93
99
  if (!current?.organization) return null;
94
100
  return /* @__PURE__ */ jsxs("div", {
95
101
  className: "mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-6 md:px-6",
@@ -1,7 +1,7 @@
1
1
  import { MessageValue } from "../locale/messages.js";
2
2
  //#region src/organizations/messages.d.ts
3
3
  export declare const text: {
4
- (id: "create" | "open" | "members" | "accept" | "join" | "leave" | "name" | "organization" | "invitations" | "organizations" | "remove" | "guestLinks" | "yourName" | "signOut" | "loading" | "save" | "cancel" | "until" | "current" | "password" | "delete" | "owner" | "admin" | "member" | "passwordOptional" | "invalidLink" | "manageOrganizations" | "slug" | "allOrganizations" | "allOrganizationsDescription" | "findOrganization" | "nameOrSlug" | "cannotChangeRole" | "makeAccountToJoin" | "makeAccount" | "passwordRequired" | "createAndJoin" | "createYourAccount" | "invitation" | "goToApp" | "invitesToApp" | "invitesTo" | "invitesToWith" | "hasAccount" | "signInAs" | "signInAsToJoin" | "otherAddress" | "signOutToAccept" | "inviteSomeone" | "inviteDescription" | "organizationRole" | "peopleInvited" | "notAcceptedYet" | "sendingAgain" | "nobodyWaiting" | "roleOf" | "couldNotReadMembers" | "whoWorks" | "membersDescription" | "details" | "detailsEditable" | "detailsReadOnly" | "guestLinksDescription" | "guestLinksAllowed" | "handOver" | "handOverDescription" | "newOwner" | "chooseMember" | "deleteOrganization" | "deleteDescription" | "deleteTitle" | "deleteConfirm" | "organizationName" | "leaveOwner" | "leaveMember" | "leaveName" | "noOrganization" | "youAre" | "throughGlobalRoles" | "newOrganization" | "newOrganizationDescription" | "invitationsForYou" | "invitationsForYouDescription" | "anOrganization" | "noAppRoles" | "organizationsSubtitle" | "yourOrganizations" | "memberOf" | "notMember" | "couldNotReadOrganizations", values?: Record<string, MessageValue>): string;
5
- rich(id: "create" | "open" | "members" | "accept" | "join" | "leave" | "name" | "organization" | "invitations" | "organizations" | "remove" | "guestLinks" | "yourName" | "signOut" | "loading" | "save" | "cancel" | "until" | "current" | "password" | "delete" | "owner" | "admin" | "member" | "passwordOptional" | "invalidLink" | "manageOrganizations" | "slug" | "allOrganizations" | "allOrganizationsDescription" | "findOrganization" | "nameOrSlug" | "cannotChangeRole" | "makeAccountToJoin" | "makeAccount" | "passwordRequired" | "createAndJoin" | "createYourAccount" | "invitation" | "goToApp" | "invitesToApp" | "invitesTo" | "invitesToWith" | "hasAccount" | "signInAs" | "signInAsToJoin" | "otherAddress" | "signOutToAccept" | "inviteSomeone" | "inviteDescription" | "organizationRole" | "peopleInvited" | "notAcceptedYet" | "sendingAgain" | "nobodyWaiting" | "roleOf" | "couldNotReadMembers" | "whoWorks" | "membersDescription" | "details" | "detailsEditable" | "detailsReadOnly" | "guestLinksDescription" | "guestLinksAllowed" | "handOver" | "handOverDescription" | "newOwner" | "chooseMember" | "deleteOrganization" | "deleteDescription" | "deleteTitle" | "deleteConfirm" | "organizationName" | "leaveOwner" | "leaveMember" | "leaveName" | "noOrganization" | "youAre" | "throughGlobalRoles" | "newOrganization" | "newOrganizationDescription" | "invitationsForYou" | "invitationsForYouDescription" | "anOrganization" | "noAppRoles" | "organizationsSubtitle" | "yourOrganizations" | "memberOf" | "notMember" | "couldNotReadOrganizations", values: Record<string, MessageValue | import("react").ReactNode>): import("react").ReactNode;
4
+ (id: "members" | "create" | "open" | "organizations" | "accept" | "join" | "leave" | "organization" | "name" | "invitations" | "remove" | "guestLinks" | "yourName" | "signOut" | "loading" | "save" | "cancel" | "until" | "current" | "password" | "delete" | "owner" | "admin" | "member" | "passwordOptional" | "invalidLink" | "manageOrganizations" | "slug" | "allOrganizations" | "allOrganizationsDescription" | "findOrganization" | "nameOrSlug" | "cannotChangeRole" | "makeAccountToJoin" | "makeAccount" | "passwordRequired" | "createAndJoin" | "createYourAccount" | "invitation" | "goToApp" | "invitesToApp" | "invitesTo" | "invitesToWith" | "hasAccount" | "signInAs" | "signInAsToJoin" | "otherAddress" | "signOutToAccept" | "inviteSomeone" | "inviteDescription" | "organizationRole" | "peopleInvited" | "notAcceptedYet" | "sendingAgain" | "nobodyWaiting" | "roleOf" | "couldNotReadMembers" | "whoWorks" | "membersDescription" | "details" | "detailsEditable" | "detailsReadOnly" | "guestLinksDescription" | "guestLinksAllowed" | "handOver" | "handOverDescription" | "newOwner" | "chooseMember" | "deleteOrganization" | "deleteDescription" | "deleteTitle" | "deleteConfirm" | "organizationName" | "leaveOwner" | "leaveMember" | "leaveName" | "noOrganization" | "youAre" | "throughGlobalRoles" | "newOrganization" | "newOrganizationDescription" | "invitationsForYou" | "invitationsForYouDescription" | "anOrganization" | "noAppRoles" | "organizationsSubtitle" | "yourOrganizations" | "memberOf" | "notMember" | "couldNotReadOrganizations", values?: Record<string, MessageValue>): string;
5
+ rich(id: "members" | "create" | "open" | "organizations" | "accept" | "join" | "leave" | "organization" | "name" | "invitations" | "remove" | "guestLinks" | "yourName" | "signOut" | "loading" | "save" | "cancel" | "until" | "current" | "password" | "delete" | "owner" | "admin" | "member" | "passwordOptional" | "invalidLink" | "manageOrganizations" | "slug" | "allOrganizations" | "allOrganizationsDescription" | "findOrganization" | "nameOrSlug" | "cannotChangeRole" | "makeAccountToJoin" | "makeAccount" | "passwordRequired" | "createAndJoin" | "createYourAccount" | "invitation" | "goToApp" | "invitesToApp" | "invitesTo" | "invitesToWith" | "hasAccount" | "signInAs" | "signInAsToJoin" | "otherAddress" | "signOutToAccept" | "inviteSomeone" | "inviteDescription" | "organizationRole" | "peopleInvited" | "notAcceptedYet" | "sendingAgain" | "nobodyWaiting" | "roleOf" | "couldNotReadMembers" | "whoWorks" | "membersDescription" | "details" | "detailsEditable" | "detailsReadOnly" | "guestLinksDescription" | "guestLinksAllowed" | "handOver" | "handOverDescription" | "newOwner" | "chooseMember" | "deleteOrganization" | "deleteDescription" | "deleteTitle" | "deleteConfirm" | "organizationName" | "leaveOwner" | "leaveMember" | "leaveName" | "noOrganization" | "youAre" | "throughGlobalRoles" | "newOrganization" | "newOrganizationDescription" | "invitationsForYou" | "invitationsForYouDescription" | "anOrganization" | "noAppRoles" | "organizationsSubtitle" | "yourOrganizations" | "memberOf" | "notMember" | "couldNotReadOrganizations", values: Record<string, MessageValue | import("react").ReactNode>): import("react").ReactNode;
6
6
  };
7
7
  //#endregion
@@ -8,7 +8,10 @@ export type OrganizationsState = {
8
8
  error?: string;
9
9
  reload: () => void;
10
10
  };
11
- /** The current organization and the person's organizations, read again with `reload` after a change. */
11
+ /**
12
+ * The current organization and the person's organizations, read again with `reload` after a change; a query, so the
13
+ * start cache keeps them and the app's first frame draws them.
14
+ */
12
15
  export declare const useOrganizations: (enabled: boolean) => OrganizationsState;
13
16
  /**
14
17
  * Starts the app again in another organization: what it shows, the menu included, follows from the roles there, so it
@@ -1,31 +1,37 @@
1
1
  import { useAuth } from "../auth/auth-provider.js";
2
+ import { keys } from "../data/query-keys.js";
2
3
  import { authMessage } from "../auth/auth-messages.js";
3
4
  import { text } from "./messages.js";
4
- import { useCallback, useEffect, useState } from "react";
5
+ import { useCallback } from "react";
5
6
  import { AuthError } from "@protobase/client";
7
+ import { useQuery } from "@tanstack/react-query";
6
8
  //#region src/organizations/use-organizations.ts
7
- /** The current organization and the person's organizations, read again with `reload` after a change. */
9
+ const none = [];
10
+ /**
11
+ * The current organization and the person's organizations, read again with `reload` after a change; a query, so the
12
+ * start cache keeps them and the app's first frame draws them.
13
+ */
8
14
  const useOrganizations = (enabled) => {
9
15
  const { session } = useAuth();
10
- const [current, setCurrent] = useState();
11
- const [organizations, setOrganizations] = useState([]);
12
- const [error, setError] = useState();
13
- const [round, setRound] = useState(0);
14
- const reload = useCallback(() => setRound((value) => value + 1), []);
15
- useEffect(() => {
16
- if (!enabled) return;
17
- Promise.all([session.organizations.current(), session.organizations.list()]).then(([currentOrganization, list]) => {
18
- setCurrent(currentOrganization);
19
- setOrganizations(list);
20
- }, (failure) => setError(failure instanceof AuthError ? authMessage(failure) : text("couldNotReadOrganizations")));
21
- }, [
16
+ const query = useQuery({
17
+ queryKey: keys.organizations,
18
+ queryFn: async () => {
19
+ const [current, organizations] = await Promise.all([session.organizations.current(), session.organizations.list()]);
20
+ return {
21
+ current,
22
+ organizations
23
+ };
24
+ },
22
25
  enabled,
23
- session,
24
- round
25
- ]);
26
+ retry: false
27
+ });
28
+ const { refetch } = query;
29
+ const reload = useCallback(() => void refetch(), [refetch]);
30
+ const data = enabled ? query.data : void 0;
31
+ const error = enabled && query.error ? query.error instanceof AuthError ? authMessage(query.error) : text("couldNotReadOrganizations") : void 0;
26
32
  return {
27
- current,
28
- organizations,
33
+ current: data?.current,
34
+ organizations: data?.organizations ?? none,
29
35
  ...error && { error },
30
36
  reload
31
37
  };
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.113.1";
2
+ var version = "0.114.0";
3
3
  var protobase = { "pluginApi": 1 };
4
4
  //#endregion
5
5
  export { protobase, version };