frappe-ui 1.0.0-beta.2 → 1.0.0-beta.21
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/experimental/FloatingWindow/FloatingWindow.cy.ts +328 -0
- package/experimental/FloatingWindow/FloatingWindow.vue +303 -0
- package/experimental/FloatingWindow/index.ts +8 -0
- package/experimental/FloatingWindow/types.ts +31 -0
- package/experimental/FloatingWindow/useFloatingWindow.ts +236 -0
- package/experimental/MultiEmailInput/MultiEmailInput.cy.ts +155 -0
- package/experimental/MultiEmailInput/MultiEmailInput.vue +472 -0
- package/experimental/MultiEmailInput/index.ts +17 -0
- package/experimental/MultiEmailInput/stories/AsyncSuggestions.vue +54 -0
- package/experimental/MultiEmailInput/stories/Basic.vue +18 -0
- package/experimental/MultiEmailInput/stories/CustomChip.vue +39 -0
- package/experimental/MultiEmailInput/stories/Labeling.vue +28 -0
- package/experimental/MultiEmailInput/types.ts +138 -0
- package/experimental/MultiEmailInput/utils.ts +60 -0
- package/experimental.ts +12 -0
- package/frappe/Billing/SignupBanner.vue +1 -1
- package/frappe/Billing/TrialBanner.vue +1 -1
- package/frappe/DataImport/DataImport.vue +1 -1
- package/frappe/DataImport/DataImportList.vue +1 -1
- package/frappe/DataImport/ImportSteps.vue +6 -6
- package/frappe/DataImport/MappingStep.vue +1 -1
- package/frappe/DataImport/PreviewStep.vue +9 -9
- package/frappe/DataImport/TemplateModal.vue +1 -1
- package/frappe/DataImport/UploadStep.vue +5 -5
- package/frappe/Filter/Filter.vue +1 -1
- package/frappe/Help/HelpModal.vue +1 -1
- package/frappe/Link/stories/Suffix.vue +2 -2
- package/frappe/Onboarding/GettingStartedBanner.vue +1 -1
- package/frappe/drive/components/AppSwitcher.vue +1 -1
- package/frappe/drive/components/InfoDialog.vue +3 -3
- package/frappe/drive/components/MoveDialog.vue +2 -2
- package/frappe/drive/components/Select/Select.vue +2 -2
- package/frappe/drive/components/ShareDialog.vue +1 -1
- package/frappe/telemetry/index.ts +88 -14
- package/frappe/telemetry/pulse.ts +78 -164
- package/frappe/telemetry/telemetry.test.ts +13 -79
- package/icons/IconPicker.vue +1 -1
- package/package.json +104 -34
- package/src/components/Alert/Alert.md +4 -0
- package/src/components/Alert/Alert.vue +4 -4
- package/src/components/Autocomplete/Autocomplete.vue +6 -6
- package/src/components/Avatar/Avatar.md +4 -0
- package/src/components/Avatar/Avatar.vue +23 -4
- package/src/components/Badge/Badge.api.md +1 -1
- package/src/components/Badge/Badge.cy.ts +34 -16
- package/src/components/Badge/Badge.md +20 -4
- package/src/components/Badge/Badge.vue +60 -45
- package/src/components/Badge/stories/CallMeta.vue +35 -0
- package/src/components/Badge/stories/EventStatus.vue +16 -0
- package/src/components/Badge/stories/ListStatus.vue +91 -0
- package/src/components/Badge/stories/Reactions.vue +33 -0
- package/src/components/Badge/stories/RowTags.vue +39 -0
- package/src/components/Badge/types.ts +1 -2
- package/src/components/BottomSheet/BottomSheet.api.md +57 -0
- package/src/components/BottomSheet/BottomSheet.vue +232 -0
- package/src/components/BottomSheet/index.ts +6 -0
- package/src/components/BottomSheet/types.ts +23 -0
- package/src/components/Breadcrumbs/Breadcrumbs.md +4 -0
- package/src/components/Breadcrumbs/Breadcrumbs.vue +3 -3
- package/src/components/Button/Button.api.md +37 -32
- package/src/components/Button/Button.cy.ts +18 -2
- package/src/components/Button/Button.md +20 -8
- package/src/components/Button/Button.vue +304 -284
- package/src/components/Button/stories/InlineActions.vue +10 -0
- package/src/components/Button/stories/LiveClassCard.vue +34 -0
- package/src/components/Button/stories/SectionAction.vue +17 -0
- package/src/components/Button/stories/SectionControls.vue +28 -0
- package/src/components/Button/stories/SelectionToolbar.vue +20 -0
- package/src/components/Button/stories/StackedActions.vue +10 -0
- package/src/components/Button/types.ts +38 -32
- package/src/components/Calendar/Calendar.api.md +16 -16
- package/src/components/Calendar/Calendar.vue +100 -73
- package/src/components/Calendar/CalendarDaily.vue +21 -20
- package/src/components/Calendar/CalendarMonthEvent.vue +30 -9
- package/src/components/Calendar/CalendarMonthly.vue +60 -39
- package/src/components/Calendar/CalendarTimeMarker.vue +9 -8
- package/src/components/Calendar/CalendarWeekDayEvent.vue +98 -42
- package/src/components/Calendar/CalendarWeekly.vue +77 -41
- package/src/components/Calendar/EventModalContent.vue +32 -16
- package/src/components/Calendar/NewEventModal.vue +19 -16
- package/src/components/Calendar/ShowMoreCalendarEvent.vue +11 -17
- package/src/components/Calendar/{calendarUtils.js → calendarUtils.ts} +76 -52
- package/src/components/Calendar/composables/{useCalendarData.js → useCalendarData.ts} +23 -11
- package/src/components/Calendar/composables/{useEventModal.js → useEventModal.ts} +16 -12
- package/src/components/Calendar/index.ts +12 -2
- package/src/components/Calendar/stories/CustomHeader.vue +1 -1
- package/src/components/Calendar/types.ts +106 -0
- package/src/components/Calendar/{useEventBase.js → useEventBase.ts} +40 -26
- package/src/components/Card.vue +2 -2
- package/src/components/Charts/ECharts.vue +1 -1
- package/src/components/Charts/NumberChart.vue +7 -7
- package/src/components/Charts/eChartOptions.ts +28 -13
- package/src/components/Checkbox/Checkbox.api.md +6 -0
- package/src/components/Checkbox/Checkbox.cy.ts +10 -2
- package/src/components/Checkbox/Checkbox.md +28 -0
- package/src/components/Checkbox/Checkbox.vue +9 -22
- package/src/components/Checkbox/stories/Group.vue +27 -0
- package/src/components/Checkbox/stories/HorizontalGroup.vue +24 -0
- package/src/components/Checkbox/stories/SettingRow.vue +23 -0
- package/src/components/Checkbox/stories/WithDescription.vue +27 -0
- package/src/components/Checkbox/types.ts +7 -0
- package/src/components/CodeEditor/CodeEditor.api.md +139 -0
- package/src/components/CodeEditor/CodeEditor.cy.ts +160 -0
- package/src/components/CodeEditor/CodeEditor.md +104 -0
- package/src/components/CodeEditor/CodeEditor.vue +556 -0
- package/src/components/CodeEditor/CodePreview.test.ts +49 -0
- package/src/components/CodeEditor/CodePreview.vue +45 -0
- package/src/components/CodeEditor/index.ts +17 -0
- package/src/components/CodeEditor/languages.ts +63 -0
- package/src/components/CodeEditor/stories/Default.vue +16 -0
- package/src/components/CodeEditor/stories/Labeling.vue +25 -0
- package/src/components/CodeEditor/stories/MaxHeight.vue +24 -0
- package/src/components/CodeEditor/stories/Preview.vue +36 -0
- package/src/components/CodeEditor/stories/Sizes.vue +15 -0
- package/src/components/CodeEditor/stories/Variants.vue +13 -0
- package/src/components/CodeEditor/theme.ts +272 -0
- package/src/components/CodeEditor/types.ts +69 -0
- package/src/components/Combobox/Combobox.api.md +19 -20
- package/src/components/Combobox/Combobox.cy.ts +54 -14
- package/src/components/Combobox/Combobox.md +4 -0
- package/src/components/Combobox/Combobox.vue +233 -247
- package/src/components/Combobox/ComboboxResults.vue +1 -1
- package/src/components/Combobox/stories/Clearable.vue +2 -2
- package/src/components/Combobox/stories/CreateNew.vue +1 -1
- package/src/components/Combobox/stories/Footer.vue +10 -2
- package/src/components/Combobox/stories/InDialog.vue +1 -1
- package/src/components/Combobox/types.ts +8 -29
- package/src/components/CommandPalette/CommandPaletteItem.vue +1 -1
- package/src/components/ContextMenu/ContextMenu.api.md +52 -0
- package/src/components/ContextMenu/ContextMenu.cy.ts +191 -0
- package/src/components/ContextMenu/ContextMenu.md +25 -0
- package/src/components/ContextMenu/ContextMenu.vue +106 -0
- package/src/components/ContextMenu/index.ts +2 -0
- package/src/components/ContextMenu/stories/FileList.vue +105 -0
- package/src/components/ContextMenu/stories/Groups.vue +95 -0
- package/src/components/ContextMenu/stories/Simple.vue +72 -0
- package/src/components/ContextMenu/types.ts +39 -0
- package/src/components/DatePicker/CalendarPanel.vue +128 -86
- package/src/components/DatePicker/DatePicker.vue +3 -9
- package/src/components/DatePicker/DateRangePicker.vue +4 -8
- package/src/components/DatePicker/DateTimePicker.cy.ts +4 -2
- package/src/components/DatePicker/DateTimePicker.vue +3 -9
- package/src/components/DatePicker/composables.ts +15 -37
- package/src/components/DatePicker/stories/Range.vue +1 -1
- package/src/components/DatePicker/types.ts +1 -1
- package/src/components/DesktopShell/DesktopShell.api.md +40 -0
- package/src/components/DesktopShell/DesktopShell.cy.ts +39 -0
- package/src/components/DesktopShell/DesktopShell.md +31 -0
- package/src/components/DesktopShell/DesktopShell.vue +81 -0
- package/src/components/DesktopShell/index.ts +3 -0
- package/src/components/DesktopShell/stories/Default.vue +97 -0
- package/src/components/DesktopShell/types.ts +2 -0
- package/src/components/Dialog/Dialog.api.md +7 -8
- package/src/components/Dialog/Dialog.md +4 -0
- package/src/components/Dialog/Dialog.vue +8 -7
- package/src/components/Dialog/stories/CommandPalette.vue +1 -1
- package/src/components/Dialog/stories/Wizard.vue +1 -1
- package/src/components/Dialogs.vue +11 -9
- package/src/components/Divider/Divider.api.md +1 -1
- package/src/components/Divider/Divider.md +4 -0
- package/src/components/Dropdown/Dropdown.api.md +10 -35
- package/src/components/Dropdown/Dropdown.md +10 -6
- package/src/components/Dropdown/Dropdown.vue +33 -47
- package/src/components/Dropdown/stories/{05_KebabMenu.vue → KebabMenu.vue} +3 -1
- package/src/components/Dropdown/stories/{06_UserMenu.vue → UserMenu.vue} +1 -1
- package/src/components/Dropdown/types.ts +25 -189
- package/src/components/Duration/Duration.api.md +92 -0
- package/src/components/Duration/Duration.cy.ts +183 -0
- package/src/components/Duration/Duration.md +98 -0
- package/src/components/Duration/Duration.vue +114 -0
- package/src/components/Duration/duration.ts +185 -0
- package/src/components/Duration/index.ts +8 -0
- package/src/components/Duration/stories/Default.vue +10 -0
- package/src/components/Duration/stories/Formats.vue +16 -0
- package/src/components/Duration/stories/RealWorld.vue +50 -0
- package/src/components/Duration/stories/Sizes.vue +15 -0
- package/src/components/Duration/stories/States.vue +21 -0
- package/src/components/Duration/types.ts +52 -0
- package/src/components/ErrorMessage/ErrorMessage.cy.ts +1 -1
- package/src/components/ErrorMessage/ErrorMessage.md +4 -0
- package/src/components/ErrorMessage/ErrorMessage.vue +1 -1
- package/src/components/FileUploader/FileUploader.api.md +36 -11
- package/src/components/FileUploader/FileUploader.cy.ts +66 -0
- package/src/components/FileUploader/FileUploader.md +4 -1
- package/src/components/FileUploader/FileUploader.vue +147 -106
- package/src/components/FileUploader/index.ts +6 -0
- package/src/components/FileUploader/types.ts +43 -0
- package/src/components/FormControl/FormControl.api.md +3 -4
- package/src/components/FormControl/FormControl.md +4 -0
- package/src/components/FormControl/stories/RealForm.vue +3 -3
- package/src/components/FormLabel.vue +5 -8
- package/src/components/HoverCard/HoverCard.api.md +100 -0
- package/src/components/HoverCard/HoverCard.cy.ts +103 -0
- package/src/components/HoverCard/HoverCard.md +52 -0
- package/src/components/HoverCard/HoverCard.vue +91 -0
- package/src/components/HoverCard/index.ts +2 -0
- package/src/components/HoverCard/stories/Arrow.vue +28 -0
- package/src/components/HoverCard/stories/Delays.vue +16 -0
- package/src/components/HoverCard/stories/Example.vue +28 -0
- package/src/components/HoverCard/types.ts +47 -0
- package/src/components/Icon/Icon.cy.ts +78 -0
- package/src/components/Icon/Icon.vue +50 -0
- package/src/components/Icon/index.ts +1 -0
- package/src/components/InputLabeling/InputDescription.vue +1 -1
- package/src/components/InputLabeling/InputError.vue +1 -1
- package/src/components/InputLabeling/InputLabel.vue +21 -7
- package/src/components/InputLabeling/RequiredIndicator.vue +1 -1
- package/src/components/ItemListRow/ItemListRow.vue +1 -1
- package/src/components/ItemListRow/stories/RowStates.vue +1 -1
- package/src/components/KeyboardShortcut.vue +4 -8
- package/src/components/KeyboardShortcutsModal/KeyboardShortcutsModal.api.md +22 -14
- package/src/components/KeyboardShortcutsModal/KeyboardShortcutsModal.vue +2 -2
- package/src/components/ListFilter/ListFilter.api.md +5 -6
- package/src/components/ListFilter/ListFilter.vue +161 -57
- package/src/components/ListFilter/NestedPopover.vue +17 -10
- package/src/components/ListFilter/SearchComplete.vue +31 -38
- package/src/components/ListItem.vue +1 -1
- package/src/components/ListView/ListEmptyState.vue +1 -1
- package/src/components/ListView/ListGroupHeader.vue +2 -2
- package/src/components/ListView/ListRow.vue +1 -1
- package/src/components/ListView/ListSelectBanner.vue +1 -1
- package/src/components/ListView/ListView.api.md +322 -6
- package/src/components/ListView/index.ts +25 -0
- package/src/components/ListView/stories/CustomList.vue +1 -1
- package/src/components/ListView/stories/GroupedRows.vue +1 -1
- package/src/components/LoadingIndicator.vue +13 -22
- package/src/components/LoadingText.vue +3 -13
- package/src/components/{Dropdown/DropdownMenuList.vue → Menu/Menu.vue} +110 -75
- package/src/components/{Dropdown/DropdownMenuItemContent.vue → Menu/MenuItemContent.vue} +23 -33
- package/src/components/{Dropdown/DropdownRenderContent.vue → Menu/MenuRenderContent.vue} +1 -1
- package/src/components/Menu/types.ts +225 -0
- package/src/components/{Dropdown → Menu}/utils.ts +36 -40
- package/src/components/MobileNav/MobileNav.api.md +70 -0
- package/src/components/MobileNav/MobileNav.cy.ts +89 -0
- package/src/components/MobileNav/MobileNav.md +34 -0
- package/src/components/MobileNav/MobileNav.vue +15 -0
- package/src/components/MobileNav/MobileNavItem.vue +125 -0
- package/src/components/MobileNav/index.ts +4 -0
- package/src/components/MobileNav/stories/Default.vue +40 -0
- package/src/components/MobileNav/types.ts +33 -0
- package/src/components/MobileShell/MobileShell.api.md +23 -0
- package/src/components/MobileShell/MobileShell.cy.ts +25 -0
- package/src/components/MobileShell/MobileShell.md +24 -0
- package/src/components/MobileShell/MobileShell.vue +41 -0
- package/src/components/MobileShell/index.ts +3 -0
- package/src/components/MobileShell/stories/Default.vue +75 -0
- package/src/components/MobileShell/types.ts +7 -0
- package/src/components/MonthPicker/MonthPicker.cy.ts +16 -0
- package/src/components/MonthPicker/MonthPicker.vue +19 -8
- package/src/components/MultiSelect/MultiSelect.api.md +3 -4
- package/src/components/MultiSelect/MultiSelect.md +42 -10
- package/src/components/MultiSelect/MultiSelect.vue +199 -227
- package/src/components/MultiSelect/MultiSelectResults.vue +1 -1
- package/src/components/MultiSelect/stories/Members.vue +1 -1
- package/src/components/MultiSelect/stories/TagsTrigger.vue +3 -3
- package/src/components/MultiSelect/types.ts +3 -3
- package/src/components/PageHeader/PageHeader.api.md +112 -0
- package/src/components/PageHeader/PageHeader.cy.ts +68 -0
- package/src/components/PageHeader/PageHeader.md +25 -0
- package/src/components/PageHeader/PageHeader.vue +13 -0
- package/src/components/PageHeader/PageHeaderBackButton.vue +29 -0
- package/src/components/PageHeader/PageHeaderBase.vue +51 -0
- package/src/components/PageHeader/PageHeaderMobile.vue +68 -0
- package/src/components/PageHeader/PageHeaderMobileTitle.vue +16 -0
- package/src/components/PageHeader/PageHeaderTarget.vue +13 -0
- package/src/components/PageHeader/PageHeaderTitle.vue +12 -0
- package/src/components/PageHeader/index.ts +7 -0
- package/src/components/PageHeader/stories/Default.vue +19 -0
- package/src/components/PageHeader/stories/Mobile.vue +24 -0
- package/src/components/PageHeader/target.ts +19 -0
- package/src/components/PageHeader/types.ts +19 -0
- package/src/components/Password/Password.md +4 -0
- package/src/components/Password/Password.vue +2 -2
- package/src/components/Popover/Popover.api.md +126 -42
- package/src/components/Popover/Popover.cy.ts +425 -41
- package/src/components/Popover/Popover.md +99 -4
- package/src/components/Popover/Popover.vue +288 -215
- package/src/components/Popover/index.ts +8 -1
- package/src/components/Popover/stories/Arrow.vue +16 -0
- package/src/components/Popover/stories/Bare.vue +20 -0
- package/src/components/Popover/stories/Click.vue +7 -4
- package/src/components/Popover/stories/Controlled.vue +22 -0
- package/src/components/Popover/stories/Dismissible.vue +19 -0
- package/src/components/Popover/stories/MatchTriggerWidth.vue +16 -0
- package/src/components/Popover/stories/SideAlign.vue +17 -0
- package/src/components/Popover/types.ts +101 -23
- package/src/components/Progress/Progress.cy.ts +2 -2
- package/src/components/Progress/Progress.md +4 -0
- package/src/components/Progress/Progress.vue +4 -4
- package/src/components/Rail/Rail.api.md +91 -0
- package/src/components/Rail/Rail.cy.ts +84 -0
- package/src/components/Rail/Rail.md +30 -0
- package/src/components/Rail/Rail.vue +16 -0
- package/src/components/Rail/RailItem.vue +134 -0
- package/src/components/Rail/RailItemBadge.vue +64 -0
- package/src/components/Rail/index.ts +2 -0
- package/src/components/Rail/stories/Default.vue +44 -0
- package/src/components/Rail/types.ts +37 -0
- package/src/components/Rating/Rating.md +4 -0
- package/src/components/Rating/Rating.vue +5 -8
- package/src/components/Rating/stories/CustomSlot.vue +2 -2
- package/src/components/ScrollArea/ScrollArea.api.md +59 -0
- package/src/components/ScrollArea/ScrollArea.vue +46 -0
- package/src/components/ScrollArea/ScrollBar.vue +101 -0
- package/src/components/ScrollArea/index.ts +2 -0
- package/src/components/Select/Select.cy.ts +16 -15
- package/src/components/Select/Select.md +4 -0
- package/src/components/Select/Select.vue +217 -203
- package/src/components/Select/stories/Example.vue +4 -3
- package/src/components/Select/stories/States.vue +1 -1
- package/src/components/Select/stories/TriggerSlots.vue +2 -2
- package/src/components/Select/utils.ts +4 -3
- package/src/components/SettingsDialog/SettingsBody.vue +23 -0
- package/src/components/SettingsDialog/SettingsContent.vue +7 -0
- package/src/components/SettingsDialog/SettingsDialog.api.md +273 -0
- package/src/components/SettingsDialog/SettingsDialog.cy.ts +126 -0
- package/src/components/SettingsDialog/SettingsDialog.md +43 -0
- package/src/components/SettingsDialog/SettingsDialog.vue +76 -0
- package/src/components/SettingsDialog/SettingsHeader.vue +36 -0
- package/src/components/SettingsDialog/SettingsNavGroup.vue +20 -0
- package/src/components/SettingsDialog/SettingsNavItem.vue +33 -0
- package/src/components/SettingsDialog/SettingsPanel.cy.ts +77 -0
- package/src/components/SettingsDialog/SettingsPanel.vue +26 -0
- package/src/components/SettingsDialog/SettingsRow.vue +52 -0
- package/src/components/SettingsDialog/SettingsSidebar.vue +16 -0
- package/src/components/SettingsDialog/index.ts +10 -0
- package/src/components/SettingsDialog/stories/Default.vue +99 -0
- package/src/components/SettingsDialog/stories/PanelBasic.vue +52 -0
- package/src/components/SettingsDialog/stories/panels/NotificationsPanel.vue +57 -0
- package/src/components/SettingsDialog/stories/panels/PreferencesPanel.vue +57 -0
- package/src/components/SettingsDialog/stories/panels/ProfilePanel.vue +38 -0
- package/src/components/SettingsDialog/stories/panels/UsersPanel.vue +83 -0
- package/src/components/SettingsDialog/types.ts +21 -0
- package/src/components/Sidebar/Sidebar.api.md +124 -65
- package/src/components/Sidebar/Sidebar.cy.ts +127 -76
- package/src/components/Sidebar/Sidebar.md +47 -3
- package/src/components/Sidebar/Sidebar.vue +64 -56
- package/src/components/Sidebar/SidebarCollapseToggle.vue +23 -0
- package/src/components/Sidebar/SidebarHeader.vue +76 -52
- package/src/components/Sidebar/SidebarItem.vue +159 -95
- package/src/components/Sidebar/SidebarItemIcon.vue +25 -0
- package/src/components/Sidebar/SidebarLabel.vue +34 -0
- package/src/components/Sidebar/SidebarSection.vue +29 -14
- package/src/components/Sidebar/index.ts +13 -2
- package/src/components/Sidebar/stories/Collapsed.vue +40 -0
- package/src/components/Sidebar/stories/Default.vue +153 -0
- package/src/components/Sidebar/stories/Legacy.vue +36 -0
- package/src/components/Sidebar/types.ts +105 -20
- package/src/components/Skeleton/Skeleton.cy.ts +21 -0
- package/src/components/Skeleton/Skeleton.md +21 -0
- package/src/components/Skeleton/Skeleton.vue +6 -0
- package/src/components/Skeleton/index.ts +1 -0
- package/src/components/Skeleton/stories/Card.vue +12 -0
- package/src/components/Skeleton/stories/List.vue +15 -0
- package/src/components/Skeleton/stories/Text.vue +11 -0
- package/src/components/Slider/Slider.api.md +1 -1
- package/src/components/Slider/Slider.cy.ts +29 -0
- package/src/components/Slider/Slider.md +10 -0
- package/src/components/Slider/Slider.vue +37 -9
- package/src/components/Slider/stories/NegativeValues.vue +12 -0
- package/src/components/Slider/types.ts +1 -1
- package/src/components/Spinner/Spinner.api.md +32 -0
- package/src/components/Spinner/Spinner.cy.ts +87 -0
- package/src/components/Spinner/Spinner.md +21 -0
- package/src/components/Spinner/Spinner.vue +168 -0
- package/src/components/Spinner/index.ts +2 -0
- package/src/components/Spinner/stories/InContext.vue +49 -0
- package/src/components/Spinner/stories/Sizes.vue +12 -0
- package/src/components/Spinner/stories/Themes.vue +10 -0
- package/src/components/Spinner/stories/Track.vue +12 -0
- package/src/components/Spinner/types.ts +14 -0
- package/src/components/Switch/Switch.md +4 -0
- package/src/components/Switch/Switch.vue +6 -23
- package/src/components/TabButtons/Pill.vue +161 -0
- package/src/components/TabButtons/TabButtons.api.md +52 -2
- package/src/components/TabButtons/TabButtons.cy.ts +18 -5
- package/src/components/TabButtons/TabButtons.md +49 -0
- package/src/components/TabButtons/TabButtons.vue +207 -109
- package/src/components/TabButtons/index.ts +11 -1
- package/src/components/TabButtons/pillTypes.ts +43 -0
- package/src/components/TabButtons/stories/PrefixSuffix.vue +65 -0
- package/src/components/TabButtons/stories/Sizes.vue +26 -0
- package/src/components/TabButtons/stories/Variants.vue +40 -0
- package/src/components/TabButtons/stories/Vertical.vue +64 -0
- package/src/components/TabButtons/types.ts +49 -0
- package/src/components/Tabs/Tabs.md +4 -0
- package/src/components/Tabs/Tabs.vue +1 -1
- package/src/components/TextEditor/TextEditor.cy.ts +1 -1
- package/src/components/TextEditor/TextEditor.md +3 -0
- package/src/components/TextEditor/TextEditor.vue +7 -4
- package/src/components/TextEditor/components/CodeBlockComponent.vue +4 -194
- package/src/components/TextEditor/components/FontColor.vue +1 -1
- package/src/components/TextEditor/components/LinkPopup.vue +1 -1
- package/src/components/TextEditor/components/MediaNodeView.vue +17 -17
- package/src/components/TextEditor/components/MentionList.vue +1 -1
- package/src/components/TextEditor/components/TextEditorBubbleMenu.vue +14 -5
- package/src/components/TextEditor/components/TextEditorFixedMenu.vue +3 -3
- package/src/components/TextEditor/components/{Menu.vue → TextEditorMenu.vue} +3 -3
- package/src/components/TextEditor/extensions/iframe/InsertIframe.vue +2 -2
- package/src/components/TextEditor/extensions/iframe/iframe-extension.ts +62 -19
- package/src/components/TextEditor/extensions/image-group/ImageGroupNodeView.vue +1 -1
- package/src/components/TextEditor/extensions/image-group/ImageGroupUploadDialog.vue +4 -4
- package/src/components/TextEditor/extensions/suggestion/SuggestionList.vue +1 -1
- package/src/components/TextEditor/extensions/toc-node/TocNodeView.vue +1 -1
- package/src/components/TextEditor/hljs-github.css +197 -0
- package/src/components/TextEditor/index.ts +13 -0
- package/src/components/TextInput/TextInput.cy.ts +8 -3
- package/src/components/TextInput/TextInput.md +4 -0
- package/src/components/TextInput/TextInput.vue +11 -15
- package/src/components/TextInput/stories/Slots.vue +1 -1
- package/src/components/Textarea/Textarea.cy.ts +1 -1
- package/src/components/Textarea/Textarea.md +4 -0
- package/src/components/Textarea/Textarea.vue +11 -15
- package/src/components/ThemeSwitcher/ThemePreview.vue +74 -0
- package/src/components/ThemeSwitcher/ThemeSwitcher.api.md +82 -0
- package/src/components/ThemeSwitcher/ThemeSwitcher.cy.ts +101 -0
- package/src/components/ThemeSwitcher/ThemeSwitcher.md +70 -0
- package/src/components/ThemeSwitcher/ThemeSwitcher.vue +145 -0
- package/src/components/ThemeSwitcher/index.ts +2 -0
- package/src/components/ThemeSwitcher/previews/PreviewWindow.vue +74 -0
- package/src/components/ThemeSwitcher/stories/Branded.vue +12 -0
- package/src/components/ThemeSwitcher/stories/Default.vue +7 -0
- package/src/components/ThemeSwitcher/stories/Menu.vue +53 -0
- package/src/components/ThemeSwitcher/stories/Toggle.vue +25 -0
- package/src/components/ThemeSwitcher/types.ts +35 -0
- package/src/components/TimePicker/TimePicker.api.md +67 -15
- package/src/components/TimePicker/TimePicker.cy.ts +130 -14
- package/src/components/TimePicker/TimePicker.md +6 -0
- package/src/components/TimePicker/TimePicker.vue +74 -19
- package/src/components/TimePicker/stories/Labeling.vue +21 -0
- package/src/components/TimePicker/stories/Range.vue +1 -1
- package/src/components/TimePicker/stories/SizesAndVariants.vue +23 -0
- package/src/components/TimePicker/stories/TwentyFour.vue +1 -1
- package/src/components/TimePicker/types.ts +15 -3
- package/src/components/TimePicker/utils.ts +82 -21
- package/src/components/Toast/Toast.md +1 -1
- package/src/components/Toast/Toast.sanitize.test.ts +50 -0
- package/src/components/Toast/Toast.test.ts +5 -0
- package/src/components/Toast/Toast.vue +7 -7
- package/src/components/Toast/ToastProvider.vue +18 -9
- package/src/components/Toast/stories/CustomIcon.vue +1 -1
- package/src/components/Toast/toast.ts +32 -8
- package/src/components/Tooltip/Tooltip.api.md +43 -5
- package/src/components/Tooltip/Tooltip.cy.ts +48 -0
- package/src/components/Tooltip/Tooltip.md +10 -0
- package/src/components/Tooltip/Tooltip.vue +20 -5
- package/src/components/Tooltip/TooltipBubble.vue +2 -2
- package/src/components/Tooltip/TooltipProvider.vue +53 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/Tooltip/stories/Group.vue +22 -0
- package/src/components/Tooltip/stories/Slots.vue +2 -2
- package/src/components/Tooltip/types.ts +1 -1
- package/src/components/Tree/Tree.api.md +76 -18
- package/src/components/Tree/Tree.md +144 -2
- package/src/components/Tree/Tree.vue +276 -97
- package/src/components/Tree/TreeItem.vue +263 -0
- package/src/components/Tree/index.ts +9 -1
- package/src/components/Tree/stories/DragDrop.vue +94 -0
- package/src/components/Tree/stories/Example.vue +11 -34
- package/src/components/Tree/stories/ExpandAll.vue +48 -0
- package/src/components/Tree/stories/Guides.vue +49 -0
- package/src/components/Tree/stories/ListView.vue +74 -0
- package/src/components/Tree/tree.cy.ts +218 -90
- package/src/components/Tree/types.ts +114 -24
- package/src/components/Tree/useTreeDragDrop.ts +203 -0
- package/src/components/Tree/useTreeKeyboard.ts +109 -0
- package/src/components/VueGridLayout/Layout.vue +1 -1
- package/src/components/shared/picker/PickerShell.vue +20 -15
- package/src/components/shared/popover/PopoverPanel.vue +67 -0
- package/src/components/shared/popover/popoverPanel.css +102 -0
- package/src/components/shared/selection/utils.ts +6 -6
- package/src/composables/useAutofocusOnOpen.ts +2 -0
- package/src/composables/useScreenSize.ts +46 -0
- package/src/composables/useScrollContainer.ts +108 -0
- package/src/composables/useShortcut.ts +3 -0
- package/src/data-fetching/docStore.test.ts +74 -0
- package/src/data-fetching/docStore.ts +18 -7
- package/src/data-fetching/useCall/types.ts +1 -0
- package/src/data-fetching/useCall/useCall.test.ts +43 -0
- package/src/data-fetching/useCall/useCall.ts +17 -4
- package/src/data-fetching/useDoc/useDoc.test.ts +61 -2
- package/src/data-fetching/useDoc/useDoc.ts +35 -15
- package/src/data-fetching/useDoctype/useDoctype.ts +6 -5
- package/src/data-fetching/useFrappeFetch.ts +17 -4
- package/src/data-fetching/useList/types.ts +1 -0
- package/src/data-fetching/useList/useList.test.ts +40 -0
- package/src/data-fetching/useList/useList.ts +20 -13
- package/src/data-fetching/useNewDoc/useNewDoc.ts +9 -5
- package/src/directives/focus.ts +3 -3
- package/src/index.ts +105 -74
- package/src/mocks/handlers.ts +8 -0
- package/src/molecules/editor/Editor.cy.ts +6 -1
- package/src/molecules/editor/EditorBubbleMenu.vue +1 -1
- package/src/molecules/editor/EditorContent.vue +50 -9
- package/src/molecules/editor/EditorFixedMenu.vue +2 -1
- package/src/molecules/editor/EditorFloatingMenu.vue +1 -1
- package/src/molecules/editor/EditorTableMenu.vue +303 -0
- package/src/molecules/editor/MenuItems.vue +81 -69
- package/src/molecules/editor/commands.ts +10 -2
- package/src/molecules/editor/components/AttachmentNodeView.vue +115 -0
- package/src/molecules/editor/components/EditorDropZone.vue +105 -0
- package/src/molecules/editor/components/EditorPopover.vue +89 -0
- package/src/molecules/editor/components/MediaNodeView.vue +156 -49
- package/src/molecules/editor/components/MediaResizeHandles.vue +38 -0
- package/src/molecules/editor/components/MediaToolbar.vue +108 -54
- package/src/molecules/editor/components/TableContextMenu.vue +144 -0
- package/src/molecules/editor/components/UploadProgressIndicator.vue +33 -0
- package/src/molecules/editor/components/VideoControls.vue +208 -0
- package/src/molecules/editor/components/font-color/ColorSwatchGrid.vue +3 -5
- package/src/molecules/editor/components/font-color/fontColorController.ts +28 -23
- package/src/molecules/editor/components/font-color/swatches.ts +1 -1
- package/src/molecules/editor/components/media-node-view-controller.ts +4 -4
- package/src/molecules/editor/components/media-node-view-utils.test.ts +0 -13
- package/src/molecules/editor/components/media-node-view-utils.ts +0 -10
- package/src/molecules/editor/components/table-color/tableCellColorController.ts +80 -0
- package/src/molecules/editor/components/table-size-picker/TableSizePicker.vue +92 -0
- package/src/molecules/editor/components/table-size-picker/tableSizePickerController.ts +40 -0
- package/src/molecules/editor/composables/useEditorFileDrop.ts +117 -0
- package/src/molecules/editor/composables/useFloatingPopup.ts +46 -2
- package/src/molecules/editor/composables/useNodeViewResize.test.ts +60 -11
- package/src/molecules/editor/composables/useNodeViewResize.ts +80 -21
- package/src/molecules/editor/composables/useTableCellColorState.ts +78 -0
- package/src/molecules/editor/composables/useWindowFileDragging.ts +68 -0
- package/src/molecules/editor/extensions/attachment/attachment-engine.ts +250 -0
- package/src/molecules/editor/extensions/attachment/attachment-extension.ts +248 -0
- package/src/molecules/editor/extensions/attachment/attachment.flow.test.ts +80 -0
- package/src/molecules/editor/extensions/attachment/attachment.roundtrip.test.ts +50 -0
- package/src/molecules/editor/extensions/attachment/index.ts +5 -0
- package/src/molecules/editor/extensions/code-block/CodeBlockComponent.css +16 -26
- package/src/molecules/editor/extensions/code-block/CodeBlockComponent.vue +107 -22
- package/src/molecules/editor/extensions/content-paste/content-paste-extension.ts +5 -3
- package/src/molecules/editor/extensions/iframe/IframeInsertDialog.vue +34 -7
- package/src/molecules/editor/extensions/iframe/IframeNodeView.vue +54 -48
- package/src/molecules/editor/extensions/iframe/iframe-allowlist.ts +33 -4
- package/src/molecules/editor/extensions/iframe/iframe-commands.ts +49 -5
- package/src/molecules/editor/extensions/iframe/iframe-embed-utils.ts +30 -0
- package/src/molecules/editor/extensions/iframe/iframe-extension.ts +4 -4
- package/src/molecules/editor/extensions/iframe/iframeInsertDialogController.ts +12 -1
- package/src/molecules/editor/extensions/iframe/index.ts +4 -4
- package/src/molecules/editor/extensions/iframe/useIframeDialog.ts +25 -13
- package/src/molecules/editor/extensions/image/image-extension.ts +29 -11
- package/src/molecules/editor/extensions/image-group/ImageGroupGrid.vue +27 -11
- package/src/molecules/editor/extensions/image-group/ImageGroupGridCell.vue +55 -11
- package/src/molecules/editor/extensions/image-group/ImageGroupNodeView.vue +64 -31
- package/src/molecules/editor/extensions/image-group/ImageGroupUploadDialog.vue +84 -40
- package/src/molecules/editor/extensions/image-group/image-group-extension.ts +4 -3
- package/src/molecules/editor/extensions/image-group/useImageGroupDialog.ts +116 -17
- package/src/molecules/editor/extensions/link/LinkEditorPopup.vue +214 -71
- package/src/molecules/editor/extensions/link/link-click-plugin.ts +10 -15
- package/src/molecules/editor/extensions/link/link-commands.ts +24 -3
- package/src/molecules/editor/extensions/link/link-extension.ts +11 -2
- package/src/molecules/editor/extensions/link/link-popup-controller.test.ts +49 -0
- package/src/molecules/editor/extensions/link/link-popup-controller.ts +67 -2
- package/src/molecules/editor/extensions/link/link-shortcut-plugin.ts +7 -2
- package/src/molecules/editor/extensions/media-drop/media-drop-extension.ts +177 -0
- package/src/molecules/editor/extensions/shared/media-dimensions.ts +36 -3
- package/src/molecules/editor/extensions/shared/media-node-ops.ts +17 -0
- package/src/molecules/editor/extensions/shared/media-plugin.test.ts +60 -0
- package/src/molecules/editor/extensions/shared/media-plugin.ts +7 -37
- package/src/molecules/editor/extensions/shared/media-upload-engine.test.ts +39 -2
- package/src/molecules/editor/extensions/shared/media-upload-engine.ts +104 -10
- package/src/molecules/editor/extensions/shared/media-upload-state.ts +55 -0
- package/src/molecules/editor/extensions/shared/media-upload-types.ts +52 -1
- package/src/molecules/editor/extensions/shared/suggestion-helpers.ts +20 -0
- package/src/molecules/editor/extensions/shared/suggestion-types.ts +7 -0
- package/src/molecules/editor/extensions/shared/upload-types.ts +1 -0
- package/src/molecules/editor/extensions/slash-commands/slash-commands-extension.test.ts +38 -0
- package/src/molecules/editor/extensions/slash-commands/slash-commands-extension.ts +119 -55
- package/src/molecules/editor/extensions/suggestion/SuggestionList.vue +62 -22
- package/src/molecules/editor/extensions/suggestion/SuggestionListItem.vue +1 -1
- package/src/molecules/editor/extensions/suggestion/createSuggestionExtension.ts +4 -0
- package/src/molecules/editor/extensions/table/drag-scroll.ts +154 -0
- package/src/molecules/editor/extensions/table/table-cell-color.ts +188 -0
- package/src/molecules/editor/extensions/table/table-navigation.ts +560 -0
- package/src/molecules/editor/extensions/table/table-selection-overlay.ts +137 -0
- package/src/molecules/editor/extensions/toc-node/TocNodeView.vue +1 -1
- package/src/molecules/editor/extensions/toc-node/toc-render.ts +7 -3
- package/src/molecules/editor/extensions/video/video-extension.ts +72 -5
- package/src/molecules/editor/extensions.ts +176 -8
- package/src/molecules/editor/index.ts +9 -4
- package/src/molecules/editor/kits.test.ts +21 -1
- package/src/molecules/editor/kits.ts +56 -33
- package/src/molecules/editor/menu.test.ts +3 -1
- package/src/molecules/editor/menu.ts +180 -18
- package/src/molecules/editor/stories/Comment.vue +4 -4
- package/src/molecules/editor/stories/Inline.vue +1 -1
- package/src/molecules/editor/stories/Primitives.vue +1 -1
- package/src/molecules/editor/stories/RichText.vue +1 -1
- package/src/molecules/editor/style.css +80 -3
- package/src/molecules/editor/useEditor.test.ts +4 -0
- package/src/molecules/editor/useEditor.ts +7 -3
- package/src/molecules/list/List.cy.ts +626 -0
- package/src/molecules/list/List.vue +93 -0
- package/src/molecules/list/ListCell.vue +15 -0
- package/src/molecules/list/ListGroup.vue +40 -0
- package/src/molecules/list/ListHeader.vue +62 -0
- package/src/molecules/list/ListHeaderCell.vue +26 -0
- package/src/molecules/list/ListHeaderCellSort.vue +106 -0
- package/src/molecules/list/ListRow.vue +55 -0
- package/src/molecules/list/ListRowBase.vue +103 -0
- package/src/molecules/list/ListRows.vue +120 -0
- package/src/molecules/list/index.ts +24 -0
- package/src/molecules/list/list-context.ts +44 -0
- package/src/molecules/list/list.api.md +276 -0
- package/src/molecules/list/list.md +119 -0
- package/src/molecules/list/stories/Columns.vue +103 -0
- package/src/molecules/list/stories/Feed.vue +105 -0
- package/src/molecules/list/stories/Virtual.vue +31 -0
- package/src/molecules/list/style.css +173 -0
- package/src/molecules/list/types.ts +82 -0
- package/src/molecules/list/useVirtualRows.ts +80 -0
- package/src/resources/documentResource.d.ts +28 -0
- package/src/resources/documentResource.js +32 -4
- package/src/resources/documentResource.test.ts +111 -0
- package/src/resources/listResource.d.ts +33 -0
- package/src/resources/plugin.d.ts +7 -0
- package/src/resources/resources.d.ts +35 -0
- package/src/utils/{call.js → call.ts} +50 -9
- package/src/utils/config.ts +16 -1
- package/src/utils/confirmDialog.d.ts +17 -0
- package/src/utils/debounce.ts +6 -7
- package/src/utils/dialog.cy.ts +9 -9
- package/src/utils/fileSize.ts +36 -0
- package/src/utils/fileUploadHandler.ts +46 -6
- package/src/utils/frappeRequest.test.ts +79 -0
- package/src/utils/{frappeRequest.js → frappeRequest.ts} +76 -13
- package/src/utils/pageMeta.ts +1 -1
- package/src/utils/plugin.ts +58 -0
- package/src/utils/{request.js → request.ts} +28 -3
- package/src/utils/{socketio.js → socketio.ts} +11 -1
- package/src/utils/theme.ts +48 -57
- package/src/utils/useFileUpload.ts +80 -23
- package/tailwind/audit-token-drift.cjs +176 -0
- package/tailwind/colorPalette.js +69 -8
- package/tailwind/colors.json +1115 -397
- package/tailwind/figma-tokens-to-theme.js +364 -0
- package/tailwind/generated/colors.json +1217 -0
- package/tailwind/generated/effects.json +41 -0
- package/tailwind/generated/radius.json +20 -0
- package/tailwind/generated/typography.json +479 -0
- package/tailwind/migrate-tokens-v2.js +453 -0
- package/tailwind/migrate-tokens-v2.test.js +55 -0
- package/tailwind/plugin.js +220 -15
- package/tailwind/preset.js +15 -0
- package/tailwind/tokens.js +35 -37
- package/tsconfig.base.json +2 -2
- package/vitepress/components/Docs/CommandPalette.vue +214 -0
- package/vitepress/components/Docs/Demo.vue +60 -0
- package/vitepress/components/Docs/EmitsTable.vue +99 -0
- package/vitepress/components/Docs/MobileNavSheet.vue +148 -0
- package/vitepress/components/Docs/OnThisPage.vue +74 -0
- package/vitepress/components/Docs/PrevNextBtns.vue +58 -0
- package/vitepress/components/Docs/PropsTable.vue +185 -0
- package/vitepress/components/Docs/Search.vue +34 -0
- package/vitepress/components/Docs/Sidebar.vue +91 -0
- package/vitepress/components/Docs/SlotsTable.vue +99 -0
- package/vitepress/components/Docs/index.ts +13 -0
- package/vitepress/components/Docs/sidebarList.ts +33 -0
- package/vitepress/components/Layout.vue +58 -0
- package/vitepress/components/Navbar.vue +126 -0
- package/vitepress/components/index.ts +3 -0
- package/vitepress/composables/index.ts +3 -0
- package/vitepress/composables/useTheme.ts +39 -0
- package/vitepress/css/fonts/Inter-Italic.var.woff2 +0 -0
- package/vitepress/css/fonts/Inter.var.woff2 +0 -0
- package/vitepress/css/style.css +198 -0
- package/vitepress/index.d.ts +23 -0
- package/vitepress/index.node.ts +175 -0
- package/vitepress/index.ts +17 -0
- package/vitepress/plugins/colocatedComponentDocs.ts +164 -0
- package/vitepress/plugins/componentTransformer.ts +286 -0
- package/vitepress/plugins/index.ts +12 -0
- package/vitepress/state.ts +10 -0
- package/vitepress/theme/index.ts +21 -0
- package/frappe/telemetry/utils.ts +0 -15
- package/src/components/Badge/stories/Themes.vue +0 -10
- package/src/components/Badge/stories/Variants.vue +0 -10
- package/src/components/Button/stories/Icons.vue +0 -27
- package/src/components/Button/stories/Sizes.vue +0 -11
- package/src/components/Button/stories/Themes.vue +0 -10
- package/src/components/Button/stories/Variants.vue +0 -10
- package/src/components/Popover/stories/Hover.vue +0 -14
- package/src/components/Resource.vue +0 -21
- package/src/components/Sidebar/stories/Example.vue +0 -76
- package/src/components/Spinner.vue +0 -3
- package/src/components/TabButtons/TabButtons.story.vue +0 -22
- package/src/utils/plugin.js +0 -24
- /package/src/components/Dropdown/stories/{02_Shortcuts.vue → Shortcuts.vue} +0 -0
- /package/src/components/Dropdown/stories/{01_Simple.vue → Simple.vue} +0 -0
- /package/src/components/Dropdown/stories/{03_Submenus.vue → Submenus.vue} +0 -0
- /package/src/components/Dropdown/stories/{04_Switches.vue → Switches.vue} +0 -0
- /package/src/components/{Dropdown/DropdownRenderContentAsChild.vue → Menu/MenuRenderContentAsChild.vue} +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Lazy language loading for CodeEditor.
|
|
2
|
+
//
|
|
3
|
+
// `loadLanguage` dynamically imports the matching `@codemirror/lang-*` package
|
|
4
|
+
// so each language tree-shakes into its own async chunk (apps that never render
|
|
5
|
+
// a code field pay nothing).
|
|
6
|
+
//
|
|
7
|
+
// Mapping a Frappe FormLayout fieldtype to a language key (`fieldtypeToLanguage`)
|
|
8
|
+
// is FormLayout-specific glue and lives in `@framework/ui` alongside the field
|
|
9
|
+
// wrapper, not here — this primitive stays framework-agnostic.
|
|
10
|
+
|
|
11
|
+
import type { Extension } from '@codemirror/state'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Dynamically import the CodeMirror language extension for `key`.
|
|
15
|
+
* Returns `null` for plain text / unknown keys (no highlighting).
|
|
16
|
+
*/
|
|
17
|
+
export async function loadLanguage(key?: string): Promise<Extension | null> {
|
|
18
|
+
switch (key) {
|
|
19
|
+
case 'json': {
|
|
20
|
+
const { json } = await import('@codemirror/lang-json')
|
|
21
|
+
return json()
|
|
22
|
+
}
|
|
23
|
+
case 'html': {
|
|
24
|
+
const { html } = await import('@codemirror/lang-html')
|
|
25
|
+
return html()
|
|
26
|
+
}
|
|
27
|
+
case 'javascript': {
|
|
28
|
+
const { javascript } = await import('@codemirror/lang-javascript')
|
|
29
|
+
return javascript()
|
|
30
|
+
}
|
|
31
|
+
case 'python': {
|
|
32
|
+
const { python } = await import('@codemirror/lang-python')
|
|
33
|
+
return python()
|
|
34
|
+
}
|
|
35
|
+
case 'sql': {
|
|
36
|
+
const { sql } = await import('@codemirror/lang-sql')
|
|
37
|
+
return sql()
|
|
38
|
+
}
|
|
39
|
+
case 'markdown': {
|
|
40
|
+
const { markdown } = await import('@codemirror/lang-markdown')
|
|
41
|
+
return markdown()
|
|
42
|
+
}
|
|
43
|
+
case 'css': {
|
|
44
|
+
const { css } = await import('@codemirror/lang-css')
|
|
45
|
+
return css()
|
|
46
|
+
}
|
|
47
|
+
case 'scss': {
|
|
48
|
+
// `lang-sass` covers both — `indented: false` selects SCSS (brace) syntax.
|
|
49
|
+
const { sass } = await import('@codemirror/lang-sass')
|
|
50
|
+
return sass({ indented: false })
|
|
51
|
+
}
|
|
52
|
+
case 'yaml': {
|
|
53
|
+
const { yaml } = await import('@codemirror/lang-yaml')
|
|
54
|
+
return yaml()
|
|
55
|
+
}
|
|
56
|
+
case 'xml': {
|
|
57
|
+
const { xml } = await import('@codemirror/lang-xml')
|
|
58
|
+
return xml()
|
|
59
|
+
}
|
|
60
|
+
default:
|
|
61
|
+
return null
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import { CodeEditor } from 'frappe-ui/code-editor'
|
|
4
|
+
|
|
5
|
+
const code = ref(`function greet(name) {\n\treturn \`Hello, \${name}!\`\n}`)
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<div class="w-full max-w-xl">
|
|
10
|
+
<CodeEditor
|
|
11
|
+
v-model="code"
|
|
12
|
+
language="javascript"
|
|
13
|
+
placeholder="Type some code…"
|
|
14
|
+
/>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import { CodeEditor } from 'frappe-ui/code-editor'
|
|
4
|
+
|
|
5
|
+
const code = ref(`{\n "host": "127.0.0.1",\n "port": "oops"\n}`)
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<div class="w-full max-w-xl space-y-6">
|
|
10
|
+
<CodeEditor
|
|
11
|
+
v-model="code"
|
|
12
|
+
language="json"
|
|
13
|
+
label="Configuration"
|
|
14
|
+
description="Paste the service config as JSON."
|
|
15
|
+
required
|
|
16
|
+
/>
|
|
17
|
+
<CodeEditor
|
|
18
|
+
v-model="code"
|
|
19
|
+
language="json"
|
|
20
|
+
label="Configuration"
|
|
21
|
+
error="`port` must be a number."
|
|
22
|
+
required
|
|
23
|
+
/>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import { CodeEditor } from 'frappe-ui/code-editor'
|
|
4
|
+
|
|
5
|
+
const overflowing = ref(false)
|
|
6
|
+
const code = ref(
|
|
7
|
+
Array.from({ length: 30 }, (_, i) => `const line${i + 1} = ${i + 1}`).join(
|
|
8
|
+
'\n',
|
|
9
|
+
),
|
|
10
|
+
)
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<div class="w-full max-w-xl">
|
|
15
|
+
<!-- The cap is a CSS hook, not a prop: set `--cm-max-height` on the root. -->
|
|
16
|
+
<CodeEditor
|
|
17
|
+
v-model="code"
|
|
18
|
+
language="javascript"
|
|
19
|
+
style="--cm-max-height: 12rem"
|
|
20
|
+
@overflow="(v) => (overflowing = v)"
|
|
21
|
+
/>
|
|
22
|
+
<p class="mt-2 text-xs text-ink-gray-6">overflowing = {{ overflowing }}</p>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import { Button } from 'frappe-ui'
|
|
4
|
+
import { CodeEditor, CodePreview } from 'frappe-ui/code-editor'
|
|
5
|
+
|
|
6
|
+
const mode = ref<'write' | 'preview'>('write')
|
|
7
|
+
const markdown = ref(
|
|
8
|
+
`# Notes\n\nSome **bold** text and a [link](https://frappe.io).`,
|
|
9
|
+
)
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div class="w-full max-w-xl">
|
|
14
|
+
<div class="mb-2 flex gap-1">
|
|
15
|
+
<Button
|
|
16
|
+
:variant="mode === 'write' ? 'subtle' : 'ghost'"
|
|
17
|
+
size="sm"
|
|
18
|
+
label="Write"
|
|
19
|
+
@click="mode = 'write'"
|
|
20
|
+
/>
|
|
21
|
+
<Button
|
|
22
|
+
:variant="mode === 'preview' ? 'subtle' : 'ghost'"
|
|
23
|
+
size="sm"
|
|
24
|
+
label="Preview"
|
|
25
|
+
@click="mode = 'preview'"
|
|
26
|
+
/>
|
|
27
|
+
</div>
|
|
28
|
+
<CodeEditor v-show="mode === 'write'" v-model="markdown" language="markdown" />
|
|
29
|
+
<CodePreview
|
|
30
|
+
v-if="mode === 'preview'"
|
|
31
|
+
:model-value="markdown"
|
|
32
|
+
language="markdown"
|
|
33
|
+
class="min-h-[4.5rem] rounded-md border border-surface-gray-2 p-3 mt-3"
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import { CodeEditor } from 'frappe-ui/code-editor'
|
|
4
|
+
|
|
5
|
+
const code = ref(`const sum = (a, b) => a + b`)
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<div class="w-full max-w-xl space-y-4">
|
|
10
|
+
<CodeEditor v-model="code" language="javascript" size="sm" />
|
|
11
|
+
<CodeEditor v-model="code" language="javascript" size="md" />
|
|
12
|
+
<CodeEditor v-model="code" language="javascript" size="lg" />
|
|
13
|
+
<CodeEditor v-model="code" language="javascript" size="xl" />
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import { CodeEditor } from 'frappe-ui/code-editor'
|
|
4
|
+
|
|
5
|
+
const code = ref(`{\n "name": "frappe-ui",\n "private": true\n}`)
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<div class="w-full max-w-xl space-y-4">
|
|
10
|
+
<CodeEditor v-model="code" language="json" variant="subtle" />
|
|
11
|
+
<CodeEditor v-model="code" language="json" variant="outline" />
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
// Base CodeMirror theme + token-keyed syntax highlighting for CodeEditor, split
|
|
2
|
+
// out of the SFC so the ~200 lines of style literals don't drown the editor
|
|
3
|
+
// logic. Both helpers take the CodeMirror modules as params (rather than
|
|
4
|
+
// importing them) so the lazy-load isolation holds: this file pulls no editor
|
|
5
|
+
// code into the static graph — `@codemirror/language` / `@lezer/highlight` load
|
|
6
|
+
// via dynamic `import()` only when the editor actually mounts.
|
|
7
|
+
import type { Extension } from '@codemirror/state'
|
|
8
|
+
|
|
9
|
+
// lucide `chevron-down`, used as a CSS mask so the fold marker inherits the
|
|
10
|
+
// gutter's `currentColor` (and so flips with the theme) instead of baking a
|
|
11
|
+
// fill. Single-quoted attrs keep it embeddable in this double-quoted string.
|
|
12
|
+
const FOLD_CHEVRON =
|
|
13
|
+
"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E\")"
|
|
14
|
+
|
|
15
|
+
// Chrome theme. Every color is a frappe-ui `--surface-*` / `--ink-*` token, and
|
|
16
|
+
// those tokens are re-mapped under `[data-theme="dark"]` — so the editor follows
|
|
17
|
+
// the app's light/dark scheme for free (no JS observation, no second theme to
|
|
18
|
+
// swap). The literal fallbacks are the light values, used only when a consumer
|
|
19
|
+
// renders the editor outside the token system.
|
|
20
|
+
export function buildBaseTheme(
|
|
21
|
+
cmView: typeof import('@codemirror/view'),
|
|
22
|
+
): Extension {
|
|
23
|
+
return cmView.EditorView.theme({
|
|
24
|
+
'&': {
|
|
25
|
+
// Font size is owned by `buildSize` (the `size` compartment) — setting it
|
|
26
|
+
// here too would fight that theme on equal specificity and, depending on
|
|
27
|
+
// StyleModule injection order, silently win and pin every size to 13px.
|
|
28
|
+
color: 'var(--ink-gray-8, #1e293b)',
|
|
29
|
+
borderRadius: 'var(--radius-md, 0.5rem)',
|
|
30
|
+
overflow: 'hidden',
|
|
31
|
+
// Height cap, driven by the `--cm-max-height` CSS var a consumer sets on
|
|
32
|
+
// the root (`none` when unset, so the editor grows to fit). The inner
|
|
33
|
+
// `.cm-scroller` scrolls once content passes the cap. There's no
|
|
34
|
+
// `maxHeight` prop — the cap is a CSS hook (P10), not a style prop.
|
|
35
|
+
maxHeight: 'var(--cm-max-height, none)',
|
|
36
|
+
},
|
|
37
|
+
'&.cm-focused': {
|
|
38
|
+
outline: 'none',
|
|
39
|
+
},
|
|
40
|
+
'.cm-scroller': {
|
|
41
|
+
overflow: 'auto',
|
|
42
|
+
},
|
|
43
|
+
'.cm-content': {
|
|
44
|
+
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Consolas, monospace',
|
|
45
|
+
caretColor: 'var(--ink-gray-8, #1e293b)',
|
|
46
|
+
padding: '6px 0',
|
|
47
|
+
// Min-height is owned by `buildSize` (the `size` compartment) — see the
|
|
48
|
+
// note on `&`'s font size above for why it isn't duplicated here.
|
|
49
|
+
},
|
|
50
|
+
'.cm-cursor, .cm-dropCursor': {
|
|
51
|
+
borderLeftColor: 'var(--ink-gray-8, #1e293b)',
|
|
52
|
+
},
|
|
53
|
+
'.cm-line': {
|
|
54
|
+
padding: '0 6px',
|
|
55
|
+
},
|
|
56
|
+
// Gutter surface is owned by the variant compartment (`buildVariant`), the
|
|
57
|
+
// sole source of surface chrome — it paints `.cm-gutters` to match `&` in
|
|
58
|
+
// every state (hover/focus/disabled). It deliberately can't stay transparent:
|
|
59
|
+
// the gutter is sticky and the content scrolls *under* it, so a see-through
|
|
60
|
+
// gutter lets horizontally-scrolled code bleed through behind the line
|
|
61
|
+
// numbers. No divider border (overrides `basicSetup`'s default right border,
|
|
62
|
+
// hence an explicit `none`) so the gutter reads as part of the surface.
|
|
63
|
+
'.cm-gutters': {
|
|
64
|
+
borderRight: 'none',
|
|
65
|
+
color: 'var(--ink-gray-5, #64748b)',
|
|
66
|
+
},
|
|
67
|
+
// Scroll shadow: while the content is scrolled horizontally it slides under
|
|
68
|
+
// the sticky gutter, so a right-edge shadow signals the hidden code. It's a
|
|
69
|
+
// pseudo-element rather than a `box-shadow` on `.cm-gutters` itself because
|
|
70
|
+
// CodeMirror stretches the gutter to the full editor height (`.cm-content`
|
|
71
|
+
// fills it, and the gutter's `min-height` tracks that) — a gutter shadow
|
|
72
|
+
// would run down past the last line into the empty area below, where, with
|
|
73
|
+
// the gutter camouflaged against the surface, it looks like a shadow
|
|
74
|
+
// floating in space. Instead this overlay is capped to the actual text
|
|
75
|
+
// height via `--cm-text-height` (the last line's bottom, set from the SFC),
|
|
76
|
+
// so it ends with the code. `cm-scrolled-x` (also set there) fades it in.
|
|
77
|
+
'.cm-gutters::after': {
|
|
78
|
+
content: '""',
|
|
79
|
+
position: 'absolute',
|
|
80
|
+
top: '0',
|
|
81
|
+
right: '0',
|
|
82
|
+
width: '6px',
|
|
83
|
+
height: 'var(--cm-text-height, 100%)',
|
|
84
|
+
transform: 'translateX(100%)',
|
|
85
|
+
pointerEvents: 'none',
|
|
86
|
+
opacity: '0',
|
|
87
|
+
transition: 'opacity 0.15s ease',
|
|
88
|
+
background: 'linear-gradient(to right, rgba(0, 0, 0, 0.16), transparent)',
|
|
89
|
+
},
|
|
90
|
+
'&.cm-scrolled-x .cm-gutters::after': {
|
|
91
|
+
opacity: '1',
|
|
92
|
+
},
|
|
93
|
+
// Fold marker. `basicSetup` renders a bare text caret pinned to the
|
|
94
|
+
// cell's top-left; center it and swap the glyph for a masked chevron
|
|
95
|
+
// (inherits the gutter `currentColor`). The marker carries no open/closed
|
|
96
|
+
// class, but its `title` differs — so rotate it to point right when folded.
|
|
97
|
+
'.cm-foldGutter .cm-gutterElement': {
|
|
98
|
+
display: 'flex',
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
justifyContent: 'center',
|
|
101
|
+
padding: '0 2px',
|
|
102
|
+
cursor: 'pointer',
|
|
103
|
+
},
|
|
104
|
+
'.cm-foldGutter .cm-gutterElement:hover': {
|
|
105
|
+
color: 'var(--ink-gray-8, #1e293b)',
|
|
106
|
+
},
|
|
107
|
+
'.cm-foldGutter .cm-gutterElement > span': {
|
|
108
|
+
display: 'block',
|
|
109
|
+
width: '14px',
|
|
110
|
+
height: '14px',
|
|
111
|
+
fontSize: '0',
|
|
112
|
+
backgroundColor: 'currentColor',
|
|
113
|
+
transition: 'transform 0.12s ease',
|
|
114
|
+
WebkitMaskImage: FOLD_CHEVRON,
|
|
115
|
+
maskImage: FOLD_CHEVRON,
|
|
116
|
+
WebkitMaskRepeat: 'no-repeat',
|
|
117
|
+
maskRepeat: 'no-repeat',
|
|
118
|
+
WebkitMaskPosition: 'center',
|
|
119
|
+
maskPosition: 'center',
|
|
120
|
+
WebkitMaskSize: '14px 14px',
|
|
121
|
+
maskSize: '14px 14px',
|
|
122
|
+
},
|
|
123
|
+
".cm-foldGutter .cm-gutterElement > span[title='Unfold line']": {
|
|
124
|
+
transform: 'rotate(-90deg)',
|
|
125
|
+
},
|
|
126
|
+
// The fold gutter otherwise reserves a column even when nothing on screen is
|
|
127
|
+
// foldable (plain text, a flat markdown doc) — dead space next to the code.
|
|
128
|
+
// Collapse it to zero width until at least one line renders a real fold
|
|
129
|
+
// chevron. The catch: CodeMirror sizes the gutter with an always-present
|
|
130
|
+
// hidden "spacer" element (a FoldMarker span tagged with inline
|
|
131
|
+
// `visibility: hidden`), so a naive `:has(> span)` is always true. We exclude
|
|
132
|
+
// the spacer with `:not([style*='visibility'])`, leaving only the chevrons
|
|
133
|
+
// that actually appear on foldable lines. `overflow: hidden` then clips the
|
|
134
|
+
// spacer's span so it stops reserving width once collapsed. `:has`
|
|
135
|
+
// re-evaluates live, so the column appears/disappears as folds come and go.
|
|
136
|
+
".cm-foldGutter:not(:has(.cm-gutterElement:not([style*='visibility']) > span))":
|
|
137
|
+
{
|
|
138
|
+
width: '0',
|
|
139
|
+
overflow: 'hidden',
|
|
140
|
+
},
|
|
141
|
+
".cm-foldGutter:not(:has(.cm-gutterElement:not([style*='visibility']) > span)) .cm-gutterElement":
|
|
142
|
+
{
|
|
143
|
+
padding: '0',
|
|
144
|
+
},
|
|
145
|
+
// Same for the JSON lint gutter: it holds a fixed column for diagnostic
|
|
146
|
+
// markers, but valid JSON has none, so collapse it until a `.cm-lint-marker`
|
|
147
|
+
// appears. The column springs back the moment the parser reports an error.
|
|
148
|
+
'.cm-gutter-lint:not(:has(.cm-lint-marker))': {
|
|
149
|
+
width: '0',
|
|
150
|
+
},
|
|
151
|
+
'.cm-gutter-lint:not(:has(.cm-lint-marker)) .cm-gutterElement': {
|
|
152
|
+
padding: '0',
|
|
153
|
+
},
|
|
154
|
+
// `basicSetup` highlights the active line/gutter in a default light blue.
|
|
155
|
+
// A fixed gray token can't stay visible across every surface the row sits on
|
|
156
|
+
// — the `subtle` fill (gray-2), its hover fill (gray-3), and the white
|
|
157
|
+
// `outline` surface — and using gray-3 makes the row vanish on hover, where
|
|
158
|
+
// the surface itself becomes gray-3. Instead use a low-alpha `ink-gray-9`
|
|
159
|
+
// overlay: it darkens (light mode) or lightens (dark mode, where the token
|
|
160
|
+
// flips to near-white) whatever surface is beneath by a constant amount, so
|
|
161
|
+
// the active row always reads. Being mostly transparent, it also lets the
|
|
162
|
+
// selection — drawn behind the content — show through on the active row.
|
|
163
|
+
'.cm-activeLine': {
|
|
164
|
+
backgroundColor:
|
|
165
|
+
'color-mix(in srgb, var(--ink-gray-9, #0f0f0f) 7%, transparent)',
|
|
166
|
+
},
|
|
167
|
+
'.cm-activeLineGutter': {
|
|
168
|
+
backgroundColor:
|
|
169
|
+
'color-mix(in srgb, var(--ink-gray-9, #0f0f0f) 7%, transparent)',
|
|
170
|
+
color: 'var(--ink-gray-7, #525252)',
|
|
171
|
+
},
|
|
172
|
+
// Autocomplete / hover tooltips (from `basicSetup`) default to a light
|
|
173
|
+
// popup — theme them off `--surface-elevation-2` (the elevated popover surface)
|
|
174
|
+
// so the dropdown follows dark mode instead of flashing white.
|
|
175
|
+
'.cm-tooltip': {
|
|
176
|
+
backgroundColor: 'var(--surface-elevation-2, white)',
|
|
177
|
+
border: '1px solid var(--surface-gray-3, #cbd5e1)',
|
|
178
|
+
borderRadius: 'var(--radius-md, 0.5rem)',
|
|
179
|
+
color: 'var(--ink-gray-8, #1e293b)',
|
|
180
|
+
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.12)',
|
|
181
|
+
overflow: 'hidden',
|
|
182
|
+
},
|
|
183
|
+
'.cm-tooltip-autocomplete > ul': {
|
|
184
|
+
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Consolas, monospace',
|
|
185
|
+
},
|
|
186
|
+
'.cm-tooltip-autocomplete > ul > li': {
|
|
187
|
+
color: 'var(--ink-gray-7, #475569)',
|
|
188
|
+
padding: '2px 6px',
|
|
189
|
+
},
|
|
190
|
+
'.cm-tooltip-autocomplete > ul > li[aria-selected]': {
|
|
191
|
+
backgroundColor: 'var(--surface-gray-3, #e2e8f0)',
|
|
192
|
+
color: 'var(--ink-gray-9, #0f172a)',
|
|
193
|
+
},
|
|
194
|
+
'.cm-completionIcon': {
|
|
195
|
+
color: 'var(--ink-gray-5, #64748b)',
|
|
196
|
+
},
|
|
197
|
+
'.cm-completionMatchedText': {
|
|
198
|
+
color: 'var(--ink-blue-6)',
|
|
199
|
+
textDecoration: 'none',
|
|
200
|
+
fontWeight: '600',
|
|
201
|
+
},
|
|
202
|
+
'.cm-completionDetail': {
|
|
203
|
+
color: 'var(--ink-gray-5, #64748b)',
|
|
204
|
+
fontStyle: 'italic',
|
|
205
|
+
},
|
|
206
|
+
})
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Syntax highlighting keyed to `--ink-*` tokens so the palette flips with the
|
|
210
|
+
// app theme. `basicSetup` already installs CodeMirror's default (light-tuned)
|
|
211
|
+
// highlight style; layering this at the highest precedence makes it win for
|
|
212
|
+
// every tag we define, and the default only fills the rare gaps we don't.
|
|
213
|
+
export async function buildSyntaxHighlight(
|
|
214
|
+
cmState: typeof import('@codemirror/state'),
|
|
215
|
+
): Promise<Extension> {
|
|
216
|
+
const { HighlightStyle, syntaxHighlighting } =
|
|
217
|
+
await import('@codemirror/language')
|
|
218
|
+
const { tags } = await import('@lezer/highlight')
|
|
219
|
+
const highlightStyle = HighlightStyle.define([
|
|
220
|
+
{
|
|
221
|
+
tag: [tags.keyword, tags.moduleKeyword, tags.controlKeyword],
|
|
222
|
+
color: 'var(--ink-blue-6)',
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
tag: [tags.string, tags.special(tags.string), tags.regexp],
|
|
226
|
+
color: 'var(--ink-green-6)',
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
tag: [tags.comment, tags.lineComment, tags.blockComment],
|
|
230
|
+
color: 'var(--ink-gray-5)',
|
|
231
|
+
fontStyle: 'italic',
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
tag: [tags.number, tags.bool, tags.null, tags.atom],
|
|
235
|
+
color: 'var(--ink-amber-6)',
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
tag: [tags.typeName, tags.className, tags.namespace],
|
|
239
|
+
color: 'var(--ink-amber-6)',
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
tag: [
|
|
243
|
+
tags.function(tags.variableName),
|
|
244
|
+
tags.function(tags.propertyName),
|
|
245
|
+
tags.labelName,
|
|
246
|
+
],
|
|
247
|
+
color: 'var(--ink-blue-6)',
|
|
248
|
+
},
|
|
249
|
+
{ tag: [tags.propertyName, tags.attributeName], color: 'var(--ink-red-6)' },
|
|
250
|
+
{ tag: [tags.tagName, tags.angleBracket], color: 'var(--ink-red-6)' },
|
|
251
|
+
{
|
|
252
|
+
tag: [tags.operator, tags.punctuation, tags.separator, tags.bracket],
|
|
253
|
+
color: 'var(--ink-gray-6)',
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
tag: [tags.variableName, tags.definition(tags.variableName)],
|
|
257
|
+
color: 'var(--ink-gray-8)',
|
|
258
|
+
},
|
|
259
|
+
{ tag: tags.meta, color: 'var(--ink-gray-5)' },
|
|
260
|
+
{
|
|
261
|
+
tag: [tags.link, tags.url],
|
|
262
|
+
color: 'var(--ink-blue-6)',
|
|
263
|
+
textDecoration: 'underline',
|
|
264
|
+
},
|
|
265
|
+
{ tag: tags.heading, color: 'var(--ink-blue-6)', fontWeight: 'bold' },
|
|
266
|
+
{ tag: tags.strong, fontWeight: 'bold' },
|
|
267
|
+
{ tag: tags.emphasis, fontStyle: 'italic' },
|
|
268
|
+
{ tag: tags.strikethrough, textDecoration: 'line-through' },
|
|
269
|
+
{ tag: tags.invalid, color: 'var(--ink-red-8)' },
|
|
270
|
+
])
|
|
271
|
+
return cmState.Prec.highest(syntaxHighlighting(highlightStyle))
|
|
272
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Props/emits for the CodeEditor writer primitive. Kept here so the field
|
|
2
|
+
// wrapper and stories can share the same contract without importing the .vue.
|
|
3
|
+
|
|
4
|
+
import type { InputLabelingProps } from '../../composables/useInputLabeling'
|
|
5
|
+
import type { InputSize, InputVariant } from '../../composables/inputTypes'
|
|
6
|
+
|
|
7
|
+
/** A language key understood by `loadLanguage`. */
|
|
8
|
+
export type CodeLanguage =
|
|
9
|
+
| 'json'
|
|
10
|
+
| 'html'
|
|
11
|
+
| 'javascript'
|
|
12
|
+
| 'python'
|
|
13
|
+
| 'sql'
|
|
14
|
+
| 'markdown'
|
|
15
|
+
| 'css'
|
|
16
|
+
| 'scss'
|
|
17
|
+
| 'yaml'
|
|
18
|
+
| 'xml'
|
|
19
|
+
| 'plain'
|
|
20
|
+
|
|
21
|
+
export interface CodeEditorProps extends InputLabelingProps {
|
|
22
|
+
/** The editor's text content (controlled, two-way via `v-model`). */
|
|
23
|
+
modelValue: string
|
|
24
|
+
/**
|
|
25
|
+
* CodeMirror language key; falls through to plain text when unset/unknown.
|
|
26
|
+
* Typed as `CodeLanguage | (string & {})` so the known keys autocomplete
|
|
27
|
+
* while an arbitrary string still type-checks.
|
|
28
|
+
*/
|
|
29
|
+
language?: CodeLanguage | (string & {})
|
|
30
|
+
/** If true, the editor is disabled: greyed out and not editable. */
|
|
31
|
+
disabled?: boolean
|
|
32
|
+
/** Placeholder shown when the editor is empty. */
|
|
33
|
+
placeholder?: string
|
|
34
|
+
/**
|
|
35
|
+
* Surface style; derived from the shared `InputVariant` union so the code
|
|
36
|
+
* field can't drift from the TextInput/Textarea fields it sits next to.
|
|
37
|
+
* `subtle` is the filled default, `outline` is a bordered-on-white box.
|
|
38
|
+
* `ghost` (borderless) is excluded — a borderless code surface reads as plain
|
|
39
|
+
* text and loses the affordance that it's an editable field. Defaults to
|
|
40
|
+
* `subtle`.
|
|
41
|
+
*/
|
|
42
|
+
variant?: Exclude<InputVariant, 'ghost'>
|
|
43
|
+
/**
|
|
44
|
+
* Size token, mirroring frappe-ui inputs. Scales the editor's font size and
|
|
45
|
+
* minimum height (`sm | md | lg | xl`). Defaults to `md`.
|
|
46
|
+
*/
|
|
47
|
+
size?: InputSize
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type CodeEditorEmits = {
|
|
51
|
+
/** Live document text on every change — mirrors the textarea field contract. */
|
|
52
|
+
'update:modelValue': [value: string]
|
|
53
|
+
/** Commit (blur). The field wrapper normalizes (e.g. JSON pretty-print) here. */
|
|
54
|
+
change: [value: string]
|
|
55
|
+
/**
|
|
56
|
+
* Whether the content currently overflows the height cap (only transitions are
|
|
57
|
+
* emitted). The cap is set in CSS via the `--cm-max-height` custom property on
|
|
58
|
+
* the root (there's no `maxHeight` prop — styling lives in CSS per P10); this
|
|
59
|
+
* emit reports the crossing because a consumer can't measure it from CSS.
|
|
60
|
+
*/
|
|
61
|
+
overflow: [overflowing: boolean]
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface CodePreviewProps {
|
|
65
|
+
/** The source text to render as sanitized preview output. */
|
|
66
|
+
modelValue: string
|
|
67
|
+
/** Only `markdown` / `html` render a preview; anything else renders nothing. */
|
|
68
|
+
language?: CodeLanguage | (string & {})
|
|
69
|
+
}
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
{
|
|
166
166
|
name: 'trigger',
|
|
167
167
|
description: 'Fully custom trigger renderer.',
|
|
168
|
-
type: '
|
|
168
|
+
type: 'ComboboxControlSlotProps'
|
|
169
169
|
},
|
|
170
170
|
{
|
|
171
171
|
name: 'label',
|
|
@@ -179,13 +179,13 @@
|
|
|
179
179
|
},
|
|
180
180
|
{
|
|
181
181
|
name: 'prefix',
|
|
182
|
-
description: 'Content rendered before the default input. Receives the same shape\nas
|
|
183
|
-
type: '
|
|
182
|
+
description: 'Content rendered before the default input. Receives the same shape\nas the other control slots.',
|
|
183
|
+
type: 'ComboboxControlSlotProps'
|
|
184
184
|
},
|
|
185
185
|
{
|
|
186
186
|
name: 'suffix',
|
|
187
187
|
description: 'Content rendered after the input (input mode) or label (button mode).\nProviding this slot **replaces the default chevron** — render your\nown fallback (e.g. the chevron) when your slot content is conditional.\nCommon use: an inline clear button. Use `@click.stop` and\n`@pointerdown.stop` so the press doesn\'t toggle the popover.',
|
|
188
|
-
type: '
|
|
188
|
+
type: 'ComboboxControlSlotProps'
|
|
189
189
|
},
|
|
190
190
|
{
|
|
191
191
|
name: 'item-prefix',
|
|
@@ -219,8 +219,8 @@
|
|
|
219
219
|
},
|
|
220
220
|
{
|
|
221
221
|
name: 'footer',
|
|
222
|
-
description: 'Content rendered after the list. Stays pinned below the scrollable
|
|
223
|
-
type: '
|
|
222
|
+
description: 'Content rendered after the list. Stays pinned below the scrollable\noptions.',
|
|
223
|
+
type: 'ComboboxControlSlotProps'
|
|
224
224
|
}
|
|
225
225
|
]
|
|
226
226
|
|
|
@@ -235,20 +235,15 @@
|
|
|
235
235
|
description: 'Fired when the query changes.',
|
|
236
236
|
type: '[value: string]'
|
|
237
237
|
},
|
|
238
|
-
{
|
|
239
|
-
name: 'input',
|
|
240
|
-
description: '',
|
|
241
|
-
type: '[value: string]'
|
|
242
|
-
},
|
|
243
238
|
{
|
|
244
239
|
name: 'update:open',
|
|
245
240
|
description: 'Fired when the open state changes.',
|
|
246
241
|
type: '[value: boolean]'
|
|
247
242
|
},
|
|
248
243
|
{
|
|
249
|
-
name: '
|
|
250
|
-
description: '
|
|
251
|
-
type: '[
|
|
244
|
+
name: 'blur',
|
|
245
|
+
description: '',
|
|
246
|
+
type: '[event: FocusEvent]'
|
|
252
247
|
},
|
|
253
248
|
{
|
|
254
249
|
name: 'focus',
|
|
@@ -256,17 +251,21 @@
|
|
|
256
251
|
type: '[event: FocusEvent]'
|
|
257
252
|
},
|
|
258
253
|
{
|
|
259
|
-
name: '
|
|
254
|
+
name: 'input',
|
|
260
255
|
description: '',
|
|
261
|
-
type: '[
|
|
256
|
+
type: '[value: string]'
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
name: 'update:selectedOption',
|
|
260
|
+
description: 'Fired when the selected option changes.',
|
|
261
|
+
type: '[option: ComboboxSelectableOption | ComboboxCustomOption | null]'
|
|
262
262
|
}
|
|
263
263
|
]
|
|
264
264
|
</script>
|
|
265
265
|
## API Reference
|
|
266
266
|
|
|
267
|
-
<PropsTable name="Combobox" :data="propsData"/>
|
|
268
|
-
|
|
269
|
-
<SlotsTable :data="slotsData"/>
|
|
267
|
+
<PropsTable name="Combobox" :data="propsData"/>
|
|
270
268
|
|
|
271
|
-
<
|
|
269
|
+
<SlotsTable :data="slotsData"/>
|
|
272
270
|
|
|
271
|
+
<EmitsTable :data="emitsData"/>
|