@embedpdf/viewer-chrome 3.0.0-next.4 → 3.0.0-next.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/dist/chrome.cjs +8 -1
- package/dist/chrome.cjs.map +1 -1
- package/dist/chrome.d.cts +1 -0
- package/dist/chrome.d.ts +1 -0
- package/dist/chrome.js +8 -1
- package/dist/chrome.js.map +1 -1
- package/dist/commands.cjs +21 -0
- package/dist/commands.cjs.map +1 -1
- package/dist/commands.js +21 -0
- package/dist/commands.js.map +1 -1
- package/dist/{es-D0PzYE9Z.js → es-CfmzJaGm.js} +5 -1
- package/dist/es-CfmzJaGm.js.map +1 -0
- package/dist/{es-C5084JO6.cjs → es-DtxmixGA.cjs} +5 -1
- package/dist/es-DtxmixGA.cjs.map +1 -0
- package/dist/index.cjs +71 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +72 -25
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/es-C5084JO6.cjs.map +0 -1
- package/dist/es-D0PzYE9Z.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Stage, StageToken, StageToken as StageToken$1, stagePlugin, usePages }
|
|
|
6
6
|
import { RenderLayer, TileLayer, renderPlugin } from "@embedpdf/react/render";
|
|
7
7
|
import { pageEditPlugin } from "@embedpdf/react/page-edit";
|
|
8
8
|
import { InteractionToken, InteractionToken as InteractionToken$1, interactionPlugin, useTool, useToolCursor } from "@embedpdf/react/interaction";
|
|
9
|
-
import { SelectionLayer, SelectionToken, selectionPlugin } from "@embedpdf/react/selection";
|
|
9
|
+
import { SelectionClipboard, SelectionLayer, SelectionMenu, SelectionToken, selectionPlugin } from "@embedpdf/react/selection";
|
|
10
10
|
import { AnnotationLayer, AnnotationToken, AnnotationToken as AnnotationToken$1, annotationPlugin, useAnnotation, useAnnotationDefaults, useAnnotationSelected, useFilePickerProvider, useSelectionFlags, useSelectionProps } from "@embedpdf/react/annotation";
|
|
11
11
|
import { RedactionToken, RedactionToken as RedactionToken$1, redactionPlugin, usePendingRedactions, useRedaction } from "@embedpdf/react/redaction";
|
|
12
12
|
import { FormToken, formPlugin, formWidgetRenderer, useFormScriptingProvider } from "@embedpdf/react/form";
|
|
@@ -147,6 +147,10 @@ const en = {
|
|
|
147
147
|
ungroup: "Ungroup",
|
|
148
148
|
strip: "Annotation actions"
|
|
149
149
|
},
|
|
150
|
+
selection: {
|
|
151
|
+
copy: "Copy",
|
|
152
|
+
strip: "Text selection actions"
|
|
153
|
+
},
|
|
150
154
|
shapes: {
|
|
151
155
|
rectangle: "Rectangle",
|
|
152
156
|
circle: "Circle",
|
|
@@ -1283,19 +1287,13 @@ function AppToolbar({ bar, className }) {
|
|
|
1283
1287
|
});
|
|
1284
1288
|
}
|
|
1285
1289
|
//#endregion
|
|
1286
|
-
//#region src/ui/
|
|
1290
|
+
//#region src/ui/strip-bar.tsx
|
|
1287
1291
|
/**
|
|
1288
|
-
* The
|
|
1289
|
-
*
|
|
1290
|
-
*
|
|
1291
|
-
*
|
|
1292
|
-
*
|
|
1293
|
-
* <AnnotationMenu> solves WHERE (camera transform,
|
|
1294
|
-
* rotate-knob dodging, pointer isolation)
|
|
1295
|
-
*
|
|
1296
|
-
* useStripView is the live intersection: hidden commands drop out, empty
|
|
1297
|
-
* groups vanish, null when nothing applies. This file only draws pixels.
|
|
1298
|
-
* Mounted in the Stage `overlay` slot.
|
|
1292
|
+
* The floating strip's PIXELS, shared by every contextual strip (annotation
|
|
1293
|
+
* selection, text selection, …): a rounded toolbar of command buttons with
|
|
1294
|
+
* derived group separators. The WHERE is each strip's menu component
|
|
1295
|
+
* (`<AnnotationMenu>`, `<SelectionMenu>`); the WHICH is the commands'
|
|
1296
|
+
* `visible`/`enabled` derivations via `useStripView`. This file only draws.
|
|
1299
1297
|
*/
|
|
1300
1298
|
function StripButton({ cmd, run }) {
|
|
1301
1299
|
return /* @__PURE__ */ jsx("button", {
|
|
@@ -1313,6 +1311,34 @@ function StripButton({ cmd, run }) {
|
|
|
1313
1311
|
})
|
|
1314
1312
|
});
|
|
1315
1313
|
}
|
|
1314
|
+
function StripBar({ view, label }) {
|
|
1315
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1316
|
+
role: "toolbar",
|
|
1317
|
+
"aria-label": label,
|
|
1318
|
+
className: "border-border-subtle bg-elevated flex items-center gap-1 rounded-lg border p-1 shadow-xl",
|
|
1319
|
+
children: view.groups.map((g, i) => /* @__PURE__ */ jsxs(Fragment, { children: [i > 0 && /* @__PURE__ */ jsx("span", {
|
|
1320
|
+
"aria-hidden": true,
|
|
1321
|
+
className: "bg-border h-5 w-px"
|
|
1322
|
+
}), g.commands.map((cmd) => /* @__PURE__ */ jsx(StripButton, {
|
|
1323
|
+
cmd,
|
|
1324
|
+
run: () => view.execute(cmd.id)
|
|
1325
|
+
}, cmd.id))] }, g.id))
|
|
1326
|
+
});
|
|
1327
|
+
}
|
|
1328
|
+
//#endregion
|
|
1329
|
+
//#region src/ui/annotation-strip.tsx
|
|
1330
|
+
/**
|
|
1331
|
+
* The ANNOTATION-selection floating strip:
|
|
1332
|
+
*
|
|
1333
|
+
* config/chrome.ts `strips.annotation` declares WHAT may appear
|
|
1334
|
+
* each command's visible/enabled decides WHICH items show
|
|
1335
|
+
* <AnnotationMenu> solves WHERE (camera transform,
|
|
1336
|
+
* rotate-knob dodging, pointer isolation)
|
|
1337
|
+
*
|
|
1338
|
+
* useStripView is the live intersection: hidden commands drop out, empty
|
|
1339
|
+
* groups vanish, null when nothing applies. Mounted in the Stage `overlay`
|
|
1340
|
+
* slot. The pixels are the shared <StripBar>.
|
|
1341
|
+
*/
|
|
1316
1342
|
function AnnotationStrip() {
|
|
1317
1343
|
const t = useT();
|
|
1318
1344
|
const view = useStripView(useStripSchema("annotation"));
|
|
@@ -1320,17 +1346,36 @@ function AnnotationStrip() {
|
|
|
1320
1346
|
return /* @__PURE__ */ jsx(AnnotationMenu, {
|
|
1321
1347
|
placement: "bottom",
|
|
1322
1348
|
gap: 15,
|
|
1323
|
-
children:
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1349
|
+
children: /* @__PURE__ */ jsx(StripBar, {
|
|
1350
|
+
view,
|
|
1351
|
+
label: t("commands.annotate.strip")
|
|
1352
|
+
})
|
|
1353
|
+
});
|
|
1354
|
+
}
|
|
1355
|
+
//#endregion
|
|
1356
|
+
//#region src/ui/selection-strip.tsx
|
|
1357
|
+
/**
|
|
1358
|
+
* The TEXT-SELECTION floating strip:
|
|
1359
|
+
*
|
|
1360
|
+
* config/chrome.ts `strips.selection` declares WHAT may appear
|
|
1361
|
+
* each command's visible/enabled decides WHICH items show
|
|
1362
|
+
* <SelectionMenu> solves WHERE (settles on pointer-up,
|
|
1363
|
+
* camera transform, pointer isolation)
|
|
1364
|
+
*
|
|
1365
|
+
* `useStripView` is the live intersection: with copy denied (no
|
|
1366
|
+
* doc.text.copy) every command drops out and this renders nothing — no
|
|
1367
|
+
* empty bubble. Mounted in the Stage `overlay` slot.
|
|
1368
|
+
*/
|
|
1369
|
+
function SelectionStrip() {
|
|
1370
|
+
const t = useT();
|
|
1371
|
+
const view = useStripView(useStripSchema("selection"));
|
|
1372
|
+
if (!view) return null;
|
|
1373
|
+
return /* @__PURE__ */ jsx(SelectionMenu, {
|
|
1374
|
+
placement: "bottom",
|
|
1375
|
+
gap: 12,
|
|
1376
|
+
children: /* @__PURE__ */ jsx(StripBar, {
|
|
1377
|
+
view,
|
|
1378
|
+
label: t("commands.selection.strip")
|
|
1334
1379
|
})
|
|
1335
1380
|
});
|
|
1336
1381
|
}
|
|
@@ -3314,10 +3359,12 @@ function Shell() {
|
|
|
3314
3359
|
className: "relative min-w-0 flex-1",
|
|
3315
3360
|
children: [
|
|
3316
3361
|
/* @__PURE__ */ jsx(ArmedToolCursor, {}),
|
|
3362
|
+
/* @__PURE__ */ jsx(SelectionClipboard, {}),
|
|
3317
3363
|
/* @__PURE__ */ jsx(Stage, {
|
|
3318
3364
|
interaction: true,
|
|
3319
3365
|
overlay: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
3320
3366
|
/* @__PURE__ */ jsx(AnnotationStrip, {}),
|
|
3367
|
+
/* @__PURE__ */ jsx(SelectionStrip, {}),
|
|
3321
3368
|
/* @__PURE__ */ jsx(Scrollbar, { axis: "y" }),
|
|
3322
3369
|
/* @__PURE__ */ jsx(Scrollbar, { axis: "x" })
|
|
3323
3370
|
] }),
|
|
@@ -3364,7 +3411,7 @@ function Shell() {
|
|
|
3364
3411
|
* changing these props on a mounted viewer does not rebuild the workspace.
|
|
3365
3412
|
*/
|
|
3366
3413
|
/** Lazy built-in packs — a strings override for one of these wraps its loader. */
|
|
3367
|
-
const BUILTIN_LOADERS = { es: () => import("./es-
|
|
3414
|
+
const BUILTIN_LOADERS = { es: () => import("./es-CfmzJaGm.js").then((m) => m.es) };
|
|
3368
3415
|
const isDict = (v) => typeof v === "object" && v !== null;
|
|
3369
3416
|
/**
|
|
3370
3417
|
* Deep-merge `over` into `base` (immutably), expanding dotted keys —
|