mirror of
https://github.com/11ty/is-land.git
synced 2025-12-23 12:26:50 +00:00
Add better PE code for Alpine to workaround global mount. Renames autoinit to type (but keeps backwards compat). Adds Island.opts for more advanced config: attribute prefix rename and manual custom element define. Adds Island.addInitType and Island.addFallback functions. Swaps to use Import Maps on Lit, Svelte, and Solid examples.
25 lines
627 B
JavaScript
25 lines
627 B
JavaScript
import {createSignal} from "solid-js";
|
|
import html from "solid-js/html";
|
|
import { customElement } from "solid-element";
|
|
|
|
customElement('solid-component-client', { name: undefined },
|
|
|
|
/**
|
|
* @param {{name: string | undefined}} props
|
|
* @param {{element: HTMLElement}} input
|
|
*/
|
|
(props, { element }) => {
|
|
element.classList.add("test-c-finish");
|
|
const [count, setCount] = createSignal(0);
|
|
return html`
|
|
<style>
|
|
p { color: blue; margin: 0 }
|
|
</style>
|
|
<p>Hello, ${() => props.name || "Stranger"}!</p>
|
|
<div>
|
|
<button onclick=${() => setCount(count() + 1)} >Increment</button>
|
|
Counter: ${count}
|
|
</div>
|
|
`;
|
|
});
|
|
|