Skip to content

Commit f8bf6c7

Browse files
committed
Merge remote-tracking branch 'origin/develop' into feature/bump-react-flow-v12-CMEM-6506
2 parents 66109c1 + 577b795 commit f8bf6c7

23 files changed

Lines changed: 3012 additions & 4720 deletions

.github/workflows/create-release-branch.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ jobs:
2828
run: |
2929
branchname=$(git describe --all --exact-match | sed 's=heads/==')
3030
echo "Dispatched on $branchname"
31-
if [[ ! "$branchname" =~ ^(main|next|legacy)$ ]]; then echo "Branch $branchname is not allowed to dispatch this action on, use it only on develop, next and legacy." && false; fi
32-
echo "targetbranch=(echo $branchname | sed 's=^develop$=main=')" >> $GITHUB_OUTPUT
31+
if [[ ! "$branchname" =~ ^(develop|next|legacy)$ ]]; then echo "Branch $branchname is not allowed to dispatch this action on, use it only on develop, next and legacy." && false; fi
32+
echo "targetbranch=$(echo $branchname | sed 's=^develop$=main=')" >> $GITHUB_OUTPUT
3333
- name: Update package.json with new release candidate version
3434
id: create-version
3535
run: |
@@ -38,7 +38,7 @@ jobs:
3838
- name: Check if version already exists as package
3939
id: check-version-existence
4040
run: |
41-
if [ -n "$( npm view @eccenca/gui-elements versions | grep ${{ steps.create-version.outputs.version }} )" ] ; then echo "Stop: v${{ steps.create-version.outputs.version }} is already published!" && false; else echo "Continue: v${{ steps.create-version.outputs.version }} is not published."; fi
41+
if [ -n "$( npm view @eccenca/gui-elements versions | grep \'${{ steps.create-version.outputs.version }}\' )" ] ; then echo "Stop: v${{ steps.create-version.outputs.version }} is already published!" && false; else echo "Continue: v${{ steps.create-version.outputs.version }} is not published."; fi
4242
- name: Create release branch
4343
id: create-branch
4444
run: |

.github/workflows/publish-featurefix-prerelease.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
preid=$(echo ${{ steps.branch-name.outputs.current_branch }} | tr '[:upper:]' '[:lower:]' | sed 's=[^[:alnum:][:space:]"]==g')
4949
publishedversions=$(npm view @eccenca/gui-elements versions)
5050
yarn version --no-git-tag-version --new-version $(node -p -e "require('./package.json').version.split('-').shift()")-$preid.0
51-
while [ -n "$( echo $publishedversions | grep $(node -p -e "require('./package.json').version") )" ] ; do yarn version --no-git-tag-version --preid "$preid" --prerelease ; done
51+
while [ -n "$( echo $publishedversions | grep \'$(node -p -e "require('./package.json').version")\' )" ] ; do yarn version --no-git-tag-version --preid "$preid" --prerelease ; done
5252
- name: Get version
5353
id: package-version
5454
run: echo "version=$(node -p -e "require('./package.json').version")" >> $GITHUB_OUTPUT

