@bitcobblers/wod-wiki-lang 0.1.6 → 0.1.14
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/{chunk-F2TOS4AF.mjs → chunk-PFQDVQQO.mjs} +3 -9
- package/dist/chunk-PFQDVQQO.mjs.map +1 -0
- package/dist/index.cjs +220 -72
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +178 -96
- package/dist/index.d.ts +178 -96
- package/dist/index.mjs +178 -68
- package/dist/index.mjs.map +1 -1
- package/dist/react.mjs +2 -2
- package/package.json +2 -2
- package/dist/chunk-F2TOS4AF.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { createBrowserRuntimeNow, frozenNow, getRuntimeNowMs, wallClockNow } from './chunk-
|
|
1
|
+
import { wallClockNow, formatDurationSmart } from './chunk-PFQDVQQO.mjs';
|
|
2
|
+
export { createBrowserRuntimeNow, frozenNow, getRuntimeNowMs, wallClockNow } from './chunk-PFQDVQQO.mjs';
|
|
3
3
|
import { MetricType, MetricContainer, BlockKey, ParsedCodeStatement, OutputStatement } from '@bitcobblers/wod-wiki-core';
|
|
4
4
|
import { LRParser } from '@lezer/lr';
|
|
5
5
|
import { LRLanguage, LanguageSupport } from '@codemirror/language';
|
|
@@ -5542,6 +5542,11 @@ var RuntimeStack = class {
|
|
|
5542
5542
|
}
|
|
5543
5543
|
}
|
|
5544
5544
|
};
|
|
5545
|
+
|
|
5546
|
+
// src/runtime/contracts/ICastSubscription.ts
|
|
5547
|
+
function isCastSubscription(s) {
|
|
5548
|
+
return "sendAnalyticsSummary" in s && typeof s.sendAnalyticsSummary === "function";
|
|
5549
|
+
}
|
|
5545
5550
|
var CompletionTimestampBehavior = class {
|
|
5546
5551
|
completionTime;
|
|
5547
5552
|
wasComplete = false;
|
|
@@ -11864,6 +11869,170 @@ var RuntimeAdapter = class {
|
|
|
11864
11869
|
return icons[memoryType];
|
|
11865
11870
|
}
|
|
11866
11871
|
};
|
|
11872
|
+
|
|
11873
|
+
// src/runtime/subscriptions/LocalRuntimeSubscription.ts
|
|
11874
|
+
var LocalRuntimeSubscription = class {
|
|
11875
|
+
id;
|
|
11876
|
+
onStackSnapshotCallback;
|
|
11877
|
+
onOutputCallback;
|
|
11878
|
+
constructor(options) {
|
|
11879
|
+
this.id = options?.id ?? "local";
|
|
11880
|
+
this.onStackSnapshotCallback = options?.onStackSnapshot;
|
|
11881
|
+
this.onOutputCallback = options?.onOutput;
|
|
11882
|
+
}
|
|
11883
|
+
onStackSnapshot(snapshot) {
|
|
11884
|
+
this.onStackSnapshotCallback?.(snapshot);
|
|
11885
|
+
}
|
|
11886
|
+
onOutput(output) {
|
|
11887
|
+
this.onOutputCallback?.(output);
|
|
11888
|
+
}
|
|
11889
|
+
dispose() {
|
|
11890
|
+
this.onStackSnapshotCallback = void 0;
|
|
11891
|
+
this.onOutputCallback = void 0;
|
|
11892
|
+
}
|
|
11893
|
+
};
|
|
11894
|
+
|
|
11895
|
+
// src/runtime/subscriptions/LocalEventProvider.ts
|
|
11896
|
+
var LocalEventProvider = class _LocalEventProvider {
|
|
11897
|
+
constructor(runtime) {
|
|
11898
|
+
this.runtime = runtime;
|
|
11899
|
+
}
|
|
11900
|
+
runtime;
|
|
11901
|
+
static subscriptionCounter = 0;
|
|
11902
|
+
unsubscribes = [];
|
|
11903
|
+
disposed = false;
|
|
11904
|
+
dispatch(event) {
|
|
11905
|
+
if (this.disposed) return;
|
|
11906
|
+
this.runtime.handle(event);
|
|
11907
|
+
}
|
|
11908
|
+
onEvent(handler) {
|
|
11909
|
+
if (this.disposed) return () => {
|
|
11910
|
+
};
|
|
11911
|
+
const ownerId = `local-event-provider-${_LocalEventProvider.subscriptionCounter++}`;
|
|
11912
|
+
const unsubscribeFromBus = this.runtime.eventBus.on("*", (event) => {
|
|
11913
|
+
handler(event);
|
|
11914
|
+
}, ownerId);
|
|
11915
|
+
const unsubscribe = () => {
|
|
11916
|
+
unsubscribeFromBus();
|
|
11917
|
+
this.unsubscribes = this.unsubscribes.filter((candidate) => candidate !== unsubscribe);
|
|
11918
|
+
};
|
|
11919
|
+
this.unsubscribes.push(unsubscribe);
|
|
11920
|
+
return unsubscribe;
|
|
11921
|
+
}
|
|
11922
|
+
dispose() {
|
|
11923
|
+
if (this.disposed) return;
|
|
11924
|
+
this.disposed = true;
|
|
11925
|
+
const unsubscribes = [...this.unsubscribes];
|
|
11926
|
+
this.unsubscribes = [];
|
|
11927
|
+
for (const unsubscribe of unsubscribes) {
|
|
11928
|
+
unsubscribe();
|
|
11929
|
+
}
|
|
11930
|
+
}
|
|
11931
|
+
};
|
|
11932
|
+
|
|
11933
|
+
// src/runtime/subscriptions/SubscriptionManager.ts
|
|
11934
|
+
var SubscriptionManager = class {
|
|
11935
|
+
constructor(runtime) {
|
|
11936
|
+
this.runtime = runtime;
|
|
11937
|
+
this.stackUnsub = this.runtime.subscribeToStack((snapshot) => {
|
|
11938
|
+
for (const sub of this.subscriptions.values()) {
|
|
11939
|
+
try {
|
|
11940
|
+
sub.onStackSnapshot(snapshot);
|
|
11941
|
+
} catch (err) {
|
|
11942
|
+
console.error(`[SubscriptionManager] Error in subscription '${sub.id}' onStackSnapshot:`, err);
|
|
11943
|
+
}
|
|
11944
|
+
}
|
|
11945
|
+
});
|
|
11946
|
+
this.outputUnsub = this.runtime.subscribeToOutput((output) => {
|
|
11947
|
+
for (const sub of this.subscriptions.values()) {
|
|
11948
|
+
try {
|
|
11949
|
+
sub.onOutput(output);
|
|
11950
|
+
} catch (err) {
|
|
11951
|
+
console.error(`[SubscriptionManager] Error in subscription '${sub.id}' onOutput:`, err);
|
|
11952
|
+
}
|
|
11953
|
+
}
|
|
11954
|
+
});
|
|
11955
|
+
}
|
|
11956
|
+
runtime;
|
|
11957
|
+
subscriptions = /* @__PURE__ */ new Map();
|
|
11958
|
+
stackUnsub = null;
|
|
11959
|
+
outputUnsub = null;
|
|
11960
|
+
disposed = false;
|
|
11961
|
+
/**
|
|
11962
|
+
* Register a subscription. If a subscription with the same ID already exists,
|
|
11963
|
+
* the old one is disposed and replaced.
|
|
11964
|
+
*
|
|
11965
|
+
* New subscriptions immediately receive the current stack state and any
|
|
11966
|
+
* existing output statements to catch them up.
|
|
11967
|
+
*/
|
|
11968
|
+
add(subscription) {
|
|
11969
|
+
if (this.disposed) {
|
|
11970
|
+
console.warn("[SubscriptionManager] Cannot add subscription after dispose");
|
|
11971
|
+
return;
|
|
11972
|
+
}
|
|
11973
|
+
const existing = this.subscriptions.get(subscription.id);
|
|
11974
|
+
if (existing) {
|
|
11975
|
+
existing.dispose();
|
|
11976
|
+
}
|
|
11977
|
+
this.subscriptions.set(subscription.id, subscription);
|
|
11978
|
+
try {
|
|
11979
|
+
subscription.onStackSnapshot({
|
|
11980
|
+
type: "initial",
|
|
11981
|
+
blocks: [...this.runtime.stack.blocks],
|
|
11982
|
+
depth: this.runtime.stack.count,
|
|
11983
|
+
clockTime: this.runtime.clock.currentDate
|
|
11984
|
+
});
|
|
11985
|
+
const currentOutputs = this.runtime.getOutputStatements();
|
|
11986
|
+
for (const output of currentOutputs) {
|
|
11987
|
+
subscription.onOutput(output);
|
|
11988
|
+
}
|
|
11989
|
+
} catch (err) {
|
|
11990
|
+
console.error(`[SubscriptionManager] Error catching up subscription '${subscription.id}':`, err);
|
|
11991
|
+
}
|
|
11992
|
+
}
|
|
11993
|
+
/**
|
|
11994
|
+
* Remove and dispose a subscription by ID.
|
|
11995
|
+
* Returns true if the subscription was found and removed.
|
|
11996
|
+
*/
|
|
11997
|
+
remove(id) {
|
|
11998
|
+
const sub = this.subscriptions.get(id);
|
|
11999
|
+
if (!sub) return false;
|
|
12000
|
+
sub.dispose();
|
|
12001
|
+
this.subscriptions.delete(id);
|
|
12002
|
+
return true;
|
|
12003
|
+
}
|
|
12004
|
+
/**
|
|
12005
|
+
* Check if a subscription with the given ID is registered.
|
|
12006
|
+
*/
|
|
12007
|
+
has(id) {
|
|
12008
|
+
return this.subscriptions.has(id);
|
|
12009
|
+
}
|
|
12010
|
+
/**
|
|
12011
|
+
* Get the number of active subscriptions.
|
|
12012
|
+
*/
|
|
12013
|
+
get count() {
|
|
12014
|
+
return this.subscriptions.size;
|
|
12015
|
+
}
|
|
12016
|
+
/**
|
|
12017
|
+
* Dispose all subscriptions and unsubscribe from the runtime.
|
|
12018
|
+
*/
|
|
12019
|
+
dispose() {
|
|
12020
|
+
if (this.disposed) return;
|
|
12021
|
+
this.disposed = true;
|
|
12022
|
+
this.stackUnsub?.();
|
|
12023
|
+
this.stackUnsub = null;
|
|
12024
|
+
this.outputUnsub?.();
|
|
12025
|
+
this.outputUnsub = null;
|
|
12026
|
+
for (const sub of this.subscriptions.values()) {
|
|
12027
|
+
try {
|
|
12028
|
+
sub.dispose();
|
|
12029
|
+
} catch (err) {
|
|
12030
|
+
console.error(`[SubscriptionManager] Error disposing subscription '${sub.id}':`, err);
|
|
12031
|
+
}
|
|
12032
|
+
}
|
|
12033
|
+
this.subscriptions.clear();
|
|
12034
|
+
}
|
|
12035
|
+
};
|
|
11867
12036
|
function formatMetricLabel(key) {
|
|
11868
12037
|
return key.charAt(0).toUpperCase() + key.slice(1).replace(/_/g, " ");
|
|
11869
12038
|
}
|
|
@@ -12541,65 +12710,6 @@ function normalizeName(value) {
|
|
|
12541
12710
|
return value.trim().toLowerCase();
|
|
12542
12711
|
}
|
|
12543
12712
|
|
|
12544
|
-
// src/analytics/calc/index.ts
|
|
12545
|
-
var calc_exports = {};
|
|
12546
|
-
__export(calc_exports, {
|
|
12547
|
-
ABSENT: () => ABSENT,
|
|
12548
|
-
AGGREGATE_BUILTINS: () => AGGREGATE_BUILTINS,
|
|
12549
|
-
AUTHORITATIVE_CASTS: () => AUTHORITATIVE_CASTS,
|
|
12550
|
-
BUILTIN_CALCS: () => BUILTIN_CALCS,
|
|
12551
|
-
CONTEXT_ATOMS: () => CONTEXT_ATOMS,
|
|
12552
|
-
CalcEngine: () => CalcEngine,
|
|
12553
|
-
CalcEvalError: () => CalcEvalError,
|
|
12554
|
-
CalcParseError: () => CalcParseError,
|
|
12555
|
-
CalcRegistrationError: () => CalcRegistrationError,
|
|
12556
|
-
CalcUnitError: () => CalcUnitError,
|
|
12557
|
-
CalculationRegistry: () => CalculationRegistry,
|
|
12558
|
-
DIM_COUNT: () => DIM_COUNT,
|
|
12559
|
-
DIM_ENERGY: () => DIM_ENERGY,
|
|
12560
|
-
DIM_LENGTH: () => DIM_LENGTH,
|
|
12561
|
-
DIM_MASS: () => DIM_MASS,
|
|
12562
|
-
DIM_TIME: () => DIM_TIME,
|
|
12563
|
-
DIM_ZERO: () => DIM_ZERO,
|
|
12564
|
-
LookupRegistry: () => LookupRegistry,
|
|
12565
|
-
NAMED_COMPOUNDS: () => NAMED_COMPOUNDS,
|
|
12566
|
-
REST_EXCLUSION: () => REST_EXCLUSION,
|
|
12567
|
-
RPE_LABELS: () => RPE_LABELS,
|
|
12568
|
-
STORE_CALCS: () => STORE_CALCS,
|
|
12569
|
-
STREAM_ATOMS: () => STREAM_ATOMS,
|
|
12570
|
-
UNITS: () => UNITS,
|
|
12571
|
-
addDim: () => addDim,
|
|
12572
|
-
buildStaticLookups: () => buildStaticLookups,
|
|
12573
|
-
checkCalcLine: () => checkCalcLine,
|
|
12574
|
-
compileLineForm: () => compileLineForm,
|
|
12575
|
-
composeDivUnit: () => composeDivUnit,
|
|
12576
|
-
composeMulUnit: () => composeMulUnit,
|
|
12577
|
-
compoundName: () => compoundName,
|
|
12578
|
-
convertScalar: () => convertScalar,
|
|
12579
|
-
createCalcEngine: () => createCalcEngine,
|
|
12580
|
-
createCalcStack: () => createCalcStack,
|
|
12581
|
-
createDisciplinesTable: () => createDisciplinesTable,
|
|
12582
|
-
createEffortTable: () => createEffortTable,
|
|
12583
|
-
createProfileTable: () => createProfileTable,
|
|
12584
|
-
createRpeLabelsTable: () => createRpeLabelsTable,
|
|
12585
|
-
dimEquals: () => dimEquals,
|
|
12586
|
-
evaluate: () => evaluate,
|
|
12587
|
-
formatDim: () => formatDim,
|
|
12588
|
-
getUnit: () => getUnit,
|
|
12589
|
-
inferDim: () => inferDim,
|
|
12590
|
-
isDimensionless: () => isDimensionless,
|
|
12591
|
-
num: () => num,
|
|
12592
|
-
outputNodeId: () => outputNodeId,
|
|
12593
|
-
outputNodeIds: () => outputNodeIds,
|
|
12594
|
-
parseCalcLine: () => parseCalcLine,
|
|
12595
|
-
parseExpression: () => parseExpression,
|
|
12596
|
-
printCalculation: () => printCalculation,
|
|
12597
|
-
str: () => str,
|
|
12598
|
-
subDim: () => subDim,
|
|
12599
|
-
truthy: () => truthy,
|
|
12600
|
-
validateOutputUnit: () => validateOutputUnit
|
|
12601
|
-
});
|
|
12602
|
-
|
|
12603
12713
|
// src/analytics/calc/lineform.ts
|
|
12604
12714
|
var SCOPE_RE = /^(segment|workout|store)\b/;
|
|
12605
12715
|
function compileLineForm(src, defaultScope) {
|
|
@@ -13032,15 +13142,15 @@ function toStoredOutputStatement(output) {
|
|
|
13032
13142
|
}
|
|
13033
13143
|
|
|
13034
13144
|
// src/version.ts
|
|
13035
|
-
var VERSION = "0.1.
|
|
13036
|
-
var GIT_SHA = "
|
|
13037
|
-
var BUILD_TIME = "2026-08-18T18:
|
|
13145
|
+
var VERSION = "0.1.14";
|
|
13146
|
+
var GIT_SHA = "ce7593a";
|
|
13147
|
+
var BUILD_TIME = "2026-08-18T18:26:56.537Z";
|
|
13038
13148
|
var SEMVER = {
|
|
13039
|
-
version: "0.1.
|
|
13040
|
-
gitSha: "
|
|
13041
|
-
buildTime: "2026-08-18T18:
|
|
13149
|
+
version: "0.1.14",
|
|
13150
|
+
gitSha: "ce7593a",
|
|
13151
|
+
buildTime: "2026-08-18T18:26:56.537Z"
|
|
13042
13152
|
};
|
|
13043
13153
|
|
|
13044
|
-
export { AbortSessionAction, AnalyticsEngine, AnalyticsTransformer, BUILD_TIME, BUILTIN_CALCS, BUNDLED_EFFORT_COUNT, BehaviorContext, BlockContext, CONSUMED_HINTS, CONSUMED_HINT_KEYS, CalcEngine, CalculateBlockProcessor, CalculationRegistry, CardioDialect, ClearChildrenAction, ClimbDialect, ClimbMetricType, CompileAndPushBlockAction, CrossFitDialect, DAY, DEFAULT_RESOLVER_OPTIONS, DEFAULT_UNRESOLVED_EFFORT_MET, DIM_LENGTH, DIM_MASS, DIM_TIME, DIM_ZERO, DISCIPLINE_FACTORS, DialectStack, EFFORT_DATA_METRIC_TYPE, EFFORT_DISCIPLINES, EFFORT_REGISTRY_ORIGINS, EffortBlock, EffortResolver, EmitEventAction, EmitSystemOutputAction, ErrorAction, EventBus, ExecutionContext, GIT_SHA, HabitsDialect, INTENSITY_TIERS, InMemoryEffortRegistry, JitCompiler, LookupRegistry, MdTimerRuntime, MemoryLocation, MemoryTypeEnum, NextAction, NextEvent, NextEventHandler, OutputEmitter, PREDEFINED_SOUNDS, PRODUCTION_STRATEGIES, PlaySoundAction, PopBlockAction, PushBlockAction, PushRestBlockAction, RegisterEventHandlerAction, Registry, RestBlock, RuntimeAdapter, RuntimeBlock, RuntimeBuilder, RuntimeClock, RuntimeFactory, RuntimeLogger, RuntimeMemory, RuntimeObservers, RuntimeStack, SEMVER, STANDARD_UNITS, STORE_CALCS, ScriptRuntime, SessionRootBlock, SnapshotClock, StandardAnalyticsProfile, StartSessionAction, StartWorkoutAction, ThrowError, ThrowErrorAction, TimeSpan, TwoPassEffortResolutionProcess, TypedMemoryReference, UnitRegistry, UnitSet, UnitsDialect, UnregisterEventHandlerAction, UpdateNextPreviewAction, VERSION, VISIBILITY_ICONS, VISIBILITY_LABELS, WaitingToStartBlock, WhiteboardScript, WodDialect, YogaDialect,
|
|
13154
|
+
export { ABSENT, AGGREGATE_BUILTINS, AUTHORITATIVE_CASTS, AbortSessionAction, AnalyticsEngine, AnalyticsTransformer, BUILD_TIME, BUILTIN_CALCS, BUNDLED_EFFORT_COUNT, BehaviorContext, BlockContext, CONSUMED_HINTS, CONSUMED_HINT_KEYS, CONTEXT_ATOMS, CalcEngine, CalcEvalError, CalcParseError, CalcRegistrationError, CalcUnitError, CalculateBlockProcessor, CalculationRegistry, CardioDialect, ClearChildrenAction, ClimbDialect, ClimbMetricType, CompileAndPushBlockAction, CrossFitDialect, DAY, DEFAULT_RESOLVER_OPTIONS, DEFAULT_UNRESOLVED_EFFORT_MET, DIM_COUNT, DIM_ENERGY, DIM_LENGTH, DIM_MASS, DIM_TIME, DIM_ZERO, DISCIPLINE_FACTORS, DialectStack, EFFORT_DATA_METRIC_TYPE, EFFORT_DISCIPLINES, EFFORT_REGISTRY_ORIGINS, EffortBlock, EffortResolver, EmitEventAction, EmitSystemOutputAction, ErrorAction, EventBus, ExecutionContext, GIT_SHA, HabitsDialect, INTENSITY_TIERS, InMemoryEffortRegistry, JitCompiler, LocalEventProvider, LocalRuntimeSubscription, LookupRegistry, MdTimerRuntime, MemoryLocation, MemoryTypeEnum, NAMED_COMPOUNDS, NextAction, NextEvent, NextEventHandler, OutputEmitter, PREDEFINED_SOUNDS, PRODUCTION_STRATEGIES, PlaySoundAction, PopBlockAction, PushBlockAction, PushRestBlockAction, REST_EXCLUSION, RPE_LABELS, RegisterEventHandlerAction, Registry, RestBlock, RuntimeAdapter, RuntimeBlock, RuntimeBuilder, RuntimeClock, RuntimeFactory, RuntimeLogger, RuntimeMemory, RuntimeObservers, RuntimeStack, SEMVER, STANDARD_UNITS, STORE_CALCS, STREAM_ATOMS, ScriptRuntime, SessionRootBlock, SnapshotClock, StandardAnalyticsProfile, StartSessionAction, StartWorkoutAction, SubscriptionManager, ThrowError, ThrowErrorAction, TimeSpan, TwoPassEffortResolutionProcess, TypedMemoryReference, UNITS, UnitRegistry, UnitSet, UnitsDialect, UnregisterEventHandlerAction, UpdateNextPreviewAction, VERSION, VISIBILITY_ICONS, VISIBILITY_LABELS, WaitingToStartBlock, WhiteboardScript, WodDialect, YogaDialect, addDim, buildStaticLookups, buildTooltip, bundledEfforts, calculateElapsed, checkCalcLine, classifyStatements, closeCurrentSpan, commonFixtureSet, compileLineForm, composeDivUnit, composeMulUnit, compoundName, computeColumnLabel, computeLabel, computeWorkloadRollups, convertScalar, createAnalyticsEngineForBlock, createCalcEngine, createCalcStack, createCompiler, createDialectStack, createDisciplinesTable, createEffortTable, createLineLocator, createPolicy as createMetricPresentationPolicy, createMockClock, createParser, createProfileTable, createRpeLabelsTable, dailySessionLoads, dayBucket, dialectRegistry, dialectStack, dimEquals, disciplineFactorFor, evaluate, evaluateCalculateDefinitions, extractEffortData, extractMetrics, extractStatements, extractStatementsRaw, extractSyntaxFacts, filterTagsByVisibility, findBestFuzzyMatch, fixtureBackSquat, fixtureBurpee, fixturePlank, fixtureRowing, fixtureRunning, fixtureUserCustom, fixtureUserOverride, formatDim, formatDuration, metricsToLabel as fragmentsToLabel, fullFixtureSet, fuseUnits, fuseUnitsInMetrics, getAnalyticsFromLogs, getAnalyticsFromRuntime, getHints, getMetricVisibility, getUnit, hasHint, hintMetric, hintsToContainer, inferDim, isCastSubscription, isDimensionless, isEffortDiscipline, isFragmentTag, isTimeLikeMetric, isWithinThreshold, levenshteinDistance, metricPresentation, mutateTimerSpans, normalizeForFuzzy, num, openSpan, outputNodeId, outputNodeIds, parseCalcLine, parseCalculateBlock, parseExpression, parseScript, printCalculation, readTimer, realtimeProcessorRegistry, resolveDominantOrigin, sharedParser, startSpan, str, strategyRegistry, subDim, summaryProcessorRegistry, toStoredOutputStatement, truthy, validateOutputUnit, parser as whiteboardParser, whiteboardScript, whiteboardScriptLanguage };
|
|
13045
13155
|
//# sourceMappingURL=index.mjs.map
|
|
13046
13156
|
//# sourceMappingURL=index.mjs.map
|