@bitcobblers/wod-wiki-ui 0.61.2259 → 0.62.2261

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.
@@ -202,7 +202,11 @@ function editorTheme(isDark, dialect = "markdown") {
202
202
  boxSizing: "border-box",
203
203
  fontSize: "14px",
204
204
  textAlign: "left",
205
- color: "hsl(var(--foreground))"
205
+ color: "hsl(var(--foreground))",
206
+ backgroundColor: "transparent"
207
+ },
208
+ "&.cm-editor": {
209
+ backgroundColor: "transparent"
206
210
  },
207
211
  "&.cm-focused": {
208
212
  outline: "none"
@@ -706,6 +710,16 @@ function activeCursorSection(state) {
706
710
  }
707
711
 
708
712
  // src/extensions/whiteboard-linter.ts
713
+ var BLOCK_HEADER_LINE_RE = /^[ \t]*(?:\d+:\d+(?::\d+)?\s+)?(?:AMRAP|EMOM|TABATA|FOR TIME)\b|^[ \t]*\(\s*\d+(?:\s*-\s*\d+)*\s*(?:rounds?|rds?)?\s*\)/i;
714
+ function leadingIndentWidth(line) {
715
+ let w = 0;
716
+ for (let i = 0; i < line.length; i++) {
717
+ if (line[i] === " ") w += 1;
718
+ else if (line[i] === " ") w += 2;
719
+ else break;
720
+ }
721
+ return w;
722
+ }
709
723
  function findWorkoutErrors(content, offsetInDoc) {
710
724
  if (!content.trim()) return [];
711
725
  const doc = content.endsWith("\n") ? content : content + "\n";
@@ -729,6 +743,54 @@ function findWorkoutErrors(content, offsetInDoc) {
729
743
  }
730
744
  }
731
745
  });
746
+ const lines = content.split("\n");
747
+ const lineOffsets = [];
748
+ let cursor2 = 0;
749
+ for (const line of lines) {
750
+ lineOffsets.push(cursor2);
751
+ cursor2 += line.length + 1;
752
+ }
753
+ for (let i = 0; i < lines.length; i++) {
754
+ const header = lines[i];
755
+ if (!header.trim() || !BLOCK_HEADER_LINE_RE.test(header)) continue;
756
+ const headerIndent2 = leadingIndentWidth(header);
757
+ const bodyLineStarts = [];
758
+ let firstFrom = -1;
759
+ let lastTo = -1;
760
+ for (let j = i + 1; j < lines.length; j++) {
761
+ const nextLine = lines[j];
762
+ if (!nextLine.trim()) break;
763
+ if (leadingIndentWidth(nextLine) > headerIndent2) {
764
+ bodyLineStarts.length = 0;
765
+ break;
766
+ }
767
+ if (BLOCK_HEADER_LINE_RE.test(nextLine)) break;
768
+ const absStart = offsetInDoc + lineOffsets[j];
769
+ bodyLineStarts.push(absStart);
770
+ if (firstFrom < 0) firstFrom = absStart;
771
+ lastTo = absStart + nextLine.length;
772
+ }
773
+ if (bodyLineStarts.length > 0 && firstFrom >= 0) {
774
+ diagnostics.push({
775
+ from: firstFrom,
776
+ to: Math.max(firstFrom + 1, lastTo),
777
+ severity: "warning",
778
+ message: "Indent lines below header so they run inside the block",
779
+ actions: [
780
+ {
781
+ name: "Indent workout body",
782
+ apply(view) {
783
+ const docLen = view.state.doc.length;
784
+ const changes = bodyLineStarts.filter((pos) => pos >= 0 && pos <= docLen).map((pos) => ({ from: pos, to: pos, insert: " " }));
785
+ if (changes.length > 0) {
786
+ view.dispatch({ changes });
787
+ }
788
+ }
789
+ }
790
+ ]
791
+ });
792
+ }
793
+ }
732
794
  return diagnostics;
733
795
  }
