@bitcobblers/wod-wiki-ui 0.7.38 → 0.9.40

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.
@@ -4,7 +4,7 @@ import { tags, styleTags, Tag } 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
6
  import { whiteboardScriptLanguage, createParser, getAnalyticsFromLogs, whiteboardScript } from '@bitcobblers/wod-wiki-lang';
7
- import { WQL_SOURCES, WQL_AGGREGATORS, WQL_ROLLUP_PERIODS, WQL_VIRTUAL_DIMS, WQL_TAG_KEYS, WQL_METRIC_AGGREGATES, WQL_METRIC_FAMILIES, WQL_CALC_TARGETS, WQL_DISPLAY_UNITS, WQL_INTENSITY_TIERS, parseQueryWidgetSuffix, WQL_COMPARISON_OPS, parseQuery, isRowsQuery, isDashboardWidgetType, unknownWidgetTypeMessage, resolveWidgetType, PLANNED_WIDGET_TYPES, parseWqlSuffixes, isFindQuery, isAggregateQuery, splitWidgetBody, substituteTokens, unknownTokensMessage, wql, wqlLanguage } from '@bitcobblers/wod-wiki-wql';
7
+ import { WQL_SOURCES, WQL_AGGREGATORS, WQL_ROLLUP_PERIODS, WQL_VIRTUAL_DIMS, WQL_TAG_KEYS, WQL_METRIC_AGGREGATES, WQL_METRIC_FAMILIES, WQL_CALC_TARGETS, WQL_DISPLAY_UNITS, WQL_INTENSITY_TIERS, parseQueryWidgetSuffix, WQL_COMPARISON_OPS, parseQuery, isRowsQuery, isDashboardWidgetType, unknownWidgetTypeMessage, resolveWidgetType, PLANNED_WIDGET_TYPES, parseWqlSuffixes, WQL_FIND_TARGETS, isFindQuery, isAggregateQuery, splitWidgetBody, substituteTokens, unknownTokensMessage, wql, wqlLanguage } from '@bitcobblers/wod-wiki-wql';
8
8
  import { clsx } from 'clsx';
9
9
  import { twMerge } from 'tailwind-merge';
10
10
  import { snippet, autocompletion, closeBrackets, closeBracketsKeymap, CompletionContext, ifNotIn, completeFromList, snippetCompletion } from '@codemirror/autocomplete';
