Skip to content

Commit 079ce99

Browse files
committed
Don't remove digits and _ from slot names
1 parent d1536b2 commit 079ce99

File tree

3 files changed

+128
-2
lines changed

3 files changed

+128
-2
lines changed

src/utils/names.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,5 @@ export function quote_prop_if_necessary(name: string) {
111111
}
112112

113113
export function sanitize(name: string) {
114-
return name.replace(/[^a-zA-Z]+/g, '_').replace(/^_/, '').replace(/_$/, '');
115-
}
114+
return name.replace(/[^a-zA-Z0-9_]+/g, '_').replace(/^_/, '').replace(/_$/, '');
115+
}
+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/* generated by Svelte vX.Y.Z */
2+
import {
3+
SvelteComponent as SvelteComponent_1,
4+
append,
5+
create_slot,
6+
detach,
7+
element,
8+
get_slot_changes,
9+
get_slot_context,
10+
init,
11+
insert,
12+
noop,
13+
safe_not_equal,
14+
space
15+
} from "svelte/internal";
16+
17+
function create_fragment(ctx) {
18+
var div, t0, t1;
19+
20+
const header_1_slot_1 = ctx.$$slot_header_1;
21+
const header_1_slot = create_slot(header_1_slot_1, ctx, null);
22+
23+
const header_2__slot_1 = ctx.$$slot_header_2_;
24+
const header_2__slot = create_slot(header_2__slot_1, ctx, null);
25+
26+
const header_3_slot_1 = ctx.$$slot_header_3;
27+
const header_3_slot = create_slot(header_3_slot_1, ctx, null);
28+
29+
return {
30+
c() {
31+
div = element("div");
32+
33+
if (header_1_slot) header_1_slot.c();
34+
t0 = space();
35+
36+
if (header_2__slot) header_2__slot.c();
37+
t1 = space();
38+
39+
if (header_3_slot) header_3_slot.c();
40+
},
41+
42+
l(nodes) {
43+
if (header_1_slot) header_1_slot.l(div_nodes);
44+
if (header_2__slot) header_2__slot.l(div_nodes);
45+
if (header_3_slot) header_3_slot.l(div_nodes);
46+
},
47+
48+
m(target, anchor) {
49+
insert(target, div, anchor);
50+
51+
if (header_1_slot) {
52+
header_1_slot.m(div, null);
53+
}
54+
55+
append(div, t0);
56+
57+
if (header_2__slot) {
58+
header_2__slot.m(div, null);
59+
}
60+
61+
append(div, t1);
62+
63+
if (header_3_slot) {
64+
header_3_slot.m(div, null);
65+
}
66+
},
67+
68+
p(changed, ctx) {
69+
if (header_1_slot && header_1_slot.p && changed.$$scope) {
70+
header_1_slot.p(get_slot_changes(header_1_slot_1, ctx, changed,), get_slot_context(header_1_slot_1, ctx, null));
71+
}
72+
73+
if (header_2__slot && header_2__slot.p && changed.$$scope) {
74+
header_2__slot.p(get_slot_changes(header_2__slot_1, ctx, changed,), get_slot_context(header_2__slot_1, ctx, null));
75+
}
76+
77+
if (header_3_slot && header_3_slot.p && changed.$$scope) {
78+
header_3_slot.p(get_slot_changes(header_3_slot_1, ctx, changed,), get_slot_context(header_3_slot_1, ctx, null));
79+
}
80+
},
81+
82+
i: noop,
83+
o: noop,
84+
85+
d(detaching) {
86+
if (detaching) {
87+
detach(div);
88+
}
89+
90+
if (header_1_slot) header_1_slot.d(detaching);
91+
92+
if (header_2__slot) header_2__slot.d(detaching);
93+
94+
if (header_3_slot) header_3_slot.d(detaching);
95+
}
96+
};
97+
}
98+
99+
function instance($$self, $$props, $$invalidate) {
100+
let { $$slot_header_1, $$slot_header_2_, $$slot_header_3, $$scope } = $$props;
101+
102+
$$self.$set = $$props => {
103+
if ('$$scope' in $$props) $$invalidate('$$scope', $$scope = $$props.$$scope);
104+
};
105+
106+
return {
107+
$$slot_header_1,
108+
$$slot_header_2_,
109+
$$slot_header_3,
110+
$$scope
111+
};
112+
}
113+
114+
class SvelteComponent extends SvelteComponent_1 {
115+
constructor(options) {
116+
super();
117+
init(this, options, instance, create_fragment, safe_not_equal, []);
118+
}
119+
}
120+
121+
export default SvelteComponent;
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<div>
2+
<slot name="_header-1" />
3+
<slot name="header-2_-" />
4+
<slot name="-header-3-" />
5+
</div>

0 commit comments

Comments
 (0)