export declare const todoSchemaContent = "import { Events, makeSchema, Schema, SessionIdSymbol, State } from '@livestore/livestore'\n\n// State tables - Define your application state as SQLite tables\nexport const tables = {\n todos: State.SQLite.table({\n name: 'todos',\n columns: {\n id: State.SQLite.text({ primaryKey: true }),\n title: State.SQLite.text({ default: '' }),\n completed: State.SQLite.boolean({ default: false }),\n deletedAt: State.SQLite.integer({ nullable: true, schema: Schema.DateFromNumber }),\n createdAt: State.SQLite.integer({ schema: Schema.DateFromNumber }),\n position: State.SQLite.real(), // For ordering - enables conflict-free reordering\n },\n }),\n tags: State.SQLite.table({\n name: 'tags',\n columns: {\n id: State.SQLite.text({ primaryKey: true }),\n name: State.SQLite.text(),\n color: State.SQLite.text({ nullable: true }),\n createdAt: State.SQLite.integer({ schema: Schema.DateFromNumber }),\n deletedAt: State.SQLite.integer({ nullable: true, schema: Schema.DateFromNumber }),\n },\n }),\n todoTags: State.SQLite.table({\n name: 'todo_tags',\n columns: {\n todoId: State.SQLite.text(),\n tagId: State.SQLite.text(),\n createdAt: State.SQLite.integer({ schema: Schema.DateFromNumber }),\n },\n }),\n // Client-only state for UI (not synced)\n uiState: State.SQLite.clientDocument({\n name: 'uiState',\n schema: Schema.Struct({ \n newTodoText: Schema.String, \n filter: Schema.Literal('all', 'active', 'completed'),\n selectedTags: Schema.Array(Schema.String)\n }),\n default: { id: SessionIdSymbol, value: { newTodoText: '', filter: 'all', selectedTags: [] } },\n }),\n}\n\n// Events - Define state changes as events for reliable sync and replay\nexport const events = {\n // Todo events\n todoCreated: Events.synced({\n name: 'v1.TodoCreated',\n schema: Schema.Struct({ \n id: Schema.String, \n title: Schema.String,\n createdAt: Schema.Date,\n position: Schema.Number\n }),\n }),\n todoCompleted: Events.synced({\n name: 'v1.TodoCompleted',\n schema: Schema.Struct({ id: Schema.String }),\n }),\n todoUncompleted: Events.synced({\n name: 'v1.TodoUncompleted', \n schema: Schema.Struct({ id: Schema.String }),\n }),\n todoTitleChanged: Events.synced({\n name: 'v1.TodoTitleChanged',\n schema: Schema.Struct({ id: Schema.String, title: Schema.String }),\n }),\n todoReordered: Events.synced({\n name: 'v1.TodoReordered',\n schema: Schema.Struct({ id: Schema.String, position: Schema.Number }),\n }),\n todoDeleted: Events.synced({\n name: 'v1.TodoDeleted',\n schema: Schema.Struct({ id: Schema.String, deletedAt: Schema.Date }),\n }),\n todosCleared: Events.synced({\n name: 'v1.TodosCleared', \n schema: Schema.Struct({ deletedAt: Schema.Date }),\n }),\n \n // Tag events\n tagCreated: Events.synced({\n name: 'v1.TagCreated',\n schema: Schema.Struct({ \n id: Schema.String, \n name: Schema.String, \n color: Schema.NullOr(Schema.String),\n createdAt: Schema.Date\n }),\n }),\n tagDeleted: Events.synced({\n name: 'v1.TagDeleted',\n schema: Schema.Struct({ id: Schema.String, deletedAt: Schema.Date }),\n }),\n \n // Todo-Tag relationship events\n todoTagged: Events.synced({\n name: 'v1.TodoTagged',\n schema: Schema.Struct({ todoId: Schema.String, tagId: Schema.String, createdAt: Schema.Date }),\n }),\n todoUntagged: Events.synced({\n name: 'v1.TodoUntagged',\n schema: Schema.Struct({ todoId: Schema.String, tagId: Schema.String }),\n }),\n \n // UI state events (local only)\n uiStateSet: tables.uiState.set,\n}\n\n// Materializers - Map events to state changes with conflict-free semantics\nconst materializers = State.SQLite.materializers(events, {\n // Todo materializers\n 'v1.TodoCreated': ({ id, title, createdAt, position }) => \n tables.todos.insert({ id, title, completed: false, createdAt, position }),\n \n 'v1.TodoCompleted': ({ id }) => \n tables.todos.update({ completed: true }).where({ id }),\n \n 'v1.TodoUncompleted': ({ id }) => \n tables.todos.update({ completed: false }).where({ id }),\n \n 'v1.TodoTitleChanged': ({ id, title }) => \n tables.todos.update({ title }).where({ id }),\n \n 'v1.TodoReordered': ({ id, position }) => \n tables.todos.update({ position }).where({ id }),\n \n 'v1.TodoDeleted': ({ id, deletedAt }) => \n tables.todos.update({ deletedAt }).where({ id }),\n \n 'v1.TodosCleared': ({ deletedAt }) => \n tables.todos.update({ deletedAt }).where({ completed: true, deletedAt: null }),\n \n // Tag materializers \n 'v1.TagCreated': ({ id, name, color, createdAt }) => \n tables.tags.insert({ id, name, color, createdAt }),\n \n 'v1.TagDeleted': ({ id, deletedAt }) => \n tables.tags.update({ deletedAt }).where({ id }),\n \n // Todo-Tag relationship materializers\n 'v1.TodoTagged': ({ todoId, tagId, createdAt }) => \n tables.todoTags.insert({ todoId, tagId, createdAt }),\n \n 'v1.TodoUntagged': ({ todoId, tagId }) => \n tables.todoTags.delete().where({ todoId, tagId }),\n})\n\nconst state = State.SQLite.makeState({ tables, materializers })\n\nexport const schema = makeSchema({ events, state })\n\n// Example usage:\n// \n// import { queryDb, dispatchEvent } from '@livestore/livestore'\n// import { schema, events, tables } from './schema.js'\n//\n// // Query active todos\n// const activeTodos$ = queryDb(\n// tables.todos.select().where({ deletedAt: null, completed: false }).orderBy('position'),\n// { label: 'activeTodos' }\n// )\n//\n// // Create a new todo\n// const createTodo = (title: string) => {\n// const id = crypto.randomUUID()\n// const position = Date.now() // Simple position strategy\n// dispatchEvent(events.todoCreated({ id, title, createdAt: new Date(), position }))\n// }"; //# sourceMappingURL=todo.d.ts.map