@manifest-editor/shell 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +237 -256
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +246 -258
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -464,6 +464,7 @@ import { createContext as createContext5, memo, useContext as useContext5, useEf
|
|
|
464
464
|
|
|
465
465
|
// src/PreviewContext/PreviewContext.hooks.ts
|
|
466
466
|
import { useMemo as useMemo4 } from "react";
|
|
467
|
+
import { useVault } from "react-iiif-vault";
|
|
467
468
|
|
|
468
469
|
// src/PreviewContext/previews/ExternalManifestUrlPreview.ts
|
|
469
470
|
var ExternalManifestUrlPreview = class {
|
|
@@ -637,7 +638,6 @@ var IIIFPreviewService = class {
|
|
|
637
638
|
};
|
|
638
639
|
|
|
639
640
|
// src/PreviewContext/PreviewContext.hooks.ts
|
|
640
|
-
import { useVault } from "react-iiif-vault";
|
|
641
641
|
function usePreviewActions(state, dispatch, handlers, previews, setPreviews) {
|
|
642
642
|
const resource = useAppResource();
|
|
643
643
|
const instanceId = useAppResourceInstance();
|
|
@@ -709,8 +709,8 @@ function usePreviewActions(state, dispatch, handlers, previews, setPreviews) {
|
|
|
709
709
|
async function selectPreview(id) {
|
|
710
710
|
const selectedHandler = handlerMap[id];
|
|
711
711
|
if (selectedHandler && instanceId) {
|
|
712
|
-
await activatePreview(id);
|
|
713
712
|
dispatch({ type: "selectPreview", payload: id });
|
|
713
|
+
await activatePreview(id);
|
|
714
714
|
}
|
|
715
715
|
}
|
|
716
716
|
async function getPreviewLink() {
|
|
@@ -762,13 +762,13 @@ function usePreviewActions(state, dispatch, handlers, previews, setPreviews) {
|
|
|
762
762
|
dispatch({ type: "activatePreview", payload: contextualPreview.id });
|
|
763
763
|
} else {
|
|
764
764
|
Object.assign(context, existing?.data || {});
|
|
765
|
-
dispatch({ type: "activatePreview", payload: id });
|
|
765
|
+
dispatch({ type: "activatePreview", payload: existing.id });
|
|
766
766
|
}
|
|
767
767
|
}
|
|
768
768
|
const created = await selectedHandler.createPreview(instanceId, resource, vault, context);
|
|
769
769
|
if (created) {
|
|
770
770
|
previewActions.setPreview(created);
|
|
771
|
-
dispatch({ type: "activatePreview", payload: id });
|
|
771
|
+
dispatch({ type: "activatePreview", payload: created.id });
|
|
772
772
|
}
|
|
773
773
|
}
|
|
774
774
|
}
|
|
@@ -1083,20 +1083,13 @@ var ButtonEmpty = styled3.div`
|
|
|
1083
1083
|
|
|
1084
1084
|
// src/PreviewButton/PreviewButton.tsx
|
|
1085
1085
|
import { Fragment, jsx as jsx8, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1086
|
-
function PreviewButton({
|
|
1087
|
-
downloadEnabled,
|
|
1088
|
-
fileName
|
|
1089
|
-
}) {
|
|
1086
|
+
function PreviewButton({ downloadEnabled, fileName }) {
|
|
1090
1087
|
const { active, configs, actions, selected } = usePreviewContext();
|
|
1091
1088
|
const vault = useVault2();
|
|
1092
1089
|
const config = useConfig();
|
|
1093
1090
|
const resource = useAppResource();
|
|
1094
|
-
const configsToShow = configs.filter(
|
|
1095
|
-
|
|
1096
|
-
);
|
|
1097
|
-
const { isOpen, buttonProps, itemProps } = useDropdownMenu(
|
|
1098
|
-
configsToShow.length
|
|
1099
|
-
);
|
|
1091
|
+
const configsToShow = configs.filter((c) => c.type === "external-manifest-preview");
|
|
1092
|
+
const { isOpen, buttonProps, itemProps } = useDropdownMenu(configsToShow.length);
|
|
1100
1093
|
if (configsToShow.length === 0) {
|
|
1101
1094
|
return /* @__PURE__ */ jsx8(ButtonEmpty, { children: "Preview not available" });
|
|
1102
1095
|
}
|
|
@@ -1108,17 +1101,9 @@ function PreviewButton({
|
|
|
1108
1101
|
label: "Download manifest",
|
|
1109
1102
|
getData: () => {
|
|
1110
1103
|
if (config.export && config.export.version === 2) {
|
|
1111
|
-
return JSON.stringify(
|
|
1112
|
-
vault.toPresentation2(resource),
|
|
1113
|
-
null,
|
|
1114
|
-
2
|
|
1115
|
-
);
|
|
1104
|
+
return JSON.stringify(vault.toPresentation2(resource), null, 2);
|
|
1116
1105
|
}
|
|
1117
|
-
return JSON.stringify(
|
|
1118
|
-
vault.toPresentation3(resource),
|
|
1119
|
-
null,
|
|
1120
|
-
2
|
|
1121
|
-
);
|
|
1106
|
+
return JSON.stringify(vault.toPresentation3(resource), null, 2);
|
|
1122
1107
|
}
|
|
1123
1108
|
}
|
|
1124
1109
|
) }) : null,
|
|
@@ -1133,7 +1118,6 @@ function PreviewButton({
|
|
|
1133
1118
|
const found = configs.find((c) => c.id === defaultPreviewId);
|
|
1134
1119
|
if (found) {
|
|
1135
1120
|
actions.selectPreview(found.id);
|
|
1136
|
-
actions.updatePreviews();
|
|
1137
1121
|
return;
|
|
1138
1122
|
}
|
|
1139
1123
|
}
|
|
@@ -1148,29 +1132,17 @@ function PreviewButton({
|
|
|
1148
1132
|
/* @__PURE__ */ jsx8(MenuContainer, { $open: isOpen, children: configsToShow.map((config2, key) => {
|
|
1149
1133
|
const inactive = active.indexOf(config2.id) === -1;
|
|
1150
1134
|
return /* @__PURE__ */ jsxs2(MenuItem, { ...itemProps[key], children: [
|
|
1151
|
-
/* @__PURE__ */ jsx8(
|
|
1152
|
-
MenuItemStatus,
|
|
1153
|
-
{
|
|
1154
|
-
$status: inactive ? "available" : config2.id === selected ? "active" : "configured"
|
|
1155
|
-
}
|
|
1156
|
-
),
|
|
1135
|
+
/* @__PURE__ */ jsx8(MenuItemStatus, { $status: inactive ? "available" : config2.id === selected ? "active" : "configured" }),
|
|
1157
1136
|
/* @__PURE__ */ jsx8(
|
|
1158
1137
|
MenuItemLabel,
|
|
1159
1138
|
{
|
|
1160
1139
|
onClick: () => {
|
|
1161
1140
|
actions.selectPreview(config2.id);
|
|
1162
|
-
actions.updatePreviews();
|
|
1163
1141
|
},
|
|
1164
1142
|
children: config2.label
|
|
1165
1143
|
}
|
|
1166
1144
|
),
|
|
1167
|
-
!inactive ? /* @__PURE__ */ jsx8(
|
|
1168
|
-
MenuItemClose,
|
|
1169
|
-
{
|
|
1170
|
-
onClick: () => actions.deletePreview(config2.id),
|
|
1171
|
-
children: /* @__PURE__ */ jsx8(CloseIcon, {})
|
|
1172
|
-
}
|
|
1173
|
-
) : null
|
|
1145
|
+
!inactive ? /* @__PURE__ */ jsx8(MenuItemClose, { onClick: () => actions.deletePreview(config2.id), children: /* @__PURE__ */ jsx8(CloseIcon, {}) }) : null
|
|
1174
1146
|
] }, config2.id);
|
|
1175
1147
|
}) })
|
|
1176
1148
|
] })
|
|
@@ -1626,31 +1598,17 @@ function AtlasStoreProvider({
|
|
|
1626
1598
|
|
|
1627
1599
|
// src/BaseCreator/BaseCreator.tsx
|
|
1628
1600
|
import { toRef as toRef3 } from "@iiif/parser";
|
|
1629
|
-
import {
|
|
1601
|
+
import {
|
|
1602
|
+
CreatorGrid,
|
|
1603
|
+
ErrorMessage as ErrorMessage2,
|
|
1604
|
+
GridIcon,
|
|
1605
|
+
IconButton as IconButton2,
|
|
1606
|
+
ModalBackSlot,
|
|
1607
|
+
Spinner
|
|
1608
|
+
} from "@manifest-editor/components";
|
|
1630
1609
|
import {
|
|
1631
1610
|
matchBasedOnResource as matchBasedOnResource2
|
|
1632
1611
|
} from "@manifest-editor/creator-api";
|
|
1633
|
-
|
|
1634
|
-
// ../ui/madoc/components/icons/Spinner.tsx
|
|
1635
|
-
import { jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1636
|
-
function Spinner(props) {
|
|
1637
|
-
return /* @__PURE__ */ jsx13("svg", { width: "1em", height: "1em", viewBox: "0 0 42 42", xmlns: "http://www.w3.org/2000/svg", stroke: "#fff", ...props, children: /* @__PURE__ */ jsxs4("g", { transform: "translate(2 2)", strokeWidth: 5, fill: "none", fillRule: "evenodd", children: [
|
|
1638
|
-
/* @__PURE__ */ jsx13("circle", { strokeOpacity: 0.5, cx: 18, cy: 18, r: 18 }),
|
|
1639
|
-
/* @__PURE__ */ jsx13("path", { d: "M36 18c0-9.94-8.06-18-18-18", children: /* @__PURE__ */ jsx13(
|
|
1640
|
-
"animateTransform",
|
|
1641
|
-
{
|
|
1642
|
-
attributeName: "transform",
|
|
1643
|
-
type: "rotate",
|
|
1644
|
-
from: "0 18 18",
|
|
1645
|
-
to: "360 18 18",
|
|
1646
|
-
dur: "1s",
|
|
1647
|
-
repeatCount: "indefinite"
|
|
1648
|
-
}
|
|
1649
|
-
) })
|
|
1650
|
-
] }) });
|
|
1651
|
-
}
|
|
1652
|
-
|
|
1653
|
-
// src/BaseCreator/BaseCreator.tsx
|
|
1654
1612
|
import { Suspense, memo as memo3, useEffect as useEffect8, useMemo as useMemo12, useRef as useRef3, useState as useState5 } from "react";
|
|
1655
1613
|
import { useVault as useVault4 } from "react-iiif-vault";
|
|
1656
1614
|
|
|
@@ -1682,11 +1640,11 @@ function useLayoutProvider() {
|
|
|
1682
1640
|
import styled6 from "styled-components";
|
|
1683
1641
|
|
|
1684
1642
|
// ../ui/icons/StarIcon.tsx
|
|
1685
|
-
import { jsx as
|
|
1686
|
-
var StarIcon = (props) => /* @__PURE__ */
|
|
1687
|
-
/* @__PURE__ */
|
|
1688
|
-
/* @__PURE__ */
|
|
1689
|
-
/* @__PURE__ */
|
|
1643
|
+
import { jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1644
|
+
var StarIcon = (props) => /* @__PURE__ */ jsxs4("svg", { xmlns: "http://www.w3.org/2000/svg", height: "1em", width: "1em", viewBox: "0 0 24 24", ...props, children: [
|
|
1645
|
+
/* @__PURE__ */ jsx13("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
1646
|
+
/* @__PURE__ */ jsx13("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
1647
|
+
/* @__PURE__ */ jsx13(
|
|
1690
1648
|
"path",
|
|
1691
1649
|
{
|
|
1692
1650
|
d: "M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z",
|
|
@@ -1696,10 +1654,10 @@ var StarIcon = (props) => /* @__PURE__ */ jsxs5("svg", { xmlns: "http://www.w3.o
|
|
|
1696
1654
|
] });
|
|
1697
1655
|
|
|
1698
1656
|
// ../ui/icons/BackIcon.tsx
|
|
1699
|
-
import { jsx as
|
|
1700
|
-
var BackIcon = ({ style }) => /* @__PURE__ */
|
|
1701
|
-
/* @__PURE__ */
|
|
1702
|
-
/* @__PURE__ */
|
|
1657
|
+
import { jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1658
|
+
var BackIcon = ({ style }) => /* @__PURE__ */ jsxs5("svg", { xmlns: "http://www.w3.org/2000/svg", height: "1rem", viewBox: "0 0 24 24", width: "1rem", fill: "#000000", style, children: [
|
|
1659
|
+
/* @__PURE__ */ jsx14("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
1660
|
+
/* @__PURE__ */ jsx14("path", { d: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" })
|
|
1703
1661
|
] });
|
|
1704
1662
|
|
|
1705
1663
|
// src/Layout/components/ModularPanel.tsx
|
|
@@ -1718,13 +1676,13 @@ var PaddedSidebarContainer = styled4.div`
|
|
|
1718
1676
|
// src/Layout/components/PanelError.tsx
|
|
1719
1677
|
import { ErrorMessage } from "@manifest-editor/components";
|
|
1720
1678
|
import { useState as useState3 } from "react";
|
|
1721
|
-
import { jsx as
|
|
1679
|
+
import { jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1722
1680
|
function PanelError(props) {
|
|
1723
1681
|
let error = props.error.toString();
|
|
1724
1682
|
const [isFixing, setIsFixing] = useState3(false);
|
|
1725
|
-
return /* @__PURE__ */
|
|
1726
|
-
/* @__PURE__ */
|
|
1727
|
-
/* @__PURE__ */
|
|
1683
|
+
return /* @__PURE__ */ jsxs6(PaddedSidebarContainer, { children: [
|
|
1684
|
+
/* @__PURE__ */ jsx15(ErrorMessage, { className: "mb-2", children: error }),
|
|
1685
|
+
/* @__PURE__ */ jsx15(CalltoButton, { onClick: props.resetErrorBoundary, children: "Try again" })
|
|
1728
1686
|
] });
|
|
1729
1687
|
}
|
|
1730
1688
|
|
|
@@ -1848,7 +1806,7 @@ import useDropdownMenu2 from "react-accessible-dropdown-menu-hook";
|
|
|
1848
1806
|
var OverrideScrollbar = "ModularPanel_OverrideScrollbar";
|
|
1849
1807
|
|
|
1850
1808
|
// src/Layout/components/ModularPanel.tsx
|
|
1851
|
-
import { jsx as
|
|
1809
|
+
import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1852
1810
|
var LayoutTitleReactContext = createContext10(null);
|
|
1853
1811
|
function useSetCustomTitle() {
|
|
1854
1812
|
return useContext10(LayoutTitleReactContext);
|
|
@@ -1945,7 +1903,7 @@ var ModulePanelButton = styled6.button`
|
|
|
1945
1903
|
var ModulePanelSpacer = styled6.div`
|
|
1946
1904
|
flex: 1 1 0px;
|
|
1947
1905
|
`;
|
|
1948
|
-
var ModularPanelLabel = styled6.
|
|
1906
|
+
var ModularPanelLabel = styled6.div`
|
|
1949
1907
|
font-size: 0.875em;
|
|
1950
1908
|
flex: 1 1 0px;
|
|
1951
1909
|
padding-left: 1em;
|
|
@@ -2023,16 +1981,16 @@ function ModularPanel({
|
|
|
2023
1981
|
if (!panel || !state.current) {
|
|
2024
1982
|
return null;
|
|
2025
1983
|
}
|
|
2026
|
-
const backButton = panel.backAction || state.stack.length ? /* @__PURE__ */
|
|
2027
|
-
const closeButton = /* @__PURE__ */
|
|
2028
|
-
return /* @__PURE__ */
|
|
2029
|
-
noHeader ? null : /* @__PURE__ */
|
|
2030
|
-
/* @__PURE__ */
|
|
1984
|
+
const backButton = panel.backAction || state.stack.length ? /* @__PURE__ */ jsx16(ModulePanelButton, { onClick: backAction, children: /* @__PURE__ */ jsx16(BackIcon, {}) }) : null;
|
|
1985
|
+
const closeButton = /* @__PURE__ */ jsx16(ModulePanelButton, { onClick: close || actions.close, children: /* @__PURE__ */ jsx16(CloseIcon, {}) });
|
|
1986
|
+
return /* @__PURE__ */ jsx16(LayoutTitleReactContext.Provider, { value: _setCustomTitle, children: /* @__PURE__ */ jsxs7(ModularPanelWrapper, { "data-state": transition, "data-flipped": isLeft, style, "data-header": !noHeader, children: [
|
|
1987
|
+
noHeader ? null : /* @__PURE__ */ jsxs7(ModularPanelHeader, { "data-tabs": !!tabs, "data-error": didError, children: [
|
|
1988
|
+
/* @__PURE__ */ jsxs7(Dropdown, { style: { display: "flex", height: "100%" }, children: [
|
|
2031
1989
|
panel.renderBackAction ? panel.renderBackAction({ backAction, fallback: backButton }) : backButton,
|
|
2032
|
-
switchablePanels.length ? /* @__PURE__ */
|
|
2033
|
-
/* @__PURE__ */
|
|
2034
|
-
/* @__PURE__ */
|
|
2035
|
-
switchablePanels.map((newPanel, i) => /* @__PURE__ */
|
|
1990
|
+
switchablePanels.length ? /* @__PURE__ */ jsxs7(DropdownMenu, { $open: isOpen, style: { left: "0.5em" }, children: [
|
|
1991
|
+
/* @__PURE__ */ jsx16(DropdownLabel, { children: "All panels" }),
|
|
1992
|
+
/* @__PURE__ */ jsx16(DropdownDivider, {}),
|
|
1993
|
+
switchablePanels.map((newPanel, i) => /* @__PURE__ */ jsx16(
|
|
2036
1994
|
DropdownItem,
|
|
2037
1995
|
{
|
|
2038
1996
|
...itemProps[i],
|
|
@@ -2044,11 +2002,11 @@ function ModularPanel({
|
|
|
2044
2002
|
))
|
|
2045
2003
|
] }) : null
|
|
2046
2004
|
] }),
|
|
2047
|
-
customTitle ? /* @__PURE__ */
|
|
2048
|
-
pinnable ? state.pinned ? /* @__PURE__ */
|
|
2005
|
+
customTitle ? /* @__PURE__ */ jsx16(ModularPanelLabel, { children: customTitle }) : hideHeader ? /* @__PURE__ */ jsx16(ModulePanelSpacer, {}) : /* @__PURE__ */ jsx16(ModularPanelLabel, { children: panel.label }),
|
|
2006
|
+
pinnable ? state.pinned ? /* @__PURE__ */ jsx16(ModulePanelButton, { onClick: pinActions.unpin, children: /* @__PURE__ */ jsx16(StarIcon, { fill: "orange" }) }) : /* @__PURE__ */ jsx16(ModulePanelButton, { onClick: () => pinActions.pin({ id: panel.id, state: state.state }), children: /* @__PURE__ */ jsx16(StarIcon, { fill: "#ddd" }) }) : null,
|
|
2049
2007
|
panel.renderCloseAction ? panel.renderCloseAction({ closeAction: close || actions.close, fallback: closeButton }) : closeButton
|
|
2050
2008
|
] }),
|
|
2051
|
-
/* @__PURE__ */
|
|
2009
|
+
/* @__PURE__ */ jsx16(ModularPanelContent, { className: OverrideScrollbar, children: /* @__PURE__ */ jsx16(
|
|
2052
2010
|
ErrorBoundary,
|
|
2053
2011
|
{
|
|
2054
2012
|
onError: () => setDidError(true),
|
|
@@ -2105,15 +2063,13 @@ function createDownload(data, fileName, fileType = "text/json") {
|
|
|
2105
2063
|
a.remove();
|
|
2106
2064
|
}
|
|
2107
2065
|
async function copyToClipboard(json) {
|
|
2108
|
-
return navigator.clipboard.writeText(
|
|
2109
|
-
typeof json === "string" ? json : JSON.stringify(json, null, 2)
|
|
2110
|
-
);
|
|
2066
|
+
return navigator.clipboard.writeText(typeof json === "string" ? json : JSON.stringify(json, null, 2));
|
|
2111
2067
|
}
|
|
2112
2068
|
function randomId() {
|
|
2113
2069
|
return `${Math.random().toString(36).substr(2)}-${Date.now().toString(36)}`;
|
|
2114
2070
|
}
|
|
2115
2071
|
function mapApp(input, map) {
|
|
2116
|
-
const { default: metadata, ...props } = input;
|
|
2072
|
+
const { default: metadata, config, ...props } = input;
|
|
2117
2073
|
const app = {
|
|
2118
2074
|
metadata,
|
|
2119
2075
|
layout: {
|
|
@@ -2121,7 +2077,8 @@ function mapApp(input, map) {
|
|
|
2121
2077
|
rightPanels: [],
|
|
2122
2078
|
centerPanels: [],
|
|
2123
2079
|
...props
|
|
2124
|
-
}
|
|
2080
|
+
},
|
|
2081
|
+
config
|
|
2125
2082
|
};
|
|
2126
2083
|
return map ? map(app) : app;
|
|
2127
2084
|
}
|
|
@@ -2144,35 +2101,17 @@ function extendApp(app, metadata, extensions) {
|
|
|
2144
2101
|
}),
|
|
2145
2102
|
...extensions?.leftPanels || []
|
|
2146
2103
|
],
|
|
2147
|
-
annotations: [
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
],
|
|
2151
|
-
canvasEditors: [
|
|
2152
|
-
...extensions?.canvasEditors || [],
|
|
2153
|
-
...app.layout.canvasEditors || []
|
|
2154
|
-
],
|
|
2155
|
-
creators: [
|
|
2156
|
-
...extensions?.creators || [],
|
|
2157
|
-
...app.layout.creators || []
|
|
2158
|
-
],
|
|
2104
|
+
annotations: [...extensions?.annotations || [], ...app.layout.annotations || []],
|
|
2105
|
+
canvasEditors: [...extensions?.canvasEditors || [], ...app.layout.canvasEditors || []],
|
|
2106
|
+
creators: [...extensions?.creators || [], ...app.layout.creators || []],
|
|
2159
2107
|
editors: [
|
|
2160
2108
|
//
|
|
2161
2109
|
...extensions?.editors || [],
|
|
2162
2110
|
...app.layout.editors || []
|
|
2163
2111
|
],
|
|
2164
|
-
rightPanels: [
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
],
|
|
2168
|
-
centerPanels: [
|
|
2169
|
-
...app.layout.centerPanels || [],
|
|
2170
|
-
...extensions?.centerPanels || []
|
|
2171
|
-
],
|
|
2172
|
-
modals: [
|
|
2173
|
-
...app.layout.modals || [],
|
|
2174
|
-
...extensions?.modalPanels || []
|
|
2175
|
-
]
|
|
2112
|
+
rightPanels: [...app.layout.rightPanels || [], ...extensions?.rightPanels || []],
|
|
2113
|
+
centerPanels: [...app.layout.centerPanels || [], ...extensions?.centerPanels || []],
|
|
2114
|
+
modals: [...app.layout.modals || [], ...extensions?.modalPanels || []]
|
|
2176
2115
|
}
|
|
2177
2116
|
};
|
|
2178
2117
|
}
|
|
@@ -2345,7 +2284,7 @@ function createPreviewVault(homepageCollectionId = "vault://homepage-collection.
|
|
|
2345
2284
|
}
|
|
2346
2285
|
|
|
2347
2286
|
// src/PreviewVault/PreviewVault.tsx
|
|
2348
|
-
import { jsx as
|
|
2287
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
2349
2288
|
function usePreviewVault() {
|
|
2350
2289
|
return useContext11(PreviewVaultReactContext);
|
|
2351
2290
|
}
|
|
@@ -2367,11 +2306,11 @@ function PreviewVaultContext(props) {
|
|
|
2367
2306
|
useEffect7(() => {
|
|
2368
2307
|
return unsubscribe;
|
|
2369
2308
|
}, []);
|
|
2370
|
-
return /* @__PURE__ */
|
|
2309
|
+
return /* @__PURE__ */ jsx17(PreviewVaultAddHistory.Provider, { value: { addHistory, clearHistory }, children: /* @__PURE__ */ jsx17(PreviewVaultReactContext.Provider, { value: vault, children: props.children }) });
|
|
2371
2310
|
}
|
|
2372
2311
|
function PreviewVaultBoundary({ children }) {
|
|
2373
2312
|
const vault = usePreviewVault();
|
|
2374
|
-
return /* @__PURE__ */
|
|
2313
|
+
return /* @__PURE__ */ jsx17(VaultProvider2, { vault, children });
|
|
2375
2314
|
}
|
|
2376
2315
|
|
|
2377
2316
|
// src/BaseCreator/BaseCreator.hooks.tsx
|
|
@@ -2472,11 +2411,12 @@ function useInlineCreator() {
|
|
|
2472
2411
|
}
|
|
2473
2412
|
|
|
2474
2413
|
// src/BaseCreator/BaseCreator.tsx
|
|
2475
|
-
import { Fragment as Fragment2, jsx as
|
|
2414
|
+
import { Fragment as Fragment2, jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2476
2415
|
var RenderCreator = memo3(function RenderCreator2(props) {
|
|
2477
2416
|
const vault = useVault4();
|
|
2478
2417
|
const { edit, modal } = useLayoutActions();
|
|
2479
2418
|
const [isCreating, setIsCreating] = useState5(false);
|
|
2419
|
+
const [error, setError] = useState5(null);
|
|
2480
2420
|
const creator = useInlineCreator();
|
|
2481
2421
|
const isCreatingRef = useRef3(false);
|
|
2482
2422
|
const canvasSelector = props.resource.initialData?.selector;
|
|
@@ -2492,18 +2432,32 @@ var RenderCreator = memo3(function RenderCreator2(props) {
|
|
|
2492
2432
|
initialData: props.resource.initialData
|
|
2493
2433
|
};
|
|
2494
2434
|
const runCreate = (payload) => {
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2435
|
+
try {
|
|
2436
|
+
if (isCreating || isCreatingRef.current)
|
|
2437
|
+
return;
|
|
2438
|
+
setIsCreating(true);
|
|
2439
|
+
isCreatingRef.current = true;
|
|
2440
|
+
creator.create(props.creator.id, payload, options).catch((err) => {
|
|
2441
|
+
setError(err?.message || "Unknown error");
|
|
2442
|
+
return null;
|
|
2443
|
+
}).then(async (ref) => {
|
|
2444
|
+
if (!ref)
|
|
2445
|
+
return;
|
|
2446
|
+
const singleRef = Array.isArray(ref) ? ref[0] : ref;
|
|
2447
|
+
setIsCreating(false);
|
|
2448
|
+
modal.popStack();
|
|
2449
|
+
modal.close();
|
|
2450
|
+
if (singleRef) {
|
|
2451
|
+
edit(singleRef, {
|
|
2452
|
+
parent: toRef3(props.resource.parent),
|
|
2453
|
+
property: props.resource.property,
|
|
2454
|
+
index: props.resource.index
|
|
2455
|
+
});
|
|
2456
|
+
}
|
|
2505
2457
|
});
|
|
2506
|
-
})
|
|
2458
|
+
} catch (err) {
|
|
2459
|
+
setError(err?.message || "Unknown error");
|
|
2460
|
+
}
|
|
2507
2461
|
};
|
|
2508
2462
|
const validate = async () => {
|
|
2509
2463
|
return true;
|
|
@@ -2513,19 +2467,21 @@ var RenderCreator = memo3(function RenderCreator2(props) {
|
|
|
2513
2467
|
runCreate({});
|
|
2514
2468
|
}
|
|
2515
2469
|
}, [props.creator]);
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
}
|
|
2521
|
-
|
|
2470
|
+
if (error) {
|
|
2471
|
+
return /* @__PURE__ */ jsx18("div", { className: "flex flex-col items-center p-4", children: /* @__PURE__ */ jsx18(ErrorMessage2, { children: error }) });
|
|
2472
|
+
}
|
|
2473
|
+
const spinner = /* @__PURE__ */ jsx18("div", { className: "flex flex-col items-center py-8", children: /* @__PURE__ */ jsxs8("div", { className: "flex gap-2 items-center", children: [
|
|
2474
|
+
/* @__PURE__ */ jsx18(Spinner, {}),
|
|
2475
|
+
" ",
|
|
2476
|
+
/* @__PURE__ */ jsx18("span", { children: "Loading" })
|
|
2477
|
+
] }) });
|
|
2522
2478
|
if (isCreating) {
|
|
2523
|
-
return
|
|
2479
|
+
return spinner;
|
|
2524
2480
|
}
|
|
2525
2481
|
if (!props.creator.render) {
|
|
2526
|
-
return /* @__PURE__ */
|
|
2482
|
+
return /* @__PURE__ */ jsx18("div", { children: /* @__PURE__ */ jsx18(Button, { onClick: () => runCreate({}), children: "Create" }) });
|
|
2527
2483
|
}
|
|
2528
|
-
return /* @__PURE__ */
|
|
2484
|
+
return /* @__PURE__ */ jsx18(Fragment2, { children: /* @__PURE__ */ jsx18(Suspense, { fallback: spinner, children: props.creator.render({
|
|
2529
2485
|
vault,
|
|
2530
2486
|
runCreate,
|
|
2531
2487
|
validate,
|
|
@@ -2535,9 +2491,7 @@ var RenderCreator = memo3(function RenderCreator2(props) {
|
|
|
2535
2491
|
function BaseCreator(props) {
|
|
2536
2492
|
const app = useApp();
|
|
2537
2493
|
const vault = useVault4();
|
|
2538
|
-
const [currentId, setCurrentId] = useState5(
|
|
2539
|
-
props.resource.initialCreator || ""
|
|
2540
|
-
);
|
|
2494
|
+
const [currentId, setCurrentId] = useState5(props.resource.initialCreator || "");
|
|
2541
2495
|
const set = useSetCustomTitle();
|
|
2542
2496
|
const supported = useMemo12(
|
|
2543
2497
|
() => matchBasedOnResource2(props.resource, app.layout.creators || [], {
|
|
@@ -2555,19 +2509,33 @@ function BaseCreator(props) {
|
|
|
2555
2509
|
}
|
|
2556
2510
|
});
|
|
2557
2511
|
if (supported.length === 0) {
|
|
2558
|
-
return /* @__PURE__ */
|
|
2512
|
+
return /* @__PURE__ */ jsx18("div", { children: "Not currently supported" });
|
|
2559
2513
|
}
|
|
2514
|
+
const backButton = /* @__PURE__ */ jsx18(ModalBackSlot, { children: /* @__PURE__ */ jsx18(
|
|
2515
|
+
IconButton2,
|
|
2516
|
+
{
|
|
2517
|
+
root: document.getElementById("headlessui-portal-root") || void 0,
|
|
2518
|
+
label: "Back to Add content options",
|
|
2519
|
+
className: "group",
|
|
2520
|
+
placement: "right",
|
|
2521
|
+
onPress: () => setCurrentId(""),
|
|
2522
|
+
children: /* @__PURE__ */ jsx18(GridIcon, { className: "text-2xl opacity-50 group-hover:opacity-70" })
|
|
2523
|
+
}
|
|
2524
|
+
) });
|
|
2560
2525
|
if (current) {
|
|
2561
2526
|
const shouldHideModal = current.hiddenModal;
|
|
2562
2527
|
if (shouldHideModal) {
|
|
2563
|
-
return /* @__PURE__ */
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2528
|
+
return /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
2529
|
+
backButton,
|
|
2530
|
+
/* @__PURE__ */ jsx18(RenderCreator, { creator: current, resource: props.resource })
|
|
2531
|
+
] });
|
|
2532
|
+
}
|
|
2533
|
+
return /* @__PURE__ */ jsxs8("div", { children: [
|
|
2534
|
+
backButton,
|
|
2535
|
+
/* @__PURE__ */ jsx18("div", { className: "p-2 py-6", children: /* @__PURE__ */ jsx18(RenderCreator, { creator: current, resource: props.resource }) })
|
|
2568
2536
|
] });
|
|
2569
2537
|
}
|
|
2570
|
-
return /* @__PURE__ */
|
|
2538
|
+
return /* @__PURE__ */ jsx18(
|
|
2571
2539
|
CreatorGrid,
|
|
2572
2540
|
{
|
|
2573
2541
|
label: "Select a type",
|
|
@@ -2583,13 +2551,13 @@ function BaseCreator(props) {
|
|
|
2583
2551
|
}
|
|
2584
2552
|
|
|
2585
2553
|
// src/BaseCreator/index.tsx
|
|
2586
|
-
import { jsx as
|
|
2554
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
2587
2555
|
var baseCreator = {
|
|
2588
2556
|
id: "@manifest-editor/creator",
|
|
2589
2557
|
label: "Add content",
|
|
2590
2558
|
options: { hideHeader: true, tabs: false },
|
|
2591
2559
|
render(state) {
|
|
2592
|
-
return /* @__PURE__ */
|
|
2560
|
+
return /* @__PURE__ */ jsx19(BaseCreator, { resource: state });
|
|
2593
2561
|
}
|
|
2594
2562
|
};
|
|
2595
2563
|
|
|
@@ -2696,7 +2664,7 @@ function filterStack(newStackWithDuplicates, current) {
|
|
|
2696
2664
|
import { EditorInstance } from "@manifest-editor/editor-api";
|
|
2697
2665
|
import { useResourceContext, useVault as useVault5 } from "react-iiif-vault";
|
|
2698
2666
|
import { toRef as toRef5 } from "@iiif/parser";
|
|
2699
|
-
import { jsx as
|
|
2667
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
2700
2668
|
var defaultState = { stack: [], current: null, create: null };
|
|
2701
2669
|
var EditingStackContext = createContext12(defaultState);
|
|
2702
2670
|
var EditingStackActionsContext = createContext12({
|
|
@@ -2836,16 +2804,16 @@ function EditingStack(props) {
|
|
|
2836
2804
|
return { edit, updateCurrent, close, back, create: create2 };
|
|
2837
2805
|
}, []);
|
|
2838
2806
|
const { instanceId } = useAppInstance();
|
|
2839
|
-
return /* @__PURE__ */
|
|
2807
|
+
return /* @__PURE__ */ jsx20(EditingStackActionsContext.Provider, { value: actions, children: /* @__PURE__ */ jsx20(EditingStackContext.Provider, { value: state, children: props.children }) }, instanceId);
|
|
2840
2808
|
}
|
|
2841
2809
|
|
|
2842
2810
|
// src/BaseEditor/BaseEditor.tsx
|
|
2843
|
-
import { jsx as
|
|
2811
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
2844
2812
|
function BaseEditorBackButton({ fallback, backAction }) {
|
|
2845
2813
|
const stack = useEditingResourceStack();
|
|
2846
2814
|
const { back } = useEditingStack();
|
|
2847
2815
|
if (stack.length) {
|
|
2848
|
-
return /* @__PURE__ */
|
|
2816
|
+
return /* @__PURE__ */ jsx21(ModulePanelButton, { onClick: back, children: /* @__PURE__ */ jsx21(BackIcon, {}) });
|
|
2849
2817
|
}
|
|
2850
2818
|
return fallback;
|
|
2851
2819
|
}
|
|
@@ -2853,22 +2821,20 @@ function BaseEditorCloseButton({ closeAction, fallback }) {
|
|
|
2853
2821
|
const stack = useEditingResourceStack();
|
|
2854
2822
|
const current = useEditingResource();
|
|
2855
2823
|
if (current || stack.length) {
|
|
2856
|
-
return /* @__PURE__ */
|
|
2824
|
+
return /* @__PURE__ */ jsx21(
|
|
2857
2825
|
ModulePanelButton,
|
|
2858
2826
|
{
|
|
2859
2827
|
onClick: () => {
|
|
2860
2828
|
closeAction();
|
|
2861
2829
|
},
|
|
2862
|
-
children: /* @__PURE__ */
|
|
2830
|
+
children: /* @__PURE__ */ jsx21(CloseIcon, {})
|
|
2863
2831
|
}
|
|
2864
2832
|
);
|
|
2865
2833
|
}
|
|
2866
2834
|
return fallback;
|
|
2867
2835
|
}
|
|
2868
2836
|
function editBasedOnResource(resource, list, options, config) {
|
|
2869
|
-
const filteredList = list.filter(
|
|
2870
|
-
(l) => l.resourceType === resource.resource.source.type
|
|
2871
|
-
);
|
|
2837
|
+
const filteredList = list.filter((l) => l.resourceType === resource.resource.source.type);
|
|
2872
2838
|
if (filteredList.length === 0) {
|
|
2873
2839
|
return null;
|
|
2874
2840
|
}
|
|
@@ -2916,9 +2882,7 @@ function editBasedOnResource(resource, list, options, config) {
|
|
|
2916
2882
|
}
|
|
2917
2883
|
return null;
|
|
2918
2884
|
}
|
|
2919
|
-
function BaseEditor({
|
|
2920
|
-
currentTab = void 0
|
|
2921
|
-
}) {
|
|
2885
|
+
function BaseEditor({ currentTab = void 0 }) {
|
|
2922
2886
|
const resource = useEditingResource();
|
|
2923
2887
|
const currentResourceContext = useContext13(ResourceReactContext);
|
|
2924
2888
|
const app = useApp();
|
|
@@ -2948,7 +2912,7 @@ function BaseEditor({
|
|
|
2948
2912
|
if (!resource) {
|
|
2949
2913
|
return children;
|
|
2950
2914
|
}
|
|
2951
|
-
return /* @__PURE__ */
|
|
2915
|
+
return /* @__PURE__ */ jsx21(ResourceReactContext.Provider, { value: newResourceContext, children });
|
|
2952
2916
|
}
|
|
2953
2917
|
const match = useMemo14(() => {
|
|
2954
2918
|
if (!resource) {
|
|
@@ -2956,28 +2920,19 @@ function BaseEditor({
|
|
|
2956
2920
|
}
|
|
2957
2921
|
const editors = app.layout.editors || [];
|
|
2958
2922
|
const resources = app.layout.resources || [];
|
|
2959
|
-
const mappedResources = resources.map(
|
|
2960
|
-
(resource2)
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
(e) => e.supports.resourceTypes.includes(resource2)
|
|
2969
|
-
)
|
|
2970
|
-
};
|
|
2971
|
-
}
|
|
2972
|
-
return resource2;
|
|
2923
|
+
const mappedResources = resources.map((resource2) => {
|
|
2924
|
+
if (typeof resource2 === "string") {
|
|
2925
|
+
return {
|
|
2926
|
+
id: "@default/" + resource2,
|
|
2927
|
+
label: resource2,
|
|
2928
|
+
resourceType: resource2,
|
|
2929
|
+
auto: true,
|
|
2930
|
+
editors: editors.filter((e) => e.supports.resourceTypes.includes(resource2))
|
|
2931
|
+
};
|
|
2973
2932
|
}
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
mappedResources,
|
|
2978
|
-
{ edit: true, vault },
|
|
2979
|
-
resourceConfig
|
|
2980
|
-
);
|
|
2933
|
+
return resource2;
|
|
2934
|
+
});
|
|
2935
|
+
return editBasedOnResource(resource, mappedResources, { edit: true, vault }, resourceConfig);
|
|
2981
2936
|
}, [resource, app]);
|
|
2982
2937
|
useEffect10(() => {
|
|
2983
2938
|
set(match?.label || "");
|
|
@@ -2993,17 +2948,15 @@ function BaseEditor({
|
|
|
2993
2948
|
return null;
|
|
2994
2949
|
}
|
|
2995
2950
|
if (resourceConfig.singleTab) {
|
|
2996
|
-
const first = (match?.editors || []).find(
|
|
2997
|
-
(editor) => editor.id === resourceConfig.singleTab
|
|
2998
|
-
);
|
|
2951
|
+
const first = (match?.editors || []).find((editor) => editor.id === resourceConfig.singleTab);
|
|
2999
2952
|
if (first) {
|
|
3000
2953
|
return wrap(
|
|
3001
|
-
/* @__PURE__ */
|
|
2954
|
+
/* @__PURE__ */ jsx21("div", { className: "w-full", children: first.component(resourceConfig) }, resource.resource.source?.id)
|
|
3002
2955
|
);
|
|
3003
2956
|
}
|
|
3004
2957
|
}
|
|
3005
2958
|
return wrap(
|
|
3006
|
-
/* @__PURE__ */
|
|
2959
|
+
/* @__PURE__ */ jsx21(
|
|
3007
2960
|
SidebarTabs,
|
|
3008
2961
|
{
|
|
3009
2962
|
menuId: resource.resource.source.id,
|
|
@@ -3025,20 +2978,20 @@ function BaseEditor({
|
|
|
3025
2978
|
}
|
|
3026
2979
|
|
|
3027
2980
|
// src/BaseEditor/index.tsx
|
|
3028
|
-
import { jsx as
|
|
2981
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
3029
2982
|
var baseEditor = {
|
|
3030
2983
|
id: "@manifest-editor/editor",
|
|
3031
2984
|
label: "Editor",
|
|
3032
2985
|
options: { hideHeader: true, tabs: true, minWidth: 400 },
|
|
3033
|
-
renderBackAction: ({ backAction, fallback }) => /* @__PURE__ */
|
|
3034
|
-
renderCloseAction: ({ closeAction, fallback }) => /* @__PURE__ */
|
|
2986
|
+
renderBackAction: ({ backAction, fallback }) => /* @__PURE__ */ jsx22(BaseEditorBackButton, { backAction, fallback }),
|
|
2987
|
+
renderCloseAction: ({ closeAction, fallback }) => /* @__PURE__ */ jsx22(BaseEditorCloseButton, { closeAction, fallback }),
|
|
3035
2988
|
render({ currentTab }) {
|
|
3036
|
-
return /* @__PURE__ */
|
|
2989
|
+
return /* @__PURE__ */ jsx22(BaseEditor, { currentTab });
|
|
3037
2990
|
}
|
|
3038
2991
|
};
|
|
3039
2992
|
|
|
3040
2993
|
// src/ConfigContext/ConfigEditor.tsx
|
|
3041
|
-
import {
|
|
2994
|
+
import { ActionButton, Form, Sidebar, SidebarContent, SidebarHeader } from "@manifest-editor/components";
|
|
3042
2995
|
|
|
3043
2996
|
// src/hooks/use-decay-state.ts
|
|
3044
2997
|
import { useMemo as useMemo15, useRef as useRef4, useState as useState6 } from "react";
|
|
@@ -3070,9 +3023,10 @@ function useDecayState(time) {
|
|
|
3070
3023
|
}
|
|
3071
3024
|
|
|
3072
3025
|
// src/ConfigContext/ConfigEditor.tsx
|
|
3073
|
-
import { jsx as
|
|
3026
|
+
import { jsx as jsx23, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3074
3027
|
function ConfigEditor() {
|
|
3075
3028
|
const previews = usePreviewContext();
|
|
3029
|
+
const resource = useAppResource();
|
|
3076
3030
|
const config = useConfig();
|
|
3077
3031
|
const setConfig = useSaveConfig();
|
|
3078
3032
|
const [isSaved, saveState] = useDecayState(2e3);
|
|
@@ -3097,13 +3051,13 @@ function ConfigEditor() {
|
|
|
3097
3051
|
saveState.set();
|
|
3098
3052
|
saveState.clear();
|
|
3099
3053
|
}
|
|
3100
|
-
return /* @__PURE__ */
|
|
3101
|
-
/* @__PURE__ */
|
|
3102
|
-
isSaved ? /* @__PURE__ */
|
|
3103
|
-
/* @__PURE__ */
|
|
3104
|
-
/* @__PURE__ */
|
|
3105
|
-
/* @__PURE__ */
|
|
3106
|
-
/* @__PURE__ */
|
|
3054
|
+
return /* @__PURE__ */ jsxs9(Sidebar, { children: [
|
|
3055
|
+
/* @__PURE__ */ jsx23(SidebarHeader, { title: "Workspace configuration" }),
|
|
3056
|
+
isSaved ? /* @__PURE__ */ jsx23("div", { className: "bg-me-primary-500 text-white p-3 text-sm", children: "Changes saved" }) : null,
|
|
3057
|
+
/* @__PURE__ */ jsx23(SidebarContent, { className: "p-4", children: /* @__PURE__ */ jsxs9(Form.Form, { onSubmit, className: "flex flex-col gap-3", children: [
|
|
3058
|
+
/* @__PURE__ */ jsxs9(Form.InputContainer, { children: [
|
|
3059
|
+
/* @__PURE__ */ jsx23(Form.Label, { htmlFor: "defaultLanguage", children: "Default Language" }),
|
|
3060
|
+
/* @__PURE__ */ jsx23(
|
|
3107
3061
|
Form.Input,
|
|
3108
3062
|
{
|
|
3109
3063
|
type: "text",
|
|
@@ -3113,9 +3067,9 @@ function ConfigEditor() {
|
|
|
3113
3067
|
}
|
|
3114
3068
|
)
|
|
3115
3069
|
] }),
|
|
3116
|
-
/* @__PURE__ */
|
|
3117
|
-
/* @__PURE__ */
|
|
3118
|
-
/* @__PURE__ */
|
|
3070
|
+
/* @__PURE__ */ jsxs9(Form.InputContainer, { children: [
|
|
3071
|
+
/* @__PURE__ */ jsx23(Form.Label, { htmlFor: "availableLanguages", children: "Available Languages" }),
|
|
3072
|
+
/* @__PURE__ */ jsx23(
|
|
3119
3073
|
Form.Input,
|
|
3120
3074
|
{
|
|
3121
3075
|
type: "text",
|
|
@@ -3125,8 +3079,8 @@ function ConfigEditor() {
|
|
|
3125
3079
|
}
|
|
3126
3080
|
)
|
|
3127
3081
|
] }),
|
|
3128
|
-
/* @__PURE__ */
|
|
3129
|
-
/* @__PURE__ */
|
|
3082
|
+
/* @__PURE__ */ jsxs9(Form.InputContainer, { horizontal: true, className: "my-3", children: [
|
|
3083
|
+
/* @__PURE__ */ jsx23(
|
|
3130
3084
|
Form.Input,
|
|
3131
3085
|
{
|
|
3132
3086
|
type: "checkbox",
|
|
@@ -3135,10 +3089,10 @@ function ConfigEditor() {
|
|
|
3135
3089
|
defaultChecked: config.i18n?.advancedLanguageMode || false
|
|
3136
3090
|
}
|
|
3137
3091
|
),
|
|
3138
|
-
/* @__PURE__ */
|
|
3092
|
+
/* @__PURE__ */ jsx23(Form.Label, { htmlFor: "advancedLanguageMode", children: "Advanced Language Mode" })
|
|
3139
3093
|
] }),
|
|
3140
|
-
/* @__PURE__ */
|
|
3141
|
-
/* @__PURE__ */
|
|
3094
|
+
/* @__PURE__ */ jsxs9(Form.InputContainer, { horizontal: true, className: "my-3", children: [
|
|
3095
|
+
/* @__PURE__ */ jsx23(
|
|
3142
3096
|
Form.Input,
|
|
3143
3097
|
{
|
|
3144
3098
|
type: "checkbox",
|
|
@@ -3147,10 +3101,10 @@ function ConfigEditor() {
|
|
|
3147
3101
|
defaultChecked: config.i18n?.textGranularityEnabled || false
|
|
3148
3102
|
}
|
|
3149
3103
|
),
|
|
3150
|
-
/* @__PURE__ */
|
|
3104
|
+
/* @__PURE__ */ jsx23(Form.Label, { htmlFor: "textGranularityEnabled", children: "Enable text granularity" })
|
|
3151
3105
|
] }),
|
|
3152
|
-
/* @__PURE__ */
|
|
3153
|
-
/* @__PURE__ */
|
|
3106
|
+
/* @__PURE__ */ jsxs9(Form.InputContainer, { horizontal: true, className: "my-3", children: [
|
|
3107
|
+
/* @__PURE__ */ jsx23(
|
|
3154
3108
|
Form.Input,
|
|
3155
3109
|
{
|
|
3156
3110
|
type: "checkbox",
|
|
@@ -3159,16 +3113,20 @@ function ConfigEditor() {
|
|
|
3159
3113
|
defaultChecked: config.export?.version === 2
|
|
3160
3114
|
}
|
|
3161
3115
|
),
|
|
3162
|
-
/* @__PURE__ */
|
|
3116
|
+
/* @__PURE__ */ jsxs9(Form.Label, { htmlFor: "isVersion2", children: [
|
|
3117
|
+
"Export Presentation 2 ",
|
|
3118
|
+
resource.type,
|
|
3119
|
+
"s"
|
|
3120
|
+
] })
|
|
3163
3121
|
] }),
|
|
3164
|
-
/* @__PURE__ */
|
|
3165
|
-
/* @__PURE__ */
|
|
3166
|
-
/* @__PURE__ */
|
|
3122
|
+
/* @__PURE__ */ jsxs9(Form.InputContainer, { children: [
|
|
3123
|
+
/* @__PURE__ */ jsx23(Form.Label, { htmlFor: "defaultPreview", children: "Default preview" }),
|
|
3124
|
+
/* @__PURE__ */ jsx23("div", { children: previews.configs.map((preview, key) => {
|
|
3167
3125
|
if (preview.type === "iiif-preview-service") {
|
|
3168
3126
|
return null;
|
|
3169
3127
|
}
|
|
3170
|
-
return /* @__PURE__ */
|
|
3171
|
-
/* @__PURE__ */
|
|
3128
|
+
return /* @__PURE__ */ jsxs9(Form.InputContainer, { horizontal: true, children: [
|
|
3129
|
+
/* @__PURE__ */ jsx23(
|
|
3172
3130
|
Form.Input,
|
|
3173
3131
|
{
|
|
3174
3132
|
type: "radio",
|
|
@@ -3178,19 +3136,19 @@ function ConfigEditor() {
|
|
|
3178
3136
|
defaultChecked: !config.defaultPreview ? key === 0 : config.defaultPreview === preview.id
|
|
3179
3137
|
}
|
|
3180
3138
|
),
|
|
3181
|
-
/* @__PURE__ */
|
|
3139
|
+
/* @__PURE__ */ jsx23("label", { htmlFor: preview.id, children: preview.label })
|
|
3182
3140
|
] }, preview.id);
|
|
3183
3141
|
}) })
|
|
3184
3142
|
] }),
|
|
3185
|
-
/* @__PURE__ */
|
|
3143
|
+
resource.type === "Manifest" ? /* @__PURE__ */ jsx23(
|
|
3186
3144
|
"a",
|
|
3187
3145
|
{
|
|
3188
3146
|
className: "text-sm text-me-primary-500 hover:underline hover:text-me-primary-600",
|
|
3189
3147
|
href: window.location.pathname.includes("/exhibition") ? window.location.pathname.replace("/exhibition", "") || "/" : `${window.location.pathname}/exhibition`,
|
|
3190
3148
|
children: window.location.pathname.includes("/exhibition") ? "Return to Manifest Editor" : "Go to Exhibition Editor"
|
|
3191
3149
|
}
|
|
3192
|
-
),
|
|
3193
|
-
/* @__PURE__ */
|
|
3150
|
+
) : null,
|
|
3151
|
+
/* @__PURE__ */ jsx23("div", { className: "mt-5", children: /* @__PURE__ */ jsx23(ActionButton, { type: "submit", children: "Save changes" }) })
|
|
3194
3152
|
] }) })
|
|
3195
3153
|
] });
|
|
3196
3154
|
}
|
|
@@ -3208,12 +3166,12 @@ var CenterPanelContainer_default = {
|
|
|
3208
3166
|
};
|
|
3209
3167
|
|
|
3210
3168
|
// ../ui/ui/CenterPanelContainer/CenterPanelContainer.tsx
|
|
3211
|
-
import { jsx as
|
|
3169
|
+
import { jsx as jsx24, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3212
3170
|
function CenterPanelContainer(props) {
|
|
3213
|
-
return /* @__PURE__ */
|
|
3214
|
-
props.title || props.close ? /* @__PURE__ */
|
|
3215
|
-
props.title ? /* @__PURE__ */
|
|
3216
|
-
props.close ? /* @__PURE__ */
|
|
3171
|
+
return /* @__PURE__ */ jsxs10("div", { className: CenterPanelContainer_default.CenterPanelContainer, children: [
|
|
3172
|
+
props.title || props.close ? /* @__PURE__ */ jsxs10("div", { className: CenterPanelContainer_default.CenterPanelHeader, children: [
|
|
3173
|
+
props.title ? /* @__PURE__ */ jsx24("h2", { className: CenterPanelContainer_default.CenterPanelTitle, children: props.title }) : null,
|
|
3174
|
+
props.close ? /* @__PURE__ */ jsx24(Button, { className: CenterPanelContainer_default.CenterPanelClose, onClick: props.close, children: /* @__PURE__ */ jsx24(CloseIcon, {}) }) : null
|
|
3217
3175
|
] }) : null,
|
|
3218
3176
|
props.children
|
|
3219
3177
|
] });
|
|
@@ -3230,7 +3188,7 @@ import {
|
|
|
3230
3188
|
useRef as useRef5,
|
|
3231
3189
|
useState as useState7
|
|
3232
3190
|
} from "react";
|
|
3233
|
-
import { jsx as
|
|
3191
|
+
import { jsx as jsx25, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3234
3192
|
var AccordionContainer = styled7.div`
|
|
3235
3193
|
flex: 1;
|
|
3236
3194
|
display: flex;
|
|
@@ -3585,16 +3543,16 @@ var AccordionItem = forwardRef(function AccordionItem2(props, ref) {
|
|
|
3585
3543
|
setScrolled(false);
|
|
3586
3544
|
}
|
|
3587
3545
|
};
|
|
3588
|
-
return /* @__PURE__ */
|
|
3589
|
-
/* @__PURE__ */
|
|
3590
|
-
props.icon ? /* @__PURE__ */
|
|
3591
|
-
/* @__PURE__ */
|
|
3546
|
+
return /* @__PURE__ */ jsxs11(ItemRow, { "data-large": props.large, "data-open": open, children: [
|
|
3547
|
+
/* @__PURE__ */ jsxs11(ItemHeading, { "data-open": open, children: [
|
|
3548
|
+
props.icon ? /* @__PURE__ */ jsx25(ItemIcon, { onClick: toggle, children: props.icon }) : null,
|
|
3549
|
+
/* @__PURE__ */ jsxs11(ItemLabel, { ref: btn, onClick: toggle, "aria-expanded": open, "aria-controls": `accordion-${id}`, children: [
|
|
3592
3550
|
props.label,
|
|
3593
|
-
props.description ? /* @__PURE__ */
|
|
3551
|
+
props.description ? /* @__PURE__ */ jsx25(ItemDescription, { children: props.description }) : null
|
|
3594
3552
|
] }),
|
|
3595
|
-
/* @__PURE__ */
|
|
3553
|
+
/* @__PURE__ */ jsx25(ItemCollapse, { onClick: toggle, children: /* @__PURE__ */ jsx25(DownIcon, { width: "1em", height: "1em", rotate: open ? 0 : 180 }) })
|
|
3596
3554
|
] }),
|
|
3597
|
-
/* @__PURE__ */
|
|
3555
|
+
/* @__PURE__ */ jsx25(
|
|
3598
3556
|
ItemBody,
|
|
3599
3557
|
{
|
|
3600
3558
|
"aria-labelledby": `accordion-${id}`,
|
|
@@ -3606,7 +3564,7 @@ var AccordionItem = forwardRef(function AccordionItem2(props, ref) {
|
|
|
3606
3564
|
$initial: !open,
|
|
3607
3565
|
"data-scrolled": scrolled,
|
|
3608
3566
|
hidden: !open,
|
|
3609
|
-
children: /* @__PURE__ */
|
|
3567
|
+
children: /* @__PURE__ */ jsx25(ItemBodyInner, { children: /* @__PURE__ */ jsx25(
|
|
3610
3568
|
ItemBodyPadding,
|
|
3611
3569
|
{
|
|
3612
3570
|
"data-max-height": !!maxHeight,
|
|
@@ -3621,13 +3579,13 @@ var AccordionItem = forwardRef(function AccordionItem2(props, ref) {
|
|
|
3621
3579
|
});
|
|
3622
3580
|
function Accordion(props) {
|
|
3623
3581
|
const { getItemProps, onKeyDown } = useAccordionItems(props.items.length, props.singleMode);
|
|
3624
|
-
return /* @__PURE__ */
|
|
3582
|
+
return /* @__PURE__ */ jsx25(AccordionContainer, { onKeyDown, children: props.items.map((item, key) => /* @__PURE__ */ jsx25(AccordionItem, { overflow: props.overflow, maxHeight: props.maxHeight, ...item, ...getItemProps(key), children: item.children }, key)) });
|
|
3625
3583
|
}
|
|
3626
3584
|
|
|
3627
3585
|
// ../ui/icons/DownloadIcon.tsx
|
|
3628
|
-
import { jsx as
|
|
3586
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
3629
3587
|
function DownloadIcon() {
|
|
3630
|
-
return /* @__PURE__ */
|
|
3588
|
+
return /* @__PURE__ */ jsx26("svg", { xmlns: "http://www.w3.org/2000/svg", height: "48", viewBox: "0 -960 960 960", width: "48", children: /* @__PURE__ */ jsx26("path", { d: "M220-160q-24 0-42-18t-18-42v-143h60v143h520v-143h60v143q0 24-18 42t-42 18H220Zm260-153L287-506l43-43 120 120v-371h60v371l120-120 43 43-193 193Z" }) });
|
|
3631
3589
|
}
|
|
3632
3590
|
|
|
3633
3591
|
// ../ui/atoms/ButtonRow.tsx
|
|
@@ -3657,7 +3615,7 @@ var ButtonRow = styled8.div`
|
|
|
3657
3615
|
`;
|
|
3658
3616
|
|
|
3659
3617
|
// src/ExportPanel/ExportPanel.tsx
|
|
3660
|
-
import { jsx as
|
|
3618
|
+
import { jsx as jsx27, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3661
3619
|
function ExportPanel(props) {
|
|
3662
3620
|
const manifest = useManifest();
|
|
3663
3621
|
const vault = useVault7();
|
|
@@ -3668,7 +3626,7 @@ function ExportPanel(props) {
|
|
|
3668
3626
|
const version2 = useMemo17(() => {
|
|
3669
3627
|
return JSON.stringify(vault.toPresentation2(manifest), null, 2);
|
|
3670
3628
|
}, [manifest, vault]);
|
|
3671
|
-
return /* @__PURE__ */
|
|
3629
|
+
return /* @__PURE__ */ jsx27(CenterPanelContainer, { title: "Export manifest", close: actions.centerPanel.popStack, children: /* @__PURE__ */ jsx27("div", { style: { flex: 1, overflowY: "auto" }, children: /* @__PURE__ */ jsx27(
|
|
3672
3630
|
Accordion,
|
|
3673
3631
|
{
|
|
3674
3632
|
items: [
|
|
@@ -3679,12 +3637,12 @@ function ExportPanel(props) {
|
|
|
3679
3637
|
large: true,
|
|
3680
3638
|
initialOpen: true,
|
|
3681
3639
|
overflow: true,
|
|
3682
|
-
icon: /* @__PURE__ */
|
|
3683
|
-
children: /* @__PURE__ */
|
|
3684
|
-
/* @__PURE__ */
|
|
3685
|
-
/* @__PURE__ */
|
|
3686
|
-
/* @__PURE__ */
|
|
3687
|
-
/* @__PURE__ */
|
|
3640
|
+
icon: /* @__PURE__ */ jsx27(Button, { onClick: () => createDownload(version3, "manifest.json"), children: /* @__PURE__ */ jsx27(DownloadIcon, {}) }),
|
|
3641
|
+
children: /* @__PURE__ */ jsxs12("div", { style: { maxWidth: "100%" }, children: [
|
|
3642
|
+
/* @__PURE__ */ jsx27("pre", { style: { whiteSpace: "pre-wrap" }, children: JSON.stringify(vault.toPresentation3(manifest), null, 2) }),
|
|
3643
|
+
/* @__PURE__ */ jsxs12(ButtonRow, { "data-sticky": "true", children: [
|
|
3644
|
+
/* @__PURE__ */ jsx27(Button, { onClick: () => copyToClipboard(version3), children: "Copy to clipboard" }),
|
|
3645
|
+
/* @__PURE__ */ jsx27(Button, { onClick: () => createDownload(version3, "manifest.json"), children: "Download" })
|
|
3688
3646
|
] })
|
|
3689
3647
|
] })
|
|
3690
3648
|
},
|
|
@@ -3693,12 +3651,12 @@ function ExportPanel(props) {
|
|
|
3693
3651
|
description: 'Download this version by clicking the "Download" button.',
|
|
3694
3652
|
maxHeight: 400,
|
|
3695
3653
|
large: true,
|
|
3696
|
-
icon: /* @__PURE__ */
|
|
3697
|
-
children: /* @__PURE__ */
|
|
3698
|
-
/* @__PURE__ */
|
|
3699
|
-
/* @__PURE__ */
|
|
3700
|
-
/* @__PURE__ */
|
|
3701
|
-
/* @__PURE__ */
|
|
3654
|
+
icon: /* @__PURE__ */ jsx27(Button, { onClick: () => createDownload(version2, "manifest.json"), children: /* @__PURE__ */ jsx27(DownloadIcon, {}) }),
|
|
3655
|
+
children: /* @__PURE__ */ jsxs12("div", { style: { maxWidth: "100%" }, children: [
|
|
3656
|
+
/* @__PURE__ */ jsx27("pre", { style: { whiteSpace: "pre-wrap" }, children: JSON.stringify(vault.toPresentation2(manifest), null, 2) }),
|
|
3657
|
+
/* @__PURE__ */ jsxs12(ButtonRow, { "data-sticky": "true", children: [
|
|
3658
|
+
/* @__PURE__ */ jsx27(Button, { onClick: () => copyToClipboard(version2), children: "Copy to clipboard" }),
|
|
3659
|
+
/* @__PURE__ */ jsx27(Button, { onClick: () => createDownload(version2, "manifest.json"), children: "Download" })
|
|
3702
3660
|
] })
|
|
3703
3661
|
] })
|
|
3704
3662
|
}
|
|
@@ -3710,6 +3668,36 @@ function ExportPanel(props) {
|
|
|
3710
3668
|
// src/Layout/Layout.tsx
|
|
3711
3669
|
import { Modal, PanelSideMenu as PanelSideMenu2 } from "@manifest-editor/components";
|
|
3712
3670
|
|
|
3671
|
+
// ../ui/madoc/components/icons/Spinner.tsx
|
|
3672
|
+
import { jsx as jsx28, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3673
|
+
function Spinner2(props) {
|
|
3674
|
+
return /* @__PURE__ */ jsx28(
|
|
3675
|
+
"svg",
|
|
3676
|
+
{
|
|
3677
|
+
width: "1em",
|
|
3678
|
+
height: "1em",
|
|
3679
|
+
viewBox: "0 0 42 42",
|
|
3680
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3681
|
+
stroke: "currentColor",
|
|
3682
|
+
...props,
|
|
3683
|
+
children: /* @__PURE__ */ jsxs13("g", { transform: "translate(2 2)", strokeWidth: 5, fill: "none", fillRule: "evenodd", children: [
|
|
3684
|
+
/* @__PURE__ */ jsx28("circle", { strokeOpacity: 0.5, cx: 18, cy: 18, r: 18 }),
|
|
3685
|
+
/* @__PURE__ */ jsx28("path", { d: "M36 18c0-9.94-8.06-18-18-18", children: /* @__PURE__ */ jsx28(
|
|
3686
|
+
"animateTransform",
|
|
3687
|
+
{
|
|
3688
|
+
attributeName: "transform",
|
|
3689
|
+
type: "rotate",
|
|
3690
|
+
from: "0 18 18",
|
|
3691
|
+
to: "360 18 18",
|
|
3692
|
+
dur: "1s",
|
|
3693
|
+
repeatCount: "indefinite"
|
|
3694
|
+
}
|
|
3695
|
+
) })
|
|
3696
|
+
] })
|
|
3697
|
+
}
|
|
3698
|
+
);
|
|
3699
|
+
}
|
|
3700
|
+
|
|
3713
3701
|
// ../ui/ui/GhostBlocks/GhostBlocks.module.css
|
|
3714
3702
|
var GhostBlocks_default = {
|
|
3715
3703
|
ghostLoadingBlock: "GhostBlocks_ghostLoadingBlock",
|
|
@@ -4539,7 +4527,7 @@ var Layout = memo4(function Layout2(props) {
|
|
|
4539
4527
|
justifyContent: "center",
|
|
4540
4528
|
alignItems: "center"
|
|
4541
4529
|
},
|
|
4542
|
-
children: /* @__PURE__ */ jsx32(
|
|
4530
|
+
children: /* @__PURE__ */ jsx32(Spinner2, { stroke: "rgba(0,0,0,.3)", fontSize: "2em" })
|
|
4543
4531
|
}
|
|
4544
4532
|
) : state.centerPanel.open ? centerPanel ? renderHelper(
|
|
4545
4533
|
centerPanel.render(
|