viewkitjs 0.38.0 → 0.39.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 (184) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/MIGRATION.md +7 -0
  3. package/fields/dist/query/figure-kinds.d.ts +2 -2
  4. package/fields/dist/query/figure-kinds.js +3 -0
  5. package/fields/dist/query/figures.d.ts +5 -3
  6. package/fields/dist/query/figures.js +13 -0
  7. package/fields/docs/reference/query.md +3 -3
  8. package/package.json +1 -1
  9. package/postgres/docs/guides/field-map.md +1 -1
  10. package/views/dist/atoms/HeaderChrome.d.ts +7 -0
  11. package/views/dist/atoms/HeaderChrome.js +15 -0
  12. package/views/dist/atoms/ToolbarButton.d.ts +1 -1
  13. package/views/dist/atoms/ToolbarButton.js +2 -2
  14. package/views/dist/atoms/defaults.js +4 -0
  15. package/views/dist/atoms/types.d.ts +39 -2
  16. package/views/dist/contract.d.ts +19 -8
  17. package/views/dist/contract.js +37 -6
  18. package/views/dist/controls/field/looks.d.ts +1 -1
  19. package/views/dist/controls/field/looks.js +7 -3
  20. package/views/dist/controls/field/tokens.d.ts +4 -0
  21. package/views/dist/controls/field/tokens.js +1 -0
  22. package/views/dist/controls/field.css +33 -0
  23. package/views/dist/controls/filter-editor/block.d.ts +3 -1
  24. package/views/dist/controls/filter-editor/block.js +4 -3
  25. package/views/dist/controls/filter-editor/filter-editor.d.ts +13 -2
  26. package/views/dist/controls/filter-editor/filter-editor.js +45 -15
  27. package/views/dist/controls/filter-editor/how.d.ts +3 -1
  28. package/views/dist/controls/filter-editor/map-filter-body.js +5 -4
  29. package/views/dist/controls/filter-editor/map-rules.d.ts +2 -1
  30. package/views/dist/controls/filter-editor/map-rules.js +3 -3
  31. package/views/dist/controls/internal/menu-items.d.ts +2 -0
  32. package/views/dist/controls/internal/menu-items.js +1 -1
  33. package/views/dist/controls/internal/part-slot.d.ts +1 -1
  34. package/views/dist/controls/internal/part-slot.js +1 -1
  35. package/views/dist/controls/internal/row-actions.d.ts +33 -0
  36. package/views/dist/controls/internal/row-actions.js +28 -0
  37. package/views/dist/controls/menu/map-menu.js +1 -1
  38. package/views/dist/controls/popover/map-popover.d.ts +1 -1
  39. package/views/dist/controls/popover/map-popover.js +2 -2
  40. package/views/dist/controls/sheet/map-sheet.js +9 -6
  41. package/views/dist/controls/sort-editor/map-sort-body.js +1 -0
  42. package/views/dist/controls/sort-editor/sort-editor.d.ts +5 -1
  43. package/views/dist/controls/sort-editor/sort-editor.js +41 -13
  44. package/views/dist/controls/text-editor.css +20 -0
  45. package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +1 -1
  46. package/views/dist/controls/toolbar-button/atom-toolbar-button.js +2 -2
  47. package/views/dist/editors/EditorPanel.js +1 -1
  48. package/views/dist/field-row/FieldRow.js +38 -16
  49. package/views/dist/field-row/editors/RowChipsEditor.js +3 -1
  50. package/views/dist/field-row/editors/RowDateEditor.js +3 -1
  51. package/views/dist/field-row/editors/RowNameEditor.js +3 -1
  52. package/views/dist/field-row/editors/RowPlaceEditor.js +4 -2
  53. package/views/dist/field-row/editors/RowRangeEditor.js +3 -1
  54. package/views/dist/field-row/editors/RowRelationEditor.js +5 -2
  55. package/views/dist/field-row/editors/RowSelectEditor.js +3 -1
  56. package/views/dist/field-row/editors/RowTextEditor.d.ts +7 -1
  57. package/views/dist/field-row/editors/RowTextEditor.js +25 -4
  58. package/views/dist/field-row/editors/RowValueListEditor.js +4 -4
  59. package/views/dist/field-row/editors/row-place.d.ts +33 -0
  60. package/views/dist/field-row/editors/row-place.js +141 -0
  61. package/views/dist/field-row/field-row-button.d.ts +9 -6
  62. package/views/dist/field-row/field-row-button.js +3 -3
  63. package/views/dist/field-row/row-target.d.ts +4 -1
  64. package/views/dist/field-row/row-target.js +1 -1
  65. package/views/dist/grid/chrome/GridAggregateMenu.d.ts +12 -11
  66. package/views/dist/grid/chrome/GridAggregateMenu.js +4 -3
  67. package/views/dist/grid/chrome/GridFooter.d.ts +12 -4
  68. package/views/dist/grid/chrome/GridFooter.js +11 -9
  69. package/views/dist/grid/chrome/GridHeader.js +4 -3
  70. package/views/dist/grid/chrome/GridResizeHandle.d.ts +7 -3
  71. package/views/dist/grid/chrome/GridResizeHandle.js +2 -3
  72. package/views/dist/grid/chrome/GridTable.js +1 -1
  73. package/views/dist/grid/chrome/GridTableSurface.js +1 -1
  74. package/views/dist/grid/chrome/grid-body-place.d.ts +2 -4
  75. package/views/dist/grid/chrome/grid-body-place.js +4 -5
  76. package/views/dist/grid/chrome/grid-figure-value.js +10 -4
  77. package/views/dist/grid/chrome/grid-table-props.d.ts +11 -3
  78. package/views/dist/grid/grid.css +7 -3
  79. package/views/dist/internal/over-cell.d.ts +8 -0
  80. package/views/dist/internal/over-cell.js +5 -0
  81. package/views/dist/list/bar-keys.d.ts +5 -0
  82. package/views/dist/list/bar-keys.js +2 -0
  83. package/views/dist/list/bar-parts.d.ts +27 -0
  84. package/views/dist/list/bar-parts.js +38 -0
  85. package/views/dist/list/buttons/clear-save.d.ts +7 -0
  86. package/views/dist/list/buttons/clear-save.js +15 -0
  87. package/views/dist/list/buttons/customize.d.ts +28 -0
  88. package/views/dist/list/buttons/customize.js +31 -0
  89. package/views/dist/list/buttons/filter.d.ts +32 -0
  90. package/views/dist/list/buttons/filter.js +60 -0
  91. package/views/dist/list/buttons/new.d.ts +18 -0
  92. package/views/dist/list/buttons/new.js +9 -0
  93. package/views/dist/list/buttons/quick.d.ts +15 -0
  94. package/views/dist/list/buttons/quick.js +24 -0
  95. package/views/dist/list/buttons/search.d.ts +18 -0
  96. package/views/dist/list/buttons/search.js +17 -0
  97. package/views/dist/list/buttons/shared.d.ts +91 -0
  98. package/views/dist/list/buttons/shared.js +131 -0
  99. package/views/dist/list/buttons/sort-filter.d.ts +6 -0
  100. package/views/dist/list/buttons/sort-filter.js +16 -0
  101. package/views/dist/list/buttons/sort.d.ts +17 -0
  102. package/views/dist/list/buttons/sort.js +34 -0
  103. package/views/dist/list/buttons/views.d.ts +21 -0
  104. package/views/dist/list/buttons/views.js +36 -0
  105. package/views/dist/list/editor-menus.d.ts +13 -0
  106. package/views/dist/list/editor-menus.js +13 -0
  107. package/views/dist/list/index.d.ts +41 -0
  108. package/views/dist/list/index.js +19 -0
  109. package/views/dist/list/line.d.ts +55 -0
  110. package/views/dist/list/line.js +221 -0
  111. package/views/dist/list/pane-box.d.ts +6 -0
  112. package/views/dist/list/pane-box.js +15 -0
  113. package/views/dist/list/panels/customize.d.ts +8 -0
  114. package/views/dist/list/panels/customize.js +23 -0
  115. package/views/dist/list/panels/filter-bar.d.ts +12 -0
  116. package/views/dist/list/panels/filter-bar.js +67 -0
  117. package/views/dist/list/panels/filter.d.ts +8 -0
  118. package/views/dist/list/panels/filter.js +23 -0
  119. package/views/dist/list/panels/quick.d.ts +7 -0
  120. package/views/dist/list/panels/quick.js +16 -0
  121. package/views/dist/list/panels/shared.d.ts +25 -0
  122. package/views/dist/list/panels/shared.js +33 -0
  123. package/views/dist/list/panels/sort.d.ts +8 -0
  124. package/views/dist/list/panels/sort.js +19 -0
  125. package/views/dist/list/panels/views.d.ts +13 -0
  126. package/views/dist/list/panels/views.js +27 -0
  127. package/views/dist/list/ready.d.ts +35 -0
  128. package/views/dist/list/ready.js +7 -0
  129. package/views/dist/list/root-base.d.ts +17 -0
  130. package/views/dist/list/root-base.js +9 -1
  131. package/views/dist/list/root.js +2 -2
  132. package/views/dist/list/store.d.ts +19 -0
  133. package/views/dist/list/store.js +40 -1
  134. package/views/dist/list/toolbar-model.d.ts +95 -0
  135. package/views/dist/list/toolbar-model.js +177 -0
  136. package/views/dist/list/toolbar.js +140 -328
  137. package/views/dist/list/views-axis.js +15 -4
  138. package/views/dist/model/aggregates.d.ts +18 -8
  139. package/views/dist/model/aggregates.js +16 -22
  140. package/views/dist/panels/react/filter/FilterEditor.d.ts +3 -1
  141. package/views/dist/panels/react/filter/FilterEditor.js +2 -2
  142. package/views/dist/panels/react/filter/filter-body.d.ts +3 -1
  143. package/views/dist/panels/react/filter/filter-body.js +2 -2
  144. package/views/dist/panels/react/sort/SortEditor.d.ts +3 -1
  145. package/views/dist/panels/react/sort/SortEditor.js +4 -4
  146. package/views/dist/panels/react/toolbar/Toolbar.d.ts +80 -3
  147. package/views/dist/panels/react/toolbar/Toolbar.js +85 -52
  148. package/views/dist/panels/react/toolbar/ToolbarBarSorts.d.ts +9 -0
  149. package/views/dist/panels/react/toolbar/ToolbarBarSorts.js +57 -0
  150. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +4 -1
  151. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +2 -2
  152. package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +30 -0
  153. package/views/dist/panels/react/toolbar/ToolbarOptions.js +6 -1
  154. package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +5 -0
  155. package/views/dist/panels/react/toolbar/ToolbarSortPill.js +6 -4
  156. package/views/dist/panels/react/toolbar/ToolbarViews.d.ts +7 -1
  157. package/views/dist/panels/react/toolbar/ToolbarViews.js +4 -4
  158. package/views/dist/panels/react/toolbar/sheet-host.d.ts +3 -0
  159. package/views/dist/panels/react/toolbar/sheet-host.js +6 -0
  160. package/views/dist/panels/react/toolbar/use-give-way.d.ts +6 -0
  161. package/views/dist/panels/react/toolbar/use-give-way.js +8 -1
  162. package/views/dist/panels/react/views-row/ViewPicker.d.ts +8 -1
  163. package/views/dist/panels/react/views-row/ViewPicker.js +12 -7
  164. package/views/dist/panels/settings/filter-groups.js +7 -0
  165. package/views/dist/provider/components.d.ts +36 -2
  166. package/views/dist/react.d.ts +1 -1
  167. package/views/dist/styles.css +104 -1
  168. package/views/dist/styles.unlayered.css +104 -1
  169. package/views/docs/contract.md +20 -12
  170. package/views/docs/controls/field.md +1 -0
  171. package/views/docs/controls/filter-editor.md +1 -1
  172. package/views/docs/controls/menu.md +1 -1
  173. package/views/docs/controls/sort-editor.md +1 -1
  174. package/views/docs/guides/atoms.md +1 -0
  175. package/views/docs/guides/the-grid.md +2 -2
  176. package/views/docs/reference/controls.md +3 -3
  177. package/views/docs/reference/field-row.md +1 -1
  178. package/views/docs/reference/grid.md +4 -4
  179. package/views/docs/reference/list.md +168 -6
  180. package/views/docs/reference/looks.md +1 -1
  181. package/views/docs/reference/panels-react.md +7 -7
  182. package/views/docs/reference/react.md +13 -10
  183. package/views/docs/reference/views.md +8 -6
  184. package/views/skills/views/SKILL.md +2 -1
