@thednp/color-picker 2.0.1 → 2.0.3
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/README.md +25 -14
 - package/dist/css/color-picker.css +3 -6
 - package/dist/css/color-picker.css.map +1 -0
 - package/dist/css/color-picker.min.css +1 -2
 - package/dist/css/color-picker.min.css.map +1 -0
 - package/dist/css/color-picker.rtl.css +3 -6
 - package/dist/css/color-picker.rtl.css.map +1 -0
 - package/dist/css/color-picker.rtl.min.css +1 -2
 - package/dist/css/color-picker.rtl.min.css.map +1 -0
 - package/dist/js/color-picker.cjs +2 -2
 - package/dist/js/color-picker.cjs.map +1 -1
 - package/dist/js/color-picker.d.ts +307 -300
 - package/dist/js/color-picker.js +2 -2
 - package/dist/js/color-picker.js.map +1 -1
 - package/dist/js/color-picker.mjs +423 -382
 - package/dist/js/color-picker.mjs.map +1 -1
 - package/package.json +39 -50
 - package/.eslintrc.cjs +0 -199
 - package/.lgtm.yml +0 -9
 - package/.prettierrc.json +0 -15
 - package/.stylelintrc.json +0 -236
 - package/compile.cjs +0 -51
 - package/cypress/e2e/color-palette.cy.ts +0 -128
 - package/cypress/e2e/color-picker.cy.ts +0 -909
 - package/cypress/fixtures/colorNamesFrench.js +0 -3
 - package/cypress/fixtures/componentLabelsFrench.js +0 -21
 - package/cypress/fixtures/format.js +0 -3
 - package/cypress/fixtures/getMarkup.js +0 -35
 - package/cypress/fixtures/getRandomInt.js +0 -6
 - package/cypress/fixtures/sampleWebcolors.js +0 -18
 - package/cypress/fixtures/testSample.js +0 -8
 - package/cypress/plugins/esbuild-istanbul.ts +0 -50
 - package/cypress/plugins/tsCompile.ts +0 -34
 - package/cypress/support/commands.ts +0 -0
 - package/cypress/support/e2e.ts +0 -21
 - package/cypress/test.html +0 -23
 - package/cypress.config.ts +0 -30
 - package/dts.config.ts +0 -15
 - package/src/scss/_variables.scss +0 -6
 - package/src/scss/color-picker.rtl.scss +0 -27
 - package/src/scss/color-picker.scss +0 -536
 - package/src/ts/colorPalette.ts +0 -89
 - package/src/ts/index.ts +0 -1236
 - package/src/ts/interface/ColorNames.ts +0 -20
 - package/src/ts/interface/colorPickerLabels.ts +0 -20
 - package/src/ts/interface/colorPickerOptions.ts +0 -11
 - package/src/ts/interface/paletteOptions.ts +0 -6
 - package/src/ts/util/colorNames.ts +0 -21
 - package/src/ts/util/colorPickerLabels.ts +0 -24
 - package/src/ts/util/getColorControls.ts +0 -90
 - package/src/ts/util/getColorForm.ts +0 -75
 - package/src/ts/util/getColorMenu.ts +0 -83
 - package/src/ts/util/isValidJSON.ts +0 -19
 - package/src/ts/util/setMarkup.ts +0 -130
 - package/src/ts/util/vHidden.ts +0 -2
 - package/tsconfig.json +0 -29
 - package/vite.config.mts +0 -35
 
| 
         @@ -1,20 +0,0 @@ 
     | 
|
| 
       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 
     | 
    
         
            -
            }
         
     | 
| 
         @@ -1,20 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            export default interface ColorPickerLabels {
         
     | 
| 
       2 
     | 
    
         
            -
              pickerLabel: string;
         
     | 
| 
       3 
     | 
    
         
            -
              appearanceLabel: string;
         
     | 
| 
       4 
     | 
    
         
            -
              valueLabel: string;
         
     | 
| 
       5 
     | 
    
         
            -
              toggleLabel: string;
         
     | 
| 
       6 
     | 
    
         
            -
              presetsLabel: string;
         
     | 
| 
       7 
     | 
    
         
            -
              defaultsLabel: string;
         
     | 
| 
       8 
     | 
    
         
            -
              formatLabel: string;
         
     | 
| 
       9 
     | 
    
         
            -
              alphaLabel: string;
         
     | 
| 
       10 
     | 
    
         
            -
              hexLabel: string;
         
     | 
| 
       11 
     | 
    
         
            -
              hueLabel: string;
         
     | 
| 
       12 
     | 
    
         
            -
              whitenessLabel: string;
         
     | 
| 
       13 
     | 
    
         
            -
              blacknessLabel: string;
         
     | 
| 
       14 
     | 
    
         
            -
              saturationLabel: string;
         
     | 
| 
       15 
     | 
    
         
            -
              lightnessLabel: string;
         
     | 
| 
       16 
     | 
    
         
            -
              redLabel: string;
         
     | 
| 
       17 
     | 
    
         
            -
              greenLabel: string;
         
     | 
| 
       18 
     | 
    
         
            -
              blueLabel: string;
         
     | 
| 
       19 
     | 
    
         
            -
              [key: string]: string;
         
     | 
| 
       20 
     | 
    
         
            -
            }
         
     | 
| 
         @@ -1,11 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import type { ColorFormats } from '@thednp/color';
         
     | 
| 
       2 
     | 
    
         
            -
            import ColorPickerLabels from './colorPickerLabels';
         
     | 
