@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,700 +0,0 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-c325dcb | Cube Dev Team */
|
|
2
|
-
import { useEvent } from "../../../_internal/hooks/use-event.js";
|
|
3
|
-
import { BoardWidgetStore } from "./board-store.js";
|
|
4
|
-
import { collides } from "./grid-core/collision.js";
|
|
5
|
-
import { createCollisionResolver } from "./grid-core/collision-modes.js";
|
|
6
|
-
import { placeInFreeSlot } from "./grid-core/placement.js";
|
|
7
|
-
import { bottom, cloneLayout, getLayoutItem, moveElement } from "./grid-core/layout.js";
|
|
8
|
-
import { moveElements } from "./grid-core/group-move.js";
|
|
9
|
-
import { calcXYRaw } from "./grid-core/calculate.js";
|
|
10
|
-
import { applyPositionConstraints } from "./grid-core/constraints.js";
|
|
11
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
12
|
-
|
|
13
|
-
//#region src/components/layout/Board/use-board-registry.ts
|
|
14
|
-
/**
|
|
15
|
-
* The dragged widget's center in viewport coordinates.
|
|
16
|
-
*
|
|
17
|
-
* This is the anchor the drop-target hit-test uses to pick which board a drag is
|
|
18
|
-
* over, so a board (including an empty one) opens as soon as the widget's center
|
|
19
|
-
* enters it rather than only once its whole top-left corner is inside.
|
|
20
|
-
*
|
|
21
|
-
* The landing itself stays anchored to the grabbed top-left (`rect.left/top` in
|
|
22
|
-
* `computeLanding`): that point is this center offset by the widget's own fixed
|
|
23
|
-
* pixel size, so the resolved landing cell keeps corresponding to where the
|
|
24
|
-
* floating overlay clone is drawn (see `WidgetHost`) and the placeholder keeps
|
|
25
|
-
* tracking the ghost. The only unavoidable divergence is while the widget
|
|
26
|
-
* physically overhangs a board edge - a placeholder cannot render outside row 0
|
|
27
|
-
* / column 0 - which is the accepted tradeoff for opening on the center.
|
|
28
|
-
*/
|
|
29
|
-
function rectCenter(rect) {
|
|
30
|
-
return {
|
|
31
|
-
x: rect.left + rect.width / 2,
|
|
32
|
-
y: rect.top + rect.height / 2
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Canonical key for the unordered pair `{id1, id2}`. Widget ids are unrestricted
|
|
37
|
-
* strings, so a naive `` `${id1}|${id2}` `` join is ambiguous - an id containing
|
|
38
|
-
* the delimiter lets two different pairs collide (e.g. `{"a|b","c"}` and
|
|
39
|
-
* `{"a","b|c"}` both yield `"a|b|c"`). `JSON.stringify` of the sorted tuple
|
|
40
|
-
* quotes and escapes each id, so distinct pairs always produce distinct keys.
|
|
41
|
-
*/
|
|
42
|
-
function pairKey(id1, id2) {
|
|
43
|
-
return id1 < id2 ? JSON.stringify([id1, id2]) : JSON.stringify([id2, id1]);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Keys of every overlapping pair in the layout (see `pairKey`), so two layouts'
|
|
47
|
-
* overlap sets can be compared to tell which overlaps a move *introduced* versus
|
|
48
|
-
* which already existed.
|
|
49
|
-
*/
|
|
50
|
-
function overlappingPairs(layout) {
|
|
51
|
-
const pairs = /* @__PURE__ */ new Set();
|
|
52
|
-
for (let i = 0; i < layout.length; i++) for (let j = i + 1; j < layout.length; j++) {
|
|
53
|
-
const a = layout[i];
|
|
54
|
-
const b = layout[j];
|
|
55
|
-
if (collides(a, b)) pairs.add(pairKey(a.i, b.i));
|
|
56
|
-
}
|
|
57
|
-
return pairs;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Whether `after` contains an overlapping pair that `before` did not. Used to
|
|
61
|
-
* reject only moves that *create* a new stack. A board may already hold
|
|
62
|
-
* overlapping widgets - a `compact={null}` layout is never gap-compacted, and an
|
|
63
|
-
* app can supply overlapping items directly (or toggle `allowOverlap` off after
|
|
64
|
-
* stacking) - and those pre-existing overlaps must not freeze every subsequent
|
|
65
|
-
* move by making a whole-layout collision check always true.
|
|
66
|
-
*/
|
|
67
|
-
function hasNewOverlap(before, after) {
|
|
68
|
-
const afterPairs = overlappingPairs(after);
|
|
69
|
-
for (const key of afterPairs) if (!before.has(key)) return true;
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Where a cross-board arrival ends up when the destination refuses the very first
|
|
74
|
-
* cell it was offered.
|
|
75
|
-
*
|
|
76
|
-
* `moveElement` answers a refused placement by restoring the item to where it
|
|
77
|
-
* came from. Every frame after the first has a real cell to go back to - the one
|
|
78
|
-
* the previous frame settled on - so the preview simply holds there, which is
|
|
79
|
-
* what keeps the placeholder from jumping about as the pointer sweeps across an
|
|
80
|
-
* occupied widget. The *first* frame on a board has no such cell: its origin is
|
|
81
|
-
* the synthetic seed one row above (or column left of) the anchor, which sits off
|
|
82
|
-
* the board entirely whenever the anchor is in row 0 or column 0. Holding that
|
|
83
|
-
* would preview - and commit - a widget outside the grid.
|
|
84
|
-
*
|
|
85
|
-
* So only that first frame relocates, to the nearest cell that can hold the
|
|
86
|
-
* widget. The destination's own widgets are the fixed `others`: an arrival is
|
|
87
|
-
* placed around them and never displaces one.
|
|
88
|
-
*
|
|
89
|
-
* A refusal is read off `origin` - the seed itself - rather than off the
|
|
90
|
-
* requested cell, because a resolver is allowed to place the widget somewhere
|
|
91
|
-
* other than the exact cell asked for (downscaling into room the anchor clamp hid
|
|
92
|
-
* from the pointer does exactly that). Only an item sitting back on its origin was
|
|
93
|
-
* actually refused; anything else is a resolution and stands.
|
|
94
|
-
*/
|
|
95
|
-
function landIncoming(layout, others, itemId, origin, landing, cols, maxRows) {
|
|
96
|
-
const placed = getLayoutItem(layout, itemId);
|
|
97
|
-
if (!placed || placed.x !== origin.x || placed.y !== origin.y) return layout;
|
|
98
|
-
const landed = placeInFreeSlot(others, {
|
|
99
|
-
...placed,
|
|
100
|
-
...landing
|
|
101
|
-
}, cols, maxRows);
|
|
102
|
-
return layout.map((l) => l.i === itemId ? {
|
|
103
|
-
...l,
|
|
104
|
-
...landed
|
|
105
|
-
} : l);
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Whether any item in `after` has a different size than it had in `before`.
|
|
109
|
-
*/
|
|
110
|
-
function resizesAnything(before, after) {
|
|
111
|
-
return after.some((a) => {
|
|
112
|
-
const b = before.find((it) => it.i === a.i);
|
|
113
|
-
return !!b && (b.w !== a.w || b.h !== a.h);
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
function useBoardRegistry(options) {
|
|
117
|
-
const store = useMemo(() => new BoardWidgetStore(), []);
|
|
118
|
-
const onTransferRef = useRef(options?.onWidgetTransfer);
|
|
119
|
-
onTransferRef.current = options?.onWidgetTransfer;
|
|
120
|
-
const overlayRef = useRef(null);
|
|
121
|
-
const boardsRef = useRef(/* @__PURE__ */ new Map());
|
|
122
|
-
const dragStateRef = useRef(null);
|
|
123
|
-
const affectedRef = useRef(/* @__PURE__ */ new Set());
|
|
124
|
-
const sourceSnapshotRef = useRef([]);
|
|
125
|
-
const targetSnapshotsRef = useRef(/* @__PURE__ */ new Map());
|
|
126
|
-
const previewRef = useRef(null);
|
|
127
|
-
const frozenRectsRef = useRef(/* @__PURE__ */ new Map());
|
|
128
|
-
const nestedInDraggedRef = useRef(/* @__PURE__ */ new Set());
|
|
129
|
-
const lastLandingRef = useRef(null);
|
|
130
|
-
const pointerPosRef = useRef(null);
|
|
131
|
-
const [dragState, setDragStateInternal] = useState(null);
|
|
132
|
-
const setDragState = useCallback((next) => {
|
|
133
|
-
dragStateRef.current = next;
|
|
134
|
-
setDragStateInternal(next);
|
|
135
|
-
}, []);
|
|
136
|
-
const getDragState = useCallback(() => dragStateRef.current, []);
|
|
137
|
-
const trackPointer = useCallback((e) => {
|
|
138
|
-
pointerPosRef.current = {
|
|
139
|
-
x: e.clientX,
|
|
140
|
-
y: e.clientY
|
|
141
|
-
};
|
|
142
|
-
}, []);
|
|
143
|
-
useEffect(() => () => window.removeEventListener("pointermove", trackPointer, true), [trackPointer]);
|
|
144
|
-
const registerBoard = useCallback((entry) => {
|
|
145
|
-
boardsRef.current.set(entry.id, entry);
|
|
146
|
-
return () => {
|
|
147
|
-
if (boardsRef.current.get(entry.id) === entry) boardsRef.current.delete(entry.id);
|
|
148
|
-
};
|
|
149
|
-
}, []);
|
|
150
|
-
const getBoardRect = useCallback((entry_0) => {
|
|
151
|
-
const frozen = frozenRectsRef.current.get(entry_0.id);
|
|
152
|
-
if (frozen && frozen.width > 0 && frozen.height > 0) return frozen;
|
|
153
|
-
const live = entry_0.getContentRect();
|
|
154
|
-
if (live && live.width > 0 && live.height > 0) {
|
|
155
|
-
frozenRectsRef.current.set(entry_0.id, live);
|
|
156
|
-
return live;
|
|
157
|
-
}
|
|
158
|
-
return frozen ?? live;
|
|
159
|
-
}, []);
|
|
160
|
-
/** True when board `outer` DOM-contains board `inner` (outer is an ancestor). */
|
|
161
|
-
const isAncestorBoard = useCallback((outer, inner) => {
|
|
162
|
-
const outerNode = outer.getContentNode();
|
|
163
|
-
const innerNode = inner.getContentNode();
|
|
164
|
-
return !!outerNode && !!innerNode && outerNode.contains(innerNode);
|
|
165
|
-
}, []);
|
|
166
|
-
/**
|
|
167
|
-
* Viewport rect of the widget host a nested board lives in, or null for a
|
|
168
|
-
* top-level board. Lets a drag stay anchored to a nested board while the anchor
|
|
169
|
-
* is still within its container widget (e.g. over a Tabs header sitting above
|
|
170
|
-
* the board), so an ancestor board does not reflow prematurely.
|
|
171
|
-
*/
|
|
172
|
-
const getBoardContainerRect = useCallback((entry_1) => {
|
|
173
|
-
return (entry_1.getContentNode()?.parentElement?.closest("[data-board-widget-host]"))?.getBoundingClientRect() ?? null;
|
|
174
|
-
}, []);
|
|
175
|
-
/** Whether a point falls within a rect (inclusive of edges). */
|
|
176
|
-
const pointInRect = useCallback((point, rect) => point.x >= rect.left && point.x <= rect.right && point.y >= rect.top && point.y <= rect.bottom, []);
|
|
177
|
-
/** Find the most-nested droppable board whose content rect contains a point. */
|
|
178
|
-
const hitTest = useCallback((point_0) => {
|
|
179
|
-
let best = null;
|
|
180
|
-
let bestArea = Infinity;
|
|
181
|
-
const overlay = overlayRef.current;
|
|
182
|
-
boardsRef.current.forEach((entry_2) => {
|
|
183
|
-
if (!entry_2.isDroppable()) return;
|
|
184
|
-
if (nestedInDraggedRef.current.has(entry_2.id)) return;
|
|
185
|
-
if (overlay && overlay.contains(entry_2.getContentNode())) return;
|
|
186
|
-
const liveRect = entry_2.getContentRect();
|
|
187
|
-
if (!liveRect || liveRect.width === 0 || liveRect.height === 0) return;
|
|
188
|
-
const rect_0 = getBoardRect(entry_2);
|
|
189
|
-
if (!rect_0) return;
|
|
190
|
-
if (point_0.x >= rect_0.left && point_0.x <= rect_0.right && point_0.y >= rect_0.top && point_0.y <= rect_0.bottom) {
|
|
191
|
-
const area = rect_0.width * rect_0.height;
|
|
192
|
-
if (area < bestArea) {
|
|
193
|
-
bestArea = area;
|
|
194
|
-
best = entry_2;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
return best;
|
|
199
|
-
}, [getBoardRect]);
|
|
200
|
-
const onDragStart = useEvent((boardId, itemId, rect_1, pointerType, widgetNode) => {
|
|
201
|
-
const entry_3 = boardsRef.current.get(boardId);
|
|
202
|
-
const layoutAtStart = entry_3?.getLayout() ?? [];
|
|
203
|
-
const item = entry_3 ? getLayoutItem(layoutAtStart, itemId) : void 0;
|
|
204
|
-
if (!entry_3 || !item) return;
|
|
205
|
-
const selected = entry_3.getSelectedKeys();
|
|
206
|
-
const memberIds = selected && selected.has(itemId) ? layoutAtStart.filter((l) => l.i !== itemId && selected.has(l.i) && (!l.static || l.isDraggable === true)).map((l_0) => l_0.i) : [];
|
|
207
|
-
const itemIds = [itemId, ...memberIds];
|
|
208
|
-
const memberNodes = widgetNode ? [widgetNode] : [];
|
|
209
|
-
const memberRects = /* @__PURE__ */ new Map();
|
|
210
|
-
if (memberIds.length > 0) {
|
|
211
|
-
const contentNode = entry_3.getContentNode();
|
|
212
|
-
const idSet = new Set(itemIds);
|
|
213
|
-
contentNode?.querySelectorAll("[data-board-widget-id]").forEach((el) => {
|
|
214
|
-
const id = el.dataset.boardWidgetId;
|
|
215
|
-
if (!id || !idSet.has(id)) return;
|
|
216
|
-
if (id !== itemId) memberNodes.push(el);
|
|
217
|
-
const r = el.getBoundingClientRect();
|
|
218
|
-
memberRects.set(id, {
|
|
219
|
-
left: r.left,
|
|
220
|
-
top: r.top,
|
|
221
|
-
width: r.width,
|
|
222
|
-
height: r.height
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
const nested = /* @__PURE__ */ new Set();
|
|
227
|
-
if (memberNodes.length > 0) boardsRef.current.forEach((e_0) => {
|
|
228
|
-
const node = e_0.getContentNode();
|
|
229
|
-
if (node && memberNodes.some((host_0) => host_0.contains(node))) nested.add(e_0.id);
|
|
230
|
-
});
|
|
231
|
-
nestedInDraggedRef.current = nested;
|
|
232
|
-
const frozen_0 = /* @__PURE__ */ new Map();
|
|
233
|
-
boardsRef.current.forEach((e_1) => {
|
|
234
|
-
const r_0 = e_1.getContentRect();
|
|
235
|
-
if (r_0) frozen_0.set(e_1.id, r_0);
|
|
236
|
-
});
|
|
237
|
-
frozenRectsRef.current = frozen_0;
|
|
238
|
-
affectedRef.current = new Set([boardId]);
|
|
239
|
-
sourceSnapshotRef.current = cloneLayout(entry_3.getLayout());
|
|
240
|
-
previewRef.current = null;
|
|
241
|
-
lastLandingRef.current = {
|
|
242
|
-
x: item.x,
|
|
243
|
-
y: item.y
|
|
244
|
-
};
|
|
245
|
-
pointerPosRef.current = null;
|
|
246
|
-
if (pointerType !== "keyboard") window.addEventListener("pointermove", trackPointer, true);
|
|
247
|
-
const draggedItem = {
|
|
248
|
-
...item,
|
|
249
|
-
constraints: item.constraints ?? store.get(itemId)?.constraints
|
|
250
|
-
};
|
|
251
|
-
const items = itemIds.map((id_0) => id_0 === itemId ? draggedItem : getLayoutItem(layoutAtStart, id_0)).filter((it) => it !== void 0);
|
|
252
|
-
setDragState({
|
|
253
|
-
sourceBoardId: boardId,
|
|
254
|
-
currentBoardId: boardId,
|
|
255
|
-
itemId,
|
|
256
|
-
item: draggedItem,
|
|
257
|
-
itemIds,
|
|
258
|
-
items,
|
|
259
|
-
rect: rect_1,
|
|
260
|
-
startRect: rect_1,
|
|
261
|
-
memberRects,
|
|
262
|
-
pointerType,
|
|
263
|
-
nestedBoardIds: nested
|
|
264
|
-
});
|
|
265
|
-
entry_3.setPlaceholders(items.map((it_0) => ({ ...it_0 })));
|
|
266
|
-
});
|
|
267
|
-
/** Compute the constrained landing position of an item on a target board. */
|
|
268
|
-
const computeLanding = useCallback((target, item_0, rect_2) => {
|
|
269
|
-
const pp = target.getPositionParams();
|
|
270
|
-
const contentRect = getBoardRect(target);
|
|
271
|
-
const localLeft = rect_2.left - (contentRect?.left ?? 0);
|
|
272
|
-
const raw = calcXYRaw(pp, rect_2.top - (contentRect?.top ?? 0), localLeft);
|
|
273
|
-
return applyPositionConstraints(target.getConstraints(), item_0, raw.x, raw.y, {
|
|
274
|
-
cols: pp.cols,
|
|
275
|
-
maxRows: target.getMaxRows(),
|
|
276
|
-
containerWidth: pp.containerWidth,
|
|
277
|
-
containerHeight: target.getContainerHeight(),
|
|
278
|
-
rowHeight: pp.rowHeight,
|
|
279
|
-
margin: pp.margin,
|
|
280
|
-
layout: target.getLayout()
|
|
281
|
-
});
|
|
282
|
-
}, [getBoardRect]);
|
|
283
|
-
const moveWithinBoard = useCallback((entry_4, item_1, x, y) => {
|
|
284
|
-
const pp_0 = entry_4.getPositionParams();
|
|
285
|
-
const compactor = entry_4.getCompactor();
|
|
286
|
-
const layout = entry_4.getLayout();
|
|
287
|
-
const collisionMode = compactor.preventCollision ? entry_4.getCollisionMode() : "revert";
|
|
288
|
-
const startLayout = sourceSnapshotRef.current;
|
|
289
|
-
const base = collisionMode !== "revert" && getLayoutItem(startLayout, item_1.i) ? startLayout : layout;
|
|
290
|
-
const working = getLayoutItem(base, item_1.i) ? cloneLayout(base) : [...cloneLayout(base), {
|
|
291
|
-
...item_1,
|
|
292
|
-
x,
|
|
293
|
-
y
|
|
294
|
-
}];
|
|
295
|
-
const target_0 = getLayoutItem(working, item_1.i);
|
|
296
|
-
if (!target_0) return;
|
|
297
|
-
const moved = moveElement(working, target_0, x, y, true, compactor.preventCollision, compactor.type, pp_0.cols, compactor.allowOverlap, { resolveCollision: createCollisionResolver(collisionMode, {
|
|
298
|
-
cols: pp_0.cols,
|
|
299
|
-
maxRows: entry_4.getMaxRows(),
|
|
300
|
-
desired: {
|
|
301
|
-
w: target_0.w,
|
|
302
|
-
h: target_0.h
|
|
303
|
-
}
|
|
304
|
-
}) });
|
|
305
|
-
const compacted = [...compactor.compact(moved, pp_0.cols)];
|
|
306
|
-
if (!compactor.allowOverlap && hasNewOverlap(overlappingPairs(base), compacted)) return;
|
|
307
|
-
entry_4.applyLayout(compacted, false);
|
|
308
|
-
entry_4.setPlaceholders([getLayoutItem(compacted, item_1.i)].filter((it_1) => it_1 !== void 0));
|
|
309
|
-
}, []);
|
|
310
|
-
/**
|
|
311
|
-
* Move the whole selection rigidly to an absolute delta.
|
|
312
|
-
*
|
|
313
|
-
* Unlike the single-widget path, each frame is recomputed from the drag-start
|
|
314
|
-
* snapshot rather than from the previous frame. A rigid group at an absolute
|
|
315
|
-
* delta is a pure function of that delta, so dragging back retraces the
|
|
316
|
-
* arrangement exactly, pushed neighbours never accumulate, and there is no
|
|
317
|
-
* hysteresis. The single path's frame-to-frame continuity exists to stop
|
|
318
|
-
* `moveElement` sinking a no-op placement to the bottom of a column;
|
|
319
|
-
* `moveElements` places the group explicitly, so that does not apply here.
|
|
320
|
-
*/
|
|
321
|
-
const moveGroupWithinBoard = useCallback((entry_5, ds, dx, dy) => {
|
|
322
|
-
const pp_1 = entry_5.getPositionParams();
|
|
323
|
-
const result = moveElements(sourceSnapshotRef.current, new Set(ds.itemIds), dx, dy, {
|
|
324
|
-
compactor: entry_5.getCompactor(),
|
|
325
|
-
cols: pp_1.cols,
|
|
326
|
-
maxRows: entry_5.getMaxRows()
|
|
327
|
-
});
|
|
328
|
-
if (!result.moved) return;
|
|
329
|
-
entry_5.applyLayout(result.layout, false);
|
|
330
|
-
entry_5.setPlaceholders(ds.itemIds.map((id_1) => getLayoutItem(result.layout, id_1)).filter((it_2) => it_2 !== void 0));
|
|
331
|
-
}, []);
|
|
332
|
-
/**
|
|
333
|
-
* Move a widget by one logical keyboard step. Unlike pointer movement, this
|
|
334
|
-
* starts from the live grid coordinates rather than DOM geometry and scans
|
|
335
|
-
* farther in the requested direction when the adjacent slot cannot produce a
|
|
336
|
-
* valid move.
|
|
337
|
-
*/
|
|
338
|
-
const moveWithKeyboard = useCallback((entry_6, item_2, deltaX, deltaY) => {
|
|
339
|
-
const pp_2 = entry_6.getPositionParams();
|
|
340
|
-
const compactor_0 = entry_6.getCompactor();
|
|
341
|
-
const layout_0 = entry_6.getLayout();
|
|
342
|
-
const live_1 = getLayoutItem(layout_0, item_2.i);
|
|
343
|
-
if (!live_1) return;
|
|
344
|
-
const directionX = Math.sign(deltaX);
|
|
345
|
-
const directionY = Math.sign(deltaY);
|
|
346
|
-
if (directionX === 0 && directionY === 0) return;
|
|
347
|
-
const maxRows = entry_6.getMaxRows();
|
|
348
|
-
const resolveCollision = compactor_0.preventCollision ? createCollisionResolver(entry_6.getCollisionMode(), {
|
|
349
|
-
cols: pp_2.cols,
|
|
350
|
-
maxRows,
|
|
351
|
-
desired: {
|
|
352
|
-
w: live_1.w,
|
|
353
|
-
h: live_1.h
|
|
354
|
-
}
|
|
355
|
-
}) : void 0;
|
|
356
|
-
const attempts = directionX < 0 ? live_1.x : directionX > 0 ? Math.max(0, pp_2.cols - live_1.w - live_1.x) : directionY < 0 ? live_1.y : Number.isFinite(maxRows) ? Math.max(0, maxRows - live_1.h - live_1.y) : Math.max(1, bottom(layout_0) - live_1.y);
|
|
357
|
-
const seen = /* @__PURE__ */ new Set();
|
|
358
|
-
const beforePairs = overlappingPairs(layout_0);
|
|
359
|
-
for (let distance = 1; distance <= attempts; distance++) {
|
|
360
|
-
const rawX = live_1.x + directionX * distance;
|
|
361
|
-
const rawY = live_1.y + directionY * distance;
|
|
362
|
-
const candidate = applyPositionConstraints(entry_6.getConstraints(), item_2, rawX, rawY, {
|
|
363
|
-
cols: pp_2.cols,
|
|
364
|
-
maxRows,
|
|
365
|
-
containerWidth: pp_2.containerWidth,
|
|
366
|
-
containerHeight: entry_6.getContainerHeight(),
|
|
367
|
-
rowHeight: pp_2.rowHeight,
|
|
368
|
-
margin: pp_2.margin,
|
|
369
|
-
layout: layout_0
|
|
370
|
-
});
|
|
371
|
-
const candidateKey = `${candidate.x}:${candidate.y}`;
|
|
372
|
-
if (seen.has(candidateKey)) continue;
|
|
373
|
-
seen.add(candidateKey);
|
|
374
|
-
if (directionX !== 0 && (Math.sign(candidate.x - live_1.x) !== directionX || candidate.y !== live_1.y) || directionY !== 0 && (Math.sign(candidate.y - live_1.y) !== directionY || candidate.x !== live_1.x)) continue;
|
|
375
|
-
const working_0 = cloneLayout(layout_0);
|
|
376
|
-
const target_1 = getLayoutItem(working_0, item_2.i);
|
|
377
|
-
if (!target_1) return;
|
|
378
|
-
const moved_0 = moveElement(working_0, target_1, candidate.x, candidate.y, true, compactor_0.preventCollision, compactor_0.type, pp_2.cols, compactor_0.allowOverlap, { resolveCollision });
|
|
379
|
-
const compacted_0 = [...compactor_0.compact(moved_0, pp_2.cols)];
|
|
380
|
-
const landed = getLayoutItem(compacted_0, item_2.i);
|
|
381
|
-
if (!landed) continue;
|
|
382
|
-
const advanced = directionX !== 0 ? Math.sign(landed.x - live_1.x) === directionX && landed.y === live_1.y : Math.sign(landed.y - live_1.y) === directionY && landed.x === live_1.x;
|
|
383
|
-
const overlaps = !compactor_0.allowOverlap && hasNewOverlap(beforePairs, compacted_0);
|
|
384
|
-
if (!advanced || overlaps || resizesAnything(layout_0, compacted_0)) continue;
|
|
385
|
-
entry_6.applyLayout(compacted_0, false);
|
|
386
|
-
entry_6.setPlaceholders([landed]);
|
|
387
|
-
lastLandingRef.current = {
|
|
388
|
-
x: landed.x,
|
|
389
|
-
y: landed.y
|
|
390
|
-
};
|
|
391
|
-
return;
|
|
392
|
-
}
|
|
393
|
-
}, []);
|
|
394
|
-
/**
|
|
395
|
-
* Keyboard equivalent of `moveGroupWithinBoard`: scan outward for the nearest
|
|
396
|
-
* whole-group delta that resolves cleanly.
|
|
397
|
-
*
|
|
398
|
-
* Constraints are resolved through the **grabbed** widget only, and the delta
|
|
399
|
-
* it yields is applied to the rest. `applyPositionConstraints` returns an
|
|
400
|
-
* absolute position, so running it per member would shear the group apart
|
|
401
|
-
* under `snapToGrid` or any app constraint — and the grabbed widget is the one
|
|
402
|
-
* the user is aiming with.
|
|
403
|
-
*
|
|
404
|
-
* Unlike the pointer path this steps from the live layout, not the drag-start
|
|
405
|
-
* snapshot, because keyboard moves accumulate one cell at a time.
|
|
406
|
-
*/
|
|
407
|
-
const moveGroupWithKeyboard = useCallback((entry_7, ds_0, deltaX_0, deltaY_0) => {
|
|
408
|
-
const pp_3 = entry_7.getPositionParams();
|
|
409
|
-
const compactor_1 = entry_7.getCompactor();
|
|
410
|
-
const layout_1 = entry_7.getLayout();
|
|
411
|
-
const live_2 = getLayoutItem(layout_1, ds_0.itemId);
|
|
412
|
-
if (!live_2) return;
|
|
413
|
-
const directionX_0 = Math.sign(deltaX_0);
|
|
414
|
-
const directionY_0 = Math.sign(deltaY_0);
|
|
415
|
-
if (directionX_0 === 0 && directionY_0 === 0) return;
|
|
416
|
-
const maxRows_0 = entry_7.getMaxRows();
|
|
417
|
-
const ids = new Set(ds_0.itemIds);
|
|
418
|
-
const members = layout_1.filter((l_1) => ids.has(l_1.i));
|
|
419
|
-
if (members.length === 0) return;
|
|
420
|
-
const attempts_0 = directionX_0 < 0 ? Math.min(...members.map((l_2) => l_2.x)) : directionX_0 > 0 ? Math.min(...members.map((l_3) => pp_3.cols - l_3.w - l_3.x)) : directionY_0 < 0 ? Math.min(...members.map((l_4) => l_4.y)) : Number.isFinite(maxRows_0) ? Math.min(...members.map((l_5) => maxRows_0 - l_5.h - l_5.y)) : Math.max(1, bottom(layout_1) - live_2.y);
|
|
421
|
-
const seen_0 = /* @__PURE__ */ new Set();
|
|
422
|
-
const beforePairs_0 = overlappingPairs(layout_1);
|
|
423
|
-
for (let distance_0 = 1; distance_0 <= Math.max(0, attempts_0); distance_0++) {
|
|
424
|
-
const candidate_0 = applyPositionConstraints(entry_7.getConstraints(), ds_0.item, live_2.x + directionX_0 * distance_0, live_2.y + directionY_0 * distance_0, {
|
|
425
|
-
cols: pp_3.cols,
|
|
426
|
-
maxRows: maxRows_0,
|
|
427
|
-
containerWidth: pp_3.containerWidth,
|
|
428
|
-
containerHeight: entry_7.getContainerHeight(),
|
|
429
|
-
rowHeight: pp_3.rowHeight,
|
|
430
|
-
margin: pp_3.margin,
|
|
431
|
-
layout: layout_1
|
|
432
|
-
});
|
|
433
|
-
const candidateKey_0 = `${candidate_0.x}:${candidate_0.y}`;
|
|
434
|
-
if (seen_0.has(candidateKey_0)) continue;
|
|
435
|
-
seen_0.add(candidateKey_0);
|
|
436
|
-
if (directionX_0 !== 0 && (Math.sign(candidate_0.x - live_2.x) !== directionX_0 || candidate_0.y !== live_2.y) || directionY_0 !== 0 && (Math.sign(candidate_0.y - live_2.y) !== directionY_0 || candidate_0.x !== live_2.x)) continue;
|
|
437
|
-
const result_0 = moveElements(layout_1, ids, candidate_0.x - live_2.x, candidate_0.y - live_2.y, {
|
|
438
|
-
compactor: compactor_1,
|
|
439
|
-
cols: pp_3.cols,
|
|
440
|
-
maxRows: maxRows_0
|
|
441
|
-
});
|
|
442
|
-
if (!result_0.moved) continue;
|
|
443
|
-
const landed_0 = getLayoutItem(result_0.layout, ds_0.itemId);
|
|
444
|
-
if (!landed_0) continue;
|
|
445
|
-
if (!(directionX_0 !== 0 ? Math.sign(landed_0.x - live_2.x) === directionX_0 && landed_0.y === live_2.y : Math.sign(landed_0.y - live_2.y) === directionY_0 && landed_0.x === live_2.x) || !compactor_1.allowOverlap && hasNewOverlap(beforePairs_0, result_0.layout)) continue;
|
|
446
|
-
entry_7.applyLayout(result_0.layout, false);
|
|
447
|
-
entry_7.setPlaceholders(ds_0.itemIds.map((id_2) => getLayoutItem(result_0.layout, id_2)).filter((it_3) => it_3 !== void 0));
|
|
448
|
-
lastLandingRef.current = {
|
|
449
|
-
x: landed_0.x,
|
|
450
|
-
y: landed_0.y
|
|
451
|
-
};
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
}, []);
|
|
455
|
-
/**
|
|
456
|
-
* Live cross-board reflow preview. Pushes the target board's *other* widgets
|
|
457
|
-
* aside to make room for the incoming item, without ever adding the dragged
|
|
458
|
-
* item's host to the target (it stays visualized as a placeholder + overlay
|
|
459
|
-
* clone, and its gesture host remains mounted in the source board).
|
|
460
|
-
*
|
|
461
|
-
* Continuity: the working layout (including the incoming item) is carried
|
|
462
|
-
* across frames via `previewRef`, so a small pointer movement moves the item
|
|
463
|
-
* one step and reflows the neighbours incrementally - identical to an in-board
|
|
464
|
-
* drag. Recomputing from the clean snapshot every frame instead lets
|
|
465
|
-
* `moveElement`/compaction sink the item to the bottom of an occupied column
|
|
466
|
-
* (the "pushed too far below" bug). On (re-)entry the working layout is seeded
|
|
467
|
-
* from a *clone* of the snapshot so the stored snapshot is never mutated.
|
|
468
|
-
*/
|
|
469
|
-
const previewOnTarget = useCallback((target_2, item_3, x_0, y_0) => {
|
|
470
|
-
const pp_4 = target_2.getPositionParams();
|
|
471
|
-
const compactor_2 = target_2.getCompactor();
|
|
472
|
-
const carried = previewRef.current?.boardId === target_2.id ? previewRef.current.working : null;
|
|
473
|
-
const base_0 = cloneLayout(carried ?? targetSnapshotsRef.current.get(target_2.id) ?? target_2.getLayout()).filter((l_6) => l_6.i !== item_3.i);
|
|
474
|
-
const prevItem = carried ? getLayoutItem(carried, item_3.i) : void 0;
|
|
475
|
-
const dragged = prevItem ? prevItem.x === x_0 && prevItem.y === y_0 ? { ...prevItem } : {
|
|
476
|
-
...prevItem,
|
|
477
|
-
w: item_3.w,
|
|
478
|
-
h: item_3.h
|
|
479
|
-
} : compactor_2.type === "horizontal" ? {
|
|
480
|
-
...item_3,
|
|
481
|
-
x: Math.max(0, x_0) - 1,
|
|
482
|
-
y: y_0
|
|
483
|
-
} : {
|
|
484
|
-
...item_3,
|
|
485
|
-
x: x_0,
|
|
486
|
-
y: Math.max(0, y_0) - 1
|
|
487
|
-
};
|
|
488
|
-
const working_1 = [...base_0, dragged];
|
|
489
|
-
const origin = {
|
|
490
|
-
x: dragged.x,
|
|
491
|
-
y: dragged.y
|
|
492
|
-
};
|
|
493
|
-
const moved_1 = moveElement(working_1, dragged, x_0, y_0, true, compactor_2.preventCollision, compactor_2.type, pp_4.cols, compactor_2.allowOverlap, { resolveCollision: compactor_2.preventCollision ? createCollisionResolver(target_2.getCollisionMode(), {
|
|
494
|
-
cols: pp_4.cols,
|
|
495
|
-
maxRows: target_2.getMaxRows(),
|
|
496
|
-
desired: {
|
|
497
|
-
w: item_3.w,
|
|
498
|
-
h: item_3.h
|
|
499
|
-
},
|
|
500
|
-
allowExchange: false
|
|
501
|
-
}) : void 0 });
|
|
502
|
-
const compacted_1 = [...compactor_2.compact(prevItem ? moved_1 : landIncoming(moved_1, base_0, item_3.i, origin, {
|
|
503
|
-
x: x_0,
|
|
504
|
-
y: y_0
|
|
505
|
-
}, pp_4.cols, target_2.getMaxRows()), pp_4.cols)];
|
|
506
|
-
const landed_1 = getLayoutItem(compacted_1, item_3.i);
|
|
507
|
-
if (!compactor_2.allowOverlap && hasNewOverlap(overlappingPairs(base_0), compacted_1)) return;
|
|
508
|
-
previewRef.current = {
|
|
509
|
-
boardId: target_2.id,
|
|
510
|
-
working: compacted_1
|
|
511
|
-
};
|
|
512
|
-
const previewItem = landed_1 ?? {
|
|
513
|
-
...item_3,
|
|
514
|
-
x: x_0,
|
|
515
|
-
y: y_0
|
|
516
|
-
};
|
|
517
|
-
target_2.applyLayout(compacted_1.filter((l_7) => l_7.i !== item_3.i), false);
|
|
518
|
-
target_2.setPlaceholders([{ ...previewItem }]);
|
|
519
|
-
}, []);
|
|
520
|
-
const onDragMove = useEvent((deltaX_1, deltaY_1, pointerType_0) => {
|
|
521
|
-
const ds_1 = dragStateRef.current;
|
|
522
|
-
if (!ds_1) return;
|
|
523
|
-
const isGroup = ds_1.itemIds.length > 1;
|
|
524
|
-
if (pointerType_0 === "keyboard") {
|
|
525
|
-
const source = boardsRef.current.get(ds_1.sourceBoardId);
|
|
526
|
-
if (!source) return;
|
|
527
|
-
if (isGroup) moveGroupWithKeyboard(source, ds_1, deltaX_1, deltaY_1);
|
|
528
|
-
else moveWithKeyboard(source, ds_1.item, deltaX_1, deltaY_1);
|
|
529
|
-
return;
|
|
530
|
-
}
|
|
531
|
-
const newRect = {
|
|
532
|
-
...ds_1.rect,
|
|
533
|
-
left: ds_1.rect.left + deltaX_1,
|
|
534
|
-
top: ds_1.rect.top + deltaY_1
|
|
535
|
-
};
|
|
536
|
-
const source_0 = boardsRef.current.get(ds_1.sourceBoardId);
|
|
537
|
-
const anchor = rectCenter(newRect);
|
|
538
|
-
let target_3 = isGroup ? source_0 : hitTest(anchor) ?? source_0 ?? null;
|
|
539
|
-
if (target_3 && source_0 && target_3.id !== source_0.id && isAncestorBoard(target_3, source_0)) {
|
|
540
|
-
const containerRect = getBoardContainerRect(source_0);
|
|
541
|
-
const gatePoint = pointerPosRef.current ?? anchor;
|
|
542
|
-
if (containerRect && pointInRect(gatePoint, containerRect)) target_3 = source_0;
|
|
543
|
-
}
|
|
544
|
-
if (!target_3) {
|
|
545
|
-
setDragState({
|
|
546
|
-
...ds_1,
|
|
547
|
-
rect: newRect
|
|
548
|
-
});
|
|
549
|
-
return;
|
|
550
|
-
}
|
|
551
|
-
const { x: x_1, y: y_1 } = computeLanding(target_3, ds_1.item, newRect);
|
|
552
|
-
lastLandingRef.current = {
|
|
553
|
-
x: x_1,
|
|
554
|
-
y: y_1
|
|
555
|
-
};
|
|
556
|
-
if (target_3.id === ds_1.sourceBoardId) {
|
|
557
|
-
if (ds_1.currentBoardId !== ds_1.sourceBoardId) {
|
|
558
|
-
const prev = boardsRef.current.get(ds_1.currentBoardId);
|
|
559
|
-
const snap = targetSnapshotsRef.current.get(ds_1.currentBoardId);
|
|
560
|
-
if (snap) prev?.applyLayout(cloneLayout(snap), false);
|
|
561
|
-
prev?.setPlaceholders([]);
|
|
562
|
-
previewRef.current = null;
|
|
563
|
-
}
|
|
564
|
-
if (isGroup) moveGroupWithinBoard(target_3, ds_1, x_1 - ds_1.item.x, y_1 - ds_1.item.y);
|
|
565
|
-
else moveWithinBoard(target_3, ds_1.item, x_1, y_1);
|
|
566
|
-
setDragState({
|
|
567
|
-
...ds_1,
|
|
568
|
-
currentBoardId: ds_1.sourceBoardId,
|
|
569
|
-
rect: newRect
|
|
570
|
-
});
|
|
571
|
-
return;
|
|
572
|
-
}
|
|
573
|
-
if (ds_1.currentBoardId !== target_3.id) {
|
|
574
|
-
const prev_0 = boardsRef.current.get(ds_1.currentBoardId);
|
|
575
|
-
if (ds_1.currentBoardId === ds_1.sourceBoardId) prev_0?.applyLayout(cloneLayout(sourceSnapshotRef.current), false);
|
|
576
|
-
else {
|
|
577
|
-
const snap_0 = targetSnapshotsRef.current.get(ds_1.currentBoardId);
|
|
578
|
-
if (snap_0) prev_0?.applyLayout(cloneLayout(snap_0), false);
|
|
579
|
-
}
|
|
580
|
-
prev_0?.setPlaceholders([]);
|
|
581
|
-
previewRef.current = null;
|
|
582
|
-
if (!targetSnapshotsRef.current.has(target_3.id)) targetSnapshotsRef.current.set(target_3.id, cloneLayout(target_3.getLayout()));
|
|
583
|
-
}
|
|
584
|
-
previewOnTarget(target_3, ds_1.item, x_1, y_1);
|
|
585
|
-
affectedRef.current.add(target_3.id);
|
|
586
|
-
setDragState({
|
|
587
|
-
...ds_1,
|
|
588
|
-
currentBoardId: target_3.id,
|
|
589
|
-
rect: newRect
|
|
590
|
-
});
|
|
591
|
-
});
|
|
592
|
-
const onDragEnd = useEvent(() => {
|
|
593
|
-
window.removeEventListener("pointermove", trackPointer, true);
|
|
594
|
-
pointerPosRef.current = null;
|
|
595
|
-
const ds_2 = dragStateRef.current;
|
|
596
|
-
if (!ds_2) return;
|
|
597
|
-
const source_1 = boardsRef.current.get(ds_2.sourceBoardId);
|
|
598
|
-
const target_4 = boardsRef.current.get(ds_2.currentBoardId);
|
|
599
|
-
if (!target_4 || target_4.id === ds_2.sourceBoardId) {
|
|
600
|
-
if (source_1) {
|
|
601
|
-
const sp = source_1.getPositionParams();
|
|
602
|
-
const sc = source_1.getCompactor();
|
|
603
|
-
source_1.applyLayout([...sc.compact(source_1.getLayout(), sp.cols)], true, "drag");
|
|
604
|
-
}
|
|
605
|
-
} else {
|
|
606
|
-
const landing = lastLandingRef.current ?? {
|
|
607
|
-
x: ds_2.item.x,
|
|
608
|
-
y: ds_2.item.y
|
|
609
|
-
};
|
|
610
|
-
const tp = target_4.getPositionParams();
|
|
611
|
-
const tc = target_4.getCompactor();
|
|
612
|
-
const carried_0 = previewRef.current?.boardId === target_4.id && getLayoutItem(previewRef.current.working, ds_2.itemId) ? previewRef.current.working : null;
|
|
613
|
-
if (source_1) {
|
|
614
|
-
const sp_0 = source_1.getPositionParams();
|
|
615
|
-
const sc_0 = source_1.getCompactor();
|
|
616
|
-
const remaining = source_1.getLayout().filter((l_8) => l_8.i !== ds_2.itemId);
|
|
617
|
-
source_1.applyLayout([...sc_0.compact(remaining, sp_0.cols)], true, "transfer");
|
|
618
|
-
}
|
|
619
|
-
let finalLayout;
|
|
620
|
-
if (carried_0) finalLayout = [...tc.compact(cloneLayout(carried_0), tp.cols)];
|
|
621
|
-
else {
|
|
622
|
-
const newItem = tc.type === "horizontal" ? {
|
|
623
|
-
...ds_2.item,
|
|
624
|
-
x: Math.max(0, landing.x) - 1,
|
|
625
|
-
y: landing.y
|
|
626
|
-
} : {
|
|
627
|
-
...ds_2.item,
|
|
628
|
-
x: landing.x,
|
|
629
|
-
y: Math.max(0, landing.y) - 1
|
|
630
|
-
};
|
|
631
|
-
const base_1 = [...cloneLayout((targetSnapshotsRef.current.get(target_4.id) ?? target_4.getLayout()).filter((l_9) => l_9.i !== ds_2.itemId)), newItem];
|
|
632
|
-
const seed = {
|
|
633
|
-
x: newItem.x,
|
|
634
|
-
y: newItem.y
|
|
635
|
-
};
|
|
636
|
-
const moved_2 = moveElement(base_1, newItem, landing.x, landing.y, true, tc.preventCollision, tc.type, tp.cols, tc.allowOverlap, { resolveCollision: createCollisionResolver(target_4.getCollisionMode(), {
|
|
637
|
-
cols: tp.cols,
|
|
638
|
-
maxRows: tp.maxRows,
|
|
639
|
-
desired: {
|
|
640
|
-
w: ds_2.item.w,
|
|
641
|
-
h: ds_2.item.h
|
|
642
|
-
},
|
|
643
|
-
allowExchange: false
|
|
644
|
-
}) });
|
|
645
|
-
finalLayout = [...tc.compact(landIncoming(moved_2, base_1.filter((l_10) => l_10.i !== ds_2.itemId), ds_2.itemId, seed, landing, tp.cols, tp.maxRows), tp.cols)];
|
|
646
|
-
}
|
|
647
|
-
const targetOthers = cloneLayout((targetSnapshotsRef.current.get(target_4.id) ?? target_4.getLayout()).filter((l_11) => l_11.i !== ds_2.itemId));
|
|
648
|
-
if (!tc.allowOverlap && hasNewOverlap(overlappingPairs(targetOthers), finalLayout)) finalLayout = [...targetOthers, placeInFreeSlot(targetOthers, {
|
|
649
|
-
...ds_2.item,
|
|
650
|
-
x: landing.x,
|
|
651
|
-
y: landing.y
|
|
652
|
-
}, tp.cols, tp.maxRows)];
|
|
653
|
-
target_4.applyLayout(finalLayout, true, "transfer");
|
|
654
|
-
onTransferRef.current?.({
|
|
655
|
-
widgetId: ds_2.itemId,
|
|
656
|
-
fromBoardId: ds_2.sourceBoardId,
|
|
657
|
-
toBoardId: target_4.id,
|
|
658
|
-
item: getLayoutItem(finalLayout, ds_2.itemId) ?? {
|
|
659
|
-
...ds_2.item,
|
|
660
|
-
x: landing.x,
|
|
661
|
-
y: landing.y
|
|
662
|
-
}
|
|
663
|
-
});
|
|
664
|
-
}
|
|
665
|
-
const ids_0 = new Set(affectedRef.current);
|
|
666
|
-
ids_0.add(ds_2.sourceBoardId);
|
|
667
|
-
ids_0.add(ds_2.currentBoardId);
|
|
668
|
-
ids_0.forEach((id_3) => boardsRef.current.get(id_3)?.setPlaceholders([]));
|
|
669
|
-
affectedRef.current.clear();
|
|
670
|
-
sourceSnapshotRef.current = [];
|
|
671
|
-
targetSnapshotsRef.current.clear();
|
|
672
|
-
frozenRectsRef.current.clear();
|
|
673
|
-
nestedInDraggedRef.current = /* @__PURE__ */ new Set();
|
|
674
|
-
previewRef.current = null;
|
|
675
|
-
lastLandingRef.current = null;
|
|
676
|
-
setDragState(null);
|
|
677
|
-
});
|
|
678
|
-
return useMemo(() => ({
|
|
679
|
-
store,
|
|
680
|
-
overlayRef,
|
|
681
|
-
registerBoard,
|
|
682
|
-
onDragStart,
|
|
683
|
-
onDragMove,
|
|
684
|
-
onDragEnd,
|
|
685
|
-
dragState,
|
|
686
|
-
getDragState
|
|
687
|
-
}), [
|
|
688
|
-
store,
|
|
689
|
-
registerBoard,
|
|
690
|
-
onDragStart,
|
|
691
|
-
onDragMove,
|
|
692
|
-
onDragEnd,
|
|
693
|
-
dragState,
|
|
694
|
-
getDragState
|
|
695
|
-
]);
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
//#endregion
|
|
699
|
-
export { useBoardRegistry };
|
|
700
|
-
//# sourceMappingURL=use-board-registry.js.map
|