comment: remove unused codes, fixing types
This commit is contained in:
parent
458477d7c8
commit
18538f0bbe
8 changed files with 48 additions and 92 deletions
|
|
@ -51,3 +51,5 @@ function myButton:render(props)
|
||||||
end
|
end
|
||||||
|
|
||||||
myButton.updateTriggers.style = true;
|
myButton.updateTriggers.style = true;
|
||||||
|
|
||||||
|
return myButton
|
||||||
|
|
@ -64,4 +64,4 @@ do local this = store.getObject("testFrame");
|
||||||
end
|
end
|
||||||
|
|
||||||
app.unmount(); -- 트리의 객체들을 모두 파기한다, 플러그인에서 unload 같은곳에 쓰는 함수
|
app.unmount(); -- 트리의 객체들을 모두 파기한다, 플러그인에서 unload 같은곳에 쓰는 함수
|
||||||
return app;
|
return app;
|
||||||
|
|
@ -1,29 +1,20 @@
|
||||||
local module = {};
|
local module = {};
|
||||||
|
local pack = table.pack;
|
||||||
-- local exportItemMeta = {
|
|
||||||
-- __index = function (self,key)
|
|
||||||
-- local methods = self.__methods;
|
|
||||||
-- local events = self.__events;
|
|
||||||
-- return (methods and methods[key]) or (events and events[key]) or (self.getters[key](self.__this));
|
|
||||||
-- end;
|
|
||||||
-- __newindex = function (self,key,value)
|
|
||||||
-- self.__setters[key](self.__this,value);
|
|
||||||
-- end;
|
|
||||||
-- };
|
|
||||||
|
|
||||||
function module.init(shared)
|
function module.init(shared)
|
||||||
local new = {};
|
---@class quad_module_class
|
||||||
|
local new = {__type = "quad_module_class"};
|
||||||
local InstanceNew = Instance.new;
|
local InstanceNew = Instance.new;
|
||||||
local event = shared.event; ---@module "src.event"
|
local event = shared.event; ---@type quad_module_event
|
||||||
local bind = event.bind;
|
local bind = event.bind;
|
||||||
local store = shared.store; ---@module "src.store"
|
local store = shared.store; ---@type quad_module_store
|
||||||
local addObject = store.addObject;
|
local addObject = store.addObject;
|
||||||
local storeNew = store.new;
|
local storeNew = store.new;
|
||||||
local mount = shared.mount; ---@module "src.mount"
|
local mount = shared.mount; ---@type quad_module_mount
|
||||||
local getHolder = mount.getHolder;
|
local getHolder = mount.getHolder;
|
||||||
local mountf = mount.mount;
|
local mountfunc = mount.mount;
|
||||||
local advancedTween = shared.tween; ---@module "src.libs.AdvancedTween"
|
local advancedTween = shared.tween; ---@type quad_module_tween
|
||||||
local round = shared.round; ---@module "src.libs.round"
|
local round = shared.round; ---@type quad_module_round
|
||||||
|
|
||||||
local function InstanceNewWithName(classname,parent,name)
|
local function InstanceNewWithName(classname,parent,name)
|
||||||
local item = InstanceNew(classname,parent);
|
local item = InstanceNew(classname,parent);
|
||||||
|
|
@ -94,7 +85,6 @@ function module.init(shared)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- make object that from instance, class and more
|
-- make object that from instance, class and more
|
||||||
local pack = table.pack;
|
|
||||||
function new.make(ClassName,...) -- render object
|
function new.make(ClassName,...) -- render object
|
||||||
-- make thing
|
-- make thing
|
||||||
local item;
|
local item;
|
||||||
|
|
@ -124,7 +114,7 @@ function module.init(shared)
|
||||||
item = func(parsed);
|
item = func(parsed);
|
||||||
local holder = getHolder(item);
|
local holder = getHolder(item);
|
||||||
for _,v in ipairs(childs) do
|
for _,v in ipairs(childs) do
|
||||||
mountf(item,v,holder);
|
mountfunc(item,v,holder);
|
||||||
end
|
end
|
||||||
for i,v in pairs(binds) do
|
for i,v in pairs(binds) do
|
||||||
bind(item,i,v);
|
bind(item,i,v);
|
||||||
|
|
@ -221,7 +211,7 @@ function module.init(shared)
|
||||||
setProperty(item,index,value,ClassName);
|
setProperty(item,index,value,ClassName);
|
||||||
elseif indexType == "number" and valueType ~= "boolean" then -- object
|
elseif indexType == "number" and valueType ~= "boolean" then -- object
|
||||||
-- child object
|
-- child object
|
||||||
mountf(item,((iprop == 1) and value or value:Clone()),holder);
|
mountfunc(item,((iprop == 1) and value or value:Clone()),holder);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -237,6 +227,7 @@ function module.init(shared)
|
||||||
end
|
end
|
||||||
local this = defaultProperties or {};
|
local this = defaultProperties or {};
|
||||||
setmetatable(this,{
|
setmetatable(this,{
|
||||||
|
__type = "quad_imported_class",
|
||||||
__call = function (self,prop,...)
|
__call = function (self,prop,...)
|
||||||
local propType = type(prop);
|
local propType = type(prop);
|
||||||
if propType == "string" then
|
if propType == "string" then
|
||||||
|
|
@ -257,18 +248,6 @@ function module.init(shared)
|
||||||
return this;
|
return this;
|
||||||
end
|
end
|
||||||
|
|
||||||
-- function new.export(newFn,setters,getters,methods,events) -- make quad importable class
|
|
||||||
-- return function ()
|
|
||||||
-- return setmetatable({
|
|
||||||
-- __this = newFn();
|
|
||||||
-- __setters = setters;
|
|
||||||
-- __getters = getters;
|
|
||||||
-- __methods = methods;
|
|
||||||
-- __events = events;
|
|
||||||
-- },exportItemMeta);
|
|
||||||
-- end;
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- set module calling function
|
-- set module calling function
|
||||||
setmetatable(new,{
|
setmetatable(new,{
|
||||||
__call = function (self,...)
|
__call = function (self,...)
|
||||||
|
|
@ -278,7 +257,7 @@ function module.init(shared)
|
||||||
|
|
||||||
-- make class
|
-- make class
|
||||||
function new.extend()
|
function new.extend()
|
||||||
local this = {};
|
local this = {__type = "quad_extend"};
|
||||||
|
|
||||||
--- make new object
|
--- make new object
|
||||||
function this.new(prop)
|
function this.new(prop)
|
||||||
|
|
@ -298,7 +277,7 @@ function module.init(shared)
|
||||||
rawset(self,"__holder",object);
|
rawset(self,"__holder",object);
|
||||||
if parent then
|
if parent then
|
||||||
rawset(self,"__parent",parent);
|
rawset(self,"__parent",parent);
|
||||||
mountf(self,parent)
|
mountfunc(self,parent)
|
||||||
end
|
end
|
||||||
-- prevent gc
|
-- prevent gc
|
||||||
((type(object) == "table" and object.__object) or object):GetPropertyChangedSignal "ClassName":Connect(function()
|
((type(object) == "table" and object.__object) or object):GetPropertyChangedSignal "ClassName":Connect(function()
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
local module = {};
|
local module = {};
|
||||||
|
local unpack = table.unpack;
|
||||||
|
local wrap = coroutine.wrap;
|
||||||
|
|
||||||
function module.init(shared)
|
function module.init(shared)
|
||||||
local new = {};
|
---@class quad_module_event
|
||||||
local unpack = table.unpack;
|
local new = {__type = "quad_module_event"};
|
||||||
local wrap = coroutine.wrap;
|
|
||||||
|
|
||||||
local prefix = "Event::";
|
local prefix = "Event::";
|
||||||
local special = {
|
local special = {
|
||||||
|
|
@ -88,7 +89,7 @@ function module.init(shared)
|
||||||
-- roblox connections disconnecter
|
-- roblox connections disconnecter
|
||||||
local insert = table.insert;
|
local insert = table.insert;
|
||||||
local idSpace = {};
|
local idSpace = {};
|
||||||
local disconnecterClass = {};
|
local disconnecterClass = {__type = "quad_disconnecter"};
|
||||||
function disconnecterClass:add(connection)
|
function disconnecterClass:add(connection)
|
||||||
insert(self,connection);
|
insert(self,connection);
|
||||||
end
|
end
|
||||||
|
|
@ -109,7 +110,7 @@ function module.init(shared)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
disconnecterClass.__index = disconnecterClass;
|
disconnecterClass.__index = disconnecterClass;
|
||||||
function new.new(id)
|
function new.disconnecter(id)
|
||||||
if id then
|
if id then
|
||||||
local old = idSpace[id];
|
local old = idSpace[id];
|
||||||
if old then
|
if old then
|
||||||
|
|
|
||||||
51
src/init.lua
51
src/init.lua
|
|
@ -1,40 +1,17 @@
|
||||||
---@class quad
|
---@class quad
|
||||||
local module = {};
|
local module = {};
|
||||||
|
|
||||||
-- TODO : style should be can edited with anytimes, and the object's styles can be changed (add, remove ...)
|
|
||||||
-- and also, styles can be affect by the objects sorts
|
|
||||||
--[[
|
|
||||||
this feature should be like :
|
|
||||||
|
|
||||||
local style_all = style {
|
|
||||||
BackgroundTransparency = 0.2;
|
|
||||||
}
|
|
||||||
|
|
||||||
frame{
|
|
||||||
Size = UDim2.new(1,0,1,0);
|
|
||||||
textBox "#Input" {
|
|
||||||
[event.property "Text"] = function (this,text)
|
|
||||||
print(this,"의 글자가",text,"로 변경됨");
|
|
||||||
end;
|
|
||||||
};
|
|
||||||
[style.set] = {
|
|
||||||
style_all
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
]]
|
|
||||||
|
|
||||||
local require = require(script.require);
|
local require = require(script.require);
|
||||||
local event = require "event"; ---@module "src.event"
|
local event = require "event";
|
||||||
local store = require "store"; ---@module "src.store"
|
local store = require "store";
|
||||||
local class = require "class"; ---@module "src.class"
|
local class = require "class";
|
||||||
local mount = require "mount"; ---@module "src.mount"
|
local mount = require "mount";
|
||||||
local _,advancedTween = pcall(require,"libs.AdvancedTween"); ---@module "src.libs.AdvancedTween"
|
local _,advancedTween = pcall(require,"libs.AdvancedTween");
|
||||||
local _,round = pcall(require,"libs.round"); ---@module "src.libs.round"
|
local _,round = pcall(require,"libs.round");
|
||||||
|
|
||||||
local idSpace = {};
|
local idSpace = {};
|
||||||
|
|
||||||
---@return quadexport this
|
---@return quad_export this
|
||||||
---@return quad_module_round round
|
---@return quad_module_round round
|
||||||
---@return quad_module_tween tween
|
---@return quad_module_tween tween
|
||||||
function module.init(id)
|
function module.init(id)
|
||||||
|
|
@ -45,18 +22,16 @@ function module.init(id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---@class quadexport
|
---@class quad_export
|
||||||
local this = {items = {}};
|
local this = {__type = "quad_module_init",items = {}};
|
||||||
|
|
||||||
this.require = require;
|
this.require = require;
|
||||||
this.round = type(round) == "table" and round; ---@type quad_module_round
|
this.round = type(round) == "table" and round; ---@type quad_module_round
|
||||||
this.tween = type(advancedTween) == "table" and advancedTween; ---@type quad_module_tween
|
this.tween = type(advancedTween) == "table" and advancedTween; ---@type quad_module_tween
|
||||||
this.event = event.init(this);
|
this.event = event.init(this); ---@type quad_module_event
|
||||||
this.store = store.init(this);
|
this.store = store.init(this); ---@type quad_module_store
|
||||||
this.mount = mount.init(this);
|
this.mount = mount.init(this); ---@type quad_module_mount
|
||||||
this.class = class.init(this);
|
this.class = class.init(this); ---@type quad_module_class
|
||||||
|
|
||||||
--this.plugin = plugin;
|
|
||||||
|
|
||||||
if id then
|
if id then
|
||||||
idSpace[id] = this;
|
idSpace[id] = this;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
local module = {};
|
local module = {};
|
||||||
|
local insert = table.insert;
|
||||||
|
local pack = table.pack;
|
||||||
|
|
||||||
function module.init(shared)
|
function module.init(shared)
|
||||||
local new = {};
|
---@class quad_module_mount
|
||||||
local insert = table.insert;
|
local new = {__type = "quad_module_mount"};
|
||||||
|
|
||||||
local mountClass = {};
|
local mountClass = {__type = "quad_mount"};
|
||||||
mountClass.__index = mountClass;
|
mountClass.__index = mountClass;
|
||||||
function mountClass:unmount()
|
function mountClass:unmount()
|
||||||
local this = self.this
|
local this = self.this
|
||||||
|
|
@ -64,8 +66,7 @@ function module.init(shared)
|
||||||
end
|
end
|
||||||
local mount = new.mount;
|
local mount = new.mount;
|
||||||
|
|
||||||
local pack = table.pack;
|
local mountsClass = {__type = "quad_mounts"};
|
||||||
local mountsClass = {};
|
|
||||||
mountsClass.__index = mountsClass;
|
mountsClass.__index = mountsClass;
|
||||||
function mountsClass:unmount()
|
function mountsClass:unmount()
|
||||||
for _,v in ipairs(self) do
|
for _,v in ipairs(self) do
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,12 @@ end
|
||||||
|
|
||||||
local week = {__mode = "v"};
|
local week = {__mode = "v"};
|
||||||
function module.init(shared)
|
function module.init(shared)
|
||||||
local new = {};
|
---@class quad_module_store
|
||||||
|
local new = {__type = "quad_module_store"};
|
||||||
local items = shared.items;
|
local items = shared.items;
|
||||||
|
|
||||||
-- id space (array of object)
|
-- id space (array of object)
|
||||||
local objSpaceClass = {};
|
local objSpaceClass = {__type = "quad_objspace"};
|
||||||
function objSpaceClass:each(func)
|
function objSpaceClass:each(func)
|
||||||
for i,v in ipairs(self) do
|
for i,v in ipairs(self) do
|
||||||
wrap(catch)(func,i,v);
|
wrap(catch)(func,i,v);
|
||||||
|
|
@ -85,6 +86,7 @@ function module.init(shared)
|
||||||
end
|
end
|
||||||
|
|
||||||
local registerClass = {
|
local registerClass = {
|
||||||
|
__type = "quad_register";
|
||||||
register = function (s,efunc)
|
register = function (s,efunc)
|
||||||
local self = s.store;
|
local self = s.store;
|
||||||
local events = self.__evt;
|
local events = self.__evt;
|
||||||
|
|
@ -109,7 +111,7 @@ function module.init(shared)
|
||||||
end;
|
end;
|
||||||
---@deprecated
|
---@deprecated
|
||||||
from = function (s,value)
|
from = function (s,value)
|
||||||
warn "[QUAD] register:from() is deprecated. You can use register:add(t:table|function) instead"
|
warn "[QUAD] register:from() is deprecated. You can use register:add(t:table|function) instead";
|
||||||
return setmetatable({fvalue = value},{__index = s});
|
return setmetatable({fvalue = value},{__index = s});
|
||||||
end;
|
end;
|
||||||
add = function (s,value)
|
add = function (s,value)
|
||||||
|
|
@ -119,7 +121,7 @@ function module.init(shared)
|
||||||
registerClass.__index = registerClass;
|
registerClass.__index = registerClass;
|
||||||
|
|
||||||
-- bindable store object
|
-- bindable store object
|
||||||
local store = {};
|
local store = {__type = "quad_store"};
|
||||||
local storeIdSpace = {};
|
local storeIdSpace = {};
|
||||||
function store:__index(key)
|
function store:__index(key)
|
||||||
local this = self.__self[key];
|
local this = self.__self[key];
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
local Quad = require(game.ReplicatedStorage:WaitForChild "Quad"); ---@module "src"
|
|
||||||
local _ = Quad.init(); local class,mount,store,event,tween = _.class,_.mount,_.store,_.event,_.tween;
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in a new issue