@thednp/color-picker 2.0.0-alpha9 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.cjs +0 -0
- package/.lgtm.yml +0 -0
- package/.prettierrc.json +0 -0
- package/.stylelintrc.json +0 -0
- package/LICENSE +0 -0
- package/README.md +5 -5
- package/{compile.js → compile.cjs} +0 -0
- package/cypress/e2e/color-palette.cy.ts +0 -0
- package/cypress/e2e/color-picker.cy.ts +0 -0
- 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 +0 -0
- 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 +2 -1
- package/dist/css/color-picker.css +7 -7
- package/dist/css/color-picker.min.css +2 -2
- package/dist/css/color-picker.rtl.css +7 -7
- package/dist/css/color-picker.rtl.min.css +2 -2
- package/dist/js/color-picker.cjs +2 -2
- package/dist/js/color-picker.cjs.map +1 -1
- package/dist/js/color-picker.d.ts +11 -7
- package/dist/js/color-picker.js +2 -2
- package/dist/js/color-picker.js.map +1 -1
- package/dist/js/color-picker.mjs +254 -289
- package/dist/js/color-picker.mjs.map +1 -1
- package/dts.config.ts +0 -0
- package/package.json +56 -54
- package/src/scss/_variables.scss +0 -0
- package/src/scss/color-picker.rtl.scss +0 -0
- package/src/scss/color-picker.scss +10 -6
- package/src/ts/colorPalette.ts +0 -0
- package/src/ts/index.ts +4 -4
- 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 +2 -2
- package/{vite.config.ts → vite.config.mts} +1 -0
package/dts.config.ts
CHANGED
File without changes
|
package/package.json
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
{
|
2
2
|
"name": "@thednp/color-picker",
|
3
|
-
"version": "2.0.
|
3
|
+
"version": "2.0.1",
|
4
4
|
"author": "thednp",
|
5
5
|
"license": "MIT",
|
6
6
|
"description": "🎨 Modern Color Picker Component",
|
7
|
-
"homepage": "
|
7
|
+
"homepage": "https://thednp.github.io/color-picker",
|
8
|
+
"type": "module",
|
8
9
|
"source": "./src/ts/index.ts",
|
9
10
|
"main": "./dist/js/color-picker.js",
|
10
11
|
"module": "./dist/js/color-picker.mjs",
|
11
12
|
"style": "./dist/css/color-picker.css",
|
12
13
|
"sass": "./src/scss/color-picker.scss",
|
14
|
+
"sideEffects": false,
|
13
15
|
"exports": {
|
14
16
|
".": {
|
15
17
|
"require": "./dist/js/color-picker.cjs",
|
@@ -33,31 +35,6 @@
|
|
33
35
|
"require": "./src/scss/color-picker.rtl.scss"
|
34
36
|
}
|
35
37
|
},
|
36
|
-
"scripts": {
|
37
|
-
"pre-test": "npm run clean-coverage",
|
38
|
-
"test": "npm run pre-test && cypress run",
|
39
|
-
"cypress": "npm run pre-test && npx cypress open",
|
40
|
-
"clean-coverage": "rimraf coverage .nyc_output",
|
41
|
-
"coverage:report": "nyc report --reporter=lcov --reporter=json --reporter=text --reporter=json-summary",
|
42
|
-
"format": "prettier --write \"src/**/*.ts\"",
|
43
|
-
"fix:ts": "eslint src --config .eslintrc.cjs --fix",
|
44
|
-
"lint:ts": "eslint src --config .eslintrc.cjs",
|
45
|
-
"fix:css": "stylelint --config .stylelintrc.json --fix scss \"src/scss/*.scss\"",
|
46
|
-
"lint:css": "stylelint --config .stylelintrc.json scss \"src/scss/*.scss\"",
|
47
|
-
"build": "npm run lint:ts && npm run build-vite && npm run dts",
|
48
|
-
"build-vite": "vite build && npm run docs",
|
49
|
-
"dev": "vite --open ./docs/dev.html --port 8577",
|
50
|
-
"dts": "dts-bundle-generator --config ./dts.config.ts",
|
51
|
-
"docs": "ncp dist/js/color-picker.js docs/js/color-picker.js && ncp dist/js/color-picker.js.map docs/js/color-picker.js.map",
|
52
|
-
"copy": "npm-run-all --parallel copy-*",
|
53
|
-
"copy-css-cp": "ncp dist/css/color-picker.css docs/css/color-picker.css",
|
54
|
-
"copy-css-rtl": "ncp dist/css/color-picker.rtl.css docs/css/color-picker.rtl.css",
|
55
|
-
"compile": "npm run lint:css && npm-run-all --parallel compile-* && npm run copy",
|
56
|
-
"compile-scss": "node compile.js",
|
57
|
-
"compile-scss-min": "node compile.js MIN:true",
|
58
|
-
"compile-scss-rtl": "node compile.js MIN:false,DIR:rtl",
|
59
|
-
"compile-scss-rtl-min": "node compile.js MIN:true,DIR:rtl"
|
60
|
-
},
|
61
38
|
"bugs": {
|
62
39
|
"url": "https://github.com/thednp/color-picker/issues"
|
63
40
|
},
|
@@ -79,37 +56,62 @@
|
|
79
56
|
"typescript"
|
80
57
|
],
|
81
58
|
"dependencies": {
|
82
|
-
"@thednp/color": "^1.0.
|
83
|
-
"@thednp/
|
84
|
-
"@thednp/shorty": "2.0.0-alpha17"
|
59
|
+
"@thednp/color": "^1.0.9",
|
60
|
+
"@thednp/shorty": "2.0.3"
|
85
61
|
},
|
86
62
|
"devDependencies": {
|
87
|
-
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.
|
88
|
-
"@cypress/code-coverage": "^3.
|
89
|
-
"@types/istanbul-lib-instrument": "^1.7.
|
90
|
-
"@
|
91
|
-
"@typescript-eslint/
|
92
|
-
"
|
93
|
-
"
|
94
|
-
"
|
95
|
-
"eslint
|
63
|
+
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.2",
|
64
|
+
"@cypress/code-coverage": "^3.12.44",
|
65
|
+
"@types/istanbul-lib-instrument": "^1.7.7",
|
66
|
+
"@types/node": "^22.2.0",
|
67
|
+
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
68
|
+
"@typescript-eslint/parser": "^6.21.0",
|
69
|
+
"cypress": "^13.13.2",
|
70
|
+
"dts-bundle-generator": "^9.5.1",
|
71
|
+
"eslint": "^8.57.0",
|
72
|
+
"eslint-plugin-jsdoc": "^46.10.1",
|
96
73
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
97
|
-
"eslint-plugin-prettier": "^5.
|
98
|
-
"istanbul-lib-coverage": "^3.2.
|
99
|
-
"istanbul-lib-instrument": "^6.0.
|
74
|
+
"eslint-plugin-prettier": "^5.2.1",
|
75
|
+
"istanbul-lib-coverage": "^3.2.2",
|
76
|
+
"istanbul-lib-instrument": "^6.0.3",
|
100
77
|
"ncp": "^2.0.0",
|
101
|
-
"npm-run-all": "^4.1.5",
|
102
78
|
"nyc": "^15.1.0",
|
103
|
-
"prettier": "^3.
|
104
|
-
"
|
105
|
-
"
|
106
|
-
"stylelint": "^15.10.3",
|
79
|
+
"prettier": "^3.3.3",
|
80
|
+
"sass": "^1.77.8",
|
81
|
+
"stylelint": "^15.11.0",
|
107
82
|
"stylelint-config-standard": "^34.0.0",
|
108
|
-
"stylelint-config-standard-scss": "^
|
109
|
-
"stylelint-order": "^6.0.
|
110
|
-
"stylelint-scss": "^5.
|
111
|
-
"typescript": "^5.
|
112
|
-
"vite": "^
|
83
|
+
"stylelint-config-standard-scss": "^11.1.0",
|
84
|
+
"stylelint-order": "^6.0.4",
|
85
|
+
"stylelint-scss": "^5.3.2",
|
86
|
+
"typescript": "^5.5.4",
|
87
|
+
"vite": "^5.4.0"
|
113
88
|
},
|
114
|
-
"
|
115
|
-
|
89
|
+
"scripts": {
|
90
|
+
"pre-test": "pnpm clean-coverage",
|
91
|
+
"test": "pnpm pre-test && cypress run",
|
92
|
+
"cypress": "pnpm pre-test && npx cypress open",
|
93
|
+
"badges": "npx -p dependency-version-badge update-badge typescript cypress eslint prettier vite",
|
94
|
+
"clean-coverage": "rm -rf coverage && rm -rf .nyc_output",
|
95
|
+
"coverage:report": "nyc report --reporter=lcov --reporter=json --reporter=text --reporter=json-summary",
|
96
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
97
|
+
"lint": "pnpm lint:ts && pnpm check:ts && pnpm lint:css",
|
98
|
+
"fix:ts": "eslint src --config .eslintrc.cjs --fix",
|
99
|
+
"lint:ts": "eslint src --config .eslintrc.cjs",
|
100
|
+
"check:ts": "tsc --noEmit",
|
101
|
+
"fix:css": "stylelint --config .stylelintrc.json --fix scss \"src/scss/*.scss\"",
|
102
|
+
"lint:css": "stylelint --config .stylelintrc.json scss \"src/scss/*.scss\"",
|
103
|
+
"build": "pnpm lint && pnpm build-vite && pnpm dts && pnpm docs",
|
104
|
+
"build-vite": "vite build",
|
105
|
+
"dev": "vite --open ./docs/dev.html --port 8577",
|
106
|
+
"dts": "dts-bundle-generator --config ./dts.config.ts",
|
107
|
+
"docs": "ncp dist/js/color-picker.js ./docs/js/color-picker.js && ncp dist/js/color-picker.js.map docs/js/color-picker.js.map",
|
108
|
+
"copy": "pnpm copy-css-cp && pnpm copy-css-rtl",
|
109
|
+
"copy-css-cp": "ncp dist/css/color-picker.css docs/css/color-picker.css",
|
110
|
+
"copy-css-rtl": "ncp dist/css/color-picker.rtl.css docs/css/color-picker.rtl.css",
|
111
|
+
"compile": "pnpm lint:css && pnpm compile-scss && pnpm compile-scss-min && pnpm compile-scss-rtl && pnpm compile-scss-rtl-min && pnpm copy",
|
112
|
+
"compile-scss": "node compile.cjs",
|
113
|
+
"compile-scss-min": "node compile.cjs MIN:true",
|
114
|
+
"compile-scss-rtl": "node compile.cjs MIN:false,DIR:rtl",
|
115
|
+
"compile-scss-rtl-min": "node compile.cjs MIN:true,DIR:rtl"
|
116
|
+
}
|
117
|
+
}
|
package/src/scss/_variables.scss
CHANGED
File without changes
|
File without changes
|
@@ -1,14 +1,14 @@
|
|
1
1
|
@import "variables";
|
2
2
|
|
3
|
+
*, *::before, *::after {
|
4
|
+
box-sizing: border-box;
|
5
|
+
}
|
6
|
+
|
3
7
|
/* :host */
|
4
8
|
.color-picker {
|
5
9
|
position: relative;
|
6
10
|
display: flex;
|
7
11
|
|
8
|
-
*, *::before, *::after {
|
9
|
-
box-sizing: border-box;
|
10
|
-
}
|
11
|
-
|
12
12
|
@each $name in "white", "black" {
|
13
13
|
@each $lvl in $transparency-levels {
|
14
14
|
@if type-of($name) == "string" and type-of($lvl) == "number" {
|
@@ -21,6 +21,8 @@
|
|
21
21
|
$rgba: rgba($color, $lvl * 1%);
|
22
22
|
|
23
23
|
--#{$name}-#{$lvl}: #{$rgba};
|
24
|
+
|
25
|
+
// --#{$name}-#{$lvl}: #{rgba($color, $lvl * 1%)};
|
24
26
|
}
|
25
27
|
}
|
26
28
|
}
|
@@ -205,8 +207,10 @@
|
|
205
207
|
|
206
208
|
/* scrollable */
|
207
209
|
.scrollable {
|
208
|
-
overflow
|
209
|
-
|
210
|
+
overflow: hidden auto;
|
211
|
+
|
212
|
+
// overflow-x: hidden;
|
213
|
+
// overflow-y: auto;
|
210
214
|
scrollbar-width: thin;
|
211
215
|
}
|
212
216
|
|
package/src/ts/colorPalette.ts
CHANGED
File without changes
|
package/src/ts/index.ts
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
import { addListener, removeListener } from '@thednp/event-listener';
|
2
|
-
|
3
1
|
import {
|
4
2
|
ariaDescription,
|
5
3
|
ariaSelected,
|
@@ -53,6 +51,8 @@ import {
|
|
53
51
|
isArray,
|
54
52
|
isString,
|
55
53
|
getWindow,
|
54
|
+
on,
|
55
|
+
off,
|
56
56
|
} from '@thednp/shorty';
|
57
57
|
|
58
58
|
// ColorPicker Util
|
@@ -97,7 +97,7 @@ const initColorPicker = (element: HTMLInputElement) => new ColorPicker(element);
|
|
97
97
|
* Add / remove `ColorPicker` main event listeners.
|
98
98
|
*/
|
99
99
|
const toggleEvents = (self: ColorPicker, action?: boolean) => {
|
100
|
-
const fn = action ?
|
100
|
+
const fn = action ? on : off;
|
101
101
|
const { input, pickerToggle, menuToggle } = self;
|
102
102
|
|
103
103
|
fn(input, focusinEvent, self.showPicker);
|
@@ -112,7 +112,7 @@ const toggleEvents = (self: ColorPicker, action?: boolean) => {
|
|
112
112
|
* Add / remove `ColorPicker` event listeners active only when open.
|
113
113
|
*/
|
114
114
|
const toggleEventsOnShown = (self: ColorPicker, action?: boolean) => {
|
115
|
-
const fn = action ?
|
115
|
+
const fn = action ? on : off;
|
116
116
|
const { input, colorMenu, parent } = self;
|
117
117
|
const doc = getDocument(input);
|
118
118
|
const win = getWindow(doc);
|
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,8 +2,8 @@
|
|
2
2
|
// https://janessagarrow.com/blog/typescript-and-esbuild/
|
3
3
|
"compilerOptions": {
|
4
4
|
"lib": ["DOM", "ESNext", "DOM.Iterable"],
|
5
|
-
|
6
|
-
"rootDir": "./",
|
5
|
+
// "types": ["vite", "vite/client", "@thednp/shorty", "@thednp/color"],
|
6
|
+
"rootDir": "./src",
|
7
7
|
"baseUrl": "./",
|
8
8
|
"module": "ESNext",
|
9
9
|
"target": "ESNext",
|