mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
parent
7deae9c9f6
commit
19eaeb424f
4 changed files with 33 additions and 74 deletions
|
|
@ -1,52 +1,8 @@
|
|||
type Pseudo = {
|
||||
Test: number
|
||||
}
|
||||
|
||||
type Instances = {
|
||||
TextLabel: TextLabel,
|
||||
TextButton: TextButton,
|
||||
ImageLabel: ImageLabel,
|
||||
Pseudo: Pseudo
|
||||
}
|
||||
|
||||
type function Properties(instance: type?)
|
||||
local properties = types.newtable()
|
||||
|
||||
while instance do
|
||||
for i, v in instance:properties() do
|
||||
local connector = v.read and v.read.tag == "table" and v.read:readproperty(types.singleton("Connect"))
|
||||
if connector then
|
||||
if not connector then continue end
|
||||
local params = connector:parameters().head
|
||||
if not params then continue end
|
||||
local listener = params[2]
|
||||
if not listener then continue end
|
||||
properties:setproperty(i, types.optional(listener))
|
||||
elseif v.write then
|
||||
properties:setproperty(i, types.optional(types.unionof(
|
||||
v.write,
|
||||
types.newfunction({}, { head = { v.write } })
|
||||
)))
|
||||
end
|
||||
end
|
||||
|
||||
instance = instance:readparent()
|
||||
end
|
||||
|
||||
properties:setindexer(types.number, types.any)
|
||||
|
||||
return properties
|
||||
end
|
||||
|
||||
local function create<Name>(name: Name | keyof<Instances>): (Properties<index<Instances, Name>>) -> index<Instances, Name>
|
||||
return function()
|
||||
return "" :: any
|
||||
end
|
||||
end
|
||||
|
||||
local vide = require "../src/"
|
||||
|
||||
local count = vide.source(0)
|
||||
create("TextButton") { -- todo: why is `:: "TextButton"` not necessary?
|
||||
|
||||
vide.create("TextButton") {
|
||||
BackgroundTransparency = 1,
|
||||
AnchorPoint = "bad value", -- should error
|
||||
InvalidProperty = true, -- should error
|
||||
|
|
@ -65,6 +21,7 @@ create("TextButton") { -- todo: why is `:: "TextButton"` not necessary?
|
|||
|
||||
Activated = "bad value", -- should error
|
||||
|
||||
create "TextLabel" {},
|
||||
vide.create "TextLabel" {},
|
||||
|
||||
function() end,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue