@thednp/color-picker 2.0.0-alpha1 → 2.0.0-alpha10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.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
@@ -0,0 +1,20 @@
|
|
1
|
+
export default interface ColorNames {
|
2
|
+
white: string;
|
3
|
+
black: string;
|
4
|
+
grey: string;
|
5
|
+
red: string;
|
6
|
+
orange: string;
|
7
|
+
brown: string;
|
8
|
+
gold: string;
|
9
|
+
olive: string;
|
10
|
+
yellow: string;
|
11
|
+
lime: string;
|
12
|
+
green: string;
|
13
|
+
teal: string;
|
14
|
+
cyan: string;
|
15
|
+
blue: string;
|
16
|
+
violet: string;
|
17
|
+
magenta: string;
|
18
|
+
pink: string;
|
19
|
+
[key: string]: string;
|
20
|
+
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
package/src/ts/util/setMarkup.ts
CHANGED
@@ -36,13 +36,14 @@ const setMarkup = (self: ColorPicker) => {
|
|
36
36
|
// set initial controls dimensions
|
37
37
|
const formatString = format === 'hex' ? hexLabel : toUpperCase(format);
|
38
38
|
|
39
|
-
const pickerBtn = createElement({
|
39
|
+
const pickerBtn = createElement<HTMLButtonElement>({
|
40
40
|
id: `picker-btn-${id}`,
|
41
41
|
tagName: 'button',
|
42
|
+
type: 'button',
|
42
43
|
className: 'picker-toggle btn-appearance',
|
43
44
|
ariaExpanded: 'false',
|
44
45
|
ariaHasPopup: 'true',
|
45
|
-
}) as
|
46
|
+
}) as HTMLButtonElement;
|
46
47
|
|
47
48
|
pickerBtn.append(
|
48
49
|
createElement({
|
@@ -84,13 +85,14 @@ const setMarkup = (self: ColorPicker) => {
|
|
84
85
|
presetsDropdown.append(getColorMenu(self, colorKeywords, 'color-defaults'));
|
85
86
|
}
|
86
87
|
|
87
|
-
const presetsBtn = createElement({
|
88
|
+
const presetsBtn = createElement<HTMLButtonElement>({
|
88
89
|
tagName: 'button',
|
90
|
+
type: 'button',
|
89
91
|
className: 'menu-toggle btn-appearance',
|
90
92
|
tabIndex: -1,
|
91
93
|
ariaExpanded: 'false',
|
92
94
|
ariaHasPopup: 'true',
|
93
|
-
}) as
|
95
|
+
}) as HTMLButtonElement;
|
94
96
|
|
95
97
|
const xmlns = encodeURI('http://www.w3.org/2000/svg');
|
96
98
|
const presetsIcon = createElementNS(xmlns, {
|
package/src/ts/util/vHidden.ts
CHANGED
File without changes
|
package/tsconfig.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
// https://janessagarrow.com/blog/typescript-and-esbuild/
|
3
3
|
"compilerOptions": {
|
4
4
|
"lib": ["DOM", "ESNext", "DOM.Iterable"],
|
5
|
-
"types": ["vite", "vite/client", "
|
5
|
+
"types": ["vite", "vite/client", "@thednp/shorty", "@thednp/color"],
|
6
6
|
"rootDir": "./",
|
7
7
|
"baseUrl": "./",
|
8
8
|
"module": "ESNext",
|
package/vite.config.ts
CHANGED
File without changes
|
Binary file
|
@@ -1,29 +0,0 @@
|
|
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
|
-
}
|