@comfyorg/design-system 1.2.0 → 1.3.0-alpha.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/README.md +33 -3
- package/dist/accordion/PropertiesAccordionItem.vue.d.ts +34 -0
- package/dist/accordion/PropertiesAccordionItem.vue.js +62 -0
- package/dist/badge/Badge.vue.js +1 -2
- package/dist/badge/CreditBadge.vue.d.ts +0 -1
- package/dist/badge/CreditBadge.vue.js +10 -24
- package/dist/badge/badge.variants.d.ts +1 -1
- package/dist/button/Button.vue.js +1 -2
- package/dist/button-group/ButtonGroup.vue.js +2 -4
- package/dist/button-group/IconGroup.vue.js +2 -4
- package/dist/card/Card.vue.js +1 -2
- package/dist/card/CardFooter.vue.js +1 -2
- package/dist/card/CardHeader.vue.js +1 -2
- package/dist/card/CoachmarkCard.vue.js +2 -4
- package/dist/chart/Chart.vue.js +4 -7
- package/dist/chart/__tests__/chartTestUtils.d.ts +3 -0
- package/dist/checkbox/Checkbox.vue.js +2 -4
- package/dist/chip/Tag.vue.d.ts +61 -0
- package/dist/chip/Tag.vue.js +71 -0
- package/dist/chip/TagRemoveButton.vue.js +1 -2
- package/dist/color-picker/ColorPicker.vue.d.ts +23 -0
- package/dist/color-picker/ColorPicker.vue.js +139 -0
- package/dist/color-picker/ColorPickerPanel.vue.d.ts +27 -0
- package/dist/color-picker/ColorPickerPanel.vue.js +1 -0
- package/dist/color-picker/ColorPickerSaturationValue.vue.d.ts +17 -0
- package/dist/color-picker/ColorPickerSaturationValue.vue.js +1 -0
- package/dist/color-picker/ColorPickerSlider.vue.d.ts +17 -0
- package/dist/color-picker/ColorPickerSlider.vue.js +1 -0
- package/dist/color-picker/types.d.ts +22 -0
- package/dist/color-picker/types.js +0 -0
- package/dist/color-picker/useColorPicker.d.ts +33 -0
- package/dist/common/CanvasBanner.vue.js +3 -5
- package/dist/common/ContentDivider.vue.js +2 -4
- package/dist/common/CustomFormValue.vue.js +1 -3
- package/dist/common/DotSpinner.vue.js +3 -5
- package/dist/common/EditableText.vue.js +3 -5
- package/dist/common/HighlightedText.vue.d.ts +8 -0
- package/dist/common/HighlightedText.vue.js +50 -0
- package/dist/common/LoadingOverlay.vue.js +3 -5
- package/dist/common/MarkdownText.vue.js +2 -4
- package/dist/common/MarqueeLine.vue.js +2 -3
- package/dist/common/NoResultsPlaceholder.vue.d.ts +28 -0
- package/dist/common/NoResultsPlaceholder.vue.js +49 -0
- package/dist/common/NotificationPopup.vue.d.ts +28 -0
- package/dist/common/NotificationPopup.vue.js +63 -0
- package/dist/common/OverlayIcon.vue.js +1 -2
- package/dist/common/SanitizedHtml.vue.js +2 -4
- package/dist/common/TextDivider.vue.js +3 -5
- package/dist/common/TextTicker.vue.js +2 -4
- package/dist/common/TextTickerMultiLine.vue.js +3 -6
- package/dist/common/UserAvatar.vue.d.ts +9 -0
- package/dist/common/UserAvatar.vue.js +45 -0
- package/dist/common/VerticalDivider.vue.js +2 -3
- package/dist/common/VideoCompareSlider.vue.js +3 -5
- package/dist/common/ViewportWidgetShell.vue.js +3 -5
- package/dist/common/VirtualGrid.vue.js +1 -3
- package/dist/common/highlightQuery.d.ts +6 -0
- package/dist/composables/useAttrsClass.js +1 -2
- package/dist/composables/usePopoverSizing.js +1 -2
- package/dist/confirm/ConfirmBody.vue.js +3 -5
- package/dist/confirm/ConfirmFooter.vue.d.ts +18 -0
- package/dist/confirm/ConfirmFooter.vue.js +53 -0
- package/dist/confirm/ConfirmHeader.vue.js +2 -4
- package/dist/content-card/CardBottom.vue.js +2 -4
- package/dist/content-card/CardContainer.vue.js +3 -5
- package/dist/content-card/CardTop.vue.js +2 -4
- package/dist/dialog/Dialog.vue.js +1 -3
- package/dist/dialog/DialogClose.vue.js +1 -24
- package/dist/dialog/DialogContent.vue.js +1 -73
- package/dist/dialog/DialogDescription.vue.js +2 -4
- package/dist/dialog/DialogFooter.vue.js +2 -4
- package/dist/dialog/DialogHeader.vue.js +2 -4
- package/dist/dialog/DialogMaximize.vue.js +2 -4
- package/dist/dialog/DialogOverlay.vue.js +1 -35
- package/dist/dialog/DialogPanel.vue.js +7 -9
- package/dist/dialog/DialogPortal.vue.js +1 -38
- package/dist/dialog/DialogTitle.vue.js +1 -2
- package/dist/dialog/Dialogue.vue.d.ts +22 -0
- package/dist/dialog/Dialogue.vue.js +56 -0
- package/dist/dialog/dialog.variants.js +4 -5
- package/dist/field/Field.vue.js +4 -7
- package/dist/field/FieldDescription.vue.js +2 -4
- package/dist/field/FieldError.vue.js +3 -5
- package/dist/field/FieldGroup.vue.js +2 -4
- package/dist/field/FieldLabel.vue.js +3 -5
- package/dist/field/FieldSwitch.vue.d.ts +16 -0
- package/dist/field/FieldSwitch.vue.js +43 -0
- package/dist/field/LayoutField.vue.d.ts +18 -0
- package/dist/field/LayoutField.vue.js +1 -0
- package/dist/field/ModelInfoField.vue.js +2 -4
- package/dist/hover-card/HoverCard.vue.js +1 -3
- package/dist/hover-card/HoverCardContent.vue.js +2 -4
- package/dist/hover-card/HoverCardTrigger.vue.js +1 -3
- package/dist/icon/ComfyLogo.vue.js +2 -4
- package/dist/icon/PuzzleIcon.vue.js +2 -4
- package/dist/icon/TinyChevronIcon.vue.js +1 -3
- package/dist/icon/VerifiedIcon.vue.js +2 -4
- package/dist/input/Input.vue.js +1 -2
- package/dist/input/PasswordInput.vue.js +5 -7
- package/dist/input-group/InputGroup.vue.js +1 -2
- package/dist/input-group/InputGroupAddon.vue.js +1 -2
- package/dist/input-group/InputGroupButton.vue.js +1 -2
- package/dist/input-group/InputGroupInput.vue.js +1 -2
- package/dist/input-group/inputGroup.variants.js +1 -2
- package/dist/knob/Knob.vue.js +3 -5
- package/dist/label/Label.vue.js +1 -2
- package/dist/layout/BaseModalLayout.vue.d.ts +67 -0
- package/dist/layout/BaseModalLayout.vue.js +198 -0
- package/dist/media/AudioPreview.vue.js +2 -4
- package/dist/media/ImageLightbox.vue.d.ts +17 -0
- package/dist/media/ImageLightbox.vue.js +76 -0
- package/dist/media/MediaTitle.vue.js +2 -4
- package/dist/media/Video.vue.d.ts +28 -0
- package/dist/media/Video.vue.js +100 -0
- package/dist/media/VideoPlayOverlay.vue.js +3 -5
- package/dist/media/VideoPreview.vue.js +2 -4
- package/dist/media/ZoomPane.vue.js +1 -3
- package/dist/menu/ContextMenu.vue.js +3 -5
- package/dist/menu/ContextMenuContent.vue.js +1 -2
- package/dist/menu/Menu.vue.js +3 -5
- package/dist/menu/MenuAction.vue.js +1 -2
- package/dist/menu/MenuContent.vue.js +1 -2
- package/dist/menu/MenuItem.vue.js +2 -4
- package/dist/menu/MenuItemContent.vue.js +1 -2
- package/dist/menu/MenuItems.vue.js +1 -2
- package/dist/menu/MenuRadioGroup.vue.js +1 -2
- package/dist/menu/MenuRadioItem.vue.js +1 -2
- package/dist/menu/MenuSeparator.vue.js +1 -2
- package/dist/menu/MenuSub.vue.js +1 -2
- package/dist/menu/MenuSubContent.vue.js +1 -2
- package/dist/menu/MenuSubTrigger.vue.js +1 -2
- package/dist/menu/MenuSubmenu.vue.js +1 -2
- package/dist/menu/menuAnchor.js +1 -2
- package/dist/menu/menuStyles.js +1 -2
- package/dist/menu/usePointMenu.js +1 -2
- package/dist/message/Message.vue.js +4 -6
- package/dist/message/message.variants.js +1 -2
- package/dist/multi-select/MultiSelect.vue.js +3 -5
- package/dist/multi-select/MultiSelectContent.vue.js +1 -2
- package/dist/multi-select/MultiSelectTrigger.vue.js +1 -2
- package/dist/navigation/LeftSidePanel.vue.d.ts +12 -0
- package/dist/navigation/LeftSidePanel.vue.js +82 -0
- package/dist/navigation/NavIcon.vue.d.ts +7 -0
- package/dist/navigation/NavIcon.vue.js +1 -0
- package/dist/navigation/NavItem.vue.d.ts +21 -0
- package/dist/navigation/NavItem.vue.js +1 -0
- package/dist/navigation/NavTitle.vue.js +1 -42
- package/dist/navigation/SidebarTopArea.vue.js +2 -3
- package/dist/navigation/types.d.ts +13 -0
- package/dist/navigation/types.js +0 -0
- package/dist/number-field/NumberField.vue.js +2 -4
- package/dist/number-field/NumberFieldDecrement.vue.js +2 -4
- package/dist/number-field/NumberFieldIncrement.vue.js +2 -4
- package/dist/number-field/NumberFieldInput.vue.js +2 -4
- package/dist/number-field/PropertyNumberField.vue.js +3 -5
- package/dist/pagination/Pagination.vue.js +8 -10
- package/dist/popover/PopoverContent.vue.js +1 -91
- package/dist/popover/usePopoverViewportDismiss.js +1 -2
- package/dist/radio-group/RadioGroup.vue.js +2 -4
- package/dist/radio-group/RadioGroupItem.vue.js +2 -4
- package/dist/search-input/AsyncSearchInput.vue.js +3 -5
- package/dist/search-input/SearchAutocomplete.vue.js +4 -6
- package/dist/search-input/SearchInput.vue.js +4 -6
- package/dist/select/DropdownControl.vue.js +2 -4
- package/dist/select/Select.vue.js +1 -2
- package/dist/select/SelectContent.vue.js +1 -2
- package/dist/select/SelectItem.vue.d.ts +4 -0
- package/dist/select/SelectItem.vue.js +1 -2
- package/dist/select/SelectScrollDownButton.vue.js +1 -2
- package/dist/select/SelectScrollUpButton.vue.js +1 -2
- package/dist/select/SelectTrigger.vue.js +1 -2
- package/dist/select/SelectValue.vue.js +1 -2
- package/dist/select/useSelectSearch.js +1 -2
- package/dist/shared/{Badge-D3uWa3yk.js → Badge-DFHO3AFi.js} +4 -6
- package/dist/shared/{Button-CilmsOkY.js → Button-Dj_H5v3V.js} +5 -8
- package/dist/shared/{Card-l7baUdn0.js → Card-BrvqUM49.js} +3 -5
- package/dist/shared/{CardFooter-BM6EmVi7.js → CardFooter-BV_I0pM-.js} +2 -4
- package/dist/shared/{CardHeader-B5To28Jp.js → CardHeader-CMutruBx.js} +2 -4
- package/dist/shared/ColorPickerPanel-DQGHuvxk.js +239 -0
- package/dist/shared/ColorPickerSaturationValue-B5VDiMcl.js +64 -0
- package/dist/shared/ColorPickerSlider--mnQyzWD.js +305 -0
- package/dist/shared/{ContextMenuContent-CNQHJQ81.js → ContextMenuContent-RNyBBJOX.js} +2 -4
- package/dist/shared/DialogClose-CrtPRSNX.js +22 -0
- package/dist/shared/DialogContent-v2s55FXs.js +71 -0
- package/dist/shared/DialogOverlay-C9qv0zme.js +33 -0
- package/dist/shared/DialogPortal-DtCpLgtO.js +36 -0
- package/dist/shared/{DialogTitle-CfkkTGuU.js → DialogTitle-Chomvpgq.js} +2 -4
- package/dist/shared/{Input-39RLwDr2.js → Input-DOeNoniw.js} +2 -4
- package/dist/shared/{InputGroup-kjQKkhyB.js → InputGroup-BYt6BWpk.js} +2 -4
- package/dist/shared/{InputGroupAddon-DLDRT0CQ.js → InputGroupAddon-B1cn7czs.js} +3 -5
- package/dist/shared/{InputGroupButton-BoEp2apg.js → InputGroupButton-tw5AYOoR.js} +3 -5
- package/dist/shared/{InputGroupInput-E2MlEVUU.js → InputGroupInput-C_kkIxvY.js} +3 -5
- package/dist/shared/{Label-Cx_lFofI.js → Label-kwhWNR2P.js} +2 -4
- package/dist/shared/LayoutField-C8KCaVF0.js +34 -0
- package/dist/shared/{MenuAction-BdghJ23k.js → MenuAction-0z8BSoX9.js} +5 -8
- package/dist/shared/{MenuContent-ChqlM3xA.js → MenuContent--tKCqaIO.js} +2 -4
- package/dist/shared/{MenuItemContent--dPNoBmU.js → MenuItemContent-Be658c7e.js} +6 -8
- package/dist/shared/{MenuItems-BJKetPV-.js → MenuItems-BZTlERd6.js} +5 -7
- package/dist/shared/{MenuRadioGroup-Bpjt9sHI.js → MenuRadioGroup-B28YS1p1.js} +4 -6
- package/dist/shared/{MenuRadioItem-h7hh_RGU.js → MenuRadioItem-D8DFu-KU.js} +2 -4
- package/dist/shared/{MenuSeparator-Dm6CkPqB.js → MenuSeparator-DrAiObmE.js} +2 -4
- package/dist/shared/{MenuSub-Dbnj2w-X.js → MenuSub-DSizq_fV.js} +1 -3
- package/dist/shared/{MenuSubContent-M-g3fllh.js → MenuSubContent-ghzkX4hX.js} +2 -4
- package/dist/shared/{MenuSubTrigger-D6-3s2NL.js → MenuSubTrigger-BGRIm_Bf.js} +2 -4
- package/dist/shared/{MenuSubmenu-QHWMyfKF.js → MenuSubmenu-CjPf8DXl.js} +5 -7
- package/dist/shared/{MultiSelectContent-c1D5avjh.js → MultiSelectContent-9xyBQKz3.js} +5 -7
- package/dist/shared/{MultiSelectTrigger-lmuXqETa.js → MultiSelectTrigger-DNySkpH9.js} +4 -6
- package/dist/shared/NavIcon-FTJH75HH.js +12 -0
- package/dist/shared/NavItem-sQJ-77Zw.js +77 -0
- package/dist/shared/NavTitle-BM22yfCR.js +40 -0
- package/dist/shared/{OverlayIcon-DntJI-mm.js → OverlayIcon-C-din824.js} +3 -5
- package/dist/shared/PopoverContent-DNqL6t-O.js +89 -0
- package/dist/shared/{SearchableSingleSelect-Dnti1kqJ.js → SearchableSingleSelect-DQauLQWW.js} +4 -6
- package/dist/shared/{Select-CP3OZjtL.js → Select-DtVgv7Po.js} +1 -3
- package/dist/shared/{SelectContent-C8aNlcFf.js → SelectContent-Ba1mCDWM.js} +4 -6
- package/dist/shared/{SelectItem-tU4CIa5J.js → SelectItem-DaOr3TFS.js} +23 -10
- package/dist/shared/{SelectScrollDownButton-Dvig5MVc.js → SelectScrollDownButton-DYmxtida.js} +2 -4
- package/dist/shared/{SelectScrollUpButton-lv-npT6v.js → SelectScrollUpButton-DiyvSb9O.js} +2 -4
- package/dist/shared/{SelectTrigger-CCDiZW91.js → SelectTrigger-BBicbVsI.js} +2 -4
- package/dist/shared/{SelectValue-DFZFSiQp.js → SelectValue-BjaQc-WU.js} +1 -3
- package/dist/shared/{Switch-DsCzHpDU.js → Switch-qavkHWMz.js} +3 -5
- package/dist/shared/{TableHead-OxGist4m.js → TableHead-DpsXVMzk.js} +2 -4
- package/dist/shared/{TagRemoveButton-BiCdscIC.js → TagRemoveButton-D919R-To.js} +4 -6
- package/dist/shared/{TextTooltip-ClHQl84h.js → TextTooltip-BNlZI515.js} +4 -6
- package/dist/shared/{Tooltip-DbXyHv20.js → Tooltip-4rCebVao.js} +2 -4
- package/dist/shared/{TooltipContent-Bju-U7gc.js → TooltipContent-0GR7hBNu.js} +3 -5
- package/dist/shared/{TooltipTrigger-CVwISmWo.js → TooltipTrigger-64EIE5f2.js} +2 -4
- package/dist/shared/TransitionCollapse-VfBzyj5a.js +108 -0
- package/dist/shared/{_plugin-vue_export-helper-BOaGB7Aw.js → _plugin-vue_export-helper-DjkACiAr.js} +1 -2
- package/dist/shared/{searchInput.variants-NOge_52E.js → searchInput.variants-BdYHNjce.js} +1 -2
- package/dist/shared/{select.variants-BPn5Z7N1.js → select.variants-cRXaATWS.js} +1 -2
- package/dist/shared/{src-CnJ6AzLP.js → src-DTwuqov4.js} +1 -2
- package/dist/shared/{tabKeys-BISOrxWu.js → tabKeys-CP6c3wTY.js} +1 -2
- package/dist/shared/{tabs.variants-XUREdHry.js → tabs.variants-Cgk7bRhG.js} +1 -2
- package/dist/shared/{tag.variants-CCqCn8Jc.js → tag.variants-BEXRRbPc.js} +1 -2
- package/dist/shared/{tagsInputContext-QXu7RrG5.js → tagsInputContext-C-X1-iNf.js} +1 -2
- package/dist/shared/{toggleGroup.variants-CvjZDHMw.js → toggleGroup.variants-BuwGELw0.js} +1 -2
- package/dist/shared/{tooltipContext-BL5JtM0i.js → tooltipContext-arEyjGQC.js} +1 -2
- package/dist/single-select/SearchableSingleSelect.vue.js +1 -2
- package/dist/single-select/SingleSelect.vue.js +5 -7
- package/dist/skeleton/Skeleton.vue.js +2 -4
- package/dist/slider/GradientSlider.vue.d.ts +20 -0
- package/dist/slider/GradientSlider.vue.js +100 -0
- package/dist/slider/Slider.vue.js +2 -4
- package/dist/slider/gradients.d.ts +6 -0
- package/dist/spinner/Spinner.vue.js +2 -4
- package/dist/splitter/SplitterGroup.vue.js +2 -4
- package/dist/splitter/SplitterPanel.vue.js +2 -4
- package/dist/splitter/SplitterResizeHandle.vue.js +3 -5
- package/dist/switch/Switch.vue.js +1 -2
- package/dist/tab/Tab.vue.js +5 -8
- package/dist/tab/TabList.vue.js +3 -5
- package/dist/tab/TabPanel.vue.js +3 -5
- package/dist/table/Table.vue.js +3 -5
- package/dist/table/TableBody.vue.js +2 -4
- package/dist/table/TableCell.vue.js +2 -4
- package/dist/table/TableHead.vue.js +1 -2
- package/dist/table/TableHeader.vue.js +2 -4
- package/dist/table/TableRow.vue.js +2 -4
- package/dist/table/TableSortHead.vue.js +3 -5
- package/dist/table/tableUtils.js +1 -2
- package/dist/tabs/Tabs.vue.js +2 -4
- package/dist/tabs/TabsContent.vue.js +2 -4
- package/dist/tabs/TabsList.vue.js +3 -5
- package/dist/tabs/TabsTrigger.vue.js +3 -5
- package/dist/tags-input/TagsInput.vue.js +4 -6
- package/dist/tags-input/TagsInputInput.vue.js +3 -5
- package/dist/tags-input/TagsInputItem.vue.js +3 -5
- package/dist/tags-input/TagsInputItemDelete.vue.js +2 -4
- package/dist/tags-input/TagsInputItemText.vue.js +2 -4
- package/dist/textarea/Textarea.vue.js +2 -4
- package/dist/toast/ToastClose.vue.js +3 -5
- package/dist/toast/ToastDescription.vue.js +2 -4
- package/dist/toast/ToastDock.vue.js +2 -4
- package/dist/toast/ToastPanel.vue.js +3 -5
- package/dist/toast/ToastRoot.vue.js +3 -5
- package/dist/toast/ToastTitle.vue.js +2 -4
- package/dist/toast/ToastViewport.vue.js +2 -4
- package/dist/toggle-group/ToggleGroup.vue.js +3 -5
- package/dist/toggle-group/ToggleGroupItem.vue.js +3 -5
- package/dist/tooltip/TextTooltip.vue.js +1 -2
- package/dist/tooltip/Tooltip.vue.js +1 -2
- package/dist/tooltip/TooltipContent.vue.js +1 -2
- package/dist/tooltip/TooltipProvider.vue.js +1 -3
- package/dist/tooltip/TooltipTrigger.vue.js +1 -2
- package/dist/tooltip/tooltipConfig.js +1 -2
- package/dist/transition/TransitionCollapse.vue.js +1 -110
- package/dist/tree/Tree.vue.d.ts +1 -1
- package/dist/tree/Tree.vue.js +2 -4
- package/dist/tree/TreeItem.vue.js +4 -6
- package/dist/tree/treeStyles.js +1 -2
- package/package.json +40 -20
- package/src/css/_baseline.css +143 -0
- package/src/css/_mask-editor.css +0 -1
- package/src/css/baseline.css +3 -0
- package/src/css/iconSizing.test.ts +1 -1
- package/src/css/published.css +3 -0
- package/src/css/style.css +2 -316
- package/src/css/theme.css +175 -0
- package/src/icons/README.md +41 -84
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { t as Select_default } from "./Select-DtVgv7Po.js";
|
|
2
|
+
import { t as SelectContent_default } from "./SelectContent-Ba1mCDWM.js";
|
|
3
|
+
import { t as SelectItem_default } from "./SelectItem-DaOr3TFS.js";
|
|
4
|
+
import { t as SelectTrigger_default } from "./SelectTrigger-BBicbVsI.js";
|
|
5
|
+
import { t as SelectValue_default } from "./SelectValue-BjaQc-WU.js";
|
|
6
|
+
import { t as ColorPickerSaturationValue_default } from "./ColorPickerSaturationValue-B5VDiMcl.js";
|
|
7
|
+
import { a as normalizeHex, n as hexToHsva, o as rgbToHex, r as hsbToRgb, s as rgbToHsv, t as ColorPickerSlider_default } from "./ColorPickerSlider--mnQyzWD.js";
|
|
8
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, openBlock, reactive, ref, renderList, toDisplayString, unref, useModel, vModelText, watch, withCtx, withDirectives, withKeys } from "vue";
|
|
9
|
+
import { clamp } from "es-toolkit";
|
|
10
|
+
// src/components/color-picker/useColorPicker.ts
|
|
11
|
+
var rgbChannels = [
|
|
12
|
+
{ key: "r" },
|
|
13
|
+
{ key: "g" },
|
|
14
|
+
{ key: "b" }
|
|
15
|
+
];
|
|
16
|
+
function useDraftField(source, apply) {
|
|
17
|
+
const draft = ref(source());
|
|
18
|
+
const isEditing = ref(false);
|
|
19
|
+
watch(source, (value) => {
|
|
20
|
+
if (!isEditing.value) draft.value = value;
|
|
21
|
+
});
|
|
22
|
+
return reactive({
|
|
23
|
+
draft,
|
|
24
|
+
beginEdit: () => {
|
|
25
|
+
isEditing.value = true;
|
|
26
|
+
},
|
|
27
|
+
commit: () => apply(draft.value),
|
|
28
|
+
reset: () => {
|
|
29
|
+
isEditing.value = false;
|
|
30
|
+
draft.value = source();
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function useColorPicker(hsva) {
|
|
35
|
+
const rgb = computed(() => hsbToRgb({
|
|
36
|
+
h: hsva.value.h,
|
|
37
|
+
s: hsva.value.s,
|
|
38
|
+
b: hsva.value.v
|
|
39
|
+
}));
|
|
40
|
+
const hexString = computed(() => rgbToHex(rgb.value).toLowerCase());
|
|
41
|
+
return {
|
|
42
|
+
hex: useDraftField(() => hexString.value, (draft) => {
|
|
43
|
+
const normalized = normalizeHex(draft);
|
|
44
|
+
if (!normalized) return;
|
|
45
|
+
const next = hexToHsva(normalized);
|
|
46
|
+
hsva.value = {
|
|
47
|
+
...hsva.value,
|
|
48
|
+
h: next.h,
|
|
49
|
+
s: next.s,
|
|
50
|
+
v: next.v
|
|
51
|
+
};
|
|
52
|
+
}),
|
|
53
|
+
rgb: useDraftField(() => ({ ...rgb.value }), ({ r, g, b }) => {
|
|
54
|
+
if (![
|
|
55
|
+
r,
|
|
56
|
+
g,
|
|
57
|
+
b
|
|
58
|
+
].every(Number.isFinite)) return;
|
|
59
|
+
const hsv = rgbToHsv({
|
|
60
|
+
r: clamp(Math.round(r), 0, 255),
|
|
61
|
+
g: clamp(Math.round(g), 0, 255),
|
|
62
|
+
b: clamp(Math.round(b), 0, 255)
|
|
63
|
+
});
|
|
64
|
+
hsva.value = {
|
|
65
|
+
...hsva.value,
|
|
66
|
+
h: hsv.h,
|
|
67
|
+
s: hsv.s,
|
|
68
|
+
v: hsv.v
|
|
69
|
+
};
|
|
70
|
+
}),
|
|
71
|
+
alpha: useDraftField(() => hsva.value.a, (draft) => {
|
|
72
|
+
if (!Number.isFinite(draft)) return;
|
|
73
|
+
hsva.value = {
|
|
74
|
+
...hsva.value,
|
|
75
|
+
a: clamp(Math.round(draft), 0, 100)
|
|
76
|
+
};
|
|
77
|
+
})
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
// src/components/color-picker/ColorPickerPanel.vue?vue&type=script&setup=true&lang.ts
|
|
81
|
+
var _hoisted_1 = { class: "flex w-[211px] flex-col gap-2 rounded-lg border border-border/50 bg-background p-2 shadow-md" };
|
|
82
|
+
var _hoisted_2 = { class: "flex items-center gap-1" };
|
|
83
|
+
var _hoisted_3 = { class: "flex h-6 min-w-0 flex-1 items-center gap-1 rounded-sm bg-secondary px-1 text-xs text-muted-foreground" };
|
|
84
|
+
var _hoisted_4 = ["aria-label"];
|
|
85
|
+
var _hoisted_5 = ["onUpdate:modelValue", "aria-label"];
|
|
86
|
+
var _hoisted_6 = {
|
|
87
|
+
key: 2,
|
|
88
|
+
class: "flex shrink-0 items-center border-l border-border/50 pl-1"
|
|
89
|
+
};
|
|
90
|
+
var _hoisted_7 = ["aria-label"];
|
|
91
|
+
// src/components/color-picker/ColorPickerPanel.vue
|
|
92
|
+
var ColorPickerPanel_default = /* @__PURE__ */ defineComponent({
|
|
93
|
+
__name: "ColorPickerPanel",
|
|
94
|
+
props: /*@__PURE__*/ mergeModels({
|
|
95
|
+
alpha: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
default: true
|
|
98
|
+
},
|
|
99
|
+
hexLabel: {},
|
|
100
|
+
rgbaLabel: {},
|
|
101
|
+
hueLabel: {},
|
|
102
|
+
alphaLabel: {},
|
|
103
|
+
redLabel: {},
|
|
104
|
+
greenLabel: {},
|
|
105
|
+
blueLabel: {},
|
|
106
|
+
saturationBrightnessLabel: {},
|
|
107
|
+
formatLabel: {}
|
|
108
|
+
}, {
|
|
109
|
+
"hsva": { required: true },
|
|
110
|
+
"hsvaModifiers": {},
|
|
111
|
+
"displayMode": { required: true },
|
|
112
|
+
"displayModeModifiers": {}
|
|
113
|
+
}),
|
|
114
|
+
emits: ["update:hsva", "update:displayMode"],
|
|
115
|
+
setup(__props) {
|
|
116
|
+
const hsva = useModel(__props, "hsva");
|
|
117
|
+
const displayMode = useModel(__props, "displayMode");
|
|
118
|
+
const channelLabels = computed(() => ({
|
|
119
|
+
r: __props.redLabel,
|
|
120
|
+
g: __props.greenLabel,
|
|
121
|
+
b: __props.blueLabel
|
|
122
|
+
}));
|
|
123
|
+
const { hex, rgb, alpha: alphaField } = useColorPicker(hsva);
|
|
124
|
+
return (_ctx, _cache) => {
|
|
125
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
126
|
+
createVNode(ColorPickerSaturationValue_default, {
|
|
127
|
+
saturation: hsva.value.s,
|
|
128
|
+
"onUpdate:saturation": _cache[0] || (_cache[0] = ($event) => hsva.value.s = $event),
|
|
129
|
+
value: hsva.value.v,
|
|
130
|
+
"onUpdate:value": _cache[1] || (_cache[1] = ($event) => hsva.value.v = $event),
|
|
131
|
+
hue: hsva.value.h,
|
|
132
|
+
"aria-label": __props.saturationBrightnessLabel
|
|
133
|
+
}, null, 8, [
|
|
134
|
+
"saturation",
|
|
135
|
+
"value",
|
|
136
|
+
"hue",
|
|
137
|
+
"aria-label"
|
|
138
|
+
]),
|
|
139
|
+
createVNode(ColorPickerSlider_default, {
|
|
140
|
+
modelValue: hsva.value.h,
|
|
141
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => hsva.value.h = $event),
|
|
142
|
+
type: "hue",
|
|
143
|
+
"aria-label": __props.hueLabel
|
|
144
|
+
}, null, 8, ["modelValue", "aria-label"]),
|
|
145
|
+
__props.alpha ? (openBlock(), createBlock(ColorPickerSlider_default, {
|
|
146
|
+
key: 0,
|
|
147
|
+
modelValue: hsva.value.a,
|
|
148
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => hsva.value.a = $event),
|
|
149
|
+
type: "alpha",
|
|
150
|
+
hue: hsva.value.h,
|
|
151
|
+
saturation: hsva.value.s,
|
|
152
|
+
brightness: hsva.value.v,
|
|
153
|
+
"aria-label": __props.alphaLabel
|
|
154
|
+
}, null, 8, [
|
|
155
|
+
"modelValue",
|
|
156
|
+
"hue",
|
|
157
|
+
"saturation",
|
|
158
|
+
"brightness",
|
|
159
|
+
"aria-label"
|
|
160
|
+
])) : createCommentVNode("", true),
|
|
161
|
+
createElementVNode("div", _hoisted_2, [createVNode(unref(Select_default), {
|
|
162
|
+
modelValue: displayMode.value,
|
|
163
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => displayMode.value = $event)
|
|
164
|
+
}, {
|
|
165
|
+
default: withCtx(() => [createVNode(unref(SelectTrigger_default), {
|
|
166
|
+
"aria-label": __props.formatLabel,
|
|
167
|
+
class: "h-6 w-[58px] shrink-0 gap-0.5 overflow-clip rounded-sm border-0 px-1.5 py-0 text-xs [&>span]:overflow-visible"
|
|
168
|
+
}, {
|
|
169
|
+
default: withCtx(() => [createVNode(unref(SelectValue_default))]),
|
|
170
|
+
_: 1
|
|
171
|
+
}, 8, ["aria-label"]), createVNode(unref(SelectContent_default), { class: "min-w-16 p-1" }, {
|
|
172
|
+
default: withCtx(() => [createVNode(unref(SelectItem_default), {
|
|
173
|
+
value: "hex",
|
|
174
|
+
class: "py-1 text-xs"
|
|
175
|
+
}, {
|
|
176
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.hexLabel), 1)]),
|
|
177
|
+
_: 1
|
|
178
|
+
}), createVNode(unref(SelectItem_default), {
|
|
179
|
+
value: "rgba",
|
|
180
|
+
class: "py-1 text-xs"
|
|
181
|
+
}, {
|
|
182
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.rgbaLabel), 1)]),
|
|
183
|
+
_: 1
|
|
184
|
+
})]),
|
|
185
|
+
_: 1
|
|
186
|
+
})]),
|
|
187
|
+
_: 1
|
|
188
|
+
}, 8, ["modelValue"]), createElementVNode("div", _hoisted_3, [displayMode.value === "hex" ? withDirectives((openBlock(), createElementBlock("input", {
|
|
189
|
+
key: 0,
|
|
190
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => unref(hex).draft = $event),
|
|
191
|
+
type: "text",
|
|
192
|
+
spellcheck: "false",
|
|
193
|
+
"aria-label": __props.hexLabel,
|
|
194
|
+
class: "min-w-0 flex-1 appearance-none border-none bg-transparent p-0 text-center outline-none",
|
|
195
|
+
onFocus: _cache[6] || (_cache[6] = (...args) => unref(hex).beginEdit && unref(hex).beginEdit(...args)),
|
|
196
|
+
onInput: _cache[7] || (_cache[7] = (...args) => unref(hex).commit && unref(hex).commit(...args)),
|
|
197
|
+
onKeydown: _cache[8] || (_cache[8] = withKeys((...args) => unref(hex).commit && unref(hex).commit(...args), ["enter"])),
|
|
198
|
+
onBlur: _cache[9] || (_cache[9] = (...args) => unref(hex).reset && unref(hex).reset(...args))
|
|
199
|
+
}, null, 40, _hoisted_4)), [[vModelText, unref(hex).draft]]) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(rgbChannels), (channel) => {
|
|
200
|
+
return withDirectives((openBlock(), createElementBlock("input", {
|
|
201
|
+
key: channel.key,
|
|
202
|
+
"onUpdate:modelValue": ($event) => unref(rgb).draft[channel.key] = $event,
|
|
203
|
+
type: "number",
|
|
204
|
+
min: 0,
|
|
205
|
+
max: 255,
|
|
206
|
+
"aria-label": channelLabels.value[channel.key],
|
|
207
|
+
class: "min-w-0 flex-1 appearance-none border-none bg-transparent p-0 text-center outline-none [&::-webkit-inner-spin-button]:appearance-none",
|
|
208
|
+
onFocus: _cache[10] || (_cache[10] = (...args) => unref(rgb).beginEdit && unref(rgb).beginEdit(...args)),
|
|
209
|
+
onInput: _cache[11] || (_cache[11] = (...args) => unref(rgb).commit && unref(rgb).commit(...args)),
|
|
210
|
+
onKeydown: _cache[12] || (_cache[12] = withKeys((...args) => unref(rgb).commit && unref(rgb).commit(...args), ["enter"])),
|
|
211
|
+
onBlur: _cache[13] || (_cache[13] = (...args) => unref(rgb).reset && unref(rgb).reset(...args))
|
|
212
|
+
}, null, 40, _hoisted_5)), [[
|
|
213
|
+
vModelText,
|
|
214
|
+
unref(rgb).draft[channel.key],
|
|
215
|
+
void 0,
|
|
216
|
+
{ number: true }
|
|
217
|
+
]]);
|
|
218
|
+
}), 128)), __props.alpha ? (openBlock(), createElementBlock("div", _hoisted_6, [withDirectives(createElementVNode("input", {
|
|
219
|
+
"onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => unref(alphaField).draft = $event),
|
|
220
|
+
type: "number",
|
|
221
|
+
min: 0,
|
|
222
|
+
max: 100,
|
|
223
|
+
"aria-label": __props.alphaLabel,
|
|
224
|
+
class: "w-6 min-w-0 appearance-none border-none bg-transparent p-0 text-right outline-none [&::-webkit-inner-spin-button]:appearance-none",
|
|
225
|
+
onFocus: _cache[15] || (_cache[15] = (...args) => unref(alphaField).beginEdit && unref(alphaField).beginEdit(...args)),
|
|
226
|
+
onInput: _cache[16] || (_cache[16] = (...args) => unref(alphaField).commit && unref(alphaField).commit(...args)),
|
|
227
|
+
onKeydown: _cache[17] || (_cache[17] = withKeys((...args) => unref(alphaField).commit && unref(alphaField).commit(...args), ["enter"])),
|
|
228
|
+
onBlur: _cache[18] || (_cache[18] = (...args) => unref(alphaField).reset && unref(alphaField).reset(...args))
|
|
229
|
+
}, null, 40, _hoisted_7), [[
|
|
230
|
+
vModelText,
|
|
231
|
+
unref(alphaField).draft,
|
|
232
|
+
void 0,
|
|
233
|
+
{ number: true }
|
|
234
|
+
]]), _cache[19] || (_cache[19] = createElementVNode("span", null, "%", -1))])) : createCommentVNode("", true)])])
|
|
235
|
+
]);
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
export { ColorPickerPanel_default as t };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { computed, createElementBlock, createElementVNode, defineComponent, mergeModels, normalizeStyle, openBlock, ref, useModel } from "vue";
|
|
2
|
+
// src/components/color-picker/ColorPickerSaturationValue.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var _hoisted_1 = ["aria-valuetext"];
|
|
4
|
+
// src/components/color-picker/ColorPickerSaturationValue.vue
|
|
5
|
+
var ColorPickerSaturationValue_default = /* @__PURE__ */ defineComponent({
|
|
6
|
+
__name: "ColorPickerSaturationValue",
|
|
7
|
+
props: /*@__PURE__*/ mergeModels({ hue: {} }, {
|
|
8
|
+
"saturation": { required: true },
|
|
9
|
+
"saturationModifiers": {},
|
|
10
|
+
"value": { required: true },
|
|
11
|
+
"valueModifiers": {}
|
|
12
|
+
}),
|
|
13
|
+
emits: ["update:saturation", "update:value"],
|
|
14
|
+
setup(__props) {
|
|
15
|
+
const saturation = useModel(__props, "saturation");
|
|
16
|
+
const value = useModel(__props, "value");
|
|
17
|
+
const containerRef = ref(null);
|
|
18
|
+
const hueBackground = computed(() => `hsl(${__props.hue}, 100%, 50%)`);
|
|
19
|
+
const handleStyle = computed(() => ({
|
|
20
|
+
left: `${saturation.value}%`,
|
|
21
|
+
top: `${100 - value.value}%`
|
|
22
|
+
}));
|
|
23
|
+
function updateFromPointer(e) {
|
|
24
|
+
const el = containerRef.value;
|
|
25
|
+
if (!el) return;
|
|
26
|
+
const rect = el.getBoundingClientRect();
|
|
27
|
+
const x = Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width));
|
|
28
|
+
const y = Math.max(0, Math.min(1, (e.clientY - rect.top) / rect.height));
|
|
29
|
+
saturation.value = Math.round(x * 100);
|
|
30
|
+
value.value = Math.round((1 - y) * 100);
|
|
31
|
+
}
|
|
32
|
+
function handlePointerDown(e) {
|
|
33
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
34
|
+
updateFromPointer(e);
|
|
35
|
+
}
|
|
36
|
+
function handlePointerMove(e) {
|
|
37
|
+
if (!e.currentTarget.hasPointerCapture(e.pointerId)) return;
|
|
38
|
+
updateFromPointer(e);
|
|
39
|
+
}
|
|
40
|
+
return (_ctx, _cache) => {
|
|
41
|
+
return openBlock(), createElementBlock("div", {
|
|
42
|
+
ref_key: "containerRef",
|
|
43
|
+
ref: containerRef,
|
|
44
|
+
role: "slider",
|
|
45
|
+
"aria-valuetext": `${saturation.value}%, ${value.value}%`,
|
|
46
|
+
class: "relative aspect-square w-full cursor-crosshair rounded-sm",
|
|
47
|
+
style: normalizeStyle({
|
|
48
|
+
backgroundColor: hueBackground.value,
|
|
49
|
+
touchAction: "none"
|
|
50
|
+
}),
|
|
51
|
+
onPointerdown: handlePointerDown,
|
|
52
|
+
onPointermove: handlePointerMove
|
|
53
|
+
}, [
|
|
54
|
+
_cache[0] || (_cache[0] = createElementVNode("div", { class: "absolute inset-0 rounded-sm bg-linear-to-r from-white to-transparent" }, null, -1)),
|
|
55
|
+
_cache[1] || (_cache[1] = createElementVNode("div", { class: "absolute inset-0 rounded-sm bg-linear-to-b from-transparent to-black" }, null, -1)),
|
|
56
|
+
createElementVNode("div", {
|
|
57
|
+
class: "pointer-events-none absolute size-3.5 -translate-1/2 rounded-full border-2 border-white shadow-[0_0_2px_rgba(0,0,0,0.6)]",
|
|
58
|
+
style: normalizeStyle(handleStyle.value)
|
|
59
|
+
}, null, 4)
|
|
60
|
+
], 44, _hoisted_1);
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
export { ColorPickerSaturationValue_default as t };
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeModels, normalizeStyle, openBlock, useModel } from "vue";
|
|
2
|
+
import { memoize } from "es-toolkit/compat";
|
|
3
|
+
// ../shared-frontend-utils/src/colorUtil.ts
|
|
4
|
+
function rgbToHsl({ r, g, b }) {
|
|
5
|
+
r /= 255;
|
|
6
|
+
g /= 255;
|
|
7
|
+
b /= 255;
|
|
8
|
+
const max = Math.max(r, g, b), min = Math.min(r, g, b);
|
|
9
|
+
let h = 0, s = 0;
|
|
10
|
+
const l = (max + min) / 2;
|
|
11
|
+
if (max !== min) {
|
|
12
|
+
const d = max - min;
|
|
13
|
+
s = l > .5 ? d / (2 - max - min) : d / (max + min);
|
|
14
|
+
switch (max) {
|
|
15
|
+
case r:
|
|
16
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
17
|
+
break;
|
|
18
|
+
case g:
|
|
19
|
+
h = (b - r) / d + 2;
|
|
20
|
+
break;
|
|
21
|
+
case b: h = (r - g) / d + 4;
|
|
22
|
+
}
|
|
23
|
+
h /= 6;
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
h,
|
|
27
|
+
s,
|
|
28
|
+
l
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function hexToRgb(hex) {
|
|
32
|
+
let r = 0, g = 0, b = 0;
|
|
33
|
+
if (hex.length === 4 || hex.length === 5) {
|
|
34
|
+
r = parseInt(hex[1] + hex[1], 16);
|
|
35
|
+
g = parseInt(hex[2] + hex[2], 16);
|
|
36
|
+
b = parseInt(hex[3] + hex[3], 16);
|
|
37
|
+
} else if (hex.length === 7 || hex.length === 9) {
|
|
38
|
+
r = parseInt(hex.slice(1, 3), 16);
|
|
39
|
+
g = parseInt(hex.slice(3, 5), 16);
|
|
40
|
+
b = parseInt(hex.slice(5, 7), 16);
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
r,
|
|
44
|
+
g,
|
|
45
|
+
b
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function rgbToHex({ r, g, b }) {
|
|
49
|
+
const toHex = (n) => Math.max(0, Math.min(255, Math.round(n))).toString(16).padStart(2, "0");
|
|
50
|
+
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
51
|
+
}
|
|
52
|
+
function hsbToRgb({ h, s, b }) {
|
|
53
|
+
const hh = (h % 360 + 360) % 360;
|
|
54
|
+
const ss = Math.max(0, Math.min(100, s)) / 100;
|
|
55
|
+
const vv = Math.max(0, Math.min(100, b)) / 100;
|
|
56
|
+
const c = vv * ss;
|
|
57
|
+
const x = c * (1 - Math.abs(hh / 60 % 2 - 1));
|
|
58
|
+
const m = vv - c;
|
|
59
|
+
let rp, gp, bp;
|
|
60
|
+
if (hh < 60) {
|
|
61
|
+
rp = c;
|
|
62
|
+
gp = x;
|
|
63
|
+
bp = 0;
|
|
64
|
+
} else if (hh < 120) {
|
|
65
|
+
rp = x;
|
|
66
|
+
gp = c;
|
|
67
|
+
bp = 0;
|
|
68
|
+
} else if (hh < 180) {
|
|
69
|
+
rp = 0;
|
|
70
|
+
gp = c;
|
|
71
|
+
bp = x;
|
|
72
|
+
} else if (hh < 240) {
|
|
73
|
+
rp = 0;
|
|
74
|
+
gp = x;
|
|
75
|
+
bp = c;
|
|
76
|
+
} else if (hh < 300) {
|
|
77
|
+
rp = x;
|
|
78
|
+
gp = 0;
|
|
79
|
+
bp = c;
|
|
80
|
+
} else {
|
|
81
|
+
rp = c;
|
|
82
|
+
gp = 0;
|
|
83
|
+
bp = x;
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
r: Math.floor((rp + m) * 255),
|
|
87
|
+
g: Math.floor((gp + m) * 255),
|
|
88
|
+
b: Math.floor((bp + m) * 255)
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
var identifyColorFormat = (color) => {
|
|
92
|
+
if (!color) return null;
|
|
93
|
+
if (color.startsWith("#") && (color.length === 4 || color.length === 5 || color.length === 7 || color.length === 9)) return "hex";
|
|
94
|
+
if (/rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*/.test(color)) return color.includes("rgba") ? "rgba" : "rgb";
|
|
95
|
+
if (/hsla?\(\s*\d+(\.\d+)?\s*,\s*\d+(\.\d+)?%\s*,\s*\d+(\.\d+)?%/.test(color)) return color.includes("hsla") ? "hsla" : "hsl";
|
|
96
|
+
return null;
|
|
97
|
+
};
|
|
98
|
+
var isHSLA = (color) => {
|
|
99
|
+
if (typeof color !== "object" || color === null) return false;
|
|
100
|
+
return [
|
|
101
|
+
"h",
|
|
102
|
+
"s",
|
|
103
|
+
"l",
|
|
104
|
+
"a"
|
|
105
|
+
].every((key) => typeof color[key] === "number" && !isNaN(color[key]));
|
|
106
|
+
};
|
|
107
|
+
function parseToHSLA(color, format) {
|
|
108
|
+
let match;
|
|
109
|
+
switch (format) {
|
|
110
|
+
case "hex": {
|
|
111
|
+
let a = 1;
|
|
112
|
+
let hexColor = color;
|
|
113
|
+
if (color.length === 9) {
|
|
114
|
+
a = parseInt(color.slice(7, 9), 16) / 255;
|
|
115
|
+
hexColor = color.slice(0, 7);
|
|
116
|
+
} else if (color.length === 5) {
|
|
117
|
+
const aChar = color[4];
|
|
118
|
+
a = parseInt(aChar + aChar, 16) / 255;
|
|
119
|
+
hexColor = color.slice(0, 4);
|
|
120
|
+
}
|
|
121
|
+
const hsl = rgbToHsl(hexToRgb(hexColor));
|
|
122
|
+
return {
|
|
123
|
+
h: Math.round(hsl.h * 360),
|
|
124
|
+
s: +(hsl.s * 100).toFixed(1),
|
|
125
|
+
l: +(hsl.l * 100).toFixed(1),
|
|
126
|
+
a
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
case "rgb":
|
|
130
|
+
case "rgba": {
|
|
131
|
+
match = color.match(/\d+(\.\d+)?/g);
|
|
132
|
+
if (!match || match.length < 3) return null;
|
|
133
|
+
const [r, g, b] = match.map(Number);
|
|
134
|
+
const hsl = rgbToHsl({
|
|
135
|
+
r,
|
|
136
|
+
g,
|
|
137
|
+
b
|
|
138
|
+
});
|
|
139
|
+
const a = format === "rgba" && match[3] ? parseFloat(match[3]) : 1;
|
|
140
|
+
return {
|
|
141
|
+
h: Math.round(hsl.h * 360),
|
|
142
|
+
s: +(hsl.s * 100).toFixed(1),
|
|
143
|
+
l: +(hsl.l * 100).toFixed(1),
|
|
144
|
+
a
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
case "hsl":
|
|
148
|
+
case "hsla": {
|
|
149
|
+
match = color.match(/\d+(\.\d+)?/g);
|
|
150
|
+
if (!match || match.length < 3) return null;
|
|
151
|
+
const [h, s, l] = match.map(Number);
|
|
152
|
+
return {
|
|
153
|
+
h,
|
|
154
|
+
s,
|
|
155
|
+
l,
|
|
156
|
+
a: format === "hsla" && match[3] ? parseFloat(match[3]) : 1
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
default: return null;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function rgbToHsv({ r, g, b }) {
|
|
163
|
+
r /= 255;
|
|
164
|
+
g /= 255;
|
|
165
|
+
b /= 255;
|
|
166
|
+
const max = Math.max(r, g, b);
|
|
167
|
+
const d = max - Math.min(r, g, b);
|
|
168
|
+
let h = 0;
|
|
169
|
+
const s = max === 0 ? 0 : d / max * 100;
|
|
170
|
+
const v = max * 100;
|
|
171
|
+
if (d !== 0) switch (max) {
|
|
172
|
+
case r:
|
|
173
|
+
h = ((g - b) / d + (g < b ? 6 : 0)) * 60;
|
|
174
|
+
break;
|
|
175
|
+
case g:
|
|
176
|
+
h = ((b - r) / d + 2) * 60;
|
|
177
|
+
break;
|
|
178
|
+
case b: h = ((r - g) / d + 4) * 60;
|
|
179
|
+
}
|
|
180
|
+
return {
|
|
181
|
+
h,
|
|
182
|
+
s,
|
|
183
|
+
v
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
function normalizeHex(value) {
|
|
187
|
+
const digits = value.trim().replace(/^#/, "");
|
|
188
|
+
return /^([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(digits) ? `#${digits}` : null;
|
|
189
|
+
}
|
|
190
|
+
function hexToHsva(hex) {
|
|
191
|
+
const normalized = hex.startsWith("#") ? hex : `#${hex}`;
|
|
192
|
+
let a = 100;
|
|
193
|
+
let hexColor = normalized;
|
|
194
|
+
if (normalized.length === 9) {
|
|
195
|
+
a = Math.round(parseInt(normalized.slice(7, 9), 16) / 255 * 100);
|
|
196
|
+
hexColor = normalized.slice(0, 7);
|
|
197
|
+
} else if (normalized.length === 5) {
|
|
198
|
+
const aChar = normalized[4];
|
|
199
|
+
a = Math.round(parseInt(aChar + aChar, 16) / 255 * 100);
|
|
200
|
+
hexColor = normalized.slice(0, 4);
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
...rgbToHsv(hexToRgb(hexColor)),
|
|
204
|
+
a
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
function hsvaToHex(hsva) {
|
|
208
|
+
const hex = rgbToHex(hsbToRgb({
|
|
209
|
+
h: hsva.h,
|
|
210
|
+
s: hsva.s,
|
|
211
|
+
b: hsva.v
|
|
212
|
+
}));
|
|
213
|
+
if (hsva.a >= 100) return hex.toLowerCase();
|
|
214
|
+
return `${hex}${Math.round(hsva.a / 100 * 255).toString(16).padStart(2, "0")}`.toLowerCase();
|
|
215
|
+
}
|
|
216
|
+
var applyColorAdjustments = (color, options) => {
|
|
217
|
+
if (!Object.keys(options).length) return color;
|
|
218
|
+
const format = identifyColorFormat(color);
|
|
219
|
+
if (!format) {
|
|
220
|
+
console.warn(`Unsupported color format in color palette: ${color}`);
|
|
221
|
+
return color;
|
|
222
|
+
}
|
|
223
|
+
const hsla = parseToHSLA(color, format);
|
|
224
|
+
if (!isHSLA(hsla)) {
|
|
225
|
+
console.warn(`Invalid color values in color palette: ${color}`);
|
|
226
|
+
return color;
|
|
227
|
+
}
|
|
228
|
+
if (options.lightness) hsla.l = Math.max(0, Math.min(100, hsla.l + options.lightness * 100));
|
|
229
|
+
if (options.opacity) hsla.a = Math.max(0, Math.min(1, options.opacity));
|
|
230
|
+
return `hsla(${hsla.h}, ${hsla.s}%, ${hsla.l}%, ${hsla.a})`;
|
|
231
|
+
};
|
|
232
|
+
memoize(applyColorAdjustments, (color, options) => `${color}-${JSON.stringify(options)}`);
|
|
233
|
+
// src/components/color-picker/ColorPickerSlider.vue?vue&type=script&setup=true&lang.ts
|
|
234
|
+
var _hoisted_1 = ["aria-valuemax", "aria-valuenow"];
|
|
235
|
+
// src/components/color-picker/ColorPickerSlider.vue
|
|
236
|
+
var ColorPickerSlider_default = /* @__PURE__ */ defineComponent({
|
|
237
|
+
__name: "ColorPickerSlider",
|
|
238
|
+
props: /*@__PURE__*/ mergeModels({
|
|
239
|
+
type: {},
|
|
240
|
+
hue: { default: 0 },
|
|
241
|
+
saturation: { default: 100 },
|
|
242
|
+
brightness: { default: 100 }
|
|
243
|
+
}, {
|
|
244
|
+
"modelValue": { required: true },
|
|
245
|
+
"modelModifiers": {}
|
|
246
|
+
}),
|
|
247
|
+
emits: ["update:modelValue"],
|
|
248
|
+
setup(__props) {
|
|
249
|
+
const modelValue = useModel(__props, "modelValue");
|
|
250
|
+
const max = computed(() => __props.type === "hue" ? 360 : 100);
|
|
251
|
+
const fraction = computed(() => modelValue.value / max.value);
|
|
252
|
+
const trackBackground = computed(() => {
|
|
253
|
+
if (__props.type === "hue") return "linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%)";
|
|
254
|
+
return `linear-gradient(to right, transparent, ${rgbToHex(hsbToRgb({
|
|
255
|
+
h: __props.hue,
|
|
256
|
+
s: __props.saturation,
|
|
257
|
+
b: __props.brightness
|
|
258
|
+
}))})`;
|
|
259
|
+
});
|
|
260
|
+
const containerStyle = computed(() => {
|
|
261
|
+
if (__props.type === "alpha") return {
|
|
262
|
+
backgroundImage: "repeating-conic-gradient(#808080 0% 25%, transparent 0% 50%)",
|
|
263
|
+
backgroundSize: "8px 8px",
|
|
264
|
+
touchAction: "none"
|
|
265
|
+
};
|
|
266
|
+
return {
|
|
267
|
+
background: trackBackground.value,
|
|
268
|
+
touchAction: "none"
|
|
269
|
+
};
|
|
270
|
+
});
|
|
271
|
+
function updateFromPointer(e) {
|
|
272
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
273
|
+
const x = Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width));
|
|
274
|
+
modelValue.value = Math.round(x * max.value);
|
|
275
|
+
}
|
|
276
|
+
function handlePointerDown(e) {
|
|
277
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
278
|
+
updateFromPointer(e);
|
|
279
|
+
}
|
|
280
|
+
function handlePointerMove(e) {
|
|
281
|
+
if (!e.currentTarget.hasPointerCapture(e.pointerId)) return;
|
|
282
|
+
updateFromPointer(e);
|
|
283
|
+
}
|
|
284
|
+
return (_ctx, _cache) => {
|
|
285
|
+
return openBlock(), createElementBlock("div", {
|
|
286
|
+
role: "slider",
|
|
287
|
+
"aria-valuemin": 0,
|
|
288
|
+
"aria-valuemax": max.value,
|
|
289
|
+
"aria-valuenow": modelValue.value,
|
|
290
|
+
class: "relative flex h-4 cursor-pointer items-center rounded-full p-px",
|
|
291
|
+
style: normalizeStyle(containerStyle.value),
|
|
292
|
+
onPointerdown: handlePointerDown,
|
|
293
|
+
onPointermove: handlePointerMove
|
|
294
|
+
}, [__props.type === "alpha" ? (openBlock(), createElementBlock("div", {
|
|
295
|
+
key: 0,
|
|
296
|
+
class: "absolute inset-0 rounded-full",
|
|
297
|
+
style: normalizeStyle({ background: trackBackground.value })
|
|
298
|
+
}, null, 4)) : createCommentVNode("", true), createElementVNode("div", {
|
|
299
|
+
class: "pointer-events-none absolute aspect-square h-full -translate-x-1/2 rounded-full border-2 border-white shadow-[0_0_2px_rgba(0,0,0,0.6)]",
|
|
300
|
+
style: normalizeStyle({ left: `${fraction.value * 100}%` })
|
|
301
|
+
}, null, 4)], 44, _hoisted_1);
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
export { normalizeHex as a, hsvaToHex as i, hexToHsva as n, rgbToHex as o, hsbToRgb as r, rgbToHsv as s, ColorPickerSlider_default as t };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { t as cn } from "./src-
|
|
1
|
+
import { t as cn } from "./src-DTwuqov4.js";
|
|
2
2
|
import { menuContentClass } from "../menu/menuStyles.js";
|
|
3
3
|
import { createBlock, createPropsRestProxy, createVNode, defineComponent, mergeProps, openBlock, renderSlot, unref, withCtx } from "vue";
|
|
4
4
|
import { ContextMenuContent, ContextMenuPortal, injectContextMenuRootContext, useForwardPropsEmits } from "reka-ui";
|
|
5
|
-
|
|
6
|
-
//#region src/components/menu/ContextMenuContent.vue
|
|
5
|
+
// src/components/menu/ContextMenuContent.vue
|
|
7
6
|
var ContextMenuContent_default = /* @__PURE__ */ defineComponent({
|
|
8
7
|
inheritAttrs: false,
|
|
9
8
|
__name: "ContextMenuContent",
|
|
@@ -60,5 +59,4 @@ var ContextMenuContent_default = /* @__PURE__ */ defineComponent({
|
|
|
60
59
|
};
|
|
61
60
|
}
|
|
62
61
|
});
|
|
63
|
-
//#endregion
|
|
64
62
|
export { ContextMenuContent_default as t };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { t as Button_default } from "./Button-Dj_H5v3V.js";
|
|
2
|
+
import { createBlock, createElementVNode, createVNode, defineComponent, openBlock, renderSlot, unref, withCtx } from "vue";
|
|
3
|
+
import { DialogClose } from "reka-ui";
|
|
4
|
+
// src/components/dialog/DialogClose.vue
|
|
5
|
+
var DialogClose_default = /* @__PURE__ */ defineComponent({
|
|
6
|
+
__name: "DialogClose",
|
|
7
|
+
setup(__props) {
|
|
8
|
+
return (_ctx, _cache) => {
|
|
9
|
+
return openBlock(), createBlock(unref(DialogClose), { "as-child": "" }, {
|
|
10
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default", {}, () => [createVNode(unref(Button_default), {
|
|
11
|
+
size: "icon",
|
|
12
|
+
variant: "muted-textonly"
|
|
13
|
+
}, {
|
|
14
|
+
default: withCtx(() => [..._cache[0] || (_cache[0] = [createElementVNode("i", { class: "icon-[lucide--x]" }, null, -1)])]),
|
|
15
|
+
_: 1
|
|
16
|
+
})])]),
|
|
17
|
+
_: 3
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
export { DialogClose_default as t };
|