viewkitjs 0.31.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 +198 -0
- package/MIGRATION.md +40 -6
- package/README.md +1 -1
- 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/index.d.ts +2 -0
- package/fields/dist/query/index.js +2 -0
- package/fields/dist/query/list-request.d.ts +148 -0
- package/fields/dist/query/list-request.js +125 -0
- package/fields/dist/query/saved-view.d.ts +15 -0
- package/fields/dist/query/saved-view.js +11 -0
- package/fields/dist/query/settings.d.ts +9 -0
- package/fields/dist/query/settings.js +9 -0
- 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/fields/docs/reference/query.md +66 -0
- package/package.json +5 -1
- package/postgres/README.md +1 -0
- 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/handler.d.ts +53 -0
- package/postgres/dist/handler.js +211 -0
- package/postgres/dist/ids.d.ts +1 -1
- package/postgres/dist/ids.js +19 -1
- package/postgres/dist/index.d.ts +1 -0
- package/postgres/dist/index.js +1 -0
- package/postgres/dist/limits.d.ts +3 -1
- package/postgres/dist/limits.js +1 -1
- package/postgres/dist/list-fields.d.ts +10 -0
- package/postgres/dist/list-fields.js +36 -0
- package/postgres/dist/page.js +6 -3
- package/postgres/dist/readable.d.ts +4 -0
- package/postgres/dist/readable.js +4 -0
- package/postgres/dist/refusals.d.ts +9 -2
- package/postgres/dist/refusals.js +6 -0
- 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 +3 -3
- package/postgres/docs/guides/list-handler.md +99 -0
- package/postgres/docs/index.md +1 -0
- package/postgres/docs/reference/definitions.md +1 -1
- package/postgres/docs/reference/postgres.md +12 -4
- package/views/README.md +2 -2
- package/views/dist/atoms/RowMenu.d.ts +7 -0
- package/views/dist/atoms/RowMenu.js +18 -16
- package/views/dist/atoms/ToolbarButton.d.ts +1 -1
- package/views/dist/atoms/ToolbarButton.js +4 -3
- package/views/dist/atoms/carried.d.ts +5 -0
- package/views/dist/atoms/carried.js +7 -0
- 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 +19 -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 +56 -11
- package/views/dist/contract.js +148 -0
- package/views/dist/controls/alert-dialog/alert-dialog.js +2 -1
- package/views/dist/controls/atoms.d.ts +2 -0
- package/views/dist/controls/atoms.js +2 -0
- package/views/dist/controls/avatar/avatar.d.ts +3 -3
- package/views/dist/controls/avatar/avatar.js +1 -1
- package/views/dist/controls/avatar/tokens.d.ts +44 -0
- package/views/dist/controls/avatar/tokens.js +11 -0
- package/views/dist/controls/avatar.css +22 -5
- 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/choice/tokens.d.ts +0 -4
- package/views/dist/controls/choice/tokens.js +0 -1
- package/views/dist/controls/choice.css +3 -3
- 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 +8 -0
- package/views/dist/controls/controls.js +12 -2
- 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 +5 -1
- 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 +22 -4
- package/views/dist/controls/field/field.js +63 -5
- 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 +41 -16
- 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/glyphs/glyphs.d.ts +10 -0
- package/views/dist/controls/glyphs/glyphs.js +173 -0
- package/views/dist/controls/group-editor/group-editor.js +15 -13
- package/views/dist/controls/index.d.ts +4 -1
- package/views/dist/controls/index.js +3 -1
- package/views/dist/controls/input/input.js +6 -3
- package/views/dist/controls/input/map-input.js +2 -0
- package/views/dist/controls/input/tokens.d.ts +4 -0
- package/views/dist/controls/input/tokens.js +1 -0
- package/views/dist/controls/input.css +31 -3
- package/views/dist/controls/internal/editor-parts.js +1 -1
- package/views/dist/controls/internal/icons.js +10 -0
- package/views/dist/controls/internal/keep-focus.d.ts +2 -0
- package/views/dist/controls/internal/keep-focus.js +17 -0
- 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/internal/watch-frame.d.ts +2 -0
- package/views/dist/controls/internal/watch-frame.js +33 -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/markdown/map-markdown.d.ts +4 -0
- package/views/dist/controls/markdown/map-markdown.js +5 -0
- 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 +17 -4
- package/views/dist/controls/menu-list/menu-list.js +27 -25
- package/views/dist/controls/modal/modal.js +5 -1
- 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 +6 -5
- package/views/dist/controls/phone-header/header-bar.d.ts +5 -1
- package/views/dist/controls/phone-header/header-bar.js +2 -2
- package/views/dist/controls/phone-header.css +11 -1
- package/views/dist/controls/picker/map-picker.js +3 -0
- package/views/dist/controls/picker/picker.d.ts +16 -0
- package/views/dist/controls/picker/picker.js +61 -40
- package/views/dist/controls/picker/rows.d.ts +4 -0
- package/views/dist/controls/picker.css +2 -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/popover/popover.js +2 -1
- package/views/dist/controls/quick-filters/quick-filters.js +4 -4
- package/views/dist/controls/radio/radio.d.ts +8 -3
- package/views/dist/controls/radio/radio.js +22 -5
- package/views/dist/controls/radio/tokens.d.ts +44 -0
- package/views/dist/controls/radio/tokens.js +11 -0
- package/views/dist/controls/radio.css +79 -1
- 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 +7 -0
- package/views/dist/controls/select/select.js +12 -6
- package/views/dist/controls/select/tokens.d.ts +8 -0
- package/views/dist/controls/select/tokens.js +2 -0
- package/views/dist/controls/select.css +17 -0
- package/views/dist/controls/setting-row/looks.d.ts +1 -1
- package/views/dist/controls/setting-row/looks.js +9 -4
- package/views/dist/controls/setting-row/setting-row.d.ts +45 -10
- package/views/dist/controls/setting-row/setting-row.js +82 -15
- package/views/dist/controls/setting-row/tokens.d.ts +74 -2
- package/views/dist/controls/setting-row/tokens.js +19 -1
- package/views/dist/controls/setting-row.css +135 -14
- package/views/dist/controls/sheet/bottom-sheet.d.ts +14 -2
- package/views/dist/controls/sheet/bottom-sheet.js +6 -3
- package/views/dist/controls/sheet/map-sheet.js +1 -1
- package/views/dist/controls/sheet.css +4 -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 +25 -26
- package/views/dist/controls/sort-editor.css +13 -2
- package/views/dist/controls/switch-row/tokens.d.ts +0 -12
- package/views/dist/controls/switch-row/tokens.js +0 -3
- package/views/dist/controls/switch-row.css +3 -7
- package/views/dist/controls/switch.css +17 -7
- package/views/dist/controls/tag/tag.d.ts +3 -1
- package/views/dist/controls/tag/tag.js +2 -2
- package/views/dist/controls/tag/tokens.d.ts +4 -0
- package/views/dist/controls/tag/tokens.js +1 -0
- package/views/dist/controls/tag-field/tag-field.d.ts +5 -1
- package/views/dist/controls/tag-field/tag-field.js +11 -5
- package/views/dist/controls/tag-field/tokens.d.ts +16 -0
- package/views/dist/controls/tag-field/tokens.js +4 -0
- package/views/dist/controls/tag-field.css +19 -0
- package/views/dist/controls/tag.css +2 -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/toolbar.d.ts +15 -3
- package/views/dist/controls/toolbar/toolbar.js +22 -15
- package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +14 -0
- package/views/dist/controls/toolbar-button/atom-toolbar-button.js +52 -0
- package/views/dist/controls/toolbar-button/toolbar-button.d.ts +1 -1
- package/views/dist/controls/toolbar-button/toolbar-button.js +2 -3
- package/views/dist/controls/toolbar-button.css +4 -0
- package/views/dist/controls/toolbar.css +5 -0
- 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.d.ts +3 -0
- package/views/dist/controls/views-list/map-view-menu.js +25 -0
- package/views/dist/controls/views-list/map-views-list-body.d.ts +28 -1
- package/views/dist/controls/views-list/map-views-list-body.js +39 -21
- package/views/dist/controls/views-list/rules.d.ts +2 -0
- package/views/dist/controls/views-list/view-menu.d.ts +7 -0
- package/views/dist/controls/views-list/view-menu.js +33 -29
- package/views/dist/controls/views-list/views-list.js +4 -4
- package/views/dist/controls/views-list/words.d.ts +2 -0
- package/views/dist/controls/views-list/words.js +1 -1
- package/views/dist/editors/EditorPanel.js +3 -2
- package/views/dist/editors/edit-session.js +2 -5
- package/views/dist/field-row/FieldRow.d.ts +4 -2
- package/views/dist/field-row/FieldRow.js +80 -20
- package/views/dist/field-row/FieldRowLane.d.ts +7 -2
- package/views/dist/field-row/FieldRowLane.js +4 -3
- package/views/dist/field-row/editors/RowEditor.d.ts +12 -0
- package/views/dist/field-row/editors/RowEditor.js +31 -1
- package/views/dist/field-row/editors/RowValueListEditor.d.ts +5 -1
- package/views/dist/field-row/editors/RowValueListEditor.js +4 -1
- package/views/dist/field-row/field-row-button.d.ts +5 -0
- package/views/dist/field-row/field-row-button.js +2 -0
- package/views/dist/fields/binding.d.ts +3 -2
- package/views/dist/fields/binding.js +38 -5
- package/views/dist/fields/money.d.ts +5 -2
- package/views/dist/fields/money.js +14 -2
- package/views/dist/grid/chrome/GridColumnMenu.d.ts +4 -2
- package/views/dist/grid/chrome/GridColumnMenu.js +3 -2
- package/views/dist/grid/chrome/GridGroupMenu.d.ts +4 -1
- package/views/dist/grid/chrome/GridGroupMenu.js +4 -3
- package/views/dist/grid/chrome/GridHeader.d.ts +4 -1
- package/views/dist/grid/chrome/GridHeader.js +2 -2
- package/views/dist/grid/chrome/GridRow.js +6 -5
- package/views/dist/grid/chrome/GridRowCells.js +6 -9
- package/views/dist/grid/chrome/GridStructure.d.ts +4 -1
- package/views/dist/grid/chrome/GridStructure.js +4 -4
- package/views/dist/grid/chrome/GridTable.js +9 -3
- 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-column-menu-items.js +1 -1
- package/views/dist/grid/chrome/grid-row-menu-items.d.ts +27 -3
- package/views/dist/grid/chrome/grid-row-menu-items.js +93 -7
- package/views/dist/grid/chrome/grid-row-props.d.ts +7 -2
- package/views/dist/grid/chrome/grid-rows-menu.js +34 -6
- package/views/dist/grid/chrome/grid-table-props.d.ts +38 -7
- package/views/dist/grid/chrome/useGridBatchApi.d.ts +3 -1
- package/views/dist/grid/chrome/useGridBatchApi.js +4 -2
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +7 -2
- package/views/dist/grid/chrome/useGridKeyboard.js +43 -14
- package/views/dist/grid/chrome/useGridPendingReconciliation.js +1 -2
- package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +1 -1
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +20 -7
- 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/commit-model.d.ts +20 -2
- package/views/dist/grid/core/editing-controller.d.ts +21 -0
- package/views/dist/grid/core/editing-controller.js +194 -42
- package/views/dist/grid/core/editing-model.d.ts +3 -0
- package/views/dist/grid/core/editing-model.js +3 -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/save-path.d.ts +24 -0
- package/views/dist/grid/core/save-path.js +122 -0
- package/views/dist/grid/core/spreadsheet-operations.d.ts +3 -0
- package/views/dist/grid/core/spreadsheet-operations.js +24 -1
- package/views/dist/grid/core/useGridEditing.d.ts +5 -0
- package/views/dist/grid/core/useGridEditing.js +6 -0
- package/views/dist/grid/index.d.ts +3 -2
- package/views/dist/grid/index.js +1 -0
- package/views/dist/internal/field-rows.d.ts +26 -0
- package/views/dist/internal/field-rows.js +8 -0
- package/views/dist/internal/page-close.d.ts +7 -0
- package/views/dist/internal/page-close.js +43 -0
- package/views/dist/list/answer.d.ts +40 -0
- package/views/dist/list/answer.js +43 -0
- package/views/dist/list/browser-views-store.d.ts +10 -0
- package/views/dist/list/browser-views-store.js +182 -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 +36 -0
- package/views/dist/list/index.js +11 -0
- 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/menu.d.ts +31 -0
- package/views/dist/list/menu.js +76 -0
- package/views/dist/list/parts.d.ts +6 -0
- package/views/dist/list/parts.js +66 -0
- package/views/dist/list/registry.d.ts +11 -0
- package/views/dist/list/registry.js +31 -0
- 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 +41 -0
- package/views/dist/list/root.js +168 -0
- package/views/dist/list/slot.d.ts +14 -0
- package/views/dist/list/slot.js +22 -0
- package/views/dist/list/source-answers.d.ts +39 -0
- package/views/dist/list/source-answers.js +225 -0
- package/views/dist/list/source.d.ts +11 -0
- package/views/dist/list/source.js +31 -0
- package/views/dist/list/store.d.ts +119 -0
- package/views/dist/list/store.js +146 -0
- package/views/dist/list/toolbar.d.ts +7 -0
- package/views/dist/list/toolbar.js +371 -0
- package/views/dist/list/views-axis.d.ts +5 -0
- package/views/dist/list/views-axis.js +98 -0
- package/views/dist/list/views-store.d.ts +41 -0
- package/views/dist/list/views-store.js +1 -0
- package/views/dist/list/views.d.ts +72 -0
- package/views/dist/list/views.js +411 -0
- 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/preferences.js +1 -1
- package/views/dist/model/prefs-buckets.js +1 -1
- package/views/dist/model/view-rules.js +1 -0
- package/views/dist/panels/index.d.ts +3 -1
- package/views/dist/panels/index.js +1 -0
- package/views/dist/panels/model.d.ts +2 -0
- package/views/dist/panels/react/customize-body.js +1 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +47 -4
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +6 -326
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +17 -2
- package/views/dist/panels/react/toolbar/Toolbar.js +43 -23
- 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 +7 -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 +2 -2
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +2 -2
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +3 -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 +20 -3
- package/views/dist/panels/react/toolbar/context.js +3 -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/react/views-row/FoldingViewRow.d.ts +1 -1
- package/views/dist/panels/react/views-row/FoldingViewRow.js +15 -4
- package/views/dist/panels/react/views-row/PillGroup.d.ts +5 -2
- package/views/dist/panels/react/views-row/PillGroup.js +16 -7
- package/views/dist/panels/react/views-row/ViewPicker.js +2 -12
- package/views/dist/panels/react/views-row/ViewPickerRow.d.ts +4 -2
- package/views/dist/panels/react/views-row/ViewPickerRow.js +9 -5
- package/views/dist/panels/react.d.ts +2 -2
- package/views/dist/panels/settings/filter-groups.js +6 -1
- package/views/dist/panels/toolbar/edit-view.d.ts +7 -1
- package/views/dist/panels/toolbar/edit-view.js +14 -0
- package/views/dist/panels/toolbar/model.d.ts +5 -0
- package/views/dist/panels/toolbar/model.js +7 -3
- package/views/dist/panels/view-state.d.ts +5 -3
- package/views/dist/panels/views-row/model.d.ts +19 -2
- package/views/dist/panels/views-row/model.js +14 -0
- package/views/dist/provider/ViewsProvider.d.ts +21 -8
- package/views/dist/provider/ViewsProvider.js +40 -5
- package/views/dist/provider/components.d.ts +102 -2
- package/views/dist/provider/components.js +1 -1
- package/views/dist/provider/context.d.ts +6 -2
- package/views/dist/provider/context.js +1 -1
- package/views/dist/provider/own-control.d.ts +4 -0
- package/views/dist/provider/own-control.js +7 -0
- package/views/dist/provider/ports.d.ts +19 -12
- package/views/dist/provider/ports.js +69 -1
- 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 +503 -136
- package/views/dist/styles.unlayered.css +503 -136
- package/views/docs/contract.md +292 -34
- package/views/docs/controls/avatar.md +11 -0
- package/views/docs/controls/choice.md +0 -1
- 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 +7 -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 +5 -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 +20 -1
- package/views/docs/controls/select.md +10 -0
- package/views/docs/controls/setting-row.md +18 -0
- package/views/docs/controls/sheet.md +4 -0
- package/views/docs/controls/sort-editor.md +8 -0
- package/views/docs/controls/switch-row.md +0 -3
- package/views/docs/controls/tag-field.md +4 -0
- package/views/docs/controls/tag.md +1 -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/getting-started.md +2 -2
- package/views/docs/guides/atoms.md +2 -2
- package/views/docs/guides/columns.md +1 -1
- package/views/docs/guides/ports.md +1 -1
- package/views/docs/guides/the-grid.md +36 -9
- package/views/docs/guides/the-provider.md +22 -3
- package/views/docs/index.md +1 -0
- package/views/docs/reference/controls.md +41 -29
- package/views/docs/reference/editors-session.md +1 -1
- package/views/docs/reference/field-row.md +9 -1
- package/views/docs/reference/grid.md +15 -9
- package/views/docs/reference/list.md +357 -0
- package/views/docs/reference/looks.md +1 -1
- package/views/docs/reference/panels-react.md +17 -12
- package/views/docs/reference/panels.md +8 -5
- package/views/docs/reference/react.md +24 -16
- package/views/docs/reference/views.md +10 -6
- package/views/docs/reshaping.md +6 -1
- package/views/skills/views/SKILL.md +9 -6
|
@@ -37,6 +37,9 @@ export type ViewsButtonProps = {
|
|
|
37
37
|
"aria-expanded"?: boolean;
|
|
38
38
|
/** The part's name, `vk-grid-row-more` on a row's ⋯. */
|
|
39
39
|
"data-slot"?: string;
|
|
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. Forward it to your element. */
|
|
42
|
+
"data-key"?: string;
|
|
40
43
|
/** A state flag: `""` (present, no value) while the menu this button opens is open; absent when closed. */
|
|
41
44
|
"data-open"?: "";
|
|
42
45
|
/** True while a field row's write is pending: the button keeps its focus and takes no press. Forward it to your
|
|
@@ -87,6 +90,8 @@ export type ViewsPopoverProps = {
|
|
|
87
90
|
/** The popup's own style, where a class cannot say it: a width that follows the cell it opens on. */
|
|
88
91
|
style?: CSSProperties;
|
|
89
92
|
className?: string;
|
|
93
|
+
/** Its name to a screen reader (VK-1013: Add sort's fields, inside a panel under `panelControls`): your popup's `aria-label`. */
|
|
94
|
+
label?: string;
|
|
90
95
|
children: ReactNode;
|
|
91
96
|
};
|
|
92
97
|
/** The app mounts one tooltip provider above the views; a tooltip never mounts its own. Its child may be a plain
|
|
@@ -157,6 +162,13 @@ export type ViewsMenuItem = {
|
|
|
157
162
|
shortcut?: string;
|
|
158
163
|
/** A link item: the row is an anchor and `onSelect` still fires. */
|
|
159
164
|
href?: string;
|
|
165
|
+
/** Draws the row's inside, in place of its icon, words, keys and count; `label` stays its words (a screen reader, typing
|
|
166
|
+
* to find it). Called while the menu draws: return elements, call no hooks in it. Honoured on a plain row: a group, a
|
|
167
|
+
* tick and a link draw as they are. A hint: an adapter that ignores it draws the label. */
|
|
168
|
+
render?: () => ReactNode;
|
|
169
|
+
/** The row's public name where ViewKit names it (VK-1013: `vk-sort-rule-action`, a panel's menu under `panelControls`), its
|
|
170
|
+
* `key` saying which one: draw them on your row as its `data-slot` and `data-key`. */
|
|
171
|
+
slot?: string;
|
|
160
172
|
};
|
|
161
173
|
/** Opens at `anchor`, with no trigger child; a group opens beside it only where it asks to and the
|
|
162
174
|
* adapter can. On Base UI, the menu's root, positioner and popup, the anchor handed to the positioner. */
|
|
@@ -171,6 +183,9 @@ export type ViewsMenuProps = {
|
|
|
171
183
|
* menu the package opens hands one. */
|
|
172
184
|
label?: string;
|
|
173
185
|
className?: string;
|
|
186
|
+
/** The menu's public name where ViewKit names it (VK-988: `vk-view-menu`): draw it on your popup as its `data-slot`. ViewKit's
|
|
187
|
+
* own Menu also names each row `<name>-row`, which one by its item's `data-key`. */
|
|
188
|
+
"data-slot"?: string;
|
|
174
189
|
};
|
|
175
190
|
/** The command list's parts, the shape both cmdk-based shadcn copies already have. */
|
|
176
191
|
export type ViewsCommandParts = {
|
|
@@ -808,6 +823,8 @@ export type ViewsFilterBodyField = {
|
|
|
808
823
|
type: keyof typeof FILTER_OPERATORS;
|
|
809
824
|
/** A relation's far fields, one level in: a rule on one is a relation rule (any, none or every where …). */
|
|
810
825
|
far?: readonly ViewsFilterBodyField[];
|
|
826
|
+
/** A number field that holds whole numbers only (`isIntegerField`): your body's box takes whole numbers. Absent, any. */
|
|
827
|
+
integer?: true;
|
|
811
828
|
/** A choice field's values (a status's, a select's, a person's, a record's), or a place's country's names (its `countryCode`
|
|
812
829
|
* part, VK-735), each as the Picker draws it, where ViewKit holds
|
|
813
830
|
* them as the list opens: your body may list them in the rule's value box. Absent where its values are read on demand, or the
|
|
@@ -993,6 +1010,8 @@ export type ViewsViewsListItem = {
|
|
|
993
1010
|
changed?: boolean;
|
|
994
1011
|
/** One of the reader's favorites. */
|
|
995
1012
|
favorite?: boolean;
|
|
1013
|
+
/** A view this reader can't change: no Rename, Delete, Private view or Save in its menu; Reset, Save as new view, Copy link and Duplicate stay. */
|
|
1014
|
+
readOnly?: boolean;
|
|
996
1015
|
};
|
|
997
1016
|
/** A view as a restore hands it back. */
|
|
998
1017
|
export type ViewsViewRecord = {
|
|
@@ -1074,6 +1093,12 @@ export type ViewsViewVerbs = {
|
|
|
1074
1093
|
* is deleted, the view again on a restore with `open`, the new one on a create or a duplicate, whose ids your app makes).
|
|
1075
1094
|
* `viewsAfter` (viewkitjs/views/controls) does all of it over your views. */
|
|
1076
1095
|
onChange: (change: ViewsViewChange) => void;
|
|
1096
|
+
/** The view's menu as data (VK-741): handed its default items, keyed (`rename`, `edit`, `private`, `save`, `reset`,
|
|
1097
|
+
* `save-new`, `copy-link`, `favorite`, `duplicate`, `delete`; on a phone the groups `unsaved` and `this-view`), and the view,
|
|
1098
|
+
* it hands back the items drawn. `menu` (viewkitjs/views/list) drops, renames, adds and moves them. */
|
|
1099
|
+
menu?: (items: ViewsMenuItem[], ctx: {
|
|
1100
|
+
view: ViewsViewsListItem;
|
|
1101
|
+
}) => ViewsMenuItem[];
|
|
1077
1102
|
};
|
|
1078
1103
|
/** The views list's body, which your app draws (`ViewsListBody`): what the view picker's chip opens on a computer and in
|
|
1079
1104
|
* the phone's Sheet, in place of ViewKit's own list. A panel's body, as every panel's: handed the axis's views as data,
|
|
@@ -1113,6 +1138,29 @@ export type ViewsViewsListBodyProps = {
|
|
|
1113
1138
|
* dialog, which stands outside the list's popover), and the list stays when it is answered. On a computer. */
|
|
1114
1139
|
onHold?: (holding: boolean) => void;
|
|
1115
1140
|
};
|
|
1141
|
+
/** One view's whole menu at an anchor, which your app may draw (`ViewMenu`; `CONTROLS.ViewMenu` is ViewKit's own): what a views
|
|
1142
|
+
* row's pill and a folded view's ⋮ open on a computer where the axis hands `verbs` (VK-947), in place of the view's `menu`
|
|
1143
|
+
* rows. Its items are the views list's view menu's (Rename, Edit view, Save, Reset, Save as new view, Copy link, Duplicate,
|
|
1144
|
+
* Delete), as data `verbs.menu` reshapes; Rename and New view ask in their Modal, Delete asks first and says so with Undo. */
|
|
1145
|
+
export type ViewsViewMenuProps = {
|
|
1146
|
+
open: boolean;
|
|
1147
|
+
onOpenChange: ViewsOpenChange;
|
|
1148
|
+
anchor: ViewsAnchor;
|
|
1149
|
+
align?: ViewsAlign;
|
|
1150
|
+
/** The view whose menu it is, by its value. Left out, it stands on New view's Modal (the layouts, the name) in place of a
|
|
1151
|
+
* menu, as the views row's + opens it (VK-971): drawn with `open`, it tells `onOpenChange(false)` once the Modal has closed. */
|
|
1152
|
+
view?: string;
|
|
1153
|
+
/** Every view of the axis, in its order, as the views list is handed them: Delete keeps one, Undo puts it back in its place. */
|
|
1154
|
+
views: readonly ViewsViewsListItem[];
|
|
1155
|
+
/** The view in use. */
|
|
1156
|
+
value: string;
|
|
1157
|
+
verbs: ViewsViewVerbs;
|
|
1158
|
+
/** A change opened a view, ended in the Toast, or asked for Customize: what holds the menu closes. */
|
|
1159
|
+
onDone?: () => void;
|
|
1160
|
+
/** While true, the menu asks outside what holds it (your `confirm` port's dialog): a press outside and Escape close nothing
|
|
1161
|
+
* there, and it stays when it is answered. */
|
|
1162
|
+
onHold?: (holding: boolean) => void;
|
|
1163
|
+
};
|
|
1116
1164
|
/** A field a list can be grouped by, as the group body is handed it (`ViewsGroupBodyProps.dimensions`): the panels'
|
|
1117
1165
|
* `GroupDimension` (`viewkitjs/views/panels`), written out here, since the provider reaches nothing inside the panels. */
|
|
1118
1166
|
export type ViewsGroupDimension = {
|
|
@@ -1395,9 +1443,11 @@ export type ViewsCustomizeBodyProps = {
|
|
|
1395
1443
|
group?: Omit<ViewsGroupBodyProps, "form" | "onDone" | "actions" | "onStepChange">;
|
|
1396
1444
|
/** The list's own toggles, Show counts among them (read from the view). */
|
|
1397
1445
|
toggles: readonly ViewsCustomizeToggle[];
|
|
1398
|
-
/** On a
|
|
1446
|
+
/** On a saved view: how far the reader has drifted from it, and Reset and Save for everyone (Save on the reader's own). */
|
|
1399
1447
|
view?: {
|
|
1400
1448
|
changes: number;
|
|
1449
|
+
/** The view is this reader's own: its Save says `views.panels.view-save-own`. */
|
|
1450
|
+
own?: boolean;
|
|
1401
1451
|
/** Everyone's view moved after the reader's changes began. */
|
|
1402
1452
|
stale: boolean;
|
|
1403
1453
|
/** The reader may set what they see as everyone's. */
|
|
@@ -1481,6 +1531,49 @@ export type ViewsInputProps = Omit<ComponentPropsWithRef<"input">, "children"> &
|
|
|
1481
1531
|
* wears the app's field frame, as a form's input does. Default `bare`. */
|
|
1482
1532
|
chrome?: "bare" | "field";
|
|
1483
1533
|
};
|
|
1534
|
+
/** One row of a Select's list (VK-1013). `level` holds the rows one level in, under a row that is never picked itself (a
|
|
1535
|
+
* deal's Company › Region): draw them in place, or flatten them with `flatSelectItems`, each named by its path. */
|
|
1536
|
+
export type ViewsSelectItem = {
|
|
1537
|
+
value: string;
|
|
1538
|
+
label: string;
|
|
1539
|
+
/** Its mark before the words: a field's type, a direction's arrow. */
|
|
1540
|
+
icon?: ReactNode;
|
|
1541
|
+
/** A second line under the words ("Sorted"). */
|
|
1542
|
+
line?: string;
|
|
1543
|
+
/** The heading it stands under. */
|
|
1544
|
+
group?: string;
|
|
1545
|
+
/** It can't be picked: greyed, passed over by the keys. */
|
|
1546
|
+
disabled?: boolean;
|
|
1547
|
+
level?: ViewsSelectItem[];
|
|
1548
|
+
};
|
|
1549
|
+
/** The components map's `Select` (VK-1013): pick one value, or several, from a list. ViewKit's panels draw it under the
|
|
1550
|
+
* provider's `panelControls` for the boxes that pick (the sort's field and direction, the filter's field, way and choices). */
|
|
1551
|
+
export type ViewsSelectProps = {
|
|
1552
|
+
items: ViewsSelectItem[];
|
|
1553
|
+
/** One value, several (with `multiple`), or none. */
|
|
1554
|
+
value: string | string[] | null;
|
|
1555
|
+
/** A pick: one value, or the values now picked. */
|
|
1556
|
+
onValueChange: (value: string | string[] | null) => void;
|
|
1557
|
+
multiple?: boolean;
|
|
1558
|
+
/** What the box says with nothing picked. */
|
|
1559
|
+
placeholder?: string;
|
|
1560
|
+
disabled?: boolean;
|
|
1561
|
+
/** Its list held open or shut from outside, told every press that would open or shut it. On a phone a panel holds it
|
|
1562
|
+
* shut and turns its sheet to a step of its own on `onOpenChange(true)`: honour both when handed. */
|
|
1563
|
+
open?: boolean;
|
|
1564
|
+
onOpenChange?: (open: boolean) => void;
|
|
1565
|
+
/** The words of the search ViewKit's own Select shows over a long list ("Search deal fields"); yours may show one. */
|
|
1566
|
+
search?: string;
|
|
1567
|
+
size?: "sm" | "default";
|
|
1568
|
+
className?: string;
|
|
1569
|
+
"aria-label"?: string;
|
|
1570
|
+
/** The part's public name (`vk-sort-field`) and which one: draw them on the box a person presses. */
|
|
1571
|
+
"data-slot"?: string;
|
|
1572
|
+
"data-key"?: string;
|
|
1573
|
+
};
|
|
1574
|
+
/** The controls ViewKit's panels can draw as the app's own, under the provider's `panelControls` (VK-1013). */
|
|
1575
|
+
export type PanelControlName = "Button" | "Select" | "Menu" | "Popover" | "Input";
|
|
1576
|
+
export declare const PANEL_CONTROL_NAMES: readonly PanelControlName[];
|
|
1484
1577
|
/** What the components map's `RowsWait` is handed: a grid's rows, and whether new ones are loading. */
|
|
1485
1578
|
export type ViewsRowsWaitProps = {
|
|
1486
1579
|
/** New rows are loading: `children` are the old ones, inert. Draw how they wait (a bar along the top, the rows
|
|
@@ -1530,6 +1623,9 @@ export type ViewsComponents = {
|
|
|
1530
1623
|
/** Optional: every editor's single-line box draws through it. Left out, the provider draws a
|
|
1531
1624
|
* plain `<input>`. */
|
|
1532
1625
|
Input?: ComponentType<ViewsInputProps>;
|
|
1626
|
+
/** Optional: the panels' boxes that pick (VK-1013), drawn only inside ViewKit's panels and only where the provider's
|
|
1627
|
+
* `panelControls` names `Select`. Left out, the panels draw ViewKit's own (`CONTROLS.Select`). */
|
|
1628
|
+
Select?: ComponentType<ViewsSelectProps>;
|
|
1533
1629
|
/** Required: a whole pick list your app draws (`CONTROLS.Picker` is ViewKit's own). The select, several-values,
|
|
1534
1630
|
* place and relation editors open it, handed their rows as data. */
|
|
1535
1631
|
Picker: ComponentType<ViewsPickerProps>;
|
|
@@ -1574,6 +1670,10 @@ export type ViewsComponents = {
|
|
|
1574
1670
|
/** Required: the views list's whole body, which your app draws (`CONTROLS.ViewsListBody` is ViewKit's own). The view
|
|
1575
1671
|
* picker's chip opens it on a computer and in the phone's Sheet, handed the views as data. */
|
|
1576
1672
|
ViewsListBody: ComponentType<ViewsViewsListBodyProps>;
|
|
1673
|
+
/** Optional: one view's whole menu, which your app draws (`CONTROLS.ViewMenu` is ViewKit's own). A views row's pill and a
|
|
1674
|
+
* folded view's ⋮ open it where the axis hands `verbs`, and the row's + opens it with no `view`, on New view; left out, they
|
|
1675
|
+
* open the view's `menu` rows through `Menu`, and the + calls the axis's `onCreate`. */
|
|
1676
|
+
ViewMenu?: ComponentType<ViewsViewMenuProps>;
|
|
1577
1677
|
/** @deprecated Read by nothing: only ViewKit's own Customize opened it, and that Customize is gone. A `CustomizeBody`
|
|
1578
1678
|
* holds its own group editor, handed the group as `GroupBody` was (`ViewsCustomizeBodyProps.group`). */
|
|
1579
1679
|
GroupBody?: ComponentType<ViewsGroupBodyProps>;
|
|
@@ -1596,7 +1696,7 @@ export type ViewsComponents = {
|
|
|
1596
1696
|
/** The selection bar's props, as your `SelectionBar` is handed them: ViewKit's `SelectionBar`'s own. */
|
|
1597
1697
|
export type ViewsSelectionBarProps = SelectionBarProps;
|
|
1598
1698
|
/** The map as the views read it: `Input` and `Calendar` always filled, the app's or the
|
|
1599
|
-
* package's own; `RowsWait`, `GroupBody`, `SearchField`, `PortsHost` and `
|
|
1699
|
+
* package's own; `RowsWait`, `GroupBody`, `SearchField`, `PortsHost`, `SelectionBar` and `ViewMenu` as the app handed them. */
|
|
1600
1700
|
export type ViewsResolvedComponents = ViewsComponents & {
|
|
1601
1701
|
Input: ComponentType<ViewsInputProps>;
|
|
1602
1702
|
Calendar: ComponentType<ViewsCalendarProps>;
|
|
@@ -2,7 +2,7 @@ import type { FieldConventions } from "viewkitjs/fields";
|
|
|
2
2
|
import type { ViewsMessageResolver } from "../contract.js";
|
|
3
3
|
import type { ViewsAtoms } from "../atoms/types.js";
|
|
4
4
|
import type { FieldPresentation } from "../display/options.js";
|
|
5
|
-
import type { ViewsDatePicks, ViewsResolvedComponents, ViewsSelectionBarSettings, ViewsSheetActionsPlace } from "./components.js";
|
|
5
|
+
import type { PanelControlName, ViewsDatePicks, ViewsResolvedComponents, ViewsSelectionBarSettings, ViewsSheetActionsPlace } from "./components.js";
|
|
6
6
|
import type { ViewsIcons } from "./icons.js";
|
|
7
7
|
import type { ViewsResolvedPorts } from "./ports.js";
|
|
8
8
|
import type { ViewsEscapeRules } from "../editors/escape-rule.js";
|
|
@@ -13,7 +13,8 @@ export type ViewsContextValue = {
|
|
|
13
13
|
components: ViewsResolvedComponents;
|
|
14
14
|
atoms: ViewsAtoms;
|
|
15
15
|
icons: ViewsIcons;
|
|
16
|
-
/** The app's ports, with `confirm` always a function (the browser's where
|
|
16
|
+
/** The app's ports, each one it left out filled with its default: `confirm` always a function (the browser's where
|
|
17
|
+
* nothing draws ViewKit's). */
|
|
17
18
|
ports: ViewsResolvedPorts;
|
|
18
19
|
/** No `confirm` of the app's and no `PortsHost` to draw ViewKit's: `ports.confirm` is the browser's own. A control that can ask
|
|
19
20
|
* in a dialog of its own (a view's menu, VK-823) asks there instead. */
|
|
@@ -39,6 +40,9 @@ export type ViewsContextValue = {
|
|
|
39
40
|
selectionBar?: ViewsSelectionBarSettings;
|
|
40
41
|
/** The quick days the date editors offer (`ViewsProvider`'s `datePicks`); absent, today, tomorrow and next Monday. */
|
|
41
42
|
datePicks?: ViewsDatePicks;
|
|
43
|
+
/** The controls ViewKit's panels draw as the app's own (`ViewsProvider`'s `panelControls`, VK-1013): each name opted in whose
|
|
44
|
+
* control in `components` is the app's, never one of ViewKit's own. Empty unless the app opts in. */
|
|
45
|
+
panelControls: ReadonlySet<PanelControlName>;
|
|
42
46
|
};
|
|
43
47
|
export declare const ViewsContext: import("react").Context<ViewsContextValue | null>;
|
|
44
48
|
export declare function useViews(): ViewsContextValue;
|
|
@@ -4,7 +4,7 @@ export const ViewsContext = createContext(null);
|
|
|
4
4
|
export function useViews() {
|
|
5
5
|
const value = useContext(ViewsContext);
|
|
6
6
|
if (!value) {
|
|
7
|
-
throw new Error("useViews() needs a <ViewsProvider> above it: mount one at the app's client root
|
|
7
|
+
throw new Error("useViews() needs a <ViewsProvider> above it: mount one at the app's client root, <ViewsProvider components={CONTROLS}> at the least.");
|
|
8
8
|
}
|
|
9
9
|
return value;
|
|
10
10
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const OWN_CONTROL = Symbol.for("viewkitjs.views.own-control");
|
|
2
|
+
export function markOwnControl(control) {
|
|
3
|
+
return Object.defineProperty(control, OWN_CONTROL, { value: true, enumerable: false });
|
|
4
|
+
}
|
|
5
|
+
export function isOwnControl(control) {
|
|
6
|
+
return (typeof control === "function" || (typeof control === "object" && control !== null)) && control[OWN_CONTROL] === true;
|
|
7
|
+
}
|
|
@@ -46,24 +46,31 @@ export type ViewsConfirmPort = (request: ViewsConfirmRequest) => Promise<boolean
|
|
|
46
46
|
export type ViewsPorts = {
|
|
47
47
|
/** What ViewKit reports. Absent: ViewKit's Toast where the components map hands `PortsHost` (CONTROLS does), else nothing. */
|
|
48
48
|
toast?: ViewsToastPort;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
/** Absent: haptics that do nothing (`NO_HAPTICS`). */
|
|
50
|
+
haptics?: ViewsHapticsPort;
|
|
51
|
+
/** Absent: the browser's own clipboard (`browserClipboard`). */
|
|
52
|
+
clipboard?: ViewsClipboardPort;
|
|
53
|
+
/** Absent: a store on the browser's `localStorage`, at the package's own `vk:` keys (`localPrefs`). */
|
|
54
|
+
viewPrefs?: ViewsPrefsPort;
|
|
52
55
|
/** Asks before a destructive act (a row's Delete). Absent: ViewKit's alert dialog where the components map hands
|
|
53
56
|
* `PortsHost` (CONTROLS does), else the browser's own confirm with `message`. */
|
|
54
57
|
confirm?: ViewsConfirmPort;
|
|
55
58
|
};
|
|
56
|
-
/** The ports as the provider hands them on
|
|
57
|
-
* else a toast that draws nothing and the browser's confirm. */
|
|
58
|
-
export type ViewsResolvedPorts = ViewsPorts
|
|
59
|
-
toast: ViewsToastPort;
|
|
60
|
-
confirm: ViewsConfirmPort;
|
|
61
|
-
};
|
|
59
|
+
/** The ports as the provider hands them on, every one there: the app's own, else the default. `toast` and `confirm` are
|
|
60
|
+
* `PortsHost`'s where the app handed none, else a toast that draws nothing and the browser's confirm. */
|
|
61
|
+
export type ViewsResolvedPorts = Required<ViewsPorts>;
|
|
62
62
|
/** The browser's own dialog, read when it is asked, so a server render never reaches `window`. */
|
|
63
63
|
export declare const browserConfirm: ViewsConfirmPort;
|
|
64
64
|
/** A toast that draws nothing: where an app hands none and nothing draws ViewKit's. */
|
|
65
65
|
export declare const NOOP_TOAST: ViewsToastPort;
|
|
66
|
+
/** Haptics that do nothing: the default where an app hands none. */
|
|
67
|
+
export declare const NO_HAPTICS: ViewsHapticsPort;
|
|
68
|
+
/** The browser's own clipboard, the default where an app hands none: read when it is called, so a server render never
|
|
69
|
+
* reaches it; where the browser refuses or has none, a write resolves to false and a read to null. */
|
|
70
|
+
export declare const browserClipboard: ViewsClipboardPort;
|
|
71
|
+
/** The per-device store on the browser's `localStorage`, the default where an app hands none: each value as JSON at the
|
|
72
|
+
* package's own key (its `vk:` names). Read when it is called, never while the server renders; where storage is refused
|
|
73
|
+
* or there is no window, nothing is kept and nothing throws. */
|
|
74
|
+
export declare const localPrefs: ViewsPrefsPort;
|
|
66
75
|
/** Ports that do nothing: a server render, a test, an app without a device. */
|
|
67
|
-
export declare const NOOP_PORTS: ViewsPorts &
|
|
68
|
-
toast: ViewsToastPort;
|
|
69
|
-
};
|
|
76
|
+
export declare const NOOP_PORTS: ViewsPorts & Required<Omit<ViewsPorts, "confirm">>;
|
|
@@ -2,9 +2,77 @@ export const browserConfirm = async ({ message }) => window.confirm(message);
|
|
|
2
2
|
const _portsMatchContract = true;
|
|
3
3
|
void _portsMatchContract;
|
|
4
4
|
export const NOOP_TOAST = { success() { }, error() { }, info() { }, warning() { } };
|
|
5
|
+
export const NO_HAPTICS = { selection() { }, impact() { }, notification() { } };
|
|
6
|
+
export const browserClipboard = {
|
|
7
|
+
writeText: async (text) => {
|
|
8
|
+
try {
|
|
9
|
+
if (typeof navigator === "undefined" || !navigator.clipboard)
|
|
10
|
+
return false;
|
|
11
|
+
await navigator.clipboard.writeText(text);
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
readText: async () => {
|
|
19
|
+
try {
|
|
20
|
+
if (typeof navigator === "undefined" || !navigator.clipboard)
|
|
21
|
+
return null;
|
|
22
|
+
return await navigator.clipboard.readText();
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
const prefListeners = new Map();
|
|
30
|
+
export const localPrefs = {
|
|
31
|
+
get: (key) => {
|
|
32
|
+
try {
|
|
33
|
+
if (typeof window === "undefined")
|
|
34
|
+
return undefined;
|
|
35
|
+
const stored = localStorage.getItem(key);
|
|
36
|
+
return stored == null ? undefined : JSON.parse(stored);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
set: (key, value) => {
|
|
43
|
+
try {
|
|
44
|
+
if (typeof window === "undefined")
|
|
45
|
+
return;
|
|
46
|
+
localStorage.setItem(key, JSON.stringify(value));
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
for (const listener of [...(prefListeners.get(key) ?? [])])
|
|
52
|
+
listener();
|
|
53
|
+
},
|
|
54
|
+
subscribe: (key, listener) => {
|
|
55
|
+
if (typeof window === "undefined")
|
|
56
|
+
return () => { };
|
|
57
|
+
const onStorage = (event) => {
|
|
58
|
+
if (event.key === key)
|
|
59
|
+
listener();
|
|
60
|
+
};
|
|
61
|
+
const listeners = prefListeners.get(key) ?? new Set();
|
|
62
|
+
listeners.add(listener);
|
|
63
|
+
prefListeners.set(key, listeners);
|
|
64
|
+
window.addEventListener("storage", onStorage);
|
|
65
|
+
return () => {
|
|
66
|
+
listeners.delete(listener);
|
|
67
|
+
if (listeners.size === 0)
|
|
68
|
+
prefListeners.delete(key);
|
|
69
|
+
window.removeEventListener("storage", onStorage);
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
};
|
|
5
73
|
export const NOOP_PORTS = {
|
|
6
74
|
toast: NOOP_TOAST,
|
|
7
|
-
haptics:
|
|
75
|
+
haptics: NO_HAPTICS,
|
|
8
76
|
clipboard: { writeText: async () => false, readText: async () => null },
|
|
9
77
|
viewPrefs: { get: () => undefined, set() { }, subscribe: () => () => { } },
|
|
10
78
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export function flatSelectItems(items) {
|
|
2
|
+
return flatUnder(items, []);
|
|
3
|
+
}
|
|
4
|
+
function flatUnder(items, path) {
|
|
5
|
+
return items.flatMap(({ level, ...row }) => level ? flatUnder(level, [...path, row.label]) : [path.length ? { ...row, label: [...path, row.label].join(" › ") } : row]);
|
|
6
|
+
}
|
package/views/dist/react.d.ts
CHANGED
|
@@ -3,11 +3,13 @@ export type { ViewsContextValue, ViewsProviderProps } from "./provider/ViewsProv
|
|
|
3
3
|
export type { EditEscape, EditEscapeByEditor, ViewsEscapeRules } from "./editors/escape-rule.js";
|
|
4
4
|
export type { ViewsOneValueEditors } from "./model/one-value.js";
|
|
5
5
|
export { DEFAULT_DESKTOP_QUERY } from "./provider/desktop.js";
|
|
6
|
+
export { PANEL_CONTROL_NAMES } from "./provider/components.js";
|
|
7
|
+
export { flatSelectItems } from "./provider/select-items.js";
|
|
6
8
|
export type { ViewsSeveralValues } from "./display/fit-values.js";
|
|
7
|
-
export type { ViewsAlign, ViewsAnchor, ViewsBarPlacement, ViewsButtonProps, ViewsCalendarProps, ViewsCheckboxProps, ViewsCloseReason, ViewsCollapseProps, ViewsCommandParts, ViewsComponents, ViewsCustomizeBodyProps, ViewsCustomizeChoice, ViewsCustomizeColumn, ViewsCustomizeColumns, ViewsCustomizeField, ViewsCustomizeFields, ViewsCustomizeLayout, ViewsCustomizePage, ViewsCustomizeToggle, ViewsDateBodyProps, ViewsDatePick, ViewsDatePicks, ViewsInputProps, ViewsFieldsBodyField, ViewsFieldsBodyProps, ViewsFilterBodyField, ViewsFilterBodyProps, ViewsFilterPartBodyProps, ViewsGroupBodyProps, ViewsGroupDimension, ViewsGroupEntry, ViewsGroupValue, ViewsMenuItem, ViewsMenuProps, ViewsNumberBodyProps, ViewsOpenChange, ViewsPartsBodyProps, ViewsPickerAction, ViewsPickerItem, ViewsPickerProps, ViewsLink, ViewsLinkRole, ViewsLinksBodyProps, ViewsPlacePart, ViewsPlaceParts, ViewsPopoverProps, ViewsPortsHostProps, ViewsSelectionBarProps, ViewsQuickFiltersBodyProps, ViewsResolvedComponents, ViewsRowsWaitProps, ViewsSearchFieldProps, ViewsSelectionBarSettings, ViewsSheetAction, ViewsSheetActions, ViewsBodyStep, ViewsSheetActionsPlace, ViewsSheetProps, ViewsSide, ViewsSortBodyProps, ViewsTextBodyProps, ViewsTooltipProps, ViewsValueLine, ViewsValuesBodyProps, ViewsViewsListBodyProps, ViewsViewsListItem, ViewsViewChange, ViewsViewLayout, ViewsViewRecord, ViewsViewVerbs, } from "./provider/components.js";
|
|
9
|
+
export type { ViewsAlign, ViewsAnchor, ViewsBarPlacement, ViewsButtonProps, ViewsCalendarProps, ViewsCheckboxProps, ViewsCloseReason, ViewsCollapseProps, ViewsCommandParts, ViewsComponents, ViewsCustomizeBodyProps, ViewsCustomizeChoice, ViewsCustomizeColumn, ViewsCustomizeColumns, ViewsCustomizeField, ViewsCustomizeFields, ViewsCustomizeLayout, ViewsCustomizePage, ViewsCustomizeToggle, ViewsDateBodyProps, ViewsDatePick, ViewsDatePicks, ViewsInputProps, ViewsFieldsBodyField, ViewsFieldsBodyProps, ViewsFilterBodyField, ViewsFilterBodyProps, ViewsFilterPartBodyProps, ViewsGroupBodyProps, ViewsGroupDimension, ViewsGroupEntry, ViewsGroupValue, ViewsMenuItem, ViewsMenuProps, ViewsNumberBodyProps, ViewsOpenChange, ViewsPartsBodyProps, ViewsPickerAction, ViewsPickerItem, ViewsPickerProps, ViewsLink, ViewsLinkRole, ViewsLinksBodyProps, ViewsPlacePart, ViewsPlaceParts, ViewsPopoverProps, ViewsPortsHostProps, PanelControlName, ViewsSelectionBarProps, ViewsSelectItem, ViewsSelectProps, ViewsQuickFiltersBodyProps, ViewsResolvedComponents, ViewsRowsWaitProps, ViewsSearchFieldProps, ViewsSelectionBarSettings, ViewsSheetAction, ViewsSheetActions, ViewsBodyStep, ViewsSheetActionsPlace, ViewsSheetProps, ViewsSide, ViewsSortBodyProps, ViewsTextBodyProps, ViewsTooltipProps, ViewsValueLine, ViewsValuesBodyProps, ViewsViewsListBodyProps, ViewsViewsListItem, ViewsViewChange, ViewsViewLayout, ViewsViewMenuProps, ViewsViewRecord, ViewsViewVerbs, } from "./provider/components.js";
|
|
8
10
|
export type { ViewsIconProps, ViewsIcons } from "./provider/icons.js";
|
|
9
11
|
export { NOOP_PORTS, NOOP_TOAST } from "./provider/ports.js";
|
|
10
12
|
export type { ViewsClipboardPort, ViewsConfirmPort, ViewsConfirmRequest, ViewsHapticsPort, ViewsPorts, ViewsPrefsPort, ViewsResolvedPorts, ViewsToastPort, } from "./provider/ports.js";
|
|
11
13
|
export { DEFAULT_VIEWS_ATOMS } from "./atoms/defaults.js";
|
|
12
|
-
export type { ViewsAtoms, ViewsAvatarProps, ViewsCommandMenuProps, ViewsRowMenuItem, ViewsRowMenuProps, ViewsListProps, ViewsRelationLinkProps, ViewsRelationRolesProps, ViewsCellMoreProps, ViewsLoadingProps, ViewsLoadMoreProps, ViewsPlatformMarkProps, ViewsRowContentProps, ViewsRowProps, ViewsSelectionSheetProps, ViewsStatusBadgeProps, ViewsStatusOption, ViewsStatusPlace, ViewsStatusMarkerProps, ViewsTagProps, ViewsTickBoxProps, ViewsChoiceRowProps, ViewsCheckRowProps, ViewsRadioRowProps, ViewsDirectionButtonProps, ViewsMenuRowProps, ViewsToggleRowProps, ViewsPanelSearchProps, ViewsPillProps, ViewsRangeCalendarProps, ViewsToolbarButtonProps, ViewsToolbarButtonPart, } from "./atoms/types.js";
|
|
14
|
+
export type { ViewsAtoms, ViewsAvatarProps, ViewsCommandMenuProps, ViewsRowMenuItem, ViewsRowMenuProps, ViewsListProps, ViewsRelationLinkProps, ViewsRelationRolesProps, 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";
|
|
13
15
|
export type { ComponentName, PortName, ViewsIconName, ViewsMessage, ViewsMessageResolver } from "./contract.js";
|
package/views/dist/react.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
export { ViewsProvider, useViews } from "./provider/ViewsProvider.js";
|
|
3
3
|
export { DEFAULT_DESKTOP_QUERY } from "./provider/desktop.js";
|
|
4
|
+
export { PANEL_CONTROL_NAMES } from "./provider/components.js";
|
|
5
|
+
export { flatSelectItems } from "./provider/select-items.js";
|
|
4
6
|
export { NOOP_PORTS, NOOP_TOAST } from "./provider/ports.js";
|
|
5
7
|
export { DEFAULT_VIEWS_ATOMS } from "./atoms/defaults.js";
|