@marktiderman/genesis-core 2.16.1 → 2.17.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 (124) hide show
  1. package/README.md +3 -2
  2. package/dist/{aggregate-Y5IJ5aPn.d.ts → aggregate-v_r-nZbH.d.ts} +1 -1
  3. package/dist/{chunk-M5IX7C6U.js → chunk-24X4HWL5.js} +4 -4
  4. package/dist/{chunk-M5IX7C6U.js.map → chunk-24X4HWL5.js.map} +1 -1
  5. package/dist/chunk-2ORQLYVW.js +115 -0
  6. package/dist/chunk-2ORQLYVW.js.map +1 -0
  7. package/dist/{chunk-XPBS5YE4.js → chunk-4POVYF6P.js} +4 -4
  8. package/dist/{chunk-XPBS5YE4.js.map → chunk-4POVYF6P.js.map} +1 -1
  9. package/dist/{chunk-IYGVJFCV.js → chunk-5KLIFJYG.js} +3 -3
  10. package/dist/{chunk-IYGVJFCV.js.map → chunk-5KLIFJYG.js.map} +1 -1
  11. package/dist/{chunk-ALLWIK62.js → chunk-6B4CN2TC.js} +8 -6
  12. package/dist/chunk-6B4CN2TC.js.map +1 -0
  13. package/dist/chunk-6JOWGO2X.js +266 -0
  14. package/dist/chunk-6JOWGO2X.js.map +1 -0
  15. package/dist/{chunk-E3K2A3PK.js → chunk-6SHGMEA6.js} +3 -3
  16. package/dist/{chunk-E3K2A3PK.js.map → chunk-6SHGMEA6.js.map} +1 -1
  17. package/dist/chunk-6VNM6KAX.js +59 -0
  18. package/dist/chunk-6VNM6KAX.js.map +1 -0
  19. package/dist/{chunk-SOO54YYY.js → chunk-AQX5HQD6.js} +3 -3
  20. package/dist/{chunk-SOO54YYY.js.map → chunk-AQX5HQD6.js.map} +1 -1
  21. package/dist/chunk-BNKP2H7J.js +11 -0
  22. package/dist/chunk-BNKP2H7J.js.map +1 -0
  23. package/dist/{chunk-FXPODKCK.js → chunk-FBMKI22S.js} +6 -6
  24. package/dist/{chunk-FXPODKCK.js.map → chunk-FBMKI22S.js.map} +1 -1
  25. package/dist/{chunk-POUI7GAI.js → chunk-JF7FXSQB.js} +5 -5
  26. package/dist/{chunk-POUI7GAI.js.map → chunk-JF7FXSQB.js.map} +1 -1
  27. package/dist/chunk-JNWTHDGF.js +892 -0
  28. package/dist/chunk-JNWTHDGF.js.map +1 -0
  29. package/dist/chunk-K33LWVUF.js +31 -0
  30. package/dist/chunk-K33LWVUF.js.map +1 -0
  31. package/dist/chunk-KRRESUXT.js +192 -0
  32. package/dist/chunk-KRRESUXT.js.map +1 -0
  33. package/dist/{chunk-LB6FMQQM.js → chunk-KV2HW4G4.js} +3 -11
  34. package/dist/chunk-KV2HW4G4.js.map +1 -0
  35. package/dist/{chunk-42NVJJTT.js → chunk-MMMC37AP.js} +3 -3
  36. package/dist/{chunk-42NVJJTT.js.map → chunk-MMMC37AP.js.map} +1 -1
  37. package/dist/chunk-MZVFOTAE.js +96 -0
  38. package/dist/chunk-MZVFOTAE.js.map +1 -0
  39. package/dist/{chunk-R3YXYVWF.js → chunk-OIZNABG4.js} +5 -4
  40. package/dist/chunk-OIZNABG4.js.map +1 -0
  41. package/dist/{chunk-QGWQ6LK3.js → chunk-QJOKZZKY.js} +9 -6
  42. package/dist/chunk-QJOKZZKY.js.map +1 -0
  43. package/dist/chunk-TWLPC4S3.js +53 -0
  44. package/dist/chunk-TWLPC4S3.js.map +1 -0
  45. package/dist/{chunk-7EFTWOMA.js → chunk-UNEZF3ZP.js} +73 -15
  46. package/dist/chunk-UNEZF3ZP.js.map +1 -0
  47. package/dist/chunk-WNOCPV4A.js +220 -0
  48. package/dist/chunk-WNOCPV4A.js.map +1 -0
  49. package/dist/{chunk-ZYOJWU62.js → chunk-XIBQ5BTZ.js} +12 -53
  50. package/dist/chunk-XIBQ5BTZ.js.map +1 -0
  51. package/dist/chunk-YMFJLBIZ.js +159 -0
  52. package/dist/chunk-YMFJLBIZ.js.map +1 -0
  53. package/dist/{chunk-UDSTWXXZ.js → chunk-ZKLB2HB5.js} +3 -3
  54. package/dist/{chunk-UDSTWXXZ.js.map → chunk-ZKLB2HB5.js.map} +1 -1
  55. package/dist/csv.d.ts +12 -3
  56. package/dist/csv.js +4 -4
  57. package/dist/csv.js.map +1 -1
  58. package/dist/form-types.d.ts +1 -1
  59. package/dist/headless/index.d.ts +1 -1
  60. package/dist/hooks/index.d.ts +16 -6
  61. package/dist/hooks/index.js +27 -15
  62. package/dist/hooks/mutation-mode.d.ts +1 -1
  63. package/dist/hooks/mutation-mode.js +3 -3
  64. package/dist/hooks/related-keys.d.ts +1 -1
  65. package/dist/hooks/use-aggregate.d.ts +2 -2
  66. package/dist/hooks/use-aggregate.js +3 -3
  67. package/dist/hooks/use-board-columns.d.ts +79 -0
  68. package/dist/hooks/use-board-columns.js +4 -0
  69. package/dist/hooks/use-board-columns.js.map +1 -0
  70. package/dist/hooks/use-capabilities.d.ts +1 -1
  71. package/dist/hooks/use-capabilities.js +2 -2
  72. package/dist/hooks/use-infinite-resource.d.ts +1 -1
  73. package/dist/hooks/use-infinite-resource.js +3 -3
  74. package/dist/hooks/use-link-options.d.ts +1 -1
  75. package/dist/hooks/use-link-options.js +5 -5
  76. package/dist/hooks/use-list-state.d.ts +103 -0
  77. package/dist/hooks/use-list-state.js +21 -0
  78. package/dist/hooks/use-list-state.js.map +1 -0
  79. package/dist/hooks/use-live.d.ts +1 -1
  80. package/dist/hooks/use-live.js +2 -2
  81. package/dist/hooks/use-one.d.ts +7 -1
  82. package/dist/hooks/use-one.js +3 -3
  83. package/dist/hooks/use-persisted-ui-state.js +2 -2
  84. package/dist/hooks/use-relation-label.d.ts +1 -1
  85. package/dist/hooks/use-relation-label.js +2 -2
  86. package/dist/hooks/use-resource-form.d.ts +1 -1
  87. package/dist/hooks/use-resource-form.js +7 -7
  88. package/dist/hooks/use-resource.d.ts +7 -1
  89. package/dist/hooks/use-resource.js +5 -5
  90. package/dist/hooks/use-segment-counts.d.ts +23 -0
  91. package/dist/hooks/use-segment-counts.js +19 -0
  92. package/dist/hooks/use-segment-counts.js.map +1 -0
  93. package/dist/hooks/use-view-board.d.ts +120 -0
  94. package/dist/hooks/use-view-board.js +29 -0
  95. package/dist/hooks/use-view-board.js.map +1 -0
  96. package/dist/hooks/use-view-calendar-range.d.ts +91 -0
  97. package/dist/hooks/use-view-calendar-range.js +22 -0
  98. package/dist/hooks/use-view-calendar-range.js.map +1 -0
  99. package/dist/hooks/use-write.d.ts +1 -1
  100. package/dist/index.d.ts +41 -11
  101. package/dist/index.js +119 -26
  102. package/dist/index.js.map +1 -1
  103. package/dist/provider/index.d.ts +61 -8
  104. package/dist/provider/index.js +2 -2
  105. package/dist/resource-view/index.d.ts +162 -757
  106. package/dist/resource-view/index.js +31 -686
  107. package/dist/resource-view/index.js.map +1 -1
  108. package/dist/saved-views-C45lRm7i.d.ts +155 -0
  109. package/dist/schema/index.d.ts +3 -3
  110. package/dist/schema/index.js +2 -1
  111. package/dist/testing/index.d.ts +2 -2
  112. package/dist/types-BAhcze_-.d.ts +1063 -0
  113. package/dist/{types-BriIV4e_.d.ts → types-CiQY6hUy.d.ts} +11 -1
  114. package/dist/{viewer-scope-Dx0N9AYk.d.ts → viewer-oOk0ZZk9.d.ts} +36 -34
  115. package/dist/{workspaces-CxpiFu2-.d.ts → workspaces-DeaFix5Z.d.ts} +1 -1
  116. package/dist/workspaces.d.ts +2 -2
  117. package/dist/{write-outcome-CkQXgtJq.d.ts → write-outcome-DuwfsnyO.d.ts} +1 -1
  118. package/package.json +11 -1
  119. package/dist/chunk-7EFTWOMA.js.map +0 -1
  120. package/dist/chunk-ALLWIK62.js.map +0 -1
  121. package/dist/chunk-LB6FMQQM.js.map +0 -1
  122. package/dist/chunk-QGWQ6LK3.js.map +0 -1
  123. package/dist/chunk-R3YXYVWF.js.map +0 -1
  124. package/dist/chunk-ZYOJWU62.js.map +0 -1
