ropav 0.1.6 → 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 +6 -0
- package/dist/accordion.css +17 -17
- package/dist/accordion.js +123 -155
- package/dist/alert.css +18 -18
- package/dist/alert.js +10 -11
- 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 +9 -17
- package/dist/badge.css +16 -16
- package/dist/badge.js +5 -5
- package/dist/button-group.js +1 -1
- package/dist/button-link.js +4 -3
- package/dist/button.js +4 -3
- package/dist/button.scss_vue_type_style_index_0_src_true_lang.js +1 -1
- package/dist/card.js +1 -1
- package/dist/checkbox.css +32 -32
- package/dist/checkbox.js +22 -28
- package/dist/collapse.css +6 -6
- package/dist/collapse.js +7 -6
- package/dist/collectionNavigation.js +2 -99
- package/dist/color-input.css +19 -19
- package/dist/color-input.js +14 -13
- package/dist/color-picker.css +40 -40
- package/dist/color-picker.js +221 -200
- package/dist/color-picker2.js +1 -9
- package/dist/color-swatch.css +4 -4
- package/dist/color-swatch.js +6 -8
- package/dist/color.js +5 -10
- package/dist/componentColors.js +125 -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 +1 -2
- 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} +1 -5
- 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-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-trigger.d.ts +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-sub.d.ts +1 -1
- package/dist/components/dropdown-menu/{dropdown-menu-primitive-core.d.ts → dropdownMenuContext.d.ts} +16 -18
- 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/number-input/numberInputModel.d.ts +15 -0
- package/dist/components/number-input/useNumberInput.d.ts +3 -17
- 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 +0 -6
- package/dist/components/radio/useRadio.d.ts +1 -2
- 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/useScrollArea.d.ts +70 -53
- package/dist/components/scroll-area/{useScrollAreaPresentation.d.ts → useScrollAreaAttributes.d.ts} +37 -17
- 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/slider/rangeSliderModel.d.ts +41 -0
- package/dist/components/slider/{sliderCore.d.ts → sliderModel.d.ts} +0 -1
- package/dist/components/slider/useRangeSlider.d.ts +8 -16
- package/dist/components/slider/useRangeSliderValueState.d.ts +40 -0
- package/dist/components/slider/useSlider.d.ts +7 -13
- 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/teleport-provider/index.js +1 -1
- package/dist/components/teleport-provider/useTeleportTarget.d.ts +1 -2
- package/dist/components/toast/useToastLifecycle.d.ts +19 -0
- package/dist/components/tooltip/useTooltip.d.ts +1 -2
- package/dist/css.js +12 -0
- package/dist/dialog.js +226 -218
- package/dist/dropdown-menu.js +1458 -1097
- package/dist/events.js +59 -0
- package/dist/field.css +8 -8
- package/dist/field.js +13 -25
- package/dist/floating.js +548 -319
- package/dist/floatingOffset.js +11 -0
- package/dist/focus-trap.js +7 -5
- package/dist/focusNavigation.js +37 -0
- package/dist/icon-button.css +8 -8
- package/dist/icon-button.js +7 -6
- package/dist/index.js +6 -6
- package/dist/input.css +24 -24
- package/dist/input.js +19 -31
- package/dist/interactive.js +18 -0
- package/dist/modal.js +1 -1
- package/dist/number-input.css +18 -18
- package/dist/number-input.js +14 -12
- package/dist/number.js +22 -0
- package/dist/overlay.js +3 -2
- package/dist/pagination.css +28 -28
- package/dist/pagination.js +65 -63
- package/dist/pointer.js +9 -0
- package/dist/popover.css +34 -34
- package/dist/popover.js +85 -86
- package/dist/progress.js +10 -13
- package/dist/query.js +40 -0
- package/dist/radio.css +18 -18
- package/dist/radio.js +30 -36
- package/dist/rafScheduler.js +34 -0
- package/dist/scroll-area.css +28 -28
- package/dist/scroll-area.js +512 -516
- package/dist/select.css +45 -45
- package/dist/select.js +36 -44
- package/dist/slider.css +191 -191
- package/dist/slider.js +691 -618
- 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 +14 -15
- package/dist/tabs.css +43 -43
- package/dist/tabs.js +29 -56
- package/dist/text.js +17 -0
- package/dist/textarea.css +26 -26
- package/dist/textarea.js +21 -32
- package/dist/toast.css +26 -26
- package/dist/toast.js +141 -118
- package/dist/tooltip.css +12 -12
- package/dist/tooltip.js +36 -40
- package/dist/useCollapse.js +8 -11
- package/dist/useControlState.js +3 -6
- package/dist/useFloatingPosition.js +140 -10
- package/dist/useOverlayZIndex.js +1 -5
- 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-floating-api.md +6 -5
- package/package.json +13 -12
- 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 -36
- 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 -30
- package/dist/components/scroll-area/useScrollAreaControls.d.ts +0 -25
- package/dist/components/scroll-area/useScrollAreaMetrics.d.ts +0 -38
- /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/color-picker.js
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
import './color-picker.css';
|
|
2
|
-
import {
|
|
2
|
+
import { t as useStylesApi } from "./styles-api.js";
|
|
3
|
+
import { n as toPresenceAttribute } from "./attributes.js";
|
|
3
4
|
import { t as bem } from "./bem.js";
|
|
4
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";
|
|
5
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,124 +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, "data-readonly", unref(
|
|
424
|
+
setAttr(n3, "data-readonly", unref(toPresenceAttribute)(_readonly));
|
|
411
425
|
setProp(n0, "id", _id);
|
|
412
|
-
setValue(n0,
|
|
413
|
-
setAttr(n0, "aria-valuenow", Math.round(
|
|
426
|
+
setValue(n0, _selection.saturation);
|
|
427
|
+
setAttr(n0, "aria-valuenow", Math.round(_selection.saturation));
|
|
414
428
|
setAttr(n0, "aria-valuetext", _ariaValueText);
|
|
415
429
|
setAttr(n0, "aria-describedby", _describedby);
|
|
416
430
|
setAttr(n0, "aria-readonly", _readonly || void 0);
|
|
431
|
+
_setTemplateRef(n0, setSaturationInput, null, "setSaturationInput");
|
|
417
432
|
setProp(n1, "id", _id ? `${_id}-value` : void 0);
|
|
418
|
-
setValue(n1,
|
|
419
|
-
setAttr(n1, "aria-valuenow", Math.round(
|
|
433
|
+
setValue(n1, _selection.value);
|
|
434
|
+
setAttr(n1, "aria-valuenow", Math.round(_selection.value));
|
|
420
435
|
setAttr(n1, "aria-valuetext", _ariaValueText);
|
|
421
436
|
setAttr(n1, "aria-describedby", _describedby);
|
|
422
437
|
setAttr(n1, "aria-readonly", _readonly || void 0);
|
|
423
438
|
setClass(n2, ["rp-color-picker__handle", __props.handleClass]);
|
|
424
439
|
setStyle(n2, __props.handleStyle);
|
|
440
|
+
_setTemplateRef(n3, setSaturationElement, null, "setSaturationElement");
|
|
425
441
|
});
|
|
426
442
|
return n3;
|
|
427
443
|
}
|
|
428
|
-
}), [["__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
|
+
}
|
|
429
495
|
//#endregion
|
|
430
496
|
//#region src/components/color-picker/color-picker-slider.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
431
|
-
var t0$1 = template("<div data-v-
|
|
432
|
-
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);
|
|
433
498
|
//#endregion
|
|
434
499
|
//#region src/components/color-picker/color-picker-slider.vue
|
|
435
500
|
var color_picker_slider_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
|
|
@@ -476,92 +541,51 @@ var color_picker_slider_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
|
|
|
476
541
|
setup(__props, { emit: __emit }) {
|
|
477
542
|
const props = __props;
|
|
478
543
|
const emit = __emit;
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
|
|
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
|
+
});
|
|
482
550
|
const rootClass = computed(() => `rp-color-picker__${props.variant}`);
|
|
483
551
|
const surfaceClass = computed(() => ["rp-color-picker__slider-surface", `rp-color-picker__${props.variant}-surface`]);
|
|
484
552
|
const internalHandleClass = computed(() => ["rp-color-picker__slider-handle", `rp-color-picker__${props.variant}-handle`]);
|
|
485
|
-
const normalizedValue = computed(() => isHue.value ? normalizeHue(props.value) : clampOpacity(props.value));
|
|
486
|
-
const currentOutputValue = computed(() => normalizeOutputValue(normalizedValue.value));
|
|
487
553
|
const sliderStyle = computed(() => {
|
|
488
|
-
const style = { "--_rp-color-picker-slider-x": `${
|
|
489
|
-
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));
|
|
490
556
|
else style["--_rp-color-picker-opacity-color"] = props.color;
|
|
491
557
|
return style;
|
|
492
558
|
});
|
|
493
|
-
const ariaLabel = computed(() =>
|
|
494
|
-
const ariaValueText = computed(() =>
|
|
495
|
-
function updateValue(nextValue) {
|
|
496
|
-
if (props.readonly) return;
|
|
497
|
-
const normalizedNextValue = normalizeOutputValue(nextValue);
|
|
498
|
-
if (normalizedNextValue === currentOutputValue.value) return;
|
|
499
|
-
emit("update:value", normalizedNextValue);
|
|
500
|
-
}
|
|
501
|
-
function updateFromPointer(e, rect) {
|
|
502
|
-
if (rect.width <= 0) return;
|
|
503
|
-
updateValue((e.clientX - rect.left) / rect.width * max.value);
|
|
504
|
-
}
|
|
505
|
-
const { onPointerDown } = useColorPickerDrag({
|
|
506
|
-
target: sliderRef,
|
|
507
|
-
readonly: () => props.readonly,
|
|
508
|
-
isGeometryValid: (rect) => rect.width > 0,
|
|
509
|
-
updateFromPointer
|
|
510
|
-
});
|
|
511
|
-
function onKeydown(e) {
|
|
512
|
-
if (props.readonly) return;
|
|
513
|
-
const step = e.shiftKey ? 10 : 1;
|
|
514
|
-
switch (e.key) {
|
|
515
|
-
case "ArrowRight":
|
|
516
|
-
case "ArrowUp":
|
|
517
|
-
e.preventDefault();
|
|
518
|
-
updateValue(normalizedValue.value + step);
|
|
519
|
-
break;
|
|
520
|
-
case "ArrowLeft":
|
|
521
|
-
case "ArrowDown":
|
|
522
|
-
e.preventDefault();
|
|
523
|
-
updateValue(normalizedValue.value - step);
|
|
524
|
-
break;
|
|
525
|
-
case "Home":
|
|
526
|
-
e.preventDefault();
|
|
527
|
-
updateValue(0);
|
|
528
|
-
break;
|
|
529
|
-
case "End":
|
|
530
|
-
e.preventDefault();
|
|
531
|
-
updateValue(max.value);
|
|
532
|
-
break;
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
function normalizeOutputValue(value) {
|
|
536
|
-
return isHue.value ? Math.round(clampHue(value)) : roundPercent(clampOpacity(value));
|
|
537
|
-
}
|
|
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`);
|
|
538
561
|
const _setTemplateRef = createTemplateRefSetter();
|
|
539
562
|
const n2 = t0$1();
|
|
540
563
|
const n0 = child(n2);
|
|
541
564
|
const n1 = next(n0, 1);
|
|
542
|
-
n2
|
|
543
|
-
n2
|
|
544
|
-
_setTemplateRef(n2, sliderRef, null, "sliderRef");
|
|
565
|
+
on(n2, "pointerdown", (e) => unref(onPointerDown)(e));
|
|
566
|
+
on(n2, "keydown", (e) => unref(onKeydown)(e));
|
|
545
567
|
renderEffect(() => {
|
|
568
|
+
const _sliderState = unref(sliderState);
|
|
546
569
|
const _readonly = __props.readonly;
|
|
547
570
|
const _variant = __props.variant;
|
|
548
571
|
setClass(n2, [rootClass.value, __props.controlClass]);
|
|
549
572
|
setStyle(n2, [sliderStyle.value, __props.controlStyle]);
|
|
550
573
|
setAttr(n2, "aria-label", ariaLabel.value);
|
|
551
|
-
setAttr(n2, "aria-valuemax", max
|
|
552
|
-
setAttr(n2, "aria-valuenow", Math.round(
|
|
574
|
+
setAttr(n2, "aria-valuemax", _sliderState.max);
|
|
575
|
+
setAttr(n2, "aria-valuenow", Math.round(_sliderState.value));
|
|
553
576
|
setAttr(n2, "aria-valuetext", ariaValueText.value);
|
|
554
577
|
setAttr(n2, "aria-readonly", _readonly || void 0);
|
|
555
|
-
setAttr(n2, "data-readonly", unref(
|
|
578
|
+
setAttr(n2, "data-readonly", unref(toPresenceAttribute)(_readonly));
|
|
556
579
|
setAttr(n2, "data-control", _variant);
|
|
557
580
|
setClass(n0, surfaceClass.value);
|
|
558
581
|
setClass(n1, [internalHandleClass.value, __props.handleClass]);
|
|
559
582
|
setStyle(n1, __props.handleStyle);
|
|
560
583
|
setAttr(n1, "data-control", _variant);
|
|
584
|
+
_setTemplateRef(n2, setSliderElement, null, "setSliderElement");
|
|
561
585
|
});
|
|
562
586
|
return n2;
|
|
563
587
|
}
|
|
564
|
-
}), [["__scopeId", "data-v-
|
|
588
|
+
}), [["__scopeId", "data-v-3a0ac9e0"]]);
|
|
565
589
|
//#endregion
|
|
566
590
|
//#region src/components/color-picker/useColorPickerSwatches.ts
|
|
567
591
|
var MAX_SWATCHES_PER_ROW = 15;
|
|
@@ -595,9 +619,7 @@ function useColorPickerSwatches(props, options) {
|
|
|
595
619
|
focusedSwatchIndex.value = index;
|
|
596
620
|
}
|
|
597
621
|
function onSwatchesFocusout(event) {
|
|
598
|
-
|
|
599
|
-
const nextTarget = event.relatedTarget;
|
|
600
|
-
if (group instanceof HTMLElement && nextTarget instanceof Node && group.contains(nextTarget)) return;
|
|
622
|
+
if (isNodeWithinElement(event.relatedTarget, event.currentTarget)) return;
|
|
601
623
|
focusedSwatchIndex.value = null;
|
|
602
624
|
}
|
|
603
625
|
function onSwatchKeydown(event, index) {
|
|
@@ -720,11 +742,10 @@ function getComparableColor(color) {
|
|
|
720
742
|
}
|
|
721
743
|
//#endregion
|
|
722
744
|
//#region src/components/color-picker/color-picker.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
723
|
-
var t0 = template("<div data-v-
|
|
724
|
-
var t1 = template("<button data-v-
|
|
725
|
-
var t2 = template("<div data-v-
|
|
726
|
-
var t3 = template("<div data-v-
|
|
727
|
-
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);
|
|
728
749
|
//#endregion
|
|
729
750
|
//#region src/components/color-picker/color-picker.vue
|
|
730
751
|
var color_picker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
|
|
@@ -763,14 +784,14 @@ var color_picker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
|
|
|
763
784
|
const { getPartAttrs, getRootAttrs } = useStylesApi(props, "root");
|
|
764
785
|
const rootAttrs = computed(() => getRootAttrs({
|
|
765
786
|
class: rootClass.value,
|
|
766
|
-
"data-readonly":
|
|
787
|
+
"data-readonly": toPresenceAttribute(props.readonly)
|
|
767
788
|
}));
|
|
768
789
|
const { selectedColor, saturationValue, opacityColor, showAlphaControls, updateSelection, updateHue, updateOpacity, selectColor, isColorSelected } = useColorPickerValue(props, (value) => emit("update:modelValue", value));
|
|
769
790
|
const { swatchesRef, normalizedSwatchesPerRow, validSwatches, swatchesStyle, swatchSize, isSwatchSelected, getSwatchTabindex, selectSwatch, onSwatchFocus, onSwatchesFocusout, onSwatchKeydown } = useColorPickerSwatches(props, {
|
|
770
791
|
isSelected: isColorSelected,
|
|
771
792
|
select: selectColor
|
|
772
793
|
});
|
|
773
|
-
const
|
|
794
|
+
const templateRefs = { swatches: swatchesRef };
|
|
774
795
|
const n22 = t3();
|
|
775
796
|
renderEffect(() => setDynamicProps(n22, [rootAttrs.value]));
|
|
776
797
|
setInsertionState(n22, null, 0);
|
|
@@ -850,7 +871,7 @@ var color_picker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
|
|
|
850
871
|
const _index = _for_key0.value;
|
|
851
872
|
const _isSwatchSelected = unref(isSwatchSelected);
|
|
852
873
|
const _swatch = _for_item0.value;
|
|
853
|
-
const
|
|
874
|
+
const _toPresenceAttribute = unref(toPresenceAttribute);
|
|
854
875
|
setDynamicProps(n20, [unref(getPartAttrs)("swatch", { class: "rp-color-picker__swatch" }), {
|
|
855
876
|
type: "button",
|
|
856
877
|
role: "radio",
|
|
@@ -859,8 +880,8 @@ var color_picker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
|
|
|
859
880
|
"aria-checked": _isSwatchSelected(_index),
|
|
860
881
|
"aria-label": `Select color ${_swatch}`,
|
|
861
882
|
title: _swatch,
|
|
862
|
-
"data-selected":
|
|
863
|
-
"data-readonly":
|
|
883
|
+
"data-selected": _toPresenceAttribute(_isSwatchSelected(_index)),
|
|
884
|
+
"data-readonly": _toPresenceAttribute(_readonly)
|
|
864
885
|
}]);
|
|
865
886
|
});
|
|
866
887
|
setInsertionState(n20, null, 0);
|
|
@@ -873,17 +894,17 @@ var color_picker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
|
|
|
873
894
|
return createComponent(unref(check_default), { class: "rp-color-picker__swatch-check" });
|
|
874
895
|
}, null, 129);
|
|
875
896
|
}, { _: 8 }));
|
|
876
|
-
n20
|
|
897
|
+
on(n20, "click", () => unref(selectSwatch)(_for_item0.value));
|
|
877
898
|
on(n20, "focus", () => unref(onSwatchFocus)(_for_key0.value));
|
|
878
|
-
n20
|
|
899
|
+
on(n20, "keydown", ($event) => unref(onSwatchKeydown)($event, _for_key0.value));
|
|
879
900
|
return n20;
|
|
880
901
|
}, (swatch, index) => `${swatch}-${index}`, 9);
|
|
881
|
-
n21
|
|
882
|
-
|
|
902
|
+
on(n21, "focusout", (e) => unref(onSwatchesFocusout)(e));
|
|
903
|
+
setTemplateRefBinding(n21, () => templateRefs.swatches);
|
|
883
904
|
return n21;
|
|
884
905
|
});
|
|
885
906
|
return n22;
|
|
886
907
|
}
|
|
887
|
-
}), [["__scopeId", "data-v-
|
|
908
|
+
}), [["__scopeId", "data-v-7fe38e4e"]]);
|
|
888
909
|
//#endregion
|
|
889
|
-
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%;
|