.github/workflows/publish-final-release.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
echo "You started it on '${{ steps.branch-name.outputs.current_branch }}'."
3535
exit 1
3636
fi
37-
echo "targetbranch=(echo ${{ steps.branch-name.outputs.current_branch }} | sed 's=^main$=develop=')" >> $GITHUB_OUTPUT
37+
echo "targetbranch=$(echo ${{ steps.branch-name.outputs.current_branch }} | sed 's=^main$=develop=')" >> $GITHUB_OUTPUT
3838
- uses: actions/checkout@main
3939
- name: Initialize mandatory git config
4040
# @see https://github.community/t/how-do-i-get-gh-username-based-on-actions-events/17882
@@ -50,7 +50,7 @@ jobs:
5050
- name: Check if version already exists as package
5151
id: check-version-existence
5252
run: |
53-
if [ -n "$( npm view @eccenca/gui-elements versions | grep ${{ steps.package-version.outputs.version }} )" ] ; then echo "Stop: v${{ steps.package-version.outputs.version }} is already published!" && false; else echo "Continue: v${{ steps.package-version.outputs.version }} is not published."; fi
53+
if [ -n "$( npm view @eccenca/gui-elements versions | grep \'${{ steps.package-version.outputs.version }}\' )" ] ; then echo "Stop: v${{ steps.package-version.outputs.version }} is already published!" && false; else echo "Continue: v${{ steps.package-version.outputs.version }} is not published."; fi
5454
- name: Update version in repository
5555
run: |
5656
yarn version --no-git-tag-version --new-version ${{ steps.package-version.outputs.version }}
@@ -63,6 +63,7 @@ jobs:
6363
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
6464
- name: Push tag and changes
6565
run: |
66+
git checkout -b maintain/mergeReleaseTag-v${{ steps.package-version.outputs.version }}
6667
git push origin v${{ steps.package-version.outputs.version }}
6768
git push origin maintain/mergeReleaseTag-v${{ steps.package-version.outputs.version }}
6869
- name: Create pull request merge back release process changes
@@ -71,12 +72,12 @@ jobs:
7172
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7273
head: maintain/mergeReleaseTag-v${{ steps.package-version.outputs.version }}
7374
base: ${{ steps.dispatched-branch.outputs.targetbranch }}
74-
title: Release process changes from v${{ steps.create-version.outputs.version }}
75+
title: Release process changes from v${{ steps.package-version.outputs.version }}
7576
draft: true
7677
reviewers: ${{ github.actor }}
7778
body: |
7879
Created by Github workflow.
79-
After merging this PR the "publish final release" action can be triggered on `${{ steps.dispatched-branch.outputs.targetbranch }}`.
80+
Necessary to merge back all changes that had to be done during release process.
8081
8182
publish-package:
8283
needs: publish-final-release

.github/workflows/publish-release-candidate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
preid="rc"
4646
publishedversions=$(npm view @eccenca/gui-elements versions)
4747
yarn version --no-git-tag-version --new-version $(node -p -e "require('./package.json').version.split('-').shift()")-$preid.0
48-
while [ -n "$( echo $publishedversions | grep $(node -p -e "require('./package.json').version") )" ] ; do yarn version --no-git-tag-version --preid "$preid" --prerelease ; done
48+
while [ -n "$( echo $publishedversions | grep \'$(node -p -e "require('./package.json').version")\' )" ] ; do yarn version --no-git-tag-version --preid "$preid" --prerelease ; done
4949
- name: Get version
5050
id: package-version
5151
run: echo "version=$(node -p -e "require('./package.json').version")" >> $GITHUB_OUTPUT

.github/workflows/push-tagged-release.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,13 @@ jobs:
7777
if: inputs.onlyNpmPush != true
7878
run: |
7979
touch ./releasecontent.md
80+
CHANGELOG=$(cat <<"EOL"
81+
${{ steps.info-changelog.outputs.changes }}
82+
EOL
83+
)
8084
echo "* NPM package: https://www.npmjs.com/package/@eccenca/gui-elements/v/${{ steps.info-vars.outputs.version }}" >> ./releasecontent.md
8185
$( if [[ ! "${{ inputs.sectionChangelog }}" =~ ^(Unreleased)$ ]]; then echo "* Storybook: ${{ steps.chromatic-upload.outputs.storybookUrl }}" >> ./releasecontent.md; fi )
82-
$( if [[ ! "${{ inputs.sectionChangelog }}" =~ ^(Unreleased)$ ]]; then echo "${{ steps.info-changelog.outputs.changes }}" >> ./releasecontent.md; else echo "* Changelog: https://github.com/eccenca/gui-elements/blob/${{ inputs.ref }}/CHANGELOG.md#unreleased" >> ./releasecontent.md; fi )
86+
$( if [[ ! "${{ inputs.sectionChangelog }}" =~ ^(Unreleased)$ ]]; then echo "${CHANGELOG}" >> ./releasecontent.md; else echo "* Changelog: https://github.com/eccenca/gui-elements/blob/${{ inputs.ref }}/CHANGELOG.md#unreleased" >> ./releasecontent.md; fi )
8387
- name: Publish release
8488
# only use for final releases and RCs -- other pre-releases do not need an official announcement
8589
if: inputs.onlyNpmPush != true

