import { ListItemNode, registerListStrictIndentTransform } from "@lexical/list";
import { ListNode } from "@lexical/list";
import { createEffect, mergeProps, onCleanup } from "solid-js";
import { useLexicalComposerContext } from "./LexicalComposerContext";
import { useList } from "./shared/useList";
export function ListPlugin(props) {
    props = mergeProps({ hasStrictIndent: false }, props);
    const [editor] = useLexicalComposerContext();
    createEffect(() => {
        if (!editor.hasNodes([ListNode, ListItemNode])) {
            throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");
        }
    });
    createEffect(() => {
        if (!props.hasStrictIndent) {
            return;
        }
        onCleanup(registerListStrictIndentTransform(editor));
    });
    useList(editor);
    return null;
}
