stimulus-pdf-viewer-rails 0.2.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f716f4d4af642c98353a4dab874dedcc15f88672b6fd44d8a98acd8d31c971ad
4
- data.tar.gz: 304be04c5c426ee97c844c29bd54c8b4045f31ca4d638d269bec34b9593861fc
3
+ metadata.gz: a2b8580f37e1f69672150d18e71bda47daff6b3eb2b082becc5f0090bea57d43
4
+ data.tar.gz: 6f3ecaf5db5c8248a6037c0f416149df1af21980e83236a9ffe9a9d395aa5e99
5
5
  SHA512:
6
- metadata.gz: 35a297b94975f670100c5cf603eeb5662a32cd22c098ba10b071a6438a9a47b8bd2b7bb4e72d6385d90385c8d31afcd03d7ae9b8e6275103d9770186a1b490d4
7
- data.tar.gz: 473d768614f6907348f4bd10cfc50f173c9a544253b63c86f494fcc7a181b2e79d3d8e7988af92837fe07bb1a4a602ae1b6eb8c5b6d8e6ab0f5fad43418b11ca
6
+ metadata.gz: 27b13a4566eefe38263b236ba1fd96a0bec05651a27f5e333147b2f6635e9dac5e100b58ff4a67db6f36360895fc1b2ca8facdd58e091aa8b1c2053accf76f28
7
+ data.tar.gz: 65a0c1284f86ffc83680d9ac95c6e20f64cec6dad84f3f5edb9ea6ec6e4cd1f6003f865d4d959400e05eab4f8e56b2db39494b2cec520506c1a8078770d3d605
@@ -7956,7 +7956,8 @@ class pdf_viewer_controller extends Controller {
7956
7956
  documentId: String,
7957
7957
  trackingUrl: String,
7958
7958
  initialPage: Number,
7959
- initialAnnotation: String
7959
+ initialAnnotation: String,
7960
+ autoHeight: { type: Boolean, default: true }
7960
7961
  }
7961
7962
 
