@almadar/ui 4.51.12 → 4.51.13

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.
@@ -60296,12 +60296,16 @@ function OrbInspector({ node, schema, editable = false, userType = "builder", th
60296
60296
  }, [schema, orbitalName, traitName, transitionEvent]);
60297
60297
  const traits2 = React93.useMemo(() => findTraits(schema, orbitalName), [schema, orbitalName]);
60298
60298
  const patternConfig = React93.useMemo(() => {
60299
- if (!selectedPattern || !transition) return null;
60299
+ if (!selectedPattern) return null;
60300
60300
  const patternId = selectedPattern.patternId ?? "root";
60301
- for (const eff of transition.effects ?? []) {
60302
- if (Array.isArray(eff) && eff[0] === "render-ui" && eff[2]) {
60301
+ const tryEffects = (effects) => {
60302
+ for (const eff of effects) {
60303
+ if (!Array.isArray(eff) || eff[0] !== "render-ui" || !eff[2]) continue;
60303
60304
  const found = findPatternInTree(eff[2], patternId);
60304
60305
  if (!found) continue;
60306
+ if (selectedPattern.patternType && typeof found.type === "string" && found.type !== selectedPattern.patternType) {
60307
+ continue;
60308
+ }
60305
60309
  const nested = found.props;
60306
60310
  if (nested && typeof nested === "object" && !Array.isArray(nested)) {
60307
60311
  const { props: _stripped, ...rest } = found;
@@ -60309,18 +60313,47 @@ function OrbInspector({ node, schema, editable = false, userType = "builder", th
60309
60313
  }
60310
60314
  return found;
60311
60315
  }
60316
+ return null;
60317
+ };
60318
+ if (transition) {
60319
+ const direct = tryEffects(transition.effects ?? []);
60320
+ if (direct) return direct;
60321
+ }
60322
+ const orbital = schema.orbitals.find((o) => o.name === orbitalName);
60323
+ if (orbital) {
60324
+ const orderedTraits = [...orbital.traits ?? []].sort((a, b) => {
60325
+ const aName = typeof a === "string" ? a : a.name;
60326
+ const bName = typeof b === "string" ? b : b.name;
60327
+ const src = selectedPattern.sourceTrait;
60328
+ if (src && aName === src) return -1;
60329
+ if (src && bName === src) return 1;
60330
+ return 0;
60331
+ });
60332
+ for (const traitRef of orderedTraits) {
60333
+ if (typeof traitRef === "string") continue;
60334
+ const inline = "stateMachine" in traitRef ? traitRef.stateMachine : void 0;
60335
+ const resolved = "_resolved" in traitRef ? traitRef._resolved?.stateMachine : void 0;
60336
+ const sm = inline ?? resolved;
60337
+ const traitTransitions = sm?.transitions;
60338
+ if (!Array.isArray(traitTransitions)) continue;
60339
+ for (const tx of traitTransitions) {
60340
+ const hit = tryEffects(tx.effects ?? []);
60341
+ if (hit) return hit;
60342
+ }
60343
+ }
60312
60344
  }
60313
60345
  if (selectedPattern.patternId) {
60314
60346
  inspectorLog.warn("pattern-config-unresolved", () => ({
60315
60347
  patternId: selectedPattern.patternId,
60316
60348
  patternType: selectedPattern.patternType,
60349
+ sourceTrait: selectedPattern.sourceTrait,
60317
60350
  orbitalName,
60318
60351
  traitName,
60319
60352
  transitionEvent
60320
60353
  }));
60321
60354
  }
60322
60355
  return null;
60323
- }, [selectedPattern, transition, orbitalName, traitName, transitionEvent]);
60356
+ }, [selectedPattern, transition, schema, orbitalName, traitName, transitionEvent]);
60324
60357
  const orbCode = React93.useMemo(() => {
60325
60358
  const orbital = (schema.orbitals ?? []).find((o) => o.name === orbitalName);
60326
60359
  if (!orbital) return "{}";
package/dist/avl/index.js CHANGED
@@ -60250,12 +60250,16 @@ function OrbInspector({ node, schema, editable = false, userType = "builder", th
60250
60250
  }, [schema, orbitalName, traitName, transitionEvent]);
60251
60251
  const traits2 = useMemo(() => findTraits(schema, orbitalName), [schema, orbitalName]);
60252
60252
  const patternConfig = useMemo(() => {
60253
- if (!selectedPattern || !transition) return null;
60253
+ if (!selectedPattern) return null;
60254
60254
  const patternId = selectedPattern.patternId ?? "root";
60255
- for (const eff of transition.effects ?? []) {
60256
- if (Array.isArray(eff) && eff[0] === "render-ui" && eff[2]) {
60255
+ const tryEffects = (effects) => {
60256
+ for (const eff of effects) {
60257
+ if (!Array.isArray(eff) || eff[0] !== "render-ui" || !eff[2]) continue;
60257
60258
  const found = findPatternInTree(eff[2], patternId);
60258
60259
  if (!found) continue;
60260
+ if (selectedPattern.patternType && typeof found.type === "string" && found.type !== selectedPattern.patternType) {
60261
+ continue;
60262
+ }
60259
60263
  const nested = found.props;
60260
60264
  if (nested && typeof nested === "object" && !Array.isArray(nested)) {
60261
60265
  const { props: _stripped, ...rest } = found;
@@ -60263,18 +60267,47 @@ function OrbInspector({ node, schema, editable = false, userType = "builder", th
60263
60267
  }
60264
60268
  return found;
60265
60269
  }
60270
+ return null;
60271
+ };
60272
+ if (transition) {
60273
+ const direct = tryEffects(transition.effects ?? []);
60274
+ if (direct) return direct;
60275
+ }
60276
+ const orbital = schema.orbitals.find((o) => o.name === orbitalName);
60277
+ if (orbital) {
60278
+ const orderedTraits = [...orbital.traits ?? []].sort((a, b) => {
60279
+ const aName = typeof a === "string" ? a : a.name;
60280
+ const bName = typeof b === "string" ? b : b.name;
60281
+ const src = selectedPattern.sourceTrait;
60282
+ if (src && aName === src) return -1;
60283
+ if (src && bName === src) return 1;
60284
+ return 0;
60285
+ });
60286
+ for (const traitRef of orderedTraits) {
60287
+ if (typeof traitRef === "string") continue;
60288
+ const inline = "stateMachine" in traitRef ? traitRef.stateMachine : void 0;
60289
+ const resolved = "_resolved" in traitRef ? traitRef._resolved?.stateMachine : void 0;
60290
+ const sm = inline ?? resolved;
60291
+ const traitTransitions = sm?.transitions;
60292
+ if (!Array.isArray(traitTransitions)) continue;
60293
+ for (const tx of traitTransitions) {
60294
+ const hit = tryEffects(tx.effects ?? []);
60295
+ if (hit) return hit;
60296
+ }
60297
+ }
60266
60298
  }
60267
60299
  if (selectedPattern.patternId) {
60268
60300
  inspectorLog.warn("pattern-config-unresolved", () => ({
60269
60301
  patternId: selectedPattern.patternId,
60270
60302
  patternType: selectedPattern.patternType,
60303
+ sourceTrait: selectedPattern.sourceTrait,
60271
60304
  orbitalName,
60272
60305
  traitName,
60273
60306
  transitionEvent
60274
60307
  }));
60275
60308
  }
60276
60309
  return null;
60277
- }, [selectedPattern, transition, orbitalName, traitName, transitionEvent]);
60310
+ }, [selectedPattern, transition, schema, orbitalName, traitName, transitionEvent]);
60278
60311
  const orbCode = useMemo(() => {
60279
60312
  const orbital = (schema.orbitals ?? []).find((o) => o.name === orbitalName);
60280
60313
  if (!orbital) return "{}";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "4.51.12",
3
+ "version": "4.51.13",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [