pxengine 0.1.129 → 0.1.131
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/dist/index.cjs +9 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +9 -1
- package/dist/index.mjs.map +1 -1
- package/dist/registry.json +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -9928,6 +9928,12 @@ var ChartContainer = React82.forwardRef(({ id, className, children, config, ...p
|
|
|
9928
9928
|
) });
|
|
9929
9929
|
});
|
|
9930
9930
|
ChartContainer.displayName = "Chart";
|
|
9931
|
+
var SAFE_CSS_COLOR = /^(?:#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})|rgba?\(\s*[\d.%\s,/]+\s*\)|hsla?\(\s*[\d.%\s,/]+\s*\)|var\(\s*--[a-zA-Z0-9_-]+\s*\)|[a-zA-Z]+)$/;
|
|
9932
|
+
function sanitizeChartColor(value) {
|
|
9933
|
+
if (!value) return void 0;
|
|
9934
|
+
const trimmed = value.trim();
|
|
9935
|
+
return SAFE_CSS_COLOR.test(trimmed) ? trimmed : void 0;
|
|
9936
|
+
}
|
|
9931
9937
|
var ChartStyle = ({ id, config }) => {
|
|
9932
9938
|
const colorConfig = Object.entries(config).filter(
|
|
9933
9939
|
([, config2]) => config2.theme || config2.color
|
|
@@ -9943,7 +9949,9 @@ var ChartStyle = ({ id, config }) => {
|
|
|
9943
9949
|
([theme, prefix]) => `
|
|
9944
9950
|
${prefix} [data-chart=${id}] {
|
|
9945
9951
|
${colorConfig.map(([key, itemConfig]) => {
|
|
9946
|
-
const color =
|
|
9952
|
+
const color = sanitizeChartColor(
|
|
9953
|
+
itemConfig.theme?.[theme] || itemConfig.color
|
|
9954
|
+
);
|
|
9947
9955
|
return color ? ` --color-${key}: ${color};` : null;
|
|
9948
9956
|
}).join("\n")}
|
|
9949
9957
|
}
|