@automattic/charts 4.13.0 → 4.15.0
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/CHANGELOG.md +34 -29
- package/TOKENS.md +4 -1
- package/dist/index.cjs +1069 -1620
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +33 -1
- package/dist/index.d.cts +60 -15
- package/dist/index.d.ts +60 -15
- package/dist/index.js +1072 -1575
- package/dist/index.js.map +1 -1
- package/package.json +11 -10
- package/src/charts/area-chart/area-chart.tsx +29 -20
- package/src/charts/area-chart/types.ts +3 -1
- package/src/charts/bar-chart/bar-chart.module.scss +38 -0
- package/src/charts/bar-chart/bar-chart.tsx +159 -56
- package/src/charts/bar-chart/private/band-tooltip.tsx +40 -5
- package/src/charts/bar-chart/private/bar-layer.tsx +66 -13
- package/src/charts/bar-chart/private/category.ts +25 -0
- package/src/charts/bar-chart/private/comparison-bars-geometry.ts +13 -1
- package/src/charts/bar-chart/private/index.ts +3 -1
- package/src/charts/bar-chart/private/selected-bar-ring.tsx +17 -6
- package/src/charts/bar-chart/private/stack-layout.ts +99 -0
- package/src/charts/bar-chart/private/stacked-bar-series.tsx +145 -0
- package/src/charts/bar-chart/private/test/stack-layout.test.ts +81 -0
- package/src/charts/bar-chart/private/test/value-domain.test.ts +10 -0
- package/src/charts/bar-chart/private/use-bar-chart-options.ts +35 -11
- package/src/charts/bar-chart/private/{use-overlap-slots.ts → use-bar-slots.ts} +36 -38
- package/src/charts/bar-chart/private/use-bar-stops.ts +19 -19
- package/src/charts/bar-chart/private/value-domain.ts +10 -8
- package/src/charts/bar-chart/test/bar-chart-stacked.test.tsx +546 -0
- package/src/charts/bar-chart/test/bar-chart.test.tsx +75 -0
- package/src/charts/bar-chart/test/use-bar-legend-items.test.tsx +18 -0
- package/src/charts/bar-chart/types.ts +3 -1
- package/src/charts/bar-chart/use-bar-colors.ts +12 -0
- package/src/charts/bar-chart/use-bar-legend-items.ts +4 -2
- package/src/charts/bar-list-chart/bar-list-chart.tsx +2 -0
- package/src/charts/leaderboard-chart/leaderboard-chart.module.scss +1 -1
- package/src/charts/leaderboard-chart/leaderboard-chart.tsx +26 -9
- package/src/charts/leaderboard-chart/private/resolve-leaderboard-entries.ts +53 -0
- package/src/charts/leaderboard-chart/test/leaderboard-chart.test.tsx +41 -0
- package/src/charts/leaderboard-chart/test/resolve-leaderboard-entries.test.ts +146 -0
- package/src/charts/leaderboard-chart/types.ts +6 -0
- package/src/charts/line-chart/line-chart.tsx +55 -26
- package/src/charts/line-chart/test/line-chart.test.tsx +86 -0
- package/src/charts/line-chart/types.ts +3 -1
- package/src/charts/private/test/compact-when-short.test.tsx +170 -0
- package/src/charts/private/test/tick-decimals.test.tsx +95 -0
- package/src/charts/private/tick-decimals.tsx +132 -0
- package/src/charts/private/use-compact-when-short.ts +18 -0
- package/src/components/legend/private/base-legend.tsx +13 -8
- package/src/components/legend/test/legend.test.tsx +125 -0
- package/src/components/legend/types.ts +9 -1
- package/src/providers/chart-context/themes.ts +4 -0
- package/src/styles/chart-scope.scss +1 -0
- package/src/types.ts +40 -9
- package/src/charts/private/test/whole-number-ticks.test.tsx +0 -57
- package/src/charts/private/whole-number-ticks.tsx +0 -79
package/dist/index.js
CHANGED
|
@@ -3,8 +3,7 @@ import { formatNumber, formatNumberCompact } from "@automattic/number-formatters
|
|
|
3
3
|
import { AnimatedAreaSeries, AnimatedAreaStack, AreaSeries, Axis, BarGroup, BarSeries, DataContext, GlyphSeries, Grid, TooltipContext, XYChart, buildChartTheme, useEventEmitter } from "@visx/xychart";
|
|
4
4
|
import { __, _n, _x, sprintf } from "@wordpress/i18n";
|
|
5
5
|
import clsx from "clsx";
|
|
6
|
-
import
|
|
7
|
-
import { Children, Fragment, createContext, createContext as createContext$1, createElement, forwardRef, forwardRef as forwardRef$1, isValidElement, memo, useCallback, useCallback as useCallback$1, useContext, useContext as useContext$1, useEffect, useEffect as useEffect$1, useId, useImperativeHandle, useLayoutEffect, useMemo, useMemo as useMemo$1, useRef, useRef as useRef$1, useState, useState as useState$1, version } from "react";
|
|
6
|
+
import { Children, Fragment, createContext, createContext as createContext$1, createElement, forwardRef, forwardRef as forwardRef$1, isValidElement, memo, useCallback, useContext, useContext as useContext$1, useEffect, useEffect as useEffect$1, useId, useImperativeHandle, useLayoutEffect, useMemo, useMemo as useMemo$1, useRef, useRef as useRef$1, useState, useState as useState$1, version } from "react";
|
|
8
7
|
import { differenceInHours, differenceInYears, isValid, parse, parseISO } from "date-fns";
|
|
9
8
|
import { tzOffset } from "@date-fns/tz";
|
|
10
9
|
import { Text, getStringWidth } from "@visx/text";
|
|
@@ -27,7 +26,6 @@ import { PatternCircles, PatternHexagons, PatternLines, PatternWaves } from "@vi
|
|
|
27
26
|
import { Chart } from "react-google-charts";
|
|
28
27
|
import DOMPurify from "dompurify";
|
|
29
28
|
import { __assign } from "tslib";
|
|
30
|
-
import "@babel/runtime/helpers/esm/extends";
|
|
31
29
|
import { Icon, chevronRight } from "@wordpress/icons";
|
|
32
30
|
import { arc, pie } from "@visx/shape";
|
|
33
31
|
// \0rolldown/runtime.js
|
|
@@ -1283,6 +1281,15 @@ const defaultTheme = {
|
|
|
1283
1281
|
},
|
|
1284
1282
|
strokeWidth: 1.5
|
|
1285
1283
|
},
|
|
1284
|
+
compactWhenShort: {
|
|
1285
|
+
below: 140,
|
|
1286
|
+
margin: {
|
|
1287
|
+
top: 2,
|
|
1288
|
+
right: 2,
|
|
1289
|
+
bottom: 2,
|
|
1290
|
+
left: 2
|
|
1291
|
+
}
|
|
1292
|
+
},
|
|
1286
1293
|
heatmapChart: {
|
|
1287
1294
|
compactCellGap: 2,
|
|
1288
1295
|
compactCellSize: 11,
|
|
@@ -2125,16 +2132,17 @@ const BaseLegend = forwardRef(({ items: allItems, className, orientation = "hori
|
|
|
2125
2132
|
chartId,
|
|
2126
2133
|
context
|
|
2127
2134
|
]);
|
|
2128
|
-
const createClickHandler = useCallback((seriesLabels, itemInteractive) => {
|
|
2135
|
+
const createClickHandler = useCallback((seriesLabels, itemInteractive, onToggle) => {
|
|
2129
2136
|
if (!itemInteractive) return;
|
|
2130
|
-
return () => handleLegendClick(seriesLabels);
|
|
2137
|
+
return onToggle ? () => onToggle() : () => handleLegendClick(seriesLabels);
|
|
2131
2138
|
}, [handleLegendClick]);
|
|
2132
|
-
const createKeyDownHandler = useCallback((seriesLabels, itemInteractive) => {
|
|
2139
|
+
const createKeyDownHandler = useCallback((seriesLabels, itemInteractive, onToggle) => {
|
|
2133
2140
|
if (!itemInteractive) return;
|
|
2141
|
+
const toggle = onToggle ?? (() => handleLegendClick(seriesLabels));
|
|
2134
2142
|
return (event) => {
|
|
2135
2143
|
if (event.key === "Enter" || event.key === " ") {
|
|
2136
2144
|
event.preventDefault();
|
|
2137
|
-
|
|
2145
|
+
if (!event.repeat) toggle();
|
|
2138
2146
|
}
|
|
2139
2147
|
};
|
|
2140
2148
|
}, [handleLegendClick]);
|
|
@@ -2158,10 +2166,11 @@ const BaseLegend = forwardRef(({ items: allItems, className, orientation = "hori
|
|
|
2158
2166
|
children: labels.map((label, i) => {
|
|
2159
2167
|
const matchedItem = items[i];
|
|
2160
2168
|
const seriesLabels = matchedItem?.seriesLabels?.length ? matchedItem.seriesLabels : [label.text];
|
|
2161
|
-
const visible = matchedItem?.interactive === false || isSeriesVisible(seriesLabels[0]);
|
|
2162
2169
|
const itemInteractive = interactive && matchedItem?.interactive !== false;
|
|
2163
|
-
const
|
|
2164
|
-
const
|
|
2170
|
+
const onToggle = itemInteractive ? matchedItem?.onToggle : void 0;
|
|
2171
|
+
const visible = matchedItem?.onToggle ? matchedItem.pressed : matchedItem?.interactive === false || isSeriesVisible(seriesLabels[0]);
|
|
2172
|
+
const handleClick = createClickHandler(seriesLabels, itemInteractive, onToggle);
|
|
2173
|
+
const handleKeyDown = createKeyDownHandler(seriesLabels, itemInteractive, onToggle);
|
|
2165
2174
|
return /* @__PURE__ */ jsxs(LegendItem, {
|
|
2166
2175
|
className: clsx("visx-legend-item", base_legend_module_default["legend-item"], itemInteractive && base_legend_module_default["legend-item--interactive"], !visible && base_legend_module_default["legend-item--inactive"], itemClassName),
|
|
2167
2176
|
margin: itemMargin,
|
|
@@ -3556,6 +3565,89 @@ const getAllHiddenMessage = (interactive, itemType) => {
|
|
|
3556
3565
|
if (interactive) return _x("All series are hidden. Click legend items to show data.", "chart empty state: interactive series", "jetpack-charts");
|
|
3557
3566
|
return _x("All series are hidden.", "chart empty state: series", "jetpack-charts");
|
|
3558
3567
|
};
|
|
3568
|
+
// src/charts/private/tick-decimals.tsx
|
|
3569
|
+
/**
|
|
3570
|
+
* Whether every reading in the series is a whole number.
|
|
3571
|
+
*
|
|
3572
|
+
* @param series - The series visx renders.
|
|
3573
|
+
* @return True when at least one reading exists and none has a fraction.
|
|
3574
|
+
*/
|
|
3575
|
+
const hasOnlyWholeNumbers = (series) => {
|
|
3576
|
+
let sawReading = false;
|
|
3577
|
+
for (const { data } of series) for (const point of data) {
|
|
3578
|
+
const value = point?.value;
|
|
3579
|
+
if (!isReading(value)) continue;
|
|
3580
|
+
if (!Number.isInteger(value)) return false;
|
|
3581
|
+
sawReading = true;
|
|
3582
|
+
}
|
|
3583
|
+
return sawReading;
|
|
3584
|
+
};
|
|
3585
|
+
const EPSILON = 1e-12;
|
|
3586
|
+
const tolerance = (scaled) => EPSILON * Math.max(1, Math.abs(scaled));
|
|
3587
|
+
const isValidDecimals = (decimals) => Number.isInteger(decimals) && decimals >= 0;
|
|
3588
|
+
const isOnDecimals = (value, decimals) => {
|
|
3589
|
+
const scaled = value * 10 ** decimals;
|
|
3590
|
+
return Math.abs(scaled - Math.round(scaled)) < tolerance(scaled);
|
|
3591
|
+
};
|
|
3592
|
+
/**
|
|
3593
|
+
* The scale's ticks with those finer than `decimals` places dropped.
|
|
3594
|
+
*
|
|
3595
|
+
* d3 steps by 1, 2 or 5 times a power of ten, so every multiple of 10^-decimals inside the domain is one of its ticks.
|
|
3596
|
+
*
|
|
3597
|
+
* @param scale - The value scale visx built.
|
|
3598
|
+
* @param count - Ticks to ask the scale for; undefined uses the scale's own default, as visx does.
|
|
3599
|
+
* @param decimals - Decimal places a tick may carry; 0 keeps whole numbers.
|
|
3600
|
+
* @return The kept ticks, or undefined when visx's own ticks need no change.
|
|
3601
|
+
*/
|
|
3602
|
+
const getTickDecimalValues = (scale, count, decimals = 0) => {
|
|
3603
|
+
const ticks = scale?.ticks?.(count);
|
|
3604
|
+
if (!ticks?.every((tick) => typeof tick === "number")) return;
|
|
3605
|
+
const kept = ticks.filter((tick) => isOnDecimals(tick, decimals));
|
|
3606
|
+
return kept.length > 1 && kept.length < ticks.length ? kept : void 0;
|
|
3607
|
+
};
|
|
3608
|
+
/**
|
|
3609
|
+
* A value domain widened to the nearest `decimals` steps when fewer than two fit inside it, so the axis shows at least two ticks.
|
|
3610
|
+
*
|
|
3611
|
+
* @param domain - The domain the chart would scale to.
|
|
3612
|
+
* @param decimals - The axis's `tickDecimals`.
|
|
3613
|
+
* @return The widened domain, or undefined when `domain` needs no change.
|
|
3614
|
+
*/
|
|
3615
|
+
const getTickDecimalsDomain = (domain, decimals) => {
|
|
3616
|
+
if (!domain || !isValidDecimals(decimals)) return;
|
|
3617
|
+
const scale = 10 ** decimals;
|
|
3618
|
+
const low = domain[0] * scale;
|
|
3619
|
+
const high = domain[1] * scale;
|
|
3620
|
+
if (Math.floor(high + tolerance(high)) - Math.ceil(low - tolerance(low)) >= 1) return;
|
|
3621
|
+
const floor = Math.floor(low + tolerance(low));
|
|
3622
|
+
const ceil = Math.max(Math.ceil(high - tolerance(high)), floor + 1);
|
|
3623
|
+
return [floor / scale, ceil / scale];
|
|
3624
|
+
};
|
|
3625
|
+
/**
|
|
3626
|
+
* The decimals a value axis's ticks are held to: 0 for whole-number data, else the caller's `tickDecimals`.
|
|
3627
|
+
*
|
|
3628
|
+
* @param hasWholeNumberValues - Whether every plotted value is a whole number.
|
|
3629
|
+
* @param tickDecimals - The axis's `tickDecimals`.
|
|
3630
|
+
* @return Decimal places, or undefined to keep visx's ticks.
|
|
3631
|
+
*/
|
|
3632
|
+
const getTickDecimals = (hasWholeNumberValues, tickDecimals) => {
|
|
3633
|
+
if (hasWholeNumberValues) return 0;
|
|
3634
|
+
return isValidDecimals(tickDecimals) ? tickDecimals : void 0;
|
|
3635
|
+
};
|
|
3636
|
+
/**
|
|
3637
|
+
* Hands its children the chart's value-scale ticks, held to `decimals` places.
|
|
3638
|
+
*
|
|
3639
|
+
* @param props - Component props.
|
|
3640
|
+
* @param props.axis - Which scale carries the values.
|
|
3641
|
+
* @param props.numTicks - Ticks to ask the scale for.
|
|
3642
|
+
* @param props.decimals - Decimal places a tick may carry, or undefined to keep visx's ticks.
|
|
3643
|
+
* @param props.children - Renders the axis and grid with the tick values.
|
|
3644
|
+
* @return The rendered children.
|
|
3645
|
+
*/
|
|
3646
|
+
const TickDecimals = ({ axis, numTicks, decimals, children }) => {
|
|
3647
|
+
const { xScale, yScale } = useContext(DataContext);
|
|
3648
|
+
const tickValues = decimals === void 0 ? void 0 : getTickDecimalValues(axis === "x" ? xScale : yScale, numTicks, decimals);
|
|
3649
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: children(tickValues) });
|
|
3650
|
+
};
|
|
3559
3651
|
// src/charts/private/time-axis.ts
|
|
3560
3652
|
const X_TICK_WIDTH = 60;
|
|
3561
3653
|
const getCurveType = (type, smoothing) => {
|
|
@@ -3848,52 +3940,24 @@ const buildTimeAxisOptions = ({ dataSorted, width, axisOptions, scaleDomain, zoo
|
|
|
3848
3940
|
...numTicks === void 0 ? {} : { numTicks }
|
|
3849
3941
|
};
|
|
3850
3942
|
};
|
|
3851
|
-
// src/charts/private/
|
|
3852
|
-
/**
|
|
3853
|
-
* Whether every reading in the series is a whole number.
|
|
3854
|
-
*
|
|
3855
|
-
* @param series - The series visx renders.
|
|
3856
|
-
* @return True when at least one reading exists and none has a fraction.
|
|
3857
|
-
*/
|
|
3858
|
-
const hasOnlyWholeNumbers = (series) => {
|
|
3859
|
-
let sawReading = false;
|
|
3860
|
-
for (const { data } of series) for (const point of data) {
|
|
3861
|
-
const value = point?.value;
|
|
3862
|
-
if (!isReading(value)) continue;
|
|
3863
|
-
if (!Number.isInteger(value)) return false;
|
|
3864
|
-
sawReading = true;
|
|
3865
|
-
}
|
|
3866
|
-
return sawReading;
|
|
3867
|
-
};
|
|
3943
|
+
// src/charts/private/use-compact-when-short.ts
|
|
3868
3944
|
/**
|
|
3869
|
-
*
|
|
3945
|
+
* Whether a `compactWhenShort` chart is compact, and the margin it then defaults to.
|
|
3870
3946
|
*
|
|
3871
|
-
*
|
|
3872
|
-
*
|
|
3873
|
-
* @param scale - The value scale visx built.
|
|
3874
|
-
* @param count - Ticks to ask the scale for; undefined uses the scale's own default, as visx does.
|
|
3875
|
-
* @return Whole-number ticks, or undefined when visx's own ticks need no change.
|
|
3876
|
-
*/
|
|
3877
|
-
const getWholeNumberTickValues = (scale, count) => {
|
|
3878
|
-
const ticks = scale?.ticks?.(count);
|
|
3879
|
-
if (!ticks?.every((tick) => typeof tick === "number")) return;
|
|
3880
|
-
const whole = ticks.filter((tick) => Number.isInteger(tick));
|
|
3881
|
-
return whole.length > 1 && whole.length < ticks.length ? whole : void 0;
|
|
3882
|
-
};
|
|
3883
|
-
/**
|
|
3884
|
-
* Hands its children the whole-number ticks of the chart's value scale.
|
|
3947
|
+
* Reads the height the chart was given, not the measured plot area: that grows once the legend
|
|
3948
|
+
* is hidden and would flip the chart straight back. A zero height is unmeasured, not short.
|
|
3885
3949
|
*
|
|
3886
|
-
* @param
|
|
3887
|
-
* @param
|
|
3888
|
-
* @
|
|
3889
|
-
* @param props.enabled - Whether the plotted values are all whole numbers and the caller pinned neither the ticks nor the value domain.
|
|
3890
|
-
* @param props.children - Renders the axis and grid with the tick values.
|
|
3891
|
-
* @return The rendered children.
|
|
3950
|
+
* @param enabled - The chart's `compactWhenShort` prop.
|
|
3951
|
+
* @param height - The height the chart was given.
|
|
3952
|
+
* @return Whether the chart is compact, and the compact margin when it is.
|
|
3892
3953
|
*/
|
|
3893
|
-
const
|
|
3894
|
-
const {
|
|
3895
|
-
const
|
|
3896
|
-
return
|
|
3954
|
+
const useCompactWhenShort = (enabled, height) => {
|
|
3955
|
+
const { compactWhenShort } = useGlobalChartsTheme();
|
|
3956
|
+
const isCompact = enabled && (height ?? 0) > 0 && height < compactWhenShort.below;
|
|
3957
|
+
return {
|
|
3958
|
+
isCompact,
|
|
3959
|
+
compactMargin: isCompact ? compactWhenShort.margin : void 0
|
|
3960
|
+
};
|
|
3897
3961
|
};
|
|
3898
3962
|
// src/charts/private/with-responsive/with-responsive.module.scss
|
|
3899
3963
|
var with_responsive_module_default = {
|
|
@@ -4780,7 +4844,7 @@ const LineChartScalesRef = ({ chartRef, width, height, margin }) => {
|
|
|
4780
4844
|
]);
|
|
4781
4845
|
return null;
|
|
4782
4846
|
};
|
|
4783
|
-
const LineChartInternal = forwardRef(({ data, ariaLabel, chartId: providedChartId, width, height, className, margin, withTooltips = true, withTooltipCrosshairs, showLegend = false, legend = {}, renderGlyph = defaultRenderGlyph, glyphStyle = {}, withLegendGlyph = false, withGradientFill = false, smoothing = true, curveType, renderTooltip = renderDefaultTooltip, tooltipPlacement, tooltipStyle, withStartGlyphs = false, withEndGlyphs = false, animation, options = {}, onPointerDown = void 0, onPointerUp = void 0, onPointerMove = void 0, onPointerOut = void 0, onDatumActivate = void 0, zoomable = false, rescaleYOnVisibilityChange = true, defaultHiddenSeries, children, gridVisibility, gap = "md" }, ref) => {
|
|
4847
|
+
const LineChartInternal = forwardRef(({ data, ariaLabel, chartId: providedChartId, width, height, className, margin, withTooltips = true, withTooltipCrosshairs, showLegend = false, legend = {}, renderGlyph = defaultRenderGlyph, glyphStyle = {}, withLegendGlyph = false, withGradientFill = false, smoothing = true, curveType, renderTooltip = renderDefaultTooltip, tooltipPlacement, tooltipStyle, withStartGlyphs = false, withEndGlyphs = false, animation, options = {}, onPointerDown = void 0, onPointerUp = void 0, onPointerMove = void 0, onPointerOut = void 0, onDatumActivate = void 0, zoomable = false, rescaleYOnVisibilityChange = true, defaultHiddenSeries, children, gridVisibility, gap = "md", compactWhenShort = false }, ref) => {
|
|
4784
4848
|
const legendInteractive = legend.interactive ?? false;
|
|
4785
4849
|
const legendCollapseGroups = legend.collapseGroups ?? false;
|
|
4786
4850
|
const legendComparisonItem = legend.comparisonItem ?? false;
|
|
@@ -4807,6 +4871,7 @@ const LineChartInternal = forwardRef(({ data, ariaLabel, chartId: providedChartI
|
|
|
4807
4871
|
}
|
|
4808
4872
|
});
|
|
4809
4873
|
const { legendChildren, nonLegendChildren } = useChartChildren(children, "LineChart");
|
|
4874
|
+
const { isCompact, compactMargin } = useCompactWhenShort(compactWhenShort, height);
|
|
4810
4875
|
const [measuredChartHeight, setMeasuredChartHeight] = useState();
|
|
4811
4876
|
const handleContentHeightChange = useCallback((contentHeight) => {
|
|
4812
4877
|
setMeasuredChartHeight(contentHeight > 0 ? contentHeight : height);
|
|
@@ -4895,25 +4960,34 @@ const LineChartInternal = forwardRef(({ data, ariaLabel, chartId: providedChartI
|
|
|
4895
4960
|
return min <= max ? [min, max] : void 0;
|
|
4896
4961
|
}, [dataSorted, isSeriesVisible]);
|
|
4897
4962
|
const hasWholeNumberValues = useMemo(() => hasOnlyWholeNumbers(visibleSeries), [visibleSeries]);
|
|
4963
|
+
const isLogScale = options?.yScale?.type === "log";
|
|
4964
|
+
const callerTickDecimals = isLogScale ? void 0 : options?.axis?.y?.tickDecimals;
|
|
4965
|
+
const yTickDecimals = getTickDecimals(hasWholeNumberValues, callerTickDecimals);
|
|
4898
4966
|
const chartOptions = useMemo(() => {
|
|
4899
|
-
const fallbackYDomain = getFallbackYDomain(visibleReadingExtent,
|
|
4967
|
+
const fallbackYDomain = getFallbackYDomain(visibleReadingExtent, isLogScale);
|
|
4968
|
+
const { tickDecimals, ...yAxisOptions } = options?.axis?.y ?? {};
|
|
4969
|
+
const tickDecimalsDomain = isLogScale || tickDecimals === void 0 || options?.yScale?.domain || yAxisOptions.tickValues ? void 0 : getTickDecimalsDomain(yDomain ?? fallbackYDomain ?? visibleReadingExtent, yTickDecimals);
|
|
4900
4970
|
return {
|
|
4901
4971
|
axis: {
|
|
4902
|
-
x:
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4972
|
+
x: {
|
|
4973
|
+
...buildTimeAxisOptions({
|
|
4974
|
+
dataSorted,
|
|
4975
|
+
width,
|
|
4976
|
+
axisOptions: options?.axis?.x,
|
|
4977
|
+
scaleDomain: options?.xScale?.domain,
|
|
4978
|
+
zoomDomain: zoom.domain,
|
|
4979
|
+
formatting,
|
|
4980
|
+
isSeriesRendered: (series) => isSeriesVisible(series.label)
|
|
4981
|
+
}),
|
|
4982
|
+
...isCompact && { display: false }
|
|
4983
|
+
},
|
|
4911
4984
|
y: {
|
|
4912
4985
|
orientation: "left",
|
|
4913
4986
|
numTicks: 4,
|
|
4914
4987
|
tickFormat: formatNumberCompact,
|
|
4915
4988
|
display: true,
|
|
4916
|
-
...
|
|
4989
|
+
...yAxisOptions,
|
|
4990
|
+
...isCompact && { display: false }
|
|
4917
4991
|
}
|
|
4918
4992
|
},
|
|
4919
4993
|
xScale: {
|
|
@@ -4927,6 +5001,7 @@ const LineChartInternal = forwardRef(({ data, ariaLabel, chartId: providedChartI
|
|
|
4927
5001
|
zero: false,
|
|
4928
5002
|
...fallbackYDomain ? { domain: fallbackYDomain } : {},
|
|
4929
5003
|
...yDomain ? { domain: yDomain } : {},
|
|
5004
|
+
...tickDecimalsDomain ? { domain: tickDecimalsDomain } : {},
|
|
4930
5005
|
...options?.yScale
|
|
4931
5006
|
}
|
|
4932
5007
|
};
|
|
@@ -4937,8 +5012,11 @@ const LineChartInternal = forwardRef(({ data, ariaLabel, chartId: providedChartI
|
|
|
4937
5012
|
zoom.domain,
|
|
4938
5013
|
yDomain,
|
|
4939
5014
|
visibleReadingExtent,
|
|
5015
|
+
isLogScale,
|
|
5016
|
+
yTickDecimals,
|
|
4940
5017
|
formatting,
|
|
4941
|
-
isSeriesVisible
|
|
5018
|
+
isSeriesVisible,
|
|
5019
|
+
isCompact
|
|
4942
5020
|
]);
|
|
4943
5021
|
const bucketInfo = useMemo(() => getBucketInfo(visibleSeries, options?.axis?.x?.tickResolution), [visibleSeries, options?.axis?.x?.tickResolution]);
|
|
4944
5022
|
const tooltipRenderGlyph = useMemo(() => {
|
|
@@ -5013,7 +5091,7 @@ const LineChartInternal = forwardRef(({ data, ariaLabel, chartId: providedChartI
|
|
|
5013
5091
|
className: clsx("line-chart", line_chart_module_default["line-chart"]),
|
|
5014
5092
|
children: error
|
|
5015
5093
|
});
|
|
5016
|
-
const legendElement = showLegend && /* @__PURE__ */ jsx(Legend, {
|
|
5094
|
+
const legendElement = showLegend && !isCompact && /* @__PURE__ */ jsx(Legend, {
|
|
5017
5095
|
orientation: legend.orientation ?? "horizontal",
|
|
5018
5096
|
alignment: legend.alignment ?? "center",
|
|
5019
5097
|
position: legendPosition,
|
|
@@ -5037,7 +5115,7 @@ const LineChartInternal = forwardRef(({ data, ariaLabel, chartId: providedChartI
|
|
|
5037
5115
|
children: /* @__PURE__ */ jsx(ChartLayout, {
|
|
5038
5116
|
legendPosition,
|
|
5039
5117
|
legendElement,
|
|
5040
|
-
legendChildren,
|
|
5118
|
+
legendChildren: isCompact ? [] : legendChildren,
|
|
5041
5119
|
gap,
|
|
5042
5120
|
className: clsx("line-chart", line_chart_module_default["line-chart"], { [line_chart_module_default["line-chart--animated"]]: animation && !prefersReducedMotion }, className),
|
|
5043
5121
|
style: {
|
|
@@ -5065,6 +5143,7 @@ const LineChartInternal = forwardRef(({ data, ariaLabel, chartId: providedChartI
|
|
|
5065
5143
|
height: chartHeight,
|
|
5066
5144
|
margin: {
|
|
5067
5145
|
...defaultMargin,
|
|
5146
|
+
...compactMargin,
|
|
5068
5147
|
...margin
|
|
5069
5148
|
},
|
|
5070
5149
|
xScale: chartOptions.xScale,
|
|
@@ -5072,12 +5151,12 @@ const LineChartInternal = forwardRef(({ data, ariaLabel, chartId: providedChartI
|
|
|
5072
5151
|
onPointerOut,
|
|
5073
5152
|
children: [
|
|
5074
5153
|
/* @__PURE__ */ jsx(NearestPointerEvents, { ...zoom.handlers }),
|
|
5075
|
-
/* @__PURE__ */ jsx(
|
|
5154
|
+
/* @__PURE__ */ jsx(TickDecimals, {
|
|
5076
5155
|
axis: "y",
|
|
5077
5156
|
numTicks: chartOptions.axis.y.numTicks,
|
|
5078
|
-
|
|
5157
|
+
decimals: !chartOptions.axis.y.tickValues && !options?.yScale?.domain ? yTickDecimals : void 0,
|
|
5079
5158
|
children: (tickValues) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
5080
|
-
!allSeriesHidden && gridVisibility !== "none" && /* @__PURE__ */ jsx(Grid, {
|
|
5159
|
+
!allSeriesHidden && gridVisibility !== "none" && !isCompact && /* @__PURE__ */ jsx(Grid, {
|
|
5081
5160
|
columns: false,
|
|
5082
5161
|
numTicks: chartOptions.axis.y.numTicks,
|
|
5083
5162
|
tickValues: tickValues ?? chartOptions.axis.y.tickValues
|
|
@@ -5094,7 +5173,7 @@ const LineChartInternal = forwardRef(({ data, ariaLabel, chartId: providedChartI
|
|
|
5094
5173
|
y: chartHeight / 2,
|
|
5095
5174
|
width,
|
|
5096
5175
|
height: chartHeight,
|
|
5097
|
-
children: getAllHiddenMessage(legendInteractive, "series")
|
|
5176
|
+
children: getAllHiddenMessage(legendInteractive && !isCompact, "series")
|
|
5098
5177
|
}) : null,
|
|
5099
5178
|
/* @__PURE__ */ jsx(ZoomClip, {
|
|
5100
5179
|
active: zoomable && !!zoom.domain,
|
|
@@ -5296,7 +5375,7 @@ const HoverGlyphs = ({ visibleSeries, stacked, stackOffset, getElementStyles, st
|
|
|
5296
5375
|
});
|
|
5297
5376
|
};
|
|
5298
5377
|
// src/charts/area-chart/area-chart.tsx
|
|
5299
|
-
const AreaChartInternal = forwardRef(({ data, ariaLabel, chartId: providedChartId, width, height, className, margin, withTooltips = true, withTooltipCrosshairs, showLegend = false, legend = {}, stacked = true, stackOffset = "none", smoothing = true, curveType, fillOpacity, withStroke, renderTooltip = renderDefaultTooltip, animation, options = {}, onPointerDown, onPointerUp, onPointerMove, onPointerOut, zoomable = false, rescaleYOnVisibilityChange = true, defaultHiddenSeries, children, gridVisibility, gap = "md" }, ref) => {
|
|
5378
|
+
const AreaChartInternal = forwardRef(({ data, ariaLabel, chartId: providedChartId, width, height, className, margin, withTooltips = true, withTooltipCrosshairs, showLegend = false, legend = {}, stacked = true, stackOffset = "none", smoothing = true, curveType, fillOpacity, withStroke, renderTooltip = renderDefaultTooltip, animation, options = {}, onPointerDown, onPointerUp, onPointerMove, onPointerOut, zoomable = false, rescaleYOnVisibilityChange = true, defaultHiddenSeries, children, gridVisibility, gap = "md", compactWhenShort = false }, ref) => {
|
|
5300
5379
|
const legendInteractive = legend.interactive ?? false;
|
|
5301
5380
|
const legendShape = legend.shape ?? "rect";
|
|
5302
5381
|
const legendPosition = legend.position ?? "bottom";
|
|
@@ -5319,6 +5398,7 @@ const AreaChartInternal = forwardRef(({ data, ariaLabel, chartId: providedChartI
|
|
|
5319
5398
|
}
|
|
5320
5399
|
});
|
|
5321
5400
|
const { legendChildren, nonLegendChildren } = useChartChildren(children, "AreaChart");
|
|
5401
|
+
const { isCompact, compactMargin } = useCompactWhenShort(compactWhenShort, height);
|
|
5322
5402
|
const [measuredChartHeight, setMeasuredChartHeight] = useState();
|
|
5323
5403
|
const handleContentHeightChange = useCallback((contentHeight) => {
|
|
5324
5404
|
setMeasuredChartHeight(contentHeight > 0 ? contentHeight : height);
|
|
@@ -5398,20 +5478,24 @@ const AreaChartInternal = forwardRef(({ data, ariaLabel, chartId: providedChartI
|
|
|
5398
5478
|
const chartOptions = useMemo(() => {
|
|
5399
5479
|
return {
|
|
5400
5480
|
axis: {
|
|
5401
|
-
x:
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5481
|
+
x: {
|
|
5482
|
+
...buildTimeAxisOptions({
|
|
5483
|
+
dataSorted,
|
|
5484
|
+
width,
|
|
5485
|
+
axisOptions: options?.axis?.x,
|
|
5486
|
+
scaleDomain: options?.xScale?.domain,
|
|
5487
|
+
zoomDomain: zoom.domain,
|
|
5488
|
+
formatting
|
|
5489
|
+
}),
|
|
5490
|
+
...isCompact && { display: false }
|
|
5491
|
+
},
|
|
5409
5492
|
y: {
|
|
5410
5493
|
orientation: "left",
|
|
5411
5494
|
numTicks: 4,
|
|
5412
5495
|
tickFormat: formatNumberCompact,
|
|
5413
5496
|
display: true,
|
|
5414
|
-
...options?.axis?.y
|
|
5497
|
+
...options?.axis?.y,
|
|
5498
|
+
...isCompact && { display: false }
|
|
5415
5499
|
}
|
|
5416
5500
|
},
|
|
5417
5501
|
xScale: {
|
|
@@ -5434,7 +5518,8 @@ const AreaChartInternal = forwardRef(({ data, ariaLabel, chartId: providedChartI
|
|
|
5434
5518
|
stacked,
|
|
5435
5519
|
fixedYDomain,
|
|
5436
5520
|
zoom.domain,
|
|
5437
|
-
formatting
|
|
5521
|
+
formatting,
|
|
5522
|
+
isCompact
|
|
5438
5523
|
]);
|
|
5439
5524
|
const defaultMargin = useChartMargin(height, chartOptions, dataSorted, theme);
|
|
5440
5525
|
const error = validateData$3(dataSorted);
|
|
@@ -5514,7 +5599,7 @@ const AreaChartInternal = forwardRef(({ data, ariaLabel, chartId: providedChartI
|
|
|
5514
5599
|
className: clsx("area-chart", area_chart_module_default["area-chart"]),
|
|
5515
5600
|
children: error
|
|
5516
5601
|
});
|
|
5517
|
-
const legendElement = showLegend && /* @__PURE__ */ jsx(Legend, {
|
|
5602
|
+
const legendElement = showLegend && !isCompact && /* @__PURE__ */ jsx(Legend, {
|
|
5518
5603
|
orientation: legend.orientation ?? "horizontal",
|
|
5519
5604
|
alignment: legend.alignment ?? "center",
|
|
5520
5605
|
position: legendPosition,
|
|
@@ -5562,7 +5647,7 @@ const AreaChartInternal = forwardRef(({ data, ariaLabel, chartId: providedChartI
|
|
|
5562
5647
|
children: /* @__PURE__ */ jsx(ChartLayout, {
|
|
5563
5648
|
legendPosition,
|
|
5564
5649
|
legendElement,
|
|
5565
|
-
legendChildren,
|
|
5650
|
+
legendChildren: isCompact ? [] : legendChildren,
|
|
5566
5651
|
gap,
|
|
5567
5652
|
className: clsx("area-chart", area_chart_module_default["area-chart"], { [area_chart_module_default["area-chart--animated"]]: animationEnabled }, className),
|
|
5568
5653
|
style: {
|
|
@@ -5590,6 +5675,7 @@ const AreaChartInternal = forwardRef(({ data, ariaLabel, chartId: providedChartI
|
|
|
5590
5675
|
height: chartHeight,
|
|
5591
5676
|
margin: {
|
|
5592
5677
|
...defaultMargin,
|
|
5678
|
+
...compactMargin,
|
|
5593
5679
|
...margin
|
|
5594
5680
|
},
|
|
5595
5681
|
xScale: chartOptions.xScale,
|
|
@@ -5600,12 +5686,12 @@ const AreaChartInternal = forwardRef(({ data, ariaLabel, chartId: providedChartI
|
|
|
5600
5686
|
onPointerOut,
|
|
5601
5687
|
pointerEventsDataKey: "nearest",
|
|
5602
5688
|
children: [
|
|
5603
|
-
/* @__PURE__ */ jsx(
|
|
5689
|
+
/* @__PURE__ */ jsx(TickDecimals, {
|
|
5604
5690
|
axis: "y",
|
|
5605
5691
|
numTicks: chartOptions.axis.y.numTicks,
|
|
5606
|
-
|
|
5692
|
+
decimals: hasWholeNumberValues && !chartOptions.axis.y.tickValues && !options?.yScale?.domain ? 0 : void 0,
|
|
5607
5693
|
children: (tickValues) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
5608
|
-
!allSeriesHidden && gridVisibility !== "none" && /* @__PURE__ */ jsx(Grid, {
|
|
5694
|
+
!allSeriesHidden && gridVisibility !== "none" && !isCompact && /* @__PURE__ */ jsx(Grid, {
|
|
5609
5695
|
columns: false,
|
|
5610
5696
|
numTicks: chartOptions.axis.y.numTicks,
|
|
5611
5697
|
tickValues: tickValues ?? chartOptions.axis.y.tickValues
|
|
@@ -5622,7 +5708,7 @@ const AreaChartInternal = forwardRef(({ data, ariaLabel, chartId: providedChartI
|
|
|
5622
5708
|
y: chartHeight / 2,
|
|
5623
5709
|
width,
|
|
5624
5710
|
height: chartHeight,
|
|
5625
|
-
children: getAllHiddenMessage(legendInteractive, "series")
|
|
5711
|
+
children: getAllHiddenMessage(legendInteractive && !isCompact, "series")
|
|
5626
5712
|
}) : null,
|
|
5627
5713
|
/* @__PURE__ */ jsxs(ZoomClip, {
|
|
5628
5714
|
active: zoomable,
|
|
@@ -5685,9 +5771,145 @@ var bar_chart_module_default = {
|
|
|
5685
5771
|
"bar-chart": "a8ccharts-97yN9W-bar-chart",
|
|
5686
5772
|
"bar-chart--animated": "a8ccharts-97yN9W-bar-chart--animated",
|
|
5687
5773
|
"bar-chart--animated-horizontal": "a8ccharts-97yN9W-bar-chart--animated-horizontal",
|
|
5774
|
+
"bar-chart--stacked": "a8ccharts-97yN9W-bar-chart--stacked",
|
|
5688
5775
|
"rise": "a8ccharts-97yN9W-rise",
|
|
5689
5776
|
"stretch": "a8ccharts-97yN9W-stretch"
|
|
5690
5777
|
};
|
|
5778
|
+
// src/charts/bar-chart/private/category.ts
|
|
5779
|
+
/**
|
|
5780
|
+
* Whether two data points sit at the same category: the same label, or the same date.
|
|
5781
|
+
*
|
|
5782
|
+
* @param point - A data point.
|
|
5783
|
+
* @param category - The data point naming the category.
|
|
5784
|
+
* @return Whether `point` is at `category`.
|
|
5785
|
+
*/
|
|
5786
|
+
function isSameCategory(point, category) {
|
|
5787
|
+
return category.label ? point.label === category.label : !!category.date && !!point.date && point.date.getTime() === category.date.getTime();
|
|
5788
|
+
}
|
|
5789
|
+
/**
|
|
5790
|
+
* The category a data point sits at, as a key two points share when `isSameCategory` holds.
|
|
5791
|
+
*
|
|
5792
|
+
* @param point - A data point.
|
|
5793
|
+
* @return The category key.
|
|
5794
|
+
*/
|
|
5795
|
+
function categoryKey(point) {
|
|
5796
|
+
return point.label ? `label:${point.label}` : `date:${point.date?.getTime()}`;
|
|
5797
|
+
}
|
|
5798
|
+
// src/charts/bar-chart/private/value-domain.ts
|
|
5799
|
+
/** Domain for a value axis that has nothing to scale, so its ticks still read 0 to 1. */
|
|
5800
|
+
const EMPTY_DOMAIN = [0, 1];
|
|
5801
|
+
/**
|
|
5802
|
+
* The value a bar is drawn at, preferring `visualValue` so a zero still shows a sliver.
|
|
5803
|
+
*
|
|
5804
|
+
* A missing reading is NaN, not null: `ComparisonBars` coerces the value with `Number()`,
|
|
5805
|
+
* which turns null into 0 and would draw a comparison shadow at the baseline.
|
|
5806
|
+
*
|
|
5807
|
+
* @param point - A data point handed to visx.
|
|
5808
|
+
* @return The bar value, or NaN when the bucket has no reading.
|
|
5809
|
+
*/
|
|
5810
|
+
const getBarValue = (point) => {
|
|
5811
|
+
const enhanced = point;
|
|
5812
|
+
return (enhanced?.visualValue !== void 0 ? enhanced.visualValue : point?.value) ?? NaN;
|
|
5813
|
+
};
|
|
5814
|
+
/**
|
|
5815
|
+
* Whether visx renders a bar for a point.
|
|
5816
|
+
*
|
|
5817
|
+
* @param point - A data point handed to visx.
|
|
5818
|
+
* @return True when the point has a finite bar value.
|
|
5819
|
+
*/
|
|
5820
|
+
const isBarRendered = (point) => Number.isFinite(getBarValue(point));
|
|
5821
|
+
/**
|
|
5822
|
+
* An explicit domain for the value scale, or null to let visx fit one to the data.
|
|
5823
|
+
*
|
|
5824
|
+
* Zero goes into the domain here rather than through the scale's `zero` flag: visx applies
|
|
5825
|
+
* `nice` before `zero`, which would leave the axis topping out at a raw maximum.
|
|
5826
|
+
*
|
|
5827
|
+
* @param data - Every series handed to the chart.
|
|
5828
|
+
* @param includeZero - Whether the domain must span zero.
|
|
5829
|
+
* @param isSeriesRendered - Whether visx mounts a series, i.e. the legend shows it.
|
|
5830
|
+
* @param tickDecimals - The value axis's `tickDecimals`.
|
|
5831
|
+
* @return Value domain, or null when visx should fit its own.
|
|
5832
|
+
*/
|
|
5833
|
+
const getValueScaleDomain = (data, includeZero, isSeriesRendered, tickDecimals) => {
|
|
5834
|
+
let min = Infinity;
|
|
5835
|
+
let max = -Infinity;
|
|
5836
|
+
for (const series of data) {
|
|
5837
|
+
if (!isSeriesRendered(series)) continue;
|
|
5838
|
+
for (const point of series.data) {
|
|
5839
|
+
const value = getBarValue(point);
|
|
5840
|
+
if (!Number.isFinite(value)) continue;
|
|
5841
|
+
min = Math.min(min, value);
|
|
5842
|
+
max = Math.max(max, value);
|
|
5843
|
+
}
|
|
5844
|
+
}
|
|
5845
|
+
if (min === Infinity) return [...EMPTY_DOMAIN];
|
|
5846
|
+
let domain = null;
|
|
5847
|
+
if (min === max) domain = min === 0 ? [...EMPTY_DOMAIN] : [Math.min(0, min), Math.max(0, max)];
|
|
5848
|
+
else if (includeZero) domain = [Math.min(0, min), Math.max(0, max)];
|
|
5849
|
+
return getTickDecimalsDomain(domain ?? [min, max], tickDecimals) ?? domain;
|
|
5850
|
+
};
|
|
5851
|
+
// src/charts/bar-chart/private/stack-layout.ts
|
|
5852
|
+
/**
|
|
5853
|
+
* The series a layout draws: a stacked layout leaves comparison series out for now.
|
|
5854
|
+
*
|
|
5855
|
+
* @param series - The chart's series.
|
|
5856
|
+
* @param layout - The layout the bars are drawn in.
|
|
5857
|
+
* @return The drawn series.
|
|
5858
|
+
*/
|
|
5859
|
+
function getDrawnSeries(series, layout) {
|
|
5860
|
+
return layout === "stacked" ? series.filter((item) => item.options?.type !== "comparison") : series;
|
|
5861
|
+
}
|
|
5862
|
+
/**
|
|
5863
|
+
* Stacks the series in order at each category: positives upward and negatives downward from zero.
|
|
5864
|
+
*
|
|
5865
|
+
* @param series - The series to stack, bottom first.
|
|
5866
|
+
* @return The stack layout.
|
|
5867
|
+
*/
|
|
5868
|
+
function getStackLayout(series) {
|
|
5869
|
+
const segments = /* @__PURE__ */ new Map();
|
|
5870
|
+
const extents = /* @__PURE__ */ new Map();
|
|
5871
|
+
for (const { label, data } of series) {
|
|
5872
|
+
const byCategory = /* @__PURE__ */ new Map();
|
|
5873
|
+
segments.set(label, byCategory);
|
|
5874
|
+
for (const point of data) {
|
|
5875
|
+
const value = getBarValue(point);
|
|
5876
|
+
if (!Number.isFinite(value)) continue;
|
|
5877
|
+
const key = categoryKey(point);
|
|
5878
|
+
if (byCategory.has(key)) continue;
|
|
5879
|
+
const extent = extents.get(key) ?? [0, 0];
|
|
5880
|
+
const side = value < 0 ? 0 : 1;
|
|
5881
|
+
const start = extent[side];
|
|
5882
|
+
extent[side] = start + value;
|
|
5883
|
+
extents.set(key, extent);
|
|
5884
|
+
byCategory.set(key, {
|
|
5885
|
+
start,
|
|
5886
|
+
end: start + value
|
|
5887
|
+
});
|
|
5888
|
+
}
|
|
5889
|
+
}
|
|
5890
|
+
let extent = null;
|
|
5891
|
+
for (const [low, high] of extents.values()) extent = extent ? [Math.min(extent[0], low), Math.max(extent[1], high)] : [low, high];
|
|
5892
|
+
return {
|
|
5893
|
+
segmentOf: (key, datum) => segments.get(key)?.get(categoryKey(datum)),
|
|
5894
|
+
extentAt: (category) => {
|
|
5895
|
+
const [low, high] = extents.get(categoryKey(category)) ?? [0, 0];
|
|
5896
|
+
return [low, high];
|
|
5897
|
+
},
|
|
5898
|
+
extent
|
|
5899
|
+
};
|
|
5900
|
+
}
|
|
5901
|
+
/**
|
|
5902
|
+
* The value domain of a computed stack, falling back to an empty chart's domain.
|
|
5903
|
+
*
|
|
5904
|
+
* @param stack - The precomputed stack.
|
|
5905
|
+
* @param tickDecimals - The value axis precision, when set.
|
|
5906
|
+
* @return The extent widened for tick precision, or the empty chart domain.
|
|
5907
|
+
*/
|
|
5908
|
+
function getStackedValueDomain(stack, tickDecimals) {
|
|
5909
|
+
const { extent } = stack;
|
|
5910
|
+
const domain = !extent || extent[0] === extent[1] ? [...EMPTY_DOMAIN] : extent;
|
|
5911
|
+
return getTickDecimalsDomain(domain, tickDecimals) ?? domain;
|
|
5912
|
+
}
|
|
5691
5913
|
// src/charts/bar-chart/private/truncated-tick-component.tsx
|
|
5692
5914
|
/**
|
|
5693
5915
|
* Get the bandwidth of a scale
|
|
@@ -5802,57 +6024,6 @@ const createTruncatedTickComponent = (axis) => (props) => {
|
|
|
5802
6024
|
*/
|
|
5803
6025
|
const TruncatedXTickComponent = createTruncatedTickComponent("x");
|
|
5804
6026
|
const TruncatedYTickComponent = createTruncatedTickComponent("y");
|
|
5805
|
-
// src/charts/bar-chart/private/value-domain.ts
|
|
5806
|
-
/** Domain for a value axis that has nothing to scale, so its ticks still read 0 to 1. */
|
|
5807
|
-
const EMPTY_DOMAIN = [0, 1];
|
|
5808
|
-
/**
|
|
5809
|
-
* The value a bar is drawn at, preferring `visualValue` so a zero still shows a sliver.
|
|
5810
|
-
*
|
|
5811
|
-
* A missing reading is NaN, not null: `ComparisonBars` coerces the value with `Number()`,
|
|
5812
|
-
* which turns null into 0 and would draw a comparison shadow at the baseline.
|
|
5813
|
-
*
|
|
5814
|
-
* @param point - A data point handed to visx.
|
|
5815
|
-
* @return The bar value, or NaN when the bucket has no reading.
|
|
5816
|
-
*/
|
|
5817
|
-
const getBarValue = (point) => {
|
|
5818
|
-
const enhanced = point;
|
|
5819
|
-
return (enhanced?.visualValue !== void 0 ? enhanced.visualValue : point?.value) ?? NaN;
|
|
5820
|
-
};
|
|
5821
|
-
/**
|
|
5822
|
-
* Whether visx renders a bar for a point.
|
|
5823
|
-
*
|
|
5824
|
-
* @param point - A data point handed to visx.
|
|
5825
|
-
* @return True when the point has a finite bar value.
|
|
5826
|
-
*/
|
|
5827
|
-
const isBarRendered = (point) => Number.isFinite(getBarValue(point));
|
|
5828
|
-
/**
|
|
5829
|
-
* An explicit domain for the value scale, or null to let visx fit one to the data.
|
|
5830
|
-
*
|
|
5831
|
-
* Zero goes into the domain here rather than through the scale's `zero` flag: visx applies
|
|
5832
|
-
* `nice` before `zero`, which would leave the axis topping out at a raw maximum.
|
|
5833
|
-
*
|
|
5834
|
-
* @param data - Every series handed to the chart.
|
|
5835
|
-
* @param includeZero - Whether the domain must span zero.
|
|
5836
|
-
* @param isSeriesRendered - Whether visx mounts a series, i.e. the legend shows it.
|
|
5837
|
-
* @return Value domain, or null when visx should fit its own.
|
|
5838
|
-
*/
|
|
5839
|
-
const getValueScaleDomain = (data, includeZero, isSeriesRendered) => {
|
|
5840
|
-
let min = Infinity;
|
|
5841
|
-
let max = -Infinity;
|
|
5842
|
-
for (const series of data) {
|
|
5843
|
-
if (!isSeriesRendered(series)) continue;
|
|
5844
|
-
for (const point of series.data) {
|
|
5845
|
-
const value = getBarValue(point);
|
|
5846
|
-
if (!Number.isFinite(value)) continue;
|
|
5847
|
-
min = Math.min(min, value);
|
|
5848
|
-
max = Math.max(max, value);
|
|
5849
|
-
}
|
|
5850
|
-
}
|
|
5851
|
-
if (min === Infinity) return [...EMPTY_DOMAIN];
|
|
5852
|
-
if (min === max) return min === 0 ? [...EMPTY_DOMAIN] : [Math.min(0, min), Math.max(0, max)];
|
|
5853
|
-
if (includeZero) return [Math.min(0, min), Math.max(0, max)];
|
|
5854
|
-
return null;
|
|
5855
|
-
};
|
|
5856
6027
|
// src/charts/bar-chart/private/use-bar-chart-options.ts
|
|
5857
6028
|
/** Outer padding of the category band scale (space at the chart edges). */
|
|
5858
6029
|
const BASE_BAND_PADDING = .2;
|
|
@@ -5941,14 +6112,18 @@ const getGroupPadding = (scale) => {
|
|
|
5941
6112
|
* @param horizontal - Whether the chart is horizontal or vertical.
|
|
5942
6113
|
* @param options - The options for the chart.
|
|
5943
6114
|
* @param isSeriesRendered - Whether visx mounts a series, i.e. the legend shows it.
|
|
6115
|
+
* @param stack - The precomputed stack, when series share one bar.
|
|
5944
6116
|
* @return The merged options for the chart.
|
|
5945
6117
|
*/
|
|
5946
|
-
function useBarChartOptions(data, horizontal, options = {}, isSeriesRendered = ALL_RENDERED) {
|
|
6118
|
+
function useBarChartOptions(data, horizontal, options = {}, isSeriesRendered = ALL_RENDERED, stack) {
|
|
5947
6119
|
const stableOptions = useDeepMemo(options);
|
|
5948
6120
|
const formatting = useChartFormatting();
|
|
6121
|
+
const isStacked = !!stack;
|
|
5949
6122
|
const axisConfig = useMemo(() => {
|
|
5950
|
-
const { labelOverflow: xLabelOverflow, tickResolution: xTickResolution, tickFormat: xTickFormat, ...xAxisOptions } = stableOptions.axis?.x || {};
|
|
5951
|
-
const { labelOverflow: yLabelOverflow, tickResolution: yTickResolution, tickFormat: yTickFormat, ...yAxisOptions } = stableOptions.axis?.y || {};
|
|
6123
|
+
const { labelOverflow: xLabelOverflow, tickResolution: xTickResolution, tickFormat: xTickFormat, tickDecimals: xTickDecimals, ...xAxisOptions } = stableOptions.axis?.x || {};
|
|
6124
|
+
const { labelOverflow: yLabelOverflow, tickResolution: yTickResolution, tickFormat: yTickFormat, tickDecimals: yTickDecimals, ...yAxisOptions } = stableOptions.axis?.y || {};
|
|
6125
|
+
const [valueAxisOptions, valueTickDecimals] = horizontal ? [xAxisOptions, xTickDecimals] : [yAxisOptions, yTickDecimals];
|
|
6126
|
+
const valueScaleType = isStacked ? "linear" : (horizontal ? stableOptions.xScale : stableOptions.yScale)?.type;
|
|
5952
6127
|
return {
|
|
5953
6128
|
xLabelOverflow,
|
|
5954
6129
|
yLabelOverflow,
|
|
@@ -5956,9 +6131,14 @@ function useBarChartOptions(data, horizontal, options = {}, isSeriesRendered = A
|
|
|
5956
6131
|
yTickFormat,
|
|
5957
6132
|
xAxisOptions,
|
|
5958
6133
|
yAxisOptions,
|
|
5959
|
-
tickResolution: horizontal ? yTickResolution : xTickResolution
|
|
6134
|
+
tickResolution: horizontal ? yTickResolution : xTickResolution,
|
|
6135
|
+
valueTickDecimals: valueAxisOptions.tickValues || valueScaleType === "log" ? void 0 : valueTickDecimals
|
|
5960
6136
|
};
|
|
5961
|
-
}, [
|
|
6137
|
+
}, [
|
|
6138
|
+
stableOptions,
|
|
6139
|
+
horizontal,
|
|
6140
|
+
isStacked
|
|
6141
|
+
]);
|
|
5962
6142
|
const { tickResolution } = axisConfig;
|
|
5963
6143
|
const defaultOptions = useMemo(() => {
|
|
5964
6144
|
const bandScale = {
|
|
@@ -6013,17 +6193,21 @@ function useBarChartOptions(data, horizontal, options = {}, isSeriesRendered = A
|
|
|
6013
6193
|
const { xTickFormat: defaultXTickFormat, yTickFormat: defaultYTickFormat, tooltipLabelFormatter: defaultTooltipLabelFormatter, xAccessor, yAccessor, gridVisibility, xScale: baseXScale, yScale: baseYScale } = defaultOptions[horizontal ? "horizontal" : "vertical"];
|
|
6014
6194
|
const valueScaleOptions = horizontal ? stableOptions.xScale : stableOptions.yScale;
|
|
6015
6195
|
const includeZero = data.some((s) => s.options?.type === "comparison") || valueScaleOptions?.zero !== false;
|
|
6016
|
-
|
|
6017
|
-
|
|
6196
|
+
let domain = null;
|
|
6197
|
+
if (!valueScaleOptions?.domain) domain = stack ? getStackedValueDomain(stack, axisConfig.valueTickDecimals) : getValueScaleDomain(data, includeZero, isSeriesRendered, axisConfig.valueTickDecimals);
|
|
6198
|
+
const valueScaleOverride = {
|
|
6199
|
+
...domain && { domain },
|
|
6200
|
+
...stack && { type: "linear" }
|
|
6201
|
+
};
|
|
6018
6202
|
const xScale = {
|
|
6019
6203
|
...baseXScale,
|
|
6020
6204
|
...stableOptions.xScale || {},
|
|
6021
|
-
...horizontal ?
|
|
6205
|
+
...horizontal ? valueScaleOverride : {}
|
|
6022
6206
|
};
|
|
6023
6207
|
const yScale = {
|
|
6024
6208
|
...baseYScale,
|
|
6025
6209
|
...stableOptions.yScale || {},
|
|
6026
|
-
...!horizontal ?
|
|
6210
|
+
...!horizontal ? valueScaleOverride : {}
|
|
6027
6211
|
};
|
|
6028
6212
|
const { xLabelOverflow, yLabelOverflow, xTickFormat, yTickFormat, xAxisOptions, yAxisOptions } = axisConfig;
|
|
6029
6213
|
const dateAxisTickFormat = horizontal ? yTickFormat : xTickFormat;
|
|
@@ -6058,7 +6242,8 @@ function useBarChartOptions(data, horizontal, options = {}, isSeriesRendered = A
|
|
|
6058
6242
|
}
|
|
6059
6243
|
},
|
|
6060
6244
|
barGroup: { padding: getGroupPadding(horizontal ? yScale : xScale) },
|
|
6061
|
-
tooltip: { labelFormatter: dateAxisTickFormat || defaultTooltipLabelFormatter }
|
|
6245
|
+
tooltip: { labelFormatter: dateAxisTickFormat || defaultTooltipLabelFormatter },
|
|
6246
|
+
valueTickDecimals: axisConfig.valueTickDecimals
|
|
6062
6247
|
};
|
|
6063
6248
|
}, [
|
|
6064
6249
|
defaultOptions,
|
|
@@ -6066,7 +6251,8 @@ function useBarChartOptions(data, horizontal, options = {}, isSeriesRendered = A
|
|
|
6066
6251
|
stableOptions,
|
|
6067
6252
|
horizontal,
|
|
6068
6253
|
data,
|
|
6069
|
-
isSeriesRendered
|
|
6254
|
+
isSeriesRendered,
|
|
6255
|
+
stack
|
|
6070
6256
|
]);
|
|
6071
6257
|
}
|
|
6072
6258
|
// src/charts/bar-chart/private/band-scale.ts
|
|
@@ -6098,6 +6284,17 @@ function getValueScaleBaseline(scale) {
|
|
|
6098
6284
|
return Number.isFinite(maybeZero) ? Math.max(maybeZero, minOutput) : minOutput;
|
|
6099
6285
|
}
|
|
6100
6286
|
/**
|
|
6287
|
+
* A value's position on a continuous scale, held inside its range so a domain that leaves the value out cannot push a bar off the plot.
|
|
6288
|
+
*
|
|
6289
|
+
* @param {ValueScale} scale - The continuous value scale.
|
|
6290
|
+
* @param {number} value - The value to place.
|
|
6291
|
+
* @return {number} The position in pixels.
|
|
6292
|
+
*/
|
|
6293
|
+
function getValueScalePosition(scale, value) {
|
|
6294
|
+
const [a, b] = scale.range().map((r) => Number(r) || 0);
|
|
6295
|
+
return Math.min(Math.max(scale(value), Math.min(a, b)), Math.max(a, b));
|
|
6296
|
+
}
|
|
6297
|
+
/**
|
|
6101
6298
|
* Compute the rect that spans `valuePositions` along the value axis, centered on a slot and scaled by `widthFactor` across it.
|
|
6102
6299
|
*
|
|
6103
6300
|
* @param {object} params - Geometry inputs.
|
|
@@ -6294,13 +6491,13 @@ const SelectedBarRing = ({ chartId, selected, slotKeys, groupPadding, horizontal
|
|
|
6294
6491
|
const slotOffset = groupScale(selected.slotKey);
|
|
6295
6492
|
const bandPosition = Number(bandScale((horizontal ? yAccessor : xAccessor)(category)));
|
|
6296
6493
|
if (slotOffset == null || !Number.isFinite(bandPosition)) return null;
|
|
6297
|
-
const valuePositions = selected.data.map((datum) => Number(valueScale(Number((horizontal ? xAccessor : yAccessor)(datum)))));
|
|
6494
|
+
const valuePositions = selected.valueExtent ? selected.valueExtent.map((value) => getValueScalePosition(valueScale, value)) : [getValueScaleBaseline(valueScale), ...selected.data.map((datum) => Number(valueScale(Number((horizontal ? xAccessor : yAccessor)(datum)))))];
|
|
6298
6495
|
const rect = computeSlotRect({
|
|
6299
6496
|
horizontal,
|
|
6300
6497
|
bandPosition,
|
|
6301
6498
|
slotOffset,
|
|
6302
6499
|
slotThickness: groupScale.bandwidth(),
|
|
6303
|
-
valuePositions
|
|
6500
|
+
valuePositions,
|
|
6304
6501
|
widthFactor: selected.thickness
|
|
6305
6502
|
});
|
|
6306
6503
|
return /* @__PURE__ */ jsx(SelectedRing, {
|
|
@@ -6310,38 +6507,147 @@ const SelectedBarRing = ({ chartId, selected, slotKeys, groupPadding, horizontal
|
|
|
6310
6507
|
testId: "bar-chart-selected-ring"
|
|
6311
6508
|
});
|
|
6312
6509
|
};
|
|
6313
|
-
// src/charts/bar-chart/private/bar-
|
|
6510
|
+
// src/charts/bar-chart/private/stacked-bar-series.tsx
|
|
6314
6511
|
/**
|
|
6315
|
-
*
|
|
6512
|
+
* The side a segment rounds when it ends its drawn stack: the far end of the positives or of the negatives.
|
|
6316
6513
|
*
|
|
6317
|
-
* @param
|
|
6318
|
-
* @param
|
|
6319
|
-
* @param
|
|
6320
|
-
* @param
|
|
6321
|
-
* @param
|
|
6322
|
-
* @
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6514
|
+
* @param stack - The stack layout.
|
|
6515
|
+
* @param segment - The segment.
|
|
6516
|
+
* @param category - A datum at the segment's category.
|
|
6517
|
+
* @param horizontal - Whether the bars run horizontally.
|
|
6518
|
+
* @param clamp - Holds a value inside the value domain, where the bars are cut off.
|
|
6519
|
+
* @return The side to round, or undefined for a segment inside its stack or drawn with no length.
|
|
6520
|
+
*/
|
|
6521
|
+
function getStackEnd(stack, segment, category, horizontal, clamp) {
|
|
6522
|
+
const [start, end] = [segment.start, segment.end].map(clamp);
|
|
6523
|
+
if (start === end) return;
|
|
6524
|
+
const extent = stack.extentAt(category).map(clamp);
|
|
6525
|
+
if (segment.end > 0 && end === extent[1]) return horizontal ? "right" : "top";
|
|
6526
|
+
if (segment.end < 0 && end === extent[0]) return horizontal ? "left" : "bottom";
|
|
6527
|
+
}
|
|
6528
|
+
const StackedBarSeries = ({ barClassName, slotKeys, slotKey, groupPadding, stack, ...props }) => {
|
|
6529
|
+
const { xScale, yScale, horizontal } = useContext(DataContext);
|
|
6530
|
+
const bandScale = horizontal ? yScale : xScale;
|
|
6531
|
+
const valueScale = horizontal ? xScale : yScale;
|
|
6532
|
+
const groupScale = useMemo(() => createGroupScale(slotKeys, bandScale?.bandwidth?.() ?? 0, groupPadding), [
|
|
6533
|
+
slotKeys,
|
|
6534
|
+
bandScale,
|
|
6535
|
+
groupPadding
|
|
6536
|
+
]);
|
|
6537
|
+
const { dataKey, xAccessor, yAccessor } = props;
|
|
6538
|
+
const [domainStart, domainEnd] = (horizontal ? xScale : yScale)?.domain() ?? [-Infinity, Infinity];
|
|
6539
|
+
const domainMin = Math.min(Number(domainStart), Number(domainEnd));
|
|
6540
|
+
const domainMax = Math.max(Number(domainStart), Number(domainEnd));
|
|
6541
|
+
const clamp = useCallback((value) => Math.min(domainMax, Math.max(domainMin, value)), [domainMin, domainMax]);
|
|
6542
|
+
const stackEnd = useCallback((datum) => {
|
|
6543
|
+
const [low, high] = stack.extentAt(datum);
|
|
6544
|
+
return clamp(high > 0 ? high : low);
|
|
6545
|
+
}, [stack, clamp]);
|
|
6546
|
+
const renderGlyph = useCallback(({ datum, color }) => {
|
|
6547
|
+
const segment = stack.segmentOf(dataKey, datum);
|
|
6548
|
+
if (!segment || !bandScale?.bandwidth || !valueScale) return null;
|
|
6549
|
+
const rect = computeSlotRect({
|
|
6550
|
+
horizontal: !!horizontal,
|
|
6551
|
+
bandPosition: Number(bandScale((horizontal ? yAccessor : xAccessor)(datum))),
|
|
6552
|
+
slotOffset: groupScale(slotKey) ?? 0,
|
|
6553
|
+
slotThickness: groupScale.bandwidth(),
|
|
6554
|
+
valuePositions: [segment.start, segment.end].map((value) => getValueScalePosition(valueScale, value)),
|
|
6555
|
+
widthFactor: 1
|
|
6556
|
+
});
|
|
6557
|
+
return /* @__PURE__ */ jsx("rect", {
|
|
6558
|
+
...rect,
|
|
6559
|
+
"data-stack-end": getStackEnd(stack, segment, datum, !!horizontal, clamp),
|
|
6560
|
+
className: clsx("visx-bar", barClassName?.(datum)),
|
|
6561
|
+
fill: color
|
|
6562
|
+
});
|
|
6563
|
+
}, [
|
|
6564
|
+
stack,
|
|
6565
|
+
clamp,
|
|
6566
|
+
dataKey,
|
|
6567
|
+
bandScale,
|
|
6568
|
+
valueScale,
|
|
6569
|
+
horizontal,
|
|
6570
|
+
groupScale,
|
|
6571
|
+
slotKey,
|
|
6572
|
+
xAccessor,
|
|
6573
|
+
yAccessor,
|
|
6574
|
+
barClassName
|
|
6575
|
+
]);
|
|
6576
|
+
return /* @__PURE__ */ jsx(GlyphSeries, {
|
|
6577
|
+
...props,
|
|
6578
|
+
xAccessor: horizontal ? stackEnd : xAccessor,
|
|
6579
|
+
yAccessor: horizontal ? yAccessor : stackEnd,
|
|
6580
|
+
enableEvents: false,
|
|
6581
|
+
renderGlyph
|
|
6582
|
+
});
|
|
6583
|
+
};
|
|
6584
|
+
// src/charts/bar-chart/private/bar-layer.tsx
|
|
6585
|
+
/**
|
|
6586
|
+
* Wraps the stacked bars so the entrance animation grows them from the zero line.
|
|
6587
|
+
*
|
|
6588
|
+
* Reading the scales here, not in `BarLayer`, keeps the series' own data registration from re-rendering it in a loop.
|
|
6589
|
+
*
|
|
6590
|
+
* @param props - Component props.
|
|
6591
|
+
* @param props.horizontal - Whether the bars run horizontally.
|
|
6592
|
+
* @param props.children - The stacked series.
|
|
6593
|
+
* @return The group.
|
|
6594
|
+
*/
|
|
6595
|
+
const StackedBarGroup = ({ horizontal, children }) => {
|
|
6596
|
+
const { xScale, yScale } = useContext(DataContext);
|
|
6597
|
+
const valueScale = horizontal ? xScale : yScale;
|
|
6598
|
+
const zero = valueScale ? getValueScalePosition(valueScale, 0) : 0;
|
|
6599
|
+
return /* @__PURE__ */ jsx("g", {
|
|
6600
|
+
className: "visx-bar-group",
|
|
6601
|
+
style: { transformOrigin: horizontal ? `${zero}px 0` : `0 ${zero}px` },
|
|
6602
|
+
children
|
|
6603
|
+
});
|
|
6604
|
+
};
|
|
6605
|
+
/**
|
|
6606
|
+
* Draws the bars in front of any comparison shadows, stacked or slotted in the layout's slots and grouped by visx otherwise, then the selected bar's ring.
|
|
6607
|
+
*
|
|
6608
|
+
* @param props - Component props.
|
|
6609
|
+
* @param props.chartId - The chart's id, which keeps the ring's clip path unique on a page with several charts.
|
|
6610
|
+
* @param props.barSlots - The overlap or stacked slots, or undefined for a grouped layout.
|
|
6611
|
+
* @param props.selectedBar - The bar or slot the keyboard has selected.
|
|
6612
|
+
* @param props.primaryEntries - The visible primary series, for a grouped layout.
|
|
6613
|
+
* @param props.primaryKeys - Their labels, in group order.
|
|
6614
|
+
* @param props.getBarBackground - Reads a series' bar fill.
|
|
6615
|
+
* @param props.barClassName - Adds classes to a bar.
|
|
6616
|
+
* @param props.groupPadding - The padding between the bars of a category.
|
|
6326
6617
|
* @param props.horizontal - Whether the bars run horizontally.
|
|
6327
6618
|
* @param props.xAccessor - Reads a datum's x value.
|
|
6328
6619
|
* @param props.yAccessor - Reads a datum's y value.
|
|
6329
6620
|
* @return The bars.
|
|
6330
6621
|
*/
|
|
6331
|
-
const BarLayer = ({ chartId,
|
|
6622
|
+
const BarLayer = ({ chartId, barSlots, selectedBar, primaryEntries, primaryKeys, getBarBackground, barClassName, groupPadding, horizontal, xAccessor, yAccessor }) => {
|
|
6332
6623
|
let bars;
|
|
6333
|
-
if (
|
|
6624
|
+
if (barSlots?.kind === "stacked") bars = /* @__PURE__ */ jsx(StackedBarGroup, {
|
|
6625
|
+
horizontal,
|
|
6626
|
+
children: barSlots.entries.map(({ series, index }) => /* @__PURE__ */ jsx(StackedBarSeries, {
|
|
6627
|
+
dataKey: series.label,
|
|
6628
|
+
data: series.data,
|
|
6629
|
+
xAccessor,
|
|
6630
|
+
yAccessor,
|
|
6631
|
+
colorAccessor: getBarBackground(index),
|
|
6632
|
+
barClassName,
|
|
6633
|
+
slotKeys: barSlots.slotKeys,
|
|
6634
|
+
slotKey: barSlots.slotOf(series.label),
|
|
6635
|
+
groupPadding,
|
|
6636
|
+
stack: barSlots.stack
|
|
6637
|
+
}, series.label))
|
|
6638
|
+
});
|
|
6639
|
+
else if (barSlots) bars = /* @__PURE__ */ jsx("g", {
|
|
6334
6640
|
className: "visx-bar-group",
|
|
6335
|
-
children:
|
|
6641
|
+
children: barSlots.entries.map(({ series, index }) => /* @__PURE__ */ jsx(SlottedBarSeries, {
|
|
6336
6642
|
dataKey: series.label,
|
|
6337
6643
|
data: series.data,
|
|
6338
6644
|
xAccessor,
|
|
6339
6645
|
yAccessor,
|
|
6340
6646
|
colorAccessor: getBarBackground(index),
|
|
6341
6647
|
barClassName,
|
|
6342
|
-
slotKeys:
|
|
6343
|
-
slotKey:
|
|
6344
|
-
thickness:
|
|
6648
|
+
slotKeys: barSlots.slotKeys,
|
|
6649
|
+
slotKey: barSlots.slotOf(series.label),
|
|
6650
|
+
thickness: barSlots.thicknessOf(series.label),
|
|
6345
6651
|
groupPadding
|
|
6346
6652
|
}, series.label))
|
|
6347
6653
|
});
|
|
@@ -6371,7 +6677,7 @@ const BarLayer = ({ chartId, overlapSlots, selectedBar, primaryEntries, primaryK
|
|
|
6371
6677
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [bars, selectedBar && /* @__PURE__ */ jsx(SelectedBarRing, {
|
|
6372
6678
|
chartId,
|
|
6373
6679
|
selected: selectedBar,
|
|
6374
|
-
slotKeys:
|
|
6680
|
+
slotKeys: barSlots?.slotKeys ?? primaryKeys,
|
|
6375
6681
|
groupPadding,
|
|
6376
6682
|
horizontal,
|
|
6377
6683
|
xAccessor,
|
|
@@ -6507,28 +6813,36 @@ function getOverlapBarColors(series, colors, slotColors, background) {
|
|
|
6507
6813
|
});
|
|
6508
6814
|
return barColors;
|
|
6509
6815
|
}
|
|
6510
|
-
// src/charts/bar-chart/private/use-
|
|
6511
|
-
/**
|
|
6512
|
-
* Whether two data points sit at the same category: the same label, or the same date.
|
|
6513
|
-
*
|
|
6514
|
-
* @param point - A data point.
|
|
6515
|
-
* @param category - The data point naming the category.
|
|
6516
|
-
* @return Whether `point` is at `category`.
|
|
6517
|
-
*/
|
|
6518
|
-
function isSameCategory(point, category) {
|
|
6519
|
-
return category.label ? point.label === category.label : !!category.date && !!point.date && point.date.getTime() === category.date.getTime();
|
|
6520
|
-
}
|
|
6816
|
+
// src/charts/bar-chart/private/use-bar-slots.ts
|
|
6521
6817
|
/**
|
|
6522
|
-
* Lays out the visible series
|
|
6818
|
+
* Lays out the visible series in slots: overlap layers primaries and comparisons in two, stacked puts every primary in one.
|
|
6523
6819
|
*
|
|
6524
|
-
* @param
|
|
6820
|
+
* @param layout - How the chart places its series in a category.
|
|
6525
6821
|
* @param seriesWithVisibility - Every series, with its index and whether it is visible.
|
|
6526
|
-
* @return The
|
|
6822
|
+
* @return The slots, or undefined for a grouped layout.
|
|
6527
6823
|
*/
|
|
6528
|
-
function
|
|
6824
|
+
function useBarSlots(layout, seriesWithVisibility) {
|
|
6529
6825
|
return useMemo(() => {
|
|
6530
|
-
if (
|
|
6826
|
+
if (layout === "grouped") return;
|
|
6531
6827
|
const visible = seriesWithVisibility.filter(({ isVisible }) => isVisible);
|
|
6828
|
+
if (layout === "stacked") {
|
|
6829
|
+
const entries = visible.map(({ series, index }) => ({
|
|
6830
|
+
series,
|
|
6831
|
+
index
|
|
6832
|
+
}));
|
|
6833
|
+
const slotKeys = [PRIMARY_SLOT];
|
|
6834
|
+
const slotOf = () => PRIMARY_SLOT;
|
|
6835
|
+
return {
|
|
6836
|
+
kind: "stacked",
|
|
6837
|
+
stack: getStackLayout(entries.map(({ series }) => series)),
|
|
6838
|
+
entries,
|
|
6839
|
+
keys: entries.map(({ series }) => series.label),
|
|
6840
|
+
slotKeys,
|
|
6841
|
+
slotOf,
|
|
6842
|
+
thicknessOf: () => 1,
|
|
6843
|
+
positions: getStopPositions(entries, slotKeys, slotOf)
|
|
6844
|
+
};
|
|
6845
|
+
}
|
|
6532
6846
|
const placements = getOverlapPlacements(visible.map(({ series }) => series));
|
|
6533
6847
|
const placed = visible.map(({ series, index }, position) => ({
|
|
6534
6848
|
entry: {
|
|
@@ -6545,6 +6859,7 @@ function useOverlapSlots(enabled, seriesWithVisibility) {
|
|
|
6545
6859
|
const showsComparisons = entries.some(({ series }) => slotOf(series.label) === COMPARISON_SLOT);
|
|
6546
6860
|
const slotKeys = [...hasPrimaries ? [PRIMARY_SLOT] : [], ...showsComparisons ? [COMPARISON_SLOT] : []];
|
|
6547
6861
|
return {
|
|
6862
|
+
kind: "overlap",
|
|
6548
6863
|
entries,
|
|
6549
6864
|
keys: entries.map(({ series }) => series.label),
|
|
6550
6865
|
slotKeys,
|
|
@@ -6552,16 +6867,7 @@ function useOverlapSlots(enabled, seriesWithVisibility) {
|
|
|
6552
6867
|
thicknessOf,
|
|
6553
6868
|
positions: getStopPositions(entries, slotKeys, slotOf)
|
|
6554
6869
|
};
|
|
6555
|
-
}, [
|
|
6556
|
-
}
|
|
6557
|
-
/**
|
|
6558
|
-
* The category a data point sits at, as a key two points share when `isSameCategory` holds.
|
|
6559
|
-
*
|
|
6560
|
-
* @param point - A data point.
|
|
6561
|
-
* @return The category key.
|
|
6562
|
-
*/
|
|
6563
|
-
function categoryKey(point) {
|
|
6564
|
-
return point.label ? `label:${point.label}` : `date:${point.date?.getTime()}`;
|
|
6870
|
+
}, [layout, seriesWithVisibility]);
|
|
6565
6871
|
}
|
|
6566
6872
|
/**
|
|
6567
6873
|
* Lists a stop for every slot at every category that slot draws a bar at, category by category.
|
|
@@ -6620,7 +6926,7 @@ function membersAt(entries, category, stopKey) {
|
|
|
6620
6926
|
/**
|
|
6621
6927
|
* The slot a keyboard index selects, and every bar at its category.
|
|
6622
6928
|
*
|
|
6623
|
-
* @param slots - The overlap
|
|
6929
|
+
* @param slots - The overlap or stacked slots.
|
|
6624
6930
|
* @param selectedIndex - The keyboard index into `slots.positions`.
|
|
6625
6931
|
* @return The selected slot, or undefined when nothing is selected or drawn there.
|
|
6626
6932
|
*/
|
|
@@ -6634,25 +6940,26 @@ function getSelectedSlot(slots, selectedIndex) {
|
|
|
6634
6940
|
data: slotBars.map(({ datum }) => datum),
|
|
6635
6941
|
slotKey,
|
|
6636
6942
|
thickness: Math.max(...slotBars.map(({ key }) => slots.thicknessOf(key))),
|
|
6637
|
-
members
|
|
6943
|
+
members,
|
|
6944
|
+
...slots.kind === "stacked" && { valueExtent: slots.stack.extentAt(category) }
|
|
6638
6945
|
};
|
|
6639
6946
|
}
|
|
6640
6947
|
// src/charts/bar-chart/private/use-bar-stops.ts
|
|
6641
6948
|
/**
|
|
6642
|
-
* Lays out the keyboard stops: one per slot and category in
|
|
6949
|
+
* Lays out the keyboard stops: one per slot and category in a slotted layout, else one per primary bar, series-major within each category.
|
|
6643
6950
|
*
|
|
6644
|
-
* @param
|
|
6951
|
+
* @param barSlots - The overlap or stacked slots, or undefined for a grouped layout.
|
|
6645
6952
|
* @param primaryEntries - The visible primary series.
|
|
6646
6953
|
* @return The stops.
|
|
6647
6954
|
*/
|
|
6648
|
-
function useBarStops(
|
|
6649
|
-
const series = useMemo(() =>
|
|
6955
|
+
function useBarStops(barSlots, primaryEntries) {
|
|
6956
|
+
const series = useMemo(() => barSlots ? [] : primaryEntries.map((entry) => entry.series), [barSlots, primaryEntries]);
|
|
6650
6957
|
return {
|
|
6651
|
-
count:
|
|
6652
|
-
key: useMemo(() => JSON.stringify(
|
|
6958
|
+
count: barSlots?.positions.length ?? Math.max(0, ...series.map((item) => item.data.length)) * series.length,
|
|
6959
|
+
key: useMemo(() => JSON.stringify(barSlots?.keys ?? series.map((item) => item.label)), [barSlots, series]),
|
|
6653
6960
|
barAt: useCallback((stop) => {
|
|
6654
|
-
if (
|
|
6655
|
-
const position =
|
|
6961
|
+
if (barSlots) {
|
|
6962
|
+
const position = barSlots.positions[stop];
|
|
6656
6963
|
return position && {
|
|
6657
6964
|
datum: position.datum,
|
|
6658
6965
|
index: position.dataPointIndex,
|
|
@@ -6668,17 +6975,17 @@ function useBarStops(overlapSlots, primaryEntries) {
|
|
|
6668
6975
|
index,
|
|
6669
6976
|
key: item.label
|
|
6670
6977
|
} : void 0;
|
|
6671
|
-
}, [
|
|
6978
|
+
}, [barSlots, series]),
|
|
6672
6979
|
stopOf: useCallback((seriesKey, dataPointIndex) => {
|
|
6673
|
-
if (
|
|
6674
|
-
const hovered =
|
|
6675
|
-
const slotKey =
|
|
6676
|
-
const stop = hovered ?
|
|
6980
|
+
if (barSlots) {
|
|
6981
|
+
const hovered = barSlots.entries.find((entry) => entry.series.label === seriesKey)?.series.data[dataPointIndex];
|
|
6982
|
+
const slotKey = barSlots.slotOf(seriesKey);
|
|
6983
|
+
const stop = hovered ? barSlots.positions.findIndex((position) => position.slotKey === slotKey && isSameCategory(position.datum, hovered)) : -1;
|
|
6677
6984
|
return stop >= 0 ? stop : void 0;
|
|
6678
6985
|
}
|
|
6679
6986
|
const seriesIndex = series.findIndex((item) => item.label === seriesKey);
|
|
6680
6987
|
return seriesIndex >= 0 ? dataPointIndex * series.length + seriesIndex : void 0;
|
|
6681
|
-
}, [
|
|
6988
|
+
}, [barSlots, series])
|
|
6682
6989
|
};
|
|
6683
6990
|
}
|
|
6684
6991
|
/**
|
|
@@ -6833,10 +7140,23 @@ function nearestBandIndex(data, accessor, scale, position) {
|
|
|
6833
7140
|
return nearest;
|
|
6834
7141
|
}
|
|
6835
7142
|
/**
|
|
7143
|
+
* How far a pointer sits from a stacked segment along the value axis.
|
|
7144
|
+
*
|
|
7145
|
+
* @param segment - The segment, or undefined when its series has no reading there.
|
|
7146
|
+
* @param scale - The value scale.
|
|
7147
|
+
* @param position - Pointer coordinate on the value axis.
|
|
7148
|
+
* @return 0 inside the segment, Infinity without one, otherwise the gap to its nearer end.
|
|
7149
|
+
*/
|
|
7150
|
+
function distanceToSegment(segment, scale, position) {
|
|
7151
|
+
if (!segment) return Infinity;
|
|
7152
|
+
const [low, high] = [segment.start, segment.end].map((value) => getValueScalePosition(scale, value)).sort((a, b) => a - b);
|
|
7153
|
+
return Math.max(low - position, 0, position - high);
|
|
7154
|
+
}
|
|
7155
|
+
/**
|
|
6836
7156
|
* Correct visx's range-based band inversion, which omits outer padding.
|
|
6837
7157
|
* @param root0 - Registered series selection.
|
|
6838
7158
|
* @param root0.keys - Visible series keys, back to front where bars overlap.
|
|
6839
|
-
* @param root0.slots - Where series share slots: the slots of a category, in the order the band lays them out,
|
|
7159
|
+
* @param root0.slots - Where series share slots: the slots of a category, in the order the band lays them out, the slot each series sits in, and for a stack where each segment runs.
|
|
6840
7160
|
* @param root0.groupPadding - Padding between grouped bars.
|
|
6841
7161
|
* @param root0.withTooltips - Whether pointer events update the tooltip.
|
|
6842
7162
|
* @param root0.onPointerDown - Receives the corrected pointer-down datum.
|
|
@@ -6848,6 +7168,7 @@ function BandTooltip({ keys, slots, groupPadding, withTooltips, onPointerDown, o
|
|
|
6848
7168
|
const { xScale, yScale, dataRegistry, horizontal } = useContext(DataContext);
|
|
6849
7169
|
const { showTooltip, hideTooltip, updateTooltip } = useContext(TooltipContext);
|
|
6850
7170
|
const scale = horizontal ? yScale : xScale;
|
|
7171
|
+
const valueScale = horizontal ? xScale : yScale;
|
|
6851
7172
|
const bandwidth = scale?.bandwidth?.() ?? 0;
|
|
6852
7173
|
const groupScale = useMemo(() => createGroupScale(slots?.keys ?? keys, bandwidth, groupPadding), [
|
|
6853
7174
|
slots,
|
|
@@ -6872,6 +7193,7 @@ function BandTooltip({ keys, slots, groupPadding, withTooltips, onPointerDown, o
|
|
|
6872
7193
|
const start = band + Number(groupScale(slots ? slots.slotOf(key) : key));
|
|
6873
7194
|
const end = start + groupScale.step();
|
|
6874
7195
|
const distance = position >= start && position <= end ? 0 : Math.abs(position - (start + end) / 2);
|
|
7196
|
+
const valueDistance = slots?.stack && valueScale ? distanceToSegment(slots.stack.segmentOf(key, datum), valueScale, horizontal ? point.x : point.y) : 0;
|
|
6875
7197
|
bands.push(band);
|
|
6876
7198
|
selections.push({
|
|
6877
7199
|
event: params.event,
|
|
@@ -6879,8 +7201,8 @@ function BandTooltip({ keys, slots, groupPadding, withTooltips, onPointerDown, o
|
|
|
6879
7201
|
datum,
|
|
6880
7202
|
index,
|
|
6881
7203
|
svgPoint: point,
|
|
6882
|
-
distanceX: horizontal ?
|
|
6883
|
-
distanceY: horizontal ? distance :
|
|
7204
|
+
distanceX: horizontal ? valueDistance : distance,
|
|
7205
|
+
distanceY: horizontal ? distance : valueDistance
|
|
6884
7206
|
});
|
|
6885
7207
|
}
|
|
6886
7208
|
if (!slots) return selections;
|
|
@@ -6889,6 +7211,7 @@ function BandTooltip({ keys, slots, groupPadding, withTooltips, onPointerDown, o
|
|
|
6889
7211
|
return selections.filter((_, index) => bands[index] === hoveredBand);
|
|
6890
7212
|
}, [
|
|
6891
7213
|
scale,
|
|
7214
|
+
valueScale,
|
|
6892
7215
|
dataRegistry,
|
|
6893
7216
|
horizontal,
|
|
6894
7217
|
keys,
|
|
@@ -6982,6 +7305,16 @@ function useBarColors() {
|
|
|
6982
7305
|
data,
|
|
6983
7306
|
index
|
|
6984
7307
|
}).color);
|
|
7308
|
+
if (layout === "stacked") {
|
|
7309
|
+
const drawn = getDrawnSeries(series, layout);
|
|
7310
|
+
return series.map((data, index) => {
|
|
7311
|
+
const drawnIndex = drawn.indexOf(data);
|
|
7312
|
+
return drawnIndex === -1 ? colors[index] : getElementStyles({
|
|
7313
|
+
data,
|
|
7314
|
+
index: drawnIndex
|
|
7315
|
+
}).color;
|
|
7316
|
+
});
|
|
7317
|
+
}
|
|
6985
7318
|
if (layout !== "overlap") return comparisonOpacity === void 0 ? getGroupedBarColors(series, colors, backgroundColor) : colors;
|
|
6986
7319
|
return getOverlapBarColors(series, colors, [getElementStyles({ index: 0 }).color, getElementStyles({ index: 1 }).color], backgroundColor);
|
|
6987
7320
|
}, [
|
|
@@ -7030,13 +7363,14 @@ function forBarLayout(data, items, layout, seriesColors) {
|
|
|
7030
7363
|
/**
|
|
7031
7364
|
* Builds legend items that match `BarChart`'s bars in a layout, for a custom legend or a chart's own.
|
|
7032
7365
|
*
|
|
7033
|
-
* @param
|
|
7366
|
+
* @param allData - The chart's series; those the layout does not draw get no item.
|
|
7034
7367
|
* @param options - The legend options, and the layout the bars are drawn in.
|
|
7035
7368
|
* @param legendShape - The shape of the legend swatches.
|
|
7036
7369
|
* @return The legend items.
|
|
7037
7370
|
*/
|
|
7038
|
-
function useBarLegendItems(
|
|
7371
|
+
function useBarLegendItems(allData, options = {}, legendShape) {
|
|
7039
7372
|
const { layout } = options;
|
|
7373
|
+
const data = useMemo(() => getDrawnSeries(allData, layout), [allData, layout]);
|
|
7040
7374
|
const getBarColors = useBarColors();
|
|
7041
7375
|
const seriesColors = useMemo(() => layout ? getBarColors(data, { layout }) : void 0, [
|
|
7042
7376
|
data,
|
|
@@ -7065,7 +7399,12 @@ const renderTooltipRow = (label, value) => /* @__PURE__ */ jsx("div", {
|
|
|
7065
7399
|
className: bar_chart_module_default["bar-chart__tooltip-row"],
|
|
7066
7400
|
children: sprintf(__("%1$s: %2$s", "jetpack-charts"), label, value)
|
|
7067
7401
|
});
|
|
7068
|
-
const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, height, className, margin, withTooltips = false, showLegend = false, legend = {}, gridVisibility: gridVisibilityProp, renderTooltip, tooltipPlacement, tooltipAnchorTop, tooltipStyle, barClassName, options = {}, orientation = "vertical", layout = "grouped", withPatterns = false, showZeroValues = false, withBandHighlight = false, onBandHighlightChange, defaultHiddenSeries, animation, children, gap = "md", onPointerDown, onPointerUp, onDatumActivate }) => {
|
|
7402
|
+
const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, height, className, margin, withTooltips = false, showLegend = false, legend = {}, gridVisibility: gridVisibilityProp, renderTooltip, tooltipPlacement, tooltipAnchorTop, tooltipStyle, barClassName, options = {}, orientation = "vertical", layout = "grouped", withPatterns = false, showZeroValues = false, withBandHighlight = false, onBandHighlightChange, defaultHiddenSeries, animation, children, gap = "md", compactWhenShort = false, onPointerDown, onPointerUp, onDatumActivate }) => {
|
|
7403
|
+
if (layout === "stacked" && showZeroValues) warnOnce("bar-chart-stacked-zero-values", "BarChart: showZeroValues has no effect in a stacked layout.");
|
|
7404
|
+
if (layout === "stacked" && data?.some((series) => series.options?.type === "comparison")) warnOnce("bar-chart-stacked-comparison", "BarChart: a stacked layout does not draw comparison series yet.");
|
|
7405
|
+
const valueScaleOptions = orientation === "horizontal" ? options.xScale : options.yScale;
|
|
7406
|
+
if (layout === "stacked" && valueScaleOptions?.type && valueScaleOptions.type !== "linear") warnOnce(`bar-chart-stacked-${valueScaleOptions.type}-scale`, `BarChart: a stacked layout draws on a linear value scale, so the ${valueScaleOptions.type} scale is ignored.`);
|
|
7407
|
+
if (layout === "stacked" && valueScaleOptions?.zero === false && !valueScaleOptions.domain) warnOnce("bar-chart-stacked-zero", "BarChart: every stack starts at zero, so zero: false has no effect in a stacked layout.");
|
|
7069
7408
|
if (!withTooltips && (withBandHighlight || onBandHighlightChange)) warnOnce("bar-chart-band-highlight-without-tooltips", "BarChart: withBandHighlight and onBandHighlightChange require withTooltips.");
|
|
7070
7409
|
const legendInteractive = legend.interactive ?? false;
|
|
7071
7410
|
const legendCollapseGroups = legend.collapseGroups ?? false;
|
|
@@ -7073,13 +7412,15 @@ const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, he
|
|
|
7073
7412
|
const legendComparisonSeriesItems = legend.comparisonSeriesItems;
|
|
7074
7413
|
const horizontal = orientation === "horizontal";
|
|
7075
7414
|
const isOverlap = layout === "overlap";
|
|
7415
|
+
const isStacked = layout === "stacked";
|
|
7076
7416
|
const chartId = useChartId(providedChartId);
|
|
7077
7417
|
const hiddenSeries = useDefaultHiddenSeries(chartId, defaultHiddenSeries);
|
|
7078
7418
|
const isSeriesVisible = useCallback((seriesLabel) => !hiddenSeries.has(seriesLabel), [hiddenSeries]);
|
|
7079
7419
|
const theme = useXYChartTheme(data);
|
|
7080
|
-
const
|
|
7420
|
+
const transformedData = useChartDataTransform(data);
|
|
7421
|
+
const dataSorted = useMemo(() => getDrawnSeries(transformedData, layout), [layout, transformedData]);
|
|
7081
7422
|
const dataWithVisibleZeros = useZeroValueDisplay(dataSorted, {
|
|
7082
|
-
enabled: showZeroValues,
|
|
7423
|
+
enabled: showZeroValues && !isStacked,
|
|
7083
7424
|
valueAxisLength: horizontal ? width : height
|
|
7084
7425
|
});
|
|
7085
7426
|
const legendItems = useBarLegendItems(dataSorted, useMemo(() => ({
|
|
@@ -7103,13 +7444,39 @@ const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, he
|
|
|
7103
7444
|
if (providerTheme.barChart?.barStyles?.comparison?.opacity !== void 0) warnOnce("bar-chart-comparison-opacity", "BarChart: theme.barChart.barStyles.comparison.opacity is deprecated. Comparison bars are opaque; leave it unset.");
|
|
7104
7445
|
const isSeriesRendered = useCallback((series) => isSeriesVisible(series.label), [isSeriesVisible]);
|
|
7105
7446
|
const hasWholeNumberValues = useMemo(() => hasOnlyWholeNumbers(dataSorted.filter(isSeriesRendered)), [dataSorted, isSeriesRendered]);
|
|
7106
|
-
const
|
|
7447
|
+
const { isCompact, compactMargin } = useCompactWhenShort(compactWhenShort && !horizontal, height);
|
|
7448
|
+
const resolvedOptions = useMemo(() => isCompact ? {
|
|
7449
|
+
...options,
|
|
7450
|
+
axis: {
|
|
7451
|
+
...options.axis,
|
|
7452
|
+
x: {
|
|
7453
|
+
...options.axis?.x,
|
|
7454
|
+
display: false
|
|
7455
|
+
},
|
|
7456
|
+
y: {
|
|
7457
|
+
...options.axis?.y,
|
|
7458
|
+
display: false
|
|
7459
|
+
}
|
|
7460
|
+
}
|
|
7461
|
+
} : options, [isCompact, options]);
|
|
7462
|
+
const seriesWithVisibility = useMemo(() => dataWithVisibleZeros.map((series, index) => ({
|
|
7463
|
+
series,
|
|
7464
|
+
index,
|
|
7465
|
+
isVisible: isSeriesRendered(series)
|
|
7466
|
+
})), [dataWithVisibleZeros, isSeriesRendered]);
|
|
7467
|
+
const allSeriesHidden = useMemo(() => {
|
|
7468
|
+
return seriesWithVisibility.every(({ isVisible }) => !isVisible);
|
|
7469
|
+
}, [seriesWithVisibility]);
|
|
7470
|
+
const primaryEntries = useMemo(() => seriesWithVisibility.filter(({ isVisible, series }) => isVisible && series.options?.type !== "comparison"), [seriesWithVisibility]);
|
|
7471
|
+
const barSlots = useBarSlots(layout, seriesWithVisibility);
|
|
7472
|
+
const chartOptions = useBarChartOptions(dataWithVisibleZeros, horizontal, resolvedOptions, isSeriesRendered, barSlots?.kind === "stacked" ? barSlots.stack : void 0);
|
|
7107
7473
|
const valueAxis = horizontal ? chartOptions.axis.x : chartOptions.axis.y;
|
|
7108
7474
|
const callerValueDomain = horizontal ? options.xScale?.domain : options.yScale?.domain;
|
|
7109
|
-
const
|
|
7475
|
+
const valueTickDecimals = getTickDecimals(hasWholeNumberValues, chartOptions.valueTickDecimals);
|
|
7476
|
+
const tickDecimalsProps = {
|
|
7110
7477
|
axis: horizontal ? "x" : "y",
|
|
7111
7478
|
numTicks: valueAxis.numTicks,
|
|
7112
|
-
|
|
7479
|
+
decimals: !valueAxis.tickValues && !callerValueDomain ? valueTickDecimals : void 0
|
|
7113
7480
|
};
|
|
7114
7481
|
const defaultMargin = useChartMargin(height, chartOptions, dataSorted, theme, horizontal);
|
|
7115
7482
|
const chartRef = useRef(null);
|
|
@@ -7120,18 +7487,8 @@ const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, he
|
|
|
7120
7487
|
}, [height]);
|
|
7121
7488
|
const [selectedIndex, setSelectedIndex] = useState(void 0);
|
|
7122
7489
|
const [isNavigating, setIsNavigating] = useState(false);
|
|
7123
|
-
const seriesWithVisibility = useMemo(() => dataWithVisibleZeros.map((series, index) => ({
|
|
7124
|
-
series,
|
|
7125
|
-
index,
|
|
7126
|
-
isVisible: isSeriesRendered(series)
|
|
7127
|
-
})), [dataWithVisibleZeros, isSeriesRendered]);
|
|
7128
|
-
const allSeriesHidden = useMemo(() => {
|
|
7129
|
-
return seriesWithVisibility.every(({ isVisible }) => !isVisible);
|
|
7130
|
-
}, [seriesWithVisibility]);
|
|
7131
|
-
const primaryEntries = useMemo(() => seriesWithVisibility.filter(({ isVisible, series }) => isVisible && series.options?.type !== "comparison"), [seriesWithVisibility]);
|
|
7132
|
-
const overlapSlots = useOverlapSlots(isOverlap, seriesWithVisibility);
|
|
7133
7490
|
const primaryKeys = useMemo(() => primaryEntries.map(({ series }) => series.label), [primaryEntries]);
|
|
7134
|
-
const stops = useBarStops(
|
|
7491
|
+
const stops = useBarStops(barSlots, primaryEntries);
|
|
7135
7492
|
const { barAt, stopOf } = stops;
|
|
7136
7493
|
const activateSelectedBar = useCallback((stop) => {
|
|
7137
7494
|
const bar = barAt(stop);
|
|
@@ -7152,7 +7509,7 @@ const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, he
|
|
|
7152
7509
|
if (stop !== void 0) onChartPointerMove(stop);
|
|
7153
7510
|
}, [stopOf, onChartPointerMove]);
|
|
7154
7511
|
const comparisonEntries = useMemo(() => {
|
|
7155
|
-
if (
|
|
7512
|
+
if (barSlots) return [];
|
|
7156
7513
|
const primaryByGroup = new Map(primaryEntries.map(({ series, index }) => [series.group, {
|
|
7157
7514
|
label: series.label,
|
|
7158
7515
|
index
|
|
@@ -7173,7 +7530,7 @@ const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, he
|
|
|
7173
7530
|
});
|
|
7174
7531
|
return entries;
|
|
7175
7532
|
}, [
|
|
7176
|
-
|
|
7533
|
+
barSlots,
|
|
7177
7534
|
seriesWithVisibility,
|
|
7178
7535
|
primaryEntries,
|
|
7179
7536
|
primaryKeys
|
|
@@ -7239,6 +7596,32 @@ const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, he
|
|
|
7239
7596
|
})]
|
|
7240
7597
|
});
|
|
7241
7598
|
}, [chartOptions.tooltip, dataSorted]);
|
|
7599
|
+
const renderStackedTooltip = useCallback(({ tooltipData }) => {
|
|
7600
|
+
const nearestDatum = tooltipData?.nearestDatum?.datum;
|
|
7601
|
+
if (!nearestDatum || barSlots?.kind !== "stacked") return null;
|
|
7602
|
+
const datumByKey = tooltipData?.datumByKey ?? {};
|
|
7603
|
+
const categoryLabel = chartOptions.tooltip.labelFormatter(nearestDatum.label || (nearestDatum.date ? nearestDatum.date.getTime() : 0), 0, []);
|
|
7604
|
+
const rows = [...barSlots.entries].reverse().flatMap(({ series }) => {
|
|
7605
|
+
const datum = datumByKey[series.label]?.datum;
|
|
7606
|
+
return datum ? [{
|
|
7607
|
+
label: series.label,
|
|
7608
|
+
datum
|
|
7609
|
+
}] : [];
|
|
7610
|
+
});
|
|
7611
|
+
const readings = rows.filter(({ datum }) => isBarRendered(datum)).length;
|
|
7612
|
+
const [negative, positive] = barSlots.stack.extentAt(nearestDatum);
|
|
7613
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7614
|
+
className: bar_chart_module_default["bar-chart__tooltip"],
|
|
7615
|
+
children: [
|
|
7616
|
+
/* @__PURE__ */ jsx("div", {
|
|
7617
|
+
className: bar_chart_module_default["bar-chart__tooltip-header"],
|
|
7618
|
+
children: categoryLabel
|
|
7619
|
+
}),
|
|
7620
|
+
rows.map(({ label, datum }) => /* @__PURE__ */ jsx(Fragment, { children: renderTooltipRow(label, formatReading(datum.value)) }, label)),
|
|
7621
|
+
readings > 1 && renderTooltipRow(__("Total", "jetpack-charts"), formatReading(negative + positive))
|
|
7622
|
+
]
|
|
7623
|
+
});
|
|
7624
|
+
}, [chartOptions.tooltip, barSlots]);
|
|
7242
7625
|
const renderDefaultTooltip = useCallback(({ tooltipData }) => {
|
|
7243
7626
|
const nearestDatum = tooltipData?.nearestDatum?.datum;
|
|
7244
7627
|
if (!nearestDatum) return null;
|
|
@@ -7310,24 +7693,25 @@ const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, he
|
|
|
7310
7693
|
}
|
|
7311
7694
|
`;
|
|
7312
7695
|
}, [chartId]);
|
|
7313
|
-
const
|
|
7314
|
-
keys:
|
|
7315
|
-
slotOf:
|
|
7316
|
-
|
|
7317
|
-
|
|
7696
|
+
const barBandSlots = useMemo(() => barSlots && {
|
|
7697
|
+
keys: barSlots.slotKeys,
|
|
7698
|
+
slotOf: barSlots.slotOf,
|
|
7699
|
+
stack: barSlots.kind === "stacked" ? barSlots.stack : void 0
|
|
7700
|
+
}, [barSlots]);
|
|
7701
|
+
const selectedSlot = useMemo(() => getSelectedSlot(barSlots, selectedIndex), [barSlots, selectedIndex]);
|
|
7318
7702
|
const selectedGroup = useMemo(() => {
|
|
7319
|
-
const stop =
|
|
7703
|
+
const stop = barSlots || selectedIndex === void 0 ? void 0 : barAt(selectedIndex);
|
|
7320
7704
|
if (!stop) return;
|
|
7321
7705
|
return membersAt(primaryEntries, stop.datum, stop.key);
|
|
7322
7706
|
}, [
|
|
7323
|
-
|
|
7707
|
+
barSlots,
|
|
7324
7708
|
selectedIndex,
|
|
7325
7709
|
barAt,
|
|
7326
7710
|
primaryEntries
|
|
7327
7711
|
]);
|
|
7328
7712
|
const selectedMembers = selectedSlot?.members ?? selectedGroup;
|
|
7329
7713
|
const selectedBar = useMemo(() => {
|
|
7330
|
-
if (
|
|
7714
|
+
if (barSlots) return selectedSlot;
|
|
7331
7715
|
const bar = selectedIndex === void 0 ? void 0 : barAt(selectedIndex);
|
|
7332
7716
|
return bar && isBarRendered(bar.datum) ? {
|
|
7333
7717
|
data: [bar.datum],
|
|
@@ -7335,7 +7719,7 @@ const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, he
|
|
|
7335
7719
|
thickness: 1
|
|
7336
7720
|
} : void 0;
|
|
7337
7721
|
}, [
|
|
7338
|
-
|
|
7722
|
+
barSlots,
|
|
7339
7723
|
selectedSlot,
|
|
7340
7724
|
selectedIndex,
|
|
7341
7725
|
barAt
|
|
@@ -7358,9 +7742,9 @@ const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, he
|
|
|
7358
7742
|
className: clsx("bar-chart", bar_chart_module_default["bar-chart"]),
|
|
7359
7743
|
children: error
|
|
7360
7744
|
});
|
|
7361
|
-
const gridVisibility = gridVisibilityProp ?? chartOptions.gridVisibility;
|
|
7745
|
+
const gridVisibility = isCompact ? "none" : gridVisibilityProp ?? chartOptions.gridVisibility;
|
|
7362
7746
|
const legendPosition = legend.position ?? "bottom";
|
|
7363
|
-
const legendElement = showLegend && /* @__PURE__ */ jsx(Legend, {
|
|
7747
|
+
const legendElement = showLegend && !isCompact && /* @__PURE__ */ jsx(Legend, {
|
|
7364
7748
|
orientation: legend.orientation ?? "horizontal",
|
|
7365
7749
|
position: legendPosition,
|
|
7366
7750
|
alignment: legend.alignment ?? "center",
|
|
@@ -7383,9 +7767,12 @@ const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, he
|
|
|
7383
7767
|
children: /* @__PURE__ */ jsx(ChartLayout, {
|
|
7384
7768
|
legendPosition,
|
|
7385
7769
|
legendElement,
|
|
7386
|
-
legendChildren,
|
|
7770
|
+
legendChildren: isCompact ? [] : legendChildren,
|
|
7387
7771
|
gap,
|
|
7388
|
-
className: clsx("bar-chart", bar_chart_module_default["bar-chart"], {
|
|
7772
|
+
className: clsx("bar-chart", bar_chart_module_default["bar-chart"], {
|
|
7773
|
+
[bar_chart_module_default["bar-chart--stacked"]]: isStacked,
|
|
7774
|
+
[bar_chart_module_default[`bar-chart--animated${horizontal ? "-horizontal" : ""}`]]: animation && !prefersReducedMotion
|
|
7775
|
+
}, className),
|
|
7389
7776
|
style: {
|
|
7390
7777
|
width,
|
|
7391
7778
|
height
|
|
@@ -7412,6 +7799,7 @@ const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, he
|
|
|
7412
7799
|
height: chartHeight,
|
|
7413
7800
|
margin: {
|
|
7414
7801
|
...defaultMargin,
|
|
7802
|
+
...compactMargin,
|
|
7415
7803
|
...margin
|
|
7416
7804
|
},
|
|
7417
7805
|
xScale,
|
|
@@ -7424,8 +7812,8 @@ const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, he
|
|
|
7424
7812
|
horizontal,
|
|
7425
7813
|
onChange: onBandHighlightChange
|
|
7426
7814
|
}),
|
|
7427
|
-
!allSeriesHidden && /* @__PURE__ */ jsx(
|
|
7428
|
-
...
|
|
7815
|
+
!allSeriesHidden && /* @__PURE__ */ jsx(TickDecimals, {
|
|
7816
|
+
...tickDecimalsProps,
|
|
7429
7817
|
children: (valueTicks) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Grid, {
|
|
7430
7818
|
columns: gridVisibility.includes("y"),
|
|
7431
7819
|
rows: false,
|
|
@@ -7444,7 +7832,7 @@ const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, he
|
|
|
7444
7832
|
y: chartHeight / 2,
|
|
7445
7833
|
width,
|
|
7446
7834
|
height: chartHeight,
|
|
7447
|
-
children: getAllHiddenMessage(legendInteractive, "series")
|
|
7835
|
+
children: getAllHiddenMessage(legendInteractive && !isCompact, "series")
|
|
7448
7836
|
}) : null,
|
|
7449
7837
|
/* @__PURE__ */ jsx(ComparisonBars, {
|
|
7450
7838
|
comparisonEntries,
|
|
@@ -7458,7 +7846,7 @@ const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, he
|
|
|
7458
7846
|
}),
|
|
7459
7847
|
/* @__PURE__ */ jsx(BarLayer, {
|
|
7460
7848
|
chartId,
|
|
7461
|
-
|
|
7849
|
+
barSlots,
|
|
7462
7850
|
selectedBar,
|
|
7463
7851
|
primaryEntries,
|
|
7464
7852
|
primaryKeys,
|
|
@@ -7470,16 +7858,16 @@ const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, he
|
|
|
7470
7858
|
yAccessor: chartOptions.accessors.yAccessor
|
|
7471
7859
|
}),
|
|
7472
7860
|
(withTooltips || onPointerDown || onPointerUp) && /* @__PURE__ */ jsx(BandTooltip, {
|
|
7473
|
-
keys:
|
|
7474
|
-
slots:
|
|
7861
|
+
keys: barSlots?.keys ?? primaryKeys,
|
|
7862
|
+
slots: barBandSlots,
|
|
7475
7863
|
groupPadding,
|
|
7476
7864
|
withTooltips,
|
|
7477
7865
|
onPointerDown,
|
|
7478
7866
|
onPointerUp,
|
|
7479
7867
|
onPointerMove: handlePointerMove
|
|
7480
7868
|
}),
|
|
7481
|
-
!allSeriesHidden && /* @__PURE__ */ jsx(
|
|
7482
|
-
...
|
|
7869
|
+
!allSeriesHidden && /* @__PURE__ */ jsx(TickDecimals, {
|
|
7870
|
+
...tickDecimalsProps,
|
|
7483
7871
|
children: (valueTicks) => /* @__PURE__ */ jsxs(Fragment$1, { children: [chartOptions.axis.x.display !== false && /* @__PURE__ */ jsx(Axis, {
|
|
7484
7872
|
...chartOptions.axis.x,
|
|
7485
7873
|
...horizontal && valueTicks ? { tickValues: valueTicks } : {}
|
|
@@ -7496,7 +7884,7 @@ const BarChartInternal = ({ data, ariaLabel, chartId: providedChartId, width, he
|
|
|
7496
7884
|
detectBounds: true,
|
|
7497
7885
|
snapTooltipToDatumX: true,
|
|
7498
7886
|
snapTooltipToDatumY: true,
|
|
7499
|
-
renderTooltip: renderTooltip || (isOverlap ? renderOverlapTooltip : renderDefaultTooltip),
|
|
7887
|
+
renderTooltip: renderTooltip || isStacked && renderStackedTooltip || (isOverlap ? renderOverlapTooltip : renderDefaultTooltip),
|
|
7500
7888
|
selectedIndex,
|
|
7501
7889
|
tooltipRef,
|
|
7502
7890
|
keyboardFocusedClassName: bar_chart_module_default["bar-chart__tooltip--keyboard-focused"],
|
|
@@ -9867,7 +10255,7 @@ var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
|
|
|
9867
10255
|
function noCase(input, options) {
|
|
9868
10256
|
if (options === void 0) options = {};
|
|
9869
10257
|
var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
|
|
9870
|
-
var result = replace
|
|
10258
|
+
var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
|
|
9871
10259
|
var start = 0;
|
|
9872
10260
|
var end = result.length;
|
|
9873
10261
|
while (result.charAt(start) === "\0") start++;
|
|
@@ -9877,7 +10265,7 @@ function noCase(input, options) {
|
|
|
9877
10265
|
/**
|
|
9878
10266
|
* Replace `re` in the input string with the replacement value.
|
|
9879
10267
|
*/
|
|
9880
|
-
function replace
|
|
10268
|
+
function replace(input, re, value) {
|
|
9881
10269
|
if (re instanceof RegExp) return input.replace(re, value);
|
|
9882
10270
|
return re.reduce(function(input, re) {
|
|
9883
10271
|
return input.replace(re, value);
|
|
@@ -9893,12 +10281,33 @@ function paramCase(input, options) {
|
|
|
9893
10281
|
if (options === void 0) options = {};
|
|
9894
10282
|
return dotCase(input, __assign({ delimiter: "-" }, options));
|
|
9895
10283
|
}
|
|
9896
|
-
// ../../../node_modules/.pnpm/@wordpress+warning@
|
|
9897
|
-
|
|
9898
|
-
|
|
10284
|
+
// ../../../node_modules/.pnpm/@wordpress+warning@4.1.0/node_modules/@wordpress/warning/build-module/utils.mjs
|
|
10285
|
+
/**
|
|
10286
|
+
* Object map tracking messages which have been logged, for use in ensuring a
|
|
10287
|
+
* message is only logged once.
|
|
10288
|
+
*/
|
|
10289
|
+
const logged = /* @__PURE__ */ new Set();
|
|
10290
|
+
// ../../../node_modules/.pnpm/@wordpress+warning@4.1.0/node_modules/@wordpress/warning/build-module/index.mjs
|
|
9899
10291
|
function isDev() {
|
|
9900
10292
|
return globalThis.SCRIPT_DEBUG === true;
|
|
9901
10293
|
}
|
|
10294
|
+
/**
|
|
10295
|
+
* Shows a warning with `message` if environment is not `production`.
|
|
10296
|
+
*
|
|
10297
|
+
* @param message Message to show in the warning.
|
|
10298
|
+
*
|
|
10299
|
+
* @example
|
|
10300
|
+
* ```js
|
|
10301
|
+
* import warning from '@wordpress/warning';
|
|
10302
|
+
*
|
|
10303
|
+
* function MyComponent( props ) {
|
|
10304
|
+
* if ( ! props.title ) {
|
|
10305
|
+
* warning( '`props.title` was not passed' );
|
|
10306
|
+
* }
|
|
10307
|
+
* ...
|
|
10308
|
+
* }
|
|
10309
|
+
* ```
|
|
10310
|
+
*/
|
|
9902
10311
|
function warning(message) {
|
|
9903
10312
|
if (!isDev()) return;
|
|
9904
10313
|
if (logged.has(message)) return;
|
|
@@ -9908,7 +10317,61 @@ function warning(message) {
|
|
|
9908
10317
|
} catch {}
|
|
9909
10318
|
logged.add(message);
|
|
9910
10319
|
}
|
|
9911
|
-
// ../../../node_modules/.pnpm
|
|
10320
|
+
// ../../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/es6/index.js
|
|
10321
|
+
var require_es6 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
10322
|
+
module.exports = function equal(a, b) {
|
|
10323
|
+
if (a === b) return true;
|
|
10324
|
+
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
10325
|
+
if (a.constructor !== b.constructor) return false;
|
|
10326
|
+
var length, i, keys;
|
|
10327
|
+
if (Array.isArray(a)) {
|
|
10328
|
+
length = a.length;
|
|
10329
|
+
if (length != b.length) return false;
|
|
10330
|
+
for (i = length; i-- !== 0;) if (!equal(a[i], b[i])) return false;
|
|
10331
|
+
return true;
|
|
10332
|
+
}
|
|
10333
|
+
if (a instanceof Map && b instanceof Map) {
|
|
10334
|
+
if (a.size !== b.size) return false;
|
|
10335
|
+
for (i of a.entries()) if (!b.has(i[0])) return false;
|
|
10336
|
+
for (i of a.entries()) if (!equal(i[1], b.get(i[0]))) return false;
|
|
10337
|
+
return true;
|
|
10338
|
+
}
|
|
10339
|
+
if (a instanceof Set && b instanceof Set) {
|
|
10340
|
+
if (a.size !== b.size) return false;
|
|
10341
|
+
for (i of a.entries()) if (!b.has(i[0])) return false;
|
|
10342
|
+
return true;
|
|
10343
|
+
}
|
|
10344
|
+
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
|
|
10345
|
+
length = a.length;
|
|
10346
|
+
if (length != b.length) return false;
|
|
10347
|
+
for (i = length; i-- !== 0;) if (a[i] !== b[i]) return false;
|
|
10348
|
+
return true;
|
|
10349
|
+
}
|
|
10350
|
+
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
10351
|
+
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
10352
|
+
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
10353
|
+
keys = Object.keys(a);
|
|
10354
|
+
length = keys.length;
|
|
10355
|
+
if (length !== Object.keys(b).length) return false;
|
|
10356
|
+
for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
10357
|
+
for (i = length; i-- !== 0;) {
|
|
10358
|
+
var key = keys[i];
|
|
10359
|
+
if (!equal(a[key], b[key])) return false;
|
|
10360
|
+
}
|
|
10361
|
+
return true;
|
|
10362
|
+
}
|
|
10363
|
+
return a !== a && b !== b;
|
|
10364
|
+
};
|
|
10365
|
+
}));
|
|
10366
|
+
// ../../../node_modules/.pnpm/@wordpress+components@44.0.0_patch_hash=dd89cc780626599c6721f4e05e7091dd7b0aed577d8a667_94a1a77c56d75249398bc99af3f14fa5/node_modules/@wordpress/components/build-module/utils/hooks/use-update-effect.mjs
|
|
10367
|
+
/**
|
|
10368
|
+
* A `React.useEffect` that will not run on the first render.
|
|
10369
|
+
* Source:
|
|
10370
|
+
* https://github.com/ariakit/ariakit/blob/main/packages/ariakit-react-core/src/utils/hooks.ts
|
|
10371
|
+
*
|
|
10372
|
+
* @param effect
|
|
10373
|
+
* @param deps
|
|
10374
|
+
*/
|
|
9912
10375
|
function useUpdateEffect(effect, deps) {
|
|
9913
10376
|
const mountedRef = useRef$1(false);
|
|
9914
10377
|
useEffect$1(() => {
|
|
@@ -9919,1173 +10382,88 @@ function useUpdateEffect(effect, deps) {
|
|
|
9919
10382
|
mountedRef.current = false;
|
|
9920
10383
|
}, []);
|
|
9921
10384
|
}
|
|
9922
|
-
|
|
9923
|
-
|
|
9924
|
-
|
|
9925
|
-
|
|
9926
|
-
|
|
9927
|
-
for (var i = 0; i < document.styleSheets.length; i++) if (document.styleSheets[i].ownerNode === tag) return document.styleSheets[i];
|
|
9928
|
-
}
|
|
9929
|
-
function createStyleElement(options) {
|
|
9930
|
-
var tag = document.createElement("style");
|
|
9931
|
-
tag.setAttribute("data-emotion", options.key);
|
|
9932
|
-
if (options.nonce !== void 0) tag.setAttribute("nonce", options.nonce);
|
|
9933
|
-
tag.appendChild(document.createTextNode(""));
|
|
9934
|
-
tag.setAttribute("data-s", "");
|
|
9935
|
-
return tag;
|
|
9936
|
-
}
|
|
9937
|
-
var StyleSheet = /*#__PURE__*/ function() {
|
|
9938
|
-
function StyleSheet(options) {
|
|
9939
|
-
var _this = this;
|
|
9940
|
-
this._insertTag = function(tag) {
|
|
9941
|
-
var before;
|
|
9942
|
-
if (_this.tags.length === 0) {
|
|
9943
|
-
if (_this.insertionPoint) before = _this.insertionPoint.nextSibling;
|
|
9944
|
-
else if (_this.prepend) before = _this.container.firstChild;
|
|
9945
|
-
else before = _this.before;
|
|
9946
|
-
} else before = _this.tags[_this.tags.length - 1].nextSibling;
|
|
9947
|
-
_this.container.insertBefore(tag, before);
|
|
9948
|
-
_this.tags.push(tag);
|
|
9949
|
-
};
|
|
9950
|
-
this.isSpeedy = options.speedy === void 0 ? true : options.speedy;
|
|
9951
|
-
this.tags = [];
|
|
9952
|
-
this.ctr = 0;
|
|
9953
|
-
this.nonce = options.nonce;
|
|
9954
|
-
this.key = options.key;
|
|
9955
|
-
this.container = options.container;
|
|
9956
|
-
this.prepend = options.prepend;
|
|
9957
|
-
this.insertionPoint = options.insertionPoint;
|
|
9958
|
-
this.before = null;
|
|
9959
|
-
}
|
|
9960
|
-
var _proto = StyleSheet.prototype;
|
|
9961
|
-
_proto.hydrate = function hydrate(nodes) {
|
|
9962
|
-
nodes.forEach(this._insertTag);
|
|
9963
|
-
};
|
|
9964
|
-
_proto.insert = function insert(rule) {
|
|
9965
|
-
if (this.ctr % (this.isSpeedy ? 65e3 : 1) === 0) this._insertTag(createStyleElement(this));
|
|
9966
|
-
var tag = this.tags[this.tags.length - 1];
|
|
9967
|
-
if (this.isSpeedy) {
|
|
9968
|
-
var sheet = sheetForTag(tag);
|
|
9969
|
-
try {
|
|
9970
|
-
sheet.insertRule(rule, sheet.cssRules.length);
|
|
9971
|
-
} catch (e) {}
|
|
9972
|
-
} else tag.appendChild(document.createTextNode(rule));
|
|
9973
|
-
this.ctr++;
|
|
9974
|
-
};
|
|
9975
|
-
_proto.flush = function flush() {
|
|
9976
|
-
this.tags.forEach(function(tag) {
|
|
9977
|
-
var _tag$parentNode;
|
|
9978
|
-
return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag);
|
|
9979
|
-
});
|
|
9980
|
-
this.tags = [];
|
|
9981
|
-
this.ctr = 0;
|
|
9982
|
-
};
|
|
9983
|
-
return StyleSheet;
|
|
9984
|
-
}();
|
|
9985
|
-
// ../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Enum.js
|
|
9986
|
-
var MS = "-ms-";
|
|
9987
|
-
var MOZ = "-moz-";
|
|
9988
|
-
var WEBKIT = "-webkit-";
|
|
9989
|
-
var COMMENT = "comm";
|
|
9990
|
-
var RULESET = "rule";
|
|
9991
|
-
var DECLARATION = "decl";
|
|
9992
|
-
var IMPORT = "@import";
|
|
9993
|
-
var KEYFRAMES = "@keyframes";
|
|
9994
|
-
var LAYER = "@layer";
|
|
9995
|
-
// ../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Utility.js
|
|
9996
|
-
/**
|
|
9997
|
-
* @param {number}
|
|
9998
|
-
* @return {number}
|
|
9999
|
-
*/
|
|
10000
|
-
var abs = Math.abs;
|
|
10001
|
-
/**
|
|
10002
|
-
* @param {number}
|
|
10003
|
-
* @return {string}
|
|
10004
|
-
*/
|
|
10005
|
-
var from = String.fromCharCode;
|
|
10006
|
-
/**
|
|
10007
|
-
* @param {object}
|
|
10008
|
-
* @return {object}
|
|
10009
|
-
*/
|
|
10010
|
-
var assign = Object.assign;
|
|
10385
|
+
// ../../../node_modules/.pnpm/@wordpress+components@44.0.0_patch_hash=dd89cc780626599c6721f4e05e7091dd7b0aed577d8a667_94a1a77c56d75249398bc99af3f14fa5/node_modules/@wordpress/components/build-module/context/context-system-provider.mjs
|
|
10386
|
+
var import_es6 = /* @__PURE__ */ __toESM(require_es6(), 1);
|
|
10387
|
+
const ComponentsContext = createContext$1({});
|
|
10388
|
+
ComponentsContext.displayName = "ComponentsContext";
|
|
10389
|
+
const useComponentsContext = () => useContext$1(ComponentsContext);
|
|
10011
10390
|
/**
|
|
10012
|
-
*
|
|
10013
|
-
*
|
|
10014
|
-
*
|
|
10391
|
+
* Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.
|
|
10392
|
+
*
|
|
10393
|
+
* Note: This function will warn if it detects an un-memoized `value`
|
|
10394
|
+
*
|
|
10395
|
+
* @param {Object} props
|
|
10396
|
+
* @param {Record<string, any>} props.value
|
|
10397
|
+
* @return {Record<string, any>} The consolidated value.
|
|
10015
10398
|
*/
|
|
10016
|
-
function
|
|
10017
|
-
|
|
10399
|
+
function useContextSystemBridge({ value }) {
|
|
10400
|
+
const parentContext = useComponentsContext();
|
|
10401
|
+
const valueRef = useRef$1(value);
|
|
10402
|
+
useUpdateEffect(() => {
|
|
10403
|
+
if ((0, import_es6.default)(valueRef.current, value) && valueRef.current !== value) warning(`Please memoize your context: ${JSON.stringify(value)}`);
|
|
10404
|
+
}, [value]);
|
|
10405
|
+
return useMemo$1(() => {
|
|
10406
|
+
return deepmerge(parentContext ?? {}, value ?? {}, { isMergeableObject: isPlainObject });
|
|
10407
|
+
}, [parentContext, value]);
|
|
10018
10408
|
}
|
|
10019
10409
|
/**
|
|
10020
|
-
*
|
|
10021
|
-
*
|
|
10410
|
+
* A Provider component that can modify props for connected components within
|
|
10411
|
+
* the Context system.
|
|
10412
|
+
*
|
|
10413
|
+
* @example
|
|
10414
|
+
* ```jsx
|
|
10415
|
+
* <ContextSystemProvider value={{ Button: { size: 'small' }}}>
|
|
10416
|
+
* <Button>...</Button>
|
|
10417
|
+
* </ContextSystemProvider>
|
|
10418
|
+
* ```
|
|
10419
|
+
*
|
|
10420
|
+
* @template {Record<string, any>} T
|
|
10421
|
+
* @param {Object} options
|
|
10422
|
+
* @param {React.ReactNode} options.children Children to render.
|
|
10423
|
+
* @param {T} options.value Props to render into connected components.
|
|
10424
|
+
* @return {React.JSX.Element} A Provider wrapped component.
|
|
10022
10425
|
*/
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
|
|
10426
|
+
const BaseContextSystemProvider = ({ children, value }) => {
|
|
10427
|
+
const contextValue = useContextSystemBridge({ value });
|
|
10428
|
+
return /* @__PURE__ */ jsx(ComponentsContext.Provider, {
|
|
10429
|
+
value: contextValue,
|
|
10430
|
+
children
|
|
10431
|
+
});
|
|
10432
|
+
};
|
|
10433
|
+
memo(BaseContextSystemProvider);
|
|
10434
|
+
// ../../../node_modules/.pnpm/@wordpress+components@44.0.0_patch_hash=dd89cc780626599c6721f4e05e7091dd7b0aed577d8a667_94a1a77c56d75249398bc99af3f14fa5/node_modules/@wordpress/components/build-module/context/constants.mjs
|
|
10435
|
+
const COMPONENT_NAMESPACE = "data-wp-component";
|
|
10436
|
+
const CONNECTED_NAMESPACE = "data-wp-c16t";
|
|
10026
10437
|
/**
|
|
10027
|
-
*
|
|
10028
|
-
*
|
|
10029
|
-
* @return {string?}
|
|
10438
|
+
* Special key where the connected namespaces are stored.
|
|
10439
|
+
* This is attached to Context connected components as a static property.
|
|
10030
10440
|
*/
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
}
|
|
10441
|
+
const CONNECT_STATIC_NAMESPACE = "__contextSystemKey__";
|
|
10442
|
+
// ../../../node_modules/.pnpm/memize@2.1.1/node_modules/memize/dist/index.js
|
|
10034
10443
|
/**
|
|
10035
|
-
*
|
|
10036
|
-
*
|
|
10037
|
-
* @
|
|
10038
|
-
*
|
|
10444
|
+
* Memize options object.
|
|
10445
|
+
*
|
|
10446
|
+
* @typedef MemizeOptions
|
|
10447
|
+
*
|
|
10448
|
+
* @property {number} [maxSize] Maximum size of the cache.
|
|
10039
10449
|
*/
|
|
10040
|
-
function replace(value, pattern, replacement) {
|
|
10041
|
-
return value.replace(pattern, replacement);
|
|
10042
|
-
}
|
|
10043
10450
|
/**
|
|
10044
|
-
*
|
|
10045
|
-
*
|
|
10046
|
-
* @
|
|
10451
|
+
* Internal cache entry.
|
|
10452
|
+
*
|
|
10453
|
+
* @typedef MemizeCacheNode
|
|
10454
|
+
*
|
|
10455
|
+
* @property {?MemizeCacheNode|undefined} [prev] Previous node.
|
|
10456
|
+
* @property {?MemizeCacheNode|undefined} [next] Next node.
|
|
10457
|
+
* @property {Array<*>} args Function arguments for cache
|
|
10458
|
+
* entry.
|
|
10459
|
+
* @property {*} val Function result.
|
|
10047
10460
|
*/
|
|
10048
|
-
function indexof(value, search) {
|
|
10049
|
-
return value.indexOf(search);
|
|
10050
|
-
}
|
|
10051
10461
|
/**
|
|
10052
|
-
*
|
|
10053
|
-
*
|
|
10054
|
-
* @
|
|
10055
|
-
|
|
10056
|
-
|
|
10057
|
-
return value.charCodeAt(index) | 0;
|
|
10058
|
-
}
|
|
10059
|
-
/**
|
|
10060
|
-
* @param {string} value
|
|
10061
|
-
* @param {number} begin
|
|
10062
|
-
* @param {number} end
|
|
10063
|
-
* @return {string}
|
|
10064
|
-
*/
|
|
10065
|
-
function substr(value, begin, end) {
|
|
10066
|
-
return value.slice(begin, end);
|
|
10067
|
-
}
|
|
10068
|
-
/**
|
|
10069
|
-
* @param {string} value
|
|
10070
|
-
* @return {number}
|
|
10071
|
-
*/
|
|
10072
|
-
function strlen(value) {
|
|
10073
|
-
return value.length;
|
|
10074
|
-
}
|
|
10075
|
-
/**
|
|
10076
|
-
* @param {any[]} value
|
|
10077
|
-
* @return {number}
|
|
10078
|
-
*/
|
|
10079
|
-
function sizeof(value) {
|
|
10080
|
-
return value.length;
|
|
10081
|
-
}
|
|
10082
|
-
/**
|
|
10083
|
-
* @param {any} value
|
|
10084
|
-
* @param {any[]} array
|
|
10085
|
-
* @return {any}
|
|
10086
|
-
*/
|
|
10087
|
-
function append(value, array) {
|
|
10088
|
-
return array.push(value), value;
|
|
10089
|
-
}
|
|
10090
|
-
/**
|
|
10091
|
-
* @param {string[]} array
|
|
10092
|
-
* @param {function} callback
|
|
10093
|
-
* @return {string}
|
|
10094
|
-
*/
|
|
10095
|
-
function combine(array, callback) {
|
|
10096
|
-
return array.map(callback).join("");
|
|
10097
|
-
}
|
|
10098
|
-
// ../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Tokenizer.js
|
|
10099
|
-
var line = 1;
|
|
10100
|
-
var column = 1;
|
|
10101
|
-
var length = 0;
|
|
10102
|
-
var position = 0;
|
|
10103
|
-
var character = 0;
|
|
10104
|
-
var characters = "";
|
|
10105
|
-
/**
|
|
10106
|
-
* @param {string} value
|
|
10107
|
-
* @param {object | null} root
|
|
10108
|
-
* @param {object | null} parent
|
|
10109
|
-
* @param {string} type
|
|
10110
|
-
* @param {string[] | string} props
|
|
10111
|
-
* @param {object[] | string} children
|
|
10112
|
-
* @param {number} length
|
|
10113
|
-
*/
|
|
10114
|
-
function node(value, root, parent, type, props, children, length) {
|
|
10115
|
-
return {
|
|
10116
|
-
value,
|
|
10117
|
-
root,
|
|
10118
|
-
parent,
|
|
10119
|
-
type,
|
|
10120
|
-
props,
|
|
10121
|
-
children,
|
|
10122
|
-
line,
|
|
10123
|
-
column,
|
|
10124
|
-
length,
|
|
10125
|
-
return: ""
|
|
10126
|
-
};
|
|
10127
|
-
}
|
|
10128
|
-
/**
|
|
10129
|
-
* @param {object} root
|
|
10130
|
-
* @param {object} props
|
|
10131
|
-
* @return {object}
|
|
10132
|
-
*/
|
|
10133
|
-
function copy(root, props) {
|
|
10134
|
-
return assign(node("", null, null, "", null, null, 0), root, { length: -root.length }, props);
|
|
10135
|
-
}
|
|
10136
|
-
/**
|
|
10137
|
-
* @return {number}
|
|
10138
|
-
*/
|
|
10139
|
-
function char() {
|
|
10140
|
-
return character;
|
|
10141
|
-
}
|
|
10142
|
-
/**
|
|
10143
|
-
* @return {number}
|
|
10144
|
-
*/
|
|
10145
|
-
function prev() {
|
|
10146
|
-
character = position > 0 ? charat(characters, --position) : 0;
|
|
10147
|
-
if (column--, character === 10) column = 1, line--;
|
|
10148
|
-
return character;
|
|
10149
|
-
}
|
|
10150
|
-
/**
|
|
10151
|
-
* @return {number}
|
|
10152
|
-
*/
|
|
10153
|
-
function next() {
|
|
10154
|
-
character = position < length ? charat(characters, position++) : 0;
|
|
10155
|
-
if (column++, character === 10) column = 1, line++;
|
|
10156
|
-
return character;
|
|
10157
|
-
}
|
|
10158
|
-
/**
|
|
10159
|
-
* @return {number}
|
|
10160
|
-
*/
|
|
10161
|
-
function peek() {
|
|
10162
|
-
return charat(characters, position);
|
|
10163
|
-
}
|
|
10164
|
-
/**
|
|
10165
|
-
* @return {number}
|
|
10166
|
-
*/
|
|
10167
|
-
function caret() {
|
|
10168
|
-
return position;
|
|
10169
|
-
}
|
|
10170
|
-
/**
|
|
10171
|
-
* @param {number} begin
|
|
10172
|
-
* @param {number} end
|
|
10173
|
-
* @return {string}
|
|
10174
|
-
*/
|
|
10175
|
-
function slice(begin, end) {
|
|
10176
|
-
return substr(characters, begin, end);
|
|
10177
|
-
}
|
|
10178
|
-
/**
|
|
10179
|
-
* @param {number} type
|
|
10180
|
-
* @return {number}
|
|
10181
|
-
*/
|
|
10182
|
-
function token(type) {
|
|
10183
|
-
switch (type) {
|
|
10184
|
-
case 0:
|
|
10185
|
-
case 9:
|
|
10186
|
-
case 10:
|
|
10187
|
-
case 13:
|
|
10188
|
-
case 32: return 5;
|
|
10189
|
-
case 33:
|
|
10190
|
-
case 43:
|
|
10191
|
-
case 44:
|
|
10192
|
-
case 47:
|
|
10193
|
-
case 62:
|
|
10194
|
-
case 64:
|
|
10195
|
-
case 126:
|
|
10196
|
-
case 59:
|
|
10197
|
-
case 123:
|
|
10198
|
-
case 125: return 4;
|
|
10199
|
-
case 58: return 3;
|
|
10200
|
-
case 34:
|
|
10201
|
-
case 39:
|
|
10202
|
-
case 40:
|
|
10203
|
-
case 91: return 2;
|
|
10204
|
-
case 41:
|
|
10205
|
-
case 93: return 1;
|
|
10206
|
-
}
|
|
10207
|
-
return 0;
|
|
10208
|
-
}
|
|
10209
|
-
/**
|
|
10210
|
-
* @param {string} value
|
|
10211
|
-
* @return {any[]}
|
|
10212
|
-
*/
|
|
10213
|
-
function alloc(value) {
|
|
10214
|
-
return line = column = 1, length = strlen(characters = value), position = 0, [];
|
|
10215
|
-
}
|
|
10216
|
-
/**
|
|
10217
|
-
* @param {any} value
|
|
10218
|
-
* @return {any}
|
|
10219
|
-
*/
|
|
10220
|
-
function dealloc(value) {
|
|
10221
|
-
return characters = "", value;
|
|
10222
|
-
}
|
|
10223
|
-
/**
|
|
10224
|
-
* @param {number} type
|
|
10225
|
-
* @return {string}
|
|
10226
|
-
*/
|
|
10227
|
-
function delimit(type) {
|
|
10228
|
-
return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)));
|
|
10229
|
-
}
|
|
10230
|
-
/**
|
|
10231
|
-
* @param {number} type
|
|
10232
|
-
* @return {string}
|
|
10233
|
-
*/
|
|
10234
|
-
function whitespace(type) {
|
|
10235
|
-
while (character = peek()) if (character < 33) next();
|
|
10236
|
-
else break;
|
|
10237
|
-
return token(type) > 2 || token(character) > 3 ? "" : " ";
|
|
10238
|
-
}
|
|
10239
|
-
/**
|
|
10240
|
-
* @param {number} index
|
|
10241
|
-
* @param {number} count
|
|
10242
|
-
* @return {string}
|
|
10243
|
-
*/
|
|
10244
|
-
function escaping(index, count) {
|
|
10245
|
-
while (--count && next()) if (character < 48 || character > 102 || character > 57 && character < 65 || character > 70 && character < 97) break;
|
|
10246
|
-
return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32));
|
|
10247
|
-
}
|
|
10248
|
-
/**
|
|
10249
|
-
* @param {number} type
|
|
10250
|
-
* @return {number}
|
|
10251
|
-
*/
|
|
10252
|
-
function delimiter(type) {
|
|
10253
|
-
while (next()) switch (character) {
|
|
10254
|
-
case type: return position;
|
|
10255
|
-
case 34:
|
|
10256
|
-
case 39:
|
|
10257
|
-
if (type !== 34 && type !== 39) delimiter(character);
|
|
10258
|
-
break;
|
|
10259
|
-
case 40:
|
|
10260
|
-
if (type === 41) delimiter(type);
|
|
10261
|
-
break;
|
|
10262
|
-
case 92: next();
|
|
10263
|
-
}
|
|
10264
|
-
return position;
|
|
10265
|
-
}
|
|
10266
|
-
/**
|
|
10267
|
-
* @param {number} type
|
|
10268
|
-
* @param {number} index
|
|
10269
|
-
* @return {number}
|
|
10270
|
-
*/
|
|
10271
|
-
function commenter(type, index) {
|
|
10272
|
-
while (next()) if (type + character === 57) break;
|
|
10273
|
-
else if (type + character === 84 && peek() === 47) break;
|
|
10274
|
-
return "/*" + slice(index, position - 1) + "*" + from(type === 47 ? type : next());
|
|
10275
|
-
}
|
|
10276
|
-
/**
|
|
10277
|
-
* @param {number} index
|
|
10278
|
-
* @return {string}
|
|
10279
|
-
*/
|
|
10280
|
-
function identifier(index) {
|
|
10281
|
-
while (!token(peek())) next();
|
|
10282
|
-
return slice(index, position);
|
|
10283
|
-
}
|
|
10284
|
-
// ../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Parser.js
|
|
10285
|
-
/**
|
|
10286
|
-
* @param {string} value
|
|
10287
|
-
* @return {object[]}
|
|
10288
|
-
*/
|
|
10289
|
-
function compile(value) {
|
|
10290
|
-
return dealloc(parse$1("", null, null, null, [""], value = alloc(value), 0, [0], value));
|
|
10291
|
-
}
|
|
10292
|
-
/**
|
|
10293
|
-
* @param {string} value
|
|
10294
|
-
* @param {object} root
|
|
10295
|
-
* @param {object?} parent
|
|
10296
|
-
* @param {string[]} rule
|
|
10297
|
-
* @param {string[]} rules
|
|
10298
|
-
* @param {string[]} rulesets
|
|
10299
|
-
* @param {number[]} pseudo
|
|
10300
|
-
* @param {number[]} points
|
|
10301
|
-
* @param {string[]} declarations
|
|
10302
|
-
* @return {object}
|
|
10303
|
-
*/
|
|
10304
|
-
function parse$1(value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
|
|
10305
|
-
var index = 0;
|
|
10306
|
-
var offset = 0;
|
|
10307
|
-
var length = pseudo;
|
|
10308
|
-
var atrule = 0;
|
|
10309
|
-
var property = 0;
|
|
10310
|
-
var previous = 0;
|
|
10311
|
-
var variable = 1;
|
|
10312
|
-
var scanning = 1;
|
|
10313
|
-
var ampersand = 1;
|
|
10314
|
-
var character = 0;
|
|
10315
|
-
var type = "";
|
|
10316
|
-
var props = rules;
|
|
10317
|
-
var children = rulesets;
|
|
10318
|
-
var reference = rule;
|
|
10319
|
-
var characters = type;
|
|
10320
|
-
while (scanning) switch (previous = character, character = next()) {
|
|
10321
|
-
case 40: if (previous != 108 && charat(characters, length - 1) == 58) {
|
|
10322
|
-
if (indexof(characters += replace(delimit(character), "&", "&\f"), "&\f") != -1) ampersand = -1;
|
|
10323
|
-
break;
|
|
10324
|
-
}
|
|
10325
|
-
case 34:
|
|
10326
|
-
case 39:
|
|
10327
|
-
case 91:
|
|
10328
|
-
characters += delimit(character);
|
|
10329
|
-
break;
|
|
10330
|
-
case 9:
|
|
10331
|
-
case 10:
|
|
10332
|
-
case 13:
|
|
10333
|
-
case 32:
|
|
10334
|
-
characters += whitespace(previous);
|
|
10335
|
-
break;
|
|
10336
|
-
case 92:
|
|
10337
|
-
characters += escaping(caret() - 1, 7);
|
|
10338
|
-
continue;
|
|
10339
|
-
case 47:
|
|
10340
|
-
switch (peek()) {
|
|
10341
|
-
case 42:
|
|
10342
|
-
case 47:
|
|
10343
|
-
append(comment(commenter(next(), caret()), root, parent), declarations);
|
|
10344
|
-
break;
|
|
10345
|
-
default: characters += "/";
|
|
10346
|
-
}
|
|
10347
|
-
break;
|
|
10348
|
-
case 123 * variable: points[index++] = strlen(characters) * ampersand;
|
|
10349
|
-
case 125 * variable:
|
|
10350
|
-
case 59:
|
|
10351
|
-
case 0:
|
|
10352
|
-
switch (character) {
|
|
10353
|
-
case 0:
|
|
10354
|
-
case 125: scanning = 0;
|
|
10355
|
-
case 59 + offset:
|
|
10356
|
-
if (ampersand == -1) characters = replace(characters, /\f/g, "");
|
|
10357
|
-
if (property > 0 && strlen(characters) - length) append(property > 32 ? declaration(characters + ";", rule, parent, length - 1) : declaration(replace(characters, " ", "") + ";", rule, parent, length - 2), declarations);
|
|
10358
|
-
break;
|
|
10359
|
-
case 59: characters += ";";
|
|
10360
|
-
default:
|
|
10361
|
-
append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets);
|
|
10362
|
-
if (character === 123) if (offset === 0) parse$1(characters, root, reference, reference, props, rulesets, length, points, children);
|
|
10363
|
-
else switch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {
|
|
10364
|
-
case 100:
|
|
10365
|
-
case 108:
|
|
10366
|
-
case 109:
|
|
10367
|
-
case 115:
|
|
10368
|
-
parse$1(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children);
|
|
10369
|
-
break;
|
|
10370
|
-
default: parse$1(characters, reference, reference, reference, [""], children, 0, points, children);
|
|
10371
|
-
}
|
|
10372
|
-
}
|
|
10373
|
-
index = offset = property = 0, variable = ampersand = 1, type = characters = "", length = pseudo;
|
|
10374
|
-
break;
|
|
10375
|
-
case 58: length = 1 + strlen(characters), property = previous;
|
|
10376
|
-
default:
|
|
10377
|
-
if (variable < 1) {
|
|
10378
|
-
if (character == 123) --variable;
|
|
10379
|
-
else if (character == 125 && variable++ == 0 && prev() == 125) continue;
|
|
10380
|
-
}
|
|
10381
|
-
switch (characters += from(character), character * variable) {
|
|
10382
|
-
case 38:
|
|
10383
|
-
ampersand = offset > 0 ? 1 : (characters += "\f", -1);
|
|
10384
|
-
break;
|
|
10385
|
-
case 44:
|
|
10386
|
-
points[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1;
|
|
10387
|
-
break;
|
|
10388
|
-
case 64:
|
|
10389
|
-
if (peek() === 45) characters += delimit(next());
|
|
10390
|
-
atrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++;
|
|
10391
|
-
break;
|
|
10392
|
-
case 45: if (previous === 45 && strlen(characters) == 2) variable = 0;
|
|
10393
|
-
}
|
|
10394
|
-
}
|
|
10395
|
-
return rulesets;
|
|
10396
|
-
}
|
|
10397
|
-
/**
|
|
10398
|
-
* @param {string} value
|
|
10399
|
-
* @param {object} root
|
|
10400
|
-
* @param {object?} parent
|
|
10401
|
-
* @param {number} index
|
|
10402
|
-
* @param {number} offset
|
|
10403
|
-
* @param {string[]} rules
|
|
10404
|
-
* @param {number[]} points
|
|
10405
|
-
* @param {string} type
|
|
10406
|
-
* @param {string[]} props
|
|
10407
|
-
* @param {string[]} children
|
|
10408
|
-
* @param {number} length
|
|
10409
|
-
* @return {object}
|
|
10410
|
-
*/
|
|
10411
|
-
function ruleset(value, root, parent, index, offset, rules, points, type, props, children, length) {
|
|
10412
|
-
var post = offset - 1;
|
|
10413
|
-
var rule = offset === 0 ? rules : [""];
|
|
10414
|
-
var size = sizeof(rule);
|
|
10415
|
-
for (var i = 0, j = 0, k = 0; i < index; ++i) for (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x) if (z = trim(j > 0 ? rule[x] + " " + y : replace(y, /&\f/g, rule[x]))) props[k++] = z;
|
|
10416
|
-
return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length);
|
|
10417
|
-
}
|
|
10418
|
-
/**
|
|
10419
|
-
* @param {number} value
|
|
10420
|
-
* @param {object} root
|
|
10421
|
-
* @param {object?} parent
|
|
10422
|
-
* @return {object}
|
|
10423
|
-
*/
|
|
10424
|
-
function comment(value, root, parent) {
|
|
10425
|
-
return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0);
|
|
10426
|
-
}
|
|
10427
|
-
/**
|
|
10428
|
-
* @param {string} value
|
|
10429
|
-
* @param {object} root
|
|
10430
|
-
* @param {object?} parent
|
|
10431
|
-
* @param {number} length
|
|
10432
|
-
* @return {object}
|
|
10433
|
-
*/
|
|
10434
|
-
function declaration(value, root, parent, length) {
|
|
10435
|
-
return node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length);
|
|
10436
|
-
}
|
|
10437
|
-
// ../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Serializer.js
|
|
10438
|
-
/**
|
|
10439
|
-
* @param {object[]} children
|
|
10440
|
-
* @param {function} callback
|
|
10441
|
-
* @return {string}
|
|
10442
|
-
*/
|
|
10443
|
-
function serialize(children, callback) {
|
|
10444
|
-
var output = "";
|
|
10445
|
-
var length = sizeof(children);
|
|
10446
|
-
for (var i = 0; i < length; i++) output += callback(children[i], i, children, callback) || "";
|
|
10447
|
-
return output;
|
|
10448
|
-
}
|
|
10449
|
-
/**
|
|
10450
|
-
* @param {object} element
|
|
10451
|
-
* @param {number} index
|
|
10452
|
-
* @param {object[]} children
|
|
10453
|
-
* @param {function} callback
|
|
10454
|
-
* @return {string}
|
|
10455
|
-
*/
|
|
10456
|
-
function stringify(element, index, children, callback) {
|
|
10457
|
-
switch (element.type) {
|
|
10458
|
-
case LAYER: if (element.children.length) break;
|
|
10459
|
-
case IMPORT:
|
|
10460
|
-
case DECLARATION: return element.return = element.return || element.value;
|
|
10461
|
-
case COMMENT: return "";
|
|
10462
|
-
case KEYFRAMES: return element.return = element.value + "{" + serialize(element.children, callback) + "}";
|
|
10463
|
-
case RULESET: element.value = element.props.join(",");
|
|
10464
|
-
}
|
|
10465
|
-
return strlen(children = serialize(element.children, callback)) ? element.return = element.value + "{" + children + "}" : "";
|
|
10466
|
-
}
|
|
10467
|
-
// ../../../node_modules/.pnpm/stylis@4.2.0/node_modules/stylis/src/Middleware.js
|
|
10468
|
-
/**
|
|
10469
|
-
* @param {function[]} collection
|
|
10470
|
-
* @return {function}
|
|
10471
|
-
*/
|
|
10472
|
-
function middleware(collection) {
|
|
10473
|
-
var length = sizeof(collection);
|
|
10474
|
-
return function(element, index, children, callback) {
|
|
10475
|
-
var output = "";
|
|
10476
|
-
for (var i = 0; i < length; i++) output += collection[i](element, index, children, callback) || "";
|
|
10477
|
-
return output;
|
|
10478
|
-
};
|
|
10479
|
-
}
|
|
10480
|
-
/**
|
|
10481
|
-
* @param {function} callback
|
|
10482
|
-
* @return {function}
|
|
10483
|
-
*/
|
|
10484
|
-
function rulesheet(callback) {
|
|
10485
|
-
return function(element) {
|
|
10486
|
-
if (!element.root) {
|
|
10487
|
-
if (element = element.return) callback(element);
|
|
10488
|
-
}
|
|
10489
|
-
};
|
|
10490
|
-
}
|
|
10491
|
-
// ../../../node_modules/.pnpm/@emotion+memoize@0.9.0/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js
|
|
10492
|
-
function memoize(fn) {
|
|
10493
|
-
var cache = Object.create(null);
|
|
10494
|
-
return function(arg) {
|
|
10495
|
-
if (cache[arg] === void 0) cache[arg] = fn(arg);
|
|
10496
|
-
return cache[arg];
|
|
10497
|
-
};
|
|
10498
|
-
}
|
|
10499
|
-
// ../../../node_modules/.pnpm/@emotion+cache@11.14.0/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js
|
|
10500
|
-
var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
|
|
10501
|
-
var previous = 0;
|
|
10502
|
-
var character = 0;
|
|
10503
|
-
while (true) {
|
|
10504
|
-
previous = character;
|
|
10505
|
-
character = peek();
|
|
10506
|
-
if (previous === 38 && character === 12) points[index] = 1;
|
|
10507
|
-
if (token(character)) break;
|
|
10508
|
-
next();
|
|
10509
|
-
}
|
|
10510
|
-
return slice(begin, position);
|
|
10511
|
-
};
|
|
10512
|
-
var toRules = function toRules(parsed, points) {
|
|
10513
|
-
var index = -1;
|
|
10514
|
-
var character = 44;
|
|
10515
|
-
do
|
|
10516
|
-
switch (token(character)) {
|
|
10517
|
-
case 0:
|
|
10518
|
-
if (character === 38 && peek() === 12) points[index] = 1;
|
|
10519
|
-
parsed[index] += identifierWithPointTracking(position - 1, points, index);
|
|
10520
|
-
break;
|
|
10521
|
-
case 2:
|
|
10522
|
-
parsed[index] += delimit(character);
|
|
10523
|
-
break;
|
|
10524
|
-
case 4: if (character === 44) {
|
|
10525
|
-
parsed[++index] = peek() === 58 ? "&\f" : "";
|
|
10526
|
-
points[index] = parsed[index].length;
|
|
10527
|
-
break;
|
|
10528
|
-
}
|
|
10529
|
-
default: parsed[index] += from(character);
|
|
10530
|
-
}
|
|
10531
|
-
while (character = next());
|
|
10532
|
-
return parsed;
|
|
10533
|
-
};
|
|
10534
|
-
var getRules = function getRules(value, points) {
|
|
10535
|
-
return dealloc(toRules(alloc(value), points));
|
|
10536
|
-
};
|
|
10537
|
-
var fixedElements = /* #__PURE__ */ new WeakMap();
|
|
10538
|
-
var compat = function compat(element) {
|
|
10539
|
-
if (element.type !== "rule" || !element.parent || element.length < 1) return;
|
|
10540
|
-
var value = element.value;
|
|
10541
|
-
var parent = element.parent;
|
|
10542
|
-
var isImplicitRule = element.column === parent.column && element.line === parent.line;
|
|
10543
|
-
while (parent.type !== "rule") {
|
|
10544
|
-
parent = parent.parent;
|
|
10545
|
-
if (!parent) return;
|
|
10546
|
-
}
|
|
10547
|
-
if (element.props.length === 1 && value.charCodeAt(0) !== 58 && !fixedElements.get(parent)) return;
|
|
10548
|
-
if (isImplicitRule) return;
|
|
10549
|
-
fixedElements.set(element, true);
|
|
10550
|
-
var points = [];
|
|
10551
|
-
var rules = getRules(value, points);
|
|
10552
|
-
var parentRules = parent.props;
|
|
10553
|
-
for (var i = 0, k = 0; i < rules.length; i++) for (var j = 0; j < parentRules.length; j++, k++) element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
|
|
10554
|
-
};
|
|
10555
|
-
var removeLabel = function removeLabel(element) {
|
|
10556
|
-
if (element.type === "decl") {
|
|
10557
|
-
var value = element.value;
|
|
10558
|
-
if (value.charCodeAt(0) === 108 && value.charCodeAt(2) === 98) {
|
|
10559
|
-
element["return"] = "";
|
|
10560
|
-
element.value = "";
|
|
10561
|
-
}
|
|
10562
|
-
}
|
|
10563
|
-
};
|
|
10564
|
-
function prefix(value, length) {
|
|
10565
|
-
switch (hash(value, length)) {
|
|
10566
|
-
case 5103: return WEBKIT + "print-" + value + value;
|
|
10567
|
-
case 5737:
|
|
10568
|
-
case 4201:
|
|
10569
|
-
case 3177:
|
|
10570
|
-
case 3433:
|
|
10571
|
-
case 1641:
|
|
10572
|
-
case 4457:
|
|
10573
|
-
case 2921:
|
|
10574
|
-
case 5572:
|
|
10575
|
-
case 6356:
|
|
10576
|
-
case 5844:
|
|
10577
|
-
case 3191:
|
|
10578
|
-
case 6645:
|
|
10579
|
-
case 3005:
|
|
10580
|
-
case 6391:
|
|
10581
|
-
case 5879:
|
|
10582
|
-
case 5623:
|
|
10583
|
-
case 6135:
|
|
10584
|
-
case 4599:
|
|
10585
|
-
case 4855:
|
|
10586
|
-
case 4215:
|
|
10587
|
-
case 6389:
|
|
10588
|
-
case 5109:
|
|
10589
|
-
case 5365:
|
|
10590
|
-
case 5621:
|
|
10591
|
-
case 3829: return WEBKIT + value + value;
|
|
10592
|
-
case 5349:
|
|
10593
|
-
case 4246:
|
|
10594
|
-
case 4810:
|
|
10595
|
-
case 6968:
|
|
10596
|
-
case 2756: return WEBKIT + value + MOZ + value + MS + value + value;
|
|
10597
|
-
case 6828:
|
|
10598
|
-
case 4268: return WEBKIT + value + MS + value + value;
|
|
10599
|
-
case 6165: return WEBKIT + value + MS + "flex-" + value + value;
|
|
10600
|
-
case 5187: return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + "box-$1$2" + MS + "flex-$1$2") + value;
|
|
10601
|
-
case 5443: return WEBKIT + value + MS + "flex-item-" + replace(value, /flex-|-self/, "") + value;
|
|
10602
|
-
case 4675: return WEBKIT + value + MS + "flex-line-pack" + replace(value, /align-content|flex-|-self/, "") + value;
|
|
10603
|
-
case 5548: return WEBKIT + value + MS + replace(value, "shrink", "negative") + value;
|
|
10604
|
-
case 5292: return WEBKIT + value + MS + replace(value, "basis", "preferred-size") + value;
|
|
10605
|
-
case 6060: return WEBKIT + "box-" + replace(value, "-grow", "") + WEBKIT + value + MS + replace(value, "grow", "positive") + value;
|
|
10606
|
-
case 4554: return WEBKIT + replace(value, /([^-])(transform)/g, "$1" + WEBKIT + "$2") + value;
|
|
10607
|
-
case 6187: return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + "$1"), /(image-set)/, WEBKIT + "$1"), value, "") + value;
|
|
10608
|
-
case 5495:
|
|
10609
|
-
case 3959: return replace(value, /(image-set\([^]*)/, WEBKIT + "$1$`$1");
|
|
10610
|
-
case 4968: return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + "box-pack:$3" + MS + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + WEBKIT + value + value;
|
|
10611
|
-
case 4095:
|
|
10612
|
-
case 3583:
|
|
10613
|
-
case 4068:
|
|
10614
|
-
case 2532: return replace(value, /(.+)-inline(.+)/, WEBKIT + "$1$2") + value;
|
|
10615
|
-
case 8116:
|
|
10616
|
-
case 7059:
|
|
10617
|
-
case 5753:
|
|
10618
|
-
case 5535:
|
|
10619
|
-
case 5445:
|
|
10620
|
-
case 5701:
|
|
10621
|
-
case 4933:
|
|
10622
|
-
case 4677:
|
|
10623
|
-
case 5533:
|
|
10624
|
-
case 5789:
|
|
10625
|
-
case 5021:
|
|
10626
|
-
case 4765:
|
|
10627
|
-
if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) {
|
|
10628
|
-
case 109: if (charat(value, length + 4) !== 45) break;
|
|
10629
|
-
case 102: return replace(value, /(.+:)(.+)-([^]+)/, "$1" + WEBKIT + "$2-$3$1" + MOZ + (charat(value, length + 3) == 108 ? "$3" : "$2-$3")) + value;
|
|
10630
|
-
case 115: return ~indexof(value, "stretch") ? prefix(replace(value, "stretch", "fill-available"), length) + value : value;
|
|
10631
|
-
}
|
|
10632
|
-
break;
|
|
10633
|
-
case 4949: if (charat(value, length + 1) !== 115) break;
|
|
10634
|
-
case 6444:
|
|
10635
|
-
switch (charat(value, strlen(value) - 3 - (~indexof(value, "!important") && 10))) {
|
|
10636
|
-
case 107: return replace(value, ":", ":" + WEBKIT) + value;
|
|
10637
|
-
case 101: return replace(value, /(.+:)([^;!]+)(;|!.+)?/, "$1" + WEBKIT + (charat(value, 14) === 45 ? "inline-" : "") + "box$3$1" + WEBKIT + "$2$3$1" + MS + "$2box$3") + value;
|
|
10638
|
-
}
|
|
10639
|
-
break;
|
|
10640
|
-
case 5936:
|
|
10641
|
-
switch (charat(value, length + 11)) {
|
|
10642
|
-
case 114: return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "tb") + value;
|
|
10643
|
-
case 108: return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "tb-rl") + value;
|
|
10644
|
-
case 45: return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "lr") + value;
|
|
10645
|
-
}
|
|
10646
|
-
return WEBKIT + value + MS + value + value;
|
|
10647
|
-
}
|
|
10648
|
-
return value;
|
|
10649
|
-
}
|
|
10650
|
-
var defaultStylisPlugins = [function prefixer(element, index, children, callback) {
|
|
10651
|
-
if (element.length > -1) {
|
|
10652
|
-
if (!element["return"]) switch (element.type) {
|
|
10653
|
-
case DECLARATION:
|
|
10654
|
-
element["return"] = prefix(element.value, element.length);
|
|
10655
|
-
break;
|
|
10656
|
-
case KEYFRAMES: return serialize([copy(element, { value: replace(element.value, "@", "@" + WEBKIT) })], callback);
|
|
10657
|
-
case RULESET: if (element.length) return combine(element.props, function(value) {
|
|
10658
|
-
switch (match(value, /(::plac\w+|:read-\w+)/)) {
|
|
10659
|
-
case ":read-only":
|
|
10660
|
-
case ":read-write": return serialize([copy(element, { props: [replace(value, /:(read-\w+)/, ":" + MOZ + "$1")] })], callback);
|
|
10661
|
-
case "::placeholder": return serialize([
|
|
10662
|
-
copy(element, { props: [replace(value, /:(plac\w+)/, ":" + WEBKIT + "input-$1")] }),
|
|
10663
|
-
copy(element, { props: [replace(value, /:(plac\w+)/, ":" + MOZ + "$1")] }),
|
|
10664
|
-
copy(element, { props: [replace(value, /:(plac\w+)/, MS + "input-$1")] })
|
|
10665
|
-
], callback);
|
|
10666
|
-
}
|
|
10667
|
-
return "";
|
|
10668
|
-
});
|
|
10669
|
-
}
|
|
10670
|
-
}
|
|
10671
|
-
}];
|
|
10672
|
-
var createCache = function createCache(options) {
|
|
10673
|
-
var key = options.key;
|
|
10674
|
-
if (key === "css") {
|
|
10675
|
-
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])");
|
|
10676
|
-
Array.prototype.forEach.call(ssrStyles, function(node) {
|
|
10677
|
-
if (node.getAttribute("data-emotion").indexOf(" ") === -1) return;
|
|
10678
|
-
document.head.appendChild(node);
|
|
10679
|
-
node.setAttribute("data-s", "");
|
|
10680
|
-
});
|
|
10681
|
-
}
|
|
10682
|
-
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
|
|
10683
|
-
var inserted = {};
|
|
10684
|
-
var container;
|
|
10685
|
-
var nodesToHydrate = [];
|
|
10686
|
-
container = options.container || document.head;
|
|
10687
|
-
Array.prototype.forEach.call(document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function(node) {
|
|
10688
|
-
var attrib = node.getAttribute("data-emotion").split(" ");
|
|
10689
|
-
for (var i = 1; i < attrib.length; i++) inserted[attrib[i]] = true;
|
|
10690
|
-
nodesToHydrate.push(node);
|
|
10691
|
-
});
|
|
10692
|
-
var _insert;
|
|
10693
|
-
var omnipresentPlugins = [compat, removeLabel];
|
|
10694
|
-
var currentSheet;
|
|
10695
|
-
var finalizingPlugins = [stringify, rulesheet(function(rule) {
|
|
10696
|
-
currentSheet.insert(rule);
|
|
10697
|
-
})];
|
|
10698
|
-
var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
|
|
10699
|
-
var stylis = function stylis(styles) {
|
|
10700
|
-
return serialize(compile(styles), serializer);
|
|
10701
|
-
};
|
|
10702
|
-
_insert = function insert(selector, serialized, sheet, shouldCache) {
|
|
10703
|
-
currentSheet = sheet;
|
|
10704
|
-
stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
|
10705
|
-
if (shouldCache) cache.inserted[serialized.name] = true;
|
|
10706
|
-
};
|
|
10707
|
-
var cache = {
|
|
10708
|
-
key,
|
|
10709
|
-
sheet: new StyleSheet({
|
|
10710
|
-
key,
|
|
10711
|
-
container,
|
|
10712
|
-
nonce: options.nonce,
|
|
10713
|
-
speedy: options.speedy,
|
|
10714
|
-
prepend: options.prepend,
|
|
10715
|
-
insertionPoint: options.insertionPoint
|
|
10716
|
-
}),
|
|
10717
|
-
nonce: options.nonce,
|
|
10718
|
-
inserted,
|
|
10719
|
-
registered: {},
|
|
10720
|
-
insert: _insert
|
|
10721
|
-
};
|
|
10722
|
-
cache.sheet.hydrate(nodesToHydrate);
|
|
10723
|
-
return cache;
|
|
10724
|
-
};
|
|
10725
|
-
// ../../../node_modules/.pnpm/@emotion+utils@1.4.2/node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js
|
|
10726
|
-
function getRegisteredStyles$1(registered, registeredStyles, classNames) {
|
|
10727
|
-
var rawClassName = "";
|
|
10728
|
-
classNames.split(" ").forEach(function(className) {
|
|
10729
|
-
if (registered[className] !== void 0) registeredStyles.push(registered[className] + ";");
|
|
10730
|
-
else if (className) rawClassName += className + " ";
|
|
10731
|
-
});
|
|
10732
|
-
return rawClassName;
|
|
10733
|
-
}
|
|
10734
|
-
var registerStyles = function registerStyles(cache, serialized, isStringTag) {
|
|
10735
|
-
var className = cache.key + "-" + serialized.name;
|
|
10736
|
-
if ((isStringTag === false || false) && cache.registered[className] === void 0) cache.registered[className] = serialized.styles;
|
|
10737
|
-
};
|
|
10738
|
-
var insertStyles = function insertStyles(cache, serialized, isStringTag) {
|
|
10739
|
-
registerStyles(cache, serialized, isStringTag);
|
|
10740
|
-
var className = cache.key + "-" + serialized.name;
|
|
10741
|
-
if (cache.inserted[serialized.name] === void 0) {
|
|
10742
|
-
var current = serialized;
|
|
10743
|
-
do {
|
|
10744
|
-
cache.insert(serialized === current ? "." + className : "", current, cache.sheet, true);
|
|
10745
|
-
current = current.next;
|
|
10746
|
-
} while (current !== void 0);
|
|
10747
|
-
}
|
|
10748
|
-
};
|
|
10749
|
-
// ../../../node_modules/.pnpm/@emotion+hash@0.9.2/node_modules/@emotion/hash/dist/emotion-hash.esm.js
|
|
10750
|
-
function murmur2(str) {
|
|
10751
|
-
var h = 0;
|
|
10752
|
-
var k, i = 0, len = str.length;
|
|
10753
|
-
for (; len >= 4; ++i, len -= 4) {
|
|
10754
|
-
k = str.charCodeAt(i) & 255 | (str.charCodeAt(++i) & 255) << 8 | (str.charCodeAt(++i) & 255) << 16 | (str.charCodeAt(++i) & 255) << 24;
|
|
10755
|
-
k = (k & 65535) * 1540483477 + ((k >>> 16) * 59797 << 16);
|
|
10756
|
-
k ^= k >>> 24;
|
|
10757
|
-
h = (k & 65535) * 1540483477 + ((k >>> 16) * 59797 << 16) ^ (h & 65535) * 1540483477 + ((h >>> 16) * 59797 << 16);
|
|
10758
|
-
}
|
|
10759
|
-
switch (len) {
|
|
10760
|
-
case 3: h ^= (str.charCodeAt(i + 2) & 255) << 16;
|
|
10761
|
-
case 2: h ^= (str.charCodeAt(i + 1) & 255) << 8;
|
|
10762
|
-
case 1:
|
|
10763
|
-
h ^= str.charCodeAt(i) & 255;
|
|
10764
|
-
h = (h & 65535) * 1540483477 + ((h >>> 16) * 59797 << 16);
|
|
10765
|
-
}
|
|
10766
|
-
h ^= h >>> 13;
|
|
10767
|
-
h = (h & 65535) * 1540483477 + ((h >>> 16) * 59797 << 16);
|
|
10768
|
-
return ((h ^ h >>> 15) >>> 0).toString(36);
|
|
10769
|
-
}
|
|
10770
|
-
// ../../../node_modules/.pnpm/@emotion+unitless@0.10.0/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js
|
|
10771
|
-
var unitlessKeys = {
|
|
10772
|
-
animationIterationCount: 1,
|
|
10773
|
-
aspectRatio: 1,
|
|
10774
|
-
borderImageOutset: 1,
|
|
10775
|
-
borderImageSlice: 1,
|
|
10776
|
-
borderImageWidth: 1,
|
|
10777
|
-
boxFlex: 1,
|
|
10778
|
-
boxFlexGroup: 1,
|
|
10779
|
-
boxOrdinalGroup: 1,
|
|
10780
|
-
columnCount: 1,
|
|
10781
|
-
columns: 1,
|
|
10782
|
-
flex: 1,
|
|
10783
|
-
flexGrow: 1,
|
|
10784
|
-
flexPositive: 1,
|
|
10785
|
-
flexShrink: 1,
|
|
10786
|
-
flexNegative: 1,
|
|
10787
|
-
flexOrder: 1,
|
|
10788
|
-
gridRow: 1,
|
|
10789
|
-
gridRowEnd: 1,
|
|
10790
|
-
gridRowSpan: 1,
|
|
10791
|
-
gridRowStart: 1,
|
|
10792
|
-
gridColumn: 1,
|
|
10793
|
-
gridColumnEnd: 1,
|
|
10794
|
-
gridColumnSpan: 1,
|
|
10795
|
-
gridColumnStart: 1,
|
|
10796
|
-
msGridRow: 1,
|
|
10797
|
-
msGridRowSpan: 1,
|
|
10798
|
-
msGridColumn: 1,
|
|
10799
|
-
msGridColumnSpan: 1,
|
|
10800
|
-
fontWeight: 1,
|
|
10801
|
-
lineHeight: 1,
|
|
10802
|
-
opacity: 1,
|
|
10803
|
-
order: 1,
|
|
10804
|
-
orphans: 1,
|
|
10805
|
-
scale: 1,
|
|
10806
|
-
tabSize: 1,
|
|
10807
|
-
widows: 1,
|
|
10808
|
-
zIndex: 1,
|
|
10809
|
-
zoom: 1,
|
|
10810
|
-
WebkitLineClamp: 1,
|
|
10811
|
-
fillOpacity: 1,
|
|
10812
|
-
floodOpacity: 1,
|
|
10813
|
-
stopOpacity: 1,
|
|
10814
|
-
strokeDasharray: 1,
|
|
10815
|
-
strokeDashoffset: 1,
|
|
10816
|
-
strokeMiterlimit: 1,
|
|
10817
|
-
strokeOpacity: 1,
|
|
10818
|
-
strokeWidth: 1
|
|
10819
|
-
};
|
|
10820
|
-
// ../../../node_modules/.pnpm/@emotion+serialize@1.3.3/node_modules/@emotion/serialize/dist/emotion-serialize.esm.js
|
|
10821
|
-
var isDevelopment = false;
|
|
10822
|
-
var hyphenateRegex = /[A-Z]|^ms/g;
|
|
10823
|
-
var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
|
|
10824
|
-
var isCustomProperty = function isCustomProperty(property) {
|
|
10825
|
-
return property.charCodeAt(1) === 45;
|
|
10826
|
-
};
|
|
10827
|
-
var isProcessableValue = function isProcessableValue(value) {
|
|
10828
|
-
return value != null && typeof value !== "boolean";
|
|
10829
|
-
};
|
|
10830
|
-
var processStyleName = /* #__PURE__ */ memoize(function(styleName) {
|
|
10831
|
-
return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, "-$&").toLowerCase();
|
|
10832
|
-
});
|
|
10833
|
-
var processStyleValue = function processStyleValue(key, value) {
|
|
10834
|
-
switch (key) {
|
|
10835
|
-
case "animation":
|
|
10836
|
-
case "animationName": if (typeof value === "string") return value.replace(animationRegex, function(match, p1, p2) {
|
|
10837
|
-
cursor = {
|
|
10838
|
-
name: p1,
|
|
10839
|
-
styles: p2,
|
|
10840
|
-
next: cursor
|
|
10841
|
-
};
|
|
10842
|
-
return p1;
|
|
10843
|
-
});
|
|
10844
|
-
}
|
|
10845
|
-
if (unitlessKeys[key] !== 1 && !isCustomProperty(key) && typeof value === "number" && value !== 0) return value + "px";
|
|
10846
|
-
return value;
|
|
10847
|
-
};
|
|
10848
|
-
var noComponentSelectorMessage = "Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";
|
|
10849
|
-
function handleInterpolation(mergedProps, registered, interpolation) {
|
|
10850
|
-
if (interpolation == null) return "";
|
|
10851
|
-
var componentSelector = interpolation;
|
|
10852
|
-
if (componentSelector.__emotion_styles !== void 0) return componentSelector;
|
|
10853
|
-
switch (typeof interpolation) {
|
|
10854
|
-
case "boolean": return "";
|
|
10855
|
-
case "object":
|
|
10856
|
-
var keyframes = interpolation;
|
|
10857
|
-
if (keyframes.anim === 1) {
|
|
10858
|
-
cursor = {
|
|
10859
|
-
name: keyframes.name,
|
|
10860
|
-
styles: keyframes.styles,
|
|
10861
|
-
next: cursor
|
|
10862
|
-
};
|
|
10863
|
-
return keyframes.name;
|
|
10864
|
-
}
|
|
10865
|
-
var serializedStyles = interpolation;
|
|
10866
|
-
if (serializedStyles.styles !== void 0) {
|
|
10867
|
-
var next = serializedStyles.next;
|
|
10868
|
-
if (next !== void 0) while (next !== void 0) {
|
|
10869
|
-
cursor = {
|
|
10870
|
-
name: next.name,
|
|
10871
|
-
styles: next.styles,
|
|
10872
|
-
next: cursor
|
|
10873
|
-
};
|
|
10874
|
-
next = next.next;
|
|
10875
|
-
}
|
|
10876
|
-
return serializedStyles.styles + ";";
|
|
10877
|
-
}
|
|
10878
|
-
return createStringFromObject(mergedProps, registered, interpolation);
|
|
10879
|
-
case "function": if (mergedProps !== void 0) {
|
|
10880
|
-
var previousCursor = cursor;
|
|
10881
|
-
var result = interpolation(mergedProps);
|
|
10882
|
-
cursor = previousCursor;
|
|
10883
|
-
return handleInterpolation(mergedProps, registered, result);
|
|
10884
|
-
}
|
|
10885
|
-
}
|
|
10886
|
-
var asString = interpolation;
|
|
10887
|
-
if (registered == null) return asString;
|
|
10888
|
-
var cached = registered[asString];
|
|
10889
|
-
return cached !== void 0 ? cached : asString;
|
|
10890
|
-
}
|
|
10891
|
-
function createStringFromObject(mergedProps, registered, obj) {
|
|
10892
|
-
var string = "";
|
|
10893
|
-
if (Array.isArray(obj)) for (var i = 0; i < obj.length; i++) string += handleInterpolation(mergedProps, registered, obj[i]) + ";";
|
|
10894
|
-
else for (var key in obj) {
|
|
10895
|
-
var value = obj[key];
|
|
10896
|
-
if (typeof value !== "object") {
|
|
10897
|
-
var asString = value;
|
|
10898
|
-
if (registered != null && registered[asString] !== void 0) string += key + "{" + registered[asString] + "}";
|
|
10899
|
-
else if (isProcessableValue(asString)) string += processStyleName(key) + ":" + processStyleValue(key, asString) + ";";
|
|
10900
|
-
} else {
|
|
10901
|
-
if (key === "NO_COMPONENT_SELECTOR" && isDevelopment) throw new Error(noComponentSelectorMessage);
|
|
10902
|
-
if (Array.isArray(value) && typeof value[0] === "string" && (registered == null || registered[value[0]] === void 0)) {
|
|
10903
|
-
for (var _i = 0; _i < value.length; _i++) if (isProcessableValue(value[_i])) string += processStyleName(key) + ":" + processStyleValue(key, value[_i]) + ";";
|
|
10904
|
-
} else {
|
|
10905
|
-
var interpolated = handleInterpolation(mergedProps, registered, value);
|
|
10906
|
-
switch (key) {
|
|
10907
|
-
case "animation":
|
|
10908
|
-
case "animationName":
|
|
10909
|
-
string += processStyleName(key) + ":" + interpolated + ";";
|
|
10910
|
-
break;
|
|
10911
|
-
default: string += key + "{" + interpolated + "}";
|
|
10912
|
-
}
|
|
10913
|
-
}
|
|
10914
|
-
}
|
|
10915
|
-
}
|
|
10916
|
-
return string;
|
|
10917
|
-
}
|
|
10918
|
-
var labelPattern = /label:\s*([^\s;{]+)\s*(;|$)/g;
|
|
10919
|
-
var cursor;
|
|
10920
|
-
function serializeStyles(args, registered, mergedProps) {
|
|
10921
|
-
if (args.length === 1 && typeof args[0] === "object" && args[0] !== null && args[0].styles !== void 0) return args[0];
|
|
10922
|
-
var stringMode = true;
|
|
10923
|
-
var styles = "";
|
|
10924
|
-
cursor = void 0;
|
|
10925
|
-
var strings = args[0];
|
|
10926
|
-
if (strings == null || strings.raw === void 0) {
|
|
10927
|
-
stringMode = false;
|
|
10928
|
-
styles += handleInterpolation(mergedProps, registered, strings);
|
|
10929
|
-
} else styles += strings[0];
|
|
10930
|
-
for (var i = 1; i < args.length; i++) {
|
|
10931
|
-
styles += handleInterpolation(mergedProps, registered, args[i]);
|
|
10932
|
-
if (stringMode) styles += strings[i];
|
|
10933
|
-
}
|
|
10934
|
-
labelPattern.lastIndex = 0;
|
|
10935
|
-
var identifierName = "";
|
|
10936
|
-
var match;
|
|
10937
|
-
while ((match = labelPattern.exec(styles)) !== null) identifierName += "-" + match[1];
|
|
10938
|
-
return {
|
|
10939
|
-
name: murmur2(styles) + identifierName,
|
|
10940
|
-
styles,
|
|
10941
|
-
next: cursor
|
|
10942
|
-
};
|
|
10943
|
-
}
|
|
10944
|
-
React["useInsertionEffect"] && React["useInsertionEffect"] || React.useLayoutEffect;
|
|
10945
|
-
// ../../../node_modules/.pnpm/@emotion+react@11.14.0_@types+react@19.3.0_react@19.3.0/node_modules/@emotion/react/dist/emotion-element-f0de968e.browser.esm.js
|
|
10946
|
-
var EmotionCacheContext = /* #__PURE__ */ React.createContext(typeof HTMLElement !== "undefined" ? /* #__PURE__ */ createCache({ key: "css" }) : null);
|
|
10947
|
-
EmotionCacheContext.Provider;
|
|
10948
|
-
var __unsafe_useEmotionCache = function useEmotionCache() {
|
|
10949
|
-
return useContext(EmotionCacheContext);
|
|
10950
|
-
};
|
|
10951
|
-
({}).hasOwnProperty;
|
|
10952
|
-
// ../../../node_modules/.pnpm/@emotion+css@11.13.5/node_modules/@emotion/css/create-instance/dist/emotion-css-create-instance.esm.js
|
|
10953
|
-
function insertWithoutScoping(cache, serialized) {
|
|
10954
|
-
if (cache.inserted[serialized.name] === void 0) return cache.insert("", serialized, cache.sheet, true);
|
|
10955
|
-
}
|
|
10956
|
-
function merge$1(registered, css, className) {
|
|
10957
|
-
var registeredStyles = [];
|
|
10958
|
-
var rawClassName = getRegisteredStyles$1(registered, registeredStyles, className);
|
|
10959
|
-
if (registeredStyles.length < 2) return className;
|
|
10960
|
-
return rawClassName + css(registeredStyles);
|
|
10961
|
-
}
|
|
10962
|
-
var createEmotion = function createEmotion(options) {
|
|
10963
|
-
var cache = createCache(options);
|
|
10964
|
-
cache.sheet.speedy = function(value) {
|
|
10965
|
-
this.isSpeedy = value;
|
|
10966
|
-
};
|
|
10967
|
-
cache.compat = true;
|
|
10968
|
-
var css = function css() {
|
|
10969
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
|
10970
|
-
var serialized = serializeStyles(args, cache.registered, void 0);
|
|
10971
|
-
insertStyles(cache, serialized, false);
|
|
10972
|
-
return cache.key + "-" + serialized.name;
|
|
10973
|
-
};
|
|
10974
|
-
return {
|
|
10975
|
-
css,
|
|
10976
|
-
cx: function cx() {
|
|
10977
|
-
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) args[_key4] = arguments[_key4];
|
|
10978
|
-
return merge$1(cache.registered, css, classnames(args));
|
|
10979
|
-
},
|
|
10980
|
-
injectGlobal: function injectGlobal() {
|
|
10981
|
-
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) args[_key3] = arguments[_key3];
|
|
10982
|
-
insertWithoutScoping(cache, serializeStyles(args, cache.registered));
|
|
10983
|
-
},
|
|
10984
|
-
keyframes: function keyframes() {
|
|
10985
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) args[_key2] = arguments[_key2];
|
|
10986
|
-
var serialized = serializeStyles(args, cache.registered);
|
|
10987
|
-
var animation = "animation-" + serialized.name;
|
|
10988
|
-
insertWithoutScoping(cache, {
|
|
10989
|
-
name: serialized.name,
|
|
10990
|
-
styles: "@keyframes " + animation + "{" + serialized.styles + "}"
|
|
10991
|
-
});
|
|
10992
|
-
return animation;
|
|
10993
|
-
},
|
|
10994
|
-
hydrate: function hydrate(ids) {
|
|
10995
|
-
ids.forEach(function(key) {
|
|
10996
|
-
cache.inserted[key] = true;
|
|
10997
|
-
});
|
|
10998
|
-
},
|
|
10999
|
-
flush: function flush() {
|
|
11000
|
-
cache.registered = {};
|
|
11001
|
-
cache.inserted = {};
|
|
11002
|
-
cache.sheet.flush();
|
|
11003
|
-
},
|
|
11004
|
-
sheet: cache.sheet,
|
|
11005
|
-
cache,
|
|
11006
|
-
getRegisteredStyles: getRegisteredStyles$1.bind(null, cache.registered),
|
|
11007
|
-
merge: merge$1.bind(null, cache.registered, css)
|
|
11008
|
-
};
|
|
11009
|
-
};
|
|
11010
|
-
var classnames = function classnames(args) {
|
|
11011
|
-
var cls = "";
|
|
11012
|
-
for (var i = 0; i < args.length; i++) {
|
|
11013
|
-
var arg = args[i];
|
|
11014
|
-
if (arg == null) continue;
|
|
11015
|
-
var toAdd = void 0;
|
|
11016
|
-
switch (typeof arg) {
|
|
11017
|
-
case "boolean": break;
|
|
11018
|
-
case "object":
|
|
11019
|
-
if (Array.isArray(arg)) toAdd = classnames(arg);
|
|
11020
|
-
else {
|
|
11021
|
-
toAdd = "";
|
|
11022
|
-
for (var k in arg) if (arg[k] && k) {
|
|
11023
|
-
toAdd && (toAdd += " ");
|
|
11024
|
-
toAdd += k;
|
|
11025
|
-
}
|
|
11026
|
-
}
|
|
11027
|
-
break;
|
|
11028
|
-
default: toAdd = arg;
|
|
11029
|
-
}
|
|
11030
|
-
if (toAdd) {
|
|
11031
|
-
cls && (cls += " ");
|
|
11032
|
-
cls += toAdd;
|
|
11033
|
-
}
|
|
11034
|
-
}
|
|
11035
|
-
return cls;
|
|
11036
|
-
};
|
|
11037
|
-
// ../../../node_modules/.pnpm/@emotion+css@11.13.5/node_modules/@emotion/css/dist/emotion-css.esm.js
|
|
11038
|
-
var _createEmotion = createEmotion({ key: "css" });
|
|
11039
|
-
_createEmotion.flush;
|
|
11040
|
-
_createEmotion.hydrate;
|
|
11041
|
-
var cx = _createEmotion.cx;
|
|
11042
|
-
_createEmotion.merge;
|
|
11043
|
-
_createEmotion.getRegisteredStyles;
|
|
11044
|
-
_createEmotion.injectGlobal;
|
|
11045
|
-
_createEmotion.keyframes;
|
|
11046
|
-
_createEmotion.css;
|
|
11047
|
-
_createEmotion.sheet;
|
|
11048
|
-
_createEmotion.cache;
|
|
11049
|
-
// ../../../node_modules/.pnpm/@wordpress+components@42.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_6d0393a58a031b78f608040e2ecbe6e0/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.mjs
|
|
11050
|
-
var isSerializedStyles = (o) => typeof o !== "undefined" && o !== null && ["name", "styles"].every((p) => typeof o[p] !== "undefined");
|
|
11051
|
-
var useCx = () => {
|
|
11052
|
-
const cache = __unsafe_useEmotionCache();
|
|
11053
|
-
return useCallback$1((...classNames) => {
|
|
11054
|
-
if (cache === null) throw new Error("The `useCx` hook should be only used within a valid Emotion Cache Context");
|
|
11055
|
-
return cx(...classNames.map((arg) => {
|
|
11056
|
-
if (isSerializedStyles(arg)) {
|
|
11057
|
-
insertStyles(cache, arg, false);
|
|
11058
|
-
return `${cache.key}-${arg.name}`;
|
|
11059
|
-
}
|
|
11060
|
-
return arg;
|
|
11061
|
-
}));
|
|
11062
|
-
}, [cache]);
|
|
11063
|
-
};
|
|
11064
|
-
// ../../../node_modules/.pnpm/memize@2.1.1/node_modules/memize/dist/index.js
|
|
11065
|
-
/**
|
|
11066
|
-
* Memize options object.
|
|
11067
|
-
*
|
|
11068
|
-
* @typedef MemizeOptions
|
|
11069
|
-
*
|
|
11070
|
-
* @property {number} [maxSize] Maximum size of the cache.
|
|
11071
|
-
*/
|
|
11072
|
-
/**
|
|
11073
|
-
* Internal cache entry.
|
|
11074
|
-
*
|
|
11075
|
-
* @typedef MemizeCacheNode
|
|
11076
|
-
*
|
|
11077
|
-
* @property {?MemizeCacheNode|undefined} [prev] Previous node.
|
|
11078
|
-
* @property {?MemizeCacheNode|undefined} [next] Next node.
|
|
11079
|
-
* @property {Array<*>} args Function arguments for cache
|
|
11080
|
-
* entry.
|
|
11081
|
-
* @property {*} val Function result.
|
|
11082
|
-
*/
|
|
11083
|
-
/**
|
|
11084
|
-
* Properties of the enhanced function for controlling cache.
|
|
11085
|
-
*
|
|
11086
|
-
* @typedef MemizeMemoizedFunction
|
|
11087
|
-
*
|
|
11088
|
-
* @property {()=>void} clear Clear the cache.
|
|
10462
|
+
* Properties of the enhanced function for controlling cache.
|
|
10463
|
+
*
|
|
10464
|
+
* @typedef MemizeMemoizedFunction
|
|
10465
|
+
*
|
|
10466
|
+
* @property {()=>void} clear Clear the cache.
|
|
11089
10467
|
*/
|
|
11090
10468
|
/**
|
|
11091
10469
|
* Accepts a function to be memoized, and returns a new memoized function, with
|
|
@@ -11151,90 +10529,36 @@ function memize(fn, options) {
|
|
|
11151
10529
|
};
|
|
11152
10530
|
return memoized;
|
|
11153
10531
|
}
|
|
11154
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
11155
|
-
|
|
11156
|
-
|
|
11157
|
-
|
|
11158
|
-
|
|
11159
|
-
|
|
11160
|
-
|
|
11161
|
-
if (Array.isArray(a)) {
|
|
11162
|
-
length = a.length;
|
|
11163
|
-
if (length != b.length) return false;
|
|
11164
|
-
for (i = length; i-- !== 0;) if (!equal(a[i], b[i])) return false;
|
|
11165
|
-
return true;
|
|
11166
|
-
}
|
|
11167
|
-
if (a instanceof Map && b instanceof Map) {
|
|
11168
|
-
if (a.size !== b.size) return false;
|
|
11169
|
-
for (i of a.entries()) if (!b.has(i[0])) return false;
|
|
11170
|
-
for (i of a.entries()) if (!equal(i[1], b.get(i[0]))) return false;
|
|
11171
|
-
return true;
|
|
11172
|
-
}
|
|
11173
|
-
if (a instanceof Set && b instanceof Set) {
|
|
11174
|
-
if (a.size !== b.size) return false;
|
|
11175
|
-
for (i of a.entries()) if (!b.has(i[0])) return false;
|
|
11176
|
-
return true;
|
|
11177
|
-
}
|
|
11178
|
-
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
|
|
11179
|
-
length = a.length;
|
|
11180
|
-
if (length != b.length) return false;
|
|
11181
|
-
for (i = length; i-- !== 0;) if (a[i] !== b[i]) return false;
|
|
11182
|
-
return true;
|
|
11183
|
-
}
|
|
11184
|
-
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
11185
|
-
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
11186
|
-
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
11187
|
-
keys = Object.keys(a);
|
|
11188
|
-
length = keys.length;
|
|
11189
|
-
if (length !== Object.keys(b).length) return false;
|
|
11190
|
-
for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
11191
|
-
for (i = length; i-- !== 0;) {
|
|
11192
|
-
var key = keys[i];
|
|
11193
|
-
if (!equal(a[key], b[key])) return false;
|
|
11194
|
-
}
|
|
11195
|
-
return true;
|
|
11196
|
-
}
|
|
11197
|
-
return a !== a && b !== b;
|
|
11198
|
-
};
|
|
11199
|
-
})))(), 1);
|
|
11200
|
-
var ComponentsContext = createContext$1({});
|
|
11201
|
-
ComponentsContext.displayName = "ComponentsContext";
|
|
11202
|
-
var useComponentsContext = () => useContext$1(ComponentsContext);
|
|
11203
|
-
function useContextSystemBridge({ value }) {
|
|
11204
|
-
const parentContext = useComponentsContext();
|
|
11205
|
-
const valueRef = useRef$1(value);
|
|
11206
|
-
use_update_effect_default(() => {
|
|
11207
|
-
if ((0, import_es6.default)(valueRef.current, value) && valueRef.current !== value) globalThis.SCRIPT_DEBUG === true && warning(`Please memoize your context: ${JSON.stringify(value)}`);
|
|
11208
|
-
}, [value]);
|
|
11209
|
-
return useMemo$1(() => {
|
|
11210
|
-
return deepmerge(parentContext ?? {}, value ?? {}, { isMergeableObject: isPlainObject });
|
|
11211
|
-
}, [parentContext, value]);
|
|
11212
|
-
}
|
|
11213
|
-
var BaseContextSystemProvider = ({ children, value }) => {
|
|
11214
|
-
const contextValue = useContextSystemBridge({ value });
|
|
11215
|
-
return /* @__PURE__ */ jsx(ComponentsContext.Provider, {
|
|
11216
|
-
value: contextValue,
|
|
11217
|
-
children
|
|
11218
|
-
});
|
|
11219
|
-
};
|
|
11220
|
-
memo(BaseContextSystemProvider);
|
|
11221
|
-
// ../../../node_modules/.pnpm/@wordpress+components@42.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_6d0393a58a031b78f608040e2ecbe6e0/node_modules/@wordpress/components/build-module/context/constants.mjs
|
|
11222
|
-
var COMPONENT_NAMESPACE = "data-wp-component";
|
|
11223
|
-
var CONNECTED_NAMESPACE = "data-wp-c16t";
|
|
11224
|
-
var CONNECT_STATIC_NAMESPACE = "__contextSystemKey__";
|
|
11225
|
-
// ../../../node_modules/.pnpm/@wordpress+components@42.0.0_@date-fns+tz@1.5.0_@types+react-dom@19.3.0_@types+react@19_6d0393a58a031b78f608040e2ecbe6e0/node_modules/@wordpress/components/build-module/context/get-styled-class-name-from-key.mjs
|
|
10532
|
+
// ../../../node_modules/.pnpm/@wordpress+components@44.0.0_patch_hash=dd89cc780626599c6721f4e05e7091dd7b0aed577d8a667_94a1a77c56d75249398bc99af3f14fa5/node_modules/@wordpress/components/build-module/context/get-styled-class-name-from-key.mjs
|
|
10533
|
+
/**
|
|
10534
|
+
* Generates the connected component CSS className based on the namespace.
|
|
10535
|
+
*
|
|
10536
|
+
* @param namespace The name of the connected component.
|
|
10537
|
+
* @return The generated CSS className.
|
|
10538
|
+
*/
|
|
11226
10539
|
function getStyledClassName(namespace) {
|
|
11227
10540
|
return `components-${paramCase(namespace)}`;
|
|
11228
10541
|
}
|
|
11229
|
-
|
|
11230
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
10542
|
+
const getStyledClassNameFromKey = memize(getStyledClassName);
|
|
10543
|
+
// ../../../node_modules/.pnpm/@wordpress+components@44.0.0_patch_hash=dd89cc780626599c6721f4e05e7091dd7b0aed577d8a667_94a1a77c56d75249398bc99af3f14fa5/node_modules/@wordpress/components/build-module/context/context-connect.mjs
|
|
10544
|
+
/**
|
|
10545
|
+
* Forwards ref (React.ForwardRef) and "Connects" (or registers) a component
|
|
10546
|
+
* within the Context system under a specified namespace.
|
|
10547
|
+
*
|
|
10548
|
+
* @param Component The component to register into the Context system.
|
|
10549
|
+
* @param namespace The namespace to register the component under.
|
|
10550
|
+
* @return The connected WordPressComponent
|
|
10551
|
+
*/
|
|
11231
10552
|
function contextConnect(Component, namespace) {
|
|
11232
10553
|
return _contextConnect(Component, namespace, { forwardsRef: true });
|
|
11233
10554
|
}
|
|
11234
10555
|
function _contextConnect(Component, namespace, options) {
|
|
11235
10556
|
const WrappedComponent = options?.forwardsRef ? forwardRef$1(Component) : Component;
|
|
11236
|
-
if (typeof namespace === "undefined")
|
|
10557
|
+
if (typeof namespace === "undefined") warning("contextConnect: Please provide a namespace");
|
|
11237
10558
|
let mergedNamespace = WrappedComponent["__contextSystemKey__"] || [namespace];
|
|
10559
|
+
/**
|
|
10560
|
+
* Consolidate (merge) namespaces before attaching it to the WrappedComponent.
|
|
10561
|
+
*/
|
|
11238
10562
|
if (Array.isArray(namespace)) mergedNamespace = [...mergedNamespace, ...namespace];
|
|
11239
10563
|
if (typeof namespace === "string") mergedNamespace = [...mergedNamespace, namespace];
|
|
11240
10564
|
return Object.assign(WrappedComponent, {
|
|
@@ -11243,17 +10567,48 @@ function _contextConnect(Component, namespace, options) {
|
|
|
11243
10567
|
selector: `.${getStyledClassNameFromKey(namespace)}`
|
|
11244
10568
|
});
|
|
11245
10569
|
}
|
|
11246
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
10570
|
+
// ../../../node_modules/.pnpm/@wordpress+components@44.0.0_patch_hash=dd89cc780626599c6721f4e05e7091dd7b0aed577d8a667_94a1a77c56d75249398bc99af3f14fa5/node_modules/@wordpress/components/build-module/context/utils.mjs
|
|
10571
|
+
/**
|
|
10572
|
+
* Creates a dedicated context namespace HTML attribute for components.
|
|
10573
|
+
* ns is short for "namespace"
|
|
10574
|
+
*
|
|
10575
|
+
* @example
|
|
10576
|
+
* ```jsx
|
|
10577
|
+
* <div {...ns('Container')} />
|
|
10578
|
+
* ```
|
|
10579
|
+
*
|
|
10580
|
+
* @param componentName The name for the component.
|
|
10581
|
+
* @return A props object with the namespaced HTML attribute.
|
|
10582
|
+
*/
|
|
11247
10583
|
function getNamespace(componentName) {
|
|
11248
10584
|
return { [COMPONENT_NAMESPACE]: componentName };
|
|
11249
10585
|
}
|
|
10586
|
+
/**
|
|
10587
|
+
* Creates a dedicated connected context namespace HTML attribute for components.
|
|
10588
|
+
* ns is short for "namespace"
|
|
10589
|
+
*
|
|
10590
|
+
* @example
|
|
10591
|
+
* ```jsx
|
|
10592
|
+
* <div {...cns()} />
|
|
10593
|
+
* ```
|
|
10594
|
+
*
|
|
10595
|
+
* @return A props object with the namespaced HTML attribute.
|
|
10596
|
+
*/
|
|
11250
10597
|
function getConnectedNamespace() {
|
|
11251
10598
|
return { [CONNECTED_NAMESPACE]: true };
|
|
11252
10599
|
}
|
|
11253
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
10600
|
+
// ../../../node_modules/.pnpm/@wordpress+components@44.0.0_patch_hash=dd89cc780626599c6721f4e05e7091dd7b0aed577d8a667_94a1a77c56d75249398bc99af3f14fa5/node_modules/@wordpress/components/build-module/context/use-context-system.mjs
|
|
10601
|
+
/**
|
|
10602
|
+
* Custom hook that derives registered props from the Context system.
|
|
10603
|
+
* These derived props are then consolidated with incoming component props.
|
|
10604
|
+
*
|
|
10605
|
+
* @param props Incoming props from the component.
|
|
10606
|
+
* @param namespace The namespace to register and to derive context props from.
|
|
10607
|
+
* @return The connected props.
|
|
10608
|
+
*/
|
|
11254
10609
|
function useContextSystem(props, namespace) {
|
|
11255
10610
|
const contextSystemProps = useComponentsContext();
|
|
11256
|
-
if (typeof namespace === "undefined")
|
|
10611
|
+
if (typeof namespace === "undefined") warning("useContextSystem: Please provide a namespace");
|
|
11257
10612
|
const contextProps = contextSystemProps?.[namespace] || {};
|
|
11258
10613
|
const finalComponentProps = {
|
|
11259
10614
|
...getConnectedNamespace(),
|
|
@@ -11263,7 +10618,7 @@ function useContextSystem(props, namespace) {
|
|
|
11263
10618
|
const overrideProps = _overrides;
|
|
11264
10619
|
const initialMergedProps = Object.entries(otherContextProps).length ? Object.assign({}, otherContextProps, props) : props;
|
|
11265
10620
|
const propsWithChildren = initialMergedProps;
|
|
11266
|
-
const classes =
|
|
10621
|
+
const classes = clsx(getStyledClassNameFromKey(namespace), props.className);
|
|
11267
10622
|
const rendered = typeof propsWithChildren.renderChildren === "function" ? propsWithChildren.renderChildren(initialMergedProps) : propsWithChildren.children;
|
|
11268
10623
|
for (const key in initialMergedProps) finalComponentProps[key] = initialMergedProps[key];
|
|
11269
10624
|
for (const key in overrideProps) finalComponentProps[key] = overrideProps[key];
|
|
@@ -11271,8 +10626,8 @@ function useContextSystem(props, namespace) {
|
|
|
11271
10626
|
finalComponentProps.className = classes;
|
|
11272
10627
|
return finalComponentProps;
|
|
11273
10628
|
}
|
|
11274
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
11275
|
-
|
|
10629
|
+
// ../../../node_modules/.pnpm/@wordpress+components@44.0.0_patch_hash=dd89cc780626599c6721f4e05e7091dd7b0aed577d8a667_94a1a77c56d75249398bc99af3f14fa5/node_modules/@wordpress/components/build-module/visually-hidden/styles.mjs
|
|
10630
|
+
const visuallyHidden = {
|
|
11276
10631
|
border: 0,
|
|
11277
10632
|
clip: "rect(1px, 1px, 1px, 1px)",
|
|
11278
10633
|
WebkitClipPath: "inset( 50% )",
|
|
@@ -11286,10 +10641,10 @@ var visuallyHidden = {
|
|
|
11286
10641
|
wordWrap: "normal",
|
|
11287
10642
|
wordBreak: "normal"
|
|
11288
10643
|
};
|
|
11289
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
11290
|
-
|
|
11291
|
-
|
|
11292
|
-
|
|
10644
|
+
// ../../../node_modules/.pnpm/@wordpress+components@44.0.0_patch_hash=dd89cc780626599c6721f4e05e7091dd7b0aed577d8a667_94a1a77c56d75249398bc99af3f14fa5/node_modules/@wordpress/components/build-module/utils/polymorphic-element.mjs
|
|
10645
|
+
const customAttributeRegExp = /^(data|aria|x)-/i;
|
|
10646
|
+
const eventHandlerRegExp = /^on[A-Z]/;
|
|
10647
|
+
const svgElementNames = new Set(`animate animateMotion animateTransform circle clipPath defs desc ellipse
|
|
11293
10648
|
feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix
|
|
11294
10649
|
feDiffuseLighting feDisplacementMap feDistantLight feDropShadow feFlood
|
|
11295
10650
|
feFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode
|
|
@@ -11297,7 +10652,7 @@ var svgElementNames = new Set(`animate animateMotion animateTransform circle cli
|
|
|
11297
10652
|
feTurbulence filter foreignObject g image line linearGradient marker mask
|
|
11298
10653
|
metadata mpath path pattern polygon polyline radialGradient rect set stop svg
|
|
11299
10654
|
switch symbol text textPath tspan use view`.split(/\s+/));
|
|
11300
|
-
|
|
10655
|
+
const baseElementProps = new Set(`children dangerouslySetInnerHTML key autoFocus defaultValue defaultChecked
|
|
11301
10656
|
innerHTML suppressContentEditableWarning suppressHydrationWarning valueLink
|
|
11302
10657
|
abbr accept acceptCharset accessKey action allow allowUserMedia
|
|
11303
10658
|
allowPaymentRequest allowFullScreen allowTransparency alt async autoComplete
|
|
@@ -11318,7 +10673,7 @@ var baseElementProps = new Set(`children dangerouslySetInnerHTML key autoFocus d
|
|
|
11318
10673
|
datatype inlist prefix property resource typeof vocab autoCapitalize
|
|
11319
10674
|
autoCorrect autoSave color incremental fallback inert itemProp itemScope
|
|
11320
10675
|
itemType itemID itemRef on option results security unselectable`.split(/\s+/));
|
|
11321
|
-
|
|
10676
|
+
const svgElementProps = new Set(`accentHeight accumulate additive alignmentBaseline allowReorder alphabetic
|
|
11322
10677
|
amplitude arabicForm ascent attributeName attributeType autoReverse azimuth
|
|
11323
10678
|
baseFrequency baselineShift baseProfile bbox begin bias by calcMode capHeight
|
|
11324
10679
|
clip clipPathUnits clipPath clipRule colorInterpolation
|
|
@@ -11353,7 +10708,7 @@ var svgElementProps = new Set(`accentHeight accumulate additive alignmentBaselin
|
|
|
11353
10708
|
xlinkActuate xlinkArcrole xlinkHref xlinkRole xlinkShow xlinkTitle xlinkType
|
|
11354
10709
|
xmlBase xmlns xmlnsXlink xmlLang xmlSpace y y1 y2 yChannelSelector z
|
|
11355
10710
|
zoomAndPan`.split(/\s+/));
|
|
11356
|
-
|
|
10711
|
+
const compatElementProps = /* @__PURE__ */ new Set([
|
|
11357
10712
|
"autofocus",
|
|
11358
10713
|
"class",
|
|
11359
10714
|
"for"
|
|
@@ -11374,19 +10729,39 @@ function UnforwardedPolymorphicElement({ as, ...props }, ref) {
|
|
|
11374
10729
|
...forwardedProps
|
|
11375
10730
|
});
|
|
11376
10731
|
}
|
|
11377
|
-
|
|
11378
|
-
|
|
10732
|
+
/**
|
|
10733
|
+
* Internal utility for components that need Emotion-compatible `as` behavior
|
|
10734
|
+
* while rendering with plain React elements.
|
|
10735
|
+
*/
|
|
10736
|
+
const PolymorphicElement = forwardRef$1(UnforwardedPolymorphicElement);
|
|
10737
|
+
// ../../../node_modules/.pnpm/@wordpress+components@44.0.0_patch_hash=dd89cc780626599c6721f4e05e7091dd7b0aed577d8a667_94a1a77c56d75249398bc99af3f14fa5/node_modules/@wordpress/components/build-module/view/component.mjs
|
|
11379
10738
|
function UnforwardedView({ css, ...restProps }, ref) {
|
|
11380
10739
|
return /* @__PURE__ */ jsx(PolymorphicElement, {
|
|
11381
10740
|
ref,
|
|
11382
10741
|
...restProps
|
|
11383
10742
|
});
|
|
11384
10743
|
}
|
|
11385
|
-
|
|
11386
|
-
|
|
10744
|
+
/**
|
|
10745
|
+
* `View` is a core component that renders everything in the library.
|
|
10746
|
+
* It is the principle component in the entire library.
|
|
10747
|
+
*
|
|
10748
|
+
* ```jsx
|
|
10749
|
+
* import { View } from `@wordpress/components`;
|
|
10750
|
+
*
|
|
10751
|
+
* function Example() {
|
|
10752
|
+
* return (
|
|
10753
|
+
* <View>
|
|
10754
|
+
* Code is Poetry
|
|
10755
|
+
* </View>
|
|
10756
|
+
* );
|
|
10757
|
+
* }
|
|
10758
|
+
* ```
|
|
10759
|
+
*/
|
|
10760
|
+
const View = Object.assign(forwardRef$1(UnforwardedView), { selector: ".components-view" });
|
|
10761
|
+
// ../../../node_modules/.pnpm/@wordpress+components@44.0.0_patch_hash=dd89cc780626599c6721f4e05e7091dd7b0aed577d8a667_94a1a77c56d75249398bc99af3f14fa5/node_modules/@wordpress/components/build-module/visually-hidden/component.mjs
|
|
11387
10762
|
function UnconnectedVisuallyHidden(props, forwardedRef) {
|
|
11388
10763
|
const { style: styleProp, ...contextProps } = useContextSystem(props, "VisuallyHidden");
|
|
11389
|
-
return /* @__PURE__ */ jsx(
|
|
10764
|
+
return /* @__PURE__ */ jsx(View, {
|
|
11390
10765
|
ref: forwardedRef,
|
|
11391
10766
|
...contextProps,
|
|
11392
10767
|
"data-visually-hidden": "",
|
|
@@ -11396,14 +10771,30 @@ function UnconnectedVisuallyHidden(props, forwardedRef) {
|
|
|
11396
10771
|
}
|
|
11397
10772
|
});
|
|
11398
10773
|
}
|
|
11399
|
-
|
|
11400
|
-
|
|
11401
|
-
|
|
10774
|
+
/**
|
|
10775
|
+
* `VisuallyHidden` is a component used to render text intended to be visually
|
|
10776
|
+
* hidden, but will show for alternate devices, for example a screen reader.
|
|
10777
|
+
*
|
|
10778
|
+
* ```jsx
|
|
10779
|
+
* import { VisuallyHidden } from `@wordpress/components`;
|
|
10780
|
+
*
|
|
10781
|
+
* function Example() {
|
|
10782
|
+
* return (
|
|
10783
|
+
* <VisuallyHidden>
|
|
10784
|
+
* <label>Code is Poetry</label>
|
|
10785
|
+
* </VisuallyHidden>
|
|
10786
|
+
* );
|
|
10787
|
+
* }
|
|
10788
|
+
* ```
|
|
10789
|
+
*/
|
|
10790
|
+
const VisuallyHidden$1 = contextConnect(UnconnectedVisuallyHidden, "VisuallyHidden");
|
|
10791
|
+
// ../../../node_modules/.pnpm/@wordpress+components@44.0.0_patch_hash=dd89cc780626599c6721f4e05e7091dd7b0aed577d8a667_94a1a77c56d75249398bc99af3f14fa5/node_modules/@wordpress/components/build-module/utils/use-responsive-value.mjs
|
|
10792
|
+
const breakpoints = [
|
|
11402
10793
|
"40em",
|
|
11403
10794
|
"52em",
|
|
11404
10795
|
"64em"
|
|
11405
10796
|
];
|
|
11406
|
-
|
|
10797
|
+
const useBreakpointIndex = (options = {}) => {
|
|
11407
10798
|
const { defaultIndex = 0, enabled = true } = options;
|
|
11408
10799
|
if (typeof defaultIndex !== "number") throw new TypeError(`Default breakpoint index should be a number. Got: ${defaultIndex}, ${typeof defaultIndex}`);
|
|
11409
10800
|
else if (defaultIndex < 0 || defaultIndex > breakpoints.length - 1) throw new RangeError(`Default breakpoint index out of range. Theme has ${breakpoints.length} breakpoints, got index ${defaultIndex}`);
|
|
@@ -11435,15 +10826,15 @@ function useResponsiveValue(values, options = {}) {
|
|
|
11435
10826
|
const array = values || [];
|
|
11436
10827
|
return array[index >= array.length ? array.length - 1 : index];
|
|
11437
10828
|
}
|
|
11438
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
11439
|
-
|
|
10829
|
+
// ../../../node_modules/.pnpm/@wordpress+components@44.0.0_patch_hash=dd89cc780626599c6721f4e05e7091dd7b0aed577d8a667_94a1a77c56d75249398bc99af3f14fa5/node_modules/@wordpress/components/build-module/grid/utils.mjs
|
|
10830
|
+
const ALIGNMENTS = {
|
|
11440
10831
|
bottom: {
|
|
11441
10832
|
alignItems: "flex-end",
|
|
11442
10833
|
justifyContent: "center"
|
|
11443
10834
|
},
|
|
11444
10835
|
bottomLeft: {
|
|
11445
|
-
alignItems: "flex-
|
|
11446
|
-
justifyContent: "flex-
|
|
10836
|
+
alignItems: "flex-end",
|
|
10837
|
+
justifyContent: "flex-start"
|
|
11447
10838
|
},
|
|
11448
10839
|
bottomRight: {
|
|
11449
10840
|
alignItems: "flex-end",
|
|
@@ -11482,8 +10873,16 @@ var ALIGNMENTS = {
|
|
|
11482
10873
|
function getAlignmentProps(alignment) {
|
|
11483
10874
|
return alignment ? ALIGNMENTS[alignment] ?? {} : {};
|
|
11484
10875
|
}
|
|
11485
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
11486
|
-
|
|
10876
|
+
// ../../../node_modules/.pnpm/@wordpress+components@44.0.0_patch_hash=dd89cc780626599c6721f4e05e7091dd7b0aed577d8a667_94a1a77c56d75249398bc99af3f14fa5/node_modules/@wordpress/components/build-module/grid/hook.mjs
|
|
10877
|
+
const STYLE_HASH_ATTRIBUTE = "data-wp-hash";
|
|
10878
|
+
/**
|
|
10879
|
+
* Returns the shared style runtime registry.
|
|
10880
|
+
*
|
|
10881
|
+
* The registry is stored on `globalThis` so separately bundled copies of this
|
|
10882
|
+
* package can coordinate through the same document and style maps.
|
|
10883
|
+
*
|
|
10884
|
+
* @return The shared runtime registry.
|
|
10885
|
+
*/
|
|
11487
10886
|
function getRuntime() {
|
|
11488
10887
|
const globalScope = globalThis;
|
|
11489
10888
|
if (globalScope.__wpStyleRuntime) return globalScope.__wpStyleRuntime;
|
|
@@ -11495,11 +10894,27 @@ function getRuntime() {
|
|
|
11495
10894
|
if (typeof document !== "undefined") registerDocument(document);
|
|
11496
10895
|
return globalScope.__wpStyleRuntime;
|
|
11497
10896
|
}
|
|
10897
|
+
/**
|
|
10898
|
+
* Checks whether a document already contains a style tag for a hash.
|
|
10899
|
+
*
|
|
10900
|
+
* @param targetDocument Document to inspect.
|
|
10901
|
+
* @param hash Stable hash for the transformed CSS.
|
|
10902
|
+
*
|
|
10903
|
+
* @return Whether the style hash already exists in the document.
|
|
10904
|
+
*/
|
|
11498
10905
|
function documentContainsStyleHash(targetDocument, hash) {
|
|
11499
10906
|
if (!targetDocument.head) return false;
|
|
11500
10907
|
for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) return true;
|
|
11501
10908
|
return false;
|
|
11502
10909
|
}
|
|
10910
|
+
/**
|
|
10911
|
+
* Injects a registered style into a document, unless that document already
|
|
10912
|
+
* contains a style tag for the same hash.
|
|
10913
|
+
*
|
|
10914
|
+
* @param targetDocument Document to inject the style into.
|
|
10915
|
+
* @param hash Stable hash for the transformed CSS.
|
|
10916
|
+
* @param css CSS text to inject.
|
|
10917
|
+
*/
|
|
11503
10918
|
function injectStyle(targetDocument, hash, css) {
|
|
11504
10919
|
if (!targetDocument.head) return;
|
|
11505
10920
|
const runtime = getRuntime();
|
|
@@ -11519,6 +10934,17 @@ function injectStyle(targetDocument, hash, css) {
|
|
|
11519
10934
|
targetDocument.head.appendChild(style);
|
|
11520
10935
|
injectedStyles.add(hash);
|
|
11521
10936
|
}
|
|
10937
|
+
/**
|
|
10938
|
+
* Registers a document as a style injection target.
|
|
10939
|
+
*
|
|
10940
|
+
* Existing registered styles are replayed into the document immediately.
|
|
10941
|
+
* Documents are reference-counted so multiple providers can safely register the
|
|
10942
|
+
* same document without one cleanup removing it while another registration is
|
|
10943
|
+
* still active.
|
|
10944
|
+
*
|
|
10945
|
+
* @param targetDocument Document to receive registered styles.
|
|
10946
|
+
* @return Cleanup function that unregisters this document registration.
|
|
10947
|
+
*/
|
|
11522
10948
|
function registerDocument(targetDocument) {
|
|
11523
10949
|
const runtime = getRuntime();
|
|
11524
10950
|
runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);
|
|
@@ -11533,51 +10959,62 @@ function registerDocument(targetDocument) {
|
|
|
11533
10959
|
runtime.documents.set(targetDocument, count - 1);
|
|
11534
10960
|
};
|
|
11535
10961
|
}
|
|
10962
|
+
/**
|
|
10963
|
+
* Registers a style and injects it into all registered documents.
|
|
10964
|
+
*
|
|
10965
|
+
* The hash is used as the deduplication key, so calling this repeatedly with
|
|
10966
|
+
* the same hash will not add duplicate style tags to a document.
|
|
10967
|
+
* Registered styles are retained for the lifetime of the page so they can be
|
|
10968
|
+
* replayed into documents that are registered later.
|
|
10969
|
+
*
|
|
10970
|
+
* @param hash Stable hash for the transformed CSS.
|
|
10971
|
+
* @param css CSS text to inject.
|
|
10972
|
+
*/
|
|
11536
10973
|
function registerStyle(hash, css) {
|
|
11537
10974
|
const runtime = getRuntime();
|
|
11538
10975
|
runtime.styles.set(hash, css);
|
|
11539
10976
|
for (const targetDocument of runtime.documents.keys()) injectStyle(targetDocument, hash, css);
|
|
11540
10977
|
}
|
|
11541
|
-
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle("
|
|
10978
|
+
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle("b1a8e206b7", ".ad3e2e48d7abbecd__grid{--wp-components-grid-align:initial;--wp-components-grid-justify:initial;--wp-components-grid-gap:initial;--wp-components-grid-template-columns:initial;--wp-components-grid-template-rows:initial;--wp-components-grid-row-gap:initial;--wp-components-grid-column-gap:initial;display:grid}.ad3e2e48d7abbecd__grid:not(:where(._519ed3f6107b2f0e__row-gap-inherit,.cd62b95f8b7a55ca__row-gap-initial,._226744df7703790b__row-gap-unset,._372e9fe7fa60a162__row-gap-revert,.a788bb6771f557d4__row-gap-revert-layer)){row-gap:var(--wp-components-grid-row-gap,calc(4px*var(--wp-components-grid-gap)))}.ad3e2e48d7abbecd__grid:not(:where(.c811e15146756906__column-gap-inherit,._17d3c2ea7daf9367__column-gap-initial,._595e6195481b9016__column-gap-unset,.a3ecb3e47731c19e__column-gap-revert,._7c87cfbf3c22f476__column-gap-revert-layer)){column-gap:var(--wp-components-grid-column-gap,calc(4px*var(--wp-components-grid-gap)))}._25a972dc3223dff3__has-align:not(:where(._3cda38ca04ad4eb9__align-inherit,.f1d7342c52a8cb04__align-initial,._0d1a6c7ee990f351__align-unset,._57c7b85e7abf618b__align-revert,._82cb0c4950962787__align-revert-layer)){align-items:var(--wp-components-grid-align)}._801d1214723237b8__has-justify:not(:where(.b83c5dbf3264515b__justify-inherit,._5b7394b39d69670e__justify-initial,._3e7f0418752602e5__justify-unset,._5f937df46d7b2259__justify-revert,.bf2a4718a1ddba5c__justify-revert-layer)){justify-content:var(--wp-components-grid-justify)}._3c6ac9820776f1cb__has-template-columns:not(:where(._35faa4d32eedef32__template-columns-inherit,._8150cadb3f438833__template-columns-initial,.bcd5f2b096dec164__template-columns-unset,._48d047bc6fb687b8__template-columns-revert,._93f250669aa1a5a7__template-columns-revert-layer)){grid-template-columns:var(--wp-components-grid-template-columns)}.c2703b6b15e69b82__has-template-rows:not(:where(._3e9d5ffc53e4afc0__template-rows-inherit,._64bb5fbdf6d1038a__template-rows-initial,.f8f5df7043222325__template-rows-unset,._408aaf58100e60d5__template-rows-revert,.e0730d6abf0f3d2a__template-rows-revert-layer)){grid-template-rows:var(--wp-components-grid-template-rows)}._43af1cbfad3e73dd__is-inline{display:inline-grid;vertical-align:middle}._3cda38ca04ad4eb9__align-inherit{align-items:inherit}.f1d7342c52a8cb04__align-initial{align-items:normal}._0d1a6c7ee990f351__align-unset{align-items:unset}._57c7b85e7abf618b__align-revert{align-items:revert}._82cb0c4950962787__align-revert-layer{align-items:revert-layer}.b83c5dbf3264515b__justify-inherit{justify-content:inherit}._5b7394b39d69670e__justify-initial{justify-content:normal}._3e7f0418752602e5__justify-unset{justify-content:unset}._5f937df46d7b2259__justify-revert{justify-content:revert}.bf2a4718a1ddba5c__justify-revert-layer{justify-content:revert-layer}._35faa4d32eedef32__template-columns-inherit{grid-template-columns:inherit}._8150cadb3f438833__template-columns-initial{grid-template-columns:none}.bcd5f2b096dec164__template-columns-unset{grid-template-columns:unset}._48d047bc6fb687b8__template-columns-revert{grid-template-columns:revert}._93f250669aa1a5a7__template-columns-revert-layer{grid-template-columns:revert-layer}._3e9d5ffc53e4afc0__template-rows-inherit{grid-template-rows:inherit}._64bb5fbdf6d1038a__template-rows-initial{grid-template-rows:none}.f8f5df7043222325__template-rows-unset{grid-template-rows:unset}._408aaf58100e60d5__template-rows-revert{grid-template-rows:revert}.e0730d6abf0f3d2a__template-rows-revert-layer{grid-template-rows:revert-layer}._519ed3f6107b2f0e__row-gap-inherit{row-gap:inherit}.cd62b95f8b7a55ca__row-gap-initial{row-gap:normal}._226744df7703790b__row-gap-unset{row-gap:unset}._372e9fe7fa60a162__row-gap-revert{row-gap:revert}.a788bb6771f557d4__row-gap-revert-layer{row-gap:revert-layer}.c811e15146756906__column-gap-inherit{column-gap:inherit}._17d3c2ea7daf9367__column-gap-initial{column-gap:normal}._595e6195481b9016__column-gap-unset{column-gap:unset}.a3ecb3e47731c19e__column-gap-revert{column-gap:revert}._7c87cfbf3c22f476__column-gap-revert-layer{column-gap:revert-layer}");
|
|
11542
10979
|
var style_module_default = {
|
|
11543
|
-
"grid": "
|
|
11544
|
-
"row-gap-inherit": "
|
|
11545
|
-
"row-gap-initial": "
|
|
11546
|
-
"row-gap-unset": "
|
|
11547
|
-
"row-gap-revert": "
|
|
11548
|
-
"row-gap-revert-layer": "
|
|
11549
|
-
"column-gap-inherit": "
|
|
11550
|
-
"column-gap-initial": "
|
|
11551
|
-
"column-gap-unset": "
|
|
11552
|
-
"column-gap-revert": "
|
|
11553
|
-
"column-gap-revert-layer": "
|
|
11554
|
-
"has-align": "
|
|
11555
|
-
"align-inherit": "
|
|
11556
|
-
"align-initial": "
|
|
11557
|
-
"align-unset": "
|
|
11558
|
-
"align-revert": "
|
|
11559
|
-
"align-revert-layer": "
|
|
11560
|
-
"has-justify": "
|
|
11561
|
-
"justify-inherit": "
|
|
11562
|
-
"justify-initial": "
|
|
11563
|
-
"justify-unset": "
|
|
11564
|
-
"justify-revert": "
|
|
11565
|
-
"justify-revert-layer": "
|
|
11566
|
-
"has-template-columns": "
|
|
11567
|
-
"template-columns-inherit": "
|
|
11568
|
-
"template-columns-initial": "
|
|
11569
|
-
"template-columns-unset": "
|
|
11570
|
-
"template-columns-revert": "
|
|
11571
|
-
"template-columns-revert-layer": "
|
|
11572
|
-
"has-template-rows": "
|
|
11573
|
-
"template-rows-inherit": "
|
|
11574
|
-
"template-rows-initial": "
|
|
11575
|
-
"template-rows-unset": "
|
|
11576
|
-
"template-rows-revert": "
|
|
11577
|
-
"template-rows-revert-layer": "
|
|
11578
|
-
"is-inline": "
|
|
11579
|
-
};
|
|
11580
|
-
|
|
10980
|
+
"grid": "ad3e2e48d7abbecd__grid",
|
|
10981
|
+
"row-gap-inherit": "_519ed3f6107b2f0e__row-gap-inherit",
|
|
10982
|
+
"row-gap-initial": "cd62b95f8b7a55ca__row-gap-initial",
|
|
10983
|
+
"row-gap-unset": "_226744df7703790b__row-gap-unset",
|
|
10984
|
+
"row-gap-revert": "_372e9fe7fa60a162__row-gap-revert",
|
|
10985
|
+
"row-gap-revert-layer": "a788bb6771f557d4__row-gap-revert-layer",
|
|
10986
|
+
"column-gap-inherit": "c811e15146756906__column-gap-inherit",
|
|
10987
|
+
"column-gap-initial": "_17d3c2ea7daf9367__column-gap-initial",
|
|
10988
|
+
"column-gap-unset": "_595e6195481b9016__column-gap-unset",
|
|
10989
|
+
"column-gap-revert": "a3ecb3e47731c19e__column-gap-revert",
|
|
10990
|
+
"column-gap-revert-layer": "_7c87cfbf3c22f476__column-gap-revert-layer",
|
|
10991
|
+
"has-align": "_25a972dc3223dff3__has-align",
|
|
10992
|
+
"align-inherit": "_3cda38ca04ad4eb9__align-inherit",
|
|
10993
|
+
"align-initial": "f1d7342c52a8cb04__align-initial",
|
|
10994
|
+
"align-unset": "_0d1a6c7ee990f351__align-unset",
|
|
10995
|
+
"align-revert": "_57c7b85e7abf618b__align-revert",
|
|
10996
|
+
"align-revert-layer": "_82cb0c4950962787__align-revert-layer",
|
|
10997
|
+
"has-justify": "_801d1214723237b8__has-justify",
|
|
10998
|
+
"justify-inherit": "b83c5dbf3264515b__justify-inherit",
|
|
10999
|
+
"justify-initial": "_5b7394b39d69670e__justify-initial",
|
|
11000
|
+
"justify-unset": "_3e7f0418752602e5__justify-unset",
|
|
11001
|
+
"justify-revert": "_5f937df46d7b2259__justify-revert",
|
|
11002
|
+
"justify-revert-layer": "bf2a4718a1ddba5c__justify-revert-layer",
|
|
11003
|
+
"has-template-columns": "_3c6ac9820776f1cb__has-template-columns",
|
|
11004
|
+
"template-columns-inherit": "_35faa4d32eedef32__template-columns-inherit",
|
|
11005
|
+
"template-columns-initial": "_8150cadb3f438833__template-columns-initial",
|
|
11006
|
+
"template-columns-unset": "bcd5f2b096dec164__template-columns-unset",
|
|
11007
|
+
"template-columns-revert": "_48d047bc6fb687b8__template-columns-revert",
|
|
11008
|
+
"template-columns-revert-layer": "_93f250669aa1a5a7__template-columns-revert-layer",
|
|
11009
|
+
"has-template-rows": "c2703b6b15e69b82__has-template-rows",
|
|
11010
|
+
"template-rows-inherit": "_3e9d5ffc53e4afc0__template-rows-inherit",
|
|
11011
|
+
"template-rows-initial": "_64bb5fbdf6d1038a__template-rows-initial",
|
|
11012
|
+
"template-rows-unset": "f8f5df7043222325__template-rows-unset",
|
|
11013
|
+
"template-rows-revert": "_408aaf58100e60d5__template-rows-revert",
|
|
11014
|
+
"template-rows-revert-layer": "e0730d6abf0f3d2a__template-rows-revert-layer",
|
|
11015
|
+
"is-inline": "_43af1cbfad3e73dd__is-inline"
|
|
11016
|
+
};
|
|
11017
|
+
const CSS_WIDE_KEYWORDS = /* @__PURE__ */ new Set([
|
|
11581
11018
|
"inherit",
|
|
11582
11019
|
"initial",
|
|
11583
11020
|
"unset",
|
|
@@ -11626,15 +11063,35 @@ function useGrid(props) {
|
|
|
11626
11063
|
}
|
|
11627
11064
|
};
|
|
11628
11065
|
}
|
|
11629
|
-
// ../../../node_modules/.pnpm/@wordpress+components@
|
|
11066
|
+
// ../../../node_modules/.pnpm/@wordpress+components@44.0.0_patch_hash=dd89cc780626599c6721f4e05e7091dd7b0aed577d8a667_94a1a77c56d75249398bc99af3f14fa5/node_modules/@wordpress/components/build-module/grid/component.mjs
|
|
11630
11067
|
function UnconnectedGrid(props, forwardedRef) {
|
|
11631
11068
|
const gridProps = useGrid(props);
|
|
11632
|
-
return /* @__PURE__ */ jsx(
|
|
11069
|
+
return /* @__PURE__ */ jsx(View, {
|
|
11633
11070
|
...gridProps,
|
|
11634
11071
|
ref: forwardedRef
|
|
11635
11072
|
});
|
|
11636
11073
|
}
|
|
11637
|
-
|
|
11074
|
+
/**
|
|
11075
|
+
* `Grid` is a primitive layout component that can arrange content in a grid configuration.
|
|
11076
|
+
*
|
|
11077
|
+
* ```jsx
|
|
11078
|
+
* import {
|
|
11079
|
+
* __experimentalGrid as Grid,
|
|
11080
|
+
* __experimentalText as Text
|
|
11081
|
+
* } from `@wordpress/components`;
|
|
11082
|
+
*
|
|
11083
|
+
* function Example() {
|
|
11084
|
+
* return (
|
|
11085
|
+
* <Grid columns={ 3 }>
|
|
11086
|
+
* <Text>Code</Text>
|
|
11087
|
+
* <Text>is</Text>
|
|
11088
|
+
* <Text>Poetry</Text>
|
|
11089
|
+
* </Grid>
|
|
11090
|
+
* );
|
|
11091
|
+
* }
|
|
11092
|
+
* ```
|
|
11093
|
+
*/
|
|
11094
|
+
const Grid$1 = contextConnect(UnconnectedGrid, "Grid");
|
|
11638
11095
|
// src/charts/leaderboard-chart/hooks/use-fitted-row-count.ts
|
|
11639
11096
|
/**
|
|
11640
11097
|
* Fractional layout rounding can put a row's bottom a hair past the container's
|
|
@@ -11798,6 +11255,41 @@ var leaderboard_chart_module_default = {
|
|
|
11798
11255
|
"stretch": "a8ccharts-GovfoW-stretch",
|
|
11799
11256
|
"valueContainer": "a8ccharts-GovfoW-valueContainer"
|
|
11800
11257
|
};
|
|
11258
|
+
// src/charts/leaderboard-chart/private/resolve-leaderboard-entries.ts
|
|
11259
|
+
const toShare = (value, max) => max === 0 ? 0 : value / max * 100;
|
|
11260
|
+
const toDelta = (currentValue, previousValue) => {
|
|
11261
|
+
if (previousValue == null) return;
|
|
11262
|
+
if (previousValue === 0) return currentValue === 0 ? 0 : void 0;
|
|
11263
|
+
return (currentValue - previousValue) / Math.abs(previousValue) * 100;
|
|
11264
|
+
};
|
|
11265
|
+
/**
|
|
11266
|
+
* Fills in the shares and delta an entry omits, derived from its values.
|
|
11267
|
+
*
|
|
11268
|
+
* @param data - Leaderboard entries; passed shares and delta win over derived ones.
|
|
11269
|
+
* @param options - Resolver options.
|
|
11270
|
+
* @param options.includePrevious - Whether previous values count toward the shared max.
|
|
11271
|
+
* @param options.clampNegative - Whether a negative share draws as an empty bar instead of below zero.
|
|
11272
|
+
* @return Entries with `currentShare` always set.
|
|
11273
|
+
*/
|
|
11274
|
+
function resolveLeaderboardEntries(data, { includePrevious, clampNegative = false }) {
|
|
11275
|
+
const magnitude = clampNegative ? (value) => Math.max(value, 0) : Math.abs;
|
|
11276
|
+
const clamp = (share) => clampNegative ? Math.max(share, 0) : share;
|
|
11277
|
+
const max = data.reduce((largest, { currentValue, previousValue }) => {
|
|
11278
|
+
const previous = includePrevious && previousValue != null ? magnitude(previousValue) : 0;
|
|
11279
|
+
return Math.max(largest, magnitude(currentValue), previous);
|
|
11280
|
+
}, 0);
|
|
11281
|
+
return data.map((entry) => {
|
|
11282
|
+
const passedOrDerivedPrevious = entry.previousShare ?? (entry.previousValue != null ? toShare(entry.previousValue, max) : void 0);
|
|
11283
|
+
const previousShare = passedOrDerivedPrevious !== void 0 ? clamp(passedOrDerivedPrevious) : void 0;
|
|
11284
|
+
const delta = entry.delta ?? toDelta(entry.currentValue, entry.previousValue);
|
|
11285
|
+
return {
|
|
11286
|
+
...entry,
|
|
11287
|
+
currentShare: clamp(entry.currentShare ?? toShare(entry.currentValue, max)),
|
|
11288
|
+
...previousShare !== void 0 && { previousShare },
|
|
11289
|
+
...delta !== void 0 && { delta }
|
|
11290
|
+
};
|
|
11291
|
+
});
|
|
11292
|
+
}
|
|
11801
11293
|
// src/charts/leaderboard-chart/leaderboard-chart.tsx
|
|
11802
11294
|
const ROW_GAP = "var(--a8c-charts-dimension-leaderboard-row-gap, 12px)";
|
|
11803
11295
|
const COLUMN_GAP = "var(--a8c-charts-dimension-leaderboard-column-gap, 4px)";
|
|
@@ -11908,6 +11400,7 @@ const BarWithLabel = ({ entry, withComparison, withOverlayLabel, primaryColor, s
|
|
|
11908
11400
|
* @param props.height - Optional height of the chart container in pixels
|
|
11909
11401
|
* @param props.withComparison - Whether to show comparison data
|
|
11910
11402
|
* @param props.withOverlayLabel - Whether to overlay the label on top of the bar
|
|
11403
|
+
* @param props.negativeBars - How a negative value draws: from a shared zero point, or as an empty bar
|
|
11911
11404
|
* @param props.primaryColor - Primary color for current period bars
|
|
11912
11405
|
* @param props.secondaryColor - Secondary color for comparison period bars
|
|
11913
11406
|
* @param props.valueFormatter - Custom formatter for values
|
|
@@ -11925,7 +11418,7 @@ const BarWithLabel = ({ entry, withComparison, withOverlayLabel, primaryColor, s
|
|
|
11925
11418
|
* @param props.ariaLabel - Accessible name for the list, defaulting to "Leaderboard chart"
|
|
11926
11419
|
* @return JSX element representing the leaderboard chart
|
|
11927
11420
|
*/
|
|
11928
|
-
const LeaderboardChartInternal = ({ data, chartId: providedChartId, width: propWidth, height: propHeight, withComparison = false, withOverlayLabel = false, primaryColor, secondaryColor, valueFormatter = defaultValueFormatter, deltaFormatter = defaultDeltaFormatter, animation, loading = false, fitRows = false, showLegend = false, legend = {}, legendLabels, gap = "md", ariaLabel, className, style, children }) => {
|
|
11421
|
+
const LeaderboardChartInternal = ({ data, chartId: providedChartId, width: propWidth, height: propHeight, withComparison = false, withOverlayLabel = false, negativeBars = "diverge", primaryColor, secondaryColor, valueFormatter = defaultValueFormatter, deltaFormatter = defaultDeltaFormatter, animation, loading = false, fitRows = false, showLegend = false, legend = {}, legendLabels, gap = "md", ariaLabel, className, style, children }) => {
|
|
11929
11422
|
const legendInteractive = legend.interactive ?? false;
|
|
11930
11423
|
const legendPosition = legend.position ?? "bottom";
|
|
11931
11424
|
const chartId = useChartId(providedChartId);
|
|
@@ -11979,13 +11472,21 @@ const LeaderboardChartInternal = ({ data, chartId: providedChartId, width: propW
|
|
|
11979
11472
|
withComparison,
|
|
11980
11473
|
withOverlayLabel
|
|
11981
11474
|
]);
|
|
11475
|
+
const withComparisonBars = withComparison && !withOverlayLabel;
|
|
11476
|
+
const resolvedData = useMemo(() => resolveLeaderboardEntries(data ?? [], {
|
|
11477
|
+
includePrevious: withComparisonBars,
|
|
11478
|
+
clampNegative: negativeBars === "clamp"
|
|
11479
|
+
}), [
|
|
11480
|
+
data,
|
|
11481
|
+
withComparisonBars,
|
|
11482
|
+
negativeBars
|
|
11483
|
+
]);
|
|
11982
11484
|
const divergingScale = useMemo(() => {
|
|
11983
|
-
const withComparisonBars = withComparison && !withOverlayLabel;
|
|
11984
11485
|
const scale = {
|
|
11985
11486
|
negative: 0,
|
|
11986
11487
|
positive: 0
|
|
11987
11488
|
};
|
|
11988
|
-
for (const entry of
|
|
11489
|
+
for (const entry of resolvedData) {
|
|
11989
11490
|
const shares = [entry.currentShare];
|
|
11990
11491
|
if (withComparisonBars && hasPreviousValue(entry)) shares.push(entry.previousShare);
|
|
11991
11492
|
for (const share of shares) {
|
|
@@ -11994,11 +11495,7 @@ const LeaderboardChartInternal = ({ data, chartId: providedChartId, width: propW
|
|
|
11994
11495
|
}
|
|
11995
11496
|
}
|
|
11996
11497
|
return scale.negative > 0 ? scale : void 0;
|
|
11997
|
-
}, [
|
|
11998
|
-
data,
|
|
11999
|
-
withComparison,
|
|
12000
|
-
withOverlayLabel
|
|
12001
|
-
]);
|
|
11498
|
+
}, [resolvedData, withComparisonBars]);
|
|
12002
11499
|
const isDataValid = Boolean(data && data.length > 0);
|
|
12003
11500
|
const chartMetadata = useMemo(() => ({
|
|
12004
11501
|
withComparison,
|
|
@@ -12077,14 +11574,14 @@ const LeaderboardChartInternal = ({ data, chartId: providedChartId, width: propW
|
|
|
12077
11574
|
}), allSeriesHidden ? /* @__PURE__ */ jsx("div", {
|
|
12078
11575
|
className: leaderboard_chart_module_default.emptyState,
|
|
12079
11576
|
children: getAllHiddenMessage(legendInteractive, "series")
|
|
12080
|
-
}) : /* @__PURE__ */ jsx(
|
|
11577
|
+
}) : /* @__PURE__ */ jsx(Grid$1, {
|
|
12081
11578
|
role: "list",
|
|
12082
11579
|
"aria-label": ariaLabel ?? __("Leaderboard chart", "jetpack-charts"),
|
|
12083
11580
|
templateColumns,
|
|
12084
11581
|
rowGap: ROW_GAP,
|
|
12085
11582
|
columnGap: COLUMN_GAP,
|
|
12086
11583
|
"data-leaderboard-grid": true,
|
|
12087
|
-
children:
|
|
11584
|
+
children: resolvedData.map((entry, rowIndex) => {
|
|
12088
11585
|
const rowStyle = shouldFitRows && rowIndex >= fittedCount ? { visibility: "hidden" } : void 0;
|
|
12089
11586
|
const hasPreviousPeriodValue = hasPreviousValue(entry);
|
|
12090
11587
|
const hasDelta = hasDeltaValue(entry);
|
|
@@ -12118,7 +11615,7 @@ const LeaderboardChartInternal = ({ data, chartId: providedChartId, width: propW
|
|
|
12118
11615
|
children: [/* @__PURE__ */ jsx("span", {
|
|
12119
11616
|
"aria-hidden": "true",
|
|
12120
11617
|
children: "—"
|
|
12121
|
-
}), /* @__PURE__ */ jsx(
|
|
11618
|
+
}), /* @__PURE__ */ jsx(VisuallyHidden$1, {
|
|
12122
11619
|
as: "span",
|
|
12123
11620
|
children: hasPreviousPeriodValue ? __("Percentage change unavailable", "jetpack-charts") : __("No comparison data", "jetpack-charts")
|
|
12124
11621
|
})]
|