diff --git a/DEV_CHANGELOG.txt b/DEV_CHANGELOG.txt index 030981f..e231f77 100644 --- a/DEV_CHANGELOG.txt +++ b/DEV_CHANGELOG.txt @@ -5,3 +5,9 @@ types 모듈이 삭제되며 init.lua 에 통합됨 이제 extend 에 대해서 Init(self) self 안에 props 기능이 내장되어있음 TODO: slot 기능 구현 + +TODO: spring 구현 + +TODO: !ChildRemoved 구현 + +TODO: AdvancedTween 을 submodule 로 변경 diff --git a/mock/Slot.txt b/mock/Slot.txt new file mode 100644 index 0000000..dfc28d7 --- /dev/null +++ b/mock/Slot.txt @@ -0,0 +1,22 @@ + +Window { + Class.Slot "Content" { + Text { + Text = "wow"; + }; + Text { + Text = "wow"; + }; + Text { + Text = "wow"; + }; + Text { + Text = "wow"; + }; + } + TopbarButton { + [Class.Slot] = "Topbar"; + }; +} +다수가 있을경우 +이런식으로 묶을 수 있다고 하자 diff --git a/src/class.lua b/src/class.lua index a3ff83b..1069632 100644 --- a/src/class.lua +++ b/src/class.lua @@ -110,8 +110,13 @@ function module.init(shared) new.SetProperty = SetProperty local function Link(linker,item,index,indexType) - local target = linker.target - local name = linker.name + -- error("Not implemented") + + local target = linker.lvalue + local name = linker.key + + -- local target = linker.target + -- local name = linker.name if indexType == "number" then -- set -- if rawget(target,name) ~= nil then @@ -140,7 +145,7 @@ function module.init(shared) local indexType = typeof(index) local quadType = valueType == "table" and PcallGetProperty(value,"__type") - if quadType == "quad_linker" then + if indexType == "number" and quadType == "quad_register" then -- linking Link(value,item,index,indexType) elseif indexType == "string" and quadType == "quad_register" then @@ -162,7 +167,8 @@ function module.init(shared) local setValue,tween = value:CalcWithNewValue(item,newValue,key) if tween then if not advancedTween then - return warn "[QUAD] module 'AdvancedTween' needs to be loaded for tween properties but it is not found on 'src.libs'. you should adding that to src.libs directory" + warn "[QUAD] Failed to execute register handler function. (Real Instance was not updated)" + return warn "[QUAD] module 'AdvancedTween' needs to be loaded for tween properties but it is not found on 'src.libs'. you should adding that to src.libs directory.\nPossible reason : Cloned repository without recursive option. => 'git submodule init ; git submodule update' to get submodules" end -- local ended, onStepped -- if tween.Ended then @@ -349,13 +355,13 @@ function module.init(shared) end }) - local function Linker(target,name) - return { - __type = "quad_linker"; - target = target; - name = name; - } - end + -- local function Linker(target,name) + -- return { + -- __type = "quad_linker"; + -- target = target; + -- name = name; + -- } + -- end -- make class function new.Extend() @@ -400,8 +406,12 @@ function module.init(shared) return self end - function this:Default(...) - return this.__prop:Default(...) + -- default function from props + function this:Default(key,value) + if self == this then + error("prop handler not found (this method cannot be used on class)") + end + self.__prop:Default(key,value) end function this:GetPropertyChangedSignal(propertyName) @@ -436,11 +446,18 @@ function module.init(shared) thisSignal:Fire(value) end - function this:GetChildren() - local children = rawget(self,"__child") - if not children then - return {} + function this:GetChildren(slotName) + if slotName then + local slot = rawget(slotName,"__slot") + if not slot then return {} end + local newSlot = {} + for _,v in pairs(slot) do + insert(newSlot,v) + end + return slot end + local children = rawget(self,"__child") + if not children then return {} end local newChildren = {} for _,v in pairs(children) do insert(newChildren,v) @@ -504,7 +521,6 @@ function module.init(shared) end end end - self = nil end --- link to new @@ -517,7 +533,10 @@ function module.init(shared) if type(name) ~= "string" then error(("Name must be string, but got %s"):format(type(name))) end - return Linker(self,name) + -- return Linker(self,name) + local register = self.__props(name) + register:Link(self) + return register end -- indexer (getter) diff --git a/src/store.lua b/src/store.lua index bf7101c..be9d58f 100644 --- a/src/store.lua +++ b/src/store.lua @@ -283,6 +283,9 @@ function module.init(shared) -- return s return setmetatable({avalue = avalue},{__index = s}) end; + Link = function(s,lvalue) + return setmetatable({avalue = lvalue},{__index = s}) + end; -- return init data CalcWithDefault = function (s,withItem) local with = s.wfunc