| 
       3 
     | 
    
         
            -
            import ColorPalette from '../colorPalette';
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            export default interface ColorPickerOptions {
         
     | 
| 
       6 
     | 
    
         
            -
              colorLabels: string | string[];
         
     | 
| 
       7 
     | 
    
         
            -
              componentLabels: ColorPickerLabels;
         
     | 
| 
       8 
     | 
    
         
            -
              format: ColorFormats;
         
     | 
| 
       9 
     | 
    
         
            -
              colorPresets: string | string[] | ColorPalette | false;
         
     | 
| 
       10 
     | 
    
         
            -
              colorKeywords: string | string[] | false;
         
     | 
| 
       11 
     | 
    
         
            -
            }
         
     | 
| 
         @@ -1,21 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            /** A list of 17 color names used for WAI-ARIA compliance. */
         
     | 
| 
       2 
     | 
    
         
            -
            const colorNames: string[] = [
         
     | 
| 
       3 
     | 
    
         
            -
              'white',
         
     | 
| 
       4 
     | 
    
         
            -
              'black',
         
     | 
| 
       5 
     | 
    
         
            -
              'grey',
         
     | 
| 
       6 
     | 
    
         
            -
              'red',
         
     | 
| 
       7 
     | 
    
         
            -
              'orange',
         
     | 
| 
       8 
     | 
    
         
            -
              'brown',
         
     | 
| 
       9 
     | 
    
         
            -
              'gold',
         
     | 
| 
       10 
     | 
    
         
            -
              'olive',
         
     | 
| 
       11 
     | 
    
         
            -
              'yellow',
         
     | 
| 
       12 
     | 
    
         
            -
              'lime',
         
     | 
| 
       13 
     | 
    
         
            -
              'green',
         
     | 
| 
       14 
     | 
    
         
            -
              'teal',
         
     | 
| 
       15 
     | 
    
         
            -
              'cyan',
         
     | 
| 
       16 
     | 
    
         
            -
              'blue',
         
     | 
| 
       17 
     | 
    
         
            -
              'violet',
         
     | 
| 
       18 
     | 
    
         
            -
              'magenta',
         
     | 
| 
       19 
     | 
    
         
            -
              'pink',
         
     | 
| 
       20 
     | 
    
         
            -
            ];
         
     | 
| 
       21 
     | 
    
         
            -
            export default colorNames;
         
     | 
| 
         @@ -1,24 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import ColorPickerLabels from '../interface/colorPickerLabels';
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            /** The labels presented to the user. */
         
     | 
| 
       4 
     | 
    
         
            -
            const colorPickerLabels: ColorPickerLabels = {
         
     | 
| 
       5 
     | 
    
         
            -
              pickerLabel: 'Colour Picker',
         
     | 
| 
       6 
     | 
    
         
            -
              appearanceLabel: 'Colour Appearance',
         
     | 
| 
       7 
     | 
    
         
            -
              valueLabel: 'Colour Value',
         
     | 
| 
       8 
     | 
    
         
            -
              toggleLabel: 'Select Colour',
         
     | 
| 
       9 
     | 
    
         
            -
              presetsLabel: 'Colour Presets',
         
     | 
| 
       10 
     | 
    
         
            -
              defaultsLabel: 'Colour Defaults',
         
     | 
| 
       11 
     | 
    
         
            -
              formatLabel: 'Format',
         
     | 
| 
       12 
     | 
    
         
            -
              alphaLabel: 'Alpha',
         
     | 
| 
       13 
     | 
    
         
            -
              hexLabel: 'Hexadecimal',
         
     | 
| 
       14 
     | 
    
         
            -
              hueLabel: 'Hue',
         
     | 
| 
       15 
     | 
    
         
            -
              whitenessLabel: 'Whiteness',
         
     | 
| 
       16 
     | 
    
         
            -
              blacknessLabel: 'Blackness',
         
     | 
| 
       17 
     | 
    
         
            -
              saturationLabel: 'Saturation',
         
     | 
| 
       18 
     | 
    
         
            -
              lightnessLabel: 'Lightness',
         
     | 
| 
       19 
     | 
    
         
            -
              redLabel: 'Red',
         
     | 
| 
       20 
     | 
    
         
            -
              greenLabel: 'Green',
         
     | 
| 
       21 
     | 
    
         
            -
              blueLabel: 'Blue',
         
     | 
| 
       22 
     | 
    
         
            -
            };
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
            export default colorPickerLabels;
         
     | 
| 
         @@ -1,90 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { createElement } from '@thednp/shorty';
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            import ColorPicker from '..';
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            /**
         
     | 
| 
       6 
     | 
    
         
            -
             * Returns all color controls for `ColorPicker`.
         
     | 
| 
       7 
     | 
    
         
            -
             *
         
     | 
| 
       8 
     | 
    
         
            -
             * @param self the `ColorPicker` instance
         
     | 
| 
       9 
     | 
    
         
            -
             * @returns color controls
         
     | 
| 
       10 
     | 
    
         
            -
             */
         
     | 
| 
       11 
     | 
    
         
            -
            const getColorControls = (self: ColorPicker): HTMLElement => {
         
     | 
| 
       12 
     | 
    
         
            -
              const { format, componentLabels } = self;
         
     | 
| 
       13 
     | 
    
         
            -
              const { hueLabel, alphaLabel, lightnessLabel, saturationLabel, whitenessLabel, blacknessLabel } = componentLabels;
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
              const max1 = format === 'hsl' ? 360 : 100;
         
     | 
| 
       16 
     | 
    
         
            -
              const max2 = format === 'hsl' ? 100 : 360;
         
     | 
| 
       17 
     | 
    
         
            -
              const max3 = 100;
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
              let ctrl1Label = format === 'hsl' ? `${hueLabel} & ${lightnessLabel}` : `${lightnessLabel} & ${saturationLabel}`;
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
              ctrl1Label = format === 'hwb' ? `${whitenessLabel} & ${blacknessLabel}` : ctrl1Label;
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
              const ctrl2Label = format === 'hsl' ? `${saturationLabel}` : `${hueLabel}`;
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
              const colorControls = createElement({
         
     | 
| 
       26 
     | 
    
         
            -
                tagName: 'div',
         
     | 
| 
       27 
     | 
    
         
            -
                className: `color-controls ${format}`,
         
     | 
| 
       28 
     | 
    
         
            -
              }) as HTMLElement;
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
              const colorPointer = 'color-pointer';
         
     | 
| 
       31 
     | 
    
         
            -
              const colorSlider = 'color-slider';
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
              const controls = [
         
     | 
| 
       34 
     | 
    
         
            -
                {
         
     | 
| 
       35 
     | 
    
         
            -
                  i: 1,
         
     | 
| 
       36 
     | 
    
         
            -
                  c: colorPointer,
         
     | 
| 
       37 
     | 
    
         
            -
                  l: ctrl1Label,
         
     | 
| 
       38 
     | 
    
         
            -
                  min: 0,
         
     | 
| 
       39 
     | 
    
         
            -
                  max: max1,
         
     | 
| 
       40 
     | 
    
         
            -
                },
         
     | 
| 
       41 
     | 
    
         
            -
                {
         
     | 
| 
       42 
     | 
    
         
            -
                  i: 2,
         
     | 
| 
       43 
     | 
    
         
            -
                  c: colorSlider,
         
     | 
| 
       44 
     | 
    
         
            -
                  l: ctrl2Label,
         
     | 
| 
       45 
     | 
    
         
            -
                  min: 0,
         
     | 
| 
       46 
     | 
    
         
            -
                  max: max2,
         
     | 
| 
       47 
     | 
    
         
            -
                },
         
     | 
| 
       48 
     | 
    
         
            -
                {
         
     | 
| 
       49 
     | 
    
         
            -
                  i: 3,
         
     | 
| 
       50 
     | 
    
         
            -
                  c: colorSlider,
         
     | 
| 
       51 
     | 
    
         
            -
                  l: alphaLabel,
         
     | 
| 
       52 
     | 
    
         
            -
                  min: 0,
         
     | 
| 
       53 
     | 
    
         
            -
                  max: max3,
         
     | 
| 
       54 
     | 
    
         
            -
                },
         
     | 
| 
       55 
     | 
    
         
            -
              ];
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
              controls.forEach(template => {
         
     | 
| 
       58 
     | 
    
         
            -
                const { i, c, l, min, max } = template;
         
     | 
| 
       59 
     | 
    
         
            -
                const control = createElement({
         
     | 
| 
       60 
     | 
    
         
            -
                  tagName: 'div',
         
     | 
| 
       61 
     | 
    
         
            -
                  className: 'color-control',
         
     | 
| 
       62 
     | 
    
         
            -
                  role: 'presentation',
         
     | 
| 
       63 
     | 
    
         
            -
                }) as HTMLElement;
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
                control.append(
         
     | 
| 
       66 
     | 
    
         
            -
                  createElement({
         
     | 
| 
       67 
     | 
    
         
            -
                    tagName: 'div',
         
     | 
| 
       68 
     | 
    
         
            -
                    className: `visual-control visual-control${i}`,
         
     | 
| 
       69 
     | 
    
         
            -
                  }) as HTMLElement,
         
     | 
| 
       70 
     | 
    
         
            -
                );
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
                const knob = createElement({
         
     | 
| 
       73 
     | 
    
         
            -
                  tagName: 'div',
         
     | 
| 
       74 
     | 
    
         
            -
                  className: `${c} knob`,
         
     | 
| 
       75 
     | 
    
         
            -
                  ariaLive: 'polite',
         
     | 
| 
       76 
     | 
    
         
            -
                  ariaLabel: l,
         
     | 
| 
       77 
     | 
    
         
            -
                  role: 'slider',
         
     | 
| 
       78 
     | 
    
         
            -
                  tabIndex: 0,
         
     | 
| 
       79 
     | 
    
         
            -
                  ariaValueMin: `${min}`,
         
     | 
| 
       80 
     | 
    
         
            -
                  ariaValueMax: `${max}`,
         
     | 
| 
       81 
     | 
    
         
            -
                }) as HTMLElement;
         
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
                control.append(knob);
         
     | 
| 
       84 
     | 
    
         
            -
                colorControls.append(control);
         
     | 
| 
       85 
     | 
    
         
            -
              });
         
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
       87 
     | 
    
         
            -
              return colorControls;
         
     | 
| 
       88 
     | 
    
         
            -
            };
         
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
            export default getColorControls;
         
     | 
| 
         @@ -1,75 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { createElement, setAttribute, ObjectAssign, toUpperCase } from '@thednp/shorty';
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            import vHidden from './vHidden';
         
     | 
| 
       4 
     | 
    
         
            -
            import ColorPicker from '../index';
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
            /**
         
     | 
| 
       7 
     | 
    
         
            -
             * Returns the color form for `ColorPicker`.
         
     | 
| 
       8 
     | 
    
         
            -
             *
         
     | 
| 
       9 
     | 
    
         
            -
             * @param self the `ColorPicker` instance
         
     | 
| 
       10 
     | 
    
         
            -
             * @returns a new `<div>` element with color component `<input>`
         
     | 
| 
       11 
     | 
    
         
            -
             */
         
     | 
