switch to pretty-roact-hooks

This commit is contained in:
Reid 2023-08-20 20:03:30 -07:00
parent 057efc9a8c
commit 079af9709f
4 changed files with 25 additions and 20 deletions

View file

@ -38,11 +38,11 @@
"@rbxts/make": "^1.0.6", "@rbxts/make": "^1.0.6",
"@rbxts/matter": "^0.6.2-ts.6", "@rbxts/matter": "^0.6.2-ts.6",
"@rbxts/plasma": "^0.4.1-ts.1", "@rbxts/plasma": "^0.4.1-ts.1",
"@rbxts/pretty-roact-hooks": "^3.1.1",
"@rbxts/reflex": "^4.2.0", "@rbxts/reflex": "^4.2.0",
"@rbxts/rewire": "^0.3.0", "@rbxts/rewire": "^0.3.0",
"@rbxts/roact": "^1.4.4-ts.0", "@rbxts/roact": "^1.4.4-ts.0",
"@rbxts/roact-hooked": "^2.6.0", "@rbxts/roact-hooked": "^2.6.0",
"@rbxts/roact-hooked-plus": "^1.8.1",
"@rbxts/roact-reflex": "^2.1.0", "@rbxts/roact-reflex": "^2.1.0",
"@rbxts/services": "^1.5.1", "@rbxts/services": "^1.5.1",
"@rbxts/testez": "^0.4.2-ts.0", "@rbxts/testez": "^0.4.2-ts.0",

View file

