@arrai-innovations/reactive-helpers 21.1.2 → 22.0.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 (67) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +109 -21
  3. package/config/commonCrud.js +4 -6
  4. package/config/listCrud.js +20 -22
  5. package/config/objectCrud.js +30 -37
  6. package/package.json +93 -89
  7. package/types/config/listCrud.d.ts +83 -26
  8. package/types/config/objectCrud.d.ts +123 -44
  9. package/types/use/cancellableIntent.d.ts +27 -31
  10. package/types/use/combineClasses.d.ts +4 -1
  11. package/types/use/error.d.ts +39 -19
  12. package/types/use/list.d.ts +27 -26
  13. package/types/use/listCalculated.d.ts +21 -39
  14. package/types/use/listFilter.d.ts +25 -33
  15. package/types/use/listInstance.d.ts +88 -80
  16. package/types/use/listRelated.d.ts +26 -46
  17. package/types/use/listSearch.d.ts +54 -52
  18. package/types/use/listSort.d.ts +25 -39
  19. package/types/use/listSubscription.d.ts +28 -35
  20. package/types/use/loading.d.ts +20 -10
  21. package/types/use/loadingError.d.ts +12 -3
  22. package/types/use/object.d.ts +8 -5
  23. package/types/use/objectCalculated.d.ts +30 -27
  24. package/types/use/objectInstance.d.ts +67 -73
  25. package/types/use/objectRelated.d.ts +41 -33
  26. package/types/use/objectSubscription.d.ts +32 -43
  27. package/types/use/proxyError.d.ts +15 -6
  28. package/types/use/proxyLoading.d.ts +11 -5
  29. package/types/use/proxyLoadingError.d.ts +19 -7
  30. package/types/use/search.d.ts +33 -29
  31. package/types/utils/assignReactiveObject.d.ts +3 -0
  32. package/types/utils/cancellablePromise.d.ts +5 -5
  33. package/types/utils/classes.d.ts +7 -1
  34. package/types/utils/deepUnref.d.ts +1 -1
  35. package/types/utils/isReactiveTyped.d.ts +2 -0
  36. package/types/utils/keyDiff.d.ts +4 -6
  37. package/types/utils/relatedCalculatedHelpers.d.ts +2 -0
  38. package/types/utils/watches.d.ts +1 -1
  39. package/use/cancellableIntent.js +27 -7
  40. package/use/combineClasses.js +1 -1
  41. package/use/error.js +10 -14
  42. package/use/list.js +6 -18
  43. package/use/listCalculated.js +7 -22
  44. package/use/listFilter.js +8 -21
  45. package/use/listInstance.js +25 -44
  46. package/use/listRelated.js +9 -28
  47. package/use/listSearch.js +8 -17
  48. package/use/listSort.js +27 -41
  49. package/use/listSubscription.js +10 -25
  50. package/use/loading.js +5 -7
  51. package/use/loadingError.js +3 -3
  52. package/use/object.js +7 -19
  53. package/use/objectCalculated.js +9 -15
  54. package/use/objectInstance.js +46 -47
  55. package/use/objectRelated.js +13 -20
  56. package/use/objectSubscription.js +11 -25
  57. package/use/proxyError.js +10 -10
  58. package/use/proxyLoading.js +5 -5
  59. package/use/proxyLoadingError.js +10 -8
  60. package/use/search.js +5 -11
  61. package/utils/assignReactiveObject.js +3 -3
  62. package/utils/cancellablePromise.js +4 -4
  63. package/utils/classes.js +2 -2
  64. package/utils/deepUnref.js +1 -5
  65. package/utils/isReactiveTyped.js +2 -0
  66. package/utils/keyDiff.js +1 -3
  67. package/utils/relatedCalculatedHelpers.js +2 -0
@@ -8,9 +8,7 @@
8
8
  * @module use/listSearch.js
9
9
  */
10
10
  /**
11
- * Represents the raw reactive state used by the list search functionality.
12
- *
13
- * @typedef {object} ListSearchRawState
11
+ * @typedef {object} ListSearchRawState - Represents the raw reactive state used by the list search functionality.
14
12
  * @property {import('./listInstance.js').ObjectsByPk} objects - Currently filtered objects based on the search.
15
13
  * @property {import('./listInstance.js').ObjectsInOrder} objectsInOrder - The list of objects sorted according to the current search criteria.
16
14
  * @property {import('./listInstance.js').ListOrder} order - The current sort order of object pks after search have been applied.
@@ -32,13 +30,13 @@
32
30
  * Partial<import('./listRelated.js').ListRelatedRawState> &
33
31
  * Partial<import('./listCalculated.js').ListCalculatedRawState> &
34
32
  * Partial<import('./listFilter.js').ListFilterRawState>
35
- * )} ListSearchParentRawState
33
+ * )} ListSearchParentRawState - The raw, pre-unwrapped parent state consumed by the list search mixin, aggregating the upstream list composable states.
36
34
  */
37
35
  /**
38
36
  * @typedef {import('vue').UnwrapNestedRefs<ListSearchParentRawState>} ListSearchParentState - The parent state for a list search.
39
37
  */
40
38
  /**
41
- * @typedef {import('vue').ToRefs<ListSearchParentState>} ListSearchParentStateToRefs
39
+ * @typedef {import('vue').ToRefs<ListSearchParentState>} ListSearchParentStateToRefs - The parent list-search state converted to individual Vue refs.
42
40
  */
43
41
  /**
44
42
  * @typedef {import('vue').UnwrapNestedRefs<
@@ -66,17 +64,13 @@
66
64
  * @property {boolean} [showAllWhenEmpty=true] - Whether to show all items when the search is empty.
67
65
  */
68
66
  /**
69
- * The properties on a list search instance.
70
- *
71
- * @typedef {object} ListSearchProperties
67
+ * @typedef {object} ListSearchProperties - The properties on a list search instance.
72
68
  * @property {ListSearchState} state - The state.
73
69
  * @property {import('./search.js').SearchInstance} textSearchIndex - The text search index.
74
70
  * @property {() => void} stop - Stops the effect scope and cleans up resources.
75
71
  */
76
72
  /**
77
- * The provided list search instance, containing properties and functions.
78
- *
79
- * @typedef {ListSearchProperties} ListSearch
73
+ * @typedef {ListSearchProperties} ListSearch - The provided list search instance, containing properties and functions.
80
74
  */
81
75
  /**
82
76
  * Helper function that initializes multiple list search instances from given configurations. This is typically used
@@ -95,13 +89,10 @@ export function useListSearches(listSearchArgs: {
95
89
  [key: string]: ListSearch;
96
90
  };
97
91
  /**
98
- * FlexSearch.Document options, specifically for .index. Their documentation isn't very clear on this.
99
- * Typically, it would be a list of dot-separated keys to index.
100
- *
101
- * @typedef {string | string[] | object[]} TextSearchRules
92
+ * @typedef {string | string[] | object[]} TextSearchRules - FlexSearch.Document options, specifically for .index. Their documentation isn't very clear on this. Typically, it would be a list of dot-separated keys to index.
102
93
  */
103
94
  /**
104
- * @typedef {object} ListSearchProps
95
+ * @typedef {object} ListSearchProps - The consumer-supplied props configuring a list's text search (rules, value, and FlexSearch options).
105
96
  * @property {TextSearchRules} textSearchRules - Rules for what to search for. Keys are the keys to search for, values are functions that take the object and return The value to search for.
106
97
  * @property {string} textSearchValue - The value to search for.
107
98
  * @property {object} customDocumentOptions - FlexSearch.Document options.
@@ -109,7 +100,7 @@ export function useListSearches(listSearchArgs: {
109
100
  * @property {object} [customSearchOptions.limit=1000] - FlexSearch.Search options.
110
101
  */
111
102
  /**
112
- * @typedef {object} ListSearchInstanceOptions
103
+ * @typedef {object} ListSearchInstanceOptions - The configuration options used to create a list search instance.
113
104
  * @property {object} parentState - The list being filtered.
114
105
  * @property {ListSearchProps} [props] - Reactive properties.
115
106
  * @property {number} [throttle=500] - Throttle wait time.
@@ -149,98 +140,104 @@ export function useListSearch({ parentState, props, throttle, showAllWhenEmpty }
149
140
  */
