viewkitjs 0.37.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.
- package/CHANGELOG.md +95 -0
- package/MIGRATION.md +7 -0
- package/fields/dist/query/figure-kinds.d.ts +2 -2
- package/fields/dist/query/figure-kinds.js +3 -0
- package/fields/dist/query/figures.d.ts +5 -3
- package/fields/dist/query/figures.js +13 -0
- package/fields/docs/reference/query.md +3 -3
- package/package.json +1 -1
- package/postgres/docs/guides/field-map.md +1 -1
- package/views/dist/atoms/HeaderChrome.d.ts +7 -0
- package/views/dist/atoms/HeaderChrome.js +15 -0
- package/views/dist/atoms/ToolbarButton.d.ts +1 -1
- package/views/dist/atoms/ToolbarButton.js +2 -2
- package/views/dist/atoms/defaults.js +4 -0
- package/views/dist/atoms/types.d.ts +39 -2
- package/views/dist/contract.d.ts +25 -11
- package/views/dist/contract.js +41 -6
- package/views/dist/controls/field/looks.d.ts +1 -1
- package/views/dist/controls/field/looks.js +9 -3
- package/views/dist/controls/field/tokens.d.ts +4 -0
- package/views/dist/controls/field/tokens.js +1 -0
- package/views/dist/controls/field.css +93 -1
- package/views/dist/controls/filter-editor/block.d.ts +3 -1
- package/views/dist/controls/filter-editor/block.js +4 -3
- package/views/dist/controls/filter-editor/filter-editor.d.ts +13 -2
- package/views/dist/controls/filter-editor/filter-editor.js +45 -15
- package/views/dist/controls/filter-editor/how.d.ts +3 -1
- package/views/dist/controls/filter-editor/map-filter-body.js +5 -4
- package/views/dist/controls/filter-editor/map-rules.d.ts +2 -1
- package/views/dist/controls/filter-editor/map-rules.js +3 -3
- package/views/dist/controls/glyphs/glyphs.js +2 -0
- package/views/dist/controls/inline-input.css +3 -2
- package/views/dist/controls/internal/menu-items.d.ts +2 -0
- package/views/dist/controls/internal/menu-items.js +1 -1
- package/views/dist/controls/internal/part-slot.d.ts +1 -1
- package/views/dist/controls/internal/part-slot.js +1 -1
- package/views/dist/controls/internal/read-token.d.ts +2 -1
- package/views/dist/controls/internal/read-token.js +2 -1
- package/views/dist/controls/internal/row-actions.d.ts +33 -0
- package/views/dist/controls/internal/row-actions.js +28 -0
- package/views/dist/controls/menu/map-menu.js +1 -1
- package/views/dist/controls/number-editor/tokens.d.ts +8 -0
- package/views/dist/controls/number-editor/tokens.js +2 -0
- package/views/dist/controls/number-editor.css +20 -0
- package/views/dist/controls/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +2 -2
- package/views/dist/controls/sheet/map-sheet.js +9 -6
- package/views/dist/controls/sort-editor/map-sort-body.js +1 -0
- package/views/dist/controls/sort-editor/sort-editor.d.ts +5 -1
- package/views/dist/controls/sort-editor/sort-editor.js +41 -13
- package/views/dist/controls/text-editor/tokens.d.ts +8 -0
- package/views/dist/controls/text-editor/tokens.js +2 -0
- package/views/dist/controls/text-editor.css +44 -2
- package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +1 -1
- package/views/dist/controls/toolbar-button/atom-toolbar-button.js +2 -2
- package/views/dist/controls/tooltip/tooltip.js +2 -1
- package/views/dist/editors/EditorPanel.js +1 -1
- package/views/dist/field-row/FieldRow.js +46 -15
- package/views/dist/field-row/editors/RowChipsEditor.js +3 -1
- package/views/dist/field-row/editors/RowDateEditor.js +3 -1
- package/views/dist/field-row/editors/RowNameEditor.js +3 -1
- package/views/dist/field-row/editors/RowPlaceEditor.js +4 -2
- package/views/dist/field-row/editors/RowRangeEditor.js +3 -1
- package/views/dist/field-row/editors/RowRelationEditor.js +5 -2
- package/views/dist/field-row/editors/RowSelectEditor.js +3 -1
- package/views/dist/field-row/editors/RowTextEditor.d.ts +7 -1
- package/views/dist/field-row/editors/RowTextEditor.js +25 -4
- package/views/dist/field-row/editors/RowValueListEditor.js +4 -4
- package/views/dist/field-row/editors/row-place.d.ts +33 -0
- package/views/dist/field-row/editors/row-place.js +141 -0
- package/views/dist/field-row/field-row-button.d.ts +21 -6
- package/views/dist/field-row/field-row-button.js +8 -3
- package/views/dist/field-row/row-target.d.ts +4 -1
- package/views/dist/field-row/row-target.js +1 -1
- package/views/dist/fields/binding.d.ts +4 -0
- package/views/dist/grid/chrome/GridAggregateMenu.d.ts +12 -11
- package/views/dist/grid/chrome/GridAggregateMenu.js +4 -3
- package/views/dist/grid/chrome/GridCellEditors.d.ts +1 -1
- package/views/dist/grid/chrome/GridCellOutline.d.ts +13 -1
- package/views/dist/grid/chrome/GridCellOutline.js +17 -0
- package/views/dist/grid/chrome/GridFooter.d.ts +12 -4
- package/views/dist/grid/chrome/GridFooter.js +11 -9
- package/views/dist/grid/chrome/GridHeader.js +4 -3
- package/views/dist/grid/chrome/GridNumberEditor.js +2 -1
- package/views/dist/grid/chrome/GridResizeHandle.d.ts +7 -3
- package/views/dist/grid/chrome/GridResizeHandle.js +2 -3
- package/views/dist/grid/chrome/GridRowCells.js +1 -1
- package/views/dist/grid/chrome/GridStructure.js +3 -3
- package/views/dist/grid/chrome/GridTable.js +1 -1
- package/views/dist/grid/chrome/GridTableSurface.js +1 -1
- package/views/dist/grid/chrome/GridTextEditor.js +3 -1
- package/views/dist/grid/chrome/grid-body-place.d.ts +2 -4
- package/views/dist/grid/chrome/grid-body-place.js +4 -4
- package/views/dist/grid/chrome/grid-edit-session.d.ts +7 -3
- package/views/dist/grid/chrome/grid-edit-session.js +12 -3
- package/views/dist/grid/chrome/grid-editor-layer.d.ts +5 -4
- package/views/dist/grid/chrome/grid-figure-value.js +10 -4
- package/views/dist/grid/chrome/grid-row-props.d.ts +1 -1
- package/views/dist/grid/chrome/grid-table-props.d.ts +11 -3
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +5 -1
- package/views/dist/grid/chrome/useGridKeyboard.js +9 -5
- package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +1 -1
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +8 -3
- package/views/dist/grid/grid.css +7 -3
- package/views/dist/internal/length.d.ts +2 -0
- package/views/dist/internal/length.js +16 -0
- package/views/dist/internal/over-cell.d.ts +8 -0
- package/views/dist/internal/over-cell.js +5 -0
- package/views/dist/list/bar-keys.d.ts +5 -0
- package/views/dist/list/bar-keys.js +2 -0
- package/views/dist/list/bar-parts.d.ts +27 -0
- package/views/dist/list/bar-parts.js +38 -0
- package/views/dist/list/buttons/clear-save.d.ts +7 -0
- package/views/dist/list/buttons/clear-save.js +15 -0
- package/views/dist/list/buttons/customize.d.ts +28 -0
- package/views/dist/list/buttons/customize.js +31 -0
- package/views/dist/list/buttons/filter.d.ts +32 -0
- package/views/dist/list/buttons/filter.js +60 -0
- package/views/dist/list/buttons/new.d.ts +18 -0
- package/views/dist/list/buttons/new.js +9 -0
- package/views/dist/list/buttons/quick.d.ts +15 -0
- package/views/dist/list/buttons/quick.js +24 -0
- package/views/dist/list/buttons/search.d.ts +18 -0
- package/views/dist/list/buttons/search.js +17 -0
- package/views/dist/list/buttons/shared.d.ts +91 -0
- package/views/dist/list/buttons/shared.js +131 -0
- package/views/dist/list/buttons/sort-filter.d.ts +6 -0
- package/views/dist/list/buttons/sort-filter.js +16 -0
- package/views/dist/list/buttons/sort.d.ts +17 -0
- package/views/dist/list/buttons/sort.js +34 -0
- package/views/dist/list/buttons/views.d.ts +21 -0
- package/views/dist/list/buttons/views.js +36 -0
- package/views/dist/list/editor-menus.d.ts +13 -0
- package/views/dist/list/editor-menus.js +13 -0
- package/views/dist/list/index.d.ts +41 -0
- package/views/dist/list/index.js +19 -0
- package/views/dist/list/line.d.ts +55 -0
- package/views/dist/list/line.js +221 -0
- package/views/dist/list/pane-box.d.ts +6 -0
- package/views/dist/list/pane-box.js +15 -0
- package/views/dist/list/panels/customize.d.ts +8 -0
- package/views/dist/list/panels/customize.js +23 -0
- package/views/dist/list/panels/filter-bar.d.ts +12 -0
- package/views/dist/list/panels/filter-bar.js +67 -0
- package/views/dist/list/panels/filter.d.ts +8 -0
- package/views/dist/list/panels/filter.js +23 -0
- package/views/dist/list/panels/quick.d.ts +7 -0
- package/views/dist/list/panels/quick.js +16 -0
- package/views/dist/list/panels/shared.d.ts +25 -0
- package/views/dist/list/panels/shared.js +33 -0
- package/views/dist/list/panels/sort.d.ts +8 -0
- package/views/dist/list/panels/sort.js +19 -0
- package/views/dist/list/panels/views.d.ts +13 -0
- package/views/dist/list/panels/views.js +27 -0
- package/views/dist/list/ready.d.ts +35 -0
- package/views/dist/list/ready.js +7 -0
- package/views/dist/list/root-base.d.ts +17 -0
- package/views/dist/list/root-base.js +9 -1
- package/views/dist/list/root.js +2 -2
- package/views/dist/list/store.d.ts +19 -0
- package/views/dist/list/store.js +40 -1
- package/views/dist/list/toolbar-model.d.ts +95 -0
- package/views/dist/list/toolbar-model.js +177 -0
- package/views/dist/list/toolbar.js +140 -328
- package/views/dist/list/views-axis.js +15 -4
- package/views/dist/model/aggregates.d.ts +18 -8
- package/views/dist/model/aggregates.js +16 -22
- package/views/dist/panels/react/filter/FilterEditor.d.ts +3 -1
- package/views/dist/panels/react/filter/FilterEditor.js +2 -2
- package/views/dist/panels/react/filter/filter-body.d.ts +3 -1
- package/views/dist/panels/react/filter/filter-body.js +2 -2
- package/views/dist/panels/react/sort/SortEditor.d.ts +3 -1
- package/views/dist/panels/react/sort/SortEditor.js +4 -4
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +80 -3
- package/views/dist/panels/react/toolbar/Toolbar.js +85 -52
- package/views/dist/panels/react/toolbar/ToolbarBarSorts.d.ts +9 -0
- package/views/dist/panels/react/toolbar/ToolbarBarSorts.js +57 -0
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +4 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +30 -0
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +6 -1
- package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +5 -0
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +6 -4
- package/views/dist/panels/react/toolbar/ToolbarViews.d.ts +7 -1
- package/views/dist/panels/react/toolbar/ToolbarViews.js +4 -4
- package/views/dist/panels/react/toolbar/sheet-host.d.ts +3 -0
- package/views/dist/panels/react/toolbar/sheet-host.js +6 -0
- package/views/dist/panels/react/toolbar/use-give-way.d.ts +6 -0
- package/views/dist/panels/react/toolbar/use-give-way.js +8 -1
- package/views/dist/panels/react/views-row/ViewPicker.d.ts +8 -1
- package/views/dist/panels/react/views-row/ViewPicker.js +12 -7
- package/views/dist/panels/settings/filter-groups.js +7 -0
- package/views/dist/provider/components.d.ts +38 -3
- package/views/dist/react.d.ts +1 -1
- package/views/dist/selection/bar-overflow.d.ts +2 -0
- package/views/dist/selection/bar-overflow.js +2 -1
- package/views/dist/selection/bar-props.d.ts +1 -1
- package/views/dist/selection/verbs.d.ts +2 -2
- package/views/dist/styles.css +268 -5
- package/views/dist/styles.unlayered.css +268 -5
- package/views/docs/contract.md +29 -15
- package/views/docs/controls/field.md +1 -0
- package/views/docs/controls/filter-editor.md +1 -1
- package/views/docs/controls/menu.md +1 -1
- package/views/docs/controls/number-editor.md +2 -0
- package/views/docs/controls/sort-editor.md +1 -1
- package/views/docs/controls/text-editor.md +2 -0
- package/views/docs/guides/atoms.md +1 -0
- package/views/docs/guides/selection.md +1 -1
- package/views/docs/guides/the-grid.md +3 -3
- package/views/docs/reference/controls.md +3 -3
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +4 -4
- package/views/docs/reference/list.md +168 -6
- package/views/docs/reference/looks.md +1 -1
- package/views/docs/reference/panels-react.md +7 -7
- package/views/docs/reference/react.md +13 -10
- package/views/docs/reference/selection.md +1 -1
- package/views/docs/reference/views.md +9 -7
- package/views/skills/views/SKILL.md +2 -1
|
@@ -16,7 +16,7 @@ export function ToolbarSortPill(props) {
|
|
|
16
16
|
return null;
|
|
17
17
|
return (_jsx("span", { "data-slot": props.row ? "vk-toolbar-sort-row" : "vk-toolbar-sort-pill", className: "relative inline-flex shrink-0 items-center gap-1", children: phone ? _jsx(PhonePill, { ...props }) : _jsx(ComputerPill, { ...props }) }));
|
|
18
18
|
}
|
|
19
|
-
function ComputerPill({ sorts, open: openIn, onOpenChange: onOpenChangeIn, host: Host, addAfter: addAfterIn = true, row = false, changed, }) {
|
|
19
|
+
function ComputerPill({ sorts, open: openIn, onOpenChange: onOpenChangeIn, host: Host, addAfter: addAfterIn = true, row = false, changed, empty, fieldsOnly = false, }) {
|
|
20
20
|
const addAfter = row ? false : addAfterIn;
|
|
21
21
|
const { components, icons, messages } = useViews();
|
|
22
22
|
const { Popover } = components;
|
|
@@ -31,7 +31,9 @@ function ComputerPill({ sorts, open: openIn, onOpenChange: onOpenChangeIn, host:
|
|
|
31
31
|
const asideOnly = !named && (sorts.setAside?.length ?? 0) > 0;
|
|
32
32
|
const places = openSortPlaces(sorts);
|
|
33
33
|
const can = canAddSortRule(sorts.rules, places);
|
|
34
|
-
const
|
|
34
|
+
const editorEmpty = row && empty === "editor" && !fieldsOnly;
|
|
35
|
+
const editorFirst = !fieldsOnly && (named || asideOnly || editorEmpty);
|
|
36
|
+
const opens = row ? { what: editorFirst ? "editor" : "fields", at: "pill", addSort: true } : pressed;
|
|
35
37
|
const Glyph = icons.sort;
|
|
36
38
|
const Plus = icons.add;
|
|
37
39
|
const name = messages({ key: "views.panels.sort" });
|
|
@@ -58,11 +60,11 @@ function ComputerPill({ sorts, open: openIn, onOpenChange: onOpenChangeIn, host:
|
|
|
58
60
|
...sorts,
|
|
59
61
|
onChange: (next, setAside) => {
|
|
60
62
|
sorts.onChange(next, setAside);
|
|
61
|
-
if (next.length === 0 && (setAside ?? sorts.setAside ?? []).length === 0)
|
|
63
|
+
if (next.length === 0 && (setAside ?? sorts.setAside ?? []).length === 0 && !editorEmpty)
|
|
62
64
|
close();
|
|
63
65
|
},
|
|
64
66
|
};
|
|
65
|
-
const content = opens.what === "editor" ? (_jsx(SortEditorHost, { sorts: editing, form: "computer", addSort: opens.addSort, onDone: () => close() })) : (_jsx(SortFieldList, { sorts: sorts, onPick: (value) => {
|
|
67
|
+
const content = opens.what === "editor" ? (_jsx(SortEditorHost, { sorts: editing, form: "computer", addSort: opens.addSort, onDone: () => close(), ...(editorEmpty && { empty: "editor" }) })) : (_jsx(SortFieldList, { sorts: sorts, onPick: (value) => {
|
|
66
68
|
const next = addSortRule(sorts.rules, value, places);
|
|
67
69
|
sorts.onChange(next);
|
|
68
70
|
close(true, opens.at === "add" && canAddSortRule(next, places));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import { type CollectionViewsInput, type ViewsLayout } from "../../views-row/model.js";
|
|
3
|
-
export declare function ToolbarViews({ views, viewsLayout, showCounts, as, stacked, }: {
|
|
3
|
+
export declare function ToolbarViews({ views, viewsLayout, showCounts, as, stacked, press, }: {
|
|
4
4
|
views: CollectionViewsInput<string>;
|
|
5
5
|
/** How several axes stand: `stacked` (the default) puts every axis after the first on the line beneath. */
|
|
6
6
|
viewsLayout?: ViewsLayout;
|
|
@@ -10,4 +10,10 @@ export declare function ToolbarViews({ views, viewsLayout, showCounts, as, stack
|
|
|
10
10
|
as?: "row" | "picker";
|
|
11
11
|
/** This part is the second line's: the axes a stacked layout pushes beneath. */
|
|
12
12
|
stacked?: boolean;
|
|
13
|
+
/** Its picker's list stands elsewhere (VK-1092): handed on to the picker, whose chip calls it and opens no list. */
|
|
14
|
+
press?: {
|
|
15
|
+
onPress: () => void;
|
|
16
|
+
expanded: boolean;
|
|
17
|
+
lit?: boolean;
|
|
18
|
+
};
|
|
13
19
|
}): ReactNode;
|
|
@@ -6,11 +6,11 @@ import { ViewAxes } from "../views-row/ViewAxes.js";
|
|
|
6
6
|
import { ViewsRowInFrameProvider } from "../views-row/in-frame.js";
|
|
7
7
|
import { ViewPicker } from "../views-row/ViewPicker.js";
|
|
8
8
|
import { useToolbarSlot } from "./context.js";
|
|
9
|
-
export function ToolbarViews({ views, viewsLayout, showCounts, as = "row", stacked = false, }) {
|
|
9
|
+
export function ToolbarViews({ views, viewsLayout, showCounts, as = "row", stacked = false, press, }) {
|
|
10
10
|
const { appFrame } = useToolbarSlot();
|
|
11
|
-
return (_jsx(ViewsRowInFrameProvider, { on: appFrame, children: _jsx(ToolbarViewsBody, { views: views, viewsLayout: viewsLayout, showCounts: showCounts, as: as, stacked: stacked }) }));
|
|
11
|
+
return (_jsx(ViewsRowInFrameProvider, { on: appFrame, children: _jsx(ToolbarViewsBody, { views: views, viewsLayout: viewsLayout, showCounts: showCounts, as: as, stacked: stacked, press: press }) }));
|
|
12
12
|
}
|
|
13
|
-
function ToolbarViewsBody({ views, viewsLayout, showCounts, as, stacked, }) {
|
|
13
|
+
function ToolbarViewsBody({ views, viewsLayout, showCounts, as, stacked, press, }) {
|
|
14
14
|
const { form, fold, tabsFolded } = useToolbarSlot();
|
|
15
15
|
const counted = showCounts === undefined ? views : (withCounts(views, showCounts) ?? views);
|
|
16
16
|
if (form === "phone") {
|
|
@@ -24,6 +24,6 @@ function ToolbarViewsBody({ views, viewsLayout, showCounts, as, stacked, }) {
|
|
|
24
24
|
if (!viewAxes)
|
|
25
25
|
return null;
|
|
26
26
|
if (as === "picker" && viewAxes.length === 1 && !stackedAxes)
|
|
27
|
-
return _jsx(ViewPicker, { axis: viewAxes[0] });
|
|
27
|
+
return _jsx(ViewPicker, { axis: viewAxes[0], ...(press && { press }) });
|
|
28
28
|
return _jsx(ViewAxes, { axes: viewAxes, folded: fold ? tabsFolded : undefined });
|
|
29
29
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { PanelSheet } from "../panel-sheet.js";
|
|
4
|
+
export function SheetHost({ open, onOpenChange, title, children }) {
|
|
5
|
+
return (_jsx(PanelSheet, { open: open, onOpenChange: onOpenChange, title: title, snap: "full", headed: true, children: children }));
|
|
6
|
+
}
|
|
@@ -2,3 +2,9 @@
|
|
|
2
2
|
export declare function overflows(line: HTMLElement): boolean;
|
|
3
3
|
/** The stage a line stands at, out of `max` steps; `on` false, 0. */
|
|
4
4
|
export declare function useGiveWay(line: HTMLElement | null, max: number, on: boolean): number;
|
|
5
|
+
/** The stage, and a fresh look to ask for (not on the door, VK-1105): a line whose parts draw themselves (`ListLine`) asks it
|
|
6
|
+
* when one of them changes its width on its own, which no width of the line's and no render of it shows. */
|
|
7
|
+
export declare function useGiveWayLook(line: HTMLElement | null, max: number, on: boolean): {
|
|
8
|
+
stage: number;
|
|
9
|
+
look: () => void;
|
|
10
|
+
};
|
|
@@ -29,6 +29,9 @@ export function overflows(line) {
|
|
|
29
29
|
return far > edge + 0.5;
|
|
30
30
|
}
|
|
31
31
|
export function useGiveWay(line, max, on) {
|
|
32
|
+
return useGiveWayLook(line, max, on).stage;
|
|
33
|
+
}
|
|
34
|
+
export function useGiveWayLook(line, max, on) {
|
|
32
35
|
const [fit, setFit] = useState({ stage: 0, mode: "done" });
|
|
33
36
|
const stage = on ? Math.min(fit.stage, max) : 0;
|
|
34
37
|
const ours = useRef(false);
|
|
@@ -80,7 +83,11 @@ export function useGiveWay(line, max, on) {
|
|
|
80
83
|
fonts?.removeEventListener?.("loadingdone", again);
|
|
81
84
|
};
|
|
82
85
|
}, [line, on, look]);
|
|
83
|
-
|
|
86
|
+
const lookNow = useCallback(() => {
|
|
87
|
+
if (line && on)
|
|
88
|
+
look(latest.current.stage, latest.current.max);
|
|
89
|
+
}, [line, on, look]);
|
|
90
|
+
return { stage, look: lookNow };
|
|
84
91
|
}
|
|
85
92
|
function freshLook(line, at, top, set) {
|
|
86
93
|
if (!line || line.querySelector(HOLDING))
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { type CollectionViewsConfig } from "../../views-row/model.js";
|
|
2
|
-
export declare function ViewPicker({ axis, className }: {
|
|
2
|
+
export declare function ViewPicker({ axis, className, press, }: {
|
|
3
3
|
axis: CollectionViewsConfig<string>;
|
|
4
4
|
className?: string;
|
|
5
|
+
/** Its list stands elsewhere (VK-1092: a placed views list): the chip calls `onPress`, says `expanded`, opens no list, and
|
|
6
|
+
* lights only with `lit` (the list standing because the chip showed it). */
|
|
7
|
+
press?: {
|
|
8
|
+
onPress: () => void;
|
|
9
|
+
expanded: boolean;
|
|
10
|
+
lit?: boolean;
|
|
11
|
+
};
|
|
5
12
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -13,7 +13,7 @@ import { ToolbarButton } from "../toolbar/ToolbarButton.js";
|
|
|
13
13
|
import { useViewsRowInFrame } from "./in-frame.js";
|
|
14
14
|
import { ViewCreatePill } from "./ViewCreatePill.js";
|
|
15
15
|
import { useNewView } from "./new-view.js";
|
|
16
|
-
export function ViewPicker({ axis, className }) {
|
|
16
|
+
export function ViewPicker({ axis, className, press, }) {
|
|
17
17
|
const context = useViews();
|
|
18
18
|
const { components, conventions, icons, messages } = context;
|
|
19
19
|
const { AppIcon, Popover, ViewsListBody } = components;
|
|
@@ -65,22 +65,27 @@ export function ViewPicker({ axis, className }) {
|
|
|
65
65
|
}) }));
|
|
66
66
|
const words = (_jsxs(_Fragment, { children: [_jsx("span", { className: "truncate", children: active?.label ?? messages({ key: "views.panels.view-fallback" }) }), active && !axis.hideCounts && typeof active.count === "number" && (_jsxs("span", { className: "font-medium opacity-70 tabular-nums", children: ["\u00B7 ", formatCount(active.count, conventions)] }))] }));
|
|
67
67
|
const onChipClick = (event) => {
|
|
68
|
-
|
|
68
|
+
if (press)
|
|
69
|
+
press.onPress();
|
|
70
|
+
else
|
|
71
|
+
toggle.triggerProps.onClick(event);
|
|
69
72
|
};
|
|
70
|
-
|
|
73
|
+
const expanded = press ? press.expanded : toggle.open;
|
|
74
|
+
const lit = press ? !!press.lit : toggle.open;
|
|
75
|
+
return (_jsxs(_Fragment, { children: [inFrame ? (_jsx(ToolbarButton, { ref: anchor, icon: active?.icon ? _jsx(AppIcon, { name: active.icon, className: "h-3.5 w-3.5 shrink-0" }) : null, label: messages({ key: "views.panels.view-change" }), part: "views-chip", ...(press ? { expanded } : { popup: "dialog" }), open: lit, onPointerDown: toggle.triggerProps.onPointerDown, onClick: onChipClick, children: words })) : (_jsx(PanelButton, { views: context, draw: {
|
|
71
76
|
frame: cx("h-8 max-w-full gap-1.5 px-2.5", className),
|
|
72
77
|
variant: "secondary",
|
|
73
78
|
size: "sm",
|
|
74
79
|
ref: anchor,
|
|
75
80
|
"aria-label": messages({ key: "views.panels.view-change" }),
|
|
76
|
-
"aria-haspopup": "dialog",
|
|
77
|
-
"aria-expanded":
|
|
81
|
+
...(!press && { "aria-haspopup": "dialog" }),
|
|
82
|
+
"aria-expanded": expanded,
|
|
78
83
|
"data-slot": "vk-views-chip",
|
|
79
|
-
"data-state":
|
|
84
|
+
"data-state": lit ? "open" : "closed",
|
|
80
85
|
onPointerDown: toggle.triggerProps.onPointerDown,
|
|
81
86
|
onClick: onChipClick,
|
|
82
87
|
children: (_jsxs(_Fragment, { children: [active?.icon && _jsx(AppIcon, { name: active.icon, className: "h-3.5 w-3.5 shrink-0" }), words, _jsx(Chevron, { className: "h-3.5 w-3.5 shrink-0 opacity-60" })] })),
|
|
83
|
-
} })), sheet ? (_jsx(PanelSheet, { open: toggle.open, onOpenChange: (next) => {
|
|
88
|
+
} })), press ? null : sheet ? (_jsx(PanelSheet, { open: toggle.open, onOpenChange: (next) => {
|
|
84
89
|
toggle.setOpen(next);
|
|
85
90
|
}, title: messages({ key: "views.panels.views-list" }), snap: "auto", ...(step.title !== undefined && { sheetTitle: step.title || listLabel, headed: !sheetDrawsClose }), ...(step.back &&
|
|
86
91
|
sheetDrawsClose && {
|
|
@@ -260,7 +260,14 @@ export function settingsFilterTree(input, write) {
|
|
|
260
260
|
});
|
|
261
261
|
return built.find((config) => config.key === key) ?? null;
|
|
262
262
|
};
|
|
263
|
+
const answered = new Map();
|
|
263
264
|
const optionsOf = (fieldKey, part, relation) => {
|
|
265
|
+
const key = `${fieldKey}\u0000${part ?? ""}\u0000${relation ?? ""}`;
|
|
266
|
+
if (!answered.has(key))
|
|
267
|
+
answered.set(key, optionsAnswer(fieldKey, part, relation));
|
|
268
|
+
return answered.get(key);
|
|
269
|
+
};
|
|
270
|
+
const optionsAnswer = (fieldKey, part, relation) => {
|
|
264
271
|
const target = relation !== undefined ? relationFilters?.targets[relation] : undefined;
|
|
265
272
|
if (relation !== undefined && !target)
|
|
266
273
|
return undefined;
|
|
@@ -38,7 +38,8 @@ export type ViewsButtonProps = {
|
|
|
38
38
|
/** The part's name, `vk-grid-row-more` on a row's ⋯. */
|
|
39
39
|
"data-slot"?: string;
|
|
40
40
|
/** Which one of a part that repeats, beside its `data-slot` (VK-1013: inside ViewKit's panels, under `panelControls`): a
|
|
41
|
-
* rule's field, an action's verb
|
|
41
|
+
* rule's field, an action's verb; and a record's field row's target (`vk-field-row-target`, `-beside`, `-under`), which the
|
|
42
|
+
* Field's Box dresses. Forward it to your element. */
|
|
42
43
|
"data-key"?: string;
|
|
43
44
|
/** A state flag: `""` (present, no value) while the menu this button opens is open; absent when closed. */
|
|
44
45
|
"data-open"?: "";
|
|
@@ -70,6 +71,10 @@ export type ViewsPopoverProps = {
|
|
|
70
71
|
* its own input); that editor focuses its input with `preventScroll`, so the
|
|
71
72
|
* page stays where it is however the popup places itself. Default true. */
|
|
72
73
|
initialFocus?: boolean;
|
|
74
|
+
/** False moves no focus as the popup closes: what opened it hands the focus back itself (a field row's editor, to its
|
|
75
|
+
* row). Forward it to your popup's return of focus (Base UI's `finalFocus`), as `initialFocus` to its first focus.
|
|
76
|
+
* Default true: focus goes back to what opened it. */
|
|
77
|
+
finalFocus?: boolean;
|
|
73
78
|
/** Called on a press outside the popup before it closes; return false to keep it open.
|
|
74
79
|
* `event` is the pointer press, with its `target` where the press landed, also when the
|
|
75
80
|
* focus that press moves is what would close the popup: a vetoed press holds against its
|
|
@@ -723,7 +728,8 @@ export type ViewsBodyStep = {
|
|
|
723
728
|
};
|
|
724
729
|
/** Which of the sort editor's menus a function is handed (VK-1063): a rule's ⋯ (a phone's and the narrow form's: a computer's rule
|
|
725
730
|
* has × and no ⋯), its `field` the sort's key (`rules[].value`), `index` its place; or a set-aside rule's ⋯, its `field` the
|
|
726
|
-
* rule's stored `fieldKey`.
|
|
731
|
+
* rule's stored `fieldKey`. Or (VK-1065) `row`, the buttons at a rule's end (× `delete` on a computer, ⋯ `more` elsewhere and on a
|
|
732
|
+
* set-aside rule, `aside: true`); `foot`, Add sort and Clear (`add`, `clear`). */
|
|
727
733
|
export type ViewsSortEditorItemsContext = ({
|
|
728
734
|
menu: "rule";
|
|
729
735
|
field: string;
|
|
@@ -731,21 +737,43 @@ export type ViewsSortEditorItemsContext = ({
|
|
|
731
737
|
} | {
|
|
732
738
|
menu: "aside";
|
|
733
739
|
field: string;
|
|
740
|
+
} | {
|
|
741
|
+
menu: "row";
|
|
742
|
+
field: string;
|
|
743
|
+
index: number;
|
|
744
|
+
} | {
|
|
745
|
+
menu: "row";
|
|
746
|
+
field: string;
|
|
747
|
+
aside: true;
|
|
748
|
+
} | {
|
|
749
|
+
menu: "foot";
|
|
734
750
|
}) & {
|
|
735
751
|
form: "computer" | "phone";
|
|
736
752
|
};
|
|
737
753
|
/** Which of the filter editor's menus (VK-1063): a rule's ⋮ or a set-aside rule's, named by its field (`field`, the rule's
|
|
738
754
|
* `fieldKey`; its `part`; the `relation` it stands under), or a group's actions; each by its `path` in the filter the body is handed
|
|
739
|
-
* (`ViewsFilterBodyProps.filter`): its indices through `items` and a relation rule's `where.items`, the whole filter `[]`.
|
|
755
|
+
* (`ViewsFilterBodyProps.filter`): its indices through `items` and a relation rule's `where.items`, the whole filter `[]`. Or (VK-1065)
|
|
756
|
+
* `row`, a rule's ⋮ (`more`), named as `rule` is, `aside: true` on a set-aside rule; `foot`, a foot's buttons by its group's `path`
|
|
757
|
+
* (`[]` the filter's own): `add`, `clear`, `delete`, `more`. */
|
|
740
758
|
export type ViewsFilterEditorItemsContext = ({
|
|
741
759
|
menu: "rule" | "aside";
|
|
742
760
|
field: string;
|
|
743
761
|
part?: string;
|
|
744
762
|
relation?: string;
|
|
745
763
|
path: number[];
|
|
764
|
+
} | {
|
|
765
|
+
menu: "row";
|
|
766
|
+
field: string;
|
|
767
|
+
part?: string;
|
|
768
|
+
relation?: string;
|
|
769
|
+
path: number[];
|
|
770
|
+
aside?: true;
|
|
746
771
|
} | {
|
|
747
772
|
menu: "group";
|
|
748
773
|
path: number[];
|
|
774
|
+
} | {
|
|
775
|
+
menu: "foot";
|
|
776
|
+
path: number[];
|
|
749
777
|
}) & {
|
|
750
778
|
form: "computer" | "phone";
|
|
751
779
|
};
|
|
@@ -811,6 +839,10 @@ export type ViewsSortBodyProps = {
|
|
|
811
839
|
onRulesChange: (rules: ViewsSortBodyProps["rules"][number][], setAside?: ViewsSortBodyProps["setAside"]) => void;
|
|
812
840
|
/** The job is done and what holds it closes. */
|
|
813
841
|
onDone: () => void;
|
|
842
|
+
/** What a computer's body shows with no rule and none set aside (VK-1091): nothing of its own, what opened it showing the
|
|
843
|
+
* fields instead (absent or `fields`), or that nothing sorts yet, with Add sort (`editor`). A body that ignores it draws as
|
|
844
|
+
* before. */
|
|
845
|
+
empty?: "fields" | "editor";
|
|
814
846
|
/** On a phone where the sheet's head doesn't draw them (`sheetActions: "bar"`): its ✕ (taking the rules and the
|
|
815
847
|
* set-aside sorts back to what they were as it opened) and ✓, for your body's own head. Absent on a computer, and
|
|
816
848
|
* under `head`, where the sheet holds them. */
|
|
@@ -920,6 +952,9 @@ export type ViewsFilterBodyProps = {
|
|
|
920
952
|
levels: number;
|
|
921
953
|
/** Whether the level may exclude its matches (`op: "not"`): an advanced filter's own group, not a top or a where. */
|
|
922
954
|
excludable: boolean;
|
|
955
|
+
/** What a computer's top level shows with nothing filtered (VK-1091): the fields, a pick adding its rule (absent or
|
|
956
|
+
* `fields`), or that nothing filters yet, with Add filter (`editor`). A body that ignores it draws as before. */
|
|
957
|
+
empty?: "fields" | "editor";
|
|
923
958
|
/** Where the level is a relation rule's where, edited in place (wrapping it in a group would pass 3 levels): the
|
|
924
959
|
* relation's field key, its words and its quantifier. Its rules name its far fields, and a quantifier handed back with
|
|
925
960
|
* the level is written to it. `gone`, present only where the list no longer lists the relation, is why, in words
|
package/views/dist/react.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ export type { ViewsIconProps, ViewsIcons } from "./provider/icons.js";
|
|
|
11
11
|
export { NOOP_PORTS, NOOP_TOAST } from "./provider/ports.js";
|
|
12
12
|
export type { ViewsClipboardPort, ViewsConfirmPort, ViewsConfirmRequest, ViewsHapticsPort, ViewsPorts, ViewsPrefsPort, ViewsResolvedPorts, ViewsToastPort, } from "./provider/ports.js";
|
|
13
13
|
export { DEFAULT_VIEWS_ATOMS } from "./atoms/defaults.js";
|
|
14
|
-
export type { ViewsAtoms, ViewsAvatarProps, ViewsCommandMenuProps, ViewsRowMenuItem, ViewsRowMenuProps, ViewsListProps, ViewsRelationLinkProps, ViewsRelationRolesProps, ViewsRelationChipProps, ViewsRelationChipLinkProps, ViewsCellMoreProps, ViewsLoadingProps, ViewsLoadMoreProps, ViewsPlatformMarkProps, ViewsRowContentProps, ViewsRowProps, ViewsSelectionSheetProps, ViewsStatusBadgeProps, ViewsStatusOption, ViewsStatusPlace, ViewsStatusMarkerProps, ViewsTagProps, ViewsTickBoxProps, ViewsChoiceRowProps, ViewsCheckRowProps, ViewsRadioRowProps, ViewsDirectionButtonProps, ViewsMenuRowProps, ViewsToggleRowProps, ViewsPanelSearchProps, ViewsPillProps, ViewsRangeCalendarProps, ViewsToolbarButtonProps, ViewsToolbarButtonPart, ViewsFramePart, } from "./atoms/types.js";
|
|
14
|
+
export type { ViewsAtoms, ViewsAvatarProps, ViewsCommandMenuProps, ViewsRowMenuItem, ViewsRowMenuProps, ViewsListProps, ViewsRelationLinkProps, ViewsRelationRolesProps, ViewsRelationChipProps, ViewsRelationChipLinkProps, ViewsCellMoreProps, ViewsHeaderGlyphProps, ViewsHeaderResizeHandleProps, ViewsHeaderSortMarkProps, ViewsLoadingProps, ViewsLoadMoreProps, ViewsPlatformMarkProps, ViewsRowContentProps, ViewsRowProps, ViewsSelectionSheetProps, ViewsStatusBadgeProps, ViewsStatusOption, ViewsStatusPlace, ViewsStatusMarkerProps, ViewsTagProps, ViewsTickBoxProps, ViewsChoiceRowProps, ViewsCheckRowProps, ViewsRadioRowProps, ViewsDirectionButtonProps, ViewsMenuRowProps, ViewsToggleRowProps, ViewsPanelSearchProps, ViewsPillProps, ViewsRangeCalendarProps, ViewsToolbarButtonProps, ViewsToolbarButtonPart, ViewsFramePart, } from "./atoms/types.js";
|
|
15
15
|
export type { ComponentName, PortName, ViewsIconName, ViewsMessage, ViewsMessageResolver } from "./contract.js";
|
|
@@ -2,6 +2,8 @@ import type { ViewsMenuItem } from "../provider/components.js";
|
|
|
2
2
|
import type { SelectionVerb } from "./verbs.js";
|
|
3
3
|
/** How many verbs stay on the bar before the rest fold into More. */
|
|
4
4
|
export declare const INLINE_VERBS = 4;
|
|
5
|
+
/** The first four verbs not marked `more` stand on the bar. More holds the marked ones, then the rest past
|
|
6
|
+
* four: the components map's bar's order (`moreRows`), so both list More alike. */
|
|
5
7
|
export declare function splitVerbs(verbs: readonly SelectionVerb[]): {
|
|
6
8
|
inline: SelectionVerb[];
|
|
7
9
|
overflow: SelectionVerb[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const INLINE_VERBS = 4;
|
|
2
2
|
export function splitVerbs(verbs) {
|
|
3
|
-
|
|
3
|
+
const onBar = verbs.filter((verb) => !verb.more), kept = verbs.filter((verb) => verb.more);
|
|
4
|
+
return { inline: onBar.slice(0, INLINE_VERBS), overflow: [...kept, ...onBar.slice(INLINE_VERBS)] };
|
|
4
5
|
}
|
|
5
6
|
export function overflowItems(overflow) {
|
|
6
7
|
const reason = (disabled, why) => disabled && why ? { disabledReason: why } : {};
|
|
@@ -11,7 +11,7 @@ export type SelectionBarProps = {
|
|
|
11
11
|
};
|
|
12
12
|
/** Clears the selection: the count chip, the phone's ✕. */
|
|
13
13
|
onClear: () => void;
|
|
14
|
-
/** What the selection lets a person do, in order: the first four on
|
|
14
|
+
/** What the selection lets a person do, in order: the first four not marked `more` on ViewKit's own bar, the rest in More. */
|
|
15
15
|
verbs: readonly SelectionVerb[];
|
|
16
16
|
/** A batch is running: every control is disabled until it ends. */
|
|
17
17
|
busy?: boolean;
|
|
@@ -35,7 +35,7 @@ export type SelectionOptionsVerb = {
|
|
|
35
35
|
/** Its values: a status by its `slot`, a category by its `color`, a person or a company by `avatarUrl` (null: their initials)
|
|
36
36
|
* and `kind`. ViewKit's own bar reads the value, the label, the slot and the colour. */
|
|
37
37
|
options: ViewsPickerItem[];
|
|
38
|
-
/** Kept off the bar, in More
|
|
38
|
+
/** Kept off the bar, in More: on ViewKit's own bar and on CONTROLS.SelectionBar's. */
|
|
39
39
|
more?: boolean;
|
|
40
40
|
/** What every picked row holds, when they hold the same: a value, or null when every one is empty; left out, they differ.
|
|
41
41
|
* CONTROLS.SelectionBar's bar marks it. */
|
|
@@ -58,7 +58,7 @@ export type SelectionVerb = ({
|
|
|
58
58
|
kind: "group";
|
|
59
59
|
label: string;
|
|
60
60
|
icon?: ReactNode;
|
|
61
|
-
/** Kept off the bar, in More
|
|
61
|
+
/** Kept off the bar, in More: on ViewKit's own bar and on CONTROLS.SelectionBar's. */
|
|
62
62
|
more?: boolean;
|
|
63
63
|
disabled?: boolean;
|
|
64
64
|
/** Why the group is disabled: its own button and More's row carry it, and so does each of its rows that
|