You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.1 KiB
32 lines
1.1 KiB
<script lang="ts">
|
|
import type { ConditionBuilderStore } from '../stores/ConditionEditor.svelte.ts';
|
|
import ConditionNode from './ConditionNode.svelte';
|
|
|
|
interface Props {
|
|
store: ConditionBuilderStore;
|
|
onchange?: (compiled: unknown) => void;
|
|
onvalid?: (valid: boolean) => void;
|
|
}
|
|
|
|
let { store, onchange, onvalid }: Props = $props();
|
|
|
|
$effect(() => { onchange?.(store.compiled); });
|
|
$effect(() => { onvalid?.(store.isValid); });
|
|
</script>
|
|
|
|
<div class="flex flex-col gap-2">
|
|
|
|
{#if store.tautology.kind === 'always-true'}
|
|
<div class="rounded bg-amber-50 border border-amber-300 px-3 py-1.5 text-sm text-amber-700">
|
|
⚠️ Esta condición siempre es <strong>verdadera</strong>
|
|
</div>
|
|
{:else if store.tautology.kind === 'always-false'}
|
|
<div class="rounded bg-red-50 border border-red-300 px-3 py-1.5 text-sm text-red-700">
|
|
⚠️ Esta condición siempre es <strong>falsa</strong>
|
|
</div>
|
|
{/if}
|
|
|
|
<ConditionNode node={store.root} {store} depth={0} />
|
|
|
|
</div>
|