| 
       12 
     | 
    
         
            -
            const getColorForm = (self: ColorPicker): HTMLElement => {
         
     | 
| 
       13 
     | 
    
         
            -
              const { format, id, componentLabels } = self;
         
     | 
| 
       14 
     | 
    
         
            -
              const colorForm = createElement({
         
     | 
| 
       15 
     | 
    
         
            -
                tagName: 'div',
         
     | 
| 
       16 
     | 
    
         
            -
                className: `color-form ${format}`,
         
     | 
| 
       17 
     | 
    
         
            -
              }) as HTMLElement;
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
              let components = ['hex'];
         
     | 
| 
       20 
     | 
    
         
            -
              if (format === 'rgb') components = ['red', 'green', 'blue', 'alpha'];
         
     | 
| 
       21 
     | 
    
         
            -
              else if (format === 'hsl') components = ['hue', 'saturation', 'lightness', 'alpha'];
         
     | 
| 
       22 
     | 
    
         
            -
              else if (format === 'hwb') components = ['hue', 'whiteness', 'blackness', 'alpha'];
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
              components.forEach((c: string): void => {
         
     | 
| 
       25 
     | 
    
         
            -
                const [C] = format === 'hex' ? ['#'] : toUpperCase(c).split('');
         
     | 
| 
       26 
     | 
    
         
            -
                const cID = `color_${format}_${c}_${id}`;
         
     | 
| 
       27 
     | 
    
         
            -
                const formatLabel = componentLabels[`${c}Label`];
         
     | 
| 
       28 
     | 
    
         
            -
                const cInputLabel = createElement({ tagName: 'label' }) as HTMLElement;
         
     | 
| 
       29 
     | 
    
         
            -
                setAttribute(cInputLabel, 'for', cID);
         
     | 
| 
       30 
     | 
    
         
            -
                cInputLabel.append(
         
     | 
| 
       31 
     | 
    
         
            -
                  createElement({
         
     | 
| 
       32 
     | 
    
         
            -
                    tagName: 'span',
         
     | 
| 
       33 
     | 
    
         
            -
                    ariaHidden: 'true',
         
     | 
| 
       34 
     | 
    
         
            -
                    innerText: `${C}:`,
         
     | 
| 
       35 
     | 
    
         
            -
                  }) as HTMLElement,
         
     | 
| 
       36 
     | 
    
         
            -
                  createElement({
         
     | 
| 
       37 
     | 
    
         
            -
                    tagName: 'span',
         
     | 
| 
       38 
     | 
    
         
            -
                    className: vHidden,
         
     | 
| 
       39 
     | 
    
         
            -
                    innerText: formatLabel,
         
     | 
| 
       40 
     | 
    
         
            -
                  }) as HTMLElement,
         
     | 
| 
       41 
     | 
    
         
            -
                );
         
     | 
| 
       42 
     | 
    
         
            -
                const cInput = createElement({
         
     | 
| 
       43 
     | 
    
         
            -
                  tagName: 'input',
         
     | 
| 
       44 
     | 
    
         
            -
                  id: cID,
         
     | 
| 
       45 
     | 
    
         
            -
                  // name: cID, - prevent saving the value to a form
         
     | 
| 
       46 
     | 
    
         
            -
                  type: format === 'hex' ? 'text' : 'number',
         
     | 
| 
       47 
     | 
    
         
            -
                  value: c === 'alpha' ? '100' : '0',
         
     | 
| 
       48 
     | 
    
         
            -
                  className: `color-input ${c}`,
         
     | 
| 
       49 
     | 
    
         
            -
                  autocomplete: 'off',
         
     | 
| 
       50 
     | 
    
         
            -
                  spellcheck: false,
         
     | 
| 
       51 
     | 
    
         
            -
                } as Partial<HTMLInputElement>) as HTMLInputElement;
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
                // alpha
         
     | 
| 
       54 
     | 
    
         
            -
                let max = '100';
         
     | 
| 
       55 
     | 
    
         
            -
                let step = '1';
         
     | 
| 
       56 
     | 
    
         
            -
                if (c !== 'alpha') {
         
     | 
| 
       57 
     | 
    
         
            -
                  if (format === 'rgb') {
         
     | 
| 
       58 
     | 
    
         
            -
                    max = '255';
         
     | 
| 
       59 
     | 
    
         
            -
                    step = '1';
         
     | 
| 
       60 
     | 
    
         
            -
                  } else if (c === 'hue') {
         
     | 
| 
       61 
     | 
    
         
            -
                    max = '360';
         
     | 
| 
       62 
     | 
    
         
            -
                    step = '1';
         
     | 
| 
       63 
     | 
    
         
            -
                  }
         
     | 
| 
       64 
     | 
    
         
            -
                }
         
     | 
| 
       65 
     | 
    
         
            -
                ObjectAssign(cInput, {
         
     | 
| 
       66 
     | 
    
         
            -
                  min: '0',
         
     | 
| 
       67 
     | 
    
         
            -
                  max,
         
     | 
| 
       68 
     | 
    
         
            -
                  step,
         
     | 
| 
       69 
     | 
    
         
            -
                });
         
     | 
| 
       70 
     | 
    
         
            -
                colorForm.append(cInputLabel, cInput);
         
     | 
| 
       71 
     | 
    
         
            -
              });
         
     | 
| 
       72 
     | 
    
         
            -
              return colorForm;
         
     | 
| 
       73 
     | 
    
         
            -
            };
         
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
            export default getColorForm;
         
     | 
| 
         @@ -1,83 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { setAttribute, getAttribute, createElement, setElementStyle } from '@thednp/shorty';
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            import Color from '@thednp/color';
         
     | 
| 
       4 
     | 
    
         
            -
            import ColorPalette from '../colorPalette';
         
     | 
| 
       5 
     | 
    
         
            -
            import ColorPicker from '../index';
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
            /**
         
     | 
| 
       8 
     | 
    
         
            -
             * Returns a color-defaults with given values and class.
         
     | 
| 
       9 
     | 
    
         
            -
             */
         
     | 
