@bitcobblers/wod-wiki-lang 0.59.2246 → 0.60.2248

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.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { UnitRegistry, hintsToContainer, hasHint, CONSUMED_HINTS, wallClockNow, TimeSpan, metricPresentation, hintMetric, resolveTagContributions, tagReferenceFor, tagContributionMetrics, tagMarkerType, collectTagReferences, tagMarkerSlugs, getHints } from './chunk-L6BUOOKE.mjs';
2
- export { CONSUMED_HINTS, CONSUMED_HINT_KEYS, MAX_TAG_CONTRIBUTION_DEPTH, STANDARD_UNITS, TAG_MARKER_PREFIX, TimeSpan, UnitRegistry, UnitSet, buildTooltip, calculateDuration, computeColumnLabel, computeLabel, createBrowserRuntimeNow, createPolicy as createMetricPresentationPolicy, findTagContributionCycles, formatDurationCompact, formatDurationSmart, formatSecondsHHMMSS, formatSecondsMMSS, formatTime, formatTimeHHMMSS, formatTimeMMSS, formatTimePrecise, formatTimestamp, frozenNow, getHints, getRuntimeNowMs, hasHint, hintMetric, hintsToContainer, interpolateSessionClockFrame, isRequiredCountdownLocked, isTimeLikeMetric, metricPresentation, observeSessionClockInputs, projectLiveSessionTelemetry, projectScriptOutline, projectSessionClock, resolveTagContributions, resolveVisualPolarity, roundToTenth, synthesizeWorkoutFormat, tagContributionMetrics, tagMarkerSlug, tagMarkerSlugs, tagMarkerType, wallClockNow } from './chunk-L6BUOOKE.mjs';
1
+ import { UnitRegistry, hintsToContainer, hasHint, CONSUMED_HINTS, wallClockNow, TimeSpan, metricPresentation, hintMetric, resolveTagContributions, tagReferenceFor, tagContributionMetrics, tagMarkerType, collectTagReferences, tagMarkerSlugs, getHints } from './chunk-2WQW2LJ3.mjs';
2
+ export { CONSUMED_HINTS, CONSUMED_HINT_KEYS, MAX_TAG_CONTRIBUTION_DEPTH, STANDARD_UNITS, TAG_MARKER_PREFIX, TimeSpan, UnitRegistry, UnitSet, buildTooltip, calculateDuration, computeColumnLabel, computeLabel, createBrowserRuntimeNow, createPolicy as createMetricPresentationPolicy, findTagContributionCycles, formatDurationCompact, formatDurationSmart, formatSecondsHHMMSS, formatSecondsMMSS, formatTime, formatTimeHHMMSS, formatTimeMMSS, formatTimePrecise, formatTimestamp, frozenNow, getHints, getRuntimeNowMs, hasHint, hintMetric, hintsToContainer, interpolateSessionClockFrame, isRequiredCountdownLocked, isTimeLikeMetric, metricPresentation, observeSessionClockInputs, projectLiveSessionTelemetry, projectScriptOutline, projectSessionClock, resolveTagContributions, resolveVisualPolarity, roundToTenth, synthesizeWorkoutFormat, tagContributionMetrics, tagMarkerSlug, tagMarkerSlugs, tagMarkerType, wallClockNow } from './chunk-2WQW2LJ3.mjs';
3
3
  import { MetricType, MetricContainer, BlockKey, REFERENCE_METADATA_KEY, ParsedCodeStatement, getReferenceMetadata, TAG_REFERENCE_METADATA_KEY, parseFrontmatter, getScalar, OutputStatement, valueKindOf, normalizeFieldPath } from '@bitcobblers/wod-wiki-core';
4
4
  import { LRParser } from '@lezer/lr';
5
5
  import { LRLanguage, LanguageSupport, syntaxTree } from '@codemirror/language';
@@ -1657,12 +1657,45 @@ function propertyPair(primitive) {
1657
1657
  meta: primitive.meta
1658
1658
  };
1659
1659
  }
