@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.
Files changed (56) hide show
  1. package/.eslintrc.cjs +1 -1
  2. package/.lgtm.yml +0 -0
  3. package/.prettierrc.json +0 -0
  4. package/.stylelintrc.json +0 -0
  5. package/LICENSE +0 -0
  6. package/README.md +8 -7
  7. package/compile.js +6 -3
  8. package/cypress/e2e/color-palette.cy.ts +0 -0
  9. package/cypress/e2e/color-picker.cy.ts +58 -69
  10. package/cypress/fixtures/colorNamesFrench.js +0 -0
  11. package/cypress/fixtures/componentLabelsFrench.js +0 -0
  12. package/cypress/fixtures/format.js +0 -0
  13. package/cypress/fixtures/getMarkup.js +8 -1
  14. package/cypress/fixtures/getRandomInt.js +0 -0
  15. package/cypress/fixtures/sampleWebcolors.js +0 -0
  16. package/cypress/fixtures/testSample.js +0 -0
  17. package/cypress/plugins/esbuild-istanbul.ts +0 -0
  18. package/cypress/plugins/tsCompile.ts +0 -0
  19. package/cypress/support/commands.ts +0 -0
  20. package/cypress/support/e2e.ts +0 -0
  21. package/cypress/test.html +0 -0
  22. package/cypress.config.ts +0 -0
  23. package/dist/css/color-picker.css +13 -18
  24. package/dist/css/color-picker.min.css +2 -2
  25. package/dist/css/color-picker.rtl.css +13 -18
  26. package/dist/css/color-picker.rtl.min.css +2 -2
  27. package/dist/js/color-picker.cjs +3 -3
  28. package/dist/js/color-picker.cjs.map +1 -1
  29. package/dist/js/color-picker.d.ts +42 -24
  30. package/dist/js/color-picker.js +3 -3
  31. package/dist/js/color-picker.js.map +1 -1
  32. package/dist/js/color-picker.mjs +408 -421
  33. package/dist/js/color-picker.mjs.map +1 -1
  34. package/dts.config.ts +0 -0
  35. package/package.json +116 -98
  36. package/src/scss/_variables.scss +0 -0
  37. package/src/scss/color-picker.rtl.scss +0 -0
  38. package/src/scss/color-picker.scss +20 -14
  39. package/src/ts/colorPalette.ts +0 -0
  40. package/src/ts/index.ts +40 -54
  41. package/src/ts/interface/ColorNames.ts +20 -0
  42. package/src/ts/interface/colorPickerLabels.ts +0 -0
  43. package/src/ts/interface/colorPickerOptions.ts +0 -0
  44. package/src/ts/interface/paletteOptions.ts +0 -0
  45. package/src/ts/util/colorNames.ts +0 -0
  46. package/src/ts/util/colorPickerLabels.ts +0 -0
  47. package/src/ts/util/getColorControls.ts +0 -0
  48. package/src/ts/util/getColorForm.ts +0 -0
  49. package/src/ts/util/getColorMenu.ts +0 -0
  50. package/src/ts/util/isValidJSON.ts +0 -0
  51. package/src/ts/util/setMarkup.ts +6 -4
  52. package/src/ts/util/vHidden.ts +0 -0
  53. package/tsconfig.json +1 -1
  54. package/vite.config.ts +0 -0
  55. package/cypress/downloads/downloads.htm +0 -0
  56. 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
@@ -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 HTMLElement;
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 HTMLElement;
95
+ }) as HTMLButtonElement;
94
96
 
95
97
  const xmlns = encodeURI('http://www.w3.org/2000/svg');
96
98
  const presetsIcon = createElementNS(xmlns, {
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", "cypress", "@thednp/shorty", "@thednp/event-listener", "@thednp/color"],
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
- }