papyr-react 1.0.0
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/LICENSE +21 -0
- package/README.md +87 -0
- package/dist/blocks/WorkspaceBlock/WorkspaceBlock.d.ts +79 -0
- package/dist/blocks/index.d.ts +2 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +12 -0
- package/dist/components/Breadcrumbs/index.d.ts +2 -0
- package/dist/components/DoubleSidebarLayout/DoubleSidebarLayout.d.ts +49 -0
- package/dist/components/DoubleSidebarLayout/index.d.ts +2 -0
- package/dist/components/EmptyState/EmptyState.d.ts +31 -0
- package/dist/components/EmptyState/index.d.ts +2 -0
- package/dist/components/FileHierarchy/FileHierarchy.d.ts +19 -0
- package/dist/components/FileHierarchy/FileHierarchy.test.d.ts +1 -0
- package/dist/components/FileHierarchy/MemoizedFolderTree.d.ts +16 -0
- package/dist/components/FileHierarchy/index.d.ts +3 -0
- package/dist/components/FileHierarchy/types.d.ts +9 -0
- package/dist/components/FileHierarchy/utils.d.ts +5 -0
- package/dist/components/FileSearch/FileSearch.d.ts +27 -0
- package/dist/components/FileSearch/index.d.ts +2 -0
- package/dist/components/GraphView/GraphView.d.ts +19 -0
- package/dist/components/GraphView/index.d.ts +2 -0
- package/dist/components/HoverPreview/HoverPreview.d.ts +12 -0
- package/dist/components/HoverPreview/index.d.ts +2 -0
- package/dist/components/MiniGraph/MiniGraph.d.ts +8 -0
- package/dist/components/MiniGraph/MiniGraph.test.d.ts +1 -0
- package/dist/components/MiniGraph/index.d.ts +2 -0
- package/dist/components/NotePreview/NotePreviewContent.d.ts +14 -0
- package/dist/components/NotePreview/index.d.ts +2 -0
- package/dist/components/NoteViewer/NoteViewer.d.ts +15 -0
- package/dist/components/NoteViewer/NoteViewer.test.d.ts +1 -0
- package/dist/components/NoteViewer/index.d.ts +2 -0
- package/dist/components/SearchBar/SearchBar.d.ts +9 -0
- package/dist/components/SearchBar/index.d.ts +2 -0
- package/dist/components/SearchDropdown/SearchDropdown.d.ts +12 -0
- package/dist/components/SearchDropdown/index.d.ts +1 -0
- package/dist/components/SidebarLayout/SidebarLayout.d.ts +33 -0
- package/dist/components/SidebarLayout/index.d.ts +2 -0
- package/dist/components/TableOfContents/TableOfContents.d.ts +10 -0
- package/dist/components/TableOfContents/TableOfContents.test.d.ts +1 -0
- package/dist/components/TableOfContents/index.d.ts +1 -0
- package/dist/components/TagFilter/TagFilter.d.ts +9 -0
- package/dist/components/TagFilter/index.d.ts +2 -0
- package/dist/components/Toast/Toast.d.ts +11 -0
- package/dist/components/index.d.ts +16 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/useActiveNote.d.ts +27 -0
- package/dist/hooks/useActiveNote.test.d.ts +1 -0
- package/dist/hooks/useNotes.d.ts +3 -0
- package/dist/hooks/useRoutableActiveNote.d.ts +16 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +3178 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/PapyrProvider.d.ts +24 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/style.css +1548 -0
- package/dist/styles/index.d.ts +0 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/utils/graphUtils.d.ts +18 -0
- package/dist/utils/hydration.d.ts +8 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/linkUtils.d.ts +10 -0
- package/package.json +87 -0
- package/src/styles/index.ts +2 -0
- package/src/styles/theme.css +184 -0
- package/style.css +1 -0
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { WebReadyNote, NoteGraph, SearchResult, FolderNode, Slug, GraphOptions, IndexOptions, SearchOptions } from 'papyr-core/runtime';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NoteGraph } from 'papyr-core/runtime';
|
|
2
|
+
|
|
3
|
+
export interface ForceGraphNode {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
group?: string;
|
|
7
|
+
value?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface ForceGraphLink {
|
|
10
|
+
source: string;
|
|
11
|
+
target: string;
|
|
12
|
+
value?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface ForceGraphData {
|
|
15
|
+
nodes: ForceGraphNode[];
|
|
16
|
+
links: ForceGraphLink[];
|
|
17
|
+
}
|
|
18
|
+
export declare function toForceGraphData(graph: NoteGraph | null): ForceGraphData;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SearchIndex, SerializedSearchIndex } from 'papyr-core/runtime';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Ensure a search index is ready for runtime usage.
|
|
5
|
+
* Accepts either the hydrated SearchIndex returned by papyr-core or the
|
|
6
|
+
* serialized JSON emitted during the build, and always returns a usable index.
|
|
7
|
+
*/
|
|
8
|
+
export declare function hydrateSearchIndex(value: SearchIndex | SerializedSearchIndex): SearchIndex;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WebReadyNote } from 'papyr-core/runtime';
|
|
2
|
+
|
|
3
|
+
export declare function buildWikiLink(slug: string): string;
|
|
4
|
+
export declare function findNoteBySlug(notes: WebReadyNote[], slug: string): WebReadyNote | undefined;
|
|
5
|
+
export interface ParsedHashInfo {
|
|
6
|
+
slug: string | null;
|
|
7
|
+
anchor: string | null;
|
|
8
|
+
}
|
|
9
|
+
export declare function parseNoteHash(hash: string): ParsedHashInfo;
|
|
10
|
+
export declare function updateHashWithAnchor(anchor: string): void;
|
package/package.json
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "papyr-react",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "React components, hooks, and utilities for building Papyr knowledge experiences",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./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
|
+
"./style.css": "./style.css",
|
|
15
|
+
"./styles/theme.css": "./src/styles/theme.css",
|
|
16
|
+
"./package.json": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"style.css",
|
|
21
|
+
"src/styles"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "vite build",
|
|
25
|
+
"dev": "vite build --watch",
|
|
26
|
+
"test": "vitest --run",
|
|
27
|
+
"test:watch": "vitest --watch",
|
|
28
|
+
"test:coverage": "vitest --coverage --run",
|
|
29
|
+
"clean": "rm -rf dist",
|
|
30
|
+
"prepublishOnly": "pnpm run clean && pnpm run build"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"papyr",
|
|
34
|
+
"react",
|
|
35
|
+
"knowledge-base",
|
|
36
|
+
"markdown",
|
|
37
|
+
"graph",
|
|
38
|
+
"wiki-links"
|
|
39
|
+
],
|
|
40
|
+
"author": "Ray Kong",
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/Ray-kong/papyr-react.git"
|
|
45
|
+
},
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/Ray-kong/papyr-react/issues"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://github.com/Ray-kong/papyr-react#readme",
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"papyr-core": "^1.0.0",
|
|
52
|
+
"react": ">=18.0.0",
|
|
53
|
+
"react-dom": ">=18.0.0"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@floating-ui/react": "^0.27.16",
|
|
57
|
+
"clsx": "^2.1.1",
|
|
58
|
+
"d3-drag": "^3.0.0",
|
|
59
|
+
"d3-force": "^3.0.0",
|
|
60
|
+
"d3-selection": "^3.0.0",
|
|
61
|
+
"d3-zoom": "^3.0.0"
|
|
62
|
+
},
|
|
63
|
+
"optionalDependencies": {
|
|
64
|
+
"react-force-graph-2d": "^1.29.0"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@testing-library/react": "^15.0.0",
|
|
68
|
+
"@types/d3-drag": "^3.0.7",
|
|
69
|
+
"@types/d3-force": "^3.0.10",
|
|
70
|
+
"@types/d3-selection": "^3.0.11",
|
|
71
|
+
"@types/d3-zoom": "^3.0.8",
|
|
72
|
+
"@types/node": "^20.0.0",
|
|
73
|
+
"@types/react": "^18.0.0",
|
|
74
|
+
"@types/react-dom": "^18.0.0",
|
|
75
|
+
"@vitejs/plugin-react": "^5.0.0",
|
|
76
|
+
"jsdom": "^27.0.1",
|
|
77
|
+
"papyr-core": "^1.0.0",
|
|
78
|
+
"typescript": "^5.0.0",
|
|
79
|
+
"vite": "^5.0.0",
|
|
80
|
+
"vite-plugin-dts": "^3.0.0",
|
|
81
|
+
"vitest": "^1.6.1"
|
|
82
|
+
},
|
|
83
|
+
"engines": {
|
|
84
|
+
"node": ">=18.0.0"
|
|
85
|
+
},
|
|
86
|
+
"packageManager": "pnpm@10.13.1"
|
|
87
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Papyr Default Theme
|
|
3
|
+
*
|
|
4
|
+
* Import this file once in your app to get all styling working out of the box:
|
|
5
|
+
*
|
|
6
|
+
* import 'papyr-react/styles/theme.css'
|
|
7
|
+
*
|
|
8
|
+
* This provides:
|
|
9
|
+
* - Dark theme by default
|
|
10
|
+
* - Light theme via [data-theme="light"] or @media (prefers-color-scheme: light)
|
|
11
|
+
* - All required CSS variables
|
|
12
|
+
* - Base resets for full-height layout
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/* Base resets for full-height app */
|
|
16
|
+
*, *::before, *::after {
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
html, body, #root {
|
|
21
|
+
height: 100%;
|
|
22
|
+
margin: 0;
|
|
23
|
+
padding: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* Dark theme (default) */
|
|
27
|
+
:root {
|
|
28
|
+
/* Core colors */
|
|
29
|
+
--papyr-foreground: #e0e0e0;
|
|
30
|
+
--papyr-background: #1e1e1e;
|
|
31
|
+
--papyr-muted-foreground: rgba(255, 255, 255, 0.6);
|
|
32
|
+
--papyr-border: rgba(255, 255, 255, 0.1);
|
|
33
|
+
|
|
34
|
+
/* Surfaces */
|
|
35
|
+
--papyr-surface: #252525;
|
|
36
|
+
--papyr-surface-muted: rgba(255, 255, 255, 0.04);
|
|
37
|
+
--papyr-surface-hover: rgba(255, 255, 255, 0.08);
|
|
38
|
+
--papyr-sidebar-background: #1a1a1a;
|
|
39
|
+
--papyr-surface-sidebar: #1a1a1a;
|
|
40
|
+
|
|
41
|
+
/* Input styling */
|
|
42
|
+
--papyr-input-bg: rgba(255, 255, 255, 0.06);
|
|
43
|
+
--papyr-input-bg-focus: rgba(255, 255, 255, 0.1);
|
|
44
|
+
--papyr-border-focus: rgba(99, 102, 241, 0.5);
|
|
45
|
+
--papyr-focus-ring: rgba(99, 102, 241, 0.3);
|
|
46
|
+
|
|
47
|
+
/* Primary/accent colors */
|
|
48
|
+
--papyr-primary: #6366f1;
|
|
49
|
+
--papyr-primary-soft: rgba(99, 102, 241, 0.15);
|
|
50
|
+
--papyr-link: #818cf8;
|
|
51
|
+
|
|
52
|
+
/* Tags */
|
|
53
|
+
--papyr-tag-background: rgba(99, 102, 241, 0.2);
|
|
54
|
+
--papyr-tag-foreground: #a5b4fc;
|
|
55
|
+
|
|
56
|
+
/* Interactive states */
|
|
57
|
+
--papyr-hover: rgba(255, 255, 255, 0.08);
|
|
58
|
+
--papyr-active: rgba(99, 102, 241, 0.25);
|
|
59
|
+
--papyr-active-foreground: #ffffff;
|
|
60
|
+
--papyr-active-foreground-muted: rgba(255, 255, 255, 0.7);
|
|
61
|
+
--papyr-active-item: #6366f1;
|
|
62
|
+
--papyr-active-item-hover: #818cf8;
|
|
63
|
+
--papyr-active-background: rgba(99, 102, 241, 0.15);
|
|
64
|
+
|
|
65
|
+
/* Toast */
|
|
66
|
+
--papyr-toast-background: rgba(28, 36, 52, 0.95);
|
|
67
|
+
--papyr-toast-foreground: #f9fafb;
|
|
68
|
+
|
|
69
|
+
/* Code blocks */
|
|
70
|
+
--papyr-code-surface: linear-gradient(135deg, #1e293b, #0f172a);
|
|
71
|
+
--papyr-code-foreground: #e2e8f0;
|
|
72
|
+
--papyr-code-header: rgba(15, 23, 42, 0.8);
|
|
73
|
+
--papyr-code-label: rgba(148, 163, 184, 0.9);
|
|
74
|
+
|
|
75
|
+
/* Counts/badges */
|
|
76
|
+
--papyr-count-foreground: #a5b4fc;
|
|
77
|
+
--papyr-count-background: rgba(99, 102, 241, 0.2);
|
|
78
|
+
|
|
79
|
+
/* Typography */
|
|
80
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
81
|
+
color: var(--papyr-foreground);
|
|
82
|
+
background: var(--papyr-background);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* Light theme - activated by data attribute or system preference */
|
|
86
|
+
[data-theme="light"],
|
|
87
|
+
:root:has([data-theme="light"]) {
|
|
88
|
+
/* Core colors */
|
|
89
|
+
--papyr-foreground: #1f2937;
|
|
90
|
+
--papyr-background: #ffffff;
|
|
91
|
+
--papyr-muted-foreground: #6b7280;
|
|
92
|
+
--papyr-border: rgba(0, 0, 0, 0.1);
|
|
93
|
+
|
|
94
|
+
/* Surfaces */
|
|
95
|
+
--papyr-surface: #ffffff;
|
|
96
|
+
--papyr-surface-muted: rgba(0, 0, 0, 0.04);
|
|
97
|
+
--papyr-surface-hover: rgba(0, 0, 0, 0.06);
|
|
98
|
+
--papyr-sidebar-background: #f8fafc;
|
|
99
|
+
--papyr-surface-sidebar: #f8fafc;
|
|
100
|
+
|
|
101
|
+
/* Input styling */
|
|
102
|
+
--papyr-input-bg: #ffffff;
|
|
103
|
+
--papyr-input-bg-focus: #ffffff;
|
|
104
|
+
--papyr-border-focus: rgba(99, 102, 241, 0.5);
|
|
105
|
+
--papyr-focus-ring: rgba(99, 102, 241, 0.2);
|
|
106
|
+
|
|
107
|
+
/* Primary/accent colors */
|
|
108
|
+
--papyr-primary: #6366f1;
|
|
109
|
+
--papyr-primary-soft: rgba(99, 102, 241, 0.12);
|
|
110
|
+
--papyr-link: #4f46e5;
|
|
111
|
+
|
|
112
|
+
/* Tags */
|
|
113
|
+
--papyr-tag-background: rgba(99, 102, 241, 0.1);
|
|
114
|
+
--papyr-tag-foreground: #4f46e5;
|
|
115
|
+
|
|
116
|
+
/* Interactive states */
|
|
117
|
+
--papyr-hover: #374151;
|
|
118
|
+
--papyr-active: #1f2937;
|
|
119
|
+
--papyr-active-item: #6366f1;
|
|
120
|
+
--papyr-active-item-hover: #4f46e5;
|
|
121
|
+
--papyr-active-background: rgba(99, 102, 241, 0.1);
|
|
122
|
+
|
|
123
|
+
/* Toast */
|
|
124
|
+
--papyr-toast-background: rgba(31, 41, 55, 0.95);
|
|
125
|
+
--papyr-toast-foreground: #f9fafb;
|
|
126
|
+
|
|
127
|
+
/* Code blocks - keep dark for contrast */
|
|
128
|
+
--papyr-code-surface: linear-gradient(135deg, #1e293b, #0f172a);
|
|
129
|
+
--papyr-code-foreground: #e2e8f0;
|
|
130
|
+
--papyr-code-header: rgba(15, 23, 42, 0.8);
|
|
131
|
+
--papyr-code-label: rgba(148, 163, 184, 0.9);
|
|
132
|
+
|
|
133
|
+
/* Counts/badges */
|
|
134
|
+
--papyr-count-foreground: #4f46e5;
|
|
135
|
+
--papyr-count-background: rgba(99, 102, 241, 0.1);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/* System preference based light theme */
|
|
139
|
+
@media (prefers-color-scheme: light) {
|
|
140
|
+
:root:not([data-theme="dark"]) {
|
|
141
|
+
/* Core colors */
|
|
142
|
+
--papyr-foreground: #1f2937;
|
|
143
|
+
--papyr-background: #ffffff;
|
|
144
|
+
--papyr-muted-foreground: #6b7280;
|
|
145
|
+
--papyr-border: rgba(0, 0, 0, 0.1);
|
|
146
|
+
|
|
147
|
+
/* Surfaces */
|
|
148
|
+
--papyr-surface: #ffffff;
|
|
149
|
+
--papyr-surface-muted: rgba(0, 0, 0, 0.04);
|
|
150
|
+
--papyr-surface-hover: rgba(0, 0, 0, 0.06);
|
|
151
|
+
--papyr-sidebar-background: #f8fafc;
|
|
152
|
+
--papyr-surface-sidebar: #f8fafc;
|
|
153
|
+
|
|
154
|
+
/* Input styling */
|
|
155
|
+
--papyr-input-bg: #ffffff;
|
|
156
|
+
--papyr-input-bg-focus: #ffffff;
|
|
157
|
+
--papyr-border-focus: rgba(99, 102, 241, 0.5);
|
|
158
|
+
--papyr-focus-ring: rgba(99, 102, 241, 0.2);
|
|
159
|
+
|
|
160
|
+
/* Primary/accent colors */
|
|
161
|
+
--papyr-primary: #6366f1;
|
|
162
|
+
--papyr-primary-soft: rgba(99, 102, 241, 0.12);
|
|
163
|
+
--papyr-link: #4f46e5;
|
|
164
|
+
|
|
165
|
+
/* Tags */
|
|
166
|
+
--papyr-tag-background: rgba(99, 102, 241, 0.1);
|
|
167
|
+
--papyr-tag-foreground: #4f46e5;
|
|
168
|
+
|
|
169
|
+
/* Interactive states */
|
|
170
|
+
--papyr-hover: #374151;
|
|
171
|
+
--papyr-active: #1f2937;
|
|
172
|
+
--papyr-active-item: #6366f1;
|
|
173
|
+
--papyr-active-item-hover: #4f46e5;
|
|
174
|
+
--papyr-active-background: rgba(99, 102, 241, 0.1);
|
|
175
|
+
|
|
176
|
+
/* Toast */
|
|
177
|
+
--papyr-toast-background: rgba(31, 41, 55, 0.95);
|
|
178
|
+
--papyr-toast-foreground: #f9fafb;
|
|
179
|
+
|
|
180
|
+
/* Counts/badges */
|
|
181
|
+
--papyr-count-foreground: #4f46e5;
|
|
182
|
+
--papyr-count-background: rgba(99, 102, 241, 0.1);
|
|
183
|
+
}
|
|
184
|
+
}
|
package/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import './dist/style.css';
|