@thednp/color-picker 1.0.1 → 2.0.0-alpha10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. package/.eslintrc.cjs +199 -0
  2. package/.lgtm.yml +9 -0
  3. package/.prettierrc.json +15 -0
  4. package/.stylelintrc.json +236 -0
  5. package/README.md +55 -72
  6. package/compile.js +51 -0
  7. package/cypress/e2e/color-palette.cy.ts +128 -0
  8. package/cypress/e2e/color-picker.cy.ts +909 -0
  9. package/cypress/fixtures/colorNamesFrench.js +3 -0
  10. package/cypress/fixtures/componentLabelsFrench.js +21 -0
  11. package/cypress/fixtures/format.js +3 -0
  12. package/cypress/fixtures/getMarkup.js +35 -0
  13. package/cypress/fixtures/getRandomInt.js +6 -0
  14. package/cypress/fixtures/sampleWebcolors.js +18 -0
  15. package/cypress/fixtures/testSample.js +8 -0
  16. package/cypress/plugins/esbuild-istanbul.ts +50 -0
  17. package/cypress/plugins/tsCompile.ts +34 -0
  18. package/cypress/support/commands.ts +0 -0
  19. package/cypress/support/e2e.ts +21 -0
  20. package/cypress/test.html +23 -0
  21. package/cypress.config.ts +29 -0
  22. package/dist/css/color-picker.css +25 -54
  23. package/dist/css/color-picker.min.css +2 -2
  24. package/dist/css/color-picker.rtl.css +25 -54
  25. package/dist/css/color-picker.rtl.min.css +2 -2
  26. package/dist/js/color-picker.cjs +8 -0
  27. package/dist/js/color-picker.cjs.map +1 -0
  28. package/dist/js/color-picker.d.ts +296 -0
  29. package/dist/js/color-picker.js +5 -3570
  30. package/dist/js/color-picker.js.map +1 -0
  31. package/dist/js/color-picker.mjs +2618 -0
  32. package/dist/js/color-picker.mjs.map +1 -0
  33. package/dts.config.ts +15 -0
  34. package/package.json +116 -108
  35. package/src/scss/_variables.scss +0 -1
  36. package/src/scss/color-picker.rtl.scss +4 -0
  37. package/src/scss/color-picker.scss +93 -51
  38. package/src/ts/colorPalette.ts +89 -0
  39. package/src/{js/color-picker.js → ts/index.ts} +498 -509
  40. package/src/ts/interface/ColorNames.ts +20 -0
  41. package/src/ts/interface/colorPickerLabels.ts +20 -0
  42. package/src/ts/interface/colorPickerOptions.ts +11 -0
  43. package/src/ts/interface/paletteOptions.ts +6 -0
  44. package/src/ts/util/colorNames.ts +21 -0
  45. package/src/{js/util/colorPickerLabels.js → ts/util/colorPickerLabels.ts} +4 -2
  46. package/src/ts/util/getColorControls.ts +90 -0
  47. package/src/{js/util/getColorForm.js → ts/util/getColorForm.ts} +28 -18
  48. package/src/{js/util/getColorMenu.js → ts/util/getColorMenu.ts} +21 -30
  49. package/src/ts/util/isValidJSON.ts +19 -0
  50. package/src/{js/util/setMarkup.js → ts/util/setMarkup.ts} +61 -50
  51. package/tsconfig.json +29 -0
  52. package/vite.config.ts +34 -0
  53. package/dist/js/color-esm.js +0 -1164
  54. package/dist/js/color-esm.min.js +0 -2
  55. package/dist/js/color-palette-esm.js +0 -1235
  56. package/dist/js/color-palette-esm.min.js +0 -2
  57. package/dist/js/color-palette.js +0 -1243
  58. package/dist/js/color-palette.min.js +0 -2
  59. package/dist/js/color-picker-element-esm.js +0 -3718
  60. package/dist/js/color-picker-element-esm.min.js +0 -2
  61. package/dist/js/color-picker-element.js +0 -3726
  62. package/dist/js/color-picker-element.min.js +0 -2
  63. package/dist/js/color-picker-esm.js +0 -3565
  64. package/dist/js/color-picker-esm.min.js +0 -2
  65. package/dist/js/color-picker.min.js +0 -2
  66. package/dist/js/color.js +0 -1172
  67. package/dist/js/color.min.js +0 -2
  68. package/src/js/color-palette.js +0 -75
  69. package/src/js/color-picker-element.js +0 -107
  70. package/src/js/color.js +0 -1104
  71. package/src/js/index.js +0 -8
  72. package/src/js/util/colorNames.js +0 -6
  73. package/src/js/util/getColorControls.js +0 -103
  74. package/src/js/util/isValidJSON.js +0 -13
  75. package/src/js/util/nonColors.js +0 -5
  76. package/src/js/util/roundPart.js +0 -9
  77. package/src/js/util/setCSSProperties.js +0 -12
  78. package/src/js/util/tabindex.js +0 -3
  79. package/src/js/util/toggleCEAttr.js +0 -70
  80. package/src/js/util/version.js +0 -5
  81. package/src/js/version.js +0 -5
  82. package/types/cp.d.ts +0 -558
  83. package/types/index.d.ts +0 -44
  84. package/types/source/source.ts +0 -4
  85. package/types/source/types.d.ts +0 -92
  86. /package/src/{js/util/vHidden.js → ts/util/vHidden.ts} +0 -0
@@ -0,0 +1,3 @@
1
+ const colorNamesFrench = 'blanc,noir,gris,rouge,orange,brun,or,olive,jaune,citron,vert,sarcelle,cyan,bleu,violet,magenta,rose';
2
+
3
+ export default colorNamesFrench;
@@ -0,0 +1,21 @@
1
+ const componentLabelsFrench = {
2
+ pickerLabel: "Couleur Sélection",
3
+ appearanceLabel: "Apparence de la couleur",
4
+ valueLabel: "Valeur de couleur",
5
+ toggleLabel: "Sélectionner la couleur",
6
+ presetsLabel: "Préréglages de couleur",
7
+ defaultsLabel: "Couleur par défaut",
8
+ formatLabel: "Format",
9
+ alphaLabel: "Alpha",
10
+ hexLabel: "Hexadécimal",
11
+ hueLabel: "Nuance",
12
+ whitenessLabel: "Blancheur",
13
+ blacknessLabel: "Noirceur",
14
+ saturationLabel: "Saturation",
15
+ lightnessLabel: "Légèreté",
16
+ redLabel: "Rouge",
17
+ greenLabel: "Vert",
18
+ blueLabel: "Bleu",
19
+ };
20
+
21
+ export default componentLabelsFrench;
@@ -0,0 +1,3 @@
1
+ const FORMAT = ['hsl', 'rgb', 'hwb', 'hex'];
2
+
3
+ export default FORMAT;
@@ -0,0 +1,35 @@
1
+ import testSample from "./testSample";
2
+ import getRandomInt from "./getRandomInt";
3
+
4
+ export default function getMarkup(body, id, format) {
5
+ const set = testSample[getRandomInt(0,3)];
6
+ const value = set[format];
7
+
8
+ const label = document.createElement('label');
9
+ label.setAttribute('for', `color-picker-${id}`);
10
+ label.innerText = `Color Picker Test`;
11
+
12
+ const cpWrapper = document.createElement('div');
13
+ cpWrapper.className = 'color-picker';
14
+
15
+ const input = document.createElement('input');
16
+ input.type = 'text';
17
+ input.id = `color-picker-${id}`;
18
+ input.className = 'btn-appearance color-preview';
19
+ input.setAttribute('value', value);
20
+ input.setAttribute('autocomplete', "off");
21
+ input.setAttribute('spellcheck', "false");
22
+ input.setAttribute('data-format', format);
23
+
24
+ const a = document.createElement('a');
25
+ a.setAttribute('href', '#');
26
+ a.innerText = 'Some link';
27
+ a.className = 'my-link';
28
+ a.style = 'position: absolute; top: 20px; opacity: 0.015';
29
+ // body.append(a);
30
+ cpWrapper.append(input);
31
+ if (body) {
32
+ body.append(label, cpWrapper, a);
33
+ }
34
+ return {set, value};
35
+ }
@@ -0,0 +1,6 @@
1
+ export default function getRandomInt(min, max) {
2
+ min = Math.ceil(min);
3
+ max = Math.round(max);
4
+ // The maximum is exclusive and the minimum is inclusive
5
+ return Math.round(Math.random() * (max - min) + min);
6
+ }
@@ -0,0 +1,18 @@
1
+ const sampleWebcolors = [
2
+ {name:"white",rgb:"rgb(255, 255, 255)",hex:"#ffffff",hsl:"hsl(0, 0%, 100%)",hsl4:"hsl(0deg 0% 100%)",hwb:"hwb(0deg 100% 0%)",hsv:{h:0,s:0,v:1,a:1}},
3
+ {name:"black",rgb:"rgb(0, 0, 0)",hex:"#000000",hsl:"hsl(0, 0%, 0%)",hsl4:"hsl(0deg 0% 0%)",hwb:"hwb(0deg 0% 100%)",hsv:{h:0,s:0,v:0,a:1}},
4
+ {name:"yellow",rgb:"rgb(255, 255, 0)",hex:"#ffff00",hsl:"hsl(60, 100%, 50%)",hsl4:"hsl(60deg 100% 50%)",hwb:"hwb(60deg 0% 0%)",hsv: {h: 0.167, s: 1, v: 1, a: 1}},
5
+ {name:"green",rgb:"rgb(0, 128, 0)",hex:"#008000",hsl:"hsl(120, 100%, 25%)",hsl4:"hsl(120deg 100% 25%)",hwb:"hwb(120deg 0% 50%)",hsv: {h: 0.333, s: 1, v: 0.502, a: 1}},
6
+ {name:"red",rgb:"rgb(255, 0, 0)",hex:"#ff0000",hsl:"hsl(0, 100%, 50%)",hsl4:"hsl(0deg 100% 50%)",hwb:"hwb(0deg 0% 0%)",hsv:{h:0,s:1,v:1,a:1}},
7
+ {name:"pink",rgb:"rgb(255, 192, 203)",hex:"#ffc0cb",hsl:"hsl(350, 100%, 88%)",hsl4:"hsl(350deg 100% 88%)",hwb:"hwb(350deg 75% 0%)",hsv:{h:0.971,s:0.247,v:1,a:1}},
8
+ {name:"brown",rgb:"rgb(165, 42, 42)",hex:"#a52a2a",hsl:"hsl(0, 59%, 41%)",hsl4:"hsl(0deg 59% 41%)",hwb:"hwb(0deg 16% 35%)",hsv:{h:0,s:0.745,v:0.647,a:1}},
9
+ {name:"orange",rgb:"rgb(255, 165, 0)",hex:"#ffa500",hsl:"hsl(39, 100%, 50%)",hsl4:"hsl(39deg 100% 50%)",hwb:"hwb(39deg 0% 0%)",hsv:{h:0.108,s:1,v:1,a:1}},
10
+ {name:"darkorange",rgb:"rgb(255, 140, 0)",hex:"#ff8c00",hsl:"hsl(33, 100%, 50%)",hsl4:"hsl(33deg 100% 50%)",hwb:"hwb(33deg 0% 0%)",hsv:{h:0.092,s:1,v:1,a:1}},
11
+ {name:"cyan",rgb:"rgb(0, 255, 255)",hex:"#00ffff",hsl:"hsl(180, 100%, 50%)",hsl4:"hsl(180deg 100% 50%)",hwb:"hwb(180deg 0% 0%)",hsv:{h:0.5,s:1,v:1,a:1}},
12
+ {name:"yellow",rgb:"rgb(255, 255, 0)",hex:"#ffff00",hsl:"hsl(60, 100%, 50%)",hsl4:"hsl(60deg 100% 50%)",hwb:"hwb(60deg 0% 0%)",hsv:{h:0.167,s:1,v:1,a:1}},
13
+ {name:"navy",rgb:"rgb(0, 0, 128)",hex:"#000080",hsl:"hsl(240, 100%, 25%)",hsl4:"hsl(240deg 100% 25%)",hwb:"hwb(240deg 0% 50%)",hsv:{h:0.667,s:1,v:0.502,a:1}},
14
+ {name:"orchid",rgb:"rgb(218, 112, 214)",hex:"#da70d6",hsl:"hsl(302, 59%, 65%)",hsl4:"hsl(302deg 59% 65%)",hwb:"hwb(302deg 44% 15%)",hsv:{h: 0.84, s: 0.486, v: 0.855, a: 1}},
15
+ {name:"indigo",rgb:"rgb(75, 0, 130)",hex:"#4b0082",hsl:"hsl(275, 100%, 25%)",hsl4:"hsl(275deg 100% 25%)",hwb:"hwb(275deg 0% 49%)",hsv:{h: 0.763, s: 1, v: 0.51, a: 1}},
16
+ ];
17
+
18
+ export default sampleWebcolors;
@@ -0,0 +1,8 @@
1
+ const testSample = [
2
+ {name: 'red', hex: '#f00', rgb: 'rgb(255, 0, 0)', hsl: 'hsl(0, 100%, 50%)', hwb: 'hwb(0deg 0% 0%)'},
3
+ {name: 'lime', hex: '#0f0', rgb: 'rgb(0, 255, 0)', hsl: 'hsl(120, 100%, 50%)', hwb: 'hwb(120deg 0% 0%)'},
4
+ {name: 'blue', hex: '#00f', rgb: 'rgb(0, 0, 255)', hsl: 'hsl(240, 100%, 50%)', hwb: 'hwb(240deg 0% 0%)'},
5
+ {name: 'pink', hex: '#f0f', rgb: 'rgb(255, 0, 255)', hsl: 'hsl(300, 100%, 50%)', hwb: 'hwb(300deg 0% 0%)'},
6
+ ];
7
+
8
+ export default testSample;
@@ -0,0 +1,50 @@
1
+ // sources
2
+ // * https://github.com/enketo/enketo-express/blob/master/tools/esbuild-plugin-istanbul.js
3
+ 'use strict';
4
+ import esbuild from 'esbuild';
5
+ import { promises } from 'fs';
6
+ import { createInstrumenter } from 'istanbul-lib-instrument';
7
+ import { extname, sep } from 'path';
8
+ import tsCompile from './tsCompile';
9
+
10
+ // import Cypress settings
11
+ const sourceFolder = 'src';
12
+ const [name] = process.cwd().split(sep).slice(-1);
13
+
14
+ const sourceFilter = `${name}${sep}${sourceFolder}`;
15
+ const instrumenter = createInstrumenter({
16
+ compact: false,
17
+ esModules: true,
18
+ preserveComments: true,
19
+ autoWrap: true,
20
+ });
21
+
22
+ const createEsbuildIstanbulPlugin = (): esbuild.Plugin => {
23
+ return {
24
+ name: 'istanbul',
25
+ setup(build: esbuild.PluginBuild) {
26
+ build.onLoad(
27
+ { filter: /\.(ts|tsx)$/ },
28
+ async ({ path }: esbuild.OnLoadArgs): Promise<{ contents: string } & Record<string, any>> => {
29
+
30
+ if (!path.includes(sourceFilter)) {
31
+ // console.log("> compiling typescript %s for output build", path);
32
+ const contents = await promises.readFile(path, 'utf8');
33
+ return {
34
+ contents: ['.ts', '.tsx'].includes(extname(path)) ? tsCompile(path).outputText : contents,
35
+ };
36
+ }
37
+
38
+ // console.log("🧡 instrumenting %s for output coverage", path);
39
+ const { outputText, sourceMap } = tsCompile(path);
40
+
41
+ return {
42
+ contents: instrumenter.instrumentSync(outputText, path, sourceMap),
43
+ };
44
+ },
45
+ );
46
+ },
47
+ };
48
+ };
49
+
50
+ export default createEsbuildIstanbulPlugin;
@@ -0,0 +1,34 @@
1
+ // compile.ts
2
+ import TypeScript from 'typescript';
3
+ import { basename } from 'path';
4
+ import { RawSourceMap } from 'source-map';
5
+ import { readFileSync } from 'fs';
6
+
7
+ export default function tsCompile(
8
+ path: string,
9
+ ops?: Partial<TypeScript.TranspileOptions>,
10
+ ): TypeScript.TranspileOutput & { sourceMap: RawSourceMap } {
11
+ // Default options -- you could also perform a merge, or use the project tsconfig.json
12
+ const options: TypeScript.TranspileOptions = Object.assign(
13
+ {
14
+ compilerOptions: {
15
+ allowJs: true,
16
+ esModuleInterop: true,
17
+ removeComments: false,
18
+ target: 99, // ESNext
19
+ allowSyntheticDefaultImports: true,
20
+ isolatedModules: true,
21
+ noEmitHelpers: true,
22
+ sourceMap: true,
23
+ } as Partial<TypeScript.CompilerOptions>,
24
+ },
25
+ ops,
26
+ );
27
+ const contents = readFileSync(path, { encoding: 'utf8' });
28
+ const { outputText, sourceMapText } = TypeScript.transpileModule(contents, options);
29
+ const sourceMap: RawSourceMap = JSON.parse(sourceMapText || '');
30
+ sourceMap.file = basename(path);
31
+ sourceMap.sources = [basename(path)];
32
+
33
+ return { outputText, sourceMap, sourceMapText };
34
+ }
File without changes
@@ -0,0 +1,21 @@
1
+ // ***********************************************************
2
+ // This example support/index.js is processed and
3
+ // loaded automatically before your test files.
4
+ //
5
+ // This is a great place to put global configuration and
6
+ // behavior that modifies Cypress.
7
+ //
8
+ // You can change the location of this file or turn off
9
+ // automatically serving support files with the
10
+ // 'supportFile' configuration option.
11
+ //
12
+ // You can read more here:
13
+ // https://on.cypress.io/configuration
14
+ // ***********************************************************
15
+
16
+ // Import commands.js using ES2015 syntax:
17
+ // require('./commands')
18
+ import './commands'
19
+
20
+ // Alternatively you can use CommonJS syntax:
21
+ import '@cypress/code-coverage/support'
@@ -0,0 +1,23 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>ColorPicker Testing Page</title>
6
+ <meta name="description" content="A modern and fully featured color picker web component">
7
+ <meta name="keywords" content="color, picker, colorpicker, web component, hwb, hex, rgb, hsl, hsv">
8
+ <link id="styles" rel="stylesheet" href="../dist/css/color-picker.css">
9
+ <style>
10
+ body { padding: 65vh 0 65vh 0; margin: 0 auto; width: 60vw; font-family: sans-serif }
11
+ color-picker, .color-picker {
12
+ margin: 0 0 2.5rem;
13
+ --dropdown-transition: none;
14
+ --btn-transition: none;
15
+ --options-transition: none;
16
+ }
17
+ label { margin: 0.5rem 0;display: block;}
18
+ body > a { position: absolute; top: 50%; left: 1rem; /* color: white !important clip: 0px 0px 0px 0px; height:0; width: 0 */ }
19
+ </style>
20
+ </head>
21
+ <body>
22
+ </body>
23
+ </html>
@@ -0,0 +1,29 @@
1
+ import { defineConfig } from "cypress";
2
+ import createBundler from "@bahmutov/cypress-esbuild-preprocessor";
3
+ import createEsbuildIstanbulPlugin from "./cypress/plugins/esbuild-istanbul";
4
+
5
+ async function setupNodeEvents(
6
+ on: Cypress.PluginEvents,
7
+ config: Cypress.PluginConfigOptions
8
+ ): Promise<Cypress.PluginConfigOptions> {
9
+ await require("@cypress/code-coverage/task")(on, config);
10
+
11
+ on(
12
+ "file:preprocessor",
13
+ createBundler({
14
+ plugins: [createEsbuildIstanbulPlugin()],
15
+ })
16
+ );
17
+
18
+ // Make sure to return the config object as it might have been modified by the plugin.
19
+ return config;
20
+ }
21
+
22
+ export default defineConfig({
23
+ e2e: {
24
+ specPattern: "cypress/e2e/**/*.{js,jsx,ts,tsx}",
25
+ supportFile: "cypress/support/e2e.ts",
26
+ video: false,
27
+ setupNodeEvents,
28
+ },
29
+ });
@@ -1,10 +1,9 @@
1
1
  /*!
2
- * ColorPicker v1.0.1 (http://thednp.github.io/color-picker)
3
- * Copyright 2022 © thednp
4
- * Licensed under MIT (https://github.com/thednp/color-picker/blob/master/LICENSE)
2
+ * ColorPicker v2.0.0-alpha10 (http://thednp.github.io/color-picker)
3
+ * Copyright 2023 © thednp
4
+ * Licensed under MIT (https://github.com/thednp/color-picker/blob/main/LICENSE)
5
5
  */
