Files
t3code/apps/web/src/browser/browserPointerStore.ts
T
Julius Marminge dd739c880d Port browser preview annotations to desktop
- Add IPC and runtime plumbing for preview annotation theming
- Generate and ship annotation CSS for the desktop overlay
- Add pointer and artifact handling for browser preview interactions
2026-06-13 22:18:37 -07:00

26 lines
742 B
TypeScript

import type { DesktopPreviewPointerEvent } from "@t3tools/contracts";
import { create } from "zustand";
interface BrowserPointerStoreState {
readonly byTabId: Record<string, DesktopPreviewPointerEvent>;
readonly apply: (event: DesktopPreviewPointerEvent) => void;
readonly clear: (tabId: string) => void;
}
export const useBrowserPointerStore = create<BrowserPointerStoreState>()((set) => ({
byTabId: {},
apply: (event) =>
set((state) => ({
byTabId: {
...state.byTabId,
[event.tabId]: event,
},
})),
clear: (tabId) =>
set((state) => {
if (!(tabId in state.byTabId)) return state;
const { [tabId]: _removed, ...byTabId } = state.byTabId;
return { byTabId };
}),
}));