summaryrefslogtreecommitdiff
path: root/packages/integrations/svelte/client.js
blob: 3f401b544f940ed3f52cb3e0501e606f244e36dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import SvelteWrapper from './Wrapper.svelte';

export default (target) => {
	return (component, props, children, { client }) => {
		if (!target.hasAttribute('ssr')) return;
		delete props['class'];
		try {
			new SvelteWrapper({
				target,
				props: { __astro_component: component, __astro_children: children, ...props },
				hydrate: client !== 'only',
			});
		} catch (e) {}
	};
};