@@ -0,0 +1,155 @@
1
+ import { S as StorageAdapter } from './types-DKcxHXxq.js';
2
+ import { b as ViewFilterValue, c as ViewFilterKind, d as ResolvedFilter, S as SegmentWhere } from './types-BAhcze_-.js';
3
+ import { a as FilterParam } from './types-CiQY6hUy.js';
4
+
5
+ /** A segment's `where` as provider filters. A range keeps only the ends it has. */
6
+ declare function whereParams(where: SegmentWhere | null | undefined): FilterParam[];
7
+ /** Whether a filter value narrows anything (an empty choice or range doesn't). @stability Beta */
8
+ declare function isFilterSet(value: ViewFilterValue | undefined | null): boolean;
9
+ /**
10
+ * A stored filter value in the shape its filter takes (a choice's list of strings, a range's ends,
11
+ * a text), or undefined when it isn't: a saved view from a server or edited by hand can't break a list.
12
+ *
13
+ * @stability Beta
14
+ */
15
+ declare function filterValueFor(filter: Pick<ResolvedFilter, "kind">, value: unknown): ViewFilterValue | undefined;
16
+ /**
17
+ * Everything a person can change about a list, as plain data: what a saved view stores and what
18
+ * the URL keeps (ADR 0017 §4).
19
+ *
20
+ * @stability Beta
21
+ */
22
+ interface ListState {
23
+ /** The segment's id. */
24
+ segment?: string;
25
+ /** Declared filters' values, by field. */
26
+ filters?: Readonly<Record<string, ViewFilterValue>>;
27
+ search?: string;
28
+ sort?: {
29
+ readonly field: string;
30
+ readonly order: "asc" | "desc";
31
+ };
32
+ /** A column preset. */
33
+ columns?: string;
34
+ /** The view type (`table`, `board`, a registered one). */
35
+ type?: string;
36
+ /** The field rows are grouped by, or `null` for none (over the view's own `groupBy`). */
37
+ groupBy?: string | null;
38
+ }
39
+ /** The URL keys a list's state uses beside `q`, `sort`, `page` and `id`. @stability Beta */
40
+ declare const LIST_URL_KEYS: Readonly<{
41
+ segment: "seg";
42
+ filterPrefix: "f.";
43
+ }>;
44
+ /** A filter value as one URL parameter: choices joined by commas, a range as `from..to`, text as is. */
45
+ declare function encodeFilterValue(value: ViewFilterValue): string;
46
+ /** One URL parameter as a declared filter's value, by its kind; undefined when it doesn't parse. */
47
+ declare function decodeFilterValue(kind: ViewFilterKind, raw: string): ViewFilterValue | undefined;
48
+ /**
49
+ * A list's segment and declared filters from URL parameters. Only declared filters and defined
50
+ * segments are read; anything else is ignored.
51
+ *
52
+ * @stability Beta
53
+ */
54
+ declare function readListUrl(view: {
55
+ filters(): readonly ResolvedFilter[];
56
+ segments(): readonly {
57
+ id: string;
58
+ }[];
59
+ }, get: (key: string) => string | null | undefined): Pick<ListState, "segment" | "filters">;
60
+ /**
61
+ * The URL parameters a list's segment and declared filters set, `null` for each to remove: pass
62
+ * them to a router adapter's `setSearchParams`.
63
+ *
64
+ * @stability Beta
65
+ */
66
+ declare function listUrlParams(view: {
67
+ filters(): readonly ResolvedFilter[];
68
+ segments(): readonly {
69
+ id: string;
70
+ }[];
71
+ }, state: Pick<ListState, "segment" | "filters">, defaultSegment?: string): Record<string, string | null>;
72
+ /** A value's words for a filter chip: its label, or the value in title case. */
73
+ declare function filterOptionLabel(filter: ResolvedFilter, value: string): string;
74
+
75
+ /**
76
+ * One saved view: a name, who it's for, and the list state it restores, stamped with the view's
77
+ * `version` when it was saved.
78
+ *
79
+ * @stability Beta
80
+ */
81
+ interface SavedView {
82
+ readonly id: string;
83
+ readonly name: string;
84
+ /** `personal` (the person's own) or `team` (shared, as the app's store decides). */
85
+ readonly scope: "personal" | "team";
86
+ /** The view's resource. */
87
+ readonly resource: string;
88
+ /** The view's `version` when it was saved (1 when the view has none). */
89
+ readonly version: number;
90
+ readonly state: ListState;
91
+ }
92
+ /** A saved view to store: the store gives it its id. @stability Beta */
93
+ type SavedViewInput = Omit<SavedView, "id"> & {
94
+ readonly id?: string;
95
+ };
96
+ /**
97
+ * Where saved views live (ADR 0017 §4). Passed once to genesis-ui's `ResourceViewDefaultsProvider`
98
+ * (`savedViews`). Every method may be async. `readCurrent` and `writeCurrent`, when the store has
99
+ * them, keep each person's current choices for a list (its view type, say), so they follow the
100
+ * person the way saved views do.
101
+ *
102
+ * A store returns only the views the signed-in person may see: a server store scopes its rows to
103
+ * the viewer (row-level security on the app's table: their own personal views, and team views of
104
+ * their team). A store kept on a device that several people sign in to has `forViewer`, and lists
105
+ * call it with the viewer's id, so one person never sees another's views.
106
+ *
107
+ * @stability Beta
108
+ */
109
+ interface SavedViewStore {
110
+ list(resource: string): readonly SavedView[] | Promise<readonly SavedView[]>;
111
+ save(view: SavedViewInput): SavedView | Promise<SavedView>;
112
+ remove(id: string, resource: string): void | Promise<void>;
113
+ /** Which scopes this store can save to. Default `["personal"]`. */
114
+ readonly scopes?: readonly ("personal" | "team")[];
115
+ /** The person's current state for a list (its key: the resource, or a screen's own key). */
116
+ readCurrent?(key: string): ListState | null | undefined | Promise<ListState | null | undefined>;
117
+ writeCurrent?(key: string, state: ListState): void | Promise<void>;
118
+ /** The store for one viewer (their id, or null signed out), for a store kept on a shared device. */
119
+ forViewer?(viewer: string | null): SavedViewStore;
120
+ }
121
+ /**
122
+ * The default saved-view store: this device only, personal views, under `<prefix>:<resource>`
123
+ * in the browser's localStorage (or the storage you pass, such as a phone's adapter). Without
124
+ * storage it keeps views in memory for the page's life. Lists use `forViewer(id)`, which keeps
125
+ * each person's views under `<prefix>:<viewer>:…`, so whoever signs in next on the device sees
126
+ * only their own.
127
+ *
128
+ * ```ts
129
+ * <ResourceViewDefaultsProvider savedViews={createLocalSavedViewStore()} />
130
+ * ```
131
+ *
132
+ * @stability Beta
133
+ */
134
+ declare function createLocalSavedViewStore(options?: {
135
+ storage?: StorageAdapter;
136
+ prefix?: string;
137
+ }): SavedViewStore;
138
+ /**
139
+ * The part of a stored list state that still applies to a view: a segment it still has, filters
140
+ * it still declares, a column preset and view type it still offers, a field it can still group by.
141
+ * A saved view from an older `version` is offered as far as it applies, never refused whole.
142
+ *
143
+ * @stability Beta
144
+ */
145
+ declare function applicableListState(view: {
146
+ filters(): readonly ResolvedFilter[];
147
+ segments(): readonly {
148
+ id: string;
149
+ }[];
150
+ presets: readonly string[];
151
+ types(): readonly string[];
152
+ field(name: string): unknown;
153
+ }, state: ListState | null | undefined): ListState;
154
+
155
+ export { type ListState as L, type SavedViewStore as S, LIST_URL_KEYS as a, type SavedView as b, type SavedViewInput as c, applicableListState as d, createLocalSavedViewStore as e, decodeFilterValue as f, encodeFilterValue as g, filterOptionLabel as h, filterValueFor as i, isFilterSet as j, listUrlParams as l, readListUrl as r, whereParams as w };
@@ -1,6 +1,6 @@
1
- import { M as ResourceContract, d as Identifier, j as DataRow } from '../types-BriIV4e_.js';
2
- export { h as AuditEntry, C as ControlHint, s as FieldPermissions, e as FieldReference, F as FieldSchema, u as FilterOperator, P as ProviderCapabilities, J as RecordComment, K as ResourceAccess, O as ResourceRelation, Q as ResourceSchema, T as ResourceSummary, U as RowAction, X as RowOf, _ as StorageType, a1 as VersionField, a2 as WidgetHint, a3 as defineResource, a4 as fieldControl } from '../types-BriIV4e_.js';
3
- export { D as DataWriteError, a as DataWriteErrorOptions, N as NO_ROWS_MATCHED, W as WriteOutcome, i as isDataWriteError } from '../write-outcome-CkQXgtJq.js';
1
+ import { R as ResourceContract, c as Identifier, e as DataRow } from '../types-CiQY6hUy.js';
2
+ export { j as AuditEntry, C as ControlHint, v as FieldPermissions, f as FieldReference, F as FieldSchema, x as FilterOperator, P as ProviderCapabilities, O as RecordComment, Q as ResourceAccess, T as ResourceRelation, U as ResourceSchema, V as ResourceSummary, m as RowAction, l as RowOf, _ as StorageType, a1 as VersionField, a2 as WidgetHint, a3 as defineResource, a4 as fieldControl } from '../types-CiQY6hUy.js';
3
+ export { D as DataWriteError, a as DataWriteErrorOptions, N as NO_ROWS_MATCHED, W as WriteOutcome, i as isDataWriteError } from '../write-outcome-DuwfsnyO.js';
4
4
  export { W as WriteConflict, a as WriteConflictOptions, b as WriteState, w as writeConflict } from '../write-state-DVC4Yq9T.js';
