@almadar/core 9.10.0 → 9.10.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.
package/dist/index.js CHANGED
@@ -2020,19 +2020,23 @@ function asInlineTrait(ref2) {
2020
2020
  return null;
2021
2021
  }
2022
2022
  function findRenderUiRoot(orbital, address) {
2023
+ const wantTransition = address.transition !== "";
2024
+ const wantState = address.state !== void 0 && address.state !== "";
2025
+ let fallback = null;
2023
2026
  for (const ref2 of orbital.traits) {
2024
2027
  const trait = asInlineTrait(ref2);
2025
2028
  if (!trait || trait.name !== address.trait) continue;
2026
2029
  for (const t of trait.stateMachine?.transitions ?? []) {
2027
- if (t.event !== address.transition) continue;
2028
- if (address.state !== void 0 && t.from !== address.state) continue;
2030
+ if (wantState && t.from !== address.state) continue;
2029
2031
  for (const eff of t.effects ?? []) {
2030
2032
  const ru = readRenderUi(eff);
2031
- if (ru && ru.slot === address.slot) return ru.node;
2033
+ if (!ru || ru.slot !== address.slot) continue;
2034
+ if (wantTransition && t.event === address.transition) return ru.node;
2035
+ fallback ?? (fallback = ru.node);
2032
2036
  }
2033
2037
  }
2034
2038
  }
2035
- return null;
2039
+ return fallback;
2036
2040
  }
2037
2041
  function resolvePath(root, patch) {
2038
2042
  if (patch.op === "insert") {