734
796
  function workoutLintSource(view) {
@@ -811,14 +873,24 @@ var TONE_CLASS = {
811
873
  };
812
874
  function MetricBadge({ token }) {
813
875
  if (!token.visible || !token.label) return null;
876
+ const accessibleLabel = token.columnLabel ? `${token.columnLabel}: ${token.label}` : token.label;
814
877
  if (token.renderKind === "comment") {
815
- return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] italic text-muted-foreground", title: token.tooltip, children: token.label });
878
+ return /* @__PURE__ */ jsxRuntime.jsx(
879
+ "span",
880
+ {
881
+ className: "text-[10px] italic text-muted-foreground",
882
+ title: token.tooltip,
883
+ "aria-label": accessibleLabel,
884
+ children: token.label
885
+ }
886
+ );
816
887
  }
817
888
  return /* @__PURE__ */ jsxRuntime.jsx(
818
889
  "span",
819
890
  {
820
891
  className: `rounded-md border px-1.5 py-0.5 text-[10px] font-medium leading-tight select-none ${TONE_CLASS[token.tone] ?? TONE_CLASS.unknown}`,
821
892
  title: token.tooltip,
893
+ "aria-label": accessibleLabel,
822
894
  children: token.label
823
895
  }
824
896
  );
@@ -1238,7 +1310,7 @@ function StatementCards({
1238
1310
  /* @__PURE__ */ jsxRuntime.jsx(
1239
1311
  "span",
1240
1312
  {
1241
- className: `inline-block shrink-0 rounded px-1.5 py-0.2 text-[9px] font-bold uppercase tracking-wider ${OUTPUT_TYPE_CLASS[typeKey] ?? OUTPUT_TYPE_CLASS.system}`,
1313
+ className: `inline-block shrink-0 rounded px-1.5 py-0.2 text-[9px] font-bold tracking-wider ${OUTPUT_TYPE_CLASS[typeKey] ?? OUTPUT_TYPE_CLASS.system}`,
1242
1314
  children: typeLabel
1243
1315
  }
1244
1316
  ),
@@ -1519,7 +1591,7 @@ function OutputStatementsTable({
1519
1591
  return /* @__PURE__ */ jsxRuntime.jsx("td", { className: "p-2 text-center whitespace-nowrap", children: /* @__PURE__ */ jsxRuntime.jsx(
1520
1592
  "span",
1521
1593
  {
1522
- className: `inline-block rounded px-1.5 py-0.2 text-[9px] font-bold uppercase tracking-wider ${OUTPUT_TYPE_CLASS[String(out.outputType)] ?? OUTPUT_TYPE_CLASS.system}`,
1594
+ className: `inline-block rounded px-1.5 py-0.2 text-[9px] font-bold tracking-wider ${OUTPUT_TYPE_CLASS[String(out.outputType)] ?? OUTPUT_TYPE_CLASS.system}`,
1523
1595
  title: rowTitle,
1524
1596
  children: typeLabel
1525
1597
  }
@@ -1735,14 +1807,15 @@ function rpeChipClass(rpe, selected) {
1735
1807
  }
1736
1808
  function formatSummaryDurationMMSS(ms) {
1737
1809
  if (!Number.isFinite(ms) || ms <= 0) return "\u2014";
1738
- const totalSec = Math.round(ms / 1e3);
1739
- const hours = Math.floor(totalSec / 3600);
1740
- const mins = Math.floor(totalSec % 3600 / 60);
1741
- const secs = totalSec % 60;
1742
- if (hours > 0) {
1743
- return `${hours}:${String(mins).padStart(2, "0")}:${String(secs).padStart(2, "0")}`;
1744
- }
1745
- return `${mins}:${String(secs).padStart(2, "0")}`;
1810
+ const formatted = wodWikiCore.formatDurationMMSS(ms);
1811
+ return formatted.startsWith("0") && formatted.length === 5 && ms < 6e5 ? formatted.slice(1) : formatted;
1812
+ }
1813
+ function formatAnalyticsFloat(value) {
1814
+ if (!Number.isFinite(value)) return "0.0";
1815
+ return (Math.round(value * 10) / 10).toLocaleString("en-US", {
1816
+ minimumFractionDigits: 1,
1817
+ maximumFractionDigits: 1
1818
+ });
1746
1819
  }
1747
1820
  function formatCompactNum(value) {
1748
1821
  if (!Number.isFinite(value)) return "0";
@@ -1930,8 +2003,8 @@ function SessionSummaryCard({
1930
2003
  const effortList = summary.efforts ?? [];
1931
2004
  const primaryWorkSub = hasVolume && hasDistance ? `${formatCompactNum(summary.totalDistance)} ${summary.distanceUnit ?? "m"} distance` : effortList.length > 0 ? `${effortList.length} movement${effortList.length === 1 ? "" : "s"}` : void 0;
1932
2005
  const intensityLabel = summary.tis !== void 0 ? "Intensity (TIS)" : summary.sessionLoad !== void 0 ? "Session Load" : "Movements";
1933
- const intensityValue = summary.tis !== void 0 ? `${formatCompactNum(summary.tis)} pts` : summary.sessionLoad !== void 0 ? `${formatCompactNum(summary.sessionLoad)} AU` : effortList.length > 0 ? String(effortList.length) : "\u2014";
1934
- const intensitySub = summary.tis !== void 0 && summary.sessionLoad !== void 0 ? `${formatCompactNum(summary.sessionLoad)} AU load` : summary.rpe !== void 0 ? `RPE ${summary.rpe}/10 logged` : void 0;
2006
+ const intensityValue = summary.tis !== void 0 ? `${formatAnalyticsFloat(summary.tis)} pts` : summary.sessionLoad !== void 0 ? `${formatAnalyticsFloat(summary.sessionLoad)} AU` : effortList.length > 0 ? String(effortList.length) : "\u2014";
2007
+ const intensitySub = summary.tis !== void 0 && summary.sessionLoad !== void 0 ? `${formatAnalyticsFloat(summary.sessionLoad)} AU load` : summary.rpe !== void 0 ? `RPE ${summary.rpe}/10 logged` : void 0;
1935
2008
  const rollups = summary.movementRollup ?? [];
1936
2009
  const visibleRollups = rollupExpanded ? rollups : rollups.slice(0, compactMobile ? 2 : 3);
1937
2010
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2211,6 +2284,8 @@ function RpeChip({
2211
2284
  }
2212
2285
  function useSessionPrHighlights(sessionRun, blockContentId2, executor, enabled, retainHistory = false) {
2213
2286
  const [wideResult, setWideResult] = React2.useState(void 0);
2287
+ const sessionRunId = sessionRun?.resultId;
2288
+ const sessionEventCount = sessionRun?.events.length ?? 0;
2214
2289
  React2.useEffect(() => {
2215
2290
  if (!enabled || !blockContentId2 || !executor) {
2216
2291
  if (!retainHistory) setWideResult(void 0);
@@ -2225,12 +2300,12 @@ function useSessionPrHighlights(sessionRun, blockContentId2, executor, enabled,
2225
2300
  void promise.then((res) => {
2226
2301
  if (!cancelled && res && Array.isArray(res.runs)) setWideResult(res);
2227
2302
  }).catch(() => {
2228
- if (!cancelled) setWideResult(void 0);
2303
+ if (!cancelled && !retainHistory) setWideResult(void 0);
2229
2304
  });
2230
2305
  return () => {
2231
2306
  cancelled = true;
2232
2307
  };
2233
- }, [enabled, retainHistory, blockContentId2, executor, sessionRun?.events]);
2308
+ }, [enabled, retainHistory, blockContentId2, executor, sessionRunId, sessionEventCount]);
2234
2309
  const prHighlights = React2.useMemo(
2235
2310
  () => enabled ? computeSessionPrHighlights(sessionRun, wideResult?.runs) : void 0,
2236
2311
  [enabled, sessionRun, wideResult?.runs]
@@ -2518,6 +2593,7 @@ function mergeSeries(series) {
2518
2593
  const map = /* @__PURE__ */ new Map();
2519
2594
  for (const s of series) {
2520
2595
  for (const p of s.points) {
2596
+ if (p.missing) continue;
2521
2597
  if (!map.has(p.ts)) map.set(p.ts, { ts: p.ts });
2522
2598
  map.get(p.ts)[s.label] = p.value;
2523
2599
  }
@@ -2531,6 +2607,7 @@ function buildOrdinalChartData(series) {
2531
2607
  const map = /* @__PURE__ */ new Map();
2532
2608
  for (const s of series) {
2533
2609
  s.points.forEach((p, idx) => {
2610
+ if (p.missing) return;
2534
2611
  const xVal = p.x ?? idx;
2535
2612
  const key = String(xVal);
2536
2613
  if (!map.has(key)) {
@@ -2570,13 +2647,13 @@ function useChartShape(result) {
2570
2647
  return { kind: hasTimeAxis ? "timeseries" : "bars" };
2571
2648
  }, [result]);
2572
2649
  }
2573
- function WqlEmptyState({ result, className, actions }) {
2650
+ function WqlEmptyState({ result, className, actions, fallbackMessage }) {
2574
2651
  const message = React2.useMemo(() => {
2575
2652
  if (!result) return "Loading\u2026";
2576
2653
  if (result.parsed.error) return `Query error: ${result.parsed.error}`;
2577
2654
  if (result.series.length === 0) return "No data for this range.";
2578
- return null;
2579
- }, [result]);
2655
+ return fallbackMessage ?? null;
2656
+ }, [result, fallbackMessage]);
2580
2657
  if (message === null && !actions) return null;
2581
2658
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `h-full flex flex-col items-center justify-center text-sm text-muted-foreground px-4 text-center ${className ?? ""}`, children: [
2582
2659
  message && /* @__PURE__ */ jsxRuntime.jsx("div", { children: message }),
@@ -2605,6 +2682,7 @@ var INTRINSIC_METRIC_UNITS = {
2605
2682
  "calc.strain": "AU",
2606
2683
  "calc.readiness": "",
2607
2684
  "calc.sends": "",
2685
+ "calc.sleep": "h",
2608
2686
  sleep: "h"
2609
2687
  };
2610
2688
  var INTRINSIC_MASS_METRICS = /* @__PURE__ */ new Set([
@@ -2666,7 +2744,7 @@ function formatWithUnit(formattedNumber, unit) {
2666
2744
  const cleanUnit = unit?.trim();
2667
2745
  return cleanUnit ? `${formattedNumber} ${cleanUnit}` : formattedNumber;
2668
2746
  }
2669
- function formatTimeseriesTick(value, unit) {
2747
+ function formatAxisTick(value, unit) {
2670
2748
  const numeric = Number(value);
2671
2749
  if (!Number.isFinite(numeric)) {
2672
2750
  return formatWithUnit(String(value), unit);
@@ -2675,7 +2753,7 @@ function formatTimeseriesTick(value, unit) {
2675
2753
  const formatted = new Intl.NumberFormat(void 0, { maximumFractionDigits }).format(numeric);
2676
2754
  return formatWithUnit(formatted, unit);
2677
2755
  }
2678
- function formatTimeseriesTooltipValue(value, unit) {
2756
+ function formatMetricValue(value, unit) {
2679
2757
  const numeric = Number(value);
2680
2758
  if (!Number.isFinite(numeric)) {
2681
2759
  return formatWithUnit(String(value), unit);
@@ -2683,9 +2761,45 @@ function formatTimeseriesTooltipValue(value, unit) {
2683
2761
  const formatted = new Intl.NumberFormat(void 0, { maximumFractionDigits: 1 }).format(numeric);
2684
2762
  return formatWithUnit(formatted, unit);
2685
2763
  }
2764
+ function computeYAxisWidth(values2, unit, minWidth = 56, maxWidth = 104) {
2765
+ let maxLen = formatAxisTick(0, unit).length;
2766
+ for (const v of values2) {
2767
+ if (!Number.isFinite(v)) continue;
2768
+ const len = formatAxisTick(v, unit).length;
2769
+ if (len > maxLen) maxLen = len;
2770
+ }
2771
+ const estimated = Math.ceil(maxLen * 6.5 + 14);
2772
+ return Math.max(minWidth, Math.min(maxWidth, estimated));
2773
+ }
2774
+ function SingleLineYAxisTick({
2775
+ x = 0,
2776
+ y = 0,
2777
+ payload,
2778
+ unit
2779
+ }) {
2780
+ const raw = payload?.value ?? "";
2781
+ const text = formatAxisTick(raw, unit);
2782
+ return /* @__PURE__ */ jsxRuntime.jsx("g", { transform: `translate(${x},${y})`, className: "recharts-layer recharts-cartesian-axis-tick", children: /* @__PURE__ */ jsxRuntime.jsx(
2783
+ "text",
2784
+ {
2785
+ x: 0,
2786
+ y: 0,
2787
+ dy: 4,
2788
+ textAnchor: "end",
2789
+ fill: "hsl(var(--muted-foreground))",
2790
+ fontSize: 10,
2791
+ className: "recharts-text recharts-cartesian-axis-tick-value",
2792
+ style: { whiteSpace: "nowrap" },
2793
+ children: text
2794
+ }
2795
+ ) });
2796
+ }
2797
+ var formatTimeseriesTooltipValue = formatMetricValue;
2686
2798
  var INTRINSIC_METRIC_UNITS2 = {
2687
2799
  "calc.hrv": "ms",
2688
- hrv: "ms"
2800
+ hrv: "ms",
2801
+ "calc.sleep": "h",
2802
+ sleep: "h"
2689
2803
  };
2690
2804
  function resolveTimeseriesUnit(result, unitProp) {
2691
2805
  const seriesUnit = result.series[0]?.unit;
@@ -2713,10 +2827,17 @@ function WqlTimeseries({ result, unit: unitProp }) {
2713
2827
  [isOrdinal, result]
2714
2828
  );
2715
2829
  const unit = resolveTimeseriesUnit(result, unitProp);
2830
+ const yAxisWidth = React2.useMemo(
2831
+ () => computeYAxisWidth(
2832
+ result.series.flatMap((s) => s.points.map((p) => p.value)),
2833
+ unit
2834
+ ),
2835
+ [result.series, unit]
2836
+ );
2716
2837
  if (shape.kind !== "timeseries" && shape.kind !== "scalar") {
2717
2838
  return /* @__PURE__ */ jsxRuntime.jsx(WqlEmptyState, { result });
2718
2839
  }
2719
- return /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.LineChart, { data: data2, margin: { top: 4, right: 8, bottom: 0, left: -12 }, children: [
2840
+ return /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.LineChart, { data: data2, margin: { top: 4, right: 8, bottom: 0, left: 8 }, children: [
2720
2841
  /* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { stroke: "hsl(var(--border))", vertical: false }),
2721
2842
  /* @__PURE__ */ jsxRuntime.jsx(
2722
2843
  recharts.XAxis,
@@ -2734,10 +2855,9 @@ function WqlTimeseries({ result, unit: unitProp }) {
2734
2855
  {
2735
2856
  tickLine: false,
2736
2857
  axisLine: false,
2737
- width: 64,
2858
+ width: yAxisWidth,
2738
2859
  stroke: "hsl(var(--muted-foreground))",
2739
- tick: { fill: "hsl(var(--muted-foreground))", fontSize: 10 },
2740
- tickFormatter: (v) => formatTimeseriesTick(v, unit)
2860
+ tick: /* @__PURE__ */ jsxRuntime.jsx(SingleLineYAxisTick, { unit })
2741
2861
  }
2742
2862
  ),
2743
2863
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2770,7 +2890,9 @@ function WqlTimeseries({ result, unit: unitProp }) {
2770
2890
  }
2771
2891
  function WqlBars({ result, unit: unitProp }) {
2772
2892
  const shape = useChartShape(result);
2773
- const data2 = React2.useMemo(
2893
+ const isOrdinal = React2.useMemo(() => isOrdinalSeriesSet(result.series), [result.series]);
2894
+ const isTimeOrOrdinal = shape.kind === "timeseries" || isOrdinal;
2895
+ const categoryData = React2.useMemo(
2774
2896
  () => result.series.map((s, i) => ({
2775
2897
  name: s.label,
2776
2898
  value: s.points[0]?.value ?? 0,
@@ -2778,11 +2900,75 @@ function WqlBars({ result, unit: unitProp }) {
2778
2900
  })),
2779
2901
  [result]
2780
2902
  );
2903
+ const seriesData = React2.useMemo(
2904
+ () => isOrdinal ? buildOrdinalChartData(result.series) : mergeSeries(result.series),
2905
+ [isOrdinal, result]
2906
+ );
2781
2907
  const unit = resolveWidgetDisplayUnit(result, unitProp);
2908
+ const yAxisWidth = React2.useMemo(
2909
+ () => computeYAxisWidth(
2910
+ result.series.flatMap((s) => s.points.map((p) => p.value)),
2911
+ unit
2912
+ ),
2913
+ [result.series, unit]
2914
+ );
2915
+ if (shape.kind === "error" || shape.kind === "empty") {
2916
+ return /* @__PURE__ */ jsxRuntime.jsx(WqlEmptyState, { result, fallbackMessage: "No bar data available for this query." });
2917
+ }
2918
+ if (isTimeOrOrdinal) {
2919
+ return /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.BarChart, { data: seriesData, margin: { top: 4, right: 8, bottom: 0, left: 8 }, children: [
2920
+ /* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { stroke: "hsl(var(--border))", vertical: false }),
2921
+ /* @__PURE__ */ jsxRuntime.jsx(
2922
+ recharts.XAxis,
2923
+ {
2924
+ dataKey: isOrdinal ? "label" : "ts",
2925
+ tickFormatter: isOrdinal ? (v) => String(v) : formatTimestamp,
2926
+ tickLine: false,
2927
+ axisLine: { stroke: "hsl(var(--border))" },
2928
+ stroke: "hsl(var(--muted-foreground))",
2929
+ tick: { fill: "hsl(var(--muted-foreground))", fontSize: 10 }
2930
+ }
2931
+ ),
2932
+ /* @__PURE__ */ jsxRuntime.jsx(
2933
+ recharts.YAxis,
2934
+ {
2935
+ tickLine: false,
2936
+ axisLine: false,
2937
+ width: yAxisWidth,
2938
+ stroke: "hsl(var(--muted-foreground))",
2939
+ tick: /* @__PURE__ */ jsxRuntime.jsx(SingleLineYAxisTick, { unit })
2940
+ }
2941
+ ),
2942
+ /* @__PURE__ */ jsxRuntime.jsx(
2943
+ recharts.Tooltip,
2944
+ {
2945
+ contentStyle: {
2946
+ backgroundColor: "hsl(var(--popover))",
2947
+ borderColor: "hsl(var(--border))",
2948
+ fontSize: "12px",
2949
+ color: "hsl(var(--popover-foreground))"
2950
+ },
2951
+ labelFormatter: isOrdinal ? (v) => String(v) : (v) => tooltipTimestamp(v),
2952
+ formatter: (v, name) => [formatMetricValue(v, unit), String(name ?? "")]
2953
+ }
2954
+ ),
2955
+ result.series.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(recharts.Legend, { wrapperStyle: { fontSize: 11 } }),
2956
+ result.series.map((s, i) => /* @__PURE__ */ jsxRuntime.jsx(
2957
+ recharts.Bar,
2958
+ {
2959
+ dataKey: s.label,
2960
+ name: s.label,
2961
+ fill: SERIES_COLORS[i % SERIES_COLORS.length],
2962
+ radius: [4, 4, 0, 0]
2963
+ },
2964
+ s.key
2965
+ ))
2966
+ ] }) });
2967
+ }
2782
2968
  if (shape.kind !== "bars" && shape.kind !== "scalar") {
2783
- return /* @__PURE__ */ jsxRuntime.jsx(WqlEmptyState, { result });
2969
+ return /* @__PURE__ */ jsxRuntime.jsx(WqlEmptyState, { result, fallbackMessage: "No bar data available for this query." });
2784
2970
  }
2785
- return /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.BarChart, { data: data2, margin: { top: 4, right: 8, bottom: 0, left: 48 }, children: [
2971
+ return /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.BarChart, { data: categoryData, margin: { top: 4, right: 8, bottom: 0, left: 8 }, children: [
2786
2972
  /* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { stroke: "hsl(var(--border))", vertical: false }),
2787
2973
  /* @__PURE__ */ jsxRuntime.jsx(
2788
2974
  recharts.XAxis,
@@ -2799,10 +2985,9 @@ function WqlBars({ result, unit: unitProp }) {
2799
2985
  {
2800
2986
  tickLine: false,
2801
2987
  axisLine: false,
2802
- width: 64,
2803
- tickFormatter: (v) => formatTimeseriesTick(v, unit),
2988
+ width: yAxisWidth,
2804
2989
  stroke: "hsl(var(--muted-foreground))",
2805
- tick: { fill: "hsl(var(--muted-foreground))", fontSize: 10 }
2990
+ tick: /* @__PURE__ */ jsxRuntime.jsx(SingleLineYAxisTick, { unit })
2806
2991
  }
2807
2992
  ),
2808
2993
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2816,11 +3001,11 @@ function WqlBars({ result, unit: unitProp }) {
2816
3001
  },
2817
3002
  formatter: (v, _n, p) => {
2818
3003
  const label = typeof p?.payload?.name === "string" ? p.payload.name : "";
2819
- return [`${Number(v).toLocaleString()} ${unit ?? ""}`.trim(), label];
3004
+ return [formatMetricValue(v, unit), label];
2820
3005
  }
2821
3006
  }
2822
3007
  ),
2823
- /* @__PURE__ */ jsxRuntime.jsx(recharts.Bar, { dataKey: "value", radius: [4, 4, 0, 0], children: data2.map((d) => (
3008
+ /* @__PURE__ */ jsxRuntime.jsx(recharts.Bar, { dataKey: "value", radius: [4, 4, 0, 0], children: categoryData.map((d) => (
2824
3009
  // eslint-disable-next-line @typescript-eslint/no-deprecated -- Recharts Bar per-bar fill still uses Cell
2825
3010
  /* @__PURE__ */ jsxRuntime.jsx(recharts.Cell, { fill: d.fill }, d.name)
2826
3011
  )) })
@@ -2958,11 +3143,7 @@ function TopList({ result, unit: unitProp, limit = 8 }) {
2958
3143
  }
2959
3144
  }
2960
3145
  ) }),
2961
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs tabular-nums text-muted-foreground w-20 text-right", children: [
2962
- r.value.toLocaleString(),
2963
- " ",
2964
- unit
2965
- ] })
3146
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs tabular-nums text-muted-foreground w-24 text-right whitespace-nowrap", children: formatMetricValue(r.value, unit) })
2966
3147
  ] }, r.name)) });
2967
3148
  }
2968
3149
  var INTENSITY_ORDER = ["low", "moderate", "high"];
@@ -2970,6 +3151,13 @@ function StackedBar({ result, unit: unitProp }) {
2970
3151
  const shape = useChartShape(result);
2971
3152
  const data2 = React2.useMemo(() => mergeSeries(result.series), [result]);
2972
3153
  const unit = resolveWidgetDisplayUnit(result, unitProp);
3154
+ const yAxisWidth = React2.useMemo(
3155
+ () => computeYAxisWidth(
3156
+ result.series.flatMap((s) => s.points.map((p) => p.value)),
3157
+ unit
3158
+ ),
3159
+ [result.series, unit]
3160
+ );
2973
3161
  const keys = React2.useMemo(() => {
2974
3162
  const labels = result.series.map((s) => s.label);
2975
3163
  return labels.sort((a, b) => {
@@ -2984,7 +3172,7 @@ function StackedBar({ result, unit: unitProp }) {
2984
3172
  if (shape.kind !== "timeseries" && shape.kind !== "bars") {
2985
3173
  return /* @__PURE__ */ jsxRuntime.jsx(WqlEmptyState, { result });
2986
3174
  }
2987
- return /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.BarChart, { data: data2, margin: { top: 4, right: 8, bottom: 0, left: 48 }, children: [
3175
+ return /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.BarChart, { data: data2, margin: { top: 4, right: 8, bottom: 0, left: 8 }, children: [
2988
3176
  /* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { stroke: "hsl(var(--border))", vertical: false }),
2989
3177
  /* @__PURE__ */ jsxRuntime.jsx(
2990
3178
  recharts.XAxis,
@@ -3002,11 +3190,9 @@ function StackedBar({ result, unit: unitProp }) {
3002
3190
  {
3003
3191
  tickLine: false,
3004
3192
  axisLine: false,
3005
- width: 48,
3006
- tickFormatter: compactNumber,
3193
+ width: yAxisWidth,
3007
3194
  stroke: "hsl(var(--muted-foreground))",
3008
- tick: { fill: "hsl(var(--muted-foreground))", fontSize: 10 },
3009
- unit: unit ? ` ${unit}` : ""
3195
+ tick: /* @__PURE__ */ jsxRuntime.jsx(SingleLineYAxisTick, { unit })
3010
3196
  }
3011
3197
  ),
3012
3198
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -3019,9 +3205,9 @@ function StackedBar({ result, unit: unitProp }) {
3019
3205
  color: "hsl(var(--popover-foreground))"
3020
3206
  },
3021
3207
  labelFormatter: (v) => tooltipTimestamp(v),
3022
- formatter: (v, _n, p) => {
3023
- const label = typeof p?.payload?.name === "string" ? p.payload.name : "";
3024
- return [`${Number(v).toLocaleString()} ${unit ?? ""}`.trim(), label];
3208
+ formatter: (v, name, p) => {
3209
+ const label = typeof p?.payload?.name === "string" && p.payload.name ? p.payload.name : String(name ?? "");
3210
+ return [formatMetricValue(v, unit), label];
3025
3211
  }
3026
3212
  }
3027
3213
  ),
@@ -3080,8 +3266,8 @@ function GoalRingItem({
3080
3266
  pct,
3081
3267
  unit
3082
3268
  }) {
3083
- const formattedCurrent = current.toLocaleString();
3084
- const formattedTarget = target ? target.toLocaleString() : void 0;
3269
+ const formattedCurrent = formatMetricValue(current);
3270
+ const formattedTarget = target !== void 0 ? formatMetricValue(target) : void 0;
3085
3271
  const radius = 38;
3086
3272
  const circumference = 2 * Math.PI * radius;
3087
3273
  const clampedPct = pct !== void 0 ? Math.min(Math.max(pct, 0), 100) : 0;
@@ -3454,9 +3640,25 @@ function extractVisibleMetrics(row) {
3454
3640
  }
3455
3641
  function buildSpreadsheetRows(run, prHighlights) {
3456
3642
  const prMap = normalizePrLookup(prHighlights);
3457
- const segmentEvents = (run.events ?? []).filter(
3458
- (e) => e.outputType === "segment" && !String(e.sourceBlockKey ?? "").toLowerCase().startsWith("waiting-to-start")
3459
- );
3643
+ const rawSegments = (run.events ?? []).filter((e) => {
3644
+ if (e.outputType !== "segment") return false;
3645
+ const key = String(e.sourceBlockKey ?? "").toLowerCase();
3646
+ return !key.startsWith("waiting-to-start") && key !== "session-root" && key !== "root";
3647
+ });
3648
+ const maxStackLevel = rawSegments.reduce((max, e) => Math.max(max, e.stackLevel ?? 0), 0);
3649
+ const hasEffortLeaves = rawSegments.some((e) => {
3650
+ const metrics = extractVisibleMetrics(e);
3651
+ return Boolean(e.effortSlug) || metrics.some((m) => String(m.type ?? "").toLowerCase() === "effort");
3652
+ });
3653
+ const segmentEvents = hasEffortLeaves ? rawSegments.filter((e) => {
3654
+ if ((e.stackLevel ?? 0) >= maxStackLevel) return true;
3655
+ const metrics = extractVisibleMetrics(e);
3656
+ const hasMovement = Boolean(e.effortSlug) || metrics.some((m) => {
3657
+ const t = String(m.type ?? "").toLowerCase();
3658
+ return t === "effort" || t === "rep" || t === "reps" || t === "distance";
3659
+ });
3660
+ return hasMovement;
3661
+ }) : rawSegments;
3460
3662
  const sessionStart = segmentEvents.reduce(
3461
3663
  (min, e) => e.timeSpan?.started !== void 0 ? Math.min(min, e.timeSpan.started) : min,
3462
3664
  run.timestamp
@@ -3474,6 +3676,7 @@ function buildSpreadsheetRows(run, prHighlights) {
3474
3676
  let loadType = "resistance";
3475
3677
  let loadModified = false;
3476
3678
  let splitSec = null;
3679
+ let splitFromElapsed = false;
3477
3680
  let splitModified = false;
3478
3681
  let distance = null;
3479
3682
  let distanceUnit = "m";
@@ -3515,10 +3718,17 @@ function buildSpreadsheetRows(run, prHighlights) {
3515
3718
  loadType = mType || "resistance";
3516
3719
  loadModified = isUser;
3517
3720
  }
3518
- } else if (canon === "elapsed" || canon === "duration" || lower === "duration") {
3519
- const sec = m.unit === "ms" ? m.value / 1e3 : m.unit === "min" ? m.value * 60 : m.value;
3520
- if (splitSec === null || isUser) {
3521
- splitSec = sec;
3721
+ } else if (canon === "elapsed" || lower === "elapsed") {
3722
+ const ms = wodWikiCore.metricToMs(m);
3723
+ if (ms !== void 0 && (!splitModified || isUser)) {
3724
+ splitSec = ms / 1e3;
3725
+ splitFromElapsed = true;
3726
+ splitModified = isUser;
3727
+ }
3728
+ } else if (canon === "duration" || lower === "duration") {
3729
+ const ms = wodWikiCore.metricToMs(m);
3730
+ if (ms !== void 0 && (splitSec === null && !splitFromElapsed || isUser)) {
3731
+ splitSec = ms / 1e3;
3522
3732
  splitModified = isUser;
3523
3733
  }
3524
3734
  } else if (canon === "distance" || canon === "totaldistance" || lower === "distance") {
@@ -3789,7 +3999,8 @@ function formatCellDisplay(row, colId) {
3789
3999
  default: {
3790
4000
  const custom = row.custom[colId];
3791
4001
  if (!custom) return "\u2014";
3792
- return `${formatNum(custom.value, 2)}${custom.unit ? ` ${custom.unit}` : ""}`;
4002
+ const displayVal = Number.isInteger(custom.value) ? formatNum(custom.value, 0) : formatAnalyticsFloat(custom.value);
4003
+ return `${displayVal}${custom.unit ? ` ${custom.unit}` : ""}`;
3793
4004
  }
3794
4005
  }
3795
4006
  }
@@ -4062,18 +4273,22 @@ function ResultsSpreadsheetGrid({
4062
4273
  if (!showCustomSummariesStrip) return [];
4063
4274
  const seen = /* @__PURE__ */ new Set();
4064
4275
  const items = [];
4276
+ const hasGrainSummary = (run.events ?? []).some((e) => e.grain === "summary");
4065
4277
  for (const ev of run.events ?? []) {
4066
4278
  if (ev.outputType !== "analytics" && ev.grain !== "summary") continue;
4279
+ if (hasGrainSummary && ev.grain !== "summary") continue;
4067
4280
  for (const m of extractVisibleMetrics(ev)) {
4068
4281
  const mType = String(m.type ?? "");
4069
4282
  if (!mType || mType === "label" || mType === "hint" || mType === "diagnostic") continue;
4070
4283
  if (typeof m.value !== "number" || !Number.isFinite(m.value)) continue;
4071
- if (seen.has(mType)) continue;
4072
- seen.add(mType);
4284
+ const canonKey = String(m.metadata?.canonicalKey ?? mType);
4285
+ if (seen.has(canonKey)) continue;
4286
+ seen.add(canonKey);
4287
+ const formatted = Number.isInteger(m.value) && (m.unit === "reps" || m.unit === "rounds") ? formatNum(m.value, 0) : formatAnalyticsFloat(m.value);
4073
4288
  items.push({
4074
- key: mType,
4075
- label: mType,
4076
- value: `${formatNum(m.value, 1)}${m.unit ? ` ${m.unit}` : ""}`,
4289
+ key: canonKey,
4290
+ label: wodWikiLang.computeColumnLabel(canonKey),
4291
+ value: `${formatted}${m.unit ? ` ${m.unit}` : ""}`,
4077
4292
  origin: m.origin
4078
4293
  });
4079
4294
  }
@@ -4681,7 +4896,7 @@ function ResultsSpreadsheetGrid({
4681
4896
  ] }),
4682
4897
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2.5 text-right font-mono tabular-nums", children: s.totalVolume > 0 ? `${formatNum(s.totalVolume, 0)} ${s.volumeUnit ?? ""}` : s.totalDistance > 0 ? `${formatNum(s.totalDistance, 0)} ${s.distanceUnit ?? ""}` : "\u2014" }),
4683
4898
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2.5 text-right font-mono tabular-nums", children: s.totalReps > 0 ? formatNum(s.totalReps, 0) : "\u2014" }),
4684
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2.5 text-right font-mono tabular-nums", children: s.tis !== void 0 ? `${formatNum(s.tis, 0)} pts` : "\u2014" }),
4899
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2.5 text-right font-mono tabular-nums", children: s.tis !== void 0 ? `${formatAnalyticsFloat(s.tis)} pts` : "\u2014" }),
4685
4900
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2.5 text-right font-mono tabular-nums", children: s.rpe !== void 0 ? `${s.rpe}/10` : "\u2014" })
4686
4901
  ]
4687
4902
  },
@@ -4703,6 +4918,7 @@ function ResultsSpreadsheetGrid({
4703
4918
  {
4704
4919
  outputs: run.events,
4705
4920
  filter: rawFilter,
4921
+ timeOrigin: run.timestamp,
4706
4922
  onClearFilter: () => setRawFilter(""),
4707
4923
  onEditMetric: onEditMetric ? (p) => onEditMetric(run.resultId, p) : void 0,
4708
4924
  prHighlights
@@ -5164,14 +5380,14 @@ var CLAUSE_ICON_MAP = {
5164
5380
  tag: lucideReact.Tag,
5165
5381
  tags: lucideReact.Tag,
5166
5382
  contributes: lucideReact.Sparkles,
5167
- effort: lucideReact.Dumbbell,
5383
+ effort: lucideReact.Flame,
5168
5384
  domain: lucideReact.Globe,
5169
5385
  format: lucideReact.Clock,
5170
- equipment: lucideReact.Wrench,
5386
+ equipment: lucideReact.Dumbbell,
5171
5387
  quality: lucideReact.Zap,
5172
5388
  intent: lucideReact.Gauge,
5173
5389
  discipline: lucideReact.SlidersHorizontal,
5174
- intensity: lucideReact.Flame,
5390
+ intensity: lucideReact.Activity,
5175
5391
  origin: lucideReact.Bookmark,
5176
5392
  type: lucideReact.Box,
5177
5393
  time: lucideReact.CalendarRange,
@@ -9531,9 +9747,19 @@ function QueryBlockView({
9531
9747
  const parsed = React2.useMemo(() => wodWikiWql.parseQuery(effectiveQuery), [effectiveQuery]);
9532
9748
  const effectiveWidgetError = widgetError ?? yamlObject?.error;
9533
9749
  const syntaxError = isMultiLineDoc ? docParse.diagnostics[0] : parsed.error;
9750
+ const missingKey = missing.join("\0");
9751
+ const resolvedAttributesKey = React2.useMemo(() => JSON.stringify(resolvedAttributes), [resolvedAttributes]);
9752
+ const parsedRef = React2.useRef(parsed);
9753
+ parsedRef.current = parsed;
9754
+ const resolvedAttributesRef = React2.useRef(resolvedAttributes);
9755
+ resolvedAttributesRef.current = resolvedAttributes;
9534
9756
  const unknownType = effectiveWidgetType != null && effectiveWidgetType !== "" && !wodWikiWql.isDashboardWidgetType(effectiveWidgetType);
9535
9757
  const [runResult, setRunResult] = React2.useState(void 0);
9536
9758
  const [runError, setRunError] = React2.useState(void 0);
9759
+ const [isRecalculating, setIsRecalculating] = React2.useState(false);
9760
+ const [lockedMinHeight, setLockedMinHeight] = React2.useState(void 0);
9761
+ const bodyContainerRef = React2.useRef(null);
9762
+ const settledHeightRef = React2.useRef(0);
9537
9763
  const [rowsRefreshKey, setRowsRefreshKey] = React2.useState(0);
9538
9764
  React2.useEffect(() => {
9539
9765
  if (onResultSaved) {
@@ -9545,13 +9771,46 @@ function QueryBlockView({
9545
9771
  };
9546
9772
  }
9547
9773
  }, [onResultSaved]);
9774
+ React2.useEffect(() => {
9775
+ const el = bodyContainerRef.current;
9776
+ if (!el || isRecalculating) return;
9777
+ const measure = () => {
9778
+ const h = el.getBoundingClientRect().height;
9779
+ if (h > 0) settledHeightRef.current = h;
9780
+ };
9781
+ measure();
9782
+ if (typeof ResizeObserver === "undefined") return;
9783
+ const ro = new ResizeObserver(measure);
9784
+ ro.observe(el);
9785
+ return () => ro.disconnect();
9786
+ }, [isRecalculating, runResult, runError, syntaxError, effectiveWidgetError, unknownType, missingKey]);
9787
+ React2.useEffect(() => {
9788
+ if (isRecalculating || lockedMinHeight === void 0) return;
9789
+ if (typeof requestAnimationFrame !== "function") {
9790
+ setLockedMinHeight(void 0);
9791
+ return;
9792
+ }
9793
+ const rafId = requestAnimationFrame(() => {
9794
+ setLockedMinHeight(void 0);
9795
+ });
9796
+ return () => cancelAnimationFrame(rafId);
9797
+ }, [isRecalculating, lockedMinHeight]);
9548
9798
  React2.useEffect(() => {
9549
9799
  let cancelled = false;
9550
9800
  let retryTimer;
9551
- setRunError(void 0);
9552
- setRunResult(void 0);
9553
- if (syntaxError || effectiveWidgetError || unknownType || missing.length > 0 || !executor) return;
9554
- const isSessionFind = !isMultiLineDoc && wodWikiWql.isFindQuery(parsed) && parsed.target === "session";
9801
+ if (syntaxError || effectiveWidgetError || unknownType || missingKey.length > 0 || !executor) {
9802
+ setRunError(void 0);
9803
+ setIsRecalculating(false);
9804
+ setLockedMinHeight(void 0);
9805
+ return;
9806
+ }
9807
+ const currentParsed = parsedRef.current;
9808
+ const currentAttributes = resolvedAttributesRef.current;
9809
+ if (settledHeightRef.current > 0) {
9810
+ setLockedMinHeight(Math.ceil(settledHeightRef.current));
9811
+ }
9812
+ setIsRecalculating(true);
9813
+ const isSessionFind = !isMultiLineDoc && wodWikiWql.isFindQuery(currentParsed) && currentParsed.target === "session";
9555
9814
  const host = createExecutorDocumentHost(executor);
9556
9815
  const executeRun = (attemptCount) => {
9557
9816
  const runner = new wodWikiWql.SharedQueryDocumentRunner(host, pageSources ? { pageSources } : void 0);
@@ -9560,15 +9819,21 @@ function QueryBlockView({
9560
9819
  const error = res.outputs.find((o) => o.error !== void 0)?.error ?? res.diagnostics[0];
9561
9820
  if (!res.outputs.length && res.diagnostics.length) {
9562
9821
  setRunError(res.diagnostics[0]);
9822
+ setRunResult(void 0);
9823
+ setIsRecalculating(false);
9563
9824
  return;
9564
9825
  }
9565
9826
  if (error) {
9566
9827
  setRunError(error);
9828
+ setRunResult(void 0);
9829
+ setIsRecalculating(false);
9567
9830
  return;
9568
9831
  }
9569
- const effectiveParsed = isMultiLineDoc ? { family: "aggregate", raw: effectiveQuery, agg: "sum", metric: res.outputs[0]?.name ?? "value", filters: [], groupBy: [] } : parsed;
9570
- const shaped = outputsToRunResult(effectiveParsed, res, resolvedAttributes);
9832
+ const effectiveParsed = isMultiLineDoc ? { family: "aggregate", raw: effectiveQuery, agg: "sum", metric: res.outputs[0]?.name ?? "value", filters: [], groupBy: [] } : currentParsed;
9833
+ const shaped = outputsToRunResult(effectiveParsed, res, currentAttributes);
9834
+ setRunError(void 0);
9571
9835
  setRunResult(shaped);
9836
+ setIsRecalculating(false);
9572
9837
  if (isSessionFind && (shaped.runs ?? []).length === 0 && attemptCount < 4) {
9573
9838
  const delays = [50, 150, 350, 750];
9574
9839
  retryTimer = setTimeout(() => {
@@ -9576,7 +9841,11 @@ function QueryBlockView({
9576
9841
  }, delays[attemptCount] ?? 500);
9577
9842
  }
9578
9843
  }).catch((err) => {
9579
- if (!cancelled) setRunError(err instanceof Error ? err.message : String(err));
9844
+ if (!cancelled) {
9845
+ setRunError(err instanceof Error ? err.message : String(err));
9846
+ setRunResult(void 0);
9847
+ setIsRecalculating(false);
9848
+ }
9580
9849
  });
9581
9850
  };
9582
9851
  executeRun(0);
@@ -9584,7 +9853,7 @@ function QueryBlockView({
9584
9853
  cancelled = true;
9585
9854
  clearTimeout(retryTimer);
9586
9855
  };
9587
- }, [effectiveQuery, parsed, isMultiLineDoc, syntaxError, effectiveWidgetError, unknownType, missing, executor, rowsRefreshKey, resolvedAttributes, pageSources]);
9856
+ }, [effectiveQuery, isMultiLineDoc, syntaxError, effectiveWidgetError, unknownType, missingKey, executor, rowsRefreshKey, resolvedAttributesKey, pageSources]);
9588
9857
  const canEdit = onSaveQuery !== void 0 && !readOnly;
9589
9858
  const onEdit = canEdit ? () => setIsModalOpen(true) : void 0;
9590
9859
  const effectiveEditSource = !readOnly ? onEditSource : void 0;
@@ -9616,29 +9885,39 @@ function QueryBlockView({
9616
9885
  onAddToDashboard,
9617
9886
  hideActions: effectiveWidgetType === "summary" && Boolean(runResult?.runs?.length),
9618
9887
  children: /* @__PURE__ */ jsxRuntime.jsx(
9619
- QueryBlockBody,
9888
+ "div",
9620
9889
  {
9621
- parsed,
9622
- result: runResult,
9623
- resultId,
9624
- widgetType: effectiveWidgetType,
9625
- isMultiLineDoc,
9626
- yamlColumns: yamlObject?.columns,
9627
- yamlSort: yamlObject?.sort,
9628
- yamlLimit: yamlObject?.limit,
9629
- yamlComparePr: yamlObject?.comparePr,
9630
- attributes: resolvedAttributes,
9631
- fallbackLabel,
9632
- executor,
9633
- onCaptureRpe,
9634
- onEditMetric: readOnly ? void 0 : onEditMetric,
9635
- onCaptured: () => setRowsRefreshKey((k) => k + 1),
9636
- onOpenNote,
9637
- noteHref,
9638
- onOpenResults,
9639
- onAddToDashboard,
9640
- onEditSource: effectiveEditSource,
9641
- readOnly
9890
+ ref: bodyContainerRef,
9891
+ "aria-busy": isRecalculating || void 0,
9892
+ "data-recalculating": isRecalculating ? "true" : void 0,
9893
+ style: lockedMinHeight ? { minHeight: `${lockedMinHeight}px` } : void 0,
9894
+ className: isRecalculating && runResult ? "opacity-70 transition-opacity duration-150" : "transition-opacity duration-150",
9895
+ children: /* @__PURE__ */ jsxRuntime.jsx(
9896
+ QueryBlockBody,
9897
+ {
9898
+ parsed,
9899
+ result: runResult,
9900
+ resultId,
9901
+ widgetType: effectiveWidgetType,
9902
+ isMultiLineDoc,
9903
+ yamlColumns: yamlObject?.columns,
9904
+ yamlSort: yamlObject?.sort,
9905
+ yamlLimit: yamlObject?.limit,
9906
+ yamlComparePr: yamlObject?.comparePr,
9907
+ attributes: resolvedAttributes,
9908
+ fallbackLabel,
9909
+ executor,
9910
+ onCaptureRpe,
9911
+ onEditMetric: readOnly ? void 0 : onEditMetric,
9912
+ onCaptured: () => setRowsRefreshKey((k) => k + 1),
9913
+ onOpenNote,
9914
+ noteHref,
9915
+ onOpenResults,
9916
+ onAddToDashboard,
9917
+ onEditSource: effectiveEditSource,
9918
+ readOnly
9919
+ }
9920
+ )
9642
9921
  }
9643
9922
  )
9644
9923
  }
@@ -9690,7 +9969,9 @@ function QueryBlockBody({
9690
9969
  Boolean(effectiveType === "summary" && yamlComparePr !== false && summaryBlockContentId && executor)
9691
9970
  );
9692
9971
  if (!result) {
9693
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-muted-foreground py-2", children: wodWikiWql.isFindQuery(parsed) ? "Loading rows\u2026" : "Loading\u2026" });
9972
+ const expectsChart = wodWikiWql.isPipelineQuery(parsed) || Boolean(isMultiLineDoc) || ["timeseries", "bar", "line", "pie", "area", "chart"].includes(effectiveType);
9973
+ const placeholderMinH = effectiveType === "value" ? "min-h-[64px]" : expectsChart ? "min-h-[220px]" : "min-h-[120px]";
9974
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex items-center text-xs text-muted-foreground py-2 ${placeholderMinH}`, children: wodWikiWql.isFindQuery(parsed) ? "Loading rows\u2026" : "Loading\u2026" });
9694
9975
  }
9695
9976
  if (result.table && (widgetType == null || widgetType === "" || widgetType === "table")) {
9696
9977
  return /* @__PURE__ */ jsxRuntime.jsx(WidgetChart, { type: "table", result });
@@ -9938,7 +10219,7 @@ var ReactQueryBlock = class extends view.WidgetType {
9938
10219
  root = null;
9939
10220
  container = null;
9940
10221
  eq(other) {
9941
- return this.queryText === other.queryText && this.sectionId === other.sectionId && this.sectionFrom === other.sectionFrom && this.widgetType === other.widgetType && this.widgetError === other.widgetError && JSON.stringify(this.attributes ?? {}) === JSON.stringify(other.attributes ?? {}) && JSON.stringify(this.tokenValues ?? {}) === JSON.stringify(other.tokenValues ?? {}) && this.options?.readOnly === other.options?.readOnly && this.options?.executor === other.options?.executor && this.options?.onOpenNote === other.options?.onOpenNote && this.options?.noteHref === other.options?.noteHref && this.options?.onOpenResults === other.options?.onOpenResults && this.options?.onAddToDashboard === other.options?.onAddToDashboard && this.options?.pageSources === other.options?.pageSources;
10222
+ return this.queryText === other.queryText && this.sectionId === other.sectionId && this.widgetType === other.widgetType && this.widgetError === other.widgetError && JSON.stringify(this.attributes ?? {}) === JSON.stringify(other.attributes ?? {}) && JSON.stringify(this.tokenValues ?? {}) === JSON.stringify(other.tokenValues ?? {}) && this.options?.readOnly === other.options?.readOnly && this.options?.executor === other.options?.executor && this.options?.onOpenNote === other.options?.onOpenNote && this.options?.noteHref === other.options?.noteHref && this.options?.onOpenResults === other.options?.onOpenResults && this.options?.onAddToDashboard === other.options?.onAddToDashboard && this.options?.pageSources === other.options?.pageSources;
9942
10223
  }
9943
10224
  resolveSection(view) {
9944
10225
  const byId = findQueryBlockSection(view, this.sectionId);
@@ -10032,6 +10313,9 @@ var ReactQueryBlock = class extends view.WidgetType {
10032
10313
  ignoreEvent() {
10033
10314
  return true;
10034
10315
  }
10316
+ get estimatedHeight() {
10317
+ return this.widgetType === "value" ? 96 : 220;
10318
+ }
10035
10319
  get block() {
10036
10320
  return true;
10037
10321
  }
@@ -10045,7 +10329,7 @@ var QueryPreviewToggleWidget = class extends view.WidgetType {
10045
10329
  sectionId;
10046
10330
  exitPos;
10047
10331
  eq(other) {
10048
- return this.sectionId === other.sectionId && this.exitPos === other.exitPos;
10332
+ return this.sectionId === other.sectionId;
10049
10333
  }
10050
10334
  toDOM(view) {
10051
10335
  const btn = document.createElement("button");
@@ -10061,7 +10345,8 @@ var QueryPreviewToggleWidget = class extends view.WidgetType {
10061
10345
  btn.addEventListener("click", (e) => {
10062
10346
  e.preventDefault();
10063
10347
  e.stopPropagation();
10064
- const targetPos = Math.min(this.exitPos, view.state.doc.length);
10348
+ const liveExitPos = findQueryBlockSection(view, this.sectionId)?.to ?? this.exitPos;
10349
+ const targetPos = Math.min(liveExitPos, view.state.doc.length);
10065
10350
  view.dispatch({
10066
10351
  selection: { anchor: targetPos },
10067
10352
  effects: setQuerySourceEditing.of({
@@ -10163,21 +10448,102 @@ var queryBlockPreviewTheme = view.EditorView.baseTheme({
10163
10448
  backgroundColor: "hsl(var(--muted))"
10164
10449
  }
10165
10450
  });
10451
+ var queryBlockOptionsFacet = state.Facet.define({
10452
+ combine: (values2) => values2[values2.length - 1]
10453
+ });
10454
+ var queryBlockDecoField = state.StateField.define({
10455
+ create(state) {
10456
+ return buildQueryBlockDecos(state, state.facet(queryBlockOptionsFacet));
10457
+ },
10458
+ update(deco, tr) {
10459
+ if (tr.docChanged || tr.selection || tr.startState.field(sectionField) !== tr.state.field(sectionField) || tr.startState.facet(queryBlockOptionsFacet) !== tr.state.facet(queryBlockOptionsFacet) || tr.effects.some((e) => e.is(setQuerySourceEditing) || e.is(setEditorFocused))) {
10460
+ return buildQueryBlockDecos(tr.state, tr.state.facet(queryBlockOptionsFacet));
10461
+ }
10462
+ return deco;
10463
+ },
10464
+ provide: (f) => view.EditorView.decorations.from(f)
10465
+ });
10166
10466
  function queryBlockPreview(options) {
10167
- const decoField = state.StateField.define({
10168
- create(state) {
10169
- return buildQueryBlockDecos(state, options);
10170
- },
10171
- update(deco, tr) {
10172
- if (tr.docChanged || tr.selection || tr.startState.field(sectionField) !== tr.state.field(sectionField) || tr.effects.some((e) => e.is(setQuerySourceEditing) || e.is(setEditorFocused))) {
10173
- return buildQueryBlockDecos(tr.state, options);
10174
- }
10175
- return deco;
10176
- },
10177
- provide: (f) => view.EditorView.decorations.from(f)
10467
+ return [
10468
+ queryBlockOptionsFacet.of(options),
10469
+ editingQuerySectionsField,
10470
+ queryBlockDecoField,
10471
+ queryBlockPreviewTheme
10472
+ ];
10473
+ }
10474
+ function isWhiteboardScriptBody(state, pos) {
10475
+ const sections = state.field(sectionField, false);
10476
+ if (sections) {
10477
+ const section = sectionAtPos(state, pos);
10478
+ if (!section || section.type !== "time" && section.type !== "log") {
10479
+ return false;
10480
+ }
10481
+ const line = state.doc.lineAt(pos);
10482
+ if (line.number <= section.startLine) return false;
10483
+ if (line.number === section.endLine && /^\s*`{3,}\s*$/.test(line.text)) return false;
10484
+ return line.number <= section.endLine;
10485
+ }
10486
+ return wodWikiLang.whiteboardScriptLanguage.isActiveAt(state, pos, -1) || wodWikiLang.whiteboardScriptLanguage.isActiveAt(state, pos, 1);
10487
+ }
10488
+ function insertWhiteboardNewline(view) {
10489
+ if (view.state.readOnly) return false;
10490
+ const { state: state$1 } = view;
10491
+ const inWhiteboard = state$1.selection.ranges.every(
10492
+ (range) => isWhiteboardScriptBody(state$1, range.from) && isWhiteboardScriptBody(state$1, range.to)
10493
+ );
10494
+ if (!inWhiteboard) return false;
10495
+ const unit = state$1.facet(language.indentUnit);
10496
+ const transaction = state$1.changeByRange((range) => {
10497
+ const startLine = state$1.doc.lineAt(range.from);
10498
+ const endLine = state$1.doc.lineAt(range.to);
10499
+ if (startLine.number === endLine.number) {
10500
+ const action2 = wodWikiLang.computeWhiteboardEnterAction(
10501
+ startLine.text,
10502
+ range.from - startLine.from,
10503
+ range.to - startLine.from,
10504
+ unit
10505
+ );
10506
+ const replaceFrom2 = startLine.from + action2.replaceFromCol;
10507
+ return {
10508
+ changes: {
10509
+ from: replaceFrom2,
10510
+ to: startLine.from + action2.replaceToCol,
10511
+ insert: action2.insert
10512
+ },
10513
+ range: state.EditorSelection.cursor(replaceFrom2 + action2.cursorOffset)
10514
+ };
10515
+ }
10516
+ const beforeOnStart = startLine.text.slice(0, range.from - startLine.from);
10517
+ const action = wodWikiLang.computeWhiteboardEnterAction(
10518
+ beforeOnStart,
10519
+ beforeOnStart.length,
10520
+ beforeOnStart.length,
10521
+ unit
10522
+ );
10523
+ const afterOnEnd = endLine.text.slice(range.to - endLine.from);
10524
+ const leadingAfter = /^[ \t]+/.exec(afterOnEnd)?.[0].length ?? 0;
10525
+ const replaceFrom = startLine.from + action.replaceFromCol;
10526
+ return {
10527
+ changes: {
10528
+ from: replaceFrom,
10529
+ to: range.to + leadingAfter,
10530
+ insert: action.insert
10531
+ },
10532
+ range: state.EditorSelection.cursor(replaceFrom + action.cursorOffset)
10533
+ };
10178
10534
  });
10179
- return [editingQuerySectionsField, decoField, queryBlockPreviewTheme];
10535
+ view.dispatch(state$1.update(transaction, { scrollIntoView: true, userEvent: "input" }));
10536
+ return true;
10180
10537
  }
10538
+ var wodIndentKeymap = state.Prec.high(
10539
+ view.keymap.of([
10540
+ {
10541
+ key: "Enter",
10542
+ run: insertWhiteboardNewline,
10543
+ shift: insertWhiteboardNewline
10544
+ }
10545
+ ])
10546
+ );
10181
10547
 
10182
10548
  // src/extensions/whiteboard-autocomplete.ts
10183
10549
  var WORKOUT_SECTION = { name: "Workout & Data", rank: 1 };
@@ -10640,18 +11006,62 @@ var wodCompletionKeymap = state.Prec.highest(
10640
11006
  }
10641
11007
  ])
10642
11008
  );
10643
- var wodAutocompletion = autocomplete.autocompletion({
10644
- selectOnOpen: false,
10645
- interactionDelay: 0,
10646
- icons: false,
10647
- addToOptions: [wodCompletionIconOption],
10648
- tooltipClass: (state) => state.facet(mobileDockedCompletionFacet) ? "cm-wod-tooltip cm-wod-tooltip-docked-hidden" : "cm-wod-tooltip",
10649
- activateOnCompletion: (completion) => completion.type === "property" && typeof completion.apply === "string" && completion.apply.endsWith(":\n - "),
10650
- override: [
10651
- // Explicit provider order — see wodCompletionSource.
10652
- wodCompletionSource
10653
- ]
11009
+ function shouldTriggerBackspaceCompletion(update) {
11010
+ if (!update.docChanged || update.state.readOnly) return false;
11011
+ if (autocomplete.completionStatus(update.state) !== null) return false;
11012
+ if (!update.state.selection.main.empty) return false;
11013
+ const backspaces = update.transactions.filter((tr) => tr.isUserEvent("delete.backward"));
11014
+ if (backspaces.length === 0) return false;
11015
+ for (const tr of backspaces) {
11016
+ let deletedNewline = false;
11017
+ tr.changes.iterChanges((fromA, toA) => {
11018
+ if (tr.startState.doc.sliceString(fromA, toA).includes("\n")) {
11019
+ deletedNewline = true;
11020
+ }
11021
+ });
11022
+ if (deletedNewline) return false;
11023
+ }
11024
+ const head = update.state.selection.main.head;
11025
+ const line = update.state.doc.lineAt(head);
11026
+ const before = line.text.slice(0, head - line.from);
11027
+ if (isWhiteboardScriptBody(update.state, head)) {
11028
+ const trimmedBefore = before.trim();
11029
+ if (!trimmedBefore) return false;
11030
+ if (/\/\//.test(before)) return false;
11031
+ if (/^#(?![A-Za-z0-9])/.test(trimmedBefore)) return false;
11032
+ if (/(?:^|\s)[*^]?\d*:\d*$/.test(before)) return false;
11033
+ return true;
11034
+ }
11035
+ const section = activeCursorSection(update.state);
11036
+ if (!section || section.type === "markdown") {
11037
+ if (/^\s*#{1,6}(?:\s|$)/.test(before)) return false;
11038
+ if (/(?:^#[a-zA-Z][a-zA-Z0-9-]*|(?<=\s)#[a-zA-Z0-9-]*)$/.test(before)) return true;
11039
+ if (/\[\[[^\]]*$/.test(before)) return true;
11040
+ }
11041
+ return false;
11042
+ }
11043
+ var wodBackspaceCompletion = view.EditorView.updateListener.of((update) => {
11044
+ if (shouldTriggerBackspaceCompletion(update)) {
11045
+ queueMicrotask(() => {
11046
+ if (update.view.state === update.state) autocomplete.startCompletion(update.view);
11047
+ });
11048
+ }
10654
11049
  });
11050
+ var wodAutocompletion = [
11051
+ autocomplete.autocompletion({
11052
+ selectOnOpen: false,
11053
+ interactionDelay: 0,
11054
+ icons: false,
11055
+ addToOptions: [wodCompletionIconOption],
11056
+ tooltipClass: (state) => state.facet(mobileDockedCompletionFacet) ? "cm-wod-tooltip cm-wod-tooltip-docked-hidden" : "cm-wod-tooltip",
11057
+ activateOnCompletion: (completion) => completion.type === "property" && typeof completion.apply === "string" && completion.apply.endsWith(":\n - "),
11058
+ override: [
11059
+ // Explicit provider order — see wodCompletionSource.
11060
+ wodCompletionSource
11061
+ ]
11062
+ }),
11063
+ wodBackspaceCompletion
11064
+ ];
10655
11065
  var SectionGeometryPlugin = class {
10656
11066
  constructor(view) {
10657
11067
  this.view = view;
@@ -10744,15 +11154,15 @@ var SectionGeometryPlugin = class {
10744
11154
  }
10745
11155
  };
10746
11156
  var sectionGeometry = view.ViewPlugin.fromClass(SectionGeometryPlugin);
10747
- var fenceOpenDeco = view.Decoration.line({
10748
- attributes: { class: "cm-wod-fence cm-wod-fence-open" }
10749
- });
10750
- var fenceCloseDeco = view.Decoration.line({
10751
- attributes: { class: "cm-wod-fence cm-wod-fence-close" }
10752
- });
10753
- var workoutInnerDeco = view.Decoration.line({
10754
- attributes: { class: "cm-wod-inner" }
10755
- });
11157
+ var lineDecoCache = /* @__PURE__ */ new Map();
11158
+ function lineDeco(className) {
11159
+ let cached = lineDecoCache.get(className);
11160
+ if (!cached) {
11161
+ cached = view.Decoration.line({ attributes: { class: className } });
11162
+ lineDecoCache.set(className, cached);
11163
+ }
11164
+ return cached;
11165
+ }
10756
11166
  var DialectBadgeWidget = class extends view.WidgetType {
10757
11167
  constructor(dialect, lineFrom, lineTo, readOnly) {
10758
11168
  super();
@@ -10766,7 +11176,7 @@ var DialectBadgeWidget = class extends view.WidgetType {
10766
11176
  lineTo;
10767
11177
  readOnly;
10768
11178
  eq(other) {
10769
- return this.dialect === other.dialect && this.lineFrom === other.lineFrom && this.lineTo === other.lineTo && this.readOnly === other.readOnly;
11179
+ return this.dialect === other.dialect && this.readOnly === other.readOnly;
10770
11180
  }
10771
11181
  toDOM(view) {
10772
11182
  const badge = document.createElement("button");
@@ -10789,7 +11199,14 @@ var DialectBadgeWidget = class extends view.WidgetType {
10789
11199
  e.preventDefault();
10790
11200
  e.stopPropagation();
10791
11201
  if (view.state.readOnly) return;
10792
- const currentLine = view.state.doc.lineAt(this.lineFrom);
11202
+ let targetPos = Math.max(0, Math.min(this.lineFrom, view.state.doc.length));
11203
+ try {
11204
+ if (view.dom.contains(badge)) {
11205
+ targetPos = Math.max(0, Math.min(view.posAtDOM(badge), view.state.doc.length));
11206
+ }
11207
+ } catch {
11208
+ }
11209
+ const currentLine = view.state.doc.lineAt(targetPos);
10793
11210
  const match = currentLine.text.match(/^(\s*`{3,})(time|log|wod|whiteboard)(.*)$/i);
10794
11211
  if (!match) return;
10795
11212
  const nextTag = isTime ? "log" : "time";
@@ -10818,8 +11235,8 @@ var AppendLineAfterFenceWidget = class extends view.WidgetType {
10818
11235
  this.closeLineTo = closeLineTo;
10819
11236
  }
10820
11237
  closeLineTo;
10821
- eq(other) {
10822
- return this.closeLineTo === other.closeLineTo;
11238
+ eq() {
11239
+ return true;
10823
11240
  }
10824
11241
  toDOM(view) {
10825
11242
  const btn = document.createElement("button");
@@ -10836,7 +11253,14 @@ var AppendLineAfterFenceWidget = class extends view.WidgetType {
10836
11253
  e.preventDefault();
10837
11254
  e.stopPropagation();
10838
11255
  if (view.state.readOnly) return;
10839
- const pos = Math.min(this.closeLineTo, view.state.doc.length);
11256
+ let pos = Math.min(this.closeLineTo, view.state.doc.length);
11257
+ try {
11258
+ if (view.dom.contains(btn)) {
11259
+ const domPos = Math.max(0, Math.min(view.posAtDOM(btn), view.state.doc.length));
11260
+ pos = view.state.doc.lineAt(domPos).to;
11261
+ }
11262
+ } catch {
11263
+ }
10840
11264
  const hasTrailingNewline = pos < view.state.doc.length && view.state.doc.sliceString(pos, pos + 1) === "\n";
10841
11265
  if (hasTrailingNewline) {
10842
11266
  const nextLine = view.state.doc.lineAt(pos + 1);
@@ -10869,11 +11293,23 @@ function buildWorkoutDecorations(state$1) {
10869
11293
  if (section.type !== "time" && section.type !== "log") continue;
10870
11294
  const startLine = state$1.doc.line(section.startLine);
10871
11295
  const endLine = state$1.doc.line(section.endLine);
11296
+ const dialectClass = `cm-wod-block-${section.type}`;
11297
+ const isActive = !state$1.readOnly && focused && cursor2 >= section.from && cursor2 <= section.to;
11298
+ const activeClass = isActive ? " cm-wod-block-active" : "";
10872
11299
  if (section.endLine <= section.startLine) {
10873
- decos.push(fenceOpenDeco.range(startLine.from));
11300
+ decos.push(
11301
+ lineDeco(`cm-wod-fence cm-wod-fence-open ${dialectClass}${activeClass}`).range(
11302
+ startLine.from
11303
+ )
11304
+ );
10874
11305
  continue;
10875
11306
  }
10876
- decos.push(fenceOpenDeco.range(startLine.from));
11307
+ const isEmptyBody = section.endLine === section.startLine + 1;
11308
+ decos.push(
11309
+ lineDeco(`cm-wod-fence cm-wod-fence-open ${dialectClass}${activeClass}`).range(
11310
+ startLine.from
11311
+ )
11312
+ );
10877
11313
  decos.push(
10878
11314
  view.Decoration.widget({
10879
11315
  widget: new DialectBadgeWidget(
@@ -10882,16 +11318,26 @@ function buildWorkoutDecorations(state$1) {
10882
11318
  startLine.to,
10883
11319
  state$1.readOnly
10884
11320
  ),
10885
- side: 1
10886
- }).range(startLine.to)
11321
+ side: -1
11322
+ }).range(startLine.from)
10887
11323
  );
10888
11324
  for (let l = section.startLine + 1; l < section.endLine; l++) {
10889
11325
  const line = state$1.doc.line(l);
10890
- decos.push(workoutInnerDeco.range(line.from));
11326
+ const isFirst = l === section.startLine + 1 ? " cm-wod-inner-first" : "";
11327
+ const isLast = l === section.endLine - 1 ? " cm-wod-inner-last" : "";
11328
+ decos.push(
11329
+ lineDeco(`cm-wod-inner ${dialectClass}${activeClass}${isFirst}${isLast}`).range(
11330
+ line.from
11331
+ )
11332
+ );
10891
11333
  }
10892
- decos.push(fenceCloseDeco.range(endLine.from));
10893
- const cursorInsideSection = !state$1.readOnly && focused && cursor2 >= section.from && cursor2 <= section.to;
10894
- if (cursorInsideSection) {
11334
+ const emptyCloseClass = isEmptyBody ? " cm-wod-fence-close-empty" : "";
11335
+ decos.push(
11336
+ lineDeco(
11337
+ `cm-wod-fence cm-wod-fence-close ${dialectClass}${activeClass}${emptyCloseClass}`
11338
+ ).range(endLine.from)
11339
+ );
11340
+ if (isActive) {
10895
11341
  decos.push(
10896
11342
  view.Decoration.widget({
10897
11343
  widget: new AppendLineAfterFenceWidget(endLine.to),
@@ -10924,55 +11370,152 @@ var scriptBlockBaseTheme = view.EditorView.baseTheme({
10924
11370
  fontFamily: 'var(--font-mono, "JetBrains Mono", ui-monospace, SFMono-Regular, monospace)',
10925
11371
  fontSize: "11.5px",
10926
11372
  color: "hsl(var(--muted-foreground))",
10927
- paddingLeft: "7px",
10928
- paddingRight: "8px",
10929
- backgroundColor: "hsl(var(--card))",
10930
- borderLeft: "1px solid hsl(var(--border))",
10931
- borderRight: "1px solid hsl(var(--border))",
11373
+ paddingLeft: "14px",
11374
+ paddingRight: "14px",
11375
+ backgroundColor: "color-mix(in srgb, hsl(var(--muted)) 48%, hsl(var(--card)) 52%)",
11376
+ borderLeft: "1px solid hsl(var(--border) / 0.9)",
11377
+ borderRight: "1px solid hsl(var(--border) / 0.9)",
10932
11378
  boxSizing: "border-box"
10933
11379
  },
11380
+ "&dark .cm-wod-fence": {
11381
+ backgroundColor: "hsl(var(--muted) / 0.92)"
11382
+ },
11383
+ ".cm-wod-block-time": {
11384
+ borderLeftColor: "color-mix(in srgb, hsl(var(--metric-time)) 24%, hsl(var(--border)))",
11385
+ borderRightColor: "color-mix(in srgb, hsl(var(--metric-time)) 24%, hsl(var(--border)))"
11386
+ },
11387
+ ".cm-wod-block-log": {
11388
+ borderLeftColor: "color-mix(in srgb, hsl(var(--metric-effort)) 24%, hsl(var(--border)))",
11389
+ borderRightColor: "color-mix(in srgb, hsl(var(--metric-effort)) 24%, hsl(var(--border)))"
11390
+ },
10934
11391
  ".cm-wod-fence-open": {
10935
- borderTop: "1px solid hsl(var(--border))",
10936
- borderRadius: "8px 8px 0 0",
10937
- // Reserve header clearance so dialect badge & InlineCommandBar controls
10938
- // stay crisp and never collide with preceding prose or the first workout line.
10939
- paddingTop: "32px",
10940
- paddingRight: "112px",
10941
- backgroundColor: "transparent",
10942
- backgroundImage: "linear-gradient(to bottom, transparent 30px, hsl(var(--border)) 30px, hsl(var(--border)) 31px, hsl(var(--card)) 31px)"
11392
+ borderTop: "1px solid hsl(var(--border) / 0.9)",
11393
+ borderBottom: "1px solid hsl(var(--border) / 0.75)",
11394
+ borderRadius: "10px 10px 0 0",
11395
+ paddingTop: "7px",
11396
+ paddingBottom: "7px",
11397
+ paddingLeft: "12px",
11398
+ // Reserve right clearance for InlineCommandBar controls inside the unified header bar.
11399
+ paddingRight: "228px",
11400
+ lineHeight: "24px"
11401
+ },
11402
+ ".cm-wod-fence-open.cm-wod-block-time": {
11403
+ borderTopColor: "color-mix(in srgb, hsl(var(--metric-time)) 24%, hsl(var(--border)))",
11404
+ backgroundColor: "color-mix(in srgb, hsl(var(--metric-time)) 5%, color-mix(in srgb, hsl(var(--muted)) 80%, hsl(var(--card)) 20%))"
11405
+ },
11406
+ ".cm-wod-fence-open.cm-wod-block-log": {
11407
+ borderTopColor: "color-mix(in srgb, hsl(var(--metric-effort)) 24%, hsl(var(--border)))",
11408
+ backgroundColor: "color-mix(in srgb, hsl(var(--metric-effort)) 5%, color-mix(in srgb, hsl(var(--muted)) 80%, hsl(var(--card)) 20%))"
11409
+ },
11410
+ "&dark .cm-wod-fence-open.cm-wod-block-time": {
11411
+ borderTopColor: "color-mix(in srgb, hsl(var(--metric-time)) 28%, hsl(var(--border)))",
11412
+ backgroundColor: "color-mix(in srgb, hsl(var(--metric-time)) 10%, hsl(var(--muted)))"
11413
+ },
11414
+ "&dark .cm-wod-fence-open.cm-wod-block-log": {
11415
+ borderTopColor: "color-mix(in srgb, hsl(var(--metric-effort)) 28%, hsl(var(--border)))",
11416
+ backgroundColor: "color-mix(in srgb, hsl(var(--metric-effort)) 10%, hsl(var(--muted)))"
10943
11417
  },
10944
11418
  ".cm-wod-fence-close": {
10945
- borderBottom: "1px solid hsl(var(--border))",
10946
- borderRadius: "0 0 8px 8px"
11419
+ fontSize: "11px",
11420
+ color: "hsl(var(--muted-foreground) / 0.55)",
11421
+ paddingTop: "3px",
11422
+ paddingBottom: "7px",
11423
+ borderBottom: "1px solid hsl(var(--border) / 0.9)",
11424
+ borderRadius: "0 0 10px 10px"
11425
+ },
11426
+ ".cm-wod-fence-close.cm-wod-block-time": {
11427
+ borderBottomColor: "color-mix(in srgb, hsl(var(--metric-time)) 24%, hsl(var(--border)))"
11428
+ },
11429
+ ".cm-wod-fence-close.cm-wod-block-log": {
11430
+ borderBottomColor: "color-mix(in srgb, hsl(var(--metric-effort)) 24%, hsl(var(--border)))"
11431
+ },
11432
+ ".cm-wod-fence-close.cm-wod-fence-close-empty": {
11433
+ paddingTop: "8px",
11434
+ paddingBottom: "8px"
10947
11435
  },
10948
11436
  ".cm-wod-inner": {
10949
11437
  fontFamily: 'var(--font-mono, "JetBrains Mono", ui-monospace, SFMono-Regular, monospace)',
11438
+ fontSize: "13.5px",
11439
+ lineHeight: "24px",
10950
11440
  fontVariantNumeric: "tabular-nums",
10951
- paddingLeft: "7px",
10952
- paddingRight: "8px",
10953
- backgroundColor: "hsl(var(--card))",
10954
- borderLeft: "1px solid hsl(var(--border))",
10955
- borderRight: "1px solid hsl(var(--border))",
11441
+ paddingLeft: "14px",
11442
+ paddingRight: "14px",
11443
+ backgroundColor: "color-mix(in srgb, hsl(var(--muted)) 48%, hsl(var(--card)) 52%)",
11444
+ borderLeft: "1px solid hsl(var(--border) / 0.9)",
11445
+ borderRight: "1px solid hsl(var(--border) / 0.9)",
10956
11446
  boxSizing: "border-box"
10957
11447
  },
11448
+ "&dark .cm-wod-inner": {
11449
+ backgroundColor: "hsl(var(--muted) / 0.92)"
11450
+ },
11451
+ ".cm-wod-inner.cm-wod-block-time": {
11452
+ borderLeftColor: "color-mix(in srgb, hsl(var(--metric-time)) 24%, hsl(var(--border)))",
11453
+ borderRightColor: "color-mix(in srgb, hsl(var(--metric-time)) 24%, hsl(var(--border)))"
11454
+ },
11455
+ ".cm-wod-inner.cm-wod-block-log": {
11456
+ borderLeftColor: "color-mix(in srgb, hsl(var(--metric-effort)) 24%, hsl(var(--border)))",
11457
+ borderRightColor: "color-mix(in srgb, hsl(var(--metric-effort)) 24%, hsl(var(--border)))"
11458
+ },
11459
+ ".cm-wod-inner-first": {
11460
+ paddingTop: "8px"
11461
+ },
11462
+ ".cm-wod-inner-last": {
11463
+ paddingBottom: "4px"
11464
+ },
11465
+ ".cm-wod-block-active.cm-wod-block-time": {
11466
+ borderLeftColor: "hsl(var(--metric-time) / 0.58)",
11467
+ borderRightColor: "hsl(var(--metric-time) / 0.58)"
11468
+ },
11469
+ ".cm-wod-fence-open.cm-wod-block-active.cm-wod-block-time": {
11470
+ borderTopColor: "hsl(var(--metric-time) / 0.58)"
11471
+ },
11472
+ ".cm-wod-fence-close.cm-wod-block-active.cm-wod-block-time": {
11473
+ borderBottomColor: "hsl(var(--metric-time) / 0.58)"
11474
+ },
11475
+ ".cm-wod-block-active.cm-wod-block-log": {
11476
+ borderLeftColor: "hsl(var(--metric-effort) / 0.58)",
11477
+ borderRightColor: "hsl(var(--metric-effort) / 0.58)"
11478
+ },
11479
+ ".cm-wod-fence-open.cm-wod-block-active.cm-wod-block-log": {
11480
+ borderTopColor: "hsl(var(--metric-effort) / 0.58)"
11481
+ },
11482
+ ".cm-wod-fence-close.cm-wod-block-active.cm-wod-block-log": {
11483
+ borderBottomColor: "hsl(var(--metric-effort) / 0.58)"
11484
+ },
10958
11485
  ".cm-wod-dialect-badge": {
10959
11486
  display: "inline-flex",
10960
11487
  alignItems: "center",
10961
- minHeight: "22px",
11488
+ gap: "5px",
11489
+ height: "22px",
10962
11490
  padding: "0 8px",
10963
- marginLeft: "8px",
11491
+ marginRight: "8px",
10964
11492
  borderRadius: "9999px",
10965
- fontSize: "11.5px",
11493
+ fontSize: "11px",
10966
11494
  fontWeight: "700",
10967
- letterSpacing: "0.04em",
11495
+ letterSpacing: "0.05em",
11496
+ lineHeight: "1",
10968
11497
  fontFamily: 'var(--font-sans, "Geist Sans", system-ui, sans-serif)',
10969
11498
  border: "1px solid transparent",
10970
11499
  cursor: "pointer",
10971
- verticalAlign: "middle"
11500
+ verticalAlign: "middle",
11501
+ transition: "background-color 150ms ease, border-color 150ms ease"
11502
+ },
11503
+ ".cm-wod-dialect-badge::before": {
11504
+ content: '""',
11505
+ width: "6px",
11506
+ height: "6px",
11507
+ borderRadius: "9999px",
11508
+ backgroundColor: "currentColor",
11509
+ opacity: "0.85",
11510
+ flexShrink: "0"
11511
+ },
11512
+ ".cm-wod-dialect-badge:focus-visible": {
11513
+ outline: "2px solid hsl(var(--ring))",
11514
+ outlineOffset: "1px"
10972
11515
  },
10973
11516
  "@media (pointer: coarse)": {
10974
11517
  ".cm-wod-dialect-badge": {
10975
- minHeight: "34px",
11518
+ minHeight: "32px",
10976
11519
  padding: "0 10px"
10977
11520
  }
10978
11521
  },
@@ -10980,44 +11523,66 @@ var scriptBlockBaseTheme = view.EditorView.baseTheme({
10980
11523
  cursor: "default"
10981
11524
  },
10982
11525
  ".cm-wod-dialect-time": {
10983
- backgroundColor: "#E1F3FE",
10984
- color: "#1F6C9F",
10985
- borderColor: "rgba(31, 108, 159, 0.2)"
11526
+ backgroundColor: "color-mix(in srgb, hsl(var(--metric-time)) 12%, hsl(var(--card)))",
11527
+ color: "hsl(var(--secondary-foreground))",
11528
+ borderColor: "hsl(var(--metric-time) / 0.28)"
11529
+ },
11530
+ ".cm-wod-dialect-time:hover:not(:disabled)": {
11531
+ backgroundColor: "color-mix(in srgb, hsl(var(--metric-time)) 18%, hsl(var(--card)))",
11532
+ borderColor: "hsl(var(--metric-time) / 0.45)"
10986
11533
  },
10987
11534
  "&dark .cm-wod-dialect-time": {
10988
11535
  backgroundColor: "hsl(var(--metric-time) / 0.16)",
10989
- color: "hsl(var(--metric-time))",
10990
- borderColor: "hsl(var(--metric-time) / 0.3)"
11536
+ color: "color-mix(in srgb, hsl(var(--metric-time)) 78%, hsl(var(--foreground)))",
11537
+ borderColor: "hsl(var(--metric-time) / 0.34)"
11538
+ },
11539
+ "&dark .cm-wod-dialect-time:hover:not(:disabled)": {
11540
+ backgroundColor: "hsl(var(--metric-time) / 0.24)",
11541
+ borderColor: "hsl(var(--metric-time) / 0.52)"
10991
11542
  },
10992
11543
  ".cm-wod-dialect-log": {
10993
- backgroundColor: "#EDF3EC",
10994
- color: "#346538",
10995
- borderColor: "rgba(52, 101, 56, 0.2)"
11544
+ backgroundColor: "color-mix(in srgb, hsl(var(--metric-effort)) 11%, hsl(var(--card)))",
11545
+ color: "color-mix(in srgb, hsl(var(--metric-effort)) 78%, hsl(var(--foreground)))",
11546
+ borderColor: "hsl(var(--metric-effort) / 0.28)"
11547
+ },
11548
+ ".cm-wod-dialect-log:hover:not(:disabled)": {
11549
+ backgroundColor: "color-mix(in srgb, hsl(var(--metric-effort)) 17%, hsl(var(--card)))",
11550
+ borderColor: "hsl(var(--metric-effort) / 0.45)"
10996
11551
  },
10997
11552
  "&dark .cm-wod-dialect-log": {
10998
11553
  backgroundColor: "hsl(var(--metric-effort) / 0.16)",
10999
- color: "hsl(var(--metric-effort))",
11000
- borderColor: "hsl(var(--metric-effort) / 0.3)"
11554
+ color: "color-mix(in srgb, hsl(var(--metric-effort)) 78%, hsl(var(--foreground)))",
11555
+ borderColor: "hsl(var(--metric-effort) / 0.34)"
11556
+ },
11557
+ "&dark .cm-wod-dialect-log:hover:not(:disabled)": {
11558
+ backgroundColor: "hsl(var(--metric-effort) / 0.24)",
11559
+ borderColor: "hsl(var(--metric-effort) / 0.52)"
11001
11560
  },
11002
11561
  ".cm-wod-exit-block-btn": {
11003
11562
  marginLeft: "10px",
11004
11563
  display: "inline-flex",
11005
11564
  alignItems: "center",
11006
- height: "18px",
11007
- padding: "0 6px",
11008
- borderRadius: "4px",
11009
- fontSize: "10px",
11565
+ height: "20px",
11566
+ padding: "0 7px",
11567
+ borderRadius: "5px",
11568
+ fontSize: "11px",
11010
11569
  fontFamily: 'var(--font-sans, "Geist Sans", system-ui, sans-serif)',
11011
11570
  fontWeight: "500",
11012
11571
  color: "hsl(var(--muted-foreground))",
11013
- backgroundColor: "hsl(var(--muted) / 0.6)",
11014
- border: "1px solid hsl(var(--border))",
11572
+ backgroundColor: "transparent",
11573
+ border: "1px dashed hsl(var(--border))",
11015
11574
  cursor: "pointer",
11016
- verticalAlign: "middle"
11575
+ verticalAlign: "middle",
11576
+ transition: "background-color 150ms ease, color 150ms ease, border-color 150ms ease"
11017
11577
  },
11018
11578
  ".cm-wod-exit-block-btn:hover": {
11019
11579
  color: "hsl(var(--foreground))",
11020
- backgroundColor: "hsl(var(--muted))"
11580
+ backgroundColor: "hsl(var(--card))",
11581
+ borderStyle: "solid"
11582
+ },
11583
+ ".cm-wod-exit-block-btn:focus-visible": {
11584
+ outline: "2px solid hsl(var(--ring))",
11585
+ outlineOffset: "1px"
11021
11586
  }
11022
11587
  });
11023
11588
  var previewDecorations = [
@@ -11077,21 +11642,32 @@ var InlineImageWidget = class extends view.WidgetType {
11077
11642
  img.alt = this.alt || "Embedded image";
11078
11643
  img.loading = "lazy";
11079
11644
  img.className = "cm-image-embed-img";
11645
+ if (this.standalone) {
11646
+ card.classList.add("cm-image-embed-loading");
11647
+ const clearLoading = () => card.classList.remove("cm-image-embed-loading");
11648
+ img.addEventListener("load", clearLoading);
11649
+ img.addEventListener("error", clearLoading);
11650
+ }
11080
11651
  const resolver = view.state.facet(attachmentUrlFacet);
11081
11652
  if (isDirectImageUrl(this.target)) {
11082
11653
  img.src = this.target;
11654
+ if (img.complete) card.classList.remove("cm-image-embed-loading");
11083
11655
  } else if (resolver) {
11084
11656
  Promise.resolve(resolver(this.target)).then((resolved) => {
11085
11657
  if (resolved) {
11086
11658
  img.src = resolved;
11659
+ if (img.complete) card.classList.remove("cm-image-embed-loading");
11087
11660
  } else {
11661
+ card.classList.remove("cm-image-embed-loading");
11088
11662
  card.classList.add("cm-image-embed-missing");
11089
11663
  }
11090
11664
  }).catch(() => {
11665
+ card.classList.remove("cm-image-embed-loading");
11091
11666
  card.classList.add("cm-image-embed-missing");
11092
11667
  });
11093
11668
  } else {
11094
11669
  img.src = this.target;
11670
+ if (img.complete) card.classList.remove("cm-image-embed-loading");
11095
11671
  }
11096
11672
  card.appendChild(img);
11097
11673
  if (this.alt) {
@@ -11198,6 +11774,9 @@ var embedPreviewTheme = view.EditorView.baseTheme({
11198
11774
  backgroundColor: "hsl(var(--card))",
11199
11775
  overflow: "hidden"
11200
11776
  },
11777
+ ".cm-image-embed-block .cm-image-embed-card.cm-image-embed-loading": {
11778
+ minHeight: "160px"
11779
+ },
11201
11780
  ".cm-image-embed-img": {
11202
11781
  display: "block",
11203
11782
  maxWidth: "100%",
@@ -11462,15 +12041,29 @@ function triggerAddOrEditProperty(view, root, _sectionId) {
11462
12041
  patchPropertyInView(view, fm.id, ["property"], "", true);
11463
12042
  }
11464
12043
  var widgetCleanup = /* @__PURE__ */ new WeakMap();
12044
+ var pendingFrontmatterCommit = /* @__PURE__ */ new WeakMap();
11465
12045
  var helperId = 0;
12046
+ function registerFrontmatterCommit(input, commit) {
12047
+ pendingFrontmatterCommit.set(input, commit);
12048
+ }
12049
+ function attachExternalCommitFlush(root) {
12050
+ const onPointerDown = (e) => {
12051
+ const active = document.activeElement;
12052
+ if (!(active instanceof HTMLInputElement) || !root.contains(active)) return;
12053
+ const target = e.target;
12054
+ if (target && (root.contains(target) || target.closest('[role="listbox"]'))) return;
12055
+ const commit = pendingFrontmatterCommit.get(active);
12056
+ if (commit) commit();
12057
+ };
12058
+ document.addEventListener("pointerdown", onPointerDown, true);
12059
+ widgetCleanup.get(root)?.push(() => document.removeEventListener("pointerdown", onPointerDown, true));
12060
+ }
11466
12061
  var TAG_CATEGORY_SUMMARY_KEYS = {
11467
12062
  tag: true,
11468
12063
  tags: true,
11469
12064
  category: true,
11470
12065
  domain: true,
11471
12066
  format: true,
11472
- equipment: true,
11473
- effort: true,
11474
12067
  quality: true,
11475
12068
  intent: true,
11476
12069
  discipline: true,
@@ -11704,6 +12297,9 @@ function createTagDraftRow(view, root, key, onCommit) {
11704
12297
  const commit = () => settle(true);
11705
12298
  const discard = () => settle(false);
11706
12299
  attachSuggestions(input, view, root, "value", key, [], commit);
12300
+ registerFrontmatterCommit(input, () => {
12301
+ if (input.isConnected && input.value.trim()) commit();
12302
+ });
11707
12303
  input.addEventListener("keydown", (e) => {
11708
12304
  if (e.isComposing || e.keyCode === 229) return;
11709
12305
  if (e.key === "Escape") {
@@ -12087,38 +12683,91 @@ function createFrontmatterSummary(entries, onShowDetails, docKind, referenceProv
12087
12683
  const summary = document.createElement("div");
12088
12684
  summary.dataset.frontmatterSummary = "true";
12089
12685
  summary.className = "divide-y divide-border/60";
12090
- const groups = [
12091
- { label: "Tags", entries: entries.filter(([key]) => TAG_CATEGORY_SUMMARY_KEYS[key.trim().toLowerCase()]), hash: true },
12092
- { label: "Aliases", entries: entries.filter(([key]) => isAliasProperty(key)), hash: false }
12093
- ];
12094
- for (const group of groups) {
12095
- const seen = /* @__PURE__ */ new Set();
12096
- const values2 = group.entries.flatMap(([, value]) => parseTagList(value)).filter((val) => {
12097
- const lower = val.toLowerCase();
12098
- if (seen.has(lower)) return false;
12099
- seen.add(lower);
12100
- return true;
12101
- });
12102
- if (values2.length === 0) continue;
12686
+ const appendSummaryGroupRow = (labelText, items) => {
12687
+ if (items.length === 0) return;
12103
12688
  const row = document.createElement("div");
12104
12689
  row.className = "flex flex-wrap items-center gap-1.5 px-3 py-2";
12105
12690
  const label = document.createElement("span");
12106
- label.className = "mr-1 w-14 shrink-0 text-[11px] font-medium text-muted-foreground";
12107
- label.textContent = group.label;
12691
+ label.className = "mr-1 w-16 shrink-0 text-[11px] font-medium text-muted-foreground";
12692
+ label.textContent = labelText;
12108
12693
  row.appendChild(label);
12109
- for (const value of values2) {
12694
+ for (const item of items) {
12695
+ row.appendChild(createSummaryPill(item.text, item.hash, item.href));
12696
+ }
12697
+ summary.appendChild(row);
12698
+ };
12699
+ const seenTags = /* @__PURE__ */ new Set();
12700
+ const tagItems = [];
12701
+ for (const [key, value] of entries) {
12702
+ const normKey = key.trim().toLowerCase();
12703
+ if (!TAG_CATEGORY_SUMMARY_KEYS[normKey]) continue;
12704
+ for (const val of parseTagList(value)) {
12705
+ const lower = val.toLowerCase();
12706
+ if (seenTags.has(lower)) continue;
12707
+ seenTags.add(lower);
12708
+ tagItems.push({
12709
+ text: val,
12710
+ hash: true,
12711
+ href: referenceProvider?.openHref("tag", val, normKey)
12712
+ });
12713
+ }
12714
+ }
12715
+ appendSummaryGroupRow("Tags", tagItems);
12716
+ const seenEquip = /* @__PURE__ */ new Set();
12717
+ const equipItems = [];
12718
+ for (const [key, value] of entries) {
12719
+ if (key.trim().toLowerCase() !== "equipment") continue;
12720
+ for (const val of parseTagList(value)) {
12721
+ const lower = val.toLowerCase();
12722
+ if (seenEquip.has(lower)) continue;
12723
+ seenEquip.add(lower);
12724
+ const match = referenceProvider?.resolveEquipment(val) ?? null;
12725
+ equipItems.push({
12726
+ text: match ? match.label : val,
12727
+ hash: false,
12728
+ href: match && referenceProvider ? referenceProvider.openHref("equipment", match.slug) : void 0
12729
+ });
12730
+ }
12731
+ }
12732
+ appendSummaryGroupRow("Equipment", equipItems);
12733
+ const seenEffort = /* @__PURE__ */ new Set();
12734
+ const effortItems = [];
12735
+ for (const [key, value] of entries) {
12736
+ if (key.trim().toLowerCase() !== "effort") continue;
12737
+ for (const val of parseTagList(value)) {
12738
+ const lower = val.toLowerCase();
12739
+ if (seenEffort.has(lower)) continue;
12740
+ seenEffort.add(lower);
12741
+ const match = referenceProvider?.resolveEffort(val) ?? null;
12742
+ effortItems.push({
12743
+ text: match ? match.label : val,
12744
+ hash: false,
12745
+ href: match && referenceProvider ? referenceProvider.openHref("effort", match.slug) : void 0
12746
+ });
12747
+ }
12748
+ }
12749
+ appendSummaryGroupRow("Effort", effortItems);
12750
+ const seenAliases = /* @__PURE__ */ new Set();
12751
+ const aliasItems = [];
12752
+ for (const [key, value] of entries) {
12753
+ if (!isAliasProperty(key)) continue;
12754
+ for (const val of parseTagList(value)) {
12755
+ const lower = val.toLowerCase();
12756
+ if (seenAliases.has(lower)) continue;
12757
+ seenAliases.add(lower);
12110
12758
  let href;
12111
- if (group.label === "Aliases" && referenceProvider && (docKind === "effort" || docKind === "equipment")) {
12112
- const match = docKind === "effort" ? referenceProvider.resolveEffort(value) : referenceProvider.resolveEquipment(value);
12113
- if (match) {
12114
- href = referenceProvider.openHref(docKind, match.slug);
12115
- }
12759
+ if (referenceProvider && (docKind === "effort" || docKind === "equipment")) {
12760
+ const match = docKind === "effort" ? referenceProvider.resolveEffort(val) : referenceProvider.resolveEquipment(val);
12761
+ if (match) href = referenceProvider.openHref(docKind, match.slug);
12116
12762
  }
12117
- row.appendChild(createSummaryPill(value, group.hash, href));
12763
+ aliasItems.push({ text: val, hash: false, href });
12118
12764
  }
12119
- summary.appendChild(row);
12120
12765
  }
12121
- const hidden = entries.filter(([key]) => !TAG_CATEGORY_SUMMARY_KEYS[key.trim().toLowerCase()] && !isAliasProperty(key));
12766
+ appendSummaryGroupRow("Aliases", aliasItems);
12767
+ const hidden = entries.filter(([key]) => {
12768
+ const k = key.trim().toLowerCase();
12769
+ return !TAG_CATEGORY_SUMMARY_KEYS[k] && k !== "equipment" && k !== "effort" && !isAliasProperty(key);
12770
+ });
12122
12771
  const metricCount = hidden.filter(([key]) => {
12123
12772
  const k = key.trim().toLowerCase();
12124
12773
  return k.startsWith("metrics.") || k === "metrics";
@@ -12177,7 +12826,31 @@ var DefaultFrontmatterWidget = class extends view.WidgetType {
12177
12826
  toDOM(view) {
12178
12827
  const root = document.createElement("div");
12179
12828
  widgetCleanup.set(root, []);
12829
+ attachExternalCommitFlush(root);
12180
12830
  root.className = "cm-frontmatter-preview py-2 font-sans select-none";
12831
+ if (!this.readOnly) {
12832
+ root.addEventListener("click", (event) => {
12833
+ const target = event.target;
12834
+ if (target?.closest(
12835
+ 'button, input, textarea, select, a, label, [role="button"], [role="combobox"], [role="option"], [contenteditable="true"]'
12836
+ )) {
12837
+ return;
12838
+ }
12839
+ view.dispatch({ selection: { anchor: view.state.doc.length } });
12840
+ view.focus();
12841
+ });
12842
+ root.addEventListener("keydown", (event) => {
12843
+ if ((event.ctrlKey || event.metaKey) && (event.key === "End" || event.key === "ArrowDown")) {
12844
+ event.preventDefault();
12845
+ event.stopPropagation();
12846
+ view.dispatch({
12847
+ selection: { anchor: view.state.doc.length },
12848
+ scrollIntoView: true
12849
+ });
12850
+ view.focus();
12851
+ }
12852
+ });
12853
+ }
12181
12854
  const heading = document.createElement("div");
12182
12855
  heading.className = "mb-1.5 flex items-center px-0.5 text-xs font-medium text-muted-foreground";
12183
12856
  const headingLabel = document.createElement("span");
@@ -12193,6 +12866,7 @@ var DefaultFrontmatterWidget = class extends view.WidgetType {
12193
12866
  summaryButton.addEventListener("click", () => {
12194
12867
  persistedDetailed.set(view.dom, false);
12195
12868
  view.dispatch({ effects: setFrontmatterDetailed.of(false) });
12869
+ view.dom.querySelector('[aria-label="Show property details"]')?.focus();
12196
12870
  });
12197
12871
  heading.appendChild(summaryButton);
12198
12872
  }
@@ -12211,6 +12885,7 @@ var DefaultFrontmatterWidget = class extends view.WidgetType {
12211
12885
  box.appendChild(createFrontmatterSummary(entries, () => {
12212
12886
  persistedDetailed.set(view.dom, true);
12213
12887
  view.dispatch({ effects: setFrontmatterDetailed.of(true) });
12888
+ view.dom.querySelector('[aria-label="Show property summary"]')?.focus();
12214
12889
  }, docKind, referenceProvider));
12215
12890
  } else {
12216
12891
  box.appendChild(createColumnHeader());
@@ -12284,6 +12959,9 @@ var DefaultFrontmatterWidget = class extends view.WidgetType {
12284
12959
  keyInput.addEventListener("change", commitKeyIfAttached);
12285
12960
  keyCol.appendChild(keyInput);
12286
12961
  attachSuggestions(keyInput, view, root, "key", key, entries.map(([name]) => name), commitKey);
12962
+ registerFrontmatterCommit(keyInput, () => {
12963
+ if (keyInput.isConnected) commitKey();
12964
+ });
12287
12965
  keyInput.addEventListener("blur", commitKeyIfAttached);
12288
12966
  keyInput.addEventListener("keydown", (e) => {
12289
12967
  if ((e.metaKey || e.ctrlKey) && e.key === ";") {
@@ -12424,6 +13102,9 @@ var DefaultFrontmatterWidget = class extends view.WidgetType {
12424
13102
  };
12425
13103
  valCol.appendChild(chipInput);
12426
13104
  attachSuggestions(chipInput, view, root, "value", key, chips, commitNewChip, valueKind);
13105
+ registerFrontmatterCommit(chipInput, () => {
13106
+ if (chipInput.isConnected && chipInput.value.trim()) commitNewChip();
13107
+ });
12427
13108
  chipInput.addEventListener("keydown", (e) => {
12428
13109
  if ((e.metaKey || e.ctrlKey) && e.key === ";") {
12429
13110
  e.preventDefault();
@@ -12585,6 +13266,9 @@ var DefaultFrontmatterWidget = class extends view.WidgetType {
12585
13266
  commitVal,
12586
13267
  key.trim().toLowerCase() === "metrics.effort" ? "effort" : "tags"
12587
13268
  );
13269
+ registerFrontmatterCommit(valInput, () => {
13270
+ if (valInput.isConnected) commitVal();
13271
+ });
12588
13272
  valInput.addEventListener("blur", commitValIfAttached);
12589
13273
  valInput.addEventListener("keydown", (e) => {
12590
13274
  if ((e.metaKey || e.ctrlKey) && e.key === ";") {
@@ -12916,6 +13600,27 @@ var EmptyFrontmatterWidget = class extends view.WidgetType {
12916
13600
  toDOM(view) {
12917
13601
  const root = document.createElement("div");
12918
13602
  root.className = "cm-frontmatter-preview py-2 font-sans select-none";
13603
+ root.addEventListener("click", (event) => {
13604
+ const target = event.target;
13605
+ if (target?.closest(
13606
+ 'button, input, textarea, select, a, label, [role="button"], [role="combobox"], [role="option"], [contenteditable="true"]'
13607
+ )) {
13608
+ return;
13609
+ }
13610
+ view.dispatch({ selection: { anchor: view.state.doc.length } });
13611
+ view.focus();
13612
+ });
13613
+ root.addEventListener("keydown", (event) => {
13614
+ if ((event.ctrlKey || event.metaKey) && (event.key === "End" || event.key === "ArrowDown")) {
13615
+ event.preventDefault();
13616
+ event.stopPropagation();
13617
+ view.dispatch({
13618
+ selection: { anchor: view.state.doc.length },
13619
+ scrollIntoView: true
13620
+ });
13621
+ view.focus();
13622
+ }
13623
+ });
12919
13624
  const heading = document.createElement("div");
12920
13625
  heading.className = "text-xs font-medium text-muted-foreground mb-1.5 px-0.5";
12921
13626
  heading.textContent = "Properties";
@@ -13088,7 +13793,18 @@ var frontmatterPreviewField = state.StateField.define({
13088
13793
  return buildFrontmatterDecos(state);
13089
13794
  },
13090
13795
  update(deco, tr) {
13091
- if (tr.docChanged || tr.reconfigured || tr.selection || tr.effects.some((e) => e.is(referenceIndexReload) || e.is(setFrontmatterDetailed) || e.is(setFrontmatterSource))) {
13796
+ if (tr.reconfigured || tr.effects.some((e) => e.is(referenceIndexReload) || e.is(setFrontmatterDetailed) || e.is(setFrontmatterSource)) || tr.startState.field(frontmatterDetailed, false) !== tr.state.field(frontmatterDetailed, false) || tr.startState.field(frontmatterSource, false) !== tr.state.field(frontmatterSource, false) || tr.startState.readOnly !== tr.state.readOnly || tr.startState.facet(frontmatterVisibility) !== tr.state.facet(frontmatterVisibility) || tr.startState.facet(frontmatterDebugMode) !== tr.state.facet(frontmatterDebugMode)) {
13797
+ return buildFrontmatterDecos(tr.state);
13798
+ }
13799
+ if (tr.docChanged) {
13800
+ const prevFm = tr.startState.field(sectionField, false)?.sections.find((s) => s.type === "frontmatter");
13801
+ const nextFm = tr.state.field(sectionField, false)?.sections.find((s) => s.type === "frontmatter");
13802
+ if (prevFm && nextFm && prevFm.id === nextFm.id && prevFm.from === nextFm.from && prevFm.to === nextFm.to && !tr.changes.touchesRange(0, prevFm.to)) {
13803
+ return deco;
13804
+ }
13805
+ if (!prevFm && !nextFm && !tr.changes.touchesRange(0, 0)) {
13806
+ return deco;
13807
+ }
13092
13808
  return buildFrontmatterDecos(tr.state);
13093
13809
  }
13094
13810
  return deco;
@@ -13214,7 +13930,7 @@ var TaskCheckboxWidget = class extends view.WidgetType {
13214
13930
  checked;
13215
13931
  bracketPos;
13216
13932
  eq(other) {
13217
- return this.checked === other.checked && this.bracketPos === other.bracketPos;
13933
+ return this.checked === other.checked;
13218
13934
  }
13219
13935
  toDOM(view) {
13220
13936
  const btn = document.createElement("button");
@@ -13242,13 +13958,29 @@ var TaskCheckboxWidget = class extends view.WidgetType {
13242
13958
  event.preventDefault();
13243
13959
  event.stopPropagation();
13244
13960
  if (view.state.readOnly) return;
13245
- const charAtPos = view.state.doc.sliceString(this.bracketPos + 1, this.bracketPos + 2);
13961
+ let bracketPos = this.bracketPos;
13962
+ try {
13963
+ if (view.dom.contains(btn)) {
13964
+ const domPos = Math.max(0, Math.min(view.posAtDOM(btn), view.state.doc.length));
13965
+ const line = view.state.doc.lineAt(domPos);
13966
+ const match = TASK_RE.exec(line.text);
13967
+ if (match) {
13968
+ const bracketIdx = line.text.indexOf("[", match[1].length + match[2].length);
13969
+ if (bracketIdx >= 0) {
13970
+ bracketPos = line.from + bracketIdx;
13971
+ }
13972
+ }
13973
+ }
13974
+ } catch {
13975
+ }
13976
+ if (bracketPos < 0 || bracketPos + 2 > view.state.doc.length) return;
13977
+ const charAtPos = view.state.doc.sliceString(bracketPos + 1, bracketPos + 2);
13246
13978
  if (charAtPos !== " " && charAtPos !== "x" && charAtPos !== "X") return;
13247
13979
  const nextChar = this.checked ? " " : "x";
13248
13980
  view.dispatch({
13249
13981
  changes: {
13250
- from: this.bracketPos + 1,
13251
- to: this.bracketPos + 2,
13982
+ from: bracketPos + 1,
13983
+ to: bracketPos + 2,
13252
13984
  insert: nextChar
13253
13985
  },
13254
13986
  userEvent: "input.toggle"
@@ -13642,7 +14374,7 @@ function appendFormattedCellContent(container, rawText, view) {
13642
14374
  container.appendChild(document.createTextNode(rawText.slice(lastIndex)));
13643
14375
  }
13644
14376
  }
13645
- var MarkdownTableWidget = class extends view.WidgetType {
14377
+ var MarkdownTableWidget = class _MarkdownTableWidget extends view.WidgetType {
13646
14378
  constructor(head, rows, from, to, readOnly) {
13647
14379
  super();
13648
14380
  this.head = head;
@@ -13657,7 +14389,7 @@ var MarkdownTableWidget = class extends view.WidgetType {
13657
14389
  to;
13658
14390
  readOnly;
13659
14391
  eq(other) {
13660
- if (this.readOnly !== other.readOnly || this.from !== other.from || this.to !== other.to || this.head.length !== other.head.length || this.rows.length !== other.rows.length) {
14392
+ if (this.readOnly !== other.readOnly || this.head.length !== other.head.length || this.rows.length !== other.rows.length) {
13661
14393
  return false;
13662
14394
  }
13663
14395
  if (!this.head.every((h, i) => h === other.head[i])) return false;
@@ -13679,21 +14411,50 @@ var MarkdownTableWidget = class extends view.WidgetType {
13679
14411
  const mutableRows = this.rows.map(
13680
14412
  (row) => Array.from({ length: colCount }, (_, i) => row[i] ?? "")
13681
14413
  );
14414
+ const resolveLiveRange = () => {
14415
+ const field = view.state.field(tablePreviewField, false);
14416
+ if (field && view.dom.contains(outer)) {
14417
+ try {
14418
+ const domPos = view.posAtDOM(outer);
14419
+ const searchFrom = Math.max(0, domPos - 1);
14420
+ const searchTo = Math.min(view.state.doc.length, domPos + 1);
14421
+ let found = null;
14422
+ field.between(searchFrom, searchTo, (from, to, value) => {
14423
+ const widget = value.spec?.widget;
14424
+ if (widget instanceof _MarkdownTableWidget) {
14425
+ found = { from, to };
14426
+ return false;
14427
+ }
14428
+ });
14429
+ if (found) return found;
14430
+ } catch {
14431
+ }
14432
+ }
14433
+ return {
14434
+ from: Math.max(0, Math.min(this.from, view.state.doc.length)),
14435
+ to: Math.max(0, Math.min(this.to, view.state.doc.length))
14436
+ };
14437
+ };
13682
14438
  const commitTable = (nextHead, nextRows, focusAfter) => {
13683
14439
  if (view.state.readOnly) return;
14440
+ const { from: liveFrom, to: liveTo } = resolveLiveRange();
13684
14441
  const serialized = serializeMarkdownTable(nextHead, nextRows);
13685
- const safeSelection = this.to < view.state.doc.length ? Math.min(view.state.doc.length, this.from + serialized.length + 1) : Math.max(0, this.from - 1);
14442
+ const safeSelection = liveTo < view.state.doc.length ? Math.min(view.state.doc.length, liveFrom + serialized.length + 1) : Math.max(0, liveFrom - 1);
13686
14443
  const currentCursor = view.state.selection.main.head;
13687
- const nextCursor = currentCursor >= this.from && currentCursor <= this.to ? safeSelection : currentCursor > this.to ? currentCursor + (serialized.length - (this.to - this.from)) : currentCursor;
14444
+ const nextCursor = currentCursor >= liveFrom && currentCursor <= liveTo ? safeSelection : currentCursor > liveTo ? currentCursor + (serialized.length - (liveTo - liveFrom)) : currentCursor;
14445
+ wrap.dataset.tableFrom = String(liveFrom);
13688
14446
  view.dispatch({
13689
- changes: { from: this.from, to: this.to, insert: serialized },
13690
- selection: { anchor: Math.max(0, Math.min(nextCursor, view.state.doc.length + serialized.length - (this.to - this.from))) },
14447
+ changes: { from: liveFrom, to: liveTo, insert: serialized },
14448
+ selection: { anchor: Math.max(0, Math.min(nextCursor, view.state.doc.length + serialized.length - (liveTo - liveFrom))) },
13691
14449
  userEvent: "input.table"
13692
14450
  });
13693
14451
  if (focusAfter) {
13694
14452
  requestAnimationFrame(() => {
13695
- const targetCell = view.dom.querySelector(
13696
- `[data-table-from="${this.from}"] [data-cell-coord="${focusAfter.row}:${focusAfter.col}"]`
14453
+ const rootScope = outer.isConnected ? outer : view.dom;
14454
+ const targetCell = outer.isConnected ? rootScope.querySelector(
14455
+ `[data-cell-coord="${focusAfter.row}:${focusAfter.col}"]`
14456
+ ) : rootScope.querySelector(
14457
+ `[data-table-from="${liveFrom}"] [data-cell-coord="${focusAfter.row}:${focusAfter.col}"]`
13697
14458
  );
13698
14459
  targetCell?.click();
13699
14460
  });
@@ -13883,7 +14644,8 @@ var MarkdownTableWidget = class extends view.WidgetType {
13883
14644
  })
13884
14645
  );
13885
14646
  const sourceBtn = makeBtn("Source", "Edit raw Markdown table", () => {
13886
- view.dispatch({ selection: { anchor: this.from } });
14647
+ const { from: liveFrom } = resolveLiveRange();
14648
+ view.dispatch({ selection: { anchor: liveFrom } });
13887
14649
  view.focus();
13888
14650
  });
13889
14651
  sourceBtn.style.marginLeft = "auto";
@@ -14166,7 +14928,7 @@ function openLinkEditPopover(anchorEl, view, match) {
14166
14928
  labelInput.focus();
14167
14929
  labelInput.select();
14168
14930
  }
14169
- var LinkPillWidget = class extends view.WidgetType {
14931
+ var LinkPillWidget = class _LinkPillWidget extends view.WidgetType {
14170
14932
  constructor(label, url, from, to, readOnly, affiliateTag) {
14171
14933
  super();
14172
14934
  this.label = label;
@@ -14183,7 +14945,31 @@ var LinkPillWidget = class extends view.WidgetType {
14183
14945
  readOnly;
14184
14946
  affiliateTag;
14185
14947
  eq(other) {
14186
- return this.label === other.label && this.url === other.url && this.from === other.from && this.to === other.to && this.readOnly === other.readOnly && this.affiliateTag === other.affiliateTag;
14948
+ return this.label === other.label && this.url === other.url && this.readOnly === other.readOnly && this.affiliateTag === other.affiliateTag;
14949
+ }
14950
+ resolveLiveRange(pill, view) {
14951
+ const field = view.state.field(linkPreviewField, false);
14952
+ if (field && view.dom.contains(pill)) {
14953
+ try {
14954
+ const domPos = view.posAtDOM(pill);
14955
+ const searchFrom = Math.max(0, domPos - 1);
14956
+ const searchTo = Math.min(view.state.doc.length, domPos + 1);
14957
+ let found = null;
14958
+ field.between(searchFrom, searchTo, (from, to, value) => {
14959
+ const widget = value.spec?.widget;
14960
+ if (widget instanceof _LinkPillWidget && widget.label === this.label && widget.url === this.url) {
14961
+ found = { from, to };
14962
+ return false;
14963
+ }
14964
+ });
14965
+ if (found) return found;
14966
+ } catch {
14967
+ }
14968
+ }
14969
+ return {
14970
+ from: Math.max(0, Math.min(this.from, view.state.doc.length)),
14971
+ to: Math.max(0, Math.min(this.to, view.state.doc.length))
14972
+ };
14187
14973
  }
14188
14974
  toDOM(view) {
14189
14975
  const isExternal = isExternalHttpUrl(this.url);
@@ -14201,9 +14987,10 @@ var LinkPillWidget = class extends view.WidgetType {
14201
14987
  label.addEventListener("click", (e) => {
14202
14988
  e.preventDefault();
14203
14989
  e.stopPropagation();
14990
+ const range = this.resolveLiveRange(pill, view);
14204
14991
  openLinkEditPopover(pill, view, {
14205
- from: this.from,
14206
- to: this.to,
14992
+ from: range.from,
14993
+ to: range.to,
14207
14994
  label: this.label,
14208
14995
  url: this.url
14209
14996
  });
@@ -15561,6 +16348,21 @@ var ReactWidgetBlock = class extends view.WidgetType {
15561
16348
  );
15562
16349
  return wrapper;
15563
16350
  }
16351
+ updateDOM(dom, view) {
16352
+ const root = getOrCreateRoot2(dom);
16353
+ this.container = dom;
16354
+ this.root = root;
16355
+ root.render(
16356
+ React2__namespace.createElement(WidgetBlockPreviewWrapper, {
16357
+ widgetName: this.widgetName,
16358
+ rawContent: this.rawContent,
16359
+ sectionId: this.sectionId,
16360
+ registry: this.registry,
16361
+ view
16362
+ })
16363
+ );
16364
+ return true;
16365
+ }
15564
16366
  destroy(dom) {
15565
16367
  const targetDom = dom ?? this.container;
15566
16368
  const r = this.root;
@@ -15671,22 +16473,31 @@ var widgetNavKeymap = state.Prec.high(view.keymap.of([
15671
16473
  { key: "ArrowDown", run: skipWidgetDown },
15672
16474
  { key: "ArrowUp", run: skipWidgetUp }
15673
16475
  ]));
16476
+ var widgetRegistryFacet = state.Facet.define({
16477
+ combine: (values2) => values2[values2.length - 1] ?? /* @__PURE__ */ new Map()
16478
+ });
16479
+ var widgetPreviewField = state.StateField.define({
16480
+ create(state) {
16481
+ return buildWidgetDecos(state, state.facet(widgetRegistryFacet));
16482
+ },
16483
+ update(value, tr) {
16484
+ const hasToggle = tr.effects.some((e) => e.is(toggleWidgetEdit));
16485
+ const selectionChanged = !tr.startState.selection.eq(tr.newSelection);
16486
+ const registryChanged = tr.startState.facet(widgetRegistryFacet) !== tr.state.facet(widgetRegistryFacet);
16487
+ if (tr.docChanged || hasToggle || selectionChanged || registryChanged) {
16488
+ return buildWidgetDecos(tr.state, tr.state.facet(widgetRegistryFacet));
16489
+ }
16490
+ return value;
16491
+ },
16492
+ provide: (f) => view.EditorView.decorations.from(f)
16493
+ });
15674
16494
  function widgetBlockPreview(registry) {
15675
- const widgetPreviewField = state.StateField.define({
15676
- create(state) {
15677
- return buildWidgetDecos(state, registry);
15678
- },
15679
- update(value, tr) {
15680
- const hasToggle = tr.effects.some((e) => e.is(toggleWidgetEdit));
15681
- const selectionChanged = !tr.startState.selection.eq(tr.newSelection);
15682
- if (tr.docChanged || hasToggle || selectionChanged) {
15683
- return buildWidgetDecos(tr.state, registry);
15684
- }
15685
- return value;
15686
- },
15687
- provide: (f) => view.EditorView.decorations.from(f)
15688
- });
15689
- return [widgetPreviewField, editingWidgetsField, widgetNavKeymap];
16495
+ return [
16496
+ widgetRegistryFacet.of(registry),
16497
+ widgetPreviewField,
16498
+ editingWidgetsField,
16499
+ widgetNavKeymap
16500
+ ];
15690
16501
  }
15691
16502
  var CompositeBlock = class _CompositeBlock {
15692
16503
  static create(type, value, from, parentHash, end) {
@@ -19210,7 +20021,7 @@ var operatorToken = new lr.ExternalTokenizer((input, stack) => {
19210
20021
  function identifierChar(ch, start) {
19211
20022
  return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch == 95 || ch >= 192 || !start && ch >= 48 && ch <= 57;
19212
20023
  }
19213
- var jsx32 = new lr.ExternalTokenizer((input, stack) => {
20024
+ var jsx33 = new lr.ExternalTokenizer((input, stack) => {
19214
20025
  if (input.next != lt || !stack.dialectEnabled(Dialect_jsx)) return;
19215
20026
  input.advance();
19216
20027
  if (input.next == slash2) return;
@@ -19322,7 +20133,7 @@ var parser4 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R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~", 141, 340), new lr.LocalTokenGroup("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~", 25, 323)],
20136
+ tokenizers: [noSemicolon, noSemicolonType, operatorToken, jsx33, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, insertSemicolon, new lr.LocalTokenGroup("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~", 141, 340), new lr.LocalTokenGroup("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~", 25, 323)],
19326
20137
  topRules: { "Script": [0, 7], "SingleExpression": [1, 276], "SingleClassItem": [2, 277] },
19327
20138
  dialects: { jsx: 0, ts: 15175 },
19328
20139
  dynamicPrecedences: { "80": 1, "82": 1, "94": 1, "169": 1, "199": 1 },
@@ -20851,6 +21662,8 @@ function editorPreset(optionsOrDialect = "markdown") {
20851
21662
  addToOptions: [wodCompletionIconOption]
20852
21663
  }),
20853
21664
  wodCompletionKeymap,
21665
+ wodIndentKeymap,
21666
+ wodBackspaceCompletion,
20854
21667
  wodLinter
20855
21668
  );
20856
21669
  } else {
@@ -20863,6 +21676,7 @@ function editorPreset(optionsOrDialect = "markdown") {
20863
21676
  ...whiteboardScriptCompletion ? { whiteboardScript: whiteboardScriptCompletion } : {}
20864
21677
  };
20865
21678
  extensions.push(
21679
+ wodIndentKeymap,
20866
21680
  markdown({ codeLanguages: resolveCodeLanguage }),
20867
21681
  editorFocusTracker,
20868
21682
  sectionField,
@@ -20937,10 +21751,12 @@ exports.handleFenceAutoWrap = handleFenceAutoWrap;
20937
21751
  exports.handleSmartUrlPaste = handleSmartUrlPaste;
20938
21752
  exports.inlineButtonDecoration = inlineButtonDecoration;
20939
21753
  exports.insertMarkdownLinkCommand = insertMarkdownLinkCommand;
21754
+ exports.insertWhiteboardNewline = insertWhiteboardNewline;
20940
21755
  exports.isAmazonRetailHost = isAmazonRetailHost;
20941
21756
  exports.isEditorFocused = isEditorFocused;
20942
21757
  exports.isInternalFrontmatterKey = isInternalFrontmatterKey;
20943
21758
  exports.isNavigableUrl = isNavigableUrl;
21759
+ exports.isWhiteboardScriptBody = isWhiteboardScriptBody;
20944
21760
  exports.lineIdsExtension = lineIdsExtension;
20945
21761
  exports.linkOpen = linkOpen;
20946
21762
  exports.linkPreview = linkPreview;
@@ -20974,6 +21790,7 @@ exports.setFrontmatterDetailed = setFrontmatterDetailed;
20974
21790
  exports.setFrontmatterSource = setFrontmatterSource;
20975
21791
  exports.setGutterHighlights = setGutterHighlights;
20976
21792
  exports.setQuerySourceEditing = setQuerySourceEditing;
21793
+ exports.shouldTriggerBackspaceCompletion = shouldTriggerBackspaceCompletion;
20977
21794
  exports.slashBlockCompletion = slashBlockCompletion;
20978
21795
  exports.smartIncrement = smartIncrement;
20979
21796
  exports.toggleInlineMarkdown = toggleInlineMarkdown;
@@ -20982,10 +21799,12 @@ exports.urlAtPos = urlAtPos;
20982
21799
  exports.widgetBlockPreview = widgetBlockPreview;
20983
21800
  exports.wodAutoWrap = wodAutoWrap;
20984
21801
  exports.wodAutocompletion = wodAutocompletion;
21802
+ exports.wodBackspaceCompletion = wodBackspaceCompletion;
20985
21803
  exports.wodCompletionIconOption = wodCompletionIconOption;
20986
21804
  exports.wodCompletionKeymap = wodCompletionKeymap;
20987
21805
  exports.wodCompletionSource = wodCompletionSource;
20988
21806
  exports.wodEditorKeymap = wodEditorKeymap;
21807
+ exports.wodIndentKeymap = wodIndentKeymap;
20989
21808
  exports.wodLinter = wodLinter;
20990
21809
  exports.wodOverlayPanel = wodOverlayPanel;
20991
21810
  exports.workoutLintSource = workoutLintSource;