Skip to content

Commit e365997

Browse files
committed
fix: internals
1 parent cb9cbb3 commit e365997

19 files changed

+43
-51
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"exports": {
1414
"./api": "./dist/api/index.js",
1515
"./ui": "./dist/ui/index.js",
16-
"./ui/experimental": "./dist/experimental/index.js",
16+
"./ui/experimental": "./dist/ui/experimental/index.js",
1717
"./jsx-runtime": "./dist/jsx-runtime.js",
1818
"./jsx-dev-runtime": "./dist/jsx-dev-runtime.js"
1919
},

src/jsx-runtime.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
UiNode,
44
FunctionalComponent,
55
Fragment,
6-
createElement,
6+
element,
77
} from "./ui/internal.js";
88

99
export { UiNode, FunctionalComponent, Fragment };
@@ -13,8 +13,7 @@ type ClassList = string | Record<string, boolean> | ClassList[];
1313
export function jsx<
1414
T extends FunctionalComponent | keyof JSX.IntrinsicElements,
1515
>(type: T, props: Record<string, unknown>): UiNode {
16-
const { children, ...rest } = props;
17-
return createElement(type, rest, children as UiNode);
16+
return element(type, props);
1817
}
1918

2019
export const jsxs = jsx;

src/ui/experimental/Box.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Responsive, Space, UiNode, createElement } from "../internal.js";
1+
import { Responsive, Space, UiNode, element } from "../internal.js";
22

33
type BoxProps = {
44
width?: Responsive<string>;
@@ -22,6 +22,5 @@ type BoxProps = {
2222
};
2323

2424
export function Box(props: BoxProps): UiNode {
25-
const { children, ...rest } = props;
26-
return createElement("ui-box", rest, children);
25+
return element("ui-box", props);
2726
}

src/ui/experimental/Button.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Json, UiNode, createElement } from "../internal.js";
1+
import { Json, UiNode, element } from "../internal.js";
22

33
type ButtonProps = {
44
variant?: "default" | "primary" | "danger";
@@ -10,6 +10,5 @@ type ButtonProps = {
1010
};
1111

1212
export function Button(props: ButtonProps): UiNode {
13-
const { children, ...rest } = props;
14-
return createElement("ui-button", rest, children);
13+
return element("ui-button", props);
1514
}

src/ui/experimental/Callout.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { UiNode, createElement } from "../internal.js";
1+
import { UiNode, element } from "../internal.js";
22

33
type CalloutProps = {
44
type?: "info" | "success" | "warning" | "error";
@@ -7,6 +7,5 @@ type CalloutProps = {
77
};
88

99
export function Callout(props: CalloutProps): UiNode {
10-
const { children, ...rest } = props;
11-
return createElement("ui-alert", rest, children);
10+
return element("ui-alert", props);
1211
}

src/ui/experimental/Checkbox.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Json, UiNode, createElement } from "../internal.js";
1+
import { Json, UiNode, element } from "../internal.js";
22

33
type CheckboxProps = {
44
name?: string;
@@ -9,5 +9,5 @@ type CheckboxProps = {
99
};
1010

1111
export function Checkbox(props: CheckboxProps): UiNode {
12-
return createElement("ui-checkbox", props);
12+
return element("ui-checkbox", props);
1313
}

src/ui/experimental/CopyButton.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { UiNode, createElement } from "../internal.js";
1+
import { UiNode, element } from "../internal.js";
22

33
type CopyButtonProps = {
44
variant?: "default" | "primary" | "danger";
@@ -9,6 +9,5 @@ type CopyButtonProps = {
99
};
1010

1111
export function CopyButton(props: CopyButtonProps): UiNode {
12-
const { children, ...rest } = props;
13-
return createElement("ui-copy-button", rest, children);
12+
return element("ui-copy-button", props);
1413
}

src/ui/experimental/Divider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { Responsive, UiNode, createElement } from "../internal.js";
1+
import { Responsive, UiNode, element } from "../internal.js";
22

33
type DividerProps = {
44
orientation?: Responsive<"horizontal" | "vertical">;
55
};
66

77
export function Divider(props: DividerProps): UiNode {
8-
return createElement("ui-divider", props);
8+
return element("ui-divider", props);
99
}

src/ui/experimental/DownloadButton.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Json, UiNode, createElement } from "../internal.js";
1+
import { Json, UiNode, element } from "../internal.js";
22

33
type DownloadButtonProps = {
44
variant?: "default" | "primary" | "danger";
@@ -10,6 +10,5 @@ type DownloadButtonProps = {
1010
};
1111

1212
export function DownloadButton(props: DownloadButtonProps): UiNode {
13-
const { children, ...rest } = props;
14-
return createElement("ui-download-button", rest, children);
13+
return element("ui-download-button", props);
1514
}

src/ui/experimental/Flex.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Responsive, Space, UiNode, createElement } from "../internal.js";
1+
import { Responsive, Space, UiNode, element } from "../internal.js";
22

33
type FlexProps = {
44
width?: Responsive<string>;
@@ -30,6 +30,5 @@ type FlexProps = {
3030
};
3131

3232
export function Flex(props: FlexProps): UiNode {
33-
const { children, ...rest } = props;
34-
return createElement("ui-flex", rest, children);
33+
return element("ui-flex", props);
3534
}

0 commit comments

Comments
 (0)