@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,103 @@
1
+ import { a as FilterParam, R as ResourceContract } from '../types-CiQY6hUy.js';
2
+ import { b as ViewFilterValue, R as ResourceView } from '../types-BAhcze_-.js';
3
+ import { L as ListState, S as SavedViewStore } from '../saved-views-C45lRm7i.js';
4
+ import '../status-BXRokZD9.js';
5
+ import '../viewer-oOk0ZZk9.js';
6
+ import 'react';
7
+ import '@tanstack/react-query';
8
+ import '../dates.js';
9
+ import '../gallery/index.js';
10
+ import '../types-DKcxHXxq.js';
11
+
12
+ /**
13
+ * Where a list keeps its state in the address: a router's search params (the web's
14
+ * `SearchParamsAdapter` has this shape). A phone list passes none.
15
+ *
16
+ * @stability Beta
17
+ */
18
+ interface ListUrlAdapter {
19
+ readonly searchParams: URLSearchParams;
20
+ setSearchParams(next: URLSearchParams, options?: {
21
+ replace?: boolean;
22
+ }): void;
23
+ }
24
+ /** A list's sort, as a list reports it. @stability Beta */
25
+ interface ListSort {
26
+ readonly field: string;
27
+ readonly order: "asc" | "desc";
28
+ }
29
+ /** @stability Beta */
30
+ interface UseListStateOptions {
31
+ view: ResourceView<ResourceContract<any>, any>;
32
+ /** Where the URL lives (a page list, once the app registers its adapter). */
33
+ url?: ListUrlAdapter | undefined;
34
+ /** Where the person's current choices are kept: the app's saved-view store. */
35
+ store?: SavedViewStore | undefined;
36
+ /** The key for the person's current choices (the resource, or the screen's key). */
37
+ currentKey?: string | undefined;
38
+ defaultSegment?: string | undefined;
39
+ /** The type the screen opens on, when it names one. */
40
+ defaultType?: string | undefined;
41
+ /** The types a person may switch between; a stored choice must be one. */
42
+ types?: readonly string[] | undefined;
43
+ /** Remember the person's type. Off when the screen fixes the type. */
44
+ rememberType?: boolean | undefined;
45
+ /** How long a text filter waits after the last keystroke before the list asks again. Default 300 ms. */
46
+ textDelayMs?: number | undefined;
47
+ }
48
+ /** @stability Beta */
49
+ interface ListStateResult {
50
+ segment: string | undefined;
51
+ setSegment: (id: string) => void;
52
+ /** The declared filters' values as the person set them (a text filter's as typed). */
53
+ values: Readonly<Record<string, ViewFilterValue>>;
54
+ setValue: (field: string, value: ViewFilterValue | undefined) => void;
55
+ /** The segment and every filter back to their defaults. */
56
+ clear: () => void;
57
+ /** Something narrows the list beyond the default segment. */
58
+ active: boolean;
59
+ type: string | undefined;
60
+ setType: (type: string) => void;
61
+ groupBy: string | null | undefined;
62
+ setGroupBy: (field: string | null) => void;
63
+ /** Apply a saved view's state: its segment, filters, search, sort, columns, type and grouping. */
64
+ apply: (state: ListState) => void;
65
+ /** A column preset a saved view chose, over the screen's default. */
66
+ columns: string | undefined;
67
+ /** Search and sort a saved view restored: a list starts again (`nonce` changes) with these. */
68
+ restore: {
69
+ readonly nonce: number;
70
+ readonly search: string;
71
+ readonly sort: ListSort | null;
72
+ };
73
+ /** The list's own search and sort as it reports them, for saving. */
74
+ observeQuery: (query: {
75
+ search: string;
76
+ sort: ListSort | null;
77
+ }) => void;
78
+ /** The last search and sort the list reported. */
79
+ query: () => {
80
+ search: string;
81
+ sort: ListSort | null;
82
+ };
83
+ /** The declared filters' provider filters, on the viewer's clock (what segment counts add to). */
84
+ valueFilters: FilterParam[];
85
+ /** The provider filters the segment and declared filters make. */
86
+ filters: FilterParam[];
87
+ /** The store this viewer's choices and saved views live in (`forViewer` on a shared device). */
88
+ store: SavedViewStore | undefined;
89
+ /** Everything the person set, as a saved view stores it (`columns`: the preset shown, when not the default). */
90
+ snapshot: (columns?: string) => ListState;
91
+ }
92
+ /**
93
+ * A list's state, held for one list (ADR 0017): from the URL when it has one, and the person's
94
+ * store. The URL follows each change (replacing the entry: a filter isn't a page) and the state
95
+ * follows the URL back (Back, Forward, a link to the same page with other filters). A text filter
96
+ * reaches the query after a pause. Nothing is read from storage while rendering, so a server
97
+ * render and the first client render agree; the stored view type arrives in an effect.
98
+ *
99
+ * @stability Beta
100
+ */
101
+ declare function useListState(options: UseListStateOptions): ListStateResult;
102
+
103
+ export { type ListSort, type ListStateResult, type ListUrlAdapter, type UseListStateOptions, useListState };
@@ -0,0 +1,21 @@
1
+ export { useListState } from '../chunk-WNOCPV4A.js';
2
+ import '../chunk-MZVFOTAE.js';
3
+ import '../chunk-6JOWGO2X.js';
4
+ import '../chunk-XIBQ5BTZ.js';
5
+ import '../chunk-OZYF55E3.js';
6
+ import '../chunk-AQX5HQD6.js';
7
+ import '../chunk-MMMC37AP.js';
8
+ import '../chunk-AJGVLF37.js';
9
+ import '../chunk-2IGAUXYH.js';
10
+ import '../chunk-OIZNABG4.js';
11
+ import '../chunk-J54XXKQD.js';
12
+ import '../chunk-4PTQYT5J.js';
13
+ import '../chunk-5ASUMG6K.js';
14
+ import '../chunk-AUVKRXRC.js';
15
+ import '../chunk-WXENWPWP.js';
16
+ import '../chunk-NOPS5EIH.js';
17
+ import '../chunk-HUNGCTRA.js';
18
+ import '../chunk-RYEXWQFD.js';
19
+ import '../chunk-WLDSIQJ2.js';
20
+ //# sourceMappingURL=use-list-state.js.map
21
+ //# sourceMappingURL=use-list-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"use-list-state.js"}
@@ -1,5 +1,5 @@
1
1
  import { QueryKey } from '@tanstack/react-query';
