Skip to content

Commit

Permalink
Move components to extended. Make stubs for ready to make it requirable
Browse files Browse the repository at this point in the history
  • Loading branch information
Insality committed Sep 21, 2020
1 parent 04c39f1 commit 23e2846
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 44 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions druid/helper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,13 @@ function M.get_border(node)
)
end


-- Show message to require extended component
function M.extended_component(component_name)
print(string.format("[Druid]: The component %s is extended component. You have to register it via druid.register to use it", component_name))
print("[Druid]: Use next code:")
print(string.format('local %s = require("druid.extended.%s")', component_name, component_name))
print(string.format('druid.register("%s", %s)', component_name, component_name))
end

return M
94 changes: 51 additions & 43 deletions druid/system/druid_instance.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,29 @@
-- @see druid.drag

local const = require("druid.const")
local helper = require("druid.helper")
local druid_input = require("druid.helper.druid_input")
local settings = require("druid.system.settings")
local class = require("druid.system.middleclass")

local button = require("druid.base.button")
local blocker = require("druid.base.blocker")
local back_handler = require("druid.base.back_handler")
local blocker = require("druid.base.blocker")
local button = require("druid.base.button")
local drag = require("druid.base.drag")
local grid = require("druid.base.grid")
local hover = require("druid.base.hover")
local text = require("druid.base.text")
local lang_text = require("druid.base.lang_text")
local timer = require("druid.base.timer")
local progress = require("druid.base.progress")
local grid = require("druid.base.grid")
local scroll = require("druid.base.scroll")
local slider = require("druid.base.slider")
local checkbox = require("druid.base.checkbox")
local checkbox_group = require("druid.base.checkbox_group")
local radio_group = require("druid.base.radio_group")
local input = require("druid.base.input")
local swipe = require("druid.base.swipe")
local drag = require("druid.base.drag")
-- local infinity_scroll = require("druid.base.infinity_scroll")
local text = require("druid.base.text")

local checkbox = require("druid.extended.checkbox")
local checkbox_group = require("druid.extended.checkbox_group")
local input = require("druid.extended.input")
local progress = require("druid.extended.progress")
local radio_group = require("druid.extended.radio_group")
local slider = require("druid.extended.slider")
local timer = require("druid.extended.timer")

-- @classmod Druid
local Druid = class("druid.druid_instance")
Expand Down Expand Up @@ -384,24 +385,6 @@ function Druid.new_lang_text(self, ...)
end


--- Create timer basic component
-- @function druid:new_timer
-- @tparam args ... timer init args
-- @treturn Component timer component
function Druid.new_timer(self, ...)
return Druid.create(self, timer, ...)
end


--- Create progress basic component
-- @function druid:new_progress
-- @tparam args ... progress init args
-- @treturn Component progress component
function Druid.new_progress(self, ...)
return Druid.create(self, progress, ...)
end


--- Create grid basic component
-- @function druid:new_grid
-- @tparam args ... grid init args
Expand All @@ -420,11 +403,30 @@ function Druid.new_scroll(self, ...)
end


--- Create swipe basic component
-- @function druid:new_swipe
-- @tparam args ... swipe init args
-- @treturn Component swipe component
function Druid.new_swipe(self, ...)
return Druid.create(self, swipe, ...)
end


--- Create drag basic component
-- @function druid:new_drag
-- @tparam args ... drag init args
-- @treturn Componetn drag component
function Druid.new_drag(self, ...)
return Druid.create(self, drag, ...)
end


--- Create slider basic component
-- @function druid:new_slider
-- @tparam args ... slider init args
-- @treturn Component slider component
function Druid.new_slider(self, ...)
-- return helper.extended_component("slider")
return Druid.create(self, slider, ...)
end

Expand All @@ -434,6 +436,7 @@ end
-- @tparam args ... checkbox init args
-- @treturn Component checkbox component
function Druid.new_checkbox(self, ...)
-- return helper.extended_component("checkbox")
return Druid.create(self, checkbox, ...)
end

Expand All @@ -443,6 +446,7 @@ end
-- @tparam args ... input init args
-- @treturn Component input component
function Druid.new_input(self, ...)
-- return helper.extended_component("input")
return Druid.create(self, input, ...)
end

Expand All @@ -452,6 +456,7 @@ end
-- @tparam args ... checkbox_group init args
-- @treturn Component checkbox_group component
function Druid.new_checkbox_group(self, ...)
-- return helper.extended_component("checkbox_group")
return Druid.create(self, checkbox_group, ...)
end

Expand All @@ -461,25 +466,28 @@ end
-- @tparam args ... radio_group init args
-- @treturn Component radio_group component
function Druid.new_radio_group(self, ...)
-- return helper.extended_component("radio_group")
return Druid.create(self, radio_group, ...)
end


--- Create swipe basic component
-- @function druid:new_swipe
-- @tparam args ... swipe init args
-- @treturn Component swipe component
function Druid.new_swipe(self, ...)
return Druid.create(self, swipe, ...)
--- Create timer basic component
-- @function druid:new_timer
-- @tparam args ... timer init args
-- @treturn Component timer component
function Druid.new_timer(self, ...)
-- return helper.extended_component("timer")
return Druid.create(self, timer, ...)
end


--- Create drag basic component
-- @function druid:new_drag
-- @tparam args ... drag init args
-- @treturn Componetn drag component
function Druid.new_drag(self, ...)
return Druid.create(self, drag, ...)
--- Create progress basic component
-- @function druid:new_progress
-- @tparam args ... progress init args
-- @treturn Component progress component
function Druid.new_progress(self, ...)
-- return helper.extended_component("progress")
return Druid.create(self, progress, ...)
end


Expand Down
2 changes: 1 addition & 1 deletion settings_deployer
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
use_latest_bob=true
use_latest_bob=false

0 comments on commit 23e2846

Please sign in to comment.