@bitcobblers/wod-wiki-ui 0.44.2159 → 0.45.2166

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.
@@ -3,13 +3,13 @@ import { HighlightStyle, syntaxTree, sublanguageProp, LRLanguage, indentNodeProp
3
3
  import { tags, styleTags, Tag as Tag$1 } from '@lezer/highlight';
4
4
  import { RangeSetBuilder, Facet, StateEffect, StateField, Prec, EditorState, EditorSelection, countColumn } from '@codemirror/state';
5
5
  import { linter, forEachDiagnostic } from '@codemirror/lint';
6
- import { whiteboardScriptLanguage, EFFORT_DISCIPLINES, createParser, metricPresentation, whiteboardScript } from '@bitcobblers/wod-wiki-lang';
6
+ import { whiteboardScriptLanguage, EFFORT_DISCIPLINES, createParser, whiteboardScriptCompletionSource, metricPresentation, whiteboardScript } from '@bitcobblers/wod-wiki-lang';
7
7
  import { mapNoteBlockChanges, validateNoteBlocks, reconcileNoteBlocks, parseDocumentSections, actionableSectionKind, patchFrontmatterProperty, MetricType } from '@bitcobblers/wod-wiki-core';
8
8
  export { blockContentId } from '@bitcobblers/wod-wiki-core';
9
9
  import { invertedEffects, history, defaultKeymap, historyKeymap, indentWithTab, cursorPageUp, cursorPageDown, cursorDocStart, cursorDocEnd } from '@codemirror/commands';
10
- import { WQL_FIND_TARGETS, WQL_SOURCE_VALUES, WQL_RESULT_PLANES, WQL_AGGREGATORS, WQL_VIRTUAL_DIMS, WQL_TAG_KEYS, WQL_METRIC_AGGREGATES, WQL_METRIC_FAMILIES, WQL_CALC_TARGETS, WQL_DISPLAY_UNITS, WQL_INTENSITY_TIERS, parseQueryWidgetSuffix, parseFrontmatterBody, parseQuery, isFindQuery, isDashboardWidgetType, unknownWidgetTypeMessage, resolveWidgetType, PLANNED_WIDGET_TYPES, catalogOfItem, isPipelineQuery, wqlGroupingDimensions, isAggregateQuery, serialize, allowedFilterTypesForTarget, CONTENT_GROUPING_DIMENSIONS, substituteTokens, unknownTokensMessage, wql, WQL_NOTE_DEFAULT_SOURCES, wqlCompletionSource, wqlLanguage, wqlHighlightStyle, supportsWqlFilterKey } from '@bitcobblers/wod-wiki-wql';
10
+ import { WQL_FIND_TARGETS, WQL_SOURCE_VALUES, WQL_RESULT_PLANES, WQL_AGGREGATORS, WQL_VIRTUAL_DIMS, WQL_TAG_KEYS, WQL_METRIC_AGGREGATES, WQL_METRIC_FAMILIES, WQL_CALC_TARGETS, WQL_DISPLAY_UNITS, WQL_INTENSITY_TIERS, parseQueryWidgetSuffix, wqlLanguage, parseFrontmatterBody, wqlCompletionSource, parseQuery, isFindQuery, isDashboardWidgetType, unknownWidgetTypeMessage, resolveWidgetType, PLANNED_WIDGET_TYPES, notebookSlugOfSourceId, isPipelineQuery, wqlGroupingDimensions, isAggregateQuery, serialize, allowedFilterTypesForTarget, CONTENT_GROUPING_DIMENSIONS, substituteTokens, unknownTokensMessage, wql, WQL_NOTE_DEFAULT_SOURCES, wqlHighlightStyle, supportsWqlFilterKey } from '@bitcobblers/wod-wiki-wql';
11
11
  export { CONTENT_GROUPING_DIMENSIONS } from '@bitcobblers/wod-wiki-wql';
12
- import { snippet, autocompletion, closeBrackets, closeBracketsKeymap, completionStatus, startCompletion, moveCompletionSelection, setSelectedCompletion, currentCompletions, acceptCompletion, closeCompletion, CompletionContext, ifNotIn, completeFromList, snippetCompletion } from '@codemirror/autocomplete';
12
+ import { snippet, autocompletion, CompletionContext, closeBrackets, closeBracketsKeymap, completionStatus, startCompletion, moveCompletionSelection, setSelectedCompletion, currentCompletions, acceptCompletion, closeCompletion, ifNotIn, completeFromList, snippetCompletion } from '@codemirror/autocomplete';
13
13
  import { createRoot } from 'react-dom/client';
14
14
  import * as React2 from 'react';
15
15
  import React2__default, { createElement, useMemo, useState, useCallback, useEffect, useId, useRef, useSyncExternalStore } from 'react';
@@ -559,7 +559,7 @@ var sectionIdentityHistory = invertedEffects.of((tr) => {
559
559
  return value && tr.docChanged ? [restoreHistoryIdentity.of({ rawContent: value.rawContent, blocks: toEditorBlocks(value) })] : [];
560
560
  });
561
561
  function sectionAtPos(state, pos) {
562
- return state.field(sectionField).sections.find((section) => pos >= section.from && pos <= section.to) ?? null;
562
+ return state.field(sectionField, false)?.sections.find((section) => pos >= section.from && pos <= section.to) ?? null;
563
563
  }
564
564
  function activeCursorSection(state) {
565
565
  return sectionAtPos(state, state.selection.main.head);
@@ -654,6 +654,8 @@ function fenceCompletion(context) {
654
654
  }
655
655
  function wrapInTimeFence(view) {
656
656
  if (view.state.readOnly) return false;
657
+ const section = activeCursorSection(view.state);
658
+ if (section && section.type !== "markdown") return false;
657
659
  const { from, to } = view.state.selection.main;
658
660
  const selected = view.state.doc.sliceString(from, to);
659
661
  if (!selected) {
@@ -677,6 +679,8 @@ ${selected}
677
679
  function handleFenceAutoWrap(event, view) {
678
680
  if (view.state.readOnly) return false;
679
681
  if (event.data !== "`") return false;
682
+ const section = activeCursorSection(view.state);
683
+ if (section && section.type !== "markdown") return false;
680
684
  const { from, to } = view.state.selection.main;
681
685
  if (from === to) return false;
682
686
  const selected = view.state.doc.sliceString(from, to);
@@ -701,32 +705,152 @@ var wodEditorKeymap = keymap.of([
701
705
  run: wrapInTimeFence
702
706
  }
703
707
  ]);
704
- var customCompletionSources = [];
705
- function registerCustomCompletionSource(source) {
706
- if (!customCompletionSources.includes(source)) {
707
- customCompletionSources.push(source);
708
- }
708
+ var customCompletionSources = Facet.define({
709
+ combine: (sources) => sources
710
+ });
711
+ var nestedCompletionOptions = Facet.define({
712
+ combine: (values2) => values2[values2.length - 1]
713
+ });
714
+ var sharedWqlSource;
715
+ var nestedWqlSources = /* @__PURE__ */ new WeakMap();
716
+ function nestedWqlSource(options) {
717
+ if (!options) return sharedWqlSource ??= wqlCompletionSource({});
718
+ let source = nestedWqlSources.get(options);
719
+ if (!source) {
720
+ source = wqlCompletionSource(options);
721
+ nestedWqlSources.set(options, source);
722
+ }
723
+ return source;
724
+ }
725
+ var sharedWbPerSport;
726
+ var nestedWbSources = /* @__PURE__ */ new WeakMap();
727
+ function nestedWhiteboardScriptSource(options, sport) {
728
+ let perSport;
729
+ if (!options) perSport = sharedWbPerSport ??= /* @__PURE__ */ new Map();
730
+ else {
731
+ perSport = nestedWbSources.get(options) ?? /* @__PURE__ */ new Map();
732
+ nestedWbSources.set(options, perSport);
733
+ }
734
+ const key = sport ?? "";
735
+ let source = perSport.get(key);
736
+ if (!source) {
737
+ source = whiteboardScriptCompletionSource({ ...options ?? {}, ...sport ? { sport } : {} });
738
+ perSport.set(key, source);
739
+ }
740
+ return source;
741
+ }
742
+ function wqlFenceAt(state, pos) {
743
+ return /^`{3,}wql\b/i.test(state.doc.lineAt(pos).text.trim());
744
+ }
745
+ function nestedCompletion(context) {
746
+ const section = sectionAtPos(context.state, context.pos);
747
+ const { contentFrom, contentTo } = section ?? {};
748
+ if (!section || contentFrom === void 0 || contentTo === void 0) return null;
749
+ const whiteboard = section.type === "time" || section.type === "log";
750
+ const query = section.type === "query" || wqlFenceAt(context.state, section.from);
751
+ if (!whiteboard && !query) return null;
752
+ if (context.pos < contentFrom || context.pos > contentTo) return null;
753
+ const { state } = context;
754
+ const selection2 = state.selection.main;
755
+ const selFrom = Math.min(Math.max(selection2.from, contentFrom), contentTo);
756
+ const selTo = Math.min(Math.max(selection2.to, contentFrom), contentTo);
757
+ const subState = EditorState.create({
758
+ doc: state.doc.sliceString(contentFrom, contentTo),
759
+ selection: EditorSelection.range(selFrom - contentFrom, selTo - contentFrom),
760
+ // Slot detection may read the Lezer tree — parse the body with its
761
+ // dialect language, exactly as a standalone editor's state would have it.
762
+ extensions: whiteboard ? whiteboardScriptLanguage : [wqlLanguage]
763
+ });
764
+ const source = whiteboard ? nestedWhiteboardScriptSource(state.facet(nestedCompletionOptions)?.whiteboardScript, section.sport) : nestedWqlSource(state.facet(nestedCompletionOptions)?.wql);
765
+ const result = source(
766
+ new CompletionContext(subState, context.pos - contentFrom, context.explicit)
767
+ );
768
+ const rebase = (resolved) => resolved && {
769
+ ...resolved,
770
+ from: contentFrom + resolved.from,
771
+ ...resolved.to !== void 0 ? { to: contentFrom + resolved.to } : {}
772
+ };
773
+ return result instanceof Promise ? result.then(rebase) : rebase(result);
709
774
  }
710
- function unregisterCustomCompletionSource(source) {
711
- const idx = customCompletionSources.indexOf(source);
712
- if (idx !== -1) {
713
- customCompletionSources.splice(idx, 1);
775
+ async function wodCompletionSource(context) {
776
+ for (const source of context.state.facet(customCompletionSources)) {
777
+ const result = await source(context);
778
+ if (result) return result;
714
779
  }
780
+ return fenceCompletion(context) ?? nestedCompletion(context);
715
781
  }
716
782
  var wodAutocompletion = autocompletion({
717
783
  interactionDelay: 0,
718
784
  activateOnCompletion: (completion) => completion.type === "property" && typeof completion.apply === "string" && completion.apply.endsWith(":\n - "),
719
785
  override: [
720
- fenceCompletion,
721
- async (context) => {
722
- for (const source of customCompletionSources) {
723
- const res = await source(context);
724
- if (res) return res;
725
- }
726
- return null;
727
- }
786
+ // Explicit provider order — see wodCompletionSource.
787
+ wodCompletionSource
728
788
  ]
729
789
  });
790
+ var autocompleteTooltipTheme = EditorView.theme({
791
+ ".cm-tooltip": {
792
+ backgroundColor: "hsl(var(--popover))",
793
+ color: "hsl(var(--popover-foreground))",
794
+ border: "1px solid hsl(var(--border))",
795
+ borderRadius: "var(--radius-md)",
796
+ // Tailwind shadow-md (no --shadow-* token exists yet).
797
+ boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
798
+ fontFamily: "var(--font-sans, Inter, system-ui, sans-serif)",
799
+ fontSize: "14px",
800
+ zIndex: "40"
801
+ },
802
+ ".cm-tooltip-autocomplete": {
803
+ overflow: "hidden",
804
+ // Viewport clamps keep the popover usable on narrow/mobile screens.
805
+ minWidth: "min(18rem, calc(100vw - 2rem))",
806
+ maxWidth: "calc(100vw - 2rem)"
807
+ },
808
+ ".cm-tooltip-autocomplete > ul": {
809
+ padding: "4px",
810
+ maxHeight: "min(45svh, 20rem)",
811
+ overscrollBehavior: "contain",
812
+ fontFamily: "inherit",
813
+ fontSize: "inherit"
814
+ },
815
+ ".cm-tooltip-autocomplete > ul > li": {
816
+ display: "flex",
817
+ alignItems: "center",
818
+ gap: "8px",
819
+ minHeight: "40px",
820
+ padding: "8px 10px",
821
+ borderRadius: "var(--radius-sm)",
822
+ lineHeight: "20px"
823
+ },
824
+ ".cm-tooltip-autocomplete > ul > li:hover": {
825
+ backgroundColor: "hsl(var(--muted) / 0.6)"
826
+ },
827
+ '.cm-tooltip-autocomplete > ul > li[aria-selected="true"]': {
828
+ backgroundColor: "hsl(var(--primary) / 0.15)",
829
+ fontWeight: "600"
830
+ },
831
+ ".cm-completionLabel": {
832
+ fontFamily: "var(--font-mono, ui-monospace, SFMono-Regular, monospace)",
833
+ fontWeight: "500",
834
+ overflow: "hidden",
835
+ textOverflow: "ellipsis"
836
+ },
837
+ ".cm-completionMatchedText": {
838
+ textDecoration: "none",
839
+ fontWeight: "700",
840
+ color: "hsl(var(--primary))"
841
+ },
842
+ ".cm-completionDetail": {
843
+ marginLeft: "auto",
844
+ paddingLeft: "12px",
845
+ fontFamily: "var(--font-sans, Inter, system-ui, sans-serif)",
846
+ fontSize: "12px",
847
+ fontStyle: "normal",
848
+ color: "hsl(var(--muted-foreground))"
849
+ },
850
+ "@media (pointer: coarse)": {
851
+ ".cm-tooltip-autocomplete > ul > li": { minHeight: "48px" }
852
+ }
853
+ });
730
854
  var SectionGeometryPlugin = class {
731
855
  constructor(view) {
732
856
  this.view = view;
@@ -4637,7 +4761,7 @@ function EditorDialog({
4637
4761
  const handleKeyDown = (event) => {
4638
4762
  if (event.key === "Escape") {
4639
4763
  event.stopPropagation();
4640
- onClose();
4764
+ if (!event.defaultPrevented) onClose();
4641
4765
  return;
4642
4766
  }
4643
4767
  if (event.key !== "Tab") return;
@@ -4793,7 +4917,11 @@ var TARGET_OPTIONS = WQL_FIND_TARGETS.map((t) => ({
4793
4917
  effort: "Find registered movements and benchmarks",
4794
4918
  session: "Find completed workout sessions",
4795
4919
  segment: "Cross-workout segment table",
4796
- event: "Telemetry events table"
4920
+ event: "Telemetry events table",
4921
+ notebook: "Find notebooks \u2014 every notebook, narrowed with notebook:",
4922
+ page: "Find page placements \u2014 notes placed on pages, narrowed with page:",
4923
+ tag: "Find tags \u2014 labels, types, and what they contribute",
4924
+ equipment: "Find equipment notes \u2014 narrowed with equipment: or tags:"
4797
4925
  }[t]
4798
4926
  }));
4799
4927
  var SOURCE_OPTIONS = WQL_SOURCE_VALUES.map((s) => ({
@@ -4801,7 +4929,7 @@ var SOURCE_OPTIONS = WQL_SOURCE_VALUES.map((s) => ({
4801
4929
  label: s.charAt(0).toUpperCase() + s.slice(1),
4802
4930
  description: {
4803
4931
  journal: "Daily journal notes",
4804
- feeds: "Notebook notes",
4932
+ notebooks: "Notebook notes",
4805
4933
  guides: "Static guide pages",
4806
4934
  playground: "Playground scratch pages",
4807
4935
  dashboards: "Dashboard notes",
@@ -4841,9 +4969,9 @@ var CLAUSE_META = {
4841
4969
  target: { label: "Find", inputType: "select", placeholder: "note, block, effort\u2026", placeholderText: ": [target]", icon: "\u{1F3AF}", description: "What to find \u2014 singular", prefix: ":" },
4842
4970
  source: { label: "Where stored", inputType: "select", placeholder: "journal, notebooks\u2026", placeholderText: "source: [scope]", icon: "\u{1F310}", description: "Storage scope \u2014 all sources means no scope", prefix: "source:" },
4843
4971
  text: { label: "Contains", inputType: "freetext", placeholder: "Text query...", placeholderText: "text: [query]", icon: "\u{1F50D}", description: "Raw text substring search", prefix: "text:" },
4844
- catalog: { label: "Catalog", inputType: "select", placeholder: "crossfit-games, hyrox...", placeholderText: "catalog: [directory-id]", icon: "\u{1F4D3}", description: "Filter by catalog directory id, e.g. crossfit-games", prefix: "catalog:" },
4845
4972
  notebook: { label: "Notebook", inputType: "select", placeholder: "Pick notebook...", placeholderText: "notebook: [id]", icon: "\u{1F4D3}", description: "Filter by canonical notebook container id, e.g. notebook/journal, notebook/playground, notebook/guides", prefix: "notebook:" },
4846
4973
  tag: { label: "Tag", inputType: "select", placeholder: "Pick tag...", placeholderText: "tags: [tag]", icon: "\u{1F3F7}", description: "Filter by note/workout tags", prefix: "tags:" },
4974
+ contributes: { label: "Contributes", inputType: "select", placeholder: "metric, tag, function\u2026", placeholderText: "contributes: [kind]", icon: "\u2747", description: "On :tag \u2014 what a tag contributes (metric, tag:<slug>, function:<name>) \u2014 never a label filter", prefix: "contributes:" },
4847
4975
  effort: { label: "Effort", inputType: "select", placeholder: "Pick effort...", placeholderText: "effort: [movement]", icon: "\u{1F4AA}", description: "Filter by movement/workout", prefix: "effort:" },
4848
4976
  domain: { label: "Domain", inputType: "select", placeholder: "crossfit, parkour, swimming\u2026", placeholderText: "domain: [discipline]", icon: "\u{1F310}", description: "Filter by sport/training domain", prefix: "domain:" },
4849
4977
  format: { label: "Format", inputType: "select", placeholder: "for-time, amrap, emom\u2026", placeholderText: "format: [shape]", icon: "\u23F1", description: "Filter by session time structure", prefix: "format:" },
@@ -4864,7 +4992,7 @@ var CLAUSE_META = {
4864
4992
  result: { label: "Session", inputType: "freetext", placeholder: "result id\u2026", placeholderText: "result: [id]", icon: "\u{1F3C1}", description: "Scope to one workout session", prefix: "result:" },
4865
4993
  block: { label: "Block", inputType: "freetext", placeholder: "block content id\u2026", placeholderText: "block: [contentId]", icon: "\u{1F9F1}", description: "Scope to all versions of a block", prefix: "block:" },
4866
4994
  note: { label: "Note", inputType: "freetext", placeholder: "note id\u2026", placeholderText: "note: [id]", icon: "\u{1F4D3}", description: "Scope to one note", prefix: "note:" },
4867
- page: { label: "Page", inputType: "select", placeholder: "true, false\u2026", placeholderText: "page: [true|false]", icon: "\u{1F4C4}", description: "Notes that are (or are not) pages", prefix: "page:" },
4995
+ page: { label: "Page", inputType: "select", placeholder: "slug, date, true\u2026", placeholderText: "page: [slug|date]", icon: "\u{1F4C4}", description: "On :page \u2014 the page slug or YYYY-MM-DD date; on :note \u2014 page-ness (true/false)", prefix: "page:" },
4868
4996
  plane: { label: "Output Plane", inputType: "select", placeholder: "segment, load, event\u2026", placeholderText: "plane: [type]", icon: "\u{1F4CB}", description: "Output-statement plane on :session", prefix: "plane:" },
4869
4997
  pipes: { label: "Pipes", inputType: "freetext", placeholder: "| order by date | limit 10", placeholderText: "| select | order | limit", icon: "\u21E5", description: "Presentation pipes \u2014 select/order/limit/offset" }
4870
4998
  };
@@ -5131,8 +5259,8 @@ function InlineClauseEditor({
5131
5259
  }
5132
5260
  var MULTI_VALUE_TYPES = {
5133
5261
  tag: true,
5134
- catalog: true,
5135
5262
  notebook: true,
5263
+ contributes: true,
5136
5264
  effort: true,
5137
5265
  domain: true,
5138
5266
  format: true,
@@ -5171,13 +5299,11 @@ function tagsFromStaticBlocks(blocks) {
5171
5299
  }
5172
5300
  return Array.from(set).sort((a, b) => a.localeCompare(b));
5173
5301
  }
5174
- function catalogIdsFromBlocks(blocks) {
5302
+ function notebookSlugsFromBlocks(blocks) {
5175
5303
  const set = /* @__PURE__ */ new Set();
5176
5304
  for (const b of blocks) {
5177
- if (b.sourceId && b.sourceId.startsWith("collection:")) {
5178
- const catalog = catalogOfItem(b);
5179
- if (catalog) set.add(catalog);
5180
- }
5305
+ const slug = notebookSlugOfSourceId(b.sourceId);
5306
+ if (slug) set.add(slug);
5181
5307
  }
5182
5308
  return Array.from(set).sort((a, b) => a.localeCompare(b));
5183
5309
  }
@@ -5218,12 +5344,6 @@ var builtinBindings = {
5218
5344
  open: false,
5219
5345
  emptyText: "No disciplines available"
5220
5346
  },
5221
- catalog: {
5222
- load: async () => [],
5223
- cache: "static",
5224
- open: false,
5225
- emptyText: "No catalogs in the static corpus"
5226
- },
5227
5347
  notebook: {
5228
5348
  load: async () => [],
5229
5349
  cache: "static",
@@ -5241,6 +5361,14 @@ var builtinBindings = {
5241
5361
  cache: "static",
5242
5362
  open: false,
5243
5363
  emptyText: "No indexed block types yet"
5364
+ },
5365
+ // Tag-plane contribution kinds (ticket 08) — an open slot: qualifiers like
5366
+ // `metric:rpe` or `function:calc.e1rm` are typed, never listed as labels.
5367
+ contributes: {
5368
+ load: async () => canonicalSuggestionItems(["metric", "tag", "function"]),
5369
+ cache: "static",
5370
+ open: true,
5371
+ emptyText: "metric, tag, or function"
5244
5372
  }
5245
5373
  };
5246
5374
  var SUGGESTION_BINDINGS = { ...builtinBindings };
@@ -5975,38 +6103,9 @@ function WqlTextEditor({ value, onChange, onSubmit, onEscape, placeholder: place
5975
6103
  '.cm-line span[class*="tok-"]:hover, .cm-line span[class^="tok-"]:hover': { fontWeight: "700", textShadow: "0 0 0.5px currentColor", cursor: "pointer" },
5976
6104
  ".cm-scroller": { overflow: "auto" },
5977
6105
  ".cm-placeholder": { color: "hsl(var(--muted-foreground))" },
5978
- ".cm-tooltip": {
5979
- backgroundColor: "hsl(var(--popover))",
5980
- color: "hsl(var(--popover-foreground))",
5981
- border: "1px solid hsl(var(--border))",
5982
- borderRadius: "12px",
5983
- boxShadow: "0 8px 24px rgb(0 0 0 / 0.16)",
5984
- fontFamily: "var(--font-sans, Inter, system-ui, sans-serif)",
5985
- fontSize: "14px"
5986
- },
5987
- ".cm-tooltip-autocomplete": { overflow: "hidden", minWidth: "min(18rem, calc(100vw - 2rem))", maxWidth: "calc(100vw - 2rem)" },
5988
- ".cm-tooltip-autocomplete > ul": { padding: "4px", maxHeight: "min(20rem, 45vh)", overscrollBehavior: "contain" },
5989
- ".cm-tooltip-autocomplete > ul > li": {
5990
- display: "flex",
5991
- alignItems: "center",
5992
- gap: "8px",
5993
- minHeight: "40px",
5994
- padding: "8px 10px",
5995
- borderRadius: "8px",
5996
- lineHeight: "20px"
5997
- },
5998
- ".cm-tooltip-autocomplete > ul > li:hover": { backgroundColor: "hsl(var(--muted))" },
5999
- ".cm-tooltip-autocomplete > ul > li[aria-selected]": {
6000
- backgroundColor: "hsl(var(--accent))",
6001
- color: "hsl(var(--accent-foreground))",
6002
- boxShadow: "inset 2px 0 hsl(var(--primary))"
6003
- },
6004
- ".wql-completion-icon": { display: "inline-flex", flexShrink: "0", color: "hsl(var(--primary))" },
6005
- ".cm-completionLabel": { fontWeight: "500", overflow: "hidden", textOverflow: "ellipsis" },
6006
- ".cm-completionMatchedText": { textDecoration: "none", fontWeight: "700", color: "hsl(var(--primary))" },
6007
- ".cm-completionDetail": { marginLeft: "auto", paddingLeft: "12px", fontSize: "12px", fontStyle: "normal", color: "hsl(var(--muted-foreground))" },
6008
- "@media (pointer: coarse)": { ".cm-tooltip-autocomplete > ul > li": { minHeight: "48px" } }
6009
- })
6106
+ ".wql-completion-icon": { display: "inline-flex", flexShrink: "0", color: "hsl(var(--primary))" }
6107
+ }),
6108
+ autocompleteTooltipTheme
6010
6109
  ]
6011
6110
  })
6012
6111
  });
@@ -6784,8 +6883,8 @@ function AnalyticsChart({
6784
6883
  function containerPageHref(container) {
6785
6884
  if (!container || container.kind !== "page") return void 0;
6786
6885
  const { slug, date } = container;
6787
- if (slug) return `/p/${encodeURIComponent(slug)}`;
6788
- if (date) return `/journal/${encodeURIComponent(date)}`;
6886
+ if (slug) return `/page/${encodeURIComponent(slug)}`;
6887
+ if (date) return `/day/${encodeURIComponent(date)}`;
6789
6888
  return void 0;
6790
6889
  }
6791
6890
  function FindResultList({
@@ -12797,6 +12896,7 @@ function editorPreset(optionsOrDialect = "markdown") {
12797
12896
  onResultSaved,
12798
12897
  catalog,
12799
12898
  tagTypeValues,
12899
+ whiteboardScript: whiteboardScriptCompletion,
12800
12900
  extensions: extraExtensions = []
12801
12901
  } = options;
12802
12902
  const extensions = [
@@ -12816,6 +12916,8 @@ function editorPreset(optionsOrDialect = "markdown") {
12816
12916
  indentWithTab
12817
12917
  ]),
12818
12918
  editorTheme(isDark),
12919
+ // One token-based autocomplete tooltip theme for every dialect.
12920
+ autocompleteTooltipTheme,
12819
12921
  lineIdsExtension,
12820
12922
  smartIncrement
12821
12923
  ];
@@ -12830,10 +12932,18 @@ function editorPreset(optionsOrDialect = "markdown") {
12830
12932
  extensions.push(wql(completionOptions));
12831
12933
  } else if (dialect === "wod" || dialect === "whiteboard" || dialect === "time") {
12832
12934
  extensions.push(
12833
- whiteboardScript(),
12935
+ whiteboardScript(whiteboardScriptCompletion),
12834
12936
  wodLinter
12835
12937
  );
12836
12938
  } else {
12939
+ const nestedWql = {
12940
+ ...catalog ? { catalog } : {},
12941
+ ...tagTypeValues ? { tagTypeValues } : {}
12942
+ };
12943
+ const nestedOptions = {
12944
+ ...Object.keys(nestedWql).length ? { wql: nestedWql } : {},
12945
+ ...whiteboardScriptCompletion ? { whiteboardScript: whiteboardScriptCompletion } : {}
12946
+ };
12837
12947
  extensions.push(
12838
12948
  markdown({ codeLanguages: resolveCodeLanguage }),
12839
12949
  sectionField,
@@ -12843,6 +12953,7 @@ function editorPreset(optionsOrDialect = "markdown") {
12843
12953
  wodAutocompletion,
12844
12954
  wodEditorKeymap,
12845
12955
  wodAutoWrap,
12956
+ ...Object.keys(nestedOptions).length ? [nestedCompletionOptions.of(nestedOptions)] : [],
12846
12957
  linkOpen,
12847
12958
  markdownSyntaxHiding(),
12848
12959
  markdownTablePreview,
@@ -12856,6 +12967,6 @@ function editorPreset(optionsOrDialect = "markdown") {
12856
12967
  return extensions;
12857
12968
  }
12858
12969
 
12859
- export { AGG_OPTIONS, CANONICAL_BLOCK_TYPES, CLAUSE_META, ComposerRegistry, DEFAULT_DIAGNOSTICS_DEBOUNCE_MS, DEFAULT_OUTPUT_FILTERS, DEFAULT_PRIMARY_FILTER, DefaultFrontmatterWidget, EditorDialog, GROUPBY_OPTIONS, GoalRings, KIND_OPTIONS, METRIC_OPTIONS, MULTI_VALUE_TYPES, MetricBadge, OUTPUT_TYPE_CLASS, OUTPUT_TYPE_DOT, OutputFilterPills, OutputStatementsTable, PLANE_OPTIONS, ProposedMetricBadge, QueryBlockView, 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, blockTypesFromBlocks, canonicalSuggestionItems, catalogIdsFromBlocks, cn, compactNumber, composerRegistry, configureOverlayActions, cursorFocusExtension, dateRangeSlot, dispatchAddRuntimePanel, dispatchExpandRuntimePanel, dispatchGutterHighlights, dispatchRemoveRuntimePanel, editQueryClause, editingWidgetsField, editorPreset, editorTheme, embedPreviewDecorations, expandRuntimePanel, extractBlockQueries, extractMetricsByCategory, fenceCompletion, findQueryBlockSection, findWorkoutErrors, forceSectionParse, formatClockTime, formatMMSS, formatTimestamp, frontmatterPreview, frontmatterPreviewField, frontmatterReferenceIndex, frontmatterSuggestions, frontmatterVisibility, getClauseMeta, getCursorFocusState, getOverlayActions, getSuggestionBinding, gutterHighlightsField, gutterUnified, handleFenceAutoWrap, hashCode, inlineButtonDecoration, invalidateSuggestions, lineIdsExtension, linkOpen, linkPreview, loadSuggestions, markdownSyntaxHiding, markdownTablePreview, matchFilterTypeahead, mergeSeries, mergeSuggestionItems, mergeTagSuggestions, navigationFacet, normalizeOutputFilter, patchBlockQuery, presentBadges, previewDecorations, queryBlockPreview, readSessionRpe, referenceIndexReload, registerCustomCompletionSource, registeredSectionWidgets, removeRuntimePanel, resolveQueryDraft, runtimePanelField, saveBlockQuerySource, sectionAtPos, sectionField, sectionGeometry, sectionIdentity, sectionIdentityHistory, sectionMove, sectionRestore, sectionSaved, sessionQueryInsert, sessionQueryWql, setGutterHighlights, setSuggestionBinding, smartIncrement, summarizeAggregate, summarizeFind, summarizePipeline, tagsFromStaticBlocks, toChartResult, toggleWidgetEdit, tooltipTimestamp, unregisterCustomCompletionSource, urlAtPos, useChartShape, useComposerSlots, useSuggestions, useVisualViewportRect, useWqlStageCounts, widgetBlockPreview, wodAutoWrap, wodAutocompletion, wodEditorKeymap, wodLinter, wodOverlayPanel, workoutLintSource, wqlToPills, wrapInTimeFence };
12860
- //# sourceMappingURL=chunk-7OSBFQY7.mjs.map
12861
- //# sourceMappingURL=chunk-7OSBFQY7.mjs.map
12970
+ export { AGG_OPTIONS, CANONICAL_BLOCK_TYPES, CLAUSE_META, ComposerRegistry, DEFAULT_DIAGNOSTICS_DEBOUNCE_MS, DEFAULT_OUTPUT_FILTERS, DEFAULT_PRIMARY_FILTER, DefaultFrontmatterWidget, EditorDialog, GROUPBY_OPTIONS, GoalRings, KIND_OPTIONS, METRIC_OPTIONS, MULTI_VALUE_TYPES, MetricBadge, OUTPUT_TYPE_CLASS, OUTPUT_TYPE_DOT, OutputFilterPills, OutputStatementsTable, PLANE_OPTIONS, ProposedMetricBadge, QueryBlockView, 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, autocompleteTooltipTheme, blockTypesFromBlocks, canonicalSuggestionItems, cn, compactNumber, composerRegistry, configureOverlayActions, cursorFocusExtension, customCompletionSources, dateRangeSlot, dispatchAddRuntimePanel, dispatchExpandRuntimePanel, dispatchGutterHighlights, dispatchRemoveRuntimePanel, editQueryClause, editingWidgetsField, editorPreset, editorTheme, embedPreviewDecorations, expandRuntimePanel, extractBlockQueries, extractMetricsByCategory, fenceCompletion, findQueryBlockSection, findWorkoutErrors, forceSectionParse, formatClockTime, formatMMSS, formatTimestamp, frontmatterPreview, frontmatterPreviewField, frontmatterReferenceIndex, frontmatterSuggestions, frontmatterVisibility, getClauseMeta, getCursorFocusState, getOverlayActions, getSuggestionBinding, gutterHighlightsField, gutterUnified, handleFenceAutoWrap, hashCode, inlineButtonDecoration, invalidateSuggestions, lineIdsExtension, linkOpen, linkPreview, loadSuggestions, markdownSyntaxHiding, markdownTablePreview, matchFilterTypeahead, mergeSeries, mergeSuggestionItems, mergeTagSuggestions, navigationFacet, nestedCompletion, nestedCompletionOptions, normalizeOutputFilter, notebookSlugsFromBlocks, patchBlockQuery, presentBadges, previewDecorations, queryBlockPreview, readSessionRpe, referenceIndexReload, registeredSectionWidgets, removeRuntimePanel, resolveCodeLanguage, resolveQueryDraft, runtimePanelField, saveBlockQuerySource, sectionAtPos, sectionField, sectionGeometry, sectionIdentity, sectionIdentityHistory, sectionMove, sectionRestore, sectionSaved, sessionQueryInsert, sessionQueryWql, setGutterHighlights, setSuggestionBinding, smartIncrement, summarizeAggregate, summarizeFind, summarizePipeline, tagsFromStaticBlocks, toChartResult, toggleWidgetEdit, tooltipTimestamp, urlAtPos, useChartShape, useComposerSlots, useSuggestions, useVisualViewportRect, useWqlStageCounts, widgetBlockPreview, wodAutoWrap, wodAutocompletion, wodCompletionSource, wodEditorKeymap, wodLinter, wodOverlayPanel, workoutLintSource, wqlToPills, wrapInTimeFence };
12971
+ //# sourceMappingURL=chunk-QCWASNQO.mjs.map
12972
+ //# sourceMappingURL=chunk-QCWASNQO.mjs.map