@uninterface/backend-element-plus 0.0.0-stage → 2.14.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/LICENSE +21 -0
- package/README.md +61 -2
- package/THIRD-PARTY-NOTICES.md +37 -0
- package/capabilities.json +168 -0
- package/docs/README.md +47 -0
- package/docs/collections.md +211 -0
- package/docs/contract-adaptations.md +111 -0
- package/docs/customization.md +131 -0
- package/docs/examples/NativeReference.vue +147 -0
- package/docs/exports.md +32 -0
- package/docs/floating-panels.md +53 -0
- package/docs/font-licenses/inter.txt +93 -0
- package/docs/font-licenses/noto-sans-sc.txt +93 -0
- package/docs/font-licenses/noto-sans-tc.txt +93 -0
- package/docs/icon-licenses/Element-Plus.txt +21 -0
- package/docs/icon-licenses/SOURCES.md +47 -0
- package/docs/modals.md +29 -0
- package/docs/native-html.md +21 -0
- package/docs/navigation.md +31 -0
- package/docs/package-build.md +20 -0
- package/docs/presentation.md +291 -0
- package/docs/progress.md +9 -0
- package/docs/reviewed-components.md +76 -0
- package/docs/segmented-selection.md +22 -0
- package/docs/selection-feedback-panels.md +79 -0
- package/docs/setup.md +159 -0
- package/docs/strategies.md +89 -0
- package/docs/table-columns.md +37 -0
- package/docs/testing.md +44 -0
- package/docs/typography.md +93 -0
- package/document.css +102 -0
- package/esm/_virtual/_plugin-vue_export-helper.js +10 -0
- package/esm/capabilities.json.js +14 -0
- package/esm/package.json.js +14 -0
- package/esm/src/ChoiceGroup.css +23 -0
- package/esm/src/ChoiceGroup.vue.js +8 -0
- package/esm/src/ChoiceGroup2.vue.js +221 -0
- package/esm/src/CollectionCard.vue.js +4 -0
- package/esm/src/CollectionCard2.vue.js +199 -0
- package/esm/src/CollectionFilterEditor.vue.js +4 -0
- package/esm/src/CollectionFilterEditor2.vue.js +31 -0
- package/esm/src/CollectionHeaderFlow.vue.js +4 -0
- package/esm/src/CollectionHeaderFlow2.vue.js +33 -0
- package/esm/src/CollectionHeaderPart.vue.js +4 -0
- package/esm/src/CollectionHeaderPart2.vue.js +40 -0
- package/esm/src/CollectionQueryBadge.vue.js +4 -0
- package/esm/src/CollectionQueryBadge2.vue.js +86 -0
- package/esm/src/CollectionSortLayout.vue.js +4 -0
- package/esm/src/CollectionSortLayout2.vue.js +23 -0
- package/esm/src/CollectionStatus.vue.js +4 -0
- package/esm/src/CollectionStatus2.vue.js +135 -0
- package/esm/src/CollectionSummary.vue.js +4 -0
- package/esm/src/CollectionSummary2.vue.js +70 -0
- package/esm/src/CollectionTableActions.vue.js +13 -0
- package/esm/src/DrawerDepth.vue.js +4 -0
- package/esm/src/DrawerDepth2.vue.js +28 -0
- package/esm/src/DrawerDock.vue.js +4 -0
- package/esm/src/DrawerDock2.vue.js +26 -0
- package/esm/src/EntryBranch.vue.js +4 -0
- package/esm/src/EntryBranch2.vue.js +357 -0
- package/esm/src/EntryContent.css +10 -0
- package/esm/src/EntryContent.vue.js +8 -0
- package/esm/src/EntryContent2.vue.js +79 -0
- package/esm/src/EntryPopup.vue.js +4 -0
- package/esm/src/EntryPopup2.vue.js +164 -0
- package/esm/src/FeedbackItem.vue.js +4 -0
- package/esm/src/FeedbackItem2.vue.js +145 -0
- package/esm/src/FeedbackViewport.vue.js +4 -0
- package/esm/src/FeedbackViewport2.vue.js +42 -0
- package/esm/src/FieldError.vue.js +4 -0
- package/esm/src/FieldError2.vue.js +34 -0
- package/esm/src/FieldFailureTooltip.vue.js +4 -0
- package/esm/src/FieldFailureTooltip2.vue.js +96 -0
- package/esm/src/FileTypeIcon.vue.js +4 -0
- package/esm/src/FileTypeIcon2.vue.js +32 -0
- package/esm/src/FooterActions.vue.js +16 -0
- package/esm/src/MenuBridge.vue.js +4 -0
- package/esm/src/MenuBridge2.vue.js +68 -0
- package/esm/src/NativeMenu.vue.js +4 -0
- package/esm/src/NativeMenu2.vue.js +90 -0
- package/esm/src/OverlaySurface.vue.js +4 -0
- package/esm/src/OverlaySurface2.vue.js +195 -0
- package/esm/src/TableAddRow.vue.js +4 -0
- package/esm/src/TableAddRow2.vue.js +66 -0
- package/esm/src/TableFilterButton.vue.js +4 -0
- package/esm/src/TableFilterButton2.vue.js +35 -0
- package/esm/src/TemporalAction.vue.js +4 -0
- package/esm/src/TemporalAction2.vue.js +46 -0
- package/esm/src/TemporalEditor.vue.js +4 -0
- package/esm/src/TemporalEditor2.vue.js +113 -0
- package/esm/src/TemporalInput.vue.js +4 -0
- package/esm/src/TemporalInput2.vue.js +269 -0
- package/esm/src/TemporalMode.vue.js +4 -0
- package/esm/src/TemporalMode2.vue.js +149 -0
- package/esm/src/TemporalPicker.vue.js +4 -0
- package/esm/src/TemporalPicker2.vue.js +155 -0
- package/esm/src/TemporalRangeIcon.vue.js +4 -0
- package/esm/src/TemporalRangeIcon2.vue.js +67 -0
- package/esm/src/TemporalRangePicker.vue.js +4 -0
- package/esm/src/TemporalRangePicker2.vue.js +199 -0
- package/esm/src/TemporalTimePanel.vue.js +4 -0
- package/esm/src/TemporalTimePanel2.vue.js +53 -0
- package/esm/src/UiApp.vue.js +4 -0
- package/esm/src/UiApp2.vue.js +57 -0
- package/esm/src/UiBadge.vue.js +4 -0
- package/esm/src/UiBadge2.vue.js +44 -0
- package/esm/src/UiBreadcrumbs.css +7 -0
- package/esm/src/UiBreadcrumbs.vue.js +8 -0
- package/esm/src/UiBreadcrumbs2.vue.js +110 -0
- package/esm/src/UiButton.vue.js +4 -0
- package/esm/src/UiButton2.vue.js +167 -0
- package/esm/src/UiCard.vue.js +4 -0
- package/esm/src/UiCard2.vue.js +102 -0
- package/esm/src/UiCheckbox.vue.js +4 -0
- package/esm/src/UiCheckbox2.vue.js +105 -0
- package/esm/src/UiCheckboxGroup.vue.js +4 -0
- package/esm/src/UiCheckboxGroup2.vue.js +43 -0
- package/esm/src/UiCollapsible.css +7 -0
- package/esm/src/UiCollapsible.vue.js +8 -0
- package/esm/src/UiCollapsible2.vue.js +59 -0
- package/esm/src/UiCollectionFooter.vue.js +4 -0
- package/esm/src/UiCollectionFooter2.vue.js +64 -0
- package/esm/src/UiCollectionHeader.vue.js +4 -0
- package/esm/src/UiCollectionHeader2.vue.js +24 -0
- package/esm/src/UiCollectionView.vue.js +4 -0
- package/esm/src/UiCollectionView2.vue.js +239 -0
- package/esm/src/UiContent.vue.js +4 -0
- package/esm/src/UiContent2.vue.js +35 -0
- package/esm/src/UiDateInput.vue.js +4 -0
- package/esm/src/UiDateInput2.vue.js +46 -0
- package/esm/src/UiDateTimeInput.vue.js +4 -0
- package/esm/src/UiDateTimeInput2.vue.js +46 -0
- package/esm/src/UiDrawer.vue.js +4 -0
- package/esm/src/UiDrawer2.vue.js +98 -0
- package/esm/src/UiDrawerLayout.vue.js +4 -0
- package/esm/src/UiDrawerLayout2.vue.js +63 -0
- package/esm/src/UiEmpty.vue.js +4 -0
- package/esm/src/UiEmpty2.vue.js +51 -0
- package/esm/src/UiField.vue.js +4 -0
- package/esm/src/UiField2.vue.js +172 -0
- package/esm/src/UiFileCollection.vue.js +4 -0
- package/esm/src/UiFileCollection2.vue.js +54 -0
- package/esm/src/UiFileInput.vue.js +4 -0
- package/esm/src/UiFileInput2.vue.js +138 -0
- package/esm/src/UiFilePreview.vue.js +4 -0
- package/esm/src/UiFilePreview2.vue.js +104 -0
- package/esm/src/UiFloating.vue.js +4 -0
- package/esm/src/UiFloating2.vue.js +108 -0
- package/esm/src/UiForm.vue.js +4 -0
- package/esm/src/UiForm2.vue.js +47 -0
- package/esm/src/UiIcon.css +7 -0
- package/esm/src/UiIcon.vue.js +8 -0
- package/esm/src/UiIcon2.vue.js +27 -0
- package/esm/src/UiImagePreview.vue.js +4 -0
- package/esm/src/UiImagePreview2.vue.js +92 -0
- package/esm/src/UiInputFrame.vue.js +4 -0
- package/esm/src/UiInputFrame2.vue.js +62 -0
- package/esm/src/UiInputFrameSpacer.vue.js +4 -0
- package/esm/src/UiInputFrameSpacer2.vue.js +20 -0
- package/esm/src/UiKeyValueItem.vue.js +4 -0
- package/esm/src/UiKeyValueItem2.vue.js +29 -0
- package/esm/src/UiKeyValueList.vue.js +4 -0
- package/esm/src/UiKeyValueList2.vue.js +17 -0
- package/esm/src/UiLayout.vue.js +4 -0
- package/esm/src/UiLayout2.vue.js +156 -0
- package/esm/src/UiLink.vue.js +4 -0
- package/esm/src/UiLink2.vue.js +43 -0
- package/esm/src/UiList.vue.js +4 -0
- package/esm/src/UiList2.vue.js +247 -0
- package/esm/src/UiLoadingIndicator.vue.js +4 -0
- package/esm/src/UiLoadingIndicator2.vue.js +53 -0
- package/esm/src/UiLoadingRegion.vue.js +4 -0
- package/esm/src/UiLoadingRegion2.vue.js +100 -0
- package/esm/src/UiMenu.vue.js +4 -0
- package/esm/src/UiMenu2.vue.js +70 -0
- package/esm/src/UiModal.vue.js +4 -0
- package/esm/src/UiModal2.vue.js +145 -0
- package/esm/src/UiMultiSelect.vue.js +4 -0
- package/esm/src/UiMultiSelect2.vue.js +224 -0
- package/esm/src/UiNavMenu.vue.js +4 -0
- package/esm/src/UiNavMenu2.vue.js +86 -0
- package/esm/src/UiNavbar.vue.js +4 -0
- package/esm/src/UiNavbar2.vue.js +37 -0
- package/esm/src/UiNotice.vue.js +4 -0
- package/esm/src/UiNotice2.vue.js +186 -0
- package/esm/src/UiPaginator.vue.js +4 -0
- package/esm/src/UiPaginator2.vue.js +260 -0
- package/esm/src/UiPaginatorJumper.vue.js +4 -0
- package/esm/src/UiPaginatorJumper2.vue.js +90 -0
- package/esm/src/UiPaginatorSizeSelect.vue.js +4 -0
- package/esm/src/UiPaginatorSizeSelect2.vue.js +60 -0
- package/esm/src/UiPopover.vue.js +4 -0
- package/esm/src/UiPopover2.vue.js +93 -0
- package/esm/src/UiPreviewRegion.vue.js +4 -0
- package/esm/src/UiPreviewRegion2.vue.js +62 -0
- package/esm/src/UiProgressBar.vue.js +4 -0
- package/esm/src/UiProgressBar2.vue.js +44 -0
- package/esm/src/UiRadioGroup.vue.js +4 -0
- package/esm/src/UiRadioGroup2.vue.js +43 -0
- package/esm/src/UiRegionLayout.vue.js +4 -0
- package/esm/src/UiRegionLayout2.vue.js +106 -0
- package/esm/src/UiSegmentedSelect.css +72 -0
- package/esm/src/UiSegmentedSelect.vue.js +8 -0
- package/esm/src/UiSegmentedSelect2.vue.js +190 -0
- package/esm/src/UiSelect.vue.js +4 -0
- package/esm/src/UiSelect2.vue.js +209 -0
- package/esm/src/UiSuggestions.vue.js +4 -0
- package/esm/src/UiSuggestions2.vue.js +151 -0
- package/esm/src/UiSwitch.vue.js +4 -0
- package/esm/src/UiSwitch2.vue.js +108 -0
- package/esm/src/UiTabPanel.vue.js +4 -0
- package/esm/src/UiTabPanel2.vue.js +40 -0
- package/esm/src/UiTable.vue.js +4 -0
- package/esm/src/UiTable2.vue.js +740 -0
- package/esm/src/UiTabs.vue.js +4 -0
- package/esm/src/UiTabs2.vue.js +85 -0
- package/esm/src/UiTextInput.vue.js +4 -0
- package/esm/src/UiTextInput2.vue.js +108 -0
- package/esm/src/UiTimeInput.vue.js +4 -0
- package/esm/src/UiTimeInput2.vue.js +46 -0
- package/esm/src/UiTooltip.vue.js +4 -0
- package/esm/src/UiTooltip2.vue.js +72 -0
- package/esm/src/UiUploadProgress.vue.js +4 -0
- package/esm/src/UiUploadProgress2.vue.js +134 -0
- package/esm/src/UiUploadRegion.vue.js +4 -0
- package/esm/src/UiUploadRegion2.vue.js +230 -0
- package/esm/src/checkableDescription.js +104 -0
- package/esm/src/controlSize.js +29 -0
- package/esm/src/fieldPresentation.js +50 -0
- package/esm/src/focus.js +6 -0
- package/esm/src/formPresentation.js +6 -0
- package/esm/src/icons/external-link.vue.js +32 -0
- package/esm/src/icons/globe.vue.js +59 -0
- package/esm/src/icons/index.js +67 -0
- package/esm/src/icons/more-vertical.vue.js +13 -0
- package/esm/src/icons/more-vertical2.vue.js +4 -0
- package/esm/src/index.js +18 -0
- package/esm/src/integration.js +45 -0
- package/esm/src/layout.js +13 -0
- package/esm/src/menuPresentation.js +229 -0
- package/esm/src/navigationDropdownHeight.js +43 -0
- package/esm/src/selectEscape.js +11 -0
- package/esm/src/zOrder.js +17 -0
- package/esm/testing/browser-control-parts.js +25 -0
- package/esm/testing/dom.js +48 -0
- package/esm/testing/index.js +120 -0
- package/esm/testing/presentation-mapping.js +45 -0
- package/esm/testing/presentation-parts.js +49 -0
- package/font-bundled.css +6 -0
- package/font-family.css +23 -0
- package/font.css +6 -0
- package/hooks/vite.d.mts +3 -0
- package/hooks/vite.mjs +178 -0
- package/native-content.css +52 -0
- package/package.json +83 -4
- package/style.css +3549 -0
- package/types/src/ChoiceGroup.vue.d.ts +15 -0
- package/types/src/CollectionCard.vue.d.ts +42 -0
- package/types/src/CollectionFilterEditor.vue.d.ts +16 -0
- package/types/src/CollectionHeaderFlow.vue.d.ts +17 -0
- package/types/src/CollectionHeaderPart.vue.d.ts +24 -0
- package/types/src/CollectionQueryBadge.vue.d.ts +26 -0
- package/types/src/CollectionSortLayout.vue.d.ts +17 -0
- package/types/src/CollectionStatus.vue.d.ts +28 -0
- package/types/src/CollectionSummary.vue.d.ts +22 -0
- package/types/src/CollectionTableActions.vue.d.ts +13 -0
- package/types/src/DrawerDepth.vue.d.ts +7 -0
- package/types/src/DrawerDock.vue.d.ts +17 -0
- package/types/src/EntryBranch.vue.d.ts +31 -0
- package/types/src/EntryContent.vue.d.ts +35 -0
- package/types/src/EntryPopup.vue.d.ts +24 -0
- package/types/src/FeedbackItem.vue.d.ts +16 -0
- package/types/src/FeedbackViewport.vue.d.ts +19 -0
- package/types/src/FieldError.vue.d.ts +9 -0
- package/types/src/FieldFailureTooltip.vue.d.ts +17 -0
- package/types/src/FileTypeIcon.vue.d.ts +6 -0
- package/types/src/FooterActions.vue.d.ts +13 -0
- package/types/src/MenuBridge.vue.d.ts +13 -0
- package/types/src/NativeMenu.vue.d.ts +44 -0
- package/types/src/OverlaySurface.vue.d.ts +38 -0
- package/types/src/TableAddRow.vue.d.ts +18 -0
- package/types/src/TableFilterButton.vue.d.ts +7 -0
- package/types/src/TemporalAction.vue.d.ts +13 -0
- package/types/src/TemporalEditor.vue.d.ts +12 -0
- package/types/src/TemporalInput.vue.d.ts +9 -0
- package/types/src/TemporalMode.vue.d.ts +20 -0
- package/types/src/TemporalPicker.vue.d.ts +10 -0
- package/types/src/TemporalRangeIcon.vue.d.ts +7 -0
- package/types/src/TemporalRangePicker.vue.d.ts +17 -0
- package/types/src/TemporalTimePanel.vue.d.ts +14 -0
- package/types/src/UiApp.vue.d.ts +18 -0
- package/types/src/UiBadge.vue.d.ts +14 -0
- package/types/src/UiBreadcrumbs.vue.d.ts +24 -0
- package/types/src/UiButton.vue.d.ts +22 -0
- package/types/src/UiCard.vue.d.ts +24 -0
- package/types/src/UiCheckbox.vue.d.ts +10 -0
- package/types/src/UiCheckboxGroup.vue.d.ts +12 -0
- package/types/src/UiCollapsible.vue.d.ts +20 -0
- package/types/src/UiCollectionFooter.vue.d.ts +15 -0
- package/types/src/UiCollectionHeader.vue.d.ts +14 -0
- package/types/src/UiCollectionView.vue.d.ts +56 -0
- package/types/src/UiContent.vue.d.ts +14 -0
- package/types/src/UiDateInput.vue.d.ts +6 -0
- package/types/src/UiDateTimeInput.vue.d.ts +6 -0
- package/types/src/UiDrawer.vue.d.ts +40 -0
- package/types/src/UiDrawerLayout.vue.d.ts +16 -0
- package/types/src/UiEmpty.vue.d.ts +18 -0
- package/types/src/UiField.vue.d.ts +17 -0
- package/types/src/UiFileCollection.vue.d.ts +16 -0
- package/types/src/UiFileInput.vue.d.ts +6 -0
- package/types/src/UiFilePreview.vue.d.ts +6 -0
- package/types/src/UiFloating.vue.d.ts +14 -0
- package/types/src/UiForm.vue.d.ts +25 -0
- package/types/src/UiIcon.vue.d.ts +14 -0
- package/types/src/UiImagePreview.vue.d.ts +4 -0
- package/types/src/UiInputFrame.vue.d.ts +26 -0
- package/types/src/UiInputFrameSpacer.vue.d.ts +3 -0
- package/types/src/UiKeyValueItem.vue.d.ts +14 -0
- package/types/src/UiKeyValueList.vue.d.ts +13 -0
- package/types/src/UiLayout.vue.d.ts +17 -0
- package/types/src/UiLink.vue.d.ts +16 -0
- package/types/src/UiList.vue.d.ts +49 -0
- package/types/src/UiLoadingIndicator.vue.d.ts +14 -0
- package/types/src/UiLoadingRegion.vue.d.ts +17 -0
- package/types/src/UiMenu.vue.d.ts +59 -0
- package/types/src/UiModal.vue.d.ts +27 -0
- package/types/src/UiMultiSelect.vue.d.ts +16 -0
- package/types/src/UiNavMenu.vue.d.ts +36 -0
- package/types/src/UiNavbar.vue.d.ts +17 -0
- package/types/src/UiNotice.vue.d.ts +18 -0
- package/types/src/UiPaginator.vue.d.ts +4 -0
- package/types/src/UiPaginatorJumper.vue.d.ts +4 -0
- package/types/src/UiPaginatorSizeSelect.vue.d.ts +4 -0
- package/types/src/UiPopover.vue.d.ts +40 -0
- package/types/src/UiPreviewRegion.vue.d.ts +14 -0
- package/types/src/UiProgressBar.vue.d.ts +4 -0
- package/types/src/UiRadioGroup.vue.d.ts +12 -0
- package/types/src/UiRegionLayout.vue.d.ts +21 -0
- package/types/src/UiSegmentedSelect.vue.d.ts +12 -0
- package/types/src/UiSelect.vue.d.ts +14 -0
- package/types/src/UiSuggestions.vue.d.ts +37 -0
- package/types/src/UiSwitch.vue.d.ts +10 -0
- package/types/src/UiTabPanel.vue.d.ts +14 -0
- package/types/src/UiTable.vue.d.ts +90 -0
- package/types/src/UiTabs.vue.d.ts +20 -0
- package/types/src/UiTextInput.vue.d.ts +24 -0
- package/types/src/UiTimeInput.vue.d.ts +6 -0
- package/types/src/UiTooltip.vue.d.ts +25 -0
- package/types/src/UiUploadProgress.vue.d.ts +4 -0
- package/types/src/UiUploadRegion.vue.d.ts +6 -0
- package/types/src/checkableDescription.d.ts +7 -0
- package/types/src/controlSize.d.ts +2 -0
- package/types/src/fieldPresentation.d.ts +50 -0
- package/types/src/focus.d.ts +3 -0
- package/types/src/formPresentation.d.ts +3 -0
- package/types/src/icons/external-link.vue.d.ts +3 -0
- package/types/src/icons/globe.vue.d.ts +3 -0
- package/types/src/icons/index.d.ts +181 -0
- package/types/src/icons/more-vertical.vue.d.ts +3 -0
- package/types/src/index.d.ts +2 -0
- package/types/src/integration.d.ts +1426 -0
- package/types/src/layout.d.ts +2 -0
- package/types/src/menuPresentation.d.ts +30 -0
- package/types/src/navigationDropdownHeight.d.ts +3 -0
- package/types/src/selectEscape.d.ts +1 -0
- package/types/src/zOrder.d.ts +3 -0
- package/types/testing/browser-control-parts.d.ts +2 -0
- package/types/testing/dom.d.mts +3 -0
- package/types/testing/index.d.ts +3 -0
- package/types/testing/presentation-mapping.d.ts +33 -0
- package/types/testing/presentation-parts.d.mts +20 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { computed, onMounted, onActivated, onDeactivated, onUnmounted, onBeforeUnmount, provide, nextTick } from "vue";
|
|
2
|
+
const entryIndex = (key) => `entry:${key}`;
|
|
3
|
+
const menuPresentationKey = /* @__PURE__ */ Symbol(
|
|
4
|
+
"element-menu-presentation"
|
|
5
|
+
);
|
|
6
|
+
const commandCheckColumnKey = /* @__PURE__ */ Symbol("element-command-check-column");
|
|
7
|
+
function useMenuPresentation(entries, navigation, emit, mode = () => "horizontal") {
|
|
8
|
+
const surfaces = /* @__PURE__ */ new Map();
|
|
9
|
+
const nodes = computed(() => {
|
|
10
|
+
const result = [];
|
|
11
|
+
function visit(items2) {
|
|
12
|
+
for (const node of items2) {
|
|
13
|
+
result.push(node);
|
|
14
|
+
if (node.children) visit(node.children);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
visit(entries());
|
|
18
|
+
return result;
|
|
19
|
+
});
|
|
20
|
+
const owns = (target) => Boolean(
|
|
21
|
+
target && [...surfaces.values()].some((surface) => {
|
|
22
|
+
const boundary = surface.closest(".el-popper") ?? surface;
|
|
23
|
+
return boundary.contains(target);
|
|
24
|
+
})
|
|
25
|
+
);
|
|
26
|
+
const items = (surface) => [...surface.querySelectorAll("[role^=menuitem]")].filter(
|
|
27
|
+
(item) => item.closest("[role=menu], [role=menubar]") === surface
|
|
28
|
+
);
|
|
29
|
+
function focus(key, last = false) {
|
|
30
|
+
const surface = surfaces.get(key);
|
|
31
|
+
if (!surface) return;
|
|
32
|
+
const candidates = items(surface);
|
|
33
|
+
(last ? candidates.at(-1) : candidates[0] ?? surface)?.focus();
|
|
34
|
+
}
|
|
35
|
+
function tabstops() {
|
|
36
|
+
const root = surfaces.get(void 0);
|
|
37
|
+
if (!root) return;
|
|
38
|
+
for (const child of root.children)
|
|
39
|
+
if (!child.matches("[role^=menuitem]")) child.removeAttribute("tabindex");
|
|
40
|
+
const candidates = items(root);
|
|
41
|
+
const focused = document.activeElement?.closest("[role^=menuitem]");
|
|
42
|
+
if (focused && owns(focused)) {
|
|
43
|
+
root.tabIndex = -1;
|
|
44
|
+
for (const item of candidates) item.tabIndex = item === focused ? 0 : -1;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
root.tabIndex = candidates.length ? -1 : 0;
|
|
48
|
+
if (!candidates.some((item) => item.tabIndex === 0)) {
|
|
49
|
+
if (candidates[0]) candidates[0].tabIndex = 0;
|
|
50
|
+
}
|
|
51
|
+
let found = false;
|
|
52
|
+
for (const item of candidates) {
|
|
53
|
+
if (item.tabIndex !== 0) continue;
|
|
54
|
+
if (found) item.tabIndex = -1;
|
|
55
|
+
found = true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function parent(key) {
|
|
59
|
+
return [...surfaces.values()].flatMap(items).find((item) => item.dataset.entryKey === key);
|
|
60
|
+
}
|
|
61
|
+
async function expand(key, open, moveFocus = false) {
|
|
62
|
+
emit("expand", key, open);
|
|
63
|
+
await nextTick();
|
|
64
|
+
await nextTick();
|
|
65
|
+
if (moveFocus) {
|
|
66
|
+
if (open) focus(key);
|
|
67
|
+
else parent(key)?.focus();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
let search = "";
|
|
71
|
+
let typedAt = 0;
|
|
72
|
+
function keyboard(event) {
|
|
73
|
+
const target = event.target;
|
|
74
|
+
const surface = target.closest("[role=menu], [role=menubar]");
|
|
75
|
+
if (!surface || ![...surfaces.values()].includes(surface)) return;
|
|
76
|
+
const item = target.closest("[role^=menuitem]");
|
|
77
|
+
const candidates = items(surface);
|
|
78
|
+
const index = candidates.indexOf(item);
|
|
79
|
+
const horizontal = navigation && mode() === "horizontal" && !surface.hasAttribute("data-parent");
|
|
80
|
+
const rtl = getComputedStyle(surface).direction === "rtl";
|
|
81
|
+
const forward = rtl ? "ArrowLeft" : "ArrowRight";
|
|
82
|
+
const backward = rtl ? "ArrowRight" : "ArrowLeft";
|
|
83
|
+
const key = item?.dataset.entryKey;
|
|
84
|
+
let destination;
|
|
85
|
+
if (event.key === (horizontal ? forward : "ArrowDown"))
|
|
86
|
+
destination = candidates[(index + 1) % candidates.length];
|
|
87
|
+
else if (event.key === (horizontal ? backward : "ArrowUp"))
|
|
88
|
+
destination = candidates[(index - 1 + candidates.length) % candidates.length];
|
|
89
|
+
else if (event.key === "Home") destination = candidates[0];
|
|
90
|
+
else if (event.key === "End") destination = candidates.at(-1);
|
|
91
|
+
else if (key !== void 0 && item?.hasAttribute("aria-expanded") && item.getAttribute("aria-disabled") !== "true" && (event.key === (horizontal ? "ArrowDown" : forward) || event.key === "Enter" || event.key === " ")) {
|
|
92
|
+
void expand(key, true, true);
|
|
93
|
+
} else if (event.key === "Enter" || event.key === " ") {
|
|
94
|
+
if (item?.getAttribute("aria-disabled") !== "true")
|
|
95
|
+
(item?.querySelector("a[href]") ?? item)?.click();
|
|
96
|
+
} else if (event.key === "Escape" && navigation && mode() === "vertical-tree") {
|
|
97
|
+
return;
|
|
98
|
+
} else if ((event.key === "Escape" || event.key === backward) && surface.dataset.parent !== void 0) {
|
|
99
|
+
void expand(surface.dataset.parent, false, true);
|
|
100
|
+
} else if (event.key === "Escape") {
|
|
101
|
+
for (const node of nodes.value)
|
|
102
|
+
if (node.expanded) emit("expand", node.entry.key, false);
|
|
103
|
+
emit("close");
|
|
104
|
+
} else if (event.key === "Tab") {
|
|
105
|
+
if (mode() === "vertical-tree") return;
|
|
106
|
+
emit("close");
|
|
107
|
+
for (const node of nodes.value)
|
|
108
|
+
if (node.expanded) emit("expand", node.entry.key, false);
|
|
109
|
+
return;
|
|
110
|
+
} else if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
|
|
111
|
+
search = Date.now() - typedAt > 600 ? event.key : search + event.key;
|
|
112
|
+
typedAt = Date.now();
|
|
113
|
+
destination = [
|
|
114
|
+
...candidates.slice(index + 1),
|
|
115
|
+
...candidates.slice(0, index + 1)
|
|
116
|
+
].find(
|
|
117
|
+
(candidate) => (candidate.getAttribute("aria-label") ?? candidate.textContent ?? "").toLocaleLowerCase().startsWith(search.toLocaleLowerCase())
|
|
118
|
+
);
|
|
119
|
+
} else return;
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
event.stopImmediatePropagation();
|
|
122
|
+
destination?.focus();
|
|
123
|
+
}
|
|
124
|
+
function roving(event) {
|
|
125
|
+
const item = event.target;
|
|
126
|
+
if (!owns(item) || !item.matches("[role^=menuitem]")) return;
|
|
127
|
+
for (const surface of surfaces.values())
|
|
128
|
+
for (const candidate of items(surface)) candidate.tabIndex = -1;
|
|
129
|
+
item.tabIndex = 0;
|
|
130
|
+
}
|
|
131
|
+
function outside(event) {
|
|
132
|
+
if (!navigation || mode() === "vertical-tree" || owns(event.target))
|
|
133
|
+
return;
|
|
134
|
+
void nextTick(tabstops);
|
|
135
|
+
for (const node of nodes.value)
|
|
136
|
+
if (node.expanded) emit("expand", node.entry.key, false);
|
|
137
|
+
}
|
|
138
|
+
function releaseFocus(event) {
|
|
139
|
+
for (const [key, surface] of surfaces) {
|
|
140
|
+
if (surface.closest(".el-popper") !== event.target) continue;
|
|
141
|
+
event.preventDefault();
|
|
142
|
+
if (!navigation && key !== void 0 && !nodes.value.some((node) => node.entry.key === key && node.expanded))
|
|
143
|
+
event.stopPropagation();
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function listenRelease() {
|
|
148
|
+
document.addEventListener(
|
|
149
|
+
"focus-trap.focus-after-released",
|
|
150
|
+
releaseFocus,
|
|
151
|
+
true
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
function unlistenRelease() {
|
|
155
|
+
document.removeEventListener(
|
|
156
|
+
"focus-trap.focus-after-released",
|
|
157
|
+
releaseFocus,
|
|
158
|
+
true
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
onMounted(listenRelease);
|
|
162
|
+
onActivated(listenRelease);
|
|
163
|
+
onDeactivated(unlistenRelease);
|
|
164
|
+
onUnmounted(unlistenRelease);
|
|
165
|
+
function listen() {
|
|
166
|
+
document.addEventListener("keydown", keyboard, true);
|
|
167
|
+
document.addEventListener("focusin", roving);
|
|
168
|
+
document.addEventListener("focusin", outside);
|
|
169
|
+
document.addEventListener("pointerdown", outside);
|
|
170
|
+
}
|
|
171
|
+
function unlisten() {
|
|
172
|
+
document.removeEventListener("keydown", keyboard, true);
|
|
173
|
+
document.removeEventListener("focusin", roving);
|
|
174
|
+
document.removeEventListener("focusin", outside);
|
|
175
|
+
document.removeEventListener("pointerdown", outside);
|
|
176
|
+
}
|
|
177
|
+
onMounted(listen);
|
|
178
|
+
onActivated(listen);
|
|
179
|
+
onDeactivated(unlisten);
|
|
180
|
+
onBeforeUnmount(unlisten);
|
|
181
|
+
const presentation = {
|
|
182
|
+
entries,
|
|
183
|
+
navigation,
|
|
184
|
+
persistent: () => mode() === "vertical-tree",
|
|
185
|
+
horizontal: () => mode() === "horizontal",
|
|
186
|
+
rail: () => mode() === "icon-popup",
|
|
187
|
+
tabstops,
|
|
188
|
+
direction() {
|
|
189
|
+
const root = surfaces.get(void 0);
|
|
190
|
+
return root ? getComputedStyle(root).direction === "rtl" ? "rtl" : "ltr" : void 0;
|
|
191
|
+
},
|
|
192
|
+
activate(key) {
|
|
193
|
+
const link = navigation ? parent(key)?.querySelector("a[href]") : void 0;
|
|
194
|
+
if (link) link.click();
|
|
195
|
+
else {
|
|
196
|
+
const node = nodes.value.find((node2) => node2.entry.key === key);
|
|
197
|
+
if (node?.request) node.request();
|
|
198
|
+
else emit("activate", key);
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
link(key, event) {
|
|
202
|
+
if (!event.ctrlKey && !event.metaKey && !event.shiftKey && !event.altKey && event.button === 0) {
|
|
203
|
+
const node = nodes.value.find((node2) => node2.entry.key === key);
|
|
204
|
+
if (node?.request) node.request(event);
|
|
205
|
+
else emit("activate", key);
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
expand: (key, open, moveFocus = false) => {
|
|
209
|
+
void expand(key, open, moveFocus);
|
|
210
|
+
},
|
|
211
|
+
retry: (key) => emit("retry", key),
|
|
212
|
+
register(key, surface) {
|
|
213
|
+
surfaces.set(key, surface);
|
|
214
|
+
void nextTick(tabstops);
|
|
215
|
+
return () => {
|
|
216
|
+
if (surfaces.get(key) === surface) surfaces.delete(key);
|
|
217
|
+
};
|
|
218
|
+
},
|
|
219
|
+
focus
|
|
220
|
+
};
|
|
221
|
+
provide(menuPresentationKey, presentation);
|
|
222
|
+
return { nodes, owns, focus };
|
|
223
|
+
}
|
|
224
|
+
export {
|
|
225
|
+
commandCheckColumnKey,
|
|
226
|
+
entryIndex,
|
|
227
|
+
menuPresentationKey,
|
|
228
|
+
useMenuPresentation
|
|
229
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ref, onActivated, onDeactivated, watchEffect, computed } from "vue";
|
|
2
|
+
function useNavigationDropdownHeight(root, enabled, offset, opened) {
|
|
3
|
+
const height = ref();
|
|
4
|
+
const active = ref(true);
|
|
5
|
+
onActivated(() => active.value = true);
|
|
6
|
+
onDeactivated(() => active.value = false);
|
|
7
|
+
watchEffect((cleanup) => {
|
|
8
|
+
const element = root();
|
|
9
|
+
if (!active.value || !enabled() || !element) {
|
|
10
|
+
height.value = void 0;
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
opened();
|
|
14
|
+
const distance = offset();
|
|
15
|
+
const view = element.ownerDocument.defaultView;
|
|
16
|
+
function measure() {
|
|
17
|
+
const rect = element.getBoundingClientRect();
|
|
18
|
+
const viewport = view.innerHeight;
|
|
19
|
+
const above = rect.top;
|
|
20
|
+
const below = viewport - rect.bottom;
|
|
21
|
+
height.value = Math.max(
|
|
22
|
+
0,
|
|
23
|
+
Math.min(viewport - 16, Math.max(above, below) - distance - 8)
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
measure();
|
|
27
|
+
const observer = new view.ResizeObserver(measure);
|
|
28
|
+
observer.observe(element);
|
|
29
|
+
view.addEventListener("resize", measure);
|
|
30
|
+
view.addEventListener("scroll", measure, true);
|
|
31
|
+
cleanup(() => {
|
|
32
|
+
observer.disconnect();
|
|
33
|
+
view.removeEventListener("resize", measure);
|
|
34
|
+
view.removeEventListener("scroll", measure, true);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
return computed(
|
|
38
|
+
() => height.value === void 0 ? void 0 : `${height.value}px`
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
useNavigationDropdownHeight
|
|
43
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useUiOverlayEscape } from "@uninterface/uninterface/backend";
|
|
2
|
+
function useSelectEscape() {
|
|
3
|
+
const offerEscape = useUiOverlayEscape();
|
|
4
|
+
return (event) => {
|
|
5
|
+
if (event.key === "Escape" && event.target instanceof HTMLInputElement && event.target.matches('input[role="combobox"][aria-expanded="false"]'))
|
|
6
|
+
offerEscape?.(event);
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
useSelectEscape
|
|
11
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function popupTarget(element) {
|
|
2
|
+
if (!element || element.nodeType !== 1) return void 0;
|
|
3
|
+
return element?.closest(".el-popper") ?? element ?? void 0;
|
|
4
|
+
}
|
|
5
|
+
function controlledPopup(id) {
|
|
6
|
+
if (typeof document === "undefined") return;
|
|
7
|
+
const trigger = document.getElementById(id);
|
|
8
|
+
const ids = (trigger?.getAttribute("aria-controls") ?? trigger?.getAttribute("aria-owns") ?? "").split(/\s+/).filter(Boolean);
|
|
9
|
+
for (const id2 of ids) {
|
|
10
|
+
const candidate = document.getElementById(id2);
|
|
11
|
+
if (candidate) return popupTarget(candidate);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
controlledPopup,
|
|
16
|
+
popupTarget
|
|
17
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const browserControlParts = {
|
|
2
|
+
collapsibleTrigger: (scope, name) => scope.getByRole("button", { name, exact: typeof name === "string" }),
|
|
3
|
+
temporalMode: (trigger, value) => ({
|
|
4
|
+
kind: "menu",
|
|
5
|
+
option: trigger.page().locator(`[data-temporal-mode-value="${value}"]:visible`)
|
|
6
|
+
}),
|
|
7
|
+
fileInputName: (root) => ({
|
|
8
|
+
kind: "text",
|
|
9
|
+
control: root.locator("[data-ui-file-name]")
|
|
10
|
+
}),
|
|
11
|
+
fileInput(root, clearName) {
|
|
12
|
+
const clear = root.getByRole("button", { name: clearName, exact: true });
|
|
13
|
+
const frame = root.locator(".element-input-frame");
|
|
14
|
+
return {
|
|
15
|
+
chooser: root.locator("input[type=file]"),
|
|
16
|
+
frame,
|
|
17
|
+
focusedFrame: frame.and(root.locator("[data-focused]")),
|
|
18
|
+
clear,
|
|
19
|
+
clearFocus: { target: clear, kind: "outline" }
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
browserControlParts
|
|
25
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { entryIconColumn, temporalPickerParts, fieldSelectors, fieldGroupParts, cardParts } from "./presentation-parts.js";
|
|
2
|
+
import { uiNativeDomTestAdapter, domFieldFeedbackParts, domFieldParts } from "@uninterface/testing/dom";
|
|
3
|
+
const emptyState = (scope) => {
|
|
4
|
+
const elements = scope.querySelectorAll(".element-empty");
|
|
5
|
+
if (elements.length > 1)
|
|
6
|
+
throw new Error("More than one empty state in the supplied scope.");
|
|
7
|
+
return elements[0] ?? null;
|
|
8
|
+
};
|
|
9
|
+
const uiDomTestAdapter = {
|
|
10
|
+
version: 1,
|
|
11
|
+
card: (card) => cardParts((selector) => card.querySelector(selector)),
|
|
12
|
+
field: (editor) => domFieldParts(editor, fieldSelectors),
|
|
13
|
+
fieldGroup: (group) => fieldGroupParts((selector) => group.querySelector(selector)),
|
|
14
|
+
fieldFeedback: (editor) => domFieldFeedbackParts(editor, fieldSelectors),
|
|
15
|
+
emptyState,
|
|
16
|
+
temporalPicker: (picker) => temporalPickerParts((selector) => picker.querySelector(selector)),
|
|
17
|
+
menuEntryIcon(entry) {
|
|
18
|
+
const column = [...entry.querySelectorAll(entryIconColumn)].find(
|
|
19
|
+
(element) => element.closest("[data-entry-key]") === entry
|
|
20
|
+
) ?? null;
|
|
21
|
+
return { column, icon: column?.firstElementChild ?? null };
|
|
22
|
+
},
|
|
23
|
+
tableBody(scope) {
|
|
24
|
+
return {
|
|
25
|
+
body: scope.querySelector(".el-table__body-wrapper"),
|
|
26
|
+
scrollSurface: scope.querySelector('.el-scrollbar__wrap[role="region"]'),
|
|
27
|
+
emptyState: emptyState(scope),
|
|
28
|
+
errorState: scope.querySelector('[data-collection-failure="initial"]')
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
navigationEntries(scope, kind) {
|
|
32
|
+
return scope.querySelectorAll(
|
|
33
|
+
kind === "submenu" ? '.el-sub-menu[data-entry-key][role="menuitem"]' : '.el-menu-item[data-entry-key][role="menuitem"]:has(a[href])'
|
|
34
|
+
);
|
|
35
|
+
},
|
|
36
|
+
select(control) {
|
|
37
|
+
if (control.tagName === "SELECT")
|
|
38
|
+
return uiNativeDomTestAdapter.select(control);
|
|
39
|
+
return {
|
|
40
|
+
kind: "composite",
|
|
41
|
+
selection: () => control.closest(".el-select")?.querySelector(".el-select__placeholder") ?? null,
|
|
42
|
+
popup: (owned) => owned.closest(".el-select__popper")
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
uiDomTestAdapter
|
|
48
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { uiNativeTestAdapter } from "@uninterface/testing/playwright";
|
|
2
|
+
import { fieldGroupParts, fieldSelectors, cardParts } from "./presentation-parts.js";
|
|
3
|
+
import { presentationParts } from "./presentation-mapping.js";
|
|
4
|
+
import { browserControlParts } from "./browser-control-parts.js";
|
|
5
|
+
const uiTestAdapter = {
|
|
6
|
+
...presentationParts,
|
|
7
|
+
card: (card) => cardParts((selector) => card.locator(selector)),
|
|
8
|
+
fieldGroup(group) {
|
|
9
|
+
const parts = fieldGroupParts((selector) => group.locator(selector));
|
|
10
|
+
const { label } = parts;
|
|
11
|
+
const generated = label;
|
|
12
|
+
return {
|
|
13
|
+
...parts,
|
|
14
|
+
required: {
|
|
15
|
+
elements: label.locator(fieldSelectors.required),
|
|
16
|
+
before: generated,
|
|
17
|
+
after: generated
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
inputFrame: (frame) => ({ surface: frame }),
|
|
22
|
+
buttonFocus: (button) => ({ target: button, kind: "outline" }),
|
|
23
|
+
async checkable(control) {
|
|
24
|
+
const parts = await uiNativeTestAdapter.checkable(control);
|
|
25
|
+
const container = control.locator("xpath=ancestor::*").and(control.page().locator(".el-checkbox,.el-radio,.el-switch")).last();
|
|
26
|
+
const surface = container.locator(
|
|
27
|
+
".el-checkbox__inner,.el-radio__inner,.el-switch__core"
|
|
28
|
+
);
|
|
29
|
+
const text = parts.text.locator(".el-checkbox__label,.el-radio__label");
|
|
30
|
+
return {
|
|
31
|
+
text: await text.count() ? text : parts.text,
|
|
32
|
+
surface: await surface.count() ? surface : control
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
version: 1,
|
|
36
|
+
menuPopup(menu) {
|
|
37
|
+
return menu.locator(
|
|
38
|
+
'xpath=ancestor::*[contains(concat(" ", normalize-space(@class), " "), " el-popper ") and contains(concat(" ", normalize-space(@class), " "), " element-command-popup ")][1]'
|
|
39
|
+
);
|
|
40
|
+
},
|
|
41
|
+
async multiSelect(control) {
|
|
42
|
+
const native = await uiNativeTestAdapter.multiSelect(control);
|
|
43
|
+
return { ...uiTestAdapter.select(control), clear: native.clear };
|
|
44
|
+
},
|
|
45
|
+
choice(group, key, kind) {
|
|
46
|
+
const { control } = uiNativeTestAdapter.choice(group, key, kind);
|
|
47
|
+
return { control, target: control.locator("xpath=ancestor::label[1]") };
|
|
48
|
+
},
|
|
49
|
+
navigationEntry(scope, { name, kind }) {
|
|
50
|
+
return scope.getByRole("menuitem", { name, exact: true }).and(
|
|
51
|
+
scope.locator(
|
|
52
|
+
kind === "submenu" ? ".el-sub-menu[data-entry-key]" : ".el-menu-item[data-entry-key]"
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
},
|
|
56
|
+
modal(dialog) {
|
|
57
|
+
return {
|
|
58
|
+
body: dialog.locator(
|
|
59
|
+
":scope > .element-modal-surface > .element-modal-body"
|
|
60
|
+
),
|
|
61
|
+
actions: dialog.locator(
|
|
62
|
+
":scope > .element-modal-surface > .el-dialog__footer"
|
|
63
|
+
)
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
tableHeaderSeparator: uiNativeTestAdapter.tableHeaderSeparator,
|
|
67
|
+
columnHeaderParts(header) {
|
|
68
|
+
return {
|
|
69
|
+
caption: header.locator(".element-table-header-copy"),
|
|
70
|
+
sortTarget: header.locator("button.caret-wrapper"),
|
|
71
|
+
sortIndicator: header.locator(".caret-wrapper")
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
popoverSurface(dialog) {
|
|
75
|
+
return dialog.locator(
|
|
76
|
+
':scope[data-ui-overlay="popover"] > .element-overlay-content.el-popover'
|
|
77
|
+
);
|
|
78
|
+
},
|
|
79
|
+
async field(control) {
|
|
80
|
+
const parts = await uiNativeTestAdapter.field(control);
|
|
81
|
+
const wrapper = control.locator(
|
|
82
|
+
'xpath=ancestor::*[contains(concat(" ", normalize-space(@class), " "), " el-input__wrapper ") or contains(concat(" ", normalize-space(@class), " "), " el-select__wrapper ")][1]'
|
|
83
|
+
).or(control.locator(".el-segmented"));
|
|
84
|
+
return {
|
|
85
|
+
...parts,
|
|
86
|
+
surface: await wrapper.count() ? wrapper : parts.surface,
|
|
87
|
+
required: {
|
|
88
|
+
...parts.required,
|
|
89
|
+
elements: parts.label.locator(".element-required")
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
checkbox: (control) => control.locator("xpath=ancestor::label[1]"),
|
|
94
|
+
select(control) {
|
|
95
|
+
return {
|
|
96
|
+
kind: "composite",
|
|
97
|
+
trigger: control.locator(
|
|
98
|
+
'xpath=ancestor::*[contains(concat(" ", normalize-space(@class), " "), " el-select ")][1]'
|
|
99
|
+
).locator(".el-select__wrapper"),
|
|
100
|
+
selection: control.locator(
|
|
101
|
+
'xpath=ancestor::*[contains(concat(" ", normalize-space(@class), " "), " el-select ")][1]'
|
|
102
|
+
).locator(".el-select__placeholder"),
|
|
103
|
+
async popup() {
|
|
104
|
+
const id = await control.getAttribute("aria-controls");
|
|
105
|
+
if (!id || /\s/.test(id))
|
|
106
|
+
throw new Error(
|
|
107
|
+
"UiSelect must identify exactly one owned popup through aria-controls."
|
|
108
|
+
);
|
|
109
|
+
const owned = control.page().locator(`[id=${JSON.stringify(id)}]`);
|
|
110
|
+
return owned.locator(
|
|
111
|
+
'xpath=ancestor::*[contains(concat(" ", normalize-space(@class), " "), " el-select__popper ")][1]'
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
export {
|
|
118
|
+
browserControlParts,
|
|
119
|
+
uiTestAdapter
|
|
120
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { browserFieldFeedbackParts } from "@uninterface/testing/playwright";
|
|
2
|
+
import { entryIconColumn, temporalPickerParts, fieldSelectors } from "./presentation-parts.js";
|
|
3
|
+
const presentationParts = {
|
|
4
|
+
fieldFeedback: (editor) => browserFieldFeedbackParts(editor, fieldSelectors.invalid),
|
|
5
|
+
tableBody(table) {
|
|
6
|
+
const scope = table.locator("xpath=ancestor-or-self::*[@data-scroll][1]");
|
|
7
|
+
return {
|
|
8
|
+
body: scope.locator(".el-table__body-wrapper"),
|
|
9
|
+
scrollSurface: scope.locator('.el-scrollbar__wrap[role="region"]'),
|
|
10
|
+
emptyState: scope.locator(".element-empty"),
|
|
11
|
+
errorState: scope.locator('[data-collection-failure="initial"]')
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
feedbackItem(item) {
|
|
15
|
+
return { content: item.locator(".element-feedback-body"), surface: item };
|
|
16
|
+
},
|
|
17
|
+
progressBar(bar) {
|
|
18
|
+
return {
|
|
19
|
+
track: bar.locator(".el-progress-bar__outer"),
|
|
20
|
+
fill: bar.locator(".el-progress-bar__inner")
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
async uploadRegion(region) {
|
|
24
|
+
const surface = region;
|
|
25
|
+
const chooser = region.locator("[data-upload-choose]");
|
|
26
|
+
return {
|
|
27
|
+
surface,
|
|
28
|
+
chooser,
|
|
29
|
+
chooserFocus: await region.getAttribute("data-upload-recovery") !== null ? { target: chooser, kind: "outline" } : { target: surface, kind: "border" }
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
temporalPicker: (picker) => temporalPickerParts((selector) => picker.locator(selector)),
|
|
33
|
+
menuEntryIcon(entry) {
|
|
34
|
+
const column = entry.locator(
|
|
35
|
+
`:is(${entryIconColumn}):not(:scope [data-entry-key] *)`
|
|
36
|
+
);
|
|
37
|
+
return {
|
|
38
|
+
column,
|
|
39
|
+
icon: column.locator(":scope > *")
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
presentationParts
|
|
45
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
function cardParts(find) {
|
|
2
|
+
return {
|
|
3
|
+
header: find(":scope > .el-card__header"),
|
|
4
|
+
body: find(":scope > .el-card__body"),
|
|
5
|
+
footer: find(":scope > .el-card__footer"),
|
|
6
|
+
topEnd: find(":scope > .el-card__body > .element-card-top-end")
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
const fieldSelectors = {
|
|
10
|
+
root: ".element-field",
|
|
11
|
+
surface: ".el-input__wrapper,.el-select__wrapper",
|
|
12
|
+
required: ".element-required",
|
|
13
|
+
invalid: ".el-form-item.is-error, .el-input.is-error, .el-select.is-error"
|
|
14
|
+
};
|
|
15
|
+
function fieldGroupParts(find) {
|
|
16
|
+
return {
|
|
17
|
+
label: find(
|
|
18
|
+
":scope > .el-form-item__label, :scope > .el-form-item__label-wrap > .el-form-item__label"
|
|
19
|
+
),
|
|
20
|
+
controlArea: find(
|
|
21
|
+
":scope > .el-form-item__content, :scope > .element-field-content"
|
|
22
|
+
)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function temporalPickerParts(find) {
|
|
26
|
+
return {
|
|
27
|
+
dateInput: find("input[type=date],input[type=datetime-local]"),
|
|
28
|
+
timeInput: find("input[type=time],input[type=datetime-local]"),
|
|
29
|
+
day(isoDate) {
|
|
30
|
+
return find("td.element-calendar-day-DATE".replaceAll("DATE", isoDate));
|
|
31
|
+
},
|
|
32
|
+
timeSegment(unit) {
|
|
33
|
+
return find(
|
|
34
|
+
".el-time-spinner__wrapper:nth-of-type(UNIT_INDEX)".replace(
|
|
35
|
+
"UNIT_INDEX",
|
|
36
|
+
String(["hour", "minute", "second"].indexOf(unit) + 1)
|
|
37
|
+
)
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const entryIconColumn = ".element-entry-icon";
|
|
43
|
+
export {
|
|
44
|
+
cardParts,
|
|
45
|
+
entryIconColumn,
|
|
46
|
+
fieldGroupParts,
|
|
47
|
+
fieldSelectors,
|
|
48
|
+
temporalPickerParts
|
|
49
|
+
};
|
package/font-bundled.css
ADDED
package/font-family.css
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* Font selection only; native token mapping belongs to style.css. */
|
|
2
|
+
:root,
|
|
3
|
+
body,
|
|
4
|
+
[lang] {
|
|
5
|
+
--uninterface-font-set-family:
|
|
6
|
+
'Inter Variable', 'Noto Sans SC Variable', system-ui, sans-serif;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:root:lang(zh-Hant),
|
|
10
|
+
body:lang(zh-Hant),
|
|
11
|
+
[lang]:lang(zh-Hant),
|
|
12
|
+
:root:lang(zh-TW),
|
|
13
|
+
body:lang(zh-TW),
|
|
14
|
+
[lang]:lang(zh-TW),
|
|
15
|
+
:root:lang(zh-HK),
|
|
16
|
+
body:lang(zh-HK),
|
|
17
|
+
[lang]:lang(zh-HK),
|
|
18
|
+
:root:lang(zh-MO),
|
|
19
|
+
body:lang(zh-MO),
|
|
20
|
+
[lang]:lang(zh-MO) {
|
|
21
|
+
--uninterface-font-set-family:
|
|
22
|
+
'Inter Variable', 'Noto Sans TC Variable', system-ui, sans-serif;
|
|
23
|
+
}
|
package/font.css
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
@import url('https://cdn.jsdelivr.net/npm/@fontsource-variable/inter@5.3.0/wght.css');
|
|
2
|
+
@import url('https://cdn.jsdelivr.net/npm/@fontsource-variable/inter@5.3.0/wght-italic.css');
|
|
3
|
+
@import url('https://cdn.jsdelivr.net/npm/@fontsource-variable/noto-sans-sc@5.3.1/wght.css');
|
|
4
|
+
@import url('https://cdn.jsdelivr.net/npm/@fontsource-variable/noto-sans-tc@5.3.1/wght.css');
|
|
5
|
+
|
|
6
|
+
@import './font-family.css';
|
package/hooks/vite.d.mts
ADDED