@sit-onyx/chartjs-plugin 1.0.0-beta.26 → 1.0.0-beta.260
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 +1 -5
- package/package.json +10 -4
- package/src/utils.ts +11 -2
package/README.md
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
<div align="center" style="text-align: center">
|
|
2
|
-
<
|
|
3
|
-
<source media="(prefers-color-scheme: dark)" type="image/svg+xml" srcset="https://raw.githubusercontent.com/SchwarzIT/onyx/main/.github/onyx-logo-light.svg">
|
|
4
|
-
<source media="(prefers-color-scheme: light)" type="image/svg+xml" srcset="https://raw.githubusercontent.com/SchwarzIT/onyx/main/.github/onyx-logo-dark.svg">
|
|
5
|
-
<img alt="onyx logo" src="https://raw.githubusercontent.com/SchwarzIT/onyx/main/.github/onyx-logo-dark.svg" width="160px">
|
|
6
|
-
</picture>
|
|
2
|
+
<img alt="onyx logo" src="https://raw.githubusercontent.com/SchwarzIT/onyx/main/.github/onyx-logo.svg" height="96px">
|
|
7
3
|
</div>
|
|
8
4
|
|
|
9
5
|
<br>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sit-onyx/chartjs-plugin",
|
|
3
3
|
"description": "A Chart.js plugin for the onyx design system created by Schwarz IT",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.260",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Schwarz IT KG",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -24,16 +24,22 @@
|
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"chart.js": ">= 4.0.0",
|
|
27
|
-
"sit-onyx": "^1.0.0-beta.
|
|
27
|
+
"sit-onyx": "^1.0.0-beta.260"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"vue-
|
|
30
|
+
"@vue/compiler-dom": "3.5.16",
|
|
31
|
+
"chart.js": "4.5.0",
|
|
32
|
+
"vue": "3.5.16",
|
|
33
|
+
"vue-chartjs": "^5.3.2",
|
|
34
|
+
"@sit-onyx/shared": "^1.0.0-beta.3",
|
|
35
|
+
"@sit-onyx/storybook-utils": "^1.0.0-beta.93",
|
|
36
|
+
"sit-onyx": "^1.0.0-beta.260"
|
|
31
37
|
},
|
|
32
38
|
"scripts": {
|
|
33
39
|
"dev": "storybook dev -p 6006 --no-open",
|
|
34
40
|
"build": "vue-tsc --noEmit",
|
|
35
41
|
"test": "vitest",
|
|
36
42
|
"test:coverage": "vitest run --coverage",
|
|
37
|
-
"test:
|
|
43
|
+
"test:playwright": "playwright install && playwright test"
|
|
38
44
|
}
|
|
39
45
|
}
|
package/src/utils.ts
CHANGED
|
@@ -39,8 +39,17 @@ export const getDatasetColors = (color: OnyxColor | `quantitatives-${Quantitativ
|
|
|
39
39
|
* Gets the current value of the given CSS variable.
|
|
40
40
|
* @param CSS variable name, e.g. `--onyx-color-base-primary-500`
|
|
41
41
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
|
|
43
|
+
export const getCSSVariableValue = (variableName: string): string => {
|
|
44
|
+
const isDark = getComputedStyle(document.body).colorScheme === "dark";
|
|
45
|
+
const computedValue = getComputedStyle(document.body).getPropertyValue(variableName).trim();
|
|
46
|
+
const lightDarkMatch = /^light-dark\(([^,]+),\s*([^)]+)\)$/.exec(computedValue);
|
|
47
|
+
|
|
48
|
+
if (lightDarkMatch) {
|
|
49
|
+
return lightDarkMatch[isDark ? 2 : 1].trim();
|
|
50
|
+
} else {
|
|
51
|
+
return computedValue;
|
|
52
|
+
}
|
|
44
53
|
};
|
|
45
54
|
|
|
46
55
|
/**
|