ropav 0.1.5 → 0.1.7
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 +10 -0
- package/dist/accordion.css +17 -17
- package/dist/accordion.js +125 -154
- package/dist/alert.css +18 -18
- package/dist/alert.js +20 -20
- package/dist/aria.js +14 -0
- package/dist/aspect-ratio.js +1 -1
- package/dist/attributes.js +9 -0
- package/dist/attributes2.js +29 -0
- package/dist/avatar.css +19 -19
- package/dist/avatar.js +10 -18
- package/dist/badge.css +16 -16
- package/dist/badge.js +6 -6
- package/dist/base.css +18 -13
- package/dist/button-group.js +1 -1
- package/dist/button-link.js +13 -14
- package/dist/button.css +32 -27
- package/dist/button.js +13 -14
- package/dist/{useButtonColor.js → button.scss_vue_type_style_index_0_src_true_lang.js} +3 -2
- package/dist/card.js +1 -1
- package/dist/checkbox.css +32 -32
- package/dist/checkbox.js +23 -29
- package/dist/collapse.css +6 -6
- package/dist/collapse.js +8 -7
- package/dist/collectionNavigation.js +2 -99
- package/dist/color-input.css +19 -19
- package/dist/color-input.js +15 -14
- package/dist/color-picker.css +40 -40
- package/dist/color-picker.js +222 -202
- package/dist/color-picker2.js +1 -9
- package/dist/color-swatch.css +4 -4
- package/dist/color-swatch.js +7 -9
- package/dist/color.js +5 -10
- package/dist/componentColors.js +165 -84
- package/dist/componentRef.js +26 -0
- package/dist/components/accordion/accordionContext.d.ts +3 -0
- package/dist/components/accordion/accordionModel.d.ts +14 -0
- package/dist/components/accordion/index.d.ts +2 -1
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/accordion/types.d.ts +1 -2
- package/dist/components/accordion/useAccordion.d.ts +2 -2
- package/dist/components/accordion/useAccordionItem.d.ts +2 -0
- package/dist/components/checkbox/useCheckbox.d.ts +2 -3
- package/dist/components/color-input/color-input.d.ts +2 -2
- package/dist/components/color-input/useColorInput.d.ts +1 -1
- package/dist/components/color-picker/index.js +2 -2
- package/dist/components/color-picker/types.d.ts +2 -2
- package/dist/components/color-picker/useColorPickerSaturation.d.ts +22 -0
- package/dist/components/color-picker/useColorPickerSlider.d.ts +20 -0
- package/dist/components/color-picker/useColorPickerValue.d.ts +1 -1
- package/dist/components/dialog/{dialog-core.d.ts → dialogContext.d.ts} +2 -6
- package/dist/components/dialog/useDialogContentInteractions.d.ts +18 -0
- package/dist/components/dialog/useDialogRootState.d.ts +19 -0
- package/dist/components/dropdown-menu/dropdown-menu-content.d.ts +2 -2
- package/dist/components/dropdown-menu/dropdown-menu-item-row.d.ts +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-items.d.ts +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-model.d.ts +8 -0
- package/dist/components/dropdown-menu/dropdown-menu-root.d.ts +2 -2
- package/dist/components/dropdown-menu/dropdown-menu-sub-content.d.ts +2 -2
- package/dist/components/dropdown-menu/dropdown-menu-sub-trigger.d.ts +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-sub.d.ts +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +3 -3
- package/dist/components/dropdown-menu/{dropdown-menu-primitive-core.d.ts → dropdownMenuContext.d.ts} +17 -19
- package/dist/components/dropdown-menu/dropdownMenuDataModel.d.ts +20 -0
- package/dist/components/dropdown-menu/dropdownMenuInteraction.d.ts +3 -0
- package/dist/components/dropdown-menu/dropdownMenuInteractionNavigation.d.ts +24 -0
- package/dist/components/dropdown-menu/dropdownMenuInteractionRegistry.d.ts +42 -0
- package/dist/components/dropdown-menu/dropdownMenuInteractionTypes.d.ts +85 -0
- package/dist/components/dropdown-menu/useDropdownMenu.d.ts +11 -11
- package/dist/components/dropdown-menu/useDropdownMenuContextTrigger.d.ts +9 -0
- package/dist/components/dropdown-menu/useDropdownMenuDataController.d.ts +34 -0
- package/dist/components/dropdown-menu/useDropdownMenuDataRegistration.d.ts +22 -0
- package/dist/components/dropdown-menu/useDropdownMenuHoverIntent.d.ts +6 -5
- package/dist/components/dropdown-menu/useDropdownMenuInteractionDismissal.d.ts +17 -0
- package/dist/components/dropdown-menu/useDropdownMenuInteractionKeyboard.d.ts +19 -0
- package/dist/components/dropdown-menu/useDropdownMenuPortalPosition.d.ts +0 -1
- package/dist/components/dropdown-menu/useDropdownMenuPresentation.d.ts +29 -0
- package/dist/components/dropdown-menu/useDropdownMenuPrimitiveContent.d.ts +2 -2
- package/dist/components/dropdown-menu/useDropdownMenuRenderItems.d.ts +1 -1
- package/dist/components/dropdown-menu/useDropdownMenuTargetBindings.d.ts +19 -0
- package/dist/components/floating/hoverDisclosureInteractionModel.d.ts +42 -0
- package/dist/components/floating/index.js +1 -1
- package/dist/components/floating/useFloatingPosition.d.ts +0 -1
- package/dist/components/floating/useHoverDisclosureInteractions.d.ts +32 -0
- package/dist/components/floating/useHoverDisclosureOpenState.d.ts +25 -0
- package/dist/components/floating/useHoverDisclosureTargetBinding.d.ts +27 -0
- package/dist/components/input/useInput.d.ts +1 -1
- package/dist/components/number-input/numberInputModel.d.ts +15 -0
- package/dist/components/number-input/useNumberInput.d.ts +4 -18
- package/dist/components/pagination/index.d.ts +1 -1
- package/dist/components/pagination/index.js +1 -1
- package/dist/components/pagination/paginationModel.d.ts +4 -0
- package/dist/components/pagination/types.d.ts +15 -0
- package/dist/components/pagination/usePagination.d.ts +3 -19
- package/dist/components/popover/usePopoverBindings.d.ts +16 -0
- package/dist/components/progress/progressModel.d.ts +8 -0
- package/dist/components/progress/useProgress.d.ts +1 -7
- package/dist/components/radio/useRadio.d.ts +3 -4
- package/dist/components/scroll-area/scroll-area.d.ts +1 -1
- package/dist/components/scroll-area/scrollAreaModel.d.ts +64 -0
- package/dist/components/scroll-area/types.d.ts +4 -0
- package/dist/components/scroll-area/useScrollArea.d.ts +70 -52
- package/dist/components/scroll-area/{useScrollAreaPresentation.d.ts → useScrollAreaAttributes.d.ts} +37 -14
- package/dist/components/scroll-area/useScrollAreaDerivedState.d.ts +8 -0
- package/dist/components/scroll-area/useScrollAreaMeasurement.d.ts +35 -0
- package/dist/components/scroll-area/useScrollAreaPointer.d.ts +10 -8
- package/dist/components/scroll-area/useScrollAreaVisibility.d.ts +15 -20
- package/dist/components/select/useSelect.d.ts +2 -1
- package/dist/components/select/useSelectNativeValue.d.ts +1 -7
- package/dist/components/slider/rangeSliderModel.d.ts +41 -0
- package/dist/components/slider/{sliderCore.d.ts → sliderModel.d.ts} +2 -2
- package/dist/components/slider/useRangeSlider.d.ts +9 -17
- package/dist/components/slider/useRangeSliderValueState.d.ts +40 -0
- package/dist/components/slider/useSlider.d.ts +8 -14
- package/dist/components/slider/useSliderPointerPreview.d.ts +22 -0
- package/dist/components/slider/useSliderTooltipState.d.ts +40 -0
- package/dist/components/slider/useSliderValueState.d.ts +33 -0
- package/dist/components/switch/useSwitch.d.ts +1 -1
- package/dist/components/teleport-provider/index.js +1 -1
- package/dist/components/teleport-provider/useTeleportTarget.d.ts +1 -2
- package/dist/components/textarea/useTextarea.d.ts +1 -1
- package/dist/components/toast/useToastLifecycle.d.ts +19 -0
- package/dist/components/tooltip/useTooltip.d.ts +1 -2
- package/dist/composables/index.d.ts +2 -0
- package/dist/composables/index.js +2 -0
- package/dist/composables/useControllableValue.d.ts +14 -0
- package/dist/css.js +12 -0
- package/dist/dialog.js +227 -216
- package/dist/dropdown-menu.js +1493 -1118
- package/dist/events.js +59 -0
- package/dist/field.css +8 -8
- package/dist/field.js +13 -25
- package/dist/floating.js +553 -312
- package/dist/floatingOffset.js +11 -0
- package/dist/focus-trap.js +7 -5
- package/dist/focusNavigation.js +37 -0
- package/dist/icon-button.css +12 -173
- package/dist/icon-button.js +8 -7
- package/dist/index.d.ts +5 -4
- package/dist/index.js +13 -11
- package/dist/input.css +24 -24
- package/dist/input.js +20 -32
- package/dist/interactive.js +18 -0
- package/dist/modal.js +11 -7
- package/dist/number-input.css +18 -18
- package/dist/number-input.js +15 -13
- package/dist/number.js +22 -0
- package/dist/overlay.js +3 -2
- package/dist/pagination.css +28 -28
- package/dist/pagination.js +67 -65
- package/dist/pointer.js +9 -0
- package/dist/popover.css +34 -34
- package/dist/popover.js +93 -91
- package/dist/progress.css +29 -21
- package/dist/progress.js +25 -21
- package/dist/query.js +40 -0
- package/dist/radio.css +18 -18
- package/dist/radio.js +31 -37
- package/dist/rafScheduler.js +34 -0
- package/dist/scroll-area.css +35 -26
- package/dist/scroll-area.js +553 -500
- package/dist/select.css +45 -45
- package/dist/select.js +70 -56
- package/dist/slider.css +191 -191
- package/dist/slider.js +695 -628
- package/dist/styles-api.d.ts +0 -1
- package/dist/styles-api.js +1 -4
- package/dist/switch.css +17 -17
- package/dist/switch.js +15 -16
- package/dist/tabs.css +46 -46
- package/dist/tabs.js +51 -68
- package/dist/text.js +17 -0
- package/dist/textarea.css +26 -26
- package/dist/textarea.js +22 -33
- package/dist/toast.css +26 -26
- package/dist/toast.js +157 -129
- package/dist/tooltip.css +12 -12
- package/dist/tooltip.js +46 -47
- package/dist/useCollapse.js +19 -17
- package/dist/useControlState.js +4 -7
- package/dist/useControllableValue.js +8 -2
- package/dist/useFloatingPosition.js +122 -1128
- package/dist/useFormControl.js +3 -2
- package/dist/useOverlayZIndex.js +2 -6
- package/dist/useRequiredInject.js +1 -1
- package/dist/useTeleportTarget.js +3 -14
- package/dist/useTypeahead.js +94 -0
- package/dist/utils/aria.d.ts +3 -0
- package/dist/utils/attributes.d.ts +2 -0
- package/dist/utils/bem.d.ts +3 -0
- package/dist/utils/collectionNavigation.d.ts +2 -0
- package/dist/utils/color.d.ts +7 -0
- package/dist/{components/color-picker/color-picker-utils.d.ts → utils/colorPicker.d.ts} +5 -4
- package/dist/utils/componentColors.d.ts +7 -0
- package/dist/utils/css.d.ts +3 -0
- package/dist/utils/dom/ancestry.d.ts +7 -0
- package/dist/utils/dom/attributes.d.ts +16 -0
- package/dist/utils/dom/componentRef.d.ts +4 -0
- package/dist/utils/dom/events.d.ts +5 -0
- package/dist/utils/dom/focusNavigation.d.ts +7 -0
- package/dist/utils/dom/interactive.d.ts +2 -0
- package/dist/utils/dom/pointer.d.ts +2 -0
- package/dist/utils/dom/query.d.ts +4 -0
- package/dist/utils/dom/scroll.d.ts +23 -0
- package/dist/utils/floatingOffset.d.ts +10 -0
- package/dist/utils/geometry.d.ts +14 -0
- package/dist/utils/indexPath.d.ts +6 -0
- package/dist/utils/number.d.ts +4 -0
- package/dist/utils/rafScheduler.d.ts +4 -0
- package/dist/utils/text.d.ts +2 -0
- package/docs/code-architecture.md +118 -0
- package/docs/public-composables-api.md +52 -0
- package/docs/public-floating-api.md +6 -5
- package/package.json +54 -46
- package/src/styles/_mixins.scss +4 -0
- package/src/styles/_tokens.scss +12 -12
- package/src/styles/_variables.scss +1 -1
- package/dist/button-link.css +0 -167
- package/dist/components/dropdown-menu/dropdown-menu-outside.d.ts +0 -3
- package/dist/components/dropdown-menu/dropdown-menu-utils.d.ts +0 -21
- package/dist/components/dropdown-menu/useDropdownMenuDisclosure.d.ts +0 -37
- package/dist/components/dropdown-menu/useDropdownMenuDom.d.ts +0 -29
- package/dist/components/dropdown-menu/useDropdownMenuInteractions.d.ts +0 -52
- package/dist/components/dropdown-menu/useDropdownMenuNavigation.d.ts +0 -17
- package/dist/components/dropdown-menu/useDropdownSubmenus.d.ts +0 -18
- package/dist/components/scroll-area/scrollAreaCore.d.ts +0 -25
- package/dist/components/scroll-area/useScrollAreaControls.d.ts +0 -25
- package/dist/components/scroll-area/useScrollAreaMetrics.d.ts +0 -35
- /package/dist/components/alert/{useAlertColor.d.ts → alertColor.d.ts} +0 -0
- /package/dist/components/avatar/{useAvatarColor.d.ts → avatarColor.d.ts} +0 -0
- /package/dist/components/badge/{useBadgeColor.d.ts → badgeColor.d.ts} +0 -0
- /package/dist/components/button/{useButtonColor.d.ts → buttonColor.d.ts} +0 -0
- /package/dist/components/color-swatch/{useColorSwatchColor.d.ts → colorSwatchColor.d.ts} +0 -0
- /package/dist/components/toast/{useToastColor.d.ts → toastColor.d.ts} +0 -0
- /package/dist/{composables → internal/composables}/useOverlayLayer.d.ts +0 -0
package/dist/color-picker.js
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
import './color-picker.css';
|
|
2
|
+
import { t as useStylesApi } from "./styles-api.js";
|
|
3
|
+
import { n as toPresenceAttribute } from "./attributes.js";
|
|
2
4
|
import { t as bem } from "./bem.js";
|
|
3
|
-
import { n as useStylesApi, t as presence } from "./styles-api.js";
|
|
4
|
-
import { t as parseCssColor } from "./color.js";
|
|
5
5
|
import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
|
|
6
|
+
import { i as roundTo, t as clamp } from "./number.js";
|
|
7
|
+
import { t as parseCssColor } from "./color.js";
|
|
6
8
|
import { t as check_default } from "./check.js";
|
|
7
9
|
import { t as color_swatch_default } from "./color-swatch.js";
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
10
|
+
import { n as toHTMLElement } from "./componentRef.js";
|
|
11
|
+
import { n as isMatchingPointer, t as getPointerId } from "./pointer.js";
|
|
12
|
+
import { t as createRafScheduler } from "./rafScheduler.js";
|
|
13
|
+
import { i as isNodeWithinElement } from "./events.js";
|
|
14
|
+
import { child, computed, createComponent, createFor, createIf, createSlot, createTemplateRefSetter, defineVaporComponent, extend, next, nthChild, on, onBeforeUnmount, ref, renderEffect, setAttr, setClass, setDynamicProps, setInsertionState, setProp, setStyle, setTemplateRefBinding, setValue, template, unref } from "vue";
|
|
15
|
+
//#region src/utils/colorPicker.ts
|
|
16
|
+
var colorPickerFormats = [
|
|
17
|
+
"hex",
|
|
18
|
+
"hexa",
|
|
19
|
+
"rgb",
|
|
20
|
+
"rgba",
|
|
21
|
+
"hsl",
|
|
22
|
+
"hsla"
|
|
23
|
+
];
|
|
12
24
|
function clampPercent(value) {
|
|
13
25
|
return clamp(Number.isFinite(value) ? value : 0, 0, 100);
|
|
14
26
|
}
|
|
@@ -27,7 +39,18 @@ function clampOpacity(value) {
|
|
|
27
39
|
return clamp(Number.isFinite(value) ? value : 100, 0, 100);
|
|
28
40
|
}
|
|
29
41
|
function roundPercent(value) {
|
|
30
|
-
return
|
|
42
|
+
return roundTo(value);
|
|
43
|
+
}
|
|
44
|
+
function getColorPickerKeyboardValue(key, currentValue, maxValue, step = 1) {
|
|
45
|
+
switch (key) {
|
|
46
|
+
case "ArrowRight":
|
|
47
|
+
case "ArrowUp": return currentValue + step;
|
|
48
|
+
case "ArrowLeft":
|
|
49
|
+
case "ArrowDown": return currentValue - step;
|
|
50
|
+
case "Home": return 0;
|
|
51
|
+
case "End": return maxValue;
|
|
52
|
+
default: return;
|
|
53
|
+
}
|
|
31
54
|
}
|
|
32
55
|
function isColorPickerAlphaFormat(format) {
|
|
33
56
|
return format === "hexa" || format === "rgba" || format === "hsla";
|
|
@@ -142,29 +165,18 @@ function formatAlpha(opacity) {
|
|
|
142
165
|
return formatNumber(clampOpacity(opacity) / 100);
|
|
143
166
|
}
|
|
144
167
|
function formatNumber(value) {
|
|
145
|
-
return String(
|
|
168
|
+
return String(roundTo(value));
|
|
146
169
|
}
|
|
147
170
|
//#endregion
|
|
148
171
|
//#region src/components/color-picker/useColorPickerDrag.ts
|
|
149
|
-
function getPointerId(event) {
|
|
150
|
-
return Number.isFinite(event.pointerId) ? event.pointerId : void 0;
|
|
151
|
-
}
|
|
152
172
|
function useColorPickerDrag({ target, focusTarget, readonly, isGeometryValid, updateFromPointer }) {
|
|
153
173
|
let session;
|
|
154
|
-
let frameWindow = null;
|
|
155
|
-
let frameId;
|
|
156
174
|
let geometryDirty = false;
|
|
157
175
|
let pendingPointer;
|
|
158
176
|
function isCurrentPointer(event) {
|
|
159
177
|
const currentSession = session;
|
|
160
178
|
if (!currentSession) return false;
|
|
161
|
-
|
|
162
|
-
return currentSession.pointerId === void 0 || pointerId === currentSession.pointerId;
|
|
163
|
-
}
|
|
164
|
-
function cancelScheduledFrame() {
|
|
165
|
-
if (frameId !== void 0) frameWindow?.cancelAnimationFrame(frameId);
|
|
166
|
-
frameWindow = null;
|
|
167
|
-
frameId = void 0;
|
|
179
|
+
return isMatchingPointer(event, currentSession.pointerId);
|
|
168
180
|
}
|
|
169
181
|
function applyScheduledUpdate(currentSession) {
|
|
170
182
|
if (session !== currentSession) return;
|
|
@@ -178,26 +190,17 @@ function useColorPickerDrag({ target, focusTarget, readonly, isGeometryValid, up
|
|
|
178
190
|
pendingPointer = void 0;
|
|
179
191
|
if (pointer) updateFromPointer(pointer, currentSession.rect);
|
|
180
192
|
}
|
|
193
|
+
const updateScheduler = createRafScheduler(() => {
|
|
194
|
+
const currentSession = session;
|
|
195
|
+
if (currentSession) applyScheduledUpdate(currentSession);
|
|
196
|
+
}, () => session?.view);
|
|
181
197
|
function flushScheduledUpdate() {
|
|
182
198
|
const currentSession = session;
|
|
183
|
-
|
|
199
|
+
updateScheduler.cancel();
|
|
184
200
|
if (currentSession) applyScheduledUpdate(currentSession);
|
|
185
201
|
}
|
|
186
202
|
function scheduleUpdate() {
|
|
187
|
-
|
|
188
|
-
if (!currentSession) return;
|
|
189
|
-
const view = currentSession.view;
|
|
190
|
-
if (!view?.requestAnimationFrame) {
|
|
191
|
-
applyScheduledUpdate(currentSession);
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
if (frameId !== void 0) return;
|
|
195
|
-
frameWindow = view;
|
|
196
|
-
frameId = view.requestAnimationFrame(() => {
|
|
197
|
-
frameWindow = null;
|
|
198
|
-
frameId = void 0;
|
|
199
|
-
applyScheduledUpdate(currentSession);
|
|
200
|
-
});
|
|
203
|
+
if (session) updateScheduler.schedule();
|
|
201
204
|
}
|
|
202
205
|
function onGeometryChange() {
|
|
203
206
|
if (!session) return;
|
|
@@ -212,7 +215,7 @@ function useColorPickerDrag({ target, focusTarget, readonly, isGeometryValid, up
|
|
|
212
215
|
stoppedSession.view?.removeEventListener("pointercancel", onPointerEnd);
|
|
213
216
|
stoppedSession.view?.removeEventListener("resize", onGeometryChange);
|
|
214
217
|
stoppedSession.view?.removeEventListener("scroll", onGeometryChange, true);
|
|
215
|
-
|
|
218
|
+
updateScheduler.cancel();
|
|
216
219
|
geometryDirty = false;
|
|
217
220
|
pendingPointer = void 0;
|
|
218
221
|
session = void 0;
|
|
@@ -260,9 +263,80 @@ function useColorPickerDrag({ target, focusTarget, readonly, isGeometryValid, up
|
|
|
260
263
|
return { onPointerDown };
|
|
261
264
|
}
|
|
262
265
|
//#endregion
|
|
266
|
+
//#region src/components/color-picker/useColorPickerSaturation.ts
|
|
267
|
+
function useColorPickerSaturation({ modelValue, hue, readonly, onChange }) {
|
|
268
|
+
const saturationRef = ref(null);
|
|
269
|
+
const saturationInputRef = ref(null);
|
|
270
|
+
const selection = computed(() => {
|
|
271
|
+
const currentSelection = modelValue();
|
|
272
|
+
return {
|
|
273
|
+
saturation: clampPercent(currentSelection.saturation),
|
|
274
|
+
value: clampPercent(currentSelection.value)
|
|
275
|
+
};
|
|
276
|
+
});
|
|
277
|
+
const normalizedHue = computed(() => normalizeHue(hue()));
|
|
278
|
+
function setSaturationElement(value) {
|
|
279
|
+
saturationRef.value = toHTMLElement(value);
|
|
280
|
+
}
|
|
281
|
+
function setSaturationInput(value) {
|
|
282
|
+
saturationInputRef.value = toHTMLElement(value);
|
|
283
|
+
}
|
|
284
|
+
function commitSelection(nextSaturation, nextValue) {
|
|
285
|
+
if (readonly()) return;
|
|
286
|
+
const nextSelection = {
|
|
287
|
+
saturation: roundPercent(clampPercent(nextSaturation)),
|
|
288
|
+
value: roundPercent(clampPercent(nextValue))
|
|
289
|
+
};
|
|
290
|
+
if (nextSelection.saturation === selection.value.saturation && nextSelection.value === selection.value.value) return;
|
|
291
|
+
onChange(nextSelection);
|
|
292
|
+
}
|
|
293
|
+
function updateAxis(axis, nextValue) {
|
|
294
|
+
if (axis === "saturation") {
|
|
295
|
+
commitSelection(nextValue, selection.value.value);
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
commitSelection(selection.value.saturation, nextValue);
|
|
299
|
+
}
|
|
300
|
+
function onAxisKeydown(event, axis) {
|
|
301
|
+
const currentValue = axis === "saturation" ? selection.value.saturation : selection.value.value;
|
|
302
|
+
const nextValue = getColorPickerKeyboardValue(event.key, currentValue, 100, event.shiftKey ? 10 : void 0);
|
|
303
|
+
if (nextValue === void 0) return;
|
|
304
|
+
event.preventDefault();
|
|
305
|
+
if (!readonly()) updateAxis(axis, nextValue);
|
|
306
|
+
}
|
|
307
|
+
function onAxisInput(event, axis) {
|
|
308
|
+
const input = event.currentTarget;
|
|
309
|
+
if (!(input instanceof HTMLInputElement)) return;
|
|
310
|
+
if (readonly()) {
|
|
311
|
+
input.value = String(axis === "saturation" ? selection.value.saturation : selection.value.value);
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
updateAxis(axis, Number(input.value));
|
|
315
|
+
}
|
|
316
|
+
function updateFromTwoDimensionalPointer(pointer, rect) {
|
|
317
|
+
if (rect.width <= 0 || rect.height <= 0) return;
|
|
318
|
+
commitSelection((pointer.clientX - rect.left) / rect.width * 100, 100 - (pointer.clientY - rect.top) / rect.height * 100);
|
|
319
|
+
}
|
|
320
|
+
const { onPointerDown } = useColorPickerDrag({
|
|
321
|
+
target: saturationRef,
|
|
322
|
+
focusTarget: saturationInputRef,
|
|
323
|
+
readonly,
|
|
324
|
+
isGeometryValid: (rect) => rect.width > 0 && rect.height > 0,
|
|
325
|
+
updateFromPointer: updateFromTwoDimensionalPointer
|
|
326
|
+
});
|
|
327
|
+
return {
|
|
328
|
+
setSaturationElement,
|
|
329
|
+
setSaturationInput,
|
|
330
|
+
selection,
|
|
331
|
+
normalizedHue,
|
|
332
|
+
onPointerDown,
|
|
333
|
+
onAxisKeydown,
|
|
334
|
+
onAxisInput
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
//#endregion
|
|
263
338
|
//#region src/components/color-picker/color-picker-saturation.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
264
|
-
var t0$2 = template("<div data-v-
|
|
265
|
-
delegateEvents("input", "keydown", "pointerdown");
|
|
339
|
+
var t0$2 = template("<div data-v-9c7fa05b role=group data-control=saturation><input data-v-9c7fa05b class=\"rp-color-picker__axis-input rp-color-picker__axis-input--saturation\"type=range min=0 max=100 step=1 aria-label=Saturation aria-orientation=horizontal><input data-v-9c7fa05b class=\"rp-color-picker__axis-input rp-color-picker__axis-input--value\"type=range min=0 max=100 step=1 aria-label=Value aria-orientation=vertical><span data-v-9c7fa05b class=rp-color-picker__surface aria-hidden=true></span><span data-v-9c7fa05b data-control=saturation aria-hidden=true>", 1);
|
|
266
340
|
//#endregion
|
|
267
341
|
//#region src/components/color-picker/color-picker-saturation.vue
|
|
268
342
|
var color_picker_saturation_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
|
|
@@ -312,125 +386,115 @@ var color_picker_saturation_default = /*#__PURE__*/ _plugin_vue_export_helper_de
|
|
|
312
386
|
setup(__props, { emit: __emit }) {
|
|
313
387
|
const props = __props;
|
|
314
388
|
const emit = __emit;
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
389
|
+
const { setSaturationElement, setSaturationInput, selection, normalizedHue, onPointerDown, onAxisKeydown, onAxisInput } = useColorPickerSaturation({
|
|
390
|
+
modelValue: () => props.modelValue,
|
|
391
|
+
hue: () => props.hue,
|
|
392
|
+
readonly: () => props.readonly,
|
|
393
|
+
onChange: (nextSelection) => emit("update:modelValue", nextSelection)
|
|
394
|
+
});
|
|
320
395
|
const saturationStyle = computed(() => ({
|
|
321
|
-
"--_rp-color-picker-hue": String(normalizeHueForColor(
|
|
322
|
-
"--_rp-color-picker-saturation-x": `${
|
|
323
|
-
"--_rp-color-picker-saturation-y": `${100 - value.value}%`,
|
|
324
|
-
"--_rp-color-picker-current": getHsvCssColor(
|
|
396
|
+
"--_rp-color-picker-hue": String(normalizeHueForColor(normalizedHue.value)),
|
|
397
|
+
"--_rp-color-picker-saturation-x": `${selection.value.saturation}%`,
|
|
398
|
+
"--_rp-color-picker-saturation-y": `${100 - selection.value.value}%`,
|
|
399
|
+
"--_rp-color-picker-current": getHsvCssColor(normalizedHue.value, selection.value.saturation, selection.value.value)
|
|
325
400
|
}));
|
|
326
|
-
const ariaValueText = computed(() => `${Math.round(
|
|
401
|
+
const ariaValueText = computed(() => `${Math.round(selection.value.saturation)}% saturation, ${Math.round(selection.value.value)}% value`);
|
|
327
402
|
const groupAriaLabel = computed(() => props.labelledby ? void 0 : props.ariaLabel || "Color area");
|
|
328
|
-
function updateValue(nextSaturation, nextValue) {
|
|
329
|
-
if (props.readonly) return;
|
|
330
|
-
const normalizedSaturation = roundPercent(clampPercent(nextSaturation));
|
|
331
|
-
const normalizedValue = roundPercent(clampPercent(nextValue));
|
|
332
|
-
if (normalizedSaturation === saturation.value && normalizedValue === value.value) return;
|
|
333
|
-
emit("update:modelValue", {
|
|
334
|
-
saturation: normalizedSaturation,
|
|
335
|
-
value: normalizedValue
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
function updateFromPointer(e, rect) {
|
|
339
|
-
if (rect.width <= 0 || rect.height <= 0) return;
|
|
340
|
-
updateValue((e.clientX - rect.left) / rect.width * 100, 100 - (e.clientY - rect.top) / rect.height * 100);
|
|
341
|
-
}
|
|
342
|
-
const { onPointerDown } = useColorPickerDrag({
|
|
343
|
-
target: saturationRef,
|
|
344
|
-
focusTarget: saturationInputRef,
|
|
345
|
-
readonly: () => props.readonly,
|
|
346
|
-
isGeometryValid: (rect) => rect.width > 0 && rect.height > 0,
|
|
347
|
-
updateFromPointer
|
|
348
|
-
});
|
|
349
|
-
function onAxisKeydown(event, axis) {
|
|
350
|
-
const currentValue = axis === "saturation" ? saturation.value : value.value;
|
|
351
|
-
const step = event.shiftKey ? 10 : 1;
|
|
352
|
-
let nextValue;
|
|
353
|
-
switch (event.key) {
|
|
354
|
-
case "ArrowRight":
|
|
355
|
-
case "ArrowUp":
|
|
356
|
-
nextValue = currentValue + step;
|
|
357
|
-
break;
|
|
358
|
-
case "ArrowLeft":
|
|
359
|
-
case "ArrowDown":
|
|
360
|
-
nextValue = currentValue - step;
|
|
361
|
-
break;
|
|
362
|
-
case "Home":
|
|
363
|
-
nextValue = 0;
|
|
364
|
-
break;
|
|
365
|
-
case "End":
|
|
366
|
-
nextValue = 100;
|
|
367
|
-
break;
|
|
368
|
-
}
|
|
369
|
-
if (nextValue === void 0) return;
|
|
370
|
-
event.preventDefault();
|
|
371
|
-
if (!props.readonly) updateAxis(axis, nextValue);
|
|
372
|
-
}
|
|
373
|
-
function onAxisInput(event, axis) {
|
|
374
|
-
const input = event.currentTarget;
|
|
375
|
-
if (!(input instanceof HTMLInputElement)) return;
|
|
376
|
-
if (props.readonly) {
|
|
377
|
-
input.value = String(axis === "saturation" ? saturation.value : value.value);
|
|
378
|
-
return;
|
|
379
|
-
}
|
|
380
|
-
updateAxis(axis, Number(input.value));
|
|
381
|
-
}
|
|
382
|
-
function updateAxis(axis, nextValue) {
|
|
383
|
-
if (axis === "saturation") updateValue(nextValue, value.value);
|
|
384
|
-
else updateValue(saturation.value, nextValue);
|
|
385
|
-
}
|
|
386
403
|
const _setTemplateRef = createTemplateRefSetter();
|
|
387
404
|
const n3 = t0$2();
|
|
388
405
|
const n0 = child(n3);
|
|
389
406
|
const n1 = next(n0, 1);
|
|
390
407
|
const n2 = nthChild(n3, 3);
|
|
391
|
-
n0
|
|
392
|
-
n0
|
|
393
|
-
|
|
394
|
-
n1
|
|
395
|
-
|
|
396
|
-
n3.$evtpointerdown = createInvoker((e) => unref(onPointerDown)(e));
|
|
397
|
-
_setTemplateRef(n3, saturationRef, null, "saturationRef");
|
|
408
|
+
on(n0, "input", ($event) => unref(onAxisInput)($event, "saturation"));
|
|
409
|
+
on(n0, "keydown", ($event) => unref(onAxisKeydown)($event, "saturation"));
|
|
410
|
+
on(n1, "input", ($event) => unref(onAxisInput)($event, "value"));
|
|
411
|
+
on(n1, "keydown", ($event) => unref(onAxisKeydown)($event, "value"));
|
|
412
|
+
on(n3, "pointerdown", (e) => unref(onPointerDown)(e));
|
|
398
413
|
renderEffect(() => {
|
|
399
414
|
const _describedby = __props.describedby;
|
|
400
415
|
const _readonly = __props.readonly;
|
|
401
416
|
const _id = __props.id;
|
|
402
|
-
const
|
|
417
|
+
const _selection = unref(selection);
|
|
403
418
|
const _ariaValueText = ariaValueText.value;
|
|
404
|
-
const _value = value.value;
|
|
405
419
|
setClass(n3, ["rp-color-picker__saturation", __props.controlClass]);
|
|
406
420
|
setStyle(n3, [saturationStyle.value, __props.controlStyle]);
|
|
407
421
|
setAttr(n3, "aria-label", groupAriaLabel.value);
|
|
408
422
|
setAttr(n3, "aria-labelledby", __props.labelledby);
|
|
409
423
|
setAttr(n3, "aria-describedby", _describedby);
|
|
410
|
-
setAttr(n3, "
|
|
411
|
-
setAttr(n3, "data-readonly", unref(presence)(_readonly));
|
|
424
|
+
setAttr(n3, "data-readonly", unref(toPresenceAttribute)(_readonly));
|
|
412
425
|
setProp(n0, "id", _id);
|
|
413
|
-
setValue(n0,
|
|
414
|
-
setAttr(n0, "aria-valuenow", Math.round(
|
|
426
|
+
setValue(n0, _selection.saturation);
|
|
427
|
+
setAttr(n0, "aria-valuenow", Math.round(_selection.saturation));
|
|
415
428
|
setAttr(n0, "aria-valuetext", _ariaValueText);
|
|
416
429
|
setAttr(n0, "aria-describedby", _describedby);
|
|
417
430
|
setAttr(n0, "aria-readonly", _readonly || void 0);
|
|
431
|
+
_setTemplateRef(n0, setSaturationInput, null, "setSaturationInput");
|
|
418
432
|
setProp(n1, "id", _id ? `${_id}-value` : void 0);
|
|
419
|
-
setValue(n1,
|
|
420
|
-
setAttr(n1, "aria-valuenow", Math.round(
|
|
433
|
+
setValue(n1, _selection.value);
|
|
434
|
+
setAttr(n1, "aria-valuenow", Math.round(_selection.value));
|
|
421
435
|
setAttr(n1, "aria-valuetext", _ariaValueText);
|
|
422
436
|
setAttr(n1, "aria-describedby", _describedby);
|
|
423
437
|
setAttr(n1, "aria-readonly", _readonly || void 0);
|
|
424
438
|
setClass(n2, ["rp-color-picker__handle", __props.handleClass]);
|
|
425
439
|
setStyle(n2, __props.handleStyle);
|
|
440
|
+
_setTemplateRef(n3, setSaturationElement, null, "setSaturationElement");
|
|
426
441
|
});
|
|
427
442
|
return n3;
|
|
428
443
|
}
|
|
429
|
-
}), [["__scopeId", "data-v-
|
|
444
|
+
}), [["__scopeId", "data-v-9c7fa05b"]]);
|
|
445
|
+
//#endregion
|
|
446
|
+
//#region src/components/color-picker/useColorPickerSlider.ts
|
|
447
|
+
function useColorPickerSlider({ variant, value, readonly, onChange }) {
|
|
448
|
+
const sliderRef = ref(null);
|
|
449
|
+
const sliderState = computed(() => {
|
|
450
|
+
const isHue = variant() === "hue";
|
|
451
|
+
const normalizedValue = isHue ? normalizeHue(value()) : clampOpacity(value());
|
|
452
|
+
return {
|
|
453
|
+
isHue,
|
|
454
|
+
max: isHue ? 359 : 100,
|
|
455
|
+
value: normalizedValue,
|
|
456
|
+
outputValue: normalizeOutputValue(normalizedValue, isHue)
|
|
457
|
+
};
|
|
458
|
+
});
|
|
459
|
+
function setSliderElement(element) {
|
|
460
|
+
sliderRef.value = toHTMLElement(element);
|
|
461
|
+
}
|
|
462
|
+
function commitValue(nextValue) {
|
|
463
|
+
if (readonly()) return;
|
|
464
|
+
const normalizedNextValue = normalizeOutputValue(nextValue, sliderState.value.isHue);
|
|
465
|
+
if (normalizedNextValue === sliderState.value.outputValue) return;
|
|
466
|
+
onChange(normalizedNextValue);
|
|
467
|
+
}
|
|
468
|
+
function updateFromHorizontalPointer(pointer, rect) {
|
|
469
|
+
if (rect.width <= 0) return;
|
|
470
|
+
commitValue((pointer.clientX - rect.left) / rect.width * sliderState.value.max);
|
|
471
|
+
}
|
|
472
|
+
const { onPointerDown } = useColorPickerDrag({
|
|
473
|
+
target: sliderRef,
|
|
474
|
+
readonly,
|
|
475
|
+
isGeometryValid: (rect) => rect.width > 0,
|
|
476
|
+
updateFromPointer: updateFromHorizontalPointer
|
|
477
|
+
});
|
|
478
|
+
function onKeydown(event) {
|
|
479
|
+
if (readonly()) return;
|
|
480
|
+
const nextValue = getColorPickerKeyboardValue(event.key, sliderState.value.value, sliderState.value.max, event.shiftKey ? 10 : void 0);
|
|
481
|
+
if (nextValue === void 0) return;
|
|
482
|
+
event.preventDefault();
|
|
483
|
+
commitValue(nextValue);
|
|
484
|
+
}
|
|
485
|
+
return {
|
|
486
|
+
setSliderElement,
|
|
487
|
+
sliderState,
|
|
488
|
+
onPointerDown,
|
|
489
|
+
onKeydown
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
function normalizeOutputValue(nextValue, isHue) {
|
|
493
|
+
return isHue ? Math.round(clampHue(nextValue)) : roundPercent(clampOpacity(nextValue));
|
|
494
|
+
}
|
|
430
495
|
//#endregion
|
|
431
496
|
//#region src/components/color-picker/color-picker-slider.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
432
|
-
var t0$1 = template("<div data-v-
|
|
433
|
-
delegateEvents("pointerdown", "keydown");
|
|
497
|
+
var t0$1 = template("<div data-v-3a0ac9e0 role=slider tabindex=0 aria-orientation=horizontal aria-valuemin=0><span data-v-3a0ac9e0 aria-hidden=true></span><span data-v-3a0ac9e0 aria-hidden=true>", 1);
|
|
434
498
|
//#endregion
|
|
435
499
|
//#region src/components/color-picker/color-picker-slider.vue
|
|
436
500
|
var color_picker_slider_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
|
|
@@ -477,92 +541,51 @@ var color_picker_slider_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
|
|
|
477
541
|
setup(__props, { emit: __emit }) {
|
|
478
542
|
const props = __props;
|
|
479
543
|
const emit = __emit;
|
|
480
|
-
const
|
|
481
|
-
|
|
482
|
-
|
|
544
|
+
const { setSliderElement, sliderState, onPointerDown, onKeydown } = useColorPickerSlider({
|
|
545
|
+
variant: () => props.variant,
|
|
546
|
+
value: () => props.value,
|
|
547
|
+
readonly: () => props.readonly,
|
|
548
|
+
onChange: (value) => emit("update:value", value)
|
|
549
|
+
});
|
|
483
550
|
const rootClass = computed(() => `rp-color-picker__${props.variant}`);
|
|
484
551
|
const surfaceClass = computed(() => ["rp-color-picker__slider-surface", `rp-color-picker__${props.variant}-surface`]);
|
|
485
552
|
const internalHandleClass = computed(() => ["rp-color-picker__slider-handle", `rp-color-picker__${props.variant}-handle`]);
|
|
486
|
-
const normalizedValue = computed(() => isHue.value ? normalizeHue(props.value) : clampOpacity(props.value));
|
|
487
|
-
const currentOutputValue = computed(() => normalizeOutputValue(normalizedValue.value));
|
|
488
553
|
const sliderStyle = computed(() => {
|
|
489
|
-
const style = { "--_rp-color-picker-slider-x": `${
|
|
490
|
-
if (
|
|
554
|
+
const style = { "--_rp-color-picker-slider-x": `${sliderState.value.outputValue / sliderState.value.max * 100}%` };
|
|
555
|
+
if (sliderState.value.isHue) style["--_rp-color-picker-hue"] = String(normalizeHueForColor(sliderState.value.outputValue));
|
|
491
556
|
else style["--_rp-color-picker-opacity-color"] = props.color;
|
|
492
557
|
return style;
|
|
493
558
|
});
|
|
494
|
-
const ariaLabel = computed(() =>
|
|
495
|
-
const ariaValueText = computed(() =>
|
|
496
|
-
function updateValue(nextValue) {
|
|
497
|
-
if (props.readonly) return;
|
|
498
|
-
const normalizedNextValue = normalizeOutputValue(nextValue);
|
|
499
|
-
if (normalizedNextValue === currentOutputValue.value) return;
|
|
500
|
-
emit("update:value", normalizedNextValue);
|
|
501
|
-
}
|
|
502
|
-
function updateFromPointer(e, rect) {
|
|
503
|
-
if (rect.width <= 0) return;
|
|
504
|
-
updateValue((e.clientX - rect.left) / rect.width * max.value);
|
|
505
|
-
}
|
|
506
|
-
const { onPointerDown } = useColorPickerDrag({
|
|
507
|
-
target: sliderRef,
|
|
508
|
-
readonly: () => props.readonly,
|
|
509
|
-
isGeometryValid: (rect) => rect.width > 0,
|
|
510
|
-
updateFromPointer
|
|
511
|
-
});
|
|
512
|
-
function onKeydown(e) {
|
|
513
|
-
if (props.readonly) return;
|
|
514
|
-
const step = e.shiftKey ? 10 : 1;
|
|
515
|
-
switch (e.key) {
|
|
516
|
-
case "ArrowRight":
|
|
517
|
-
case "ArrowUp":
|
|
518
|
-
e.preventDefault();
|
|
519
|
-
updateValue(normalizedValue.value + step);
|
|
520
|
-
break;
|
|
521
|
-
case "ArrowLeft":
|
|
522
|
-
case "ArrowDown":
|
|
523
|
-
e.preventDefault();
|
|
524
|
-
updateValue(normalizedValue.value - step);
|
|
525
|
-
break;
|
|
526
|
-
case "Home":
|
|
527
|
-
e.preventDefault();
|
|
528
|
-
updateValue(0);
|
|
529
|
-
break;
|
|
530
|
-
case "End":
|
|
531
|
-
e.preventDefault();
|
|
532
|
-
updateValue(max.value);
|
|
533
|
-
break;
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
function normalizeOutputValue(value) {
|
|
537
|
-
return isHue.value ? Math.round(clampHue(value)) : roundPercent(clampOpacity(value));
|
|
538
|
-
}
|
|
559
|
+
const ariaLabel = computed(() => sliderState.value.isHue ? "Hue" : "Opacity");
|
|
560
|
+
const ariaValueText = computed(() => sliderState.value.isHue ? `${Math.round(sliderState.value.value)} degrees hue` : `${Math.round(sliderState.value.value)}% opacity`);
|
|
539
561
|
const _setTemplateRef = createTemplateRefSetter();
|
|
540
562
|
const n2 = t0$1();
|
|
541
563
|
const n0 = child(n2);
|
|
542
564
|
const n1 = next(n0, 1);
|
|
543
|
-
n2
|
|
544
|
-
n2
|
|
545
|
-
_setTemplateRef(n2, sliderRef, null, "sliderRef");
|
|
565
|
+
on(n2, "pointerdown", (e) => unref(onPointerDown)(e));
|
|
566
|
+
on(n2, "keydown", (e) => unref(onKeydown)(e));
|
|
546
567
|
renderEffect(() => {
|
|
568
|
+
const _sliderState = unref(sliderState);
|
|
547
569
|
const _readonly = __props.readonly;
|
|
548
570
|
const _variant = __props.variant;
|
|
549
571
|
setClass(n2, [rootClass.value, __props.controlClass]);
|
|
550
572
|
setStyle(n2, [sliderStyle.value, __props.controlStyle]);
|
|
551
573
|
setAttr(n2, "aria-label", ariaLabel.value);
|
|
552
|
-
setAttr(n2, "aria-valuemax", max
|
|
553
|
-
setAttr(n2, "aria-valuenow", Math.round(
|
|
574
|
+
setAttr(n2, "aria-valuemax", _sliderState.max);
|
|
575
|
+
setAttr(n2, "aria-valuenow", Math.round(_sliderState.value));
|
|
554
576
|
setAttr(n2, "aria-valuetext", ariaValueText.value);
|
|
555
577
|
setAttr(n2, "aria-readonly", _readonly || void 0);
|
|
556
|
-
setAttr(n2, "data-readonly", unref(
|
|
578
|
+
setAttr(n2, "data-readonly", unref(toPresenceAttribute)(_readonly));
|
|
557
579
|
setAttr(n2, "data-control", _variant);
|
|
558
580
|
setClass(n0, surfaceClass.value);
|
|
559
581
|
setClass(n1, [internalHandleClass.value, __props.handleClass]);
|
|
560
582
|
setStyle(n1, __props.handleStyle);
|
|
561
583
|
setAttr(n1, "data-control", _variant);
|
|
584
|
+
_setTemplateRef(n2, setSliderElement, null, "setSliderElement");
|
|
562
585
|
});
|
|
563
586
|
return n2;
|
|
564
587
|
}
|
|
565
|
-
}), [["__scopeId", "data-v-
|
|
588
|
+
}), [["__scopeId", "data-v-3a0ac9e0"]]);
|
|
566
589
|
//#endregion
|
|
567
590
|
//#region src/components/color-picker/useColorPickerSwatches.ts
|
|
568
591
|
var MAX_SWATCHES_PER_ROW = 15;
|
|
@@ -596,9 +619,7 @@ function useColorPickerSwatches(props, options) {
|
|
|
596
619
|
focusedSwatchIndex.value = index;
|
|
597
620
|
}
|
|
598
621
|
function onSwatchesFocusout(event) {
|
|
599
|
-
|
|
600
|
-
const nextTarget = event.relatedTarget;
|
|
601
|
-
if (group instanceof HTMLElement && nextTarget instanceof Node && group.contains(nextTarget)) return;
|
|
622
|
+
if (isNodeWithinElement(event.relatedTarget, event.currentTarget)) return;
|
|
602
623
|
focusedSwatchIndex.value = null;
|
|
603
624
|
}
|
|
604
625
|
function onSwatchKeydown(event, index) {
|
|
@@ -721,11 +742,10 @@ function getComparableColor(color) {
|
|
|
721
742
|
}
|
|
722
743
|
//#endregion
|
|
723
744
|
//#region src/components/color-picker/color-picker.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
724
|
-
var t0 = template("<div data-v-
|
|
725
|
-
var t1 = template("<button data-v-
|
|
726
|
-
var t2 = template("<div data-v-
|
|
727
|
-
var t3 = template("<div data-v-
|
|
728
|
-
delegateEvents("click", "keydown", "focusout");
|
|
745
|
+
var t0 = template("<div data-v-7fe38e4e class=rp-color-picker__header><span data-v-7fe38e4e>");
|
|
746
|
+
var t1 = template("<button data-v-7fe38e4e>");
|
|
747
|
+
var t2 = template("<div data-v-7fe38e4e>");
|
|
748
|
+
var t3 = template("<div data-v-7fe38e4e>", 1);
|
|
729
749
|
//#endregion
|
|
730
750
|
//#region src/components/color-picker/color-picker.vue
|
|
731
751
|
var color_picker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
|
|
@@ -764,14 +784,14 @@ var color_picker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
|
|
|
764
784
|
const { getPartAttrs, getRootAttrs } = useStylesApi(props, "root");
|
|
765
785
|
const rootAttrs = computed(() => getRootAttrs({
|
|
766
786
|
class: rootClass.value,
|
|
767
|
-
"data-readonly":
|
|
787
|
+
"data-readonly": toPresenceAttribute(props.readonly)
|
|
768
788
|
}));
|
|
769
789
|
const { selectedColor, saturationValue, opacityColor, showAlphaControls, updateSelection, updateHue, updateOpacity, selectColor, isColorSelected } = useColorPickerValue(props, (value) => emit("update:modelValue", value));
|
|
770
790
|
const { swatchesRef, normalizedSwatchesPerRow, validSwatches, swatchesStyle, swatchSize, isSwatchSelected, getSwatchTabindex, selectSwatch, onSwatchFocus, onSwatchesFocusout, onSwatchKeydown } = useColorPickerSwatches(props, {
|
|
771
791
|
isSelected: isColorSelected,
|
|
772
792
|
select: selectColor
|
|
773
793
|
});
|
|
774
|
-
const
|
|
794
|
+
const templateRefs = { swatches: swatchesRef };
|
|
775
795
|
const n22 = t3();
|
|
776
796
|
renderEffect(() => setDynamicProps(n22, [rootAttrs.value]));
|
|
777
797
|
setInsertionState(n22, null, 0);
|
|
@@ -851,7 +871,7 @@ var color_picker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
|
|
|
851
871
|
const _index = _for_key0.value;
|
|
852
872
|
const _isSwatchSelected = unref(isSwatchSelected);
|
|
853
873
|
const _swatch = _for_item0.value;
|
|
854
|
-
const
|
|
874
|
+
const _toPresenceAttribute = unref(toPresenceAttribute);
|
|
855
875
|
setDynamicProps(n20, [unref(getPartAttrs)("swatch", { class: "rp-color-picker__swatch" }), {
|
|
856
876
|
type: "button",
|
|
857
877
|
role: "radio",
|
|
@@ -860,8 +880,8 @@ var color_picker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
|
|
|
860
880
|
"aria-checked": _isSwatchSelected(_index),
|
|
861
881
|
"aria-label": `Select color ${_swatch}`,
|
|
862
882
|
title: _swatch,
|
|
863
|
-
"data-selected":
|
|
864
|
-
"data-readonly":
|
|
883
|
+
"data-selected": _toPresenceAttribute(_isSwatchSelected(_index)),
|
|
884
|
+
"data-readonly": _toPresenceAttribute(_readonly)
|
|
865
885
|
}]);
|
|
866
886
|
});
|
|
867
887
|
setInsertionState(n20, null, 0);
|
|
@@ -874,17 +894,17 @@ var color_picker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
|
|
|
874
894
|
return createComponent(unref(check_default), { class: "rp-color-picker__swatch-check" });
|
|
875
895
|
}, null, 129);
|
|
876
896
|
}, { _: 8 }));
|
|
877
|
-
n20
|
|
897
|
+
on(n20, "click", () => unref(selectSwatch)(_for_item0.value));
|
|
878
898
|
on(n20, "focus", () => unref(onSwatchFocus)(_for_key0.value));
|
|
879
|
-
n20
|
|
899
|
+
on(n20, "keydown", ($event) => unref(onSwatchKeydown)($event, _for_key0.value));
|
|
880
900
|
return n20;
|
|
881
901
|
}, (swatch, index) => `${swatch}-${index}`, 9);
|
|
882
|
-
n21
|
|
883
|
-
|
|
902
|
+
on(n21, "focusout", (e) => unref(onSwatchesFocusout)(e));
|
|
903
|
+
setTemplateRefBinding(n21, () => templateRefs.swatches);
|
|
884
904
|
return n21;
|
|
885
905
|
});
|
|
886
906
|
return n22;
|
|
887
907
|
}
|
|
888
|
-
}), [["__scopeId", "data-v-
|
|
908
|
+
}), [["__scopeId", "data-v-7fe38e4e"]]);
|
|
889
909
|
//#endregion
|
|
890
|
-
export {
|
|
910
|
+
export { parseColorPickerValue as i, colorPickerFormats as n, formatColorPickerValue as r, color_picker_default as t };
|
package/dist/color-picker2.js
CHANGED
|
@@ -7,14 +7,6 @@ var colorPickerParts = [
|
|
|
7
7
|
"swatches",
|
|
8
8
|
"swatch"
|
|
9
9
|
];
|
|
10
|
-
var colorPickerFormats = [
|
|
11
|
-
"hex",
|
|
12
|
-
"hexa",
|
|
13
|
-
"rgb",
|
|
14
|
-
"rgba",
|
|
15
|
-
"hsl",
|
|
16
|
-
"hsla"
|
|
17
|
-
];
|
|
18
10
|
var colorPickerSizes = [
|
|
19
11
|
"xs",
|
|
20
12
|
"sm",
|
|
@@ -23,4 +15,4 @@ var colorPickerSizes = [
|
|
|
23
15
|
"xl"
|
|
24
16
|
];
|
|
25
17
|
//#endregion
|
|
26
|
-
export {
|
|
18
|
+
export { colorPickerSizes as n, colorPickerParts as t };
|
package/dist/color-swatch.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
@layer ropav.components {
|
|
2
|
-
.rp-color-swatch[data-v-
|
|
2
|
+
.rp-color-swatch[data-v-63bed4a0] {
|
|
3
3
|
--_rp-color-swatch-size: 24px;
|
|
4
4
|
--_rp-color-swatch-radius: var(--rp-radius-sm);
|
|
5
5
|
--_rp-color-swatch-checkerboard-tile: var(--rp-color-gray-3);
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
overflow: hidden;
|
|
32
32
|
vertical-align: middle;
|
|
33
33
|
}
|
|
34
|
-
html.dark .rp-color-swatch[data-v-
|
|
34
|
+
html.dark .rp-color-swatch[data-v-63bed4a0], [data-rp-color-scheme=dark] .rp-color-swatch[data-v-63bed4a0] {
|
|
35
35
|
--_rp-color-swatch-checkerboard-tile: var(--rp-color-dark-6);
|
|
36
36
|
--_rp-color-swatch-checkerboard-tile-alt: var(--rp-color-dark-4);
|
|
37
37
|
}
|
|
38
|
-
.rp-color-swatch__icon[data-v-
|
|
38
|
+
.rp-color-swatch__icon[data-v-63bed4a0] {
|
|
39
39
|
display: inline-flex;
|
|
40
40
|
align-items: center;
|
|
41
41
|
justify-content: center;
|
|
@@ -44,7 +44,7 @@ html.dark .rp-color-swatch[data-v-13032098], [data-rp-color-scheme=dark] .rp-col
|
|
|
44
44
|
color: inherit;
|
|
45
45
|
pointer-events: none;
|
|
46
46
|
}
|
|
47
|
-
.rp-color-swatch__icon[data-v-
|
|
47
|
+
.rp-color-swatch__icon[data-v-63bed4a0] svg {
|
|
48
48
|
display: block;
|
|
49
49
|
width: 100%;
|
|
50
50
|
height: 100%;
|