@cube-dev/ui-kit 0.0.0-canary-c325dcb → 0.0.0-canary-162cdb3
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/dist/CHANGELOG.md +8 -0
- package/dist/_internal/hooks/use-debounced-value.js +1 -1
- package/dist/_internal/hooks/use-deprecation-warning.js +1 -1
- package/dist/_internal/hooks/use-event.js +1 -1
- package/dist/_internal/hooks/use-is-first-render.js +1 -1
- package/dist/_internal/hooks/use-sync-ref.js +1 -1
- package/dist/_internal/hooks/use-timer/timer.js +1 -1
- package/dist/_internal/hooks/use-timer/use-timer.js +1 -1
- package/dist/_internal/hooks/use-warn.js +1 -1
- package/dist/components/Block.js +1 -1
- package/dist/components/CollectionItem.js +1 -1
- package/dist/components/GlobalStyles.js +1 -1
- package/dist/components/GridProvider.js +1 -1
- package/dist/components/HiddenInput.js +1 -1
- package/dist/components/Root.js +1 -1
- package/dist/components/actions/Action/Action.js +1 -1
- package/dist/components/actions/Banner/Banner.js +1 -1
- package/dist/components/actions/Button/Button.js +1 -1
- package/dist/components/actions/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/components/actions/ButtonSplit/ButtonSplit.js +1 -1
- package/dist/components/actions/ButtonSplit/context.js +1 -1
- package/dist/components/actions/CommandMenu/CommandMenu.js +201 -201
- package/dist/components/actions/CommandMenu/CommandMenu.js.map +1 -1
- package/dist/components/actions/CommandMenu/styled.js +1 -1
- package/dist/components/actions/ItemAction/ItemAction.js +1 -1
- package/dist/components/actions/ItemActionContext.js +1 -1
- package/dist/components/actions/ItemActionsWrapper.js +1 -1
- package/dist/components/actions/ItemButton/ItemButton.js +1 -1
- package/dist/components/actions/Link/Link.js +1 -1
- package/dist/components/actions/Menu/Menu.js +1 -1
- package/dist/components/actions/Menu/MenuItem.js +1 -1
- package/dist/components/actions/Menu/MenuSection.js +1 -1
- package/dist/components/actions/Menu/MenuTrigger.js +1 -1
- package/dist/components/actions/Menu/SubMenuTrigger.js +1 -1
- package/dist/components/actions/Menu/SubmenuTriggerContext.js +1 -1
- package/dist/components/actions/Menu/context.js +1 -1
- package/dist/components/actions/Menu/styled.js +1 -1
- package/dist/components/actions/actions-run.js +1 -1
- package/dist/components/actions/index.js +1 -1
- package/dist/components/actions/use-action.js +1 -1
- package/dist/components/actions/use-anchored-menu.js +1 -1
- package/dist/components/actions/use-context-menu.js +1 -1
- package/dist/components/content/ActiveZone/ActiveZone.js +1 -1
- package/dist/components/content/Alert/Alert.js +1 -1
- package/dist/components/content/Alert/use-alert.js +1 -1
- package/dist/components/content/Avatar/Avatar.js +1 -1
- package/dist/components/content/Badge/Badge.js +1 -1
- package/dist/components/content/Card/Card.js +1 -1
- package/dist/components/content/Content.js +1 -1
- package/dist/components/content/CopyPasteBlock/CopyPasteBlock.js +1 -1
- package/dist/components/content/CopySnippet/CopySnippet.d.ts +6 -6
- package/dist/components/content/CopySnippet/CopySnippet.js +1 -1
- package/dist/components/content/Disclosure/Disclosure.js +1 -1
- package/dist/components/content/Divider.js +1 -1
- package/dist/components/content/Footer.js +1 -1
- package/dist/components/content/Header.js +1 -1
- package/dist/components/content/HotKeys/HotKeys.js +1 -1
- package/dist/components/content/InfoBadge/InfoBadge.js +1 -1
- package/dist/components/content/InlineInput/InlineInput.js +1 -1
- package/dist/components/content/Item/Item.js +1 -1
- package/dist/components/content/ItemBadge/ItemBadge.js +1 -1
- package/dist/components/content/ItemCard/ItemCard.js +1 -1
- package/dist/components/content/Layout/GridLayout.js +1 -1
- package/dist/components/content/Layout/Layout.js +1 -1
- package/dist/components/content/Layout/LayoutBlock.js +1 -1
- package/dist/components/content/Layout/LayoutCenter.js +1 -1
- package/dist/components/content/Layout/LayoutContainer.js +1 -1
- package/dist/components/content/Layout/LayoutContent.js +1 -1
- package/dist/components/content/Layout/LayoutContext.js +1 -1
- package/dist/components/content/Layout/LayoutFlex.js +1 -1
- package/dist/components/content/Layout/LayoutFooter.js +1 -1
- package/dist/components/content/Layout/LayoutGrid.js +1 -1
- package/dist/components/content/Layout/LayoutHeader.js +1 -1
- package/dist/components/content/Layout/LayoutPane.js +1 -1
- package/dist/components/content/Layout/LayoutPanel.js +1 -1
- package/dist/components/content/Layout/LayoutPanelHeader.js +1 -1
- package/dist/components/content/Layout/LayoutPanelTransition.js +1 -1
- package/dist/components/content/Layout/LayoutToolbar.js +1 -1
- package/dist/components/content/Layout/hooks/useTinyScrollbar.js +1 -1
- package/dist/components/content/Layout/index.js +1 -1
- package/dist/components/content/Layout/utils.js +1 -1
- package/dist/components/content/Paragraph.js +1 -1
- package/dist/components/content/Placeholder/Placeholder.js +1 -1
- package/dist/components/content/PrismCode/PrismCode.js +1 -1
- package/dist/components/content/PrismCode/prismSetup.js +1 -1
- package/dist/components/content/PrismDiffCode/PrismDiffCode.js +1 -1
- package/dist/components/content/Result/Result.js +1 -1
- package/dist/components/content/Skeleton/Skeleton.js +1 -1
- package/dist/components/content/Tag/Tag.js +1 -1
- package/dist/components/content/Text.js +1 -1
- package/dist/components/content/TextItem/TextItem.js +1 -1
- package/dist/components/content/Title.js +1 -1
- package/dist/components/content/Tree/Tree.js +1 -1
- package/dist/components/content/Tree/TreeNode.js +1 -1
- package/dist/components/content/Tree/styled.js +1 -1
- package/dist/components/content/Tree/tree-index.js +1 -1
- package/dist/components/content/Tree/use-checkbox-tree.js +1 -1
- package/dist/components/content/Tree/use-load-data.js +1 -1
- package/dist/components/content/highlightText.js +1 -1
- package/dist/components/content/use-auto-tooltip.js +1 -1
- package/dist/components/data/DataTable/DataTable.js +1 -1
- package/dist/components/data/ItemTable/ItemTable.js +1 -1
- package/dist/components/data/ItemTable/ItemTableBulkBar.js +1 -1
- package/dist/components/data/ItemTable/ItemTableDragPreview.js +1 -1
- package/dist/components/data/ItemTable/ItemTableFooter.js +1 -1
- package/dist/components/data/ItemTable/ItemTableToolbar.js +1 -1
- package/dist/components/data/ItemTable/use-item-table-column-widths.js +1 -1
- package/dist/components/data/ItemTable/use-item-table-drag-drop.js +1 -1
- package/dist/components/data/ItemTable/use-item-table-pagination.js +1 -1
- package/dist/components/data/ItemTable/use-item-table-selection.js +1 -1
- package/dist/components/data/ItemTable/use-item-table-sort.js +1 -1
- package/dist/components/data/ItemTable/use-item-table-tree-model.js +1 -1
- package/dist/components/data/TableBase/ColumnResizer.js +3 -3
- package/dist/components/data/TableBase/ColumnResizer.js.map +1 -1
- package/dist/components/data/TableBase/RowCollection.js +1 -1
- package/dist/components/data/TableBase/TableHeaderCell.js +1 -1
- package/dist/components/data/TableBase/TableRow.js +1 -1
- package/dist/components/data/TableBase/TableView.js +1 -1
- package/dist/components/data/TableBase/TreeGridTable.js +1 -1
- package/dist/components/data/TableBase/column-header.js +1 -1
- package/dist/components/data/TableBase/column-menu.js +1 -1
- package/dist/components/data/TableBase/column-styles.js +1 -1
- package/dist/components/data/TableBase/column-tint.js +1 -1
- package/dist/components/data/TableBase/row-menu.js +1 -1
- package/dist/components/data/TableBase/styled.js +1 -1
- package/dist/components/data/TableBase/table-tree.js +1 -1
- package/dist/components/data/TableBase/types.js +1 -1
- package/dist/components/data/TableBase/use-cell-selection.js +0 -0
- package/dist/components/data/TableBase/use-column-menu.js +1 -1
- package/dist/components/data/TableBase/use-column-order.js +1 -1
- package/dist/components/data/TableBase/use-container-width.js +1 -1
- package/dist/components/data/TableBase/use-row-move-animation.js +1 -1
- package/dist/components/data/TableBase/use-scrollability.js +1 -1
- package/dist/components/data/TableBase/use-table-columns.js +154 -166
- package/dist/components/data/TableBase/use-table-columns.js.map +1 -1
- package/dist/components/data/TableBase/use-table-search.js +1 -1
- package/dist/components/data/TableBase/use-table-selection.js +1 -1
- package/dist/components/data/TableBase/use-table-sort.js +1 -1
- package/dist/components/data/TableBase/use-table-sorts.js +1 -1
- package/dist/components/data/TableBase/use-table-storage.js +1 -1
- package/dist/components/data/TableBase/use-table-tooltip-refresh.js +1 -1
- package/dist/components/data/TableBase/use-table-tree-state.js +1 -1
- package/dist/components/fields/Checkbox/Checkbox.js +1 -1
- package/dist/components/fields/Checkbox/CheckboxGroup.js +1 -1
- package/dist/components/fields/Checkbox/context.js +1 -1
- package/dist/components/fields/ColorInput/ColorInput.js +1 -1
- package/dist/components/fields/ColorPicker/ColorPicker.js +1 -1
- package/dist/components/fields/ColorSwatch/ColorSwatch.js +1 -1
- package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js +1 -1
- package/dist/components/fields/ComboBox/ComboBox.js +194 -160
- package/dist/components/fields/ComboBox/ComboBox.js.map +1 -1
- package/dist/components/fields/CommandTextArea/CommandTextArea.js +1 -1
- package/dist/components/fields/CommandTextArea/caretPosition.js +1 -1
- package/dist/components/fields/CommandTextArea/useCaretAnchor.js +1 -1
- package/dist/components/fields/DatePicker/DateInput.js +1 -1
- package/dist/components/fields/DatePicker/DateInputBase.js +1 -1
- package/dist/components/fields/DatePicker/DatePicker.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerButton.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerElement.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerInput.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerSegment.js +1 -1
- package/dist/components/fields/DatePicker/DateRangePicker.js +1 -1
- package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js +1 -1
- package/dist/components/fields/DatePicker/MonthPicker.js +1 -1
- package/dist/components/fields/DatePicker/PeriodPicker.js +1 -1
- package/dist/components/fields/DatePicker/QuarterPicker.js +1 -1
- package/dist/components/fields/DatePicker/TimeInput.js +1 -1
- package/dist/components/fields/DatePicker/WeekPicker.js +1 -1
- package/dist/components/fields/DatePicker/YearPicker.js +1 -1
- package/dist/components/fields/DatePicker/parseDate.js +1 -1
- package/dist/components/fields/DatePicker/period.js +1 -1
- package/dist/components/fields/DatePicker/props.js +1 -1
- package/dist/components/fields/DatePicker/utils.js +1 -1
- package/dist/components/fields/FileInput/FileInput.js +1 -1
- package/dist/components/fields/FilterListBox/FilterListBox.js +1 -1
- package/dist/components/fields/FilterPicker/FilterPicker.js +1 -1
- package/dist/components/fields/Input/Input.js +1 -1
- package/dist/components/fields/ListBox/DraggableListBox.js +1 -1
- package/dist/components/fields/ListBox/ListBox.js +15 -8
- package/dist/components/fields/ListBox/ListBox.js.map +1 -1
- package/dist/components/fields/ListBox/optionId.js +1 -1
- package/dist/components/fields/ListBoxPopover/ListBoxPopover.js +1 -1
- package/dist/components/fields/ListBoxPopover/listNavigation.js +1 -1
- package/dist/components/fields/ListBoxPopover/useCompositeFocus.js +1 -1
- package/dist/components/fields/NumberInput/NumberInput.js +1 -1
- package/dist/components/fields/NumberInput/StepButton.js +1 -1
- package/dist/components/fields/PasswordInput/PasswordInput.js +1 -1
- package/dist/components/fields/Picker/Picker.js +1 -1
- package/dist/components/fields/RadioGroup/Radio.d.ts +4 -4
- package/dist/components/fields/RadioGroup/Radio.js +1 -1
- package/dist/components/fields/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/fields/RadioGroup/context.js +1 -1
- package/dist/components/fields/SearchComboBox/SearchComboBox.js +71 -67
- package/dist/components/fields/SearchComboBox/SearchComboBox.js.map +1 -1
- package/dist/components/fields/SearchInput/SearchInput.js +1 -1
- package/dist/components/fields/Select/Select.js +1 -1
- package/dist/components/fields/Slider/Gradation.js +1 -1
- package/dist/components/fields/Slider/HueSlider.js +1 -1
- package/dist/components/fields/Slider/RangeSlider.js +1 -1
- package/dist/components/fields/Slider/Slider.js +1 -1
- package/dist/components/fields/Slider/SliderBase.js +1 -1
- package/dist/components/fields/Slider/SliderThumb.js +1 -1
- package/dist/components/fields/Slider/SliderTrack.js +1 -1
- package/dist/components/fields/Slider/elements.js +1 -1
- package/dist/components/fields/Slider/index.js +1 -1
- package/dist/components/fields/Switch/Switch.js +1 -1
- package/dist/components/fields/TagInput/TagInput.js +1 -1
- package/dist/components/fields/TagInput/TagList.js +1 -1
- package/dist/components/fields/TagInput/useActiveOption.js +1 -1
- package/dist/components/fields/TagInput/useTagError.js +1 -1
- package/dist/components/fields/TextArea/TextArea.js +1 -1
- package/dist/components/fields/TextInput/TextInput.js +1 -1
- package/dist/components/fields/TextInput/TextInputBase.js +1 -1
- package/dist/components/fields/TextInput/useAutoSizeTextArea.js +1 -1
- package/dist/components/fields/TextInputMapper/TextInputMapper.js +1 -1
- package/dist/components/fields/TriggerActions.js +1 -1
- package/dist/components/fields/color/ColorPanel.js +1 -1
- package/dist/components/fields/color/channels.js +1 -1
- package/dist/components/fields/color/color.js +1 -1
- package/dist/components/fields/color/context.js +1 -1
- package/dist/components/form/FieldWrapper/FieldWrapper.js +1 -1
- package/dist/components/form/Form/Field.js +1 -1
- package/dist/components/form/Form/Form.js +1 -1
- package/dist/components/form/Form/ModernFormRoot.js +1 -1
- package/dist/components/form/Form/ResetButton/ResetButton.js +1 -1
- package/dist/components/form/Form/SubmitButton/SubmitButton.js +1 -1
- package/dist/components/form/Form/SubmitError.js +1 -1
- package/dist/components/form/Form/backend.js +1 -1
- package/dist/components/form/Form/index.js +1 -1
- package/dist/components/form/Form/modern/actions.js +1 -1
- package/dist/components/form/Form/modern/context.js +1 -1
- package/dist/components/form/Form/modern/controller.js +1 -1
- package/dist/components/form/Form/modern/field-binding.js +1 -1
- package/dist/components/form/Form/modern/field.js +1 -1
- package/dist/components/form/Form/modern/react.js +1 -1
- package/dist/components/form/Form/modern/store.js +1 -1
- package/dist/components/form/Form/modern/validation.js +1 -1
- package/dist/components/form/Form/modern/values.js +1 -1
- package/dist/components/form/Form/reset-unbound-controls.js +1 -1
- package/dist/components/form/Form/use-field/use-field-binding.js +1 -1
- package/dist/components/form/Form/use-field/use-field-props.js +1 -1
- package/dist/components/form/Form/use-field/use-field.js +1 -1
- package/dist/components/form/Form/use-form.js +1 -1
- package/dist/components/form/Form/validation.js +1 -1
- package/dist/components/form/Label.js +1 -1
- package/dist/components/form/legacy-tooltip.js +1 -1
- package/dist/components/form/validation/ValidationIndicator.js +1 -1
- package/dist/components/form/validation/resolve-validation-props.js +1 -1
- package/dist/components/form/validation/use-validation-props.js +1 -1
- package/dist/components/form/wrapper.js +1 -1
- package/dist/components/helpers/DisplayTransition/DisplayTransition.js +1 -1
- package/dist/components/helpers/IconSwitch/IconSwitch.js +1 -1
- package/dist/components/layout/Flex.js +1 -1
- package/dist/components/layout/Flow.js +1 -1
- package/dist/components/layout/Grid.js +1 -1
- package/dist/components/layout/Panel.js +1 -1
- package/dist/components/layout/Prefix.js +1 -1
- package/dist/components/layout/ResizablePanel.js +1 -1
- package/dist/components/layout/Space.js +1 -1
- package/dist/components/layout/Suffix.js +1 -1
- package/dist/components/navigation/Pagination/Pagination.js +1 -1
- package/dist/components/navigation/Pagination/use-pagination.js +1 -1
- package/dist/components/navigation/Tabs/BoardDragActiveProvider.d.ts +36 -0
- package/dist/components/navigation/Tabs/BoardDragActiveProvider.js +57 -0
- package/dist/components/navigation/Tabs/BoardDragActiveProvider.js.map +1 -0
- package/dist/components/navigation/Tabs/DraggableTabList.js +1 -1
- package/dist/components/navigation/Tabs/TabButton.js +2 -2
- package/dist/components/navigation/Tabs/TabButton.js.map +1 -1
- package/dist/components/navigation/Tabs/TabDropIndicator.js +1 -1
- package/dist/components/navigation/Tabs/TabPanel.js +1 -1
- package/dist/components/navigation/Tabs/TabPicker.js +1 -1
- package/dist/components/navigation/Tabs/Tabs.js +2 -2
- package/dist/components/navigation/Tabs/Tabs.js.map +1 -1
- package/dist/components/navigation/Tabs/TabsAction.js +1 -1
- package/dist/components/navigation/Tabs/TabsContext.js +1 -1
- package/dist/components/navigation/Tabs/index.d.ts +2 -1
- package/dist/components/navigation/Tabs/popover-placement.js +1 -1
- package/dist/components/navigation/Tabs/styled.js +1 -1
- package/dist/components/navigation/Tabs/types.js +1 -1
- package/dist/components/navigation/Tabs/use-tab-editing.js +1 -1
- package/dist/components/navigation/Tabs/use-tab-indicator.js +1 -1
- package/dist/components/navigation/index.d.ts +1 -0
- package/dist/components/organisms/StatsCard/StatsCard.js +1 -1
- package/dist/components/other/Calendar/Calendar.js +1 -1
- package/dist/components/other/Calendar/CalendarCell.js +1 -1
- package/dist/components/other/Calendar/CalendarGrid.js +1 -1
- package/dist/components/other/Calendar/CalendarHeader.js +1 -1
- package/dist/components/other/Calendar/CalendarPanel.js +1 -1
- package/dist/components/other/Calendar/PeriodCalendar.js +1 -1
- package/dist/components/other/Calendar/PeriodGrid.js +1 -1
- package/dist/components/other/Calendar/RangeCalendar.js +1 -1
- package/dist/components/other/Calendar/styled.js +1 -1
- package/dist/components/other/CubeLogo/CubeLogo.js +1 -1
- package/dist/components/other/NoDataIcon/NoDataIcon.js +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialog.js +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialogApiProvider.js +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialogZone.js +1 -1
- package/dist/components/overlays/Dialog/Dialog.js +1 -1
- package/dist/components/overlays/Dialog/DialogContainer.js +1 -1
- package/dist/components/overlays/Dialog/DialogForm.js +1 -1
- package/dist/components/overlays/Dialog/DialogTrigger.js +1 -1
- package/dist/components/overlays/Dialog/ModernDialogForm.js +1 -1
- package/dist/components/overlays/Dialog/context.js +1 -1
- package/dist/components/overlays/Dialog/default-button-text.js +1 -1
- package/dist/components/overlays/Dialog/use-content-overflow.js +1 -1
- package/dist/components/overlays/Dialog/use-dialog-container.js +1 -1
- package/dist/components/overlays/Modal/Modal.js +1 -1
- package/dist/components/overlays/Modal/OpenTransitionContext.js +1 -1
- package/dist/components/overlays/Modal/Overlay.js +1 -1
- package/dist/components/overlays/Modal/Popover.js +1 -1
- package/dist/components/overlays/Modal/Tray.js +1 -1
- package/dist/components/overlays/Modal/Underlay.js +1 -1
- package/dist/components/overlays/Notifications/Notification.js +1 -1
- package/dist/components/overlays/Notifications/NotificationAction.js +1 -1
- package/dist/components/overlays/Notifications/NotificationCard.js +1 -1
- package/dist/components/overlays/Notifications/NotificationContext.js +1 -1
- package/dist/components/overlays/Notifications/NotificationItem.js +1 -1
- package/dist/components/overlays/Notifications/OverlayContainer.js +1 -1
- package/dist/components/overlays/Notifications/OverlayProvider.js +1 -1
- package/dist/components/overlays/Notifications/PersistentNotificationsList.js +1 -1
- package/dist/components/overlays/Notifications/dismissed-storage.js +1 -1
- package/dist/components/overlays/Notifications/format-relative-time.js +1 -1
- package/dist/components/overlays/Notifications/index.js +1 -1
- package/dist/components/overlays/Notifications/use-notification-state.js +1 -1
- package/dist/components/overlays/Notifications/use-notifications.js +1 -1
- package/dist/components/overlays/Notifications/use-overlay-timers.js +1 -1
- package/dist/components/overlays/Notifications/use-persistent-notifications.js +1 -1
- package/dist/components/overlays/Notifications/use-persistent-state.js +1 -1
- package/dist/components/overlays/Notifications/use-toast-state.js +1 -1
- package/dist/components/overlays/Toast/ToastItem.js +1 -1
- package/dist/components/overlays/Toast/index.js +1 -1
- package/dist/components/overlays/Toast/useProgressToast.js +1 -1
- package/dist/components/overlays/Toast/useToast.js +1 -1
- package/dist/components/overlays/Tooltip/Tooltip.js +1 -1
- package/dist/components/overlays/Tooltip/TooltipProvider.js +1 -1
- package/dist/components/overlays/Tooltip/TooltipTrigger.js +1 -1
- package/dist/components/overlays/Tooltip/context.js +1 -1
- package/dist/components/overlays/Tooltip/split-trigger-props.js +1 -1
- package/dist/components/portal/Portal.js +1 -1
- package/dist/components/portal/PortalProvider.js +1 -1
- package/dist/components/portal/usePortal.js +1 -1
- package/dist/components/shared/DraggableCollection.js +1 -1
- package/dist/components/shared/InvalidIcon.js +1 -1
- package/dist/components/shared/ValidIcon.js +1 -1
- package/dist/components/status/LoadingAnimation/LoadingAnimation.js +1 -1
- package/dist/components/status/Spin/Cube.js +1 -1
- package/dist/components/status/Spin/InternalSpinner.js +1 -1
- package/dist/components/status/Spin/Spin.js +1 -1
- package/dist/components/status/Spin/SpinsContainer.js +1 -1
- package/dist/data/item-themes.js +1 -1
- package/dist/data/themes.js +1 -1
- package/dist/eslint-plugin/defaults.generated.js +1 -83
- package/dist/eslint-plugin/defaults.generated.js.map +1 -1
- package/dist/eslint-plugin/index.js +1 -1
- package/dist/eslint-plugin/rules/no-redundant-default-prop.js +1 -1
- package/dist/i18n/I18nProvider.js +1 -1
- package/dist/i18n/createFormatter.js +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/instance.js +1 -1
- package/dist/i18n/locales/de-DE/uikit.js +1 -9
- package/dist/i18n/locales/en-US/uikit.js +1 -9
- package/dist/i18n/locales/en-US/uikit.json.d.ts +1 -9
- package/dist/i18n/locales/es-ES/uikit.js +1 -9
- package/dist/i18n/locales/es-MX/uikit.js +1 -9
- package/dist/i18n/locales/fr-FR/uikit.js +1 -9
- package/dist/i18n/locales/it-IT/uikit.js +1 -9
- package/dist/i18n/locales/ja-JP/uikit.js +1 -9
- package/dist/i18n/locales/nb-NO/uikit.js +1 -9
- package/dist/i18n/locales/pt-BR/uikit.js +1 -9
- package/dist/i18n/locales/pt-PT/uikit.js +1 -9
- package/dist/i18n/locales/sv-SE/uikit.js +1 -9
- package/dist/i18n/locales/vi-VN/uikit.js +1 -9
- package/dist/i18n/locales.js +1 -1
- package/dist/i18n/useFormatter.js +1 -1
- package/dist/i18n/useI18n.js +1 -1
- package/dist/icons/AdjustmentsHorizontalIcon.js +1 -1
- package/dist/icons/AdjustmentsIcon.js +1 -1
- package/dist/icons/AiIcon.js +1 -1
- package/dist/icons/AreaChartIcon.js +1 -1
- package/dist/icons/ArrowNarrowDownIcon.js +1 -1
- package/dist/icons/ArrowNarrowUpIcon.js +1 -1
- package/dist/icons/BackwardIcon.js +1 -1
- package/dist/icons/BarChartIcon.js +1 -1
- package/dist/icons/BellFilledIcon.js +1 -1
- package/dist/icons/BellIcon.js +1 -1
- package/dist/icons/BooleanIcon.js +1 -1
- package/dist/icons/CalendarEditIcon.js +1 -1
- package/dist/icons/CalendarIcon.js +1 -1
- package/dist/icons/CaretDownIcon.js +1 -1
- package/dist/icons/CaretUpIcon.js +1 -1
- package/dist/icons/ChartAreaStackedIcon.js +1 -1
- package/dist/icons/ChartAreaStackedPercentageIcon.js +1 -1
- package/dist/icons/ChartBarGroupedHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarGroupedIcon.js +1 -1
- package/dist/icons/ChartBarHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarLineIcon.js +1 -1
- package/dist/icons/ChartBarStackedHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarStackedIcon.js +1 -1
- package/dist/icons/ChartBarStackedPercentageHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarStackedPercentageIcon.js +1 -1
- package/dist/icons/ChartBoxPlot2Icon.js +1 -1
- package/dist/icons/ChartBoxPlotIcon.js +1 -1
- package/dist/icons/ChartBubbleIcon.js +1 -1
- package/dist/icons/ChartDonut2Icon.js +1 -1
- package/dist/icons/ChartFunnelIcon.js +1 -1
- package/dist/icons/ChartHeatmapIcon.js +1 -1
- package/dist/icons/ChartKPIIcon.js +1 -1
- package/dist/icons/ChartPie2Icon.js +1 -1
- package/dist/icons/ChartScatterIcon.js +1 -1
- package/dist/icons/CheckCircleFilledIcon.js +1 -1
- package/dist/icons/CheckCircleIcon.js +1 -1
- package/dist/icons/CheckIcon.js +1 -1
- package/dist/icons/CircleFilledIcon.js +1 -1
- package/dist/icons/ClearIcon.js +1 -1
- package/dist/icons/CloseCircleFilledIcon.js +1 -1
- package/dist/icons/CloseCircleIcon.js +1 -1
- package/dist/icons/CloseIcon.js +1 -1
- package/dist/icons/CodeIcon.js +1 -1
- package/dist/icons/ColumnTotalIcon.js +1 -1
- package/dist/icons/CopyIcon.js +1 -1
- package/dist/icons/CountIcon.js +1 -1
- package/dist/icons/CubeIcon.js +1 -1
- package/dist/icons/CubePauseIcon.js +1 -1
- package/dist/icons/CubePlayIcon.js +1 -1
- package/dist/icons/CurrencyDollarIcon.js +1 -1
- package/dist/icons/DangerIcon.js +1 -1
- package/dist/icons/DashboardIcon.js +1 -1
- package/dist/icons/DatabaseIcon.js +1 -1
- package/dist/icons/DecimalDecreaseIcon.js +1 -1
- package/dist/icons/DecimalIncreaseIcon.js +1 -1
- package/dist/icons/DirectionIcon.js +1 -1
- package/dist/icons/DonutIcon.js +1 -1
- package/dist/icons/DownIcon.js +1 -1
- package/dist/icons/EditIcon.js +1 -1
- package/dist/icons/ExclamationCircleFilledIcon.js +1 -1
- package/dist/icons/ExclamationCircleIcon.js +1 -1
- package/dist/icons/ExclamationIcon.js +1 -1
- package/dist/icons/EyeIcon.js +1 -1
- package/dist/icons/EyeInvisibleIcon.js +1 -1
- package/dist/icons/FilterIcon.js +1 -1
- package/dist/icons/FolderFilledIcon.js +1 -1
- package/dist/icons/FolderIcon.js +1 -1
- package/dist/icons/FolderOpenFilledIcon.js +1 -1
- package/dist/icons/FolderOpenIcon.js +1 -1
- package/dist/icons/ForwardIcon.js +1 -1
- package/dist/icons/GripVerticalIcon.js +1 -1
- package/dist/icons/HierarchyIcon.js +1 -1
- package/dist/icons/HierarchyOpenIcon.js +1 -1
- package/dist/icons/Icon.js +1 -1
- package/dist/icons/InfoCircleIcon.js +1 -1
- package/dist/icons/InfoIcon.js +1 -1
- package/dist/icons/KeyIcon.js +1 -1
- package/dist/icons/LeftIcon.js +1 -1
- package/dist/icons/LineChartIcon.js +1 -1
- package/dist/icons/LoadingIcon.js +1 -1
- package/dist/icons/LockFilledIcon.js +1 -1
- package/dist/icons/LockIcon.js +1 -1
- package/dist/icons/MoreIcon.js +1 -1
- package/dist/icons/NotAllowedIcon.js +1 -1
- package/dist/icons/Number123Icon.js +1 -1
- package/dist/icons/NumberIcon.js +1 -1
- package/dist/icons/PauseCircleFilledIcon.js +1 -1
- package/dist/icons/PauseCircleIcon.js +1 -1
- package/dist/icons/PauseIcon.js +1 -1
- package/dist/icons/PercentageIcon.js +1 -1
- package/dist/icons/PieChartIcon.js +1 -1
- package/dist/icons/PipetteIcon.js +1 -1
- package/dist/icons/PlayCircleIcon.js +1 -1
- package/dist/icons/PlayIcon.js +1 -1
- package/dist/icons/PlusIcon.js +1 -1
- package/dist/icons/ProgressBarIcon.js +1 -1
- package/dist/icons/ReloadIcon.js +1 -1
- package/dist/icons/ReportIcon.js +1 -1
- package/dist/icons/ReturnIcon.js +1 -1
- package/dist/icons/RightIcon.js +1 -1
- package/dist/icons/RowTotalsIcon.js +1 -1
- package/dist/icons/SchemeIcon.js +1 -1
- package/dist/icons/SearchIcon.js +1 -1
- package/dist/icons/SemanticQueryIcon.js +1 -1
- package/dist/icons/SettingsIcon.js +1 -1
- package/dist/icons/ShieldFilledIcon.js +1 -1
- package/dist/icons/ShieldIcon.js +1 -1
- package/dist/icons/SlashIcon.js +1 -1
- package/dist/icons/SparklesIcon.js +1 -1
- package/dist/icons/SqlIcon.js +1 -1
- package/dist/icons/StatsIcon.js +1 -1
- package/dist/icons/StopIcon.js +1 -1
- package/dist/icons/StringIcon.js +1 -1
- package/dist/icons/SubtotalsIcon.js +1 -1
- package/dist/icons/SwitchIcon.js +1 -1
- package/dist/icons/TableIcon.js +1 -1
- package/dist/icons/ThumbsDownIcon.js +1 -1
- package/dist/icons/ThumbsUpIcon.js +1 -1
- package/dist/icons/ThunderboltCrossedIcon.js +1 -1
- package/dist/icons/ThunderboltFilledIcon.js +1 -1
- package/dist/icons/ThunderboltIcon.js +1 -1
- package/dist/icons/TimeIcon.js +1 -1
- package/dist/icons/TrashIcon.js +1 -1
- package/dist/icons/UnlockIcon.js +1 -1
- package/dist/icons/UpIcon.js +1 -1
- package/dist/icons/UserGroupIcon.js +1 -1
- package/dist/icons/UserIcon.js +1 -1
- package/dist/icons/UserLockIcon.js +1 -1
- package/dist/icons/ViewIcon.js +1 -1
- package/dist/icons/WarningFilledIcon.js +1 -1
- package/dist/icons/WarningIcon.js +1 -1
- package/dist/icons/wrap-icon.js +1 -1
- package/dist/index.d.ts +3 -15
- package/dist/index.js +3 -11
- package/dist/index.js.map +1 -1
- package/dist/probe/canonicalize.js +1 -1
- package/dist/probe/css.js +1 -1
- package/dist/probe/index.js +1 -1
- package/dist/provider.js +1 -1
- package/dist/providers/TrackingProvider.js +1 -1
- package/dist/providers/navigationAdapter.default.js +1 -1
- package/dist/tokens/all-tokens.js +1 -1
- package/dist/tokens/base.js +1 -1
- package/dist/tokens/color-seed.js +1 -1
- package/dist/tokens/color-theme.js +1 -1
- package/dist/tokens/colors.js +1 -1
- package/dist/tokens/layout.js +1 -1
- package/dist/tokens/lazy-styles.js +1 -1
- package/dist/tokens/legacy-color.js +1 -1
- package/dist/tokens/palette-config.js +1 -1
- package/dist/tokens/palette.js +1 -1
- package/dist/tokens/resolve.js +1 -1
- package/dist/tokens/shadows.js +1 -1
- package/dist/tokens/sizes.js +1 -1
- package/dist/tokens/spacing.js +1 -1
- package/dist/tokens/typography.js +1 -1
- package/dist/utils/ResizeSensor.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/dotize.js +1 -1
- package/dist/utils/is-dev-env.js +1 -1
- package/dist/utils/modules.js +1 -1
- package/dist/utils/promise.js +1 -1
- package/dist/utils/raf.js +1 -1
- package/dist/utils/random.js +1 -1
- package/dist/utils/range.js +1 -1
- package/dist/utils/react/RenderCache.js +1 -1
- package/dist/utils/react/Slots.js +1 -1
- package/dist/utils/react/chain.js +1 -1
- package/dist/utils/react/disabledProps.js +1 -1
- package/dist/utils/react/escapePropagation.js +1 -1
- package/dist/utils/react/forwardRefWithGenerics.js +1 -1
- package/dist/utils/react/index.js +1 -1
- package/dist/utils/react/interactions.js +1 -1
- package/dist/utils/react/isTextOnly.js +1 -1
- package/dist/utils/react/mapProps.js +1 -1
- package/dist/utils/react/mergeProps.js +1 -1
- package/dist/utils/react/nullableValue.js +1 -1
- package/dist/utils/react/programmaticFocus.js +1 -1
- package/dist/utils/react/resolveIcon.js +1 -1
- package/dist/utils/react/sharedStore.js +1 -1
- package/dist/utils/react/useBufferedValue.js +1 -1
- package/dist/utils/react/useCombinedRefs.js +1 -1
- package/dist/utils/react/useControlledFocusVisible.js +1 -1
- package/dist/utils/react/useEventBus.js +1 -1
- package/dist/utils/react/useId.js +1 -1
- package/dist/utils/react/useIsDarwin.js +1 -1
- package/dist/utils/react/useKeySymbols.js +1 -1
- package/dist/utils/react/useLayoutEffect.js +1 -1
- package/dist/utils/react/useLocalStorage.js +1 -1
- package/dist/utils/react/useMergeStyles.js +1 -1
- package/dist/utils/react/useOverlayEscapeGuard.js +1 -1
- package/dist/utils/react/usePopoverSync.js +1 -1
- package/dist/utils/react/useQaProps.js +1 -1
- package/dist/utils/react/useScheme.js +1 -1
- package/dist/utils/react/useViewportSize.js +1 -1
- package/dist/utils/react/wrapNodeIfPlain.js +1 -1
- package/dist/utils/selection.js +1 -1
- package/dist/utils/styles.js +1 -1
- package/dist/utils/tree.js +1 -1
- package/dist/utils/warnings.js +1 -1
- package/dist/version.js +2 -2
- package/docs/components/data/ItemTable.md +1 -1
- package/docs/components/navigation/Tabs.md +8 -2
- package/package.json +1 -1
- package/dist/components/layout/Board/Board.d.ts +0 -253
- package/dist/components/layout/Board/Board.js +0 -771
- package/dist/components/layout/Board/Board.js.map +0 -1
- package/dist/components/layout/Board/BoardProvider.d.ts +0 -28
- package/dist/components/layout/Board/BoardProvider.js +0 -47
- package/dist/components/layout/Board/BoardProvider.js.map +0 -1
- package/dist/components/layout/Board/BoardResponsive.d.ts +0 -55
- package/dist/components/layout/Board/BoardResponsive.js +0 -101
- package/dist/components/layout/Board/BoardResponsive.js.map +0 -1
- package/dist/components/layout/Board/Widget.d.ts +0 -152
- package/dist/components/layout/Board/Widget.js +0 -76
- package/dist/components/layout/Board/Widget.js.map +0 -1
- package/dist/components/layout/Board/WidgetHost.js +0 -1065
- package/dist/components/layout/Board/WidgetHost.js.map +0 -1
- package/dist/components/layout/Board/board-context.d.ts +0 -43
- package/dist/components/layout/Board/board-context.js +0 -79
- package/dist/components/layout/Board/board-context.js.map +0 -1
- package/dist/components/layout/Board/board-store.d.ts +0 -4
- package/dist/components/layout/Board/board-store.js +0 -49
- package/dist/components/layout/Board/board-store.js.map +0 -1
- package/dist/components/layout/Board/grid-core/calculate.js +0 -90
- package/dist/components/layout/Board/grid-core/calculate.js.map +0 -1
- package/dist/components/layout/Board/grid-core/collision-modes.js +0 -254
- package/dist/components/layout/Board/grid-core/collision-modes.js.map +0 -1
- package/dist/components/layout/Board/grid-core/collision.js +0 -35
- package/dist/components/layout/Board/grid-core/collision.js.map +0 -1
- package/dist/components/layout/Board/grid-core/compactors.d.ts +0 -23
- package/dist/components/layout/Board/grid-core/compactors.js +0 -166
- package/dist/components/layout/Board/grid-core/compactors.js.map +0 -1
- package/dist/components/layout/Board/grid-core/constraints.d.ts +0 -35
- package/dist/components/layout/Board/grid-core/constraints.js +0 -155
- package/dist/components/layout/Board/grid-core/constraints.js.map +0 -1
- package/dist/components/layout/Board/grid-core/group-move.js +0 -317
- package/dist/components/layout/Board/grid-core/group-move.js.map +0 -1
- package/dist/components/layout/Board/grid-core/layout.js +0 -186
- package/dist/components/layout/Board/grid-core/layout.js.map +0 -1
- package/dist/components/layout/Board/grid-core/placement.d.ts +0 -58
- package/dist/components/layout/Board/grid-core/placement.js +0 -153
- package/dist/components/layout/Board/grid-core/placement.js.map +0 -1
- package/dist/components/layout/Board/grid-core/sort.js +0 -37
- package/dist/components/layout/Board/grid-core/sort.js.map +0 -1
- package/dist/components/layout/Board/grid-core/types.d.ts +0 -186
- package/dist/components/layout/Board/index.d.ts +0 -24
- package/dist/components/layout/Board/index.js +0 -20
- package/dist/components/layout/Board/index.js.map +0 -1
- package/dist/components/layout/Board/responsive-utils.d.ts +0 -13
- package/dist/components/layout/Board/responsive-utils.js +0 -55
- package/dist/components/layout/Board/responsive-utils.js.map +0 -1
- package/dist/components/layout/Board/use-board-layout.d.ts +0 -26
- package/dist/components/layout/Board/use-board-layout.js +0 -57
- package/dist/components/layout/Board/use-board-layout.js.map +0 -1
- package/dist/components/layout/Board/use-board-registry.js +0 -700
- package/dist/components/layout/Board/use-board-registry.js.map +0 -1
- package/dist/components/layout/Board/use-board-select-modifier-key.js +0 -24
- package/dist/components/layout/Board/use-board-select-modifier-key.js.map +0 -1
- package/dist/components/layout/Board/use-board-selection.d.ts +0 -8
- package/dist/components/layout/Board/use-board-selection.js +0 -113
- package/dist/components/layout/Board/use-board-selection.js.map +0 -1
- package/docs/components/layout/Board.md +0 -473
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-c325dcb | Cube Dev Team */
|
|
2
|
-
import { getAllCollisions, getFirstCollision } from "./collision.js";
|
|
3
|
-
import { sortLayoutItems } from "./sort.js";
|
|
4
|
-
|
|
5
|
-
//#region src/components/layout/Board/grid-core/layout.ts
|
|
6
|
-
/**
|
|
7
|
-
* Core layout manipulation utilities.
|
|
8
|
-
*
|
|
9
|
-
* Vendored from react-grid-layout v2 (`src/core/layout.ts`).
|
|
10
|
-
* See ./NOTICE.md for attribution and license.
|
|
11
|
-
*
|
|
12
|
-
* These functions create, modify, and query grid layouts. Most functions treat
|
|
13
|
-
* layouts as immutable and return new arrays/objects, but a few mutate items in
|
|
14
|
-
* place for performance (documented per function).
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Get the bottom-most Y coordinate of the layout (max of y + h).
|
|
18
|
-
*/
|
|
19
|
-
function bottom(layout) {
|
|
20
|
-
let max = 0;
|
|
21
|
-
for (let i = 0; i < layout.length; i++) {
|
|
22
|
-
const item = layout[i];
|
|
23
|
-
if (item !== void 0) {
|
|
24
|
-
const bottomY = item.y + item.h;
|
|
25
|
-
if (bottomY > max) max = bottomY;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return max;
|
|
29
|
-
}
|
|
30
|
-
/** Get a layout item by its ID. */
|
|
31
|
-
function getLayoutItem(layout, id) {
|
|
32
|
-
for (let i = 0; i < layout.length; i++) {
|
|
33
|
-
const item = layout[i];
|
|
34
|
-
if (item !== void 0 && item.i === id) return item;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
/** Get all static items from the layout. */
|
|
38
|
-
function getStatics(layout) {
|
|
39
|
-
return layout.filter((l) => l.static === true);
|
|
40
|
-
}
|
|
41
|
-
/** Clone a layout item (shallow copy, boolean flags normalized). */
|
|
42
|
-
function cloneLayoutItem(layoutItem) {
|
|
43
|
-
return {
|
|
44
|
-
i: layoutItem.i,
|
|
45
|
-
x: layoutItem.x,
|
|
46
|
-
y: layoutItem.y,
|
|
47
|
-
w: layoutItem.w,
|
|
48
|
-
h: layoutItem.h,
|
|
49
|
-
minW: layoutItem.minW,
|
|
50
|
-
maxW: layoutItem.maxW,
|
|
51
|
-
minH: layoutItem.minH,
|
|
52
|
-
maxH: layoutItem.maxH,
|
|
53
|
-
moved: Boolean(layoutItem.moved),
|
|
54
|
-
static: Boolean(layoutItem.static),
|
|
55
|
-
isDraggable: layoutItem.isDraggable,
|
|
56
|
-
isResizable: layoutItem.isResizable,
|
|
57
|
-
resizeHandles: layoutItem.resizeHandles,
|
|
58
|
-
constraints: layoutItem.constraints,
|
|
59
|
-
isBounded: layoutItem.isBounded
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
/** Clone an entire layout. */
|
|
63
|
-
function cloneLayout(layout) {
|
|
64
|
-
const newLayout = new Array(layout.length);
|
|
65
|
-
for (let i = 0; i < layout.length; i++) {
|
|
66
|
-
const item = layout[i];
|
|
67
|
-
if (item !== void 0) newLayout[i] = cloneLayoutItem(item);
|
|
68
|
-
}
|
|
69
|
-
return newLayout;
|
|
70
|
-
}
|
|
71
|
-
/** Replace a layout item in a layout (matched by `i`). Other items untouched. */
|
|
72
|
-
function modifyLayout(layout, layoutItem) {
|
|
73
|
-
const newLayout = new Array(layout.length);
|
|
74
|
-
for (let i = 0; i < layout.length; i++) {
|
|
75
|
-
const item = layout[i];
|
|
76
|
-
if (item !== void 0) if (layoutItem.i === item.i) newLayout[i] = layoutItem;
|
|
77
|
-
else newLayout[i] = item;
|
|
78
|
-
}
|
|
79
|
-
return newLayout;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Ensure all layout items fit within the grid bounds.
|
|
83
|
-
*
|
|
84
|
-
* **IMPORTANT**: mutates the layout items in place for performance. Clone the
|
|
85
|
-
* layout first (e.g. with `cloneLayout()`) if you need immutability.
|
|
86
|
-
*/
|
|
87
|
-
function correctBounds(layout, bounds) {
|
|
88
|
-
const collidesWith = getStatics(layout);
|
|
89
|
-
for (let i = 0; i < layout.length; i++) {
|
|
90
|
-
const l = layout[i];
|
|
91
|
-
if (l === void 0) continue;
|
|
92
|
-
if (l.x + l.w > bounds.cols) l.x = bounds.cols - l.w;
|
|
93
|
-
if (l.x < 0) {
|
|
94
|
-
l.x = 0;
|
|
95
|
-
l.w = bounds.cols;
|
|
96
|
-
}
|
|
97
|
-
if (!l.static) collidesWith.push(l);
|
|
98
|
-
else while (getFirstCollision(collidesWith, l)) l.y++;
|
|
99
|
-
}
|
|
100
|
-
return layout;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Move a layout element to a new position.
|
|
104
|
-
*
|
|
105
|
-
* Handles collision detection and cascading movements. Does not compact the
|
|
106
|
-
* layout - call the compactor separately.
|
|
107
|
-
*
|
|
108
|
-
* **Note**: mutates the `l` parameter directly for performance.
|
|
109
|
-
*/
|
|
110
|
-
function moveElement(layout, l, x, y, isUserAction, preventCollision, compactType, cols, allowOverlap, options) {
|
|
111
|
-
if (l.static && l.isDraggable !== true) return [...layout];
|
|
112
|
-
if (l.y === y && l.x === x) return [...layout];
|
|
113
|
-
const oldX = l.x;
|
|
114
|
-
const oldY = l.y;
|
|
115
|
-
if (typeof x === "number") l.x = x;
|
|
116
|
-
if (typeof y === "number") l.y = y;
|
|
117
|
-
l.moved = true;
|
|
118
|
-
let sorted = sortLayoutItems(layout, compactType);
|
|
119
|
-
if (compactType === "vertical" && typeof y === "number" ? oldY >= y : compactType === "horizontal" && typeof x === "number" ? oldX >= x : false) sorted = sorted.reverse();
|
|
120
|
-
const collisions = getAllCollisions(sorted, l);
|
|
121
|
-
const hasCollisions = collisions.length > 0;
|
|
122
|
-
if (hasCollisions && allowOverlap) return cloneLayout(layout);
|
|
123
|
-
if (hasCollisions && preventCollision) {
|
|
124
|
-
const resolved = options?.resolveCollision?.({
|
|
125
|
-
layout,
|
|
126
|
-
item: l,
|
|
127
|
-
collisions,
|
|
128
|
-
from: {
|
|
129
|
-
x: oldX,
|
|
130
|
-
y: oldY
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
if (resolved) return resolved;
|
|
134
|
-
l.x = oldX;
|
|
135
|
-
l.y = oldY;
|
|
136
|
-
l.moved = false;
|
|
137
|
-
return layout;
|
|
138
|
-
}
|
|
139
|
-
let resultLayout = [...layout];
|
|
140
|
-
for (let i = 0; i < collisions.length; i++) {
|
|
141
|
-
const collision = collisions[i];
|
|
142
|
-
if (collision === void 0) continue;
|
|
143
|
-
if (collision.moved) continue;
|
|
144
|
-
if (collision.static) resultLayout = moveElementAwayFromCollision(resultLayout, collision, l, isUserAction, compactType, cols);
|
|
145
|
-
else resultLayout = moveElementAwayFromCollision(resultLayout, l, collision, isUserAction, compactType, cols);
|
|
146
|
-
}
|
|
147
|
-
return resultLayout;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Move an item away from a collision. Attempts to move up/left first if there's
|
|
151
|
-
* room, otherwise moves it down/right.
|
|
152
|
-
*/
|
|
153
|
-
function moveElementAwayFromCollision(layout, collidesWith, itemToMove, isUserAction, compactType, cols) {
|
|
154
|
-
const compactH = compactType === "horizontal";
|
|
155
|
-
const compactV = compactType === "vertical";
|
|
156
|
-
const preventCollision = collidesWith.static;
|
|
157
|
-
if (isUserAction) {
|
|
158
|
-
isUserAction = false;
|
|
159
|
-
const fakeItem = {
|
|
160
|
-
x: compactH ? Math.max(collidesWith.x - itemToMove.w, 0) : itemToMove.x,
|
|
161
|
-
y: compactV ? Math.max(collidesWith.y - itemToMove.h, 0) : itemToMove.y,
|
|
162
|
-
w: itemToMove.w,
|
|
163
|
-
h: itemToMove.h,
|
|
164
|
-
i: "-1"
|
|
165
|
-
};
|
|
166
|
-
const firstCollision = getFirstCollision(layout, fakeItem);
|
|
167
|
-
const collisionNorth = firstCollision !== void 0 && firstCollision.y + firstCollision.h > collidesWith.y;
|
|
168
|
-
const collisionWest = firstCollision !== void 0 && collidesWith.x + collidesWith.w > firstCollision.x;
|
|
169
|
-
if (!firstCollision) return moveElement(layout, itemToMove, compactH ? fakeItem.x : void 0, compactV ? fakeItem.y : void 0, isUserAction, preventCollision, compactType, cols);
|
|
170
|
-
if (collisionNorth && compactV) return moveElement(layout, itemToMove, void 0, itemToMove.y + 1, isUserAction, preventCollision, compactType, cols);
|
|
171
|
-
if (collisionNorth && compactType === null) {
|
|
172
|
-
collidesWith.y = itemToMove.y;
|
|
173
|
-
itemToMove.y = itemToMove.y + itemToMove.h;
|
|
174
|
-
return [...layout];
|
|
175
|
-
}
|
|
176
|
-
if (collisionWest && compactH) return moveElement(layout, collidesWith, itemToMove.x, void 0, isUserAction, preventCollision, compactType, cols);
|
|
177
|
-
}
|
|
178
|
-
const newX = compactH ? itemToMove.x + 1 : void 0;
|
|
179
|
-
const newY = compactV ? itemToMove.y + 1 : void 0;
|
|
180
|
-
if (newX === void 0 && newY === void 0) return [...layout];
|
|
181
|
-
return moveElement(layout, itemToMove, newX, newY, isUserAction, preventCollision, compactType, cols);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
//#endregion
|
|
185
|
-
export { bottom, cloneLayout, cloneLayoutItem, correctBounds, getLayoutItem, getStatics, modifyLayout, moveElement };
|
|
186
|
-
//# sourceMappingURL=layout.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","names":["getAllCollisions","getFirstCollision","sortLayoutItems","CompactType","Layout","LayoutItem","MoveElementOptions","Mutable","bottom","layout","max","i","length","item","undefined","bottomY","y","h","getLayoutItem","id","getStatics","filter","l","static","cloneLayoutItem","layoutItem","x","w","minW","maxW","minH","maxH","moved","Boolean","isDraggable","isResizable","resizeHandles","constraints","isBounded","cloneLayout","newLayout","Array","modifyLayout","withLayoutItem","itemKey","cb","correctBounds","bounds","cols","collidesWith","push","moveElement","isUserAction","preventCollision","compactType","allowOverlap","options","oldX","oldY","sorted","movingUp","reverse","collisions","hasCollisions","resolved","resolveCollision","from","resultLayout","collision","moveElementAwayFromCollision","itemToMove","compactH","compactV","fakeItem","Math","firstCollision","collisionNorth","collisionWest","newX","newY","validateLayout","contextName","requiredProps","const","isArray","Error","key","value","Number","isNaN","String"],"sources":["../../../../../src/components/layout/Board/grid-core/layout.ts"],"sourcesContent":["/**\n * Core layout manipulation utilities.\n *\n * Vendored from react-grid-layout v2 (`src/core/layout.ts`).\n * See ./NOTICE.md for attribution and license.\n *\n * These functions create, modify, and query grid layouts. Most functions treat\n * layouts as immutable and return new arrays/objects, but a few mutate items in\n * place for performance (documented per function).\n */\n\nimport { getAllCollisions, getFirstCollision } from './collision';\nimport { sortLayoutItems } from './sort';\n\nimport type {\n CompactType,\n Layout,\n LayoutItem,\n MoveElementOptions,\n Mutable,\n} from './types';\n\n// ============================================================================\n// Layout Queries\n// ============================================================================\n\n/**\n * Get the bottom-most Y coordinate of the layout (max of y + h).\n */\nexport function bottom(layout: Layout): number {\n let max = 0;\n for (let i = 0; i < layout.length; i++) {\n const item = layout[i];\n if (item !== undefined) {\n const bottomY = item.y + item.h;\n if (bottomY > max) max = bottomY;\n }\n }\n return max;\n}\n\n/** Get a layout item by its ID. */\nexport function getLayoutItem(\n layout: Layout,\n id: string,\n): LayoutItem | undefined {\n for (let i = 0; i < layout.length; i++) {\n const item = layout[i];\n if (item !== undefined && item.i === id) {\n return item;\n }\n }\n return undefined;\n}\n\n/** Get all static items from the layout. */\nexport function getStatics(layout: Layout): LayoutItem[] {\n return layout.filter((l): l is LayoutItem => l.static === true);\n}\n\n// ============================================================================\n// Layout Cloning\n// ============================================================================\n\n/** Clone a layout item (shallow copy, boolean flags normalized). */\nexport function cloneLayoutItem(layoutItem: LayoutItem): LayoutItem {\n return {\n i: layoutItem.i,\n x: layoutItem.x,\n y: layoutItem.y,\n w: layoutItem.w,\n h: layoutItem.h,\n minW: layoutItem.minW,\n maxW: layoutItem.maxW,\n minH: layoutItem.minH,\n maxH: layoutItem.maxH,\n moved: Boolean(layoutItem.moved),\n static: Boolean(layoutItem.static),\n isDraggable: layoutItem.isDraggable,\n isResizable: layoutItem.isResizable,\n resizeHandles: layoutItem.resizeHandles,\n constraints: layoutItem.constraints,\n isBounded: layoutItem.isBounded,\n };\n}\n\n/** Clone an entire layout. */\nexport function cloneLayout(layout: Layout): LayoutItem[] {\n const newLayout: LayoutItem[] = new Array(layout.length);\n for (let i = 0; i < layout.length; i++) {\n const item = layout[i];\n if (item !== undefined) {\n newLayout[i] = cloneLayoutItem(item);\n }\n }\n return newLayout;\n}\n\n// ============================================================================\n// Layout Modification\n// ============================================================================\n\n/** Replace a layout item in a layout (matched by `i`). Other items untouched. */\nexport function modifyLayout(\n layout: Layout,\n layoutItem: LayoutItem,\n): LayoutItem[] {\n const newLayout: LayoutItem[] = new Array(layout.length);\n for (let i = 0; i < layout.length; i++) {\n const item = layout[i];\n if (item !== undefined) {\n if (layoutItem.i === item.i) {\n newLayout[i] = layoutItem;\n } else {\n newLayout[i] = item;\n }\n }\n }\n return newLayout;\n}\n\n/**\n * Apply a transformation to a layout item. Finds the item by key, clones it,\n * applies the callback, and returns [new layout, modified item | null].\n */\nexport function withLayoutItem(\n layout: Layout,\n itemKey: string,\n cb: (item: LayoutItem) => LayoutItem,\n): [LayoutItem[], LayoutItem | null] {\n let item = getLayoutItem(layout, itemKey);\n if (!item) {\n return [[...layout], null];\n }\n\n item = cb(cloneLayoutItem(item));\n const newLayout = modifyLayout(layout, item);\n\n return [newLayout, item];\n}\n\n// ============================================================================\n// Bounds Correction\n// ============================================================================\n\n/**\n * Ensure all layout items fit within the grid bounds.\n *\n * **IMPORTANT**: mutates the layout items in place for performance. Clone the\n * layout first (e.g. with `cloneLayout()`) if you need immutability.\n */\nexport function correctBounds(\n layout: Mutable<LayoutItem>[],\n bounds: { cols: number },\n): LayoutItem[] {\n const collidesWith = getStatics(layout);\n\n for (let i = 0; i < layout.length; i++) {\n const l = layout[i];\n if (l === undefined) continue;\n\n // Overflows right\n if (l.x + l.w > bounds.cols) {\n l.x = bounds.cols - l.w;\n }\n\n // Overflows left\n if (l.x < 0) {\n l.x = 0;\n l.w = bounds.cols;\n }\n\n if (!l.static) {\n collidesWith.push(l);\n } else {\n // Static items that collide with other statics must be moved down\n while (getFirstCollision(collidesWith, l)) {\n l.y++;\n }\n }\n }\n\n return layout;\n}\n\n// ============================================================================\n// Move Operations\n// ============================================================================\n\n/**\n * Move a layout element to a new position.\n *\n * Handles collision detection and cascading movements. Does not compact the\n * layout - call the compactor separately.\n *\n * **Note**: mutates the `l` parameter directly for performance.\n */\nexport function moveElement(\n layout: Layout,\n l: LayoutItem,\n x: number | undefined,\n y: number | undefined,\n isUserAction: boolean | undefined,\n preventCollision: boolean | undefined,\n compactType: CompactType,\n cols: number,\n allowOverlap?: boolean,\n options?: MoveElementOptions,\n): LayoutItem[] {\n // Static items can't be moved unless explicitly draggable\n if (l.static && l.isDraggable !== true) {\n return [...layout];\n }\n\n // Short-circuit if position unchanged\n if (l.y === y && l.x === x) {\n return [...layout];\n }\n\n const oldX = l.x;\n const oldY = l.y;\n\n // Update position (mutates l directly - see JSDoc note)\n if (typeof x === 'number') (l as Mutable<LayoutItem>).x = x;\n if (typeof y === 'number') (l as Mutable<LayoutItem>).y = y;\n (l as Mutable<LayoutItem>).moved = true;\n\n // Sort for proper collision detection order\n let sorted = sortLayoutItems(layout, compactType);\n const movingUp =\n compactType === 'vertical' && typeof y === 'number'\n ? oldY >= y\n : compactType === 'horizontal' && typeof x === 'number'\n ? oldX >= x\n : false;\n\n if (movingUp) {\n sorted = sorted.reverse();\n }\n\n const collisions = getAllCollisions(sorted, l);\n const hasCollisions = collisions.length > 0;\n\n // Handle overlap mode - just clone and return\n if (hasCollisions && allowOverlap) {\n return cloneLayout(layout);\n }\n\n // Handle prevent collision mode. A resolver may rewrite the layout instead of\n // refusing the move outright - shrinking the item into the room that is there,\n // or trading places with the widget already in it (see `collision-modes.ts`).\n // Its result is required to be overlap-free, so nothing downstream has to\n // change; when it declines, we revert exactly as before.\n if (hasCollisions && preventCollision) {\n const resolved = options?.resolveCollision?.({\n layout,\n item: l,\n collisions,\n from: { x: oldX, y: oldY },\n });\n if (resolved) return resolved;\n\n // Revert position. Return same reference to signal no change occurred.\n (l as Mutable<LayoutItem>).x = oldX;\n (l as Mutable<LayoutItem>).y = oldY;\n (l as Mutable<LayoutItem>).moved = false;\n return layout as LayoutItem[];\n }\n\n // Resolve collisions by moving other items\n let resultLayout: LayoutItem[] = [...layout];\n for (let i = 0; i < collisions.length; i++) {\n const collision = collisions[i];\n if (collision === undefined) continue;\n\n // Skip already-moved items to prevent infinite loops\n if (collision.moved) continue;\n\n // Static items can't be moved - move the dragged item instead\n if (collision.static) {\n resultLayout = moveElementAwayFromCollision(\n resultLayout,\n collision,\n l,\n isUserAction,\n compactType,\n cols,\n );\n } else {\n resultLayout = moveElementAwayFromCollision(\n resultLayout,\n l,\n collision,\n isUserAction,\n compactType,\n cols,\n );\n }\n }\n\n return resultLayout;\n}\n\n/**\n * Move an item away from a collision. Attempts to move up/left first if there's\n * room, otherwise moves it down/right.\n */\nexport function moveElementAwayFromCollision(\n layout: Layout,\n collidesWith: LayoutItem,\n itemToMove: LayoutItem,\n isUserAction: boolean | undefined,\n compactType: CompactType,\n cols: number,\n): LayoutItem[] {\n const compactH = compactType === 'horizontal';\n const compactV = compactType === 'vertical';\n const preventCollision = collidesWith.static;\n\n // Try to move up/left first (only on primary collision from user action)\n if (isUserAction) {\n isUserAction = false; // Only try this once\n\n // Create a fake item to test if there's room above/left\n const fakeItem: LayoutItem = {\n x: compactH ? Math.max(collidesWith.x - itemToMove.w, 0) : itemToMove.x,\n y: compactV ? Math.max(collidesWith.y - itemToMove.h, 0) : itemToMove.y,\n w: itemToMove.w,\n h: itemToMove.h,\n i: '-1',\n };\n\n const firstCollision = getFirstCollision(layout, fakeItem);\n const collisionNorth =\n firstCollision !== undefined &&\n firstCollision.y + firstCollision.h > collidesWith.y;\n const collisionWest =\n firstCollision !== undefined &&\n collidesWith.x + collidesWith.w > firstCollision.x;\n\n // No collision above/left - we can move there\n if (!firstCollision) {\n return moveElement(\n layout,\n itemToMove,\n compactH ? fakeItem.x : undefined,\n compactV ? fakeItem.y : undefined,\n isUserAction,\n preventCollision,\n compactType,\n cols,\n );\n }\n\n // Handle specific collision cases\n if (collisionNorth && compactV) {\n return moveElement(\n layout,\n itemToMove,\n undefined,\n itemToMove.y + 1,\n isUserAction,\n preventCollision,\n compactType,\n cols,\n );\n }\n\n if (collisionNorth && compactType === null) {\n // Swap positions in free-form mode\n (collidesWith as Mutable<LayoutItem>).y = itemToMove.y;\n (itemToMove as Mutable<LayoutItem>).y = itemToMove.y + itemToMove.h;\n return [...layout];\n }\n\n if (collisionWest && compactH) {\n return moveElement(\n layout,\n collidesWith,\n itemToMove.x,\n undefined,\n isUserAction,\n preventCollision,\n compactType,\n cols,\n );\n }\n }\n\n // Default: move down/right by 1\n const newX = compactH ? itemToMove.x + 1 : undefined;\n const newY = compactV ? itemToMove.y + 1 : undefined;\n\n if (newX === undefined && newY === undefined) {\n return [...layout];\n }\n\n return moveElement(\n layout,\n itemToMove,\n newX,\n newY,\n isUserAction,\n preventCollision,\n compactType,\n cols,\n );\n}\n\n// ============================================================================\n// Validation\n// ============================================================================\n\n/** Validate that a layout has the required numeric properties. */\nexport function validateLayout(\n layout: Layout,\n contextName: string = 'Layout',\n): void {\n const requiredProps = ['x', 'y', 'w', 'h'] as const;\n\n if (!Array.isArray(layout)) {\n throw new Error(`${contextName} must be an array!`);\n }\n\n for (let i = 0; i < layout.length; i++) {\n const item = layout[i];\n if (item === undefined) continue;\n\n for (const key of requiredProps) {\n const value = item[key];\n if (typeof value !== 'number' || Number.isNaN(value)) {\n throw new Error(\n `Board: ${contextName}[${i}].${key} must be a number! ` +\n `Received: ${String(value)} (${typeof value})`,\n );\n }\n }\n\n if (item.i !== undefined && typeof item.i !== 'string') {\n throw new Error(\n `Board: ${contextName}[${i}].i must be a string! ` +\n `Received: ${String(item.i)} (${typeof item.i})`,\n );\n }\n }\n}\n"],"mappings":"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"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Layout, LayoutItem } from "./types.js";
|
|
3
|
-
|
|
4
|
-
//#region src/components/layout/Board/grid-core/placement.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* The first position at or below the preferred cell where `item` fits without
|
|
7
|
-
* overlapping any of `others` (which must themselves be overlap-free), scanning
|
|
8
|
-
* left-to-right then top-to-bottom and never past `maxRows`; if the band below
|
|
9
|
-
* is full, upward toward the top.
|
|
10
|
-
*
|
|
11
|
-
* This is the rule the board itself applies when it has to land a widget that
|
|
12
|
-
* cannot stay where it was dropped, so using it for a programmatic add is what
|
|
13
|
-
* makes the two agree.
|
|
14
|
-
*
|
|
15
|
-
* A finite `maxRows` mirrors the `gridBounds` constraint the normal landing path
|
|
16
|
-
* applies (`clamp(y, 0, maxRows - h)`): the item's bottom edge stays within the
|
|
17
|
-
* row limit even when the landing cell is blocked, so the downward scan cannot
|
|
18
|
-
* push it off the board. If the whole valid band is full the item is clamped to
|
|
19
|
-
* the limit — bounds win over overlap, exactly as `gridBounds` does. With an
|
|
20
|
-
* unbounded `maxRows` there is always a free slot below every existing item, so
|
|
21
|
-
* the downward scan terminates on its own.
|
|
22
|
-
*
|
|
23
|
-
* The returned item is a copy; `item` is not mutated. Its `w` is capped to
|
|
24
|
-
* `cols`, and no other dimension is changed — this never resizes to fit.
|
|
25
|
-
*/
|
|
26
|
-
declare function placeInFreeSlot(others: Layout, item: LayoutItem, cols: number, maxRows?: number): LayoutItem;
|
|
27
|
-
/**
|
|
28
|
-
* Tile every item evenly across both axes of a `cols × rows` grid, keeping the
|
|
29
|
-
* row structure the layout already has: items are grouped into visual rows by
|
|
30
|
-
* their current `y`, `rows` is divided across those groups, and `cols` across
|
|
31
|
-
* each group's members.
|
|
32
|
-
*
|
|
33
|
-
* So three items on one line become three equal full-height columns; move one
|
|
34
|
-
* below and the top line becomes two half-width cells while the lower item
|
|
35
|
-
* spans the full width at half height. Grouping by `y` rather than reflowing
|
|
36
|
-
* from scratch is what makes the result recognisably the user's arrangement
|
|
37
|
-
* instead of an arbitrary repack.
|
|
38
|
-
*
|
|
39
|
-
* A visual row holding more items than the grid is wide is wrapped into
|
|
40
|
-
* sub-rows of at most `cols`, so nothing tiles past the right edge. That can
|
|
41
|
-
* take the result past `rows`; the caller decides whether to grow the grid or
|
|
42
|
-
* let its bounds clip.
|
|
43
|
-
*
|
|
44
|
-
* This is the one operation that deliberately GROWS items — every gesture-driven
|
|
45
|
-
* path refuses to, because growing on a move is a surprise. Here it is the whole
|
|
46
|
-
* point, which is why it is a call the app makes rather than a mode the board is
|
|
47
|
-
* in. Returns new items in the input's order; the input is not mutated.
|
|
48
|
-
*/
|
|
49
|
-
declare function distributeEvenly(layout: Layout, {
|
|
50
|
-
cols,
|
|
51
|
-
rows
|
|
52
|
-
}: {
|
|
53
|
-
cols: number;
|
|
54
|
-
rows: number;
|
|
55
|
-
}): LayoutItem[];
|
|
56
|
-
//#endregion
|
|
57
|
-
export { distributeEvenly, placeInFreeSlot };
|
|
58
|
-
//# sourceMappingURL=placement.d.ts.map
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-c325dcb | Cube Dev Team */
|
|
2
|
-
import { collides } from "./collision.js";
|
|
3
|
-
|
|
4
|
-
//#region src/components/layout/Board/grid-core/placement.ts
|
|
5
|
-
/**
|
|
6
|
-
* Placing items into a grid without dragging them there.
|
|
7
|
-
*
|
|
8
|
-
* A board's own gestures resolve placement through the compactor and the
|
|
9
|
-
* collision resolver. An app that adds a widget programmatically — a toolbar
|
|
10
|
-
* drop, a widget moved between boards by code, an "arrange these for me"
|
|
11
|
-
* command — has to answer the same question with no gesture in hand, and had no
|
|
12
|
-
* way to ask the engine for the answer. Left to solve it themselves, apps
|
|
13
|
-
* re-implement the scan, and the same drop lands in two different cells
|
|
14
|
-
* depending on whether a pointer or a code path served it.
|
|
15
|
-
*
|
|
16
|
-
* Original UI Kit code (not vendored from react-grid-layout).
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* The first position at or below the preferred cell where `item` fits without
|
|
20
|
-
* overlapping any of `others` (which must themselves be overlap-free), scanning
|
|
21
|
-
* left-to-right then top-to-bottom and never past `maxRows`; if the band below
|
|
22
|
-
* is full, upward toward the top.
|
|
23
|
-
*
|
|
24
|
-
* This is the rule the board itself applies when it has to land a widget that
|
|
25
|
-
* cannot stay where it was dropped, so using it for a programmatic add is what
|
|
26
|
-
* makes the two agree.
|
|
27
|
-
*
|
|
28
|
-
* A finite `maxRows` mirrors the `gridBounds` constraint the normal landing path
|
|
29
|
-
* applies (`clamp(y, 0, maxRows - h)`): the item's bottom edge stays within the
|
|
30
|
-
* row limit even when the landing cell is blocked, so the downward scan cannot
|
|
31
|
-
* push it off the board. If the whole valid band is full the item is clamped to
|
|
32
|
-
* the limit — bounds win over overlap, exactly as `gridBounds` does. With an
|
|
33
|
-
* unbounded `maxRows` there is always a free slot below every existing item, so
|
|
34
|
-
* the downward scan terminates on its own.
|
|
35
|
-
*
|
|
36
|
-
* The returned item is a copy; `item` is not mutated. Its `w` is capped to
|
|
37
|
-
* `cols`, and no other dimension is changed — this never resizes to fit.
|
|
38
|
-
*/
|
|
39
|
-
function placeInFreeSlot(others, item, cols, maxRows = Infinity) {
|
|
40
|
-
const w = Math.min(item.w, cols);
|
|
41
|
-
const maxY = Number.isFinite(maxRows) ? Math.max(0, maxRows - item.h) : Infinity;
|
|
42
|
-
const fits = (x, y) => !others.some((o) => collides(o, {
|
|
43
|
-
...item,
|
|
44
|
-
x,
|
|
45
|
-
y,
|
|
46
|
-
w
|
|
47
|
-
}));
|
|
48
|
-
const preferX = Math.min(Math.max(0, item.x), cols - w);
|
|
49
|
-
const startY = Math.min(Math.max(0, item.y), maxY);
|
|
50
|
-
if (fits(preferX, startY)) return {
|
|
51
|
-
...item,
|
|
52
|
-
x: preferX,
|
|
53
|
-
y: startY,
|
|
54
|
-
w
|
|
55
|
-
};
|
|
56
|
-
const scanBottom = Number.isFinite(maxRows) ? maxY : startY + others.reduce((m, o) => Math.max(m, o.y + o.h), 0) + 1;
|
|
57
|
-
for (let y = startY; y <= scanBottom; y++) for (let x = 0; x <= cols - w; x++) if (fits(x, y)) return {
|
|
58
|
-
...item,
|
|
59
|
-
x,
|
|
60
|
-
y,
|
|
61
|
-
w
|
|
62
|
-
};
|
|
63
|
-
for (let y = startY - 1; y >= 0; y--) for (let x = 0; x <= cols - w; x++) if (fits(x, y)) return {
|
|
64
|
-
...item,
|
|
65
|
-
x,
|
|
66
|
-
y,
|
|
67
|
-
w
|
|
68
|
-
};
|
|
69
|
-
return {
|
|
70
|
-
...item,
|
|
71
|
-
x: preferX,
|
|
72
|
-
y: startY,
|
|
73
|
-
w
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Split `total` cells across `parts` groups as evenly as possible: each group
|
|
78
|
-
* gets at least one, and the first `total % parts` groups get one extra so the
|
|
79
|
-
* pieces sum to `total`. With more groups than cells every group still gets one
|
|
80
|
-
* and the sum overflows, which the grid's own bounds then clip — the best
|
|
81
|
-
* available answer when there is less than a cell to go round.
|
|
82
|
-
*/
|
|
83
|
-
function splitEvenly(total, parts) {
|
|
84
|
-
if (parts <= 0) return [];
|
|
85
|
-
const base = Math.max(1, Math.floor(total / parts));
|
|
86
|
-
const remainder = base * parts >= total ? 0 : total - base * parts;
|
|
87
|
-
return Array.from({ length: parts }, (_, i) => base + (i < remainder ? 1 : 0));
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Tile every item evenly across both axes of a `cols × rows` grid, keeping the
|
|
91
|
-
* row structure the layout already has: items are grouped into visual rows by
|
|
92
|
-
* their current `y`, `rows` is divided across those groups, and `cols` across
|
|
93
|
-
* each group's members.
|
|
94
|
-
*
|
|
95
|
-
* So three items on one line become three equal full-height columns; move one
|
|
96
|
-
* below and the top line becomes two half-width cells while the lower item
|
|
97
|
-
* spans the full width at half height. Grouping by `y` rather than reflowing
|
|
98
|
-
* from scratch is what makes the result recognisably the user's arrangement
|
|
99
|
-
* instead of an arbitrary repack.
|
|
100
|
-
*
|
|
101
|
-
* A visual row holding more items than the grid is wide is wrapped into
|
|
102
|
-
* sub-rows of at most `cols`, so nothing tiles past the right edge. That can
|
|
103
|
-
* take the result past `rows`; the caller decides whether to grow the grid or
|
|
104
|
-
* let its bounds clip.
|
|
105
|
-
*
|
|
106
|
-
* This is the one operation that deliberately GROWS items — every gesture-driven
|
|
107
|
-
* path refuses to, because growing on a move is a surprise. Here it is the whole
|
|
108
|
-
* point, which is why it is a call the app makes rather than a mode the board is
|
|
109
|
-
* in. Returns new items in the input's order; the input is not mutated.
|
|
110
|
-
*/
|
|
111
|
-
function distributeEvenly(layout, { cols, rows }) {
|
|
112
|
-
if (layout.length === 0) return [];
|
|
113
|
-
const gridCols = Math.max(1, cols);
|
|
114
|
-
const gridRows = Math.max(1, rows);
|
|
115
|
-
const sorted = [...layout].sort((a, b) => a.y !== b.y ? a.y - b.y : a.x - b.x);
|
|
116
|
-
const groups = [];
|
|
117
|
-
let lastY = null;
|
|
118
|
-
for (const item of sorted) {
|
|
119
|
-
if (lastY === null || item.y !== lastY) {
|
|
120
|
-
groups.push([]);
|
|
121
|
-
lastY = item.y;
|
|
122
|
-
}
|
|
123
|
-
groups[groups.length - 1].push(item);
|
|
124
|
-
}
|
|
125
|
-
const rowGroups = [];
|
|
126
|
-
for (const group of groups) if (group.length <= gridCols) rowGroups.push(group);
|
|
127
|
-
else for (let i = 0; i < group.length; i += gridCols) rowGroups.push(group.slice(i, i + gridCols));
|
|
128
|
-
const rowHeights = splitEvenly(gridRows, rowGroups.length);
|
|
129
|
-
const placed = /* @__PURE__ */ new Map();
|
|
130
|
-
let y = 0;
|
|
131
|
-
rowGroups.forEach((group, gi) => {
|
|
132
|
-
const h = rowHeights[gi];
|
|
133
|
-
const widths = splitEvenly(gridCols, group.length);
|
|
134
|
-
let x = 0;
|
|
135
|
-
group.forEach((item, ci) => {
|
|
136
|
-
const w = widths[ci];
|
|
137
|
-
placed.set(item.i, {
|
|
138
|
-
...item,
|
|
139
|
-
x,
|
|
140
|
-
y,
|
|
141
|
-
w,
|
|
142
|
-
h
|
|
143
|
-
});
|
|
144
|
-
x += w;
|
|
145
|
-
});
|
|
146
|
-
y += h;
|
|
147
|
-
});
|
|
148
|
-
return layout.map((item) => placed.get(item.i) ?? item);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
//#endregion
|
|
152
|
-
export { distributeEvenly, placeInFreeSlot };
|
|
153
|
-
//# sourceMappingURL=placement.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"placement.js","names":["collides","Layout","LayoutItem","placeInFreeSlot","others","item","cols","maxRows","Infinity","w","Math","min","maxY","Number","isFinite","max","h","fits","x","y","some","o","preferX","startY","scanBottom","reduce","m","splitEvenly","total","parts","base","floor","remainder","Array","from","length","_","i","distributeEvenly","layout","rows","gridCols","gridRows","sorted","sort","a","b","groups","lastY","push","rowGroups","group","slice","rowHeights","placed","Map","forEach","gi","widths","ci","set","map","get"],"sources":["../../../../../src/components/layout/Board/grid-core/placement.ts"],"sourcesContent":["/**\n * Placing items into a grid without dragging them there.\n *\n * A board's own gestures resolve placement through the compactor and the\n * collision resolver. An app that adds a widget programmatically — a toolbar\n * drop, a widget moved between boards by code, an \"arrange these for me\"\n * command — has to answer the same question with no gesture in hand, and had no\n * way to ask the engine for the answer. Left to solve it themselves, apps\n * re-implement the scan, and the same drop lands in two different cells\n * depending on whether a pointer or a code path served it.\n *\n * Original UI Kit code (not vendored from react-grid-layout).\n */\n\nimport { collides } from './collision';\n\nimport type { Layout, LayoutItem } from './types';\n\n/**\n * The first position at or below the preferred cell where `item` fits without\n * overlapping any of `others` (which must themselves be overlap-free), scanning\n * left-to-right then top-to-bottom and never past `maxRows`; if the band below\n * is full, upward toward the top.\n *\n * This is the rule the board itself applies when it has to land a widget that\n * cannot stay where it was dropped, so using it for a programmatic add is what\n * makes the two agree.\n *\n * A finite `maxRows` mirrors the `gridBounds` constraint the normal landing path\n * applies (`clamp(y, 0, maxRows - h)`): the item's bottom edge stays within the\n * row limit even when the landing cell is blocked, so the downward scan cannot\n * push it off the board. If the whole valid band is full the item is clamped to\n * the limit — bounds win over overlap, exactly as `gridBounds` does. With an\n * unbounded `maxRows` there is always a free slot below every existing item, so\n * the downward scan terminates on its own.\n *\n * The returned item is a copy; `item` is not mutated. Its `w` is capped to\n * `cols`, and no other dimension is changed — this never resizes to fit.\n */\nexport function placeInFreeSlot(\n others: Layout,\n item: LayoutItem,\n cols: number,\n maxRows = Infinity,\n): LayoutItem {\n const w = Math.min(item.w, cols);\n const maxY = Number.isFinite(maxRows)\n ? Math.max(0, maxRows - item.h)\n : Infinity;\n const fits = (x: number, y: number) =>\n !others.some((o) => collides(o, { ...item, x, y, w }));\n const preferX = Math.min(Math.max(0, item.x), cols - w);\n const startY = Math.min(Math.max(0, item.y), maxY);\n if (fits(preferX, startY)) return { ...item, x: preferX, y: startY, w };\n const scanBottom = Number.isFinite(maxRows)\n ? maxY\n : startY + others.reduce((m, o) => Math.max(m, o.y + o.h), 0) + 1;\n for (let y = startY; y <= scanBottom; y++) {\n for (let x = 0; x <= cols - w; x++) {\n if (fits(x, y)) return { ...item, x, y, w };\n }\n }\n // The landing row (clamped to the limit) and everything below it were full;\n // look upward for a free slot still inside the board before giving up.\n for (let y = startY - 1; y >= 0; y--) {\n for (let x = 0; x <= cols - w; x++) {\n if (fits(x, y)) return { ...item, x, y, w };\n }\n }\n return { ...item, x: preferX, y: startY, w };\n}\n\n/**\n * Split `total` cells across `parts` groups as evenly as possible: each group\n * gets at least one, and the first `total % parts` groups get one extra so the\n * pieces sum to `total`. With more groups than cells every group still gets one\n * and the sum overflows, which the grid's own bounds then clip — the best\n * available answer when there is less than a cell to go round.\n */\nfunction splitEvenly(total: number, parts: number): number[] {\n if (parts <= 0) return [];\n const base = Math.max(1, Math.floor(total / parts));\n const remainder = base * parts >= total ? 0 : total - base * parts;\n return Array.from(\n { length: parts },\n (_, i) => base + (i < remainder ? 1 : 0),\n );\n}\n\n/**\n * Tile every item evenly across both axes of a `cols × rows` grid, keeping the\n * row structure the layout already has: items are grouped into visual rows by\n * their current `y`, `rows` is divided across those groups, and `cols` across\n * each group's members.\n *\n * So three items on one line become three equal full-height columns; move one\n * below and the top line becomes two half-width cells while the lower item\n * spans the full width at half height. Grouping by `y` rather than reflowing\n * from scratch is what makes the result recognisably the user's arrangement\n * instead of an arbitrary repack.\n *\n * A visual row holding more items than the grid is wide is wrapped into\n * sub-rows of at most `cols`, so nothing tiles past the right edge. That can\n * take the result past `rows`; the caller decides whether to grow the grid or\n * let its bounds clip.\n *\n * This is the one operation that deliberately GROWS items — every gesture-driven\n * path refuses to, because growing on a move is a surprise. Here it is the whole\n * point, which is why it is a call the app makes rather than a mode the board is\n * in. Returns new items in the input's order; the input is not mutated.\n */\nexport function distributeEvenly(\n layout: Layout,\n { cols, rows }: { cols: number; rows: number },\n): LayoutItem[] {\n if (layout.length === 0) return [];\n\n const gridCols = Math.max(1, cols);\n const gridRows = Math.max(1, rows);\n\n const sorted = [...layout].sort((a, b) =>\n a.y !== b.y ? a.y - b.y : a.x - b.x,\n );\n\n const groups: LayoutItem[][] = [];\n let lastY: number | null = null;\n for (const item of sorted) {\n if (lastY === null || item.y !== lastY) {\n groups.push([]);\n lastY = item.y;\n }\n groups[groups.length - 1].push(item);\n }\n\n const rowGroups: LayoutItem[][] = [];\n for (const group of groups) {\n if (group.length <= gridCols) {\n rowGroups.push(group);\n } else {\n for (let i = 0; i < group.length; i += gridCols) {\n rowGroups.push(group.slice(i, i + gridCols));\n }\n }\n }\n\n const rowHeights = splitEvenly(gridRows, rowGroups.length);\n const placed = new Map<string, LayoutItem>();\n let y = 0;\n rowGroups.forEach((group, gi) => {\n const h = rowHeights[gi];\n const widths = splitEvenly(gridCols, group.length);\n let x = 0;\n group.forEach((item, ci) => {\n const w = widths[ci];\n placed.set(item.i, { ...item, x, y, w, h });\n x += w;\n });\n y += h;\n });\n\n // Emit in the caller's order, not the sort's: a layout is keyed by `i`, and\n // reordering it would churn every consumer that diffs the array positionally.\n return layout.map((item) => placed.get(item.i) ?? item);\n}\n"],"mappings":"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"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-c325dcb | Cube Dev Team */
|
|
2
|
-
//#region src/components/layout/Board/grid-core/sort.ts
|
|
3
|
-
/**
|
|
4
|
-
* Sort layout items based on the compaction type.
|
|
5
|
-
*
|
|
6
|
-
* - Vertical compaction: sort by row (y) then column (x)
|
|
7
|
-
* - Horizontal compaction: sort by column (x) then row (y)
|
|
8
|
-
* - No compaction (null): return original order
|
|
9
|
-
*/
|
|
10
|
-
function sortLayoutItems(layout, compactType) {
|
|
11
|
-
if (compactType === "horizontal") return sortLayoutItemsByColRow(layout);
|
|
12
|
-
if (compactType === "vertical") return sortLayoutItemsByRowCol(layout);
|
|
13
|
-
if (compactType === "wrap") return sortLayoutItemsByRowCol(layout);
|
|
14
|
-
return [...layout];
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Sort layout items by row ascending, then column ascending.
|
|
18
|
-
*/
|
|
19
|
-
function sortLayoutItemsByRowCol(layout) {
|
|
20
|
-
return [...layout].sort((a, b) => {
|
|
21
|
-
if (a.y !== b.y) return a.y - b.y;
|
|
22
|
-
return a.x - b.x;
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Sort layout items by column ascending, then row ascending.
|
|
27
|
-
*/
|
|
28
|
-
function sortLayoutItemsByColRow(layout) {
|
|
29
|
-
return [...layout].sort((a, b) => {
|
|
30
|
-
if (a.x !== b.x) return a.x - b.x;
|
|
31
|
-
return a.y - b.y;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
//#endregion
|
|
36
|
-
export { sortLayoutItems, sortLayoutItemsByColRow, sortLayoutItemsByRowCol };
|
|
37
|
-
//# sourceMappingURL=sort.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sort.js","names":["CompactType","Layout","LayoutItem","sortLayoutItems","layout","compactType","sortLayoutItemsByColRow","sortLayoutItemsByRowCol","sort","a","b","y","x"],"sources":["../../../../../src/components/layout/Board/grid-core/sort.ts"],"sourcesContent":["/**\n * Sorting utilities for grid layouts.\n *\n * Vendored from react-grid-layout v2 (`src/core/sort.ts`).\n * See ./NOTICE.md for attribution and license.\n */\n\nimport type { CompactType, Layout, LayoutItem } from './types';\n\n/**\n * Sort layout items based on the compaction type.\n *\n * - Vertical compaction: sort by row (y) then column (x)\n * - Horizontal compaction: sort by column (x) then row (y)\n * - No compaction (null): return original order\n */\nexport function sortLayoutItems(\n layout: Layout,\n compactType: CompactType,\n): LayoutItem[] {\n if (compactType === 'horizontal') {\n return sortLayoutItemsByColRow(layout);\n }\n if (compactType === 'vertical') {\n return sortLayoutItemsByRowCol(layout);\n }\n if (compactType === 'wrap') {\n // Wrap mode uses row-col order (reading order: left-to-right, top-to-bottom)\n return sortLayoutItemsByRowCol(layout);\n }\n // No compaction - return a copy to maintain immutability\n return [...layout];\n}\n\n/**\n * Sort layout items by row ascending, then column ascending.\n */\nexport function sortLayoutItemsByRowCol(layout: Layout): LayoutItem[] {\n return [...layout].sort((a, b) => {\n if (a.y !== b.y) {\n return a.y - b.y;\n }\n return a.x - b.x;\n });\n}\n\n/**\n * Sort layout items by column ascending, then row ascending.\n */\nexport function sortLayoutItemsByColRow(layout: Layout): LayoutItem[] {\n return [...layout].sort((a, b) => {\n if (a.x !== b.x) {\n return a.x - b.x;\n }\n return a.y - b.y;\n });\n}\n"],"mappings":";;;;;;;;;AAgBA,SAAgBG,gBACdC,QACAC,aACc;AACd,KAAIA,gBAAgB,aAClB,QAAOC,wBAAwBF,OAAO;AAExC,KAAIC,gBAAgB,WAClB,QAAOE,wBAAwBH,OAAO;AAExC,KAAIC,gBAAgB,OAElB,QAAOE,wBAAwBH,OAAO;AAGxC,QAAO,CAAC,GAAGA,OAAO;;;;;AAMpB,SAAgBG,wBAAwBH,QAA8B;AACpE,QAAO,CAAC,GAAGA,OAAO,CAACI,MAAMC,GAAGC,MAAM;AAChC,MAAID,EAAEE,MAAMD,EAAEC,EACZ,QAAOF,EAAEE,IAAID,EAAEC;AAEjB,SAAOF,EAAEG,IAAIF,EAAEE;GACf;;;;;AAMJ,SAAgBN,wBAAwBF,QAA8B;AACpE,QAAO,CAAC,GAAGA,OAAO,CAACI,MAAMC,GAAGC,MAAM;AAChC,MAAID,EAAEG,MAAMF,EAAEE,EACZ,QAAOH,EAAEG,IAAIF,EAAEE;AAEjB,SAAOH,EAAEE,IAAID,EAAEC;GACf"}
|