ogm-viewer
v0.2.0
Published
A web-based viewer for previewing OpenGeoMetadata records
Downloads
14
Readme
OpenGeoMetadata Viewer
A web-based viewer for previewing OpenGeoMetadata records.
Installation
You can add the viewer to your project by including the following script tag in your HTML:
<script type="module" src="https://unpkg.com/ogm-viewer"></script>If using a bundler, you can install it via npm:
npm install ogm-viewerThen add it to your entrypoint file:
import 'ogm-viewer';Usage
Once installed, the viewer can be used in your HTML as a web component:
<ogm-viewer record-url="https://example.com/record.json"></ogm-viewer>The record-url attribute should point to a valid OpenGeoMetadata Aardvark record in JSON format.
You can also programmatically set the record URL using JavaScript:
const viewer = document.querySelector('ogm-viewer');
viewer.recordUrl = 'https://example.com/record.json';When the record URL changes, the viewer will automatically fetch and display the record data.
Dark mode support
The viewer supports dark mode. If your system preference is set to prefer dark mode, the viewer will automatically apply dark styles.
To programmatically control dark mode, you can use the theme attribute with a value of dark or light:
<ogm-viewer record-url="https://example.com/record.json" theme="dark"></ogm-viewer>Development
After cloning the repository, install dependencies:
npm installYou can start a local development web server with:
npm startFormatting
Code is formatted using Prettier. To format your code for a pull request, run:
npx prettier --write .Tests
To run tests, use:
npm testComponent unit tests use Stencil's testing framework.
Releasing
To publish a new version, update the version in package.json and commit your changes. Then create a release tag:
git tag vX.Y.Z # replace with your new version number
git push --tagsAfter tagging, build the project and publish it to npm:
npm run build
npm publishYou can create a new release on GitHub by going to the "Releases" section and clicking "Draft a new release". The "Generate release notes" option will automatically include the changes since the last tag.
