@nivaro/react 0.3.32 → 0.3.34

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 (31) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +89 -8
  4. package/dist/index.js +338 -328
  5. package/dist/shared/components/ForceReloadBanner.js +56 -46
  6. package/dist/shared/components/ItemEditForm.js +5637 -5442
  7. package/dist/shared/components/ProfileView.js +46 -44
  8. package/dist/shared/components/ReportView.js +208 -205
  9. package/dist/shared/components/SearchHighlight.js +30 -0
  10. package/dist/shared/components/TipLayer.js +39 -37
  11. package/dist/shared/components/item-edit/CatalogPickerField.js +1484 -1232
  12. package/dist/shared/components/item-edit/FieldAffordances.js +370 -203
  13. package/dist/shared/components/item-edit/FieldRow.js +396 -354
  14. package/dist/shared/components/item-edit/PersonalDefaultPill.js +50 -0
  15. package/dist/shared/components/item-edit/RelationCombobox.js +42 -41
  16. package/dist/shared/components/item-edit/catalog-search.js +34 -0
  17. package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +34 -34
  18. package/dist/shared/components/item-edit/personal-default-checks.js +134 -0
  19. package/dist/shared/components/item-edit/usePersonalDefaults.js +358 -0
  20. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +130 -111
  21. package/dist/shared/components/layout-editor/inspector/RulesTab.js +76 -75
  22. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  23. package/dist/shared/components/profile/MyDefaultsCard.js +667 -0
  24. package/dist/shared/components/profile/PersonProfile.js +42 -40
  25. package/dist/shared/components/profile/my-defaults-labels.js +76 -0
  26. package/dist/shared/components/profile/primitives.js +72 -67
  27. package/dist/shared/lib/personal-defaults.js +76 -0
  28. package/dist/shared/lib/request-gate.js +78 -76
  29. package/dist/shared/lib/search-text.js +111 -0
  30. package/dist/shared/lib/unsaved-work.js +86 -38
  31. package/package.json +1 -1
@@ -9,7 +9,7 @@ import { noteReplayEvent as _e, createReplayCheckoutState as De } from "../share
9
9
  import { emitReplayTap as Te, setReplayRecorderMode as N, registerReplayCapture as qe, clipEndOffset as Le, withClipKind as Pe } from "../shared/lib/replay-capture.js";
10
10
  import { instrumentConsole as Ne, instrumentRequests as Fe, redactSecrets as Me } from "../shared/lib/replay-context.js";
11
11
  import { instrumentSocket as Oe } from "../shared/lib/replay-socket.js";