| 
       10 
     | 
    
         
            -
            const getColorMenu = (self: ColorPicker, colorsSource: ColorPalette | string[], menuClass: string): HTMLElement => {
         
     | 
| 
       11 
     | 
    
         
            -
              const { input, format, componentLabels } = self;
         
     | 
| 
       12 
     | 
    
         
            -
              const { defaultsLabel, presetsLabel } = componentLabels;
         
     | 
| 
       13 
     | 
    
         
            -
              const isOptionsMenu = menuClass === 'color-options';
         
     | 
| 
       14 
     | 
    
         
            -
              const isPalette = colorsSource instanceof ColorPalette;
         
     | 
| 
       15 
     | 
    
         
            -
              const menuLabel = isOptionsMenu ? presetsLabel : defaultsLabel;
         
     | 
| 
       16 
     | 
    
         
            -
              const colorsArray = isPalette ? colorsSource.colors : colorsSource;
         
     | 
| 
       17 
     | 
    
         
            -
              const colorsCount = colorsArray.length;
         
     | 
| 
       18 
     | 
    
         
            -
              const { lightSteps } = isPalette ? colorsSource : { lightSteps: null };
         
     | 
| 
       19 
     | 
    
         
            -
              const fit = lightSteps || [9, 10].find(x => colorsCount >= x * 2 && !(colorsCount % x)) || 5;
         
     | 
| 
       20 
     | 
    
         
            -
              const isMultiLine = isOptionsMenu && colorsCount > fit;
         
     | 
| 
       21 
     | 
    
         
            -
              let rowCountHover = 2;
         
     | 
| 
       22 
     | 
    
         
            -
              rowCountHover = isMultiLine && colorsCount > fit * 2 ? 3 : rowCountHover;
         
     | 
| 
       23 
     | 
    
         
            -
              rowCountHover = isMultiLine && colorsCount > fit * 3 ? 4 : rowCountHover;
         
     | 
| 
       24 
     | 
    
         
            -
              rowCountHover = isMultiLine && colorsCount > fit * 4 ? 5 : rowCountHover;
         
     | 
| 
       25 
     | 
    
         
            -
              const rowCount = rowCountHover - (colorsCount <= fit * 3 ? 1 : 2);
         
     | 
| 
       26 
     | 
    
         
            -
              const isScrollable = isMultiLine && colorsCount > rowCount * fit;
         
     | 
| 
       27 
     | 
    
         
            -
              let finalClass = menuClass;
         
     | 
| 
       28 
     | 
    
         
            -
              finalClass += isScrollable ? ' scrollable' : '';
         
     | 
| 
       29 
     | 
    
         
            -
              finalClass += isMultiLine ? ' multiline' : '';
         
     | 
| 
       30 
     | 
    
         
            -
              const gap = isMultiLine ? '1px' : '0.25rem';
         
     | 
| 
       31 
     | 
    
         
            -
              let optionSize = isMultiLine ? 1.75 : 2;
         
     | 
| 
       32 
     | 
    
         
            -
              optionSize = fit > 5 && isMultiLine ? 1.5 : optionSize;
         
     | 
| 
       33 
     | 
    
         
            -
              const menuHeight = `${rowCount * optionSize}rem`;
         
     | 
| 
       34 
     | 
    
         
            -
              const menuHeightHover = `calc(${rowCountHover} * ${optionSize}rem + ${rowCountHover - 1} * ${gap})`;
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
              // <UL> is an `HTMLElement`
         
     | 
| 
       37 
     | 
    
         
            -
              const menu = createElement({
         
     | 
| 
       38 
     | 
    
         
            -
                tagName: 'ul',
         
     | 
| 
       39 
     | 
    
         
            -
                className: finalClass,
         
     | 
| 
       40 
     | 
    
         
            -
                role: 'listbox',
         
     | 
| 
       41 
     | 
    
         
            -
                ariaLabel: menuLabel,
         
     | 
| 
       42 
     | 
    
         
            -
              }) as HTMLElement;
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
              if (isScrollable) {
         
     | 
| 
       45 
     | 
    
         
            -
                setElementStyle(menu, {
         
     | 
| 
       46 
     | 
    
         
            -
                  '--grid-item-size': `${optionSize}rem`,
         
     | 
| 
       47 
     | 
    
         
            -
                  '--grid-fit': `${fit}`,
         
     | 
| 
       48 
     | 
    
         
            -
                  '--grid-gap': gap,
         
     | 
| 
       49 
     | 
    
         
            -
                  '--grid-height': menuHeight,
         
     | 
| 
       50 
     | 
    
         
            -
                  '--grid-hover-height': menuHeightHover,
         
     | 
| 
       51 
     | 
    
         
            -
                });
         
     | 
| 
       52 
     | 
    
         
            -
              }
         
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
              colorsArray.forEach(x => {
         
     | 
| 
       55 
     | 
    
         
            -
                let [value, label] = typeof x === 'string' ? x.trim().split(':') : [];
         
     | 
| 
       56 
     | 
    
         
            -
                if (x instanceof Color) {
         
     | 
| 
       57 
     | 
    
         
            -
                  value = x.toHexString();
         
     | 
| 
       58 
     | 
    
         
            -
                  label = value;
         
     | 
| 
       59 
     | 
    
         
            -
                }
         
     | 
| 
       60 
     | 
    
         
            -
                const color = new Color(x instanceof Color ? x : value, format);
         
     | 
| 
       61 
     | 
    
         
            -
                const isActive = color.toString() === getAttribute(input, 'value');
         
     | 
| 
       62 
     | 
    
         
            -
                const active = isActive ? ' active' : '';
         
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
                const option = createElement({
         
     | 
| 
       65 
     | 
    
         
            -
                  tagName: 'li',
         
     | 
| 
       66 
     | 
    
         
            -
                  className: `color-option${active}`,
         
     | 
| 
       67 
     | 
    
         
            -
                  innerText: `${label || value}`,
         
     | 
| 
       68 
     | 
    
         
            -
                  tabIndex: 0,
         
     | 
| 
       69 
     | 
    
         
            -
                  role: 'option',
         
     | 
| 
       70 
     | 
    
         
            -
                  ariaSelected: isActive ? 'true' : 'false',
         
     | 
| 
       71 
     | 
    
         
            -
                }) as HTMLElement;
         
     | 
| 
       72 
     | 
    
         
            -
                setAttribute(option, 'data-value', `${value}`);
         
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
                if (isOptionsMenu) {
         
     | 
| 
       75 
     | 
    
         
            -
                  setElementStyle(option, { backgroundColor: value });
         
     | 
| 
       76 
     | 
    
         
            -
                }
         
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
                menu.append(option);
         
     | 
| 
       79 
     | 
    
         
            -
              });
         
     | 
| 
       80 
     | 
    
         
            -
              return menu;
         
     | 
| 
       81 
     | 
    
         
            -
            };
         
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
            export default getColorMenu;
         
     | 