@@ -0,0 +1,131 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { createContext, createElement, useContext, useMemo, useRef } from "react";
4
+ import { ToolbarSlotContext, useToolbarSlot } from "../../panels/react/toolbar/context.js";
5
+ import { PaneBox, PaneHost } from "../../panels/react/toolbar/pane-host.js";
6
+ import { SheetHost } from "../../panels/react/toolbar/sheet-host.js";
7
+ import { ToolbarButton } from "../../panels/react/toolbar/ToolbarButton.js";
8
+ import { useViews } from "../../provider/context.js";
9
+ import { useDesktop } from "../../provider/desktop.js";
10
+ import { ListPaneBoxContext, useList, useListPanel, useListStore } from "../root-base.js";
11
+ import { FILTER_BAR_BUTTON_KEY } from "../bar-parts.js";
12
+ import { useToolbarModel } from "../toolbar-model.js";
13
+ import { useReadyParts } from "../ready.js";
14
+ export const PART_KEYS = {
15
+ sort: "list-sort",
16
+ filter: "list-filter",
17
+ customize: "list-customize",
18
+ quick: "list-quick",
19
+ views: "list-views",
20
+ barSort: "list-bar-sort",
21
+ barFilters: "list-bar-filters",
22
+ };
23
+ export const PartKeys = createContext({});
24
+ export function usePartKey(name) {
25
+ return useContext(PartKeys)[name] ?? PART_KEYS[name];
26
+ }
27
+ export function usePartPhone() {
28
+ const ready = useReadyParts();
29
+ const desktop = useDesktop();
30
+ return ready ? ready.phone : !desktop;
31
+ }
32
+ const READY_HOST = { sort: "sort", filter: "filter", customize: "options", quick: "quick" };
33
+ export function PartSlot({ words, fill, form, children, }) {
34
+ const slot = useToolbarSlot();
35
+ if (words === undefined && fill === undefined && form === undefined)
36
+ return children;
37
+ const value = {
38
+ ...slot,
39
+ ...(words !== undefined && { words }),
40
+ ...(fill !== undefined && { fill }),
41
+ ...(form !== undefined && { form }),
42
+ };
43
+ return createElement(ToolbarSlotContext.Provider, { value }, children);
44
+ }
45
+ export function usePartPanel(part, name, opens) {
46
+ const phone = usePartPhone();
47
+ const ready = useReadyParts();
48
+ const rooted = useList((s) => s.columns !== null);
49
+ const fielded = ready ? true : rooted;
50
+ const model = useToolbarModel({ phone, fromRoot: true });
51
+ const listState = useListPanel(usePartKey(name));
52
+ const placed = useList((s) => (s.panels.placed.bar ?? 0) > 0);
53
+ const pane = useContext(ListPaneBoxContext);
54
+ const { Pane } = useViews().components;
55
+ const store = useListStore();
56
+ const warned = useRef(false);
57
+ const opened = useMemo(() => ({
58
+ ...listState,
59
+ onOpenChange: (next) => {
60
+ if (next && opens === "bar" && !phone) {
61
+ const { placed } = store.get().panels;
62
+ if ((placed.bar ?? 0) > 0) {
63
+ if ((placed[FILTER_BAR_BUTTON_KEY] ?? 0) > 0)
64
+ store.get().setBarOpen(true);
65
+ }
66
+ else if (!warned.current && process.env.NODE_ENV !== "production") {
67
+ warned.current = true;
68
+ console.warn(`ViewKit: ${part} opens="bar" needs a filter bar under its ListRoot; it opens its popover`);
69
+ }
70
+ }
71
+ listState.onOpenChange(next);
72
+ },
73
+ }), [listState, opens, phone, store, part]);
74
+ const inPane = opens === "pane" && !phone && !!pane?.box && !!Pane;
75
+ const readyHost = READY_HOST[name];
76
+ const host = ready ? (readyHost && ready.hosts[readyHost]) : opens === "sheet" && !phone ? SheetHost : inPane ? PaneHost : undefined;
77
+ return {
78
+ phone,
79
+ fielded,
80
+ model,
81
+ state: opened,
82
+ host,
83
+ paneBox: opens === "pane" ? (pane?.box ?? null) : undefined,
84
+ press: typeof opens === "function" ? opens : undefined,
85
+ bar: opens === "bar" && placed && !phone,
86
+ };
87
+ }
88
+ export function PartFrame({ panel, words, form, children, }) {
89
+ const placed = createElement(PartSlot, { words, form }, children);
90
+ return panel.paneBox === undefined ? placed : createElement(PaneBox.Provider, { value: panel.paneBox }, placed);
91
+ }
92
+ export function PressButton({ part, icon, label, changed, word, onPress, }) {
93
+ return (_jsx(ToolbarButton, { part: part, icon: icon, label: label, ...(changed !== undefined && { changed }), ...(word === null && { word }), onClick: (event) => onPress(event.currentTarget) }));
94
+ }
95
+ export function panelId(listId, key) {
96
+ return `vk-list-${listId}-${key}`;
97
+ }
98
+ export function usePlacedPanel(name) {
99
+ const key = usePartKey(name);
100
+ const store = useListStore();
101
+ const placed = useList((s) => (s.panels.placed[key] ?? 0) > 0);
102
+ const stands = useList((s) => s.panels.standing[key] ?? null);
103
+ const press = () => {
104
+ const state = store.get();
105
+ if (state.panels.standing[key] === "shown")
106
+ return state.setShown(key, false);
107
+ if (!state.panels.standing[key])
108
+ state.setShown(key, true);
109
+ requestAnimationFrame(() => {
110
+ const panel = document.getElementById(panelId(state.id, key));
111
+ panel?.focus({ preventScroll: true });
112
+ panel?.scrollIntoView?.({ block: "nearest" });
113
+ });
114
+ };
115
+ return { placed, stands, press };
116
+ }
117
+ export function PlacedButton({ part, icon, label, word, changed, panel, }) {
118
+ return (_jsx(ToolbarButton, { part: part, icon: icon, label: label, ...(changed !== undefined && { changed }), ...(word === null && { word }), open: panel.stands === "shown", expanded: panel.stands !== null, onClick: () => panel.press() }));
119
+ }
120
+ export function menuPress(placed, press, more, state) {
121
+ return () => {
122
+ if (placed.placed)
123
+ return placed.press();
124
+ if (press) {
125
+ if (more?.current)
126
+ press(more.current);
127
+ return;
128
+ }
129
+ state.onOpenChange(true);
130
+ };
131
+ }
@@ -0,0 +1,6 @@
1
+ import type { ReactNode } from "react";
2
+ import { type ListWords } from "./shared.js";
3
+ export type ListSortFilterProps = {
4
+ words?: ListWords;
5
+ };
6
+ export declare function ListSortFilter({ words }: ListSortFilterProps): ReactNode;
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { ToolbarButton } from "../../panels/react/toolbar/ToolbarButton.js";
4
+ import { useViews } from "../../provider/context.js";
5
+ import { useList } from "../root-base.js";
6
+ import { LineItem } from "../line.js";
7
+ import { PartSlot } from "./shared.js";
8
+ export function ListSortFilter({ words }) {
9
+ const { icons, messages } = useViews();
10
+ const open = useList((s) => s.panels.barOpen);
11
+ const setBarOpen = useList((s) => s.setBarOpen);
12
+ const Glyph = icons.filter;
13
+ const label = messages({ key: "views.panels.sort-filter" });
14
+ const item = { key: "sort-filter", shed: true, fold: true, menu: { label, icon: _jsx(Glyph, { className: "h-4 w-4" }), onSelect: () => setBarOpen(!open) } };
15
+ return (_jsx(LineItem, { item: item, children: _jsx(PartSlot, { words: words, children: _jsx(ToolbarButton, { part: "sort-filter", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: messages({ key: "views.panels.sort-filter" }), open: open, expanded: open, onClick: () => setBarOpen(!open) }) }) }));
16
+ }
@@ -0,0 +1,17 @@
1
+ import type { ReactNode } from "react";
2
+ import { type ListOpens, type ListWords } from "./shared.js";
3
+ export type ListSortProps = {
4
+ /** Where its panel opens; `bar`: a picked field's rule stands on the filter bar, where one is placed. Default `popover`. */
5
+ opens?: ListOpens | "bar";
6
+ /** What it opens with no sort set: the fields (`fields`, the default), or the sort editor saying so (`editor`). Means
7
+ * nothing with `opens="bar"` (the fields every time) or on a list with one sort rule (the one-rule Sort). */
8
+ empty?: "fields" | "editor";
9
+ words?: ListWords;
10
+ };
11
+ export declare function ListSort({ opens, empty, words }: ListSortProps): ReactNode;
12
+ /** Sort in a line (not on the door, VK-1105): its word, then into ⋯. */
13
+ export declare const SORT_ITEM: {
14
+ readonly key: "sort";
15
+ readonly shed: true;
16
+ readonly fold: true;
17
+ };
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { ToolbarSort } from "../../panels/react/toolbar/ToolbarSort.js";
4
+ import { ToolbarSortPill } from "../../panels/react/toolbar/ToolbarSortPill.js";
5
+ import { useViews } from "../../provider/context.js";
6
+ import { LineItem, useLineMore } from "../line.js";
7
+ import { useReadyParts } from "../ready.js";
8
+ import { PartFrame, PlacedButton, PressButton, menuPress, usePartPanel, usePlacedPanel } from "./shared.js";
9
+ export function ListSort({ opens, empty, words }) {
10
+ const { icons, messages } = useViews();
11
+ const panel = usePartPanel("ListSort", "sort", opens);
12
+ const placed = usePlacedPanel("sort");
13
+ const more = useLineMore();
14
+ const ready = useReadyParts();
15
+ const { fielded, model, state, host, press, bar } = panel;
16
+ const { panels, differs } = model;
17
+ if (!fielded)
18
+ return null;
19
+ const changed = differs && { changed: differs.sort };
20
+ const Glyph = icons.sort;
21
+ const item = {
22
+ ...SORT_ITEM,
23
+ menu: { label: messages({ key: "views.panels.sort" }), icon: _jsx(Glyph, { className: "h-4 w-4" }), onSelect: menuPress(placed, press, more, state) },
24
+ };
25
+ const line = (node) => _jsx(LineItem, { item: item, children: node });
26
+ if (placed.placed)
27
+ return line(_jsx(PartFrame, { panel: panel, words: words, children: _jsx(PlacedButton, { part: "sort", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: messages({ key: "views.panels.sort" }), ...changed, panel: placed }) }));
28
+ if (press)
29
+ return line(_jsx(PartFrame, { panel: panel, words: words, children: _jsx(PressButton, { part: "sort", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: messages({ key: "views.panels.sort" }), ...changed, onPress: press }) }));
30
+ if (ready?.sort === "line")
31
+ return line(_jsx(PartFrame, { panel: panel, words: words, children: panels.sorts ? (_jsx(ToolbarSortPill, { sorts: panels.sorts, open: state.open, onOpenChange: state.onOpenChange, host: host, addAfter: ready.addAfter, ...changed })) : (_jsx(ToolbarSort, { sort: panels.sort, open: state.open, onOpenChange: state.onOpenChange, host: host })) }));
32
+ return line(_jsx(PartFrame, { panel: panel, words: words, children: panels.sorts ? (_jsx(ToolbarSortPill, { row: true, sorts: panels.sorts, open: state.open, onOpenChange: state.onOpenChange, host: host, ...changed, ...(empty && { empty }), ...(bar && { fieldsOnly: true }) })) : (_jsx(ToolbarSort, { sort: panels.sort, open: state.open, onOpenChange: state.onOpenChange, host: host, ...changed })) }));
33
+ }
34
+ export const SORT_ITEM = { key: "sort", shed: true, fold: true };
@@ -0,0 +1,21 @@
1
+ import { type ReactNode } from "react";
2
+ import type { ListLayout } from "viewkitjs/fields/query";
3
+ import type { ToolbarMoreViews } from "../../panels/react/toolbar/Toolbar.js";
4
+ import type { ViewsViewVerbs } from "../../provider/components.js";
5
+ import type { CollectionViewsInput, ViewsLayout } from "../../panels/views-row/model.js";
6
+ export type ListViewsProps = {
7
+ /** The app's own views; absent, the root's saved views. */
8
+ views?: CollectionViewsInput<string>;
9
+ /** The layouts a new view takes one of; absent, a table. */
10
+ layouts?: readonly ListLayout[];
11
+ /** `tabs` (the default): each view a tab; `button`: one button naming the open view, opening the rest. */
12
+ shows?: "tabs" | "button";
13
+ /** A view's menu as data (as the ready toolbar's `menus.view`): handed each view's rows, it hands back the rows its menu shows. */
14
+ menu?: ViewsViewVerbs["menu"];
15
+ /** The views' "+N" as the app draws it (as the ready toolbar's `moreViews`): its class on ViewKit's own, or its whole button. */
16
+ moreViews?: ToolbarMoreViews;
17
+ };
18
+ export declare function ListViews({ views: handed, layouts, shows, menu, moreViews }: ListViewsProps): ReactNode;
19
+ /** How many of the views' tabs may fold into "+N" in a line (not on the door, VK-1105): one axis's, the open one never, on a
20
+ * computer; none on a phone or with several axes. */
21
+ export declare function viewsTabs(views: CollectionViewsInput<string>, layout: ViewsLayout | undefined, phone: boolean): number;
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useContext } from "react";
4
+ import { showCountsOf } from "../../panels/toolbar/counts.js";
5
+ import { withViewMenu } from "../../panels/toolbar/edit-view.js";
6
+ import { ToolbarViews } from "../../panels/react/toolbar/ToolbarViews.js";
7
+ import { MoreViews } from "../../panels/react/views-row/more-views.js";
8
+ import { splitViewAxes } from "../../panels/views-row/model.js";
9
+ import { LineForm, LineItem } from "../line.js";
10
+ import { ReadyPiece, useReadyParts } from "../ready.js";
11
+ import { useList } from "../root-base.js";
12
+ import { useListViewsAxis } from "../views-axis.js";
13
+ import { usePlacedPanel } from "./shared.js";
14
+ export function ListViews({ views: handed, layouts, shows, menu, moreViews }) {
15
+ const stored = useListViewsAxis(layouts);
16
+ const show = useList((s) => showCountsOf(s.view.settings));
17
+ const views = withViewMenu(handed ?? stored, menu);
18
+ const ready = useReadyParts();
19
+ const piece = useContext(ReadyPiece);
20
+ const layout = ready?.viewsLayout;
21
+ const placed = usePlacedPanel("views");
22
+ const lineForm = useContext(LineForm);
23
+ if (!views)
24
+ return null;
25
+ const drawn = (node) => (moreViews ? _jsx(MoreViews.Provider, { value: moreViews, children: node }) : node);
26
+ if (piece === "stacked")
27
+ return _jsx(LineItem, { item: STACKED_ITEM, children: drawn(_jsx(ToolbarViews, { views: views, viewsLayout: layout, showCounts: show, stacked: true })) });
28
+ const tabs = shows === "button" ? 0 : viewsTabs(views, layout, lineForm === "phone");
29
+ const press = shows === "button" && placed.placed ? { onPress: placed.press, expanded: placed.stands !== null, lit: placed.stands === "shown" } : undefined;
30
+ return (_jsx(LineItem, { item: { key: "views", ...(tabs > 0 && { tabs }) }, children: drawn(_jsx(ToolbarViews, { views: views, ...(layout && { viewsLayout: layout }), showCounts: show, ...(shows === "button" && { as: "picker" }), ...(press && { press }) })) }));
31
+ }
32
+ export function viewsTabs(views, layout, phone) {
33
+ const axes = splitViewAxes(views, layout).viewAxes;
34
+ return !phone && axes?.length === 1 ? Math.max(0, axes[0].options.length - 1) : 0;
35
+ }
36
+ const STACKED_ITEM = { key: "views-stacked" };
@@ -0,0 +1,13 @@
1
+ import { type ReactNode } from "react";
2
+ import type { ViewsFilterEditorItems, ViewsGroupEditorItems, ViewsSortEditorItems } from "../provider/components.js";
3
+ export type ListEditorMenusProps = {
4
+ /** The sort editor's menus: a rule's ⋯, a set-aside rule's, its rule ends and foot. */
5
+ sortEditor?: ViewsSortEditorItems;
6
+ /** The filter editor's menus: a rule's ⋮, a set-aside rule's, a group's actions, its rule ends and foot. */
7
+ filterEditor?: ViewsFilterEditorItems;
8
+ /** The group editor's rows: its settings and its foot, on Customize's Group page. */
9
+ groupEditor?: ViewsGroupEditorItems;
10
+ children?: ReactNode;
11
+ };
12
+ /** The editors' menus for every part under it (VK-1106): each one handed over the outer `ListEditorMenus`'s. */
13
+ export declare function ListEditorMenus({ sortEditor, filterEditor, groupEditor, children }: ListEditorMenusProps): ReactNode;
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { createElement, useMemo } from "react";
3
+ import { EditorMenus, useEditorMenus } from "../panels/react/toolbar/editor-menus.js";
4
+ export function ListEditorMenus({ sortEditor, filterEditor, groupEditor, children }) {
5
+ const outer = useEditorMenus();
6
+ const value = useMemo(() => ({
7
+ ...outer,
8
+ ...(sortEditor && { sort: sortEditor }),
9
+ ...(filterEditor && { filter: filterEditor }),
10
+ ...(groupEditor && { group: groupEditor }),
11
+ }), [outer, sortEditor, filterEditor, groupEditor]);
12
+ return createElement(EditorMenus.Provider, { value }, children);
13
+ }
@@ -6,29 +6,70 @@ export type { ListAnswerState } from "./answer.js";
6
6
  export { ListBulkBar } from "./bulk-bar.js";
