mirror of https://github.com/sveltejs/svelte
parent
c435703dd2
commit
2c8228a7eb
@ -0,0 +1,6 @@
|
||||
export default {
|
||||
options: {
|
||||
customElement: true,
|
||||
shadowDom: false
|
||||
}
|
||||
};
|
@ -0,0 +1,54 @@
|
||||
/* generated by Svelte vX.Y.Z */
|
||||
import {
|
||||
SvelteElement,
|
||||
detach,
|
||||
element,
|
||||
init,
|
||||
insert,
|
||||
noop,
|
||||
safe_not_equal
|
||||
} from "svelte/internal";
|
||||
|
||||
function create_fragment(ctx) {
|
||||
var h1;
|
||||
|
||||
return {
|
||||
c() {
|
||||
h1 = element("h1");
|
||||
h1.textContent = "Hello world";
|
||||
this.c = noop;
|
||||
},
|
||||
|
||||
m(target, anchor) {
|
||||
insert(target, h1, anchor);
|
||||
},
|
||||
|
||||
p: noop,
|
||||
i: noop,
|
||||
o: noop,
|
||||
|
||||
d(detaching) {
|
||||
if (detaching) {
|
||||
detach(h1);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
class Component extends SvelteElement {
|
||||
constructor(options) {
|
||||
super({ use_shadow_dom: true });
|
||||
|
||||
init(this, { target: this }, null, create_fragment, safe_not_equal, []);
|
||||
|
||||
if (options) {
|
||||
if (options.target) {
|
||||
insert(options.target, this, options.anchor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("custom-element", Component);
|
||||
|
||||
export default Component;
|
@ -0,0 +1,9 @@
|
||||
<svelte:options tag="custom-element"/>
|
||||
|
||||
<h1>Hello world</h1>
|
||||
|
||||
<style>
|
||||
h1 {
|
||||
color: blue;
|
||||
}
|
||||
</style>
|
Loading…
Reference in new issue