@marktiderman/genesis-core 2.12.0 → 2.14.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 (99) hide show
  1. package/dist/{chunk-PSFKIG27.js → chunk-2K4747KX.js} +7 -4
  2. package/dist/chunk-2K4747KX.js.map +1 -0
  3. package/dist/{chunk-ZYJUEJ4Z.js → chunk-4PTQYT5J.js} +11 -5
  4. package/dist/chunk-4PTQYT5J.js.map +1 -0
  5. package/dist/{chunk-HBAPYA5K.js → chunk-5ASUMG6K.js} +3 -3
  6. package/dist/{chunk-HBAPYA5K.js.map → chunk-5ASUMG6K.js.map} +1 -1
  7. package/dist/{chunk-C62CMLWG.js → chunk-AHFIS42U.js} +6 -6
  8. package/dist/{chunk-C62CMLWG.js.map → chunk-AHFIS42U.js.map} +1 -1
  9. package/dist/{chunk-VJGU6E4U.js → chunk-DFABPMEQ.js} +13 -9
  10. package/dist/chunk-DFABPMEQ.js.map +1 -0
  11. package/dist/{chunk-POMTRNAL.js → chunk-G6GQPXQS.js} +4 -4
  12. package/dist/{chunk-POMTRNAL.js.map → chunk-G6GQPXQS.js.map} +1 -1
  13. package/dist/{chunk-ZHC3MDCS.js → chunk-JN47G4UE.js} +25 -16
  14. package/dist/chunk-JN47G4UE.js.map +1 -0
  15. package/dist/{chunk-2VJQVAJD.js → chunk-KA3BUJ4H.js} +3 -3
  16. package/dist/{chunk-2VJQVAJD.js.map → chunk-KA3BUJ4H.js.map} +1 -1
  17. package/dist/{chunk-2WS4LGYU.js → chunk-LKRJB632.js} +3 -3
  18. package/dist/{chunk-2WS4LGYU.js.map → chunk-LKRJB632.js.map} +1 -1
  19. package/dist/{chunk-LOJGHR5O.js → chunk-NE2D74BP.js} +4 -4
  20. package/dist/{chunk-LOJGHR5O.js.map → chunk-NE2D74BP.js.map} +1 -1
  21. package/dist/{chunk-VFT6QKZW.js → chunk-NOPS5EIH.js} +3 -3
  22. package/dist/{chunk-VFT6QKZW.js.map → chunk-NOPS5EIH.js.map} +1 -1
  23. package/dist/{chunk-52T2EYXH.js → chunk-NQFIAULD.js} +3 -3
  24. package/dist/{chunk-52T2EYXH.js.map → chunk-NQFIAULD.js.map} +1 -1
  25. package/dist/{chunk-3B5O36DU.js → chunk-OYDJGPDY.js} +7 -7
  26. package/dist/{chunk-3B5O36DU.js.map → chunk-OYDJGPDY.js.map} +1 -1
  27. package/dist/{chunk-OC4OGB2K.js → chunk-P3FHXRS2.js} +9 -6
  28. package/dist/chunk-P3FHXRS2.js.map +1 -0
  29. package/dist/{chunk-YNXLPOAB.js → chunk-RFHUOXZC.js} +4 -4
  30. package/dist/{chunk-YNXLPOAB.js.map → chunk-RFHUOXZC.js.map} +1 -1
  31. package/dist/{chunk-XVRIWP7B.js → chunk-S2VYJWB4.js} +3 -3
  32. package/dist/{chunk-XVRIWP7B.js.map → chunk-S2VYJWB4.js.map} +1 -1
  33. package/dist/{chunk-HYYTAJBG.js → chunk-SDAJSJNN.js} +3 -3
  34. package/dist/chunk-SDAJSJNN.js.map +1 -0
  35. package/dist/{chunk-42QPCDQF.js → chunk-WDPM5TBO.js} +3 -3
  36. package/dist/{chunk-42QPCDQF.js.map → chunk-WDPM5TBO.js.map} +1 -1
  37. package/dist/{chunk-LG6TUBVM.js → chunk-WLDSIQJ2.js} +4 -3
  38. package/dist/chunk-WLDSIQJ2.js.map +1 -0
  39. package/dist/{chunk-YQBWXG2G.js → chunk-YZV3Z6ZA.js} +3 -3
  40. package/dist/{chunk-YQBWXG2G.js.map → chunk-YZV3Z6ZA.js.map} +1 -1
  41. package/dist/conversation/index.d.ts +13 -2
  42. package/dist/conversation/index.js +7 -2
  43. package/dist/conversation/index.js.map +1 -1
  44. package/dist/csv.d.ts +1 -1
  45. package/dist/errors.js +2 -2
  46. package/dist/form-types.d.ts +1 -1
  47. package/dist/gallery/index.d.ts +5 -0
  48. package/dist/gallery/index.js.map +1 -1
  49. package/dist/hooks/draft-controller.js +2 -2
  50. package/dist/hooks/index.d.ts +1 -1
  51. package/dist/hooks/index.js +19 -19
  52. package/dist/hooks/mutation-mode.d.ts +1 -1
  53. package/dist/hooks/mutation-mode.js +6 -6
  54. package/dist/hooks/related-keys.d.ts +1 -1
  55. package/dist/hooks/use-capabilities.d.ts +1 -1
  56. package/dist/hooks/use-capabilities.js +3 -3
  57. package/dist/hooks/use-draft.js +3 -3
  58. package/dist/hooks/use-infinite-resource.d.ts +1 -1
  59. package/dist/hooks/use-infinite-resource.js +4 -4
  60. package/dist/hooks/use-link-options.d.ts +2 -1
  61. package/dist/hooks/use-link-options.js +6 -6
  62. package/dist/hooks/use-live.d.ts +1 -1
  63. package/dist/hooks/use-live.js +3 -3
  64. package/dist/hooks/use-one.d.ts +1 -1
  65. package/dist/hooks/use-one.js +4 -4
  66. package/dist/hooks/use-persisted-ui-state.js +3 -3
  67. package/dist/hooks/use-relation-label.d.ts +1 -1
  68. package/dist/hooks/use-relation-label.js +3 -3
  69. package/dist/hooks/use-resource-form.d.ts +1 -1
  70. package/dist/hooks/use-resource-form.js +10 -10
  71. package/dist/hooks/use-resource.d.ts +1 -1
  72. package/dist/hooks/use-resource.js +8 -8
  73. package/dist/hooks/use-write.d.ts +1 -1
  74. package/dist/hooks/use-write.js +2 -2
  75. package/dist/index.d.ts +3 -3
  76. package/dist/index.js +20 -20
  77. package/dist/navigation.d.ts +18 -1
  78. package/dist/navigation.js +7 -1
  79. package/dist/navigation.js.map +1 -1
  80. package/dist/provider/index.d.ts +4 -4
  81. package/dist/provider/index.js +5 -5
  82. package/dist/resource-view/index.d.ts +9 -2
  83. package/dist/resource-view/index.js +13 -4
  84. package/dist/resource-view/index.js.map +1 -1
  85. package/dist/schema/index.d.ts +3 -3
  86. package/dist/schema/index.js +2 -2
  87. package/dist/storage/index.js +1 -1
  88. package/dist/testing/index.d.ts +2 -2
  89. package/dist/testing/index.js +1 -1
  90. package/dist/{types-BzLv8yOm.d.ts → types-CtJxwoyv.d.ts} +6 -0
  91. package/dist/{write-outcome-DC5hORz-.d.ts → write-outcome-Goy1v39G.d.ts} +4 -2
  92. package/package.json +1 -1
  93. package/dist/chunk-HYYTAJBG.js.map +0 -1
  94. package/dist/chunk-LG6TUBVM.js.map +0 -1
  95. package/dist/chunk-OC4OGB2K.js.map +0 -1
  96. package/dist/chunk-PSFKIG27.js.map +0 -1
  97. package/dist/chunk-VJGU6E4U.js.map +0 -1
  98. package/dist/chunk-ZHC3MDCS.js.map +0 -1
  99. package/dist/chunk-ZYJUEJ4Z.js.map +0 -1
