• Compile a context-menu condition into a predicate suitable for Foundry's ContextMenu base class. Function-form conditions are passed through unchanged; string-form conditions are evaluated as SafeExpressions. Parse errors and evaluation errors on the string form are caught and logged; the entry is treated as hidden (predicate returns false) rather than allowed to bubble.

    Parameters

    • source: ContextMenuCondition

      The condition source (string SafeExpression or a ready-made predicate function).

    • entryName: string

      The owning entry's display name, used in log output.

    • Optionalparent: SohlLogic

      The owning document's logic, used as the compiled expression's parent. Required to compile a string condition; a string condition without a parent is treated as hidden.

    Returns (target: HTMLElement) => boolean

    A predicate that evaluates the condition against a target.