import { template as _$template } from '@solidjs/web';
import { getNextElement as _$getNextElement } from '@solidjs/web';
import { getNextMarker as _$getNextMarker } from '@solidjs/web';
import { insert as _$insert } from '@solidjs/web';
import { scope as _$scope } from '@solidjs/web';
import { createComponent as _$createComponent } from '@solidjs/web';
import { className as _$className } from '@solidjs/web';
import { effect as _$effect } from '@solidjs/web';
import { addEvent as _$addEvent } from '@solidjs/web';
import { delegateEvents as _$delegateEvents } from '@solidjs/web';
import { runHydrationEvents as _$runHydrationEvents } from '@solidjs/web';
var _tmpl$ = _$template(`<span>`);
var _tmpl$2 = _$template(
`<button type=button><!$><!/><!$><!/>`,
);
var _tmpl$3 = _$template(
`<p class=counter><!$><!/>: <!$><!/> <!$><!/>`,
);
var _tmpl$4 = _$template(`<pre>debug panel`);
var _tmpl$5 = _$template(
`<main><h1>Hello</h1><!$><!/><!$><!/>`,
);
import { Show, createSignal } from 'solid-js';
import type { JSX } from '@solidjs/web';
const DEBUG = false;
function Icon(props: { name: string }) {
var _el$ = _$getNextElement(_tmpl$);
_$effect(
() => `icon icon-${props.name}`,
(_v$, _$p) => {
_$className(_el$, _v$, _$p);
},
);
return _el$;
}
function Button(props: {
icon: string;
onClick: () => void;
children: JSX.Element;
}) {
var _el$2 = _$getNextElement(_tmpl$2);
var _el$3 = _el$2.firstChild;
var [_el$4, _el$5] = _$getNextMarker(_el$3.nextSibling);
var _el$6 = _el$4.nextSibling;
var [_el$7, _el$8] = _$getNextMarker(_el$6.nextSibling);
_$addEvent(_el$2, 'click', props.onClick, true);
_$insert(
_el$2,
_$createComponent(Icon, {
get name() {
return props.icon;
},
}),
_el$4,
_el$5,
);
_$insert(
_el$2,
_$scope(() => {
return props.children;
}),
_el$7,
_el$8,
);
_$runHydrationEvents();
return _el$2;
}
function Counter(props: { label: string; start: number }) {
const [count, setCount] = createSignal(props.start);
var _el$9 = _$getNextElement(_tmpl$3);
var _el$10 = _el$9.firstChild;
var [_el$11, _el$12] = _$getNextMarker(_el$10.nextSibling);
var _el$13 = _el$11.nextSibling;
var _el$14 = _el$13.nextSibling;
var [_el$15, _el$16] = _$getNextMarker(_el$14.nextSibling);
var _el$17 = _el$15.nextSibling;
var _el$18 = _el$17.nextSibling;
var [_el$19, _el$20] = _$getNextMarker(_el$18.nextSibling);
_$insert(
_el$9,
_$scope(() => {
return props.label;
}),
_el$11,
_el$12,
);
_$insert(
_el$9,
_$scope(() => {
return count();
}),
_el$15,
_el$16,
);
_$insert(
_el$9,
_$createComponent(Button, {
icon: 'plus',
onClick: () => setCount(count() + 1),
children: 'Add',
}),
_el$19,
_el$20,
);
return _el$9;
}
export function App() {
var _el$21 = _$getNextElement(_tmpl$5);
var _el$22 = _el$21.firstChild;
var _el$24 = _el$22.nextSibling;
var [_el$25, _el$26] = _$getNextMarker(_el$24.nextSibling);
var _el$27 = _el$25.nextSibling;
var [_el$28, _el$29] = _$getNextMarker(_el$27.nextSibling);
_$insert(
_el$21,
_$createComponent(Show, {
when: DEBUG,
get children() {
return _$getNextElement(_tmpl$4);
},
}),
_el$25,
_el$26,
);
_$insert(
_el$21,
_$createComponent(Counter, {
label: 'Clicks',
start: 0,
}),
_el$28,
_el$29,
);
return _el$21;
}
_$delegateEvents(['click']);