@bitcobblers/wod-wiki-lang 0.59.2246 → 0.60.2250

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.
package/dist/index.cjs CHANGED
@@ -308,10 +308,27 @@ function computeLabel(metric, _surface) {
308
308
  }
309
309
  return base;
310
310
  }
311
+ function formatTooltipValue(metric) {
312
+ if (isTimeLikeMetric(metric.type) && typeof metric.value === "number") {
313
+ return formatDurationSmart(metric.value);
314
+ }
315
+ const val = metric.value;
316
+ if (val !== null && typeof val === "object") {
317
+ if (metric.image) return metric.image;
318
+ const obj = val;
319
+ if ("amount" in obj && "units" in obj) {
320
+ return obj.amount !== void 0 ? `${obj.amount} ${obj.units}` : String(obj.units);
321
+ }
322
+ if ("text" in obj) return String(obj.text);
323
+ if ("current" in obj) return `Round ${obj.current}`;
324
+ return JSON.stringify(val);
325
+ }
326
+ return String(val);
327
+ }
311
328
  function buildTooltip(metric) {
312
329
  const parts = [];
313
330
  parts.push(`Type: ${metric.type}`);
314
- if (metric.value !== void 0) parts.push(`Value: ${metric.value}`);
331
+ if (metric.value !== void 0) parts.push(`Value: ${formatTooltipValue(metric)}`);
315
332
  if (metric.origin) parts.push(`Origin: ${metric.origin}`);
316
333
  if (metric.sourceBlockKey) parts.push(`Block: ${metric.sourceBlockKey}`);
317
334
  if (metric.timestamp) {
@@ -2237,12 +2254,45 @@ function propertyPair(primitive) {
2237
2254
  meta: primitive.meta
2238
2255
  };
2239
2256
  }
2257
+ function foldRepLadders(pairs) {
2258
+ const folded = [];
2259
+ let i = 0;
2260
+ while (i < pairs.length) {
2261
+ const first = pairs[i];
2262
+ if (first.metrics instanceof RepMetric && typeof first.metrics.reps === "number") {
2263
+ const repItems = [first];
2264
+ let j = i;
2265
+ while (j + 2 < pairs.length && pairs[j + 1].metrics instanceof EffortMetric && pairs[j + 1].metrics.effort === "-" && pairs[j + 1].meta.startOffset - pairs[j].meta.endOffset === 0 && pairs[j + 2].metrics instanceof RepMetric && typeof pairs[j + 2].metrics.reps === "number" && pairs[j + 2].meta.startOffset - pairs[j + 1].meta.endOffset === 0) {
2266
+ repItems.push(pairs[j + 2]);
2267
+ j += 2;
2268
+ }
2269
+ if (repItems.length >= 3) {
2270
+ const last = repItems[repItems.length - 1];
2271
+ const ladderMeta = {
2272
+ ...first.meta,
2273
+ endOffset: last.meta.endOffset,
2274
+ columnEnd: last.meta.columnEnd,
2275
+ length: last.meta.endOffset - first.meta.startOffset,
2276
+ raw: repItems.map((item) => item.meta.raw).join("-")
2277
+ };
2278
+ folded.push({ metrics: new RoundsMetric(repItems.length), meta: ladderMeta });
2279
+ folded.push(...repItems);
2280
+ i = j + 1;
2281
+ continue;
2282
+ }
2283
+ }
2284
+ folded.push(first);
2285
+ i++;
2286
+ }
2287
+ return folded;
2288
+ }
2240
2289
  function mergeFragments(pairs) {
2241
- if (pairs.length < 2) return pairs;
2290
+ const normalized = foldRepLadders(pairs);
2291
+ if (normalized.length < 2) return normalized;
2242
2292
  const result = [];
2243
- let current = pairs[0];
2244
- for (let index = 1; index < pairs.length; index++) {
2245
- const next = pairs[index];
2293
+ let current = normalized[0];
2294
+ for (let index = 1; index < normalized.length; index++) {
2295
+ const next = normalized[index];
2246
2296
  if (current.metrics instanceof EffortMetric && next.metrics instanceof EffortMetric) {
2247
2297
  if (current.metrics.effort === "/" || current.metrics.effort === "|" || next.metrics.effort === "/" || next.metrics.effort === "|") {
2248
2298
  result.push(current);
@@ -10954,7 +11004,7 @@ var ChildSelectionBehavior = class _ChildSelectionBehavior {
10954
11004
  const nextGroup = this.config.childGroups[this.childIndex];
10955
11005
  this.childIndex++;
10956
11006
  this.dispatchedOnLastNext = true;
10957
- const upcomingGroup = this.config.childGroups[this.childIndex];
11007
+ const upcomingGroup = this.config.childGroups[this.childIndex] ?? (this.shouldLoop(ctx) ? this.config.childGroups[0] : void 0);
10958
11008
  return [
10959
11009
  new CompileAndPushBlockAction(nextGroup),
10960
11010
  this.createNextPreview(ctx, upcomingGroup)
@@ -13562,6 +13612,7 @@ var LookupRegistry = class {
13562
13612
 
13563
13613
  // src/analytics/calc/seeds.ts
13564
13614
  var REST_EXCLUSION = "rest|pause|rest-*";
13615
+ var WORKOUT_FENCES = ["time", "log", "wod", "whiteboard", "crossfit"];
13565
13616
  var expr = (id, expression, unit) => ({ id, kind: "expr", expression, unit });
13566
13617
  var BUILTIN_CALCS = [
13567
13618
  // ── segment scope (Tier-1 annotations) ────────────────────────────────
@@ -13569,7 +13620,7 @@ var BUILTIN_CALCS = [
13569
13620
  id: "pace-reps",
13570
13621
  kind: "output",
13571
13622
  scope: "segment",
13572
- fences: ["time", "log"],
13623
+ fences: WORKOUT_FENCES,
13573
13624
  when: "elapsed > 0 and has(reps)",
13574
13625
  variants: [{
13575
13626
  id: "default",
@@ -13583,7 +13634,7 @@ var BUILTIN_CALCS = [
13583
13634
  id: "pace-speed",
13584
13635
  kind: "output",
13585
13636
  scope: "segment",
13586
- fences: ["time", "log"],
13637
+ fences: WORKOUT_FENCES,
13587
13638
  when: "elapsed > 0 and has(distance)",
13588
13639
  variants: [{
13589
13640
  id: "default",
@@ -13597,7 +13648,7 @@ var BUILTIN_CALCS = [
13597
13648
  id: "pace-runner",
13598
13649
  kind: "output",
13599
13650
  scope: "segment",
13600
- fences: ["time", "log"],
13651
+ fences: WORKOUT_FENCES,
13601
13652
  when: "elapsed > 0 and has(distance)",
13602
13653
  variants: [{
13603
13654
  id: "default",
@@ -13611,7 +13662,7 @@ var BUILTIN_CALCS = [
13611
13662
  id: "power",
13612
13663
  kind: "output",
13613
13664
  scope: "segment",
13614
- fences: ["time", "log"],
13665
+ fences: WORKOUT_FENCES,
13615
13666
  when: "elapsed > 0 and has(reps) and has(resistance)",
13616
13667
  variants: [{
13617
13668
  id: "default",
@@ -13643,7 +13694,7 @@ var BUILTIN_CALCS = [
13643
13694
  id: "e1rm",
13644
13695
  kind: "output",
13645
13696
  scope: "segment",
13646
- fences: ["time", "log"],
13697
+ fences: WORKOUT_FENCES,
13647
13698
  when: "has(reps) and has(resistance) and reps > 0 and resistance > 0",
13648
13699
  variants: [{
13649
13700
  id: "default",
@@ -13665,7 +13716,7 @@ var BUILTIN_CALCS = [
13665
13716
  id: "pct1rm",
13666
13717
  kind: "output",
13667
13718
  scope: "segment",
13668
- fences: ["time", "log"],
13719
+ fences: WORKOUT_FENCES,
13669
13720
  when: "has(reps) and has(resistance) and reps > 0",
13670
13721
  variants: [{
13671
13722
  id: "default",
@@ -13685,7 +13736,7 @@ var BUILTIN_CALCS = [
13685
13736
  id: "climb-sends",
13686
13737
  kind: "output",
13687
13738
  scope: "segment",
13688
- fences: ["time", "log"],
13739
+ fences: WORKOUT_FENCES,
13689
13740
  when: "has(climbSend)",
13690
13741
  variants: [{
13691
13742
  id: "default",
@@ -13713,7 +13764,7 @@ var BUILTIN_CALCS = [
13713
13764
  scope: "segment",
13714
13765
  // Fenced like the legacy MetMinuteProjectionEngine — segment-scope only
13715
13766
  // (its workout consumer is fenced too).
13716
- fences: ["time", "log"],
13767
+ fences: WORKOUT_FENCES,
13717
13768
  when: "elapsed > 0",
13718
13769
  variants: [
13719
13770
  {
@@ -13740,7 +13791,7 @@ var BUILTIN_CALCS = [
13740
13791
  id: "total-reps",
13741
13792
  kind: "output",
13742
13793
  scope: "workout",
13743
- fences: ["time", "log"],
13794
+ fences: WORKOUT_FENCES,
13744
13795
  when: "has(sum(reps)) and sum(reps) > 0",
13745
13796
  variants: [{
13746
13797
  id: "default",
@@ -13754,7 +13805,7 @@ var BUILTIN_CALCS = [
13754
13805
  id: "total-reps-by-effort",
13755
13806
  kind: "output",
13756
13807
  scope: "workout",
13757
- fences: ["time", "log"],
13808
+ fences: WORKOUT_FENCES,
13758
13809
  variants: [{
13759
13810
  id: "default",
13760
13811
  priority: 10,
@@ -13767,7 +13818,7 @@ var BUILTIN_CALCS = [
13767
13818
  id: "total-distance",
13768
13819
  kind: "output",
13769
13820
  scope: "workout",
13770
- fences: ["time", "log"],
13821
+ fences: WORKOUT_FENCES,
13771
13822
  when: "has(sum(distance)) and sum(distance) > 0",
13772
13823
  variants: [{
13773
13824
  id: "default",
@@ -13781,7 +13832,7 @@ var BUILTIN_CALCS = [
13781
13832
  id: "total-volume",
13782
13833
  kind: "output",
13783
13834
  scope: "workout",
13784
- fences: ["time", "log"],
13835
+ fences: WORKOUT_FENCES,
13785
13836
  when: "has(sum(segmentVolume)) and sum(segmentVolume) > 0",
13786
13837
  variants: [{
13787
13838
  id: "default",
@@ -13795,7 +13846,7 @@ var BUILTIN_CALCS = [
13795
13846
  id: "total-volume-by-effort",
13796
13847
  kind: "output",
13797
13848
  scope: "workout",
13798
- fences: ["time", "log"],
13849
+ fences: WORKOUT_FENCES,
13799
13850
  variants: [{
13800
13851
  id: "default",
13801
13852
  priority: 10,
@@ -13819,7 +13870,7 @@ var BUILTIN_CALCS = [
13819
13870
  id: "met-minutes",
13820
13871
  kind: "output",
13821
13872
  scope: "workout",
13822
- fences: ["time", "log"],
13873
+ fences: WORKOUT_FENCES,
13823
13874
  when: "has(sum(metMinutes))",
13824
13875
  variants: [
13825
13876
  {
@@ -13829,13 +13880,13 @@ var BUILTIN_CALCS = [
13829
13880
  priority: 100,
13830
13881
  when: "sum(metMinutesEstimated) > 0",
13831
13882
  origin: "analyzed-estimated",
13832
- nodes: { total: expr("total", "round(sum(metMinutes))") }
13883
+ nodes: { total: expr("total", "sum(metMinutes)") }
13833
13884
  },
13834
13885
  {
13835
13886
  id: "resolved",
13836
13887
  priority: 10,
13837
13888
  origin: "analyzed",
13838
- nodes: { total: expr("total", "round(sum(metMinutes))") }
13889
+ nodes: { total: expr("total", "sum(metMinutes)") }
13839
13890
  }
13840
13891
  ],
13841
13892
  output: { nodeId: "total", key: "calc.metMinutes", emitType: "work", unit: "MET-min" }
@@ -13871,7 +13922,7 @@ var BUILTIN_CALCS = [
13871
13922
  id: "session-load",
13872
13923
  kind: "output",
13873
13924
  scope: "workout",
13874
- fences: ["time", "log"],
13925
+ fences: WORKOUT_FENCES,
13875
13926
  when: "has(session.duration)",
13876
13927
  variants: [
13877
13928
  {
@@ -13927,7 +13978,7 @@ var BUILTIN_CALCS = [
13927
13978
  id: "tis",
13928
13979
  kind: "output",
13929
13980
  scope: "workout",
13930
- fences: ["time", "log"],
13981
+ fences: WORKOUT_FENCES,
13931
13982
  when: "has(sum(metMinutes)) and has(sum(elapsed))",
13932
13983
  variants: [
13933
13984
  {
@@ -13982,7 +14033,7 @@ var STORE_CALCS = [
13982
14033
  id: "acwr",
13983
14034
  kind: "output",
13984
14035
  scope: "store",
13985
- fences: ["time", "log"],
14036
+ fences: WORKOUT_FENCES,
13986
14037
  variants: [{
13987
14038
  id: "default",
13988
14039
  priority: 10,
@@ -14000,7 +14051,7 @@ var STORE_CALCS = [
14000
14051
  id: "monotony",
14001
14052
  kind: "output",
14002
14053
  scope: "store",
14003
- fences: ["time", "log"],
14054
+ fences: WORKOUT_FENCES,
14004
14055
  variants: [{
14005
14056
  id: "default",
14006
14057
  priority: 10,
@@ -14018,7 +14069,7 @@ var STORE_CALCS = [
14018
14069
  id: "strain",
14019
14070
  kind: "output",
14020
14071
  scope: "store",
14021
- fences: ["time", "log"],
14072
+ fences: WORKOUT_FENCES,
14022
14073
  variants: [{
14023
14074
  id: "default",
14024
14075
  priority: 10,
@@ -14040,7 +14091,7 @@ var STORE_CALCS = [
14040
14091
  id: "ctl",
14041
14092
  kind: "output",
14042
14093
  scope: "store",
14043
- fences: ["time", "log"],
14094
+ fences: WORKOUT_FENCES,
14044
14095
  variants: [{
14045
14096
  id: "default",
14046
14097
  priority: 10,
@@ -14056,7 +14107,7 @@ var STORE_CALCS = [
14056
14107
  id: "atl",
14057
14108
  kind: "output",
14058
14109
  scope: "store",
14059
- fences: ["time", "log"],
14110
+ fences: WORKOUT_FENCES,
14060
14111
  variants: [{
14061
14112
  id: "default",
14062
14113
  priority: 10,
@@ -14072,7 +14123,7 @@ var STORE_CALCS = [
14072
14123
  id: "tsb",
14073
14124
  kind: "output",
14074
14125
  scope: "store",
14075
- fences: ["time", "log"],
14126
+ fences: WORKOUT_FENCES,
14076
14127
  variants: [{
14077
14128
  id: "default",
14078
14129
  priority: 10,
@@ -14098,7 +14149,7 @@ var STORE_CALCS = [
14098
14149
  id: "soreness",
14099
14150
  kind: "output",
14100
14151
  scope: "store",
14101
- fences: ["time", "log"],
14152
+ fences: WORKOUT_FENCES,
14102
14153
  variants: [{
14103
14154
  id: "default",
14104
14155
  priority: 10,
@@ -14114,7 +14165,7 @@ var STORE_CALCS = [
14114
14165
  id: "sleep",
14115
14166
  kind: "output",
14116
14167
  scope: "store",
14117
- fences: ["time", "log"],
14168
+ fences: WORKOUT_FENCES,
14118
14169
  variants: [{
14119
14170
  id: "default",
14120
14171
  priority: 10,
@@ -14130,7 +14181,7 @@ var STORE_CALCS = [
14130
14181
  id: "hrv",
14131
14182
  kind: "output",
14132
14183
  scope: "store",
14133
- fences: ["time", "log"],
14184
+ fences: WORKOUT_FENCES,
14134
14185
  variants: [{
14135
14186
  id: "default",
14136
14187
  priority: 10,
@@ -14150,7 +14201,7 @@ var STORE_CALCS = [
14150
14201
  id: "readiness",
14151
14202
  kind: "output",
14152
14203
  scope: "store",
14153
- fences: ["time", "log"],
14204
+ fences: WORKOUT_FENCES,
14154
14205
  variants: [{
14155
14206
  id: "default",
14156
14207
  priority: 10,
@@ -14170,7 +14221,7 @@ var STORE_CALCS = [
14170
14221
  id: "mvcBw",
14171
14222
  kind: "output",
14172
14223
  scope: "store",
14173
- fences: ["time", "log"],
14224
+ fences: WORKOUT_FENCES,
14174
14225
  variants: [{
14175
14226
  id: "default",
14176
14227
  priority: 10,
@@ -14190,7 +14241,7 @@ var STORE_CALCS = [
14190
14241
  id: "ef",
14191
14242
  kind: "output",
14192
14243
  scope: "store",
14193
- fences: ["time", "log"],
14244
+ fences: WORKOUT_FENCES,
14194
14245
  variants: [{
14195
14246
  id: "default",
14196
14247
  priority: 10,
@@ -14212,7 +14263,7 @@ var STORE_CALCS = [
14212
14263
  id: "adherence",
14213
14264
  kind: "output",
14214
14265
  scope: "store",
14215
- fences: ["time", "log"],
14266
+ fences: WORKOUT_FENCES,
14216
14267
  variants: [{
14217
14268
  id: "default",
14218
14269
  priority: 10,