.github/workflows/test-project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "🛑 Test: project conventions"
1+
name: "👀 Test: project conventions"
22

33
on:
44
push:

CHANGELOG.md

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,34 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
88

99
### Added
1010

11-
- `intent` property to `Button`, `FieldItem`, `FieldSet`, `Notification`, and `Spinner`
11+
- added support for `react-flow` v12 for `NodeContent` component, added v12-related components: `EdgeDefaultV12`, `NodeDefaultV12`, `EdgeDefs`
12+
13+
## [24.2.0] - 2025-06-04
14+
15+
### Added
16+
17+
- `<ContextOverlay />`
18+
- `usePlaceholder` property: can be used to display the target but include the component later when the first interaction happens, this can improve performance
19+
- `<ContextMenu />`
20+
- `preventPlaceholder` property to prevent the default usage of placeholders waiting for the first user interaction before inserting the full context menu
21+
- `<Tooltip />`
22+
- `usePlaceholder` property: can be used to display the target but include the full component later when the first interaction happens, this can improve performance. It is turned on for text tooltips by default.
23+
- `<OverviewItemActions />`
24+
- `delayDisplayChildren` property: set a time (in ms) to delay the actual rendering of elements inside the actions container. When enabled the containing `OverviewItem` can be displayed faster. Can be used e.g. to boost performance when rendering `OverviewItemActions` with `hiddenInteractions` set to `true`.
25+
- `delaySkeleton` property to set the placeholder/skeleton as long as the delayed display is waiting to get processed
26+
- `<Button />`, `<FieldItem />`, `<FieldSet />`, `<Notification />`, `<Spinner />`
27+
- `intent` property: align intent state usage with other components
28+
29+
### Deprecated
30+
31+
- `<Markdown />`
32+
- `reHypePlugins` property now use `PluggableList` from the unified package. This may require changes if you previously used plugins not conforming to the stricter unified typings. Backward compatibility with the old plugin list type will be removed in the next major version.
33+
- `<FieldSet />`, `<FieldItem />`, `<MultiSelect />`, `<Button />`
34+
- `hasStatePrimary`, `hasStateSuccess`, `hasStateWarning` and `hasStateDanger` properties will be removed, use `intent` property instead
35+
- `<Notification />`
36+
- `neutral`, `success`, `warning` and `danger` properties will be removed, use `intent` property instead
37+
- `<MultiSelect />`
38+
- `data-test-id` for clearance button won't be set automatically, only if a test id for `MultiSelect` is given
1239

1340
### Fixed
1441

@@ -20,7 +47,24 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
2047
- some more interfaces are exposed:
2148
- `IntentBlueprint`: BlueprintJS intent types, also available by `DefinitionsBlueprint`
2249
- `TableDataContainerProps`, `TableSimpleContainerProps`, `TableHeadProps`, `TableBodyProps`, `TableExpandedRowProps`, `TableHeaderProps` and `DataTableRenderProps` as interfaces for diverse table components
23-
- added support for `react-flow` v12 for `NodeContent` component, added v12-related components: `EdgeDefaultV12`, `NodeDefaultV12`, `EdgeDefs`
50+
- `<CodeAutocompleteField />`
51+
- memorize `handleChange` handler to prevent unwanted re-renders
52+
53+
### Usage with old application bundlers
54+
55+
Old bundlers like webpack4 do not support the `exports` field from `package.json`, so it cannot resolve the correct files that need to be imported from the packages if they do not come with alternate configs like `modules` or `main`. Our latest markdown update introduced a few of those packages. So you need to extend your aliases (in webpack4 it is managed in `config.resolve.alias`) like:
56+
57+
```
58+
{
59+
"devlop": "devlop/lib/default.js",
60+
"unist-util-visit-parents/do-not-use-color": "unist-util-visit-parents/lib/color.js",
61+
"vfile/do-not-use-conditional-minpath": "vfile/lib/minpath.browser.js",
62+
"vfile/do-not-use-conditional-minproc": "vfile/lib/minproc.browser.js",
63+
"vfile/do-not-use-conditional-minurl": "vfile/lib/minurl.browser.js",
64+
}
65+
```
66+
67+
If you use Jest then you can use the same aliases for the `moduleNameMapper` config, if necessary.
2468

