viewkitjs 0.28.0 → 0.30.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 +218 -0
- package/MIGRATION.md +181 -11
- package/fields/dist/derived.d.ts +2 -1
- package/fields/dist/derived.js +9 -3
- package/fields/dist/entities.js +41 -3
- package/fields/dist/index.d.ts +1 -1
- package/fields/dist/index.js +1 -1
- package/fields/dist/messages.d.ts +8 -2
- package/fields/dist/messages.js +3 -0
- package/fields/dist/range.d.ts +6 -0
- package/fields/dist/range.js +8 -0
- package/fields/dist/registry.js +11 -1
- package/fields/dist/spec-changes.js +1 -0
- package/fields/dist/types.d.ts +23 -1
- package/fields/docs/guides/derived-fields.md +7 -5
- package/fields/docs/guides/field-types.md +2 -2
- package/fields/docs/guides/the-index.md +1 -1
- package/fields/docs/reference/fields.md +3 -1
- package/fields/docs/reference/types.md +3 -1
- package/fields/skills/viewkit/SKILL.md +1 -1
- package/package.json +2 -1
- package/postgres/dist/definitions/build.js +29 -5
- package/postgres/dist/definitions/label.d.ts +7 -0
- package/postgres/dist/definitions/label.js +9 -1
- package/postgres/dist/definitions/lookup.js +6 -2
- package/postgres/dist/definitions/place.d.ts +6 -3
- package/postgres/dist/definitions/rollup.js +5 -1
- package/postgres/dist/definitions/storage.d.ts +15 -0
- package/postgres/dist/definitions/storage.js +52 -1
- package/postgres/dist/definitions/stored.js +21 -0
- package/postgres/dist/phone.d.ts +13 -1
- package/postgres/dist/phone.js +23 -3
- package/postgres/dist/search-indexes.d.ts +6 -1
- package/postgres/dist/search-indexes.js +71 -25
- package/postgres/dist/search.js +3 -3
- package/postgres/docs/guides/definitions.md +22 -5
- package/postgres/docs/guides/field-map.md +5 -4
- package/postgres/docs/reference/definitions.md +3 -3
- package/postgres/docs/reference/postgres.md +1 -1
- package/views/dist/cells/cell-format.d.ts +2 -2
- package/views/dist/cells/cell-format.js +2 -2
- package/views/dist/cells/cell-values.js +9 -12
- package/views/dist/contract.d.ts +161 -18
- package/views/dist/contract.js +170 -28
- package/views/dist/controls/bulk-bar/bulk-bar-of.d.ts +66 -0
- package/views/dist/controls/bulk-bar/bulk-bar-of.js +22 -0
- package/views/dist/controls/bulk-bar/bulk-bar.d.ts +40 -0
- package/views/dist/controls/bulk-bar/bulk-bar.js +278 -0
- package/views/dist/controls/bulk-bar/looks.d.ts +10 -0
- package/views/dist/controls/bulk-bar/looks.js +14 -0
- package/views/dist/controls/bulk-bar/map-selection-bar.d.ts +19 -0
- package/views/dist/controls/bulk-bar/map-selection-bar.js +57 -0
- package/views/dist/controls/bulk-bar/tokens.d.ts +136 -0
- package/views/dist/controls/bulk-bar/tokens.js +36 -0
- package/views/dist/controls/bulk-bar/words.d.ts +50 -0
- package/views/dist/controls/bulk-bar/words.js +19 -0
- package/views/dist/controls/bulk-bar.css +96 -0
- package/views/dist/controls/button/button.js +3 -1
- package/views/dist/controls/button.css +5 -4
- package/views/dist/controls/checkbox/checkbox.js +3 -1
- package/views/dist/controls/checkbox.css +1 -1
- package/views/dist/controls/choice/tokens.d.ts +79 -0
- package/views/dist/controls/choice/tokens.js +22 -0
- package/views/dist/controls/choice.css +31 -0
- package/views/dist/controls/compound-editor/looks.js +1 -1
- package/views/dist/controls/controls.d.ts +8 -0
- package/views/dist/controls/controls.js +8 -0
- package/views/dist/controls/customize/customize.d.ts +176 -0
- package/views/dist/controls/customize/customize.js +348 -0
- package/views/dist/controls/customize/glide.d.ts +10 -0
- package/views/dist/controls/customize/glide.js +55 -0
- package/views/dist/controls/customize/looks.d.ts +13 -0
- package/views/dist/controls/customize/looks.js +11 -0
- package/views/dist/controls/customize/map-customize-body.d.ts +15 -0
- package/views/dist/controls/customize/map-customize-body.js +195 -0
- package/views/dist/controls/customize/map-ranges.d.ts +23 -0
- package/views/dist/controls/customize/map-ranges.js +41 -0
- package/views/dist/controls/customize/rules.d.ts +39 -0
- package/views/dist/controls/customize/rules.js +21 -0
- package/views/dist/controls/customize/tokens.d.ts +40 -0
- package/views/dist/controls/customize/tokens.js +12 -0
- package/views/dist/controls/customize/words.d.ts +65 -0
- package/views/dist/controls/customize/words.js +42 -0
- package/views/dist/controls/customize.css +57 -0
- package/views/dist/controls/date-editor/looks.js +1 -1
- package/views/dist/controls/filter-editor/block.d.ts +31 -0
- package/views/dist/controls/filter-editor/block.js +27 -0
- package/views/dist/controls/filter-editor/filter-editor.d.ts +4 -0
- package/views/dist/controls/filter-editor/filter-editor.js +86 -43
- package/views/dist/controls/filter-editor/how.d.ts +1 -1
- package/views/dist/controls/filter-editor/how.js +1 -0
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +16 -1
- package/views/dist/controls/filter-editor/map-filter-body.js +39 -13
- package/views/dist/controls/filter-editor/map-rules.d.ts +27 -11
- package/views/dist/controls/filter-editor/map-rules.js +73 -42
- package/views/dist/controls/filter-editor/rules.d.ts +42 -5
- package/views/dist/controls/filter-editor/rules.js +55 -2
- package/views/dist/controls/filter-editor/words.d.ts +15 -0
- package/views/dist/controls/filter-editor/words.js +6 -0
- package/views/dist/controls/filter-editor.css +18 -0
- package/views/dist/controls/index.d.ts +33 -9
- package/views/dist/controls/index.js +32 -9
- package/views/dist/controls/inline-input/looks.js +1 -1
- package/views/dist/controls/input/input.js +10 -4
- package/views/dist/controls/internal/phone.d.ts +5 -4
- package/views/dist/controls/internal/phone.js +7 -7
- package/views/dist/controls/internal/scroll.js +5 -1
- package/views/dist/controls/internal/typed-run.d.ts +2 -0
- package/views/dist/controls/internal/typed-run.js +5 -0
- package/views/dist/controls/menu/map-menu.js +2 -2
- package/views/dist/controls/menu-list/menu-list.d.ts +16 -1
- package/views/dist/controls/menu-list/menu-list.js +26 -8
- package/views/dist/controls/menu-list.css +8 -0
- package/views/dist/controls/number-editor/looks.js +1 -1
- package/views/dist/controls/option/option.js +3 -1
- package/views/dist/controls/option.css +1 -1
- package/views/dist/controls/pane/pane.d.ts +4 -0
- package/views/dist/controls/pane/pane.js +2 -1
- package/views/dist/controls/picker/looks.js +1 -1
- package/views/dist/controls/picker/map-picker.d.ts +6 -2
- package/views/dist/controls/picker/map-picker.js +4 -2
- package/views/dist/controls/picker/picker.d.ts +7 -0
- package/views/dist/controls/picker/picker.js +57 -8
- package/views/dist/controls/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +2 -2
- package/views/dist/controls/popover/popover.js +2 -1
- package/views/dist/controls/popover.css +3 -0
- package/views/dist/controls/ports-host/map-ports-host.d.ts +7 -0
- package/views/dist/controls/ports-host/map-ports-host.js +43 -0
- package/views/dist/controls/press/tokens.d.ts +8 -0
- package/views/dist/controls/press/tokens.js +4 -0
- package/views/dist/controls/press.css +44 -0
- package/views/dist/controls/quick-filters/looks.d.ts +11 -0
- package/views/dist/controls/quick-filters/looks.js +9 -0
- package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +31 -0
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +59 -0
- package/views/dist/controls/quick-filters/quick-filters.d.ts +37 -0
- package/views/dist/controls/quick-filters/quick-filters.js +89 -0
- package/views/dist/controls/quick-filters/reminder.d.ts +18 -0
- package/views/dist/controls/quick-filters/reminder.js +41 -0
- package/views/dist/controls/quick-filters/rules.d.ts +89 -0
- package/views/dist/controls/quick-filters/rules.js +52 -0
- package/views/dist/controls/quick-filters/tokens.d.ts +112 -0
- package/views/dist/controls/quick-filters/tokens.js +30 -0
- package/views/dist/controls/quick-filters/words.d.ts +25 -0
- package/views/dist/controls/quick-filters/words.js +13 -0
- package/views/dist/controls/quick-filters.css +118 -0
- package/views/dist/controls/sheet/bottom-sheet.d.ts +9 -4
- package/views/dist/controls/sheet/bottom-sheet.js +4 -4
- package/views/dist/controls/sheet/map-sheet.d.ts +4 -1
- package/views/dist/controls/sheet/map-sheet.js +19 -6
- package/views/dist/controls/sheet/sheet-parts.d.ts +10 -0
- package/views/dist/controls/sheet/sheet-parts.js +2 -0
- package/views/dist/controls/switch-row/switch-row.d.ts +15 -0
- package/views/dist/controls/switch-row/switch-row.js +9 -0
- package/views/dist/controls/switch-row/tokens.d.ts +51 -0
- package/views/dist/controls/switch-row/tokens.js +15 -0
- package/views/dist/controls/switch-row.css +39 -0
- package/views/dist/controls/switch.css +1 -1
- package/views/dist/controls/tag/tag.js +3 -1
- package/views/dist/controls/tag-field/tag-field.d.ts +20 -0
- package/views/dist/controls/tag-field/tag-field.js +19 -0
- package/views/dist/controls/tag-field/tokens.d.ts +7 -0
- package/views/dist/controls/tag-field/tokens.js +4 -0
- package/views/dist/controls/tag-field.css +13 -0
- package/views/dist/controls/text-editor/looks.js +1 -1
- package/views/dist/controls/text-editor/map-text-body.d.ts +1 -1
- package/views/dist/controls/text-editor/map-text-body.js +2 -2
- package/views/dist/controls/text-editor/text-editor.d.ts +3 -0
- package/views/dist/controls/text-editor/text-editor.js +17 -7
- package/views/dist/controls/text-editor.css +11 -0
- package/views/dist/controls/toast/toast.d.ts +5 -1
- package/views/dist/controls/toast/toast.js +5 -3
- package/views/dist/controls/tokens.js +18 -0
- package/views/dist/controls/toolbar/keys.d.ts +3 -0
- package/views/dist/controls/toolbar/keys.js +11 -0
- package/views/dist/controls/toolbar/looks.d.ts +10 -0
- package/views/dist/controls/toolbar/looks.js +40 -0
- package/views/dist/controls/toolbar/tokens.d.ts +28 -0
- package/views/dist/controls/toolbar/tokens.js +9 -0
- package/views/dist/controls/toolbar/toolbar.d.ts +111 -0
- package/views/dist/controls/toolbar/toolbar.js +370 -0
- package/views/dist/controls/toolbar/words.d.ts +28 -0
- package/views/dist/controls/toolbar/words.js +17 -0
- package/views/dist/controls/toolbar-button/looks.d.ts +4 -0
- package/views/dist/controls/toolbar-button/looks.js +21 -0
- package/views/dist/controls/toolbar-button/tokens.d.ts +103 -0
- package/views/dist/controls/toolbar-button/tokens.js +28 -0
- package/views/dist/controls/toolbar-button/toolbar-button.d.ts +66 -0
- package/views/dist/controls/toolbar-button/toolbar-button.js +51 -0
- package/views/dist/controls/toolbar-button.css +75 -0
- package/views/dist/controls/toolbar.css +65 -0
- package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
- package/views/dist/controls/tooltip/map-tooltip.js +2 -2
- package/views/dist/controls/tooltip/tooltip.d.ts +3 -1
- package/views/dist/controls/tooltip/tooltip.js +2 -2
- package/views/dist/controls/values-editor/looks.js +1 -1
- package/views/dist/controls/values-editor/values.js +6 -2
- package/views/dist/controls/views-list/map-views-list-body.d.ts +4 -1
- package/views/dist/controls/views-list/map-views-list-body.js +128 -4
- package/views/dist/controls/views-list/rules.d.ts +26 -0
- package/views/dist/controls/views-list/rules.js +63 -0
- package/views/dist/controls/views-list/view-menu.d.ts +84 -0
- package/views/dist/controls/views-list/view-menu.js +201 -0
- package/views/dist/controls/views-list/views-list.d.ts +8 -1
- package/views/dist/controls/views-list/views-list.js +18 -3
- package/views/dist/controls/views-list/words.d.ts +54 -0
- package/views/dist/controls/views-list/words.js +10 -1
- package/views/dist/controls/views-list.css +5 -1
- package/views/dist/display/date.js +3 -3
- package/views/dist/display/format.d.ts +6 -0
- package/views/dist/display/format.js +3 -0
- package/views/dist/display/index.d.ts +1 -1
- package/views/dist/display/index.js +1 -1
- package/views/dist/display/options.d.ts +1 -1
- package/views/dist/display/range.d.ts +2 -1
- package/views/dist/display/range.js +4 -1
- package/views/dist/display/rich-text.js +0 -1
- package/views/dist/editors/ChipsEditor.d.ts +4 -5
- package/views/dist/editors/ChipsEditor.js +12 -78
- package/views/dist/editors/DateEditor.d.ts +12 -16
- package/views/dist/editors/DateEditor.js +40 -191
- package/views/dist/editors/EditorPanel.d.ts +2 -6
- package/views/dist/editors/EditorPanel.js +2 -2
- package/views/dist/editors/LocationEditor.d.ts +11 -19
- package/views/dist/editors/LocationEditor.js +19 -211
- package/views/dist/editors/NameEditor.d.ts +8 -16
- package/views/dist/editors/NameEditor.js +11 -100
- package/views/dist/editors/NumberEditor.d.ts +14 -21
- package/views/dist/editors/NumberEditor.js +22 -49
- package/views/dist/editors/RangeEditor.d.ts +9 -33
- package/views/dist/editors/RangeEditor.js +12 -97
- package/views/dist/editors/RelationEditor.d.ts +6 -9
- package/views/dist/editors/RelationEditor.js +11 -30
- package/views/dist/editors/RelationSetEditor.d.ts +13 -24
- package/views/dist/editors/RelationSetEditor.js +33 -101
- package/views/dist/editors/SelectEditor.d.ts +15 -17
- package/views/dist/editors/SelectEditor.js +15 -94
- package/views/dist/editors/TextEditor.d.ts +23 -26
- package/views/dist/editors/TextEditor.js +11 -48
- package/views/dist/editors/ValueListEditor.d.ts +14 -23
- package/views/dist/editors/ValueListEditor.js +16 -202
- package/views/dist/editors/body-panel.d.ts +13 -7
- package/views/dist/editors/body-panel.js +3 -7
- package/views/dist/editors/edit-cores.d.ts +15 -15
- package/views/dist/editors/edit-cores.js +14 -14
- package/views/dist/editors/number-body.d.ts +1 -1
- package/views/dist/editors/number-step.d.ts +0 -34
- package/views/dist/editors/number-step.js +0 -37
- package/views/dist/editors/option-add-flow.d.ts +1 -13
- package/views/dist/editors/option-add-flow.js +0 -22
- package/views/dist/editors/relation-links-body.d.ts +2 -3
- package/views/dist/editors/relation-picker.d.ts +13 -3
- package/views/dist/editors/relation-source.d.ts +0 -22
- package/views/dist/editors/relation-source.js +0 -21
- package/views/dist/field-row/FieldRow.js +5 -6
- package/views/dist/field-row/FieldRowLane.js +0 -1
- package/views/dist/field-row/editors/RowChipsEditor.js +2 -2
- package/views/dist/field-row/editors/RowDateEditor.d.ts +2 -2
- package/views/dist/field-row/editors/RowDateEditor.js +2 -2
- package/views/dist/field-row/editors/RowNameEditor.d.ts +2 -5
- package/views/dist/field-row/editors/RowNameEditor.js +7 -12
- package/views/dist/field-row/editors/RowNumberEditor.d.ts +1 -1
- package/views/dist/field-row/editors/RowNumberEditor.js +4 -4
- package/views/dist/field-row/editors/RowPlaceEditor.js +3 -3
- package/views/dist/field-row/editors/RowRangeEditor.d.ts +2 -5
- package/views/dist/field-row/editors/RowRangeEditor.js +7 -14
- package/views/dist/field-row/editors/RowRelationEditor.js +3 -3
- package/views/dist/field-row/editors/RowSelectEditor.js +2 -2
- package/views/dist/field-row/editors/RowTextEditor.d.ts +1 -1
- package/views/dist/field-row/editors/RowTextEditor.js +3 -4
- package/views/dist/field-row/editors/RowValueListEditor.js +5 -5
- package/views/dist/field-row/field-row-button.d.ts +6 -9
- package/views/dist/field-row/field-row-button.js +1 -6
- package/views/dist/field-row/field-row-checkbox.d.ts +1 -1
- package/views/dist/field-row/row-target.d.ts +0 -7
- package/views/dist/field-row/row-target.js +0 -2
- package/views/dist/grid/chrome/GridAddColumn.d.ts +2 -1
- package/views/dist/grid/chrome/GridAddColumn.js +8 -66
- package/views/dist/grid/chrome/GridAggregateMenu.d.ts +5 -7
- package/views/dist/grid/chrome/GridAggregateMenu.js +20 -39
- package/views/dist/grid/chrome/GridCellEditors.d.ts +2 -2
- package/views/dist/grid/chrome/GridCellEditors.js +12 -12
- package/views/dist/grid/chrome/GridChipsEditor.js +3 -3
- package/views/dist/grid/chrome/GridColumnMenu.d.ts +11 -12
- package/views/dist/grid/chrome/GridColumnMenu.js +32 -93
- package/views/dist/grid/chrome/GridDateEditor.d.ts +6 -6
- package/views/dist/grid/chrome/GridDateEditor.js +3 -3
- package/views/dist/grid/chrome/GridGroupMenu.d.ts +4 -6
- package/views/dist/grid/chrome/GridGroupMenu.js +21 -62
- package/views/dist/grid/chrome/GridHeader.d.ts +1 -2
- package/views/dist/grid/chrome/GridHeader.js +3 -2
- package/views/dist/grid/chrome/GridLongTextEditor.d.ts +17 -38
- package/views/dist/grid/chrome/GridLongTextEditor.js +6 -7
- package/views/dist/grid/chrome/GridNameEditor.js +4 -4
- package/views/dist/grid/chrome/GridNumberEditor.d.ts +4 -5
- package/views/dist/grid/chrome/GridNumberEditor.js +5 -6
- package/views/dist/grid/chrome/GridPlaceEditor.d.ts +2 -5
- package/views/dist/grid/chrome/GridPlaceEditor.js +5 -5
- package/views/dist/grid/chrome/GridRangeEditor.d.ts +6 -12
- package/views/dist/grid/chrome/GridRangeEditor.js +7 -15
- package/views/dist/grid/chrome/GridRelationEditor.js +5 -5
- package/views/dist/grid/chrome/GridRow.js +0 -3
- package/views/dist/grid/chrome/GridRowActions.d.ts +1 -1
- package/views/dist/grid/chrome/GridRowActions.js +0 -5
- package/views/dist/grid/chrome/GridRowCells.js +11 -7
- package/views/dist/grid/chrome/GridSelectEditor.js +3 -3
- package/views/dist/grid/chrome/GridStructure.js +0 -1
- package/views/dist/grid/chrome/GridTable.js +1 -1
- package/views/dist/grid/chrome/GridTextEditor.d.ts +5 -7
- package/views/dist/grid/chrome/GridTextEditor.js +5 -18
- package/views/dist/grid/chrome/GridValueListEditor.js +4 -4
- package/views/dist/grid/chrome/grid-body-place.d.ts +2 -3
- package/views/dist/grid/chrome/grid-body-place.js +4 -8
- package/views/dist/grid/chrome/grid-button.d.ts +7 -10
- package/views/dist/grid/chrome/grid-button.js +1 -6
- package/views/dist/grid/chrome/grid-cell-classes.js +1 -1
- package/views/dist/grid/chrome/grid-column-menu-items.d.ts +4 -4
- package/views/dist/grid/chrome/grid-column-menu-items.js +10 -6
- package/views/dist/grid/chrome/grid-editor-layer.d.ts +5 -1
- package/views/dist/grid/chrome/grid-editor-layer.js +1 -0
- package/views/dist/grid/chrome/grid-fitted-box.d.ts +7 -1
- package/views/dist/grid/chrome/grid-fitted-box.js +4 -4
- package/views/dist/grid/chrome/grid-group-menu-parts.d.ts +5 -9
- package/views/dist/grid/chrome/grid-group-menu-parts.js +1 -3
- package/views/dist/grid/chrome/grid-hover.js +0 -1
- package/views/dist/grid/chrome/grid-menu-focus.d.ts +7 -31
- package/views/dist/grid/chrome/grid-menu-focus.js +7 -47
- package/views/dist/grid/chrome/grid-styles.d.ts +0 -3
- package/views/dist/grid/chrome/grid-styles.js +0 -1
- package/views/dist/grid/chrome/grid-table-props.d.ts +6 -10
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +2 -4
- package/views/dist/grid/core/clipboard-model.js +9 -4
- package/views/dist/grid/core/editing-controller.d.ts +2 -1
- package/views/dist/grid/core/editing-controller.js +10 -2
- package/views/dist/grid/core/refusal-sentence.d.ts +3 -0
- package/views/dist/grid/core/refusal-sentence.js +2 -2
- package/views/dist/grid/core/write-states.d.ts +3 -1
- package/views/dist/grid/core/write-states.js +6 -2
- package/views/dist/grid/grid.css +240 -0
- package/views/dist/grid/looks.d.ts +5 -1
- package/views/dist/grid/looks.js +20 -12
- package/views/dist/grid-tokens.d.ts +109 -0
- package/views/dist/grid-tokens.js +29 -0
- package/views/dist/looks/index.d.ts +5 -0
- package/views/dist/looks/index.js +5 -0
- package/views/dist/looks/pieces.js +10 -0
- package/views/dist/model/body-frame.d.ts +0 -32
- package/views/dist/model/body-frame.js +1 -15
- package/views/dist/model/column-capabilities.d.ts +2 -0
- package/views/dist/model/column-filters.d.ts +2 -1
- package/views/dist/model/column-from.js +2 -2
- package/views/dist/model/column-inspect.d.ts +5 -5
- package/views/dist/model/column-inspect.js +2 -2
- package/views/dist/model/relation-filters.d.ts +2 -0
- package/views/dist/panels/customize-body.d.ts +1 -10
- package/views/dist/panels/customize-body.js +0 -3
- package/views/dist/panels/filter/MenuSelect.js +0 -5
- package/views/dist/panels/filter/RangeFilterBody.js +0 -1
- package/views/dist/panels/filter/details.d.ts +1 -5
- package/views/dist/panels/filter/details.js +0 -13
- package/views/dist/panels/filter/filter-list.d.ts +0 -1
- package/views/dist/panels/filter/filter-list.js +1 -1
- package/views/dist/panels/index.d.ts +2 -2
- package/views/dist/panels/index.js +2 -2
- package/views/dist/panels/labels.d.ts +4 -0
- package/views/dist/panels/labels.js +8 -0
- package/views/dist/panels/model.d.ts +10 -2
- package/views/dist/panels/panel-button.d.ts +10 -12
- package/views/dist/panels/panel-button.js +1 -6
- package/views/dist/panels/quick/model.d.ts +4 -0
- package/views/dist/panels/react/chrome.d.ts +0 -17
- package/views/dist/panels/react/chrome.js +0 -8
- package/views/dist/panels/react/customize-body.d.ts +14 -12
- package/views/dist/panels/react/customize-body.js +93 -19
- package/views/dist/panels/react/customize.d.ts +16 -12
- package/views/dist/panels/react/customize.js +4 -110
- package/views/dist/panels/react/filter/FilterEditor.d.ts +4 -18
- package/views/dist/panels/react/filter/FilterEditor.js +6 -330
- package/views/dist/panels/react/filter/FilterFieldList.d.ts +1 -1
- package/views/dist/panels/react/filter/FilterFieldList.js +27 -51
- package/views/dist/panels/react/filter/PhoneFilterEditor.d.ts +1 -11
- package/views/dist/panels/react/filter/PhoneFilterEditor.js +8 -144
- package/views/dist/panels/react/filter/editor-ctx.d.ts +1 -33
- package/views/dist/panels/react/filter/editor-ctx.js +5 -33
- package/views/dist/panels/react/filter/filter-body.js +5 -2
- package/views/dist/panels/react/filter/filter-part-body.d.ts +3 -6
- package/views/dist/panels/react/filter/filter-part-body.js +0 -5
- package/views/dist/panels/react/filter/rule-writes.d.ts +1 -26
- package/views/dist/panels/react/filter/rule-writes.js +4 -95
- package/views/dist/panels/react/order-details.d.ts +1 -26
- package/views/dist/panels/react/order-details.js +3 -69
- package/views/dist/panels/react/panel-header.js +0 -1
- package/views/dist/panels/react/panel-step.d.ts +3 -0
- package/views/dist/panels/react/panel-step.js +2 -1
- package/views/dist/panels/react/popover.d.ts +4 -7
- package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +2 -4
- package/views/dist/panels/react/quick/QuickFiltersPanel.js +16 -136
- package/views/dist/panels/react/sort/SortEditor.d.ts +4 -4
- package/views/dist/panels/react/sort/SortEditor.js +8 -245
- package/views/dist/panels/react/sort/SortFieldList.d.ts +1 -1
- package/views/dist/panels/react/sort/SortFieldList.js +11 -25
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +13 -3
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +10 -3
- package/views/dist/panels/react/toolbar/Toolbar.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +16 -18
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +2 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +3 -3
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +12 -4
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +6 -2
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.js +0 -4
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +0 -1
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +3 -3
- package/views/dist/panels/react/view-actions.js +0 -1
- package/views/dist/panels/react/views-row/FoldingViewRow.js +2 -5
- package/views/dist/panels/react/views-row/ViewCreatePill.js +0 -1
- package/views/dist/panels/react/views-row/ViewPicker.js +30 -45
- package/views/dist/panels/react/views-row/ViewPickerRow.js +0 -2
- package/views/dist/panels/react/views-row/menu-classes.d.ts +0 -4
- package/views/dist/panels/react/views-row/menu-classes.js +0 -2
- package/views/dist/panels/react.d.ts +5 -12
- package/views/dist/panels/react.js +5 -12
- package/views/dist/panels/settings/filter-groups.d.ts +3 -0
- package/views/dist/panels/settings/filter-groups.js +40 -9
- package/views/dist/panels/settings/filters.d.ts +5 -0
- package/views/dist/panels/settings/filters.js +12 -6
- package/views/dist/panels/views-row/model.d.ts +10 -1
- package/views/dist/provider/ViewsProvider.d.ts +2 -46
- package/views/dist/provider/ViewsProvider.js +31 -27
- package/views/dist/provider/components.d.ts +295 -107
- package/views/dist/provider/context.d.ts +7 -21
- package/views/dist/provider/missing-slot.d.ts +3 -7
- package/views/dist/provider/missing-slot.js +2 -9
- package/views/dist/provider/ports.d.ts +18 -6
- package/views/dist/provider/ports.js +2 -1
- package/views/dist/react.d.ts +2 -3
- package/views/dist/react.js +1 -1
- package/views/dist/selection/SelectionBar.d.ts +2 -16
- package/views/dist/selection/SelectionBar.js +6 -4
- package/views/dist/selection/bar-props.d.ts +26 -0
- package/views/dist/selection/bar-props.js +1 -0
- package/views/dist/selection/index.d.ts +1 -1
- package/views/dist/selection/verbs.d.ts +32 -5
- package/views/dist/styles.css +694 -191
- package/views/dist/styles.unlayered.css +691 -188
- package/views/docs/contract.md +133 -130
- package/views/docs/controls/bulk-bar.md +41 -0
- package/views/docs/controls/choice.md +25 -0
- package/views/docs/controls/customize.md +17 -0
- package/views/docs/controls/popover.md +2 -0
- package/views/docs/controls/press.md +9 -0
- package/views/docs/controls/quick-filters.md +35 -0
- package/views/docs/controls/radio.md +1 -1
- package/views/docs/controls/switch-row.md +18 -0
- package/views/docs/controls/tag-field.md +7 -0
- package/views/docs/controls/toolbar-button.md +31 -0
- package/views/docs/controls/toolbar.md +14 -0
- package/views/docs/getting-started.md +222 -2
- package/views/docs/guides/atoms.md +2 -2
- package/views/docs/guides/cells.md +224 -4
- package/views/docs/guides/display.md +3 -3
- package/views/docs/guides/editors.md +235 -20
- package/views/docs/guides/looks.md +8 -2
- package/views/docs/guides/ports.md +7 -7
- package/views/docs/guides/selection.md +5 -1
- package/views/docs/guides/the-grid.md +15 -17
- package/views/docs/guides/the-provider.md +9 -15
- package/views/docs/install.md +4 -1
- package/views/docs/reference/cells.md +2 -2
- package/views/docs/reference/controls.md +215 -21
- package/views/docs/reference/display.md +1 -0
- package/views/docs/reference/editors-chips.md +2 -2
- package/views/docs/reference/editors-date.md +4 -4
- package/views/docs/reference/editors-location.md +4 -7
- package/views/docs/reference/editors-name.md +3 -5
- package/views/docs/reference/editors-number.md +10 -10
- package/views/docs/reference/editors-panel.md +3 -3
- package/views/docs/reference/editors-range.md +3 -5
- package/views/docs/reference/editors-relation.md +4 -4
- package/views/docs/reference/editors-select.md +3 -3
- package/views/docs/reference/editors-text.md +3 -4
- package/views/docs/reference/editors-value-list.md +3 -3
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +2 -2
- package/views/docs/reference/looks.md +25 -11
- package/views/docs/reference/panels-react.md +23 -37
- package/views/docs/reference/panels.md +8 -6
- package/views/docs/reference/react.md +24 -24
- package/views/docs/reference/selection.md +4 -2
- package/views/docs/reference/views.md +12 -11
- package/views/skills/views/SKILL.md +2 -2
- package/views/dist/editors/relation-panel.d.ts +0 -69
- package/views/dist/editors/relation-panel.js +0 -46
- package/views/dist/grid/chrome/GridColumnColorSection.d.ts +0 -13
- package/views/dist/grid/chrome/GridColumnColorSection.js +0 -40
- package/views/dist/grid/chrome/GridColumnDateSection.d.ts +0 -28
- package/views/dist/grid/chrome/GridColumnDateSection.js +0 -23
- package/views/dist/grid/chrome/GridColumnDurationSection.d.ts +0 -23
- package/views/dist/grid/chrome/GridColumnDurationSection.js +0 -24
- package/views/dist/grid/chrome/GridColumnNumberSection.d.ts +0 -29
- package/views/dist/grid/chrome/GridColumnNumberSection.js +0 -27
- package/views/dist/grid/chrome/GridColumnPercentSection.d.ts +0 -16
- package/views/dist/grid/chrome/GridColumnPercentSection.js +0 -16
- package/views/dist/grid/chrome/GridColumnSortSection.d.ts +0 -38
- package/views/dist/grid/chrome/GridColumnSortSection.js +0 -33
- package/views/dist/grid/chrome/GridFlyout.d.ts +0 -44
- package/views/dist/grid/chrome/GridFlyout.js +0 -80
- package/views/dist/grid/chrome/GridMenuRow.d.ts +0 -15
- package/views/dist/grid/chrome/GridMenuRow.js +0 -15
- package/views/dist/grid/chrome/grid-menu-search.d.ts +0 -7
- package/views/dist/grid/chrome/grid-menu-search.js +0 -7
- package/views/dist/panels/react/GroupBucketsList.d.ts +0 -16
- package/views/dist/panels/react/GroupBucketsList.js +0 -44
- package/views/dist/panels/react/LayoutColumnsList.d.ts +0 -24
- package/views/dist/panels/react/LayoutColumnsList.js +0 -101
- package/views/dist/panels/react/PopoverColumnDetail.d.ts +0 -11
- package/views/dist/panels/react/PopoverColumnDetail.js +0 -24
- package/views/dist/panels/react/drag.d.ts +0 -2
- package/views/dist/panels/react/drag.js +0 -5
- package/views/dist/panels/react/layout-detail.d.ts +0 -4
- package/views/dist/panels/react/layout-detail.js +0 -29
- package/views/dist/panels/react/root-list.d.ts +0 -6
- package/views/dist/panels/react/root-list.js +0 -31
- package/views/dist/panels/react/sort/use-sort-drag.d.ts +0 -17
- package/views/dist/panels/react/sort/use-sort-drag.js +0 -39
- package/views/dist/panels/react/view-footer.d.ts +0 -20
- package/views/dist/panels/react/view-footer.js +0 -41
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Button } from "../button/button.js";
|
|
5
|
+
import { glyph } from "../internal/editor-parts.js";
|
|
6
|
+
import { Icon } from "../internal/icons.js";
|
|
7
|
+
import { PhoneHost, phoneMark, usePhone } from "../internal/phone.js";
|
|
8
|
+
import { Input, InputGroup, InputGroupAddon } from "../input/input.js";
|
|
9
|
+
import { MENU_LIST_CARD_FRAME } from "../menu-list/looks.js";
|
|
10
|
+
import { MenuList, MenuListPanelRows } from "../menu-list/menu-list.js";
|
|
11
|
+
import { Notice } from "../notice/notice.js";
|
|
12
|
+
import { InPane, PaneBody, PaneClose, PaneFoot, PaneHead, PaneTitle } from "../pane/pane.js";
|
|
13
|
+
import { Radio, RadioGroup } from "../radio/radio.js";
|
|
14
|
+
import { SheetStep } from "../sheet/bottom-sheet.js";
|
|
15
|
+
import { reduced, slideTime, useGlide } from "./glide.js";
|
|
16
|
+
import { CUSTOMIZE_ATTRS, customizeWornOf } from "./looks.js";
|
|
17
|
+
import { columnOpens, columnOpensBySettings, columnsSay, findColumns, moveColumn, setShown } from "./rules.js";
|
|
18
|
+
import { customizeWords } from "./words.js";
|
|
19
|
+
export function useCustomizeWorn() {
|
|
20
|
+
const [el, setEl] = React.useState(null), [worn, setWorn] = React.useState(() => customizeWornOf(null));
|
|
21
|
+
React.useLayoutEffect(() => {
|
|
22
|
+
if (!el)
|
|
23
|
+
return;
|
|
24
|
+
const read = () => setWorn((now) => { const next = customizeWornOf(el); return now.head === next.head && now.columns === next.columns ? now : next; });
|
|
25
|
+
read();
|
|
26
|
+
const watch = new MutationObserver(read);
|
|
27
|
+
watch.observe(document.documentElement, { attributes: true, subtree: true, attributeFilter: CUSTOMIZE_ATTRS });
|
|
28
|
+
return () => watch.disconnect();
|
|
29
|
+
}, [el]);
|
|
30
|
+
return [setEl, worn];
|
|
31
|
+
}
|
|
32
|
+
const COLUMNS = glyph(["M6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2z", "M9 4v16", "M15 4v16"]);
|
|
33
|
+
const GROUP = glyph(["M5.5 4h13a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1 -1.5 1.5h-13a1.5 1.5 0 0 1 -1.5 -1.5v-3a1.5 1.5 0 0 1 1.5 -1.5z", "M5.5 14h13a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1 -1.5 1.5h-13a1.5 1.5 0 0 1 -1.5 -1.5v-3a1.5 1.5 0 0 1 1.5 -1.5z"]);
|
|
34
|
+
const LAYOUT_MARKS = {
|
|
35
|
+
table: "M6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2zM4 10h16M10 4v16",
|
|
36
|
+
board: "M5.5 4h3a1.5 1.5 0 0 1 1.5 1.5v13a1.5 1.5 0 0 1 -1.5 1.5h-3a1.5 1.5 0 0 1 -1.5 -1.5v-13a1.5 1.5 0 0 1 1.5 -1.5zM15.5 4h3a1.5 1.5 0 0 1 1.5 1.5v7a1.5 1.5 0 0 1 -1.5 1.5h-3a1.5 1.5 0 0 1 -1.5 -1.5v-7a1.5 1.5 0 0 1 1.5 -1.5z",
|
|
37
|
+
list: "M9 6h11M9 12h11M9 18h11M5 6h.01M5 12h.01M5 18h.01",
|
|
38
|
+
calendar: "M6 5h12a2 2 0 0 1 2 2v11a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2M4 10h16M9 3v4M15 3v4",
|
|
39
|
+
timeline: "M4 7h9M8 12h10M6 17h7",
|
|
40
|
+
};
|
|
41
|
+
export const layoutMark = (id) => (LAYOUT_MARKS[id] ? glyph([LAYOUT_MARKS[id]]) : undefined);
|
|
42
|
+
export function useCustomize(props) {
|
|
43
|
+
const { view, onViewChange, layouts, filter, sort, group, changed = false, onReset, onSave, pending = false, stale = false, exportCount, onCopyLink, onExport, toggles, layoutSettings, columnsReset, onLineChange, columnsFoot, fields = [], foldFields = false, onClose, onScreenChange } = props;
|
|
44
|
+
const w = customizeWords(props.words);
|
|
45
|
+
const host = React.useContext(PhoneHost), small = usePhone(), phone = (props.form ?? (host || small ? "phone" : "computer")) === "phone";
|
|
46
|
+
const inPane = React.useContext(InPane);
|
|
47
|
+
const [place, worn] = useCustomizeWorn();
|
|
48
|
+
const now = React.useRef(view);
|
|
49
|
+
React.useLayoutEffect(() => { now.current = view; });
|
|
50
|
+
const latest = React.useMemo(() => ({ get view() { return now.current; } }), []);
|
|
51
|
+
const change = (next) => { now.current = next; onViewChange(next); };
|
|
52
|
+
const NAMES = { layout: w.layout, columns: w.columns, filter: w.filter, sort: w.sort, group: w.group };
|
|
53
|
+
const SCREEN_OF = { [w.layout]: "layout", [w.columns]: "columns", [w.filter]: "filter", [w.sort]: "sort", [w.group]: "group" };
|
|
54
|
+
const handed = { filter, sort, group };
|
|
55
|
+
const hasLayout = layouts.length > 0 || !!layoutSettings, hasColumns = view.columns.length > 0;
|
|
56
|
+
const folded = foldFields && !filter && fields.length > 0;
|
|
57
|
+
const opens = (to) => to === "list" || (to === "layout" ? hasLayout : to === "columns" ? hasColumns : to === "filter" && folded ? true : handed[to]?.opens != null);
|
|
58
|
+
const [screen, setScreen] = React.useState(() => (props.screen && opens(props.screen) ? props.screen : "list")), [back, setBack] = React.useState(false);
|
|
59
|
+
const [choosing, setChoosing] = React.useState(null), [column, setColumn] = React.useState(null);
|
|
60
|
+
const [fieldKey, setFieldKey] = React.useState(null);
|
|
61
|
+
const [find, setFind] = React.useState("");
|
|
62
|
+
const [focusTo, setFocusTo] = React.useState(null), root = React.useRef(null), backButton = React.useRef(null);
|
|
63
|
+
const go = (to) => {
|
|
64
|
+
if (!opens(to))
|
|
65
|
+
return;
|
|
66
|
+
setBack(false);
|
|
67
|
+
setScreen(to);
|
|
68
|
+
setChoosing(null);
|
|
69
|
+
setColumn(null);
|
|
70
|
+
setFieldKey(null);
|
|
71
|
+
setFocusTo("back");
|
|
72
|
+
setFind("");
|
|
73
|
+
onScreenChange?.(to);
|
|
74
|
+
};
|
|
75
|
+
const goBack = () => { const from = screen; setBack(true); setScreen("list"); setChoosing(null); setColumn(null); setFieldKey(null); setFocusTo(from === "list" ? null : NAMES[from]); setFind(""); onScreenChange?.("list"); };
|
|
76
|
+
React.useLayoutEffect(() => {
|
|
77
|
+
if (!focusTo || phone)
|
|
78
|
+
return;
|
|
79
|
+
setFocusTo(null);
|
|
80
|
+
if (focusTo === "back") {
|
|
81
|
+
backButton.current?.focus({ preventScroll: true });
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const row = [...(root.current?.querySelectorAll("[data-item]") ?? [])].find((r) => r.querySelector(".o-menu-name")?.textContent === focusTo);
|
|
85
|
+
row?.focus({ preventScroll: true });
|
|
86
|
+
}, [focusTo, phone]);
|
|
87
|
+
const placeRoot = React.useCallback((el) => { root.current = el; place(el); }, [place]);
|
|
88
|
+
const glide = useGlide(root);
|
|
89
|
+
const [held, setHeld] = React.useState({});
|
|
90
|
+
const holds = React.useRef([]);
|
|
91
|
+
const press = (ids, on) => {
|
|
92
|
+
const land = (these) => change({ ...latest.view, columns: these.reduce((cols, id) => setShown(cols, id, on), latest.view.columns) });
|
|
93
|
+
if (!ids.length)
|
|
94
|
+
return;
|
|
95
|
+
if (reduced()) {
|
|
96
|
+
land(ids);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
for (const h of holds.current)
|
|
100
|
+
h.ids = h.ids.filter((id) => !ids.includes(id));
|
|
101
|
+
setHeld((was) => ({ ...was, ...Object.fromEntries(ids.map((id) => [id, on])) }));
|
|
102
|
+
const hold = { ids, land: () => land(hold.ids), timer: 0 };
|
|
103
|
+
hold.timer = window.setTimeout(() => {
|
|
104
|
+
holds.current = holds.current.filter((h) => h !== hold);
|
|
105
|
+
glide(() => {
|
|
106
|
+
if (hold.ids.length)
|
|
107
|
+
hold.land();
|
|
108
|
+
setHeld((was) => { const next = { ...was }; for (const id of hold.ids)
|
|
109
|
+
delete next[id]; return next; });
|
|
110
|
+
}, latest.view.columns.filter((c) => hold.ids.includes(c.id)).map((c) => c.label));
|
|
111
|
+
}, slideTime(root.current));
|
|
112
|
+
holds.current.push(hold);
|
|
113
|
+
};
|
|
114
|
+
React.useEffect(() => () => { for (const h of holds.current) {
|
|
115
|
+
window.clearTimeout(h.timer);
|
|
116
|
+
if (h.ids.length)
|
|
117
|
+
h.land();
|
|
118
|
+
} holds.current = []; }, []);
|
|
119
|
+
const layout = layouts.find((l) => l.id === view.layout) ?? layouts[0];
|
|
120
|
+
const section = (label, icon, s) => s ? [{ kind: "actions", icon, label, detail: s.says, inForce: s.inForce, entries: [] }] : [];
|
|
121
|
+
const toggleRows = (ts) => ts.flatMap((t) => [
|
|
122
|
+
{ kind: "check", label: t.label, checked: t.value, onCheckedChange: (on) => t.onChange(on), ...(t.icon != null && { icon: t.icon }) },
|
|
123
|
+
...(t.reset ? [{ icon: null, label: w.toggleReset(t.label), onSelect: t.reset }] : []),
|
|
124
|
+
]);
|
|
125
|
+
const sectionsOfToggles = (ts) => [...new Set(ts.flatMap((t) => (t.section ? [t.section] : [])))];
|
|
126
|
+
const checks = toggles
|
|
127
|
+
? [...toggleRows(toggles.filter((t) => !t.section)),
|
|
128
|
+
...sectionsOfToggles(toggles).map((s) => ({ kind: "group", heading: s, entries: toggleRows(toggles.filter((t) => t.section === s)) }))]
|
|
129
|
+
: [{ kind: "check", label: w.showCounts, checked: view.counts, onCheckedChange: (c) => change({ ...latest.view, counts: c }) }];
|
|
130
|
+
const fieldRows = new Map();
|
|
131
|
+
const fieldRow = (f) => {
|
|
132
|
+
const entry = f.disabled != null
|
|
133
|
+
? { icon: f.icon ?? null, label: f.label, disabled: f.disabled }
|
|
134
|
+
: { kind: "actions", icon: f.icon ?? null, label: f.label, detail: f.says, inForce: f.inForce, entries: [] };
|
|
135
|
+
if (f.disabled == null)
|
|
136
|
+
fieldRows.set(entry, f.key);
|
|
137
|
+
return entry;
|
|
138
|
+
};
|
|
139
|
+
const fieldEntries = (fs, line = false) => {
|
|
140
|
+
const heads = [...new Set(fs.flatMap((f) => (f.section ? [f.section] : [])))];
|
|
141
|
+
return [...fs.filter((f) => !f.section).map(fieldRow),
|
|
142
|
+
...heads.map((s) => ({ kind: "group", heading: s, entries: fs.filter((f) => f.section === s).map(fieldRow) })),
|
|
143
|
+
...(line && heads.length ? [{ kind: "separator" }] : [])];
|
|
144
|
+
};
|
|
145
|
+
const filterFields = fields.filter((f) => f.place === "filters"), afterFields = fields.filter((f) => f.place === "after");
|
|
146
|
+
const inForceFields = filterFields.filter((f) => f.inForce).length;
|
|
147
|
+
const foldedFilter = folded ? { says: inForceFields ? String(inForceFields) : w.none, inForce: inForceFields > 0 } : undefined;
|
|
148
|
+
const sections = [
|
|
149
|
+
...(hasLayout ? [{ kind: "actions", icon: layout?.mark, label: w.layout, detail: layout?.name, entries: [] }] : []),
|
|
150
|
+
...(hasColumns ? [{ kind: "actions", icon: COLUMNS, label: w.columns, detail: columnsSay(view.columns, w), entries: [] }] : []),
|
|
151
|
+
...(folded ? [] : fieldEntries(filterFields, true)),
|
|
152
|
+
...section(w.filter, _jsx(Icon, { name: "filter" }), filter ?? foldedFilter), ...section(w.sort, _jsx(Icon, { name: "sort" }), sort), ...section(w.group, GROUP, group),
|
|
153
|
+
...(folded ? [] : fieldEntries(afterFields)),
|
|
154
|
+
...(checks.length ? [{ kind: "separator" }, ...checks] : []),
|
|
155
|
+
];
|
|
156
|
+
const field = screen === "filter" && fieldKey ? fields.find((f) => f.key === fieldKey && f.disabled == null) : undefined;
|
|
157
|
+
React.useLayoutEffect(() => {
|
|
158
|
+
if (!fieldKey || field)
|
|
159
|
+
return;
|
|
160
|
+
setFieldKey(null);
|
|
161
|
+
setBack(true);
|
|
162
|
+
if (!folded) {
|
|
163
|
+
setScreen("list");
|
|
164
|
+
onScreenChange?.("list");
|
|
165
|
+
}
|
|
166
|
+
}, [fieldKey, field, folded, onScreenChange]);
|
|
167
|
+
const openField = (key) => {
|
|
168
|
+
const f = fields.find((x) => x.key === key);
|
|
169
|
+
if (!f || f.disabled != null)
|
|
170
|
+
return;
|
|
171
|
+
setBack(false);
|
|
172
|
+
setScreen("filter");
|
|
173
|
+
setFieldKey(key);
|
|
174
|
+
setChoosing(null);
|
|
175
|
+
setColumn(null);
|
|
176
|
+
setFocusTo("back");
|
|
177
|
+
setFind("");
|
|
178
|
+
if (screen !== "filter")
|
|
179
|
+
onScreenChange?.("filter");
|
|
180
|
+
f.onOpen?.();
|
|
181
|
+
};
|
|
182
|
+
const backFromField = () => {
|
|
183
|
+
const label = field?.label ?? null;
|
|
184
|
+
setBack(true);
|
|
185
|
+
setFieldKey(null);
|
|
186
|
+
setFocusTo(label);
|
|
187
|
+
if (!folded) {
|
|
188
|
+
setScreen("list");
|
|
189
|
+
onScreenChange?.("list");
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
const opened = (e) => { const key = fieldRows.get(e); if (key) {
|
|
193
|
+
openField(key);
|
|
194
|
+
return;
|
|
195
|
+
} if ("label" in e && SCREEN_OF[e.label])
|
|
196
|
+
go(SCREEN_OF[e.label]); };
|
|
197
|
+
const footer = [
|
|
198
|
+
...(onCopyLink ? [{ icon: _jsx(Icon, { name: "link" }), label: w.copyLink, onSelect: onCopyLink }] : []),
|
|
199
|
+
...(onExport ? [{ icon: _jsx(Icon, { name: "export" }), label: w.export, ...(exportCount != null ? { count: exportCount } : {}), onSelect: onExport }] : []),
|
|
200
|
+
];
|
|
201
|
+
const words = (size) => (_jsxs(_Fragment, { children: [stale && _jsx(Notice, { className: "o-customize-stale", children: w.stale }), _jsxs("div", { className: "o-customize-words", children: [_jsx(Button, { kind: "link", size: size, onClick: onReset, disabled: pending, children: w.reset }), onSave && _jsx(Button, { kind: "link", size: size, onClick: onSave, disabled: pending, children: w.save })] })] }));
|
|
202
|
+
const col = screen === "columns" && column ? view.columns.find((c) => c.id === column && columnOpens(c)) : undefined;
|
|
203
|
+
React.useLayoutEffect(() => { if (column && !col) {
|
|
204
|
+
setColumn(null);
|
|
205
|
+
setChoosing(null);
|
|
206
|
+
setBack(true);
|
|
207
|
+
} }, [column, col]);
|
|
208
|
+
const allChoices = screen === "layout" ? (layoutSettings ? [...layoutSettings.choices, ...(layoutSettings.personal?.choices ?? [])] : []) : col?.settings?.choices ?? [];
|
|
209
|
+
const choiceRows = new Map();
|
|
210
|
+
const choiceOpened = (e) => { const c = choiceRows.get(e); if (c) {
|
|
211
|
+
setBack(false);
|
|
212
|
+
setChoosing(c.key);
|
|
213
|
+
} };
|
|
214
|
+
const rowsList = (label, rows) => (phone
|
|
215
|
+
? _jsx(MenuList, { label: label, entries: rows, onOpen: choiceOpened, words: w.rows })
|
|
216
|
+
: _jsx(MenuListPanelRows, { label: label, entries: rows, ticks: "switch", onOpen: choiceOpened, words: w.rows }));
|
|
217
|
+
const choiceRow = (c) => {
|
|
218
|
+
const entry = { kind: "choices", icon: null, label: c.label, value: c.value, choices: c.options.map((o) => ({ value: o.value, label: o.label })),
|
|
219
|
+
detail: c.options.find((o) => o.value === c.value)?.label };
|
|
220
|
+
choiceRows.set(entry, c);
|
|
221
|
+
return entry;
|
|
222
|
+
};
|
|
223
|
+
const choice = allChoices.find((c) => c.key === choosing);
|
|
224
|
+
const backFromChoice = () => { setBack(true); setFocusTo(choice?.label ?? null); setChoosing(null); };
|
|
225
|
+
const choiceLevel = choice && (() => {
|
|
226
|
+
const rows = [{ kind: "pick", value: choice.value, choices: choice.options.map((o) => ({ value: o.value, label: o.label })),
|
|
227
|
+
onChoose: (v) => { if (v !== choice.value)
|
|
228
|
+
choice.onChange(v); backFromChoice(); } }];
|
|
229
|
+
return phone ? _jsx(MenuList, { label: choice.label, entries: rows, words: w.rows }) : _jsx(MenuListPanelRows, { label: choice.label, entries: rows, words: w.rows });
|
|
230
|
+
})();
|
|
231
|
+
const heading = (label, act) => (_jsxs("div", { className: "o-customize-heading", children: [_jsx("p", { className: "o-list-heading o-customize-heading-words", children: label }), act?.map((a) => _jsx(Button, { kind: "link", size: "line", onClick: a.onPress, children: a.label }, a.label))] }));
|
|
232
|
+
const ownSettings = (settings, name, lead = [], own) => {
|
|
233
|
+
const bare = settings.toggles.filter((t) => !t.section), sectioned = sectionsOfToggles(settings.toggles);
|
|
234
|
+
const first = [...lead, ...settings.choices.map(choiceRow), ...toggleRows(bare)];
|
|
235
|
+
const you = settings.personal, yours = you ? [...you.choices.map(choiceRow), ...toggleRows(you.toggles), ...(you.onReset ? [{ icon: null, label: w.personalReset, onSelect: you.onReset }] : [])] : [];
|
|
236
|
+
return _jsxs(_Fragment, { children: [first.length > 0 && _jsxs(_Fragment, { children: [!own && _jsx("p", { className: "o-list-heading o-customize-heading-words", children: name }), rowsList(own?.list ?? w.layoutSettings(name), first)] }), sectioned.map((s) => _jsxs(React.Fragment, { children: [_jsx("p", { className: "o-list-heading o-customize-heading-words", children: s }), rowsList(s, toggleRows(settings.toggles.filter((t) => t.section === s)))] }, s)), you && yours.length > 0 && _jsxs(_Fragment, { children: [_jsx("p", { className: "o-list-heading o-customize-heading-words", children: you.label }), rowsList(you.label, yours)] })] });
|
|
237
|
+
};
|
|
238
|
+
const layoutScreen = (_jsxs(_Fragment, { children: [_jsx(RadioGroup, { tiles: true, "aria-label": w.layout, value: view.layout, onValueChange: (v) => { if (typeof v === "string")
|
|
239
|
+
change({ ...latest.view, layout: v }); }, children: layouts.map((l) => _jsx(Radio, { value: l.id, mark: l.mark, label: l.name, disabled: l.later }, l.id)) }), layoutSettings ? ownSettings(layoutSettings, layout?.name ?? w.layout) : layout?.id === "table" && _jsxs(_Fragment, { children: [_jsx("p", { className: "o-list-heading o-customize-heading-words", children: layout.name }), rowsList(w.layoutSettings(layout.name), [
|
|
240
|
+
{ kind: "check", label: w.freeze, checked: view.freeze, onCheckedChange: (c) => change({ ...latest.view, freeze: c }) },
|
|
241
|
+
{ kind: "check", label: w.wrap, checked: view.wrap, onCheckedChange: (c) => change({ ...latest.view, wrap: c }) },
|
|
242
|
+
])] })] }));
|
|
243
|
+
const searching = find.trim() !== "", eyes = worn.columns === "eye";
|
|
244
|
+
const found = findColumns(view.columns, find);
|
|
245
|
+
const gripped = (columns, shown) => (searching || (!shown && !eyes) ? [] : columns.filter((c) => c.shown === shown && !c.locked));
|
|
246
|
+
const columnRows = new Map();
|
|
247
|
+
const openColumn = (id) => { setBack(false); setColumn(id); setChoosing(null); setFocusTo("back"); setFind(""); };
|
|
248
|
+
const columnOpened = (e) => { const id = columnRows.get(e); if (id)
|
|
249
|
+
openColumn(id); };
|
|
250
|
+
const lineMark = glyph(["M9 10l-5 5l5 5", "M20 4v7a4 4 0 0 1 -4 4h-12"]);
|
|
251
|
+
const block = (shown) => {
|
|
252
|
+
const grips = new Set(gripped(found, shown).map((c) => c.id));
|
|
253
|
+
return found.filter((c) => c.shown === shown).map((c) => {
|
|
254
|
+
const entry = { kind: "check", label: c.label, icon: c.mark, checked: held[c.id] ?? c.shown, grip: grips.has(c.id),
|
|
255
|
+
disabled: c.locked ? w.alwaysShown : undefined, onCheckedChange: (on) => press([c.id], on),
|
|
256
|
+
...(columnOpens(c) && { opens: w.columnSettings(c.label) }),
|
|
257
|
+
...(c.line && { toggle: { icon: lineMark, label: c.line.on ? w.newLineOn(c.label) : w.newLineStart(c.label), on: c.line.on, onPress: () => onLineChange?.(c.id),
|
|
258
|
+
...(c.line.refused && { disabled: c.line.refused }) } }) };
|
|
259
|
+
if (columnOpens(c))
|
|
260
|
+
columnRows.set(entry, c.id);
|
|
261
|
+
return entry;
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
const moveIn = (shown) => (from, to) => {
|
|
265
|
+
const g = gripped(latest.view.columns, shown);
|
|
266
|
+
if (g[from] && g[to])
|
|
267
|
+
change({ ...latest.view, columns: moveColumn(latest.view.columns, g[from].id, g[to].id) });
|
|
268
|
+
};
|
|
269
|
+
const ticks = eyes ? "eye" : "switch";
|
|
270
|
+
const rowsOf = (label, shown) => phone
|
|
271
|
+
? _jsx(MenuList, { label: label, entries: block(shown), ticks: ticks, onMove: moveIn(shown), onOpen: columnOpened, words: w.rows })
|
|
272
|
+
: _jsx(MenuListPanelRows, { label: label, entries: block(shown), ticks: ticks, onMove: moveIn(shown), onOpen: columnOpened, words: w.rows });
|
|
273
|
+
const canHide = view.columns.some((c) => c.shown && !c.locked), canShow = view.columns.some((c) => !c.shown);
|
|
274
|
+
const shownHere = found.some((c) => c.shown), hiddenHere = found.some((c) => !c.shown);
|
|
275
|
+
const typed = (e) => setFind(e.target.value);
|
|
276
|
+
const columnsBox = (_jsxs(InputGroup, { size: phone ? "lg" : "sm", chrome: "soft", children: [_jsx(InputGroupAddon, { children: _jsx(Icon, { name: "search" }) }), _jsx(Input, { value: find, onChange: typed, placeholder: phone ? w.findColumn : w.searchColumns, "aria-label": phone ? w.findColumn : w.searchColumns })] }));
|
|
277
|
+
const columnsSearch = phone ? columnsBox : _jsx("div", { className: "o-customize-search", children: columnsBox });
|
|
278
|
+
const shownActs = [
|
|
279
|
+
...(!searching && canHide ? [{ label: w.hideAll, onPress: () => press(latest.view.columns.filter((c) => c.shown && !c.locked).map((c) => c.id), false) }] : []),
|
|
280
|
+
...(!searching && columnsReset ? [{ label: w.columnsReset, onPress: columnsReset }] : []),
|
|
281
|
+
];
|
|
282
|
+
const columnsScreen = (_jsxs(_Fragment, { children: [phone && columnsSearch, shownHere && _jsxs(_Fragment, { children: [heading(w.shownHeading, shownActs), rowsOf(w.shownHeading, true)] }), hiddenHere && _jsxs(_Fragment, { children: [heading(w.hiddenHeading, !searching && canShow ? [{ label: w.showAll, onPress: () => press(latest.view.columns.filter((c) => !c.shown).map((c) => c.id), true) }] : undefined), rowsOf(w.hiddenHeading, false)] }), !found.length && _jsx("p", { className: "o-customize-none", children: w.noColumn(find.trim()) }), columnsFoot != null && _jsx("div", { className: "o-customize-foot-rows", children: columnsFoot })] }));
|
|
283
|
+
const backFromColumn = () => { setBack(true); setFocusTo(col?.label ?? null); setColumn(null); setChoosing(null); };
|
|
284
|
+
const columnLevel = col && (_jsxs(_Fragment, { children: [ownSettings(col.settings ?? { choices: [], toggles: [] }, col.label, col.locked ? [] : [{ kind: "check", label: w.columnShown, checked: held[col.id] ?? col.shown, onCheckedChange: (on) => press([col.id], on) }], { list: w.columnSettings(col.label) }), col.rows != null && _jsxs("div", { className: "o-customize-rows", children: [(!col.locked || columnOpensBySettings(col)) && _jsx("div", { role: "separator", className: "o-list-sep" }), col.rows] })] }));
|
|
285
|
+
const rowsOfField = (label, rows) => (phone
|
|
286
|
+
? _jsx(MenuList, { label: label, entries: rows, words: w.rows }) : _jsx(MenuListPanelRows, { label: label, entries: rows, ticks: "box", words: w.rows }));
|
|
287
|
+
const fieldScreen = field && (() => {
|
|
288
|
+
const o = field.opens;
|
|
289
|
+
if ("pick" in o)
|
|
290
|
+
return o.pick.choices.length === 0 ? _jsx("p", { className: "o-customize-none", children: w.nothingToPick })
|
|
291
|
+
: rowsOfField(field.label, [{ kind: "pick", value: o.pick.value, choices: o.pick.choices, onChoose: (v) => { if (v !== o.pick.value)
|
|
292
|
+
o.pick.onChoose(v); backFromField(); } }]);
|
|
293
|
+
if ("check" in o)
|
|
294
|
+
return o.check.choices.length === 0 ? _jsx("p", { className: "o-customize-none", children: w.nothingToPick })
|
|
295
|
+
: rowsOfField(field.label, o.check.choices.map((c) => ({ kind: "check", label: c.label, ...(c.mark != null && { icon: c.mark }), checked: o.check.values.includes(c.value),
|
|
296
|
+
onCheckedChange: (on) => o.check.onChange(on ? [...o.check.values, c.value] : o.check.values.filter((v) => v !== c.value)) })));
|
|
297
|
+
return typeof o.body === "function" ? o.body(backFromField) : o.body;
|
|
298
|
+
})();
|
|
299
|
+
const foldedScreen = folded && _jsx(_Fragment, { children: phone
|
|
300
|
+
? _jsx(MenuList, { label: w.filter, entries: [...fieldEntries(filterFields), ...fieldEntries(afterFields)], onOpen: opened, words: w.rows })
|
|
301
|
+
: _jsx(MenuListPanelRows, { label: w.filter, entries: [...fieldEntries(filterFields), ...fieldEntries(afterFields)], onOpen: opened, words: w.rows }) });
|
|
302
|
+
const content = screen === "list"
|
|
303
|
+
? phone ? _jsx(MenuList, { label: w.list, entries: sections, onOpen: opened, words: w.rows }) : _jsx(MenuListPanelRows, { label: w.list, entries: sections, ticks: "switch", onOpen: opened, words: w.rows })
|
|
304
|
+
: screen === "layout" ? choiceLevel ?? layoutScreen : screen === "columns" ? choiceLevel ?? columnLevel ?? columnsScreen
|
|
305
|
+
: screen === "filter" && (field || folded) ? fieldScreen ?? foldedScreen : handed[screen]?.opens;
|
|
306
|
+
const form = phone ? "phone" : "computer";
|
|
307
|
+
const fieldLevel = field && "body" in field.opens ? field.opens.level ?? null : null;
|
|
308
|
+
const level = choice ? { name: choice.label, back: backFromChoice } : col ? { name: col.label, back: backFromColumn }
|
|
309
|
+
: field ? fieldLevel ?? { name: field.label, back: backFromField } : screen !== "list" ? handed[screen]?.level ?? null : null, backTo = level?.back ?? goBack;
|
|
310
|
+
const named = worn.head === "name" && view.name !== "";
|
|
311
|
+
const name = screen === "list" ? (named ? view.name : w.title) : level?.name ?? NAMES[screen];
|
|
312
|
+
const titled = !named;
|
|
313
|
+
const step = choice ? (col ? `columns:${col.id}:${choice.key}` : `layout:${choice.key}`) : col ? `columns:${col.id}` : field ? `field:${field.key}` : screen;
|
|
314
|
+
if (phone) {
|
|
315
|
+
const body = (_jsx("div", { ref: placeRoot, className: "o-customize", "data-kit": "customize", "data-customize-form": form, "data-customize-screen": screen, ...phoneMark(!!host || small), ...MENU_LIST_CARD_FRAME, children: _jsx(SheetStep, { step: step, back: back, children: _jsx("div", { className: "o-customize-step", children: content }) }) }));
|
|
316
|
+
const foot = screen === "list" && (changed || footer.length) ? (_jsxs("div", { className: "o-customize-foot", ...MENU_LIST_CARD_FRAME, children: [changed && words("44"), footer.length > 0 && _jsx(MenuList, { label: w.share, entries: footer, words: w.rows })] })) : undefined;
|
|
317
|
+
return { body, title: name, head: screen === "list" ? { close: true } : { onBack: backTo, close: titled }, foot, level };
|
|
318
|
+
}
|
|
319
|
+
const title = (words) => (inPane ? _jsx(PaneTitle, { children: words }) : _jsx("h2", { className: "o-pane-title", children: words }));
|
|
320
|
+
const xButton = (extra) => _jsx(Button, { kind: "quiet", shape: "icon", size: "sm", "aria-label": w.close, icon: _jsx(Icon, { name: "x" }), ...extra });
|
|
321
|
+
const close = inPane ? _jsx(PaneClose, { render: xButton() }) : onClose ? xButton({ onClick: onClose }) : null;
|
|
322
|
+
const head = screen !== "list" ? (_jsxs(PaneHead, { className: "o-customize-head o-customize-head-screen", children: [_jsx(Button, { ref: backButton, kind: "quiet", shape: "icon", size: "sm", "aria-label": w.back, icon: _jsx(Icon, { name: "left" }), onClick: backTo }), _jsx("span", { className: "o-customize-title", children: title(name) }), titled && close] })) : titled ? (_jsxs(PaneHead, { className: "o-customize-head o-customize-head-title", children: [_jsx("span", { className: "o-customize-title", children: title(w.title) }), close] })) : (_jsxs(PaneHead, { className: "o-customize-head o-customize-head-name", children: [hasLayout && _jsx(Button, { kind: "outline", shape: "icon", size: "sm", "aria-label": w.layoutButton(layout?.name ?? ""), icon: layout?.mark, onClick: () => go("layout") }), _jsx(ViewName, { name: view.name, label: w.viewName, onRename: (n) => change({ ...latest.view, name: n }) })] }));
|
|
323
|
+
const parts = (_jsxs(_Fragment, { children: [head, screen === "columns" && !col && columnsSearch, _jsx(PaneBody, { children: _jsx("div", { ref: placeRoot, className: "o-customize", "data-kit": "customize", "data-customize-form": form, "data-customize-screen": screen, ...phoneMark(!!host || small), ...MENU_LIST_CARD_FRAME, children: _jsx(React.Fragment, { children: content }, step) }) }), screen === "list" && changed && words("xs"), footer.length > 0 && _jsx(PaneFoot, { children: _jsx(MenuListPanelRows, { label: w.share, entries: footer, words: w.rows }) })] }));
|
|
324
|
+
return { body: inPane ? parts : _jsx("div", { className: "o-customize-frame", children: parts }), title: name, head: {}, level };
|
|
325
|
+
}
|
|
326
|
+
function ViewName({ name, label, onRename }) {
|
|
327
|
+
const [draft, setDraft] = React.useState(name);
|
|
328
|
+
React.useEffect(() => setDraft(name), [name]);
|
|
329
|
+
const keep = () => { const n = draft.trim(); if (!n)
|
|
330
|
+
setDraft(name);
|
|
331
|
+
else if (n !== name)
|
|
332
|
+
onRename(n);
|
|
333
|
+
else
|
|
334
|
+
setDraft(name); };
|
|
335
|
+
return (_jsx("span", { className: "o-customize-name", children: _jsx(Input, { size: "sm", "aria-label": label, value: draft, onChange: (e) => setDraft(e.target.value), onBlur: keep, onKeyDown: (e) => {
|
|
336
|
+
if (e.key === "Enter") {
|
|
337
|
+
e.preventDefault();
|
|
338
|
+
keep();
|
|
339
|
+
}
|
|
340
|
+
if (e.key === "Escape" && draft !== name) {
|
|
341
|
+
e.preventDefault();
|
|
342
|
+
setDraft(name);
|
|
343
|
+
}
|
|
344
|
+
} }) }));
|
|
345
|
+
}
|
|
346
|
+
export function Customize(props) {
|
|
347
|
+
return _jsx(_Fragment, { children: useCustomize({ ...props, form: props.form ?? "computer" }).body });
|
|
348
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export declare const groundOf: (el: Element) => string;
|
|
3
|
+
/** Whether the person asked for less motion. */
|
|
4
|
+
export declare const reduced: () => boolean;
|
|
5
|
+
/** How long a tick takes to show its new state: the Switch's own slide (its thumb's longest transition, whichever Motion it wears),
|
|
6
|
+
* or, where the ticks are eyes, the eye's slash being drawn (KIT-826); `--customize-tick` (`--vk-duration-fast`) where it finds neither. */
|
|
7
|
+
export declare function slideTime(root: HTMLElement | null): number;
|
|
8
|
+
/** A change that glides: `apply` hands it on, and once it is drawn every row and heading in `root` that moved slides from where it
|
|
9
|
+
* stood, and one that is new fades in; the rows named in `lead` (the ones pressed) over the others. */
|
|
10
|
+
export declare function useGlide(root: React.RefObject<HTMLElement | null>): (apply: () => void, lead?: string[]) => void;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const MOVES = "[data-item], .o-menu-list-row, .o-customize-heading";
|
|
3
|
+
const keyOf = (el) => `${el.matches(".o-customize-heading") ? "h" : "r"}:${el.querySelector(".o-list-heading, .o-menu-name, .o-menu-list-name > span:first-child")?.textContent ?? ""}`;
|
|
4
|
+
const ms = (v) => { const t = v.trim(); return t.endsWith("ms") ? parseFloat(t) : t.endsWith("s") ? parseFloat(t) * 1000 : parseFloat(t) || 0; };
|
|
5
|
+
const token = (name, el) => getComputedStyle(el ?? document.documentElement).getPropertyValue(name);
|
|
6
|
+
const alphaOf = (colour) => {
|
|
7
|
+
const c = colour.trim();
|
|
8
|
+
if (!c || c === "transparent")
|
|
9
|
+
return 0;
|
|
10
|
+
const commas = /^(?:rgb|hsl)a?\(([^)/]*)\)$/.exec(c)?.[1]?.split(",");
|
|
11
|
+
const said = /\/\s*([\d.]+)(%?)\s*\)$/.exec(c) ?? (commas?.length === 4 ? /([\d.]+)(%?)\s*$/.exec(commas[3]) : null);
|
|
12
|
+
return said ? parseFloat(said[1]) / (said[2] ? 100 : 1) : 1;
|
|
13
|
+
};
|
|
14
|
+
export const groundOf = (el) => {
|
|
15
|
+
for (let n = el.parentElement; n; n = n.parentElement) {
|
|
16
|
+
const c = getComputedStyle(n).backgroundColor;
|
|
17
|
+
if (alphaOf(c) >= 1)
|
|
18
|
+
return c;
|
|
19
|
+
}
|
|
20
|
+
return token("--customize-ground", el).trim();
|
|
21
|
+
};
|
|
22
|
+
export const reduced = () => typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
23
|
+
export function slideTime(root) {
|
|
24
|
+
const tick = root?.querySelector(".o-switch-thumb, .o-eye-slash");
|
|
25
|
+
if (tick)
|
|
26
|
+
return Math.max(0, ...getComputedStyle(tick).transitionDuration.split(",").map(ms));
|
|
27
|
+
return ms(token("--customize-tick", root));
|
|
28
|
+
}
|
|
29
|
+
export function useGlide(root) {
|
|
30
|
+
const before = React.useRef(null);
|
|
31
|
+
React.useLayoutEffect(() => {
|
|
32
|
+
const was = before.current;
|
|
33
|
+
if (!was || !root.current)
|
|
34
|
+
return;
|
|
35
|
+
before.current = null;
|
|
36
|
+
const duration = ms(token("--customize-glide", root.current)), easing = token("--customize-glide-ease", root.current).trim() || "ease-in-out";
|
|
37
|
+
for (const el of root.current.querySelectorAll(MOVES)) {
|
|
38
|
+
const key = keyOf(el), from = was.at.get(key), dy = from === undefined ? 0 : from - el.getBoundingClientRect().top;
|
|
39
|
+
const over = was.lead.has(key) ? { position: "relative", zIndex: "1", backgroundColor: groundOf(el) } : {};
|
|
40
|
+
if (from === undefined)
|
|
41
|
+
el.animate([{ opacity: 0 }, { opacity: 1 }], { duration, easing });
|
|
42
|
+
else if (Math.abs(dy) > 0.5)
|
|
43
|
+
el.animate([{ transform: `translateY(${dy}px)`, ...over }, { transform: "none", ...over }], { duration, easing });
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return (apply, lead = []) => {
|
|
47
|
+
if (root.current && !reduced()) {
|
|
48
|
+
const at = new Map();
|
|
49
|
+
for (const el of root.current.querySelectorAll(MOVES))
|
|
50
|
+
at.set(keyOf(el), el.getBoundingClientRect().top);
|
|
51
|
+
before.current = { at, lead: new Set(lead.map((name) => `r:${name}`)) };
|
|
52
|
+
}
|
|
53
|
+
apply();
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type PieceLooks } from "../../looks/looks.js";
|
|
2
|
+
export type CustomizeOptionId = "head" | "columns";
|
|
3
|
+
/** What Customize reads from the frame round it. */
|
|
4
|
+
export interface CustomizeWorn {
|
|
5
|
+
head: "name" | "title";
|
|
6
|
+
columns: "switch" | "eye";
|
|
7
|
+
}
|
|
8
|
+
/** Customize's options; it has no looks. */
|
|
9
|
+
export declare const CUSTOMIZE_LOOKS: PieceLooks<CustomizeOptionId>;
|
|
10
|
+
/** The options worn round `el`, each from the nearest frame that picks it; outside any frame, the defaults. */
|
|
11
|
+
export declare function customizeWornOf(el: Element | null): CustomizeWorn;
|
|
12
|
+
/** The attributes Customize watches, so an option changed while it is open reaches it. */
|
|
13
|
+
export declare const CUSTOMIZE_ATTRS: string[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { lookWornOf } from "../../looks/looks.js";
|
|
2
|
+
const options = [
|
|
3
|
+
{ id: "head", name: "Its head", def: "title", values: [{ id: "name", name: "The view's name" }, { id: "title", name: "A title" }] },
|
|
4
|
+
{ id: "columns", name: "Columns", def: "switch", values: [{ id: "switch", name: "Switches" }, { id: "eye", name: "Eyes" }] },
|
|
5
|
+
];
|
|
6
|
+
export const CUSTOMIZE_LOOKS = { id: "customize", name: "Customize", options, looks: [] };
|
|
7
|
+
export function customizeWornOf(el) {
|
|
8
|
+
const worn = lookWornOf(CUSTOMIZE_LOOKS, el, ["head", "columns"]);
|
|
9
|
+
return { head: worn.head === "title" ? "title" : "name", columns: worn.columns === "eye" ? "eye" : "switch" };
|
|
10
|
+
}
|
|
11
|
+
export const CUSTOMIZE_ATTRS = CUSTOMIZE_LOOKS.options.map((o) => `data-customize-${o.id}`);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ViewsMessageResolver } from "../../contract.js";
|
|
2
|
+
import type { ViewsCustomizeBodyProps } from "../../provider/components.js";
|
|
3
|
+
import { type CustomizeView } from "./customize.js";
|
|
4
|
+
import type { CustomizeWords } from "./words.js";
|
|
5
|
+
/** The view's name and its rename, Copy link, and Export CSV with its count: what the toolbar hands Customize's body, each drawn
|
|
6
|
+
* only where handed. */
|
|
7
|
+
export type CustomizeBodyOwn = Pick<ViewsCustomizeBodyProps, "name" | "onRename" | "exportCount" | "onCopyLink" | "onExport">;
|
|
8
|
+
/** Customize's words in the app's: ViewKit's key wherever its word is the kit's, a key of its own where it differs. */
|
|
9
|
+
export declare function customizeWordsOf(say: ViewsMessageResolver): CustomizeWords;
|
|
10
|
+
/** The one write a change of Customize's view makes, or null, compared with the view as drawn (a second change built before it
|
|
11
|
+
* draws again, two moves of one drag, still writes whole and right): the first of its name, its layout (one the list offers; a
|
|
12
|
+
* refused one writes nothing) and its columns that differs. Columns, one or several shown or hidden (Hide all, Show all) or moved,
|
|
13
|
+
* through ViewKit's own, in one change. */
|
|
14
|
+
export declare function customizeWriteOf(p: ViewsCustomizeBodyProps, own: CustomizeBodyOwn, now: CustomizeView, next: CustomizeView): (() => void) | null;
|
|
15
|
+
export declare function MapCustomizeBody(props: ViewsCustomizeBodyProps): import("react/jsx-runtime").JSX.Element;
|