@hussmartinez/pdf-sdk 0.4.0 → 0.4.2
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/assets/processing/processing.worker.js +1 -1
- package/dist/index.js +1 -1
- package/dist/lazy/{processing-worker-DIP9ck2l.js → processing-worker-DjQv43DW.js} +2 -2
- package/dist/lazy/{processing-worker-DIP9ck2l.js.map → processing-worker-DjQv43DW.js.map} +1 -1
- package/dist/react.d.ts +2 -0
- package/dist/react.js +23 -4
- package/dist/react.js.map +1 -1
- package/dist/shared/{en-DKR-ngAZ.js → en-CrXGi3kJ.js} +3 -3
- package/dist/shared/{en-DKR-ngAZ.js.map → en-CrXGi3kJ.js.map} +1 -1
- package/dist/styles.css +3 -4
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processing-worker-
|
|
1
|
+
{"version":3,"file":"processing-worker-DjQv43DW.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.d.ts
CHANGED
|
@@ -405,12 +405,14 @@ export declare const pdfEditorMessages: {
|
|
|
405
405
|
readonly "tools.insert-pages": "Insert pages";
|
|
406
406
|
readonly "tools.move-earlier": "Move earlier";
|
|
407
407
|
readonly "tools.move-later": "Move later";
|
|
408
|
+
readonly "colorField.swatches": "swatches";
|
|
408
409
|
readonly "dialog.close": "Close";
|
|
409
410
|
readonly "fileDropZone.choose": "Choose a file";
|
|
410
411
|
readonly "fileDropZone.chooseMultiple": "Choose files";
|
|
411
412
|
readonly "fileDropZone.hint": "or drop it here";
|
|
412
413
|
readonly "fileDropZone.hintMultiple": "or drop them here";
|
|
413
414
|
readonly "progress.label": "Progress";
|
|
415
|
+
readonly "reorderableList.moved": "{label} moved to position {position} of {count}";
|
|
414
416
|
readonly "spinner.label": "Loading";
|
|
415
417
|
readonly "errors.INVALID_THEME_TOKEN": "The theme setting {token} has a value that can't be used.";
|
|
416
418
|
readonly "errors.INVALID_THEME_SELECTOR": "The theme can't be applied to the selector {selector}.";
|
package/dist/react.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { T as isPdfError, _ as createPdfJsEngine, b as safeLinkUrl, g as createPdfProcessor, n as createPdfSession, r as cleanFileName, t as pdfMessages, y as linkDestination } from "./shared/en-
|
|
2
|
+
import { T as isPdfError, _ as createPdfJsEngine, b as safeLinkUrl, g as createPdfProcessor, n as createPdfSession, r as cleanFileName, t as pdfMessages, y as linkDestination } from "./shared/en-CrXGi3kJ.js";
|
|
3
3
|
import { 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";
|
|
@@ -331,6 +331,22 @@ function PdfSessionProvider(props) {
|
|
|
331
331
|
children
|
|
332
332
|
});
|
|
333
333
|
}
|
|
334
|
+
// src/react/scrollbar.ts
|
|
335
|
+
function scrollbarThickness(container) {
|
|
336
|
+
const probe = document.createElement("div");
|
|
337
|
+
probe.style.cssText = "position: absolute; top: 0; left: 0; width: 100px; height: 100px; overflow: scroll; visibility: hidden; pointer-events: none;";
|
|
338
|
+
probe.style.setProperty("scrollbar-width", getComputedStyle(container).getPropertyValue("scrollbar-width") || "auto");
|
|
339
|
+
container.append(probe);
|
|
340
|
+
const thickness = probe.offsetWidth - probe.clientWidth;
|
|
341
|
+
probe.remove();
|
|
342
|
+
return thickness;
|
|
343
|
+
}
|
|
344
|
+
function steadyWidth(container, measured, thickness) {
|
|
345
|
+
const style = getComputedStyle(container);
|
|
346
|
+
const borders = Number.parseFloat(style.borderLeftWidth) + Number.parseFloat(style.borderRightWidth);
|
|
347
|
+
const shown = container.offsetWidth - container.clientWidth - borders;
|
|
348
|
+
return Math.max(0, measured - Math.max(0, thickness - shown));
|
|
349
|
+
}
|
|
334
350
|
// src/react/use-near-observer.ts
|
|
335
351
|
function useNearObserver(root) {
|
|
336
352
|
const observer = useRef(void 0);
|
|
@@ -604,8 +620,9 @@ function PdfThumbnails(props) {
|
|
|
604
620
|
useEffect(() => {
|
|
605
621
|
const element = root.current;
|
|
606
622
|
if (!element) return;
|
|
623
|
+
const thickness = scrollbarThickness(element);
|
|
607
624
|
const observer = new ResizeObserver(([entry]) => {
|
|
608
|
-
if (entry) setWidth(entry.contentRect.width);
|
|
625
|
+
if (entry) setWidth(steadyWidth(element, entry.contentRect.width, thickness));
|
|
609
626
|
});
|
|
610
627
|
observer.observe(element);
|
|
611
628
|
return () => observer.disconnect();
|
|
@@ -941,8 +958,10 @@ function PdfViewer(props) {
|
|
|
941
958
|
useEffect(() => {
|
|
942
959
|
const element = pages.current;
|
|
943
960
|
if (!element) return;
|
|
961
|
+
const viewerElement = root.current;
|
|
962
|
+
const thickness = viewerElement ? scrollbarThickness(viewerElement) : 0;
|
|
944
963
|
const observer = new ResizeObserver(([entry]) => {
|
|
945
|
-
if (entry) setWidth(entry.contentRect.width);
|
|
964
|
+
if (entry) setWidth(viewerElement ? steadyWidth(viewerElement, entry.contentRect.width, thickness) : entry.contentRect.width);
|
|
946
965
|
const viewer = root.current;
|
|
947
966
|
const held = anchor.current;
|
|
948
967
|
if (!viewer || !held) return;
|
|
@@ -1449,7 +1468,7 @@ function PdfEditorBody(props) {
|
|
|
1449
1468
|
role: "group",
|
|
1450
1469
|
"aria-label": messages.t("editor.label"),
|
|
1451
1470
|
"aria-busy": status === "opening" || snapshot.busy || saving.saving,
|
|
1452
|
-
className: join("hm-pdf-editor", className, classNames.root),
|
|
1471
|
+
className: join(unstyled ? void 0 : "hm-text", "hm-pdf-editor", className, classNames.root),
|
|
1453
1472
|
"data-hm-status": status,
|
|
1454
1473
|
onKeyDown,
|
|
1455
1474
|
...unstyled ? { "data-hm-unstyled": "" } : {},
|