@xdev-asia/ui 0.0.0-stage → 4.15.1
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/AGENTS.md +66 -0
- package/LICENSE +202 -0
- package/README.md +149 -2
- package/assets/brand/mobile/android-background-1024.png +0 -0
- package/assets/brand/mobile/android-background.svg +13 -0
- package/assets/brand/mobile/android-foreground-1024.png +0 -0
- package/assets/brand/mobile/android-foreground.svg +13 -0
- package/assets/brand/mobile/android-monochrome-1024.png +0 -0
- package/assets/brand/mobile/android-monochrome.svg +3 -0
- package/assets/brand/mobile/ios-icon-1024.png +0 -0
- package/assets/brand/mobile/ios-icon-dark-1024.png +0 -0
- package/assets/brand/mobile/ios-icon-dark.svg +22 -0
- package/assets/brand/mobile/ios-icon.svg +22 -0
- package/assets/brand/systems/xdev-ui-icon.svg +23 -0
- package/assets/brand/systems/xdev-ui-lockup-dark.svg +24 -0
- package/assets/brand/systems/xdev-ui-lockup-light.svg +24 -0
- package/assets/brand/systems/xdev-ui-mark-lit.svg +13 -0
- package/assets/brand/systems/xdev-ui-mark.svg +3 -0
- package/assets/brand/xdev-icon-512.png +0 -0
- package/assets/brand/xdev-icon-blue.svg +23 -0
- package/assets/brand/xdev-icon.svg +23 -0
- package/assets/brand/xdev-lockup-dark.svg +24 -0
- package/assets/brand/xdev-lockup-light.svg +24 -0
- package/assets/brand/xdev-mark-lit.svg +13 -0
- package/assets/brand/xdev-mark-tile.svg +3 -0
- package/assets/brand/xdev-mark.svg +3 -0
- package/bin/xdev-ui-skills.mjs +142 -0
- package/dist/Workspace.stories.d.ts +15 -0
- package/dist/ai-manifest.json +3727 -0
- package/dist/chunks/FileDrop-C-ygn8kF.js +891 -0
- package/dist/chunks/FileDrop-C-ygn8kF.js.map +1 -0
- package/dist/chunks/Popover-Ds4RBtZv.js +121 -0
- package/dist/chunks/Popover-Ds4RBtZv.js.map +1 -0
- package/dist/chunks/crop-CahE3q01.js +55 -0
- package/dist/chunks/crop-CahE3q01.js.map +1 -0
- package/dist/chunks/modal-BYFY08ti.js +54 -0
- package/dist/chunks/modal-BYFY08ti.js.map +1 -0
- package/dist/components/ActionTile/ActionTile.d.ts +14 -0
- package/dist/components/ActionTile/ActionTile.stories.d.ts +18 -0
- package/dist/components/ActivityBar/ActivityBar.d.ts +36 -0
- package/dist/components/ActivityBar/ActivityBar.stories.d.ts +27 -0
- package/dist/components/AgentChip/AgentChip.d.ts +10 -0
- package/dist/components/AgentChip/AgentChip.stories.d.ts +21 -0
- package/dist/components/AgentRow/AgentRow.d.ts +24 -0
- package/dist/components/AgentRow/AgentRow.stories.d.ts +19 -0
- package/dist/components/AppShell/AppShell.d.ts +58 -0
- package/dist/components/AppShell/AppShell.stories.d.ts +17 -0
- package/dist/components/ApprovalBar/ApprovalBar.d.ts +23 -0
- package/dist/components/ApprovalBar/ApprovalBar.stories.d.ts +18 -0
- package/dist/components/AttentionInbox/AttentionInbox.d.ts +43 -0
- package/dist/components/AttentionInbox/AttentionInbox.stories.d.ts +16 -0
- package/dist/components/AudioPreview/AudioPreview.d.ts +33 -0
- package/dist/components/AudioPreview/AudioPreview.stories.d.ts +23 -0
- package/dist/components/AudioPreview/audio-preview-store.d.ts +14 -0
- package/dist/components/AuthShell/AuthShell.d.ts +24 -0
- package/dist/components/AuthShell/AuthShell.stories.d.ts +20 -0
- package/dist/components/Avatar/Avatar.d.ts +13 -0
- package/dist/components/Avatar/Avatar.stories.d.ts +21 -0
- package/dist/components/Badge/Badge.d.ts +14 -0
- package/dist/components/Badge/Badge.stories.d.ts +26 -0
- package/dist/components/Banner/Banner.d.ts +11 -0
- package/dist/components/Banner/Banner.stories.d.ts +23 -0
- package/dist/components/BarChart/BarChart.d.ts +20 -0
- package/dist/components/BarChart/BarChart.stories.d.ts +24 -0
- package/dist/components/Board/Board.d.ts +9 -0
- package/dist/components/Board/Board.stories.d.ts +18 -0
- package/dist/components/BoardCard/BoardCard.d.ts +32 -0
- package/dist/components/BoardColumn/BoardColumn.d.ts +24 -0
- package/dist/components/BottomNav/BottomNav.d.ts +40 -0
- package/dist/components/BottomNav/BottomNav.stories.d.ts +40 -0
- package/dist/components/BrandMark/BrandMark.d.ts +20 -0
- package/dist/components/BrandMark/BrandMark.stories.d.ts +28 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +22 -0
- package/dist/components/Breadcrumb/Breadcrumb.stories.d.ts +27 -0
- package/dist/components/BulkBar/BulkBar.d.ts +21 -0
- package/dist/components/BulkBar/BulkBar.stories.d.ts +16 -0
- package/dist/components/Button/Button.d.ts +42 -0
- package/dist/components/Button/Button.stories.d.ts +41 -0
- package/dist/components/Card/Card.d.ts +22 -0
- package/dist/components/Card/Card.stories.d.ts +307 -0
- package/dist/components/Checkbox/Checkbox.d.ts +10 -0
- package/dist/components/Checkbox/Checkbox.stories.d.ts +18 -0
- package/dist/components/Coachmark/Coachmark.d.ts +31 -0
- package/dist/components/Coachmark/Coachmark.stories.d.ts +27 -0
- package/dist/components/Coachmark/placeCoachmark.d.ts +31 -0
- package/dist/components/CodeBlock/CodeBlock.d.ts +19 -0
- package/dist/components/CodeBlock/CodeBlock.stories.d.ts +22 -0
- package/dist/components/CodeInput/CodeInput.d.ts +25 -0
- package/dist/components/CodeInput/CodeInput.stories.d.ts +32 -0
- package/dist/components/CodeInput/normalizeCode.d.ts +10 -0
- package/dist/components/ColorField/ColorField.d.ts +29 -0
- package/dist/components/Combobox/Combobox.d.ts +105 -0
- package/dist/components/Combobox/Combobox.stories.d.ts +42 -0
- package/dist/components/CommandPalette/CommandPalette.d.ts +94 -0
- package/dist/components/CommandPalette/CommandPalette.stories.d.ts +39 -0
- package/dist/components/Comment/Comment.d.ts +25 -0
- package/dist/components/Comment/Comment.stories.d.ts +24 -0
- package/dist/components/CommitGraph/CommitGraph.d.ts +15 -0
- package/dist/components/CommitGraph/CommitGraph.stories.d.ts +15 -0
- package/dist/components/CommitGraph/graphLanes.d.ts +56 -0
- package/dist/components/Composer/Composer.d.ts +31 -0
- package/dist/components/Composer/Composer.stories.d.ts +17 -0
- package/dist/components/Container/Container.d.ts +11 -0
- package/dist/components/Container/Container.stories.d.ts +14 -0
- package/dist/components/DataTable/DataTable.d.ts +79 -0
- package/dist/components/DataTable/DataTable.stories.d.ts +26 -0
- package/dist/components/DataTable/table-helpers.d.ts +16 -0
- package/dist/components/DataTable/table-reorder.d.ts +40 -0
- package/dist/components/DatePicker/Calendar.d.ts +51 -0
- package/dist/components/DatePicker/DatePicker.d.ts +51 -0
- package/dist/components/DatePicker/DatePicker.stories.d.ts +42 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +59 -0
- package/dist/components/DateRangePicker/DateRangePicker.stories.d.ts +42 -0
- package/dist/components/DescriptionList/DescriptionList.d.ts +14 -0
- package/dist/components/DescriptionList/DescriptionList.stories.d.ts +21 -0
- package/dist/components/Dialog/Dialog.d.ts +43 -0
- package/dist/components/Dialog/Dialog.stories.d.ts +22 -0
- package/dist/components/DiffStat/DiffStat.d.ts +12 -0
- package/dist/components/DiffStat/DiffStat.stories.d.ts +15 -0
- package/dist/components/Disclosure/Disclosure.d.ts +18 -0
- package/dist/components/Disclosure/Disclosure.stories.d.ts +27 -0
- package/dist/components/DonutChart/DonutChart.d.ts +30 -0
- package/dist/components/DonutChart/DonutChart.stories.d.ts +26 -0
- package/dist/components/Drawer/Drawer.d.ts +27 -0
- package/dist/components/Drawer/Drawer.stories.d.ts +18 -0
- package/dist/components/Emblem/Emblem.d.ts +19 -0
- package/dist/components/Emblem/Emblem.stories.d.ts +19 -0
- package/dist/components/EmptyState/EmptyState.d.ts +43 -0
- package/dist/components/EmptyState/EmptyState.stories.d.ts +17 -0
- package/dist/components/EndpointPanel/EndpointPanel.d.ts +29 -0
- package/dist/components/FacetFilter/FacetFilter.d.ts +39 -0
- package/dist/components/FacetFilter/FacetFilter.stories.d.ts +23 -0
- package/dist/components/FacetFilter/facet-helpers.d.ts +5 -0
- package/dist/components/Field/Field.d.ts +27 -0
- package/dist/components/Field/Field.stories.d.ts +25 -0
- package/dist/components/FieldMessage/FieldMessage.d.ts +10 -0
- package/dist/components/FieldMessage/FieldMessage.stories.d.ts +14 -0
- package/dist/components/FileDrop/FileDrop.d.ts +72 -0
- package/dist/components/FileDrop/FileDrop.stories.d.ts +18 -0
- package/dist/components/FileIcon/FileIcon.d.ts +25 -0
- package/dist/components/FileIcon/FileIcon.stories.d.ts +14 -0
- package/dist/components/FilterChip/FilterChip.d.ts +9 -0
- package/dist/components/FilterChip/FilterChip.stories.d.ts +19 -0
- package/dist/components/FlowMap/FlowMap.d.ts +74 -0
- package/dist/components/FlowMap/FlowMap.stories.d.ts +24 -0
- package/dist/components/FontField/FontField.d.ts +15 -0
- package/dist/components/FontField/FontField.stories.d.ts +17 -0
- package/dist/components/FormDialog/FormDialog.d.ts +40 -0
- package/dist/components/FormDialog/FormDialog.stories.d.ts +22 -0
- package/dist/components/FormSection/FormSection.d.ts +19 -0
- package/dist/components/FormSection/FormSection.stories.d.ts +16 -0
- package/dist/components/Grid/Grid.d.ts +23 -0
- package/dist/components/Grid/Grid.stories.d.ts +19 -0
- package/dist/components/Grid/breakpoints.d.ts +25 -0
- package/dist/components/Heatmap/Heatmap.d.ts +22 -0
- package/dist/components/Heatmap/Heatmap.stories.d.ts +24 -0
- package/dist/components/Icon/Icon.d.ts +14 -0
- package/dist/components/Icon/Icon.stories.d.ts +20 -0
- package/dist/components/IconButton/IconButton.d.ts +16 -0
- package/dist/components/IconButton/IconButton.stories.d.ts +27 -0
- package/dist/components/Identity/Identity.d.ts +14 -0
- package/dist/components/Identity/Identity.stories.d.ts +14 -0
- package/dist/components/Kbd/Kbd.d.ts +5 -0
- package/dist/components/Kbd/Kbd.stories.d.ts +13 -0
- package/dist/components/Label/Label.d.ts +15 -0
- package/dist/components/Label/Label.stories.d.ts +16 -0
- package/dist/components/LaunchCard/LaunchCard.d.ts +36 -0
- package/dist/components/LaunchCard/LaunchCard.stories.d.ts +32 -0
- package/dist/components/List/List.d.ts +11 -0
- package/dist/components/List/List.stories.d.ts +13 -0
- package/dist/components/ListRow/ListRow.d.ts +20 -0
- package/dist/components/ListRow/ListRow.stories.d.ts +27 -0
- package/dist/components/Menu/Menu.d.ts +53 -0
- package/dist/components/Menu/Menu.stories.d.ts +85 -0
- package/dist/components/Menu/MenuButton.d.ts +23 -0
- package/dist/components/Menu/MenuButton.stories.d.ts +46 -0
- package/dist/components/Menu/menu-keys.d.ts +26 -0
- package/dist/components/Meter/Meter.d.ts +18 -0
- package/dist/components/Meter/Meter.stories.d.ts +34 -0
- package/dist/components/ModelChip/ModelChip.d.ts +26 -0
- package/dist/components/ModelChip/ModelChip.stories.d.ts +18 -0
- package/dist/components/NavList/NavList.d.ts +56 -0
- package/dist/components/NavList/NavList.stories.d.ts +25 -0
- package/dist/components/PageHeader/PageHeader.d.ts +14 -0
- package/dist/components/PageHeader/PageHeader.stories.d.ts +14 -0
- package/dist/components/Pagination/Pagination.d.ts +28 -0
- package/dist/components/Pagination/Pagination.stories.d.ts +16 -0
- package/dist/components/PairingCode/PairingCode.d.ts +17 -0
- package/dist/components/PairingCode/PairingCode.stories.d.ts +24 -0
- package/dist/components/PaletteTrigger/PaletteTrigger.d.ts +16 -0
- package/dist/components/PanZoom/PanZoom.d.ts +24 -0
- package/dist/components/PanZoom/PanZoom.stories.d.ts +11 -0
- package/dist/components/Popover/Popover.d.ts +24 -0
- package/dist/components/Popover/Popover.stories.d.ts +25 -0
- package/dist/components/Prose/Prose.d.ts +8 -0
- package/dist/components/Prose/Prose.stories.d.ts +12 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +27 -0
- package/dist/components/RadioGroup/RadioGroup.stories.d.ts +22 -0
- package/dist/components/ReactionBar/ReactionBar.d.ts +21 -0
- package/dist/components/ReactionBar/ReactionBar.stories.d.ts +26 -0
- package/dist/components/ResourceCard/ResourceCard.d.ts +30 -0
- package/dist/components/ResourceCard/ResourceCard.stories.d.ts +19 -0
- package/dist/components/ReviewComment/ReviewComment.d.ts +41 -0
- package/dist/components/ReviewComment/ReviewComment.stories.d.ts +19 -0
- package/dist/components/RouteDiagram/RouteDiagram.d.ts +27 -0
- package/dist/components/RunTimeline/RunTimeline.d.ts +28 -0
- package/dist/components/RunTimeline/RunTimeline.stories.d.ts +31 -0
- package/dist/components/SaveBar/SaveBar.d.ts +56 -0
- package/dist/components/SaveBar/SaveBar.stories.d.ts +16 -0
- package/dist/components/SearchInput/SearchInput.d.ts +22 -0
- package/dist/components/SearchInput/SearchInput.stories.d.ts +18 -0
- package/dist/components/SearchPicker/SearchPicker.d.ts +49 -0
- package/dist/components/SearchPicker/SearchPicker.stories.d.ts +33 -0
- package/dist/components/Segmented/Segmented.d.ts +18 -0
- package/dist/components/Segmented/Segmented.stories.d.ts +18 -0
- package/dist/components/Select/Select.d.ts +26 -0
- package/dist/components/Select/Select.stories.d.ts +22 -0
- package/dist/components/ServiceStatus/ServiceStatus.d.ts +13 -0
- package/dist/components/SessionBar/SessionBar.d.ts +33 -0
- package/dist/components/SessionBar/SessionBar.stories.d.ts +27 -0
- package/dist/components/SettingRow/SettingRow.d.ts +17 -0
- package/dist/components/SettingRow/SettingRow.stories.d.ts +26 -0
- package/dist/components/SettingsShell/SettingsShell.d.ts +52 -0
- package/dist/components/SettingsShell/SettingsShell.stories.d.ts +9 -0
- package/dist/components/ShellTitle/ShellTitle.d.ts +25 -0
- package/dist/components/SiteShell/SiteShell.d.ts +24 -0
- package/dist/components/SiteShell/SiteShell.stories.d.ts +18 -0
- package/dist/components/Skeleton/Skeleton.d.ts +20 -0
- package/dist/components/Skeleton/Skeleton.stories.d.ts +15 -0
- package/dist/components/SortableList/SortableList.d.ts +30 -0
- package/dist/components/SortableList/SortableList.stories.d.ts +16 -0
- package/dist/components/Spinner/Spinner.d.ts +15 -0
- package/dist/components/Spinner/Spinner.stories.d.ts +14 -0
- package/dist/components/SplitHandle/SplitHandle.d.ts +25 -0
- package/dist/components/SplitHandle/SplitHandle.stories.d.ts +18 -0
- package/dist/components/Stack/Stack.d.ts +18 -0
- package/dist/components/Stack/Stack.stories.d.ts +12 -0
- package/dist/components/StatTile/StatTile.d.ts +30 -0
- package/dist/components/StatTile/StatTile.stories.d.ts +32 -0
- package/dist/components/StatusBar/StatusBar.d.ts +8 -0
- package/dist/components/StatusBar/StatusBar.stories.d.ts +15 -0
- package/dist/components/StatusDot/StatusDot.d.ts +18 -0
- package/dist/components/StatusDot/StatusDot.stories.d.ts +24 -0
- package/dist/components/StepDots/StepDots.d.ts +15 -0
- package/dist/components/StepDots/StepDots.stories.d.ts +15 -0
- package/dist/components/SwatchGroup/SwatchGroup.d.ts +20 -0
- package/dist/components/SwatchGroup/SwatchGroup.stories.d.ts +33 -0
- package/dist/components/Switch/Switch.d.ts +10 -0
- package/dist/components/Switch/Switch.stories.d.ts +17 -0
- package/dist/components/TabStrip/TabStrip.d.ts +44 -0
- package/dist/components/TabStrip/TabStrip.stories.d.ts +66 -0
- package/dist/components/Tabs/Tabs.d.ts +28 -0
- package/dist/components/Tabs/Tabs.stories.d.ts +34 -0
- package/dist/components/Tag/Tag.d.ts +12 -0
- package/dist/components/Tag/Tag.stories.d.ts +21 -0
- package/dist/components/Textarea/Textarea.d.ts +15 -0
- package/dist/components/Textarea/Textarea.stories.d.ts +19 -0
- package/dist/components/ThemeEditor/ThemeEditor.d.ts +56 -0
- package/dist/components/ThemePreview/ThemePreview.d.ts +15 -0
- package/dist/components/ThemeSwitch/ThemeSwitch.d.ts +30 -0
- package/dist/components/ThemeSwitch/ThemeSwitch.stories.d.ts +15 -0
- package/dist/components/TimeField/TimeField.d.ts +32 -0
- package/dist/components/TimeField/TimeField.stories.d.ts +36 -0
- package/dist/components/TimeField/time-text.d.ts +26 -0
- package/dist/components/TimeSeriesChart/TimeSeriesChart.d.ts +30 -0
- package/dist/components/TimeSeriesChart/TimeSeriesChart.stories.d.ts +29 -0
- package/dist/components/Toast/Toast.d.ts +18 -0
- package/dist/components/Toast/Toast.stories.d.ts +15 -0
- package/dist/components/Toast/Toaster.d.ts +18 -0
- package/dist/components/Toast/Toaster.stories.d.ts +16 -0
- package/dist/components/Toast/toast-region.d.ts +17 -0
- package/dist/components/Toast/toast-store.d.ts +46 -0
- package/dist/components/ToggleButton/ToggleButton.d.ts +16 -0
- package/dist/components/ToggleButton/ToggleButton.stories.d.ts +20 -0
- package/dist/components/Toolbar/Toolbar.d.ts +21 -0
- package/dist/components/Toolbar/Toolbar.stories.d.ts +25 -0
- package/dist/components/Tooltip/Tooltip.d.ts +13 -0
- package/dist/components/Tooltip/Tooltip.stories.d.ts +23 -0
- package/dist/components/TreeView/TreeView.d.ts +42 -0
- package/dist/components/TreeView/TreeView.stories.d.ts +26 -0
- package/dist/components/TreeView/pathRows.d.ts +16 -0
- package/dist/components/TreeView/treeKeys.d.ts +16 -0
- package/dist/components/UsageMeterRow/UsageMeterRow.d.ts +28 -0
- package/dist/components/UsageMeterRow/UsageMeterRow.stories.d.ts +26 -0
- package/dist/components/WorktreeRow/WorktreeRow.d.ts +32 -0
- package/dist/components/WorktreeRow/WorktreeRow.stories.d.ts +32 -0
- package/dist/components/ZoomBar/ZoomBar.d.ts +22 -0
- package/dist/components/ZoomBar/ZoomBar.stories.d.ts +17 -0
- package/dist/editor/RichTextEditor/EditorToolbar.d.ts +35 -0
- package/dist/editor/RichTextEditor/ImageBar.d.ts +17 -0
- package/dist/editor/RichTextEditor/LinkForm.d.ts +16 -0
- package/dist/editor/RichTextEditor/RichTextEditor.d.ts +45 -0
- package/dist/editor/RichTextEditor/RichTextEditor.stories.d.ts +43 -0
- package/dist/editor/RichTextEditor/extensions.d.ts +23 -0
- package/dist/editor/RichTextEditor/icons.d.ts +23 -0
- package/dist/editor/RichTextEditor/insertImage.d.ts +28 -0
- package/dist/editor/RichTextEditor/labels.d.ts +32 -0
- package/dist/editor/index.d.ts +4 -0
- package/dist/editor.js +629 -0
- package/dist/editor.js.map +1 -0
- package/dist/fonts.css +2 -0
- package/dist/icons.d.ts +891 -0
- package/dist/image/ImageCropper/ImageCropper.d.ts +39 -0
- package/dist/image/ImageCropper/ImageCropper.stories.d.ts +18 -0
- package/dist/image/ImageField/ImageField.d.ts +86 -0
- package/dist/image/ImageField/ImageField.stories.d.ts +29 -0
- package/dist/image/crop.d.ts +39 -0
- package/dist/image/index.d.ts +3 -0
- package/dist/image.js +377 -0
- package/dist/image.js.map +1 -0
- package/dist/index.d.ts +138 -0
- package/dist/index.js +8253 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/cx.d.ts +2 -0
- package/dist/internal/date.d.ts +96 -0
- package/dist/internal/duration.d.ts +4 -0
- package/dist/internal/focus.d.ts +34 -0
- package/dist/internal/keys.d.ts +21 -0
- package/dist/internal/modal.d.ts +8 -0
- package/dist/internal/portal.d.ts +9 -0
- package/dist/internal/position.d.ts +37 -0
- package/dist/internal/reveal.d.ts +6 -0
- package/dist/internal/roving.d.ts +25 -0
- package/dist/internal/scroll-fade.d.ts +16 -0
- package/dist/internal/session-labels.d.ts +3 -0
- package/dist/internal/text.d.ts +2 -0
- package/dist/llms-full.txt +9786 -0
- package/dist/llms.txt +162 -0
- package/dist/mcp.js +24706 -0
- package/dist/panZoom.d.ts +40 -0
- package/dist/styles.css +2 -0
- package/dist/styles.layered.css +4 -0
- package/dist/tailwind.css +38 -0
- package/dist/test-utils.d.ts +5 -0
- package/dist/theme/font.d.ts +20 -0
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/theme.d.ts +62 -0
- package/dist/tokens.css +304 -0
- package/dist/tokens.json +267 -0
- package/dist/types.d.ts +6 -0
- package/package.json +177 -4
- package/skills/xdev-ui-admin/SKILL.md +106 -0
- package/skills/xdev-ui-admin/references/audit-log.md +18 -0
- package/skills/xdev-ui-admin/references/console-chrome.md +119 -0
- package/skills/xdev-ui-admin/references/dashboard.md +24 -0
- package/skills/xdev-ui-admin/references/detail-and-forms.md +22 -0
- package/skills/xdev-ui-admin/references/dialogs.md +33 -0
- package/skills/xdev-ui-admin/references/forms.md +60 -0
- package/skills/xdev-ui-admin/references/from-other-kits.md +75 -0
- package/skills/xdev-ui-admin/references/layout.md +58 -0
- package/skills/xdev-ui-admin/references/navigation.md +10 -0
- package/skills/xdev-ui-admin/references/permissions.md +26 -0
- package/skills/xdev-ui-admin/references/resource-list.md +64 -0
- package/skills/xdev-ui-admin/references/responsive.md +68 -0
- package/skills/xdev-ui-admin/references/rich-content.md +37 -0
- package/skills/xdev-ui-admin/references/settings.md +20 -0
- package/skills/xdev-ui-admin/references/sign-in.md +47 -0
- package/skills/xdev-ui-admin/references/states-feedback.md +26 -0
- package/skills/xdev-ui-admin/references/tree-list.md +50 -0
- package/skills/xdev-ui-admin/references/users-roles.md +32 -0
- package/skills/xdev-ui-admin/references/ux-principles.md +43 -0
- package/skills/xdev-ui-admin/references/visual-identity.md +62 -0
- package/skills/xdev-ui-admin/templates/admin/_gitignore +3 -0
- package/skills/xdev-ui-admin/templates/admin/_mcp.json +5 -0
- package/skills/xdev-ui-admin/templates/admin/_npmrc +2 -0
- package/skills/xdev-ui-admin/templates/admin/index.html +14 -0
- package/skills/xdev-ui-admin/templates/admin/package.json +24 -0
- package/skills/xdev-ui-admin/templates/admin/src/App.tsx +66 -0
- package/skills/xdev-ui-admin/templates/admin/src/app.css +26 -0
- package/skills/xdev-ui-admin/templates/admin/src/auth/permissions.ts +7 -0
- package/skills/xdev-ui-admin/templates/admin/src/auth/session.ts +42 -0
- package/skills/xdev-ui-admin/templates/admin/src/data/context.ts +11 -0
- package/skills/xdev-ui-admin/templates/admin/src/data/store.ts +84 -0
- package/skills/xdev-ui-admin/templates/admin/src/data/useLoad.ts +25 -0
- package/skills/xdev-ui-admin/templates/admin/src/i18n/en.ts +98 -0
- package/skills/xdev-ui-admin/templates/admin/src/i18n/index.tsx +63 -0
- package/skills/xdev-ui-admin/templates/admin/src/i18n/vi.ts +98 -0
- package/skills/xdev-ui-admin/templates/admin/src/i18n/xdev-ui-labels.ts +47 -0
- package/skills/xdev-ui-admin/templates/admin/src/main.tsx +12 -0
- package/skills/xdev-ui-admin/templates/admin/src/notify.tsx +36 -0
- package/skills/xdev-ui-admin/templates/admin/src/pages/Dashboard.tsx +55 -0
- package/skills/xdev-ui-admin/templates/admin/src/pages/ItemDetail.tsx +83 -0
- package/skills/xdev-ui-admin/templates/admin/src/pages/ItemsList.tsx +140 -0
- package/skills/xdev-ui-admin/templates/admin/src/pages/NotFound.tsx +17 -0
- package/skills/xdev-ui-admin/templates/admin/src/pages/Settings.tsx +37 -0
- package/skills/xdev-ui-admin/templates/admin/src/pages/SignIn.tsx +105 -0
- package/skills/xdev-ui-admin/templates/admin/src/router.ts +49 -0
- package/skills/xdev-ui-admin/templates/admin/src/shell/AccountMenu.tsx +36 -0
- package/skills/xdev-ui-admin/templates/admin/src/shell/Shell.tsx +53 -0
- package/skills/xdev-ui-admin/templates/admin/src/theme.ts +34 -0
- package/skills/xdev-ui-admin/templates/admin/tsconfig.json +16 -0
- package/skills/xdev-ui-admin/templates/admin/vite.config.ts +4 -0
- package/skills/xdev-ui-build-app/SKILL.md +85 -0
- package/skills/xdev-ui-build-app/references/app-shell.md +20 -0
- package/skills/xdev-ui-build-app/references/i18n.md +9 -0
- package/skills/xdev-ui-build-app/references/responsive-a11y.md +10 -0
- package/skills/xdev-ui-build-app/references/routing.md +14 -0
- package/skills/xdev-ui-build-app/references/setup.md +25 -0
- package/skills/xdev-ui-build-app/references/states.md +25 -0
- package/skills/xdev-ui-build-app/references/theme.md +11 -0
- package/skills/xdev-ui-build-app/templates/app/_gitignore +3 -0
- package/skills/xdev-ui-build-app/templates/app/_mcp.json +5 -0
- package/skills/xdev-ui-build-app/templates/app/_npmrc +2 -0
- package/skills/xdev-ui-build-app/templates/app/index.html +14 -0
- package/skills/xdev-ui-build-app/templates/app/package.json +24 -0
- package/skills/xdev-ui-build-app/templates/app/src/App.tsx +77 -0
- package/skills/xdev-ui-build-app/templates/app/src/app.css +3 -0
- package/skills/xdev-ui-build-app/templates/app/src/i18n/en.ts +35 -0
- package/skills/xdev-ui-build-app/templates/app/src/i18n/index.tsx +63 -0
- package/skills/xdev-ui-build-app/templates/app/src/i18n/vi.ts +35 -0
- package/skills/xdev-ui-build-app/templates/app/src/i18n/xdev-ui-labels.ts +19 -0
- package/skills/xdev-ui-build-app/templates/app/src/main.tsx +12 -0
- package/skills/xdev-ui-build-app/templates/app/src/notify.tsx +36 -0
- package/skills/xdev-ui-build-app/templates/app/src/pages/Home.tsx +22 -0
- package/skills/xdev-ui-build-app/templates/app/src/pages/NotFound.tsx +17 -0
- package/skills/xdev-ui-build-app/templates/app/src/pages/Settings.tsx +35 -0
- package/skills/xdev-ui-build-app/templates/app/src/router.ts +26 -0
- package/skills/xdev-ui-build-app/templates/app/src/theme.ts +34 -0
- package/skills/xdev-ui-build-app/templates/app/tsconfig.json +16 -0
- package/skills/xdev-ui-build-app/templates/app/vite.config.ts +4 -0
- package/skills/xdev-ui-design/SKILL.md +111 -0
- package/skills/xdev-ui-design/references/brand.md +58 -0
- package/skills/xdev-ui-design/references/checklist.md +55 -0
- package/skills/xdev-ui-design/references/owner-notes.md +54 -0
- package/skills/xdev-ui-design/references/porting.md +56 -0
- package/skills/xdev-ui-design/references/rules.md +135 -0
- package/skills/xdev-ui-design/references/screens.md +61 -0
- package/skills/xdev-ui-design/references/tokens.md +97 -0
- package/skills/xdev-ui-improve/SKILL.md +96 -0
- package/skills/xdev-ui-improve/references/plan-template.md +59 -0
- package/skills/xdev-ui-motion/SKILL.md +87 -0
- package/skills/xdev-ui-motion/references/recipes.md +117 -0
- package/skills/xdev-ui-review/SKILL.md +141 -0
- package/skills/xdev-ui-review/references/checklist.md +92 -0
- package/skills/xdev-ui-review/references/grep-recipes.md +37 -0
- package/skills/xdev-ui-review/references/pages/dashboard.md +21 -0
- package/skills/xdev-ui-review/references/pages/dialogs-forms.md +23 -0
- package/skills/xdev-ui-review/references/pages/list.md +22 -0
- package/skills/xdev-ui-review/references/pages/provider-grid.md +19 -0
- package/skills/xdev-ui-review/references/pages/settings.md +18 -0
- package/skills/xdev-ui-review/references/pages/sign-in.md +21 -0
- package/skills/xdev-ui-review/references/web-interface.md +73 -0
- package/skills/xdev-ui-review/scripts/audit.mjs +775 -0
- package/skills/xdev-ui-ux-standards/SKILL.md +88 -0
- package/skills/xdev-ui-ux-standards/references/heuristics-checklist.md +129 -0
- package/skills/xdev-ui-ux-standards/references/patterns.md +120 -0
- package/skills/xdev-ui-ux-standards/references/platforms.md +104 -0
- package/skills/xdev-ui-ux-standards/references/standards-map.md +144 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Editor } from "@tiptap/core";
|
|
2
|
+
/** Image types the editor uploads; the file picker offers the same list. */
|
|
3
|
+
export declare const IMAGE_TYPES: readonly ["image/jpeg", "image/png", "image/webp"];
|
|
4
|
+
export declare const DEFAULT_MAX_IMAGE_BYTES: number;
|
|
5
|
+
export declare const DEFAULT_IMAGE_MAX_WIDTH = 1600;
|
|
6
|
+
/** Why a file was refused, or null when it may be uploaded. Pure: reads only `type` and `size`. */
|
|
7
|
+
export declare function checkImageFile(file: {
|
|
8
|
+
type: string;
|
|
9
|
+
size: number;
|
|
10
|
+
}, maxBytes?: number): "type" | "size" | null;
|
|
11
|
+
/** The image files of a paste, drop or picker list (anything `image/*`; `checkImageFile` narrows further). */
|
|
12
|
+
export declare function imageFilesOf<F extends {
|
|
13
|
+
type: string;
|
|
14
|
+
}>(list: ArrayLike<F> | null | undefined): F[];
|
|
15
|
+
export interface InsertImageOptions {
|
|
16
|
+
upload: (file: File) => Promise<string>;
|
|
17
|
+
/** Re-encode to WebP at most this wide before upload; 0 uploads the original file. */
|
|
18
|
+
maxWidth: number;
|
|
19
|
+
onStart: () => void;
|
|
20
|
+
onEnd: () => void;
|
|
21
|
+
onError: (error: unknown) => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Puts the image into the document at once (dimmed, with a spinner), shrinks it to `maxWidth` WebP,
|
|
25
|
+
* uploads it and swaps the `blob:` placeholder for the returned URL. A failed upload removes it again.
|
|
26
|
+
* `onStart`/`onEnd` bracket the whole job so a form can lock its save button.
|
|
27
|
+
*/
|
|
28
|
+
export declare function insertImageFile(editor: Editor, file: File, at: number | null, opts: InsertImageOptions): Promise<void>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface RichTextEditorLabels {
|
|
2
|
+
/** aria-label of the formatting toolbar. */
|
|
3
|
+
toolbar: string;
|
|
4
|
+
heading2: string;
|
|
5
|
+
heading3: string;
|
|
6
|
+
bold: string;
|
|
7
|
+
italic: string;
|
|
8
|
+
bulletList: string;
|
|
9
|
+
orderedList: string;
|
|
10
|
+
quote: string;
|
|
11
|
+
link: string;
|
|
12
|
+
image: string;
|
|
13
|
+
undo: string;
|
|
14
|
+
redo: string;
|
|
15
|
+
/** Link form. */
|
|
16
|
+
linkDialog: string;
|
|
17
|
+
linkUrl: string;
|
|
18
|
+
linkInvalid: string;
|
|
19
|
+
linkApply: string;
|
|
20
|
+
linkRemove: string;
|
|
21
|
+
/** Image bar, shown while an image is selected. */
|
|
22
|
+
imageAlt: string;
|
|
23
|
+
imageAltPlaceholder: string;
|
|
24
|
+
imageRemove: string;
|
|
25
|
+
/** Spinner on an image that is uploading. */
|
|
26
|
+
uploading: string;
|
|
27
|
+
/** Shown when a picked, pasted or dropped file is not JPG/PNG/WebP or too big; gets the limit ("10 MB"). */
|
|
28
|
+
imageInvalid: (maxSize: string) => string;
|
|
29
|
+
/** Shown when `onUploadImage` rejects and there is no `onUploadError`. */
|
|
30
|
+
uploadFailed: string;
|
|
31
|
+
}
|
|
32
|
+
export declare const DEFAULT_LABELS: RichTextEditorLabels;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { RichTextEditor, type RichTextEditorProps, type RichTextFormat } from "./RichTextEditor/RichTextEditor";
|
|
2
|
+
export { DEFAULT_LABELS as RICH_TEXT_EDITOR_LABELS, type RichTextEditorLabels } from "./RichTextEditor/labels";
|
|
3
|
+
export { editorExtensions, isSafeUrl, type EditorExtensionOptions } from "./RichTextEditor/extensions";
|
|
4
|
+
export { checkImageFile } from "./RichTextEditor/insertImage";
|
package/dist/editor.js
ADDED
|
@@ -0,0 +1,629 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { d as e, o as t, r as n } from "./chunks/FileDrop-C-ygn8kF.js";
|
|
3
|
+
import { s as r, t as i } from "./chunks/Popover-Ds4RBtZv.js";
|
|
4
|
+
import { a, i as o, r as s } from "./chunks/crop-CahE3q01.js";
|
|
5
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
6
|
+
import { useCallback as d, useEffect as f, useId as p, useMemo as m, useRef as h, useState as g } from "react";
|
|
7
|
+
import { EditorContent as _, useEditor as v, useEditorState as y } from "@tiptap/react";
|
|
8
|
+
import { Extension as b } from "@tiptap/core";
|
|
9
|
+
import x from "@tiptap/extension-image";
|
|
10
|
+
import S from "@tiptap/extension-link";
|
|
11
|
+
import { Placeholder as C } from "@tiptap/extensions";
|
|
12
|
+
import { Markdown as w } from "@tiptap/markdown";
|
|
13
|
+
import T from "@tiptap/starter-kit";
|
|
14
|
+
import { NodeSelection as E } from "@tiptap/pm/state";
|
|
15
|
+
// src/editor/RichTextEditor/icons.tsx
|
|
16
|
+
var D = {
|
|
17
|
+
heading2: "M4 6v12M12 6v12M4 12h8M16 10.5a2.5 2.5 0 0 1 5 0c0 1.5-1.2 2.4-2.5 3.6L16 18h5",
|
|
18
|
+
heading3: "M4 6v12M12 6v12M4 12h8M16 8h5l-3 4a3 3 0 1 1-2.6 4.5",
|
|
19
|
+
bold: "M7 5h6a3.5 3.5 0 0 1 0 7H7zM7 12h7a3.5 3.5 0 0 1 0 7H7z",
|
|
20
|
+
italic: "M10 5h8M6 19h8M14 5l-4 14",
|
|
21
|
+
bulletList: "M9 6h11M9 12h11M9 18h11M4 6h.01M4 12h.01M4 18h.01",
|
|
22
|
+
orderedList: "M10 6h10M10 12h10M10 18h10M4 4.5l1.5-.5V9M3.5 14.5a1.5 1.5 0 0 1 3 .3c0 .9-3 2.2-3 3.7h3",
|
|
23
|
+
quote: "M5 17c2 0 3.5-1.5 3.5-3.5V8H4v5.5h4.5M15.5 17c2 0 3.5-1.5 3.5-3.5V8h-4.5v5.5H19",
|
|
24
|
+
link: "M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1",
|
|
25
|
+
image: "M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zM21 16l-5-5-9 9M9 8a2 2 0 1 0 0 4 2 2 0 0 0 0-4",
|
|
26
|
+
undo: "M9 14 4 9l5-5M4 9h10.5a5.5 5.5 0 0 1 0 11H11",
|
|
27
|
+
redo: "m15 14 5-5-5-5M20 9H9.5a5.5 5.5 0 0 0 0 11H13"
|
|
28
|
+
};
|
|
29
|
+
function O({ name: e }) {
|
|
30
|
+
return /* @__PURE__ */ l("svg", {
|
|
31
|
+
className: "x-icon",
|
|
32
|
+
width: 16,
|
|
33
|
+
height: 16,
|
|
34
|
+
viewBox: "0 0 24 24",
|
|
35
|
+
fill: "none",
|
|
36
|
+
stroke: "currentColor",
|
|
37
|
+
strokeWidth: 1.75,
|
|
38
|
+
strokeLinecap: "round",
|
|
39
|
+
strokeLinejoin: "round",
|
|
40
|
+
"aria-hidden": "true",
|
|
41
|
+
children: /* @__PURE__ */ l("path", { d: D[e] })
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
// src/editor/RichTextEditor/insertImage.ts
|
|
45
|
+
var k = [
|
|
46
|
+
"image/jpeg",
|
|
47
|
+
"image/png",
|
|
48
|
+
"image/webp"
|
|
49
|
+
], A = 10485760, j = 1600;
|
|
50
|
+
function M(e, t = A) {
|
|
51
|
+
return k.includes(e.type) ? e.size > t ? "size" : null : "type";
|
|
52
|
+
}
|
|
53
|
+
function N(e) {
|
|
54
|
+
return Array.from(e ?? []).filter((e) => e.type.startsWith("image/"));
|
|
55
|
+
}
|
|
56
|
+
function P(e, t) {
|
|
57
|
+
let n = null;
|
|
58
|
+
return e.state.doc.descendants((e, r) => !n && (e.type.name === "image" && e.attrs.src === t && (n = {
|
|
59
|
+
pos: r,
|
|
60
|
+
attrs: e.attrs
|
|
61
|
+
}), !n)), n;
|
|
62
|
+
}
|
|
63
|
+
async function ee(e, t, n, r) {
|
|
64
|
+
let i = URL.createObjectURL(t);
|
|
65
|
+
r.onStart();
|
|
66
|
+
try {
|
|
67
|
+
e.chain().focus().insertContentAt(n ?? e.state.selection.to, {
|
|
68
|
+
type: "image",
|
|
69
|
+
attrs: {
|
|
70
|
+
src: i,
|
|
71
|
+
alt: "",
|
|
72
|
+
uploading: !0
|
|
73
|
+
}
|
|
74
|
+
}).run();
|
|
75
|
+
try {
|
|
76
|
+
let n = t;
|
|
77
|
+
if (r.maxWidth > 0) {
|
|
78
|
+
let e = await a(await s(i), r.maxWidth);
|
|
79
|
+
n = new File([e], o(t.name, "webp"), { type: e.type || "image/webp" });
|
|
80
|
+
}
|
|
81
|
+
let c = await r.upload(n);
|
|
82
|
+
if (e.isDestroyed) return;
|
|
83
|
+
let l = P(e, i);
|
|
84
|
+
l && e.view.dispatch(e.state.tr.setNodeMarkup(l.pos, void 0, {
|
|
85
|
+
...l.attrs,
|
|
86
|
+
src: c,
|
|
87
|
+
uploading: !1
|
|
88
|
+
}));
|
|
89
|
+
} catch (t) {
|
|
90
|
+
if (e.isDestroyed) return;
|
|
91
|
+
let n = P(e, i);
|
|
92
|
+
n && e.view.dispatch(e.state.tr.delete(n.pos, n.pos + 1)), r.onError(t);
|
|
93
|
+
}
|
|
94
|
+
} finally {
|
|
95
|
+
URL.revokeObjectURL(i), r.onEnd();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// src/editor/RichTextEditor/extensions.ts
|
|
99
|
+
var F = /^https?:\/\/\S+$/i, I = (e) => F.test(e.trim()), L = (e) => (e ?? 2) <= 2 ? 2 : 3, R = b.create({
|
|
100
|
+
name: "xHeadingLevels",
|
|
101
|
+
priority: 1e3,
|
|
102
|
+
markdownTokenName: "heading",
|
|
103
|
+
parseMarkdown(e, t) {
|
|
104
|
+
return t.createNode("heading", { level: L(e.depth) }, t.parseInline(e.tokens ?? []));
|
|
105
|
+
},
|
|
106
|
+
renderMarkdown(e, t) {
|
|
107
|
+
return e.content ? `${"#".repeat(L(Number(e.attrs?.level) || 2))} ${t.renderChildren(e.content)}` : "";
|
|
108
|
+
}
|
|
109
|
+
}), z = S.extend({ parseMarkdown(e, t) {
|
|
110
|
+
let n = t.parseInline(e.tokens ?? []);
|
|
111
|
+
return I(e.href ?? "") ? t.applyMark("link", n, {
|
|
112
|
+
href: e.href,
|
|
113
|
+
title: e.title || null
|
|
114
|
+
}) : n;
|
|
115
|
+
} }), B = x.extend({
|
|
116
|
+
addOptions() {
|
|
117
|
+
return {
|
|
118
|
+
...this.parent?.(),
|
|
119
|
+
resolveSrc: (e) => e,
|
|
120
|
+
uploadingLabel: () => "Uploading image"
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
addAttributes() {
|
|
124
|
+
return {
|
|
125
|
+
...this.parent?.(),
|
|
126
|
+
uploading: {
|
|
127
|
+
default: !1,
|
|
128
|
+
rendered: !1
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
},
|
|
132
|
+
addNodeView() {
|
|
133
|
+
let e = this.options;
|
|
134
|
+
return ({ node: t }) => {
|
|
135
|
+
let n = t, r = document.createElement("div");
|
|
136
|
+
r.className = "x-editor-image";
|
|
137
|
+
let i = document.createElement("img"), a = document.createElement("span");
|
|
138
|
+
a.className = "x-spinner", a.setAttribute("role", "status"), a.dataset.size = "md";
|
|
139
|
+
let o = document.createElement("span");
|
|
140
|
+
o.className = "x-spinner-ring", o.setAttribute("aria-hidden", "true");
|
|
141
|
+
let s = document.createElement("span");
|
|
142
|
+
s.className = "x-sr-only", a.append(o, s), r.append(i);
|
|
143
|
+
let c = () => {
|
|
144
|
+
let t = n.attrs.src ?? "";
|
|
145
|
+
i.src = t.startsWith("blob:") ? t : e.resolveSrc(t), i.alt = n.attrs.alt ?? "", n.attrs.uploading ? (r.dataset.uploading = "", s.textContent = e.uploadingLabel(), a.isConnected || r.append(a)) : (delete r.dataset.uploading, a.remove());
|
|
146
|
+
};
|
|
147
|
+
return c(), {
|
|
148
|
+
dom: r,
|
|
149
|
+
update(e) {
|
|
150
|
+
return e.type === n.type && (n = e, c(), !0);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
function V({ placeholder: e, resolveSrc: t, uploadingLabel: n } = {}) {
|
|
157
|
+
return [
|
|
158
|
+
T.configure({
|
|
159
|
+
heading: { levels: [2, 3] },
|
|
160
|
+
link: !1,
|
|
161
|
+
underline: !1,
|
|
162
|
+
strike: !1,
|
|
163
|
+
code: !1,
|
|
164
|
+
codeBlock: !1,
|
|
165
|
+
horizontalRule: !1
|
|
166
|
+
}),
|
|
167
|
+
R,
|
|
168
|
+
z.configure({
|
|
169
|
+
openOnClick: !1,
|
|
170
|
+
autolink: !1,
|
|
171
|
+
protocols: [],
|
|
172
|
+
isAllowedUri: (e) => I(e)
|
|
173
|
+
}),
|
|
174
|
+
B.configure({
|
|
175
|
+
inline: !1,
|
|
176
|
+
allowBase64: !1,
|
|
177
|
+
resolveSrc: t ?? ((e) => e),
|
|
178
|
+
uploadingLabel: n ?? (() => "Uploading image")
|
|
179
|
+
}),
|
|
180
|
+
C.configure({ placeholder: () => e?.() ?? "" }),
|
|
181
|
+
w
|
|
182
|
+
];
|
|
183
|
+
}
|
|
184
|
+
// src/editor/RichTextEditor/LinkForm.tsx
|
|
185
|
+
function H(e, t) {
|
|
186
|
+
return I(e) ? t.empty && !t.inLink ? "insert" : "set" : "invalid";
|
|
187
|
+
}
|
|
188
|
+
function U({ editor: e, labels: n, onDone: r }) {
|
|
189
|
+
let i = `x-editor-link-${p()}`, a = `${i}-error`, o = h(null), [s, c] = g(() => e.getAttributes("link").href ?? ""), [d, m] = g(!1), _ = e.isActive("link");
|
|
190
|
+
f(() => {
|
|
191
|
+
let e = setTimeout(() => o.current?.focus(), 0);
|
|
192
|
+
return () => clearTimeout(e);
|
|
193
|
+
}, []);
|
|
194
|
+
let v = () => {
|
|
195
|
+
let t = s.trim(), n = H(t, {
|
|
196
|
+
empty: e.state.selection.empty,
|
|
197
|
+
inLink: _
|
|
198
|
+
});
|
|
199
|
+
if (n === "invalid") {
|
|
200
|
+
m(!0);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
let i = e.chain().focus();
|
|
204
|
+
n === "insert" ? i.insertContent({
|
|
205
|
+
type: "text",
|
|
206
|
+
text: t,
|
|
207
|
+
marks: [{
|
|
208
|
+
type: "link",
|
|
209
|
+
attrs: { href: t }
|
|
210
|
+
}]
|
|
211
|
+
}).run() : i.extendMarkRange("link").setLink({ href: t }).run(), r();
|
|
212
|
+
};
|
|
213
|
+
return /* @__PURE__ */ u("form", {
|
|
214
|
+
className: "x-editor-link",
|
|
215
|
+
noValidate: !0,
|
|
216
|
+
onSubmit: (e) => {
|
|
217
|
+
e.preventDefault(), v();
|
|
218
|
+
},
|
|
219
|
+
children: [/* @__PURE__ */ u("label", {
|
|
220
|
+
className: "ws-field",
|
|
221
|
+
htmlFor: i,
|
|
222
|
+
"data-invalid": d ? "" : void 0,
|
|
223
|
+
children: [
|
|
224
|
+
n.linkUrl,
|
|
225
|
+
/* @__PURE__ */ l("input", {
|
|
226
|
+
ref: o,
|
|
227
|
+
id: i,
|
|
228
|
+
type: "url",
|
|
229
|
+
inputMode: "url",
|
|
230
|
+
value: s,
|
|
231
|
+
placeholder: "https://",
|
|
232
|
+
"aria-invalid": d || void 0,
|
|
233
|
+
"aria-describedby": d ? a : void 0,
|
|
234
|
+
onChange: (e) => {
|
|
235
|
+
c(e.target.value), m(!1);
|
|
236
|
+
}
|
|
237
|
+
}),
|
|
238
|
+
d ? /* @__PURE__ */ l("small", {
|
|
239
|
+
id: a,
|
|
240
|
+
role: "alert",
|
|
241
|
+
children: n.linkInvalid
|
|
242
|
+
}) : null
|
|
243
|
+
]
|
|
244
|
+
}), /* @__PURE__ */ u("div", {
|
|
245
|
+
className: "dialog-actions",
|
|
246
|
+
children: [_ ? /* @__PURE__ */ l(t, {
|
|
247
|
+
variant: "secondary",
|
|
248
|
+
onClick: () => {
|
|
249
|
+
e.chain().focus().extendMarkRange("link").unsetLink().run(), r();
|
|
250
|
+
},
|
|
251
|
+
children: n.linkRemove
|
|
252
|
+
}) : null, /* @__PURE__ */ l(t, {
|
|
253
|
+
variant: "primary",
|
|
254
|
+
type: "submit",
|
|
255
|
+
children: n.linkApply
|
|
256
|
+
})]
|
|
257
|
+
})]
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
// src/editor/RichTextEditor/EditorToolbar.tsx
|
|
261
|
+
function W(e) {
|
|
262
|
+
return {
|
|
263
|
+
heading2: e.isActive("heading", { level: 2 }),
|
|
264
|
+
heading3: e.isActive("heading", { level: 3 }),
|
|
265
|
+
bold: e.isActive("bold"),
|
|
266
|
+
italic: e.isActive("italic"),
|
|
267
|
+
bulletList: e.isActive("bulletList"),
|
|
268
|
+
orderedList: e.isActive("orderedList"),
|
|
269
|
+
quote: e.isActive("blockquote"),
|
|
270
|
+
link: e.isActive("link"),
|
|
271
|
+
canUndo: e.can().undo(),
|
|
272
|
+
canRedo: e.can().redo()
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
function G(e, t) {
|
|
276
|
+
let n = !!t.disabled, r = (e, t, r = !1, i = n) => ({
|
|
277
|
+
key: e,
|
|
278
|
+
pressed: t,
|
|
279
|
+
disabled: i,
|
|
280
|
+
group: r
|
|
281
|
+
});
|
|
282
|
+
return [
|
|
283
|
+
r("heading2", e.heading2),
|
|
284
|
+
r("heading3", e.heading3),
|
|
285
|
+
r("bold", e.bold, !0),
|
|
286
|
+
r("italic", e.italic),
|
|
287
|
+
r("bulletList", e.bulletList, !0),
|
|
288
|
+
r("orderedList", e.orderedList),
|
|
289
|
+
r("quote", e.quote),
|
|
290
|
+
r("link", e.link, !0),
|
|
291
|
+
...t.image ? [r("image", void 0)] : [],
|
|
292
|
+
r("undo", void 0, !0, n || !e.canUndo),
|
|
293
|
+
r("redo", void 0, !1, n || !e.canRedo)
|
|
294
|
+
];
|
|
295
|
+
}
|
|
296
|
+
function K(e, t) {
|
|
297
|
+
let n = e.chain().focus();
|
|
298
|
+
switch (t) {
|
|
299
|
+
case "heading2":
|
|
300
|
+
n.toggleHeading({ level: 2 }).run();
|
|
301
|
+
break;
|
|
302
|
+
case "heading3":
|
|
303
|
+
n.toggleHeading({ level: 3 }).run();
|
|
304
|
+
break;
|
|
305
|
+
case "bold":
|
|
306
|
+
n.toggleBold().run();
|
|
307
|
+
break;
|
|
308
|
+
case "italic":
|
|
309
|
+
n.toggleItalic().run();
|
|
310
|
+
break;
|
|
311
|
+
case "bulletList":
|
|
312
|
+
n.toggleBulletList().run();
|
|
313
|
+
break;
|
|
314
|
+
case "orderedList":
|
|
315
|
+
n.toggleOrderedList().run();
|
|
316
|
+
break;
|
|
317
|
+
case "quote":
|
|
318
|
+
n.toggleBlockquote().run();
|
|
319
|
+
break;
|
|
320
|
+
case "undo":
|
|
321
|
+
n.undo().run();
|
|
322
|
+
break;
|
|
323
|
+
case "redo": n.redo().run();
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
function q(e, t) {
|
|
327
|
+
let n = e.target;
|
|
328
|
+
if (!n.hasAttribute?.("data-x-tool")) return;
|
|
329
|
+
let i = Array.from(e.currentTarget.querySelectorAll("[data-x-tool]")), a = i.indexOf(n);
|
|
330
|
+
if (a < 0) return;
|
|
331
|
+
let o = r(e.key, a, i.length, "horizontal", (e) => i[e]?.disabled ?? !1);
|
|
332
|
+
o != null && (e.preventDefault(), i[o]?.focus(), t(o));
|
|
333
|
+
}
|
|
334
|
+
function J({ editor: t, labels: n, linkOpen: r, onLinkOpenChange: a, onPickImages: o, disabled: s }) {
|
|
335
|
+
let c = h(null), [d, f] = g(0), p = G(y({
|
|
336
|
+
editor: t,
|
|
337
|
+
selector: ({ editor: e }) => W(e)
|
|
338
|
+
}), {
|
|
339
|
+
image: !!o,
|
|
340
|
+
disabled: s
|
|
341
|
+
}), m = p[d] && !p[d].disabled ? d : Math.max(0, p.findIndex((e) => !e.disabled)), _ = (e, i, o = {}) => /* @__PURE__ */ l("button", {
|
|
342
|
+
type: "button",
|
|
343
|
+
className: "ws-icon-btn x-editor-tool",
|
|
344
|
+
"data-x-tool": e.key,
|
|
345
|
+
"aria-label": n[e.key],
|
|
346
|
+
title: e.key === "link" ? `${n.link} (Ctrl+K)` : n[e.key],
|
|
347
|
+
"aria-pressed": e.pressed,
|
|
348
|
+
disabled: e.disabled,
|
|
349
|
+
tabIndex: i === m ? 0 : -1,
|
|
350
|
+
onFocus: () => f(i),
|
|
351
|
+
onClick: () => {
|
|
352
|
+
e.key === "link" ? a(!r) : e.key === "image" ? c.current?.click() : K(t, e.key);
|
|
353
|
+
},
|
|
354
|
+
...o,
|
|
355
|
+
children: /* @__PURE__ */ l(O, { name: e.key })
|
|
356
|
+
}, e.key);
|
|
357
|
+
return /* @__PURE__ */ u("div", {
|
|
358
|
+
className: "x-editor-toolbar",
|
|
359
|
+
role: "toolbar",
|
|
360
|
+
"aria-label": n.toolbar,
|
|
361
|
+
"aria-disabled": s || void 0,
|
|
362
|
+
onKeyDown: (e) => q(e, f),
|
|
363
|
+
children: [p.map((o, c) => /* @__PURE__ */ l("span", {
|
|
364
|
+
className: e("x-editor-slot", o.group && "x-editor-group"),
|
|
365
|
+
children: o.key === "link" ? /* @__PURE__ */ l(i, {
|
|
366
|
+
open: r && !s,
|
|
367
|
+
onClose: () => a(!1),
|
|
368
|
+
label: n.linkDialog,
|
|
369
|
+
trigger: (e) => _(o, c, e),
|
|
370
|
+
children: /* @__PURE__ */ l(U, {
|
|
371
|
+
editor: t,
|
|
372
|
+
labels: n,
|
|
373
|
+
onDone: () => {
|
|
374
|
+
a(!1), setTimeout(() => t.commands.focus(), 0);
|
|
375
|
+
}
|
|
376
|
+
})
|
|
377
|
+
}) : _(o, c)
|
|
378
|
+
}, o.key)), o ? /* @__PURE__ */ l("input", {
|
|
379
|
+
ref: c,
|
|
380
|
+
type: "file",
|
|
381
|
+
accept: k.join(","),
|
|
382
|
+
multiple: !0,
|
|
383
|
+
hidden: !0,
|
|
384
|
+
tabIndex: -1,
|
|
385
|
+
"aria-hidden": "true",
|
|
386
|
+
onChange: (e) => {
|
|
387
|
+
o(Array.from(e.target.files ?? [])), e.target.value = "";
|
|
388
|
+
}
|
|
389
|
+
}) : null]
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
// src/editor/RichTextEditor/ImageBar.tsx
|
|
393
|
+
function Y(e) {
|
|
394
|
+
if (e instanceof E && e.node.type.name === "image") {
|
|
395
|
+
let { attrs: t } = e.node;
|
|
396
|
+
return {
|
|
397
|
+
pos: e.from,
|
|
398
|
+
alt: t.alt ?? "",
|
|
399
|
+
busy: !!t.uploading
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
return null;
|
|
403
|
+
}
|
|
404
|
+
function te({ editor: e, labels: n, disabled: r }) {
|
|
405
|
+
let i = `x-editor-alt-${p()}`, a = y({
|
|
406
|
+
editor: e,
|
|
407
|
+
selector: ({ editor: e }) => e ? Y(e.state.selection) : null
|
|
408
|
+
});
|
|
409
|
+
return a ? /* @__PURE__ */ u("div", {
|
|
410
|
+
className: "x-editor-imagebar",
|
|
411
|
+
children: [/* @__PURE__ */ u("label", {
|
|
412
|
+
className: "ws-field",
|
|
413
|
+
htmlFor: i,
|
|
414
|
+
children: [n.imageAlt, /* @__PURE__ */ l("input", {
|
|
415
|
+
id: i,
|
|
416
|
+
defaultValue: a.alt,
|
|
417
|
+
placeholder: n.imageAltPlaceholder,
|
|
418
|
+
disabled: r,
|
|
419
|
+
onChange: (t) => e.commands.updateAttributes("image", { alt: t.target.value })
|
|
420
|
+
}, a.pos)]
|
|
421
|
+
}), /* @__PURE__ */ l(t, {
|
|
422
|
+
variant: "secondary",
|
|
423
|
+
icon: "trash",
|
|
424
|
+
disabled: r || a.busy,
|
|
425
|
+
onClick: () => e.chain().focus().deleteSelection().run(),
|
|
426
|
+
children: n.imageRemove
|
|
427
|
+
})]
|
|
428
|
+
}) : null;
|
|
429
|
+
}
|
|
430
|
+
// src/editor/RichTextEditor/labels.ts
|
|
431
|
+
var X = {
|
|
432
|
+
toolbar: "Formatting",
|
|
433
|
+
heading2: "Heading 2",
|
|
434
|
+
heading3: "Heading 3",
|
|
435
|
+
bold: "Bold",
|
|
436
|
+
italic: "Italic",
|
|
437
|
+
bulletList: "Bulleted list",
|
|
438
|
+
orderedList: "Numbered list",
|
|
439
|
+
quote: "Quote",
|
|
440
|
+
link: "Link",
|
|
441
|
+
image: "Insert image",
|
|
442
|
+
undo: "Undo",
|
|
443
|
+
redo: "Redo",
|
|
444
|
+
linkDialog: "Edit link",
|
|
445
|
+
linkUrl: "Link address",
|
|
446
|
+
linkInvalid: "Use an address that starts with http:// or https://.",
|
|
447
|
+
linkApply: "Apply",
|
|
448
|
+
linkRemove: "Remove link",
|
|
449
|
+
imageAlt: "Image description",
|
|
450
|
+
imageAltPlaceholder: "What does this image show?",
|
|
451
|
+
imageRemove: "Remove image",
|
|
452
|
+
uploading: "Uploading image",
|
|
453
|
+
imageInvalid: (e) => `Use a JPG, PNG or WebP image up to ${e}.`,
|
|
454
|
+
uploadFailed: "The image could not be uploaded. Try again."
|
|
455
|
+
}, ne = (e, t) => t === "html" ? e.getHTML() : e.getMarkdown();
|
|
456
|
+
function re(e) {
|
|
457
|
+
if (e != null) return typeof e == "number" ? `${e}px` : e;
|
|
458
|
+
}
|
|
459
|
+
function Z({ label: t, "aria-label": r, hideLabel: i = !1, value: a, onChange: o, format: s = "markdown", placeholder: y, disabled: b = !1, invalid: x = !1, "aria-describedby": S, minHeight: C, onUploadImage: w, onUploadingChange: T, onUploadError: E, imageMaxWidth: D = j, imageMaxBytes: O = A, resolveImageSrc: k, labels: P, className: F }) {
|
|
460
|
+
let I = {
|
|
461
|
+
...X,
|
|
462
|
+
...P
|
|
463
|
+
}, L = `x-editor-${p()}`, R = `${L}-error`, [z, B] = g(!1), [H, U] = g(null), W = h(null), G = h(0), K = h(a), q = h({
|
|
464
|
+
onChange: o,
|
|
465
|
+
onUploadingChange: T,
|
|
466
|
+
onUploadError: E,
|
|
467
|
+
onUploadImage: w,
|
|
468
|
+
format: s,
|
|
469
|
+
placeholder: y,
|
|
470
|
+
resolveImageSrc: k,
|
|
471
|
+
l: I,
|
|
472
|
+
imageMaxWidth: D,
|
|
473
|
+
imageMaxBytes: O,
|
|
474
|
+
disabled: b
|
|
475
|
+
});
|
|
476
|
+
q.current = {
|
|
477
|
+
onChange: o,
|
|
478
|
+
onUploadingChange: T,
|
|
479
|
+
onUploadError: E,
|
|
480
|
+
onUploadImage: w,
|
|
481
|
+
format: s,
|
|
482
|
+
placeholder: y,
|
|
483
|
+
resolveImageSrc: k,
|
|
484
|
+
l: I,
|
|
485
|
+
imageMaxWidth: D,
|
|
486
|
+
imageMaxBytes: O,
|
|
487
|
+
disabled: b
|
|
488
|
+
};
|
|
489
|
+
let Y = d((e) => {
|
|
490
|
+
if (e.isDestroyed) return;
|
|
491
|
+
let t = ne(e, q.current.format);
|
|
492
|
+
K.current = t, q.current.onChange(t);
|
|
493
|
+
}, []), Z = d((e, t) => {
|
|
494
|
+
let r = W.current, i = q.current;
|
|
495
|
+
if (!r || !i.onUploadImage || i.disabled) return;
|
|
496
|
+
let a = t;
|
|
497
|
+
for (let t of e) {
|
|
498
|
+
let e = M(t, i.imageMaxBytes);
|
|
499
|
+
if (e) {
|
|
500
|
+
i.onUploadError ? i.onUploadError(Error(e), t) : U(i.l.imageInvalid(n(i.imageMaxBytes)));
|
|
501
|
+
continue;
|
|
502
|
+
}
|
|
503
|
+
U(null);
|
|
504
|
+
let o = i.onUploadImage;
|
|
505
|
+
ee(r, t, a, {
|
|
506
|
+
upload: o,
|
|
507
|
+
maxWidth: i.imageMaxWidth,
|
|
508
|
+
onStart: () => {
|
|
509
|
+
G.current++ === 0 && q.current.onUploadingChange?.(!0);
|
|
510
|
+
},
|
|
511
|
+
onEnd: () => {
|
|
512
|
+
--G.current === 0 && (Y(r), q.current.onUploadingChange?.(!1));
|
|
513
|
+
},
|
|
514
|
+
onError: (e) => {
|
|
515
|
+
q.current.onUploadError ? q.current.onUploadError(e, t) : U(q.current.l.uploadFailed);
|
|
516
|
+
}
|
|
517
|
+
}), a = null;
|
|
518
|
+
}
|
|
519
|
+
}, [Y]), ie = m(() => V({
|
|
520
|
+
placeholder: () => q.current.placeholder ?? "",
|
|
521
|
+
resolveSrc: (e) => q.current.resolveImageSrc?.(e) ?? e,
|
|
522
|
+
uploadingLabel: () => q.current.l.uploading
|
|
523
|
+
}), []), Q = m(() => {
|
|
524
|
+
let e = {
|
|
525
|
+
class: "x-editor-content",
|
|
526
|
+
role: "textbox",
|
|
527
|
+
"aria-multiline": "true"
|
|
528
|
+
};
|
|
529
|
+
t ? e["aria-labelledby"] = L : r && (e["aria-label"] = r);
|
|
530
|
+
let n = [S, H ? R : void 0].filter(Boolean).join(" ");
|
|
531
|
+
return n && (e["aria-describedby"] = n), x && (e["aria-invalid"] = "true"), b && (e["aria-disabled"] = "true"), e;
|
|
532
|
+
}, [
|
|
533
|
+
t,
|
|
534
|
+
r,
|
|
535
|
+
L,
|
|
536
|
+
S,
|
|
537
|
+
H,
|
|
538
|
+
R,
|
|
539
|
+
x,
|
|
540
|
+
b
|
|
541
|
+
]), $ = v({
|
|
542
|
+
extensions: ie,
|
|
543
|
+
content: a,
|
|
544
|
+
contentType: s,
|
|
545
|
+
editable: !b,
|
|
546
|
+
immediatelyRender: !1,
|
|
547
|
+
editorProps: {
|
|
548
|
+
attributes: Q,
|
|
549
|
+
handleKeyDown: (e, t) => (t.metaKey || t.ctrlKey) && !t.shiftKey && !t.altKey && t.key.toLowerCase() === "k" ? (t.preventDefault(), B(!0), !0) : !1,
|
|
550
|
+
handleDrop: (e, t, n, r) => {
|
|
551
|
+
let i = N(t.dataTransfer?.files);
|
|
552
|
+
return r || i.length === 0 || !q.current.onUploadImage ? !1 : (t.preventDefault(), Z(i, e.posAtCoords({
|
|
553
|
+
left: t.clientX,
|
|
554
|
+
top: t.clientY
|
|
555
|
+
})?.pos ?? null), !0);
|
|
556
|
+
},
|
|
557
|
+
handlePaste: (e, t) => {
|
|
558
|
+
let n = N(t.clipboardData?.files);
|
|
559
|
+
return n.length === 0 || !q.current.onUploadImage ? !1 : (t.preventDefault(), Z(n, null), !0);
|
|
560
|
+
}
|
|
561
|
+
},
|
|
562
|
+
onUpdate: ({ editor: e }) => {
|
|
563
|
+
G.current === 0 && Y(e);
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
f(() => (W.current = $, () => {
|
|
567
|
+
W.current = null;
|
|
568
|
+
}), [$]), f(() => {
|
|
569
|
+
$ && !$.isDestroyed && $.setOptions({ editorProps: {
|
|
570
|
+
...$.options.editorProps,
|
|
571
|
+
attributes: Q
|
|
572
|
+
} });
|
|
573
|
+
}, [$, Q]), f(() => {
|
|
574
|
+
$ && !$.isDestroyed && $.isEditable === b && $.setEditable(!b, !1), b && B(!1);
|
|
575
|
+
}, [$, b]), f(() => {
|
|
576
|
+
$ && a !== K.current && (K.current = a, $.commands.setContent(a, {
|
|
577
|
+
contentType: s,
|
|
578
|
+
emitUpdate: !1
|
|
579
|
+
}));
|
|
580
|
+
}, [
|
|
581
|
+
$,
|
|
582
|
+
a,
|
|
583
|
+
s
|
|
584
|
+
]);
|
|
585
|
+
let ae = C == null ? void 0 : { "--editor-min-height": re(C) };
|
|
586
|
+
return /* @__PURE__ */ u("div", {
|
|
587
|
+
className: e("x-editor", F),
|
|
588
|
+
"data-invalid": x ? "" : void 0,
|
|
589
|
+
"data-disabled": b ? "" : void 0,
|
|
590
|
+
style: ae,
|
|
591
|
+
children: [
|
|
592
|
+
t ? /* @__PURE__ */ l("span", {
|
|
593
|
+
id: L,
|
|
594
|
+
className: i ? "x-sr-only" : "x-editor-label",
|
|
595
|
+
children: t
|
|
596
|
+
}) : null,
|
|
597
|
+
/* @__PURE__ */ l("div", {
|
|
598
|
+
className: "x-editor-frame",
|
|
599
|
+
children: $ ? /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ u("div", {
|
|
600
|
+
className: "x-editor-bars",
|
|
601
|
+
children: [/* @__PURE__ */ l(J, {
|
|
602
|
+
editor: $,
|
|
603
|
+
labels: I,
|
|
604
|
+
linkOpen: z,
|
|
605
|
+
onLinkOpenChange: B,
|
|
606
|
+
onPickImages: w ? (e) => Z(e, null) : void 0,
|
|
607
|
+
disabled: b
|
|
608
|
+
}), /* @__PURE__ */ l(te, {
|
|
609
|
+
editor: $,
|
|
610
|
+
labels: I,
|
|
611
|
+
disabled: b
|
|
612
|
+
})]
|
|
613
|
+
}), /* @__PURE__ */ l(_, { editor: $ })] }) : /* @__PURE__ */ l("div", {
|
|
614
|
+
className: "x-editor-content",
|
|
615
|
+
"aria-busy": "true"
|
|
616
|
+
})
|
|
617
|
+
}),
|
|
618
|
+
H ? /* @__PURE__ */ l("small", {
|
|
619
|
+
id: R,
|
|
620
|
+
className: "x-editor-error",
|
|
621
|
+
role: "alert",
|
|
622
|
+
children: H
|
|
623
|
+
}) : null
|
|
624
|
+
]
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
export { X as RICH_TEXT_EDITOR_LABELS, Z as RichTextEditor, M as checkImageFile, V as editorExtensions, I as isSafeUrl };
|
|
628
|
+
|
|
629
|
+
//# sourceMappingURL=editor.js.map
|