chartjs-plugin-autocolors 0.4.2 → 0.5.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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * chartjs-plugin-autocolors v0.0.0-development
2
+ * chartjs-plugin-autocolors v0.5.0
3
3
  * https://github.com/kurkle/chartjs-plugin-autocolors#readme
4
4
  * (c) 2026 Jukka Kurkela <jukka.kurkela@gmail.com>
5
5
  * Released under the MIT license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * chartjs-plugin-autocolors v0.0.0-development
2
+ * chartjs-plugin-autocolors v0.5.0
3
3
  * https://github.com/kurkle/chartjs-plugin-autocolors#readme
4
4
  * (c) 2026 Jukka Kurkela <jukka.kurkela@gmail.com>
5
5
  * Released under the MIT license
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * chartjs-plugin-autocolors v0.0.0-development
2
+ * chartjs-plugin-autocolors v0.5.0
3
3
  * https://github.com/kurkle/chartjs-plugin-autocolors#readme
4
4
  * (c) 2026 Jukka Kurkela <jukka.kurkela@gmail.com>
5
5
  * Released under the MIT license
package/package.json CHANGED
@@ -12,41 +12,43 @@
12
12
  "@kurkle/astro-chartjs-editor": "^1.0.0",
13
13
  "@kurkle/color": "^0.5.1",
14
14
  "@kurkle/configs": "^1.5.1",
15
- "@rollup/plugin-json": "^6.0.0",
16
15
  "@rollup/plugin-node-resolve": "^16.0.0",
17
16
  "@rollup/plugin-terser": "^1.0.0",
17
+ "@types/node": "^26.0.0",
18
+ "@vitest/browser": "^5.0.0",
19
+ "@vitest/browser-playwright": "^5.0.0",
20
+ "@vitest/coverage-istanbul": "^5.0.0",
18
21
  "astro": "^7.0.6",
19
22
  "chart.js": "^4.4.5",
20
- "chartjs-test-utils": "^0.5.0",
21
- "concurrently": "^10.0.5",
22
23
  "cookie": "^2.0.1",
23
- "cross-env": "^10.1.0",
24
- "jasmine-core": "^7.0.2",
25
- "karma": "^6.4.1",
26
- "karma-chrome-launcher": "^3.1.1",
27
- "karma-coverage": "^2.2.0",
28
- "karma-firefox-launcher": "^2.1.2",
29
- "karma-jasmine": "^5.1.0",
30
- "karma-jasmine-html-reporter": "^2.0.0",
31
- "karma-rollup-preprocessor": "7.0.8",
32
- "karma-spec-reporter": "^0.0.37",
24
+ "pixelmatch": "^7.1.0",
25
+ "playwright": "^1.63.0",
33
26
  "png-to-ico": "^3.0.2",
34
27
  "rollup": "^4.21.2",
35
- "rollup-plugin-istanbul": "^5.0.0",
36
28
  "semantic-release": "^25.0.3",
37
29
  "sharp": "^0.35.4",
38
- "typescript": "^6.0.3"
30
+ "typescript": "^6.0.3",
31
+ "vitest": "^5.0.0"
39
32
  },
40
33
  "exports": {
41
- "import": "./dist/chartjs-plugin-autocolors.esm.js",
42
- "require": "./dist/chartjs-plugin-autocolors.cjs",
43
- "script": "./dist/chartjs-plugin-autocolors.min.js",
44
- "types": "./types/index.esm.d.ts"
34
+ ".": {
35
+ "import": {
36
+ "types": "./types/index.esm.d.ts",
37
+ "default": "./dist/chartjs-plugin-autocolors.esm.js"
38
+ },
39
+ "require": {
40
+ "types": "./types/index.esm.d.cts",
41
+ "default": "./dist/chartjs-plugin-autocolors.cjs"
42
+ },
43
+ "script": "./dist/chartjs-plugin-autocolors.min.js"
44
+ },
45
+ "./package.json": "./package.json"
45
46
  },
46
47
  "files": [
47
48
  "dist/*",
48
49
  "!dist/docs/**",
49
- "types/index.esm.d.ts"
50
+ "types/index.esm.d.ts",
51
+ "types/index.esm.d.cts"
50
52
  ],
51
53
  "homepage": "https://github.com/kurkle/chartjs-plugin-autocolors#readme",