2
- import { f as SubscribeParams, g as ResourceChangeEvent } from '../types-BriIV4e_.js';
2
+ import { g as SubscribeParams, h as ResourceChangeEvent } from '../types-CiQY6hUy.js';
3
3
 
4
4
  /** How long a burst of change events is gathered into one refetch. */
5
5
  declare const DEFAULT_LIVE_DEBOUNCE_MS = 250;
@@ -1,5 +1,5 @@
1
- export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS, useLiveInvalidation } from '../chunk-E3K2A3PK.js';
2
- import '../chunk-R3YXYVWF.js';
1
+ export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS, useLiveInvalidation } from '../chunk-6SHGMEA6.js';
2
+ import '../chunk-OIZNABG4.js';
3
3
  import '../chunk-J54XXKQD.js';
4
4
  import '../chunk-4PTQYT5J.js';
5
5
  import '../chunk-AUVKRXRC.js';
@@ -1,5 +1,5 @@
1
1
  import { UseQueryResult } from '@tanstack/react-query';
2
- import { B as BaseRecord, d as Identifier } from '../types-BriIV4e_.js';
2
+ import { a as FilterParam, B as BaseRecord, c as Identifier } from '../types-CiQY6hUy.js';
3
3
  import { LiveOptions } from './use-live.js';
4
4
 
