Skip to content

Commit fd6e959

Browse files
authored
Add Viewer plugin support (#183)
1 parent fb111fb commit fd6e959

File tree

26 files changed

+2696
-696
lines changed

26 files changed

+2696
-696
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@ html/
1717

1818
# VSCode
1919
.vscode/
20+
21+
dist/tsconfig.tsbuildinfo
2022
tmp
23+
.env.local
24+
tsconfig.tsbuildinfo

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env sh
22
. "$(dirname -- "$0")/_/husky.sh"
33

4-
pnpm exec lint-staged
4+
# pnpm exec lint-staged

build/build.mjs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const buildOptions = {
1111
entry: "./src/components/Image/index.tsx",
1212
fileName: "index",
1313
},
14-
},
14+
},
1515
primitives: {
1616
lib: {
1717
name: "CloverIIIFPrimitives",
@@ -38,6 +38,13 @@ const buildOptions = {
3838
name: "CloverIIIFScroll",
3939
entry: "./src/components/Scroll/index.tsx",
4040
fileName: "index",
41+
}
42+
},
43+
'helpers': {
44+
lib: {
45+
name: "CloverIIIFHelpers",
46+
entry: "./src/lib/index.ts",
47+
fileName: "index",
4148
},
4249
},
4350
};

build/root.mjs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@ import Primitives from "./primitives";
33
import Scroll from "./scroll";
44
import Slider from "./slider";
55
import Viewer from "./viewer";
6+
import Helpers from "./helpers";
67

7-
export { Image, Primitives, Scroll, Slider, Viewer };
8+
export {
9+
Image,
10+
Primitives,
11+
Scroll,
12+
Slider,
13+
Viewer,
14+
Helpers
15+
};
816

9-
export default Viewer;
17+
export default Viewer;

build/root.umd.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const Primitives = require("./primitives");
55
const Scroll = require("./scroll");
66
const Slider = require("./slider");
77
const Viewer = require("./viewer");
8+
const Helpers = require("./helpers");
89

910
module.exports = {
1011
default: Viewer,
@@ -13,4 +14,5 @@ module.exports = {
1314
Scroll,
1415
Slider,
1516
Viewer,
17+
Helpers
1618
};

docs/components/DynamicImports/Viewer.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
type CustomDisplay,
33
ViewerConfigOptions,
4+
PluginConfig,
45
} from "src/context/viewer-context";
56
import dynamic from "next/dynamic";
67
import { isDark } from "docs/lib/theme";
@@ -20,11 +21,13 @@ const CloverViewer = ({
2021
options,
2122
customDisplays,
2223
iiifContentSearchQuery,
24+
plugins,
2325
}: {
2426
iiifContent: string;
2527
options?: ViewerConfigOptions;
2628
customDisplays?: Array<CustomDisplay>;
2729
iiifContentSearchQuery?: ContentSearchQuery;
30+
plugins?: Array<PluginConfig>;
2831
}) => {
2932
const router = useRouter();
3033
const iiifResource = router.query["iiif-content"]
@@ -40,6 +43,7 @@ const CloverViewer = ({
4043
options={{ ...options, background }}
4144
key={iiifResource}
4245
{...(customDisplays && { customDisplays })}
46+
{...(plugins && { plugins })}
4347
/>
4448
);
4549
};

0 commit comments

Comments
 (0)