@manifest-editor/exhibition-preset 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +577 -395
- package/dist/index.css +3 -0
- package/dist/index.js +525 -343
- package/package.json +9 -8
package/dist/index.cjs
CHANGED
|
@@ -712,16 +712,21 @@ function YouTubeEditor({
|
|
|
712
712
|
] });
|
|
713
713
|
}
|
|
714
714
|
|
|
715
|
+
// src/creators/image-browser-slide-creator.tsx
|
|
716
|
+
var import_creators = require("@manifest-editor/creators");
|
|
717
|
+
|
|
715
718
|
// src/creators/image-slide-creator.tsx
|
|
716
719
|
var import_parser = require("@iiif/parser");
|
|
720
|
+
var import_components5 = require("@manifest-editor/components");
|
|
717
721
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
718
722
|
var imageSlideCreator = {
|
|
719
723
|
id: "@exhibitions/image-slide-creator",
|
|
720
724
|
create: createImageSlide,
|
|
721
|
-
label: "
|
|
722
|
-
summary: "An image
|
|
723
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
725
|
+
label: "Empty slide",
|
|
726
|
+
summary: "An empty image slide.",
|
|
727
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_components5.EmptyCanvasIcon, {}),
|
|
724
728
|
tags: ["exhibition-slide"],
|
|
729
|
+
// No tag, so it doesn't appear, it's just called.
|
|
725
730
|
resourceType: "Canvas",
|
|
726
731
|
resourceFields: ["id", "type", "label", "height", "width", "items"],
|
|
727
732
|
supports: {
|
|
@@ -754,7 +759,7 @@ var imageSlideBottomCreator = {
|
|
|
754
759
|
create: (payload, ctx) => createImageSlide({ ...payload, type: "bottom" }, ctx)
|
|
755
760
|
};
|
|
756
761
|
function createImageSlide(payload, ctx) {
|
|
757
|
-
const canvasId = ctx.generateId("Canvas");
|
|
762
|
+
const canvasId = payload.canvasId || ctx.generateId("Canvas");
|
|
758
763
|
const itemsPageId = ctx.generateId("AnnotationPage", {
|
|
759
764
|
id: canvasId,
|
|
760
765
|
type: "Canvas"
|
|
@@ -763,8 +768,23 @@ function createImageSlide(payload, ctx) {
|
|
|
763
768
|
id: canvasId,
|
|
764
769
|
type: "Canvas"
|
|
765
770
|
});
|
|
766
|
-
const behavior = [
|
|
771
|
+
const behavior = [];
|
|
767
772
|
let width = 6e3;
|
|
773
|
+
if (payload.width && payload.height) {
|
|
774
|
+
if (payload.width > payload.height) {
|
|
775
|
+
const gridSize = payload.width / 12;
|
|
776
|
+
const heightColumns = Math.floor(payload.height / gridSize);
|
|
777
|
+
const hClass = `h-${heightColumns}`;
|
|
778
|
+
behavior.push("w-12", hClass);
|
|
779
|
+
} else {
|
|
780
|
+
const gridSize = payload.height / 12;
|
|
781
|
+
const widthColumns = Math.floor(payload.width / gridSize);
|
|
782
|
+
const wClass = `w-${widthColumns}`;
|
|
783
|
+
behavior.push(wClass, "h-12");
|
|
784
|
+
}
|
|
785
|
+
} else {
|
|
786
|
+
behavior.push("w-12", "h-4");
|
|
787
|
+
}
|
|
768
788
|
switch (payload.type) {
|
|
769
789
|
case "left":
|
|
770
790
|
behavior.push("left");
|
|
@@ -778,6 +798,9 @@ function createImageSlide(payload, ctx) {
|
|
|
778
798
|
behavior.push("bottom");
|
|
779
799
|
break;
|
|
780
800
|
}
|
|
801
|
+
if (!payload.items?.length) {
|
|
802
|
+
behavior.push("multi-image");
|
|
803
|
+
}
|
|
781
804
|
return ctx.embed({
|
|
782
805
|
...import_parser.emptyCanvas,
|
|
783
806
|
id: canvasId,
|
|
@@ -790,7 +813,7 @@ function createImageSlide(payload, ctx) {
|
|
|
790
813
|
...import_parser.emptyAnnotationPage,
|
|
791
814
|
id: itemsPageId,
|
|
792
815
|
type: "AnnotationPage",
|
|
793
|
-
items: []
|
|
816
|
+
items: payload.items ? payload.items : []
|
|
794
817
|
})
|
|
795
818
|
],
|
|
796
819
|
annotations: [
|
|
@@ -804,6 +827,167 @@ function createImageSlide(payload, ctx) {
|
|
|
804
827
|
});
|
|
805
828
|
}
|
|
806
829
|
|
|
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
|
+
// src/creators/image-url-slide.tsx
|
|
935
|
+
var import_creators3 = require("@manifest-editor/creators");
|
|
936
|
+
var imageUrlSlideCreator = {
|
|
937
|
+
...import_creators3.imageUrlCreator,
|
|
938
|
+
id: "@exhibitions/image-url-creator",
|
|
939
|
+
create: createUrlSlide,
|
|
940
|
+
tags: ["exhibition-slide"],
|
|
941
|
+
label: "Image",
|
|
942
|
+
summary: "Image from URL",
|
|
943
|
+
resourceType: "Canvas",
|
|
944
|
+
supports: {
|
|
945
|
+
parentTypes: ["Manifest"],
|
|
946
|
+
parentFields: ["items"]
|
|
947
|
+
}
|
|
948
|
+
};
|
|
949
|
+
async function createUrlSlide(data, ctx) {
|
|
950
|
+
const canvasId = ctx.generateId("canvas");
|
|
951
|
+
const pageId = ctx.generateId("annotation-page", {
|
|
952
|
+
id: canvasId,
|
|
953
|
+
type: "Canvas"
|
|
954
|
+
});
|
|
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
|
+
}
|
|
969
|
+
);
|
|
970
|
+
const { width, height } = resource.get();
|
|
971
|
+
const annotation = ctx.embed({
|
|
972
|
+
id: ctx.generateId("annotation"),
|
|
973
|
+
type: "Annotation",
|
|
974
|
+
motivation: "painting",
|
|
975
|
+
body: [resource],
|
|
976
|
+
target: {
|
|
977
|
+
type: "SpecificResource",
|
|
978
|
+
source: { id: canvasId, type: "Canvas" }
|
|
979
|
+
}
|
|
980
|
+
});
|
|
981
|
+
return await ctx.create(imageSlideCreator.id, {
|
|
982
|
+
canvasId,
|
|
983
|
+
width,
|
|
984
|
+
height,
|
|
985
|
+
type: "default",
|
|
986
|
+
// default / left / right / bottom
|
|
987
|
+
items: [annotation]
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
|
|
807
991
|
// src/creators/info-box-creator.tsx
|
|
808
992
|
var import_parser2 = require("@iiif/parser");
|
|
809
993
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
@@ -812,20 +996,23 @@ var infoBoxCreator = {
|
|
|
812
996
|
create: createInfoBox,
|
|
813
997
|
label: "Info box",
|
|
814
998
|
summary: "A text panel for an exhibition",
|
|
815
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime9.
|
|
999
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
816
1000
|
"svg",
|
|
817
1001
|
{
|
|
818
1002
|
xmlns: "http://www.w3.org/2000/svg",
|
|
819
1003
|
width: "1em",
|
|
820
1004
|
height: "1em",
|
|
821
1005
|
viewBox: "0 0 24 24",
|
|
822
|
-
children:
|
|
823
|
-
"
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
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
|
+
]
|
|
829
1016
|
}
|
|
830
1017
|
),
|
|
831
1018
|
tags: ["exhibition-slide"],
|
|
@@ -914,7 +1101,7 @@ async function createInfoBox(data, ctx) {
|
|
|
914
1101
|
id: canvasId,
|
|
915
1102
|
type: "Canvas",
|
|
916
1103
|
behavior: ["w-4", "h-4", "info"],
|
|
917
|
-
label: data.label ||
|
|
1104
|
+
label: data.label || void 0,
|
|
918
1105
|
height: data.height || 1e3,
|
|
919
1106
|
width: data.width || 1e3,
|
|
920
1107
|
items: [page],
|
|
@@ -924,10 +1111,10 @@ async function createInfoBox(data, ctx) {
|
|
|
924
1111
|
|
|
925
1112
|
// src/creators/youtube-slide-creator.tsx
|
|
926
1113
|
var import_parser3 = require("@iiif/parser");
|
|
927
|
-
var
|
|
1114
|
+
var import_creators4 = require("@manifest-editor/creators");
|
|
928
1115
|
var import_editors3 = require("@manifest-editor/editors");
|
|
929
1116
|
var youtubeSlideCreator = {
|
|
930
|
-
...
|
|
1117
|
+
...import_creators4.youTubeBodyCreator,
|
|
931
1118
|
id: "@exhibitions/youtube-creator",
|
|
932
1119
|
create: createYoutube,
|
|
933
1120
|
tags: ["video", "exhibition-slide"],
|
|
@@ -979,9 +1166,9 @@ async function createYoutube(data, ctx) {
|
|
|
979
1166
|
}
|
|
980
1167
|
|
|
981
1168
|
// src/left-panels/ExhibitionGrid.tsx
|
|
982
|
-
var
|
|
1169
|
+
var import_components7 = require("@manifest-editor/components");
|
|
983
1170
|
var import_editors5 = require("@manifest-editor/editors");
|
|
984
|
-
var
|
|
1171
|
+
var import_components8 = require("@manifest-editor/manifest-preset/components");
|
|
985
1172
|
var import_shell8 = require("@manifest-editor/shell");
|
|
986
1173
|
|
|
987
1174
|
// src/components/ExhibitionGrid.tsx
|
|
@@ -1012,7 +1199,7 @@ function ExhibitionContainer({
|
|
|
1012
1199
|
}
|
|
1013
1200
|
|
|
1014
1201
|
// src/components/ExhibitionItem.tsx
|
|
1015
|
-
var
|
|
1202
|
+
var import_components6 = require("@manifest-editor/components");
|
|
1016
1203
|
var import_editors4 = require("@manifest-editor/editors");
|
|
1017
1204
|
var import_react3 = require("react");
|
|
1018
1205
|
var import_react_iiif_vault7 = require("react-iiif-vault");
|
|
@@ -1041,7 +1228,7 @@ var ExhibitionItem = (0, import_react3.forwardRef)(
|
|
|
1041
1228
|
isLeft ? "flex-row-reverse" : isBottom ? "flex-col" : "flex-row"
|
|
1042
1229
|
),
|
|
1043
1230
|
children: [
|
|
1044
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex-1 overflow-hidden relative justify-self-stretch", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1231
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex-1 overflow-hidden relative justify-self-stretch", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_components6.LazyThumbnail, { cover: true, fade: false }) }) }),
|
|
1045
1232
|
isImage ? null : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1046
1233
|
"div",
|
|
1047
1234
|
{
|
|
@@ -1243,14 +1430,14 @@ function ExhibitionGridLeftPanel() {
|
|
|
1243
1430
|
const manifest = { id: manifestId, type: "Manifest" };
|
|
1244
1431
|
const [canCreateCanvas, canvasActions] = (0, import_shell8.useCreator)(manifest, "items", "Canvas");
|
|
1245
1432
|
const [toggled, toggle] = (0, import_editors5.useToggleList)();
|
|
1246
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1433
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_components7.Sidebar, { children: [
|
|
1247
1434
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1248
|
-
|
|
1435
|
+
import_components7.SidebarHeader,
|
|
1249
1436
|
{
|
|
1250
1437
|
title: "Exhibition",
|
|
1251
1438
|
actions: [
|
|
1252
1439
|
{
|
|
1253
|
-
icon: toggled.list ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1440
|
+
icon: toggled.list ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_components8.CanvasListingIcon, { className: "text-2xl" }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ExhibitionGridIcon, {}),
|
|
1254
1441
|
title: toggled.list ? "List view" : "Grid view",
|
|
1255
1442
|
onClick: () => toggle("list")
|
|
1256
1443
|
},
|
|
@@ -1269,7 +1456,7 @@ function ExhibitionGridLeftPanel() {
|
|
|
1269
1456
|
]
|
|
1270
1457
|
}
|
|
1271
1458
|
),
|
|
1272
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1459
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_components7.SidebarContent, { children: toggled.list ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_components8.CanvasListView, { isEditing: toggled.editing }) : toggled.editing ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SortableExhibitionGrid, {}) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ExhibitionGrid, {}) })
|
|
1273
1460
|
] });
|
|
1274
1461
|
}
|
|
1275
1462
|
function ExhibitionGridIcon() {
|
|
@@ -1292,208 +1479,19 @@ function NewSlideIcon() {
|
|
|
1292
1479
|
] });
|
|
1293
1480
|
}
|
|
1294
1481
|
|
|
1295
|
-
// src/right-panels/SlideBehaviours.tsx
|
|
1296
|
-
var import_components8 = require("@manifest-editor/components");
|
|
1297
|
-
var import_editors6 = require("@manifest-editor/editors");
|
|
1298
|
-
var import_shell9 = require("@manifest-editor/shell");
|
|
1299
|
-
var import_react5 = require("react");
|
|
1300
|
-
|
|
1301
|
-
// src/components/AspectRatioWarning.tsx
|
|
1302
|
-
var import_react_iiif_vault10 = require("react-iiif-vault");
|
|
1303
|
-
var import_tiny_invariant2 = __toESM(require("tiny-invariant"), 1);
|
|
1304
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1305
|
-
function AspectRatioWarning() {
|
|
1306
|
-
const canvas = (0, import_react_iiif_vault10.useCanvas)();
|
|
1307
|
-
(0, import_tiny_invariant2.default)(canvas);
|
|
1308
|
-
const ratio = canvas.width && canvas.height ? canvas.width / canvas.height : 0;
|
|
1309
|
-
const target = getHeightWidthRatio(canvas.behavior || []);
|
|
1310
|
-
if (Math.abs(ratio - target.ratio) < 0.01)
|
|
1311
|
-
return null;
|
|
1312
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "p-2 rounded bg-me-100", children: [
|
|
1313
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "text-me-700-500", children: "Aspect ratio warning" }),
|
|
1314
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "text-sm text-black/60", children: [
|
|
1315
|
-
"The aspect ratio of this canvas is ",
|
|
1316
|
-
ratio.toFixed(2),
|
|
1317
|
-
" but the target aspect ratio is ",
|
|
1318
|
-
target.ratio.toFixed(2),
|
|
1319
|
-
". Some parts of this image may be cropped.",
|
|
1320
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "relative h-32 w-full mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1321
|
-
"div",
|
|
1322
|
-
{
|
|
1323
|
-
className: "bg-[red] left-0 top-0 z-2 opacity-50 max-w-32 max-h-32",
|
|
1324
|
-
style: { aspectRatio: ratio.toFixed(2) },
|
|
1325
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1326
|
-
"div",
|
|
1327
|
-
{
|
|
1328
|
-
className: "asbolute bg-[white] left-0 top-0 z-1 opacity-50 max-w-32 max-h-32",
|
|
1329
|
-
style: { aspectRatio: target.ratio }
|
|
1330
|
-
}
|
|
1331
|
-
)
|
|
1332
|
-
}
|
|
1333
|
-
) })
|
|
1334
|
-
] })
|
|
1335
|
-
] });
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
|
-
// src/right-panels/SlideBehaviours.tsx
|
|
1339
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1340
|
-
var customBehaviourEditor = {
|
|
1341
|
-
component: () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SlideBehavioursPanel, {}),
|
|
1342
|
-
supports: {
|
|
1343
|
-
edit: true,
|
|
1344
|
-
resourceTypes: ["Canvas"],
|
|
1345
|
-
properties: ["behavior"]
|
|
1346
|
-
},
|
|
1347
|
-
id: "slide-behaviors",
|
|
1348
|
-
label: "Layout",
|
|
1349
|
-
tabs: {
|
|
1350
|
-
showTitle: true
|
|
1351
|
-
}
|
|
1352
|
-
};
|
|
1353
|
-
var exhibitionConfigs = [
|
|
1354
|
-
{
|
|
1355
|
-
id: "layout",
|
|
1356
|
-
type: "choice",
|
|
1357
|
-
label: { en: ["Layout"] },
|
|
1358
|
-
initialOpen: true,
|
|
1359
|
-
items: [
|
|
1360
|
-
{
|
|
1361
|
-
label: { en: ["Text on left"] },
|
|
1362
|
-
value: "left"
|
|
1363
|
-
},
|
|
1364
|
-
{
|
|
1365
|
-
label: { en: ["Text on right"] },
|
|
1366
|
-
value: "right"
|
|
1367
|
-
},
|
|
1368
|
-
{
|
|
1369
|
-
label: { en: ["Text on bottom"] },
|
|
1370
|
-
value: "bottom"
|
|
1371
|
-
},
|
|
1372
|
-
{
|
|
1373
|
-
label: { en: ["Only image"] },
|
|
1374
|
-
value: "image"
|
|
1375
|
-
}
|
|
1376
|
-
]
|
|
1377
|
-
},
|
|
1378
|
-
{
|
|
1379
|
-
id: "size",
|
|
1380
|
-
component: (existing, setBehaviors) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(EditSize, { behaviors: existing, setBehaviors }),
|
|
1381
|
-
label: { en: ["Size"] },
|
|
1382
|
-
type: "custom",
|
|
1383
|
-
initialOpen: true,
|
|
1384
|
-
supports: (b) => b.startsWith("w-") || b.startsWith("h-")
|
|
1385
|
-
}
|
|
1386
|
-
];
|
|
1387
|
-
function parseBehaviors(items) {
|
|
1388
|
-
let width = 0;
|
|
1389
|
-
let height = 0;
|
|
1390
|
-
for (const item of items) {
|
|
1391
|
-
if (item.startsWith("w-")) {
|
|
1392
|
-
width = Number.parseInt(item.slice(2));
|
|
1393
|
-
}
|
|
1394
|
-
if (item.startsWith("h-")) {
|
|
1395
|
-
height = Number.parseInt(item.slice(2));
|
|
1396
|
-
}
|
|
1397
|
-
}
|
|
1398
|
-
return {
|
|
1399
|
-
width,
|
|
1400
|
-
height
|
|
1401
|
-
};
|
|
1402
|
-
}
|
|
1403
|
-
function EditSize({ behaviors, setBehaviors }) {
|
|
1404
|
-
const { width, height } = parseBehaviors(behaviors);
|
|
1405
|
-
const [hoverPosition, setHoverPosition] = (0, import_react5.useState)({ x: -1, y: -1 });
|
|
1406
|
-
const setBehavior = (w2, h) => {
|
|
1407
|
-
const newBehaviors = behaviors.filter((b) => {
|
|
1408
|
-
return !b.startsWith("w-") && !b.startsWith("h-");
|
|
1409
|
-
});
|
|
1410
|
-
newBehaviors.push(`w-${w2}`);
|
|
1411
|
-
newBehaviors.push(`h-${h}`);
|
|
1412
|
-
setBehaviors(newBehaviors);
|
|
1413
|
-
};
|
|
1414
|
-
const cells = Array.from({ length: 144 }, (_2, i2) => {
|
|
1415
|
-
const x2 = i2 % 12;
|
|
1416
|
-
const y2 = Math.floor(i2 / 12);
|
|
1417
|
-
const hovered = hoverPosition.x >= x2 && hoverPosition.y >= y2;
|
|
1418
|
-
const selected = x2 < width && y2 < height;
|
|
1419
|
-
const hoveredAndSelected = hovered && selected;
|
|
1420
|
-
let bgClass = "bg-gray-200";
|
|
1421
|
-
if (hovered) {
|
|
1422
|
-
bgClass = "bg-me-200";
|
|
1423
|
-
}
|
|
1424
|
-
if (selected) {
|
|
1425
|
-
bgClass = "bg-me-500";
|
|
1426
|
-
}
|
|
1427
|
-
if (hoveredAndSelected) {
|
|
1428
|
-
bgClass = "bg-me-400";
|
|
1429
|
-
}
|
|
1430
|
-
return (
|
|
1431
|
-
// biome-ignore lint/a11y/useKeyWithClickEvents: <explanation>
|
|
1432
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1433
|
-
"div",
|
|
1434
|
-
{
|
|
1435
|
-
className: `flex aspect-square rounded cursor-se-resize items-center justify-center ${bgClass}`,
|
|
1436
|
-
onClick: () => setBehavior(x2 + 1, y2 + 1),
|
|
1437
|
-
onMouseUp: () => setBehavior(x2 + 1, y2 + 1),
|
|
1438
|
-
onMouseEnter: () => setHoverPosition({ x: x2, y: y2 })
|
|
1439
|
-
},
|
|
1440
|
-
i2
|
|
1441
|
-
)
|
|
1442
|
-
);
|
|
1443
|
-
});
|
|
1444
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "grid grid-cols-12 grid-rows-12 gap-1", onMouseLeave: () => setHoverPosition({ x: -1, y: -1 }), children: cells });
|
|
1445
|
-
}
|
|
1446
|
-
function SlideBehavioursPanel() {
|
|
1447
|
-
const canvas = (0, import_editors6.useInStack)("Canvas");
|
|
1448
|
-
const editor = (0, import_shell9.useEditor)();
|
|
1449
|
-
const { width, height } = editor.technical;
|
|
1450
|
-
if (!canvas || editor.technical.type !== "Canvas") {
|
|
1451
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_components8.Sidebar, { children: [
|
|
1452
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components8.SidebarHeader, { title: "Slide behaviors" }),
|
|
1453
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: "Please select canvas" })
|
|
1454
|
-
] });
|
|
1455
|
-
}
|
|
1456
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components8.Sidebar, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_components8.SidebarContent, { children: [
|
|
1457
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "px-2", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_editors6.InputContainer, { $wide: true, children: [
|
|
1458
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1459
|
-
import_editors6.DimensionsTriplet,
|
|
1460
|
-
{
|
|
1461
|
-
widthId: width.containerId(),
|
|
1462
|
-
width: width.get() || 0,
|
|
1463
|
-
changeWidth: (v2) => width.set(v2),
|
|
1464
|
-
heightId: height.containerId(),
|
|
1465
|
-
height: height.get() || 0,
|
|
1466
|
-
changeHeight: (v2) => height.set(v2)
|
|
1467
|
-
}
|
|
1468
|
-
),
|
|
1469
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AspectRatioWarning, {}) })
|
|
1470
|
-
] }) }),
|
|
1471
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1472
|
-
import_editors6.BehaviorEditor,
|
|
1473
|
-
{
|
|
1474
|
-
behavior: editor.technical.behavior.get() || [],
|
|
1475
|
-
onChange: (v2) => {
|
|
1476
|
-
editor.technical.behavior.set(v2);
|
|
1477
|
-
},
|
|
1478
|
-
configs: exhibitionConfigs
|
|
1479
|
-
}
|
|
1480
|
-
)
|
|
1481
|
-
] }) });
|
|
1482
|
-
}
|
|
1483
|
-
|
|
1484
1482
|
// src/right-panels/ExhibitionCanvasEditor.tsx
|
|
1485
1483
|
var import_components10 = require("@manifest-editor/components");
|
|
1486
|
-
var
|
|
1487
|
-
var
|
|
1488
|
-
var
|
|
1484
|
+
var import_editors6 = require("@manifest-editor/editors");
|
|
1485
|
+
var import_shell10 = require("@manifest-editor/shell");
|
|
1486
|
+
var import_react_iiif_vault10 = require("react-iiif-vault");
|
|
1489
1487
|
|
|
1490
1488
|
// src/components/ExhibitionItemConversion.tsx
|
|
1491
|
-
var
|
|
1489
|
+
var import_helpers3 = require("@iiif/helpers");
|
|
1492
1490
|
var import_components9 = require("@manifest-editor/components");
|
|
1493
|
-
var
|
|
1494
|
-
var
|
|
1491
|
+
var import_shell9 = require("@manifest-editor/shell");
|
|
1492
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1495
1493
|
function ExhibitionItemConversion() {
|
|
1496
|
-
const editor = (0,
|
|
1494
|
+
const editor = (0, import_shell9.useEditor)();
|
|
1497
1495
|
const applyDefaultSettings = () => {
|
|
1498
1496
|
const canvasWidth = editor.technical.width.get();
|
|
1499
1497
|
const canvasHeight = editor.technical.height.get();
|
|
@@ -1503,19 +1501,19 @@ function ExhibitionItemConversion() {
|
|
|
1503
1501
|
behaviorsToAdd.push("w-12");
|
|
1504
1502
|
const height = Math.max(1, Math.min(12, Math.round(canvasWidth / canvasHeight * 12)));
|
|
1505
1503
|
behaviorsToAdd.push(`h-${height}`);
|
|
1506
|
-
if (!(0,
|
|
1504
|
+
if (!(0, import_helpers3.getValue)(summary.get())) {
|
|
1507
1505
|
summary.set({ en: ["Summary of image"] });
|
|
1508
1506
|
}
|
|
1509
1507
|
editor.technical.behavior.set(behaviorsToAdd);
|
|
1510
1508
|
};
|
|
1511
|
-
return /* @__PURE__ */ (0,
|
|
1509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col items-center gap-4 border-me-100 border-2 p-4 rounded", children: [
|
|
1512
1510
|
"This canvas was not created in the exhibition editor. Do you want to apply default settings?",
|
|
1513
|
-
/* @__PURE__ */ (0,
|
|
1511
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_components9.ActionButton, { onPress: () => applyDefaultSettings(), children: "Apply defaults" })
|
|
1514
1512
|
] });
|
|
1515
1513
|
}
|
|
1516
1514
|
|
|
1517
1515
|
// src/right-panels/ExhibitionCanvasEditor.tsx
|
|
1518
|
-
var
|
|
1516
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1519
1517
|
var exhibitionCanvasEditor = {
|
|
1520
1518
|
id: "@exhibition/right-panel-editor",
|
|
1521
1519
|
supports: {
|
|
@@ -1532,12 +1530,12 @@ var exhibitionCanvasEditor = {
|
|
|
1532
1530
|
}
|
|
1533
1531
|
},
|
|
1534
1532
|
label: "Exhibition",
|
|
1535
|
-
component: () => /* @__PURE__ */ (0,
|
|
1533
|
+
component: () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ExhibitionRightPanel, {})
|
|
1536
1534
|
};
|
|
1537
1535
|
function ExhibitionRightPanel() {
|
|
1538
|
-
const canvas = (0,
|
|
1539
|
-
const resource = (0,
|
|
1540
|
-
const { structural, technical, descriptive } = (0,
|
|
1536
|
+
const canvas = (0, import_react_iiif_vault10.useCanvas)();
|
|
1537
|
+
const resource = (0, import_shell10.useEditingResource)();
|
|
1538
|
+
const { structural, technical, descriptive } = (0, import_shell10.useEditor)();
|
|
1541
1539
|
const { items } = structural;
|
|
1542
1540
|
const { thumbnail } = descriptive;
|
|
1543
1541
|
const { width, height } = technical;
|
|
@@ -1545,12 +1543,12 @@ function ExhibitionRightPanel() {
|
|
|
1545
1543
|
const page = pages[0];
|
|
1546
1544
|
const isAnExhibitionCanvas = isExhibitionItem(canvas);
|
|
1547
1545
|
if (!canvas || !page || !resource)
|
|
1548
|
-
return /* @__PURE__ */ (0,
|
|
1549
|
-
return /* @__PURE__ */ (0,
|
|
1550
|
-
!isAnExhibitionCanvas ? /* @__PURE__ */ (0,
|
|
1551
|
-
/* @__PURE__ */ (0,
|
|
1552
|
-
/* @__PURE__ */ (0,
|
|
1553
|
-
|
|
1546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "p-8", children: "Canvas, page, or resource not found" });
|
|
1547
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components10.Sidebar, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components10.SidebarContent, { padding: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_shell10.ResourceEditingProvider, { resource: canvas, children: [
|
|
1548
|
+
!isAnExhibitionCanvas ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ExhibitionItemConversion, {}) : null,
|
|
1549
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_editors6.LanguageMapEditor, { dispatchType: "label", disableMultiline: true, disallowHTML: true }),
|
|
1550
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1551
|
+
import_editors6.LinkingPropertyList,
|
|
1554
1552
|
{
|
|
1555
1553
|
containerId: thumbnail.containerId(),
|
|
1556
1554
|
label: "Thumbnail",
|
|
@@ -1558,22 +1556,22 @@ function ExhibitionRightPanel() {
|
|
|
1558
1556
|
items: thumbnail.get(),
|
|
1559
1557
|
singleMode: true,
|
|
1560
1558
|
reorder: (ctx) => thumbnail.reorder(ctx.startIndex, ctx.endIndex),
|
|
1561
|
-
createActions: (0,
|
|
1559
|
+
createActions: (0, import_editors6.createAppActions)(thumbnail),
|
|
1562
1560
|
creationType: "ContentResource",
|
|
1563
1561
|
emptyLabel: "No thumbnail",
|
|
1564
1562
|
parent: resource?.resource
|
|
1565
1563
|
}
|
|
1566
1564
|
),
|
|
1567
|
-
/* @__PURE__ */ (0,
|
|
1565
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_iiif_vault10.AnnotationPageContext, { annotationPage: page.id, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_editors6.PaintingAnnotationList, { createFilter: "image" }) })
|
|
1568
1566
|
] }) }) });
|
|
1569
1567
|
}
|
|
1570
1568
|
|
|
1571
1569
|
// src/right-panels/ExhibitionSummaryEditor.tsx
|
|
1572
1570
|
var import_components11 = require("@manifest-editor/components");
|
|
1573
|
-
var
|
|
1574
|
-
var
|
|
1575
|
-
var
|
|
1576
|
-
var
|
|
1571
|
+
var import_editors7 = require("@manifest-editor/editors");
|
|
1572
|
+
var import_shell11 = require("@manifest-editor/shell");
|
|
1573
|
+
var import_react_iiif_vault11 = require("react-iiif-vault");
|
|
1574
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1577
1575
|
var exhibitionSummaryEdtior = {
|
|
1578
1576
|
id: "@exhibition/summary-editor",
|
|
1579
1577
|
supports: {
|
|
@@ -1590,41 +1588,41 @@ var exhibitionSummaryEdtior = {
|
|
|
1590
1588
|
}
|
|
1591
1589
|
},
|
|
1592
1590
|
label: "Summary",
|
|
1593
|
-
component: () => /* @__PURE__ */ (0,
|
|
1591
|
+
component: () => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ExhibitionRightPanel2, {})
|
|
1594
1592
|
};
|
|
1595
1593
|
function ExhibitionRightPanel2() {
|
|
1596
|
-
const canvas = (0,
|
|
1594
|
+
const canvas = (0, import_react_iiif_vault11.useCanvas)();
|
|
1597
1595
|
if (!canvas)
|
|
1598
1596
|
return null;
|
|
1599
|
-
return /* @__PURE__ */ (0,
|
|
1600
|
-
/* @__PURE__ */ (0,
|
|
1601
|
-
/* @__PURE__ */ (0,
|
|
1597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_components11.Sidebar, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_components11.SidebarContent, { padding: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_shell11.ResourceEditingProvider, { resource: canvas, children: [
|
|
1598
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_editors7.LanguageMapEditor, { dispatchType: "label" }),
|
|
1599
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_editors7.LanguageMapEditor, { dispatchType: "summary" })
|
|
1602
1600
|
] }) }) });
|
|
1603
1601
|
}
|
|
1604
1602
|
|
|
1605
1603
|
// src/right-panels/ExhibitionTourSteps.tsx
|
|
1606
1604
|
var import_components17 = require("@manifest-editor/components");
|
|
1607
|
-
var import_editors12 = require("@manifest-editor/editors");
|
|
1608
|
-
var import_shell18 = require("@manifest-editor/shell");
|
|
1609
|
-
var import_react10 = require("react");
|
|
1610
|
-
var import_react_aria_components2 = require("react-aria-components");
|
|
1611
|
-
var import_react_iiif_vault19 = require("react-iiif-vault");
|
|
1612
|
-
|
|
1613
|
-
// src/components/TourAnnotationPageEditor.tsx
|
|
1614
1605
|
var import_editors11 = require("@manifest-editor/editors");
|
|
1615
1606
|
var import_shell17 = require("@manifest-editor/shell");
|
|
1607
|
+
var import_react9 = require("react");
|
|
1608
|
+
var import_react_aria_components2 = require("react-aria-components");
|
|
1616
1609
|
var import_react_iiif_vault18 = require("react-iiif-vault");
|
|
1617
1610
|
|
|
1618
|
-
// src/components/
|
|
1611
|
+
// src/components/TourAnnotationPageEditor.tsx
|
|
1619
1612
|
var import_editors10 = require("@manifest-editor/editors");
|
|
1620
1613
|
var import_shell16 = require("@manifest-editor/shell");
|
|
1621
|
-
var import_react9 = require("react");
|
|
1622
1614
|
var import_react_iiif_vault17 = require("react-iiif-vault");
|
|
1623
1615
|
|
|
1616
|
+
// src/components/TourAnnotationEditor.tsx
|
|
1617
|
+
var import_editors9 = require("@manifest-editor/editors");
|
|
1618
|
+
var import_shell15 = require("@manifest-editor/shell");
|
|
1619
|
+
var import_react8 = require("react");
|
|
1620
|
+
var import_react_iiif_vault16 = require("react-iiif-vault");
|
|
1621
|
+
|
|
1624
1622
|
// src/components/TourNormalAnnotationEditor.tsx
|
|
1625
1623
|
var import_components13 = require("@manifest-editor/components");
|
|
1626
1624
|
var import_components14 = require("@manifest-editor/manifest-preset/components");
|
|
1627
|
-
var
|
|
1625
|
+
var import_shell13 = require("@manifest-editor/shell");
|
|
1628
1626
|
|
|
1629
1627
|
// ../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.es6.js
|
|
1630
1628
|
var __assign = function() {
|
|
@@ -1671,7 +1669,7 @@ var isPropValid = /* @__PURE__ */ memoize(
|
|
|
1671
1669
|
);
|
|
1672
1670
|
|
|
1673
1671
|
// ../../node_modules/.pnpm/styled-components@6.1.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/styled-components/dist/styled-components.browser.esm.js
|
|
1674
|
-
var
|
|
1672
|
+
var import_react5 = __toESM(require("react"));
|
|
1675
1673
|
var import_shallowequal = __toESM(require_shallowequal());
|
|
1676
1674
|
|
|
1677
1675
|
// ../../node_modules/.pnpm/stylis@4.3.1/node_modules/stylis/src/Enum.js
|
|
@@ -2289,7 +2287,7 @@ var P = function(t, n) {
|
|
|
2289
2287
|
for (var n2 = [], o3 = 1; o3 < arguments.length; o3++)
|
|
2290
2288
|
n2[o3 - 1] = arguments[o3];
|
|
2291
2289
|
E.test(t2) ? (a2 = false, N.delete(s2)) : i2.apply(void 0, __spreadArray([t2], n2, false));
|
|
2292
|
-
}, (0,
|
|
2290
|
+
}, (0, import_react5.useRef)(), a2 && !N.has(s2) && (console.warn(s2), N.add(s2));
|
|
2293
2291
|
} catch (e) {
|
|
2294
2292
|
E.test(e.message) && N.delete(s2);
|
|
2295
2293
|
} finally {
|
|
@@ -2654,26 +2652,26 @@ function xe(e) {
|
|
|
2654
2652
|
}
|
|
2655
2653
|
var Ve = new Re();
|
|
2656
2654
|
var Fe = xe();
|
|
2657
|
-
var Me =
|
|
2655
|
+
var Me = import_react5.default.createContext({ shouldForwardProp: void 0, styleSheet: Ve, stylis: Fe });
|
|
2658
2656
|
var $e = Me.Consumer;
|
|
2659
|
-
var ze =
|
|
2657
|
+
var ze = import_react5.default.createContext(void 0);
|
|
2660
2658
|
function Be() {
|
|
2661
|
-
return (0,
|
|
2659
|
+
return (0, import_react5.useContext)(Me);
|
|
2662
2660
|
}
|
|
2663
2661
|
function Le(e) {
|
|
2664
|
-
var t = (0,
|
|
2662
|
+
var t = (0, import_react5.useState)(e.stylisPlugins), n = t[0], r2 = t[1], c2 = Be().styleSheet, l2 = (0, import_react5.useMemo)(function() {
|
|
2665
2663
|
var t2 = c2;
|
|
2666
2664
|
return e.sheet ? t2 = e.sheet : e.target && (t2 = t2.reconstructWithOptions({ target: e.target }, false)), e.disableCSSOMInjection && (t2 = t2.reconstructWithOptions({ useCSSOMInjection: false })), t2;
|
|
2667
|
-
}, [e.disableCSSOMInjection, e.sheet, e.target, c2]), u2 = (0,
|
|
2665
|
+
}, [e.disableCSSOMInjection, e.sheet, e.target, c2]), u2 = (0, import_react5.useMemo)(function() {
|
|
2668
2666
|
return xe({ options: { namespace: e.namespace, prefix: e.enableVendorPrefixes }, plugins: n });
|
|
2669
2667
|
}, [e.enableVendorPrefixes, e.namespace, n]);
|
|
2670
|
-
(0,
|
|
2668
|
+
(0, import_react5.useEffect)(function() {
|
|
2671
2669
|
(0, import_shallowequal.default)(n, e.stylisPlugins) || r2(e.stylisPlugins);
|
|
2672
2670
|
}, [e.stylisPlugins]);
|
|
2673
|
-
var d = (0,
|
|
2671
|
+
var d = (0, import_react5.useMemo)(function() {
|
|
2674
2672
|
return { shouldForwardProp: e.shouldForwardProp, styleSheet: l2, stylis: u2 };
|
|
2675
2673
|
}, [e.shouldForwardProp, l2, u2]);
|
|
2676
|
-
return
|
|
2674
|
+
return import_react5.default.createElement(Me.Provider, { value: d }, import_react5.default.createElement(ze.Provider, { value: u2 }, e.children));
|
|
2677
2675
|
}
|
|
2678
2676
|
var Ge = function() {
|
|
2679
2677
|
function e(e2, t) {
|
|
@@ -2773,7 +2771,7 @@ var Ze = function() {
|
|
|
2773
2771
|
return o2;
|
|
2774
2772
|
}, e;
|
|
2775
2773
|
}();
|
|
2776
|
-
var Ke =
|
|
2774
|
+
var Ke = import_react5.default.createContext(void 0);
|
|
2777
2775
|
var Qe = Ke.Consumer;
|
|
2778
2776
|
var nt = {};
|
|
2779
2777
|
var ot = /* @__PURE__ */ new Set();
|
|
@@ -2799,8 +2797,8 @@ function rt(e, r2, s2) {
|
|
|
2799
2797
|
var N2 = new Ze(s2, g2, i2 ? a2.componentStyle : void 0);
|
|
2800
2798
|
function O2(e2, r3) {
|
|
2801
2799
|
return function(e3, r4, s3) {
|
|
2802
|
-
var i3 = e3.attrs, a3 = e3.componentStyle, c3 = e3.defaultProps, p3 = e3.foldedComponentIds, d2 = e3.styledComponentId, h2 = e3.target, f3 =
|
|
2803
|
-
(0,
|
|
2800
|
+
var i3 = e3.attrs, a3 = e3.componentStyle, c3 = e3.defaultProps, p3 = e3.foldedComponentIds, d2 = e3.styledComponentId, h2 = e3.target, f3 = import_react5.default.useContext(Ke), m3 = Be(), y3 = e3.shouldForwardProp || m3.shouldForwardProp;
|
|
2801
|
+
(0, import_react5.useDebugValue)(d2);
|
|
2804
2802
|
var v2 = I(r4, f3, c3) || C, g3 = function(e4, n, o2) {
|
|
2805
2803
|
for (var r5, s4 = __assign(__assign({}, n), { className: void 0, theme: o2 }), i4 = 0; i4 < e4.length; i4 += 1) {
|
|
2806
2804
|
var a4 = re(r5 = e4[i4]) ? r5(s4) : r5;
|
|
@@ -2813,15 +2811,15 @@ function rt(e, r2, s2) {
|
|
|
2813
2811
|
void 0 === g3[b2] || "$" === b2[0] || "as" === b2 || "theme" === b2 && g3.theme === v2 || ("forwardedAs" === b2 ? w3.as = g3.forwardedAs : y3 && !y3(b2, S3) || (w3[b2] = g3[b2], y3 || false || isPropValid(b2) || ot.has(b2) || !A.has(S3) || (ot.add(b2), console.warn('styled-components: it looks like an unknown prop "'.concat(b2, '" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));
|
|
2814
2812
|
var E3 = function(e4, t) {
|
|
2815
2813
|
var n = Be(), o2 = e4.generateAndInjectStyles(t, n.styleSheet, n.stylis);
|
|
2816
|
-
return (0,
|
|
2814
|
+
return (0, import_react5.useDebugValue)(o2), o2;
|
|
2817
2815
|
}(a3, g3);
|
|
2818
2816
|
e3.warnTooManyClasses && e3.warnTooManyClasses(E3);
|
|
2819
2817
|
var N3 = ie(p3, d2);
|
|
2820
|
-
return E3 && (N3 += " " + E3), g3.className && (N3 += " " + g3.className), w3[L(S3) && !A.has(S3) ? "class" : "className"] = N3, w3.ref = s3, (0,
|
|
2818
|
+
return E3 && (N3 += " " + E3), g3.className && (N3 += " " + g3.className), w3[L(S3) && !A.has(S3) ? "class" : "className"] = N3, w3.ref = s3, (0, import_react5.createElement)(S3, w3);
|
|
2821
2819
|
}(D2, e2, r3);
|
|
2822
2820
|
}
|
|
2823
2821
|
O2.displayName = y2;
|
|
2824
|
-
var D2 =
|
|
2822
|
+
var D2 = import_react5.default.forwardRef(O2);
|
|
2825
2823
|
return D2.attrs = S2, D2.componentStyle = N2, D2.displayName = y2, D2.shouldForwardProp = w2, D2.foldedComponentIds = i2 ? ie(a2.foldedComponentIds, a2.styledComponentId) : "", D2.styledComponentId = g2, D2.target = i2 ? a2.target : e, Object.defineProperty(D2, "defaultProps", { get: function() {
|
|
2826
2824
|
return this._foldedDefaultProps;
|
|
2827
2825
|
}, set: function(e2) {
|
|
@@ -2909,7 +2907,7 @@ var mt = function() {
|
|
|
2909
2907
|
if (e2.sealed)
|
|
2910
2908
|
throw he(2);
|
|
2911
2909
|
var r2 = ((n = {})[f] = "", n[y] = v, n.dangerouslySetInnerHTML = { __html: e2.instance.toString() }, n), s2 = Pe();
|
|
2912
|
-
return s2 && (r2.nonce = s2), [
|
|
2910
|
+
return s2 && (r2.nonce = s2), [import_react5.default.createElement("style", __assign({}, r2, { key: "sc-0-0" }))];
|
|
2913
2911
|
}, this.seal = function() {
|
|
2914
2912
|
e2.sealed = true;
|
|
2915
2913
|
}, this.instance = new Re({ isServer: true }), this.sealed = false;
|
|
@@ -2917,7 +2915,7 @@ var mt = function() {
|
|
|
2917
2915
|
return e.prototype.collectStyles = function(e2) {
|
|
2918
2916
|
if (this.sealed)
|
|
2919
2917
|
throw he(2);
|
|
2920
|
-
return
|
|
2918
|
+
return import_react5.default.createElement(Le, { sheet: this.instance }, e2);
|
|
2921
2919
|
}, e.prototype.interleaveWithNodeStream = function(e2) {
|
|
2922
2920
|
throw he(3);
|
|
2923
2921
|
}, e;
|
|
@@ -2927,10 +2925,10 @@ var vt = "__sc-".concat(f, "__");
|
|
|
2927
2925
|
"undefined" != typeof window && (window[vt] || (window[vt] = 0), 1 === window[vt] && console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info."), window[vt] += 1);
|
|
2928
2926
|
|
|
2929
2927
|
// ../../packages/ui/madoc/components/icons/CloseIcon.tsx
|
|
2930
|
-
var
|
|
2931
|
-
var CloseIcon = ut((props) => /* @__PURE__ */ (0,
|
|
2932
|
-
/* @__PURE__ */ (0,
|
|
2933
|
-
/* @__PURE__ */ (0,
|
|
2928
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2929
|
+
var CloseIcon = ut((props) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24", viewBox: "0 0 24 24", width: "24", ...props, children: [
|
|
2930
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }),
|
|
2931
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("path", { d: "M0 0h24v24H0z", fill: "none" })
|
|
2934
2932
|
] }))`
|
|
2935
2933
|
fill: rgba(0, 0, 0, 0.5);
|
|
2936
2934
|
cursor: pointer;
|
|
@@ -2948,50 +2946,40 @@ var CloseIcon = ut((props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("sv
|
|
|
2948
2946
|
`;
|
|
2949
2947
|
|
|
2950
2948
|
// src/components/TourNormalAnnotationEditor.tsx
|
|
2951
|
-
var
|
|
2952
|
-
var
|
|
2949
|
+
var import_react6 = require("react");
|
|
2950
|
+
var import_react_iiif_vault14 = require("react-iiif-vault");
|
|
2953
2951
|
|
|
2954
2952
|
// src/components/HTMLAnnotationBodyRender.tsx
|
|
2955
|
-
var
|
|
2956
|
-
var
|
|
2957
|
-
function HTMLAnnotationBodyRender({
|
|
2958
|
-
|
|
2959
|
-
locale
|
|
2960
|
-
}) {
|
|
2961
|
-
const annotation = (0, import_react_iiif_vault13.useAnnotation)();
|
|
2953
|
+
var import_react_iiif_vault12 = require("react-iiif-vault");
|
|
2954
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2955
|
+
function HTMLAnnotationBodyRender({ className, locale }) {
|
|
2956
|
+
const annotation = (0, import_react_iiif_vault12.useAnnotation)();
|
|
2962
2957
|
const filteredBodies = locale && annotation ? annotation?.body.filter((body) => {
|
|
2963
2958
|
const language = Array.isArray(body.language) ? body.language[0] : body.language;
|
|
2964
2959
|
return language === locale;
|
|
2965
2960
|
}) : annotation?.body || [];
|
|
2966
2961
|
const bodiesToRender = filteredBodies.length ? filteredBodies : locale ? [(annotation?.body || [])[0]] : annotation?.body || [];
|
|
2967
|
-
return /* @__PURE__ */ (0,
|
|
2968
|
-
return /* @__PURE__ */ (0,
|
|
2969
|
-
"div",
|
|
2970
|
-
{
|
|
2971
|
-
className: "prose-headings:mt-1 prose-headings:mb-1 prose-sm leading-normal",
|
|
2972
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { dangerouslySetInnerHTML: { __html: body.value } })
|
|
2973
|
-
},
|
|
2974
|
-
idx
|
|
2975
|
-
);
|
|
2962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className, children: bodiesToRender.map((body, idx) => {
|
|
2963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "prose-headings:mt-1 prose-headings:mb-1 prose-sm leading-normal", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { dangerouslySetInnerHTML: { __html: body.value } }) }, idx);
|
|
2976
2964
|
}) });
|
|
2977
2965
|
}
|
|
2978
2966
|
|
|
2979
2967
|
// src/components/HTMLAnnotationEditor.tsx
|
|
2980
2968
|
var import_components12 = require("@manifest-editor/components");
|
|
2981
|
-
var
|
|
2982
|
-
var
|
|
2983
|
-
var
|
|
2969
|
+
var import_shell12 = require("@manifest-editor/shell");
|
|
2970
|
+
var import_react_iiif_vault13 = require("react-iiif-vault");
|
|
2971
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2984
2972
|
function HTMLAnnotationEditor() {
|
|
2985
|
-
const annotation = (0,
|
|
2986
|
-
const creator = (0,
|
|
2973
|
+
const annotation = (0, import_react_iiif_vault13.useAnnotation)();
|
|
2974
|
+
const creator = (0, import_shell12.useInlineCreator)();
|
|
2987
2975
|
const bodies = annotation?.body || [];
|
|
2988
|
-
const editor = (0,
|
|
2976
|
+
const editor = (0, import_shell12.useGenericEditor)(annotation);
|
|
2989
2977
|
if (!annotation) {
|
|
2990
2978
|
return null;
|
|
2991
2979
|
}
|
|
2992
|
-
return /* @__PURE__ */ (0,
|
|
2980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-4", children: [
|
|
2993
2981
|
bodies.map((body, n) => {
|
|
2994
|
-
return /* @__PURE__ */ (0,
|
|
2982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2995
2983
|
AnnotationBodyEditor,
|
|
2996
2984
|
{
|
|
2997
2985
|
resourceId: body.id,
|
|
@@ -3000,7 +2988,7 @@ function HTMLAnnotationEditor() {
|
|
|
3000
2988
|
n
|
|
3001
2989
|
);
|
|
3002
2990
|
}),
|
|
3003
|
-
/* @__PURE__ */ (0,
|
|
2991
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3004
2992
|
import_components12.ActionButton,
|
|
3005
2993
|
{
|
|
3006
2994
|
primary: true,
|
|
@@ -3028,15 +3016,15 @@ function HTMLAnnotationEditor() {
|
|
|
3028
3016
|
}
|
|
3029
3017
|
|
|
3030
3018
|
// src/components/TourNormalAnnotationEditor.tsx
|
|
3031
|
-
var
|
|
3019
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3032
3020
|
function TourNormalAnnotationEditor({
|
|
3033
3021
|
highlightProps
|
|
3034
3022
|
}) {
|
|
3035
|
-
const annotation = (0,
|
|
3036
|
-
const editor = (0,
|
|
3037
|
-
const pageEditor = (0,
|
|
3023
|
+
const annotation = (0, import_react_iiif_vault14.useAnnotation)();
|
|
3024
|
+
const editor = (0, import_shell13.useGenericEditor)(annotation);
|
|
3025
|
+
const pageEditor = (0, import_shell13.useGenericEditor)((0, import_react_iiif_vault14.useAnnotationPage)());
|
|
3038
3026
|
const target = editor.annotation.target.getParsedSelector();
|
|
3039
|
-
const { requestAnnotation, isPending, cancelRequest, busy } = (0,
|
|
3027
|
+
const { requestAnnotation, isPending, cancelRequest, busy } = (0, import_shell13.useRequestAnnotation)({
|
|
3040
3028
|
onSuccess: (resp) => {
|
|
3041
3029
|
if (resp.target) {
|
|
3042
3030
|
editor.annotation.target.setSelector(resp.target);
|
|
@@ -3081,29 +3069,29 @@ function TourNormalAnnotationEditor({
|
|
|
3081
3069
|
pageEditor.structural.items.deleteAtIndex(index);
|
|
3082
3070
|
}
|
|
3083
3071
|
};
|
|
3084
|
-
const [isOpen, setIsOpen] = (0,
|
|
3085
|
-
return /* @__PURE__ */ (0,
|
|
3072
|
+
const [isOpen, setIsOpen] = (0, import_react6.useState)(false);
|
|
3073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3086
3074
|
"div",
|
|
3087
3075
|
{
|
|
3088
3076
|
...highlightProps,
|
|
3089
3077
|
className: "border border-gray-300 p-3 hover:border-me-500 shadow-sm rounded bg-white relative",
|
|
3090
3078
|
children: [
|
|
3091
|
-
/* @__PURE__ */ (0,
|
|
3092
|
-
/* @__PURE__ */ (0,
|
|
3093
|
-
/* @__PURE__ */ (0,
|
|
3079
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "absolute top-1 right-1 z-20 flex gap-2", children: [
|
|
3080
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components13.ActionButton, { onPress: () => deleteAnnotation(), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components13.DeleteForeverIcon, {}) }),
|
|
3081
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components13.ActionButton, { onPress: () => setIsOpen((o2) => !o2), children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CloseIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components14.ListEditIcon, {}) })
|
|
3094
3082
|
] }),
|
|
3095
|
-
/* @__PURE__ */ (0,
|
|
3096
|
-
isOpen ? /* @__PURE__ */ (0,
|
|
3097
|
-
/* @__PURE__ */ (0,
|
|
3098
|
-
/* @__PURE__ */ (0,
|
|
3099
|
-
] }) : /* @__PURE__ */ (0,
|
|
3083
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "mb-2 relative", children: [
|
|
3084
|
+
isOpen ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
3085
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h3", { className: "text-lg font-semibold border-b pt-1 pb-2 mb-2", children: "Edit step" }),
|
|
3086
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(HTMLAnnotationEditor, {})
|
|
3087
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_jsx_runtime23.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3100
3088
|
HTMLAnnotationBodyRender,
|
|
3101
3089
|
{
|
|
3102
3090
|
className: "line-clamp-3 prose-p:text-slate-600",
|
|
3103
3091
|
locale: "en"
|
|
3104
3092
|
}
|
|
3105
3093
|
) }),
|
|
3106
|
-
!isOpen ? /* @__PURE__ */ (0,
|
|
3094
|
+
!isOpen ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: isPending ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components13.ActionButton, { onPress: cancelRequest, children: "Discard changes" }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3107
3095
|
import_components13.ActionButton,
|
|
3108
3096
|
{
|
|
3109
3097
|
isDisabled: busy,
|
|
@@ -3112,7 +3100,7 @@ function TourNormalAnnotationEditor({
|
|
|
3112
3100
|
}
|
|
3113
3101
|
) }) : null
|
|
3114
3102
|
] }),
|
|
3115
|
-
/* @__PURE__ */ (0,
|
|
3103
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "absolute -bottom-5 h-5 border-l-2 border-gray-300 w-0" })
|
|
3116
3104
|
]
|
|
3117
3105
|
}
|
|
3118
3106
|
);
|
|
@@ -3120,52 +3108,52 @@ function TourNormalAnnotationEditor({
|
|
|
3120
3108
|
|
|
3121
3109
|
// src/components/TourPaintingAnnotationEditor.tsx
|
|
3122
3110
|
var import_components15 = require("@manifest-editor/components");
|
|
3123
|
-
var
|
|
3111
|
+
var import_editors8 = require("@manifest-editor/editors");
|
|
3124
3112
|
var import_components16 = require("@manifest-editor/manifest-preset/components");
|
|
3125
|
-
var
|
|
3126
|
-
var
|
|
3127
|
-
var
|
|
3128
|
-
var
|
|
3113
|
+
var import_shell14 = require("@manifest-editor/shell");
|
|
3114
|
+
var import_react7 = require("react");
|
|
3115
|
+
var import_react_iiif_vault15 = require("react-iiif-vault");
|
|
3116
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3129
3117
|
function TourPaintingAnnotationEditor({
|
|
3130
3118
|
originalAnnotationId,
|
|
3131
3119
|
highlightProps
|
|
3132
3120
|
}) {
|
|
3133
|
-
const page = (0,
|
|
3134
|
-
const pageEditor = (0,
|
|
3135
|
-
const annotation = (0,
|
|
3136
|
-
const { edit } = (0,
|
|
3137
|
-
const [isOpen, setIsOpen] = (0,
|
|
3121
|
+
const page = (0, import_react_iiif_vault15.useAnnotationPage)();
|
|
3122
|
+
const pageEditor = (0, import_shell14.useGenericEditor)(page);
|
|
3123
|
+
const annotation = (0, import_react_iiif_vault15.useAnnotation)();
|
|
3124
|
+
const { edit } = (0, import_shell14.useLayoutActions)();
|
|
3125
|
+
const [isOpen, setIsOpen] = (0, import_react7.useState)(false);
|
|
3138
3126
|
const deleteAnnotation = () => {
|
|
3139
3127
|
if (originalAnnotationId && confirm("Are you sure you want to delete this annotation?")) {
|
|
3140
3128
|
const index = pageEditor.structural.items.getWithoutTracking().findIndex((item) => item.id === originalAnnotationId);
|
|
3141
3129
|
pageEditor.structural.items.deleteAtIndex(index);
|
|
3142
3130
|
}
|
|
3143
3131
|
};
|
|
3144
|
-
return /* @__PURE__ */ (0,
|
|
3132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
3145
3133
|
"div",
|
|
3146
3134
|
{
|
|
3147
3135
|
...highlightProps,
|
|
3148
3136
|
className: "border border-gray-300 hover:border-me-500 shadow-sm rounded p-3 bg-white relative",
|
|
3149
3137
|
children: [
|
|
3150
|
-
/* @__PURE__ */ (0,
|
|
3151
|
-
/* @__PURE__ */ (0,
|
|
3152
|
-
/* @__PURE__ */ (0,
|
|
3138
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "absolute top-1 right-1 z-20 flex gap-2", children: [
|
|
3139
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components15.ActionButton, { onPress: () => deleteAnnotation(), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components15.DeleteForeverIcon, {}) }),
|
|
3140
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components15.ActionButton, { onPress: () => setIsOpen((o2) => !o2), children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CloseIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components16.ListEditIcon, {}) })
|
|
3153
3141
|
] }),
|
|
3154
|
-
/* @__PURE__ */ (0,
|
|
3155
|
-
/* @__PURE__ */ (0,
|
|
3156
|
-
/* @__PURE__ */ (0,
|
|
3157
|
-
/* @__PURE__ */ (0,
|
|
3158
|
-
] }) : /* @__PURE__ */ (0,
|
|
3159
|
-
/* @__PURE__ */ (0,
|
|
3160
|
-
|
|
3142
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex gap-2 mb-2", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex-1 min-w-0", children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
3143
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h3", { className: "text-lg font-semibold border-b pt-1 pb-2 mb-2", children: "Edit step" }),
|
|
3144
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_editors8.LanguageMapEditor, { dispatchType: "label" }),
|
|
3145
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_editors8.LanguageMapEditor, { dispatchType: "summary" })
|
|
3146
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
3147
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3148
|
+
import_react_iiif_vault15.LocaleString,
|
|
3161
3149
|
{
|
|
3162
3150
|
as: "div",
|
|
3163
3151
|
className: "whitespace-nowrap overflow-ellipsis w-full overflow-x-hidden",
|
|
3164
3152
|
children: annotation?.label
|
|
3165
3153
|
}
|
|
3166
3154
|
),
|
|
3167
|
-
/* @__PURE__ */ (0,
|
|
3168
|
-
|
|
3155
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3156
|
+
import_react_iiif_vault15.LocaleString,
|
|
3169
3157
|
{
|
|
3170
3158
|
className: "text-gray-500 text-sm bg-white line-clamp-2",
|
|
3171
3159
|
as: "div",
|
|
@@ -3173,25 +3161,25 @@ function TourPaintingAnnotationEditor({
|
|
|
3173
3161
|
}
|
|
3174
3162
|
)
|
|
3175
3163
|
] }) }) }),
|
|
3176
|
-
/* @__PURE__ */ (0,
|
|
3177
|
-
/* @__PURE__ */ (0,
|
|
3164
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components15.ActionButton, { onPress: () => edit(annotation), children: "Edit target annotation" }),
|
|
3165
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "absolute -bottom-5 h-8 -z-10 border-l-2 border-gray-300 w-0" })
|
|
3178
3166
|
]
|
|
3179
3167
|
}
|
|
3180
3168
|
);
|
|
3181
3169
|
}
|
|
3182
3170
|
|
|
3183
3171
|
// src/components/TourAnnotationEditor.tsx
|
|
3184
|
-
var
|
|
3172
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3185
3173
|
function TourAnnotationEditor() {
|
|
3186
|
-
const [annotation, { annotationTarget, highlightProps }] = (0,
|
|
3187
|
-
const resource = (0,
|
|
3174
|
+
const [annotation, { annotationTarget, highlightProps }] = (0, import_editors9.useAnnotationInfo)();
|
|
3175
|
+
const resource = (0, import_react8.useMemo)(() => {
|
|
3188
3176
|
if (annotationTarget) {
|
|
3189
3177
|
return { id: annotationTarget, type: "Annotation" };
|
|
3190
3178
|
}
|
|
3191
3179
|
return { id: annotation?.id, type: "Annotation" };
|
|
3192
3180
|
}, [annotation?.id, annotationTarget]);
|
|
3193
3181
|
if (annotationTarget) {
|
|
3194
|
-
return /* @__PURE__ */ (0,
|
|
3182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_shell15.ResourceEditingProvider, { resource, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_iiif_vault16.AnnotationContext, { annotation: annotationTarget, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3195
3183
|
TourPaintingAnnotationEditor,
|
|
3196
3184
|
{
|
|
3197
3185
|
originalAnnotationId: annotation?.id,
|
|
@@ -3199,37 +3187,37 @@ function TourAnnotationEditor() {
|
|
|
3199
3187
|
}
|
|
3200
3188
|
) }) });
|
|
3201
3189
|
}
|
|
3202
|
-
return /* @__PURE__ */ (0,
|
|
3190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_shell15.ResourceEditingProvider, { resource, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TourNormalAnnotationEditor, { highlightProps }) });
|
|
3203
3191
|
}
|
|
3204
3192
|
|
|
3205
3193
|
// src/components/TourAnnotationPageEditor.tsx
|
|
3206
|
-
var
|
|
3194
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3207
3195
|
function TourAnnotationPageEditor({
|
|
3208
3196
|
reorderable = false
|
|
3209
3197
|
}) {
|
|
3210
|
-
const page = (0,
|
|
3211
|
-
const editor = (0,
|
|
3198
|
+
const page = (0, import_react_iiif_vault17.useAnnotationPage)();
|
|
3199
|
+
const editor = (0, import_shell16.useGenericEditor)(page);
|
|
3212
3200
|
if (!page) {
|
|
3213
3201
|
return null;
|
|
3214
3202
|
}
|
|
3215
3203
|
if (!reorderable) {
|
|
3216
|
-
return /* @__PURE__ */ (0,
|
|
3204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: page.items.map((annotation) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_iiif_vault17.AnnotationContext, { annotation: annotation.id, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TourAnnotationEditor, {}) }, annotation.id)) });
|
|
3217
3205
|
}
|
|
3218
|
-
return /* @__PURE__ */ (0,
|
|
3219
|
-
|
|
3206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3207
|
+
import_editors10.ReorderList,
|
|
3220
3208
|
{
|
|
3221
3209
|
id: page.id,
|
|
3222
3210
|
marginBottom: "0.5em",
|
|
3223
3211
|
items: page.items || [],
|
|
3224
3212
|
inlineHandle: false,
|
|
3225
3213
|
reorder: ({ startIndex, endIndex }) => editor.structural.items.reorder(startIndex, endIndex),
|
|
3226
|
-
renderItem: (ref, index) => /* @__PURE__ */ (0,
|
|
3214
|
+
renderItem: (ref, index) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_iiif_vault17.AnnotationContext, { annotation: ref.id, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TourAnnotationEditor, {}) })
|
|
3227
3215
|
}
|
|
3228
3216
|
) });
|
|
3229
3217
|
}
|
|
3230
3218
|
|
|
3231
3219
|
// src/right-panels/ExhibitionTourSteps.tsx
|
|
3232
|
-
var
|
|
3220
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3233
3221
|
var exhibitionTourSteps = {
|
|
3234
3222
|
id: "@exhibition/tour-steps",
|
|
3235
3223
|
supports: {
|
|
@@ -3246,20 +3234,20 @@ var exhibitionTourSteps = {
|
|
|
3246
3234
|
}
|
|
3247
3235
|
},
|
|
3248
3236
|
label: "Tour steps",
|
|
3249
|
-
component: () => /* @__PURE__ */ (0,
|
|
3237
|
+
component: () => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ExhibitionRightPanelOptionalPage, {})
|
|
3250
3238
|
};
|
|
3251
3239
|
function ExhibitionRightPanelOptionalPage() {
|
|
3252
|
-
const canvas = (0,
|
|
3240
|
+
const canvas = (0, import_react_iiif_vault18.useCanvas)();
|
|
3253
3241
|
const firstAnnotationPage = canvas?.annotations[0];
|
|
3254
3242
|
const itemsAnnotationPage = canvas?.items[0];
|
|
3255
3243
|
if (!firstAnnotationPage || !canvas || !itemsAnnotationPage) {
|
|
3256
|
-
return /* @__PURE__ */ (0,
|
|
3244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PromptCreationOfTourSteps, {});
|
|
3257
3245
|
}
|
|
3258
|
-
return /* @__PURE__ */ (0,
|
|
3246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ExhibitionRightPanel3, {});
|
|
3259
3247
|
}
|
|
3260
3248
|
function PromptCreationOfTourSteps() {
|
|
3261
|
-
const canvas = (0,
|
|
3262
|
-
const creator = (0,
|
|
3249
|
+
const canvas = (0, import_react_iiif_vault18.useCanvas)();
|
|
3250
|
+
const creator = (0, import_shell17.useInlineCreator)();
|
|
3263
3251
|
const createEmptyAnnotationPage = () => {
|
|
3264
3252
|
if (!canvas)
|
|
3265
3253
|
return;
|
|
@@ -3284,9 +3272,9 @@ function PromptCreationOfTourSteps() {
|
|
|
3284
3272
|
}
|
|
3285
3273
|
);
|
|
3286
3274
|
};
|
|
3287
|
-
return /* @__PURE__ */ (0,
|
|
3288
|
-
/* @__PURE__ */ (0,
|
|
3289
|
-
/* @__PURE__ */ (0,
|
|
3275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col items-center justify-center p-4", children: [
|
|
3276
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "p-4 opacity-50 text-center", children: "This image does not yet have a tour." }),
|
|
3277
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3290
3278
|
import_react_aria_components2.Button,
|
|
3291
3279
|
{
|
|
3292
3280
|
className: "border w-full disabled:opacity-50 border-gray-300 hover:border-me-500 hover:bg-me-50 cursor-pointer shadow-sm rounded p-4 bg-white relative text-black/40 hover:text-me-500",
|
|
@@ -3297,13 +3285,13 @@ function PromptCreationOfTourSteps() {
|
|
|
3297
3285
|
] });
|
|
3298
3286
|
}
|
|
3299
3287
|
function ExhibitionRightPanel3() {
|
|
3300
|
-
const canvas = (0,
|
|
3288
|
+
const canvas = (0, import_react_iiif_vault18.useCanvas)();
|
|
3301
3289
|
const firstAnnotationPage = canvas?.annotations[0];
|
|
3302
3290
|
const itemsAnnotationPage = canvas?.items[0];
|
|
3303
|
-
const editor = (0,
|
|
3304
|
-
const creator = (0,
|
|
3305
|
-
const [reorderable, setReorderable] = (0,
|
|
3306
|
-
const { requestAnnotation, isPending, busy, cancelRequest, completeRequest } = (0,
|
|
3291
|
+
const editor = (0, import_shell17.useGenericEditor)(firstAnnotationPage);
|
|
3292
|
+
const creator = (0, import_shell17.useInlineCreator)();
|
|
3293
|
+
const [reorderable, setReorderable] = (0, import_react9.useState)(false);
|
|
3294
|
+
const { requestAnnotation, isPending, busy, cancelRequest, completeRequest } = (0, import_shell17.useRequestAnnotation)({
|
|
3307
3295
|
onSuccess: (resp) => {
|
|
3308
3296
|
if (!resp.cancelled && resp.target && firstAnnotationPage) {
|
|
3309
3297
|
creator.create(
|
|
@@ -3340,18 +3328,18 @@ function ExhibitionRightPanel3() {
|
|
|
3340
3328
|
if (!canvas)
|
|
3341
3329
|
return null;
|
|
3342
3330
|
if (!firstAnnotationPage) {
|
|
3343
|
-
return /* @__PURE__ */ (0,
|
|
3331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { children: "No annotation page - create one?" });
|
|
3344
3332
|
}
|
|
3345
|
-
return /* @__PURE__ */ (0,
|
|
3346
|
-
/* @__PURE__ */ (0,
|
|
3347
|
-
/* @__PURE__ */ (0,
|
|
3348
|
-
/* @__PURE__ */ (0,
|
|
3333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components17.Sidebar, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_components17.SidebarContent, { padding: true, children: [
|
|
3334
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-4 border-b pt-4 pb-2 mb-2", children: [
|
|
3335
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h2", { className: "text-lg font-semibold flex-1", children: "Tour steps" }),
|
|
3336
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components17.ActionButton, { onPress: () => setReorderable((r2) => !r2), children: reorderable ? "Done" : "Reorder" })
|
|
3349
3337
|
] }),
|
|
3350
|
-
/* @__PURE__ */ (0,
|
|
3351
|
-
/* @__PURE__ */ (0,
|
|
3352
|
-
/* @__PURE__ */ (0,
|
|
3353
|
-
!busy ? isPending ? /* @__PURE__ */ (0,
|
|
3354
|
-
/* @__PURE__ */ (0,
|
|
3338
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_shell17.ResourceEditingProvider, { resource: canvas, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_react_iiif_vault18.AnnotationPageContext, { annotationPage: firstAnnotationPage.id, children: [
|
|
3339
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-4", children: [
|
|
3340
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TourAnnotationPageEditor, { reorderable }),
|
|
3341
|
+
!busy ? isPending ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "border grid grid-cols-2 gap-2 disabled:opacity-50 border-gray-300 shadow-sm rounded p-1 bg-white relative text-black/40", children: [
|
|
3342
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3355
3343
|
import_react_aria_components2.Button,
|
|
3356
3344
|
{
|
|
3357
3345
|
onPress: cancelRequest,
|
|
@@ -3359,7 +3347,7 @@ function ExhibitionRightPanel3() {
|
|
|
3359
3347
|
children: "Cancel"
|
|
3360
3348
|
}
|
|
3361
3349
|
),
|
|
3362
|
-
/* @__PURE__ */ (0,
|
|
3350
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3363
3351
|
import_react_aria_components2.Button,
|
|
3364
3352
|
{
|
|
3365
3353
|
onPress: completeRequest,
|
|
@@ -3367,7 +3355,7 @@ function ExhibitionRightPanel3() {
|
|
|
3367
3355
|
children: "Save changes"
|
|
3368
3356
|
}
|
|
3369
3357
|
)
|
|
3370
|
-
] }) : /* @__PURE__ */ (0,
|
|
3358
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3371
3359
|
import_react_aria_components2.Button,
|
|
3372
3360
|
{
|
|
3373
3361
|
onPress: () => requestAnnotation({ type: "polygon" }),
|
|
@@ -3376,10 +3364,10 @@ function ExhibitionRightPanel3() {
|
|
|
3376
3364
|
}
|
|
3377
3365
|
) : null
|
|
3378
3366
|
] }),
|
|
3379
|
-
itemsAnnotationPage ? /* @__PURE__ */ (0,
|
|
3380
|
-
/* @__PURE__ */ (0,
|
|
3381
|
-
/* @__PURE__ */ (0,
|
|
3382
|
-
|
|
3367
|
+
itemsAnnotationPage ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
3368
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h3", { className: "text-md border-b pt-4 pb-2 mb-2", children: "Available tour steps from images" }),
|
|
3369
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3370
|
+
import_editors11.PromptToAddPaintingAnnotations,
|
|
3383
3371
|
{
|
|
3384
3372
|
painting: itemsAnnotationPage,
|
|
3385
3373
|
page: editor.ref(),
|
|
@@ -3391,6 +3379,195 @@ function ExhibitionRightPanel3() {
|
|
|
3391
3379
|
] }) });
|
|
3392
3380
|
}
|
|
3393
3381
|
|
|
3382
|
+
// src/right-panels/SlideBehaviours.tsx
|
|
3383
|
+
var import_components18 = require("@manifest-editor/components");
|
|
3384
|
+
var import_editors12 = require("@manifest-editor/editors");
|
|
3385
|
+
var import_shell18 = require("@manifest-editor/shell");
|
|
3386
|
+
var import_react10 = require("react");
|
|
3387
|
+
|
|
3388
|
+
// src/components/AspectRatioWarning.tsx
|
|
3389
|
+
var import_react_iiif_vault19 = require("react-iiif-vault");
|
|
3390
|
+
var import_tiny_invariant2 = __toESM(require("tiny-invariant"), 1);
|
|
3391
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3392
|
+
function AspectRatioWarning() {
|
|
3393
|
+
const canvas = (0, import_react_iiif_vault19.useCanvas)();
|
|
3394
|
+
(0, import_tiny_invariant2.default)(canvas);
|
|
3395
|
+
const ratio = canvas.width && canvas.height ? canvas.width / canvas.height : 0;
|
|
3396
|
+
const target = getHeightWidthRatio(canvas.behavior || []);
|
|
3397
|
+
if (Math.abs(ratio - target.ratio) < 0.01)
|
|
3398
|
+
return null;
|
|
3399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "p-2 rounded bg-me-100", children: [
|
|
3400
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "text-me-700-500", children: "Aspect ratio warning" }),
|
|
3401
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "text-sm text-black/60", children: [
|
|
3402
|
+
"The aspect ratio of this canvas is ",
|
|
3403
|
+
ratio.toFixed(2),
|
|
3404
|
+
" but the target aspect ratio is ",
|
|
3405
|
+
target.ratio.toFixed(2),
|
|
3406
|
+
". Some parts of this image may be cropped.",
|
|
3407
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "relative h-32 w-full mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3408
|
+
"div",
|
|
3409
|
+
{
|
|
3410
|
+
className: "bg-[red] left-0 top-0 z-2 opacity-50 max-w-32 max-h-32",
|
|
3411
|
+
style: { aspectRatio: ratio.toFixed(2) },
|
|
3412
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3413
|
+
"div",
|
|
3414
|
+
{
|
|
3415
|
+
className: "asbolute bg-[white] left-0 top-0 z-1 opacity-50 max-w-32 max-h-32",
|
|
3416
|
+
style: { aspectRatio: target.ratio }
|
|
3417
|
+
}
|
|
3418
|
+
)
|
|
3419
|
+
}
|
|
3420
|
+
) })
|
|
3421
|
+
] })
|
|
3422
|
+
] });
|
|
3423
|
+
}
|
|
3424
|
+
|
|
3425
|
+
// src/right-panels/SlideBehaviours.tsx
|
|
3426
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3427
|
+
var customBehaviourEditor = {
|
|
3428
|
+
component: () => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SlideBehavioursPanel, {}),
|
|
3429
|
+
supports: {
|
|
3430
|
+
edit: true,
|
|
3431
|
+
resourceTypes: ["Canvas"],
|
|
3432
|
+
properties: ["behavior"]
|
|
3433
|
+
},
|
|
3434
|
+
id: "slide-behaviors",
|
|
3435
|
+
label: "Layout",
|
|
3436
|
+
tabs: {
|
|
3437
|
+
showTitle: true
|
|
3438
|
+
}
|
|
3439
|
+
};
|
|
3440
|
+
var exhibitionConfigs = [
|
|
3441
|
+
{
|
|
3442
|
+
id: "layout",
|
|
3443
|
+
type: "choice",
|
|
3444
|
+
label: { en: ["Layout"] },
|
|
3445
|
+
initialOpen: true,
|
|
3446
|
+
items: [
|
|
3447
|
+
{
|
|
3448
|
+
label: { en: ["Text on left"] },
|
|
3449
|
+
value: "left"
|
|
3450
|
+
},
|
|
3451
|
+
{
|
|
3452
|
+
label: { en: ["Text on right"] },
|
|
3453
|
+
value: "right"
|
|
3454
|
+
},
|
|
3455
|
+
{
|
|
3456
|
+
label: { en: ["Text on bottom"] },
|
|
3457
|
+
value: "bottom"
|
|
3458
|
+
},
|
|
3459
|
+
{
|
|
3460
|
+
label: { en: ["Only image"] },
|
|
3461
|
+
value: "image"
|
|
3462
|
+
}
|
|
3463
|
+
]
|
|
3464
|
+
},
|
|
3465
|
+
{
|
|
3466
|
+
id: "size",
|
|
3467
|
+
component: (existing, setBehaviors) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(EditSize, { behaviors: existing, setBehaviors }),
|
|
3468
|
+
label: { en: ["Size"] },
|
|
3469
|
+
type: "custom",
|
|
3470
|
+
initialOpen: true,
|
|
3471
|
+
supports: (b) => b.startsWith("w-") || b.startsWith("h-")
|
|
3472
|
+
}
|
|
3473
|
+
];
|
|
3474
|
+
function parseBehaviors(items) {
|
|
3475
|
+
let width = 0;
|
|
3476
|
+
let height = 0;
|
|
3477
|
+
for (const item of items) {
|
|
3478
|
+
if (item.startsWith("w-")) {
|
|
3479
|
+
width = Number.parseInt(item.slice(2));
|
|
3480
|
+
}
|
|
3481
|
+
if (item.startsWith("h-")) {
|
|
3482
|
+
height = Number.parseInt(item.slice(2));
|
|
3483
|
+
}
|
|
3484
|
+
}
|
|
3485
|
+
return {
|
|
3486
|
+
width,
|
|
3487
|
+
height
|
|
3488
|
+
};
|
|
3489
|
+
}
|
|
3490
|
+
function EditSize({ behaviors, setBehaviors }) {
|
|
3491
|
+
const { width, height } = parseBehaviors(behaviors);
|
|
3492
|
+
const [hoverPosition, setHoverPosition] = (0, import_react10.useState)({ x: -1, y: -1 });
|
|
3493
|
+
const setBehavior = (w2, h) => {
|
|
3494
|
+
const newBehaviors = behaviors.filter((b) => {
|
|
3495
|
+
return !b.startsWith("w-") && !b.startsWith("h-");
|
|
3496
|
+
});
|
|
3497
|
+
newBehaviors.push(`w-${w2}`);
|
|
3498
|
+
newBehaviors.push(`h-${h}`);
|
|
3499
|
+
setBehaviors(newBehaviors);
|
|
3500
|
+
};
|
|
3501
|
+
const cells = Array.from({ length: 144 }, (_2, i2) => {
|
|
3502
|
+
const x2 = i2 % 12;
|
|
3503
|
+
const y2 = Math.floor(i2 / 12);
|
|
3504
|
+
const hovered = hoverPosition.x >= x2 && hoverPosition.y >= y2;
|
|
3505
|
+
const selected = x2 < width && y2 < height;
|
|
3506
|
+
const hoveredAndSelected = hovered && selected;
|
|
3507
|
+
let bgClass = "bg-gray-200";
|
|
3508
|
+
if (hovered) {
|
|
3509
|
+
bgClass = "bg-me-200";
|
|
3510
|
+
}
|
|
3511
|
+
if (selected) {
|
|
3512
|
+
bgClass = "bg-me-500";
|
|
3513
|
+
}
|
|
3514
|
+
if (hoveredAndSelected) {
|
|
3515
|
+
bgClass = "bg-me-400";
|
|
3516
|
+
}
|
|
3517
|
+
return (
|
|
3518
|
+
// biome-ignore lint/a11y/useKeyWithClickEvents: <explanation>
|
|
3519
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3520
|
+
"div",
|
|
3521
|
+
{
|
|
3522
|
+
className: `flex aspect-square rounded cursor-se-resize items-center justify-center ${bgClass}`,
|
|
3523
|
+
onClick: () => setBehavior(x2 + 1, y2 + 1),
|
|
3524
|
+
onMouseUp: () => setBehavior(x2 + 1, y2 + 1),
|
|
3525
|
+
onMouseEnter: () => setHoverPosition({ x: x2, y: y2 })
|
|
3526
|
+
},
|
|
3527
|
+
i2
|
|
3528
|
+
)
|
|
3529
|
+
);
|
|
3530
|
+
});
|
|
3531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "grid grid-cols-12 grid-rows-12 gap-1", onMouseLeave: () => setHoverPosition({ x: -1, y: -1 }), children: cells });
|
|
3532
|
+
}
|
|
3533
|
+
function SlideBehavioursPanel() {
|
|
3534
|
+
const canvas = (0, import_editors12.useInStack)("Canvas");
|
|
3535
|
+
const editor = (0, import_shell18.useEditor)();
|
|
3536
|
+
const { width, height } = editor.technical;
|
|
3537
|
+
if (!canvas || editor.technical.type !== "Canvas") {
|
|
3538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_components18.Sidebar, { children: [
|
|
3539
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_components18.SidebarHeader, { title: "Slide behaviors" }),
|
|
3540
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: "Please select canvas" })
|
|
3541
|
+
] });
|
|
3542
|
+
}
|
|
3543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_components18.Sidebar, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_components18.SidebarContent, { children: [
|
|
3544
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "px-2", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_editors12.InputContainer, { $wide: true, children: [
|
|
3545
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3546
|
+
import_editors12.DimensionsTriplet,
|
|
3547
|
+
{
|
|
3548
|
+
widthId: width.containerId(),
|
|
3549
|
+
width: width.get() || 0,
|
|
3550
|
+
changeWidth: (v2) => width.set(v2),
|
|
3551
|
+
heightId: height.containerId(),
|
|
3552
|
+
height: height.get() || 0,
|
|
3553
|
+
changeHeight: (v2) => height.set(v2)
|
|
3554
|
+
}
|
|
3555
|
+
),
|
|
3556
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AspectRatioWarning, {}) })
|
|
3557
|
+
] }) }),
|
|
3558
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3559
|
+
import_editors12.BehaviorEditor,
|
|
3560
|
+
{
|
|
3561
|
+
behavior: editor.technical.behavior.get() || [],
|
|
3562
|
+
onChange: (v2) => {
|
|
3563
|
+
editor.technical.behavior.set(v2);
|
|
3564
|
+
},
|
|
3565
|
+
configs: exhibitionConfigs
|
|
3566
|
+
}
|
|
3567
|
+
)
|
|
3568
|
+
] }) });
|
|
3569
|
+
}
|
|
3570
|
+
|
|
3394
3571
|
// src/index.tsx
|
|
3395
3572
|
var exhibitionEditorPreset = (0, import_shell19.extendApp)(
|
|
3396
3573
|
(0, import_shell19.mapApp)(ManifestPreset),
|
|
@@ -3432,14 +3609,19 @@ var exhibitionEditorPreset = (0, import_shell19.extendApp)(
|
|
|
3432
3609
|
youtubeMainEdtior,
|
|
3433
3610
|
infoBlockEditor
|
|
3434
3611
|
],
|
|
3435
|
-
editors: [
|
|
3612
|
+
editors: [
|
|
3613
|
+
exhibitionCanvasEditor,
|
|
3614
|
+
customBehaviourEditor,
|
|
3615
|
+
exhibitionSummaryEdtior,
|
|
3616
|
+
exhibitionTourSteps
|
|
3617
|
+
],
|
|
3436
3618
|
creators: [
|
|
3437
3619
|
infoBoxCreator,
|
|
3438
|
-
|
|
3620
|
+
youtubeSlideCreator,
|
|
3621
|
+
imageServiceSlideCreator,
|
|
3622
|
+
imageBrowserSlideCreator,
|
|
3439
3623
|
imageSlideCreator,
|
|
3440
|
-
|
|
3441
|
-
imageSlideRightCreator,
|
|
3442
|
-
youtubeSlideCreator
|
|
3624
|
+
imageUrlSlideCreator
|
|
3443
3625
|
]
|
|
3444
3626
|
}
|
|
3445
3627
|
);
|