Skip to content

Commit 056a1ae

Browse files
authored
chore: move slot function into its own module (#12357)
1 parent 94197b0 commit 056a1ae

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* @param {Comment} anchor
3+
* @param {void | ((anchor: Comment, slot_props: Record<string, unknown>) => void)} slot_fn
4+
* @param {Record<string, unknown>} slot_props
5+
* @param {null | ((anchor: Comment) => void)} fallback_fn
6+
*/
7+
export function slot(anchor, slot_fn, slot_props, fallback_fn) {
8+
if (slot_fn === undefined) {
9+
if (fallback_fn !== null) {
10+
fallback_fn(anchor);
11+
}
12+
} else {
13+
slot_fn(anchor, slot_props);
14+
}
15+
}

packages/svelte/src/internal/client/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export { key_block as key } from './dom/blocks/key.js';
1515
export { css_props } from './dom/blocks/css-props.js';
1616
export { index, each } from './dom/blocks/each.js';
1717
export { html } from './dom/blocks/html.js';
18+
export { slot } from './dom/blocks/slot.js';
1819
export { snippet, wrap_snippet } from './dom/blocks/snippet.js';
1920
export { component } from './dom/blocks/svelte-component.js';
2021
export { element } from './dom/blocks/svelte-element.js';
@@ -118,7 +119,7 @@ export {
118119
update_pre_store,
119120
update_store
120121
} from './reactivity/store.js';
121-
export { append_styles, sanitize_slots, set_text, slot } from './render.js';
122+
export { append_styles, sanitize_slots, set_text } from './render.js';
122123
export {
123124
get,
124125
invalidate_inner_signals,

packages/svelte/src/internal/client/render.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,6 @@ export function set_text(text, value) {
4949
}
5050
}
5151

52-
/**
53-
* @param {Comment} anchor
54-
* @param {void | ((anchor: Comment, slot_props: Record<string, unknown>) => void)} slot_fn
55-
* @param {Record<string, unknown>} slot_props
56-
* @param {null | ((anchor: Comment) => void)} fallback_fn
57-
*/
58-
export function slot(anchor, slot_fn, slot_props, fallback_fn) {
59-
if (slot_fn === undefined) {
60-
if (fallback_fn !== null) {
61-
fallback_fn(anchor);
62-
}
63-
} else {
64-
slot_fn(anchor, slot_props);
65-
}
66-
}
67-
6852
/**
6953
* Mounts a component to the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component.
7054
* Transitions will play during the initial render unless the `intro` option is set to `false`.

0 commit comments

Comments
 (0)