@@ -1,19 +1,19 @@
1
- export { blankValues, buildArrayItemDefaults, useResourceForm } from '../chunk-3B5O36DU.js';
2
- import '../chunk-2WS4LGYU.js';
1
+ export { blankValues, buildArrayItemDefaults, useResourceForm } from '../chunk-OYDJGPDY.js';
2
+ import '../chunk-LKRJB632.js';
3
3
  import '../chunk-RVWKVD5Q.js';
4
4
  import '../chunk-7NUL32W7.js';
5
- import '../chunk-LOJGHR5O.js';
6
- import '../chunk-XVRIWP7B.js';
7
- import '../chunk-YNXLPOAB.js';
8
- import '../chunk-2VJQVAJD.js';
5
+ import '../chunk-NE2D74BP.js';
6
+ import '../chunk-S2VYJWB4.js';
7
+ import '../chunk-RFHUOXZC.js';
8
+ import '../chunk-KA3BUJ4H.js';
9
9
  import '../chunk-AJGVLF37.js';
10
10
  import '../chunk-7PUFVNPB.js';
11
- import '../chunk-PSFKIG27.js';
12
- import '../chunk-ZYJUEJ4Z.js';
11
+ import '../chunk-2K4747KX.js';
12
+ import '../chunk-4PTQYT5J.js';
13
13
  import '../chunk-AUVKRXRC.js';
14
- import '../chunk-VFT6QKZW.js';
14
+ import '../chunk-NOPS5EIH.js';
15
15
  import '../chunk-HUNGCTRA.js';
16
16
  import '../chunk-RYEXWQFD.js';
17
- import '../chunk-LG6TUBVM.js';
17
+ import '../chunk-WLDSIQJ2.js';
18
18
  //# sourceMappingURL=use-resource-form.js.map
19
19
  //# sourceMappingURL=use-resource-form.js.map
@@ -1,5 +1,5 @@
1
1
  import { UseQueryResult, UseMutationResult } from '@tanstack/react-query';
2
- import { S as SortParam, a as FilterParam, I as InvalidationKey, s as ListResult, L as ListParams, b as Identifier, B as BaseRecord } from '../types-BzLv8yOm.js';
2
+ import { S as SortParam, a as FilterParam, I as InvalidationKey, s as ListResult, L as ListParams, b as Identifier, B as BaseRecord } from '../types-CtJxwoyv.js';
3
3
  import { MutationModeOptions } from './mutation-mode.js';
4
4
  import { LiveOptions } from './use-live.js';
5
5
 
@@ -1,16 +1,16 @@
1
- export { useResource } from '../chunk-OC4OGB2K.js';
1
+ export { useResource } from '../chunk-P3FHXRS2.js';
2
2
  import '../chunk-7NUL32W7.js';
3
- import '../chunk-XVRIWP7B.js';
4
- import '../chunk-YNXLPOAB.js';
5
- import '../chunk-2VJQVAJD.js';
3
+ import '../chunk-S2VYJWB4.js';
4
+ import '../chunk-RFHUOXZC.js';
5
+ import '../chunk-KA3BUJ4H.js';
6
6
  import '../chunk-AJGVLF37.js';
7
7
  import '../chunk-7PUFVNPB.js';
8
- import '../chunk-PSFKIG27.js';
9
- import '../chunk-ZYJUEJ4Z.js';
8
+ import '../chunk-2K4747KX.js';
9
+ import '../chunk-4PTQYT5J.js';
10
10
  import '../chunk-AUVKRXRC.js';
11
- import '../chunk-VFT6QKZW.js';
11
+ import '../chunk-NOPS5EIH.js';
12
12
  import '../chunk-HUNGCTRA.js';
13
13
  import '../chunk-RYEXWQFD.js';
14
- import '../chunk-LG6TUBVM.js';
14
+ import '../chunk-WLDSIQJ2.js';
15
15
  //# sourceMappingURL=use-resource.js.map
16
16
  //# sourceMappingURL=use-resource.js.map
@@ -1,5 +1,5 @@
1
1
  import { QueryClient, MutationOptions } from '@tanstack/react-query';
2
- import { I as InvalidationKey } from '../types-BzLv8yOm.js';
2
+ import { I as InvalidationKey } from '../types-CtJxwoyv.js';
3
3
 
4
4
  declare const WRITE_FAILED = "That didn't work. Try again.";