12
- const Ue = "nivaro-react@0.3.32", j = 1e4, We = 150, He = 3e3, Ke = 600, $e = (n) => `nvr_replay_resume${n ? `:${n}` : ""}`, G = () => typeof navigator > "u" || navigator.onLine !== !1;
12
+ const Ue = "nivaro-react@0.3.34", j = 1e4, We = 150, He = 3e3, Ke = 600, $e = (n) => `nvr_replay_resume${n ? `:${n}` : ""}`, G = () => typeof navigator > "u" || navigator.onLine !== !1;
13
13
  function Be(n) {
14
14
  return typeof n.url != "string" || typeof fetch != "function" ? null : (f, a) => {
15
15
  const u = typeof n.getToken == "function" ? n.getToken() : void 0, d = { "Content-Type": "application/json" };
package/dist/index.d.ts CHANGED
@@ -2851,6 +2851,9 @@ export declare interface EventPathSheetProps {
2851
2851
 
2852
2852
  declare type EventStatus = 'ok' | 'error' | 'info';
2853
2853
 
2854
+ /** Each token with its alternatives (itself first, then every synonym it shares a group with). */
2855
+ export declare function expandTokens(tokens: string[], synonyms?: SynonymGroups): string[][];
2856
+
2854
2857
  export declare type ExprNode = {
2855
2858
  kind: 'number';
2856
2859
  value: number;
@@ -3202,6 +3205,9 @@ export declare function focusRecordTarget(target: {
3202
3205
  rowId?: string;
3203
3206
  }): void;
3204
3207
 
3208
+ /** Case- and accent-folded text. */
3209
+ export declare function foldSearchText(text: string): string;
3210
+
3205
3211
  /** A press of Expand all or Collapse all; `seq` changes on every press. */
3206
3212
  declare interface FoldSignal {
3207
3213
  open: boolean;
@@ -4093,6 +4099,18 @@ declare interface HelpVideoWhatsNew {
4093
4099
  whole: boolean;
4094
4100
  }
4095
4101
 
4102
+ export declare interface HighlightPart {
4103
+ text: string;
4104
+ match: boolean;
4105
+ }
4106
+
4107
+ /**
4108
+ * The text split into matched / unmatched runs for every token and synonym
4109
+ * found in it. Overlapping or touching matches merge into one run. No query,
4110
+ * or nothing found, returns the whole text as one unmatched part.
4111
+ */
4112
+ export declare function highlightParts(text: string | null | undefined, q: string | null | undefined, opts?: SearchTextOptions): HighlightPart[];
4113
+
4096
4114
  /** A held frame (#1537): the edited timeline freezes on the source frame at
4097
4115
  * `at_ms` for `hold_ms` (edited time, 0.2–10 s). Extra edited time with no
4098
4116
  * source advance, like 0.5x slow motion; everything on screen at that moment
@@ -5003,6 +5021,8 @@ export declare function isCodeError(err: unknown): boolean;
5003
5021
  */
5004
5022
  export declare function isListTimeout(err: unknown): boolean;
5005
5023
 
5024
+ export declare function isReloadingForUpdate(): boolean;
5025
+
5006
5026
  /** True once a 401 said this tab is signed out, until a sign-in is heard. */
5007
5027
  export declare function isSignedOut(): boolean;
5008
5028
 
@@ -5040,11 +5060,6 @@ export declare type ItemEditAuthContextValue = {
5040
5060
  userId: string;
5041
5061
  };
5042
5062
 
5043
- /**
5044
- * The record form. With `design` (the layout editor's canvas) the whole form —
5045
- * its own hooks included — runs inside DesignCanvas: a client that cannot
5046
- * write, no realtime, inert inputs, selectable shells.
5047
- */
5048
5063
  export declare function ItemEditForm(props: ItemEditFormProps): JSX.Element;
5049
5064
 
5050
5065
  export declare interface ItemEditFormProps {
@@ -5820,6 +5835,12 @@ declare type MatchedDrawerConfig = {
5820
5835
  defaults?: Record<string, unknown>;
5821
5836
  };
5822
5837
 
5838
+ /**
5839
+ * Every token (or one of its synonyms) occurs in the text. An empty query
5840
+ * matches everything — same contract as `matchesAllTokens`.
5841
+ */
5842
+ export declare function matchesSearch(text: string | null | undefined, q: string | null | undefined, opts?: SearchTextOptions): boolean;
5843
+
5823
5844
  /** Match a filter surface (by its own key and/or its options collection) to a
5824
5845
  * scope dimension. Convention: key === dimension name wins, else the filter's
5825
5846
  * options collection === the dimension's target collection. */
@@ -8490,7 +8511,7 @@ export declare function registerReplayCapture(fn: Capture, snap?: Snapshot): ()
8490
8511
  export declare function registerRoomOpener(fn: RoomOpener): () => void;
8491
8512
 
8492
8513
  /** Report a source of unsaved work; the returned function removes it. */
8493
- export declare function registerUnsavedWork(label: string, dirty: () => boolean): () => void;
8514
+ export declare function registerUnsavedWork(label: string, dirty: () => boolean, opts?: UnsavedWorkOptions): () => void;
8494
8515
 
8495
8516
  /** Register the host's opener. Returns an unregister function. */
8496
8517
  export declare function registerViewAsOpener(fn: ViewAsOpener): () => void;
@@ -9142,6 +9163,36 @@ declare interface ScopeDimensionLite {
9142
9163
  display_field?: string | null;
9143
9164
  }
9144
9165
 
9166
+ /**
9167
+ * Text with the typed search marked (lib/search-text.ts `highlightParts`):
9168
+ * every token and synonym, case- and accent-insensitive. The mark keeps the
9169
+ * text's own colour and only tints behind it (the admin palette's treatment),
9170
+ * so it reads in light and dark alike. No query = the plain text.
9171
+ */
9172
+ export declare function SearchHighlight({ text, query, synonyms, className, markClassName }: {
9173
+ text: string | null | undefined;
9174
+ query: string | null | undefined;
9175
+ synonyms?: SynonymGroups;
9176
+ className?: string;
9177
+ markClassName?: string;
9178
+ }): JSX.Element;
9179
+
9180
+ /**
9181
+ * The API's `search_rank=1` tier for one row, from its searched values in
9182
+ * request order (`values[0]` = the primary column, e.g. the item number):
9183
+ * 0 primary equals the text · 1 another column equals it · 2 primary starts
9184
+ * with it · 3 another column starts with it · 4 every word starts a word of
9185
+ * some column (start, or after a non-letter/digit) · 5 anything else.
9186
+ * Case-insensitive like the database collation; accents are compared as-is
9187
+ * (SQL Server *_CI_AS), so this never folds them.
9188
+ */
9189
+ export declare function searchRankTier(values: ReadonlyArray<unknown>, q: string | null | undefined): number;
9190
+
9191
+ export declare interface SearchTextOptions {
9192
+ /** Groups of interchangeable words/phrases; a token in a group also matches the rest. */
9193
+ synonyms?: SynonymGroups;
9194
+ }
9195
+
9145
9196
  export declare type SectionState = {
9146
9197
  isCollapsed: (key: string) => boolean;
9147
9198
  toggle: (key: string) => void;
@@ -9877,6 +9928,28 @@ export declare function SupportView({ initialTicketId, onTicketChange, className
9877
9928
  className?: string;
9878
9929
  }): JSX.Element;
9879
9930
 
9931
+ /**
9932
+ * One search-text vocabulary for every client surface that matches typed text
9933
+ * against labels: pickers (RelationCombobox, CatalogPickerField), the command
9934
+ * palettes and full search pages (2026-10-28 search program, item 22).
9935
+ *
9936
+ * - `tokenize(q)`: words, lower-cased and accent-folded; "quoted phrases" stay
9937
+ * one token. Duplicates drop.
9938
+ * - `matchesSearch(text, q)`: every token (or one of its synonyms) is a
9939
+ * substring of the text — `matchesAllTokens` (lib/utils.ts) semantics, plus
9940
+ * accent folding, phrases and synonyms.
9941
+ * - `highlightParts(text, q)`: the text cut into matched / unmatched parts for
9942
+ * rendering `<mark>`s (multi-token, case- and accent-insensitive, overlaps
9943
+ * merged, indices mapped back to the ORIGINAL text).
9944
+ * - Synonyms are a hook, never fetched here: pass `synonyms` (groups of
9945
+ * interchangeable words, e.g. the search-analytics synonym list the server's
9946
+ * `searchPhrases` reads) and each token also matches the others in its group.
9947
+ *
9948
+ * `searchRankTier` is the client twin of the API's `search_rank=1` ORDER BY
9949
+ * (api/src/services/list-search-rank.ts) — change both together.
9950
+ */
9951
+ export declare type SynonymGroups = ReadonlyArray<ReadonlyArray<string>>;
9952
+
9880
9953
  declare type TabKey = 'catalog' | 'rules' | 'subscriptions' | 'history' | 'widget_alerts' | 'widget_alert_history' | 'anomaly_rules' | 'anomaly_history';
9881
9954
 
9882
9955
  export declare type TabState = {
@@ -10023,6 +10096,9 @@ export declare function TipLayer(): ReactPortal | null;
10023
10096
 
10024
10097
  export declare function titleCase(str: string): string;
10025
10098
 
10099
+ /** Typed text → tokens: whitespace-split words, "quoted phrases" kept whole; folded, unique. */
10100
+ export declare function tokenize(q: string | null | undefined): string[];
10101
+
10026
10102
  export declare type TokenResolver = (path: string) => unknown;
10027
10103
 
10028
10104
  declare type Tone = 'accent' | 'warning' | 'neutral';
@@ -10182,6 +10258,10 @@ declare interface UnsavedSummary {
10182
10258
  /** What would be lost, by label (empty = nothing). */
10183
10259
  export declare function unsavedWorkLabels(): string[];
10184
10260
 
10261
+ declare interface UnsavedWorkOptions {
10262
+ saveForReload?: () => boolean | Promise<boolean>;
10263
+ }
10264
+
10185
10265
  /** The ids an update covers: one, a coalesced list, or null = "too many — refresh it all". */
10186
10266
  export declare function updateItemIds(ev: CollectionUpdateEvent): Array<string | number> | null;
10187
10267
 
@@ -11079,8 +11159,9 @@ export declare function useTypingIndicator(room: string | null): {
11079
11159
 
11080
11160
  export declare function useUnreadChirp(totalUnread: number, rooms?: RoomInfo[]): void;
11081
11161
 
11082
- /** A form reports its dirty state while mounted. */
11083
- export declare function useUnsavedWork(dirty: boolean, label?: string): void;
11162
+ /** A form reports its dirty state while mounted (and, optionally, how to keep it through a
11163
+ * pushed reload — the latest function is always the one called). */
11164
+ export declare function useUnsavedWork(dirty: boolean, label?: string, saveForReload?: () => boolean | Promise<boolean>): void;
11084
11165
 
11085
11166
  /** Directory of users to add to a private channel. */
11086
11167
  export declare function useUserSearch(search: string, enabled: boolean): {