52
54
  "jsdelivr": "dist/chartjs-plugin-autocolors.min.js",
@@ -63,7 +65,7 @@
63
65
  "module": "dist/chartjs-plugin-autocolors.esm.js",
64
66
  "name": "chartjs-plugin-autocolors",
65
67
  "peerDependencies": {
66
- "@kurkle/color": "^0.4.0 || ^0.5.0",
68
+ "@kurkle/color": ">=0.3.0",
67
69
  "chart.js": ">=2"
68
70
  },
69
71
  "repository": {
@@ -72,25 +74,28 @@
72
74
  },
73
75
  "scripts": {
74
76
  "autobuild": "rollup -c -w",
75
- "build": "rollup -c",
76
- "dev": "karma start ./karma.conf.cjs --no-single-run --auto-watch --browsers chrome",
77
+ "build": "rollup -c && kurkle-build-cjs-types --dir types",
78
+ "dev": "vitest --config vitest.browser.config.ts",
77
79
  "docs": "npm run build && astro build",
78
80
  "docs:dev": "npm run build && astro dev",
79
81
  "docs:version": "node ./docs/scripts/write-docs-version.cjs",
82
+ "fixtures:update": "node scripts/update-fixtures.mjs",
80
83
  "format": "biome check --write",
81
84
  "icons": "kurkle-generate-icons",
82
85
  "lint": "biome check",
83
86
  "predocs": "npm run docs:version",
84
87
  "predocs:dev": "npm run docs:version",
88
+ "prepack": "npm run build",
85
89
  "prepare": "git config core.hooksPath .githooks || true",
86
- "test": "cross-env NODE_ENV=test concurrently \"npm:test-*\"",
87
- "test-karma": "karma start ./karma.conf.cjs --no-auto-watch --single-run",
88
- "typecheck": "tsc -p types/tests/",
90
+ "test": "npm run test:fixture && npm run test:pack",
91
+ "test:fixture": "vitest run --config vitest.browser.config.ts --coverage",
92
+ "test:pack": "kurkle-check-package",
93
+ "typecheck": "tsc -p types/tests/ && tsc --noEmit -p tsconfig.tooling.json",
89
94
  "typecheck:docs": "astro check"
90
95
  },
91
96
  "sideEffects": false,
92
97
  "type": "module",
93
- "types": "types/index.esm.d.ts",
98
+ "types": "types/index.esm.d.cts",
94
99
  "unpkg": "dist/chartjs-plugin-autocolors.min.js",
95
- "version": "0.4.2"
100
+ "version": "0.5.0"
96
101
  }
@@ -0,0 +1,33 @@
1
+ import type {} from './index.esm.js' with { 'resolution-mode': 'import' };
2
+ import type { Chart, ChartType, Plugin } from 'chart.js' with { 'resolution-mode': 'import' };
3
+
4
+ interface ColorsDescriptor {
5
+ background: string
6
+ border: string
7
+ }
8
+
9
+ interface AutocolorsOptions {
10
+ enabled?: boolean
11
+ mode?: 'dataset' | 'data' | 'label'
12
+ offset?: number
13
+ repeat?: number
14
+ customize?: (ctx: AutocolorsContext, options: AutocolorsOptions) => ColorsDescriptor
15
+ }
16
+
17
+ interface AutocolorsContext {
18
+ chart: Chart
19
+ colors: ColorsDescriptor
20
+ dataIndex?: number
21
+ datasetIndex: number
22
+ }
23
+
24
+ declare const autocolorPlugin: Plugin
25
+
26
+ /**
27
+ * Exports the plugin class as default
28
+ */
29
+ declare namespace autocolorPlugin {
30
+ export { AutocolorsContext, AutocolorsOptions, ColorsDescriptor }
31
+ }
32
+
33
+ export = autocolorPlugin
@@ -1,4 +1,4 @@
1
- import { Chart, ChartType } from 'chart.js'
1
+ import { Chart, ChartType, Plugin } from 'chart.js'
2
2
 
3
3
  declare module 'chart.js' {
4
4
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -27,8 +27,9 @@ export interface AutocolorsContext {
27
27
  datasetIndex: number
28
28
  }
29
29
 
30
+ declare const autocolorPlugin: Plugin
31
+
30
32
  /**
31
33
  * Exports the plugin class as default
32
34
  */
33
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
34
35
  export { autocolorPlugin as default }