1660
+ function foldRepLadders(pairs) {
1661
+ const folded = [];
1662
+ let i = 0;
1663
+ while (i < pairs.length) {
1664
+ const first = pairs[i];
1665
+ if (first.metrics instanceof RepMetric && typeof first.metrics.reps === "number") {
1666
+ const repItems = [first];
1667
+ let j = i;
1668
+ 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) {
1669
+ repItems.push(pairs[j + 2]);
1670
+ j += 2;
1671
+ }
1672
+ if (repItems.length >= 3) {
1673
+ const last = repItems[repItems.length - 1];
1674
+ const ladderMeta = {
1675
+ ...first.meta,
1676
+ endOffset: last.meta.endOffset,
1677
+ columnEnd: last.meta.columnEnd,
1678
+ length: last.meta.endOffset - first.meta.startOffset,
1679
+ raw: repItems.map((item) => item.meta.raw).join("-")
1680
+ };
1681
+ folded.push({ metrics: new RoundsMetric(repItems.length), meta: ladderMeta });
1682
+ folded.push(...repItems);
1683
+ i = j + 1;
1684
+ continue;
1685
+ }
1686
+ }
1687
+ folded.push(first);
1688
+ i++;
1689
+ }
1690
+ return folded;
1691
+ }
1660
1692
  function mergeFragments(pairs) {
1661
- if (pairs.length < 2) return pairs;
1693
+ const normalized = foldRepLadders(pairs);
1694
+ if (normalized.length < 2) return normalized;
1662
1695
  const result = [];
1663
- let current = pairs[0];
1664
- for (let index = 1; index < pairs.length; index++) {
1665
- const next = pairs[index];
1696
+ let current = normalized[0];
1697
+ for (let index = 1; index < normalized.length; index++) {
1698
+ const next = normalized[index];
1666
1699
  if (current.metrics instanceof EffortMetric && next.metrics instanceof EffortMetric) {
1667
1700
  if (current.metrics.effort === "/" || current.metrics.effort === "|" || next.metrics.effort === "/" || next.metrics.effort === "|") {
1668
1701
  result.push(current);
@@ -10300,7 +10333,7 @@ var ChildSelectionBehavior = class _ChildSelectionBehavior {
10300
10333
  const nextGroup = this.config.childGroups[this.childIndex];
10301
10334
  this.childIndex++;
10302
10335
  this.dispatchedOnLastNext = true;
10303
- const upcomingGroup = this.config.childGroups[this.childIndex];
10336
+ const upcomingGroup = this.config.childGroups[this.childIndex] ?? (this.shouldLoop(ctx) ? this.config.childGroups[0] : void 0);
10304
10337
  return [
10305
10338
  new CompileAndPushBlockAction(nextGroup),
10306
10339
  this.createNextPreview(ctx, upcomingGroup)
@@ -12908,6 +12941,7 @@ var LookupRegistry = class {
12908
12941
 
12909
12942
  // src/analytics/calc/seeds.ts
12910
12943
  var REST_EXCLUSION = "rest|pause|rest-*";
12944
+ var WORKOUT_FENCES = ["time", "log", "wod", "whiteboard", "crossfit"];
12911
12945
  var expr = (id, expression, unit) => ({ id, kind: "expr", expression, unit });
12912
12946
  var BUILTIN_CALCS = [
12913
12947
  // ── segment scope (Tier-1 annotations) ────────────────────────────────
@@ -12915,7 +12949,7 @@ var BUILTIN_CALCS = [
12915
12949
  id: "pace-reps",
12916
12950
  kind: "output",
12917
12951
  scope: "segment",
12918
- fences: ["time", "log"],
12952
+ fences: WORKOUT_FENCES,
12919
12953
  when: "elapsed > 0 and has(reps)",
12920
12954
  variants: [{
12921
12955
  id: "default",
@@ -12929,7 +12963,7 @@ var BUILTIN_CALCS = [
12929
12963
  id: "pace-speed",
12930
12964
  kind: "output",
12931
12965
  scope: "segment",
12932
- fences: ["time", "log"],
12966
+ fences: WORKOUT_FENCES,
12933
12967
  when: "elapsed > 0 and has(distance)",
12934
12968
  variants: [{
12935
12969
  id: "default",
@@ -12943,7 +12977,7 @@ var BUILTIN_CALCS = [
12943
12977
  id: "pace-runner",
12944
12978
  kind: "output",
12945
12979
  scope: "segment",
12946
- fences: ["time", "log"],
12980
+ fences: WORKOUT_FENCES,
12947
12981
  when: "elapsed > 0 and has(distance)",
12948
12982
  variants: [{
12949
12983
  id: "default",
@@ -12957,7 +12991,7 @@ var BUILTIN_CALCS = [
12957
12991
  id: "power",
12958
12992
  kind: "output",
12959
12993
  scope: "segment",
12960
- fences: ["time", "log"],
12994
+ fences: WORKOUT_FENCES,
12961
12995
  when: "elapsed > 0 and has(reps) and has(resistance)",
12962
12996
  variants: [{
12963
12997
  id: "default",
@@ -12989,7 +13023,7 @@ var BUILTIN_CALCS = [
12989
13023
  id: "e1rm",
12990
13024
  kind: "output",
12991
13025
  scope: "segment",
12992
- fences: ["time", "log"],
13026
+ fences: WORKOUT_FENCES,
12993
13027
  when: "has(reps) and has(resistance) and reps > 0 and resistance > 0",
12994
13028
  variants: [{
12995
13029
  id: "default",
@@ -13011,7 +13045,7 @@ var BUILTIN_CALCS = [
13011
13045
  id: "pct1rm",
13012
13046
  kind: "output",
13013
13047
  scope: "segment",
13014
- fences: ["time", "log"],
13048
+ fences: WORKOUT_FENCES,
13015
13049
  when: "has(reps) and has(resistance) and reps > 0",
13016
13050
  variants: [{
13017
13051
  id: "default",
@@ -13031,7 +13065,7 @@ var BUILTIN_CALCS = [
13031
13065
  id: "climb-sends",
13032
13066
  kind: "output",
13033
13067
  scope: "segment",
13034
- fences: ["time", "log"],
13068
+ fences: WORKOUT_FENCES,
13035
13069
  when: "has(climbSend)",
13036
13070
  variants: [{
13037
13071
  id: "default",
@@ -13059,7 +13093,7 @@ var BUILTIN_CALCS = [
13059
13093
  scope: "segment",
13060
13094
  // Fenced like the legacy MetMinuteProjectionEngine — segment-scope only
13061
13095
  // (its workout consumer is fenced too).
13062
- fences: ["time", "log"],
13096
+ fences: WORKOUT_FENCES,
13063
13097
  when: "elapsed > 0",
13064
13098
  variants: [
13065
13099
  {
@@ -13086,7 +13120,7 @@ var BUILTIN_CALCS = [
13086
13120
  id: "total-reps",
13087
13121
  kind: "output",
13088
13122
  scope: "workout",
13089
- fences: ["time", "log"],
13123
+ fences: WORKOUT_FENCES,
13090
13124
  when: "has(sum(reps)) and sum(reps) > 0",
13091
13125
  variants: [{
13092
13126
  id: "default",
@@ -13100,7 +13134,7 @@ var BUILTIN_CALCS = [
13100
13134
  id: "total-reps-by-effort",
13101
13135
  kind: "output",
13102
13136
  scope: "workout",
13103
- fences: ["time", "log"],
13137
+ fences: WORKOUT_FENCES,
13104
13138
  variants: [{
13105
13139
  id: "default",
13106
13140
  priority: 10,
@@ -13113,7 +13147,7 @@ var BUILTIN_CALCS = [
13113
13147
  id: "total-distance",
13114
13148
  kind: "output",
13115
13149
  scope: "workout",
13116
- fences: ["time", "log"],
13150
+ fences: WORKOUT_FENCES,
13117
13151
  when: "has(sum(distance)) and sum(distance) > 0",
13118
13152
  variants: [{
13119
13153
  id: "default",
@@ -13127,7 +13161,7 @@ var BUILTIN_CALCS = [
13127
13161
  id: "total-volume",
13128
13162
  kind: "output",
13129
13163
  scope: "workout",
13130
- fences: ["time", "log"],
13164
+ fences: WORKOUT_FENCES,
13131
13165
  when: "has(sum(segmentVolume)) and sum(segmentVolume) > 0",
13132
13166
  variants: [{
13133
13167
  id: "default",
@@ -13141,7 +13175,7 @@ var BUILTIN_CALCS = [
13141
13175
  id: "total-volume-by-effort",
13142
13176
  kind: "output",
13143
13177
  scope: "workout",
13144
- fences: ["time", "log"],
13178
+ fences: WORKOUT_FENCES,
13145
13179
  variants: [{
13146
13180
  id: "default",
13147
13181
  priority: 10,
@@ -13165,7 +13199,7 @@ var BUILTIN_CALCS = [
13165
13199
  id: "met-minutes",
13166
13200
  kind: "output",
13167
13201
  scope: "workout",
13168
- fences: ["time", "log"],
13202
+ fences: WORKOUT_FENCES,
13169
13203
  when: "has(sum(metMinutes))",
13170
13204
  variants: [
13171
13205
  {
@@ -13175,13 +13209,13 @@ var BUILTIN_CALCS = [
13175
13209
  priority: 100,
13176
13210
  when: "sum(metMinutesEstimated) > 0",
13177
13211
  origin: "analyzed-estimated",
13178
- nodes: { total: expr("total", "round(sum(metMinutes))") }
13212
+ nodes: { total: expr("total", "sum(metMinutes)") }
13179
13213
  },
13180
13214
  {
13181
13215
  id: "resolved",
13182
13216
  priority: 10,
13183
13217
  origin: "analyzed",
13184
- nodes: { total: expr("total", "round(sum(metMinutes))") }
13218
+ nodes: { total: expr("total", "sum(metMinutes)") }
13185
13219
  }
13186
13220
  ],
13187
13221
  output: { nodeId: "total", key: "calc.metMinutes", emitType: "work", unit: "MET-min" }
@@ -13217,7 +13251,7 @@ var BUILTIN_CALCS = [
13217
13251
  id: "session-load",
13218
13252
  kind: "output",
13219
13253
  scope: "workout",
13220
- fences: ["time", "log"],
13254
+ fences: WORKOUT_FENCES,
13221
13255
  when: "has(session.duration)",
13222
13256
  variants: [
13223
13257
  {
@@ -13273,7 +13307,7 @@ var BUILTIN_CALCS = [
13273
13307
  id: "tis",
13274
13308
  kind: "output",
13275
13309
  scope: "workout",
13276
- fences: ["time", "log"],
13310
+ fences: WORKOUT_FENCES,
13277
13311
  when: "has(sum(metMinutes)) and has(sum(elapsed))",
13278
13312
  variants: [
13279
13313
  {
@@ -13328,7 +13362,7 @@ var STORE_CALCS = [
13328
13362
  id: "acwr",
13329
13363
  kind: "output",
13330
13364
  scope: "store",
13331
- fences: ["time", "log"],
13365
+ fences: WORKOUT_FENCES,
13332
13366
  variants: [{
13333
13367
  id: "default",
13334
13368
  priority: 10,
@@ -13346,7 +13380,7 @@ var STORE_CALCS = [
13346
13380
  id: "monotony",
13347
13381
  kind: "output",
13348
13382
  scope: "store",
13349
- fences: ["time", "log"],
13383
+ fences: WORKOUT_FENCES,
13350
13384
  variants: [{
13351
13385
  id: "default",
13352
13386
  priority: 10,
@@ -13364,7 +13398,7 @@ var STORE_CALCS = [
13364
13398
  id: "strain",
13365
13399
  kind: "output",
13366
13400
  scope: "store",
13367
- fences: ["time", "log"],
13401
+ fences: WORKOUT_FENCES,
13368
13402
  variants: [{
13369
13403
  id: "default",
13370
13404
  priority: 10,
@@ -13386,7 +13420,7 @@ var STORE_CALCS = [
13386
13420
  id: "ctl",
13387
13421
  kind: "output",
13388
13422
  scope: "store",
13389
- fences: ["time", "log"],
13423
+ fences: WORKOUT_FENCES,
13390
13424
  variants: [{
13391
13425
  id: "default",
13392
13426
  priority: 10,
@@ -13402,7 +13436,7 @@ var STORE_CALCS = [
13402
13436
  id: "atl",
13403
13437
  kind: "output",
13404
13438
  scope: "store",
13405
- fences: ["time", "log"],
13439
+ fences: WORKOUT_FENCES,
13406
13440
  variants: [{
13407
13441
  id: "default",
13408
13442
  priority: 10,
@@ -13418,7 +13452,7 @@ var STORE_CALCS = [
13418
13452
  id: "tsb",
13419
13453
  kind: "output",
13420
13454
  scope: "store",
13421
- fences: ["time", "log"],
13455
+ fences: WORKOUT_FENCES,
13422
13456
  variants: [{
13423
13457
  id: "default",
13424
13458
  priority: 10,
@@ -13444,7 +13478,7 @@ var STORE_CALCS = [
13444
13478
  id: "soreness",
13445
13479
  kind: "output",
13446
13480
  scope: "store",
13447
- fences: ["time", "log"],
13481
+ fences: WORKOUT_FENCES,
13448
13482
  variants: [{
13449
13483
  id: "default",
13450
13484
  priority: 10,
@@ -13460,7 +13494,7 @@ var STORE_CALCS = [
13460
13494
  id: "sleep",
13461
13495
  kind: "output",
13462
13496
  scope: "store",
13463
- fences: ["time", "log"],
13497
+ fences: WORKOUT_FENCES,
13464
13498
  variants: [{
13465
13499
  id: "default",
13466
13500
  priority: 10,
@@ -13476,7 +13510,7 @@ var STORE_CALCS = [
13476
13510
  id: "hrv",
13477
13511
  kind: "output",
13478
13512
  scope: "store",
13479
- fences: ["time", "log"],
13513
+ fences: WORKOUT_FENCES,
13480
13514
  variants: [{
13481
13515
  id: "default",
13482
13516
  priority: 10,
@@ -13496,7 +13530,7 @@ var STORE_CALCS = [
13496
13530
  id: "readiness",
13497
13531
  kind: "output",
13498
13532
  scope: "store",
13499
- fences: ["time", "log"],
13533
+ fences: WORKOUT_FENCES,
13500
13534
  variants: [{
13501
13535
  id: "default",
13502
13536
  priority: 10,
@@ -13516,7 +13550,7 @@ var STORE_CALCS = [
13516
13550
  id: "mvcBw",
13517
13551
  kind: "output",
13518
13552
  scope: "store",
13519
- fences: ["time", "log"],
13553
+ fences: WORKOUT_FENCES,
13520
13554
  variants: [{
13521
13555
  id: "default",
13522
13556
  priority: 10,
@@ -13536,7 +13570,7 @@ var STORE_CALCS = [
13536
13570
  id: "ef",
13537
13571
  kind: "output",
13538
13572
  scope: "store",
13539
- fences: ["time", "log"],
13573
+ fences: WORKOUT_FENCES,
13540
13574
  variants: [{
13541
13575
  id: "default",
13542
13576
  priority: 10,
@@ -13558,7 +13592,7 @@ var STORE_CALCS = [
13558
13592
  id: "adherence",
13559
13593
  kind: "output",
13560
13594
  scope: "store",
13561
- fences: ["time", "log"],
13595
+ fences: WORKOUT_FENCES,
13562
13596
  variants: [{
13563
13597
  id: "default",
13564
13598
  priority: 10,