@screenpipe-ui/core 0.1.0 → 0.1.2
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.
- package/README.md +88 -0
- package/package.json +21 -14
package/README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# @screenpipe-ui/core
|
|
2
|
+
|
|
3
|
+
Framework-agnostic core library for [screenpipe](https://github.com/screenpipe/screenpipe) UIs. Provides a REST client, Zustand vanilla stores, and formatting utilities — no React dependency.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add @screenpipe-ui/core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Client
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { createClient } from "@screenpipe-ui/core";
|
|
17
|
+
|
|
18
|
+
const client = createClient(); // defaults to localhost:3030
|
|
19
|
+
|
|
20
|
+
const results = await client.search({ q: "meeting notes", content_type: "audio" });
|
|
21
|
+
const health = await client.health();
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Stores
|
|
25
|
+
|
|
26
|
+
Zustand vanilla stores that work anywhere — call `.getState()` in scripts, or subscribe reactively in UI frameworks.
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { createSearchStore, createClient } from "@screenpipe-ui/core";
|
|
30
|
+
|
|
31
|
+
const client = createClient();
|
|
32
|
+
const store = createSearchStore();
|
|
33
|
+
|
|
34
|
+
// Imperative usage (CLI, scripts)
|
|
35
|
+
await store.getState().executeSearch(client);
|
|
36
|
+
console.log(store.getState().results);
|
|
37
|
+
|
|
38
|
+
// Reactive usage (subscribe to changes)
|
|
39
|
+
store.subscribe((state) => console.log(state.results));
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Available stores: `createSearchStore`, `createTimelineStore`, `createHealthStore`.
|
|
43
|
+
|
|
44
|
+
### Formatters
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import { timeAgo, truncate, contentPreview, formatTable } from "@screenpipe-ui/core";
|
|
48
|
+
|
|
49
|
+
timeAgo("2024-01-01T12:00:00Z"); // "3 months ago"
|
|
50
|
+
truncate("long text...", 10); // "long te..."
|
|
51
|
+
contentPreview(contentItem); // formatted preview string
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Content helpers
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { getContentText, getContentTimestamp, getContentAppName } from "@screenpipe-ui/core";
|
|
58
|
+
|
|
59
|
+
// Extract fields from ContentItem regardless of type (OCR, Audio, UI)
|
|
60
|
+
const text = getContentText(item);
|
|
61
|
+
const time = getContentTimestamp(item);
|
|
62
|
+
const app = getContentAppName(item);
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## API
|
|
66
|
+
|
|
67
|
+
### Client
|
|
68
|
+
|
|
69
|
+
- `createClient(config?)` — create a `ScreenpipeUIClient`
|
|
70
|
+
- `client.search(params)` — search screen captures and audio transcriptions
|
|
71
|
+
- `client.health()` — check screenpipe server status
|
|
72
|
+
- `client.getFrameUrl(frameId)` — get URL for a captured frame
|
|
73
|
+
|
|
74
|
+
### Stores
|
|
75
|
+
|
|
76
|
+
- `createSearchStore()` — search state with `executeSearch`, `nextPage`, `prevPage`, `reset`
|
|
77
|
+
- `createTimelineStore()` — timeline state with `loadTimeline`
|
|
78
|
+
- `createHealthStore()` — health state with `checkHealth`
|
|
79
|
+
|
|
80
|
+
### Formatters
|
|
81
|
+
|
|
82
|
+
- `timeAgo`, `formatDuration`, `formatTime`, `formatDate`, `formatDateTime`, `todayRange`
|
|
83
|
+
- `truncate`, `contentTypeLabel`, `highlightMatch`, `stripAnsi`, `contentPreview`
|
|
84
|
+
- `formatTable(rows, columns)` — aligned text table
|
|
85
|
+
|
|
86
|
+
## License
|
|
87
|
+
|
|
88
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@screenpipe-ui/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -11,18 +11,25 @@
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"files": ["dist"],
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
"
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/remoun/screenpipe-ui",
|
|
17
|
+
"directory": "packages/core"
|
|
18
18
|
},
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"test": "bun test",
|
|
24
|
+
"build": "tsup src/index.ts --format esm --dts --clean"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@screenpipe/js": "^1.0.21",
|
|
28
|
+
"zustand": "^5.0.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/bun": "^1.1.14",
|
|
32
|
+
"tsup": "^8.0.0",
|
|
33
|
+
"typescript": "^5.3.3"
|
|
34
|
+
}
|
|
28
35
|
}
|