Skip to content

Commit

Permalink
4.9.0-alpha.3 release
Browse files Browse the repository at this point in the history
  • Loading branch information
enact-bot committed Jun 5, 2024
2 parents a3284e4 + 5db673f commit 2e5d271
Show file tree
Hide file tree
Showing 32 changed files with 2,759 additions and 1,509 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

The following is a curated list of changes in the Enact project, newest changes on the top.

## [4.9.0-alpha.3] - 2024-06-05

### Changed

- `spotlight/Spottable` to have sibling DOM node as alternative to findDOMNode API which will be removed in React 19
- `ui/Placeholder.PlaceholderControllerDecorator` and `ui/ViewManager` to have sibling DOM node as alternative to findDOMNode API which will be removed in React 19
- `webos/speech.VoiceControlDecorator` to have sibling DOM node as alternative to findDOMNode API which will be removed in React 19

## [4.0.15] - 2024-05-28

### Fixed

- `i18n` resource loader to override strings where the original strings file does not exist

## [4.9.0-alpha.2] - 2024-05-24

No significant changes.
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "4.9.0-alpha.2",
"version": "4.9.0-alpha.3",
"packages": [
"packages/*"
],
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "enact",
"version": "4.9.0-alpha.2",
"version": "4.9.0-alpha.3",
"description": "Monorepo for all Enact front end libraries.",
"private": true,
"scripts": {
Expand Down
8 changes: 8 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

The following is a curated list of changes in the Enact core module, newest changes on the top.

## [4.9.0-alpha.3] - 2024-06-05

No significant changes.

## [4.0.15] - 2024-05-28

No significant changes.

## [4.9.0-alpha.2] - 2024-05-24

No significant changes.
Expand Down
40 changes: 40 additions & 0 deletions packages/core/internal/WithRef/WithRef.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import {forwardRef, useId, useImperativeHandle, useRef} from 'react';

const WithRef = (WrappedComponent) => {
const HoC = forwardRef(function (props, ref) {
const {['data-withref-id']: givenId, outermostRef, referrerName, ...rest} = props;
const divRef = useRef();
const generatedId = useId();
const id = givenId || generatedId;

useImperativeHandle(outermostRef, () => {
const refNode = divRef.current;
const attributeSelector = `[data-withref-id="${refNode.getAttribute('data-withref-target')}"]`;
/* The intended code is to search for the referrer element via a single querySelector call. But unit tests cannot handle :has() properly.
const selector = `:scope ${attributeSelector}, :scope :has(${attributeSelector})`;
return refNode?.parentElement?.querySelector(selector) || null;
*/
const targetNode = refNode?.parentElement?.querySelector(attributeSelector) || null;
for (let current = targetNode; current; current = current.parentElement) {
if (current?.parentElement === refNode?.parentElement) {
return current;
}
}
return null;
}, []);

return (
<>
<WrappedComponent {...rest} data-withref-id={id} ref={ref} />
<div data-withref-target={id} data-withref-referrer={referrerName} ref={divRef} style={{display: 'none'}} />
</>
);
});

HoC.displayName = 'WithRef';

return HoC;
};

export default WithRef;
export {WithRef};
3 changes: 3 additions & 0 deletions packages/core/internal/WithRef/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"main": "WithRef.js"
}
39 changes: 39 additions & 0 deletions packages/core/internal/WithRef/tests/WithRef-specs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import {createRef, Component as ReactComponent} from 'react';
import {render, screen} from '@testing-library/react';

import {WithRef} from '../WithRef';

describe('WithRef', () => {
const DummyComponent = class extends ReactComponent {
static displayName = 'DummyComponent';

render () {
return (<div {...this.props}>Dummy</div>);
}
};

test('should return a DOM node of the wrapped component via outermostRef', () => {
const ComponentWithRef = WithRef(DummyComponent);
const id = 'test-wrapped';
const divRef = createRef();
render(
<ComponentWithRef outermostRef={divRef} data-testid={id} />
);
const expectedNode = screen.getByTestId(id);

expect(divRef.current).toBe(expectedNode);
});

test('should pass ref', () => {
const ComponentWithRef = WithRef('div');
const id = 'test-wrapped';
const divRef = createRef();

render(
<ComponentWithRef ref={divRef} data-testid={id} />
);
const expectedNode = screen.getByTestId(id);

expect(divRef.current).toBe(expectedNode);
});
});
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@enact/core",
"version": "4.9.0-alpha.2",
"version": "4.9.0-alpha.3",
"description": "Enact is an open source JavaScript framework containing everything you need to create a fast, scalable mobile or web application.",
"repository": {
"type": "git",
Expand Down
10 changes: 10 additions & 0 deletions packages/i18n/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

The following is a curated list of changes in the Enact i18n module, newest changes on the top.

## [4.9.0-alpha.3] - 2024-06-05

No significant changes.

## [4.0.15] - 2024-05-28

### Fixed

- `i18n` resource loader to override strings where the original strings file does not exist

## [4.9.0-alpha.2] - 2024-05-24

No significant changes.
Expand Down
4 changes: 2 additions & 2 deletions packages/i18n/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@enact/i18n",
"main": "./src/index.js",
"version": "4.9.0-alpha.2",
"version": "4.9.0-alpha.3",
"description": "Internationalization support for Enact using iLib",
"repository": {
"type": "git",
Expand Down Expand Up @@ -48,7 +48,7 @@
]
},
"dependencies": {
"@enact/core": "^4.9.0-alpha.2",
"@enact/core": "^4.9.0-alpha.3",
"prop-types": "^15.8.1",
"ramda": "^0.29.1",
"react": "^18.3.1",
Expand Down
8 changes: 8 additions & 0 deletions packages/sampler/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

The following is a curated list of changes in the Enact Sampler, newest changes on the top.

## [4.9.0-alpha.3] - 2024-06-05

No significant changes.

## [4.0.15] - 2024-05-28

No significant changes.

## [4.9.0-alpha.2] - 2024-05-24

No significant changes.
Expand Down
Loading

0 comments on commit 2e5d271

Please sign in to comment.