150
141
  export type ListSearchRawState = {
151
142
  /**
152
- * - Currently filtered objects based on the search.
143
+ * Currently filtered objects based on the search.
153
144
  */
154
145
  objects: import("./listInstance.js").ObjectsByPk;
155
146
  /**
156
- * - The list of objects sorted according to the current search criteria.
147
+ * The list of objects sorted according to the current search criteria.
157
148
  */
158
149
  objectsInOrder: import("./listInstance.js").ObjectsInOrder;
159
150
  /**
160
- * - The current sort order of object pks after search have been applied.
151
+ * The current sort order of object pks after search have been applied.
161
152
  */
162
153
  order: import("./listInstance.js").ListOrder;
163
154
  /**
164
- * - Rules defining how text search should be applied on list items. Each rule
155
+ * Rules defining how text search should be applied on list items. Each rule
165
156
  * specifies a key and a function to extract the searchable text.
166
157
  */
167
158
  textSearchRules: object;
168
159
  /**
169
- * - The current value used for searching.
160
+ * The current value used for searching.
170
161
  */
171
162
  textSearchValue: string;
172
163
  /**
173
- * - Indexes built for quick search across objects based on rules.
164
+ * Indexes built for quick search across objects based on rules.
174
165
  */
175
166
  objectIndexes: object;
176
167
  /**
177
- * - Configuration options for the search document, used by FlexSearch.
168
+ * Configuration options for the search document, used by FlexSearch.
178
169
  */
179
170
  customDocumentOptions: object;
180
171
  /**
181
- * - Additional search options for FlexSearch.
172
+ * Additional search options for FlexSearch.
182
173
  */
183
174
  customSearchOptions: object;
184
175
  /**
185
- * - Flag indicating if a search has been performed.
176
+ * Flag indicating if a search has been performed.
186
177
  */
187
178
  searched: Readonly<import("vue").Ref<boolean>>;
188
179
  /**
189
- * - Indicates if the search process is actively running.
180
+ * Indicates if the search process is actively running.
190
181
  */
191
182
  running: import("vue").ComputedRef<boolean>;
192
183
  };
184
+ /**
185
+ * The raw, pre-unwrapped parent state consumed by the list search mixin, aggregating the upstream list composable states.
186
+ */
193
187
  export type ListSearchParentRawState = (import("./listInstance.js").ListInstanceRawState & Partial<import("./listSubscription.js").ListSubscriptionRawState> & Partial<import("./listRelated.js").ListRelatedRawState> & Partial<import("./listCalculated.js").ListCalculatedRawState> & Partial<import("./listFilter.js").ListFilterRawState>);
194
188
  /**
195
- * - The parent state for a list search.
189
+ * The parent state for a list search.
196
190
  */
197
191
  export type ListSearchParentState = import("vue").UnwrapNestedRefs<ListSearchParentRawState>;
192
+ /**
193
+ * The parent list-search state converted to individual Vue refs.
194
+ */
198
195
  export type ListSearchParentStateToRefs = import("vue").ToRefs<ListSearchParentState>;
199
196
  /**
200
- * - The state for a list search.
197
+ * The state for a list search.
201
198
  */
202
199
  export type ListSearchState = import("vue").UnwrapNestedRefs<ListSearchRawState & Partial<import("./listFilter.js").ListFilterRawState> & Partial<import("./listCalculated.js").ListCalculatedRawState> & Partial<import("./listRelated.js").ListRelatedRawState> & Partial<import("./listSubscription.js").ListSubscriptionRawState> & import("./listInstance.js").ListInstanceRawState>;
203
200
  /**
204
- * - The raw props for a list search.
201
+ * The raw props for a list search.
205
202
  */
206
203
  export type ListSearchRawProps = {
207
204
  /**
208
- * - Rules for what to search for. Keys are the keys to search for, values are functions that take the object and return The value to search for.
205
+ * Rules for what to search for. Keys are the keys to search for, values are functions that take the object and return The value to search for.
209
206
  */
210
207
  textSearchRules: any[];
211
208
  /**
212
- * - The value to search for.
209
+ * The value to search for.
213
210
  */
214
211
  textSearchValue: string;
215
212
  /**
216
- * - FlexSearch.Document options.
213
+ * FlexSearch.Document options.
217
214
  */
218
215
  customDocumentOptions: object;
219
216
  /**
220
- * - FlexSearch.Search options.
217
+ * FlexSearch.Search options.
221
218
  */
222
219
  customSearchOptions: {
223
220
  limit?: object;
224
221
  };
225
222
  };
226
223
  /**
227
- * - The options for a list search.
224
+ * The options for a list search.
228
225
  */
229
226
  export type ListSearchOptions = {
230
227
  /**
231
- * - The parent state.
228
+ * The parent state.
232
229
  */
233
230
  parentState: ListSearchParentState;
234
231
  /**
235
- * - The props.
232
+ * The props.
236
233
  */
237
234
  props: import("vue").UnwrapNestedRefs<ListSearchRawProps>;
238
235
  /**
239
- * - The throttle.
236
+ * The throttle.
240
237
  */
241
238
  throttle?: number;
242
239
  /**
243
- * - Whether to show all items when the search is empty.
240
+ * Whether to show all items when the search is empty.
244
241
  */
245
242
  showAllWhenEmpty?: boolean;
246
243
  };
