@cloudpdf/engine 3.0.0-next.13 → 3.0.0-next.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.cjs +50 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +51 -2
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -794,7 +794,8 @@ function queryIdentity(query) {
|
|
|
794
794
|
query.text,
|
|
795
795
|
query.matchCase ? 1 : 0,
|
|
796
796
|
query.matchDiacritics ? 1 : 0,
|
|
797
|
-
query.wholeWord ? 1 : 0
|
|
797
|
+
query.wholeWord ? 1 : 0,
|
|
798
|
+
query.ignoreWhitespace ? 1 : 0
|
|
798
799
|
]);
|
|
799
800
|
}
|
|
800
801
|
//#endregion
|
|
@@ -1615,6 +1616,41 @@ var CloudPageTextService = class {
|
|
|
1615
1616
|
}
|
|
1616
1617
|
};
|
|
1617
1618
|
//#endregion
|
|
1619
|
+
//#region src/document/CloudPageMeasureService.ts
|
|
1620
|
+
var CloudPageMeasureService = class {
|
|
1621
|
+
constructor(http, docId, layerName, pon, isClosed, manifest, publisher) {
|
|
1622
|
+
this.http = http;
|
|
1623
|
+
this.docId = docId;
|
|
1624
|
+
this.layerName = layerName;
|
|
1625
|
+
this.pon = pon;
|
|
1626
|
+
this.isClosed = isClosed;
|
|
1627
|
+
this.manifest = manifest;
|
|
1628
|
+
this.publisher = publisher;
|
|
1629
|
+
}
|
|
1630
|
+
viewports() {
|
|
1631
|
+
return _embedpdf_engine_core_runtime.AbortablePromise.run(async (signal) => {
|
|
1632
|
+
this.check();
|
|
1633
|
+
return this.http.getJson(_embedpdf_engine_core_wire.wirePaths.layerPageViewports(this.docId, this.layerName, this.pon), (raw) => _embedpdf_engine_core_wire.PageMeasurementViewportSchema.array().parse(raw), signal);
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
1636
|
+
setScale(measure) {
|
|
1637
|
+
return _embedpdf_engine_core_runtime.AbortablePromise.run(async (signal) => {
|
|
1638
|
+
await Promise.resolve();
|
|
1639
|
+
signal.throwIfAborted();
|
|
1640
|
+
this.check();
|
|
1641
|
+
const result = await this.http.putJson(_embedpdf_engine_core_wire.wirePaths.layerPageScale(this.docId, this.layerName, this.pon), { measure }, (raw) => _embedpdf_engine_core_wire.PageScaleResultSchema.parse(raw), signal);
|
|
1642
|
+
this.manifest.apply(result.meta, []);
|
|
1643
|
+
this.publisher.publishLocal({
|
|
1644
|
+
type: "page.viewportsChanged",
|
|
1645
|
+
...result
|
|
1646
|
+
});
|
|
1647
|
+
});
|
|
1648
|
+
}
|
|
1649
|
+
check() {
|
|
1650
|
+
if (this.isClosed()) throw new _embedpdf_engine_core_runtime.EngineError(_embedpdf_engine_core_runtime.EngineErrorCode.DocNotOpen, `Document not open: ${this.docId}`);
|
|
1651
|
+
}
|
|
1652
|
+
};
|
|
1653
|
+
//#endregion
|
|
1618
1654
|
//#region src/document/CloudPageHandle.ts
|
|
1619
1655
|
var CloudPageHandle = class {
|
|
1620
1656
|
constructor(pageObjectNumber, pageIndex, http, docId, layerName, isClosed, manifest, publisher) {
|
|
@@ -1624,6 +1660,8 @@ var CloudPageHandle = class {
|
|
|
1624
1660
|
_defineProperty(this, "text", void 0);
|
|
1625
1661
|
_defineProperty(this, "geometry", void 0);
|
|
1626
1662
|
_defineProperty(this, "render", void 0);
|
|
1663
|
+
_defineProperty(this, "measure", void 0);
|
|
1664
|
+
this.measure = new CloudPageMeasureService(http, docId, layerName, pageObjectNumber, isClosed, manifest, publisher);
|
|
1627
1665
|
this.annotations = new CloudPageAnnotationsService(http, docId, layerName, pageObjectNumber, isClosed, manifest, publisher);
|
|
1628
1666
|
this.text = new CloudPageTextService(http, docId, layerName, pageObjectNumber, isClosed, manifest);
|
|
1629
1667
|
this.geometry = new CloudPageGeometryService(http, docId, layerName, pageObjectNumber, isClosed, manifest);
|
|
@@ -1656,6 +1694,11 @@ function auditRowToEvent(row, mySessionId) {
|
|
|
1656
1694
|
serverId: row.id
|
|
1657
1695
|
};
|
|
1658
1696
|
switch (row.kind) {
|
|
1697
|
+
case "measure.setScale": return {
|
|
1698
|
+
type: "page.viewportsChanged",
|
|
1699
|
+
origin,
|
|
1700
|
+
...row.payload
|
|
1701
|
+
};
|
|
1659
1702
|
case "annot.create": return {
|
|
1660
1703
|
type: "annotation.created",
|
|
1661
1704
|
pageObjectNumber: row.pageObjectNumber ?? row.affectedPages[0] ?? 0,
|
|
@@ -2275,6 +2318,9 @@ var CloudDocumentHandle = class {
|
|
|
2275
2318
|
* whose hand caused the change. */
|
|
2276
2319
|
absorbRemoteEvent(event) {
|
|
2277
2320
|
switch (event.type) {
|
|
2321
|
+
case "page.viewportsChanged":
|
|
2322
|
+
this.absorbMutation(event.meta, []);
|
|
2323
|
+
return;
|
|
2278
2324
|
case "annotation.created":
|
|
2279
2325
|
case "annotation.updated":
|
|
2280
2326
|
case "annotation.deleted":
|
|
@@ -2691,6 +2737,9 @@ var HttpClient = class HttpClient {
|
|
|
2691
2737
|
const res = await this.requestJson(path, "POST", body, signal);
|
|
2692
2738
|
return await this.parseJsonResponse(res, parser);
|
|
2693
2739
|
}
|
|
2740
|
+
async putJson(path, body, parser, signal) {
|
|
2741
|
+
return this.parseJsonResponse(await this.requestJson(path, "PUT", body, signal), parser);
|
|
2742
|
+
}
|
|
2694
2743
|
/** POST a JSON body and return the raw binary response (pages.extract). */
|
|
2695
2744
|
async postJsonBytes(path, body, signal) {
|
|
2696
2745
|
const res = await this.requestJson(path, "POST", body, signal);
|