6
6
  /* :host */
7
- color-picker,
8
7
  .color-picker {
9
8
  position: relative;
10
9
  display: flex;
@@ -41,8 +40,10 @@ color-picker,
41
40
  --option-bg-active: var(--white-90);
42
41
  --visual-shadow: 0 0 0 1px var(--white-15) inset;
43
42
  }
43
+ .color-picker *, .color-picker *::before, .color-picker *::after {
44
+ box-sizing: border-box;
45
+ }
44
46
 
45
- color-picker:focus,
46
47
  .color-picker:focus {
47
48
  outline: none;
48
49
  }
@@ -69,6 +70,7 @@ color-picker:focus,
69
70
 
70
71
  .color-dropdown.menu {
71
72
  right: 0;
73
+ max-height: 230px;
72
74
  }
73
75
 
74
76
  .open .color-dropdown.top {
@@ -108,7 +110,6 @@ color-picker:focus,
108
110
  /* btn-appearance */
109
111
  .btn-appearance {
110
112
  width: 100%;
111
- height: 1.5rem;
112
113
  padding: 0.6rem 1rem;
113
114
  font-size: 1rem;
114
115
  line-height: 1.5;
@@ -127,8 +128,7 @@ color-picker:focus,
127
128
  /* color-preview */
128
129
  .color-preview {
129
130
  box-shadow: 0 0 0 1px rgba(120, 120, 120, 0.33) inset;
130
- direction: ltr;
131
- /* color value can never be rtl */
131
+ direction: ltr; /* color value can never be rtl */
132
132
  }
133
133
 
134
134
  .txt-dark .color-preview {
@@ -159,10 +159,10 @@ color-picker:focus,
159
159
  /* picker-toggle */
160
160
  .picker-toggle {
161
161
  position: absolute;
162
- top: 0;
163
- left: 0;
162
+ inset: 0;
164
163
  width: 100%;
165
164
  height: 100%;
165
+ cursor: pointer;
166
166
  background: transparent;
167
167
  border: 0;
168
168
  }
@@ -188,8 +188,6 @@ color-picker:focus,
188
188
  .txt-light .menu-toggle {
189
189
  background: var(--black-50);
190
190
  }
191
-
192
- .txt-light .menu-toggle:focus,
193
191
  .txt-light .menu-toggle:focus {
194
192
  background: var(--black-75);
195
193
  }
@@ -197,8 +195,6 @@ color-picker:focus,
197
195
  .txt-dark .menu-toggle {
198
196
  background: var(--white-33);
199
197
  }
200
-
201
- .txt-dark .menu-toggle:focus,
202
198
  .txt-dark .menu-toggle:focus {
203
199
  background: var(--white-50);
204
200
  }
@@ -241,8 +237,7 @@ color-picker:focus,
241
237
  /* color-defaults */
242
238
  .color-defaults {
243
239
  display: none;
244
- flex-wrap: wrap;
245
- flex-flow: column;
240
+ flex-flow: column wrap;
246
241
  margin: 0;
247
242
  list-style: none;
248
243
  padding-inline: 0;
@@ -253,10 +248,6 @@ color-picker:focus,
253
248
  display: flex;
254
249
  }
255
250
 
256
- .color-dropdown.menu {
257
- max-height: 230px;
258
- }
259
-
260
251
  .color-defaults .color-option {
261
252
  padding: 0.25rem 0.5rem;
262
253
  color: inherit;
@@ -302,7 +293,7 @@ color-picker:focus,
302
293
  transition: var(--options-transition);
303
294
  }
304
295
 
305
- .color-options.scrollable:hover {
296
+ .color-dropdown.menu:hover .scrollable {
306
297
  height: var(--grid-hover-height);
307
298
  }
308
299
 
@@ -311,8 +302,7 @@ color-picker:focus,
311
302
  }
312
303
 
313
304
  .multiline + .color-defaults {
314
- flex-direction: row;
315
- flex-wrap: wrap;
305
+ flex-flow: row wrap;
316
306
  }
317
307
  .multiline + .color-defaults .color-option {
318
308
  padding: 0.25rem 0.33rem;
@@ -324,20 +314,16 @@ color-picker:focus,
324
314
  width: var(--grid-item-size);
325
315
  height: var(--grid-item-size);
326
316
  overflow: hidden;
327
- text-indent: 2.1rem;
317
+ color: rgba(0, 0, 0, 0);
328
318
  }
329
-
330
- .color-options .color-option:active,
331
- .color-options .color-option:focus {
319
+ .color-options .color-option:active, .color-options .color-option:focus {
332
320
  outline: none;
321
+ box-shadow: 0 0 0 4px rgba(125, 125, 125, 0.75) inset;
333
322
  }
334
323
 
335
324
  .color-options .color-option::before {
336
325
  position: absolute;
337
- top: 0;
338
- right: 0;
339
- bottom: 0;
340
- left: 0;
326
+ inset: 0;
341
327
  }
342
328
 
343
329
  .color-options .color-option:hover::before,
@@ -348,12 +334,7 @@ color-picker:focus,
348
334
  mix-blend-mode: difference;
349
335
  }
350
336
 
351
- .color-options .color-option:active,
352
- .color-options .color-option:focus {
353
- box-shadow: 0 0 0 4px rgba(125, 125, 125, 0.75) inset;
354
- }
355
-
356
- .color-options .color-option.active:after {
337
+ .color-options .color-option.active::after {
357
338
  position: absolute;
358
339
  top: 50%;
359
340
  left: 50%;
@@ -364,19 +345,18 @@ color-picker:focus,
364
345
  border-radius: 4px;
365
346
  }
366
347
 
367
- .txt-dark .color-options .color-option.active:after {
348
+ .txt-dark .color-options .color-option.active::after {
368
349
  box-shadow: 0 0 0 4px var(--white-90);
369
350
  }
370
351
 
371
- .txt-light .color-options .color-option.active:after {
352
+ .txt-light .color-options .color-option.active::after {
372
353
  box-shadow: 0 0 0 4px var(--black-90);
373
354
  }
374
355
 
375
356
  /* color-form */
376
357
  .color-form {
377
358
  display: flex;
378
- flex-direction: row;
379
- flex-wrap: wrap;
359
+ flex-flow: row wrap;
380
360
  align-items: center;
381
361
  padding: 0.25rem 0 0;
382
362
  font: 12px sans-serif;
@@ -419,14 +399,14 @@ color-picker:focus,
419
399
 
420
400
  /* visual control */
421
401
  .visual-control {
422
- height: 150px;
402
+ height: 230px;
423
403
  /* important for mobile devices */
424
404
  touch-action: none;
425
405
  box-shadow: var(--visual-shadow);
426
406
  }
427
407
 
428
408
  .visual-control1 {
429
- width: 150px;
409
+ width: 230px;
430
410
  }
431
411
 
432
412
  .visual-control2,
@@ -435,20 +415,10 @@ color-picker:focus,
435
415
  cursor: ns-resize;
436
416
  }
437
417
 
438
- @media (min-width: 578px) {
439
- .visual-control {
440
- height: 230px;
441
- }
442
-
443
- .visual-control1 {
444
- width: 230px;
445
- }
446
- }
447
- @media (min-width: 1200px) {
418
+ @media (width >= 980px) {
448
419
  .visual-control {
449
420
  height: 300px;
450
421
  }
451
-
452
422
  .visual-control1 {
453
423
  width: 300px;
454
424
  }
@@ -473,6 +443,7 @@ color-picker:focus,
473
443
  position: absolute;
474
444
  top: 0;
475
445
  left: 0;
446
+ width: 100%;
476
447
  height: 7px;
477
448
  /* important for mobile devices */
478
449
  touch-action: none;
@@ -1,2 +1,2 @@
1
- /* ColorPicker v1.0.1 | thednp © 2022 | MIT-License */
2
- color-picker,.color-picker{position:relative;display:flex;--white-15: rgba(255, 255, 255, 0.15);--white-25: rgba(255, 255, 255, 0.25);--white-33: rgba(255, 255, 255, 0.33);--white-50: rgba(255, 255, 255, 0.5);--white-75: rgba(255, 255, 255, 0.75);--white-90: rgba(255, 255, 255, 0.9);--black-15: rgba(0, 0, 0, 0.15);--black-25: rgba(0, 0, 0, 0.25);--black-33: rgba(0, 0, 0, 0.33);--black-50: rgba(0, 0, 0, 0.5);--black-75: rgba(0, 0, 0, 0.75);--black-90: rgba(0, 0, 0, 0.9);--dropdown-transition: transform 0.33s ease, opacity 0.33s ease;--btn-transition: box-shadow 0.33s ease, border 0.33s ease;--options-transition: height 0.33s ease;--dropdown-bg: var(--black-75);--dropdown-color: var(--white-75);--dropdown-shadow: 0 6px 12px var(--black-33);--dropdown-scrollbar-bg: var(--white-33);--dropdown-scrollbar-bg-hover: var(--white-50);--knob-bg: #000;--knob-border: 1px solid var(--white-90);--knob-shadow-hover: 0 0 0 6px var(--white-50);--knob-shadow-active: 0 0 0 6px var(--white-90);--input-border: 1px solid var(--white-15);--input-border-hover: 1px solid var(--white-33);--input-bg-hover: var(--black-15);--option-color-hover: var(--black-75);--option-bg-hover: var(--white-50);--option-color-active: var(--black-75);--option-bg-active: var(--white-90);--visual-shadow: 0 0 0 1px var(--white-15) inset}color-picker:focus,.color-picker:focus{outline:none}.color-dropdown{position:absolute;z-index:50;display:none;flex-direction:column;width:min-content;padding:.5rem;color:var(--dropdown-color);background:var(--dropdown-bg);border-radius:.5rem;box-shadow:var(--dropdown-shadow);opacity:0;transition:var(--dropdown-transition)}.color-dropdown.picker{left:0}.color-dropdown.menu{right:0}.open .color-dropdown.top{top:auto;bottom:100%}.color-dropdown.bottom{top:100%}.open .color-dropdown.top,.open .color-dropdown.bottom{display:flex}.color-dropdown.show{opacity:1}.color-dropdown.show.top{transform:translate(0, -5px)}.color-dropdown.show.bottom{transform:translate(0, 5px)}.color-controls{display:none;flex-wrap:wrap;justify-content:space-between;width:max-content}.btn-appearance{width:100%;height:1.5rem;padding:.6rem 1rem;font-size:1rem;line-height:1.5;border:0;border-radius:.25rem;outline:none;appearance:none;transition:var(--btn-transition)}.btn-appearance:focus,.btn-appearance:hover{box-shadow:0 0 0 3px var(--black-15)}.color-preview{box-shadow:0 0 0 1px rgba(120,120,120,.33) inset;direction:ltr}.txt-dark .color-preview{color:var(--white-75)}.txt-dark .color-preview:focus{box-shadow:0 0 0 1px #fff inset,0 0 0 3px var(--black-15)}.txt-dark .color-preview::placeholder{color:var(--white-50)}.txt-light .color-preview{color:var(--black-75)}.txt-light .color-preview:focus{color:var(--black-75);box-shadow:0 0 0 1px #000 inset,0 0 0 3px var(--black-15)}.txt-light .color-preview::placeholder{color:var(--black-50)}.picker-toggle{position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0);border:0}.open .picker-toggle{z-index:-1}.menu-toggle{position:absolute;top:0;right:0;display:flex;width:3rem;height:100%;padding:0 .25rem;cursor:pointer;border:0;border-radius:0 .25rem .25rem 0}.txt-light .menu-toggle{background:var(--black-50)}.txt-light .menu-toggle:focus,.txt-light .menu-toggle:focus{background:var(--black-75)}.txt-dark .menu-toggle{background:var(--white-33)}.txt-dark .menu-toggle:focus,.txt-dark .menu-toggle:focus{background:var(--white-50)}.menu-toggle svg{width:auto;height:100%}.scrollable{overflow-x:hidden;overflow-y:auto;scrollbar-width:thin}.scrollable::-webkit-scrollbar{width:.5rem}.scrollable::-webkit-scrollbar-track{background-color:rgba(0,0,0,0)}.scrollable::-webkit-scrollbar-thumb{width:.5rem;background-color:rgba(0,0,0,0);background-clip:content-box;border:0}.scrollable:hover::-webkit-scrollbar-thumb{background-color:var(--dropdown-scrollbar-bg)}.scrollable::-webkit-scrollbar-thumb:hover{background-color:var(--dropdown-scrollbar-bg-hover)}.color-defaults{display:none;flex-wrap:wrap;flex-flow:column;margin:0;list-style:none;padding-inline:0}.color-dropdown.menu .color-defaults,.color-dropdown.picker .color-controls{display:flex}.color-dropdown.menu{max-height:230px}.color-defaults .color-option{padding:.25rem .5rem;color:inherit}.color-option{cursor:pointer}.color-defaults .color-option:focus,.color-defaults .color-option:hover{color:var(--option-color-hover);background:var(--option-bg-hover);outline:none}.color-defaults .color-option:active,.color-defaults .color-option.active{color:var(--option-color-active);background:var(--option-bg-active)}.color-options{--grid-item-size: 2rem;--grid-fit: 5;--grid-gap: .25rem;--grid-height: auto;--grid-hover-height: auto;display:grid;padding:0;margin:0;list-style:none;grid-template-columns:repeat(var(--grid-fit), var(--grid-item-size));grid-template-rows:repeat(auto-fill, var(--grid-item-size));gap:var(--grid-gap)}.color-options.scrollable{height:var(--grid-height);margin:0 -0.5rem 0 0;overflow-y:scroll;transition:var(--options-transition)}.color-options.scrollable:hover{height:var(--grid-hover-height)}.color-options+.color-defaults{margin-top:.25rem}.multiline+.color-defaults{flex-direction:row;flex-wrap:wrap}.multiline+.color-defaults .color-option{padding:.25rem .33rem;font-size:12px}.color-options .color-option{position:relative;width:var(--grid-item-size);height:var(--grid-item-size);overflow:hidden;text-indent:2.1rem}.color-options .color-option:active,.color-options .color-option:focus{outline:none}.color-options .color-option::before{position:absolute;top:0;right:0;bottom:0;left:0}.color-options .color-option:hover::before,.color-options .color-option:active::before,.color-options .color-option:focus::before{content:"";border:3px solid var(--white-75);mix-blend-mode:difference}.color-options .color-option:active,.color-options .color-option:focus{box-shadow:0 0 0 4px rgba(125,125,125,.75) inset}.color-options .color-option.active:after{position:absolute;top:50%;left:50%;width:4px;height:4px;margin:-2px 0 0 -2px;content:"";border-radius:4px}.txt-dark .color-options .color-option.active:after{box-shadow:0 0 0 4px var(--white-90)}.txt-light .color-options .color-option.active:after{box-shadow:0 0 0 4px var(--black-90)}.color-form{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;padding:.25rem 0 0;font:12px sans-serif}.color-form.hex{max-width:initial}.color-form>*{flex:1 0 0%;width:17.5%;max-width:17.5%}.color-form label{width:7.5%;max-width:7.5%;text-align:center}.color-input{color:inherit;text-align:right;background:rgba(0,0,0,0);border:var(--input-border);outline:none}.color-input.hex{width:92.5%;max-width:92.5%}.color-input:active,.color-input:focus{background:var(--input-bg-hover);border:var(--input-border-hover)}.visual-control{height:150px;touch-action:none;box-shadow:var(--visual-shadow)}.visual-control1{width:150px}.visual-control2,.visual-control3{width:21px;cursor:ns-resize}@media(min-width: 578px){.visual-control{height:230px}.visual-control1{width:230px}}@media(min-width: 1200px){.visual-control{height:300px}.visual-control1{width:300px}}.color-control{position:relative;display:inline-block}.color-slider{left:0;width:calc(100% - 2px);cursor:ns-resize}.color-control+.color-control{margin-left:.5rem}.knob{position:absolute;top:0;left:0;height:7px;touch-action:none;user-select:none;background-color:var(--knob-bg);border:var(--knob-border);border-radius:5px;outline:none;will-change:transform}.knob:hover{box-shadow:var(--knob-shadow-hover)}.knob:focus,.knob:active{z-index:1;box-shadow:var(--knob-shadow-active)}.color-pointer{width:7px;background-color:rgba(0,0,0,0);border:0}.txt-dark .color-pointer{box-shadow:0 0 0 5px var(--white-50)}.txt-light .color-pointer{box-shadow:0 0 0 5px var(--black-50)}.txt-dark .color-pointer:hover{box-shadow:0 0 0 5px var(--white-75)}.txt-light .color-pointer:hover{box-shadow:0 0 0 5px var(--black-75)}.txt-dark .color-pointer:focus,.txt-dark .color-pointer:active{box-shadow:0 0 0 5px var(--white-90)}.txt-light .color-pointer:focus,.txt-light .color-pointer:active{box-shadow:0 0 0 5px var(--black-90)}.v-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}
1
+ /* ColorPicker v2.0.0-alpha10 | thednp © 2023 | MIT-License */
2
+ .color-picker{position:relative;display:flex;--white-15: rgba(255, 255, 255, 0.15);--white-25: rgba(255, 255, 255, 0.25);--white-33: rgba(255, 255, 255, 0.33);--white-50: rgba(255, 255, 255, 0.5);--white-75: rgba(255, 255, 255, 0.75);--white-90: rgba(255, 255, 255, 0.9);--black-15: rgba(0, 0, 0, 0.15);--black-25: rgba(0, 0, 0, 0.25);--black-33: rgba(0, 0, 0, 0.33);--black-50: rgba(0, 0, 0, 0.5);--black-75: rgba(0, 0, 0, 0.75);--black-90: rgba(0, 0, 0, 0.9);--dropdown-transition: transform 0.33s ease, opacity 0.33s ease;--btn-transition: box-shadow 0.33s ease, border 0.33s ease;--options-transition: height 0.33s ease;--dropdown-bg: var(--black-75);--dropdown-color: var(--white-75);--dropdown-shadow: 0 6px 12px var(--black-33);--dropdown-scrollbar-bg: var(--white-33);--dropdown-scrollbar-bg-hover: var(--white-50);--knob-bg: #000;--knob-border: 1px solid var(--white-90);--knob-shadow-hover: 0 0 0 6px var(--white-50);--knob-shadow-active: 0 0 0 6px var(--white-90);--input-border: 1px solid var(--white-15);--input-border-hover: 1px solid var(--white-33);--input-bg-hover: var(--black-15);--option-color-hover: var(--black-75);--option-bg-hover: var(--white-50);--option-color-active: var(--black-75);--option-bg-active: var(--white-90);--visual-shadow: 0 0 0 1px var(--white-15) inset}.color-picker *,.color-picker *::before,.color-picker *::after{box-sizing:border-box}.color-picker:focus{outline:none}.color-dropdown{position:absolute;z-index:50;display:none;flex-direction:column;width:min-content;padding:.5rem;color:var(--dropdown-color);background:var(--dropdown-bg);border-radius:.5rem;box-shadow:var(--dropdown-shadow);opacity:0;transition:var(--dropdown-transition)}.color-dropdown.picker{left:0}.color-dropdown.menu{right:0;max-height:230px}.open .color-dropdown.top{top:auto;bottom:100%}.color-dropdown.bottom{top:100%}.open .color-dropdown.top,.open .color-dropdown.bottom{display:flex}.color-dropdown.show{opacity:1}.color-dropdown.show.top{transform:translate(0, -5px)}.color-dropdown.show.bottom{transform:translate(0, 5px)}.color-controls{display:none;flex-wrap:wrap;justify-content:space-between;width:max-content}.btn-appearance{width:100%;padding:.6rem 1rem;font-size:1rem;line-height:1.5;border:0;border-radius:.25rem;outline:none;appearance:none;transition:var(--btn-transition)}.btn-appearance:focus,.btn-appearance:hover{box-shadow:0 0 0 3px var(--black-15)}.color-preview{box-shadow:0 0 0 1px rgba(120,120,120,.33) inset;direction:ltr}.txt-dark .color-preview{color:var(--white-75)}.txt-dark .color-preview:focus{box-shadow:0 0 0 1px #fff inset,0 0 0 3px var(--black-15)}.txt-dark .color-preview::placeholder{color:var(--white-50)}.txt-light .color-preview{color:var(--black-75)}.txt-light .color-preview:focus{color:var(--black-75);box-shadow:0 0 0 1px #000 inset,0 0 0 3px var(--black-15)}.txt-light .color-preview::placeholder{color:var(--black-50)}.picker-toggle{position:absolute;inset:0;width:100%;height:100%;cursor:pointer;background:rgba(0,0,0,0);border:0}.open .picker-toggle{z-index:-1}.menu-toggle{position:absolute;top:0;right:0;display:flex;width:3rem;height:100%;padding:0 .25rem;cursor:pointer;border:0;border-radius:0 .25rem .25rem 0}.txt-light .menu-toggle{background:var(--black-50)}.txt-light .menu-toggle:focus{background:var(--black-75)}.txt-dark .menu-toggle{background:var(--white-33)}.txt-dark .menu-toggle:focus{background:var(--white-50)}.menu-toggle svg{width:auto;height:100%}.scrollable{overflow-x:hidden;overflow-y:auto;scrollbar-width:thin}.scrollable::-webkit-scrollbar{width:.5rem}.scrollable::-webkit-scrollbar-track{background-color:rgba(0,0,0,0)}.scrollable::-webkit-scrollbar-thumb{width:.5rem;background-color:rgba(0,0,0,0);background-clip:content-box;border:0}.scrollable:hover::-webkit-scrollbar-thumb{background-color:var(--dropdown-scrollbar-bg)}.scrollable::-webkit-scrollbar-thumb:hover{background-color:var(--dropdown-scrollbar-bg-hover)}.color-defaults{display:none;flex-flow:column wrap;margin:0;list-style:none;padding-inline:0}.color-dropdown.menu .color-defaults,.color-dropdown.picker .color-controls{display:flex}.color-defaults .color-option{padding:.25rem .5rem;color:inherit}.color-option{cursor:pointer}.color-defaults .color-option:focus,.color-defaults .color-option:hover{color:var(--option-color-hover);background:var(--option-bg-hover);outline:none}.color-defaults .color-option:active,.color-defaults .color-option.active{color:var(--option-color-active);background:var(--option-bg-active)}.color-options{--grid-item-size: 2rem;--grid-fit: 5;--grid-gap: .25rem;--grid-height: auto;--grid-hover-height: auto;display:grid;padding:0;margin:0;list-style:none;grid-template-columns:repeat(var(--grid-fit), var(--grid-item-size));grid-template-rows:repeat(auto-fill, var(--grid-item-size));gap:var(--grid-gap)}.color-options.scrollable{height:var(--grid-height);margin:0 -0.5rem 0 0;overflow-y:scroll;transition:var(--options-transition)}.color-dropdown.menu:hover .scrollable{height:var(--grid-hover-height)}.color-options+.color-defaults{margin-top:.25rem}.multiline+.color-defaults{flex-flow:row wrap}.multiline+.color-defaults .color-option{padding:.25rem .33rem;font-size:12px}.color-options .color-option{position:relative;width:var(--grid-item-size);height:var(--grid-item-size);overflow:hidden;color:rgba(0,0,0,0)}.color-options .color-option:active,.color-options .color-option:focus{outline:none;box-shadow:0 0 0 4px rgba(125,125,125,.75) inset}.color-options .color-option::before{position:absolute;inset:0}.color-options .color-option:hover::before,.color-options .color-option:active::before,.color-options .color-option:focus::before{content:"";border:3px solid var(--white-75);mix-blend-mode:difference}.color-options .color-option.active::after{position:absolute;top:50%;left:50%;width:4px;height:4px;margin:-2px 0 0 -2px;content:"";border-radius:4px}.txt-dark .color-options .color-option.active::after{box-shadow:0 0 0 4px var(--white-90)}.txt-light .color-options .color-option.active::after{box-shadow:0 0 0 4px var(--black-90)}.color-form{display:flex;flex-flow:row wrap;align-items:center;padding:.25rem 0 0;font:12px sans-serif}.color-form.hex{max-width:initial}.color-form>*{flex:1 0 0%;width:17.5%;max-width:17.5%}.color-form label{width:7.5%;max-width:7.5%;text-align:center}.color-input{color:inherit;text-align:right;background:rgba(0,0,0,0);border:var(--input-border);outline:none}.color-input.hex{width:92.5%;max-width:92.5%}.color-input:active,.color-input:focus{background:var(--input-bg-hover);border:var(--input-border-hover)}.visual-control{height:230px;touch-action:none;box-shadow:var(--visual-shadow)}.visual-control1{width:230px}.visual-control2,.visual-control3{width:21px;cursor:ns-resize}@media(width >= 980px){.visual-control{height:300px}.visual-control1{width:300px}}.color-control{position:relative;display:inline-block}.color-slider{left:0;width:calc(100% - 2px);cursor:ns-resize}.color-control+.color-control{margin-left:.5rem}.knob{position:absolute;top:0;left:0;width:100%;height:7px;touch-action:none;user-select:none;background-color:var(--knob-bg);border:var(--knob-border);border-radius:5px;outline:none;will-change:transform}.knob:hover{box-shadow:var(--knob-shadow-hover)}.knob:focus,.knob:active{z-index:1;box-shadow:var(--knob-shadow-active)}.color-pointer{width:7px;background-color:rgba(0,0,0,0);border:0}.txt-dark .color-pointer{box-shadow:0 0 0 5px var(--white-50)}.txt-light .color-pointer{box-shadow:0 0 0 5px var(--black-50)}.txt-dark .color-pointer:hover{box-shadow:0 0 0 5px var(--white-75)}.txt-light .color-pointer:hover{box-shadow:0 0 0 5px var(--black-75)}.txt-dark .color-pointer:focus,.txt-dark .color-pointer:active{box-shadow:0 0 0 5px var(--white-90)}.txt-light .color-pointer:focus,.txt-light .color-pointer:active{box-shadow:0 0 0 5px var(--black-90)}.v-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}