@edgepdf/viewer-react 0.0.9 → 0.0.11
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 +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +194 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,5 +10,6 @@ export { useMarkers } from './lib/use-markers.js';
|
|
|
10
10
|
export type { UseMarkersReturn } from './lib/use-markers.js';
|
|
11
11
|
export { useZoom } from './lib/use-zoom.js';
|
|
12
12
|
export type { UseZoomReturn } from './lib/use-zoom.js';
|
|
13
|
+
export { CDNManager } from '@edgepdf/viewer-js';
|
|
13
14
|
export type { ImageInfo, TileConfig, ViewerConfig, LeafletCoords, ImageCoords, Marker, MarkerData, MapOptions, ZoomConfig, ZoomState, CoordinateBounds, MarkerEventType, MarkerEvent, MarkerEditHandler, MarkerDeleteHandler, MarkerInteractionConfig, MarkerSelectionState, } from '@edgepdf/types';
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,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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,SAAS,EACT,UAAU,EACV,YAAY,EACZ,aAAa,EACb,WAAW,EACX,MAAM,EACN,UAAU,EACV,UAAU,EACV,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9622,6 +9622,18 @@ function calculateTileGrid(width, height, tileSize, zoom) {
|
|
|
9622
9622
|
tileY: calculateTileCount(height, tileSize, zoom)
|
|
9623
9623
|
};
|
|
9624
9624
|
}
|
|
9625
|
+
function getOriginPreviewPath(documentId) {
|
|
9626
|
+
return `processed/${documentId}/preview/preview.webp`;
|
|
9627
|
+
}
|
|
9628
|
+
function getOriginPreviewThumbnailPath(documentId) {
|
|
9629
|
+
return `processed/${documentId}/preview/thumbnail.webp`;
|
|
9630
|
+
}
|
|
9631
|
+
function getAnnotatedPreviewPath(documentId) {
|
|
9632
|
+
return `processed/${documentId}/annotated/preview/preview.webp`;
|
|
9633
|
+
}
|
|
9634
|
+
function getAnnotatedThumbnailPath(documentId) {
|
|
9635
|
+
return `processed/${documentId}/annotated/preview/thumbnail.webp`;
|
|
9636
|
+
}
|
|
9625
9637
|
function generateTileUrl(template, z, x, y) {
|
|
9626
9638
|
return template.replace("{z}", String(z)).replace("{x}", String(x)).replace("{y}", String(y));
|
|
9627
9639
|
}
|
|
@@ -23314,7 +23326,8 @@ var MarkerManager = class {
|
|
|
23314
23326
|
href: options.href,
|
|
23315
23327
|
target: options.target,
|
|
23316
23328
|
showLabel: options.showLabel ?? true,
|
|
23317
|
-
iconType: options.iconType || "pin"
|
|
23329
|
+
iconType: options.iconType || "pin",
|
|
23330
|
+
referenceId: options.referenceId
|
|
23318
23331
|
};
|
|
23319
23332
|
this.validateMarker(marker);
|
|
23320
23333
|
const leafletMarker = this.createLeafletMarker(marker);
|
|
@@ -23425,8 +23438,10 @@ var MarkerManager = class {
|
|
|
23425
23438
|
href: markerData.href,
|
|
23426
23439
|
target: markerData.target,
|
|
23427
23440
|
showLabel: markerData.showLabel,
|
|
23428
|
-
iconType: markerData.iconType
|
|
23441
|
+
iconType: markerData.iconType,
|
|
23429
23442
|
// Preserve iconType from imported data
|
|
23443
|
+
referenceId: markerData.referenceId
|
|
23444
|
+
// Preserve referenceId from imported data
|
|
23430
23445
|
});
|
|
23431
23446
|
importedCount++;
|
|
23432
23447
|
} catch (error46) {
|
|
@@ -24943,6 +24958,182 @@ var EdgePdfViewer = class {
|
|
|
24943
24958
|
}
|
|
24944
24959
|
}
|
|
24945
24960
|
};
|
|
24961
|
+
var CDNManager = class {
|
|
24962
|
+
baseUrl;
|
|
24963
|
+
/**
|
|
24964
|
+
* Create a new CDN Manager instance
|
|
24965
|
+
*
|
|
24966
|
+
* @param baseUrl - Base CDN URL (e.g., 'https://cdn.example.com')
|
|
24967
|
+
*
|
|
24968
|
+
* @example
|
|
24969
|
+
* ```typescript
|
|
24970
|
+
* const cdn = new CDNManager('https://cdn.example.com');
|
|
24971
|
+
* ```
|
|
24972
|
+
*/
|
|
24973
|
+
constructor(baseUrl) {
|
|
24974
|
+
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
24975
|
+
}
|
|
24976
|
+
/**
|
|
24977
|
+
* Get the base CDN URL
|
|
24978
|
+
*
|
|
24979
|
+
* @returns The base URL configured for this manager
|
|
24980
|
+
*/
|
|
24981
|
+
getBaseUrl() {
|
|
24982
|
+
return this.baseUrl;
|
|
24983
|
+
}
|
|
24984
|
+
/**
|
|
24985
|
+
* Build a full CDN URL from a path
|
|
24986
|
+
*
|
|
24987
|
+
* @param path - Path to append to base URL (with or without leading slash)
|
|
24988
|
+
* @returns Complete CDN URL
|
|
24989
|
+
*
|
|
24990
|
+
* @example
|
|
24991
|
+
* ```typescript
|
|
24992
|
+
* const cdn = new CDNManager('https://cdn.example.com');
|
|
24993
|
+
* cdn.buildUrl('processed/doc123/preview.webp');
|
|
24994
|
+
* // 'https://cdn.example.com/processed/doc123/preview.webp'
|
|
24995
|
+
* ```
|
|
24996
|
+
*/
|
|
24997
|
+
buildUrl(path) {
|
|
24998
|
+
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
24999
|
+
return `${this.baseUrl}${normalizedPath}`;
|
|
25000
|
+
}
|
|
25001
|
+
/**
|
|
25002
|
+
* Get the origin preview path for a document
|
|
25003
|
+
*
|
|
25004
|
+
* @param documentId - Document ID
|
|
25005
|
+
* @returns S3 path for origin preview
|
|
25006
|
+
*
|
|
25007
|
+
* @example
|
|
25008
|
+
* ```typescript
|
|
25009
|
+
* cdn.getOriginPreviewPath('doc123');
|
|
25010
|
+
* // 'processed/doc123/preview/preview.webp'
|
|
25011
|
+
* ```
|
|
25012
|
+
*/
|
|
25013
|
+
getOriginPreviewPath(documentId) {
|
|
25014
|
+
return getOriginPreviewPath(documentId);
|
|
25015
|
+
}
|
|
25016
|
+
/**
|
|
25017
|
+
* Get the full CDN URL for origin preview
|
|
25018
|
+
*
|
|
25019
|
+
* @param documentId - Document ID
|
|
25020
|
+
* @returns Complete CDN URL for origin preview
|
|
25021
|
+
*
|
|
25022
|
+
* @example
|
|
25023
|
+
* ```typescript
|
|
25024
|
+
* cdn.getOriginPreviewUrl('doc123');
|
|
25025
|
+
* // 'https://cdn.example.com/processed/doc123/preview/preview.webp'
|
|
25026
|
+
* ```
|
|
25027
|
+
*/
|
|
25028
|
+
getOriginPreviewUrl(documentId) {
|
|
25029
|
+
return this.buildUrl(getOriginPreviewPath(documentId));
|
|
25030
|
+
}
|
|
25031
|
+
/**
|
|
25032
|
+
* Get the origin preview thumbnail path for a document
|
|
25033
|
+
*
|
|
25034
|
+
* @param documentId - Document ID
|
|
25035
|
+
* @returns S3 path for origin preview thumbnail
|
|
25036
|
+
*
|
|
25037
|
+
* @example
|
|
25038
|
+
* ```typescript
|
|
25039
|
+
* cdn.getOriginPreviewThumbnailPath('doc123');
|
|
25040
|
+
* // 'processed/doc123/preview/thumbnail.webp'
|
|
25041
|
+
* ```
|
|
25042
|
+
*/
|
|
25043
|
+
getOriginPreviewThumbnailPath(documentId) {
|
|
25044
|
+
return getOriginPreviewThumbnailPath(documentId);
|
|
25045
|
+
}
|
|
25046
|
+
/**
|
|
25047
|
+
* Get the full CDN URL for origin preview thumbnail
|
|
25048
|
+
*
|
|
25049
|
+
* @param documentId - Document ID
|
|
25050
|
+
* @returns Complete CDN URL for origin preview thumbnail
|
|
25051
|
+
*
|
|
25052
|
+
* @example
|
|
25053
|
+
* ```typescript
|
|
25054
|
+
* cdn.getOriginPreviewThumbnailUrl('doc123');
|
|
25055
|
+
* // 'https://cdn.example.com/processed/doc123/preview/thumbnail.webp'
|
|
25056
|
+
* ```
|
|
25057
|
+
*/
|
|
25058
|
+
getOriginPreviewThumbnailUrl(documentId) {
|
|
25059
|
+
return this.buildUrl(getOriginPreviewThumbnailPath(documentId));
|
|
25060
|
+
}
|
|
25061
|
+
/**
|
|
25062
|
+
* Get the annotated preview path for a document
|
|
25063
|
+
*
|
|
25064
|
+
* @param documentId - Document ID
|
|
25065
|
+
* @returns S3 path for annotated preview
|
|
25066
|
+
*
|
|
25067
|
+
* @example
|
|
25068
|
+
* ```typescript
|
|
25069
|
+
* cdn.getAnnotatedPreviewPath('doc123');
|
|
25070
|
+
* // 'processed/doc123/annotated/preview/preview.webp'
|
|
25071
|
+
* ```
|
|
25072
|
+
*/
|
|
25073
|
+
getAnnotatedPreviewPath(documentId) {
|
|
25074
|
+
return getAnnotatedPreviewPath(documentId);
|
|
25075
|
+
}
|
|
25076
|
+
/**
|
|
25077
|
+
* Get the full CDN URL for annotated preview
|
|
25078
|
+
*
|
|
25079
|
+
* @param documentId - Document ID
|
|
25080
|
+
* @returns Complete CDN URL for annotated preview
|
|
25081
|
+
*
|
|
25082
|
+
* @example
|
|
25083
|
+
* ```typescript
|
|
25084
|
+
* cdn.getAnnotatedPreviewUrl('doc123');
|
|
25085
|
+
* // 'https://cdn.example.com/processed/doc123/annotated/preview/preview.webp'
|
|
25086
|
+
* ```
|
|
25087
|
+
*/
|
|
25088
|
+
getAnnotatedPreviewUrl(documentId) {
|
|
25089
|
+
return this.buildUrl(getAnnotatedPreviewPath(documentId));
|
|
25090
|
+
}
|
|
25091
|
+
/**
|
|
25092
|
+
* Get the annotated thumbnail path for a document
|
|
25093
|
+
*
|
|
25094
|
+
* @param documentId - Document ID
|
|
25095
|
+
* @returns S3 path for annotated thumbnail
|
|
25096
|
+
*
|
|
25097
|
+
* @example
|
|
25098
|
+
* ```typescript
|
|
25099
|
+
* cdn.getAnnotatedThumbnailPath('doc123');
|
|
25100
|
+
* // 'processed/doc123/annotated/preview/thumbnail.webp'
|
|
25101
|
+
* ```
|
|
25102
|
+
*/
|
|
25103
|
+
getAnnotatedThumbnailPath(documentId) {
|
|
25104
|
+
return getAnnotatedThumbnailPath(documentId);
|
|
25105
|
+
}
|
|
25106
|
+
/**
|
|
25107
|
+
* Get the full CDN URL for annotated thumbnail
|
|
25108
|
+
*
|
|
25109
|
+
* @param documentId - Document ID
|
|
25110
|
+
* @returns Complete CDN URL for annotated thumbnail
|
|
25111
|
+
*
|
|
25112
|
+
* @example
|
|
25113
|
+
* ```typescript
|
|
25114
|
+
* cdn.getAnnotatedThumbnailUrl('doc123');
|
|
25115
|
+
* // 'https://cdn.example.com/processed/doc123/annotated/preview/thumbnail.webp'
|
|
25116
|
+
* ```
|
|
25117
|
+
*/
|
|
25118
|
+
getAnnotatedThumbnailUrl(documentId) {
|
|
25119
|
+
return this.buildUrl(getAnnotatedThumbnailPath(documentId));
|
|
25120
|
+
}
|
|
25121
|
+
/**
|
|
25122
|
+
* Validate tile URL template
|
|
25123
|
+
*
|
|
25124
|
+
* @param template - URL template to validate
|
|
25125
|
+
* @returns True if template contains required placeholders
|
|
25126
|
+
*
|
|
25127
|
+
* @example
|
|
25128
|
+
* ```typescript
|
|
25129
|
+
* cdn.isValidTileUrl('/tiles/{z}/{x}/{y}.png'); // true
|
|
25130
|
+
* cdn.isValidTileUrl('/tiles/z/x/y.png'); // false
|
|
25131
|
+
* ```
|
|
25132
|
+
*/
|
|
25133
|
+
isValidTileUrl(template) {
|
|
25134
|
+
return isValidTileUrl(template);
|
|
25135
|
+
}
|
|
25136
|
+
};
|
|
24946
25137
|
|
|
24947
25138
|
// packages/viewer-react/src/lib/viewer-context.tsx
|
|
24948
25139
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -25626,6 +25817,7 @@ function useZoom() {
|
|
|
25626
25817
|
};
|
|
25627
25818
|
}
|
|
25628
25819
|
export {
|
|
25820
|
+
CDNManager,
|
|
25629
25821
|
EdgePDFViewer,
|
|
25630
25822
|
ViewerProvider,
|
|
25631
25823
|
ZoomControls,
|
package/package.json
CHANGED