| 
         @@ -1,19 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { isString } from '@thednp/shorty';
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            /**
         
     | 
| 
       4 
     | 
    
         
            -
             * Check if a string is valid JSON string.
         
     | 
| 
       5 
     | 
    
         
            -
             *
         
     | 
| 
       6 
     | 
    
         
            -
             * @param str the string input
         
     | 
| 
       7 
     | 
    
         
            -
             * @returns the query result
         
     | 
| 
       8 
     | 
    
         
            -
             */
         
     | 
| 
       9 
     | 
    
         
            -
            const isValidJSON = (str: unknown): str is string => {
         
     | 
| 
       10 
     | 
    
         
            -
              if (!isString(str)) return false;
         
     | 
| 
       11 
     | 
    
         
            -
              try {
         
     | 
| 
       12 
     | 
    
         
            -
                JSON.parse(str);
         
     | 
| 
       13 
     | 
    
         
            -
              } catch (e) {
         
     | 
| 
       14 
     | 
    
         
            -
                return false;
         
     | 
| 
       15 
     | 
    
         
            -
              }
         
     | 
| 
       16 
     | 
    
         
            -
              return true;
         
     | 
| 
       17 
     | 
    
         
            -
            };
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
            export default isValidJSON;
         
     | 
    
        package/src/ts/util/setMarkup.ts
    DELETED
    
    | 
         @@ -1,130 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import {
         
     | 
| 
       2 
     | 
    
         
            -
              getAttribute,
         
     | 
| 
       3 
     | 
    
         
            -
              setAttribute,
         
     | 
| 
       4 
     | 
    
         
            -
              toUpperCase,
         
     | 
| 
       5 
     | 
    
         
            -
              ariaHidden,
         
     | 
| 
       6 
     | 
    
         
            -
              tabindex,
         
     | 
| 
       7 
     | 
    
         
            -
              createElement,
         
     | 
| 
       8 
     | 
    
         
            -
              createElementNS,
         
     | 
| 
       9 
     | 
    
         
            -
            } from '@thednp/shorty';
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
            import Color from '@thednp/color';
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
            import getColorForm from './getColorForm';
         
     | 
| 
       14 
     | 
    
         
            -
            import getColorControls from './getColorControls';
         
     | 
| 
       15 
     | 
    
         
            -
            import getColorMenu from './getColorMenu';
         
     | 
| 
       16 
     | 
    
         
            -
            import vHidden from './vHidden';
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
            import ColorPicker from '../index';
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            /**
         
     | 
| 
       21 
     | 
    
         
            -
             * Generate HTML markup and update instance properties.
         
     | 
| 
       22 
     | 
    
         
            -
             *
         
     | 
| 
       23 
     | 
    
         
            -
             * @param self
         
     | 
| 
       24 
     | 
    
         
            -
             */
         
     | 
