@thednp/color-picker 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. package/README.md +4 -4
  2. package/dist/css/color-picker.css +1 -1
  3. package/dist/css/color-picker.min.css +1 -1
  4. package/dist/css/color-picker.rtl.css +1 -1
  5. package/dist/css/color-picker.rtl.min.css +1 -1
  6. package/dist/js/color-picker.cjs +2 -2
  7. package/dist/js/color-picker.cjs.map +1 -1
  8. package/dist/js/color-picker.js +2 -2
  9. package/dist/js/color-picker.js.map +1 -1
  10. package/dist/js/color-picker.mjs +243 -239
  11. package/dist/js/color-picker.mjs.map +1 -1
  12. package/package.json +23 -26
  13. package/src/ts/colorPalette.ts +2 -2
  14. package/src/ts/index.ts +20 -19
  15. package/test/color-palette.test.ts +137 -0
  16. package/test/color-picker.test.ts +705 -0
  17. package/{cypress → test}/fixtures/getMarkup.js +8 -7
  18. package/test/fixtures/swipe.ts +33 -0
  19. package/test/fixtures/write.ts +37 -0
  20. package/tsconfig.json +45 -27
  21. package/vite.config.mts +5 -13
  22. package/vitest.config-ui.ts +26 -0
  23. package/vitest.config.ts +26 -0
  24. package/cypress/e2e/color-palette.cy.ts +0 -128
  25. package/cypress/e2e/color-picker.cy.ts +0 -909
  26. package/cypress/plugins/esbuild-istanbul.ts +0 -50
  27. package/cypress/plugins/tsCompile.ts +0 -34
  28. package/cypress/support/commands.ts +0 -0
  29. package/cypress/support/e2e.ts +0 -21
  30. package/cypress/test.html +0 -23
  31. package/cypress.config.ts +0 -30
  32. /package/{cypress → test}/fixtures/colorNamesFrench.js +0 -0
  33. /package/{cypress → test}/fixtures/componentLabelsFrench.js +0 -0
  34. /package/{cypress → test}/fixtures/format.js +0 -0
  35. /package/{cypress → test}/fixtures/getRandomInt.js +0 -0
  36. /package/{cypress → test}/fixtures/sampleWebcolors.js +0 -0
  37. /package/{cypress → test}/fixtures/testSample.js +0 -0
