Skip to content

The VS Code of video editing, built for agents.

TypeScript

Update package-lock.json to include new dependencies for koota and koota-solid

konstantin-paulus46b4c225a19b
diff --git a/package-lock.json b/package-lock.json
index 50ddb836..060b6431 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -593,6 +593,10 @@
"resolved": "packages/jsx",
"link": true
},
+ "node_modules/@diffusionstudio/koota-solid": {
+ "resolved": "packages/koota-solid",
+ "link": true
+ },
"node_modules/@diffusionstudio/web": {
"resolved": "apps/web",
"link": true
@@ -7871,6 +7875,24 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/koota": {
+ "version": "0.6.6",
+ "resolved": "https://registry.npmjs.org/koota/-/koota-0.6.6.tgz",
+ "integrity": "sha512-Fn8lSooH3u9TIP+eAMugFrOju40Ec70+sB7x1eZBB3H0Lki2hyIbFAodk3NDB/RIRzoMs54O4422BVN6SbtWfw==",
+ "license": "ISC",
+ "peerDependencies": {
+ "@types/react": ">=18.0.0",
+ "react": ">=18.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "react": {
+ "optional": true
+ }
+ }
+ },
"node_modules/levn": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
@@ -11845,6 +11867,20 @@
"peerDependencies": {
"solid-js": "^1.9.0"
}
+ },
+ "packages/koota-solid": {
+ "name": "@diffusionstudio/koota-solid",
+ "version": "0.1.0",
+ "license": "MPL-2.0",
+ "dependencies": {
+ "koota": "^0.6.6"
+ },
+ "devDependencies": {
+ "typescript": "~5.9.3"
+ },
+ "peerDependencies": {
+ "solid-js": "^1.9.0"
+ }
}
}
}
diff --git a/packages/koota-solid/README.md b/packages/koota-solid/README.md
new file mode 100644
index 00000000..ff79bd6f
--- /dev/null
+++ b/packages/koota-solid/README.md
@@ -0,0 +1,43 @@
+# @diffusionstudio/koota-solid
+
+Solid bindings for [koota](https://github.com/pmndrs/koota): a port of `@koota/react` used while migrating the editor from bitecs to koota. The API mirrors `@koota/react` one to one, adapted to Solid's reactivity model.
+
+## Usage
+
+```tsx
+import { createWorld, trait } from 'koota';
+import { WorldProvider, useQuery, useTrait } from '@diffusionstudio/koota-solid';
+
+const Position = trait({ x: 0, y: 0 });
+const world = createWorld();
+
+function App() {
+ return (
+ <WorldProvider world={world}>
+ <EntityList />
+ </WorldProvider>
+ );
+}
+
+function EntityList() {
+ const entities = useQuery(Position);
+ return <For each={entities()}>{(entity) => <EntityView entity={entity} />}</For>;
+}
+
+function EntityView(props: { entity: Entity }) {
+ // Pass reactive inputs as accessors so the hook resubscribes when they change
+ const pos = useTrait(() => props.entity, Position);
+ return <div>{pos()?.x}, {pos()?.y}</div>;
+}
+```
+
+## Differences from `@koota/react`
+
+- Every hook returns an `Accessor` instead of a plain value: call it (`pos()`, `entities()`) inside JSX, memos, or effects to subscribe.
+- Solid components run once, so hooks are set up once. Where React re-renders with new props, here you pass reactive inputs as accessors: the `target` argument of `useTrait`, `useTraitEffect`, `useTag`, `useHas`, `useTarget`, and `useTargets` accepts `Entity | World` or an accessor returning one.
+- The `trait` argument of `useTrait`, `useTraitEffect`, and `useHas` also accepts an accessor, which matters for relation pairs with reactive targets: `useTrait(entity, () => ChildOf(parent()))`. Pair identity is compared by relation + target, so re-evaluations with the same pair do not resubscribe.
+- `useTraitEffect` runs its callback untracked, like the React version. Cleanup is tied to the owning component.
+
+## Exports
+
+`WorldProvider`, `useWorld`, `useActions`, `useQuery`, `useQueryFirst`, `useTrait`, `useTraitEffect`, `useTag`, `useHas`, `useTarget`, `useTargets`, plus the `MaybeAccessor` type and `access` helper.
diff --git a/packages/koota-solid/package.json b/packages/koota-solid/package.json
new file mode 100644
index 00000000..31f3551b
--- /dev/null
+++ b/packages/koota-solid/package.json
@@ -0,0 +1,28 @@
+{
+ "name": "@diffusionstudio/koota-solid",
+ "version": "0.1.0",
+ "description": "Solid bindings for koota — a port of @koota/react used while migrating the editor from bitecs to koota.",
+ "license": "MPL-2.0",
+ "type": "module",
+ "sideEffects": false,
+ "exports": {
+ ".": "./src/index.ts"
+ },
+ "scripts": {
+ "check": "tsc --noEmit"
+ },
+ "keywords": [
+ "koota",
+ "ecs",
+ "solid-js"
+ ],
+ "dependencies": {
+ "koota": "^0.6.6"
+ },
+ "peerDependencies": {
+ "solid-js": "^1.9.0"
+ },
+ "devDependencies": {
+ "typescript": "~5.9.3"
+ }
+}
diff --git a/packages/koota-solid/src/hooks/use-actions.ts b/packages/koota-solid/src/hooks/use-actions.ts
new file mode 100644
index 00000000..1e4807a6
--- /dev/null
+++ b/packages/koota-solid/src/hooks/use-actions.ts
@@ -0,0 +1,9 @@
+import type { World } from 'koota';
+import { useWorld } from '../world/use-world';
+
+export function useActions<T extends Record<string, (...args: any[]) => any>>(
+ actions: (world: World) => T
+) {
+ const world = useWorld();
+ return actions(world);
+}
diff --git a/packages/koota-solid/src/hooks/use-has.ts b/packages/koota-solid/src/hooks/use-has.ts
new file mode 100644
index 00000000..7b7bfb94
--- /dev/null
+++ b/packages/koota-solid/src/hooks/use-has.ts
@@ -0,0 +1,56 @@
+import { $internal, $relationPair, type Entity, type RelationPair, type Trait, type World } from 'koota';
+import { createComputed, createSignal, onCleanup, type Accessor } from 'solid-js';
+import { isWorld } from '../utils/is-world';
+import { access, createStableTrait, type MaybeAccessor } from '../utils/reactive-args';
+import { useWorld } from '../world/use-world';
+
+export function useHas(
+ target: MaybeAccessor<Entity | World | undefined | null>,
+ trait: MaybeAccessor<Trait | RelationPair>
+): Accessor<boolean> {
+ const contextWorld = useWorld();
+ const stableTrait = createStableTrait(trait);
+ const [value, setValue] = createSignal(false);
+
+ createComputed(() => {
+ const currentTarget = access(target);
+ const currentTrait = stableTrait();
+
+ if (!currentTarget) {
+ setValue(false);
+ return;
+ }
+
+ const world = isWorld(currentTarget) ? currentTarget : contextWorld;
+ const entity = isWorld(currentTarget) ? currentTarget[$internal].worldEntity : currentTarget;
+
+ // Wildcard pairs like ChildOf('*') fire on every pair removal, but the entity
+ // may still have other pairs. Since onRemove fires before state cleanup,
+ // we check targetsFor().length > 1 (the removed target is still counted).
+ const isWildcard =
+ !!(currentTrait as any)?.[$relationPair] && (currentTrait as RelationPair).target === '*';
+ const wildcardRelation = isWildcard ? (currentTrait as RelationPair).relation : undefined;
+
+ const onAddUnsub = world.onAdd(currentTrait, (e) => {
+ if (e === entity) setValue(true);
+ });
+
+ const onRemoveUnsub = world.onRemove(currentTrait, (e) => {
+ if (e !== entity) return;
+ if (wildcardRelation) {
+ setValue(entity.targetsFor(wildcardRelation).length > 1);
+ } else {
+ setValue(false);
+ }
+ });
+
+ setValue(entity.has(currentTrait));
+
+ onCleanup(() => {
+ onAddUnsub();
+ onRemoveUnsub();
+ });
+ });
+
+ return value;
+}
diff --git a/packages/koota-solid/src/hooks/use-query-first.ts b/packages/koota-solid/src/hooks/use-query-first.ts
new file mode 100644
index 00000000..6417b9cc
--- /dev/null
+++ b/packages/koota-solid/src/hooks/use-query-first.ts
@@ -0,0 +1,10 @@
+import type { Entity, QueryParameter } from 'koota';
+import type { Accessor } from 'solid-js';
+import { useQuery } from './use-query';
+
+export function useQueryFirst<T extends QueryParameter[]>(
+ ...parameters: T
+): Accessor<Entity | undefined> {
+ const query = useQuery(...parameters);
+ return () => query()[0];
+}
diff --git a/packages/koota-solid/src/hooks/use-query.ts b/packages/koota-solid/src/hooks/use-query.ts
new file mode 100644
index 00000000..e0597fab
--- /dev/null
+++ b/packages/koota-solid/src/hooks/use-query.ts
@@ -0,0 +1,41 @@
+import { $internal, createQuery, type QueryParameter, type QueryResult } from 'koota';
+import { createSignal, onCleanup, type Accessor } from 'solid-js';
+import { useWorld } from '../world/use-world';
+
+export function useQuery<T extends QueryParameter[]>(
+ ...parameters: T
+): Accessor<QueryResult<T>> {
+ const world = useWorld();
+ const queryRef = createQuery(...parameters);
+
+ const [result, setResult] = createSignal<QueryResult<T>>(world.query(queryRef).sort(), {
+ equals: false,
+ });
+ const update = () => setResult(world.query(queryRef).sort());
+
+ let unsubAdd = () => {};
+ let unsubRemove = () => {};
+
+ const subscribe = () => {
+ unsubAdd = world.onQueryAdd(queryRef, update);
+ unsubRemove = world.onQueryRemove(queryRef, update);
+ };
+
+ const handleReset = () => {
+ unsubAdd();
+ unsubRemove();
+ subscribe();
+ update();
+ };
+
+ subscribe();
+ world[$internal].resetSubscriptions.add(handleReset);
+
+ onCleanup(() => {
+ world[$internal].resetSubscriptions.delete(handleReset);
+ unsubAdd();
+ unsubRemove();
+ });
+
+ return result;
+}
diff --git a/packages/koota-solid/src/hooks/use-tag.ts b/packages/koota-solid/src/hooks/use-tag.ts
new file mode 100644
index 00000000..1003c1dc
--- /dev/null
+++ b/packages/koota-solid/src/hooks/use-tag.ts
@@ -0,0 +1,42 @@
+import { $internal, type Entity, type TagTrait, type World } from 'koota';
+import { createComputed, createSignal, onCleanup, type Accessor } from 'solid-js';
+import { isWorld } from '../utils/is-world';
+import { access, type MaybeAccessor } from '../utils/reactive-args';
+import { useWorld } from '../world/use-world';
+
+export function useTag(
+ target: MaybeAccessor<Entity | World | undefined | null>,
+ tag: TagTrait
+): Accessor<boolean> {
+ const contextWorld = useWorld();
+ const [value, setValue] = createSignal(false);
+
+ createComputed(() => {
+ const currentTarget = access(target);
+
+ if (!currentTarget) {
+ setValue(false);
+ return;
+ }
+
+ const world = isWorld(currentTarget) ? currentTarget : contextWorld;
+ const entity = isWorld(currentTarget) ? currentTarget[$internal].worldEntity : currentTarget;
+
+ const onAddUnsub = world.onAdd(tag, (e) => {
+ if (e === entity) setValue(true);
+ });
+
+ const onRemoveUnsub = world.onRemove(tag, (e) => {
+ if (e === entity) setValue(false);
+ });
+
+ setValue(entity.has(tag));
+
+ onCleanup(() => {
+ onAddUnsub();
+ onRemoveUnsub();
+ });
+ });
+
+ return value;
+}
diff --git a/packages/koota-solid/src/hooks/use-target.ts b/packages/koota-solid/src/hooks/use-target.ts
new file mode 100644
index 00000000..6e1ff87c
--- /dev/null
+++ b/packages/koota-solid/src/hooks/use-target.ts
@@ -0,0 +1,47 @@
+import { $internal, type Entity, type Relation, type Trait, type World } from 'koota';
+import { createComputed, createSignal, onCleanup, type Accessor } from 'solid-js';
+import { isWorld } from '../utils/is-world';
+import { access, type MaybeAccessor } from '../utils/reactive-args';
+import { useWorld } from '../world/use-world';
+
+export function useTarget<T extends Trait>(
+ target: MaybeAccessor<Entity | World | undefined | null>,
+ relation: Relation<T>
+): Accessor<Entity | undefined> {
+ const contextWorld = useWorld();
+ const [value, setValue] = createSignal<Entity | undefined>(undefined);
+
+ createComputed(() => {
+ const currentTarget = access(target);
+
+ if (!currentTarget) {
+ setValue(undefined);
+ return;
+ }
+
+ const world = isWorld(currentTarget) ? currentTarget : contextWorld;
+ const entity = isWorld(currentTarget) ? currentTarget[$internal].worldEntity : currentTarget;
+
+ const onAddUnsub = world.onAdd(relation, (e) => {
+ if (e === entity) setValue(entity.targetFor(relation));
+ });
+
+ const onRemoveUnsub = world.onRemove(relation, (e) => {
+ if (e === entity) setValue(undefined);
+ });
+
+ const onChangeUnsub = world.onChange(relation, (e) => {
+ if (e === entity) setValue(entity.targetFor(relation));
+ });
+
+ setValue(entity.targetFor(relation));
+
+ onCleanup(() => {
+ onAddUnsub();
+ onRemoveUnsub();
+ onChangeUnsub();
+ });
+ });
+
+ return value;
+}
diff --git a/packages/koota-solid/src/hooks/use-targets.ts b/packages/koota-solid/src/hooks/use-targets.ts
new file mode 100644
index 00000000..dc20795b
--- /dev/null
+++ b/packages/koota-solid/src/hooks/use-targets.ts
@@ -0,0 +1,56 @@
+import { $internal, type Entity, type Relation, type Trait, type World } from 'koota';
+import { createComputed, createSignal, onCleanup, type Accessor } from 'solid-js';
+import { isWorld } from '../utils/is-world';
+import { access, type MaybeAccessor } from '../utils/reactive-args';
+import { useWorld } from '../world/use-world';
+
+export function useTargets<T extends Trait>(
+ target: MaybeAccessor<Entity | World | undefined | null>,
+ relation: Relation<T>
+): Accessor<Entity[]> {
+ const contextWorld = useWorld();
+ const [value, setValue] = createSignal<Entity[]>([], { equals: false });
+
+ createComputed(() => {
+ const currentTarget = access(target);
+
+ if (!currentTarget) {
+ setValue([]);
+ return;
+ }
+
+ const world = isWorld(currentTarget) ? currentTarget : contextWorld;
+ const entity = isWorld(currentTarget) ? currentTarget[$internal].worldEntity : currentTarget;
+
+ // Track current value for onRemove filter
+ let currentValue: Entity[] = [];
+
+ const update = (next: Entity[]) => {
+ currentValue = next;
+ setValue(next);
+ };
+
+ const onAddUnsub = world.onAdd(relation, (e) => {
+ if (e === entity) update(entity.targetsFor(relation));
+ });
+
+ // onRemove fires before data is removed, so filter out the target
+ const onRemoveUnsub = world.onRemove(relation, (e, t) => {
+ if (e === entity) update(currentValue.filter((p) => p !== t));
+ });
+
+ const onChangeUnsub = world.onChange(relation, (e) => {
+ if (e === entity) update(entity.targetsFor(relation));
+ });
+
+ update(entity.targetsFor(relation));
+
+ onCleanup(() => {
+ onAddUnsub();
+ onRemoveUnsub();
+ onChangeUnsub();
+ });
+ });
+
+ return value;
+}
diff --git a/packages/koota-solid/src/hooks/use-trait-effect.ts b/packages/koota-solid/src/hooks/use-trait-effect.ts
new file mode 100644
index 00000000..bb6fc659
--- /dev/null
+++ b/packages/koota-solid/src/hooks/use-trait-effect.ts
@@ -0,0 +1,42 @@
+import { $internal, type Entity, type RelationPair, type Trait, type TraitRecord, type World } from 'koota';
+import { createEffect, onCleanup, untrack } from 'solid-js';
+import { isWorld } from '../utils/is-world';
+import { access, createStableTrait, type MaybeAccessor } from '../utils/reactive-args';
+import { useWorld } from '../world/use-world';
+
+export function useTraitEffect<T extends Trait>(
+ target: MaybeAccessor<Entity | World>,
+ trait: MaybeAccessor<T | RelationPair<T>>,
+ callback: (value: TraitRecord<T> | undefined) => void
+): void {
+ const contextWorld = useWorld();
+ const stableTrait = createStableTrait(trait);
+
+ createEffect(() => {
+ const currentTarget = access(target);
+ const currentTrait = stableTrait();
+
+ const world = isWorld(currentTarget) ? currentTarget : contextWorld;
+ const entity = isWorld(currentTarget) ? currentTarget[$internal].worldEntity : currentTarget;
+
+ const onChangeUnsub = world.onChange(currentTrait, (e) => {
+ if (e === entity) callback(e.get(currentTrait));
+ });
+
+ const onAddUnsub = world.onAdd(currentTrait, (e) => {
+ if (e === entity) callback(e.get(currentTrait));
+ });
+
+ const onRemoveUnsub = world.onRemove(currentTrait, (e) => {
+ if (e === entity) callback(undefined);
+ });
+
+ untrack(() => callback(entity.has(currentTrait) ? entity.get(currentTrait) : undefined));
+
+ onCleanup(() => {
+ onChangeUnsub();
+ onAddUnsub();
+ onRemoveUnsub();
+ });
+ });
+}
diff --git a/packages/koota-solid/src/hooks/use-trait.ts b/packages/koota-solid/src/hooks/use-trait.ts
new file mode 100644
index 00000000..190ff00e
--- /dev/null
+++ b/packages/koota-solid/src/hooks/use-trait.ts
@@ -0,0 +1,53 @@
+import { $internal, type Entity, type RelationPair, type Trait, type TraitRecord, type World } from 'koota';
+import { createComputed, createSignal, onCleanup, type Accessor } from 'solid-js';
+import { isWorld } from '../utils/is-world';
+import { access, createStableTrait, type MaybeAccessor } from '../utils/reactive-args';
+import { useWorld } from '../world/use-world';
+
+export function useTrait<T extends Trait>(
+ target: MaybeAccessor<Entity | World | undefined | null>,
+ trait: MaybeAccessor<T | RelationPair<T>>
+): Accessor<TraitRecord<T> | undefined> {
+ const contextWorld = useWorld();
+ const stableTrait = createStableTrait(trait);
+
+ const [value, setValue] = createSignal<TraitRecord<T> | undefined>(undefined, {
+ equals: false,
+ });
+
+ createComputed(() => {
+ const currentTarget = access(target);
+ const currentTrait = stableTrait();
+
+ if (!currentTarget) {
+ setValue(undefined);
+ return;
+ }
+
+ // Use the context world unless the target is a world itself
+ const world = isWorld(currentTarget) ? currentTarget : contextWorld;
+ const entity = isWorld(currentTarget) ? currentTarget[$internal].worldEntity : currentTarget;
+
+ const onChangeUnsub = world.onChange(currentTrait, (e) => {
+ if (e === entity) setValue(() => e.get(currentTrait));
+ });
+
+ const onAddUnsub = world.onAdd(currentTrait, (e) => {
+ if (e === entity) setValue(() => e.get(currentTrait));
+ });
+
+ const onRemoveUnsub = world.onRemove(currentTrait, (e) => {
+ if (e === entity) setValue(undefined);
+ });
+
+ setValue(() => (entity.has(currentTrait) ? entity.get(currentTrait) : undefined));
+
+ onCleanup(() => {
+ onChangeUnsub();
+ onAddUnsub();
+ onRemoveUnsub();
+ });
+ });
+
+ return value;
+}
diff --git a/packages/koota-solid/src/index.ts b/packages/koota-solid/src/index.ts
new file mode 100644
index 00000000..6233ee4b
--- /dev/null
+++ b/packages/koota-solid/src/index.ts
@@ -0,0 +1,12 @@
+export { useActions } from './hooks/use-actions';
+export { useQuery } from './hooks/use-query';
+export { useQueryFirst } from './hooks/use-query-first';
+export { useTag } from './hooks/use-tag';
+export { useHas } from './hooks/use-has';
+export { useTarget } from './hooks/use-target';
+export { useTargets } from './hooks/use-targets';
+export { useTrait } from './hooks/use-trait';
+export { useTraitEffect } from './hooks/use-trait-effect';
+export { useWorld } from './world/use-world';
+export { WorldProvider } from './world/world-provider';
+export { access, type MaybeAccessor } from './utils/reactive-args';
diff --git a/packages/koota-solid/src/utils/is-world.ts b/packages/koota-solid/src/utils/is-world.ts
new file mode 100644
index 00000000..a34a6047
--- /dev/null
+++ b/packages/koota-solid/src/utils/is-world.ts
@@ -0,0 +1,5 @@
+import type { Entity, World } from 'koota';
+
+export function isWorld(target: Entity | World): target is World {
+ return typeof (target as World)?.spawn === 'function';
+}
diff --git a/packages/koota-solid/src/utils/reactive-args.ts b/packages/koota-solid/src/utils/reactive-args.ts
new file mode 100644
index 00000000..fac29178
--- /dev/null
+++ b/packages/koota-solid/src/utils/reactive-args.ts
@@ -0,0 +1,51 @@
+import { $internal, $relationPair, type RelationPair, type Trait } from 'koota';
+import { createMemo, type Accessor } from 'solid-js';
+
+export type MaybeAccessor<T> = T | Accessor<T>;
+
+export function access<T>(value: MaybeAccessor<T>): T {
+ return typeof value === 'function' ? (value as Accessor<T>)() : value;
+}
+
+export type TraitOrPair<T extends Trait = Trait> = T | RelationPair<T>;
+
+export function isRelationPair(value: unknown): value is RelationPair {
+ return !!(value as any)?.[$relationPair];
+}
+
+/**
+ * Traits and relations are themselves functions, so a plain typeof check
+ * can't tell them apart from accessors. Koota values carry marker symbols.
+ */
+function accessTrait<TP>(value: MaybeAccessor<TP>): TP {
+ if (
+ typeof value === 'function' &&
+ !($internal in value) &&
+ !($relationPair in value)
+ ) {
+ return (value as Accessor<TP>)();
+ }
+ return value as TP;
+}
+
+/**
+ * Stabilizes a trait-or-pair argument. Plain traits are referentially stable
+ * (defined once), but relation pairs like `ChildOf(parent())` create a new
+ * object each evaluation, so the memo only notifies when the underlying
+ * relation + target identity changes.
+ */
+export function createStableTrait<TP extends TraitOrPair>(
+ input: MaybeAccessor<TP>
+): Accessor<TP> {
+ return createMemo(() => accessTrait(input), undefined, {
+ equals: (a, b) => relationOf(a) === relationOf(b) && targetOf(a) === targetOf(b),
+ });
+}
+
+function relationOf(value: TraitOrPair): unknown {
+ return isRelationPair(value) ? value.relation : value;
+}
+
+function targetOf(value: TraitOrPair): unknown {
+ return isRelationPair(value) ? value.target : undefined;
+}
diff --git a/packages/koota-solid/src/world/use-world.ts b/packages/koota-solid/src/world/use-world.ts
new file mode 100644
index 00000000..ee478762
--- /dev/null
+++ b/packages/koota-solid/src/world/use-world.ts
@@ -0,0 +1,13 @@
+import type { World } from 'koota';
+import { useContext } from 'solid-js';
+import { WorldContext } from './world-context';
+
+export function useWorld(): World {
+ const world = useContext(WorldContext);
+
+ if (!world) {
+ throw new Error('Koota: useWorld must be used within a WorldProvider');
+ }
+
+ return world;
+}
diff --git a/packages/koota-solid/src/world/world-context.ts b/packages/koota-solid/src/world/world-context.ts
new file mode 100644
index 00000000..bc121174
--- /dev/null
+++ b/packages/koota-solid/src/world/world-context.ts
@@ -0,0 +1,4 @@
+import type { World } from 'koota';
+import { createContext } from 'solid-js';
+
+export const WorldContext = createContext<World>();
diff --git a/packages/koota-solid/src/world/world-provider.ts b/packages/koota-solid/src/world/world-provider.ts
new file mode 100644
index 00000000..a7d114db
--- /dev/null
+++ b/packages/koota-solid/src/world/world-provider.ts
@@ -0,0 +1,14 @@
+import type { World } from 'koota';
+import { createComponent, type JSX } from 'solid-js';
+import { WorldContext } from './world-context';
+
+export function WorldProvider(props: { world: World; children?: JSX.Element }): JSX.Element {
+ return createComponent(WorldContext.Provider, {
+ get value() {
+ return props.world;
+ },
+ get children() {
+ return props.children;
+ },
+ });
+}
diff --git a/packages/koota-solid/tsconfig.json b/packages/koota-solid/tsconfig.json
new file mode 100644
index 00000000..5bf184ea
--- /dev/null
+++ b/packages/koota-solid/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "../../tsconfig.base.json",
+ "compilerOptions": {
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.tsbuildinfo",
+ "lib": ["es2024", "dom"]
+ },
+ "include": ["src"]
+}