@manifest-editor/creators 1.4.1 → 1.4.3
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/chunk-2B2F7X4A.js +59 -0
- package/dist/chunk-5YV7MYAZ.js +60 -0
- package/dist/chunk-CYVZA2MU.js +59 -0
- package/dist/chunk-W4PYM3PN.js +59 -0
- package/dist/index.cjs +57 -49
- package/dist/index.d.cts +11 -4
- package/dist/index.d.ts +11 -4
- package/dist/index.js +47 -48
- package/dist/manifest-browser-form.lazy-4CFTHOMZ.js +6 -0
- package/dist/manifest-browser-form.lazy-5JVKGB7O.js +6 -0
- package/dist/manifest-browser-form.lazy-ALVCNMEV.js +6 -0
- package/dist/manifest-browser-form.lazy-QGTJHSSC.js +6 -0
- package/package.json +9 -9
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// src/Manifest/ManifestBrowserCreator/manifest-browser-form.lazy.tsx
|
|
2
|
+
import { Vault } from "@iiif/helpers";
|
|
3
|
+
import { PreviewVaultBoundary } from "@manifest-editor/shell";
|
|
4
|
+
import { IIIFBrowser } from "iiif-browser";
|
|
5
|
+
import { useMemo } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
function ManifestBrowserCreatorForm(props) {
|
|
8
|
+
const vault = useMemo(() => new Vault(), []);
|
|
9
|
+
const output = useMemo(() => {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
type: "callback",
|
|
13
|
+
label: "Select",
|
|
14
|
+
supportedTypes: ["Manifest", "Collection"],
|
|
15
|
+
cb: (resource) => props.runCreate({ output: resource }),
|
|
16
|
+
format: {
|
|
17
|
+
type: "custom",
|
|
18
|
+
format: (resource, parent, vault2) => {
|
|
19
|
+
const resourcesAsArray = Array.isArray(resource) ? resource : [{ ...resource, parent }];
|
|
20
|
+
const resources = [];
|
|
21
|
+
for (const resource2 of resourcesAsArray) {
|
|
22
|
+
resources.push({ resource: vault2.get(resource2), parent: resource2.parent, selector: resource2.selector });
|
|
23
|
+
}
|
|
24
|
+
return resources;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
];
|
|
29
|
+
}, [props.runCreate]);
|
|
30
|
+
const navigationOptions = useMemo(() => {
|
|
31
|
+
return {
|
|
32
|
+
canCropImage: false,
|
|
33
|
+
canSelectCanvas: false,
|
|
34
|
+
canSelectManifest: true,
|
|
35
|
+
canSelectCollection: true,
|
|
36
|
+
multiSelect: true
|
|
37
|
+
};
|
|
38
|
+
}, []);
|
|
39
|
+
const uiOptions = useMemo(() => {
|
|
40
|
+
return {
|
|
41
|
+
buttonClassName: "bg-me-primary-500 text-white hover:bg-me-primary-600"
|
|
42
|
+
};
|
|
43
|
+
}, []);
|
|
44
|
+
return /* @__PURE__ */ jsx(PreviewVaultBoundary, { children: /* @__PURE__ */ jsx(
|
|
45
|
+
IIIFBrowser,
|
|
46
|
+
{
|
|
47
|
+
debug: true,
|
|
48
|
+
ui: uiOptions,
|
|
49
|
+
vault,
|
|
50
|
+
className: "iiif-browser border-none border-t rounded-none h-[70vh] min-h-[60vh] max-h-full max-w-full",
|
|
51
|
+
output,
|
|
52
|
+
navigation: navigationOptions
|
|
53
|
+
}
|
|
54
|
+
) });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export {
|
|
58
|
+
ManifestBrowserCreatorForm
|
|
59
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// src/Manifest/ManifestBrowserCreator/manifest-browser-form.lazy.tsx
|
|
2
|
+
import { Vault } from "@iiif/helpers";
|
|
3
|
+
import { PreviewVaultBoundary } from "@manifest-editor/shell";
|
|
4
|
+
import { IIIFBrowser } from "iiif-browser";
|
|
5
|
+
import { useMemo } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
function ManifestBrowserCreatorForm(props) {
|
|
8
|
+
const vault = useMemo(() => new Vault(), []);
|
|
9
|
+
const output = useMemo(() => {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
type: "callback",
|
|
13
|
+
label: "Select",
|
|
14
|
+
supportedTypes: ["Manifest", "Collection"],
|
|
15
|
+
cb: (resource) => props.runCreate({ output: resource }),
|
|
16
|
+
format: {
|
|
17
|
+
type: "custom",
|
|
18
|
+
format: (resource, parent, vault2) => {
|
|
19
|
+
const resourcesAsArray = Array.isArray(resource) ? resource : [{ ...resource, parent }];
|
|
20
|
+
const resources = [];
|
|
21
|
+
for (const resource2 of resourcesAsArray) {
|
|
22
|
+
resources.push({ resource: vault2.get(resource2), parent: resource2.parent, selector: resource2.selector });
|
|
23
|
+
}
|
|
24
|
+
return resources;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
];
|
|
29
|
+
}, [props.runCreate]);
|
|
30
|
+
const navigationOptions = useMemo(() => {
|
|
31
|
+
return {
|
|
32
|
+
canCropImage: false,
|
|
33
|
+
canSelectCanvas: false,
|
|
34
|
+
canSelectManifest: true,
|
|
35
|
+
canSelectCollection: true,
|
|
36
|
+
// @todo fix the output so this one works.
|
|
37
|
+
multiSelect: false
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
const uiOptions = useMemo(() => {
|
|
41
|
+
return {
|
|
42
|
+
buttonClassName: "bg-me-primary-500 text-white hover:bg-me-primary-600"
|
|
43
|
+
};
|
|
44
|
+
}, []);
|
|
45
|
+
return /* @__PURE__ */ jsx(PreviewVaultBoundary, { children: /* @__PURE__ */ jsx(
|
|
46
|
+
IIIFBrowser,
|
|
47
|
+
{
|
|
48
|
+
debug: true,
|
|
49
|
+
ui: uiOptions,
|
|
50
|
+
vault,
|
|
51
|
+
className: "iiif-browser border-none border-t rounded-none h-[70vh] min-h-[60vh] max-h-full max-w-full",
|
|
52
|
+
output,
|
|
53
|
+
navigation: navigationOptions
|
|
54
|
+
}
|
|
55
|
+
) });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export {
|
|
59
|
+
ManifestBrowserCreatorForm
|
|
60
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// src/Manifest/ManifestBrowserCreator/manifest-browser-form.lazy.tsx
|
|
2
|
+
import { Vault } from "@iiif/helpers";
|
|
3
|
+
import { PreviewVaultBoundary } from "@manifest-editor/shell";
|
|
4
|
+
import { IIIFBrowser } from "iiif-browser";
|
|
5
|
+
import { useMemo } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
function ManifestBrowserCreatorForm(props) {
|
|
8
|
+
const vault = useMemo(() => new Vault(), []);
|
|
9
|
+
const output = useMemo(() => {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
type: "callback",
|
|
13
|
+
label: "Select",
|
|
14
|
+
supportedTypes: ["Manifest", "Collection", "ManifestList", "CollectionList", "CollectionItemList"],
|
|
15
|
+
cb: (resource) => props.runCreate({ output: resource }),
|
|
16
|
+
format: {
|
|
17
|
+
type: "custom",
|
|
18
|
+
format: (resource, parent, vault2) => {
|
|
19
|
+
const resourcesAsArray = Array.isArray(resource) ? resource : [{ ...resource, parent }];
|
|
20
|
+
const resources = [];
|
|
21
|
+
for (const resource2 of resourcesAsArray) {
|
|
22
|
+
resources.push({ resource: vault2.get(resource2), parent: resource2.parent, selector: resource2.selector });
|
|
23
|
+
}
|
|
24
|
+
return resources;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
];
|
|
29
|
+
}, [props.runCreate]);
|
|
30
|
+
const navigationOptions = useMemo(() => {
|
|
31
|
+
return {
|
|
32
|
+
canCropImage: false,
|
|
33
|
+
canSelectCanvas: false,
|
|
34
|
+
canSelectManifest: true,
|
|
35
|
+
canSelectCollection: true,
|
|
36
|
+
multiSelect: true
|
|
37
|
+
};
|
|
38
|
+
}, []);
|
|
39
|
+
const uiOptions = useMemo(() => {
|
|
40
|
+
return {
|
|
41
|
+
buttonClassName: "bg-me-primary-500 text-white hover:bg-me-primary-600"
|
|
42
|
+
};
|
|
43
|
+
}, []);
|
|
44
|
+
return /* @__PURE__ */ jsx(PreviewVaultBoundary, { children: /* @__PURE__ */ jsx(
|
|
45
|
+
IIIFBrowser,
|
|
46
|
+
{
|
|
47
|
+
debug: true,
|
|
48
|
+
ui: uiOptions,
|
|
49
|
+
vault,
|
|
50
|
+
className: "iiif-browser border-none border-t rounded-none h-[70vh] min-h-[60vh] max-h-full max-w-full",
|
|
51
|
+
output,
|
|
52
|
+
navigation: navigationOptions
|
|
53
|
+
}
|
|
54
|
+
) });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export {
|
|
58
|
+
ManifestBrowserCreatorForm
|
|
59
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// src/Manifest/ManifestBrowserCreator/manifest-browser-form.lazy.tsx
|
|
2
|
+
import { Vault } from "@iiif/helpers";
|
|
3
|
+
import { PreviewVaultBoundary } from "@manifest-editor/shell";
|
|
4
|
+
import { IIIFBrowser } from "iiif-browser";
|
|
5
|
+
import { useMemo } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
function ManifestBrowserCreatorForm(props) {
|
|
8
|
+
const vault = useMemo(() => new Vault(), []);
|
|
9
|
+
const output = useMemo(() => {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
type: "callback",
|
|
13
|
+
label: "Select",
|
|
14
|
+
supportedTypes: ["Manifest", "Collection", "CollectionItemList"],
|
|
15
|
+
cb: (resource) => props.runCreate({ output: resource }),
|
|
16
|
+
format: {
|
|
17
|
+
type: "custom",
|
|
18
|
+
format: (resource, parent, vault2) => {
|
|
19
|
+
const resourcesAsArray = Array.isArray(resource) ? resource : [{ ...resource, parent }];
|
|
20
|
+
const resources = [];
|
|
21
|
+
for (const resource2 of resourcesAsArray) {
|
|
22
|
+
resources.push({ resource: vault2.get(resource2), parent: resource2.parent, selector: resource2.selector });
|
|
23
|
+
}
|
|
24
|
+
return resources;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
];
|
|
29
|
+
}, [props.runCreate]);
|
|
30
|
+
const navigationOptions = useMemo(() => {
|
|
31
|
+
return {
|
|
32
|
+
canCropImage: false,
|
|
33
|
+
canSelectCanvas: false,
|
|
34
|
+
canSelectManifest: true,
|
|
35
|
+
canSelectCollection: true,
|
|
36
|
+
multiSelect: true
|
|
37
|
+
};
|
|
38
|
+
}, []);
|
|
39
|
+
const uiOptions = useMemo(() => {
|
|
40
|
+
return {
|
|
41
|
+
buttonClassName: "bg-me-primary-500 text-white hover:bg-me-primary-600"
|
|
42
|
+
};
|
|
43
|
+
}, []);
|
|
44
|
+
return /* @__PURE__ */ jsx(PreviewVaultBoundary, { children: /* @__PURE__ */ jsx(
|
|
45
|
+
IIIFBrowser,
|
|
46
|
+
{
|
|
47
|
+
debug: true,
|
|
48
|
+
ui: uiOptions,
|
|
49
|
+
vault,
|
|
50
|
+
className: "iiif-browser border-none border-t rounded-none h-[70vh] min-h-[60vh] max-h-full max-w-full",
|
|
51
|
+
output,
|
|
52
|
+
navigation: navigationOptions
|
|
53
|
+
}
|
|
54
|
+
) });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export {
|
|
58
|
+
ManifestBrowserCreatorForm
|
|
59
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -108,9 +108,19 @@ function ManifestBrowserCreatorForm(props) {
|
|
|
108
108
|
{
|
|
109
109
|
type: "callback",
|
|
110
110
|
label: "Select",
|
|
111
|
-
supportedTypes: ["Manifest", "Collection"],
|
|
111
|
+
supportedTypes: ["Manifest", "Collection", "ManifestList", "CollectionList", "CollectionItemList"],
|
|
112
112
|
cb: (resource) => props.runCreate({ output: resource }),
|
|
113
|
-
format: {
|
|
113
|
+
format: {
|
|
114
|
+
type: "custom",
|
|
115
|
+
format: (resource, parent, vault2) => {
|
|
116
|
+
const resourcesAsArray = Array.isArray(resource) ? resource : [{ ...resource, parent }];
|
|
117
|
+
const resources = [];
|
|
118
|
+
for (const resource2 of resourcesAsArray) {
|
|
119
|
+
resources.push({ resource: vault2.get(resource2), parent: resource2.parent, selector: resource2.selector });
|
|
120
|
+
}
|
|
121
|
+
return resources;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
114
124
|
}
|
|
115
125
|
];
|
|
116
126
|
}, [props.runCreate]);
|
|
@@ -120,8 +130,7 @@ function ManifestBrowserCreatorForm(props) {
|
|
|
120
130
|
canSelectCanvas: false,
|
|
121
131
|
canSelectManifest: true,
|
|
122
132
|
canSelectCollection: true,
|
|
123
|
-
|
|
124
|
-
multiSelect: false
|
|
133
|
+
multiSelect: true
|
|
125
134
|
};
|
|
126
135
|
}, []);
|
|
127
136
|
const uiOptions = (0, import_react13.useMemo)(() => {
|
|
@@ -1977,6 +1986,7 @@ async function createFromIIIFBrowserOutput(data, ctx) {
|
|
|
1977
1986
|
if (!fullCanvas.label) {
|
|
1978
1987
|
fullCanvas.label = { en: ["Untitled canvas"] };
|
|
1979
1988
|
}
|
|
1989
|
+
ctx.vault.loadSync(fullCanvas.id, fullCanvas);
|
|
1980
1990
|
returnResources.push(ctx.embed(fullCanvas));
|
|
1981
1991
|
continue;
|
|
1982
1992
|
}
|
|
@@ -2003,8 +2013,7 @@ async function createFromIIIFBrowserOutput(data, ctx) {
|
|
|
2003
2013
|
}
|
|
2004
2014
|
if (selector?.type === "BoxSelector") {
|
|
2005
2015
|
const imageApiSelector = {
|
|
2006
|
-
|
|
2007
|
-
type: "iiif:ImageApiSelector",
|
|
2016
|
+
type: "ImageApiSelector",
|
|
2008
2017
|
region: [
|
|
2009
2018
|
~~selector.spatial.x,
|
|
2010
2019
|
~~selector.spatial.y,
|
|
@@ -2647,50 +2656,49 @@ var import_creator_api25 = require("@manifest-editor/creator-api");
|
|
|
2647
2656
|
var import_helpers7 = require("@iiif/helpers");
|
|
2648
2657
|
var import_react14 = require("react");
|
|
2649
2658
|
async function createFromManifestBrowserOutput(data, ctx) {
|
|
2650
|
-
const
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
});
|
|
2659
|
+
const inputItems = data.output || [];
|
|
2660
|
+
const itemsToAdd = [];
|
|
2661
|
+
for (const item of inputItems) {
|
|
2662
|
+
const { resource, parent, selector } = item;
|
|
2663
|
+
const previewVault = ctx.getPreviewVault();
|
|
2664
|
+
const thumbnails = (0, import_helpers7.createThumbnailHelper)(previewVault);
|
|
2665
|
+
if (resource.type === "Manifest") {
|
|
2666
|
+
const manifestId = resource.id;
|
|
2667
|
+
invariant(manifestId, "Could not find Manifest ID");
|
|
2668
|
+
const manifest = await previewVault.loadManifest(manifestId);
|
|
2669
|
+
const thumbnail = await thumbnails.getBestThumbnailAtSize(manifest, { width: 256, height: 256 }, false);
|
|
2670
|
+
invariant(manifest, "Manifest not found");
|
|
2671
|
+
itemsToAdd.push(
|
|
2672
|
+
ctx.embed({
|
|
2673
|
+
id: resource.id,
|
|
2674
|
+
type: "Manifest",
|
|
2675
|
+
label: manifest.label,
|
|
2676
|
+
summary: manifest.summary,
|
|
2677
|
+
thumbnail: thumbnail?.best ? [
|
|
2678
|
+
{
|
|
2679
|
+
id: thumbnail.best.id,
|
|
2680
|
+
type: "Image"
|
|
2681
|
+
}
|
|
2682
|
+
] : void 0
|
|
2683
|
+
})
|
|
2684
|
+
);
|
|
2685
|
+
continue;
|
|
2686
|
+
}
|
|
2687
|
+
if (resource.type === "Collection") {
|
|
2688
|
+
const collectionId = resource.id;
|
|
2689
|
+
invariant(collectionId, "Could not find Manifest ID");
|
|
2690
|
+
const collection = await previewVault.loadManifest(collectionId);
|
|
2691
|
+
invariant(collection, "Collection not found");
|
|
2692
|
+
itemsToAdd.push(
|
|
2693
|
+
ctx.embed({
|
|
2694
|
+
id: resource.id,
|
|
2695
|
+
type: "Collection",
|
|
2696
|
+
label: collection.label
|
|
2697
|
+
})
|
|
2698
|
+
);
|
|
2699
|
+
}
|
|
2692
2700
|
}
|
|
2693
|
-
|
|
2701
|
+
return itemsToAdd;
|
|
2694
2702
|
}
|
|
2695
2703
|
var ManifestBrowserCreatorForm2 = (0, import_react14.lazy)(() => Promise.resolve().then(() => (init_manifest_browser_form_lazy(), manifest_browser_form_lazy_exports)));
|
|
2696
2704
|
|
package/dist/index.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ import { CreatorFunctionContext, CreatorContext, CreatorResource } from '@manife
|
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import { SizeParameter, RegionParameter } from '@iiif/parser/image-3';
|
|
7
7
|
import * as react from 'react';
|
|
8
|
-
import { BoxSelector
|
|
8
|
+
import { BoxSelector } from '@iiif/helpers';
|
|
9
9
|
|
|
10
10
|
interface CreateAudioAnnotationPayload {
|
|
11
11
|
label?: InternationalString;
|
|
@@ -315,9 +315,16 @@ declare const youTubeBodyCreator: _manifest_editor_creator_api.SpecificCreatorDe
|
|
|
315
315
|
declare function ManifestBrowserCreatorForm$1(props: CreatorContext): react_jsx_runtime.JSX.Element;
|
|
316
316
|
|
|
317
317
|
interface ManifestBrowserCreatorPayload {
|
|
318
|
-
output:
|
|
318
|
+
output: Array<{
|
|
319
|
+
resource: any;
|
|
320
|
+
parent: {
|
|
321
|
+
id: string;
|
|
322
|
+
type: string;
|
|
323
|
+
} | undefined;
|
|
324
|
+
selector: BoxSelector | undefined;
|
|
325
|
+
}>;
|
|
319
326
|
}
|
|
320
|
-
declare function createFromManifestBrowserOutput(data: ManifestBrowserCreatorPayload, ctx: CreatorFunctionContext): Promise<
|
|
327
|
+
declare function createFromManifestBrowserOutput(data: ManifestBrowserCreatorPayload, ctx: CreatorFunctionContext): Promise<CreatorResource[]>;
|
|
321
328
|
declare const ManifestBrowserCreatorForm: react.LazyExoticComponent<typeof ManifestBrowserCreatorForm$1>;
|
|
322
329
|
|
|
323
330
|
declare module "@manifest-editor/creator-api" {
|
|
@@ -327,7 +334,7 @@ declare module "@manifest-editor/creator-api" {
|
|
|
327
334
|
}
|
|
328
335
|
}
|
|
329
336
|
}
|
|
330
|
-
declare const manifestBrowserCreator: _manifest_editor_creator_api.SpecificCreatorDefinition<ManifestBrowserCreatorPayload, "@manifest-editor/manifest-browser-creator", "Manifest", ["Collection"], ["Manifest", "Collection"], ["Collection"], [], Promise<_manifest_editor_creator_api.CreatorResource>>;
|
|
337
|
+
declare const manifestBrowserCreator: _manifest_editor_creator_api.SpecificCreatorDefinition<ManifestBrowserCreatorPayload, "@manifest-editor/manifest-browser-creator", "Manifest", ["Collection"], ["Manifest", "Collection"], ["Collection"], [], Promise<_manifest_editor_creator_api.CreatorResource[]>>;
|
|
331
338
|
|
|
332
339
|
declare function createImageUrlListAnnotation(payload: {
|
|
333
340
|
images: CreateImageUrlPayload[];
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { CreatorFunctionContext, CreatorContext, CreatorResource } from '@manife
|
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import { SizeParameter, RegionParameter } from '@iiif/parser/image-3';
|
|
7
7
|
import * as react from 'react';
|
|
8
|
-
import { BoxSelector
|
|
8
|
+
import { BoxSelector } from '@iiif/helpers';
|
|
9
9
|
|
|
10
10
|
interface CreateAudioAnnotationPayload {
|
|
11
11
|
label?: InternationalString;
|
|
@@ -315,9 +315,16 @@ declare const youTubeBodyCreator: _manifest_editor_creator_api.SpecificCreatorDe
|
|
|
315
315
|
declare function ManifestBrowserCreatorForm$1(props: CreatorContext): react_jsx_runtime.JSX.Element;
|
|
316
316
|
|
|
317
317
|
interface ManifestBrowserCreatorPayload {
|
|
318
|
-
output:
|
|
318
|
+
output: Array<{
|
|
319
|
+
resource: any;
|
|
320
|
+
parent: {
|
|
321
|
+
id: string;
|
|
322
|
+
type: string;
|
|
323
|
+
} | undefined;
|
|
324
|
+
selector: BoxSelector | undefined;
|
|
325
|
+
}>;
|
|
319
326
|
}
|
|
320
|
-
declare function createFromManifestBrowserOutput(data: ManifestBrowserCreatorPayload, ctx: CreatorFunctionContext): Promise<
|
|
327
|
+
declare function createFromManifestBrowserOutput(data: ManifestBrowserCreatorPayload, ctx: CreatorFunctionContext): Promise<CreatorResource[]>;
|
|
321
328
|
declare const ManifestBrowserCreatorForm: react.LazyExoticComponent<typeof ManifestBrowserCreatorForm$1>;
|
|
322
329
|
|
|
323
330
|
declare module "@manifest-editor/creator-api" {
|
|
@@ -327,7 +334,7 @@ declare module "@manifest-editor/creator-api" {
|
|
|
327
334
|
}
|
|
328
335
|
}
|
|
329
336
|
}
|
|
330
|
-
declare const manifestBrowserCreator: _manifest_editor_creator_api.SpecificCreatorDefinition<ManifestBrowserCreatorPayload, "@manifest-editor/manifest-browser-creator", "Manifest", ["Collection"], ["Manifest", "Collection"], ["Collection"], [], Promise<_manifest_editor_creator_api.CreatorResource>>;
|
|
337
|
+
declare const manifestBrowserCreator: _manifest_editor_creator_api.SpecificCreatorDefinition<ManifestBrowserCreatorPayload, "@manifest-editor/manifest-browser-creator", "Manifest", ["Collection"], ["Manifest", "Collection"], ["Collection"], [], Promise<_manifest_editor_creator_api.CreatorResource[]>>;
|
|
331
338
|
|
|
332
339
|
declare function createImageUrlListAnnotation(payload: {
|
|
333
340
|
images: CreateImageUrlPayload[];
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ManifestBrowserCreatorForm
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CYVZA2MU.js";
|
|
4
4
|
|
|
5
5
|
// src/Annotation/AudioAnnotation/index.tsx
|
|
6
6
|
import { AudioIcon } from "@manifest-editor/components";
|
|
@@ -1774,6 +1774,7 @@ async function createFromIIIFBrowserOutput(data, ctx) {
|
|
|
1774
1774
|
if (!fullCanvas.label) {
|
|
1775
1775
|
fullCanvas.label = { en: ["Untitled canvas"] };
|
|
1776
1776
|
}
|
|
1777
|
+
ctx.vault.loadSync(fullCanvas.id, fullCanvas);
|
|
1777
1778
|
returnResources.push(ctx.embed(fullCanvas));
|
|
1778
1779
|
continue;
|
|
1779
1780
|
}
|
|
@@ -1800,8 +1801,7 @@ async function createFromIIIFBrowserOutput(data, ctx) {
|
|
|
1800
1801
|
}
|
|
1801
1802
|
if (selector?.type === "BoxSelector") {
|
|
1802
1803
|
const imageApiSelector = {
|
|
1803
|
-
|
|
1804
|
-
type: "iiif:ImageApiSelector",
|
|
1804
|
+
type: "ImageApiSelector",
|
|
1805
1805
|
region: [
|
|
1806
1806
|
~~selector.spatial.x,
|
|
1807
1807
|
~~selector.spatial.y,
|
|
@@ -2446,55 +2446,54 @@ import { IIIFBrowserIcon as IIIFBrowserIcon2 } from "@manifest-editor/components
|
|
|
2446
2446
|
import { defineCreator as defineCreator21 } from "@manifest-editor/creator-api";
|
|
2447
2447
|
|
|
2448
2448
|
// src/Manifest/ManifestBrowserCreator/manifest-browser-creator.tsx
|
|
2449
|
-
import { createThumbnailHelper
|
|
2449
|
+
import { createThumbnailHelper } from "@iiif/helpers";
|
|
2450
2450
|
import { lazy as lazy2 } from "react";
|
|
2451
2451
|
async function createFromManifestBrowserOutput(data, ctx) {
|
|
2452
|
-
const
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
});
|
|
2452
|
+
const inputItems = data.output || [];
|
|
2453
|
+
const itemsToAdd = [];
|
|
2454
|
+
for (const item of inputItems) {
|
|
2455
|
+
const { resource, parent, selector } = item;
|
|
2456
|
+
const previewVault = ctx.getPreviewVault();
|
|
2457
|
+
const thumbnails = createThumbnailHelper(previewVault);
|
|
2458
|
+
if (resource.type === "Manifest") {
|
|
2459
|
+
const manifestId = resource.id;
|
|
2460
|
+
invariant(manifestId, "Could not find Manifest ID");
|
|
2461
|
+
const manifest = await previewVault.loadManifest(manifestId);
|
|
2462
|
+
const thumbnail = await thumbnails.getBestThumbnailAtSize(manifest, { width: 256, height: 256 }, false);
|
|
2463
|
+
invariant(manifest, "Manifest not found");
|
|
2464
|
+
itemsToAdd.push(
|
|
2465
|
+
ctx.embed({
|
|
2466
|
+
id: resource.id,
|
|
2467
|
+
type: "Manifest",
|
|
2468
|
+
label: manifest.label,
|
|
2469
|
+
summary: manifest.summary,
|
|
2470
|
+
thumbnail: thumbnail?.best ? [
|
|
2471
|
+
{
|
|
2472
|
+
id: thumbnail.best.id,
|
|
2473
|
+
type: "Image"
|
|
2474
|
+
}
|
|
2475
|
+
] : void 0
|
|
2476
|
+
})
|
|
2477
|
+
);
|
|
2478
|
+
continue;
|
|
2479
|
+
}
|
|
2480
|
+
if (resource.type === "Collection") {
|
|
2481
|
+
const collectionId = resource.id;
|
|
2482
|
+
invariant(collectionId, "Could not find Manifest ID");
|
|
2483
|
+
const collection = await previewVault.loadManifest(collectionId);
|
|
2484
|
+
invariant(collection, "Collection not found");
|
|
2485
|
+
itemsToAdd.push(
|
|
2486
|
+
ctx.embed({
|
|
2487
|
+
id: resource.id,
|
|
2488
|
+
type: "Collection",
|
|
2489
|
+
label: collection.label
|
|
2490
|
+
})
|
|
2491
|
+
);
|
|
2492
|
+
}
|
|
2494
2493
|
}
|
|
2495
|
-
|
|
2494
|
+
return itemsToAdd;
|
|
2496
2495
|
}
|
|
2497
|
-
var ManifestBrowserCreatorForm2 = lazy2(() => import("./manifest-browser-form.lazy-
|
|
2496
|
+
var ManifestBrowserCreatorForm2 = lazy2(() => import("./manifest-browser-form.lazy-QGTJHSSC.js"));
|
|
2498
2497
|
|
|
2499
2498
|
// src/Manifest/ManifestBrowserCreator/index.tsx
|
|
2500
2499
|
import { jsx as jsx42 } from "react/jsx-runtime";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manifest-editor/creators",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bugs": "https://github.com/digirati-co-uk/iiif-manifest-editor/issues",
|
|
6
6
|
"repository": {
|
|
@@ -43,16 +43,16 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@atlas-viewer/iiif-image-api": "^2.2.0",
|
|
46
|
-
"@iiif/helpers": "^1.3.
|
|
46
|
+
"@iiif/helpers": "^1.3.2",
|
|
47
47
|
"@iiif/parser": "^2.1.8",
|
|
48
48
|
"@iiif/presentation-3": "^2.2.3",
|
|
49
49
|
"@iiif/presentation-3-normalized": "^0.9.7",
|
|
50
|
-
"@manifest-editor/components": "1.4.
|
|
51
|
-
"@manifest-editor/creator-api": "1.4.
|
|
52
|
-
"@manifest-editor/editor-api": "1.4.
|
|
53
|
-
"@manifest-editor/editors": "1.4.
|
|
54
|
-
"@manifest-editor/iiif-browser": "1.4.
|
|
55
|
-
"@manifest-editor/shell": "1.4.
|
|
50
|
+
"@manifest-editor/components": "1.4.3",
|
|
51
|
+
"@manifest-editor/creator-api": "1.4.3",
|
|
52
|
+
"@manifest-editor/editor-api": "1.4.3",
|
|
53
|
+
"@manifest-editor/editors": "1.4.3",
|
|
54
|
+
"@manifest-editor/iiif-browser": "1.4.3",
|
|
55
|
+
"@manifest-editor/shell": "1.4.3",
|
|
56
56
|
"iiif-browser": "^2.0.1",
|
|
57
57
|
"react": "^18.3.1",
|
|
58
58
|
"react-dom": "^18.3.1",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "830243a96a22a5d14b39e4c8a88cabb49a6f984a"
|
|
75
75
|
}
|