blob: 78d8720f0f57cbac03081b5afcda728eccb862d5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import { h, render } from 'preact';
import StaticHtml from './static-html.js';
export default (element) =>
(Component, props, { default: children, ...slotted }) => {
if (!element.hasAttribute('ssr')) return;
for (const [key, value] of Object.entries(slotted)) {
props[key] = h(StaticHtml, { value, name: key });
}
render(
h(Component, props, children != null ? h(StaticHtml, { value: children }) : children),
element
);
};
|