@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,254 +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/collision-modes.ts
|
|
3
|
-
/** Whether a single grid cell is free of every item in `others`. */
|
|
4
|
-
function cellFree(others, x, y) {
|
|
5
|
-
for (let i = 0; i < others.length; i++) {
|
|
6
|
-
const o = others[i];
|
|
7
|
-
if (o !== void 0 && x >= o.x && x < o.x + o.w && y >= o.y && y < o.y + o.h) return false;
|
|
8
|
-
}
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* The largest rectangle anchored at `anchor` that fits without overlapping
|
|
13
|
-
* `others`, growing rightward and downward only.
|
|
14
|
-
*
|
|
15
|
-
* Never larger than `desired` (a drag must never *upscale* a widget - growing
|
|
16
|
-
* things is an explicit, opt-in operation like "distribute evenly", not a side
|
|
17
|
-
* effect of moving them), never smaller than the item's own `minW`/`minH`, and
|
|
18
|
-
* never past `cols` / `maxRows`. Among the candidates the largest-area rectangle
|
|
19
|
-
* wins, breaking ties on width: a grid is read left to right, so a wide-and-flat
|
|
20
|
-
* result is the less surprising of two equal-area fits.
|
|
21
|
-
*
|
|
22
|
-
* Returns `null` when not even the minimum size fits, which the callers treat as
|
|
23
|
-
* "no resolution" and fall back to reverting.
|
|
24
|
-
*/
|
|
25
|
-
function maxFreeRectAt(others, anchor, desired, limits, mins) {
|
|
26
|
-
if (anchor.x < 0 || anchor.y < 0) return null;
|
|
27
|
-
const minW = Math.max(1, mins?.minW ?? 1);
|
|
28
|
-
const minH = Math.max(1, mins?.minH ?? 1);
|
|
29
|
-
const maxRows = limits.maxRows ?? Infinity;
|
|
30
|
-
const maxW = Math.min(desired.w, limits.cols - anchor.x);
|
|
31
|
-
const maxH = Math.min(desired.h, Number.isFinite(maxRows) ? maxRows - anchor.y : desired.h);
|
|
32
|
-
if (maxW < minW || maxH < minH) return null;
|
|
33
|
-
const free = [];
|
|
34
|
-
for (let dx = 0; dx < maxW; dx++) {
|
|
35
|
-
let h = 0;
|
|
36
|
-
while (h < maxH && cellFree(others, anchor.x + dx, anchor.y + h)) h++;
|
|
37
|
-
free.push(h);
|
|
38
|
-
if (h === 0) break;
|
|
39
|
-
}
|
|
40
|
-
let best = null;
|
|
41
|
-
let bestArea = 0;
|
|
42
|
-
let limit = maxH;
|
|
43
|
-
for (let w = 1; w <= free.length; w++) {
|
|
44
|
-
limit = Math.min(limit, free[w - 1]);
|
|
45
|
-
if (limit < minH) break;
|
|
46
|
-
if (w < minW) continue;
|
|
47
|
-
const area = w * limit;
|
|
48
|
-
if (area >= bestArea) {
|
|
49
|
-
best = {
|
|
50
|
-
w,
|
|
51
|
-
h: limit
|
|
52
|
-
};
|
|
53
|
-
bestArea = area;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return best;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* The cells beyond a pinned anchor that a drag could never ask for.
|
|
60
|
-
*
|
|
61
|
-
* `gridBounds` clamps a drag anchor to `cols - w` (and `maxRows - h`), which
|
|
62
|
-
* assumes the widget keeps the size it started with. So when the blocker is to
|
|
63
|
-
* the LEFT of the free room and that room is narrower than the widget, every
|
|
64
|
-
* anchor a pointer can produce lands inside the blocker - and the mode whose
|
|
65
|
-
* whole job is to shrink the widget into that room never gets offered it. The
|
|
66
|
-
* drop just reverts. The mirror case has no such problem, because the anchor at
|
|
67
|
-
* column 0 is always reachable: that asymmetry is why downscaling into room on
|
|
68
|
-
* the left has always worked and room on the right has not. The row axis clamps
|
|
69
|
-
* the same way, so a board with a finite `maxRows` has the same blind spot below
|
|
70
|
-
* a blocker.
|
|
71
|
-
*
|
|
72
|
-
* Nothing is offered unless the anchor is sitting ON the limit, pinned against
|
|
73
|
-
* the far edge with the pointer unable to push it further. An anchor short of the
|
|
74
|
-
* limit is the pointer's own choice - every cell between it and the limit was
|
|
75
|
-
* available to ask for - so a blocked drop there still just reverts, exactly as
|
|
76
|
-
* before. Without that gate a widget dropped on an occupied cell would skip over
|
|
77
|
-
* free cells the pointer could perfectly well have aimed at.
|
|
78
|
-
*
|
|
79
|
-
* A pinned anchor's span ends at the last row/column of the grid, so every cell
|
|
80
|
-
* returned - and every rectangle that can be measured from one - lies inside the
|
|
81
|
-
* footprint the widget is already covering.
|
|
82
|
-
*/
|
|
83
|
-
function clampedOutAnchors(item, desired, limits) {
|
|
84
|
-
const maxRows = limits.maxRows ?? Infinity;
|
|
85
|
-
const bounded = Number.isFinite(maxRows);
|
|
86
|
-
const xLimit = Math.max(0, limits.cols - desired.w);
|
|
87
|
-
const yLimit = bounded ? Math.max(0, maxRows - desired.h) : Infinity;
|
|
88
|
-
const anchors = [];
|
|
89
|
-
if (item.x === xLimit) {
|
|
90
|
-
const lastX = Math.min(item.x + desired.w - 1, limits.cols - 1);
|
|
91
|
-
for (let x = item.x + 1; x <= lastX; x++) anchors.push({
|
|
92
|
-
x,
|
|
93
|
-
y: item.y
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
if (bounded && item.y === yLimit) {
|
|
97
|
-
const lastY = Math.min(item.y + desired.h - 1, maxRows - 1);
|
|
98
|
-
for (let y = item.y + 1; y <= lastY; y++) anchors.push({
|
|
99
|
-
x: item.x,
|
|
100
|
-
y
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
return anchors;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Shrink the placement to the room actually available at the cell it was
|
|
107
|
-
* dropped on, or - when that cell cannot take the widget at any size and the
|
|
108
|
-
* anchor is pinned against the grid edge - at a cell the clamp hid from the
|
|
109
|
-
* pointer (see `clampedOutAnchors`). The largest fit among those wins, so the
|
|
110
|
-
* widget takes as much of the room it is already hovering as there is.
|
|
111
|
-
*/
|
|
112
|
-
function downscaleInPlace(layout, item, others, desired, limits) {
|
|
113
|
-
const fitAt = (anchor) => maxFreeRectAt(others, anchor, desired, limits, item);
|
|
114
|
-
let anchor = {
|
|
115
|
-
x: item.x,
|
|
116
|
-
y: item.y
|
|
117
|
-
};
|
|
118
|
-
let fit = fitAt(anchor);
|
|
119
|
-
if (!fit) {
|
|
120
|
-
let bestArea = 0;
|
|
121
|
-
for (const candidate of clampedOutAnchors(item, desired, limits)) {
|
|
122
|
-
const candidateFit = fitAt(candidate);
|
|
123
|
-
if (!candidateFit) continue;
|
|
124
|
-
const area = candidateFit.w * candidateFit.h;
|
|
125
|
-
if (area > bestArea) {
|
|
126
|
-
bestArea = area;
|
|
127
|
-
fit = candidateFit;
|
|
128
|
-
anchor = candidate;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if (!fit) return null;
|
|
133
|
-
if (fit.w === item.w && fit.h === item.h && anchor.x === item.x && anchor.y === item.y) return null;
|
|
134
|
-
return layout.map((l) => l.i === item.i ? {
|
|
135
|
-
...l,
|
|
136
|
-
x: anchor.x,
|
|
137
|
-
y: anchor.y,
|
|
138
|
-
w: fit.w,
|
|
139
|
-
h: fit.h,
|
|
140
|
-
moved: true
|
|
141
|
-
} : l);
|
|
142
|
-
}
|
|
143
|
-
/** Number of cells two items share. Zero when they do not overlap at all. */
|
|
144
|
-
function overlapArea(a, b) {
|
|
145
|
-
const w = Math.min(a.x + a.w, b.x + b.w) - Math.max(a.x, b.x);
|
|
146
|
-
const h = Math.min(a.y + a.h, b.y + b.h) - Math.max(a.y, b.y);
|
|
147
|
-
return w > 0 && h > 0 ? w * h : 0;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Exchange the placement with one of the widgets under it.
|
|
151
|
-
*
|
|
152
|
-
* The dragged widget takes the other's cell and the other takes the cell the
|
|
153
|
-
* dragged widget came from. Each keeps as much of its own size as fits there -
|
|
154
|
-
* that cell plus any free space adjacent to it - and neither ever grows.
|
|
155
|
-
*
|
|
156
|
-
* `from` is whatever the caller's layout says, so it is the caller that decides
|
|
157
|
-
* what "came from" means. A pointer drag resolves every frame against the
|
|
158
|
-
* arrangement the gesture started with, making it the cell the drag began at, and
|
|
159
|
-
* keeping the result a pure function of where the pointer is; chaining frames off
|
|
160
|
-
* each other instead would exchange with every widget swept over.
|
|
161
|
-
* The slot the dragged widget is leaving is reserved for the displaced widget
|
|
162
|
-
* while the dragged one is sized, so the two can never claim the same cells: the
|
|
163
|
-
* result is overlap-free by construction, not by a follow-up check.
|
|
164
|
-
*/
|
|
165
|
-
function exchangeWithCollision(layout, item, collisions, from, desired, limits) {
|
|
166
|
-
if (from.x === item.x && from.y === item.y) return null;
|
|
167
|
-
const candidates = collisions.filter((c) => !c.static).map((c) => ({
|
|
168
|
-
c,
|
|
169
|
-
area: overlapArea(item, c)
|
|
170
|
-
})).sort((p, q) => q.area - p.area || p.c.y - q.c.y || p.c.x - q.c.x).map(({ c }) => c);
|
|
171
|
-
for (const other of candidates) {
|
|
172
|
-
const exchanged = exchangeWith(layout, item, other, from, desired, limits);
|
|
173
|
-
if (exchanged) return exchanged;
|
|
174
|
-
}
|
|
175
|
-
return null;
|
|
176
|
-
}
|
|
177
|
-
/** One concrete two-widget exchange, or `null` if either side cannot fit. */
|
|
178
|
-
function exchangeWith(layout, item, other, from, desired, limits) {
|
|
179
|
-
const rest = layout.filter((l) => l.i !== item.i && l.i !== other.i);
|
|
180
|
-
const originSlot = {
|
|
181
|
-
i: "origin-slot-reservation",
|
|
182
|
-
x: from.x,
|
|
183
|
-
y: from.y,
|
|
184
|
-
w: desired.w,
|
|
185
|
-
h: desired.h
|
|
186
|
-
};
|
|
187
|
-
const movedFit = maxFreeRectAt([...rest, originSlot], {
|
|
188
|
-
x: other.x,
|
|
189
|
-
y: other.y
|
|
190
|
-
}, desired, limits, item);
|
|
191
|
-
if (!movedFit) return null;
|
|
192
|
-
const moved = {
|
|
193
|
-
...item,
|
|
194
|
-
x: other.x,
|
|
195
|
-
y: other.y,
|
|
196
|
-
w: movedFit.w,
|
|
197
|
-
h: movedFit.h,
|
|
198
|
-
moved: true
|
|
199
|
-
};
|
|
200
|
-
const displacedFit = maxFreeRectAt([...rest, moved], {
|
|
201
|
-
x: from.x,
|
|
202
|
-
y: from.y
|
|
203
|
-
}, {
|
|
204
|
-
w: other.w,
|
|
205
|
-
h: other.h
|
|
206
|
-
}, limits, other);
|
|
207
|
-
if (!displacedFit) return null;
|
|
208
|
-
const displaced = {
|
|
209
|
-
...other,
|
|
210
|
-
x: from.x,
|
|
211
|
-
y: from.y,
|
|
212
|
-
w: displacedFit.w,
|
|
213
|
-
h: displacedFit.h,
|
|
214
|
-
moved: true
|
|
215
|
-
};
|
|
216
|
-
return layout.map((l) => l.i === item.i ? moved : l.i === other.i ? displaced : l);
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Build the resolver `moveElement` consults instead of reverting a blocked move,
|
|
220
|
-
* or `undefined` for `'revert'` (and for an unset mode), which keeps the engine
|
|
221
|
-
* on its original path with no added work.
|
|
222
|
-
*
|
|
223
|
-
* For an in-board drag, `'swap'` is an escalation ladder: exchange with one of
|
|
224
|
-
* the widgets under the drop, else downscale at the drop cell, else revert. A
|
|
225
|
-
* dense grid stays draggable that way - refusing everything that is not a clean
|
|
226
|
-
* one-to-one trade would make the mode feel broken exactly where it is needed.
|
|
227
|
-
* Cross-board callers pass `allowExchange: false`, which turns the same mode into
|
|
228
|
-
* downscaling at the drop cell - there is no slot on the destination to trade
|
|
229
|
-
* back, and a transfer that cannot resolve is placed in a free cell rather than
|
|
230
|
-
* refused, since a widget dropped somewhere has to end up somewhere.
|
|
231
|
-
*/
|
|
232
|
-
function createCollisionResolver(mode, options) {
|
|
233
|
-
if (!mode || mode === "revert") return void 0;
|
|
234
|
-
const limits = {
|
|
235
|
-
cols: options.cols,
|
|
236
|
-
maxRows: options.maxRows
|
|
237
|
-
};
|
|
238
|
-
return ({ layout, item, collisions, from }) => {
|
|
239
|
-
const others = layout.filter((l) => l.i !== item.i);
|
|
240
|
-
const desired = options.desired ?? {
|
|
241
|
-
w: item.w,
|
|
242
|
-
h: item.h
|
|
243
|
-
};
|
|
244
|
-
if (mode === "swap" && options.allowExchange !== false) {
|
|
245
|
-
const exchanged = exchangeWithCollision(layout, item, collisions, from, desired, limits);
|
|
246
|
-
if (exchanged) return exchanged;
|
|
247
|
-
}
|
|
248
|
-
return downscaleInPlace(layout, item, others, desired, limits);
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
//#endregion
|
|
253
|
-
export { createCollisionResolver };
|
|
254
|
-
//# sourceMappingURL=collision-modes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collision-modes.js","names":["collides","CollisionMode","CollisionResolver","CollisionResolverOptions","Layout","LayoutItem","cellFree","others","x","y","i","length","o","undefined","w","h","maxFreeRectAt","anchor","desired","limits","cols","maxRows","mins","minW","minH","Math","max","Infinity","maxW","min","maxH","Number","isFinite","free","dx","push","best","bestArea","limit","area","clampedOutAnchors","item","bounded","xLimit","yLimit","anchors","lastX","lastY","downscaleInPlace","layout","fitAt","fit","candidate","candidateFit","map","l","moved","overlapArea","a","b","exchangeWithCollision","collisions","from","candidates","filter","c","static","sort","p","q","other","exchanged","exchangeWith","rest","originSlot","movedFit","displacedFit","displaced","createCollisionResolver","mode","options","allowExchange","isOverlapFree","j"],"sources":["../../../../../src/components/layout/Board/grid-core/collision-modes.ts"],"sourcesContent":["/**\n * Collision resolution strategies for a grid that prevents collisions.\n *\n * Original UI Kit code (not vendored from react-grid-layout): the upstream\n * engine only ever reverts a blocked move.\n *\n * When `preventCollision` is on, `moveElement` refuses any placement that\n * overlaps an existing item and snaps the dragged item back. That is the right\n * default, but a free grid often wants the placement *resolved* instead of\n * refused - shrunk into whatever room is actually there, or exchanged with the\n * widget already sitting in the target slot. These strategies produce such a\n * resolution, and every resolution they return is overlap-free, so the caller's\n * own overlap guards keep working unchanged.\n */\n\nimport { collides } from './collision';\n\nimport type {\n CollisionMode,\n CollisionResolver,\n CollisionResolverOptions,\n Layout,\n LayoutItem,\n} from './types';\n\n/** Whether a single grid cell is free of every item in `others`. */\nfunction cellFree(others: Layout, x: number, y: number): boolean {\n for (let i = 0; i < others.length; i++) {\n const o = others[i];\n if (\n o !== undefined &&\n x >= o.x &&\n x < o.x + o.w &&\n y >= o.y &&\n y < o.y + o.h\n ) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * The largest rectangle anchored at `anchor` that fits without overlapping\n * `others`, growing rightward and downward only.\n *\n * Never larger than `desired` (a drag must never *upscale* a widget - growing\n * things is an explicit, opt-in operation like \"distribute evenly\", not a side\n * effect of moving them), never smaller than the item's own `minW`/`minH`, and\n * never past `cols` / `maxRows`. Among the candidates the largest-area rectangle\n * wins, breaking ties on width: a grid is read left to right, so a wide-and-flat\n * result is the less surprising of two equal-area fits.\n *\n * Returns `null` when not even the minimum size fits, which the callers treat as\n * \"no resolution\" and fall back to reverting.\n */\nexport function maxFreeRectAt(\n others: Layout,\n anchor: { x: number; y: number },\n desired: { w: number; h: number },\n limits: { cols: number; maxRows?: number },\n mins?: { minW?: number; minH?: number },\n): { w: number; h: number } | null {\n if (anchor.x < 0 || anchor.y < 0) return null;\n\n const minW = Math.max(1, mins?.minW ?? 1);\n const minH = Math.max(1, mins?.minH ?? 1);\n const maxRows = limits.maxRows ?? Infinity;\n const maxW = Math.min(desired.w, limits.cols - anchor.x);\n const maxH = Math.min(\n desired.h,\n Number.isFinite(maxRows) ? maxRows - anchor.y : desired.h,\n );\n\n if (maxW < minW || maxH < minH) return null;\n\n // Free height available in each column of the candidate band, measured down\n // from the anchor row and capped at the tallest useful height.\n const free: number[] = [];\n for (let dx = 0; dx < maxW; dx++) {\n let h = 0;\n while (h < maxH && cellFree(others, anchor.x + dx, anchor.y + h)) h++;\n free.push(h);\n // A column with no room at all caps every wider candidate, so stop early.\n if (h === 0) break;\n }\n\n let best: { w: number; h: number } | null = null;\n let bestArea = 0;\n let limit = maxH;\n for (let w = 1; w <= free.length; w++) {\n limit = Math.min(limit, free[w - 1]!);\n if (limit < minH) break;\n if (w < minW) continue;\n const area = w * limit;\n // `>=` so the widest of several equal-area fits wins: `w` only grows here, so\n // the last match is the widest one.\n if (area >= bestArea) {\n best = { w, h: limit };\n bestArea = area;\n }\n }\n\n return best;\n}\n\n/**\n * The cells beyond a pinned anchor that a drag could never ask for.\n *\n * `gridBounds` clamps a drag anchor to `cols - w` (and `maxRows - h`), which\n * assumes the widget keeps the size it started with. So when the blocker is to\n * the LEFT of the free room and that room is narrower than the widget, every\n * anchor a pointer can produce lands inside the blocker - and the mode whose\n * whole job is to shrink the widget into that room never gets offered it. The\n * drop just reverts. The mirror case has no such problem, because the anchor at\n * column 0 is always reachable: that asymmetry is why downscaling into room on\n * the left has always worked and room on the right has not. The row axis clamps\n * the same way, so a board with a finite `maxRows` has the same blind spot below\n * a blocker.\n *\n * Nothing is offered unless the anchor is sitting ON the limit, pinned against\n * the far edge with the pointer unable to push it further. An anchor short of the\n * limit is the pointer's own choice - every cell between it and the limit was\n * available to ask for - so a blocked drop there still just reverts, exactly as\n * before. Without that gate a widget dropped on an occupied cell would skip over\n * free cells the pointer could perfectly well have aimed at.\n *\n * A pinned anchor's span ends at the last row/column of the grid, so every cell\n * returned - and every rectangle that can be measured from one - lies inside the\n * footprint the widget is already covering.\n */\nfunction clampedOutAnchors(\n item: LayoutItem,\n desired: { w: number; h: number },\n limits: { cols: number; maxRows?: number },\n): { x: number; y: number }[] {\n const maxRows = limits.maxRows ?? Infinity;\n const bounded = Number.isFinite(maxRows);\n const xLimit = Math.max(0, limits.cols - desired.w);\n const yLimit = bounded ? Math.max(0, maxRows - desired.h) : Infinity;\n\n const anchors: { x: number; y: number }[] = [];\n // Each axis is clamped on its own, so each recovers on its own: slide along\n // the one the limit actually pinned, never diagonally into open grid.\n if (item.x === xLimit) {\n const lastX = Math.min(item.x + desired.w - 1, limits.cols - 1);\n for (let x = item.x + 1; x <= lastX; x++) anchors.push({ x, y: item.y });\n }\n if (bounded && item.y === yLimit) {\n const lastY = Math.min(item.y + desired.h - 1, maxRows - 1);\n for (let y = item.y + 1; y <= lastY; y++) anchors.push({ x: item.x, y });\n }\n return anchors;\n}\n\n/**\n * Shrink the placement to the room actually available at the cell it was\n * dropped on, or - when that cell cannot take the widget at any size and the\n * anchor is pinned against the grid edge - at a cell the clamp hid from the\n * pointer (see `clampedOutAnchors`). The largest fit among those wins, so the\n * widget takes as much of the room it is already hovering as there is.\n */\nfunction downscaleInPlace(\n layout: Layout,\n item: LayoutItem,\n others: Layout,\n desired: { w: number; h: number },\n limits: { cols: number; maxRows?: number },\n): LayoutItem[] | null {\n const fitAt = (anchor: { x: number; y: number }) =>\n maxFreeRectAt(others, anchor, desired, limits, item);\n\n let anchor = { x: item.x, y: item.y };\n let fit = fitAt(anchor);\n\n if (!fit) {\n let bestArea = 0;\n for (const candidate of clampedOutAnchors(item, desired, limits)) {\n const candidateFit = fitAt(candidate);\n if (!candidateFit) continue;\n const area = candidateFit.w * candidateFit.h;\n // `>` keeps the first of several equal-area fits, and the scan runs in\n // reading order from the drop cell, so that is the closest one to it.\n if (area > bestArea) {\n bestArea = area;\n fit = candidateFit;\n anchor = candidate;\n }\n }\n }\n\n if (!fit) return null;\n // Nothing to resolve: the requested cell takes the requested size, so the\n // collision was not a sizing problem and reverting is still the honest answer.\n if (\n fit.w === item.w &&\n fit.h === item.h &&\n anchor.x === item.x &&\n anchor.y === item.y\n ) {\n return null;\n }\n\n return layout.map((l) =>\n l.i === item.i\n ? { ...l, x: anchor.x, y: anchor.y, w: fit!.w, h: fit!.h, moved: true }\n : l,\n );\n}\n\n/** Number of cells two items share. Zero when they do not overlap at all. */\nfunction overlapArea(a: LayoutItem, b: LayoutItem): number {\n const w = Math.min(a.x + a.w, b.x + b.w) - Math.max(a.x, b.x);\n const h = Math.min(a.y + a.h, b.y + b.h) - Math.max(a.y, b.y);\n return w > 0 && h > 0 ? w * h : 0;\n}\n\n/**\n * Exchange the placement with one of the widgets under it.\n *\n * The dragged widget takes the other's cell and the other takes the cell the\n * dragged widget came from. Each keeps as much of its own size as fits there -\n * that cell plus any free space adjacent to it - and neither ever grows.\n *\n * `from` is whatever the caller's layout says, so it is the caller that decides\n * what \"came from\" means. A pointer drag resolves every frame against the\n * arrangement the gesture started with, making it the cell the drag began at, and\n * keeping the result a pure function of where the pointer is; chaining frames off\n * each other instead would exchange with every widget swept over.\n * The slot the dragged widget is leaving is reserved for the displaced widget\n * while the dragged one is sized, so the two can never claim the same cells: the\n * result is overlap-free by construction, not by a follow-up check.\n */\nfunction exchangeWithCollision(\n layout: Layout,\n item: LayoutItem,\n collisions: LayoutItem[],\n from: { x: number; y: number },\n desired: { w: number; h: number },\n limits: { cols: number; maxRows?: number },\n): LayoutItem[] | null {\n // Nothing to trade if the widget has not actually left a slot behind - a\n // cross-board drop, where it never had one on this board.\n if (from.x === item.x && from.y === item.y) return null;\n\n // A drop that spans a boundary covers two widgets at once, and refusing those\n // frames would leave a band mid-drag where nothing is swapped at all: the\n // placeholder snaps back to the origin, then jumps to the far swap once the drop\n // clears the first widget. Trade with the one the drop covers most instead, so\n // the swap only ever changes which partner it is - never blinks away. Ties go to\n // the widget earlier in reading order, so the choice is deterministic. Exactly\n // one widget is ever displaced, whichever is picked.\n const candidates = collisions\n .filter((c) => !c.static)\n .map((c) => ({ c, area: overlapArea(item, c) }))\n .sort((p, q) => q.area - p.area || p.c.y - q.c.y || p.c.x - q.c.x)\n .map(({ c }) => c);\n\n for (const other of candidates) {\n const exchanged = exchangeWith(layout, item, other, from, desired, limits);\n if (exchanged) return exchanged;\n }\n return null;\n}\n\n/** One concrete two-widget exchange, or `null` if either side cannot fit. */\nfunction exchangeWith(\n layout: Layout,\n item: LayoutItem,\n other: LayoutItem,\n from: { x: number; y: number },\n desired: { w: number; h: number },\n limits: { cols: number; maxRows?: number },\n): LayoutItem[] | null {\n const rest = layout.filter((l) => l.i !== item.i && l.i !== other.i);\n // The slot being vacated, held back so the dragged widget cannot grow into the\n // space the displaced one is about to need. Ids are never compared here (the\n // scan works cell by cell), so this placeholder cannot clash with a real one.\n const originSlot: LayoutItem = {\n i: 'origin-slot-reservation',\n x: from.x,\n y: from.y,\n w: desired.w,\n h: desired.h,\n };\n\n const movedFit = maxFreeRectAt(\n [...rest, originSlot],\n { x: other.x, y: other.y },\n desired,\n limits,\n item,\n );\n if (!movedFit) return null;\n const moved: LayoutItem = {\n ...item,\n x: other.x,\n y: other.y,\n w: movedFit.w,\n h: movedFit.h,\n moved: true,\n };\n\n const displacedFit = maxFreeRectAt(\n [...rest, moved],\n { x: from.x, y: from.y },\n { w: other.w, h: other.h },\n limits,\n other,\n );\n if (!displacedFit) return null;\n const displaced: LayoutItem = {\n ...other,\n x: from.x,\n y: from.y,\n w: displacedFit.w,\n h: displacedFit.h,\n moved: true,\n };\n\n return layout.map((l) =>\n l.i === item.i ? moved : l.i === other.i ? displaced : l,\n );\n}\n\n/**\n * Build the resolver `moveElement` consults instead of reverting a blocked move,\n * or `undefined` for `'revert'` (and for an unset mode), which keeps the engine\n * on its original path with no added work.\n *\n * For an in-board drag, `'swap'` is an escalation ladder: exchange with one of\n * the widgets under the drop, else downscale at the drop cell, else revert. A\n * dense grid stays draggable that way - refusing everything that is not a clean\n * one-to-one trade would make the mode feel broken exactly where it is needed.\n * Cross-board callers pass `allowExchange: false`, which turns the same mode into\n * downscaling at the drop cell - there is no slot on the destination to trade\n * back, and a transfer that cannot resolve is placed in a free cell rather than\n * refused, since a widget dropped somewhere has to end up somewhere.\n */\nexport function createCollisionResolver(\n mode: CollisionMode | undefined,\n options: CollisionResolverOptions,\n): CollisionResolver | undefined {\n if (!mode || mode === 'revert') return undefined;\n\n const limits = { cols: options.cols, maxRows: options.maxRows };\n\n return ({ layout, item, collisions, from }) => {\n const others = layout.filter((l) => l.i !== item.i);\n const desired = options.desired ?? { w: item.w, h: item.h };\n\n if (mode === 'swap' && options.allowExchange !== false) {\n const exchanged = exchangeWithCollision(\n layout,\n item,\n collisions,\n from,\n desired,\n limits,\n );\n if (exchanged) return exchanged;\n }\n\n return downscaleInPlace(layout, item, others, desired, limits);\n };\n}\n\n/**\n * Whether a layout holds no overlapping pair. A resolution is only ever accepted\n * when this holds, so the specs assert it directly.\n */\nexport function isOverlapFree(layout: Layout): boolean {\n for (let i = 0; i < layout.length; i++) {\n for (let j = i + 1; j < layout.length; j++) {\n if (collides(layout[i]!, layout[j]!)) return false;\n }\n }\n return true;\n}\n"],"mappings":";;;AA0BA,SAASM,SAASC,QAAgBC,GAAWC,GAAoB;AAC/D,MAAK,IAAIC,IAAI,GAAGA,IAAIH,OAAOI,QAAQD,KAAK;EACtC,MAAME,IAAIL,OAAOG;AACjB,MACEE,MAAMC,UACNL,KAAKI,EAAEJ,KACPA,IAAII,EAAEJ,IAAII,EAAEE,KACZL,KAAKG,EAAEH,KACPA,IAAIG,EAAEH,IAAIG,EAAEG,EAEZ,QAAO;;AAGX,QAAO;;;;;;;;;;;;;;;;AAiBT,SAAgBC,cACdT,QACAU,QACAC,SACAC,QACAG,MACiC;AACjC,KAAIL,OAAOT,IAAI,KAAKS,OAAOR,IAAI,EAAG,QAAO;CAEzC,MAAMc,OAAOE,KAAKC,IAAI,GAAGJ,MAAMC,QAAQ,EAAE;CACzC,MAAMC,OAAOC,KAAKC,IAAI,GAAGJ,MAAME,QAAQ,EAAE;CACzC,MAAMH,UAAUF,OAAOE,WAAWM;CAClC,MAAMC,OAAOH,KAAKI,IAAIX,QAAQJ,GAAGK,OAAOC,OAAOH,OAAOT,EAAE;CACxD,MAAMsB,OAAOL,KAAKI,IAChBX,QAAQH,GACRgB,OAAOC,SAASX,QAAQ,GAAGA,UAAUJ,OAAOR,IAAIS,QAAQH,EACzD;AAED,KAAIa,OAAOL,QAAQO,OAAON,KAAM,QAAO;CAIvC,MAAMS,OAAiB,EAAE;AACzB,MAAK,IAAIC,KAAK,GAAGA,KAAKN,MAAMM,MAAM;EA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;GACtD,MAAMV,YAAYX,sBAChBX,QACAR,MACAoB,YACAC,MACA5C,SACAC,OACD;AACD,OAAIoD,UAAW,QAAOA;;AAGxB,SAAOvB,iBAAiBC,QAAQR,MAAMlC,QAAQW,SAASC,OAAO"}
|
|
@@ -1,35 +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/collision.ts
|
|
3
|
-
/**
|
|
4
|
-
* Check if two layout items collide (overlap).
|
|
5
|
-
*
|
|
6
|
-
* Two items collide if their bounding boxes overlap and they are not the same
|
|
7
|
-
* item.
|
|
8
|
-
*/
|
|
9
|
-
function collides(l1, l2) {
|
|
10
|
-
if (l1.i === l2.i) return false;
|
|
11
|
-
if (l1.x + l1.w <= l2.x) return false;
|
|
12
|
-
if (l1.x >= l2.x + l2.w) return false;
|
|
13
|
-
if (l1.y + l1.h <= l2.y) return false;
|
|
14
|
-
if (l1.y >= l2.y + l2.h) return false;
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Find the first item in the layout that collides with the given item.
|
|
19
|
-
*/
|
|
20
|
-
function getFirstCollision(layout, layoutItem) {
|
|
21
|
-
for (let i = 0; i < layout.length; i++) {
|
|
22
|
-
const item = layout[i];
|
|
23
|
-
if (item !== void 0 && collides(item, layoutItem)) return item;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Find all items in the layout that collide with the given item.
|
|
28
|
-
*/
|
|
29
|
-
function getAllCollisions(layout, layoutItem) {
|
|
30
|
-
return layout.filter((l) => collides(l, layoutItem));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
//#endregion
|
|
34
|
-
export { collides, getAllCollisions, getFirstCollision };
|
|
35
|
-
//# sourceMappingURL=collision.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collision.js","names":["Layout","LayoutItem","collides","l1","l2","i","x","w","y","h","getFirstCollision","layout","layoutItem","length","item","undefined","getAllCollisions","filter","l"],"sources":["../../../../../src/components/layout/Board/grid-core/collision.ts"],"sourcesContent":["/**\n * Collision detection utilities for grid layouts.\n *\n * Vendored from react-grid-layout v2 (`src/core/collision.ts`).\n * See ./NOTICE.md for attribution and license.\n */\n\nimport type { Layout, LayoutItem } from './types';\n\n/**\n * Check if two layout items collide (overlap).\n *\n * Two items collide if their bounding boxes overlap and they are not the same\n * item.\n */\nexport function collides(l1: LayoutItem, l2: LayoutItem): boolean {\n // Same element - can't collide with itself\n if (l1.i === l2.i) return false;\n\n // Check if bounding boxes don't overlap (any gap means no collision)\n if (l1.x + l1.w <= l2.x) return false; // l1 is completely left of l2\n if (l1.x >= l2.x + l2.w) return false; // l1 is completely right of l2\n if (l1.y + l1.h <= l2.y) return false; // l1 is completely above l2\n if (l1.y >= l2.y + l2.h) return false; // l1 is completely below l2\n\n // Bounding boxes overlap\n return true;\n}\n\n/**\n * Find the first item in the layout that collides with the given item.\n */\nexport function getFirstCollision(\n layout: Layout,\n layoutItem: LayoutItem,\n): LayoutItem | undefined {\n for (let i = 0; i < layout.length; i++) {\n const item = layout[i];\n if (item !== undefined && collides(item, layoutItem)) {\n return item;\n }\n }\n return undefined;\n}\n\n/**\n * Find all items in the layout that collide with the given item.\n */\nexport function getAllCollisions(\n layout: Layout,\n layoutItem: LayoutItem,\n): LayoutItem[] {\n return layout.filter((l): l is LayoutItem => collides(l, layoutItem));\n}\n"],"mappings":";;;;;;;;AAeA,SAAgBE,SAASC,IAAgBC,IAAyB;AAEhE,KAAID,GAAGE,MAAMD,GAAGC,EAAG,QAAO;AAG1B,KAAIF,GAAGG,IAAIH,GAAGI,KAAKH,GAAGE,EAAG,QAAO;AAChC,KAAIH,GAAGG,KAAKF,GAAGE,IAAIF,GAAGG,EAAG,QAAO;AAChC,KAAIJ,GAAGK,IAAIL,GAAGM,KAAKL,GAAGI,EAAG,QAAO;AAChC,KAAIL,GAAGK,KAAKJ,GAAGI,IAAIJ,GAAGK,EAAG,QAAO;AAGhC,QAAO;;;;;AAMT,SAAgBC,kBACdC,QACAC,YACwB;AACxB,MAAK,IAAIP,IAAI,GAAGA,IAAIM,OAAOE,QAAQR,KAAK;EACtC,MAAMS,OAAOH,OAAON;AACpB,MAAIS,SAASC,UAAab,SAASY,MAAMF,WAAW,CAClD,QAAOE;;;;;;AASb,SAAgBE,iBACdL,QACAC,YACc;AACd,QAAOD,OAAOM,QAAQC,MAAuBhB,SAASgB,GAAGN,WAAW,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { CompactType, Compactor } from "./types.js";
|
|
3
|
-
|
|
4
|
-
//#region src/components/layout/Board/grid-core/compactors.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Vertical compactor - moves items up to fill gaps. Default compaction mode.
|
|
7
|
-
*/
|
|
8
|
-
declare const verticalCompactor: Compactor;
|
|
9
|
-
/**
|
|
10
|
-
* Horizontal compactor - moves items left to fill gaps.
|
|
11
|
-
*/
|
|
12
|
-
declare const horizontalCompactor: Compactor;
|
|
13
|
-
/**
|
|
14
|
-
* No compaction - items stay where placed (free-form layouts).
|
|
15
|
-
*/
|
|
16
|
-
declare const noCompactor: Compactor;
|
|
17
|
-
/**
|
|
18
|
-
* Get a compactor by type (convenience for the string-based compactType API).
|
|
19
|
-
*/
|
|
20
|
-
declare function getCompactor(compactType: CompactType, allowOverlap?: boolean, preventCollision?: boolean): Compactor;
|
|
21
|
-
//#endregion
|
|
22
|
-
export { getCompactor, horizontalCompactor, noCompactor, verticalCompactor };
|
|
23
|
-
//# sourceMappingURL=compactors.d.ts.map
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-c325dcb | Cube Dev Team */
|
|
2
|
-
import { collides, getFirstCollision } from "./collision.js";
|
|
3
|
-
import { sortLayoutItemsByColRow, sortLayoutItemsByRowCol } from "./sort.js";
|
|
4
|
-
import { bottom, cloneLayout, cloneLayoutItem, getStatics } from "./layout.js";
|
|
5
|
-
|
|
6
|
-
//#region src/components/layout/Board/grid-core/compactors.ts
|
|
7
|
-
/**
|
|
8
|
-
* Compactor implementations.
|
|
9
|
-
*
|
|
10
|
-
* Vendored from react-grid-layout v2 (`src/core/compactors.ts`).
|
|
11
|
-
* See ./NOTICE.md for attribution and license.
|
|
12
|
-
*
|
|
13
|
-
* Compactors are pluggable strategies for removing gaps between grid items.
|
|
14
|
-
*/
|
|
15
|
-
/**
|
|
16
|
-
* Resolve a compaction collision by moving items.
|
|
17
|
-
*
|
|
18
|
-
* Before moving an item to a position, checks if that movement would cause
|
|
19
|
-
* collisions and recursively moves those items first.
|
|
20
|
-
*/
|
|
21
|
-
function resolveCompactionCollision(layout, item, moveToCoord, axis, hasStatics) {
|
|
22
|
-
const sizeProp = axis === "x" ? "w" : "h";
|
|
23
|
-
item[axis] += 1;
|
|
24
|
-
const itemIndex = layout.findIndex((l) => l.i === item.i);
|
|
25
|
-
const layoutHasStatics = hasStatics ?? getStatics(layout).length > 0;
|
|
26
|
-
for (let i = itemIndex + 1; i < layout.length; i++) {
|
|
27
|
-
const otherItem = layout[i];
|
|
28
|
-
if (otherItem === void 0) continue;
|
|
29
|
-
if (otherItem.static) continue;
|
|
30
|
-
if (!layoutHasStatics && otherItem.y > item.y + item.h) break;
|
|
31
|
-
if (collides(item, otherItem)) resolveCompactionCollision(layout, otherItem, moveToCoord + item[sizeProp], axis, layoutHasStatics);
|
|
32
|
-
}
|
|
33
|
-
item[axis] = moveToCoord;
|
|
34
|
-
}
|
|
35
|
-
/** Compact a single item vertically (move up). Mutates `l`. */
|
|
36
|
-
function compactItemVertical(compareWith, l, fullLayout, maxY) {
|
|
37
|
-
l.x = Math.max(l.x, 0);
|
|
38
|
-
l.y = Math.max(l.y, 0);
|
|
39
|
-
l.y = Math.min(maxY, l.y);
|
|
40
|
-
while (l.y > 0 && !getFirstCollision(compareWith, l)) l.y--;
|
|
41
|
-
let collision;
|
|
42
|
-
while ((collision = getFirstCollision(compareWith, l)) !== void 0) resolveCompactionCollision(fullLayout, l, collision.y + collision.h, "y");
|
|
43
|
-
l.y = Math.max(l.y, 0);
|
|
44
|
-
return l;
|
|
45
|
-
}
|
|
46
|
-
/** Compact a single item horizontally (move left). Mutates `l`. */
|
|
47
|
-
function compactItemHorizontal(compareWith, l, cols, fullLayout) {
|
|
48
|
-
l.x = Math.max(l.x, 0);
|
|
49
|
-
l.y = Math.max(l.y, 0);
|
|
50
|
-
while (l.x > 0 && !getFirstCollision(compareWith, l)) l.x--;
|
|
51
|
-
let collision;
|
|
52
|
-
while ((collision = getFirstCollision(compareWith, l)) !== void 0) {
|
|
53
|
-
resolveCompactionCollision(fullLayout, l, collision.x + collision.w, "x");
|
|
54
|
-
if (l.x + l.w > cols) {
|
|
55
|
-
l.x = cols - l.w;
|
|
56
|
-
l.y++;
|
|
57
|
-
while (l.x > 0 && !getFirstCollision(compareWith, l)) l.x--;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
l.x = Math.max(l.x, 0);
|
|
61
|
-
return l;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Vertical compactor - moves items up to fill gaps. Default compaction mode.
|
|
65
|
-
*/
|
|
66
|
-
const verticalCompactor = {
|
|
67
|
-
type: "vertical",
|
|
68
|
-
allowOverlap: false,
|
|
69
|
-
compact(layout, _cols) {
|
|
70
|
-
const compareWith = getStatics(layout);
|
|
71
|
-
let maxY = bottom(compareWith);
|
|
72
|
-
const sorted = sortLayoutItemsByRowCol(layout);
|
|
73
|
-
const out = new Array(layout.length);
|
|
74
|
-
for (let i = 0; i < sorted.length; i++) {
|
|
75
|
-
const sortedItem = sorted[i];
|
|
76
|
-
if (sortedItem === void 0) continue;
|
|
77
|
-
let l = cloneLayoutItem(sortedItem);
|
|
78
|
-
if (!l.static) {
|
|
79
|
-
l = compactItemVertical(compareWith, l, sorted, maxY);
|
|
80
|
-
maxY = Math.max(maxY, l.y + l.h);
|
|
81
|
-
compareWith.push(l);
|
|
82
|
-
}
|
|
83
|
-
const originalIndex = layout.indexOf(sortedItem);
|
|
84
|
-
out[originalIndex] = l;
|
|
85
|
-
l.moved = false;
|
|
86
|
-
}
|
|
87
|
-
return out;
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Horizontal compactor - moves items left to fill gaps.
|
|
92
|
-
*/
|
|
93
|
-
const horizontalCompactor = {
|
|
94
|
-
type: "horizontal",
|
|
95
|
-
allowOverlap: false,
|
|
96
|
-
compact(layout, cols) {
|
|
97
|
-
const compareWith = getStatics(layout);
|
|
98
|
-
const sorted = sortLayoutItemsByColRow(layout);
|
|
99
|
-
const out = new Array(layout.length);
|
|
100
|
-
for (let i = 0; i < sorted.length; i++) {
|
|
101
|
-
const sortedItem = sorted[i];
|
|
102
|
-
if (sortedItem === void 0) continue;
|
|
103
|
-
let l = cloneLayoutItem(sortedItem);
|
|
104
|
-
if (!l.static) {
|
|
105
|
-
l = compactItemHorizontal(compareWith, l, cols, sorted);
|
|
106
|
-
compareWith.push(l);
|
|
107
|
-
}
|
|
108
|
-
const originalIndex = layout.indexOf(sortedItem);
|
|
109
|
-
out[originalIndex] = l;
|
|
110
|
-
l.moved = false;
|
|
111
|
-
}
|
|
112
|
-
return out;
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
/**
|
|
116
|
-
* No compaction - items stay where placed (free-form layouts).
|
|
117
|
-
*/
|
|
118
|
-
const noCompactor = {
|
|
119
|
-
type: null,
|
|
120
|
-
allowOverlap: false,
|
|
121
|
-
compact(layout, _cols) {
|
|
122
|
-
return cloneLayout(layout);
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
/** Vertical compactor that allows overlapping items. */
|
|
126
|
-
const verticalOverlapCompactor = {
|
|
127
|
-
...verticalCompactor,
|
|
128
|
-
allowOverlap: true,
|
|
129
|
-
compact(layout, _cols) {
|
|
130
|
-
return cloneLayout(layout);
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
/** Horizontal compactor that allows overlapping items. */
|
|
134
|
-
const horizontalOverlapCompactor = {
|
|
135
|
-
...horizontalCompactor,
|
|
136
|
-
allowOverlap: true,
|
|
137
|
-
compact(layout, _cols) {
|
|
138
|
-
return cloneLayout(layout);
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
/** No compaction, with overlapping allowed. */
|
|
142
|
-
const noOverlapCompactor = {
|
|
143
|
-
...noCompactor,
|
|
144
|
-
allowOverlap: true
|
|
145
|
-
};
|
|
146
|
-
/**
|
|
147
|
-
* Get a compactor by type (convenience for the string-based compactType API).
|
|
148
|
-
*/
|
|
149
|
-
function getCompactor(compactType, allowOverlap = false, preventCollision = false) {
|
|
150
|
-
let baseCompactor;
|
|
151
|
-
if (allowOverlap) if (compactType === "vertical") baseCompactor = verticalOverlapCompactor;
|
|
152
|
-
else if (compactType === "horizontal") baseCompactor = horizontalOverlapCompactor;
|
|
153
|
-
else baseCompactor = noOverlapCompactor;
|
|
154
|
-
else if (compactType === "vertical") baseCompactor = verticalCompactor;
|
|
155
|
-
else if (compactType === "horizontal") baseCompactor = horizontalCompactor;
|
|
156
|
-
else baseCompactor = noCompactor;
|
|
157
|
-
if (preventCollision) return {
|
|
158
|
-
...baseCompactor,
|
|
159
|
-
preventCollision
|
|
160
|
-
};
|
|
161
|
-
return baseCompactor;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
//#endregion
|
|
165
|
-
export { compactItemHorizontal, compactItemVertical, getCompactor, horizontalCompactor, noCompactor, verticalCompactor };
|
|
166
|
-
//# sourceMappingURL=compactors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compactors.js","names":["collides","getFirstCollision","bottom","cloneLayout","cloneLayoutItem","getStatics","sortLayoutItemsByColRow","sortLayoutItemsByRowCol","Compactor","CompactType","Layout","LayoutItem","Mutable","resolveCompactionCollision","layout","item","moveToCoord","axis","hasStatics","sizeProp","itemIndex","findIndex","l","i","layoutHasStatics","length","otherItem","undefined","static","y","h","compactItemVertical","compareWith","fullLayout","maxY","x","Math","max","min","collision","compactItemHorizontal","cols","w","verticalCompactor","type","allowOverlap","compact","_cols","sorted","out","Array","sortedItem","push","originalIndex","indexOf","moved","horizontalCompactor","noCompactor","verticalOverlapCompactor","horizontalOverlapCompactor","noOverlapCompactor","getCompactor","compactType","preventCollision","baseCompactor"],"sources":["../../../../../src/components/layout/Board/grid-core/compactors.ts"],"sourcesContent":["/**\n * Compactor implementations.\n *\n * Vendored from react-grid-layout v2 (`src/core/compactors.ts`).\n * See ./NOTICE.md for attribution and license.\n *\n * Compactors are pluggable strategies for removing gaps between grid items.\n */\n\nimport { collides, getFirstCollision } from './collision';\nimport { bottom, cloneLayout, cloneLayoutItem, getStatics } from './layout';\nimport { sortLayoutItemsByColRow, sortLayoutItemsByRowCol } from './sort';\n\nimport type {\n Compactor,\n CompactType,\n Layout,\n LayoutItem,\n Mutable,\n} from './types';\n\n// ============================================================================\n// Helpers for Custom Compactors\n// ============================================================================\n\n/**\n * Resolve a compaction collision by moving items.\n *\n * Before moving an item to a position, checks if that movement would cause\n * collisions and recursively moves those items first.\n */\nexport function resolveCompactionCollision(\n layout: Layout,\n item: LayoutItem,\n moveToCoord: number,\n axis: 'x' | 'y',\n hasStatics?: boolean,\n): void {\n const sizeProp = axis === 'x' ? 'w' : 'h';\n\n // Temporarily increment position to check for collisions\n (item as Mutable<LayoutItem>)[axis] += 1;\n\n const itemIndex = layout.findIndex((l) => l.i === item.i);\n\n const layoutHasStatics = hasStatics ?? getStatics(layout).length > 0;\n\n for (let i = itemIndex + 1; i < layout.length; i++) {\n const otherItem = layout[i];\n if (otherItem === undefined) continue;\n if (otherItem.static) continue;\n // Optimization: break early if past this element, but only if no statics\n // are present. Static items can be scattered throughout the layout.\n if (!layoutHasStatics && otherItem.y > item.y + item.h) break;\n\n if (collides(item, otherItem)) {\n resolveCompactionCollision(\n layout,\n otherItem,\n moveToCoord + item[sizeProp],\n axis,\n layoutHasStatics,\n );\n }\n }\n\n (item as Mutable<LayoutItem>)[axis] = moveToCoord;\n}\n\n/** Compact a single item vertically (move up). Mutates `l`. */\nexport function compactItemVertical(\n compareWith: Layout,\n l: LayoutItem,\n fullLayout: Layout,\n maxY: number,\n): LayoutItem {\n // Correct negative positions first\n (l as Mutable<LayoutItem>).x = Math.max(l.x, 0);\n (l as Mutable<LayoutItem>).y = Math.max(l.y, 0);\n\n // Limit Y to the current bottom\n (l as Mutable<LayoutItem>).y = Math.min(maxY, l.y);\n\n // Move up as far as possible\n while (l.y > 0 && !getFirstCollision(compareWith, l)) {\n (l as Mutable<LayoutItem>).y--;\n }\n\n // Resolve collisions by moving down\n let collision: LayoutItem | undefined;\n while ((collision = getFirstCollision(compareWith, l)) !== undefined) {\n resolveCompactionCollision(fullLayout, l, collision.y + collision.h, 'y');\n }\n\n (l as Mutable<LayoutItem>).y = Math.max(l.y, 0);\n return l;\n}\n\n/** Compact a single item horizontally (move left). Mutates `l`. */\nexport function compactItemHorizontal(\n compareWith: Layout,\n l: LayoutItem,\n cols: number,\n fullLayout: Layout,\n): LayoutItem {\n // Correct negative positions first\n (l as Mutable<LayoutItem>).x = Math.max(l.x, 0);\n (l as Mutable<LayoutItem>).y = Math.max(l.y, 0);\n\n // Move left as far as possible\n while (l.x > 0 && !getFirstCollision(compareWith, l)) {\n (l as Mutable<LayoutItem>).x--;\n }\n\n // Resolve collisions\n let collision: LayoutItem | undefined;\n while ((collision = getFirstCollision(compareWith, l)) !== undefined) {\n resolveCompactionCollision(fullLayout, l, collision.x + collision.w, 'x');\n\n // Horizontal overflow: wrap to next row\n if (l.x + l.w > cols) {\n (l as Mutable<LayoutItem>).x = cols - l.w;\n (l as Mutable<LayoutItem>).y++;\n\n while (l.x > 0 && !getFirstCollision(compareWith, l)) {\n (l as Mutable<LayoutItem>).x--;\n }\n }\n }\n\n (l as Mutable<LayoutItem>).x = Math.max(l.x, 0);\n return l;\n}\n\n// ============================================================================\n// Vertical Compactor\n// ============================================================================\n\n/**\n * Vertical compactor - moves items up to fill gaps. Default compaction mode.\n */\nexport const verticalCompactor: Compactor = {\n type: 'vertical',\n allowOverlap: false,\n\n compact(layout: Layout, _cols: number): Layout {\n const compareWith = getStatics(layout);\n let maxY = bottom(compareWith);\n const sorted = sortLayoutItemsByRowCol(layout);\n const out: LayoutItem[] = new Array(layout.length);\n\n for (let i = 0; i < sorted.length; i++) {\n const sortedItem = sorted[i];\n if (sortedItem === undefined) continue;\n\n let l = cloneLayoutItem(sortedItem);\n\n if (!l.static) {\n l = compactItemVertical(compareWith, l, sorted, maxY);\n maxY = Math.max(maxY, l.y + l.h);\n compareWith.push(l);\n }\n\n const originalIndex = layout.indexOf(sortedItem);\n out[originalIndex] = l;\n l.moved = false;\n }\n\n return out;\n },\n};\n\n// ============================================================================\n// Horizontal Compactor\n// ============================================================================\n\n/**\n * Horizontal compactor - moves items left to fill gaps.\n */\nexport const horizontalCompactor: Compactor = {\n type: 'horizontal',\n allowOverlap: false,\n\n compact(layout: Layout, cols: number): Layout {\n const compareWith = getStatics(layout);\n const sorted = sortLayoutItemsByColRow(layout);\n const out: LayoutItem[] = new Array(layout.length);\n\n for (let i = 0; i < sorted.length; i++) {\n const sortedItem = sorted[i];\n if (sortedItem === undefined) continue;\n\n let l = cloneLayoutItem(sortedItem);\n\n if (!l.static) {\n l = compactItemHorizontal(compareWith, l, cols, sorted);\n compareWith.push(l);\n }\n\n const originalIndex = layout.indexOf(sortedItem);\n out[originalIndex] = l;\n l.moved = false;\n }\n\n return out;\n },\n};\n\n// ============================================================================\n// No Compaction\n// ============================================================================\n\n/**\n * No compaction - items stay where placed (free-form layouts).\n */\nexport const noCompactor: Compactor = {\n type: null,\n allowOverlap: false,\n\n compact(layout: Layout, _cols: number): Layout {\n return cloneLayout(layout);\n },\n};\n\n// ============================================================================\n// Overlap-Allowing Variants\n// ============================================================================\n\n/** Vertical compactor that allows overlapping items. */\nexport const verticalOverlapCompactor: Compactor = {\n ...verticalCompactor,\n allowOverlap: true,\n\n compact(layout: Layout, _cols: number): Layout {\n return cloneLayout(layout);\n },\n};\n\n/** Horizontal compactor that allows overlapping items. */\nexport const horizontalOverlapCompactor: Compactor = {\n ...horizontalCompactor,\n allowOverlap: true,\n\n compact(layout: Layout, _cols: number): Layout {\n return cloneLayout(layout);\n },\n};\n\n/** No compaction, with overlapping allowed. */\nexport const noOverlapCompactor: Compactor = {\n ...noCompactor,\n allowOverlap: true,\n};\n\n// ============================================================================\n// Factory Function\n// ============================================================================\n\n/**\n * Get a compactor by type (convenience for the string-based compactType API).\n */\nexport function getCompactor(\n compactType: CompactType,\n allowOverlap: boolean = false,\n preventCollision: boolean = false,\n): Compactor {\n let baseCompactor: Compactor;\n\n if (allowOverlap) {\n if (compactType === 'vertical') baseCompactor = verticalOverlapCompactor;\n else if (compactType === 'horizontal')\n baseCompactor = horizontalOverlapCompactor;\n else baseCompactor = noOverlapCompactor;\n } else {\n if (compactType === 'vertical') baseCompactor = verticalCompactor;\n else if (compactType === 'horizontal') baseCompactor = horizontalCompactor;\n // For 'wrap' and null, use noCompactor\n else baseCompactor = noCompactor;\n }\n\n if (preventCollision) {\n return { ...baseCompactor, preventCollision };\n }\n return baseCompactor;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA+BA,SAAgBa,2BACdC,QACAC,MACAC,aACAC,MACAC,YACM;CACN,MAAMC,WAAWF,SAAS,MAAM,MAAM;AAGtC,CAACF,KAA6BE,SAAS;CAEvC,MAAMG,YAAYN,OAAOO,WAAWC,MAAMA,EAAEC,MAAMR,KAAKQ,EAAE;CAEzD,MAAMC,mBAAmBN,cAAcb,WAAWS,OAAO,CAACW,SAAS;AAEnE,MAAK,IAAIF,IAAIH,YAAY,GAAGG,IAAIT,OAAOW,QAAQF,KAAK;EAClD,MAAMG,YAAYZ,OAAOS;AACzB,MAAIG,cAAcC,OAAW;AAC7B,MAAID,UAAUE,OAAQ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exB,OAAW;GAE9B,IAAIL,IAAIlB,gBAAgB+C,WAAW;AAEnC,OAAI,CAAC7B,EAAEM,QAAQ;AACbN,QAAIkB,sBAAsBR,aAAaV,GAAGmB,MAAMO,OAAO;AACvDhB,gBAAYoB,KAAK9B,EAAE;;GAGrB,MAAM+B,gBAAgBvC,OAAOwC,QAAQH,WAAW;AAChDF,OAAII,iBAAiB/B;AACrBA,KAAEiC,QAAQ;;AAGZ,SAAON;;CAEV;;;;AASD,MAAaQ,cAAyB;CACpCb,MAAM;CACNC,cAAc;CAEdC,QAAQhC,QAAgBiC,OAAuB;AAC7C,SAAO5C,YAAYW,OAAO;;CAE7B;;AAOD,MAAa4C,2BAAsC;CACjD,GAAGf;CACHE,cAAc;CAEdC,QAAQhC,QAAgBiC,OAAuB;AAC7C,SAAO5C,YAAYW,OAAO;;CAE7B;;AAGD,MAAa6C,6BAAwC;CACnD,GAAGH;CACHX,cAAc;CAEdC,QAAQhC,QAAgBiC,OAAuB;AAC7C,SAAO5C,YAAYW,OAAO;;CAE7B;;AAGD,MAAa8C,qBAAgC;CAC3C,GAAGH;CACHZ,cAAc;CACf;;;;AASD,SAAgBgB,aACdC,aACAjB,eAAwB,OACxBkB,mBAA4B,OACjB;CACX,IAAIC;AAEJ,KAAInB,aACF,KAAIiB,gBAAgB,WAAYE,iBAAgBN;UACvCI,gBAAgB,aACvBE,iBAAgBL;KACbK,iBAAgBJ;UAEjBE,gBAAgB,WAAYE,iBAAgBrB;UACvCmB,gBAAgB,aAAcE,iBAAgBR;KAElDQ,iBAAgBP;AAGvB,KAAIM,iBACF,QAAO;EAAE,GAAGC;EAAeD;EAAkB;AAE/C,QAAOC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { LayoutConstraint } from "./types.js";
|
|
3
|
-
|
|
4
|
-
//#region src/components/layout/Board/grid-core/constraints.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Grid boundary constraint. Ensures items stay within the grid bounds. This is
|
|
7
|
-
* the default position constraint.
|
|
8
|
-
*/
|
|
9
|
-
declare const gridBounds: LayoutConstraint;
|
|
10
|
-
/**
|
|
11
|
-
* Min/max size constraint. Enforces per-item minW/maxW/minH/maxH.
|
|
12
|
-
*/
|
|
13
|
-
declare const minMaxSize: LayoutConstraint;
|
|
14
|
-
/**
|
|
15
|
-
* Container bounds constraint. Constrains items to stay within the visible
|
|
16
|
-
* container (a replacement for the legacy `isBounded` prop).
|
|
17
|
-
*/
|
|
18
|
-
declare const containerBounds: LayoutConstraint;
|
|
19
|
-
/** Bounded X constraint. Only constrains horizontal position. */
|
|
20
|
-
declare const boundedX: LayoutConstraint;
|
|
21
|
-
/** Bounded Y constraint. Only constrains vertical position. */
|
|
22
|
-
declare const boundedY: LayoutConstraint;
|
|
23
|
-
/**
|
|
24
|
-
* Create an aspect ratio constraint (maintains width-to-height ratio in pixels).
|
|
25
|
-
*/
|
|
26
|
-
declare function aspectRatio(ratio: number): LayoutConstraint;
|
|
27
|
-
/** Create a snap-to-grid constraint. */
|
|
28
|
-
declare function snapToGrid(stepX: number, stepY?: number): LayoutConstraint;
|
|
29
|
-
/** Create a minimum size constraint (grid-wide). */
|
|
30
|
-
declare function minSize(minW: number, minH: number): LayoutConstraint;
|
|
31
|
-
/** Create a maximum size constraint (grid-wide). */
|
|
32
|
-
declare function maxSize(maxW: number, maxH: number): LayoutConstraint;
|
|
33
|
-
//#endregion
|
|
34
|
-
export { aspectRatio, boundedX, boundedY, containerBounds, gridBounds, maxSize, minMaxSize, minSize, snapToGrid };
|
|
35
|
-
//# sourceMappingURL=constraints.d.ts.map
|