comment: remove unused codes, fixing types

This commit is contained in:
Qwreey 2023-01-02 05:04:47 +09:00
parent 458477d7c8
commit 18538f0bbe
8 changed files with 48 additions and 92 deletions

View file

@ -51,3 +51,5 @@ function myButton:render(props)
end
myButton.updateTriggers.style = true;
return myButton

View file

@ -1,29 +1,20 @@
local module = {};
-- 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;
-- };
local pack = table.pack;
function module.init(shared)
local new = {};
---@class quad_module_class
local new = {__type = "quad_module_class"};
local InstanceNew = Instance.new;
local event = shared.event; ---@module "src.event"
local event = shared.event; ---@type quad_module_event
local bind = event.bind;
local store = shared.store; ---@module "src.store"
local store = shared.store; ---@type quad_module_store
local addObject = store.addObject;
local storeNew = store.new;
local mount = shared.mount; ---@module "src.mount"
local mount = shared.mount; ---@type quad_module_mount
local getHolder = mount.getHolder;
local mountf = mount.mount;
local advancedTween = shared.tween; ---@module "src.libs.AdvancedTween"
local round = shared.round; ---@module "src.libs.round"
local mountfunc = mount.mount;
local advancedTween = shared.tween; ---@type quad_module_tween
local round = shared.round; ---@type quad_module_round
local function InstanceNewWithName(classname,parent,name)
local item = InstanceNew(classname,parent);
@ -94,7 +85,6 @@ function module.init(shared)
end
-- make object that from instance, class and more
local pack = table.pack;
function new.make(ClassName,...) -- render object
-- make thing
local item;
@ -124,7 +114,7 @@ function module.init(shared)
item = func(parsed);
local holder = getHolder(item);
for _,v in ipairs(childs) do
mountf(item,v,holder);
mountfunc(item,v,holder);
end
for i,v in pairs(binds) do
bind(item,i,v);
@ -221,7 +211,7 @@ function module.init(shared)
setProperty(item,index,value,ClassName);
elseif indexType == "number" and valueType ~= "boolean" then -- 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
@ -237,6 +227,7 @@ function module.init(shared)
end
local this = defaultProperties or {};
setmetatable(this,{
__type = "quad_imported_class",
__call = function (self,prop,...)
local propType = type(prop);
if propType == "string" then
@ -257,18 +248,6 @@ function module.init(shared)
return this;
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
setmetatable(new,{
__call = function (self,...)
@ -278,7 +257,7 @@ function module.init(shared)
-- make class
function new.extend()
local this = {};
local this = {__type = "quad_extend"};
--- make new object
function this.new(prop)
@ -298,7 +277,7 @@ function module.init(shared)
rawset(self,"__holder",object);
if parent then
rawset(self,"__parent",parent);
mountf(self,parent)
mountfunc(self,parent)
end
-- prevent gc
((type(object) == "table" and object.__object) or object):GetPropertyChangedSignal "ClassName":Connect(function()

View file

@ -1,9 +1,10 @@
local module = {};
local unpack = table.unpack;
local wrap = coroutine.wrap;
function module.init(shared)
local new = {};
local unpack = table.unpack;
local wrap = coroutine.wrap;
---@class quad_module_event
local new = {__type = "quad_module_event"};
local prefix = "Event::";
local special = {
@ -88,7 +89,7 @@ function module.init(shared)
-- roblox connections disconnecter
local insert = table.insert;
local idSpace = {};
local disconnecterClass = {};
local disconnecterClass = {__type = "quad_disconnecter"};
function disconnecterClass:add(connection)
insert(self,connection);
end
@ -109,7 +110,7 @@ function module.init(shared)
end
end
disconnecterClass.__index = disconnecterClass;
function new.new(id)
function new.disconnecter(id)
if id then
local old = idSpace[id];
if old then

View file

@ -1,40 +1,17 @@
---@class quad
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 event = require "event"; ---@module "src.event"
local store = require "store"; ---@module "src.store"
local class = require "class"; ---@module "src.class"
local mount = require "mount"; ---@module "src.mount"
local _,advancedTween = pcall(require,"libs.AdvancedTween"); ---@module "src.libs.AdvancedTween"
local _,round = pcall(require,"libs.round"); ---@module "src.libs.round"
local event = require "event";
local store = require "store";
local class = require "class";
local mount = require "mount";
local _,advancedTween = pcall(require,"libs.AdvancedTween");
local _,round = pcall(require,"libs.round");
local idSpace = {};
---@return quadexport this
---@return quad_export this
---@return quad_module_round round
---@return quad_module_tween tween
function module.init(id)
@ -45,18 +22,16 @@ function module.init(id)
end
end
---@class quadexport
local this = {items = {}};
---@class quad_export
local this = {__type = "quad_module_init",items = {}};
this.require = require;
this.round = type(round) == "table" and round; ---@type quad_module_round
this.tween = type(advancedTween) == "table" and advancedTween; ---@type quad_module_tween
this.event = event.init(this);
this.store = store.init(this);
this.mount = mount.init(this);
this.class = class.init(this);
--this.plugin = plugin;
this.event = event.init(this); ---@type quad_module_event
this.store = store.init(this); ---@type quad_module_store
this.mount = mount.init(this); ---@type quad_module_mount
this.class = class.init(this); ---@type quad_module_class
if id then
idSpace[id] = this;

View file

@ -1,10 +1,12 @@
local module = {};
local insert = table.insert;
local pack = table.pack;
function module.init(shared)
local new = {};
local insert = table.insert;
---@class quad_module_mount
local new = {__type = "quad_module_mount"};
local mountClass = {};
local mountClass = {__type = "quad_mount"};
mountClass.__index = mountClass;
function mountClass:unmount()
local this = self.this
@ -64,8 +66,7 @@ function module.init(shared)
end
local mount = new.mount;
local pack = table.pack;
local mountsClass = {};
local mountsClass = {__type = "quad_mounts"};
mountsClass.__index = mountsClass;
function mountsClass:unmount()
for _,v in ipairs(self) do

View file

@ -18,11 +18,12 @@ end
local week = {__mode = "v"};
function module.init(shared)
local new = {};
---@class quad_module_store
local new = {__type = "quad_module_store"};
local items = shared.items;
-- id space (array of object)
local objSpaceClass = {};
local objSpaceClass = {__type = "quad_objspace"};
function objSpaceClass:each(func)
for i,v in ipairs(self) do
wrap(catch)(func,i,v);
@ -85,6 +86,7 @@ function module.init(shared)
end
local registerClass = {
__type = "quad_register";
register = function (s,efunc)
local self = s.store;
local events = self.__evt;
@ -109,7 +111,7 @@ function module.init(shared)
end;
---@deprecated
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});
end;
add = function (s,value)
@ -119,7 +121,7 @@ function module.init(shared)
registerClass.__index = registerClass;
-- bindable store object
local store = {};
local store = {__type = "quad_store"};
local storeIdSpace = {};
function store:__index(key)
local this = self.__self[key];

View file

@ -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;