@@ -249,15 +246,15 @@ export type ListSearchOptions = {
249
246
  */
250
247
  export type ListSearchProperties = {
251
248
  /**
252
- * - The state.
249
+ * The state.
253
250
  */
254
251
  state: ListSearchState;
255
252
  /**
256
- * - The text search index.
253
+ * The text search index.
257
254
  */
258
255
  textSearchIndex: import("./search.js").SearchInstance;
259
256
  /**
260
- * - Stops the effect scope and cleans up resources.
257
+ * Stops the effect scope and cleans up resources.
261
258
  */
262
259
  stop: () => void;
263
260
  };
@@ -266,45 +263,50 @@ export type ListSearchProperties = {
266
263
  */
267
264
  export type ListSearch = ListSearchProperties;
268
265
  /**
269
- * FlexSearch.Document options, specifically for .index. Their documentation isn't very clear on this.
270
- * Typically, it would be a list of dot-separated keys to index.
266
+ * FlexSearch.Document options, specifically for .index. Their documentation isn't very clear on this. Typically, it would be a list of dot-separated keys to index.
271
267
  */
272
268
  export type TextSearchRules = string | string[] | object[];
269
+ /**
270
+ * The consumer-supplied props configuring a list's text search (rules, value, and FlexSearch options).
271
+ */
273
272
  export type ListSearchProps = {
274
273
  /**
275
- * - Rules for what to search for. Keys are the keys to search for, values are functions that take the object and return The value to search for.
274
+ * Rules for what to search for. Keys are the keys to search for, values are functions that take the object and return The value to search for.
276
275
  */
277
276
  textSearchRules: TextSearchRules;
278
277
  /**
279
- * - The value to search for.
278
+ * The value to search for.
280
279
  */
281
280
  textSearchValue: string;
282
281
  /**
283
- * - FlexSearch.Document options.
282
+ * FlexSearch.Document options.
284
283
  */
285
284
  customDocumentOptions: object;
286
285
  /**
287
- * - FlexSearch.Search options.
286
+ * FlexSearch.Search options.
288
287
  */
289
288
  customSearchOptions: {
290
289
  limit?: object;
291
290
  };
292
291
  };
292
+ /**
293
+ * The configuration options used to create a list search instance.
294
+ */
293
295
  export type ListSearchInstanceOptions = {
294
296
  /**
295
- * - The list being filtered.
297
+ * The list being filtered.
296
298
  */
297
299
  parentState: object;
298
300
  /**
299
- * - Reactive properties.
301
+ * Reactive properties.
300
302
  */
301
303
  props?: ListSearchProps;
302
304
  /**
303
- * - Throttle wait time.
305
+ * Throttle wait time.
304
306
  */
305
307
  throttle?: number;
306
308
  /**
307
- * - Whether to show all items when the search is empty.
309
+ * Whether to show all items when the search is empty.
308
310
  */
309
311
  showAllWhenEmpty?: boolean;
310
312
  };
@@ -11,22 +11,15 @@ export function setListSortDefaultOptions({ sortThrottleWait }: {
11
11
  sortThrottleWait: number;
12
12
  }): void;
13
13
  /**
14
- * Describes a rule for ordering elements in a list. Each rule can directly reference a property of the list items,
15
- * or define a function to compute the value used for sorting. Rules can be configured to sort in ascending or descending
16
- * order and can utilize locale-aware string comparison if necessary.
17
- *
18
14
  * @typedef {{
19
15
  * key: string,
20
16
  * keyFn?: (object: any, state: ListSortState) => any,
21
17
  * desc?: boolean,
22
18
  * localeCompare?: boolean
23
- * }} OrderByRule
19
+ * }} OrderByRule - Describes a rule for ordering elements in a list. Each rule can directly reference a property of the list items, or define a function to compute the value used for sorting. Rules can be configured to sort in ascending or descending order and can utilize locale-aware string comparison if necessary.
24
20
  */
25
21
  /**
26
- * Represents the raw state used by the list sorting functionality. Includes all configurations and state necessary
27
- * to manage sorting operations within a Vue application.
28
- *
29
- * @typedef {object} ListSortRawState
22
+ * @typedef {object} ListSortRawState - Represents the raw state used by the list sorting functionality. Includes all configurations and state necessary to manage sorting operations within a Vue application.
30
23
  * @property {OrderByRule[]} orderByRules - Current sorting rules applied to the list.
31
24
  * @property {boolean[]} orderByDesc - Flags indicating whether each sort criterion is in descending order.
32
25
  */
@@ -40,40 +33,31 @@ export function setListSortDefaultOptions({ sortThrottleWait }: {
40
33
  * Partial<import('./listCalculated.js').ListCalculatedRawState> &
41
34
  * Partial<import('./listFilter.js').ListFilterRawState> &
42
35
  * Partial<import('./listSearch.js').ListSearchRawState>
43
- * )} ListSortParentRawState
36
+ * )} ListSortParentRawState - The raw, pre-unwrapped parent state consumed by the list sort mixin, aggregating the upstream list composable states.
44
37
  */
