bodleian / archiox-mirador-plugin

An experimental plugin to display depth information captured with Lucida or Selene scanners from FactumARTE. However, the plug-in can present any normal map/albedo map combination produced from any technique.
MIT License
1 stars 0 forks source link

Refactoring into an actual Mirador plugin #2

Closed BeebBenjamin closed 1 year ago

BeebBenjamin commented 2 years ago

Structure of the plugin needs changing so that it can be actually used as a plugin i.e. downloaded from a repo and installed into a Mirador 3 instance. At the moment everything including Mirador 3 is bundled into one repository.

BeebBenjamin commented 2 years ago

Critical because we need to demo this in December using our own Mirador.

BeebBenjamin commented 1 year ago

This is ready for testing on a dev branch.

mel-mason commented 1 year ago

Just checking this on my mirador plugin build. I think https://github.com/bodleian/archiox-mirador-plugin/blob/refactor-into-plugin/src/index.js#L1 should be export archioxMiradorPlugin from './plugins/archiox-mirador-plugin'; (e.g. https://github.com/ProjectMirador/mirador-image-tools/blob/master/src/index.js)

BeebBenjamin commented 1 year ago

I have changed this, but didn't realise it enforced style like that.

mel-mason commented 1 year ago

Yeah, you can't have hypens in js variable names - the parser thinks it's the subtraction operator

mel-mason commented 1 year ago

I think there may be an issue with my webpack configuration. I've got past a few errors building the code: had to add "module": "src/index.js", to your package.json so webpack could find it, and then started getting loader errors:

You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

Firstly on the index.js, which I got past after changing it to:

import _archioxMiradorPlugin from './plugins/archioxMiradorPlugin';
export { _archioxMiradorPlugin as archioxMiradorPlugin };

But now it's giving the same error for this line: https://github.com/bodleian/archiox-mirador-plugin/blob/master/src/plugins/archiox-mirador-plugin/light-normals.js#L10

Any suggestions of changes I should make to my webpack config?

BeebBenjamin commented 1 year ago

OK it should work with archiox now from branch: https://gitlab.bodleian.ox.ac.uk/digital.bodleian/2.0/mirador_plugins_build/-/tree/archiox-working-as-plugin

All you need to do is change the config in the index.html file to the following:

const config = {
          id: 'viewer',
          windows: [{
            // enable and show the image tools plugin controls
            imageToolsEnabled: true,
            imageToolsOpen: true,
            // open a specific manifest (optional)
            manifestId: 'https://gist.githubusercontent.com/BeebBenjamin/ceb7c61c952d47b8dad5849f0d5f7f98/raw/c22e9eeef0fd7b9dc3d10d3c356eaab97f6e9f36/rawl_copperplates_g21.json',
            // open a specific canvas (optional)
            //canvasId: 'https://iiif.bodleian.ox.ac.uk/iiif/canvas/1dc21f24-43be-4b2e-b03b-feb278af1795.json'
          }],
          // requests: {
          //   // Manipulate IIIF HTTP requests (info.json, IIIF presentation manifests, annotations, etc) to add an Accept header so we use our v3 manifests
          //   preprocessors: [
          //     (url, options) => ({...options,
          //       headers: {
          //         ...options.headers,
          //         Accept: 'application/ld+json;profile="http://iiif.io/api/presentation/3/context.json"'
          //       }
          //     })
          //   ],
          // },
          theme: {
            palette: {
              primary: {
                main: '#1967d2',
              },
            },
          },
        };
mel-mason commented 1 year ago

I can't get the plugin to build/run correctly - have added an issue in the plugin build repo with more details.

mel-mason commented 1 year ago

I'm also not sure that https://github.com/bodleian/archiox-mirador-plugin/blob/master/src/index.js makes sense for a plugin

BeebBenjamin commented 1 year ago

That is the master branch, we haven't merged the changes in yet.

mel-mason commented 1 year ago

Oops, wrong branch, sorry. I was testing on the qa branch for the build/run, though