Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Viewer plugin support #183

Merged
merged 30 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
baf3c4a
update .gitignore
wykhuh Feb 14, 2024
15ac0ec
add plugins to Viewer
wykhuh Feb 22, 2024
eb03da7
refactor getAnnotationResources to handle external annotation pages
wykhuh Feb 24, 2024
98fdeae
refactor parseAnnotationTarget to handle FragmentSelector
wykhuh Feb 24, 2024
a4a3f96
add ignoreAnnotationOverlaysLabels to not add overlays to annotations
wykhuh Feb 27, 2024
2836f71
add infomation panel to plugins
wykhuh Mar 5, 2024
0528f09
export annotation and helpers
wykhuh Mar 5, 2024
366e081
fix - add try catch to getAnnotationResources
wykhuh Mar 5, 2024
451dd05
refactor plugin component and info panel to have same props
wykhuh Mar 7, 2024
1088534
add Plugin typescript type
wykhuh Mar 7, 2024
e951790
add menu section to plugins props
wykhuh Mar 7, 2024
6350c7d
refactor plugin info panel so the panel can be shown or hidden
wykhuh Mar 8, 2024
d83498b
update build process to include annotation and openseadragon helpers
wykhuh Mar 9, 2024
d535797
update types for plugins
wykhuh Mar 10, 2024
04fb1b2
improve error handling - add console.log, ErrorFallback, try...catch
wykhuh Mar 10, 2024
b20633f
fix - handle cases when annotation have no body for formatPluginAnnot…
wykhuh Mar 11, 2024
a421b1b
update gitignore
wykhuh Mar 11, 2024
6331e93
remove annotations from plugins
wykhuh Apr 18, 2024
c769703
add imageViewer property to plugin config
wykhuh Apr 17, 2024
dd2e097
fix linting issues
wykhuh Apr 18, 2024
8148cac
Update package-lock.json
wykhuh May 20, 2024
5f44adb
delete unneeded code
wykhuh May 20, 2024
3c450e9
reorganize exporting as helper functions
wykhuh May 23, 2024
70980ed
rename imageViewer.menu to imageViewer.controls
wykhuh May 23, 2024
1ac9988
update PluginInformationPanel type
wykhuh May 23, 2024
63300f8
simplify props passed to plugin components
wykhuh May 24, 2024
9efd5ea
reorganize exporting as helper functions
wykhuh May 24, 2024
6ea8b8d
add documentation for plugins
wykhuh May 24, 2024
448c383
add plugins to viewer docs
wykhuh May 24, 2024
2be1c8c
consolidate helpers export
wykhuh May 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
16 changes: 15 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,20 @@ const buildOptions = {
name: "CloverIIIFScroll",
entry: "./src/components/Scroll/index.tsx",
fileName: "index",
}
},
'annotation-helpers': {
lib: {
name: "CloverIIIFAnnotationHelpers",
entry: "./src/lib/annotation-helpers.ts",
fileName: "index",
},
},
'openseadragon-helpers': {
lib: {
name: "CloverIIIFOpenseadragonHelpers",
entry: "./src/lib/openseadragon-helpers.ts",
fileName: "index",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might bloat over time. I wonder if we should try to consolidate all helpers under a single export?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I consolidated the helpers in a single export

},
},
};
Expand Down
16 changes: 14 additions & 2 deletions build/root.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@ import Primitives from "./primitives";
import Scroll from "./scroll";
import Slider from "./slider";
import Viewer from "./viewer";
import {
parseAnnotationTarget,
} from "./annotation-helpers";
import { createOpenSeadragonRect } from "./openseadragon-helpers";

export { Image, Primitives, Scroll, Slider, Viewer };
export {
Image,
Primitives,
Scroll,
Slider,
Viewer,
parseAnnotationTarget,
createOpenSeadragonRect
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, maybe we work to consolidate at some point? Perhaps if this reaches a count of three.

};

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

module.exports = {
default: Viewer,
Expand All @@ -13,4 +17,6 @@ module.exports = {
Scroll,
Slider,
Viewer,
parseAnnotationTarget,
createOpenSeadragonRect
};
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
Loading