@manifest-editor/creators 1.4.0 → 1.4.2

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.
@@ -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: { type: "content-state" }
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
- // @todo fix the output so this one works.
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
  }
@@ -2647,50 +2657,49 @@ var import_creator_api25 = require("@manifest-editor/creator-api");
2647
2657
  var import_helpers7 = require("@iiif/helpers");
2648
2658
  var import_react14 = require("react");
2649
2659
  async function createFromManifestBrowserOutput(data, ctx) {
2650
- const targetType = ctx.options.targetType;
2651
- if (Array.isArray(data.output)) {
2652
- throw new Error("Multiple items not yet supported");
2653
- }
2654
- const contentState = (0, import_helpers7.normaliseContentState)(
2655
- typeof data.output === "string" ? (0, import_helpers7.parseContentState)(data.output) : data.output
2656
- );
2657
- const target = contentState.target[0];
2658
- const previewVault = ctx.getPreviewVault();
2659
- const thumbnails = (0, import_helpers7.createThumbnailHelper)(previewVault);
2660
- if (!target) {
2661
- throw new Error("No target found in content state");
2662
- }
2663
- if (targetType === "Manifest") {
2664
- const manifestId = target.source.id;
2665
- invariant(manifestId, "Could not find Manifest ID");
2666
- const manifest = await previewVault.loadManifest(manifestId);
2667
- const thumbnail = await thumbnails.getBestThumbnailAtSize(manifest, { width: 256, height: 256 }, false);
2668
- invariant(manifest, "Manifest not found");
2669
- return ctx.embed({
2670
- id: target.source.id,
2671
- type: "Manifest",
2672
- label: manifest.label,
2673
- summary: manifest.summary,
2674
- thumbnail: thumbnail?.best ? [
2675
- {
2676
- id: thumbnail.best.id,
2677
- type: "Image"
2678
- }
2679
- ] : void 0
2680
- });
2681
- }
2682
- if (targetType === "Collection") {
2683
- const collectionId = target.source.id;
2684
- invariant(collectionId, "Could not find Manifest ID");
2685
- const collection = await previewVault.loadManifest(collectionId);
2686
- invariant(collection, "Collection not found");
2687
- return ctx.embed({
2688
- id: target.source.id,
2689
- type: "Collection",
2690
- label: collection.label
2691
- });
2660
+ const inputItems = data.output || [];
2661
+ const itemsToAdd = [];
2662
+ for (const item of inputItems) {
2663
+ const { resource, parent, selector } = item;
2664
+ const previewVault = ctx.getPreviewVault();
2665
+ const thumbnails = (0, import_helpers7.createThumbnailHelper)(previewVault);
2666
+ if (resource.type === "Manifest") {
2667
+ const manifestId = resource.id;
2668
+ invariant(manifestId, "Could not find Manifest ID");
2669
+ const manifest = await previewVault.loadManifest(manifestId);
2670
+ const thumbnail = await thumbnails.getBestThumbnailAtSize(manifest, { width: 256, height: 256 }, false);
2671
+ invariant(manifest, "Manifest not found");
2672
+ itemsToAdd.push(
2673
+ ctx.embed({
2674
+ id: resource.id,
2675
+ type: "Manifest",
2676
+ label: manifest.label,
2677
+ summary: manifest.summary,
2678
+ thumbnail: thumbnail?.best ? [
2679
+ {
2680
+ id: thumbnail.best.id,
2681
+ type: "Image"
2682
+ }
2683
+ ] : void 0
2684
+ })
2685
+ );
2686
+ continue;
2687
+ }
2688
+ if (resource.type === "Collection") {
2689
+ const collectionId = resource.id;
2690
+ invariant(collectionId, "Could not find Manifest ID");
2691
+ const collection = await previewVault.loadManifest(collectionId);
2692
+ invariant(collection, "Collection not found");
2693
+ itemsToAdd.push(
2694
+ ctx.embed({
2695
+ id: resource.id,
2696
+ type: "Collection",
2697
+ label: collection.label
2698
+ })
2699
+ );
2700
+ }
2692
2701
  }
2693
- throw new Error("Not yet supported.");
2702
+ return itemsToAdd;
2694
2703
  }
2695
2704
  var ManifestBrowserCreatorForm2 = (0, import_react14.lazy)(() => Promise.resolve().then(() => (init_manifest_browser_form_lazy(), manifest_browser_form_lazy_exports)));
2696
2705
 
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, ContentState } from '@iiif/helpers';
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: string | ContentState | ContentState[];
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<_manifest_editor_creator_api.CreatorResource>;
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, ContentState } from '@iiif/helpers';
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: string | ContentState | ContentState[];
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<_manifest_editor_creator_api.CreatorResource>;
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-S3JO5Y3Z.js";
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
  }
