Skip to content

Commit

Permalink
Add Viewer plugin support (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
wykhuh committed May 28, 2024
1 parent fb111fb commit fd6e959
Show file tree
Hide file tree
Showing 26 changed files with 2,696 additions and 696 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ html/

# VSCode
.vscode/

dist/tsconfig.tsbuildinfo
tmp
.env.local
tsconfig.tsbuildinfo
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm exec lint-staged
# pnpm exec lint-staged
9 changes: 8 additions & 1 deletion build/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const buildOptions = {
entry: "./src/components/Image/index.tsx",
fileName: "index",
},
},
},
primitives: {
lib: {
name: "CloverIIIFPrimitives",
Expand All @@ -38,6 +38,13 @@ const buildOptions = {
name: "CloverIIIFScroll",
entry: "./src/components/Scroll/index.tsx",
fileName: "index",
}
},
'helpers': {
lib: {
name: "CloverIIIFHelpers",
entry: "./src/lib/index.ts",
fileName: "index",
},
},
};
Expand Down
12 changes: 10 additions & 2 deletions build/root.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ import Primitives from "./primitives";
import Scroll from "./scroll";
import Slider from "./slider";
import Viewer from "./viewer";
import Helpers from "./helpers";

export { Image, Primitives, Scroll, Slider, Viewer };
export {
Image,
Primitives,
Scroll,
Slider,
Viewer,
Helpers
};

export default Viewer;
export default Viewer;
2 changes: 2 additions & 0 deletions build/root.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const Primitives = require("./primitives");
const Scroll = require("./scroll");
const Slider = require("./slider");
const Viewer = require("./viewer");
const Helpers = require("./helpers");

module.exports = {
default: Viewer,
Expand All @@ -13,4 +14,5 @@ module.exports = {
Scroll,
Slider,
Viewer,
Helpers
};
4 changes: 4 additions & 0 deletions docs/components/DynamicImports/Viewer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
type CustomDisplay,
ViewerConfigOptions,
PluginConfig,
} from "src/context/viewer-context";
import dynamic from "next/dynamic";
import { isDark } from "docs/lib/theme";
Expand All @@ -20,11 +21,13 @@ const CloverViewer = ({
options,
customDisplays,
iiifContentSearchQuery,
plugins,
}: {
iiifContent: string;
options?: ViewerConfigOptions;
customDisplays?: Array<CustomDisplay>;
iiifContentSearchQuery?: ContentSearchQuery;
plugins?: Array<PluginConfig>;
}) => {
const router = useRouter();
const iiifResource = router.query["iiif-content"]
Expand All @@ -40,6 +43,7 @@ const CloverViewer = ({
options={{ ...options, background }}
key={iiifResource}
{...(customDisplays && { customDisplays })}
{...(plugins && { plugins })}
/>
);
};
Expand Down
Loading

0 comments on commit fd6e959

Please sign in to comment.