pxengine 0.1.130 → 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 +1 -1
package/dist/index.cjs
CHANGED
|
@@ -10278,6 +10278,12 @@ var ChartContainer = React82.forwardRef(({ id, className, children, config, ...p
|
|
|
10278
10278
|
) });
|
|
10279
10279
|
});
|
|
10280
10280
|
ChartContainer.displayName = "Chart";
|
|
10281
|
+
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]+)$/;
|
|
10282
|
+
function sanitizeChartColor(value) {
|
|
10283
|
+
if (!value) return void 0;
|
|
10284
|
+
const trimmed = value.trim();
|
|
10285
|
+
return SAFE_CSS_COLOR.test(trimmed) ? trimmed : void 0;
|
|
10286
|
+
}
|
|
10281
10287
|
var ChartStyle = ({ id, config }) => {
|
|
10282
10288
|
const colorConfig = Object.entries(config).filter(
|
|
10283
10289
|
([, config2]) => config2.theme || config2.color
|
|
@@ -10293,7 +10299,9 @@ var ChartStyle = ({ id, config }) => {
|
|
|
10293
10299
|
([theme, prefix]) => `
|
|
10294
10300
|
${prefix} [data-chart=${id}] {
|
|
10295
10301
|
${colorConfig.map(([key, itemConfig]) => {
|
|
10296
|
-
const color =
|
|
10302
|
+
const color = sanitizeChartColor(
|
|
10303
|
+
itemConfig.theme?.[theme] || itemConfig.color
|
|
10304
|
+
);
|
|
10297
10305
|
return color ? ` --color-${key}: ${color};` : null;
|
|
10298
10306
|
}).join("\n")}
|
|
10299
10307
|
}
|