autoql-fe-utils 1.0.28 → 1.0.30
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.d.ts +1 -1
- package/dist/index.global.js +261 -258
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +261 -260
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +261 -260
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -753,7 +753,7 @@ declare const getSVGBase64: (svgElement: any) => string;
|
|
|
753
753
|
* @param {string} [fill] optionally backgrund canvas fill
|
|
754
754
|
* @return {Promise} a promise to the bas64 png image
|
|
755
755
|
*/
|
|
756
|
-
declare const svgToPng: (svgElement: SVGElement, scale
|
|
756
|
+
declare const svgToPng: (svgElement: SVGElement, scale: number, CSS_PREFIX: string) => Promise<string>;
|
|
757
757
|
declare const getBBoxFromRef: (ref: any) => any;
|
|
758
758
|
|
|
759
759
|
interface getSupportedDisplayTypesParams {
|
package/dist/index.global.js
CHANGED
|
@@ -17325,6 +17325,260 @@
|
|
|
17325
17325
|
return parseFloat(nearestLog10.toPrecision(1));
|
|
17326
17326
|
};
|
|
17327
17327
|
|
|
17328
|
+
// src/theme/Themes.ts
|
|
17329
|
+
var LIGHT_THEME = {
|
|
17330
|
+
"accent-color": "#28A8E0",
|
|
17331
|
+
"accent-color-secondary": "#1EA0D8",
|
|
17332
|
+
"background-color-primary": "#F8F8F8",
|
|
17333
|
+
"background-color-secondary": "#FFFFFF",
|
|
17334
|
+
"background-color-tertiary": "#E8E8E8",
|
|
17335
|
+
"background-color-switch-input": "#BABABA",
|
|
17336
|
+
"background-color-switch-thumb": "#FFFFFF",
|
|
17337
|
+
"background-color-disabled": "#EDEDED",
|
|
17338
|
+
"background-color-disabled-dark": "#857D83",
|
|
17339
|
+
"background-color-checkbox": "#FFFFFF",
|
|
17340
|
+
"border-color": "#D8D8D8",
|
|
17341
|
+
"table-border-color": "#EFEFEF",
|
|
17342
|
+
"hover-color": "#F6F7F9",
|
|
17343
|
+
"text-color-primary": "#343434",
|
|
17344
|
+
"text-color-secondary": "#8b8b8b",
|
|
17345
|
+
"text-color-accent": "#FFFFFF",
|
|
17346
|
+
"text-color-placeholder": "#0000004D",
|
|
17347
|
+
"dashboard-title-color": "#28A8E0",
|
|
17348
|
+
"font-family": "'Roboto', sans-serif",
|
|
17349
|
+
"font-size": "15px",
|
|
17350
|
+
"chart-font-size": "12px",
|
|
17351
|
+
"highlight-color": "#000000",
|
|
17352
|
+
"badge-color": "#F5222D",
|
|
17353
|
+
"danger-color": "#CA0B00",
|
|
17354
|
+
"warning-color": "#FFB600",
|
|
17355
|
+
"success-color": "#47b84c",
|
|
17356
|
+
"info-color": "#28A8E0",
|
|
17357
|
+
"box-shadow-color": "#85858528",
|
|
17358
|
+
"mask-color": "#0000000F",
|
|
17359
|
+
"mobile-mask-color": "#00000059",
|
|
17360
|
+
"scrollbar-color": "#aeaeae",
|
|
17361
|
+
"box-shadow-1": "0px 1px 2px 1px var(--react-autoql-box-shadow-color)",
|
|
17362
|
+
"box-shadow-2": "0px 1px 2px 0px var(--react-autoql-box-shadow-color)"
|
|
17363
|
+
};
|
|
17364
|
+
var DARK_THEME = {
|
|
17365
|
+
"accent-color": "#193a48",
|
|
17366
|
+
"accent-color-secondary": "#1ea0d8",
|
|
17367
|
+
"background-color-primary": "#20252A",
|
|
17368
|
+
"background-color-secondary": "#3B3F46",
|
|
17369
|
+
"background-color-tertiary": "#292929",
|
|
17370
|
+
"background-color-switch-input": "#252525",
|
|
17371
|
+
"background-color-switch-thumb": "#ececec",
|
|
17372
|
+
"background-color-checkbox": "#292929",
|
|
17373
|
+
"background-color-disabled": "#5d6167",
|
|
17374
|
+
"background-color-disabled-dark": "#857d83",
|
|
17375
|
+
"table-border-color": "#53565c",
|
|
17376
|
+
"border-color": "#53565c",
|
|
17377
|
+
"hover-color": "#4a4f56",
|
|
17378
|
+
"text-color-primary": "#ececec",
|
|
17379
|
+
"text-color-secondary": "#bababa",
|
|
17380
|
+
"text-color-accent": "#ffffff",
|
|
17381
|
+
"text-color-placeholder": "#ffffff6e",
|
|
17382
|
+
"dashboard-title-color": "#193a48",
|
|
17383
|
+
"font-family": "'Roboto', sans-serif",
|
|
17384
|
+
"font-size": "12px",
|
|
17385
|
+
"chart-font-size": "12px",
|
|
17386
|
+
"highlight-color": "#ffffff",
|
|
17387
|
+
"badge-color": "#f5222d",
|
|
17388
|
+
"danger-color": "#ff584e",
|
|
17389
|
+
"warning-color": "#ffcc00",
|
|
17390
|
+
"success-color": "#47b84c",
|
|
17391
|
+
"info-color": "#28a8e0",
|
|
17392
|
+
"box-shadow-color": "#00000066",
|
|
17393
|
+
"mask-color": "#00000021",
|
|
17394
|
+
"mobile-mask-color": "#00000059",
|
|
17395
|
+
"scrollbar-color": "#727477",
|
|
17396
|
+
"box-shadow-1": "0px 1px 1px 0px var(--react-autoql-box-shadow-color)",
|
|
17397
|
+
"box-shadow-2": "0px 1px 2px 0px var(--react-autoql-box-shadow-color)"
|
|
17398
|
+
};
|
|
17399
|
+
|
|
17400
|
+
// src/theme/configureTheme.ts
|
|
17401
|
+
var ThemeType = /* @__PURE__ */ ((ThemeType2) => {
|
|
17402
|
+
ThemeType2["LIGHT"] = "light";
|
|
17403
|
+
ThemeType2["DARK"] = "dark";
|
|
17404
|
+
return ThemeType2;
|
|
17405
|
+
})(ThemeType || {});
|
|
17406
|
+
var defaultThemeConfig = {
|
|
17407
|
+
theme: "light" /* LIGHT */,
|
|
17408
|
+
chartColors: ["#26A7E9", "#A5CD39", "#DD6A6A", "#FFA700", "#00C1B2"],
|
|
17409
|
+
accentColor: "#26A7E9",
|
|
17410
|
+
fontFamily: "sans-serif",
|
|
17411
|
+
textColor: void 0,
|
|
17412
|
+
textColorSecondary: void 0,
|
|
17413
|
+
accentTextColor: void 0,
|
|
17414
|
+
dashboardTitleColor: void 0,
|
|
17415
|
+
backgroundColorPrimary: void 0,
|
|
17416
|
+
backgroundColorSecondary: void 0
|
|
17417
|
+
};
|
|
17418
|
+
var getThemeConfig = (customThemeConfig = {}) => {
|
|
17419
|
+
return {
|
|
17420
|
+
...defaultThemeConfig,
|
|
17421
|
+
...customThemeConfig
|
|
17422
|
+
};
|
|
17423
|
+
};
|
|
17424
|
+
var getRBGFromHex = (hex2) => {
|
|
17425
|
+
let color3 = hex2;
|
|
17426
|
+
if (color3.slice(0, 1) === "#") {
|
|
17427
|
+
color3 = color3.slice(1);
|
|
17428
|
+
}
|
|
17429
|
+
if (color3.length === 3) {
|
|
17430
|
+
color3 = color3.split("").map((col) => col + col).join("");
|
|
17431
|
+
}
|
|
17432
|
+
const r = parseInt(color3.substr(0, 2), 16);
|
|
17433
|
+
const g = parseInt(color3.substr(2, 2), 16);
|
|
17434
|
+
const b = parseInt(color3.substr(4, 2), 16);
|
|
17435
|
+
return { r, g, b };
|
|
17436
|
+
};
|
|
17437
|
+
var getYIQFromHex = (hex2) => {
|
|
17438
|
+
const { r, g, b } = getRBGFromHex(hex2);
|
|
17439
|
+
const yiq = (r * 299 + g * 587 + b * 114) / 1e3;
|
|
17440
|
+
return yiq;
|
|
17441
|
+
};
|
|
17442
|
+
var lightenDarkenColor = (col, amt) => {
|
|
17443
|
+
let usePound = false;
|
|
17444
|
+
if (col[0] == "#") {
|
|
17445
|
+
col = col.slice(1);
|
|
17446
|
+
usePound = true;
|
|
17447
|
+
}
|
|
17448
|
+
const num = parseInt(col, 16);
|
|
17449
|
+
let r = (num >> 16) + amt;
|
|
17450
|
+
if (r > 255)
|
|
17451
|
+
r = 255;
|
|
17452
|
+
else if (r < 0)
|
|
17453
|
+
r = 0;
|
|
17454
|
+
let b = (num >> 8 & 255) + amt;
|
|
17455
|
+
if (b > 255)
|
|
17456
|
+
b = 255;
|
|
17457
|
+
else if (b < 0)
|
|
17458
|
+
b = 0;
|
|
17459
|
+
let g = (num & 255) + amt;
|
|
17460
|
+
if (g > 255)
|
|
17461
|
+
g = 255;
|
|
17462
|
+
else if (g < 0)
|
|
17463
|
+
g = 0;
|
|
17464
|
+
const string = "000000" + (g | b << 8 | r << 16).toString(16);
|
|
17465
|
+
return (usePound ? "#" : "") + string.substring(string.length - 6);
|
|
17466
|
+
};
|
|
17467
|
+
var getThemeValue = (property, prefix2 = "react-autoql") => {
|
|
17468
|
+
return document.documentElement.style.getPropertyValue(`--${prefix2}-${property}`);
|
|
17469
|
+
};
|
|
17470
|
+
var getThemeType = () => {
|
|
17471
|
+
try {
|
|
17472
|
+
const primaryTextColor = getThemeValue("text-color-primary");
|
|
17473
|
+
const textColorYIQ = getYIQFromHex(primaryTextColor);
|
|
17474
|
+
const themeType = textColorYIQ >= 140 ? "light" /* LIGHT */ : "dark" /* DARK */;
|
|
17475
|
+
return themeType;
|
|
17476
|
+
} catch (error) {
|
|
17477
|
+
console.error(error);
|
|
17478
|
+
return "light" /* LIGHT */;
|
|
17479
|
+
}
|
|
17480
|
+
};
|
|
17481
|
+
var getChartColorVars = (prefix2) => {
|
|
17482
|
+
var _a, _b, _c;
|
|
17483
|
+
try {
|
|
17484
|
+
const chartColors = [];
|
|
17485
|
+
const chartColorsDark = [];
|
|
17486
|
+
const maxLoops = 100;
|
|
17487
|
+
let counter = 0;
|
|
17488
|
+
while (counter < maxLoops) {
|
|
17489
|
+
try {
|
|
17490
|
+
const chartColor = getThemeValue(`chart-color-${counter}`, prefix2);
|
|
17491
|
+
const chartColorDark = (_a = getThemeValue(`chart-color-dark-${counter}`, prefix2)) != null ? _a : chartColor;
|
|
17492
|
+
if (chartColor) {
|
|
17493
|
+
chartColors.push(chartColor);
|
|
17494
|
+
chartColorsDark.push(chartColorDark);
|
|
17495
|
+
} else {
|
|
17496
|
+
return { chartColors, chartColorsDark };
|
|
17497
|
+
}
|
|
17498
|
+
} catch (error) {
|
|
17499
|
+
}
|
|
17500
|
+
counter += 1;
|
|
17501
|
+
}
|
|
17502
|
+
return { chartColors, chartColorsDark };
|
|
17503
|
+
} catch (error) {
|
|
17504
|
+
console.error("Could not get chart color css vars. See below for error details");
|
|
17505
|
+
console.error(error);
|
|
17506
|
+
return { chartColors: (_b = defaultThemeConfig.chartColors) != null ? _b : [], chartColorsDark: (_c = defaultThemeConfig.chartColors) != null ? _c : [] };
|
|
17507
|
+
}
|
|
17508
|
+
};
|
|
17509
|
+
var setAccentColorVars = (accentColor, themeStyles) => {
|
|
17510
|
+
const accentColorYIQ = getYIQFromHex(accentColor);
|
|
17511
|
+
themeStyles["text-color-accent"] = accentColorYIQ >= 140 ? "black" : "white";
|
|
17512
|
+
};
|
|
17513
|
+
var setChartColors = (providedChartColors, themeStyles) => {
|
|
17514
|
+
const chartColors = providedChartColors || defaultThemeConfig.chartColors;
|
|
17515
|
+
if (!Array.isArray(chartColors)) {
|
|
17516
|
+
console.error("configureTheme chartColors option must be an array");
|
|
17517
|
+
return;
|
|
17518
|
+
} else if (!chartColors.length) {
|
|
17519
|
+
console.error(
|
|
17520
|
+
"configureTheme chartColors option must not be empty. If you meant to use the default colors, do not supply a chart colors array"
|
|
17521
|
+
);
|
|
17522
|
+
return;
|
|
17523
|
+
}
|
|
17524
|
+
chartColors.forEach((color3, i) => {
|
|
17525
|
+
themeStyles[`chart-color-${i}`] = color3;
|
|
17526
|
+
const darkerColor = lightenDarkenColor(color3, -50);
|
|
17527
|
+
themeStyles[`chart-color-dark-${i}`] = darkerColor;
|
|
17528
|
+
});
|
|
17529
|
+
};
|
|
17530
|
+
var configureTheme = (customThemeConfig = {}, prefix2 = "react-autoql") => {
|
|
17531
|
+
const {
|
|
17532
|
+
theme,
|
|
17533
|
+
textColor,
|
|
17534
|
+
fontFamily,
|
|
17535
|
+
chartColors,
|
|
17536
|
+
accentColor,
|
|
17537
|
+
accentTextColor,
|
|
17538
|
+
textColorSecondary,
|
|
17539
|
+
dashboardTitleColor,
|
|
17540
|
+
backgroundColorPrimary,
|
|
17541
|
+
backgroundColorSecondary
|
|
17542
|
+
} = getThemeConfig(customThemeConfig);
|
|
17543
|
+
const themeStyles = theme === "light" ? LIGHT_THEME : DARK_THEME;
|
|
17544
|
+
if (textColor) {
|
|
17545
|
+
themeStyles["text-color-primary"] = textColor;
|
|
17546
|
+
}
|
|
17547
|
+
if (textColorSecondary) {
|
|
17548
|
+
themeStyles["text-color-secondary"] = textColorSecondary;
|
|
17549
|
+
}
|
|
17550
|
+
if (accentTextColor) {
|
|
17551
|
+
themeStyles["text-color-accent"] = accentTextColor;
|
|
17552
|
+
} else {
|
|
17553
|
+
setAccentColorVars(accentColor, themeStyles);
|
|
17554
|
+
}
|
|
17555
|
+
if (fontFamily) {
|
|
17556
|
+
themeStyles["font-family"] = fontFamily;
|
|
17557
|
+
}
|
|
17558
|
+
if (accentColor) {
|
|
17559
|
+
themeStyles["accent-color"] = accentColor;
|
|
17560
|
+
}
|
|
17561
|
+
themeStyles["dashboard-title-color"] = dashboardTitleColor || themeStyles["accent-color"];
|
|
17562
|
+
if (backgroundColorPrimary) {
|
|
17563
|
+
themeStyles["background-color-primary"] = backgroundColorPrimary;
|
|
17564
|
+
}
|
|
17565
|
+
if (backgroundColorSecondary) {
|
|
17566
|
+
themeStyles["background-color-secondary"] = backgroundColorSecondary;
|
|
17567
|
+
}
|
|
17568
|
+
setChartColors(chartColors, themeStyles);
|
|
17569
|
+
for (const property in themeStyles) {
|
|
17570
|
+
document.documentElement.style.setProperty(`--${prefix2}-${property}`, themeStyles[property]);
|
|
17571
|
+
}
|
|
17572
|
+
try {
|
|
17573
|
+
const { r, g, b } = getRBGFromHex(themeStyles["accent-color"]);
|
|
17574
|
+
document.documentElement.style.setProperty(`--${prefix2}-accent-color-R`, `${r}`);
|
|
17575
|
+
document.documentElement.style.setProperty(`--${prefix2}-accent-color-G`, `${g}`);
|
|
17576
|
+
document.documentElement.style.setProperty(`--${prefix2}-accent-color-B`, `${b}`);
|
|
17577
|
+
} catch (error) {
|
|
17578
|
+
console.error(error);
|
|
17579
|
+
}
|
|
17580
|
+
};
|
|
17581
|
+
|
|
17328
17582
|
// node_modules/d3-selection/src/namespaces.js
|
|
17329
17583
|
var xhtml = "http://www.w3.org/1999/xhtml";
|
|
17330
17584
|
var namespaces_default = {
|
|
@@ -18283,7 +18537,7 @@
|
|
|
18283
18537
|
return void 0;
|
|
18284
18538
|
}
|
|
18285
18539
|
};
|
|
18286
|
-
var svgToPng = (svgElement, scale = 3) => {
|
|
18540
|
+
var svgToPng = (svgElement, scale = 3, CSS_PREFIX) => {
|
|
18287
18541
|
return new Promise(function(resolve, reject) {
|
|
18288
18542
|
var _a, _b, _c, _d;
|
|
18289
18543
|
try {
|
|
@@ -18297,7 +18551,10 @@
|
|
|
18297
18551
|
const scaledWidth = originalWidth * scale;
|
|
18298
18552
|
const scaledHeight = originalHeight * scale;
|
|
18299
18553
|
const clonedSvg = svgElement.cloneNode(true);
|
|
18300
|
-
|
|
18554
|
+
const chartFontFamily = getThemeValue("font-family", CSS_PREFIX);
|
|
18555
|
+
const chartTextColor = getThemeValue("text-color-primary", CSS_PREFIX);
|
|
18556
|
+
const chartBackgroundColor = getThemeValue("background-color-secondary", CSS_PREFIX);
|
|
18557
|
+
select_default2(clonedSvg).attr("width", originalWidth).attr("height", originalHeight).attr("viewBox", `0 0 ${originalWidth} ${originalHeight}`).attr("preserveAspectRatio", "xMinYMin meet").style("font-family", chartFontFamily).style("color", chartTextColor).style("background", chartBackgroundColor);
|
|
18301
18558
|
const image64 = getSVGBase64(clonedSvg);
|
|
18302
18559
|
const canvas = document.createElement("canvas");
|
|
18303
18560
|
canvas.width = scaledWidth + 2 * scaledMargin;
|
|
@@ -18310,7 +18567,7 @@
|
|
|
18310
18567
|
if (!ctx) {
|
|
18311
18568
|
return;
|
|
18312
18569
|
}
|
|
18313
|
-
ctx.fillStyle =
|
|
18570
|
+
ctx.fillStyle = chartBackgroundColor;
|
|
18314
18571
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
18315
18572
|
ctx.drawImage(this, scaledMargin, scaledMargin, scaledWidth, scaledHeight);
|
|
18316
18573
|
resolve(canvas.toDataURL("image/png"));
|
|
@@ -21292,260 +21549,6 @@
|
|
|
21292
21549
|
return entries;
|
|
21293
21550
|
}
|
|
21294
21551
|
|
|
21295
|
-
// src/theme/Themes.ts
|
|
21296
|
-
var LIGHT_THEME = {
|
|
21297
|
-
"accent-color": "#28A8E0",
|
|
21298
|
-
"accent-color-secondary": "#1EA0D8",
|
|
21299
|
-
"background-color-primary": "#F8F8F8",
|
|
21300
|
-
"background-color-secondary": "#FFFFFF",
|
|
21301
|
-
"background-color-tertiary": "#E8E8E8",
|
|
21302
|
-
"background-color-switch-input": "#BABABA",
|
|
21303
|
-
"background-color-switch-thumb": "#FFFFFF",
|
|
21304
|
-
"background-color-disabled": "#EDEDED",
|
|
21305
|
-
"background-color-disabled-dark": "#857D83",
|
|
21306
|
-
"background-color-checkbox": "#FFFFFF",
|
|
21307
|
-
"border-color": "#D8D8D8",
|
|
21308
|
-
"table-border-color": "#EFEFEF",
|
|
21309
|
-
"hover-color": "#F6F7F9",
|
|
21310
|
-
"text-color-primary": "#343434",
|
|
21311
|
-
"text-color-secondary": "#8b8b8b",
|
|
21312
|
-
"text-color-accent": "#FFFFFF",
|
|
21313
|
-
"text-color-placeholder": "#0000004D",
|
|
21314
|
-
"dashboard-title-color": "#28A8E0",
|
|
21315
|
-
"font-family": "'Roboto', sans-serif",
|
|
21316
|
-
"font-size": "15px",
|
|
21317
|
-
"chart-font-size": "12px",
|
|
21318
|
-
"highlight-color": "#000000",
|
|
21319
|
-
"badge-color": "#F5222D",
|
|
21320
|
-
"danger-color": "#CA0B00",
|
|
21321
|
-
"warning-color": "#FFB600",
|
|
21322
|
-
"success-color": "#47b84c",
|
|
21323
|
-
"info-color": "#28A8E0",
|
|
21324
|
-
"box-shadow-color": "#85858528",
|
|
21325
|
-
"mask-color": "#0000000F",
|
|
21326
|
-
"mobile-mask-color": "#00000059",
|
|
21327
|
-
"scrollbar-color": "#aeaeae",
|
|
21328
|
-
"box-shadow-1": "0px 1px 2px 1px var(--react-autoql-box-shadow-color)",
|
|
21329
|
-
"box-shadow-2": "0px 1px 2px 0px var(--react-autoql-box-shadow-color)"
|
|
21330
|
-
};
|
|
21331
|
-
var DARK_THEME = {
|
|
21332
|
-
"accent-color": "#193a48",
|
|
21333
|
-
"accent-color-secondary": "#1ea0d8",
|
|
21334
|
-
"background-color-primary": "#20252A",
|
|
21335
|
-
"background-color-secondary": "#3B3F46",
|
|
21336
|
-
"background-color-tertiary": "#292929",
|
|
21337
|
-
"background-color-switch-input": "#252525",
|
|
21338
|
-
"background-color-switch-thumb": "#ececec",
|
|
21339
|
-
"background-color-checkbox": "#292929",
|
|
21340
|
-
"background-color-disabled": "#5d6167",
|
|
21341
|
-
"background-color-disabled-dark": "#857d83",
|
|
21342
|
-
"table-border-color": "#53565c",
|
|
21343
|
-
"border-color": "#53565c",
|
|
21344
|
-
"hover-color": "#4a4f56",
|
|
21345
|
-
"text-color-primary": "#ececec",
|
|
21346
|
-
"text-color-secondary": "#bababa",
|
|
21347
|
-
"text-color-accent": "#ffffff",
|
|
21348
|
-
"text-color-placeholder": "#ffffff6e",
|
|
21349
|
-
"dashboard-title-color": "#193a48",
|
|
21350
|
-
"font-family": "'Roboto', sans-serif",
|
|
21351
|
-
"font-size": "12px",
|
|
21352
|
-
"chart-font-size": "12px",
|
|
21353
|
-
"highlight-color": "#ffffff",
|
|
21354
|
-
"badge-color": "#f5222d",
|
|
21355
|
-
"danger-color": "#ff584e",
|
|
21356
|
-
"warning-color": "#ffcc00",
|
|
21357
|
-
"success-color": "#47b84c",
|
|
21358
|
-
"info-color": "#28a8e0",
|
|
21359
|
-
"box-shadow-color": "#00000066",
|
|
21360
|
-
"mask-color": "#00000021",
|
|
21361
|
-
"mobile-mask-color": "#00000059",
|
|
21362
|
-
"scrollbar-color": "#727477",
|
|
21363
|
-
"box-shadow-1": "0px 1px 1px 0px var(--react-autoql-box-shadow-color)",
|
|
21364
|
-
"box-shadow-2": "0px 1px 2px 0px var(--react-autoql-box-shadow-color)"
|
|
21365
|
-
};
|
|
21366
|
-
|
|
21367
|
-
// src/theme/configureTheme.ts
|
|
21368
|
-
var ThemeType = /* @__PURE__ */ ((ThemeType2) => {
|
|
21369
|
-
ThemeType2["LIGHT"] = "light";
|
|
21370
|
-
ThemeType2["DARK"] = "dark";
|
|
21371
|
-
return ThemeType2;
|
|
21372
|
-
})(ThemeType || {});
|
|
21373
|
-
var defaultThemeConfig = {
|
|
21374
|
-
theme: "light" /* LIGHT */,
|
|
21375
|
-
chartColors: ["#26A7E9", "#A5CD39", "#DD6A6A", "#FFA700", "#00C1B2"],
|
|
21376
|
-
accentColor: "#26A7E9",
|
|
21377
|
-
fontFamily: "sans-serif",
|
|
21378
|
-
textColor: void 0,
|
|
21379
|
-
textColorSecondary: void 0,
|
|
21380
|
-
accentTextColor: void 0,
|
|
21381
|
-
dashboardTitleColor: void 0,
|
|
21382
|
-
backgroundColorPrimary: void 0,
|
|
21383
|
-
backgroundColorSecondary: void 0
|
|
21384
|
-
};
|
|
21385
|
-
var getThemeConfig = (customThemeConfig = {}) => {
|
|
21386
|
-
return {
|
|
21387
|
-
...defaultThemeConfig,
|
|
21388
|
-
...customThemeConfig
|
|
21389
|
-
};
|
|
21390
|
-
};
|
|
21391
|
-
var getRBGFromHex = (hex2) => {
|
|
21392
|
-
let color3 = hex2;
|
|
21393
|
-
if (color3.slice(0, 1) === "#") {
|
|
21394
|
-
color3 = color3.slice(1);
|
|
21395
|
-
}
|
|
21396
|
-
if (color3.length === 3) {
|
|
21397
|
-
color3 = color3.split("").map((col) => col + col).join("");
|
|
21398
|
-
}
|
|
21399
|
-
const r = parseInt(color3.substr(0, 2), 16);
|
|
21400
|
-
const g = parseInt(color3.substr(2, 2), 16);
|
|
21401
|
-
const b = parseInt(color3.substr(4, 2), 16);
|
|
21402
|
-
return { r, g, b };
|
|
21403
|
-
};
|
|
21404
|
-
var getYIQFromHex = (hex2) => {
|
|
21405
|
-
const { r, g, b } = getRBGFromHex(hex2);
|
|
21406
|
-
const yiq = (r * 299 + g * 587 + b * 114) / 1e3;
|
|
21407
|
-
return yiq;
|
|
21408
|
-
};
|
|
21409
|
-
var lightenDarkenColor = (col, amt) => {
|
|
21410
|
-
let usePound = false;
|
|
21411
|
-
if (col[0] == "#") {
|
|
21412
|
-
col = col.slice(1);
|
|
21413
|
-
usePound = true;
|
|
21414
|
-
}
|
|
21415
|
-
const num = parseInt(col, 16);
|
|
21416
|
-
let r = (num >> 16) + amt;
|
|
21417
|
-
if (r > 255)
|
|
21418
|
-
r = 255;
|
|
21419
|
-
else if (r < 0)
|
|
21420
|
-
r = 0;
|
|
21421
|
-
let b = (num >> 8 & 255) + amt;
|
|
21422
|
-
if (b > 255)
|
|
21423
|
-
b = 255;
|
|
21424
|
-
else if (b < 0)
|
|
21425
|
-
b = 0;
|
|
21426
|
-
let g = (num & 255) + amt;
|
|
21427
|
-
if (g > 255)
|
|
21428
|
-
g = 255;
|
|
21429
|
-
else if (g < 0)
|
|
21430
|
-
g = 0;
|
|
21431
|
-
const string = "000000" + (g | b << 8 | r << 16).toString(16);
|
|
21432
|
-
return (usePound ? "#" : "") + string.substring(string.length - 6);
|
|
21433
|
-
};
|
|
21434
|
-
var getThemeValue = (property, prefix2 = "react-autoql") => {
|
|
21435
|
-
return document.documentElement.style.getPropertyValue(`--${prefix2}-${property}`);
|
|
21436
|
-
};
|
|
21437
|
-
var getThemeType = () => {
|
|
21438
|
-
try {
|
|
21439
|
-
const primaryTextColor = getThemeValue("text-color-primary");
|
|
21440
|
-
const textColorYIQ = getYIQFromHex(primaryTextColor);
|
|
21441
|
-
const themeType = textColorYIQ >= 140 ? "light" /* LIGHT */ : "dark" /* DARK */;
|
|
21442
|
-
return themeType;
|
|
21443
|
-
} catch (error) {
|
|
21444
|
-
console.error(error);
|
|
21445
|
-
return "light" /* LIGHT */;
|
|
21446
|
-
}
|
|
21447
|
-
};
|
|
21448
|
-
var getChartColorVars = (prefix2) => {
|
|
21449
|
-
var _a, _b, _c;
|
|
21450
|
-
try {
|
|
21451
|
-
const chartColors = [];
|
|
21452
|
-
const chartColorsDark = [];
|
|
21453
|
-
const maxLoops = 100;
|
|
21454
|
-
let counter = 0;
|
|
21455
|
-
while (counter < maxLoops) {
|
|
21456
|
-
try {
|
|
21457
|
-
const chartColor = getThemeValue(`chart-color-${counter}`, prefix2);
|
|
21458
|
-
const chartColorDark = (_a = getThemeValue(`chart-color-dark-${counter}`, prefix2)) != null ? _a : chartColor;
|
|
21459
|
-
if (chartColor) {
|
|
21460
|
-
chartColors.push(chartColor);
|
|
21461
|
-
chartColorsDark.push(chartColorDark);
|
|
21462
|
-
} else {
|
|
21463
|
-
return { chartColors, chartColorsDark };
|
|
21464
|
-
}
|
|
21465
|
-
} catch (error) {
|
|
21466
|
-
}
|
|
21467
|
-
counter += 1;
|
|
21468
|
-
}
|
|
21469
|
-
return { chartColors, chartColorsDark };
|
|
21470
|
-
} catch (error) {
|
|
21471
|
-
console.error("Could not get chart color css vars. See below for error details");
|
|
21472
|
-
console.error(error);
|
|
21473
|
-
return { chartColors: (_b = defaultThemeConfig.chartColors) != null ? _b : [], chartColorsDark: (_c = defaultThemeConfig.chartColors) != null ? _c : [] };
|
|
21474
|
-
}
|
|
21475
|
-
};
|
|
21476
|
-
var setAccentColorVars = (accentColor, themeStyles) => {
|
|
21477
|
-
const accentColorYIQ = getYIQFromHex(accentColor);
|
|
21478
|
-
themeStyles["text-color-accent"] = accentColorYIQ >= 140 ? "black" : "white";
|
|
21479
|
-
};
|
|
21480
|
-
var setChartColors = (providedChartColors, themeStyles) => {
|
|
21481
|
-
const chartColors = providedChartColors || defaultThemeConfig.chartColors;
|
|
21482
|
-
if (!Array.isArray(chartColors)) {
|
|
21483
|
-
console.error("configureTheme chartColors option must be an array");
|
|
21484
|
-
return;
|
|
21485
|
-
} else if (!chartColors.length) {
|
|
21486
|
-
console.error(
|
|
21487
|
-
"configureTheme chartColors option must not be empty. If you meant to use the default colors, do not supply a chart colors array"
|
|
21488
|
-
);
|
|
21489
|
-
return;
|
|
21490
|
-
}
|
|
21491
|
-
chartColors.forEach((color3, i) => {
|
|
21492
|
-
themeStyles[`chart-color-${i}`] = color3;
|
|
21493
|
-
const darkerColor = lightenDarkenColor(color3, -50);
|
|
21494
|
-
themeStyles[`chart-color-dark-${i}`] = darkerColor;
|
|
21495
|
-
});
|
|
21496
|
-
};
|
|
21497
|
-
var configureTheme = (customThemeConfig = {}, prefix2 = "react-autoql") => {
|
|
21498
|
-
const {
|
|
21499
|
-
theme,
|
|
21500
|
-
textColor,
|
|
21501
|
-
fontFamily,
|
|
21502
|
-
chartColors,
|
|
21503
|
-
accentColor,
|
|
21504
|
-
accentTextColor,
|
|
21505
|
-
textColorSecondary,
|
|
21506
|
-
dashboardTitleColor,
|
|
21507
|
-
backgroundColorPrimary,
|
|
21508
|
-
backgroundColorSecondary
|
|
21509
|
-
} = getThemeConfig(customThemeConfig);
|
|
21510
|
-
const themeStyles = theme === "light" ? LIGHT_THEME : DARK_THEME;
|
|
21511
|
-
if (textColor) {
|
|
21512
|
-
themeStyles["text-color-primary"] = textColor;
|
|
21513
|
-
}
|
|
21514
|
-
if (textColorSecondary) {
|
|
21515
|
-
themeStyles["text-color-secondary"] = textColorSecondary;
|
|
21516
|
-
}
|
|
21517
|
-
if (accentTextColor) {
|
|
21518
|
-
themeStyles["text-color-accent"] = accentTextColor;
|
|
21519
|
-
} else {
|
|
21520
|
-
setAccentColorVars(accentColor, themeStyles);
|
|
21521
|
-
}
|
|
21522
|
-
if (fontFamily) {
|
|
21523
|
-
themeStyles["font-family"] = fontFamily;
|
|
21524
|
-
}
|
|
21525
|
-
if (accentColor) {
|
|
21526
|
-
themeStyles["accent-color"] = accentColor;
|
|
21527
|
-
}
|
|
21528
|
-
themeStyles["dashboard-title-color"] = dashboardTitleColor || themeStyles["accent-color"];
|
|
21529
|
-
if (backgroundColorPrimary) {
|
|
21530
|
-
themeStyles["background-color-primary"] = backgroundColorPrimary;
|
|
21531
|
-
}
|
|
21532
|
-
if (backgroundColorSecondary) {
|
|
21533
|
-
themeStyles["background-color-secondary"] = backgroundColorSecondary;
|
|
21534
|
-
}
|
|
21535
|
-
setChartColors(chartColors, themeStyles);
|
|
21536
|
-
for (const property in themeStyles) {
|
|
21537
|
-
document.documentElement.style.setProperty(`--${prefix2}-${property}`, themeStyles[property]);
|
|
21538
|
-
}
|
|
21539
|
-
try {
|
|
21540
|
-
const { r, g, b } = getRBGFromHex(themeStyles["accent-color"]);
|
|
21541
|
-
document.documentElement.style.setProperty(`--${prefix2}-accent-color-R`, `${r}`);
|
|
21542
|
-
document.documentElement.style.setProperty(`--${prefix2}-accent-color-G`, `${g}`);
|
|
21543
|
-
document.documentElement.style.setProperty(`--${prefix2}-accent-color-B`, `${b}`);
|
|
21544
|
-
} catch (error) {
|
|
21545
|
-
console.error(error);
|
|
21546
|
-
}
|
|
21547
|
-
};
|
|
21548
|
-
|
|
21549
21552
|
// src/Charts/chartHelpers.ts
|
|
21550
21553
|
var DEFAULT_INNER_PADDING = 0.2;
|
|
21551
21554
|
var DEFAULT_OUTER_PADDING = 0.5;
|
|
@@ -21703,7 +21706,7 @@
|
|
|
21703
21706
|
const column1 = columns[colIndex];
|
|
21704
21707
|
const column2 = columns[colIndex2];
|
|
21705
21708
|
if (!!legendColumn && !!(column1 == null ? void 0 : column1.origColumn)) {
|
|
21706
|
-
tooltipLine1 = `<div><strong>${legendColumn.display_name}:</strong> ${column1.
|
|
21709
|
+
tooltipLine1 = `<div><strong>${legendColumn.display_name}:</strong> ${column1.title}</div>`;
|
|
21707
21710
|
}
|
|
21708
21711
|
if (column1) {
|
|
21709
21712
|
let column1Title = column1.origColumn ? column1.origColumn.display_name : column1.display_name;
|