@@ -2446,55 +2447,54 @@ import { IIIFBrowserIcon as IIIFBrowserIcon2 } from "@manifest-editor/components
2446
2447
  import { defineCreator as defineCreator21 } from "@manifest-editor/creator-api";
2447
2448
 
2448
2449
  // src/Manifest/ManifestBrowserCreator/manifest-browser-creator.tsx
2449
- import { createThumbnailHelper, normaliseContentState as normaliseContentState2, parseContentState as parseContentState2 } from "@iiif/helpers";
2450
+ import { createThumbnailHelper } from "@iiif/helpers";
2450
2451
  import { lazy as lazy2 } from "react";
2451
2452
  async function createFromManifestBrowserOutput(data, ctx) {
2452
- const targetType = ctx.options.targetType;
2453
- if (Array.isArray(data.output)) {
2454
- throw new Error("Multiple items not yet supported");
2455
- }
2456
- const contentState = normaliseContentState2(
2457
- typeof data.output === "string" ? parseContentState2(data.output) : data.output
2458
- );
2459
- const target = contentState.target[0];
2460
- const previewVault = ctx.getPreviewVault();
2461
- const thumbnails = createThumbnailHelper(previewVault);
2462
- if (!target) {
2463
- throw new Error("No target found in content state");
2464
- }
2465
- if (targetType === "Manifest") {
2466
- const manifestId = target.source.id;
2467
- invariant(manifestId, "Could not find Manifest ID");
2468
- const manifest = await previewVault.loadManifest(manifestId);
2469
- const thumbnail = await thumbnails.getBestThumbnailAtSize(manifest, { width: 256, height: 256 }, false);
2470
- invariant(manifest, "Manifest not found");
2471
- return ctx.embed({
2472
- id: target.source.id,
2473
- type: "Manifest",
2474
- label: manifest.label,
2475
- summary: manifest.summary,
2476
- thumbnail: thumbnail?.best ? [
2477
- {
2478
- id: thumbnail.best.id,
2479
- type: "Image"
2480
- }
2481
- ] : void 0
2482
- });
2483
- }
2484
- if (targetType === "Collection") {
2485
- const collectionId = target.source.id;
2486
- invariant(collectionId, "Could not find Manifest ID");
2487
- const collection = await previewVault.loadManifest(collectionId);
2488
- invariant(collection, "Collection not found");
2489
- return ctx.embed({
2490
- id: target.source.id,
2491
- type: "Collection",
2492
- label: collection.label
2493
- });
2453
+ const inputItems = data.output || [];
2454
+ const itemsToAdd = [];
2455
+ for (const item of inputItems) {
2456
+ const { resource, parent, selector } = item;
2457
+ const previewVault = ctx.getPreviewVault();
2458
+ const thumbnails = createThumbnailHelper(previewVault);
2459
+ if (resource.type === "Manifest") {
2460
+ const manifestId = resource.id;
2461
+ invariant(manifestId, "Could not find Manifest ID");
2462
+ const manifest = await previewVault.loadManifest(manifestId);
2463
+ const thumbnail = await thumbnails.getBestThumbnailAtSize(manifest, { width: 256, height: 256 }, false);
2464
+ invariant(manifest, "Manifest not found");
2465
+ itemsToAdd.push(
2466
+ ctx.embed({
2467
+ id: resource.id,
2468
+ type: "Manifest",
2469
+ label: manifest.label,
2470
+ summary: manifest.summary,
2471
+ thumbnail: thumbnail?.best ? [
2472
+ {
2473
+ id: thumbnail.best.id,
2474
+ type: "Image"
2475
+ }
2476
+ ] : void 0
2477
+ })
2478
+ );
2479
+ continue;
2480
+ }
2481
+ if (resource.type === "Collection") {
2482
+ const collectionId = resource.id;
2483
+ invariant(collectionId, "Could not find Manifest ID");
2484
+ const collection = await previewVault.loadManifest(collectionId);
2485
+ invariant(collection, "Collection not found");
2486
+ itemsToAdd.push(
2487
+ ctx.embed({
2488
+ id: resource.id,
2489
+ type: "Collection",
2490
+ label: collection.label
2491
+ })
2492
+ );
2493
+ }
2494
2494
  }
2495
- throw new Error("Not yet supported.");
2495
+ return itemsToAdd;
2496
2496
  }
2497
- var ManifestBrowserCreatorForm2 = lazy2(() => import("./manifest-browser-form.lazy-HJJKFMR6.js"));
2497
+ var ManifestBrowserCreatorForm2 = lazy2(() => import("./manifest-browser-form.lazy-QGTJHSSC.js"));
2498
2498
 
2499
2499
  // src/Manifest/ManifestBrowserCreator/index.tsx
2500
2500
  import { jsx as jsx42 } from "react/jsx-runtime";
@@ -0,0 +1,6 @@
1
+ import {
2
+ ManifestBrowserCreatorForm
3
+ } from "./chunk-W4PYM3PN.js";
4
+ export {
5
+ ManifestBrowserCreatorForm as default
6
+ };
@@ -0,0 +1,6 @@
1
+ import {
2
+ ManifestBrowserCreatorForm
3
+ } from "./chunk-5YV7MYAZ.js";
4
+ export {
5
+ ManifestBrowserCreatorForm as default
6
+ };
@@ -0,0 +1,6 @@
1
+ import {
2
+ ManifestBrowserCreatorForm
3
+ } from "./chunk-2B2F7X4A.js";
4
+ export {
5
+ ManifestBrowserCreatorForm as default
6
+ };
@@ -0,0 +1,6 @@
1
+ import {
2
+ ManifestBrowserCreatorForm
3
+ } from "./chunk-CYVZA2MU.js";
4
+ export {
5
+ ManifestBrowserCreatorForm as default
6
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manifest-editor/creators",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "type": "module",
5
5
  "bugs": "https://github.com/digirati-co-uk/iiif-manifest-editor/issues",
6
6
  "repository": {
@@ -47,12 +47,12 @@
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.0",
51
- "@manifest-editor/creator-api": "1.4.0",
50
+ "@manifest-editor/components": "1.4.2",
51
+ "@manifest-editor/creator-api": "1.4.2",
52
52
  "@manifest-editor/editor-api": "1.4.0",
53
- "@manifest-editor/editors": "1.4.0",
54
- "@manifest-editor/iiif-browser": "1.4.0",
55
- "@manifest-editor/shell": "1.4.0",
53
+ "@manifest-editor/editors": "1.4.2",
54
+ "@manifest-editor/iiif-browser": "1.4.1",
55
+ "@manifest-editor/shell": "1.4.2",
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": "4ca76024a42ec30c958f476a6fcd8d10592c12d3"
74
+ "gitHead": "7da90acfb83545d53d34ba95b86c8d5492005e81"
75
75
  }