@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.
@@ -1481,7 +1481,7 @@ function dispatchExpandRuntimePanel(view, sectionId, expanded) {
1481
1481
 
1482
1482
  // src/extensions/sessionQueryBlock.ts
1483
1483
  function sessionQueryWql(resultId) {
1484
- return `rows:{result:${resultId}}`;
1484
+ return `rows:all{result:${resultId}}`;
1485
1485
  }
1486
1486
  function sessionQueryInsert(state, blockId, resultId, runBlock) {
1487
1487
  const sections = state.field(sectionField).sections;
@@ -1830,7 +1830,7 @@ function RowsResultsChrome({
1830
1830
  return;
1831
1831
  }
1832
1832
  let cancelled = false;
1833
- const wideQuery = wodWikiWql.parseQuery(`rows:{block:${blockContentId2}}`);
1833
+ const wideQuery = wodWikiWql.parseQuery(`rows:all{block:${blockContentId2}}`);
1834
1834
  if (!wodWikiWql.isRowsQuery(wideQuery)) return;
1835
1835
  void executor.runRows(wideQuery).then((res) => {
1836
1836
  if (!cancelled) setWideResult(res);
@@ -2950,7 +2950,7 @@ function clausesToWql(clauses) {
2950
2950
  const filterBraces = filterParts.length > 0 ? `{${filterParts.join(", ")}}` : "";
2951
2951
  const source = clauseValue(clauses, "source", "notes");
2952
2952
  if (source === "rows") {
2953
- const output = clauseValue(clauses, "output", "");
2953
+ const output = clauseValue(clauses, "output", "") || "all";
2954
2954
  const timeClause2 = clauses.find((c) => c.type === "time");
2955
2955
  let timeStr2 = "";
2956
2956
  if (timeClause2 && timeClause2.value && timeClause2.value !== "all") {
@@ -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
  ];
@@ -3076,20 +3077,24 @@ function wqlToClauses(wql2) {
3076
3077
  const headMatch2 = RESTORE_FIND_HEAD_RE.exec(primaryText);
3077
3078
  if (!headMatch2) return null;
3078
3079
  const targetValue = headMatch2[1];
3080
+ if (!wodWikiWql.WQL_FIND_TARGETS.includes(targetValue)) return null;
3079
3081
  const rest2 = primaryText.slice(headMatch2[0].length).trim();
3080
3082
  const filterClauses2 = restoreFilters(rest2);
3081
3083
  if (!filterClauses2) return null;
3082
- const timeValue = last ? `last ${last.size}${last.unit}` : "all";
3083
- 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;
3084
3089
  const sourceValue = targetValue === "block" ? "blocks" : targetValue === "effort" ? "efforts" : !scopeValue || scopeValue === "all" ? "notes" : scopeValue;
3085
3090
  const clauses2 = [
3086
3091
  restoreClause("c-source", "source", sourceValue),
3087
3092
  restoreClause("c-time", "time", timeValue),
3088
- ...filterClauses2
3093
+ ...remainingFilterClauses
3089
3094
  ];
3090
- if (where) clauses2.push(restoreClause("c-where", "where", where));
3091
3095
  return clauses2;
3092
3096
  }
3097
+ if (window2) return null;
3093
3098
  const headMatch = RESTORE_AGG_HEAD_RE.exec(primaryText);
3094
3099
  if (!headMatch) return null;
3095
3100
  const aggValue = headMatch[1];
@@ -3591,10 +3596,12 @@ function AddCalcDropdown({
3591
3596
  ] });
3592
3597
  }
3593
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";
3594
3601
  return {
3595
3602
  target: ast.target,
3596
- scope: ast.scope || "all",
3597
- 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,
3598
3605
  hasJoin: Boolean(ast.join),
3599
3606
  filterCount: ast.filters.length
3600
3607
  };