@edgepdf/viewer-js 0.0.14 → 0.0.17
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/dist/cdn-manager.d.ts +8 -0
- package/dist/cdn-manager.d.ts.map +1 -0
- package/dist/cdn-manager.js +197 -0
- package/package.json +7 -1
- package/dist/images/layers-2x.png +0 -0
- package/dist/images/layers.png +0 -0
- package/dist/images/marker-icon-2x.png +0 -0
- package/dist/images/marker-icon.png +0 -0
- package/dist/images/marker-shadow.png +0 -0
- package/dist/images/pin-gray-selected.png +0 -0
- package/dist/images/pin-gray.png +0 -0
- package/dist/images/pin-yellow-selected.png +0 -0
- package/dist/images/pin-yellow.png +0 -0
- package/dist/images/pin.png +0 -0
- package/dist/index.css +0 -929
- package/dist/index.js +0 -25303
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSR-safe entry point for CDNManager
|
|
3
|
+
*
|
|
4
|
+
* This file exports only CDNManager without any Leaflet dependencies,
|
|
5
|
+
* making it safe to use in Next.js server-side rendering.
|
|
6
|
+
*/
|
|
7
|
+
export { CDNManager } from './lib/cdn-manager.js';
|
|
8
|
+
//# sourceMappingURL=cdn-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cdn-manager.d.ts","sourceRoot":"","sources":["../src/cdn-manager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// packages/utils/dist/index.js
|
|
2
|
+
function getOriginPreviewPath(documentId) {
|
|
3
|
+
return `processed/${documentId}/preview/preview.webp`;
|
|
4
|
+
}
|
|
5
|
+
function getOriginPreviewThumbnailPath(documentId) {
|
|
6
|
+
return `processed/${documentId}/preview/thumbnail.webp`;
|
|
7
|
+
}
|
|
8
|
+
function getAnnotatedPreviewPath(documentId) {
|
|
9
|
+
return `processed/${documentId}/annotated/preview/preview.webp`;
|
|
10
|
+
}
|
|
11
|
+
function getAnnotatedThumbnailPath(documentId) {
|
|
12
|
+
return `processed/${documentId}/annotated/preview/thumbnail.webp`;
|
|
13
|
+
}
|
|
14
|
+
function isValidTileUrl(template) {
|
|
15
|
+
return template.includes("{z}") && template.includes("{x}") && template.includes("{y}");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// packages/viewer-js/src/lib/cdn-manager.ts
|
|
19
|
+
var CDNManager = class {
|
|
20
|
+
baseUrl;
|
|
21
|
+
/**
|
|
22
|
+
* Create a new CDN Manager instance
|
|
23
|
+
*
|
|
24
|
+
* @param baseUrl - Base CDN URL (e.g., 'https://cdn.example.com')
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const cdn = new CDNManager('https://cdn.example.com');
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
constructor(baseUrl) {
|
|
32
|
+
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Get the base CDN URL
|
|
36
|
+
*
|
|
37
|
+
* @returns The base URL configured for this manager
|
|
38
|
+
*/
|
|
39
|
+
getBaseUrl() {
|
|
40
|
+
return this.baseUrl;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Build a full CDN URL from a path
|
|
44
|
+
*
|
|
45
|
+
* @param path - Path to append to base URL (with or without leading slash)
|
|
46
|
+
* @returns Complete CDN URL
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const cdn = new CDNManager('https://cdn.example.com');
|
|
51
|
+
* cdn.buildUrl('processed/doc123/preview.webp');
|
|
52
|
+
* // 'https://cdn.example.com/processed/doc123/preview.webp'
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
buildUrl(path) {
|
|
56
|
+
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
57
|
+
return `${this.baseUrl}${normalizedPath}`;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get the origin preview path for a document
|
|
61
|
+
*
|
|
62
|
+
* @param documentId - Document ID
|
|
63
|
+
* @returns S3 path for origin preview
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* cdn.getOriginPreviewPath('doc123');
|
|
68
|
+
* // 'processed/doc123/preview/preview.webp'
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
getOriginPreviewPath(documentId) {
|
|
72
|
+
return getOriginPreviewPath(documentId);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get the full CDN URL for origin preview
|
|
76
|
+
*
|
|
77
|
+
* @param documentId - Document ID
|
|
78
|
+
* @returns Complete CDN URL for origin preview
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* cdn.getOriginPreviewUrl('doc123');
|
|
83
|
+
* // 'https://cdn.example.com/processed/doc123/preview/preview.webp'
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
getOriginPreviewUrl(documentId) {
|
|
87
|
+
return this.buildUrl(getOriginPreviewPath(documentId));
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Get the origin preview thumbnail path for a document
|
|
91
|
+
*
|
|
92
|
+
* @param documentId - Document ID
|
|
93
|
+
* @returns S3 path for origin preview thumbnail
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* cdn.getOriginPreviewThumbnailPath('doc123');
|
|
98
|
+
* // 'processed/doc123/preview/thumbnail.webp'
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
getOriginPreviewThumbnailPath(documentId) {
|
|
102
|
+
return getOriginPreviewThumbnailPath(documentId);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Get the full CDN URL for origin preview thumbnail
|
|
106
|
+
*
|
|
107
|
+
* @param documentId - Document ID
|
|
108
|
+
* @returns Complete CDN URL for origin preview thumbnail
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* cdn.getOriginPreviewThumbnailUrl('doc123');
|
|
113
|
+
* // 'https://cdn.example.com/processed/doc123/preview/thumbnail.webp'
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
getOriginPreviewThumbnailUrl(documentId) {
|
|
117
|
+
return this.buildUrl(getOriginPreviewThumbnailPath(documentId));
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Get the annotated preview path for a document
|
|
121
|
+
*
|
|
122
|
+
* @param documentId - Document ID
|
|
123
|
+
* @returns S3 path for annotated preview
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* cdn.getAnnotatedPreviewPath('doc123');
|
|
128
|
+
* // 'processed/doc123/annotated/preview/preview.webp'
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
getAnnotatedPreviewPath(documentId) {
|
|
132
|
+
return getAnnotatedPreviewPath(documentId);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Get the full CDN URL for annotated preview
|
|
136
|
+
*
|
|
137
|
+
* @param documentId - Document ID
|
|
138
|
+
* @returns Complete CDN URL for annotated preview
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* cdn.getAnnotatedPreviewUrl('doc123');
|
|
143
|
+
* // 'https://cdn.example.com/processed/doc123/annotated/preview/preview.webp'
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
getAnnotatedPreviewUrl(documentId) {
|
|
147
|
+
return this.buildUrl(getAnnotatedPreviewPath(documentId));
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Get the annotated thumbnail path for a document
|
|
151
|
+
*
|
|
152
|
+
* @param documentId - Document ID
|
|
153
|
+
* @returns S3 path for annotated thumbnail
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* cdn.getAnnotatedThumbnailPath('doc123');
|
|
158
|
+
* // 'processed/doc123/annotated/preview/thumbnail.webp'
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
getAnnotatedThumbnailPath(documentId) {
|
|
162
|
+
return getAnnotatedThumbnailPath(documentId);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Get the full CDN URL for annotated thumbnail
|
|
166
|
+
*
|
|
167
|
+
* @param documentId - Document ID
|
|
168
|
+
* @returns Complete CDN URL for annotated thumbnail
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```typescript
|
|
172
|
+
* cdn.getAnnotatedThumbnailUrl('doc123');
|
|
173
|
+
* // 'https://cdn.example.com/processed/doc123/annotated/preview/thumbnail.webp'
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
getAnnotatedThumbnailUrl(documentId) {
|
|
177
|
+
return this.buildUrl(getAnnotatedThumbnailPath(documentId));
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Validate tile URL template
|
|
181
|
+
*
|
|
182
|
+
* @param template - URL template to validate
|
|
183
|
+
* @returns True if template contains required placeholders
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```typescript
|
|
187
|
+
* cdn.isValidTileUrl('/tiles/{z}/{x}/{y}.png'); // true
|
|
188
|
+
* cdn.isValidTileUrl('/tiles/z/x/y.png'); // false
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
isValidTileUrl(template) {
|
|
192
|
+
return isValidTileUrl(template);
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
export {
|
|
196
|
+
CDNManager
|
|
197
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edgepdf/viewer-js",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"description": "EdgePDF Viewer - JavaScript library for viewing PDF documents with interactive markers and zoom controls",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -30,6 +30,12 @@
|
|
|
30
30
|
"types": "./dist/index.d.ts",
|
|
31
31
|
"import": "./dist/index.js",
|
|
32
32
|
"default": "./dist/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./cdn-manager": {
|
|
35
|
+
"@edge-pdf/workspace": "./src/cdn-manager.ts",
|
|
36
|
+
"types": "./dist/cdn-manager.d.ts",
|
|
37
|
+
"import": "./dist/cdn-manager.js",
|
|
38
|
+
"default": "./dist/cdn-manager.js"
|
|
33
39
|
}
|
|
34
40
|
},
|
|
35
41
|
"files": [
|
|
Binary file
|
package/dist/images/layers.png
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/images/pin-gray.png
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/images/pin.png
DELETED
|
Binary file
|