Skip to content

Commit

Permalink
Merge branch 'main' into manifest-getValue-locale2
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer authored Jan 8, 2025
2 parents c92dd06 + e5470d6 commit c605e0f
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 38 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Node.js CI

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]

jobs:
build:
Expand All @@ -23,7 +23,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
- run: npm test -- --coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
env:
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ Contributions to Mirador are always welcome!

It is always helpful to begin any large change by submitting an issue or engaging with the Mirador community. Mirador 3.0 and beyond adheres to [semantic versioning](https://semver.org/) so that adopters and contributors can better understand what changes can be expected in released versions of the software.

All contributions should be submitted as a [GitHub pull request](https://help.github.com/articles/about-pull-requests/) to the master branch. Pull requests must be reviewed and accepted by another Mirador maintainer and pass all continuous integration checks. Contributions should have tests for the feature or bug fix, documentation, should maintain high code coverage, and should conform to the Mirador agreed-upon coding style. Contributions should not include a “built” version of Mirador—this will help to reduce merge conflicts.
All contributions should be submitted as a [GitHub pull request](https://help.github.com/articles/about-pull-requests/) to the main branch. Pull requests must be reviewed and accepted by another Mirador maintainer and pass all continuous integration checks. Contributions should have tests for the feature or bug fix, documentation, should maintain high code coverage, and should conform to the Mirador agreed-upon coding style. Contributions should not include a “built” version of Mirador—this will help to reduce merge conflicts.

### Code of Conduct
Everyone interacting in this community is expected to follow the [Mirador Code of Conduct](https://github.com/ProjectMirador/mirador/blob/master/CODE_OF_CONDUCT.md).
Everyone interacting in this community is expected to follow the [Mirador Code of Conduct](https://github.com/ProjectMirador/mirador/blob/main/CODE_OF_CONDUCT.md).

### Accessibility
Mirador 3 aims to comply with the [Web Content Accessibility Guidelines (WCAG) 2.1 AA](https://www.w3.org/WAI/standards-guidelines/wcag/). These guidelines, authored by the W3C and legally adopted [internationally](https://www.w3.org/WAI/policies/?q=wcag-20), are comprehensive and provide the success criteria designers and developers need to build accessible web applications.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Mirador
![Node.js CI](https://github.com/ProjectMirador/mirador/workflows/Node.js%20CI/badge.svg) [![codecov](https://codecov.io/gh/ProjectMirador/mirador/branch/master/graph/badge.svg)](https://codecov.io/gh/ProjectMirador/mirador)
![Node.js CI](https://github.com/ProjectMirador/mirador/workflows/Node.js%20CI/badge.svg) [![codecov](https://codecov.io/gh/ProjectMirador/mirador/branch/main/graph/badge.svg)](https://codecov.io/gh/ProjectMirador/mirador)

## For Mirador Users
You can quickly use and configure Mirador by remixing the [mirador-start](https://mirador-start.glitch.me/) Glitch.
Expand All @@ -14,7 +14,7 @@ $ npm install mirador
$ yarn add mirador
```

If you are interested in integrating Mirador with plugins into your project, we recommend using webpack or parcel to integrate the es version of the packages. Examples are here:
If you are interested in integrating Mirador with plugins into your project, we recommend using vite to integrate the es version of the packages. Examples are here:

[https://github.com/ProjectMirador/mirador-integration](https://github.com/ProjectMirador/mirador-integration)

Expand All @@ -24,7 +24,7 @@ If you want to simply embed Mirador in an HTML page without further customizatio
<script src="https://unpkg.com/mirador@latest/dist/mirador.min.js"></script>
```

More examples of embedding Mirador can be found at [https://github.com/ProjectMirador/mirador/wiki/M3-Embedding-in-Another-Environment#in-an-html-document-with-javascript](https://github.com/ProjectMirador/mirador/wiki/M3-Embedding-in-Another-Environment#in-an-html-document-with-javascript).
More examples of embedding Mirador can be found at [https://github.com/ProjectMirador/mirador/wiki/M3-Embedding-in-Another-Environment#in-an-html-document-with-javascript](https://github.com/ProjectMirador/mirador/wiki/Embedding-in-Another-Environment).

## Adding translations to Mirador
For help with adding a translation, see [src/locales/README.md](src/locales/README.md)
Expand Down
2 changes: 1 addition & 1 deletion __tests__/src/components/AccessTokenSender.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('AccessTokenSender', () => {
it('renders properly', () => {
const { container } = createWrapper({ url: 'http://example.com' });

expect(container.querySelector('iframe')).toHaveAttribute('src', 'http://example.com?origin=http://localhost&messageId=http://example.com'); // eslint-disable-line testing-library/no-node-access, testing-library/no-container
expect(container.querySelector('iframe')).toHaveAttribute('src', 'http://example.com/?origin=http%3A%2F%2Flocalhost&messageId=http%3A%2F%2Fexample.com'); // eslint-disable-line testing-library/no-node-access, testing-library/no-container
});

it('triggers an action when the iframe sends a message', () => {
Expand Down
6 changes: 5 additions & 1 deletion src/components/AccessTokenSender.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ export function AccessTokenSender({ handleAccessTokenMessage, url = undefined })

if (!url) return null;

const src = new URL(url);
src.searchParams.append('origin', window.origin);
src.searchParams.append('messageId', url);

/**
login, clickthrough/kiosk open @id, wait for close
external, no-op
*/
return (
<IIIFIFrameCommunication
src={`${url}?origin=${window.origin}&messageId=${url}`}
src={src.toString()}
title="AccessTokenSender"
handleReceiveMessage={onReceiveAccessTokenMessage}
/>
Expand Down
14 changes: 6 additions & 8 deletions src/components/CompanionWindow.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Children, cloneElement } from 'react';
import { Children, cloneElement, forwardRef } from 'react';
import { useSelector } from 'react-redux';
import PropTypes from 'prop-types';
import { styled } from '@mui/material/styles';
Expand Down Expand Up @@ -29,11 +29,11 @@ const StyledCloseButton = styled(MiradorMenuButton, { name: 'CompanionWindow', s
/**
* CompanionWindow
*/
export function CompanionWindow(props) { // eslint-disable-line react/require-default-props
export const CompanionWindow = forwardRef((props, innerRef) => {
const {
ariaLabel = undefined, classes = {}, direction, id, paperClassName = '', onCloseClick = () => {}, updateCompanionWindow = undefined, isDisplayed = false,
position = null, title = null, children = undefined, titleControls = null,
defaultSidebarPanelWidth = 235, defaultSidebarPanelHeight = 201, innerRef = undefined,
defaultSidebarPanelWidth = 235, defaultSidebarPanelHeight = 201,
} = props;
const [sizeRef, size] = useElementSize();
const { t } = useTranslation();
Expand Down Expand Up @@ -189,7 +189,7 @@ export function CompanionWindow(props) { // eslint-disable-line react/require-de
</LocaleContext.Provider>
</Root>
);
}
});

CompanionWindow.propTypes = {
ariaLabel: PropTypes.string,

Check failure on line 195 in src/components/CompanionWindow.js

View workflow job for this annotation

GitHub Actions / build (18.x)

propType "ariaLabel" is not required, but has no corresponding defaultProps declaration

Check failure on line 195 in src/components/CompanionWindow.js

View workflow job for this annotation

GitHub Actions / build (20.x)

propType "ariaLabel" is not required, but has no corresponding defaultProps declaration

Check failure on line 195 in src/components/CompanionWindow.js

View workflow job for this annotation

GitHub Actions / build (22.x)

propType "ariaLabel" is not required, but has no corresponding defaultProps declaration
Expand All @@ -199,10 +199,6 @@ CompanionWindow.propTypes = {
defaultSidebarPanelWidth: PropTypes.number,

Check failure on line 199 in src/components/CompanionWindow.js

View workflow job for this annotation

GitHub Actions / build (18.x)

propType "defaultSidebarPanelWidth" is not required, but has no corresponding defaultProps declaration

Check failure on line 199 in src/components/CompanionWindow.js

View workflow job for this annotation

GitHub Actions / build (20.x)

propType "defaultSidebarPanelWidth" is not required, but has no corresponding defaultProps declaration

Check failure on line 199 in src/components/CompanionWindow.js

View workflow job for this annotation

GitHub Actions / build (22.x)

propType "defaultSidebarPanelWidth" is not required, but has no corresponding defaultProps declaration
direction: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
innerRef: PropTypes.oneOfType([
PropTypes.func,
PropTypes.shape({ current: PropTypes.instanceOf(Element) }),
]),
isDisplayed: PropTypes.bool,

Check failure on line 202 in src/components/CompanionWindow.js

View workflow job for this annotation

GitHub Actions / build (18.x)

propType "isDisplayed" is not required, but has no corresponding defaultProps declaration

Check failure on line 202 in src/components/CompanionWindow.js

View workflow job for this annotation

GitHub Actions / build (20.x)

propType "isDisplayed" is not required, but has no corresponding defaultProps declaration

Check failure on line 202 in src/components/CompanionWindow.js

View workflow job for this annotation

GitHub Actions / build (22.x)

propType "isDisplayed" is not required, but has no corresponding defaultProps declaration
onCloseClick: PropTypes.func,

Check failure on line 203 in src/components/CompanionWindow.js

View workflow job for this annotation

GitHub Actions / build (18.x)

propType "onCloseClick" is not required, but has no corresponding defaultProps declaration

Check failure on line 203 in src/components/CompanionWindow.js

View workflow job for this annotation

GitHub Actions / build (20.x)

propType "onCloseClick" is not required, but has no corresponding defaultProps declaration

Check failure on line 203 in src/components/CompanionWindow.js

View workflow job for this annotation

GitHub Actions / build (22.x)

propType "onCloseClick" is not required, but has no corresponding defaultProps declaration
paperClassName: PropTypes.string,

Check failure on line 204 in src/components/CompanionWindow.js

View workflow job for this annotation

GitHub Actions / build (18.x)

propType "paperClassName" is not required, but has no corresponding defaultProps declaration

Check failure on line 204 in src/components/CompanionWindow.js

View workflow job for this annotation

GitHub Actions / build (20.x)

propType "paperClassName" is not required, but has no corresponding defaultProps declaration

Check failure on line 204 in src/components/CompanionWindow.js

View workflow job for this annotation

GitHub Actions / build (22.x)

propType "paperClassName" is not required, but has no corresponding defaultProps declaration
Expand All @@ -215,3 +211,5 @@ CompanionWindow.propTypes = {
titleControls: PropTypes.node,
updateCompanionWindow: PropTypes.func,
};

CompanionWindow.displayName = 'CompanionWindow';
1 change: 0 additions & 1 deletion src/components/WindowCanvasNavigationControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ export const WindowCanvasNavigationControls = forwardRef(({

WindowCanvasNavigationControls.propTypes = {
showZoomControls: PropTypes.bool,
size: PropTypes.shape({ width: PropTypes.number }).isRequired,
visible: PropTypes.bool,
windowId: PropTypes.string.isRequired,
zoomToWorld: PropTypes.func.isRequired,
Expand Down
16 changes: 1 addition & 15 deletions src/state/selectors/manifests.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,6 @@ function getProperty(property) {
);
}

/**
* Returns the manifest provider.
* @param {object} state
* @param {object} props
* @param {string} props.companionWindowId
* @returns {string}
*/
export const getManifestProvider = createSelector(
[
getProperty('provider'),
],
(provider) => provider,
);

/**
* Return the IIIF v3 provider of a manifest or null.
* @param {object} state
Expand All @@ -129,7 +115,7 @@ export const getManifestProviderName = createSelector(
* @returns {string|null}
*/
export const getProviderLogo = createSelector(
[getManifestProvider],
[getProperty('provider')],
(provider) => {
const logo = provider && provider[0] && provider[0].logo && provider[0].logo[0];
if (!logo) return null;
Expand Down
4 changes: 0 additions & 4 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ export default defineConfig({
},
},
test: {
coverage: {
all: true,
enabled: true,
},
environment: 'happy-dom',
exclude: ['node_modules'],
globals: true,
Expand Down

0 comments on commit c605e0f

Please sign in to comment.