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

update plugin for mirador 4 #99

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
49 changes: 25 additions & 24 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"plugin:react/recommended",
"airbnb",
"plugin:prettier/recommended"
],
"overrides": [{
"files": ["*.js", "*.jsx"]
}],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
"extends": ["airbnb", "prettier"],
"globals": {
"page": true,
"document": true
},
"plugins": [
"react",
"simple-import-sort"
],
"parser": "@babel/eslint-parser",
"plugins": ["babel", "react", "react-hooks", "prettier"],
"rules": {
"default-param-last": "warn",
"import/prefer-default-export": "off",
"react/function-component-definition": "off",
"import/no-extraneous-dependencies": "off",
"no-console": "off",
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error"
"require-jsdoc": ["error", {
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": true,
"ArrowFunctionExpression": true,
"FunctionExpression": true
}
}],
"no-restricted-syntax": ["off", "ForOfStatement"],
"react/no-unstable-nested-components": 1,
"react/no-unused-class-component-methods": 1,
"react/jsx-fragments": "off",
"react/jsx-props-no-spreading": "off",
"react/prefer-stateless-function": "off",
"react/function-component-definition": "off",
"no-continue": "off"
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
/node_modules
/umd
npm-debug.log*
.cache
dist
23 changes: 23 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/__fixtures__
.cache
.docassets
.github
/demo/dist
/dist
/es
/lib
/umd
/node_modules
.eslintrc
.npmrc
babel.config.js
CONTRIBUTING.md
jest.config.js
jest.setup.js
LICENSE.md
netlify.toml
npm-debug.log*
package-lock.json
package.json
README.md
webpack.config.js
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"singleQuote": true
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![npm package][npm-badge]][npm]
[![required Mirador version][mirador-badge]][mirador]

A Mirador 3 plugin which replaces the builtin canvas navigation with an extended one containing the following functionalities:
A Mirador 4 plugin which replaces the builtin canvas navigation with an extended one containing the following functionalities:

- scroll to the first canvas
- scroll to the previous canvas
Expand Down Expand Up @@ -54,6 +54,7 @@ const miradorConfig = {
// config for an individual window, see available settings below
},
}, // ...
]
}
```

Expand Down
94 changes: 94 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
const moduleFormatMap = {
cjs: "commonjs",
es: false,
}

module.exports = (api) => ({
presets: [
api.env("test") && [
"@babel/preset-env",
{
modules: "commonjs",
targets: {
node: "current",
},
},
],
(api.env("production") || api.env("development")) && [
"@babel/preset-env",
{
corejs: 3,
exclude: ["transform-typeof-symbol"],
forceAllTransforms: true,
modules: moduleFormatMap[process.env.MODULE_FORMAT] || false,
useBuiltIns: "entry",
},
],
[
"@babel/preset-react",
{
development: api.env("development") || api.env("test"),
runtime: "automatic",
useBuiltIns: true,
},
],
].filter(Boolean),
plugins: [
"babel-plugin-macros",
"@babel/plugin-transform-destructuring",
[
"@babel/plugin-proposal-class-properties",
{
loose: true,
},
],
["@babel/plugin-proposal-private-property-in-object", { loose: true }],
["@babel/plugin-proposal-private-methods", { loose: true }],
[
"@babel/plugin-proposal-object-rest-spread",
{
useBuiltIns: true,
},
],
[
"@babel/plugin-transform-runtime",
{
corejs: false,
helpers: false, // Needed to support IE/Edge
regenerator: true,
},
],
[
"@babel/plugin-transform-regenerator",
{
async: false,
},
],
[
"transform-react-remove-prop-types",
{
ignoreFilenames: ["node_modules"],
removeImport: true,
},
],
[
"@emotion",
{
importMap: {
"@mui/system": {
styled: {
canonicalImport: ["@emotion/styled", "default"],
styledBaseImport: ["@mui/system", "styled"],
},
},
"@mui/material/styles": {
styled: {
canonicalImport: ["@emotion/styled", "default"],
styledBaseImport: ["@mui/material/styles", "styled"],
},
},
},
},
],
].filter(Boolean),
})
11 changes: 11 additions & 0 deletions demo/src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Mirador with canvasnavigation plugin</title>
</head>
<body>
<div id="demo"></div>
<script src="./index.js"></script>
</body>
</html>
25 changes: 11 additions & 14 deletions demo/src/index.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
import Mirador from "mirador/dist/es/src/index";
import Mirador from 'mirador/dist/es/src/index';

import canvasNavigationPlugin from "../../src";
import canvasNavigationPlugin from '../../src';

const config = {
catalog: [
{
manifestId:
"https://api.digitale-sammlungen.de/iiif/presentation/v2/bsb00135902/manifest",
provider: "Bavarian State Library",
manifestId: 'https://api.digitale-sammlungen.de/iiif/presentation/v2/bsb00135902/manifest',
provider: 'Bavarian State Library',
},
{
manifestId:
"https://api.digitale-sammlungen.de/iiif/presentation/v2/bsb10532463_00005_u001/manifest",
provider: "Bavarian State Library",
'https://api.digitale-sammlungen.de/iiif/presentation/v2/bsb10532463_00005_u001/manifest',
provider: 'Bavarian State Library',
},
{
manifestId:
"https://api.digitale-sammlungen.de/iiif/presentation/v2/bsb00034024/manifest",
provider: "Bavarian State Library",
manifestId: 'https://api.digitale-sammlungen.de/iiif/presentation/v2/bsb00034024/manifest',
provider: 'Bavarian State Library',
},
],
id: "demo",
id: 'demo',
window: {
allowFullscreen: true,
canvasNavigation: {
Expand All @@ -30,9 +28,8 @@ const config = {
windows: [
{
canvasIndex: 8,
manifestId:
"https://api.digitale-sammlungen.de/iiif/presentation/v2/bsb00034024/manifest",
view: "single",
manifestId: 'https://api.digitale-sammlungen.de/iiif/presentation/v2/bsb00034024/manifest',
view: 'single',
},
],
};
Expand Down
Binary file added mirador-canvasnavigation-1.0.0-alpha.1.tgz
Binary file not shown.
24 changes: 0 additions & 24 deletions nwb.config.js

This file was deleted.

Loading