@draftline/react 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +51 -0
  2. package/package.json +49 -37
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # Draftline React
2
+
3
+ React hooks and primitive components for Draftline-enabled Tauri applications.
4
+
5
+ `@draftline/react` builds on `@draftline/client` and provides provider-backed
6
+ workspace state, mutation helpers, remote/recovery surfaces, and headless-first
7
+ graph and variation primitives. The primitives are designed for host apps to keep
8
+ their own shell, copy, styling, and destructive-operation policy.
9
+
10
+ ## Install
11
+
12
+ ```powershell
13
+ npm install @draftline/client @draftline/react
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ ```tsx
19
+ import { createDraftlineClient } from '@draftline/client';
20
+ import {
21
+ DraftlineHistoryGraph,
22
+ DraftlineProvider,
23
+ createDraftlineHistoryGraph,
24
+ } from '@draftline/react';
25
+
26
+ const client = createDraftlineClient();
27
+
28
+ export function App() {
29
+ const graph = createDraftlineHistoryGraph({
30
+ activeVariationId: 'main',
31
+ versions: [],
32
+ variations: [],
33
+ });
34
+
35
+ return (
36
+ <DraftlineProvider client={client} workspacePath="C:\\path\\to\\workspace">
37
+ <DraftlineHistoryGraph graph={graph} />
38
+ </DraftlineProvider>
39
+ );
40
+ }
41
+ ```
42
+
43
+ ## Design notes
44
+
45
+ - `DraftlineGraphNode` is an exported discriminated union for version, dirty, and
46
+ remote-tip nodes.
47
+ - `DraftlineHistoryGraph` is non-interactive unless the host supplies
48
+ `onSelectNode`.
49
+ - Selection callbacks receive full context: `{ node, graph, selectable,
50
+ nativeEvent }`.
51
+ - Host apps own labels, editor reloads, dirty-navigation prompts, and remote UX.
package/package.json CHANGED
@@ -1,37 +1,49 @@
1
- {
2
- "name": "@draftline/react",
3
- "version": "0.1.0",
4
- "type": "module",
5
- "main": "./dist/index.js",
6
- "types": "./dist/index.d.ts",
7
- "exports": {
8
- ".": {
9
- "types": "./dist/index.d.ts",
10
- "import": "./dist/index.js"
11
- }
12
- },
13
- "files": [
14
- "dist"
15
- ],
16
- "scripts": {
17
- "build": "tsc -p tsconfig.json",
18
- "test": "vitest run --environment jsdom"
19
- },
20
- "dependencies": {
21
- "@draftline/client": "0.1.0"
22
- },
23
- "peerDependencies": {
24
- "react": "^19.0.0"
25
- },
26
- "devDependencies": {
27
- "@testing-library/dom": "^10.4.1",
28
- "@testing-library/react": "^16.3.2",
29
- "@types/react": "^19.2.7",
30
- "jsdom": "^29.1.1",
31
- "typescript": "^6.0.3",
32
- "vitest": "^4.1.9"
33
- },
34
- "publishConfig": {
35
- "access": "public"
36
- }
37
- }
1
+ {
2
+ "name": "@draftline/react",
3
+ "version": "0.1.1",
4
+ "description": "React hooks and primitives for Draftline-enabled Tauri applications.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "README.md",
17
+ "dist"
18
+ ],
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/sethjuarez/draftline.git",
22
+ "directory": "packages/react"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/sethjuarez/draftline/issues"
26
+ },
27
+ "homepage": "https://github.com/sethjuarez/draftline#readme",
28
+ "scripts": {
29
+ "build": "tsc -p tsconfig.json",
30
+ "test": "vitest run --environment jsdom"
31
+ },
32
+ "dependencies": {
33
+ "@draftline/client": "0.1.1"
34
+ },
35
+ "peerDependencies": {
36
+ "react": "^19.0.0"
37
+ },
38
+ "devDependencies": {
39
+ "@testing-library/dom": "^10.4.1",
40
+ "@testing-library/react": "^16.3.2",
41
+ "@types/react": "^19.2.7",
42
+ "jsdom": "^29.1.1",
43
+ "typescript": "^6.0.3",
44
+ "vitest": "^4.1.9"
45
+ },
46
+ "publishConfig": {
47
+ "access": "public"
48
+ }
49
+ }