@nivaro/react 0.3.107 → 0.3.108

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.
@@ -10,7 +10,7 @@ import { noteReplayEvent as Fe, createReplayCheckoutState as Me } from "../share
10
10
  import { emitReplayTap as Ne, setReplayRecorderMode as O, registerReplayCapture as Oe, clipEndOffset as Ue, withClipKind as We } from "../shared/lib/replay-capture.js";
11
11
  import { instrumentConsole as He, instrumentRequests as Ke, redactSecrets as $e } from "../shared/lib/replay-context.js";
12
12
  import { instrumentSocket as Be } from "../shared/lib/replay-socket.js";
13
- const ze = "nivaro-react@0.3.107", Q = 1e4, Ye = 150, xe = 3e3, je = 600, Ge = (o) => `nvr_replay_resume${o ? `:${o}` : ""}`, V = () => typeof navigator > "u" || navigator.onLine !== !1;
13
+ const ze = "nivaro-react@0.3.108", Q = 1e4, Ye = 150, xe = 3e3, je = 600, Ge = (o) => `nvr_replay_resume${o ? `:${o}` : ""}`, V = () => typeof navigator > "u" || navigator.onLine !== !1;
14
14
  function Je(o) {
15
15
  return typeof o.url != "string" || typeof fetch != "function" ? null : (f, u) => {
16
16
  const l = typeof o.getToken == "function" ? o.getToken() : void 0, d = { "Content-Type": "application/json" };
package/dist/index.d.ts CHANGED
@@ -2205,6 +2205,16 @@ export declare interface CollectionBrowserViewProps {
2205
2205
  className?: string;
2206
2206
  }
2207
2207
 
2208
+ /**
2209
+ * The person's own favorite collections — the star. The admin app passes its sidebar
2210
+ * favorites (so a star also lands in the sidebar); without one the directory reads and writes
2211
+ * the same store itself (users.preferences.nav_favorites, `/collections/<name>` paths).
2212
+ */
2213
+ export declare interface CollectionFavorites {
2214
+ favorite: Set<string>;
2215
+ toggle: (collection: string, label: string) => unknown;
2216
+ }
2217
+
2208
2218
  export declare function CollectionImportPanel({ initialJobId, onJobOpen }: {
2209
2219
  /** Deep link: open this job's detail on mount. */
2210
2220
  initialJobId?: string | null;
@@ -2216,6 +2226,86 @@ declare interface CollectionNames {
2216
2226
  plural?: string | null;
2217
2227
  }
2218
2228
 
2229
+ export declare function CollectionsDirectory({ isAdmin, title, collectionPath, include, favorites: hostFavorites, admin }: CollectionsDirectoryProps): JSX.Element;
2230
+
2231
+ /**
2232
+ * Editing tools only the admin app offers (efp-new passes none): each one switches its part
2233
+ * of the page on. Everything else — Pinned, My favorites, Recent, the views, chips, folders,
2234
+ * Jump to, the switches, the hover card, search — is the same in every host.
2235
+ */
2236
+ export declare interface CollectionsDirectoryAdminTools {
2237
+ /** Toolbar buttons before Arrange / Select (new table, schema views, proposals). */
2238
+ toolbarActions?: ReactNode;
2239
+ /** Panels shown above the list (create a table, describe, proposals). */
2240
+ panels?: ReactNode;
2241
+ /** ✏ on each row: where the collection's editor lives. */
2242
+ editPath?: (collection: string) => string;
2243
+ /** An extra group in each row's ⋯ menu. */
2244
+ rowMenu?: {
2245
+ heading: string;
2246
+ items: (collection: string) => RowMenuLink[];
2247
+ };
2248
+ /** Move collections into a folder (null = out of every folder). Turns on the row menu's
2249
+ * "Move to folder" (and, with `renderMoveDialog`, Select). */
2250
+ moveCollections?: (names: string[], group: string | null) => Promise<unknown>;
2251
+ /** Select mode's "Move to folder…" dialog. */
2252
+ renderMoveDialog?: (p: {
2253
+ open: boolean;
2254
+ onOpenChange: (open: boolean) => void;
2255
+ names: string[];
2256
+ folders: FolderOption[];
2257
+ onMoved: () => void;
2258
+ }) => ReactNode;
2259
+ /** Save a new folder / collection order. Turns on Arrange. */
2260
+ reorder?: (items: Array<{
2261
+ collection: string;
2262
+ sort: number;
2263
+ }>) => Promise<unknown>;
2264
+ /** Shown above the folders in the Folders view while nothing is filtered (suggested folders). */
2265
+ renderSuggestions?: (ctx: {
2266
+ real: DirectoryCollection[];
2267
+ folders: FolderOption[];
2268
+ refresh: () => void;
2269
+ }) => ReactNode;
2270
+ /** Extra folded sections under the list (unregistered / system tables). */
2271
+ renderExtraSections?: (ctx: {
2272
+ filter: string;
2273
+ collapsed: Record<string, boolean>;
2274
+ onToggle: (key: string) => void;
2275
+ renderSection: (s: ExtraSectionSpec) => ReactNode;
2276
+ }) => ReactNode;
2277
+ /** "Create a table" on an empty search. */
2278
+ onCreate?: () => void;
2279
+ }
2280
+
2281
+ /**
2282
+ * The collections directory — every registered collection, findable. One page for every host:
2283
+ * the admin app's /collections and efp-new's /admin/data render this.
2284
+ *
2285
+ * Folders (a registry row other rows name as their `group`) hold the curated part; everything
2286
+ * else sits in "Not in a folder", A–Z. Hidden collections and link tables are folded away by
2287
+ * default. Views other than Folders are one flat sorted list. "Pinned" is the shared list an
2288
+ * administrator puts at the top for everyone (shared-pins.ts); "My favorites" are the person's
2289
+ * own stars (= the admin sidebar's favorites); Recent / Most used are this browser's own.
2290
+ * Administrators also get counts, last change, badges, the hover card and pin for everyone.
2291
+ * Editing tools (Arrange, Select → Move to folder, folder suggestions, schema tools, ✏ Edit,
2292
+ * the Data model menu) come only from the host's `admin` prop.
2293
+ */
2294
+ export declare interface CollectionsDirectoryProps {
2295
+ /** The reader is an administrator (stats, admin views, hover card, pin for everyone). */
2296
+ isAdmin: boolean;
2297
+ /** The page's name in the toolbar (default "Collections"). */
2298
+ title?: string;
2299
+ /** Where a collection's records open in this app (default `/collections/<name>`). */
2300
+ collectionPath?: (collection: string) => string;
2301
+ /** Leave collections out of the directory (efp-new: system tables). */
2302
+ include?: (c: DirectoryCollection) => boolean;
2303
+ /** The person's favorites; default = the shared store the admin sidebar uses. */
2304
+ favorites?: CollectionFavorites;
2305
+ /** Host-only editing tools (the admin app). */
2306
+ admin?: CollectionsDirectoryAdminTools;
2307
+ }
2308
+
2219
2309
  /**
2220
2310
  * Realtime sprint client contract. A HOST (admin, a portal app) owns the actual
2221
2311
  * Socket.io connection and provides this to shared components; components
@@ -2856,6 +2946,26 @@ declare interface DirectoryChannel {
2856
2946
  color?: string | null;
2857
2947
  }
2858
2948
 
2949
+ /**
2950
+ * The collections directory (admin /collections, efp-new /admin/data): one shared page that
2951
+ * lists every registered collection. The page (CollectionsDirectory.tsx) owns the state;
2952
+ * the parts in this folder render it. Host-only edit tools come in through
2953
+ * `CollectionsDirectoryAdminTools`, so a host that passes none gets the plain directory.
2954
+ */
2955
+ /** A row of GET /api/collections — only the columns the directory reads. */
2956
+ export declare interface DirectoryCollection {
2957
+ collection: string;
2958
+ display_name?: string | null;
2959
+ icon?: string | null;
2960
+ color?: string | null;
2961
+ note?: string | null;
2962
+ hidden?: boolean | null;
2963
+ singleton?: boolean | null;
2964
+ sort?: number | null;
2965
+ /** The folder it sits in (another row's `collection`). */
2966
+ group?: string | null;
2967
+ }
2968
+
2859
2969
  /** Forget a run: stops watching it (the server run continues on its own). */
2860
2970
  export declare function dismissAutofillRun(id: string): void;
2861
2971
 
@@ -3528,6 +3638,17 @@ export declare function ExternalRequestsChip({ collection, itemId }: {
3528
3638
  /** Field paths an expression reads, without evaluating it. */
3529
3639
  export declare function extractExpressionTokens(src: string): string[];
3530
3640
 
3641
+ /** A folded section the host adds under the list (the admin's unregistered/system tables). */
3642
+ declare interface ExtraSectionSpec {
3643
+ key: string;
3644
+ label: string;
3645
+ icon?: ReactNode;
3646
+ count: number | null;
3647
+ open: boolean;
3648
+ onToggle: () => void;
3649
+ body: ReactNode;
3650
+ }
3651
+
3531
3652
  /** Extract the slot key from an assignment field name, or null. */
3532
3653
  export declare function extSlotKey(field: string): string | null;
3533
3654
 
@@ -3805,6 +3926,13 @@ export declare function focusRecordTarget(target: {
3805
3926
  rowId?: string;
3806
3927
  }): void;
3807
3928
 
3929
+ declare interface FolderOption {
3930
+ /** The folder's key (a `group` value). */
3931
+ key: string;
3932
+ label: string;
3933
+ color: string | null;
3934
+ }
3935
+
3808
3936
  /** Case- and accent-folded text. */
3809
3937
  export declare function foldSearchText(text: string): string;
3810
3938
 
@@ -10212,6 +10340,15 @@ declare interface RowMatchPanelConfig {
10212
10340
  };
10213
10341
  }
10214
10342
 
10343
+ /** One extra item in a row's ⋯ menu (host-supplied, e.g. the admin's Data model pages). */
10344
+ declare interface RowMenuLink {
10345
+ key: string;
10346
+ label: string;
10347
+ icon?: ReactNode;
10348
+ /** In-app path, opened through the host's navigation. */
10349
+ path: string;
10350
+ }
10351
+
10215
10352
  /**
10216
10353
  * "Who has this row open" on a list row (#2486): up to three 16px avatar discs, overlapping,
10217
10354
  * then "+N" when more people are there; the names in the instant tooltip. People the viewer
@@ -12253,6 +12390,15 @@ export declare function useMyScopes(): {
12253
12390
  ready: boolean;
12254
12391
  };
12255
12392
 
12393
+ /**
12394
+ * The person's favorite collections when the host has no sidebar favorites of its own:
12395
+ * the same server store the admin sidebar uses (GET /users/me preferences, PATCH
12396
+ * /users/me/preferences {nav_favorites, nav_favorite_groups}), so a star here shows in the
12397
+ * admin's sidebar too and follows the person between apps and machines. Saves go out one
12398
+ * at a time; the star flips at once and falls back if the save fails.
12399
+ */
12400
+ export declare function useNavFavoriteCollections(enabled?: boolean): CollectionFavorites;
12401
+
12256
12402
  export declare function useNavigation(): NavigationContextValue;
12257
12403
 
12258
12404
  /** The tab's trail, re-rendering on every change. */