45
38
  /**
46
- * @typedef {import('vue').UnwrapNestedRefs<ListSortParentRawState>} ListSortParentState
39
+ * @typedef {import('vue').UnwrapNestedRefs<ListSortParentRawState>} ListSortParentState - The unwrapped reactive parent state consumed by the list sort mixin.
47
40
  */
48
41
  /**
49
- * The reactive state used by the list sorting functionality. Includes all configurations and state necessary to manage
50
- * sorting operations within a Vue application.
51
- *
52
42
  * @typedef {import('vue').UnwrapNestedRefs<
53
43
  * ListSortParentRawState &
54
44
  * ListSortRawState
55
- * >} ListSortState
45
+ * >} ListSortState - The reactive state used by the list sorting functionality. Includes all configurations and state necessary to manage sorting operations within a Vue application.
56
46
  */
57
47
  /**
58
- * The configuration options for initializing a list sort instance.
59
- *
60
- * @typedef {object} ListSortOptions
48
+ * @typedef {object} ListSortOptions - The configuration options for initializing a list sort instance.
61
49
  * @property {ListSortParentState} parentState - The parent state containing the list data and any associated state needed for sorting.
62
50
  * @property {OrderByRule[]|import('vue').Ref<OrderByRule[]>} orderByRules - Rules defining how the list should be sorted, including key and direction.
63
51
  * @property {number | symbol} sortThrottleWait - Optional throttle wait time to limit the frequency of sort operations, enhancing performance.
64
52
  */
65
53
  /**
66
- * The properties available on a list sort instance.
67
- *
68
- * @typedef {object} ListSortProperties
54
+ * @typedef {object} ListSortProperties - The properties available on a list sort instance.
69
55
  * @property {ListSortState} state - The reactive state for the list sort.
70
56
  * @property {ListSortParentState} parentState - The parent state.
71
57
  * @property {() => void} stop - A function to stop the effect scope and clean up resources.
72
58
  */
73
59
  /**
74
- * The list sort instance, including reactive state and utilities to manage list sorting operations.
75
- *
76
- * @typedef {ListSortProperties} ListSort
60
+ * @typedef {ListSortProperties} ListSort - The list sort instance, including reactive state and utilities to manage list sorting operations.
77
61
  */
78
62
  /**
79
63
  * Creates multiple list sort instances.
@@ -132,9 +116,7 @@ export function useListSorts(listSortArgs: {
132
116
  */
133
117
  export function useListSort({ parentState, orderByRules, sortThrottleWait }: ListSortOptions): ListSort;
134
118
  /**
135
- * Describes a rule for ordering elements in a list. Each rule can directly reference a property of the list items,
136
- * or define a function to compute the value used for sorting. Rules can be configured to sort in ascending or descending
137
- * order and can utilize locale-aware string comparison if necessary.
119
+ * Describes a rule for ordering elements in a list. Each rule can directly reference a property of the list items, or define a function to compute the value used for sorting. Rules can be configured to sort in ascending or descending order and can utilize locale-aware string comparison if necessary.
138
120
  */
