Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/odd-zebras-enjoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@devup-ui/webpack-plugin": patch
---

Fix hot reload issue
6 changes: 6 additions & 0 deletions .changeset/tricky-roses-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@devup-ui/wasm": patch
"@devup-ui/react": patch
---

Add Image component
36 changes: 0 additions & 36 deletions .github/workflows/check-pr.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
- name: Upload to codecov.io
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
- name: Create Release Pull Request or Publish to npm
id: changesets
Expand Down
2 changes: 1 addition & 1 deletion apps/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"react": "^19.0.0",
"react-dom": "^19.0.0",
"next": "15.1.3",
"next": "^15.1.4",
"@devup-ui/react": "workspace:*"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion bindings/devup-ui-wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
"types": "./pkg/index.d.ts",
"scripts": {
"build": "wasm-pack build --target nodejs --out-dir ./pkg --out-name index",
"test": "cargo test"
"test": "wasm-pack test --node"
}
}
2 changes: 1 addition & 1 deletion bindings/devup-ui-wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ pub fn code_extract(
Err(error) => Err(JsValue::from_str(error.to_string().as_str())),
}
}
fn object_to_typography(obj: Object, level: u8) -> Result<Typography, JsValue> {
pub fn object_to_typography(obj: Object, level: u8) -> Result<Typography, JsValue> {
Ok(Typography::new(
Reflect::get(&obj, &JsValue::from_str("fontFamily"))?
.as_string()
Expand Down
47 changes: 47 additions & 0 deletions bindings/devup-ui-wasm/tests/wasm.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
use devup_ui_wasm::object_to_typography;
use js_sys::{Object, Reflect};
use wasm_bindgen::JsValue;
use wasm_bindgen_test::*;

#[allow(dead_code)]
#[wasm_bindgen_test]
fn test_object_to_typography() {
let obj = Object::new();
Reflect::set(
&obj,
&JsValue::from_str("fontFamily"),
&JsValue::from_str("Arial"),
)
.unwrap();
Reflect::set(
&obj,
&JsValue::from_str("fontSize"),
&JsValue::from_str("12px"),
)
.unwrap();
Reflect::set(
&obj,
&JsValue::from_str("fontWeight"),
&JsValue::from_str("bold"),
)
.unwrap();
Reflect::set(
&obj,
&JsValue::from_str("lineHeight"),
&JsValue::from_str("1.5"),
)
.unwrap();
Reflect::set(
&obj,
&JsValue::from_str("letterSpacing"),
&JsValue::from_str("1px"),
)
.unwrap();
let typography = object_to_typography(obj, 0).unwrap();
assert_eq!(typography.font_family, "Arial");
assert_eq!(typography.font_size, "12px");
assert_eq!(typography.font_weight, "bold");
assert_eq!(typography.line_height, "1.5");
assert_eq!(typography.letter_spacing, "1px");
assert_eq!(typography.level, 0);
}
13 changes: 0 additions & 13 deletions bindings/devup-ui-wasm/tests/web.rs

This file was deleted.

10 changes: 10 additions & 0 deletions libs/extractor/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub enum ExportVariableKind {
Flex,
VStack,
Center,
Image,
Css,
}

Expand All @@ -23,6 +24,7 @@ impl ExportVariableKind {
| ExportVariableKind::Flex
| ExportVariableKind::Box => Ok("div"),
ExportVariableKind::Text => Ok("span"),
ExportVariableKind::Image => Ok("img"),
ExportVariableKind::Button => Ok("button"),
ExportVariableKind::Input => Ok("input"),
ExportVariableKind::Css => Err("Css does not have a tag"),
Expand All @@ -37,6 +39,7 @@ impl ExportVariableKind {
| ExportVariableKind::Button
| ExportVariableKind::Css
| ExportVariableKind::Text
| ExportVariableKind::Image
| ExportVariableKind::Box => vec![],
ExportVariableKind::Flex => vec![Static(ExtractStaticStyle {
value: "flex".to_string(),
Expand Down Expand Up @@ -93,6 +96,7 @@ impl TryFrom<String> for ExportVariableKind {
match value.as_str() {
"Box" => Ok(ExportVariableKind::Box),
"Text" => Ok(ExportVariableKind::Text),
"Image" => Ok(ExportVariableKind::Image),
"Button" => Ok(ExportVariableKind::Button),
"Input" => Ok(ExportVariableKind::Input),
"Flex" => Ok(ExportVariableKind::Flex),
Expand All @@ -118,6 +122,10 @@ mod tests {
ExportVariableKind::try_from("Text".to_string()),
Ok(ExportVariableKind::Text)
);
assert_eq!(
ExportVariableKind::try_from("Image".to_string()),
Ok(ExportVariableKind::Image)
);
assert_eq!(
ExportVariableKind::try_from("Button".to_string()),
Ok(ExportVariableKind::Button)
Expand Down Expand Up @@ -149,6 +157,7 @@ mod tests {
fn test_to_tag() {
assert_eq!(ExportVariableKind::Box.to_tag(), Ok("div"));
assert_eq!(ExportVariableKind::Text.to_tag(), Ok("span"));
assert_eq!(ExportVariableKind::Image.to_tag(), Ok("img"));
assert_eq!(ExportVariableKind::Button.to_tag(), Ok("button"));
assert_eq!(ExportVariableKind::Input.to_tag(), Ok("input"));
assert_eq!(ExportVariableKind::Flex.to_tag(), Ok("div"));
Expand All @@ -161,6 +170,7 @@ mod tests {
fn test_extract_style_from_kind() {
assert_eq!(ExportVariableKind::Box.extract(), vec![]);
assert_eq!(ExportVariableKind::Text.extract(), vec![]);
assert_eq!(ExportVariableKind::Image.extract(), vec![]);
assert_eq!(ExportVariableKind::Button.extract(), vec![]);
assert_eq!(ExportVariableKind::Input.extract(), vec![]);
assert_eq!(
Expand Down
2 changes: 2 additions & 0 deletions libs/extractor/src/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ impl<'a> VisitMut<'a> for DevupVisitor<'a> {
|| name == "role"
|| name == "ref"
|| name == "key"
|| name == "alt"
|| name == "src"
|| name == "children"
{
continue;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "module",
"scripts": {
"lint": "pnpm -r lint",
"test": "cargo tarpaulin && vitest test --coverage --run",
"test": "cargo tarpaulin && vitest test --coverage --run && pnpm -r test",
"build": "pnpm -r build",
"dev": "pnpm -r dev"
},
Expand Down
2 changes: 0 additions & 2 deletions packages/next-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"next": "^15.1"
},
"scripts": {
"test": "vitest run --coverage",
"test:s": "vitest run -u",
"lint": "eslint",
"build": "tsc && vite build"
},
Expand Down
2 changes: 0 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"csstype": "^3.1"
},
"scripts": {
"test": "vitest run --coverage",
"test:s": "vitest run -u",
"lint": "eslint",
"build": "vite build"
},
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe('export', () => {
Input: expect.any(Function),
Text: expect.any(Function),
VStack: expect.any(Function),
Image: expect.any(Function),

css: expect.any(Function),
})
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/Box.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { DevupProps } from '../types/props'
import type { Merge } from '../types/utils'

export function Box(
export function Box<T extends React.ElementType = 'div'>(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
props: Merge<React.ComponentProps<'div'>, DevupProps>,
props: Merge<React.ComponentProps<T>, DevupProps>,
): React.ReactElement {
throw new Error('Cannot run on the runtime')
}
4 changes: 2 additions & 2 deletions packages/react/src/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { DevupProps } from '../types/props'
import type { Merge } from '../types/utils'

export function Button(
export function Button<T extends React.ElementType = 'button'>(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
props: Merge<React.ComponentProps<'button'>, DevupProps>,
props: Merge<React.ComponentProps<T>, DevupProps>,
): React.ReactElement {
throw new Error('Cannot run on the runtime')
}
4 changes: 2 additions & 2 deletions packages/react/src/components/Center.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { DevupProps } from '../types/props'
import type { Merge } from '../types/utils'

export function Center(
export function Center<T extends React.ElementType = 'div'>(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
props: Merge<React.ComponentProps<'div'>, DevupProps>,
props: Merge<React.ComponentProps<T>, DevupProps>,
): React.ReactElement {
throw new Error('Cannot run on the runtime')
}
4 changes: 2 additions & 2 deletions packages/react/src/components/Flex.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { DevupProps } from '../types/props'
import type { Merge } from '../types/utils'

export function Flex(
export function Flex<T extends React.ElementType = 'div'>(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
props: Merge<React.ComponentProps<'div'>, DevupProps>,
props: Merge<React.ComponentProps<T>, DevupProps>,
): React.ReactElement {
throw new Error('Cannot run on the runtime')
}
9 changes: 9 additions & 0 deletions packages/react/src/components/Image.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { DevupProps } from '../types/props'
import type { Merge } from '../types/utils'

export function Image<T extends React.ElementType = 'img'>(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
props: Merge<React.ComponentProps<T>, DevupProps>,
): React.ReactElement {
throw new Error('Cannot run on the runtime')
}
4 changes: 2 additions & 2 deletions packages/react/src/components/Input.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { DevupProps } from '../types/props'
import type { Merge } from '../types/utils'

export function Input(
export function Input<T extends React.ElementType = 'input'>(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
props: Merge<React.ComponentProps<'input'>, DevupProps>,
props: Merge<React.ComponentProps<T>, DevupProps>,
): React.ReactElement {
throw new Error('Cannot run on the runtime')
}
4 changes: 2 additions & 2 deletions packages/react/src/components/Text.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { DevupTypographyProps } from '../types/props'
import type { Merge } from '../types/utils'

export function Text(
export function Text<T extends React.ElementType = 'span'>(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
props: Merge<React.ComponentProps<'span'>, DevupTypographyProps>,
props: Merge<React.ComponentProps<T>, DevupTypographyProps>,
): React.ReactElement {
throw new Error('Cannot run on the runtime')
}
4 changes: 2 additions & 2 deletions packages/react/src/components/VStack.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { DevupProps } from '../types/props'
import type { Merge } from '../types/utils'

export function VStack(
export function VStack<T extends React.ElementType = 'span'>(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
props: Merge<React.ComponentProps<'div'>, DevupProps>,
props: Merge<React.ComponentProps<T>, DevupProps>,
): React.ReactElement {
throw new Error('Cannot run on the runtime')
}
2 changes: 2 additions & 0 deletions packages/react/src/components/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Box } from '../Box'
import { Button } from '../Button'
import { Center } from '../Center'
import { Flex } from '../Flex'
import { Image } from '../Image'
import { Input } from '../Input'
import { Text } from '../Text'
import { VStack } from '../VStack'
Expand All @@ -15,5 +16,6 @@ describe('Component', () => {
expect(() => Input({})).toThrowError('Cannot run on the runtime')
expect(() => Text({})).toThrowError('Cannot run on the runtime')
expect(() => VStack({})).toThrowError('Cannot run on the runtime')
expect(() => Image({})).toThrowError('Cannot run on the runtime')
})
})
1 change: 1 addition & 0 deletions packages/react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export { Box } from './components/Box'
export { Button } from './components/Button'
export { Center } from './components/Center'
export { Flex } from './components/Flex'
export { Image } from './components/Image'
export { Input } from './components/Input'
export { Text } from './components/Text'
export { VStack } from './components/VStack'
Expand Down
2 changes: 0 additions & 2 deletions packages/webpack-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
],
"types": "./dist/index.d.ts",
"scripts": {
"test": "vitest run --coverage",
"test:s": "vitest run -u",
"lint": "eslint",
"build": "tsc && vite build"
},
Expand Down
Loading
Loading