tinybase 9.1.0-beta.0 → 9.1.0-beta.2

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 (106) hide show
  1. package/@types/_internal/store/with-schemas/index.d.ts +133 -2
  2. package/@types/common/index.d.ts +17 -2
  3. package/@types/common/with-schemas/index.d.ts +18 -2
  4. package/@types/indexes/index.d.ts +97 -0
  5. package/@types/indexes/with-schemas/index.d.ts +137 -0
  6. package/@types/store/index.d.ts +133 -25
  7. package/@types/store/with-schemas/index.d.ts +145 -51
  8. package/@types/ui-react/index.d.ts +48 -2
  9. package/@types/ui-react/with-schemas/index.d.ts +108 -34
  10. package/@types/ui-solid/index.d.ts +51 -2
  11. package/@types/ui-solid/with-schemas/index.d.ts +111 -34
  12. package/@types/ui-svelte/index.d.ts +84 -2
  13. package/@types/ui-svelte/with-schemas/index.d.ts +122 -25
  14. package/index.js +155 -38
  15. package/indexes/index.js +39 -0
  16. package/indexes/with-schemas/index.js +39 -0
  17. package/mergeable-store/index.js +116 -38
  18. package/mergeable-store/with-schemas/index.js +116 -38
  19. package/min/index.js +1 -1
  20. package/min/index.js.gz +0 -0
  21. package/min/indexes/index.js +1 -1
  22. package/min/indexes/index.js.gz +0 -0
  23. package/min/indexes/with-schemas/index.js +1 -1
  24. package/min/indexes/with-schemas/index.js.gz +0 -0
  25. package/min/mergeable-store/index.js +1 -1
  26. package/min/mergeable-store/index.js.gz +0 -0
  27. package/min/mergeable-store/with-schemas/index.js +1 -1
  28. package/min/mergeable-store/with-schemas/index.js.gz +0 -0
  29. package/min/omni/index.js +1 -1
  30. package/min/omni/index.js.gz +0 -0
  31. package/min/omni/with-schemas/index.js +1 -1
  32. package/min/omni/with-schemas/index.js.gz +0 -0
  33. package/min/store/index.js +1 -1
  34. package/min/store/index.js.gz +0 -0
  35. package/min/store/with-schemas/index.js +1 -1
  36. package/min/store/with-schemas/index.js.gz +0 -0
  37. package/min/ui-react/index.js +1 -1
  38. package/min/ui-react/index.js.gz +0 -0
  39. package/min/ui-react/with-schemas/index.js +1 -1
  40. package/min/ui-react/with-schemas/index.js.gz +0 -0
  41. package/min/ui-react-dom/index.js +1 -1
  42. package/min/ui-react-dom/index.js.gz +0 -0
  43. package/min/ui-react-dom/with-schemas/index.js +1 -1
  44. package/min/ui-react-dom/with-schemas/index.js.gz +0 -0
  45. package/min/ui-react-dom-charts/index.js +1 -1
  46. package/min/ui-react-dom-charts/index.js.gz +0 -0
  47. package/min/ui-react-dom-charts/with-schemas/index.js +1 -1
  48. package/min/ui-react-dom-charts/with-schemas/index.js.gz +0 -0
  49. package/min/ui-react-inspector/index.js +1 -1
  50. package/min/ui-react-inspector/index.js.gz +0 -0
  51. package/min/ui-react-inspector/with-schemas/index.js +1 -1
  52. package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  53. package/min/ui-solid/index.js +1 -1
  54. package/min/ui-solid/index.js.gz +0 -0
  55. package/min/ui-solid/with-schemas/index.js +1 -1
  56. package/min/ui-solid/with-schemas/index.js.gz +0 -0
  57. package/min/ui-solid-dom/index.js +1 -1
  58. package/min/ui-solid-dom/index.js.gz +0 -0
  59. package/min/ui-solid-dom/with-schemas/index.js +1 -1
  60. package/min/ui-solid-dom/with-schemas/index.js.gz +0 -0
  61. package/min/ui-solid-inspector/index.js +1 -1
  62. package/min/ui-solid-inspector/index.js.gz +0 -0
  63. package/min/ui-solid-inspector/with-schemas/index.js +1 -1
  64. package/min/ui-solid-inspector/with-schemas/index.js.gz +0 -0
  65. package/min/ui-svelte/index.js +1 -1
  66. package/min/ui-svelte/index.js.gz +0 -0
  67. package/min/ui-svelte/with-schemas/index.js +1 -1
  68. package/min/ui-svelte/with-schemas/index.js.gz +0 -0
  69. package/min/ui-svelte-dom/index.js +1 -1
  70. package/min/ui-svelte-dom/index.js.gz +0 -0
  71. package/min/ui-svelte-dom/with-schemas/index.js +1 -1
  72. package/min/ui-svelte-dom/with-schemas/index.js.gz +0 -0
  73. package/min/ui-svelte-inspector/index.js +1 -1
  74. package/min/ui-svelte-inspector/index.js.gz +0 -0
  75. package/min/ui-svelte-inspector/with-schemas/index.js +1 -1
  76. package/min/ui-svelte-inspector/with-schemas/index.js.gz +0 -0
  77. package/min/with-schemas/index.js +1 -1
  78. package/min/with-schemas/index.js.gz +0 -0
  79. package/omni/index.js +155 -38
  80. package/omni/with-schemas/index.js +155 -38
  81. package/package.json +3 -3
  82. package/readme.md +14 -14
  83. package/releases.md +101 -60
  84. package/store/index.js +116 -38
  85. package/store/with-schemas/index.js +116 -38
  86. package/ui-react/index.js +52 -6
  87. package/ui-react/with-schemas/index.js +52 -6
  88. package/ui-react-dom/index.js +24 -4
  89. package/ui-react-dom/with-schemas/index.js +24 -4
  90. package/ui-react-dom-charts/index.js +24 -4
  91. package/ui-react-dom-charts/with-schemas/index.js +24 -4
  92. package/ui-react-inspector/index.js +140 -42
  93. package/ui-react-inspector/with-schemas/index.js +140 -42
  94. package/ui-solid/index.js +48 -2
  95. package/ui-solid/with-schemas/index.js +48 -2
  96. package/ui-solid-dom/index.js +17 -1
  97. package/ui-solid-dom/with-schemas/index.js +17 -1
  98. package/ui-solid-inspector/index.js +133 -39
  99. package/ui-solid-inspector/with-schemas/index.js +133 -39
  100. package/ui-svelte/index.js +91 -31
  101. package/ui-svelte/with-schemas/index.js +91 -31
  102. package/ui-svelte-dom/index.js +35 -14
  103. package/ui-svelte-dom/with-schemas/index.js +35 -14
  104. package/ui-svelte-inspector/index.js +151 -52
  105. package/ui-svelte-inspector/with-schemas/index.js +151 -52
  106. package/with-schemas/index.js +155 -38
