@manifest-editor/creators 1.3.1 → 1.4.0
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/README.md +49 -0
- package/dist/chunk-AVISJS46.js +50 -0
- package/dist/chunk-ES62IRNT.js +50 -0
- package/dist/chunk-PFQB3PNW.js +47 -0
- package/dist/chunk-S3JO5Y3Z.js +50 -0
- package/dist/iiif-browser-form.lazy-3INAWCE5.js +54 -0
- package/dist/iiif-browser-form.lazy-5TF74M2Q.js +48 -0
- package/dist/iiif-browser-form.lazy-BHX6TGDY.js +58 -0
- package/dist/iiif-browser-form.lazy-DKKTAIO5.js +59 -0
- package/dist/iiif-browser-form.lazy-DPRO7R2W.js +59 -0
- package/dist/iiif-browser-form.lazy-EREIP6PZ.js +58 -0
- package/dist/iiif-browser-form.lazy-FQDZQ3UW.js +58 -0
- package/dist/iiif-browser-form.lazy-G7TCZSC2.js +58 -0
- package/dist/iiif-browser-form.lazy-JMT72BLP.js +59 -0
- package/dist/iiif-browser-form.lazy-KTB4BQBM.js +59 -0
- package/dist/iiif-browser-form.lazy-O35TC45U.js +49 -0
- package/dist/iiif-browser-form.lazy-OXQVZ3GS.js +59 -0
- package/dist/iiif-browser-form.lazy-XORWZFSW.js +49 -0
- package/dist/index.cjs +876 -575
- package/dist/index.d.cts +237 -102
- package/dist/index.d.ts +237 -102
- package/dist/index.js +813 -562
- package/dist/manifest-browser-form.lazy-FI4GGCPX.js +6 -0
- package/dist/manifest-browser-form.lazy-HJJKFMR6.js +6 -0
- package/dist/manifest-browser-form.lazy-XVYSAQAW.js +6 -0
- package/dist/manifest-browser-form.lazy-YYKOYF7R.js +6 -0
- package/package.json +11 -10
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Creators
|
|
2
|
+
|
|
3
|
+
## API Design
|
|
4
|
+
|
|
5
|
+
The current API is a pain to use. Its lacking types.
|
|
6
|
+
|
|
7
|
+
Essentially this is the current creator hook/API (with no types!).
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
creator.create("@manifest-editor/image-url-creator", newThumbnail, {
|
|
11
|
+
targetType: "ContentResource",
|
|
12
|
+
parent: {
|
|
13
|
+
property: "thumbnail",
|
|
14
|
+
resource: {
|
|
15
|
+
id: collection!.id,
|
|
16
|
+
type: "Collection",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
initialData: {},
|
|
20
|
+
});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Ideally something like this would work, and be type-safe.
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
|
|
27
|
+
const resource = { id: ..., type: 'Manifest' }; // Maybe from props or something.
|
|
28
|
+
const createImage = useCreator(
|
|
29
|
+
// Resource will have a type.
|
|
30
|
+
resource,
|
|
31
|
+
// This should be inferred from the resource type + supported fields.
|
|
32
|
+
"thumbnail",
|
|
33
|
+
// This should be inferred from the resource type + property supported type.
|
|
34
|
+
"@manifest-editor/image-url-creator"
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
// ...
|
|
38
|
+
createImage({ url: 'https://example.org/image.jpg' });
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The same thing, but on the editor API.
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
const manifestEditor = useManifestEditor();
|
|
45
|
+
|
|
46
|
+
await manifestEditor.descriptive.thumbnail.create("@manifest-editor/image-url-creator", {
|
|
47
|
+
url: "https://example.org/image.jpg",
|
|
48
|
+
});
|
|
49
|
+
```
|
|
@@ -0,0 +1,50 @@
|
|
|
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: { type: "content-state" }
|
|
17
|
+
}
|
|
18
|
+
];
|
|
19
|
+
}, [props.runCreate]);
|
|
20
|
+
const navigationOptions = useMemo(() => {
|
|
21
|
+
return {
|
|
22
|
+
canCropImage: true,
|
|
23
|
+
canSelectCanvas: true,
|
|
24
|
+
canSelectManifest: false,
|
|
25
|
+
canSelectCollection: false,
|
|
26
|
+
// @todo fix the output so this one works.
|
|
27
|
+
multiSelect: false
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
const uiOptions = useMemo(() => {
|
|
31
|
+
return {
|
|
32
|
+
buttonClassName: "bg-me-primary-500 text-white hover:bg-me-primary-600"
|
|
33
|
+
};
|
|
34
|
+
}, []);
|
|
35
|
+
return /* @__PURE__ */ jsx(PreviewVaultBoundary, { children: /* @__PURE__ */ jsx(
|
|
36
|
+
IIIFBrowser,
|
|
37
|
+
{
|
|
38
|
+
debug: true,
|
|
39
|
+
ui: uiOptions,
|
|
40
|
+
vault,
|
|
41
|
+
className: "iiif-browser border-none border-t rounded-none h-[70vh] min-h-[60vh] max-h-full max-w-full",
|
|
42
|
+
output,
|
|
43
|
+
navigation: navigationOptions
|
|
44
|
+
}
|
|
45
|
+
) });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
ManifestBrowserCreatorForm
|
|
50
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
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: ["Canvas", "CanvasList", "CanvasRegion", "ImageService", "ImageServiceRegion"],
|
|
15
|
+
cb: (resource) => props.runCreate({ output: resource }),
|
|
16
|
+
format: { type: "content-state" }
|
|
17
|
+
}
|
|
18
|
+
];
|
|
19
|
+
}, [props.runCreate]);
|
|
20
|
+
const navigationOptions = useMemo(() => {
|
|
21
|
+
return {
|
|
22
|
+
canCropImage: true,
|
|
23
|
+
canSelectCanvas: true,
|
|
24
|
+
canSelectManifest: false,
|
|
25
|
+
canSelectCollection: false,
|
|
26
|
+
// @todo fix the output so this one works.
|
|
27
|
+
multiSelect: false
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
const uiOptions = useMemo(() => {
|
|
31
|
+
return {
|
|
32
|
+
buttonClassName: "bg-me-primary-500 text-white hover:bg-me-primary-600"
|
|
33
|
+
};
|
|
34
|
+
}, []);
|
|
35
|
+
return /* @__PURE__ */ jsx(PreviewVaultBoundary, { children: /* @__PURE__ */ jsx(
|
|
36
|
+
IIIFBrowser,
|
|
37
|
+
{
|
|
38
|
+
debug: true,
|
|
39
|
+
ui: uiOptions,
|
|
40
|
+
vault,
|
|
41
|
+
className: "iiif-browser border-none border-t rounded-none h-[70vh] min-h-[60vh] max-h-full max-w-full",
|
|
42
|
+
output,
|
|
43
|
+
navigation: navigationOptions
|
|
44
|
+
}
|
|
45
|
+
) });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
ManifestBrowserCreatorForm
|
|
50
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// src/Manifest/ManifestBrowserCreator/manifest-browser-form.lazy.tsx
|
|
2
|
+
import { PreviewVaultBoundary } from "@manifest-editor/shell";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
function ManifestBrowserCreatorForm(props) {
|
|
5
|
+
const vault = useMemo(() => new Vault(), []);
|
|
6
|
+
const output = useMemo(() => {
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
type: "callback",
|
|
10
|
+
label: "Select",
|
|
11
|
+
supportedTypes: ["Canvas", "CanvasList", "CanvasRegion", "ImageService", "ImageServiceRegion"],
|
|
12
|
+
cb: (resource) => props.runCreate({ output: resource }),
|
|
13
|
+
format: { type: "content-state" }
|
|
14
|
+
}
|
|
15
|
+
];
|
|
16
|
+
}, [props.runCreate]);
|
|
17
|
+
const navigationOptions = useMemo(() => {
|
|
18
|
+
return {
|
|
19
|
+
canCropImage: true,
|
|
20
|
+
canSelectCanvas: true,
|
|
21
|
+
canSelectManifest: false,
|
|
22
|
+
canSelectCollection: false,
|
|
23
|
+
// @todo fix the output so this one works.
|
|
24
|
+
multiSelect: false
|
|
25
|
+
};
|
|
26
|
+
}, []);
|
|
27
|
+
const uiOptions = useMemo(() => {
|
|
28
|
+
return {
|
|
29
|
+
buttonClassName: "bg-me-primary-500 text-white hover:bg-me-primary-600"
|
|
30
|
+
};
|
|
31
|
+
}, []);
|
|
32
|
+
return /* @__PURE__ */ jsx(PreviewVaultBoundary, { children: /* @__PURE__ */ jsx(
|
|
33
|
+
IIIFBrowser,
|
|
34
|
+
{
|
|
35
|
+
debug: true,
|
|
36
|
+
ui: uiOptions,
|
|
37
|
+
vault,
|
|
38
|
+
className: "iiif-browser border-none border-t rounded-none h-[70vh] min-h-[60vh] max-h-full max-w-full",
|
|
39
|
+
output,
|
|
40
|
+
navigation: navigationOptions
|
|
41
|
+
}
|
|
42
|
+
) });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
ManifestBrowserCreatorForm
|
|
47
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
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: { type: "content-state" }
|
|
17
|
+
}
|
|
18
|
+
];
|
|
19
|
+
}, [props.runCreate]);
|
|
20
|
+
const navigationOptions = useMemo(() => {
|
|
21
|
+
return {
|
|
22
|
+
canCropImage: false,
|
|
23
|
+
canSelectCanvas: false,
|
|
24
|
+
canSelectManifest: true,
|
|
25
|
+
canSelectCollection: true,
|
|
26
|
+
// @todo fix the output so this one works.
|
|
27
|
+
multiSelect: false
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
const uiOptions = useMemo(() => {
|
|
31
|
+
return {
|
|
32
|
+
buttonClassName: "bg-me-primary-500 text-white hover:bg-me-primary-600"
|
|
33
|
+
};
|
|
34
|
+
}, []);
|
|
35
|
+
return /* @__PURE__ */ jsx(PreviewVaultBoundary, { children: /* @__PURE__ */ jsx(
|
|
36
|
+
IIIFBrowser,
|
|
37
|
+
{
|
|
38
|
+
debug: true,
|
|
39
|
+
ui: uiOptions,
|
|
40
|
+
vault,
|
|
41
|
+
className: "iiif-browser border-none border-t rounded-none h-[70vh] min-h-[60vh] max-h-full max-w-full",
|
|
42
|
+
output,
|
|
43
|
+
navigation: navigationOptions
|
|
44
|
+
}
|
|
45
|
+
) });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
ManifestBrowserCreatorForm
|
|
50
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// src/ContentResource/IIIFBrowserCreator/iiif-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 IIIFBrowserCreatorForm(props) {
|
|
8
|
+
const vault = useMemo(() => new Vault(), []);
|
|
9
|
+
const output = useMemo(() => {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
type: "callback",
|
|
13
|
+
label: "Select",
|
|
14
|
+
supportedTypes: ["Canvas", "CanvasList", "CanvasRegion", "ImageService", "ImageServiceRegion"],
|
|
15
|
+
cb: (resource) => props.runCreate({ output: resource }),
|
|
16
|
+
format: {
|
|
17
|
+
type: "custom",
|
|
18
|
+
format: (resource, parent, vault2) => {
|
|
19
|
+
console.log({ resource, parent });
|
|
20
|
+
return { resource: vault2.get(resource), parent };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
}, [props.runCreate]);
|
|
26
|
+
const navigationOptions = useMemo(() => {
|
|
27
|
+
return {
|
|
28
|
+
canCropImage: true,
|
|
29
|
+
canSelectCanvas: true,
|
|
30
|
+
canSelectManifest: false,
|
|
31
|
+
canSelectCollection: false,
|
|
32
|
+
// @todo fix the output so this one works.
|
|
33
|
+
multiSelect: true
|
|
34
|
+
};
|
|
35
|
+
}, []);
|
|
36
|
+
const uiOptions = useMemo(() => {
|
|
37
|
+
return {
|
|
38
|
+
buttonClassName: "bg-me-primary-500 text-white hover:bg-me-primary-600"
|
|
39
|
+
};
|
|
40
|
+
}, []);
|
|
41
|
+
return /* @__PURE__ */ jsx(PreviewVaultBoundary, { children: /* @__PURE__ */ jsx(
|
|
42
|
+
IIIFBrowser,
|
|
43
|
+
{
|
|
44
|
+
ui: uiOptions,
|
|
45
|
+
vault,
|
|
46
|
+
className: "iiif-browser border-none border-t rounded-none h-[70vh] min-h-[60vh] max-h-full max-w-full",
|
|
47
|
+
output,
|
|
48
|
+
navigation: navigationOptions
|
|
49
|
+
}
|
|
50
|
+
) });
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
IIIFBrowserCreatorForm as default
|
|
54
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// src/ContentResource/IIIFBrowserCreator/iiif-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 IIIFBrowserCreatorForm(props) {
|
|
8
|
+
const vault = useMemo(() => new Vault(), []);
|
|
9
|
+
const output = useMemo(() => {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
type: "callback",
|
|
13
|
+
label: "Select",
|
|
14
|
+
supportedTypes: ["Canvas", "CanvasList", "CanvasRegion", "ImageService", "ImageServiceRegion"],
|
|
15
|
+
cb: (resource) => props.runCreate({ output: resource }),
|
|
16
|
+
format: { type: "custom", format: (resource, parent, vault2) => ({ resource: vault2.get(resource), parent }) }
|
|
17
|
+
}
|
|
18
|
+
];
|
|
19
|
+
}, [props.runCreate]);
|
|
20
|
+
const navigationOptions = useMemo(() => {
|
|
21
|
+
return {
|
|
22
|
+
canCropImage: true,
|
|
23
|
+
canSelectCanvas: true,
|
|
24
|
+
canSelectManifest: false,
|
|
25
|
+
canSelectCollection: false,
|
|
26
|
+
// @todo fix the output so this one works.
|
|
27
|
+
multiSelect: true
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
const uiOptions = useMemo(() => {
|
|
31
|
+
return {
|
|
32
|
+
buttonClassName: "bg-me-primary-500 text-white hover:bg-me-primary-600"
|
|
33
|
+
};
|
|
34
|
+
}, []);
|
|
35
|
+
return /* @__PURE__ */ jsx(PreviewVaultBoundary, { children: /* @__PURE__ */ jsx(
|
|
36
|
+
IIIFBrowser,
|
|
37
|
+
{
|
|
38
|
+
ui: uiOptions,
|
|
39
|
+
vault,
|
|
40
|
+
className: "iiif-browser border-none border-t rounded-none h-[70vh] min-h-[60vh] max-h-full max-w-full",
|
|
41
|
+
output,
|
|
42
|
+
navigation: navigationOptions
|
|
43
|
+
}
|
|
44
|
+
) });
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
IIIFBrowserCreatorForm as default
|
|
48
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// src/ContentResource/IIIFBrowserCreator/iiif-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 IIIFBrowserCreatorForm(props) {
|
|
8
|
+
const vault = useMemo(() => new Vault(), []);
|
|
9
|
+
const output = useMemo(() => {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
type: "callback",
|
|
13
|
+
label: "Select",
|
|
14
|
+
supportedTypes: ["Canvas", "CanvasList", "CanvasRegion", "ImageService", "ImageServiceRegion"],
|
|
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];
|
|
20
|
+
const resources = [];
|
|
21
|
+
for (const resource2 of resourcesAsArray) {
|
|
22
|
+
resources.push({ resource: vault2.get(resource2), parent: resource2.parent });
|
|
23
|
+
}
|
|
24
|
+
return { resources };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
];
|
|
29
|
+
}, [props.runCreate]);
|
|
30
|
+
const navigationOptions = useMemo(() => {
|
|
31
|
+
return {
|
|
32
|
+
canCropImage: true,
|
|
33
|
+
canSelectCanvas: true,
|
|
34
|
+
canSelectManifest: false,
|
|
35
|
+
canSelectCollection: false,
|
|
36
|
+
// @todo fix the output so this one works.
|
|
37
|
+
multiSelect: true
|
|
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
|
+
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
|
+
export {
|
|
57
|
+
IIIFBrowserCreatorForm as default
|
|
58
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// src/ContentResource/IIIFBrowserCreator/iiif-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 IIIFBrowserCreatorForm(props) {
|
|
8
|
+
const vault = useMemo(() => new Vault(), []);
|
|
9
|
+
const output = useMemo(() => {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
type: "callback",
|
|
13
|
+
label: "Select",
|
|
14
|
+
supportedTypes: ["Canvas", "CanvasList", "CanvasRegion", "ImageService", "ImageServiceRegion"],
|
|
15
|
+
cb: (resource) => props.runCreate({ output: resource }),
|
|
16
|
+
format: {
|
|
17
|
+
type: "custom",
|
|
18
|
+
format: (resource, parent, vault2) => {
|
|
19
|
+
console.log({ resource });
|
|
20
|
+
const resourcesAsArray = Array.isArray(resource) ? resource : [{ ...resource, parent }];
|
|
21
|
+
const resources = [];
|
|
22
|
+
for (const resource2 of resourcesAsArray) {
|
|
23
|
+
resources.push({ resource: vault2.get(resource2), parent: resource2.parent, selector: resource2.selector });
|
|
24
|
+
}
|
|
25
|
+
return resources;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
];
|
|
30
|
+
}, [props.runCreate]);
|
|
31
|
+
const navigationOptions = useMemo(() => {
|
|
32
|
+
return {
|
|
33
|
+
canCropImage: true,
|
|
34
|
+
canSelectCanvas: true,
|
|
35
|
+
canSelectManifest: false,
|
|
36
|
+
canSelectCollection: false,
|
|
37
|
+
// @todo fix the output so this one works.
|
|
38
|
+
multiSelect: true
|
|
39
|
+
};
|
|
40
|
+
}, []);
|
|
41
|
+
const uiOptions = useMemo(() => {
|
|
42
|
+
return {
|
|
43
|
+
buttonClassName: "bg-me-primary-500 text-white hover:bg-me-primary-600"
|
|
44
|
+
};
|
|
45
|
+
}, []);
|
|
46
|
+
return /* @__PURE__ */ jsx(PreviewVaultBoundary, { children: /* @__PURE__ */ jsx(
|
|
47
|
+
IIIFBrowser,
|
|
48
|
+
{
|
|
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
|
+
export {
|
|
58
|
+
IIIFBrowserCreatorForm as default
|
|
59
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// src/ContentResource/IIIFBrowserCreator/iiif-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 IIIFBrowserCreatorForm(props) {
|
|
8
|
+
const vault = useMemo(() => new Vault(), []);
|
|
9
|
+
const output = useMemo(() => {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
type: "callback",
|
|
13
|
+
label: "Select",
|
|
14
|
+
supportedTypes: ["Canvas", "CanvasList", "CanvasRegion", "ImageService", "ImageServiceRegion"],
|
|
15
|
+
cb: (resource) => props.runCreate({ output: resource }),
|
|
16
|
+
format: {
|
|
17
|
+
type: "custom",
|
|
18
|
+
format: (resource, parent, vault2) => {
|
|
19
|
+
console.log({ resource });
|
|
20
|
+
const resourcesAsArray = Array.isArray(resource) ? resource : [{ ...resource, parent }];
|
|
21
|
+
const resources = [];
|
|
22
|
+
for (const resource2 of resourcesAsArray) {
|
|
23
|
+
resources.push({ resource: vault2.get(resource2), parent: resource2.parent, selector: resource2.selector });
|
|
24
|
+
}
|
|
25
|
+
return { resources };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
];
|
|
30
|
+
}, [props.runCreate]);
|
|
31
|
+
const navigationOptions = useMemo(() => {
|
|
32
|
+
return {
|
|
33
|
+
canCropImage: true,
|
|
34
|
+
canSelectCanvas: true,
|
|
35
|
+
canSelectManifest: false,
|
|
36
|
+
canSelectCollection: false,
|
|
37
|
+
// @todo fix the output so this one works.
|
|
38
|
+
multiSelect: true
|
|
39
|
+
};
|
|
40
|
+
}, []);
|
|
41
|
+
const uiOptions = useMemo(() => {
|
|
42
|
+
return {
|
|
43
|
+
buttonClassName: "bg-me-primary-500 text-white hover:bg-me-primary-600"
|
|
44
|
+
};
|
|
45
|
+
}, []);
|
|
46
|
+
return /* @__PURE__ */ jsx(PreviewVaultBoundary, { children: /* @__PURE__ */ jsx(
|
|
47
|
+
IIIFBrowser,
|
|
48
|
+
{
|
|
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
|
+
export {
|
|
58
|
+
IIIFBrowserCreatorForm as default
|
|
59
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// src/ContentResource/IIIFBrowserCreator/iiif-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 IIIFBrowserCreatorForm(props) {
|
|
8
|
+
const vault = useMemo(() => new Vault(), []);
|
|
9
|
+
const output = useMemo(() => {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
type: "callback",
|
|
13
|
+
label: "Select",
|
|
14
|
+
supportedTypes: ["Canvas", "CanvasList", "CanvasRegion", "ImageService", "ImageServiceRegion"],
|
|
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 resource;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
];
|
|
29
|
+
}, [props.runCreate]);
|
|
30
|
+
const navigationOptions = useMemo(() => {
|
|
31
|
+
return {
|
|
32
|
+
canCropImage: true,
|
|
33
|
+
canSelectCanvas: true,
|
|
34
|
+
canSelectManifest: false,
|
|
35
|
+
canSelectCollection: false,
|
|
36
|
+
// @todo fix the output so this one works.
|
|
37
|
+
multiSelect: true
|
|
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
|
+
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
|
+
export {
|
|
57
|
+
IIIFBrowserCreatorForm as default
|
|
58
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// src/ContentResource/IIIFBrowserCreator/iiif-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 IIIFBrowserCreatorForm(props) {
|
|
8
|
+
const vault = useMemo(() => new Vault(), []);
|
|
9
|
+
const output = useMemo(() => {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
type: "callback",
|
|
13
|
+
label: "Select",
|
|
14
|
+
supportedTypes: ["Canvas", "CanvasList", "CanvasRegion", "ImageService", "ImageServiceRegion"],
|
|
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: true,
|
|
33
|
+
canSelectCanvas: true,
|
|
34
|
+
canSelectManifest: false,
|
|
35
|
+
canSelectCollection: false,
|
|
36
|
+
// @todo fix the output so this one works.
|
|
37
|
+
multiSelect: true
|
|
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
|
+
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
|
+
export {
|
|
57
|
+
IIIFBrowserCreatorForm as default
|
|
58
|
+
};
|