@k2b/editor 0.11.6 → 0.12.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/package.json +3 -3
- package/src/charts.ts +12 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k2b/editor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Configurable Markdown editor for SolidJS: editor, toolbar, bubble menu, and slash menu on one shared state.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"@codemirror/search": "6.7.2",
|
|
70
70
|
"@codemirror/state": "6.7.6",
|
|
71
71
|
"@codemirror/view": "6.43.15",
|
|
72
|
-
"@k2b/stdlib": "0.
|
|
73
|
-
"@k2b/ui": "0.
|
|
72
|
+
"@k2b/stdlib": "0.34.0",
|
|
73
|
+
"@k2b/ui": "0.60.0",
|
|
74
74
|
"@lezer/common": "1.5.5",
|
|
75
75
|
"@lezer/highlight": "1.2.5",
|
|
76
76
|
"@lezer/markdown": "1.8.1",
|
package/src/charts.ts
CHANGED
|
@@ -619,13 +619,22 @@ export function chartBaseRenderOptions(
|
|
|
619
619
|
...(input.kind === "line" ? { lineStyle: input.series[index]?.style ?? (entry.role === "reference" ? "dashed" : undefined) } : {}),
|
|
620
620
|
}));
|
|
621
621
|
const points = series.flatMap((entry) => entry.data);
|
|
622
|
+
// Every line over dates takes the time axis: ticks on round days, weeks or months inside the plotted span, so the
|
|
623
|
+
// first date is never one before the first value. A number axis would round the span out to whole milliseconds.
|
|
622
624
|
const calendarLine =
|
|
623
625
|
input.kind === "line" &&
|
|
624
|
-
lineDetailsEnabled(input) &&
|
|
625
626
|
(input.series.some((entry) => entry.data.some((point) => typeof point.x === "string")) ||
|
|
626
627
|
(input.xAxis?.format && "date" in input.xAxis.format));
|
|
627
|
-
//
|
|
628
|
-
|
|
628
|
+
// A time axis spans the plotted dates; an x reference outside them widens it to exactly that date, not to a
|
|
629
|
+
// rounded millisecond step.
|
|
630
|
+
const xValues = points.map((point) => point.x).filter(Number.isFinite);
|
|
631
|
+
const xSpan = [...xValues, ...chartReferenceValues(input, "x").filter(Number.isFinite)];
|
|
632
|
+
const widened = xValues.length > 0 && (Math.min(...xSpan) < Math.min(...xValues) || Math.max(...xSpan) > Math.max(...xValues));
|
|
633
|
+
const xAxis = calendarLine
|
|
634
|
+
? input.xAxis?.domain || !widened
|
|
635
|
+
? input.xAxis
|
|
636
|
+
: { ...input.xAxis, domain: [Math.min(...xSpan), Math.max(...xSpan)] }
|
|
637
|
+
: referencedAxis(input, "x");
|
|
629
638
|
const yAxis = referencedAxis(input, "y");
|
|
630
639
|
const candidates = tickCandidates([...points.map((point) => point.x), ...chartReferenceValues(input, "x")], xAxis).filter(
|
|
631
640
|
Number.isFinite,
|