@bitcobblers/wod-wiki-ui 0.8.39 → 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.
@@ -3057,7 +3057,8 @@ function restoreFilters(rest) {
3057
3057
  function wqlToClauses(wql2) {
3058
3058
  const suffixes = wodWikiWql.parseWqlSuffixes(wql2.trim());
3059
3059
  if (suffixes.conflicts?.length) return null;
3060
- const { where, displayUnit, groupBy, rollup, last, scope, primaryText } = suffixes;
3060
+ const { where, displayUnit, groupBy, rollup, window: window2, legacyScope, primaryText } = suffixes;
3061
+ if (window2?.kind === "range") return null;
3061
3062
  const rowsMatch = /^rows(?:\:([a-zA-Z0-9_-]+))?\:?/.exec(primaryText);
3062
3063
  if (rowsMatch) {
3063
3064
  if (where || groupBy || rollup) return null;
@@ -3066,7 +3067,7 @@ function wqlToClauses(wql2) {
3066
3067
  if (!filterClauses2) return null;
3067
3068
  const clauses2 = [
3068
3069
  restoreClause("c-source", "source", "rows"),
3069
- restoreClause("c-time", "time", last ? `last ${last.size}${last.unit}` : "all"),
3070
+ restoreClause("c-time", "time", window2?.kind === "relative" ? `last ${window2.size}${window2.unit}` : "all"),
3070
3071
  ...rowsMatch[1] ? [restoreClause("c-output", "output", rowsMatch[1])] : [],
3071
3072
  ...filterClauses2
3072
3073
  ];
@@ -3080,17 +3081,20 @@ function wqlToClauses(wql2) {
3080
3081
  const rest2 = primaryText.slice(headMatch2[0].length).trim();
3081
3082
  const filterClauses2 = restoreFilters(rest2);
3082
3083
  if (!filterClauses2) return null;
3083
- const timeValue = last ? `last ${last.size}${last.unit}` : "all";
3084
- const scopeValue = scope;
3084
+ const timeValue = window2?.kind === "relative" ? `last ${window2.size}${window2.unit}` : "all";
3085
+ const sourceClauseIdx = filterClauses2.findIndex((c) => c.type === "source");
3086
+ const sourceFromFilter = sourceClauseIdx !== -1 ? filterClauses2[sourceClauseIdx].value : void 0;
3087
+ const scopeValue = legacyScope ?? sourceFromFilter;
3088
+ const remainingFilterClauses = sourceClauseIdx !== -1 ? filterClauses2.filter((_, idx) => idx !== sourceClauseIdx) : filterClauses2;
3085
3089
  const sourceValue = targetValue === "block" ? "blocks" : targetValue === "effort" ? "efforts" : !scopeValue || scopeValue === "all" ? "notes" : scopeValue;
3086
3090
  const clauses2 = [
3087
3091
  restoreClause("c-source", "source", sourceValue),
3088
3092
  restoreClause("c-time", "time", timeValue),
3089
- ...filterClauses2
3093
+ ...remainingFilterClauses
3090
3094
  ];
3091
- if (where) clauses2.push(restoreClause("c-where", "where", where));
3092
3095
  return clauses2;
3093
3096
  }
3097
+ if (window2) return null;
3094
3098
  const headMatch = RESTORE_AGG_HEAD_RE.exec(primaryText);
3095
3099
  if (!headMatch) return null;
3096
3100
  const aggValue = headMatch[1];
@@ -3592,10 +3596,12 @@ function AddCalcDropdown({
3592
3596
  ] });
3593
3597
  }
3594
3598
  function summarizeFind(ast) {
3599
+ const sourceFilter = ast.filters.find((f) => f.key === "source");
3600
+ const scope = sourceFilter ? sourceFilter.values.map((v) => v.value).join(",") : "all";
3595
3601
  return {
3596
3602
  target: ast.target,
3597
- scope: ast.scope || "all",
3598
- timeWindow: ast.last ? `last ${ast.last.size}${ast.last.unit}` : void 0,
3603
+ scope,
3604
+ 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,
3599
3605
  hasJoin: Boolean(ast.join),
3600
3606
  filterCount: ast.filters.length
3601
3607
  };