mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
This commit is contained in:
parent
f7ce5f024d
commit
7cdcebf03c
11 changed files with 367 additions and 233 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue