viewkitjs 0.38.0 → 0.40.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 (309) hide show
  1. package/CHANGELOG.md +134 -0
  2. package/MIGRATION.md +32 -0
  3. package/fields/dist/derived.d.ts +7 -0
  4. package/fields/dist/derived.js +4 -0
  5. package/fields/dist/index.d.ts +1 -1
  6. package/fields/dist/index.js +1 -1
  7. package/fields/dist/messages.d.ts +5 -1
  8. package/fields/dist/messages.js +3 -0
  9. package/fields/dist/query/evaluate.d.ts +7 -1
  10. package/fields/dist/query/evaluate.js +8 -5
  11. package/fields/dist/query/figure-kinds.d.ts +2 -2
  12. package/fields/dist/query/figure-kinds.js +3 -0
  13. package/fields/dist/query/figures.d.ts +5 -3
  14. package/fields/dist/query/figures.js +13 -0
  15. package/fields/dist/query/filter.d.ts +7 -0
  16. package/fields/dist/query/filter.js +7 -1
  17. package/fields/dist/query/kit.d.ts +3 -2
  18. package/fields/dist/query/kit.js +1 -1
  19. package/fields/dist/query/layer.d.ts +6 -0
  20. package/fields/dist/query/layer.js +3 -0
  21. package/fields/dist/query/number.d.ts +3 -2
  22. package/fields/dist/query/number.js +5 -3
  23. package/fields/dist/query/read-rule.d.ts +1 -1
  24. package/fields/dist/query/read-rule.js +3 -0
  25. package/fields/docs/guides/queries.md +28 -24
  26. package/fields/docs/reference/fields.md +1 -0
  27. package/fields/docs/reference/query.md +9 -7
  28. package/package.json +2 -4
  29. package/postgres/dist/check.js +3 -1
  30. package/postgres/dist/definitions/storage.d.ts +3 -1
  31. package/postgres/dist/definitions/storage.js +3 -1
  32. package/postgres/dist/definitions/stored.js +13 -2
  33. package/postgres/dist/map.d.ts +5 -1
  34. package/postgres/dist/map.js +4 -0
  35. package/postgres/dist/records.js +6 -1
  36. package/postgres/docs/guides/definitions.md +1 -1
  37. package/postgres/docs/guides/field-map.md +3 -3
  38. package/postgres/docs/reference/postgres.md +1 -1
  39. package/views/dist/atoms/HeaderChrome.d.ts +7 -0
  40. package/views/dist/atoms/HeaderChrome.js +15 -0
  41. package/views/dist/atoms/ToolbarButton.d.ts +1 -1
  42. package/views/dist/atoms/ToolbarButton.js +2 -2
  43. package/views/dist/atoms/defaults.js +4 -0
  44. package/views/dist/atoms/types.d.ts +39 -2
  45. package/views/dist/contract.d.ts +38 -9
  46. package/views/dist/contract.js +64 -6
  47. package/views/dist/controls/avatar.css +1 -1
  48. package/views/dist/controls/customize/map-customize-body.js +1 -1
  49. package/views/dist/controls/field/field.d.ts +2 -14
  50. package/views/dist/controls/field/field.js +4 -9
  51. package/views/dist/controls/field/looks.d.ts +1 -1
  52. package/views/dist/controls/field/looks.js +7 -3
  53. package/views/dist/controls/field/tokens.d.ts +4 -0
  54. package/views/dist/controls/field/tokens.js +1 -0
  55. package/views/dist/controls/field.css +33 -0
  56. package/views/dist/controls/filter-editor/block.d.ts +3 -1
  57. package/views/dist/controls/filter-editor/block.js +4 -3
  58. package/views/dist/controls/filter-editor/filter-editor.d.ts +15 -2
  59. package/views/dist/controls/filter-editor/filter-editor.js +49 -16
  60. package/views/dist/controls/filter-editor/how.d.ts +11 -1
  61. package/views/dist/controls/filter-editor/map-filter-body.d.ts +4 -2
  62. package/views/dist/controls/filter-editor/map-filter-body.js +21 -11
  63. package/views/dist/controls/filter-editor/map-rules.d.ts +6 -4
  64. package/views/dist/controls/filter-editor/map-rules.js +7 -4
  65. package/views/dist/controls/filter-editor/parts.d.ts +14 -1
  66. package/views/dist/controls/filter-editor/parts.js +14 -0
  67. package/views/dist/controls/filter-editor.css +4 -1
  68. package/views/dist/controls/index.d.ts +0 -3
  69. package/views/dist/controls/index.js +0 -3
  70. package/views/dist/controls/input.css +1 -1
  71. package/views/dist/controls/internal/menu-items.d.ts +2 -0
  72. package/views/dist/controls/internal/menu-items.js +1 -1
  73. package/views/dist/controls/internal/part-slot.d.ts +1 -1
  74. package/views/dist/controls/internal/part-slot.js +1 -1
  75. package/views/dist/controls/internal/row-actions.d.ts +33 -0
  76. package/views/dist/controls/internal/row-actions.js +28 -0
  77. package/views/dist/controls/menu/map-menu.js +1 -1
  78. package/views/dist/controls/menu-list.css +1 -1
  79. package/views/dist/controls/picker/looks.d.ts +1 -1
  80. package/views/dist/controls/picker.css +2 -2
  81. package/views/dist/controls/popover/map-popover.d.ts +1 -1
  82. package/views/dist/controls/popover/map-popover.js +2 -2
  83. package/views/dist/controls/press.css +0 -1
  84. package/views/dist/controls/radio/radio.d.ts +1 -1
  85. package/views/dist/controls/radio/radio.js +1 -16
  86. package/views/dist/controls/sheet/bottom-sheet.d.ts +2 -2
  87. package/views/dist/controls/sheet/bottom-sheet.js +31 -24
  88. package/views/dist/controls/sheet/map-sheet.js +9 -6
  89. package/views/dist/controls/sort-editor/map-sort-body.js +1 -0
  90. package/views/dist/controls/sort-editor/sort-editor.d.ts +5 -1
  91. package/views/dist/controls/sort-editor/sort-editor.js +41 -13
  92. package/views/dist/controls/text-editor.css +22 -0
  93. package/views/dist/controls/tokens.js +0 -6
  94. package/views/dist/controls/toolbar/toolbar.js +2 -2
  95. package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +1 -1
  96. package/views/dist/controls/toolbar-button/atom-toolbar-button.js +2 -2
  97. package/views/dist/editors/EditorPanel.js +1 -1
  98. package/views/dist/field-row/FieldRow.js +38 -16
  99. package/views/dist/field-row/editors/RowChipsEditor.js +3 -1
  100. package/views/dist/field-row/editors/RowDateEditor.js +3 -1
  101. package/views/dist/field-row/editors/RowNameEditor.js +3 -1
  102. package/views/dist/field-row/editors/RowPlaceEditor.js +4 -2
  103. package/views/dist/field-row/editors/RowRangeEditor.js +3 -1
  104. package/views/dist/field-row/editors/RowRelationEditor.js +5 -2
  105. package/views/dist/field-row/editors/RowSelectEditor.js +3 -1
  106. package/views/dist/field-row/editors/RowTextEditor.d.ts +7 -1
  107. package/views/dist/field-row/editors/RowTextEditor.js +28 -4
  108. package/views/dist/field-row/editors/RowValueListEditor.js +4 -4
  109. package/views/dist/field-row/editors/row-place.d.ts +33 -0
  110. package/views/dist/field-row/editors/row-place.js +141 -0
  111. package/views/dist/field-row/field-row-button.d.ts +9 -6
  112. package/views/dist/field-row/field-row-button.js +3 -3
  113. package/views/dist/field-row/row-target.d.ts +4 -1
  114. package/views/dist/field-row/row-target.js +1 -1
  115. package/views/dist/filters/duration-bound.d.ts +7 -0
  116. package/views/dist/filters/duration-bound.js +9 -0
  117. package/views/dist/filters/filter-model.d.ts +4 -0
  118. package/views/dist/filters/number-refused.d.ts +8 -0
  119. package/views/dist/filters/number-refused.js +4 -0
  120. package/views/dist/grid/chrome/GridAggregateMenu.d.ts +12 -11
  121. package/views/dist/grid/chrome/GridAggregateMenu.js +4 -3
  122. package/views/dist/grid/chrome/GridFooter.d.ts +12 -4
  123. package/views/dist/grid/chrome/GridFooter.js +11 -9
  124. package/views/dist/grid/chrome/GridHeader.js +4 -3
  125. package/views/dist/grid/chrome/GridResizeHandle.d.ts +7 -3
  126. package/views/dist/grid/chrome/GridResizeHandle.js +2 -3
  127. package/views/dist/grid/chrome/GridTable.js +1 -1
  128. package/views/dist/grid/chrome/GridTableSurface.js +1 -1
  129. package/views/dist/grid/chrome/grid-body-place.d.ts +2 -4
  130. package/views/dist/grid/chrome/grid-body-place.js +4 -5
  131. package/views/dist/grid/chrome/grid-figure-value.js +10 -4
  132. package/views/dist/grid/chrome/grid-table-props.d.ts +15 -4
  133. package/views/dist/grid/chrome/useGridTableInteractionModel.js +12 -2
  134. package/views/dist/grid/core/clipboard-model.js +42 -8
  135. package/views/dist/grid/core/commit-model.d.ts +3 -0
  136. package/views/dist/grid/core/editing-controller.d.ts +29 -1
  137. package/views/dist/grid/core/editing-controller.js +142 -12
  138. package/views/dist/grid/core/pending-reconciliation.d.ts +14 -0
  139. package/views/dist/grid/core/pending-reconciliation.js +20 -8
  140. package/views/dist/grid/core/save-path.d.ts +4 -2
  141. package/views/dist/grid/core/save-path.js +1 -1
  142. package/views/dist/grid/core/spreadsheet-operations.js +43 -5
  143. package/views/dist/grid/core/useGridEditing.d.ts +5 -1
  144. package/views/dist/grid/core/useGridEditing.js +4 -4
  145. package/views/dist/grid/core/written-alongside.d.ts +16 -0
  146. package/views/dist/grid/core/written-alongside.js +30 -0
  147. package/views/dist/grid/grid.css +8 -4
  148. package/views/dist/grid/index.d.ts +1 -1
  149. package/views/dist/grid/looks.d.ts +2 -2
  150. package/views/dist/internal/before-paint.d.ts +5 -0
  151. package/views/dist/internal/before-paint.js +17 -0
  152. package/views/dist/internal/field-rows.d.ts +0 -8
  153. package/views/dist/internal/field-rows.js +1 -3
  154. package/views/dist/internal/over-cell.d.ts +8 -0
  155. package/views/dist/internal/over-cell.js +5 -0
  156. package/views/dist/list/bar-keys.d.ts +8 -0
  157. package/views/dist/list/bar-keys.js +3 -0
  158. package/views/dist/list/bar-parts.d.ts +27 -0
  159. package/views/dist/list/bar-parts.js +38 -0
  160. package/views/dist/list/buttons/clear-save.d.ts +7 -0
  161. package/views/dist/list/buttons/clear-save.js +19 -0
  162. package/views/dist/list/buttons/customize.d.ts +28 -0
  163. package/views/dist/list/buttons/customize.js +31 -0
  164. package/views/dist/list/buttons/filter.d.ts +32 -0
  165. package/views/dist/list/buttons/filter.js +60 -0
  166. package/views/dist/list/buttons/new.d.ts +18 -0
  167. package/views/dist/list/buttons/new.js +21 -0
  168. package/views/dist/list/buttons/quick.d.ts +15 -0
  169. package/views/dist/list/buttons/quick.js +24 -0
  170. package/views/dist/list/buttons/search.d.ts +18 -0
  171. package/views/dist/list/buttons/search.js +17 -0
  172. package/views/dist/list/buttons/shared.d.ts +97 -0
  173. package/views/dist/list/buttons/shared.js +137 -0
  174. package/views/dist/list/buttons/sort-filter.d.ts +6 -0
  175. package/views/dist/list/buttons/sort-filter.js +16 -0
  176. package/views/dist/list/buttons/sort.d.ts +17 -0
  177. package/views/dist/list/buttons/sort.js +34 -0
  178. package/views/dist/list/buttons/views.d.ts +21 -0
  179. package/views/dist/list/buttons/views.js +38 -0
  180. package/views/dist/list/editor-menus.d.ts +13 -0
  181. package/views/dist/list/editor-menus.js +13 -0
  182. package/views/dist/list/edits.d.ts +3 -1
  183. package/views/dist/list/index.d.ts +41 -0
  184. package/views/dist/list/index.js +19 -0
  185. package/views/dist/list/layer.d.ts +13 -3
  186. package/views/dist/list/layer.js +13 -3
  187. package/views/dist/list/line.d.ts +58 -0
  188. package/views/dist/list/line.js +229 -0
  189. package/views/dist/list/list.d.ts +7 -1
  190. package/views/dist/list/list.js +2 -2
  191. package/views/dist/list/pane-box.d.ts +6 -0
  192. package/views/dist/list/pane-box.js +15 -0
  193. package/views/dist/list/panels/customize.d.ts +8 -0
  194. package/views/dist/list/panels/customize.js +23 -0
  195. package/views/dist/list/panels/filter-bar.d.ts +12 -0
  196. package/views/dist/list/panels/filter-bar.js +73 -0
  197. package/views/dist/list/panels/filter.d.ts +8 -0
  198. package/views/dist/list/panels/filter.js +23 -0
  199. package/views/dist/list/panels/quick.d.ts +7 -0
  200. package/views/dist/list/panels/quick.js +16 -0
  201. package/views/dist/list/panels/shared.d.ts +26 -0
  202. package/views/dist/list/panels/shared.js +36 -0
  203. package/views/dist/list/panels/sort.d.ts +8 -0
  204. package/views/dist/list/panels/sort.js +19 -0
  205. package/views/dist/list/panels/views.d.ts +13 -0
  206. package/views/dist/list/panels/views.js +27 -0
  207. package/views/dist/list/ready.d.ts +35 -0
  208. package/views/dist/list/ready.js +7 -0
  209. package/views/dist/list/root-base.d.ts +19 -1
  210. package/views/dist/list/root-base.js +13 -3
  211. package/views/dist/list/root.d.ts +1 -1
  212. package/views/dist/list/root.js +2 -2
  213. package/views/dist/list/store.d.ts +29 -0
  214. package/views/dist/list/store.js +48 -2
  215. package/views/dist/list/toolbar-model.d.ts +99 -0
  216. package/views/dist/list/toolbar-model.js +195 -0
  217. package/views/dist/list/toolbar.js +142 -329
  218. package/views/dist/list/views-axis.js +15 -4
  219. package/views/dist/list/views.d.ts +1 -1
  220. package/views/dist/list/views.js +4 -1
  221. package/views/dist/looks/index.d.ts +0 -1
  222. package/views/dist/looks/index.js +0 -1
  223. package/views/dist/looks/looks.d.ts +1 -1
  224. package/views/dist/looks/pieces.js +0 -2
  225. package/views/dist/model/aggregates.d.ts +18 -8
  226. package/views/dist/model/aggregates.js +16 -22
  227. package/views/dist/model/column-filters.js +10 -3
  228. package/views/dist/model/view-rules.js +1 -0
  229. package/views/dist/panels/filter/NumberFilterBody.js +6 -8
  230. package/views/dist/panels/labels.js +7 -2
  231. package/views/dist/panels/model.d.ts +3 -0
  232. package/views/dist/panels/react/filter/FilterEditor.d.ts +3 -1
  233. package/views/dist/panels/react/filter/FilterEditor.js +2 -2
  234. package/views/dist/panels/react/filter/filter-body.d.ts +3 -1
  235. package/views/dist/panels/react/filter/filter-body.js +7 -3
  236. package/views/dist/panels/react/sort/SortEditor.d.ts +3 -1
  237. package/views/dist/panels/react/sort/SortEditor.js +4 -4
  238. package/views/dist/panels/react/toolbar/Toolbar.d.ts +80 -3
  239. package/views/dist/panels/react/toolbar/Toolbar.js +85 -52
  240. package/views/dist/panels/react/toolbar/ToolbarBarSorts.d.ts +9 -0
  241. package/views/dist/panels/react/toolbar/ToolbarBarSorts.js +84 -0
  242. package/views/dist/panels/react/toolbar/ToolbarButton.d.ts +1 -1
  243. package/views/dist/panels/react/toolbar/ToolbarButton.js +5 -3
  244. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +4 -1
  245. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +2 -2
  246. package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +30 -0
  247. package/views/dist/panels/react/toolbar/ToolbarOptions.js +6 -1
  248. package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +5 -0
  249. package/views/dist/panels/react/toolbar/ToolbarSortPill.js +6 -4
  250. package/views/dist/panels/react/toolbar/ToolbarViews.d.ts +7 -1
  251. package/views/dist/panels/react/toolbar/ToolbarViews.js +4 -4
  252. package/views/dist/panels/react/toolbar/context.d.ts +4 -0
  253. package/views/dist/panels/react/toolbar/context.js +1 -0
  254. package/views/dist/panels/react/toolbar/sheet-host.d.ts +3 -0
  255. package/views/dist/panels/react/toolbar/sheet-host.js +6 -0
  256. package/views/dist/panels/react/toolbar/use-give-way.d.ts +6 -0
  257. package/views/dist/panels/react/toolbar/use-give-way.js +10 -3
  258. package/views/dist/panels/react/views-row/ViewPicker.d.ts +8 -1
  259. package/views/dist/panels/react/views-row/ViewPicker.js +12 -7
  260. package/views/dist/panels/settings/filter-groups.js +12 -0
  261. package/views/dist/panels/settings/input.d.ts +11 -0
  262. package/views/dist/panels/settings/layout.js +26 -0
  263. package/views/dist/panels/settings/person.d.ts +15 -0
  264. package/views/dist/panels/settings/person.js +6 -0
  265. package/views/dist/panels/toolbar/page-resets.js +14 -3
  266. package/views/dist/provider/components.d.ts +47 -4
  267. package/views/dist/react.d.ts +1 -1
  268. package/views/dist/styles.css +116 -257
  269. package/views/dist/styles.unlayered.css +116 -257
  270. package/views/docs/contract.md +28 -18
  271. package/views/docs/controls/field.md +2 -1
  272. package/views/docs/controls/filter-editor.md +1 -1
  273. package/views/docs/controls/menu.md +1 -1
  274. package/views/docs/controls/sort-editor.md +1 -1
  275. package/views/docs/guides/atoms.md +1 -0
  276. package/views/docs/guides/looks.md +1 -1
  277. package/views/docs/guides/the-grid.md +6 -4
  278. package/views/docs/guides/toolbar-parts.md +337 -0
  279. package/views/docs/index.md +4 -0
  280. package/views/docs/reference/controls.md +6 -44
  281. package/views/docs/reference/field-row.md +1 -1
  282. package/views/docs/reference/grid.md +8 -7
  283. package/views/docs/reference/list.md +184 -11
  284. package/views/docs/reference/looks.md +13 -16
  285. package/views/docs/reference/panels-react.md +7 -7
  286. package/views/docs/reference/panels.md +1 -1
  287. package/views/docs/reference/react.md +14 -11
  288. package/views/docs/reference/views.md +9 -7
  289. package/views/skills/views/SKILL.md +2 -1
  290. package/views/dist/controls/setting-row/looks.d.ts +0 -10
  291. package/views/dist/controls/setting-row/looks.js +0 -22
  292. package/views/dist/controls/setting-row/setting-row.d.ts +0 -102
  293. package/views/dist/controls/setting-row/setting-row.js +0 -135
  294. package/views/dist/controls/setting-row/tokens.d.ts +0 -156
  295. package/views/dist/controls/setting-row/tokens.js +0 -41
  296. package/views/dist/controls/setting-row.css +0 -216
  297. package/views/dist/controls/switch-row/switch-row.d.ts +0 -1
  298. package/views/dist/controls/switch-row/switch-row.js +0 -1
  299. package/views/dist/controls/switch-row/tokens.d.ts +0 -39
  300. package/views/dist/controls/switch-row/tokens.js +0 -12
  301. package/views/dist/controls/switch-row.css +0 -35
  302. package/views/dist/controls/tag-field/tag-field.d.ts +0 -24
  303. package/views/dist/controls/tag-field/tag-field.js +0 -25
  304. package/views/dist/controls/tag-field/tokens.d.ts +0 -23
  305. package/views/dist/controls/tag-field/tokens.js +0 -8
  306. package/views/dist/controls/tag-field.css +0 -32
  307. package/views/docs/controls/setting-row.md +0 -44
  308. package/views/docs/controls/switch-row.md +0 -15
  309. package/views/docs/controls/tag-field.md +0 -11
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { barItemsOf } from "../../filters/filter-tree.js";
4
+ import { heldStands } from "../../panels/react/filter/editor-ctx.js";
5
+ import { WholeFilterEditor } from "../../panels/react/filter/FilterEditor.js";
6
+ import { useViews } from "../../provider/context.js";
7
+ import { useList } from "../root-base.js";
8
+ import { useToolbarModel } from "../toolbar-model.js";
9
+ import { usePartPhone } from "../buttons/shared.js";
10
+ import { PanelFrame, usePanelPlace } from "./shared.js";
11
+ export function ListFilterPanel({ shows = "always", className }) {
12
+ const { messages } = useViews();
13
+ const phone = usePartPhone();
14
+ const fielded = useList((s) => s.columns !== null);
15
+ const { panels, held } = useToolbarModel({ phone, fromRoot: true });
16
+ const tree = fielded ? panels.filterTree : undefined;
17
+ const holds = !!tree && (barItemsOf(tree.tree).length > 0 || !!heldStands(held, tree.tree));
18
+ const place = usePanelPlace("filter", shows, holds, !!tree);
19
+ if (!tree)
20
+ return null;
21
+ const label = tree.label ?? messages({ key: "views.panels.filter" });
22
+ return (_jsx(PanelFrame, { place: place, label: label, head: true, panel: "filter", className: className, children: _jsx(WholeFilterEditor, { filterTree: tree, empty: "editor", onDone: place.hide }) }));
23
+ }
@@ -0,0 +1,7 @@
1
+ import type { ReactNode } from "react";
2
+ export type ListQuickFiltersPanelProps = {
3
+ /** When it stands. Default `always`. */
4
+ shows?: "always" | "button";
5
+ className?: string;
6
+ };
7
+ export declare function ListQuickFiltersPanel({ shows, className }: ListQuickFiltersPanelProps): ReactNode;
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { QuickFiltersPanel } from "../../panels/react/quick/QuickFiltersPanel.js";
4
+ import { useViews } from "../../provider/context.js";
5
+ import { useToolbarModel } from "../toolbar-model.js";
6
+ import { usePartPhone } from "../buttons/shared.js";
7
+ import { PanelFrame, usePanelPlace } from "./shared.js";
8
+ export function ListQuickFiltersPanel({ shows = "always", className }) {
9
+ const { messages } = useViews();
10
+ const phone = usePartPhone();
11
+ const { quick } = useToolbarModel({ phone, fromRoot: true });
12
+ const place = usePanelPlace("quick", shows, true, !!quick);
13
+ if (!quick)
14
+ return null;
15
+ return (_jsx(PanelFrame, { place: place, label: quick.label ?? messages({ key: "views.panels.quick-filters" }), head: false, panel: "quick", className: className, children: _jsx(QuickFiltersPanel, { quickFilters: quick, form: "computer", inHost: true, closeButton: place.stands === "shown", onDone: place.hide }) }));
16
+ }
@@ -0,0 +1,26 @@
1
+ import { type ReactNode } from "react";
2
+ import { type PartKeyName } from "../buttons/shared.js";
3
+ /** When a placed panel stands: always, once it holds something, or while its button shows it. */
4
+ export type ListPanelShows = "always" | "filled" | "button";
5
+ /** A placed panel's place in the root: its key, its region's id, whether and how it stands, and its way to go. One panel
6
+ * per key under a root, as every part: what stands is published by key, not counted. */
7
+ export type PanelPlace = {
8
+ key: string;
9
+ id: string;
10
+ stands: "alone" | "shown" | null;
11
+ hide: () => void;
12
+ };
13
+ /** A placed panel's place (VK-1092): placed under its key while it can draw (`can`; on a phone, not behind a button of the
14
+ * same), standing as `shows` and `holds` say, published. */
15
+ export declare function usePanelPlace(name: PartKeyName, shows: ListPanelShows, holds: boolean, can: boolean): PanelPlace;
16
+ /** The region a standing panel draws in: named, focusable so its button can point to it, and, where its body draws no head
17
+ * of its own, the panels' header (its name, ✕ while it stands only by its button). Nothing while it doesn't stand. */
18
+ export declare function PanelFrame({ place, label, head, panel, className, children, }: {
19
+ place: PanelPlace;
20
+ label: string;
21
+ head: boolean;
22
+ /** Its name in `data-panel`: `views`, `filter`, `sort`, `quick`, `customize`. */
23
+ panel: string;
24
+ className?: string;
25
+ children: ReactNode;
26
+ }): ReactNode;
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useLayoutEffect } from "react";
4
+ import { cx } from "../../internal/cx.js";
5
+ import { PanelHeader } from "../../panels/react/panel-header.js";
6
+ import { useList, useListStore } from "../root-base.js";
7
+ import { panelId, partButtonKey, usePartKey, usePartPhone } from "../buttons/shared.js";
8
+ export function usePanelPlace(name, shows, holds, can) {
9
+ const key = usePartKey(name);
10
+ const phone = usePartPhone();
11
+ const fronted = useList((s) => (s.panels.placed[partButtonKey(name)] ?? 0) > 0);
12
+ const drawn = can && !(phone && fronted);
13
+ const store = useListStore();
14
+ const listId = useList((s) => s.id);
15
+ const shown = useList((s) => !!s.panels.shown[key]);
16
+ const stands = !drawn ? null : shows === "always" || (shows === "filled" && holds) ? "alone" : shown ? "shown" : null;
17
+ useLayoutEffect(() => {
18
+ if (!drawn)
19
+ return;
20
+ const unplace = store.get().place(key);
21
+ return () => {
22
+ unplace();
23
+ store.get().setShown(key, false);
24
+ };
25
+ }, [store, key, drawn]);
26
+ useLayoutEffect(() => {
27
+ store.get().stand(key, stands);
28
+ return () => store.get().stand(key, null);
29
+ }, [store, key, stands]);
30
+ return { key, id: panelId(listId, key), stands, hide: () => store.get().setShown(key, false) };
31
+ }
32
+ export function PanelFrame({ place, label, head, panel, className, children, }) {
33
+ if (!place.stands)
34
+ return null;
35
+ return (_jsxs("section", { id: place.id, role: "region", "aria-label": label, tabIndex: -1, "data-slot": "vk-list-panel", "data-panel": panel, "data-stands": place.stands, className: cx("flex min-h-0 flex-col", className), children: [head && _jsx(PanelHeader, { title: label, ...(place.stands === "shown" && { onClose: place.hide }) }), children] }));
36
+ }
@@ -0,0 +1,8 @@
1
+ import type { ReactNode } from "react";
2
+ import { type ListPanelShows } from "./shared.js";
3
+ export type ListSortPanelProps = {
4
+ /** When it stands. Default `always`. */
5
+ shows?: ListPanelShows;
6
+ className?: string;
7
+ };
8
+ export declare function ListSortPanel({ shows, className }: ListSortPanelProps): ReactNode;
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { SortEditorHost } from "../../panels/react/sort/SortEditor.js";
4
+ import { useViews } from "../../provider/context.js";
5
+ import { useList } from "../root-base.js";
6
+ import { useToolbarModel } from "../toolbar-model.js";
7
+ import { usePartPhone } from "../buttons/shared.js";
8
+ import { PanelFrame, usePanelPlace } from "./shared.js";
9
+ export function ListSortPanel({ shows = "always", className }) {
10
+ const { messages } = useViews();
11
+ const phone = usePartPhone();
12
+ const fielded = useList((s) => s.columns !== null);
13
+ const { panels } = useToolbarModel({ phone, fromRoot: true });
14
+ const sorts = fielded ? panels.sorts : undefined;
15
+ const place = usePanelPlace("sort", shows, !!sorts && sorts.rules.length > 0, !!sorts && sorts.options.length > 0);
16
+ if (!sorts || sorts.options.length === 0)
17
+ return null;
18
+ return (_jsx(PanelFrame, { place: place, label: messages({ key: "views.panels.sort" }), head: true, panel: "sort", className: className, children: _jsx(SortEditorHost, { sorts: sorts, form: "computer", addSort: true, empty: "editor", onDone: place.hide }) }));
19
+ }
@@ -0,0 +1,13 @@
1
+ import type { ReactNode } from "react";
2
+ import type { ListLayout } from "viewkitjs/fields/query";
3
+ import { type CollectionViewsInput } from "../../panels/views-row/model.js";
4
+ export type ListViewsPanelProps = {
5
+ /** The app's own views; absent, the root's saved views. */
6
+ views?: CollectionViewsInput<string>;
7
+ /** The layouts a new view takes one of; absent, a table. */
8
+ layouts?: readonly ListLayout[];
9
+ /** When it stands. Default `always`. */
10
+ shows?: "always" | "button";
11
+ className?: string;
12
+ };
13
+ export declare function ListViewsPanel({ views: handed, layouts, shows, className }: ListViewsPanelProps): ReactNode;
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { toViewAxes, viewsListItemsOf, viewsListOrderFits, viewsListPickFits } from "../../panels/views-row/model.js";
4
+ import { useViews } from "../../provider/context.js";
5
+ import { useListViewsAxis } from "../views-axis.js";
6
+ import { PanelFrame, usePanelPlace } from "./shared.js";
7
+ export function ListViewsPanel({ views: handed, layouts, shows = "always", className }) {
8
+ const { components, messages } = useViews();
9
+ const { ViewsListBody } = components;
10
+ const stored = useListViewsAxis(layouts);
11
+ const axis = toViewAxes(handed ?? stored)?.[0];
12
+ const place = usePanelPlace("views", shows, true, !!axis);
13
+ if (!axis)
14
+ return null;
15
+ const label = messages({ key: "views.panels.views-list" });
16
+ const { onCreate, onReorder } = axis;
17
+ return (_jsx(PanelFrame, { place: place, label: label, head: true, panel: "views", className: className, children: _jsx(ViewsListBody, { label: label, views: viewsListItemsOf(axis), ...(axis.verbs && { verbs: axis.verbs }), value: axis.value, form: "computer", onViewChange: (value) => {
18
+ if (viewsListPickFits(axis.options, value))
19
+ axis.onChange(value);
20
+ }, ...(onCreate && { onCreate, createLabel: axis.createLabel ?? messages({ key: "views.panels.view-create" }) }), ...(onReorder && {
21
+ onReorder: (orderedIds) => {
22
+ if (viewsListOrderFits(axis.options, orderedIds))
23
+ onReorder(orderedIds);
24
+ },
25
+ ...(axis.canDrag && { canDrag: axis.canDrag }),
26
+ }), onDone: place.hide }) }));
27
+ }
@@ -0,0 +1,35 @@
1
+ import type { ToolbarPanelHost } from "../panels/react/toolbar/panel-part.js";
2
+ import type { ToolbarPanelState } from "../panels/react/toolbar/panel-state.js";
3
+ import type { ViewsLayout } from "../panels/views-row/model.js";
4
+ /** What the ready toolbar asks of the parts it draws (not on the door). `sort`: `row`, Mihai's row Sort (a placed Sort's);
5
+ * `line`, the pill of the bar's line, the phone and the row arrangement, + after it as `addAfter` says, its one-rule Sort lit
6
+ * by its own sort alone. `filter`: `add`, a placed Filter's; `plain`, Filter and its panel whatever the groups; `bar`, the bar
7
+ * form's filters, Filter alone while none stands. `customizeFoot`: `parts`, a placed Customize's; `none`, none (Clear and Save
8
+ * stand on the bar); `own`, the row arrangement's (Reset and Save for everyone, no Clear). `quickWord`: `icon`, the quick
9
+ * filters' icon alone; `own`, their button's own word. */
10
+ export type ReadyParts = {
11
+ phone: boolean;
12
+ hosts: {
13
+ options?: ToolbarPanelHost;
14
+ sort?: ToolbarPanelHost;
15
+ filter?: ToolbarPanelHost;
16
+ quick?: ToolbarPanelHost;
17
+ };
18
+ sort: "row" | "line";
19
+ addAfter?: boolean;
20
+ filter: "add" | "plain" | "bar";
21
+ customizeFoot: "parts" | "none" | "own";
22
+ quickWord: "icon" | "own";
23
+ quickState?: Pick<ToolbarPanelState, "open" | "onOpenChange">;
24
+ viewsLayout?: ViewsLayout;
25
+ barAlways: boolean;
26
+ };
27
+ /** The ready toolbar's asks (not on the door): null outside a `ListToolbar`, and for an app's own node inside one. */
28
+ export declare const ReadyPartsContext: import("react").Context<ReadyParts | null>;
29
+ /** The ready toolbar's asks, where the part stands in one (not on the door). */
30
+ export declare function useReadyParts(): ReadyParts | null;
31
+ /** Which piece of a part one item draws (not on the door): the stacked views, a half of Clear and Save, one of the filter bar's
32
+ * pieces. */
33
+ export type ReadyPieceName = "stacked" | "clear" | "save" | "sort-pill" | "sep" | "filters";
34
+ /** The piece one item draws (not on the door). */
35
+ export declare const ReadyPiece: import("react").Context<ReadyPieceName | null>;
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import { createContext, useContext } from "react";
3
+ export const ReadyPartsContext = createContext(null);
4
+ export function useReadyParts() {
5
+ return useContext(ReadyPartsContext);
6
+ }
7
+ export const ReadyPiece = createContext(null);
@@ -1,5 +1,6 @@
1
1
  import { type ReactNode } from "react";
2
2
  import type { ListLinkReading, ListSettings } from "viewkitjs/fields/query";
3
+ import type { QuickFiltersConfig } from "../panels/quick/model.js";
3
4
  import type { ToolbarPanelState } from "../panels/react/toolbar/panel-state.js";
4
5
  import { type ListState, type ListStore, type ListSync } from "./store.js";
5
6
  import type { ViewSeed, ViewsStore } from "./views-store.js";
@@ -13,7 +14,7 @@ export type ListViewsOptions = {
13
14
  };
14
15
  /** The list root's props: its id, and either its settings and layer as the app holds them (memory mode: what
15
16
  * `useListSettingsState` returns, with the shared view), or no settings, and the root keeps them through a store. A
16
- * root keeps the mode it mounted in. Either way, the toolbar's `sortFilter` and `bar`. */
17
+ * root keeps the mode it mounted in. Either way, the toolbar's `sortFilter` and `bar`, and what the person may set (`personSettings`). */
17
18
  export type ListRootModes = ListSync | {
18
19
  settings?: undefined;
19
20
  /** Where the list's saved views are kept: a store, or options; default `browserViewsStore()`. */
@@ -27,6 +28,7 @@ export type ListRootModes = ListSync | {
27
28
  link?: boolean | ListLinkReading;
28
29
  sortFilter?: ListSync["sortFilter"];
29
30
  bar?: ListSync["bar"];
31
+ personSettings?: ListSync["personSettings"];
30
32
  };
31
33
  /** The base root's props: its id, its mode, and `share: false` (no "Save for everyone", store mode). Not on the door. */
32
34
  export type ListRootBaseProps = {
@@ -34,7 +36,23 @@ export type ListRootBaseProps = {
34
36
  children?: ReactNode;
35
37
  share?: boolean;
36
38
  } & ListRootModes;
39
+ /** The model of the `ListToolbar` around a part (not on the door, VK-1105): a part placed inside what it draws reads it. Its
40
+ * value changes whenever that model is built again, so a part React skips still reads the new one; a root resets it, so a
41
+ * root drawn inside a toolbar never hands its parts another root's model. */
42
+ export declare const ToolbarModelProvided: import("react").Context<{
43
+ model: unknown;
44
+ } | null>;
37
45
  export declare function ListRootBase({ id, children, share, ...props }: ListRootBaseProps): ReactNode;
46
+ /** The quick filters `ListRoot` was handed, for a part placed under it (VK-1091): provided by the root that holds a list's
47
+ * data (./root.tsx), read here so the ready toolbar never loads that root's data path. Not on the door. */
48
+ export declare const RootQuickFilters: import("react").Context<QuickFiltersConfig | null>;
49
+ /** The quick filters of the root around this part; null where it was handed none (not on the door). */
50
+ export declare function useRootQuickFilters(): QuickFiltersConfig | null;
51
+ /** The box the root's `ListPaneBox` draws, where a placed button's Pane stands (VK-1091), and its setter. Not on the door. */
52
+ export declare const ListPaneBoxContext: import("react").Context<{
53
+ box: HTMLElement | null;
54
+ setBox: (box: HTMLElement | null) => void;
55
+ } | null>;
38
56
  /** The store of the list root around this part (not on the door). */
39
57
  export declare function useListStore(): ListStore;
40
58
  /** What this part selects of its list's state: it re-renders only when that changes (by `equal`, `Object.is` by
@@ -1,7 +1,8 @@
1
1
  "use client";
2
2
  import { createContext, createElement, useCallback, useContext, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore, } from "react";
3
3
  import { LIST_SETTINGS_DEFAULTS, readListLink } from "viewkitjs/fields/query";
4
- import { ListRadioContext, ToolbarRadioContext, useToolbarRadioState } from "../panels/react/toolbar/context.js";
4
+ import { ListRadioContext, PersonWordsContext, ToolbarRadioContext, useToolbarRadioState } from "../panels/react/toolbar/context.js";
5
+ import { personWords } from "./layer.js";
5
6
  import { ListRegistryContext } from "./registry.js";
6
7
  import { ViewsContext } from "../provider/context.js";
7
8
  import { browserViewsStore } from "./browser-views-store.js";
@@ -9,9 +10,10 @@ import { openViewKey, useKeptView, useListLink } from "./link.js";
9
10
  import { createListStore } from "./store.js";
10
11
  import { createListViews } from "./views.js";
11
12
  const ListStoreContext = createContext(null);
13
+ export const ToolbarModelProvided = createContext(null);
12
14
  export function ListRootBase({ id, children, share, ...props }) {
13
15
  const mode = useStoreMode(id, props, share);
14
- const extra = { sortFilter: props.sortFilter, bar: props.bar };
16
+ const extra = { sortFilter: props.sortFilter, bar: props.bar, personSettings: props.personSettings };
15
17
  const sync = mode ? mode.views.sync(extra) : props;
16
18
  const [store] = useState(() => createListStore(id, sync));
17
19
  useListLink(store, !!mode && props.link === true, mode?.defaults ?? LIST_SETTINGS_DEFAULTS);
@@ -22,8 +24,16 @@ export function ListRootBase({ id, children, share, ...props }) {
22
24
  const registry = useContext(ListRegistryContext);
23
25
  useLayoutEffect(() => registry?.addStore(store.get().id, store), [registry, store]);
24
26
  const radio = useToolbarRadioState();
25
- return createElement(ListStoreContext.Provider, { value: store }, createElement(ListRadioContext.Provider, { value: radio }, createElement(ToolbarRadioContext.Provider, { value: radio }, children)));
27
+ const words = useSyncExternalStore(store.subscribe, () => personWords(store.get()), () => personWords(store.get()));
28
+ const [box, setBox] = useState(null);
29
+ const paneBox = useMemo(() => ({ box, setBox }), [box]);
30
+ return createElement(ListStoreContext.Provider, { value: store }, createElement(ListRadioContext.Provider, { value: radio }, createElement(ToolbarRadioContext.Provider, { value: radio }, createElement(ListPaneBoxContext.Provider, { value: paneBox }, createElement(ToolbarModelProvided.Provider, { value: null }, createElement(PersonWordsContext.Provider, { value: words }, children))))));
26
31
  }
32
+ export const RootQuickFilters = createContext(null);
33
+ export function useRootQuickFilters() {
34
+ return useContext(RootQuickFilters);
35
+ }
36
+ export const ListPaneBoxContext = createContext(null);
27
37
  export function useListStore() {
28
38
  const store = useContext(ListStoreContext);
29
39
  if (!store)
@@ -33,7 +33,7 @@ export type ListData<Row extends ListRow = ListRow> = {
33
33
  };
34
34
  /** The list root's props: its id, and either its settings and layer as the app holds them (memory mode: what
35
35
  * `useListSettingsState` returns, with the shared view), or no settings, and the root keeps them through a store. A
36
- * root keeps the mode it mounted in. Either way, the toolbar's `sortFilter` and `bar`, and the list's data. */
36
+ * root keeps the mode it mounted in. Either way, the toolbar's `sortFilter` and `bar`, what the person may set (`personSettings`), and the list's data. */
37
37
  export type ListRootProps<Row extends ListRow = ListRow> = {
38
38
  id: string;
39
39
  children?: ReactNode;
@@ -8,7 +8,7 @@ import { createListAnswers, requestSettingsOf } from "./source-answers.js";
8
8
  import { answerInMemory } from "./answer.js";
9
9
  import { columnsOf } from "./columns.js";
10
10
  import { ListCommitsContext, ListEditsSinkContext, useListCommits, useListEditsSink } from "./edits.js";
11
- import { ListRootBase, useList, useListStore } from "./root-base.js";
11
+ import { ListRootBase, RootQuickFilters, useList, useListStore } from "./root-base.js";
12
12
  export { useList, useListPanel, useListStore } from "./root-base.js";
13
13
  export function ListRoot({ fields, rows, source, pageSize, quickFilters, columns, save, can, children, ...base }) {
14
14
  const [defaults] = useState(() => base.settings === undefined && base.defaults === undefined && fields ? columnsOf(fields, columns, false).defaults : undefined);
@@ -36,7 +36,7 @@ function RootData({ fields, rows, source, pageSize, quickFilters, columns: overr
36
36
  useLayoutEffect(() => store.flush());
37
37
  const commits = useListCommits(save, writable, bindings);
38
38
  const sink = useListEditsSink(store);
39
- return createElement(ListCommitsContext.Provider, { value: commits }, createElement(ListEditsSinkContext.Provider, { value: sink }, children));
39
+ return createElement(ListCommitsContext.Provider, { value: commits }, createElement(ListEditsSinkContext.Provider, { value: sink }, createElement(RootQuickFilters.Provider, { value: quickFilters ?? null }, children)));
40
40
  }
41
41
  function useListData(fields, rows, overrides, settings, conventions, writable, hold) {
42
42
  const of = useMemo(() => (fields ? columnsOf(fields, overrides, writable) : null), [fields, overrides, writable]);
@@ -30,6 +30,21 @@ export type ListState = {
30
30
  footHere: boolean;
31
31
  sortFilter: "right" | "bar";
32
32
  bar: "added" | "always";
33
+ /** What the app lets the person set in their own Customize (`personSettings`): when the filter bar stands, the
34
+ * buttons' words. Two flags, so an app's inline object changes nothing while they hold. */
35
+ personBar: boolean;
36
+ personWords: boolean;
37
+ /** What stands under this root, by key, counted (VK-1091): `ListToolbar` places `bar` while it draws a filter bar, so a
38
+ * placed button's `opens="bar"` knows one is there. */
39
+ placed: Readonly<Record<string, number>>;
40
+ /** Sort and filter's (VK-1091): the filter bar asked open by its button. */
41
+ barOpen: boolean;
42
+ /** A placed panel asked to stand by its button, by its key (VK-1092): apart from `open`, so a popover opening elsewhere
43
+ * leaves it standing. */
44
+ shown: Readonly<Record<string, boolean>>;
45
+ /** A placed panel standing now, by its key (VK-1092): on its own (`always`, or `filled` holding something), or only
46
+ * because its button showed it. Its button reads it to show, point to or hide it. */
47
+ standing: Readonly<Record<string, "alone" | "shown">>;
33
48
  };
34
49
  /** The picked rows: their ids, or every matching row (`all`), and how many (null: every matching row, before the
35
50
  * list knows its total). */
@@ -57,6 +72,14 @@ export type ListState = {
57
72
  /** A panel's page: the open one's, or kept for a panel until another opens. */
58
73
  setPage: (key: string, page: ActivePanel) => void;
59
74
  hold: (held: Pending | null) => void;
75
+ /** Counts one more of `key` as placed; the function it hands back takes that one back, once. */
76
+ place: (key: string) => () => void;
77
+ /** Sort and filter's: asks the filter bar open, or lets it go. */
78
+ setBarOpen: (open: boolean) => void;
79
+ /** Asks a placed panel to stand, or lets it go (VK-1092). */
80
+ setShown: (key: string, shown: boolean) => void;
81
+ /** A placed panel says whether it stands, and how; `null`, it doesn't (VK-1092). */
82
+ stand: (key: string, stands: "alone" | "shown" | null) => void;
60
83
  /** Picks these rows, or every matching row (`"all"`); `[]` picks none. */
61
84
  select: (ids: readonly string[] | "all") => void;
62
85
  /** The shared view's Save for everyone; nothing without a shared view. */
@@ -81,6 +104,12 @@ export type ListSync = {
81
104
  view?: CollectionViewState;
82
105
  sortFilter?: "right" | "bar";
83
106
  bar?: "added" | "always";
107
+ /** What the person may set in their own Customize, each kept in their layer: `bar`, when the filter bar stands
108
+ * (once added or always); `words`, the toolbar buttons' words (icon and word, icon or word). Off by default. */
109
+ personSettings?: {
110
+ bar?: boolean;
111
+ words?: boolean;
112
+ };
84
113
  };
85
114
  export type ListStore = {
86
115
  get: () => ListState;
@@ -1,3 +1,4 @@
1
+ import { FILTER_BAR_BUTTON_KEY } from "./bar-keys.js";
1
2
  const NO_EDITS = { saving: false, canUndo: false, canRedo: false };
2
3
  const sameKeys = (a, b) => Object.keys(b).every((key) => Object.is(a[key], b[key]));
3
4
  const sameIds = (a, b) => a.length === b.length && a.every((id, i) => id === b[i]);
@@ -38,7 +39,41 @@ export function createListStore(id, props) {
38
39
  hold: (held) => {
39
40
  if (state.panels.held === held)
40
41
  return;
41
- write({ panels: { ...state.panels, held } });
42
+ const { panels } = state;
43
+ const opens = held !== null && !panels.barOpen && (panels.placed[FILTER_BAR_BUTTON_KEY] ?? 0) > 0;
44
+ write({ panels: { ...panels, held, ...(opens && { barOpen: true }) } });
45
+ },
46
+ place: (key) => {
47
+ const count = (by) => {
48
+ const { [key]: was = 0, ...rest } = state.panels.placed;
49
+ const now = was + by;
50
+ write({ panels: { ...state.panels, placed: now > 0 ? { ...rest, [key]: now } : rest } });
51
+ };
52
+ count(1);
53
+ let placed = true;
54
+ return () => {
55
+ if (!placed)
56
+ return;
57
+ placed = false;
58
+ count(-1);
59
+ };
60
+ },
61
+ setBarOpen: (open) => {
62
+ if (state.panels.barOpen === open)
63
+ return;
64
+ write({ panels: { ...state.panels, barOpen: open } });
65
+ },
66
+ setShown: (key, shown) => {
67
+ const { [key]: was = false, ...rest } = state.panels.shown;
68
+ if (was === shown)
69
+ return;
70
+ write({ panels: { ...state.panels, shown: shown ? { ...rest, [key]: true } : rest } });
71
+ },
72
+ stand: (key, stands) => {
73
+ const { [key]: was = null, ...rest } = state.panels.standing;
74
+ if (was === stands)
75
+ return;
76
+ write({ panels: { ...state.panels, standing: stands ? { ...rest, [key]: stands } : rest } });
42
77
  },
43
78
  select: (ids) => {
44
79
  if (ids === "all" && wired.selectAll)
@@ -68,6 +103,12 @@ export function createListStore(id, props) {
68
103
  footHere: false,
69
104
  sortFilter: props.sortFilter ?? "right",
70
105
  bar: props.bar ?? "added",
106
+ personBar: !!props.personSettings?.bar,
107
+ personWords: !!props.personSettings?.words,
108
+ placed: {},
109
+ barOpen: false,
110
+ shown: {},
111
+ standing: {},
71
112
  },
72
113
  selection: { ids: [], all: false, count: 0 },
73
114
  views: null,
@@ -96,7 +137,12 @@ export function createListStore(id, props) {
96
137
  const view = viewOf(next);
97
138
  if (!sameKeys(state.view, view))
98
139
  changed.view = view;
99
- const panels = { sortFilter: next.sortFilter ?? "right", bar: next.bar ?? "added" };
140
+ const panels = {
141
+ sortFilter: next.sortFilter ?? "right",
142
+ bar: next.bar ?? "added",
143
+ personBar: !!next.personSettings?.bar,
144
+ personWords: !!next.personSettings?.words,
145
+ };
100
146
  if (!sameKeys(state.panels, panels))
101
147
  changed.panels = { ...state.panels, ...panels };
102
148
  if (Object.keys(changed).length === 0)
@@ -0,0 +1,99 @@
1
+ import type { ListPersonalLayer, ListSettings, ListSettingsChange } from "viewkitjs/fields/query";
2
+ import type { ToggleConfig } from "../panels/model.js";
3
+ import type { Pending } from "../panels/react/filter/editor-ctx.js";
4
+ import type { QuickFiltersConfig } from "../panels/quick/model.js";
5
+ import type { SettingsPanelsInput } from "../panels/settings/input.js";
6
+ import { settingsPanels } from "../panels/settings/settings-panels.js";
7
+ import { groupShown } from "../panels/toolbar/counts.js";
8
+ import { type CustomizePage } from "../panels/toolbar/page-resets.js";
9
+ import type { CollectionViewState } from "../panels/view-state.js";
10
+ import type { CollectionViewsInput } from "../panels/views-row/model.js";
11
+ import { useViews } from "../provider/context.js";
12
+ import type { ListState } from "./store.js";
13
+ import type { ListToolbarProps } from "./toolbar.js";
14
+ /** What the model takes: `ListToolbar` hands its own props; a part hands what it has (often nothing), and `fromRoot` to read
15
+ * the root's quick filters where it is handed none. */
16
+ export type ToolbarModelProps<Row> = Partial<Omit<ListToolbarProps<Row>, "toolbarParts">> & {
17
+ phone: boolean;
18
+ fromRoot?: boolean;
19
+ };
20
+ type Panels<Row> = ReturnType<typeof settingsPanels<Row>>;
21
+ /** What Customize and the bar's buttons are handed of the builder's panels. */
22
+ export type ToolbarOptionsInputs<Row> = {
23
+ filters: Panels<Row>["filters"];
24
+ sort: Panels<Row>["sort"];
25
+ sorts: Panels<Row>["sorts"];
26
+ filterTree: Panels<Row>["filterTree"];
27
+ group: ReturnType<typeof groupShown>;
28
+ layout: Panels<Row>["layout"];
29
+ toggles: ToggleConfig[] | undefined;
30
+ };
31
+ export type ToolbarModel<Row> = {
32
+ settings: ListSettings;
33
+ layer: ListPersonalLayer;
34
+ onChange: (change: ListSettingsChange) => void;
35
+ onLayerChange: (patch: ListPersonalLayer) => void;
36
+ /** The views handed, else the root's saved views. */
37
+ views: CollectionViewsInput<string> | undefined;
38
+ /** What the builder was handed. */
39
+ input: SettingsPanelsInput<Row>;
40
+ panels: Panels<Row>;
41
+ inputs: ToolbarOptionsInputs<Row>;
42
+ /** The shared view, its Reset the first page's (`resetAll`). */
43
+ view: CollectionViewState | undefined;
44
+ resets: Partial<Record<CustomizePage, () => void>> | undefined;
45
+ /** What differs from the saved view, or with none from the list's defaults; absent with no baseline. */
46
+ differs: {
47
+ sort: boolean;
48
+ filter: boolean;
49
+ } | undefined;
50
+ /** The person's layer holds something on this screen. */
51
+ layered: boolean;
52
+ /** Something differs from the default with no shared view: the kit's Clear stands. */
53
+ clearable: boolean;
54
+ resetAll: () => void;
55
+ clear: (scope: "options" | "filters") => () => void;
56
+ /** Show counts. */
57
+ show: boolean;
58
+ held: Pending | null;
59
+ setHeld: (held: Pending | null) => void;
60
+ /** The saved view's own filter, kept off the bar. */
61
+ savedFilter: ListSettings["filter"] | undefined;
62
+ /** The quick filters, their counts following Show counts and the source's where the app hands none; null with none. */
63
+ quick: QuickFiltersConfig | null;
64
+ };
65
+ /** What the model reads from the root and the provider: built again only when one of these, or a prop, changes. */
66
+ type ModelReads = {
67
+ settings: ListSettings;
68
+ layer: ListPersonalLayer;
69
+ onChange: (change: ListSettingsChange) => void;
70
+ onLayerChange: (patch: ListPersonalLayer) => void;
71
+ shared: CollectionViewState | undefined;
72
+ held: Pending | null;
73
+ setHeld: (held: Pending | null) => void;
74
+ rootColumns: unknown;
75
+ answer: ListState["answer"];
76
+ storeViews: CollectionViewsInput<string> | undefined;
77
+ rootQuick: QuickFiltersConfig | null;
78
+ /** What the app lets the person set, and when the bar stands while they picked none. */
79
+ personBar: boolean;
80
+ personWords: boolean;
81
+ barDefault: "added" | "always" | "button";
82
+ messages: ReturnType<typeof useViews>["messages"];
83
+ conventions: ReturnType<typeof useViews>["conventions"];
84
+ };
85
+ /** A built model and what it was built from (not on the door). */
86
+ export type ModelCell = {
87
+ reads: ModelReads | null;
88
+ props: object | null;
89
+ model: unknown;
90
+ };
91
+ /** The toolbar's model (VK-1091, not on the door): every part placed under one root (`fromRoot`) reads the same one, built once
92
+ * per change of what it reads (VK-1105); a `ListToolbar` keeps its own (`useOwnToolbarModel`), and a part inside what it draws
93
+ * reads that (`ToolbarModelProvided`). */
94
+ export declare function useToolbarModel<Row>(props: ToolbarModelProps<Row>): ToolbarModel<Row>;
95
+ /** A `ListToolbar`'s own model (not on the door), which it hands to what it draws through `ToolbarModelProvided`. */
96
+ export declare function useOwnToolbarModel<Row>(props: ToolbarModelProps<Row>): ToolbarModel<Row>;
97
+ /** The settings' search written back: `next` empty clears it. */
98
+ export declare function searchChange(settings: ListSettings, next: string): ListSettingsChange;
99
+ export {};