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

prepare for m4 release #101

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
50 changes: 26 additions & 24 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
{
"env": {
"browser": true,
"es2021": true
"browser": 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"
}
}
20 changes: 20 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/__fixtures__
.github
/demo/dist
/dist
/es
/lib
/umd
/node_modules
.eslintrc
.npmrc
babel.config.js
CONTRIBUTING.md
jest.config.js
jest.setup.js
LICENSE.md
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
}
4 changes: 2 additions & 2 deletions 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 adds keyboard shortcuts for the following events:
A Mirador 4 plugin which adds keyboard shortcuts for the following events:

- scroll to the first canvas (default shortcut: `ctrl+left`)
- scroll to the previous canvas (default shortcut: `left`)
Expand Down Expand Up @@ -79,7 +79,7 @@ starting the work, so we can discuss if it's a fit.
[demo-cfg]: https://github.com/dbmdz/mirador-keyboardshortcuts/blob/main/demo/src/index.js#L5-L40
[event-types]: https://github.com/dbmdz/mirador-keyboardshortcuts/blob/main/src/state/events.js#L5-L12
[hotkeys-js]: https://wangchujiang.com/hotkeys-js/#defining-shortcuts
[mirador]: https://github.com/ProjectMirador/mirador/releases/tag/v3.3.0
[mirador]: https://github.com/ProjectMirador/mirador/releases/tag/v4.0.0.alpha-1
[mirador-badge]: https://img.shields.io/badge/Mirador-%E2%89%A53.3.0-blueviolet
[npm]: https://www.npmjs.org/package/mirador-keyboardshortcuts
[npm-badge]: https://img.shields.io/npm/v/mirador-keyboardshortcuts.png?style=flat-square
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 keyboardshortcuts plugin</title>
</head>
<body>
<div id="demo"></div>
<script src="./index.js"></script>
</body>
</html>
28 changes: 12 additions & 16 deletions demo/src/index.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,36 @@
import Mirador from "mirador/dist/es/src/index";

import keyboardShortcutsPlugin from "../../src";
import Mirador from 'mirador/dist/es/src/index';
import keyboardShortcutsPlugin 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,
},
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',
},
],
keyboardShortcuts: {
shortcutMapping: {
"toggle-fullscreen": "f",
'toggle-fullscreen': 'f',
},
},
};
Expand Down
24 changes: 0 additions & 24 deletions nwb.config.js

This file was deleted.

Loading