Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix typescript typecheck

Sultan9a59dabe1d99
diff --git a/apps/designer/app/designer/features/footer/breadcrumbs.tsx b/apps/designer/app/designer/features/footer/breadcrumbs.tsx
index f17d4673bf..1856a8cbcd 100644
--- a/apps/designer/app/designer/features/footer/breadcrumbs.tsx
+++ b/apps/designer/app/designer/features/footer/breadcrumbs.tsx
@@ -5,11 +5,11 @@ import { type Publish, type Instance } from "@webstudio-is/react-sdk";
import { useSelectedInstanceData } from "~/designer/shared/nano-states";
type BreadcrumbProps = {
- component: Instance["component"];
+ children: JSX.Element | string;
onClick?: () => void;
};
-const Breadcrumb = ({ component, onClick }: BreadcrumbProps) => {
+const Breadcrumb = ({ children, onClick }: BreadcrumbProps) => {
return (
<>
<Button
@@ -23,7 +23,7 @@ const Breadcrumb = ({ component, onClick }: BreadcrumbProps) => {
lineHeight: "100%",
}}
>
- {component}
+ {children}
</Button>
<ChevronRightIcon color="white" />
</>
@@ -41,19 +41,22 @@ export const Breadcrumbs = ({ publish }: BreadcrumbsProps) => {
return (
<Flex align="center" css={{ height: "100%" }}>
{selectedInstancePath.length === 0 ? (
- <Breadcrumb component={<Text size="1">No instance selected</Text>} />
+ <Breadcrumb>
+ <Text size="1">No instance selected</Text>
+ </Breadcrumb>
) : (
selectedInstancePath.map((instance) => (
<Breadcrumb
key={instance.id}
- component={instance.component}
onClick={() => {
publish<"selectInstanceById", Instance["id"]>({
type: "selectInstanceById",
payload: instance.id,
});
}}
- />
+ >
+ {instance.component}
+ </Breadcrumb>
))
)}
</Flex>
diff --git a/apps/designer/app/designer/features/style-panel/shared/configs.ts b/apps/designer/app/designer/features/style-panel/shared/configs.ts
index 6f04b8889c..3750e0cb33 100644
--- a/apps/designer/app/designer/features/style-panel/shared/configs.ts
+++ b/apps/designer/app/designer/features/style-panel/shared/configs.ts
@@ -23,7 +23,6 @@ export type Control =
| "Empty";
type StyleConfigWithItems = BaseStyleConfig & {
- category: Category;
control: Control;
items: Array<{ label: string; name: string }>;
};
diff --git a/apps/designer/app/designer/features/style-panel/style-section.tsx b/apps/designer/app/designer/features/style-panel/style-section.tsx
index 16219917eb..baf3b18b20 100644
--- a/apps/designer/app/designer/features/style-panel/style-section.tsx
+++ b/apps/designer/app/designer/features/style-panel/style-section.tsx
@@ -302,25 +302,19 @@ const ComboboxControl = ({
<PropertyName property={styleConfig.property} label={styleConfig.label} />
<Flex align="center" css={{ gridColumn: "2/4" }} gap="1">
<Combobox
- id={styleConfig.property}
+ label={styleConfig.property}
items={styleConfig.items}
- css={{
- // @todo drag&drop cursor to adjust numeric value
- // const cursorUrl = data:image/svg+xml;base64,${btoa(svgCursor)}
- //cursor: `url(${cursorUrl}), text`,
- textAlign: "right",
- }}
- state={value.type === "invalid" ? "invalid" : undefined}
- value={String(value.value)}
+ // state={value.type === "invalid" ? "invalid" : undefined}
+ value={String(value.value) as string}
// @todo new combobox doesn't include any of these event handlers
- onValueSelect={setValue}
- onValueEnter={setValue}
- onItemEnter={(value) => {
- setValue(value, { isEphemeral: true });
- }}
- onItemLeave={() => {
- setValue(String(value.value), { isEphemeral: true });
- }}
+ // onValueSelect={setValue}
+ // onValueEnter={setValue}
+ // onItemEnter={(value: unknown) => {
+ // setValue(value as string, { isEphemeral: true });
+ // }}
+ // onItemLeave={() => {
+ // setValue(String(value.value), { isEphemeral: true });
+ // }}
/>
<Unit value={value} />
</Flex>
@@ -575,7 +569,11 @@ const LockControl = ({
);
};
-const ShowMore = ({ styleConfigs }: { styleConfigs: Array<JSX.Element> }) => {
+const ShowMore = ({
+ styleConfigs,
+}: {
+ styleConfigs: Array<JSX.Element | null>;
+}) => {
const [isOpen, setIsOpen] = useState(false);
if (styleConfigs.length === 0) return null;
return (
@@ -638,8 +636,8 @@ type RenderCategoryProps = {
createBatchUpdate: CreateBatchUpdate;
currentStyle: Style;
category: Category;
- styleConfigsByCategory: JSX.Element[];
- moreStyleConfigsByCategory: JSX.Element[];
+ styleConfigsByCategory: Array<JSX.Element | null>;
+ moreStyleConfigsByCategory: Array<JSX.Element | null>;
};
// Categories should render themselves because most Categories will not be flat un-ordered lists with
// the new designs, refactor ColorControl, SpacingControl if needed.
diff --git a/apps/designer/app/designer/features/style-panel/style-settings.tsx b/apps/designer/app/designer/features/style-panel/style-settings.tsx
index 78e1c22ffe..b59b0268e4 100644
--- a/apps/designer/app/designer/features/style-panel/style-settings.tsx
+++ b/apps/designer/app/designer/features/style-panel/style-settings.tsx
@@ -94,8 +94,8 @@ export const StyleSettings = ({
search
);
const { moreFrom } = categories[category];
- const styleConfigsByCategory: Array<JSX.Element> = [];
- const moreStyleConfigsByCategory: Array<JSX.Element> = [];
+ const styleConfigsByCategory: Array<JSX.Element | null> = [];
+ const moreStyleConfigsByCategory: Array<JSX.Element | null> = [];
for (const styleConfig of styleConfigs) {
const isInCategory = categoryProperties.includes(styleConfig.property);
@@ -109,7 +109,6 @@ export const StyleSettings = ({
const element = renderProperty({
...rest,
setProperty,
- createBatchUpdate,
currentStyle,
styleConfig,
category,
diff --git a/package.json b/package.json
index cbcd14529f..51b25e54bf 100644
--- a/package.json
+++ b/package.json
@@ -10,7 +10,7 @@
},
"scripts": {
"build": "turbo run build",
- "checks": "turbo run checks",
+ "checks": "turbo run build && turbo run checks",
"dev": "turbo run dev --parallel",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"prepare": "husky install",
diff --git a/packages/design-system/src/components/combobox.tsx b/packages/design-system/src/components/combobox.tsx
index d8f81f6123..6fb525e9f1 100644
--- a/packages/design-system/src/components/combobox.tsx
+++ b/packages/design-system/src/components/combobox.tsx
@@ -115,7 +115,8 @@ export const List = <Item extends BaseItem>({
export const ComboboxPopperContent = PopperContent;
type ComboboxProps<Item> = {
- name: string;
+ name?: string;
+ label?: string;
items: Array<Item>;
value?: Item;
onItemSelect?: (value: Item) => void;
diff --git a/packages/design-system/src/components/primitives/numeric-gesture-control.ts b/packages/design-system/src/components/primitives/numeric-gesture-control.ts
index fa4e475193..e3bf5655f9 100644
--- a/packages/design-system/src/components/primitives/numeric-gesture-control.ts
+++ b/packages/design-system/src/components/primitives/numeric-gesture-control.ts
@@ -72,7 +72,7 @@ export const numericGestureControl = (
const handleEvent = (event: PointerEvent) => {
const { type, clientX, clientY, movementY, movementX } = event;
const offset = direction === "horizontal" ? clientX : clientY;
- let movement = direction === "horizontal" ? movementX : -movementY;
+ const movement = direction === "horizontal" ? movementX : -movementY;
switch (type) {
case "pointerup": {
state.offset = 0;