@@ -1460,7 +1460,7 @@ function dispatchExpandRuntimePanel(view, sectionId, expanded) {
1460
1460
 
1461
1461
  // src/extensions/sessionQueryBlock.ts
1462
1462
  function sessionQueryWql(resultId) {
1463
- return `rows:{result:${resultId}}`;
1463
+ return `rows:all{result:${resultId}}`;
1464
1464
  }
1465
1465
  function sessionQueryInsert(state, blockId, resultId, runBlock) {
1466
1466
  const sections = state.field(sectionField).sections;
@@ -1809,7 +1809,7 @@ function RowsResultsChrome({
1809
1809
  return;
1810
1810
  }
1811
1811
  let cancelled = false;
1812
- const wideQuery = parseQuery(`rows:{block:${blockContentId2}}`);
1812
+ const wideQuery = parseQuery(`rows:all{block:${blockContentId2}}`);
1813
1813
  if (!isRowsQuery(wideQuery)) return;
1814
1814
  void executor.runRows(wideQuery).then((res) => {
1815
1815
  if (!cancelled) setWideResult(res);
@@ -3004,7 +3004,7 @@ function clausesToWql(clauses) {
3004
3004
  const filterBraces = filterParts.length > 0 ? `{${filterParts.join(", ")}}` : "";
3005
3005
  const source = clauseValue(clauses, "source", "notes");
3006
3006
  if (source === "rows") {
3007
- const output = clauseValue(clauses, "output", "");
3007
+ const output = clauseValue(clauses, "output", "") || "all";
3008
3008
  const timeClause2 = clauses.find((c) => c.type === "time");
3009
3009
  let timeStr2 = "";
3010
3010
  if (timeClause2 && timeClause2.value && timeClause2.value !== "all") {
@@ -3111,7 +3111,8 @@ function restoreFilters(rest) {
3111
3111
  function wqlToClauses(wql2) {
3112
3112
  const suffixes = parseWqlSuffixes(wql2.trim());
3113
3113
  if (suffixes.conflicts?.length) return null;
3114
- const { where, displayUnit, groupBy, rollup, last, scope, primaryText } = suffixes;
3114
+ const { where, displayUnit, groupBy, rollup, window: window2, legacyScope, primaryText } = suffixes;
3115
+ if (window2?.kind === "range") return null;
3115
3116
  const rowsMatch = /^rows(?:\:([a-zA-Z0-9_-]+))?\:?/.exec(primaryText);
3116
3117
  if (rowsMatch) {
3117
3118
  if (where || groupBy || rollup) return null;
@@ -3120,7 +3121,7 @@ function wqlToClauses(wql2) {
3120
3121
  if (!filterClauses2) return null;
3121
3122
  const clauses2 = [
3122
3123
  restoreClause("c-source", "source", "rows"),
3123
- restoreClause("c-time", "time", last ? `last ${last.size}${last.unit}` : "all"),
3124
+ restoreClause("c-time", "time", window2?.kind === "relative" ? `last ${window2.size}${window2.unit}` : "all"),
3124
3125
  ...rowsMatch[1] ? [restoreClause("c-output", "output", rowsMatch[1])] : [],
3125
3126
  ...filterClauses2
3126
3127
  ];
@@ -3130,20 +3131,24 @@ function wqlToClauses(wql2) {
3130
3131
  const headMatch2 = RESTORE_FIND_HEAD_RE.exec(primaryText);
3131
3132
  if (!headMatch2) return null;
3132
3133
  const targetValue = headMatch2[1];
3134
+ if (!WQL_FIND_TARGETS.includes(targetValue)) return null;
3133
3135
  const rest2 = primaryText.slice(headMatch2[0].length).trim();
3134
3136
  const filterClauses2 = restoreFilters(rest2);
3135
3137
  if (!filterClauses2) return null;
3136
- const timeValue = last ? `last ${last.size}${last.unit}` : "all";
3137
- const scopeValue = scope;
3138
+ const timeValue = window2?.kind === "relative" ? `last ${window2.size}${window2.unit}` : "all";
3139
+ const sourceClauseIdx = filterClauses2.findIndex((c) => c.type === "source");
3140
+ const sourceFromFilter = sourceClauseIdx !== -1 ? filterClauses2[sourceClauseIdx].value : void 0;
3141
+ const scopeValue = legacyScope ?? sourceFromFilter;
3142
+ const remainingFilterClauses = sourceClauseIdx !== -1 ? filterClauses2.filter((_, idx) => idx !== sourceClauseIdx) : filterClauses2;
3138
3143
  const sourceValue = targetValue === "block" ? "blocks" : targetValue === "effort" ? "efforts" : !scopeValue || scopeValue === "all" ? "notes" : scopeValue;
3139
3144
  const clauses2 = [
3140
3145
  restoreClause("c-source", "source", sourceValue),
3141
3146
  restoreClause("c-time", "time", timeValue),
3142
- ...filterClauses2
3147
+ ...remainingFilterClauses
3143
3148
  ];
3144
- if (where) clauses2.push(restoreClause("c-where", "where", where));
3145
3149
  return clauses2;
3146
3150
  }
3151
+ if (window2) return null;
3147
3152
  const headMatch = RESTORE_AGG_HEAD_RE.exec(primaryText);
3148
3153
  if (!headMatch) return null;
3149
3154
  const aggValue = headMatch[1];
@@ -3650,10 +3655,12 @@ function AddCalcDropdown({
3650
3655
  ] });
3651
3656
  }
3652
3657
  function summarizeFind(ast) {
3658
+ const sourceFilter = ast.filters.find((f) => f.key === "source");
3659
+ const scope = sourceFilter ? sourceFilter.values.map((v) => v.value).join(",") : "all";
3653
3660
  return {
3654
3661
  target: ast.target,
3655
- scope: ast.scope || "all",
3656
- timeWindow: ast.last ? `last ${ast.last.size}${ast.last.unit}` : void 0,
3662
+ scope,
3663
+ timeWindow: ast.window ? ast.window.kind === "relative" ? `last ${ast.window.size}${ast.window.unit}` : `from ${ast.window.start}${ast.window.end ? ` to ${ast.window.end}` : ""}` : void 0,
3657
3664
  hasJoin: Boolean(ast.join),
3658
3665
  filterCount: ast.filters.length
3659
3666
  };
@@ -10369,5 +10376,5 @@ function editorPreset(optionsOrDialect = "markdown") {
10369
10376
  }
10370
10377
 
10371
10378
  export { AGG_OPTIONS, AddCalcDropdown, AddFilterDropdown, CLAUSE_META, CONTENT_SOURCES, ClausePopover, ComposerRegistry, CustomSlotPopover, DEFAULT_DIAGNOSTICS_DEBOUNCE_MS, DefaultFrontmatterWidget, GROUPBY_OPTIONS, GoalRings, METRIC_OPTIONS, MULTI_VALUE_TYPES, ProposedMetricBadge, QueryBlockView, QueryValue, ROLLUP_OPTIONS, RowsResultsChrome, RowsTable, SERIES_COLORS, SOURCE_OPTIONS, SUGGESTION_BINDINGS, StackedBar, TIME_OPTIONS, TokenSlotPill, TopList, UNIT_OPTIONS, WHERE_AGGREGATORS, WHERE_METRICS, WHERE_OPERATORS, WidgetChart, WidgetProblemBadge, WqlBars, WqlComposer, WqlDiagnosticsStrip, WqlEmptyState, WqlQueryInspectorModal, WqlTable, WqlTimeseries, ZoneDistribution, activeCursorSection, addRuntimePanel, blockContentId, blockTypesFromBlocks, catalogIdsFromBlocks, clauseToWql, clauseValue, clausesToWql, cn, compactNumber, composerRegistry, configureOverlayActions, cursorFocusExtension, dateRangeSlot, defaultClauses, defaultMetricsClauses, diagnoseClauses, dispatchAddRuntimePanel, dispatchExpandRuntimePanel, dispatchGutterHighlights, dispatchRemoveRuntimePanel, editingWidgetsField, editorPreset, editorTheme, embedPreviewDecorations, expandRuntimePanel, extractBlockQueries, fenceCompletion, findQueryBlockSection, findWorkoutErrors, forceSectionParse, formatTimestamp, frontmatterPreview, frontmatterPreviewField, getClauseMeta, getCursorFocusState, getOverlayActions, getSuggestionBinding, gutterHighlightsField, gutterUnified, handleFenceAutoWrap, hashCode, inlineButtonDecoration, invalidateSuggestions, lineIdsExtension, linkOpen, loadSuggestions, markdownSyntaxHiding, markdownTablePreview, mergeSeries, mergeTagSuggestions, navigationFacet, patchBlockQuery, pivotClauses, previewDecorations, queryBlockPreview, readSessionRpe, removeRuntimePanel, runtimePanelField, saveBlockQuerySource, sectionAtPos, sectionField, sectionGeometry, sessionQueryInsert, sessionQueryWql, setGutterHighlights, setMetricClause, setSuggestionBinding, smartIncrement, sourcePlane, summarizeAggregate, summarizeFind, tagsFromStaticBlocks, toggleWidgetEdit, tooltipTimestamp, urlAtPos, useChartShape, useComposerSlots, useSuggestions, useWqlStageCounts, widgetBlockPreview, wodAutoWrap, wodAutocompletion, wodEditorKeymap, wodLinter, wodOverlayPanel, workoutLintSource, wqlToClauses, wrapInTimeFence };
10372
- //# sourceMappingURL=chunk-3ANAQJ6S.mjs.map
10373
- //# sourceMappingURL=chunk-3ANAQJ6S.mjs.map
10379
+ //# sourceMappingURL=chunk-LEM2Y37Q.mjs.map
10380
+ //# sourceMappingURL=chunk-LEM2Y37Q.mjs.map