@extend-ai/react-xlsx 0.20.0 → 0.20.2
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 -0
- package/dist/{chart-renderer-AAVZ34BF.cjs → chart-renderer-3QDNTMRN.cjs} +526 -604
- package/dist/chart-renderer-3QDNTMRN.cjs.map +1 -0
- package/dist/{chart-renderer-RXO7WP4Q.js → chart-renderer-7DTEXXG6.js} +19 -97
- package/dist/chart-renderer-7DTEXXG6.js.map +1 -0
- package/dist/{chart-renderer-KGLAI4DN.js → chart-renderer-F355CYSE.js} +13 -92
- package/dist/chart-renderer-F355CYSE.js.map +1 -0
- package/dist/{chart-renderer-NM5UVCTO.cjs → chart-renderer-LGW4EH4M.cjs} +287 -366
- package/dist/chart-renderer-LGW4EH4M.cjs.map +1 -0
- package/dist/{chunk-WSQDFXDW.js → chunk-3LMOGW6A.js} +22 -6
- package/dist/chunk-3LMOGW6A.js.map +1 -0
- package/dist/chunk-A4S3AMON.js +108 -0
- package/dist/chunk-A4S3AMON.js.map +1 -0
- package/dist/{chunk-T5WZHPIN.cjs → chunk-AD4CGQN2.cjs} +2 -2
- package/dist/{chunk-T5WZHPIN.cjs.map → chunk-AD4CGQN2.cjs.map} +1 -1
- package/dist/chunk-AJT23BDP.js +111 -0
- package/dist/chunk-AJT23BDP.js.map +1 -0
- package/dist/{chunk-CJBI5F6V.cjs → chunk-AZWBTFJI.cjs} +12 -93
- package/dist/chunk-AZWBTFJI.cjs.map +1 -0
- package/dist/{chunk-6K3NSKDJ.cjs → chunk-D2UA4P6N.cjs} +15 -4
- package/dist/chunk-D2UA4P6N.cjs.map +1 -0
- package/dist/{chunk-QN3D3JS2.js → chunk-GXYDJPHM.js} +162 -40
- package/dist/chunk-GXYDJPHM.js.map +1 -0
- package/dist/chunk-IDNIGBUM.cjs +108 -0
- package/dist/chunk-IDNIGBUM.cjs.map +1 -0
- package/dist/{chunk-3JTCYAUX.js → chunk-IYGZTLDY.js} +14 -3
- package/dist/chunk-IYGZTLDY.js.map +1 -0
- package/dist/chunk-M55TBS4X.cjs +111 -0
- package/dist/chunk-M55TBS4X.cjs.map +1 -0
- package/dist/{chunk-MCFUTO4J.cjs → chunk-OCF75R75.cjs} +25 -9
- package/dist/chunk-OCF75R75.cjs.map +1 -0
- package/dist/{chunk-NBH72POD.js → chunk-PUI6QI4U.js} +11 -92
- package/dist/chunk-PUI6QI4U.js.map +1 -0
- package/dist/{chunk-2YBG7XQ3.cjs → chunk-ZJ76CZAL.cjs} +1683 -1561
- package/dist/chunk-ZJ76CZAL.cjs.map +1 -0
- package/dist/index.cjs +626 -529
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +124 -27
- package/dist/index.js.map +1 -1
- package/dist/{internal-DrXSHYJZ.d.cts → internal-BJsg5os3.d.cts} +13 -0
- package/dist/{internal-DrXSHYJZ.d.ts → internal-BJsg5os3.d.ts} +13 -0
- package/dist/internal.cjs +6 -5
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +4 -3
- package/dist/preact-LICENSE.txt +21 -0
- package/dist/region-map-geography-24TXETDP.cjs +184 -0
- package/dist/region-map-geography-24TXETDP.cjs.map +1 -0
- package/dist/region-map-geography-OR6DHAF7.js +182 -0
- package/dist/region-map-geography-OR6DHAF7.js.map +1 -0
- package/dist/shared-chart-3STFRVWT.js +215 -0
- package/dist/shared-chart-3STFRVWT.js.map +1 -0
- package/dist/shared-chart-BFQNYOIQ.js +221 -0
- package/dist/shared-chart-BFQNYOIQ.js.map +1 -0
- package/dist/shared-chart-DVC5S2P6.cjs +222 -0
- package/dist/shared-chart-DVC5S2P6.cjs.map +1 -0
- package/dist/shared-chart-MFQSQG4K.cjs +216 -0
- package/dist/shared-chart-MFQSQG4K.cjs.map +1 -0
- package/dist/{spreadsheet-font-assets-4AHYDTAQ.cjs → spreadsheet-font-assets-6FKCVICP.cjs} +2 -2
- package/dist/{spreadsheet-font-assets-4AHYDTAQ.cjs.map → spreadsheet-font-assets-6FKCVICP.cjs.map} +1 -1
- package/dist/{surface-regl-AY7JZVYY.cjs → surface-regl-BBJ6OIKK.cjs} +15 -13
- package/dist/surface-regl-BBJ6OIKK.cjs.map +1 -0
- package/dist/{surface-regl-TJUWTLAZ.js → surface-regl-R2N54JT2.js} +7 -5
- package/dist/{surface-regl-TJUWTLAZ.js.map → surface-regl-R2N54JT2.js.map} +1 -1
- package/dist/{surface-regl-5Z6IVOID.cjs → surface-regl-SUJ2TFZA.cjs} +2 -2
- package/dist/{surface-regl-5Z6IVOID.cjs.map → surface-regl-SUJ2TFZA.cjs.map} +1 -1
- package/dist/us-atlas-LICENSE.txt +13 -0
- package/dist/vanilla.cjs +6 -5
- package/dist/vanilla.cjs.map +1 -1
- package/dist/vanilla.d.cts +2 -2
- package/dist/vanilla.d.ts +2 -2
- package/dist/vanilla.js +4 -3
- package/dist/world-atlas-LICENSE.txt +13 -0
- package/dist/xlsx-worker.js +82 -1
- package/dist/xlsx-worker.js.map +1 -1
- package/package.json +7 -6
- package/dist/chart-renderer-AAVZ34BF.cjs.map +0 -1
- package/dist/chart-renderer-KGLAI4DN.js.map +0 -1
- package/dist/chart-renderer-NM5UVCTO.cjs.map +0 -1
- package/dist/chart-renderer-RXO7WP4Q.js.map +0 -1
- package/dist/chunk-2YBG7XQ3.cjs.map +0 -1
- package/dist/chunk-3JTCYAUX.js.map +0 -1
- package/dist/chunk-6K3NSKDJ.cjs.map +0 -1
- package/dist/chunk-CJBI5F6V.cjs.map +0 -1
- package/dist/chunk-MCFUTO4J.cjs.map +0 -1
- package/dist/chunk-NBH72POD.js.map +0 -1
- package/dist/chunk-QN3D3JS2.js.map +0 -1
- package/dist/chunk-WSQDFXDW.js.map +0 -1
- package/dist/region-map-geography-6TGXBY3V.cjs +0 -184
- package/dist/region-map-geography-6TGXBY3V.cjs.map +0 -1
- package/dist/region-map-geography-YD54DI3H.js +0 -182
- package/dist/region-map-geography-YD54DI3H.js.map +0 -1
- package/dist/surface-regl-AY7JZVYY.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
C2 as C,
|
|
3
3
|
h
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-PUI6QI4U.js";
|
|
5
5
|
|
|
6
6
|
// src/use-chart-module.ts
|
|
7
7
|
function useChartModule(resource) {
|
|
@@ -42,20 +42,35 @@ function createChartModule(importModule) {
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
var officeChartRenderer = createChartModule(async () => {
|
|
46
|
+
try {
|
|
47
|
+
const [{ loadOfficeCharts }, { SharedChartSvg }] = await Promise.all([
|
|
48
|
+
import("@extend-ai/rust-office-charts"),
|
|
49
|
+
import("./shared-chart-BFQNYOIQ.js")
|
|
50
|
+
]);
|
|
51
|
+
return { renderer: await loadOfficeCharts(), SharedChartSvg };
|
|
52
|
+
} catch {
|
|
53
|
+
return { renderer: null, SharedChartSvg: null };
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
var chartRenderer = createChartModule(() => import("./chart-renderer-7DTEXXG6.js"));
|
|
57
|
+
var regionMapResources = createChartModule(() => import("./region-map-geography-OR6DHAF7.js"));
|
|
58
|
+
var surfaceRenderer = createChartModule(() => import("./surface-regl-R2N54JT2.js"));
|
|
48
59
|
function preloadChartRenderers(chartsBySheet) {
|
|
49
60
|
let hasCharts = false;
|
|
61
|
+
let hasSharedCharts = false;
|
|
50
62
|
let hasMaps = false;
|
|
51
63
|
let hasSurfaces = false;
|
|
52
64
|
for (const charts of chartsBySheet) {
|
|
53
65
|
for (const chart of charts) {
|
|
54
|
-
|
|
66
|
+
hasSharedCharts ||= Boolean(chart.renderSource);
|
|
67
|
+
hasCharts ||= !chart.renderSource;
|
|
55
68
|
hasMaps ||= chart.chartType === "RegionMap";
|
|
56
69
|
hasSurfaces ||= chart.chartType === "Surface";
|
|
57
70
|
}
|
|
58
71
|
}
|
|
72
|
+
if (hasSharedCharts) void officeChartRenderer.load().catch(() => {
|
|
73
|
+
});
|
|
59
74
|
if (hasCharts) void chartRenderer.load().catch(() => {
|
|
60
75
|
});
|
|
61
76
|
if (hasMaps) void regionMapResources.load().catch(() => {
|
|
@@ -66,9 +81,10 @@ function preloadChartRenderers(chartsBySheet) {
|
|
|
66
81
|
|
|
67
82
|
export {
|
|
68
83
|
useChartModule,
|
|
84
|
+
officeChartRenderer,
|
|
69
85
|
chartRenderer,
|
|
70
86
|
regionMapResources,
|
|
71
87
|
surfaceRenderer,
|
|
72
88
|
preloadChartRenderers
|
|
73
89
|
};
|
|
74
|
-
//# sourceMappingURL=chunk-
|
|
90
|
+
//# sourceMappingURL=chunk-3LMOGW6A.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/use-chart-module.ts","../src/chart-loader.ts"],"sourcesContent":["import * as React from \"react\";\nimport type { ChartModule } from \"./chart-loader\";\n\nexport function useChartModule<T>(resource: ChartModule<T>) {\n const snapshot = React.useSyncExternalStore(resource.subscribe, resource.getSnapshot, resource.getServerSnapshot);\n React.useEffect(() => {\n void resource.load().catch(() => {});\n }, [resource]);\n if (snapshot.error) throw snapshot.error;\n return snapshot.module;\n}\n","import type { XlsxChart } from \"./types\";\n\ntype ModuleSnapshot<T> = { module: T | null; error: unknown };\n\nexport type ChartModule<T> = {\n load: () => Promise<T>;\n getSnapshot: () => ModuleSnapshot<T>;\n getServerSnapshot: () => ModuleSnapshot<T>;\n subscribe: (listener: () => void) => () => void;\n};\n\nfunction createChartModule<T>(importModule: () => Promise<T>): ChartModule<T> {\n const initialSnapshot: ModuleSnapshot<T> = { module: null, error: null };\n let snapshot = initialSnapshot;\n let promise: Promise<T> | undefined;\n const listeners = new Set<() => void>();\n const publish = (next: ModuleSnapshot<T>) => {\n snapshot = next;\n listeners.forEach((listener) => listener());\n };\n\n return {\n load: () => promise ??= importModule().then((module) => {\n publish({ module, error: null });\n return module;\n }, (error: unknown) => {\n publish({ module: null, error: error instanceof Error ? error : new Error(\"Unable to load chart module.\") });\n throw error;\n }),\n getSnapshot: () => snapshot,\n getServerSnapshot: () => initialSnapshot,\n subscribe: (listener) => {\n listeners.add(listener);\n return () => { listeners.delete(listener); };\n }\n };\n}\n\nexport const officeChartRenderer = createChartModule(async () => {\n try {\n const [{ loadOfficeCharts }, { SharedChartSvg }] = await Promise.all([\n import(\"@extend-ai/rust-office-charts\"), import(\"./shared-chart\")\n ]);\n return { renderer: await loadOfficeCharts(), SharedChartSvg };\n } catch {\n return { renderer: null, SharedChartSvg: null };\n }\n});\n\nexport const chartRenderer = createChartModule(() => import(\"./chart-renderer\"));\nexport const regionMapResources = createChartModule(() => import(\"./region-map-geography\"));\nexport const surfaceRenderer = createChartModule(() => import(\"./surface-regl\"));\n\nexport function preloadChartRenderers(chartsBySheet: readonly (readonly XlsxChart[])[]) {\n let hasCharts = false;\n let hasSharedCharts = false;\n let hasMaps = false;\n let hasSurfaces = false;\n for (const charts of chartsBySheet) {\n for (const chart of charts) {\n hasSharedCharts ||= Boolean(chart.renderSource);\n hasCharts ||= !chart.renderSource;\n hasMaps ||= chart.chartType === \"RegionMap\";\n hasSurfaces ||= chart.chartType === \"Surface\";\n }\n }\n\n if (hasSharedCharts) void officeChartRenderer.load().catch(() => {});\n if (hasCharts) void chartRenderer.load().catch(() => {});\n if (hasMaps) void regionMapResources.load().catch(() => {});\n if (hasSurfaces) void surfaceRenderer.load().catch(() => {});\n}\n"],"mappings":";;;;;;AAGO,SAAS,eAAkB,UAA0B;AAC1D,QAAM,WAAiB,EAAqB,SAAS,WAAW,SAAS,aAAa,SAAS,iBAAiB;AAChH,EAAM,EAAU,MAAM;AACpB,SAAK,SAAS,KAAK,EAAE,MAAM,MAAM;AAAA,IAAC,CAAC;AAAA,EACrC,GAAG,C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wB,CAAC;AACnF,IAAM,kBAAkB,kBAAkB,MAAM,OAAO,4BAAgB,CAAC;AAExE,SAAS,sBAAsB,eAAkD;AACtF,MAAI,YAAY;AAChB,MAAI,kBAAkB;AACtB,MAAI,UAAU;AACd,MAAI,cAAc;AAClB,aAAW,UAAU,eAAe;AAClC,eAAW,SAAS,QAAQ;AAC1B,0BAAoB,QAAQ,MAAM,YAAY;AAC9C,oBAAc,CAAC,MAAM;AACrB,kBAAY,MAAM,cAAc;AAChC,sBAAgB,MAAM,cAAc;AAAA,IACtC;AAAA,EACF;AAEA,MAAI,gBAAiB,MAAK,oBAAoB,KAAK,EAAE,MAAM,MAAM;AAAA,EAAC,CAAC;AACnE,MAAI,UAAW,MAAK,cAAc,KAAK,EAAE,MAAM,MAAM;AAAA,EAAC,CAAC;AACvD,MAAI,QAAS,MAAK,mBAAmB,KAAK,EAAE,MAAM,MAAM;AAAA,EAAC,CAAC;AAC1D,MAAI,YAAa,MAAK,gBAAgB,KAAK,EAAE,MAAM,MAAM;AAAA,EAAC,CAAC;AAC7D;","names":[]}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// src/chart-interaction.tsx
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
function resolveChartElementTarget(target) {
|
|
5
|
+
if (!(target instanceof Element)) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
return target.closest("[data-xlsx-chart-series-index]");
|
|
9
|
+
}
|
|
10
|
+
function resolveChartSelectionFromTarget(chart, target, selectedChartElement) {
|
|
11
|
+
const element = resolveChartElementTarget(target);
|
|
12
|
+
if (!element) {
|
|
13
|
+
return { chartId: chart.id, kind: "chart" };
|
|
14
|
+
}
|
|
15
|
+
const seriesIndex = Number(element.dataset.xlsxChartSeriesIndex);
|
|
16
|
+
if (!Number.isInteger(seriesIndex) || seriesIndex < 0 || seriesIndex >= chart.series.length) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const series = chart.series[seriesIndex];
|
|
20
|
+
if (!series) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const rawPointIndex = element.dataset.xlsxChartPointIndex;
|
|
24
|
+
const rawElementKind = element.dataset.xlsxChartElementKind;
|
|
25
|
+
const selectionMode = element.dataset.xlsxChartSelectionMode;
|
|
26
|
+
const pointIndex = rawPointIndex == null || rawPointIndex === "" ? null : Number(rawPointIndex);
|
|
27
|
+
const hasPoint = pointIndex != null && Number.isInteger(pointIndex) && pointIndex >= 0;
|
|
28
|
+
const sameSelectedSeries = selectedChartElement?.chartId === chart.id && selectedChartElement.kind !== "chart" && selectedChartElement.seriesIndex === seriesIndex;
|
|
29
|
+
if (hasPoint && (selectionMode !== "seriesFirst" || sameSelectedSeries)) {
|
|
30
|
+
return {
|
|
31
|
+
chartId: chart.id,
|
|
32
|
+
kind: "point",
|
|
33
|
+
pointIndex,
|
|
34
|
+
seriesId: series.id,
|
|
35
|
+
seriesIndex
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
chartId: chart.id,
|
|
40
|
+
kind: rawElementKind === "legendEntry" ? "legendEntry" : "series",
|
|
41
|
+
seriesId: series.id,
|
|
42
|
+
seriesIndex
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function useChartEvents({
|
|
46
|
+
chart,
|
|
47
|
+
onChartElementPointerDown,
|
|
48
|
+
onChartElementDoubleClick,
|
|
49
|
+
selectedChartElement
|
|
50
|
+
}) {
|
|
51
|
+
const handlePointerDown = React.useCallback((event) => {
|
|
52
|
+
const selection = resolveChartSelectionFromTarget(chart, event.target, selectedChartElement);
|
|
53
|
+
if (!selection) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (resolveChartElementTarget(event.target)) {
|
|
57
|
+
event.stopPropagation();
|
|
58
|
+
}
|
|
59
|
+
onChartElementPointerDown?.(selection, event);
|
|
60
|
+
}, [chart, onChartElementPointerDown, selectedChartElement]);
|
|
61
|
+
const handleDoubleClick = React.useCallback((event) => {
|
|
62
|
+
const selection = resolveChartSelectionFromTarget(chart, event.target, selectedChartElement);
|
|
63
|
+
if (!selection) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (resolveChartElementTarget(event.target)) {
|
|
67
|
+
event.stopPropagation();
|
|
68
|
+
}
|
|
69
|
+
onChartElementDoubleClick?.(selection, event);
|
|
70
|
+
}, [chart, onChartElementDoubleClick, selectedChartElement]);
|
|
71
|
+
return { handlePointerDown, handleDoubleClick };
|
|
72
|
+
}
|
|
73
|
+
function renderSelectionRectHandles(key, left, top, width, height, color = "#64748b") {
|
|
74
|
+
return renderSelectionPointHandles(
|
|
75
|
+
key,
|
|
76
|
+
[
|
|
77
|
+
{ x: left, y: top },
|
|
78
|
+
{ x: left + width, y: top },
|
|
79
|
+
{ x: left, y: top + height },
|
|
80
|
+
{ x: left + width, y: top + height }
|
|
81
|
+
],
|
|
82
|
+
color
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
function renderSelectionPointHandles(key, points, color = "#64748b") {
|
|
86
|
+
const radius = 3;
|
|
87
|
+
return /* @__PURE__ */ jsx("g", { pointerEvents: "none", children: points.map((point, index) => /* @__PURE__ */ jsx(
|
|
88
|
+
"circle",
|
|
89
|
+
{
|
|
90
|
+
cx: point.x,
|
|
91
|
+
cy: point.y,
|
|
92
|
+
fill: "#ffffff",
|
|
93
|
+
r: radius,
|
|
94
|
+
stroke: color,
|
|
95
|
+
strokeWidth: 1.1,
|
|
96
|
+
style: { filter: "drop-shadow(0 1px 2px rgba(15, 23, 42, 0.18))" },
|
|
97
|
+
vectorEffect: "non-scaling-stroke"
|
|
98
|
+
},
|
|
99
|
+
`${key}-handle-${index}`
|
|
100
|
+
)) }, key);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export {
|
|
104
|
+
useChartEvents,
|
|
105
|
+
renderSelectionRectHandles,
|
|
106
|
+
renderSelectionPointHandles
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=chunk-A4S3AMON.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/chart-interaction.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { ChartSvgProps } from \"./chart-renderer\";\nimport type { XlsxChart, XlsxChartElementSelection } from \"./types\";\n\nfunction resolveChartElementTarget(target: EventTarget | null) {\n if (!(target instanceof Element)) {\n return null;\n }\n\n return target.closest(\"[data-xlsx-chart-series-index]\") as HTMLElement | SVGElement | null;\n}\n\nfunction resolveChartSelectionFromTarget(\n chart: XlsxChart,\n target: EventTarget | null,\n selectedChartElement: XlsxChartElementSelection | null | undefined\n): XlsxChartElementSelection | null {\n const element = resolveChartElementTarget(target);\n if (!element) {\n return { chartId: chart.id, kind: \"chart\" };\n }\n\n const seriesIndex = Number(element.dataset.xlsxChartSeriesIndex);\n if (!Number.isInteger(seriesIndex) || seriesIndex < 0 || seriesIndex >= chart.series.length) {\n return null;\n }\n\n const series = chart.series[seriesIndex];\n if (!series) {\n return null;\n }\n\n const rawPointIndex = element.dataset.xlsxChartPointIndex;\n const rawElementKind = element.dataset.xlsxChartElementKind;\n const selectionMode = element.dataset.xlsxChartSelectionMode;\n const pointIndex = rawPointIndex == null || rawPointIndex === \"\" ? null : Number(rawPointIndex);\n const hasPoint = pointIndex != null && Number.isInteger(pointIndex) && pointIndex >= 0;\n const sameSelectedSeries = selectedChartElement?.chartId === chart.id\n && selectedChartElement.kind !== \"chart\"\n && selectedChartElement.seriesIndex === seriesIndex;\n if (hasPoint && (selectionMode !== \"seriesFirst\" || sameSelectedSeries)) {\n return {\n chartId: chart.id,\n kind: \"point\",\n pointIndex,\n seriesId: series.id,\n seriesIndex\n };\n }\n\n return {\n chartId: chart.id,\n kind: rawElementKind === \"legendEntry\" ? \"legendEntry\" : \"series\",\n seriesId: series.id,\n seriesIndex\n };\n}\n\nexport function useChartEvents({\n chart, onChartElementPointerDown, onChartElementDoubleClick, selectedChartElement\n}: Pick<ChartSvgProps, \"chart\" | \"onChartElementPointerDown\" | \"onChartElementDoubleClick\" | \"selectedChartElement\">) {\n const handlePointerDown = React.useCallback((event: React.PointerEvent<SVGSVGElement>) => {\n const selection = resolveChartSelectionFromTarget(chart, event.target, selectedChartElement);\n if (!selection) {\n return;\n }\n\n if (resolveChartElementTarget(event.target)) {\n event.stopPropagation();\n }\n onChartElementPointerDown?.(selection, event);\n }, [chart, onChartElementPointerDown, selectedChartElement]);\n const handleDoubleClick = React.useCallback((event: React.MouseEvent<SVGSVGElement>) => {\n const selection = resolveChartSelectionFromTarget(chart, event.target, selectedChartElement);\n if (!selection) {\n return;\n }\n\n if (resolveChartElementTarget(event.target)) {\n event.stopPropagation();\n }\n onChartElementDoubleClick?.(selection, event);\n }, [chart, onChartElementDoubleClick, selectedChartElement]);\n\n return { handlePointerDown, handleDoubleClick };\n}\n\nexport function renderSelectionRectHandles(\n key: string,\n left: number,\n top: number,\n width: number,\n height: number,\n color = \"#64748b\"\n) {\n return renderSelectionPointHandles(\n key,\n [\n { x: left, y: top },\n { x: left + width, y: top },\n { x: left, y: top + height },\n { x: left + width, y: top + height }\n ],\n color\n );\n}\n\nexport function renderSelectionPointHandles(\n key: string,\n points: Array<{ x: number; y: number }>,\n color = \"#64748b\"\n) {\n const radius = 3;\n\n return (\n <g key={key} pointerEvents=\"none\">\n {points.map((point, index) => (\n <circle\n cx={point.x}\n cy={point.y}\n fill=\"#ffffff\"\n key={`${key}-handle-${index}`}\n r={radius}\n stroke={color}\n strokeWidth={1.1}\n style={{ filter: \"drop-shadow(0 1px 2px rgba(15, 23, 42, 0.18))\" }}\n vectorEffect=\"non-scaling-stroke\"\n />\n ))}\n </g>\n );\n}\n"],"mappings":";AAAA,YAAY,WAAW;AAqHf;AAjHR,SAAS,0BAA0B,QAA4B;AAC7D,MAAI,EAAE,kBAAkB,UAAU;AAChC,WAAO;AAAA,EACT;AAEA,SAAO,OAAO,QAAQ,gCAAgC;AACxD;AAEA,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.defineProperty(exports, "__esModule", {value: true});// ../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// ../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.32_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js
|
|
2
2
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
|
|
3
3
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
exports.importMetaUrl = importMetaUrl;
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-AD4CGQN2.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/react-xlsx/react-xlsx/packages/react-xlsx/dist/chunk-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/react-xlsx/react-xlsx/packages/react-xlsx/dist/chunk-AD4CGQN2.cjs","../../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.32_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js"],"names":[],"mappings":"AAAA;ACKA,IAAM,iBAAA,EAAmB,CAAA,EAAA,GACvB,OAAO,SAAA,IAAa,YAAA,EAChB,IAAI,GAAA,CAAI,CAAA,KAAA,EAAQ,UAAU,CAAA,CAAA;AAK8B;ADT4B;AACA;AACA;AACA","file":"/home/runner/work/react-xlsx/react-xlsx/packages/react-xlsx/dist/chunk-AD4CGQN2.cjs","sourcesContent":[null,"// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n"]}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import {
|
|
2
|
+
q,
|
|
3
|
+
u
|
|
4
|
+
} from "./chunk-PUI6QI4U.js";
|
|
5
|
+
|
|
6
|
+
// src/chart-interaction.tsx
|
|
7
|
+
function resolveChartElementTarget(target) {
|
|
8
|
+
if (!(target instanceof Element)) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return target.closest("[data-xlsx-chart-series-index]");
|
|
12
|
+
}
|
|
13
|
+
function resolveChartSelectionFromTarget(chart, target, selectedChartElement) {
|
|
14
|
+
const element = resolveChartElementTarget(target);
|
|
15
|
+
if (!element) {
|
|
16
|
+
return { chartId: chart.id, kind: "chart" };
|
|
17
|
+
}
|
|
18
|
+
const seriesIndex = Number(element.dataset.xlsxChartSeriesIndex);
|
|
19
|
+
if (!Number.isInteger(seriesIndex) || seriesIndex < 0 || seriesIndex >= chart.series.length) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const series = chart.series[seriesIndex];
|
|
23
|
+
if (!series) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const rawPointIndex = element.dataset.xlsxChartPointIndex;
|
|
27
|
+
const rawElementKind = element.dataset.xlsxChartElementKind;
|
|
28
|
+
const selectionMode = element.dataset.xlsxChartSelectionMode;
|
|
29
|
+
const pointIndex = rawPointIndex == null || rawPointIndex === "" ? null : Number(rawPointIndex);
|
|
30
|
+
const hasPoint = pointIndex != null && Number.isInteger(pointIndex) && pointIndex >= 0;
|
|
31
|
+
const sameSelectedSeries = selectedChartElement?.chartId === chart.id && selectedChartElement.kind !== "chart" && selectedChartElement.seriesIndex === seriesIndex;
|
|
32
|
+
if (hasPoint && (selectionMode !== "seriesFirst" || sameSelectedSeries)) {
|
|
33
|
+
return {
|
|
34
|
+
chartId: chart.id,
|
|
35
|
+
kind: "point",
|
|
36
|
+
pointIndex,
|
|
37
|
+
seriesId: series.id,
|
|
38
|
+
seriesIndex
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
chartId: chart.id,
|
|
43
|
+
kind: rawElementKind === "legendEntry" ? "legendEntry" : "series",
|
|
44
|
+
seriesId: series.id,
|
|
45
|
+
seriesIndex
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function useChartEvents({
|
|
49
|
+
chart,
|
|
50
|
+
onChartElementPointerDown,
|
|
51
|
+
onChartElementDoubleClick,
|
|
52
|
+
selectedChartElement
|
|
53
|
+
}) {
|
|
54
|
+
const handlePointerDown = q((event) => {
|
|
55
|
+
const selection = resolveChartSelectionFromTarget(chart, event.target, selectedChartElement);
|
|
56
|
+
if (!selection) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (resolveChartElementTarget(event.target)) {
|
|
60
|
+
event.stopPropagation();
|
|
61
|
+
}
|
|
62
|
+
onChartElementPointerDown?.(selection, event);
|
|
63
|
+
}, [chart, onChartElementPointerDown, selectedChartElement]);
|
|
64
|
+
const handleDoubleClick = q((event) => {
|
|
65
|
+
const selection = resolveChartSelectionFromTarget(chart, event.target, selectedChartElement);
|
|
66
|
+
if (!selection) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (resolveChartElementTarget(event.target)) {
|
|
70
|
+
event.stopPropagation();
|
|
71
|
+
}
|
|
72
|
+
onChartElementDoubleClick?.(selection, event);
|
|
73
|
+
}, [chart, onChartElementDoubleClick, selectedChartElement]);
|
|
74
|
+
return { handlePointerDown, handleDoubleClick };
|
|
75
|
+
}
|
|
76
|
+
function renderSelectionRectHandles(key, left, top, width, height, color = "#64748b") {
|
|
77
|
+
return renderSelectionPointHandles(
|
|
78
|
+
key,
|
|
79
|
+
[
|
|
80
|
+
{ x: left, y: top },
|
|
81
|
+
{ x: left + width, y: top },
|
|
82
|
+
{ x: left, y: top + height },
|
|
83
|
+
{ x: left + width, y: top + height }
|
|
84
|
+
],
|
|
85
|
+
color
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
function renderSelectionPointHandles(key, points, color = "#64748b") {
|
|
89
|
+
const radius = 3;
|
|
90
|
+
return /* @__PURE__ */ u("g", { pointerEvents: "none", children: points.map((point, index) => /* @__PURE__ */ u(
|
|
91
|
+
"circle",
|
|
92
|
+
{
|
|
93
|
+
cx: point.x,
|
|
94
|
+
cy: point.y,
|
|
95
|
+
fill: "#ffffff",
|
|
96
|
+
r: radius,
|
|
97
|
+
stroke: color,
|
|
98
|
+
strokeWidth: 1.1,
|
|
99
|
+
style: { filter: "drop-shadow(0 1px 2px rgba(15, 23, 42, 0.18))" },
|
|
100
|
+
vectorEffect: "non-scaling-stroke"
|
|
101
|
+
},
|
|
102
|
+
`${key}-handle-${index}`
|
|
103
|
+
)) }, key);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export {
|
|
107
|
+
useChartEvents,
|
|
108
|
+
renderSelectionRectHandles,
|
|
109
|
+
renderSelectionPointHandles
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=chunk-AJT23BDP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/chart-interaction.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { ChartSvgProps } from \"./chart-renderer\";\nimport type { XlsxChart, XlsxChartElementSelection } from \"./types\";\n\nfunction resolveChartElementTarget(target: EventTarget | null) {\n if (!(target instanceof Element)) {\n return null;\n }\n\n return target.closest(\"[data-xlsx-chart-series-index]\") as HTMLElement | SVGElement | null;\n}\n\nfunction resolveChartSelectionFromTarget(\n chart: XlsxChart,\n target: EventTarget | null,\n selectedChartElement: XlsxChartElementSelection | null | undefined\n): XlsxChartElementSelection | null {\n const element = resolveChartElementTarget(target);\n if (!element) {\n return { chartId: chart.id, kind: \"chart\" };\n }\n\n const seriesIndex = Number(element.dataset.xlsxChartSeriesIndex);\n if (!Number.isInteger(seriesIndex) || seriesIndex < 0 || seriesIndex >= chart.series.length) {\n return null;\n }\n\n const series = chart.series[seriesIndex];\n if (!series) {\n return null;\n }\n\n const rawPointIndex = element.dataset.xlsxChartPointIndex;\n const rawElementKind = element.dataset.xlsxChartElementKind;\n const selectionMode = element.dataset.xlsxChartSelectionMode;\n const pointIndex = rawPointIndex == null || rawPointIndex === \"\" ? null : Number(rawPointIndex);\n const hasPoint = pointIndex != null && Number.isInteger(pointIndex) && pointIndex >= 0;\n const sameSelectedSeries = selectedChartElement?.chartId === chart.id\n && selectedChartElement.kind !== \"chart\"\n && selectedChartElement.seriesIndex === seriesIndex;\n if (hasPoint && (selectionMode !== \"seriesFirst\" || sameSelectedSeries)) {\n return {\n chartId: chart.id,\n kind: \"point\",\n pointIndex,\n seriesId: series.id,\n seriesIndex\n };\n }\n\n return {\n chartId: chart.id,\n kind: rawElementKind === \"legendEntry\" ? \"legendEntry\" : \"series\",\n seriesId: series.id,\n seriesIndex\n };\n}\n\nexport function useChartEvents({\n chart, onChartElementPointerDown, onChartElementDoubleClick, selectedChartElement\n}: Pick<ChartSvgProps, \"chart\" | \"onChartElementPointerDown\" | \"onChartElementDoubleClick\" | \"selectedChartElement\">) {\n const handlePointerDown = React.useCallback((event: React.PointerEvent<SVGSVGElement>) => {\n const selection = resolveChartSelectionFromTarget(chart, event.target, selectedChartElement);\n if (!selection) {\n return;\n }\n\n if (resolveChartElementTarget(event.target)) {\n event.stopPropagation();\n }\n onChartElementPointerDown?.(selection, event);\n }, [chart, onChartElementPointerDown, selectedChartElement]);\n const handleDoubleClick = React.useCallback((event: React.MouseEvent<SVGSVGElement>) => {\n const selection = resolveChartSelectionFromTarget(chart, event.target, selectedChartElement);\n if (!selection) {\n return;\n }\n\n if (resolveChartElementTarget(event.target)) {\n event.stopPropagation();\n }\n onChartElementDoubleClick?.(selection, event);\n }, [chart, onChartElementDoubleClick, selectedChartElement]);\n\n return { handlePointerDown, handleDoubleClick };\n}\n\nexport function renderSelectionRectHandles(\n key: string,\n left: number,\n top: number,\n width: number,\n height: number,\n color = \"#64748b\"\n) {\n return renderSelectionPointHandles(\n key,\n [\n { x: left, y: top },\n { x: left + width, y: top },\n { x: left, y: top + height },\n { x: left + width, y: top + height }\n ],\n color\n );\n}\n\nexport function renderSelectionPointHandles(\n key: string,\n points: Array<{ x: number; y: number }>,\n color = \"#64748b\"\n) {\n const radius = 3;\n\n return (\n <g key={key} pointerEvents=\"none\">\n {points.map((point, index) => (\n <circle\n cx={point.x}\n cy={point.y}\n fill=\"#ffffff\"\n key={`${key}-handle-${index}`}\n r={radius}\n stroke={color}\n strokeWidth={1.1}\n style={{ filter: \"drop-shadow(0 1px 2px rgba(15, 23, 42, 0.18))\" }}\n vectorEffect=\"non-scaling-stroke\"\n />\n ))}\n </g>\n );\n}\n"],"mappings":";;;;;;AAIA,SAAS,0BAA0B,QAA4B;AAC7D,MAAI,EAAE,kBAAkB,UAAU;AAChC,WAAO;AAAA,EACT;AAEA,SAAO,OAAO,QAAQ,gCAAgC;AACxD;AAEA,SAAS,gCACP,OACA,QACA,sBACkC;AAClC,QAAM,UAAU,0BAA0B,MAAM;AAChD,MAAI,CAAC,SAAS;AACZ,WAAO,EAAE,SAAS,MAAM,IAAI,MAAM,QAAQ;AAAA,EAC5C;AAEA,QAAM,cAAc,OAAO,QAAQ,QAAQ,oBAAoB;AAC/D,MAAI,CAAC,OAAO,UAAU,WAAW,KAAK,cAAc,KAAK,eAAe,MAAM,OAAO,QAAQ;AAC3F,WAAO;AAAA,EACT;AAEA,QAAM,SAAS,MAAM,OAAO,WAAW;AACvC,MAAI,CAAC,QAAQ;AACX,WAAO;AAAA,EACT;AAEA,QAAM,gBAAgB,QAAQ,QAAQ;AACtC,QAAM,iBAAiB,QAAQ,QAAQ;AACvC,QAAM,gBAAgB,QAAQ,QAAQ;AACtC,QAAM,aAAa,iBAAiB,QAAQ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ACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,EAAE,GAAG,MAAM,GAAG,IAAI;AAAA,MAClB,EAAE,GAAG,OAAO,OAAO,GAAG,IAAI;AAAA,MAC1B,EAAE,GAAG,MAAM,GAAG,MAAM,OAAO;AAAA,MAC3B,EAAE,GAAG,OAAO,OAAO,GAAG,MAAM,OAAO;AAAA,IACrC;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,4BACd,KACA,QACA,QAAQ,WACR;AACA,QAAM,SAAS;AAEf,SACE,kBAAC,OAAY,eAAc,QACxB,iBAAO,IAAI,CAAC,OAAO,UAClB;AAAA,IAAC;AAAA;AAAA,MACC,IAAI,MAAM;AAAA,MACV,IAAI,MAAM;AAAA,MACV,MAAK;AAAA,MAEL,GAAG;AAAA,MACH,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,OAAO,EAAE,QAAQ,gDAAgD;AAAA,MACjE,cAAa;AAAA;AAAA,IALR,GAAG,GAAG,WAAW,KAAK;AAAA,EAM7B,CACD,KAbK,GAcR;AAEJ;","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// ../../node_modules/.pnpm/preact@10.29.8/node_modules/preact/dist/preact.mjs
|
|
2
2
|
var n;
|
|
3
3
|
var l;
|
|
4
4
|
var u;
|
|
@@ -364,6 +364,15 @@ function x2(n2) {
|
|
|
364
364
|
var u4 = r2.context[n2.__c], i3 = s2(t2++, 9);
|
|
365
365
|
return i3.c = n2, u4 ? (null == i3.__ && (i3.__ = true, u4.sub(r2)), u4.props.value) : n2.__;
|
|
366
366
|
}
|
|
367
|
+
function g2() {
|
|
368
|
+
var n2 = s2(t2++, 11);
|
|
369
|
+
if (!n2.__) {
|
|
370
|
+
for (var u4 = r2.__v; null !== u4 && !u4.__m && null !== u4.__; ) u4 = u4.__;
|
|
371
|
+
var i3 = u4.__m || (u4.__m = [0, 0]);
|
|
372
|
+
n2.__ = "P" + i3[0] + "-" + i3[1]++;
|
|
373
|
+
}
|
|
374
|
+
return n2.__;
|
|
375
|
+
}
|
|
367
376
|
function j2() {
|
|
368
377
|
for (var n2; n2 = f2.shift(); ) {
|
|
369
378
|
var t3 = n2.__H;
|
|
@@ -688,93 +697,6 @@ var bn = function(n2, t3) {
|
|
|
688
697
|
}
|
|
689
698
|
};
|
|
690
699
|
|
|
691
|
-
// src/builtin-chart-styles.ts
|
|
692
|
-
function decodeSrgb(channel) {
|
|
693
|
-
return channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;
|
|
694
|
-
}
|
|
695
|
-
function encodeSrgb(channel) {
|
|
696
|
-
return channel <= 31308e-7 ? channel * 12.92 : 1.055 * channel ** (1 / 2.4) - 0.055;
|
|
697
|
-
}
|
|
698
|
-
function quantizeLinear(channel) {
|
|
699
|
-
return Math.round(channel * 1e5) / 1e5;
|
|
700
|
-
}
|
|
701
|
-
function resolveBuiltinChartColor(color, colorsByIndex) {
|
|
702
|
-
if (!color) return void 0;
|
|
703
|
-
const hex = _optionalChain([colorsByIndex, 'access', _4 => _4[color.themeIndex], 'optionalAccess', _5 => _5.replace, 'call', _6 => _6(/^#/, "")]);
|
|
704
|
-
if (!hex || !/^[\da-f]{6}$/i.test(hex)) return void 0;
|
|
705
|
-
if (color.transforms.length === 0) return `#${hex.toLowerCase()}`;
|
|
706
|
-
const channels = [0, 2, 4].map((offset) => Math.fround(quantizeLinear(decodeSrgb(Number.parseInt(hex.slice(offset, offset + 2), 16) / 255))));
|
|
707
|
-
for (const transform of color.transforms) {
|
|
708
|
-
const amount = Math.fround(Math.max(0, Math.min(1, transform.value)));
|
|
709
|
-
for (let index = 0; index < channels.length; index += 1) {
|
|
710
|
-
const channel = channels[index];
|
|
711
|
-
channels[index] = transform.type === "tint" ? Math.fround(Math.fround(1 - amount) + Math.fround(amount * channel)) : Math.fround(amount * channel);
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
return `#${channels.map((channel) => Math.round(encodeSrgb(quantizeLinear(channel)) * 255).toString(16).padStart(2, "0")).join("")}`;
|
|
715
|
-
}
|
|
716
|
-
var GRAYSCALE_TINTS = [88, 55, 78, 92, 70, 30];
|
|
717
|
-
var DARK_GRAYSCALE_TINTS = [5, 55, 78, 15, 70, 30];
|
|
718
|
-
function normalizeClassicStyle(styleId) {
|
|
719
|
-
if (styleId === void 0 || !Number.isInteger(styleId)) return void 0;
|
|
720
|
-
if (styleId >= 1 && styleId <= 48) return styleId;
|
|
721
|
-
if (styleId >= 101 && styleId <= 148) return styleId - 100;
|
|
722
|
-
return void 0;
|
|
723
|
-
}
|
|
724
|
-
function themeColor(themeIndex, tint) {
|
|
725
|
-
return {
|
|
726
|
-
themeIndex,
|
|
727
|
-
transforms: tint === void 0 ? [] : [{ type: "tint", value: tint / 100 }]
|
|
728
|
-
};
|
|
729
|
-
}
|
|
730
|
-
function appendBrightness(color, percent) {
|
|
731
|
-
if (percent > 0) color.transforms.push({ type: "tint", value: (100 - percent) / 100 });
|
|
732
|
-
if (percent < 0) color.transforms.push({ type: "shade", value: (100 + percent) / 100 });
|
|
733
|
-
return color;
|
|
734
|
-
}
|
|
735
|
-
function getBuiltinChartColor(styleId, index, count) {
|
|
736
|
-
const style = normalizeClassicStyle(styleId);
|
|
737
|
-
if (style === void 0 || !Number.isInteger(index) || index < 0 || !Number.isInteger(count) || count < 1) {
|
|
738
|
-
return void 0;
|
|
739
|
-
}
|
|
740
|
-
const palette = style === 41 ? 9 : (style - 1) % 8 + 1;
|
|
741
|
-
const monochrome = palette >= 3 && palette <= 8;
|
|
742
|
-
const color = monochrome ? themeColor(palette + 1) : palette === 2 ? themeColor(4 + index % 6) : themeColor(1, (palette === 9 ? DARK_GRAYSCALE_TINTS : GRAYSCALE_TINTS)[index % 6]);
|
|
743
|
-
const numerator = 140 * (monochrome ? index + 1 : Math.floor(index / 6) + 1);
|
|
744
|
-
const denominator = monochrome ? count + 1 : Math.floor(count / 6) + 2;
|
|
745
|
-
const brightness = (Math.trunc(Math.fround(Math.fround(numerator) / Math.fround(denominator))) - 70) % 100;
|
|
746
|
-
return appendBrightness(color, brightness);
|
|
747
|
-
}
|
|
748
|
-
function getBuiltinChartSurfaceStyle(styleId) {
|
|
749
|
-
const style = normalizeClassicStyle(styleId);
|
|
750
|
-
if (style === void 0) return void 0;
|
|
751
|
-
let fill = null;
|
|
752
|
-
if (style === 33 || style === 34) fill = themeColor(1, 20);
|
|
753
|
-
if (style >= 35 && style <= 40) fill = themeColor(style - 31, (_nullishCoalesce(styleId, () => ( 0))) >= 100 ? 20 : void 0);
|
|
754
|
-
if (style >= 41) fill = themeColor(1, 95);
|
|
755
|
-
return {
|
|
756
|
-
floor: { fill, line: style <= 40 ? themeColor(1, 75) : null },
|
|
757
|
-
wall: { fill, line: null },
|
|
758
|
-
majorGridline: themeColor(1, (_nullishCoalesce(styleId, () => ( 0))) >= 100 ? 75 : void 0),
|
|
759
|
-
minorGridline: themeColor(1, style >= 41 ? 90 : 50)
|
|
760
|
-
};
|
|
761
|
-
}
|
|
762
|
-
function getBuiltinChartSurfaceLine(styleId, index, count) {
|
|
763
|
-
const style = normalizeClassicStyle(styleId);
|
|
764
|
-
if (style === void 0 || !Number.isInteger(index) || index < 0 || !Number.isInteger(count) || count < 1) {
|
|
765
|
-
return void 0;
|
|
766
|
-
}
|
|
767
|
-
if (style >= 9 && style <= 16) return themeColor(2);
|
|
768
|
-
if (styleId === 133) return themeColor(1, 92);
|
|
769
|
-
if (style === 33 || style >= 35 && style <= 40) {
|
|
770
|
-
return {
|
|
771
|
-
themeIndex: style === 33 ? 1 : style - 31,
|
|
772
|
-
transforms: [{ type: "shade", value: 0.5 }]
|
|
773
|
-
};
|
|
774
|
-
}
|
|
775
|
-
return void 0;
|
|
776
|
-
}
|
|
777
|
-
|
|
778
700
|
// ../../node_modules/.pnpm/preact@10.29.8/node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs
|
|
779
701
|
var f3 = 0;
|
|
780
702
|
function u3(e3, t3, n2, o3, i3, u4) {
|
|
@@ -809,8 +731,5 @@ function u3(e3, t3, n2, o3, i3, u4) {
|
|
|
809
731
|
|
|
810
732
|
|
|
811
733
|
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
exports.k = k; exports.S = S; exports.C = C; exports.X = X; exports.d = d2; exports.y = y2; exports.h = h2; exports._ = _2; exports.A = A2; exports.T = T2; exports.q = q2; exports.x = x2; exports.C2 = C3; exports.w = w3; exports.k2 = k3; exports.N = N2; exports.$ = $2; exports.nn = nn; exports.pn = pn; exports.bn = bn; exports.resolveBuiltinChartColor = resolveBuiltinChartColor; exports.getBuiltinChartColor = getBuiltinChartColor; exports.getBuiltinChartSurfaceStyle = getBuiltinChartSurfaceStyle; exports.getBuiltinChartSurfaceLine = getBuiltinChartSurfaceLine; exports.u = u3;
|
|
816
|
-
//# sourceMappingURL=chunk-CJBI5F6V.cjs.map
|
|
734
|
+
exports.k = k; exports.S = S; exports.C = C; exports.X = X; exports.d = d2; exports.y = y2; exports.h = h2; exports._ = _2; exports.A = A2; exports.T = T2; exports.q = q2; exports.x = x2; exports.g = g2; exports.C2 = C3; exports.w = w3; exports.k2 = k3; exports.N = N2; exports.$ = $2; exports.nn = nn; exports.pn = pn; exports.bn = bn; exports.u = u3;
|
|
735
|
+
//# sourceMappingURL=chunk-AZWBTFJI.cjs.map
|