@harvard-lts/mirador-template-plugin 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,114 @@
1
+ import { Component } from 'react';
2
+ import { getManifestoInstance } from 'mirador/dist/es/src/state/selectors/manifests';
3
+ import { jsx, Fragment } from 'react/jsx-runtime';
4
+
5
+ function _assertThisInitialized(e) {
6
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
7
+ return e;
8
+ }
9
+ function _callSuper(t, o, e) {
10
+ return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
11
+ }
12
+ function _classCallCheck(a, n) {
13
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
14
+ }
15
+ function _defineProperties(e, r) {
16
+ for (var t = 0; t < r.length; t++) {
17
+ var o = r[t];
18
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
19
+ }
20
+ }
21
+ function _createClass(e, r, t) {
22
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
23
+ writable: !1
24
+ }), e;
25
+ }
26
+ function _getPrototypeOf(t) {
27
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
28
+ return t.__proto__ || Object.getPrototypeOf(t);
29
+ }, _getPrototypeOf(t);
30
+ }
31
+ function _inherits(t, e) {
32
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
33
+ t.prototype = Object.create(e && e.prototype, {
34
+ constructor: {
35
+ value: t,
36
+ writable: !0,
37
+ configurable: !0
38
+ }
39
+ }), Object.defineProperty(t, "prototype", {
40
+ writable: !1
41
+ }), e && _setPrototypeOf(t, e);
42
+ }
43
+ function _isNativeReflectConstruct() {
44
+ try {
45
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
46
+ } catch (t) {}
47
+ return (_isNativeReflectConstruct = function () {
48
+ return !!t;
49
+ })();
50
+ }
51
+ function _possibleConstructorReturn(t, e) {
52
+ if (e && ("object" == typeof e || "function" == typeof e)) return e;
53
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
54
+ return _assertThisInitialized(t);
55
+ }
56
+ function _setPrototypeOf(t, e) {
57
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
58
+ return t.__proto__ = e, t;
59
+ }, _setPrototypeOf(t, e);
60
+ }
61
+ function _toPrimitive(t, r) {
62
+ if ("object" != typeof t || !t) return t;
63
+ var e = t[Symbol.toPrimitive];
64
+ if (void 0 !== e) {
65
+ var i = e.call(t, r || "default");
66
+ if ("object" != typeof i) return i;
67
+ throw new TypeError("@@toPrimitive must return a primitive value.");
68
+ }
69
+ return ("string" === r ? String : Number)(t);
70
+ }
71
+ function _toPropertyKey(t) {
72
+ var i = _toPrimitive(t, "string");
73
+ return "symbol" == typeof i ? i : i + "";
74
+ }
75
+
76
+ var mapStateToProps = function mapStateToProps(state, _ref) {
77
+ var windowId = _ref.windowId;
78
+ return {
79
+ manifestId: (getManifestoInstance(state, {
80
+ windowId: windowId
81
+ }) || {}).id,
82
+ manifest: getManifestoInstance(state, {
83
+ windowId: windowId
84
+ })
85
+ };
86
+ };
87
+ var miradorTemplate = /*#__PURE__*/function (_Component) {
88
+ function miradorTemplate() {
89
+ _classCallCheck(this, miradorTemplate);
90
+ return _callSuper(this, miradorTemplate, arguments);
91
+ }
92
+ _inherits(miradorTemplate, _Component);
93
+ return _createClass(miradorTemplate, [{
94
+ key: "render",
95
+ value: function render() {
96
+ return /*#__PURE__*/jsx(Fragment, {});
97
+ }
98
+ }, {
99
+ key: "componentDidMount",
100
+ value: function componentDidMount() {
101
+ // Add custom stuff here
102
+ }
103
+ }]);
104
+ }(Component);
105
+ var miradorTemplatePlugin = {
106
+ target: 'Window',
107
+ mode: 'add',
108
+ component: miradorTemplate,
109
+ mapStateToProps: mapStateToProps
110
+ };
111
+
112
+ var index = [miradorTemplatePlugin];
113
+
114
+ export { index as default, miradorTemplatePlugin };
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@harvard-lts/mirador-template-plugin",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Template for Harvard mps-viewer Mirador plugins",
5
- "main": "dist/index.js",
6
- "source": "src/index.js",
7
- "module": "es/index.js",
5
+ "module": "dist/es/index.js",
6
+ "files": [
7
+ "dist"
8
+ ],
8
9
  "scripts": {
9
10
  "clean": "rm -rf ./dist && rm -rf ./demo/dist",
10
11
  "prebuild": "npm run clean",
@@ -1,31 +0,0 @@
1
- **The title of this pull-request should be a brief description of what the pull-request fixes/improves/changes. Ideally 50 characters or less.**
2
-
3
- ---
4
-
5
- **JIRA Ticket**: (link)
6
-
7
- - Other Relevant Links (Mailing list discussion, related pull requests, etc.)
8
-
9
- # What does this Pull Request do?
10
-
11
- A brief description of what the intended result of the PR will be and/or what problem it solves.
12
-
13
- # How should this be tested?
14
-
15
- A description of what steps someone could take to:
16
-
17
- - Reproduce the problem you are fixing (if applicable)
18
- - Test that the Pull Request does what is intended.
19
- - Please be as detailed as possible.
20
- - Good testing instructions help get your PR completed faster.
21
-
22
- # Test coverage
23
-
24
- Yes/No: Are changes in this pull-request covered by:
25
-
26
- - unit tests?
27
- - integration tests?
28
-
29
- # Interested parties
30
-
31
- Tag (@ mention) interested parties
@@ -1,34 +0,0 @@
1
- name: Publish to npmjs on release
2
- on:
3
- release:
4
- types: [published]
5
-
6
- jobs:
7
- publish:
8
- runs-on: ubuntu-latest
9
-
10
- steps:
11
- - name: Checkout repository
12
- uses: actions/checkout@v4
13
- with:
14
- fetch-depth: 0
15
-
16
- - name: Compare the tag and version
17
- run: |
18
- NODE_VERSION=$(node -p -e "require('./package.json').version")
19
- LATEST_TAG=$(git describe --tags --abbrev=0)
20
- if [ "v$NODE_VERSION" != $LATEST_TAG ]; then echo "Github tag ($LATEST_TAG) and version ($NODE_VERSION) don't match" && exit 1; fi
21
-
22
- - name: Set up Node.js
23
- uses: actions/setup-node@v4
24
- with:
25
- node-version: 18
26
- registry-url: "https://registry.npmjs.org"
27
-
28
- - name: Install dependencies
29
- run: npm ci
30
-
31
- - name: Publish to npm
32
- run: npm publish --access=public
33
- env:
34
- NODE_AUTH_TOKEN: ${{ secrets.LTS_NPM_TOKEN }}
package/.nvmrc DELETED
@@ -1 +0,0 @@
1
- lts/hydrogen
package/.parcelrc DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "@parcel/config-default",
3
- "transformers": {
4
- "*.{js,mjs,jsx,cjs,ts,tsx}": [
5
- "@parcel/transformer-js",
6
- "@parcel/transformer-react-refresh-wrap"
7
- ]
8
- }
9
- }
package/.travis.yml DELETED
@@ -1,16 +0,0 @@
1
- sudo: false
2
-
3
- language: node_js
4
- node_js:
5
- - 18
6
-
7
- before_install:
8
- - npm install codecov.io coveralls
9
-
10
- after_success:
11
- - cat ./coverage/lcov.info | ./node_modules/codecov.io/bin/codecov.io.js
12
- - cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
13
-
14
- branches:
15
- only:
16
-
package/CONTRIBUTING.md DELETED
@@ -1,20 +0,0 @@
1
- ## Prerequisites
2
-
3
- Check the `.nvmrc` file for the requisite node version
4
-
5
- ## Installation
6
-
7
- - Running `npm install` in the component's root directory will install everything you need for development.
8
-
9
- ## Running Tests
10
-
11
- - `npm test` will run the tests once.
12
-
13
- - `npm run test:coverage` will run the tests and produce a coverage report in `coverage/`.
14
-
15
- - `npm run test:watch` will run the tests on every change.
16
-
17
- ## Building
18
-
19
- - `npm run build` will build the component for publishing to npm and also bundle the demo app.
20
-
package/babel.config.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "presets": [
3
- [
4
- "@babel/preset-env",
5
- {
6
- "modules": "auto"
7
- }
8
- ],
9
- ["@babel/preset-react", { "runtime": "automatic" }]
10
- ]
11
- }
package/demo/demoEntry.js DELETED
@@ -1,17 +0,0 @@
1
- import Mirador from "mirador/dist/es/src/index";
2
- import Plugin from "../src/index";
3
-
4
- document.addEventListener("DOMContentLoaded", () => {
5
- const config = {
6
- id: "mirador",
7
- windows: [
8
- {
9
- manifestId: "https://nrs.lib.harvard.edu/URN-3:HUAM:925863:MANIFEST:3"
10
- }
11
- ]
12
- };
13
-
14
- const plugins = [...Plugin];
15
-
16
- Mirador.viewer(config, plugins);
17
- });
package/demo/index.html DELETED
@@ -1,23 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Test</title>
7
- <style>
8
- body {
9
- margin: 0;
10
- padding: 0;
11
- }
12
- #mirador {
13
- height: 100vh;
14
- width: 100vw;
15
- }
16
- </style>
17
- <script src="demo.js"></script>
18
- </head>
19
- <body>
20
- <div id="mirador"></div>
21
- </script>
22
- </body>
23
- </html>
package/jest.config.js DELETED
@@ -1,20 +0,0 @@
1
- /** @type {import('jest').Config} */
2
- module.exports = {
3
- testEnvironment: "jsdom",
4
- transformIgnorePatterns: ["node_modules/(?!mirador)/", "node_modules/pdiiif"],
5
- setupFilesAfterEnv: ["@testing-library/jest-dom", "./setupTests"],
6
- // collectCoverage: true,
7
- // coverageDirectory: "coverage",
8
- // verbose: true,
9
- // testRegex: "(/tests/.*|\\.(test|spec))\\.jsx?$",
10
- // moduleFileExtensions: ["js", "json", "jsx", "node"],
11
- // coverageThreshold: {
12
- // global: {
13
- // branches: 30,
14
- // functions: 90,
15
- // lines: 90,
16
- // statements: 90,
17
- // },
18
- // },
19
- // // setupFiles: ["./setupTests"],
20
- };
package/nwb.config.js DELETED
@@ -1,20 +0,0 @@
1
- const path = require('path');
2
-
3
- module.exports = {
4
- type: 'react-component',
5
- npm: {
6
- esModules: true,
7
- umd: {
8
- global: 'miradorTemplate',
9
- externals: {
10
- react: 'React'
11
- }
12
- }
13
- },
14
- webpack: {
15
- aliases: {
16
- react: path.resolve('./', 'node_modules', 'react'),
17
- 'react-dom': path.resolve('./', 'node_modules', 'react-dom'),
18
- },
19
- },
20
- }
package/rollup.config.mjs DELETED
@@ -1,12 +0,0 @@
1
- import { babel } from "@rollup/plugin-babel";
2
-
3
- const config = {
4
- input: "src/index.js",
5
- output: {
6
- dir: "dist/es",
7
- format: "es",
8
- },
9
- plugins: [babel({ babelHelpers: "bundled" })],
10
- };
11
-
12
- export default config;
package/setupTests.js DELETED
@@ -1 +0,0 @@
1
- import "whatwg-fetch";
package/src/index.js DELETED
@@ -1,9 +0,0 @@
1
- import miradorTemplatePlugin from './plugins/MiradorTemplatePlugin';
2
-
3
- export {
4
- miradorTemplatePlugin,
5
- };
6
-
7
- export default [
8
- miradorTemplatePlugin,
9
- ];
@@ -1,27 +0,0 @@
1
- import React, { Component } from 'react';
2
- import { getManifestoInstance } from 'mirador/dist/es/src/state/selectors/manifests';
3
-
4
- const mapStateToProps = (state, { windowId }) => ({
5
- manifestId: (getManifestoInstance(state, { windowId }) || {}).id,
6
- manifest: getManifestoInstance(state, { windowId }),
7
- });
8
-
9
- class miradorTemplate extends Component {
10
- render() {
11
-
12
- return (
13
- <></>
14
- );
15
- }
16
-
17
- componentDidMount() {
18
- // Add custom stuff here
19
- }
20
- }
21
-
22
- export default {
23
- target: 'Window',
24
- mode: 'add',
25
- component: miradorTemplate,
26
- mapStateToProps,
27
- }
@@ -1,52 +0,0 @@
1
- const path = require("path");
2
- const webpack = require("webpack");
3
-
4
- module.exports = (env, options) => {
5
- return {
6
- mode: options.mode,
7
- entry: "./demo/demoEntry.js",
8
- output: {
9
- path: path.resolve(__dirname, "demo", "dist"),
10
- filename: "demo.js",
11
- publicPath: "/",
12
- },
13
- resolve: {
14
- extensions: [".js", ".jsx"],
15
- },
16
- plugins: [
17
- new webpack.IgnorePlugin({
18
- resourceRegExp: /@blueprintjs\/(core|icons)/, // ignore optional UI framework dependencies
19
- }),
20
- ],
21
- module: {
22
- rules: [
23
- {
24
- test: /\.(js|jsx)$/,
25
- exclude: /node_modules/,
26
- use: {
27
- loader: "babel-loader",
28
- },
29
- resolve: {
30
- fullySpecified: false,
31
- },
32
- },
33
- ],
34
- },
35
- devServer: {
36
- static: [
37
- {
38
- directory: path.join(__dirname, "demo"),
39
- },
40
- {
41
- directory: path.join(__dirname, "demo", "dist"),
42
- },
43
- ],
44
- compress: true,
45
- port: 9000,
46
- historyApiFallback: true,
47
- client: {
48
- overlay: false,
49
- },
50
- },
51
- };
52
- };