5
5
  interface UseWriteOptions<A, R> {
@@ -1,4 +1,4 @@
1
- export { WRITE_FAILED, useWrite, writeMutation } from '../chunk-52T2EYXH.js';
2
- import '../chunk-LG6TUBVM.js';
1
+ export { WRITE_FAILED, useWrite, writeMutation } from '../chunk-NQFIAULD.js';
2
+ import '../chunk-WLDSIQJ2.js';
3
3
  //# sourceMappingURL=use-write.js.map
4
4
  //# sourceMappingURL=use-write.js.map
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { L as ListParams, b as Identifier } from './types-BzLv8yOm.js';
2
- export { A as ArrayFilter, c as AuditEntry, B as BaseRecord, d as BulkChange, e as BulkResult, C as CountMode, f as CreateParams, g as CreateResult, D as DataProvider, h as DataRow, i as DeleteParams, j as DeleteResult, k as FieldPermissions, l as FieldReference, F as FieldSchema, m as FieldType, n as FilterOperator, a as FilterParam, G as GetManyParams, o as GetManyResult, p as GetOneParams, q as GetOneResult, H as HistoryParams, r as ImportParams, I as InvalidationKey, s as ListResult, N as NullFilter, P as PaginationParam, t as ProviderCapabilities, R as RangeFilter, u as RecordComment, v as ResourceAccess, w as ResourceChangeEvent, x as ResourceContract, y as ResourceFormFieldDef, z as ResourceRelation, E as ResourceSchema, J as ResourceSummary, K as RowAction, M as RowFailure, O as RowOf, Q as ScalarFilter, T as SelectOption, S as SortParam, U as StorageType, V as SubscribeParams, X as UpdateParams, Y as UpdateResult, Z as VersionField, m as WidgetHint, W as WriteEvent, _ as defineResource } from './types-BzLv8yOm.js';
3
- export { D as DataWriteError, a as DataWriteErrorOptions, W as WriteOutcome, i as isDataWriteError } from './write-outcome-DC5hORz-.js';
1
+ import { L as ListParams, b as Identifier } from './types-CtJxwoyv.js';
2
+ export { A as ArrayFilter, c as AuditEntry, B as BaseRecord, d as BulkChange, e as BulkResult, C as CountMode, f as CreateParams, g as CreateResult, D as DataProvider, h as DataRow, i as DeleteParams, j as DeleteResult, k as FieldPermissions, l as FieldReference, F as FieldSchema, m as FieldType, n as FilterOperator, a as FilterParam, G as GetManyParams, o as GetManyResult, p as GetOneParams, q as GetOneResult, H as HistoryParams, r as ImportParams, I as InvalidationKey, s as ListResult, N as NullFilter, P as PaginationParam, t as ProviderCapabilities, R as RangeFilter, u as RecordComment, v as ResourceAccess, w as ResourceChangeEvent, x as ResourceContract, y as ResourceFormFieldDef, z as ResourceRelation, E as ResourceSchema, J as ResourceSummary, K as RowAction, M as RowFailure, O as RowOf, Q as ScalarFilter, T as SelectOption, S as SortParam, U as StorageType, V as SubscribeParams, X as UpdateParams, Y as UpdateResult, Z as VersionField, m as WidgetHint, W as WriteEvent, _ as defineResource } from './types-CtJxwoyv.js';
3
+ export { D as DataWriteError, a as DataWriteErrorOptions, N as NO_ROWS_MATCHED, W as WriteOutcome, i as isDataWriteError } from './write-outcome-Goy1v39G.js';
4
4
  export { CallRpcOptions, CreateOrAdoptOptions, CreateOrAdoptResult, DEFAULT_RPC_MESSAGES, DataProviderRoot, DataProviderRootProps, GenesisProvider, GenesisProviderProps, MockProviderOptions, PostgrestFieldErrors, RPC_FAILED, RpcClient, SupabaseClient, SupabaseClientInput, SupabaseProviderOptions, SupabaseRealtimeChannel, SupabaseRealtimePayload, SupabaseResourceConfig, SupabaseUpdateContext, SupabaseWriteContext, callRpc, createMockProvider, createOrAdopt, createSupabaseProvider, fieldErrorsFromPostgrest, readOutcomeFromCode, toDataWriteError, useDataProvider, useStorage, writeOutcomeFromCode } from './provider/index.js';
5
5
  export { D as DataReadError, a as DataReadErrorOptions, R as ReadOutcome, i as isDataReadError, r as readFailureMessage } from './read-outcome-BnboMYOV.js';
6
6
  export { S as StorageAdapter } from './types-DKcxHXxq.js';
package/dist/index.js CHANGED
@@ -1,37 +1,37 @@
1
+ export { DEFAULT_RPC_MESSAGES, RPC_FAILED, callRpc, createOrAdopt, createSupabaseProvider } from './chunk-JN47G4UE.js';
1
2
  export { defineResource } from './chunk-YDMKMNDS.js';
2
3
  export { decodeRecordKey, encodeRecordKey, keyFields } from './chunk-KV2HW4G4.js';
3
4
  import './chunk-XCX2TRBL.js';
4
- export { DEFAULT_RPC_MESSAGES, RPC_FAILED, callRpc, createOrAdopt, createSupabaseProvider } from './chunk-ZHC3MDCS.js';
5
- export { ViewerScope, WorkspaceScope, clearViewerCache, rememberedWorkspaceId, scopeClock, useOptionalViewerScope, useViewer, useViewerScope, useWorkspace } from './chunk-C62CMLWG.js';
5
+ export { ViewerScope, WorkspaceScope, clearViewerCache, rememberedWorkspaceId, scopeClock, useOptionalViewerScope, useViewer, useViewerScope, useWorkspace } from './chunk-AHFIS42U.js';
6
6
  export { NO_VIEWER } from './chunk-OZYF55E3.js';
7
- export { usePersistedUiState } from './chunk-HYYTAJBG.js';
8
- export { blankValues, buildArrayItemDefaults, useResourceForm } from './chunk-3B5O36DU.js';
9
- export { writeConflict } from './chunk-2WS4LGYU.js';
10
- export { useResource } from './chunk-OC4OGB2K.js';
7
+ export { usePersistedUiState } from './chunk-SDAJSJNN.js';
8
+ export { blankValues, buildArrayItemDefaults, useResourceForm } from './chunk-OYDJGPDY.js';
9
+ export { writeConflict } from './chunk-LKRJB632.js';
10
+ export { useResource } from './chunk-P3FHXRS2.js';
11
11
  export { DEFAULT_UNSAVED_CHANGES_MESSAGE, useUnsavedChangesGuard } from './chunk-RVWKVD5Q.js';
12
12
  export { useWizard } from './chunk-7KOLYF27.js';
13
- export { WRITE_FAILED, useWrite } from './chunk-52T2EYXH.js';
13
+ export { WRITE_FAILED, useWrite } from './chunk-NQFIAULD.js';
14
14
  import './chunk-7NUL32W7.js';
15
- export { useDraft } from './chunk-YQBWXG2G.js';
16
- export { useLinkOptions } from './chunk-VJGU6E4U.js';
17
- export { loadRelationLabel, relationNamingField, useRelationLabel } from './chunk-42QPCDQF.js';
18
- export { useInfiniteResource } from './chunk-POMTRNAL.js';
19
- export { useOne } from './chunk-LOJGHR5O.js';
20
- export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS, useLiveInvalidation } from './chunk-XVRIWP7B.js';
15
+ export { useDraft } from './chunk-YZV3Z6ZA.js';
16
+ export { useLinkOptions } from './chunk-DFABPMEQ.js';
17
+ export { loadRelationLabel, relationNamingField, useRelationLabel } from './chunk-WDPM5TBO.js';
18
+ export { useInfiniteResource } from './chunk-G6GQPXQS.js';
19
+ export { useOne } from './chunk-NE2D74BP.js';
20
+ export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS, useLiveInvalidation } from './chunk-S2VYJWB4.js';
21
21
  import './chunk-UHOMTFBD.js';
22
- export { DEFAULT_DRAFT_DELAY_MS, DRAFT_NOT_SAVED, DraftController, isNetworkFailure, stableJson } from './chunk-HBAPYA5K.js';
23
- export { DEFAULT_UNDO_DELAY_MS, dropPendingWrites, flushPendingWrites, pendingWriteCount } from './chunk-YNXLPOAB.js';
24
- export { useCapabilities } from './chunk-2VJQVAJD.js';
22
+ export { DEFAULT_DRAFT_DELAY_MS, DRAFT_NOT_SAVED, DraftController, isNetworkFailure, stableJson } from './chunk-5ASUMG6K.js';
23
+ export { DEFAULT_UNDO_DELAY_MS, dropPendingWrites, flushPendingWrites, pendingWriteCount } from './chunk-RFHUOXZC.js';
24
+ export { useCapabilities } from './chunk-KA3BUJ4H.js';
25
25
  import './chunk-AJGVLF37.js';
26
26
  export { defineQueryKeys, resourceKeys } from './chunk-7PUFVNPB.js';
27
- export { DataProviderRoot, GenesisProvider, createMockProvider, useDataProvider, useStorage } from './chunk-PSFKIG27.js';
28
- export { createLocalStorageAdapter, createMemoryStorageAdapter, createNoopStorageAdapter } from './chunk-ZYJUEJ4Z.js';
27
+ export { DataProviderRoot, GenesisProvider, createMockProvider, useDataProvider, useStorage } from './chunk-2K4747KX.js';
28
+ export { createLocalStorageAdapter, createMemoryStorageAdapter, createNoopStorageAdapter } from './chunk-4PTQYT5J.js';
29
29
  import './chunk-AUVKRXRC.js';
30
30
  import './chunk-WXENWPWP.js';
31
- export { classifyError, defaultErrorReporter, errorMessages, fieldErrorsFromPostgrest, getErrorReporter, readOutcomeFromCode, reportError, setErrorReporter, toDataWriteError, writeOutcomeFromCode } from './chunk-VFT6QKZW.js';
31
+ export { classifyError, defaultErrorReporter, errorMessages, fieldErrorsFromPostgrest, getErrorReporter, readOutcomeFromCode, reportError, setErrorReporter, toDataWriteError, writeOutcomeFromCode } from './chunk-NOPS5EIH.js';
32
32
  export { DataReadError, isDataReadError, readFailureMessage } from './chunk-HUNGCTRA.js';
33
33
  export { titleCase } from './chunk-RYEXWQFD.js';
34
- export { DataWriteError, isDataWriteError } from './chunk-LG6TUBVM.js';
34
+ export { DataWriteError, NO_ROWS_MATCHED, isDataWriteError } from './chunk-WLDSIQJ2.js';
35
35
  import './chunk-65SXNHWE.js';
36
36
  export { isSafeUrl, normalizeLinkUrl } from './chunk-YDDPFSQ6.js';
37
37
  //# sourceMappingURL=index.js.map
@@ -104,5 +104,22 @@ interface ResolvedNavigation<T> {
104
104
  * @stability Beta
105
105
  */
106
106
  declare function resolveNavigation<T>(tree: NavigationNode<T>, pathname: string): ResolvedNavigation<T>;
107
+ /**
108
+ * Most slots a phone bottom tab bar shows before the rest go under "More".
109
+ *
110
+ * @stability Beta
111
+ */
112
+ declare const TAB_BAR_MAX = 5;
113
+ /**
114
+ * A phone bottom tab bar's split: up to `max` items fit; beyond that, the first `max - 1` show
115
+ * and the rest go under "More" in the last slot. Pure, so the web `TabBar`, AppShell's phone
116
+ * bottom nav and genesis-ui-native's `NativeTabBar` all split the same way.
117
+ *
118
+ * @stability Beta
119
+ */
120
+ declare function splitTabBarItems<T>(items: readonly T[], max?: number): {
121
+ shown: T[];
122
+ more: T[];
123
+ };
107
124
 
108
- export { type IsPathActiveOptions, type NavigationNode, type ResolvedNavigation, isPathActive, resolveNavigation };
125
+ export { type IsPathActiveOptions, type NavigationNode, type ResolvedNavigation, TAB_BAR_MAX, isPathActive, resolveNavigation, splitTabBarItems };
@@ -100,7 +100,13 @@ function resolveNavigation(tree, pathname) {
100
100
  params
101
101
  };
102
102
  }
103
+ var TAB_BAR_MAX = 5;
104
+ function splitTabBarItems(items, max = TAB_BAR_MAX) {
105
+ const slots = Math.max(1, max);
106
+ if (items.length <= slots) return { shown: [...items], more: [] };
107
+ return { shown: items.slice(0, slots - 1), more: items.slice(slots - 1) };
108
+ }
103
109
 
104
- export { isPathActive, resolveNavigation };
110
+ export { TAB_BAR_MAX, isPathActive, resolveNavigation, splitTabBarItems };
105
111
  //# sourceMappingURL=navigation.js.map
