viewkitjs 0.32.0 → 0.33.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 +69 -0
- package/fields/dist/index.d.ts +1 -1
- package/fields/dist/index.js +1 -1
- package/fields/dist/query/evaluate.d.ts +7 -0
- package/fields/dist/query/exact-number.d.ts +8 -2
- package/fields/dist/query/exact-number.js +14 -1
- package/fields/dist/query/sort.js +13 -10
- package/fields/dist/registry.js +5 -1
- package/fields/dist/types.d.ts +4 -1
- package/fields/dist/zod.d.ts +5 -0
- package/fields/dist/zod.js +10 -1
- package/fields/docs/guides/contact-values.md +12 -0
- package/fields/docs/guides/field-types.md +1 -1
- package/fields/docs/guides/queries.md +3 -1
- package/fields/docs/reference/fields.md +1 -0
- package/package.json +1 -1
- package/postgres/dist/check.js +4 -1
- package/postgres/dist/definitions/formula-forms.js +3 -1
- package/postgres/dist/definitions/money.js +2 -1
- package/postgres/dist/page.js +6 -3
- package/postgres/dist/rules.d.ts +15 -1
- package/postgres/dist/rules.js +16 -0
- package/postgres/dist/sort.js +7 -2
- package/postgres/docs/guides/definitions.md +1 -1
- package/postgres/docs/guides/field-map.md +1 -1
- package/postgres/docs/reference/definitions.md +1 -1
- package/postgres/docs/reference/postgres.md +1 -1
- package/views/dist/atoms/ToolbarButton.d.ts +1 -1
- package/views/dist/atoms/ToolbarButton.js +4 -3
- package/views/dist/atoms/frame-parts.d.ts +6 -0
- package/views/dist/atoms/frame-parts.js +15 -0
- package/views/dist/atoms/types.d.ts +16 -7
- package/views/dist/cells/cell-title.d.ts +3 -1
- package/views/dist/cells/cell-title.js +2 -2
- package/views/dist/cells/cell-values.js +2 -2
- package/views/dist/contract.d.ts +31 -6
- package/views/dist/contract.js +123 -0
- package/views/dist/controls/button/map-button.js +2 -0
- package/views/dist/controls/checkbox/checkbox.d.ts +3 -2
- package/views/dist/controls/checkbox/checkbox.js +2 -2
- package/views/dist/controls/compound-editor/compound-editor.d.ts +1 -1
- package/views/dist/controls/compound-editor/name-parts.js +4 -4
- package/views/dist/controls/compound-editor/place-parts.js +19 -19
- package/views/dist/controls/compound-editor/range-parts.js +14 -14
- package/views/dist/controls/compound-editor/row.d.ts +3 -1
- package/views/dist/controls/compound-editor/row.js +2 -2
- package/views/dist/controls/controls.d.ts +2 -0
- package/views/dist/controls/controls.js +2 -0
- package/views/dist/controls/customize/customize.js +37 -35
- package/views/dist/controls/customize/map-customize-body.d.ts +2 -0
- package/views/dist/controls/customize/map-customize-body.js +4 -0
- package/views/dist/controls/date-editor/date-days.js +2 -2
- package/views/dist/controls/date-editor/date-editor.js +18 -18
- package/views/dist/controls/date-editor/date-parts.js +6 -6
- package/views/dist/controls/date-editor/map-calendar.js +1 -1
- package/views/dist/controls/date-editor.css +2 -2
- package/views/dist/controls/field/field.d.ts +3 -0
- package/views/dist/controls/field/field.js +6 -6
- package/views/dist/controls/filter-editor/block.d.ts +2 -2
- package/views/dist/controls/filter-editor/block.js +5 -5
- package/views/dist/controls/filter-editor/filter-editor.js +31 -33
- package/views/dist/controls/filter-editor/how.d.ts +3 -1
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +1 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +7 -3
- package/views/dist/controls/filter-editor/map-rules.js +1 -1
- package/views/dist/controls/filter-editor/parts.js +2 -1
- package/views/dist/controls/group-editor/group-editor.js +15 -13
- package/views/dist/controls/index.d.ts +2 -0
- package/views/dist/controls/index.js +1 -0
- package/views/dist/controls/input/input.js +2 -2
- package/views/dist/controls/input/map-input.js +2 -0
- package/views/dist/controls/internal/editor-parts.js +1 -1
- package/views/dist/controls/internal/map-panel-controls.d.ts +8 -0
- package/views/dist/controls/internal/map-panel-controls.js +20 -0
- package/views/dist/controls/internal/panel-controls.d.ts +50 -0
- package/views/dist/controls/internal/panel-controls.js +197 -0
- package/views/dist/controls/internal/part-slot.d.ts +12 -0
- package/views/dist/controls/internal/part-slot.js +5 -0
- package/views/dist/controls/links-editor/links-editor.d.ts +1 -1
- package/views/dist/controls/links-editor/links-editor.js +27 -27
- package/views/dist/controls/menu/map-menu.d.ts +2 -2
- package/views/dist/controls/menu/map-menu.js +15 -12
- package/views/dist/controls/menu/menu.d.ts +2 -0
- package/views/dist/controls/menu/menu.js +3 -3
- package/views/dist/controls/menu-list/menu-list.d.ts +14 -4
- package/views/dist/controls/menu-list/menu-list.js +23 -22
- package/views/dist/controls/notice/notice.d.ts +3 -1
- package/views/dist/controls/notice/notice.js +2 -2
- package/views/dist/controls/number-editor/number-editor.d.ts +1 -1
- package/views/dist/controls/number-editor/number-editor.js +13 -13
- package/views/dist/controls/number-field/number-field.js +5 -3
- package/views/dist/controls/pane/pane.d.ts +4 -2
- package/views/dist/controls/pane/pane.js +4 -4
- package/views/dist/controls/picker/picker.d.ts +2 -0
- package/views/dist/controls/picker/picker.js +37 -36
- package/views/dist/controls/picker/rows.d.ts +4 -0
- package/views/dist/controls/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +4 -2
- package/views/dist/controls/quick-filters/quick-filters.js +4 -4
- package/views/dist/controls/radio/radio.d.ts +3 -0
- package/views/dist/controls/radio/radio.js +4 -3
- package/views/dist/controls/select/map-select.d.ts +3 -0
- package/views/dist/controls/select/map-select.js +8 -0
- package/views/dist/controls/select/select.d.ts +3 -0
- package/views/dist/controls/select/select.js +3 -3
- package/views/dist/controls/sheet/bottom-sheet.d.ts +5 -1
- package/views/dist/controls/sheet/bottom-sheet.js +2 -2
- package/views/dist/controls/sheet/map-sheet.js +1 -1
- package/views/dist/controls/sort-editor/map-sort-body.d.ts +1 -0
- package/views/dist/controls/sort-editor/map-sort-body.js +7 -3
- package/views/dist/controls/sort-editor/sort-editor.js +24 -26
- package/views/dist/controls/sort-editor.css +5 -0
- package/views/dist/controls/text-editor/text-editor.d.ts +1 -1
- package/views/dist/controls/text-editor/text-editor.js +8 -8
- package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +3 -3
- package/views/dist/controls/toolbar-button/atom-toolbar-button.js +7 -6
- package/views/dist/controls/values-editor/values-editor.d.ts +1 -1
- package/views/dist/controls/values-editor/values-editor.js +22 -22
- package/views/dist/controls/views-list/map-view-menu.js +1 -1
- package/views/dist/controls/views-list/view-menu.js +6 -6
- package/views/dist/controls/views-list/views-list.js +4 -4
- package/views/dist/editors/EditorPanel.js +1 -1
- package/views/dist/field-row/FieldRow.js +13 -0
- package/views/dist/fields/money.d.ts +5 -2
- package/views/dist/fields/money.js +14 -2
- package/views/dist/grid/chrome/GridTable.js +4 -1
- package/views/dist/grid/chrome/cell-clipboard.d.ts +4 -2
- package/views/dist/grid/chrome/cell-clipboard.js +2 -2
- package/views/dist/grid/chrome/cells.js +3 -1
- package/views/dist/grid/chrome/grid-row-menu-items.js +1 -1
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +4 -1
- package/views/dist/grid/chrome/useGridKeyboard.js +29 -6
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +9 -2
- package/views/dist/grid/core/clipboard-model.d.ts +3 -1
- package/views/dist/grid/core/clipboard-model.js +9 -8
- package/views/dist/grid/core/editing-controller.d.ts +3 -0
- package/views/dist/grid/core/editing-controller.js +6 -0
- package/views/dist/grid/core/edits-sink.d.ts +19 -0
- package/views/dist/grid/core/edits-sink.js +2 -0
- package/views/dist/grid/core/spreadsheet-operations.js +1 -1
- package/views/dist/grid/core/useGridEditing.d.ts +5 -0
- package/views/dist/grid/core/useGridEditing.js +6 -0
- package/views/dist/list/answer.d.ts +40 -0
- package/views/dist/list/answer.js +43 -0
- package/views/dist/list/bulk-bar.d.ts +7 -0
- package/views/dist/list/bulk-bar.js +10 -0
- package/views/dist/list/columns.d.ts +24 -0
- package/views/dist/list/columns.js +27 -0
- package/views/dist/list/edits.d.ts +19 -0
- package/views/dist/list/edits.js +56 -0
- package/views/dist/list/grid.d.ts +11 -0
- package/views/dist/list/grid.js +76 -0
- package/views/dist/list/index.d.ts +14 -1
- package/views/dist/list/index.js +4 -1
- package/views/dist/list/link.d.ts +8 -0
- package/views/dist/list/link.js +78 -0
- package/views/dist/list/list.d.ts +70 -0
- package/views/dist/list/list.js +14 -0
- package/views/dist/list/parts.js +10 -3
- package/views/dist/list/root-base.d.ts +46 -0
- package/views/dist/list/root-base.js +137 -0
- package/views/dist/list/root.d.ts +35 -34
- package/views/dist/list/root.js +153 -113
- package/views/dist/list/source-answers.d.ts +39 -0
- package/views/dist/list/source-answers.js +225 -0
- package/views/dist/list/store.d.ts +37 -5
- package/views/dist/list/store.js +31 -0
- package/views/dist/list/toolbar.d.ts +3 -2
- package/views/dist/list/toolbar.js +14 -2
- package/views/dist/list/views-axis.js +4 -2
- package/views/dist/list/views.d.ts +7 -2
- package/views/dist/list/views.js +16 -5
- package/views/dist/model/column-capabilities.d.ts +13 -0
- package/views/dist/model/column-capabilities.js +23 -2
- package/views/dist/model/column-schema.d.ts +11 -1
- package/views/dist/model/view-rules.js +1 -0
- package/views/dist/panels/model.d.ts +2 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +8 -2
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +2 -2
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +8 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +12 -3
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +4 -4
- package/views/dist/panels/react/toolbar/ToolbarButton.js +4 -1
- package/views/dist/panels/react/toolbar/ToolbarFilter.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarNew.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSort.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +6 -4
- package/views/dist/panels/react/toolbar/context.d.ts +10 -1
- package/views/dist/panels/react/toolbar/panel-part.d.ts +4 -1
- package/views/dist/panels/react/toolbar/panel-part.js +5 -3
- package/views/dist/panels/settings/filter-groups.js +6 -1
- package/views/dist/provider/ViewsProvider.d.ts +6 -2
- package/views/dist/provider/ViewsProvider.js +18 -1
- package/views/dist/provider/components.d.ts +59 -0
- package/views/dist/provider/components.js +1 -1
- package/views/dist/provider/context.d.ts +4 -1
- package/views/dist/provider/own-control.d.ts +4 -0
- package/views/dist/provider/own-control.js +7 -0
- package/views/dist/provider/select-items.d.ts +3 -0
- package/views/dist/provider/select-items.js +6 -0
- package/views/dist/react.d.ts +4 -2
- package/views/dist/react.js +2 -0
- package/views/dist/styles.css +86 -78
- package/views/dist/styles.unlayered.css +86 -78
- package/views/docs/contract.md +252 -5
- package/views/docs/controls/compound-editor.md +4 -0
- package/views/docs/controls/customize.md +6 -0
- package/views/docs/controls/date-editor.md +4 -0
- package/views/docs/controls/field.md +4 -0
- package/views/docs/controls/filter-editor.md +8 -0
- package/views/docs/controls/group-editor.md +6 -0
- package/views/docs/controls/input.md +4 -0
- package/views/docs/controls/links-editor.md +4 -0
- package/views/docs/controls/menu-list.md +8 -0
- package/views/docs/controls/menu.md +4 -0
- package/views/docs/controls/notice.md +4 -0
- package/views/docs/controls/number-editor.md +4 -0
- package/views/docs/controls/pane.md +4 -0
- package/views/docs/controls/picker.md +8 -0
- package/views/docs/controls/quick-filters.md +6 -0
- package/views/docs/controls/radio.md +4 -0
- package/views/docs/controls/select.md +8 -0
- package/views/docs/controls/sheet.md +4 -0
- package/views/docs/controls/sort-editor.md +8 -0
- package/views/docs/controls/text-editor.md +4 -0
- package/views/docs/controls/values-editor.md +4 -0
- package/views/docs/controls/views-list.md +6 -0
- package/views/docs/guides/the-grid.md +2 -2
- package/views/docs/guides/the-provider.md +19 -2
- package/views/docs/reference/controls.md +7 -5
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +1 -1
- package/views/docs/reference/list.md +141 -11
- package/views/docs/reference/panels-react.md +2 -2
- package/views/docs/reference/react.md +15 -9
- package/views/docs/reference/views.md +8 -4
- package/views/docs/reshaping.md +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,75 @@ Until 0.19.0 ViewKit shipped as three packages; their changes are in [fields/CHA
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.33.0] — 2026-12-03
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `viewkitjs/views/react`: the provider's `panelControls` draws your own `Button`, `Select`, `Menu`, `Popover` and `Input` inside the sort and filter panels (`true`, or the names you want), each handed the components map's props and the part's `data-slot` and `data-key`. Nothing changes without it, and a control of `CONTROLS`' stays ViewKit's whatever it says. `PanelControlName`, `PANEL_CONTROL_NAMES` and `flatSelectItems` (a Select's rows one level in, flattened and named by their path) are exported.
|
|
13
|
+
- The components map takes an optional `Select` (`ViewsSelectProps`, `ViewsSelectItem`), drawn only inside the panels under `panelControls`; `CONTROLS.Select` (`MapSelect`, from `viewkitjs/views/controls`) is ViewKit's own. A `Select` of your own that `panelControls` doesn't name is never drawn, and the provider says so once in development.
|
|
14
|
+
- `ViewsButtonProps` takes `data-key`, `ViewsMenuItem` takes `slot` (a row's public name, which ViewKit's own Menu draws too), and `ViewsPopoverProps` takes `label` (its name to a screen reader).
|
|
15
|
+
- `viewkitjs/fields`: a url field can say `bareHost: "https"`. A host typed with no scheme (`acme.ro`, `acme.ro/work`) is then stored as `https://` and the host, where it was refused for naming no scheme. Every place a value is committed does it the same way: a grid cell, a paste, a field row, `acceptFieldCommit` and `zodFor` on your route. An address that names its scheme is kept as typed, text that is no host is still refused in the same words, the ceiling (`validation.maxLength`) counts what is stored, and a url kept as stored comes back as it was. Absent, nothing changes.
|
|
16
|
+
- `viewkitjs/fields`: `withUrlScheme(text)` is that rule: trimmed text naming no scheme, whose host holds a dot, with `https://` before it; anything else trimmed and unchanged.
|
|
17
|
+
- `viewkitjs/views`: `ViewsFilterBodyField.integer` is `true` on a number field that holds whole numbers only, so your own filter body's box can take whole numbers.
|
|
18
|
+
- `viewkitjs/views/model`: `withEditThroughLocks(config, fields)` gives a list's locks with each edit-through pair locked together: a lock stored under a worked-out field edited through a stored one (`editThrough`), or under that stored field, holds under both keys. The stored config is untouched, so each field keeps its own lock toggle. A surface that checks a lock by field key, such as a record's `LockedResolver`, passes its fields through it to agree with the grid.
|
|
19
|
+
- `viewkitjs/views/grid`: `cellCopyText(column, value, language?)` takes the names language a place's country is written in; without it, English, as before.
|
|
20
|
+
- `viewkitjs/postgres`: `FilterContext.sortCurrency`, the currency a money field that converts is sorted in when `currencies` names none for it, your app's own, say. The rows then order by each amount converted into it, so amounts in different currencies change places when the direction flips, while each row still reads in its own currency. A page's cursor is bound to it; one that is no currency is refused.
|
|
21
|
+
- `viewkitjs/fields/query`: `ViewFieldReader.sortAmountOf(row, key)`, the amount a money field sorts by when its cells show each row's own currency, converted into one currency for the whole list. `compareBy` orders by it, with no code clusters, where it answers both rows.
|
|
22
|
+
- `viewkitjs/views`: `ListColumn.sortAccessor`, set by `readMoneyColumns` on a convertible column read in Original: each row's figure in the reader's default currency. The grid's reader answers `sortAmountOf` from it, so an in-memory sort agrees with a server's sorted by `sortCurrency`. `readMoneyColumn` takes the currency as an optional third argument.
|
|
23
|
+
- `viewkitjs/views/list`: `List`, a whole list in one component. Hand it `id`, your fields (`defineFields`), your rows and one `save`, and it draws the toolbar, the grid, saved views, edits with undo and redo, and the bulk bar, in the Outright look, on a computer and a phone. Columns come from the fields, changed by key (`columns`, with `bind` for a field its key can't bind); the address carries the open view (`link`, on by default); `can` takes away editing or sharing; `menus`, `toolbarParts`, and `toolbar`, `grid` and `bulk` reach every part.
|
|
24
|
+
- `viewkitjs/views/list`: `ListGrid` (the grid reading its list root) and `ListBulkBar` (the selection bar over the root's picks), for an arrangement of your own inside `ListRoot`.
|
|
25
|
+
- `viewkitjs/views/list`: `ListRoot` takes a list's data in either mode: `fields`, `rows`, `columns`, `save` and `can`; in store mode `link={true}` carries the open view in the address, and the open view is kept on the device. `ListState` gains `columns`, `answer`, `edits` and `redo()`; `ListViewsState.openView` takes a change to lay over the view.
|
|
26
|
+
- `viewkitjs/views/list`: `ListToolbar` takes its `columns`, group heads and filter values from a root that holds a list's fields and rows.
|
|
27
|
+
- `viewkitjs/views/list`: the types `ListProps`, `ListGridProps`, `ListBulkBarProps`, `ListColumnOverride`, `ListColumnsOverride`, `ListFieldsRegistry`, `ListAnswerState` and `ListData`; `ListChange` and `ListSave` are named here too.
|
|
28
|
+
- `viewkitjs/views/list`: `List` and `ListRoot` take their rows from a `source` in place of `rows`: `fetchSource(url)`, or your server action as it stands. The list asks one list request per part it draws, each answer through `answerFor`. It asks for the first page as the settings or the quick filters' hold change, the next page and a group's next page as their ends come near, every matching row's ids as your app calls `select("all")`, each saved view's count while Show counts is on, the quick filters' counts while their panel is open, and each text field's values while a filter panel is open. An answer a newer request has outrun is dropped, and no page is asked with a cursor from older settings. While the first page is out the grid shows its wait; a group the source sends unnamed takes its field's name. A refusal shows in the grid's empty state in your server's words; a throw is said through the toast, and the rows shown stay. Picks clear as the quick filters' hold changes, as they do for the search, filter and group. `pageSize` sets a page, 50 by default, held between 1 and 1000.
|
|
29
|
+
- `viewkitjs/views/list`: `ListRoot` and `List` take `quickFilters`, whose hold narrows the rows, held in memory or from a source. `ListState` gains `loadMore()` and `loadGroup(key)`; `ListAnswerState` gains `more`, `paged`, `viewCounts` and `holdCounts`.
|
|
30
|
+
- `viewkitjs/views/react`: every button the toolbar draws now hands your `ToolbarButton` its `part`, named after the `toolbarParts` place it stands in: `options`, `search`, `quick`, `new`, `sort`, `filter`, `filter-add`, `filters` (each of a rule's four joined buttons), `advanced-filters` and `sort-pill`; a place's second kind of button by a name of its own, `sort-add` (the + after the sort) and `more-filters` ("+N filters"); and ⋯ `more`. Before, only the views row's parts, Clear and Save in an app's own frame were named. New type: `ViewsFramePart`, those six.
|
|
31
|
+
- `viewkitjs/views/react`: `ViewsToolbarButtonProps` takes `className`, the class its toolbar place hands: put it on the button. ViewKit's own button and `CONTROL_ATOMS`' put it there.
|
|
32
|
+
- `viewkitjs/views/panels/react`: a `toolbarParts` place (`ToolbarPartPlace`) takes `className`, put on every toolbar button the part draws, and `button`, your own button for the part, drawn in place of your `ToolbarButton` and handed the same props, `ref` included, so what it opens still hangs at it. Hand neither and every toolbar draws exactly as before.
|
|
33
|
+
- `viewkitjs/views`: every part inside the default panels has a public name. The sort, filter and group editors, Customize, the views list, a view's menu and the quick filters mark each part with a `data-slot` of its own (`vk-sort-rule`, `vk-sort-add`, `vk-filter-rule`, `vk-customize-section` …, listed in `PANEL_SLOTS` and the contract), and a part that repeats says which one it is (`data-key`; a rule its place, `data-index`), so an app's stylesheet dresses one sort rule, Add sort or one Customize section on its own. An app that styles nothing draws as before.
|
|
34
|
+
- `viewkitjs/views/controls`: a Menu list's entry and choice and a Picker's item take `slot` (`PartSlot`), drawn on the row in every form; the Select's box, the Radio's label, `PaneHead`, `PaneFoot`, `Notice` and a Menu's popup take a handed `data-slot`; the Picker's `menuSlot` names its rows' menus.
|
|
35
|
+
- `ViewsMenuProps` takes `data-slot`: ViewKit's own Menu draws it on its popup and names that menu's rows by their items' keys.
|
|
36
|
+
- `data-toolbar-item`, the folding toolbar's mark of each place (its key, an app's own included), is public.
|
|
37
|
+
- `viewkitjs/views/controls`: every part inside the default field editors has a public `data-slot`, the same in the grid, the field row and a phone's sheet, on the box a person sees: the date editor and its calendar (`vk-date-*`, `vk-calendar`: its quick picks, line, time, head, days, months, years, quarters, parts, wheels), the text and number editors (`vk-text-*`, `vk-number-*`), the name, place and range editor (`vk-parts-*`, each part by `data-key`), the values editor (`vk-values-*`, each row by `data-index`) and the links editor (`vk-links-*`, each link by its record, each field by its id); every editor's ✕, ✓ and a step's ‹ are `vk-editor-close`, `vk-editor-save` and `vk-editor-back`. Listed in `EDITOR_PART_SLOTS` and `docs/contract.md`. An app dresses one part by its name; with nothing dressed, every editor draws as it did.
|
|
38
|
+
- `Input` draws a handed `data-slot` and `data-key` on its box; `Field` on its root in every form; `SheetButton` and `SheetHead` (`backSlot`) on their buttons.
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- The filter editor's field and how boxes carry `vk-filter-field` and `vk-filter-how` on the box itself (the Select's, `data-kit="select"`), as the sort's do, no longer on the box's wrapper. A stylesheet that dressed the wrapper by those names now dresses the box.
|
|
43
|
+
- `viewkitjs/views/react`'s size budget rises from 25 to 30 kB gzipped: the provider's `panelControls`, `PANEL_CONTROL_NAMES`, `flatSelectItems` and the own-control mark brought it to 25.0 kB.
|
|
44
|
+
- `viewkitjs/views`: a column's `indicator` is handed the value its cell shows beside the row, as `render` is: `indicator?: (row, cell?: { value })`. While a write saves (a paste, a fill, an edit), `cell.value` is the value being saved, which the cell already draws; otherwise it is what `accessor` reads. An indicator read from `cell.value` agrees with the value beside it from the moment it shows, and goes back with it if the save fails. An indicator that reads only the row works as before.
|
|
45
|
+
- A money column read in each row's own currency, sorted in memory after `readMoneyColumns`, now orders by its amount in the reader's default currency instead of clustering by code first. Hand `context.sortCurrency` to `viewkitjs/postgres` for the same order from the server.
|
|
46
|
+
- `viewkitjs/views/list`'s size budget rises to 360 kB gzipped: the door now carries the grid, the save path and the in-memory answers `List` draws with. `ReadyToolbar` and `ListToolbar` don't load them.
|
|
47
|
+
- The tarball's unpacked budget rises from 10500 kB to 11560 kB: with the ready List and this release's other additions the package unpacks to 10505 kB. The new budget is that measure plus 10%, rounded up to the next 5 kB, the rule a first budget takes.
|
|
48
|
+
- `viewkitjs/views/react`: `ViewsToolbarButtonPart` now names every toolbar button, so an atom that dressed any `part` as the views row's, Clear's or Save's dresses Sort, New and the rest that way too. Dress by the six alone, and key a record by `ViewsFramePart`:
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
// Before
|
|
52
|
+
const SLOT: Record<ViewsToolbarButtonPart, string> = { /* the six */ };
|
|
53
|
+
if (part) return <FrameButton data-slot={SLOT[part]} />;
|
|
54
|
+
|
|
55
|
+
// After
|
|
56
|
+
const SLOT: Record<ViewsFramePart, string> = { /* the six */ };
|
|
57
|
+
const FRAME = new Set<string>(Object.keys(SLOT));
|
|
58
|
+
if (part && FRAME.has(part)) return <FrameButton data-slot={SLOT[part as ViewsFramePart]} />;
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- `viewkitjs/views/react`: an atom that spreads its leftover props onto its element now spreads `part` too (`part="sort"` on the button): take `part` out of the props first, as you take `icon` and `label`.
|
|
62
|
+
- The reset ViewKit's stylesheet holds to its own elements starts at no part's name: an editor an app draws on its own, outside ViewKit's frames, draws as before.
|
|
63
|
+
- The date editor's roving day is marked `data-stop` (was an internal `data-key`), so a public `data-key` rule never catches it.
|
|
64
|
+
|
|
65
|
+
### Fixed
|
|
66
|
+
|
|
67
|
+
- `viewkitjs/views/field-row`: one click on a text, email, phone, link or number row inside a dialog that takes back a focus fallen to the page (Base UI's Dialog, which returns it to its popup) opens the row's editor and keeps it open. The row now holds the focus while its editor takes the button's place, so the focus never falls to the page; a click away, Escape and Tab close the editor as before.
|
|
68
|
+
- `viewkitjs/views/grid`: a value whose field has commands (its ▾) no longer loses its last 8px to an ellipsis when its column has room; in a narrow column it still ends in "…", with the ▾ inside the cell.
|
|
69
|
+
- `viewkitjs/views/grid`: a fraction pasted into a whole-number column is rounded, as typing it is, instead of being refused when it is saved.
|
|
70
|
+
- `viewkitjs/views`: the filter editor's number box on a whole-number column rounds what is typed to a whole number.
|
|
71
|
+
- `viewkitjs/views/grid`: a lock on a stored field now locks the worked-out field edited through it, and a lock on the worked-out field locks the stored field it writes, through every write route (editor, Delete, fill, paste, the selection bar).
|
|
72
|
+
- `viewkitjs/views/grid`: copying a place cell names its country in the names language (`conventions.language`), as the cell shows it: "Budapest, Ungaria" under Romanian, where it always wrote English. A paste of that country into the place's Country part still reads it back.
|
|
73
|
+
- `viewkitjs/fields/query`: a number sort in memory places NaN and the infinities where Postgres orders a numeric or a float8: -Infinity below every number, then Infinity, then NaN, whether the value is a JavaScript number or decimal text ("NaN", "Infinity"). A list sorted in memory and the same list sorted by the database now agree. The number filter still reads them as empty.
|
|
74
|
+
- `viewkitjs/postgres`: a formula that concatenates text is written in functions an index can hold, with the same answers, so `searchIndexes` prints its trigram index (a first and last name joined with `concat`, say) instead of naming it unserved. A concat of a day, an instant or a number is still unserved.
|
|
75
|
+
- `viewkitjs/views/controls`: on a computer, ViewKit's own Popover holding the sort editor (the ready toolbar's Sort, with a rule) is as wide as its rows, so each rule's grip, field, direction and × stand inside it; it was 288 px and cut them off. It never goes under 288 px nor past the room on screen, and with no rule Add sort's fields open at 288 px as before. An app's own Popover, or its own width on this one, is unchanged.
|
|
76
|
+
|
|
8
77
|
## [0.32.0] — 2026-12-03
|
|
9
78
|
|
|
10
79
|
### Added
|
package/fields/dist/index.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export { isOpenVocabulary, optionFor, optionValues, optionsOf, statusOptionOrder
|
|
|
27
27
|
export { sameListValue, sameStoredValue } from "./equality.js";
|
|
28
28
|
export { optimisticDisplay, sameFieldValue } from "./optimistic.js";
|
|
29
29
|
export * from "./relation.js";
|
|
30
|
-
export { zodFor } from "./zod.js";
|
|
30
|
+
export { withUrlScheme, zodFor } from "./zod.js";
|
|
31
31
|
export { acceptFieldCommit, acceptStoredFieldValue, fieldClearRefusal, type FieldAcceptance, } from "./accept.js";
|
|
32
32
|
export * from "./codecs.js";
|
|
33
33
|
export { dateOfDay, dateOfInstant, dayOf, instantOf, type DateReading, } from "./date-codec.js";
|
package/fields/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@ export { isOpenVocabulary, optionFor, optionValues, optionsOf, statusOptionOrder
|
|
|
24
24
|
export { sameListValue, sameStoredValue } from "./equality.js";
|
|
25
25
|
export { optimisticDisplay, sameFieldValue } from "./optimistic.js";
|
|
26
26
|
export * from "./relation.js";
|
|
27
|
-
export { zodFor } from "./zod.js";
|
|
27
|
+
export { withUrlScheme, zodFor } from "./zod.js";
|
|
28
28
|
export { acceptFieldCommit, acceptStoredFieldValue, fieldClearRefusal, } from "./accept.js";
|
|
29
29
|
export * from "./codecs.js";
|
|
30
30
|
export { dateOfDay, dateOfInstant, dayOf, instantOf, } from "./date-codec.js";
|
|
@@ -36,6 +36,13 @@ export type ViewFieldReader<Row> = {
|
|
|
36
36
|
* blank in the sibling) is its own cluster and sorts after every known code.
|
|
37
37
|
* The library converts nothing itself. */
|
|
38
38
|
codeOf?: (row: Row, key: string) => string | null | undefined;
|
|
39
|
+
/** The number a money field SORTS by when its cells show each row's own
|
|
40
|
+
* currency: the row's amount converted into one currency for the whole list
|
|
41
|
+
* (`null` when it has none, or no rate: last both ways). A host that answers
|
|
42
|
+
* it for two rows has them ordered by these numbers, with no code clusters,
|
|
43
|
+
* so the order flips with the direction; `undefined` (or no hook) sorts by
|
|
44
|
+
* what `read` returns, clustered by code as `codeOf` says. */
|
|
45
|
+
sortAmountOf?: (row: Row, key: string) => number | null | undefined;
|
|
39
46
|
/** The records a row's relation holds, each read as a record of its own (`recordReaderFor` over the far rows and
|
|
40
47
|
* their reader), so a rule across the relation ("any / none / every of its records where …") is answered in
|
|
41
48
|
* memory. Absent, or `undefined` for a row, the rule has no opinion and the row stays. */
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/** `value` as canonical decimal text, or null when it reads as no number: absent, blank, malformed or not finite. */
|
|
2
2
|
export declare function exactNumberText(value: unknown): string | null;
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
3
|
+
/**
|
|
4
|
+
* Where a non-finite number sorts, as postgres orders a numeric or a float8: -1 for -Infinity, below every number; 1
|
|
5
|
+
* for Infinity, above them; 2 for NaN, above Infinity. 0 for anything else. A JS number or decimal text spelling one.
|
|
6
|
+
* Only the sort reads it: to a filter, `exactNumberText` still reads these as no number.
|
|
7
|
+
*/
|
|
8
|
+
export declare function nonFiniteSide(value: unknown): -1 | 0 | 1 | 2;
|
|
9
|
+
/** Whether `value` reads as no number to the sort: a JS number never does, and a non-finite one in text sorts as a
|
|
10
|
+
* value too, as postgres sorts it (`nonFiniteSide`); anything else as `exactNumberText` reads it. */
|
|
5
11
|
export declare function readsAsNoNumber(value: unknown): boolean;
|
|
@@ -13,6 +13,19 @@ export function exactNumberText(value) {
|
|
|
13
13
|
const read = MACHINE_NUMBER.test(text) ? Number(text) : parseNumber(text);
|
|
14
14
|
return read == null ? null : decimalTextOf(read);
|
|
15
15
|
}
|
|
16
|
+
const INFINITY_TEXT = /^([+-]?)inf(inity)?$/i;
|
|
17
|
+
const NAN_TEXT = /^nan$/i;
|
|
18
|
+
export function nonFiniteSide(value) {
|
|
19
|
+
if (typeof value === "number")
|
|
20
|
+
return Number.isNaN(value) ? 2 : value === Infinity ? 1 : value === -Infinity ? -1 : 0;
|
|
21
|
+
if (typeof value !== "string")
|
|
22
|
+
return 0;
|
|
23
|
+
const text = value.trim();
|
|
24
|
+
if (NAN_TEXT.test(text))
|
|
25
|
+
return 2;
|
|
26
|
+
const infinity = INFINITY_TEXT.exec(text);
|
|
27
|
+
return infinity === null ? 0 : infinity[1] === "-" ? -1 : 1;
|
|
28
|
+
}
|
|
16
29
|
export function readsAsNoNumber(value) {
|
|
17
|
-
return typeof value === "number" ? false : exactNumberText(value) === null;
|
|
30
|
+
return typeof value === "number" || nonFiniteSide(value) !== 0 ? false : exactNumberText(value) === null;
|
|
18
31
|
}
|
|
@@ -8,7 +8,7 @@ import { LOCATION_ORDERS, locationSortText } from "./location.js";
|
|
|
8
8
|
import { isOpenVocabulary, statusOptionOrder } from "../options.js";
|
|
9
9
|
import { phoneMatchText } from "../phone.js";
|
|
10
10
|
import { compareDecimalText } from "../parse-number.js";
|
|
11
|
-
import { exactNumberText, readsAsNoNumber } from "./exact-number.js";
|
|
11
|
+
import { exactNumberText, nonFiniteSide, readsAsNoNumber } from "./exact-number.js";
|
|
12
12
|
import { textOrderOf } from "./collate.js";
|
|
13
13
|
import { mainItem, valueItems } from "../value-list.js";
|
|
14
14
|
const NUMBER_TYPES = new Set(["number", "percent", "currency"]);
|
|
@@ -37,16 +37,16 @@ function mainOf(v) {
|
|
|
37
37
|
function firstOf(v) {
|
|
38
38
|
return Array.isArray(v) ? v[0] : v;
|
|
39
39
|
}
|
|
40
|
-
const infinitySide = (v) => (typeof v === "number" && (v === Infinity || v === -Infinity) ? Math.sign(v) : 0);
|
|
41
40
|
const number = (a, b) => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
const ia = nonFiniteSide(a), ib = nonFiniteSide(b);
|
|
42
|
+
if (ia === 0 && ib === 0 && typeof a === "number" && typeof b === "number")
|
|
43
|
+
return a === b ? 0 : a < b ? -1 : 1;
|
|
44
|
+
const ta = ia === 0 ? exactNumberText(a) : null, tb = ib === 0 ? exactNumberText(b) : null;
|
|
45
|
+
const noneA = ia === 0 && ta === null, noneB = ib === 0 && tb === null;
|
|
46
|
+
if (noneA || noneB)
|
|
47
|
+
return noneA === noneB ? 0 : noneA ? 1 : -1;
|
|
45
48
|
if (ia !== 0 || ib !== 0)
|
|
46
49
|
return ia - ib;
|
|
47
|
-
const ta = exactNumberText(a), tb = exactNumberText(b);
|
|
48
|
-
if (ta === null || tb === null)
|
|
49
|
-
return ta === tb ? 0 : ta === null ? 1 : -1;
|
|
50
50
|
return compareDecimalText(ta, tb);
|
|
51
51
|
};
|
|
52
52
|
const instant = nullsLast((a, b) => new Date(String(a)).getTime() - new Date(String(b)).getTime());
|
|
@@ -250,17 +250,20 @@ export function compareBy(sorts, reader, cv = DEFAULT_CONVENTIONS) {
|
|
|
250
250
|
emptyName: valueTypeOf(field) === "name",
|
|
251
251
|
emptyRange: valueTypeOf(field) === "range",
|
|
252
252
|
emptyNumber: NUMBER_TYPES.has(valueTypeOf(field)) && !isPerCodeCurrency(presented),
|
|
253
|
+
sortAmountOf: money && reader.sortAmountOf,
|
|
253
254
|
denominationOf: money && denominationReader(reader, spec.fieldKey, money),
|
|
254
255
|
codeOrder: money && codeOrderFor(reader, money, cv),
|
|
255
256
|
};
|
|
256
257
|
});
|
|
257
258
|
return (a, b) => {
|
|
258
259
|
for (const step of steps) {
|
|
259
|
-
const
|
|
260
|
+
const sa = step.sortAmountOf?.(a, step.key), sb = step.sortAmountOf?.(b, step.key);
|
|
261
|
+
const converted = sa !== undefined && sb !== undefined;
|
|
262
|
+
const va = converted ? sa : scalarOf(step.field, reader.read(a, step.key)), vb = converted ? sb : scalarOf(step.field, reader.read(b, step.key));
|
|
260
263
|
const ea = isEmpty(va) || (step.emptyName && isEmptyName(firstOf(va))) || (step.emptyRange && isEmptyRange(va)) || (step.emptyNumber && readsAsNoNumber(va)), eb = isEmpty(vb) || (step.emptyName && isEmptyName(firstOf(vb))) || (step.emptyRange && isEmptyRange(vb)) || (step.emptyNumber && readsAsNoNumber(vb));
|
|
261
264
|
if (ea !== eb)
|
|
262
265
|
return ea ? 1 : -1;
|
|
263
|
-
if (!ea && step.denominationOf && step.codeOrder) {
|
|
266
|
+
if (!ea && !converted && step.denominationOf && step.codeOrder) {
|
|
264
267
|
const ca = step.denominationOf(a), cb = step.denominationOf(b);
|
|
265
268
|
if ((ca === undefined) !== (cb === undefined))
|
|
266
269
|
return ca === undefined ? 1 : -1;
|
package/fields/dist/registry.js
CHANGED
|
@@ -1047,7 +1047,11 @@ const STORED = [
|
|
|
1047
1047
|
MULTISELECT,
|
|
1048
1048
|
RELATION,
|
|
1049
1049
|
{ type: z.literal("user") },
|
|
1050
|
-
{
|
|
1050
|
+
{
|
|
1051
|
+
type: z.literal("url"),
|
|
1052
|
+
bareHost: z.literal("https").optional(),
|
|
1053
|
+
validation: z.strictObject({ maxLength: finite.optional(), maxItems: finite.optional() }).optional(),
|
|
1054
|
+
},
|
|
1051
1055
|
{ type: z.literal("domain"), ...ruledValidation },
|
|
1052
1056
|
{ type: z.literal("email"), validation: listMax.optional() },
|
|
1053
1057
|
{ type: z.literal("phone"), ...ruledValidation },
|
package/fields/dist/types.d.ts
CHANGED
|
@@ -444,9 +444,12 @@ export type FieldDef = (FieldBase & TextSpec & {
|
|
|
444
444
|
| (FieldBase & {
|
|
445
445
|
type: "user";
|
|
446
446
|
})
|
|
447
|
-
/** `multiple`: several links, each a `{ value, label, main }` (`ValueItem`), at most one main.
|
|
447
|
+
/** `multiple`: several links, each a `{ value, label, main }` (`ValueItem`), at most one main. `bareHost: "https"`: a
|
|
448
|
+
* host typed with no scheme (`acme.ro`, `acme.ro/work`) is stored with `https://` before it, by every commit and by
|
|
449
|
+
* `zodFor` alike (`withUrlScheme`); absent, it is refused for naming no scheme. */
|
|
448
450
|
| (FieldBase & UrlSpec & {
|
|
449
451
|
multiple?: true;
|
|
452
|
+
bareHost?: "https";
|
|
450
453
|
validation?: {
|
|
451
454
|
maxItems?: number;
|
|
452
455
|
};
|
package/fields/dist/zod.d.ts
CHANGED
|
@@ -22,6 +22,11 @@ type KeptKeys = {
|
|
|
22
22
|
/** Internal: the key a relation link's stored role is kept under: the link it rides on and the role, so the role
|
|
23
23
|
* passes on that link alone. */
|
|
24
24
|
export declare function linkRoleKey(kind: string, id: string, role: string): string;
|
|
25
|
+
/** A url as a field with `bareHost: "https"` stores it: trimmed text that names no scheme, whose host (the text before
|
|
26
|
+
* its first `/`, `?` or `#`, after a leading `//`) holds a dot and no space, with `https://` before it. Anything else
|
|
27
|
+
* comes back trimmed and is judged as typed: an address with its scheme, `mailto:`, a host with a port (which reads
|
|
28
|
+
* as a scheme, as a cell's link reads it), or a word that is no host (`hello`). */
|
|
29
|
+
export declare function withUrlScheme(text: string): string;
|
|
25
30
|
/** Internal: whether a stored url is one a url cell links — an absolute web address, or text naming no scheme that
|
|
26
31
|
* is one once `https://` is put before it. What a kept url is held to (`accept.ts`). Text with a space or a control
|
|
27
32
|
* character inside is none: a split `java\tscript:` would hide its scheme here and lose it in the address parser. */
|
package/fields/dist/zod.js
CHANGED
|
@@ -22,6 +22,14 @@ export function linkRoleKey(kind, id, role) {
|
|
|
22
22
|
}
|
|
23
23
|
const NO_KEPT = { has: () => false };
|
|
24
24
|
const WEB_ADDRESS = z.url().refine((u) => /^https?:\/\//i.test(u));
|
|
25
|
+
export function withUrlScheme(text) {
|
|
26
|
+
const trimmed = text.trim();
|
|
27
|
+
if (/^[a-z][a-z\d+.-]*:/i.test(trimmed))
|
|
28
|
+
return trimmed;
|
|
29
|
+
const rest = trimmed.startsWith("//") ? trimmed.slice(2) : trimmed;
|
|
30
|
+
const host = rest.split(/[/?#]/, 1)[0] ?? "";
|
|
31
|
+
return /^[^\s.]+(\.[^\s.]+)+$/.test(host) ? `https://${rest}` : trimmed;
|
|
32
|
+
}
|
|
25
33
|
export function readsAsLink(value) {
|
|
26
34
|
if (typeof value !== "string")
|
|
27
35
|
return false;
|
|
@@ -347,13 +355,14 @@ function build(field, cv, say, kept = NO_KEPT) {
|
|
|
347
355
|
error: () => say({ key: "validation.url" }),
|
|
348
356
|
});
|
|
349
357
|
const max = field.validation?.maxLength;
|
|
350
|
-
const
|
|
358
|
+
const ruled = max === undefined
|
|
351
359
|
? address
|
|
352
360
|
: z
|
|
353
361
|
.string({ error: () => say({ key: "validation.url" }) })
|
|
354
362
|
.trim()
|
|
355
363
|
.max(max, { error: () => say({ key: "validation.max-length", values: { max } }) })
|
|
356
364
|
.pipe(address);
|
|
365
|
+
const checked = field.bareHost === "https" ? z.preprocess((v) => (typeof v === "string" ? withUrlScheme(v) : v), ruled) : ruled;
|
|
357
366
|
const one = kept === NO_KEPT
|
|
358
367
|
? checked
|
|
359
368
|
: z.unknown().transform((v, ctx) => {
|
|
@@ -21,6 +21,7 @@ const PERSON = defineFields({
|
|
|
21
21
|
phones: { type: "phone", label: "Phones", multiple: true },
|
|
22
22
|
website: { type: "url", label: "Website", validation: { maxLength: 300 } },
|
|
23
23
|
links: { type: "url", label: "Links", multiple: true, emptiable: true },
|
|
24
|
+
blog: { type: "url", label: "Blog", bareHost: "https" },
|
|
24
25
|
},
|
|
25
26
|
});
|
|
26
27
|
|
|
@@ -141,6 +142,17 @@ const long = acceptFieldCommit(PERSON.website, `https://ana.example/${"a".repeat
|
|
|
141
142
|
assert.equal(long.ok ? "" : long.reason, "Too long — at most 300 characters");
|
|
142
143
|
```
|
|
143
144
|
|
|
145
|
+
A url field with `bareHost: "https"` takes a host typed with no scheme and stores it with `https://` before it: `ana.example` is stored as `https://ana.example`, its path kept. Every commit does it the same way: `acceptFieldCommit`, `zodFor` on your route, and the grid's own check. `withUrlScheme` is the rule they share. An address that names its scheme is kept as typed, and text that is no host (`hello`, a host with a port, `mailto:`) is still refused in the url's words. The ceiling counts what is stored, the scheme included. A url kept as stored (`stored`, below) comes back as it was. Without the key, a bare host is refused.
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
import { withUrlScheme, zodFor } from "viewkitjs/fields";
|
|
149
|
+
|
|
150
|
+
assert.deepEqual(acceptFieldCommit(PERSON.blog, " ana.example/notes "), { ok: true, value: "https://ana.example/notes" });
|
|
151
|
+
assert.equal(zodFor(PERSON.blog).parse("ana.example"), "https://ana.example");
|
|
152
|
+
assert.equal(acceptFieldCommit(PERSON.blog, "hello").ok, false);
|
|
153
|
+
assert.equal(withUrlScheme("http://ana.example"), "http://ana.example");
|
|
154
|
+
```
|
|
155
|
+
|
|
144
156
|
A link's platform is read from its address whenever it is asked for, and never stored. A platform a host adds later reaches every link already stored. `linkPlatform` gives `{ key, name }`: the first platform that answers on the link's host, else a website (`WEBSITE`, the key `"website"`), or null for a value that is no web link. A platform's host matches itself and every subdomain of it, as whole labels. `LINK_PLATFORMS` lists the library's own.
|
|
145
157
|
|
|
146
158
|
```ts
|
|
@@ -516,7 +516,7 @@ assert.throws(
|
|
|
516
516
|
|
|
517
517
|
Six types hold a value with a shape of its own. In brief:
|
|
518
518
|
|
|
519
|
-
- `url`: a web address with its scheme, stored as text. Its platform (LinkedIn, GitHub, a website…) is read from the address when asked for, never stored.
|
|
519
|
+
- `url`: a web address with its scheme, stored as text; `bareHost: "https"` stores a host typed without one with `https://` before it. Its platform (LinkedIn, GitHub, a website…) is read from the address when asked for, never stored.
|
|
520
520
|
- `email`: an address, stored as text.
|
|
521
521
|
- `domain`: a company's domain, kept clean: no scheme, `www.`, path or port; lower case; subdomains kept. It takes no validation of its own.
|
|
522
522
|
- `phone`: `{ number, extension }`, the number in its international form (`+40722123456`). The phone library is its whole check.
|
|
@@ -561,6 +561,8 @@ const inEuros: ViewFieldReader<Deal> = {
|
|
|
561
561
|
assert.deepEqual(sortedBy(DEALS, [{ fieldKey: "value", direction: "asc" }], inEuros), ["d5", "d3", "d2", "d4", "d1", "d6"]);
|
|
562
562
|
```
|
|
563
563
|
|
|
564
|
+
A reader whose cells show each row's own currency can still sort them as one: `sortAmountOf(row, key)` answers the amount converted into one currency for the whole list (`null` for none). Where it answers both rows, they order by those numbers, with no code clusters, so the order flips with the direction; `undefined` leaves the rule above in charge.
|
|
565
|
+
|
|
564
566
|
## Groups and buckets
|
|
565
567
|
|
|
566
568
|
A `GroupSpec` splits a list into sections by one field. `canGroupBy(type, by?)` says whether a type can: a select, a status, a relation, a user, an actor, a yes or no, a date and a range group as a whole, a multiselect under every value it holds, so a row tagged twice sits in both buckets, and a many relation by its first link; text, numbers and names do not. A place groups only by one part, named by `by`, which `groupOrdersFor(type)` lists. `bucketRows(rows, spec, field, read, options?)` makes the buckets, each with its key, its label, its rows and whether it is hidden.
|
|
@@ -746,7 +748,7 @@ assert.deepEqual(columns.map((c) => [c.key, c.items.length, c.hidden]), [
|
|
|
746
748
|
|
|
747
749
|
`evaluateView(rows, query, reader, options?)` runs a whole `ViewQuery`: it filters, sorts, and then groups the sorted rows, so each bucket's rows keep the sort. It returns the rows and the buckets, `null` when the query has no group or groups by a field the reader does not know. Pass `now` and `conventions` so today and every day are the host's.
|
|
748
750
|
|
|
749
|
-
The reader is the one `compareBy` takes. `fieldOf(key)` gives a field's definition and `read(row, key)` its value as drawn. `decimalsOf(key)` gives a number column's decimals for equality,
|
|
751
|
+
The reader is the one `compareBy` takes. `fieldOf(key)` gives a field's definition and `read(row, key)` its value as drawn. `decimalsOf(key)` gives a number column's decimals for equality, `codeOf(row, key)` the currency a converted amount is in, and `sortAmountOf(row, key)` the amount a money field sorts by when its cells show each row's own currency. A rollup with a breakdown is filtered, sorted and grouped by its headline.
|
|
750
752
|
|
|
751
753
|
```ts
|
|
752
754
|
import type { ViewQuery } from "viewkitjs/fields/query";
|
|
@@ -63,6 +63,7 @@ Guide: [conventions](../guides/conventions.md).
|
|
|
63
63
|
|
|
64
64
|
Guide: [validation and acceptance](../guides/validation-and-acceptance.md).
|
|
65
65
|
|
|
66
|
+
- `withUrlScheme` — a url as a field with `bareHost: "https"` stores it: trimmed text naming no scheme, whose host holds a dot, with `https://` before it (`acme.ro/work` → `https://acme.ro/work`, `//acme.ro` → `https://acme.ro`); anything else trimmed and unchanged, to be judged as typed. `acceptFieldCommit`, `zodFor` and the grid's check all read it.
|
|
66
67
|
- `zodFor` — the Zod schema of a field's stored value, worded in the host's messages. Input and output keep the stored type and nothing is coerced between types, so a form resolver keeps the row's literal types. Its JSON Schema (`z.toJSONSchema`) names each type's stored shape; a phone's is an object of an E.164 `number` and an `extension` of digits or `null`, while the phone library judges the number itself.
|
|
67
68
|
- `acceptFieldCommit` — judges the value a field's editor commits and returns the value to store or a refusal: an empty commit becomes null or the type's empty value, or is refused; typed text is trimmed, a domain cleaned, a phone read in the record's or the person's region. It judges the value only, never who may change the field (that is `lockReason` and the field's mutability): an actor and a non-empty commit to a derived field are refused, and an empty commit to a nullable derived field is accepted as null.
|
|
68
69
|
- `acceptStoredFieldValue` — judges the value a binding says it will store, as the last gate before a write: null only for a nullable field, no blank for a required one, then the stored-value schema.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "viewkitjs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "ViewKit — typed fields, the grid and its editors, and a list's SQL for record lists, in one package: viewkitjs/fields, viewkitjs/views and viewkitjs/postgres. By Sheaf.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
package/postgres/dist/check.js
CHANGED
|
@@ -3,7 +3,7 @@ import { filterPartsFor, filterValueSchema, operatorsForField, ruleIsActive, whe
|
|
|
3
3
|
import { fieldsOf, isOneRelation } from "./map.js";
|
|
4
4
|
import { readableField } from "./readable.js";
|
|
5
5
|
import { REFUSALS } from "./refusals.js";
|
|
6
|
-
import { currenciesProblem } from "./rules.js";
|
|
6
|
+
import { currenciesProblem, sortCurrencyProblem } from "./rules.js";
|
|
7
7
|
const TEXT_TYPES = new Set([
|
|
8
8
|
"text",
|
|
9
9
|
"url",
|
|
@@ -103,6 +103,9 @@ function contextProblem(context) {
|
|
|
103
103
|
const currencies = currenciesProblem(context.currencies);
|
|
104
104
|
if (currencies !== null)
|
|
105
105
|
return currencies;
|
|
106
|
+
const sortCurrency = sortCurrencyProblem(context.sortCurrency);
|
|
107
|
+
if (sortCurrency !== null)
|
|
108
|
+
return sortCurrency;
|
|
106
109
|
const since = context.since;
|
|
107
110
|
return since === undefined || (since instanceof Date && Number.isFinite(since.getTime())) ? null : "since is no moment";
|
|
108
111
|
}
|
|
@@ -163,7 +163,9 @@ export function formulaSql(rule, read, clock) {
|
|
|
163
163
|
case "isEmpty":
|
|
164
164
|
return boolean(a.type === "text" || a.spelled ? sql `(NULLIF(${a.sql}, '') IS NULL)` : sql `(${a.sql} IS NULL)`);
|
|
165
165
|
case "concat":
|
|
166
|
-
|
|
166
|
+
if (args.length === 0)
|
|
167
|
+
return text(sql `''::text`);
|
|
168
|
+
return text(sql `(${join(args.map((one) => sql `COALESCE(${textOf(one)}, '')`), sql ` || `)})`);
|
|
167
169
|
case "join": {
|
|
168
170
|
const [separator, ...parts] = args;
|
|
169
171
|
if (parts.length === 0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { conversionOf, presentedDef, valueTypeOf } from "viewkitjs/fields";
|
|
2
2
|
import { openedOf } from "../access.js";
|
|
3
|
-
import { currencyOf } from "../rules.js";
|
|
3
|
+
import { convertsWith, currencyOf } from "../rules.js";
|
|
4
4
|
import { sql } from "../sql.js";
|
|
5
5
|
import { StorageError } from "./storage.js";
|
|
6
6
|
export const MONEY_REASONS = {
|
|
@@ -76,6 +76,7 @@ export function placeConverted(at, base) {
|
|
|
76
76
|
return into === undefined ? kept(row) : convert(row, into);
|
|
77
77
|
};
|
|
78
78
|
KEPT.set(value, kept);
|
|
79
|
+
convertsWith(value, convert);
|
|
79
80
|
const fields = [
|
|
80
81
|
...("fields" in base ? (base.fields ?? []) : []),
|
|
81
82
|
{ table, key: codeKey },
|
package/postgres/dist/page.js
CHANGED
|
@@ -3,7 +3,7 @@ import { fingerprintOf, fitsKey, KEY_ARRAYS, readCursor, spelledAsKept, writeCur
|
|
|
3
3
|
import { doubleText } from "./double.js";
|
|
4
4
|
import { fieldsOf } from "./map.js";
|
|
5
5
|
import { REFUSALS } from "./refusals.js";
|
|
6
|
-
import { currencyOf } from "./rules.js";
|
|
6
|
+
import { currencyOf, sortCurrencyOf } from "./rules.js";
|
|
7
7
|
import { checkSorts, keyPartsOf, orderItem } from "./sort.js";
|
|
8
8
|
import { isDateType } from "./date-groups.js";
|
|
9
9
|
import { groupSql } from "./groups.js";
|
|
@@ -131,7 +131,8 @@ function readsDay(node) {
|
|
|
131
131
|
return node.items.some(readsDay);
|
|
132
132
|
}
|
|
133
133
|
function currenciesRead(map, checked, sorts, groupKey, context) {
|
|
134
|
-
const
|
|
134
|
+
const sorted = new Set(sorts.map((sort) => sort.key));
|
|
135
|
+
const keys = new Set([...sorted, ...(groupKey === undefined ? [] : [groupKey])]);
|
|
135
136
|
const walk = (node) => {
|
|
136
137
|
if (node === null || "quantifier" in node)
|
|
137
138
|
return;
|
|
@@ -144,7 +145,9 @@ function currenciesRead(map, checked, sorts, groupKey, context) {
|
|
|
144
145
|
const read = [];
|
|
145
146
|
for (const key of [...keys].sort()) {
|
|
146
147
|
const field = Object.hasOwn(map.fields, key) ? map.fields[key] : undefined;
|
|
147
|
-
const currency = field === undefined
|
|
148
|
+
const currency = field === undefined
|
|
149
|
+
? undefined
|
|
150
|
+
: (currencyOf(context, key, field.def) ?? (sorted.has(key) ? sortCurrencyOf(context, key, field.def) : undefined));
|
|
148
151
|
if (currency !== undefined)
|
|
149
152
|
read.push([key, currency]);
|
|
150
153
|
}
|
package/postgres/dist/rules.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type FieldDef, type ValueType } from "viewkitjs/fields";
|
|
2
2
|
import { type FilterRule } from "viewkitjs/fields/query";
|
|
3
|
-
import type { Stored } from "./map.js";
|
|
3
|
+
import type { Row, Stored } from "./map.js";
|
|
4
4
|
import { type Sql } from "./sql.js";
|
|
5
5
|
/**
|
|
6
6
|
* What a rule reads beside its row: the zone a day is read in, the moment relative days count from, and the reader's
|
|
@@ -15,9 +15,23 @@ export type FilterContext = {
|
|
|
15
15
|
/** The currency a field whose definition converts is read in, by the list's own field key; a field not named reads
|
|
16
16
|
* its amount as kept, beside its own code. */
|
|
17
17
|
readonly currencies?: Readonly<Record<string, string>>;
|
|
18
|
+
/** The currency a field whose definition converts is SORTED in when `currencies` names none for it: its amount
|
|
19
|
+
* converted into it, so rows in different currencies order as one number that flips with the direction. The cells
|
|
20
|
+
* still read each amount as kept, beside its own code. Your app's own currency, say. Absent, such a sort clusters
|
|
21
|
+
* by code first. */
|
|
22
|
+
readonly sortCurrency?: string;
|
|
18
23
|
};
|
|
19
24
|
/** Why a context's `currencies` can't be read, or null: no record, or a currency that is no text. */
|
|
20
25
|
export declare function currenciesProblem(currencies: unknown): string | null;
|
|
26
|
+
/** Why a context's `sortCurrency` can't be read, or null. */
|
|
27
|
+
export declare function sortCurrencyProblem(sortCurrency: unknown): string | null;
|
|
28
|
+
/** The currency field `key` is sorted in when the request reads it as kept: the context's `sortCurrency`, for a field
|
|
29
|
+
* whose definition converts and that `currencies` names no currency for; else undefined. */
|
|
30
|
+
export declare function sortCurrencyOf(context: FilterContext | undefined, key: string, def: FieldDef): string | undefined;
|
|
31
|
+
/** Records `convert` as the conversion behind the read `read`. */
|
|
32
|
+
export declare function convertsWith(read: (row: Row) => Sql, convert: (row: Row, into: string) => Sql): void;
|
|
33
|
+
/** The conversion behind a read that converts, else undefined: a column, or an app's own expression, has none. */
|
|
34
|
+
export declare function conversionBehind(read: unknown): ((row: Row, into: string) => Sql) | undefined;
|
|
21
35
|
/**
|
|
22
36
|
* The currency the request reads field `key` in: undefined for a lookup (its code is a far record's), a field whose
|
|
23
37
|
* definition doesn't convert, or one the request names none for. The one place the translator reads `currencies`.
|
package/postgres/dist/rules.js
CHANGED
|
@@ -15,6 +15,22 @@ export function currenciesProblem(currencies) {
|
|
|
15
15
|
}
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
18
|
+
export function sortCurrencyProblem(sortCurrency) {
|
|
19
|
+
return sortCurrency === undefined || (typeof sortCurrency === "string" && sortCurrency !== "") ? null : "sortCurrency is no currency";
|
|
20
|
+
}
|
|
21
|
+
export function sortCurrencyOf(context, key, def) {
|
|
22
|
+
if (def.type === "lookup" || conversionOf(def) === null || currencyOf(context, key, def) !== undefined)
|
|
23
|
+
return undefined;
|
|
24
|
+
const code = context?.sortCurrency;
|
|
25
|
+
return typeof code === "string" && code !== "" ? code : undefined;
|
|
26
|
+
}
|
|
27
|
+
const CONVERTS = new WeakMap();
|
|
28
|
+
export function convertsWith(read, convert) {
|
|
29
|
+
CONVERTS.set(read, convert);
|
|
30
|
+
}
|
|
31
|
+
export function conversionBehind(read) {
|
|
32
|
+
return typeof read === "function" ? CONVERTS.get(read) : undefined;
|
|
33
|
+
}
|
|
18
34
|
export function currencyOf(context, key, def) {
|
|
19
35
|
if (def.type === "lookup" || conversionOf(def) === null)
|
|
20
36
|
return undefined;
|
package/postgres/dist/sort.js
CHANGED
|
@@ -6,7 +6,7 @@ import { fieldsOf, isOneRelation } from "./map.js";
|
|
|
6
6
|
import { REFUSALS } from "./refusals.js";
|
|
7
7
|
import { castTo, integerLiteral, isSql, join, render, sql } from "./sql.js";
|
|
8
8
|
import { reachedFrom } from "./relations.js";
|
|
9
|
-
import { currencyOf } from "./rules.js";
|
|
9
|
+
import { conversionBehind, currencyOf, sortCurrencyOf } from "./rules.js";
|
|
10
10
|
import { joinedValueSql, mainValueSql } from "./several.js";
|
|
11
11
|
import { joinedOf, labelOf, partNamesOf, partSql, rowJoinOf, valueSql } from "./values.js";
|
|
12
12
|
import { rowFilledSql, rowProbeOn, rowProbeSql } from "./value-rows.js";
|
|
@@ -231,10 +231,15 @@ function partsOf(scope, main, sort, locale) {
|
|
|
231
231
|
if (field.mapping.notNull === true)
|
|
232
232
|
return [{ ...turning(value(), kindOf(stored)), notNull: true }];
|
|
233
233
|
return walking([last(value(), kindOf(stored))], asKept);
|
|
234
|
-
case "currency":
|
|
234
|
+
case "currency": {
|
|
235
235
|
if (currencyOf(scope.context, key, field.def) !== undefined)
|
|
236
236
|
return [last(value(), kindOf(stored))];
|
|
237
|
+
const into = sortCurrencyOf(scope.context, key, field.def);
|
|
238
|
+
const convert = into === undefined ? undefined : conversionBehind(field.mapping.value);
|
|
239
|
+
if (into !== undefined && convert !== undefined)
|
|
240
|
+
return [last(convert(main.row, into), "numeric")];
|
|
237
241
|
return walking(currencyParts(scope, main, sort, def, value(), kindOf(stored), last, flag, (codes) => rowWalk(value(), rowFilledSql(stored, value()), (probe) => rowFilledSql(stored, probe.row.column(row.value)), { codes })), asKept);
|
|
242
|
+
}
|
|
238
243
|
case "select":
|
|
239
244
|
case "status": {
|
|
240
245
|
const v = stored === "uuid" ? sql `(${value()})::text` : value();
|
|
@@ -186,7 +186,7 @@ Hand it in beside the rest: `buildFieldMap({ index, storage, kind: "deal", money
|
|
|
186
186
|
- **`day`** is `{ ask }`, the request's moment, for a definition that converts at today's rate (read it as its UTC day), or `{ row, type }` for one that converts at a row's own date: `type: "date"` for a date, `"datetime"` for an instant, handed as a `timestamptz` (one kept without a zone is read as UTC), whose UTC day you read.
|
|
187
187
|
- **`into`** is the currency the request names for the field, as text, or, for a rollup, the currency its result names: a fixed code, or its record's own as SQL.
|
|
188
188
|
|
|
189
|
-
The request names a currency per field, in its context: `context: { timeZone, now, currencies: { value: "USD" } }`. A field it names reads, filters, sorts, adds up and pages in that currency, and a page's cursor is bound to it. A field it names none for reads its amount as kept, beside its own code, and sorts by its code first, as the translator sorts any amount whose code is a sibling.
|
|
189
|
+
The request names a currency per field, in its context: `context: { timeZone, now, currencies: { value: "USD" } }`. A field it names reads, filters, sorts, adds up and pages in that currency, and a page's cursor is bound to it. A field it names none for reads its amount as kept, beside its own code, and sorts by its code first, as the translator sorts any amount whose code is a sibling, unless the context names a `sortCurrency` (`context: { timeZone, now, sortCurrency: "EUR" }`, your app's own currency): then it sorts by its amount converted into that one, so €12,000 and $8,000 change places when the direction does, while each row still reads in its own currency.
|
|
190
190
|
|
|
191
191
|
Only the list's own rows convert: a related record's amount reads as kept. A formula reads the amounts it uses as kept, and its own result converts when its definition says so, so nothing converts twice. A rollup's sum, average, smallest, largest or first of an amount that converts converts each far amount on its far row's own day into the currency its result names: a fixed code, or its record's own (`code: { field }`), so it converts even when the request names no currency; a result that converts in turn then converts into the one the request names. A definition that converts, with no `money` handed in, is refused when the map is built, as a `StorageError` at `money` naming the field. So is your own entry (`handWritten`) for one: an amount that converts is read through your money function, so the currency a request names always reaches it.
|
|
192
192
|
|
|
@@ -412,7 +412,7 @@ assert.deepEqual(unserved, []);
|
|
|
412
412
|
- A word of one or two letters reads every row: a trigram index has nothing to look it up by.
|
|
413
413
|
- The indexes serve a statement Postgres plans with its values, as it plans one sent unnamed (`pg`, Prisma's driver adapters, a transaction pooler). A prepared statement planned generically reads every row, with the same answers.
|
|
414
414
|
- A relation's column, when it is your expression, now runs on every row a search reads, so it must never raise.
|
|
415
|
-
- An index holds only immutable SQL. A `search` read, a label or a formula that calls a function Postgres won't index (`concat_ws`, `concat`, `to_char`, `unaccent`, `now()`) is named in `unserved` (`notImmutable`, or `farLabel` for a relation's far label) and never printed. A name kept in parts is labelled in immutable SQL, so its index builds. Write your own label the same way: `COALESCE(given || ' ' || family, given, family)`, not `concat_ws`. A stable cast (text to a date or a timestamp) is not recognised: an index on one is printed, and `CREATE INDEX` refuses it (`42P17`).
|
|
415
|
+
- An index holds only immutable SQL. A `search` read, a label or a formula that calls a function Postgres won't index (`concat_ws`, `concat`, `to_char`, `unaccent`, `now()`) is named in `unserved` (`notImmutable`, or `farLabel` for a relation's far label) and never printed. A name kept in parts is labelled in immutable SQL, so its index builds, and so is a formula's `join` and `concat` of text; a formula that reads a day, an instant or a number into text still reaches `to_char` and is named unserved. Write your own label the same way: `COALESCE(given || ' ' || family, given, family)`, not `concat_ws`. A stable cast (text to a date or a timestamp) is not recognised: an index on one is printed, and `CREATE INDEX` refuses it (`42P17`).
|
|
416
416
|
- Each trigram index adds cost to every insert and update on its table, so index only the fields a list searches. Built without `CONCURRENTLY` inside a migration's transaction, an index blocks writes to its table until the migration commits.
|
|
417
417
|
|
|
418
418
|
Measured on a list of about 26,000 records searched across five fields, one a formula and one a relation: with every word of three letters or more, each statement took under 50 ms through its indexes, where reading every row took 110–270 ms.
|
|
@@ -19,7 +19,7 @@ A field map from your definitions and a storage declaration. Guide: [a field map
|
|
|
19
19
|
|
|
20
20
|
## Your money function
|
|
21
21
|
|
|
22
|
-
- `ConvertMoney` — your one money function, `({ amount, currency, day, into }) => Sql`: the amount converted, as SQL; a zero or missing rate reads null, never raises. Called wherever a definition converts an amount, on the list's own rows, in the currency the request's `context.currencies` names for the field.
|
|
22
|
+
- `ConvertMoney` — your one money function, `({ amount, currency, day, into }) => Sql`: the amount converted, as SQL; a zero or missing rate reads null, never raises. Called wherever a definition converts an amount, on the list's own rows, in the currency the request's `context.currencies` names for the field, and in a sort by such a field that it names none for, in `context.sortCurrency`.
|
|
23
23
|
- `MoneyAsk` — one conversion: the amount (`numeric`), its currency (the row's code, as text), the day it converts on, and the currency it converts into.
|
|
24
24
|
- `MoneyDay` — the day an amount converts on: `{ ask }`, the request's moment, read as its UTC day; or `{ row, type }`, a row's own date (`"date"`) or instant (`"datetime"`, a `timestamptz`), read as its UTC day.
|
|
25
25
|
- `MoneyInto` — the currency an amount converts into: the request's, as text, or the one a rollup's result names, a fixed code or its record's own as SQL.
|
|
@@ -81,7 +81,7 @@ The one door. Guide: [the field map and the permission condition](../guides/fiel
|
|
|
81
81
|
- `VALUES_PAGE` — 1000: the keys one step of `valuesQuery` reads.
|
|
82
82
|
- `Page` — a page's `keys` in order, and `next`, the cursor the next page starts after, or null after the last.
|
|
83
83
|
- `KeysRequest` — a request: the app's map, its permission condition and the fields the reader may read (`readable`, required); the list's filter tree (relation rules and a value's parts included), its search (each word in some field it names, or the whole text a row's key), its quick-filter `hold` (fields' `ListHold`, on top of the filter: every statement keeps only rows that pass both, and a page's cursor is bound to it), and the context a date rule reads.
|
|
84
|
-
- `FilterContext` — what a rule reads beside its row: the reader's time zone and the moment relative days count from, which a date rule needs, and the reader's `region` (two letters), which a phone typed without its country code is read in; `since`, the instant a relation's `within` reads a rule's records from, never bound into a cursor;
|
|
84
|
+
- `FilterContext` — what a rule reads beside its row: the reader's time zone and the moment relative days count from, which a date rule needs, and the reader's `region` (two letters), which a phone typed without its country code is read in; `since`, the instant a relation's `within` reads a rule's records from, never bound into a cursor; `currencies`, the currency each field whose definition converts is read in, by key, bound into a page's cursor when it sorts, filters or groups by one; and `sortCurrency`, the currency such a field is sorted in when `currencies` names none for it (your app's own): its amount converted into it orders the rows while each still reads as kept, bound into the cursor of a page sorted by one.
|
|
85
85
|
|
|
86
86
|
## Counts and groups
|
|
87
87
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ViewsToolbarButtonProps } from "./types.js";
|
|
2
|
-
export declare function DefaultToolbarButton({ icon, label, word, count, onClear, dot, open, changed, edge, disabled, disabledReason, children, more, empty, iconAlone, aside, foot, joined, waits, size, popup, current, part, onContextMenu, onClick, onPointerDown, ref, }: ViewsToolbarButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function DefaultToolbarButton({ icon, label, word, count, onClear, dot, open, changed, edge, disabled, disabledReason, children, more, empty, iconAlone, aside, foot, joined, waits, size, popup, current, part, className, onContextMenu, onClick, onPointerDown, ref, }: ViewsToolbarButtonProps): import("react/jsx-runtime").JSX.Element;
|