@manifest-editor/exhibition-preset 1.3.1 → 1.4.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.
Files changed (3) hide show
  1. package/dist/index.cjs +164 -184
  2. package/dist/index.js +174 -188
  3. package/package.json +11 -11
package/dist/index.cjs CHANGED
@@ -623,13 +623,7 @@ var import_jsx_runtime7 = require("react/jsx-runtime");
623
623
  var youtubeMainEdtior = {
624
624
  id: "youtube-main-editor",
625
625
  label: "YouTube main editor",
626
- component: (strategy) => strategy.type === "media" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
627
- YouTubeEditor,
628
- {
629
- strategy,
630
- video: strategy.media
631
- }
632
- ) : null,
626
+ component: (strategy) => strategy.type === "media" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(YouTubeEditor, { strategy, video: strategy.media }) : null,
633
627
  supports: {
634
628
  strategy: (strategy, resource, vault) => {
635
629
  console.log(strategy);
@@ -643,10 +637,7 @@ var youtubeMainEdtior = {
643
637
  }
644
638
  }
645
639
  };
646
- function YouTubeEditor({
647
- strategy,
648
- video
649
- }) {
640
+ function YouTubeEditor({ strategy, video }) {
650
641
  const { edit } = (0, import_shell4.useLayoutActions)();
651
642
  const canvas = (0, import_react_iiif_vault5.useCanvas)();
652
643
  const annotationRef = (0, import_react_iiif_vault5.useVaultSelector)((_2, v2) => {
@@ -658,26 +649,19 @@ function YouTubeEditor({
658
649
  const annotation = (0, import_shell4.useGenericEditor)(annotationRef);
659
650
  const media = video;
660
651
  const ar = (canvas.width || 1) / (canvas.height || 1);
661
- const ytThumbnail = `https://img.youtube.com/vi/${media.youTubeId}/0.jpg`;
652
+ const ytThumbnail = `https://img.youtube.com/vi/${media.youTubeId}/maxresdefault.jpg`;
662
653
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "overflow-y-auto", children: [
663
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "p-8", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
664
- "div",
654
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "p-8", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "bg-black z-20 flex p-8 rounded-lg max-w-full max-h-[70vh] mx-auto", style: { aspectRatio: ar }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
655
+ "iframe",
665
656
  {
666
- className: "bg-black z-20 flex p-8 rounded-lg max-w-full max-h-[70vh] mx-auto",
667
- style: { aspectRatio: ar },
668
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
669
- "iframe",
670
- {
671
- title: "YouTube video",
672
- className: "border-none w-full h-full object-contain",
673
- ref: player,
674
- src: `https://www.youtube.com/embed/${media.youTubeId}?enablejsapi=1&origin=${window.location.host}`,
675
- referrerPolicy: "no-referrer",
676
- sandbox: "allow-scripts allow-same-origin allow-presentation"
677
- }
678
- )
657
+ title: "YouTube video",
658
+ className: "border-none w-full h-full object-contain",
659
+ ref: player,
660
+ src: `https://www.youtube.com/embed/${media.youTubeId}?enablejsapi=1&origin=${window.location.host}`,
661
+ referrerPolicy: "no-referrer",
662
+ sandbox: "allow-scripts allow-same-origin allow-presentation"
679
663
  }
680
- ) }),
664
+ ) }) }),
681
665
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "bg-white shadow w-full p-8 flex gap-8", children: [
682
666
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
683
667
  "div",
@@ -713,13 +697,119 @@ function YouTubeEditor({
713
697
  }
714
698
 
715
699
  // src/creators/image-browser-slide-creator.tsx
700
+ var import_creator_api = require("@manifest-editor/creator-api");
716
701
  var import_creators = require("@manifest-editor/creators");
702
+ var imageBrowserSlideCreator = (0, import_creator_api.defineCreator)({
703
+ ...import_creators.iiifBrowserCreator,
704
+ id: "@exhibitions/browser-creator",
705
+ create: createBrowser,
706
+ tags: ["image", "exhibition-slide"],
707
+ label: "IIIF Browser",
708
+ summary: "Browse IIIF Resources"
709
+ });
710
+ async function createBrowser(data, ctx) {
711
+ const canvasId = ctx.generateId("canvas");
712
+ const pageId = ctx.generateId("annotation-page", {
713
+ id: canvasId,
714
+ type: "Canvas"
715
+ });
716
+ const dimensions = { width: 0, height: 0 };
717
+ const createBrowserAnnotation = (0, import_creator_api.creatorHelper)(
718
+ ctx,
719
+ { id: pageId, type: "AnnotationPage" },
720
+ "items",
721
+ "@manifest-editor/iiif-browser-creator"
722
+ );
723
+ const annotation = await createBrowserAnnotation(
724
+ {
725
+ ...data,
726
+ trackSize({ width, height }) {
727
+ dimensions.height = height;
728
+ dimensions.width = width;
729
+ }
730
+ },
731
+ {
732
+ targetType: "Annotation",
733
+ target: {
734
+ id: canvasId,
735
+ type: "Canvas"
736
+ }
737
+ }
738
+ );
739
+ const createSlide = (0, import_creator_api.creatorHelper)(ctx, "Manifest", "items", "@exhibitions/image-slide-creator");
740
+ return await createSlide({
741
+ canvasId,
742
+ width: dimensions.width,
743
+ height: dimensions.height,
744
+ type: "default",
745
+ // default / left / right / bottom
746
+ items: annotation
747
+ });
748
+ }
749
+
750
+ // src/creators/image-service-slide-creator.tsx
751
+ var import_creator_api2 = require("@manifest-editor/creator-api");
752
+ var import_creators2 = require("@manifest-editor/creators");
753
+ var imageServiceSlideCreator = (0, import_creator_api2.defineCreator)({
754
+ ...import_creators2.imageServiceCreator,
755
+ id: "@exhibitions/image-service-creator",
756
+ create: createImageService,
757
+ tags: ["image", "exhibition-slide"],
758
+ label: "IIIF Image",
759
+ summary: "IIIF Image service",
760
+ resourceType: "Canvas",
761
+ supports: {
762
+ parentTypes: ["Manifest"],
763
+ parentFields: ["items"]
764
+ }
765
+ });
766
+ async function createImageService(data, ctx) {
767
+ const canvasId = ctx.generateId("canvas");
768
+ const pageId = ctx.generateId("annotation-page", {
769
+ id: canvasId,
770
+ type: "Canvas"
771
+ });
772
+ const annotationId = ctx.generateId("annotation");
773
+ const createImageService2 = (0, import_creator_api2.creatorHelper)(
774
+ ctx,
775
+ { id: annotationId, type: "Annotation" },
776
+ "body",
777
+ "@manifest-editor/image-service-creator"
778
+ );
779
+ const resource = await createImageService2(data, {
780
+ target: {
781
+ id: canvasId,
782
+ type: "Canvas"
783
+ }
784
+ });
785
+ const { width, height } = resource.get();
786
+ const annotation = ctx.embed({
787
+ id: ctx.generateId("annotation"),
788
+ type: "Annotation",
789
+ motivation: "painting",
790
+ body: [resource],
791
+ target: {
792
+ type: "SpecificResource",
793
+ source: { id: canvasId, type: "Canvas" }
794
+ }
795
+ });
796
+ const createSlide = (0, import_creator_api2.creatorHelper)(ctx, "Manifest", "items", "@exhibitions/image-slide-creator");
797
+ return await createSlide({
798
+ canvasId,
799
+ width,
800
+ height,
801
+ type: "default",
802
+ // default / left / right / bottom
803
+ items: [annotation]
804
+ });
805
+ }
717
806
 
718
807
  // src/creators/image-slide-creator.tsx
719
808
  var import_parser = require("@iiif/parser");
720
809
  var import_components5 = require("@manifest-editor/components");
810
+ var import_creator_api3 = require("@manifest-editor/creator-api");
721
811
  var import_jsx_runtime8 = require("react/jsx-runtime");
722
- var imageSlideCreator = {
812
+ var imageSlideCreator = (0, import_creator_api3.defineCreator)({
723
813
  id: "@exhibitions/image-slide-creator",
724
814
  create: createImageSlide,
725
815
  label: "Empty slide",
@@ -733,31 +823,31 @@ var imageSlideCreator = {
733
823
  parentTypes: ["Manifest"],
734
824
  parentFields: ["items"]
735
825
  }
736
- };
737
- var imageSlideLeftCreator = {
826
+ });
827
+ var imageSlideLeftCreator = (0, import_creator_api3.defineCreator)({
738
828
  ...imageSlideCreator,
739
829
  id: "@exhibitions/image-slide-creator-left",
740
830
  label: "Image (Left)",
741
831
  summary: "An image with text on the left.",
742
832
  icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: "IMAGE (LEFT)" }),
743
833
  create: (payload, ctx) => createImageSlide({ ...payload, type: "left" }, ctx)
744
- };
745
- var imageSlideRightCreator = {
834
+ });
835
+ var imageSlideRightCreator = (0, import_creator_api3.defineCreator)({
746
836
  ...imageSlideCreator,
747
837
  id: "@exhibitions/image-slide-creator-right",
748
838
  label: "Image (Right)",
749
839
  summary: "An image with text on the right.",
750
840
  icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: "IMAGE (RIGHT)" }),
751
841
  create: (payload, ctx) => createImageSlide({ ...payload, type: "right" }, ctx)
752
- };
753
- var imageSlideBottomCreator = {
842
+ });
843
+ var imageSlideBottomCreator = (0, import_creator_api3.defineCreator)({
754
844
  ...imageSlideCreator,
755
845
  id: "@exhibitions/image-slide-creator-bottom",
756
846
  label: "Image (Bottom)",
757
847
  summary: "An image with text at the bottom.",
758
848
  icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: "IMAGE (BOTTOM)" }),