106
112
  //# sourceMappingURL=navigation.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/navigation.ts"],"names":["trail"],"mappings":";AAOA,SAAS,oBAAoB,IAAA,EAAsB;AACjD,EAAA,IAAI,MAAM,IAAA,CAAK,MAAA;AACf,EAAA,OAAO,MAAM,CAAA,IAAK,IAAA,CAAK,WAAW,GAAA,GAAM,CAAC,MAAM,EAAA,EAAI,GAAA,EAAA;AACnD,EAAA,OAAO,IAAA,CAAK,KAAA,CAAM,CAAA,EAAG,GAAG,CAAA;AAC1B;AAMA,SAAS,UAAU,IAAA,EAA8D;AAC/E,EAAA,MAAM,MAAA,GAAS,IAAA,CAAK,OAAA,CAAQ,GAAG,CAAA;AAC/B,EAAA,MAAM,OAAO,MAAA,KAAW,EAAA,GAAK,KAAK,IAAA,CAAK,KAAA,CAAM,SAAS,CAAC,CAAA;AACvD,EAAA,MAAM,aAAa,MAAA,KAAW,EAAA,GAAK,OAAO,IAAA,CAAK,KAAA,CAAM,GAAG,MAAM,CAAA;AAC9D,EAAA,MAAM,QAAA,GAAW,UAAA,CAAW,OAAA,CAAQ,GAAG,CAAA;AACvC,EAAA,MAAM,UAAU,QAAA,KAAa,EAAA,GAAK,aAAa,UAAA,CAAW,KAAA,CAAM,GAAG,QAAQ,CAAA;AAC3E,EAAA,OAAO;AAAA,IACL,MAAM,OAAA,CAAQ,MAAA,GAAS,IAAI,mBAAA,CAAoB,OAAO,KAAK,GAAA,GAAM,OAAA;AAAA,IACjE,QAAQ,QAAA,KAAa,EAAA,GAAK,KAAK,UAAA,CAAW,KAAA,CAAM,WAAW,CAAC,CAA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AI,IAAA,CAAK,UAAA,CAAW,GAAG,CAAA,EAAG,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,CAAC,CAAC,CAAA,GAAI,QAAA,CAAS,CAAC,CAAA;AAAA,EAC9D,CAAC,CAAA;AAED,EAAA,MAAM,WAAA,GAAc,CAAC,IAAA,MAAgD;AAAA,IACnE,GAAG,IAAA;AAAA,IACH,IAAA,EAAM,KAAK,IAAA,CACR,KAAA,CAAM,GAAG,CAAA,CACT,GAAA,CAAI,CAAC,IAAA,KAAS;AACb,MAAA,IAAI,CAAC,IAAA,CAAK,UAAA,CAAW,GAAG,GAAG,OAAO,IAAA;AAClC,MAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,CAAC,CAAC,CAAA;AAClC,MAAA,OAAO,KAAA,IAAS,IAAA,GAAO,IAAA,GAAO,kBAAA,CAAmB,KAAK,CAAA;AAAA,IACxD,CAAC,CAAA,CACA,IAAA,CAAK,GAAG;AAAA,GACb,CAAA;AAEA,EAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,KAAA,CAAM,GAAA,CAAI,WAAW,CAAA;AAC1C,EAAA,MAAM,OAAA,GAAU,KAAA,CAAM,KAAA,CAAM,MAAA,GAAS,CAAC,CAAA;AACtC,EAAA,OAAO;AAAA,IACL,OAAA;AAAA,IACA,MAAA,EAAQ,MAAM,MAAA,GAAS,CAAA,GAAI,MAAM,KAAA,CAAM,MAAA,GAAS,CAAC,CAAA,GAAI,MAAA;AAAA,IACrD,OAAO,OAAA,CAAQ,KAAA;AAAA,IACf,KAAA;AAAA,IACA;AAAA,GACF;AACF","file":"navigation.js","sourcesContent":["/**\n * Router-free, DOM-free navigation: the logical navigation tree and the\n * active-path matcher, shared by the web app shell and native shells.\n * `resolveNavigation` never reads browser history or `window`.\n */\n\n/** `path` without its trailing slashes, in one linear pass (a regex can backtrack on many slashes). */\nfunction trimTrailingSlashes(path: string): string {\n let end = path.length;\n while (end > 0 && path.charCodeAt(end - 1) === 47) end--;\n return path.slice(0, end);\n}\n\n/**\n * Split a href into its path (trailing slash dropped, except for `/`), query\n * (no `?`) and hash (no `#`).\n */\nfunction splitHref(href: string): { path: string; search: string; hash: string } {\n const hashAt = href.indexOf(\"#\");\n const hash = hashAt === -1 ? \"\" : href.slice(hashAt + 1);\n const beforeHash = hashAt === -1 ? href : href.slice(0, hashAt);\n const searchAt = beforeHash.indexOf(\"?\");\n const rawPath = searchAt === -1 ? beforeHash : beforeHash.slice(0, searchAt);\n return {\n path: rawPath.length > 1 ? trimTrailingSlashes(rawPath) || \"/\" : rawPath,\n search: searchAt === -1 ? \"\" : beforeHash.slice(searchAt + 1),\n hash,\n };\n}\n\n/**\n * Options for {@link isPathActive}.\n *\n * @stability Beta\n */\nexport interface IsPathActiveOptions {\n /** Require an exact path match instead of a prefix match (like `NavLink end`). */\n end?: boolean;\n}\n\n/**\n * Default active-path matcher, mirroring React Router's `NavLink` (prefix\n * match, with `/` treated as exact). Consumers can override via an `isActive`\n * prop where components accept one.\n *\n * `activePath` may carry a query and hash (`pathname + search + hash`). An\n * item whose `to` has neither compares against the path part only, exactly as\n * before. An item that opts in by putting a query or hash in its `to`\n * (`/admin?tab=users`, `/settings#profile`) is active only when the path\n * matches exactly AND every query param it names has the same value in\n * `activePath` (extra params such as `&page=2` are ignored) AND, if it names a\n * hash, the hash is equal.\n *\n * @stability Beta\n */\nexport function isPathActive(\n to: string,\n activePath?: string,\n options?: IsPathActiveOptions,\n): boolean {\n if (activePath == null) return false;\n if (to === activePath) return true;\n const target = splitHref(to);\n const current = splitHref(activePath);\n\n if (!target.search && !target.hash) {\n if (target.path === current.path) return true;\n if (options?.end) return false;\n return target.path !== \"/\" && current.path.startsWith(target.path + \"/\");\n }\n\n if (target.path !== current.path) return false;\n if (target.hash && target.hash !== current.hash) return false;\n if (target.search) {\n const want = new URLSearchParams(target.search);\n const have = new URLSearchParams(current.search);\n for (const key of new Set(want.keys())) {\n const wanted = want.getAll(key);\n const had = have.getAll(key);\n if (!wanted.every((value) => had.includes(value))) return false;\n }\n }\n return true;\n}\n\n// ---------------------------------------------------------------------------\n// Hierarchical navigation resolver\n// ---------------------------------------------------------------------------\n\n/**\n * One node of a logical navigation hierarchy. `path` is a route pattern whose\n * segments are either static (`clients`) or named params (`$clientId`). A\n * node's place in the tree is its LOGICAL parent, which need not share its URL\n * prefix — `/clients/$clientId` can sit under `/dashboard`.\n *\n * @stability Beta\n */\nexport interface NavigationNode<T> {\n id: string;\n path: string;\n label: string;\n /** Contextual nav items to show while this node is current. */\n items: T[];\n children?: NavigationNode<T>[];\n /**\n * Ask the app shell to open its desktop sidebar collapsed (icon rail) while\n * this node, or a descendant that doesn't set its own value, is current.\n * The nearest node in the resolved trail that sets it wins, so\n * `defaultCollapsed: false` on a child re-opens it under a collapsed\n * parent. Only a default: once the user has toggled the sidebar, their\n * choice wins everywhere. `AppShell` reads it; `resolveNavigation` copies\n * it through untouched.\n *\n * @stability Beta\n */\n defaultCollapsed?: boolean;\n /**\n * How the app shell shows this node's `items` (its child pages, e.g. a\n * form's Questions / Logic / Responses / Settings). `\"tabs\"` (across the\n * top of the content) or `\"sidebar\"` (nested under the active item) turn\n * shell sub-navigation on, which also gives phones a back item plus the\n * children in the bottom bar. `\"section\"` is the legacy rendering (the\n * shell's default) and `\"off\"` hides them. The nearest node in the trail\n * that sets it wins over the shell's `options.subNav`.\n *\n * @stability Beta\n */\n subNav?: \"section\" | \"tabs\" | \"sidebar\" | \"off\";\n}\n\n/**\n * Result of {@link resolveNavigation}. `current`, `parent` and every `trail`\n * entry are shallow copies of their tree nodes with `path` interpolated from\n * `params` (a param the URL did not supply stays as `$name`).\n *\n * @stability Beta\n */\nexport interface ResolvedNavigation<T> {\n /** The best-matching node — the root when nothing else matches. */\n current: NavigationNode<T>;\n /** `current`'s logical parent, for an \"up\" / back-to-parent link. */\n parent?: NavigationNode<T>;\n /** `current.items`. */\n items: T[];\n /** Root → `current`, inclusive. */\n trail: NavigationNode<T>[];\n /** Params captured by `current.path`, URL-decoded. */\n params: Record<string, string>;\n}\n\nfunction pathSegments(path: string): string[] {\n return splitHref(path).path.split(\"/\").filter(Boolean);\n}\n\nfunction decodeSegment(segment: string): string {\n try {\n return decodeURIComponent(segment);\n } catch {\n return segment;\n }\n}\n\n/**\n * Resolve where `pathname` sits in a logical navigation tree. Pure: it never\n * reads browser history or `window`.\n *\n * A node matches when its pattern matches a leading run of WHOLE path\n * segments (`/my` matches `/my/tasks`, never `/my-other`). Among matches the\n * winner is decided by positional specificity: at the first position where\n * one pattern is static and the other a `$param`, the static one wins (so\n * `/clients/new` beats `/clients/$clientId` whatever the sibling order, and\n * `/my` beats `/$space/tasks` for `/my/tasks`). Otherwise the pattern matching\n * more segments wins, then the deeper tree node.\n * Non-matching nodes are still searched, so a match keeps its logical\n * ancestors even when their URLs differ.\n *\n * @stability Beta\n */\nexport function resolveNavigation<T>(\n tree: NavigationNode<T>,\n pathname: string,\n): ResolvedNavigation<T> {\n // Compare decoded forms on both sides, so `/caf%C3%A9` matches a `/café`\n // node (and an encoded pattern matches a decoded pathname).\n const segments = pathSegments(pathname).map(decodeSegment);\n\n type Match = { trail: NavigationNode<T>[]; pattern: string[] };\n const matches = (pattern: string[]) =>\n pattern.length <= segments.length &&\n pattern.every(\n (part, i) => part.startsWith(\"$\") || decodeSegment(part) === segments[i],\n );\n\n // > 0 when `a` should win over `b`.\n // Positional specificity, as TanStack Router and React Router rank routes:\n // walking left to right, the first position where one pattern is static and\n // the other a `$param` decides. Only then does the longer match win.\n const compare = (a: Match, b: Match): number => {\n const shared = Math.min(a.pattern.length, b.pattern.length);\n for (let i = 0; i < shared; i++) {\n const aParam = a.pattern[i]!.startsWith(\"$\");\n const bParam = b.pattern[i]!.startsWith(\"$\");\n if (aParam !== bParam) return aParam ? -1 : 1;\n }\n if (a.pattern.length !== b.pattern.length) {\n return a.pattern.length - b.pattern.length;\n }\n return a.trail.length - b.trail.length;\n };\n\n let best: Match | undefined;\n const visit = (node: NavigationNode<T>, ancestors: NavigationNode<T>[]) => {\n const trail = [...ancestors, node];\n const pattern = pathSegments(node.path);\n if (matches(pattern)) {\n const candidate = { trail, pattern };\n if (!best || compare(candidate, best) > 0) best = candidate;\n }\n for (const child of node.children ?? []) visit(child, trail);\n };\n visit(tree, []);\n\n const winner: Match = best ?? { trail: [tree], pattern: [] };\n const params: Record<string, string> = {};\n winner.pattern.forEach((part, i) => {\n if (part.startsWith(\"$\")) params[part.slice(1)] = segments[i]!;\n });\n\n const interpolate = (node: NavigationNode<T>): NavigationNode<T> => ({\n ...node,\n path: node.path\n .split(\"/\")\n .map((part) => {\n if (!part.startsWith(\"$\")) return part;\n const value = params[part.slice(1)];\n return value == null ? part : encodeURIComponent(value);\n })\n .join(\"/\"),\n });\n\n const trail = winner.trail.map(interpolate);\n const current = trail[trail.length - 1]!;\n return {\n current,\n parent: trail.length > 1 ? trail[trail.length - 2] : undefined,\n items: current.items,\n trail,\n params,\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/navigation.ts"],"names":["trail"],"mappings":";AAOA,SAAS,oBAAoB,IAAA,EAAsB;AACjD,EAAA,IAAI,MAAM,IAAA,CAAK,MAAA;AACf,EAAA,OAAO,MAAM,CAAA,IAAK,IAAA,CAAK,WAAW,GAAA,GAAM,CAAC,MAAM,EAAA,EAAI,GAAA,EAAA;AACnD,EAAA,OAAO,IAAA,CAAK,KAAA,CAAM,CAAA,EAAG,GAAG,CAAA;AAC1B;AAMA,SAAS,UAAU,IAAA,EAA8D;AAC/E,EAAA,MAAM,MAAA,GAAS,IAAA,CAAK,OAAA,CAAQ,GAAG,CAAA;AAC/B,EAAA,MAAM,OAAO,MAAA,KAAW,EAAA,GAAK,KAAK,IAAA,CAAK,KAAA,CAAM,SAAS,CAAC,CAAA;AACvD,EAAA,MAAM,aAAa,MAAA,KAAW,EAAA,GAAK,OAAO,IAAA,CAAK,KAAA,CAAM,GAAG,MAAM,CAAA;AAC9D,EAAA,MAAM,QAAA,GAAW,UAAA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AS,CAAC,CAAA,GAAI,MAAA;AAAA,IACrD,OAAO,OAAA,CAAQ,KAAA;AAAA,IACf,KAAA;AAAA,IACA;AAAA,GACF;AACF;AAOO,IAAM,WAAA,GAAc;AASpB,SAAS,gBAAA,CAAoB,KAAA,EAAqB,GAAA,GAAc,WAAA,EAAwC;AAC7G,EAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,GAAA,CAAI,CAAA,EAAG,GAAG,CAAA;AAC7B,EAAA,IAAI,KAAA,CAAM,MAAA,IAAU,KAAA,EAAO,OAAO,EAAE,KAAA,EAAO,CAAC,GAAG,KAAK,CAAA,EAAG,IAAA,EAAM,EAAC,EAAE;AAChE,EAAA,OAAO,EAAE,KAAA,EAAO,KAAA,CAAM,KAAA,CAAM,CAAA,EAAG,KAAA,GAAQ,CAAC,CAAA,EAAG,IAAA,EAAM,KAAA,CAAM,KAAA,CAAM,KAAA,GAAQ,CAAC,CAAA,EAAE;AAC1E","file":"navigation.js","sourcesContent":["/**\n * Router-free, DOM-free navigation: the logical navigation tree and the\n * active-path matcher, shared by the web app shell and native shells.\n * `resolveNavigation` never reads browser history or `window`.\n */\n\n/** `path` without its trailing slashes, in one linear pass (a regex can backtrack on many slashes). */\nfunction trimTrailingSlashes(path: string): string {\n let end = path.length;\n while (end > 0 && path.charCodeAt(end - 1) === 47) end--;\n return path.slice(0, end);\n}\n\n/**\n * Split a href into its path (trailing slash dropped, except for `/`), query\n * (no `?`) and hash (no `#`).\n */\nfunction splitHref(href: string): { path: string; search: string; hash: string } {\n const hashAt = href.indexOf(\"#\");\n const hash = hashAt === -1 ? \"\" : href.slice(hashAt + 1);\n const beforeHash = hashAt === -1 ? href : href.slice(0, hashAt);\n const searchAt = beforeHash.indexOf(\"?\");\n const rawPath = searchAt === -1 ? beforeHash : beforeHash.slice(0, searchAt);\n return {\n path: rawPath.length > 1 ? trimTrailingSlashes(rawPath) || \"/\" : rawPath,\n search: searchAt === -1 ? \"\" : beforeHash.slice(searchAt + 1),\n hash,\n };\n}\n\n/**\n * Options for {@link isPathActive}.\n *\n * @stability Beta\n */\nexport interface IsPathActiveOptions {\n /** Require an exact path match instead of a prefix match (like `NavLink end`). */\n end?: boolean;\n}\n\n/**\n * Default active-path matcher, mirroring React Router's `NavLink` (prefix\n * match, with `/` treated as exact). Consumers can override via an `isActive`\n * prop where components accept one.\n *\n * `activePath` may carry a query and hash (`pathname + search + hash`). An\n * item whose `to` has neither compares against the path part only, exactly as\n * before. An item that opts in by putting a query or hash in its `to`\n * (`/admin?tab=users`, `/settings#profile`) is active only when the path\n * matches exactly AND every query param it names has the same value in\n * `activePath` (extra params such as `&page=2` are ignored) AND, if it names a\n * hash, the hash is equal.\n *\n * @stability Beta\n */\nexport function isPathActive(\n to: string,\n activePath?: string,\n options?: IsPathActiveOptions,\n): boolean {\n if (activePath == null) return false;\n if (to === activePath) return true;\n const target = splitHref(to);\n const current = splitHref(activePath);\n\n if (!target.search && !target.hash) {\n if (target.path === current.path) return true;\n if (options?.end) return false;\n return target.path !== \"/\" && current.path.startsWith(target.path + \"/\");\n }\n\n if (target.path !== current.path) return false;\n if (target.hash && target.hash !== current.hash) return false;\n if (target.search) {\n const want = new URLSearchParams(target.search);\n const have = new URLSearchParams(current.search);\n for (const key of new Set(want.keys())) {\n const wanted = want.getAll(key);\n const had = have.getAll(key);\n if (!wanted.every((value) => had.includes(value))) return false;\n }\n }\n return true;\n}\n\n// ---------------------------------------------------------------------------\n// Hierarchical navigation resolver\n// ---------------------------------------------------------------------------\n\n/**\n * One node of a logical navigation hierarchy. `path` is a route pattern whose\n * segments are either static (`clients`) or named params (`$clientId`). A\n * node's place in the tree is its LOGICAL parent, which need not share its URL\n * prefix — `/clients/$clientId` can sit under `/dashboard`.\n *\n * @stability Beta\n */\nexport interface NavigationNode<T> {\n id: string;\n path: string;\n label: string;\n /** Contextual nav items to show while this node is current. */\n items: T[];\n children?: NavigationNode<T>[];\n /**\n * Ask the app shell to open its desktop sidebar collapsed (icon rail) while\n * this node, or a descendant that doesn't set its own value, is current.\n * The nearest node in the resolved trail that sets it wins, so\n * `defaultCollapsed: false` on a child re-opens it under a collapsed\n * parent. Only a default: once the user has toggled the sidebar, their\n * choice wins everywhere. `AppShell` reads it; `resolveNavigation` copies\n * it through untouched.\n *\n * @stability Beta\n */\n defaultCollapsed?: boolean;\n /**\n * How the app shell shows this node's `items` (its child pages, e.g. a\n * form's Questions / Logic / Responses / Settings). `\"tabs\"` (across the\n * top of the content) or `\"sidebar\"` (nested under the active item) turn\n * shell sub-navigation on, which also gives phones a back item plus the\n * children in the bottom bar. `\"section\"` is the legacy rendering (the\n * shell's default) and `\"off\"` hides them. The nearest node in the trail\n * that sets it wins over the shell's `options.subNav`.\n *\n * @stability Beta\n */\n subNav?: \"section\" | \"tabs\" | \"sidebar\" | \"off\";\n}\n\n/**\n * Result of {@link resolveNavigation}. `current`, `parent` and every `trail`\n * entry are shallow copies of their tree nodes with `path` interpolated from\n * `params` (a param the URL did not supply stays as `$name`).\n *\n * @stability Beta\n */\nexport interface ResolvedNavigation<T> {\n /** The best-matching node — the root when nothing else matches. */\n current: NavigationNode<T>;\n /** `current`'s logical parent, for an \"up\" / back-to-parent link. */\n parent?: NavigationNode<T>;\n /** `current.items`. */\n items: T[];\n /** Root → `current`, inclusive. */\n trail: NavigationNode<T>[];\n /** Params captured by `current.path`, URL-decoded. */\n params: Record<string, string>;\n}\n\nfunction pathSegments(path: string): string[] {\n return splitHref(path).path.split(\"/\").filter(Boolean);\n}\n\nfunction decodeSegment(segment: string): string {\n try {\n return decodeURIComponent(segment);\n } catch {\n return segment;\n }\n}\n\n/**\n * Resolve where `pathname` sits in a logical navigation tree. Pure: it never\n * reads browser history or `window`.\n *\n * A node matches when its pattern matches a leading run of WHOLE path\n * segments (`/my` matches `/my/tasks`, never `/my-other`). Among matches the\n * winner is decided by positional specificity: at the first position where\n * one pattern is static and the other a `$param`, the static one wins (so\n * `/clients/new` beats `/clients/$clientId` whatever the sibling order, and\n * `/my` beats `/$space/tasks` for `/my/tasks`). Otherwise the pattern matching\n * more segments wins, then the deeper tree node.\n * Non-matching nodes are still searched, so a match keeps its logical\n * ancestors even when their URLs differ.\n *\n * @stability Beta\n */\nexport function resolveNavigation<T>(\n tree: NavigationNode<T>,\n pathname: string,\n): ResolvedNavigation<T> {\n // Compare decoded forms on both sides, so `/caf%C3%A9` matches a `/café`\n // node (and an encoded pattern matches a decoded pathname).\n const segments = pathSegments(pathname).map(decodeSegment);\n\n type Match = { trail: NavigationNode<T>[]; pattern: string[] };\n const matches = (pattern: string[]) =>\n pattern.length <= segments.length &&\n pattern.every(\n (part, i) => part.startsWith(\"$\") || decodeSegment(part) === segments[i],\n );\n\n // > 0 when `a` should win over `b`.\n // Positional specificity, as TanStack Router and React Router rank routes:\n // walking left to right, the first position where one pattern is static and\n // the other a `$param` decides. Only then does the longer match win.\n const compare = (a: Match, b: Match): number => {\n const shared = Math.min(a.pattern.length, b.pattern.length);\n for (let i = 0; i < shared; i++) {\n const aParam = a.pattern[i]!.startsWith(\"$\");\n const bParam = b.pattern[i]!.startsWith(\"$\");\n if (aParam !== bParam) return aParam ? -1 : 1;\n }\n if (a.pattern.length !== b.pattern.length) {\n return a.pattern.length - b.pattern.length;\n }\n return a.trail.length - b.trail.length;\n };\n\n let best: Match | undefined;\n const visit = (node: NavigationNode<T>, ancestors: NavigationNode<T>[]) => {\n const trail = [...ancestors, node];\n const pattern = pathSegments(node.path);\n if (matches(pattern)) {\n const candidate = { trail, pattern };\n if (!best || compare(candidate, best) > 0) best = candidate;\n }\n for (const child of node.children ?? []) visit(child, trail);\n };\n visit(tree, []);\n\n const winner: Match = best ?? { trail: [tree], pattern: [] };\n const params: Record<string, string> = {};\n winner.pattern.forEach((part, i) => {\n if (part.startsWith(\"$\")) params[part.slice(1)] = segments[i]!;\n });\n\n const interpolate = (node: NavigationNode<T>): NavigationNode<T> => ({\n ...node,\n path: node.path\n .split(\"/\")\n .map((part) => {\n if (!part.startsWith(\"$\")) return part;\n const value = params[part.slice(1)];\n return value == null ? part : encodeURIComponent(value);\n })\n .join(\"/\"),\n });\n\n const trail = winner.trail.map(interpolate);\n const current = trail[trail.length - 1]!;\n return {\n current,\n parent: trail.length > 1 ? trail[trail.length - 2] : undefined,\n items: current.items,\n trail,\n params,\n };\n}\n\n/**\n * Most slots a phone bottom tab bar shows before the rest go under \"More\".\n *\n * @stability Beta\n */\nexport const TAB_BAR_MAX = 5;\n\n/**\n * A phone bottom tab bar's split: up to `max` items fit; beyond that, the first `max - 1` show\n * and the rest go under \"More\" in the last slot. Pure, so the web `TabBar`, AppShell's phone\n * bottom nav and genesis-ui-native's `NativeTabBar` all split the same way.\n *\n * @stability Beta\n */\nexport function splitTabBarItems<T>(items: readonly T[], max: number = TAB_BAR_MAX): { shown: T[]; more: T[] } {\n const slots = Math.max(1, max);\n if (items.length <= slots) return { shown: [...items], more: [] };\n return { shown: items.slice(0, slots - 1), more: items.slice(slots - 1) };\n}\n"]}
