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.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
better naming, better type inference for timeout prop
Sultanb180d9c1fcbd
diff --git a/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx b/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsxindex 77f45a8f8a..3f57594587 100644--- a/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx+++ b/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx@@ -86,7 +86,7 @@ const useScrub = ({onChangeComplete: (value: StyleValue) => void;}): [React.MutableRefObject<HTMLInputElement | null>, boolean] => {const inputRef = useRef<HTMLInputElement | null>(null);- const [inputActiveState, setInputActiveState] = useState(false);+ const [isInputActive, setIsInputActive] = useState(false);const onChangeRef = useRef(onChange);const onChangeCompleteRef = useRef(onChangeComplete);const valueRef = useRef(value);@@ -112,7 +112,7 @@ const useScrub = ({unit,value: event.value,});- setInputActiveState(true);+ setIsInputActive(true);inputRef.current?.blur();},onValueChange(event) {@@ -121,7 +121,7 @@ const useScrub = ({unit,value: event.value,});- setInputActiveState(false);+ setIsInputActive(false);inputRef.current?.focus();inputRef.current?.select();},@@ -130,7 +130,7 @@ const useScrub = ({return scrub.disconnectedCallback;}, [type, unit]);- return [inputRef, inputActiveState];+ return [inputRef, isInputActive];};const useHandleKeyDown =@@ -249,7 +249,7 @@ export const CssValueInput = ({},});- const [inputRef, inputActiveState] = useScrub({+ const [inputRef, isInputActive] = useScrub({value,onChange,onChangeComplete,@@ -299,7 +299,7 @@ export const CssValueInput = ({state={value.type === "invalid"? "invalid"- : inputActiveState+ : isInputActive? "active": undefined}diff --git a/packages/design-system/src/components/primitives/numeric-gesture-control.ts b/packages/design-system/src/components/primitives/numeric-gesture-control.tsindex 3eba276420..14f8d42235 100644--- a/packages/design-system/src/components/primitives/numeric-gesture-control.ts+++ b/packages/design-system/src/components/primitives/numeric-gesture-control.ts@@ -39,7 +39,7 @@ type NumericScrubState = {offset: number;velocity: number;direction: string;- timeout: unknown;+ timeout?: ReturnType<typeof window.setTimeout>;};export const numericScrubControl = (@@ -60,7 +60,7 @@ export const numericScrubControl = (offset: 0,velocity: direction === "horizontal" ? 1 : -1,direction: direction,- timeout: 0,+ timeout: undefined,};const handleEvent = (event: PointerEvent) => {const { type, clientX, clientY, movementY, movementX } = event;@@ -71,7 +71,7 @@ export const numericScrubControl = (const shouldComponentUpdate = Boolean(state.cursor);state.offset = 0;targetNode.removeEventListener("pointermove", handleEvent);- clearTimeout(state.timeout as number);+ clearTimeout(state.timeout);exitPointerLock(state, event, targetNode);if (shouldComponentUpdate)onValueChange?.({