759
849
  create: (payload, ctx) => createImageSlide({ ...payload, type: "bottom" }, ctx)
760
- };
850
+ });
761
851
  function createImageSlide(payload, ctx) {
762
852
  const canvasId = payload.canvasId || ctx.generateId("Canvas");
763
853
  const itemsPageId = ctx.generateId("AnnotationPage", {
@@ -827,113 +917,10 @@ function createImageSlide(payload, ctx) {
827
917
  });
828
918
  }
829
919
 
830
- // src/creators/image-browser-slide-creator.tsx
831
- var imageBrowserSlideCreator = {
832
- ...import_creators.iiifBrowserCreator,
833
- id: "@exhibitions/browser-creator",
834
- create: createBrowser,
835
- tags: ["image", "exhibition-slide"],
836
- label: "IIIF Browser",
837
- summary: "Browse IIIF Resources"
838
- };
839
- async function createBrowser(data, ctx) {
840
- const canvasId = ctx.generateId("canvas");
841
- const pageId = ctx.generateId("annotation-page", {
842
- id: canvasId,
843
- type: "Canvas"
844
- });
845
- const dimensions = { width: 0, height: 0 };
846
- const annotation = await ctx.create(
847
- import_creators.iiifBrowserCreator.id,
848
- {
849
- ...data,
850
- trackSize({ width, height }) {
851
- dimensions.height = height;
852
- dimensions.width = width;
853
- }
854
- },
855
- {
856
- target: {
857
- id: canvasId,
858
- type: "Canvas"
859
- },
860
- targetType: "Annotation",
861
- parent: {
862
- resource: { id: pageId, type: "AnnotationPage" },
863
- property: "items"
864
- }
865
- }
866
- );
867
- return await ctx.create(imageSlideCreator.id, {
868
- canvasId,
869
- width: dimensions.width,
870
- height: dimensions.height,
871
- type: "default",
872
- // default / left / right / bottom
873
- items: [annotation]
874
- });
875
- }
876
-
877
- // src/creators/image-service-slide-creator.tsx
878
- var import_creators2 = require("@manifest-editor/creators");
879
- var imageServiceSlideCreator = {
880
- ...import_creators2.imageServiceCreator,
881
- id: "@exhibitions/image-service-creator",
882
- create: createImageService,
883
- tags: ["image", "exhibition-slide"],
884
- label: "IIIF Image",
885
- summary: "IIIF Image service",
886
- resourceType: "Canvas",
887
- supports: {
888
- parentTypes: ["Manifest"],
889
- parentFields: ["items"]
890
- }
891
- };
892
- async function createImageService(data, ctx) {
893
- const canvasId = ctx.generateId("canvas");
894
- const pageId = ctx.generateId("annotation-page", {
895
- id: canvasId,
896
- type: "Canvas"
897
- });
898
- const resource = await ctx.create(
899
- import_creators2.imageServiceCreator.id,
900
- data,
901
- {
902
- target: {
903
- id: canvasId,
904
- type: "Canvas"
905
- },
906
- targetType: "Annotation",
907
- parent: {
908
- resource: { id: pageId, type: "AnnotationPage" },
909
- property: "items"
910
- }
911
- }
912
- );
913
- const { width, height } = resource.get();
914
- const annotation = ctx.embed({
915
- id: ctx.generateId("annotation"),
916
- type: "Annotation",
917
- motivation: "painting",
918
- body: [resource],
919
- target: {
920
- type: "SpecificResource",
921
- source: { id: canvasId, type: "Canvas" }
922
- }
923
- });
924
- return await ctx.create(imageSlideCreator.id, {
925
- canvasId,
926
- width,
927
- height,
928
- type: "default",
929
- // default / left / right / bottom
930
- items: [annotation]
931
- });
932
- }
933
-
934
920
  // src/creators/image-url-slide.tsx
921
+ var import_creator_api4 = require("@manifest-editor/creator-api");
935
922
  var import_creators3 = require("@manifest-editor/creators");
936
- var imageUrlSlideCreator = {
923
+ var imageUrlSlideCreator = (0, import_creator_api4.defineCreator)({
937
924
  ...import_creators3.imageUrlCreator,
938
925
  id: "@exhibitions/image-url-creator",
939
926
  create: createUrlSlide,
@@ -945,31 +932,30 @@ var imageUrlSlideCreator = {
945
932
  parentTypes: ["Manifest"],
946
933
  parentFields: ["items"]
947
934
  }
948
- };
935
+ });
949
936
  async function createUrlSlide(data, ctx) {
950
937
  const canvasId = ctx.generateId("canvas");
951
938
  const pageId = ctx.generateId("annotation-page", {
952
939
  id: canvasId,
953
940
  type: "Canvas"
954
941
  });
955
- const resource = await ctx.create(
956
- import_creators3.imageUrlCreator.id,
957
- data,
958
- {
959
- target: {
960
- id: canvasId,
961
- type: "Canvas"
962
- },
963
- targetType: "Annotation",
964
- parent: {
965
- resource: { id: pageId, type: "AnnotationPage" },
966
- property: "items"
967
- }
968
- }
942
+ const annotationId = ctx.generateId("annotation");
943
+ const createImageUrl = (0, import_creator_api4.creatorHelper)(
944
+ ctx,
945
+ { id: annotationId, type: "Annotation" },
946
+ "body",
947
+ "@manifest-editor/image-url-creator"
969
948
  );
949
+ const resource = await createImageUrl(data, {
950
+ target: {
951
+ id: canvasId,
952
+ type: "Canvas"
953
+ },
954
+ targetType: "Annotation"
955
+ });
970
956
  const { width, height } = resource.get();
971
957
  const annotation = ctx.embed({
972
- id: ctx.generateId("annotation"),
958
+ id: annotationId,
973
959
  type: "Annotation",
974
960
  motivation: "painting",
975
961
  body: [resource],
@@ -978,7 +964,8 @@ async function createUrlSlide(data, ctx) {
978
964
  source: { id: canvasId, type: "Canvas" }
979
965
  }
980
966
  });
981
- return await ctx.create(imageSlideCreator.id, {
967
+ const createSlide = (0, import_creator_api4.creatorHelper)(ctx, "Manifest", "items", "@exhibitions/image-slide-creator");
968
+ return await createSlide({
982
969
  canvasId,
983
970
  width,
984
971
  height,
@@ -990,31 +977,23 @@ async function createUrlSlide(data, ctx) {
990
977
 
991
978
  // src/creators/info-box-creator.tsx
992
979
  var import_parser2 = require("@iiif/parser");
980
+ var import_creator_api5 = require("@manifest-editor/creator-api");
993
981
  var import_jsx_runtime9 = require("react/jsx-runtime");
994
- var infoBoxCreator = {
982
+ var infoBoxCreator = (0, import_creator_api5.defineCreator)({
995
983
  id: "@exhibitions/info-box-creator",
996
984
  create: createInfoBox,
997
985
  label: "Info box",
998
986
  summary: "A text panel for an exhibition",
999
- icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1000
- "svg",
1001
- {
1002
- xmlns: "http://www.w3.org/2000/svg",
1003
- width: "1em",
1004
- height: "1em",
1005
- viewBox: "0 0 24 24",
1006
- children: [
1007
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("title", { children: "Info box" }),
1008
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1009
- "path",
1010
- {
1011
- fill: "currentColor",
1012
- d: "M11 17h2v-6h-2zm1-8q.425 0 .713-.288T13 8t-.288-.712T12 7t-.712.288T11 8t.288.713T12 9m0 13q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22"
1013
- }
1014
- )
1015
- ]
1016
- }
1017
- ),
987
+ icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", children: [
988
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("title", { children: "Info box" }),
989
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
990
+ "path",
991
+ {
992
+ fill: "currentColor",
993
+ d: "M11 17h2v-6h-2zm1-8q.425 0 .713-.288T13 8t-.288-.712T12 7t-.712.288T11 8t.288.713T12 9m0 13q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22"
994
+ }
995
+ )
996
+ ] }),
1018
997
  tags: ["exhibition-slide"],
1019
998
  resourceType: "Canvas",
1020
999
  resourceFields: ["id", "type", "label", "height", "width", "items"],
@@ -1022,7 +1001,7 @@ var infoBoxCreator = {
1022
1001
  parentTypes: ["Manifest"],
1023
1002
  parentFields: ["items"]
1024
1003
  }
1025
- };
1004
+ });
1026
1005
  async function createInfoBox(data, ctx) {
1027
1006
  const canvasId = ctx.generateId("canvas");
1028
1007
  const pageId = ctx.generateId("annotation-page", {
@@ -1111,16 +1090,17 @@ async function createInfoBox(data, ctx) {
1111
1090
 
1112
1091
  // src/creators/youtube-slide-creator.tsx
1113
1092
  var import_parser3 = require("@iiif/parser");
1093
+ var import_creator_api6 = require("@manifest-editor/creator-api");
1114
1094
  var import_creators4 = require("@manifest-editor/creators");
1115
1095
  var import_editors3 = require("@manifest-editor/editors");
1116
- var youtubeSlideCreator = {
1096
+ var youtubeSlideCreator = (0, import_creator_api6.defineCreator)({
1117
1097
  ...import_creators4.youTubeBodyCreator,
1118
1098
  id: "@exhibitions/youtube-creator",
1119
1099
  create: createYoutube,
1120
1100
  tags: ["video", "exhibition-slide"],
1121
1101
  label: "YouTube",
1122
1102
  summary: "A YouTube for an exhibition"
1123
- };
1103
+ });
1124
1104
  async function createYoutube(data, ctx) {
1125
1105
  const ytId = (0, import_editors3.getYouTubeId)(data.youtubeUrl);
1126
1106
  const canvasId = ctx.generateId("canvas");
@@ -1145,10 +1125,10 @@ async function createYoutube(data, ctx) {
1145
1125
  items: [annotation]
1146
1126
  });
1147
1127
  const thumbnail = ctx.embed({
1148
- id: `https://img.youtube.com/vi/${ytId}/0.jpg`,
1128
+ id: `https://img.youtube.com/vi/${ytId}/maxresdefault.jpg`,
1149
1129
  type: "Image",
1150
1130
  format: "image/jpeg",
1151
- width: 480,
1131
+ width: 640,
1152
1132
  height: 360
1153
1133
  });
1154
1134
  return ctx.embed({
@@ -1346,7 +1326,7 @@ function SortableExhibitionItem({
1346
1326
  onClick,
1347
1327
  isFirst,
1348
1328
  item,
1349
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "absolute bg-white text-2xl p-1 top-0.5 right-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ResizeHandleIcon, {}) })
1329
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "absolute bg-white text-2xl p-1 top-0.5 right-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ResizeHandleIcon, { "aria-label": "Reorder item" }) })
1350
1330
  }
1351
1331
  );
1352
1332
  }
package/dist/index.js CHANGED
@@ -629,10 +629,7 @@ function AnnotationEditor() {
629
629
 
630
630
  // src/canvas-editors/youtube-editor.tsx
631
631
  import { ActionButton as ActionButton4, LazyThumbnail } from "@manifest-editor/components";
632
- import {
633
- useGenericEditor as useGenericEditor4,
634
- useLayoutActions
635
- } from "@manifest-editor/shell";
632
+ import { useGenericEditor as useGenericEditor4, useLayoutActions } from "@manifest-editor/shell";
636
633
  import { useRef as useRef2 } from "react";
637
634
  import {
638
635
  LocaleString as LocaleString2,
@@ -644,13 +641,7 @@ import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
644
641
  var youtubeMainEdtior = {
645
642
  id: "youtube-main-editor",
646
643
  label: "YouTube main editor",
647
- component: (strategy) => strategy.type === "media" ? /* @__PURE__ */ jsx7(
648
- YouTubeEditor,
649
- {
650
- strategy,
651
- video: strategy.media
652
- }
653
- ) : null,
644
+ component: (strategy) => strategy.type === "media" ? /* @__PURE__ */ jsx7(YouTubeEditor, { strategy, video: strategy.media }) : null,
654
645
  supports: {
655
646
  strategy: (strategy, resource, vault) => {
656
647
  console.log(strategy);
@@ -664,10 +655,7 @@ var youtubeMainEdtior = {
664
655
  }
665
656
  }
666
657
  };
667
- function YouTubeEditor({
668
- strategy,
669
- video
670
- }) {
658
+ function YouTubeEditor({ strategy, video }) {
671
659
  const { edit } = useLayoutActions();
672
660
  const canvas = useCanvas5();
673
661
  const annotationRef = useVaultSelector2((_2, v2) => {
@@ -679,26 +667,19 @@ function YouTubeEditor({
679
667
  const annotation = useGenericEditor4(annotationRef);
680
668
  const media = video;
681
669
  const ar = (canvas.width || 1) / (canvas.height || 1);
682
- const ytThumbnail = `https://img.youtube.com/vi/${media.youTubeId}/0.jpg`;
670
+ const ytThumbnail = `https://img.youtube.com/vi/${media.youTubeId}/maxresdefault.jpg`;
683
671
  return /* @__PURE__ */ jsxs4("div", { className: "overflow-y-auto", children: [
684
- /* @__PURE__ */ jsx7("div", { className: "p-8", children: /* @__PURE__ */ jsx7(
685
- "div",
672
+ /* @__PURE__ */ jsx7("div", { className: "p-8", children: /* @__PURE__ */ jsx7("div", { className: "bg-black z-20 flex p-8 rounded-lg max-w-full max-h-[70vh] mx-auto", style: { aspectRatio: ar }, children: /* @__PURE__ */ jsx7(
673
+ "iframe",
686
674
  {
687
- className: "bg-black z-20 flex p-8 rounded-lg max-w-full max-h-[70vh] mx-auto",
688
- style: { aspectRatio: ar },
689
- children: /* @__PURE__ */ jsx7(
690
- "iframe",
691
- {
692
- title: "YouTube video",
693
- className: "border-none w-full h-full object-contain",
694
- ref: player,
695
- src: `https://www.youtube.com/embed/${media.youTubeId}?enablejsapi=1&origin=${window.location.host}`,
696
- referrerPolicy: "no-referrer",
697
- sandbox: "allow-scripts allow-same-origin allow-presentation"
698
- }
699
- )
675
+ title: "YouTube video",
676
+ className: "border-none w-full h-full object-contain",
677
+ ref: player,
678
+ src: `https://www.youtube.com/embed/${media.youTubeId}?enablejsapi=1&origin=${window.location.host}`,
679
+ referrerPolicy: "no-referrer",
680
+ sandbox: "allow-scripts allow-same-origin allow-presentation"
700
681
  }
701
- ) }),
682
+ ) }) }),
702
683
  /* @__PURE__ */ jsxs4("div", { className: "bg-white shadow w-full p-8 flex gap-8", children: [
703
684
  /* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(
704
685
  "div",
@@ -734,13 +715,125 @@ function YouTubeEditor({
734
715
  }
735
716
 
736
717
  // src/creators/image-browser-slide-creator.tsx
718
+ import {
719
+ creatorHelper,
720
+ defineCreator
721
+ } from "@manifest-editor/creator-api";
737
722
  import { iiifBrowserCreator } from "@manifest-editor/creators";
723
+ var imageBrowserSlideCreator = defineCreator({
724
+ ...iiifBrowserCreator,
725
+ id: "@exhibitions/browser-creator",
726
+ create: createBrowser,
727
+ tags: ["image", "exhibition-slide"],
728
+ label: "IIIF Browser",
729
+ summary: "Browse IIIF Resources"
730
+ });
731
+ async function createBrowser(data, ctx) {
732
+ const canvasId = ctx.generateId("canvas");
733
+ const pageId = ctx.generateId("annotation-page", {
734
+ id: canvasId,
735
+ type: "Canvas"
736
+ });
737
+ const dimensions = { width: 0, height: 0 };
738
+ const createBrowserAnnotation = creatorHelper(
739
+ ctx,
740
+ { id: pageId, type: "AnnotationPage" },
741
+ "items",
742
+ "@manifest-editor/iiif-browser-creator"
743
+ );
744
+ const annotation = await createBrowserAnnotation(
745
+ {
746
+ ...data,
747
+ trackSize({ width, height }) {
748
+ dimensions.height = height;
749
+ dimensions.width = width;
750
+ }
751
+ },
752
+ {
753
+ targetType: "Annotation",
754
+ target: {
755
+ id: canvasId,
756
+ type: "Canvas"
757
+ }
758
+ }
759
+ );
760
+ const createSlide = creatorHelper(ctx, "Manifest", "items", "@exhibitions/image-slide-creator");
761
+ return await createSlide({
762
+ canvasId,
763
+ width: dimensions.width,
764
+ height: dimensions.height,
765
+ type: "default",
766
+ // default / left / right / bottom
767
+ items: annotation
768
+ });
769
+ }
770
+
771
+ // src/creators/image-service-slide-creator.tsx
772
+ import {
773
+ creatorHelper as creatorHelper2,
774
+ defineCreator as defineCreator2
775
+ } from "@manifest-editor/creator-api";
776
+ import { imageServiceCreator } from "@manifest-editor/creators";
777
+ var imageServiceSlideCreator = defineCreator2({
778
+ ...imageServiceCreator,
779
+ id: "@exhibitions/image-service-creator",
780
+ create: createImageService,
781
+ tags: ["image", "exhibition-slide"],
782
+ label: "IIIF Image",
783
+ summary: "IIIF Image service",
784
+ resourceType: "Canvas",
785
+ supports: {
786
+ parentTypes: ["Manifest"],
787
+ parentFields: ["items"]
788
+ }
789
+ });
790
+ async function createImageService(data, ctx) {
791
+ const canvasId = ctx.generateId("canvas");
792
+ const pageId = ctx.generateId("annotation-page", {
793
+ id: canvasId,
794
+ type: "Canvas"
795
+ });
796
+ const annotationId = ctx.generateId("annotation");
797
+ const createImageService2 = creatorHelper2(
798
+ ctx,
799
+ { id: annotationId, type: "Annotation" },
800
+ "body",
801
+ "@manifest-editor/image-service-creator"
802
+ );
803
+ const resource = await createImageService2(data, {
804
+ target: {
805
+ id: canvasId,
806
+ type: "Canvas"
807
+ }
808
+ });
809
+ const { width, height } = resource.get();
810
+ const annotation = ctx.embed({
811
+ id: ctx.generateId("annotation"),
812
+ type: "Annotation",
813
+ motivation: "painting",
814
+ body: [resource],
815
+ target: {
816
+ type: "SpecificResource",
817
+ source: { id: canvasId, type: "Canvas" }
818
+ }
819
+ });
820
+ const createSlide = creatorHelper2(ctx, "Manifest", "items", "@exhibitions/image-slide-creator");
821
+ return await createSlide({
822
+ canvasId,
823
+ width,
824
+ height,
825
+ type: "default",
826
+ // default / left / right / bottom
827
+ items: [annotation]
828
+ });
829
+ }
738
830
 
739
831
  // src/creators/image-slide-creator.tsx
740
832
  import { emptyAnnotationPage, emptyCanvas } from "@iiif/parser";
741
833
  import { EmptyCanvasIcon } from "@manifest-editor/components";
834
+ import { defineCreator as defineCreator3 } from "@manifest-editor/creator-api";
742
835
  import { jsx as jsx8 } from "react/jsx-runtime";
743
- var imageSlideCreator = {
836
+ var imageSlideCreator = defineCreator3({
744
837
  id: "@exhibitions/image-slide-creator",
745
838
  create: createImageSlide,
746
839
  label: "Empty slide",
@@ -754,31 +847,31 @@ var imageSlideCreator = {
754
847
  parentTypes: ["Manifest"],
755
848
  parentFields: ["items"]
756
849
  }
757
- };
758
- var imageSlideLeftCreator = {
850
+ });
851
+ var imageSlideLeftCreator = defineCreator3({
759
852
  ...imageSlideCreator,
760
853
  id: "@exhibitions/image-slide-creator-left",
761
854
  label: "Image (Left)",
762
855
  summary: "An image with text on the left.",
763
856
  icon: /* @__PURE__ */ jsx8("div", { children: "IMAGE (LEFT)" }),
764
857
  create: (payload, ctx) => createImageSlide({ ...payload, type: "left" }, ctx)
765
- };
766
- var imageSlideRightCreator = {
858
+ });
859
+ var imageSlideRightCreator = defineCreator3({
767
860
  ...imageSlideCreator,
768
861
  id: "@exhibitions/image-slide-creator-right",
769
862
  label: "Image (Right)",
770
863
  summary: "An image with text on the right.",
771
864
  icon: /* @__PURE__ */ jsx8("div", { children: "IMAGE (RIGHT)" }),
772
865
  create: (payload, ctx) => createImageSlide({ ...payload, type: "right" }, ctx)
773
- };
774
- var imageSlideBottomCreator = {
866
+ });
867
+ var imageSlideBottomCreator = defineCreator3({
775
868
  ...imageSlideCreator,
776
869
  id: "@exhibitions/image-slide-creator-bottom",
777
870
  label: "Image (Bottom)",
778
871
  summary: "An image with text at the bottom.",
779
872
  icon: /* @__PURE__ */ jsx8("div", { children: "IMAGE (BOTTOM)" }),
780
873
  create: (payload, ctx) => createImageSlide({ ...payload, type: "bottom" }, ctx)
781
- };
874
+ });
782
875
  function createImageSlide(payload, ctx) {
783
876
  const canvasId = payload.canvasId || ctx.generateId("Canvas");
784
877
  const itemsPageId = ctx.generateId("AnnotationPage", {
@@ -848,113 +941,13 @@ function createImageSlide(payload, ctx) {
848
941
  });
849
942
  }
850
943
 
851
- // src/creators/image-browser-slide-creator.tsx
852
- var imageBrowserSlideCreator = {
853
- ...iiifBrowserCreator,
854
- id: "@exhibitions/browser-creator",
855
- create: createBrowser,
856
- tags: ["image", "exhibition-slide"],
857
- label: "IIIF Browser",
858
- summary: "Browse IIIF Resources"
859
- };
860
- async function createBrowser(data, ctx) {
861
- const canvasId = ctx.generateId("canvas");
862
- const pageId = ctx.generateId("annotation-page", {
863
- id: canvasId,
864
- type: "Canvas"
865
- });
866
- const dimensions = { width: 0, height: 0 };
867
- const annotation = await ctx.create(
868
- iiifBrowserCreator.id,
869
- {
870
- ...data,
871
- trackSize({ width, height }) {
872
- dimensions.height = height;
873
- dimensions.width = width;
874
- }
875
- },
876
- {
877
- target: {
878
- id: canvasId,
879
- type: "Canvas"
880
- },
881
- targetType: "Annotation",
882
- parent: {
883
- resource: { id: pageId, type: "AnnotationPage" },
884
- property: "items"
885
- }
886
- }
887
- );
888
- return await ctx.create(imageSlideCreator.id, {
889
- canvasId,
890
- width: dimensions.width,
891
- height: dimensions.height,
892
- type: "default",
893
- // default / left / right / bottom
894
- items: [annotation]
895
- });
896
- }
897
-
898
- // src/creators/image-service-slide-creator.tsx
899
- import { imageServiceCreator } from "@manifest-editor/creators";
900
- var imageServiceSlideCreator = {
901
- ...imageServiceCreator,
902
- id: "@exhibitions/image-service-creator",
903
- create: createImageService,
904
- tags: ["image", "exhibition-slide"],
905
- label: "IIIF Image",
906
- summary: "IIIF Image service",
907
- resourceType: "Canvas",
908
- supports: {
909
- parentTypes: ["Manifest"],
910
- parentFields: ["items"]
911
- }
912
- };
913
- async function createImageService(data, ctx) {
914
- const canvasId = ctx.generateId("canvas");
915
- const pageId = ctx.generateId("annotation-page", {
916
- id: canvasId,
917
- type: "Canvas"
918
- });
919
- const resource = await ctx.create(
920
- imageServiceCreator.id,
921
- data,
922
- {
923
- target: {
924
- id: canvasId,
925
- type: "Canvas"
926
- },
927
- targetType: "Annotation",
928
- parent: {
929
- resource: { id: pageId, type: "AnnotationPage" },
930
- property: "items"
931
- }
932
- }
933
- );
934
- const { width, height } = resource.get();
935
- const annotation = ctx.embed({
936
- id: ctx.generateId("annotation"),
937
- type: "Annotation",
938
- motivation: "painting",
939
- body: [resource],
940
- target: {
941
- type: "SpecificResource",
942
- source: { id: canvasId, type: "Canvas" }
943
- }
944
- });
945
- return await ctx.create(imageSlideCreator.id, {
946
- canvasId,
947
- width,
948
- height,
949
- type: "default",
950
- // default / left / right / bottom
951
- items: [annotation]
952
- });
953
- }
954
-
955
944
  // src/creators/image-url-slide.tsx
945
+ import {
946
+ creatorHelper as creatorHelper3,
947
+ defineCreator as defineCreator4
948
+ } from "@manifest-editor/creator-api";
956
949
  import { imageUrlCreator } from "@manifest-editor/creators";
957
- var imageUrlSlideCreator = {
950
+ var imageUrlSlideCreator = defineCreator4({
958
951
  ...imageUrlCreator,
959
952
  id: "@exhibitions/image-url-creator",
960
953
  create: createUrlSlide,
@@ -966,31 +959,30 @@ var imageUrlSlideCreator = {
966
959
  parentTypes: ["Manifest"],
967
960
  parentFields: ["items"]
968
961
  }
969
- };
962
+ });
970
963
  async function createUrlSlide(data, ctx) {
971
964
  const canvasId = ctx.generateId("canvas");
972
965
  const pageId = ctx.generateId("annotation-page", {
973
966
  id: canvasId,
974
967
  type: "Canvas"
975
968
  });
976
- const resource = await ctx.create(
977
- imageUrlCreator.id,
978
- data,
979
- {
980
- target: {
981
- id: canvasId,
982
- type: "Canvas"
983
- },
984
- targetType: "Annotation",
985
- parent: {
986
- resource: { id: pageId, type: "AnnotationPage" },
987
- property: "items"
988
- }
989
- }
969
+ const annotationId = ctx.generateId("annotation");
970
+ const createImageUrl = creatorHelper3(
971
+ ctx,
972
+ { id: annotationId, type: "Annotation" },
973
+ "body",
974
+ "@manifest-editor/image-url-creator"
990
975
  );
976
+ const resource = await createImageUrl(data, {
977
+ target: {
978
+ id: canvasId,
979
+ type: "Canvas"
980
+ },
981
+ targetType: "Annotation"
982
+ });
991
983
  const { width, height } = resource.get();
992
984
  const annotation = ctx.embed({
993
- id: ctx.generateId("annotation"),
985
+ id: annotationId,
994
986
  type: "Annotation",
995
987
  motivation: "painting",
996
988
  body: [resource],
@@ -999,7 +991,8 @@ async function createUrlSlide(data, ctx) {
999
991
  source: { id: canvasId, type: "Canvas" }
1000
992
  }
1001
993
  });
1002
- return await ctx.create(imageSlideCreator.id, {
994
+ const createSlide = creatorHelper3(ctx, "Manifest", "items", "@exhibitions/image-slide-creator");
995
+ return await createSlide({
1003
996
  canvasId,
1004
997
  width,
1005
998
  height,
@@ -1011,31 +1004,23 @@ async function createUrlSlide(data, ctx) {
1011
1004
 
1012
1005
  // src/creators/info-box-creator.tsx
1013
1006
  import { emptyAnnotation, emptyCanvas as emptyCanvas2 } from "@iiif/parser";
1007
+ import { defineCreator as defineCreator5 } from "@manifest-editor/creator-api";
1014
1008
  import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
1015
- var infoBoxCreator = {
1009
+ var infoBoxCreator = defineCreator5({
1016
1010
  id: "@exhibitions/info-box-creator",
1017
1011
  create: createInfoBox,
1018
1012
  label: "Info box",
1019
1013
  summary: "A text panel for an exhibition",
1020
- icon: /* @__PURE__ */ jsxs5(
1021
- "svg",
1022
- {
1023
- xmlns: "http://www.w3.org/2000/svg",
1024
- width: "1em",
1025
- height: "1em",
1026
- viewBox: "0 0 24 24",
1027
- children: [
1028
- /* @__PURE__ */ jsx9("title", { children: "Info box" }),
1029
- /* @__PURE__ */ jsx9(
1030
- "path",
1031
- {
1032
- fill: "currentColor",
1033
- d: "M11 17h2v-6h-2zm1-8q.425 0 .713-.288T13 8t-.288-.712T12 7t-.712.288T11 8t.288.713T12 9m0 13q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22"
1034
- }
1035
- )
1036
- ]
1037
- }
1038
- ),
1014
+ icon: /* @__PURE__ */ jsxs5("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", children: [
1015
+ /* @__PURE__ */ jsx9("title", { children: "Info box" }),
1016
+ /* @__PURE__ */ jsx9(
1017
+ "path",
1018
+ {
1019
+ fill: "currentColor",
1020
+ d: "M11 17h2v-6h-2zm1-8q.425 0 .713-.288T13 8t-.288-.712T12 7t-.712.288T11 8t.288.713T12 9m0 13q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22"
1021
+ }
1022
+ )
1023
+ ] }),
1039
1024
  tags: ["exhibition-slide"],
1040
1025
  resourceType: "Canvas",
1041
1026
  resourceFields: ["id", "type", "label", "height", "width", "items"],
@@ -1043,7 +1028,7 @@ var infoBoxCreator = {
1043
1028
  parentTypes: ["Manifest"],
1044
1029
  parentFields: ["items"]
1045
1030
  }
1046
- };
1031
+ });
1047
1032
  async function createInfoBox(data, ctx) {
1048
1033
  const canvasId = ctx.generateId("canvas");
1049
1034
  const pageId = ctx.generateId("annotation-page", {
@@ -1132,16 +1117,17 @@ async function createInfoBox(data, ctx) {
1132
1117
 
1133
1118
  // src/creators/youtube-slide-creator.tsx
1134
1119
  import { emptyCanvas as emptyCanvas3 } from "@iiif/parser";
1120
+ import { defineCreator as defineCreator6 } from "@manifest-editor/creator-api";
1135
1121
  import { youTubeBodyCreator } from "@manifest-editor/creators";
1136
1122
  import { getYouTubeId } from "@manifest-editor/editors";
1137
- var youtubeSlideCreator = {
1123
+ var youtubeSlideCreator = defineCreator6({
1138
1124
  ...youTubeBodyCreator,
1139
1125
  id: "@exhibitions/youtube-creator",
1140
1126
  create: createYoutube,
1141
1127
  tags: ["video", "exhibition-slide"],
1142
1128
  label: "YouTube",
1143
1129
  summary: "A YouTube for an exhibition"
1144
- };
1130
+ });
1145
1131
  async function createYoutube(data, ctx) {
1146
1132
  const ytId = getYouTubeId(data.youtubeUrl);
1147
1133
  const canvasId = ctx.generateId("canvas");
@@ -1166,10 +1152,10 @@ async function createYoutube(data, ctx) {
1166
1152
  items: [annotation]
1167
1153
  });
1168
1154
  const thumbnail = ctx.embed({
1169
- id: `https://img.youtube.com/vi/${ytId}/0.jpg`,
1155
+ id: `https://img.youtube.com/vi/${ytId}/maxresdefault.jpg`,
1170
1156
  type: "Image",
1171
1157
  format: "image/jpeg",
1172
- width: 480,
1158
+ width: 640,
1173
1159
  height: 360
1174
1160
  });
1175
1161
  return ctx.embed({
@@ -1390,7 +1376,7 @@ function SortableExhibitionItem({
1390
1376
  onClick,
1391
1377
  isFirst,
1392
1378
  item,
1393
- children: /* @__PURE__ */ jsx14("div", { className: "absolute bg-white text-2xl p-1 top-0.5 right-0.5", children: /* @__PURE__ */ jsx14(ResizeHandleIcon, {}) })
1379
+ children: /* @__PURE__ */ jsx14("div", { className: "absolute bg-white text-2xl p-1 top-0.5 right-0.5", children: /* @__PURE__ */ jsx14(ResizeHandleIcon, { "aria-label": "Reorder item" }) })
1394
1380
  }
1395
1381
  );
1396
1382
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manifest-editor/exhibition-preset",
3
- "version": "1.3.1",
3
+ "version": "1.4.1",
4
4
  "type": "module",
5
5
  "bugs": "https://github.com/digirati-co-uk/iiif-manifest-editor/issues",
6
6
  "repository": {
@@ -47,20 +47,20 @@
47
47
  "@dnd-kit/sortable": "8.0.0",
48
48
  "@dnd-kit/utilities": "^3.2.1",
49
49
  "@iiif/helpers": "^1.3.1",
50
- "@iiif/parser": "^2.1.7",
50
+ "@iiif/parser": "^2.1.8",
51
51
  "@iiif/presentation-3": "^2.2.3",
52
52
  "@iiif/presentation-3-normalized": "^0.9.7",
53
- "@manifest-editor/components": "1.3.1",
54
- "@manifest-editor/creator-api": "1.3.1",
55
- "@manifest-editor/creators": "1.3.1",
56
- "@manifest-editor/editor-api": "1.3.1",
57
- "@manifest-editor/editors": "1.3.1",
58
- "@manifest-editor/manifest-preset": "1.3.1",
59
- "@manifest-editor/shell": "1.3.1",
53
+ "@manifest-editor/components": "1.4.1",
54
+ "@manifest-editor/creator-api": "1.4.0",
55
+ "@manifest-editor/creators": "1.4.1",
56
+ "@manifest-editor/editor-api": "1.4.0",
57
+ "@manifest-editor/editors": "1.4.1",
58
+ "@manifest-editor/manifest-preset": "1.4.1",
59
+ "@manifest-editor/shell": "1.4.1",
60
60
  "react": "^18.3.1",
61
61
  "react-aria-components": "^1.7.1",
62
62
  "react-dom": "^18.3.1",
63
- "react-iiif-vault": "^1.5.1",
63
+ "react-iiif-vault": "^1.5.6",
64
64
  "tailwind-merge": "^2.3.0",
65
65
  "tiny-invariant": "^1.3.3",
66
66
  "zustand": "^4.5.2"
@@ -76,5 +76,5 @@
76
76
  "publishConfig": {
77
77
  "access": "public"
78
78
  },
79
- "gitHead": "920fe405869996394c204c6eae70f446aab78986"
79
+ "gitHead": "7e8791689668c2428ecf0d617f69038d0fd2e758"
80
80
  }