ggaction 0.0.17 → 0.0.19
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 +96 -0
- package/README.md +6 -2
- package/knowledge/action-card.schema.json +1 -1
- package/knowledge/action-cards.json +1 -1
- package/knowledge/intent-taxonomy.json +1 -1
- package/knowledge/mcp-resources.json +1 -1
- package/knowledge/task-resolver.js +1 -1
- package/package.json +3 -3
- package/src/BasicChartProgram.js +1 -1
- package/src/accessibility.js +3 -2
- package/src/actions/boxPlots/create.js +14 -4
- package/src/actions/boxPlots/edit.js +39 -33
- package/src/actions/boxPlots/materialize.js +7 -3
- package/src/actions/boxPlots/options.js +37 -11
- package/src/actions/canvas/actions.js +70 -95
- package/src/actions/canvas/fitting.js +20 -1
- package/src/actions/canvas/index.js +3 -0
- package/src/actions/canvas/plotBorder.js +28 -0
- package/src/actions/charts/area.js +2 -2
- package/src/actions/charts/bar.js +34 -7
- package/src/actions/charts/ecdf.js +4 -18
- package/src/actions/charts/endpoints.js +4 -18
- package/src/actions/charts/heatmap.js +8 -7
- package/src/actions/charts/index.js +2 -0
- package/src/actions/charts/interval-regression.js +2 -2
- package/src/actions/charts/line.js +1 -1
- package/src/actions/charts/pie.js +3 -47
- package/src/actions/charts/radial.js +34 -12
- package/src/actions/charts/scatter.js +16 -2
- package/src/actions/charts/shared.js +2 -2
- package/src/actions/charts/text.js +35 -0
- package/src/actions/composition/actions.js +6 -2
- package/src/actions/data/box.js +2 -1
- package/src/actions/data/derived.js +11 -1
- package/src/actions/data/edit.js +3 -1
- package/src/actions/data/index.js +4 -0
- package/src/actions/data/regression.js +25 -16
- package/src/actions/data/regressionStatistics.js +73 -0
- package/src/actions/data/shared.js +8 -4
- package/src/actions/data/stack.js +3 -1
- package/src/actions/distributions/revision.js +24 -18
- package/src/actions/encodings/appearance.js +37 -29
- package/src/actions/encodings/barWidth.js +36 -11
- package/src/actions/encodings/channels.js +0 -1
- package/src/actions/encodings/color/continuous.js +1 -1
- package/src/actions/encodings/color/index.js +1 -1
- package/src/actions/encodings/color/policy.js +10 -3
- package/src/actions/encodings/density/resolve.js +1 -6
- package/src/actions/encodings/position/policies/arc.js +12 -10
- package/src/actions/encodings/position/policies/area.js +3 -3
- package/src/actions/encodings/position/policies/bar.js +15 -6
- package/src/actions/encodings/position/policies/line.js +17 -6
- package/src/actions/encodings/position/resolve.js +3 -2
- package/src/actions/encodings/ranged.js +17 -0
- package/src/actions/encodings/remove.js +14 -8
- package/src/actions/encodings/seriesLayout.js +1 -0
- package/src/actions/encodings/shared.js +26 -24
- package/src/actions/encodings/text.js +6 -3
- package/src/actions/errorBands/create.js +2 -2
- package/src/actions/errorBands/edit.js +2 -1
- package/src/actions/facets/actions.js +176 -247
- package/src/actions/facets/guides.js +2 -1
- package/src/actions/gradientPlots/resolve.js +2 -17
- package/src/actions/guides/applicability.js +1 -1
- package/src/actions/guides/axes/axes.js +30 -11
- package/src/actions/guides/axes/axis.js +72 -10
- package/src/actions/guides/axes/components.js +13 -13
- package/src/actions/guides/axes/edit.js +36 -24
- package/src/actions/guides/axes/labels.js +155 -71
- package/src/actions/guides/axes/lines.js +27 -24
- package/src/actions/guides/axes/parallel/lifecycle.js +1 -1
- package/src/actions/guides/axes/parallel/policy.js +8 -7
- package/src/actions/guides/axes/remove.js +13 -8
- package/src/actions/guides/axes/tickGroups.js +11 -7
- package/src/actions/guides/axes/ticks.js +36 -24
- package/src/actions/guides/axes/titles.js +107 -69
- package/src/actions/guides/basic.js +2 -0
- package/src/actions/guides/facadeAxes.js +33 -24
- package/src/actions/guides/facadeLegend.js +12 -4
- package/src/actions/guides/grids/grid.js +8 -2
- package/src/actions/guides/grids/resolve.js +102 -58
- package/src/actions/guides/legends/blocks.js +46 -20
- package/src/actions/guides/legends/categorical/actions.js +95 -19
- package/src/actions/guides/legends/categorical/components.js +15 -18
- package/src/actions/guides/legends/categorical/index.js +8 -0
- package/src/actions/guides/legends/categorical/layout.js +45 -20
- package/src/actions/guides/legends/categorical/options.js +39 -22
- package/src/actions/guides/legends/categorical/recipes.js +7 -3
- package/src/actions/guides/legends/categorical/resolve.js +11 -4
- package/src/actions/guides/legends/categorical/symbols.js +38 -18
- package/src/actions/guides/legends/categorical/validation.js +1 -6
- package/src/actions/guides/legends/colorSize.js +110 -0
- package/src/actions/guides/legends/combine.js +37 -0
- package/src/actions/guides/legends/continuous/colorSymbols.js +1 -0
- package/src/actions/guides/legends/continuous/common.js +1 -447
- package/src/actions/guides/legends/continuous/gradient.js +73 -46
- package/src/actions/guides/legends/continuous/interval.js +4 -4
- package/src/actions/guides/legends/continuous/opacity.js +33 -21
- package/src/actions/guides/legends/creation.js +2 -0
- package/src/actions/guides/legends/edit.js +1 -604
- package/src/actions/guides/legends/focused.js +8 -7
- package/src/actions/guides/legends/group.js +1 -0
- package/src/actions/guides/legends/lane.js +1 -516
- package/src/actions/guides/legends/lifecycle.js +2 -1
- package/src/actions/guides/legends/remove.js +9 -3
- package/src/actions/guides/legends/sampling.js +1 -1
- package/src/actions/guides/legends/size.js +65 -47
- package/src/actions/guides/legends/strokeWidth.js +13 -29
- package/src/actions/guides/legends/target.js +2 -79
- package/src/actions/guides/legends/transition.js +44 -11
- package/src/actions/guides/polar/axes/labels.js +4 -2
- package/src/actions/guides/polar/axes/titles.js +7 -5
- package/src/actions/guides/polar/resolve.js +6 -14
- package/src/actions/guides/tickValues.js +8 -5
- package/src/actions/index.js +16 -16
- package/src/actions/marks/arc/actions.js +3 -10
- package/src/actions/marks/area/actions.js +8 -5
- package/src/actions/marks/area/materialize.js +8 -9
- package/src/actions/marks/bar/create.js +10 -4
- package/src/actions/marks/bar/edit.js +29 -14
- package/src/actions/marks/bar/materialize.js +15 -7
- package/src/actions/marks/line/actions.js +11 -4
- package/src/actions/marks/line/materialize.js +9 -5
- package/src/actions/marks/point/edit.js +1 -1
- package/src/actions/marks/point/materialize.js +5 -1
- package/src/actions/marks/rect/actions.js +3 -3
- package/src/actions/marks/remove.js +12 -10
- package/src/actions/marks/rule/actions.js +7 -4
- package/src/actions/marks/text/actions.js +17 -5
- package/src/actions/marks/text/layout.js +3 -0
- package/src/actions/primitives/createGraphics.js +3 -2
- package/src/actions/primitives/editGraphics.js +15 -11
- package/src/actions/primitives/graphicProperties.js +1 -6
- package/src/actions/primitives/semanticAction.js +27 -1
- package/src/actions/primitives/semanticValidation/guide.js +11 -1
- package/src/actions/primitives/semanticValidation/layer.js +8 -0
- package/src/actions/regression/create.js +1 -1
- package/src/actions/regression/edit.js +18 -6
- package/src/actions/regression/resolve.js +2 -6
- package/src/actions/scales/channels.js +9 -4
- package/src/actions/scales/consumers/families.js +16 -5
- package/src/actions/scales/create.js +10 -5
- package/src/actions/scales/definitions.js +1 -425
- package/src/actions/scales/edit.js +3 -3
- package/src/actions/scales/editPolicy.js +12 -3
- package/src/actions/scales/materialize.js +1 -1
- package/src/actions/scales/patch.js +1 -1
- package/src/actions/scales/preview.js +21 -1
- package/src/actions/scales/quantitativeColor.js +8 -3
- package/src/actions/selection/actions.js +1 -13
- package/src/actions/theme/reconcile.js +126 -45
- package/src/actions/theme/state.js +12 -0
- package/src/actions/titles/actions.js +5 -18
- package/src/actions/titles/resolve.js +41 -19
- package/src/actions/violinPlots/edit.js +3 -20
- package/src/core/compositionState.js +6 -3
- package/src/core/font.js +9 -2
- package/src/core/graphicProperties.js +1 -0
- package/src/core/optionRequirements.js +1 -0
- package/src/core/programState.js +4 -0
- package/src/core/resourceReferences.js +5 -2
- package/src/core/textMetricProfile.js +3 -2
- package/src/core/textMetrics.js +41 -4
- package/src/core/validation.js +35 -0
- package/src/core/vocabulary.js +7 -0
- package/src/grammar/aggregate.js +4 -18
- package/src/grammar/arcs.js +1 -386
- package/src/grammar/areaPaint.js +10 -0
- package/src/grammar/areaSeries.js +18 -10
- package/src/grammar/axisTextPlacement.js +1 -0
- package/src/grammar/bars/geometry.js +30 -3
- package/src/grammar/bars/policy.js +12 -1
- package/src/grammar/bin.js +2 -12
- package/src/grammar/bin2d.js +1 -6
- package/src/grammar/boxPlot.js +56 -9
- package/src/grammar/categoryOrder.js +1 -6
- package/src/grammar/colorSizeLegend.js +39 -0
- package/src/grammar/complete.js +15 -19
- package/src/grammar/computed.js +115 -26
- package/src/grammar/curveCommands.js +29 -16
- package/src/grammar/datasetSchema.js +13 -9
- package/src/grammar/displayLabels.js +36 -0
- package/src/grammar/ecdf.js +2 -9
- package/src/grammar/facets/dependencies.js +6 -2
- package/src/grammar/facets/guides.js +58 -30
- package/src/grammar/facets/index.js +2 -5
- package/src/grammar/facets/legendIntent.js +65 -0
- package/src/grammar/fold.js +2 -12
- package/src/grammar/gradientProfile.js +1 -6
- package/src/grammar/guideDash.js +1 -0
- package/src/grammar/impute.js +21 -48
- package/src/grammar/interval.js +2 -9
- package/src/grammar/legendBlocks.js +1 -0
- package/src/grammar/legendBorder.js +9 -0
- package/src/grammar/legendClip.js +19 -0
- package/src/grammar/legendCombinations.js +45 -0
- package/src/grammar/legendGradient.js +27 -0
- package/src/grammar/legendGroups.js +1 -0
- package/src/grammar/legendOpacity.js +6 -0
- package/src/grammar/legendTitleStyle.js +22 -0
- package/src/grammar/lineSeries.js +32 -17
- package/src/grammar/markLabels.js +5 -2
- package/src/grammar/normalize.js +4 -54
- package/src/grammar/numeric.js +1 -290
- package/src/grammar/parallelCoordinates.js +1 -6
- package/src/grammar/parseTime.js +41 -0
- package/src/grammar/pathCommands.js +11 -4
- package/src/grammar/pointShapes.js +16 -2
- package/src/grammar/polar.js +1 -184
- package/src/grammar/positionCompatibility.js +3 -3
- package/src/grammar/regression/derive.js +16 -2
- package/src/grammar/regression/models.js +142 -54
- package/src/grammar/regression/parameters.js +23 -4
- package/src/grammar/regression/statistics.js +64 -0
- package/src/grammar/roundedRect.js +42 -54
- package/src/grammar/scales/appearance.js +1 -206
- package/src/grammar/scales/color.js +1 -382
- package/src/grammar/scales/colorConsumers.js +5 -2
- package/src/grammar/scales/definition.js +1 -197
- package/src/grammar/scales/discretized.js +1 -195
- package/src/grammar/scales/size.js +1 -456
- package/src/grammar/scales/temporal.js +2 -13
- package/src/grammar/scales/transformed.js +1 -383
- package/src/grammar/scales/types.js +1 -1
- package/src/grammar/scales/validation.js +1 -66
- package/src/grammar/schemas/concreteGraphic.js +14 -0
- package/src/grammar/schemas/graphic.js +6 -0
- package/src/grammar/schemas/graphicBounds.js +31 -7
- package/src/grammar/schemas/semanticPath.js +19 -3
- package/src/grammar/stack.js +2 -10
- package/src/grammar/statisticalReference.js +1 -6
- package/src/grammar/summary.js +4 -27
- package/src/grammar/text.js +19 -0
- package/src/grammar/timeUnit.js +22 -11
- package/src/grammar/transformKeys.js +47 -0
- package/src/grammar/transformTopology.js +1 -0
- package/src/grammar/transforms.js +15 -2
- package/src/grammar/valueFormat.js +17 -5
- package/src/grammar/weightedStatistics.js +1 -6
- package/src/grammar/window.js +4 -58
- package/src/inspectionDescriptors.js +1 -1
- package/src/layout/canvas.js +1 -110
- package/src/layout/facets.js +1 -244
- package/src/layout/guideCollisions.js +9 -1
- package/src/layout/labels.js +1 -0
- package/src/layout/legend.js +13 -0
- package/src/layout/legendGroup.js +1 -0
- package/src/layout/legendItems.js +59 -15
- package/src/layout/legendLane.js +1 -441
- package/src/layout/legendText.js +1 -0
- package/src/layout/title.js +35 -13
- package/src/materialization/bars/aggregate.js +11 -5
- package/src/materialization/bars/histogram.js +4 -1
- package/src/materialization/bars/ranged.js +19 -6
- package/src/materialization/bars/resolve.js +22 -1
- package/src/materialization/compositionSnapshot.js +2 -7
- package/src/materialization/coordinateBounds.js +21 -0
- package/src/materialization/dependencies.js +4 -44
- package/src/materialization/facetGuides/edit.js +30 -0
- package/src/materialization/facetGuides/layout.js +1 -0
- package/src/materialization/facetGuides/owner.js +125 -0
- package/src/materialization/facetGuides/ownerLayout.js +71 -0
- package/src/materialization/facetGuides/placement.js +71 -14
- package/src/materialization/facetGuides/preparation.js +22 -7
- package/src/materialization/facetHeaders.js +1 -347
- package/src/materialization/facets.js +1 -185
- package/src/materialization/graphicHierarchy.js +5 -1
- package/src/materialization/graphicTranslation.js +73 -0
- package/src/materialization/guides/layout.js +1 -57
- package/src/materialization/guides/resources.js +1 -123
- package/src/materialization/layout.js +53 -0
- package/src/materialization/legendBorder.js +28 -0
- package/src/materialization/legendClip.js +76 -0
- package/src/materialization/legendGroups.js +1 -0
- package/src/materialization/legendText.js +1 -0
- package/src/materialization/legends.js +2 -2
- package/src/materialization/marks/capabilities.js +5 -6
- package/src/materialization/rect.js +1 -1
- package/src/materialization/scaleGuideDependencies.js +14 -15
- package/src/materialization/scales/map.js +6 -0
- package/src/materialization/scales/policies/arc.js +8 -7
- package/src/materialization/scales/policies/bar.js +19 -7
- package/src/materialization/scales/policies/series.js +2 -1
- package/src/materialization/scales/resolve.js +7 -3
- package/src/materialization/selection/items/arc.js +1 -1
- package/src/materialization/selection/items/bar.js +7 -6
- package/src/materialization/selection/items/path.js +7 -6
- package/src/materialization/selection/items/rect.js +2 -2
- package/src/materialization/text.js +13 -4
- package/src/materialization/textLines.js +15 -0
- package/src/materialization/typography.js +10 -2
- package/src/persistence/codec.js +37 -6
- package/src/persistence/validation.js +220 -0
- package/src/persistence.js +19 -6
- package/src/renderers/canvas/circle.js +6 -3
- package/src/renderers/canvas/fill.js +7 -1
- package/src/renderers/canvas/index.js +22 -11
- package/src/renderers/canvas/isolated.js +166 -0
- package/src/renderers/canvas/limits.js +3 -0
- package/src/renderers/canvas/line.js +1 -0
- package/src/renderers/canvas/path.js +1 -1
- package/src/renderers/canvas/rect.js +11 -8
- package/src/renderers/canvas/stroke.js +2 -1
- package/src/renderers/canvas/text.js +5 -3
- package/src/renderers/pdf.js +2 -2
- package/src/renderers/png.js +2 -2
- package/src/renderers/svg.js +14 -4
- package/src/selectors/axes.js +1 -0
- package/src/selectors/graphicCapacity.js +38 -0
- package/src/selectors/layers.js +19 -0
- package/src/theme/defaults.js +8 -2
- package/src/version.js +1 -1
- package/types/basic.d.ts +3 -0
- package/types/index.d.ts +12 -0
- package/types/program.d.ts +536 -129
|
@@ -45,14 +45,23 @@ export function normalizeRegressionParameters({
|
|
|
45
45
|
method = "linear",
|
|
46
46
|
degree,
|
|
47
47
|
span,
|
|
48
|
+
robustIterations,
|
|
48
49
|
confidenceMethod,
|
|
49
50
|
level,
|
|
50
51
|
confidence,
|
|
51
52
|
interval
|
|
52
53
|
} = {}) {
|
|
53
|
-
if (!["linear", "polynomial", "loess"].includes(method)) {
|
|
54
|
+
if (!["linear", "polynomial", "loess", "exp"].includes(method)) {
|
|
54
55
|
throw new Error(`Unsupported regression method "${method}".`);
|
|
55
56
|
}
|
|
57
|
+
if (method === "exp") {
|
|
58
|
+
if (degree !== undefined || span !== undefined || robustIterations !== undefined ||
|
|
59
|
+
confidenceMethod !== undefined || level !== undefined || confidence !== undefined ||
|
|
60
|
+
(interval !== undefined && interval !== false)) {
|
|
61
|
+
throw new Error("Exponential regression only supports interval false and no confidence or method-specific options.");
|
|
62
|
+
}
|
|
63
|
+
return cloneAndFreeze({ method, interval: false });
|
|
64
|
+
}
|
|
56
65
|
if (method === "loess") {
|
|
57
66
|
if (degree !== undefined) {
|
|
58
67
|
throw new Error("Regression degree requires the polynomial method.");
|
|
@@ -69,7 +78,15 @@ export function normalizeRegressionParameters({
|
|
|
69
78
|
"Regression LOESS span must be greater than zero and at most one."
|
|
70
79
|
);
|
|
71
80
|
}
|
|
72
|
-
|
|
81
|
+
const iterations = robustIterations === undefined ? 0 : robustIterations;
|
|
82
|
+
if (!Number.isInteger(iterations) || iterations < 0 || iterations > 32) {
|
|
83
|
+
throw new RangeError("LOESS robustIterations must be an integer in [0, 32].");
|
|
84
|
+
}
|
|
85
|
+
return cloneAndFreeze({ method, span: resolvedSpan,
|
|
86
|
+
...(iterations === 0 ? {} : { robustIterations: iterations }) });
|
|
87
|
+
}
|
|
88
|
+
if (robustIterations !== undefined) {
|
|
89
|
+
throw new Error("Regression robustIterations requires the loess method.");
|
|
73
90
|
}
|
|
74
91
|
if (span !== undefined) {
|
|
75
92
|
throw new Error("Regression span requires the loess method.");
|
|
@@ -140,7 +157,7 @@ export function validateRegressionTransform(transform) {
|
|
|
140
157
|
const supported = [
|
|
141
158
|
"type", "method", "x", "y", "groupBy", "confidenceMethod", "level",
|
|
142
159
|
"confidence", "interval",
|
|
143
|
-
"degree", "span", "predict", "missing"
|
|
160
|
+
"degree", "span", "robustIterations", "predict", "missing"
|
|
144
161
|
];
|
|
145
162
|
const unknown = Object.keys(transform).find(key => !supported.includes(key));
|
|
146
163
|
if (unknown !== undefined) {
|
|
@@ -166,6 +183,7 @@ export function validateRegressionTransform(transform) {
|
|
|
166
183
|
method: transform.method,
|
|
167
184
|
degree: transform.degree,
|
|
168
185
|
span: transform.span,
|
|
186
|
+
robustIterations: transform.robustIterations,
|
|
169
187
|
confidenceMethod: transform.confidenceMethod,
|
|
170
188
|
level: transform.level,
|
|
171
189
|
confidence: transform.confidence,
|
|
@@ -202,7 +220,8 @@ export function normalizeRegressionTransform(args = {}) {
|
|
|
202
220
|
? { degree: parameters.degree }
|
|
203
221
|
: {}),
|
|
204
222
|
...(parameters.method === "loess"
|
|
205
|
-
? { span: parameters.span
|
|
223
|
+
? { span: parameters.span, ...(parameters.robustIterations === undefined
|
|
224
|
+
? {} : { robustIterations: parameters.robustIterations }) }
|
|
206
225
|
: parameters.interval === false ? { interval: false } : {
|
|
207
226
|
confidenceMethod: parameters.confidenceMethod,
|
|
208
227
|
level: parameters.level,
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { isPlainObject } from "../../core/immutable.js";
|
|
2
|
+
import { rejectUnknownProperties } from "../../core/validation.js";
|
|
3
|
+
|
|
4
|
+
export const REGRESSION_STATISTIC_FIELDS = Object.freeze(["count", "intercept", "slope", "rSquared"]);
|
|
5
|
+
|
|
6
|
+
export function validateRegressionStatisticsTransform(transform) {
|
|
7
|
+
if (!isPlainObject(transform)) throw new TypeError("Regression statistics transform must be a plain object.");
|
|
8
|
+
rejectUnknownProperties(transform, ["type"], "regression statistics transform");
|
|
9
|
+
if (transform.type !== "regressionStatistics") throw new Error("Unsupported regression statistics transform.");
|
|
10
|
+
return transform;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function requireRegressionStatisticsSource(source) {
|
|
14
|
+
const transform = source?.transform?.[0];
|
|
15
|
+
if (source?.transform?.length !== 1 || transform.type !== "regression") {
|
|
16
|
+
throw new Error("Regression statistics source must be a regression dataset.");
|
|
17
|
+
}
|
|
18
|
+
if (transform.method !== "linear") throw new Error("Regression statistics only supports linear regression.");
|
|
19
|
+
if (REGRESSION_STATISTIC_FIELDS.includes(transform.groupBy)) {
|
|
20
|
+
throw new Error(`Regression statistics group field "${transform.groupBy}" collides with a statistic output.`);
|
|
21
|
+
}
|
|
22
|
+
return transform;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function validateRegressionFitStatistics(cache, dataset, source) {
|
|
26
|
+
if (!isPlainObject(cache)) throw new TypeError("Regression fit statistics must be a plain object.");
|
|
27
|
+
rejectUnknownProperties(cache, ["version", "method", "groups"], "regression fit statistics");
|
|
28
|
+
const transform = dataset?.transform?.[0];
|
|
29
|
+
if (dataset?.transform?.length !== 1 || transform.type !== "regression" || transform.method !== "linear" ||
|
|
30
|
+
!Array.isArray(dataset.values) || cache.version !== 1 || cache.method !== "linear" || !Array.isArray(cache.groups)) {
|
|
31
|
+
throw new Error("Regression fit statistics requires a materialized linear owner and version 1 groups.");
|
|
32
|
+
}
|
|
33
|
+
const expected = new Map();
|
|
34
|
+
for (const row of source?.values ?? []) {
|
|
35
|
+
if (transform.missing === "drop" && (row[transform.x] == null || row[transform.y] == null)) continue;
|
|
36
|
+
if (!Number.isFinite(row[transform.x]) || !Number.isFinite(row[transform.y])) {
|
|
37
|
+
throw new Error("Regression fit statistics source must contain eligible finite pairs.");
|
|
38
|
+
}
|
|
39
|
+
const key = transform.groupBy === undefined ? undefined : row[transform.groupBy];
|
|
40
|
+
expected.set(key, (expected.get(key) ?? 0) + 1);
|
|
41
|
+
}
|
|
42
|
+
const groups = [...expected.entries()];
|
|
43
|
+
if (groups.length !== cache.groups.length) throw new Error("Regression fit statistics group count does not match its source.");
|
|
44
|
+
cache.groups.forEach((row, index) => {
|
|
45
|
+
if (!isPlainObject(row)) throw new TypeError("Regression fit statistic row must be a plain object.");
|
|
46
|
+
const grouped = transform.groupBy !== undefined;
|
|
47
|
+
rejectUnknownProperties(row, [...REGRESSION_STATISTIC_FIELDS, ...(grouped ? ["group"] : [])], "regression fit statistic row");
|
|
48
|
+
if (grouped && !Object.is(row.group, groups[index][0]) ||
|
|
49
|
+
!Number.isSafeInteger(row.count) || row.count < 2 || row.count !== groups[index][1] ||
|
|
50
|
+
!Number.isFinite(row.intercept) || !Number.isFinite(row.slope) ||
|
|
51
|
+
row.rSquared !== null && !Number.isFinite(row.rSquared)) {
|
|
52
|
+
throw new Error("Regression fit statistics contains invalid coefficients, group identity or observation count.");
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return cache;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function regressionStatisticsRows(cache, dataset) {
|
|
59
|
+
const transform = requireRegressionStatisticsSource(dataset);
|
|
60
|
+
return cache.groups.map(({ group, count, intercept, slope, rSquared }) => ({
|
|
61
|
+
...(transform.groupBy === undefined ? {} : { [transform.groupBy]: group }),
|
|
62
|
+
count, intercept, slope, rSquared
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
@@ -5,8 +5,12 @@ import {
|
|
|
5
5
|
} from "./strokeStyle.js";
|
|
6
6
|
|
|
7
7
|
export const ROUNDED_RECT_K = 4 * (Math.sqrt(2) - 1) / 3;
|
|
8
|
+
export const RECT_RADIUS_PROPERTIES = Object.freeze([
|
|
9
|
+
"cornerRadius", "cornerRadiusTopLeft", "cornerRadiusTopRight",
|
|
10
|
+
"cornerRadiusBottomRight", "cornerRadiusBottomLeft"
|
|
11
|
+
]);
|
|
8
12
|
export const RECT_STYLE_PROPERTIES = Object.freeze([
|
|
9
|
-
|
|
13
|
+
...RECT_RADIUS_PROPERTIES,
|
|
10
14
|
...STROKE_STYLE_PROPERTIES
|
|
11
15
|
]);
|
|
12
16
|
|
|
@@ -17,12 +21,12 @@ function requireFinite(value, property) {
|
|
|
17
21
|
return value;
|
|
18
22
|
}
|
|
19
23
|
|
|
20
|
-
export function validateCornerRadius(value, label = "Rect style") {
|
|
24
|
+
export function validateCornerRadius(value, label = "Rect style", property = "cornerRadius") {
|
|
21
25
|
if (!Number.isFinite(value)) {
|
|
22
|
-
throw new TypeError(`${label}
|
|
26
|
+
throw new TypeError(`${label} ${property} must be a finite number.`);
|
|
23
27
|
}
|
|
24
28
|
if (value < 0) {
|
|
25
|
-
throw new RangeError(`${label}
|
|
29
|
+
throw new RangeError(`${label} ${property} must not be negative.`);
|
|
26
30
|
}
|
|
27
31
|
return value;
|
|
28
32
|
}
|
|
@@ -33,9 +37,9 @@ export function requestedRectStyleDetails(request = {}, label = "Rect style") {
|
|
|
33
37
|
}
|
|
34
38
|
return freezeOwned({
|
|
35
39
|
...requestedStrokeDetails(request, label),
|
|
36
|
-
...
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
...Object.fromEntries(RECT_RADIUS_PROPERTIES
|
|
41
|
+
.filter(property => Object.hasOwn(request, property))
|
|
42
|
+
.map(property => [property, validateCornerRadius(request[property], label, property)]))
|
|
39
43
|
});
|
|
40
44
|
}
|
|
41
45
|
|
|
@@ -65,60 +69,48 @@ export function resolveRoundedRectRadius(width, height, requestedRadius) {
|
|
|
65
69
|
return Math.min(requestedRadius, width / 2, height / 2);
|
|
66
70
|
}
|
|
67
71
|
|
|
72
|
+
export function hasRectRadius(style = {}) {
|
|
73
|
+
return RECT_RADIUS_PROPERTIES.some(property => Object.hasOwn(style, property));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function resolveCornerRadii(width, height, requested) {
|
|
77
|
+
const style = typeof requested === "number" ? { cornerRadius: requested } : requested;
|
|
78
|
+
const details = requestedRectStyleDetails(style, "Rounded rect");
|
|
79
|
+
return RECT_RADIUS_PROPERTIES.slice(1).map(property => resolveRoundedRectRadius(
|
|
80
|
+
width, height, details[property] ?? details.cornerRadius ?? 0
|
|
81
|
+
));
|
|
82
|
+
}
|
|
83
|
+
|
|
68
84
|
export function roundedRectCommands({ x, y, width, height, radius }) {
|
|
69
85
|
const geometry = normalizeRectGeometry({ x, y, width, height });
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
geometry.height,
|
|
73
|
-
radius
|
|
74
|
-
);
|
|
75
|
-
if (!(r > 0)) {
|
|
86
|
+
const [tl, tr, br, bl] = resolveCornerRadii(geometry.width, geometry.height, radius);
|
|
87
|
+
if (![tl, tr, br, bl].some(value => value > 0)) {
|
|
76
88
|
throw new RangeError("Rounded rect commands require a positive resolved radius.");
|
|
77
89
|
}
|
|
78
90
|
const right = geometry.x + geometry.width;
|
|
79
91
|
const bottom = geometry.y + geometry.height;
|
|
80
|
-
const
|
|
92
|
+
const k = ROUNDED_RECT_K;
|
|
81
93
|
return freezeOwned([
|
|
82
|
-
{ op: "M", x: geometry.x +
|
|
83
|
-
{ op: "L", x: right -
|
|
94
|
+
{ op: "M", x: geometry.x + tl, y: geometry.y },
|
|
95
|
+
{ op: "L", x: right - tr, y: geometry.y },
|
|
84
96
|
{
|
|
85
|
-
op: "C",
|
|
86
|
-
|
|
87
|
-
y1: geometry.y,
|
|
88
|
-
x2: right,
|
|
89
|
-
y2: geometry.y + r - c,
|
|
90
|
-
x: right,
|
|
91
|
-
y: geometry.y + r
|
|
97
|
+
op: "C", x1: right - tr + k * tr, y1: geometry.y,
|
|
98
|
+
x2: right, y2: geometry.y + tr - k * tr, x: right, y: geometry.y + tr
|
|
92
99
|
},
|
|
93
|
-
{ op: "L", x: right, y: bottom -
|
|
100
|
+
{ op: "L", x: right, y: bottom - br },
|
|
94
101
|
{
|
|
95
|
-
op: "C",
|
|
96
|
-
|
|
97
|
-
y1: bottom - r + c,
|
|
98
|
-
x2: right - r + c,
|
|
99
|
-
y2: bottom,
|
|
100
|
-
x: right - r,
|
|
101
|
-
y: bottom
|
|
102
|
+
op: "C", x1: right, y1: bottom - br + k * br,
|
|
103
|
+
x2: right - br + k * br, y2: bottom, x: right - br, y: bottom
|
|
102
104
|
},
|
|
103
|
-
{ op: "L", x: geometry.x +
|
|
105
|
+
{ op: "L", x: geometry.x + bl, y: bottom },
|
|
104
106
|
{
|
|
105
|
-
op: "C",
|
|
106
|
-
|
|
107
|
-
y1: bottom,
|
|
108
|
-
x2: geometry.x,
|
|
109
|
-
y2: bottom - r + c,
|
|
110
|
-
x: geometry.x,
|
|
111
|
-
y: bottom - r
|
|
107
|
+
op: "C", x1: geometry.x + bl - k * bl, y1: bottom,
|
|
108
|
+
x2: geometry.x, y2: bottom - bl + k * bl, x: geometry.x, y: bottom - bl
|
|
112
109
|
},
|
|
113
|
-
{ op: "L", x: geometry.x, y: geometry.y +
|
|
110
|
+
{ op: "L", x: geometry.x, y: geometry.y + tl },
|
|
114
111
|
{
|
|
115
|
-
op: "C",
|
|
116
|
-
|
|
117
|
-
y1: geometry.y + r - c,
|
|
118
|
-
x2: geometry.x + r - c,
|
|
119
|
-
y2: geometry.y,
|
|
120
|
-
x: geometry.x + r,
|
|
121
|
-
y: geometry.y
|
|
112
|
+
op: "C", x1: geometry.x, y1: geometry.y + tl - k * tl,
|
|
113
|
+
x2: geometry.x + tl - k * tl, y2: geometry.y, x: geometry.x + tl, y: geometry.y
|
|
122
114
|
},
|
|
123
115
|
{ op: "Z" }
|
|
124
116
|
].map(command => freezeOwned(command)));
|
|
@@ -129,15 +121,11 @@ export function materializeRectItem(properties, requestedRadius = 0) {
|
|
|
129
121
|
throw new TypeError("Rounded rect item properties must be a plain object.");
|
|
130
122
|
}
|
|
131
123
|
const geometry = normalizeRectGeometry(properties);
|
|
132
|
-
const
|
|
133
|
-
geometry.width,
|
|
134
|
-
geometry.height,
|
|
135
|
-
requestedRadius
|
|
136
|
-
);
|
|
124
|
+
const radii = resolveCornerRadii(geometry.width, geometry.height, requestedRadius);
|
|
137
125
|
const appearance = Object.fromEntries(Object.entries(properties).filter(
|
|
138
126
|
([key]) => !["x", "y", "width", "height"].includes(key)
|
|
139
127
|
));
|
|
140
|
-
return radius === 0
|
|
128
|
+
return radii.every(radius => radius === 0)
|
|
141
129
|
? freezeOwned({
|
|
142
130
|
type: "rect",
|
|
143
131
|
properties: freezeOwned({ ...geometry, ...appearance })
|
|
@@ -145,7 +133,7 @@ export function materializeRectItem(properties, requestedRadius = 0) {
|
|
|
145
133
|
: freezeOwned({
|
|
146
134
|
type: "path",
|
|
147
135
|
properties: freezeOwned({
|
|
148
|
-
commands: roundedRectCommands({ ...geometry, radius }),
|
|
136
|
+
commands: roundedRectCommands({ ...geometry, radius: requestedRadius }),
|
|
149
137
|
...appearance
|
|
150
138
|
})
|
|
151
139
|
});
|
|
@@ -1,206 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { validateUnitInterval } from "../../core/validation.js";
|
|
3
|
-
import { POINT_SHAPES } from "../pointShapes.js";
|
|
4
|
-
import {
|
|
5
|
-
normalizePalette,
|
|
6
|
-
resolvePalette
|
|
7
|
-
} from "../palettes.js";
|
|
8
|
-
|
|
9
|
-
export const DASH10 = cloneAndFreeze([
|
|
10
|
-
[], [8, 4], [3, 3], [12, 4], [8, 3, 2, 3],
|
|
11
|
-
[12, 3, 3, 3], [2, 2], [10, 3, 2, 3, 2, 3], [14, 4, 4, 4], [6, 2, 2, 2]
|
|
12
|
-
]);
|
|
13
|
-
export const NAMED_DASH_PATTERNS = cloneAndFreeze({
|
|
14
|
-
solid: [],
|
|
15
|
-
dashed: [6, 4],
|
|
16
|
-
dotted: [1, 3],
|
|
17
|
-
dashdot: [6, 3, 1, 3]
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export { POINT_SHAPES } from "../pointShapes.js";
|
|
21
|
-
export const DEFAULT_SIZE_RANGE = cloneAndFreeze([24, 196]);
|
|
22
|
-
export const DEFAULT_OPACITY_RANGE = cloneAndFreeze([0.2, 1]);
|
|
23
|
-
export const DEFAULT_STROKE_WIDTH_RANGE = cloneAndFreeze([1, 8]);
|
|
24
|
-
|
|
25
|
-
export function validateColorRange(range) {
|
|
26
|
-
if (range === "auto") return range;
|
|
27
|
-
if (Array.isArray(range)) {
|
|
28
|
-
if (
|
|
29
|
-
range.length === 0 ||
|
|
30
|
-
!range.every(color => typeof color === "string" && color.length > 0)
|
|
31
|
-
) {
|
|
32
|
-
throw new TypeError("Color range must contain non-empty color strings.");
|
|
33
|
-
}
|
|
34
|
-
return cloneAndFreeze(range);
|
|
35
|
-
}
|
|
36
|
-
if (
|
|
37
|
-
!isPlainObject(range) ||
|
|
38
|
-
Object.keys(range).length !== 1 ||
|
|
39
|
-
!Object.hasOwn(range, "palette")
|
|
40
|
-
) {
|
|
41
|
-
throw new Error("Color range must contain only a palette descriptor.");
|
|
42
|
-
}
|
|
43
|
-
normalizePalette(range.palette);
|
|
44
|
-
return cloneAndFreeze(range);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function isDashPattern(pattern) {
|
|
48
|
-
return (
|
|
49
|
-
Array.isArray(pattern) &&
|
|
50
|
-
pattern.length % 2 === 0 &&
|
|
51
|
-
pattern.every(value => Number.isFinite(value) && value >= 0) &&
|
|
52
|
-
(pattern.length === 0 || pattern.some(value => value > 0))
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function normalizeStrokeDashPattern(pattern) {
|
|
57
|
-
if (typeof pattern === "string") {
|
|
58
|
-
const resolved = NAMED_DASH_PATTERNS[pattern];
|
|
59
|
-
if (resolved === undefined) {
|
|
60
|
-
throw new Error(`Unknown stroke dash style "${pattern}".`);
|
|
61
|
-
}
|
|
62
|
-
return cloneAndFreeze(resolved);
|
|
63
|
-
}
|
|
64
|
-
if (!isDashPattern(pattern)) {
|
|
65
|
-
throw new TypeError(
|
|
66
|
-
"Stroke dash pattern must be a named style or an empty or nonzero even-length array of non-negative finite numbers."
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
return cloneAndFreeze(pattern);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export function validateStrokeDashRange(range) {
|
|
73
|
-
if (range === "auto") return range;
|
|
74
|
-
if (!Array.isArray(range) || range.length === 0) {
|
|
75
|
-
throw new TypeError(
|
|
76
|
-
"StrokeDash range must contain one or more named styles or direct patterns."
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
for (const pattern of range) normalizeStrokeDashPattern(pattern);
|
|
80
|
-
return cloneAndFreeze(range);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export function validateShapeRange(range) {
|
|
84
|
-
if (range === "auto") return range;
|
|
85
|
-
if (
|
|
86
|
-
!Array.isArray(range) ||
|
|
87
|
-
range.length === 0 ||
|
|
88
|
-
!range.every(shape => POINT_SHAPES.includes(shape)) ||
|
|
89
|
-
new Set(range).size !== range.length
|
|
90
|
-
) {
|
|
91
|
-
throw new TypeError(
|
|
92
|
-
"Shape range must contain unique supported point shapes."
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
return cloneAndFreeze(range);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export function validateSizeRange(range) {
|
|
99
|
-
if (range === "auto") return range;
|
|
100
|
-
if (
|
|
101
|
-
!Array.isArray(range) ||
|
|
102
|
-
range.length !== 2 ||
|
|
103
|
-
!range.every(value => Number.isFinite(value) && value >= 0) ||
|
|
104
|
-
range[0] > range[1]
|
|
105
|
-
) {
|
|
106
|
-
throw new TypeError(
|
|
107
|
-
"Size range must be an ascending pair of non-negative finite areas."
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
return cloneAndFreeze(range);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export function validateOpacityRange(range) {
|
|
114
|
-
if (range === "auto") return range;
|
|
115
|
-
if (
|
|
116
|
-
!Array.isArray(range) ||
|
|
117
|
-
range.length !== 2 ||
|
|
118
|
-
!range.every(value => Number.isFinite(value) && value >= 0 && value <= 1)
|
|
119
|
-
) {
|
|
120
|
-
throw new TypeError(
|
|
121
|
-
"Opacity range must contain two finite values from 0 to 1."
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
return cloneAndFreeze(range);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export function validateStrokeWidthRange(range) {
|
|
128
|
-
if (range === "auto") return range;
|
|
129
|
-
if (
|
|
130
|
-
!Array.isArray(range) ||
|
|
131
|
-
range.length !== 2 ||
|
|
132
|
-
!range.every(value => Number.isFinite(value) && value >= 0) ||
|
|
133
|
-
range[0] > range[1]
|
|
134
|
-
) {
|
|
135
|
-
throw new TypeError(
|
|
136
|
-
"StrokeWidth range must be an ascending pair of non-negative finite widths."
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
return cloneAndFreeze(range);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export function validateOpacityValue(value, label = "Opacity") {
|
|
143
|
-
return validateUnitInterval(value, label);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export function validateSemanticScaleRange(range) {
|
|
147
|
-
if (range === "auto") return range;
|
|
148
|
-
if (Array.isArray(range) && range.length > 0) return cloneAndFreeze(range);
|
|
149
|
-
if (isPlainObject(range) && Object.hasOwn(range, "palette")) {
|
|
150
|
-
normalizePalette(range.palette);
|
|
151
|
-
return cloneAndFreeze(range);
|
|
152
|
-
}
|
|
153
|
-
throw new TypeError("Scale range has an unsupported value.");
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export function resolveColorRange(range, domainCount) {
|
|
157
|
-
const validated = validateColorRange(range);
|
|
158
|
-
if (validated === "auto") return TABLEAU10;
|
|
159
|
-
if (Array.isArray(validated)) return validated;
|
|
160
|
-
return resolvePalette(validated.palette, domainCount);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export function resolveStrokeDashRange(range) {
|
|
164
|
-
const validated = validateStrokeDashRange(range);
|
|
165
|
-
return validated === "auto"
|
|
166
|
-
? DASH10
|
|
167
|
-
: cloneAndFreeze(validated.map(normalizeStrokeDashPattern));
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export function resolveShapeRange(range) {
|
|
171
|
-
const validated = validateShapeRange(range);
|
|
172
|
-
return validated === "auto" ? POINT_SHAPES : validated;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export function resolveSizeRange(range) {
|
|
176
|
-
const validated = validateSizeRange(range);
|
|
177
|
-
return validated === "auto" ? DEFAULT_SIZE_RANGE : validated;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export function resolveOpacityRange(range) {
|
|
181
|
-
const validated = validateOpacityRange(range);
|
|
182
|
-
return validated === "auto" ? DEFAULT_OPACITY_RANGE : validated;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export function resolveStrokeWidthRange(range) {
|
|
186
|
-
const validated = validateStrokeWidthRange(range);
|
|
187
|
-
return validated === "auto" ? DEFAULT_STROKE_WIDTH_RANGE : validated;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export function mapOrdinalValues(values, domain, range, options = {}) {
|
|
191
|
-
const hasUnknown = Object.hasOwn(options, "unknown");
|
|
192
|
-
const indices = new Map(domain.map((value, index) => [value, index]));
|
|
193
|
-
return cloneAndFreeze(values.map(value => {
|
|
194
|
-
const index = indices.get(value);
|
|
195
|
-
if (index === undefined) {
|
|
196
|
-
if (hasUnknown) return options.unknown;
|
|
197
|
-
throw new Error(`Value "${value}" is outside the ordinal domain.`);
|
|
198
|
-
}
|
|
199
|
-
return range[index % range.length];
|
|
200
|
-
}));
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
export const TABLEAU10 = resolvePalette(
|
|
204
|
-
{ name: "tableau10", count: 10 },
|
|
205
|
-
10
|
|
206
|
-
);
|
|
1
|
+
import{cloneAndFreeze as r,isPlainObject as s}from"../../core/immutable.js";import{validateUnitInterval as y}from"../../core/validation.js";import{POINT_SHAPES as u}from"../pointShapes.js";import{normalizePalette as c,resolvePalette as l}from"../palettes.js";const m=r([[],[8,4],[3,3],[12,4],[8,3,2,3],[12,3,3,3],[2,2],[10,3,2,3,2,3],[14,4,4,4],[6,2,2,2]]),A=r({solid:[],dashed:[6,4],dotted:[1,3],dashdot:[6,3,1,3]});import{POINT_SHAPES as g}from"../pointShapes.js";const v=r([24,196]),w=r([.2,1]),S=r([1,8]);function x(t){if(t==="auto")return t;if(Array.isArray(t)){if(t.length===0||!t.every(e=>typeof e=="string"&&e.length>0))throw new TypeError("Color range must contain non-empty color strings.");return r(t)}if(!s(t)||Object.keys(t).length!==1||!Object.hasOwn(t,"palette"))throw new Error("Color range must contain only a palette descriptor.");return c(t.palette),r(t)}function E(t){return Array.isArray(t)&&t.length%2===0&&t.every(e=>Number.isFinite(e)&&e>=0)&&(t.length===0||t.some(e=>e>0))}function p(t){if(typeof t=="string"){const e=A[t];if(e===void 0)throw new Error(`Unknown stroke dash style "${t}".`);return r(e)}if(!E(t))throw new TypeError("Stroke dash pattern must be a named style or an empty or nonzero even-length array of non-negative finite numbers.");return r(t)}function R(t){if(t==="auto")return t;if(!Array.isArray(t)||t.length===0)throw new TypeError("StrokeDash range must contain one or more named styles or direct patterns.");for(const e of t)p(e);return r(t)}function O(t){if(t==="auto")return t;if(!Array.isArray(t)||t.length===0||!t.every(e=>u.includes(e)))throw new TypeError("Shape range must contain supported point shapes.");return r(t)}function f(t,e){if(t==="auto")return t;if(!Array.isArray(t)||t.length!==2||!t.every(o=>Number.isFinite(o)&&o>=0)||t[0]>t[1])throw new TypeError(`${e} must be an ascending pair of non-negative finite ${e==="Size range"?"areas":"widths"}.`);return r(t)}function T(t){return f(t,"Size range")}function k(t){if(t==="auto")return t;if(!Array.isArray(t)||t.length!==2||!t.every(e=>Number.isFinite(e)&&e>=0&&e<=1))throw new TypeError("Opacity range must contain two finite values from 0 to 1.");return r(t)}function D(t){return f(t,"StrokeWidth range")}function F(t,e="Opacity"){return y(t,e)}function U(t){if(t==="auto")return t;if(Array.isArray(t)&&t.length>0)return r(t);if(s(t)&&Object.hasOwn(t,"palette"))return c(t.palette),r(t);throw new TypeError("Scale range has an unsupported value.")}function I(t,e){const o=x(t);return o==="auto"?b:Array.isArray(o)?o:l(o.palette,e)}function j(t){const e=R(t);return e==="auto"?m:r(e.map(p))}function C(t){const e=O(t);return e==="auto"?u:e}function H(t){const e=T(t);return e==="auto"?v:e}function L(t){const e=k(t);return e==="auto"?w:e}function W(t){const e=D(t);return e==="auto"?S:e}function $(t,e,o,a={}){const d=Object.hasOwn(a,"unknown"),h=new Map(e.map((n,i)=>[n,i]));return r(t.map(n=>{const i=h.get(n);if(i===void 0){if(d)return a.unknown;throw new Error(`Value "${n}" is outside the ordinal domain.`)}return o[i%o.length]}))}const b=l({name:"tableau10",count:10},10);export{m as DASH10,w as DEFAULT_OPACITY_RANGE,v as DEFAULT_SIZE_RANGE,S as DEFAULT_STROKE_WIDTH_RANGE,A as NAMED_DASH_PATTERNS,g as POINT_SHAPES,b as TABLEAU10,$ as mapOrdinalValues,p as normalizeStrokeDashPattern,I as resolveColorRange,L as resolveOpacityRange,C as resolveShapeRange,H as resolveSizeRange,j as resolveStrokeDashRange,W as resolveStrokeWidthRange,x as validateColorRange,k as validateOpacityRange,F as validateOpacityValue,U as validateSemanticScaleRange,O as validateShapeRange,T as validateSizeRange,R as validateStrokeDashRange,D as validateStrokeWidthRange};
|