7
7
  export type { ListBulkBarProps } from "./bulk-bar.js";
8
8
  export type { ListChange } from "../grid/core/commit-model.js";
9
+ export { ListClearSave } from "./buttons/clear-save.js";
10
+ export type { ListClearSaveProps } from "./buttons/clear-save.js";
9
11
  export type { ListColumnOverride } from "./columns.js";
10
12
  export type { ListColumnsOverride } from "./columns.js";
13
+ export { ListCustomize } from "./buttons/customize.js";
14
+ export { ListCustomizePanel } from "./panels/customize.js";
15
+ export type { ListCustomizePanelProps } from "./panels/customize.js";
16
+ export type { ListCustomizeProps } from "./buttons/customize.js";
11
17
  export type { ListData } from "./root.js";
18
+ export { ListEditorMenus } from "./editor-menus.js";
19
+ export type { ListEditorMenusProps } from "./editor-menus.js";
12
20
  export type { ListFieldsRegistry } from "./columns.js";
13
21
  export { ListFill } from "./slot.js";
14
22
  export type { ListFillProps } from "./slot.js";
23
+ export { ListFilter } from "./buttons/filter.js";
24
+ export { ListFilterBar } from "./panels/filter-bar.js";
25
+ export type { ListFilterBarProps } from "./panels/filter-bar.js";
26
+ export { ListFilterPanel } from "./panels/filter.js";
27
+ export type { ListFilterPanelProps } from "./panels/filter.js";
28
+ export type { ListFilterProps } from "./buttons/filter.js";
29
+ export { ListGap } from "./line.js";
30
+ export type { ListGapProps } from "./line.js";
15
31
  export { ListGrid } from "./grid.js";
