chore: restructure vue-sync-engine workspace and remove unused files

This commit is contained in:
2026-05-29 01:09:14 +07:00
parent 654bca0a00
commit ee14101fc1
66 changed files with 5158 additions and 582 deletions
@@ -0,0 +1,15 @@
import { computed, type ComputedRef, type MaybeRefOrGetter, toValue } from 'vue'
import type { EntityDef, EntityId } from '../core/types'
import { useEngine } from './useEngine'
export function useEntity<T>(
def: EntityDef<T>,
id: MaybeRefOrGetter<EntityId | undefined>,
): ComputedRef<T | undefined> {
const engine = useEngine()
return computed(() => {
const v = toValue(id)
if (v === undefined || v === null) return undefined
return engine.mirror.getEntity<T>(def.name, v)
})
}