@declarion/react 0.38.1 → 0.39.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 (46) hide show
  1. package/dist-lib/{DraggableChildrenTable-CI5a0Emm.js → DraggableChildrenTable-DziCVhq6.js} +1 -1
  2. package/dist-lib/{Grid-BZEMUmjI.js → Grid-BTX2tkCT.js} +2 -2
  3. package/dist-lib/{LayoutRenderer-CnKUYh8M.js → LayoutRenderer-CwMERoPJ.js} +387 -285
  4. package/dist-lib/{MarkdownRenderer-DNmOqp_M.js → MarkdownRenderer-dHOTEhUa.js} +1 -1
  5. package/dist-lib/{RefreshControl-DsEXi6WF.js → RefreshControl--UAgflh7.js} +257 -175
  6. package/dist-lib/{SmartDetailPage.impl-DhSpZTLw.js → SmartDetailPage.impl-Bj7MtHxi.js} +474 -414
  7. package/dist-lib/{SmartRecordListPage.impl-Bi_FPbGy.js → SmartRecordListPage.impl-CZXzVhPC.js} +164 -164
  8. package/dist-lib/api/params.d.ts +12 -11
  9. package/dist-lib/components/columns/ColumnPicker.d.ts +11 -1
  10. package/dist-lib/components/detail-layout/EvidenceBlock.d.ts +6 -0
  11. package/dist-lib/components/detail-layout/useManualColumnResize.d.ts +25 -0
  12. package/dist-lib/components/list/QuickPeek.d.ts +11 -2
  13. package/dist-lib/components/pages/list/{ListBulkBar.d.ts → ListFloatbar.d.ts} +3 -3
  14. package/dist-lib/components/pages/list/RowActionsCell.d.ts +8 -10
  15. package/dist-lib/components/pages/list/RowContextMenu.d.ts +29 -0
  16. package/dist-lib/components/pages/list/SaveViewDialog.d.ts +5 -1
  17. package/dist-lib/components/pages/list/cardProjection.d.ts +1 -1
  18. package/dist-lib/components/pages/list/column-sizing.d.ts +15 -0
  19. package/dist-lib/components/pages/list/columns.d.ts +3 -0
  20. package/dist-lib/components/pages/list/useHeaderReorder.d.ts +26 -0
  21. package/dist-lib/components/pages/list/useRowMenu.d.ts +47 -0
  22. package/dist-lib/components/pages/profile/Profile.d.ts +3 -0
  23. package/dist-lib/components/pages/tenant-params/TenantParamsPage.d.ts +2 -0
  24. package/dist-lib/components/params/ParamsBlock.d.ts +25 -0
  25. package/dist-lib/components/params/param-editors.d.ts +28 -0
  26. package/dist-lib/components/primitives/Dropdown.d.ts +10 -1
  27. package/dist-lib/components/shared/ActionDialog.d.ts +2 -2
  28. package/dist-lib/components/shared/ActionRunner.d.ts +15 -0
  29. package/dist-lib/components/shared/ResponsiveActionBar.d.ts +45 -23
  30. package/dist-lib/declarion-react.css +1 -1
  31. package/dist-lib/hooks/useParams.d.ts +45 -1
  32. package/dist-lib/index.d.ts +0 -2
  33. package/dist-lib/index.js +3074 -2189
  34. package/dist-lib/lib/actions.d.ts +17 -3
  35. package/dist-lib/lib/evidence-verdict.d.ts +11 -0
  36. package/dist-lib/lib/rowClickGesture.d.ts +14 -0
  37. package/dist-lib/{registry-B_AmhRdj.js → registry-DXNFRlbB.js} +780 -559
  38. package/dist-lib/stores/list-layout.d.ts +86 -0
  39. package/dist-lib/testing.js +1 -1
  40. package/dist-lib/types/api.d.ts +29 -1
  41. package/dist-lib/types/schema.d.ts +15 -0
  42. package/dist-lib/{useCurrentScreen-CcsD2NAk.js → useCurrentScreen-BA2lb-d7.js} +860 -835
  43. package/dist-lib/{useProperties-CPtQIWXp.js → useProperties-Br2DeOQh.js} +81 -81
  44. package/dist-lib/{value-BCjHI_Ai.js → value-C91loRXp.js} +1 -1
  45. package/package.json +1 -1
  46. package/dist-lib/components/list/RowMenu.d.ts +0 -23
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Per-device list-table WIDTH store (plan 2026-07-18 "Adjustable table
3
+ * columns", rev 2). Holds ONE thing: column pixel widths, device-local in
4
+ * localStorage, per (tenant, user, SCREEN) by column id. Screen-keyed, so
5
+ * widening a column once holds across EVERY view of that screen on this device.
6
+ * Absent entry = the YAML default (`field.display.width ?? 150`), resolved by
7
+ * TanStack when `header.getSize()` reads `columnSizing[id] ?? columnDef.size`.
8
+ *
9
+ * Why widths are the ONLY thing here: order/visibility/sort/filters already
10
+ * live in the URL and are persisted per device per tab by the `tabs` store -
11
+ * that is the single source of truth for the logical layout (a second store
12
+ * mirroring them caused a cold-open seed to clobber `?sort`; removed in rev 2).
13
+ * Width is the one column setting that must NOT ride a shareable URL: it is
14
+ * physical fit (a width tuned for a 27"/4K monitor would corrupt the same view
15
+ * for a teammate on a laptop), so it is device-local and never in a saved view.
16
+ *
17
+ * This does NOT violate the "browser stores nothing" appearance-preferences
18
+ * rule (Decision 33, `preferences.ts`): that governs deployment BRANDING
19
+ * (theme/accent/density). Widths are device state of the same class as the
20
+ * `tabs` store, which already uses localStorage. Keying + persistence mirror
21
+ * `stores/tabs.ts`: a module-level (tenant,user) scope set via `setScope`, the
22
+ * whole snapshot under one key `declarion::${tenantId}::${userId}::listlayout`,
23
+ * hydrated on tenant switch. `childKey` callers pass a composite screenKey
24
+ * `${screenCode}::child::${childKey}`; the store is agnostic to it.
25
+ */
26
+ /** Minimum resizable column width in px. Exported so the resize handler and
27
+ * the store's defensive clamp share ONE floor (no magic number). */
28
+ export declare const MIN_COL_WIDTH = 60;
29
+ /** Maximum resizable column width in px (a sane cap so a column can never
30
+ * become absurdly wide). Shared by the TanStack per-column `maxSize` and the
31
+ * store's defensive clamp. */
32
+ export declare const MAX_COL_WIDTH = 1200;
33
+ /** Snapshot schema version. A snapshot with a different `v` is discarded on
34
+ * read (future migrations plug in here). */
35
+ export declare const LIST_LAYOUT_VERSION = 2;
36
+ /** A screen's width overrides: colId -> pixel width. */
37
+ export type WidthMap = Record<string, number>;
38
+ interface LayoutSnapshot {
39
+ v: number;
40
+ /** screenKey -> (colId -> width). */
41
+ widths: Record<string, WidthMap>;
42
+ /** True once this user has resized any column on this device - gates the
43
+ * one-time "widths are personal per device" education toast. */
44
+ resizeEduShown?: boolean;
45
+ }
46
+ interface LayoutState extends LayoutSnapshot {
47
+ setScope: (tenantId: string | null, userId: string | null) => void;
48
+ hydrate: () => void;
49
+ /** Set one column's width (clamped). */
50
+ setWidth: (screenKey: string, colId: string, width: number) => void;
51
+ /** Merge a batch of column widths (clamped). */
52
+ setWidths: (screenKey: string, widths: WidthMap) => void;
53
+ /** Drop all width overrides for a screen (back to YAML defaults). Stored as
54
+ * an empty map, not a deleted key, so the reset propagates across tabs. */
55
+ resetWidths: (screenKey: string) => void;
56
+ /** Drop width entries for colIds no longer in the screen schema. */
57
+ prune: (screenKey: string, validColIds: string[]) => void;
58
+ /** Record that the one-time resize-education toast has been shown. */
59
+ markResizeEduShown: () => void;
60
+ }
61
+ /** Narrow an untrusted persisted snapshot (localStorage is hostile) to
62
+ * LayoutSnapshot, discarding anything malformed or of a foreign version. */
63
+ export declare function parseLayoutSnapshot(raw: string): LayoutSnapshot | null;
64
+ /**
65
+ * Merge an incoming cross-tab snapshot into the local one, last-writer-wins per
66
+ * screenKey (a screenKey present in `incoming` replaces the local value
67
+ * wholesale, so a prune / reset-to-`{}` / edit all propagate; screenKeys only
68
+ * the local tab touched survive).
69
+ */
70
+ export declare function mergeSnapshot(local: LayoutSnapshot, incoming: LayoutSnapshot): LayoutSnapshot;
71
+ export declare const useListLayoutStore: import("zustand").UseBoundStore<import("zustand").StoreApi<LayoutState>>;
72
+ /** Subscribe to the window `storage` event for the layout key and merge an
73
+ * incoming snapshot (last-writer-wins per screenKey). Idempotent. */
74
+ export declare function startListLayoutCrossTabSync(): void;
75
+ export interface ScopedListLayout {
76
+ widths: WidthMap;
77
+ /** Whether the one-time resize-education toast has already been shown. */
78
+ resizeEduShown: boolean;
79
+ setWidth: (colId: string, width: number) => void;
80
+ setWidths: (widths: WidthMap) => void;
81
+ resetWidths: () => void;
82
+ prune: (validColIds: string[]) => void;
83
+ markResizeEduShown: () => void;
84
+ }
85
+ export declare function useListLayout(screenKey: string | null | undefined): ScopedListLayout;
86
+ export {};
@@ -1,4 +1,4 @@
1
- import { Ln as e, _t as t, at as n, ft as r, mt as i, pt as a, r as o, t as s } from "./useCurrentScreen-CcsD2NAk.js";
1
+ import { Ln as e, _t as t, at as n, ft as r, mt as i, pt as a, r as o, t as s } from "./useCurrentScreen-BA2lb-d7.js";
2
2
  import { useState as c } from "react";
3
3
  import { MemoryRouter as l } from "react-router-dom";
4
4
  import { QueryClient as u, QueryClientProvider as d } from "@tanstack/react-query";
@@ -355,7 +355,12 @@ export interface ParamLookup {
355
355
  source?: "object" | "user" | "role" | "tenant" | "env" | "yaml";
356
356
  type?: string;
357
357
  }
358
- /** @deprecated Prefer `ParamLookup`. Retained for callers still inspecting `source`. */
358
+ /**
359
+ * One entry of the bulk `GET /api/params` response (and per-code resolution).
360
+ * Carries the declaration facets the admin UIs need to compute attachment,
361
+ * render structure editors, and render choice selects, so the bulk endpoint is
362
+ * self-sufficient without a second schema fetch.
363
+ */
359
364
  export interface ResolvedParam {
360
365
  code: string;
361
366
  name: LocalizedString;
@@ -364,6 +369,12 @@ export interface ResolvedParam {
364
369
  description?: LocalizedString;
365
370
  value: unknown;
366
371
  source: "object" | "user" | "role" | "tenant" | "env" | "yaml" | "none";
372
+ /** Override levels the param accepts (reserved words or entity codes). */
373
+ scopes?: string[];
374
+ /** Structure code when `type === "structure"`. */
375
+ structure?: string;
376
+ /** Closed value set for a choices-constrained string param. */
377
+ choices?: string[];
367
378
  }
368
379
  export interface ParamOverride {
369
380
  param_code: string;
@@ -449,6 +460,22 @@ export interface V2PropertyInstance {
449
460
  updated_by?: string;
450
461
  }
451
462
  /** Per-row parameter override. */
463
+ /**
464
+ * The last verification verdict of an evidence-covered row, shipped under the
465
+ * row's `$evidence` key (the evidence satellite, mirroring `$statuses`). Read
466
+ * cheaply from the stored verification result - never a live re-verify. Mirrors
467
+ * the Go `evidence.RowVerdict`. `verdict` is one of: `verified`, `unverified`,
468
+ * `tampered`, `erased`, `indeterminate`, `outside_coverage`.
469
+ */
470
+ export interface EvidenceVerdict {
471
+ verdict: string;
472
+ verified_at?: string;
473
+ reason?: string;
474
+ seq?: number;
475
+ generation?: number;
476
+ checkpoint_number?: number;
477
+ covered: boolean;
478
+ }
452
479
  export interface V2ParamInstance {
453
480
  param_code: string;
454
481
  value: unknown;
@@ -498,4 +525,5 @@ export interface EnrichedRow extends RowData {
498
525
  $params?: V2ParamInstance[];
499
526
  $children?: Record<string, Record<string, unknown>[]>;
500
527
  $units?: Units;
528
+ $evidence?: EvidenceVerdict;
501
529
  }
@@ -42,6 +42,9 @@ export declare function getDisplayValue(row: Record<string, unknown> | null | un
42
42
  display?: {
43
43
  display_field?: string;
44
44
  };
45
+ fields?: {
46
+ get(name: string): EntityField | undefined;
47
+ };
45
48
  } | null | undefined): string | undefined;
46
49
  export declare function resolveRefRecordLabel(record: Record<string, unknown>, displayKey: string | undefined, fallback: string): string;
47
50
  export declare function screenTitleForPath(pathname: string, screens: Record<string, Screen> | undefined, entities?: Record<string, Entity>): {
@@ -357,6 +360,11 @@ export interface Entity {
357
360
  tenant_key?: string;
358
361
  children?: ChildRelation[];
359
362
  status_groups?: Record<string, StatusGroupDef>;
363
+ /** Computed by the server: this entity's rows are evidence-covered (an
364
+ * `evidence:` block, or an audit table the core audit source covers). Drives
365
+ * the evidence panel / `?expand=evidence` the same way `status_groups` drives
366
+ * the statuses surface. Absent for uncovered entities. */
367
+ evidence_covered?: boolean;
360
368
  properties?: Record<string, PropertyDef>;
361
369
  search_fields?: string[];
362
370
  actions?: Record<string, Action>;
@@ -374,6 +382,10 @@ export interface Entity {
374
382
  * routes a singleton entity's detail screen at the screen's declared
375
383
  * `route:` without a `:id` segment, and skips list-route registration. */
376
384
  singleton?: boolean;
385
+ /** Carrier scope its `$params` writes land under (e.g. my_tenant -> "tenant",
386
+ * profile -> "user"). Absent = writes land under the entity's own code. Used
387
+ * by ParamsBlock to compute the attachable parameter set. */
388
+ params_scope?: string;
377
389
  /** Server-enforced WHERE applied unconditionally on every read/write
378
390
  * via server/handlers/data_prefilter.go. Values may be literal scalars
379
391
  * OR `$caller.*` expressions (`$caller.user_id`, `$caller.tenant_id`)
@@ -756,6 +768,9 @@ export interface HandlerParam {
756
768
  description?: LocalizedString;
757
769
  color?: string;
758
770
  }>;
771
+ /** `type: structure` (or structure-shaped json) param target: the top-level
772
+ * structure code whose fields the dialog renders as a nested form. */
773
+ structure?: string;
759
774
  /** `type: ref` param target. Scalar entity-code string (shorthand) OR a
760
775
  * structured RefConfig (non-id lookup / display). Normalize via
761
776
  * normalizeRefConfig before use. */