@hussmartinez/pdf-sdk 0.4.3 → 0.4.5
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 +2 -2
- package/dist/assets/processing/processing.worker.js +1 -1
- package/dist/index.js +1 -1
- package/dist/lazy/{processing-worker-DmUXTvVf.js → processing-worker-D4qwaqbw.js} +2 -2
- package/dist/lazy/{processing-worker-DmUXTvVf.js.map → processing-worker-D4qwaqbw.js.map} +1 -1
- package/dist/react.js +6 -6
- package/dist/react.js.map +1 -1
- package/dist/shared/{en-DcHRkVwP.js → en-DAmVF5wH.js} +5 -18
- package/dist/shared/en-DAmVF5wH.js.map +1 -0
- package/package.json +5 -4
- package/dist/shared/en-DcHRkVwP.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processing-worker-
|
|
1
|
+
{"version":3,"file":"processing-worker-D4qwaqbw.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"}
|
package/dist/react.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { createMessages, createShortcutRegistry, createToolRegistry, defineMessages, defineTool, plural } from "@hussmartinez/sdk-core";
|
|
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-DAmVF5wH.js";
|
|
3
|
+
import { MAX_FILE_NAME_LENGTH, cleanFileName, createMessages, createShortcutRegistry, createToolRegistry, defineMessages, defineTool, plural } from "@hussmartinez/sdk-core";
|
|
4
4
|
import { AnnouncerProvider, Button, DeleteIcon, DownloadIcon, IconButton, MoveDownIcon, MoveUpIcon, OpenIcon, PageAddIcon, RedoIcon, RotateLeftIcon, RotateRightIcon, Toolbar, ToolbarGroup, UiMessagesProvider, UndoIcon, useAnnounce, usePlatform } from "@hussmartinez/ui/react";
|
|
5
5
|
import { Component, createContext, forwardRef, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
6
6
|
import { uiMessages } from "@hussmartinez/ui";
|
|
@@ -148,7 +148,7 @@ function move({ session }, direction) {
|
|
|
148
148
|
const current = before.currentPage;
|
|
149
149
|
session.goToPage(current !== void 0 && found.pages.includes(current) ? current : found.pages[0]);
|
|
150
150
|
}
|
|
151
|
-
var canMove = (direction
|
|
151
|
+
var canMove = (direction, { snapshot }) => hasDocument({ snapshot }) && moveOf(snapshot, direction) !== void 0;
|
|
152
152
|
// src/features/tools.ts
|
|
153
153
|
var pdfTools = [
|
|
154
154
|
openTool,
|
|
@@ -162,7 +162,7 @@ var pdfTools = [
|
|
|
162
162
|
label: "tools.move-earlier",
|
|
163
163
|
icon: "move-up",
|
|
164
164
|
group: "pages",
|
|
165
|
-
isEnabled: canMove("earlier"),
|
|
165
|
+
isEnabled: (state) => canMove("earlier", state),
|
|
166
166
|
run: (context) => move(context, "earlier")
|
|
167
167
|
}),
|
|
168
168
|
/* @__PURE__ */ defineTool({
|
|
@@ -170,7 +170,7 @@ var pdfTools = [
|
|
|
170
170
|
label: "tools.move-later",
|
|
171
171
|
icon: "move-down",
|
|
172
172
|
group: "pages",
|
|
173
|
-
isEnabled: canMove("later"),
|
|
173
|
+
isEnabled: (state) => canMove("later", state),
|
|
174
174
|
run: (context) => move(context, "later")
|
|
175
175
|
}),
|
|
176
176
|
deletePagesTool,
|
|
@@ -1150,7 +1150,7 @@ function downloadFileName(name) {
|
|
|
1150
1150
|
const clean = cleanFileName(name);
|
|
1151
1151
|
if (clean === void 0) return DEFAULT_DOWNLOAD_NAME;
|
|
1152
1152
|
if (clean.toLowerCase().endsWith(EXTENSION)) return clean;
|
|
1153
|
-
const base = Array.from(clean).slice(0,
|
|
1153
|
+
const base = Array.from(clean).slice(0, MAX_FILE_NAME_LENGTH - 4).join("").trimEnd();
|
|
1154
1154
|
return base === "" ? DEFAULT_DOWNLOAD_NAME : `${base}${EXTENSION}`;
|
|
1155
1155
|
}
|
|
1156
1156
|
function saveFile(bytes, name) {
|