@@ -1,50 +0,0 @@
1
- // sources
2
- // * https://github.com/enketo/enketo-express/blob/master/tools/esbuild-plugin-istanbul.js
3
- 'use strict';
4
- import esbuild from 'esbuild';
5
- import { promises } from 'fs';
6
- import { createInstrumenter } from 'istanbul-lib-instrument';
7
- import { extname, sep } from 'path';
8
- import tsCompile from './tsCompile';
9
-
10
- // import Cypress settings
11
- const sourceFolder = 'src';
12
- const [name] = process.cwd().split(sep).slice(-1);
13
-
14
- const sourceFilter = `${name}${sep}${sourceFolder}`;
15
- const instrumenter = createInstrumenter({
16
- compact: false,
17
- esModules: true,
18
- preserveComments: true,
19
- autoWrap: true,
20
- });
21
-
22
- const createEsbuildIstanbulPlugin = (): esbuild.Plugin => {
23
- return {
24
- name: 'istanbul',
25
- setup(build: esbuild.PluginBuild) {
26
- build.onLoad(
27
- { filter: /\.(ts|tsx)$/ },
28
- async ({ path }: esbuild.OnLoadArgs): Promise<{ contents: string } & Record<string, any>> => {
29
-
30
- if (!path.includes(sourceFilter)) {
31
- // console.log("> compiling typescript %s for output build", path);
32
- const contents = await promises.readFile(path, 'utf8');
33
- return {
34
- contents: ['.ts', '.tsx'].includes(extname(path)) ? tsCompile(path).outputText : contents,
35
- };
36
- }
37
-
38
- // console.log("🧡 instrumenting %s for output coverage", path);
39
- const { outputText, sourceMap } = tsCompile(path);
40
-
41
- return {
42
- contents: instrumenter.instrumentSync(outputText, path, sourceMap),
43
- };
44
- },
45
- );
46
- },
47
- };
48
- };
49
-
50
- export default createEsbuildIstanbulPlugin;
@@ -1,34 +0,0 @@
1
- // compile.ts
2
- import TypeScript from 'typescript';
3
- import { basename } from 'path';
4
- import { RawSourceMap } from 'source-map';
5
- import { readFileSync } from 'fs';
6
-
7
- export default function tsCompile(
8
- path: string,
9
- ops?: Partial<TypeScript.TranspileOptions>,
10
- ): TypeScript.TranspileOutput & { sourceMap: RawSourceMap } {
11
- // Default options -- you could also perform a merge, or use the project tsconfig.json
12
- const options: TypeScript.TranspileOptions = Object.assign(
13
- {
14
- compilerOptions: {
15
- allowJs: true,
16
- esModuleInterop: true,
17
- removeComments: false,
18
- target: 99, // ESNext
19
- allowSyntheticDefaultImports: true,
20
- isolatedModules: true,
21
- noEmitHelpers: true,
22
- sourceMap: true,
23
- } as Partial<TypeScript.CompilerOptions>,
24
- },
25
- ops,
26
- );
27
- const contents = readFileSync(path, { encoding: 'utf8' });
28
- const { outputText, sourceMapText } = TypeScript.transpileModule(contents, options);
29
- const sourceMap: RawSourceMap = JSON.parse(sourceMapText || '');
30
- sourceMap.file = basename(path);
31
- sourceMap.sources = [basename(path)];
32
-
33
- return { outputText, sourceMap, sourceMapText };
34
- }
File without changes
@@ -1,21 +0,0 @@
1
- // ***********************************************************
2
- // This example support/index.js is processed and
3
- // loaded automatically before your test files.
4
- //
5
- // This is a great place to put global configuration and
6
- // behavior that modifies Cypress.
7
- //
8
- // You can change the location of this file or turn off
9
- // automatically serving support files with the
10
- // 'supportFile' configuration option.
11
- //
12
- // You can read more here:
13
- // https://on.cypress.io/configuration
14
- // ***********************************************************
15
-
16
- // Import commands.js using ES2015 syntax:
17
- // require('./commands')
18
- import './commands'
19
-
20
- // Alternatively you can use CommonJS syntax:
21
- import '@cypress/code-coverage/support'
package/cypress/test.html DELETED
@@ -1,23 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <title>ColorPicker Testing Page</title>
6
- <meta name="description" content="A modern and fully featured color picker web component">
7
- <meta name="keywords" content="color, picker, colorpicker, web component, hwb, hex, rgb, hsl, hsv">
8
- <link id="styles" rel="stylesheet" href="../dist/css/color-picker.css">
9
- <style>
10
- body { padding: 65vh 0 65vh 0; margin: 0 auto; width: 60vw; font-family: sans-serif }
11
- color-picker, .color-picker {
12
- margin: 0 0 2.5rem;
13
- --dropdown-transition: none;
14
- --btn-transition: none;
15
- --options-transition: none;
16
- }
17
- label { margin: 0.5rem 0;display: block;}
18
- body > a { position: absolute; top: 50%; left: 1rem; /* color: white !important clip: 0px 0px 0px 0px; height:0; width: 0 */ }
19
- </style>
20
- </head>
21
- <body>
22
- </body>
23
- </html>
package/cypress.config.ts DELETED
@@ -1,30 +0,0 @@
1
- import { defineConfig } from "cypress";
2
- import createBundler from "@bahmutov/cypress-esbuild-preprocessor";
3
- import createEsbuildIstanbulPlugin from "./cypress/plugins/esbuild-istanbul";
4
- import codeCoverageTask from "@cypress/code-coverage/task";
5
-
6
- async function setupNodeEvents(
7
- on: Cypress.PluginEvents,
8
- config: Cypress.PluginConfigOptions
9
- ): Promise<Cypress.PluginConfigOptions> {
10
- codeCoverageTask(on, config);
11
-
12
- on(
13
- "file:preprocessor",
14
- createBundler({
15
- plugins: [createEsbuildIstanbulPlugin()],
16
- })
17
- );
18
-
19
- // Make sure to return the config object as it might have been modified by the plugin.
20
- return config;
21
- }
22
-
23
- export default defineConfig({
24
- e2e: {
25
- specPattern: "cypress/e2e/**/*.{js,jsx,ts,tsx}",
26
- supportFile: "cypress/support/e2e.ts",
27
- video: false,
28
- setupNodeEvents,
29
- },
30
- });
File without changes
File without changes
File without changes
File without changes
File without changes