| 
       25 
     | 
    
         
            -
            const setMarkup = (self: ColorPicker) => {
         
     | 
| 
       26 
     | 
    
         
            -
              const { input, parent, format, id, componentLabels, colorKeywords, colorPresets } = self;
         
     | 
| 
       27 
     | 
    
         
            -
              const colorValue = getAttribute(input, 'value') || '#fff';
         
     | 
| 
       28 
     | 
    
         
            -
              const { nonColors } = Color;
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
              const { toggleLabel, pickerLabel, formatLabel, hexLabel } = componentLabels;
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
              // update color
         
     | 
| 
       33 
     | 
    
         
            -
              const color = nonColors.includes(colorValue) ? '#fff' : colorValue;
         
     | 
| 
       34 
     | 
    
         
            -
              self.color = new Color(color, format);
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
              // set initial controls dimensions
         
     | 
| 
       37 
     | 
    
         
            -
              const formatString = format === 'hex' ? hexLabel : toUpperCase(format);
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
              const pickerBtn = createElement<HTMLButtonElement>({
         
     | 
| 
       40 
     | 
    
         
            -
                id: `picker-btn-${id}`,
         
     | 
| 
       41 
     | 
    
         
            -
                tagName: 'button',
         
     | 
| 
       42 
     | 
    
         
            -
                type: 'button',
         
     | 
| 
       43 
     | 
    
         
            -
                className: 'picker-toggle btn-appearance',
         
     | 
| 
       44 
     | 
    
         
            -
                ariaExpanded: 'false',
         
     | 
| 
       45 
     | 
    
         
            -
                ariaHasPopup: 'true',
         
     | 
| 
       46 
     | 
    
         
            -
              }) as HTMLButtonElement;
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
              pickerBtn.append(
         
     | 
| 
       49 
     | 
    
         
            -
                createElement({
         
     | 
| 
       50 
     | 
    
         
            -
                  tagName: 'span',
         
     | 
| 
       51 
     | 
    
         
            -
                  className: vHidden,
         
     | 
| 
       52 
     | 
    
         
            -
                  innerText: `${pickerLabel}. ${formatLabel}: ${formatString}`,
         
     | 
| 
       53 
     | 
    
         
            -
                }) as HTMLElement,
         
     | 
| 
       54 
     | 
    
         
            -
              );
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
              const pickerDropdown = createElement({
         
     | 
| 
       57 
     | 
    
         
            -
                tagName: 'div',
         
     | 
| 
       58 
     | 
    
         
            -
                className: 'color-dropdown picker',
         
     | 
| 
       59 
     | 
    
         
            -
                role: 'group',
         
     | 
| 
       60 
     | 
    
         
            -
                ariaLabelledBy: `picker-btn-${id}`,
         
     | 
| 
       61 
     | 
    
         
            -
              } as Partial<HTMLElement> & { ariaLabelledBy: string }) as HTMLElement;
         
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
              const colorControls = getColorControls(self);
         
     | 
| 
       64 
     | 
    
         
            -
              const colorForm = getColorForm(self);
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
              pickerDropdown.append(colorControls, colorForm);
         
     | 
| 
       67 
     | 
    
         
            -
              input.before(pickerBtn);
         
     | 
| 
       68 
     | 
    
         
            -
              parent.append(pickerDropdown);
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
              // set colour key menu template
         
     | 
| 
       71 
     | 
    
         
            -
              if (colorKeywords || colorPresets) {
         
     | 
| 
       72 
     | 
    
         
            -
                const presetsDropdown = createElement({
         
     | 
| 
       73 
     | 
    
         
            -
                  tagName: 'div',
         
     | 
| 
       74 
     | 
    
         
            -
                  className: 'color-dropdown scrollable menu',
         
     | 
| 
       75 
     | 
    
         
            -
                }) as HTMLElement;
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
                // color presets
         
     | 
| 
       78 
     | 
    
         
            -
                if (colorPresets) {
         
     | 
| 
       79 
     | 
    
         
            -
                  presetsDropdown.append(getColorMenu(self, colorPresets, 'color-options'));
         
     | 
| 
       80 
     | 
    
         
            -
                }
         
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
                // explicit defaults [reset, initial, inherit, transparent, currentColor]
         
     | 
| 
       83 
     | 
    
         
            -
                // also custom defaults [default: #069, complementary: #930]
         
     | 
| 
       84 
     | 
    
         
            -
                if (colorKeywords && colorKeywords.length) {
         
     | 
| 
       85 
     | 
    
         
            -
                  presetsDropdown.append(getColorMenu(self, colorKeywords, 'color-defaults'));
         
     | 
| 
       86 
     | 
    
         
            -
                }
         
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
                const presetsBtn = createElement<HTMLButtonElement>({
         
     | 
| 
       89 
     | 
    
         
            -
                  tagName: 'button',
         
     | 
| 
       90 
     | 
    
         
            -
                  type: 'button',
         
     | 
| 
       91 
     | 
    
         
            -
                  className: 'menu-toggle btn-appearance',
         
     | 
| 
       92 
     | 
    
         
            -
                  tabIndex: -1,
         
     | 
| 
       93 
     | 
    
         
            -
                  ariaExpanded: 'false',
         
     | 
| 
       94 
     | 
    
         
            -
                  ariaHasPopup: 'true',
         
     | 
| 
       95 
     | 
    
         
            -
                }) as HTMLButtonElement;
         
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
                const xmlns = encodeURI('http://www.w3.org/2000/svg');
         
     | 
| 
       98 
     | 
    
         
            -
                const presetsIcon = createElementNS(xmlns, {
         
     | 
| 
       99 
     | 
    
         
            -
                  tagName: 'svg',
         
     | 
| 
       100 
     | 
    
         
            -
                }) as HTMLElement;
         
     | 
| 
       101 
     | 
    
         
            -
                setAttribute(presetsIcon, 'xmlns', xmlns);
         
     | 
| 
       102 
     | 
    
         
            -
                setAttribute(presetsIcon, 'viewBox', '0 0 512 512');
         
     | 
| 
       103 
     | 
    
         
            -
                setAttribute(presetsIcon, ariaHidden, 'true');
         
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
                const path = createElementNS(xmlns, {
         
     | 
| 
       106 
     | 
    
         
            -
                  tagName: 'path',
         
     | 
| 
       107 
     | 
    
         
            -
                }) as HTMLElement;
         
     | 
| 
       108 
     | 
    
         
            -
                setAttribute(path, 'd', 'M98,158l157,156L411,158l27,27L255,368L71,185L98,158z');
         
     | 
| 
       109 
     | 
    
         
            -
                setAttribute(path, 'fill', '#fff');
         
     | 
| 
       110 
     | 
    
         
            -
                presetsIcon.append(path);
         
     | 
| 
       111 
     | 
    
         
            -
                presetsBtn.append(
         
     | 
| 
       112 
     | 
    
         
            -
                  createElement({
         
     | 
| 
       113 
     | 
    
         
            -
                    tagName: 'span',
         
     | 
| 
       114 
     | 
    
         
            -
                    className: vHidden,
         
     | 
| 
       115 
     | 
    
         
            -
                    innerText: `${toggleLabel}`,
         
     | 
| 
       116 
     | 
    
         
            -
                  }) as HTMLElement,
         
     | 
| 
       117 
     | 
    
         
            -
                  presetsIcon,
         
     | 
| 
       118 
     | 
    
         
            -
                );
         
     | 
| 
       119 
     | 
    
         
            -
             
     | 
| 
       120 
     | 
    
         
            -
                parent.append(presetsBtn, presetsDropdown);
         
     | 
| 
       121 
     | 
    
         
            -
              }
         
     | 
| 
       122 
     | 
    
         
            -
             
     | 
| 
       123 
     | 
    
         
            -
              // solve non-colors after settings save
         
     | 
| 
       124 
     | 
    
         
            -
              if (colorKeywords && nonColors.includes(colorValue)) {
         
     | 
| 
       125 
     | 
    
         
            -
                self.value = colorValue;
         
     | 
| 
       126 
     | 
    
         
            -
              }
         
     | 
| 
       127 
     | 
    
         
            -
              setAttribute(input, tabindex, '-1');
         
     | 
| 
       128 
     | 
    
         
            -
            };
         
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
       130 
     | 
    
         
            -
            export default setMarkup;
         
     | 
    
        package/src/ts/util/vHidden.ts
    DELETED
    
    
    
        package/tsconfig.json
    DELETED
    
    | 
         @@ -1,29 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {
         
     | 
| 
       2 
     | 
    
         
            -
              // https://janessagarrow.com/blog/typescript-and-esbuild/
         
     | 
| 
       3 
     | 
    
         
            -
             "compilerOptions": {
         
     | 
| 
       4 
     | 
    
         
            -
               "lib": ["DOM", "ESNext", "DOM.Iterable"],
         
     | 
| 
       5 
     | 
    
         
            -
              //  "types": ["vite", "vite/client", "@thednp/shorty", "@thednp/color"],
         
     | 
| 
       6 
     | 
    
         
            -
               "rootDir": "./src",
         
     | 
| 
       7 
     | 
    
         
            -
               "baseUrl": "./",
         
     | 
| 
       8 
     | 
    
         
            -
               "module": "ESNext",
         
     | 
| 
       9 
     | 
    
         
            -
               "target": "ESNext",
         
     | 
| 
       10 
     | 
    
         
            -
               "moduleResolution": "Node",
         
     | 
| 
       11 
     | 
    
         
            -
               "allowJs": true,
         
     | 
| 
       12 
     | 
    
         
            -
               "forceConsistentCasingInFileNames": true,
         
     | 
| 
       13 
     | 
    
         
            -
               "useDefineForClassFields": true,
         
     | 
| 
       14 
     | 
    
         
            -
               "strict": true,
         
     | 
| 
       15 
     | 
    
         
            -
               "sourceMap": true,
         
     | 
| 
       16 
     | 
    
         
            -
               "resolveJsonModule": true,
         
     | 
| 
       17 
     | 
    
         
            -
               "esModuleInterop": true,
         
     | 
| 
       18 
     | 
    
         
            -
               "isolatedModules": true,
         
     | 
| 
       19 
     | 
    
         
            -
               "noUnusedLocals": true,
         
     | 
| 
       20 
     | 
    
         
            -
               "noUnusedParameters": true,
         
     | 
| 
       21 
     | 
    
         
            -
               "noImplicitReturns": true,
         
     | 
| 
       22 
     | 
    
         
            -
               "removeComments": false,
         
     | 
| 
       23 
     | 
    
         
            -
               "allowSyntheticDefaultImports": true,
         
     | 
| 
       24 
     | 
    
         
            -
               "noEmit": true,
         
     | 
| 
       25 
     | 
    
         
            -
               "skipLibCheck": true // allows dts-bundle-generator to import from package.json
         
     | 
| 
       26 
     | 
    
         
            -
             },
         
     | 
| 
       27 
     | 
    
         
            -
             "include": ["src/*", "src/**/*"],
         
     | 
| 
       28 
     | 
    
         
            -
             "exclude": ["node_modules", "experiments", "coverage", "dist"],
         
     | 
| 
       29 
     | 
    
         
            -
            }
         
     | 
    
        package/vite.config.mts
    DELETED
    
    | 
         @@ -1,35 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            /// <reference types="vite/client" />
         
     | 
