@edgepdf/viewer-react 0.0.13 → 0.0.14

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/index.d.ts CHANGED
@@ -11,4 +11,5 @@ export { useMarkers } from './lib/use-markers.js';
11
11
  export type { UseMarkersReturn } from './lib/use-markers.js';
12
12
  export { useZoom } from './lib/use-zoom.js';
13
13
  export type { UseZoomReturn } from './lib/use-zoom.js';
14
+ export { CDNManager } from '@edgepdf/viewer-js';
14
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG9D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,YAAY,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,YAAY,EACV,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG9D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,YAAY,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,YAAY,EACV,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -12739,6 +12739,18 @@ function calculateTileGrid(width, height, tileSize, zoom) {
12739
12739
  tileY: calculateTileCount(height, tileSize, zoom)
12740
12740
  };
12741
12741
  }
12742
+ function getOriginPreviewPath(documentId) {
12743
+ return `processed/${documentId}/preview/preview.webp`;
12744
+ }
12745
+ function getOriginPreviewThumbnailPath(documentId) {
12746
+ return `processed/${documentId}/preview/thumbnail.webp`;
12747
+ }
12748
+ function getAnnotatedPreviewPath(documentId) {
12749
+ return `processed/${documentId}/annotated/preview/preview.webp`;
12750
+ }
12751
+ function getAnnotatedThumbnailPath(documentId) {
12752
+ return `processed/${documentId}/annotated/preview/thumbnail.webp`;
12753
+ }
12742
12754
  function generateTileUrl(template, z, x, y) {
12743
12755
  return template.replace("{z}", String(z)).replace("{x}", String(x)).replace("{y}", String(y));
12744
12756
  }
@@ -28070,6 +28082,182 @@ var EdgePdfViewer = class {
28070
28082
  }
28071
28083
  }
28072
28084
  };