@@ -84,6 +84,7 @@ import type {
84
84
  IdOrNull,
85
85
  Ids,
86
86
  ParameterizedCallback,
87
+ Sorter,
87
88
  } from '../../common/with-schemas/index.d.ts';
88
89
  import type {
89
90
  Indexes,
@@ -142,6 +143,8 @@ import type {
142
143
  MapCell,
143
144
  MapValue,
144
145
  OptionalSchemas,
146
+ PartialRow,
147
+ PartialValues,
145
148
  Row,
146
149
  RowCountListener,
147
150
  RowIdsListener,
@@ -1635,6 +1638,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
1635
1638
  * descending?: MaybeAccessor<boolean | undefined>,
1636
1639
  * offset?: MaybeAccessor<number | undefined>,
1637
1640
  * limit?: MaybeAccessor<number | undefined>,
1641
+ * sorter?: Sorter,
1638
1642
  * storeOrStoreId?: MaybeAccessor<StoreOrStoreId | undefined>,
1639
1643
  * ): Accessor<Ids>;
1640
1644
  * ```
@@ -1654,6 +1658,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
1654
1658
  * @param descending Whether the sorting should be in descending order.
1655
1659
  * @param offset The number of Row Ids to skip for pagination purposes, if any.
1656
1660
  * @param limit The maximum number of Row Ids to return, or `undefined` for all.
1661
+ * @param sorter A custom function for comparing the sorting values, or
1662
+ * `undefined` to use the default alphanumeric sorting.
1657
1663
  * @param storeOrStoreId The Store to be accessed: omit for the default context
1658
1664
  * Store, provide an Id for a named context Store, or provide an explicit
1659
1665
  * reference.
@@ -1677,6 +1683,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
1677
1683
  * false,
1678
1684
  * 0,
1679
1685
  * undefined,
1686
+ * undefined,
1680
1687
  * store,
1681
1688
  * );
1682
1689
  * console.log(JSON.stringify(rowIds()));
@@ -1697,6 +1704,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
1697
1704
  descending?: MaybeAccessor<boolean | undefined>,
1698
1705
  offset?: MaybeAccessor<number | undefined>,
1699
1706
  limit?: MaybeAccessor<number | undefined>,
1707
+ sorter?: Sorter,
1700
1708
  storeOrStoreId?: MaybeAccessor<StoreOrStoreId<Schemas> | undefined>,
1701
1709
  ): Accessor<Ids>;
1702
1710
 
@@ -1704,7 +1712,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
1704
1712
  * When called with an object as the first argument, the useSortedRowIds method
1705
1713
  * destructures it to make it easier to skip optional parameters.
1706
1714
  * @param args A SortedRowIdsArgs object containing the Id of the Table in the
1707
- * Store, and optional `cellId`, `descending`, `offset`, and `limit` parameters.
1715
+ * Store, and optional `cellId`, `descending`, `offset`, `limit`, and `sorter`
1716
+ * parameters.
1708
1717
  * @param storeOrStoreId The Store to be accessed: omit for the default context
1709
1718
  * Store, provide an Id for a named context Store, or provide an explicit
1710
1719
  * reference.
@@ -2684,13 +2693,13 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
2684
2693
  * @category Store primitives
2685
2694
  * @since v8.3.0
2686
2695
  */
2687
- useSetTablesCallback: <Parameter, SetTables = Tables<Schemas[0], true>>(
2696
+ useSetTablesCallback: <Parameter>(
2688
2697
  getTables: (
2689
2698
  parameter: Parameter,
2690
2699
  store: Store<Schemas>,
2691
- ) => NoInfer<SetTables>,
2700
+ ) => Tables<Schemas[0], true>,
2692
2701
  storeOrStoreId?: MaybeAccessor<StoreOrStoreId<Schemas> | undefined>,
2693
- then?: (store: Store<Schemas>, tables: SetTables) => void,
2702
+ then?: (store: Store<Schemas>, tables: Tables<Schemas[0], true>) => void,
2694
2703
  ) => ParameterizedCallback<Parameter>;
2695
2704
 
2696
2705
  /**
@@ -2796,15 +2805,17 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
2796
2805
  useSetTableCallback: <
2797
2806
  Parameter,
2798
2807
  TableId extends TableIdFromSchema<Schemas[0]>,
2799
- SetTable = Table<Schemas[0], TableId, true>,
2800
2808
  >(
2801
2809
  tableId: MaybeAccessor<TableId> | GetId<Schemas, Parameter, TableId>,
2802
2810
  getTable: (
2803
2811
  parameter: Parameter,
2804
2812
  store: Store<Schemas>,
2805
- ) => NoInfer<SetTable>,
2813
+ ) => Table<Schemas[0], TableId, true>,
2806
2814
  storeOrStoreId?: MaybeAccessor<StoreOrStoreId<Schemas> | undefined>,
2807
- then?: (store: Store<Schemas>, table: SetTable) => void,
2815
+ then?: (
2816
+ store: Store<Schemas>,
2817
+ table: Table<Schemas[0], TableId, true>,
2818
+ ) => void,
2808
2819
  ) => ParameterizedCallback<Parameter>;
2809
2820
 
2810
2821
  /**
@@ -2910,16 +2921,15 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
2910
2921
  * @category Store primitives
2911
2922
  * @since v8.3.0
2912
2923
  */
2913
- useSetRowCallback: <
2914
- Parameter,
2915
- TableId extends TableIdFromSchema<Schemas[0]>,
2916
- SetRow = Row<Schemas[0], TableId, true>,
2917
- >(
2924
+ useSetRowCallback: <Parameter, TableId extends TableIdFromSchema<Schemas[0]>>(
2918
2925
  tableId: MaybeAccessor<TableId> | GetId<Schemas, Parameter, TableId>,
2919
2926
  rowId: MaybeAccessor<Id> | GetId<Schemas, Parameter, Id>,
2920
- getRow: (parameter: Parameter, store: Store<Schemas>) => NoInfer<SetRow>,
2927
+ getRow: (
2928
+ parameter: Parameter,
2929
+ store: Store<Schemas>,
2930
+ ) => Row<Schemas[0], TableId, true>,
2921
2931
  storeOrStoreId?: MaybeAccessor<StoreOrStoreId<Schemas> | undefined>,
2922
- then?: (store: Store<Schemas>, row: SetRow) => void,
2932
+ then?: (store: Store<Schemas>, row: Row<Schemas[0], TableId, true>) => void,
2923
2933
  ) => ParameterizedCallback<Parameter>;
2924
2934
 
2925
2935
  /**
@@ -3032,15 +3042,18 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
3032
3042
  * @category Store primitives
3033
3043
  * @since v8.3.0
3034
3044
  */
3035
- useAddRowCallback: <
3036
- Parameter,
3037
- TableId extends TableIdFromSchema<Schemas[0]>,
3038
- AddRow = Row<Schemas[0], TableId, true>,
3039
- >(
3045
+ useAddRowCallback: <Parameter, TableId extends TableIdFromSchema<Schemas[0]>>(
3040
3046
  tableId: MaybeAccessor<TableId> | GetId<Schemas, Parameter, TableId>,
3041
- getRow: (parameter: Parameter, store: Store<Schemas>) => NoInfer<AddRow>,
3047
+ getRow: (
3048
+ parameter: Parameter,
3049
+ store: Store<Schemas>,
3050
+ ) => Row<Schemas[0], TableId, true>,
3042
3051
  storeOrStoreId?: MaybeAccessor<StoreOrStoreId<Schemas> | undefined>,
3043
- then?: (rowId: Id | undefined, store: Store<Schemas>, row: AddRow) => void,
3052
+ then?: (
3053
+ rowId: Id | undefined,
3054
+ store: Store<Schemas>,
3055
+ row: Row<Schemas[0], TableId, true>,
3056
+ ) => void,
3044
3057
  reuseRowIds?: boolean,
3045
3058
  ) => ParameterizedCallback<Parameter>;
3046
3059
 
@@ -3151,16 +3164,18 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
3151
3164
  useSetPartialRowCallback: <
3152
3165
  Parameter,
3153
3166
  TableId extends TableIdFromSchema<Schemas[0]>,
3154
- SetPartialRow = Row<Schemas[0], TableId, true>,
3155
3167
  >(
3156
3168
  tableId: MaybeAccessor<TableId> | GetId<Schemas, Parameter, TableId>,
3157
3169
  rowId: MaybeAccessor<Id> | GetId<Schemas, Parameter, Id>,
3158
3170
  getPartialRow: (
3159
3171
  parameter: Parameter,
3160
3172
  store: Store<Schemas>,
3161
- ) => NoInfer<SetPartialRow>,
3173
+ ) => PartialRow<Schemas[0], TableId>,
3162
3174
  storeOrStoreId?: MaybeAccessor<StoreOrStoreId<Schemas> | undefined>,
3163
- then?: (store: Store<Schemas>, partialRow: SetPartialRow) => void,
3175
+ then?: (
3176
+ store: Store<Schemas>,
3177
+ partialRow: PartialRow<Schemas[0], TableId>,
3178
+ ) => void,
3164
3179
  ) => ParameterizedCallback<Parameter>;
3165
3180
 
3166
3181
  /**
@@ -3346,13 +3361,13 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
3346
3361
  * @category Store primitives
3347
3362
  * @since v8.3.0
3348
3363
  */
3349
- useSetValuesCallback: <Parameter, SetValues = Values<Schemas[1], true>>(
3364
+ useSetValuesCallback: <Parameter>(
3350
3365
  getValues: (
3351
3366
  parameter: Parameter,
3352
3367
  store: Store<Schemas>,
3353
- ) => NoInfer<SetValues>,
3368
+ ) => Values<Schemas[1], true>,
3354
3369
  storeOrStoreId?: MaybeAccessor<StoreOrStoreId<Schemas> | undefined>,
3355
- then?: (store: Store<Schemas>, values: SetValues) => void,
3370
+ then?: (store: Store<Schemas>, values: Values<Schemas[1], true>) => void,
3356
3371
  ) => ParameterizedCallback<Parameter>;
3357
3372
 
3358
3373
  /**
@@ -3453,16 +3468,16 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
3453
3468
  * @category Store primitives
3454
3469
  * @since v8.3.0
3455
3470
  */
3456
- useSetPartialValuesCallback: <
3457
- Parameter,
3458
- SetPartialValues = Values<Schemas[1], true>,
3459
- >(
3471
+ useSetPartialValuesCallback: <Parameter>(
3460
3472
  getPartialValues: (
3461
3473
  parameter: Parameter,
3462
3474
  store: Store<Schemas>,
3463
- ) => NoInfer<SetPartialValues>,
3475
+ ) => PartialValues<Schemas[1]>,
3464
3476
  storeOrStoreId?: MaybeAccessor<StoreOrStoreId<Schemas> | undefined>,
3465
- then?: (store: Store<Schemas>, partialValues: SetPartialValues) => void,
3477
+ then?: (
3478
+ store: Store<Schemas>,
3479
+ partialValues: PartialValues<Schemas[1]>,
3480
+ ) => void,
3466
3481
  ) => ParameterizedCallback<Parameter>;
3467
3482
 
3468
3483
  /**
@@ -5274,7 +5289,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
5274
5289
  * When called with an object as the first argument, the useSortedRowIds method
5275
5290
  * destructures it to make it easier to skip optional parameters.
5276
5291
  * @param args A SortedRowIdsArgs object containing the Id of the Table in the
5277
- * Store, and optional `cellId`, `descending`, `offset`, and `limit` parameters.
5292
+ * Store, and optional `cellId`, `descending`, `offset`, `limit`, and `sorter`
5293
+ * parameters.
5278
5294
  * @param listener The function that will be called whenever the sorted Row Ids
5279
5295
  * in the Table change.
5280
5296
  * @param mutator An optional boolean that indicates that the listener mutates
@@ -7819,6 +7835,35 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
7819
7835
  indexesOrIndexesId?: MaybeAccessor<IndexesOrIndexesId<Schemas> | undefined>,
7820
7836
  ): Accessor<Ids>;
7821
7837
 
7838
+ /**
7839
+ * The useHasIndex primitive returns a boolean indicating whether a given Index
7840
+ * exists in the Indexes object, and registers a listener so that any changes to
7841
+ * that result will cause an update.
7842
+ *
7843
+ * This has schema-based typing. The following is a simplified representation:
7844
+ *
7845
+ * ```ts override
7846
+ * useHasIndex(
7847
+ * indexId: MaybeAccessor<Id>,
7848
+ * indexesOrIndexesId?: MaybeAccessor<IndexesOrIndexesId | undefined>,
7849
+ * ): Accessor<boolean>;
7850
+ * ```
7851
+ *
7852
+ * This primitive follows the same Indexes object resolution rules as the
7853
+ * useIndexIds primitive.
7854
+ * @param indexId The Id of a possible Index in the Indexes object.
7855
+ * @param indexesOrIndexesId The Indexes object to be accessed: omit for the
7856
+ * default context Indexes object, provide an Id for a named context Indexes
7857
+ * object, or provide an explicit reference.
7858
+ * @returns Whether an Index with that Id exists.
7859
+ * @category Indexes primitives
7860
+ * @since v9.1.0
7861
+ */
7862
+ useHasIndex: (
7863
+ indexId: MaybeAccessor<Id>,
7864
+ indexesOrIndexesId?: MaybeAccessor<IndexesOrIndexesId<Schemas> | undefined>,
7865
+ ) => Accessor<boolean>;
7866
+
7822
7867
  /**
7823
7868
  * The useSliceIds primitive gets the list of Slice Ids in an Index, and
7824
7869
  * registers a listener so that any changes to that result will cause an update.
@@ -7915,6 +7960,38 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
7915
7960
  indexesOrIndexesId?: MaybeAccessor<IndexesOrIndexesId<Schemas> | undefined>,
7916
7961
  ) => Accessor<Ids>;
7917
7962
 
7963
+ /**
7964
+ * The useHasSlice primitive returns a boolean indicating whether a given Slice
7965
+ * exists in an Index, and registers a listener so that any changes to that
7966
+ * result will cause an update.
7967
+ *
7968
+ * This has schema-based typing. The following is a simplified representation:
7969
+ *
7970
+ * ```ts override
7971
+ * useHasSlice(
7972
+ * indexId: MaybeAccessor<Id>,
7973
+ * sliceId: MaybeAccessor<Id>,
7974
+ * indexesOrIndexesId?: MaybeAccessor<IndexesOrIndexesId | undefined>,
7975
+ * ): Accessor<boolean>;
7976
+ * ```
7977
+ *
7978
+ * This primitive follows the same Indexes object resolution rules as the
7979
+ * useSliceIds primitive.
7980
+ * @param indexId The Id of a possible Index in the Indexes object.
7981
+ * @param sliceId The Id of a possible Slice in the Index.
7982
+ * @param indexesOrIndexesId The Indexes object to be accessed: omit for the
7983
+ * default context Indexes object, provide an Id for a named context Indexes
7984
+ * object, or provide an explicit reference.
7985
+ * @returns Whether a Slice with that Id exists.
7986
+ * @category Indexes primitives
7987
+ * @since v9.1.0
7988
+ */
7989
+ useHasSlice: (
7990
+ indexId: MaybeAccessor<Id>,
7991
+ sliceId: MaybeAccessor<Id>,
7992
+ indexesOrIndexesId?: MaybeAccessor<IndexesOrIndexesId<Schemas> | undefined>,
7993
+ ) => Accessor<boolean>;
7994
+
7918
7995
  /**
7919
7996
  * The useSliceRowIds primitive gets the list of Row Ids in a given Slice, and
7920
7997
  * registers a listener so that any changes to that result will cause an update.
@@ -35,7 +35,7 @@ import type {
35
35
  CheckpointListener,
36
36
  Checkpoints,
37
37
  } from '../checkpoints/index.d.ts';
38
- import type {Id, IdOrNull, Ids} from '../common/index.d.ts';
38
+ import type {Id, IdOrNull, Ids, Sorter} from '../common/index.d.ts';
39
39
  import type {
40
40
  Indexes,
41
41
  SliceIdsListener,
@@ -82,6 +82,7 @@ import type {
82
82
  RowCountListener,
83
83
  RowIdsListener,
84
84
  RowListener,
85
+ SortedRowIdsArgs,
85
86
  SortedRowIdsListener,
86
87
  Store,
87
88
  Table,
@@ -2893,6 +2894,8 @@ export function getRowIds(
2893
2894
  * @param descending Whether to sort descending (or a getter returning it).
2894
2895
  * @param offset The starting Row offset (or a getter returning it).
2895
2896
  * @param limit The maximum number of Rows to return (or a getter returning it).
2897
+ * @param sorter A custom function for comparing the sorting values, or
2898
+ * `undefined` to use the default alphanumeric sorting.
2896
2899
  * @param storeOrStoreId The Store to use (plain value or getter), or its Id.
2897
2900
  * @returns A reactive object with a `current` Ids property.
2898
2901
  * @example
@@ -2907,7 +2910,15 @@ export function getRowIds(
2907
2910
  *
2908
2911
  * let {store} = $props();
2909
2912
  *
2910
- * const result = getSortedRowIds('pets', 'sold', false, 0, undefined, store);
2913
+ * const result = getSortedRowIds(
2914
+ * 'pets',
2915
+ * 'sold',
2916
+ * false,
2917
+ * 0,
2918
+ * undefined,
2919
+ * undefined,
2920
+ * store,
2921
+ * );
2911
2922
  * </script>
2912
2923
  *
2913
2924
  * {JSON.stringify(result.current)}
@@ -2941,6 +2952,23 @@ export function getSortedRowIds(
2941
2952
  descending?: MaybeGetter<boolean>,
2942
2953
  offset?: MaybeGetter<number>,
2943
2954
  limit?: MaybeGetter<number | undefined>,
2955
+ sorter?: Sorter,
2956
+ storeOrStoreId?: MaybeGetter<StoreOrStoreId | undefined>,
2957
+ ): {readonly current: Ids};
2958
+
2959
+ /**
2960
+ * When called with an object as the first argument, the getSortedRowIds
2961
+ * function destructures it to make it easier to skip optional parameters.
2962
+ * @param args A SortedRowIdsArgs object containing the Id of the Table in the
2963
+ * Store, and optional `cellId`, `descending`, `offset`, `limit`, and `sorter`
2964
+ * parameters.
2965
+ * @param storeOrStoreId The Store to use (plain value or getter), or its Id.
2966
+ * @returns A reactive object with a `current` Ids property.
2967
+ * @category Getter
2968
+ * @since v9.1.0
2969
+ */
2970
+ export function getSortedRowIds(
2971
+ args: SortedRowIdsArgs,
2944
2972
  storeOrStoreId?: MaybeGetter<StoreOrStoreId | undefined>,
2945
2973
  ): {readonly current: Ids};
2946
2974
 
@@ -4209,6 +4237,22 @@ export function getIndexIds(
4209
4237
  readonly current: Ids;
4210
4238
  };
4211
4239
 
4240
+ /**
4241
+ * The hasIndex function returns a reactive object reflecting whether a given
4242
+ * Index exists in the Indexes object, and registers a listener so that any
4243
+ * changes will update `current`.
4244
+ * @param indexId The Id of the possible Index (or a getter returning it).
4245
+ * @param indexesOrIndexesId The Indexes object to use (plain or getter), or its
4246
+ * Id.
4247
+ * @returns A reactive object with a `current` boolean property.
4248
+ * @category Getter
4249
+ * @since v9.1.0
4250
+ */
4251
+ export function hasIndex(
4252
+ indexId: MaybeGetter<Id>,
4253
+ indexesOrIndexesId?: MaybeGetter<IndexesOrIndexesId | undefined>,
4254
+ ): {readonly current: boolean};
4255
+
4212
4256
  /**
4213
4257
  * The getSliceIds function returns a reactive object reflecting the Ids of the
4214
4258
  * Slices in an Index, and registers a listener so that any changes will update
@@ -4267,6 +4311,24 @@ export function getSliceIds(
4267
4311
  indexesOrIndexesId?: MaybeGetter<IndexesOrIndexesId | undefined>,
4268
4312
  ): {readonly current: Ids};
4269
4313
 
4314
+ /**
4315
+ * The hasSlice function returns a reactive object reflecting whether a given
4316
+ * Slice exists in an Index, and registers a listener so that any changes will
4317
+ * update `current`.
4318
+ * @param indexId The Id of the Index (or a getter returning it).
4319
+ * @param sliceId The Id of the possible Slice (or a getter returning it).
4320
+ * @param indexesOrIndexesId The Indexes object to use (plain or getter), or its
4321
+ * Id.
4322
+ * @returns A reactive object with a `current` boolean property.
4323
+ * @category Getter
4324
+ * @since v9.1.0
4325
+ */
4326
+ export function hasSlice(
4327
+ indexId: MaybeGetter<Id>,
4328
+ sliceId: MaybeGetter<Id>,
4329
+ indexesOrIndexesId?: MaybeGetter<IndexesOrIndexesId | undefined>,
4330
+ ): {readonly current: boolean};
4331
+
4270
4332
  /**
4271
4333
  * The getSliceRowIds function returns a reactive object reflecting the Ids of
4272
4334
  * the Rows in a Slice, and registers a listener so that any changes will update
@@ -6936,6 +6998,26 @@ export function onSortedRowIds(
6936
6998
  storeOrStoreId?: MaybeGetter<StoreOrStoreId | undefined>,
6937
6999
  ): void;
6938
7000
 
7001
+ /**
7002
+ * When called with an object as the first argument, the onSortedRowIds function
7003
+ * destructures it to make it easier to skip optional parameters.
7004
+ * @param args A SortedRowIdsArgs object containing the Id of the Table in the
7005
+ * Store, and optional `cellId`, `descending`, `offset`, `limit`, and `sorter`
7006
+ * parameters.
7007
+ * @param listener The function to call when sorted Row Ids change.
7008
+ * @param mutator An optional boolean indicating the listener mutates Store
7009
+ * data.
7010
+ * @param storeOrStoreId The Store to use, or its Id.
7011
+ * @category Listener
7012
+ * @since v9.1.0
7013
+ */
7014
+ export function onSortedRowIds(
7015
+ args: SortedRowIdsArgs,
7016
+ listener: SortedRowIdsListener,
7017
+ mutator?: boolean,
7018
+ storeOrStoreId?: MaybeGetter<StoreOrStoreId | undefined>,
7019
+ ): void;
7020
+
6939
7021
  /**
6940
7022
  * The onHasRow function registers a listener that is called whenever a
6941
7023
  * specified Row is added to or removed from a Table.
@@ -23,7 +23,12 @@ import type {
23
23
  CheckpointListener,
24
24
  Checkpoints,
25
25
  } from '../../checkpoints/with-schemas/index.d.ts';
26
- import type {Id, IdOrNull, Ids} from '../../common/with-schemas/index.d.ts';
26
+ import type {
27
+ Id,
28
+ IdOrNull,
29
+ Ids,
30
+ Sorter,
31
+ } from '../../common/with-schemas/index.d.ts';
27
32
  import type {
28
33
  Indexes,
29
34
  SliceIdsListener,
@@ -77,6 +82,7 @@ import type {
77
82
  RowCountListener,
78
83
  RowIdsListener,
79
84
  RowListener,
85
+ SortedRowIdsArgs,
80
86
  SortedRowIdsListener,
81
87
  Store,
82
88
  Table,
@@ -3151,7 +3157,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
3151
3157
  storeOrStoreId?: StoreOrStoreId<Schemas>,
3152
3158
  ) => {readonly current: Ids};
3153
3159
 
3154
- /**
3160
+ getSortedRowIds: {
3161
+ /**
3155
3162
  * The getSortedRowIds function returns a reactive object reflecting the sorted
3156
3163
  * Row Ids in a Table, and registers a listener so that any changes will update
3157
3164
  * `current`.
@@ -3160,6 +3167,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
3160
3167
  * @param descending Whether to sort descending (or a getter returning it).
3161
3168
  * @param offset The starting Row offset (or a getter returning it).
3162
3169
  * @param limit The maximum number of Rows to return (or a getter returning it).
3170
+ * @param sorter A custom function for comparing the sorting values, or
3171
+ * `undefined` to use the default alphanumeric sorting.
3163
3172
  * @param storeOrStoreId The Store to use (plain value or getter), or its Id.
3164
3173
  * @returns A reactive object with a `current` Ids property.
3165
3174
  * @example
@@ -3175,6 +3184,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
3175
3184
  * descending?: MaybeGetter<boolean>,
3176
3185
  * offset?: MaybeGetter<number>,
3177
3186
  * limit?: MaybeGetter<number | undefined>,
3187
+ * sorter?: Sorter,
3178
3188
  * storeOrStoreId?: MaybeGetter<StoreOrStoreId | undefined>,
3179
3189
  * ): {readonly current: Ids};
3180
3190
  * ```
@@ -3187,7 +3197,15 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
3187
3197
  *
3188
3198
  * let {store} = $props();
3189
3199
  *
3190
- * const result = getSortedRowIds('pets', 'sold', false, 0, undefined, store);
3200
+ * const result = getSortedRowIds(
3201
+ * 'pets',
3202
+ * 'sold',
3203
+ * false,
3204
+ * 0,
3205
+ * undefined,
3206
+ * undefined,
3207
+ * store,
3208
+ * );
3191
3209
  * </script>
3192
3210
  *
3193
3211
  * {JSON.stringify(result.current)}
@@ -3215,14 +3233,32 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
3215
3233
  * @category Getter
3216
3234
  * @since v8.1.0
3217
3235
  */
3218
- getSortedRowIds: <TableId extends TableIdFromSchema<Schemas[0]>>(
3219
- tableId: MaybeGetter<TableId>,
3220
- cellId?: MaybeGetter<CellIdFromSchema<Schemas[0], TableId> | undefined>,
3221
- descending?: MaybeGetter<boolean>,
3222
- offset?: MaybeGetter<number>,
3223
- limit?: MaybeGetter<number | undefined>,
3224
- storeOrStoreId?: StoreOrStoreId<Schemas>,
3225
- ) => {readonly current: Ids};
3236
+ <TableId extends TableIdFromSchema<Schemas[0]>>(
3237
+ tableId: MaybeGetter<TableId>,
3238
+ cellId?: MaybeGetter<CellIdFromSchema<Schemas[0], TableId> | undefined>,
3239
+ descending?: MaybeGetter<boolean>,
3240
+ offset?: MaybeGetter<number>,
3241
+ limit?: MaybeGetter<number | undefined>,
3242
+ sorter?: Sorter,
3243
+ storeOrStoreId?: StoreOrStoreId<Schemas>,
3244
+ ): {readonly current: Ids};
3245
+
3246
+ /**
3247
+ * When called with an object as the first argument, the getSortedRowIds
3248
+ * function destructures it to make it easier to skip optional parameters.
3249
+ * @param args A SortedRowIdsArgs object containing the Id of the Table in the
3250
+ * Store, and optional `cellId`, `descending`, `offset`, `limit`, and `sorter`
3251
+ * parameters.
3252
+ * @param storeOrStoreId The Store to use (plain value or getter), or its Id.
3253
+ * @returns A reactive object with a `current` Ids property.
3254
+ * @category Getter
3255
+ * @since v9.1.0
3256
+ */
3257
+ <TableId extends TableIdFromSchema<Schemas[0]>>(
3258
+ args: SortedRowIdsArgs<Schemas[0], TableId>,
3259
+ storeOrStoreId?: StoreOrStoreId<Schemas>,
3260
+ ): {readonly current: Ids};
3261
+ };
3226
3262
 
