react-iiif-vault 0.9.9 → 0.9.12
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/.build/types/canvas-panel/Viewer.d.ts +13 -0
- package/.build/types/canvas-panel/index.d.ts +18 -0
- package/.build/types/canvas-panel/render/Annotation.d.ts +8 -0
- package/.build/types/canvas-panel/render/AnnotationPage.d.ts +6 -0
- package/.build/types/canvas-panel/render/Audio.d.ts +6 -0
- package/.build/types/canvas-panel/render/Canvas.d.ts +23 -0
- package/.build/types/canvas-panel/render/DefaultCanvasFallback.d.ts +5 -0
- package/.build/types/canvas-panel/render/Image.d.ts +13 -0
- package/.build/types/canvas-panel/render/Model.d.ts +3 -0
- package/.build/types/canvas-panel/render/Video.d.ts +6 -0
- package/.build/types/context/AnnotationContext.d.ts +5 -0
- package/.build/types/context/CanvasContext.d.ts +5 -0
- package/.build/types/context/CollectionContext.d.ts +5 -0
- package/.build/types/context/ContextBridge.d.ts +22 -0
- package/.build/types/context/ImageServiceLoaderContext.d.ts +4 -0
- package/.build/types/context/ManifestContext.d.ts +5 -0
- package/.build/types/context/MediaContext.d.ts +17 -0
- package/.build/types/context/PortalContext.d.ts +7 -0
- package/.build/types/context/RangeContext.d.ts +5 -0
- package/.build/types/context/ResourceContext.d.ts +14 -0
- package/.build/types/context/VaultContext.d.ts +14 -0
- package/.build/types/context/ViewerPresetContext.d.ts +3 -0
- package/.build/types/context/VisibleCanvasContext.d.ts +4 -0
- package/.build/types/demo/demo.d.ts +1 -0
- package/.build/types/demo/media-controls.d.ts +1 -0
- package/.build/types/demo/viewer-controls.d.ts +1 -0
- package/.build/types/features/rendering-strategy/3d-strategy.d.ts +13 -0
- package/.build/types/features/rendering-strategy/audio-strategy.d.ts +3 -0
- package/.build/types/features/rendering-strategy/choice-types.d.ts +15 -0
- package/.build/types/features/rendering-strategy/image-strategy.d.ts +13 -0
- package/.build/types/features/rendering-strategy/rendering-utils.d.ts +21 -0
- package/.build/types/features/rendering-strategy/resource-types.d.ts +42 -0
- package/.build/types/features/rendering-strategy/selector-extensions.d.ts +53 -0
- package/.build/types/features/rendering-strategy/strategies.d.ts +22 -0
- package/.build/types/features/rendering-strategy/video-strategy.d.ts +3 -0
- package/.build/types/hooks/useAnnotation.d.ts +8 -0
- package/.build/types/hooks/useAnnotationPageManager.d.ts +10 -0
- package/.build/types/hooks/useAnnotationsAtTime.d.ts +4 -0
- package/.build/types/hooks/useCanvas.d.ts +8 -0
- package/.build/types/hooks/useCanvasClock.d.ts +1 -0
- package/.build/types/hooks/useCanvasSelector.d.ts +0 -0
- package/.build/types/hooks/useCanvasTimeline.d.ts +0 -0
- package/.build/types/hooks/useCollection.d.ts +8 -0
- package/.build/types/hooks/useDispatch.d.ts +2 -0
- package/.build/types/hooks/useEnabledAnnotationPageIds.d.ts +1 -0
- package/.build/types/hooks/useEventListener.d.ts +4 -0
- package/.build/types/hooks/useExistingVault.d.ts +1 -0
- package/.build/types/hooks/useExternalCollection.d.ts +13 -0
- package/.build/types/hooks/useExternalManifest.d.ts +13 -0
- package/.build/types/hooks/useExternalResource.d.ts +16 -0
- package/.build/types/hooks/useImageService.d.ts +9 -0
- package/.build/types/hooks/useImageTile.d.ts +11 -0
- package/.build/types/hooks/useLoadImageService.d.ts +6 -0
- package/.build/types/hooks/useManifest.d.ts +8 -0
- package/.build/types/hooks/usePaintables.d.ts +8 -0
- package/.build/types/hooks/usePaintingAnnotations.d.ts +4 -0
- package/.build/types/hooks/useRange.d.ts +8 -0
- package/.build/types/hooks/useRenderingStrategy.d.ts +14 -0
- package/.build/types/hooks/useResourceEvents.d.ts +3 -0
- package/.build/types/hooks/useResources.d.ts +1 -0
- package/.build/types/hooks/useSearchService.d.ts +2 -0
- package/.build/types/hooks/useSimpleMediaPlayer.d.ts +32 -0
- package/.build/types/hooks/useStyleHelper.d.ts +1 -0
- package/.build/types/hooks/useStyles.d.ts +3 -0
- package/.build/types/hooks/useThumbnail.d.ts +5 -0
- package/.build/types/hooks/useVault.d.ts +2 -0
- package/.build/types/hooks/useVaultEffect.d.ts +2 -0
- package/.build/types/hooks/useVaultSelector.d.ts +2 -0
- package/.build/types/hooks/useVirtualAnnotationPage.d.ts +13 -0
- package/.build/types/hooks/useVirtualAnnotationPageContext.d.ts +9 -0
- package/.build/types/hooks/useVirtualCanvas.d.ts +0 -0
- package/.build/types/index.d.ts +56 -0
- package/.build/types/utility/expand-target.d.ts +19 -0
- package/.build/types/utility/flatten-annotation-page-ids.d.ts +7 -0
- package/.build/types/utility/parse-selector.d.ts +7 -0
- package/.build/types/viewers/SimpleViewerContext.d.ts +18 -0
- package/.build/types/viewers/SingleCanvasContext.d.ts +1 -0
- package/dist/bundle/cjs/index.js +36 -0
- package/dist/bundle/cjs/index.js.map +1 -0
- package/dist/{esm → bundle/esm}/index.mjs +734 -796
- package/dist/bundle/esm/index.mjs.map +1 -0
- package/dist/canvas-panel/cjs/canvas-panel.js +36 -0
- package/dist/canvas-panel/cjs/canvas-panel.js.map +1 -0
- package/dist/canvas-panel/esm/canvas-panel.mjs +2024 -0
- package/dist/canvas-panel/esm/canvas-panel.mjs.map +1 -0
- package/dist/index.umd.js +121 -31732
- package/dist/index.umd.js.map +1 -0
- package/package.json +38 -28
- package/dist/cjs/index.js +0 -2528
- package/dist/index.d.ts +0 -615
|
@@ -1,218 +1,163 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
})(commonjsGlobal, (function (exports, React) {
|
|
17
|
-
function _interopNamespace(e) {
|
|
18
|
-
if (e && e.__esModule) return e;
|
|
19
|
-
var n = Object.create(null);
|
|
20
|
-
if (e) {
|
|
21
|
-
Object.keys(e).forEach(function (k) {
|
|
22
|
-
if (k !== 'default') {
|
|
23
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
24
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () { return e[k]; }
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
});
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
30
16
|
}
|
|
31
|
-
|
|
32
|
-
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import * as React from "react";
|
|
33
|
+
import React__default, { useContext, useMemo, useState, useEffect, createContext, useCallback, useRef, useLayoutEffect, Fragment as Fragment$1, useReducer } from "react";
|
|
34
|
+
import { AtlasAuto, mergeStyles, RegionHighlight, TileSet } from "@atlas-viewer/atlas";
|
|
35
|
+
import { globalVault, Vault } from "@iiif/vault";
|
|
36
|
+
import { createAction } from "typesafe-actions";
|
|
37
|
+
import require$$0 from "react-dom";
|
|
38
|
+
import { ImageServiceLoader, getImageServices, getFixedSizeFromImage } from "@atlas-viewer/iiif-image-api";
|
|
39
|
+
function _setPrototypeOf(o, p2) {
|
|
40
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p3) {
|
|
41
|
+
o2.__proto__ = p3;
|
|
42
|
+
return o2;
|
|
43
|
+
};
|
|
44
|
+
return _setPrototypeOf(o, p2);
|
|
45
|
+
}
|
|
46
|
+
function _inheritsLoose(subClass, superClass) {
|
|
47
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
48
|
+
subClass.prototype.constructor = subClass;
|
|
49
|
+
_setPrototypeOf(subClass, superClass);
|
|
50
|
+
}
|
|
51
|
+
var changedArray = function changedArray2(a, b) {
|
|
52
|
+
if (a === void 0) {
|
|
53
|
+
a = [];
|
|
33
54
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
function _setPrototypeOf(o, p) {
|
|
38
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
39
|
-
o.__proto__ = p;
|
|
40
|
-
return o;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
return _setPrototypeOf(o, p);
|
|
55
|
+
if (b === void 0) {
|
|
56
|
+
b = [];
|
|
44
57
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
58
|
+
return a.length !== b.length || a.some(function(item, index) {
|
|
59
|
+
return !Object.is(item, b[index]);
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
var initialState = {
|
|
63
|
+
error: null
|
|
64
|
+
};
|
|
65
|
+
var ErrorBoundary = /* @__PURE__ */ function(_React$Component) {
|
|
66
|
+
_inheritsLoose(ErrorBoundary2, _React$Component);
|
|
67
|
+
function ErrorBoundary2() {
|
|
68
|
+
var _this;
|
|
69
|
+
for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
70
|
+
_args[_key] = arguments[_key];
|
|
71
|
+
}
|
|
72
|
+
_this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this;
|
|
73
|
+
_this.state = initialState;
|
|
74
|
+
_this.resetErrorBoundary = function() {
|
|
75
|
+
var _this$props;
|
|
76
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
77
|
+
args[_key2] = arguments[_key2];
|
|
78
|
+
}
|
|
79
|
+
_this.props.onReset == null ? void 0 : (_this$props = _this.props).onReset.apply(_this$props, args);
|
|
80
|
+
_this.reset();
|
|
81
|
+
};
|
|
82
|
+
return _this;
|
|
50
83
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (b === void 0) {
|
|
58
|
-
b = [];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return a.length !== b.length || a.some(function (item, index) {
|
|
62
|
-
return !Object.is(item, b[index]);
|
|
63
|
-
});
|
|
84
|
+
ErrorBoundary2.getDerivedStateFromError = function getDerivedStateFromError(error) {
|
|
85
|
+
return {
|
|
86
|
+
error
|
|
87
|
+
};
|
|
64
88
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
89
|
+
var _proto = ErrorBoundary2.prototype;
|
|
90
|
+
_proto.reset = function reset() {
|
|
91
|
+
this.setState(initialState);
|
|
68
92
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
_this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this;
|
|
81
|
-
_this.state = initialState;
|
|
82
|
-
|
|
83
|
-
_this.resetErrorBoundary = function () {
|
|
84
|
-
var _this$props;
|
|
85
|
-
|
|
86
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
87
|
-
args[_key2] = arguments[_key2];
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
_this.props.onReset == null ? void 0 : (_this$props = _this.props).onReset.apply(_this$props, args);
|
|
91
|
-
|
|
92
|
-
_this.reset();
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
return _this;
|
|
93
|
+
_proto.componentDidCatch = function componentDidCatch(error, info) {
|
|
94
|
+
var _this$props$onError, _this$props2;
|
|
95
|
+
(_this$props$onError = (_this$props2 = this.props).onError) == null ? void 0 : _this$props$onError.call(_this$props2, error, info);
|
|
96
|
+
};
|
|
97
|
+
_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
|
|
98
|
+
var error = this.state.error;
|
|
99
|
+
var resetKeys = this.props.resetKeys;
|
|
100
|
+
if (error !== null && prevState.error !== null && changedArray(prevProps.resetKeys, resetKeys)) {
|
|
101
|
+
var _this$props$onResetKe, _this$props3;
|
|
102
|
+
(_this$props$onResetKe = (_this$props3 = this.props).onResetKeysChange) == null ? void 0 : _this$props$onResetKe.call(_this$props3, prevProps.resetKeys, resetKeys);
|
|
103
|
+
this.reset();
|
|
96
104
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
105
|
+
};
|
|
106
|
+
_proto.render = function render() {
|
|
107
|
+
var error = this.state.error;
|
|
108
|
+
var _this$props4 = this.props, fallbackRender = _this$props4.fallbackRender, FallbackComponent = _this$props4.FallbackComponent, fallback = _this$props4.fallback;
|
|
109
|
+
if (error !== null) {
|
|
110
|
+
var _props = {
|
|
111
|
+
error,
|
|
112
|
+
resetErrorBoundary: this.resetErrorBoundary
|
|
101
113
|
};
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
_proto.componentDidCatch = function componentDidCatch(error, info) {
|
|
111
|
-
var _this$props$onError, _this$props2;
|
|
112
|
-
|
|
113
|
-
(_this$props$onError = (_this$props2 = this.props).onError) == null ? void 0 : _this$props$onError.call(_this$props2, error, info);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
|
|
117
|
-
var error = this.state.error;
|
|
118
|
-
var resetKeys = this.props.resetKeys; // There's an edge case where if the thing that triggered the error
|
|
119
|
-
// happens to *also* be in the resetKeys array, we'd end up resetting
|
|
120
|
-
// the error boundary immediately. This would likely trigger a second
|
|
121
|
-
// error to be thrown.
|
|
122
|
-
// So we make sure that we don't check the resetKeys on the first call
|
|
123
|
-
// of cDU after the error is set
|
|
124
|
-
|
|
125
|
-
if (error !== null && prevState.error !== null && changedArray(prevProps.resetKeys, resetKeys)) {
|
|
126
|
-
var _this$props$onResetKe, _this$props3;
|
|
127
|
-
|
|
128
|
-
(_this$props$onResetKe = (_this$props3 = this.props).onResetKeysChange) == null ? void 0 : _this$props$onResetKe.call(_this$props3, prevProps.resetKeys, resetKeys);
|
|
129
|
-
this.reset();
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
_proto.render = function render() {
|
|
134
|
-
var error = this.state.error;
|
|
135
|
-
var _this$props4 = this.props,
|
|
136
|
-
fallbackRender = _this$props4.fallbackRender,
|
|
137
|
-
FallbackComponent = _this$props4.FallbackComponent,
|
|
138
|
-
fallback = _this$props4.fallback;
|
|
139
|
-
|
|
140
|
-
if (error !== null) {
|
|
141
|
-
var _props = {
|
|
142
|
-
error: error,
|
|
143
|
-
resetErrorBoundary: this.resetErrorBoundary
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
if ( /*#__PURE__*/React__namespace.isValidElement(fallback)) {
|
|
147
|
-
return fallback;
|
|
148
|
-
} else if (typeof fallbackRender === 'function') {
|
|
149
|
-
return fallbackRender(_props);
|
|
150
|
-
} else if (FallbackComponent) {
|
|
151
|
-
return /*#__PURE__*/React__namespace.createElement(FallbackComponent, _props);
|
|
152
|
-
} else {
|
|
153
|
-
throw new Error('react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop');
|
|
154
|
-
}
|
|
114
|
+
if (/* @__PURE__ */ React.isValidElement(fallback)) {
|
|
115
|
+
return fallback;
|
|
116
|
+
} else if (typeof fallbackRender === "function") {
|
|
117
|
+
return fallbackRender(_props);
|
|
118
|
+
} else if (FallbackComponent) {
|
|
119
|
+
return /* @__PURE__ */ React.createElement(FallbackComponent, _props);
|
|
120
|
+
} else {
|
|
121
|
+
throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");
|
|
155
122
|
}
|
|
156
|
-
|
|
157
|
-
return this.props.children;
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
return ErrorBoundary;
|
|
161
|
-
}(React__namespace.Component);
|
|
162
|
-
|
|
163
|
-
function withErrorBoundary(Component, errorBoundaryProps) {
|
|
164
|
-
var Wrapped = function Wrapped(props) {
|
|
165
|
-
return /*#__PURE__*/React__namespace.createElement(ErrorBoundary, errorBoundaryProps, /*#__PURE__*/React__namespace.createElement(Component, props));
|
|
166
|
-
}; // Format for display in DevTools
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
var name = Component.displayName || Component.name || 'Unknown';
|
|
170
|
-
Wrapped.displayName = "withErrorBoundary(" + name + ")";
|
|
171
|
-
return Wrapped;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
function useErrorHandler(givenError) {
|
|
175
|
-
var _React$useState = React__namespace.useState(null),
|
|
176
|
-
error = _React$useState[0],
|
|
177
|
-
setError = _React$useState[1];
|
|
178
|
-
|
|
179
|
-
if (givenError != null) throw givenError;
|
|
180
|
-
if (error != null) throw error;
|
|
181
|
-
return setError;
|
|
182
|
-
}
|
|
183
|
-
/*
|
|
184
|
-
eslint
|
|
185
|
-
@typescript-eslint/sort-type-union-intersection-members: "off",
|
|
186
|
-
@typescript-eslint/no-throw-literal: "off",
|
|
187
|
-
@typescript-eslint/prefer-nullish-coalescing: "off"
|
|
188
|
-
*/
|
|
189
|
-
|
|
190
|
-
exports.ErrorBoundary = ErrorBoundary;
|
|
191
|
-
exports.useErrorHandler = useErrorHandler;
|
|
192
|
-
exports.withErrorBoundary = withErrorBoundary;
|
|
193
|
-
|
|
194
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
195
|
-
|
|
196
|
-
}));
|
|
197
|
-
|
|
198
|
-
}(reactErrorBoundary_umd, reactErrorBoundary_umd.exports));
|
|
199
|
-
|
|
200
|
-
var __defProp$a = Object.defineProperty;
|
|
201
|
-
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
202
|
-
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
203
|
-
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
204
|
-
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
205
|
-
var __spreadValues$a = (a, b) => {
|
|
206
|
-
for (var prop in b || (b = {}))
|
|
207
|
-
if (__hasOwnProp$a.call(b, prop))
|
|
208
|
-
__defNormalProp$a(a, prop, b[prop]);
|
|
209
|
-
if (__getOwnPropSymbols$a)
|
|
210
|
-
for (var prop of __getOwnPropSymbols$a(b)) {
|
|
211
|
-
if (__propIsEnum$a.call(b, prop))
|
|
212
|
-
__defNormalProp$a(a, prop, b[prop]);
|
|
213
123
|
}
|
|
214
|
-
|
|
215
|
-
};
|
|
124
|
+
return this.props.children;
|
|
125
|
+
};
|
|
126
|
+
return ErrorBoundary2;
|
|
127
|
+
}(React.Component);
|
|
128
|
+
var jsxRuntime = { exports: {} };
|
|
129
|
+
var reactJsxRuntime_production_min = {};
|
|
130
|
+
/**
|
|
131
|
+
* @license React
|
|
132
|
+
* react-jsx-runtime.production.min.js
|
|
133
|
+
*
|
|
134
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
135
|
+
*
|
|
136
|
+
* This source code is licensed under the MIT license found in the
|
|
137
|
+
* LICENSE file in the root directory of this source tree.
|
|
138
|
+
*/
|
|
139
|
+
var f = React__default, k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m$1 = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true };
|
|
140
|
+
function q(c, a, g) {
|
|
141
|
+
var b, d = {}, e = null, h = null;
|
|
142
|
+
g !== void 0 && (e = "" + g);
|
|
143
|
+
a.key !== void 0 && (e = "" + a.key);
|
|
144
|
+
a.ref !== void 0 && (h = a.ref);
|
|
145
|
+
for (b in a)
|
|
146
|
+
m$1.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
|
|
147
|
+
if (c && c.defaultProps)
|
|
148
|
+
for (b in a = c.defaultProps, a)
|
|
149
|
+
d[b] === void 0 && (d[b] = a[b]);
|
|
150
|
+
return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
|
|
151
|
+
}
|
|
152
|
+
reactJsxRuntime_production_min.Fragment = l;
|
|
153
|
+
reactJsxRuntime_production_min.jsx = q;
|
|
154
|
+
reactJsxRuntime_production_min.jsxs = q;
|
|
155
|
+
{
|
|
156
|
+
jsxRuntime.exports = reactJsxRuntime_production_min;
|
|
157
|
+
}
|
|
158
|
+
const jsx = jsxRuntime.exports.jsx;
|
|
159
|
+
const jsxs = jsxRuntime.exports.jsxs;
|
|
160
|
+
const Fragment = jsxRuntime.exports.Fragment;
|
|
216
161
|
const defaultResourceContext = {
|
|
217
162
|
collection: void 0,
|
|
218
163
|
manifest: void 0,
|
|
@@ -220,21 +165,24 @@ const defaultResourceContext = {
|
|
|
220
165
|
canvas: void 0,
|
|
221
166
|
annotation: void 0
|
|
222
167
|
};
|
|
223
|
-
const ResourceReactContext =
|
|
168
|
+
const ResourceReactContext = React__default.createContext(defaultResourceContext);
|
|
224
169
|
const useResourceContext = () => {
|
|
225
170
|
return useContext(ResourceReactContext);
|
|
226
171
|
};
|
|
227
|
-
function ResourceProvider({
|
|
172
|
+
function ResourceProvider({
|
|
173
|
+
value,
|
|
174
|
+
children
|
|
175
|
+
}) {
|
|
228
176
|
const parentContext = useResourceContext();
|
|
229
177
|
const newContext = useMemo(() => {
|
|
230
|
-
return __spreadValues
|
|
178
|
+
return __spreadValues(__spreadValues({}, parentContext), value);
|
|
231
179
|
}, [value, parentContext]);
|
|
232
|
-
return /* @__PURE__ */
|
|
233
|
-
value: newContext
|
|
234
|
-
|
|
180
|
+
return /* @__PURE__ */ jsx(ResourceReactContext.Provider, {
|
|
181
|
+
value: newContext,
|
|
182
|
+
children
|
|
183
|
+
});
|
|
235
184
|
}
|
|
236
|
-
|
|
237
|
-
const ReactVaultContext = React$1.createContext({
|
|
185
|
+
const ReactVaultContext = React__default.createContext({
|
|
238
186
|
vault: null,
|
|
239
187
|
setVaultInstance: (vault) => {
|
|
240
188
|
}
|
|
@@ -258,13 +206,17 @@ function VaultProvider({
|
|
|
258
206
|
}
|
|
259
207
|
return new Vault();
|
|
260
208
|
});
|
|
261
|
-
return /* @__PURE__ */
|
|
262
|
-
value: {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
209
|
+
return /* @__PURE__ */ jsx(ReactVaultContext.Provider, {
|
|
210
|
+
value: {
|
|
211
|
+
vault: vaultInstance,
|
|
212
|
+
setVaultInstance
|
|
213
|
+
},
|
|
214
|
+
children: /* @__PURE__ */ jsx(ResourceProvider, {
|
|
215
|
+
value: resources || {},
|
|
216
|
+
children
|
|
217
|
+
})
|
|
218
|
+
});
|
|
266
219
|
}
|
|
267
|
-
|
|
268
220
|
const useVault = () => {
|
|
269
221
|
const { vault } = useContext(ReactVaultContext);
|
|
270
222
|
if (vault === null) {
|
|
@@ -272,27 +224,6 @@ const useVault = () => {
|
|
|
272
224
|
}
|
|
273
225
|
return vault;
|
|
274
226
|
};
|
|
275
|
-
|
|
276
|
-
var __async$1 = (__this, __arguments, generator) => {
|
|
277
|
-
return new Promise((resolve, reject) => {
|
|
278
|
-
var fulfilled = (value) => {
|
|
279
|
-
try {
|
|
280
|
-
step(generator.next(value));
|
|
281
|
-
} catch (e) {
|
|
282
|
-
reject(e);
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
var rejected = (value) => {
|
|
286
|
-
try {
|
|
287
|
-
step(generator.throw(value));
|
|
288
|
-
} catch (e) {
|
|
289
|
-
reject(e);
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
293
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
294
|
-
});
|
|
295
|
-
};
|
|
296
227
|
function useExternalResource(idOrRef, { noCache = false } = {}) {
|
|
297
228
|
const id = typeof idOrRef === "string" ? idOrRef : idOrRef.id;
|
|
298
229
|
const vault = useVault();
|
|
@@ -303,9 +234,9 @@ function useExternalResource(idOrRef, { noCache = false } = {}) {
|
|
|
303
234
|
}, [id, vault]);
|
|
304
235
|
const [resource, setResource] = useState(initialData);
|
|
305
236
|
useEffect(() => {
|
|
306
|
-
(() =>
|
|
237
|
+
(async () => {
|
|
307
238
|
try {
|
|
308
|
-
const fetchedResource = initialData && !noCache ? initialData :
|
|
239
|
+
const fetchedResource = initialData && !noCache ? initialData : await vault.load(id);
|
|
309
240
|
const _realId = fetchedResource ? fetchedResource.id || fetchedResource["@id"] : null;
|
|
310
241
|
if (fetchedResource && realId !== _realId) {
|
|
311
242
|
setRealId(_realId);
|
|
@@ -314,7 +245,7 @@ function useExternalResource(idOrRef, { noCache = false } = {}) {
|
|
|
314
245
|
} catch (err) {
|
|
315
246
|
setError(err);
|
|
316
247
|
}
|
|
317
|
-
})
|
|
248
|
+
})();
|
|
318
249
|
}, [id, noCache]);
|
|
319
250
|
return {
|
|
320
251
|
isLoaded: !!resource,
|
|
@@ -325,24 +256,32 @@ function useExternalResource(idOrRef, { noCache = false } = {}) {
|
|
|
325
256
|
cached: !!(resource && resource === initialData)
|
|
326
257
|
};
|
|
327
258
|
}
|
|
328
|
-
|
|
329
259
|
function useExternalManifest(idOrRef, options) {
|
|
330
260
|
const { id, isLoaded, error, resource, requestId, cached } = useExternalResource(idOrRef, options);
|
|
331
261
|
return { id, isLoaded, error, manifest: resource, requestId, cached };
|
|
332
262
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
263
|
+
function ManifestContext({
|
|
264
|
+
manifest,
|
|
265
|
+
children
|
|
266
|
+
}) {
|
|
267
|
+
return /* @__PURE__ */ jsx(ResourceProvider, {
|
|
268
|
+
value: {
|
|
269
|
+
manifest
|
|
270
|
+
},
|
|
271
|
+
children
|
|
272
|
+
});
|
|
338
273
|
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
274
|
+
function CanvasContext({
|
|
275
|
+
canvas,
|
|
276
|
+
children
|
|
277
|
+
}) {
|
|
278
|
+
return /* @__PURE__ */ jsx(ResourceProvider, {
|
|
279
|
+
value: {
|
|
280
|
+
canvas
|
|
281
|
+
},
|
|
282
|
+
children
|
|
283
|
+
});
|
|
344
284
|
}
|
|
345
|
-
|
|
346
285
|
function useVaultSelector(selector, deps = []) {
|
|
347
286
|
const vault = useVault();
|
|
348
287
|
const [selectedState, setSelectedState] = useState(() => selector(vault.getState(), vault));
|
|
@@ -353,15 +292,13 @@ function useVaultSelector(selector, deps = []) {
|
|
|
353
292
|
}, deps);
|
|
354
293
|
return selectedState;
|
|
355
294
|
}
|
|
356
|
-
|
|
357
|
-
const VisibleCanvasReactContext = React$1.createContext([]);
|
|
295
|
+
const VisibleCanvasReactContext = React__default.createContext([]);
|
|
358
296
|
function useVisibleCanvases() {
|
|
359
297
|
const ids = useContext(VisibleCanvasReactContext);
|
|
360
298
|
return useVaultSelector((state) => {
|
|
361
299
|
return ids.map((id) => state.iiif.entities.Canvas[id]).filter(Boolean);
|
|
362
300
|
}, [ids]);
|
|
363
301
|
}
|
|
364
|
-
|
|
365
302
|
const noop = () => {
|
|
366
303
|
};
|
|
367
304
|
const SimpleViewerReactContext = createContext({
|
|
@@ -456,25 +393,32 @@ function SimpleViewerProvider(props) {
|
|
|
456
393
|
}), [nextCanvas, previousCanvas, currentCanvasIndex, canvasList, setCurrentCanvasIndex, internalSetCurrentCanvasId]);
|
|
457
394
|
if (!manifest.manifest) {
|
|
458
395
|
console.warn("The manifest passed to the provider is not a valid IIIF manifest.");
|
|
459
|
-
return /* @__PURE__ */
|
|
396
|
+
return /* @__PURE__ */ jsx("div", {
|
|
397
|
+
children: "Sorry, something went wrong."
|
|
398
|
+
});
|
|
460
399
|
}
|
|
461
400
|
if (!manifest.isLoaded) {
|
|
462
|
-
return /* @__PURE__ */
|
|
401
|
+
return /* @__PURE__ */ jsx("div", {
|
|
402
|
+
children: "Loading..."
|
|
403
|
+
});
|
|
463
404
|
}
|
|
464
|
-
return /* @__PURE__ */
|
|
465
|
-
value: ctx
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
405
|
+
return /* @__PURE__ */ jsx(SimpleViewerReactContext.Provider, {
|
|
406
|
+
value: ctx,
|
|
407
|
+
children: /* @__PURE__ */ jsx(VisibleCanvasReactContext.Provider, {
|
|
408
|
+
value: visible,
|
|
409
|
+
children: /* @__PURE__ */ jsx(ManifestContext, {
|
|
410
|
+
manifest: manifest.manifest.id,
|
|
411
|
+
children: /* @__PURE__ */ jsx(CanvasContext, {
|
|
412
|
+
canvas: currentCanvasId,
|
|
413
|
+
children: props.children
|
|
414
|
+
})
|
|
415
|
+
})
|
|
416
|
+
})
|
|
417
|
+
});
|
|
473
418
|
}
|
|
474
419
|
function useSimpleViewer() {
|
|
475
420
|
return useContext(SimpleViewerReactContext);
|
|
476
421
|
}
|
|
477
|
-
|
|
478
422
|
function useContextBridge() {
|
|
479
423
|
return {
|
|
480
424
|
VaultContext: useContext(ReactVaultContext),
|
|
@@ -484,16 +428,18 @@ function useContextBridge() {
|
|
|
484
428
|
};
|
|
485
429
|
}
|
|
486
430
|
function ContextBridge(props) {
|
|
487
|
-
return /* @__PURE__ */
|
|
431
|
+
return /* @__PURE__ */ jsx(VaultProvider, {
|
|
488
432
|
vault: props.bridge.VaultContext.vault || void 0,
|
|
489
|
-
resources: props.bridge.ResourceContext
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
}
|
|
496
|
-
|
|
433
|
+
resources: props.bridge.ResourceContext,
|
|
434
|
+
children: /* @__PURE__ */ jsx(VisibleCanvasReactContext.Provider, {
|
|
435
|
+
value: props.bridge.VisibleCanvasReactContext,
|
|
436
|
+
children: /* @__PURE__ */ jsx(SimpleViewerReactContext.Provider, {
|
|
437
|
+
value: props.bridge.SimpleViewerReactContext,
|
|
438
|
+
children: props.children
|
|
439
|
+
})
|
|
440
|
+
})
|
|
441
|
+
});
|
|
442
|
+
}
|
|
497
443
|
const IMPORT_ENTITIES = "@iiif/IMPORT_ENTITIES";
|
|
498
444
|
const MODIFY_ENTITY_FIELD = "@iiif/MODIFY_ENTITY_FIELD";
|
|
499
445
|
const REORDER_ENTITY_FIELD = "@iiif/REORDER_ENTITY_FIELD";
|
|
@@ -505,12 +451,10 @@ const reorderEntityField = createAction(REORDER_ENTITY_FIELD)();
|
|
|
505
451
|
const addReference = createAction(ADD_REFERENCE)();
|
|
506
452
|
const removeReference = createAction(REMOVE_REFERENCE)();
|
|
507
453
|
const entityActions = { importEntities, modifyEntityField, reorderEntityField, addReference, removeReference };
|
|
508
|
-
|
|
509
454
|
const ADD_MAPPING = "@iiif/ADD_MAPPING";
|
|
510
455
|
const ADD_MAPPINGS = "@iiif/ADD_MAPPINGS";
|
|
511
456
|
createAction(ADD_MAPPING)();
|
|
512
457
|
createAction(ADD_MAPPINGS)();
|
|
513
|
-
|
|
514
458
|
const SET_META_VALUE = "@iiif/SET_META_VALUE";
|
|
515
459
|
const SET_META_VALUE_DYNAMIC = "@iiif/SET_META_VALUE_DYNAMIC";
|
|
516
460
|
const UNSET_META_VALUE = "@iiif/UNSET_META_VALUE";
|
|
@@ -527,12 +471,10 @@ createAction(REQUEST_ERROR)();
|
|
|
527
471
|
createAction(REQUEST_MISMATCH)();
|
|
528
472
|
createAction(REQUEST_COMPLETE)();
|
|
529
473
|
createAction(REQUEST_OFFLINE_RESOURCE)();
|
|
530
|
-
|
|
531
474
|
const BATCH_ACTIONS = "@iiif/BATCH";
|
|
532
475
|
const BATCH_IMPORT = "@iiif/BATCH_IMPORT";
|
|
533
476
|
createAction(BATCH_ACTIONS)();
|
|
534
477
|
createAction(BATCH_IMPORT)();
|
|
535
|
-
|
|
536
478
|
function useDispatch() {
|
|
537
479
|
const vault = useVault();
|
|
538
480
|
const store = vault.getStore();
|
|
@@ -540,7 +482,6 @@ function useDispatch() {
|
|
|
540
482
|
return (action) => store.dispatch(action);
|
|
541
483
|
}, [store]);
|
|
542
484
|
}
|
|
543
|
-
|
|
544
485
|
function isVaultActivated(obj) {
|
|
545
486
|
return typeof obj !== "string" && obj && obj.bindToVault;
|
|
546
487
|
}
|
|
@@ -642,121 +583,86 @@ function useVirtualAnnotationPage() {
|
|
|
642
583
|
}
|
|
643
584
|
];
|
|
644
585
|
}
|
|
645
|
-
|
|
646
586
|
const VirtualAnnotationPageContext = createContext(null);
|
|
647
587
|
function useVirtualAnnotationPageContext() {
|
|
648
588
|
const ctx = useContext(VirtualAnnotationPageContext);
|
|
649
|
-
return [
|
|
650
|
-
ctx.
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
removeAnnotation: ctx.removeAnnotation
|
|
654
|
-
}
|
|
655
|
-
];
|
|
589
|
+
return [ctx.fullPage, {
|
|
590
|
+
addAnnotation: ctx.addAnnotation,
|
|
591
|
+
removeAnnotation: ctx.removeAnnotation
|
|
592
|
+
}];
|
|
656
593
|
}
|
|
657
|
-
function VirtualAnnotationProvider({
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
594
|
+
function VirtualAnnotationProvider({
|
|
595
|
+
children
|
|
596
|
+
}) {
|
|
597
|
+
const [fullPage, {
|
|
598
|
+
addAnnotation,
|
|
599
|
+
removeAnnotation
|
|
600
|
+
}] = useVirtualAnnotationPage();
|
|
601
|
+
return /* @__PURE__ */ jsx(VirtualAnnotationPageContext.Provider, {
|
|
602
|
+
value: useMemo(() => ({
|
|
603
|
+
fullPage,
|
|
604
|
+
addAnnotation,
|
|
605
|
+
removeAnnotation
|
|
606
|
+
}), [fullPage]),
|
|
607
|
+
children
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
function DefaultCanvasFallback({
|
|
611
|
+
width,
|
|
612
|
+
style,
|
|
613
|
+
height
|
|
614
|
+
}) {
|
|
615
|
+
return /* @__PURE__ */ jsx("div", {
|
|
616
|
+
style: __spreadProps(__spreadValues({
|
|
617
|
+
width,
|
|
618
|
+
height,
|
|
619
|
+
minHeight: 500
|
|
620
|
+
}, style || {}), {
|
|
621
|
+
background: "#f9f9f9"
|
|
622
|
+
}),
|
|
623
|
+
children: "Unknown error"
|
|
624
|
+
});
|
|
687
625
|
}
|
|
688
|
-
|
|
689
626
|
var createRoot;
|
|
690
|
-
|
|
691
627
|
var m = require$$0;
|
|
692
628
|
{
|
|
693
|
-
|
|
694
|
-
createRoot = function(c, o) {
|
|
695
|
-
i.usingClientEntryPoint = true;
|
|
696
|
-
try {
|
|
697
|
-
return m.createRoot(c, o);
|
|
698
|
-
} finally {
|
|
699
|
-
i.usingClientEntryPoint = false;
|
|
700
|
-
}
|
|
701
|
-
};
|
|
629
|
+
createRoot = m.createRoot;
|
|
702
630
|
}
|
|
703
|
-
|
|
704
631
|
const ViewerPresetContext = createContext(null);
|
|
705
632
|
function useViewerPreset() {
|
|
706
633
|
return useContext(ViewerPresetContext);
|
|
707
634
|
}
|
|
708
|
-
|
|
709
|
-
const
|
|
710
|
-
|
|
711
|
-
|
|
635
|
+
const PortalContext = React__default.createContext(null);
|
|
636
|
+
const OverlayPortalContext = React__default.createContext(null);
|
|
637
|
+
function CanvasPortal({
|
|
638
|
+
children,
|
|
639
|
+
overlay
|
|
640
|
+
}) {
|
|
712
641
|
const htmlElement = useContext(overlay ? OverlayPortalContext : PortalContext);
|
|
713
|
-
const
|
|
642
|
+
const rootRef = useRef(null);
|
|
714
643
|
const preset = useViewerPreset();
|
|
715
644
|
useLayoutEffect(() => {
|
|
716
|
-
|
|
717
|
-
|
|
645
|
+
if (!rootRef.current) {
|
|
646
|
+
rootRef.current = htmlElement ? createRoot(htmlElement) : null;
|
|
647
|
+
}
|
|
648
|
+
}, []);
|
|
649
|
+
useLayoutEffect(() => {
|
|
650
|
+
return () => {
|
|
651
|
+
var _a;
|
|
652
|
+
(_a = rootRef.current) == null ? void 0 : _a.unmount();
|
|
653
|
+
rootRef.current = null;
|
|
654
|
+
};
|
|
655
|
+
}, []);
|
|
718
656
|
useLayoutEffect(() => {
|
|
719
|
-
if (
|
|
720
|
-
|
|
721
|
-
value: preset
|
|
722
|
-
|
|
657
|
+
if (rootRef.current) {
|
|
658
|
+
rootRef.current.render(/* @__PURE__ */ jsx(ViewerPresetContext.Provider, {
|
|
659
|
+
value: preset,
|
|
660
|
+
children
|
|
661
|
+
}));
|
|
723
662
|
}
|
|
724
663
|
}, [children, preset]);
|
|
725
664
|
return null;
|
|
726
665
|
}
|
|
727
|
-
|
|
728
|
-
var __defProp$8 = Object.defineProperty;
|
|
729
|
-
var __defProps$6 = Object.defineProperties;
|
|
730
|
-
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
731
|
-
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
732
|
-
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
733
|
-
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
734
|
-
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
735
|
-
var __spreadValues$8 = (a, b) => {
|
|
736
|
-
for (var prop in b || (b = {}))
|
|
737
|
-
if (__hasOwnProp$8.call(b, prop))
|
|
738
|
-
__defNormalProp$8(a, prop, b[prop]);
|
|
739
|
-
if (__getOwnPropSymbols$8)
|
|
740
|
-
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
741
|
-
if (__propIsEnum$8.call(b, prop))
|
|
742
|
-
__defNormalProp$8(a, prop, b[prop]);
|
|
743
|
-
}
|
|
744
|
-
return a;
|
|
745
|
-
};
|
|
746
|
-
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
747
|
-
var __objRest = (source, exclude) => {
|
|
748
|
-
var target = {};
|
|
749
|
-
for (var prop in source)
|
|
750
|
-
if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
751
|
-
target[prop] = source[prop];
|
|
752
|
-
if (source != null && __getOwnPropSymbols$8)
|
|
753
|
-
for (var prop of __getOwnPropSymbols$8(source)) {
|
|
754
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
|
|
755
|
-
target[prop] = source[prop];
|
|
756
|
-
}
|
|
757
|
-
return target;
|
|
758
|
-
};
|
|
759
|
-
const AtlasAuto = AtlasAuto$1;
|
|
760
666
|
function Viewer(_a) {
|
|
761
667
|
var _b = _a, {
|
|
762
668
|
children,
|
|
@@ -778,32 +684,91 @@ function Viewer(_a) {
|
|
|
778
684
|
setPortalElement(portal.current);
|
|
779
685
|
setOverlayPortalElement(overlayPortal.current);
|
|
780
686
|
}, []);
|
|
781
|
-
return /* @__PURE__ */
|
|
782
|
-
fallbackRender: () => /* @__PURE__ */
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
687
|
+
return /* @__PURE__ */ jsxs(ErrorBoundary, {
|
|
688
|
+
fallbackRender: () => /* @__PURE__ */ jsx(ErrorFallback, __spreadValues({}, props)),
|
|
689
|
+
children: [/* @__PURE__ */ jsx(AtlasAuto, __spreadProps(__spreadValues({}, props), {
|
|
690
|
+
containerProps: __spreadValues({
|
|
691
|
+
style: {
|
|
692
|
+
position: "relative"
|
|
693
|
+
}
|
|
694
|
+
}, props.containerProps || {}),
|
|
695
|
+
htmlChildren: /* @__PURE__ */ jsx("div", {
|
|
696
|
+
ref: overlayPortal
|
|
697
|
+
}),
|
|
698
|
+
onCreated: (preset) => {
|
|
699
|
+
setViewerPreset(preset);
|
|
700
|
+
if (props.onCreated) {
|
|
701
|
+
props.onCreated(preset);
|
|
702
|
+
}
|
|
703
|
+
},
|
|
704
|
+
children: /* @__PURE__ */ jsx(ViewerPresetContext.Provider, {
|
|
705
|
+
value: viewerPreset,
|
|
706
|
+
children: /* @__PURE__ */ jsx(PortalContext.Provider, {
|
|
707
|
+
value: portalElement,
|
|
708
|
+
children: /* @__PURE__ */ jsx(OverlayPortalContext.Provider, {
|
|
709
|
+
value: overlayPortalElement,
|
|
710
|
+
children: /* @__PURE__ */ jsx(ContextBridge, {
|
|
711
|
+
bridge,
|
|
712
|
+
children: /* @__PURE__ */ jsx(VirtualAnnotationProvider, {
|
|
713
|
+
children
|
|
714
|
+
})
|
|
715
|
+
})
|
|
716
|
+
})
|
|
717
|
+
})
|
|
718
|
+
})
|
|
719
|
+
})), /* @__PURE__ */ jsx("div", {
|
|
720
|
+
ref: portal
|
|
721
|
+
})]
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
function createEventsHelper(vault) {
|
|
725
|
+
return {
|
|
726
|
+
addEventListener(resource, event, listener, scope) {
|
|
727
|
+
if (!resource) {
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
vault.setMetaValue([resource.id, "eventManager", event], (registeredCallbacks) => {
|
|
731
|
+
const callbacks = registeredCallbacks || [];
|
|
732
|
+
for (const registered of callbacks) {
|
|
733
|
+
if (registered.callback === listener) {
|
|
734
|
+
return callbacks;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
return [...callbacks, { callback: listener, scope }];
|
|
738
|
+
});
|
|
739
|
+
return listener;
|
|
740
|
+
},
|
|
741
|
+
removeEventListener(resource, event, listener) {
|
|
742
|
+
if (!resource) {
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
745
|
+
vault.setMetaValue([resource.id, "eventManager", event], (registeredCallbacks) => {
|
|
746
|
+
return (registeredCallbacks || []).filter((registeredCallback) => registeredCallback.callback !== listener);
|
|
747
|
+
});
|
|
748
|
+
},
|
|
749
|
+
getListenersAsProps(resourceOrId, scope) {
|
|
750
|
+
const resource = typeof resourceOrId === "string" ? { id: resourceOrId } : resourceOrId;
|
|
751
|
+
if (!resource || !resource.id) {
|
|
752
|
+
return {};
|
|
753
|
+
}
|
|
754
|
+
const hooks = vault.getResourceMeta(resource.id, "eventManager");
|
|
755
|
+
const props = {};
|
|
756
|
+
if (hooks && resource) {
|
|
757
|
+
for (const hook of Object.keys(hooks)) {
|
|
758
|
+
props[hook] = (e) => {
|
|
759
|
+
const fullResource = vault.get(resource);
|
|
760
|
+
for (const { callback, scope: _scope } of hooks[hook] || []) {
|
|
761
|
+
if (!_scope || scope && _scope.indexOf(scope) !== -1) {
|
|
762
|
+
callback(e, fullResource);
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
}
|
|
790
767
|
}
|
|
768
|
+
return props;
|
|
791
769
|
}
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
}, /* @__PURE__ */ React$1.createElement(PortalContext.Provider, {
|
|
795
|
-
value: portalElement
|
|
796
|
-
}, /* @__PURE__ */ React$1.createElement(OverlayPortalContext.Provider, {
|
|
797
|
-
value: overlayPortalElement
|
|
798
|
-
}, /* @__PURE__ */ React$1.createElement(ContextBridge, {
|
|
799
|
-
bridge
|
|
800
|
-
}, /* @__PURE__ */ React$1.createElement(VirtualAnnotationProvider, null, children)))))), /* @__PURE__ */ React$1.createElement("div", {
|
|
801
|
-
ref: overlayPortal
|
|
802
|
-
})), /* @__PURE__ */ React$1.createElement("div", {
|
|
803
|
-
ref: portal
|
|
804
|
-
}));
|
|
805
|
-
}
|
|
806
|
-
|
|
770
|
+
};
|
|
771
|
+
}
|
|
807
772
|
function useResourceEvents(resource, scope) {
|
|
808
773
|
const vault = useVault();
|
|
809
774
|
const helper = useMemo(() => createEventsHelper(vault), [vault]);
|
|
@@ -817,7 +782,18 @@ function useResourceEvents(resource, scope) {
|
|
|
817
782
|
return resource ? helper.getListenersAsProps(resource, scope) : {};
|
|
818
783
|
}, [hooks, resource, vault, scope]);
|
|
819
784
|
}
|
|
820
|
-
|
|
785
|
+
function createStylesHelper(vault) {
|
|
786
|
+
return {
|
|
787
|
+
applyStyles(resource, scope, styles) {
|
|
788
|
+
const id = typeof resource === "string" ? resource : resource.id;
|
|
789
|
+
return vault.setMetaValue([id, "styles", scope], styles);
|
|
790
|
+
},
|
|
791
|
+
getAppliedStyles(resource) {
|
|
792
|
+
const id = typeof resource === "string" ? resource : resource.id;
|
|
793
|
+
return vault.getResourceMeta(id, "styles");
|
|
794
|
+
}
|
|
795
|
+
};
|
|
796
|
+
}
|
|
821
797
|
function useStyles(resource, scope) {
|
|
822
798
|
const vault = useVault();
|
|
823
799
|
const helper = useMemo(() => createStylesHelper(vault), [vault]);
|
|
@@ -829,8 +805,7 @@ function useStyles(resource, scope) {
|
|
|
829
805
|
return styles ? scope ? styles[scope] : styles : void 0;
|
|
830
806
|
}, [resource, scope]);
|
|
831
807
|
}
|
|
832
|
-
|
|
833
|
-
const BOX_SELECTOR = /&?(xywh=)?(pixel:|percent:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/;
|
|
808
|
+
const BOX_SELECTOR = /&?(xywh=)?(pixel:|percent:|pct:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/;
|
|
834
809
|
const TEMPORAL_SELECTOR = /&?(t=)(npt:)?([0-9]+(.[0-9]+)?)?(,([0-9]+(.[0-9]+)?))?/;
|
|
835
810
|
function parseSelector(source) {
|
|
836
811
|
if (Array.isArray(source)) {
|
|
@@ -882,7 +857,7 @@ function parseSelector(source) {
|
|
|
882
857
|
const selector = {
|
|
883
858
|
type: "BoxSelector",
|
|
884
859
|
spatial: {
|
|
885
|
-
unit: matchBoxSelector[2] === "percent:" ? "percent" : "pixel",
|
|
860
|
+
unit: matchBoxSelector[2] === "percent:" || matchBoxSelector[2] === "pct:" ? "percent" : "pixel",
|
|
886
861
|
x: parseFloat(matchBoxSelector[3]),
|
|
887
862
|
y: parseFloat(matchBoxSelector[4]),
|
|
888
863
|
width: parseFloat(matchBoxSelector[5]),
|
|
@@ -918,26 +893,6 @@ function parseSelector(source) {
|
|
|
918
893
|
selectors: []
|
|
919
894
|
};
|
|
920
895
|
}
|
|
921
|
-
|
|
922
|
-
var __defProp$7 = Object.defineProperty;
|
|
923
|
-
var __defProps$5 = Object.defineProperties;
|
|
924
|
-
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
925
|
-
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
926
|
-
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
927
|
-
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
928
|
-
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
929
|
-
var __spreadValues$7 = (a, b) => {
|
|
930
|
-
for (var prop in b || (b = {}))
|
|
931
|
-
if (__hasOwnProp$7.call(b, prop))
|
|
932
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
933
|
-
if (__getOwnPropSymbols$7)
|
|
934
|
-
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
935
|
-
if (__propIsEnum$7.call(b, prop))
|
|
936
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
937
|
-
}
|
|
938
|
-
return a;
|
|
939
|
-
};
|
|
940
|
-
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
941
896
|
function expandTarget(target, options = {}) {
|
|
942
897
|
if (Array.isArray(target)) {
|
|
943
898
|
return expandTarget(target[0]);
|
|
@@ -994,7 +949,7 @@ function expandTarget(target, options = {}) {
|
|
|
994
949
|
if (!fragment) {
|
|
995
950
|
return {
|
|
996
951
|
type: "SpecificResource",
|
|
997
|
-
source: __spreadProps
|
|
952
|
+
source: __spreadProps(__spreadValues({}, target), {
|
|
998
953
|
id
|
|
999
954
|
}),
|
|
1000
955
|
selector: null,
|
|
@@ -1003,7 +958,7 @@ function expandTarget(target, options = {}) {
|
|
|
1003
958
|
}
|
|
1004
959
|
return expandTarget({
|
|
1005
960
|
type: "SpecificResource",
|
|
1006
|
-
source: __spreadProps
|
|
961
|
+
source: __spreadProps(__spreadValues({}, target), {
|
|
1007
962
|
id
|
|
1008
963
|
}),
|
|
1009
964
|
selector: {
|
|
@@ -1019,26 +974,6 @@ function expandTarget(target, options = {}) {
|
|
|
1019
974
|
selectors: []
|
|
1020
975
|
};
|
|
1021
976
|
}
|
|
1022
|
-
|
|
1023
|
-
var __defProp$6 = Object.defineProperty;
|
|
1024
|
-
var __defProps$4 = Object.defineProperties;
|
|
1025
|
-
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
1026
|
-
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
1027
|
-
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
1028
|
-
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
1029
|
-
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1030
|
-
var __spreadValues$6 = (a, b) => {
|
|
1031
|
-
for (var prop in b || (b = {}))
|
|
1032
|
-
if (__hasOwnProp$6.call(b, prop))
|
|
1033
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
1034
|
-
if (__getOwnPropSymbols$6)
|
|
1035
|
-
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
1036
|
-
if (__propIsEnum$6.call(b, prop))
|
|
1037
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
1038
|
-
}
|
|
1039
|
-
return a;
|
|
1040
|
-
};
|
|
1041
|
-
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
1042
977
|
function useAnnotation(options = {}, deps = []) {
|
|
1043
978
|
const { id, selector } = options;
|
|
1044
979
|
const ctx = useResourceContext();
|
|
@@ -1050,7 +985,7 @@ function useAnnotation(options = {}, deps = []) {
|
|
|
1050
985
|
if (!annotation) {
|
|
1051
986
|
return void 0;
|
|
1052
987
|
}
|
|
1053
|
-
const newAnnotation = __spreadProps
|
|
988
|
+
const newAnnotation = __spreadProps(__spreadValues({}, annotation), {
|
|
1054
989
|
body,
|
|
1055
990
|
target: expandTarget(annotation.target, { typeMap: vault.getState().iiif.mapping })
|
|
1056
991
|
});
|
|
@@ -1060,7 +995,6 @@ function useAnnotation(options = {}, deps = []) {
|
|
|
1060
995
|
return newAnnotation;
|
|
1061
996
|
}, [annotation, selector, body, ...deps]);
|
|
1062
997
|
}
|
|
1063
|
-
|
|
1064
998
|
function useCanvas(options = {}, deps = []) {
|
|
1065
999
|
const { id, selector } = options;
|
|
1066
1000
|
const ctx = useResourceContext();
|
|
@@ -1076,30 +1010,15 @@ function useCanvas(options = {}, deps = []) {
|
|
|
1076
1010
|
return canvas;
|
|
1077
1011
|
}, [canvas, selector, ...deps]);
|
|
1078
1012
|
}
|
|
1079
|
-
|
|
1080
|
-
var __defProp$5 = Object.defineProperty;
|
|
1081
|
-
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
1082
|
-
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
1083
|
-
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
1084
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1085
|
-
var __spreadValues$5 = (a, b) => {
|
|
1086
|
-
for (var prop in b || (b = {}))
|
|
1087
|
-
if (__hasOwnProp$5.call(b, prop))
|
|
1088
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
1089
|
-
if (__getOwnPropSymbols$5)
|
|
1090
|
-
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
1091
|
-
if (__propIsEnum$5.call(b, prop))
|
|
1092
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
1093
|
-
}
|
|
1094
|
-
return a;
|
|
1095
|
-
};
|
|
1096
1013
|
const RenderAnnotation = ({
|
|
1097
1014
|
id,
|
|
1098
1015
|
style: defaultStyle,
|
|
1099
1016
|
className,
|
|
1100
1017
|
interactive
|
|
1101
1018
|
}) => {
|
|
1102
|
-
const annotation = useAnnotation({
|
|
1019
|
+
const annotation = useAnnotation({
|
|
1020
|
+
id
|
|
1021
|
+
});
|
|
1103
1022
|
const style = useStyles(annotation, "atlas");
|
|
1104
1023
|
const html = useStyles(annotation, "html");
|
|
1105
1024
|
const events = useResourceEvents(annotation, ["atlas"]);
|
|
@@ -1111,7 +1030,7 @@ const RenderAnnotation = ({
|
|
|
1111
1030
|
if (!isValid) {
|
|
1112
1031
|
return null;
|
|
1113
1032
|
}
|
|
1114
|
-
return /* @__PURE__ */
|
|
1033
|
+
return /* @__PURE__ */ jsx(RegionHighlight, __spreadValues({
|
|
1115
1034
|
id: annotation.id,
|
|
1116
1035
|
isEditing: true,
|
|
1117
1036
|
region: annotation.target.selector.spatial,
|
|
@@ -1123,7 +1042,6 @@ const RenderAnnotation = ({
|
|
|
1123
1042
|
hrefTarget: (html == null ? void 0 : html.target) || null
|
|
1124
1043
|
}, events));
|
|
1125
1044
|
};
|
|
1126
|
-
|
|
1127
1045
|
const RenderAnnotationPage = ({
|
|
1128
1046
|
className,
|
|
1129
1047
|
page
|
|
@@ -1132,17 +1050,16 @@ const RenderAnnotationPage = ({
|
|
|
1132
1050
|
const style = useStyles(page, "atlas");
|
|
1133
1051
|
const html = useStyles(page, "html");
|
|
1134
1052
|
useVaultSelector((state) => page.id ? state.iiif.entities.AnnotationPage[page.id] : null, []);
|
|
1135
|
-
return /* @__PURE__ */
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1053
|
+
return /* @__PURE__ */ jsx(Fragment$1, {
|
|
1054
|
+
children: (_a = page.items) == null ? void 0 : _a.map((annotation) => {
|
|
1055
|
+
return /* @__PURE__ */ jsx(RenderAnnotation, {
|
|
1056
|
+
id: annotation.id,
|
|
1057
|
+
style,
|
|
1058
|
+
className: (html == null ? void 0 : html.className) || className
|
|
1059
|
+
}, annotation.id);
|
|
1060
|
+
})
|
|
1061
|
+
});
|
|
1143
1062
|
};
|
|
1144
|
-
|
|
1145
|
-
const TileSet = TileSet$1;
|
|
1146
1063
|
function RenderImage({
|
|
1147
1064
|
id,
|
|
1148
1065
|
image,
|
|
@@ -1154,35 +1071,33 @@ function RenderImage({
|
|
|
1154
1071
|
children
|
|
1155
1072
|
}) {
|
|
1156
1073
|
var _a, _b, _c, _d;
|
|
1157
|
-
return /* @__PURE__ */
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
} :
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
}), annotations, children));
|
|
1074
|
+
return /* @__PURE__ */ jsx(Fragment$1, {
|
|
1075
|
+
children: !image.service ? /* @__PURE__ */ jsxs(Fragment$1, {
|
|
1076
|
+
children: [/* @__PURE__ */ jsx("world-image", {
|
|
1077
|
+
uri: image.id,
|
|
1078
|
+
target: image.target.spatial,
|
|
1079
|
+
display: image.width && image.height ? {
|
|
1080
|
+
width: image.width,
|
|
1081
|
+
height: image.height
|
|
1082
|
+
} : void 0
|
|
1083
|
+
}), annotations, children]
|
|
1084
|
+
}, "no-service") : /* @__PURE__ */ jsxs(Fragment$1, {
|
|
1085
|
+
children: [/* @__PURE__ */ jsx(TileSet, {
|
|
1086
|
+
tiles: {
|
|
1087
|
+
id: image.service.id || image.service["@id"] || "unknown",
|
|
1088
|
+
height: image.height,
|
|
1089
|
+
width: image.width,
|
|
1090
|
+
imageService: image.service,
|
|
1091
|
+
thumbnail: thumbnail && thumbnail.type === "fixed" ? thumbnail : void 0
|
|
1092
|
+
},
|
|
1093
|
+
x: ((_a = image.target) == null ? void 0 : _a.spatial.x) + x,
|
|
1094
|
+
y: ((_b = image.target) == null ? void 0 : _b.spatial.y) + y,
|
|
1095
|
+
width: (_c = image.target) == null ? void 0 : _c.spatial.width,
|
|
1096
|
+
height: (_d = image.target) == null ? void 0 : _d.spatial.height
|
|
1097
|
+
}), annotations, children]
|
|
1098
|
+
}, "service")
|
|
1099
|
+
}, id);
|
|
1184
1100
|
}
|
|
1185
|
-
|
|
1186
1101
|
function parseSpecificResource(resource) {
|
|
1187
1102
|
if (resource.type === "SpecificResource") {
|
|
1188
1103
|
return [resource.source, { selector: resource.selector }];
|
|
@@ -1241,7 +1156,6 @@ const unknownResponse = { type: "unknown" };
|
|
|
1241
1156
|
const unsupportedStrategy = (reason) => {
|
|
1242
1157
|
return { type: "unknown", reason, annotations: { pages: [] } };
|
|
1243
1158
|
};
|
|
1244
|
-
|
|
1245
1159
|
function useManifest(options = {}, deps = []) {
|
|
1246
1160
|
const { id, selector } = options;
|
|
1247
1161
|
const ctx = useResourceContext();
|
|
@@ -1258,7 +1172,6 @@ function useManifest(options = {}, deps = []) {
|
|
|
1258
1172
|
return manifest;
|
|
1259
1173
|
}, [manifest, selector, ...deps]);
|
|
1260
1174
|
}
|
|
1261
|
-
|
|
1262
1175
|
function getMeta$1(state, resourceId) {
|
|
1263
1176
|
var _a;
|
|
1264
1177
|
const resourceMeta = (_a = state == null ? void 0 : state.iiif) == null ? void 0 : _a.meta[resourceId];
|
|
@@ -1285,7 +1198,6 @@ function useEnabledAnnotationPageIds(resourceId, availablePageIds) {
|
|
|
1285
1198
|
return pageIds;
|
|
1286
1199
|
}, [resourceId, availablePageIds]);
|
|
1287
1200
|
}
|
|
1288
|
-
|
|
1289
1201
|
function flattenAnnotationPageIds({
|
|
1290
1202
|
canvas,
|
|
1291
1203
|
manifest,
|
|
@@ -1319,26 +1231,6 @@ function flattenAnnotationPageIds({
|
|
|
1319
1231
|
}
|
|
1320
1232
|
return foundIds;
|
|
1321
1233
|
}
|
|
1322
|
-
|
|
1323
|
-
var __defProp$4 = Object.defineProperty;
|
|
1324
|
-
var __defProps$3 = Object.defineProperties;
|
|
1325
|
-
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
1326
|
-
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
1327
|
-
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
1328
|
-
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
1329
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1330
|
-
var __spreadValues$4 = (a, b) => {
|
|
1331
|
-
for (var prop in b || (b = {}))
|
|
1332
|
-
if (__hasOwnProp$4.call(b, prop))
|
|
1333
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
1334
|
-
if (__getOwnPropSymbols$4)
|
|
1335
|
-
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
1336
|
-
if (__propIsEnum$4.call(b, prop))
|
|
1337
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
1338
|
-
}
|
|
1339
|
-
return a;
|
|
1340
|
-
};
|
|
1341
|
-
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
1342
1234
|
function getMeta(state, resourceId) {
|
|
1343
1235
|
var _a;
|
|
1344
1236
|
const resourceMeta = (_a = state == null ? void 0 : state.iiif) == null ? void 0 : _a.meta[resourceId];
|
|
@@ -1369,7 +1261,7 @@ function useAnnotationPageManager(resourceId, options = {}) {
|
|
|
1369
1261
|
if (existingResources && !existingResources[resourceId]) {
|
|
1370
1262
|
return existingResources;
|
|
1371
1263
|
}
|
|
1372
|
-
return __spreadProps
|
|
1264
|
+
return __spreadProps(__spreadValues({}, existingResources || {}), {
|
|
1373
1265
|
[resourceId]: false
|
|
1374
1266
|
});
|
|
1375
1267
|
});
|
|
@@ -1396,7 +1288,7 @@ function useAnnotationPageManager(resourceId, options = {}) {
|
|
|
1396
1288
|
if (existingResources && existingResources[resourceId]) {
|
|
1397
1289
|
return existingResources;
|
|
1398
1290
|
}
|
|
1399
|
-
return __spreadProps
|
|
1291
|
+
return __spreadProps(__spreadValues({}, existingResources || {}), {
|
|
1400
1292
|
[resourceId]: true
|
|
1401
1293
|
});
|
|
1402
1294
|
});
|
|
@@ -1408,35 +1300,13 @@ function useAnnotationPageManager(resourceId, options = {}) {
|
|
|
1408
1300
|
setPageDisabled
|
|
1409
1301
|
};
|
|
1410
1302
|
}
|
|
1411
|
-
|
|
1412
1303
|
function useResources(ids, type) {
|
|
1413
1304
|
return useVaultSelector((state, vault) => vault.get(ids.map((id) => ({ id, type }))), [ids, type]);
|
|
1414
1305
|
}
|
|
1415
|
-
|
|
1416
|
-
const ImageServiceLoaderContext = React$1.createContext(new ImageServiceLoader());
|
|
1306
|
+
const ImageServiceLoaderContext = React__default.createContext(new ImageServiceLoader());
|
|
1417
1307
|
function useImageServiceLoader() {
|
|
1418
1308
|
return useContext(ImageServiceLoaderContext);
|
|
1419
1309
|
}
|
|
1420
|
-
|
|
1421
|
-
var __defProp$3 = Object.defineProperty;
|
|
1422
|
-
var __defProps$2 = Object.defineProperties;
|
|
1423
|
-
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
1424
|
-
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
1425
|
-
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
1426
|
-
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
1427
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1428
|
-
var __spreadValues$3 = (a, b) => {
|
|
1429
|
-
for (var prop in b || (b = {}))
|
|
1430
|
-
if (__hasOwnProp$3.call(b, prop))
|
|
1431
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
1432
|
-
if (__getOwnPropSymbols$3)
|
|
1433
|
-
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
1434
|
-
if (__propIsEnum$3.call(b, prop))
|
|
1435
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
1436
|
-
}
|
|
1437
|
-
return a;
|
|
1438
|
-
};
|
|
1439
|
-
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
1440
1310
|
function useLoadImageService() {
|
|
1441
1311
|
const loader = useImageServiceLoader();
|
|
1442
1312
|
const [imageServiceStatus, setImageServiceStatus] = useState({});
|
|
@@ -1460,7 +1330,7 @@ function useLoadImageService() {
|
|
|
1460
1330
|
} else if (!imageServiceStatus[imageServiceId]) {
|
|
1461
1331
|
if (!didUnmount.current) {
|
|
1462
1332
|
setImageServiceStatus((r) => {
|
|
1463
|
-
return __spreadProps
|
|
1333
|
+
return __spreadProps(__spreadValues({}, r), {
|
|
1464
1334
|
[imageServiceId]: "loading"
|
|
1465
1335
|
});
|
|
1466
1336
|
});
|
|
@@ -1472,7 +1342,7 @@ function useLoadImageService() {
|
|
|
1472
1342
|
}).then(() => {
|
|
1473
1343
|
if (!didUnmount.current) {
|
|
1474
1344
|
setImageServiceStatus((r) => {
|
|
1475
|
-
return __spreadProps
|
|
1345
|
+
return __spreadProps(__spreadValues({}, r), {
|
|
1476
1346
|
[imageServiceId]: "done"
|
|
1477
1347
|
});
|
|
1478
1348
|
});
|
|
@@ -1484,7 +1354,6 @@ function useLoadImageService() {
|
|
|
1484
1354
|
}, [loader, imageServiceStatus]);
|
|
1485
1355
|
return [loadImageService, imageServiceStatus];
|
|
1486
1356
|
}
|
|
1487
|
-
|
|
1488
1357
|
function usePaintingAnnotations(options = {}) {
|
|
1489
1358
|
const canvas = useCanvas(options.canvasId ? { id: options.canvasId } : void 0);
|
|
1490
1359
|
return useVaultSelector((state, vault) => {
|
|
@@ -1499,7 +1368,6 @@ function usePaintingAnnotations(options = {}) {
|
|
|
1499
1368
|
return flatAnnotations;
|
|
1500
1369
|
}, [canvas]);
|
|
1501
1370
|
}
|
|
1502
|
-
|
|
1503
1371
|
function usePaintables(options, deps = []) {
|
|
1504
1372
|
const vault = useVault();
|
|
1505
1373
|
const paintingAnnotations = usePaintingAnnotations();
|
|
@@ -1543,7 +1411,6 @@ function usePaintables(options, deps = []) {
|
|
|
1543
1411
|
const actions = { makeChoice };
|
|
1544
1412
|
return [paintables, actions];
|
|
1545
1413
|
}
|
|
1546
|
-
|
|
1547
1414
|
function getImageStrategy(canvas, paintables, loadImageService) {
|
|
1548
1415
|
const imageTypes = [];
|
|
1549
1416
|
for (const singleImage of paintables.items) {
|
|
@@ -1617,7 +1484,6 @@ function getImageStrategy(canvas, paintables, loadImageService) {
|
|
|
1617
1484
|
choice: paintables.choice
|
|
1618
1485
|
};
|
|
1619
1486
|
}
|
|
1620
|
-
|
|
1621
1487
|
const supportedFormats = ["model/gltf-binary"];
|
|
1622
1488
|
function get3dStrategy(canvas, paintables) {
|
|
1623
1489
|
const first = paintables.items[0];
|
|
@@ -1633,7 +1499,6 @@ function get3dStrategy(canvas, paintables) {
|
|
|
1633
1499
|
model: resource
|
|
1634
1500
|
};
|
|
1635
1501
|
}
|
|
1636
|
-
|
|
1637
1502
|
function getAudioStrategy(canvas, paintables) {
|
|
1638
1503
|
var _a;
|
|
1639
1504
|
if (!canvas.duration) {
|
|
@@ -1676,7 +1541,6 @@ function getAudioStrategy(canvas, paintables) {
|
|
|
1676
1541
|
}
|
|
1677
1542
|
};
|
|
1678
1543
|
}
|
|
1679
|
-
|
|
1680
1544
|
function getVideoStrategy(canvas, paintables) {
|
|
1681
1545
|
var _a;
|
|
1682
1546
|
const videoPaintables = paintables.items.filter((t) => t.type === "video");
|
|
@@ -1721,26 +1585,6 @@ function getVideoStrategy(canvas, paintables) {
|
|
|
1721
1585
|
}
|
|
1722
1586
|
};
|
|
1723
1587
|
}
|
|
1724
|
-
|
|
1725
|
-
var __defProp$2 = Object.defineProperty;
|
|
1726
|
-
var __defProps$1 = Object.defineProperties;
|
|
1727
|
-
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
1728
|
-
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
1729
|
-
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
1730
|
-
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
1731
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1732
|
-
var __spreadValues$2 = (a, b) => {
|
|
1733
|
-
for (var prop in b || (b = {}))
|
|
1734
|
-
if (__hasOwnProp$2.call(b, prop))
|
|
1735
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
1736
|
-
if (__getOwnPropSymbols$2)
|
|
1737
|
-
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
1738
|
-
if (__propIsEnum$2.call(b, prop))
|
|
1739
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
1740
|
-
}
|
|
1741
|
-
return a;
|
|
1742
|
-
};
|
|
1743
|
-
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
1744
1588
|
function useRenderingStrategy(options) {
|
|
1745
1589
|
const manifest = useManifest();
|
|
1746
1590
|
const canvas = useCanvas();
|
|
@@ -1798,21 +1642,96 @@ function useRenderingStrategy(options) {
|
|
|
1798
1642
|
return [strategy, emptyActions];
|
|
1799
1643
|
}
|
|
1800
1644
|
return [
|
|
1801
|
-
__spreadProps
|
|
1645
|
+
__spreadProps(__spreadValues({}, strategy), {
|
|
1802
1646
|
annotations: { pages: enabledPages }
|
|
1803
1647
|
}),
|
|
1804
1648
|
actions
|
|
1805
1649
|
];
|
|
1806
1650
|
}, [strategy, enabledPages]);
|
|
1807
1651
|
}
|
|
1808
|
-
|
|
1809
1652
|
const useVaultEffect = (callback, deps = []) => {
|
|
1810
1653
|
const vault = useVault();
|
|
1811
1654
|
useEffect(() => {
|
|
1812
1655
|
callback(vault);
|
|
1813
1656
|
}, [vault, ...deps]);
|
|
1814
1657
|
};
|
|
1815
|
-
|
|
1658
|
+
function createThumbnailHelper(vault, dependencies = {}) {
|
|
1659
|
+
const imageServiceLoader = dependencies.imageServiceLoader || new ImageServiceLoader();
|
|
1660
|
+
async function getBestThumbnailAtSize(input, request, dereference, candidates = [], dimensions) {
|
|
1661
|
+
if (typeof input === "string") {
|
|
1662
|
+
return { best: getFixedSizeFromImage(input), fallback: [], log: [] };
|
|
1663
|
+
}
|
|
1664
|
+
const fullInput = vault.get(input);
|
|
1665
|
+
if (typeof fullInput === "string") {
|
|
1666
|
+
return { best: getFixedSizeFromImage(fullInput), fallback: [], log: [] };
|
|
1667
|
+
}
|
|
1668
|
+
switch (fullInput.type) {
|
|
1669
|
+
case "Annotation": {
|
|
1670
|
+
const contentResources = fullInput.body;
|
|
1671
|
+
const firstContentResources = vault.get(contentResources[0]);
|
|
1672
|
+
if (dimensions && !firstContentResources.width) {
|
|
1673
|
+
firstContentResources.width = dimensions.width;
|
|
1674
|
+
firstContentResources.height = dimensions.height;
|
|
1675
|
+
}
|
|
1676
|
+
return await imageServiceLoader.getThumbnailFromResource(firstContentResources, request, dereference, candidates);
|
|
1677
|
+
}
|
|
1678
|
+
case "Canvas": {
|
|
1679
|
+
const canvas = fullInput;
|
|
1680
|
+
if (canvas.thumbnail && canvas.thumbnail.length) {
|
|
1681
|
+
const thumbnail = vault.get(canvas.thumbnail[0]);
|
|
1682
|
+
const potentialThumbnails = await imageServiceLoader.getImageCandidates(thumbnail, dereference);
|
|
1683
|
+
if (potentialThumbnails && potentialThumbnails.length) {
|
|
1684
|
+
candidates.push(...potentialThumbnails);
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
return getBestThumbnailAtSize(canvas.items[0], request, dereference, candidates, {
|
|
1688
|
+
width: canvas.width,
|
|
1689
|
+
height: canvas.height
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
case "AnnotationPage": {
|
|
1693
|
+
const annotationPage = fullInput;
|
|
1694
|
+
return getBestThumbnailAtSize(annotationPage.items[0], request, dereference, candidates, dimensions);
|
|
1695
|
+
}
|
|
1696
|
+
case "Choice": {
|
|
1697
|
+
const choice = fullInput;
|
|
1698
|
+
return getBestThumbnailAtSize(choice.items[0], request, dereference, candidates, dimensions);
|
|
1699
|
+
}
|
|
1700
|
+
case "Collection": {
|
|
1701
|
+
const collection = fullInput;
|
|
1702
|
+
const firstManifest = collection.items[0];
|
|
1703
|
+
return getBestThumbnailAtSize(firstManifest, request, dereference, candidates, dimensions);
|
|
1704
|
+
}
|
|
1705
|
+
case "Manifest": {
|
|
1706
|
+
const manifest = fullInput;
|
|
1707
|
+
const firstCanvas = manifest.items[0];
|
|
1708
|
+
return getBestThumbnailAtSize(firstCanvas, request, dereference, candidates, dimensions);
|
|
1709
|
+
}
|
|
1710
|
+
case "SpecificResource":
|
|
1711
|
+
case "Image":
|
|
1712
|
+
case "Dataset":
|
|
1713
|
+
case "Sound":
|
|
1714
|
+
case "Text":
|
|
1715
|
+
case "TextualBody":
|
|
1716
|
+
case "Video":
|
|
1717
|
+
if (dimensions && !fullInput.width) {
|
|
1718
|
+
fullInput.width = dimensions.width;
|
|
1719
|
+
fullInput.height = dimensions.height;
|
|
1720
|
+
}
|
|
1721
|
+
return imageServiceLoader.getThumbnailFromResource(fullInput, request, dereference, candidates);
|
|
1722
|
+
case "Service":
|
|
1723
|
+
case "Range":
|
|
1724
|
+
case "AnnotationCollection":
|
|
1725
|
+
case "CanvasReference":
|
|
1726
|
+
case "ContentResource":
|
|
1727
|
+
return { best: void 0, fallback: [], log: [] };
|
|
1728
|
+
}
|
|
1729
|
+
return { best: void 0, fallback: [], log: [] };
|
|
1730
|
+
}
|
|
1731
|
+
return {
|
|
1732
|
+
getBestThumbnailAtSize
|
|
1733
|
+
};
|
|
1734
|
+
}
|
|
1816
1735
|
function useThumbnail(request, dereference, { canvasId, manifestId } = {}) {
|
|
1817
1736
|
const vault = useVault();
|
|
1818
1737
|
const loader = useImageServiceLoader();
|
|
@@ -1839,49 +1758,29 @@ function useThumbnail(request, dereference, { canvasId, manifestId } = {}) {
|
|
|
1839
1758
|
}, [subject]);
|
|
1840
1759
|
return thumbnail;
|
|
1841
1760
|
}
|
|
1842
|
-
|
|
1843
|
-
var __defProp$1 = Object.defineProperty;
|
|
1844
|
-
var __defProps = Object.defineProperties;
|
|
1845
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
1846
|
-
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
1847
|
-
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
1848
|
-
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
1849
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1850
|
-
var __spreadValues$1 = (a, b) => {
|
|
1851
|
-
for (var prop in b || (b = {}))
|
|
1852
|
-
if (__hasOwnProp$1.call(b, prop))
|
|
1853
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
1854
|
-
if (__getOwnPropSymbols$1)
|
|
1855
|
-
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
1856
|
-
if (__propIsEnum$1.call(b, prop))
|
|
1857
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
1858
|
-
}
|
|
1859
|
-
return a;
|
|
1860
|
-
};
|
|
1861
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1862
1761
|
function getDefaultState(duration) {
|
|
1863
1762
|
return { isMuted: false, playRequested: false, isPlaying: false, isFinished: false, volume: 100, duration };
|
|
1864
1763
|
}
|
|
1865
1764
|
function reducer(state, action) {
|
|
1866
1765
|
switch (action.type) {
|
|
1867
1766
|
case "FINISHED":
|
|
1868
|
-
return __spreadProps(__spreadValues
|
|
1767
|
+
return __spreadProps(__spreadValues({}, state), { isFinished: true, isPlaying: false, playRequested: false });
|
|
1869
1768
|
case "PLAY_PAUSE":
|
|
1870
|
-
return __spreadProps(__spreadValues
|
|
1769
|
+
return __spreadProps(__spreadValues({}, state), { isFinished: false, isPlaying: !state.isPlaying });
|
|
1871
1770
|
case "PLAY_REQUESTED":
|
|
1872
|
-
return __spreadProps(__spreadValues
|
|
1771
|
+
return __spreadProps(__spreadValues({}, state), { isFinished: false, playRequested: true });
|
|
1873
1772
|
case "PAUSE":
|
|
1874
|
-
return __spreadProps(__spreadValues
|
|
1773
|
+
return __spreadProps(__spreadValues({}, state), { isPlaying: false });
|
|
1875
1774
|
case "PLAY":
|
|
1876
|
-
return __spreadProps(__spreadValues
|
|
1775
|
+
return __spreadProps(__spreadValues({}, state), { isFinished: false, playRequested: false, isPlaying: true });
|
|
1877
1776
|
case "MUTE":
|
|
1878
|
-
return __spreadProps(__spreadValues
|
|
1777
|
+
return __spreadProps(__spreadValues({}, state), { isMuted: true });
|
|
1879
1778
|
case "SET_VOLUME":
|
|
1880
|
-
return __spreadProps(__spreadValues
|
|
1779
|
+
return __spreadProps(__spreadValues({}, state), { volume: action.volume, isMuted: action.volume === 0 });
|
|
1881
1780
|
case "TOGGLE_MUTE":
|
|
1882
|
-
return __spreadProps(__spreadValues
|
|
1781
|
+
return __spreadProps(__spreadValues({}, state), { isMuted: !state.isMuted });
|
|
1883
1782
|
case "UNMUTE":
|
|
1884
|
-
return __spreadProps(__spreadValues
|
|
1783
|
+
return __spreadProps(__spreadValues({}, state), { isMuted: false });
|
|
1885
1784
|
}
|
|
1886
1785
|
return state;
|
|
1887
1786
|
}
|
|
@@ -1999,7 +1898,6 @@ function useSimpleMediaPlayer(props) {
|
|
|
1999
1898
|
}
|
|
2000
1899
|
];
|
|
2001
1900
|
}
|
|
2002
|
-
|
|
2003
1901
|
const MediaReactContextState = createContext(null);
|
|
2004
1902
|
const MediaReactContextActions = createContext(null);
|
|
2005
1903
|
const MediaReactContextElements = createContext(null);
|
|
@@ -2032,35 +1930,65 @@ function MediaPlayerProvider({
|
|
|
2032
1930
|
progress,
|
|
2033
1931
|
element
|
|
2034
1932
|
}) {
|
|
2035
|
-
return /* @__PURE__ */
|
|
2036
|
-
value: {
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
1933
|
+
return /* @__PURE__ */ jsx(MediaReactContextElements.Provider, {
|
|
1934
|
+
value: {
|
|
1935
|
+
currentTime,
|
|
1936
|
+
progress,
|
|
1937
|
+
element
|
|
1938
|
+
},
|
|
1939
|
+
children: /* @__PURE__ */ jsx(MediaReactContextActions.Provider, {
|
|
1940
|
+
value: actions,
|
|
1941
|
+
children: /* @__PURE__ */ jsx(MediaReactContextState.Provider, {
|
|
1942
|
+
value: state,
|
|
1943
|
+
children
|
|
1944
|
+
})
|
|
1945
|
+
})
|
|
1946
|
+
});
|
|
1947
|
+
}
|
|
1948
|
+
function Audio({
|
|
1949
|
+
media,
|
|
1950
|
+
children
|
|
1951
|
+
}) {
|
|
1952
|
+
const [{
|
|
1953
|
+
element,
|
|
2049
1954
|
currentTime,
|
|
2050
|
-
progress
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
1955
|
+
progress
|
|
1956
|
+
}, state, actions] = useSimpleMediaPlayer({
|
|
1957
|
+
duration: media.duration
|
|
1958
|
+
});
|
|
1959
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
1960
|
+
children: /* @__PURE__ */ jsx(CanvasPortal, {
|
|
1961
|
+
children: /* @__PURE__ */ jsxs(MediaPlayerProvider, {
|
|
1962
|
+
state,
|
|
1963
|
+
actions,
|
|
1964
|
+
currentTime,
|
|
1965
|
+
progress,
|
|
1966
|
+
element,
|
|
1967
|
+
children: [/* @__PURE__ */ jsx("audio", {
|
|
1968
|
+
ref: element,
|
|
1969
|
+
src: media.url
|
|
1970
|
+
}), children]
|
|
1971
|
+
})
|
|
1972
|
+
})
|
|
1973
|
+
});
|
|
1974
|
+
}
|
|
1975
|
+
function Video({
|
|
1976
|
+
media,
|
|
1977
|
+
children
|
|
1978
|
+
}) {
|
|
1979
|
+
const [{
|
|
1980
|
+
element,
|
|
1981
|
+
currentTime,
|
|
1982
|
+
progress
|
|
1983
|
+
}, state, actions] = useSimpleMediaPlayer({
|
|
1984
|
+
duration: media.duration
|
|
1985
|
+
});
|
|
2060
1986
|
const Component = "div";
|
|
2061
|
-
return /* @__PURE__ */
|
|
2062
|
-
|
|
2063
|
-
|
|
1987
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
1988
|
+
children: [/* @__PURE__ */ jsxs(CanvasPortal, {
|
|
1989
|
+
overlay: true,
|
|
1990
|
+
children: [/* @__PURE__ */ jsx("style", {
|
|
1991
|
+
children: `
|
|
2064
1992
|
.video-container {
|
|
2065
1993
|
position: absolute;
|
|
2066
1994
|
top: 0;
|
|
@@ -2073,27 +2001,39 @@ function Video({ media, children }) {
|
|
|
2073
2001
|
justify-content: center;
|
|
2074
2002
|
pointer-events: visible;
|
|
2075
2003
|
}
|
|
2076
|
-
`
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2004
|
+
`
|
|
2005
|
+
}), /* @__PURE__ */ jsx(Component, {
|
|
2006
|
+
className: "video-container",
|
|
2007
|
+
part: "video-container",
|
|
2008
|
+
onClick: () => actions.playPause(),
|
|
2009
|
+
children: /* @__PURE__ */ jsx("video", {
|
|
2010
|
+
ref: element,
|
|
2011
|
+
src: media.url,
|
|
2012
|
+
style: {
|
|
2013
|
+
width: "100%",
|
|
2014
|
+
objectFit: "contain"
|
|
2015
|
+
}
|
|
2016
|
+
})
|
|
2017
|
+
})]
|
|
2018
|
+
}), /* @__PURE__ */ jsx(CanvasPortal, {
|
|
2019
|
+
children: /* @__PURE__ */ jsx(MediaPlayerProvider, {
|
|
2020
|
+
state,
|
|
2021
|
+
actions,
|
|
2022
|
+
currentTime,
|
|
2023
|
+
progress,
|
|
2024
|
+
element,
|
|
2025
|
+
children
|
|
2026
|
+
})
|
|
2027
|
+
})]
|
|
2028
|
+
});
|
|
2029
|
+
}
|
|
2030
|
+
function Model({
|
|
2031
|
+
model
|
|
2032
|
+
}) {
|
|
2033
|
+
return /* @__PURE__ */ jsxs(CanvasPortal, {
|
|
2034
|
+
overlay: true,
|
|
2035
|
+
children: [/* @__PURE__ */ jsx("style", {
|
|
2036
|
+
children: `
|
|
2097
2037
|
.model-container {
|
|
2098
2038
|
position: absolute;
|
|
2099
2039
|
top: 0;
|
|
@@ -2106,33 +2046,22 @@ function Model({ model }) {
|
|
|
2106
2046
|
justify-content: center;
|
|
2107
2047
|
pointer-events: visible;
|
|
2108
2048
|
}
|
|
2109
|
-
`
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
var __spreadValues = (a, b) => {
|
|
2126
|
-
for (var prop in b || (b = {}))
|
|
2127
|
-
if (__hasOwnProp.call(b, prop))
|
|
2128
|
-
__defNormalProp(a, prop, b[prop]);
|
|
2129
|
-
if (__getOwnPropSymbols)
|
|
2130
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
2131
|
-
if (__propIsEnum.call(b, prop))
|
|
2132
|
-
__defNormalProp(a, prop, b[prop]);
|
|
2133
|
-
}
|
|
2134
|
-
return a;
|
|
2135
|
-
};
|
|
2049
|
+
`
|
|
2050
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
2051
|
+
className: "model-container",
|
|
2052
|
+
children: /* @__PURE__ */ jsx("model-viewer", {
|
|
2053
|
+
"interaction-prompt": "none",
|
|
2054
|
+
style: {
|
|
2055
|
+
width: "100%",
|
|
2056
|
+
height: "100%"
|
|
2057
|
+
},
|
|
2058
|
+
"camera-controls": "",
|
|
2059
|
+
"ar-status": "not-presenting",
|
|
2060
|
+
src: model.id
|
|
2061
|
+
})
|
|
2062
|
+
})]
|
|
2063
|
+
});
|
|
2064
|
+
}
|
|
2136
2065
|
function RenderCanvas({
|
|
2137
2066
|
x,
|
|
2138
2067
|
y,
|
|
@@ -2152,7 +2081,9 @@ function RenderCanvas({
|
|
|
2152
2081
|
const helper = useMemo(() => createStylesHelper(vault), [vault]);
|
|
2153
2082
|
const [strategy, actions] = useRenderingStrategy({
|
|
2154
2083
|
strategies: strategies || ["images"],
|
|
2155
|
-
defaultChoices: defaultChoices == null ? void 0 : defaultChoices.map(({
|
|
2084
|
+
defaultChoices: defaultChoices == null ? void 0 : defaultChoices.map(({
|
|
2085
|
+
id
|
|
2086
|
+
}) => id)
|
|
2156
2087
|
});
|
|
2157
2088
|
const choice = strategy.type === "images" ? strategy.choice : void 0;
|
|
2158
2089
|
useEffect(() => {
|
|
@@ -2164,7 +2095,9 @@ function RenderCanvas({
|
|
|
2164
2095
|
if (defaultChoices) {
|
|
2165
2096
|
for (const choice2 of defaultChoices) {
|
|
2166
2097
|
if (typeof choice2.opacity !== "undefined") {
|
|
2167
|
-
helper.applyStyles({
|
|
2098
|
+
helper.applyStyles({
|
|
2099
|
+
id: choice2.id
|
|
2100
|
+
}, "atlas", {
|
|
2168
2101
|
opacity: choice2.opacity
|
|
2169
2102
|
});
|
|
2170
2103
|
}
|
|
@@ -2176,66 +2109,87 @@ function RenderCanvas({
|
|
|
2176
2109
|
onChoiceChange(choice);
|
|
2177
2110
|
}
|
|
2178
2111
|
}, [choice]);
|
|
2179
|
-
const thumbnail = useThumbnail({
|
|
2112
|
+
const thumbnail = useThumbnail({
|
|
2113
|
+
maxWidth: 256,
|
|
2114
|
+
maxHeight: 256
|
|
2115
|
+
});
|
|
2180
2116
|
if (!canvas) {
|
|
2181
2117
|
return null;
|
|
2182
2118
|
}
|
|
2183
2119
|
const accompanyingCanvas = canvas.accompanyingCanvas;
|
|
2184
|
-
const thumbnailFallbackImage = thumbnail && thumbnail.type === "fixed" ? /* @__PURE__ */
|
|
2120
|
+
const thumbnailFallbackImage = thumbnail && thumbnail.type === "fixed" ? /* @__PURE__ */ jsx("world-object", {
|
|
2185
2121
|
height: canvas.height,
|
|
2186
2122
|
width: canvas.width,
|
|
2187
2123
|
x,
|
|
2188
|
-
y
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2124
|
+
y,
|
|
2125
|
+
children: /* @__PURE__ */ jsx("world-image", {
|
|
2126
|
+
uri: thumbnail.id,
|
|
2127
|
+
target: {
|
|
2128
|
+
x: 0,
|
|
2129
|
+
y: 0,
|
|
2130
|
+
width: canvas.width,
|
|
2131
|
+
height: canvas.height
|
|
2132
|
+
},
|
|
2133
|
+
display: thumbnail.width && thumbnail.height ? {
|
|
2134
|
+
width: thumbnail.width,
|
|
2135
|
+
height: thumbnail.height
|
|
2136
|
+
} : void 0
|
|
2137
|
+
})
|
|
2138
|
+
}) : null;
|
|
2197
2139
|
if (strategy.type === "unknown") {
|
|
2198
2140
|
if (thumbnailFallbackImage) {
|
|
2199
2141
|
return thumbnailFallbackImage;
|
|
2200
2142
|
}
|
|
2201
2143
|
throw new Error(strategy.reason || "Unknown image strategy");
|
|
2202
2144
|
}
|
|
2203
|
-
const annotations = /* @__PURE__ */
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2145
|
+
const annotations = /* @__PURE__ */ jsxs(Fragment$1, {
|
|
2146
|
+
children: [virtualPage ? /* @__PURE__ */ jsx(RenderAnnotationPage, {
|
|
2147
|
+
page: virtualPage
|
|
2148
|
+
}) : null, strategy.annotations && strategy.annotations.pages ? strategy.annotations.pages.map((page) => {
|
|
2149
|
+
return /* @__PURE__ */ jsx(RenderAnnotationPage, {
|
|
2150
|
+
page
|
|
2151
|
+
}, page.id);
|
|
2152
|
+
}) : null, children]
|
|
2153
|
+
});
|
|
2154
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
2155
|
+
children: [/* @__PURE__ */ jsxs("world-object", __spreadProps(__spreadValues({
|
|
2156
|
+
height: canvas.height,
|
|
2157
|
+
width: canvas.width,
|
|
2158
|
+
x,
|
|
2159
|
+
y
|
|
2160
|
+
}, elementProps), {
|
|
2161
|
+
children: [strategy.type === "images" ? /* @__PURE__ */ jsxs(Fragment, {
|
|
2162
|
+
children: [strategy.images.map((image, idx) => {
|
|
2163
|
+
return /* @__PURE__ */ jsx(RenderImage, {
|
|
2164
|
+
isStatic,
|
|
2165
|
+
image,
|
|
2166
|
+
id: image.id,
|
|
2167
|
+
thumbnail: idx === 0 ? thumbnail : void 0,
|
|
2168
|
+
annotations
|
|
2169
|
+
}, image.id);
|
|
2170
|
+
}), renderViewerControls ? /* @__PURE__ */ jsx(CanvasPortal, {
|
|
2171
|
+
overlay: true,
|
|
2172
|
+
children: renderViewerControls(strategy)
|
|
2173
|
+
}) : null]
|
|
2174
|
+
}) : null, strategy.type === "3d-model" ? /* @__PURE__ */ jsx(Model, {
|
|
2175
|
+
model: strategy.model
|
|
2176
|
+
}) : null, strategy.type === "media" ? /* @__PURE__ */ jsx(Fragment, {
|
|
2177
|
+
children: strategy.media.type === "Sound" ? /* @__PURE__ */ jsxs(Audio, {
|
|
2178
|
+
media: strategy.media,
|
|
2179
|
+
children: [thumbnailFallbackImage, renderMediaControls ? renderMediaControls(strategy) : null]
|
|
2180
|
+
}) : strategy.media.type === "Video" ? /* @__PURE__ */ jsxs(Video, {
|
|
2181
|
+
media: strategy.media,
|
|
2182
|
+
children: [thumbnailFallbackImage, renderMediaControls ? renderMediaControls(strategy) : null]
|
|
2183
|
+
}) : null
|
|
2184
|
+
}) : null]
|
|
2185
|
+
}), strategy.type), strategy.type === "media" && strategy.media.type === "Sound" && accompanyingCanvas ? /* @__PURE__ */ jsx(CanvasContext, {
|
|
2186
|
+
canvas: accompanyingCanvas.id,
|
|
2187
|
+
children: /* @__PURE__ */ jsx(RenderCanvas, {
|
|
2188
|
+
renderViewerControls
|
|
2189
|
+
})
|
|
2190
|
+
}) : null]
|
|
2191
|
+
});
|
|
2192
|
+
}
|
|
2239
2193
|
const CanvasPanel = {
|
|
2240
2194
|
RenderImage,
|
|
2241
2195
|
RenderCanvas,
|
|
@@ -2243,33 +2197,45 @@ const CanvasPanel = {
|
|
|
2243
2197
|
RenderAnnotation,
|
|
2244
2198
|
Viewer
|
|
2245
2199
|
};
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2200
|
+
function AnnotationContext({
|
|
2201
|
+
annotation,
|
|
2202
|
+
children
|
|
2203
|
+
}) {
|
|
2204
|
+
return /* @__PURE__ */ jsx(ResourceProvider, {
|
|
2205
|
+
value: {
|
|
2206
|
+
annotation
|
|
2207
|
+
},
|
|
2208
|
+
children
|
|
2209
|
+
});
|
|
2210
|
+
}
|
|
2211
|
+
function CollectionContext({
|
|
2212
|
+
collection,
|
|
2213
|
+
children
|
|
2214
|
+
}) {
|
|
2215
|
+
return /* @__PURE__ */ jsx(ResourceProvider, {
|
|
2216
|
+
value: {
|
|
2217
|
+
collection
|
|
2218
|
+
},
|
|
2219
|
+
children
|
|
2220
|
+
});
|
|
2221
|
+
}
|
|
2222
|
+
function RangeContext({
|
|
2223
|
+
range,
|
|
2224
|
+
children
|
|
2225
|
+
}) {
|
|
2226
|
+
return /* @__PURE__ */ jsx(ResourceProvider, {
|
|
2227
|
+
value: {
|
|
2228
|
+
range
|
|
2229
|
+
},
|
|
2230
|
+
children
|
|
2231
|
+
});
|
|
2232
|
+
}
|
|
2265
2233
|
function useAnnotationsAtTime(time, options = {}) {
|
|
2266
2234
|
const allAnnotations = usePaintingAnnotations(options);
|
|
2267
2235
|
return allAnnotations;
|
|
2268
2236
|
}
|
|
2269
|
-
|
|
2270
2237
|
function useCanvasClock(canvasId, autoplay = false) {
|
|
2271
2238
|
}
|
|
2272
|
-
|
|
2273
2239
|
function useCollection(options, deps = []) {
|
|
2274
2240
|
const { id, selector } = options;
|
|
2275
2241
|
const ctx = useResourceContext();
|
|
@@ -2285,7 +2251,6 @@ function useCollection(options, deps = []) {
|
|
|
2285
2251
|
return collection;
|
|
2286
2252
|
}, [collection, selector, ...deps]);
|
|
2287
2253
|
}
|
|
2288
|
-
|
|
2289
2254
|
function useEventListener(resource, name, listener, scope, deps = []) {
|
|
2290
2255
|
const vault = useVault();
|
|
2291
2256
|
const helper = useMemo(() => createEventsHelper(vault), [vault]);
|
|
@@ -2301,37 +2266,14 @@ function useEventListener(resource, name, listener, scope, deps = []) {
|
|
|
2301
2266
|
};
|
|
2302
2267
|
}, [helper, resource, name, ...deps]);
|
|
2303
2268
|
}
|
|
2304
|
-
|
|
2305
2269
|
function useExistingVault() {
|
|
2306
2270
|
const oldContext = useContext(ReactVaultContext);
|
|
2307
2271
|
return oldContext && oldContext.vault ? oldContext.vault : globalVault();
|
|
2308
2272
|
}
|
|
2309
|
-
|
|
2310
2273
|
function useExternalCollection(idOrRef, options) {
|
|
2311
2274
|
const { id, isLoaded, error, resource, requestId, cached } = useExternalResource(idOrRef, options);
|
|
2312
2275
|
return { id, isLoaded, error, manifest: resource, requestId, cached };
|
|
2313
2276
|
}
|
|
2314
|
-
|
|
2315
|
-
var __async = (__this, __arguments, generator) => {
|
|
2316
|
-
return new Promise((resolve, reject) => {
|
|
2317
|
-
var fulfilled = (value) => {
|
|
2318
|
-
try {
|
|
2319
|
-
step(generator.next(value));
|
|
2320
|
-
} catch (e) {
|
|
2321
|
-
reject(e);
|
|
2322
|
-
}
|
|
2323
|
-
};
|
|
2324
|
-
var rejected = (value) => {
|
|
2325
|
-
try {
|
|
2326
|
-
step(generator.throw(value));
|
|
2327
|
-
} catch (e) {
|
|
2328
|
-
reject(e);
|
|
2329
|
-
}
|
|
2330
|
-
};
|
|
2331
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
2332
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
2333
|
-
});
|
|
2334
|
-
};
|
|
2335
2277
|
function useImageService({ cacheKey } = {}) {
|
|
2336
2278
|
const canvas = useCanvas();
|
|
2337
2279
|
const annotations = usePaintingAnnotations();
|
|
@@ -2365,7 +2307,7 @@ function useImageService({ cacheKey } = {}) {
|
|
|
2365
2307
|
}, [key, cacheKey, canvas]);
|
|
2366
2308
|
const data = status === "success" && _data ? _data : initialData;
|
|
2367
2309
|
useEffect(() => {
|
|
2368
|
-
(() =>
|
|
2310
|
+
(async () => {
|
|
2369
2311
|
try {
|
|
2370
2312
|
if (canvas && annotations.length) {
|
|
2371
2313
|
const annotation = annotations[0];
|
|
@@ -2378,11 +2320,11 @@ function useImageService({ cacheKey } = {}) {
|
|
|
2378
2320
|
setIsFetching(true);
|
|
2379
2321
|
setStatus("loading");
|
|
2380
2322
|
try {
|
|
2381
|
-
const loadedService =
|
|
2323
|
+
const loadedService = await imageService.loadService({
|
|
2382
2324
|
id: firstImageService.id || firstImageService["@id"],
|
|
2383
2325
|
width: firstImageService.width || canvas.width,
|
|
2384
2326
|
height: firstImageService.height || canvas.height
|
|
2385
|
-
})
|
|
2327
|
+
}) || void 0;
|
|
2386
2328
|
setData(loadedService);
|
|
2387
2329
|
setStatus("success");
|
|
2388
2330
|
setIsFetching(false);
|
|
@@ -2395,7 +2337,7 @@ function useImageService({ cacheKey } = {}) {
|
|
|
2395
2337
|
setStatus("error");
|
|
2396
2338
|
setError(err);
|
|
2397
2339
|
}
|
|
2398
|
-
})
|
|
2340
|
+
})();
|
|
2399
2341
|
}, [key, cacheKey]);
|
|
2400
2342
|
return useMemo(() => {
|
|
2401
2343
|
return {
|
|
@@ -2406,7 +2348,6 @@ function useImageService({ cacheKey } = {}) {
|
|
|
2406
2348
|
};
|
|
2407
2349
|
}, [data, isFetching, status, error]);
|
|
2408
2350
|
}
|
|
2409
|
-
|
|
2410
2351
|
function useImageTile() {
|
|
2411
2352
|
const imageService = useImageService();
|
|
2412
2353
|
return {
|
|
@@ -2420,7 +2361,6 @@ function useImageTile() {
|
|
|
2420
2361
|
} : null
|
|
2421
2362
|
};
|
|
2422
2363
|
}
|
|
2423
|
-
|
|
2424
2364
|
function useRange(options = {}, deps = []) {
|
|
2425
2365
|
const { id, selector } = options;
|
|
2426
2366
|
const ctx = useResourceContext();
|
|
@@ -2436,15 +2376,13 @@ function useRange(options = {}, deps = []) {
|
|
|
2436
2376
|
return range;
|
|
2437
2377
|
}, [range, selector, ...deps]);
|
|
2438
2378
|
}
|
|
2439
|
-
|
|
2440
2379
|
function useSearchService() {
|
|
2441
2380
|
const manifest = useManifest();
|
|
2442
2381
|
return manifest ? manifest.service.find((service) => service.profile === "SearchService1" || service.profile === "http://iiif.io/api/search/1/search") : void 0;
|
|
2443
2382
|
}
|
|
2444
|
-
|
|
2445
2383
|
function useStyleHelper() {
|
|
2446
2384
|
const vault = useVault();
|
|
2447
2385
|
return useMemo(() => createStylesHelper(vault), [vault]);
|
|
2448
2386
|
}
|
|
2449
|
-
|
|
2450
|
-
|
|
2387
|
+
export { AnnotationContext, CanvasContext, CanvasPanel, CanvasPortal, CollectionContext, ContextBridge, ImageServiceLoaderContext, ManifestContext, MediaPlayerProvider, OverlayPortalContext, PortalContext, RangeContext, ReactVaultContext, ResourceProvider, ResourceReactContext, SimpleViewerProvider, SimpleViewerReactContext, VaultProvider, ViewerPresetContext, VirtualAnnotationProvider, VisibleCanvasReactContext, emptyActions, expandTarget, flattenAnnotationPageIds, formatTime, getImageStrategy, getPaintables, parseSelector, parseSpecificResource, unknownResponse, unsupportedStrategy, useAnnotation, useAnnotationPageManager, useAnnotationsAtTime, useCanvas, useCanvasClock, useCollection, useContextBridge, useDispatch, useEventListener, useExistingVault, useExternalCollection, useExternalManifest, useExternalResource, useImageService, useImageServiceLoader, useImageTile, useLoadImageService, useManifest, useMediaActions, useMediaElements, useMediaState, usePaintables, usePaintingAnnotations, useRange, useRenderingStrategy, useResourceContext, useResourceEvents, useResources, useSearchService, useSimpleMediaPlayer, useSimpleViewer, useStyleHelper, useStyles, useThumbnail, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };
|
|
2388
|
+
//# sourceMappingURL=index.mjs.map
|