@arbidocs/react 0.4.158 → 0.4.159
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/{store-CoLuVSxI.d.ts → ProductionDialog-BvRVGdvH.d.ts} +33 -33
- package/dist/{store-BEXGdE1y.d.cts → ProductionDialog-Dhf9MXH-.d.cts} +33 -33
- package/dist/annotations/freeze/index.cjs +15 -15
- package/dist/annotations/freeze/index.d.cts +6 -1
- package/dist/annotations/freeze/index.d.ts +6 -1
- package/dist/annotations/freeze/index.js +3 -3
- package/dist/annotations/index.cjs +56 -56
- package/dist/annotations/index.d.cts +9 -4
- package/dist/annotations/index.d.ts +9 -4
- package/dist/annotations/index.js +2 -2
- package/dist/bundle-COMT7X3A.js +4 -0
- package/dist/{bundle-N2JIJ2T6.js.map → bundle-COMT7X3A.js.map} +1 -1
- package/dist/bundle-UWCOLMAA.cjs +13 -0
- package/dist/{bundle-T6BEVYHE.cjs.map → bundle-UWCOLMAA.cjs.map} +1 -1
- package/dist/{chunk-SSOPIPEX.cjs → chunk-LRBOMQ6Q.cjs} +4 -3
- package/dist/chunk-LRBOMQ6Q.cjs.map +1 -0
- package/dist/{chunk-COWZGCL5.js → chunk-NBIW7AEE.js} +4 -3
- package/dist/chunk-NBIW7AEE.js.map +1 -0
- package/dist/{chunk-ZJMUNGOY.js → chunk-R66GNDO7.js} +42 -4
- package/dist/chunk-R66GNDO7.js.map +1 -0
- package/dist/{chunk-L2PXZWJM.cjs → chunk-RDF2Q45F.cjs} +75 -20
- package/dist/chunk-RDF2Q45F.cjs.map +1 -0
- package/dist/{chunk-IHTBAY57.js → chunk-S33P6THG.js} +59 -4
- package/dist/chunk-S33P6THG.js.map +1 -0
- package/dist/{chunk-QJXFRP5R.cjs → chunk-UP6PIBVF.cjs} +46 -8
- package/dist/chunk-UP6PIBVF.cjs.map +1 -0
- package/dist/document-tools/index.cjs +157 -27
- package/dist/document-tools/index.cjs.map +1 -1
- package/dist/document-tools/index.d.cts +110 -13
- package/dist/document-tools/index.d.ts +110 -13
- package/dist/document-tools/index.js +137 -21
- package/dist/document-tools/index.js.map +1 -1
- package/dist/index.cjs +13 -13
- package/dist/index.js +2 -2
- package/dist/{model-DIwXRuGC.d.cts → model-D63gedpb.d.cts} +5 -0
- package/dist/{model-DIwXRuGC.d.ts → model-D63gedpb.d.ts} +5 -0
- package/dist/ui/index.cjs +9 -9
- package/dist/ui/index.js +1 -1
- package/package.json +3 -3
- package/dist/bundle-N2JIJ2T6.js +0 -4
- package/dist/bundle-T6BEVYHE.cjs +0 -13
- package/dist/chunk-COWZGCL5.js.map +0 -1
- package/dist/chunk-IHTBAY57.js.map +0 -1
- package/dist/chunk-L2PXZWJM.cjs.map +0 -1
- package/dist/chunk-QJXFRP5R.cjs.map +0 -1
- package/dist/chunk-SSOPIPEX.cjs.map +0 -1
- package/dist/chunk-ZJMUNGOY.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkLRBOMQ6Q_cjs = require('./chunk-LRBOMQ6Q.cjs');
|
|
4
4
|
var chunkWYZJLZ67_cjs = require('./chunk-WYZJLZ67.cjs');
|
|
5
5
|
var chunkHJDR5HEO_cjs = require('./chunk-HJDR5HEO.cjs');
|
|
6
6
|
var chunkS6A6FSG7_cjs = require('./chunk-S6A6FSG7.cjs');
|
|
@@ -18,7 +18,7 @@ function reduceLayer(layer, action) {
|
|
|
18
18
|
case "replaceAll":
|
|
19
19
|
return action.layer;
|
|
20
20
|
case "add": {
|
|
21
|
-
const annotation =
|
|
21
|
+
const annotation = chunkLRBOMQ6Q_cjs.parseAnnotation(action.annotation);
|
|
22
22
|
if (layer.annotations.some((a) => a.id === annotation.id)) {
|
|
23
23
|
throw new Error(`annotation ${annotation.id} already exists`);
|
|
24
24
|
}
|
|
@@ -37,7 +37,7 @@ function reduceLayer(layer, action) {
|
|
|
37
37
|
case "update": {
|
|
38
38
|
const found = layer.annotations.find((a) => a.id === action.id);
|
|
39
39
|
if (!found) return layer;
|
|
40
|
-
const next =
|
|
40
|
+
const next = chunkLRBOMQ6Q_cjs.parseAnnotation({
|
|
41
41
|
...found,
|
|
42
42
|
...action.patch,
|
|
43
43
|
id: found.id,
|
|
@@ -76,7 +76,7 @@ function reduceLayer(layer, action) {
|
|
|
76
76
|
case "reply": {
|
|
77
77
|
const found = layer.annotations.find((a) => a.id === action.id);
|
|
78
78
|
if (!found || found.kind !== "comment") return layer;
|
|
79
|
-
const next =
|
|
79
|
+
const next = chunkLRBOMQ6Q_cjs.parseAnnotation({
|
|
80
80
|
...found,
|
|
81
81
|
replies: [...found.replies, action.reply],
|
|
82
82
|
updatedAt: action.now
|
|
@@ -146,10 +146,10 @@ function createMemoryStore(now = () => (/* @__PURE__ */ new Date()).toISOString(
|
|
|
146
146
|
return {
|
|
147
147
|
async load(documentId) {
|
|
148
148
|
const raw = layers.get(documentId);
|
|
149
|
-
return raw ?
|
|
149
|
+
return raw ? chunkLRBOMQ6Q_cjs.parseLayer(JSON.parse(raw)) : chunkLRBOMQ6Q_cjs.emptyLayer(documentId, now());
|
|
150
150
|
},
|
|
151
151
|
async save(layer) {
|
|
152
|
-
layers.set(layer.documentId, JSON.stringify(
|
|
152
|
+
layers.set(layer.documentId, JSON.stringify(chunkLRBOMQ6Q_cjs.parseLayer(layer)));
|
|
153
153
|
}
|
|
154
154
|
};
|
|
155
155
|
}
|
|
@@ -159,14 +159,14 @@ function createLocalStorageStore(storage = safeLocalStorage(), now = () => (/* @
|
|
|
159
159
|
async load(documentId) {
|
|
160
160
|
try {
|
|
161
161
|
const raw = storage?.getItem(STORAGE_PREFIX + documentId);
|
|
162
|
-
if (raw) return
|
|
162
|
+
if (raw) return chunkLRBOMQ6Q_cjs.parseLayer(JSON.parse(raw));
|
|
163
163
|
} catch {
|
|
164
164
|
}
|
|
165
|
-
return
|
|
165
|
+
return chunkLRBOMQ6Q_cjs.emptyLayer(documentId, now());
|
|
166
166
|
},
|
|
167
167
|
async save(layer) {
|
|
168
168
|
if (!storage) throw new Error("storage is not available");
|
|
169
|
-
storage.setItem(STORAGE_PREFIX + layer.documentId, JSON.stringify(
|
|
169
|
+
storage.setItem(STORAGE_PREFIX + layer.documentId, JSON.stringify(chunkLRBOMQ6Q_cjs.parseLayer(layer)));
|
|
170
170
|
}
|
|
171
171
|
};
|
|
172
172
|
}
|
|
@@ -269,7 +269,7 @@ function toNorm(r, page) {
|
|
|
269
269
|
const cy1 = Math.min(Math.max(y1, 0), page.height);
|
|
270
270
|
const cx2 = Math.min(Math.max(x2, 0), page.width);
|
|
271
271
|
const cy2 = Math.min(Math.max(y2, 0), page.height);
|
|
272
|
-
return
|
|
272
|
+
return chunkLRBOMQ6Q_cjs.clampRect({
|
|
273
273
|
x: cx1 / page.width,
|
|
274
274
|
y: cy1 / page.height,
|
|
275
275
|
w: (cx2 - cx1) / page.width,
|
|
@@ -335,6 +335,7 @@ var TEXT_TOOLS = ["highlight", "redact-text"];
|
|
|
335
335
|
var DEFAULT_SETTINGS = {
|
|
336
336
|
colors: { highlight: "#ffe066", box: "#e03131", stamp: "#c92a2a" },
|
|
337
337
|
stampLabel: "CONFIDENTIAL",
|
|
338
|
+
stampImage: null,
|
|
338
339
|
redactionReason: "Privileged",
|
|
339
340
|
strokeWidth: 2
|
|
340
341
|
};
|
|
@@ -383,7 +384,7 @@ function useAnnotationLayer({
|
|
|
383
384
|
makeId = defaultId
|
|
384
385
|
}) {
|
|
385
386
|
const [history, setHistory] = react.useState(
|
|
386
|
-
() => createHistory(
|
|
387
|
+
() => createHistory(chunkLRBOMQ6Q_cjs.emptyLayer(documentId, now()))
|
|
387
388
|
);
|
|
388
389
|
const [savedLayer, setSavedLayer] = react.useState(null);
|
|
389
390
|
const [status, setStatus] = react.useState("loading");
|
|
@@ -434,7 +435,7 @@ function useAnnotationLayer({
|
|
|
434
435
|
setSavedLayer(null);
|
|
435
436
|
setStoreReadOnly(false);
|
|
436
437
|
savedRef.current = null;
|
|
437
|
-
commit(createHistory(
|
|
438
|
+
commit(createHistory(chunkLRBOMQ6Q_cjs.emptyLayer(documentId, nowRef.current())));
|
|
438
439
|
storeRef.current.load(documentId).then((layer) => {
|
|
439
440
|
if (cancelled) return;
|
|
440
441
|
savedRef.current = layer;
|
|
@@ -878,7 +879,7 @@ function dragRect(origin, mode, dx, dy) {
|
|
|
878
879
|
const x2 = Math.min(Math.max(Math.max(left2, right), 0), 1);
|
|
879
880
|
const y1 = Math.min(Math.max(Math.min(top2, bottom), 0), 1);
|
|
880
881
|
const y2 = Math.min(Math.max(Math.max(top2, bottom), 0), 1);
|
|
881
|
-
return
|
|
882
|
+
return chunkLRBOMQ6Q_cjs.clampRect({
|
|
882
883
|
x: x1,
|
|
883
884
|
y: y1,
|
|
884
885
|
w: Math.max(x2 - x1, MIN_MARK),
|
|
@@ -984,8 +985,27 @@ function AnnotationPageOverlay({
|
|
|
984
985
|
reason: settings.redactionReason,
|
|
985
986
|
status: "pending"
|
|
986
987
|
});
|
|
988
|
+
} else if (tool === "stamp" && settings.stampImage) {
|
|
989
|
+
const { image, label } = settings.stampImage;
|
|
990
|
+
const size2 = pngPixelSize(image);
|
|
991
|
+
const h = 0.06;
|
|
992
|
+
const w = Math.min(
|
|
993
|
+
0.5,
|
|
994
|
+
h * page.height * (size2.width / Math.max(1, size2.height)) / page.width
|
|
995
|
+
);
|
|
996
|
+
const id = controller.add({
|
|
997
|
+
kind: "stamp",
|
|
998
|
+
page: pageNumber,
|
|
999
|
+
rect: chunkLRBOMQ6Q_cjs.clampRect({ x: a.x / page.width - w / 2, y: a.y / page.height - h / 2, w, h }),
|
|
1000
|
+
label,
|
|
1001
|
+
color: "#0d1a59",
|
|
1002
|
+
image
|
|
1003
|
+
});
|
|
1004
|
+
controller.setSettings({ stampImage: null });
|
|
1005
|
+
controller.setTool("select");
|
|
1006
|
+
if (id) controller.select(id);
|
|
987
1007
|
} else if (tool === "stamp") {
|
|
988
|
-
const placed = isTooSmall(rect) ?
|
|
1008
|
+
const placed = isTooSmall(rect) ? chunkLRBOMQ6Q_cjs.clampRect({
|
|
989
1009
|
x: a.x / page.width - DEFAULT_STAMP.w / 2,
|
|
990
1010
|
y: a.y / page.height - DEFAULT_STAMP.h / 2,
|
|
991
1011
|
...DEFAULT_STAMP
|
|
@@ -998,7 +1018,7 @@ function AnnotationPageOverlay({
|
|
|
998
1018
|
color: settings.colors.stamp
|
|
999
1019
|
});
|
|
1000
1020
|
} else if (tool === "comment") {
|
|
1001
|
-
const anchor =
|
|
1021
|
+
const anchor = chunkLRBOMQ6Q_cjs.clampRect({
|
|
1002
1022
|
x: a.x / page.width,
|
|
1003
1023
|
y: a.y / page.height,
|
|
1004
1024
|
w: COMMENT_ICON_PX / page.width,
|
|
@@ -1219,6 +1239,31 @@ function MarkView(props) {
|
|
|
1219
1239
|
}
|
|
1220
1240
|
);
|
|
1221
1241
|
}
|
|
1242
|
+
if (a.kind === "stamp" && a.image) {
|
|
1243
|
+
const r = rectOverride ?? a.rect;
|
|
1244
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1245
|
+
"div",
|
|
1246
|
+
{
|
|
1247
|
+
...base(`Stamp: ${a.label}`),
|
|
1248
|
+
className: chunkS6A6FSG7_cjs.cn("absolute", ring),
|
|
1249
|
+
style: {
|
|
1250
|
+
...rectStyle(r),
|
|
1251
|
+
pointerEvents: events,
|
|
1252
|
+
touchAction: dragsByTouch ? "none" : void 0,
|
|
1253
|
+
cursor
|
|
1254
|
+
},
|
|
1255
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1256
|
+
"img",
|
|
1257
|
+
{
|
|
1258
|
+
src: `data:image/png;base64,${a.image}`,
|
|
1259
|
+
alt: a.label,
|
|
1260
|
+
draggable: false,
|
|
1261
|
+
className: "pointer-events-none h-full w-full object-contain select-none"
|
|
1262
|
+
}
|
|
1263
|
+
)
|
|
1264
|
+
}
|
|
1265
|
+
);
|
|
1266
|
+
}
|
|
1222
1267
|
if (a.kind === "stamp") {
|
|
1223
1268
|
const r = rectOverride ?? a.rect;
|
|
1224
1269
|
const fontPx = Math.max(
|
|
@@ -1622,6 +1667,11 @@ function CommentPopover({
|
|
|
1622
1667
|
}
|
|
1623
1668
|
);
|
|
1624
1669
|
}
|
|
1670
|
+
function pngPixelSize(base64) {
|
|
1671
|
+
const raw = atob(base64.slice(0, 64));
|
|
1672
|
+
const at = (i) => (raw.charCodeAt(i) << 24 | raw.charCodeAt(i + 1) << 16 | raw.charCodeAt(i + 2) << 8 | raw.charCodeAt(i + 3)) >>> 0;
|
|
1673
|
+
return { width: at(16), height: at(20) };
|
|
1674
|
+
}
|
|
1625
1675
|
var isEditable = (el) => el instanceof HTMLElement && (el.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName));
|
|
1626
1676
|
function useAnnotationShortcuts(controller, enabled = true) {
|
|
1627
1677
|
react.useEffect(() => {
|
|
@@ -1858,7 +1908,12 @@ function AnnotationToolbar({
|
|
|
1858
1908
|
onChange: (c) => controller.setSettings({ colors: { ...settings.colors, [tool]: c } })
|
|
1859
1909
|
}
|
|
1860
1910
|
),
|
|
1861
|
-
editable && tool === "stamp" && /* @__PURE__ */ jsxRuntime.
|
|
1911
|
+
editable && tool === "stamp" && settings.stampImage && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground", "data-testid": "annotation-place-signature", children: [
|
|
1912
|
+
"Click where your ",
|
|
1913
|
+
settings.stampImage.label.toLowerCase(),
|
|
1914
|
+
" goes. Informal signature: for verified signing, use Request signatures."
|
|
1915
|
+
] }),
|
|
1916
|
+
editable && tool === "stamp" && !settings.stampImage && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1862
1917
|
PresetField,
|
|
1863
1918
|
{
|
|
1864
1919
|
label: "Stamp text",
|
|
@@ -1921,7 +1976,7 @@ function FreezeDialog({
|
|
|
1921
1976
|
const [burnPending, setBurnPending] = react.useState(false);
|
|
1922
1977
|
const [redactionLog, setRedactionLog] = react.useState(true);
|
|
1923
1978
|
const marks = controller.layer.annotations;
|
|
1924
|
-
const redactions = marks.filter(
|
|
1979
|
+
const redactions = marks.filter(chunkLRBOMQ6Q_cjs.isEffectiveRedaction);
|
|
1925
1980
|
const pending = pendingRedactions(controller.layer);
|
|
1926
1981
|
const hasRedactionMarks = marks.some((a) => a.kind === "redaction");
|
|
1927
1982
|
const forced = redactions.length > 0;
|
|
@@ -1930,7 +1985,7 @@ function FreezeDialog({
|
|
|
1930
1985
|
const counts = Object.keys(KIND_LABELS).map(
|
|
1931
1986
|
(k) => [
|
|
1932
1987
|
k,
|
|
1933
|
-
marks.filter((a) => a.kind === k && (k !== "redaction" ||
|
|
1988
|
+
marks.filter((a) => a.kind === k && (k !== "redaction" || chunkLRBOMQ6Q_cjs.isEffectiveRedaction(a))).length
|
|
1934
1989
|
]
|
|
1935
1990
|
).filter(([, n]) => n > 0);
|
|
1936
1991
|
return /* @__PURE__ */ jsxRuntime.jsx(chunkWYZJLZ67_cjs.Dialog, { open, onOpenChange: (next) => !busy && onOpenChange(next), children: /* @__PURE__ */ jsxRuntime.jsxs(chunkWYZJLZ67_cjs.DialogContent, { "data-testid": "freeze-dialog", children: [
|
|
@@ -2456,5 +2511,5 @@ exports.undo = undo;
|
|
|
2456
2511
|
exports.useAnnotationLayer = useAnnotationLayer;
|
|
2457
2512
|
exports.useAnnotationShortcuts = useAnnotationShortcuts;
|
|
2458
2513
|
exports.useTextSelectionMarks = useTextSelectionMarks;
|
|
2459
|
-
//# sourceMappingURL=chunk-
|
|
2460
|
-
//# sourceMappingURL=chunk-
|
|
2514
|
+
//# sourceMappingURL=chunk-RDF2Q45F.cjs.map
|
|
2515
|
+
//# sourceMappingURL=chunk-RDF2Q45F.cjs.map
|