@@ -1,7 +1,7 @@
1
- import { D as DataProvider, b as Identifier, B as BaseRecord, I as InvalidationKey, W as WriteEvent, C as CountMode, a as FilterParam } from '../types-BzLv8yOm.js';
2
- export { A as ArrayFilter, d as BulkChange, e as BulkResult, f as CreateParams, g as CreateResult, i as DeleteParams, j as DeleteResult, G as GetManyParams, o as GetManyResult, p as GetOneParams, q as GetOneResult, H as HistoryParams, r as ImportParams, L as ListParams, s as ListResult, N as NullFilter, P as PaginationParam, R as RangeFilter, w as ResourceChangeEvent, M as RowFailure, Q as ScalarFilter, S as SortParam, V as SubscribeParams, X as UpdateParams, Y as UpdateResult } from '../types-BzLv8yOm.js';
3
- import { D as DataWriteError, W as WriteOutcome } from '../write-outcome-DC5hORz-.js';
4
- export { a as DataWriteErrorOptions, i as isDataWriteError } from '../write-outcome-DC5hORz-.js';
1
+ import { D as DataProvider, b as Identifier, B as BaseRecord, I as InvalidationKey, W as WriteEvent, C as CountMode, a as FilterParam } from '../types-CtJxwoyv.js';
2
+ export { A as ArrayFilter, d as BulkChange, e as BulkResult, f as CreateParams, g as CreateResult, i as DeleteParams, j as DeleteResult, G as GetManyParams, o as GetManyResult, p as GetOneParams, q as GetOneResult, H as HistoryParams, r as ImportParams, L as ListParams, s as ListResult, N as NullFilter, P as PaginationParam, R as RangeFilter, w as ResourceChangeEvent, M as RowFailure, Q as ScalarFilter, S as SortParam, V as SubscribeParams, X as UpdateParams, Y as UpdateResult } from '../types-CtJxwoyv.js';
3
+ import { D as DataWriteError, W as WriteOutcome } from '../write-outcome-Goy1v39G.js';
4
+ export { a as DataWriteErrorOptions, N as NO_ROWS_MATCHED, i as isDataWriteError } from '../write-outcome-Goy1v39G.js';
5
5
  import { D as DataReadError, R as ReadOutcome } from '../read-outcome-BnboMYOV.js';
