@thednp/color-picker 2.0.0-alpha1 → 2.0.0-alpha10
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.cjs +1 -1
- package/.lgtm.yml +0 -0
- package/.prettierrc.json +0 -0
- package/.stylelintrc.json +0 -0
- package/LICENSE +0 -0
- package/README.md +8 -7
- package/compile.js +6 -3
- package/cypress/e2e/color-palette.cy.ts +0 -0
- package/cypress/e2e/color-picker.cy.ts +58 -69
- package/cypress/fixtures/colorNamesFrench.js +0 -0
- package/cypress/fixtures/componentLabelsFrench.js +0 -0
- package/cypress/fixtures/format.js +0 -0
- package/cypress/fixtures/getMarkup.js +8 -1
- package/cypress/fixtures/getRandomInt.js +0 -0
- package/cypress/fixtures/sampleWebcolors.js +0 -0
- package/cypress/fixtures/testSample.js +0 -0
- package/cypress/plugins/esbuild-istanbul.ts +0 -0
- package/cypress/plugins/tsCompile.ts +0 -0
- package/cypress/support/commands.ts +0 -0
- package/cypress/support/e2e.ts +0 -0
- package/cypress/test.html +0 -0
- package/cypress.config.ts +0 -0
- package/dist/css/color-picker.css +13 -18
- package/dist/css/color-picker.min.css +2 -2
- package/dist/css/color-picker.rtl.css +13 -18
- package/dist/css/color-picker.rtl.min.css +2 -2
- package/dist/js/color-picker.cjs +3 -3
- package/dist/js/color-picker.cjs.map +1 -1
- package/dist/js/color-picker.d.ts +42 -24
- package/dist/js/color-picker.js +3 -3
- package/dist/js/color-picker.js.map +1 -1
- package/dist/js/color-picker.mjs +408 -421
- package/dist/js/color-picker.mjs.map +1 -1
- package/dts.config.ts +0 -0
- package/package.json +116 -98
- package/src/scss/_variables.scss +0 -0
- package/src/scss/color-picker.rtl.scss +0 -0
- package/src/scss/color-picker.scss +20 -14
- package/src/ts/colorPalette.ts +0 -0
- package/src/ts/index.ts +40 -54
- package/src/ts/interface/ColorNames.ts +20 -0
- package/src/ts/interface/colorPickerLabels.ts +0 -0
- package/src/ts/interface/colorPickerOptions.ts +0 -0
- package/src/ts/interface/paletteOptions.ts +0 -0
- package/src/ts/util/colorNames.ts +0 -0
- package/src/ts/util/colorPickerLabels.ts +0 -0
- package/src/ts/util/getColorControls.ts +0 -0
- package/src/ts/util/getColorForm.ts +0 -0
- package/src/ts/util/getColorMenu.ts +0 -0
- package/src/ts/util/isValidJSON.ts +0 -0
- package/src/ts/util/setMarkup.ts +6 -4
- package/src/ts/util/vHidden.ts +0 -0
- package/tsconfig.json +1 -1
- package/vite.config.ts +0 -0
- package/cypress/downloads/downloads.htm +0 -0
- package/cypress/fixtures/getCEMarkup.js +0 -29
package/.eslintrc.cjs
CHANGED
@@ -127,7 +127,7 @@ module.exports = {
|
|
127
127
|
indent: 'off',
|
128
128
|
'jsdoc/check-alignment': 'error',
|
129
129
|
'jsdoc/check-indentation': 'error',
|
130
|
-
'jsdoc/newline-after-description': 'error',
|
130
|
+
// 'jsdoc/newline-after-description': 'error',
|
131
131
|
'linebreak-style': 'off',
|
132
132
|
'max-classes-per-file': ['error', 1],
|
133
133
|
'max-len': 'off',
|
package/.lgtm.yml
CHANGED
File without changes
|
package/.prettierrc.json
CHANGED
File without changes
|
package/.stylelintrc.json
CHANGED
File without changes
|
package/LICENSE
CHANGED
File without changes
|
package/README.md
CHANGED
@@ -4,13 +4,13 @@
|
|
4
4
|
[![ci](https://github.com/thednp/color-picker/actions/workflows/ci.yml/badge.svg)](https://github.com/thednp/color-picker/actions/workflows/ci.yml)
|
5
5
|
[![jsDeliver](https://img.shields.io/jsdelivr/npm/hw/@thednp/color-picker)](https://www.jsdelivr.com/package/npm/@thednp/color-picker)
|
6
6
|
[![NPM Version](https://img.shields.io/npm/v/@thednp/color-picker.svg)](https://www.npmjs.com/package/@thednp/color-picker)
|
7
|
-
[![typescript version](https://img.shields.io/badge/typescript-5.
|
8
|
-
[![eslint version](https://img.shields.io/badge/eslint-8.
|
9
|
-
[![prettier version](https://img.shields.io/badge/prettier-
|
10
|
-
[![cypress version](https://img.shields.io/badge/cypress-
|
11
|
-
[![vite version](https://img.shields.io/badge/vite-4.
|
7
|
+
[![typescript version](https://img.shields.io/badge/typescript-5.2.2-brightgreen)](https://www.typescriptlang.org/)
|
8
|
+
[![eslint version](https://img.shields.io/badge/eslint-8.49.0-brightgreen)](https://github.com/eslint)
|
9
|
+
[![prettier version](https://img.shields.io/badge/prettier-3.0.3-brightgreen)](https://prettier.io/)
|
10
|
+
[![cypress version](https://img.shields.io/badge/cypress-13.1.0-brightgreen)](https://cypress.io/)
|
11
|
+
[![vite version](https://img.shields.io/badge/vite-4.4.9-brightgreen)](https://github.com/vitejs)
|
12
12
|
|
13
|
-
The feature rich **ColorPicker** component for the modern web sourced with TypeScript, Cypress tested, WAI-ARIA compliant and lots of goodies. In addition, it features its own version of [TinyColor](https://github.com/bgrins/TinyColor) called simply [Color](http://github.com/thednp/color).
|
13
|
+
The feature rich **ColorPicker** component for the modern web, sourced with TypeScript, Cypress tested, WAI-ARIA compliant and lots of goodies. In addition, it features its own version of [TinyColor](https://github.com/bgrins/TinyColor) called simply [Color](http://github.com/thednp/color).
|
14
14
|
|
15
15
|
**ColorPicker** can use existing colour palettes or generate custom ones via DATA API configuration. If you want to play, check out [this codepen](https://codepen.io/thednp/pen/WNdRWPN) I've setup for you. Have fun!
|
16
16
|
|
@@ -19,12 +19,13 @@ The feature rich **ColorPicker** component for the modern web sourced with TypeS
|
|
19
19
|
## Highlights
|
20
20
|
|
21
21
|
- Accessibility Focus for WAI-ARIA compliance
|
22
|
-
-
|
22
|
+
- TypeScript sourced code base
|
23
23
|
- Framework agnostic and flexible design
|
24
24
|
- Supporting HEX(a), RGB(a), HSL(a) and HWB, the last three also in CSS4 Color Module flavours
|
25
25
|
- Supports keyboard and touch events
|
26
26
|
- Automatic repositioning of the popup dropdown on show / window scroll
|
27
27
|
- SCSS sources with minimal style required
|
28
|
+
- Cypress tested
|
28
29
|
- Right To Left Languages Supported
|
29
30
|
- light footprint, `10kb` in size when minified and gZipped
|
30
31
|
|
package/compile.js
CHANGED
@@ -2,12 +2,15 @@
|
|
2
2
|
// Build script to compile and minify the CSS file from SCSS folder
|
3
3
|
// Usage: npm run compile-scss
|
4
4
|
|
5
|
-
const
|
6
|
-
const writeFileSync = fs.writeFileSync;
|
5
|
+
const {writeFileSync} = require("fs");
|
6
|
+
// const writeFileSync = fs.writeFileSync;
|
7
|
+
// import { writeFileSync } from "fs";
|
7
8
|
const sass = require("sass");
|
8
9
|
const pkg = require("./package.json");
|
9
10
|
const year = new Date().getFullYear();
|
10
11
|
const args = {};
|
12
|
+
const pkName = pkg.name.includes(pkg.author) ? pkg.name.replace('@','') : `${pkg.author}/${pkg.name}`;
|
13
|
+
const home = `https://github.com/${pkName}`;
|
11
14
|
|
12
15
|
const ARGS = process.argv.slice(-1)[0].split(",");
|
13
16
|
ARGS.map((x) => {
|
@@ -22,7 +25,7 @@ const banner =
|
|
22
25
|
: `/*!
|
23
26
|
* ColorPicker v${pkg.version} (${pkg.homepage})
|
24
27
|
* Copyright ${year} © ${pkg.author}
|
25
|
-
* Licensed under MIT (${
|
28
|
+
* Licensed under MIT (${home}/blob/main/LICENSE)
|
26
29
|
*/`;
|
27
30
|
|
28
31
|
const DIR = args.DIR === "rtl" ? ".rtl" : "";
|
File without changes
|
@@ -80,11 +80,10 @@ describe('ColorPicker Class Test', () => {
|
|
80
80
|
});
|
81
81
|
|
82
82
|
cy.document().should('not.be.undefined')
|
83
|
-
|
84
|
-
|
85
|
-
.
|
86
|
-
|
87
|
-
})
|
83
|
+
cy.get('@input').should('exist')
|
84
|
+
cy.document().invoke('querySelectorAll', selector).then((nodelist ) => {
|
85
|
+
[...nodelist as NodeListOf<HTMLInputElement>].forEach(init);
|
86
|
+
})
|
88
87
|
|
89
88
|
cy.get('@input').then(($input) => {
|
90
89
|
if ($input.length) {
|
@@ -95,8 +94,9 @@ describe('ColorPicker Class Test', () => {
|
|
95
94
|
|
96
95
|
cy.get('@cp').should('exist')
|
97
96
|
.get('@cp').then(() => {
|
98
|
-
cy.get('@cp').its('colorLabels').then((
|
99
|
-
|
97
|
+
cy.get('@cp').its('colorLabels').then((lbls) => {
|
98
|
+
// console.log(lbls)
|
99
|
+
expect(Object.values(lbls))
|
100
100
|
.to.deep.equal(colorNamesFrench.split(','));
|
101
101
|
})
|
102
102
|
|
@@ -130,17 +130,18 @@ describe('ColorPicker Class Test', () => {
|
|
130
130
|
colorLabels: colorNamesFrench,
|
131
131
|
componentLabels: componentLabelsFrench,
|
132
132
|
});
|
133
|
-
console.log(cp)
|
133
|
+
// console.log(cp)
|
134
134
|
cy.wrap(cp).as('cp');
|
135
135
|
cy.get('@cp').then(() => {
|
136
136
|
cy.get('@cp').its('input').should('equal', input[0]);
|
137
137
|
cy.get('@cp').its('format').should('equal', format);
|
138
138
|
cy.get('@cp').its('value').should('equal', value);
|
139
139
|
cy.get('@cp').its('colorPresets').should('be.instanceOf', Array);
|
140
|
-
cy.get('@cp').its('colorLabels')
|
141
|
-
.
|
142
|
-
|
143
|
-
|
140
|
+
cy.get('@cp').its('colorLabels').then((lbls) => {
|
141
|
+
// console.log(lbls)
|
142
|
+
expect(Object.values(lbls))
|
143
|
+
.to.deep.equal(colorNamesFrench.split(','));
|
144
|
+
})
|
144
145
|
cy.get('@cp').its('colorKeywords').should('deep.equal', ['orange', 'lime', 'darkred']);
|
145
146
|
cy.get('@cp').its('colorPicker').should('be.instanceOf', HTMLDivElement);
|
146
147
|
cy.get('@cp').its('colorMenu').should('be.instanceOf', HTMLDivElement);
|
@@ -180,10 +181,7 @@ describe('ColorPicker Class Test', () => {
|
|
180
181
|
cy.wrap(new ColorPicker(input[0], {
|
181
182
|
colorPresets: '#330033, #990099, #ff00ff, #ff66ff, #ffccff'.split(','),
|
182
183
|
})).as('cp');
|
183
|
-
|
184
|
-
// .then(() => {
|
185
|
-
cy.get('@cp').its('colorPresets').should('be.instanceOf', Array);
|
186
|
-
// });
|
184
|
+
cy.get('@cp').its('colorPresets').should('be.instanceOf', Array);
|
187
185
|
}
|
188
186
|
});
|
189
187
|
});
|
@@ -203,12 +201,15 @@ describe('ColorPicker Class Test', () => {
|
|
203
201
|
cy.wrap(input[0]).focus().clear().type('hsl 0 100 50{enter}')
|
204
202
|
cy.wait(50)
|
205
203
|
cy.get('@cp').its('rgb').then((rgb) => {
|
206
|
-
cy.
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
204
|
+
// cy.wait(17)
|
205
|
+
|
206
|
+
cy.get('.visual-control').eq(0)
|
207
|
+
.trigger('pointerdown', 0, 0, { eventConstructor: 'PointerEvent', force: true, pointerType: 'touch' })
|
208
|
+
.trigger('pointermove', -5, -5, { eventConstructor: 'PointerEvent', force: true, pointerType: 'touch' })
|
209
|
+
.trigger('pointermove', 500, 500, { eventConstructor: 'PointerEvent', force: true, pointerType: 'touch' })
|
210
|
+
.trigger('pointermove', 100, 100, {eventConstructor: 'PointerEvent', force: true, pointerType: 'touch' })
|
211
|
+
.trigger('pointerup', 100, 100, {eventConstructor: 'PointerEvent', force: true, pointerType: 'touch' })
|
212
|
+
.then(() => {
|
212
213
|
cy.get('@cp').its('rgb').should('not.deep.equal', rgb);
|
213
214
|
})
|
214
215
|
});
|
@@ -216,26 +217,25 @@ describe('ColorPicker Class Test', () => {
|
|
216
217
|
cy.wrap(input[0]).focus().clear().type('hsl 0 100 50{enter}')
|
217
218
|
.get('@cp').its('rgb').then((rgb) => {
|
218
219
|
cy.get('.visual-control').eq(1)
|
219
|
-
.trigger('pointerdown', 3, 0, { force: true, pointerType: 'touch' })
|
220
|
-
.trigger('pointermove', 0, -5, { force: true, pointerType: 'touch' })
|
221
|
-
.trigger('pointermove', 3, 500, { force: true, pointerType: 'touch' })
|
222
|
-
.trigger('pointermove', 3, 100, { force: true, pointerType: 'touch' })
|
223
|
-
.trigger('pointerup', 3, 100, { force: true, pointerType: 'touch' })
|
220
|
+
.trigger('pointerdown', 3, 0, { eventConstructor: 'PointerEvent', force: true, pointerType: 'touch' })
|
221
|
+
.trigger('pointermove', 0, -5, { eventConstructor: 'PointerEvent', force: true, pointerType: 'touch' })
|
222
|
+
.trigger('pointermove', 3, 500, { eventConstructor: 'PointerEvent', force: true, pointerType: 'touch' })
|
223
|
+
.trigger('pointermove', 3, 100, { eventConstructor: 'PointerEvent', force: true, pointerType: 'touch' })
|
224
|
+
.trigger('pointerup', 3, 100, { eventConstructor: 'PointerEvent', force: true, pointerType: 'touch' })
|
224
225
|
.then(() => {
|
225
|
-
cy.
|
226
|
-
.get('@cp').its('rgb').should('not.deep.equal', rgb);
|
226
|
+
cy.get('@cp').its('rgb').should('not.deep.equal', rgb);
|
227
227
|
})
|
228
228
|
});
|
229
229
|
|
230
230
|
cy.wrap(input[0]).focus().clear().type('hsl 0 100 50{enter}')
|
231
|
-
.get('@cp').its('rgb').then((rgb) => {
|
231
|
+
cy.get('@cp').its('rgb').then((rgb) => {
|
232
232
|
cy.get('.visual-control').eq(2)
|
233
|
-
.trigger('pointerdown', 3, 0, { force: true, pointerType: 'touch' })
|
234
|
-
.trigger('pointermove', 3, -5, { force: true, pointerType: 'touch' })
|
235
|
-
.trigger('pointermove', 3, 200, { force: true, pointerType: 'touch' })
|
236
|
-
.trigger('pointermove', 3, 500, { force: true, pointerType: 'touch' })
|
237
|
-
.trigger('pointermove', 3, 100, { force: true, pointerType: 'touch' })
|
238
|
-
.trigger('pointerup', 3, 100, { force: true, pointerType: 'touch' })
|
233
|
+
.trigger('pointerdown', 3, 0, { eventConstructor: 'PointerEvent', force: true, pointerType: 'touch' })
|
234
|
+
.trigger('pointermove', 3, -5, { eventConstructor: 'PointerEvent', force: true, pointerType: 'touch' })
|
235
|
+
.trigger('pointermove', 3, 200, { eventConstructor: 'PointerEvent', force: true, pointerType: 'touch' })
|
236
|
+
.trigger('pointermove', 3, 500, { eventConstructor: 'PointerEvent', force: true, pointerType: 'touch' })
|
237
|
+
.trigger('pointermove', 3, 100, { eventConstructor: 'PointerEvent', force: true, pointerType: 'touch' })
|
238
|
+
.trigger('pointerup', 3, 100, { eventConstructor: 'PointerEvent', force: true, pointerType: 'touch' })
|
239
239
|
.then(() => {
|
240
240
|
cy.wait(17)
|
241
241
|
.get('@cp').its('rgb').should('not.deep.equal', rgb);
|
@@ -253,11 +253,7 @@ describe('ColorPicker Class Test', () => {
|
|
253
253
|
const format = FORMAT[getRandomInt(0,3)];
|
254
254
|
getMarkup(body, id, format);
|
255
255
|
|
256
|
-
|
257
|
-
// a.setAttribute('href', '#');
|
258
|
-
a.innerText = 'Some link';
|
259
|
-
body.append(a);
|
260
|
-
cy.wrap(a).as('a');
|
256
|
+
// cy.wrap(a).as('a');
|
261
257
|
// cy.get(`#color-picker-${id}`).then((input) => {
|
262
258
|
cy.get('input').then((input) => {
|
263
259
|
cy.wrap(input[0]).as('input');
|
@@ -329,16 +325,9 @@ describe('ColorPicker Class Test', () => {
|
|
329
325
|
cy.wait(17);
|
330
326
|
|
331
327
|
cy.log('Testing `focusout` on `input`');
|
332
|
-
cy.get('@a').focus()
|
333
|
-
cy.get('@a').blur()
|
334
328
|
|
335
|
-
|
336
|
-
cy.
|
337
|
-
// cy.get('@a').trigger('focusin', {force: true})
|
338
|
-
// cy.get('@a').trigger('focusout', {force: true})
|
339
|
-
// .then(() => {
|
340
|
-
cy.get('.color-dropdown.picker').should('not.have.class', 'show')
|
341
|
-
// });
|
329
|
+
cy.get('a.my-link').eq(0).click({force: true})
|
330
|
+
cy.get('.color-dropdown.picker').should('not.have.class', 'show')
|
342
331
|
|
343
332
|
cy.wait(17);
|
344
333
|
|
@@ -601,12 +590,12 @@ describe('ColorPicker Class Test', () => {
|
|
601
590
|
const { width, height} = visual[0].getBoundingClientRect();
|
602
591
|
|
603
592
|
cy.get('.knob').eq(0)
|
604
|
-
.trigger('pointerdown', { force: true })
|
605
|
-
.trigger('pointermove', -width, -height, { force: true })
|
606
|
-
.trigger('pointermove', -width - 100, -height - 100, { force: true })
|
607
|
-
.trigger('pointermove', 300, 300, { force: true })
|
608
|
-
.trigger('pointermove', -width + 50, -height + 50, { force: true })
|
609
|
-
.wait(17)
|
593
|
+
.trigger('pointerdown', { eventConstructor: 'PointerEvent', force: true })
|
594
|
+
.trigger('pointermove', -width, -height, { eventConstructor: 'PointerEvent', force: true })
|
595
|
+
.trigger('pointermove', -width - 100, -height - 100, { eventConstructor: 'PointerEvent', force: true })
|
596
|
+
.trigger('pointermove', 300, 300, { eventConstructor: 'PointerEvent', force: true })
|
597
|
+
.trigger('pointermove', -width + 50, -height + 50, { eventConstructor: 'PointerEvent', force: true })
|
598
|
+
// .wait(17)
|
610
599
|
.get('@cp').its('rgb').should('not.deep.equal', rgb);
|
611
600
|
});
|
612
601
|
});
|
@@ -617,11 +606,11 @@ describe('ColorPicker Class Test', () => {
|
|
617
606
|
const { width, height } = visual[0].getBoundingClientRect();
|
618
607
|
|
619
608
|
cy.get('.knob').eq(1)
|
620
|
-
.trigger('pointerdown', { force: true })
|
621
|
-
.trigger('pointermove', width / 2, -height - 100, { force: true })
|
622
|
-
.trigger('pointermove', width / 2, 300, { force: true })
|
623
|
-
.trigger('pointermove', width / 2, -height + 20, { force: true })
|
624
|
-
.wait(17)
|
609
|
+
.trigger('pointerdown', { eventConstructor: 'PointerEvent', force: true })
|
610
|
+
.trigger('pointermove', width / 2, -height - 100, { eventConstructor: 'PointerEvent', force: true })
|
611
|
+
.trigger('pointermove', width / 2, 300, { eventConstructor: 'PointerEvent', force: true })
|
612
|
+
.trigger('pointermove', width / 2, -height + 20, { eventConstructor: 'PointerEvent', force: true })
|
613
|
+
// .wait(17)
|
625
614
|
.get('@cp').its('rgb').should('not.deep.equal', rgb);
|
626
615
|
});
|
627
616
|
});
|
@@ -632,11 +621,11 @@ describe('ColorPicker Class Test', () => {
|
|
632
621
|
const { width, height } = visual[0].getBoundingClientRect();
|
633
622
|
|
634
623
|
cy.get('.knob').eq(2)
|
635
|
-
.trigger('pointerdown', { force: true })
|
636
|
-
.trigger('pointermove', width / 2, -height - 100, { force: true })
|
637
|
-
.trigger('pointermove', width / 2, 300, { force: true })
|
638
|
-
.trigger('pointermove', width / 2, -height + 20, { force: true })
|
639
|
-
.wait(17)
|
624
|
+
.trigger('pointerdown', { eventConstructor: 'PointerEvent', force: true })
|
625
|
+
.trigger('pointermove', width / 2, -height - 100, { eventConstructor: 'PointerEvent', force: true })
|
626
|
+
.trigger('pointermove', width / 2, 300, { eventConstructor: 'PointerEvent', force: true })
|
627
|
+
.trigger('pointermove', width / 2, -height + 20, { eventConstructor: 'PointerEvent', force: true })
|
628
|
+
// .wait(17)
|
640
629
|
.get('@cp').its('rgb').should('not.deep.equal', rgb);
|
641
630
|
});
|
642
631
|
});
|
@@ -653,7 +642,7 @@ describe('ColorPicker Class Test', () => {
|
|
653
642
|
.trigger('keydown', { code: 'ArrowRight' })
|
654
643
|
.trigger('keydown', { code: 'ArrowRight' })
|
655
644
|
.trigger('keydown', { code: 'ArrowLeft' })
|
656
|
-
.wait(17)
|
645
|
+
// .wait(17)
|
657
646
|
.get('@cp').its('rgb').should('not.deep.equal', rgb);
|
658
647
|
});
|
659
648
|
|
@@ -667,7 +656,7 @@ describe('ColorPicker Class Test', () => {
|
|
667
656
|
.trigger('keydown', { code: 'ArrowLeft' })
|
668
657
|
.trigger('keydown', { code: 'ArrowLeft' })
|
669
658
|
.trigger('keydown', { code: 'ArrowRight' })
|
670
|
-
.wait(17)
|
659
|
+
// .wait(17)
|
671
660
|
.get('@cp').its('rgb').should('not.deep.equal', rgb);
|
672
661
|
});
|
673
662
|
|
@@ -681,7 +670,7 @@ describe('ColorPicker Class Test', () => {
|
|
681
670
|
.trigger('keydown', { code: 'ArrowLeft' })
|
682
671
|
.trigger('keydown', { code: 'ArrowLeft' })
|
683
672
|
.trigger('keydown', { code: 'ArrowRight' })
|
684
|
-
.wait(17)
|
673
|
+
// .wait(17)
|
685
674
|
.get('@cp').its('rgb').should('not.deep.equal', rgb);
|
686
675
|
});
|
687
676
|
});
|
File without changes
|
File without changes
|
File without changes
|
@@ -20,9 +20,16 @@ export default function getMarkup(body, id, format) {
|
|
20
20
|
input.setAttribute('autocomplete', "off");
|
21
21
|
input.setAttribute('spellcheck', "false");
|
22
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);
|
23
30
|
cpWrapper.append(input);
|
24
31
|
if (body) {
|
25
|
-
body.append(label, cpWrapper);
|
32
|
+
body.append(label, cpWrapper, a);
|
26
33
|
}
|
27
34
|
return {set, value};
|
28
35
|
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
package/cypress/support/e2e.ts
CHANGED
File without changes
|
package/cypress/test.html
CHANGED
File without changes
|
package/cypress.config.ts
CHANGED
File without changes
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/*!
|
2
|
-
* ColorPicker v2.0.0-
|
2
|
+
* ColorPicker v2.0.0-alpha10 (http://thednp.github.io/color-picker)
|
3
3
|
* Copyright 2023 © thednp
|
4
|
-
* Licensed under MIT (
|
4
|
+
* Licensed under MIT (https://github.com/thednp/color-picker/blob/main/LICENSE)
|
5
5
|
*/
|
6
6
|
/* :host */
|
7
7
|
.color-picker {
|
@@ -40,6 +40,9 @@
|
|
40
40
|
--option-bg-active: var(--white-90);
|
41
41
|
--visual-shadow: 0 0 0 1px var(--white-15) inset;
|
42
42
|
}
|
43
|
+
.color-picker *, .color-picker *::before, .color-picker *::after {
|
44
|
+
box-sizing: border-box;
|
45
|
+
}
|
43
46
|
|
44
47
|
.color-picker:focus {
|
45
48
|
outline: none;
|
@@ -107,7 +110,6 @@
|
|
107
110
|
/* btn-appearance */
|
108
111
|
.btn-appearance {
|
109
112
|
width: 100%;
|
110
|
-
height: 1.5rem;
|
111
113
|
padding: 0.6rem 1rem;
|
112
114
|
font-size: 1rem;
|
113
115
|
line-height: 1.5;
|
@@ -157,10 +159,10 @@
|
|
157
159
|
/* picker-toggle */
|
158
160
|
.picker-toggle {
|
159
161
|
position: absolute;
|
160
|
-
|
161
|
-
left: 0;
|
162
|
+
inset: 0;
|
162
163
|
width: 100%;
|
163
164
|
height: 100%;
|
165
|
+
cursor: pointer;
|
164
166
|
background: transparent;
|
165
167
|
border: 0;
|
166
168
|
}
|
@@ -291,7 +293,7 @@
|
|
291
293
|
transition: var(--options-transition);
|
292
294
|
}
|
293
295
|
|
294
|
-
.color-
|
296
|
+
.color-dropdown.menu:hover .scrollable {
|
295
297
|
height: var(--grid-hover-height);
|
296
298
|
}
|
297
299
|
|
@@ -312,7 +314,7 @@
|
|
312
314
|
width: var(--grid-item-size);
|
313
315
|
height: var(--grid-item-size);
|
314
316
|
overflow: hidden;
|
315
|
-
|
317
|
+
color: rgba(0, 0, 0, 0);
|
316
318
|
}
|
317
319
|
.color-options .color-option:active, .color-options .color-option:focus {
|
318
320
|
outline: none;
|
@@ -397,14 +399,14 @@
|
|
397
399
|
|
398
400
|
/* visual control */
|
399
401
|
.visual-control {
|
400
|
-
height:
|
402
|
+
height: 230px;
|
401
403
|
/* important for mobile devices */
|
402
404
|
touch-action: none;
|
403
405
|
box-shadow: var(--visual-shadow);
|
404
406
|
}
|
405
407
|
|
406
408
|
.visual-control1 {
|
407
|
-
width:
|
409
|
+
width: 230px;
|
408
410
|
}
|
409
411
|
|
410
412
|
.visual-control2,
|
@@ -413,15 +415,7 @@
|
|
413
415
|
cursor: ns-resize;
|
414
416
|
}
|
415
417
|
|
416
|
-
@media (
|
417
|
-
.visual-control {
|
418
|
-
height: 230px;
|
419
|
-
}
|
420
|
-
.visual-control1 {
|
421
|
-
width: 230px;
|
422
|
-
}
|
423
|
-
}
|
424
|
-
@media (min-width: 1200px) {
|
418
|
+
@media (width >= 980px) {
|
425
419
|
.visual-control {
|
426
420
|
height: 300px;
|
427
421
|
}
|
@@ -449,6 +443,7 @@
|
|
449
443
|
position: absolute;
|
450
444
|
top: 0;
|
451
445
|
left: 0;
|
446
|
+
width: 100%;
|
452
447
|
height: 7px;
|
453
448
|
/* important for mobile devices */
|
454
449
|
touch-action: none;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/* ColorPicker v2.0.0-
|
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%;
|
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}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/*!
|
2
|
-
* ColorPicker v2.0.0-
|
2
|
+
* ColorPicker v2.0.0-alpha10 (http://thednp.github.io/color-picker)
|
3
3
|
* Copyright 2023 © thednp
|
4
|
-
* Licensed under MIT (
|
4
|
+
* Licensed under MIT (https://github.com/thednp/color-picker/blob/main/LICENSE)
|
5
5
|
*/
|
6
6
|
/* :host */
|
7
7
|
.color-picker {
|
@@ -40,6 +40,9 @@
|
|
40
40
|
--option-bg-active: var(--white-90);
|
41
41
|
--visual-shadow: 0 0 0 1px var(--white-15) inset;
|
42
42
|
}
|
43
|
+
.color-picker *, .color-picker *::before, .color-picker *::after {
|
44
|
+
box-sizing: border-box;
|
45
|
+
}
|
43
46
|
|
44
47
|
.color-picker:focus {
|
45
48
|
outline: none;
|
@@ -107,7 +110,6 @@
|
|
107
110
|
/* btn-appearance */
|
108
111
|
.btn-appearance {
|
109
112
|
width: 100%;
|
110
|
-
height: 1.5rem;
|
111
113
|
padding: 0.6rem 1rem;
|
112
114
|
font-size: 1rem;
|
113
115
|
line-height: 1.5;
|
@@ -157,10 +159,10 @@
|
|
157
159
|
/* picker-toggle */
|
158
160
|
.picker-toggle {
|
159
161
|
position: absolute;
|
160
|
-
|
161
|
-
left: 0;
|
162
|
+
inset: 0;
|
162
163
|
width: 100%;
|
163
164
|
height: 100%;
|
165
|
+
cursor: pointer;
|
164
166
|
background: transparent;
|
165
167
|
border: 0;
|
166
168
|
}
|
@@ -291,7 +293,7 @@
|
|
291
293
|
transition: var(--options-transition);
|
292
294
|
}
|
293
295
|
|
294
|
-
.color-
|
296
|
+
.color-dropdown.menu:hover .scrollable {
|
295
297
|
height: var(--grid-hover-height);
|
296
298
|
}
|
297
299
|
|
@@ -312,7 +314,7 @@
|
|
312
314
|
width: var(--grid-item-size);
|
313
315
|
height: var(--grid-item-size);
|
314
316
|
overflow: hidden;
|
315
|
-
|
317
|
+
color: rgba(0, 0, 0, 0);
|
316
318
|
}
|
317
319
|
.color-options .color-option:active, .color-options .color-option:focus {
|
318
320
|
outline: none;
|
@@ -397,14 +399,14 @@
|
|
397
399
|
|
398
400
|
/* visual control */
|
399
401
|
.visual-control {
|
400
|
-
height:
|
402
|
+
height: 230px;
|
401
403
|
/* important for mobile devices */
|
402
404
|
touch-action: none;
|
403
405
|
box-shadow: var(--visual-shadow);
|
404
406
|
}
|
405
407
|
|
406
408
|
.visual-control1 {
|
407
|
-
width:
|
409
|
+
width: 230px;
|
408
410
|
}
|
409
411
|
|
410
412
|
.visual-control2,
|
@@ -413,15 +415,7 @@
|
|
413
415
|
cursor: ns-resize;
|
414
416
|
}
|
415
417
|
|
416
|
-
@media (
|
417
|
-
.visual-control {
|
418
|
-
height: 230px;
|
419
|
-
}
|
420
|
-
.visual-control1 {
|
421
|
-
width: 230px;
|
422
|
-
}
|
423
|
-
}
|
424
|
-
@media (min-width: 1200px) {
|
418
|
+
@media (width >= 980px) {
|
425
419
|
.visual-control {
|
426
420
|
height: 300px;
|
427
421
|
}
|
@@ -449,6 +443,7 @@
|
|
449
443
|
position: absolute;
|
450
444
|
top: 0;
|
451
445
|
left: 0;
|
446
|
+
width: 100%;
|
452
447
|
height: 7px;
|
453
448
|
/* important for mobile devices */
|
454
449
|
touch-action: none;
|