@manifest-editor/shell 1.3.0 → 1.3.1
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/index.cjs +11 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -39
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -602,6 +602,7 @@ var import_react7 = require("react");
|
|
|
602
602
|
|
|
603
603
|
// src/PreviewContext/PreviewContext.hooks.ts
|
|
604
604
|
var import_react6 = require("react");
|
|
605
|
+
var import_react_iiif_vault2 = require("react-iiif-vault");
|
|
605
606
|
|
|
606
607
|
// src/PreviewContext/previews/ExternalManifestUrlPreview.ts
|
|
607
608
|
var ExternalManifestUrlPreview = class {
|
|
@@ -775,7 +776,6 @@ var IIIFPreviewService = class {
|
|
|
775
776
|
};
|
|
776
777
|
|
|
777
778
|
// src/PreviewContext/PreviewContext.hooks.ts
|
|
778
|
-
var import_react_iiif_vault2 = require("react-iiif-vault");
|
|
779
779
|
function usePreviewActions(state, dispatch, handlers, previews, setPreviews) {
|
|
780
780
|
const resource = useAppResource();
|
|
781
781
|
const instanceId = useAppResourceInstance();
|
|
@@ -847,8 +847,8 @@ function usePreviewActions(state, dispatch, handlers, previews, setPreviews) {
|
|
|
847
847
|
async function selectPreview(id) {
|
|
848
848
|
const selectedHandler = handlerMap[id];
|
|
849
849
|
if (selectedHandler && instanceId) {
|
|
850
|
-
await activatePreview(id);
|
|
851
850
|
dispatch({ type: "selectPreview", payload: id });
|
|
851
|
+
await activatePreview(id);
|
|
852
852
|
}
|
|
853
853
|
}
|
|
854
854
|
async function getPreviewLink() {
|
|
@@ -900,13 +900,13 @@ function usePreviewActions(state, dispatch, handlers, previews, setPreviews) {
|
|
|
900
900
|
dispatch({ type: "activatePreview", payload: contextualPreview.id });
|
|
901
901
|
} else {
|
|
902
902
|
Object.assign(context, existing?.data || {});
|
|
903
|
-
dispatch({ type: "activatePreview", payload: id });
|
|
903
|
+
dispatch({ type: "activatePreview", payload: existing.id });
|
|
904
904
|
}
|
|
905
905
|
}
|
|
906
906
|
const created = await selectedHandler.createPreview(instanceId, resource, vault, context);
|
|
907
907
|
if (created) {
|
|
908
908
|
previewActions.setPreview(created);
|
|
909
|
-
dispatch({ type: "activatePreview", payload: id });
|
|
909
|
+
dispatch({ type: "activatePreview", payload: created.id });
|
|
910
910
|
}
|
|
911
911
|
}
|
|
912
912
|
}
|
|
@@ -1221,20 +1221,13 @@ var ButtonEmpty = import_styled_components3.default.div`
|
|
|
1221
1221
|
|
|
1222
1222
|
// src/PreviewButton/PreviewButton.tsx
|
|
1223
1223
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1224
|
-
function PreviewButton({
|
|
1225
|
-
downloadEnabled,
|
|
1226
|
-
fileName
|
|
1227
|
-
}) {
|
|
1224
|
+
function PreviewButton({ downloadEnabled, fileName }) {
|
|
1228
1225
|
const { active, configs, actions, selected } = usePreviewContext();
|
|
1229
1226
|
const vault = (0, import_react_iiif_vault3.useVault)();
|
|
1230
1227
|
const config = useConfig();
|
|
1231
1228
|
const resource = useAppResource();
|
|
1232
|
-
const configsToShow = configs.filter(
|
|
1233
|
-
|
|
1234
|
-
);
|
|
1235
|
-
const { isOpen, buttonProps, itemProps } = (0, import_react_accessible_dropdown_menu_hook.default)(
|
|
1236
|
-
configsToShow.length
|
|
1237
|
-
);
|
|
1229
|
+
const configsToShow = configs.filter((c) => c.type === "external-manifest-preview");
|
|
1230
|
+
const { isOpen, buttonProps, itemProps } = (0, import_react_accessible_dropdown_menu_hook.default)(configsToShow.length);
|
|
1238
1231
|
if (configsToShow.length === 0) {
|
|
1239
1232
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ButtonEmpty, { children: "Preview not available" });
|
|
1240
1233
|
}
|
|
@@ -1246,17 +1239,9 @@ function PreviewButton({
|
|
|
1246
1239
|
label: "Download manifest",
|
|
1247
1240
|
getData: () => {
|
|
1248
1241
|
if (config.export && config.export.version === 2) {
|
|
1249
|
-
return JSON.stringify(
|
|
1250
|
-
vault.toPresentation2(resource),
|
|
1251
|
-
null,
|
|
1252
|
-
2
|
|
1253
|
-
);
|
|
1242
|
+
return JSON.stringify(vault.toPresentation2(resource), null, 2);
|
|
1254
1243
|
}
|
|
1255
|
-
return JSON.stringify(
|
|
1256
|
-
vault.toPresentation3(resource),
|
|
1257
|
-
null,
|
|
1258
|
-
2
|
|
1259
|
-
);
|
|
1244
|
+
return JSON.stringify(vault.toPresentation3(resource), null, 2);
|
|
1260
1245
|
}
|
|
1261
1246
|
}
|
|
1262
1247
|
) }) : null,
|
|
@@ -1271,7 +1256,6 @@ function PreviewButton({
|
|
|
1271
1256
|
const found = configs.find((c) => c.id === defaultPreviewId);
|
|
1272
1257
|
if (found) {
|
|
1273
1258
|
actions.selectPreview(found.id);
|
|
1274
|
-
actions.updatePreviews();
|
|
1275
1259
|
return;
|
|
1276
1260
|
}
|
|
1277
1261
|
}
|
|
@@ -1286,29 +1270,17 @@ function PreviewButton({
|
|
|
1286
1270
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MenuContainer, { $open: isOpen, children: configsToShow.map((config2, key) => {
|
|
1287
1271
|
const inactive = active.indexOf(config2.id) === -1;
|
|
1288
1272
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(MenuItem, { ...itemProps[key], children: [
|
|
1289
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1290
|
-
MenuItemStatus,
|
|
1291
|
-
{
|
|
1292
|
-
$status: inactive ? "available" : config2.id === selected ? "active" : "configured"
|
|
1293
|
-
}
|
|
1294
|
-
),
|
|
1273
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MenuItemStatus, { $status: inactive ? "available" : config2.id === selected ? "active" : "configured" }),
|
|
1295
1274
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1296
1275
|
MenuItemLabel,
|
|
1297
1276
|
{
|
|
1298
1277
|
onClick: () => {
|
|
1299
1278
|
actions.selectPreview(config2.id);
|
|
1300
|
-
actions.updatePreviews();
|
|
1301
1279
|
},
|
|
1302
1280
|
children: config2.label
|
|
1303
1281
|
}
|
|
1304
1282
|
),
|
|
1305
|
-
!inactive ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1306
|
-
MenuItemClose,
|
|
1307
|
-
{
|
|
1308
|
-
onClick: () => actions.deletePreview(config2.id),
|
|
1309
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CloseIcon, {})
|
|
1310
|
-
}
|
|
1311
|
-
) : null
|
|
1283
|
+
!inactive ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MenuItemClose, { onClick: () => actions.deletePreview(config2.id), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CloseIcon, {}) }) : null
|
|
1312
1284
|
] }, config2.id);
|
|
1313
1285
|
}) })
|
|
1314
1286
|
] })
|