6
6
  export { a as DataReadErrorOptions, i as isDataReadError, r as readFailureMessage } from '../read-outcome-BnboMYOV.js';
7
7
  import * as react from 'react';
@@ -1,9 +1,9 @@
1
- export { DEFAULT_RPC_MESSAGES, RPC_FAILED, callRpc, createOrAdopt, createSupabaseProvider } from '../chunk-ZHC3MDCS.js';
2
- export { DataProviderRoot, GenesisProvider, createMockProvider, useDataProvider, useStorage } from '../chunk-PSFKIG27.js';
3
- import '../chunk-ZYJUEJ4Z.js';
4
- export { fieldErrorsFromPostgrest, readOutcomeFromCode, toDataWriteError, writeOutcomeFromCode } from '../chunk-VFT6QKZW.js';
1
+ export { DEFAULT_RPC_MESSAGES, RPC_FAILED, callRpc, createOrAdopt, createSupabaseProvider } from '../chunk-JN47G4UE.js';
2
+ export { DataProviderRoot, GenesisProvider, createMockProvider, useDataProvider, useStorage } from '../chunk-2K4747KX.js';
3
+ import '../chunk-4PTQYT5J.js';
4
+ export { fieldErrorsFromPostgrest, readOutcomeFromCode, toDataWriteError, writeOutcomeFromCode } from '../chunk-NOPS5EIH.js';
5
5
  export { DataReadError, isDataReadError, readFailureMessage } from '../chunk-HUNGCTRA.js';
