This commit is contained in:
Aaron Smith 2023-08-02 16:12:05 +01:00
parent f7ce5f024d
commit 7cdcebf03c
11 changed files with 367 additions and 233 deletions

View file

@ -1,72 +1,43 @@
local vide = require "src/init"
local wrap = vide.wrap
local source = vide.source
local derive = vide.derive
local map = vide.map
local create = vide.create
local unwrap = vide.unwrap
local Event = vide.Event
local Layout = vide.Layout
do
local count = wrap(0)
local count2 = derive(function(from)
local c = from(count) * unwrap(count)
return c ^ 2
end)
local x = count2.value
local count2b = count + 1
local xb = unwrap(count2b)
end
local count = wrap(0)
local v = count.value
do
local t = map(1, function(i)
return ""
end)
local t = map({ true }, function(i, v)
return 1
end)
local data = wrap { "" }
local t = map(data, function(i, v)
return 1
end)
end
create("Frame") {
type Action<T> = {
type: T,
priority: number,
callback: (Instance) -> ()
}
local Value, Computed, peek, OnEvent = nil :: any, nil :: any, nil :: any, nil :: any
local New = nil :: any
local function processor(priority: number, fn: (Instance) -> ()): Action<any>
local function Counter(props)
local count, set = wrap(0)
return create("TextLabel") {
Text = "Count: " .. count,
[Layout] = props[Layout],
[Event.Activated] = function()
set(count + 1)
end
}
end
local function Frame(props)
return create("Frame") {
Position = props.Position
}
local function Changed(property: string, callback: () -> ())
return processor(1, function(instance)
instance:GetPropertyChangedSignal(property):Connect(callback)
end) :: Action<"Changed">
end
Frame { Position = UDim2.fromScale(0.5, 0.5) }
local function Cleanup(t: {})
Frame { Position = positionState }
end
function TextInput(p: {
OnInput: Action<"Changed">
})
create "TextBox" {
Text = "test",
Changed("Text", function()
end),
Cleanup {
},
create("Frame") {}
}
end