@thednp/color-picker 1.0.1 → 2.0.0-alpha1
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.cjs +199 -0
- package/.lgtm.yml +9 -0
- package/.prettierrc.json +15 -0
- package/.stylelintrc.json +236 -0
- package/LICENSE +0 -0
- package/README.md +54 -72
- package/compile.js +48 -0
- package/cypress/downloads/downloads.htm +0 -0
- package/cypress/e2e/color-palette.cy.ts +128 -0
- package/cypress/e2e/color-picker.cy.ts +920 -0
- package/cypress/fixtures/colorNamesFrench.js +3 -0
- package/cypress/fixtures/componentLabelsFrench.js +21 -0
- package/cypress/fixtures/format.js +3 -0
- package/cypress/fixtures/getCEMarkup.js +29 -0
- package/cypress/fixtures/getMarkup.js +28 -0
- package/cypress/fixtures/getRandomInt.js +6 -0
- package/cypress/fixtures/sampleWebcolors.js +18 -0
- package/cypress/fixtures/testSample.js +8 -0
- package/cypress/plugins/esbuild-istanbul.ts +50 -0
- package/cypress/plugins/tsCompile.ts +34 -0
- package/cypress/support/commands.ts +0 -0
- package/cypress/support/e2e.ts +21 -0
- package/cypress/test.html +23 -0
- package/cypress.config.ts +29 -0
- package/dist/css/color-picker.css +14 -38
- package/dist/css/color-picker.min.css +2 -2
- package/dist/css/color-picker.rtl.css +14 -38
- package/dist/css/color-picker.rtl.min.css +2 -2
- package/dist/js/color-picker.cjs +8 -0
- package/dist/js/color-picker.cjs.map +1 -0
- package/dist/js/color-picker.d.ts +278 -0
- package/dist/js/color-picker.js +5 -3570
- package/dist/js/color-picker.js.map +1 -0
- package/dist/js/color-picker.mjs +2631 -0
- package/dist/js/color-picker.mjs.map +1 -0
- package/dts.config.ts +15 -0
- package/package.json +64 -74
- package/src/scss/_variables.scss +0 -1
- package/src/scss/color-picker.rtl.scss +4 -0
- package/src/scss/color-picker.scss +74 -38
- package/src/ts/colorPalette.ts +89 -0
- package/src/{js/color-picker.js → ts/index.ts} +489 -486
- package/src/ts/interface/colorPickerLabels.ts +20 -0
- package/src/ts/interface/colorPickerOptions.ts +11 -0
- package/src/ts/interface/paletteOptions.ts +6 -0
- package/src/ts/util/colorNames.ts +21 -0
- package/src/{js/util/colorPickerLabels.js → ts/util/colorPickerLabels.ts} +4 -2
- package/src/ts/util/getColorControls.ts +90 -0
- package/src/{js/util/getColorForm.js → ts/util/getColorForm.ts} +28 -18
- package/src/{js/util/getColorMenu.js → ts/util/getColorMenu.ts} +21 -30
- package/src/ts/util/isValidJSON.ts +19 -0
- package/src/{js/util/setMarkup.js → ts/util/setMarkup.ts} +57 -48
- package/src/{js/util/vHidden.js → ts/util/vHidden.ts} +0 -0
- package/tsconfig.json +29 -0
- package/vite.config.ts +34 -0
- package/dist/js/color-esm.js +0 -1164
- package/dist/js/color-esm.min.js +0 -2
- package/dist/js/color-palette-esm.js +0 -1235
- package/dist/js/color-palette-esm.min.js +0 -2
- package/dist/js/color-palette.js +0 -1243
- package/dist/js/color-palette.min.js +0 -2
- package/dist/js/color-picker-element-esm.js +0 -3718
- package/dist/js/color-picker-element-esm.min.js +0 -2
- package/dist/js/color-picker-element.js +0 -3726
- package/dist/js/color-picker-element.min.js +0 -2
- package/dist/js/color-picker-esm.js +0 -3565
- package/dist/js/color-picker-esm.min.js +0 -2
- package/dist/js/color-picker.min.js +0 -2
- package/dist/js/color.js +0 -1172
- package/dist/js/color.min.js +0 -2
- package/src/js/color-palette.js +0 -75
- package/src/js/color-picker-element.js +0 -107
- package/src/js/color.js +0 -1104
- package/src/js/index.js +0 -8
- package/src/js/util/colorNames.js +0 -6
- package/src/js/util/getColorControls.js +0 -103
- package/src/js/util/isValidJSON.js +0 -13
- package/src/js/util/nonColors.js +0 -5
- package/src/js/util/roundPart.js +0 -9
- package/src/js/util/setCSSProperties.js +0 -12
- package/src/js/util/tabindex.js +0 -3
- package/src/js/util/toggleCEAttr.js +0 -70
- package/src/js/util/version.js +0 -5
- package/src/js/version.js +0 -5
- package/types/cp.d.ts +0 -558
- package/types/index.d.ts +0 -44
- package/types/source/source.ts +0 -4
- package/types/source/types.d.ts +0 -92
@@ -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,29 @@
|
|
1
|
+
import ColorPickerElement from '../../src/js/color-picker-element';
|
2
|
+
|
3
|
+
import getRandomInt from './getRandomInt';
|
4
|
+
import testSample from './testSample';
|
5
|
+
import FORMAT from './format';
|
6
|
+
import colorNamesFrench from './colorNamesFrench';
|
7
|
+
import componentLabelsFrench from './componentLabelsFrench';
|
8
|
+
|
9
|
+
export default function getCEMarkup(body) {
|
10
|
+
const id = getRandomInt(0,9999);
|
11
|
+
const format = FORMAT[getRandomInt(0,3)];
|
12
|
+
const sample = testSample[getRandomInt(0,2)];
|
13
|
+
const value = sample[format];
|
14
|
+
|
15
|
+
// const cpe = document.createElement('color-picker');
|
16
|
+
const cpe = new ColorPickerElement();
|
17
|
+
cpe.setAttribute('data-id', `cpe-${format}-${id}`);
|
18
|
+
cpe.setAttribute('data-format', format);
|
19
|
+
cpe.setAttribute('data-value', value);
|
20
|
+
cpe.setAttribute('data-component-labels', JSON.stringify(componentLabelsFrench));
|
21
|
+
cpe.setAttribute('data-color-labels', colorNamesFrench);
|
22
|
+
cpe.setAttribute('data-color-keywords', 'red,gree,blue');
|
23
|
+
cpe.setAttribute('data-color-presets', '#330000,#990000,#ff0000,#ff6666,#ffcccc,#003333,#009999,#00ffff,#66ffff,#ccffff');
|
24
|
+
|
25
|
+
if (body) {
|
26
|
+
body.append(cpe);
|
27
|
+
}
|
28
|
+
return {value, id, format};
|
29
|
+
}
|
@@ -0,0 +1,28 @@
|
|
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
|
+
cpWrapper.append(input);
|
24
|
+
if (body) {
|
25
|
+
body.append(label, cpWrapper);
|
26
|
+
}
|
27
|
+
return {set, value};
|
28
|
+
}
|
@@ -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
|
3
|
-
* Copyright
|
4
|
-
* Licensed under MIT (
|
2
|
+
* ColorPicker v2.0.0-alpha1 (http://thednp.github.io/color-picker)
|
3
|
+
* Copyright 2023 © thednp
|
4
|
+
* Licensed under MIT (MIT/blob/main/LICENSE)
|
5
5
|
*/
|
6
6
|
/* :host */
|
7
|
-
color-picker,
|
8
7
|
.color-picker {
|
9
8
|
position: relative;
|
10
9
|
display: flex;
|
@@ -42,7 +41,6 @@ color-picker,
|
|
42
41
|
--visual-shadow: 0 0 0 1px var(--white-15) inset;
|
43
42
|
}
|
44
43
|
|
45
|
-
color-picker:focus,
|
46
44
|
.color-picker:focus {
|
47
45
|
outline: none;
|
48
46
|
}
|
@@ -69,6 +67,7 @@ color-picker:focus,
|
|
69
67
|
|
70
68
|
.color-dropdown.menu {
|
71
69
|
right: 0;
|
70
|
+
max-height: 230px;
|
72
71
|
}
|
73
72
|
|
74
73
|
.open .color-dropdown.top {
|
@@ -127,8 +126,7 @@ color-picker:focus,
|
|
127
126
|
/* color-preview */
|
128
127
|
.color-preview {
|
129
128
|
box-shadow: 0 0 0 1px rgba(120, 120, 120, 0.33) inset;
|
130
|
-
direction: ltr;
|
131
|
-
/* color value can never be rtl */
|
129
|
+
direction: ltr; /* color value can never be rtl */
|
132
130
|
}
|
133
131
|
|
134
132
|
.txt-dark .color-preview {
|
@@ -188,8 +186,6 @@ color-picker:focus,
|
|
188
186
|
.txt-light .menu-toggle {
|
189
187
|
background: var(--black-50);
|
190
188
|
}
|
191
|
-
|
192
|
-
.txt-light .menu-toggle:focus,
|
193
189
|
.txt-light .menu-toggle:focus {
|
194
190
|
background: var(--black-75);
|
195
191
|
}
|
@@ -197,8 +193,6 @@ color-picker:focus,
|
|
197
193
|
.txt-dark .menu-toggle {
|
198
194
|
background: var(--white-33);
|
199
195
|
}
|
200
|
-
|
201
|
-
.txt-dark .menu-toggle:focus,
|
202
196
|
.txt-dark .menu-toggle:focus {
|
203
197
|
background: var(--white-50);
|
204
198
|
}
|
@@ -241,8 +235,7 @@ color-picker:focus,
|
|
241
235
|
/* color-defaults */
|
242
236
|
.color-defaults {
|
243
237
|
display: none;
|
244
|
-
flex-
|
245
|
-
flex-flow: column;
|
238
|
+
flex-flow: column wrap;
|
246
239
|
margin: 0;
|
247
240
|
list-style: none;
|
248
241
|
padding-inline: 0;
|
@@ -253,10 +246,6 @@ color-picker:focus,
|
|
253
246
|
display: flex;
|
254
247
|
}
|
255
248
|
|
256
|
-
.color-dropdown.menu {
|
257
|
-
max-height: 230px;
|
258
|
-
}
|
259
|
-
|
260
249
|
.color-defaults .color-option {
|
261
250
|
padding: 0.25rem 0.5rem;
|
262
251
|
color: inherit;
|
@@ -311,8 +300,7 @@ color-picker:focus,
|
|
311
300
|
}
|
312
301
|
|
313
302
|
.multiline + .color-defaults {
|
314
|
-
flex-
|
315
|
-
flex-wrap: wrap;
|
303
|
+
flex-flow: row wrap;
|
316
304
|
}
|
317
305
|
.multiline + .color-defaults .color-option {
|
318
306
|
padding: 0.25rem 0.33rem;
|
@@ -326,18 +314,14 @@ color-picker:focus,
|
|
326
314
|
overflow: hidden;
|
327
315
|
text-indent: 2.1rem;
|
328
316
|
}
|
329
|
-
|
330
|
-
.color-options .color-option:active,
|
331
|
-
.color-options .color-option:focus {
|
317
|
+
.color-options .color-option:active, .color-options .color-option:focus {
|
332
318
|
outline: none;
|
319
|
+
box-shadow: 0 0 0 4px rgba(125, 125, 125, 0.75) inset;
|
333
320
|
}
|
334
321
|
|
335
322
|
.color-options .color-option::before {
|
336
323
|
position: absolute;
|
337
|
-
|
338
|
-
right: 0;
|
339
|
-
bottom: 0;
|
340
|
-
left: 0;
|
324
|
+
inset: 0;
|
341
325
|
}
|
342
326
|
|
343
327
|
.color-options .color-option:hover::before,
|
@@ -348,12 +332,7 @@ color-picker:focus,
|
|
348
332
|
mix-blend-mode: difference;
|
349
333
|
}
|
350
334
|
|
351
|
-
.color-options .color-option
|
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 {
|
335
|
+
.color-options .color-option.active::after {
|
357
336
|
position: absolute;
|
358
337
|
top: 50%;
|
359
338
|
left: 50%;
|
@@ -364,19 +343,18 @@ color-picker:focus,
|
|
364
343
|
border-radius: 4px;
|
365
344
|
}
|
366
345
|
|
367
|
-
.txt-dark .color-options .color-option.active
|
346
|
+
.txt-dark .color-options .color-option.active::after {
|
368
347
|
box-shadow: 0 0 0 4px var(--white-90);
|
369
348
|
}
|
370
349
|
|
371
|
-
.txt-light .color-options .color-option.active
|
350
|
+
.txt-light .color-options .color-option.active::after {
|
372
351
|
box-shadow: 0 0 0 4px var(--black-90);
|
373
352
|
}
|
374
353
|
|
375
354
|
/* color-form */
|
376
355
|
.color-form {
|
377
356
|
display: flex;
|
378
|
-
flex-
|
379
|
-
flex-wrap: wrap;
|
357
|
+
flex-flow: row wrap;
|
380
358
|
align-items: center;
|
381
359
|
padding: 0.25rem 0 0;
|
382
360
|
font: 12px sans-serif;
|
@@ -439,7 +417,6 @@ color-picker:focus,
|
|
439
417
|
.visual-control {
|
440
418
|
height: 230px;
|
441
419
|
}
|
442
|
-
|
443
420
|
.visual-control1 {
|
444
421
|
width: 230px;
|
445
422
|
}
|
@@ -448,7 +425,6 @@ color-picker:focus,
|
|
448
425
|
.visual-control {
|
449
426
|
height: 300px;
|
450
427
|
}
|
451
|
-
|
452
428
|
.visual-control1 {
|
453
429
|
width: 300px;
|
454
430
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/* ColorPicker
|
2
|
-
color-picker
|
1
|
+
/* ColorPicker v2.0.0-alpha1 | 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: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%;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{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-options.scrollable:hover{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;text-indent:2.1rem}.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: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,10 +1,9 @@
|
|
1
1
|
/*!
|
2
|
-
* ColorPicker
|
3
|
-
* Copyright
|
4
|
-
* Licensed under MIT (
|
2
|
+
* ColorPicker v2.0.0-alpha1 (http://thednp.github.io/color-picker)
|
3
|
+
* Copyright 2023 © thednp
|
4
|
+
* Licensed under MIT (MIT/blob/main/LICENSE)
|
5
5
|
*/
|
6
6
|
/* :host */
|
7
|
-
color-picker,
|
8
7
|
.color-picker {
|
9
8
|
position: relative;
|
10
9
|
display: flex;
|
@@ -42,7 +41,6 @@ color-picker,
|
|
42
41
|
--visual-shadow: 0 0 0 1px var(--white-15) inset;
|
43
42
|
}
|
44
43
|
|
45
|
-
color-picker:focus,
|
46
44
|
.color-picker:focus {
|
47
45
|
outline: none;
|
48
46
|
}
|
@@ -69,6 +67,7 @@ color-picker:focus,
|
|
69
67
|
|
70
68
|
.color-dropdown.menu {
|
71
69
|
right: 0;
|
70
|
+
max-height: 230px;
|
72
71
|
}
|
73
72
|
|
74
73
|
.open .color-dropdown.top {
|
@@ -127,8 +126,7 @@ color-picker:focus,
|
|
127
126
|
/* color-preview */
|
128
127
|
.color-preview {
|
129
128
|
box-shadow: 0 0 0 1px rgba(120, 120, 120, 0.33) inset;
|
130
|
-
direction: ltr;
|
131
|
-
/* color value can never be rtl */
|
129
|
+
direction: ltr; /* color value can never be rtl */
|
132
130
|
}
|
133
131
|
|
134
132
|
.txt-dark .color-preview {
|
@@ -188,8 +186,6 @@ color-picker:focus,
|
|
188
186
|
.txt-light .menu-toggle {
|
189
187
|
background: var(--black-50);
|
190
188
|
}
|
191
|
-
|
192
|
-
.txt-light .menu-toggle:focus,
|
193
189
|
.txt-light .menu-toggle:focus {
|
194
190
|
background: var(--black-75);
|
195
191
|
}
|
@@ -197,8 +193,6 @@ color-picker:focus,
|
|
197
193
|
.txt-dark .menu-toggle {
|
198
194
|
background: var(--white-33);
|
199
195
|
}
|
200
|
-
|
201
|
-
.txt-dark .menu-toggle:focus,
|
202
196
|
.txt-dark .menu-toggle:focus {
|
203
197
|
background: var(--white-50);
|
204
198
|
}
|
@@ -241,8 +235,7 @@ color-picker:focus,
|
|
241
235
|
/* color-defaults */
|
242
236
|
.color-defaults {
|
243
237
|
display: none;
|
244
|
-
flex-
|
245
|
-
flex-flow: column;
|
238
|
+
flex-flow: column wrap;
|
246
239
|
margin: 0;
|
247
240
|
list-style: none;
|
248
241
|
padding-inline: 0;
|
@@ -253,10 +246,6 @@ color-picker:focus,
|
|
253
246
|
display: flex;
|
254
247
|
}
|
255
248
|
|
256
|
-
.color-dropdown.menu {
|
257
|
-
max-height: 230px;
|
258
|
-
}
|
259
|
-
|
260
249
|
.color-defaults .color-option {
|
261
250
|
padding: 0.25rem 0.5rem;
|
262
251
|
color: inherit;
|
@@ -311,8 +300,7 @@ color-picker:focus,
|
|
311
300
|
}
|
312
301
|
|
313
302
|
.multiline + .color-defaults {
|
314
|
-
flex-
|
315
|
-
flex-wrap: wrap;
|
303
|
+
flex-flow: row wrap;
|
316
304
|
}
|
317
305
|
.multiline + .color-defaults .color-option {
|
318
306
|
padding: 0.25rem 0.33rem;
|
@@ -326,18 +314,14 @@ color-picker:focus,
|
|
326
314
|
overflow: hidden;
|
327
315
|
text-indent: 2.1rem;
|
328
316
|
}
|
329
|
-
|
330
|
-
.color-options .color-option:active,
|
331
|
-
.color-options .color-option:focus {
|
317
|
+
.color-options .color-option:active, .color-options .color-option:focus {
|
332
318
|
outline: none;
|
319
|
+
box-shadow: 0 0 0 4px rgba(125, 125, 125, 0.75) inset;
|
333
320
|
}
|
334
321
|
|
335
322
|
.color-options .color-option::before {
|
336
323
|
position: absolute;
|
337
|
-
|
338
|
-
right: 0;
|
339
|
-
bottom: 0;
|
340
|
-
left: 0;
|
324
|
+
inset: 0;
|
341
325
|
}
|
342
326
|
|
343
327
|
.color-options .color-option:hover::before,
|
@@ -348,12 +332,7 @@ color-picker:focus,
|
|
348
332
|
mix-blend-mode: difference;
|
349
333
|
}
|
350
334
|
|
351
|
-
.color-options .color-option
|
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 {
|
335
|
+
.color-options .color-option.active::after {
|
357
336
|
position: absolute;
|
358
337
|
top: 50%;
|
359
338
|
left: 50%;
|
@@ -364,19 +343,18 @@ color-picker:focus,
|
|
364
343
|
border-radius: 4px;
|
365
344
|
}
|
366
345
|
|
367
|
-
.txt-dark .color-options .color-option.active
|
346
|
+
.txt-dark .color-options .color-option.active::after {
|
368
347
|
box-shadow: 0 0 0 4px var(--white-90);
|
369
348
|
}
|
370
349
|
|
371
|
-
.txt-light .color-options .color-option.active
|
350
|
+
.txt-light .color-options .color-option.active::after {
|
372
351
|
box-shadow: 0 0 0 4px var(--black-90);
|
373
352
|
}
|
374
353
|
|
375
354
|
/* color-form */
|
376
355
|
.color-form {
|
377
356
|
display: flex;
|
378
|
-
flex-
|
379
|
-
flex-wrap: wrap;
|
357
|
+
flex-flow: row wrap;
|
380
358
|
align-items: center;
|
381
359
|
padding: 0.25rem 0 0;
|
382
360
|
font: 12px sans-serif;
|
@@ -439,7 +417,6 @@ color-picker:focus,
|
|
439
417
|
.visual-control {
|
440
418
|
height: 230px;
|
441
419
|
}
|
442
|
-
|
443
420
|
.visual-control1 {
|
444
421
|
width: 230px;
|
445
422
|
}
|
@@ -448,7 +425,6 @@ color-picker:focus,
|
|
448
425
|
.visual-control {
|
449
426
|
height: 300px;
|
450
427
|
}
|
451
|
-
|
452
428
|
.visual-control1 {
|
453
429
|
width: 300px;
|
454
430
|
}
|