@papyrus-sdk/ui-react 0.2.7 → 0.2.9
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 +15 -0
- package/base.css +92 -38
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +909 -274
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +907 -272
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,6 +47,21 @@ Use `@papyrus-sdk/core` + engines and build your own UI.
|
|
|
47
47
|
|
|
48
48
|
Note: `@papyrus-sdk/ui-react` expects `@papyrus-sdk/core` and `@papyrus-sdk/types` as peer dependencies.
|
|
49
49
|
|
|
50
|
+
## Theme variables
|
|
51
|
+
|
|
52
|
+
You can override UI colors using CSS variables applied to elements with the
|
|
53
|
+
`papyrus-theme` class (they also respond to `data-papyrus-theme="light|dark"`).
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
const root = document.documentElement;
|
|
57
|
+
root.style.setProperty('--papyrus-surface', '#1b2b3a');
|
|
58
|
+
root.style.setProperty('--papyrus-surface-2', '#223243');
|
|
59
|
+
root.style.setProperty('--papyrus-border', '#2f4256');
|
|
60
|
+
root.style.setProperty('--papyrus-text', '#e6edf3');
|
|
61
|
+
root.style.setProperty('--papyrus-text-muted', '#9fb0c2');
|
|
62
|
+
root.style.setProperty('--papyrus-canvas', '#0f172a');
|
|
63
|
+
```
|
|
64
|
+
|
|
50
65
|
## Topbar customization
|
|
51
66
|
|
|
52
67
|
`Topbar` accepts optional flags to show/hide controls.
|
package/base.css
CHANGED
|
@@ -1,57 +1,92 @@
|
|
|
1
|
+
.papyrus-theme {
|
|
2
|
+
--papyrus-bg: #f3f4f6;
|
|
3
|
+
--papyrus-surface: #ffffff;
|
|
4
|
+
--papyrus-surface-2: #f9fafb;
|
|
5
|
+
--papyrus-border: #e5e7eb;
|
|
6
|
+
--papyrus-border-strong: #d1d5db;
|
|
7
|
+
--papyrus-text: #111827;
|
|
8
|
+
--papyrus-text-muted: #6b7280;
|
|
9
|
+
--papyrus-icon: #6b7280;
|
|
10
|
+
--papyrus-focus: #93c5fd;
|
|
11
|
+
--papyrus-canvas: #f3f4f6;
|
|
12
|
+
--papyrus-hover: #e5e7eb;
|
|
13
|
+
--papyrus-popover: #ffffff;
|
|
14
|
+
--papyrus-shadow: rgba(15, 23, 42, 0.08);
|
|
15
|
+
--papyrus-selection-bg: rgba(30, 64, 175, 0.5);
|
|
16
|
+
color: var(--papyrus-text);
|
|
17
|
+
font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.papyrus-theme[data-papyrus-theme="dark"] {
|
|
21
|
+
--papyrus-bg: #0f1115;
|
|
22
|
+
--papyrus-surface: #1a1a1a;
|
|
23
|
+
--papyrus-surface-2: #222222;
|
|
24
|
+
--papyrus-border: #333333;
|
|
25
|
+
--papyrus-border-strong: #444444;
|
|
26
|
+
--papyrus-text: #f3f4f6;
|
|
27
|
+
--papyrus-text-muted: #9ca3af;
|
|
28
|
+
--papyrus-icon: #9ca3af;
|
|
29
|
+
--papyrus-focus: #2563eb;
|
|
30
|
+
--papyrus-canvas: #121212;
|
|
31
|
+
--papyrus-hover: rgba(255, 255, 255, 0.08);
|
|
32
|
+
--papyrus-popover: #1f1f1f;
|
|
33
|
+
--papyrus-shadow: rgba(0, 0, 0, 0.4);
|
|
34
|
+
--papyrus-selection-bg: rgba(96, 165, 250, 0.5);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.papyrus-topbar,
|
|
38
|
+
.papyrus-sidebar-left,
|
|
39
|
+
.papyrus-sidebar-right {
|
|
40
|
+
background: var(--papyrus-surface) !important;
|
|
41
|
+
border-color: var(--papyrus-border) !important;
|
|
42
|
+
color: var(--papyrus-text) !important;
|
|
43
|
+
box-sizing: border-box;
|
|
44
|
+
font-size: 13px;
|
|
45
|
+
line-height: 1.4;
|
|
46
|
+
}
|
|
47
|
+
|
|
1
48
|
.papyrus-topbar {
|
|
2
49
|
align-items: center;
|
|
3
|
-
background: #ffffff;
|
|
4
|
-
border-bottom: 1px solid #e5e7eb;
|
|
5
|
-
box-sizing: border-box;
|
|
6
|
-
color: #111827;
|
|
7
50
|
display: flex;
|
|
8
51
|
height: 56px;
|
|
9
52
|
justify-content: space-between;
|
|
10
53
|
padding: 0 16px;
|
|
11
|
-
font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
12
54
|
font-size: 14px;
|
|
13
|
-
line-height: 1.4;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.papyrus-sidebar-left {
|
|
17
|
-
background: #ffffff;
|
|
18
|
-
border-right: 1px solid #e5e7eb;
|
|
19
|
-
box-sizing: border-box;
|
|
20
|
-
display: flex;
|
|
21
|
-
flex-direction: column;
|
|
22
|
-
height: 100%;
|
|
23
|
-
width: 288px;
|
|
24
|
-
font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
25
|
-
font-size: 13px;
|
|
26
|
-
line-height: 1.4;
|
|
27
55
|
}
|
|
28
56
|
|
|
57
|
+
.papyrus-sidebar-left,
|
|
29
58
|
.papyrus-sidebar-right {
|
|
30
|
-
background: #ffffff;
|
|
31
|
-
border-left: 1px solid #e5e7eb;
|
|
32
|
-
box-sizing: border-box;
|
|
33
59
|
display: flex;
|
|
34
60
|
flex-direction: column;
|
|
35
61
|
height: 100%;
|
|
36
|
-
width: 320px;
|
|
37
|
-
font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
38
|
-
font-size: 13px;
|
|
39
|
-
line-height: 1.4;
|
|
40
62
|
}
|
|
41
63
|
|
|
42
64
|
.papyrus-viewer {
|
|
43
|
-
background:
|
|
65
|
+
background: var(--papyrus-canvas) !important;
|
|
44
66
|
box-sizing: border-box;
|
|
45
67
|
flex: 1 1 auto;
|
|
46
68
|
overflow: auto;
|
|
47
|
-
|
|
69
|
+
color: var(--papyrus-text);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.papyrus-control,
|
|
73
|
+
.papyrus-input,
|
|
74
|
+
.papyrus-popover {
|
|
75
|
+
background: var(--papyrus-surface-2) !important;
|
|
76
|
+
border-color: var(--papyrus-border) !important;
|
|
77
|
+
color: var(--papyrus-text) !important;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.papyrus-popover {
|
|
81
|
+
background: var(--papyrus-popover) !important;
|
|
82
|
+
box-shadow: 0 20px 40px var(--papyrus-shadow);
|
|
48
83
|
}
|
|
49
84
|
|
|
50
85
|
.papyrus-topbar button,
|
|
51
86
|
.papyrus-sidebar-left button,
|
|
52
87
|
.papyrus-sidebar-right button {
|
|
53
|
-
background:
|
|
54
|
-
border: 1px solid
|
|
88
|
+
background: var(--papyrus-surface-2);
|
|
89
|
+
border: 1px solid var(--papyrus-border);
|
|
55
90
|
border-radius: 8px;
|
|
56
91
|
color: inherit;
|
|
57
92
|
cursor: pointer;
|
|
@@ -60,17 +95,23 @@
|
|
|
60
95
|
transition: background 0.15s ease, border-color 0.15s ease;
|
|
61
96
|
}
|
|
62
97
|
|
|
98
|
+
.papyrus-unstyled-button {
|
|
99
|
+
background: transparent !important;
|
|
100
|
+
border: 0 !important;
|
|
101
|
+
padding: 0 !important;
|
|
102
|
+
}
|
|
103
|
+
|
|
63
104
|
.papyrus-topbar input,
|
|
64
105
|
.papyrus-sidebar-left input,
|
|
65
106
|
.papyrus-sidebar-right input,
|
|
66
107
|
.papyrus-topbar select,
|
|
67
108
|
.papyrus-sidebar-left select,
|
|
68
109
|
.papyrus-sidebar-right select {
|
|
69
|
-
background:
|
|
70
|
-
border: 1px solid
|
|
110
|
+
background: var(--papyrus-surface);
|
|
111
|
+
border: 1px solid var(--papyrus-border);
|
|
71
112
|
border-radius: 6px;
|
|
72
113
|
box-sizing: border-box;
|
|
73
|
-
color:
|
|
114
|
+
color: var(--papyrus-text);
|
|
74
115
|
font: inherit;
|
|
75
116
|
padding: 6px 8px;
|
|
76
117
|
}
|
|
@@ -78,8 +119,8 @@
|
|
|
78
119
|
.papyrus-topbar button:hover,
|
|
79
120
|
.papyrus-sidebar-left button:hover,
|
|
80
121
|
.papyrus-sidebar-right button:hover {
|
|
81
|
-
background:
|
|
82
|
-
border-color:
|
|
122
|
+
background: var(--papyrus-hover);
|
|
123
|
+
border-color: var(--papyrus-border-strong);
|
|
83
124
|
}
|
|
84
125
|
|
|
85
126
|
.papyrus-topbar svg,
|
|
@@ -94,7 +135,7 @@
|
|
|
94
135
|
.papyrus-topbar select:focus,
|
|
95
136
|
.papyrus-sidebar-left select:focus,
|
|
96
137
|
.papyrus-sidebar-right select:focus {
|
|
97
|
-
outline: 2px solid
|
|
138
|
+
outline: 2px solid var(--papyrus-focus);
|
|
98
139
|
outline-offset: 1px;
|
|
99
140
|
}
|
|
100
141
|
|
|
@@ -108,6 +149,19 @@
|
|
|
108
149
|
display: flex;
|
|
109
150
|
justify-content: center;
|
|
110
151
|
}
|
|
111
|
-
|
|
112
|
-
|
|
152
|
+
|
|
153
|
+
.papyrus-viewer .textLayer ::selection {
|
|
154
|
+
background: var(--papyrus-selection-bg);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.papyrus-viewer .textLayer {
|
|
158
|
+
opacity: 1 !important;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.papyrus-viewer .textLayer mark.papyrus-search-hit {
|
|
162
|
+
background: rgba(250, 204, 21, 0.55);
|
|
163
|
+
box-shadow: 0 0 0 1px rgba(234, 179, 8, 0.35);
|
|
164
|
+
border-radius: 2px;
|
|
165
|
+
color: transparent;
|
|
166
|
+
padding: 0;
|
|
113
167
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -35,6 +35,10 @@ interface PageRendererProps {
|
|
|
35
35
|
engine: DocumentEngine;
|
|
36
36
|
pageIndex: number;
|
|
37
37
|
availableWidth?: number;
|
|
38
|
+
onMeasuredSize?: (pageIndex: number, size: {
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
}) => void;
|
|
38
42
|
}
|
|
39
43
|
declare const PageRenderer: React.FC<PageRendererProps>;
|
|
40
44
|
|
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,10 @@ interface PageRendererProps {
|
|
|
35
35
|
engine: DocumentEngine;
|
|
36
36
|
pageIndex: number;
|
|
37
37
|
availableWidth?: number;
|
|
38
|
+
onMeasuredSize?: (pageIndex: number, size: {
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
}) => void;
|
|
38
42
|
}
|
|
39
43
|
declare const PageRenderer: React.FC<PageRendererProps>;
|
|
40
44
|
|