@bitcobblers/wod-wiki-ui 0.59.2246 → 0.60.2248

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.
@@ -1,3 +1,4 @@
1
+ import { cn, Button } from './chunk-U2OQIGSB.mjs';
1
2
  import { ViewPlugin, Decoration, hoverTooltip, EditorView, keymap, gutter, WidgetType, GutterMarker, lineNumbers, highlightActiveLineGutter, highlightSpecialChars, drawSelection, dropCursor, highlightActiveLine, placeholder } from '@codemirror/view';
2
3
  import { HighlightStyle, syntaxTree, sublanguageProp, LRLanguage, indentNodeProp, flatIndent, continuedIndent, delimitedIndent, foldNodeProp, foldInside, defineLanguageFacet, syntaxHighlighting, LanguageSupport, indentUnit, foldService, Language, bracketMatchingHandle, languageDataProp, LanguageDescription, ParseContext } from '@codemirror/language';
3
4
  import { tags, styleTags, Tag as Tag$1 } from '@lezer/highlight';
@@ -12,19 +13,18 @@ export { CONTENT_GROUPING_DIMENSIONS } from '@bitcobblers/wod-wiki-wql';
12
13
  import { snippet, autocompletion, CompletionContext, closeBrackets, closeBracketsKeymap, completionStatus, startCompletion, moveCompletionSelection, setSelectedCompletion, currentCompletions, acceptCompletion, closeCompletion, ifNotIn, completeFromList, snippetCompletion } from '@codemirror/autocomplete';
13
14
  import { createRoot } from 'react-dom/client';
14
15
  import * as React2 from 'react';
15
- import React2__default, { createElement, useState, useEffect, useMemo, useCallback, useId, useRef, useSyncExternalStore } from 'react';
16
+ import React2__default, { createElement, useState, useEffect, useMemo, useCallback, useRef, useSyncExternalStore, useId } from 'react';
16
17
  import { Tag, ListFilter, ChartNoAxesCombined, Search, Trophy, X, AlertTriangle, CheckCircle2, AlertCircle, ChartBar, Edit3, ArrowUp, ArrowDown, Check } from 'lucide-react';
17
- import { clsx } from 'clsx';
18
- import { twMerge } from 'tailwind-merge';
19
18
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
20
19
  import { ResponsiveContainer, LineChart, CartesianGrid, XAxis, YAxis, Tooltip, Legend, Line, BarChart, Bar, Cell, PieChart, Pie } from 'recharts';
21
- import { createPortal } from 'react-dom';
20
+ import { Dialog, DialogBackdrop, DialogContent, DialogTitle, DialogDescription, DialogClose } from '@ui-sdk/react/dialog';
22
21
  import { renderToStaticMarkup } from 'react-dom/server';
22
+ import { Field, FieldLabel } from '@ui-sdk/react/field';
23
+ import { Input } from '@ui-sdk/react/input';
23
24
  import { PencilSquareIcon, CheckIcon, ArrowUturnLeftIcon } from '@heroicons/react/20/solid';
24
25
  import { NodeType, NodeProp, NodeSet, Parser, Tree, parseMixed, NodeWeakMap, IterMode } from '@lezer/common';
25
26
  import { ContextTracker, ExternalTokenizer, LRParser, LocalTokenGroup } from '@lezer/lr';
26
27
 
27
- // src/extensions/theme.ts
28
28
  var chalky = "#e5c07b";
29
29
  var coral = "#e06c75";
30
30
  var cyan = "#56b6c2";
