Skip to content

Commit 9fe2d4e

Browse files
author
Caleb Jacob
authored
Merge pull request #150 from NearSocial/release-2.5.2
Release 2.5.2
2 parents 32a404f + 71d02ac commit 9fe2d4e

File tree

4 files changed

+25
-6
lines changed

4 files changed

+25
-6
lines changed

CHANGELOG.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
11
# Changelog
22

3+
## 2.5.2
4+
5+
- Use `styled-components` in combination with `customElements` like `Link`:
6+
7+
```jsx
8+
const MyLink = styled("Link")`
9+
color: red;
10+
`;
11+
12+
return (
13+
<MyLink href="/my/page">
14+
Click Me!
15+
</MyLink>
16+
);
17+
```
18+
319
## 2.5.1
420

521
- FIX: Add back `Ethers.send`, that was incorrectly removed as part of the https://github.com/NearSocial/VM/pull/128
6-
- FIX: Disable `is` attribute to avoid conflicts with React. Reported by @brunomodificato
22+
- FIX: Disable `is` attribute to avoid conflicts with React. Reported by BrunoModificato from OtterSec.
723

824
## 2.5.0
925

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "near-social-vm",
3-
"version": "2.5.1",
3+
"version": "2.5.2",
44
"description": "Near Social VM",
55
"main": "dist/index.js",
66
"files": [

src/lib/vm/vm.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ const assertValidObject = (o) => {
313313
};
314314

315315
const assertRadixComponent = (element) => {
316+
if (!element) return;
317+
316318
let isRadixElement = Object.keys(RadixTags).includes(element.split(".")[0]);
317319

318320
if (!isRadixElement) return;
@@ -1011,14 +1013,15 @@ class VmStack {
10111013
const args = this.getArray(code.tag.arguments);
10121014
const arg = args?.[0];
10131015
const RadixComp = assertRadixComponent(arg);
1016+
const CustomElement = this.vm.near.config.customElements[arg];
10141017

1015-
if (!isStyledComponent(arg) && !RadixComp) {
1018+
if (!isStyledComponent(arg) && !RadixComp && !CustomElement) {
10161019
throw new Error(
1017-
'styled() can only take `styled` components or valid Radix components (EG: "Accordion.Trigger")'
1020+
'styled() can only take `styled` components, Radix component names (EG: "Accordion.Trigger"), or a customElement name (EG: "Link")'
10181021
);
10191022
}
10201023

1021-
styledTemplate = styled(RadixComp ?? arg);
1024+
styledTemplate = styled(CustomElement ?? RadixComp ?? arg);
10221025
} else {
10231026
if (key === "keyframes") {
10241027
styledTemplate = keyframes;

0 commit comments

Comments
 (0)