@viewkitjs/views 0.0.0-stage → 0.2.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 +615 -0
- package/LICENSE.md +7 -0
- package/README.md +99 -2
- package/dist/atoms/CommandMenu.d.ts +2 -0
- package/dist/atoms/CommandMenu.js +20 -0
- package/dist/atoms/List.d.ts +2 -0
- package/dist/atoms/List.js +6 -0
- package/dist/atoms/LoadMore.d.ts +2 -0
- package/dist/atoms/LoadMore.js +25 -0
- package/dist/atoms/Loading.d.ts +2 -0
- package/dist/atoms/Loading.js +7 -0
- package/dist/atoms/PlatformMark.d.ts +2 -0
- package/dist/atoms/PlatformMark.js +4 -0
- package/dist/atoms/RelationLink.d.ts +2 -0
- package/dist/atoms/RelationLink.js +6 -0
- package/dist/atoms/Row.d.ts +3 -0
- package/dist/atoms/Row.js +30 -0
- package/dist/atoms/RowMenu.d.ts +2 -0
- package/dist/atoms/RowMenu.js +112 -0
- package/dist/atoms/StatusBadge.d.ts +2 -0
- package/dist/atoms/StatusBadge.js +7 -0
- package/dist/atoms/StatusMarker.d.ts +2 -0
- package/dist/atoms/StatusMarker.js +19 -0
- package/dist/atoms/Tag.d.ts +2 -0
- package/dist/atoms/Tag.js +13 -0
- package/dist/atoms/TickBox.d.ts +2 -0
- package/dist/atoms/TickBox.js +8 -0
- package/dist/atoms/defaults.d.ts +2 -0
- package/dist/atoms/defaults.js +27 -0
- package/dist/atoms/tones.d.ts +5 -0
- package/dist/atoms/tones.js +28 -0
- package/dist/atoms/types.d.ts +178 -0
- package/dist/atoms/types.js +3 -0
- package/dist/cells/cell-format.d.ts +138 -0
- package/dist/cells/cell-format.js +16 -0
- package/dist/cells/cell-title.d.ts +17 -0
- package/dist/cells/cell-title.js +8 -0
- package/dist/cells/cell-values.d.ts +28 -0
- package/dist/cells/cell-values.js +87 -0
- package/dist/cells/index.d.ts +4 -0
- package/dist/cells/index.js +4 -0
- package/dist/cells/legacy-field.d.ts +52 -0
- package/dist/cells/legacy-field.js +164 -0
- package/dist/cells/relation-wrap.d.ts +3 -0
- package/dist/cells/relation-wrap.js +24 -0
- package/dist/cells/use-cell-format.d.ts +5 -0
- package/dist/cells/use-cell-format.js +10 -0
- package/dist/contract.d.ts +461 -0
- package/dist/contract.js +682 -0
- package/dist/display/actor.d.ts +4 -0
- package/dist/display/actor.js +26 -0
- package/dist/display/boolean.d.ts +18 -0
- package/dist/display/boolean.js +43 -0
- package/dist/display/breakdown.d.ts +15 -0
- package/dist/display/breakdown.js +32 -0
- package/dist/display/currency.d.ts +9 -0
- package/dist/display/currency.js +29 -0
- package/dist/display/date.d.ts +12 -0
- package/dist/display/date.js +26 -0
- package/dist/display/display-cores.d.ts +31 -0
- package/dist/display/display-cores.js +57 -0
- package/dist/display/entity-chip.d.ts +26 -0
- package/dist/display/entity-chip.js +9 -0
- package/dist/display/format.d.ts +66 -0
- package/dist/display/format.js +190 -0
- package/dist/display/index.d.ts +8 -0
- package/dist/display/index.js +7 -0
- package/dist/display/link.d.ts +29 -0
- package/dist/display/link.js +50 -0
- package/dist/display/location.d.ts +8 -0
- package/dist/display/location.js +22 -0
- package/dist/display/multi-value.d.ts +18 -0
- package/dist/display/multi-value.js +28 -0
- package/dist/display/name.d.ts +6 -0
- package/dist/display/name.js +14 -0
- package/dist/display/number.d.ts +11 -0
- package/dist/display/number.js +27 -0
- package/dist/display/options.d.ts +153 -0
- package/dist/display/options.js +1 -0
- package/dist/display/percent.d.ts +4 -0
- package/dist/display/percent.js +40 -0
- package/dist/display/phone.d.ts +11 -0
- package/dist/display/phone.js +45 -0
- package/dist/display/range.d.ts +6 -0
- package/dist/display/range.js +29 -0
- package/dist/display/relation.d.ts +4 -0
- package/dist/display/relation.js +29 -0
- package/dist/display/rich-text.d.ts +10 -0
- package/dist/display/rich-text.js +34 -0
- package/dist/display/select.d.ts +6 -0
- package/dist/display/select.js +38 -0
- package/dist/display/text-class.d.ts +23 -0
- package/dist/display/text-class.js +5 -0
- package/dist/display/text.d.ts +19 -0
- package/dist/display/text.js +8 -0
- package/dist/display/use-display-options.d.ts +2 -0
- package/dist/display/use-display-options.js +14 -0
- package/dist/display/user.d.ts +11 -0
- package/dist/display/user.js +10 -0
- package/dist/display/value-list.d.ts +10 -0
- package/dist/display/value-list.js +12 -0
- package/dist/display/viewer.d.ts +4 -0
- package/dist/display/viewer.js +11 -0
- package/dist/display/web-href.d.ts +8 -0
- package/dist/display/web-href.js +12 -0
- package/dist/editors/ChipsEditor.d.ts +59 -0
- package/dist/editors/ChipsEditor.js +73 -0
- package/dist/editors/DateEditor.d.ts +25 -0
- package/dist/editors/DateEditor.js +122 -0
- package/dist/editors/LocationEditor.d.ts +22 -0
- package/dist/editors/LocationEditor.js +228 -0
- package/dist/editors/NameEditor.d.ts +22 -0
- package/dist/editors/NameEditor.js +92 -0
- package/dist/editors/NumberEditor.d.ts +67 -0
- package/dist/editors/NumberEditor.js +86 -0
- package/dist/editors/RangeEditor.d.ts +22 -0
- package/dist/editors/RangeEditor.js +70 -0
- package/dist/editors/RelationEditor.d.ts +65 -0
- package/dist/editors/RelationEditor.js +64 -0
- package/dist/editors/SelectEditor.d.ts +72 -0
- package/dist/editors/SelectEditor.js +59 -0
- package/dist/editors/ValueListEditor.d.ts +38 -0
- package/dist/editors/ValueListEditor.js +217 -0
- package/dist/editors/edit-cores.d.ts +83 -0
- package/dist/editors/edit-cores.js +38 -0
- package/dist/editors/edit-session.d.ts +74 -0
- package/dist/editors/edit-session.js +35 -0
- package/dist/editors/open-values.d.ts +28 -0
- package/dist/editors/open-values.js +26 -0
- package/dist/editors/relation-source.d.ts +66 -0
- package/dist/editors/relation-source.js +102 -0
- package/dist/fields/binding.d.ts +87 -0
- package/dist/fields/binding.js +117 -0
- package/dist/fields/currency.d.ts +82 -0
- package/dist/fields/currency.js +41 -0
- package/dist/fields/denomination.d.ts +42 -0
- package/dist/fields/denomination.js +11 -0
- package/dist/fields/edit-core-types.d.ts +40 -0
- package/dist/fields/edit-core-types.js +29 -0
- package/dist/fields/format-knobs.d.ts +34 -0
- package/dist/fields/format-knobs.js +36 -0
- package/dist/fields/menus.d.ts +28 -0
- package/dist/fields/menus.js +1 -0
- package/dist/fields/money.d.ts +60 -0
- package/dist/fields/money.js +78 -0
- package/dist/fields/number-edit.d.ts +11 -0
- package/dist/fields/number-edit.js +17 -0
- package/dist/fields/prepare-write.d.ts +55 -0
- package/dist/fields/prepare-write.js +67 -0
- package/dist/fields/relation-source-types.d.ts +54 -0
- package/dist/fields/relation-source-types.js +1 -0
- package/dist/figures.d.ts +52 -0
- package/dist/figures.js +63 -0
- package/dist/filters/date-filter.d.ts +2 -0
- package/dist/filters/date-filter.js +1 -0
- package/dist/filters/filter-model.d.ts +176 -0
- package/dist/filters/filter-model.js +41 -0
- package/dist/filters/number-filter.d.ts +2 -0
- package/dist/filters/number-filter.js +1 -0
- package/dist/filters/range-filter.d.ts +2 -0
- package/dist/filters/range-filter.js +1 -0
- package/dist/filters/registry.d.ts +103 -0
- package/dist/filters/registry.js +8 -0
- package/dist/filters/relation-filter.d.ts +16 -0
- package/dist/filters/relation-filter.js +53 -0
- package/dist/filters/text-filter.d.ts +2 -0
- package/dist/filters/text-filter.js +1 -0
- package/dist/grid/chrome/GridAddColumn.d.ts +11 -0
- package/dist/grid/chrome/GridAddColumn.js +29 -0
- package/dist/grid/chrome/GridAggregateMenu.d.ts +31 -0
- package/dist/grid/chrome/GridAggregateMenu.js +27 -0
- package/dist/grid/chrome/GridCellEditors.d.ts +64 -0
- package/dist/grid/chrome/GridCellEditors.js +55 -0
- package/dist/grid/chrome/GridCellOutline.d.ts +70 -0
- package/dist/grid/chrome/GridCellOutline.js +21 -0
- package/dist/grid/chrome/GridChipsEditor.d.ts +28 -0
- package/dist/grid/chrome/GridChipsEditor.js +40 -0
- package/dist/grid/chrome/GridColumnColorSection.d.ts +11 -0
- package/dist/grid/chrome/GridColumnColorSection.js +40 -0
- package/dist/grid/chrome/GridColumnDateSection.d.ts +23 -0
- package/dist/grid/chrome/GridColumnDateSection.js +23 -0
- package/dist/grid/chrome/GridColumnDurationSection.d.ts +19 -0
- package/dist/grid/chrome/GridColumnDurationSection.js +24 -0
- package/dist/grid/chrome/GridColumnMenu.d.ts +101 -0
- package/dist/grid/chrome/GridColumnMenu.js +99 -0
- package/dist/grid/chrome/GridColumnNumberSection.d.ts +25 -0
- package/dist/grid/chrome/GridColumnNumberSection.js +27 -0
- package/dist/grid/chrome/GridColumnPercentSection.d.ts +15 -0
- package/dist/grid/chrome/GridColumnPercentSection.js +16 -0
- package/dist/grid/chrome/GridColumnSortSection.d.ts +18 -0
- package/dist/grid/chrome/GridColumnSortSection.js +16 -0
- package/dist/grid/chrome/GridDateEditor.d.ts +22 -0
- package/dist/grid/chrome/GridDateEditor.js +31 -0
- package/dist/grid/chrome/GridFlyout.d.ts +44 -0
- package/dist/grid/chrome/GridFlyout.js +80 -0
- package/dist/grid/chrome/GridFooter.d.ts +23 -0
- package/dist/grid/chrome/GridFooter.js +81 -0
- package/dist/grid/chrome/GridGroupMenu.d.ts +37 -0
- package/dist/grid/chrome/GridGroupMenu.js +57 -0
- package/dist/grid/chrome/GridHeader.d.ts +61 -0
- package/dist/grid/chrome/GridHeader.js +37 -0
- package/dist/grid/chrome/GridLongTextEditor.d.ts +36 -0
- package/dist/grid/chrome/GridLongTextEditor.js +127 -0
- package/dist/grid/chrome/GridMenuRow.d.ts +15 -0
- package/dist/grid/chrome/GridMenuRow.js +15 -0
- package/dist/grid/chrome/GridNameEditor.d.ts +19 -0
- package/dist/grid/chrome/GridNameEditor.js +36 -0
- package/dist/grid/chrome/GridNumberEditor.d.ts +35 -0
- package/dist/grid/chrome/GridNumberEditor.js +25 -0
- package/dist/grid/chrome/GridRangeEditor.d.ts +20 -0
- package/dist/grid/chrome/GridRangeEditor.js +25 -0
- package/dist/grid/chrome/GridRelationEditor.d.ts +21 -0
- package/dist/grid/chrome/GridRelationEditor.js +30 -0
- package/dist/grid/chrome/GridResizeHandle.d.ts +19 -0
- package/dist/grid/chrome/GridResizeHandle.js +19 -0
- package/dist/grid/chrome/GridRow.d.ts +25 -0
- package/dist/grid/chrome/GridRow.js +136 -0
- package/dist/grid/chrome/GridRowActions.d.ts +32 -0
- package/dist/grid/chrome/GridRowActions.js +25 -0
- package/dist/grid/chrome/GridRowCells.d.ts +4 -0
- package/dist/grid/chrome/GridRowCells.js +133 -0
- package/dist/grid/chrome/GridRowGlyph.d.ts +12 -0
- package/dist/grid/chrome/GridRowGlyph.js +13 -0
- package/dist/grid/chrome/GridSelectEditor.d.ts +18 -0
- package/dist/grid/chrome/GridSelectEditor.js +49 -0
- package/dist/grid/chrome/GridStructure.d.ts +48 -0
- package/dist/grid/chrome/GridStructure.js +45 -0
- package/dist/grid/chrome/GridTable.d.ts +4 -0
- package/dist/grid/chrome/GridTable.js +125 -0
- package/dist/grid/chrome/GridTableSurface.d.ts +15 -0
- package/dist/grid/chrome/GridTableSurface.js +6 -0
- package/dist/grid/chrome/GridTextEditor.d.ts +11 -0
- package/dist/grid/chrome/GridTextEditor.js +40 -0
- package/dist/grid/chrome/GridValueListEditor.d.ts +18 -0
- package/dist/grid/chrome/GridValueListEditor.js +36 -0
- package/dist/grid/chrome/StuckMarker.d.ts +16 -0
- package/dist/grid/chrome/StuckMarker.js +34 -0
- package/dist/grid/chrome/cell-clipboard.d.ts +9 -0
- package/dist/grid/chrome/cell-clipboard.js +28 -0
- package/dist/grid/chrome/cells.d.ts +21 -0
- package/dist/grid/chrome/cells.js +20 -0
- package/dist/grid/chrome/checks.d.ts +35 -0
- package/dist/grid/chrome/checks.js +22 -0
- package/dist/grid/chrome/column-glyph.d.ts +14 -0
- package/dist/grid/chrome/column-glyph.js +44 -0
- package/dist/grid/chrome/editors.d.ts +9 -0
- package/dist/grid/chrome/editors.js +10 -0
- package/dist/grid/chrome/grid-cell-classes.d.ts +59 -0
- package/dist/grid/chrome/grid-cell-classes.js +30 -0
- package/dist/grid/chrome/grid-menu-search.d.ts +7 -0
- package/dist/grid/chrome/grid-menu-search.js +7 -0
- package/dist/grid/chrome/grid-row-props.d.ts +131 -0
- package/dist/grid/chrome/grid-row-props.js +1 -0
- package/dist/grid/chrome/grid-styles.d.ts +37 -0
- package/dist/grid/chrome/grid-styles.js +8 -0
- package/dist/grid/chrome/grid-table-props.d.ts +173 -0
- package/dist/grid/chrome/grid-table-props.js +1 -0
- package/dist/grid/chrome/useGridBatchApi.d.ts +34 -0
- package/dist/grid/chrome/useGridBatchApi.js +35 -0
- package/dist/grid/chrome/useGridColumnLayout.d.ts +30 -0
- package/dist/grid/chrome/useGridColumnLayout.js +206 -0
- package/dist/grid/chrome/useGridHeaderDrag.d.ts +20 -0
- package/dist/grid/chrome/useGridHeaderDrag.js +37 -0
- package/dist/grid/chrome/useGridKeyboard.d.ts +47 -0
- package/dist/grid/chrome/useGridKeyboard.js +274 -0
- package/dist/grid/chrome/useGridPendingReconciliation.d.ts +12 -0
- package/dist/grid/chrome/useGridPendingReconciliation.js +32 -0
- package/dist/grid/chrome/useGridRailReveal.d.ts +57 -0
- package/dist/grid/chrome/useGridRailReveal.js +67 -0
- package/dist/grid/chrome/useGridRangeActions.d.ts +49 -0
- package/dist/grid/chrome/useGridRangeActions.js +188 -0
- package/dist/grid/chrome/useGridRangeGestures.d.ts +32 -0
- package/dist/grid/chrome/useGridRangeGestures.js +190 -0
- package/dist/grid/chrome/useGridRowContextMenu.d.ts +35 -0
- package/dist/grid/chrome/useGridRowContextMenu.js +127 -0
- package/dist/grid/chrome/useGridScaleStyles.d.ts +1 -0
- package/dist/grid/chrome/useGridScaleStyles.js +29 -0
- package/dist/grid/chrome/useGridScrollSync.d.ts +38 -0
- package/dist/grid/chrome/useGridScrollSync.js +176 -0
- package/dist/grid/chrome/useGridTableInteractionModel.d.ts +55 -0
- package/dist/grid/chrome/useGridTableInteractionModel.js +197 -0
- package/dist/grid/chrome/useGridTableSelection.d.ts +29 -0
- package/dist/grid/chrome/useGridTableSelection.js +55 -0
- package/dist/grid/chrome/useHeaderDragReorder.d.ts +21 -0
- package/dist/grid/chrome/useHeaderDragReorder.js +216 -0
- package/dist/grid/core/clipboard-model.d.ts +81 -0
- package/dist/grid/core/clipboard-model.js +291 -0
- package/dist/grid/core/column-values.d.ts +27 -0
- package/dist/grid/core/column-values.js +76 -0
- package/dist/grid/core/commit-model.d.ts +34 -0
- package/dist/grid/core/commit-model.js +3 -0
- package/dist/grid/core/coordinates.d.ts +48 -0
- package/dist/grid/core/coordinates.js +27 -0
- package/dist/grid/core/edit-values.d.ts +9 -0
- package/dist/grid/core/edit-values.js +1 -0
- package/dist/grid/core/editing-controller.d.ts +59 -0
- package/dist/grid/core/editing-controller.js +240 -0
- package/dist/grid/core/editing-model.d.ts +78 -0
- package/dist/grid/core/editing-model.js +136 -0
- package/dist/grid/core/grid-scale.d.ts +14 -0
- package/dist/grid/core/grid-scale.js +8 -0
- package/dist/grid/core/nav.d.ts +94 -0
- package/dist/grid/core/nav.js +92 -0
- package/dist/grid/core/pending-reconciliation.d.ts +50 -0
- package/dist/grid/core/pending-reconciliation.js +49 -0
- package/dist/grid/core/range-model.d.ts +25 -0
- package/dist/grid/core/range-model.js +59 -0
- package/dist/grid/core/spreadsheet-operations.d.ts +85 -0
- package/dist/grid/core/spreadsheet-operations.js +253 -0
- package/dist/grid/core/useGridEditing.d.ts +43 -0
- package/dist/grid/core/useGridEditing.js +90 -0
- package/dist/grid/core/useGridRange.d.ts +20 -0
- package/dist/grid/core/useGridRange.js +24 -0
- package/dist/grid/core/value-equality.d.ts +32 -0
- package/dist/grid/core/value-equality.js +34 -0
- package/dist/grid/index.d.ts +18 -0
- package/dist/grid/index.js +5 -0
- package/dist/grid/useGridTablePrefs.d.ts +50 -0
- package/dist/grid/useGridTablePrefs.js +101 -0
- package/dist/grouping/sort-groups.d.ts +18 -0
- package/dist/grouping/sort-groups.js +33 -0
- package/dist/grouping/types.d.ts +10 -0
- package/dist/grouping/types.js +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +28 -0
- package/dist/internal/chip.d.ts +4 -0
- package/dist/internal/chip.js +3 -0
- package/dist/internal/cx.d.ts +3 -0
- package/dist/internal/cx.js +3 -0
- package/dist/internal/viewport.d.ts +5 -0
- package/dist/internal/viewport.js +29 -0
- package/dist/model/aggregates.d.ts +59 -0
- package/dist/model/aggregates.js +186 -0
- package/dist/model/card-density.d.ts +8 -0
- package/dist/model/card-density.js +10 -0
- package/dist/model/card-layout.d.ts +85 -0
- package/dist/model/card-layout.js +90 -0
- package/dist/model/column-capabilities.d.ts +162 -0
- package/dist/model/column-capabilities.js +233 -0
- package/dist/model/column-filters.d.ts +106 -0
- package/dist/model/column-filters.js +321 -0
- package/dist/model/column-format.d.ts +103 -0
- package/dist/model/column-format.js +1 -0
- package/dist/model/column-from.d.ts +28 -0
- package/dist/model/column-from.js +160 -0
- package/dist/model/column-inspect.d.ts +18 -0
- package/dist/model/column-inspect.js +6 -0
- package/dist/model/column-knobs.d.ts +20 -0
- package/dist/model/column-knobs.js +16 -0
- package/dist/model/column-money.d.ts +13 -0
- package/dist/model/column-money.js +27 -0
- package/dist/model/column-order.d.ts +36 -0
- package/dist/model/column-order.js +68 -0
- package/dist/model/column-schema.d.ts +335 -0
- package/dist/model/column-schema.js +1 -0
- package/dist/model/column-sort.d.ts +17 -0
- package/dist/model/column-sort.js +11 -0
- package/dist/model/column-state.d.ts +77 -0
- package/dist/model/column-state.js +95 -0
- package/dist/model/column-types.d.ts +109 -0
- package/dist/model/column-types.js +50 -0
- package/dist/model/column-warnings.d.ts +44 -0
- package/dist/model/column-warnings.js +24 -0
- package/dist/model/density.d.ts +3 -0
- package/dist/model/density.js +13 -0
- package/dist/model/field-type-of.d.ts +21 -0
- package/dist/model/field-type-of.js +11 -0
- package/dist/model/filter-capabilities.d.ts +1 -0
- package/dist/model/filter-capabilities.js +1 -0
- package/dist/model/index.d.ts +38 -0
- package/dist/model/index.js +20 -0
- package/dist/model/part-rows.d.ts +28 -0
- package/dist/model/part-rows.js +40 -0
- package/dist/model/preferences.d.ts +155 -0
- package/dist/model/preferences.js +84 -0
- package/dist/model/prefs-buckets.d.ts +173 -0
- package/dist/model/prefs-buckets.js +71 -0
- package/dist/model/relation-filters.d.ts +45 -0
- package/dist/model/relation-filters.js +78 -0
- package/dist/model/render-count.d.ts +2 -0
- package/dist/model/render-count.js +24 -0
- package/dist/model/row-icon.d.ts +23 -0
- package/dist/model/row-icon.js +5 -0
- package/dist/model/view-rules.d.ts +73 -0
- package/dist/model/view-rules.js +216 -0
- package/dist/provider/ViewsProvider.d.ts +26 -0
- package/dist/provider/ViewsProvider.js +16 -0
- package/dist/provider/components.d.ts +230 -0
- package/dist/provider/components.js +3 -0
- package/dist/provider/context.d.ts +20 -0
- package/dist/provider/context.js +10 -0
- package/dist/provider/icons.d.ts +6 -0
- package/dist/provider/icons.js +1 -0
- package/dist/provider/menu-groups.d.ts +8 -0
- package/dist/provider/menu-groups.js +38 -0
- package/dist/provider/ports.d.ts +57 -0
- package/dist/provider/ports.js +9 -0
- package/dist/react.d.ts +9 -0
- package/dist/react.js +4 -0
- package/dist/selection/SelectCheckbox.d.ts +17 -0
- package/dist/selection/SelectCheckbox.js +11 -0
- package/dist/selection/index.d.ts +7 -0
- package/dist/selection/index.js +6 -0
- package/dist/selection/model.d.ts +55 -0
- package/dist/selection/model.js +86 -0
- package/dist/selection/row-click.d.ts +35 -0
- package/dist/selection/row-click.js +20 -0
- package/dist/selection/types.d.ts +17 -0
- package/dist/selection/types.js +1 -0
- package/dist/selection/useCheckDragSelect.d.ts +61 -0
- package/dist/selection/useCheckDragSelect.js +165 -0
- package/dist/selection/useListSelection.d.ts +39 -0
- package/dist/selection/useListSelection.js +48 -0
- package/dist/selection/useListSelectionShortcuts.d.ts +6 -0
- package/dist/selection/useListSelectionShortcuts.js +14 -0
- package/dist/selection/useRestIntent.d.ts +18 -0
- package/dist/selection/useRestIntent.js +35 -0
- package/docs/contract.md +525 -0
- package/docs/getting-started.md +250 -0
- package/docs/guides/atoms.md +245 -0
- package/docs/guides/cells.md +302 -0
- package/docs/guides/columns.md +412 -0
- package/docs/guides/display.md +203 -0
- package/docs/guides/editors.md +404 -0
- package/docs/guides/ports.md +246 -0
- package/docs/guides/selection.md +270 -0
- package/docs/guides/the-grid.md +677 -0
- package/docs/guides/the-provider.md +446 -0
- package/docs/index.md +50 -0
- package/docs/install.md +67 -0
- package/docs/reference/cells.md +28 -0
- package/docs/reference/display.md +42 -0
- package/docs/reference/editors-chips.md +6 -0
- package/docs/reference/editors-date.md +6 -0
- package/docs/reference/editors-location.md +10 -0
- package/docs/reference/editors-name.md +6 -0
- package/docs/reference/editors-number.md +11 -0
- package/docs/reference/editors-open-values.md +9 -0
- package/docs/reference/editors-range.md +6 -0
- package/docs/reference/editors-relation.md +9 -0
- package/docs/reference/editors-select.md +8 -0
- package/docs/reference/editors-session.md +9 -0
- package/docs/reference/editors-value-list.md +6 -0
- package/docs/reference/editors.md +5 -0
- package/docs/reference/grid.md +39 -0
- package/docs/reference/react.md +86 -0
- package/docs/reference/selection.md +33 -0
- package/docs/reference/views.md +601 -0
- package/docs/reshaping.md +19 -0
- package/package.json +118 -3
- package/skills/views/SKILL.md +102 -0
package/README.md
CHANGED
|
@@ -1,3 +1,100 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ViewKit views
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The grid, its cells, the field display and the editors over typed fields: a headless engine every app installs and never edits, and a default rendering written to skin discipline — markup, classes and slots only, states as `data-*` attributes, primitives handed in by the app, geometry through `--vk-*` variables. By Sheaf.
|
|
4
|
+
|
|
5
|
+
`@viewkitjs/fields` says what a value is; this package draws it and edits it. It ships no UI library of its own: your app hands in its button, popover, menu, command list and calendar through a components map, its icons by meaning, its toast, clipboard and per-device store as ports, and its wording as messages, so every view wears your app's look.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add @viewkitjs/views @viewkitjs/fields zod
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
ESM only. Node 20 or later. `react` and `react-dom` 19 and `@viewkitjs/fields` are peer dependencies. Add one `@source` line so Tailwind sees the package, and map its colours onto your theme: [docs/install.md](./docs/install.md).
|
|
14
|
+
|
|
15
|
+
## Getting started
|
|
16
|
+
|
|
17
|
+
Fields bound to your rows become the grid's columns. This block runs as written; [the getting-started page](./docs/getting-started.md) carries on from it to your primitives, the provider and the grid on screen.
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import assert from "node:assert/strict";
|
|
21
|
+
import { defineFields } from "@viewkitjs/fields";
|
|
22
|
+
import { bindFields, columnFrom, columnWritable } from "@viewkitjs/views";
|
|
23
|
+
|
|
24
|
+
const DEAL_FIELDS = defineFields({
|
|
25
|
+
entity: "deal",
|
|
26
|
+
identity: "title",
|
|
27
|
+
fields: {
|
|
28
|
+
title: { type: "text", label: "Title", required: true },
|
|
29
|
+
value: { type: "currency", label: "Value", code: { fixed: "EUR" } },
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
type Deal = { id: string; title: string; value: number };
|
|
34
|
+
|
|
35
|
+
// How each field reads on your row, and how an edit maps onto your request's body.
|
|
36
|
+
const DEAL_BINDINGS = bindFields<Deal, typeof DEAL_FIELDS>(DEAL_FIELDS, {
|
|
37
|
+
title: { read: (deal) => deal.title, write: (_deal, commit) => ({ body: { title: commit } }) },
|
|
38
|
+
value: { read: (deal) => deal.value },
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// A column is what the grid draws: its type, format and edits come from the field and the binding.
|
|
42
|
+
const title = columnFrom(DEAL_BINDINGS.title, { id: "title", width: 240, editable: true });
|
|
43
|
+
const value = columnFrom(DEAL_BINDINGS.value, { id: "value", width: 120 });
|
|
44
|
+
|
|
45
|
+
assert.equal(title.type, "title");
|
|
46
|
+
assert.equal(columnWritable(title), true);
|
|
47
|
+
assert.equal(columnWritable(value), false); // no write: read-only on every surface
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Then mount `ViewsProvider` once with your primitives and draw `GridTable` from `@viewkitjs/views/grid` with the rows, the columns, each row's id and what opening a row does.
|
|
51
|
+
|
|
52
|
+
## Documentation
|
|
53
|
+
|
|
54
|
+
The package ships its documentation in `docs/`, starting at [docs/index.md](./docs/index.md). Every example in it is compiled and run against the packed package before each release.
|
|
55
|
+
|
|
56
|
+
- [Getting started](./docs/getting-started.md): install, fields bound to your rows, columns, your primitives, the provider and the grid.
|
|
57
|
+
- [Install](./docs/install.md): the Tailwind line and the colour block.
|
|
58
|
+
|
|
59
|
+
Guides:
|
|
60
|
+
|
|
61
|
+
- [The provider](./docs/guides/the-provider.md): mounting it once, your adapter over your own primitives, icons, messages and presentation.
|
|
62
|
+
- [Ports](./docs/guides/ports.md): your toast, haptics, clipboard, per-device store and confirm dialog.
|
|
63
|
+
- [Atoms](./docs/guides/atoms.md): the small pieces every view is built from, and swapping them for your own.
|
|
64
|
+
- [The display](./docs/guides/display.md): one renderer per field type, and the string formatters.
|
|
65
|
+
- [Editors and the edit session](./docs/guides/editors.md): one editor per field type, what an editor owns and what its host owns.
|
|
66
|
+
- [Columns](./docs/guides/columns.md): a field bound to your row, the column built from it, and what may be done to it.
|
|
67
|
+
- [Cells](./docs/guides/cells.md): a column's value drawn in a cell, outside the grid too.
|
|
68
|
+
- [Selection](./docs/guides/selection.md): a list's selection, its checkbox, drag-select and the row-click rules.
|
|
69
|
+
- [The grid](./docs/guides/the-grid.md): grouping, sorting, writes, preferences, figures and the editing rules.
|
|
70
|
+
- [The rendering contract](./docs/contract.md): every public name and what each door holds; [reshaping a view](./docs/reshaping.md): the cheapest change first.
|
|
71
|
+
|
|
72
|
+
References, one per door, each naming every export: [`@viewkitjs/views`](./docs/reference/views.md), [`/react`](./docs/reference/react.md), [`/display`](./docs/reference/display.md), [`/editors`](./docs/reference/editors.md), [`/editors/select`](./docs/reference/editors-select.md), [`/editors/relation`](./docs/reference/editors-relation.md), [`/editors/number`](./docs/reference/editors-number.md), [`/editors/range`](./docs/reference/editors-range.md), [`/editors/name`](./docs/reference/editors-name.md), [`/editors/location`](./docs/reference/editors-location.md), [`/editors/value-list`](./docs/reference/editors-value-list.md), [`/editors/date`](./docs/reference/editors-date.md), [`/editors/chips`](./docs/reference/editors-chips.md), [`/editors/session`](./docs/reference/editors-session.md), [`/editors/open-values`](./docs/reference/editors-open-values.md), [`/cells`](./docs/reference/cells.md), [`/selection`](./docs/reference/selection.md), [`/grid`](./docs/reference/grid.md).
|
|
73
|
+
|
|
74
|
+
## Doors
|
|
75
|
+
|
|
76
|
+
| Import | Holds |
|
|
77
|
+
| ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------- |
|
|
78
|
+
| `@viewkitjs/views` | the rendering contract (slots, states, tokens, the components map, atom and icon names, ports, message keys and their English resolver) and the model: columns, preferences, filters, figures, groups, bindings and money. No React at runtime |
|
|
79
|
+
| `@viewkitjs/views/react` | `ViewsProvider`, `useViews`, the default atoms, and the types an adapter implements |
|
|
80
|
+
| `@viewkitjs/views/display` | the field display: one renderer per storage type, the string formatters, the viewer |
|
|
81
|
+
| `@viewkitjs/views/editors` | the edit registry: which editor each type opens |
|
|
82
|
+
| `@viewkitjs/views/editors/<name>` | one editor each: `select`, `relation`, `number`, `range`, `name`, `location`, `value-list`, `date`, `chips` |
|
|
83
|
+
| `@viewkitjs/views/editors/session`, `/editors/open-values` | the anchored edit session every host shares, and an open field's values carried to its editors |
|
|
84
|
+
| `@viewkitjs/views/cells` | a column's typed cell, and its column-shaped string formatters |
|
|
85
|
+
| `@viewkitjs/views/selection` | a list's selection: the model, the hook, the row checkbox, drag-select and the row-click rules |
|
|
86
|
+
| `@viewkitjs/views/grid` | the grid: the table, its props, its preferences, and the helpers a host shares with it |
|
|
87
|
+
|
|
88
|
+
Eighteen doors; there are no other subpaths.
|
|
89
|
+
|
|
90
|
+
## For coding agents
|
|
91
|
+
|
|
92
|
+
The package ships a usage skill at `skills/views/SKILL.md`. Its example is compiled against the published artifact on every release.
|
|
93
|
+
|
|
94
|
+
## Status
|
|
95
|
+
|
|
96
|
+
`0.x`: the API may change between minor versions.
|
|
97
|
+
|
|
98
|
+
## Licence
|
|
99
|
+
|
|
100
|
+
Proprietary. See [LICENSE.md](./LICENSE.md).
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useRef, useState } from "react";
|
|
4
|
+
import { useViews } from "../provider/context.js";
|
|
5
|
+
export function DefaultCommandMenu({ trigger, items, align = "start" }) {
|
|
6
|
+
const { Menu } = useViews().components;
|
|
7
|
+
const [open, setOpen] = useState(false);
|
|
8
|
+
const anchor = useRef(null);
|
|
9
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchor, "data-slot": "vk-command-menu", className: "inline-flex min-w-0", onClick: (event) => {
|
|
10
|
+
event.stopPropagation();
|
|
11
|
+
setOpen((current) => !current);
|
|
12
|
+
}, children: trigger }), _jsx(Menu, { open: open, onOpenChange: (next) => setOpen(next), anchor: anchor, align: align, items: items.map((item, index) => ({
|
|
13
|
+
key: String(index),
|
|
14
|
+
label: item.label,
|
|
15
|
+
icon: item.icon,
|
|
16
|
+
onSelect: item.onClick,
|
|
17
|
+
destructive: item.destructive,
|
|
18
|
+
disabled: item.disabled,
|
|
19
|
+
})) })] }));
|
|
20
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cx } from "../internal/cx.js";
|
|
4
|
+
export function DefaultList({ children, className }) {
|
|
5
|
+
return (_jsx("div", { "data-slot": "vk-list", className: cx("p-1.5", className), children: children }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
4
|
+
import { useViews } from "../provider/context.js";
|
|
5
|
+
export function DefaultLoadMore({ onReveal, label }) {
|
|
6
|
+
const { Loading } = useViews().atoms;
|
|
7
|
+
const ref = useRef(null);
|
|
8
|
+
const onRevealRef = useRef(onReveal);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
onRevealRef.current = onReveal;
|
|
11
|
+
});
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const element = ref.current;
|
|
14
|
+
if (!element || typeof IntersectionObserver === "undefined")
|
|
15
|
+
return;
|
|
16
|
+
const observer = new IntersectionObserver((entries) => {
|
|
17
|
+
for (const entry of entries)
|
|
18
|
+
if (entry.isIntersecting)
|
|
19
|
+
onRevealRef.current();
|
|
20
|
+
}, { rootMargin: "600px 0px" });
|
|
21
|
+
observer.observe(element);
|
|
22
|
+
return () => observer.disconnect();
|
|
23
|
+
}, []);
|
|
24
|
+
return (_jsx("div", { ref: ref, "data-slot": "vk-load-more", children: label != null ? (_jsx("div", { className: "py-6 text-center text-xs text-(color:--vk-fg-subtlest)", children: label })) : (_jsx(Loading, { placement: "footer", label: "Loading more rows" })) }));
|
|
25
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cx } from "../internal/cx.js";
|
|
4
|
+
export function DefaultLoading({ placement, label }) {
|
|
5
|
+
const body = placement === "body";
|
|
6
|
+
return (_jsx("div", { "data-slot": "vk-loading", className: cx("flex w-full items-center justify-center", body ? "min-h-40 py-10" : "min-h-12 py-6"), children: _jsx("span", { role: "status", "aria-label": label, className: cx("animate-spin rounded-full border-2 border-(color:--vk-border) border-t-(color:--vk-brand)", body ? "size-7" : "size-5") }) }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { CHIP_BASE } from "../internal/chip.js";
|
|
4
|
+
export function DefaultRelationLink({ relation, children }) {
|
|
5
|
+
return (_jsx("span", { "data-slot": "vk-relation-link", className: CHIP_BASE, title: relation.label, children: children }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ViewsRowContentProps, ViewsRowProps } from "./types.js";
|
|
2
|
+
export declare function DefaultRowContent({ label, description, leading, leadingLane, trailing, detail, chosen, chosenTint, tone, size, wrap, className, }: ViewsRowContentProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function DefaultRow({ onClick, onMouseDown, disabled, interactive, opens, open, title, role, "aria-selected": ariaSelected, className, ...content }: ViewsRowProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cx } from "../internal/cx.js";
|
|
4
|
+
import { useViews } from "../provider/context.js";
|
|
5
|
+
const LABEL_SIZE = { compact: "text-[13px]", regular: "text-sm" };
|
|
6
|
+
function labelClass(label, wrap, size) {
|
|
7
|
+
const layout = wrap
|
|
8
|
+
? "block min-w-0 break-all"
|
|
9
|
+
: typeof label === "string" || typeof label === "number"
|
|
10
|
+
? "block truncate"
|
|
11
|
+
: "flex min-w-0 items-center";
|
|
12
|
+
return cx(layout, LABEL_SIZE[size]);
|
|
13
|
+
}
|
|
14
|
+
export function DefaultRowContent({ label, description, leading, leadingLane, trailing, detail, chosen, chosenTint = true, tone = "default", size = "regular", wrap, className, }) {
|
|
15
|
+
const Check = useViews().icons.check;
|
|
16
|
+
const tinted = Boolean(chosen && chosenTint);
|
|
17
|
+
return (_jsxs("span", { "data-slot": "vk-row-content", "data-chosen": chosen || undefined, "data-muted": (tone === "muted" && !tinted) || undefined, className: cx("flex min-w-0 flex-1 items-center gap-2.5", tinted
|
|
18
|
+
? "font-medium text-(color:--vk-fg-selected)"
|
|
19
|
+
: tone === "muted"
|
|
20
|
+
? "text-(color:--vk-fg-subtle) group-hover/row:text-(color:--vk-fg)"
|
|
21
|
+
: null, className), children: [leading || leadingLane ? (_jsx("span", { className: "flex w-3.5 shrink-0 items-center justify-center", children: leading })) : null, _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: labelClass(label, wrap, size), children: label }), description ? (_jsx("span", { className: "block truncate text-xs text-(color:--vk-fg-subtle)", children: description })) : null] }), detail != null ? (_jsx("span", { className: cx("ml-3.5 shrink-0 truncate text-xs font-normal", chosen ? "text-(color:--vk-fg-brand)" : "text-(color:--vk-fg-subtle)"), children: detail })) : null, trailing, chosen && detail == null ? (_jsx("span", { className: "ml-auto flex size-4 shrink-0 items-center justify-center text-(color:--vk-fg-selected)", children: _jsx(Check, { className: "size-3.5" }) })) : null] }));
|
|
22
|
+
}
|
|
23
|
+
export function DefaultRow({ onClick, onMouseDown, disabled, interactive = true, opens, open, title, role, "aria-selected": ariaSelected, className, ...content }) {
|
|
24
|
+
const frame = "flex w-full items-center rounded-md px-2 py-1.5 text-left";
|
|
25
|
+
const body = _jsx(DefaultRowContent, { ...content });
|
|
26
|
+
if (!interactive) {
|
|
27
|
+
return (_jsx("div", { "data-slot": "vk-row", title: title, className: cx(frame, className), children: body }));
|
|
28
|
+
}
|
|
29
|
+
return (_jsx("button", { type: "button", "data-slot": "vk-row", "data-disabled": disabled || undefined, "data-open": open || undefined, "aria-haspopup": opens ? "dialog" : undefined, "aria-expanded": opens ? Boolean(open) : undefined, disabled: disabled, onClick: onClick, onMouseDown: onMouseDown, title: title, role: role, "aria-selected": role ? ariaSelected : undefined, className: cx(frame, "group/row transition-colors hover:bg-(color:--vk-hovered) data-open:bg-(color:--vk-pressed) disabled:pointer-events-none disabled:opacity-50", className), children: body }));
|
|
30
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useRef, useState } from "react";
|
|
4
|
+
import { useViews } from "../provider/context.js";
|
|
5
|
+
const OPEN_GRACE_MS = 300;
|
|
6
|
+
function inGraceSince(openedAt) {
|
|
7
|
+
return performance.now() - openedAt < OPEN_GRACE_MS;
|
|
8
|
+
}
|
|
9
|
+
function toMenuItems(entries) {
|
|
10
|
+
const out = [];
|
|
11
|
+
let ruled = false;
|
|
12
|
+
for (const entry of entries) {
|
|
13
|
+
if (entry.separator) {
|
|
14
|
+
ruled = out.length > 0;
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
out.push({ ...entry.item, key: entry.key, separatorBefore: ruled || undefined });
|
|
18
|
+
ruled = false;
|
|
19
|
+
}
|
|
20
|
+
return out;
|
|
21
|
+
}
|
|
22
|
+
function hostEntry(item, index) {
|
|
23
|
+
if (item.separator)
|
|
24
|
+
return { separator: true };
|
|
25
|
+
return {
|
|
26
|
+
key: `item-${index}`,
|
|
27
|
+
item: {
|
|
28
|
+
label: item.label,
|
|
29
|
+
icon: item.icon,
|
|
30
|
+
onSelect: item.onClick,
|
|
31
|
+
disabled: item.disabled,
|
|
32
|
+
destructive: item.destructive,
|
|
33
|
+
shortcut: item.shortcut,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export function DefaultRowMenu({ children, rowId, items, openHref, onDelete, deleteLabel }) {
|
|
38
|
+
const { components, icons, messages, ports } = useViews();
|
|
39
|
+
const { Menu } = components;
|
|
40
|
+
const [point, setPoint] = useState(null);
|
|
41
|
+
const openedAt = useRef(0);
|
|
42
|
+
const lastPress = useRef(undefined);
|
|
43
|
+
const wrapper = useRef(null);
|
|
44
|
+
const inGrace = () => inGraceSince(openedAt.current);
|
|
45
|
+
const guarded = (run) => () => {
|
|
46
|
+
if (!inGrace())
|
|
47
|
+
run();
|
|
48
|
+
};
|
|
49
|
+
const Open = icons.open;
|
|
50
|
+
const Delete = icons.delete;
|
|
51
|
+
const entries = [];
|
|
52
|
+
if (openHref) {
|
|
53
|
+
entries.push({
|
|
54
|
+
key: "open",
|
|
55
|
+
item: {
|
|
56
|
+
label: messages({ key: "views.menus.row-open" }),
|
|
57
|
+
icon: _jsx(Open, { className: "h-4 w-4" }),
|
|
58
|
+
onSelect: () => window.open(openHref, "_blank", "noopener,noreferrer"),
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
entries.push({ separator: true }, ...items.map(hostEntry), { separator: true });
|
|
63
|
+
if (onDelete) {
|
|
64
|
+
entries.push({
|
|
65
|
+
key: "delete",
|
|
66
|
+
item: {
|
|
67
|
+
label: messages({ key: "views.menus.row-delete" }),
|
|
68
|
+
icon: _jsx(Delete, { className: "h-4 w-4" }),
|
|
69
|
+
destructive: true,
|
|
70
|
+
onSelect: () => {
|
|
71
|
+
const request = {
|
|
72
|
+
message: messages({ key: "views.menus.row-delete-confirm" }),
|
|
73
|
+
confirmLabel: messages({ key: "views.menus.row-delete" }),
|
|
74
|
+
...(deleteLabel !== undefined && { subject: deleteLabel }),
|
|
75
|
+
destructive: true,
|
|
76
|
+
};
|
|
77
|
+
void new Promise((resolve) => resolve(ports.confirm(request)))
|
|
78
|
+
.catch(() => false)
|
|
79
|
+
.then((yes) => {
|
|
80
|
+
if (!yes)
|
|
81
|
+
return;
|
|
82
|
+
return new Promise((resolve) => resolve(onDelete(rowId))).catch(() => ports.toast.error(messages({ key: "views.menus.row-delete-failed" })));
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
const rows = toMenuItems(entries).map((row) => (row.onSelect ? { ...row, onSelect: guarded(row.onSelect) } : row));
|
|
89
|
+
if (point && rows.length === 0)
|
|
90
|
+
setPoint(null);
|
|
91
|
+
return (_jsxs("div", { ref: wrapper, "data-slot": "vk-row-menu", onPointerDownCapture: (event) => {
|
|
92
|
+
lastPress.current = event.pointerType;
|
|
93
|
+
}, onContextMenu: (event) => {
|
|
94
|
+
const fromMore = event.target.closest?.('[data-slot="vk-grid-row-more"]');
|
|
95
|
+
const touched = lastPress.current === "touch";
|
|
96
|
+
lastPress.current = undefined;
|
|
97
|
+
if (touched && !fromMore)
|
|
98
|
+
return;
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
openedAt.current = performance.now();
|
|
101
|
+
setPoint({ x: event.clientX, y: event.clientY });
|
|
102
|
+
}, onPointerUpCapture: (event) => {
|
|
103
|
+
if (!point || !inGrace())
|
|
104
|
+
return;
|
|
105
|
+
if (wrapper.current?.contains(event.target))
|
|
106
|
+
return;
|
|
107
|
+
event.stopPropagation();
|
|
108
|
+
}, children: [children, _jsx(Menu, { open: point !== null && rows.length > 0, onOpenChange: (open) => {
|
|
109
|
+
if (!open)
|
|
110
|
+
setPoint(null);
|
|
111
|
+
}, anchor: point, items: rows })] }));
|
|
112
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cx } from "../internal/cx.js";
|
|
4
|
+
import { STATUS_DOT, STATUS_TEXT } from "./tones.js";
|
|
5
|
+
export function DefaultStatusBadge({ slot, label, leading, title, size = "compact", className }) {
|
|
6
|
+
return (_jsxs("span", { "data-slot": "vk-status", "data-status": slot, title: title, className: cx("inline-flex min-w-0 items-center gap-1.5 font-medium", size === "compact" ? "text-[11px]" : "text-xs", STATUS_TEXT[slot], className), children: [leading ?? _jsx("span", { "aria-hidden": "true", className: cx("size-1.5 shrink-0 rounded-full", STATUS_DOT[slot]) }), _jsx("span", { className: "truncate", children: label })] }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useRef, useState } from "react";
|
|
4
|
+
import { useViews } from "../provider/context.js";
|
|
5
|
+
export function DefaultStatusMarker({ slot = "warning", label, title, reason, emptyReason, onResolve, resolveLabel, }) {
|
|
6
|
+
const { atoms, components, icons, messages } = useViews();
|
|
7
|
+
const [open, setOpen] = useState(false);
|
|
8
|
+
const anchor = useRef(null);
|
|
9
|
+
const { Popover, Button } = components;
|
|
10
|
+
const Badge = atoms.StatusBadge;
|
|
11
|
+
const Warning = icons.warning;
|
|
12
|
+
return (_jsxs(_Fragment, { children: [_jsx("button", { ref: anchor, type: "button", tabIndex: -1, "aria-label": title, "data-slot": "vk-marker", className: "inline-flex max-w-full", onClick: (event) => {
|
|
13
|
+
event.stopPropagation();
|
|
14
|
+
setOpen((current) => !current);
|
|
15
|
+
}, children: _jsx(Badge, { slot: slot, label: label, leading: _jsx(Warning, { className: "size-3" }) }) }), _jsx(Popover, { open: open, onOpenChange: (next) => setOpen(next), anchor: anchor, side: "bottom", align: "start", className: "w-64", onPanelClick: (event) => event.stopPropagation(), onOutsidePress: (event) => anchor.current?.contains(event.target) ? false : undefined, children: _jsxs("div", { className: "flex flex-col gap-2 text-sm", children: [_jsx("span", { className: "text-xs font-medium text-(color:--vk-fg-subtle)", children: title }), _jsx("span", { children: reason || emptyReason || messages({ key: "views.editors.marker-no-reason" }) }), onResolve ? (_jsx(Button, { size: "sm", variant: "outline", onClick: () => {
|
|
16
|
+
onResolve();
|
|
17
|
+
setOpen(false);
|
|
18
|
+
}, children: resolveLabel ?? messages({ key: "views.editors.marker-resolve" }) })) : null] }) })] }));
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cx } from "../internal/cx.js";
|
|
4
|
+
import { useViews } from "../provider/context.js";
|
|
5
|
+
import { TAG_TONE } from "./tones.js";
|
|
6
|
+
export function DefaultTag({ label, color, leading, onRemove, removeLabel, className }) {
|
|
7
|
+
const { icons, messages } = useViews();
|
|
8
|
+
const Close = icons.close;
|
|
9
|
+
return (_jsxs("span", { "data-slot": "vk-tag", className: cx("inline-flex h-5 max-w-full items-center gap-1 rounded-md px-2 text-xs font-medium", onRemove ? "pr-1" : null, TAG_TONE[color], className), children: [leading ? _jsx("span", { "aria-hidden": "true", className: "flex shrink-0 items-center", children: leading }) : null, _jsx("span", { className: "truncate", children: label }), onRemove ? (_jsx("button", { type: "button", "aria-label": removeLabel ?? messages({ key: "views.editors.tag-remove", values: { label } }), className: "grid size-3.5 shrink-0 place-content-center rounded-full hover:bg-(color:--vk-hovered)", onClick: (event) => {
|
|
10
|
+
event.stopPropagation();
|
|
11
|
+
onRemove();
|
|
12
|
+
}, children: _jsx(Close, { className: "size-2.5" }) })) : null] }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cx } from "../internal/cx.js";
|
|
4
|
+
import { useViews } from "../provider/context.js";
|
|
5
|
+
export function DefaultTickBox({ checked, className }) {
|
|
6
|
+
const Check = useViews().icons.check;
|
|
7
|
+
return (_jsx("span", { "aria-hidden": "true", "data-slot": "vk-tick", "data-checked": checked || undefined, className: cx("grid size-4 shrink-0 place-content-center rounded-sm border transition-colors", checked ? "border-(color:--vk-brand) bg-(color:--vk-brand) text-(color:--vk-fg-on-brand)" : "border-(color:--vk-border)", className), children: checked ? _jsx(Check, { className: "size-3" }) : null }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DefaultCommandMenu } from "./CommandMenu.js";
|
|
2
|
+
import { DefaultList } from "./List.js";
|
|
3
|
+
import { DefaultLoading } from "./Loading.js";
|
|
4
|
+
import { DefaultLoadMore } from "./LoadMore.js";
|
|
5
|
+
import { DefaultPlatformMark } from "./PlatformMark.js";
|
|
6
|
+
import { DefaultRelationLink } from "./RelationLink.js";
|
|
7
|
+
import { DefaultRow, DefaultRowContent } from "./Row.js";
|
|
8
|
+
import { DefaultRowMenu } from "./RowMenu.js";
|
|
9
|
+
import { DefaultStatusBadge } from "./StatusBadge.js";
|
|
10
|
+
import { DefaultStatusMarker } from "./StatusMarker.js";
|
|
11
|
+
import { DefaultTag } from "./Tag.js";
|
|
12
|
+
import { DefaultTickBox } from "./TickBox.js";
|
|
13
|
+
export const DEFAULT_VIEWS_ATOMS = {
|
|
14
|
+
List: DefaultList,
|
|
15
|
+
Row: DefaultRow,
|
|
16
|
+
RowContent: DefaultRowContent,
|
|
17
|
+
TickBox: DefaultTickBox,
|
|
18
|
+
StatusBadge: DefaultStatusBadge,
|
|
19
|
+
StatusMarker: DefaultStatusMarker,
|
|
20
|
+
Tag: DefaultTag,
|
|
21
|
+
CommandMenu: DefaultCommandMenu,
|
|
22
|
+
RelationLink: DefaultRelationLink,
|
|
23
|
+
Loading: DefaultLoading,
|
|
24
|
+
LoadMore: DefaultLoadMore,
|
|
25
|
+
PlatformMark: DefaultPlatformMark,
|
|
26
|
+
RowMenu: DefaultRowMenu,
|
|
27
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CategoryColor } from "@viewkitjs/fields/design/category-colors";
|
|
2
|
+
import type { StatusSlot } from "@viewkitjs/fields/design/status-slots";
|
|
3
|
+
export declare const STATUS_TEXT: Record<StatusSlot, string>;
|
|
4
|
+
export declare const STATUS_DOT: Record<StatusSlot, string>;
|
|
5
|
+
export declare const TAG_TONE: Record<CategoryColor, string>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export const STATUS_TEXT = {
|
|
2
|
+
success: "text-[var(--vk-success,hsl(160_84%_39%))]",
|
|
3
|
+
error: "text-(color:--vk-danger)",
|
|
4
|
+
warning: "text-[var(--vk-warning,hsl(38_92%_50%))]",
|
|
5
|
+
running: "text-[var(--vk-info,hsl(199_89%_48%))]",
|
|
6
|
+
pending: "text-(color:--vk-fg-subtle)",
|
|
7
|
+
primary: "text-(color:--vk-fg-brand)",
|
|
8
|
+
muted: "text-(color:--vk-fg-subtle)",
|
|
9
|
+
};
|
|
10
|
+
export const STATUS_DOT = {
|
|
11
|
+
success: "bg-[var(--vk-success,hsl(160_84%_39%))]",
|
|
12
|
+
error: "bg-(color:--vk-danger)",
|
|
13
|
+
warning: "bg-[var(--vk-warning,hsl(38_92%_50%))]",
|
|
14
|
+
running: "bg-[var(--vk-info,hsl(199_89%_48%))]",
|
|
15
|
+
pending: "bg-(color:--vk-fg-subtle)",
|
|
16
|
+
primary: "bg-(color:--vk-brand)",
|
|
17
|
+
muted: "bg-(color:--vk-fg-subtle)",
|
|
18
|
+
};
|
|
19
|
+
export const TAG_TONE = {
|
|
20
|
+
gray: "bg-(color:--vk-neutral) text-(color:--vk-fg-subtle)",
|
|
21
|
+
blue: "bg-[color-mix(in_oklab,var(--vk-label-blue,hsl(199_89%_48%))_12%,var(--vk-ground))] text-[var(--vk-label-blue,hsl(199_89%_48%))]",
|
|
22
|
+
green: "bg-[color-mix(in_oklab,var(--vk-label-green,hsl(160_84%_39%))_12%,var(--vk-ground))] text-[var(--vk-label-green,hsl(160_84%_39%))]",
|
|
23
|
+
amber: "bg-[color-mix(in_oklab,var(--vk-label-amber,hsl(38_92%_50%))_12%,var(--vk-ground))] text-[var(--vk-label-amber,hsl(38_92%_50%))]",
|
|
24
|
+
red: "bg-[color-mix(in_oklab,var(--vk-label-red,hsl(0_84%_60%))_12%,var(--vk-ground))] text-[var(--vk-label-red,hsl(0_84%_60%))]",
|
|
25
|
+
purple: "bg-[color-mix(in_oklab,var(--vk-label-purple,hsl(258_90%_66%))_12%,var(--vk-ground))] text-[var(--vk-label-purple,hsl(258_90%_66%))]",
|
|
26
|
+
pink: "bg-[color-mix(in_oklab,var(--vk-label-pink,hsl(330_81%_60%))_12%,var(--vk-ground))] text-[var(--vk-label-pink,hsl(330_81%_60%))]",
|
|
27
|
+
teal: "bg-[color-mix(in_oklab,var(--vk-label-teal,hsl(173_80%_40%))_12%,var(--vk-ground))] text-[var(--vk-label-teal,hsl(173_80%_40%))]",
|
|
28
|
+
};
|