16
32
  export type { ListGridProps } from "./grid.js";
33
+ export { ListLine } from "./line.js";
34
+ export type { ListLineProps } from "./line.js";
17
35
  export type { ListMenus } from "./menu.js";
36
+ export { ListNew } from "./buttons/new.js";
37
+ export type { ListNewProps } from "./buttons/new.js";
38
+ export type { ListOpens } from "./buttons/shared.js";
39
+ export { ListPaneBox } from "./pane-box.js";
40
+ export type { ListPaneBoxProps } from "./pane-box.js";
41
+ export type { ListPanelShows } from "./panels/shared.js";
18
42
  export type { ListProps } from "./list.js";
43
+ export { ListQuickFilters } from "./buttons/quick.js";
44
+ export { ListQuickFiltersPanel } from "./panels/quick.js";
45
+ export type { ListQuickFiltersPanelProps } from "./panels/quick.js";
46
+ export type { ListQuickFiltersProps } from "./buttons/quick.js";
19
47
  export { ListRoot } from "./root.js";
20
48
  export type { ListRootProps } from "./root.js";
21
49
  export type { ListSave } from "../grid/core/commit-model.js";
50
+ export { ListSearch } from "./buttons/search.js";
51
+ export type { ListSearchProps } from "./buttons/search.js";
22
52
  export { ListSlot } from "./slot.js";