| 
       2 
     | 
    
         
            -
            "use strict";
         
     | 
| 
       3 
     | 
    
         
            -
            import { resolve } from 'path';
         
     | 
| 
       4 
     | 
    
         
            -
            import { defineConfig } from 'vite';
         
     | 
| 
       5 
     | 
    
         
            -
            import { name } from './package.json';
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
            const getPackageName = () => {
         
     | 
| 
       8 
     | 
    
         
            -
              return name.includes('@') ? name.split('/')[1] : name;
         
     | 
| 
       9 
     | 
    
         
            -
            };
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
            const NAME = 'ColorPicker';
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
            const fileName = {
         
     | 
| 
       14 
     | 
    
         
            -
              es: `${getPackageName()}.mjs`,
         
     | 
| 
       15 
     | 
    
         
            -
              cjs: `${getPackageName()}.cjs`,
         
     | 
| 
       16 
     | 
    
         
            -
              iife: `${getPackageName()}.js`,
         
     | 
| 
       17 
     | 
    
         
            -
            };
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
            export default defineConfig({
         
     | 
| 
       20 
     | 
    
         
            -
              base: './',
         
     | 
| 
       21 
     | 
    
         
            -
              build: {
         
     | 
| 
       22 
     | 
    
         
            -
                emptyOutDir: true,
         
     | 
| 
       23 
     | 
    
         
            -
                outDir: 'dist/js',
         
     | 
| 
       24 
     | 
    
         
            -
                lib: {
         
     | 
| 
       25 
     | 
    
         
            -
                  entry: resolve(__dirname, 'src/ts/index.ts'),
         
     | 
| 
       26 
     | 
    
         
            -
                  name: NAME,
         
     | 
| 
       27 
     | 
    
         
            -
                  formats: ['es', 'cjs', 'iife'],
         
     | 
| 
       28 
     | 
    
         
            -
                  fileName: (format: string) => fileName[format],
         
     | 
| 
       29 
     | 
    
         
            -
                },
         
     | 
| 
       30 
     | 
    
         
            -
                target: 'ESNext',
         
     | 
| 
       31 
     | 
    
         
            -
                sourcemap: true,
         
     | 
| 
       32 
     | 
    
         
            -
                minify: true,
         
     | 
| 
       33 
     | 
    
         
            -
              },
         
     | 
| 
       34 
     | 
    
         
            -
            });
         
     | 
| 
       35 
     | 
    
         
            -
             
     |