@@ -2566,16 +2566,25 @@ function createCloseIcon(size = "md") {
2566
2566
  function isAliasProperty(key) {
2567
2567
  return ["alias", "aliases"].includes(key.trim().toLowerCase());
2568
2568
  }
2569
- function createSummaryPill(value, hash2) {
2569
+ function createSummaryPill(value, hash2, href) {
2570
2570
  const pill = document.createElement("span");
2571
2571
  pill.className = "inline-flex max-w-full items-center rounded-md border border-border/60 bg-muted/40 px-2 py-0.5 text-xs text-foreground";
2572
2572
  const label = document.createElement("span");
2573
2573
  label.className = "truncate";
2574
- label.textContent = hash2 ? `#${value}` : value;
2574
+ const text = hash2 ? `#${value}` : value;
2575
+ if (href) {
2576
+ const link = document.createElement("a");
2577
+ link.href = href;
2578
+ link.textContent = text;
2579
+ link.className = "hover:underline cursor-pointer";
2580
+ label.appendChild(link);
2581
+ } else {
2582
+ label.textContent = text;
2583
+ }
2575
2584
  pill.appendChild(label);
2576
2585
  return pill;
2577
2586
  }
2578
- function createFrontmatterSummary(entries, onShowDetails) {
2587
+ function createFrontmatterSummary(entries, onShowDetails, docKind, referenceProvider) {
2579
2588
  const summary = document.createElement("div");
2580
2589
  summary.dataset.frontmatterSummary = "true";
2581
2590
  summary.className = "divide-y divide-border/60";
@@ -2598,7 +2607,16 @@ function createFrontmatterSummary(entries, onShowDetails) {
2598
2607
  label.className = "mr-1 w-14 shrink-0 text-[11px] font-medium text-muted-foreground";
2599
2608
  label.textContent = group.label;
2600
2609
  row.appendChild(label);
2601
- for (const value of values2) row.appendChild(createSummaryPill(value, group.hash));
2610
+ for (const value of values2) {
2611
+ let href;
2612
+ if (group.label === "Aliases" && referenceProvider && (docKind === "effort" || docKind === "equipment")) {
2613
+ const match = docKind === "effort" ? referenceProvider.resolveEffort(value) : referenceProvider.resolveEquipment(value);
2614
+ if (match) {
2615
+ href = referenceProvider.openHref(docKind, match.slug);
2616
+ }
2617
+ }
2618
+ row.appendChild(createSummaryPill(value, group.hash, href));
2619
+ }
2602
2620
  summary.appendChild(row);
2603
2621
  }
2604
2622
  const hidden = entries.filter(([key]) => !TAG_CATEGORY_SUMMARY_KEYS[key.trim().toLowerCase()] && !isAliasProperty(key));
@@ -2694,7 +2712,7 @@ var DefaultFrontmatterWidget = class extends WidgetType {
2694
2712
  box.appendChild(createFrontmatterSummary(entries, () => {
2695
2713
  persistedDetailed.set(view.dom, true);
2696
2714
  view.dispatch({ effects: setFrontmatterDetailed.of(true) });
2697
- }));
2715
+ }, docKind, referenceProvider));
2698
2716
  } else {
2699
2717
  box.appendChild(createColumnHeader());
2700
2718
  if (entries.length === 0) {
@@ -2848,7 +2866,15 @@ var DefaultFrontmatterWidget = class extends WidgetType {
2848
2866
  const pill = document.createElement("span");
2849
2867
  pill.className = match ? "group/pill inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-muted/50 text-foreground border border-border/60" : chipIsReference ? "group/pill inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-destructive/10 text-destructive border border-destructive/30" : "group/pill inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-muted/40 text-foreground/90 border border-border/60";
2850
2868
  const pillText = document.createElement("span");
2851
- pillText.textContent = isAliasRow ? chip : match ? match.label : chip;
2869
+ if (isAliasRow && match && referenceProvider) {
2870
+ const aliasLink = document.createElement("a");
2871
+ aliasLink.href = referenceProvider.openHref(valueKind, match.slug);
2872
+ aliasLink.textContent = chip;
2873
+ aliasLink.className = "hover:underline cursor-pointer";
2874
+ pillText.appendChild(aliasLink);
2875
+ } else {
2876
+ pillText.textContent = isAliasRow ? chip : match ? match.label : chip;
2877
+ }
2852
2878
  pill.appendChild(pillText);
2853
2879
  if (match && referenceProvider && (!isAliasRow || idx === 0)) {
2854
2880
  const openLink = document.createElement("a");
@@ -5429,18 +5455,6 @@ function getCursorFocusState(state) {
5429
5455
  var cursorFocusExtension = [
5430
5456
  cursorFocusInternal
5431
5457
  ];
5432
- function cn(...inputs) {
5433
- return twMerge(clsx(inputs));
5434
- }
5435
- function hashCode(str) {
5436
- let hash2 = 0;
5437
- for (let i = 0; i < str.length; i++) {
5438
- const char = str.charCodeAt(i);
5439
- hash2 = (hash2 << 5) - hash2 + char;
5440
- hash2 = hash2 & hash2;
5441
- }
5442
- return Math.abs(hash2);
5443
- }
5444
5458
  function PRBadge({
5445
5459
  isPR = true,
5446
5460
  label,
@@ -5539,6 +5553,27 @@ var OUTPUT_TYPE_DOT = {
5539
5553
  compiler: "bg-muted-foreground/40",
5540
5554
  analytics: "bg-type-analytics shadow-type-analytics/50"
5541
5555
  };
5556
+ var OUTPUT_TYPE_LABEL = {
5557
+ segment: "Segment",
5558
+ milestone: "Milestone",
5559
+ completion: "Complete",
5560
+ metric: "Metric",
5561
+ system: "System",
5562
+ event: "Event",
5563
+ group: "Group",
5564
+ load: "Load",
5565
+ compiler: "Compiler",
5566
+ analytics: "Analytics"
5567
+ };
5568
+ function formatOutputTypeLabel(outputType) {
5569
+ const raw = String(outputType ?? "system").trim().toLowerCase();
5570
+ if (!raw) return "System";
5571
+ return OUTPUT_TYPE_LABEL[raw] ?? raw.charAt(0).toUpperCase() + raw.slice(1);
5572
+ }
5573
+ function formatOutputRowTitle(outputType, elapsedStr) {
5574
+ const label = formatOutputTypeLabel(outputType);
5575
+ return elapsedStr ? `${label} (${elapsedStr})` : label;
5576
+ }
5542
5577
  var EFFORT_TYPES = /* @__PURE__ */ new Set(["effort", "text", "action", "label"]);
5543
5578
  var LOAD_TYPES = /* @__PURE__ */ new Set([
5544
5579
  "resistance",
@@ -5866,17 +5901,18 @@ function StatementCards({
5866
5901
  const elapsedStr = ended !== void 0 && started !== void 0 ? formatMMSS(ended - started) : "running";
5867
5902
  const offsetStr = started !== void 0 && t0 !== void 0 ? `+${formatMMSS(started - t0)}` : "+00:00";
5868
5903
  const typeKey = String(out.outputType);
5869
- const hoverInfo = `#${out.id ?? idx + 1} \xB7 Block: ${out.sourceBlockKey || "session"}${out.completionReason ? ` \xB7 Reason: ${out.completionReason}` : ""}`;
5904
+ const typeLabel = formatOutputTypeLabel(out.outputType);
5905
+ const rowTitle = formatOutputRowTitle(out.outputType, elapsedStr);
5870
5906
  const pr = lookupPrHighlight(out, prHighlights);
5871
5907
  const bodyMetrics = [...cats.reps, ...cats.loads, ...cats.rounds, ...cats.durations, ...cats.distances];
5872
5908
  const hasBody = bodyMetrics.length > 0;
5873
- return /* @__PURE__ */ jsxs("li", { className: "relative pb-3 pl-6 last:pb-0", title: hoverInfo, children: [
5909
+ return /* @__PURE__ */ jsxs("li", { className: "relative pb-3 pl-6 last:pb-0", title: rowTitle, children: [
5874
5910
  idx < rows.length - 1 && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "absolute bottom-0 left-[5px] top-5 w-px bg-border/60" }),
5875
5911
  /* @__PURE__ */ jsx(
5876
5912
  "span",
5877
5913
  {
5878
5914
  "aria-hidden": true,
5879
- title: `Type: ${out.outputType} | ${hoverInfo}`,
5915
+ title: rowTitle,
5880
5916
  className: `absolute left-0 top-1.5 size-2.5 rounded-full shadow-md ring-2 ring-background ${OUTPUT_TYPE_DOT[typeKey] ?? OUTPUT_TYPE_DOT.system}`
5881
5917
  }
5882
5918
  ),
@@ -5887,7 +5923,7 @@ function StatementCards({
5887
5923
  "span",
5888
5924
  {
5889
5925
  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}`,
5890
- children: String(out.outputType ?? "system").slice(0, 4)
5926
+ children: typeLabel
5891
5927
  }
5892
5928
  ),
5893
5929
  presentBadges(cats.efforts),
@@ -6067,14 +6103,15 @@ function OutputStatementsTable({
6067
6103
  const elapsedStr = ended !== void 0 && started !== void 0 ? formatMMSS(ended - started) : "running";
6068
6104
  const wallTimeStr = formatClockTime(new Date(ended ?? started ?? 0));
6069
6105
  const offsetStr = started !== void 0 && t0 !== void 0 ? `+${formatMMSS(started - t0)}` : "+00:00";
6070
- const hoverInfo = `#${out.id ?? idx + 1} \xB7 Block: ${out.sourceBlockKey || "session"}${out.completionReason ? ` \xB7 Reason: ${out.completionReason}` : ""}`;
6106
+ const typeLabel = formatOutputTypeLabel(out.outputType);
6107
+ const rowTitle = formatOutputRowTitle(out.outputType, elapsedStr);
6071
6108
  const rowKey = String(out.id ?? `${out.sourceBlockKey ?? "row"}-${idx}`);
6072
6109
  const pr = lookupPrHighlight(out, prHighlights);
6073
6110
  const canInlineEditRow = Boolean(onEditMetric) && String(out.outputType ?? "").toLowerCase() === "segment" && Boolean(out.sourceBlockKey);
6074
6111
  return /* @__PURE__ */ jsx(
6075
6112
  "tr",
6076
6113
  {
6077
- title: hoverInfo,
6114
+ title: rowTitle,
6078
6115
  className: "hover:bg-muted/30 transition-colors group cursor-default",
6079
6116
  children: activeColumns.map((col) => {
6080
6117
  if (col.kind === "type") {
@@ -6082,8 +6119,8 @@ function OutputStatementsTable({
6082
6119
  "span",
6083
6120
  {
6084
6121
  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}`,
6085
- title: `Type: ${out.outputType} | ${hoverInfo}`,
6086
- children: String(out.outputType ?? "system").slice(0, 4)
6122
+ title: rowTitle,
6123
+ children: typeLabel
6087
6124
  }
6088
6125
  ) }, col.id);
6089
6126
  }
@@ -6700,7 +6737,7 @@ function tooltipTimestamp(ts) {
6700
6737
  function useChartShape(result) {
6701
6738
  return useMemo(() => {
6702
6739
  if (!result) return { kind: "empty" };
6703
- if (result.parsed.error) return { kind: "error", message: result.parsed.error };
6740
+ if (result.parsed?.error) return { kind: "error", message: result.parsed.error };
6704
6741
  if (result.series.length === 0) return { kind: "empty" };
6705
6742
  if (result.series.length === 1 && result.series[0].points.length === 1) {
6706
6743
  return { kind: "scalar", value: result.series[0].points[0].value };
@@ -6768,10 +6805,31 @@ function formatTimeseriesTooltipValue(value, unit) {
6768
6805
  const formatted = new Intl.NumberFormat(void 0, { maximumFractionDigits: 1 }).format(numeric);
6769
6806
  return formatWithUnit(formatted, unit);
6770
6807
  }
6808
+ var INTRINSIC_METRIC_UNITS = {
6809
+ "calc.hrv": "ms",
6810
+ hrv: "ms"
6811
+ };
6812
+ function resolveTimeseriesUnit(result, unitProp) {
6813
+ const seriesUnit = result.series[0]?.unit;
6814
+ if (seriesUnit) return seriesUnit;
6815
+ const seriesKey = result.series[0]?.key?.toLowerCase();
6816
+ if (seriesKey && INTRINSIC_METRIC_UNITS[seriesKey]) {
6817
+ return INTRINSIC_METRIC_UNITS[seriesKey];
6818
+ }
6819
+ const parsedMetric = result.parsed?.metric?.toLowerCase();
6820
+ if (parsedMetric && INTRINSIC_METRIC_UNITS[parsedMetric]) {
6821
+ return INTRINSIC_METRIC_UNITS[parsedMetric];
6822
+ }
6823
+ const rawQuery = result.query;
6824
+ if (typeof rawQuery === "string" && /\b(?:calc\.hrv|hrv)\b/i.test(rawQuery)) {
6825
+ return "ms";
6826
+ }
6827
+ return unitProp;
6828
+ }
6771
6829
  function WqlTimeseries({ result, unit: unitProp }) {
6772
6830
  const shape = useChartShape(result);
6773
6831
  const data2 = useMemo(() => mergeSeries(result.series), [result]);
6774
- const unit = result.series[0]?.unit ?? unitProp;
6832
+ const unit = resolveTimeseriesUnit(result, unitProp);
6775
6833
  if (shape.kind !== "timeseries" && shape.kind !== "scalar") {
6776
6834
  return /* @__PURE__ */ jsx(WqlEmptyState, { result });
6777
6835
  }
@@ -6858,11 +6916,10 @@ function WqlBars({ result, unit: unitProp }) {
6858
6916
  {
6859
6917
  tickLine: false,
6860
6918
  axisLine: false,
6861
- width: 48,
6862
- tickFormatter: compactNumber,
6919
+ width: 64,
6920
+ tickFormatter: (v) => formatTimeseriesTick(v, unit),
6863
6921
  stroke: "hsl(var(--muted-foreground))",
6864
- tick: { fill: "hsl(var(--muted-foreground))", fontSize: 10 },
6865
- unit: unit ? ` ${unit}` : ""
6922
+ tick: { fill: "hsl(var(--muted-foreground))", fontSize: 10 }
6866
6923
  }
6867
6924
  ),
6868
6925
  /* @__PURE__ */ jsx(
@@ -7721,33 +7778,6 @@ function patchBlockQuery(blockContent, newQuery, queryIndex = 0) {
7721
7778
  }
7722
7779
  return lines.join("\n");
7723
7780
  }
7724
- function readVisualViewport() {
7725
- if (typeof window === "undefined" || !window.visualViewport) {
7726
- return { height: null, offsetTop: 0, offsetBottom: 0 };
7727
- }
7728
- const vv = window.visualViewport;
7729
- return {
7730
- height: vv.height,
7731
- offsetTop: vv.offsetTop,
7732
- offsetBottom: Math.max(0, window.innerHeight - vv.height - vv.offsetTop)
7733
- };
7734
- }
7735
- function useVisualViewportRect() {
7736
- const [rect, setRect] = useState(readVisualViewport);
7737
- useEffect(() => {
7738
- const vv = window.visualViewport;
7739
- if (!vv) return;
7740
- const update = () => setRect(readVisualViewport());
7741
- vv.addEventListener("resize", update);
7742
- vv.addEventListener("scroll", update);
7743
- return () => {
7744
- vv.removeEventListener("resize", update);
7745
- vv.removeEventListener("scroll", update);
7746
- };
7747
- }, []);
7748
- return rect;
7749
- }
7750
- var FOCUSABLE_SELECTOR = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
7751
7781
  function EditorDialog({
7752
7782
  open,
7753
7783
  onClose,
@@ -7757,105 +7787,43 @@ function EditorDialog({
7757
7787
  footer,
7758
7788
  presentation = "default"
7759
7789
  }) {
7760
- const titleId = useId();
7761
- const descriptionId = useId();
7762
7790
  const panelRef = useRef(null);
7763
- const restoreFocusRef = useRef(null);
7764
- const viewport = useVisualViewportRect();
7765
7791
  const sheet = presentation === "sheet";
7766
- useEffect(() => {
7767
- if (!open) return;
7768
- restoreFocusRef.current = document.activeElement;
7769
- const previousOverflow = document.body.style.overflow;
7770
- document.body.style.overflow = "hidden";
7771
- const frame = requestAnimationFrame(() => {
7772
- const panel = panelRef.current;
7773
- if (!panel) return;
7774
- const target = sheet ? panel : panel.querySelector("[data-autofocus]") ?? panel;
7775
- target.focus();
7776
- });
7777
- return () => {
7778
- cancelAnimationFrame(frame);
7779
- document.body.style.overflow = previousOverflow;
7780
- const restore = restoreFocusRef.current;
7781
- if (restore instanceof HTMLElement && document.contains(restore)) restore.focus();
7782
- };
7783
- }, [open, sheet]);
7784
- if (!open || typeof document === "undefined") return null;
7785
- const handleKeyDown = (event) => {
7786
- if (event.key === "Escape") {
7787
- event.stopPropagation();
7788
- if (!event.defaultPrevented) onClose();
7789
- return;
7790
- }
7791
- if (event.key !== "Tab") return;
7792
- const panel = panelRef.current;
7793
- if (!panel) return;
7794
- const focusable = Array.from(panel.querySelectorAll(FOCUSABLE_SELECTOR));
7795
- if (focusable.length === 0) {
7796
- event.preventDefault();
7797
- panel.focus();
7798
- return;
7799
- }
7800
- const first = focusable[0];
7801
- const last = focusable[focusable.length - 1];
7802
- const active = document.activeElement;
7803
- if (event.shiftKey && (active === first || !panel.contains(active))) {
7804
- event.preventDefault();
7805
- last.focus();
7806
- } else if (!event.shiftKey && active === last) {
7807
- event.preventDefault();
7808
- first.focus();
7809
- }
7810
- };
7811
- const viewportStyle = {
7812
- top: viewport.offsetTop,
7813
- height: viewport.height ?? "100dvh"
7814
- };
7815
- return createPortal(
7816
- /* @__PURE__ */ jsx(
7817
- "div",
7818
- {
7819
- className: cn(
7820
- "fixed left-0 right-0 z-50 flex flex-col bg-black/40 dark:bg-black/60 sm:items-center sm:justify-center sm:bg-background/80 sm:p-4 sm:backdrop-blur-sm",
7821
- sheet && "max-sm:justify-end"
7822
- ),
7823
- style: viewportStyle,
7824
- onMouseDown: (event) => {
7825
- if (event.target === event.currentTarget) onClose();
7826
- },
7827
- children: /* @__PURE__ */ jsxs(
7828
- "div",
7792
+ return /* @__PURE__ */ jsxs(
7793
+ Dialog,
7794
+ {
7795
+ open,
7796
+ onOpenChange: (nextOpen) => {
7797
+ if (!nextOpen) onClose();
7798
+ },
7799
+ presentation: sheet ? "auto" : void 0,
7800
+ children: [
7801
+ /* @__PURE__ */ jsx(DialogBackdrop, { className: "bg-black/40 dark:bg-black/60 sm:backdrop-blur-sm" }),
7802
+ /* @__PURE__ */ jsxs(
7803
+ DialogContent,
7829
7804
  {
7830
7805
  ref: panelRef,
7831
- role: "dialog",
7832
- "aria-modal": "true",
7833
- "aria-labelledby": titleId,
7834
- "aria-describedby": description ? descriptionId : void 0,
7835
- tabIndex: -1,
7836
- onKeyDown: handleKeyDown,
7806
+ initialFocus: () => {
7807
+ if (sheet) return panelRef.current;
7808
+ return panelRef.current?.querySelector("[data-autofocus]") ?? panelRef.current;
7809
+ },
7837
7810
  className: cn(
7838
- "flex min-h-0 w-full flex-col overflow-hidden bg-card outline-none sm:max-h-full sm:max-w-2xl sm:flex-none sm:rounded-xl sm:border sm:border-border sm:shadow-2xl",
7839
- // Sheet: bottom-anchored at its natural height over the lower
7840
- // visible viewport (expands toward full height as content needs),
7841
- // with a rounded top edge; desktop keeps the centered panel.
7842
- sheet ? "max-sm:flex-none max-sm:min-h-[66%] max-sm:max-h-full max-sm:rounded-t-2xl" : "flex-1 sm:max-h-full"
7811
+ "gap-0 p-0 flex min-h-0 w-full flex-col overflow-hidden bg-card text-foreground border border-border shadow-2xl sm:max-h-[calc(100dvh-2rem)] sm:max-w-2xl sm:rounded-xl",
7812
+ sheet ? "max-sm:min-h-[66dvh] max-sm:max-h-[92dvh] max-sm:w-screen max-sm:rounded-t-2xl max-sm:rounded-b-none" : "max-sm:h-dvh max-sm:max-h-dvh max-sm:w-screen max-sm:rounded-none max-sm:border-0"
7843
7813
  ),
7844
7814
  children: [
7845
- sheet && /* @__PURE__ */ jsx("div", { "aria-hidden": true, className: "flex justify-center pt-2 sm:hidden", children: /* @__PURE__ */ jsx("div", { className: "h-1 w-10 rounded-full bg-border" }) }),
7815
+ sheet && /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: "flex justify-center pt-2 sm:hidden", children: /* @__PURE__ */ jsx("div", { className: "h-1 w-10 rounded-full bg-border" }) }),
7846
7816
  /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3 border-b border-border/80 px-4 py-3 sm:px-6 sm:py-4", children: [
7847
7817
  /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
7848
- /* @__PURE__ */ jsx("h2", { id: titleId, className: "text-base font-semibold text-foreground", children: title }),
7849
- description && /* @__PURE__ */ jsx("p", { id: descriptionId, className: "mt-0.5 text-xs text-muted-foreground", children: description })
7818
+ /* @__PURE__ */ jsx(DialogTitle, { className: "text-base font-semibold text-foreground", children: title }),
7819
+ description && /* @__PURE__ */ jsx(DialogDescription, { className: "mt-0.5 text-xs text-muted-foreground", children: description })
7850
7820
  ] }),
7851
7821
  /* @__PURE__ */ jsx(
7852
- "button",
7822
+ DialogClose,
7853
7823
  {
7854
- type: "button",
7855
- onClick: onClose,
7856
7824
  "aria-label": "Close",
7857
- className: "flex size-11 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-muted hover:text-foreground sm:size-9",
7858
- children: /* @__PURE__ */ jsx(X, { className: "size-5 sm:size-4" })
7825
+ className: "flex size-11 shrink-0 items-center justify-center rounded-lg border-0 bg-transparent p-0 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground sm:size-9",
7826
+ children: /* @__PURE__ */ jsx(X, { className: "size-5 sm:size-4", "aria-hidden": "true" })
7859
7827
  }
7860
7828
  )
7861
7829
  ] }),
@@ -7864,13 +7832,8 @@ function EditorDialog({
7864
7832
  "div",
7865
7833
  {
7866
7834
  className: cn(
7867
- "border-t border-border/80 bg-muted/10 px-4 py-3 sm:px-6",
7868
- // 44px default mobile density; sheet actions get the full
7869
- // 48px touch target.
7870
- sheet ? "max-sm:[&_button]:min-h-12 max-sm:[&_button]:min-w-11" : "max-sm:[&_button]:min-h-11 max-sm:[&_button]:min-w-11",
7871
- // Sheet rides the visual viewport bottom; clear the home
7872
- // indicator / gesture area.
7873
- sheet && "max-sm:pb-[max(0.75rem,env(safe-area-inset-bottom))]"
7835
+ "flex flex-wrap items-center gap-2 border-t border-border/80 bg-muted/10 px-4 py-3 sm:px-6",
7836
+ sheet ? "max-sm:[&_button]:min-h-12 max-sm:[&_button]:min-w-11 max-sm:pb-[max(0.75rem,env(safe-area-inset-bottom))]" : "max-sm:[&_button]:min-h-11 max-sm:[&_button]:min-w-11"
7874
7837
  ),
7875
7838
  children: footer
7876
7839
  }
@@ -7878,9 +7841,8 @@ function EditorDialog({
7878
7841
  ]
7879
7842
  }
7880
7843
  )
7881
- }
7882
- ),
7883
- document.body
7844
+ ]
7845
+ }
7884
7846
  );
7885
7847
  }
7886
7848
  var ComposerRegistry = class {
@@ -10042,7 +10004,7 @@ function WqlComposer({
10042
10004
  closeEditor();
10043
10005
  }, children: "Change query" })
10044
10006
  ] }),
10045
- !showDiagnostics && (error ?? (resolved.wql.trim() ? resolved.error : void 0)) && /* @__PURE__ */ jsx("p", { role: "alert", className: "text-sm text-destructive", children: error ?? resolved.error }),
10007
+ !showDiagnostics && (error ?? (resolved.wql.trim() && /[:{}|@]/.test(resolved.wql) ? resolved.error : void 0)) && /* @__PURE__ */ jsx("p", { role: "alert", className: "text-sm text-destructive", children: error ?? resolved.error }),
10046
10008
  !guided && !resolved.error && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Use Edit WQL to preserve every clause." }),
10047
10009
  pending && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", "data-testid": "wql-composer-pending", children: resolved.valid ? "Current draft includes this text" : resolved.error }),
10048
10010
  showDiagnostics && diagnosticsPosition === "bottom" ? /* @__PURE__ */ jsx(WqlDiagnosticsStrip, { diagnostics, stages, activeStage: cursorStage, actions: action }) : diagnosticsPosition !== "top" || !showDiagnostics ? Boolean(actionLabel || diagnosticsActions) && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center justify-end gap-2", children: action }) : null
@@ -10067,7 +10029,6 @@ function rank(c, needle) {
10067
10029
  }
10068
10030
  var ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
10069
10031
  function DateRangeEditor({ value, onChange, onClose }) {
10070
- const id = useId();
10071
10032
  const [start, setStart] = useState(value?.start ?? "");
10072
10033
  const [end, setEnd] = useState(value?.end ?? "");
10073
10034
  const shaped = ISO_DATE.test(start) && ISO_DATE.test(end);
@@ -10077,30 +10038,28 @@ function DateRangeEditor({ value, onChange, onClose }) {
10077
10038
  const ready = shaped && !error;
10078
10039
  return /* @__PURE__ */ jsxs("div", { className: "space-y-2 text-xs", "data-testid": "date-range-editor", children: [
10079
10040
  /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-1.5", children: [
10080
- /* @__PURE__ */ jsxs("div", { children: [
10081
- /* @__PURE__ */ jsx("label", { htmlFor: `${id}-start`, className: "text-[10px] uppercase font-bold text-muted-foreground", children: "Start" }),
10041
+ /* @__PURE__ */ jsxs(Field, { children: [
10042
+ /* @__PURE__ */ jsx(FieldLabel, { className: "text-[10px] uppercase font-bold text-muted-foreground", children: "Start" }),
10082
10043
  /* @__PURE__ */ jsx(
10083
- "input",
10044
+ Input,
10084
10045
  {
10085
- id: `${id}-start`,
10086
10046
  type: "date",
10087
10047
  value: start,
10088
- onChange: (e) => setStart(e.target.value),
10089
- className: "w-full min-h-12 rounded border border-border bg-background px-1.5 text-base font-mono",
10048
+ onValueChange: setStart,
10049
+ className: "w-full min-h-12 h-12 rounded border border-border bg-background px-1.5 text-base font-mono",
10090
10050
  "data-testid": "date-range-start"
10091
10051
  }
10092
10052
  )
10093
10053
  ] }),
10094
- /* @__PURE__ */ jsxs("div", { children: [
10095
- /* @__PURE__ */ jsx("label", { htmlFor: `${id}-end`, className: "text-[10px] uppercase font-bold text-muted-foreground", children: "End" }),
10054
+ /* @__PURE__ */ jsxs(Field, { children: [
10055
+ /* @__PURE__ */ jsx(FieldLabel, { className: "text-[10px] uppercase font-bold text-muted-foreground", children: "End" }),
10096
10056
  /* @__PURE__ */ jsx(
10097
- "input",
10057
+ Input,
10098
10058
  {
10099
- id: `${id}-end`,
10100
10059
  type: "date",
10101
10060
  value: end,
10102
- onChange: (e) => setEnd(e.target.value),
10103
- className: "w-full min-h-12 rounded border border-border bg-background px-1.5 text-base font-mono",
10061
+ onValueChange: setEnd,
10062
+ className: "w-full min-h-12 h-12 rounded border border-border bg-background px-1.5 text-base font-mono",
10104
10063
  "data-testid": "date-range-end"
10105
10064
  }
10106
10065
  )
@@ -10111,21 +10070,22 @@ function DateRangeEditor({ value, onChange, onClose }) {
10111
10070
  /* @__PURE__ */ jsx("code", { className: "text-[10px] font-mono text-muted-foreground truncate", children: ready ? `daterange:${start}_${end}` : "daterange: <start>_<end>" }),
10112
10071
  /* @__PURE__ */ jsxs("div", { className: "flex gap-1.5 shrink-0", children: [
10113
10072
  /* @__PURE__ */ jsx(
10114
- "button",
10073
+ Button,
10115
10074
  {
10116
- type: "button",
10075
+ variant: "outline",
10076
+ size: "sm",
10117
10077
  onClick: onClose,
10118
- className: "min-h-12 px-3 rounded border border-border text-xs text-muted-foreground hover:text-foreground transition-colors",
10078
+ className: "min-h-12 px-3 text-muted-foreground hover:text-foreground",
10119
10079
  children: "Cancel"
10120
10080
  }
10121
10081
  ),
10122
10082
  /* @__PURE__ */ jsx(
10123
- "button",
10083
+ Button,
10124
10084
  {
10125
- type: "button",
10085
+ size: "sm",
10126
10086
  disabled: !ready,
10127
10087
  onClick: () => onChange({ start, end }),
10128
- className: "min-h-12 px-3 rounded bg-primary text-primary-foreground text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-40",
10088
+ className: "min-h-12 px-3",
10129
10089
  "data-testid": "date-range-apply",
10130
10090
  children: "Set Range"
10131
10091
  }
@@ -11227,22 +11187,23 @@ function WqlQueryInspectorModal({
11227
11187
  }
11228
11188
  ),
11229
11189
  /* @__PURE__ */ jsx(
11230
- "button",
11190
+ Button,
11231
11191
  {
11232
- type: "button",
11192
+ variant: "outline",
11193
+ size: "sm",
11233
11194
  onClick: onClose,
11234
- className: "min-h-12 px-3 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground rounded-lg border border-border hover:bg-muted transition-colors",
11195
+ className: "min-h-12 text-muted-foreground hover:text-foreground",
11235
11196
  children: "Cancel"
11236
11197
  }
11237
11198
  ),
11238
11199
  /* @__PURE__ */ jsx(
11239
- "button",
11200
+ Button,
11240
11201
  {
11241
- type: "button",
11202
+ size: "sm",
11242
11203
  "data-testid": "wql-inspector-apply",
11243
11204
  onClick: () => void handleApply(),
11244
11205
  disabled: !validation.valid || applying,
11245
- className: "min-h-12 px-3 py-1.5 text-xs font-medium text-primary-foreground bg-primary hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed rounded-lg shadow transition-colors",
11206
+ className: "min-h-12",
11246
11207
  children: applying ? "Applying\u2026" : applyLabel
11247
11208
  }
11248
11209
  )
@@ -17714,6 +17675,6 @@ function editorPreset(optionsOrDialect = "markdown") {
17714
17675
  return extensions;
17715
17676
  }
17716
17677
 
17717
- export { AGG_OPTIONS, CANONICAL_BLOCK_TYPES, CLAUSE_META, ComposerRegistry, DEFAULT_DIAGNOSTICS_DEBOUNCE_MS, DEFAULT_OUTPUT_FILTERS, DEFAULT_PRIMARY_FILTER, DefaultFrontmatterWidget, EditorDialog, GROUPBY_OPTIONS, GoalRings, INTERNAL_FRONTMATTER_KEYS, KIND_OPTIONS, METRIC_OPTIONS, MULTI_VALUE_TYPES, MetricBadge, OUTPUT_TYPE_CLASS, OUTPUT_TYPE_DOT, OutputFilterPills, OutputStatementsTable, PLANE_OPTIONS, PRBadge, ProposedMetricBadge, QueryBlockView, QueryObjectBuilder, QueryValue, ROLLUP_OPTIONS, RowsResultsChrome, RowsTable, SERIES_COLORS, SOURCE_OPTIONS, SUGGESTION_BINDINGS, StackedBar, TARGET_OPTIONS, TIME_OPTIONS, TONE_CLASS, TokenSlotPill, TopList, UNIT_OPTIONS, WHERE_AGGREGATORS, WHERE_METRICS, WidgetChart, WidgetProblemBadge, WqlBars, WqlComposer, WqlDiagnosticsStrip, WqlEmptyState, WqlQueryInspectorModal, WqlTable, WqlTimeseries, ZoneDistribution, activeCursorSection, addRuntimePanel, affiliateTagFacet, applyAmazonAffiliateTag, attachmentUrlFacet, autocompleteTooltipTheme, bindTokenParamIntoWql, bindTokenToQueryObject, blockTypesFromBlocks, canonicalSuggestionItems, cn, compactNumber, composerRegistry, computeSessionPrHighlights, configureOverlayActions, createExecutorDocumentHost, cursorFocusExtension, customCompletionSources, cycleBaselineLayer, dateRangeSlot, dispatchAddRuntimePanel, dispatchExpandRuntimePanel, dispatchGutterHighlights, dispatchRemoveRuntimePanel, editQueryClause, editingQuerySectionsField, editingWidgetsField, editorFocusField, editorFocusTracker, editorPreset, editorTheme, embedPreviewDecorations, expandRuntimePanel, extractBlockQueries, extractMetricsByCategory, fenceCompletion, findQueryBlockSection, findWorkoutErrors, forceSectionParse, formatClockTime, formatMMSS, formatTimeseriesTick, formatTimeseriesTooltipValue, formatTimestamp, frontmatterDebugMode, frontmatterDetailed, frontmatterKeymap, frontmatterPreview, frontmatterPreviewField, frontmatterReferenceIndex, frontmatterSource, frontmatterSuggestions, frontmatterVisibility, getClauseMeta, getCursorFocusState, getOverlayActions, getSuggestionBinding, gutterHighlightsField, gutterUnified, handleFenceAutoWrap, handleSmartUrlPaste, hashCode, inlineButtonDecoration, insertMarkdownLinkCommand, invalidateSuggestions, isAmazonRetailHost, isEditorFocused, isInternalFrontmatterKey, isNavigableUrl, lineIdsExtension, linkOpen, linkPreview, loadSuggestions, markdownSyntaxHiding, markdownTablePreview, matchFilterTypeahead, mergeSeries, mergeSuggestionItems, mergeTagSuggestions, navigationFacet, nestedCompletion, nestedCompletionOptions, normalizeOutputFilter, normalizeSimplePipelineToAggregate, notebookSlugsFromBlocks, outputToRunResult, outputsToRunResult, patchBlockQuery, presentBadges, previewDecorations, primaryQueryOf, promoteFindToChartObject, queryBlockPreview, readSessionRpe, referenceIndexReload, registeredSectionWidgets, removeRuntimePanel, removeSeriesLayer, resolveCodeLanguage, resolveQueryDraft, runtimePanelField, saveBlockQuerySource, sectionAtPos, sectionField, sectionGeometry, sectionIdentity, sectionIdentityHistory, sectionMove, sectionRestore, sectionSaved, sessionQueryFence, sessionQueryInsert, sessionQueryWql, setEditorFocused, setFrontmatterDetailed, setFrontmatterSource, setGutterHighlights, setPrimaryQueryOnObject, setQuerySourceEditing, setSuggestionBinding, slashBlockCompletion, smartIncrement, summarizeAggregate, summarizeFind, summarizePipeline, tagsFromStaticBlocks, toChartResult, toggleCompareLayer, toggleGoalLayer, toggleInlineMarkdown, toggleWidgetEdit, tooltipTimestamp, urlAtPos, useChartShape, useComposerSlots, useSuggestions, useVisualViewportRect, useWqlStageCounts, widgetBlockPreview, wodAutoWrap, wodAutocompletion, wodCompletionSource, wodEditorKeymap, wodLinter, wodOverlayPanel, workoutLintSource, wqlToPills, wrapInTimeFence };
17718
- //# sourceMappingURL=chunk-YCI5DMLM.mjs.map
17719
- //# sourceMappingURL=chunk-YCI5DMLM.mjs.map
17678
+ export { AGG_OPTIONS, CANONICAL_BLOCK_TYPES, CLAUSE_META, ComposerRegistry, DEFAULT_DIAGNOSTICS_DEBOUNCE_MS, DEFAULT_OUTPUT_FILTERS, DEFAULT_PRIMARY_FILTER, DefaultFrontmatterWidget, EditorDialog, GROUPBY_OPTIONS, GoalRings, INTERNAL_FRONTMATTER_KEYS, KIND_OPTIONS, METRIC_OPTIONS, MULTI_VALUE_TYPES, MetricBadge, OUTPUT_TYPE_CLASS, OUTPUT_TYPE_DOT, OutputFilterPills, OutputStatementsTable, PLANE_OPTIONS, PRBadge, ProposedMetricBadge, QueryBlockView, QueryObjectBuilder, QueryValue, ROLLUP_OPTIONS, RowsResultsChrome, RowsTable, SERIES_COLORS, SOURCE_OPTIONS, SUGGESTION_BINDINGS, StackedBar, TARGET_OPTIONS, TIME_OPTIONS, TONE_CLASS, TokenSlotPill, TopList, UNIT_OPTIONS, WHERE_AGGREGATORS, WHERE_METRICS, WidgetChart, WidgetProblemBadge, WqlBars, WqlComposer, WqlDiagnosticsStrip, WqlEmptyState, WqlQueryInspectorModal, WqlTable, WqlTimeseries, ZoneDistribution, activeCursorSection, addRuntimePanel, affiliateTagFacet, applyAmazonAffiliateTag, attachmentUrlFacet, autocompleteTooltipTheme, bindTokenParamIntoWql, bindTokenToQueryObject, blockTypesFromBlocks, canonicalSuggestionItems, compactNumber, composerRegistry, computeSessionPrHighlights, configureOverlayActions, createExecutorDocumentHost, cursorFocusExtension, customCompletionSources, cycleBaselineLayer, dateRangeSlot, dispatchAddRuntimePanel, dispatchExpandRuntimePanel, dispatchGutterHighlights, dispatchRemoveRuntimePanel, editQueryClause, editingQuerySectionsField, editingWidgetsField, editorFocusField, editorFocusTracker, editorPreset, editorTheme, embedPreviewDecorations, expandRuntimePanel, extractBlockQueries, extractMetricsByCategory, fenceCompletion, findQueryBlockSection, findWorkoutErrors, forceSectionParse, formatClockTime, formatMMSS, formatTimeseriesTick, formatTimeseriesTooltipValue, formatTimestamp, frontmatterDebugMode, frontmatterDetailed, frontmatterKeymap, frontmatterPreview, frontmatterPreviewField, frontmatterReferenceIndex, frontmatterSource, frontmatterSuggestions, frontmatterVisibility, getClauseMeta, getCursorFocusState, getOverlayActions, getSuggestionBinding, gutterHighlightsField, gutterUnified, handleFenceAutoWrap, handleSmartUrlPaste, inlineButtonDecoration, insertMarkdownLinkCommand, invalidateSuggestions, isAmazonRetailHost, isEditorFocused, isInternalFrontmatterKey, isNavigableUrl, lineIdsExtension, linkOpen, linkPreview, loadSuggestions, markdownSyntaxHiding, markdownTablePreview, matchFilterTypeahead, mergeSeries, mergeSuggestionItems, mergeTagSuggestions, navigationFacet, nestedCompletion, nestedCompletionOptions, normalizeOutputFilter, normalizeSimplePipelineToAggregate, notebookSlugsFromBlocks, outputToRunResult, outputsToRunResult, patchBlockQuery, presentBadges, previewDecorations, primaryQueryOf, promoteFindToChartObject, queryBlockPreview, readSessionRpe, referenceIndexReload, registeredSectionWidgets, removeRuntimePanel, removeSeriesLayer, resolveCodeLanguage, resolveQueryDraft, runtimePanelField, saveBlockQuerySource, sectionAtPos, sectionField, sectionGeometry, sectionIdentity, sectionIdentityHistory, sectionMove, sectionRestore, sectionSaved, sessionQueryFence, sessionQueryInsert, sessionQueryWql, setEditorFocused, setFrontmatterDetailed, setFrontmatterSource, setGutterHighlights, setPrimaryQueryOnObject, setQuerySourceEditing, setSuggestionBinding, slashBlockCompletion, smartIncrement, summarizeAggregate, summarizeFind, summarizePipeline, tagsFromStaticBlocks, toChartResult, toggleCompareLayer, toggleGoalLayer, toggleInlineMarkdown, toggleWidgetEdit, tooltipTimestamp, urlAtPos, useChartShape, useComposerSlots, useSuggestions, useWqlStageCounts, widgetBlockPreview, wodAutoWrap, wodAutocompletion, wodCompletionSource, wodEditorKeymap, wodLinter, wodOverlayPanel, workoutLintSource, wqlToPills, wrapInTimeFence };
17679
+ //# sourceMappingURL=chunk-GP26UA75.mjs.map
17680
+ //# sourceMappingURL=chunk-GP26UA75.mjs.map