28085
+ var CDNManager = class {
28086
+ baseUrl;
28087
+ /**
28088
+ * Create a new CDN Manager instance
28089
+ *
28090
+ * @param baseUrl - Base CDN URL (e.g., 'https://cdn.example.com')
28091
+ *
28092
+ * @example
28093
+ * ```typescript
28094
+ * const cdn = new CDNManager('https://cdn.example.com');
28095
+ * ```
28096
+ */
28097
+ constructor(baseUrl) {
28098
+ this.baseUrl = baseUrl.replace(/\/$/, "");
28099
+ }
28100
+ /**
28101
+ * Get the base CDN URL
28102
+ *
28103
+ * @returns The base URL configured for this manager
28104
+ */
28105
+ getBaseUrl() {
28106
+ return this.baseUrl;
28107
+ }
28108
+ /**
28109
+ * Build a full CDN URL from a path
28110
+ *
28111
+ * @param path - Path to append to base URL (with or without leading slash)
28112
+ * @returns Complete CDN URL
28113
+ *
28114
+ * @example
28115
+ * ```typescript
28116
+ * const cdn = new CDNManager('https://cdn.example.com');
28117
+ * cdn.buildUrl('processed/doc123/preview.webp');
28118
+ * // 'https://cdn.example.com/processed/doc123/preview.webp'
28119
+ * ```
28120
+ */
28121
+ buildUrl(path) {
28122
+ const normalizedPath = path.startsWith("/") ? path : `/${path}`;
28123
+ return `${this.baseUrl}${normalizedPath}`;
28124
+ }
28125
+ /**
28126
+ * Get the origin preview path for a document
28127
+ *
28128
+ * @param documentId - Document ID
28129
+ * @returns S3 path for origin preview
28130
+ *
28131
+ * @example
28132
+ * ```typescript
28133
+ * cdn.getOriginPreviewPath('doc123');
28134
+ * // 'processed/doc123/preview/preview.webp'
28135
+ * ```
28136
+ */
28137
+ getOriginPreviewPath(documentId) {
28138
+ return getOriginPreviewPath(documentId);
28139
+ }
28140
+ /**
28141
+ * Get the full CDN URL for origin preview
28142
+ *
28143
+ * @param documentId - Document ID
28144
+ * @returns Complete CDN URL for origin preview
28145
+ *
28146
+ * @example
28147
+ * ```typescript
28148
+ * cdn.getOriginPreviewUrl('doc123');
28149
+ * // 'https://cdn.example.com/processed/doc123/preview/preview.webp'
28150
+ * ```
28151
+ */
28152
+ getOriginPreviewUrl(documentId) {
28153
+ return this.buildUrl(getOriginPreviewPath(documentId));
28154
+ }
28155
+ /**
28156
+ * Get the origin preview thumbnail path for a document
28157
+ *
28158
+ * @param documentId - Document ID
28159
+ * @returns S3 path for origin preview thumbnail
28160
+ *
28161
+ * @example
28162
+ * ```typescript
28163
+ * cdn.getOriginPreviewThumbnailPath('doc123');
28164
+ * // 'processed/doc123/preview/thumbnail.webp'
28165
+ * ```
28166
+ */
28167
+ getOriginPreviewThumbnailPath(documentId) {
28168
+ return getOriginPreviewThumbnailPath(documentId);
28169
+ }
28170
+ /**
28171
+ * Get the full CDN URL for origin preview thumbnail
28172
+ *
28173
+ * @param documentId - Document ID
28174
+ * @returns Complete CDN URL for origin preview thumbnail
28175
+ *
28176
+ * @example
28177
+ * ```typescript
28178
+ * cdn.getOriginPreviewThumbnailUrl('doc123');
28179
+ * // 'https://cdn.example.com/processed/doc123/preview/thumbnail.webp'
28180
+ * ```
28181
+ */
28182
+ getOriginPreviewThumbnailUrl(documentId) {
28183
+ return this.buildUrl(getOriginPreviewThumbnailPath(documentId));
28184
+ }
28185
+ /**
28186
+ * Get the annotated preview path for a document
28187
+ *
28188
+ * @param documentId - Document ID
28189
+ * @returns S3 path for annotated preview
28190
+ *
28191
+ * @example
28192
+ * ```typescript
28193
+ * cdn.getAnnotatedPreviewPath('doc123');
28194
+ * // 'processed/doc123/annotated/preview/preview.webp'
28195
+ * ```
28196
+ */
28197
+ getAnnotatedPreviewPath(documentId) {
28198
+ return getAnnotatedPreviewPath(documentId);
28199
+ }
28200
+ /**
28201
+ * Get the full CDN URL for annotated preview
28202
+ *
28203
+ * @param documentId - Document ID
28204
+ * @returns Complete CDN URL for annotated preview
28205
+ *
28206
+ * @example
28207
+ * ```typescript
28208
+ * cdn.getAnnotatedPreviewUrl('doc123');
28209
+ * // 'https://cdn.example.com/processed/doc123/annotated/preview/preview.webp'
28210
+ * ```
28211
+ */
28212
+ getAnnotatedPreviewUrl(documentId) {
28213
+ return this.buildUrl(getAnnotatedPreviewPath(documentId));
28214
+ }
28215
+ /**
28216
+ * Get the annotated thumbnail path for a document
28217
+ *
28218
+ * @param documentId - Document ID
28219
+ * @returns S3 path for annotated thumbnail
28220
+ *
28221
+ * @example
28222
+ * ```typescript
28223
+ * cdn.getAnnotatedThumbnailPath('doc123');
28224
+ * // 'processed/doc123/annotated/preview/thumbnail.webp'
28225
+ * ```
28226
+ */
28227
+ getAnnotatedThumbnailPath(documentId) {
28228
+ return getAnnotatedThumbnailPath(documentId);
28229
+ }
28230
+ /**
28231
+ * Get the full CDN URL for annotated thumbnail
28232
+ *
28233
+ * @param documentId - Document ID
28234
+ * @returns Complete CDN URL for annotated thumbnail
28235
+ *
28236
+ * @example
28237
+ * ```typescript
28238
+ * cdn.getAnnotatedThumbnailUrl('doc123');
28239
+ * // 'https://cdn.example.com/processed/doc123/annotated/preview/thumbnail.webp'
28240
+ * ```
28241
+ */
28242
+ getAnnotatedThumbnailUrl(documentId) {
28243
+ return this.buildUrl(getAnnotatedThumbnailPath(documentId));
28244
+ }
28245
+ /**
28246
+ * Validate tile URL template
28247
+ *
28248
+ * @param template - URL template to validate
28249
+ * @returns True if template contains required placeholders
28250
+ *
28251
+ * @example
28252
+ * ```typescript
28253
+ * cdn.isValidTileUrl('/tiles/{z}/{x}/{y}.png'); // true
28254
+ * cdn.isValidTileUrl('/tiles/z/x/y.png'); // false
28255
+ * ```
28256
+ */
28257
+ isValidTileUrl(template) {
28258
+ return isValidTileUrl(template);
28259
+ }
28260
+ };
28073
28261
 
28074
28262
  // packages/viewer-react/src/lib/viewer-context.tsx
28075
28263
  var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
@@ -28753,6 +28941,7 @@ function useZoom() {
28753
28941
  };
28754
28942
  }
28755
28943
  export {
28944
+ CDNManager,
28756
28945
  EdgePDFViewer,
28757
28946
  ViewerProvider,
28758
28947
  ZoomControls,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgepdf/viewer-react",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "EdgePDF Viewer - React components for viewing PDF documents with interactive markers and zoom controls",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",