Rename hst-frontend-new to deck-frontend

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
ARCHITECT
2026-01-13 00:00:56 +00:00
parent 4e9377cf09
commit 030b2a5312
44 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
import { createStore } from './store.ts';
import type { AppState, EdgeType } from '@/types/index.ts';
import { EDGE_COLORS } from '@/config/index.ts';
const initialState: AppState = {
base: 'hst',
lang: 'es',
view: 'grid',
search: '',
group: 'all',
library: 'all',
libraryMembers: new Set(),
selectionMode: false,
selected: new Set(),
selectedTag: null,
tags: [],
hstTags: [],
groups: [],
libraries: [],
graphEdges: [],
treeEdges: [],
graphFilters: {
cats: new Set(['hst'] as const),
edges: new Set(Object.keys(EDGE_COLORS) as EdgeType[])
},
graphSettings: {
nodeSize: 20,
linkDist: 80,
showImg: true,
showLbl: true
}
};
export const store = createStore(initialState);
export { createStore } from './store.ts';

View File

@@ -0,0 +1,27 @@
type Listener<T> = (state: T, prevState: T) => void;
export interface Store<T extends object> {
getState: () => Readonly<T>;
setState: (partial: Partial<T>) => void;
subscribe: (listener: Listener<T>) => () => void;
}
export function createStore<T extends object>(initialState: T): Store<T> {
let state = { ...initialState };
const listeners = new Set<Listener<T>>();
return {
getState: (): Readonly<T> => state,
setState: (partial: Partial<T>): void => {
const prevState = state;
state = { ...state, ...partial };
listeners.forEach(fn => fn(state, prevState));
},
subscribe: (listener: Listener<T>): (() => void) => {
listeners.add(listener);
return () => listeners.delete(listener);
}
};
}