react-iiif-vault 0.9.9 → 0.9.10
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/cjs/index.js +19 -11
- package/dist/esm/index.mjs +20 -12
- package/dist/index.umd.js +25 -15
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -719,14 +719,23 @@ const PortalContext = React__default["default"].createContext(null);
|
|
|
719
719
|
const OverlayPortalContext = React__default["default"].createContext(null);
|
|
720
720
|
function CanvasPortal({ children, overlay }) {
|
|
721
721
|
const htmlElement = React$1.useContext(overlay ? OverlayPortalContext : PortalContext);
|
|
722
|
-
const
|
|
722
|
+
const rootRef = React$1.useRef(null);
|
|
723
723
|
const preset = useViewerPreset();
|
|
724
724
|
React$1.useLayoutEffect(() => {
|
|
725
|
-
|
|
726
|
-
|
|
725
|
+
if (!rootRef.current) {
|
|
726
|
+
rootRef.current = htmlElement ? createRoot(htmlElement) : null;
|
|
727
|
+
}
|
|
728
|
+
}, []);
|
|
729
|
+
React$1.useLayoutEffect(() => {
|
|
730
|
+
return () => {
|
|
731
|
+
var _a;
|
|
732
|
+
(_a = rootRef.current) == null ? void 0 : _a.unmount();
|
|
733
|
+
rootRef.current = null;
|
|
734
|
+
};
|
|
735
|
+
}, []);
|
|
727
736
|
React$1.useLayoutEffect(() => {
|
|
728
|
-
if (
|
|
729
|
-
|
|
737
|
+
if (rootRef.current) {
|
|
738
|
+
rootRef.current.render(/* @__PURE__ */ React__default["default"].createElement(ViewerPresetContext.Provider, {
|
|
730
739
|
value: preset
|
|
731
740
|
}, children));
|
|
732
741
|
}
|
|
@@ -765,7 +774,6 @@ var __objRest = (source, exclude) => {
|
|
|
765
774
|
}
|
|
766
775
|
return target;
|
|
767
776
|
};
|
|
768
|
-
const AtlasAuto = atlas.AtlasAuto;
|
|
769
777
|
function Viewer(_a) {
|
|
770
778
|
var _b = _a, {
|
|
771
779
|
children,
|
|
@@ -789,9 +797,11 @@ function Viewer(_a) {
|
|
|
789
797
|
}, []);
|
|
790
798
|
return /* @__PURE__ */ React__default["default"].createElement(reactErrorBoundary_umd.exports.ErrorBoundary, {
|
|
791
799
|
fallbackRender: () => /* @__PURE__ */ React__default["default"].createElement(ErrorFallback, __spreadValues$8({}, props))
|
|
792
|
-
}, /* @__PURE__ */ React__default["default"].createElement(
|
|
793
|
-
style: { position: "relative" }
|
|
794
|
-
|
|
800
|
+
}, /* @__PURE__ */ React__default["default"].createElement(atlas.AtlasAuto, __spreadProps$6(__spreadValues$8({}, props), {
|
|
801
|
+
containerProps: __spreadValues$8({ style: { position: "relative" } }, props.containerProps || {}),
|
|
802
|
+
htmlChildren: /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
803
|
+
ref: overlayPortal
|
|
804
|
+
}),
|
|
795
805
|
onCreated: (preset) => {
|
|
796
806
|
setViewerPreset(preset);
|
|
797
807
|
if (props.onCreated) {
|
|
@@ -807,8 +817,6 @@ function Viewer(_a) {
|
|
|
807
817
|
}, /* @__PURE__ */ React__default["default"].createElement(ContextBridge, {
|
|
808
818
|
bridge
|
|
809
819
|
}, /* @__PURE__ */ React__default["default"].createElement(VirtualAnnotationProvider, null, children)))))), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
810
|
-
ref: overlayPortal
|
|
811
|
-
})), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
812
820
|
ref: portal
|
|
813
821
|
}));
|
|
814
822
|
}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React$1, { useContext, useMemo, useState, useEffect, createContext, useCallback, useRef, useLayoutEffect, Fragment, useReducer } from 'react';
|
|
2
|
-
import { AtlasAuto
|
|
2
|
+
import { AtlasAuto, mergeStyles, RegionHighlight, TileSet as TileSet$1 } from '@atlas-viewer/atlas';
|
|
3
3
|
import { globalVault, Vault } from '@iiif/vault';
|
|
4
4
|
import { createAction } from 'typesafe-actions';
|
|
5
5
|
import require$$0 from 'react-dom';
|
|
@@ -710,14 +710,23 @@ const PortalContext = React$1.createContext(null);
|
|
|
710
710
|
const OverlayPortalContext = React$1.createContext(null);
|
|
711
711
|
function CanvasPortal({ children, overlay }) {
|
|
712
712
|
const htmlElement = useContext(overlay ? OverlayPortalContext : PortalContext);
|
|
713
|
-
const
|
|
713
|
+
const rootRef = useRef(null);
|
|
714
714
|
const preset = useViewerPreset();
|
|
715
715
|
useLayoutEffect(() => {
|
|
716
|
-
|
|
717
|
-
|
|
716
|
+
if (!rootRef.current) {
|
|
717
|
+
rootRef.current = htmlElement ? createRoot(htmlElement) : null;
|
|
718
|
+
}
|
|
719
|
+
}, []);
|
|
720
|
+
useLayoutEffect(() => {
|
|
721
|
+
return () => {
|
|
722
|
+
var _a;
|
|
723
|
+
(_a = rootRef.current) == null ? void 0 : _a.unmount();
|
|
724
|
+
rootRef.current = null;
|
|
725
|
+
};
|
|
726
|
+
}, []);
|
|
718
727
|
useLayoutEffect(() => {
|
|
719
|
-
if (
|
|
720
|
-
|
|
728
|
+
if (rootRef.current) {
|
|
729
|
+
rootRef.current.render(/* @__PURE__ */ React$1.createElement(ViewerPresetContext.Provider, {
|
|
721
730
|
value: preset
|
|
722
731
|
}, children));
|
|
723
732
|
}
|
|
@@ -756,7 +765,6 @@ var __objRest = (source, exclude) => {
|
|
|
756
765
|
}
|
|
757
766
|
return target;
|
|
758
767
|
};
|
|
759
|
-
const AtlasAuto = AtlasAuto$1;
|
|
760
768
|
function Viewer(_a) {
|
|
761
769
|
var _b = _a, {
|
|
762
770
|
children,
|
|
@@ -780,9 +788,11 @@ function Viewer(_a) {
|
|
|
780
788
|
}, []);
|
|
781
789
|
return /* @__PURE__ */ React$1.createElement(reactErrorBoundary_umd.exports.ErrorBoundary, {
|
|
782
790
|
fallbackRender: () => /* @__PURE__ */ React$1.createElement(ErrorFallback, __spreadValues$8({}, props))
|
|
783
|
-
}, /* @__PURE__ */ React$1.createElement(
|
|
784
|
-
style: { position: "relative" }
|
|
785
|
-
|
|
791
|
+
}, /* @__PURE__ */ React$1.createElement(AtlasAuto, __spreadProps$6(__spreadValues$8({}, props), {
|
|
792
|
+
containerProps: __spreadValues$8({ style: { position: "relative" } }, props.containerProps || {}),
|
|
793
|
+
htmlChildren: /* @__PURE__ */ React$1.createElement("div", {
|
|
794
|
+
ref: overlayPortal
|
|
795
|
+
}),
|
|
786
796
|
onCreated: (preset) => {
|
|
787
797
|
setViewerPreset(preset);
|
|
788
798
|
if (props.onCreated) {
|
|
@@ -798,8 +808,6 @@ function Viewer(_a) {
|
|
|
798
808
|
}, /* @__PURE__ */ React$1.createElement(ContextBridge, {
|
|
799
809
|
bridge
|
|
800
810
|
}, /* @__PURE__ */ React$1.createElement(VirtualAnnotationProvider, null, children)))))), /* @__PURE__ */ React$1.createElement("div", {
|
|
801
|
-
ref: overlayPortal
|
|
802
|
-
})), /* @__PURE__ */ React$1.createElement("div", {
|
|
803
811
|
ref: portal
|
|
804
812
|
}));
|
|
805
813
|
}
|
package/dist/index.umd.js
CHANGED
|
@@ -28593,7 +28593,7 @@
|
|
|
28593
28593
|
});
|
|
28594
28594
|
|
|
28595
28595
|
var Atlas = function (_a) {
|
|
28596
|
-
var _renderPreset = _a.renderPreset, onCreated = _a.onCreated, _b = _a.mode, _mode = _b === void 0 ? 'explore' : _b, _c = _a.resetWorldOnChange, resetWorldOnChange = _c === void 0 ? true : _c, _d = _a.unstable_webglRenderer, unstable_webglRenderer = _d === void 0 ? false : _d, _e = _a.unstable_noReconciler, unstable_noReconciler = _e === void 0 ? false : _e, _f = _a.hideInlineStyle, hideInlineStyle = _f === void 0 ? false : _f; _a.controllerConfig; var children = _a.children, overlayStyle = _a.overlayStyle, containerStyle = _a.containerStyle, enableNavigator = _a.enableNavigator, className = _a.className, _g = _a.containerProps, containerProps = _g === void 0 ? {} : _g, homePosition = _a.homePosition, _background = _a.background, restProps = __rest(_a, ["renderPreset", "onCreated", "mode", "resetWorldOnChange", "unstable_webglRenderer", "unstable_noReconciler", "hideInlineStyle", "controllerConfig", "children", "overlayStyle", "containerStyle", "enableNavigator", "className", "containerProps", "homePosition", "background"]);
|
|
28596
|
+
var htmlChildren = _a.htmlChildren, _renderPreset = _a.renderPreset, onCreated = _a.onCreated, _b = _a.mode, _mode = _b === void 0 ? 'explore' : _b, _c = _a.resetWorldOnChange, resetWorldOnChange = _c === void 0 ? true : _c, _d = _a.unstable_webglRenderer, unstable_webglRenderer = _d === void 0 ? false : _d, _e = _a.unstable_noReconciler, unstable_noReconciler = _e === void 0 ? false : _e, _f = _a.hideInlineStyle, hideInlineStyle = _f === void 0 ? false : _f; _a.controllerConfig; var children = _a.children, overlayStyle = _a.overlayStyle, containerStyle = _a.containerStyle, enableNavigator = _a.enableNavigator, className = _a.className, _g = _a.containerProps, containerProps = _g === void 0 ? {} : _g, homePosition = _a.homePosition, _background = _a.background, restProps = __rest(_a, ["htmlChildren", "renderPreset", "onCreated", "mode", "resetWorldOnChange", "unstable_webglRenderer", "unstable_noReconciler", "hideInlineStyle", "controllerConfig", "children", "overlayStyle", "containerStyle", "enableNavigator", "className", "containerProps", "homePosition", "background"]);
|
|
28597
28597
|
var _h = __read(React$1.useState(_background), 2), background = _h[0], setBackground = _h[1];
|
|
28598
28598
|
var _j = __read(React$1.useState(_mode), 2), mode = _j[0], setMode = _j[1];
|
|
28599
28599
|
var _k = __read(React$1.useState(false), 2), isReady = _k[0], setIsReady = _k[1];
|
|
@@ -28812,7 +28812,8 @@
|
|
|
28812
28812
|
React__default["default"].createElement(AtlasContext.Provider, { value: preset }, children))))) : (React__default["default"].createElement(AtlasWithReconciler, { bounds: bounds, preset: preset, mode: mode, setIsReady: setIsReady, onCreated: onCreated }, children))),
|
|
28813
28813
|
enableNavigator ? (React__default["default"].createElement(Container, { className: "atlas-navigator" },
|
|
28814
28814
|
React__default["default"].createElement("canvas", { className: "atlas-navigator-canvas", part: "atlas-navigator-canvas", ref: refs.navigator }))) : null,
|
|
28815
|
-
hideInlineStyle ? (React__default["default"].createElement("style", null, ".atlas-width-".concat(widthClassName, " { width: ").concat(restProps.width, "px; height: ").concat(restProps.height, "px; }"))) : (React__default["default"].createElement("style", null, "\n .atlas { position: relative; user-select: none; display: flex; background: var(--atlas-background, #000); z-index: var(--atlas-z-index, 10); touch-action: none; }\n .atlas-width-".concat(widthClassName, " { width: ").concat(restProps.width, "px; height: ").concat(restProps.height, "px; }\n .atlas-canvas { flex: 1 1 0px; }\n .atlas-canvas:focus, .atlas-static-container:focus { outline: none }\n .atlas-canvas:focus-visible, .atlas-canvas-container:focus-visible { outline: var(--atlas-focus, 2px solid darkorange) }\n .atlas-static-container { position: relative; overflow: hidden; flex: 1 1 0px; }\n .atlas-overlay { position: absolute; top: 0; left: 0; pointer-events: none; overflow: hidden; }\n .atlas-static-image { position: absolute; pointer-events: none; user-select: none; transform-origin: 0px 0px; }\n .atlas-navigator { position: absolute; top: var(--atlas-navigator-top, 10px); right: var(--atlas-navigator-bottom, 10px); left: var(--atlas-navigator-left); bottom: var(--atlas-navigator-bottom); opacity: .8 }\n .atlas-navigator-canvas { width: 100%; }\n ")))
|
|
28815
|
+
hideInlineStyle ? (React__default["default"].createElement("style", null, ".atlas-width-".concat(widthClassName, " { width: ").concat(restProps.width, "px; height: ").concat(restProps.height, "px; }"))) : (React__default["default"].createElement("style", null, "\n .atlas { position: relative; user-select: none; display: flex; background: var(--atlas-background, #000); z-index: var(--atlas-z-index, 10); touch-action: none; }\n .atlas-width-".concat(widthClassName, " { width: ").concat(restProps.width, "px; height: ").concat(restProps.height, "px; }\n .atlas-canvas { flex: 1 1 0px; }\n .atlas-canvas:focus, .atlas-static-container:focus { outline: none }\n .atlas-canvas:focus-visible, .atlas-canvas-container:focus-visible { outline: var(--atlas-focus, 2px solid darkorange) }\n .atlas-static-container { position: relative; overflow: hidden; flex: 1 1 0px; }\n .atlas-overlay { position: absolute; top: 0; left: 0; pointer-events: none; overflow: hidden; }\n .atlas-static-image { position: absolute; pointer-events: none; user-select: none; transform-origin: 0px 0px; }\n .atlas-navigator { position: absolute; top: var(--atlas-navigator-top, 10px); right: var(--atlas-navigator-bottom, 10px); left: var(--atlas-navigator-left); bottom: var(--atlas-navigator-bottom); opacity: .8 }\n .atlas-navigator-canvas { width: 100%; }\n "))),
|
|
28816
|
+
htmlChildren));
|
|
28816
28817
|
};
|
|
28817
28818
|
|
|
28818
28819
|
function toPx(str) {
|
|
@@ -28822,7 +28823,7 @@
|
|
|
28822
28823
|
return str;
|
|
28823
28824
|
}
|
|
28824
28825
|
|
|
28825
|
-
var AtlasAuto
|
|
28826
|
+
var AtlasAuto = function (_a) {
|
|
28826
28827
|
var resizeHash = _a.resizeHash, aspectRatio = _a.aspectRatio, _b = _a.containerProps, containerProps = _b === void 0 ? {} : _b, props = __rest(_a, ["resizeHash", "aspectRatio", "containerProps"]);
|
|
28827
28828
|
var _c = __read(useMeasure(), 3), ref = _c[0], _bounds = _c[1], forceRefresh = _c[2];
|
|
28828
28829
|
var _d = props, height = _d.height, width = _d.width, restProps = __rest(_d, ["height", "width"]);
|
|
@@ -28840,7 +28841,8 @@
|
|
|
28840
28841
|
}, [_bounds, aspectRatio]);
|
|
28841
28842
|
return (React__default["default"].createElement(Container, __assign({ ref: ref, className: "atlas-container" }, containerProps),
|
|
28842
28843
|
bounds.width ? (React__default["default"].createElement(Atlas, __assign({ width: bounds.width || 100, height: bounds.height || 100 }, restProps), props.children)) : null,
|
|
28843
|
-
props.hideInlineStyle ? null : (React__default["default"].createElement("style", null, "\n .atlas-container { \n display: var(--atlas-container-display, block);\n flex: var(--atlas-container-flex, none);\n width: var(--atlas-container-width, ".concat(width ? "".concat(width, "px") : '100%', ");\n height: var(--atlas-container-height, ").concat(toPx(height ? height : aspectRatio ? bounds.height : 512), ") \n }\n ")))
|
|
28844
|
+
props.hideInlineStyle ? null : (React__default["default"].createElement("style", null, "\n .atlas-container { \n display: var(--atlas-container-display, block);\n flex: var(--atlas-container-flex, none);\n width: var(--atlas-container-width, ".concat(width ? "".concat(width, "px") : '100%', ");\n height: var(--atlas-container-height, ").concat(toPx(height ? height : aspectRatio ? bounds.height : 512), ") \n }\n "))),
|
|
28845
|
+
props.htmlChildren));
|
|
28844
28846
|
};
|
|
28845
28847
|
|
|
28846
28848
|
var useAtlas = function () {
|
|
@@ -29941,14 +29943,23 @@
|
|
|
29941
29943
|
const OverlayPortalContext = React__default["default"].createContext(null);
|
|
29942
29944
|
function CanvasPortal({ children, overlay }) {
|
|
29943
29945
|
const htmlElement = React$1.useContext(overlay ? OverlayPortalContext : PortalContext);
|
|
29944
|
-
const
|
|
29946
|
+
const rootRef = React$1.useRef(null);
|
|
29945
29947
|
const preset = useViewerPreset();
|
|
29946
29948
|
React$1.useLayoutEffect(() => {
|
|
29947
|
-
|
|
29948
|
-
|
|
29949
|
+
if (!rootRef.current) {
|
|
29950
|
+
rootRef.current = htmlElement ? createRoot(htmlElement) : null;
|
|
29951
|
+
}
|
|
29952
|
+
}, []);
|
|
29949
29953
|
React$1.useLayoutEffect(() => {
|
|
29950
|
-
|
|
29951
|
-
|
|
29954
|
+
return () => {
|
|
29955
|
+
var _a;
|
|
29956
|
+
(_a = rootRef.current) == null ? void 0 : _a.unmount();
|
|
29957
|
+
rootRef.current = null;
|
|
29958
|
+
};
|
|
29959
|
+
}, []);
|
|
29960
|
+
React$1.useLayoutEffect(() => {
|
|
29961
|
+
if (rootRef.current) {
|
|
29962
|
+
rootRef.current.render(/* @__PURE__ */ React__default["default"].createElement(ViewerPresetContext.Provider, {
|
|
29952
29963
|
value: preset
|
|
29953
29964
|
}, children));
|
|
29954
29965
|
}
|
|
@@ -29987,7 +29998,6 @@
|
|
|
29987
29998
|
}
|
|
29988
29999
|
return target;
|
|
29989
30000
|
};
|
|
29990
|
-
const AtlasAuto = AtlasAuto$1;
|
|
29991
30001
|
function Viewer(_a) {
|
|
29992
30002
|
var _b = _a, {
|
|
29993
30003
|
children,
|
|
@@ -30011,9 +30021,11 @@
|
|
|
30011
30021
|
}, []);
|
|
30012
30022
|
return /* @__PURE__ */ React__default["default"].createElement(reactErrorBoundary_umd.exports.ErrorBoundary, {
|
|
30013
30023
|
fallbackRender: () => /* @__PURE__ */ React__default["default"].createElement(ErrorFallback, __spreadValues$8({}, props))
|
|
30014
|
-
}, /* @__PURE__ */ React__default["default"].createElement(
|
|
30015
|
-
style: { position: "relative" }
|
|
30016
|
-
|
|
30024
|
+
}, /* @__PURE__ */ React__default["default"].createElement(AtlasAuto, __spreadProps$6(__spreadValues$8({}, props), {
|
|
30025
|
+
containerProps: __spreadValues$8({ style: { position: "relative" } }, props.containerProps || {}),
|
|
30026
|
+
htmlChildren: /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
30027
|
+
ref: overlayPortal
|
|
30028
|
+
}),
|
|
30017
30029
|
onCreated: (preset) => {
|
|
30018
30030
|
setViewerPreset(preset);
|
|
30019
30031
|
if (props.onCreated) {
|
|
@@ -30029,8 +30041,6 @@
|
|
|
30029
30041
|
}, /* @__PURE__ */ React__default["default"].createElement(ContextBridge, {
|
|
30030
30042
|
bridge
|
|
30031
30043
|
}, /* @__PURE__ */ React__default["default"].createElement(VirtualAnnotationProvider, null, children)))))), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
30032
|
-
ref: overlayPortal
|
|
30033
|
-
})), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
30034
30044
|
ref: portal
|
|
30035
30045
|
}));
|
|
30036
30046
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-iiif-vault",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.10",
|
|
4
4
|
"main": "./dist/cjs/index.js",
|
|
5
5
|
"module": "./dist/esm/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@iiif/presentation-3": "^1.0.5"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@atlas-viewer/atlas": "^2.0.0-alpha.
|
|
41
|
+
"@atlas-viewer/atlas": "^2.0.0-alpha.11",
|
|
42
42
|
"@atlas-viewer/iiif-image-api": "^2.*",
|
|
43
43
|
"@iiif/parser": ">=v1.0.10",
|
|
44
44
|
"@iiif/presentation-2": "^1.*",
|