precompile

Signed-off-by: Hadi <[email protected]>
This commit is contained in:
Hadi
2026-09-01 10:57:30 +02:00
parent 12305ba1f2
commit 038842878a
46 changed files with 1602 additions and 2 deletions
+26
View File
@@ -0,0 +1,26 @@
// @bun
// src/context/helper.tsx
import { createComponent as _$createComponent } from "@opentui/solid";
import { createContext, useContext } from "solid-js";
function createSimpleContext(input) {
const ctx = createContext();
return {
provider: (props) => {
const value = input.init(props);
return _$createComponent(ctx.Provider, {
value,
get children() {
return props.children;
}
});
},
use() {
const value = useContext(ctx);
if (!value)
throw new Error(`${input.name} context must be used within its provider`);
return value;
}
};
}
export { createSimpleContext };