@hussmartinez/pdf-sdk 0.4.4 → 0.5.0
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/README.md +26 -2
- package/dist/assets/processing/processing.worker.js +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/lazy/{_virtual_hm-pdfjs-data-BSzhlxyq.js → inline-data.js} +7 -1
- package/dist/lazy/inline-data.js.map +1 -0
- package/dist/lazy/no-inline-workers.js +17 -0
- package/dist/lazy/no-inline-workers.js.map +1 -0
- package/dist/lazy/{processing-worker-n7gK4h_F.js → processing-worker.js} +2 -2
- package/dist/lazy/processing-worker.js.map +1 -0
- package/dist/lazy/{render-worker-WgnZ-czI.js → render-worker.js} +1 -1
- package/dist/lazy/render-worker.js.map +1 -0
- package/dist/react.js +5 -4
- package/dist/react.js.map +1 -1
- package/dist/shared/{en-BAoGup4H.js → en-COnsYGXV.js} +12 -14
- package/dist/shared/en-COnsYGXV.js.map +1 -0
- package/dist/shared/pdf-error-DzxHQvrO.js +11 -0
- package/dist/shared/pdf-error-DzxHQvrO.js.map +1 -0
- package/package.json +19 -3
- package/dist/lazy/processing-worker-n7gK4h_F.js.map +0 -1
- package/dist/lazy/render-worker-WgnZ-czI.js.map +0 -1
- package/dist/shared/en-BAoGup4H.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processing-worker.js","names":["ProcessingWorker"],"sources":["../../src/adapters/qpdf/processing-worker.ts"],"sourcesContent":["import ProcessingWorker from \"../../workers/processing.worker.ts?worker&inline\";\n\n/** Starts the inlined processing worker, from its own lazy chunk. */\nexport function createInlineWorker(): Worker {\n return new ProcessingWorker({ name: \"hm-pdf-processing\" });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAgB,qBAA6B;CAC3C,OAAO,IAAIA,cAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-worker.js","names":["PdfJsWorker"],"sources":["../../src/adapters/pdfjs/render-worker.ts"],"sourcesContent":["import PdfJsWorker from \"../../workers/pdfjs.worker.ts?worker&inline\";\n\n/**\n * Starts the inlined render worker. A separate lazy chunk, so applications\n * that self-host the worker never download the inlined copy.\n */\nexport function createInlineWorker(): Worker {\n return new PdfJsWorker({ name: \"hm-pdf-render\" });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAMA,SAAgB,qBAA6B;CAC3C,OAAO,IAAIA,cAAY,EAAE,MAAM,gBAAgB,CAAC;AAClD"}
|
package/dist/react.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { g as createPdfJsEngine, h as createPdfProcessor, n as createPdfSession, t as pdfMessages, v as linkDestination,
|
|
2
|
+
import { g as createPdfJsEngine, h as createPdfProcessor, n as createPdfSession, t as pdfMessages, v as linkDestination, y as safeLinkUrl } from "./shared/en-COnsYGXV.js";
|
|
3
|
+
import { n as isPdfError } from "./shared/pdf-error-DzxHQvrO.js";
|
|
3
4
|
import { MAX_FILE_NAME_LENGTH, cleanFileName, createMessages, createShortcutRegistry, createToolRegistry, defineMessages, defineTool, plural } from "@hussmartinez/sdk-core";
|
|
4
5
|
import { AnnouncerProvider, Button, DeleteIcon, DownloadIcon, IconButton, MoveDownIcon, MoveUpIcon, OpenIcon, PageAddIcon, RedoIcon, RotateLeftIcon, RotateRightIcon, Toolbar, ToolbarGroup, UiMessagesProvider, UndoIcon, useAnnounce, usePlatform } from "@hussmartinez/ui/react";
|
|
5
6
|
import { Component, createContext, forwardRef, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
@@ -148,7 +149,7 @@ function move({ session }, direction) {
|
|
|
148
149
|
const current = before.currentPage;
|
|
149
150
|
session.goToPage(current !== void 0 && found.pages.includes(current) ? current : found.pages[0]);
|
|
150
151
|
}
|
|
151
|
-
var canMove = (direction
|
|
152
|
+
var canMove = (direction, { snapshot }) => hasDocument({ snapshot }) && moveOf(snapshot, direction) !== void 0;
|
|
152
153
|
// src/features/tools.ts
|
|
153
154
|
var pdfTools = [
|
|
154
155
|
openTool,
|
|
@@ -162,7 +163,7 @@ var pdfTools = [
|
|
|
162
163
|
label: "tools.move-earlier",
|
|
163
164
|
icon: "move-up",
|
|
164
165
|
group: "pages",
|
|
165
|
-
isEnabled: canMove("earlier"),
|
|
166
|
+
isEnabled: (state) => canMove("earlier", state),
|
|
166
167
|
run: (context) => move(context, "earlier")
|
|
167
168
|
}),
|
|
168
169
|
/* @__PURE__ */ defineTool({
|
|
@@ -170,7 +171,7 @@ var pdfTools = [
|
|
|
170
171
|
label: "tools.move-later",
|
|
171
172
|
icon: "move-down",
|
|
172
173
|
group: "pages",
|
|
173
|
-
isEnabled: canMove("later"),
|
|
174
|
+
isEnabled: (state) => canMove("later", state),
|
|
174
175
|
run: (context) => move(context, "later")
|
|
175
176
|
}),
|
|
176
177
|
deletePagesTool,
|