5
5
  export { D as DataReadError, a as DataReadErrorOptions, R as ReadOutcome, i as isDataReadError, r as readFailureMessage } from '../read-outcome-BnboMYOV.js';
6
6
 
@@ -1,4 +1,5 @@
1
- export { decodeRecordKey, defineResource, encodeRecordKey, fieldControl, keyFields } from '../chunk-LB6FMQQM.js';
1
+ export { defineResource, fieldControl } from '../chunk-BNKP2H7J.js';
2
+ export { decodeRecordKey, encodeRecordKey, keyFields } from '../chunk-KV2HW4G4.js';
2
3
  export { writeConflict } from '../chunk-LKRJB632.js';
3
4
  export { DataReadError, isDataReadError, readFailureMessage } from '../chunk-HUNGCTRA.js';
4
5
  export { DataWriteError, NO_ROWS_MATCHED, isDataWriteError } from '../chunk-WLDSIQJ2.js';
@@ -1,5 +1,5 @@
1
- import { D as DataProvider, d as Identifier } from '../types-BriIV4e_.js';
2
- import { D as DataWriteError } from '../write-outcome-CkQXgtJq.js';
1
+ import { D as DataProvider, c as Identifier } from '../types-CiQY6hUy.js';
2
+ import { D as DataWriteError } from '../write-outcome-DuwfsnyO.js';
3
3
 
4
4
  /** The shared fixture logins, the same ids `genesis_testing.user_id()` uses. */
5
5
  declare const FIXTURE_USERS: {