3227
3263
  /**
3228
3264
  * The hasRow function returns a reactive object indicating whether a Row exists
@@ -4682,6 +4718,22 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
4682
4718
  readonly current: Ids;
4683
4719
  };
4684
4720
 
4721
+ /**
4722
+ * The hasIndex function returns a reactive object reflecting whether a given
4723
+ * Index exists in the Indexes object, and registers a listener so that any
4724
+ * changes will update `current`.
4725
+ * @param indexId The Id of the possible Index (or a getter returning it).
4726
+ * @param indexesOrIndexesId The Indexes object to use (plain or getter), or its
4727
+ * Id.
4728
+ * @returns A reactive object with a `current` boolean property.
4729
+ * @category Getter
4730
+ * @since v9.1.0
4731
+ */
4732
+ hasIndex: (
4733
+ indexId: MaybeGetter<Id>,
4734
+ indexesOrIndexesId?: MaybeGetter<IndexesOrIndexesId<Schemas> | undefined>,
4735
+ ) => {readonly current: boolean};
4736
+
4685
4737
  /**
4686
4738
  * The getSliceIds function returns a reactive object reflecting the Ids of the
4687
4739
  * Slices in an Index, and registers a listener so that any changes will update
@@ -4749,6 +4801,24 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
4749
4801
  indexesOrIndexesId?: IndexesOrIndexesId<Schemas>,
4750
4802
  ) => {readonly current: Ids};
4751
4803
 
4804
+ /**
4805
+ * The hasSlice function returns a reactive object reflecting whether a given
4806
+ * Slice exists in an Index, and registers a listener so that any changes will
4807
+ * update `current`.
4808
+ * @param indexId The Id of the Index (or a getter returning it).
4809
+ * @param sliceId The Id of the possible Slice (or a getter returning it).
4810
+ * @param indexesOrIndexesId The Indexes object to use (plain or getter), or its
4811
+ * Id.
4812
+ * @returns A reactive object with a `current` boolean property.
4813
+ * @category Getter
4814
+ * @since v9.1.0
4815
+ */
4816
+ hasSlice: (
4817
+ indexId: MaybeGetter<Id>,
4818
+ sliceId: MaybeGetter<Id>,
4819
+ indexesOrIndexesId?: IndexesOrIndexesId<Schemas>,
4820
+ ) => {readonly current: boolean};
4821
+
4752
4822
  /**
4753
4823
  * The getSliceRowIds function returns a reactive object reflecting the Ids of
4754
4824
  * the Rows in a Slice, and registers a listener so that any changes will update
@@ -7745,7 +7815,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
7745
7815
  storeOrStoreId?: StoreOrStoreId<Schemas>,
7746
7816
  ) => void;
7747
7817
 
7748
- /**
7818
+ onSortedRowIds: {
7819
+ /**
7749
7820
  * The onSortedRowIds function registers a listener that is called whenever the
7750
7821
  * sorted Row Ids in a Table change.
7751
7822
  * @param tableId The Id of the Table to listen to.
@@ -7818,19 +7889,45 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
7818
7889
  * @category Listener
7819
7890
  * @since v8.1.0
7820
7891
  */
