@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.
@@ -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"}
@@ -27,4 +27,4 @@ function createInlineWorker() {
27
27
  }
28
28
  export { createInlineWorker };
29
29
 
30
- //# sourceMappingURL=render-worker-WgnZ-czI.js.map
30
+ //# sourceMappingURL=render-worker.js.map
@@ -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, w as isPdfError, y as safeLinkUrl } from "./shared/en-BAoGup4H.js";
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) => ({ snapshot }) => hasDocument({ snapshot }) && moveOf(snapshot, direction) !== void 0;
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,