7962
7963
  initialize() {
@@ -8422,8 +8423,8 @@ class pdf_viewer_controller extends Controller {
8422
8423
 
8423
8424
  setViewportHeight() {
8424
8425
  requestAnimationFrame(() => {
8425
- // Skip if using CSS flexbox layout (document-fullscreen wrapper handles sizing)
8426
- if (this.containerTarget.closest('.document-fullscreen')) {
8426
+ // Skip if autoHeight is disabled (container height managed by consuming application)
8427
+ if (!this.autoHeightValue) {
8427
8428
  return
8428
8429
  }
8429
8430
 
@@ -8510,40 +8511,5 @@ class pdf_download_controller extends Controller {
8510
8511
  }
8511
8512
  }
8512
8513
 
8513
- class pdf_sync_scroll_controller extends Controller {
8514
- static targets = ["container", "toggle"]
8515
-
8516
- connect() {
8517
- this.isSyncing = false;
8518
- }
8519
-
8520
- sync(event) {
8521
- if (this.isSyncing) return
8522
- if (!this.toggleTarget.checked) return
8523
-
8524
- const master = event.currentTarget;
8525
- const slave = this.containerTargets.find(target => target !== master);
8526
-
8527
- if (!slave) return
8528
-
8529
- this.isSyncing = true;
8530
-
8531
- // Calculate percentage-based scroll to account for potential
8532
- // differences in zoom levels or page counts
8533
- const scrollPercentageY = master.scrollTop / (master.scrollHeight - master.clientHeight);
8534
- const scrollPercentageX = master.scrollLeft / (master.scrollWidth - master.clientWidth);
8535
-
8536
- window.requestAnimationFrame(() => {
8537
- slave.scrollTop = scrollPercentageY * (slave.scrollHeight - slave.clientHeight);
8538
- slave.scrollLeft = scrollPercentageX * (slave.scrollWidth - slave.clientWidth);
8539
-
8540
- // Reset the lock after the browser paint
8541
- window.requestAnimationFrame(() => {
8542
- this.isSyncing = false;
8543
- });
8544
- });
8545
- }
8546
- }
8547
-
8548
- export { AnnotationStore, CoreViewer, MemoryAnnotationStore, pdf_download_controller as PdfDownloadController, pdf_sync_scroll_controller as PdfSyncScrollController, PdfViewer, pdf_viewer_controller as PdfViewerController, RestAnnotationStore, ToolMode, ViewerEvents };
8514
+ export { AnnotationStore, CoreViewer, MemoryAnnotationStore, pdf_download_controller as PdfDownloadController, PdfViewer, pdf_viewer_controller as PdfViewerController, RestAnnotationStore, ToolMode, ViewerEvents };
8549
8515
  //# sourceMappingURL=stimulus-pdf-viewer.esm.js.map
@@ -7976,7 +7976,8 @@
7976
7976
  documentId: String,
7977
7977
  trackingUrl: String,
7978
7978
  initialPage: Number,
7979
- initialAnnotation: String
7979
+ initialAnnotation: String,
7980
+ autoHeight: { type: Boolean, default: true }
7980
7981
  }
7981
7982
 
7982
7983
  initialize() {
@@ -8442,8 +8443,8 @@
8442
8443
 
8443
8444
  setViewportHeight() {
8444
8445
  requestAnimationFrame(() => {
8445
- // Skip if using CSS flexbox layout (document-fullscreen wrapper handles sizing)
8446
- if (this.containerTarget.closest('.document-fullscreen')) {
8446
+ // Skip if autoHeight is disabled (container height managed by consuming application)
8447
+ if (!this.autoHeightValue) {
8447
8448
  return
8448
8449
  }
8449
8450
 
@@ -8530,46 +8531,10 @@
8530
8531
  }
8531
8532
  }
8532
8533
 
8533
- class pdf_sync_scroll_controller extends stimulus.Controller {
8534
- static targets = ["container", "toggle"]
8535
-
8536
- connect() {
8537
- this.isSyncing = false;
8538
- }
8539
-
8540
- sync(event) {
8541
- if (this.isSyncing) return
8542
- if (!this.toggleTarget.checked) return
8543
-
8544
- const master = event.currentTarget;
8545
- const slave = this.containerTargets.find(target => target !== master);
8546
-
8547
- if (!slave) return
8548
-
8549
- this.isSyncing = true;
8550
-
8551
- // Calculate percentage-based scroll to account for potential
8552
- // differences in zoom levels or page counts
8553
- const scrollPercentageY = master.scrollTop / (master.scrollHeight - master.clientHeight);
8554
- const scrollPercentageX = master.scrollLeft / (master.scrollWidth - master.clientWidth);
8555
-
8556
- window.requestAnimationFrame(() => {
8557
- slave.scrollTop = scrollPercentageY * (slave.scrollHeight - slave.clientHeight);
8558
- slave.scrollLeft = scrollPercentageX * (slave.scrollWidth - slave.clientWidth);
8559
-
8560
- // Reset the lock after the browser paint
8561
- window.requestAnimationFrame(() => {
8562
- this.isSyncing = false;
8563
- });
8564
- });
8565
- }
8566
- }
8567
-
8568
8534
  exports.AnnotationStore = AnnotationStore;
8569
8535
  exports.CoreViewer = CoreViewer;
8570
8536
  exports.MemoryAnnotationStore = MemoryAnnotationStore;
8571
8537
  exports.PdfDownloadController = pdf_download_controller;
8572
- exports.PdfSyncScrollController = pdf_sync_scroll_controller;
8573
8538
  exports.PdfViewer = PdfViewer;
8574
8539
  exports.PdfViewerController = pdf_viewer_controller;
8575
8540
  exports.RestAnnotationStore = RestAnnotationStore;
@@ -1,203 +1,7 @@
1
1
  // PDF Viewer Styles for stimulus-pdf-viewer
2
2
  //
3
- // CURSOR ASSETS: This stylesheet references cursor SVG files for annotation tools.
4
- // Copy the cursor files from `assets/cursors/` to your asset pipeline and update
5
- // the paths in the cursor sections below (search for `cursor: url(`) to match
6
- // your asset configuration.
7
- //
8
- // Default paths assume: `pdf_viewer/cursor-*.svg` in your asset pipeline.
9
-
10
- // Fullscreen document layout - prevents dual scroll by filling viewport
11
- // Uses :has() for progressive enhancement - body overflow hidden when fullscreen viewer is present
12
- body:has(.document-fullscreen) {
13
- overflow: hidden;
14
- margin: 0;
15
- }
16
-
17
- html:has(.document-fullscreen) {
18
- // Prevent iOS Safari visual viewport scrolling
19
- overflow: hidden;
20
- }
21
-
22
- .document-fullscreen {
23
- display: flex;
24
- flex-direction: column;
25
- height: 100vh;
26
- height: 100dvh; // Dynamic viewport height (accounts for mobile browser UI)
27
- overflow: hidden;
28
- // Use fixed positioning to truly lock page on iOS Safari
29
- position: fixed;
30
- inset: 0;
31
- width: 100%;
32
- overscroll-behavior: none;
33
-
34
- // Header takes natural height
35
- .document-header {
36
- flex-shrink: 0;
37
- }
38
-
39
- // PDF viewer fills remaining space
40
- .pdf-viewer-container {
41
- flex: 1;
42
- min-height: 0; // Important: allows flex child to shrink below content size
43
- }
44
- }
45
-
46
- // Compact document header - title, actions, and close
47
- .document-header {
48
- display: flex;
49
- align-items: center;
50
- padding: 8px 16px;
51
- background: #fff;
52
- border-bottom: 1px solid #e3ebf6;
53
- gap: 12px;
54
- }
55
-
56
- .document-header-title {
57
- margin: 0;
58
- font-size: 16px;
59
- font-weight: 600;
60
- color: #12263f;
61
- white-space: nowrap;
62
- overflow: hidden;
63
- text-overflow: ellipsis;
64
- min-width: 0;
65
- flex: 1;
66
- }
67
-
68
- .document-header-actions {
69
- display: flex;
70
- align-items: center;
71
- gap: 4px;
72
- flex-shrink: 0;
73
- }
74
-
75
- .document-header-compare-form {
76
- display: flex;
77
- margin: 0;
78
- }
79
-
80
- .document-header-select {
81
- height: 32px;
82
- padding: 0 28px 0 12px;
83
- border: 1px solid #d2ddec;
84
- border-radius: 6px;
85
- background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2395aac9' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
86
- background-size: 12px;
87
- color: #12263f;
88
- font-size: 13px;
89
- cursor: pointer;
90
- appearance: none;
91
- max-width: 180px;
92
-
93
- &:hover {
94
- border-color: #95aac9;
95
- }
96
-
97
- &:focus {
98
- outline: none;
99
- border-color: #2c7be5;
100
- box-shadow: 0 0 0 2px rgba(44, 123, 229, 0.15);
101
- }
102
- }
103
-
104
- .document-header-btn {
105
- display: flex;
106
- align-items: center;
107
- justify-content: center;
108
- width: 32px;
109
- height: 32px;
110
- padding: 0;
111
- border: none;
112
- border-radius: 6px;
113
- background: none;
114
- color: #95aac9;
115
- cursor: pointer;
116
- transition: all 0.15s ease;
117
-
118
- &:hover {
119
- background: #f9fbfd;
120
- color: #12263f;
121
- }
122
- }
123
-
124
- .document-header-btn-danger {
125
- &:hover {
126
- background: #fef2f2;
127
- color: #e63757;
128
- }
129
- }
130
-
131
- .document-header-btn-text {
132
- display: flex;
133
- align-items: center;
134
- padding: 6px 12px;
135
- border-radius: 6px;
136
- color: #2c7be5;
137
- font-size: 13px;
138
- font-weight: 500;
139
- white-space: nowrap;
140
- transition: all 0.15s ease;
141
-
142
- &:hover {
143
- background: #f0f6ff;
144
- color: #1a68d1;
145
- }
146
- }
147
-
148
- .document-header-close {
149
- display: flex;
150
- align-items: center;
151
- justify-content: center;
152
- width: 32px;
153
- height: 32px;
154
- border-radius: 6px;
155
- color: #95aac9;
156
- transition: all 0.15s ease;
157
- flex-shrink: 0;
158
-
159
- &:hover {
160
- background: #f9fbfd;
161
- color: #12263f;
162
- }
163
- }
164
-
165
- // Side-by-side comparison grid for comparing two documents
166
- .document-comparison-grid {
167
- display: grid;
168
- grid-template-columns: 1fr 1fr;
169
- flex: 1;
170
- min-height: 0;
171
- gap: 0;
172
-
173
- .pdf-viewer-container {
174
- min-height: 0;
175
- min-width: 0; // Prevent grid blowout - allows children to shrink below content size
176
- overflow: hidden;
177
- }
178
-
179
- // Compact toolbar for comparison view - hide labels, show icons only
180
- .pdf-toolbar {
181
- overflow: hidden;
182
- }
183
-
184
- .pdf-tool-btn span {
185
- display: none;
186
- }
187
-
188
- .pdf-tool-btn {
189
- padding: 6px;
190
- }
191
-
192
- // Hide less essential tools in comparison view
193
- .pdf-tool-btn[data-tool="note"],
194
- .pdf-tool-btn[data-tool="ink"],
195
- .pdf-toolbar-colors,
196
- .pdf-toolbar-separator:nth-of-type(2),
197
- .pdf-toolbar-separator:nth-of-type(3) {
198
- display: none;
199
- }
200
- }
3
+ // Cursor SVGs for annotation tools are embedded as data URIs, so no additional
4
+ // asset configuration is required.
201
5
 
202
6
  // Container
203
7
  .pdf-viewer-container {
@@ -220,6 +24,11 @@ html:has(.document-fullscreen) {
220
24
  --pdf-accent: #0060df;
221
25
  --pdf-accent-hover: #0250bb;
222
26
 
27
+ --pdf-cursor-freehighlight: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='19' fill='none' viewBox='0 0 18 19'%3E%3Cpath fill='%23fbfbfe' fill-rule='evenodd' d='M12.2 3.09c.08-.08.23-.09.23-.09.05 0 .15.02.23.1l1.79 1.79c.13.13.13.33 0 .46l-2.679 2.679-2.255-2.255zm1.066 2.03L11.77 6.614l-.84-.84 1.494-1.495zM5.98 9.32l2.25 2.25 2.48-2.48-2.254-2.256L5.98 9.31zm2.25.836 1.066-1.067-.84-.84-1.067 1.066z' clip-rule='evenodd'/%3E%3Cpath fill='%23fbfbfe' fill-rule='evenodd' d='m10.153 13.182 6.06-6.06a2.78 2.78 0 0 0 .837-2.002c0-.75-.292-1.47-.837-2.002l-1.781-1.78A2.78 2.78 0 0 0 12.43.5c-.766 0-1.477.313-1.997.833l-6.75 6.75a1.755 1.755 0 0 0-.11 2.353l-2.281 2.288a1 1 0 0 0-.291.745L1 14.5a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h15a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1h-5.767c-.397 0-.833-.565-.08-1.318M4.39 9.85l.59.59-2.582 2.591h4.24l.467-.466.466.466H8.89l6.62-6.621c.35-.34.54-.8.54-1.29s-.19-.95-.54-1.29l-1.79-1.79c-.34-.35-.8-.54-1.29-.54s-.95.2-1.29.54L4.39 8.79c-.29.29-.29.77 0 1.06M16 17.5v-2H1v2z' clip-rule='evenodd'/%3E%3Cpath stroke='%2315141a' d='m15.162 6.051-.006.005-6.75 6.75a.25.25 0 0 1-.352 0l-.595-.594-.354-.354-.354.353-.718.719H3.205l2.13-2.136.352-.354-.353-.353-.59-.59a.255.255 0 0 1 0-.353l6.75-6.75c.25-.25.584-.394.936-.394.358 0 .688.138.931.388l.005.006 1.79 1.79.006.005c.25.243.388.573.388.931s-.138.688-.388.931Zm-7.286 5.873.354.353.354-.353 2.48-2.481.354-.354-.354-.353L8.81 6.48l-.353-.354-.354.354-2.476 2.475-.146.147v.424l.146.147zm3.542-3.542.353.354.354-.354 2.679-2.678a.82.82 0 0 0 0-1.168l-1.79-1.79a.84.84 0 0 0-.584-.246h-.017l-.016.001.033.499-.034-.499h-.009l-.014.002a1 1 0 0 0-.155.028.8.8 0 0 0-.372.205L9.163 5.42l-.354.354.354.353zM1.5 16h14v1h-14z'/%3E%3C/svg%3E");
28
+ --pdf-cursor-texthighlight: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='32' fill='none' viewBox='0 0 29 32'%3E%3Cpath fill='%23000' stroke='%23fbfbfe' stroke-linejoin='round' d='M28 16.75a.5.5 0 0 0 .5-.5V15a.5.5 0 0 0-.5-.5h-1.642c-.446 0-.88.126-1.258.36l-.001.001-1.099.687-1.1-.687a2.4 2.4 0 0 0-1.258-.361H20a.5.5 0 0 0-.5.5v1.25a.5.5 0 0 0 .5.5h1.642a.13.13 0 0 1 .068.02l1.107.691a.12.12 0 0 1 .059.106v10.116a.12.12 0 0 1-.059.106l-1.108.691a.13.13 0 0 1-.068.02H20a.5.5 0 0 0-.5.5v1.25a.5.5 0 0 0 .5.5h1.642c.446 0 .88-.126 1.258-.36l1.1-.687 1.1.687c.378.235.813.361 1.259.361H28a.5.5 0 0 0 .5-.5v-1.25a.5.5 0 0 0-.5-.5h-1.642a.13.13 0 0 1-.068-.02l-1.107-.691a.12.12 0 0 1-.058-.106V17.567c0-.044.021-.083.059-.106l1.105-.691a.13.13 0 0 1 .069-.02z'/%3E%3Cpath fill='%23000' d='M24.625 17.567c0-.217.11-.415.293-.53l1.108-.692a.63.63 0 0 1 .332-.095H28V15h-1.642a1.9 1.9 0 0 0-.994.285l-1.108.693c-.095.059-.175.135-.256.209-.082-.074-.161-.15-.256-.209l-1.109-.693a1.9 1.9 0 0 0-.993-.285H20v1.25h1.642a.63.63 0 0 1 .332.095l1.108.692a.62.62 0 0 1 .294.53v10.116c0 .217-.11.415-.294.53l-1.109.692a.63.63 0 0 1-.332.095H20v1.25h1.642c.352 0 .695-.099.994-.285l1.108-.692c.096-.06.175-.136.256-.209.081.073.161.149.256.209l1.109.693c.299.186.642.285.994.285H28v-1.25h-1.642a.63.63 0 0 1-.332-.095l-1.108-.692a.62.62 0 0 1-.293-.53z'/%3E%3Cpath fill='%23fbfbfe' fill-rule='evenodd' d='M12.2 2.59c.08-.08.23-.09.23-.09.05 0 .15.02.23.1l1.79 1.79c.13.13.13.33 0 .46l-2.679 2.679-2.255-2.255zm1.066 2.03L11.77 6.114l-.84-.84 1.494-1.495zM5.98 8.82l2.25 2.25 2.48-2.48-2.254-2.256L5.98 8.81zm2.25.836 1.066-1.067-.84-.84-1.067 1.066z' clip-rule='evenodd'/%3E%3Cpath fill='%23fbfbfe' fill-rule='evenodd' d='m10.153 12.682 6.06-6.06a2.78 2.78 0 0 0 .837-2.002c0-.75-.292-1.47-.837-2.002L14.432.838A2.78 2.78 0 0 0 12.43 0c-.766 0-1.477.313-1.997.833l-6.75 6.75a1.755 1.755 0 0 0-.11 2.353l-2.281 2.288a1 1 0 0 0-.291.745L1 14a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h15a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1h-5.767c-.397 0-.833-.565-.08-1.318M4.39 9.35l.59.59-2.582 2.591h4.24l.467-.466.466.466H8.89l6.62-6.621c.35-.34.54-.8.54-1.29s-.19-.95-.54-1.29l-1.79-1.79c-.34-.35-.8-.54-1.29-.54s-.95.2-1.29.54L4.39 8.29c-.29.29-.29.77 0 1.06M16 17v-2H1v2z' clip-rule='evenodd'/%3E%3Cpath stroke='%2315141a' d='m15.162 5.551-.006.005-6.75 6.75a.25.25 0 0 1-.352 0l-.595-.594-.354-.354-.354.353-.718.719H3.205l2.13-2.136.352-.354-.353-.353-.59-.59a.255.255 0 0 1 0-.353l6.75-6.75c.25-.25.584-.394.936-.394.358 0 .688.138.931.388l.005.006 1.79 1.79.006.005c.25.243.388.573.388.931s-.138.688-.388.931ZM5.48 8.82v.207l.146.147 2.25 2.25.354.353.354-.353 2.48-2.481.354-.354-.354-.353L8.81 5.98l-.353-.354-.354.354-2.476 2.475-.146.147v.217Zm5.938-.938.353.354.354-.354 2.679-2.678a.82.82 0 0 0 0-1.168l-1.79-1.79A.84.84 0 0 0 12.43 2h-.017l-.016.001.033.499-.034-.499h-.009l-.014.002a1 1 0 0 0-.155.028.8.8 0 0 0-.372.205L9.163 4.92l-.354.354.354.353zM1.5 16.5v-1h14v1z'/%3E%3C/svg%3E");
29
+ --pdf-cursor-ink: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 16 16'%3E%3Cpath fill='%23fff' d='m.019 13.665.594-3.201c.075-.41.272-.784.568-1.082l8.801-8.8a1.99 1.99 0 0 1 2.81 0L14.42 2.21a1.99 1.99 0 0 1 0 2.81l-8.804 8.803c-.296.295-.67.49-1.078.566l-3.202.594Q1.232 15 1.13 15a1.13 1.13 0 0 1-1.111-1.336'/%3E%3Cpath fill='%23000' d='m.019 13.665.594-3.201c.075-.41.272-.784.568-1.082l8.801-8.8a1.99 1.99 0 0 1 2.81 0L14.42 2.21a1.99 1.99 0 0 1 0 2.81l-8.804 8.803c-.296.295-.67.49-1.078.566l-3.202.594Q1.232 15 1.13 15a1.13 1.13 0 0 1-1.111-1.336m12.453-8.468 1.16-1.16-.001-.848-1.82-1.822-.848.002-1.16 1.16zm-8.161 7.962a.8.8 0 0 0 .423-.225l6.853-6.852-2.668-2.668-6.853 6.852a.8.8 0 0 0-.225.425l-.474 2.557.385.386z'/%3E%3C/svg%3E");
30
+ --pdf-cursor-note: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 16 16'%3E%3Cpath fill='%23fff' stroke='%23fff' d='M2 1a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h3l3 3 3-3h3a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z'/%3E%3Cpath fill='%23000' d='M2 2h12v9h-3.5L8 13.5 5.5 11H2z'/%3E%3Cpath stroke='%23fff' stroke-linecap='round' d='M4 5h8M4 7.5h6'/%3E%3C/svg%3E");
31
+
223
32
  position: relative;
224
33
  width: 100%;
225
34
  height: 100%;
@@ -731,7 +540,7 @@ html:has(.document-fullscreen) {
731
540
  .markedContent span:not(.markedContent) {
732
541
  z-index: 1;
733
542
 
734
- --font-height: 0; /* set by text_layer.js */
543
+ --font-height: 0; /* set by PDF.js TextLayer */
735
544
  font-size: calc(var(--text-scale-factor) * var(--font-height));
736
545
 
737
546
  --scale-x: 1;
@@ -1492,17 +1301,17 @@ html:has(.document-fullscreen) {
1492
1301
  // Note: Touch scroll prevention is handled by JavaScript touch event handlers
1493
1302
  .pdf-pages-container.highlight-mode {
1494
1303
  .pdf-page {
1495
- cursor: url('pdf_viewer/cursor-editorFreeHighlight.svg') 0 16, crosshair;
1304
+ cursor: var(--pdf-cursor-freehighlight) 0 16, crosshair;
1496
1305
  }
1497
1306
 
1498
1307
  .textLayer :is(span, br) {
1499
- cursor: url('pdf_viewer/cursor-editorTextHighlight.svg') 0 16, text;
1308
+ cursor: var(--pdf-cursor-texthighlight) 0 16, text;
1500
1309
  }
1501
1310
 
1502
1311
  // Force freehand cursor during active drawing (prevents cursor change on drag)
1503
1312
  &.is-drawing,
1504
1313
  &.is-drawing * {
1505
- cursor: url('pdf_viewer/cursor-editorFreeHighlight.svg') 0 16, crosshair !important;
1314
+ cursor: var(--pdf-cursor-freehighlight) 0 16, crosshair !important;
1506
1315
  }
1507
1316
  }
1508
1317
 
@@ -1510,11 +1319,11 @@ html:has(.document-fullscreen) {
1510
1319
  // Note: Touch scroll prevention is handled by JavaScript touch event handlers
1511
1320
  .pdf-pages-container.underline-mode {
1512
1321
  .pdf-page {
1513
- cursor: url('pdf_viewer/cursor-editorTextHighlight.svg') 0 16, text;
1322
+ cursor: var(--pdf-cursor-texthighlight) 0 16, text;
1514
1323
  }
1515
1324
 
1516
1325
  .textLayer :is(span, br) {
1517
- cursor: url('pdf_viewer/cursor-editorTextHighlight.svg') 0 16, text;
1326
+ cursor: var(--pdf-cursor-texthighlight) 0 16, text;
1518
1327
  }
1519
1328
  }
1520
1329
 
@@ -1523,13 +1332,13 @@ html:has(.document-fullscreen) {
1523
1332
  // Note: Touch scroll prevention is handled by JavaScript touch event handlers
1524
1333
  .pdf-pages-container.ink-mode {
1525
1334
  .pdf-page {
1526
- cursor: url('pdf_viewer/cursor-editorInk.svg') 1 14, crosshair;
1335
+ cursor: var(--pdf-cursor-ink) 1 14, crosshair;
1527
1336
  }
1528
1337
 
1529
1338
  // Force pen cursor during active drawing
1530
1339
  &.is-drawing,
1531
1340
  &.is-drawing * {
1532
- cursor: url('pdf_viewer/cursor-editorInk.svg') 1 14, crosshair !important;
1341
+ cursor: var(--pdf-cursor-ink) 1 14, crosshair !important;
1533
1342
  }
1534
1343
  }
1535
1344
 
@@ -1538,7 +1347,7 @@ html:has(.document-fullscreen) {
1538
1347
  .pdf-page,
1539
1348
  .textLayer,
1540
1349
  .textLayer * {
1541
- cursor: url('pdf_viewer/cursor-editorNote.svg') 1 1, crosshair;
1350
+ cursor: var(--pdf-cursor-note) 1 1, crosshair;
1542
1351
  }
1543
1352
  }
1544
1353
 
@@ -2821,26 +2630,3 @@ html:has(.document-fullscreen) {
2821
2630
  color: CanvasText;
2822
2631
  }
2823
2632
  }
2824
-
2825
- .document-comparison-grid {
2826
- display: grid;
2827
- grid-template-columns: 1fr 1fr;
2828
- flex: 1;
2829
- min-height: 0;
2830
- gap: 1px; // A thin separator line
2831
- background-color: var(--pdf-dark-border); // Use border color for the gap
2832
-
2833
- .pdf-viewer-container {
2834
- background-color: #525659;
2835
- overflow: hidden; // The container itself shouldn't scroll
2836
- display: flex;
2837
- flex-direction: column;
2838
- }
2839
-
2840
- // Target the actual scrollable area defined in your previous CSS
2841
- .pdf-pages-container {
2842
- overflow: auto;
2843
- -webkit-overflow-scrolling: touch;
2844
- scrollbar-gutter: stable; // Prevents layout shift when scrollbars appear
2845
- }
2846
- }
@@ -7,7 +7,6 @@ module StimulusPdfViewer
7
7
  # Add our assets to the asset paths
8
8
  app.config.assets.paths << root.join("app/assets/javascripts")
9
9
  app.config.assets.paths << root.join("app/assets/stylesheets")
10
- app.config.assets.paths << root.join("app/assets/images")
11
10
 
12
11
  # Precompile the main JS file
13
12
  app.config.assets.precompile += %w[
@@ -1,7 +1,7 @@
1
1
  module StimulusPdfViewer
2
2
  module Rails
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  # This should match the npm package version
5
- STIMULUS_PDF_VIEWER_VERSION = "0.2.0"
5
+ STIMULUS_PDF_VIEWER_VERSION = "0.2.1"
6
6
  end
7
7
  end
@@ -28,9 +28,6 @@ class StimulusPdfViewerAssetUpdater
28
28
  "styles/pdf-viewer.scss" => "app/assets/stylesheets/stimulus-pdf-viewer.scss"
29
29
  }.freeze
30
30
 
31
- CURSOR_SOURCE_DIR = "assets/cursors"
32
- CURSOR_DEST_DIR = "app/assets/images/stimulus-pdf-viewer"
33
-
34
31
  def initialize(version)
35
32
  @requested_version = version
36
33
  end
@@ -125,25 +122,6 @@ class StimulusPdfViewerAssetUpdater
125
122
  FileUtils.cp(src_path, dest_path)
126
123
  puts " #{src} -> #{dest}"
127
124
  end
128
-
129
- copy_cursors(package_dir)
130
- end
131
-
132
- def copy_cursors(package_dir)
133
- cursor_src = File.join(package_dir, CURSOR_SOURCE_DIR)
134
- cursor_dest = File.join(GEM_ROOT, CURSOR_DEST_DIR)
135
-
136
- unless Dir.exist?(cursor_src)
137
- warn " Warning: #{CURSOR_SOURCE_DIR} not found in package"
138
- return
139
- end
140
-
141
- FileUtils.mkdir_p(cursor_dest)
142
-
143
- Dir.glob(File.join(cursor_src, "*.svg")).each do |svg|
144
- FileUtils.cp(svg, cursor_dest)
145
- puts " #{CURSOR_SOURCE_DIR}/#{File.basename(svg)} -> #{CURSOR_DEST_DIR}/"
146
- end
147
125
  end
148
126
 
149
127
  def update_version_file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stimulus-pdf-viewer-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Baker
@@ -44,10 +44,6 @@ files:
44
44
  - LICENSE-MIT
45
45
  - NOTICE
46
46
  - README.md
47
- - app/assets/images/stimulus-pdf-viewer/cursor-editorFreeHighlight.svg
48
- - app/assets/images/stimulus-pdf-viewer/cursor-editorInk.svg
49
- - app/assets/images/stimulus-pdf-viewer/cursor-editorNote.svg
50
- - app/assets/images/stimulus-pdf-viewer/cursor-editorTextHighlight.svg
51
47
  - app/assets/javascripts/stimulus-pdf-viewer.esm.js
52
48
  - app/assets/javascripts/stimulus-pdf-viewer.js
53
49
  - app/assets/stylesheets/stimulus-pdf-viewer.scss
@@ -1,6 +0,0 @@
1
- <svg width="18" height="19" viewBox="0 0 18 19" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path fill-rule="evenodd" clip-rule="evenodd" d="M12.2 3.09C12.28 3.01 12.43 3 12.43 3C12.48 3 12.58 3.02 12.66 3.1L14.45 4.89C14.58 5.02 14.58 5.22 14.45 5.35L11.7713 8.02872L9.51628 5.77372L12.2 3.09ZM13.2658 5.12L11.7713 6.6145L10.9305 5.77372L12.425 4.27921L13.2658 5.12Z" fill="#FBFBFE"/>
3
- <path fill-rule="evenodd" clip-rule="evenodd" d="M5.98 9.32L8.23 11.57L10.7106 9.08938L8.45562 6.83438L5.98 9.31V9.32ZM8.23 10.1558L9.29641 9.08938L8.45562 8.24859L7.38921 9.315L8.23 10.1558Z" fill="#FBFBFE"/>
4
- <path fill-rule="evenodd" clip-rule="evenodd" d="M10.1526 13.1816L16.2125 7.1217C16.7576 6.58919 17.05 5.8707 17.05 5.12C17.05 4.36931 16.7576 3.65084 16.2126 3.11834L14.4317 1.33747C13.8992 0.79242 13.1807 0.5 12.43 0.5C11.6643 0.5 10.9529 0.812929 10.4329 1.33289L3.68289 8.08289C3.04127 8.72452 3.00459 9.75075 3.57288 10.4363L1.29187 12.7239C1.09186 12.9245 0.990263 13.1957 1.0007 13.4685L1 14.5C0.447715 14.5 0 14.9477 0 15.5V17.5C0 18.0523 0.447715 18.5 1 18.5H16C16.5523 18.5 17 18.0523 17 17.5V15.5C17 14.9477 16.5523 14.5 16 14.5H10.2325C9.83594 14.5 9.39953 13.9347 10.1526 13.1816ZM4.39 9.85L4.9807 10.4407L2.39762 13.0312H6.63877L7.10501 12.565L7.57125 13.0312H8.88875L15.51 6.41C15.86 6.07 16.05 5.61 16.05 5.12C16.05 4.63 15.86 4.17 15.51 3.83L13.72 2.04C13.38 1.69 12.92 1.5 12.43 1.5C11.94 1.5 11.48 1.7 11.14 2.04L4.39 8.79C4.1 9.08 4.1 9.56 4.39 9.85ZM16 17.5V15.5H1V17.5H16Z" fill="#FBFBFE"/>
5
- <path d="M15.1616 6.05136L15.1616 6.05132L15.1564 6.05645L8.40645 12.8064C8.35915 12.8537 8.29589 12.88 8.23 12.88C8.16411 12.88 8.10085 12.8537 8.05355 12.8064L7.45857 12.2115L7.10501 11.8579L6.75146 12.2115L6.03289 12.93H3.20465L5.33477 10.7937L5.6873 10.4402L5.33426 10.0871L4.74355 9.49645C4.64882 9.40171 4.64882 9.23829 4.74355 9.14355L11.4936 2.39355C11.7436 2.14354 12.0779 2 12.43 2C12.7883 2 13.1179 2.13776 13.3614 2.38839L13.3613 2.38843L13.3664 2.39355L15.1564 4.18355L15.1564 4.18359L15.1616 4.18864C15.4122 4.43211 15.55 4.76166 15.55 5.12C15.55 5.47834 15.4122 5.80789 15.1616 6.05136ZM7.87645 11.9236L8.23 12.2771L8.58355 11.9236L11.0642 9.44293L11.4177 9.08938L11.0642 8.73582L8.80918 6.48082L8.45562 6.12727L8.10207 6.48082L5.62645 8.95645L5.48 9.10289V9.31V9.32V9.52711L5.62645 9.67355L7.87645 11.9236ZM11.4177 8.38227L11.7713 8.73582L12.1248 8.38227L14.8036 5.70355C15.1288 5.37829 15.1288 4.86171 14.8036 4.53645L13.0136 2.74645C12.8186 2.55146 12.5792 2.5 12.43 2.5H12.4134L12.3967 2.50111L12.43 3C12.3967 2.50111 12.3966 2.50112 12.3965 2.50112L12.3963 2.50114L12.3957 2.50117L12.3947 2.50125L12.3924 2.50142L12.387 2.50184L12.3732 2.50311C12.3628 2.50416 12.3498 2.50567 12.3346 2.50784C12.3049 2.51208 12.2642 2.51925 12.2178 2.53146C12.1396 2.55202 11.9797 2.60317 11.8464 2.73645L9.16273 5.42016L8.80918 5.77372L9.16273 6.12727L11.4177 8.38227ZM1.5 16H15.5V17H1.5V16Z" stroke="#15141A"/>
6
- </svg>
@@ -1,4 +0,0 @@
1
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M0.0189877 13.6645L0.612989 10.4635C0.687989 10.0545 0.884989 9.6805 1.18099 9.3825L9.98199 0.5805C10.756 -0.1925 12.015 -0.1945 12.792 0.5805L14.42 2.2085C15.194 2.9835 15.194 4.2435 14.42 5.0185L5.61599 13.8215C5.31999 14.1165 4.94599 14.3125 4.53799 14.3875L1.33599 14.9815C1.26599 14.9935 1.19799 15.0005 1.12999 15.0005C0.832989 15.0005 0.544988 14.8835 0.330988 14.6695C0.0679874 14.4055 -0.0490122 14.0305 0.0189877 13.6645Z" fill="white"/>
3
- <path d="M0.0189877 13.6645L0.612989 10.4635C0.687989 10.0545 0.884989 9.6805 1.18099 9.3825L9.98199 0.5805C10.756 -0.1925 12.015 -0.1945 12.792 0.5805L14.42 2.2085C15.194 2.9835 15.194 4.2435 14.42 5.0185L5.61599 13.8215C5.31999 14.1165 4.94599 14.3125 4.53799 14.3875L1.33599 14.9815C1.26599 14.9935 1.19799 15.0005 1.12999 15.0005C0.832989 15.0005 0.544988 14.8835 0.330988 14.6695C0.0679874 14.4055 -0.0490122 14.0305 0.0189877 13.6645ZM12.472 5.1965L13.632 4.0365L13.631 3.1885L11.811 1.3675L10.963 1.3685L9.80299 2.5285L12.472 5.1965ZM4.31099 13.1585C4.47099 13.1285 4.61799 13.0515 4.73399 12.9345L11.587 6.0815L8.91899 3.4135L2.06599 10.2655C1.94899 10.3835 1.87199 10.5305 1.84099 10.6915L1.36699 13.2485L1.75199 13.6335L4.31099 13.1585Z" fill="black"/>
4
- </svg>
@@ -1,8 +0,0 @@
1
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <!-- White outline/shadow -->
3
- <path d="M2 1C1.44772 1 1 1.44772 1 2V11C1 11.5523 1.44772 12 2 12H5L8 15L11 12H14C14.5523 12 15 11.5523 15 11V2C15 1.44772 14.5523 1 14 1H2Z" fill="white" stroke="white" stroke-width="1"/>
4
- <!-- Black icon -->
5
- <path d="M2 2H14V11H10.5L8 13.5L5.5 11H2V2Z" fill="black"/>
6
- <!-- Inner detail - folded corner or lines -->
7
- <path d="M4 5H12M4 7.5H10" stroke="white" stroke-width="1" stroke-linecap="round"/>
8
- </svg>
@@ -1,8 +0,0 @@
1
- <svg width="29" height="32" viewBox="0 0 29 32" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M28 16.75C28.2761 16.75 28.5 16.5261 28.5 16.25V15C28.5 14.7239 28.2761 14.5 28 14.5H26.358C25.9117 14.5 25.4773 14.6257 25.0999 14.8604L25.0989 14.8611L24 15.5484L22.9 14.861L22.8991 14.8604C22.5218 14.6257 22.0875 14.5 21.642 14.5H20C19.7239 14.5 19.5 14.7239 19.5 15V16.25C19.5 16.5261 19.7239 16.75 20 16.75H21.642C21.6648 16.75 21.6885 16.7564 21.7101 16.7697C21.7102 16.7698 21.7104 16.7699 21.7105 16.77L22.817 17.461C22.817 17.461 22.8171 17.4611 22.8171 17.4611C22.8171 17.4611 22.8171 17.4611 22.8171 17.4611C22.8552 17.4849 22.876 17.5229 22.876 17.567V22.625V27.683C22.876 27.7271 22.8552 27.765 22.8172 27.7889C22.8171 27.7889 22.8171 27.789 22.817 27.789L21.7095 28.48C21.7094 28.4801 21.7093 28.4802 21.7092 28.4803C21.6872 28.4938 21.6644 28.5 21.641 28.5H20C19.7239 28.5 19.5 28.7239 19.5 29V30.25C19.5 30.5261 19.7239 30.75 20 30.75H21.642C22.0883 30.75 22.5227 30.6243 22.9001 30.3896L22.9009 30.3891L24 29.7026L25.1 30.39L25.1009 30.3906C25.4783 30.6253 25.9127 30.751 26.359 30.751H28C28.2761 30.751 28.5 30.5271 28.5 30.251V29.001C28.5 28.7249 28.2761 28.501 28 28.501H26.358C26.3352 28.501 26.3115 28.4946 26.2899 28.4813C26.2897 28.4812 26.2896 28.4811 26.2895 28.481L25.183 27.79C25.183 27.79 25.183 27.79 25.1829 27.79C25.1829 27.7899 25.1829 27.7899 25.1829 27.7899C25.1462 27.7669 25.125 27.7297 25.125 27.684V22.625V17.567C25.125 17.5227 25.146 17.4844 25.1836 17.4606C25.1838 17.4605 25.1839 17.4604 25.184 17.4603L26.2895 16.77C26.2896 16.7699 26.2898 16.7698 26.2899 16.7697C26.3119 16.7562 26.3346 16.75 26.358 16.75H28Z" fill="black" stroke="#FBFBFE" stroke-linejoin="round"/>
3
- <path d="M24.625 17.567C24.625 17.35 24.735 17.152 24.918 17.037L26.026 16.345C26.126 16.283 26.24 16.25 26.358 16.25H28V15H26.358C26.006 15 25.663 15.099 25.364 15.285L24.256 15.978C24.161 16.037 24.081 16.113 24 16.187C23.918 16.113 23.839 16.037 23.744 15.978L22.635 15.285C22.336 15.099 21.993 15 21.642 15H20V16.25H21.642C21.759 16.25 21.874 16.283 21.974 16.345L23.082 17.037C23.266 17.152 23.376 17.35 23.376 17.567V22.625V27.683C23.376 27.9 23.266 28.098 23.082 28.213L21.973 28.905C21.873 28.967 21.759 29 21.641 29H20V30.25H21.642C21.994 30.25 22.337 30.151 22.636 29.965L23.744 29.273C23.84 29.213 23.919 29.137 24 29.064C24.081 29.137 24.161 29.213 24.256 29.273L25.365 29.966C25.664 30.152 26.007 30.251 26.359 30.251H28V29.001H26.358C26.241 29.001 26.126 28.968 26.026 28.906L24.918 28.214C24.734 28.099 24.625 27.901 24.625 27.684V22.625V17.567Z" fill="black"/>
4
- <path fill-rule="evenodd" clip-rule="evenodd" d="M12.2 2.59C12.28 2.51 12.43 2.5 12.43 2.5C12.48 2.5 12.58 2.52 12.66 2.6L14.45 4.39C14.58 4.52 14.58 4.72 14.45 4.85L11.7713 7.52872L9.51628 5.27372L12.2 2.59ZM13.2658 4.62L11.7713 6.1145L10.9305 5.27372L12.425 3.77921L13.2658 4.62Z" fill="#FBFBFE"/>
5
- <path fill-rule="evenodd" clip-rule="evenodd" d="M5.98 8.82L8.23 11.07L10.7106 8.58938L8.45562 6.33438L5.98 8.81V8.82ZM8.23 9.65579L9.29641 8.58938L8.45562 7.74859L7.38921 8.815L8.23 9.65579Z" fill="#FBFBFE"/>
6
- <path fill-rule="evenodd" clip-rule="evenodd" d="M10.1526 12.6816L16.2125 6.6217C16.7576 6.08919 17.05 5.3707 17.05 4.62C17.05 3.86931 16.7576 3.15084 16.2126 2.61834L14.4317 0.837474C13.8992 0.29242 13.1807 0 12.43 0C11.6643 0 10.9529 0.312929 10.4329 0.832893L3.68289 7.58289C3.04127 8.22452 3.00459 9.25075 3.57288 9.93634L1.29187 12.2239C1.09186 12.4245 0.990263 12.6957 1.0007 12.9685L1 14C0.447715 14 0 14.4477 0 15V17C0 17.5523 0.447715 18 1 18H16C16.5523 18 17 17.5523 17 17V15C17 14.4477 16.5523 14 16 14H10.2325C9.83594 14 9.39953 13.4347 10.1526 12.6816ZM4.39 9.35L4.9807 9.9407L2.39762 12.5312H6.63877L7.10501 12.065L7.57125 12.5312H8.88875L15.51 5.91C15.86 5.57 16.05 5.11 16.05 4.62C16.05 4.13 15.86 3.67 15.51 3.33L13.72 1.54C13.38 1.19 12.92 1 12.43 1C11.94 1 11.48 1.2 11.14 1.54L4.39 8.29C4.1 8.58 4.1 9.06 4.39 9.35ZM16 17V15H1V17H16Z" fill="#FBFBFE"/>
7
- <path d="M15.1616 5.55136L15.1616 5.55132L15.1564 5.55645L8.40645 12.3064C8.35915 12.3537 8.29589 12.38 8.23 12.38C8.16411 12.38 8.10085 12.3537 8.05355 12.3064L7.45857 11.7115L7.10501 11.3579L6.75146 11.7115L6.03289 12.43H3.20465L5.33477 10.2937L5.6873 9.94019L5.33426 9.58715L4.74355 8.99645C4.64882 8.90171 4.64882 8.73829 4.74355 8.64355L11.4936 1.89355C11.7436 1.64354 12.0779 1.5 12.43 1.5C12.7883 1.5 13.1179 1.63776 13.3614 1.88839L13.3613 1.88843L13.3664 1.89355L15.1564 3.68355L15.1564 3.68359L15.1616 3.68864C15.4122 3.93211 15.55 4.26166 15.55 4.62C15.55 4.97834 15.4122 5.30789 15.1616 5.55136ZM5.48 8.82V9.02711L5.62645 9.17355L7.87645 11.4236L8.23 11.7771L8.58355 11.4236L11.0642 8.94293L11.4177 8.58938L11.0642 8.23582L8.80918 5.98082L8.45562 5.62727L8.10207 5.98082L5.62645 8.45645L5.48 8.60289V8.81V8.82ZM11.4177 7.88227L11.7713 8.23582L12.1248 7.88227L14.8036 5.20355C15.1288 4.87829 15.1288 4.36171 14.8036 4.03645L13.0136 2.24645C12.8186 2.05146 12.5792 2 12.43 2H12.4134L12.3967 2.00111L12.43 2.5C12.3967 2.00111 12.3966 2.00112 12.3965 2.00112L12.3963 2.00114L12.3957 2.00117L12.3947 2.00125L12.3924 2.00142L12.387 2.00184L12.3732 2.00311C12.3628 2.00416 12.3498 2.00567 12.3346 2.00784C12.3049 2.01208 12.2642 2.01925 12.2178 2.03146C12.1396 2.05202 11.9797 2.10317 11.8464 2.23645L9.16273 4.92016L8.80918 5.27372L9.16273 5.62727L11.4177 7.88227ZM1.5 16.5V15.5H15.5V16.5H1.5Z" stroke="#15141A"/>
8
- </svg>