139
121
  export type OrderByRule = {
140
122
  key: string;
@@ -143,24 +125,28 @@ export type OrderByRule = {
143
125
  localeCompare?: boolean;
144
126
  };
145
127
  /**
146
- * Represents the raw state used by the list sorting functionality. Includes all configurations and state necessary
147
- * to manage sorting operations within a Vue application.
128
+ * Represents the raw state used by the list sorting functionality. Includes all configurations and state necessary to manage sorting operations within a Vue application.
148
129
  */
149
130
  export type ListSortRawState = {
150
131
  /**
151
- * - Current sorting rules applied to the list.
132
+ * Current sorting rules applied to the list.
152
133
  */
153
134
  orderByRules: OrderByRule[];
154
135
  /**
155
- * - Flags indicating whether each sort criterion is in descending order.
136
+ * Flags indicating whether each sort criterion is in descending order.
156
137
  */
157
138
  orderByDesc: boolean[];
158
139
  };
140
+ /**
141
+ * The raw, pre-unwrapped parent state consumed by the list sort mixin, aggregating the upstream list composable states.
142
+ */
159
143
  export type ListSortParentRawState = (import("./listInstance.js").ListInstanceRawState & Partial<import("./listSubscription.js").ListSubscriptionRawState> & Partial<import("./listRelated.js").ListRelatedRawState> & Partial<import("./listCalculated.js").ListCalculatedRawState> & Partial<import("./listFilter.js").ListFilterRawState> & Partial<import("./listSearch.js").ListSearchRawState>);
144
+ /**
145
+ * The unwrapped reactive parent state consumed by the list sort mixin.
146
+ */
160
147
  export type ListSortParentState = import("vue").UnwrapNestedRefs<ListSortParentRawState>;
161
148
  /**
162
- * The reactive state used by the list sorting functionality. Includes all configurations and state necessary to manage
163
- * sorting operations within a Vue application.
149
+ * The reactive state used by the list sorting functionality. Includes all configurations and state necessary to manage sorting operations within a Vue application.
164
150
  */
165
151
  export type ListSortState = import("vue").UnwrapNestedRefs<ListSortParentRawState & ListSortRawState>;
166
152
  /**
@@ -168,15 +154,15 @@ export type ListSortState = import("vue").UnwrapNestedRefs<ListSortParentRawStat
168
154
  */
169
155
  export type ListSortOptions = {
170
156
  /**
171
- * - The parent state containing the list data and any associated state needed for sorting.
157
+ * The parent state containing the list data and any associated state needed for sorting.
172
158
  */
173
159
  parentState: ListSortParentState;
174
160
  /**
175
- * - Rules defining how the list should be sorted, including key and direction.
161
+ * Rules defining how the list should be sorted, including key and direction.
176
162
  */
177
163
  orderByRules: OrderByRule[] | import("vue").Ref<OrderByRule[]>;
178
164
  /**
179
- * - Optional throttle wait time to limit the frequency of sort operations, enhancing performance.
165
+ * Optional throttle wait time to limit the frequency of sort operations, enhancing performance.
180
166
  */
181
167
  sortThrottleWait: number | symbol;
182
168
  };
@@ -185,15 +171,15 @@ export type ListSortOptions = {
185
171
  */
186
172
  export type ListSortProperties = {
187
173
  /**
188
- * - The reactive state for the list sort.
174
+ * The reactive state for the list sort.
189
175
  */
190
176
  state: ListSortState;
191
177
  /**
192
- * - The parent state.
178
+ * The parent state.
193
179
  */
194
180
  parentState: ListSortParentState;
195
181
  /**
196
- * - A function to stop the effect scope and clean up resources.
182
+ * A function to stop the effect scope and clean up resources.
197
183
  */
198
184
  stop: () => void;
199
185
  };
@@ -1,61 +1,46 @@
1
1
  /**
2
- * The raw state of a list subscription.
3
- *
4
- * @typedef {object} ListSubscriptionMyState
2
+ * @typedef {object} ListSubscriptionMyState - The raw state of a list subscription.
5
3
  * @property {import('vue').Ref<boolean>|boolean} intendToList - If this is true, the list should be fetched, or re-fetched if arguments change.
6
4
  * @property {import('vue').Ref<boolean>|boolean} intendToSubscribe - If this is true, the subscription should start or restart if arguments change.
7
5
  * @property {import('vue').Ref<boolean>} subscribed - Whether the subscription is active.
8
6
  */
9
7
  /**
10
- * @typedef {import('vue').ToRefs<import('./listInstance.js').ListInstanceState>} ListInstanceStateRefs
8
+ * @typedef {import('vue').ToRefs<import('./listInstance.js').ListInstanceState>} ListInstanceStateRefs - The list instance's reactive state converted to individual Vue refs.
11
9
  */
12
10
  /**
13
- * The raw state of a list subscription, including the state from the list instance.
14
- *
15
11
  * @typedef {ListSubscriptionMyState & (
16
12
  * Pick<import('./loadingError.js').LoadingErrorStatus, "loading" | "error" | "errored">
17
- * ) & ListInstanceStateRefs} ListSubscriptionRawState
13
+ * ) & ListInstanceStateRefs} ListSubscriptionRawState - The raw state of a list subscription, including the state from the list instance.
18
14
  */
19
15
  /**
20
- * A reactive object that manages a list of objects, as returned by `useListInstance`.
21
- *
22
- * @typedef {import('vue').Reactive<ListSubscriptionRawState>} ListSubscriptionState
16
+ * @typedef {import('vue').Reactive<ListSubscriptionRawState>} ListSubscriptionState - A reactive object that manages a list of objects, as returned by `useListInstance`.
23
17
  */
24
18
  /**
25
- * The methods available on a list subscription.
26
- *
27
- * @typedef {Pick<import('./loadingError.js').LoadingErrorStatus, "clearError">} ListSubscriptionFunctions
19
+ * @typedef {Pick<import('./loadingError.js').LoadingErrorStatus, "clearError">} ListSubscriptionFunctions - The methods available on a list subscription.
28
20
  */
29
21
  /**
30
22
  * @typedef {{
31
23
  * state: ListSubscriptionState,
32
24
  * listInstance: import('./listInstance.js').ListInstance,
33
25
  * loadingError: import('./loadingError.js').LoadingErrorStatus,
34
- * }} ListSubscriptionContext
26
+ * }} ListSubscriptionContext - The context (state, list instance, and loading/error status) bound to the shared list subscription functions.
35
27
  */
36
28
  /**
37
- * The properties of a list subscription.
38
- *
39
- * @typedef {object} ListSubscriptionProperties
29
+ * @typedef {object} ListSubscriptionProperties - The properties of a list subscription.
40
30
  * @property {ListSubscriptionState} state - The reactive state of the list subscription.
41
31
  * @property {import('./listInstance.js').ListInstance} listInstance - The list instance used by the subscription.
42
32
  * @property {import('./cancellableIntent.js').CancellableIntent} listIntent - The `CancellableIntent` instance managing if the list should be (re)fetched.
43
33
  * @property {import('./cancellableIntent.js').CancellableIntent} subscribeIntent - The `CancellableIntent` instance managing if the subscription should be (un)subscribed.
44
34
  */
45
35
  /**
46
- * An instance of a list subscription, returned by `useListSubscription`.
47
- *
48
- * @typedef {ListSubscriptionFunctions & ListSubscriptionProperties} ListSubscription
36
+ * @typedef {ListSubscriptionFunctions & ListSubscriptionProperties} ListSubscription - An instance of a list subscription, returned by `useListSubscription`.
49
37
  */
50
38
  /**
51
- * @typedef {object} ListSubscriptionOwnOptions
39
+ * @typedef {object} ListSubscriptionOwnOptions - The options specific to a list subscription, namely an optional pre-built list instance to reuse.
52
40
  * @property {import("./listInstance.js").ListInstance} [listInstance] - A list instance to use instead of creating one.
53
41
  */
54
42
  /**
55
- * Defines the settings required to establish a list subscription, detailing how list instances should handle updates
56
- * and subscriptions based on the given properties.
57
- *
58
- * @typedef {import("./listInstance.js").ListInstanceOptions & ListSubscriptionOwnOptions} ListSubscriptionOptions
43
+ * @typedef {import("./listInstance.js").ListInstanceOptions & ListSubscriptionOwnOptions} ListSubscriptionOptions - Defines the settings required to establish a list subscription, detailing how list instances should handle updates and subscriptions based on the given properties.
59
44
  */
60
45
  /**
61
46
  * A Vue composition function that creates multiple list subscriptions, and returns them as an object.
@@ -139,18 +124,21 @@ export class ListSubscriptionError extends Error {
139
124
  */
140
125
  export type ListSubscriptionMyState = {
141
126
  /**
142
- * - If this is true, the list should be fetched, or re-fetched if arguments change.
127
+ * If this is true, the list should be fetched, or re-fetched if arguments change.
143
128
  */
144
129
  intendToList: import("vue").Ref<boolean> | boolean;
145
130
  /**
146
- * - If this is true, the subscription should start or restart if arguments change.
131
+ * If this is true, the subscription should start or restart if arguments change.
147
132
  */
148
133
  intendToSubscribe: import("vue").Ref<boolean> | boolean;
149
134
  /**
150
- * - Whether the subscription is active.
135
+ * Whether the subscription is active.
151
136
  */
152
137
  subscribed: import("vue").Ref<boolean>;
153
138
  };
139
+ /**
140
+ * The list instance's reactive state converted to individual Vue refs.
141
+ */
154
142
  export type ListInstanceStateRefs = import("vue").ToRefs<import("./listInstance.js").ListInstanceState>;
155
143
  /**
156
144
  * The raw state of a list subscription, including the state from the list instance.
@@ -164,6 +152,9 @@ export type ListSubscriptionState = import("vue").Reactive<ListSubscriptionRawSt
164
152
  * The methods available on a list subscription.
165
153
  */
166
154
  export type ListSubscriptionFunctions = Pick<import("./loadingError.js").LoadingErrorStatus, "clearError">;
155
+ /**
156
+ * The context (state, list instance, and loading/error status) bound to the shared list subscription functions.
157
+ */
167
158
  export type ListSubscriptionContext = {
168
159
  state: ListSubscriptionState;
169
160
  listInstance: import("./listInstance.js").ListInstance;
@@ -174,19 +165,19 @@ export type ListSubscriptionContext = {
174
165
  */
175
166
  export type ListSubscriptionProperties = {
176
167
  /**
177
- * - The reactive state of the list subscription.
168
+ * The reactive state of the list subscription.
178
169
  */
179
170
  state: ListSubscriptionState;
180
171
  /**
181
- * - The list instance used by the subscription.
172
+ * The list instance used by the subscription.
182
173
  */
183
174
  listInstance: import("./listInstance.js").ListInstance;
184
175
  /**
185
- * - The `CancellableIntent` instance managing if the list should be (re)fetched.
176
+ * The `CancellableIntent` instance managing if the list should be (re)fetched.
186
177
  */
187
178
  listIntent: import("./cancellableIntent.js").CancellableIntent;
188
179
  /**
189
- * - The `CancellableIntent` instance managing if the subscription should be (un)subscribed.
180
+ * The `CancellableIntent` instance managing if the subscription should be (un)subscribed.
190
181
  */
191
182
  subscribeIntent: import("./cancellableIntent.js").CancellableIntent;
192
183
  };
@@ -194,14 +185,16 @@ export type ListSubscriptionProperties = {
194
185
  * An instance of a list subscription, returned by `useListSubscription`.
195
186
  */
196
187
  export type ListSubscription = ListSubscriptionFunctions & ListSubscriptionProperties;
188
+ /**
189
+ * The options specific to a list subscription, namely an optional pre-built list instance to reuse.
190
+ */
197
191
  export type ListSubscriptionOwnOptions = {
198
192
  /**
199
- * - A list instance to use instead of creating one.
193
+ * A list instance to use instead of creating one.
200
194
  */
201
195
  listInstance?: import("./listInstance.js").ListInstance;
202
196
  };
203
197
  /**
204
- * Defines the settings required to establish a list subscription, detailing how list instances should handle updates
205
- * and subscriptions based on the given properties.
198
+ * Defines the settings required to establish a list subscription, detailing how list instances should handle updates and subscriptions based on the given properties.
206
199
  */
207
200
  export type ListSubscriptionOptions = import("./listInstance.js").ListInstanceOptions & ListSubscriptionOwnOptions;
@@ -1,20 +1,18 @@
1
1
  /**
2
- * @typedef {import("vue").Ref<boolean|undefined>} LoadingRef
3
- * @typedef {Readonly<LoadingRef>} LoadingReadonlyRef
2
+ * @typedef {import("vue").Ref<boolean|undefined>} LoadingRef - A Vue ref to the loading flag, which is a boolean or undefined.
3
+ * @typedef {Readonly<LoadingRef>} LoadingReadonlyRef - A readonly Vue ref to the loading flag, which is a boolean or undefined.
4
4
  */
5
5
  /**
6
- * @typedef {object} LoadingProperties
6
+ * @typedef {object} LoadingProperties - The reactive loading-state member (loading) contributed by the useLoading composable.
7
7
  * @property {LoadingReadonlyRef} loading - Whether the component is loading.
8
8
  */
9
9
  /**
10
- * @typedef {object} LoadingFunctions
10
+ * @typedef {object} LoadingFunctions - The loading-state actions (setLoading, clearLoading) contributed by the useLoading composable.
11
11
  * @property {() => void} setLoading - Set the loading state to true.
12
12
  * @property {() => void} clearLoading - Set the loading state to false.
13
13
  */
14
14
  /**
15
- * The loading state API.
16
- *
17
- * @typedef {LoadingProperties & LoadingFunctions} LoadingStatus
15
+ * @typedef {LoadingProperties & LoadingFunctions} LoadingStatus - The loading state API.
18
16
  */
19
17
  /**
20
18
  * A composable function for managing loading state.
@@ -22,21 +20,33 @@
22
20
  * @returns {LoadingStatus} - An object containing reactive fields and actions for loading state.
23
21
  */
24
22
  export function useLoading(): LoadingStatus;
23
+ /**
24
+ * A Vue ref to the loading flag, which is a boolean or undefined.
25
+ */
25
26
  export type LoadingRef = import("vue").Ref<boolean | undefined>;
27
+ /**
28
+ * A readonly Vue ref to the loading flag, which is a boolean or undefined.
29
+ */
26
30
  export type LoadingReadonlyRef = Readonly<LoadingRef>;
31
+ /**
32
+ * The reactive loading-state member (loading) contributed by the useLoading composable.
33
+ */
27
34
  export type LoadingProperties = {
28
35
  /**
29
- * - Whether the component is loading.
36
+ * Whether the component is loading.
30
37
  */
31
38
  loading: LoadingReadonlyRef;
32
39
  };
40
+ /**
41
+ * The loading-state actions (setLoading, clearLoading) contributed by the useLoading composable.
42
+ */
33
43
  export type LoadingFunctions = {
34
44
  /**
35
- * - Set the loading state to true.
45
+ * Set the loading state to true.
36
46
  */
37
47
  setLoading: () => void;
38
48
  /**
39
- * - Set the loading state to false.
49
+ * Set the loading state to false.
40
50
  */
41
51
  clearLoading: () => void;
42
52
  };