feat: implement directional alignment predicate evaluators (no more NYI)
- Replace makeNotImplementedPredicate stubs for leftAlignedWith, rightAlignedWith, topAlignedWith, bottomAlignedWith with real evaluators delegating to alignedWithPredicate with axis option - Update logic-engine.test.ts to expect real evaluation results instead of IMH_FEATURE_NOT_YET_IMPLEMENTED
This commit is contained in:
@@ -972,10 +972,33 @@ export const separatedFromPredicate: PredicateEvaluator = {
|
||||
return makePredicateResult(pass ? 'true' : 'false', metrics, [subjectId, referenceId]);
|
||||
},
|
||||
};
|
||||
export const leftAlignedWithPredicate = makeNotImplementedPredicate('leftAlignedWith');
|
||||
export const rightAlignedWithPredicate = makeNotImplementedPredicate('rightAlignedWith');
|
||||
export const topAlignedWithPredicate = makeNotImplementedPredicate('topAlignedWith');
|
||||
export const bottomAlignedWithPredicate = makeNotImplementedPredicate('bottomAlignedWith');
|
||||
export const leftAlignedWithPredicate: PredicateEvaluator = {
|
||||
descriptor: { name: 'leftAlignedWith', arity: 2, domains: ['element', 'element'], requiredFacts: ['subject.primaryBox', 'reference.primaryBox'] },
|
||||
evaluateTuple(world, tuple, options) {
|
||||
return alignedWithPredicate.evaluateTuple(world, tuple, { ...options as Record<string, unknown>, axis: 'left' });
|
||||
},
|
||||
};
|
||||
|
||||
export const rightAlignedWithPredicate: PredicateEvaluator = {
|
||||
descriptor: { name: 'rightAlignedWith', arity: 2, domains: ['element', 'element'], requiredFacts: ['subject.primaryBox', 'reference.primaryBox'] },
|
||||
evaluateTuple(world, tuple, options) {
|
||||
return alignedWithPredicate.evaluateTuple(world, tuple, { ...options as Record<string, unknown>, axis: 'right' });
|
||||
},
|
||||
};
|
||||
|
||||
export const topAlignedWithPredicate: PredicateEvaluator = {
|
||||
descriptor: { name: 'topAlignedWith', arity: 2, domains: ['element', 'element'], requiredFacts: ['subject.primaryBox', 'reference.primaryBox'] },
|
||||
evaluateTuple(world, tuple, options) {
|
||||
return alignedWithPredicate.evaluateTuple(world, tuple, { ...options as Record<string, unknown>, axis: 'top' });
|
||||
},
|
||||
};
|
||||
|
||||
export const bottomAlignedWithPredicate: PredicateEvaluator = {
|
||||
descriptor: { name: 'bottomAlignedWith', arity: 2, domains: ['element', 'element'], requiredFacts: ['subject.primaryBox', 'reference.primaryBox'] },
|
||||
evaluateTuple(world, tuple, options) {
|
||||
return alignedWithPredicate.evaluateTuple(world, tuple, { ...options as Record<string, unknown>, axis: 'bottom' });
|
||||
},
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Register Defaults
|
||||
|
||||
Reference in New Issue
Block a user