6
6
  import '../chunk-RYEXWQFD.js';
7
- export { DataWriteError, isDataWriteError } from '../chunk-LG6TUBVM.js';
7
+ export { DataWriteError, NO_ROWS_MATCHED, isDataWriteError } from '../chunk-WLDSIQJ2.js';
8
8
  //# sourceMappingURL=index.js.map
9
9
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { h as DataRow, x as ResourceContract, O as RowOf, K as RowAction, F as FieldSchema, a as FilterParam, b as Identifier } from '../types-BzLv8yOm.js';
1
+ import { h as DataRow, x as ResourceContract, O as RowOf, K as RowAction, F as FieldSchema, a as FilterParam, b as Identifier } from '../types-CtJxwoyv.js';
2
2
  import { GalleryItem } from '../gallery/index.js';
3
3
  import { C as ChipTone, R as Readiness } from '../status-BXRokZD9.js';
4
4
  import { V as Viewer, R as ResourceScope } from '../viewer-scope-Dx0N9AYk.js';
@@ -116,6 +116,8 @@ interface ViewLink {
116
116
  interface LinkOrder {
117
117
  field: string;
118
118
  direction?: "asc" | "desc";
119
+ /** Where rows with no value go. Unset, the store decides. */
120
+ nulls?: "first" | "last";
119
121
  }
120
122
  /** A link's picker, resolved: what to list, what names a row, and the filters to send. */
121
123
  interface ResolvedLink {
@@ -134,6 +136,7 @@ interface ResolvedLink {
134
136
  readonly orderBy?: {
135
137
  readonly field: string;
136
138
  readonly direction: "asc" | "desc";
139
+ readonly nulls?: "first" | "last" | undefined;
137
140
  } | undefined;
138
141
  /**
139
142
  * The filters a picker sends: the linked view's scope keys from `scope` (as its own lists apply
@@ -399,10 +402,14 @@ interface ViewDefinition<C extends ResourceContract, Row extends DataRow = RowOf
399
402
  gallery?: ViewGallery<FieldNameOf<C>>;
400
403
  /** Group rows under headers by this field. */
401
404
  groupBy?: FieldNameOf<C>;
402
- /** Default order; `manual: true` turns on drag to reorder, writing this field. */
405
+ /**
406
+ * Default order; `manual: true` turns on drag to reorder, writing this field. `nulls` says where
407
+ * rows with no value go (unset, the store decides: Postgres puts them first on a descending sort).
408
+ */
403
409
  orderBy?: {
404
410
  field: FieldNameOf<C>;
405
411
  direction?: "asc" | "desc";
412
+ nulls?: "first" | "last";
406
413
  manual?: boolean;
407
414
  };
408
415
  /** Bumped when stored preferences (saved views, column order) change shape. */
@@ -3,10 +3,10 @@ import { keyFields, encodeRecordKey } from '../chunk-KV2HW4G4.js';
3
3
  import { NO_VIEWER } from '../chunk-OZYF55E3.js';
4
4
  export { NO_VIEWER } from '../chunk-OZYF55E3.js';
5
5
  import { isTimeZone } from '../chunk-WXENWPWP.js';
6
- import { isDevelopment, reportError } from '../chunk-VFT6QKZW.js';
6
+ import { isDevelopment, reportError } from '../chunk-NOPS5EIH.js';
7
7
  import '../chunk-HUNGCTRA.js';
8
8
  import { titleCase } from '../chunk-RYEXWQFD.js';
9
- import '../chunk-LG6TUBVM.js';
9
+ import '../chunk-WLDSIQJ2.js';
10
10
  import { isSafeUrl } from '../chunk-YDDPFSQ6.js';
11
11
 
12
12
  // src/resource-view/errors.ts
@@ -122,7 +122,12 @@ function resolveLink(owner, name, reference, link, labelField) {
122
122
  get orderBy() {
123
123
  const order = link?.orderBy === "view" ? linkedView()?.definition.orderBy : link?.orderBy;
124
124
  if (!order || typeof order.field !== "string" || !IDENTIFIER.test(order.field)) return void 0;
125
- return Object.freeze({ field: order.field, direction: order.direction === "desc" ? "desc" : "asc" });
125
+ const nulls = order.nulls;
126
+ return Object.freeze({
127
+ field: order.field,
128
+ direction: order.direction === "desc" ? "desc" : "asc",
129
+ ...nulls === "first" || nulls === "last" ? { nulls } : {}
130
+ });
126
131
  },
127
132
  filters(scope, values = {}) {
128
133
  const view = linkedView();
@@ -444,7 +449,11 @@ function defineView(contract, definition = {}) {
444
449
  problems.push(...galleryProblems(fields, gallery));
445
450
  }
446
451
  }
447
- if (definition.orderBy) known(definition.orderBy.field, "orderBy");
452
+ if (definition.orderBy) {
453
+ known(definition.orderBy.field, "orderBy");
454
+ const { nulls } = definition.orderBy;
455
+ if (nulls !== void 0 && nulls !== "first" && nulls !== "last") problems.push(`orderBy.nulls is "first" or "last", not ${String(nulls)}`);
456
+ }
448
457
  for (const [name, preset] of Object.entries(presets)) {
449
458
  if (preset.columns && preset.columns !== "default" && !own(columnLists, preset.columns)) {
450
459
  problems.push(`presets.${name} uses columns "${preset.columns}", which isn't defined`);