2569
## [24.1.0] - 2025-04-16
2670

package.json

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@eccenca/gui-elements",
33
"description": "GUI elements based on other libraries, usable in React application, written in Typescript.",
4-
"version": "24.1.0",
4+
"version": "24.2.0",
55
"license": "Apache-2.0",
66
"homepage": "https://github.com/eccenca/gui-elements",
77
"bugs": "https://github.com/eccenca/gui-elements/issues",
@@ -95,12 +95,14 @@
9595
"react-flow-renderer": "9.7.4",
9696
"react-flow-renderer-lts": "npm:react-flow-renderer@^10.3.17",
9797
"react-inlinesvg": "^3.0.3",
98-
"react-markdown": "^8.0.7",
98+
"react-markdown": "^10.1.0",
99+
"react-markdown-deprecated": "npm:react-markdown@^8.0.7",
99100
"react-syntax-highlighter": "^15.6.1",
100-
"rehype-raw": "^6.1.1",
101-
"remark-definition-list": "^1.2.0",
102-
"remark-gfm": "^3.0.1",
103-
"remark-parse": "^10.0.2",
101+
"rehype-external-links": "^3.0.0",
102+
"rehype-raw": "^7.0.0",
103+
"remark-definition-list": "^2.0.0",
104+
"remark-gfm": "^4.0.1",
105+
"remark-parse": "^11.0.0",
104106
"reset-css": "^5.0.2",
105107
"unified": "^11.0.5",
106108
"wicg-inert": "^3.1.3",
@@ -179,7 +181,8 @@
179181
"**/@types/react": "^17.0.85",
180182
"node-sass-package-importer/**/postcss": "^8.4.49",
181183
"string-width": "^4.2.3",
182-
"wrap-ansi": "^7.0.0"
184+
"wrap-ansi": "^7.0.0",
185+
"hast-util-from-parse5": "8.0.0"
183186
},
184187
"husky": {
185188
"hooks": {

src/cmem/markdown/Markdown.tsx

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
import React from "react";
22
import ReactMarkdown from "react-markdown";
3-
import { PluggableList } from "react-markdown/lib/react-markdown";
3+
/**
4+
* Recreate the old type to provide support until next major
5+
*/
6+
import { PluggableList as PluggableListDeprecated } from "react-markdown-deprecated/lib/react-markdown";
47
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
58
// @ts-ignore: No declaration file for module (TODO: should be @ts-expect-error but GUI elements is used inside project with `noImplicitAny=false`)
69
import remarkTypograf from "@mavrin/remark-typograf";
10+
import rehypeExternalLinks from "rehype-external-links";
711
import rehypeRaw from "rehype-raw";
812
import { remarkDefinitionList } from "remark-definition-list";
913
import remarkGfm from "remark-gfm";
14+
import { PluggableList as PluggableListUnified } from "unified";
1015

1116
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
1217
import { HtmlContentBlock, HtmlContentBlockProps, TestableComponent } from "../../index";
18+
type PluggableList = PluggableListUnified | PluggableListDeprecated;
1319

1420
export interface MarkdownProps extends TestableComponent {
1521
children: string;
@@ -35,6 +41,7 @@ export interface MarkdownProps extends TestableComponent {
3541
/**
3642
* Additional reHype plugins to execute.
3743
* @see https://github.com/remarkjs/react-markdown#architecture
44+
* @deprecated (v25) this property won't support `PluggableList` from "react-markdown/lib/react-markdown" with the next major version, only the one from `unified` will be supported then.
3845
*/
3946
reHypePlugins?: PluggableList;
4047
/**
@@ -54,9 +61,9 @@ const configDefault = {
5461
@see https://github.com/remarkjs/react-markdown#api
5562
*/
5663
// @see https://github.com/remarkjs/remark/blob/main/doc/plugins.md#list-of-plugins
57-
remarkPlugins: [remarkGfm, remarkTypograf, remarkDefinitionList] as PluggableList,
64+
remarkPlugins: [remarkGfm, remarkTypograf, remarkDefinitionList] as PluggableListUnified,
5865
// @see https://github.com/rehypejs/rehype/blob/main/doc/plugins.md#list-of-plugins
59-
rehypePlugins: [] as PluggableList,
66+
rehypePlugins: [] as PluggableListUnified,
6067
allowedElements: [
6168
// default markdown
6269
"a",
@@ -110,6 +117,13 @@ export const Markdown = ({
110117
htmlContentBlockProps,
111118
...otherProps
112119
}: MarkdownProps) => {
120+
const configHtmlExternalLinks = {
121+
rel: ["nofollow"],
122+
target: linkTargetName,
123+
};
124+
125+
configDefault.rehypePlugins = configDefault.rehypePlugins.concat([[rehypeExternalLinks, configHtmlExternalLinks]]);
126+
113127
const configHtml = allowHtml
114128
? {
115129
rehypePlugins: [...configDefault.rehypePlugins].concat([rehypeRaw]),
@@ -132,14 +146,10 @@ export const Markdown = ({
132146
...configDefault,
133147
...configHtml,
134148
...configTextOnly,
135-
linkTarget: linkTargetName
136-
? (href: string, _children: any, _title: string) => {
137-
const linkTarget = href.charAt(0) !== "#" ? linkTargetName : "";
138-
return linkTarget as React.HTMLAttributeAnchorTarget;
139-
}
140-
: undefined,
141149
components: {
150+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
142151
code(props: any) {
152+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
143153
const { children, className, node, inline, ...rest } = props;
144154
const match = /language-(\w+)/.exec(className || "");
145155
return match ? (
@@ -159,14 +169,15 @@ export const Markdown = ({
159169
);
160170
},
161171
},
172+
allowedElements,
162173
};
163-
allowedElements && (reactMarkdownProperties.allowedElements = allowedElements);
164-
reHypePlugins &&
165-
reHypePlugins.forEach(
166-
(plugin) => (reactMarkdownProperties.rehypePlugins = [...reactMarkdownProperties.rehypePlugins, plugin])
174+
175+
if (reHypePlugins) {
176+
reactMarkdownProperties.rehypePlugins = reactMarkdownProperties.rehypePlugins.concat(
177+
reHypePlugins as PluggableListUnified
167178
);
179+
}
168180

169-
// @ts-ignore because against the lib spec it does not allow a function for linkTarget.
170181
const markdownDisplay = <ReactMarkdown {...reactMarkdownProperties} />;
171182
return inheritBlock && !(otherProps["data-test-id"] || htmlContentBlockProps) ? (
172183
markdownDisplay

src/cmem/markdown/highlightSearchWords.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,26 @@ describe("Highlight search words reHype plugin", () => {
99
const highlightSearchWordsPlugin = markdownUtils.highlightSearchWordsPluginFactory(searchQuery);
1010
const highlightSearchWordTransformer = highlightSearchWordsPlugin();
1111
const textNode = (text: string): Text => ({ type: "text", value: text });
12-
const markNode = (text: string): Element => ({ type: "element", tagName: "mark", children: [textNode(text)] });
12+
const markNode = (text: string): Element => ({
13+
type: "element",
14+
tagName: "mark",
15+
properties: {},
16+
children: [textNode(text)],
17+
});
1318
const result = highlightSearchWordTransformer(
1419
{
1520
type: "root",
1621
children: [
1722
{
1823
type: "element",
1924
tagName: "p",
25+
properties: {},
2026
children: [textNode("Text with abc query words xyz.")],
2127
},
2228
],
2329
},
2430
new VFile(),
25-
// eslint-disable-next-line @typescript-eslint/no-empty-function
31+
2632
() => {}
2733
);
2834
const rootChildren = (result as Root).children;

0 commit comments

Comments
 (0)