@ -1,10 +1,10 @@
import Roact from "@rbxts/roact" import Roact from "@rbxts/roact"
import { ContextActionService, HttpService } from "@rbxts/services" import { ContextActionService, HttpService } from "@rbxts/services"
import { Spring } from "@rbxts/flipper" import { Spring } from "@rbxts/flipper"
import { useGroupMotor } from "@rbxts/roact-hooked-plus"
import { useEffect } from "@rbxts/roact-hooked" import { useEffect } from "@rbxts/roact-hooked"
import Item from "./item" import Item from "./item"
import Surface from "ReplicatedStorage/ui/components/surface" import Surface from "ReplicatedStorage/ui/components/surface"
import { useMotor } from "@rbxts/pretty-roact-hooks"
interface ConfigProps extends Roact.JsxInstanceProperties<Frame> { interface ConfigProps extends Roact.JsxInstanceProperties<Frame> {
shown: boolean shown: boolean
@ -13,8 +13,8 @@ interface ConfigProps extends Roact.JsxInstanceProperties<Frame> {
Change?: Roact.JsxInstanceChangeEvents<Frame> Change?: Roact.JsxInstanceChangeEvents<Frame>
} }
const CONFIG_DEFAULT = [new Spring(1.5, { frequency: 6 })] const CONFIG_DEFAULT = new Spring(1.5, { frequency: 6 })
const CONFIG_ACTIVE = [new Spring(.5, { frequency: 6 })] const CONFIG_ACTIVE = new Spring(.5, { frequency: 6 })
function config(props: ConfigProps): Roact.Element { function config(props: ConfigProps): Roact.Element {
let { shown } = props let { shown } = props
@ -22,8 +22,7 @@ function config(props: ConfigProps): Roact.Element {
const spreadableProps = { ...props } as Partial<ConfigProps> const spreadableProps = { ...props } as Partial<ConfigProps>
delete spreadableProps.shown delete spreadableProps.shown
const [configPosYMap, setConfigGoal] = useGroupMotor([1.5]) const [configPosY, setConfigGoal] = useMotor(1.5)
const configPosY = configPosYMap.map((t) => t[0])
useEffect(() => { useEffect(() => {
const guid = HttpService.GenerateGUID(false) const guid = HttpService.GenerateGUID(false)

View file

@ -5,7 +5,7 @@ import { ContextActionService, HttpService } from "@rbxts/services"
import Text from "ReplicatedStorage/ui/components/text" import Text from "ReplicatedStorage/ui/components/text"
import Surface from "ReplicatedStorage/ui/components/surface" import Surface from "ReplicatedStorage/ui/components/surface"
import { Spring } from "@rbxts/flipper" import { Spring } from "@rbxts/flipper"
import { useGroupMotor } from "@rbxts/roact-hooked-plus" import { useMotor } from "@rbxts/pretty-roact-hooks"
interface SlotProps extends Roact.JsxInstanceProperties<Frame> { interface SlotProps extends Roact.JsxInstanceProperties<Frame> {
index: number index: number
@ -16,8 +16,8 @@ interface SlotProps extends Roact.JsxInstanceProperties<Frame> {
Change?: Roact.JsxInstanceChangeEvents<Frame> Change?: Roact.JsxInstanceChangeEvents<Frame>
} }
const SLOT_DEFAULT = [new Spring(0, { frequency: 6 }), new Spring(6, { frequency: 6 })] const SLOT_DEFAULT = new Spring(6, { frequency: 6 })
const SLOT_ACTIVE = [new Spring(1, { frequency: 6 }), new Spring(5, { frequency: 6 })] const SLOT_ACTIVE = new Spring(5, { frequency: 6 })
function slot(props: SlotProps): Roact.Element { function slot(props: SlotProps): Roact.Element {
const { index, keycode, tool } = props const { index, keycode, tool } = props
@ -27,8 +27,7 @@ function slot(props: SlotProps): Roact.Element {
delete spreadableProps.keycode delete spreadableProps.keycode
delete spreadableProps.tool delete spreadableProps.tool
const [slotBorderColorAndSlotRatio, setSlotGoal] = useGroupMotor([0, 6]) const [slotRatio, setSlotGoal] = useMotor(0)
const slotRatio = slotBorderColorAndSlotRatio.map((t) => t[1])
const { clientState } = useWorldContext() const { clientState } = useWorldContext()

View file

@ -131,6 +131,14 @@
resolved "https://registry.yarnpkg.com/@rbxts/plasma/-/plasma-0.4.1-ts.1.tgz#3d8db367c3220e6b6953cdddbf8af9f087165392" resolved "https://registry.yarnpkg.com/@rbxts/plasma/-/plasma-0.4.1-ts.1.tgz#3d8db367c3220e6b6953cdddbf8af9f087165392"
integrity sha512-RhLkC3GQW0KeyqjFwvOUbHhsIJOHmXg+BhcKLp0IgUDVgC5GktShi3zmW6GQ319yod+RlUDG1XHjOnP3Omo4bA== integrity sha512-RhLkC3GQW0KeyqjFwvOUbHhsIJOHmXg+BhcKLp0IgUDVgC5GktShi3zmW6GQ319yod+RlUDG1XHjOnP3Omo4bA==
"@rbxts/pretty-roact-hooks@^3.1.1":
version "3.1.1"
resolved "https://registry.yarnpkg.com/@rbxts/pretty-roact-hooks/-/pretty-roact-hooks-3.1.1.tgz#b2729163bfd2c89e1efb91c544d7ddb798054fe0"
integrity sha512-eve1L7GWKZVo6ZLgcmk6c95SDvhTRIjWwR8notAz7g+CQ/jdtOoX+5fVHOQLMYE6HbQ79Bth+LO13WOM4T3WKg==
dependencies:
"@rbxts/services" "^1.5.1"
"@rbxts/set-timeout" "^1.1.2"
"@rbxts/reflex@^4.2.0": "@rbxts/reflex@^4.2.0":
version "4.2.0" version "4.2.0"
resolved "https://registry.yarnpkg.com/@rbxts/reflex/-/reflex-4.2.0.tgz#10d064de5e293f1aea429846d4d8739821cb575a" resolved "https://registry.yarnpkg.com/@rbxts/reflex/-/reflex-4.2.0.tgz#10d064de5e293f1aea429846d4d8739821cb575a"
@ -141,14 +149,6 @@
resolved "https://registry.yarnpkg.com/@rbxts/rewire/-/rewire-0.3.0.tgz#47f0cd651fe405cf418936799d2a4dac6b1bb7ce" resolved "https://registry.yarnpkg.com/@rbxts/rewire/-/rewire-0.3.0.tgz#47f0cd651fe405cf418936799d2a4dac6b1bb7ce"
integrity sha512-wChhGZ3kEkEsMK9ZuwKpwRsC7OGVZlvxrYMR3beFgCIPXE58JKLziBLkDACmd709XCCEmsMAqv9HMCMhSTD08Q== integrity sha512-wChhGZ3kEkEsMK9ZuwKpwRsC7OGVZlvxrYMR3beFgCIPXE58JKLziBLkDACmd709XCCEmsMAqv9HMCMhSTD08Q==
"@rbxts/roact-hooked-plus@^1.8.1":
version "1.8.1"
resolved "https://registry.yarnpkg.com/@rbxts/roact-hooked-plus/-/roact-hooked-plus-1.8.1.tgz#e0fa32b74c0f958430ae62f249f1b5b52ce27f3b"
integrity sha512-ipJf6pZcQZlx/0hyisQz2eoRECg38knUgjkEvx2dvAHfs0+IDgera7mcwv6zTMACqalaXu00inc4E5dpOrs54A==
dependencies:
"@rbxts/flipper" "^2.0.1"
"@rbxts/services" "^1.2.0"
"@rbxts/roact-hooked@^2.6.0": "@rbxts/roact-hooked@^2.6.0":
version "2.6.0" version "2.6.0"
resolved "https://registry.yarnpkg.com/@rbxts/roact-hooked/-/roact-hooked-2.6.0.tgz#cbe3e244e1d52d879083c62b6662c4d082c6d30b" resolved "https://registry.yarnpkg.com/@rbxts/roact-hooked/-/roact-hooked-2.6.0.tgz#cbe3e244e1d52d879083c62b6662c4d082c6d30b"
@ -164,11 +164,18 @@
resolved "https://registry.yarnpkg.com/@rbxts/roact/-/roact-1.4.4-ts.0.tgz#7f297bec03dbea9473bd2d82b148d3ae6e4f6c00" resolved "https://registry.yarnpkg.com/@rbxts/roact/-/roact-1.4.4-ts.0.tgz#7f297bec03dbea9473bd2d82b148d3ae6e4f6c00"
integrity sha512-gn9mBoGG/Clzgv2kyOvLNVd9dh5t6z+jukC3ITv2HnfPqvf/sMbz/VMaBoiB7t5umuiIe0LjW0ctZrkrS+uTOA== integrity sha512-gn9mBoGG/Clzgv2kyOvLNVd9dh5t6z+jukC3ITv2HnfPqvf/sMbz/VMaBoiB7t5umuiIe0LjW0ctZrkrS+uTOA==
"@rbxts/services@^1.2.0", "@rbxts/services@^1.5.1": "@rbxts/services@^1.5.1":
version "1.5.1" version "1.5.1"
resolved "https://registry.yarnpkg.com/@rbxts/services/-/services-1.5.1.tgz#4536a87932f28797507ed591f0061277c52ea77f" resolved "https://registry.yarnpkg.com/@rbxts/services/-/services-1.5.1.tgz#4536a87932f28797507ed591f0061277c52ea77f"
integrity sha512-SRtfIjga0K4YYSXRpK+eH3kcTq7ZXo9OHOt0jszaOOoEOIJloMGlyuRPqesPHyhveh2AMXAZr3TYbRMSD+u+kQ== integrity sha512-SRtfIjga0K4YYSXRpK+eH3kcTq7ZXo9OHOt0jszaOOoEOIJloMGlyuRPqesPHyhveh2AMXAZr3TYbRMSD+u+kQ==
"@rbxts/set-timeout@^1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@rbxts/set-timeout/-/set-timeout-1.1.2.tgz#2adc9d4b5dcb54ca4332eb7ec8d19793932dbd40"
integrity sha512-P/A0IiH9wuZdSJYr4Us0MDFm61nvIFR0acfKFHLkcOsgvIgELC90Up9ugiSsaMEHRIcIcO5UjE39LuS3xTzQHw==
dependencies:
"@rbxts/services" "^1.5.1"
"@rbxts/testez@^0.4.2-ts.0": "@rbxts/testez@^0.4.2-ts.0":
version "0.4.2-ts.0" version "0.4.2-ts.0"
resolved "https://registry.yarnpkg.com/@rbxts/testez/-/testez-0.4.2-ts.0.tgz#4475183d317182ac7099bffee6492ffcb7bcaf0b" resolved "https://registry.yarnpkg.com/@rbxts/testez/-/testez-0.4.2-ts.0.tgz#4475183d317182ac7099bffee6492ffcb7bcaf0b"