@almadar/ui 4.51.11 → 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.
- package/dist/avl/index.cjs +55 -7
- package/dist/avl/index.js +55 -7
- package/package.json +1 -1
package/dist/avl/index.cjs
CHANGED
|
@@ -60247,8 +60247,17 @@ function findPatternInTree(root, path) {
|
|
|
60247
60247
|
for (const part of parts) {
|
|
60248
60248
|
if (current === null || current === void 0 || typeof current !== "object") return null;
|
|
60249
60249
|
const record = current;
|
|
60250
|
-
if (part === "children"
|
|
60251
|
-
|
|
60250
|
+
if (part === "children") {
|
|
60251
|
+
if (Array.isArray(record.children)) {
|
|
60252
|
+
current = record.children;
|
|
60253
|
+
} else {
|
|
60254
|
+
const nestedProps = record.props;
|
|
60255
|
+
if (nestedProps && typeof nestedProps === "object" && !Array.isArray(nestedProps) && Array.isArray(nestedProps.children)) {
|
|
60256
|
+
current = nestedProps.children;
|
|
60257
|
+
} else {
|
|
60258
|
+
return null;
|
|
60259
|
+
}
|
|
60260
|
+
}
|
|
60252
60261
|
} else if (Array.isArray(current)) {
|
|
60253
60262
|
const idx = parseInt(part, 10);
|
|
60254
60263
|
if (isNaN(idx) || idx < 0 || idx >= current.length) return null;
|
|
@@ -60287,25 +60296,64 @@ function OrbInspector({ node, schema, editable = false, userType = "builder", th
|
|
|
60287
60296
|
}, [schema, orbitalName, traitName, transitionEvent]);
|
|
60288
60297
|
const traits2 = React93.useMemo(() => findTraits(schema, orbitalName), [schema, orbitalName]);
|
|
60289
60298
|
const patternConfig = React93.useMemo(() => {
|
|
60290
|
-
if (!selectedPattern
|
|
60299
|
+
if (!selectedPattern) return null;
|
|
60291
60300
|
const patternId = selectedPattern.patternId ?? "root";
|
|
60292
|
-
|
|
60293
|
-
|
|
60301
|
+
const tryEffects = (effects) => {
|
|
60302
|
+
for (const eff of effects) {
|
|
60303
|
+
if (!Array.isArray(eff) || eff[0] !== "render-ui" || !eff[2]) continue;
|
|
60294
60304
|
const found = findPatternInTree(eff[2], patternId);
|
|
60295
|
-
if (found)
|
|
60305
|
+
if (!found) continue;
|
|
60306
|
+
if (selectedPattern.patternType && typeof found.type === "string" && found.type !== selectedPattern.patternType) {
|
|
60307
|
+
continue;
|
|
60308
|
+
}
|
|
60309
|
+
const nested = found.props;
|
|
60310
|
+
if (nested && typeof nested === "object" && !Array.isArray(nested)) {
|
|
60311
|
+
const { props: _stripped, ...rest } = found;
|
|
60312
|
+
return { ...nested, ...rest };
|
|
60313
|
+
}
|
|
60314
|
+
return found;
|
|
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
|
+
}
|
|
60296
60343
|
}
|
|
60297
60344
|
}
|
|
60298
60345
|
if (selectedPattern.patternId) {
|
|
60299
60346
|
inspectorLog.warn("pattern-config-unresolved", () => ({
|
|
60300
60347
|
patternId: selectedPattern.patternId,
|
|
60301
60348
|
patternType: selectedPattern.patternType,
|
|
60349
|
+
sourceTrait: selectedPattern.sourceTrait,
|
|
60302
60350
|
orbitalName,
|
|
60303
60351
|
traitName,
|
|
60304
60352
|
transitionEvent
|
|
60305
60353
|
}));
|
|
60306
60354
|
}
|
|
60307
60355
|
return null;
|
|
60308
|
-
}, [selectedPattern, transition, orbitalName, traitName, transitionEvent]);
|
|
60356
|
+
}, [selectedPattern, transition, schema, orbitalName, traitName, transitionEvent]);
|
|
60309
60357
|
const orbCode = React93.useMemo(() => {
|
|
60310
60358
|
const orbital = (schema.orbitals ?? []).find((o) => o.name === orbitalName);
|
|
60311
60359
|
if (!orbital) return "{}";
|
package/dist/avl/index.js
CHANGED
|
@@ -60201,8 +60201,17 @@ function findPatternInTree(root, path) {
|
|
|
60201
60201
|
for (const part of parts) {
|
|
60202
60202
|
if (current === null || current === void 0 || typeof current !== "object") return null;
|
|
60203
60203
|
const record = current;
|
|
60204
|
-
if (part === "children"
|
|
60205
|
-
|
|
60204
|
+
if (part === "children") {
|
|
60205
|
+
if (Array.isArray(record.children)) {
|
|
60206
|
+
current = record.children;
|
|
60207
|
+
} else {
|
|
60208
|
+
const nestedProps = record.props;
|
|
60209
|
+
if (nestedProps && typeof nestedProps === "object" && !Array.isArray(nestedProps) && Array.isArray(nestedProps.children)) {
|
|
60210
|
+
current = nestedProps.children;
|
|
60211
|
+
} else {
|
|
60212
|
+
return null;
|
|
60213
|
+
}
|
|
60214
|
+
}
|
|
60206
60215
|
} else if (Array.isArray(current)) {
|
|
60207
60216
|
const idx = parseInt(part, 10);
|
|
60208
60217
|
if (isNaN(idx) || idx < 0 || idx >= current.length) return null;
|
|
@@ -60241,25 +60250,64 @@ function OrbInspector({ node, schema, editable = false, userType = "builder", th
|
|
|
60241
60250
|
}, [schema, orbitalName, traitName, transitionEvent]);
|
|
60242
60251
|
const traits2 = useMemo(() => findTraits(schema, orbitalName), [schema, orbitalName]);
|
|
60243
60252
|
const patternConfig = useMemo(() => {
|
|
60244
|
-
if (!selectedPattern
|
|
60253
|
+
if (!selectedPattern) return null;
|
|
60245
60254
|
const patternId = selectedPattern.patternId ?? "root";
|
|
60246
|
-
|
|
60247
|
-
|
|
60255
|
+
const tryEffects = (effects) => {
|
|
60256
|
+
for (const eff of effects) {
|
|
60257
|
+
if (!Array.isArray(eff) || eff[0] !== "render-ui" || !eff[2]) continue;
|
|
60248
60258
|
const found = findPatternInTree(eff[2], patternId);
|
|
60249
|
-
if (found)
|
|
60259
|
+
if (!found) continue;
|
|
60260
|
+
if (selectedPattern.patternType && typeof found.type === "string" && found.type !== selectedPattern.patternType) {
|
|
60261
|
+
continue;
|
|
60262
|
+
}
|
|
60263
|
+
const nested = found.props;
|
|
60264
|
+
if (nested && typeof nested === "object" && !Array.isArray(nested)) {
|
|
60265
|
+
const { props: _stripped, ...rest } = found;
|
|
60266
|
+
return { ...nested, ...rest };
|
|
60267
|
+
}
|
|
60268
|
+
return found;
|
|
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
|
+
}
|
|
60250
60297
|
}
|
|
60251
60298
|
}
|
|
60252
60299
|
if (selectedPattern.patternId) {
|
|
60253
60300
|
inspectorLog.warn("pattern-config-unresolved", () => ({
|
|
60254
60301
|
patternId: selectedPattern.patternId,
|
|
60255
60302
|
patternType: selectedPattern.patternType,
|
|
60303
|
+
sourceTrait: selectedPattern.sourceTrait,
|
|
60256
60304
|
orbitalName,
|
|
60257
60305
|
traitName,
|
|
60258
60306
|
transitionEvent
|
|
60259
60307
|
}));
|
|
60260
60308
|
}
|
|
60261
60309
|
return null;
|
|
60262
|
-
}, [selectedPattern, transition, orbitalName, traitName, transitionEvent]);
|
|
60310
|
+
}, [selectedPattern, transition, schema, orbitalName, traitName, transitionEvent]);
|
|
60263
60311
|
const orbCode = useMemo(() => {
|
|
60264
60312
|
const orbital = (schema.orbitals ?? []).find((o) => o.name === orbitalName);
|
|
60265
60313
|
if (!orbital) return "{}";
|