@draftline/react
v0.1.14
Published
React hooks and primitives for Draftline-enabled Tauri applications.
Readme
Draftline React
React hooks and primitive components for Draftline-enabled Tauri applications.
@draftline/react builds on @draftline/client and provides provider-backed
workspace state, mutation helpers, remote/recovery surfaces, and headless-first
graph and variation primitives. The primitives are designed for host apps to keep
their own shell, copy, styling, and destructive-operation policy.
Install
npm install @draftline/client @draftline/reactUsage
import { createDraftlineClient } from '@draftline/client';
import {
DraftlineHistoryGraph,
DraftlineProvider,
createDraftlineHistoryGraph,
} from '@draftline/react';
const client = createDraftlineClient();
export function App() {
const graph = createDraftlineHistoryGraph({
activeVariationId: 'main',
versions: [],
variations: [],
});
return (
<DraftlineProvider client={client} workspacePath="C:\\path\\to\\workspace">
<DraftlineHistoryGraph graph={graph} />
</DraftlineProvider>
);
}Design notes
DraftlineGraphNodeis an exported discriminated union for version, dirty, and remote-tip nodes.DraftlineHistoryGraphis non-interactive unless the host suppliesonSelectNode.- Selection callbacks receive full context:
{ node, graph, selectable, nativeEvent }. - Host apps own labels, editor reloads, dirty-navigation prompts, and remote UX.
