@embedpdf/viewer-chrome 3.0.0-next.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 +215 -0
- package/README.md +317 -0
- package/dist/chrome.cjs +228 -0
- package/dist/chrome.cjs.map +1 -0
- package/dist/chrome.d.cts +36 -0
- package/dist/chrome.d.ts +36 -0
- package/dist/chrome.js +224 -0
- package/dist/chrome.js.map +1 -0
- package/dist/commands.cjs +497 -0
- package/dist/commands.cjs.map +1 -0
- package/dist/commands.d.cts +22 -0
- package/dist/commands.d.ts +22 -0
- package/dist/commands.js +494 -0
- package/dist/commands.js.map +1 -0
- package/dist/es-C5084JO6.cjs +166 -0
- package/dist/es-C5084JO6.cjs.map +1 -0
- package/dist/es-D0PzYE9Z.js +166 -0
- package/dist/es-D0PzYE9Z.js.map +1 -0
- package/dist/index.cjs +3700 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +121 -0
- package/dist/index.d.ts +121 -0
- package/dist/index.js +3529 -0
- package/dist/index.js.map +1 -0
- package/package.json +61 -0
- package/src/styles.css +132 -0
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@embedpdf/viewer-chrome",
|
|
3
|
+
"version": "3.0.0-next.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "The full viewer's chrome — the ONE React implementation of the snippet UI (structure-only chrome schema, measured toolbar, Tailwind pixels). Published as an implementation dependency of @embedpdf/viewer; it is not a documented user-facing entry point for now.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.cts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./chrome": {
|
|
16
|
+
"import": "./dist/chrome.js",
|
|
17
|
+
"require": "./dist/chrome.cjs"
|
|
18
|
+
},
|
|
19
|
+
"./commands": {
|
|
20
|
+
"import": "./dist/commands.js",
|
|
21
|
+
"require": "./dist/commands.cjs"
|
|
22
|
+
},
|
|
23
|
+
"./package.json": "./package.json",
|
|
24
|
+
"./styles.css": "./src/styles.css"
|
|
25
|
+
},
|
|
26
|
+
"epdf": {
|
|
27
|
+
"rawExports": [
|
|
28
|
+
"./styles.css"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"src/styles.css"
|
|
34
|
+
],
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@embedpdf/react": "3.0.0-next.0"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"react": ">=18",
|
|
40
|
+
"react-dom": ">=18"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/react": "^18.3.0",
|
|
44
|
+
"@types/react-dom": "^18.3.0",
|
|
45
|
+
"typescript": "^5.0.0",
|
|
46
|
+
"tailwindcss": "^4.1.18",
|
|
47
|
+
"@embedpdf/tooling-build": "0.0.0"
|
|
48
|
+
},
|
|
49
|
+
"license": "Apache-2.0",
|
|
50
|
+
"sideEffects": false,
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "git+https://github.com/embedpdf/embed-pdf-viewer.git",
|
|
54
|
+
"directory": "packages/viewer/chrome"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "epdf-build",
|
|
58
|
+
"clean": "rimraf dist",
|
|
59
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
60
|
+
}
|
|
61
|
+
}
|
package/src/styles.css
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
@import 'tailwindcss';
|
|
2
|
+
|
|
3
|
+
/* This sheet ships INSIDE the chrome package, so consumers importing it sit
|
|
4
|
+
outside Tailwind's automatic content detection (node_modules is ignored).
|
|
5
|
+
Point the scanner at our own sources explicitly — relative to this file. */
|
|
6
|
+
@source './';
|
|
7
|
+
|
|
8
|
+
/* Dark mode is class-driven (we toggle `.dark` on <html>), not media-driven,
|
|
9
|
+
so the `theme` preference is authoritative over the OS setting. */
|
|
10
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
11
|
+
|
|
12
|
+
/* Semantic theme tokens — ported 1:1 from the snippet's light/dark themes
|
|
13
|
+
(viewers/snippet/src/config/theme.ts). Runtime CSS variables so the theme
|
|
14
|
+
switches with a class; `@theme inline` below turns each into a Tailwind
|
|
15
|
+
color utility (bg-surface, text-fg-muted, border-subtle, …). */
|
|
16
|
+
/* `:host` alongside `:root`: inside the <embedpdf-viewer> shadow root there is
|
|
17
|
+
no :root match, so the host carries the base tokens. The dark override stays
|
|
18
|
+
a plain `.dark` class — the element applies it to its shadow WRAPPER (and
|
|
19
|
+
apps to <html>), so one selector serves both worlds. */
|
|
20
|
+
:root,
|
|
21
|
+
:host {
|
|
22
|
+
--ep-app: #f3f4f6;
|
|
23
|
+
--ep-surface: #ffffff;
|
|
24
|
+
--ep-surface-alt: #f1f3f5;
|
|
25
|
+
--ep-elevated: #ffffff;
|
|
26
|
+
--ep-fg: #111827;
|
|
27
|
+
--ep-fg-secondary: #374151;
|
|
28
|
+
--ep-fg-muted: #6b7280;
|
|
29
|
+
--ep-fg-disabled: #9ca3af;
|
|
30
|
+
--ep-on-accent: #ffffff;
|
|
31
|
+
--ep-border: #d1d5db;
|
|
32
|
+
--ep-border-subtle: #e5e7eb;
|
|
33
|
+
--ep-border-strong: #9ca3af;
|
|
34
|
+
--ep-accent: #3b82f6;
|
|
35
|
+
--ep-accent-hover: #2563eb;
|
|
36
|
+
--ep-accent-active: #1d4ed8;
|
|
37
|
+
--ep-accent-light: #eff6ff;
|
|
38
|
+
--ep-hover: #f3f4f6;
|
|
39
|
+
--ep-active: #e5e7eb;
|
|
40
|
+
--ep-selected: #eff6ff;
|
|
41
|
+
--ep-canvas: #f3f4f6;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.dark {
|
|
45
|
+
--ep-app: #111827;
|
|
46
|
+
--ep-surface: #1f2937;
|
|
47
|
+
--ep-surface-alt: #374151;
|
|
48
|
+
--ep-elevated: #1f2937;
|
|
49
|
+
--ep-fg: #f9fafb;
|
|
50
|
+
--ep-fg-secondary: #e5e7eb;
|
|
51
|
+
--ep-fg-muted: #9ca3af;
|
|
52
|
+
--ep-fg-disabled: #6b7280;
|
|
53
|
+
--ep-on-accent: #111827;
|
|
54
|
+
--ep-border: #4b5563;
|
|
55
|
+
--ep-border-subtle: #374151;
|
|
56
|
+
--ep-border-strong: #6b7280;
|
|
57
|
+
--ep-accent: #60a5fa;
|
|
58
|
+
--ep-accent-hover: #3b82f6;
|
|
59
|
+
--ep-accent-active: #2563eb;
|
|
60
|
+
--ep-accent-light: #1e3a5f;
|
|
61
|
+
--ep-hover: #374151;
|
|
62
|
+
--ep-active: #4b5563;
|
|
63
|
+
--ep-selected: #1e3a5f;
|
|
64
|
+
--ep-canvas: #0d1117;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@theme inline {
|
|
68
|
+
--color-app: var(--ep-app);
|
|
69
|
+
--color-surface: var(--ep-surface);
|
|
70
|
+
--color-surface-alt: var(--ep-surface-alt);
|
|
71
|
+
--color-elevated: var(--ep-elevated);
|
|
72
|
+
--color-fg: var(--ep-fg);
|
|
73
|
+
--color-fg-secondary: var(--ep-fg-secondary);
|
|
74
|
+
--color-fg-muted: var(--ep-fg-muted);
|
|
75
|
+
--color-fg-disabled: var(--ep-fg-disabled);
|
|
76
|
+
--color-on-accent: var(--ep-on-accent);
|
|
77
|
+
--color-border: var(--ep-border);
|
|
78
|
+
--color-border-subtle: var(--ep-border-subtle);
|
|
79
|
+
--color-border-strong: var(--ep-border-strong);
|
|
80
|
+
--color-accent: var(--ep-accent);
|
|
81
|
+
--color-accent-hover: var(--ep-accent-hover);
|
|
82
|
+
--color-accent-active: var(--ep-accent-active);
|
|
83
|
+
--color-accent-light: var(--ep-accent-light);
|
|
84
|
+
--color-hover: var(--ep-hover);
|
|
85
|
+
--color-active: var(--ep-active);
|
|
86
|
+
--color-selected: var(--ep-selected);
|
|
87
|
+
--color-canvas: var(--ep-canvas);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
html,
|
|
91
|
+
body,
|
|
92
|
+
#root {
|
|
93
|
+
height: 100%;
|
|
94
|
+
margin: 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
body {
|
|
98
|
+
font-family:
|
|
99
|
+
ui-sans-serif,
|
|
100
|
+
system-ui,
|
|
101
|
+
-apple-system,
|
|
102
|
+
'Segoe UI',
|
|
103
|
+
Roboto,
|
|
104
|
+
Helvetica,
|
|
105
|
+
Arial,
|
|
106
|
+
sans-serif;
|
|
107
|
+
color: var(--ep-fg);
|
|
108
|
+
background: var(--ep-app);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* The measurement layer in <Toolbar> is aria-hidden + visibility:hidden; make
|
|
112
|
+
doubly sure it never intercepts pointer events or shows a scrollbar. */
|
|
113
|
+
[data-measure-layer] {
|
|
114
|
+
pointer-events: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* Headless scrollbar theming. The component ships geometry + behavior only
|
|
118
|
+
(thumb drag, track paging, auto-hide → data-state); everything visual is
|
|
119
|
+
these few rules — restyle or replace them freely. */
|
|
120
|
+
:root {
|
|
121
|
+
--epdf-scrollbar-thumb: rgba(17, 24, 39, 0.35);
|
|
122
|
+
}
|
|
123
|
+
.dark {
|
|
124
|
+
--epdf-scrollbar-thumb: rgba(249, 250, 251, 0.28);
|
|
125
|
+
}
|
|
126
|
+
[data-embedpdf-scrollbar-thumb] {
|
|
127
|
+
transition: background 150ms;
|
|
128
|
+
}
|
|
129
|
+
[data-embedpdf-scrollbar-thumb]:hover,
|
|
130
|
+
[data-embedpdf-scrollbar][data-dragging] [data-embedpdf-scrollbar-thumb] {
|
|
131
|
+
background: var(--ep-fg-muted);
|
|
132
|
+
}
|