@alepha/ui 0.38.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dist/account/AccountDeleteDialog.d.ts +4 -4
- package/dist/account/AccountDeleteDialog.js +1 -1
- package/dist/account/AccountDeleteDialog.js.map +1 -1
- package/dist/account/AccountDialog.js.map +1 -1
- package/dist/account/AccountMfaDialog.d.ts +18 -0
- package/dist/account/AccountMfaDialog.d.ts.map +1 -1
- package/dist/account/AccountMfaDialog.js +99 -17
- package/dist/account/AccountMfaDialog.js.map +1 -1
- package/dist/account/AccountPasskeyProofDialog.d.ts +7 -4
- package/dist/account/AccountPasskeyProofDialog.d.ts.map +1 -1
- package/dist/account/AccountPasskeyProofDialog.js +4 -2
- package/dist/account/AccountPasskeyProofDialog.js.map +1 -1
- package/dist/account/AccountPasswordDialog.d.ts +19 -5
- package/dist/account/AccountPasswordDialog.d.ts.map +1 -1
- package/dist/account/AccountPasswordDialog.js +41 -24
- package/dist/account/AccountPasswordDialog.js.map +1 -1
- package/dist/account/AccountProfile.d.ts +1 -1
- package/dist/account/AccountProfile.js +1 -1
- package/dist/account/AccountProfile.js.map +1 -1
- package/dist/account/AccountProfileView.d.ts +1 -1
- package/dist/account/AccountProfileView.d.ts.map +1 -1
- package/dist/account/AccountProfileView.js +76 -11
- package/dist/account/AccountProfileView.js.map +1 -1
- package/dist/account/AccountRecoveryCodes.js.map +1 -1
- package/dist/account/AccountSecurityView.d.ts +1 -1
- package/dist/account/AccountSecurityView.d.ts.map +1 -1
- package/dist/account/AccountSecurityView.js +37 -2
- package/dist/account/AccountSecurityView.js.map +1 -1
- package/dist/account/AccountSessionsView.d.ts +2 -1
- package/dist/account/AccountSessionsView.d.ts.map +1 -1
- package/dist/account/AccountSessionsView.js +17 -8
- package/dist/account/AccountSessionsView.js.map +1 -1
- package/dist/account/ApiKeyCreateDialog.js.map +1 -1
- package/dist/admin/$pageAdmin.d.ts +1 -1
- package/dist/admin/$pageAdmin.js +1 -1
- package/dist/admin/$pageAdmin.js.map +1 -1
- package/dist/admin/AdminAnalytics.d.ts.map +1 -1
- package/dist/admin/AdminAnalytics.js +8 -6
- package/dist/admin/AdminAnalytics.js.map +1 -1
- package/dist/admin/AdminAudits.d.ts.map +1 -1
- package/dist/admin/AdminAudits.js +10 -17
- package/dist/admin/AdminAudits.js.map +1 -1
- package/dist/admin/AdminDashboard.d.ts +1 -1
- package/dist/admin/AdminDashboard.js +1 -1
- package/dist/admin/AdminDashboard.js.map +1 -1
- package/dist/admin/AdminDashboardCard.d.ts +2 -2
- package/dist/admin/AdminFiles.js +1 -1
- package/dist/admin/AdminFiles.js.map +1 -1
- package/dist/admin/AdminJobDetail.d.ts.map +1 -1
- package/dist/admin/AdminJobDetail.js +5 -0
- package/dist/admin/AdminJobDetail.js.map +1 -1
- package/dist/admin/AdminJobExecutionSheet.d.ts.map +1 -1
- package/dist/admin/AdminJobExecutionSheet.js +7 -0
- package/dist/admin/AdminJobExecutionSheet.js.map +1 -1
- package/dist/admin/AdminJobsStatusBadge.d.ts +1 -1
- package/dist/admin/AdminJobsStatusBadge.js +1 -1
- package/dist/admin/AdminJobsStatusBadge.js.map +1 -1
- package/dist/admin/AdminKeys.d.ts.map +1 -1
- package/dist/admin/AdminKeys.js +7 -7
- package/dist/admin/AdminKeys.js.map +1 -1
- package/dist/admin/AdminLayout.d.ts +4 -4
- package/dist/admin/AdminLayout.js +4 -4
- package/dist/admin/AdminLayout.js.map +1 -1
- package/dist/admin/AdminNotifications.js +1 -1
- package/dist/admin/AdminNotifications.js.map +1 -1
- package/dist/admin/AdminNotificationsStatusBadge.d.ts +1 -1
- package/dist/admin/AdminNotificationsStatusBadge.js +1 -1
- package/dist/admin/AdminNotificationsStatusBadge.js.map +1 -1
- package/dist/admin/AdminParameters.d.ts +2 -2
- package/dist/admin/AdminParameters.d.ts.map +1 -1
- package/dist/admin/AdminParameters.js +26 -16
- package/dist/admin/AdminParameters.js.map +1 -1
- package/dist/admin/AdminParametersEditorForm.js +2 -2
- package/dist/admin/AdminParametersEditorForm.js.map +1 -1
- package/dist/admin/AdminParametersEditorPane.d.ts.map +1 -1
- package/dist/admin/AdminParametersEditorPane.js +3 -4
- package/dist/admin/AdminParametersEditorPane.js.map +1 -1
- package/dist/admin/AdminParametersHistoryPane.js +1 -1
- package/dist/admin/AdminParametersHistoryPane.js.map +1 -1
- package/dist/admin/AdminParametersTreeNodeView.d.ts +4 -0
- package/dist/admin/AdminParametersTreeNodeView.d.ts.map +1 -1
- package/dist/admin/AdminParametersTreeNodeView.js +5 -3
- package/dist/admin/AdminParametersTreeNodeView.js.map +1 -1
- package/dist/admin/AdminParametersTreePane.d.ts +4 -0
- package/dist/admin/AdminParametersTreePane.d.ts.map +1 -1
- package/dist/admin/AdminParametersTreePane.js +3 -2
- package/dist/admin/AdminParametersTreePane.js.map +1 -1
- package/dist/admin/AdminPayments.js +1 -1
- package/dist/admin/AdminPayments.js.map +1 -1
- package/dist/admin/AdminPaymentsStatusBadge.d.ts +1 -1
- package/dist/admin/AdminPaymentsStatusBadge.js +1 -1
- package/dist/admin/AdminPaymentsStatusBadge.js.map +1 -1
- package/dist/admin/AdminRouter.d.ts +15 -15
- package/dist/admin/AdminRouter.js +15 -15
- package/dist/admin/AdminRouter.js.map +1 -1
- package/dist/admin/AdminRouterOptions.d.ts +9 -9
- package/dist/admin/AdminRouterOptions.js +2 -2
- package/dist/admin/AdminRouterOptions.js.map +1 -1
- package/dist/admin/AdminSessions.d.ts.map +1 -1
- package/dist/admin/AdminSessions.js +9 -14
- package/dist/admin/AdminSessions.js.map +1 -1
- package/dist/admin/AdminUserAvatarControl.js.map +1 -1
- package/dist/admin/AdminUserCell.d.ts +6 -6
- package/dist/admin/AdminUserCell.d.ts.map +1 -1
- package/dist/admin/AdminUserCell.js +6 -5
- package/dist/admin/AdminUserCell.js.map +1 -1
- package/dist/admin/AdminUserDetail.d.ts +1 -1
- package/dist/admin/AdminUserDetail.d.ts.map +1 -1
- package/dist/admin/AdminUserDetail.js +7 -5
- package/dist/admin/AdminUserDetail.js.map +1 -1
- package/dist/admin/AdminUserDetailAuditsTab.js +1 -1
- package/dist/admin/AdminUserDetailAuditsTab.js.map +1 -1
- package/dist/admin/AdminUserDetailIdentityAside.d.ts +2 -2
- package/dist/admin/AdminUserDetailIdentityAside.js +3 -3
- package/dist/admin/AdminUserDetailIdentityAside.js.map +1 -1
- package/dist/admin/AdminUserDetailOverviewTab.d.ts +1 -1
- package/dist/admin/AdminUserDetailOverviewTab.js.map +1 -1
- package/dist/admin/AdminUserDetailPasswordDialog.js +1 -1
- package/dist/admin/AdminUserDetailPasswordDialog.js.map +1 -1
- package/dist/admin/AdminUserDetailSecurityTab.d.ts +1 -1
- package/dist/admin/AdminUserDetailSecurityTab.js.map +1 -1
- package/dist/admin/AdminUserDetailSessionsTab.js +2 -2
- package/dist/admin/AdminUserDetailSessionsTab.js.map +1 -1
- package/dist/admin/AdminUsers.d.ts.map +1 -1
- package/dist/admin/AdminUsers.js +6 -5
- package/dist/admin/AdminUsers.js.map +1 -1
- package/dist/admin/AdminUsersRolesPicker.d.ts +1 -1
- package/dist/admin/AdminUsersRolesPicker.js.map +1 -1
- package/dist/admin/AdminWebhookDeliveryDialog.d.ts.map +1 -1
- package/dist/admin/AdminWebhookDeliveryDialog.js +5 -8
- package/dist/admin/AdminWebhookDeliveryDialog.js.map +1 -1
- package/dist/admin/AdminWebhookDetail.d.ts.map +1 -1
- package/dist/admin/AdminWebhookDetail.js +15 -0
- package/dist/admin/AdminWebhookDetail.js.map +1 -1
- package/dist/admin/AdminWebhooksCreateDialog.d.ts.map +1 -1
- package/dist/admin/AdminWebhooksCreateDialog.js +1 -0
- package/dist/admin/AdminWebhooksCreateDialog.js.map +1 -1
- package/dist/admin/ParameterHistoryItem.js +3 -3
- package/dist/admin/ParameterHistoryItem.js.map +1 -1
- package/dist/admin/adminUserDetailProfilePolicy.d.ts +2 -2
- package/dist/admin/adminUserDetailProfilePolicy.js +2 -2
- package/dist/admin/adminUserDetailProfilePolicy.js.map +1 -1
- package/dist/admin/analytics/QueryPanel.js +1 -1
- package/dist/admin/analytics/QueryPanel.js.map +1 -1
- package/dist/admin/analytics/RequestDialog.d.ts.map +1 -1
- package/dist/admin/analytics/RequestDialog.js +2 -3
- package/dist/admin/analytics/RequestDialog.js.map +1 -1
- package/dist/admin/analytics/ResultsTable.js +1 -1
- package/dist/admin/analytics/ResultsTable.js.map +1 -1
- package/dist/admin/analytics/ToggleChip.d.ts +5 -3
- package/dist/admin/analytics/ToggleChip.d.ts.map +1 -1
- package/dist/admin/analytics/ToggleChip.js +2 -2
- package/dist/admin/analytics/ToggleChip.js.map +1 -1
- package/dist/admin/analytics/TotalsCards.js +1 -1
- package/dist/admin/analytics/TotalsCards.js.map +1 -1
- package/dist/admin/analytics/analyticsModel.d.ts.map +1 -1
- package/dist/admin/analytics/analyticsModel.js +9 -4
- package/dist/admin/analytics/analyticsModel.js.map +1 -1
- package/dist/admin/analytics/analyticsTypes.d.ts +1 -1
- package/dist/admin/analytics/chartModel.d.ts.map +1 -1
- package/dist/admin/analytics/chartModel.js +4 -3
- package/dist/admin/analytics/chartModel.js.map +1 -1
- package/dist/admin/analytics/useFilterValues.js.map +1 -1
- package/dist/admin/diffLines.d.ts +1 -1
- package/dist/admin/diffLines.js +1 -1
- package/dist/admin/diffLines.js.map +1 -1
- package/dist/admin/index.d.ts +1 -1
- package/dist/admin/useAdminDetailTrail.d.ts +13 -0
- package/dist/admin/useAdminDetailTrail.d.ts.map +1 -0
- package/dist/admin/useAdminDetailTrail.js +31 -0
- package/dist/admin/useAdminDetailTrail.js.map +1 -0
- package/dist/admin/useJobRetentionLabels.d.ts +1 -1
- package/dist/admin/useJobRetentionLabels.d.ts.map +1 -1
- package/dist/admin/useJobRetentionLabels.js +2 -1
- package/dist/admin/useJobRetentionLabels.js.map +1 -1
- package/dist/admin/useNotificationStatusLabels.d.ts +1 -1
- package/dist/admin/useNotificationStatusLabels.js +1 -1
- package/dist/admin/useNotificationStatusLabels.js.map +1 -1
- package/dist/ai/AiChat.d.ts +6 -3
- package/dist/ai/AiChat.d.ts.map +1 -1
- package/dist/ai/AiChat.js +34 -5
- package/dist/ai/AiChat.js.map +1 -1
- package/dist/ai/AiChatConfirmCard.d.ts.map +1 -1
- package/dist/ai/AiChatConfirmCard.js +5 -1
- package/dist/ai/AiChatConfirmCard.js.map +1 -1
- package/dist/ai/AiChatFloat.d.ts +14 -0
- package/dist/ai/AiChatFloat.d.ts.map +1 -0
- package/dist/ai/AiChatFloat.js +30 -0
- package/dist/ai/AiChatFloat.js.map +1 -0
- package/dist/ai/AiChatHistory.js +1 -1
- package/dist/ai/AiChatHistory.js.map +1 -1
- package/dist/ai/AiChatMessage.js +2 -2
- package/dist/ai/AiChatMessage.js.map +1 -1
- package/dist/ai/AiChatPanel.d.ts +19 -0
- package/dist/ai/AiChatPanel.d.ts.map +1 -1
- package/dist/ai/AiChatPanel.js +65 -19
- package/dist/ai/AiChatPanel.js.map +1 -1
- package/dist/ai/AiChatToolStepDetails.d.ts +14 -0
- package/dist/ai/AiChatToolStepDetails.d.ts.map +1 -0
- package/dist/ai/AiChatToolStepDetails.js +34 -0
- package/dist/ai/AiChatToolStepDetails.js.map +1 -0
- package/dist/ai/AiChatToolTrace.d.ts +50 -0
- package/dist/ai/AiChatToolTrace.d.ts.map +1 -0
- package/dist/ai/AiChatToolTrace.js +91 -0
- package/dist/ai/AiChatToolTrace.js.map +1 -0
- package/dist/ai/AiFormRegistry.js.map +1 -1
- package/dist/ai/index.d.ts +4 -2
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +3 -1
- package/dist/auth/AuthLogin.d.ts +1 -1
- package/dist/auth/AuthLogin.d.ts.map +1 -1
- package/dist/auth/AuthLogin.js +12 -3
- package/dist/auth/AuthLogin.js.map +1 -1
- package/dist/auth/AuthMfaStep.d.ts +5 -0
- package/dist/auth/AuthMfaStep.d.ts.map +1 -1
- package/dist/auth/AuthMfaStep.js +43 -5
- package/dist/auth/AuthMfaStep.js.map +1 -1
- package/dist/auth/AuthRegister.d.ts +1 -1
- package/dist/auth/AuthRegister.js.map +1 -1
- package/dist/auth/AuthRegisterFormPhase.js.map +1 -1
- package/dist/auth/AuthResetPassword.d.ts.map +1 -1
- package/dist/auth/AuthResetPassword.js +47 -13
- package/dist/auth/AuthResetPassword.js.map +1 -1
- package/dist/auth/AuthRouter.d.ts +10 -70
- package/dist/auth/AuthRouter.d.ts.map +1 -1
- package/dist/auth/AuthRouter.js +10 -18
- package/dist/auth/AuthRouter.js.map +1 -1
- package/dist/auth/AuthVerifyEmailStateful.js.map +1 -1
- package/dist/auth/TurnstileWidget.d.ts +2 -2
- package/dist/auth/TurnstileWidget.js +1 -1
- package/dist/auth/TurnstileWidget.js.map +1 -1
- package/dist/command/Command.d.ts +10 -0
- package/dist/command/Command.d.ts.map +1 -1
- package/dist/command/Command.js +3 -1
- package/dist/command/Command.js.map +1 -1
- package/dist/core/Avatar.d.ts.map +1 -1
- package/dist/core/Avatar.js +1 -1
- package/dist/core/Avatar.js.map +1 -1
- package/dist/core/Badge.d.ts +3 -2
- package/dist/core/Badge.d.ts.map +1 -1
- package/dist/core/Badge.js +65 -7
- package/dist/core/Badge.js.map +1 -1
- package/dist/core/Button.d.ts.map +1 -1
- package/dist/core/Button.js +17 -1
- package/dist/core/Button.js.map +1 -1
- package/dist/core/Card.d.ts +13 -0
- package/dist/core/Card.d.ts.map +1 -1
- package/dist/core/Card.js +4 -2
- package/dist/core/Card.js.map +1 -1
- package/dist/core/Collapsible.d.ts +1 -1
- package/dist/core/Collapsible.js +1 -1
- package/dist/core/Collapsible.js.map +1 -1
- package/dist/core/ContextMenu.js +1 -1
- package/dist/core/ContextMenu.js.map +1 -1
- package/dist/core/Dialog.d.ts.map +1 -1
- package/dist/core/Dialog.js +1 -1
- package/dist/core/Dialog.js.map +1 -1
- package/dist/core/DialogHosts.js.map +1 -1
- package/dist/core/Drawer.d.ts.map +1 -1
- package/dist/core/Drawer.js +2 -1
- package/dist/core/Drawer.js.map +1 -1
- package/dist/core/DropdownMenu.js +1 -1
- package/dist/core/DropdownMenu.js.map +1 -1
- package/dist/core/FileImage.d.ts +7 -7
- package/dist/core/FileImage.d.ts.map +1 -1
- package/dist/core/FileImage.js +7 -4
- package/dist/core/FileImage.js.map +1 -1
- package/dist/core/Menubar.js +1 -1
- package/dist/core/Menubar.js.map +1 -1
- package/dist/core/PageOutline.d.ts.map +1 -1
- package/dist/core/PageOutline.js +35 -6
- package/dist/core/PageOutline.js.map +1 -1
- package/dist/core/PaneResizer.d.ts +57 -0
- package/dist/core/PaneResizer.d.ts.map +1 -0
- package/dist/core/PaneResizer.js +84 -0
- package/dist/core/PaneResizer.js.map +1 -0
- package/dist/core/Segmented.d.ts +9 -2
- package/dist/core/Segmented.d.ts.map +1 -1
- package/dist/core/Segmented.js +5 -3
- package/dist/core/Segmented.js.map +1 -1
- package/dist/core/Sidebar.d.ts.map +1 -1
- package/dist/core/Sidebar.js +3 -1
- package/dist/core/Sidebar.js.map +1 -1
- package/dist/core/Slider.d.ts.map +1 -1
- package/dist/core/Slider.js +2 -1
- package/dist/core/Slider.js.map +1 -1
- package/dist/core/Table.js +1 -1
- package/dist/core/Table.js.map +1 -1
- package/dist/core/Tabs.d.ts.map +1 -1
- package/dist/core/Tabs.js +1 -0
- package/dist/core/Tabs.js.map +1 -1
- package/dist/core/Textarea.d.ts.map +1 -1
- package/dist/core/Textarea.js +7 -2
- package/dist/core/Textarea.js.map +1 -1
- package/dist/core/TimeAgo.d.ts +3 -4
- package/dist/core/TimeAgo.d.ts.map +1 -1
- package/dist/core/TimeAgo.js +3 -4
- package/dist/core/TimeAgo.js.map +1 -1
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -1
- package/dist/core/useDialog.d.ts +8 -1
- package/dist/core/useDialog.d.ts.map +1 -1
- package/dist/core/useDialog.js +36 -5
- package/dist/core/useDialog.js.map +1 -1
- package/dist/core/useToast.d.ts +17 -1
- package/dist/core/useToast.d.ts.map +1 -1
- package/dist/core/useToast.js +16 -0
- package/dist/core/useToast.js.map +1 -1
- package/dist/core/useUndoable.d.ts.map +1 -1
- package/dist/core/useUndoable.js +2 -1
- package/dist/core/useUndoable.js.map +1 -1
- package/dist/core/userInitials.d.ts +24 -3
- package/dist/core/userInitials.d.ts.map +1 -1
- package/dist/core/userInitials.js +21 -4
- package/dist/core/userInitials.js.map +1 -1
- package/dist/form/AutoForm.d.ts +10 -10
- package/dist/form/AutoForm.d.ts.map +1 -1
- package/dist/form/AutoForm.js +15 -3
- package/dist/form/AutoForm.js.map +1 -1
- package/dist/form/AutoFormBottomBar.js.map +1 -1
- package/dist/form/AutoFormErrorPopover.d.ts.map +1 -1
- package/dist/form/AutoFormErrorPopover.js +2 -2
- package/dist/form/AutoFormErrorPopover.js.map +1 -1
- package/dist/form/AutoFormGroupBlock.js.map +1 -1
- package/dist/form/AutoFormGroupGridField.js.map +1 -1
- package/dist/form/Control.d.ts +10 -10
- package/dist/form/Control.d.ts.map +1 -1
- package/dist/form/Control.js +7 -2
- package/dist/form/Control.js.map +1 -1
- package/dist/form/ControlArray.d.ts +1 -1
- package/dist/form/ControlArray.d.ts.map +1 -1
- package/dist/form/ControlArray.js +3 -0
- package/dist/form/ControlArray.js.map +1 -1
- package/dist/form/ControlDate.d.ts.map +1 -1
- package/dist/form/ControlDate.js +3 -0
- package/dist/form/ControlDate.js.map +1 -1
- package/dist/form/ControlDatePopover.d.ts.map +1 -1
- package/dist/form/ControlDatePopover.js +5 -2
- package/dist/form/ControlDatePopover.js.map +1 -1
- package/dist/form/ControlDateRange.d.ts +2 -2
- package/dist/form/ControlDateRange.d.ts.map +1 -1
- package/dist/form/ControlDateRange.js +7 -3
- package/dist/form/ControlDateRange.js.map +1 -1
- package/dist/form/ControlMonthPopover.d.ts +0 -4
- package/dist/form/ControlMonthPopover.d.ts.map +1 -1
- package/dist/form/ControlMonthPopover.js +0 -2
- package/dist/form/ControlMonthPopover.js.map +1 -1
- package/dist/form/ControlNumber.d.ts.map +1 -1
- package/dist/form/ControlNumber.js +3 -0
- package/dist/form/ControlNumber.js.map +1 -1
- package/dist/form/ControlObject.d.ts.map +1 -1
- package/dist/form/ControlObject.js +3 -0
- package/dist/form/ControlObject.js.map +1 -1
- package/dist/form/ControlPassword.d.ts +2 -2
- package/dist/form/ControlPassword.d.ts.map +1 -1
- package/dist/form/ControlPassword.js +5 -3
- package/dist/form/ControlPassword.js.map +1 -1
- package/dist/form/ControlSelect.d.ts +7 -6
- package/dist/form/ControlSelect.d.ts.map +1 -1
- package/dist/form/ControlSelect.js +5 -1
- package/dist/form/ControlSelect.js.map +1 -1
- package/dist/form/ControlSelectCombobox.d.ts +1 -1
- package/dist/form/ControlSelectCombobox.d.ts.map +1 -1
- package/dist/form/ControlSelectCombobox.js +1 -1
- package/dist/form/ControlSelectCombobox.js.map +1 -1
- package/dist/form/ControlUpload.d.ts +2 -2
- package/dist/form/ControlUpload.d.ts.map +1 -1
- package/dist/form/ControlUpload.js +26 -5
- package/dist/form/ControlUpload.js.map +1 -1
- package/dist/form/FormField.d.ts +3 -3
- package/dist/form/FormField.js.map +1 -1
- package/dist/form/FormFieldLayoutProvider.d.ts +1 -1
- package/dist/form/FormFieldLayoutProvider.js +1 -1
- package/dist/form/FormFieldLayoutProvider.js.map +1 -1
- package/dist/form/FormFieldRequiredMarkerProvider.js +1 -1
- package/dist/form/FormFieldRequiredMarkerProvider.js.map +1 -1
- package/dist/form/autoFormGroups.js.map +1 -1
- package/dist/form/controlSelectOptions.d.ts +1 -1
- package/dist/form/controlSelectOptions.d.ts.map +1 -1
- package/dist/form/controlSelectOptions.js +2 -2
- package/dist/form/controlSelectOptions.js.map +1 -1
- package/dist/form/grid.d.ts +1 -1
- package/dist/form/grid.js +1 -1
- package/dist/form/grid.js.map +1 -1
- package/dist/form/resizeImage.d.ts +3 -3
- package/dist/form/resizeImage.js +2 -2
- package/dist/form/resizeImage.js.map +1 -1
- package/dist/form/useFieldErrorText.d.ts +8 -0
- package/dist/form/useFieldErrorText.d.ts.map +1 -0
- package/dist/form/useFieldErrorText.js +17 -0
- package/dist/form/useFieldErrorText.js.map +1 -0
- package/dist/i18n/en/index.d.ts +22 -0
- package/dist/i18n/en/index.d.ts.map +1 -0
- package/dist/i18n/en/index.js +1 -0
- package/dist/i18n/en/uiEn.d.ts +37 -0
- package/dist/i18n/en/uiEn.d.ts.map +1 -0
- package/dist/i18n/en/uiEn.js +1468 -0
- package/dist/i18n/en/uiEn.js.map +1 -0
- package/dist/i18n/fr/uiFr.d.ts +3 -2
- package/dist/i18n/fr/uiFr.d.ts.map +1 -1
- package/dist/i18n/fr/uiFr.js +59 -5
- package/dist/i18n/fr/uiFr.js.map +1 -1
- package/dist/markdown/MarkdownView.css +2 -2
- package/dist/markdown/MarkdownView.d.ts +16 -2
- package/dist/markdown/MarkdownView.d.ts.map +1 -1
- package/dist/markdown/MarkdownView.js +20 -7
- package/dist/markdown/MarkdownView.js.map +1 -1
- package/dist/markdown/diagram/FlowchartDiagram.d.ts +3 -2
- package/dist/markdown/diagram/FlowchartDiagram.d.ts.map +1 -1
- package/dist/markdown/diagram/FlowchartDiagram.js +3 -2
- package/dist/markdown/diagram/FlowchartDiagram.js.map +1 -1
- package/dist/markdown/diagram/FlowchartDiagramEdge.d.ts +5 -3
- package/dist/markdown/diagram/FlowchartDiagramEdge.d.ts.map +1 -1
- package/dist/markdown/diagram/FlowchartDiagramEdge.js +5 -3
- package/dist/markdown/diagram/FlowchartDiagramEdge.js.map +1 -1
- package/dist/markdown/diagram/SequenceDiagram.d.ts +3 -2
- package/dist/markdown/diagram/SequenceDiagram.d.ts.map +1 -1
- package/dist/markdown/diagram/SequenceDiagram.js +3 -2
- package/dist/markdown/diagram/SequenceDiagram.js.map +1 -1
- package/dist/markdown/diagram/SequenceDiagramFragment.d.ts +1 -1
- package/dist/markdown/diagram/SequenceDiagramFragment.d.ts.map +1 -1
- package/dist/markdown/diagram/SequenceDiagramFragment.js +1 -0
- package/dist/markdown/diagram/SequenceDiagramFragment.js.map +1 -1
- package/dist/markdown/diagram/SequenceDiagramParticipantActor.d.ts.map +1 -1
- package/dist/markdown/diagram/SequenceDiagramParticipantActor.js +2 -6
- package/dist/markdown/diagram/SequenceDiagramParticipantActor.js.map +1 -1
- package/dist/markdown/diagram/flowchartParser.js +16 -18
- package/dist/markdown/diagram/flowchartParser.js.map +1 -1
- package/dist/markdown/diagram/layoutSequence.d.ts +10 -0
- package/dist/markdown/diagram/layoutSequence.d.ts.map +1 -1
- package/dist/markdown/diagram/layoutSequence.js +50 -21
- package/dist/markdown/diagram/layoutSequence.js.map +1 -1
- package/dist/markdown/diagram/sequenceModel.d.ts +9 -12
- package/dist/markdown/diagram/sequenceModel.d.ts.map +1 -1
- package/dist/markdown/diagram/sequenceParser.js +14 -5
- package/dist/markdown/diagram/sequenceParser.js.map +1 -1
- package/dist/markdown/diagram/textMetrics.d.ts.map +1 -1
- package/dist/markdown/diagram/textMetrics.js +4 -4
- package/dist/markdown/diagram/textMetrics.js.map +1 -1
- package/dist/markdown/highlightLines.d.ts +27 -0
- package/dist/markdown/highlightLines.d.ts.map +1 -0
- package/dist/markdown/highlightLines.js +91 -0
- package/dist/markdown/highlightLines.js.map +1 -0
- package/dist/markdown/index.d.ts +5 -2
- package/dist/markdown/index.d.ts.map +1 -1
- package/dist/markdown/index.js +2 -1
- package/dist/markdown/rehypeHighlight.d.ts +6 -5
- package/dist/markdown/rehypeHighlight.d.ts.map +1 -1
- package/dist/markdown/rehypeHighlight.js +6 -5
- package/dist/markdown/rehypeHighlight.js.map +1 -1
- package/dist/markdown/remarkSpoiler.js +2 -2
- package/dist/markdown/remarkSpoiler.js.map +1 -1
- package/dist/organizations/OrganizationInviteDialog.d.ts.map +1 -1
- package/dist/organizations/OrganizationInviteDialog.js +2 -1
- package/dist/organizations/OrganizationInviteDialog.js.map +1 -1
- package/dist/organizations/OrganizationMemberIdentity.d.ts +6 -0
- package/dist/organizations/OrganizationMemberIdentity.d.ts.map +1 -1
- package/dist/organizations/OrganizationMemberIdentity.js +3 -2
- package/dist/organizations/OrganizationMemberIdentity.js.map +1 -1
- package/dist/organizations/OrganizationMemberRankPicker.d.ts.map +1 -1
- package/dist/organizations/OrganizationMemberRankPicker.js +2 -1
- package/dist/organizations/OrganizationMemberRankPicker.js.map +1 -1
- package/dist/organizations/OrganizationMembers.d.ts.map +1 -1
- package/dist/organizations/OrganizationMembers.js +3 -1
- package/dist/organizations/OrganizationMembers.js.map +1 -1
- package/dist/organizations/OrganizationRankColumnHeader.d.ts +9 -0
- package/dist/organizations/OrganizationRankColumnHeader.d.ts.map +1 -1
- package/dist/organizations/OrganizationRankColumnHeader.js +55 -26
- package/dist/organizations/OrganizationRankColumnHeader.js.map +1 -1
- package/dist/organizations/OrganizationRanks.d.ts.map +1 -1
- package/dist/organizations/OrganizationRanks.js +62 -7
- package/dist/organizations/OrganizationRanks.js.map +1 -1
- package/dist/organizations/rankOrder.d.ts +21 -0
- package/dist/organizations/rankOrder.d.ts.map +1 -0
- package/dist/organizations/rankOrder.js +20 -0
- package/dist/organizations/rankOrder.js.map +1 -0
- package/dist/settings/SettingsDangerSection.d.ts +3 -3
- package/dist/settings/SettingsDangerSection.d.ts.map +1 -1
- package/dist/settings/SettingsDangerSection.js +5 -3
- package/dist/settings/SettingsDangerSection.js.map +1 -1
- package/dist/settings/SettingsDialog.js +2 -2
- package/dist/settings/SettingsDialog.js.map +1 -1
- package/dist/settings/SettingsDialogs.js.map +1 -1
- package/dist/settings/SettingsHeading.d.ts +4 -4
- package/dist/settings/SettingsHeading.js +3 -3
- package/dist/settings/SettingsHeading.js.map +1 -1
- package/dist/settings/SettingsRow.d.ts +4 -4
- package/dist/settings/SettingsRow.js +1 -1
- package/dist/settings/SettingsRow.js.map +1 -1
- package/dist/settings/SettingsSection.d.ts +3 -3
- package/dist/settings/SettingsSection.js +2 -2
- package/dist/settings/SettingsSection.js.map +1 -1
- package/dist/shell/ActionErrorToaster.d.ts +1 -1
- package/dist/shell/ActionErrorToaster.js +1 -1
- package/dist/shell/ActionErrorToaster.js.map +1 -1
- package/dist/shell/AppActions.d.ts +5 -5
- package/dist/shell/AppActions.d.ts.map +1 -1
- package/dist/shell/AppActions.js +3 -3
- package/dist/shell/AppActions.js.map +1 -1
- package/dist/shell/AppShell.d.ts +1 -1
- package/dist/shell/AppShell.js.map +1 -1
- package/dist/shell/AppShellNavDropdownItems.d.ts +2 -2
- package/dist/shell/AppShellNavDropdownItems.js +2 -2
- package/dist/shell/AppShellNavDropdownItems.js.map +1 -1
- package/dist/shell/AppShellSidebarNavItem.js.map +1 -1
- package/dist/shell/ButtonInbox.d.ts +8 -0
- package/dist/shell/ButtonInbox.d.ts.map +1 -1
- package/dist/shell/ButtonInbox.js +18 -14
- package/dist/shell/ButtonInbox.js.map +1 -1
- package/dist/shell/ButtonLanguage.d.ts +1 -1
- package/dist/shell/ButtonLanguage.js +1 -1
- package/dist/shell/ButtonLanguage.js.map +1 -1
- package/dist/shell/ButtonSettingsLanguageMenu.js.map +1 -1
- package/dist/shell/ButtonUser.d.ts +1 -1
- package/dist/shell/ButtonUser.js.map +1 -1
- package/dist/shell/ButtonUserAdminMenuItem.d.ts +1 -1
- package/dist/shell/ButtonUserAdminMenuItem.js.map +1 -1
- package/dist/shell/DetailAside.d.ts +10 -4
- package/dist/shell/DetailAside.d.ts.map +1 -1
- package/dist/shell/DetailAside.js +46 -39
- package/dist/shell/DetailAside.js.map +1 -1
- package/dist/shell/DetailLayout.d.ts +7 -7
- package/dist/shell/DetailLayout.js +4 -4
- package/dist/shell/DetailLayout.js.map +1 -1
- package/dist/shell/NavShell.d.ts +3 -3
- package/dist/shell/NavShell.js +2 -2
- package/dist/shell/NavShell.js.map +1 -1
- package/dist/shell/NavigationProgress.d.ts +0 -1
- package/dist/shell/NavigationProgress.d.ts.map +1 -1
- package/dist/shell/NavigationProgress.js +8 -2
- package/dist/shell/NavigationProgress.js.map +1 -1
- package/dist/shell/PlateFolderTabs.d.ts.map +1 -1
- package/dist/shell/PlateFolderTabs.js +1 -1
- package/dist/shell/PlateFolderTabs.js.map +1 -1
- package/dist/shell/PlateLayout.d.ts +7 -11
- package/dist/shell/PlateLayout.d.ts.map +1 -1
- package/dist/shell/PlateLayout.js +48 -23
- package/dist/shell/PlateLayout.js.map +1 -1
- package/dist/shell/Spotlight.d.ts +1 -1
- package/dist/shell/Spotlight.js.map +1 -1
- package/dist/shell/appShellNav.d.ts +3 -3
- package/dist/shell/appShellNav.js +2 -2
- package/dist/shell/appShellNav.js.map +1 -1
- package/dist/shell/navTreeUtil.d.ts +5 -5
- package/dist/shell/navTreeUtil.js +4 -4
- package/dist/shell/navTreeUtil.js.map +1 -1
- package/dist/shell/useDetailTab.d.ts +5 -4
- package/dist/shell/useDetailTab.d.ts.map +1 -1
- package/dist/shell/useDetailTab.js +6 -5
- package/dist/shell/useDetailTab.js.map +1 -1
- package/dist/shell/useNavBreadcrumbs.d.ts +1 -1
- package/dist/shell/useNavBreadcrumbs.d.ts.map +1 -1
- package/dist/shell/useNavBreadcrumbs.js +2 -2
- package/dist/shell/useNavBreadcrumbs.js.map +1 -1
- package/dist/shell/useNavEntries.d.ts +5 -5
- package/dist/shell/useNavEntries.d.ts.map +1 -1
- package/dist/shell/useNavEntries.js.map +1 -1
- package/dist/shell/useNavTree.d.ts +1 -1
- package/dist/shell/useNavTree.js.map +1 -1
- package/dist/sortable/index.d.ts +17 -0
- package/dist/sortable/index.d.ts.map +1 -0
- package/dist/sortable/index.js +4 -0
- package/dist/sortable/useSortableItem.d.ts +32 -0
- package/dist/sortable/useSortableItem.d.ts.map +1 -0
- package/dist/sortable/useSortableItem.js +35 -0
- package/dist/sortable/useSortableItem.js.map +1 -0
- package/dist/sortable/useSortableList.d.ts +85 -0
- package/dist/sortable/useSortableList.d.ts.map +1 -0
- package/dist/sortable/useSortableList.js +125 -0
- package/dist/sortable/useSortableList.js.map +1 -0
- package/dist/styles.css +34 -14
- package/dist/swagger/OpenApiSpec.d.ts +5 -0
- package/dist/swagger/OpenApiSpec.d.ts.map +1 -1
- package/dist/swagger/OpenApiSpec.js +14 -1
- package/dist/swagger/OpenApiSpec.js.map +1 -1
- package/dist/swagger/SwaggerExplorer.d.ts.map +1 -1
- package/dist/swagger/SwaggerExplorer.js +4 -1
- package/dist/swagger/SwaggerExplorer.js.map +1 -1
- package/dist/swagger/SwaggerNav.js +1 -1
- package/dist/swagger/SwaggerNav.js.map +1 -1
- package/dist/swagger/SwaggerRequestBuilder.d.ts +4 -2
- package/dist/swagger/SwaggerRequestBuilder.d.ts.map +1 -1
- package/dist/swagger/SwaggerRequestBuilder.js +10 -7
- package/dist/swagger/SwaggerRequestBuilder.js.map +1 -1
- package/dist/swagger/SwaggerSchemaView.d.ts +3 -2
- package/dist/swagger/SwaggerSchemaView.d.ts.map +1 -1
- package/dist/swagger/SwaggerSchemaView.js +11 -16
- package/dist/swagger/SwaggerSchemaView.js.map +1 -1
- package/dist/swagger/SwaggerSchemaViewField.d.ts +18 -0
- package/dist/swagger/SwaggerSchemaViewField.d.ts.map +1 -0
- package/dist/swagger/SwaggerSchemaViewField.js +28 -0
- package/dist/swagger/SwaggerSchemaViewField.js.map +1 -0
- package/dist/swagger/SwaggerTryIt.d.ts.map +1 -1
- package/dist/swagger/SwaggerTryIt.js +1 -1
- package/dist/swagger/SwaggerTryIt.js.map +1 -1
- package/dist/swagger/SwaggerTryItForm.d.ts +6 -1
- package/dist/swagger/SwaggerTryItForm.d.ts.map +1 -1
- package/dist/swagger/SwaggerTryItForm.js +14 -8
- package/dist/swagger/SwaggerTryItForm.js.map +1 -1
- package/dist/table/DataTable.d.ts.map +1 -1
- package/dist/table/DataTable.js +107 -19
- package/dist/table/DataTable.js.map +1 -1
- package/dist/table/DataTableBody.d.ts +19 -1
- package/dist/table/DataTableBody.d.ts.map +1 -1
- package/dist/table/DataTableBody.js +90 -46
- package/dist/table/DataTableBody.js.map +1 -1
- package/dist/table/DataTableFilterDialog.d.ts +5 -5
- package/dist/table/DataTableFilterDialog.js +4 -4
- package/dist/table/DataTableFilterDialog.js.map +1 -1
- package/dist/table/DataTableFooter.js +1 -1
- package/dist/table/DataTableFooter.js.map +1 -1
- package/dist/table/DataTableGroupRow.d.ts +25 -0
- package/dist/table/DataTableGroupRow.d.ts.map +1 -0
- package/dist/table/DataTableGroupRow.js +43 -0
- package/dist/table/DataTableGroupRow.js.map +1 -0
- package/dist/table/DataTableHeaderPopupList.d.ts.map +1 -1
- package/dist/table/DataTableHeaderPopupList.js +1 -0
- package/dist/table/DataTableHeaderPopupList.js.map +1 -1
- package/dist/table/DataTableHeaderRow.js.map +1 -1
- package/dist/table/DataTablePresetRail.d.ts +6 -1
- package/dist/table/DataTablePresetRail.d.ts.map +1 -1
- package/dist/table/DataTablePresetRail.js +4 -2
- package/dist/table/DataTablePresetRail.js.map +1 -1
- package/dist/table/DataTablePresetRailButton.js +1 -1
- package/dist/table/DataTablePresetRailButton.js.map +1 -1
- package/dist/table/DataTableRowActionGroupItem.d.ts +23 -0
- package/dist/table/DataTableRowActionGroupItem.d.ts.map +1 -0
- package/dist/table/DataTableRowActionGroupItem.js +38 -0
- package/dist/table/DataTableRowActionGroupItem.js.map +1 -0
- package/dist/table/DataTableRowActionItem.d.ts.map +1 -1
- package/dist/table/DataTableRowActionItem.js +15 -2
- package/dist/table/DataTableRowActionItem.js.map +1 -1
- package/dist/table/DataTableRowActionsInline.d.ts.map +1 -1
- package/dist/table/DataTableRowActionsInline.js +2 -1
- package/dist/table/DataTableRowActionsInline.js.map +1 -1
- package/dist/table/DataTableRowActionsMenu.d.ts +3 -2
- package/dist/table/DataTableRowActionsMenu.d.ts.map +1 -1
- package/dist/table/DataTableRowActionsMenu.js +12 -14
- package/dist/table/DataTableRowActionsMenu.js.map +1 -1
- package/dist/table/DataTableSummaryCard.d.ts +13 -0
- package/dist/table/DataTableSummaryCard.d.ts.map +1 -1
- package/dist/table/DataTableSummaryCard.js +24 -2
- package/dist/table/DataTableSummaryCard.js.map +1 -1
- package/dist/table/DataTableSummaryPanel.d.ts +8 -0
- package/dist/table/DataTableSummaryPanel.d.ts.map +1 -1
- package/dist/table/DataTableSummaryPanel.js +6 -2
- package/dist/table/DataTableSummaryPanel.js.map +1 -1
- package/dist/table/DataTableToolbar.js.map +1 -1
- package/dist/table/PermissionMatrix.d.ts +6 -0
- package/dist/table/PermissionMatrix.d.ts.map +1 -1
- package/dist/table/PermissionMatrix.js.map +1 -1
- package/dist/table/PermissionMatrixGroupRows.d.ts.map +1 -1
- package/dist/table/PermissionMatrixGroupRows.js +9 -4
- package/dist/table/PermissionMatrixGroupRows.js.map +1 -1
- package/dist/table/dataTableBaseProps.d.ts +75 -12
- package/dist/table/dataTableBaseProps.d.ts.map +1 -1
- package/dist/table/dataTableFilterFields.d.ts +5 -0
- package/dist/table/dataTableFilterFields.d.ts.map +1 -1
- package/dist/table/dataTableFilterFields.js +15 -1
- package/dist/table/dataTableFilterFields.js.map +1 -1
- package/dist/table/dataTablePersistence.d.ts +53 -11
- package/dist/table/dataTablePersistence.d.ts.map +1 -1
- package/dist/table/dataTablePersistence.js +66 -29
- package/dist/table/dataTablePersistence.js.map +1 -1
- package/dist/table/dataTableTypes.d.ts +96 -11
- package/dist/table/dataTableTypes.d.ts.map +1 -1
- package/dist/table/index.d.ts +10 -3
- package/dist/table/index.d.ts.map +1 -1
- package/dist/table/index.js +2 -1
- package/dist/table/paginateLocal.d.ts +32 -3
- package/dist/table/paginateLocal.d.ts.map +1 -1
- package/dist/table/paginateLocal.js +47 -3
- package/dist/table/paginateLocal.js.map +1 -1
- package/dist/table/useDataTableColumns.d.ts.map +1 -1
- package/dist/table/useDataTableColumns.js +4 -4
- package/dist/table/useDataTableColumns.js.map +1 -1
- package/dist/table/useDataTableData.d.ts +1 -0
- package/dist/table/useDataTableData.d.ts.map +1 -1
- package/dist/table/useDataTableData.js +43 -24
- package/dist/table/useDataTableData.js.map +1 -1
- package/dist/table/useDataTableFilterForm.d.ts +4 -0
- package/dist/table/useDataTableFilterForm.d.ts.map +1 -1
- package/dist/table/useDataTableFilterForm.js +9 -4
- package/dist/table/useDataTableFilterForm.js.map +1 -1
- package/dist/table/useDataTableFilterModel.d.ts.map +1 -1
- package/dist/table/useDataTableFilterModel.js +2 -4
- package/dist/table/useDataTableFilterModel.js.map +1 -1
- package/dist/table/useDataTableFilterVisibility.d.ts +5 -0
- package/dist/table/useDataTableFilterVisibility.d.ts.map +1 -1
- package/dist/table/useDataTableFilterVisibility.js +16 -8
- package/dist/table/useDataTableFilterVisibility.js.map +1 -1
- package/dist/table/useDataTableRefresh.d.ts.map +1 -1
- package/dist/table/useDataTableRefresh.js +3 -2
- package/dist/table/useDataTableRefresh.js.map +1 -1
- package/dist/table/useDataTableSummary.d.ts +5 -0
- package/dist/table/useDataTableSummary.d.ts.map +1 -1
- package/dist/table/useDataTableSummary.js +6 -6
- package/dist/table/useDataTableSummary.js.map +1 -1
- package/dist/table/useDataTableWake.d.ts +43 -0
- package/dist/table/useDataTableWake.d.ts.map +1 -0
- package/dist/table/useDataTableWake.js +40 -0
- package/dist/table/useDataTableWake.js.map +1 -0
- package/dist/table/useTableSelection.d.ts +1 -1
- package/dist/table/useTableSelection.js.map +1 -1
- package/dist/tree/TreeView.d.ts +8 -8
- package/dist/tree/TreeView.d.ts.map +1 -1
- package/dist/tree/TreeView.js +63 -6
- package/dist/tree/TreeView.js.map +1 -1
- package/dist/tree/TreeViewRow.d.ts +15 -24
- package/dist/tree/TreeViewRow.d.ts.map +1 -1
- package/dist/tree/TreeViewRow.js +45 -18
- package/dist/tree/TreeViewRow.js.map +1 -1
- package/dist/tree/index.d.ts +3 -4
- package/dist/tree/index.d.ts.map +1 -1
- package/dist/tree/index.js +2 -3
- package/dist/tree/treeModel.d.ts +19 -0
- package/dist/tree/treeModel.d.ts.map +1 -1
- package/dist/tree/treeModel.js +23 -2
- package/dist/tree/treeModel.js.map +1 -1
- package/docs/packages-alepha-ui-account.md +1 -0
- package/docs/packages-alepha-ui-admin.md +1 -1
- package/docs/packages-alepha-ui-ai.md +3 -3
- package/docs/packages-alepha-ui-calendar.md +1 -0
- package/docs/packages-alepha-ui-chart.md +1 -0
- package/docs/packages-alepha-ui-command.md +1 -0
- package/docs/packages-alepha-ui-core.md +1 -0
- package/docs/packages-alepha-ui-form.md +1 -0
- package/docs/packages-alepha-ui-i18n-en.md +35 -0
- package/docs/packages-alepha-ui-i18n-fr.md +1 -0
- package/docs/packages-alepha-ui-markdown.md +4 -1
- package/docs/packages-alepha-ui-organizations.md +1 -0
- package/docs/packages-alepha-ui-otp.md +1 -0
- package/docs/packages-alepha-ui-overview.md +5 -3
- package/docs/packages-alepha-ui-resizable.md +1 -0
- package/docs/packages-alepha-ui-sortable.md +34 -0
- package/docs/packages-alepha-ui-table.md +7 -1
- package/docs/packages-alepha-ui-tree.md +2 -2
- package/package.json +22 -4
- package/src/account/AccountDeleteDialog.tsx +4 -4
- package/src/account/AccountMfaDialog.tsx +155 -20
- package/src/account/AccountPasskeyProofDialog.tsx +7 -4
- package/src/account/AccountPasswordDialog.tsx +50 -11
- package/src/account/AccountProfile.tsx +1 -1
- package/src/account/AccountProfileView.tsx +125 -31
- package/src/account/AccountSecurityView.tsx +56 -3
- package/src/account/AccountSessionsView.tsx +33 -7
- package/src/account/__tests__/AccountProfile.browser.spec.tsx +122 -14
- package/src/account/__tests__/AccountProof.browser.spec.tsx +465 -0
- package/src/account/__tests__/AccountSessions.browser.spec.tsx +18 -3
- package/src/admin/$pageAdmin.tsx +1 -1
- package/src/admin/AdminAnalytics.tsx +19 -6
- package/src/admin/AdminAudits.tsx +22 -24
- package/src/admin/AdminDashboard.tsx +1 -1
- package/src/admin/AdminDashboardCard.tsx +2 -2
- package/src/admin/AdminFiles.tsx +1 -1
- package/src/admin/AdminJobDetail.tsx +7 -0
- package/src/admin/AdminJobExecutionSheet.tsx +9 -0
- package/src/admin/AdminJobsStatusBadge.tsx +1 -1
- package/src/admin/AdminKeys.tsx +19 -10
- package/src/admin/AdminLayout.tsx +4 -4
- package/src/admin/AdminNotifications.tsx +1 -1
- package/src/admin/AdminNotificationsStatusBadge.tsx +1 -1
- package/src/admin/AdminParameters.tsx +42 -28
- package/src/admin/AdminParametersEditorForm.tsx +2 -2
- package/src/admin/AdminParametersEditorPane.tsx +6 -5
- package/src/admin/AdminParametersHistoryPane.tsx +1 -1
- package/src/admin/AdminParametersTreeNodeView.tsx +9 -3
- package/src/admin/AdminParametersTreePane.tsx +7 -2
- package/src/admin/AdminPayments.tsx +1 -1
- package/src/admin/AdminPaymentsStatusBadge.tsx +1 -1
- package/src/admin/AdminRouter.tsx +15 -15
- package/src/admin/AdminRouterOptions.tsx +9 -9
- package/src/admin/AdminSessions.tsx +17 -19
- package/src/admin/AdminUserCell.tsx +9 -10
- package/src/admin/AdminUserDetail.tsx +24 -29
- package/src/admin/AdminUserDetailAuditsTab.tsx +2 -2
- package/src/admin/AdminUserDetailIdentityAside.tsx +3 -3
- package/src/admin/AdminUserDetailOverviewTab.tsx +1 -1
- package/src/admin/AdminUserDetailPasswordDialog.tsx +1 -1
- package/src/admin/AdminUserDetailSecurityTab.tsx +1 -1
- package/src/admin/AdminUserDetailSessionsTab.tsx +2 -2
- package/src/admin/AdminUsers.tsx +6 -7
- package/src/admin/AdminUsersRolesPicker.tsx +2 -2
- package/src/admin/AdminWebhookDeliveryDialog.tsx +0 -1
- package/src/admin/AdminWebhookDetail.tsx +22 -0
- package/src/admin/AdminWebhooksCreateDialog.tsx +3 -0
- package/src/admin/ParameterHistoryItem.tsx +3 -3
- package/src/admin/__tests__/$pageAdmin.spec.ts +3 -3
- package/src/admin/__tests__/AdminAnalytics.browser.spec.tsx +66 -0
- package/src/admin/__tests__/AdminFacetReads.browser.spec.tsx +107 -0
- package/src/admin/__tests__/AdminKeysCreate.browser.spec.tsx +134 -0
- package/src/admin/__tests__/AdminKeysTokenDialog.browser.spec.tsx +13 -2
- package/src/admin/__tests__/AdminLayout.browser.spec.tsx +3 -3
- package/src/admin/__tests__/AdminParametersEditorPane.browser.spec.tsx +102 -0
- package/src/admin/__tests__/AdminParametersOrphanDelete.browser.spec.tsx +136 -0
- package/src/admin/__tests__/AdminRouter.spec.ts +14 -8
- package/src/admin/__tests__/AdminUserCell.browser.spec.tsx +27 -12
- package/src/admin/__tests__/AdminUserDetail.browser.spec.tsx +147 -0
- package/src/admin/__tests__/AdminWebhooks.browser.spec.tsx +12 -0
- package/src/admin/__tests__/AnalyticsRequestDialog.browser.spec.tsx +92 -0
- package/src/admin/__tests__/AnalyticsToggleChip.browser.spec.tsx +37 -0
- package/src/admin/__tests__/useAdminDetailTrail.browser.spec.tsx +71 -0
- package/src/admin/__tests__/useJobRetentionLabels.browser.spec.tsx +51 -0
- package/src/admin/adminUserDetailProfilePolicy.spec.ts +1 -1
- package/src/admin/adminUserDetailProfilePolicy.ts +5 -5
- package/src/admin/analytics/QueryPanel.tsx +1 -1
- package/src/admin/analytics/RequestDialog.tsx +7 -3
- package/src/admin/analytics/ResultsTable.tsx +1 -1
- package/src/admin/analytics/ToggleChip.tsx +7 -5
- package/src/admin/analytics/TotalsCards.tsx +1 -1
- package/src/admin/analytics/analyticsModel.spec.ts +41 -0
- package/src/admin/analytics/analyticsModel.ts +11 -4
- package/src/admin/analytics/analyticsTypes.ts +1 -1
- package/src/admin/analytics/chartModel.spec.ts +39 -0
- package/src/admin/analytics/chartModel.ts +24 -20
- package/src/admin/diffLines.ts +1 -1
- package/src/admin/index.ts +1 -1
- package/src/admin/useAdminDetailTrail.ts +39 -0
- package/src/admin/useJobRetentionLabels.ts +6 -1
- package/src/admin/useNotificationStatusLabels.ts +1 -1
- package/src/ai/AiChat.tsx +44 -6
- package/src/ai/AiChatConfirmCard.tsx +7 -1
- package/src/ai/AiChatFloat.tsx +46 -0
- package/src/ai/AiChatHistory.tsx +2 -2
- package/src/ai/AiChatMessage.tsx +2 -2
- package/src/ai/AiChatPanel.tsx +154 -47
- package/src/ai/AiChatToolStepDetails.tsx +42 -0
- package/src/ai/AiChatToolTrace.tsx +167 -0
- package/src/ai/__tests__/AiChat.browser.spec.tsx +270 -2
- package/src/ai/index.ts +4 -2
- package/src/auth/AuthLogin.tsx +50 -9
- package/src/auth/AuthMfaStep.tsx +99 -33
- package/src/auth/AuthRegister.tsx +5 -5
- package/src/auth/AuthRegisterFormPhase.tsx +1 -1
- package/src/auth/AuthResetPassword.tsx +52 -11
- package/src/auth/AuthRouter.tsx +10 -18
- package/src/auth/TurnstileWidget.tsx +4 -4
- package/src/auth/__tests__/AuthMfaStep.browser.spec.tsx +115 -0
- package/src/auth/__tests__/AuthPasskey.browser.spec.tsx +48 -3
- package/src/auth/__tests__/AuthPasswordForms.browser.spec.tsx +250 -0
- package/src/auth/__tests__/AuthRouter.spec.ts +0 -13
- package/src/command/Command.tsx +17 -2
- package/src/command/__tests__/Command.browser.spec.tsx +45 -1
- package/src/core/Avatar.tsx +6 -1
- package/src/core/Badge.tsx +66 -7
- package/src/core/Button.tsx +26 -1
- package/src/core/Card.tsx +25 -1
- package/src/core/Collapsible.tsx +1 -1
- package/src/core/ContextMenu.tsx +1 -1
- package/src/core/Dialog.tsx +6 -2
- package/src/core/Drawer.tsx +2 -1
- package/src/core/DropdownMenu.tsx +1 -1
- package/src/core/FileImage.tsx +12 -9
- package/src/core/Menubar.tsx +1 -1
- package/src/core/PageOutline.tsx +43 -4
- package/src/core/PaneResizer.tsx +128 -0
- package/src/core/Segmented.tsx +32 -10
- package/src/core/Sidebar.tsx +4 -1
- package/src/core/Slider.tsx +6 -4
- package/src/core/Table.tsx +1 -1
- package/src/core/Tabs.tsx +1 -0
- package/src/core/Textarea.tsx +14 -2
- package/src/core/TimeAgo.tsx +3 -4
- package/src/core/__tests__/Button.browser.spec.tsx +57 -0
- package/src/core/__tests__/CoreA11y.browser.spec.tsx +4 -0
- package/src/core/__tests__/FileImage.browser.spec.tsx +23 -0
- package/src/core/__tests__/PageOutline.browser.spec.tsx +36 -12
- package/src/core/__tests__/PaneResizer.browser.spec.tsx +104 -0
- package/src/core/__tests__/Segmented.browser.spec.tsx +29 -0
- package/src/core/__tests__/SidebarShortcut.browser.spec.tsx +35 -0
- package/src/core/__tests__/Tabs.browser.spec.tsx +23 -0
- package/src/core/__tests__/Textarea.browser.spec.tsx +41 -0
- package/src/core/__tests__/UserAvatar.browser.spec.tsx +1 -2
- package/src/core/__tests__/primitiveSlots.spec.ts +1 -0
- package/src/core/__tests__/useDialogConfirm.browser.spec.tsx +89 -0
- package/src/core/__tests__/useToast.browser.spec.tsx +1 -1
- package/src/core/__tests__/useUndoable.browser.spec.tsx +43 -0
- package/src/core/__tests__/userInitials.spec.ts +44 -0
- package/src/core/index.ts +12 -1
- package/src/core/useDialog.tsx +52 -4
- package/src/core/useToast.tsx +19 -19
- package/src/core/useUndoable.tsx +6 -2
- package/src/core/userInitials.ts +45 -6
- package/src/form/AutoForm.tsx +39 -15
- package/src/form/AutoFormBottomBar.tsx +2 -2
- package/src/form/AutoFormErrorPopover.tsx +7 -3
- package/src/form/AutoFormGroupBlock.tsx +1 -1
- package/src/form/AutoFormGroupGridField.tsx +1 -1
- package/src/form/Control.tsx +18 -13
- package/src/form/ControlArray.tsx +7 -4
- package/src/form/ControlDate.tsx +3 -0
- package/src/form/ControlDatePopover.tsx +6 -2
- package/src/form/ControlDateRange.tsx +10 -4
- package/src/form/ControlMonthPopover.tsx +0 -8
- package/src/form/ControlNumber.tsx +3 -0
- package/src/form/ControlObject.tsx +3 -0
- package/src/form/ControlPassword.tsx +9 -3
- package/src/form/ControlSelect.tsx +17 -10
- package/src/form/ControlSelectCombobox.tsx +9 -6
- package/src/form/ControlUpload.tsx +49 -10
- package/src/form/FormField.tsx +4 -4
- package/src/form/FormFieldLayoutProvider.tsx +1 -1
- package/src/form/FormFieldRequiredMarkerProvider.tsx +1 -1
- package/src/form/__tests__/AutoFormAutoSave.browser.spec.tsx +87 -0
- package/src/form/__tests__/AutoFormSettingsCard.browser.spec.tsx +3 -3
- package/src/form/__tests__/ControlChoices.browser.spec.tsx +30 -0
- package/src/form/__tests__/ControlDateRange.browser.spec.tsx +41 -2
- package/src/form/__tests__/ControlDateTime.browser.spec.tsx +82 -0
- package/src/form/__tests__/ControlFrenchLabels.browser.spec.tsx +129 -0
- package/src/form/__tests__/ControlRequiredRefusal.browser.spec.tsx +71 -2
- package/src/form/__tests__/ControlSelectClearLabel.browser.spec.tsx +3 -3
- package/src/form/__tests__/ControlSelectEmptyValue.browser.spec.tsx +60 -0
- package/src/form/__tests__/ControlSelectMulti.browser.spec.tsx +2 -2
- package/src/form/__tests__/ControlSelectSearchable.browser.spec.tsx +2 -2
- package/src/form/__tests__/ControlSelectTriggerProps.browser.spec.tsx +1 -1
- package/src/form/__tests__/ControlUpload.browser.spec.tsx +149 -0
- package/src/form/autoFormGroups.ts +1 -1
- package/src/form/controlSelectOptions.ts +17 -13
- package/src/form/grid.tsx +1 -1
- package/src/form/resizeImage.ts +4 -4
- package/src/form/useFieldErrorText.ts +20 -0
- package/src/i18n/en/__tests__/uiEn.spec.ts +110 -0
- package/src/i18n/en/index.ts +22 -0
- package/src/i18n/en/uiEn.ts +1647 -0
- package/src/i18n/fr/__tests__/uiFr.spec.ts +1 -1
- package/src/i18n/fr/uiFr.ts +75 -5
- package/src/markdown/MarkdownView.css +2 -2
- package/src/markdown/MarkdownView.tsx +40 -9
- package/src/markdown/__tests__/MarkdownViewHighlight.browser.spec.tsx +9 -0
- package/src/markdown/__tests__/MarkdownViewMermaid.browser.spec.tsx +24 -3
- package/src/markdown/__tests__/MarkdownViewRawHtml.browser.spec.tsx +3 -3
- package/src/markdown/__tests__/highlightLines.spec.ts +45 -0
- package/src/markdown/diagram/FlowchartDiagram.tsx +3 -2
- package/src/markdown/diagram/FlowchartDiagramEdge.tsx +5 -3
- package/src/markdown/diagram/SequenceDiagram.tsx +3 -2
- package/src/markdown/diagram/SequenceDiagramFragment.tsx +6 -3
- package/src/markdown/diagram/SequenceDiagramParticipantActor.tsx +1 -6
- package/src/markdown/diagram/flowchartParser.spec.ts +40 -0
- package/src/markdown/diagram/flowchartParser.ts +33 -8
- package/src/markdown/diagram/layoutSequence.spec.ts +46 -0
- package/src/markdown/diagram/layoutSequence.ts +61 -10
- package/src/markdown/diagram/sequenceModel.ts +9 -13
- package/src/markdown/diagram/sequenceParser.spec.ts +59 -11
- package/src/markdown/diagram/sequenceParser.ts +17 -4
- package/src/markdown/diagram/textMetrics.ts +6 -5
- package/src/markdown/highlightLines.ts +120 -0
- package/src/markdown/index.ts +14 -2
- package/src/markdown/rehypeHighlight.ts +6 -5
- package/src/markdown/remarkSpoiler.ts +2 -2
- package/src/organizations/OrganizationInviteDialog.tsx +3 -1
- package/src/organizations/OrganizationMemberIdentity.tsx +16 -11
- package/src/organizations/OrganizationMemberRankPicker.tsx +3 -1
- package/src/organizations/OrganizationMembers.tsx +11 -1
- package/src/organizations/OrganizationRankColumnHeader.tsx +64 -2
- package/src/organizations/OrganizationRanks.tsx +105 -17
- package/src/organizations/__tests__/OrganizationMemberRankPicker.browser.spec.tsx +36 -0
- package/src/organizations/__tests__/OrganizationMembers.browser.spec.tsx +33 -2
- package/src/organizations/__tests__/OrganizationRanks.browser.spec.tsx +78 -3
- package/src/organizations/__tests__/rankOrder.spec.ts +47 -0
- package/src/organizations/rankOrder.ts +30 -0
- package/src/settings/SettingsDangerSection.tsx +7 -4
- package/src/settings/SettingsDialog.tsx +3 -3
- package/src/settings/SettingsHeading.tsx +4 -4
- package/src/settings/SettingsRow.tsx +4 -4
- package/src/settings/SettingsSection.tsx +3 -3
- package/src/settings/__tests__/SettingsSection.browser.spec.tsx +44 -5
- package/src/shell/ActionErrorToaster.tsx +1 -1
- package/src/shell/AppActions.tsx +9 -8
- package/src/shell/AppShell.tsx +5 -5
- package/src/shell/AppShellNavDropdownItems.tsx +2 -2
- package/src/shell/AppShellSidebarNavItem.tsx +7 -7
- package/src/shell/ButtonInbox.tsx +40 -13
- package/src/shell/ButtonLanguage.tsx +1 -1
- package/src/shell/ButtonUser.tsx +1 -1
- package/src/shell/ButtonUserAdminMenuItem.tsx +1 -1
- package/src/shell/DetailAside.tsx +30 -12
- package/src/shell/DetailLayout.tsx +10 -10
- package/src/shell/NavShell.tsx +3 -3
- package/src/shell/NavigationProgress.tsx +9 -3
- package/src/shell/PlateFolderTabs.tsx +4 -2
- package/src/shell/PlateLayout.tsx +98 -44
- package/src/shell/Spotlight.tsx +1 -1
- package/src/shell/__tests__/ActionErrorToasterHandled.browser.spec.tsx +25 -18
- package/src/shell/__tests__/ButtonInbox.browser.spec.tsx +133 -2
- package/src/shell/__tests__/ButtonUserAvatar.browser.spec.tsx +6 -4
- package/src/shell/__tests__/DetailAside.browser.spec.tsx +2 -2
- package/src/shell/__tests__/DetailLayout.browser.spec.tsx +1 -1
- package/src/shell/__tests__/NavigationProgress.browser.spec.tsx +24 -4
- package/src/shell/__tests__/PlateLayout.browser.spec.tsx +44 -11
- package/src/shell/__tests__/SidebarNavAutoClose.browser.spec.tsx +2 -2
- package/src/shell/__tests__/navTreeUtil.spec.ts +1 -1
- package/src/shell/__tests__/useNavBreadcrumbs.browser.spec.tsx +76 -0
- package/src/shell/appShellNav.tsx +3 -3
- package/src/shell/navTreeUtil.ts +6 -6
- package/src/shell/useDetailTab.tsx +6 -5
- package/src/shell/useNavBreadcrumbs.ts +4 -2
- package/src/shell/useNavEntries.ts +9 -8
- package/src/shell/useNavTree.ts +1 -1
- package/src/sortable/__tests__/useSortableList.browser.spec.tsx +157 -0
- package/src/sortable/index.ts +22 -0
- package/src/sortable/useSortableItem.ts +65 -0
- package/src/sortable/useSortableList.ts +231 -0
- package/src/styles.css +34 -14
- package/src/swagger/OpenApiSpec.ts +23 -1
- package/src/swagger/SwaggerExplorer.tsx +6 -1
- package/src/swagger/SwaggerNav.tsx +2 -2
- package/src/swagger/SwaggerRequestBuilder.ts +23 -7
- package/src/swagger/SwaggerSchemaView.tsx +11 -16
- package/src/swagger/SwaggerSchemaViewField.tsx +36 -0
- package/src/swagger/SwaggerTryIt.tsx +25 -22
- package/src/swagger/SwaggerTryItForm.tsx +28 -13
- package/src/swagger/__tests__/SwaggerExplorer.browser.spec.tsx +49 -0
- package/src/swagger/__tests__/SwaggerOperationView.browser.spec.tsx +42 -2
- package/src/swagger/__tests__/SwaggerRequestBuilder.spec.ts +110 -0
- package/src/swagger/__tests__/SwaggerTryIt.browser.spec.tsx +139 -0
- package/src/table/DataTable.tsx +162 -22
- package/src/table/DataTableBody.tsx +179 -80
- package/src/table/DataTableFilterDialog.tsx +5 -5
- package/src/table/DataTableFooter.tsx +3 -3
- package/src/table/DataTableGroupRow.tsx +60 -0
- package/src/table/DataTableHeaderPopupList.tsx +8 -0
- package/src/table/DataTableHeaderRow.tsx +1 -1
- package/src/table/DataTablePresetRail.tsx +12 -2
- package/src/table/DataTablePresetRailButton.tsx +2 -2
- package/src/table/DataTableRowActionGroupItem.tsx +75 -0
- package/src/table/DataTableRowActionItem.tsx +6 -0
- package/src/table/DataTableRowActionsInline.tsx +3 -1
- package/src/table/DataTableRowActionsMenu.tsx +33 -49
- package/src/table/DataTableSummaryCard.tsx +38 -1
- package/src/table/DataTableSummaryPanel.tsx +21 -2
- package/src/table/DataTableToolbar.tsx +4 -4
- package/src/table/PermissionMatrix.tsx +7 -0
- package/src/table/PermissionMatrixGroupRows.tsx +19 -1
- package/src/table/__tests__/DataTableEmptyState.browser.spec.tsx +45 -0
- package/src/table/__tests__/DataTableFilterBar.browser.spec.tsx +12 -0
- package/src/table/__tests__/DataTableFilterOnChange.browser.spec.tsx +89 -0
- package/src/table/__tests__/DataTableGroupBy.browser.spec.tsx +281 -0
- package/src/table/__tests__/DataTableHeaderPopup.browser.spec.tsx +21 -0
- package/src/table/__tests__/DataTablePersistenceStorage.browser.spec.tsx +204 -0
- package/src/table/__tests__/DataTablePresets.browser.spec.tsx +49 -0
- package/src/table/__tests__/DataTableRefreshOnFocus.browser.spec.tsx +128 -0
- package/src/table/__tests__/DataTableRowActionGroup.browser.spec.tsx +118 -1
- package/src/table/__tests__/DataTableScope.browser.spec.tsx +34 -1
- package/src/table/__tests__/DataTableSort.browser.spec.tsx +91 -0
- package/src/table/__tests__/DataTableStatic.browser.spec.tsx +33 -4
- package/src/table/__tests__/paginateLocal.spec.ts +65 -0
- package/src/table/dataTableBaseProps.ts +72 -11
- package/src/table/dataTableFilterFields.ts +17 -0
- package/src/table/dataTablePersistence.ts +118 -32
- package/src/table/dataTableTypes.ts +97 -11
- package/src/table/index.ts +20 -2
- package/src/table/paginateLocal.ts +111 -7
- package/src/table/useDataTableColumns.ts +9 -4
- package/src/table/useDataTableData.ts +59 -29
- package/src/table/useDataTableFilterForm.ts +14 -4
- package/src/table/useDataTableFilterModel.tsx +4 -4
- package/src/table/useDataTableFilterVisibility.ts +20 -7
- package/src/table/useDataTableRefresh.ts +4 -2
- package/src/table/useDataTableSummary.ts +27 -9
- package/src/table/useDataTableWake.ts +77 -0
- package/src/table/useTableSelection.ts +1 -1
- package/src/tree/TreeView.tsx +75 -15
- package/src/tree/TreeViewRow.tsx +62 -42
- package/src/tree/__tests__/TreeViewDrag.browser.spec.tsx +101 -91
- package/src/tree/__tests__/treeModel.spec.ts +25 -0
- package/src/tree/index.ts +4 -9
- package/src/tree/treeModel.ts +38 -1
- package/dist/admin/AdminJobsPayloadDialog.d.ts +0 -19
- package/dist/admin/AdminJobsPayloadDialog.d.ts.map +0 -1
- package/dist/admin/AdminJobsPayloadDialog.js +0 -30
- package/dist/admin/AdminJobsPayloadDialog.js.map +0 -1
- package/dist/tree/TreeViewResizer.d.ts +0 -38
- package/dist/tree/TreeViewResizer.d.ts.map +0 -1
- package/dist/tree/TreeViewResizer.js +0 -72
- package/dist/tree/TreeViewResizer.js.map +0 -1
- package/src/admin/AdminJobsPayloadDialog.tsx +0 -57
- package/src/admin/__tests__/AdminJobsPayloadDialog.browser.spec.tsx +0 -67
- package/src/tree/TreeViewResizer.tsx +0 -83
- package/src/tree/__tests__/TreeViewResizer.browser.spec.tsx +0 -112
- /package/src/shell/__tests__/{AppActions.browser.spec.tsx → ButtonUserAccountMenuItem.browser.spec.tsx} +0 -0
package/dist/tree/TreeView.d.ts
CHANGED
|
@@ -4,10 +4,6 @@ import { type TreeSelectOptions } from "./TreeViewRow.tsx";
|
|
|
4
4
|
/**
|
|
5
5
|
* A controlled tree: rows in, gestures out.
|
|
6
6
|
*
|
|
7
|
-
* ⚠️ This file is the DECLARATION only. The core lands in #Q1939, drag and
|
|
8
|
-
* drop in #Q1940, rename and the menu slot in #Q1941. Every prop below says
|
|
9
|
-
* which quest implements it.
|
|
10
|
-
*
|
|
11
7
|
* ## The contract, and why it is this one
|
|
12
8
|
*
|
|
13
9
|
* `TreeView` owns the row markup, the indent geometry and the memo. A
|
|
@@ -119,7 +115,10 @@ export interface TreeViewProps<T = undefined> {
|
|
|
119
115
|
*/
|
|
120
116
|
dragId?: string;
|
|
121
117
|
/**
|
|
122
|
-
*
|
|
118
|
+
* The row the pointer is over during a drag (or {@link TREE_ROOT_ID}), as
|
|
119
|
+
* `onDragOver` reported it. The tree highlights the FOLDER it targets,
|
|
120
|
+
* as a file manager does: the branch itself, or a leaf's parent, and all
|
|
121
|
+
* of that folder's rows. #Q1940.
|
|
123
122
|
*/
|
|
124
123
|
drop?: {
|
|
125
124
|
id: string;
|
|
@@ -130,9 +129,10 @@ export interface TreeViewProps<T = undefined> {
|
|
|
130
129
|
*/
|
|
131
130
|
onDragStart?: (id: string) => void;
|
|
132
131
|
/**
|
|
133
|
-
* The pointer is over this row
|
|
134
|
-
*
|
|
135
|
-
*
|
|
132
|
+
* The pointer is over this row: `inside` on a branch, `before` on a leaf,
|
|
133
|
+
* which `resolveDrop` reads as "into the folder that holds it". The tree is
|
|
134
|
+
* sorted by its comparator, so there is no place BETWEEN two rows to drop
|
|
135
|
+
* on: the 28/44/28 zones and their before / after lines promised one. #Q1940.
|
|
136
136
|
*/
|
|
137
137
|
onDragOver?: (id: string, position: TreeDropPosition) => void;
|
|
138
138
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeView.d.ts","sourceRoot":"","sources":["../../src/tree/TreeView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"TreeView.d.ts","sourceRoot":"","sources":["../../src/tree/TreeView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAGf,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACb,KAAK,OAAO,EACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,iBAAiB,EAGvB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,SAAS;IAC1C;;;OAGG;IACH,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IACnB;;;;OAIG;IACH,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC/B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC;;;;;OAKG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACnE;;;OAGG;IACH,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B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B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC;IAE9C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAU,aAAa,CAAC,CAAC,CAAC,KAAG,YA6PtD,CAAC"}
|
package/dist/tree/TreeView.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { inlineArrowKey } from "../core/inlineArrowKey.js";
|
|
2
|
+
import "./treeModel.js";
|
|
2
3
|
import { TreeViewRow } from "./TreeViewRow.js";
|
|
3
|
-
import { useMemo, useRef, useState } from "react";
|
|
4
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
6
|
// src/tree/TreeView.tsx
|
|
6
7
|
/**
|
|
@@ -51,9 +52,8 @@ const TreeView = (props) => {
|
|
|
51
52
|
* The keyboard contract `role="tree"` claims, on the flat list of rows:
|
|
52
53
|
* Up and Down move one row, Home and End to the ends, Right opens a closed
|
|
53
54
|
* branch or steps into an open one, Left closes an open branch or steps
|
|
54
|
-
* out to the parent. Enter and Space stay the row's own (select).
|
|
55
|
-
*
|
|
56
|
-
* Arrows are read as `dir="ltr"`: right-to-left is a later epic's.
|
|
55
|
+
* out to the parent. Enter and Space stay the row's own (select). On a
|
|
56
|
+
* right-to-left page Right and Left swap (`inlineArrowKey`).
|
|
57
57
|
*/
|
|
58
58
|
const onKeyDown = (e) => {
|
|
59
59
|
const target = e.target;
|
|
@@ -150,11 +150,68 @@ const TreeView = (props) => {
|
|
|
150
150
|
walk(dragged);
|
|
151
151
|
return ids;
|
|
152
152
|
}, [props.dragId, props.rows]);
|
|
153
|
+
/**
|
|
154
|
+
* Where a drop over each row would land, and whether it means anything.
|
|
155
|
+
*
|
|
156
|
+
* A row's folder is the branch itself or a leaf's parent (`null` for the
|
|
157
|
+
* root). A drop there is REFUSED (no highlight, the "no drop" cursor) when
|
|
158
|
+
* it is the dragged node's own folder, since a sorted tree would put it
|
|
159
|
+
* back where it was, or inside the dragged branch's subtree.
|
|
160
|
+
*/
|
|
161
|
+
const drag = useMemo(() => {
|
|
162
|
+
const byId = new Map(props.rows.map((row) => [row.node.id, row.node]));
|
|
163
|
+
const dragged = props.dragId === void 0 ? void 0 : byId.get(props.dragId);
|
|
164
|
+
const draggedParent = dragged ? dragged.declaredParentId ?? dragged.parentId ?? null : void 0;
|
|
165
|
+
const containerOf = (id) => {
|
|
166
|
+
if (id === "__tree-root__") return null;
|
|
167
|
+
const node = byId.get(id);
|
|
168
|
+
if (!node) return void 0;
|
|
169
|
+
return node.branch ? node.id : node.parentId ?? null;
|
|
170
|
+
};
|
|
171
|
+
const allows = (container) => dragged !== void 0 && container !== void 0 && container !== draggedParent && (container === null || !forbidden.has(container));
|
|
172
|
+
return {
|
|
173
|
+
byId,
|
|
174
|
+
containerOf,
|
|
175
|
+
allows
|
|
176
|
+
};
|
|
177
|
+
}, [
|
|
178
|
+
props.dragId,
|
|
179
|
+
props.rows,
|
|
180
|
+
forbidden
|
|
181
|
+
]);
|
|
182
|
+
const target = props.drop ? drag.containerOf(props.drop.id) : void 0;
|
|
183
|
+
const targetAllowed = drag.allows(target);
|
|
184
|
+
const block = useMemo(() => {
|
|
185
|
+
const ids = /* @__PURE__ */ new Set();
|
|
186
|
+
if (!targetAllowed || typeof target !== "string") return ids;
|
|
187
|
+
const walk = (node) => {
|
|
188
|
+
ids.add(node.id);
|
|
189
|
+
for (const child of node.children ?? []) walk(child);
|
|
190
|
+
};
|
|
191
|
+
const folder = drag.byId.get(target);
|
|
192
|
+
if (folder) walk(folder);
|
|
193
|
+
return ids;
|
|
194
|
+
}, [
|
|
195
|
+
target,
|
|
196
|
+
targetAllowed,
|
|
197
|
+
drag
|
|
198
|
+
]);
|
|
199
|
+
const hoveredClosed = targetAllowed && typeof target === "string" && props.drop?.id === target && props.collapsed.has(target);
|
|
200
|
+
useEffect(() => {
|
|
201
|
+
if (!hoveredClosed || typeof target !== "string") return;
|
|
202
|
+
const timer = setTimeout(() => facade.toggle(target), 600);
|
|
203
|
+
return () => clearTimeout(timer);
|
|
204
|
+
}, [
|
|
205
|
+
hoveredClosed,
|
|
206
|
+
target,
|
|
207
|
+
facade
|
|
208
|
+
]);
|
|
153
209
|
return /* @__PURE__ */ jsx("div", {
|
|
154
210
|
role: "tree",
|
|
155
211
|
"aria-label": props.label,
|
|
156
212
|
"aria-multiselectable": props.selectedIds ? true : void 0,
|
|
157
213
|
className: props.className,
|
|
214
|
+
"data-drop-root": targetAllowed && target === null ? "" : void 0,
|
|
158
215
|
onKeyDown,
|
|
159
216
|
children: props.rows.map((row) => /* @__PURE__ */ jsx(TreeViewRow, {
|
|
160
217
|
node: row.node,
|
|
@@ -166,8 +223,8 @@ const TreeView = (props) => {
|
|
|
166
223
|
isDragging: props.dragId === row.node.id,
|
|
167
224
|
isDraggable: props.draggable === true,
|
|
168
225
|
isDragActive,
|
|
169
|
-
|
|
170
|
-
|
|
226
|
+
dropAllowed: drag.allows(drag.containerOf(row.node.id)),
|
|
227
|
+
inDropBlock: block.has(row.node.id),
|
|
171
228
|
hasMenu: props.renderMenu !== void 0,
|
|
172
229
|
isTabStop: row.node.id === tabStopId
|
|
173
230
|
}, row.node.id))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeView.js","names":[],"sources":["../../src/tree/TreeView.tsx"],"sourcesContent":["import {\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n useMemo,\n useRef,\n useState,\n} from \"react\";\n\nimport { inlineArrowKey } from \"../core/inlineArrowKey.ts\";\nimport {\n type TreeDropPosition,\n type TreeNode,\n type TreeRow,\n} from \"./treeModel.ts\";\nimport {\n type TreeSelectOptions,\n type TreeViewFacade,\n TreeViewRow,\n} from \"./TreeViewRow.tsx\";\n\n/**\n * A controlled tree: rows in, gestures out.\n *\n * ⚠️ This file is the DECLARATION only. The core lands in #Q1939, drag and\n * drop in #Q1940, rename and the menu slot in #Q1941. Every prop below says\n * which quest implements it.\n *\n * ## The contract, and why it is this one\n *\n * `TreeView` owns the row markup, the indent geometry and the memo. A\n * consumer supplies **render slots** (`renderIcon`, `renderLabel`,\n * `renderTrailing`, `renderMenu`) and turns capabilities on with flags.\n *\n * Render **functions** rather than `ReactNode`s carried on the node, for two\n * measured reasons. Lore's folder icon and the docs tree's folder icon both\n * need the row's collapsed state, which is row state and not node data. And\n * an element built per render changes identity every render, which is\n * exactly what defeats the row memo, while a function called inside the row\n * keeps every row prop a primitive, a memoised node, or a stable function.\n *\n * Stable **by construction**: `TreeView` wraps every callback and render prop\n * into one `useRef`-backed facade (the `implRef` pattern from Lore's\n * `useFolioTreeModel`) and hands rows that. A consumer passing inline arrows\n * still gets a memo that holds, and nobody has to rediscover `useCallback`\n * discipline.\n *\n * A `renderRow` escape hatch was considered and rejected: it hands out the\n * indent geometry and the memo contract, the two things that took the most\n * work and are easiest to break from outside.\n *\n * ## Two constraints for the docs tree, without declaring anything docs-only\n *\n * The label is its **own element**, separate from the row's click handler and\n * from the disclosure button, so rendering it as an anchor one day is a local\n * change rather than a rewrite of the row. `getHref` is deliberately NOT\n * declared: nothing in this epic implements it, and a declared prop that does\n * nothing is a lie in a types file.\n *\n * ARIA tree roles are built into the core (#Q1939) rather than opted into,\n * because they cost nothing and every consumer gains them.\n */\n\n/**\n * What a row knows about itself, handed to every render slot so a consumer\n * can draw a different icon for an open folder, dim a row being dragged, and\n * so on. None of this is node data, which is why the slots are functions of\n * two arguments.\n */\nexport interface TreeRowState {\n collapsed: boolean;\n selected: boolean;\n renaming: boolean;\n dragging: boolean;\n}\n\nexport interface TreeViewProps<T = undefined> {\n /**\n * The visible rows, from `flattenTree(nodes, collapsed)`. The tree renders\n * exactly these, in order: it does no filtering of its own.\n */\n rows: TreeRow<T>[];\n /**\n * Ids of the collapsed branches. Controlled, and the same set `rows` was\n * flattened against; the tree reads it to draw the disclosure and to\n * populate {@link TreeRowState.collapsed}.\n */\n collapsed: ReadonlySet<string>;\n /**\n * The selected row, if any. Selection is a prop pair and NOT hook state,\n * on purpose: Lore derives it from the URL, the docs tree will too, and\n * the showcase keeps a `useState` (see #Q1942).\n */\n selectedId?: string;\n /**\n * More selected rows, drawn as selected beside {@link selectedId}: a\n * range picked with shift (#Q3654). Like `selectedId`, the consumer owns\n * it; the tree only reports the shift on {@link onSelect}. Setting it\n * marks the tree `aria-multiselectable`.\n */\n selectedIds?: ReadonlySet<string>;\n /**\n * A row was activated: a plain click, or Enter / Space on a focused row.\n * ⚠️ A real double click fires click, click, dblclick, so the row guards\n * on `e.detail > 1` and this fires once per burst (#Q1939). `options.shift`\n * says Shift was held, for a tree that selects a range.\n */\n onSelect: (node: TreeNode<T>, options?: TreeSelectOptions) => void;\n /**\n * The disclosure of a branch row was clicked. The consumer owns the\n * collapsed set, so the tree reports rather than resolves.\n */\n onToggle: (id: string) => void;\n /**\n * The leading glyph. Colour it here: the tree paints only `--border`,\n * `--primary` and `--muted`, never a palette of its own (#Q1939).\n */\n renderIcon?: (node: TreeNode<T>, state: TreeRowState) => ReactNode;\n /**\n * Defaults to `node.name`. The docs tree will put its dim `.md` suffix\n * here, which a trailing slot cannot do: trailing lands at the far right\n * after `flex-1`, and the suffix belongs against the name.\n */\n renderLabel?: (node: TreeNode<T>, state: TreeRowState) => ReactNode;\n /**\n * The far right of the row, after the label takes its `flex-1`. Lore's pin\n * badge, a count, a hover affordance.\n */\n renderTrailing?: (node: TreeNode<T>, state: TreeRowState) => ReactNode;\n\n // Drag and drop, #Q1940. Off unless `draggable` is set: a read-only tree\n // must not pay a byte of handler for it.\n\n /**\n * Turn native HTML5 drag and drop on. #Q1940.\n */\n draggable?: boolean;\n /**\n * The row currently being dragged, if any. The tree also derives \"any row\n * of this tree is being dragged\" from it, which is a different question\n * from \"this row is being dragged\" and cannot be answered by the row.\n * #Q1940.\n */\n dragId?: string;\n /**\n * Where the drop marker is drawn right now. #Q1940.\n */\n drop?: { id: string; position: TreeDropPosition };\n /**\n * A drag started on this row. #Q1940.\n */\n onDragStart?: (id: string) => void;\n /**\n * The pointer is over this row, in this zone. A branch splits 28/44/28\n * into before / inside / after; a leaf splits 50/50 with no inside area.\n * #Q1940.\n */\n onDragOver?: (id: string, position: TreeDropPosition) => void;\n /**\n * A drop landed on this row. The tree resolves nothing: the consumer calls\n * `resolveDrop` itself, because only it knows whether the resulting parent\n * change is legal in its own domain. #Q1940.\n */\n onDrop?: (id: string) => void;\n /**\n * Files from the operating system were dropped on a row. Without it a file\n * drag is refused, as it always was. With it the row accepts the drag\n * (`dropEffect: \"copy\"`) and hands the files over with the row's id: a\n * consumer decides what a file landing on a leaf means (its parent, say).\n */\n onFilesDrop?: (id: string, files: File[]) => void;\n /**\n * The drag ended, dropped or cancelled. #Q1940.\n */\n onDragEnd?: () => void;\n\n // Rename and the menu slot, #Q1941.\n\n /**\n * The row showing an inline rename input, if any. The tree owns the draft\n * string; the consumer owns what a committed name means. #Q1941.\n */\n renamingId?: string;\n /**\n * Enter, or a blur that is not an Escape. #Q1941.\n */\n onCommitRename?: (id: string, name: string) => void;\n /**\n * Escape. ⚠️ Removing a focused element from the DOM can still fire\n * `blur` in some browsers, so the row guards the commit rather than\n * trusting the ordering. #Q1941.\n */\n onCancelRename?: () => void;\n /**\n * The context menu's content. Provided, the tree wraps each row in\n * `ContextMenu` / `ContextMenuTrigger`; omitted, it wraps nothing. The\n * verbs are the consumer's: Lore keeps its own 170-line menu and passes it\n * through here. #Q1941.\n */\n renderMenu?: (node: TreeNode<T>) => ReactNode;\n\n /**\n * Spoken name of the tree, for `role=\"tree\"`. #Q1939.\n */\n label?: string;\n className?: string;\n}\n\n/**\n * The controlled tree.\n *\n * Everything is a prop: `rows` (from `flattenTree`), the collapsed set, the\n * selection, and the render slots. The component owns the row markup, the\n * indent geometry, the ARIA structure and the memo, and nothing else.\n *\n * ```tsx\n * <TreeView\n * rows={flattenTree(nodes, collapsed)}\n * collapsed={collapsed}\n * selectedId={openId}\n * onSelect={(node) => open(node.id)}\n * onToggle={toggle}\n * label=\"Files\"\n * />\n * ```\n */\nexport const TreeView = <T,>(props: TreeViewProps<T>): ReactElement => {\n /**\n * The current props, read through a ref so the facade below can be held\n * forever and still call this render's implementation.\n *\n * Assigned during render on purpose: an effect would leave one render's\n * worth of rows calling last render's callbacks, which is exactly the\n * stale-closure bug the facade exists to avoid.\n */\n const implRef = useRef<TreeViewProps<T>>(props);\n implRef.current = props;\n\n /**\n * The same slots behind an object whose identity NEVER changes.\n *\n * This is what makes `memo(TreeViewRow)` worth anything, and it is built\n * HERE rather than asked of the consumer: a showcase or an app passing\n * inline arrows would otherwise defeat the memo on its first day, and the\n * failure is invisible (nothing goes red, the tree just re-renders every\n * row on every toggle).\n */\n /**\n * The row that last took the focus: the tree's one tab stop. Falls back to\n * the selected row, then the first, when it is gone or was never set.\n */\n const [focusedId, setFocusedId] = useState<string>();\n const tabStopId =\n (focusedId !== undefined &&\n props.rows.some((row) => row.node.id === focusedId) &&\n focusedId) ||\n (props.selectedId !== undefined &&\n props.rows.some((row) => row.node.id === props.selectedId) &&\n props.selectedId) ||\n props.rows[0]?.node.id;\n\n /**\n * The keyboard contract `role=\"tree\"` claims, on the flat list of rows:\n * Up and Down move one row, Home and End to the ends, Right opens a closed\n * branch or steps into an open one, Left closes an open branch or steps\n * out to the parent. Enter and Space stay the row's own (select).\n *\n * Arrows are read as `dir=\"ltr\"`: right-to-left is a later epic's.\n */\n const onKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {\n const target = e.target as HTMLElement;\n if (target.getAttribute(\"role\") !== \"treeitem\") return;\n const elements = [\n ...e.currentTarget.querySelectorAll<HTMLElement>(\n '[data-slot=\"tree-view-row\"]',\n ),\n ];\n const index = elements.indexOf(target);\n const row = props.rows[index];\n if (!row) return;\n const isOpenBranch =\n row.node.branch === true && !props.collapsed.has(row.node.id);\n let next: number | undefined;\n // Right opens and steps in, Left closes and steps out: swapped on a\n // right-to-left page, where a branch's children sit to its left.\n switch (inlineArrowKey(e)) {\n case \"ArrowDown\":\n next = index + 1;\n break;\n case \"ArrowUp\":\n next = index - 1;\n break;\n case \"Home\":\n next = 0;\n break;\n case \"End\":\n next = elements.length - 1;\n break;\n case \"ArrowRight\":\n if (row.node.branch && !isOpenBranch) {\n e.preventDefault();\n facade.toggle(row.node.id);\n return;\n }\n if (isOpenBranch && (props.rows[index + 1]?.depth ?? -1) > row.depth) {\n next = index + 1;\n }\n break;\n case \"ArrowLeft\":\n if (isOpenBranch) {\n e.preventDefault();\n facade.toggle(row.node.id);\n return;\n }\n for (let i = index - 1; i >= 0; i--) {\n if (props.rows[i]!.depth < row.depth) {\n next = i;\n break;\n }\n }\n break;\n default:\n return;\n }\n e.preventDefault();\n if (next !== undefined) elements[next]?.focus();\n };\n\n const facade = useMemo<TreeViewFacade<T>>(\n () => ({\n select: (node, options) => implRef.current.onSelect(node, options),\n toggle: (id) => implRef.current.onToggle(id),\n renderIcon: (node, state) => implRef.current.renderIcon?.(node, state),\n renderLabel: (node, state) =>\n implRef.current.renderLabel?.(node, state) ?? node.name,\n renderTrailing: (node, state) =>\n implRef.current.renderTrailing?.(node, state),\n onDragStart: (id) => implRef.current.onDragStart?.(id),\n onDragOver: (id, position) => implRef.current.onDragOver?.(id, position),\n onDrop: (id) => implRef.current.onDrop?.(id),\n acceptsFiles: () => implRef.current.onFilesDrop !== undefined,\n onFilesDrop: (id, files) => implRef.current.onFilesDrop?.(id, files),\n onDragEnd: () => implRef.current.onDragEnd?.(),\n commitRename: (id, name) => implRef.current.onCommitRename?.(id, name),\n cancelRename: () => implRef.current.onCancelRename?.(),\n renderMenu: (node) => implRef.current.renderMenu?.(node),\n focus: (id) => setFocusedId(id),\n }),\n [],\n );\n\n /**\n * Whether ANY row of this tree is being dragged.\n *\n * ⚠️ A different question from \"this row is being dragged\", and it has to be\n * answered here rather than in a row: a row can compare its own id, but only\n * the tree knows whether the drag exists at all.\n */\n const isDragActive = props.dragId !== undefined;\n\n /**\n * The dragged node and everything beneath it.\n *\n * ⚠️ The one legality question this component answers on its own, and it\n * has to: dropping a branch inside its own subtree would orphan the branch,\n * which is a fact about the TREE and not about the consumer's domain. The\n * consumer's `resolveDrop` refuses such a drop at the end anyway, so without\n * this the row would light up promising a move that never happens.\n *\n * Computed once per render as a SET rather than asking `nodeHolds` per row,\n * so a drag over a large tree stays one walk of the dragged subtree.\n */\n const forbidden = useMemo(() => {\n const ids = new Set<string>();\n if (props.dragId === undefined) return ids;\n const dragged = props.rows.find(\n (row) => row.node.id === props.dragId,\n )?.node;\n if (!dragged) return ids;\n const walk = (node: TreeNode<T>): void => {\n ids.add(node.id);\n for (const child of node.children ?? []) walk(child);\n };\n walk(dragged);\n return ids;\n }, [props.dragId, props.rows]);\n\n return (\n // oxlint-disable-next-line jsx-a11y/interactive-supports-focus -- a roving tab stop: the rows take the focus, the tree only hears their arrow keys\n <div\n role=\"tree\"\n aria-label={props.label}\n aria-multiselectable={props.selectedIds ? true : undefined}\n className={props.className}\n onKeyDown={onKeyDown}\n >\n {props.rows.map((row) => (\n <TreeViewRow\n key={row.node.id}\n node={row.node}\n depth={row.depth}\n facade={facade}\n isCollapsed={props.collapsed.has(row.node.id)}\n isSelected={\n props.selectedId === row.node.id ||\n props.selectedIds?.has(row.node.id) === true\n }\n isRenaming={props.renamingId === row.node.id}\n isDragging={props.dragId === row.node.id}\n isDraggable={props.draggable === true}\n isDragActive={isDragActive}\n isDropForbidden={forbidden.has(row.node.id)}\n dropHere={\n props.drop?.id === row.node.id ? props.drop.position : undefined\n }\n hasMenu={props.renderMenu !== undefined}\n isTabStop={row.node.id === tabStopId}\n />\n ))}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkOA,MAAa,YAAgB,UAA0C;;;;;;;;;CASrE,MAAM,UAAU,OAAyB,KAAK;CAC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AK,MAAM,SAAS,KAAK,YAAY,CAAC,GAAG,KAAK,KAAK;EACrD;EACA,KAAK,OAAO;EACZ,OAAO;CACT,GAAG,CAAC,MAAM,QAAQ,MAAM,IAAI,CAAC;CAE7B,OAEE,oBAAC,OAAD;EACE,MAAK;EACL,cAAY,MAAM;EAClB,wBAAsB,MAAM,cAAc,OAAO,KAAA;EACjD,WAAW,MAAM;EACN;EAEV,UAAA,MAAM,KAAK,KAAK,QACf,oBAAC,aAAD;GAEE,MAAM,IAAI;GACV,OAAO,IAAI;GACH;GACR,aAAa,MAAM,UAAU,IAAI,IAAI,KAAK,EAAE;GAC5C,YACE,MAAM,eAAe,IAAI,KAAK,MAC9B,MAAM,aAAa,IAAI,IAAI,KAAK,EAAE,MAAM;GAE1C,YAAY,MAAM,eAAe,IAAI,KAAK;GAC1C,YAAY,MAAM,WAAW,IAAI,KAAK;GACtC,aAAa,MAAM,cAAc;GACnB;GACd,iBAAiB,UAAU,IAAI,IAAI,KAAK,EAAE;GAC1C,UACE,MAAM,MAAM,OAAO,IAAI,KAAK,KAAK,MAAM,KAAK,WAAW,KAAA;GAEzD,SAAS,MAAM,eAAe,KAAA;GAC9B,WAAW,IAAI,KAAK,OAAO;EAC5B,GAnBM,IAAI,KAAK,EAmBf,CACF;CACE,CAAA;AAET"}
|
|
1
|
+
{"version":3,"file":"TreeView.js","names":[],"sources":["../../src/tree/TreeView.tsx"],"sourcesContent":["import {\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\n\nimport { inlineArrowKey } from \"../core/inlineArrowKey.ts\";\nimport {\n TREE_ROOT_ID,\n type TreeDropPosition,\n type TreeNode,\n type TreeRow,\n} from \"./treeModel.ts\";\nimport {\n type TreeSelectOptions,\n type TreeViewFacade,\n TreeViewRow,\n} from \"./TreeViewRow.tsx\";\n\n/**\n * A controlled tree: rows in, gestures out.\n *\n * ## The contract, and why it is this one\n *\n * `TreeView` owns the row markup, the indent geometry and the memo. A\n * consumer supplies **render slots** (`renderIcon`, `renderLabel`,\n * `renderTrailing`, `renderMenu`) and turns capabilities on with flags.\n *\n * Render **functions** rather than `ReactNode`s carried on the node, for two\n * measured reasons. Lore's folder icon and the docs tree's folder icon both\n * need the row's collapsed state, which is row state and not node data. And\n * an element built per render changes identity every render, which is\n * exactly what defeats the row memo, while a function called inside the row\n * keeps every row prop a primitive, a memoised node, or a stable function.\n *\n * Stable **by construction**: `TreeView` wraps every callback and render prop\n * into one `useRef`-backed facade (the `implRef` pattern from Lore's\n * `useFolioTreeModel`) and hands rows that. A consumer passing inline arrows\n * still gets a memo that holds, and nobody has to rediscover `useCallback`\n * discipline.\n *\n * A `renderRow` escape hatch was considered and rejected: it hands out the\n * indent geometry and the memo contract, the two things that took the most\n * work and are easiest to break from outside.\n *\n * ## Two constraints for the docs tree, without declaring anything docs-only\n *\n * The label is its **own element**, separate from the row's click handler and\n * from the disclosure button, so rendering it as an anchor one day is a local\n * change rather than a rewrite of the row. `getHref` is deliberately NOT\n * declared: nothing in this epic implements it, and a declared prop that does\n * nothing is a lie in a types file.\n *\n * ARIA tree roles are built into the core (#Q1939) rather than opted into,\n * because they cost nothing and every consumer gains them.\n */\n\n/**\n * What a row knows about itself, handed to every render slot so a consumer\n * can draw a different icon for an open folder, dim a row being dragged, and\n * so on. None of this is node data, which is why the slots are functions of\n * two arguments.\n */\nexport interface TreeRowState {\n collapsed: boolean;\n selected: boolean;\n renaming: boolean;\n dragging: boolean;\n}\n\nexport interface TreeViewProps<T = undefined> {\n /**\n * The visible rows, from `flattenTree(nodes, collapsed)`. The tree renders\n * exactly these, in order: it does no filtering of its own.\n */\n rows: TreeRow<T>[];\n /**\n * Ids of the collapsed branches. Controlled, and the same set `rows` was\n * flattened against; the tree reads it to draw the disclosure and to\n * populate {@link TreeRowState.collapsed}.\n */\n collapsed: ReadonlySet<string>;\n /**\n * The selected row, if any. Selection is a prop pair and NOT hook state,\n * on purpose: Lore derives it from the URL, the docs tree will too, and\n * the showcase keeps a `useState` (see #Q1942).\n */\n selectedId?: string;\n /**\n * More selected rows, drawn as selected beside {@link selectedId}: a\n * range picked with shift (#Q3654). Like `selectedId`, the consumer owns\n * it; the tree only reports the shift on {@link onSelect}. Setting it\n * marks the tree `aria-multiselectable`.\n */\n selectedIds?: ReadonlySet<string>;\n /**\n * A row was activated: a plain click, or Enter / Space on a focused row.\n * ⚠️ A real double click fires click, click, dblclick, so the row guards\n * on `e.detail > 1` and this fires once per burst (#Q1939). `options.shift`\n * says Shift was held, for a tree that selects a range.\n */\n onSelect: (node: TreeNode<T>, options?: TreeSelectOptions) => void;\n /**\n * The disclosure of a branch row was clicked. The consumer owns the\n * collapsed set, so the tree reports rather than resolves.\n */\n onToggle: (id: string) => void;\n /**\n * The leading glyph. Colour it here: the tree paints only `--border`,\n * `--primary` and `--muted`, never a palette of its own (#Q1939).\n */\n renderIcon?: (node: TreeNode<T>, state: TreeRowState) => ReactNode;\n /**\n * Defaults to `node.name`. The docs tree will put its dim `.md` suffix\n * here, which a trailing slot cannot do: trailing lands at the far right\n * after `flex-1`, and the suffix belongs against the name.\n */\n renderLabel?: (node: TreeNode<T>, state: TreeRowState) => ReactNode;\n /**\n * The far right of the row, after the label takes its `flex-1`. Lore's pin\n * badge, a count, a hover affordance.\n */\n renderTrailing?: (node: TreeNode<T>, state: TreeRowState) => ReactNode;\n\n // Drag and drop, #Q1940. Off unless `draggable` is set: a read-only tree\n // must not pay a byte of handler for it.\n\n /**\n * Turn native HTML5 drag and drop on. #Q1940.\n */\n draggable?: boolean;\n /**\n * The row currently being dragged, if any. The tree also derives \"any row\n * of this tree is being dragged\" from it, which is a different question\n * from \"this row is being dragged\" and cannot be answered by the row.\n * #Q1940.\n */\n dragId?: string;\n /**\n * The row the pointer is over during a drag (or {@link TREE_ROOT_ID}), as\n * `onDragOver` reported it. The tree highlights the FOLDER it targets,\n * as a file manager does: the branch itself, or a leaf's parent, and all\n * of that folder's rows. #Q1940.\n */\n drop?: { id: string; position: TreeDropPosition };\n /**\n * A drag started on this row. #Q1940.\n */\n onDragStart?: (id: string) => void;\n /**\n * The pointer is over this row: `inside` on a branch, `before` on a leaf,\n * which `resolveDrop` reads as \"into the folder that holds it\". The tree is\n * sorted by its comparator, so there is no place BETWEEN two rows to drop\n * on: the 28/44/28 zones and their before / after lines promised one. #Q1940.\n */\n onDragOver?: (id: string, position: TreeDropPosition) => void;\n /**\n * A drop landed on this row. The tree resolves nothing: the consumer calls\n * `resolveDrop` itself, because only it knows whether the resulting parent\n * change is legal in its own domain. #Q1940.\n */\n onDrop?: (id: string) => void;\n /**\n * Files from the operating system were dropped on a row. Without it a file\n * drag is refused, as it always was. With it the row accepts the drag\n * (`dropEffect: \"copy\"`) and hands the files over with the row's id: a\n * consumer decides what a file landing on a leaf means (its parent, say).\n */\n onFilesDrop?: (id: string, files: File[]) => void;\n /**\n * The drag ended, dropped or cancelled. #Q1940.\n */\n onDragEnd?: () => void;\n\n // Rename and the menu slot, #Q1941.\n\n /**\n * The row showing an inline rename input, if any. The tree owns the draft\n * string; the consumer owns what a committed name means. #Q1941.\n */\n renamingId?: string;\n /**\n * Enter, or a blur that is not an Escape. #Q1941.\n */\n onCommitRename?: (id: string, name: string) => void;\n /**\n * Escape. ⚠️ Removing a focused element from the DOM can still fire\n * `blur` in some browsers, so the row guards the commit rather than\n * trusting the ordering. #Q1941.\n */\n onCancelRename?: () => void;\n /**\n * The context menu's content. Provided, the tree wraps each row in\n * `ContextMenu` / `ContextMenuTrigger`; omitted, it wraps nothing. The\n * verbs are the consumer's: Lore keeps its own 170-line menu and passes it\n * through here. #Q1941.\n */\n renderMenu?: (node: TreeNode<T>) => ReactNode;\n\n /**\n * Spoken name of the tree, for `role=\"tree\"`. #Q1939.\n */\n label?: string;\n className?: string;\n}\n\n/**\n * The controlled tree.\n *\n * Everything is a prop: `rows` (from `flattenTree`), the collapsed set, the\n * selection, and the render slots. The component owns the row markup, the\n * indent geometry, the ARIA structure and the memo, and nothing else.\n *\n * ```tsx\n * <TreeView\n * rows={flattenTree(nodes, collapsed)}\n * collapsed={collapsed}\n * selectedId={openId}\n * onSelect={(node) => open(node.id)}\n * onToggle={toggle}\n * label=\"Files\"\n * />\n * ```\n */\nexport const TreeView = <T,>(props: TreeViewProps<T>): ReactElement => {\n /**\n * The current props, read through a ref so the facade below can be held\n * forever and still call this render's implementation.\n *\n * Assigned during render on purpose: an effect would leave one render's\n * worth of rows calling last render's callbacks, which is exactly the\n * stale-closure bug the facade exists to avoid.\n */\n const implRef = useRef<TreeViewProps<T>>(props);\n implRef.current = props;\n\n /**\n * The same slots behind an object whose identity NEVER changes.\n *\n * This is what makes `memo(TreeViewRow)` worth anything, and it is built\n * HERE rather than asked of the consumer: a showcase or an app passing\n * inline arrows would otherwise defeat the memo on its first day, and the\n * failure is invisible (nothing goes red, the tree just re-renders every\n * row on every toggle).\n */\n /**\n * The row that last took the focus: the tree's one tab stop. Falls back to\n * the selected row, then the first, when it is gone or was never set.\n */\n const [focusedId, setFocusedId] = useState<string>();\n const tabStopId =\n (focusedId !== undefined &&\n props.rows.some((row) => row.node.id === focusedId) &&\n focusedId) ||\n (props.selectedId !== undefined &&\n props.rows.some((row) => row.node.id === props.selectedId) &&\n props.selectedId) ||\n props.rows[0]?.node.id;\n\n /**\n * The keyboard contract `role=\"tree\"` claims, on the flat list of rows:\n * Up and Down move one row, Home and End to the ends, Right opens a closed\n * branch or steps into an open one, Left closes an open branch or steps\n * out to the parent. Enter and Space stay the row's own (select). On a\n * right-to-left page Right and Left swap (`inlineArrowKey`).\n */\n const onKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {\n const target = e.target as HTMLElement;\n if (target.getAttribute(\"role\") !== \"treeitem\") return;\n const elements = [\n ...e.currentTarget.querySelectorAll<HTMLElement>(\n '[data-slot=\"tree-view-row\"]',\n ),\n ];\n const index = elements.indexOf(target);\n const row = props.rows[index];\n if (!row) return;\n const isOpenBranch =\n row.node.branch === true && !props.collapsed.has(row.node.id);\n let next: number | undefined;\n // Right opens and steps in, Left closes and steps out: swapped on a\n // right-to-left page, where a branch's children sit to its left.\n switch (inlineArrowKey(e)) {\n case \"ArrowDown\":\n next = index + 1;\n break;\n case \"ArrowUp\":\n next = index - 1;\n break;\n case \"Home\":\n next = 0;\n break;\n case \"End\":\n next = elements.length - 1;\n break;\n case \"ArrowRight\":\n if (row.node.branch && !isOpenBranch) {\n e.preventDefault();\n facade.toggle(row.node.id);\n return;\n }\n if (isOpenBranch && (props.rows[index + 1]?.depth ?? -1) > row.depth) {\n next = index + 1;\n }\n break;\n case \"ArrowLeft\":\n if (isOpenBranch) {\n e.preventDefault();\n facade.toggle(row.node.id);\n return;\n }\n for (let i = index - 1; i >= 0; i--) {\n if (props.rows[i]!.depth < row.depth) {\n next = i;\n break;\n }\n }\n break;\n default:\n return;\n }\n e.preventDefault();\n if (next !== undefined) elements[next]?.focus();\n };\n\n const facade = useMemo<TreeViewFacade<T>>(\n () => ({\n select: (node, options) => implRef.current.onSelect(node, options),\n toggle: (id) => implRef.current.onToggle(id),\n renderIcon: (node, state) => implRef.current.renderIcon?.(node, state),\n renderLabel: (node, state) =>\n implRef.current.renderLabel?.(node, state) ?? node.name,\n renderTrailing: (node, state) =>\n implRef.current.renderTrailing?.(node, state),\n onDragStart: (id) => implRef.current.onDragStart?.(id),\n onDragOver: (id, position) => implRef.current.onDragOver?.(id, position),\n onDrop: (id) => implRef.current.onDrop?.(id),\n acceptsFiles: () => implRef.current.onFilesDrop !== undefined,\n onFilesDrop: (id, files) => implRef.current.onFilesDrop?.(id, files),\n onDragEnd: () => implRef.current.onDragEnd?.(),\n commitRename: (id, name) => implRef.current.onCommitRename?.(id, name),\n cancelRename: () => implRef.current.onCancelRename?.(),\n renderMenu: (node) => implRef.current.renderMenu?.(node),\n focus: (id) => setFocusedId(id),\n }),\n [],\n );\n\n /**\n * Whether ANY row of this tree is being dragged.\n *\n * ⚠️ A different question from \"this row is being dragged\", and it has to be\n * answered here rather than in a row: a row can compare its own id, but only\n * the tree knows whether the drag exists at all.\n */\n const isDragActive = props.dragId !== undefined;\n\n /**\n * The dragged node and everything beneath it.\n *\n * ⚠️ The one legality question this component answers on its own, and it\n * has to: dropping a branch inside its own subtree would orphan the branch,\n * which is a fact about the TREE and not about the consumer's domain. The\n * consumer's `resolveDrop` refuses such a drop at the end anyway, so without\n * this the row would light up promising a move that never happens.\n *\n * Computed once per render as a SET rather than asking `nodeHolds` per row,\n * so a drag over a large tree stays one walk of the dragged subtree.\n */\n const forbidden = useMemo(() => {\n const ids = new Set<string>();\n if (props.dragId === undefined) return ids;\n const dragged = props.rows.find(\n (row) => row.node.id === props.dragId,\n )?.node;\n if (!dragged) return ids;\n const walk = (node: TreeNode<T>): void => {\n ids.add(node.id);\n for (const child of node.children ?? []) walk(child);\n };\n walk(dragged);\n return ids;\n }, [props.dragId, props.rows]);\n\n /**\n * Where a drop over each row would land, and whether it means anything.\n *\n * A row's folder is the branch itself or a leaf's parent (`null` for the\n * root). A drop there is REFUSED (no highlight, the \"no drop\" cursor) when\n * it is the dragged node's own folder, since a sorted tree would put it\n * back where it was, or inside the dragged branch's subtree.\n */\n const drag = useMemo(() => {\n const byId = new Map(props.rows.map((row) => [row.node.id, row.node]));\n const dragged =\n props.dragId === undefined ? undefined : byId.get(props.dragId);\n const draggedParent = dragged\n ? (dragged.declaredParentId ?? dragged.parentId ?? null)\n : undefined;\n const containerOf = (id: string): string | null | undefined => {\n if (id === TREE_ROOT_ID) return null;\n const node = byId.get(id);\n if (!node) return undefined;\n return node.branch ? node.id : (node.parentId ?? null);\n };\n const allows = (container: string | null | undefined): boolean =>\n dragged !== undefined &&\n container !== undefined &&\n container !== draggedParent &&\n (container === null || !forbidden.has(container));\n return { byId, containerOf, allows };\n }, [props.dragId, props.rows, forbidden]);\n\n // The folder the current drop targets, when the drop would do something.\n const target = props.drop ? drag.containerOf(props.drop.id) : undefined;\n const targetAllowed = drag.allows(target);\n\n // Its rows: the folder's own row and everything beneath it that is shown.\n const block = useMemo(() => {\n const ids = new Set<string>();\n if (!targetAllowed || typeof target !== \"string\") return ids;\n const walk = (node: TreeNode<T>): void => {\n ids.add(node.id);\n for (const child of node.children ?? []) walk(child);\n };\n const folder = drag.byId.get(target);\n if (folder) walk(folder);\n return ids;\n }, [target, targetAllowed, drag]);\n\n // A closed folder held under the pointer opens, so a drop can go deep in\n // one gesture (as in a file manager). Only while a drag is on.\n const opensAfterHover = targetAllowed && typeof target === \"string\";\n const hoveredClosed =\n opensAfterHover && props.drop?.id === target && props.collapsed.has(target);\n useEffect(() => {\n if (!hoveredClosed || typeof target !== \"string\") return;\n const timer = setTimeout(() => facade.toggle(target), 600);\n return () => clearTimeout(timer);\n }, [hoveredClosed, target, facade]);\n\n return (\n // oxlint-disable-next-line jsx-a11y/interactive-supports-focus -- a roving tab stop: the rows take the focus, the tree only hears their arrow keys\n <div\n role=\"tree\"\n aria-label={props.label}\n aria-multiselectable={props.selectedIds ? true : undefined}\n className={props.className}\n // The root is the target. Flagged rather than painted: the pane around\n // the tree (and its empty space below the rows) is the root folder,\n // and only the consumer draws that.\n data-drop-root={targetAllowed && target === null ? \"\" : undefined}\n onKeyDown={onKeyDown}\n >\n {props.rows.map((row) => (\n <TreeViewRow\n key={row.node.id}\n node={row.node}\n depth={row.depth}\n facade={facade}\n isCollapsed={props.collapsed.has(row.node.id)}\n isSelected={\n props.selectedId === row.node.id ||\n props.selectedIds?.has(row.node.id) === true\n }\n isRenaming={props.renamingId === row.node.id}\n isDragging={props.dragId === row.node.id}\n isDraggable={props.draggable === true}\n isDragActive={isDragActive}\n dropAllowed={drag.allows(drag.containerOf(row.node.id))}\n inDropBlock={block.has(row.node.id)}\n hasMenu={props.renderMenu !== undefined}\n isTabStop={row.node.id === tabStopId}\n />\n ))}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoOA,MAAa,YAAgB,UAA0C;;;;;;;;;CASrE,MAAM,UAAU,OAAyB,KAAK;CAC9C,QAAQ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AC;EAAQ;EAAe;CAAI,CAAC;CAKhC,MAAM,gBADkB,iBAAiB,OAAO,WAAW,YAEtC,MAAM,MAAM,OAAO,UAAU,MAAM,UAAU,IAAI,MAAM;CAC5E,gBAAgB;EACd,IAAI,CAAC,iBAAiB,OAAO,WAAW,UAAU;EAClD,MAAM,QAAQ,iBAAiB,OAAO,OAAO,MAAM,GAAG,GAAG;EACzD,aAAa,aAAa,KAAK;CACjC,GAAG;EAAC;EAAe;EAAQ;CAAM,CAAC;CAElC,OAEE,oBAAC,OAAD;EACE,MAAK;EACL,cAAY,MAAM;EAClB,wBAAsB,MAAM,cAAc,OAAO,KAAA;EACjD,WAAW,MAAM;EAIjB,kBAAgB,iBAAiB,WAAW,OAAO,KAAK,KAAA;EAC7C;EAEV,UAAA,MAAM,KAAK,KAAK,QACf,oBAAC,aAAD;GAEE,MAAM,IAAI;GACV,OAAO,IAAI;GACH;GACR,aAAa,MAAM,UAAU,IAAI,IAAI,KAAK,EAAE;GAC5C,YACE,MAAM,eAAe,IAAI,KAAK,MAC9B,MAAM,aAAa,IAAI,IAAI,KAAK,EAAE,MAAM;GAE1C,YAAY,MAAM,eAAe,IAAI,KAAK;GAC1C,YAAY,MAAM,WAAW,IAAI,KAAK;GACtC,aAAa,MAAM,cAAc;GACnB;GACd,aAAa,KAAK,OAAO,KAAK,YAAY,IAAI,KAAK,EAAE,CAAC;GACtD,aAAa,MAAM,IAAI,IAAI,KAAK,EAAE;GAClC,SAAS,MAAM,eAAe,KAAA;GAC9B,WAAW,IAAI,KAAK,OAAO;EAC5B,GAjBM,IAAI,KAAK,EAiBf,CACF;CACE,CAAA;AAET"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
2
2
|
import type { TreeDropPosition, TreeNode } from "./treeModel.ts";
|
|
3
3
|
import type { TreeRowState } from "./TreeView.tsx";
|
|
4
4
|
/**
|
|
@@ -74,17 +74,17 @@ export interface TreeViewRowProps<T = undefined> {
|
|
|
74
74
|
*/
|
|
75
75
|
isDragActive: boolean;
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
77
|
+
* Whether a drop over this row would move anything: its folder (the
|
|
78
|
+
* branch, or a leaf's parent) is neither the dragged node's own folder nor
|
|
79
|
+
* inside the dragged branch. Refused, the row still REPORTS the hover, so
|
|
80
|
+
* the highlight leaves the last folder, but the cursor says "no drop".
|
|
78
81
|
*/
|
|
79
|
-
|
|
82
|
+
dropAllowed: boolean;
|
|
80
83
|
/**
|
|
81
|
-
* This row
|
|
82
|
-
*
|
|
83
|
-
* the marker follows the pointer rather than sticking to the last legal row,
|
|
84
|
-
* but it draws nothing: a marker promising a move that will not happen is
|
|
85
|
-
* worse than no marker at all.
|
|
84
|
+
* This row belongs to the folder the drop targets (the folder's row and
|
|
85
|
+
* everything shown beneath it), highlighted as one block.
|
|
86
86
|
*/
|
|
87
|
-
|
|
87
|
+
inDropBlock: boolean;
|
|
88
88
|
/**
|
|
89
89
|
* Whether the consumer supplied a `renderMenu` slot. A primitive rather than
|
|
90
90
|
* the slot itself, so the memo still holds: the slot travels on the facade.
|
|
@@ -110,8 +110,12 @@ export interface TreeViewRowProps<T = undefined> {
|
|
|
110
110
|
* for a library built around a single drop target per area. Recorded so it is
|
|
111
111
|
* not re-litigated.
|
|
112
112
|
*
|
|
113
|
-
* A
|
|
114
|
-
*
|
|
113
|
+
* A drop names a FOLDER, as in a file manager: over a branch, that branch;
|
|
114
|
+
* over a leaf, the folder that holds it. The tree is sorted by its
|
|
115
|
+
* comparator, so it draws no line between two rows (the 28/44/28 zones did,
|
|
116
|
+
* and promised a place the sort then ignored): it lights the target folder's
|
|
117
|
+
* rows as one block, refuses with the "no drop" cursor a drop that would
|
|
118
|
+
* change nothing, and the dragged image is a compact label of the name.
|
|
115
119
|
*
|
|
116
120
|
* The row reports gestures and resolves nothing: `resolveDrop` is the
|
|
117
121
|
* consumer's to call, because only it knows whether the resulting parent
|
|
@@ -167,19 +171,6 @@ export declare const DISCLOSURE_BOX_PX = 14;
|
|
|
167
171
|
* pixel of offset. Known, not overlooked.
|
|
168
172
|
*/
|
|
169
173
|
export declare const INDENT_GUIDE_ORIGIN_PX: number;
|
|
170
|
-
/**
|
|
171
|
-
* Whether a drag carries OS files rather than one of this tree's own rows.
|
|
172
|
-
*
|
|
173
|
-
* `dataTransfer.types` is the only readable signal during `dragover`:
|
|
174
|
-
* `dataTransfer.files` is empty until `drop`, because the browser withholds
|
|
175
|
-
* the bytes so a page cannot read a file merely by being dragged across it.
|
|
176
|
-
* Checking the tree's drag id instead would be wrong in the other direction:
|
|
177
|
-
* it is unset for an external drag, but also unset in the frame before an
|
|
178
|
-
* internal drag's `dragstart` state lands.
|
|
179
|
-
*
|
|
180
|
-
* Exported because a consumer's own tests reach for it.
|
|
181
|
-
*/
|
|
182
|
-
export declare const isFileDrag: (e: DragEvent<HTMLElement>) => boolean;
|
|
183
174
|
/**
|
|
184
175
|
* Memoised, and the props above are shaped so that the DEFAULT shallow
|
|
185
176
|
* comparison is enough: every one of them is a primitive, a node the tree
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeViewRow.d.ts","sourceRoot":"","sources":["../../src/tree/TreeViewRow.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"TreeViewRow.d.ts","sourceRoot":"","sources":["../../src/tree/TreeViewRow.tsx"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,YAAY,EAEjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD;;;;;;;;GAQG;AACH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,cAAc,CAAC,CAAC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E,QAAQ,CAAC,CAAC,CAAC,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IAC1B;;;;;OAKG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB;;;;;OAKG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,QAAA,MAAM,eAAe,GAAI,CAAC,SAAU,gBAAgB,CAAC,CAAC,CAAC,KAAG,YAgNzD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,sBAAsB,QAAyC,CAAC;AAe7E;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW,EAA4B,OAAO,eAAe,CAAC"}
|
package/dist/tree/TreeViewRow.js
CHANGED
|
@@ -19,8 +19,12 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
19
19
|
* for a library built around a single drop target per area. Recorded so it is
|
|
20
20
|
* not re-litigated.
|
|
21
21
|
*
|
|
22
|
-
* A
|
|
23
|
-
*
|
|
22
|
+
* A drop names a FOLDER, as in a file manager: over a branch, that branch;
|
|
23
|
+
* over a leaf, the folder that holds it. The tree is sorted by its
|
|
24
|
+
* comparator, so it draws no line between two rows (the 28/44/28 zones did,
|
|
25
|
+
* and promised a place the sort then ignored): it lights the target folder's
|
|
26
|
+
* rows as one block, refuses with the "no drop" cursor a drop that would
|
|
27
|
+
* change nothing, and the dragged image is a compact label of the name.
|
|
24
28
|
*
|
|
25
29
|
* The row reports gestures and resolves nothing: `resolveDrop` is the
|
|
26
30
|
* consumer's to call, because only it knows whether the resulting parent
|
|
@@ -70,6 +74,7 @@ const TreeViewRowImpl = (props) => {
|
|
|
70
74
|
e.stopPropagation();
|
|
71
75
|
e.dataTransfer.effectAllowed = "move";
|
|
72
76
|
e.dataTransfer.setData("text/plain", node.id);
|
|
77
|
+
setDragLabel(e);
|
|
73
78
|
facade.onDragStart(node.id);
|
|
74
79
|
};
|
|
75
80
|
const handleDragOver = (e) => {
|
|
@@ -79,10 +84,9 @@ const TreeViewRowImpl = (props) => {
|
|
|
79
84
|
e.dataTransfer.dropEffect = facade.acceptsFiles() ? "copy" : "none";
|
|
80
85
|
return;
|
|
81
86
|
}
|
|
82
|
-
if (!props.isDragActive
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
const position = node.branch ? y < rect.height * .28 ? "before" : y > rect.height * .72 ? "after" : "inside" : y < rect.height / 2 ? "before" : "after";
|
|
87
|
+
if (!props.isDragActive) return;
|
|
88
|
+
e.dataTransfer.dropEffect = props.dropAllowed ? "move" : "none";
|
|
89
|
+
const position = node.branch ? "inside" : "before";
|
|
86
90
|
facade.onDragOver(node.id, position);
|
|
87
91
|
};
|
|
88
92
|
const handleDrop = (e) => {
|
|
@@ -105,6 +109,7 @@ const TreeViewRowImpl = (props) => {
|
|
|
105
109
|
if (e.target === e.currentTarget) facade.focus(node.id);
|
|
106
110
|
},
|
|
107
111
|
"data-selected": isSelected || void 0,
|
|
112
|
+
"data-drop-block": props.inDropBlock || void 0,
|
|
108
113
|
draggable: props.isDraggable && !props.isRenaming,
|
|
109
114
|
onDragStart: props.isDraggable ? handleDragStart : void 0,
|
|
110
115
|
onDragOver: props.isDraggable ? handleDragOver : void 0,
|
|
@@ -112,7 +117,7 @@ const TreeViewRowImpl = (props) => {
|
|
|
112
117
|
onDragEnd: props.isDraggable ? facade.onDragEnd : void 0,
|
|
113
118
|
onClick: handleClick,
|
|
114
119
|
onKeyDown: handleKeyDown,
|
|
115
|
-
className: cn("group/tree-row hover:bg-hover relative flex cursor-default items-center gap-1 py-1 pe-2 text-sm outline-none select-none", "transition-[background-color,transform] duration-150", !props.isDragging && !props.isRenaming && "active:translate-y-px", "focus-visible:bg-muted/60", depth > 0 && "[background-image:repeating-linear-gradient(to_right,var(--border)_0_1px,transparent_1px_var(--tree-guide-step))] [background-position:var(--tree-guide-origin)_0] rtl:[background-image:repeating-linear-gradient(to_left,var(--border)_0_1px,transparent_1px_var(--tree-guide-step))] rtl:[background-position:right_var(--tree-guide-origin)_top_0]", isSelected && "bg-
|
|
120
|
+
className: cn("group/tree-row hover:bg-hover-weak relative flex cursor-default items-center gap-1 py-1 pe-2 text-sm outline-none select-none", "transition-[background-color,transform] duration-150", !props.isDragging && !props.isRenaming && "active:translate-y-px", "focus-visible:bg-muted/60", depth > 0 && "[background-image:repeating-linear-gradient(to_right,var(--border)_0_1px,transparent_1px_var(--tree-guide-step))] [background-position:var(--tree-guide-origin)_0] rtl:[background-image:repeating-linear-gradient(to_left,var(--border)_0_1px,transparent_1px_var(--tree-guide-step))] rtl:[background-position:right_var(--tree-guide-origin)_top_0]", isSelected && "bg-hover font-medium", props.isDragging && "opacity-45", props.inDropBlock && "bg-primary/15"),
|
|
116
121
|
style: {
|
|
117
122
|
paddingInlineStart: `${8 + depth * 13}px`,
|
|
118
123
|
...depth > 0 && {
|
|
@@ -128,14 +133,6 @@ const TreeViewRowImpl = (props) => {
|
|
|
128
133
|
"aria-hidden": true,
|
|
129
134
|
className: "bg-primary pointer-events-none absolute inset-y-0 start-0 w-0.5"
|
|
130
135
|
}),
|
|
131
|
-
props.dropHere === "before" && !props.isDropForbidden && /* @__PURE__ */ jsx("div", {
|
|
132
|
-
"data-slot": "tree-view-drop-before",
|
|
133
|
-
className: "bg-primary pointer-events-none absolute inset-x-0 top-0 h-0.5"
|
|
134
|
-
}),
|
|
135
|
-
props.dropHere === "after" && !props.isDropForbidden && /* @__PURE__ */ jsx("div", {
|
|
136
|
-
"data-slot": "tree-view-drop-after",
|
|
137
|
-
className: "bg-primary pointer-events-none absolute inset-x-0 bottom-0 h-0.5"
|
|
138
|
-
}),
|
|
139
136
|
node.branch ? /* @__PURE__ */ jsx("button", {
|
|
140
137
|
type: "button",
|
|
141
138
|
tabIndex: -1,
|
|
@@ -220,8 +217,6 @@ const INDENT_GUIDE_ORIGIN_PX = 15;
|
|
|
220
217
|
* Checking the tree's drag id instead would be wrong in the other direction:
|
|
221
218
|
* it is unset for an external drag, but also unset in the frame before an
|
|
222
219
|
* internal drag's `dragstart` state lands.
|
|
223
|
-
*
|
|
224
|
-
* Exported because a consumer's own tests reach for it.
|
|
225
220
|
*/
|
|
226
221
|
const isFileDrag = (e) => [...e.dataTransfer.types].includes("Files");
|
|
227
222
|
/**
|
|
@@ -241,6 +236,38 @@ const isFileDrag = (e) => [...e.dataTransfer.types].includes("Files");
|
|
|
241
236
|
* the facade.
|
|
242
237
|
*/
|
|
243
238
|
const TreeViewRow = memo(TreeViewRowImpl);
|
|
244
|
-
|
|
239
|
+
/**
|
|
240
|
+
* The image dragged under the pointer: a compact label of the row's name,
|
|
241
|
+
* not the browser's snapshot of the whole row with its indent and trailing
|
|
242
|
+
* icons. Built off-screen, handed to the browser, and removed on the next
|
|
243
|
+
* frame, once the browser has rendered it.
|
|
244
|
+
*/
|
|
245
|
+
const setDragLabel = (e) => {
|
|
246
|
+
if (typeof e.dataTransfer.setDragImage !== "function") return;
|
|
247
|
+
const text = e.currentTarget.textContent?.trim() ?? "";
|
|
248
|
+
if (!text) return;
|
|
249
|
+
const label = document.createElement("div");
|
|
250
|
+
label.textContent = text;
|
|
251
|
+
const style = getComputedStyle(e.currentTarget);
|
|
252
|
+
Object.assign(label.style, {
|
|
253
|
+
position: "fixed",
|
|
254
|
+
top: "-1000px",
|
|
255
|
+
left: "-1000px",
|
|
256
|
+
maxWidth: "240px",
|
|
257
|
+
overflow: "hidden",
|
|
258
|
+
textOverflow: "ellipsis",
|
|
259
|
+
whiteSpace: "nowrap",
|
|
260
|
+
padding: "2px 8px",
|
|
261
|
+
borderRadius: "6px",
|
|
262
|
+
font: style.font,
|
|
263
|
+
color: style.color,
|
|
264
|
+
background: "var(--popover, white)",
|
|
265
|
+
boxShadow: "0 1px 3px rgb(0 0 0 / 0.2)"
|
|
266
|
+
});
|
|
267
|
+
document.body.appendChild(label);
|
|
268
|
+
e.dataTransfer.setDragImage(label, -12, -8);
|
|
269
|
+
requestAnimationFrame(() => label.remove());
|
|
270
|
+
};
|
|
271
|
+
export { DISCLOSURE_BOX_PX, INDENT_BASE_PX, INDENT_GUIDE_ORIGIN_PX, INDENT_STEP_PX, TreeViewRow };
|
|
245
272
|
|
|
246
273
|
//# sourceMappingURL=TreeViewRow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeViewRow.js","names":[],"sources":["../../src/tree/TreeViewRow.tsx"],"sourcesContent":["import { ChevronDown, ChevronRight } from \"lucide-react\";\nimport {\n type DragEvent,\n type FocusEvent,\n type KeyboardEvent,\n memo,\n type MouseEvent,\n type ReactElement,\n type CSSProperties,\n type ReactNode,\n} from \"react\";\n\nimport { ContextMenu, ContextMenuTrigger } from \"../core/ContextMenu.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport type { TreeDropPosition, TreeNode } from \"./treeModel.ts\";\nimport type { TreeRowState } from \"./TreeView.tsx\";\nimport { TreeViewRenameInput } from \"./TreeViewRenameInput.tsx\";\n\n/**\n * The slots and callbacks a row reads, behind an object whose identity never\n * changes for the life of the tree.\n *\n * ⚠️ Rows never receive a raw consumer callback. `TreeView` builds this once\n * (see its `implRef` block) so a consumer passing inline arrows still gets a\n * memo that holds. Every method here reads through that ref, so it can be\n * held forever and still call the current implementation.\n */\n/**\n * How a row was activated, for a tree that selects a range (#Q3654).\n */\nexport interface TreeSelectOptions {\n /**\n * Shift was held: extend the selection from its anchor to this row.\n */\n shift: boolean;\n}\n\nexport interface TreeViewFacade<T = undefined> {\n select: (node: TreeNode<T>, options?: TreeSelectOptions) => void;\n toggle: (id: string) => void;\n renderIcon: (node: TreeNode<T>, state: TreeRowState) => ReactNode;\n renderLabel: (node: TreeNode<T>, state: TreeRowState) => ReactNode;\n renderTrailing: (node: TreeNode<T>, state: TreeRowState) => ReactNode;\n onDragStart: (id: string) => void;\n onDragOver: (id: string, position: TreeDropPosition) => void;\n onDrop: (id: string) => void;\n /**\n * Whether the tree takes OS files dropped on a row (`onFilesDrop`).\n */\n acceptsFiles: () => boolean;\n onFilesDrop: (id: string, files: File[]) => void;\n onDragEnd: () => void;\n commitRename: (id: string, name: string) => void;\n cancelRename: () => void;\n renderMenu: (node: TreeNode<T>) => ReactNode;\n /**\n * Reports that a row took the focus, so the tree moves its one tab stop\n * there.\n */\n focus: (id: string) => void;\n}\n\nexport interface TreeViewRowProps<T = undefined> {\n node: TreeNode<T>;\n depth: number;\n /**\n * Stable for the life of the tree, which is what lets this component be\n * memoised at all. See {@link TreeViewFacade}.\n */\n facade: TreeViewFacade<T>;\n /**\n * The state flags are passed as PRIMITIVES rather than derived from the\n * tree state here. That is the whole reason the memo below holds: a toggle\n * changes `rows` and `collapsed`, so any prop carrying the state object\n * would change identity on every row.\n */\n isCollapsed: boolean;\n isSelected: boolean;\n isRenaming: boolean;\n isDragging: boolean;\n /**\n * Whether this tree has drag and drop turned on. Off, the row attaches no\n * drag handler at all: a read-only tree must not pay for a capability it\n * never uses.\n */\n isDraggable: boolean;\n /**\n * Whether ANY row of this tree is being dragged, which is not the same\n * question as {@link TreeViewRowProps.isDragging}. `handleDragOver` needs it\n * to tell an internal drag from an external one that carries no files.\n */\n isDragActive: boolean;\n /**\n * Where this row's drop marker is drawn, if the pointer is over it.\n */\n dropHere?: TreeDropPosition;\n /**\n * This row is the dragged node or sits beneath it, so a drop here would\n * orphan the branch and will be refused. The row still REPORTS the zone, so\n * the marker follows the pointer rather than sticking to the last legal row,\n * but it draws nothing: a marker promising a move that will not happen is\n * worse than no marker at all.\n */\n isDropForbidden: boolean;\n /**\n * Whether the consumer supplied a `renderMenu` slot. A primitive rather than\n * the slot itself, so the memo still holds: the slot travels on the facade.\n */\n hasMenu: boolean;\n /**\n * Whether this row is the tree's one tab stop (`tabIndex` 0). Every other\n * row is `-1` and is reached with the arrow keys, as `role=\"tree\"` asks.\n */\n isTabStop: boolean;\n}\n\n/**\n * One row of a `TreeView`: the disclosure column (a chevron on a branch, a\n * spacer on a leaf), the icon slot, the label, and the trailing slot, over the\n * indent geometry.\n *\n * ## Drag and drop, and why it is native rather than @dnd-kit\n *\n * `@dnd-kit` is the house drag library in the applications that consume this\n * package (kanban boards, file browsers), and it is the wrong tool **here\n * specifically**. Three drop zones per row is about forty lines of\n * `onDragOver` arithmetic natively, against writing custom collision detection\n * for a library built around a single drop target per area. Recorded so it is\n * not re-litigated.\n *\n * A branch row splits **28% / 44% / 28%** into before / inside / after. A leaf\n * splits 50/50 with no inside area, because it cannot hold children.\n *\n * The row reports gestures and resolves nothing: `resolveDrop` is the\n * consumer's to call, because only it knows whether the resulting parent\n * change is legal in its own domain.\n *\n * ## Inline rename, and the context menu as a SLOT\n *\n * A row in rename mode swaps its label for {@link TreeViewRenameInput}. The\n * verbs of the context menu are never this component's business: it takes a\n * `renderMenu` slot and wraps the row in `ContextMenu` only when one is\n * given, so a consumer keeps its own menu with its own routes.\n */\nconst TreeViewRowImpl = <T,>(props: TreeViewRowProps<T>): ReactElement => {\n const { node, depth, facade, isCollapsed, isSelected } = props;\n const state: TreeRowState = {\n collapsed: isCollapsed,\n selected: isSelected,\n renaming: props.isRenaming,\n dragging: props.isDragging,\n };\n\n /**\n * One gesture, one meaning: a click opens the row it is on.\n *\n * ⚠️ The `e.detail > 1` guard is not optional. A real double click fires\n * click, click, then dblclick, so without it the two clicks toggle a\n * branch twice and it ends collapsed: a different outcome from the single\n * click that shares its first half, reached by doing the same thing\n * faster. It costs no timer and no latency, since `detail` is the\n * browser's own counter for the burst and is already on the event.\n */\n const handleClick = (e: MouseEvent): void => {\n if (props.isRenaming) return;\n if (e.detail > 1) return;\n facade.select(node, { shift: e.shiftKey });\n };\n\n const handleKeyDown = (e: KeyboardEvent): void => {\n if (props.isRenaming) return;\n if (e.key !== \"Enter\" && e.key !== \" \") return;\n e.preventDefault();\n facade.select(node, { shift: e.shiftKey });\n };\n\n const handleToggle = (e: MouseEvent): void => {\n e.stopPropagation();\n facade.toggle(node.id);\n };\n\n const handleDragStart = (e: DragEvent<HTMLDivElement>): void => {\n e.stopPropagation();\n e.dataTransfer.effectAllowed = \"move\";\n e.dataTransfer.setData(\"text/plain\", node.id);\n facade.onDragStart(node.id);\n };\n\n const handleDragOver = (e: DragEvent<HTMLDivElement>): void => {\n e.preventDefault();\n e.stopPropagation();\n if (isFileDrag(e)) {\n // An OS file drag lands only where the consumer said files may, and is\n // never treated as a re-parent.\n e.dataTransfer.dropEffect = facade.acceptsFiles() ? \"copy\" : \"none\";\n return;\n }\n if (!props.isDragActive || props.isDragging) return;\n const rect = e.currentTarget.getBoundingClientRect();\n const y = e.clientY - rect.top;\n const position: TreeDropPosition = node.branch\n ? y < rect.height * 0.28\n ? \"before\"\n : y > rect.height * 0.72\n ? \"after\"\n : \"inside\"\n : y < rect.height / 2\n ? \"before\"\n : \"after\";\n facade.onDragOver(node.id, position);\n };\n\n const handleDrop = (e: DragEvent<HTMLDivElement>): void => {\n e.preventDefault();\n e.stopPropagation();\n if (isFileDrag(e)) {\n if (facade.acceptsFiles()) {\n facade.onFilesDrop(node.id, [...e.dataTransfer.files]);\n }\n return;\n }\n facade.onDrop(node.id);\n };\n\n // The row's own attributes, built once: the same element is rendered\n // directly, or handed to `ContextMenuTrigger`'s `render` prop when the\n // consumer supplied a menu. Duplicating the list for the two branches is\n // exactly how the two would drift.\n const rowProps = {\n \"data-slot\": \"tree-view-row\",\n role: \"treeitem\",\n // The rows are a flat list rather than nested `role=\"group\"` elements,\n // so depth is spoken through `aria-level`, which is the flat\n // equivalent.\n \"aria-level\": depth + 1,\n \"aria-expanded\": node.branch ? !isCollapsed : undefined,\n \"aria-selected\": isSelected || undefined,\n tabIndex: props.isTabStop ? 0 : -1,\n onFocus: (e: FocusEvent) => {\n if (e.target === e.currentTarget) facade.focus(node.id);\n },\n // Selection is otherwise only a background class, which is not\n // something a test (or a future stylesheet) can address.\n \"data-selected\": isSelected || undefined,\n draggable: props.isDraggable && !props.isRenaming,\n onDragStart: props.isDraggable ? handleDragStart : undefined,\n onDragOver: props.isDraggable ? handleDragOver : undefined,\n onDrop: props.isDraggable ? handleDrop : undefined,\n onDragEnd: props.isDraggable ? facade.onDragEnd : undefined,\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n className: cn(\n // `group/tree-row` is NAMED, not a bare `group`: a consumer's icon\n // slot tracks this row's hover and selected background through it,\n // and a bare group here would also be captured by any `group-*`\n // utility inside the parts nested below.\n \"group/tree-row hover:bg-hover relative flex cursor-default items-center gap-1 py-1 pe-2 text-sm outline-none select-none\",\n // ⚠️ Named properties, never `transition-all`. This element is\n // also an HTML5 drag SOURCE that animates `opacity` while dragging\n // and carries the drop markers; a blanket transition puts all\n // three on a timer, so the drop indicator lags the pointer it is\n // supposed to track.\n \"transition-[background-color,transform] duration-150\",\n // The press. Suppressed while dragging, because a transform on a\n // drag source moves the browser's own drag image with it.\n !props.isDragging && !props.isRenaming && \"active:translate-y-px\",\n \"focus-visible:bg-muted/60\",\n depth > 0 &&\n \"[background-image:repeating-linear-gradient(to_right,var(--border)_0_1px,transparent_1px_var(--tree-guide-step))] [background-position:var(--tree-guide-origin)_0] rtl:[background-image:repeating-linear-gradient(to_left,var(--border)_0_1px,transparent_1px_var(--tree-guide-step))] rtl:[background-position:right_var(--tree-guide-origin)_top_0]\",\n isSelected && \"bg-muted font-medium\",\n props.isDragging && \"opacity-45\",\n props.dropHere === \"inside\" &&\n !props.isDropForbidden &&\n \"bg-primary/10 ring-primary/60 ring-1 ring-inset\",\n ),\n style: {\n paddingInlineStart: `${INDENT_BASE_PX + depth * INDENT_STEP_PX}px`,\n // Indent guides, as pure CSS: one hairline per ancestor level,\n // painted as a repeating gradient clipped to the indent area so it\n // can never run under the label. A background IMAGE, so the row's\n // background COLOUR (hover, selection) still shows through\n // underneath. A background has no logical side, so the gradient and\n // its origin are custom properties the `rtl:` classes in `className` flip.\n ...(depth > 0 && {\n \"--tree-guide-origin\": `${INDENT_GUIDE_ORIGIN_PX}px`,\n \"--tree-guide-step\": `${INDENT_STEP_PX}px`,\n backgroundSize: `${depth * INDENT_STEP_PX}px 100%`,\n backgroundRepeat: \"no-repeat\",\n }),\n } as CSSProperties,\n };\n\n const content = (\n <>\n {isSelected && (\n // The accent bar. A selected row used to differ from its\n // neighbours by a background tint alone, which several themes\n // render almost invisibly.\n <span\n aria-hidden\n className=\"bg-primary pointer-events-none absolute inset-y-0 start-0 w-0.5\"\n />\n )}\n {props.dropHere === \"before\" && !props.isDropForbidden && (\n <div\n data-slot=\"tree-view-drop-before\"\n className=\"bg-primary pointer-events-none absolute inset-x-0 top-0 h-0.5\"\n />\n )}\n {props.dropHere === \"after\" && !props.isDropForbidden && (\n <div\n data-slot=\"tree-view-drop-after\"\n className=\"bg-primary pointer-events-none absolute inset-x-0 bottom-0 h-0.5\"\n />\n )}\n {node.branch ? (\n <button\n type=\"button\"\n tabIndex={-1}\n aria-hidden\n onClick={handleToggle}\n className=\"flex h-3.5 shrink-0 items-center justify-center\"\n style={{ width: DISCLOSURE_BOX_PX }}\n >\n {isCollapsed ? (\n <ChevronRight className=\"size-3 opacity-60 rtl:-scale-x-100\" />\n ) : (\n <ChevronDown className=\"size-3 opacity-60\" />\n )}\n </button>\n ) : (\n <span\n className=\"inline-block shrink-0\"\n style={{ width: DISCLOSURE_BOX_PX }}\n />\n )}\n {facade.renderIcon(node, state)}\n {props.isRenaming ? (\n <TreeViewRenameInput\n name={node.name}\n onCommit={(name) => facade.commitRename(node.id, name)}\n onCancel={facade.cancelRename}\n />\n ) : (\n /*\n * The label is its OWN element, separate from the row's click\n * handler and from the disclosure button, so a consumer that needs\n * an anchor here one day changes this line rather than the row.\n */\n <span data-slot=\"tree-view-label\" className=\"min-w-0 flex-1 truncate\">\n {facade.renderLabel(node, state)}\n </span>\n )}\n {!props.isRenaming && facade.renderTrailing(node, state)}\n </>\n );\n\n if (!props.hasMenu) return <div {...rowProps}>{content}</div>;\n\n return (\n <ContextMenu>\n <ContextMenuTrigger render={<div {...rowProps} />}>\n {content}\n </ContextMenuTrigger>\n {facade.renderMenu(node)}\n </ContextMenu>\n );\n};\n\n/**\n * How far one level of nesting indents a row, in pixels.\n *\n * Shared by the row's own left padding and by the indent guides drawn behind\n * it, so the two cannot drift: a guide that does not line up with the column\n * it belongs to is worse than no guide.\n */\nexport const INDENT_STEP_PX = 13;\n\n/**\n * The row's own base padding: where a depth-0 row's content starts.\n */\nexport const INDENT_BASE_PX = 8;\n\n/**\n * The width of the disclosure column: the chevron button on a branch, and the\n * spacer that stands in for it on a leaf.\n *\n * Applied as a style rather than a `w-3.5` class **on purpose**: it is also\n * half of {@link INDENT_GUIDE_ORIGIN_PX}, so a class here would let the box be\n * resized while the guides stayed where they were. One number, two consumers,\n * no way to move one without the other.\n */\nexport const DISCLOSURE_BOX_PX = 14;\n\n/**\n * Where the first level's guide is painted.\n *\n * ⚠️ **Not the same as {@link INDENT_BASE_PX}, and it used to be.** The rule\n * is not \"the same number twice\" but \"a guide is centred on the disclosure\n * column of the level it marks\", which is what a reader perceives as aligned.\n * Sharing the row's base padding put every guide 7px to the LEFT of its own\n * chevron, at every depth.\n *\n * Derived rather than typed, because the correction is exactly half the\n * disclosure box: the eyeballed 14 and the computed 15 are both within a pixel\n * of right, and only one of them survives the chevron changing size.\n *\n * ⚠️ The gradient paints its hairline from this x, so the 1px line occupies\n * `[15, 16)` and its own centre is half a pixel right of the chevron's.\n * Deliberate: `14.5` would centre the line exactly and cost the hairline its\n * crispness on a 1x display, which is a worse trade for a 1px rule than half a\n * pixel of offset. Known, not overlooked.\n */\nexport const INDENT_GUIDE_ORIGIN_PX = INDENT_BASE_PX + DISCLOSURE_BOX_PX / 2;\n\n/**\n * Whether a drag carries OS files rather than one of this tree's own rows.\n *\n * `dataTransfer.types` is the only readable signal during `dragover`:\n * `dataTransfer.files` is empty until `drop`, because the browser withholds\n * the bytes so a page cannot read a file merely by being dragged across it.\n * Checking the tree's drag id instead would be wrong in the other direction:\n * it is unset for an external drag, but also unset in the frame before an\n * internal drag's `dragstart` state lands.\n *\n * Exported because a consumer's own tests reach for it.\n */\nexport const isFileDrag = (e: DragEvent<HTMLElement>): boolean =>\n [...e.dataTransfer.types].includes(\"Files\");\n\n/**\n * Memoised, and the props above are shaped so that the DEFAULT shallow\n * comparison is enough: every one of them is a primitive, a node the tree\n * model memoises, or the facade that never changes identity.\n *\n * Before this discipline existed, one toggle re-rendered every visible row\n * along with its handlers: `rows` was already memoised, but each row received\n * the whole tree-state object, which is rebuilt on every render along with all\n * of its callbacks. Now a toggle re-renders only the rows whose own props\n * changed: the branch that opened, plus the rows that appeared or disappeared\n * beneath it.\n *\n * ⚠️ A prop added here must be shallow-comparable, or the memo silently stops\n * holding and nothing goes red. Anything that is not a primitive belongs on\n * the facade.\n */\nexport const TreeViewRow = memo(TreeViewRowImpl) as typeof TreeViewRowImpl;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgJA,MAAM,mBAAuB,UAA6C;CACxE,MAAM,EAAE,MAAM,OAAO,QAAQ,aAAa,eAAe;CACzD,MAAM,QAAsB;EAC1B,WAAW;EACX,UAAU;EACV,UAAU,MAAM;EAChB,UAAU,MAAM;CAClB;;;;;;;;;;;CAYA,MAAM,eA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,UAAA,cACC,oBAAC,cAAD,EAAc,WAAU,qCAAsC,CAAA,IAE9D,oBAAC,aAAD,EAAa,WAAU,oBAAqB,CAAA;EAExC,CAAA,IAER,oBAAC,QAAD;GACE,WAAU;GACV,OAAO,EAAE,OAAA,GAAyB;EACnC,CAAA;EAEF,OAAO,WAAW,MAAM,KAAK;EAC7B,MAAM,aACL,oBAAC,qBAAD;GACE,MAAM,KAAK;GACX,WAAW,SAAS,OAAO,aAAa,KAAK,IAAI,IAAI;GACrD,UAAU,OAAO;EAClB,CAAA,IAOD,oBAAC,QAAD;GAAM,aAAU;GAAkB,WAAU;GACzC,UAAA,OAAO,YAAY,MAAM,KAAK;EAC3B,CAAA;EAEP,CAAC,MAAM,cAAc,OAAO,eAAe,MAAM,KAAK;CACvD,EAAA,CAAA;CAGJ,IAAI,CAAC,MAAM,SAAS,OAAO,oBAAC,OAAD;EAAK,GAAI;EAAW,UAAA;CAAa,CAAA;CAE5D,OACE,qBAAC,aAAD,EAAA,UAAA,CACE,oBAAC,oBAAD;EAAoB,QAAQ,oBAAC,OAAD,EAAK,GAAI,SAAW,CAAA;EAC7C,UAAA;CACiB,CAAA,GACnB,OAAO,WAAW,IAAI,CACZ,EAAA,CAAA;AAEjB;;;;;;;;AASA,MAAa,iBAAiB;;;;AAK9B,MAAa,iBAAiB;;;;;;;;;;AAW9B,MAAa,oBAAoB;;;;;;;;;;;;;;;;;;;;AAqBjC,MAAa,yBAAyB;;;;;;;;;;;;;AActC,MAAa,cAAc,MACzB,CAAC,GAAG,EAAE,aAAa,KAAK,CAAC,CAAC,SAAS,OAAO;;;;;;;;;;;;;;;;;AAkB5C,MAAa,cAAc,KAAK,eAAe"}
|
|
1
|
+
{"version":3,"file":"TreeViewRow.js","names":[],"sources":["../../src/tree/TreeViewRow.tsx"],"sourcesContent":["import { ChevronDown, ChevronRight } from \"lucide-react\";\nimport {\n type DragEvent,\n type FocusEvent,\n type KeyboardEvent,\n memo,\n type MouseEvent,\n type ReactElement,\n type CSSProperties,\n type ReactNode,\n} from \"react\";\n\nimport { ContextMenu, ContextMenuTrigger } from \"../core/ContextMenu.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport type { TreeDropPosition, TreeNode } from \"./treeModel.ts\";\nimport type { TreeRowState } from \"./TreeView.tsx\";\nimport { TreeViewRenameInput } from \"./TreeViewRenameInput.tsx\";\n\n/**\n * The slots and callbacks a row reads, behind an object whose identity never\n * changes for the life of the tree.\n *\n * ⚠️ Rows never receive a raw consumer callback. `TreeView` builds this once\n * (see its `implRef` block) so a consumer passing inline arrows still gets a\n * memo that holds. Every method here reads through that ref, so it can be\n * held forever and still call the current implementation.\n */\n/**\n * How a row was activated, for a tree that selects a range (#Q3654).\n */\nexport interface TreeSelectOptions {\n /**\n * Shift was held: extend the selection from its anchor to this row.\n */\n shift: boolean;\n}\n\nexport interface TreeViewFacade<T = undefined> {\n select: (node: TreeNode<T>, options?: TreeSelectOptions) => void;\n toggle: (id: string) => void;\n renderIcon: (node: TreeNode<T>, state: TreeRowState) => ReactNode;\n renderLabel: (node: TreeNode<T>, state: TreeRowState) => ReactNode;\n renderTrailing: (node: TreeNode<T>, state: TreeRowState) => ReactNode;\n onDragStart: (id: string) => void;\n onDragOver: (id: string, position: TreeDropPosition) => void;\n onDrop: (id: string) => void;\n /**\n * Whether the tree takes OS files dropped on a row (`onFilesDrop`).\n */\n acceptsFiles: () => boolean;\n onFilesDrop: (id: string, files: File[]) => void;\n onDragEnd: () => void;\n commitRename: (id: string, name: string) => void;\n cancelRename: () => void;\n renderMenu: (node: TreeNode<T>) => ReactNode;\n /**\n * Reports that a row took the focus, so the tree moves its one tab stop\n * there.\n */\n focus: (id: string) => void;\n}\n\nexport interface TreeViewRowProps<T = undefined> {\n node: TreeNode<T>;\n depth: number;\n /**\n * Stable for the life of the tree, which is what lets this component be\n * memoised at all. See {@link TreeViewFacade}.\n */\n facade: TreeViewFacade<T>;\n /**\n * The state flags are passed as PRIMITIVES rather than derived from the\n * tree state here. That is the whole reason the memo below holds: a toggle\n * changes `rows` and `collapsed`, so any prop carrying the state object\n * would change identity on every row.\n */\n isCollapsed: boolean;\n isSelected: boolean;\n isRenaming: boolean;\n isDragging: boolean;\n /**\n * Whether this tree has drag and drop turned on. Off, the row attaches no\n * drag handler at all: a read-only tree must not pay for a capability it\n * never uses.\n */\n isDraggable: boolean;\n /**\n * Whether ANY row of this tree is being dragged, which is not the same\n * question as {@link TreeViewRowProps.isDragging}. `handleDragOver` needs it\n * to tell an internal drag from an external one that carries no files.\n */\n isDragActive: boolean;\n /**\n * Whether a drop over this row would move anything: its folder (the\n * branch, or a leaf's parent) is neither the dragged node's own folder nor\n * inside the dragged branch. Refused, the row still REPORTS the hover, so\n * the highlight leaves the last folder, but the cursor says \"no drop\".\n */\n dropAllowed: boolean;\n /**\n * This row belongs to the folder the drop targets (the folder's row and\n * everything shown beneath it), highlighted as one block.\n */\n inDropBlock: boolean;\n /**\n * Whether the consumer supplied a `renderMenu` slot. A primitive rather than\n * the slot itself, so the memo still holds: the slot travels on the facade.\n */\n hasMenu: boolean;\n /**\n * Whether this row is the tree's one tab stop (`tabIndex` 0). Every other\n * row is `-1` and is reached with the arrow keys, as `role=\"tree\"` asks.\n */\n isTabStop: boolean;\n}\n\n/**\n * One row of a `TreeView`: the disclosure column (a chevron on a branch, a\n * spacer on a leaf), the icon slot, the label, and the trailing slot, over the\n * indent geometry.\n *\n * ## Drag and drop, and why it is native rather than @dnd-kit\n *\n * `@dnd-kit` is the house drag library in the applications that consume this\n * package (kanban boards, file browsers), and it is the wrong tool **here\n * specifically**. Three drop zones per row is about forty lines of\n * `onDragOver` arithmetic natively, against writing custom collision detection\n * for a library built around a single drop target per area. Recorded so it is\n * not re-litigated.\n *\n * A drop names a FOLDER, as in a file manager: over a branch, that branch;\n * over a leaf, the folder that holds it. The tree is sorted by its\n * comparator, so it draws no line between two rows (the 28/44/28 zones did,\n * and promised a place the sort then ignored): it lights the target folder's\n * rows as one block, refuses with the \"no drop\" cursor a drop that would\n * change nothing, and the dragged image is a compact label of the name.\n *\n * The row reports gestures and resolves nothing: `resolveDrop` is the\n * consumer's to call, because only it knows whether the resulting parent\n * change is legal in its own domain.\n *\n * ## Inline rename, and the context menu as a SLOT\n *\n * A row in rename mode swaps its label for {@link TreeViewRenameInput}. The\n * verbs of the context menu are never this component's business: it takes a\n * `renderMenu` slot and wraps the row in `ContextMenu` only when one is\n * given, so a consumer keeps its own menu with its own routes.\n */\nconst TreeViewRowImpl = <T,>(props: TreeViewRowProps<T>): ReactElement => {\n const { node, depth, facade, isCollapsed, isSelected } = props;\n const state: TreeRowState = {\n collapsed: isCollapsed,\n selected: isSelected,\n renaming: props.isRenaming,\n dragging: props.isDragging,\n };\n\n /**\n * One gesture, one meaning: a click opens the row it is on.\n *\n * ⚠️ The `e.detail > 1` guard is not optional. A real double click fires\n * click, click, then dblclick, so without it the two clicks toggle a\n * branch twice and it ends collapsed: a different outcome from the single\n * click that shares its first half, reached by doing the same thing\n * faster. It costs no timer and no latency, since `detail` is the\n * browser's own counter for the burst and is already on the event.\n */\n const handleClick = (e: MouseEvent): void => {\n if (props.isRenaming) return;\n if (e.detail > 1) return;\n facade.select(node, { shift: e.shiftKey });\n };\n\n const handleKeyDown = (e: KeyboardEvent): void => {\n if (props.isRenaming) return;\n if (e.key !== \"Enter\" && e.key !== \" \") return;\n e.preventDefault();\n facade.select(node, { shift: e.shiftKey });\n };\n\n const handleToggle = (e: MouseEvent): void => {\n e.stopPropagation();\n facade.toggle(node.id);\n };\n\n const handleDragStart = (e: DragEvent<HTMLDivElement>): void => {\n e.stopPropagation();\n e.dataTransfer.effectAllowed = \"move\";\n e.dataTransfer.setData(\"text/plain\", node.id);\n setDragLabel(e);\n facade.onDragStart(node.id);\n };\n\n const handleDragOver = (e: DragEvent<HTMLDivElement>): void => {\n e.preventDefault();\n e.stopPropagation();\n if (isFileDrag(e)) {\n // An OS file drag lands only where the consumer said files may, and is\n // never treated as a re-parent.\n e.dataTransfer.dropEffect = facade.acceptsFiles() ? \"copy\" : \"none\";\n return;\n }\n if (!props.isDragActive) return;\n // One zone per row: a drop names a folder, never a place between rows,\n // which a sorted tree could not keep. A branch is the folder; a leaf\n // stands for the folder that holds it (`resolveDrop` reads `before` so).\n e.dataTransfer.dropEffect = props.dropAllowed ? \"move\" : \"none\";\n const position: TreeDropPosition = node.branch ? \"inside\" : \"before\";\n facade.onDragOver(node.id, position);\n };\n\n const handleDrop = (e: DragEvent<HTMLDivElement>): void => {\n e.preventDefault();\n e.stopPropagation();\n if (isFileDrag(e)) {\n if (facade.acceptsFiles()) {\n facade.onFilesDrop(node.id, [...e.dataTransfer.files]);\n }\n return;\n }\n facade.onDrop(node.id);\n };\n\n // The row's own attributes, built once: the same element is rendered\n // directly, or handed to `ContextMenuTrigger`'s `render` prop when the\n // consumer supplied a menu. Duplicating the list for the two branches is\n // exactly how the two would drift.\n const rowProps = {\n \"data-slot\": \"tree-view-row\",\n role: \"treeitem\",\n // The rows are a flat list rather than nested `role=\"group\"` elements,\n // so depth is spoken through `aria-level`, which is the flat\n // equivalent.\n \"aria-level\": depth + 1,\n \"aria-expanded\": node.branch ? !isCollapsed : undefined,\n \"aria-selected\": isSelected || undefined,\n tabIndex: props.isTabStop ? 0 : -1,\n onFocus: (e: FocusEvent) => {\n if (e.target === e.currentTarget) facade.focus(node.id);\n },\n // Selection is otherwise only a background class, which is not\n // something a test (or a future stylesheet) can address.\n \"data-selected\": isSelected || undefined,\n // The target folder's block, addressable as the selection is.\n \"data-drop-block\": props.inDropBlock || undefined,\n draggable: props.isDraggable && !props.isRenaming,\n onDragStart: props.isDraggable ? handleDragStart : undefined,\n onDragOver: props.isDraggable ? handleDragOver : undefined,\n onDrop: props.isDraggable ? handleDrop : undefined,\n onDragEnd: props.isDraggable ? facade.onDragEnd : undefined,\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n className: cn(\n // `group/tree-row` is NAMED, not a bare `group`: a consumer's icon\n // slot tracks this row's hover and selected background through it,\n // and a bare group here would also be captured by any `group-*`\n // utility inside the parts nested below.\n \"group/tree-row hover:bg-hover-weak relative flex cursor-default items-center gap-1 py-1 pe-2 text-sm outline-none select-none\",\n // ⚠️ Named properties, never `transition-all`. This element is\n // also an HTML5 drag SOURCE that animates `opacity` while dragging\n // and carries the drop markers; a blanket transition puts all\n // three on a timer, so the drop indicator lags the pointer it is\n // supposed to track.\n \"transition-[background-color,transform] duration-150\",\n // The press. Suppressed while dragging, because a transform on a\n // drag source moves the browser's own drag image with it.\n !props.isDragging && !props.isRenaming && \"active:translate-y-px\",\n \"focus-visible:bg-muted/60\",\n depth > 0 &&\n \"[background-image:repeating-linear-gradient(to_right,var(--border)_0_1px,transparent_1px_var(--tree-guide-step))] [background-position:var(--tree-guide-origin)_0] rtl:[background-image:repeating-linear-gradient(to_left,var(--border)_0_1px,transparent_1px_var(--tree-guide-step))] rtl:[background-position:right_var(--tree-guide-origin)_top_0]\",\n isSelected && \"bg-hover font-medium\",\n props.isDragging && \"opacity-45\",\n // The folder the drop targets, as one block: its row and all of its\n // shown rows, the way a file manager lights the folder a file goes in.\n props.inDropBlock && \"bg-primary/15\",\n ),\n style: {\n paddingInlineStart: `${INDENT_BASE_PX + depth * INDENT_STEP_PX}px`,\n // Indent guides, as pure CSS: one hairline per ancestor level,\n // painted as a repeating gradient clipped to the indent area so it\n // can never run under the label. A background IMAGE, so the row's\n // background COLOUR (hover, selection) still shows through\n // underneath. A background has no logical side, so the gradient and\n // its origin are custom properties the `rtl:` classes in `className` flip.\n ...(depth > 0 && {\n \"--tree-guide-origin\": `${INDENT_GUIDE_ORIGIN_PX}px`,\n \"--tree-guide-step\": `${INDENT_STEP_PX}px`,\n backgroundSize: `${depth * INDENT_STEP_PX}px 100%`,\n backgroundRepeat: \"no-repeat\",\n }),\n } as CSSProperties,\n };\n\n const content = (\n <>\n {isSelected && (\n // The accent bar. A selected row used to differ from its\n // neighbours by a background tint alone, which several themes\n // render almost invisibly.\n <span\n aria-hidden\n className=\"bg-primary pointer-events-none absolute inset-y-0 start-0 w-0.5\"\n />\n )}\n {node.branch ? (\n <button\n type=\"button\"\n tabIndex={-1}\n aria-hidden\n onClick={handleToggle}\n className=\"flex h-3.5 shrink-0 items-center justify-center\"\n style={{ width: DISCLOSURE_BOX_PX }}\n >\n {isCollapsed ? (\n <ChevronRight className=\"size-3 opacity-60 rtl:-scale-x-100\" />\n ) : (\n <ChevronDown className=\"size-3 opacity-60\" />\n )}\n </button>\n ) : (\n <span\n className=\"inline-block shrink-0\"\n style={{ width: DISCLOSURE_BOX_PX }}\n />\n )}\n {facade.renderIcon(node, state)}\n {props.isRenaming ? (\n <TreeViewRenameInput\n name={node.name}\n onCommit={(name) => facade.commitRename(node.id, name)}\n onCancel={facade.cancelRename}\n />\n ) : (\n /*\n * The label is its OWN element, separate from the row's click\n * handler and from the disclosure button, so a consumer that needs\n * an anchor here one day changes this line rather than the row.\n */\n <span data-slot=\"tree-view-label\" className=\"min-w-0 flex-1 truncate\">\n {facade.renderLabel(node, state)}\n </span>\n )}\n {!props.isRenaming && facade.renderTrailing(node, state)}\n </>\n );\n\n if (!props.hasMenu) return <div {...rowProps}>{content}</div>;\n\n return (\n <ContextMenu>\n <ContextMenuTrigger render={<div {...rowProps} />}>\n {content}\n </ContextMenuTrigger>\n {facade.renderMenu(node)}\n </ContextMenu>\n );\n};\n\n/**\n * How far one level of nesting indents a row, in pixels.\n *\n * Shared by the row's own left padding and by the indent guides drawn behind\n * it, so the two cannot drift: a guide that does not line up with the column\n * it belongs to is worse than no guide.\n */\nexport const INDENT_STEP_PX = 13;\n\n/**\n * The row's own base padding: where a depth-0 row's content starts.\n */\nexport const INDENT_BASE_PX = 8;\n\n/**\n * The width of the disclosure column: the chevron button on a branch, and the\n * spacer that stands in for it on a leaf.\n *\n * Applied as a style rather than a `w-3.5` class **on purpose**: it is also\n * half of {@link INDENT_GUIDE_ORIGIN_PX}, so a class here would let the box be\n * resized while the guides stayed where they were. One number, two consumers,\n * no way to move one without the other.\n */\nexport const DISCLOSURE_BOX_PX = 14;\n\n/**\n * Where the first level's guide is painted.\n *\n * ⚠️ **Not the same as {@link INDENT_BASE_PX}, and it used to be.** The rule\n * is not \"the same number twice\" but \"a guide is centred on the disclosure\n * column of the level it marks\", which is what a reader perceives as aligned.\n * Sharing the row's base padding put every guide 7px to the LEFT of its own\n * chevron, at every depth.\n *\n * Derived rather than typed, because the correction is exactly half the\n * disclosure box: the eyeballed 14 and the computed 15 are both within a pixel\n * of right, and only one of them survives the chevron changing size.\n *\n * ⚠️ The gradient paints its hairline from this x, so the 1px line occupies\n * `[15, 16)` and its own centre is half a pixel right of the chevron's.\n * Deliberate: `14.5` would centre the line exactly and cost the hairline its\n * crispness on a 1x display, which is a worse trade for a 1px rule than half a\n * pixel of offset. Known, not overlooked.\n */\nexport const INDENT_GUIDE_ORIGIN_PX = INDENT_BASE_PX + DISCLOSURE_BOX_PX / 2;\n\n/**\n * Whether a drag carries OS files rather than one of this tree's own rows.\n *\n * `dataTransfer.types` is the only readable signal during `dragover`:\n * `dataTransfer.files` is empty until `drop`, because the browser withholds\n * the bytes so a page cannot read a file merely by being dragged across it.\n * Checking the tree's drag id instead would be wrong in the other direction:\n * it is unset for an external drag, but also unset in the frame before an\n * internal drag's `dragstart` state lands.\n */\nconst isFileDrag = (e: DragEvent<HTMLElement>): boolean =>\n [...e.dataTransfer.types].includes(\"Files\");\n\n/**\n * Memoised, and the props above are shaped so that the DEFAULT shallow\n * comparison is enough: every one of them is a primitive, a node the tree\n * model memoises, or the facade that never changes identity.\n *\n * Before this discipline existed, one toggle re-rendered every visible row\n * along with its handlers: `rows` was already memoised, but each row received\n * the whole tree-state object, which is rebuilt on every render along with all\n * of its callbacks. Now a toggle re-renders only the rows whose own props\n * changed: the branch that opened, plus the rows that appeared or disappeared\n * beneath it.\n *\n * ⚠️ A prop added here must be shallow-comparable, or the memo silently stops\n * holding and nothing goes red. Anything that is not a primitive belongs on\n * the facade.\n */\nexport const TreeViewRow = memo(TreeViewRowImpl) as typeof TreeViewRowImpl;\n\n/**\n * The image dragged under the pointer: a compact label of the row's name,\n * not the browser's snapshot of the whole row with its indent and trailing\n * icons. Built off-screen, handed to the browser, and removed on the next\n * frame, once the browser has rendered it.\n */\nconst setDragLabel = (e: DragEvent<HTMLDivElement>): void => {\n if (typeof e.dataTransfer.setDragImage !== \"function\") return;\n const text = e.currentTarget.textContent?.trim() ?? \"\";\n if (!text) return;\n const label = document.createElement(\"div\");\n label.textContent = text;\n const style = getComputedStyle(e.currentTarget);\n Object.assign(label.style, {\n position: \"fixed\",\n top: \"-1000px\",\n left: \"-1000px\",\n maxWidth: \"240px\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n padding: \"2px 8px\",\n borderRadius: \"6px\",\n font: style.font,\n color: style.color,\n background: \"var(--popover, white)\",\n boxShadow: \"0 1px 3px rgb(0 0 0 / 0.2)\",\n });\n document.body.appendChild(label);\n e.dataTransfer.setDragImage(label, -12, -8);\n requestAnimationFrame(() => label.remove());\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoJA,MAAM,mBAAuB,UAA6C;CACxE,MAAM,EAAE,MAAM,OAAO,QAAQ,aAAa,eAAe;CACzD,MAAM,QAAsB;EAC1B,WAAW;EACX,UAAU;EACV,UAAU,MAAM;EAChB,UAAU,MAAM;CAClB;;;;;;;;;;;CAYA,MAAM,eAAe,MAAwB;EAC3C,IAAI,MAAM,YAAY;EACtB,IAAI,EAAE,SAAS,GAAG;EAClB,OAAO,OAAO,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC;CAC3C;CAEA,MAAM,iBAAiB,MAA2B;EAChD,IAAI,MAAM,YAAY;EACtB,IAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,KAAK;EACxC,EAAE,eAAe;EACjB,OAAO,OAAO,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC;CAC3C;CAEA,MAAM,gBAAgB,MAAwB;EAC5C,E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AC,oBAAD;EAAoB,QAAQ,oBAAC,OAAD,EAAK,GAAI,SAAW,CAAA;EAC7C,UAAA;CACiB,CAAA,GACnB,OAAO,WAAW,IAAI,CACZ,EAAA,CAAA;AAEjB;;;;;;;;AASA,MAAa,iBAAiB;;;;AAK9B,MAAa,iBAAiB;;;;;;;;;;AAW9B,MAAa,oBAAoB;;;;;;;;;;;;;;;;;;;;AAqBjC,MAAa,yBAAyB;;;;;;;;;;;AAYtC,MAAM,cAAc,MAClB,CAAC,GAAG,EAAE,aAAa,KAAK,CAAC,CAAC,SAAS,OAAO;;;;;;;;;;;;;;;;;AAkB5C,MAAa,cAAc,KAAK,eAAe;;;;;;;AAQ/C,MAAM,gBAAgB,MAAuC;CAC3D,IAAI,OAAO,EAAE,aAAa,iBAAiB,YAAY;CACvD,MAAM,OAAO,EAAE,cAAc,aAAa,KAAK,KAAK;CACpD,IAAI,CAAC,MAAM;CACX,MAAM,QAAQ,SAAS,cAAc,KAAK;CAC1C,MAAM,cAAc;CACpB,MAAM,QAAQ,iBAAiB,EAAE,aAAa;CAC9C,OAAO,OAAO,MAAM,OAAO;EACzB,UAAU;EACV,KAAK;EACL,MAAM;EACN,UAAU;EACV,UAAU;EACV,cAAc;EACd,YAAY;EACZ,SAAS;EACT,cAAc;EACd,MAAM,MAAM;EACZ,OAAO,MAAM;EACb,YAAY;EACZ,WAAW;CACb,CAAC;CACD,SAAS,KAAK,YAAY,KAAK;CAC/B,EAAE,aAAa,aAAa,OAAO,KAAK,EAAE;CAC1C,4BAA4B,MAAM,OAAO,CAAC;AAC5C"}
|
package/dist/tree/index.d.ts
CHANGED
|
@@ -4,14 +4,13 @@
|
|
|
4
4
|
* `treeModel`'s functions are the pure half: build, flatten, cycle-safe parents
|
|
5
5
|
* and drop resolution. `TreeView` draws the rows with their indent guides and
|
|
6
6
|
* ARIA tree roles; drag and drop, inline rename and a context-menu slot are
|
|
7
|
-
* opt-ins. `useTreeState` holds the gesture state
|
|
8
|
-
*
|
|
7
|
+
* opt-ins. `useTreeState` holds the gesture state; the pane handle is
|
|
8
|
+
* `PaneResizer`, in the core entry.
|
|
9
9
|
*
|
|
10
10
|
* @module alepha.ui.tree
|
|
11
11
|
*/
|
|
12
|
-
export { buildTree, findNode, flattenTree, nodeHolds, resolveDrop, type TreeDropPosition, type TreeDropTarget, type TreeItem, type TreeNode, type TreeRow, } from "./treeModel.ts";
|
|
12
|
+
export { buildTree, dropContainerOf, findNode, flattenTree, nodeHolds, resolveDrop, TREE_ROOT_ID, type TreeDropPosition, type TreeDropTarget, type TreeItem, type TreeNode, type TreeRow, } from "./treeModel.ts";
|
|
13
13
|
export { type TreeRowState, TreeView, type TreeViewProps, } from "./TreeView.tsx";
|
|
14
14
|
export { type TreeSelectOptions } from "./TreeViewRow.tsx";
|
|
15
|
-
export { TREE_VIEW_DEFAULT_WIDTH, TREE_VIEW_MAX_WIDTH, TREE_VIEW_MIN_WIDTH, TreeViewResizer, type TreeViewResizerProps, } from "./TreeViewResizer.tsx";
|
|
16
15
|
export { type TreeState, type TreeStateCommands, useTreeState, type UseTreeStateOptions, } from "./useTreeState.ts";
|
|
17
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/tree/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tree/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,SAAS,EACT,QAAQ,EACR,WAAW,EACX,SAAS,EACT,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,OAAO,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,YAAY,EACjB,QAAQ,EACR,KAAK,aAAa,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tree/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,SAAS,EACT,eAAe,EACf,QAAQ,EACR,WAAW,EACX,SAAS,EACT,WAAW,EACX,YAAY,EACZ,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,OAAO,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,YAAY,EACjB,QAAQ,EACR,KAAK,aAAa,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EACL,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,YAAY,EACZ,KAAK,mBAAmB,GACzB,MAAM,mBAAmB,CAAC"}
|
package/dist/tree/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { buildTree, findNode, flattenTree, nodeHolds, resolveDrop } from "./treeModel.js";
|
|
1
|
+
import { TREE_ROOT_ID, buildTree, dropContainerOf, findNode, flattenTree, nodeHolds, resolveDrop } from "./treeModel.js";
|
|
2
2
|
import { TreeView } from "./TreeView.js";
|
|
3
|
-
import { TREE_VIEW_DEFAULT_WIDTH, TREE_VIEW_MAX_WIDTH, TREE_VIEW_MIN_WIDTH, TreeViewResizer } from "./TreeViewResizer.js";
|
|
4
3
|
import { useTreeState } from "./useTreeState.js";
|
|
5
|
-
export {
|
|
4
|
+
export { TREE_ROOT_ID, TreeView, buildTree, dropContainerOf, findNode, flattenTree, nodeHolds, resolveDrop, useTreeState };
|