@manifest-editor/shell 1.2.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 +1738 -958
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +344 -78
- package/dist/index.d.ts +344 -78
- package/dist/index.js +1644 -856
- package/dist/index.js.map +1 -1
- package/package.json +13 -10
package/dist/index.cjs
CHANGED
|
@@ -40,12 +40,15 @@ __export(src_exports, {
|
|
|
40
40
|
AppProvider: () => AppProvider,
|
|
41
41
|
AppResourceInstanceProvider: () => AppResourceInstanceProvider,
|
|
42
42
|
AppResourceProvider: () => AppResourceProvider,
|
|
43
|
+
AtlasStoreProvider: () => AtlasStoreProvider,
|
|
44
|
+
AtlasStoreReactContext: () => AtlasStoreReactContext,
|
|
43
45
|
BaseEditor: () => BaseEditor,
|
|
44
46
|
BaseEditorBackButton: () => BaseEditorBackButton,
|
|
45
47
|
BaseEditorCloseButton: () => BaseEditorCloseButton,
|
|
46
48
|
ConfigEditor: () => ConfigEditor,
|
|
47
49
|
ConfigProvider: () => ConfigProvider,
|
|
48
50
|
EditingStack: () => EditingStack,
|
|
51
|
+
EventEmitterProvider: () => EventEmitterProvider,
|
|
49
52
|
ExportPanel: () => ExportPanel,
|
|
50
53
|
HOMEPAGE_COLLECTION: () => HOMEPAGE_COLLECTION,
|
|
51
54
|
HandleContainer: () => HandleContainer,
|
|
@@ -63,7 +66,9 @@ __export(src_exports, {
|
|
|
63
66
|
PreviewVaultBoundary: () => PreviewVaultBoundary,
|
|
64
67
|
PreviewVaultContext: () => PreviewVaultContext,
|
|
65
68
|
PrimeAppReactContext: () => PrimeAppReactContext,
|
|
69
|
+
ReactEmitterContext: () => ReactEmitterContext,
|
|
66
70
|
ResourceEditingProvider: () => ResourceEditingProvider,
|
|
71
|
+
ResourceEditingReactContext: () => ResourceEditingReactContext,
|
|
67
72
|
ShellProvider: () => ShellProvider,
|
|
68
73
|
TaskBridge: () => TaskBridge,
|
|
69
74
|
UniversalCopyTarget: () => UniversalCopyTarget,
|
|
@@ -73,10 +78,12 @@ __export(src_exports, {
|
|
|
73
78
|
baseEditor: () => baseEditor,
|
|
74
79
|
copyToClipboard: () => copyToClipboard,
|
|
75
80
|
createActionIdentity: () => createActionIdentity,
|
|
81
|
+
createAtlasStore: () => createAtlasStore,
|
|
76
82
|
createDownload: () => createDownload,
|
|
77
83
|
createPreviewVault: () => createPreviewVault,
|
|
78
84
|
detectMedia: () => detectMedia,
|
|
79
85
|
editBasedOnResource: () => editBasedOnResource,
|
|
86
|
+
extendApp: () => extendApp,
|
|
80
87
|
getDefaultLayoutState: () => getDefaultLayoutState,
|
|
81
88
|
getDefaultPanelState: () => getDefaultPanelState,
|
|
82
89
|
getFormat: () => getFormat,
|
|
@@ -85,10 +92,11 @@ __export(src_exports, {
|
|
|
85
92
|
isPinnableState: () => isPinnableState,
|
|
86
93
|
layoutReducer: () => layoutReducer,
|
|
87
94
|
mapApp: () => mapApp,
|
|
88
|
-
matchBasedOnResource: () => matchBasedOnResource,
|
|
89
95
|
panelSizing: () => panelSizing,
|
|
96
|
+
polygonToBoundingBox: () => polygonToBoundingBox,
|
|
90
97
|
randomId: () => randomId,
|
|
91
98
|
renderHelper: () => renderHelper,
|
|
99
|
+
requestToAnnotationResponse: () => requestToAnnotationResponse,
|
|
92
100
|
useAnnotationPageEditor: () => useAnnotationPageEditor,
|
|
93
101
|
useApp: () => useApp,
|
|
94
102
|
useAppInstance: () => useAppInstance,
|
|
@@ -98,6 +106,7 @@ __export(src_exports, {
|
|
|
98
106
|
useAppResourceInstance: () => useAppResourceInstance,
|
|
99
107
|
useAppState: () => useAppState,
|
|
100
108
|
useApps: () => useApps,
|
|
109
|
+
useAtlasStore: () => useAtlasStore,
|
|
101
110
|
useAvailableLayouts: () => useAvailableLayouts,
|
|
102
111
|
useCollectionEditor: () => useCollectionEditor,
|
|
103
112
|
useConfig: () => useConfig,
|
|
@@ -109,6 +118,8 @@ __export(src_exports, {
|
|
|
109
118
|
useEditingResourceStack: () => useEditingResourceStack,
|
|
110
119
|
useEditingStack: () => useEditingStack,
|
|
111
120
|
useEditor: () => useEditor,
|
|
121
|
+
useEmitter: () => useEmitter,
|
|
122
|
+
useEvent: () => useEvent,
|
|
112
123
|
useGenericEditor: () => useGenericEditor,
|
|
113
124
|
useHighlightedImageResource: () => useHighlightedImageResource,
|
|
114
125
|
useHoverHighlightImageResource: () => useHoverHighlightImageResource,
|
|
@@ -117,16 +128,19 @@ __export(src_exports, {
|
|
|
117
128
|
useLayoutProvider: () => useLayoutProvider,
|
|
118
129
|
useLayoutState: () => useLayoutState,
|
|
119
130
|
useManifestEditor: () => useManifestEditor,
|
|
131
|
+
useMatchMedia: () => useMatchMedia,
|
|
120
132
|
useOptionalResource: () => useOptionalResource,
|
|
121
133
|
usePanelActions: () => usePanelActions,
|
|
122
134
|
usePreviewContext: () => usePreviewContext,
|
|
123
135
|
usePreviewHistory: () => usePreviewHistory,
|
|
124
136
|
usePreviewVault: () => usePreviewVault,
|
|
125
137
|
usePreviews: () => usePreviews,
|
|
138
|
+
useRequestAnnotation: () => useRequestAnnotation,
|
|
126
139
|
useResource: () => useResource,
|
|
127
140
|
useSaveConfig: () => useSaveConfig,
|
|
128
141
|
useSaveVault: () => useSaveVault,
|
|
129
142
|
useSetCustomTitle: () => useSetCustomTitle,
|
|
143
|
+
useSvgTools: () => useSvgTools,
|
|
130
144
|
useTask: () => useTask,
|
|
131
145
|
useTaskDispatch: () => useTaskDispatch,
|
|
132
146
|
useTaskEvent: () => useTaskEvent,
|
|
@@ -135,24 +149,6 @@ __export(src_exports, {
|
|
|
135
149
|
});
|
|
136
150
|
module.exports = __toCommonJS(src_exports);
|
|
137
151
|
|
|
138
|
-
// src/AppContext/AppContext.tsx
|
|
139
|
-
var import_react2 = require("react");
|
|
140
|
-
|
|
141
|
-
// ../../node_modules/.pnpm/tiny-invariant@1.3.3/node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
|
142
|
-
var isProduction = false;
|
|
143
|
-
var prefix = "Invariant failed";
|
|
144
|
-
function invariant(condition, message) {
|
|
145
|
-
if (condition) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
if (isProduction) {
|
|
149
|
-
throw new Error(prefix);
|
|
150
|
-
}
|
|
151
|
-
var provided = typeof message === "function" ? message() : message;
|
|
152
|
-
var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
|
|
153
|
-
throw new Error(value);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
152
|
// ../ui/madoc/use-local-storage.ts
|
|
157
153
|
var import_react = require("react");
|
|
158
154
|
var import_mitt = __toESM(require("mitt"), 1);
|
|
@@ -226,33 +222,127 @@ function useLocalStorage(key, initialValue) {
|
|
|
226
222
|
}
|
|
227
223
|
|
|
228
224
|
// src/AppContext/AppContext.tsx
|
|
225
|
+
var import_react3 = require("react");
|
|
226
|
+
|
|
227
|
+
// ../../node_modules/.pnpm/tiny-invariant@1.3.3/node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
|
228
|
+
var isProduction = false;
|
|
229
|
+
var prefix = "Invariant failed";
|
|
230
|
+
function invariant(condition, message) {
|
|
231
|
+
if (condition) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (isProduction) {
|
|
235
|
+
throw new Error(prefix);
|
|
236
|
+
}
|
|
237
|
+
var provided = typeof message === "function" ? message() : message;
|
|
238
|
+
var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
|
|
239
|
+
throw new Error(value);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// src/ConfigContext/ConfigContext.tsx
|
|
243
|
+
var import_react2 = require("react");
|
|
229
244
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
230
|
-
var
|
|
231
|
-
|
|
232
|
-
|
|
245
|
+
var DEFAULT_CONFIG = {
|
|
246
|
+
previews: [],
|
|
247
|
+
behaviorPresets: [
|
|
248
|
+
"auto-advance",
|
|
249
|
+
"no-auto-advance",
|
|
250
|
+
"repeat",
|
|
251
|
+
"no-repeat",
|
|
252
|
+
"unordered",
|
|
253
|
+
"individuals",
|
|
254
|
+
"continuous",
|
|
255
|
+
"paged",
|
|
256
|
+
"non-paged",
|
|
257
|
+
"facing-pages",
|
|
258
|
+
"multi-part",
|
|
259
|
+
"together",
|
|
260
|
+
"sequence",
|
|
261
|
+
"thumbnail-nav",
|
|
262
|
+
"no-nav",
|
|
263
|
+
"hidden"
|
|
264
|
+
],
|
|
265
|
+
defaultPreview: null,
|
|
266
|
+
editorConfig: {},
|
|
267
|
+
newTemplates: null,
|
|
268
|
+
i18n: {
|
|
269
|
+
advancedLanguageMode: false,
|
|
270
|
+
availableLanguages: ["en", "cy", "nl", "fr"],
|
|
271
|
+
defaultLanguage: "en"
|
|
272
|
+
},
|
|
273
|
+
editorFeatureFlags: {
|
|
274
|
+
enableMultiImageCanvases: true,
|
|
275
|
+
enableMultiMediaCanvases: true
|
|
276
|
+
},
|
|
277
|
+
uploadBackends: [],
|
|
278
|
+
export: {
|
|
279
|
+
baseIdentifier: null,
|
|
280
|
+
version: 3
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
var ConfigReactContext = (0, import_react2.createContext)(DEFAULT_CONFIG);
|
|
284
|
+
var SaveConfigReactContext = (0, import_react2.createContext)(() => {
|
|
285
|
+
});
|
|
286
|
+
function useConfig() {
|
|
287
|
+
return (0, import_react2.useContext)(ConfigReactContext);
|
|
288
|
+
}
|
|
289
|
+
function useSaveConfig() {
|
|
290
|
+
return (0, import_react2.useContext)(SaveConfigReactContext);
|
|
291
|
+
}
|
|
292
|
+
function ConfigProvider({
|
|
293
|
+
children,
|
|
294
|
+
config,
|
|
295
|
+
saveConfig
|
|
296
|
+
}) {
|
|
297
|
+
const [runtimeConfig, setRuntimeConfig] = (0, import_react2.useState)(null);
|
|
298
|
+
const resolvedConfig = (0, import_react2.useMemo)(
|
|
299
|
+
() => ({
|
|
300
|
+
...DEFAULT_CONFIG,
|
|
301
|
+
...config || {},
|
|
302
|
+
...runtimeConfig || {}
|
|
303
|
+
}),
|
|
304
|
+
[config, runtimeConfig]
|
|
305
|
+
);
|
|
306
|
+
const memoSaveConfig = (0, import_react2.useCallback)(
|
|
307
|
+
(config2) => {
|
|
308
|
+
setRuntimeConfig(config2);
|
|
309
|
+
if (saveConfig) {
|
|
310
|
+
saveConfig(config2);
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
[config]
|
|
314
|
+
);
|
|
315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SaveConfigReactContext.Provider, { value: memoSaveConfig, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfigReactContext.Provider, { value: resolvedConfig, children }) });
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// src/AppContext/AppContext.tsx
|
|
319
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
320
|
+
var PrimeAppReactContext = (0, import_react3.createContext)(null);
|
|
321
|
+
var AppReactContext = (0, import_react3.createContext)(null);
|
|
322
|
+
var AppStateReactContext = (0, import_react3.createContext)({
|
|
233
323
|
state: null,
|
|
234
324
|
setState: () => {
|
|
235
325
|
}
|
|
236
326
|
});
|
|
237
327
|
function useAppInstance() {
|
|
238
|
-
const ctx = (0,
|
|
328
|
+
const ctx = (0, import_react3.useContext)(AppReactContext);
|
|
239
329
|
invariant(ctx, "Hook useAppInstance must be used inside <AppProvider />");
|
|
240
330
|
return ctx;
|
|
241
331
|
}
|
|
242
332
|
function useApp() {
|
|
243
|
-
const app = (0,
|
|
333
|
+
const app = (0, import_react3.useContext)(PrimeAppReactContext);
|
|
244
334
|
invariant(app, "Hook useApp must be used inside <AppProvider />");
|
|
245
335
|
return app;
|
|
246
336
|
}
|
|
247
337
|
function useAppState() {
|
|
248
|
-
return (0,
|
|
338
|
+
return (0, import_react3.useContext)(AppStateReactContext);
|
|
249
339
|
}
|
|
250
340
|
function AppStateProvider(props) {
|
|
251
341
|
const [state, _setState, stateRef] = useLocalStorage(
|
|
252
342
|
`app-state/${props.appId}/${props.instanceId}`,
|
|
253
343
|
props.initialState || {}
|
|
254
344
|
);
|
|
255
|
-
const setState = (0,
|
|
345
|
+
const setState = (0, import_react3.useCallback)((partial) => {
|
|
256
346
|
const existing = stateRef.current ? JSON.parse(stateRef.current || "{}") : {};
|
|
257
347
|
const partialState = (typeof partial === "function" ? partial(existing) : partial) || {};
|
|
258
348
|
_setState({
|
|
@@ -260,13 +350,16 @@ function AppStateProvider(props) {
|
|
|
260
350
|
...partialState
|
|
261
351
|
});
|
|
262
352
|
}, []);
|
|
263
|
-
(0,
|
|
353
|
+
(0, import_react3.useEffect)(() => {
|
|
264
354
|
if (props.args) {
|
|
265
355
|
setState(props.args);
|
|
266
356
|
}
|
|
267
357
|
}, [props.appId]);
|
|
268
|
-
const ctx = (0,
|
|
269
|
-
|
|
358
|
+
const ctx = (0, import_react3.useMemo)(
|
|
359
|
+
() => ({ state: state || {}, setState }),
|
|
360
|
+
[setState, state]
|
|
361
|
+
);
|
|
362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AppStateReactContext.Provider, { value: ctx, children: props.children });
|
|
270
363
|
}
|
|
271
364
|
function AppProvider({
|
|
272
365
|
instanceId,
|
|
@@ -276,17 +369,29 @@ function AppProvider({
|
|
|
276
369
|
children,
|
|
277
370
|
initialState
|
|
278
371
|
}) {
|
|
279
|
-
const ctx = (0,
|
|
280
|
-
|
|
281
|
-
|
|
372
|
+
const ctx = (0, import_react3.useMemo)(
|
|
373
|
+
() => ({ instanceId, appId, args }),
|
|
374
|
+
[instanceId, appId, args]
|
|
375
|
+
);
|
|
376
|
+
const _initialState = (0, import_react3.useMemo)(() => initialState || {}, [instanceId]);
|
|
377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ConfigProvider, { config: definition.config || {}, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PrimeAppReactContext.Provider, { value: definition, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AppReactContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
378
|
+
AppStateProvider,
|
|
379
|
+
{
|
|
380
|
+
instanceId: ctx.instanceId,
|
|
381
|
+
appId: ctx.appId,
|
|
382
|
+
args: ctx.args,
|
|
383
|
+
initialState: _initialState,
|
|
384
|
+
children
|
|
385
|
+
}
|
|
386
|
+
) }) }) });
|
|
282
387
|
}
|
|
283
388
|
|
|
284
389
|
// src/AppContext/MultiAppContext.tsx
|
|
285
|
-
var
|
|
286
|
-
var
|
|
287
|
-
var MultiAppContext = (0,
|
|
390
|
+
var import_react4 = require("react");
|
|
391
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
392
|
+
var MultiAppContext = (0, import_react4.createContext)(null);
|
|
288
393
|
function useApps() {
|
|
289
|
-
const ctx = (0,
|
|
394
|
+
const ctx = (0, import_react4.useContext)(MultiAppContext);
|
|
290
395
|
invariant(ctx, "Hook useApps must be used inside <MultiAppProvider />");
|
|
291
396
|
return ctx;
|
|
292
397
|
}
|
|
@@ -316,7 +421,7 @@ function MultiAppProvider({
|
|
|
316
421
|
changeApp({ id: collectionApp });
|
|
317
422
|
}
|
|
318
423
|
};
|
|
319
|
-
const ctx = (0,
|
|
424
|
+
const ctx = (0, import_react4.useMemo)(
|
|
320
425
|
() => ({
|
|
321
426
|
currentApp: currentApp || { id: defaultApp },
|
|
322
427
|
initialApp: initialApp || { id: defaultApp },
|
|
@@ -330,14 +435,14 @@ function MultiAppProvider({
|
|
|
330
435
|
if (!currentApp || !currentFullApp) {
|
|
331
436
|
return null;
|
|
332
437
|
}
|
|
333
|
-
return /* @__PURE__ */ (0,
|
|
438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
334
439
|
AppProvider,
|
|
335
440
|
{
|
|
336
441
|
appId: currentApp.id,
|
|
337
442
|
definition: currentFullApp,
|
|
338
443
|
instanceId: currentApp.id + instanceId,
|
|
339
444
|
args: currentApp.args,
|
|
340
|
-
children: /* @__PURE__ */ (0,
|
|
445
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MultiAppContext.Provider, { value: ctx, children })
|
|
341
446
|
}
|
|
342
447
|
);
|
|
343
448
|
}
|
|
@@ -414,11 +519,90 @@ var ContextButton = import_styled_components.default.button`
|
|
|
414
519
|
letter-spacing: -0.42px;
|
|
415
520
|
`;
|
|
416
521
|
|
|
522
|
+
// src/PreviewButton/PreviewButton.tsx
|
|
523
|
+
var import_components = require("@manifest-editor/components");
|
|
524
|
+
|
|
525
|
+
// ../ui/icons/CloseIcon.tsx
|
|
526
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
527
|
+
var CloseIcon = ({ height = 16 }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", height, viewBox: "0 0 24 24", width: "24px", fill: "#000000", children: [
|
|
528
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
529
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.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" })
|
|
530
|
+
] });
|
|
531
|
+
|
|
532
|
+
// ../ui/icons/DownIcon.tsx
|
|
533
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
534
|
+
var DownIcon = ({ rotate = 0, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
535
|
+
"svg",
|
|
536
|
+
{
|
|
537
|
+
version: "1.2",
|
|
538
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
539
|
+
overflow: "visible",
|
|
540
|
+
preserveAspectRatio: "none",
|
|
541
|
+
viewBox: "0 0 24 24",
|
|
542
|
+
width: "1em",
|
|
543
|
+
height: "1em",
|
|
544
|
+
style: {
|
|
545
|
+
fill: "rgba(0, 0, 0, 0.6)",
|
|
546
|
+
transform: `rotate(${rotate}deg)`,
|
|
547
|
+
transition: "transform 0.2s"
|
|
548
|
+
},
|
|
549
|
+
...props,
|
|
550
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
551
|
+
"path",
|
|
552
|
+
{
|
|
553
|
+
d: "M8.12 9.29 12 13.17l3.88-3.88a.996.996 0 1 1 1.41 1.41l-4.59 4.59a.996.996 0 0 1-1.41 0L6.7 10.7a.996.996 0 0 1 0-1.41c.39-.38 1.03-.39 1.42 0z",
|
|
554
|
+
fill: "currentColor"
|
|
555
|
+
}
|
|
556
|
+
)
|
|
557
|
+
}
|
|
558
|
+
);
|
|
559
|
+
|
|
560
|
+
// src/PreviewButton/PreviewButton.tsx
|
|
561
|
+
var import_react_accessible_dropdown_menu_hook = __toESM(require("react-accessible-dropdown-menu-hook"), 1);
|
|
562
|
+
var import_react_iiif_vault3 = require("react-iiif-vault");
|
|
563
|
+
|
|
564
|
+
// src/AppResourceProvider/AppResourceProvider.tsx
|
|
565
|
+
var import_react5 = require("react");
|
|
566
|
+
var import_react_iiif_vault = require("react-iiif-vault");
|
|
567
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
568
|
+
var AppResourceReactProvider = (0, import_react5.createContext)(null);
|
|
569
|
+
var AppResourceInstanceReactProvider = (0, import_react5.createContext)(null);
|
|
570
|
+
function useAppResourceInstance() {
|
|
571
|
+
const ctx = (0, import_react5.useContext)(AppResourceInstanceReactProvider);
|
|
572
|
+
const resource = (0, import_react5.useContext)(AppResourceReactProvider);
|
|
573
|
+
const instanceId = ctx || resource?.id;
|
|
574
|
+
invariant(instanceId, "useResourceInstance can only be called from inside <ResourceProvider />");
|
|
575
|
+
return instanceId;
|
|
576
|
+
}
|
|
577
|
+
function useAppResource() {
|
|
578
|
+
const ctx = (0, import_react5.useContext)(AppResourceReactProvider);
|
|
579
|
+
invariant(ctx, "useResource can only be called from inside <ResourceProvider />");
|
|
580
|
+
return ctx;
|
|
581
|
+
}
|
|
582
|
+
function AppResourceInstanceProvider({ id, children }) {
|
|
583
|
+
if (!id) {
|
|
584
|
+
return children;
|
|
585
|
+
}
|
|
586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AppResourceInstanceReactProvider.Provider, { value: id, children });
|
|
587
|
+
}
|
|
588
|
+
function AppResourceProvider({ resource, children }) {
|
|
589
|
+
const vault = (0, import_react_iiif_vault.useExistingVault)();
|
|
590
|
+
let inner = children;
|
|
591
|
+
if (resource && resource.type === "Manifest") {
|
|
592
|
+
inner = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_iiif_vault.VaultProvider, { vault: vault || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_iiif_vault.ManifestContext, { manifest: resource.id || "", children }) });
|
|
593
|
+
}
|
|
594
|
+
if (resource && resource.type === "Collection") {
|
|
595
|
+
inner = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_iiif_vault.VaultProvider, { vault: vault || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_iiif_vault.CollectionContext, { collection: resource.id || "", children }) });
|
|
596
|
+
}
|
|
597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AppResourceReactProvider.Provider, { value: resource, children: inner });
|
|
598
|
+
}
|
|
599
|
+
|
|
417
600
|
// src/PreviewContext/PreviewContext.tsx
|
|
418
|
-
var
|
|
601
|
+
var import_react7 = require("react");
|
|
419
602
|
|
|
420
603
|
// src/PreviewContext/PreviewContext.hooks.ts
|
|
421
|
-
var
|
|
604
|
+
var import_react6 = require("react");
|
|
605
|
+
var import_react_iiif_vault2 = require("react-iiif-vault");
|
|
422
606
|
|
|
423
607
|
// src/PreviewContext/previews/ExternalManifestUrlPreview.ts
|
|
424
608
|
var ExternalManifestUrlPreview = class {
|
|
@@ -591,51 +775,12 @@ var IIIFPreviewService = class {
|
|
|
591
775
|
}
|
|
592
776
|
};
|
|
593
777
|
|
|
594
|
-
// src/PreviewContext/PreviewContext.hooks.ts
|
|
595
|
-
var import_react_iiif_vault2 = require("react-iiif-vault");
|
|
596
|
-
|
|
597
|
-
// src/AppResourceProvider/AppResourceProvider.tsx
|
|
598
|
-
var import_react4 = require("react");
|
|
599
|
-
var import_react_iiif_vault = require("react-iiif-vault");
|
|
600
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
601
|
-
var AppResourceReactProvider = (0, import_react4.createContext)(null);
|
|
602
|
-
var AppResourceInstanceReactProvider = (0, import_react4.createContext)(null);
|
|
603
|
-
function useAppResourceInstance() {
|
|
604
|
-
const ctx = (0, import_react4.useContext)(AppResourceInstanceReactProvider);
|
|
605
|
-
const resource = (0, import_react4.useContext)(AppResourceReactProvider);
|
|
606
|
-
const instanceId = ctx || resource?.id;
|
|
607
|
-
invariant(instanceId, "useResourceInstance can only be called from inside <ResourceProvider />");
|
|
608
|
-
return instanceId;
|
|
609
|
-
}
|
|
610
|
-
function useAppResource() {
|
|
611
|
-
const ctx = (0, import_react4.useContext)(AppResourceReactProvider);
|
|
612
|
-
invariant(ctx, "useResource can only be called from inside <ResourceProvider />");
|
|
613
|
-
return ctx;
|
|
614
|
-
}
|
|
615
|
-
function AppResourceInstanceProvider({ id, children }) {
|
|
616
|
-
if (!id) {
|
|
617
|
-
return children;
|
|
618
|
-
}
|
|
619
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AppResourceInstanceReactProvider.Provider, { value: id, children });
|
|
620
|
-
}
|
|
621
|
-
function AppResourceProvider({ resource, children }) {
|
|
622
|
-
const vault = (0, import_react_iiif_vault.useExistingVault)();
|
|
623
|
-
let inner = children;
|
|
624
|
-
if (resource && resource.type === "Manifest") {
|
|
625
|
-
inner = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_iiif_vault.VaultProvider, { vault: vault || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_iiif_vault.ManifestContext, { manifest: resource.id || "", children }) });
|
|
626
|
-
}
|
|
627
|
-
if (resource && resource.type === "Collection") {
|
|
628
|
-
inner = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_iiif_vault.VaultProvider, { vault: vault || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_iiif_vault.CollectionContext, { collection: resource.id || "", children }) });
|
|
629
|
-
}
|
|
630
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AppResourceReactProvider.Provider, { value: resource, children: inner });
|
|
631
|
-
}
|
|
632
|
-
|
|
633
778
|
// src/PreviewContext/PreviewContext.hooks.ts
|
|
634
779
|
function usePreviewActions(state, dispatch, handlers, previews, setPreviews) {
|
|
635
780
|
const resource = useAppResource();
|
|
636
781
|
const instanceId = useAppResourceInstance();
|
|
637
782
|
const vault = (0, import_react_iiif_vault2.useVault)();
|
|
638
|
-
const previewActions = (0,
|
|
783
|
+
const previewActions = (0, import_react6.useMemo)(
|
|
639
784
|
() => ({
|
|
640
785
|
setPreview: (preview) => {
|
|
641
786
|
if (!preview)
|
|
@@ -648,7 +793,7 @@ function usePreviewActions(state, dispatch, handlers, previews, setPreviews) {
|
|
|
648
793
|
}),
|
|
649
794
|
[setPreviews, instanceId]
|
|
650
795
|
);
|
|
651
|
-
const [handlerMap, providesMap] = (0,
|
|
796
|
+
const [handlerMap, providesMap] = (0, import_react6.useMemo)(() => {
|
|
652
797
|
const map = {};
|
|
653
798
|
const providesMap2 = {};
|
|
654
799
|
for (const handler of handlers) {
|
|
@@ -702,8 +847,8 @@ function usePreviewActions(state, dispatch, handlers, previews, setPreviews) {
|
|
|
702
847
|
async function selectPreview(id) {
|
|
703
848
|
const selectedHandler = handlerMap[id];
|
|
704
849
|
if (selectedHandler && instanceId) {
|
|
705
|
-
await activatePreview(id);
|
|
706
850
|
dispatch({ type: "selectPreview", payload: id });
|
|
851
|
+
await activatePreview(id);
|
|
707
852
|
}
|
|
708
853
|
}
|
|
709
854
|
async function getPreviewLink() {
|
|
@@ -755,18 +900,18 @@ function usePreviewActions(state, dispatch, handlers, previews, setPreviews) {
|
|
|
755
900
|
dispatch({ type: "activatePreview", payload: contextualPreview.id });
|
|
756
901
|
} else {
|
|
757
902
|
Object.assign(context, existing?.data || {});
|
|
758
|
-
dispatch({ type: "activatePreview", payload: id });
|
|
903
|
+
dispatch({ type: "activatePreview", payload: existing.id });
|
|
759
904
|
}
|
|
760
905
|
}
|
|
761
906
|
const created = await selectedHandler.createPreview(instanceId, resource, vault, context);
|
|
762
907
|
if (created) {
|
|
763
908
|
previewActions.setPreview(created);
|
|
764
|
-
dispatch({ type: "activatePreview", payload: id });
|
|
909
|
+
dispatch({ type: "activatePreview", payload: created.id });
|
|
765
910
|
}
|
|
766
911
|
}
|
|
767
912
|
}
|
|
768
913
|
}
|
|
769
|
-
return (0,
|
|
914
|
+
return (0, import_react6.useMemo)(
|
|
770
915
|
() => ({ selectPreview, deletePreview, focusPreview, activatePreview, updatePreviews, getPreviewLink }),
|
|
771
916
|
// Dispatch has a stable identity.
|
|
772
917
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -774,7 +919,7 @@ function usePreviewActions(state, dispatch, handlers, previews, setPreviews) {
|
|
|
774
919
|
);
|
|
775
920
|
}
|
|
776
921
|
function usePreviewHandlers(configs) {
|
|
777
|
-
return (0,
|
|
922
|
+
return (0, import_react6.useMemo)(() => {
|
|
778
923
|
const handlers = [];
|
|
779
924
|
for (const config of configs) {
|
|
780
925
|
switch (config.type) {
|
|
@@ -827,23 +972,23 @@ function getDefaultPreviewState() {
|
|
|
827
972
|
}
|
|
828
973
|
|
|
829
974
|
// src/PreviewContext/PreviewContext.tsx
|
|
830
|
-
var
|
|
831
|
-
var PreviewReactContext = (0,
|
|
832
|
-
var AvailablePreviewReactContext = (0,
|
|
833
|
-
var PreviewProvider = (0,
|
|
975
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
976
|
+
var PreviewReactContext = (0, import_react7.createContext)(null);
|
|
977
|
+
var AvailablePreviewReactContext = (0, import_react7.createContext)([]);
|
|
978
|
+
var PreviewProvider = (0, import_react7.memo)(function PreviewProvider2({
|
|
834
979
|
children,
|
|
835
980
|
configs = []
|
|
836
981
|
}) {
|
|
837
982
|
const instanceId = useAppResourceInstance();
|
|
838
983
|
const handlers = usePreviewHandlers(configs);
|
|
839
984
|
const [previews, setPreviews] = useLocalStorage(`preview-${instanceId}`, []);
|
|
840
|
-
const [state, dispatch] = (0,
|
|
985
|
+
const [state, dispatch] = (0, import_react7.useReducer)(previewContextReducer, void 0, getDefaultPreviewState);
|
|
841
986
|
const actions = usePreviewActions(state, dispatch, handlers, previews, setPreviews);
|
|
842
|
-
const context = (0,
|
|
987
|
+
const context = (0, import_react7.useMemo)(
|
|
843
988
|
() => ({ configs, actions, handlers, ...state }),
|
|
844
989
|
[actions, configs, handlers, state]
|
|
845
990
|
);
|
|
846
|
-
(0,
|
|
991
|
+
(0, import_react7.useEffect)(() => {
|
|
847
992
|
for (const preview of previews) {
|
|
848
993
|
if (!state.active.includes(preview.id)) {
|
|
849
994
|
const handler = handlers.find((h) => h.id === preview.id);
|
|
@@ -859,13 +1004,13 @@ var PreviewProvider = (0, import_react6.memo)(function PreviewProvider2({
|
|
|
859
1004
|
}
|
|
860
1005
|
}
|
|
861
1006
|
}, [instanceId]);
|
|
862
|
-
return /* @__PURE__ */ (0,
|
|
1007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AvailablePreviewReactContext.Provider, { value: previews, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PreviewReactContext.Provider, { value: context, children }) });
|
|
863
1008
|
});
|
|
864
1009
|
function usePreviews() {
|
|
865
|
-
return (0,
|
|
1010
|
+
return (0, import_react7.useContext)(AvailablePreviewReactContext);
|
|
866
1011
|
}
|
|
867
1012
|
function usePreviewContext() {
|
|
868
|
-
const ctx = (0,
|
|
1013
|
+
const ctx = (0, import_react7.useContext)(PreviewReactContext);
|
|
869
1014
|
invariant(ctx, "usePreviewContext() can only be called from inside <PreviewProvider />");
|
|
870
1015
|
return ctx;
|
|
871
1016
|
}
|
|
@@ -1074,124 +1219,6 @@ var ButtonEmpty = import_styled_components3.default.div`
|
|
|
1074
1219
|
cursor: not-allowed;
|
|
1075
1220
|
`;
|
|
1076
1221
|
|
|
1077
|
-
// src/PreviewButton/PreviewButton.tsx
|
|
1078
|
-
var import_react_accessible_dropdown_menu_hook = __toESM(require("react-accessible-dropdown-menu-hook"), 1);
|
|
1079
|
-
|
|
1080
|
-
// ../ui/icons/DownIcon.tsx
|
|
1081
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1082
|
-
var DownIcon = ({ rotate = 0, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1083
|
-
"svg",
|
|
1084
|
-
{
|
|
1085
|
-
version: "1.2",
|
|
1086
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1087
|
-
overflow: "visible",
|
|
1088
|
-
preserveAspectRatio: "none",
|
|
1089
|
-
viewBox: "0 0 24 24",
|
|
1090
|
-
width: "1em",
|
|
1091
|
-
height: "1em",
|
|
1092
|
-
style: {
|
|
1093
|
-
fill: "rgba(0, 0, 0, 0.6)",
|
|
1094
|
-
transform: `rotate(${rotate}deg)`,
|
|
1095
|
-
transition: "transform 0.2s"
|
|
1096
|
-
},
|
|
1097
|
-
...props,
|
|
1098
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1099
|
-
"path",
|
|
1100
|
-
{
|
|
1101
|
-
d: "M8.12 9.29 12 13.17l3.88-3.88a.996.996 0 1 1 1.41 1.41l-4.59 4.59a.996.996 0 0 1-1.41 0L6.7 10.7a.996.996 0 0 1 0-1.41c.39-.38 1.03-.39 1.42 0z",
|
|
1102
|
-
fill: "currentColor"
|
|
1103
|
-
}
|
|
1104
|
-
)
|
|
1105
|
-
}
|
|
1106
|
-
);
|
|
1107
|
-
|
|
1108
|
-
// ../ui/icons/CloseIcon.tsx
|
|
1109
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1110
|
-
var CloseIcon = ({ height = 16 }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", height, viewBox: "0 0 24 24", width: "24px", fill: "#000000", children: [
|
|
1111
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
1112
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.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" })
|
|
1113
|
-
] });
|
|
1114
|
-
|
|
1115
|
-
// src/PreviewButton/PreviewButton.tsx
|
|
1116
|
-
var import_react_iiif_vault3 = require("react-iiif-vault");
|
|
1117
|
-
var import_components = require("@manifest-editor/components");
|
|
1118
|
-
|
|
1119
|
-
// src/ConfigContext/ConfigContext.tsx
|
|
1120
|
-
var import_react7 = require("react");
|
|
1121
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1122
|
-
var DEFAULT_CONFIG = {
|
|
1123
|
-
previews: [],
|
|
1124
|
-
behaviorPresets: [
|
|
1125
|
-
"auto-advance",
|
|
1126
|
-
"no-auto-advance",
|
|
1127
|
-
"repeat",
|
|
1128
|
-
"no-repeat",
|
|
1129
|
-
"unordered",
|
|
1130
|
-
"individuals",
|
|
1131
|
-
"continuous",
|
|
1132
|
-
"paged",
|
|
1133
|
-
"non-paged",
|
|
1134
|
-
"facing-pages",
|
|
1135
|
-
"multi-part",
|
|
1136
|
-
"together",
|
|
1137
|
-
"sequence",
|
|
1138
|
-
"thumbnail-nav",
|
|
1139
|
-
"no-nav",
|
|
1140
|
-
"hidden"
|
|
1141
|
-
],
|
|
1142
|
-
defaultPreview: null,
|
|
1143
|
-
editorConfig: {},
|
|
1144
|
-
newTemplates: null,
|
|
1145
|
-
i18n: {
|
|
1146
|
-
advancedLanguageMode: false,
|
|
1147
|
-
availableLanguages: ["en", "cy", "nl", "fr"],
|
|
1148
|
-
defaultLanguage: "en"
|
|
1149
|
-
},
|
|
1150
|
-
editorFeatureFlags: {
|
|
1151
|
-
enableMultiImageCanvases: true,
|
|
1152
|
-
enableMultiMediaCanvases: true
|
|
1153
|
-
},
|
|
1154
|
-
uploadBackends: [],
|
|
1155
|
-
export: {
|
|
1156
|
-
baseIdentifier: null,
|
|
1157
|
-
version: 3
|
|
1158
|
-
}
|
|
1159
|
-
};
|
|
1160
|
-
var ConfigReactContext = (0, import_react7.createContext)(DEFAULT_CONFIG);
|
|
1161
|
-
var SaveConfigReactContext = (0, import_react7.createContext)(() => {
|
|
1162
|
-
});
|
|
1163
|
-
function useConfig() {
|
|
1164
|
-
return (0, import_react7.useContext)(ConfigReactContext);
|
|
1165
|
-
}
|
|
1166
|
-
function useSaveConfig() {
|
|
1167
|
-
return (0, import_react7.useContext)(SaveConfigReactContext);
|
|
1168
|
-
}
|
|
1169
|
-
function ConfigProvider({
|
|
1170
|
-
children,
|
|
1171
|
-
config,
|
|
1172
|
-
saveConfig
|
|
1173
|
-
}) {
|
|
1174
|
-
const [runtimeConfig, setRuntimeConfig] = (0, import_react7.useState)(null);
|
|
1175
|
-
const resolvedConfig = (0, import_react7.useMemo)(
|
|
1176
|
-
() => ({
|
|
1177
|
-
...DEFAULT_CONFIG,
|
|
1178
|
-
...config || {},
|
|
1179
|
-
...runtimeConfig || {}
|
|
1180
|
-
}),
|
|
1181
|
-
[config, runtimeConfig]
|
|
1182
|
-
);
|
|
1183
|
-
const memoSaveConfig = (0, import_react7.useCallback)(
|
|
1184
|
-
(config2) => {
|
|
1185
|
-
setRuntimeConfig(config2);
|
|
1186
|
-
if (saveConfig) {
|
|
1187
|
-
saveConfig(config2);
|
|
1188
|
-
}
|
|
1189
|
-
},
|
|
1190
|
-
[config]
|
|
1191
|
-
);
|
|
1192
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SaveConfigReactContext.Provider, { value: memoSaveConfig, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ConfigReactContext.Provider, { value: resolvedConfig, children }) });
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
1222
|
// src/PreviewButton/PreviewButton.tsx
|
|
1196
1223
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1197
1224
|
function PreviewButton({ downloadEnabled, fileName }) {
|
|
@@ -1228,9 +1255,7 @@ function PreviewButton({ downloadEnabled, fileName }) {
|
|
|
1228
1255
|
if (defaultPreviewId) {
|
|
1229
1256
|
const found = configs.find((c) => c.id === defaultPreviewId);
|
|
1230
1257
|
if (found) {
|
|
1231
|
-
console.log(found, { defaultPreviewId });
|
|
1232
1258
|
actions.selectPreview(found.id);
|
|
1233
|
-
actions.updatePreviews();
|
|
1234
1259
|
return;
|
|
1235
1260
|
}
|
|
1236
1261
|
}
|
|
@@ -1246,7 +1271,15 @@ function PreviewButton({ downloadEnabled, fileName }) {
|
|
|
1246
1271
|
const inactive = active.indexOf(config2.id) === -1;
|
|
1247
1272
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(MenuItem, { ...itemProps[key], children: [
|
|
1248
1273
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MenuItemStatus, { $status: inactive ? "available" : config2.id === selected ? "active" : "configured" }),
|
|
1249
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1274
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1275
|
+
MenuItemLabel,
|
|
1276
|
+
{
|
|
1277
|
+
onClick: () => {
|
|
1278
|
+
actions.selectPreview(config2.id);
|
|
1279
|
+
},
|
|
1280
|
+
children: config2.label
|
|
1281
|
+
}
|
|
1282
|
+
),
|
|
1250
1283
|
!inactive ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MenuItemClose, { onClick: () => actions.deletePreview(config2.id), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CloseIcon, {}) }) : null
|
|
1251
1284
|
] }, config2.id);
|
|
1252
1285
|
}) })
|
|
@@ -1288,161 +1321,456 @@ function AppMenuProvider({ children, menu }) {
|
|
|
1288
1321
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ReactAppMenuContext.Provider, { value: menu, children });
|
|
1289
1322
|
}
|
|
1290
1323
|
|
|
1291
|
-
// src/
|
|
1292
|
-
var
|
|
1293
|
-
var import_react_iiif_vault7 = require("react-iiif-vault");
|
|
1294
|
-
var import_parser3 = require("@iiif/parser");
|
|
1295
|
-
|
|
1296
|
-
// ../ui/madoc/components/icons/Spinner.tsx
|
|
1297
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1298
|
-
function Spinner(props) {
|
|
1299
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { width: "1em", height: "1em", viewBox: "0 0 42 42", xmlns: "http://www.w3.org/2000/svg", stroke: "#fff", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { transform: "translate(2 2)", strokeWidth: 5, fill: "none", fillRule: "evenodd", children: [
|
|
1300
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { strokeOpacity: 0.5, cx: 18, cy: 18, r: 18 }),
|
|
1301
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M36 18c0-9.94-8.06-18-18-18", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1302
|
-
"animateTransform",
|
|
1303
|
-
{
|
|
1304
|
-
attributeName: "transform",
|
|
1305
|
-
type: "rotate",
|
|
1306
|
-
from: "0 18 18",
|
|
1307
|
-
to: "360 18 18",
|
|
1308
|
-
dur: "1s",
|
|
1309
|
-
repeatCount: "indefinite"
|
|
1310
|
-
}
|
|
1311
|
-
) })
|
|
1312
|
-
] }) });
|
|
1313
|
-
}
|
|
1324
|
+
// src/AtlasStore/AtlasStoreProvider.tsx
|
|
1325
|
+
var import_react11 = require("react");
|
|
1314
1326
|
|
|
1315
|
-
// src/
|
|
1316
|
-
var
|
|
1317
|
-
var
|
|
1327
|
+
// src/AtlasStore/AtlasStore.ts
|
|
1328
|
+
var import_polygon_editor = require("polygon-editor");
|
|
1329
|
+
var import_vanilla = require("zustand/vanilla");
|
|
1318
1330
|
|
|
1319
|
-
// src/
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
try {
|
|
1324
|
-
await fetch(id).then((response) => {
|
|
1325
|
-
return response.json().catch((err) => {
|
|
1326
|
-
console.error(`'${err}' happened!`);
|
|
1327
|
-
});
|
|
1328
|
-
}).then((data) => {
|
|
1329
|
-
responseData = { ...data };
|
|
1330
|
-
});
|
|
1331
|
-
} catch (error) {
|
|
1332
|
-
console.log(error);
|
|
1331
|
+
// src/AtlasStore/polygon-to-bounding-box.ts
|
|
1332
|
+
function polygonToBoundingBox(polygon) {
|
|
1333
|
+
if (!polygon) {
|
|
1334
|
+
return null;
|
|
1333
1335
|
}
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
cancelable: true
|
|
1348
|
-
});
|
|
1349
|
-
a.dispatchEvent(clickEvt);
|
|
1350
|
-
a.remove();
|
|
1351
|
-
}
|
|
1352
|
-
async function copyToClipboard(json) {
|
|
1353
|
-
return navigator.clipboard.writeText(typeof json === "string" ? json : JSON.stringify(json, null, 2));
|
|
1354
|
-
}
|
|
1355
|
-
function randomId() {
|
|
1356
|
-
return `${Math.random().toString(36).substr(2)}-${Date.now().toString(36)}`;
|
|
1336
|
+
if (polygon.points.length > 2) {
|
|
1337
|
+
const x1 = Math.min(...polygon.points.map((p) => p[0]));
|
|
1338
|
+
const y1 = Math.min(...polygon.points.map((p) => p[1]));
|
|
1339
|
+
const x2 = Math.max(0, ...polygon.points.map((p) => p[0]));
|
|
1340
|
+
const y2 = Math.max(0, ...polygon.points.map((p) => p[1]));
|
|
1341
|
+
return {
|
|
1342
|
+
x: x1,
|
|
1343
|
+
y: y1,
|
|
1344
|
+
width: x2 - x1,
|
|
1345
|
+
height: y2 - y1
|
|
1346
|
+
};
|
|
1347
|
+
}
|
|
1348
|
+
return null;
|
|
1357
1349
|
}
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
...props
|
|
1367
|
-
}
|
|
1350
|
+
|
|
1351
|
+
// src/AtlasStore/AtlasStore.ts
|
|
1352
|
+
function polygonToTarget(polygon) {
|
|
1353
|
+
if (!polygon)
|
|
1354
|
+
return null;
|
|
1355
|
+
return {
|
|
1356
|
+
type: "SvgSelector",
|
|
1357
|
+
value: `<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'><g><path d='M${polygon.points.map((p) => p.join(",")).join(" ")}${polygon.open ? "" : " Z"}' /></g></svg>`
|
|
1368
1358
|
};
|
|
1369
|
-
return map ? map(app) : app;
|
|
1370
1359
|
}
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
return s;
|
|
1386
|
-
}
|
|
1387
|
-
return { resources: [...s.resources, id] };
|
|
1388
|
-
});
|
|
1389
|
-
},
|
|
1390
|
-
clearHighlight: (id) => {
|
|
1391
|
-
set((s) => ({ resources: s.resources.filter((item) => item !== id) }));
|
|
1360
|
+
function requestToAnnotationResponse(request) {
|
|
1361
|
+
if (request.type === "polygon") {
|
|
1362
|
+
return {
|
|
1363
|
+
polygon: {
|
|
1364
|
+
points: request.points || [],
|
|
1365
|
+
open: request.open || false
|
|
1366
|
+
},
|
|
1367
|
+
requestType: "polygon",
|
|
1368
|
+
boundingBox: polygonToBoundingBox({
|
|
1369
|
+
points: request.points || [],
|
|
1370
|
+
open: false
|
|
1371
|
+
}),
|
|
1372
|
+
target: polygonToTarget({ points: request.points || [], open: false })
|
|
1373
|
+
};
|
|
1392
1374
|
}
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1375
|
+
const box = request.selector;
|
|
1376
|
+
if (box) {
|
|
1377
|
+
const points = [
|
|
1378
|
+
[box.x, box.y],
|
|
1379
|
+
[box.x + box.width, box.y],
|
|
1380
|
+
[box.x + box.width, box.y + box.height],
|
|
1381
|
+
[box.x, box.y + box.height]
|
|
1382
|
+
];
|
|
1383
|
+
return {
|
|
1384
|
+
polygon: {
|
|
1385
|
+
points,
|
|
1386
|
+
open: false
|
|
1387
|
+
},
|
|
1388
|
+
requestType: request.type,
|
|
1389
|
+
boundingBox: box,
|
|
1390
|
+
target: polygonToTarget({ points, open: false })
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1393
|
+
return {
|
|
1394
|
+
polygon: { points: [], open: false },
|
|
1395
|
+
requestType: request.type,
|
|
1396
|
+
boundingBox: null,
|
|
1397
|
+
target: null
|
|
1398
|
+
};
|
|
1410
1399
|
}
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1400
|
+
var defaultSlowState = {
|
|
1401
|
+
shapeId: null,
|
|
1402
|
+
noShape: true,
|
|
1403
|
+
transitioning: false,
|
|
1404
|
+
actionIntentType: null,
|
|
1405
|
+
transitionIntentType: null,
|
|
1406
|
+
selectedPoints: [],
|
|
1407
|
+
hasClosestLine: false,
|
|
1408
|
+
modifiers: {
|
|
1409
|
+
Alt: false,
|
|
1410
|
+
Shift: false,
|
|
1411
|
+
Meta: false,
|
|
1412
|
+
proximity: 0
|
|
1413
|
+
// default value.
|
|
1414
|
+
},
|
|
1415
|
+
showBoundingBox: false,
|
|
1416
|
+
currentModifiers: {},
|
|
1417
|
+
validIntentKeys: {},
|
|
1418
|
+
pointerInsideShape: false,
|
|
1419
|
+
closestPoint: null,
|
|
1420
|
+
transitionModifiers: null,
|
|
1421
|
+
selectedStamp: null,
|
|
1422
|
+
lineMode: false,
|
|
1423
|
+
lineBoxMode: false,
|
|
1424
|
+
drawMode: false,
|
|
1425
|
+
bezierLines: [],
|
|
1426
|
+
boxMode: false,
|
|
1427
|
+
fixedAspectRatio: false
|
|
1428
|
+
};
|
|
1429
|
+
function createAtlasStore({ events: events2 }) {
|
|
1430
|
+
const store = (0, import_vanilla.createStore)((set, get) => {
|
|
1431
|
+
let runtime = null;
|
|
1432
|
+
const onSave = (input) => {
|
|
1433
|
+
set(
|
|
1434
|
+
(s) => s.tool.requestId ? { polygon: { ...input, id: s.tool.requestId } } : {
|
|
1435
|
+
polygon: { id: void 0, points: [], open: true }
|
|
1436
|
+
}
|
|
1437
|
+
);
|
|
1419
1438
|
};
|
|
1420
|
-
|
|
1421
|
-
return (0, import_react10.useMemo)(() => {
|
|
1439
|
+
const polygons = (0, import_polygon_editor.createHelper)(null, onSave);
|
|
1422
1440
|
return {
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1441
|
+
mode: "explore",
|
|
1442
|
+
tool: {
|
|
1443
|
+
enabled: false,
|
|
1444
|
+
requestId: null,
|
|
1445
|
+
canvasId: null
|
|
1446
|
+
},
|
|
1447
|
+
requestType: null,
|
|
1448
|
+
history: polygons.history,
|
|
1449
|
+
polygon: null,
|
|
1450
|
+
validRequestIds: [],
|
|
1451
|
+
stableViewport: null,
|
|
1452
|
+
canvasRelativePositions: {},
|
|
1453
|
+
canvasViewports: {},
|
|
1454
|
+
polygons,
|
|
1455
|
+
polygonState: defaultSlowState,
|
|
1456
|
+
setToolCanvasId: (canvasId) => {
|
|
1457
|
+
set((state) => ({ tool: { ...state.tool, canvasId } }));
|
|
1458
|
+
},
|
|
1459
|
+
switchTool: {
|
|
1460
|
+
draw() {
|
|
1461
|
+
set({ mode: "sketch" });
|
|
1462
|
+
helper.stamps.clear();
|
|
1463
|
+
helper.draw.enable();
|
|
1464
|
+
},
|
|
1465
|
+
polygon() {
|
|
1466
|
+
set({ mode: "sketch" });
|
|
1467
|
+
helper.stamps.clear();
|
|
1468
|
+
helper.draw.disable();
|
|
1469
|
+
helper.modes.disableLineBoxMode();
|
|
1470
|
+
helper.modes.disableLineMode();
|
|
1471
|
+
},
|
|
1472
|
+
line() {
|
|
1473
|
+
set({ mode: "sketch" });
|
|
1474
|
+
helper.modes.enableLineMode();
|
|
1475
|
+
},
|
|
1476
|
+
lineBox() {
|
|
1477
|
+
set({ mode: "sketch" });
|
|
1478
|
+
helper.modes.enableLineBoxMode();
|
|
1479
|
+
},
|
|
1480
|
+
square() {
|
|
1481
|
+
set({ mode: "sketch" });
|
|
1482
|
+
helper.stamps.square();
|
|
1483
|
+
},
|
|
1484
|
+
triangle() {
|
|
1485
|
+
set({ mode: "sketch" });
|
|
1486
|
+
helper.stamps.triangle();
|
|
1487
|
+
},
|
|
1488
|
+
hexagon() {
|
|
1489
|
+
set({ mode: "sketch" });
|
|
1490
|
+
helper.stamps.hexagon();
|
|
1491
|
+
},
|
|
1492
|
+
circle() {
|
|
1493
|
+
set({ mode: "sketch" });
|
|
1494
|
+
helper.stamps.circle();
|
|
1495
|
+
},
|
|
1496
|
+
remove() {
|
|
1497
|
+
helper.key.down("Backspace");
|
|
1426
1498
|
}
|
|
1427
1499
|
},
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1500
|
+
reset: () => {
|
|
1501
|
+
const state = get();
|
|
1502
|
+
if (state.tool.requestId) {
|
|
1503
|
+
state.cancelRequest(state.tool.requestId);
|
|
1504
|
+
}
|
|
1505
|
+
},
|
|
1506
|
+
setPolygonState: (state) => set({
|
|
1507
|
+
polygonState: typeof state === "function" ? state(get().polygonState) : state
|
|
1508
|
+
}),
|
|
1509
|
+
getRequestId: () => {
|
|
1510
|
+
const requestId = Math.random().toString(36).slice(2);
|
|
1511
|
+
set((state) => ({
|
|
1512
|
+
validRequestIds: [...state.validRequestIds, requestId]
|
|
1513
|
+
}));
|
|
1514
|
+
return {
|
|
1515
|
+
requestId,
|
|
1516
|
+
clear: () => {
|
|
1517
|
+
if (get().tool.requestId === requestId) {
|
|
1518
|
+
}
|
|
1519
|
+
set((state) => ({
|
|
1520
|
+
tool: state.tool.requestId === requestId ? { enabled: false, requestId: null, canvasId: null } : state.tool,
|
|
1521
|
+
validRequestIds: state.validRequestIds.filter((id) => id !== requestId)
|
|
1522
|
+
}));
|
|
1523
|
+
}
|
|
1524
|
+
};
|
|
1525
|
+
},
|
|
1526
|
+
cancelRequest: (requestId) => {
|
|
1527
|
+
set((state) => ({
|
|
1528
|
+
mode: "explore",
|
|
1529
|
+
tool: state.tool.requestId === requestId ? { enabled: false, requestId: null, canvasId: null } : state.tool,
|
|
1530
|
+
validRequestIds: state.validRequestIds.filter((id) => id !== requestId)
|
|
1531
|
+
}));
|
|
1532
|
+
events2.emit("atlas.request-cancelled", { id: requestId });
|
|
1533
|
+
},
|
|
1534
|
+
requestAnnotation: async (request, options) => {
|
|
1535
|
+
const response = requestToAnnotationResponse(request);
|
|
1536
|
+
try {
|
|
1537
|
+
const { points = [], open = true } = response.polygon || {};
|
|
1538
|
+
const { requestId, canvasId = null, toolId } = options;
|
|
1539
|
+
const state = get();
|
|
1540
|
+
const isValid = state.validRequestIds.includes(requestId);
|
|
1541
|
+
if (!isValid)
|
|
1542
|
+
return null;
|
|
1543
|
+
if (state.tool.enabled)
|
|
1544
|
+
return null;
|
|
1545
|
+
polygons.setShape({ id: requestId, points, open });
|
|
1546
|
+
if (request.type === "box") {
|
|
1547
|
+
polygons.modes.enableBoxMode();
|
|
1548
|
+
}
|
|
1549
|
+
if (request.type === "target") {
|
|
1550
|
+
polygons.modes.enableBoxMode();
|
|
1551
|
+
polygons.modes.lockAspectRatio();
|
|
1552
|
+
}
|
|
1553
|
+
events2.emit("atlas.annotation-request", { id: requestId });
|
|
1554
|
+
set({
|
|
1555
|
+
polygon: { id: requestId, points, open },
|
|
1556
|
+
mode: "sketch",
|
|
1557
|
+
requestType: request.type,
|
|
1558
|
+
tool: {
|
|
1559
|
+
enabled: true,
|
|
1560
|
+
requestId,
|
|
1561
|
+
canvasId
|
|
1562
|
+
}
|
|
1563
|
+
});
|
|
1564
|
+
if (toolId) {
|
|
1565
|
+
state.switchTool[toolId]?.();
|
|
1566
|
+
} else if (points.length === 0) {
|
|
1567
|
+
state.switchTool.square();
|
|
1568
|
+
}
|
|
1569
|
+
return new Promise((resolve) => {
|
|
1570
|
+
const cancelHandler = (e) => {
|
|
1571
|
+
if (e.id !== requestId)
|
|
1572
|
+
return;
|
|
1573
|
+
set({
|
|
1574
|
+
mode: "explore",
|
|
1575
|
+
tool: {
|
|
1576
|
+
requestId: null,
|
|
1577
|
+
enabled: false,
|
|
1578
|
+
canvasId: null
|
|
1579
|
+
}
|
|
1580
|
+
});
|
|
1581
|
+
events2.off("atlas.request-cancelled", cancelHandler);
|
|
1582
|
+
events2.off("atlas.annotation-completed", handler);
|
|
1583
|
+
resolve(null);
|
|
1584
|
+
};
|
|
1585
|
+
const handler = (e) => {
|
|
1586
|
+
if (e.id !== requestId)
|
|
1587
|
+
return;
|
|
1588
|
+
set({
|
|
1589
|
+
mode: "explore",
|
|
1590
|
+
tool: {
|
|
1591
|
+
requestId: null,
|
|
1592
|
+
enabled: false,
|
|
1593
|
+
canvasId: null
|
|
1594
|
+
}
|
|
1595
|
+
});
|
|
1596
|
+
events2.off("atlas.annotation-completed", handler);
|
|
1597
|
+
events2.off("atlas.request-cancelled", cancelHandler);
|
|
1598
|
+
resolve(e);
|
|
1599
|
+
};
|
|
1600
|
+
events2.on("atlas.request-cancelled", cancelHandler);
|
|
1601
|
+
events2.on("atlas.annotation-completed", handler);
|
|
1602
|
+
});
|
|
1603
|
+
} catch (err) {
|
|
1604
|
+
return null;
|
|
1605
|
+
}
|
|
1606
|
+
},
|
|
1607
|
+
completeRequest: (requestId) => {
|
|
1608
|
+
if (typeof requestId === "string" && requestId) {
|
|
1609
|
+
if (requestId !== get().tool.requestId) {
|
|
1610
|
+
return;
|
|
1611
|
+
}
|
|
1431
1612
|
}
|
|
1613
|
+
const polygon = get().polygon;
|
|
1614
|
+
if (!polygon)
|
|
1615
|
+
return;
|
|
1616
|
+
events2.emit("atlas.annotation-completed", {
|
|
1617
|
+
id: polygon.id,
|
|
1618
|
+
polygon,
|
|
1619
|
+
requestType: get().requestType,
|
|
1620
|
+
target: polygonToTarget(polygon),
|
|
1621
|
+
canvasId: get().tool.canvasId,
|
|
1622
|
+
boundingBox: polygonToBoundingBox(polygon)
|
|
1623
|
+
});
|
|
1624
|
+
},
|
|
1625
|
+
setAtlasRuntime: (newRuntime) => {
|
|
1626
|
+
runtime = newRuntime;
|
|
1627
|
+
events2.emit("atlas.ready", { runtime: newRuntime });
|
|
1628
|
+
runtime.world.addLayoutSubscriber((ev, data) => {
|
|
1629
|
+
if (ev === "event-activation" || ev === "zoom-to" || ev === "go-home") {
|
|
1630
|
+
if (runtime?._lastGoodScale && !Number.isNaN(runtime._lastGoodScale)) {
|
|
1631
|
+
helper.setScale(1 / runtime._lastGoodScale);
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
});
|
|
1635
|
+
},
|
|
1636
|
+
clearAtlasRuntime: () => {
|
|
1637
|
+
runtime = null;
|
|
1638
|
+
set({ stableViewport: null });
|
|
1639
|
+
},
|
|
1640
|
+
setCanvasRelativePosition: (canvasId, position) => {
|
|
1641
|
+
set((state) => ({
|
|
1642
|
+
canvasRelativePositions: {
|
|
1643
|
+
...state.canvasRelativePositions,
|
|
1644
|
+
[canvasId]: position
|
|
1645
|
+
}
|
|
1646
|
+
}));
|
|
1647
|
+
},
|
|
1648
|
+
clearCanvasRelativePosition: (canvasId) => {
|
|
1649
|
+
set((state) => {
|
|
1650
|
+
const newPositions = { ...state.canvasRelativePositions };
|
|
1651
|
+
delete newPositions[canvasId];
|
|
1652
|
+
return { canvasRelativePositions: newPositions };
|
|
1653
|
+
});
|
|
1654
|
+
},
|
|
1655
|
+
changeMode: (mode) => {
|
|
1656
|
+
set({ mode });
|
|
1657
|
+
},
|
|
1658
|
+
// Navigation controls
|
|
1659
|
+
nudgeLeft: () => {
|
|
1660
|
+
},
|
|
1661
|
+
nudgeRight: () => {
|
|
1662
|
+
},
|
|
1663
|
+
nudgeUp: () => {
|
|
1664
|
+
},
|
|
1665
|
+
nudgeDown: () => {
|
|
1666
|
+
},
|
|
1667
|
+
zoomIn: () => {
|
|
1668
|
+
runtime?.world?.zoomIn();
|
|
1669
|
+
},
|
|
1670
|
+
zoomOut: () => {
|
|
1671
|
+
runtime?.world?.zoomOut();
|
|
1672
|
+
},
|
|
1673
|
+
goHome: () => {
|
|
1674
|
+
runtime?.world?.goHome();
|
|
1432
1675
|
}
|
|
1433
1676
|
};
|
|
1434
|
-
}
|
|
1677
|
+
});
|
|
1678
|
+
const helper = store.getState().polygons;
|
|
1679
|
+
events2.on("atlas.annotation-request", () => {
|
|
1680
|
+
helper.clock.start((state, slowState, dt) => {
|
|
1681
|
+
events2.emit("atlas.polygon-render", { state, slowState, dt });
|
|
1682
|
+
}, store.getState().setPolygonState);
|
|
1683
|
+
});
|
|
1684
|
+
events2.on("atlas.annotation-completed", () => {
|
|
1685
|
+
helper.clock.stop();
|
|
1686
|
+
});
|
|
1687
|
+
events2.on("atlas.request-cancelled", () => {
|
|
1688
|
+
helper.clock.stop();
|
|
1689
|
+
});
|
|
1690
|
+
return store;
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
// src/hooks/use-event.tsx
|
|
1694
|
+
var import_mitt2 = __toESM(require("mitt"), 1);
|
|
1695
|
+
var import_react10 = require("react");
|
|
1696
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1697
|
+
var events = (0, import_mitt2.default)();
|
|
1698
|
+
var ReactEmitterContext = (0, import_react10.createContext)(events);
|
|
1699
|
+
function EventEmitterProvider({
|
|
1700
|
+
children,
|
|
1701
|
+
emitter
|
|
1702
|
+
}) {
|
|
1703
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ReactEmitterContext.Provider, { value: emitter, children });
|
|
1704
|
+
}
|
|
1705
|
+
function useEmitter() {
|
|
1706
|
+
return (0, import_react10.useContext)(ReactEmitterContext);
|
|
1707
|
+
}
|
|
1708
|
+
function useEvent(key, listener, deps = []) {
|
|
1709
|
+
const emitter = (0, import_react10.useContext)(ReactEmitterContext);
|
|
1710
|
+
(0, import_react10.useEffect)(() => {
|
|
1711
|
+
const handler = (data) => {
|
|
1712
|
+
listener(data);
|
|
1713
|
+
};
|
|
1714
|
+
emitter.on(key, handler);
|
|
1715
|
+
return () => {
|
|
1716
|
+
emitter.off(key, handler);
|
|
1717
|
+
};
|
|
1718
|
+
}, [emitter, key, ...deps]);
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
// src/AtlasStore/AtlasStoreProvider.tsx
|
|
1722
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1723
|
+
var AtlasStoreReactContext = (0, import_react11.createContext)(null);
|
|
1724
|
+
function useAtlasStore() {
|
|
1725
|
+
return (0, import_react11.useContext)(AtlasStoreReactContext);
|
|
1726
|
+
}
|
|
1727
|
+
function AtlasStoreProvider({
|
|
1728
|
+
children
|
|
1729
|
+
}) {
|
|
1730
|
+
const emitter = useEmitter();
|
|
1731
|
+
const value = (0, import_react11.useMemo)(() => {
|
|
1732
|
+
return createAtlasStore({ events: emitter });
|
|
1733
|
+
}, []);
|
|
1734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(AtlasStoreReactContext.Provider, { value, children });
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
// src/BaseCreator/BaseCreator.tsx
|
|
1738
|
+
var import_parser3 = require("@iiif/parser");
|
|
1739
|
+
var import_components4 = require("@manifest-editor/components");
|
|
1740
|
+
var import_creator_api2 = require("@manifest-editor/creator-api");
|
|
1741
|
+
|
|
1742
|
+
// ../ui/madoc/components/icons/Spinner.tsx
|
|
1743
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1744
|
+
function Spinner(props) {
|
|
1745
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { width: "1em", height: "1em", viewBox: "0 0 42 42", xmlns: "http://www.w3.org/2000/svg", stroke: "#fff", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("g", { transform: "translate(2 2)", strokeWidth: 5, fill: "none", fillRule: "evenodd", children: [
|
|
1746
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("circle", { strokeOpacity: 0.5, cx: 18, cy: 18, r: 18 }),
|
|
1747
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M36 18c0-9.94-8.06-18-18-18", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1748
|
+
"animateTransform",
|
|
1749
|
+
{
|
|
1750
|
+
attributeName: "transform",
|
|
1751
|
+
type: "rotate",
|
|
1752
|
+
from: "0 18 18",
|
|
1753
|
+
to: "360 18 18",
|
|
1754
|
+
dur: "1s",
|
|
1755
|
+
repeatCount: "indefinite"
|
|
1756
|
+
}
|
|
1757
|
+
) })
|
|
1758
|
+
] }) });
|
|
1435
1759
|
}
|
|
1436
1760
|
|
|
1761
|
+
// src/BaseCreator/BaseCreator.tsx
|
|
1762
|
+
var import_react19 = require("react");
|
|
1763
|
+
var import_react_iiif_vault7 = require("react-iiif-vault");
|
|
1764
|
+
|
|
1437
1765
|
// src/Layout/Layout.context.tsx
|
|
1438
|
-
var
|
|
1439
|
-
var LayoutActionsReactContext = (0,
|
|
1440
|
-
var LayoutStateReactContext = (0,
|
|
1766
|
+
var import_react12 = require("react");
|
|
1767
|
+
var LayoutActionsReactContext = (0, import_react12.createContext)(null);
|
|
1768
|
+
var LayoutStateReactContext = (0, import_react12.createContext)(null);
|
|
1441
1769
|
function useLayoutState() {
|
|
1442
|
-
return (0,
|
|
1770
|
+
return (0, import_react12.useContext)(LayoutStateReactContext);
|
|
1443
1771
|
}
|
|
1444
1772
|
function useLayoutActions() {
|
|
1445
|
-
return (0,
|
|
1773
|
+
return (0, import_react12.useContext)(LayoutActionsReactContext);
|
|
1446
1774
|
}
|
|
1447
1775
|
function useAvailableLayouts() {
|
|
1448
1776
|
const app = useApp();
|
|
@@ -1451,22 +1779,22 @@ function useAvailableLayouts() {
|
|
|
1451
1779
|
function useLayoutProvider() {
|
|
1452
1780
|
const app = useApp();
|
|
1453
1781
|
const layout = app.layout;
|
|
1454
|
-
const actions = (0,
|
|
1455
|
-
const state = (0,
|
|
1456
|
-
return (0,
|
|
1782
|
+
const actions = (0, import_react12.useContext)(LayoutActionsReactContext);
|
|
1783
|
+
const state = (0, import_react12.useContext)(LayoutStateReactContext);
|
|
1784
|
+
return (0, import_react12.useMemo)(() => {
|
|
1457
1785
|
return { actions, state, ...layout };
|
|
1458
1786
|
}, [app, state]);
|
|
1459
1787
|
}
|
|
1460
1788
|
|
|
1461
1789
|
// src/Layout/components/ModularPanel.tsx
|
|
1462
|
-
var
|
|
1790
|
+
var import_styled_components6 = __toESM(require("styled-components"), 1);
|
|
1463
1791
|
|
|
1464
1792
|
// ../ui/icons/StarIcon.tsx
|
|
1465
|
-
var
|
|
1466
|
-
var StarIcon = (props) => /* @__PURE__ */ (0,
|
|
1467
|
-
/* @__PURE__ */ (0,
|
|
1468
|
-
/* @__PURE__ */ (0,
|
|
1469
|
-
/* @__PURE__ */ (0,
|
|
1793
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1794
|
+
var StarIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", height: "1em", width: "1em", viewBox: "0 0 24 24", ...props, children: [
|
|
1795
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
1796
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
1797
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1470
1798
|
"path",
|
|
1471
1799
|
{
|
|
1472
1800
|
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",
|
|
@@ -1476,15 +1804,15 @@ var StarIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("svg",
|
|
|
1476
1804
|
] });
|
|
1477
1805
|
|
|
1478
1806
|
// ../ui/icons/BackIcon.tsx
|
|
1479
|
-
var
|
|
1480
|
-
var BackIcon = ({ style }) => /* @__PURE__ */ (0,
|
|
1481
|
-
/* @__PURE__ */ (0,
|
|
1482
|
-
/* @__PURE__ */ (0,
|
|
1807
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1808
|
+
var BackIcon = ({ style }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", height: "1rem", viewBox: "0 0 24 24", width: "1rem", fill: "#000000", style, children: [
|
|
1809
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
1810
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" })
|
|
1483
1811
|
] });
|
|
1484
1812
|
|
|
1485
1813
|
// src/Layout/components/ModularPanel.tsx
|
|
1486
1814
|
var import_react_error_boundary = require("react-error-boundary");
|
|
1487
|
-
var
|
|
1815
|
+
var import_react15 = require("react");
|
|
1488
1816
|
|
|
1489
1817
|
// ../ui/atoms/PaddedSidebarContainer.tsx
|
|
1490
1818
|
var import_styled_components4 = __toESM(require("styled-components"), 1);
|
|
@@ -1495,75 +1823,21 @@ var PaddedSidebarContainer = import_styled_components4.default.div`
|
|
|
1495
1823
|
overflow: visible;
|
|
1496
1824
|
`;
|
|
1497
1825
|
|
|
1498
|
-
// ../ui/madoc/components/callouts/ErrorMessage.tsx
|
|
1499
|
-
var import_styled_components6 = __toESM(require("styled-components"), 1);
|
|
1500
|
-
|
|
1501
|
-
// ../ui/madoc/components/callouts/BaseMessage.tsx
|
|
1502
|
-
var import_styled_components5 = __toESM(require("styled-components"), 1);
|
|
1503
|
-
var BaseMessage = import_styled_components5.default.div`
|
|
1504
|
-
background: #000;
|
|
1505
|
-
color: #fff;
|
|
1506
|
-
width: 100%;
|
|
1507
|
-
padding: 0.5em 1em;
|
|
1508
|
-
line-height: 1.9em;
|
|
1509
|
-
display: flex;
|
|
1510
|
-
|
|
1511
|
-
a {
|
|
1512
|
-
color: #fff;
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
svg {
|
|
1516
|
-
fill: #fff;
|
|
1517
|
-
margin: 0 0.5em;
|
|
1518
|
-
vertical-align: text-bottom;
|
|
1519
|
-
}
|
|
1520
|
-
|
|
1521
|
-
${(props) => props.$small && import_styled_components5.css`
|
|
1522
|
-
font-size: 0.75em;
|
|
1523
|
-
padding: 0.25em 0.5em;
|
|
1524
|
-
line-height: 1.6em;
|
|
1525
|
-
`}
|
|
1526
|
-
|
|
1527
|
-
${(props) => props.$wide && import_styled_components5.css`
|
|
1528
|
-
margin-left: -2em;
|
|
1529
|
-
margin-right: -2em;
|
|
1530
|
-
width: auto;
|
|
1531
|
-
svg {
|
|
1532
|
-
height: 0.8em;
|
|
1533
|
-
vertical-align: baseline;
|
|
1534
|
-
}
|
|
1535
|
-
`}
|
|
1536
|
-
|
|
1537
|
-
${(props) => props.$margin && import_styled_components5.css`
|
|
1538
|
-
margin-bottom: 1em;
|
|
1539
|
-
`}
|
|
1540
|
-
|
|
1541
|
-
${(props) => props.$banner && import_styled_components5.css`
|
|
1542
|
-
border-radius: 5px;
|
|
1543
|
-
box-shadow: 0 3px 15px 0 rgb(0 0 0 / 16%);
|
|
1544
|
-
`}
|
|
1545
|
-
`;
|
|
1546
|
-
|
|
1547
|
-
// ../ui/madoc/components/callouts/ErrorMessage.tsx
|
|
1548
|
-
var ErrorMessage = (0, import_styled_components6.default)(BaseMessage)`
|
|
1549
|
-
background: #c74158;
|
|
1550
|
-
color: #fff;
|
|
1551
|
-
`;
|
|
1552
|
-
|
|
1553
1826
|
// src/Layout/components/PanelError.tsx
|
|
1554
|
-
var
|
|
1555
|
-
var
|
|
1827
|
+
var import_components3 = require("@manifest-editor/components");
|
|
1828
|
+
var import_react13 = require("react");
|
|
1829
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1556
1830
|
function PanelError(props) {
|
|
1557
1831
|
let error = props.error.toString();
|
|
1558
|
-
const [isFixing, setIsFixing] = (0,
|
|
1559
|
-
return /* @__PURE__ */ (0,
|
|
1560
|
-
/* @__PURE__ */ (0,
|
|
1561
|
-
/* @__PURE__ */ (0,
|
|
1832
|
+
const [isFixing, setIsFixing] = (0, import_react13.useState)(false);
|
|
1833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(PaddedSidebarContainer, { children: [
|
|
1834
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_components3.ErrorMessage, { className: "mb-2", children: error }),
|
|
1835
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CalltoButton, { onClick: props.resetErrorBoundary, children: "Try again" })
|
|
1562
1836
|
] });
|
|
1563
1837
|
}
|
|
1564
1838
|
|
|
1565
1839
|
// src/Layout/Layout.helpers.ts
|
|
1566
|
-
var
|
|
1840
|
+
var import_react14 = require("react");
|
|
1567
1841
|
function isPinnableState(t) {
|
|
1568
1842
|
return t && t.pinnable;
|
|
1569
1843
|
}
|
|
@@ -1576,7 +1850,7 @@ function panelSizing({
|
|
|
1576
1850
|
}
|
|
1577
1851
|
function renderHelper(htmlOrReact) {
|
|
1578
1852
|
if (typeof htmlOrReact === "string") {
|
|
1579
|
-
return (0,
|
|
1853
|
+
return (0, import_react14.createElement)("div", { dangerouslySetInnerHTML: { __html: htmlOrReact } });
|
|
1580
1854
|
}
|
|
1581
1855
|
return htmlOrReact;
|
|
1582
1856
|
}
|
|
@@ -1585,12 +1859,12 @@ function renderHelper(htmlOrReact) {
|
|
|
1585
1859
|
var import_react_iiif_vault4 = require("react-iiif-vault");
|
|
1586
1860
|
|
|
1587
1861
|
// ../ui/atoms/Dropdown.tsx
|
|
1588
|
-
var
|
|
1589
|
-
var Dropdown =
|
|
1862
|
+
var import_styled_components5 = __toESM(require("styled-components"), 1);
|
|
1863
|
+
var Dropdown = import_styled_components5.default.div`
|
|
1590
1864
|
position: relative;
|
|
1591
1865
|
display: inline-block;
|
|
1592
1866
|
`;
|
|
1593
|
-
var DropdownContent =
|
|
1867
|
+
var DropdownContent = import_styled_components5.default.div`
|
|
1594
1868
|
display: flex;
|
|
1595
1869
|
flex-direction: column;
|
|
1596
1870
|
position: absolute;
|
|
@@ -1606,7 +1880,7 @@ var DropdownContent = import_styled_components7.default.div`
|
|
|
1606
1880
|
}
|
|
1607
1881
|
}
|
|
1608
1882
|
`;
|
|
1609
|
-
var DropdownItem =
|
|
1883
|
+
var DropdownItem = import_styled_components5.default.button`
|
|
1610
1884
|
padding: 0 ${(props) => props.theme.padding.small || "0.5rem"};
|
|
1611
1885
|
color: ${(props) => props.theme.color.main || "none"};
|
|
1612
1886
|
background-color: ${(props) => props.theme.color.white || "white"};
|
|
@@ -1625,7 +1899,7 @@ var DropdownItem = import_styled_components7.default.button`
|
|
|
1625
1899
|
background-color: ${(props) => props.theme.color.lightgrey || "lightgrey"};
|
|
1626
1900
|
}
|
|
1627
1901
|
|
|
1628
|
-
${(props) => props.$active &&
|
|
1902
|
+
${(props) => props.$active && import_styled_components5.css`
|
|
1629
1903
|
background: #b84c74;
|
|
1630
1904
|
color: #fff;
|
|
1631
1905
|
&:hover {
|
|
@@ -1634,7 +1908,7 @@ var DropdownItem = import_styled_components7.default.button`
|
|
|
1634
1908
|
}
|
|
1635
1909
|
`}
|
|
1636
1910
|
`;
|
|
1637
|
-
var DropdownMenu =
|
|
1911
|
+
var DropdownMenu = import_styled_components5.default.div`
|
|
1638
1912
|
display: none;
|
|
1639
1913
|
flex-direction: column;
|
|
1640
1914
|
position: absolute;
|
|
@@ -1658,18 +1932,18 @@ var DropdownMenu = import_styled_components7.default.div`
|
|
|
1658
1932
|
}
|
|
1659
1933
|
}
|
|
1660
1934
|
|
|
1661
|
-
${(props) => props.$open &&
|
|
1935
|
+
${(props) => props.$open && import_styled_components5.css`
|
|
1662
1936
|
display: flex;
|
|
1663
1937
|
`}
|
|
1664
1938
|
`;
|
|
1665
|
-
var DropdownLabel =
|
|
1939
|
+
var DropdownLabel = import_styled_components5.default.div`
|
|
1666
1940
|
color: #999;
|
|
1667
1941
|
text-transform: uppercase;
|
|
1668
1942
|
font-weight: 600;
|
|
1669
1943
|
padding: 0.7em;
|
|
1670
1944
|
font-size: 0.875em;
|
|
1671
1945
|
`;
|
|
1672
|
-
var DropdownDivider =
|
|
1946
|
+
var DropdownDivider = import_styled_components5.default.div`
|
|
1673
1947
|
height: 1px;
|
|
1674
1948
|
margin: 0 0.5em;
|
|
1675
1949
|
background: #eee;
|
|
@@ -1682,12 +1956,12 @@ var import_react_accessible_dropdown_menu_hook2 = __toESM(require("react-accessi
|
|
|
1682
1956
|
var OverrideScrollbar = "ModularPanel_OverrideScrollbar";
|
|
1683
1957
|
|
|
1684
1958
|
// src/Layout/components/ModularPanel.tsx
|
|
1685
|
-
var
|
|
1686
|
-
var LayoutTitleReactContext = (0,
|
|
1959
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1960
|
+
var LayoutTitleReactContext = (0, import_react15.createContext)(null);
|
|
1687
1961
|
function useSetCustomTitle() {
|
|
1688
|
-
return (0,
|
|
1962
|
+
return (0, import_react15.useContext)(LayoutTitleReactContext);
|
|
1689
1963
|
}
|
|
1690
|
-
var ModularPanelWrapper =
|
|
1964
|
+
var ModularPanelWrapper = import_styled_components6.default.div`
|
|
1691
1965
|
display: flex;
|
|
1692
1966
|
flex-direction: column;
|
|
1693
1967
|
position: relative;
|
|
@@ -1740,7 +2014,7 @@ var ModularPanelWrapper = import_styled_components8.default.div`
|
|
|
1740
2014
|
transform: translateX(100%);
|
|
1741
2015
|
}
|
|
1742
2016
|
`;
|
|
1743
|
-
var ModularPanelHeader =
|
|
2017
|
+
var ModularPanelHeader = import_styled_components6.default.div`
|
|
1744
2018
|
background: #fff;
|
|
1745
2019
|
display: flex;
|
|
1746
2020
|
height: 2.8em;
|
|
@@ -1763,7 +2037,7 @@ var ModularPanelHeader = import_styled_components8.default.div`
|
|
|
1763
2037
|
box-shadow: inset 0 -5px 10px 0 rgba(255, 255, 255, 0.5);
|
|
1764
2038
|
}
|
|
1765
2039
|
`;
|
|
1766
|
-
var ModulePanelButton =
|
|
2040
|
+
var ModulePanelButton = import_styled_components6.default.button`
|
|
1767
2041
|
border: none;
|
|
1768
2042
|
background: transparent;
|
|
1769
2043
|
padding: 0 0.4em;
|
|
@@ -1776,17 +2050,17 @@ var ModulePanelButton = import_styled_components8.default.button`
|
|
|
1776
2050
|
font-size: 1.2em;
|
|
1777
2051
|
}
|
|
1778
2052
|
`;
|
|
1779
|
-
var ModulePanelSpacer =
|
|
2053
|
+
var ModulePanelSpacer = import_styled_components6.default.div`
|
|
1780
2054
|
flex: 1 1 0px;
|
|
1781
2055
|
`;
|
|
1782
|
-
var ModularPanelLabel =
|
|
2056
|
+
var ModularPanelLabel = import_styled_components6.default.h2`
|
|
1783
2057
|
font-size: 0.875em;
|
|
1784
2058
|
flex: 1 1 0px;
|
|
1785
2059
|
padding-left: 1em;
|
|
1786
2060
|
text-align: center;
|
|
1787
2061
|
align-self: center;
|
|
1788
2062
|
`;
|
|
1789
|
-
var ModularPanelContent =
|
|
2063
|
+
var ModularPanelContent = import_styled_components6.default.div`
|
|
1790
2064
|
flex: 1 1 0px;
|
|
1791
2065
|
display: flex;
|
|
1792
2066
|
|
|
@@ -1810,32 +2084,32 @@ function ModularPanel({
|
|
|
1810
2084
|
style,
|
|
1811
2085
|
noHeader
|
|
1812
2086
|
}) {
|
|
1813
|
-
const vault = (0,
|
|
1814
|
-
const [didError, setDidError] = (0,
|
|
2087
|
+
const vault = (0, import_react15.useContext)(import_react_iiif_vault4.ReactVaultContext) || null;
|
|
2088
|
+
const [didError, setDidError] = (0, import_react15.useState)(false);
|
|
1815
2089
|
const appState = useAppState();
|
|
1816
2090
|
const layout = useLayoutProvider();
|
|
1817
2091
|
const { tabs, pinnable, hideHeader } = panel?.options || {};
|
|
1818
2092
|
const resetKeys = [appState.state.canvasId, panel?.id];
|
|
1819
|
-
const switchablePanels = (0,
|
|
2093
|
+
const switchablePanels = (0, import_react15.useMemo)(() => {
|
|
1820
2094
|
return (available || []).filter((p) => !p.requiresState);
|
|
1821
2095
|
}, [available]);
|
|
1822
2096
|
const { itemProps, isOpen, setIsOpen } = (0, import_react_accessible_dropdown_menu_hook2.default)(switchablePanels.length);
|
|
1823
|
-
const [customTitle, setCustomTitle] = (0,
|
|
1824
|
-
const setCustomTitleRef = (0,
|
|
1825
|
-
(0,
|
|
1826
|
-
(0,
|
|
1827
|
-
(0,
|
|
2097
|
+
const [customTitle, setCustomTitle] = (0, import_react15.useState)("");
|
|
2098
|
+
const setCustomTitleRef = (0, import_react15.useRef)();
|
|
2099
|
+
(0, import_react15.useEffect)(() => setDidError(false), resetKeys);
|
|
2100
|
+
(0, import_react15.useEffect)(() => setCustomTitle(""), [panel]);
|
|
2101
|
+
(0, import_react15.useEffect)(() => {
|
|
1828
2102
|
setCustomTitleRef.current = setCustomTitle;
|
|
1829
2103
|
return () => {
|
|
1830
2104
|
setCustomTitleRef.current = void 0;
|
|
1831
2105
|
};
|
|
1832
2106
|
}, []);
|
|
1833
|
-
const _setCustomTitle = (0,
|
|
2107
|
+
const _setCustomTitle = (0, import_react15.useCallback)((title) => {
|
|
1834
2108
|
if (setCustomTitleRef.current) {
|
|
1835
2109
|
setCustomTitleRef.current(title);
|
|
1836
2110
|
}
|
|
1837
2111
|
}, []);
|
|
1838
|
-
const backAction = (0,
|
|
2112
|
+
const backAction = (0, import_react15.useCallback)(
|
|
1839
2113
|
(e) => {
|
|
1840
2114
|
const originalCallback = panel ? state.stack.length ? actions.popStack : panel.backAction ? () => panel && panel.backAction && panel.backAction(state, { ...layout, current: actions }, appState) : null : null;
|
|
1841
2115
|
if (e && (!originalCallback || e.metaKey) && switchablePanels.length) {
|
|
@@ -1857,16 +2131,16 @@ function ModularPanel({
|
|
|
1857
2131
|
if (!panel || !state.current) {
|
|
1858
2132
|
return null;
|
|
1859
2133
|
}
|
|
1860
|
-
const backButton = panel.backAction || state.stack.length ? /* @__PURE__ */ (0,
|
|
1861
|
-
const closeButton = /* @__PURE__ */ (0,
|
|
1862
|
-
return /* @__PURE__ */ (0,
|
|
1863
|
-
noHeader ? null : /* @__PURE__ */ (0,
|
|
1864
|
-
/* @__PURE__ */ (0,
|
|
2134
|
+
const backButton = panel.backAction || state.stack.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModulePanelButton, { onClick: backAction, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BackIcon, {}) }) : null;
|
|
2135
|
+
const closeButton = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModulePanelButton, { onClick: close || actions.close, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CloseIcon, {}) });
|
|
2136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LayoutTitleReactContext.Provider, { value: _setCustomTitle, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(ModularPanelWrapper, { "data-state": transition, "data-flipped": isLeft, style, "data-header": !noHeader, children: [
|
|
2137
|
+
noHeader ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(ModularPanelHeader, { "data-tabs": !!tabs, "data-error": didError, children: [
|
|
2138
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Dropdown, { style: { display: "flex", height: "100%" }, children: [
|
|
1865
2139
|
panel.renderBackAction ? panel.renderBackAction({ backAction, fallback: backButton }) : backButton,
|
|
1866
|
-
switchablePanels.length ? /* @__PURE__ */ (0,
|
|
1867
|
-
/* @__PURE__ */ (0,
|
|
1868
|
-
/* @__PURE__ */ (0,
|
|
1869
|
-
switchablePanels.map((newPanel, i) => /* @__PURE__ */ (0,
|
|
2140
|
+
switchablePanels.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(DropdownMenu, { $open: isOpen, style: { left: "0.5em" }, children: [
|
|
2141
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DropdownLabel, { children: "All panels" }),
|
|
2142
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DropdownDivider, {}),
|
|
2143
|
+
switchablePanels.map((newPanel, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1870
2144
|
DropdownItem,
|
|
1871
2145
|
{
|
|
1872
2146
|
...itemProps[i],
|
|
@@ -1878,11 +2152,11 @@ function ModularPanel({
|
|
|
1878
2152
|
))
|
|
1879
2153
|
] }) : null
|
|
1880
2154
|
] }),
|
|
1881
|
-
customTitle ? /* @__PURE__ */ (0,
|
|
1882
|
-
pinnable ? state.pinned ? /* @__PURE__ */ (0,
|
|
2155
|
+
customTitle ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModularPanelLabel, { children: customTitle }) : hideHeader ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModulePanelSpacer, {}) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModularPanelLabel, { children: panel.label }),
|
|
2156
|
+
pinnable ? state.pinned ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModulePanelButton, { onClick: pinActions.unpin, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(StarIcon, { fill: "orange" }) }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModulePanelButton, { onClick: () => pinActions.pin({ id: panel.id, state: state.state }), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(StarIcon, { fill: "#ddd" }) }) : null,
|
|
1883
2157
|
panel.renderCloseAction ? panel.renderCloseAction({ closeAction: close || actions.close, fallback: closeButton }) : closeButton
|
|
1884
2158
|
] }),
|
|
1885
|
-
/* @__PURE__ */ (0,
|
|
2159
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModularPanelContent, { className: OverrideScrollbar, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1886
2160
|
import_react_error_boundary.ErrorBoundary,
|
|
1887
2161
|
{
|
|
1888
2162
|
onError: () => setDidError(true),
|
|
@@ -1901,14 +2175,189 @@ function ModularPanel({
|
|
|
1901
2175
|
] }) });
|
|
1902
2176
|
}
|
|
1903
2177
|
|
|
2178
|
+
// src/highlighted-image-resources.ts
|
|
2179
|
+
var import_zustand = require("zustand");
|
|
2180
|
+
var import_react16 = require("react");
|
|
2181
|
+
|
|
2182
|
+
// src/helpers.ts
|
|
2183
|
+
var import_parser = require("@iiif/parser");
|
|
2184
|
+
async function getManifestNomalized(id) {
|
|
2185
|
+
let responseData = void 0;
|
|
2186
|
+
try {
|
|
2187
|
+
await fetch(id).then((response) => {
|
|
2188
|
+
return response.json().catch((err) => {
|
|
2189
|
+
console.error(`'${err}' happened!`);
|
|
2190
|
+
});
|
|
2191
|
+
}).then((data) => {
|
|
2192
|
+
responseData = { ...data };
|
|
2193
|
+
});
|
|
2194
|
+
} catch (error) {
|
|
2195
|
+
console.log(error);
|
|
2196
|
+
}
|
|
2197
|
+
return responseData;
|
|
2198
|
+
}
|
|
2199
|
+
function createActionIdentity(type, property, parent) {
|
|
2200
|
+
return `create_${type}_${property}_${(0, import_parser.toRef)(parent)?.type || "unknown"}`;
|
|
2201
|
+
}
|
|
2202
|
+
function createDownload(data, fileName, fileType = "text/json") {
|
|
2203
|
+
const blob = data instanceof Blob ? data : new Blob([data], { type: fileType });
|
|
2204
|
+
const a = document.createElement("a");
|
|
2205
|
+
a.download = fileName;
|
|
2206
|
+
a.href = window.URL.createObjectURL(blob);
|
|
2207
|
+
const clickEvt = new MouseEvent("click", {
|
|
2208
|
+
view: window,
|
|
2209
|
+
bubbles: true,
|
|
2210
|
+
cancelable: true
|
|
2211
|
+
});
|
|
2212
|
+
a.dispatchEvent(clickEvt);
|
|
2213
|
+
a.remove();
|
|
2214
|
+
}
|
|
2215
|
+
async function copyToClipboard(json) {
|
|
2216
|
+
return navigator.clipboard.writeText(
|
|
2217
|
+
typeof json === "string" ? json : JSON.stringify(json, null, 2)
|
|
2218
|
+
);
|
|
2219
|
+
}
|
|
2220
|
+
function randomId() {
|
|
2221
|
+
return `${Math.random().toString(36).substr(2)}-${Date.now().toString(36)}`;
|
|
2222
|
+
}
|
|
2223
|
+
function mapApp(input, map) {
|
|
2224
|
+
const { default: metadata, ...props } = input;
|
|
2225
|
+
const app = {
|
|
2226
|
+
metadata,
|
|
2227
|
+
layout: {
|
|
2228
|
+
leftPanels: [],
|
|
2229
|
+
rightPanels: [],
|
|
2230
|
+
centerPanels: [],
|
|
2231
|
+
...props
|
|
2232
|
+
}
|
|
2233
|
+
};
|
|
2234
|
+
return map ? map(app) : app;
|
|
2235
|
+
}
|
|
2236
|
+
function extendApp(app, metadata, extensions) {
|
|
2237
|
+
return {
|
|
2238
|
+
...app,
|
|
2239
|
+
metadata,
|
|
2240
|
+
config: {
|
|
2241
|
+
...app.config || {},
|
|
2242
|
+
...extensions.config || {}
|
|
2243
|
+
},
|
|
2244
|
+
layout: {
|
|
2245
|
+
...app.layout,
|
|
2246
|
+
leftPanels: [
|
|
2247
|
+
...(app.layout.leftPanels || []).filter((panel) => {
|
|
2248
|
+
if (extensions?.leftPanelIds) {
|
|
2249
|
+
return extensions.leftPanelIds.includes(panel.id);
|
|
2250
|
+
}
|
|
2251
|
+
return true;
|
|
2252
|
+
}),
|
|
2253
|
+
...extensions?.leftPanels || []
|
|
2254
|
+
],
|
|
2255
|
+
annotations: [
|
|
2256
|
+
...extensions?.annotations || [],
|
|
2257
|
+
...app.layout.annotations || []
|
|
2258
|
+
],
|
|
2259
|
+
canvasEditors: [
|
|
2260
|
+
...extensions?.canvasEditors || [],
|
|
2261
|
+
...app.layout.canvasEditors || []
|
|
2262
|
+
],
|
|
2263
|
+
creators: [
|
|
2264
|
+
...extensions?.creators || [],
|
|
2265
|
+
...app.layout.creators || []
|
|
2266
|
+
],
|
|
2267
|
+
editors: [
|
|
2268
|
+
//
|
|
2269
|
+
...extensions?.editors || [],
|
|
2270
|
+
...app.layout.editors || []
|
|
2271
|
+
],
|
|
2272
|
+
rightPanels: [
|
|
2273
|
+
...app.layout.rightPanels || [],
|
|
2274
|
+
...extensions?.rightPanels || []
|
|
2275
|
+
],
|
|
2276
|
+
centerPanels: [
|
|
2277
|
+
...app.layout.centerPanels || [],
|
|
2278
|
+
...extensions?.centerPanels || []
|
|
2279
|
+
],
|
|
2280
|
+
modals: [
|
|
2281
|
+
...app.layout.modals || [],
|
|
2282
|
+
...extensions?.modalPanels || []
|
|
2283
|
+
]
|
|
2284
|
+
}
|
|
2285
|
+
};
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
// src/highlighted-image-resources.ts
|
|
2289
|
+
var useHighlightedImageResource = (0, import_zustand.create)((set) => ({
|
|
2290
|
+
regions: {},
|
|
2291
|
+
resources: [],
|
|
2292
|
+
setRegion: (id, region) => {
|
|
2293
|
+
set((ex) => ({ ...ex.regions, regions: { [id]: region || null } }));
|
|
2294
|
+
},
|
|
2295
|
+
setHighlight: (id) => {
|
|
2296
|
+
set({ resources: Array.isArray(id) ? id : [id] });
|
|
2297
|
+
},
|
|
2298
|
+
highlight: (id) => {
|
|
2299
|
+
set((s) => {
|
|
2300
|
+
if (s.resources.indexOf(id) !== -1) {
|
|
2301
|
+
return s;
|
|
2302
|
+
}
|
|
2303
|
+
return { resources: [...s.resources, id] };
|
|
2304
|
+
});
|
|
2305
|
+
},
|
|
2306
|
+
clearHighlight: (id) => {
|
|
2307
|
+
set((s) => ({ resources: s.resources.filter((item) => item !== id) }));
|
|
2308
|
+
}
|
|
2309
|
+
}));
|
|
2310
|
+
function useTemporaryHighlight(newValue) {
|
|
2311
|
+
const id = (0, import_react16.useMemo)(() => randomId(), []);
|
|
2312
|
+
const value = useHighlightedImageResource((s) => s.regions[id]);
|
|
2313
|
+
const setRegion = useHighlightedImageResource((s) => s.setRegion);
|
|
2314
|
+
(0, import_react16.useEffect)(() => {
|
|
2315
|
+
if (value && newValue) {
|
|
2316
|
+
if (value !== newValue && (value.x !== newValue.x || value.y !== newValue.y || value.width !== newValue.width || value.height !== newValue.height)) {
|
|
2317
|
+
setRegion(id, newValue || null);
|
|
2318
|
+
}
|
|
2319
|
+
} else {
|
|
2320
|
+
setRegion(id, newValue || null);
|
|
2321
|
+
}
|
|
2322
|
+
}, [value]);
|
|
2323
|
+
(0, import_react16.useEffect)(() => {
|
|
2324
|
+
return () => setRegion(id, null);
|
|
2325
|
+
}, []);
|
|
2326
|
+
}
|
|
2327
|
+
function useHoverHighlightImageResource(id) {
|
|
2328
|
+
const highlight = useHighlightedImageResource((s) => s.highlight);
|
|
2329
|
+
const clear = useHighlightedImageResource((s) => s.clearHighlight);
|
|
2330
|
+
(0, import_react16.useEffect)(() => {
|
|
2331
|
+
return () => {
|
|
2332
|
+
if (id) {
|
|
2333
|
+
clear(id);
|
|
2334
|
+
}
|
|
2335
|
+
};
|
|
2336
|
+
}, [clear, id]);
|
|
2337
|
+
return (0, import_react16.useMemo)(() => {
|
|
2338
|
+
return {
|
|
2339
|
+
onMouseEnter() {
|
|
2340
|
+
if (id) {
|
|
2341
|
+
highlight(id);
|
|
2342
|
+
}
|
|
2343
|
+
},
|
|
2344
|
+
onMouseLeave() {
|
|
2345
|
+
if (id) {
|
|
2346
|
+
clear(id);
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
};
|
|
2350
|
+
}, [id, highlight, clear]);
|
|
2351
|
+
}
|
|
2352
|
+
|
|
1904
2353
|
// src/BaseCreator/BaseCreator.hooks.tsx
|
|
2354
|
+
var import_parser2 = require("@iiif/parser");
|
|
1905
2355
|
var import_creator_api = require("@manifest-editor/creator-api");
|
|
1906
|
-
var
|
|
2356
|
+
var import_react18 = require("react");
|
|
1907
2357
|
var import_react_iiif_vault6 = require("react-iiif-vault");
|
|
1908
|
-
var import_parser2 = require("@iiif/parser");
|
|
1909
2358
|
|
|
1910
2359
|
// src/PreviewVault/PreviewVault.tsx
|
|
1911
|
-
var
|
|
2360
|
+
var import_react17 = require("react");
|
|
1912
2361
|
var import_vault2 = require("@iiif/helpers/vault");
|
|
1913
2362
|
var import_react_iiif_vault5 = require("react-iiif-vault");
|
|
1914
2363
|
|
|
@@ -1998,12 +2447,12 @@ function createPreviewVault(homepageCollectionId = "vault://homepage-collection.
|
|
|
1998
2447
|
}
|
|
1999
2448
|
|
|
2000
2449
|
// src/PreviewVault/PreviewVault.tsx
|
|
2001
|
-
var
|
|
2450
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2002
2451
|
function usePreviewVault() {
|
|
2003
|
-
return (0,
|
|
2452
|
+
return (0, import_react17.useContext)(PreviewVaultReactContext);
|
|
2004
2453
|
}
|
|
2005
|
-
var PreviewVaultReactContext = (0,
|
|
2006
|
-
var PreviewVaultAddHistory = (0,
|
|
2454
|
+
var PreviewVaultReactContext = (0, import_react17.createContext)(new import_vault2.Vault());
|
|
2455
|
+
var PreviewVaultAddHistory = (0, import_react17.createContext)({
|
|
2007
2456
|
addHistory: (id, type) => {
|
|
2008
2457
|
},
|
|
2009
2458
|
clearHistory: () => {
|
|
@@ -2011,118 +2460,127 @@ var PreviewVaultAddHistory = (0, import_react15.createContext)({
|
|
|
2011
2460
|
});
|
|
2012
2461
|
var HOMEPAGE_COLLECTION = "manifest-editor://homepage-collection.json";
|
|
2013
2462
|
function usePreviewHistory() {
|
|
2014
|
-
return (0,
|
|
2463
|
+
return (0, import_react17.useContext)(PreviewVaultAddHistory);
|
|
2015
2464
|
}
|
|
2016
2465
|
function PreviewVaultContext(props) {
|
|
2017
|
-
const { vault, unsubscribe, addHistory, clearHistory } = (0,
|
|
2466
|
+
const { vault, unsubscribe, addHistory, clearHistory } = (0, import_react17.useMemo)(() => {
|
|
2018
2467
|
return createPreviewVault(HOMEPAGE_COLLECTION);
|
|
2019
2468
|
}, []);
|
|
2020
|
-
(0,
|
|
2469
|
+
(0, import_react17.useEffect)(() => {
|
|
2021
2470
|
return unsubscribe;
|
|
2022
2471
|
}, []);
|
|
2023
|
-
return /* @__PURE__ */ (0,
|
|
2472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PreviewVaultAddHistory.Provider, { value: { addHistory, clearHistory }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PreviewVaultReactContext.Provider, { value: vault, children: props.children }) });
|
|
2024
2473
|
}
|
|
2025
2474
|
function PreviewVaultBoundary({ children }) {
|
|
2026
2475
|
const vault = usePreviewVault();
|
|
2027
|
-
return /* @__PURE__ */ (0,
|
|
2476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_iiif_vault5.VaultProvider, { vault, children });
|
|
2028
2477
|
}
|
|
2029
2478
|
|
|
2030
2479
|
// src/BaseCreator/BaseCreator.hooks.tsx
|
|
2031
|
-
function matchBasedOnResource(resource, list, options) {
|
|
2032
|
-
const supported = [];
|
|
2033
|
-
if (list.length === 0) {
|
|
2034
|
-
return [];
|
|
2035
|
-
}
|
|
2036
|
-
const parent = (0, import_parser2.toRef)(resource.parent);
|
|
2037
|
-
const property = resource.property;
|
|
2038
|
-
for (const def of list) {
|
|
2039
|
-
if (parent && property) {
|
|
2040
|
-
if (def.supports.parentTypes) {
|
|
2041
|
-
if (!def.supports.parentTypes.includes(parent.type)) {
|
|
2042
|
-
continue;
|
|
2043
|
-
}
|
|
2044
|
-
}
|
|
2045
|
-
if (def.supports.parentFields) {
|
|
2046
|
-
if (!def.supports.parentFields.includes(property)) {
|
|
2047
|
-
continue;
|
|
2048
|
-
}
|
|
2049
|
-
}
|
|
2050
|
-
if (def.supports.parentFieldMap) {
|
|
2051
|
-
const type = def.supports.parentFieldMap[parent.type];
|
|
2052
|
-
if (!type || !type.includes(property)) {
|
|
2053
|
-
continue;
|
|
2054
|
-
}
|
|
2055
|
-
}
|
|
2056
|
-
if (def.supports.disallowPainting && resource.isPainting) {
|
|
2057
|
-
continue;
|
|
2058
|
-
}
|
|
2059
|
-
if (def.supports.custom) {
|
|
2060
|
-
const isValid = def.supports.custom({ property, resource: parent, atIndex: resource.index }, options.vault);
|
|
2061
|
-
if (!isValid) {
|
|
2062
|
-
continue;
|
|
2063
|
-
}
|
|
2064
|
-
}
|
|
2065
|
-
if (!def.supports.initialData && Object.keys(resource.initialData || {}).length !== 0) {
|
|
2066
|
-
continue;
|
|
2067
|
-
}
|
|
2068
|
-
if (def.resourceType !== resource.type) {
|
|
2069
|
-
if (!(def.additionalTypes || []).includes(resource.type)) {
|
|
2070
|
-
continue;
|
|
2071
|
-
}
|
|
2072
|
-
}
|
|
2073
|
-
supported.push(def);
|
|
2074
|
-
}
|
|
2075
|
-
}
|
|
2076
|
-
return supported;
|
|
2077
|
-
}
|
|
2078
2480
|
function useCreator(parent, property, type, target, options) {
|
|
2079
2481
|
const vault = (0, import_react_iiif_vault6.useVault)();
|
|
2080
2482
|
const app = useApp();
|
|
2081
2483
|
const { create: create2, edit } = useLayoutActions();
|
|
2082
|
-
const supported = (0,
|
|
2083
|
-
() =>
|
|
2484
|
+
const supported = (0, import_react18.useMemo)(
|
|
2485
|
+
() => (0, import_creator_api.matchBasedOnResource)(
|
|
2486
|
+
{ type, parent, index: 0, property },
|
|
2487
|
+
app.layout.creators || [],
|
|
2488
|
+
{ vault }
|
|
2489
|
+
),
|
|
2084
2490
|
[parent, property, app.layout.creators, type, vault]
|
|
2085
2491
|
);
|
|
2086
2492
|
const canCreate = parent && supported.length !== 0;
|
|
2087
|
-
const wrappedCreate = (0,
|
|
2493
|
+
const wrappedCreate = (0, import_react18.useCallback)(
|
|
2088
2494
|
(index, initialData) => {
|
|
2089
2495
|
if (parent) {
|
|
2090
|
-
create2({
|
|
2496
|
+
create2({
|
|
2497
|
+
type,
|
|
2498
|
+
parent: (0, import_parser2.toRef)(parent),
|
|
2499
|
+
property,
|
|
2500
|
+
index,
|
|
2501
|
+
target,
|
|
2502
|
+
initialData,
|
|
2503
|
+
...options || {}
|
|
2504
|
+
});
|
|
2505
|
+
}
|
|
2506
|
+
},
|
|
2507
|
+
[create2, parent, property, type, options, target]
|
|
2508
|
+
);
|
|
2509
|
+
const wrappedFilteredCreate = (0, import_react18.useCallback)(
|
|
2510
|
+
(filter, index, initialData) => {
|
|
2511
|
+
if (parent) {
|
|
2512
|
+
create2({
|
|
2513
|
+
type,
|
|
2514
|
+
filter,
|
|
2515
|
+
parent: (0, import_parser2.toRef)(parent),
|
|
2516
|
+
property,
|
|
2517
|
+
index,
|
|
2518
|
+
target,
|
|
2519
|
+
initialData,
|
|
2520
|
+
...options || {}
|
|
2521
|
+
});
|
|
2091
2522
|
}
|
|
2092
2523
|
},
|
|
2093
|
-
[create2, parent, property, type]
|
|
2524
|
+
[create2, parent, property, type, options, target]
|
|
2094
2525
|
);
|
|
2095
|
-
const wrappedEdit = (0,
|
|
2526
|
+
const wrappedEdit = (0, import_react18.useCallback)(
|
|
2096
2527
|
(resource, index) => {
|
|
2097
|
-
edit(
|
|
2528
|
+
edit(
|
|
2529
|
+
resource,
|
|
2530
|
+
parent ? { parent: (0, import_parser2.toRef)(parent), property, index } : void 0
|
|
2531
|
+
);
|
|
2532
|
+
},
|
|
2533
|
+
[edit, parent, property]
|
|
2534
|
+
);
|
|
2535
|
+
const wrappedCreator = (0, import_react18.useCallback)(
|
|
2536
|
+
(initialCreator, initialData) => {
|
|
2537
|
+
if (parent) {
|
|
2538
|
+
create2({
|
|
2539
|
+
type,
|
|
2540
|
+
initialCreator,
|
|
2541
|
+
parent: (0, import_parser2.toRef)(parent),
|
|
2542
|
+
property,
|
|
2543
|
+
target,
|
|
2544
|
+
initialData,
|
|
2545
|
+
...options || {}
|
|
2546
|
+
});
|
|
2547
|
+
}
|
|
2098
2548
|
},
|
|
2099
|
-
[
|
|
2549
|
+
[type, property, parent, target, create2, options]
|
|
2100
2550
|
);
|
|
2101
|
-
const buttonProps = (0,
|
|
2551
|
+
const buttonProps = (0, import_react18.useMemo)(() => {
|
|
2102
2552
|
return {
|
|
2103
2553
|
"data-action-id": createActionIdentity(type, property, parent)
|
|
2104
2554
|
};
|
|
2105
|
-
}, []);
|
|
2106
|
-
return [
|
|
2555
|
+
}, [type, property, parent]);
|
|
2556
|
+
return [
|
|
2557
|
+
canCreate,
|
|
2558
|
+
{
|
|
2559
|
+
create: wrappedCreate,
|
|
2560
|
+
edit: wrappedEdit,
|
|
2561
|
+
createFiltered: wrappedFilteredCreate,
|
|
2562
|
+
creator: wrappedCreator,
|
|
2563
|
+
buttonProps
|
|
2564
|
+
}
|
|
2565
|
+
];
|
|
2107
2566
|
}
|
|
2108
2567
|
function useInlineCreator() {
|
|
2109
2568
|
const vault = (0, import_react_iiif_vault6.useVault)();
|
|
2110
2569
|
const previewVault = usePreviewVault();
|
|
2111
2570
|
const app = useApp();
|
|
2112
|
-
return (0,
|
|
2571
|
+
return (0, import_react18.useMemo)(() => {
|
|
2113
2572
|
return new import_creator_api.Creator(vault, app.layout.creators || [], previewVault);
|
|
2114
2573
|
}, [app.layout.creators, vault]);
|
|
2115
2574
|
}
|
|
2116
2575
|
|
|
2117
2576
|
// src/BaseCreator/BaseCreator.tsx
|
|
2118
|
-
var
|
|
2119
|
-
var
|
|
2120
|
-
var RenderCreator = (0, import_react17.memo)(function RenderCreator2(props) {
|
|
2577
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2578
|
+
var RenderCreator = (0, import_react19.memo)(function RenderCreator2(props) {
|
|
2121
2579
|
const vault = (0, import_react_iiif_vault7.useVault)();
|
|
2122
2580
|
const { edit, modal } = useLayoutActions();
|
|
2123
|
-
const [isCreating, setIsCreating] = (0,
|
|
2581
|
+
const [isCreating, setIsCreating] = (0, import_react19.useState)(false);
|
|
2124
2582
|
const creator = useInlineCreator();
|
|
2125
|
-
const isCreatingRef = (0,
|
|
2583
|
+
const isCreatingRef = (0, import_react19.useRef)(false);
|
|
2126
2584
|
const canvasSelector = props.resource.initialData?.selector;
|
|
2127
2585
|
useTemporaryHighlight(canvasSelector);
|
|
2128
2586
|
const options = {
|
|
@@ -2152,12 +2610,12 @@ var RenderCreator = (0, import_react17.memo)(function RenderCreator2(props) {
|
|
|
2152
2610
|
const validate = async () => {
|
|
2153
2611
|
return true;
|
|
2154
2612
|
};
|
|
2155
|
-
(0,
|
|
2613
|
+
(0, import_react19.useEffect)(() => {
|
|
2156
2614
|
if (!props.creator.render && !isCreating) {
|
|
2157
2615
|
runCreate({});
|
|
2158
2616
|
}
|
|
2159
2617
|
}, [props.creator]);
|
|
2160
|
-
(0,
|
|
2618
|
+
(0, import_react19.useEffect)(() => {
|
|
2161
2619
|
if (isCreating) {
|
|
2162
2620
|
modal.popStack();
|
|
2163
2621
|
modal.close();
|
|
@@ -2167,9 +2625,9 @@ var RenderCreator = (0, import_react17.memo)(function RenderCreator2(props) {
|
|
|
2167
2625
|
return null;
|
|
2168
2626
|
}
|
|
2169
2627
|
if (!props.creator.render) {
|
|
2170
|
-
return /* @__PURE__ */ (0,
|
|
2628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { onClick: () => runCreate({}), children: "Create" }) });
|
|
2171
2629
|
}
|
|
2172
|
-
return /* @__PURE__ */ (0,
|
|
2630
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react19.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Spinner, {}), children: props.creator.render({
|
|
2173
2631
|
vault,
|
|
2174
2632
|
runCreate,
|
|
2175
2633
|
validate,
|
|
@@ -2179,32 +2637,40 @@ var RenderCreator = (0, import_react17.memo)(function RenderCreator2(props) {
|
|
|
2179
2637
|
function BaseCreator(props) {
|
|
2180
2638
|
const app = useApp();
|
|
2181
2639
|
const vault = (0, import_react_iiif_vault7.useVault)();
|
|
2182
|
-
const [currentId, setCurrentId] = (0,
|
|
2640
|
+
const [currentId, setCurrentId] = (0, import_react19.useState)(
|
|
2641
|
+
props.resource.initialCreator || ""
|
|
2642
|
+
);
|
|
2183
2643
|
const set = useSetCustomTitle();
|
|
2184
|
-
const supported = (0,
|
|
2185
|
-
() => matchBasedOnResource(props.resource, app.layout.creators || [], {
|
|
2644
|
+
const supported = (0, import_react19.useMemo)(
|
|
2645
|
+
() => (0, import_creator_api2.matchBasedOnResource)(props.resource, app.layout.creators || [], {
|
|
2646
|
+
vault
|
|
2647
|
+
}),
|
|
2186
2648
|
[props.resource, app.layout.creators, vault]
|
|
2187
2649
|
);
|
|
2188
2650
|
if (supported.length === 1 && !currentId) {
|
|
2189
2651
|
setCurrentId(supported[0].id);
|
|
2190
2652
|
}
|
|
2191
2653
|
const current = supported.find((t) => t.id === currentId);
|
|
2192
|
-
(0,
|
|
2654
|
+
(0, import_react19.useEffect)(() => {
|
|
2193
2655
|
if (current) {
|
|
2194
|
-
set
|
|
2656
|
+
set?.(current.label);
|
|
2195
2657
|
}
|
|
2196
2658
|
});
|
|
2197
2659
|
if (supported.length === 0) {
|
|
2198
|
-
return /* @__PURE__ */ (0,
|
|
2660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: "Not currently supported" });
|
|
2199
2661
|
}
|
|
2200
2662
|
if (current) {
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2663
|
+
const shouldHideModal = current.hiddenModal;
|
|
2664
|
+
if (shouldHideModal) {
|
|
2665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RenderCreator, { creator: current, resource: props.resource });
|
|
2666
|
+
}
|
|
2667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
|
|
2668
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "bg-me-gray-100 p-2", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { onClick: () => setCurrentId(""), children: "Back" }) }),
|
|
2669
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "p-2 py-6", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RenderCreator, { creator: current, resource: props.resource }) })
|
|
2204
2670
|
] });
|
|
2205
2671
|
}
|
|
2206
|
-
return /* @__PURE__ */ (0,
|
|
2207
|
-
|
|
2672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2673
|
+
import_components4.CreatorGrid,
|
|
2208
2674
|
{
|
|
2209
2675
|
label: "Select a type",
|
|
2210
2676
|
items: supported.map((item) => ({
|
|
@@ -2219,22 +2685,23 @@ function BaseCreator(props) {
|
|
|
2219
2685
|
}
|
|
2220
2686
|
|
|
2221
2687
|
// src/BaseCreator/index.tsx
|
|
2222
|
-
var
|
|
2688
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2223
2689
|
var baseCreator = {
|
|
2224
2690
|
id: "@manifest-editor/creator",
|
|
2225
2691
|
label: "Add content",
|
|
2226
2692
|
options: { hideHeader: true, tabs: false },
|
|
2227
2693
|
render(state) {
|
|
2228
|
-
return /* @__PURE__ */ (0,
|
|
2694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(BaseCreator, { resource: state });
|
|
2229
2695
|
}
|
|
2230
2696
|
};
|
|
2231
2697
|
|
|
2232
2698
|
// src/BaseEditor/BaseEditor.tsx
|
|
2233
|
-
var
|
|
2699
|
+
var import_components5 = require("@manifest-editor/components");
|
|
2700
|
+
var import_react21 = require("react");
|
|
2234
2701
|
var import_react_iiif_vault9 = require("react-iiif-vault");
|
|
2235
2702
|
|
|
2236
2703
|
// src/EditingStack/EditingStack.tsx
|
|
2237
|
-
var
|
|
2704
|
+
var import_react20 = require("react");
|
|
2238
2705
|
|
|
2239
2706
|
// src/EditingStack/EditingStack.reducer.ts
|
|
2240
2707
|
var import_parser4 = require("@iiif/parser");
|
|
@@ -2331,10 +2798,10 @@ function filterStack(newStackWithDuplicates, current) {
|
|
|
2331
2798
|
var import_editor_api = require("@manifest-editor/editor-api");
|
|
2332
2799
|
var import_react_iiif_vault8 = require("react-iiif-vault");
|
|
2333
2800
|
var import_parser5 = require("@iiif/parser");
|
|
2334
|
-
var
|
|
2801
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2335
2802
|
var defaultState = { stack: [], current: null, create: null };
|
|
2336
|
-
var EditingStackContext = (0,
|
|
2337
|
-
var EditingStackActionsContext = (0,
|
|
2803
|
+
var EditingStackContext = (0, import_react20.createContext)(defaultState);
|
|
2804
|
+
var EditingStackActionsContext = (0, import_react20.createContext)({
|
|
2338
2805
|
edit() {
|
|
2339
2806
|
},
|
|
2340
2807
|
close() {
|
|
@@ -2349,29 +2816,29 @@ var EditingStackActionsContext = (0, import_react18.createContext)({
|
|
|
2349
2816
|
}
|
|
2350
2817
|
});
|
|
2351
2818
|
function useEditingStack() {
|
|
2352
|
-
return (0,
|
|
2819
|
+
return (0, import_react20.useContext)(EditingStackActionsContext);
|
|
2353
2820
|
}
|
|
2354
2821
|
function useEditingResource() {
|
|
2355
|
-
return (0,
|
|
2822
|
+
return (0, import_react20.useContext)(EditingStackContext).current;
|
|
2356
2823
|
}
|
|
2357
2824
|
function useEditingResourceStack() {
|
|
2358
|
-
return (0,
|
|
2825
|
+
return (0, import_react20.useContext)(EditingStackContext).stack;
|
|
2359
2826
|
}
|
|
2360
2827
|
function useCreatingResource() {
|
|
2361
|
-
return (0,
|
|
2828
|
+
return (0, import_react20.useContext)(EditingStackContext).create;
|
|
2362
2829
|
}
|
|
2363
2830
|
function useManifestEditor() {
|
|
2364
2831
|
const { manifest } = (0, import_react_iiif_vault8.useResourceContext)();
|
|
2365
2832
|
const vault = (0, import_react_iiif_vault8.useVault)();
|
|
2366
|
-
const [key, invalidate] = (0,
|
|
2833
|
+
const [key, invalidate] = (0, import_react20.useReducer)((i) => i + 1, 0);
|
|
2367
2834
|
invariant(manifest, "Manifest not found");
|
|
2368
|
-
const editor = (0,
|
|
2835
|
+
const editor = (0, import_react20.useMemo)(() => {
|
|
2369
2836
|
return new import_editor_api.EditorInstance({
|
|
2370
2837
|
reference: { id: manifest, type: "Manifest" },
|
|
2371
2838
|
vault
|
|
2372
2839
|
});
|
|
2373
2840
|
}, [manifest, vault]);
|
|
2374
|
-
(0,
|
|
2841
|
+
(0, import_react20.useEffect)(() => {
|
|
2375
2842
|
return editor.observe.start(invalidate);
|
|
2376
2843
|
}, [editor]);
|
|
2377
2844
|
editor.observe.key = `${key}`;
|
|
@@ -2381,15 +2848,15 @@ function useManifestEditor() {
|
|
|
2381
2848
|
function useCollectionEditor() {
|
|
2382
2849
|
const { collection } = (0, import_react_iiif_vault8.useResourceContext)();
|
|
2383
2850
|
const vault = (0, import_react_iiif_vault8.useVault)();
|
|
2384
|
-
const [key, invalidate] = (0,
|
|
2851
|
+
const [key, invalidate] = (0, import_react20.useReducer)((i) => i + 1, 0);
|
|
2385
2852
|
invariant(collection, "Collection not found");
|
|
2386
|
-
const editor = (0,
|
|
2853
|
+
const editor = (0, import_react20.useMemo)(() => {
|
|
2387
2854
|
return new import_editor_api.EditorInstance({
|
|
2388
2855
|
reference: { id: collection, type: "Collection" },
|
|
2389
2856
|
vault
|
|
2390
2857
|
});
|
|
2391
2858
|
}, [collection, vault]);
|
|
2392
|
-
(0,
|
|
2859
|
+
(0, import_react20.useEffect)(() => {
|
|
2393
2860
|
return editor.observe.start(invalidate);
|
|
2394
2861
|
}, [editor]);
|
|
2395
2862
|
editor.observe.key = `${key}`;
|
|
@@ -2398,16 +2865,16 @@ function useCollectionEditor() {
|
|
|
2398
2865
|
}
|
|
2399
2866
|
function useGenericEditor(ref, ctx = {}) {
|
|
2400
2867
|
const vault = (0, import_react_iiif_vault8.useVault)();
|
|
2401
|
-
const [key, invalidate] = (0,
|
|
2868
|
+
const [key, invalidate] = (0, import_react20.useReducer)((i) => i + 1, 0);
|
|
2402
2869
|
invariant(ref, "Resource not found");
|
|
2403
|
-
const editor = (0,
|
|
2870
|
+
const editor = (0, import_react20.useMemo)(() => {
|
|
2404
2871
|
return new import_editor_api.EditorInstance({
|
|
2405
2872
|
reference: (0, import_parser5.toRef)(ref),
|
|
2406
2873
|
vault,
|
|
2407
2874
|
context: { resource: ref, parent: ctx.parent, index: ctx.index, parentProperty: ctx.parentProperty }
|
|
2408
2875
|
});
|
|
2409
2876
|
}, [ref, vault]);
|
|
2410
|
-
(0,
|
|
2877
|
+
(0, import_react20.useEffect)(() => {
|
|
2411
2878
|
return editor.observe.start(invalidate);
|
|
2412
2879
|
}, [editor]);
|
|
2413
2880
|
editor.observe.key = `${key}`;
|
|
@@ -2422,15 +2889,15 @@ function useAnnotationPageEditor() {
|
|
|
2422
2889
|
function useEditor() {
|
|
2423
2890
|
const resource = useEditingResource();
|
|
2424
2891
|
const vault = (0, import_react_iiif_vault8.useVault)();
|
|
2425
|
-
const [key, invalidate] = (0,
|
|
2892
|
+
const [key, invalidate] = (0, import_react20.useReducer)((i) => i + 1, 0);
|
|
2426
2893
|
invariant(resource, "No resource selected");
|
|
2427
|
-
const editor = (0,
|
|
2894
|
+
const editor = (0, import_react20.useMemo)(() => {
|
|
2428
2895
|
return new import_editor_api.EditorInstance({
|
|
2429
2896
|
reference: resource.resource.source || resource.resource,
|
|
2430
2897
|
vault
|
|
2431
2898
|
});
|
|
2432
2899
|
}, [resource, vault]);
|
|
2433
|
-
(0,
|
|
2900
|
+
(0, import_react20.useEffect)(() => {
|
|
2434
2901
|
return editor.observe.start(invalidate);
|
|
2435
2902
|
}, [editor]);
|
|
2436
2903
|
editor.observe.key = `${key}`;
|
|
@@ -2439,11 +2906,11 @@ function useEditor() {
|
|
|
2439
2906
|
}
|
|
2440
2907
|
function EditingStack(props) {
|
|
2441
2908
|
const vault = (0, import_react_iiif_vault8.useVault)();
|
|
2442
|
-
const [state, _dispatch] = (0,
|
|
2443
|
-
const dispatch = (0,
|
|
2909
|
+
const [state, _dispatch] = (0, import_react20.useReducer)(editingStackReducer, defaultState);
|
|
2910
|
+
const dispatch = (0, import_react20.useCallback)((action) => {
|
|
2444
2911
|
_dispatch(action);
|
|
2445
2912
|
}, []);
|
|
2446
|
-
(0,
|
|
2913
|
+
(0, import_react20.useEffect)(() => {
|
|
2447
2914
|
return vault.on("@iiif/REMOVE_REFERENCE", (payload) => {
|
|
2448
2915
|
const action = payload.action;
|
|
2449
2916
|
const parent = { id: action.payload.id, type: action.payload.type };
|
|
@@ -2451,37 +2918,36 @@ function EditingStack(props) {
|
|
|
2451
2918
|
_dispatch({ type: "syncRemoval", payload: { resource: { parent, resource } } });
|
|
2452
2919
|
});
|
|
2453
2920
|
}, [vault]);
|
|
2454
|
-
const edit = (0,
|
|
2921
|
+
const edit = (0, import_react20.useCallback)(
|
|
2455
2922
|
(resource, reset = false) => dispatch({ type: "edit", payload: { resource, reset } }),
|
|
2456
2923
|
[]
|
|
2457
2924
|
);
|
|
2458
|
-
const updateCurrent = (0,
|
|
2925
|
+
const updateCurrent = (0, import_react20.useCallback)(
|
|
2459
2926
|
(resource) => dispatch({ type: "updateCurrent", payload: { resource } }),
|
|
2460
2927
|
[]
|
|
2461
2928
|
);
|
|
2462
|
-
const close = (0,
|
|
2463
|
-
const back = (0,
|
|
2464
|
-
const create2 = (0,
|
|
2929
|
+
const close = (0, import_react20.useCallback)(() => dispatch({ type: "close" }), []);
|
|
2930
|
+
const back = (0, import_react20.useCallback)(() => dispatch({ type: "back" }), []);
|
|
2931
|
+
const create2 = (0, import_react20.useCallback)((resource, options) => {
|
|
2465
2932
|
dispatch({ type: "create", payload: { resource, options } });
|
|
2466
2933
|
return () => {
|
|
2467
2934
|
dispatch({ type: "create", payload: { resource: null } });
|
|
2468
2935
|
};
|
|
2469
2936
|
}, []);
|
|
2470
|
-
const actions = (0,
|
|
2937
|
+
const actions = (0, import_react20.useMemo)(() => {
|
|
2471
2938
|
return { edit, updateCurrent, close, back, create: create2 };
|
|
2472
2939
|
}, []);
|
|
2473
2940
|
const { instanceId } = useAppInstance();
|
|
2474
|
-
return /* @__PURE__ */ (0,
|
|
2941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(EditingStackActionsContext.Provider, { value: actions, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(EditingStackContext.Provider, { value: state, children: props.children }) }, instanceId);
|
|
2475
2942
|
}
|
|
2476
2943
|
|
|
2477
2944
|
// src/BaseEditor/BaseEditor.tsx
|
|
2478
|
-
var
|
|
2479
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2945
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2480
2946
|
function BaseEditorBackButton({ fallback, backAction }) {
|
|
2481
2947
|
const stack = useEditingResourceStack();
|
|
2482
2948
|
const { back } = useEditingStack();
|
|
2483
2949
|
if (stack.length) {
|
|
2484
|
-
return /* @__PURE__ */ (0,
|
|
2950
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ModulePanelButton, { onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BackIcon, {}) });
|
|
2485
2951
|
}
|
|
2486
2952
|
return fallback;
|
|
2487
2953
|
}
|
|
@@ -2489,20 +2955,22 @@ function BaseEditorCloseButton({ closeAction, fallback }) {
|
|
|
2489
2955
|
const stack = useEditingResourceStack();
|
|
2490
2956
|
const current = useEditingResource();
|
|
2491
2957
|
if (current || stack.length) {
|
|
2492
|
-
return /* @__PURE__ */ (0,
|
|
2958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2493
2959
|
ModulePanelButton,
|
|
2494
2960
|
{
|
|
2495
2961
|
onClick: () => {
|
|
2496
2962
|
closeAction();
|
|
2497
2963
|
},
|
|
2498
|
-
children: /* @__PURE__ */ (0,
|
|
2964
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CloseIcon, {})
|
|
2499
2965
|
}
|
|
2500
2966
|
);
|
|
2501
2967
|
}
|
|
2502
2968
|
return fallback;
|
|
2503
2969
|
}
|
|
2504
2970
|
function editBasedOnResource(resource, list, options, config) {
|
|
2505
|
-
const filteredList = list.filter(
|
|
2971
|
+
const filteredList = list.filter(
|
|
2972
|
+
(l) => l.resourceType === resource.resource.source.type
|
|
2973
|
+
);
|
|
2506
2974
|
if (filteredList.length === 0) {
|
|
2507
2975
|
return null;
|
|
2508
2976
|
}
|
|
@@ -2550,86 +3018,136 @@ function editBasedOnResource(resource, list, options, config) {
|
|
|
2550
3018
|
}
|
|
2551
3019
|
return null;
|
|
2552
3020
|
}
|
|
2553
|
-
function BaseEditor({
|
|
3021
|
+
function BaseEditor({
|
|
3022
|
+
currentTab = void 0
|
|
3023
|
+
}) {
|
|
2554
3024
|
const resource = useEditingResource();
|
|
3025
|
+
const currentResourceContext = (0, import_react21.useContext)(import_react_iiif_vault9.ResourceReactContext);
|
|
2555
3026
|
const app = useApp();
|
|
2556
3027
|
const vault = (0, import_react_iiif_vault9.useVault)();
|
|
2557
3028
|
const { change } = useLayoutActions();
|
|
2558
3029
|
const set = useSetCustomTitle();
|
|
2559
3030
|
const { editorConfig } = useConfig();
|
|
2560
3031
|
const resourceConfig = (resource?.resource.source?.type ? editorConfig[resource?.resource.source?.type] : editorConfig.All) || {};
|
|
2561
|
-
const
|
|
3032
|
+
const newResourceContext = (0, import_react21.useMemo)(() => {
|
|
3033
|
+
const newCtx = { ...currentResourceContext };
|
|
3034
|
+
const id = resource?.resource.source.id;
|
|
3035
|
+
const type = resource?.resource.source.type;
|
|
3036
|
+
const mapping = {
|
|
3037
|
+
Collection: "collection",
|
|
3038
|
+
Manifest: "manifest",
|
|
3039
|
+
Range: "range",
|
|
3040
|
+
Canvas: "canvas",
|
|
3041
|
+
Annotation: "annotation",
|
|
3042
|
+
AnnotationPage: "annotationPage"
|
|
3043
|
+
};
|
|
3044
|
+
if (type && mapping[type]) {
|
|
3045
|
+
newCtx[mapping[type]] = id;
|
|
3046
|
+
}
|
|
3047
|
+
return newCtx;
|
|
3048
|
+
}, [resource, currentResourceContext]);
|
|
3049
|
+
function wrap(children) {
|
|
3050
|
+
if (!resource) {
|
|
3051
|
+
return children;
|
|
3052
|
+
}
|
|
3053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_iiif_vault9.ResourceReactContext.Provider, { value: newResourceContext, children });
|
|
3054
|
+
}
|
|
3055
|
+
const match = (0, import_react21.useMemo)(() => {
|
|
2562
3056
|
if (!resource) {
|
|
2563
3057
|
return null;
|
|
2564
3058
|
}
|
|
2565
3059
|
const editors = app.layout.editors || [];
|
|
2566
3060
|
const resources = app.layout.resources || [];
|
|
2567
|
-
const mappedResources = resources.map(
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
3061
|
+
const mappedResources = resources.map(
|
|
3062
|
+
(resource2) => {
|
|
3063
|
+
if (typeof resource2 === "string") {
|
|
3064
|
+
return {
|
|
3065
|
+
id: "@default/" + resource2,
|
|
3066
|
+
label: resource2,
|
|
3067
|
+
resourceType: resource2,
|
|
3068
|
+
auto: true,
|
|
3069
|
+
editors: editors.filter(
|
|
3070
|
+
(e) => e.supports.resourceTypes.includes(resource2)
|
|
3071
|
+
)
|
|
3072
|
+
};
|
|
3073
|
+
}
|
|
3074
|
+
return resource2;
|
|
2576
3075
|
}
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
3076
|
+
);
|
|
3077
|
+
return editBasedOnResource(
|
|
3078
|
+
resource,
|
|
3079
|
+
mappedResources,
|
|
3080
|
+
{ edit: true, vault },
|
|
3081
|
+
resourceConfig
|
|
3082
|
+
);
|
|
2580
3083
|
}, [resource, app]);
|
|
2581
|
-
(0,
|
|
3084
|
+
(0, import_react21.useEffect)(() => {
|
|
2582
3085
|
set(match?.label || "");
|
|
2583
3086
|
});
|
|
3087
|
+
(0, import_react21.useEffect)(() => {
|
|
3088
|
+
const availableKeys = match?.editors.map((editor, key) => editor.id + key) || [];
|
|
3089
|
+
const currentKey = availableKeys.find((key) => key === currentTab);
|
|
3090
|
+
if (!currentKey) {
|
|
3091
|
+
change("@manifest-editor/editor", { currentTab: availableKeys[0] });
|
|
3092
|
+
}
|
|
3093
|
+
}, [match?.editors, currentTab, change]);
|
|
2584
3094
|
if (!resource || !match) {
|
|
2585
3095
|
return null;
|
|
2586
3096
|
}
|
|
2587
3097
|
if (resourceConfig.singleTab) {
|
|
2588
|
-
const first = (match?.editors || []).find(
|
|
3098
|
+
const first = (match?.editors || []).find(
|
|
3099
|
+
(editor) => editor.id === resourceConfig.singleTab
|
|
3100
|
+
);
|
|
2589
3101
|
if (first) {
|
|
2590
|
-
return
|
|
3102
|
+
return wrap(
|
|
3103
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "w-full", children: first.component(resourceConfig) })
|
|
3104
|
+
);
|
|
2591
3105
|
}
|
|
2592
3106
|
}
|
|
2593
|
-
return
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
3107
|
+
return wrap(
|
|
3108
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3109
|
+
import_components5.SidebarTabs,
|
|
3110
|
+
{
|
|
3111
|
+
menuId: resource.resource.source.id,
|
|
3112
|
+
menu: (match?.editors || []).map((editor, key) => {
|
|
3113
|
+
return {
|
|
3114
|
+
id: editor.id + key,
|
|
3115
|
+
label: editor.label,
|
|
3116
|
+
renderComponent: () => editor.component(resourceConfig)
|
|
3117
|
+
};
|
|
3118
|
+
}),
|
|
3119
|
+
selectedKey: currentTab,
|
|
3120
|
+
onSelectionChange: (p) => {
|
|
3121
|
+
change("@manifest-editor/editor", { currentTab: p });
|
|
3122
|
+
}
|
|
3123
|
+
},
|
|
3124
|
+
resource.resource.source?.id
|
|
3125
|
+
)
|
|
2608
3126
|
);
|
|
2609
3127
|
}
|
|
2610
3128
|
|
|
2611
3129
|
// src/BaseEditor/index.tsx
|
|
2612
|
-
var
|
|
3130
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2613
3131
|
var baseEditor = {
|
|
2614
3132
|
id: "@manifest-editor/editor",
|
|
2615
3133
|
label: "Editor",
|
|
2616
3134
|
options: { hideHeader: true, tabs: true, minWidth: 400 },
|
|
2617
|
-
renderBackAction: ({ backAction, fallback }) => /* @__PURE__ */ (0,
|
|
2618
|
-
renderCloseAction: ({ closeAction, fallback }) => /* @__PURE__ */ (0,
|
|
3135
|
+
renderBackAction: ({ backAction, fallback }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(BaseEditorBackButton, { backAction, fallback }),
|
|
3136
|
+
renderCloseAction: ({ closeAction, fallback }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(BaseEditorCloseButton, { closeAction, fallback }),
|
|
2619
3137
|
render({ currentTab }) {
|
|
2620
|
-
return /* @__PURE__ */ (0,
|
|
3138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(BaseEditor, { currentTab });
|
|
2621
3139
|
}
|
|
2622
3140
|
};
|
|
2623
3141
|
|
|
2624
3142
|
// src/ConfigContext/ConfigEditor.tsx
|
|
2625
|
-
var
|
|
3143
|
+
var import_components6 = require("@manifest-editor/components");
|
|
2626
3144
|
|
|
2627
3145
|
// src/hooks/use-decay-state.ts
|
|
2628
|
-
var
|
|
3146
|
+
var import_react22 = require("react");
|
|
2629
3147
|
function useDecayState(time) {
|
|
2630
|
-
const [active, _setActive] = (0,
|
|
2631
|
-
const lastTimeout = (0,
|
|
2632
|
-
const focusCount = (0,
|
|
3148
|
+
const [active, _setActive] = (0, import_react22.useState)(false);
|
|
3149
|
+
const lastTimeout = (0, import_react22.useRef)();
|
|
3150
|
+
const focusCount = (0, import_react22.useRef)(0);
|
|
2633
3151
|
function clear(existing) {
|
|
2634
3152
|
focusCount.current--;
|
|
2635
3153
|
if (existing && focusCount.current !== 0) {
|
|
@@ -2650,11 +3168,11 @@ function useDecayState(time) {
|
|
|
2650
3168
|
}
|
|
2651
3169
|
_setActive(true);
|
|
2652
3170
|
}
|
|
2653
|
-
return (0,
|
|
3171
|
+
return (0, import_react22.useMemo)(() => [active, { set, clear }], [active]);
|
|
2654
3172
|
}
|
|
2655
3173
|
|
|
2656
3174
|
// src/ConfigContext/ConfigEditor.tsx
|
|
2657
|
-
var
|
|
3175
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2658
3176
|
function ConfigEditor() {
|
|
2659
3177
|
const previews = usePreviewContext();
|
|
2660
3178
|
const config = useConfig();
|
|
@@ -2681,14 +3199,14 @@ function ConfigEditor() {
|
|
|
2681
3199
|
saveState.set();
|
|
2682
3200
|
saveState.clear();
|
|
2683
3201
|
}
|
|
2684
|
-
return /* @__PURE__ */ (0,
|
|
2685
|
-
/* @__PURE__ */ (0,
|
|
2686
|
-
isSaved ? /* @__PURE__ */ (0,
|
|
2687
|
-
/* @__PURE__ */ (0,
|
|
2688
|
-
/* @__PURE__ */ (0,
|
|
2689
|
-
/* @__PURE__ */ (0,
|
|
2690
|
-
/* @__PURE__ */ (0,
|
|
2691
|
-
|
|
3202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_components6.Sidebar, { children: [
|
|
3203
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components6.SidebarHeader, { title: "Workspace configuration" }),
|
|
3204
|
+
isSaved ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "bg-me-primary-500 text-white p-3 text-sm", children: "Changes saved" }) : null,
|
|
3205
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components6.SidebarContent, { className: "p-4", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_components6.Form.Form, { onSubmit, className: "flex flex-col gap-3", children: [
|
|
3206
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_components6.Form.InputContainer, { children: [
|
|
3207
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components6.Form.Label, { htmlFor: "defaultLanguage", children: "Default Language" }),
|
|
3208
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3209
|
+
import_components6.Form.Input,
|
|
2692
3210
|
{
|
|
2693
3211
|
type: "text",
|
|
2694
3212
|
name: "defaultLanguage",
|
|
@@ -2697,10 +3215,10 @@ function ConfigEditor() {
|
|
|
2697
3215
|
}
|
|
2698
3216
|
)
|
|
2699
3217
|
] }),
|
|
2700
|
-
/* @__PURE__ */ (0,
|
|
2701
|
-
/* @__PURE__ */ (0,
|
|
2702
|
-
/* @__PURE__ */ (0,
|
|
2703
|
-
|
|
3218
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_components6.Form.InputContainer, { children: [
|
|
3219
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components6.Form.Label, { htmlFor: "availableLanguages", children: "Available Languages" }),
|
|
3220
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3221
|
+
import_components6.Form.Input,
|
|
2704
3222
|
{
|
|
2705
3223
|
type: "text",
|
|
2706
3224
|
name: "availableLanguages",
|
|
@@ -2709,9 +3227,9 @@ function ConfigEditor() {
|
|
|
2709
3227
|
}
|
|
2710
3228
|
)
|
|
2711
3229
|
] }),
|
|
2712
|
-
/* @__PURE__ */ (0,
|
|
2713
|
-
/* @__PURE__ */ (0,
|
|
2714
|
-
|
|
3230
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_components6.Form.InputContainer, { horizontal: true, className: "my-3", children: [
|
|
3231
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3232
|
+
import_components6.Form.Input,
|
|
2715
3233
|
{
|
|
2716
3234
|
type: "checkbox",
|
|
2717
3235
|
name: "advancedLanguageMode",
|
|
@@ -2719,11 +3237,23 @@ function ConfigEditor() {
|
|
|
2719
3237
|
defaultChecked: config.i18n?.advancedLanguageMode || false
|
|
2720
3238
|
}
|
|
2721
3239
|
),
|
|
2722
|
-
/* @__PURE__ */ (0,
|
|
3240
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components6.Form.Label, { htmlFor: "advancedLanguageMode", children: "Advanced Language Mode" })
|
|
3241
|
+
] }),
|
|
3242
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_components6.Form.InputContainer, { horizontal: true, className: "my-3", children: [
|
|
3243
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3244
|
+
import_components6.Form.Input,
|
|
3245
|
+
{
|
|
3246
|
+
type: "checkbox",
|
|
3247
|
+
name: "textGranularityEnabled",
|
|
3248
|
+
id: "textGranularityEnabled",
|
|
3249
|
+
defaultChecked: config.i18n?.textGranularityEnabled || false
|
|
3250
|
+
}
|
|
3251
|
+
),
|
|
3252
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components6.Form.Label, { htmlFor: "textGranularityEnabled", children: "Enable text granularity" })
|
|
2723
3253
|
] }),
|
|
2724
|
-
/* @__PURE__ */ (0,
|
|
2725
|
-
/* @__PURE__ */ (0,
|
|
2726
|
-
|
|
3254
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_components6.Form.InputContainer, { horizontal: true, className: "my-3", children: [
|
|
3255
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3256
|
+
import_components6.Form.Input,
|
|
2727
3257
|
{
|
|
2728
3258
|
type: "checkbox",
|
|
2729
3259
|
name: "isVersion2",
|
|
@@ -2731,17 +3261,17 @@ function ConfigEditor() {
|
|
|
2731
3261
|
defaultChecked: config.export?.version === 2
|
|
2732
3262
|
}
|
|
2733
3263
|
),
|
|
2734
|
-
/* @__PURE__ */ (0,
|
|
3264
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components6.Form.Label, { htmlFor: "isVersion2", children: "Export Presentation 2 Manifests" })
|
|
2735
3265
|
] }),
|
|
2736
|
-
/* @__PURE__ */ (0,
|
|
2737
|
-
/* @__PURE__ */ (0,
|
|
2738
|
-
/* @__PURE__ */ (0,
|
|
3266
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_components6.Form.InputContainer, { children: [
|
|
3267
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components6.Form.Label, { htmlFor: "defaultPreview", children: "Default preview" }),
|
|
3268
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { children: previews.configs.map((preview, key) => {
|
|
2739
3269
|
if (preview.type === "iiif-preview-service") {
|
|
2740
3270
|
return null;
|
|
2741
3271
|
}
|
|
2742
|
-
return /* @__PURE__ */ (0,
|
|
2743
|
-
/* @__PURE__ */ (0,
|
|
2744
|
-
|
|
3272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_components6.Form.InputContainer, { horizontal: true, children: [
|
|
3273
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3274
|
+
import_components6.Form.Input,
|
|
2745
3275
|
{
|
|
2746
3276
|
type: "radio",
|
|
2747
3277
|
id: preview.id,
|
|
@@ -2750,17 +3280,25 @@ function ConfigEditor() {
|
|
|
2750
3280
|
defaultChecked: !config.defaultPreview ? key === 0 : config.defaultPreview === preview.id
|
|
2751
3281
|
}
|
|
2752
3282
|
),
|
|
2753
|
-
/* @__PURE__ */ (0,
|
|
3283
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("label", { htmlFor: preview.id, children: preview.label })
|
|
2754
3284
|
] }, preview.id);
|
|
2755
3285
|
}) })
|
|
2756
3286
|
] }),
|
|
2757
|
-
/* @__PURE__ */ (0,
|
|
3287
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3288
|
+
"a",
|
|
3289
|
+
{
|
|
3290
|
+
className: "text-sm text-me-primary-500 hover:underline hover:text-me-primary-600",
|
|
3291
|
+
href: window.location.pathname.includes("/exhibition") ? window.location.pathname.replace("/exhibition", "") || "/" : `${window.location.pathname}/exhibition`,
|
|
3292
|
+
children: window.location.pathname.includes("/exhibition") ? "Return to Manifest Editor" : "Go to Exhibition Editor"
|
|
3293
|
+
}
|
|
3294
|
+
),
|
|
3295
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "mt-5", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components6.ActionButton, { type: "submit", children: "Save changes" }) })
|
|
2758
3296
|
] }) })
|
|
2759
3297
|
] });
|
|
2760
3298
|
}
|
|
2761
3299
|
|
|
2762
3300
|
// src/ExportPanel/ExportPanel.tsx
|
|
2763
|
-
var
|
|
3301
|
+
var import_react24 = require("react");
|
|
2764
3302
|
var import_react_iiif_vault10 = require("react-iiif-vault");
|
|
2765
3303
|
|
|
2766
3304
|
// ../ui/ui/CenterPanelContainer/CenterPanelContainer.module.css
|
|
@@ -2772,29 +3310,29 @@ var CenterPanelContainer_default = {
|
|
|
2772
3310
|
};
|
|
2773
3311
|
|
|
2774
3312
|
// ../ui/ui/CenterPanelContainer/CenterPanelContainer.tsx
|
|
2775
|
-
var
|
|
3313
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2776
3314
|
function CenterPanelContainer(props) {
|
|
2777
|
-
return /* @__PURE__ */ (0,
|
|
2778
|
-
props.title || props.close ? /* @__PURE__ */ (0,
|
|
2779
|
-
props.title ? /* @__PURE__ */ (0,
|
|
2780
|
-
props.close ? /* @__PURE__ */ (0,
|
|
3315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: CenterPanelContainer_default.CenterPanelContainer, children: [
|
|
3316
|
+
props.title || props.close ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: CenterPanelContainer_default.CenterPanelHeader, children: [
|
|
3317
|
+
props.title ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h2", { className: CenterPanelContainer_default.CenterPanelTitle, children: props.title }) : null,
|
|
3318
|
+
props.close ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button, { className: CenterPanelContainer_default.CenterPanelClose, onClick: props.close, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CloseIcon, {}) }) : null
|
|
2781
3319
|
] }) : null,
|
|
2782
3320
|
props.children
|
|
2783
3321
|
] });
|
|
2784
3322
|
}
|
|
2785
3323
|
|
|
2786
3324
|
// ../ui/atoms/Accordion.tsx
|
|
2787
|
-
var
|
|
2788
|
-
var
|
|
2789
|
-
var
|
|
2790
|
-
var AccordionContainer =
|
|
3325
|
+
var import_styled_components7 = __toESM(require("styled-components"), 1);
|
|
3326
|
+
var import_react23 = require("react");
|
|
3327
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3328
|
+
var AccordionContainer = import_styled_components7.default.div`
|
|
2791
3329
|
flex: 1;
|
|
2792
3330
|
display: flex;
|
|
2793
3331
|
width: 100%;
|
|
2794
3332
|
flex-direction: column;
|
|
2795
3333
|
position: relative;
|
|
2796
3334
|
`;
|
|
2797
|
-
var ItemRow =
|
|
3335
|
+
var ItemRow = import_styled_components7.default.div`
|
|
2798
3336
|
background: #fff;
|
|
2799
3337
|
position: relative;
|
|
2800
3338
|
border-bottom: 1px solid #d0d0d0;
|
|
@@ -2813,12 +3351,12 @@ var ItemRow = import_styled_components9.default.div`
|
|
|
2813
3351
|
//justify-content: center;
|
|
2814
3352
|
}
|
|
2815
3353
|
`;
|
|
2816
|
-
var ItemDescription =
|
|
3354
|
+
var ItemDescription = import_styled_components7.default.p`
|
|
2817
3355
|
font-size: 0.9em;
|
|
2818
3356
|
color: #777;
|
|
2819
3357
|
font-weight: 400;
|
|
2820
3358
|
`;
|
|
2821
|
-
var ItemLabel =
|
|
3359
|
+
var ItemLabel = import_styled_components7.default.button`
|
|
2822
3360
|
color: inherit;
|
|
2823
3361
|
text-rendering: geometricPrecision;
|
|
2824
3362
|
border: none;
|
|
@@ -2861,7 +3399,7 @@ var ItemLabel = import_styled_components9.default.button`
|
|
|
2861
3399
|
}
|
|
2862
3400
|
}
|
|
2863
3401
|
`;
|
|
2864
|
-
var ItemCollapse =
|
|
3402
|
+
var ItemCollapse = import_styled_components7.default.div`
|
|
2865
3403
|
font-size: 1.4em;
|
|
2866
3404
|
padding-right: 0.3em;
|
|
2867
3405
|
display: flex;
|
|
@@ -2871,7 +3409,7 @@ var ItemCollapse = import_styled_components9.default.div`
|
|
|
2871
3409
|
font-size: 2em;
|
|
2872
3410
|
}
|
|
2873
3411
|
`;
|
|
2874
|
-
var ItemIcon =
|
|
3412
|
+
var ItemIcon = import_styled_components7.default.div`
|
|
2875
3413
|
width: 2em;
|
|
2876
3414
|
align-items: center;
|
|
2877
3415
|
//padding-top: 0.5em;
|
|
@@ -2885,12 +3423,12 @@ var ItemIcon = import_styled_components9.default.div`
|
|
|
2885
3423
|
color: #999;
|
|
2886
3424
|
}
|
|
2887
3425
|
`;
|
|
2888
|
-
var ItemBodyInner =
|
|
3426
|
+
var ItemBodyInner = import_styled_components7.default.div`
|
|
2889
3427
|
min-height: 0;
|
|
2890
3428
|
overflow: visible;
|
|
2891
3429
|
display: flex;
|
|
2892
3430
|
`;
|
|
2893
|
-
var ItemBodyPadding =
|
|
3431
|
+
var ItemBodyPadding = import_styled_components7.default.div`
|
|
2894
3432
|
min-height: 0;
|
|
2895
3433
|
overflow: visible;
|
|
2896
3434
|
flex: 1;
|
|
@@ -2904,7 +3442,7 @@ var ItemBodyPadding = import_styled_components9.default.div`
|
|
|
2904
3442
|
overflow-y: auto;
|
|
2905
3443
|
}
|
|
2906
3444
|
`;
|
|
2907
|
-
var ItemBody =
|
|
3445
|
+
var ItemBody = import_styled_components7.default.section`
|
|
2908
3446
|
display: grid;
|
|
2909
3447
|
grid-template-rows: 0fr;
|
|
2910
3448
|
overflow: hidden;
|
|
@@ -2933,7 +3471,7 @@ var ItemBody = import_styled_components9.default.section`
|
|
|
2933
3471
|
box-shadow: inset 0px 2px 0px 0 rgba(0, 0, 0, 0.1);
|
|
2934
3472
|
}
|
|
2935
3473
|
`;
|
|
2936
|
-
var ItemHeading =
|
|
3474
|
+
var ItemHeading = import_styled_components7.default.div`
|
|
2937
3475
|
position: sticky;
|
|
2938
3476
|
display: flex;
|
|
2939
3477
|
top: 0;
|
|
@@ -2973,11 +3511,11 @@ var ItemHeading = import_styled_components9.default.div`
|
|
|
2973
3511
|
var noop = () => void 0;
|
|
2974
3512
|
var keyIdIndex = 0;
|
|
2975
3513
|
function useId() {
|
|
2976
|
-
return (0,
|
|
3514
|
+
return (0, import_react23.useMemo)(() => keyIdIndex++, []);
|
|
2977
3515
|
}
|
|
2978
3516
|
function useAccordionItems(itemsLength, singleMode = false) {
|
|
2979
|
-
const [elRefs, setElRefs] = (0,
|
|
2980
|
-
const current = (0,
|
|
3517
|
+
const [elRefs, setElRefs] = (0, import_react23.useState)([]);
|
|
3518
|
+
const current = (0, import_react23.useRef)(-1);
|
|
2981
3519
|
const onKeyDown = (e) => {
|
|
2982
3520
|
const currentEl = document.activeElement;
|
|
2983
3521
|
const currentIndex = elRefs.findIndex((r) => r.current?.button?.current === currentEl);
|
|
@@ -3045,9 +3583,9 @@ function useAccordionItems(itemsLength, singleMode = false) {
|
|
|
3045
3583
|
}
|
|
3046
3584
|
}
|
|
3047
3585
|
};
|
|
3048
|
-
(0,
|
|
3586
|
+
(0, import_react23.useEffect)(() => {
|
|
3049
3587
|
setElRefs(
|
|
3050
|
-
(elRefs_) => Array(itemsLength).fill(0).map((_, i) => elRefs_[i] || (0,
|
|
3588
|
+
(elRefs_) => Array(itemsLength).fill(0).map((_, i) => elRefs_[i] || (0, import_react23.createRef)())
|
|
3051
3589
|
);
|
|
3052
3590
|
}, [itemsLength]);
|
|
3053
3591
|
const getItemProps = (key) => {
|
|
@@ -3103,19 +3641,19 @@ function useAccordionItems(itemsLength, singleMode = false) {
|
|
|
3103
3641
|
getItemProps
|
|
3104
3642
|
};
|
|
3105
3643
|
}
|
|
3106
|
-
var AccordionItem = (0,
|
|
3107
|
-
const content = (0,
|
|
3108
|
-
const btn = (0,
|
|
3644
|
+
var AccordionItem = (0, import_react23.forwardRef)(function AccordionItem2(props, ref) {
|
|
3645
|
+
const content = (0, import_react23.useRef)(null);
|
|
3646
|
+
const btn = (0, import_react23.useRef)(null);
|
|
3109
3647
|
const id = useId();
|
|
3110
|
-
const [open, setIsOpen] = (0,
|
|
3648
|
+
const [open, setIsOpen] = (0, import_react23.useState)(props.initialOpen || false);
|
|
3111
3649
|
const onChange = props.onChange || noop;
|
|
3112
3650
|
const toggle = () => {
|
|
3113
3651
|
onChange(!open);
|
|
3114
3652
|
setIsOpen((o) => !o);
|
|
3115
3653
|
};
|
|
3116
3654
|
const maxHeight = props.maxHeight;
|
|
3117
|
-
const [scrolled, setScrolled] = (0,
|
|
3118
|
-
(0,
|
|
3655
|
+
const [scrolled, setScrolled] = (0, import_react23.useState)(false);
|
|
3656
|
+
(0, import_react23.useImperativeHandle)(ref, () => ({
|
|
3119
3657
|
open() {
|
|
3120
3658
|
onChange(true);
|
|
3121
3659
|
setIsOpen(true);
|
|
@@ -3141,16 +3679,16 @@ var AccordionItem = (0, import_react21.forwardRef)(function AccordionItem2(props
|
|
|
3141
3679
|
setScrolled(false);
|
|
3142
3680
|
}
|
|
3143
3681
|
};
|
|
3144
|
-
return /* @__PURE__ */ (0,
|
|
3145
|
-
/* @__PURE__ */ (0,
|
|
3146
|
-
props.icon ? /* @__PURE__ */ (0,
|
|
3147
|
-
/* @__PURE__ */ (0,
|
|
3682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(ItemRow, { "data-large": props.large, "data-open": open, children: [
|
|
3683
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(ItemHeading, { "data-open": open, children: [
|
|
3684
|
+
props.icon ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ItemIcon, { onClick: toggle, children: props.icon }) : null,
|
|
3685
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(ItemLabel, { ref: btn, onClick: toggle, "aria-expanded": open, "aria-controls": `accordion-${id}`, children: [
|
|
3148
3686
|
props.label,
|
|
3149
|
-
props.description ? /* @__PURE__ */ (0,
|
|
3687
|
+
props.description ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ItemDescription, { children: props.description }) : null
|
|
3150
3688
|
] }),
|
|
3151
|
-
/* @__PURE__ */ (0,
|
|
3689
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ItemCollapse, { onClick: toggle, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DownIcon, { width: "1em", height: "1em", rotate: open ? 0 : 180 }) })
|
|
3152
3690
|
] }),
|
|
3153
|
-
/* @__PURE__ */ (0,
|
|
3691
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3154
3692
|
ItemBody,
|
|
3155
3693
|
{
|
|
3156
3694
|
"aria-labelledby": `accordion-${id}`,
|
|
@@ -3162,7 +3700,7 @@ var AccordionItem = (0, import_react21.forwardRef)(function AccordionItem2(props
|
|
|
3162
3700
|
$initial: !open,
|
|
3163
3701
|
"data-scrolled": scrolled,
|
|
3164
3702
|
hidden: !open,
|
|
3165
|
-
children: /* @__PURE__ */ (0,
|
|
3703
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ItemBodyInner, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3166
3704
|
ItemBodyPadding,
|
|
3167
3705
|
{
|
|
3168
3706
|
"data-max-height": !!maxHeight,
|
|
@@ -3177,18 +3715,18 @@ var AccordionItem = (0, import_react21.forwardRef)(function AccordionItem2(props
|
|
|
3177
3715
|
});
|
|
3178
3716
|
function Accordion(props) {
|
|
3179
3717
|
const { getItemProps, onKeyDown } = useAccordionItems(props.items.length, props.singleMode);
|
|
3180
|
-
return /* @__PURE__ */ (0,
|
|
3718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AccordionContainer, { onKeyDown, children: props.items.map((item, key) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AccordionItem, { overflow: props.overflow, maxHeight: props.maxHeight, ...item, ...getItemProps(key), children: item.children }, key)) });
|
|
3181
3719
|
}
|
|
3182
3720
|
|
|
3183
3721
|
// ../ui/icons/DownloadIcon.tsx
|
|
3184
|
-
var
|
|
3722
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3185
3723
|
function DownloadIcon() {
|
|
3186
|
-
return /* @__PURE__ */ (0,
|
|
3724
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", height: "48", viewBox: "0 -960 960 960", width: "48", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("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" }) });
|
|
3187
3725
|
}
|
|
3188
3726
|
|
|
3189
3727
|
// ../ui/atoms/ButtonRow.tsx
|
|
3190
|
-
var
|
|
3191
|
-
var ButtonRow =
|
|
3728
|
+
var import_styled_components8 = __toESM(require("styled-components"), 1);
|
|
3729
|
+
var ButtonRow = import_styled_components8.default.div`
|
|
3192
3730
|
padding: 0.3em;
|
|
3193
3731
|
|
|
3194
3732
|
display: flex;
|
|
@@ -3213,18 +3751,18 @@ var ButtonRow = import_styled_components10.default.div`
|
|
|
3213
3751
|
`;
|
|
3214
3752
|
|
|
3215
3753
|
// src/ExportPanel/ExportPanel.tsx
|
|
3216
|
-
var
|
|
3754
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3217
3755
|
function ExportPanel(props) {
|
|
3218
3756
|
const manifest = (0, import_react_iiif_vault10.useManifest)();
|
|
3219
3757
|
const vault = (0, import_react_iiif_vault10.useVault)();
|
|
3220
3758
|
const actions = useLayoutActions();
|
|
3221
|
-
const version3 = (0,
|
|
3759
|
+
const version3 = (0, import_react24.useMemo)(() => {
|
|
3222
3760
|
return JSON.stringify(vault.toPresentation3(manifest), null, 2);
|
|
3223
3761
|
}, [manifest, vault]);
|
|
3224
|
-
const version2 = (0,
|
|
3762
|
+
const version2 = (0, import_react24.useMemo)(() => {
|
|
3225
3763
|
return JSON.stringify(vault.toPresentation2(manifest), null, 2);
|
|
3226
3764
|
}, [manifest, vault]);
|
|
3227
|
-
return /* @__PURE__ */ (0,
|
|
3765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CenterPanelContainer, { title: "Export manifest", close: actions.centerPanel.popStack, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { style: { flex: 1, overflowY: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3228
3766
|
Accordion,
|
|
3229
3767
|
{
|
|
3230
3768
|
items: [
|
|
@@ -3235,12 +3773,12 @@ function ExportPanel(props) {
|
|
|
3235
3773
|
large: true,
|
|
3236
3774
|
initialOpen: true,
|
|
3237
3775
|
overflow: true,
|
|
3238
|
-
icon: /* @__PURE__ */ (0,
|
|
3239
|
-
children: /* @__PURE__ */ (0,
|
|
3240
|
-
/* @__PURE__ */ (0,
|
|
3241
|
-
/* @__PURE__ */ (0,
|
|
3242
|
-
/* @__PURE__ */ (0,
|
|
3243
|
-
/* @__PURE__ */ (0,
|
|
3776
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button, { onClick: () => createDownload(version3, "manifest.json"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DownloadIcon, {}) }),
|
|
3777
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { maxWidth: "100%" }, children: [
|
|
3778
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("pre", { style: { whiteSpace: "pre-wrap" }, children: JSON.stringify(vault.toPresentation3(manifest), null, 2) }),
|
|
3779
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(ButtonRow, { "data-sticky": "true", children: [
|
|
3780
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button, { onClick: () => copyToClipboard(version3), children: "Copy to clipboard" }),
|
|
3781
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button, { onClick: () => createDownload(version3, "manifest.json"), children: "Download" })
|
|
3244
3782
|
] })
|
|
3245
3783
|
] })
|
|
3246
3784
|
},
|
|
@@ -3249,12 +3787,12 @@ function ExportPanel(props) {
|
|
|
3249
3787
|
description: 'Download this version by clicking the "Download" button.',
|
|
3250
3788
|
maxHeight: 400,
|
|
3251
3789
|
large: true,
|
|
3252
|
-
icon: /* @__PURE__ */ (0,
|
|
3253
|
-
children: /* @__PURE__ */ (0,
|
|
3254
|
-
/* @__PURE__ */ (0,
|
|
3255
|
-
/* @__PURE__ */ (0,
|
|
3256
|
-
/* @__PURE__ */ (0,
|
|
3257
|
-
/* @__PURE__ */ (0,
|
|
3790
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button, { onClick: () => createDownload(version2, "manifest.json"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DownloadIcon, {}) }),
|
|
3791
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { maxWidth: "100%" }, children: [
|
|
3792
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("pre", { style: { whiteSpace: "pre-wrap" }, children: JSON.stringify(vault.toPresentation2(manifest), null, 2) }),
|
|
3793
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(ButtonRow, { "data-sticky": "true", children: [
|
|
3794
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button, { onClick: () => copyToClipboard(version2), children: "Copy to clipboard" }),
|
|
3795
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button, { onClick: () => createDownload(version2, "manifest.json"), children: "Download" })
|
|
3258
3796
|
] })
|
|
3259
3797
|
] })
|
|
3260
3798
|
}
|
|
@@ -3263,6 +3801,9 @@ function ExportPanel(props) {
|
|
|
3263
3801
|
) }) });
|
|
3264
3802
|
}
|
|
3265
3803
|
|
|
3804
|
+
// src/Layout/Layout.tsx
|
|
3805
|
+
var import_components7 = require("@manifest-editor/components");
|
|
3806
|
+
|
|
3266
3807
|
// ../ui/ui/GhostBlocks/GhostBlocks.module.css
|
|
3267
3808
|
var GhostBlocks_default = {
|
|
3268
3809
|
ghostLoadingBlock: "GhostBlocks_ghostLoadingBlock",
|
|
@@ -3271,40 +3812,60 @@ var GhostBlocks_default = {
|
|
|
3271
3812
|
};
|
|
3272
3813
|
|
|
3273
3814
|
// ../ui/ui/GhostBlocks/GhostBlocks.tsx
|
|
3274
|
-
var
|
|
3815
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3275
3816
|
function GhostBlocks() {
|
|
3276
|
-
return /* @__PURE__ */ (0,
|
|
3277
|
-
/* @__PURE__ */ (0,
|
|
3278
|
-
/* @__PURE__ */ (0,
|
|
3279
|
-
/* @__PURE__ */ (0,
|
|
3280
|
-
/* @__PURE__ */ (0,
|
|
3281
|
-
/* @__PURE__ */ (0,
|
|
3282
|
-
/* @__PURE__ */ (0,
|
|
3817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
3818
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { "data-header": "true", className: GhostBlocks_default.ghostLoadingBlock }),
|
|
3819
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: GhostBlocks_default.ghostBlockList, children: [
|
|
3820
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: GhostBlocks_default.ghostLoadingBlock }),
|
|
3821
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: GhostBlocks_default.ghostLoadingBlock }),
|
|
3822
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: GhostBlocks_default.ghostLoadingBlock }),
|
|
3823
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: GhostBlocks_default.ghostLoadingBlock })
|
|
3283
3824
|
] })
|
|
3284
3825
|
] });
|
|
3285
3826
|
}
|
|
3286
3827
|
|
|
3287
3828
|
// src/Layout/Layout.tsx
|
|
3288
|
-
var
|
|
3829
|
+
var import_react29 = require("react");
|
|
3289
3830
|
var import_react_iiif_vault11 = require("react-iiif-vault");
|
|
3290
3831
|
var import_react_transition_group = require("react-transition-group");
|
|
3291
3832
|
var import_shallowequal = __toESM(require("shallowequal"), 1);
|
|
3292
3833
|
|
|
3834
|
+
// src/hooks/use-match-media.ts
|
|
3835
|
+
var import_react25 = require("react");
|
|
3836
|
+
function useMatchMedia(queries, defaultValues = []) {
|
|
3837
|
+
const initialValues = defaultValues.length ? defaultValues : Array(queries.length).fill(false);
|
|
3838
|
+
if (typeof window === "undefined")
|
|
3839
|
+
return initialValues;
|
|
3840
|
+
const mediaQueryLists = queries.map((q) => window.matchMedia(q));
|
|
3841
|
+
const getValue2 = () => {
|
|
3842
|
+
const matchedQueries = mediaQueryLists.map((mql) => mql.matches);
|
|
3843
|
+
return matchedQueries;
|
|
3844
|
+
};
|
|
3845
|
+
const [value, setValue] = (0, import_react25.useState)(getValue2);
|
|
3846
|
+
(0, import_react25.useLayoutEffect)(() => {
|
|
3847
|
+
const handler = () => setValue(getValue2);
|
|
3848
|
+
mediaQueryLists.forEach((mql) => mql.addListener(handler));
|
|
3849
|
+
return () => mediaQueryLists.forEach((mql) => mql.removeListener(handler));
|
|
3850
|
+
}, []);
|
|
3851
|
+
return value;
|
|
3852
|
+
}
|
|
3853
|
+
|
|
3293
3854
|
// src/Layout/Layout.mobile.tsx
|
|
3294
|
-
var
|
|
3295
|
-
var Container2 =
|
|
3855
|
+
var import_styled_components9 = __toESM(require("styled-components"), 1);
|
|
3856
|
+
var Container2 = import_styled_components9.default.div`
|
|
3296
3857
|
position: relative;
|
|
3297
3858
|
display: flex;
|
|
3298
3859
|
flex: 1;
|
|
3299
3860
|
overflow: hidden;
|
|
3300
3861
|
flex-direction: column;
|
|
3301
3862
|
`;
|
|
3302
|
-
var CenterPanel =
|
|
3863
|
+
var CenterPanel = import_styled_components9.default.div`
|
|
3303
3864
|
flex: 1;
|
|
3304
3865
|
position: relative;
|
|
3305
3866
|
z-index: 7;
|
|
3306
3867
|
`;
|
|
3307
|
-
var MobileBar =
|
|
3868
|
+
var MobileBar = import_styled_components9.default.div`
|
|
3308
3869
|
display: flex;
|
|
3309
3870
|
justify-content: space-around;
|
|
3310
3871
|
width: 100%;
|
|
@@ -3313,7 +3874,7 @@ var MobileBar = import_styled_components11.default.div`
|
|
|
3313
3874
|
padding: 0.5em;
|
|
3314
3875
|
height: 3.4rem;
|
|
3315
3876
|
`;
|
|
3316
|
-
var LeftBarButton =
|
|
3877
|
+
var LeftBarButton = import_styled_components9.default.button`
|
|
3317
3878
|
//background: red;
|
|
3318
3879
|
padding: 0.5em 1em;
|
|
3319
3880
|
width: 32%;
|
|
@@ -3322,7 +3883,7 @@ var LeftBarButton = import_styled_components11.default.button`
|
|
|
3322
3883
|
border: none;
|
|
3323
3884
|
background: #ffffff;
|
|
3324
3885
|
`;
|
|
3325
|
-
var PreviewBarButton =
|
|
3886
|
+
var PreviewBarButton = import_styled_components9.default.button`
|
|
3326
3887
|
padding: 0.5em 1em;
|
|
3327
3888
|
width: 32%;
|
|
3328
3889
|
|
|
@@ -3332,13 +3893,13 @@ var PreviewBarButton = import_styled_components11.default.button`
|
|
|
3332
3893
|
border: 1px solid rgba(0, 0, 0, 0.21);
|
|
3333
3894
|
color: #ffffff;
|
|
3334
3895
|
`;
|
|
3335
|
-
var DrawerContainer =
|
|
3896
|
+
var DrawerContainer = import_styled_components9.default.div`
|
|
3336
3897
|
position: relative;
|
|
3337
3898
|
width: 32%;
|
|
3338
3899
|
margin: 0 0.75em;
|
|
3339
3900
|
z-index: 9;
|
|
3340
3901
|
`;
|
|
3341
|
-
var DrawerButton =
|
|
3902
|
+
var DrawerButton = import_styled_components9.default.button`
|
|
3342
3903
|
padding: 0.4em 1em 0.65em;
|
|
3343
3904
|
position: absolute;
|
|
3344
3905
|
width: 100%;
|
|
@@ -3358,7 +3919,7 @@ var DrawerButton = import_styled_components11.default.button`
|
|
|
3358
3919
|
font-size: 1.8em;
|
|
3359
3920
|
}
|
|
3360
3921
|
`;
|
|
3361
|
-
var DrawerBody =
|
|
3922
|
+
var DrawerBody = import_styled_components9.default.div`
|
|
3362
3923
|
background: #fff;
|
|
3363
3924
|
display: flex;
|
|
3364
3925
|
position: absolute;
|
|
@@ -3375,7 +3936,7 @@ var DrawerBody = import_styled_components11.default.div`
|
|
|
3375
3936
|
transition:
|
|
3376
3937
|
0.3s transform ease-in-out,
|
|
3377
3938
|
0.3s box-shadow;
|
|
3378
|
-
${(props) => props.$open &&
|
|
3939
|
+
${(props) => props.$open && import_styled_components9.css`
|
|
3379
3940
|
box-shadow:
|
|
3380
3941
|
0 -5px 15px 0 rgba(0, 0, 0, 0.1),
|
|
3381
3942
|
0 -3px 5px 0 rgba(0, 0, 0, 0.1);
|
|
@@ -3389,7 +3950,7 @@ var DrawerBody = import_styled_components11.default.div`
|
|
|
3389
3950
|
font-size: 1.1em;
|
|
3390
3951
|
}
|
|
3391
3952
|
`;
|
|
3392
|
-
var LeftPanel =
|
|
3953
|
+
var LeftPanel = import_styled_components9.default.div`
|
|
3393
3954
|
position: absolute;
|
|
3394
3955
|
transform: translateX(-100%);
|
|
3395
3956
|
background: #fff;
|
|
@@ -3399,11 +3960,11 @@ var LeftPanel = import_styled_components11.default.div`
|
|
|
3399
3960
|
z-index: 10;
|
|
3400
3961
|
overflow-y: auto;
|
|
3401
3962
|
transition: 0.5s transform;
|
|
3402
|
-
${(props) => props.$open &&
|
|
3963
|
+
${(props) => props.$open && import_styled_components9.css`
|
|
3403
3964
|
transform: translateX(0);
|
|
3404
3965
|
`}
|
|
3405
3966
|
`;
|
|
3406
|
-
var Lightbox =
|
|
3967
|
+
var Lightbox = import_styled_components9.default.div`
|
|
3407
3968
|
background: rgba(0, 0, 0, 0.4);
|
|
3408
3969
|
pointer-events: none;
|
|
3409
3970
|
position: absolute;
|
|
@@ -3415,15 +3976,15 @@ var Lightbox = import_styled_components11.default.div`
|
|
|
3415
3976
|
opacity: 0;
|
|
3416
3977
|
transition: opacity 0.5s;
|
|
3417
3978
|
|
|
3418
|
-
${(props) => props.$open &&
|
|
3979
|
+
${(props) => props.$open && import_styled_components9.css`
|
|
3419
3980
|
pointer-events: visible;
|
|
3420
3981
|
opacity: 1;
|
|
3421
3982
|
`}
|
|
3422
3983
|
`;
|
|
3423
3984
|
|
|
3424
3985
|
// src/Layout/Layout.styles.ts
|
|
3425
|
-
var
|
|
3426
|
-
var OuterWrapper =
|
|
3986
|
+
var import_styled_components10 = __toESM(require("styled-components"), 1);
|
|
3987
|
+
var OuterWrapper = import_styled_components10.default.div`
|
|
3427
3988
|
display: flex;
|
|
3428
3989
|
flex-direction: column;
|
|
3429
3990
|
flex: 1;
|
|
@@ -3433,19 +3994,19 @@ var OuterWrapper = import_styled_components12.default.div`
|
|
|
3433
3994
|
min-width: 0;
|
|
3434
3995
|
overflow: hidden;
|
|
3435
3996
|
`;
|
|
3436
|
-
var Header2 =
|
|
3997
|
+
var Header2 = import_styled_components10.default.header`
|
|
3437
3998
|
//box-shadow: 0 3px 2px 0 rgba(0, 0, 0, 0.04), 0 1px 0 0 rgba(0, 0, 0, 0.17);
|
|
3438
3999
|
z-index: 200;
|
|
3439
4000
|
`;
|
|
3440
|
-
var Footer =
|
|
4001
|
+
var Footer = import_styled_components10.default.div`
|
|
3441
4002
|
background: #fff;
|
|
3442
4003
|
`;
|
|
3443
|
-
var Main =
|
|
4004
|
+
var Main = import_styled_components10.default.div`
|
|
3444
4005
|
display: flex;
|
|
3445
4006
|
flex: 1 1 0;
|
|
3446
4007
|
min-height: 0;
|
|
3447
4008
|
`;
|
|
3448
|
-
var LeftPanel2 =
|
|
4009
|
+
var LeftPanel2 = import_styled_components10.default.div`
|
|
3449
4010
|
background: #fff;
|
|
3450
4011
|
display: flex;
|
|
3451
4012
|
flex-direction: column;
|
|
@@ -3453,29 +4014,29 @@ var LeftPanel2 = import_styled_components12.default.div`
|
|
|
3453
4014
|
max-width: 720px;
|
|
3454
4015
|
align-items: flex-end;
|
|
3455
4016
|
|
|
3456
|
-
${(props) => props.$motion ?
|
|
4017
|
+
${(props) => props.$motion ? import_styled_components10.css`
|
|
3457
4018
|
transition: max-width 400ms;
|
|
3458
4019
|
` : ""}
|
|
3459
4020
|
|
|
3460
4021
|
${(props) => {
|
|
3461
4022
|
switch (props.$state) {
|
|
3462
4023
|
case "entering":
|
|
3463
|
-
return
|
|
4024
|
+
return import_styled_components10.css`
|
|
3464
4025
|
max-width: ${props.$width};
|
|
3465
4026
|
`;
|
|
3466
4027
|
case "exiting":
|
|
3467
|
-
return
|
|
4028
|
+
return import_styled_components10.css`
|
|
3468
4029
|
max-width: 0;
|
|
3469
4030
|
`;
|
|
3470
4031
|
case "unmounted":
|
|
3471
4032
|
case "exited":
|
|
3472
|
-
return
|
|
4033
|
+
return import_styled_components10.css`
|
|
3473
4034
|
max-width: 0;
|
|
3474
4035
|
`;
|
|
3475
4036
|
}
|
|
3476
4037
|
}}
|
|
3477
4038
|
`;
|
|
3478
|
-
var CenterPanel2 =
|
|
4039
|
+
var CenterPanel2 = import_styled_components10.default.div`
|
|
3479
4040
|
flex: 1 1 0;
|
|
3480
4041
|
background: #e3e7f0;
|
|
3481
4042
|
// background: #efefef;
|
|
@@ -3495,7 +4056,7 @@ var CenterPanel2 = import_styled_components12.default.div`
|
|
|
3495
4056
|
min-width: 0;
|
|
3496
4057
|
}
|
|
3497
4058
|
`;
|
|
3498
|
-
var RightPanel =
|
|
4059
|
+
var RightPanel = import_styled_components10.default.div`
|
|
3499
4060
|
background: #fff;
|
|
3500
4061
|
display: flex;
|
|
3501
4062
|
flex-direction: column;
|
|
@@ -3507,22 +4068,22 @@ var RightPanel = import_styled_components12.default.div`
|
|
|
3507
4068
|
${(props) => {
|
|
3508
4069
|
switch (props.$state) {
|
|
3509
4070
|
case "entering":
|
|
3510
|
-
return
|
|
4071
|
+
return import_styled_components10.css`
|
|
3511
4072
|
max-width: ${props.$width};
|
|
3512
4073
|
`;
|
|
3513
4074
|
case "exiting":
|
|
3514
|
-
return
|
|
4075
|
+
return import_styled_components10.css`
|
|
3515
4076
|
max-width: 0;
|
|
3516
4077
|
`;
|
|
3517
4078
|
case "unmounted":
|
|
3518
4079
|
case "exited":
|
|
3519
|
-
return
|
|
4080
|
+
return import_styled_components10.css`
|
|
3520
4081
|
max-width: 0;
|
|
3521
4082
|
`;
|
|
3522
4083
|
}
|
|
3523
4084
|
}}
|
|
3524
4085
|
`;
|
|
3525
|
-
var PanelContainer =
|
|
4086
|
+
var PanelContainer = import_styled_components10.default.div`
|
|
3526
4087
|
display: flex;
|
|
3527
4088
|
flex: 1;
|
|
3528
4089
|
height: 100%;
|
|
@@ -3533,14 +4094,14 @@ var PanelContainer = import_styled_components12.default.div`
|
|
|
3533
4094
|
${(props) => {
|
|
3534
4095
|
switch (props.$menu) {
|
|
3535
4096
|
case "top":
|
|
3536
|
-
return
|
|
4097
|
+
return import_styled_components10.css`
|
|
3537
4098
|
flex-direction: column;
|
|
3538
4099
|
${PanelMenu} {
|
|
3539
4100
|
flex-direction: column;
|
|
3540
4101
|
}
|
|
3541
4102
|
`;
|
|
3542
4103
|
case "left":
|
|
3543
|
-
return
|
|
4104
|
+
return import_styled_components10.css`
|
|
3544
4105
|
flex-direction: row;
|
|
3545
4106
|
${PanelMenu} {
|
|
3546
4107
|
flex-direction: row;
|
|
@@ -3548,14 +4109,14 @@ var PanelContainer = import_styled_components12.default.div`
|
|
|
3548
4109
|
`;
|
|
3549
4110
|
default:
|
|
3550
4111
|
case "bottom":
|
|
3551
|
-
return
|
|
4112
|
+
return import_styled_components10.css`
|
|
3552
4113
|
flex-direction: column-reverse;
|
|
3553
4114
|
${PanelMenu} {
|
|
3554
4115
|
flex-direction: column;
|
|
3555
4116
|
}
|
|
3556
4117
|
`;
|
|
3557
4118
|
case "right":
|
|
3558
|
-
return
|
|
4119
|
+
return import_styled_components10.css`
|
|
3559
4120
|
flex-direction: row-reverse;
|
|
3560
4121
|
${PanelMenu} {
|
|
3561
4122
|
flex-direction: row;
|
|
@@ -3564,7 +4125,7 @@ var PanelContainer = import_styled_components12.default.div`
|
|
|
3564
4125
|
}
|
|
3565
4126
|
}}
|
|
3566
4127
|
`;
|
|
3567
|
-
var PanelSideMenu =
|
|
4128
|
+
var PanelSideMenu = import_styled_components10.default.div`
|
|
3568
4129
|
background: #fff;
|
|
3569
4130
|
border-top: 1px solid #e3e7f0;
|
|
3570
4131
|
border-right: 1px solid #e3e7f0;
|
|
@@ -3575,7 +4136,7 @@ var PanelSideMenu = import_styled_components12.default.div`
|
|
|
3575
4136
|
padding: 0.3em;
|
|
3576
4137
|
gap: 0.3em; */
|
|
3577
4138
|
`;
|
|
3578
|
-
var PanelSideMenuItem =
|
|
4139
|
+
var PanelSideMenuItem = import_styled_components10.default.button`
|
|
3579
4140
|
cursor: pointer;
|
|
3580
4141
|
aspect-ratio: 1;
|
|
3581
4142
|
width: 3em;
|
|
@@ -3603,17 +4164,17 @@ var PanelSideMenuItem = import_styled_components12.default.button`
|
|
|
3603
4164
|
color: #999;
|
|
3604
4165
|
}
|
|
3605
4166
|
`;
|
|
3606
|
-
var PanelMenu =
|
|
4167
|
+
var PanelMenu = import_styled_components10.default.div`
|
|
3607
4168
|
display: flex;
|
|
3608
4169
|
box-shadow:
|
|
3609
4170
|
0 -3px 2px 0 rgba(0, 0, 0, 0.04),
|
|
3610
4171
|
0 -1px 0 0 rgba(0, 0, 0, 0.17);
|
|
3611
4172
|
|
|
3612
|
-
${(props) => !props.$open && (props.$position === "top" || props.$position === "bottom") ?
|
|
4173
|
+
${(props) => !props.$open && (props.$position === "top" || props.$position === "bottom") ? import_styled_components10.css`
|
|
3613
4174
|
display: none;
|
|
3614
4175
|
` : ""}
|
|
3615
4176
|
`;
|
|
3616
|
-
var PanelContent =
|
|
4177
|
+
var PanelContent = import_styled_components10.default.div`
|
|
3617
4178
|
display: flex;
|
|
3618
4179
|
flex-direction: column;
|
|
3619
4180
|
flex: 1;
|
|
@@ -3622,25 +4183,25 @@ var PanelContent = import_styled_components12.default.div`
|
|
|
3622
4183
|
`;
|
|
3623
4184
|
|
|
3624
4185
|
// src/Layout/components/HandleControls.tsx
|
|
3625
|
-
var
|
|
3626
|
-
var
|
|
4186
|
+
var import_styled_components11 = __toESM(require("styled-components"), 1);
|
|
4187
|
+
var import_react26 = require("react");
|
|
3627
4188
|
|
|
3628
4189
|
// ../ui/icons/ResetIcon.tsx
|
|
3629
|
-
var
|
|
3630
|
-
var ResetIcon = (props) => /* @__PURE__ */ (0,
|
|
3631
|
-
/* @__PURE__ */ (0,
|
|
3632
|
-
/* @__PURE__ */ (0,
|
|
4190
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4191
|
+
var ResetIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", height: "1em", width: "1em", viewBox: "0 0 24 24", ...props, children: [
|
|
4192
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: "M0 0h24v24H0V0z", fill: "none" }),
|
|
4193
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: "M12 5V2L8 6l4 4V7c3.31 0 6 2.69 6 6 0 2.97-2.17 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93 0-4.42-3.58-8-8-8zM6 13c0-1.65.67-3.15 1.76-4.24L6.34 7.34A8.014 8.014 0 0 0 4 13c0 4.08 3.05 7.44 7 7.93v-2.02c-2.83-.48-5-2.94-5-5.91z" })
|
|
3633
4194
|
] });
|
|
3634
4195
|
|
|
3635
4196
|
// src/Layout/components/HandleControls.tsx
|
|
3636
|
-
var
|
|
3637
|
-
var HandleContainer =
|
|
4197
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4198
|
+
var HandleContainer = import_styled_components11.default.div`
|
|
3638
4199
|
position: relative;
|
|
3639
4200
|
width: 1px;
|
|
3640
4201
|
background: rgba(0, 0, 0, 0.2);
|
|
3641
4202
|
z-index: 50;
|
|
3642
4203
|
`;
|
|
3643
|
-
var HandleControl = (0,
|
|
4204
|
+
var HandleControl = (0, import_styled_components11.default)(ButtonReset)`
|
|
3644
4205
|
transition:
|
|
3645
4206
|
opacity 300ms,
|
|
3646
4207
|
transform 300ms;
|
|
@@ -3653,7 +4214,7 @@ var HandleControl = (0, import_styled_components13.default)(ButtonReset)`
|
|
|
3653
4214
|
outline: 2px solid salmon;
|
|
3654
4215
|
}
|
|
3655
4216
|
`;
|
|
3656
|
-
var ResizeHandle = (0,
|
|
4217
|
+
var ResizeHandle = (0, import_styled_components11.default)(HandleControl)`
|
|
3657
4218
|
position: relative;
|
|
3658
4219
|
background: #fff;
|
|
3659
4220
|
height: 40px;
|
|
@@ -3662,7 +4223,7 @@ var ResizeHandle = (0, import_styled_components13.default)(HandleControl)`
|
|
|
3662
4223
|
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2);
|
|
3663
4224
|
user-select: none;
|
|
3664
4225
|
`;
|
|
3665
|
-
var IconControl = (0,
|
|
4226
|
+
var IconControl = (0, import_styled_components11.default)(HandleControl)`
|
|
3666
4227
|
background: #fff;
|
|
3667
4228
|
width: 30px;
|
|
3668
4229
|
height: 30px;
|
|
@@ -3677,7 +4238,7 @@ var IconControl = (0, import_styled_components13.default)(HandleControl)`
|
|
|
3677
4238
|
fill: #9999;
|
|
3678
4239
|
}
|
|
3679
4240
|
`;
|
|
3680
|
-
var OpenControl = (0,
|
|
4241
|
+
var OpenControl = (0, import_styled_components11.default)(HandleControl)`
|
|
3681
4242
|
position: relative;
|
|
3682
4243
|
display: flex;
|
|
3683
4244
|
opacity: 1;
|
|
@@ -3705,7 +4266,7 @@ var OpenControl = (0, import_styled_components13.default)(HandleControl)`
|
|
|
3705
4266
|
font-size: 1.5em;
|
|
3706
4267
|
}
|
|
3707
4268
|
`;
|
|
3708
|
-
var InnerHandleContainer =
|
|
4269
|
+
var InnerHandleContainer = import_styled_components11.default.div`
|
|
3709
4270
|
background: rgba(0, 0, 0, 0);
|
|
3710
4271
|
position: absolute;
|
|
3711
4272
|
width: 21px;
|
|
@@ -3734,7 +4295,7 @@ var InnerHandleContainer = import_styled_components13.default.div`
|
|
|
3734
4295
|
}
|
|
3735
4296
|
}
|
|
3736
4297
|
`;
|
|
3737
|
-
var UnscaledContainer =
|
|
4298
|
+
var UnscaledContainer = import_styled_components11.default.div`
|
|
3738
4299
|
background: rgba(0, 0, 0, 0);
|
|
3739
4300
|
position: absolute;
|
|
3740
4301
|
pointer-events: none;
|
|
@@ -3744,9 +4305,9 @@ var UnscaledContainer = import_styled_components13.default.div`
|
|
|
3744
4305
|
bottom: 0;
|
|
3745
4306
|
z-index: 51; // This will always be quite high.
|
|
3746
4307
|
`;
|
|
3747
|
-
var HandleControls = (0,
|
|
3748
|
-
return /* @__PURE__ */ (0,
|
|
3749
|
-
/* @__PURE__ */ (0,
|
|
4308
|
+
var HandleControls = (0, import_react26.forwardRef)(function HandleControls2({ dir, open, actions, reset }, ref) {
|
|
4309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(HandleContainer, { onClick: () => actions.open(), children: [
|
|
4310
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(UnscaledContainer, { $open: open, $dir: dir, children: !open ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3750
4311
|
OpenControl,
|
|
3751
4312
|
{
|
|
3752
4313
|
$dir: dir,
|
|
@@ -3754,42 +4315,42 @@ var HandleControls = (0, import_react23.forwardRef)(function HandleControls2({ d
|
|
|
3754
4315
|
e.stopPropagation();
|
|
3755
4316
|
actions.open();
|
|
3756
4317
|
},
|
|
3757
|
-
children: /* @__PURE__ */ (0,
|
|
4318
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DownIcon, { rotate: dir === "right" ? 90 : 270 })
|
|
3758
4319
|
}
|
|
3759
4320
|
) : null }),
|
|
3760
|
-
/* @__PURE__ */ (0,
|
|
3761
|
-
open ? /* @__PURE__ */ (0,
|
|
4321
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(InnerHandleContainer, { ref, $open: open, $dir: dir, children: [
|
|
4322
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3762
4323
|
IconControl,
|
|
3763
4324
|
{
|
|
3764
4325
|
onClick: (e) => {
|
|
3765
4326
|
e.stopPropagation();
|
|
3766
4327
|
actions.close();
|
|
3767
4328
|
},
|
|
3768
|
-
children: /* @__PURE__ */ (0,
|
|
4329
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CloseIcon, {})
|
|
3769
4330
|
}
|
|
3770
4331
|
) : null,
|
|
3771
|
-
reset && open ? /* @__PURE__ */ (0,
|
|
4332
|
+
reset && open ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3772
4333
|
IconControl,
|
|
3773
4334
|
{
|
|
3774
4335
|
onClick: (e) => {
|
|
3775
4336
|
e.stopPropagation();
|
|
3776
4337
|
reset();
|
|
3777
4338
|
},
|
|
3778
|
-
children: /* @__PURE__ */ (0,
|
|
4339
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ResetIcon, {})
|
|
3779
4340
|
}
|
|
3780
4341
|
) : null,
|
|
3781
|
-
open ? /* @__PURE__ */ (0,
|
|
4342
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ResizeHandle, {}) : null
|
|
3782
4343
|
] })
|
|
3783
4344
|
] });
|
|
3784
4345
|
});
|
|
3785
4346
|
|
|
3786
4347
|
// src/Layout/components/use-resize-layouts.tsx
|
|
3787
|
-
var
|
|
4348
|
+
var import_react28 = require("react");
|
|
3788
4349
|
|
|
3789
4350
|
// ../ui/madoc/use-event-handler.ts
|
|
3790
|
-
var
|
|
4351
|
+
var import_react27 = require("react");
|
|
3791
4352
|
function useEventHandler(ref, name, callback, deps = []) {
|
|
3792
|
-
(0,
|
|
4353
|
+
(0, import_react27.useLayoutEffect)(() => {
|
|
3793
4354
|
const current = ref.current;
|
|
3794
4355
|
if (current) {
|
|
3795
4356
|
current.addEventListener(name, callback);
|
|
@@ -3814,15 +4375,15 @@ function getMaxWidthPct(container, defaultMaxWidthPct, maxWidthPct, maxWidthPixe
|
|
|
3814
4375
|
return defaultMaxWidthPct;
|
|
3815
4376
|
}
|
|
3816
4377
|
function useResizeLayout(name, options = {}) {
|
|
3817
|
-
const container = (0,
|
|
3818
|
-
const resizableDiv = (0,
|
|
3819
|
-
const otherDiv = (0,
|
|
3820
|
-
const resizer = (0,
|
|
3821
|
-
const newPct = (0,
|
|
3822
|
-
const [isDragging, setIsDragging] = (0,
|
|
3823
|
-
const isEventDragging = (0,
|
|
3824
|
-
const isEventTimeout = (0,
|
|
3825
|
-
const startPos = (0,
|
|
4378
|
+
const container = (0, import_react28.useRef)(null);
|
|
4379
|
+
const resizableDiv = (0, import_react28.useRef)(null);
|
|
4380
|
+
const otherDiv = (0, import_react28.useRef)(null);
|
|
4381
|
+
const resizer = (0, import_react28.useRef)(null);
|
|
4382
|
+
const newPct = (0, import_react28.useRef)(0.5);
|
|
4383
|
+
const [isDragging, setIsDragging] = (0, import_react28.useState)(false);
|
|
4384
|
+
const isEventDragging = (0, import_react28.useRef)(false);
|
|
4385
|
+
const isEventTimeout = (0, import_react28.useRef)(0);
|
|
4386
|
+
const startPos = (0, import_react28.useRef)({ x: 0, y: 0 });
|
|
3826
4387
|
const [{ widthA, widthB }, setWidths] = useLocalStorage(`resize-layout/${name}`, {
|
|
3827
4388
|
widthA: "auto",
|
|
3828
4389
|
widthB: `${panelSizing({
|
|
@@ -3927,39 +4488,34 @@ function useResizeLayout(name, options = {}) {
|
|
|
3927
4488
|
};
|
|
3928
4489
|
}
|
|
3929
4490
|
|
|
3930
|
-
// src/hooks/use-match-media.ts
|
|
3931
|
-
var import_react26 = require("react");
|
|
3932
|
-
function useMatchMedia(queries, defaultValues = []) {
|
|
3933
|
-
const initialValues = defaultValues.length ? defaultValues : Array(queries.length).fill(false);
|
|
3934
|
-
if (typeof window === "undefined")
|
|
3935
|
-
return initialValues;
|
|
3936
|
-
const mediaQueryLists = queries.map((q) => window.matchMedia(q));
|
|
3937
|
-
const getValue2 = () => {
|
|
3938
|
-
const matchedQueries = mediaQueryLists.map((mql) => mql.matches);
|
|
3939
|
-
return matchedQueries;
|
|
3940
|
-
};
|
|
3941
|
-
const [value, setValue] = (0, import_react26.useState)(getValue2);
|
|
3942
|
-
(0, import_react26.useLayoutEffect)(() => {
|
|
3943
|
-
const handler = () => setValue(getValue2);
|
|
3944
|
-
mediaQueryLists.forEach((mql) => mql.addListener(handler));
|
|
3945
|
-
return () => mediaQueryLists.forEach((mql) => mql.removeListener(handler));
|
|
3946
|
-
}, []);
|
|
3947
|
-
return value;
|
|
3948
|
-
}
|
|
3949
|
-
|
|
3950
4491
|
// src/Layout/Layout.tsx
|
|
3951
|
-
var
|
|
3952
|
-
var
|
|
3953
|
-
var Layout = (0, import_react27.memo)(function Layout2(props) {
|
|
4492
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4493
|
+
var Layout = (0, import_react29.memo)(function Layout2(props) {
|
|
3954
4494
|
const appState = useAppState();
|
|
3955
4495
|
const layout = useLayoutProvider();
|
|
3956
|
-
const { vault: _vault } = (0,
|
|
4496
|
+
const { vault: _vault } = (0, import_react29.useContext)(import_react_iiif_vault11.ReactVaultContext);
|
|
3957
4497
|
const vault = _vault || void 0;
|
|
3958
|
-
const {
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
4498
|
+
const {
|
|
4499
|
+
loading,
|
|
4500
|
+
state,
|
|
4501
|
+
leftPanels,
|
|
4502
|
+
centerPanels,
|
|
4503
|
+
rightPanels,
|
|
4504
|
+
modals = [],
|
|
4505
|
+
actions
|
|
4506
|
+
} = layout;
|
|
4507
|
+
const leftPanel = leftPanels.find(
|
|
4508
|
+
(panel) => panel.id === state.leftPanel.current
|
|
4509
|
+
);
|
|
4510
|
+
const rightPanel = rightPanels.find(
|
|
4511
|
+
(panel) => panel.id === state.rightPanel.current
|
|
4512
|
+
);
|
|
4513
|
+
const centerPanel = centerPanels.find(
|
|
4514
|
+
(panel) => panel.id === state.centerPanel.current
|
|
4515
|
+
);
|
|
4516
|
+
const modalToRender = modals.find(
|
|
4517
|
+
(panel) => panel.id === state.modal.current
|
|
4518
|
+
);
|
|
3963
4519
|
const enableMotion = true;
|
|
3964
4520
|
const pinnedRightPanel = state.pinnedRightPanel.pinned ? rightPanels.find((panel) => panel.id === state.pinnedRightPanel.current) : void 0;
|
|
3965
4521
|
const [mobile] = useMatchMedia(["(max-width: 1020px)"]);
|
|
@@ -3991,13 +4547,13 @@ var Layout = (0, import_react27.memo)(function Layout2(props) {
|
|
|
3991
4547
|
fallback: 320
|
|
3992
4548
|
})
|
|
3993
4549
|
}) : void 0;
|
|
3994
|
-
(0,
|
|
4550
|
+
(0, import_react29.useLayoutEffect)(() => {
|
|
3995
4551
|
if (mobile && state.leftPanel.open && state.rightPanel.open) {
|
|
3996
4552
|
actions.leftPanel.close();
|
|
3997
4553
|
actions.rightPanel.close();
|
|
3998
4554
|
}
|
|
3999
4555
|
}, [mobile]);
|
|
4000
|
-
(0,
|
|
4556
|
+
(0, import_react29.useLayoutEffect)(() => {
|
|
4001
4557
|
if (centerPanel && centerPanel.onMount) {
|
|
4002
4558
|
return centerPanel.onMount(
|
|
4003
4559
|
state.centerPanel.state || centerPanel.defaultState || {},
|
|
@@ -4006,7 +4562,7 @@ var Layout = (0, import_react27.memo)(function Layout2(props) {
|
|
|
4006
4562
|
);
|
|
4007
4563
|
}
|
|
4008
4564
|
}, [state.centerPanel.current]);
|
|
4009
|
-
(0,
|
|
4565
|
+
(0, import_react29.useLayoutEffect)(() => {
|
|
4010
4566
|
rightPanels.length && actions.rightPanel.change({ id: rightPanels[0].id });
|
|
4011
4567
|
leftPanels.length && actions.leftPanel.change({ id: leftPanels[0].id });
|
|
4012
4568
|
centerPanels.length && actions.centerPanel.change({ id: centerPanels[0].id });
|
|
@@ -4014,7 +4570,7 @@ var Layout = (0, import_react27.memo)(function Layout2(props) {
|
|
|
4014
4570
|
if (loading) {
|
|
4015
4571
|
return null;
|
|
4016
4572
|
}
|
|
4017
|
-
const renderLeftPanel = (transition) => /* @__PURE__ */ (0,
|
|
4573
|
+
const renderLeftPanel = (transition) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4018
4574
|
PanelContainer,
|
|
4019
4575
|
{
|
|
4020
4576
|
$menu: props.leftPanelMenuPosition || "bottom",
|
|
@@ -4024,8 +4580,8 @@ var Layout = (0, import_react27.memo)(function Layout2(props) {
|
|
|
4024
4580
|
width: state.leftPanel.open || transition !== "exited" ? leftPanelResizer.widthB : void 0,
|
|
4025
4581
|
minWidth: leftPanel?.options?.minWidth
|
|
4026
4582
|
},
|
|
4027
|
-
children: isLoading ? /* @__PURE__ */ (0,
|
|
4028
|
-
props.leftPanelMenu ? /* @__PURE__ */ (0,
|
|
4583
|
+
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PanelContent, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(GhostBlocks, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
4584
|
+
props.leftPanelMenu ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4029
4585
|
PanelMenu,
|
|
4030
4586
|
{
|
|
4031
4587
|
$open: state.leftPanel.open && transition !== "exited",
|
|
@@ -4033,7 +4589,7 @@ var Layout = (0, import_react27.memo)(function Layout2(props) {
|
|
|
4033
4589
|
children: props.leftPanelMenu
|
|
4034
4590
|
}
|
|
4035
4591
|
) : null,
|
|
4036
|
-
/* @__PURE__ */ (0,
|
|
4592
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PanelContent, { children: state.leftPanel.open || transition !== "exited" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: leftPanel ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4037
4593
|
ModularPanel,
|
|
4038
4594
|
{
|
|
4039
4595
|
isLeft: true,
|
|
@@ -4051,7 +4607,7 @@ var Layout = (0, import_react27.memo)(function Layout2(props) {
|
|
|
4051
4607
|
if (!modalToRender || state.modal.open === false) {
|
|
4052
4608
|
return null;
|
|
4053
4609
|
}
|
|
4054
|
-
return /* @__PURE__ */ (0,
|
|
4610
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_components7.Modal, { title: modalToRender.label, onClose: () => actions.modal.close(), children: renderHelper(
|
|
4055
4611
|
modalToRender.render(
|
|
4056
4612
|
state.modal.state || modalToRender.defaultState || {},
|
|
4057
4613
|
{ ...layout, current: actions.modal, vault },
|
|
@@ -4059,9 +4615,27 @@ var Layout = (0, import_react27.memo)(function Layout2(props) {
|
|
|
4059
4615
|
)
|
|
4060
4616
|
) });
|
|
4061
4617
|
};
|
|
4062
|
-
const renderCenterPanel = () => /* @__PURE__ */ (0,
|
|
4063
|
-
props.centerPanelMenu ? /* @__PURE__ */ (0,
|
|
4064
|
-
|
|
4618
|
+
const renderCenterPanel = () => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(PanelContainer, { $menu: props.centerPanelMenuPosition || "top", children: [
|
|
4619
|
+
props.centerPanelMenu ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4620
|
+
PanelMenu,
|
|
4621
|
+
{
|
|
4622
|
+
$open: state.centerPanel.open,
|
|
4623
|
+
$position: props.centerPanelMenuPosition || "top",
|
|
4624
|
+
children: props.centerPanelMenu
|
|
4625
|
+
}
|
|
4626
|
+
) : null,
|
|
4627
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PanelContent, { children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4628
|
+
"div",
|
|
4629
|
+
{
|
|
4630
|
+
style: {
|
|
4631
|
+
display: "flex",
|
|
4632
|
+
flex: 1,
|
|
4633
|
+
justifyContent: "center",
|
|
4634
|
+
alignItems: "center"
|
|
4635
|
+
},
|
|
4636
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Spinner, { stroke: "rgba(0,0,0,.3)", fontSize: "2em" })
|
|
4637
|
+
}
|
|
4638
|
+
) : state.centerPanel.open ? centerPanel ? renderHelper(
|
|
4065
4639
|
centerPanel.render(
|
|
4066
4640
|
state.centerPanel.state || centerPanel.defaultState || {},
|
|
4067
4641
|
{ ...layout, current: actions.centerPanel, vault },
|
|
@@ -4069,7 +4643,7 @@ var Layout = (0, import_react27.memo)(function Layout2(props) {
|
|
|
4069
4643
|
)
|
|
4070
4644
|
) : null : null })
|
|
4071
4645
|
] });
|
|
4072
|
-
const renderRightPanel = (transition) => /* @__PURE__ */ (0,
|
|
4646
|
+
const renderRightPanel = (transition) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4073
4647
|
PanelContainer,
|
|
4074
4648
|
{
|
|
4075
4649
|
$menu: props.rightPanelMenuPosition || "bottom",
|
|
@@ -4079,10 +4653,17 @@ var Layout = (0, import_react27.memo)(function Layout2(props) {
|
|
|
4079
4653
|
width: state.rightPanel.open || transition !== "exited" ? rightPanelResizer.widthB : void 0,
|
|
4080
4654
|
minWidth: rightPanel?.options?.minWidth
|
|
4081
4655
|
},
|
|
4082
|
-
children: isLoading ? /* @__PURE__ */ (0,
|
|
4083
|
-
props.rightPanelMenu ? /* @__PURE__ */ (0,
|
|
4084
|
-
|
|
4085
|
-
|
|
4656
|
+
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PanelContent, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(GhostBlocks, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
4657
|
+
props.rightPanelMenu ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4658
|
+
PanelMenu,
|
|
4659
|
+
{
|
|
4660
|
+
$open: state.rightPanel.open,
|
|
4661
|
+
$position: props.rightPanelMenuPosition || "bottom",
|
|
4662
|
+
children: props.rightPanelMenu
|
|
4663
|
+
}
|
|
4664
|
+
) : null,
|
|
4665
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PanelContent, { children: state.rightPanel.open || transition !== "exited" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
4666
|
+
showRightPanel ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4086
4667
|
ModularPanel,
|
|
4087
4668
|
{
|
|
4088
4669
|
panel: rightPanel,
|
|
@@ -4092,7 +4673,7 @@ var Layout = (0, import_react27.memo)(function Layout2(props) {
|
|
|
4092
4673
|
available: rightPanels
|
|
4093
4674
|
}
|
|
4094
4675
|
) : null,
|
|
4095
|
-
pinnedRightPanel ? /* @__PURE__ */ (0,
|
|
4676
|
+
pinnedRightPanel ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4096
4677
|
ModularPanel,
|
|
4097
4678
|
{
|
|
4098
4679
|
panel: pinnedRightPanel,
|
|
@@ -4106,24 +4687,24 @@ var Layout = (0, import_react27.memo)(function Layout2(props) {
|
|
|
4106
4687
|
}
|
|
4107
4688
|
);
|
|
4108
4689
|
if (mobile) {
|
|
4109
|
-
return /* @__PURE__ */ (0,
|
|
4110
|
-
props.hideHeader ? null : /* @__PURE__ */ (0,
|
|
4690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(OuterWrapper, { children: [
|
|
4691
|
+
props.hideHeader ? null : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Header2, { children: [
|
|
4111
4692
|
props.header || null,
|
|
4112
|
-
props.menu ? /* @__PURE__ */ (0,
|
|
4693
|
+
props.menu ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("menu", { children: props.menu }) : null
|
|
4113
4694
|
] }),
|
|
4114
|
-
/* @__PURE__ */ (0,
|
|
4115
|
-
/* @__PURE__ */ (0,
|
|
4116
|
-
/* @__PURE__ */ (0,
|
|
4117
|
-
leftPanels.length > 0 ? /* @__PURE__ */ (0,
|
|
4118
|
-
rightPanels.length > 0 ? /* @__PURE__ */ (0,
|
|
4119
|
-
/* @__PURE__ */ (0,
|
|
4695
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Main, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Container2, { children: [
|
|
4696
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CenterPanel, { children: renderCenterPanel() }),
|
|
4697
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(MobileBar, { children: [
|
|
4698
|
+
leftPanels.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(LeftBarButton, { onClick: actions.leftPanel.toggle, children: leftPanel?.label }) : null,
|
|
4699
|
+
rightPanels.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DrawerContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(DrawerButton, { onClick: actions.rightPanel.toggle, children: [
|
|
4700
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DownIcon, { rotate: 180 }),
|
|
4120
4701
|
rightPanel?.label
|
|
4121
4702
|
] }) }) : null,
|
|
4122
|
-
/* @__PURE__ */ (0,
|
|
4703
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PreviewBarButton, { children: "Preview" })
|
|
4123
4704
|
] }),
|
|
4124
|
-
rightPanels.length > 0 ? /* @__PURE__ */ (0,
|
|
4125
|
-
leftPanels.length > 0 ? /* @__PURE__ */ (0,
|
|
4126
|
-
leftPanels.length > 0 || rightPanels.length > 0 ? /* @__PURE__ */ (0,
|
|
4705
|
+
rightPanels.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DrawerBody, { $open: state.rightPanel.open, children: renderRightPanel() }) : null,
|
|
4706
|
+
leftPanels.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(LeftPanel, { $open: state.leftPanel.open, children: renderLeftPanel() }) : null,
|
|
4707
|
+
leftPanels.length > 0 || rightPanels.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4127
4708
|
Lightbox,
|
|
4128
4709
|
{
|
|
4129
4710
|
$open: state.leftPanel.open || state.rightPanel.open,
|
|
@@ -4136,12 +4717,12 @@ var Layout = (0, import_react27.memo)(function Layout2(props) {
|
|
|
4136
4717
|
] }) })
|
|
4137
4718
|
] });
|
|
4138
4719
|
}
|
|
4139
|
-
return /* @__PURE__ */ (0,
|
|
4140
|
-
props.hideHeader ? null : /* @__PURE__ */ (0,
|
|
4720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(OuterWrapper, { className: `manifest-editor ${props.className}`, children: [
|
|
4721
|
+
props.hideHeader ? null : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Header2, { children: [
|
|
4141
4722
|
props.header || null,
|
|
4142
|
-
props.menu ? /* @__PURE__ */ (0,
|
|
4723
|
+
props.menu ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("menu", { children: props.menu }) : null
|
|
4143
4724
|
] }),
|
|
4144
|
-
/* @__PURE__ */ (0,
|
|
4725
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
4145
4726
|
Main,
|
|
4146
4727
|
{
|
|
4147
4728
|
ref: (div) => {
|
|
@@ -4149,8 +4730,8 @@ var Layout = (0, import_react27.memo)(function Layout2(props) {
|
|
|
4149
4730
|
rightPanelResizer.refs.container.current = div;
|
|
4150
4731
|
},
|
|
4151
4732
|
children: [
|
|
4152
|
-
leftPanels.length > 0 ? /* @__PURE__ */ (0,
|
|
4153
|
-
|
|
4733
|
+
leftPanels.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4734
|
+
import_components7.PanelSideMenu,
|
|
4154
4735
|
{
|
|
4155
4736
|
current: state.leftPanel.current,
|
|
4156
4737
|
items: leftPanels.map((panel) => ({
|
|
@@ -4169,44 +4750,76 @@ var Layout = (0, import_react27.memo)(function Layout2(props) {
|
|
|
4169
4750
|
open: state.leftPanel.open
|
|
4170
4751
|
}
|
|
4171
4752
|
) : null,
|
|
4172
|
-
leftPanels.length > 0 ? /* @__PURE__ */ (0,
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4753
|
+
leftPanels.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4754
|
+
import_react_transition_group.Transition,
|
|
4755
|
+
{
|
|
4756
|
+
in: state.leftPanel.open,
|
|
4757
|
+
timeout: enableMotion ? 400 : 0,
|
|
4758
|
+
unmountOnExit: false,
|
|
4759
|
+
children: (transition) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
4760
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4761
|
+
LeftPanel2,
|
|
4762
|
+
{
|
|
4763
|
+
$width: leftPanelResizer.widthB,
|
|
4764
|
+
$state: transition,
|
|
4765
|
+
$motion: enableMotion,
|
|
4766
|
+
children: renderLeftPanel(transition)
|
|
4767
|
+
}
|
|
4768
|
+
),
|
|
4769
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4770
|
+
HandleControls,
|
|
4771
|
+
{
|
|
4772
|
+
ref: leftPanelResizer.refs.resizer,
|
|
4773
|
+
reset: resetLeftPanel,
|
|
4774
|
+
dir: "left",
|
|
4775
|
+
transition,
|
|
4776
|
+
open: state.leftPanel.open || transition !== "exited",
|
|
4777
|
+
actions: actions.leftPanel
|
|
4778
|
+
}
|
|
4779
|
+
)
|
|
4780
|
+
] })
|
|
4781
|
+
}
|
|
4782
|
+
) : null,
|
|
4783
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CenterPanel2, { children: renderCenterPanel() }),
|
|
4784
|
+
rightPanels.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4785
|
+
import_react_transition_group.Transition,
|
|
4786
|
+
{
|
|
4787
|
+
in: state.rightPanel.open,
|
|
4788
|
+
timeout: enableMotion ? 400 : 0,
|
|
4789
|
+
unmountOnExit: false,
|
|
4790
|
+
children: (transition) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
4791
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4792
|
+
HandleControls,
|
|
4793
|
+
{
|
|
4794
|
+
ref: rightPanelResizer.refs.resizer,
|
|
4795
|
+
dir: "right",
|
|
4796
|
+
reset: resetRightPanel,
|
|
4797
|
+
open: state.rightPanel.open,
|
|
4798
|
+
actions: actions.rightPanel
|
|
4799
|
+
}
|
|
4800
|
+
),
|
|
4801
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4802
|
+
RightPanel,
|
|
4803
|
+
{
|
|
4804
|
+
$width: rightPanelResizer.widthB,
|
|
4805
|
+
$state: transition,
|
|
4806
|
+
$motion: enableMotion,
|
|
4807
|
+
children: renderRightPanel(transition)
|
|
4808
|
+
}
|
|
4809
|
+
)
|
|
4810
|
+
] })
|
|
4811
|
+
}
|
|
4812
|
+
) : null
|
|
4200
4813
|
]
|
|
4201
4814
|
}
|
|
4202
4815
|
),
|
|
4203
|
-
/* @__PURE__ */ (0,
|
|
4204
|
-
/* @__PURE__ */ (0,
|
|
4816
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Footer, { children: props.footer || null }),
|
|
4817
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: renderModal() })
|
|
4205
4818
|
] });
|
|
4206
4819
|
});
|
|
4207
4820
|
|
|
4208
4821
|
// src/Layout/Layout.hooks.ts
|
|
4209
|
-
var
|
|
4822
|
+
var import_react30 = require("react");
|
|
4210
4823
|
function usePanelActions(panel, dispatch) {
|
|
4211
4824
|
function popStack() {
|
|
4212
4825
|
dispatch({ type: "popStack", panel, payload: void 0 });
|
|
@@ -4241,7 +4854,7 @@ function usePanelActions(panel, dispatch) {
|
|
|
4241
4854
|
function unpin() {
|
|
4242
4855
|
dispatch({ type: "unpin", panel, payload: void 0 });
|
|
4243
4856
|
}
|
|
4244
|
-
return (0,
|
|
4857
|
+
return (0, import_react30.useMemo)(
|
|
4245
4858
|
() => ({
|
|
4246
4859
|
popStack,
|
|
4247
4860
|
change,
|
|
@@ -4407,14 +5020,14 @@ function getDefaultLayoutState() {
|
|
|
4407
5020
|
}
|
|
4408
5021
|
|
|
4409
5022
|
// src/ResourceEditingContext/ResourceEditingContext.tsx
|
|
4410
|
-
var
|
|
5023
|
+
var import_react31 = require("react");
|
|
4411
5024
|
var import_react_iiif_vault12 = require("react-iiif-vault");
|
|
4412
|
-
var
|
|
4413
|
-
var ResourceEditingReactContext = (0,
|
|
5025
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
5026
|
+
var ResourceEditingReactContext = (0, import_react31.createContext)({
|
|
4414
5027
|
resource: null
|
|
4415
5028
|
});
|
|
4416
5029
|
function useEditingContext() {
|
|
4417
|
-
return (0,
|
|
5030
|
+
return (0, import_react31.useContext)(ResourceEditingReactContext);
|
|
4418
5031
|
}
|
|
4419
5032
|
function useResource() {
|
|
4420
5033
|
const vault = (0, import_react_iiif_vault12.useVault)();
|
|
@@ -4435,10 +5048,10 @@ function ResourceEditingProvider({
|
|
|
4435
5048
|
children
|
|
4436
5049
|
}) {
|
|
4437
5050
|
const { id, type } = resource || {};
|
|
4438
|
-
return /* @__PURE__ */ (0,
|
|
5051
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4439
5052
|
ResourceEditingReactContext.Provider,
|
|
4440
5053
|
{
|
|
4441
|
-
value: (0,
|
|
5054
|
+
value: (0, import_react31.useMemo)(
|
|
4442
5055
|
() => ({
|
|
4443
5056
|
// Current resource.
|
|
4444
5057
|
resource: id && type ? { id, type } : null
|
|
@@ -4450,10 +5063,13 @@ function ResourceEditingProvider({
|
|
|
4450
5063
|
);
|
|
4451
5064
|
}
|
|
4452
5065
|
|
|
5066
|
+
// src/ShellContext/ShellContext.tsx
|
|
5067
|
+
var import_iiif_image_api = require("@atlas-viewer/iiif-image-api");
|
|
5068
|
+
|
|
4453
5069
|
// ../ui/atoms/ErrorBoundary.tsx
|
|
4454
|
-
var
|
|
4455
|
-
var
|
|
4456
|
-
var ErrorBoundary2 = class extends
|
|
5070
|
+
var import_react32 = require("react");
|
|
5071
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
5072
|
+
var ErrorBoundary2 = class extends import_react32.Component {
|
|
4457
5073
|
constructor() {
|
|
4458
5074
|
super(...arguments);
|
|
4459
5075
|
__publicField(this, "state", {
|
|
@@ -4469,34 +5085,43 @@ var ErrorBoundary2 = class extends import_react30.Component {
|
|
|
4469
5085
|
}
|
|
4470
5086
|
render() {
|
|
4471
5087
|
if (this.state.hasError) {
|
|
4472
|
-
return /* @__PURE__ */ (0,
|
|
5088
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h1", { children: "Sorry.. there was an error" });
|
|
4473
5089
|
}
|
|
4474
5090
|
return this.props.children;
|
|
4475
5091
|
}
|
|
4476
5092
|
};
|
|
4477
5093
|
|
|
4478
5094
|
// src/ShellContext/ShellContext.tsx
|
|
4479
|
-
var
|
|
5095
|
+
var import_react34 = require("react");
|
|
5096
|
+
var import_react_iiif_vault13 = require("react-iiif-vault");
|
|
5097
|
+
var import_styled_components12 = require("styled-components");
|
|
4480
5098
|
|
|
4481
5099
|
// src/Layout/Layout.context-internal.tsx
|
|
4482
5100
|
var import_parser6 = require("@iiif/parser");
|
|
4483
|
-
var
|
|
4484
|
-
var
|
|
5101
|
+
var import_react33 = require("react");
|
|
5102
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4485
5103
|
function parse(args, _state) {
|
|
4486
5104
|
if (typeof args === "string") {
|
|
4487
5105
|
return { id: args, state: _state };
|
|
4488
5106
|
}
|
|
4489
5107
|
return args;
|
|
4490
5108
|
}
|
|
4491
|
-
var LayoutProvider = (0,
|
|
5109
|
+
var LayoutProvider = (0, import_react33.memo)(function LayoutProvider2(props) {
|
|
4492
5110
|
const app = useApp();
|
|
4493
5111
|
const available = app.layout;
|
|
4494
|
-
const [state, dispatch] = (0,
|
|
5112
|
+
const [state, dispatch] = (0, import_react33.useReducer)(
|
|
5113
|
+
layoutReducer,
|
|
5114
|
+
void 0,
|
|
5115
|
+
getDefaultLayoutState
|
|
5116
|
+
);
|
|
4495
5117
|
const actions = {
|
|
4496
5118
|
centerPanel: usePanelActions("centerPanel", dispatch),
|
|
4497
5119
|
leftPanel: usePanelActions("leftPanel", dispatch),
|
|
4498
5120
|
rightPanel: usePanelActions("rightPanel", dispatch),
|
|
4499
|
-
pinnedRightPanel: usePanelActions(
|
|
5121
|
+
pinnedRightPanel: usePanelActions(
|
|
5122
|
+
"pinnedRightPanel",
|
|
5123
|
+
dispatch
|
|
5124
|
+
),
|
|
4500
5125
|
modal: usePanelActions("modal", dispatch),
|
|
4501
5126
|
editingStack: useEditingStack()
|
|
4502
5127
|
};
|
|
@@ -4519,7 +5144,10 @@ var LayoutProvider = (0, import_react31.memo)(function LayoutProvider2(props) {
|
|
|
4519
5144
|
const { id, state: state2, stacked } = parse(args, _state);
|
|
4520
5145
|
const [found, actions2, pinnable] = find(id);
|
|
4521
5146
|
if (pinnable && found.options?.openPinned) {
|
|
4522
|
-
pinnable.pin({
|
|
5147
|
+
pinnable.pin({
|
|
5148
|
+
id,
|
|
5149
|
+
state: { ...found.defaultState || {}, ...state2 || {} }
|
|
5150
|
+
});
|
|
4523
5151
|
} else {
|
|
4524
5152
|
actions2.open({
|
|
4525
5153
|
id,
|
|
@@ -4556,7 +5184,11 @@ var LayoutProvider = (0, import_react31.memo)(function LayoutProvider2(props) {
|
|
|
4556
5184
|
const [, actions2] = find(id);
|
|
4557
5185
|
actions2.toggle();
|
|
4558
5186
|
}
|
|
4559
|
-
function edit(resource, context = {}, {
|
|
5187
|
+
function edit(resource, context = {}, {
|
|
5188
|
+
reset,
|
|
5189
|
+
property,
|
|
5190
|
+
stacked
|
|
5191
|
+
} = {}) {
|
|
4560
5192
|
const toEdit = {
|
|
4561
5193
|
resource: (0, import_parser6.isSpecificResource)(resource) ? resource : {
|
|
4562
5194
|
type: "SpecificResource",
|
|
@@ -4576,7 +5208,7 @@ var LayoutProvider = (0, import_react31.memo)(function LayoutProvider2(props) {
|
|
|
4576
5208
|
}
|
|
4577
5209
|
function create2(resource) {
|
|
4578
5210
|
actions.editingStack.create(resource, {});
|
|
4579
|
-
if (available.modals
|
|
5211
|
+
if (available.modals?.find((e) => e.id === "@manifest-editor/creator")) {
|
|
4580
5212
|
actions.modal.open({
|
|
4581
5213
|
id: "@manifest-editor/creator",
|
|
4582
5214
|
stacked: true,
|
|
@@ -4601,7 +5233,13 @@ var LayoutProvider = (0, import_react31.memo)(function LayoutProvider2(props) {
|
|
|
4601
5233
|
edit,
|
|
4602
5234
|
create: create2
|
|
4603
5235
|
};
|
|
4604
|
-
return /* @__PURE__ */ (0,
|
|
5236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5237
|
+
LayoutActionsReactContext.Provider,
|
|
5238
|
+
{
|
|
5239
|
+
value: (0, import_react33.useMemo)(() => ({ ...actions, ...otherActions }), [available]),
|
|
5240
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(LayoutStateReactContext.Provider, { value: state, children: props.children })
|
|
5241
|
+
}
|
|
5242
|
+
);
|
|
4605
5243
|
});
|
|
4606
5244
|
|
|
4607
5245
|
// src/ShellContext/default-theme.ts
|
|
@@ -4650,13 +5288,11 @@ var defaultTheme = {
|
|
|
4650
5288
|
};
|
|
4651
5289
|
|
|
4652
5290
|
// src/ShellContext/ShellContext.tsx
|
|
4653
|
-
var
|
|
4654
|
-
var import_iiif_image_api = require("@atlas-viewer/iiif-image-api");
|
|
4655
|
-
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
5291
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
4656
5292
|
var previewConfigs = [
|
|
4657
5293
|
{
|
|
4658
5294
|
id: "universal-viewer",
|
|
4659
|
-
config: { url: "https://
|
|
5295
|
+
config: { url: "https://universalviewer.dev/#?iiifManifestId={manifestId}" },
|
|
4660
5296
|
type: "external-manifest-preview",
|
|
4661
5297
|
label: "Universal viewer"
|
|
4662
5298
|
},
|
|
@@ -4697,17 +5333,32 @@ function ShellProvider({
|
|
|
4697
5333
|
resource,
|
|
4698
5334
|
editing
|
|
4699
5335
|
}) {
|
|
4700
|
-
|
|
5336
|
+
const existingConfig = useConfig();
|
|
5337
|
+
const mergedConfig = (0, import_react34.useMemo)(() => {
|
|
5338
|
+
return {
|
|
5339
|
+
...existingConfig,
|
|
5340
|
+
...config,
|
|
5341
|
+
previews: config?.previews || existingConfig.previews || previewConfigs
|
|
5342
|
+
};
|
|
5343
|
+
}, [existingConfig, config]);
|
|
5344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ErrorBoundary2, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_iiif_vault13.ImageServiceLoaderContext.Provider, { value: imageServiceLoader, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AppResourceProvider, { resource, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PreviewVaultContext, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_styled_components12.ThemeProvider, { theme: theme || defaultTheme, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ConfigProvider, { config: mergedConfig, saveConfig, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(EditingStack, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(LayoutProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5345
|
+
PreviewProvider,
|
|
5346
|
+
{
|
|
5347
|
+
previews: previews || [],
|
|
5348
|
+
configs: mergedConfig.previews,
|
|
5349
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AtlasStoreProvider, { children })
|
|
5350
|
+
}
|
|
5351
|
+
) }) }) }) }) }) }) }) });
|
|
4701
5352
|
}
|
|
4702
5353
|
|
|
4703
5354
|
// src/TaskBridge/TaskBridge.tsx
|
|
4704
|
-
var
|
|
4705
|
-
var
|
|
4706
|
-
var
|
|
5355
|
+
var import_mitt3 = __toESM(require("mitt"), 1);
|
|
5356
|
+
var import_react35 = require("react");
|
|
5357
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4707
5358
|
var tempGlobalState = {};
|
|
4708
|
-
var DispatchReactContext = (0,
|
|
5359
|
+
var DispatchReactContext = (0, import_react35.createContext)("global");
|
|
4709
5360
|
function useCurrentDispatchId() {
|
|
4710
|
-
return (0,
|
|
5361
|
+
return (0, import_react35.useContext)(DispatchReactContext);
|
|
4711
5362
|
}
|
|
4712
5363
|
function createDeferred() {
|
|
4713
5364
|
let res = void 0;
|
|
@@ -4720,15 +5371,15 @@ function createDeferred() {
|
|
|
4720
5371
|
}
|
|
4721
5372
|
function useTask(name) {
|
|
4722
5373
|
const id = useCurrentDispatchId();
|
|
4723
|
-
const [, invalidate] = (0,
|
|
4724
|
-
const task = (0,
|
|
5374
|
+
const [, invalidate] = (0, import_react35.useReducer)((r) => r + 1, 0);
|
|
5375
|
+
const task = (0, import_react35.useMemo)(() => {
|
|
4725
5376
|
if (!tempGlobalState[id]) {
|
|
4726
5377
|
tempGlobalState[id] = {};
|
|
4727
5378
|
}
|
|
4728
5379
|
if (!tempGlobalState[id][name]) {
|
|
4729
5380
|
tempGlobalState[id][name] = {
|
|
4730
5381
|
name,
|
|
4731
|
-
emitter: (0,
|
|
5382
|
+
emitter: (0, import_mitt3.default)(),
|
|
4732
5383
|
status: "idle",
|
|
4733
5384
|
promise: Promise.resolve(),
|
|
4734
5385
|
abort: new AbortController(),
|
|
@@ -4745,8 +5396,8 @@ function useTask(name) {
|
|
|
4745
5396
|
return task;
|
|
4746
5397
|
}
|
|
4747
5398
|
function useTaskEvent(task, name, _cb) {
|
|
4748
|
-
const cb = (0,
|
|
4749
|
-
(0,
|
|
5399
|
+
const cb = (0, import_react35.useCallback)(() => _cb(task), [_cb]);
|
|
5400
|
+
(0, import_react35.useEffect)(() => {
|
|
4750
5401
|
const em = task.emitter;
|
|
4751
5402
|
em.on(name, cb);
|
|
4752
5403
|
return () => em.off(name, cb);
|
|
@@ -4795,12 +5446,12 @@ function useTaskRunner(name, onRun) {
|
|
|
4795
5446
|
return [completeTask, taskDetails, rejectTask];
|
|
4796
5447
|
}
|
|
4797
5448
|
function TaskBridge({ children }) {
|
|
4798
|
-
return /* @__PURE__ */ (0,
|
|
5449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(DispatchReactContext.Provider, { value: (0, import_react35.useMemo)(() => `id-${Date.now()}`, []), children });
|
|
4799
5450
|
}
|
|
4800
5451
|
|
|
4801
5452
|
// src/Universal/UniversalCopyPaste.tsx
|
|
4802
|
-
var
|
|
4803
|
-
var
|
|
5453
|
+
var import_react36 = require("react");
|
|
5454
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4804
5455
|
function analyse(t) {
|
|
4805
5456
|
return false;
|
|
4806
5457
|
}
|
|
@@ -4825,10 +5476,10 @@ function UniversalCopyTarget({
|
|
|
4825
5476
|
const onPasteReference = _onPasteReference || onReference;
|
|
4826
5477
|
const onPasteLink = _onPasteLink || onLink;
|
|
4827
5478
|
const onPasteAnalysis = _onPasteAnalysis || onAnalysis;
|
|
4828
|
-
const reference = (0,
|
|
5479
|
+
const reference = (0, import_react36.useMemo)(() => {
|
|
4829
5480
|
return _ref;
|
|
4830
5481
|
}, [_ref?.id, _ref?.type]);
|
|
4831
|
-
const onCopy = (0,
|
|
5482
|
+
const onCopy = (0, import_react36.useCallback)(
|
|
4832
5483
|
function onCopy2(e) {
|
|
4833
5484
|
if (e.defaultPrevented) {
|
|
4834
5485
|
return;
|
|
@@ -4848,7 +5499,7 @@ function UniversalCopyTarget({
|
|
|
4848
5499
|
},
|
|
4849
5500
|
[reference]
|
|
4850
5501
|
);
|
|
4851
|
-
const onPaste = (0,
|
|
5502
|
+
const onPaste = (0, import_react36.useCallback)(async function onPaste2(e) {
|
|
4852
5503
|
if (e.defaultPrevented) {
|
|
4853
5504
|
return;
|
|
4854
5505
|
}
|
|
@@ -4895,7 +5546,7 @@ function UniversalCopyTarget({
|
|
|
4895
5546
|
}
|
|
4896
5547
|
}
|
|
4897
5548
|
}, []);
|
|
4898
|
-
const onDragStart = (0,
|
|
5549
|
+
const onDragStart = (0, import_react36.useCallback)(function onPaste2(e) {
|
|
4899
5550
|
if (e.defaultPrevented) {
|
|
4900
5551
|
return;
|
|
4901
5552
|
}
|
|
@@ -4913,7 +5564,7 @@ function UniversalCopyTarget({
|
|
|
4913
5564
|
}
|
|
4914
5565
|
}
|
|
4915
5566
|
}, []);
|
|
4916
|
-
const onDrop = (0,
|
|
5567
|
+
const onDrop = (0, import_react36.useCallback)(async function onDrop2(e) {
|
|
4917
5568
|
e.preventDefault();
|
|
4918
5569
|
if (e.dataTransfer) {
|
|
4919
5570
|
if (onDropReference) {
|
|
@@ -4940,13 +5591,13 @@ function UniversalCopyTarget({
|
|
|
4940
5591
|
}
|
|
4941
5592
|
}
|
|
4942
5593
|
}, []);
|
|
4943
|
-
const onDragOver = (0,
|
|
5594
|
+
const onDragOver = (0, import_react36.useCallback)((e) => {
|
|
4944
5595
|
e.preventDefault();
|
|
4945
5596
|
if (e.dataTransfer) {
|
|
4946
5597
|
e.dataTransfer.dropEffect = "copy";
|
|
4947
5598
|
}
|
|
4948
5599
|
}, []);
|
|
4949
|
-
return /* @__PURE__ */ (0,
|
|
5600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4950
5601
|
Component2,
|
|
4951
5602
|
{
|
|
4952
5603
|
onCopy,
|
|
@@ -5146,11 +5797,11 @@ async function getImageDimensions(url) {
|
|
|
5146
5797
|
}
|
|
5147
5798
|
|
|
5148
5799
|
// src/hooks/use-save-vault.ts
|
|
5149
|
-
var
|
|
5800
|
+
var import_react37 = require("react");
|
|
5150
5801
|
var import_tiny_use_debounce = require("tiny-use-debounce");
|
|
5151
5802
|
function useSaveVault(vault, saveChanges, saveInterval, enabled = true) {
|
|
5152
5803
|
const debounceSaveChanges = (0, import_tiny_use_debounce.useDebounce)(saveChanges, saveInterval);
|
|
5153
|
-
(0,
|
|
5804
|
+
(0, import_react37.useEffect)(() => {
|
|
5154
5805
|
if (typeof window === "undefined") {
|
|
5155
5806
|
return () => void 0;
|
|
5156
5807
|
}
|
|
@@ -5160,10 +5811,139 @@ function useSaveVault(vault, saveChanges, saveInterval, enabled = true) {
|
|
|
5160
5811
|
window.removeEventListener("beforeunload", saveChanges);
|
|
5161
5812
|
};
|
|
5162
5813
|
}, [saveChanges]);
|
|
5163
|
-
(0,
|
|
5814
|
+
(0, import_react37.useEffect)(() => {
|
|
5164
5815
|
if (vault && enabled) {
|
|
5165
5816
|
return vault.subscribe(debounceSaveChanges, true);
|
|
5166
5817
|
}
|
|
5167
5818
|
}, [debounceSaveChanges, vault, enabled]);
|
|
5168
5819
|
}
|
|
5820
|
+
|
|
5821
|
+
// src/hooks/use-svg-tools.tsx
|
|
5822
|
+
var import_react38 = require("react");
|
|
5823
|
+
var import_zustand2 = require("zustand");
|
|
5824
|
+
function useSvgTools() {
|
|
5825
|
+
const store = useAtlasStore();
|
|
5826
|
+
const switchTool = (0, import_zustand2.useStore)(store, (s) => s.switchTool);
|
|
5827
|
+
const state = (0, import_zustand2.useStore)(store, (s) => s.polygons.state.slowState);
|
|
5828
|
+
return (0, import_react38.useMemo)(
|
|
5829
|
+
() => ({
|
|
5830
|
+
// Draw tool.
|
|
5831
|
+
draw: {
|
|
5832
|
+
active: !state.lineMode && !state.selectedStamp && state.drawMode,
|
|
5833
|
+
enable: switchTool.draw
|
|
5834
|
+
},
|
|
5835
|
+
// Polygon.
|
|
5836
|
+
polygon: {
|
|
5837
|
+
active: !state.lineMode && !state.selectedStamp && !state.drawMode,
|
|
5838
|
+
enable: switchTool.polygon
|
|
5839
|
+
},
|
|
5840
|
+
// Line
|
|
5841
|
+
line: {
|
|
5842
|
+
active: state.lineMode && !state.lineBoxMode,
|
|
5843
|
+
enable: switchTool.line
|
|
5844
|
+
},
|
|
5845
|
+
// Line box.
|
|
5846
|
+
lineBox: {
|
|
5847
|
+
active: state.lineBoxMode,
|
|
5848
|
+
enable: switchTool.lineBox
|
|
5849
|
+
},
|
|
5850
|
+
// Square.
|
|
5851
|
+
square: {
|
|
5852
|
+
active: state.selectedStamp?.id === "square",
|
|
5853
|
+
enable: switchTool.square
|
|
5854
|
+
},
|
|
5855
|
+
// Triangle.
|
|
5856
|
+
triangle: {
|
|
5857
|
+
active: state.selectedStamp?.id === "triangle",
|
|
5858
|
+
enable: switchTool.triangle
|
|
5859
|
+
},
|
|
5860
|
+
// Hexagon.
|
|
5861
|
+
hexagon: {
|
|
5862
|
+
active: state.selectedStamp?.id === "hexagon",
|
|
5863
|
+
enable: switchTool.hexagon
|
|
5864
|
+
},
|
|
5865
|
+
// Circle
|
|
5866
|
+
circle: {
|
|
5867
|
+
active: state.selectedStamp?.id === "circle40",
|
|
5868
|
+
enable: switchTool.circle
|
|
5869
|
+
},
|
|
5870
|
+
// Delete
|
|
5871
|
+
remove: {
|
|
5872
|
+
active: state.showBoundingBox,
|
|
5873
|
+
enable: switchTool.remove
|
|
5874
|
+
}
|
|
5875
|
+
}),
|
|
5876
|
+
[state, switchTool]
|
|
5877
|
+
);
|
|
5878
|
+
}
|
|
5879
|
+
|
|
5880
|
+
// src/hooks/use-request-annotation.ts
|
|
5881
|
+
var import_react39 = require("react");
|
|
5882
|
+
var import_zustand3 = require("zustand");
|
|
5883
|
+
function useRequestAnnotation(opts) {
|
|
5884
|
+
const [id, setId] = (0, import_react39.useState)(0);
|
|
5885
|
+
const store = useAtlasStore();
|
|
5886
|
+
const { tool, getRequestId, requestAnnotation, completeRequest, cancelRequest } = (0, import_zustand3.useStore)(store, (s) => ({
|
|
5887
|
+
getRequestId: s.getRequestId,
|
|
5888
|
+
requestAnnotation: s.requestAnnotation,
|
|
5889
|
+
completeRequest: s.completeRequest,
|
|
5890
|
+
cancelRequest: s.cancelRequest,
|
|
5891
|
+
tool: s.tool
|
|
5892
|
+
}));
|
|
5893
|
+
const [isPending, setIsPending] = (0, import_react39.useState)(false);
|
|
5894
|
+
const [data, setData] = (0, import_react39.useState)(null);
|
|
5895
|
+
const [requestId, setRequestId] = (0, import_react39.useState)(null);
|
|
5896
|
+
const busy = tool.enabled && tool.requestId !== requestId;
|
|
5897
|
+
const mutateAsync = (0, import_react39.useCallback)(
|
|
5898
|
+
async (request, options) => {
|
|
5899
|
+
if (requestId) {
|
|
5900
|
+
setIsPending(true);
|
|
5901
|
+
const response = await requestAnnotation(request, {
|
|
5902
|
+
...options,
|
|
5903
|
+
requestId
|
|
5904
|
+
});
|
|
5905
|
+
if (response) {
|
|
5906
|
+
opts?.onSuccess?.(response);
|
|
5907
|
+
setId((i) => i + 1);
|
|
5908
|
+
setIsPending(false);
|
|
5909
|
+
setData(response);
|
|
5910
|
+
return response;
|
|
5911
|
+
}
|
|
5912
|
+
const resp = {
|
|
5913
|
+
id: requestId,
|
|
5914
|
+
cancelled: true,
|
|
5915
|
+
...requestToAnnotationResponse(request)
|
|
5916
|
+
};
|
|
5917
|
+
opts?.onSuccess?.(resp);
|
|
5918
|
+
setData(resp);
|
|
5919
|
+
setId((i) => i + 1);
|
|
5920
|
+
setIsPending(false);
|
|
5921
|
+
return resp;
|
|
5922
|
+
}
|
|
5923
|
+
return null;
|
|
5924
|
+
},
|
|
5925
|
+
[opts?.onSuccess, requestAnnotation, requestId]
|
|
5926
|
+
);
|
|
5927
|
+
const reset = (0, import_react39.useCallback)(() => {
|
|
5928
|
+
setData(null);
|
|
5929
|
+
setIsPending(false);
|
|
5930
|
+
}, []);
|
|
5931
|
+
(0, import_react39.useEffect)(() => {
|
|
5932
|
+
const request = getRequestId();
|
|
5933
|
+
setRequestId(request.requestId);
|
|
5934
|
+
return () => {
|
|
5935
|
+
request.clear();
|
|
5936
|
+
};
|
|
5937
|
+
}, [id]);
|
|
5938
|
+
return {
|
|
5939
|
+
id,
|
|
5940
|
+
busy,
|
|
5941
|
+
isPending,
|
|
5942
|
+
requestAnnotation: mutateAsync,
|
|
5943
|
+
cancelRequest: () => requestId ? cancelRequest(requestId) : void 0,
|
|
5944
|
+
completeRequest: () => requestId ? completeRequest(requestId) : void 0,
|
|
5945
|
+
reset,
|
|
5946
|
+
data
|
|
5947
|
+
};
|
|
5948
|
+
}
|
|
5169
5949
|
//# sourceMappingURL=index.cjs.map
|