pickit-color 1.0.0
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 +44 -0
- package/README.md +170 -0
- package/dist/colorpicker.css +881 -0
- package/dist/colorpicker.js +929 -0
- package/dist/colorpicker.min.css +1 -0
- package/dist/colorpicker.min.js +2 -0
- package/dist/esm/index.js +820 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/index.d.ts +79 -0
- package/package.json +69 -0
- package/src/README.md +292 -0
- package/src/colorpicker.d.ts +52 -0
- package/src/colorpicker.styl +719 -0
- package/src/index.ts +1181 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../src/colorpicker.d.ts","../../src/index.ts","../../node_modules/@types/node/globals.d.ts","../../node_modules/@types/node/async_hooks.d.ts","../../node_modules/@types/node/buffer.d.ts","../../node_modules/@types/node/child_process.d.ts","../../node_modules/@types/node/cluster.d.ts","../../node_modules/@types/node/console.d.ts","../../node_modules/@types/node/constants.d.ts","../../node_modules/@types/node/crypto.d.ts","../../node_modules/@types/node/dgram.d.ts","../../node_modules/@types/node/dns.d.ts","../../node_modules/@types/node/domain.d.ts","../../node_modules/@types/node/events.d.ts","../../node_modules/@types/node/fs.d.ts","../../node_modules/@types/node/fs/promises.d.ts","../../node_modules/@types/node/http.d.ts","../../node_modules/@types/node/http2.d.ts","../../node_modules/@types/node/https.d.ts","../../node_modules/@types/node/inspector.d.ts","../../node_modules/@types/node/module.d.ts","../../node_modules/@types/node/net.d.ts","../../node_modules/@types/node/os.d.ts","../../node_modules/@types/node/path.d.ts","../../node_modules/@types/node/perf_hooks.d.ts","../../node_modules/@types/node/process.d.ts","../../node_modules/@types/node/punycode.d.ts","../../node_modules/@types/node/querystring.d.ts","../../node_modules/@types/node/readline.d.ts","../../node_modules/@types/node/repl.d.ts","../../node_modules/@types/node/stream.d.ts","../../node_modules/@types/node/string_decoder.d.ts","../../node_modules/@types/node/timers.d.ts","../../node_modules/@types/node/tls.d.ts","../../node_modules/@types/node/trace_events.d.ts","../../node_modules/@types/node/tty.d.ts","../../node_modules/@types/node/url.d.ts","../../node_modules/@types/node/util.d.ts","../../node_modules/@types/node/v8.d.ts","../../node_modules/@types/node/vm.d.ts","../../node_modules/@types/node/worker_threads.d.ts","../../node_modules/@types/node/zlib.d.ts","../../node_modules/@types/node/ts3.4/base.d.ts","../../node_modules/@types/node/globals.global.d.ts","../../node_modules/@types/node/wasi.d.ts","../../node_modules/@types/node/ts3.6/base.d.ts","../../node_modules/@types/node/assert.d.ts","../../node_modules/@types/node/base.d.ts","../../node_modules/@types/node/index.d.ts","../../node_modules/@types/stylus/index.d.ts"],"fileIdsList":[[80,81],[48,49,56,65],[40,48,56],[72],[44,49,57],[65],[46,48,56],[48],[48,50,65,71],[49],[56,65,71],[48,49,51,56,65,68,71],[48,51,68,71],[82],[71],[46,48,65],[38],[70],[48,65],[63,72,74],[44,46,56,65],[37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76],[77,78,79],[56],[62],[48,50,65,71,74],[48,83]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},"e7662e79ae21b1f16ea6bd668b238d79a7f4337f5ad95de573356bfa086275f8","a092af7dc8e35af34e084706c117c17fe357d5068cb95318a6ef12c2395dd5b1",{"version":"215d8d9a2c480fd460127edc048d68d9931d3b27f95132253a6e71975f060bb1","affectsGlobalScope":true,"impliedFormat":1},{"version":"c438b413e94ff76dfa20ae005f33a1c84f2480d1d66e0fd687501020d0de9b50","impliedFormat":1},{"version":"bc6a78961535181265845bf9b9e8a147ffd0ca275097ceb670a9b92afa825152","impliedFormat":1},{"version":"987249e7b75023387c5fd9dc2f959ee777cb8989b7900f5a9eb4a67d290f2cba","impliedFormat":1},{"version":"123ec69e4b3a686eb49afd94ebe3292a5c84a867ecbcb6bb84bdd720a12af803","impliedFormat":1},{"version":"eb5197aade83cb0e360ac407289c53a8009e8fdae7939892a0240d30444496b6","affectsGlobalScope":true,"impliedFormat":1},{"version":"90c85ddbb8de82cd19198bda062065fc51b7407c0f206f2e399e65a52e979720","impliedFormat":1},{"version":"2636f61a2d5f76d4039c7110f65c407a028ec5265e03d855fc2cf62b198ac415","impliedFormat":1},{"version":"7e050b767ed10c7ffbc01f314defbf420bf0b5d54ce666e1c87507c035dfc191","impliedFormat":1},{"version":"7db7569fbb3e2b01ba8751c761cdd3f0debd104170d5665b7dc20a11630df3a9","impliedFormat":1},{"version":"cde4d7f6274468180fa39847b183aec22626e8212ff885d535c53f4cd7c225fd","affectsGlobalScope":true,"impliedFormat":1},{"version":"365e8358843a23944be84b810b1f774ea0223adfccc085f30fd7f4c13dc8a09f","affectsGlobalScope":true,"impliedFormat":1},{"version":"f87f95c015900102a5c0edcdebb17596de1382510e6cc17ab79f375d3505bb12","impliedFormat":1},{"version":"05b5679a897598ebe556ee93415b3af1f456e674ea82e4d7afcd716bfe43aa98","impliedFormat":1},{"version":"35fe02b2c10616cc7ac3db9c15778df7ed9c99276889efdd9be31f342841cfcd","impliedFormat":1},{"version":"1c3fe66943f587685aa4a42f664f794655da1767401d2f85910177dac78aa45d","impliedFormat":1},{"version":"c969bf4c7cdfe4d5dd28aa09432f99d09ad1d8d8b839959646579521d0467d1a","impliedFormat":1},{"version":"6c3857edaeeaaf43812f527830ebeece9266b6e8eb5271ab6d2f0008306c9947","impliedFormat":1},{"version":"bc6a77e750f4d34584e46b1405b771fb69a224197dd6bafe5b0392a29a70b665","impliedFormat":1},{"version":"8de97668870cfb20fc9d355d2ef379e897bdd8a98c889c7d8a6de40ee408ad52","impliedFormat":1},{"version":"ed4ae81196cccc10f297d228bca8d02e31058e6d723a3c5bc4be5fb3c61c6a34","impliedFormat":1},{"version":"84044697c8b3e08ef24e4b32cfe6440143d07e469a5e34bda0635276d32d9f35","impliedFormat":1},{"version":"4982d94cb6427263c8839d8d6324a8bbe129e931deb61a7380f8fad17ba2cfc0","impliedFormat":1},{"version":"ae4bc1dd4d9de7bbea6ce419db45af82a81358e6014c9e1235b5d252e06f8ab8","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f6a1fd73c9dc3bd7f4b79bc075297ca6527904df69b0f2c2c94e4c4c7d9a32c","impliedFormat":1},{"version":"884560fda6c3868f925f022adc3a1289fe6507bbb45adb10fa1bbcc73a941bb0","impliedFormat":1},{"version":"6b2bb67b0942bcfce93e1d6fad5f70afd54940a2b13df7f311201fba54b2cbe9","impliedFormat":1},{"version":"acbed967a379b3e9f73237ba9473f8b337eeea14b7dc64d445430b5d695751da","impliedFormat":1},{"version":"272a46cc8f494677af587d17939e61e7db2b1925633e4da0c186ba17f6732521","impliedFormat":1},{"version":"d67e08745494b000da9410c1ae2fdc9965fc6d593fe0f381a47491f75417d457","impliedFormat":1},{"version":"b40652bf8ce4a18133b31349086523b219724dca8df3448c1a0742528e7ad5b9","impliedFormat":1},{"version":"c52eb62e3388a01b966c57bd14ca0ee9d5f6e656d6a18f6ce6b7cdece63734a3","impliedFormat":1},{"version":"a77fdb357c78b70142b2fdbbfb72958d69e8f765fd2a3c69946c1018e89d4638","impliedFormat":1},{"version":"3c2ac350c3baa61fd2b1925844109e098f4376d0768a4643abc82754fd752748","impliedFormat":1},{"version":"80ffc1786a5dab91b4aa59a72720f02f25df8b7c76b593e04d5e381aec284ccb","impliedFormat":1},{"version":"f5b9d446783f075eed9e93dfba1a5055b3fd61aab285fef3bbc761eadf598204","impliedFormat":1},{"version":"289be113bad7ee27ee7fa5b1e373c964c9789a5e9ed7db5ddcb631371120b953","impliedFormat":1},{"version":"baf0b82ffc5d2616f44a6fb1f81e8d798545bebf0c30f5d8b003a1dba1acfb3f","impliedFormat":1},{"version":"c6a5b34f1e725019445754f1e733585f113e0dced75f137bd3c4af5853d3f6ab","impliedFormat":1},{"version":"15fbe50526244954eb2f933546bca6cdcf0db16c9428d099b3b386c1db5799ab","impliedFormat":1},{"version":"d44028ae0127eb3e9fcfa5f55a8b81d64775ce15aca1020fe25c511bbb055834","impliedFormat":1},{"version":"2708349d5a11a5c2e5f3a0765259ebe7ee00cdcc8161cb9990cb4910328442a1","affectsGlobalScope":true,"impliedFormat":1},{"version":"4e0a4d84b15692ea8669fe4f3d05a4f204567906b1347da7a58b75f45bae48d3","impliedFormat":1},{"version":"ad1ae5ae98eceb9af99061e83e867b9897d267aebc8f3b938c9424deabadf4bb","impliedFormat":1},{"version":"6fbe72eed85e363ad83b763e03be824558c6ea7456c7259a48bcf0afdeb9d7e4","impliedFormat":1},{"version":"e61a21e9418f279bc480394a94d1581b2dee73747adcbdef999b6737e34d721b","impliedFormat":1},{"version":"5825520e2099309182c6e2a2b3061b060d42a098c58f67d1754880a7e2cce99a","impliedFormat":1},{"version":"c6db2268b4c7189a5d33b3bbf6616f3cc83bdad97468a25a172901d7ec28ff82","impliedFormat":1}],"root":[35,36],"options":{"allowSyntheticDefaultImports":true,"esModuleInterop":true,"module":5,"noImplicitAny":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","removeComments":true,"strict":true,"target":1},"referencedMap":[[82,1],[40,2],[41,3],[42,4],[43,5],[44,6],[45,7],[47,8],[49,9],[50,10],[51,11],[52,12],[53,13],[83,14],[54,8],[55,15],[56,16],[59,17],[60,18],[63,19],[64,20],[65,8],[68,21],[77,22],[80,23],[70,24],[71,25],[73,6],[75,26],[76,6],[84,27]],"version":"5.9.3"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export interface ColorPickerOptions {
|
|
2
|
+
defaultColor?: string;
|
|
3
|
+
format?: "hex" | "rgb" | "hsl";
|
|
4
|
+
showAlpha?: boolean;
|
|
5
|
+
sliderMode?: boolean;
|
|
6
|
+
eyeDropper?: boolean;
|
|
7
|
+
presetColors?: string[];
|
|
8
|
+
presetLabels?: string[];
|
|
9
|
+
presetsOnly?: boolean;
|
|
10
|
+
listView?: boolean;
|
|
11
|
+
inline?: boolean;
|
|
12
|
+
compact?: boolean;
|
|
13
|
+
inputPreview?: boolean;
|
|
14
|
+
onChange?: (color: string) => void;
|
|
15
|
+
onOpen?: () => void;
|
|
16
|
+
onClose?: () => void;
|
|
17
|
+
appendTo?: HTMLElement;
|
|
18
|
+
position?: "auto" | "above" | "below";
|
|
19
|
+
closeOnSelect?: boolean;
|
|
20
|
+
ariaLabels?: {
|
|
21
|
+
hue?: string;
|
|
22
|
+
saturation?: string;
|
|
23
|
+
lightness?: string;
|
|
24
|
+
alpha?: string;
|
|
25
|
+
presets?: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export declare class ColorPicker {
|
|
29
|
+
private input;
|
|
30
|
+
private options;
|
|
31
|
+
private container;
|
|
32
|
+
private colorBox;
|
|
33
|
+
private hueSlider;
|
|
34
|
+
private saturationSlider;
|
|
35
|
+
private lightnessSlider;
|
|
36
|
+
private alphaSlider;
|
|
37
|
+
private hexInput;
|
|
38
|
+
private currentColor;
|
|
39
|
+
private isOpen;
|
|
40
|
+
private saturationPointer;
|
|
41
|
+
private compactButton;
|
|
42
|
+
private inputPreview;
|
|
43
|
+
private static instances;
|
|
44
|
+
constructor(element: string | HTMLInputElement, options?: ColorPickerOptions);
|
|
45
|
+
private init;
|
|
46
|
+
private buildColorPicker;
|
|
47
|
+
private createCompactButton;
|
|
48
|
+
private createInputPreview;
|
|
49
|
+
private supportsEyeDropper;
|
|
50
|
+
private openEyeDropper;
|
|
51
|
+
private setupEventListeners;
|
|
52
|
+
private onSaturationMouseDown;
|
|
53
|
+
private updateSaturationFromMouse;
|
|
54
|
+
private onSaturationKeyDown;
|
|
55
|
+
private updateColorDisplay;
|
|
56
|
+
private formatColor;
|
|
57
|
+
private getPlaceholder;
|
|
58
|
+
private parseColor;
|
|
59
|
+
private hexToHsl;
|
|
60
|
+
private rgbToHsl;
|
|
61
|
+
private hslToRgb;
|
|
62
|
+
private toHex;
|
|
63
|
+
private toHSLString;
|
|
64
|
+
private toRGBString;
|
|
65
|
+
private isValidHex;
|
|
66
|
+
private isValidColor;
|
|
67
|
+
private announceColorChange;
|
|
68
|
+
private announceTimeout;
|
|
69
|
+
open(): void;
|
|
70
|
+
close(): void;
|
|
71
|
+
toggle(): void;
|
|
72
|
+
private positionPicker;
|
|
73
|
+
setColor(color: string): void;
|
|
74
|
+
getColor(): string;
|
|
75
|
+
destroy(): void;
|
|
76
|
+
static getInstance(element: HTMLElement): ColorPicker | undefined;
|
|
77
|
+
}
|
|
78
|
+
export default function colorpicker(selector: string | HTMLInputElement, options?: ColorPickerOptions): ColorPicker;
|
|
79
|
+
export declare function initColorPickers(root?: Document | HTMLElement): ColorPicker[];
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pickit-color",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A modern, accessible color picker with HSL support, presets, slider mode, and screen color picking",
|
|
5
|
+
"main": "dist/colorpicker.js",
|
|
6
|
+
"module": "dist/esm/colorpicker/index.js",
|
|
7
|
+
"types": "dist/colorpicker.d.ts",
|
|
8
|
+
"author": {
|
|
9
|
+
"name": "Thomas Skerbis",
|
|
10
|
+
"email": "thomas@klxm.de",
|
|
11
|
+
"url": "https://github.com/skerbis"
|
|
12
|
+
},
|
|
13
|
+
"funding": {
|
|
14
|
+
"type": "github",
|
|
15
|
+
"url": "https://github.com/sponsors/skerbis"
|
|
16
|
+
},
|
|
17
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/skerbis/pickit-color.git"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/skerbis/pickit-color/issues"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/skerbis/pickit-color#readme",
|
|
26
|
+
"keywords": [
|
|
27
|
+
"color-picker",
|
|
28
|
+
"colorpicker",
|
|
29
|
+
"hsl",
|
|
30
|
+
"rgba",
|
|
31
|
+
"hex",
|
|
32
|
+
"eyedropper",
|
|
33
|
+
"accessibility",
|
|
34
|
+
"a11y",
|
|
35
|
+
"typescript",
|
|
36
|
+
"vanilla-js"
|
|
37
|
+
],
|
|
38
|
+
"files": [
|
|
39
|
+
"dist/**/*",
|
|
40
|
+
"src/**/*",
|
|
41
|
+
"LICENSE.md",
|
|
42
|
+
"README.md"
|
|
43
|
+
],
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "run-s build:pre build:build build:esm build:types",
|
|
46
|
+
"build:pre": "rimraf dist",
|
|
47
|
+
"build:build": "ts-node --transpile-only build.ts",
|
|
48
|
+
"build:esm": "tsc -p tsconfig.esm.json",
|
|
49
|
+
"build:types": "tsc -p tsconfig.declarations.json",
|
|
50
|
+
"prepublishOnly": "npm run build"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/node": "^14.14.14",
|
|
54
|
+
"@types/stylus": "^0.48.33",
|
|
55
|
+
"autoprefixer-stylus": "latest",
|
|
56
|
+
"chokidar": "^3.4.3",
|
|
57
|
+
"fs-extra": "^9.0.1",
|
|
58
|
+
"glob": "^7.1.6",
|
|
59
|
+
"npm-run-all": ">=4.1.5",
|
|
60
|
+
"rimraf": "^3.0.2",
|
|
61
|
+
"rollup": "^2.35.1",
|
|
62
|
+
"rollup-plugin-typescript": "^1.0.1",
|
|
63
|
+
"stylus": "latest",
|
|
64
|
+
"terser": "^5.5.1",
|
|
65
|
+
"ts-node": "^9.1.1",
|
|
66
|
+
"tslib": "^2.7.0",
|
|
67
|
+
"typescript": "^5.7.2"
|
|
68
|
+
}
|
|
69
|
+
}
|
package/src/README.md
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
# Pickit ColorPicker
|
|
2
|
+
|
|
3
|
+
Ein barrierefreier, leichtgewichtiger Color Picker inspiriert von Flatpickr mit vollständiger Unterstützung moderner Farbformate.
|
|
4
|
+
|
|
5
|
+
## ✨ Features
|
|
6
|
+
|
|
7
|
+
- **♿ Vollständig Barrierefrei**: WCAG 2.1 AA konform mit ARIA-Labels und Tastaturnavigation
|
|
8
|
+
- **🎨 Moderne Farbformate**: Unterstützt HEX, RGB, HSL mit optionalem Alpha-Kanal
|
|
9
|
+
- **🎯 Voreingestellte Farben**: Schneller Zugriff auf Markenfarben oder gängige Farbpaletten
|
|
10
|
+
- **⌨️ Tastaturnavigation**: Volle Steuerung per Pfeiltasten (Shift für größere Schritte)
|
|
11
|
+
- **🌙 Dark Mode**: Automatische Unterstützung über `prefers-color-scheme`
|
|
12
|
+
- **📱 Responsive**: Optimiert für Desktop und mobile Geräte
|
|
13
|
+
- **🎭 Inline oder Popup**: Flexibel als Dropdown oder dauerhaft eingebetteter Picker
|
|
14
|
+
- **⚡ Leichtgewichtig**: Keine Abhängigkeiten, nur ~10KB gzipped
|
|
15
|
+
- **🔧 Anpassbar**: Umfangreiche Optionen und Callbacks
|
|
16
|
+
|
|
17
|
+
## 📦 Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install pickit
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Oder über CDN:
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<link rel="stylesheet" href="https://unpkg.com/pickit/dist/colorpicker.css">
|
|
27
|
+
<script src="https://unpkg.com/pickit/dist/colorpicker.js"></script>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## 🚀 Grundlegende Verwendung
|
|
31
|
+
|
|
32
|
+
### HTML
|
|
33
|
+
|
|
34
|
+
```html
|
|
35
|
+
<input type="text" id="colorInput" placeholder="Farbe auswählen">
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### JavaScript
|
|
39
|
+
|
|
40
|
+
```javascript
|
|
41
|
+
import colorpicker from 'pickit/colorpicker';
|
|
42
|
+
|
|
43
|
+
const picker = colorpicker('#colorInput', {
|
|
44
|
+
defaultColor: '#3b82f6',
|
|
45
|
+
format: 'hex',
|
|
46
|
+
onChange: (color) => {
|
|
47
|
+
console.log('Ausgewählte Farbe:', color);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## ⚙️ Optionen
|
|
53
|
+
|
|
54
|
+
| Option | Typ | Standard | Beschreibung |
|
|
55
|
+
|--------|-----|----------|--------------|
|
|
56
|
+
| `defaultColor` | `string` | `'#3b82f6'` | Standardfarbe beim Initialisieren |
|
|
57
|
+
| `format` | `'hex' \| 'rgb' \| 'hsl'` | `'hex'` | Ausgabeformat der Farbe |
|
|
58
|
+
| `showAlpha` | `boolean` | `false` | Alpha-Kanal (Transparenz) aktivieren |
|
|
59
|
+
| `presetColors` | `string[]` | `[...]` | Array vordefinierter Farben |
|
|
60
|
+
| `inline` | `boolean` | `false` | Picker dauerhaft sichtbar machen |
|
|
61
|
+
| `appendTo` | `HTMLElement` | `document.body` | Element, an das der Picker angehängt wird |
|
|
62
|
+
| `position` | `'auto' \| 'above' \| 'below'` | `'auto'` | Position des Pickers relativ zum Input |
|
|
63
|
+
| `closeOnSelect` | `boolean` | `true` | Picker nach Auswahl schließen |
|
|
64
|
+
| `onChange` | `function` | `() => {}` | Callback bei Farbänderung |
|
|
65
|
+
| `onOpen` | `function` | `() => {}` | Callback beim Öffnen |
|
|
66
|
+
| `onClose` | `function` | `() => {}` | Callback beim Schließen |
|
|
67
|
+
| `ariaLabels` | `object` | `{...}` | Anpassbare ARIA-Labels für Barrierefreiheit |
|
|
68
|
+
|
|
69
|
+
## 📖 Beispiele
|
|
70
|
+
|
|
71
|
+
### HEX Format
|
|
72
|
+
|
|
73
|
+
```javascript
|
|
74
|
+
const picker = colorpicker('#hex-input', {
|
|
75
|
+
format: 'hex',
|
|
76
|
+
defaultColor: '#3b82f6'
|
|
77
|
+
});
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### RGB mit Alpha
|
|
81
|
+
|
|
82
|
+
```javascript
|
|
83
|
+
const picker = colorpicker('#rgb-input', {
|
|
84
|
+
format: 'rgb',
|
|
85
|
+
showAlpha: true,
|
|
86
|
+
defaultColor: 'rgba(59, 130, 246, 0.8)',
|
|
87
|
+
onChange: (color) => {
|
|
88
|
+
document.body.style.backgroundColor = color;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### HSL Format
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
const picker = colorpicker('#hsl-input', {
|
|
97
|
+
format: 'hsl',
|
|
98
|
+
defaultColor: 'hsl(217, 91%, 60%)'
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Eigene Markenfarben
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
const picker = colorpicker('#brand-input', {
|
|
106
|
+
format: 'hex',
|
|
107
|
+
presetColors: [
|
|
108
|
+
'#6366f1', // Indigo
|
|
109
|
+
'#8b5cf6', // Purple
|
|
110
|
+
'#ec4899', // Pink
|
|
111
|
+
'#f59e0b', // Amber
|
|
112
|
+
'#10b981', // Emerald
|
|
113
|
+
'#06b6d4', // Cyan
|
|
114
|
+
],
|
|
115
|
+
closeOnSelect: true
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Inline Modus
|
|
120
|
+
|
|
121
|
+
```javascript
|
|
122
|
+
const picker = colorpicker('#inline-input', {
|
|
123
|
+
inline: true,
|
|
124
|
+
appendTo: document.querySelector('.color-container'),
|
|
125
|
+
format: 'hex',
|
|
126
|
+
onChange: (color) => {
|
|
127
|
+
console.log('Farbe geändert:', color);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Position steuern
|
|
133
|
+
|
|
134
|
+
```javascript
|
|
135
|
+
const picker = colorpicker('#positioned-input', {
|
|
136
|
+
position: 'above', // Immer oberhalb des Inputs
|
|
137
|
+
format: 'hex'
|
|
138
|
+
});
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### ARIA-Labels anpassen
|
|
142
|
+
|
|
143
|
+
```javascript
|
|
144
|
+
const picker = colorpicker('#accessible-input', {
|
|
145
|
+
ariaLabels: {
|
|
146
|
+
hue: 'Farbton',
|
|
147
|
+
saturation: 'Sättigung und Helligkeit',
|
|
148
|
+
lightness: 'Helligkeit',
|
|
149
|
+
alpha: 'Transparenz',
|
|
150
|
+
presets: 'Vordefinierte Farben'
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## 🎹 Tastaturnavigation
|
|
156
|
+
|
|
157
|
+
Der ColorPicker ist vollständig per Tastatur bedienbar:
|
|
158
|
+
|
|
159
|
+
| Taste | Funktion |
|
|
160
|
+
|-------|----------|
|
|
161
|
+
| `↑` `↓` `←` `→` | Sättigung und Helligkeit anpassen |
|
|
162
|
+
| `Shift` + Pfeiltasten | Größere Schritte |
|
|
163
|
+
| `Tab` | Zwischen Steuerelementen wechseln |
|
|
164
|
+
| `Escape` | Picker schließen |
|
|
165
|
+
| `Enter` | Farbauswahl bestätigen |
|
|
166
|
+
|
|
167
|
+
## 🔧 API-Methoden
|
|
168
|
+
|
|
169
|
+
### setColor(color: string)
|
|
170
|
+
|
|
171
|
+
Farbe programmatisch setzen:
|
|
172
|
+
|
|
173
|
+
```javascript
|
|
174
|
+
picker.setColor('#ff0000');
|
|
175
|
+
picker.setColor('rgb(255, 0, 0)');
|
|
176
|
+
picker.setColor('hsl(0, 100%, 50%)');
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### getColor(): string
|
|
180
|
+
|
|
181
|
+
Aktuelle Farbe abrufen:
|
|
182
|
+
|
|
183
|
+
```javascript
|
|
184
|
+
const currentColor = picker.getColor();
|
|
185
|
+
console.log(currentColor); // "#ff0000"
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### open()
|
|
189
|
+
|
|
190
|
+
Picker öffnen:
|
|
191
|
+
|
|
192
|
+
```javascript
|
|
193
|
+
picker.open();
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### close()
|
|
197
|
+
|
|
198
|
+
Picker schließen:
|
|
199
|
+
|
|
200
|
+
```javascript
|
|
201
|
+
picker.close();
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### toggle()
|
|
205
|
+
|
|
206
|
+
Picker umschalten:
|
|
207
|
+
|
|
208
|
+
```javascript
|
|
209
|
+
picker.toggle();
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### destroy()
|
|
213
|
+
|
|
214
|
+
Picker entfernen und Event Listener aufräumen:
|
|
215
|
+
|
|
216
|
+
```javascript
|
|
217
|
+
picker.destroy();
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### getInstance(element: HTMLElement)
|
|
221
|
+
|
|
222
|
+
Bestehende Picker-Instanz abrufen:
|
|
223
|
+
|
|
224
|
+
```javascript
|
|
225
|
+
const picker = colorpicker.getInstance(inputElement);
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## 🎨 Farbkonvertierung
|
|
229
|
+
|
|
230
|
+
Der ColorPicker versteht automatisch alle gängigen Farbformate:
|
|
231
|
+
|
|
232
|
+
```javascript
|
|
233
|
+
// Alle diese Formate werden erkannt:
|
|
234
|
+
picker.setColor('#ff0000'); // HEX
|
|
235
|
+
picker.setColor('#ff0000ff'); // HEX mit Alpha
|
|
236
|
+
picker.setColor('rgb(255, 0, 0)'); // RGB
|
|
237
|
+
picker.setColor('rgba(255, 0, 0, 0.5)'); // RGB mit Alpha
|
|
238
|
+
picker.setColor('hsl(0, 100%, 50%)'); // HSL
|
|
239
|
+
picker.setColor('hsla(0, 100%, 50%, 0.5)'); // HSL mit Alpha
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## 🌙 Dark Mode
|
|
243
|
+
|
|
244
|
+
Der ColorPicker unterstützt automatisch Dark Mode über CSS:
|
|
245
|
+
|
|
246
|
+
```css
|
|
247
|
+
@media (prefers-color-scheme: dark) {
|
|
248
|
+
/* Styles werden automatisch angepasst */
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Eigenes Dark Mode Styling:
|
|
253
|
+
|
|
254
|
+
```css
|
|
255
|
+
.colorpicker-container {
|
|
256
|
+
background: #1f2937;
|
|
257
|
+
border-color: #374151;
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## ♿ Barrierefreiheit
|
|
262
|
+
|
|
263
|
+
Der ColorPicker ist nach WCAG 2.1 AA Standards entwickelt:
|
|
264
|
+
|
|
265
|
+
- **ARIA-Labels**: Alle interaktiven Elemente sind beschriftet
|
|
266
|
+
- **Tastaturnavigation**: Vollständige Steuerung per Tastatur
|
|
267
|
+
- **Screen Reader**: Optimiert für Screen Reader
|
|
268
|
+
- **Focus Indicators**: Klare visuelle Fokusanzeigen
|
|
269
|
+
- **High Contrast**: Unterstützung für hohen Kontrast
|
|
270
|
+
- **Reduced Motion**: Respektiert `prefers-reduced-motion`
|
|
271
|
+
|
|
272
|
+
## 🎯 Browser-Unterstützung
|
|
273
|
+
|
|
274
|
+
- Chrome/Edge: Letzte 2 Versionen
|
|
275
|
+
- Firefox: Letzte 2 Versionen
|
|
276
|
+
- Safari: Version 12+
|
|
277
|
+
- iOS Safari: Version 12+
|
|
278
|
+
- Android Chrome: Letzte 2 Versionen
|
|
279
|
+
|
|
280
|
+
## 📄 Lizenz
|
|
281
|
+
|
|
282
|
+
MIT License - siehe [LICENSE.md](../LICENSE.md)
|
|
283
|
+
|
|
284
|
+
## 🤝 Beitragen
|
|
285
|
+
|
|
286
|
+
Contributions sind willkommen! Siehe das Haupt-Repository für Guidelines.
|
|
287
|
+
|
|
288
|
+
## 🔗 Links
|
|
289
|
+
|
|
290
|
+
- [Hauptprojekt: Pickit](../README.md)
|
|
291
|
+
- [Demo](demo-colorpicker.html)
|
|
292
|
+
- [GitHub](https://github.com/skerbis/pickit)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
declare module "pickit/colorpicker" {
|
|
2
|
+
export interface ColorPickerOptions {
|
|
3
|
+
defaultColor?: string;
|
|
4
|
+
format?: "hex" | "rgb" | "hsl";
|
|
5
|
+
showAlpha?: boolean;
|
|
6
|
+
sliderMode?: boolean;
|
|
7
|
+
eyeDropper?: boolean;
|
|
8
|
+
presetColors?: string[];
|
|
9
|
+
presetLabels?: string[];
|
|
10
|
+
presetsOnly?: boolean;
|
|
11
|
+
listView?: boolean;
|
|
12
|
+
inputPreview?: boolean;
|
|
13
|
+
inline?: boolean;
|
|
14
|
+
compact?: boolean;
|
|
15
|
+
onChange?: (color: string) => void;
|
|
16
|
+
onOpen?: () => void;
|
|
17
|
+
onClose?: () => void;
|
|
18
|
+
appendTo?: HTMLElement;
|
|
19
|
+
position?: "auto" | "above" | "below";
|
|
20
|
+
closeOnSelect?: boolean;
|
|
21
|
+
ariaLabels?: {
|
|
22
|
+
hue?: string;
|
|
23
|
+
saturation?: string;
|
|
24
|
+
lightness?: string;
|
|
25
|
+
alpha?: string;
|
|
26
|
+
presets?: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export class ColorPicker {
|
|
31
|
+
constructor(
|
|
32
|
+
element: string | HTMLInputElement,
|
|
33
|
+
options?: ColorPickerOptions
|
|
34
|
+
);
|
|
35
|
+
open(): void;
|
|
36
|
+
close(): void;
|
|
37
|
+
toggle(): void;
|
|
38
|
+
setColor(color: string): void;
|
|
39
|
+
getColor(): string;
|
|
40
|
+
destroy(): void;
|
|
41
|
+
static getInstance(element: HTMLElement): ColorPicker | undefined;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default function colorpicker(
|
|
45
|
+
selector: string | HTMLInputElement,
|
|
46
|
+
options?: ColorPickerOptions
|
|
47
|
+
): ColorPicker;
|
|
48
|
+
|
|
49
|
+
export function initColorPickers(
|
|
50
|
+
root?: Document | HTMLElement
|
|
51
|
+
): ColorPicker[];
|
|
52
|
+
}
|