@bhsd/codemirror-css-color-picker 6.3.2 → 7.1.0
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/LICENSE +21 -0
- package/README.md +15 -24
- package/dist/color.d.ts +21 -0
- package/dist/css.d.ts +6 -0
- package/dist/index.d.ts +14 -39
- package/dist/index.js +395 -587
- package/dist/types.d.ts +26 -0
- package/package.json +70 -38
- package/dist/index.cjs +0 -615
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Text } from '@codemirror/state';
|
|
2
|
+
import type { Tree, SyntaxNodeRef } from '@lezer/common';
|
|
3
|
+
export type RGB = [number, number, number];
|
|
4
|
+
export interface ColorData {
|
|
5
|
+
/** RGB component values, each in the range 0-255 */
|
|
6
|
+
color: RGB;
|
|
7
|
+
alpha: number;
|
|
8
|
+
colorType: 'rgb' | 'rgba' | 'hsl' | 'hsla' | 'hex' | 'named' | 'unknown';
|
|
9
|
+
legacy: boolean;
|
|
10
|
+
spaced: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface WidgetOptions extends ColorData {
|
|
13
|
+
from: number;
|
|
14
|
+
to: number;
|
|
15
|
+
}
|
|
16
|
+
export type ColorDiscovery = Pick<WidgetOptions, 'from' | 'to'> | WidgetOptions & {
|
|
17
|
+
colorType: 'unknown';
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Discovers colors in the syntax node, returning the options for the color picker widgets if colors are found,
|
|
21
|
+
* or `false` if the children of the syntax node can be skipped.
|
|
22
|
+
* @param tree Lezer syntax tree
|
|
23
|
+
* @param node the syntax node to check for colors
|
|
24
|
+
* @param doc the editor document
|
|
25
|
+
*/
|
|
26
|
+
export type DiscoverColors = (tree: Tree, node: SyntaxNodeRef, doc: Text) => ColorDiscovery | ColorDiscovery[] | false | undefined;
|
package/package.json
CHANGED
|
@@ -1,40 +1,72 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
2
|
+
"name": "@bhsd/codemirror-css-color-picker",
|
|
3
|
+
"version": "7.1.0",
|
|
4
|
+
"description": "Enables a color picker input next to CSS colors",
|
|
5
|
+
"homepage": "https://github.com/bhsd-harry/Codemirror-CSS-color-picker#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/bhsd-harry/Codemirror-CSS-color-picker/issues"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"contributors": [
|
|
11
|
+
"Faris Masad <faris@repl.it>",
|
|
12
|
+
"Bhsd"
|
|
13
|
+
],
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/bhsd-harry/Codemirror-CSS-color-picker"
|
|
17
|
+
},
|
|
18
|
+
"type": "module",
|
|
19
|
+
"files": [
|
|
20
|
+
"/dist/index.js",
|
|
21
|
+
"/dist/*.d.ts"
|
|
22
|
+
],
|
|
23
|
+
"main": "dist/index.js",
|
|
24
|
+
"types": "dist/index.d.ts",
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"scripts": {
|
|
27
|
+
"ls": "npm i --package-lock-only && npm ls --package-lock-only --all --omit=dev",
|
|
28
|
+
"prepublishOnly": "npm run build",
|
|
29
|
+
"lint:ts": "tsc --noEmit && eslint --cache .",
|
|
30
|
+
"lint:md": "markdownlint-cli2 '**/*.md'",
|
|
31
|
+
"lint": "npm run lint:ts && npm run lint:md",
|
|
32
|
+
"build": "tsc && node build.js && gsed '/^\\/\\/ /d' build/index.js > dist/index.js && eslint --no-config-lookup -c eslint.dist.mjs dist/index.js",
|
|
33
|
+
"build:test": "tsc --project test/tsconfig.json && npm test",
|
|
34
|
+
"test": "mocha"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@bhsd/common": "^2.1.0",
|
|
38
|
+
"@codemirror/language": "^6.12.3",
|
|
39
|
+
"@codemirror/state": "^6.6.0",
|
|
40
|
+
"@codemirror/view": "^6.41.0",
|
|
41
|
+
"color-name": "~2.0.2",
|
|
42
|
+
"color-space": "^2.3.2"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@bhsd/code-standard": "^2.3.0",
|
|
46
|
+
"@codemirror/lang-css": "^6.3.1",
|
|
47
|
+
"@codemirror/lang-html": "^6.4.11",
|
|
48
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
|
|
49
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
50
|
+
"@types/color-name": "^2.0.0",
|
|
51
|
+
"@types/color-rgba": "^2.1.3",
|
|
52
|
+
"@types/mocha": "^10.0.10",
|
|
53
|
+
"@types/node": "^24.11.0",
|
|
54
|
+
"@typescript-eslint/eslint-plugin": "^8.59.0",
|
|
55
|
+
"@typescript-eslint/parser": "^8.59.0",
|
|
56
|
+
"color-rgba": "^3.0.0",
|
|
57
|
+
"esbuild": "^0.28.0",
|
|
58
|
+
"eslint": "^10.2.1",
|
|
59
|
+
"eslint-plugin-es-x": "^9.6.0",
|
|
60
|
+
"eslint-plugin-jsdoc": "^62.9.0",
|
|
61
|
+
"eslint-plugin-jsonc": "^3.1.2",
|
|
62
|
+
"eslint-plugin-promise": "^7.2.1",
|
|
63
|
+
"eslint-plugin-regexp": "^3.1.0",
|
|
64
|
+
"eslint-plugin-unicorn": "^64.0.0",
|
|
65
|
+
"markdownlint-cli2": "^0.22.1",
|
|
66
|
+
"mocha": "^11.7.5",
|
|
67
|
+
"typescript": "^6.0.3"
|
|
68
|
+
},
|
|
69
|
+
"overrides": {
|
|
70
|
+
"eslint": "^10.2.1"
|
|
71
|
+
}
|
|
40
72
|
}
|