Skip to content

feat: replace Show with structural If / Else control flow #78

Description

@taras

Summary

Replace the spec-only Show conditional-rendering design with first-class structural If and optional Else directives.

<If condition={hasFailures}>
## Test failures

<FailureReport />
<Else>
All checks passed.
</Else>
</If>

Rationale

Show suggests visual visibility. This feature is control flow: it chooses one branch to expand and render, while the other branch must not execute. If makes that behavior explicit.

Scope

  • Implement If and Else as structural built-ins in the expansion engine, analogous to Capture; do not resolve them as ordinary filesystem components.
  • Replace specification references and examples for Show with If.
  • Replace the proposed when/string-fallback API with a required boolean condition prop and optional block-form Else.

Semantics

  • condition resolves in the invocation eval environment and must be boolean.
  • Else is optional, accepts no props, and may appear once as a direct child of If.
  • If true, expand and render only children before Else.
  • If false, expand and render only Else children; without Else, render nothing.
  • The unselected branch must not import components, run eval/exec blocks, call providers, or create journal entries.

Acceptance criteria

  • If condition=true renders its children; condition=false renders no output without Else.
  • Expression conditions and lexical eval bindings resolve in the selected branch.
  • Only the selected branch expands and performs work; the other branch creates no journal entries.
  • Nested If blocks work independently.
  • Missing or non-boolean condition produces a clear validation error.
  • Else outside If, repeated Else, props on Else, and self-closing Else produce clear errors.
  • README and executable-MDX, code-review-agent, and oxlint-sensor specifications use If.
  • Deno, Node, and Bun tests cover selection, nesting, validation, and non-execution of unselected branches.

Non-goals

  • ElseIf.
  • Truthy/falsy coercion.
  • Positional component arguments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions