Skip to content

Allow to specify custom base class for Svelte Components #4168

Open
@kmmbvnr

Description

@kmmbvnr

Could we have an option to specify a custom base class for Svelte components?

<script>
import {BaseSvelteComponent} from './base';
</script>

<svelte:options base="BaseSvelteComponent"/>

base.js:

import {SvelteComponent} from 'svelte';

export class BaseSvelteComponent extends SvelteComponent {
 /* or could be completly own custom impl */
}

It would step to make Svelte a more generic compiler and could move many conflict decisions out of the scope of Svelte project.

It allows end-users of the compiler to make own decision. I think it could resolve things like Component inheritance, move towards a solution for Custom element without shadow DOM and Support attachShadow({mode: 'closed'}), handle Native HTML elements and
Form-associated custom elements and minor things like Define some attributes on Custom Elements

And it seems pretty easy to implement - kmmbvnr@4a7f317

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions