@bitcobblers/wod-wiki-ui 0.8.39 → 0.10.41

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.
@@ -3027,6 +3027,9 @@ function filterFragmentToClause(fragment, index) {
3027
3027
  const key = fragment.slice(0, colon2);
3028
3028
  const value = fragment.slice(colon2 + 1);
3029
3029
  if (!value.trim()) return null;
3030
+ if (key === "source") {
3031
+ return restoreClause(`c-source-${index}`, "source", value);
3032
+ }
3030
3033
  const builtin = FILTER_KEY_TO_CLAUSE_TYPE[key];
3031
3034
  if (builtin) {
3032
3035
  const restoredValue = builtin === "text" && value.length >= 2 && value.startsWith('"') && value.endsWith('"') ? value.slice(1, -1) : value;
@@ -3057,7 +3060,8 @@ function restoreFilters(rest) {
3057
3060
  function wqlToClauses(wql2) {
3058
3061
  const suffixes = wodWikiWql.parseWqlSuffixes(wql2.trim());
3059
3062
  if (suffixes.conflicts?.length) return null;
3060
- const { where, displayUnit, groupBy, rollup, last, scope, primaryText } = suffixes;
3063
+ const { where, displayUnit, groupBy, rollup, window: window2, legacyScope, primaryText } = suffixes;
3064
+ if (window2?.kind === "range") return null;
3061
3065
  const rowsMatch = /^rows(?:\:([a-zA-Z0-9_-]+))?\:?/.exec(primaryText);
3062
3066
  if (rowsMatch) {
3063
3067
  if (where || groupBy || rollup) return null;
@@ -3066,7 +3070,7 @@ function wqlToClauses(wql2) {
3066
3070
  if (!filterClauses2) return null;
3067
3071
  const clauses2 = [
3068
3072
  restoreClause("c-source", "source", "rows"),
3069
- restoreClause("c-time", "time", last ? `last ${last.size}${last.unit}` : "all"),
3073
+ restoreClause("c-time", "time", window2?.kind === "relative" ? `last ${window2.size}${window2.unit}` : "all"),
3070
3074
  ...rowsMatch[1] ? [restoreClause("c-output", "output", rowsMatch[1])] : [],
3071
3075
  ...filterClauses2
3072
3076
  ];
@@ -3080,17 +3084,21 @@ function wqlToClauses(wql2) {
3080
3084
  const rest2 = primaryText.slice(headMatch2[0].length).trim();
3081
3085
  const filterClauses2 = restoreFilters(rest2);
3082
3086
  if (!filterClauses2) return null;
3083
- const timeValue = last ? `last ${last.size}${last.unit}` : "all";
3084
- const scopeValue = scope;
3087
+ const timeValue = window2?.kind === "relative" ? `last ${window2.size}${window2.unit}` : "all";
3088
+ const sourceClauseIdx = filterClauses2.findIndex((c) => c.type === "source");
3089
+ const sourceFromFilter = sourceClauseIdx !== -1 ? filterClauses2[sourceClauseIdx].value : void 0;
3090
+ const scopeValue = legacyScope ?? sourceFromFilter;
3091
+ const remainingFilterClauses = sourceClauseIdx !== -1 ? filterClauses2.filter((_, idx) => idx !== sourceClauseIdx) : filterClauses2;
3085
3092
  const sourceValue = targetValue === "block" ? "blocks" : targetValue === "effort" ? "efforts" : !scopeValue || scopeValue === "all" ? "notes" : scopeValue;
3086
3093
  const clauses2 = [
3087
3094
  restoreClause("c-source", "source", sourceValue),
3088
3095
  restoreClause("c-time", "time", timeValue),
3089
- ...filterClauses2
3096
+ ...remainingFilterClauses
3090
3097
  ];
3091
3098
  if (where) clauses2.push(restoreClause("c-where", "where", where));
3092
3099
  return clauses2;
3093
3100
  }
3101
+ if (window2) return null;
3094
3102
  const headMatch = RESTORE_AGG_HEAD_RE.exec(primaryText);
3095
3103
  if (!headMatch) return null;
3096
3104
  const aggValue = headMatch[1];
@@ -3592,10 +3600,12 @@ function AddCalcDropdown({
3592
3600
  ] });
3593
3601
  }
3594
3602
  function summarizeFind(ast) {
3603
+ const sourceFilter = ast.filters.find((f) => f.key === "source");
3604
+ const scope = sourceFilter ? sourceFilter.values.map((v) => v.value).join(",") : "all";
3595
3605
  return {
3596
3606
  target: ast.target,
3597
- scope: ast.scope || "all",
3598
- timeWindow: ast.last ? `last ${ast.last.size}${ast.last.unit}` : void 0,
3607
+ scope,
3608
+ 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
3609
  hasJoin: Boolean(ast.join),
3600
3610
  filterCount: ast.filters.length
3601
3611
  };