23
53
  export type { ListSlotProps } from "./slot.js";
54
+ export { ListSort } from "./buttons/sort.js";
55
+ export { ListSortFilter } from "./buttons/sort-filter.js";
56
+ export type { ListSortFilterProps } from "./buttons/sort-filter.js";
57
+ export { ListSortPanel } from "./panels/sort.js";
58
+ export type { ListSortPanelProps } from "./panels/sort.js";
59
+ export type { ListSortProps } from "./buttons/sort.js";
24
60
  export type { ListSource } from "./source.js";
25
61
  export type { ListState } from "./store.js";
26
62
  export { ListToolbar } from "./toolbar.js";
27
63
  export type { ListToolbarProps } from "./toolbar.js";
28
64
  export { menu } from "./menu.js";
29
65
  export type { MenuPlace } from "./menu.js";
66
+ export { ListViews } from "./buttons/views.js";
30
67
  export type { ListViewsOptions } from "./root.js";
68
+ export { ListViewsPanel } from "./panels/views.js";
69
+ export type { ListViewsPanelProps } from "./panels/views.js";
70
+ export type { ListViewsProps } from "./buttons/views.js";
31
71
  export type { ListViewsState } from "./views.js";
72
+ export type { ListWords } from "./buttons/shared.js";
32
73
  export type { SavedViewInput } from "./views-store.js";
