@almadar/runtime 4.3.0 → 4.4.1
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventBus, createUnifiedLoader, preprocessSchema, StateMachineManager, createContextFromBindings, EffectExecutor } from './chunk-
|
|
1
|
+
import { EventBus, createUnifiedLoader, preprocessSchema, StateMachineManager, createContextFromBindings, EffectExecutor } from './chunk-6YIZIJNA.js';
|
|
2
2
|
import './chunk-PZ5AY32C.js';
|
|
3
3
|
import { Router } from 'express';
|
|
4
4
|
import * as fs from 'fs';
|
|
@@ -2071,15 +2071,69 @@ var UnifiedLoader = class {
|
|
|
2071
2071
|
function createUnifiedLoader(options) {
|
|
2072
2072
|
return new UnifiedLoader(options);
|
|
2073
2073
|
}
|
|
2074
|
+
function renameEventsInRenderUiConfig(node, rename) {
|
|
2075
|
+
if (node === null || node === void 0) return node;
|
|
2076
|
+
if (Array.isArray(node)) {
|
|
2077
|
+
return node.map((item) => renameEventsInRenderUiConfig(item, rename));
|
|
2078
|
+
}
|
|
2079
|
+
if (typeof node !== "object") return node;
|
|
2080
|
+
const obj = node;
|
|
2081
|
+
const next = { ...obj };
|
|
2082
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
2083
|
+
if (key === "action" && typeof value === "string" && !value.startsWith("@")) {
|
|
2084
|
+
next[key] = rename(value) ?? value;
|
|
2085
|
+
continue;
|
|
2086
|
+
}
|
|
2087
|
+
if (key === "event" && typeof value === "string" && !value.startsWith("@")) {
|
|
2088
|
+
next[key] = rename(value) ?? value;
|
|
2089
|
+
continue;
|
|
2090
|
+
}
|
|
2091
|
+
if (/^on[A-Z]/.test(key) && typeof value === "string" && !value.startsWith("@")) {
|
|
2092
|
+
next[key] = rename(value) ?? value;
|
|
2093
|
+
continue;
|
|
2094
|
+
}
|
|
2095
|
+
if (key.endsWith("Event") && typeof value === "string" && !value.startsWith("@")) {
|
|
2096
|
+
next[key] = rename(value) ?? value;
|
|
2097
|
+
continue;
|
|
2098
|
+
}
|
|
2099
|
+
if ((key === "actions" || key === "itemActions") && Array.isArray(value)) {
|
|
2100
|
+
const rewrittenArray = value.map((entry) => {
|
|
2101
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return entry;
|
|
2102
|
+
const action = entry;
|
|
2103
|
+
if (typeof action.event === "string" && !action.event.startsWith("@")) {
|
|
2104
|
+
return { ...action, event: rename(action.event) ?? action.event };
|
|
2105
|
+
}
|
|
2106
|
+
return action;
|
|
2107
|
+
});
|
|
2108
|
+
next[key] = rewrittenArray;
|
|
2109
|
+
continue;
|
|
2110
|
+
}
|
|
2111
|
+
next[key] = renameEventsInRenderUiConfig(value, rename);
|
|
2112
|
+
}
|
|
2113
|
+
return next;
|
|
2114
|
+
}
|
|
2115
|
+
function renameEventsInEffects(effects, rename) {
|
|
2116
|
+
return effects.map((effect) => {
|
|
2117
|
+
if (!Array.isArray(effect)) return effect;
|
|
2118
|
+
if (effect[0] === "render-ui" && effect.length >= 3) {
|
|
2119
|
+
const slot = effect[1];
|
|
2120
|
+
const config = effect[2];
|
|
2121
|
+
const nextConfig = renameEventsInRenderUiConfig(config, rename);
|
|
2122
|
+
return [effect[0], slot, nextConfig, ...effect.slice(3)];
|
|
2123
|
+
}
|
|
2124
|
+
return effect;
|
|
2125
|
+
});
|
|
2126
|
+
}
|
|
2074
2127
|
function applyEventRenames(trait, renames) {
|
|
2075
2128
|
if (!renames || Object.keys(renames).length === 0) return trait;
|
|
2076
2129
|
const rename = (k) => k !== void 0 && k in renames ? renames[k] : k;
|
|
2077
2130
|
const sm = trait.stateMachine;
|
|
2078
2131
|
if (!sm) return trait;
|
|
2079
|
-
const nextTransitions = (sm.transitions ?? []).map((t) =>
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2132
|
+
const nextTransitions = (sm.transitions ?? []).map((t) => {
|
|
2133
|
+
const nextEvent = rename(t.event) ?? t.event;
|
|
2134
|
+
const nextEffects = t.effects ? renameEventsInEffects(t.effects, rename) : t.effects;
|
|
2135
|
+
return { ...t, event: nextEvent, effects: nextEffects };
|
|
2136
|
+
});
|
|
2083
2137
|
const nextEvents = (sm.events ?? []).map((e) => {
|
|
2084
2138
|
const newKey = rename(e.key);
|
|
2085
2139
|
if (newKey === e.key) return e;
|
|
@@ -2733,5 +2787,5 @@ function parseNamespacedEvent(eventName) {
|
|
|
2733
2787
|
}
|
|
2734
2788
|
|
|
2735
2789
|
export { EffectExecutor, EventBus, HANDLER_MANIFEST, StateMachineManager, containsBindings, createContextFromBindings, createInitialTraitState, createTestExecutor, createUnifiedLoader, extractBindings, findInitialState, findTransition, getIsolatedCollectionName, getNamespacedEvent, interpolateProps, interpolateValue, isBrowser, isElectron, isNamespacedEvent, isNode, normalizeEventKey, parseNamespacedEvent, preprocessSchema, processEvent };
|
|
2736
|
-
//# sourceMappingURL=chunk-
|
|
2737
|
-
//# sourceMappingURL=chunk-
|
|
2790
|
+
//# sourceMappingURL=chunk-6YIZIJNA.js.map
|
|
2791
|
+
//# sourceMappingURL=chunk-6YIZIJNA.js.map
|