7821
- onSortedRowIds: <
7822
- TableId extends TableIdFromSchema<Schemas[0]>,
7823
- CellIdOrUndefined extends CellIdFromSchema<Schemas[0], TableId> | undefined,
7824
- >(
7825
- tableId: MaybeGetter<TableId>,
7826
- cellId: MaybeGetter<CellIdOrUndefined>,
7827
- descending: MaybeGetter<boolean>,
7828
- offset: MaybeGetter<number>,
7829
- limit: MaybeGetter<number | undefined>,
7830
- listener: SortedRowIdsListener<Schemas, TableId, CellIdOrUndefined>,
7831
- mutator?: boolean,
7832
- storeOrStoreId?: StoreOrStoreId<Schemas>,
7833
- ) => void;
7892
+ <
7893
+ TableId extends TableIdFromSchema<Schemas[0]>,
7894
+ CellIdOrUndefined extends
7895
+ CellIdFromSchema<Schemas[0], TableId> | undefined,
7896
+ >(
7897
+ tableId: MaybeGetter<TableId>,
7898
+ cellId: MaybeGetter<CellIdOrUndefined>,
7899
+ descending: MaybeGetter<boolean>,
7900
+ offset: MaybeGetter<number>,
7901
+ limit: MaybeGetter<number | undefined>,
7902
+ listener: SortedRowIdsListener<Schemas, TableId, CellIdOrUndefined>,
7903
+ mutator?: boolean,
7904
+ storeOrStoreId?: StoreOrStoreId<Schemas>,
7905
+ ): void;
7906
+
7907
+ /**
7908
+ * When called with an object as the first argument, the onSortedRowIds function
7909
+ * destructures it to make it easier to skip optional parameters.
7910
+ * @param args A SortedRowIdsArgs object containing the Id of the Table in the
7911
+ * Store, and optional `cellId`, `descending`, `offset`, `limit`, and `sorter`
7912
+ * parameters.
7913
+ * @param listener The function to call when sorted Row Ids change.
7914
+ * @param mutator An optional boolean indicating the listener mutates Store
7915
+ * data.
7916
+ * @param storeOrStoreId The Store to use, or its Id.
7917
+ * @category Listener
7918
+ * @since v9.1.0
7919
+ */
7920
+ <
7921
+ TableId extends TableIdFromSchema<Schemas[0]>,
7922
+ CellIdOrUndefined extends
7923
+ CellIdFromSchema<Schemas[0], TableId> | undefined,
7924
+ >(
7925
+ args: SortedRowIdsArgs<Schemas[0], TableId, CellIdOrUndefined>,
7926
+ listener: SortedRowIdsListener<Schemas, TableId, CellIdOrUndefined>,
7927
+ mutator?: boolean,
7928
+ storeOrStoreId?: StoreOrStoreId<Schemas>,
7929
+ ): void;
7930
+ };
7834
7931
 
7835
7932
  /**
7836
7933
  * The onHasRow function registers a listener that is called whenever a