Don't remove digits and _ from slot names

pull/2304/head
Mikhail Korepanov 6 years ago
parent d1536b21a2
commit 079ce998ef

@ -111,5 +111,5 @@ export function quote_prop_if_necessary(name: string) {
}
export function sanitize(name: string) {
return name.replace(/[^a-zA-Z]+/g, '_').replace(/^_/, '').replace(/_$/, '');
}
return name.replace(/[^a-zA-Z0-9_]+/g, '_').replace(/^_/, '').replace(/_$/, '');
}

@ -0,0 +1,121 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent as SvelteComponent_1,
append,
create_slot,
detach,
element,
get_slot_changes,
get_slot_context,
init,
insert,
noop,
safe_not_equal,
space
} from "svelte/internal";
function create_fragment(ctx) {
var div, t0, t1;
const header_1_slot_1 = ctx.$$slot_header_1;
const header_1_slot = create_slot(header_1_slot_1, ctx, null);
const header_2__slot_1 = ctx.$$slot_header_2_;
const header_2__slot = create_slot(header_2__slot_1, ctx, null);
const header_3_slot_1 = ctx.$$slot_header_3;
const header_3_slot = create_slot(header_3_slot_1, ctx, null);
return {
c() {
div = element("div");
if (header_1_slot) header_1_slot.c();
t0 = space();
if (header_2__slot) header_2__slot.c();
t1 = space();
if (header_3_slot) header_3_slot.c();
},
l(nodes) {
if (header_1_slot) header_1_slot.l(div_nodes);
if (header_2__slot) header_2__slot.l(div_nodes);
if (header_3_slot) header_3_slot.l(div_nodes);
},
m(target, anchor) {
insert(target, div, anchor);
if (header_1_slot) {
header_1_slot.m(div, null);
}
append(div, t0);
if (header_2__slot) {
header_2__slot.m(div, null);
}
append(div, t1);
if (header_3_slot) {
header_3_slot.m(div, null);
}
},
p(changed, ctx) {
if (header_1_slot && header_1_slot.p && changed.$$scope) {
header_1_slot.p(get_slot_changes(header_1_slot_1, ctx, changed,), get_slot_context(header_1_slot_1, ctx, null));
}
if (header_2__slot && header_2__slot.p && changed.$$scope) {
header_2__slot.p(get_slot_changes(header_2__slot_1, ctx, changed,), get_slot_context(header_2__slot_1, ctx, null));
}
if (header_3_slot && header_3_slot.p && changed.$$scope) {
header_3_slot.p(get_slot_changes(header_3_slot_1, ctx, changed,), get_slot_context(header_3_slot_1, ctx, null));
}
},
i: noop,
o: noop,
d(detaching) {
if (detaching) {
detach(div);
}
if (header_1_slot) header_1_slot.d(detaching);
if (header_2__slot) header_2__slot.d(detaching);
if (header_3_slot) header_3_slot.d(detaching);
}
};
}
function instance($$self, $$props, $$invalidate) {
let { $$slot_header_1, $$slot_header_2_, $$slot_header_3, $$scope } = $$props;
$$self.$set = $$props => {
if ('$$scope' in $$props) $$invalidate('$$scope', $$scope = $$props.$$scope);
};
return {
$$slot_header_1,
$$slot_header_2_,
$$slot_header_3,
$$scope
};
}
class SvelteComponent extends SvelteComponent_1 {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, []);
}
}
export default SvelteComponent;

@ -0,0 +1,5 @@
<div>
<slot name="_header-1" />
<slot name="header-2_-" />
<slot name="-header-3-" />
</div>
Loading…
Cancel
Save