33
74
  export { useList } from "./root.js";
34
75
  export type { ViewDraft } from "./views-store.js";
@@ -2,10 +2,29 @@ export { browserViewsStore } from "./browser-views-store.js";
2
2
  export { fetchSource } from "./source.js";
3
3
  export { List } from "./list.js";
4
4
  export { ListBulkBar } from "./bulk-bar.js";
5
+ export { ListClearSave } from "./buttons/clear-save.js";
6
+ export { ListCustomize } from "./buttons/customize.js";
7
+ export { ListCustomizePanel } from "./panels/customize.js";
8
+ export { ListEditorMenus } from "./editor-menus.js";
5
9
  export { ListFill } from "./slot.js";
10
+ export { ListFilter } from "./buttons/filter.js";
11
+ export { ListFilterBar } from "./panels/filter-bar.js";
12
+ export { ListFilterPanel } from "./panels/filter.js";
13
+ export { ListGap } from "./line.js";
6
14
  export { ListGrid } from "./grid.js";
15
+ export { ListLine } from "./line.js";
16
+ export { ListNew } from "./buttons/new.js";
17
+ export { ListPaneBox } from "./pane-box.js";
18
+ export { ListQuickFilters } from "./buttons/quick.js";
19
+ export { ListQuickFiltersPanel } from "./panels/quick.js";
7
20
  export { ListRoot } from "./root.js";
21
+ export { ListSearch } from "./buttons/search.js";
8
22
  export { ListSlot } from "./slot.js";
23
+ export { ListSort } from "./buttons/sort.js";
24
+ export { ListSortFilter } from "./buttons/sort-filter.js";
25
+ export { ListSortPanel } from "./panels/sort.js";
9
26
  export { ListToolbar } from "./toolbar.js";
10
27
  export { menu } from "./menu.js";
28
+ export { ListViews } from "./buttons/views.js";
29
+ export { ListViewsPanel } from "./panels/views.js";
11
30
  export { useList } from "./root.js";
@@ -0,0 +1,55 @@
1
+ import { type ReactNode, type RefObject } from "react";
2
+ import { type FoldMenu, type FoldPlace, type ToolbarMore, type ToolbarOverflow } from "../panels/react/toolbar/Toolbar.js";
3
+ import type { ToolbarForm, ToolbarLine, ToolbarPlacement } from "../panels/toolbar/model.js";
4
+ export type ListLineProps = {
5
+ /** `row` (the default): a toolbar row, its buttons full size, named "List tools"; `bar`: a filter bar's line, a step
6
+ * smaller, named "Sort and filters". */
7
+ kind?: "row" | "bar";
8
+ /** ⋯ as data (as the ready toolbar's `menus.more`): handed the folded parts' rows, each keyed by its part, and which line it is
9
+ * (`row` or `bar`, the line's `kind`), it hands back the rows ⋯ shows. */
10
+ more?: ToolbarMore;
11
+ /** ⋯ as the app draws it (as the ready toolbar's `overflow`): its glyph, its class, or its whole button. */
12
+ overflow?: ToolbarOverflow;
13
+ className?: string;
14
+ children?: ReactNode;
15
+ };
16
+ export type ListGapProps = Record<string, never>;
17
+ /** A part's fold behaviour in a line (not on the door): its key (`data-toolbar-item`), and the ready toolbar's placement
18
+ * flags: words it may shed, view tabs and filters it may fold, whether it folds into ⋯ (and its row there), its role. */
19
+ export type LineItemMeta = Pick<ToolbarPlacement, "shed" | "tabs" | "filters" | "fold" | "role"> & {
20
+ key: string;
21
+ menu?: FoldMenu;
22
+ };
23
+ /** A line's form (not on the door): the row's by default, on every screen; the ready toolbar's phone line sets `phone`. */
24
+ export declare const LineForm: import("react").Context<ToolbarForm>;
25
+ /** An item's place in a line the ready toolbar lays out (not on the door, VK-1106): its key in the line (and the name
26
+ * `data-toolbar-item` reads), its place's words, foot, class, button and panel, and its `shed` where the app's `toolbarParts`
27
+ * turned it. */
28
+ export type LinePlaceValue = {
29
+ id: string;
30
+ place?: Omit<FoldPlace, "key">;
31
+ shed?: boolean;
32
+ };
33
+ /** Each item's place in a seeded line (not on the door, VK-1106), handed to that item alone: what it draws inside reads none. */
34
+ export declare const LinePlace: import("react").Context<LinePlaceValue | null>;
35
+ /** The line as the ready toolbar arranged it (not on the door, VK-1106), its slots keyed by `LinePlace` ids, the gap's id
36
+ * `vk-gap`: the line lays out from it on every render, so its first paint (and the server's) is the arranged one. */
37
+ export declare const LineSeed: import("react").Context<ToolbarLine | null>;
38
+ /** The gap's id in a seeded line (not on the door, VK-1106). */
39
+ export declare const SEED_GAP = "vk-gap";
40
+ export declare function ListLine({ kind, more: reshape, overflow, className, children }: ListLineProps): ReactNode;
41
+ /** A part in the line around it, folding as `item` says (not on the door); outside a line, `children` as they are. Until it
42
+ * has registered, it stands unfolded at the line's start. */
43
+ export declare function LineItem({ item, children }: {
44
+ item: LineItemMeta;
45
+ children?: ReactNode;
46
+ }): ReactNode;
47
+ /** Empty room (VK-1105): in a line, it pushes what follows it to the line's end, the first one splitting the line's start
48
+ * from its end; anywhere else, the same room in a row of the app's. */
49
+ export declare function ListGap(_props: ListGapProps): ReactNode;
50
+ /** Whether a part stands in a `ListLine` (not on the door): the filter bar stands its pieces as the line's items there. */
51
+ export declare function useInLine(): boolean;
52
+ /** ⋯'s button of the line around a part (not on the door): a folded part whose panel is the app's own is called with it. */
53
+ export declare function useLineMore(): RefObject<HTMLButtonElement | null> | null;
54
+ /** A separator in a line (not on the door, VK-1106): `sep`, drawn only between two drawn items of its side. */
55
+ export declare function LineSep(): ReactNode;