/*
  Do not manually edit this file, it was auto-generated by djelm
  https://github.com/Confidenceman02/djelm
*/
{{cookiecutter.lists.imports | join("\n")}}

const views = {
    djelm{{cookiecutter.view_name}}: async (el: HTMLElement, data: any) => {
        //@ts-ignore
        const { Elm } = await import("../../../src/{{cookiecutter.base_path}}{{cookiecutter.program_name}}.elm")

        const app = Elm.{{cookiecutter.base_name}}{{cookiecutter.program_name}}.init({
            node: el,
            flags: data,
        });
        {% if cookiecutter.lists.extras %}
        {{cookiecutter.lists.extras | join("\n")}}
        {% endif %}
        return {
            // Called whenever the value of the `djelm` attribute changes
            update: (newData, oldData) => {},
            // Called when the element (or its djelm attribute) is removed from the DOM
            destroy: () => {},
        };
    }
}

defo({ views, prefix: "{{cookiecutter.scope}}" })
