@hueycolor/vue 0.0.1-beta.3
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/LICENSE.md +21 -0
- package/README.md +5 -0
- package/dist/App.vue.d.ts +2 -0
- package/dist/components/alpha-input.vue.d.ts +5 -0
- package/dist/components/alpha-slider.vue.d.ts +5 -0
- package/dist/components/blue-input.vue.d.ts +5 -0
- package/dist/components/color-dropper.vue.d.ts +16 -0
- package/dist/components/color-preview.vue.d.ts +9 -0
- package/dist/components/color-swatch.vue.d.ts +6 -0
- package/dist/components/green-input.vue.d.ts +5 -0
- package/dist/components/hex-input.vue.d.ts +5 -0
- package/dist/components/hue-input.vue.d.ts +5 -0
- package/dist/components/hue-slider.vue.d.ts +5 -0
- package/dist/components/huey-root.vue.d.ts +18 -0
- package/dist/components/index.d.ts +18 -0
- package/dist/components/internal/channel-input.vue.d.ts +5 -0
- package/dist/components/internal/channel-slider.vue.d.ts +22 -0
- package/dist/components/internal/color-thumb.vue.d.ts +6 -0
- package/dist/components/lightness-input.vue.d.ts +5 -0
- package/dist/components/lightness-slider.vue.d.ts +5 -0
- package/dist/components/red-input.vue.d.ts +5 -0
- package/dist/components/saturation-area.vue.d.ts +11 -0
- package/dist/components/saturation-input.vue.d.ts +5 -0
- package/dist/components/saturation-slider.vue.d.ts +5 -0
- package/dist/composables/use-huey-context.d.ts +12 -0
- package/dist/index.cjs +4 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +755 -0
- package/dist/main.d.ts +0 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/vite.svg +1 -0
- package/dist/vue.css +1 -0
- package/package.json +60 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Eihab Khan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Vue 3 + TypeScript + Vite
|
|
2
|
+
|
|
3
|
+
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
|
4
|
+
|
|
5
|
+
Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'vue';
|
|
2
|
+
export interface AlphaInputProps extends /* @vue-ignore */ InputHTMLAttributes {
|
|
3
|
+
}
|
|
4
|
+
declare const _default: import('vue').DefineComponent<AlphaInputProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<AlphaInputProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLInputElement>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ColorSliderProps } from './internal/channel-slider.vue';
|
|
2
|
+
export interface AlphaSliderProps extends /* @vue-ignore */ ColorSliderProps {
|
|
3
|
+
}
|
|
4
|
+
declare const _default: import('vue').DefineComponent<AlphaSliderProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<AlphaSliderProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'vue';
|
|
2
|
+
export interface RedInputProps extends /* @vue-ignore */ InputHTMLAttributes {
|
|
3
|
+
}
|
|
4
|
+
declare const _default: import('vue').DefineComponent<RedInputProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<RedInputProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLInputElement>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes } from 'vue';
|
|
2
|
+
interface ColorDropperProps extends /* @vue-ignore */ ButtonHTMLAttributes {
|
|
3
|
+
}
|
|
4
|
+
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<ColorDropperProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
5
|
+
error: (error: Error) => any;
|
|
6
|
+
}, string, import('vue').PublicProps, Readonly<ColorDropperProps> & Readonly<{
|
|
7
|
+
onError?: ((error: Error) => any) | undefined;
|
|
8
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
|
|
9
|
+
default?(_: {}): any;
|
|
10
|
+
}>;
|
|
11
|
+
export default _default;
|
|
12
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
13
|
+
new (): {
|
|
14
|
+
$slots: S;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'vue';
|
|
2
|
+
export interface ColorPreviewProps {
|
|
3
|
+
class?: HTMLAttributes['class'];
|
|
4
|
+
splitPreview?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: import('vue').DefineComponent<ColorPreviewProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ColorPreviewProps> & Readonly<{}>, {
|
|
7
|
+
splitPreview: boolean;
|
|
8
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AriaAttributes } from 'vue';
|
|
2
|
+
export interface ColorSwatchProps extends /* @vue-ignore */ AriaAttributes {
|
|
3
|
+
swatch: Array<string>;
|
|
4
|
+
}
|
|
5
|
+
declare const _default: import('vue').DefineComponent<ColorSwatchProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ColorSwatchProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'vue';
|
|
2
|
+
export interface RedInputProps extends /* @vue-ignore */ InputHTMLAttributes {
|
|
3
|
+
}
|
|
4
|
+
declare const _default: import('vue').DefineComponent<RedInputProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<RedInputProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLInputElement>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'vue';
|
|
2
|
+
export interface ChannelInputProps extends /* @vue-ignore */ InputHTMLAttributes {
|
|
3
|
+
}
|
|
4
|
+
declare const _default: import('vue').DefineComponent<ChannelInputProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ChannelInputProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLInputElement>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'vue';
|
|
2
|
+
export interface HueInputProps extends /* @vue-ignore */ InputHTMLAttributes {
|
|
3
|
+
}
|
|
4
|
+
declare const _default: import('vue').DefineComponent<HueInputProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<HueInputProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLInputElement>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ColorSliderProps } from './internal/channel-slider.vue';
|
|
2
|
+
export interface HueSliderProps extends /* @vue-ignore */ ColorSliderProps {
|
|
3
|
+
}
|
|
4
|
+
declare const _default: import('vue').DefineComponent<HueSliderProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<HueSliderProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HueyColor } from '@hueycolor/core';
|
|
2
|
+
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<{
|
|
3
|
+
modelValue: HueyColor;
|
|
4
|
+
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
5
|
+
"update:modelValue": (value: HueyColor) => any;
|
|
6
|
+
}, string, import('vue').PublicProps, Readonly<{
|
|
7
|
+
modelValue: HueyColor;
|
|
8
|
+
}> & Readonly<{
|
|
9
|
+
"onUpdate:modelValue"?: ((value: HueyColor) => any) | undefined;
|
|
10
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
|
|
11
|
+
default?(_: {}): any;
|
|
12
|
+
}>;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { default as AlphaInput } from './alpha-input.vue';
|
|
2
|
+
export { default as AlphaSlider } from './alpha-slider.vue';
|
|
3
|
+
export { default as BlueInput } from './blue-input.vue';
|
|
4
|
+
export { default as ColorDropper } from './color-dropper.vue';
|
|
5
|
+
export { default as ColorPreview } from './color-preview.vue';
|
|
6
|
+
export { default as ColorSwatch } from './color-swatch.vue';
|
|
7
|
+
export { default as GreenInput } from './green-input.vue';
|
|
8
|
+
export { default as HexInput } from './hex-input.vue';
|
|
9
|
+
export { default as HueInput } from './hue-input.vue';
|
|
10
|
+
export { default as HueSlider } from './hue-slider.vue';
|
|
11
|
+
export { default as HueyRoot } from './huey-root.vue';
|
|
12
|
+
export { default as ColorThumb } from './internal/color-thumb.vue';
|
|
13
|
+
export { default as LightnessInput } from './lightness-input.vue';
|
|
14
|
+
export { default as LightnessSlider } from './lightness-slider.vue';
|
|
15
|
+
export { default as RedInput } from './red-input.vue';
|
|
16
|
+
export { default as SaturationArea } from './saturation-area.vue';
|
|
17
|
+
export { default as SaturationInput } from './saturation-input.vue';
|
|
18
|
+
export { default as SaturationSlider } from './saturation-slider.vue';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'vue';
|
|
2
|
+
export interface ChannelInputProps extends /* @vue-ignore */ InputHTMLAttributes {
|
|
3
|
+
}
|
|
4
|
+
declare const _default: import('vue').DefineComponent<ChannelInputProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ChannelInputProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLInputElement>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AriaAttributes } from 'vue';
|
|
2
|
+
export interface ColorSliderProps extends /* @vue-ignore */ AriaAttributes {
|
|
3
|
+
min?: number;
|
|
4
|
+
max?: number;
|
|
5
|
+
step?: number;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: import('vue').DefineComponent<{
|
|
8
|
+
modelValue?: number;
|
|
9
|
+
} & ColorSliderProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
10
|
+
"update:modelValue": (value: number) => any;
|
|
11
|
+
}, string, import('vue').PublicProps, Readonly<{
|
|
12
|
+
modelValue?: number;
|
|
13
|
+
} & ColorSliderProps> & Readonly<{
|
|
14
|
+
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
15
|
+
}>, {
|
|
16
|
+
max: number;
|
|
17
|
+
min: number;
|
|
18
|
+
step: number;
|
|
19
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
20
|
+
'slider-track': HTMLDivElement;
|
|
21
|
+
}, HTMLDivElement>;
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'vue';
|
|
2
|
+
export interface ColorThumbProps extends /* @vue-ignore */ HTMLAttributes {
|
|
3
|
+
class?: HTMLAttributes['class'];
|
|
4
|
+
}
|
|
5
|
+
declare const _default: import('vue').DefineComponent<ColorThumbProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ColorThumbProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'vue';
|
|
2
|
+
export interface LightnessInputProps extends /* @vue-ignore */ InputHTMLAttributes {
|
|
3
|
+
}
|
|
4
|
+
declare const _default: import('vue').DefineComponent<LightnessInputProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<LightnessInputProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLInputElement>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ColorSliderProps } from './internal/channel-slider.vue';
|
|
2
|
+
export interface LightnessSliderProps extends /* @vue-ignore */ ColorSliderProps {
|
|
3
|
+
}
|
|
4
|
+
declare const _default: import('vue').DefineComponent<LightnessSliderProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<LightnessSliderProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'vue';
|
|
2
|
+
export interface RedInputProps extends /* @vue-ignore */ InputHTMLAttributes {
|
|
3
|
+
}
|
|
4
|
+
declare const _default: import('vue').DefineComponent<RedInputProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<RedInputProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLInputElement>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ColorFormat } from '@hueycolor/core';
|
|
2
|
+
import { HTMLAttributes } from 'vue';
|
|
3
|
+
export interface SaturationAreaProps extends /* @vue-ignore */ HTMLAttributes {
|
|
4
|
+
colorFormat?: Exclude<ColorFormat, 'oklch'>;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: import('vue').DefineComponent<SaturationAreaProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<SaturationAreaProps> & Readonly<{}>, {
|
|
7
|
+
colorFormat: Exclude<ColorFormat, "oklch">;
|
|
8
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
9
|
+
area: HTMLDivElement;
|
|
10
|
+
}, HTMLDivElement>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'vue';
|
|
2
|
+
export interface SaturationInputProps extends /* @vue-ignore */ InputHTMLAttributes {
|
|
3
|
+
}
|
|
4
|
+
declare const _default: import('vue').DefineComponent<SaturationInputProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<SaturationInputProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLInputElement>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ColorSliderProps } from './internal/channel-slider.vue';
|
|
2
|
+
export interface SaturationSliderProps extends /* @vue-ignore */ ColorSliderProps {
|
|
3
|
+
}
|
|
4
|
+
declare const _default: import('vue').DefineComponent<SaturationSliderProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<SaturationSliderProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HueyColor } from '@hueycolor/core';
|
|
2
|
+
import { InjectionKey, Ref } from 'vue';
|
|
3
|
+
export interface HueyContext {
|
|
4
|
+
hue: Ref<number>;
|
|
5
|
+
saturation: Ref<number>;
|
|
6
|
+
lightness: Ref<number>;
|
|
7
|
+
alpha: Ref<number>;
|
|
8
|
+
setColor: (color: string | HueyColor) => void;
|
|
9
|
+
colorValue: Ref<HueyColor>;
|
|
10
|
+
}
|
|
11
|
+
export declare const HUEY_CONTEXT: InjectionKey<HueyContext>;
|
|
12
|
+
export declare function useHueyContext(): HueyContext;
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),c=require("@hueycolor/core"),K=e.defineComponent({__name:"channel-input",setup(g){return(p,i)=>(e.openBlock(),e.createElementBlock("input",e.mergeProps({"huey-input":""},p.$props,{autocomplete:"off",spellcheck:"false"}),null,16))}}),F=Symbol("huey");function x(){const g=e.inject(F);if(!g)throw new Error("Huey components must be used within <HueyRoot>");return g}const I=e.defineComponent({__name:"alpha-input",setup(g){const{min:p,max:i}=c.getChannelBounds("a"),{alpha:r}=x(),u=e.ref((r.value*100).toFixed(0));e.watch(r,n=>{const t=(n*100).toFixed(0);u.value!==t&&(u.value=t)});function m(n,t){n.value=String(t),u.value=n.value,r.value=t/100}function v(n){const t=n.target,o=Number(t.value);if(Number.isNaN(o)||o<p||o>i){t.value=u.value;return}m(t,o)}function d(n,t){const o=n.target,f=Number(o.value);let s=n.shiftKey?10:1;s*=t==="down"?-1:1;const l=Number.isNaN(f)?Number(u.value):f,a=Math.min(i,Math.max(p,l+s));m(o,a)}return(n,t)=>(e.openBlock(),e.createBlock(K,{value:u.value,onKeydown:[e.withKeys(e.withModifiers(v,["prevent"]),["enter"]),t[0]||(t[0]=e.withKeys(e.withModifiers(o=>d(o,"up"),["prevent"]),["up"])),t[1]||(t[1]=e.withKeys(e.withModifiers(o=>d(o,"down"),["prevent"]),["down"]))]},null,8,["value","onKeydown"]))}});function L(){document.body.style.userSelect="none"}function D(){document.body.style.userSelect="unset"}const A=["aria-valuemin","aria-valuemax","aria-valuenow"],T=e.defineComponent({__name:"channel-slider",props:e.mergeModels({min:{default:0},max:{default:100},step:{default:1}},{modelValue:{default:0},modelModifiers:{}}),emits:["update:modelValue"],setup(g){const p=g,i=e.useModel(g,"modelValue"),r=e.useTemplateRef("slider-track"),u=e.computed(()=>{const{min:o,max:f}=p;return`${c.normalize(i.value,o,f,0,100)}%`});e.onUnmounted(()=>{n()});function m(o){const f=r.value;if(!f)return;const{x:s}=c.getAbsolutePosition(f),{x:l}=c.getPageXYFromEvent(o),a=l-s,w=f.clientWidth,{max:h,min:b,step:y}=p,k=c.normalize(a/w,0,1,b,h),N=Math.round(k/y)*y;i.value=c.clamp(c.roundToStep(N,y),b,h)}function v(o){m(o),L(),window.addEventListener("mousemove",m),window.addEventListener("mouseup",t)}function d(o){const f=c.resolveArrowDirection(o);if(!f)return;const s=i.value,{min:l,max:a,step:w}=p,h=o.shiftKey?w*10:w;switch(f){case"left":case"down":i.value=c.clamp(c.roundToStep(s-h,h),l,a);break;case"right":case"up":i.value=c.clamp(c.roundToStep(s+h,h),l,a);break}}function n(){window.removeEventListener("mousemove",m),window.removeEventListener("mouseup",t)}function t(){D(),n()}return(o,f)=>(e.openBlock(),e.createElementBlock("div",e.mergeProps({ref:"slider-track"},{...p},{"huey-slider-track":"",role:"slider","aria-valuemin":o.$props.min,"aria-valuemax":o.$props.max,"aria-valuenow":g.modelValue,onMousedown:v,onTouchmovePassive:m,onTouchstartPassive:m}),[e.createVNode(e.unref(U),{tabindex:"0",style:e.normalizeStyle({left:u.value}),onKeydown:d},null,8,["style"])],16,A))}}),z=e.defineComponent({__name:"alpha-slider",setup(g){const{hue:p,saturation:i,lightness:r,alpha:u}=x(),m=e.computed(()=>`
|
|
2
|
+
linear-gradient(90deg, hsla(${p.value}, ${i.value}%, ${r.value}%, 0) 0 calc(var(--huey-slider-track-height) / 2), hsla(${p.value}, ${i.value}%, ${r.value}%, 1) calc(100% - calc(var(--huey-slider-track-height) / 2)) 100%), url('data:image/svg+xml;utf8,%3Csvg%20width%3D%222%22%20height%3D%222%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M0%200h1v2h1V1H0%22%20fill-rule%3D%22nonzero%22%20fill%3D%22%23e1e1e1%22/%3E%3C/svg%3E') 0 0 / auto 66.67%, #fff
|
|
3
|
+
`),v=e.computed(()=>`color-mix(in srgb, white, hsl(${p.value}, ${i.value}%, ${r.value}%) ${u.value*100}%)`);return(d,n)=>(e.openBlock(),e.createBlock(T,e.mergeProps({...d.$props},{modelValue:e.unref(u),"onUpdate:modelValue":n[0]||(n[0]=t=>e.isRef(u)?u.value=t:null),"aria-label":d.$props["aria-label"]??"Alpha slider","huey-slider":"",max:1,min:0,step:.01,style:{"--huey-slider-bg":m.value,"--huey-thumb-color":v.value}}),null,16,["modelValue","aria-label","style"]))}}),O=e.defineComponent({__name:"blue-input",setup(g){const{min:p,max:i}=c.getChannelBounds("g"),{hue:r,saturation:u,lightness:m,colorValue:v}=x(),{b:d}=v.value.toRgb(),n=e.ref(d.toFixed(0));e.watch([r,u,m],([s,l,a])=>{const{b:w}=c.hslToRgb(s,l,a),h=w.toFixed(0);n.value!==h&&(n.value=h)});function t(s,l){s.value=String(l),n.value=s.value;const{r:a,g:w}=v.value.toRgb(),{h,s:b,l:y}=c.rgbToHsl(a/255,w/255,l/255);r.value=h,u.value=b,m.value=y}function o(s){const l=s.target,a=Number(l.value);if(Number.isNaN(a)||a<p||a>i){l.value=n.value;return}t(l,a)}function f(s,l){const a=s.target,w=Number(a.value);let h=s.shiftKey?10:1;h*=l==="down"?-1:1;const b=Number.isNaN(w)?Number(n.value):w,y=Math.min(i,Math.max(p,b+h));t(a,y)}return(s,l)=>(e.openBlock(),e.createBlock(K,{value:n.value,onKeydown:[e.withKeys(e.withModifiers(o,["prevent"]),["enter"]),l[0]||(l[0]=e.withKeys(e.withModifiers(a=>f(a,"up"),["prevent"]),["up"])),l[1]||(l[1]=e.withKeys(e.withModifiers(a=>f(a,"down"),["prevent"]),["down"]))],onBlur:o},null,8,["value","onKeydown"]))}}),X=["aria-label"],Y=e.defineComponent({__name:"color-dropper",emits:["error"],setup(g,{emit:p}){const i=g,r=p,{hue:u,saturation:m,lightness:v}=x(),d=e.ref();window.EyeDropper&&(d.value=new EyeDropper);function n(){d.value&&d.value.open().then(t=>{const o=c.hueyColor(t.sRGBHex),{h:f,s,l}=o.toHsl();u.value=c.clamp(f,0,360),m.value=c.clamp(s,0,100),v.value=c.clamp(l,0,100)}).catch(t=>{r("error",t)})}return(t,o)=>d.value?(e.openBlock(),e.createElementBlock("button",e.mergeProps({key:0},{...i},{"aria-label":t.$props["aria-label"]??"Eye dropper button",onClick:n}),[e.renderSlot(t.$slots,"default")],16,X)):e.createCommentVNode("",!0)}}),q=["data-split-view","aria-label"],j=e.defineComponent({__name:"color-preview",props:{class:{},splitPreview:{type:Boolean,default:!0}},setup(g){e.useCssVars(d=>({v848a7ffe:m.value}));const{hue:p,saturation:i,lightness:r,alpha:u}=x(),m=e.computed(()=>`${Math.abs(u.value*100-100)/100}`),v=e.computed(()=>`hsl(${p.value}, ${i.value}%, ${r.value}%)`);return(d,n)=>(e.openBlock(),e.createElementBlock("div",{"data-split-view":g.splitPreview,"huey-preview":"",class:e.normalizeClass(d.$props.class),style:e.normalizeStyle({background:v.value}),"aria-label":`hsl(${e.unref(p)}, ${e.unref(i)}%, ${e.unref(r)}%, ${e.unref(u)})`,role:"img","aria-live":"polite"},null,14,q))}}),W=["aria-label"],G=["aria-label","aria-selected","onClick","onKeydown"],J=e.defineComponent({__name:"color-swatch",props:{swatch:{}},setup(g){const{setColor:p,colorValue:i}=x();function r(v,d){v.preventDefault(),p(d)}const u=e.computed(()=>i.value.toHexString());function m(v){const d=c.hueyColor(v).toHexString();return u.value===d}return(v,d)=>g.swatch?(e.openBlock(),e.createElementBlock("div",{key:0,role:"listbox","aria-label":v.$props["aria-label"]??"Color swatch","huey-swatch":""},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.swatch,n=>(e.openBlock(),e.createElementBlock("div",{key:n,tabindex:"0",role:"option","aria-label":n,"huey-swatch-color":"","aria-selected":m(n),style:e.normalizeStyle({"--swatch-color":n}),onClick:t=>r(t,n),onKeydown:e.withKeys(e.withModifiers(t=>r(t,n),["prevent"]),["enter","space"])},null,44,G))),128))],8,W)):e.createCommentVNode("",!0)}}),Q=e.defineComponent({__name:"green-input",setup(g){const{min:p,max:i}=c.getChannelBounds("g"),{hue:r,saturation:u,lightness:m,colorValue:v}=x(),{g:d}=v.value.toRgb(),n=e.ref(d.toFixed(0));e.watch([r,u,m],([s,l,a])=>{const{g:w}=c.hslToRgb(s,l,a),h=w.toFixed(0);n.value!==h&&(n.value=h)});function t(s,l){s.value=String(l),n.value=s.value;const{r:a,b:w}=v.value.toRgb(),{h,s:b,l:y}=c.rgbToHsl(a/255,l/255,w/255);r.value=h,u.value=b,m.value=y}function o(s){const l=s.target,a=Number(l.value);if(Number.isNaN(a)||a<p||a>i){l.value=n.value;return}t(l,a)}function f(s,l){const a=s.target,w=Number(a.value);let h=s.shiftKey?10:1;h*=l==="down"?-1:1;const b=Number.isNaN(w)?Number(n.value):w,y=Math.min(i,Math.max(p,b+h));t(a,y)}return(s,l)=>(e.openBlock(),e.createBlock(K,{value:n.value,onKeydown:[e.withKeys(e.withModifiers(o,["prevent"]),["enter"]),l[0]||(l[0]=e.withKeys(e.withModifiers(a=>f(a,"up"),["prevent"]),["up"])),l[1]||(l[1]=e.withKeys(e.withModifiers(a=>f(a,"down"),["prevent"]),["down"]))],onBlur:o},null,8,["value","onKeydown"]))}}),Z=["id","value","onKeydown"],ee=e.defineComponent({__name:"hex-input",setup(g){const{hue:p,saturation:i,lightness:r,colorValue:u,alpha:m}=x(),v=e.ref(u.value.toHex().toUpperCase());e.watch(u,s=>{v.value=s.toHex().toUpperCase()});function d(s){const l=s.target,a=l.value;if(!c.isHex(a)){l.value=v.value;return}o(l,a)}function n(s,l){const a=Number.parseInt(s,16);return a+l<0?"00":a+l>255?"FF":((a+l+256)%256).toString(16).toUpperCase().padStart(2,"0")}function t(s,l){const a=s.target,w=a.value,h=w.replace(/^#/,"").slice(0,6);if(!c.isHex(w)&&c.isHex(h)){a.value=h;return}if(!c.isHex(h)){a.value=v.value;return}const b=h.match(/.{2}/g);let y=s.shiftKey?10:1;y*=l==="down"?-1:1;const{selectionEnd:k,selectionStart:N}=a,$=N??0,_=k??0;if(_-$===a.value.length){let B="";b?.forEach(E=>{B=B.concat(n(E,y))}),o(a,B),a.setSelectionRange(0,a.value.length);return}let C,S;$===_?(C=Math.min(Math.floor($/2),2),S=C):(C=Math.floor($/2),S=Math.floor((_-1)/2));let M="";b?.forEach((B,E)=>{E>=C&&E<=S?M=M.concat(n(B,y)):M=M.concat(B)}),o(a,M);const H=C*2,R=(S+1)*2;a.setSelectionRange(H,R)}function o(s,l){s.value=String(l),v.value=s.value.toUpperCase();const a=c.hueyColor(v.value),{h:w,s:h,l:b}=a.toHsl();h>0&&(p.value=w),i.value=h,r.value=b,m.value=a.getAlpha()}function f(s){s.target.setSelectionRange(0,-1)}return(s,l)=>(e.openBlock(),e.createElementBlock("input",{id:s.$props.id,value:v.value,"huey-input":"",type:"text",autocomplete:"off",spellcheck:"false",onKeydown:[e.withKeys(e.withModifiers(d,["prevent"]),["enter"]),l[0]||(l[0]=e.withKeys(e.withModifiers(a=>t(a,"up"),["prevent"]),["up"])),l[1]||(l[1]=e.withKeys(e.withModifiers(a=>t(a,"down"),["prevent"]),["down"]))],onBlur:d,onFocus:f},null,40,Z))}}),te=e.defineComponent({__name:"hue-input",setup(g){const{min:p,max:i}=c.getChannelBounds("h"),{hue:r}=x(),u=e.ref(r.value.toFixed(0));e.watch(r,n=>{const t=n.toFixed(0);u.value!==t&&(u.value=t)});function m(n,t){n.value=String(t),u.value=n.value,r.value=t}function v(n){const t=n.target,o=Number(t.value);if(Number.isNaN(o)||o<p||o>i){t.value=u.value;return}m(t,o)}function d(n,t){const o=n.target,f=Number(o.value);let s=n.shiftKey?10:1;s*=t==="down"?-1:1;const l=Number.isNaN(f)?Number(u.value):f,a=Math.min(i,Math.max(p,l+s));m(o,a)}return(n,t)=>(e.openBlock(),e.createBlock(K,{value:u.value,onKeydown:[e.withKeys(e.withModifiers(v,["prevent"]),["enter"]),t[0]||(t[0]=e.withKeys(e.withModifiers(o=>d(o,"up"),["prevent"]),["up"])),t[1]||(t[1]=e.withKeys(e.withModifiers(o=>d(o,"down"),["prevent"]),["down"]))],onBlur:v},null,8,["value","onKeydown"]))}}),ne=e.defineComponent({__name:"hue-slider",setup(g){const{hue:p}=x(),i=e.computed(()=>`hsl(${p.value}, 100%, 50%)`);return(r,u)=>(e.openBlock(),e.createBlock(T,e.mergeProps({...r.$props},{modelValue:e.unref(p),"onUpdate:modelValue":u[0]||(u[0]=m=>e.isRef(p)?p.value=m:null),"aria-label":r.$props["aria-label"]??"Hue slider","huey-slider":"",max:360,min:0,step:1,style:{background:"linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%)","--huey-thumb-color":i.value}}),null,16,["modelValue","aria-label","style"]))}}),oe=e.defineComponent({__name:"huey-root",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(g){const p=e.useModel(g,"modelValue");if(!p.value)throw new Error("<HueyRoot> is missing required v-model of type HueyColor");const i=e.ref(0),r=e.ref(0),u=e.ref(0),m=e.ref(1);let v=!1;e.watch(()=>p,n=>{if(v){v=!1;return}const o=c.hueyColor(n.value).toHsl();i.value=o.h,r.value=o.s,u.value=o.l,m.value=o.a},{immediate:!0}),e.watch([i,r,u,m],([n,t,o,f])=>{v=!0;const s=c.hueyColor(`hsla(${c.clamp(n,0,360)}, ${c.clamp(t,0,100)}%, ${c.clamp(o,0,100)}%, ${c.clamp(f,0,1)})`);p.value=s});function d(n){const o=c.hueyColor(n).toHsl();i.value=c.clamp(o.h,0,360),r.value=c.clamp(o.s,0,100),u.value=c.clamp(o.l,0,100),m.value=c.clamp(o.a,0,1)}return e.provide(F,{hue:i,saturation:r,lightness:u,alpha:m,colorValue:p,setColor:d}),(n,t)=>e.renderSlot(n.$slots,"default")}}),U=e.defineComponent({__name:"color-thumb",props:{class:{}},setup(g){const p=g;return(i,r)=>(e.openBlock(),e.createElementBlock("div",e.mergeProps({"huey-slider-thumb":""},{...p}),null,16))}}),ae=e.defineComponent({__name:"lightness-input",setup(g){const{min:p,max:i}=c.getChannelBounds("l"),{lightness:r}=x(),u=e.ref(r.value.toFixed(0));e.watch(r,n=>{const t=n.toFixed(0);u.value!==t&&(u.value=t)});function m(n,t){n.value=String(t),u.value=n.value,r.value=t}function v(n){const t=n.target,o=Number(t.value);if(Number.isNaN(o)||o<p||o>i){t.value=u.value;return}m(t,o)}function d(n,t){const o=n.target,f=Number(o.value);let s=n.shiftKey?10:1;s*=t==="down"?-1:1;const l=Number.isNaN(f)?Number(u.value):f,a=Math.min(i,Math.max(p,l+s));m(o,a)}return(n,t)=>(e.openBlock(),e.createBlock(K,{value:u.value,onKeydown:[e.withKeys(e.withModifiers(v,["prevent"]),["enter"]),t[0]||(t[0]=e.withKeys(e.withModifiers(o=>d(o,"up"),["prevent"]),["up"])),t[1]||(t[1]=e.withKeys(e.withModifiers(o=>d(o,"down"),["prevent"]),["down"]))],onBlur:v},null,8,["value","onKeydown"]))}}),le=e.defineComponent({__name:"lightness-slider",setup(g){const{hue:p,saturation:i,lightness:r}=x(),u=e.computed(()=>`hsl(${p.value}, ${i.value}%, ${r.value}%)`),m=e.computed(()=>`linear-gradient(to right, #000, hsl(${p.value}, ${i.value}%, 50%), #fff)`);return(v,d)=>(e.openBlock(),e.createBlock(T,e.mergeProps({...v.$props},{modelValue:e.unref(r),"onUpdate:modelValue":d[0]||(d[0]=n=>e.isRef(r)?r.value=n:null),"aria-label":v.$props["aria-label"]??"Lightness slider","huey-slider":"",max:100,min:0,step:1,style:{background:m.value,"--huey-thumb-color":u.value}}),null,16,["modelValue","aria-label","style"]))}}),ue=e.defineComponent({__name:"red-input",setup(g){const{min:p,max:i}=c.getChannelBounds("r"),{hue:r,saturation:u,lightness:m,colorValue:v}=x(),{r:d}=v.value.toRgb(),n=e.ref(d.toFixed(0));e.watch([r,u,m],([s,l,a])=>{const{r:w}=c.hslToRgb(s,l,a),h=w.toFixed(0);n.value!==h&&(n.value=h)});function t(s,l){s.value=String(l),n.value=s.value;const{g:a,b:w}=v.value.toRgb(),{h,s:b,l:y}=c.rgbToHsl(l/255,a/255,w/255);r.value=h,u.value=b,m.value=y}function o(s){const l=s.target,a=Number(l.value);if(Number.isNaN(a)||a<p||a>i){l.value=n.value;return}t(l,a)}function f(s,l){const a=s.target,w=Number(a.value);let h=s.shiftKey?10:1;h*=l==="down"?-1:1;const b=Number.isNaN(w)?Number(n.value):w,y=Math.min(i,Math.max(p,b+h));t(a,y)}return(s,l)=>(e.openBlock(),e.createBlock(K,{value:n.value,onKeydown:[e.withKeys(e.withModifiers(o,["prevent"]),["enter"]),l[0]||(l[0]=e.withKeys(e.withModifiers(a=>f(a,"up"),["prevent"]),["up"])),l[1]||(l[1]=e.withKeys(e.withModifiers(a=>f(a,"down"),["prevent"]),["down"]))],onBlur:o},null,8,["value","onKeydown"]))}}),re=e.defineComponent({__name:"saturation-area",props:{colorFormat:{default:"hsl"}},setup(g){const p=g,{hue:i,saturation:r,lightness:u}=x(),m=e.useTemplateRef("area"),v=e.ref(c.hslToHsv(i.value,r.value,u.value).s),d=e.ref(!1);e.watch([i,r,u],()=>{d.value||(v.value=c.hslToHsv(i.value,r.value,u.value).s)});const n=e.computed(()=>{const k=`hsl(${i.value}, 100%, 50%)`;return p.colorFormat==="hsl"?`linear-gradient(to top, black, transparent, white), linear-gradient(to right, hsl(0, 0%, 50%), transparent), ${k}`:`linear-gradient(to top, black, transparent), linear-gradient(to right, white, transparent),
|
|
4
|
+
${k}`}),t=e.computed(()=>`hsl(${i.value}, ${r.value}%, ${u.value}%)`);function o(k){k.preventDefault();const N=m.value;if(!N)return;const $=N.clientWidth,_=N.clientHeight,{x:V,y:C}=c.getAbsolutePosition(N),{x:S,y:M}=c.getPageXYFromEvent(k),H=c.clamp(S-V,0,$),R=c.clamp(M-C,0,_);if(p.colorFormat==="hsl"){r.value=H/$*100,u.value=c.clamp(1-R/_,0,1)*100;return}const B=H/$*100,E=c.clamp(1-R/_,0,1)*100;v.value=B;const P=c.hsvToHsl(i.value,B,E);r.value=P.s,u.value=P.l}const f=e.computed(()=>p.colorFormat==="hsl"?`${r.value}%`:`${v.value}%`),s=e.computed(()=>p.colorFormat==="hsl"?`${100-u.value}%`:`${100-c.hslToHsv(i.value,r.value,u.value).v}%`);function l(){d.value=!0,L(),window.addEventListener("mousemove",o),window.addEventListener("mouseup",o),window.addEventListener("mouseup",y)}function a(k){d.value=!0,o(k),window.addEventListener("touchend",w)}function w(){d.value=!1,window.removeEventListener("touchend",w)}function h(k){const N=c.resolveArrowDirection(k),$=k.shiftKey?10:1;if(!N)return;if(d.value=!0,p.colorFormat==="hsl"){switch(N){case"left":r.value=c.clamp(r.value-$,0,100);break;case"down":u.value=c.clamp(u.value-$,0,100);break;case"right":r.value=c.clamp(r.value+$,0,100);break;case"up":u.value=c.clamp(u.value+$,0,100);break}d.value=!1;return}const _=c.hslToHsv(i.value,r.value,u.value);switch(_.s=v.value,N){case"left":_.s=c.clamp(_.s-$,0,100);break;case"down":_.v=c.clamp(_.v-$,0,100);break;case"right":_.s=c.clamp(_.s+$,0,100);break;case"up":_.v=c.clamp(_.v+$,0,100);break}v.value=_.s;const V=c.hsvToHsl(i.value,_.s,_.v);r.value=V.s,u.value=V.l,d.value=!1}function b(){window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",o),window.removeEventListener("mouseup",y),window.removeEventListener("touchend",w)}function y(){d.value=!1,D(),b()}return e.onUnmounted(()=>{b()}),(k,N)=>(e.openBlock(),e.createElementBlock("div",{ref:"area",role:"group","huey-area":"",style:e.normalizeStyle({background:n.value,"--huey-thumb-color":t.value}),onMousedown:l,onTouchmovePassive:o,onTouchstartPassive:a},[e.createVNode(e.unref(U),{style:e.normalizeStyle({top:s.value,left:f.value}),tabindex:"0",role:"slider","aria-label":"Color thumb","aria-valuenow":Math.round(e.unref(r)),"aria-valuemin":0,"aria-valuemax":100,"aria-valuetext":`Saturation ${Math.round(e.unref(r))}%, Lightness ${Math.round(e.unref(u))}%`,onKeydown:h},null,8,["style","aria-valuenow","aria-valuetext"])],36))}}),se=e.defineComponent({__name:"saturation-input",setup(g){const{min:p,max:i}=c.getChannelBounds("s"),{saturation:r}=x(),u=e.ref(r.value.toFixed(0));e.watch(r,n=>{const t=n.toFixed(0);u.value!==t&&(u.value=t)});function m(n,t){n.value=String(t),u.value=n.value,r.value=t}function v(n){const t=n.target,o=Number(t.value);if(Number.isNaN(o)||o<p||o>i){t.value=u.value;return}m(t,o)}function d(n,t){const o=n.target,f=Number(o.value);let s=n.shiftKey?10:1;s*=t==="down"?-1:1;const l=Number.isNaN(f)?Number(u.value):f,a=Math.min(i,Math.max(p,l+s));m(o,a)}return(n,t)=>(e.openBlock(),e.createBlock(K,{value:u.value,onKeydown:[e.withKeys(e.withModifiers(v,["prevent"]),["enter"]),t[0]||(t[0]=e.withKeys(e.withModifiers(o=>d(o,"up"),["prevent"]),["up"])),t[1]||(t[1]=e.withKeys(e.withModifiers(o=>d(o,"down"),["prevent"]),["down"]))],onBlur:v},null,8,["value","onKeydown"]))}}),ie=e.defineComponent({__name:"saturation-slider",setup(g){const{hue:p,saturation:i}=x(),r=e.computed(()=>`hsl(${p.value}, ${i.value}%, 50%)`),u=e.computed(()=>`linear-gradient(to right, hsl(${p.value}, 0%, 50%), hsl(${p.value}, 100%, 50%))`);return(m,v)=>(e.openBlock(),e.createBlock(T,e.mergeProps({...m.$props},{modelValue:e.unref(i),"onUpdate:modelValue":v[0]||(v[0]=d=>e.isRef(i)?i.value=d:null),"aria-label":m.$props["aria-label"]??"Saturation slider","huey-slider":"",max:100,min:0,step:1,style:{background:u.value,"--huey-thumb-color":r.value}}),null,16,["modelValue","aria-label","style"]))}});exports.AlphaInput=I;exports.AlphaSlider=z;exports.BlueInput=O;exports.ColorDropper=Y;exports.ColorPreview=j;exports.ColorSwatch=J;exports.GreenInput=Q;exports.HUEY_CONTEXT=F;exports.HexInput=ee;exports.HueInput=te;exports.HueSlider=ne;exports.HueyRoot=oe;exports.LightnessInput=ae;exports.LightnessSlider=le;exports.RedInput=ue;exports.SaturationArea=re;exports.SaturationInput=se;exports.SaturationSlider=ie;exports.useHueyContext=x;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { AlphaInput, AlphaSlider, BlueInput, ColorDropper, ColorPreview, ColorSwatch, GreenInput, HexInput, HueInput, HueSlider, HueyRoot, LightnessInput, LightnessSlider, RedInput, SaturationArea, SaturationInput, SaturationSlider, } from './components';
|
|
2
|
+
export { useHueyContext, HUEY_CONTEXT } from './composables/use-huey-context';
|
|
3
|
+
export type { HueyContext } from './composables/use-huey-context';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,755 @@
|
|
|
1
|
+
import { defineComponent as N, createElementBlock as R, openBlock as $, mergeProps as L, inject as be, ref as k, watch as H, createBlock as F, withKeys as g, withModifiers as w, mergeModels as ge, useModel as ue, useTemplateRef as le, computed as M, onUnmounted as oe, createVNode as re, unref as K, normalizeStyle as X, isRef as G, createCommentVNode as se, renderSlot as ie, useCssVars as we, normalizeClass as _e, Fragment as ye, renderList as $e, provide as xe } from "vue";
|
|
2
|
+
import { getChannelBounds as P, normalize as ne, getAbsolutePosition as ce, getPageXYFromEvent as ve, clamp as b, roundToStep as Q, resolveArrowDirection as pe, hslToRgb as Z, rgbToHsl as ee, hueyColor as O, isHex as j, hslToHsv as q, hsvToHsl as ae } from "@hueycolor/core";
|
|
3
|
+
const U = /* @__PURE__ */ N({
|
|
4
|
+
__name: "channel-input",
|
|
5
|
+
setup(f) {
|
|
6
|
+
return (i, s) => ($(), R("input", L({ "huey-input": "" }, i.$props, {
|
|
7
|
+
autocomplete: "off",
|
|
8
|
+
spellcheck: "false"
|
|
9
|
+
}), null, 16));
|
|
10
|
+
}
|
|
11
|
+
}), de = Symbol("huey");
|
|
12
|
+
function E() {
|
|
13
|
+
const f = be(de);
|
|
14
|
+
if (!f)
|
|
15
|
+
throw new Error("Huey components must be used within <HueyRoot>");
|
|
16
|
+
return f;
|
|
17
|
+
}
|
|
18
|
+
const He = /* @__PURE__ */ N({
|
|
19
|
+
__name: "alpha-input",
|
|
20
|
+
setup(f) {
|
|
21
|
+
const { min: i, max: s } = P("a"), { alpha: o } = E(), l = k((o.value * 100).toFixed(0));
|
|
22
|
+
H(o, (t) => {
|
|
23
|
+
const e = (t * 100).toFixed(0);
|
|
24
|
+
l.value !== e && (l.value = e);
|
|
25
|
+
});
|
|
26
|
+
function p(t, e) {
|
|
27
|
+
t.value = String(e), l.value = t.value, o.value = e / 100;
|
|
28
|
+
}
|
|
29
|
+
function c(t) {
|
|
30
|
+
const e = t.target, n = Number(e.value);
|
|
31
|
+
if (Number.isNaN(n) || n < i || n > s) {
|
|
32
|
+
e.value = l.value;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
p(e, n);
|
|
36
|
+
}
|
|
37
|
+
function v(t, e) {
|
|
38
|
+
const n = t.target, m = Number(n.value);
|
|
39
|
+
let r = t.shiftKey ? 10 : 1;
|
|
40
|
+
r *= e === "down" ? -1 : 1;
|
|
41
|
+
const u = Number.isNaN(m) ? Number(l.value) : m, a = Math.min(s, Math.max(i, u + r));
|
|
42
|
+
p(n, a);
|
|
43
|
+
}
|
|
44
|
+
return (t, e) => ($(), F(U, {
|
|
45
|
+
value: l.value,
|
|
46
|
+
onKeydown: [
|
|
47
|
+
g(w(c, ["prevent"]), ["enter"]),
|
|
48
|
+
e[0] || (e[0] = g(w((n) => v(n, "up"), ["prevent"]), ["up"])),
|
|
49
|
+
e[1] || (e[1] = g(w((n) => v(n, "down"), ["prevent"]), ["down"]))
|
|
50
|
+
]
|
|
51
|
+
}, null, 8, ["value", "onKeydown"]));
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
function me() {
|
|
55
|
+
document.body.style.userSelect = "none";
|
|
56
|
+
}
|
|
57
|
+
function he() {
|
|
58
|
+
document.body.style.userSelect = "unset";
|
|
59
|
+
}
|
|
60
|
+
const Ne = ["aria-valuemin", "aria-valuemax", "aria-valuenow"], J = /* @__PURE__ */ N({
|
|
61
|
+
__name: "channel-slider",
|
|
62
|
+
props: /* @__PURE__ */ ge({
|
|
63
|
+
min: { default: 0 },
|
|
64
|
+
max: { default: 100 },
|
|
65
|
+
step: { default: 1 }
|
|
66
|
+
}, {
|
|
67
|
+
modelValue: { default: 0 },
|
|
68
|
+
modelModifiers: {}
|
|
69
|
+
}),
|
|
70
|
+
emits: ["update:modelValue"],
|
|
71
|
+
setup(f) {
|
|
72
|
+
const i = f, s = ue(f, "modelValue"), o = le("slider-track"), l = M(() => {
|
|
73
|
+
const { min: n, max: m } = i;
|
|
74
|
+
return `${ne(s.value, n, m, 0, 100)}%`;
|
|
75
|
+
});
|
|
76
|
+
oe(() => {
|
|
77
|
+
t();
|
|
78
|
+
});
|
|
79
|
+
function p(n) {
|
|
80
|
+
const m = o.value;
|
|
81
|
+
if (!m)
|
|
82
|
+
return;
|
|
83
|
+
const { x: r } = ce(m), { x: u } = ve(n), a = u - r, h = m.clientWidth, { max: d, min: _, step: y } = i, S = ne(a / h, 0, 1, _, d), C = Math.round(S / y) * y;
|
|
84
|
+
s.value = b(Q(C, y), _, d);
|
|
85
|
+
}
|
|
86
|
+
function c(n) {
|
|
87
|
+
p(n), me(), window.addEventListener("mousemove", p), window.addEventListener("mouseup", e);
|
|
88
|
+
}
|
|
89
|
+
function v(n) {
|
|
90
|
+
const m = pe(n);
|
|
91
|
+
if (!m)
|
|
92
|
+
return;
|
|
93
|
+
const r = s.value, { min: u, max: a, step: h } = i, d = n.shiftKey ? h * 10 : h;
|
|
94
|
+
switch (m) {
|
|
95
|
+
case "left":
|
|
96
|
+
case "down":
|
|
97
|
+
s.value = b(Q(r - d, d), u, a);
|
|
98
|
+
break;
|
|
99
|
+
case "right":
|
|
100
|
+
case "up":
|
|
101
|
+
s.value = b(Q(r + d, d), u, a);
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function t() {
|
|
106
|
+
window.removeEventListener("mousemove", p), window.removeEventListener("mouseup", e);
|
|
107
|
+
}
|
|
108
|
+
function e() {
|
|
109
|
+
he(), t();
|
|
110
|
+
}
|
|
111
|
+
return (n, m) => ($(), R("div", L({ ref: "slider-track" }, { ...i }, {
|
|
112
|
+
"huey-slider-track": "",
|
|
113
|
+
role: "slider",
|
|
114
|
+
"aria-valuemin": n.$props.min,
|
|
115
|
+
"aria-valuemax": n.$props.max,
|
|
116
|
+
"aria-valuenow": f.modelValue,
|
|
117
|
+
onMousedown: c,
|
|
118
|
+
onTouchmovePassive: p,
|
|
119
|
+
onTouchstartPassive: p
|
|
120
|
+
}), [
|
|
121
|
+
re(K(fe), {
|
|
122
|
+
tabindex: "0",
|
|
123
|
+
style: X({ left: l.value }),
|
|
124
|
+
onKeydown: v
|
|
125
|
+
}, null, 8, ["style"])
|
|
126
|
+
], 16, Ne));
|
|
127
|
+
}
|
|
128
|
+
}), Fe = /* @__PURE__ */ N({
|
|
129
|
+
__name: "alpha-slider",
|
|
130
|
+
setup(f) {
|
|
131
|
+
const { hue: i, saturation: s, lightness: o, alpha: l } = E(), p = M(() => `
|
|
132
|
+
linear-gradient(90deg, hsla(${i.value}, ${s.value}%, ${o.value}%, 0) 0 calc(var(--huey-slider-track-height) / 2), hsla(${i.value}, ${s.value}%, ${o.value}%, 1) calc(100% - calc(var(--huey-slider-track-height) / 2)) 100%), url('data:image/svg+xml;utf8,%3Csvg%20width%3D%222%22%20height%3D%222%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M0%200h1v2h1V1H0%22%20fill-rule%3D%22nonzero%22%20fill%3D%22%23e1e1e1%22/%3E%3C/svg%3E') 0 0 / auto 66.67%, #fff
|
|
133
|
+
`), c = M(() => `color-mix(in srgb, white, hsl(${i.value}, ${s.value}%, ${o.value}%) ${l.value * 100}%)`);
|
|
134
|
+
return (v, t) => ($(), F(J, L({ ...v.$props }, {
|
|
135
|
+
modelValue: K(l),
|
|
136
|
+
"onUpdate:modelValue": t[0] || (t[0] = (e) => G(l) ? l.value = e : null),
|
|
137
|
+
"aria-label": v.$props["aria-label"] ?? "Alpha slider",
|
|
138
|
+
"huey-slider": "",
|
|
139
|
+
max: 1,
|
|
140
|
+
min: 0,
|
|
141
|
+
step: 0.01,
|
|
142
|
+
style: {
|
|
143
|
+
"--huey-slider-bg": p.value,
|
|
144
|
+
"--huey-thumb-color": c.value
|
|
145
|
+
}
|
|
146
|
+
}), null, 16, ["modelValue", "aria-label", "style"]));
|
|
147
|
+
}
|
|
148
|
+
}), Re = /* @__PURE__ */ N({
|
|
149
|
+
__name: "blue-input",
|
|
150
|
+
setup(f) {
|
|
151
|
+
const { min: i, max: s } = P("g"), { hue: o, saturation: l, lightness: p, colorValue: c } = E(), { b: v } = c.value.toRgb(), t = k(v.toFixed(0));
|
|
152
|
+
H([o, l, p], ([r, u, a]) => {
|
|
153
|
+
const { b: h } = Z(r, u, a), d = h.toFixed(0);
|
|
154
|
+
t.value !== d && (t.value = d);
|
|
155
|
+
});
|
|
156
|
+
function e(r, u) {
|
|
157
|
+
r.value = String(u), t.value = r.value;
|
|
158
|
+
const { r: a, g: h } = c.value.toRgb(), { h: d, s: _, l: y } = ee(a / 255, h / 255, u / 255);
|
|
159
|
+
o.value = d, l.value = _, p.value = y;
|
|
160
|
+
}
|
|
161
|
+
function n(r) {
|
|
162
|
+
const u = r.target, a = Number(u.value);
|
|
163
|
+
if (Number.isNaN(a) || a < i || a > s) {
|
|
164
|
+
u.value = t.value;
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
e(u, a);
|
|
168
|
+
}
|
|
169
|
+
function m(r, u) {
|
|
170
|
+
const a = r.target, h = Number(a.value);
|
|
171
|
+
let d = r.shiftKey ? 10 : 1;
|
|
172
|
+
d *= u === "down" ? -1 : 1;
|
|
173
|
+
const _ = Number.isNaN(h) ? Number(t.value) : h, y = Math.min(s, Math.max(i, _ + d));
|
|
174
|
+
e(a, y);
|
|
175
|
+
}
|
|
176
|
+
return (r, u) => ($(), F(U, {
|
|
177
|
+
value: t.value,
|
|
178
|
+
onKeydown: [
|
|
179
|
+
g(w(n, ["prevent"]), ["enter"]),
|
|
180
|
+
u[0] || (u[0] = g(w((a) => m(a, "up"), ["prevent"]), ["up"])),
|
|
181
|
+
u[1] || (u[1] = g(w((a) => m(a, "down"), ["prevent"]), ["down"]))
|
|
182
|
+
],
|
|
183
|
+
onBlur: n
|
|
184
|
+
}, null, 8, ["value", "onKeydown"]));
|
|
185
|
+
}
|
|
186
|
+
}), Ve = ["aria-label"], Be = /* @__PURE__ */ N({
|
|
187
|
+
__name: "color-dropper",
|
|
188
|
+
emits: ["error"],
|
|
189
|
+
setup(f, { emit: i }) {
|
|
190
|
+
const s = f, o = i, { hue: l, saturation: p, lightness: c } = E(), v = k();
|
|
191
|
+
window.EyeDropper && (v.value = new EyeDropper());
|
|
192
|
+
function t() {
|
|
193
|
+
v.value && v.value.open().then((e) => {
|
|
194
|
+
const n = O(e.sRGBHex), { h: m, s: r, l: u } = n.toHsl();
|
|
195
|
+
l.value = b(m, 0, 360), p.value = b(r, 0, 100), c.value = b(u, 0, 100);
|
|
196
|
+
}).catch((e) => {
|
|
197
|
+
o("error", e);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
return (e, n) => v.value ? ($(), R("button", L({ key: 0 }, { ...s }, {
|
|
201
|
+
"aria-label": e.$props["aria-label"] ?? "Eye dropper button",
|
|
202
|
+
onClick: t
|
|
203
|
+
}), [
|
|
204
|
+
ie(e.$slots, "default")
|
|
205
|
+
], 16, Ve)) : se("", !0);
|
|
206
|
+
}
|
|
207
|
+
}), Se = ["data-split-view", "aria-label"], Le = /* @__PURE__ */ N({
|
|
208
|
+
__name: "color-preview",
|
|
209
|
+
props: {
|
|
210
|
+
class: {},
|
|
211
|
+
splitPreview: { type: Boolean, default: !0 }
|
|
212
|
+
},
|
|
213
|
+
setup(f) {
|
|
214
|
+
we((v) => ({
|
|
215
|
+
v848a7ffe: p.value
|
|
216
|
+
}));
|
|
217
|
+
const { hue: i, saturation: s, lightness: o, alpha: l } = E(), p = M(() => `${Math.abs(l.value * 100 - 100) / 100}`), c = M(() => `hsl(${i.value}, ${s.value}%, ${o.value}%)`);
|
|
218
|
+
return (v, t) => ($(), R("div", {
|
|
219
|
+
"data-split-view": f.splitPreview,
|
|
220
|
+
"huey-preview": "",
|
|
221
|
+
class: _e(v.$props.class),
|
|
222
|
+
style: X({ background: c.value }),
|
|
223
|
+
"aria-label": `hsl(${K(i)}, ${K(s)}%, ${K(o)}%, ${K(l)})`,
|
|
224
|
+
role: "img",
|
|
225
|
+
"aria-live": "polite"
|
|
226
|
+
}, null, 14, Se));
|
|
227
|
+
}
|
|
228
|
+
}), Ee = ["aria-label"], ke = ["aria-label", "aria-selected", "onClick", "onKeydown"], Te = /* @__PURE__ */ N({
|
|
229
|
+
__name: "color-swatch",
|
|
230
|
+
props: {
|
|
231
|
+
swatch: {}
|
|
232
|
+
},
|
|
233
|
+
setup(f) {
|
|
234
|
+
const { setColor: i, colorValue: s } = E();
|
|
235
|
+
function o(c, v) {
|
|
236
|
+
c.preventDefault(), i(v);
|
|
237
|
+
}
|
|
238
|
+
const l = M(() => s.value.toHexString());
|
|
239
|
+
function p(c) {
|
|
240
|
+
const v = O(c).toHexString();
|
|
241
|
+
return l.value === v;
|
|
242
|
+
}
|
|
243
|
+
return (c, v) => f.swatch ? ($(), R("div", {
|
|
244
|
+
key: 0,
|
|
245
|
+
role: "listbox",
|
|
246
|
+
"aria-label": c.$props["aria-label"] ?? "Color swatch",
|
|
247
|
+
"huey-swatch": ""
|
|
248
|
+
}, [
|
|
249
|
+
($(!0), R(ye, null, $e(f.swatch, (t) => ($(), R("div", {
|
|
250
|
+
key: t,
|
|
251
|
+
tabindex: "0",
|
|
252
|
+
role: "option",
|
|
253
|
+
"aria-label": t,
|
|
254
|
+
"huey-swatch-color": "",
|
|
255
|
+
"aria-selected": p(t),
|
|
256
|
+
style: X({ "--swatch-color": t }),
|
|
257
|
+
onClick: (e) => o(e, t),
|
|
258
|
+
onKeydown: g(w((e) => o(e, t), ["prevent"]), ["enter", "space"])
|
|
259
|
+
}, null, 44, ke))), 128))
|
|
260
|
+
], 8, Ee)) : se("", !0);
|
|
261
|
+
}
|
|
262
|
+
}), De = /* @__PURE__ */ N({
|
|
263
|
+
__name: "green-input",
|
|
264
|
+
setup(f) {
|
|
265
|
+
const { min: i, max: s } = P("g"), { hue: o, saturation: l, lightness: p, colorValue: c } = E(), { g: v } = c.value.toRgb(), t = k(v.toFixed(0));
|
|
266
|
+
H([o, l, p], ([r, u, a]) => {
|
|
267
|
+
const { g: h } = Z(r, u, a), d = h.toFixed(0);
|
|
268
|
+
t.value !== d && (t.value = d);
|
|
269
|
+
});
|
|
270
|
+
function e(r, u) {
|
|
271
|
+
r.value = String(u), t.value = r.value;
|
|
272
|
+
const { r: a, b: h } = c.value.toRgb(), { h: d, s: _, l: y } = ee(a / 255, u / 255, h / 255);
|
|
273
|
+
o.value = d, l.value = _, p.value = y;
|
|
274
|
+
}
|
|
275
|
+
function n(r) {
|
|
276
|
+
const u = r.target, a = Number(u.value);
|
|
277
|
+
if (Number.isNaN(a) || a < i || a > s) {
|
|
278
|
+
u.value = t.value;
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
e(u, a);
|
|
282
|
+
}
|
|
283
|
+
function m(r, u) {
|
|
284
|
+
const a = r.target, h = Number(a.value);
|
|
285
|
+
let d = r.shiftKey ? 10 : 1;
|
|
286
|
+
d *= u === "down" ? -1 : 1;
|
|
287
|
+
const _ = Number.isNaN(h) ? Number(t.value) : h, y = Math.min(s, Math.max(i, _ + d));
|
|
288
|
+
e(a, y);
|
|
289
|
+
}
|
|
290
|
+
return (r, u) => ($(), F(U, {
|
|
291
|
+
value: t.value,
|
|
292
|
+
onKeydown: [
|
|
293
|
+
g(w(n, ["prevent"]), ["enter"]),
|
|
294
|
+
u[0] || (u[0] = g(w((a) => m(a, "up"), ["prevent"]), ["up"])),
|
|
295
|
+
u[1] || (u[1] = g(w((a) => m(a, "down"), ["prevent"]), ["down"]))
|
|
296
|
+
],
|
|
297
|
+
onBlur: n
|
|
298
|
+
}, null, 8, ["value", "onKeydown"]));
|
|
299
|
+
}
|
|
300
|
+
}), Me = ["id", "value", "onKeydown"], Pe = /* @__PURE__ */ N({
|
|
301
|
+
__name: "hex-input",
|
|
302
|
+
setup(f) {
|
|
303
|
+
const { hue: i, saturation: s, lightness: o, colorValue: l, alpha: p } = E(), c = k(l.value.toHex().toUpperCase());
|
|
304
|
+
H(l, (r) => {
|
|
305
|
+
c.value = r.toHex().toUpperCase();
|
|
306
|
+
});
|
|
307
|
+
function v(r) {
|
|
308
|
+
const u = r.target, a = u.value;
|
|
309
|
+
if (!j(a)) {
|
|
310
|
+
u.value = c.value;
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
n(u, a);
|
|
314
|
+
}
|
|
315
|
+
function t(r, u) {
|
|
316
|
+
const a = Number.parseInt(r, 16);
|
|
317
|
+
return a + u < 0 ? "00" : a + u > 255 ? "FF" : ((a + u + 256) % 256).toString(16).toUpperCase().padStart(2, "0");
|
|
318
|
+
}
|
|
319
|
+
function e(r, u) {
|
|
320
|
+
const a = r.target, h = a.value, d = h.replace(/^#/, "").slice(0, 6);
|
|
321
|
+
if (!j(h) && j(d)) {
|
|
322
|
+
a.value = d;
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
if (!j(d)) {
|
|
326
|
+
a.value = c.value;
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
const _ = d.match(/.{2}/g);
|
|
330
|
+
let y = r.shiftKey ? 10 : 1;
|
|
331
|
+
y *= u === "down" ? -1 : 1;
|
|
332
|
+
const { selectionEnd: S, selectionStart: C } = a, V = C ?? 0, x = S ?? 0;
|
|
333
|
+
if (x - V === a.value.length) {
|
|
334
|
+
let B = "";
|
|
335
|
+
_?.forEach((A) => {
|
|
336
|
+
B = B.concat(t(A, y));
|
|
337
|
+
}), n(a, B), a.setSelectionRange(0, a.value.length);
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
let T, I;
|
|
341
|
+
V === x ? (T = Math.min(Math.floor(V / 2), 2), I = T) : (T = Math.floor(V / 2), I = Math.floor((x - 1) / 2));
|
|
342
|
+
let D = "";
|
|
343
|
+
_?.forEach((B, A) => {
|
|
344
|
+
A >= T && A <= I ? D = D.concat(t(B, y)) : D = D.concat(B);
|
|
345
|
+
}), n(a, D);
|
|
346
|
+
const W = T * 2, Y = (I + 1) * 2;
|
|
347
|
+
a.setSelectionRange(W, Y);
|
|
348
|
+
}
|
|
349
|
+
function n(r, u) {
|
|
350
|
+
r.value = String(u), c.value = r.value.toUpperCase();
|
|
351
|
+
const a = O(c.value), { h, s: d, l: _ } = a.toHsl();
|
|
352
|
+
d > 0 && (i.value = h), s.value = d, o.value = _, p.value = a.getAlpha();
|
|
353
|
+
}
|
|
354
|
+
function m(r) {
|
|
355
|
+
r.target.setSelectionRange(0, -1);
|
|
356
|
+
}
|
|
357
|
+
return (r, u) => ($(), R("input", {
|
|
358
|
+
id: r.$props.id,
|
|
359
|
+
value: c.value,
|
|
360
|
+
"huey-input": "",
|
|
361
|
+
type: "text",
|
|
362
|
+
autocomplete: "off",
|
|
363
|
+
spellcheck: "false",
|
|
364
|
+
onKeydown: [
|
|
365
|
+
g(w(v, ["prevent"]), ["enter"]),
|
|
366
|
+
u[0] || (u[0] = g(w((a) => e(a, "up"), ["prevent"]), ["up"])),
|
|
367
|
+
u[1] || (u[1] = g(w((a) => e(a, "down"), ["prevent"]), ["down"]))
|
|
368
|
+
],
|
|
369
|
+
onBlur: v,
|
|
370
|
+
onFocus: m
|
|
371
|
+
}, null, 40, Me));
|
|
372
|
+
}
|
|
373
|
+
}), Ue = /* @__PURE__ */ N({
|
|
374
|
+
__name: "hue-input",
|
|
375
|
+
setup(f) {
|
|
376
|
+
const { min: i, max: s } = P("h"), { hue: o } = E(), l = k(o.value.toFixed(0));
|
|
377
|
+
H(o, (t) => {
|
|
378
|
+
const e = t.toFixed(0);
|
|
379
|
+
l.value !== e && (l.value = e);
|
|
380
|
+
});
|
|
381
|
+
function p(t, e) {
|
|
382
|
+
t.value = String(e), l.value = t.value, o.value = e;
|
|
383
|
+
}
|
|
384
|
+
function c(t) {
|
|
385
|
+
const e = t.target, n = Number(e.value);
|
|
386
|
+
if (Number.isNaN(n) || n < i || n > s) {
|
|
387
|
+
e.value = l.value;
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
p(e, n);
|
|
391
|
+
}
|
|
392
|
+
function v(t, e) {
|
|
393
|
+
const n = t.target, m = Number(n.value);
|
|
394
|
+
let r = t.shiftKey ? 10 : 1;
|
|
395
|
+
r *= e === "down" ? -1 : 1;
|
|
396
|
+
const u = Number.isNaN(m) ? Number(l.value) : m, a = Math.min(s, Math.max(i, u + r));
|
|
397
|
+
p(n, a);
|
|
398
|
+
}
|
|
399
|
+
return (t, e) => ($(), F(U, {
|
|
400
|
+
value: l.value,
|
|
401
|
+
onKeydown: [
|
|
402
|
+
g(w(c, ["prevent"]), ["enter"]),
|
|
403
|
+
e[0] || (e[0] = g(w((n) => v(n, "up"), ["prevent"]), ["up"])),
|
|
404
|
+
e[1] || (e[1] = g(w((n) => v(n, "down"), ["prevent"]), ["down"]))
|
|
405
|
+
],
|
|
406
|
+
onBlur: c
|
|
407
|
+
}, null, 8, ["value", "onKeydown"]));
|
|
408
|
+
}
|
|
409
|
+
}), Ie = /* @__PURE__ */ N({
|
|
410
|
+
__name: "hue-slider",
|
|
411
|
+
setup(f) {
|
|
412
|
+
const { hue: i } = E(), s = M(() => `hsl(${i.value}, 100%, 50%)`);
|
|
413
|
+
return (o, l) => ($(), F(J, L({ ...o.$props }, {
|
|
414
|
+
modelValue: K(i),
|
|
415
|
+
"onUpdate:modelValue": l[0] || (l[0] = (p) => G(i) ? i.value = p : null),
|
|
416
|
+
"aria-label": o.$props["aria-label"] ?? "Hue slider",
|
|
417
|
+
"huey-slider": "",
|
|
418
|
+
max: 360,
|
|
419
|
+
min: 0,
|
|
420
|
+
step: 1,
|
|
421
|
+
style: {
|
|
422
|
+
background: "linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%)",
|
|
423
|
+
"--huey-thumb-color": s.value
|
|
424
|
+
}
|
|
425
|
+
}), null, 16, ["modelValue", "aria-label", "style"]));
|
|
426
|
+
}
|
|
427
|
+
}), Ae = /* @__PURE__ */ N({
|
|
428
|
+
__name: "huey-root",
|
|
429
|
+
props: {
|
|
430
|
+
modelValue: { required: !0 },
|
|
431
|
+
modelModifiers: {}
|
|
432
|
+
},
|
|
433
|
+
emits: ["update:modelValue"],
|
|
434
|
+
setup(f) {
|
|
435
|
+
const i = ue(f, "modelValue");
|
|
436
|
+
if (!i.value)
|
|
437
|
+
throw new Error("<HueyRoot> is missing required v-model of type HueyColor");
|
|
438
|
+
const s = k(0), o = k(0), l = k(0), p = k(1);
|
|
439
|
+
let c = !1;
|
|
440
|
+
H(
|
|
441
|
+
() => i,
|
|
442
|
+
(t) => {
|
|
443
|
+
if (c) {
|
|
444
|
+
c = !1;
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
const n = O(t.value).toHsl();
|
|
448
|
+
s.value = n.h, o.value = n.s, l.value = n.l, p.value = n.a;
|
|
449
|
+
},
|
|
450
|
+
{ immediate: !0 }
|
|
451
|
+
), H([s, o, l, p], ([t, e, n, m]) => {
|
|
452
|
+
c = !0;
|
|
453
|
+
const r = O(`hsla(${b(t, 0, 360)}, ${b(e, 0, 100)}%, ${b(n, 0, 100)}%, ${b(m, 0, 1)})`);
|
|
454
|
+
i.value = r;
|
|
455
|
+
});
|
|
456
|
+
function v(t) {
|
|
457
|
+
const n = O(t).toHsl();
|
|
458
|
+
s.value = b(n.h, 0, 360), o.value = b(n.s, 0, 100), l.value = b(n.l, 0, 100), p.value = b(n.a, 0, 1);
|
|
459
|
+
}
|
|
460
|
+
return xe(de, { hue: s, saturation: o, lightness: l, alpha: p, colorValue: i, setColor: v }), (t, e) => ie(t.$slots, "default");
|
|
461
|
+
}
|
|
462
|
+
}), fe = /* @__PURE__ */ N({
|
|
463
|
+
__name: "color-thumb",
|
|
464
|
+
props: {
|
|
465
|
+
class: {}
|
|
466
|
+
},
|
|
467
|
+
setup(f) {
|
|
468
|
+
const i = f;
|
|
469
|
+
return (s, o) => ($(), R("div", L({ "huey-slider-thumb": "" }, { ...i }), null, 16));
|
|
470
|
+
}
|
|
471
|
+
}), Oe = /* @__PURE__ */ N({
|
|
472
|
+
__name: "lightness-input",
|
|
473
|
+
setup(f) {
|
|
474
|
+
const { min: i, max: s } = P("l"), { lightness: o } = E(), l = k(o.value.toFixed(0));
|
|
475
|
+
H(o, (t) => {
|
|
476
|
+
const e = t.toFixed(0);
|
|
477
|
+
l.value !== e && (l.value = e);
|
|
478
|
+
});
|
|
479
|
+
function p(t, e) {
|
|
480
|
+
t.value = String(e), l.value = t.value, o.value = e;
|
|
481
|
+
}
|
|
482
|
+
function c(t) {
|
|
483
|
+
const e = t.target, n = Number(e.value);
|
|
484
|
+
if (Number.isNaN(n) || n < i || n > s) {
|
|
485
|
+
e.value = l.value;
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
p(e, n);
|
|
489
|
+
}
|
|
490
|
+
function v(t, e) {
|
|
491
|
+
const n = t.target, m = Number(n.value);
|
|
492
|
+
let r = t.shiftKey ? 10 : 1;
|
|
493
|
+
r *= e === "down" ? -1 : 1;
|
|
494
|
+
const u = Number.isNaN(m) ? Number(l.value) : m, a = Math.min(s, Math.max(i, u + r));
|
|
495
|
+
p(n, a);
|
|
496
|
+
}
|
|
497
|
+
return (t, e) => ($(), F(U, {
|
|
498
|
+
value: l.value,
|
|
499
|
+
onKeydown: [
|
|
500
|
+
g(w(c, ["prevent"]), ["enter"]),
|
|
501
|
+
e[0] || (e[0] = g(w((n) => v(n, "up"), ["prevent"]), ["up"])),
|
|
502
|
+
e[1] || (e[1] = g(w((n) => v(n, "down"), ["prevent"]), ["down"]))
|
|
503
|
+
],
|
|
504
|
+
onBlur: c
|
|
505
|
+
}, null, 8, ["value", "onKeydown"]));
|
|
506
|
+
}
|
|
507
|
+
}), ze = /* @__PURE__ */ N({
|
|
508
|
+
__name: "lightness-slider",
|
|
509
|
+
setup(f) {
|
|
510
|
+
const { hue: i, saturation: s, lightness: o } = E(), l = M(() => `hsl(${i.value}, ${s.value}%, ${o.value}%)`), p = M(() => `linear-gradient(to right, #000, hsl(${i.value}, ${s.value}%, 50%), #fff)`);
|
|
511
|
+
return (c, v) => ($(), F(J, L({ ...c.$props }, {
|
|
512
|
+
modelValue: K(o),
|
|
513
|
+
"onUpdate:modelValue": v[0] || (v[0] = (t) => G(o) ? o.value = t : null),
|
|
514
|
+
"aria-label": c.$props["aria-label"] ?? "Lightness slider",
|
|
515
|
+
"huey-slider": "",
|
|
516
|
+
max: 100,
|
|
517
|
+
min: 0,
|
|
518
|
+
step: 1,
|
|
519
|
+
style: {
|
|
520
|
+
background: p.value,
|
|
521
|
+
"--huey-thumb-color": l.value
|
|
522
|
+
}
|
|
523
|
+
}), null, 16, ["modelValue", "aria-label", "style"]));
|
|
524
|
+
}
|
|
525
|
+
}), Xe = /* @__PURE__ */ N({
|
|
526
|
+
__name: "red-input",
|
|
527
|
+
setup(f) {
|
|
528
|
+
const { min: i, max: s } = P("r"), { hue: o, saturation: l, lightness: p, colorValue: c } = E(), { r: v } = c.value.toRgb(), t = k(v.toFixed(0));
|
|
529
|
+
H([o, l, p], ([r, u, a]) => {
|
|
530
|
+
const { r: h } = Z(r, u, a), d = h.toFixed(0);
|
|
531
|
+
t.value !== d && (t.value = d);
|
|
532
|
+
});
|
|
533
|
+
function e(r, u) {
|
|
534
|
+
r.value = String(u), t.value = r.value;
|
|
535
|
+
const { g: a, b: h } = c.value.toRgb(), { h: d, s: _, l: y } = ee(u / 255, a / 255, h / 255);
|
|
536
|
+
o.value = d, l.value = _, p.value = y;
|
|
537
|
+
}
|
|
538
|
+
function n(r) {
|
|
539
|
+
const u = r.target, a = Number(u.value);
|
|
540
|
+
if (Number.isNaN(a) || a < i || a > s) {
|
|
541
|
+
u.value = t.value;
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
e(u, a);
|
|
545
|
+
}
|
|
546
|
+
function m(r, u) {
|
|
547
|
+
const a = r.target, h = Number(a.value);
|
|
548
|
+
let d = r.shiftKey ? 10 : 1;
|
|
549
|
+
d *= u === "down" ? -1 : 1;
|
|
550
|
+
const _ = Number.isNaN(h) ? Number(t.value) : h, y = Math.min(s, Math.max(i, _ + d));
|
|
551
|
+
e(a, y);
|
|
552
|
+
}
|
|
553
|
+
return (r, u) => ($(), F(U, {
|
|
554
|
+
value: t.value,
|
|
555
|
+
onKeydown: [
|
|
556
|
+
g(w(n, ["prevent"]), ["enter"]),
|
|
557
|
+
u[0] || (u[0] = g(w((a) => m(a, "up"), ["prevent"]), ["up"])),
|
|
558
|
+
u[1] || (u[1] = g(w((a) => m(a, "down"), ["prevent"]), ["down"]))
|
|
559
|
+
],
|
|
560
|
+
onBlur: n
|
|
561
|
+
}, null, 8, ["value", "onKeydown"]));
|
|
562
|
+
}
|
|
563
|
+
}), We = /* @__PURE__ */ N({
|
|
564
|
+
__name: "saturation-area",
|
|
565
|
+
props: {
|
|
566
|
+
colorFormat: { default: "hsl" }
|
|
567
|
+
},
|
|
568
|
+
setup(f) {
|
|
569
|
+
const i = f, { hue: s, saturation: o, lightness: l } = E(), p = le("area"), c = k(q(s.value, o.value, l.value).s), v = k(!1);
|
|
570
|
+
H([s, o, l], () => {
|
|
571
|
+
v.value || (c.value = q(s.value, o.value, l.value).s);
|
|
572
|
+
});
|
|
573
|
+
const t = M(() => {
|
|
574
|
+
const S = `hsl(${s.value}, 100%, 50%)`;
|
|
575
|
+
return i.colorFormat === "hsl" ? `linear-gradient(to top, black, transparent, white), linear-gradient(to right, hsl(0, 0%, 50%), transparent), ${S}` : `linear-gradient(to top, black, transparent), linear-gradient(to right, white, transparent),
|
|
576
|
+
${S}`;
|
|
577
|
+
}), e = M(() => `hsl(${s.value}, ${o.value}%, ${l.value}%)`);
|
|
578
|
+
function n(S) {
|
|
579
|
+
S.preventDefault();
|
|
580
|
+
const C = p.value;
|
|
581
|
+
if (!C)
|
|
582
|
+
return;
|
|
583
|
+
const V = C.clientWidth, x = C.clientHeight, { x: z, y: T } = ce(C), { x: I, y: D } = ve(S), W = b(I - z, 0, V), Y = b(D - T, 0, x);
|
|
584
|
+
if (i.colorFormat === "hsl") {
|
|
585
|
+
o.value = W / V * 100, l.value = b(1 - Y / x, 0, 1) * 100;
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
const B = W / V * 100, A = b(1 - Y / x, 0, 1) * 100;
|
|
589
|
+
c.value = B;
|
|
590
|
+
const te = ae(s.value, B, A);
|
|
591
|
+
o.value = te.s, l.value = te.l;
|
|
592
|
+
}
|
|
593
|
+
const m = M(() => i.colorFormat === "hsl" ? `${o.value}%` : `${c.value}%`), r = M(() => i.colorFormat === "hsl" ? `${100 - l.value}%` : `${100 - q(s.value, o.value, l.value).v}%`);
|
|
594
|
+
function u() {
|
|
595
|
+
v.value = !0, me(), window.addEventListener("mousemove", n), window.addEventListener("mouseup", n), window.addEventListener("mouseup", y);
|
|
596
|
+
}
|
|
597
|
+
function a(S) {
|
|
598
|
+
v.value = !0, n(S), window.addEventListener("touchend", h);
|
|
599
|
+
}
|
|
600
|
+
function h() {
|
|
601
|
+
v.value = !1, window.removeEventListener("touchend", h);
|
|
602
|
+
}
|
|
603
|
+
function d(S) {
|
|
604
|
+
const C = pe(S), V = S.shiftKey ? 10 : 1;
|
|
605
|
+
if (!C)
|
|
606
|
+
return;
|
|
607
|
+
if (v.value = !0, i.colorFormat === "hsl") {
|
|
608
|
+
switch (C) {
|
|
609
|
+
case "left":
|
|
610
|
+
o.value = b(o.value - V, 0, 100);
|
|
611
|
+
break;
|
|
612
|
+
case "down":
|
|
613
|
+
l.value = b(l.value - V, 0, 100);
|
|
614
|
+
break;
|
|
615
|
+
case "right":
|
|
616
|
+
o.value = b(o.value + V, 0, 100);
|
|
617
|
+
break;
|
|
618
|
+
case "up":
|
|
619
|
+
l.value = b(l.value + V, 0, 100);
|
|
620
|
+
break;
|
|
621
|
+
}
|
|
622
|
+
v.value = !1;
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
const x = q(s.value, o.value, l.value);
|
|
626
|
+
switch (x.s = c.value, C) {
|
|
627
|
+
case "left":
|
|
628
|
+
x.s = b(x.s - V, 0, 100);
|
|
629
|
+
break;
|
|
630
|
+
case "down":
|
|
631
|
+
x.v = b(x.v - V, 0, 100);
|
|
632
|
+
break;
|
|
633
|
+
case "right":
|
|
634
|
+
x.s = b(x.s + V, 0, 100);
|
|
635
|
+
break;
|
|
636
|
+
case "up":
|
|
637
|
+
x.v = b(x.v + V, 0, 100);
|
|
638
|
+
break;
|
|
639
|
+
}
|
|
640
|
+
c.value = x.s;
|
|
641
|
+
const z = ae(s.value, x.s, x.v);
|
|
642
|
+
o.value = z.s, l.value = z.l, v.value = !1;
|
|
643
|
+
}
|
|
644
|
+
function _() {
|
|
645
|
+
window.removeEventListener("mousemove", n), window.removeEventListener("mouseup", n), window.removeEventListener("mouseup", y), window.removeEventListener("touchend", h);
|
|
646
|
+
}
|
|
647
|
+
function y() {
|
|
648
|
+
v.value = !1, he(), _();
|
|
649
|
+
}
|
|
650
|
+
return oe(() => {
|
|
651
|
+
_();
|
|
652
|
+
}), (S, C) => ($(), R("div", {
|
|
653
|
+
ref: "area",
|
|
654
|
+
role: "group",
|
|
655
|
+
"huey-area": "",
|
|
656
|
+
style: X({
|
|
657
|
+
background: t.value,
|
|
658
|
+
"--huey-thumb-color": e.value
|
|
659
|
+
}),
|
|
660
|
+
onMousedown: u,
|
|
661
|
+
onTouchmovePassive: n,
|
|
662
|
+
onTouchstartPassive: a
|
|
663
|
+
}, [
|
|
664
|
+
re(K(fe), {
|
|
665
|
+
style: X({
|
|
666
|
+
top: r.value,
|
|
667
|
+
left: m.value
|
|
668
|
+
}),
|
|
669
|
+
tabindex: "0",
|
|
670
|
+
role: "slider",
|
|
671
|
+
"aria-label": "Color thumb",
|
|
672
|
+
"aria-valuenow": Math.round(K(o)),
|
|
673
|
+
"aria-valuemin": 0,
|
|
674
|
+
"aria-valuemax": 100,
|
|
675
|
+
"aria-valuetext": `Saturation ${Math.round(K(o))}%, Lightness ${Math.round(K(l))}%`,
|
|
676
|
+
onKeydown: d
|
|
677
|
+
}, null, 8, ["style", "aria-valuenow", "aria-valuetext"])
|
|
678
|
+
], 36));
|
|
679
|
+
}
|
|
680
|
+
}), Ye = /* @__PURE__ */ N({
|
|
681
|
+
__name: "saturation-input",
|
|
682
|
+
setup(f) {
|
|
683
|
+
const { min: i, max: s } = P("s"), { saturation: o } = E(), l = k(o.value.toFixed(0));
|
|
684
|
+
H(o, (t) => {
|
|
685
|
+
const e = t.toFixed(0);
|
|
686
|
+
l.value !== e && (l.value = e);
|
|
687
|
+
});
|
|
688
|
+
function p(t, e) {
|
|
689
|
+
t.value = String(e), l.value = t.value, o.value = e;
|
|
690
|
+
}
|
|
691
|
+
function c(t) {
|
|
692
|
+
const e = t.target, n = Number(e.value);
|
|
693
|
+
if (Number.isNaN(n) || n < i || n > s) {
|
|
694
|
+
e.value = l.value;
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
p(e, n);
|
|
698
|
+
}
|
|
699
|
+
function v(t, e) {
|
|
700
|
+
const n = t.target, m = Number(n.value);
|
|
701
|
+
let r = t.shiftKey ? 10 : 1;
|
|
702
|
+
r *= e === "down" ? -1 : 1;
|
|
703
|
+
const u = Number.isNaN(m) ? Number(l.value) : m, a = Math.min(s, Math.max(i, u + r));
|
|
704
|
+
p(n, a);
|
|
705
|
+
}
|
|
706
|
+
return (t, e) => ($(), F(U, {
|
|
707
|
+
value: l.value,
|
|
708
|
+
onKeydown: [
|
|
709
|
+
g(w(c, ["prevent"]), ["enter"]),
|
|
710
|
+
e[0] || (e[0] = g(w((n) => v(n, "up"), ["prevent"]), ["up"])),
|
|
711
|
+
e[1] || (e[1] = g(w((n) => v(n, "down"), ["prevent"]), ["down"]))
|
|
712
|
+
],
|
|
713
|
+
onBlur: c
|
|
714
|
+
}, null, 8, ["value", "onKeydown"]));
|
|
715
|
+
}
|
|
716
|
+
}), je = /* @__PURE__ */ N({
|
|
717
|
+
__name: "saturation-slider",
|
|
718
|
+
setup(f) {
|
|
719
|
+
const { hue: i, saturation: s } = E(), o = M(() => `hsl(${i.value}, ${s.value}%, 50%)`), l = M(() => `linear-gradient(to right, hsl(${i.value}, 0%, 50%), hsl(${i.value}, 100%, 50%))`);
|
|
720
|
+
return (p, c) => ($(), F(J, L({ ...p.$props }, {
|
|
721
|
+
modelValue: K(s),
|
|
722
|
+
"onUpdate:modelValue": c[0] || (c[0] = (v) => G(s) ? s.value = v : null),
|
|
723
|
+
"aria-label": p.$props["aria-label"] ?? "Saturation slider",
|
|
724
|
+
"huey-slider": "",
|
|
725
|
+
max: 100,
|
|
726
|
+
min: 0,
|
|
727
|
+
step: 1,
|
|
728
|
+
style: {
|
|
729
|
+
background: l.value,
|
|
730
|
+
"--huey-thumb-color": o.value
|
|
731
|
+
}
|
|
732
|
+
}), null, 16, ["modelValue", "aria-label", "style"]));
|
|
733
|
+
}
|
|
734
|
+
});
|
|
735
|
+
export {
|
|
736
|
+
He as AlphaInput,
|
|
737
|
+
Fe as AlphaSlider,
|
|
738
|
+
Re as BlueInput,
|
|
739
|
+
Be as ColorDropper,
|
|
740
|
+
Le as ColorPreview,
|
|
741
|
+
Te as ColorSwatch,
|
|
742
|
+
De as GreenInput,
|
|
743
|
+
de as HUEY_CONTEXT,
|
|
744
|
+
Pe as HexInput,
|
|
745
|
+
Ue as HueInput,
|
|
746
|
+
Ie as HueSlider,
|
|
747
|
+
Ae as HueyRoot,
|
|
748
|
+
Oe as LightnessInput,
|
|
749
|
+
ze as LightnessSlider,
|
|
750
|
+
Xe as RedInput,
|
|
751
|
+
We as SaturationArea,
|
|
752
|
+
Ye as SaturationInput,
|
|
753
|
+
je as SaturationSlider,
|
|
754
|
+
E as useHueyContext
|
|
755
|
+
};
|
package/dist/main.d.ts
ADDED
|
File without changes
|
package/dist/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/dist/vue.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[huey-slider-track]{--huey-slider-track-height: 16px;--huey-slider-track-width: 129px;position:relative;width:var(--huey-slider-track-width);height:var(--huey-slider-track-height);border-radius:calc(1px * infinity)}[huey-slider-track] [huey-slider-thumb]{height:var(--huey-slider-track-height)}[huey-slider]{background:var(--huey-slider-bg)}[huey-preview]{--preview-tile: 20px;--opacity-tile: calc(var(--preview-tile) - 50%);overflow:hidden;position:relative;display:inline-block;width:var(--preview-tile);height:var(--preview-tile);border-radius:calc(var(--preview-tile) - 80%)}[huey-preview]:before{content:"";display:block;margin-left:auto;width:50%;height:100%;opacity:var(--v848a7ffe);background:url(data:image/svg+xml;utf8,%3Csvg%20width%3D%226%22%20height%3D%226%22%20viewBox%3D%220%200%206%206%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M0%200H3V3H0V0Z%22%20fill%3D%22%23E1E1E1%22/%3E%3Cpath%20d%3D%22M3%200H6V3H3V0Z%22%20fill%3D%22white%22/%3E%3Cpath%20d%3D%22M3%203H6V6H3V3Z%22%20fill%3D%22%23E1E1E1%22/%3E%3Cpath%20d%3D%22M0%203H3V6H0V3Z%22%20fill%3D%22white%22/%3E%3C/svg%3E%0A)}[huey-preview][data-split-view=false]:before{width:100%}[huey-swatch]{display:flex;align-items:center;justify-content:center;gap:8px}[huey-swatch-color]{cursor:pointer;width:24px;height:24px;background-color:var(--swatch-color);border-radius:4px}[huey-slider-thumb]{position:absolute;transform:translate(-50%,-50%);top:50%;height:16px;aspect-ratio:1 / 1;background-color:var(--huey-thumb-color, white);border-radius:calc(infinity * 1px);box-shadow:0 0 0 2px #fff}[huey-area]{position:relative;width:240px;height:230px;border-radius:12px}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hueycolor/vue",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.1-beta.3",
|
|
5
|
+
"private": false,
|
|
6
|
+
"description": "Composable color picker components for Vue",
|
|
7
|
+
"author": "Eihab Khan <yo@eihab.me>",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/hueycolor/huey"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"vue",
|
|
15
|
+
"vue3",
|
|
16
|
+
"color-picker",
|
|
17
|
+
"colorpicker",
|
|
18
|
+
"color",
|
|
19
|
+
"colour",
|
|
20
|
+
"hsl",
|
|
21
|
+
"rgb",
|
|
22
|
+
"hex",
|
|
23
|
+
"vue-component",
|
|
24
|
+
"huey"
|
|
25
|
+
],
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js",
|
|
30
|
+
"require": "./dist/index.cjs"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"main": "./dist/index.cjs",
|
|
34
|
+
"module": "./dist/index.js",
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"files": [
|
|
37
|
+
"dist"
|
|
38
|
+
],
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"vue": "^3.3.0"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@hueycolor/core": "0.0.1-beta.3"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/node": "^24.10.1",
|
|
47
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
48
|
+
"@vue/tsconfig": "^0.8.1",
|
|
49
|
+
"typescript": "~5.9.3",
|
|
50
|
+
"vite": "^7.2.4",
|
|
51
|
+
"vite-plugin-dts": "^4.5.4",
|
|
52
|
+
"vue": "^3.5.24",
|
|
53
|
+
"vue-tsc": "^3.1.4"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"dev": "vite",
|
|
57
|
+
"build": "vue-tsc -b && vite build",
|
|
58
|
+
"preview": "vite preview"
|
|
59
|
+
}
|
|
60
|
+
}
|