5
5
  interface UseOneOptions {
@@ -13,6 +13,12 @@ interface UseOneOptions {
13
13
  * `UseResourceOptions.live`. Off by default.
14
14
  */
15
15
  live?: boolean | LiveOptions;
16
+ /**
17
+ * The list's filters, when the record is opened from a list (`GetOneParams.scope`): a resource
18
+ * read from a function takes its scope from them. Text searches (`contains`) are left out; the
19
+ * rest are kept, and they're part of the cache key when there are any.
20
+ */
21
+ scope?: FilterParam[] | undefined;
16
22
  }
17
23
  /**
18
24
  * Fetch a single record by id, powered by TanStack Query.
@@ -1,7 +1,7 @@
1
- export { useOne } from '../chunk-QGWQ6LK3.js';
2
- import '../chunk-E3K2A3PK.js';
1
+ export { useOne } from '../chunk-QJOKZZKY.js';
2
+ import '../chunk-6SHGMEA6.js';
3
3
  import '../chunk-2IGAUXYH.js';
4
- import '../chunk-R3YXYVWF.js';
4
+ import '../chunk-OIZNABG4.js';
5
5
  import '../chunk-J54XXKQD.js';
6
6
  import '../chunk-4PTQYT5J.js';
7
7
  import '../chunk-AUVKRXRC.js';
@@ -1,5 +1,5 @@
1
- export { usePersistedUiState } from '../chunk-IYGVJFCV.js';
2
- import '../chunk-R3YXYVWF.js';
1
+ export { usePersistedUiState } from '../chunk-5KLIFJYG.js';
2
+ import '../chunk-OIZNABG4.js';
3
3
  import '../chunk-J54XXKQD.js';
4
4
  import '../chunk-4PTQYT5J.js';
5
5
  import '../chunk-HUNGCTRA.js';
@@ -1,4 +1,4 @@
1
- import { D as DataProvider, e as FieldReference, d as Identifier } from '../types-BriIV4e_.js';
1
+ import { D as DataProvider, f as FieldReference, c as Identifier } from '../types-CiQY6hUy.js';
2
2
 
3
3
  interface UseRelationLabelOptions {
4
4
  /** The linked row's field that names it. Default: the linked resource's `labelField` (`describe`). */
@@ -1,5 +1,5 @@
1
- export { loadRelationLabel, relationNamingField, useRelationLabel } from '../chunk-UDSTWXXZ.js';
2
- import '../chunk-R3YXYVWF.js';
1
+ export { loadRelationLabel, relationNamingField, useRelationLabel } from '../chunk-ZKLB2HB5.js';
2
+ import '../chunk-OIZNABG4.js';
3
3
  import '../chunk-J54XXKQD.js';
4
4
  import '../chunk-4PTQYT5J.js';
5
5
  import '../chunk-HUNGCTRA.js';
@@ -1,5 +1,5 @@
1
1
  import { UseFormReturn } from 'react-hook-form';
2
- import { R as ResourceFormFieldDef, I as InvalidationKey } from '../types-BriIV4e_.js';
2
+ import { i as ResourceFormFieldDef, I as InvalidationKey } from '../types-CiQY6hUy.js';
3
3
  import { W as WriteConflict } from '../write-state-DVC4Yq9T.js';
4
4
  import { MutationModeOptions } from './mutation-mode.js';
5
5
  import '@tanstack/react-query';
@@ -1,14 +1,14 @@
1
- export { blankValues, buildArrayItemDefaults, useResourceForm } from '../chunk-FXPODKCK.js';
2
- import '../chunk-LKRJB632.js';
3
- import '../chunk-QGWQ6LK3.js';
1
+ export { blankValues, buildArrayItemDefaults, useResourceForm } from '../chunk-FBMKI22S.js';
4
2
  import '../chunk-RVWKVD5Q.js';
5
- import '../chunk-SOO54YYY.js';
3
+ import '../chunk-LKRJB632.js';
4
+ import '../chunk-QJOKZZKY.js';
5
+ import '../chunk-AQX5HQD6.js';
6
6
  import '../chunk-7NUL32W7.js';
7
- import '../chunk-42NVJJTT.js';
7
+ import '../chunk-MMMC37AP.js';
8
8
  import '../chunk-AJGVLF37.js';
9
- import '../chunk-E3K2A3PK.js';
9
+ import '../chunk-6SHGMEA6.js';
10
10
  import '../chunk-2IGAUXYH.js';
11
- import '../chunk-R3YXYVWF.js';
11
+ import '../chunk-OIZNABG4.js';
12
12
  import '../chunk-J54XXKQD.js';
13
13
  import '../chunk-4PTQYT5J.js';
14
14
  import '../chunk-AUVKRXRC.js';
@@ -1,10 +1,16 @@
1
1
  import { UseQueryResult, UseMutationResult } from '@tanstack/react-query';
2
- import { S as SortParam, a as FilterParam, I as InvalidationKey, L as ListResult, c as ListParams, d as Identifier, B as BaseRecord } from '../types-BriIV4e_.js';
2
+ import { S as SortParam, a as FilterParam, I as InvalidationKey, L as ListResult, b as ListParams, c as Identifier, B as BaseRecord } from '../types-CiQY6hUy.js';
3
3
  import { MutationModeOptions } from './mutation-mode.js';
4
4
  import { LiveOptions } from './use-live.js';
5
5
 
6
6
  interface UseResourceOptions<T> extends MutationModeOptions {
7
7
  defaultSort?: SortParam;
8
+ /**
9
+ * A second sort under the list's own (`sorts: [sort, thenSort]`), skipped when both name one
10
+ * field: a list grouped by a field keeps its order inside each group. Applies on a provider
11
+ * whose capabilities report `multiSort`.
12
+ */
13
+ thenSort?: SortParam;
8
14
  /**
9
15
  * Re-synced whenever its value changes (deep-equal, order-independent),
10
16
  * not just its identity — safe to pass a scope/audience-derived array that
@@ -1,11 +1,11 @@
1
- export { useResource } from '../chunk-ALLWIK62.js';
2
- import '../chunk-SOO54YYY.js';
1
+ export { useResource } from '../chunk-6B4CN2TC.js';
2
+ import '../chunk-AQX5HQD6.js';
3
3
  import '../chunk-7NUL32W7.js';
4
- import '../chunk-42NVJJTT.js';
4
+ import '../chunk-MMMC37AP.js';
5
5
  import '../chunk-AJGVLF37.js';
6
- import '../chunk-E3K2A3PK.js';
6
+ import '../chunk-6SHGMEA6.js';
7
7
  import '../chunk-2IGAUXYH.js';
8
- import '../chunk-R3YXYVWF.js';
8
+ import '../chunk-OIZNABG4.js';
9
9
  import '../chunk-J54XXKQD.js';
10
10
  import '../chunk-4PTQYT5J.js';
11
11
  import '../chunk-AUVKRXRC.js';
@@ -0,0 +1,23 @@
1
+ import { R as ResourceContract, a as FilterParam } from '../types-CiQY6hUy.js';
2
+ import { R as ResourceView } from '../types-BAhcze_-.js';
3
+ import '../status-BXRokZD9.js';
4
+ import '../viewer-oOk0ZZk9.js';
5
+ import 'react';
6
+ import '@tanstack/react-query';
7
+ import '../dates.js';
8
+ import '../gallery/index.js';
9
+
10
+ /**
11
+ * Each segment's row count for a view's list (ADR 0017), for the segments that ask for one
12
+ * (`count: true`): the list's other filters (scope, the screen's, the declared filters) plus the
13
+ * segment's own, counted through the provider (estimated). A segment without a count, or one not
14
+ * counted yet, maps to undefined. The web's segment strip, the inbox rail and the phone's segment
15
+ * chips all read it.
16
+ *
17
+ * @stability Beta
18
+ */
19
+ declare function useSegmentCounts(view: ResourceView<ResourceContract<any>, any>, baseFilters: readonly FilterParam[], options?: {
20
+ enabled?: boolean;
21
+ }): Readonly<Record<string, number | undefined>>;
22
+
23
+ export { useSegmentCounts };
@@ -0,0 +1,19 @@
1
+ export { useSegmentCounts } from '../chunk-K33LWVUF.js';
2
+ import '../chunk-XIBQ5BTZ.js';
3
+ import '../chunk-OZYF55E3.js';
4
+ import '../chunk-AQX5HQD6.js';
5
+ import '../chunk-MMMC37AP.js';
6
+ import '../chunk-AJGVLF37.js';
7
+ import '../chunk-2IGAUXYH.js';
8
+ import '../chunk-OIZNABG4.js';
9
+ import '../chunk-J54XXKQD.js';
10
+ import '../chunk-4PTQYT5J.js';
11
+ import '../chunk-5ASUMG6K.js';
12
+ import '../chunk-AUVKRXRC.js';
13
+ import '../chunk-WXENWPWP.js';
14
+ import '../chunk-NOPS5EIH.js';
15
+ import '../chunk-HUNGCTRA.js';
16
+ import '../chunk-RYEXWQFD.js';
17
+ import '../chunk-WLDSIQJ2.js';
18
+ //# sourceMappingURL=use-segment-counts.js.map
19
+ //# sourceMappingURL=use-segment-counts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"use-segment-counts.js"}
@@ -0,0 +1,120 @@
1
+ import { a as FilterParam, B as BaseRecord, R as ResourceContract, e as DataRow } from '../types-CiQY6hUy.js';
2
+ import { W as WriteConflict } from '../write-state-DVC4Yq9T.js';
3
+ import { V as ViewBoard, a as ViewTone, R as ResourceView } from '../types-BAhcze_-.js';
4
+ import { LiveOptions } from './use-live.js';
5
+ import { UseResourceOptions } from './use-resource.js';
6
+ import '../status-BXRokZD9.js';
7
+ import '../viewer-oOk0ZZk9.js';
8
+ import 'react';
9
+ import '@tanstack/react-query';
10
+ import '../dates.js';
11
+ import '../gallery/index.js';
12
+ import './mutation-mode.js';
13
+
14
+ type Row = Record<string, unknown>;
15
+ /** @stability Beta */
16
+ interface UseViewBoardOptions<T extends Row = Row> extends Partial<ViewBoard> {
17
+ /** Server filters (the view's scope and the screen's), already as params. */
18
+ filters?: readonly FilterParam[] | undefined;
19
+ select?: string | undefined;
20
+ /** False while the screen waits: nothing is fetched. Default true. */
21
+ enabled?: boolean | undefined;
22
+ live?: boolean | LiveOptions | undefined;
23
+ /** Cards per column page. Default 50. */
24
+ perPage?: number | undefined;
25
+ /** The screen's own guard: it only narrows the view's. A card moves only when both allow `edit`. */
26
+ can?: ((action: "create" | "edit" | "delete", item?: T) => boolean) | undefined;
27
+ /** `invalidates`, `onError` and `onUpdateSuccess` apply to a move. A move is always pessimistic. */
28
+ resourceOptions?: Pick<UseResourceOptions<T & BaseRecord>, "invalidates" | "onError" | "onUpdateSuccess"> | undefined;
29
+ /** A move was refused. Without it, the reason is in `refusal` (and a conflict in `conflict`). */
30
+ onMoveError?: ((error: unknown, row: T) => void) | undefined;
31
+ /** The board's words, in the app's language. Default English. */
32
+ words?: Partial<ViewBoardWords> | undefined;
33
+ /** A conflict that came back after the board was gone (a route change mid-save): tell the person. Default nothing. */
34
+ onLostConflict?: ((error: unknown) => void) | undefined;
35
+ }
36
+ /** What a board says, for each platform's message catalogue. @stability Beta */
37
+ interface ViewBoardWords {
38
+ /** The screen's `can` refuses the move. */
39
+ notAllowed: string;
40
+ /** The column for rows with no value. */
41
+ noValue: string;
42
+ /** A card whose last move is still saving. */
43
+ stillSaving: (name: string) => string;
44
+ /** The move matched no row (it changed or went away). */
45
+ notChanged: (noun: string) => string;
46
+ /** The move failed with no words of its own. */
47
+ moveFailed: (name: string) => string;
48
+ }
49
+ /** One column: its value, its words, its tone and its cards so far. @stability Beta */
50
+ interface ViewBoardColumn<T extends Row = Row> {
51
+ /** A value of the board's field, or `BOARD_NONE` for rows with none. */
52
+ value: string;
53
+ label: string;
54
+ /** The field's tone for this value (`fields.<field>.tones`). */
55
+ tone?: ViewTone;
56
+ items: T[];
57
+ /** Cards in the column in all, once counted. */
58
+ total?: number;
59
+ hasMore: boolean;
60
+ loading: boolean;
61
+ /** The column's work-in-progress limit (`board.limits`). */
62
+ limit?: number;
63
+ }
64
+ /** A move that met someone else's change, for ConflictSheet. @stability Beta */
65
+ interface ViewBoardConflict {
66
+ conflict: WriteConflict;
67
+ id: string;
68
+ data: Record<string, unknown>;
69
+ }
70
+ /** @stability Beta */
71
+ interface ViewBoardState<T extends Row = Row> {
72
+ /** The board block in use: the screen's over the view's. */
73
+ block: ViewBoard;
74
+ /** The board's field. */
75
+ field: string;
76
+ columns: ViewBoardColumn<T>[];
77
+ loadMore: (value: string) => void;
78
+ /** Some column is still on its first load. */
79
+ loading: boolean;
80
+ error: unknown;
81
+ /** A filter on the board's own field was set aside (each column has its own). */
82
+ ownFilterSetAside: boolean;
83
+ /** The view can write the field on edit, so cards can move at all. */
84
+ movable: boolean;
85
+ /** Whether this card may move: `true`, or the reason. */
86
+ canMove: (row: T) => true | string;
87
+ /** Move a card to a column's value. Rejects when refused; the card stays where it was. */
88
+ move: (row: T, to: string) => Promise<void>;
89
+ /** Keys of cards whose move is saving. */
90
+ saving: ReadonlySet<string>;
91
+ /** Why the last move was refused, in words (when there's no `onMoveError`). */
92
+ refusal: string | null;
93
+ clearRefusal: () => void;
94
+ /** A move that met someone else's change, until kept or dropped. */
95
+ conflict: ViewBoardConflict | null;
96
+ /** Keep my move, checked against their version. */
97
+ keepMine: () => Promise<void>;
98
+ /** Take theirs: the card goes where their row puts it. */
99
+ takeTheirs: () => void;
100
+ /** Refetch every column. */
101
+ refresh: () => Promise<void>;
102
+ keyOf: (row: T) => string;
103
+ titleOf: (row: T) => string;
104
+ }
105
+ /**
106
+ * A view's rows as board columns, with moves:
107
+ *
108
+ * ```tsx
109
+ * const board = useViewBoard(tasksView, { filters: useViewListParams({ view: tasksView }).filters });
110
+ * board.columns.map((c) => <Lane key={c.value} title={c.label} cards={c.items} onDrop={(row) => board.move(row, c.value)} />);
111
+ * ```
112
+ *
113
+ * Throws when the view has no board field and the options name none, or names one a board can't
114
+ * use (a field without choices).
115
+ *
116
+ * @stability Beta
117
+ */
118
+ declare function useViewBoard<T extends Row = Row>(view: ResourceView<ResourceContract<any>, T & DataRow>, options?: UseViewBoardOptions<T>): ViewBoardState<T>;
119
+
120
+ export { type UseViewBoardOptions, type ViewBoardColumn, type ViewBoardConflict, type ViewBoardState, type ViewBoardWords, useViewBoard };
@@ -0,0 +1,29 @@
1
+ export { useViewBoard } from '../chunk-KRRESUXT.js';
2
+ import '../chunk-JNWTHDGF.js';
3
+ import '../chunk-BNKP2H7J.js';
4
+ import '../chunk-YMFJLBIZ.js';
5
+ import '../chunk-KV2HW4G4.js';
6
+ import '../chunk-6JOWGO2X.js';
7
+ import '../chunk-XIBQ5BTZ.js';
8
+ import '../chunk-OZYF55E3.js';
9
+ import '../chunk-LKRJB632.js';
10
+ import '../chunk-6B4CN2TC.js';
11
+ import '../chunk-AQX5HQD6.js';
12
+ import '../chunk-7NUL32W7.js';
13
+ import '../chunk-6VNM6KAX.js';
14
+ import '../chunk-MMMC37AP.js';
15
+ import '../chunk-AJGVLF37.js';
16
+ import '../chunk-6SHGMEA6.js';
17
+ import '../chunk-2IGAUXYH.js';
18
+ import '../chunk-OIZNABG4.js';
19
+ import '../chunk-J54XXKQD.js';
20
+ import '../chunk-4PTQYT5J.js';
21
+ import '../chunk-5ASUMG6K.js';
22
+ import '../chunk-AUVKRXRC.js';
23
+ import '../chunk-WXENWPWP.js';
24
+ import '../chunk-NOPS5EIH.js';
25
+ import '../chunk-HUNGCTRA.js';
26
+ import '../chunk-RYEXWQFD.js';
27
+ import '../chunk-WLDSIQJ2.js';
28
+ //# sourceMappingURL=use-view-board.js.map
29
+ //# sourceMappingURL=use-view-board.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"use-view-board.js"}
@@ -0,0 +1,91 @@
1
+ import { a as FilterParam, R as ResourceContract, e as DataRow } from '../types-CiQY6hUy.js';
2
+ import { Day } from '../dates.js';
3
+ import { R as ResourceView } from '../types-BAhcze_-.js';
4
+ import { LiveOptions } from './use-live.js';
5
+ import '../status-BXRokZD9.js';
6
+ import '../viewer-oOk0ZZk9.js';
7
+ import 'react';
8
+ import '@tanstack/react-query';
9
+ import '../gallery/index.js';
10
+
11
+ type Row = Record<string, unknown>;
12
+ /**
13
+ * Most rows one request loads (a calendar with an `endField` makes two, so up to twice this).
14
+ * A month grid is six weeks: 500 is about a dozen a day, more than a
15
+ * busy shared calendar holds, and still one quick request. Past it the calendar says how many it
16
+ * left out ("+N more") rather than dropping them silently.
17
+ */
18
+ declare const CALENDAR_LIMIT = 500;
19
+ /** The days a calendar shows: `start` inclusive, `end` exclusive, as `calendarWindow` gives them. @stability Beta */
20
+ interface ViewCalendarRange {
21
+ start: Day;
22
+ end: Day;
23
+ }
24
+ /** @stability Beta */
25
+ interface UseViewCalendarRangeOptions {
26
+ /** The date or timestamp field. Default the view's `calendar.field`. */
27
+ field?: string | undefined;
28
+ /** Default the view's `calendar.endField`. */
29
+ endField?: string | undefined;
30
+ /** Default the view's `calendar.allDayField`. */
31
+ allDayField?: string | undefined;
32
+ /** Server filters (the scope's and the screen's), already as params (`useViewListParams().filters`). */
33
+ filters?: readonly FilterParam[] | undefined;
34
+ select?: string | undefined;
35
+ /** False while the screen waits: nothing is fetched. Default true. */
36
+ enabled?: boolean | undefined;
37
+ live?: boolean | LiveOptions | undefined;
38
+ /** Most rows per request. Default {@link CALENDAR_LIMIT}. */
39
+ limit?: number | undefined;
40
+ /**
41
+ * The clock the window's days are on. Default the field's own (`fields.<field>.timeZone`),
42
+ * else the viewer's, else the device's: the clock the field's cells use.
43
+ */
44
+ timeZone?: string | undefined;
45
+ /** Default the view's `calendar.durationField`. */
46
+ durationField?: string | undefined;
47
+ /** Default the view's `calendar.durationUnit`, else minutes. */
48
+ durationUnit?: "minutes" | "hours" | "days" | undefined;
49
+ /** Default the view's `calendar.maxDuration`: how far before the window a row with a duration is read. */
50
+ maxDuration?: number | undefined;
51
+ /**
52
+ * Fields the rows must carry besides the date, end and all-day fields, for the select check.
53
+ * Default the view's `calendar.durationField` and `laneBy`.
54
+ */
55
+ needs?: readonly (string | undefined)[] | undefined;
56
+ }
57
+ /** @stability Beta */
58
+ interface ViewCalendarRangeState<T extends Row = Row> {
59
+ /** The rows in the window, each once. */
60
+ rows: T[];
61
+ /** Rows the provider counted in all; above `rows.length` when the limit cut some. */
62
+ total: number;
63
+ /** Nothing yet for this window (the last window's rows may stand in). */
64
+ loading: boolean;
65
+ error: unknown;
66
+ refetch: () => void;
67
+ /** The clock the window was read on. */
68
+ timeZone: string;
69
+ /** A row's record key. */
70
+ keyOf: (row: T) => string;
71
+ }
72
+ /**
73
+ * A view's rows in one calendar window, for a screen that places them itself (a custom view,
74
+ * ADR 0019). ResourceCalendar loads its rows through it.
75
+ *
76
+ * ```tsx
77
+ * const range = calendarWindow("weeks", today, { weeks: 1 });
78
+ * const week = useViewCalendarRange(sessionsView, range, { filters: useViewListParams({ view: sessionsView }).filters });
79
+ * ```
80
+ *
81
+ * At most two requests, each a plain filter list the provider rules apply to, that neither
82
+ * overlap nor leave a gap: rows that start in the window, and, with an end field, rows that
83
+ * started before it and end inside or after it. One query for both, under core's list keys, so a
84
+ * save refreshes it; the last window's rows stand in while the next loads, never across a change
85
+ * of filters.
86
+ *
87
+ * @stability Beta
88
+ */
89
+ declare function useViewCalendarRange<T extends Row = Row>(view: ResourceView<ResourceContract<any>, T & DataRow>, range: ViewCalendarRange, options?: UseViewCalendarRangeOptions): ViewCalendarRangeState<T>;
90
+
91
+ export { CALENDAR_LIMIT, type UseViewCalendarRangeOptions, type ViewCalendarRange, type ViewCalendarRangeState, useViewCalendarRange };
@@ -0,0 +1,22 @@
1
+ export { CALENDAR_LIMIT, useViewCalendarRange } from '../chunk-2ORQLYVW.js';
2
+ import '../chunk-YMFJLBIZ.js';
3
+ import '../chunk-KV2HW4G4.js';
4
+ import '../chunk-XIBQ5BTZ.js';
5
+ import '../chunk-OZYF55E3.js';
6
+ import '../chunk-AQX5HQD6.js';
7
+ import '../chunk-MMMC37AP.js';
8
+ import '../chunk-AJGVLF37.js';
9
+ import '../chunk-6SHGMEA6.js';
10
+ import '../chunk-2IGAUXYH.js';
11
+ import '../chunk-OIZNABG4.js';
12
+ import '../chunk-J54XXKQD.js';
13
+ import '../chunk-4PTQYT5J.js';
14
+ import '../chunk-5ASUMG6K.js';
15
+ import '../chunk-AUVKRXRC.js';
16
+ import '../chunk-WXENWPWP.js';
17
+ import '../chunk-NOPS5EIH.js';
18
+ import '../chunk-HUNGCTRA.js';
19
+ import '../chunk-RYEXWQFD.js';
20
+ import '../chunk-WLDSIQJ2.js';
21
+ //# sourceMappingURL=use-view-calendar-range.js.map
22
+ //# sourceMappingURL=use-view-calendar-range.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"use-view-calendar-range.js"}
@@ -1,5 +1,5 @@
1
1
  import { QueryClient, MutationOptions } from '@tanstack/react-query';
2
- import { I as InvalidationKey } from '../types-BriIV4e_.js';
2
+ import { I as InvalidationKey } from '../types-CiQY6hUy.js';
3
3
 
4
4
  declare const WRITE_FAILED = "That didn't work. Try again.";
5
5
  interface UseWriteOptions<A, R> {