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