Skip to content

Commit

Permalink
dependecy injection refactoring and elem scope fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Salceanu committed Oct 26, 2021
1 parent c90cc58 commit 41580c4
Show file tree
Hide file tree
Showing 29 changed files with 147 additions and 85 deletions.
6 changes: 4 additions & 2 deletions src/Badges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import Genie.Renderer.Html: HTMLString, normal_element

export badge, Badge

Genie.Renderer.Html.register_normal_element("q__badge", context = @__MODULE__)
function __init__()
Genie.Renderer.Html.register_normal_element("q__badge", context = Genie.Renderer.Html)
end

"""
floating::Bool = false
Expand All @@ -22,7 +24,7 @@ function badge( fieldname::Union{Symbol,Nothing} = nothing,
wrap::Function = StippleUI.DEFAULT_WRAPPER,
kwargs...) where {T<:Stipple.ReactiveModel}
wrap() do
q__badge(args...;
Genie.Renderer.Html.q__badge(args...;
attributes(
[:fieldname => fieldname, kwargs...],
StippleUI.API.ATTRIBUTES_MAPPINGS
Expand Down
6 changes: 4 additions & 2 deletions src/Banners.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import Genie.Renderer.Html: HTMLString, normal_element

export banner

Genie.Renderer.Html.register_normal_element("q__banner", context = @__MODULE__)
function __init__()
Genie.Renderer.Html.register_normal_element("q__banner", context = Genie.Renderer.Html)
end

function banner(content::String = "",
args...;
Expand All @@ -15,7 +17,7 @@ function banner(content::String = "",
kwargs...)

wrap() do
q__banner(args...; kwargs...) do
Genie.Renderer.Html.q__banner(args...; kwargs...) do
string(
(icon !== nothing ? wrap(()->icon, Symbol("v-slot:avatar")) : ""),
content,
Expand Down
6 changes: 4 additions & 2 deletions src/BigNumbers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import Genie.Renderer.Html: HTMLString, normal_element

export bignumber

Genie.Renderer.Html.register_normal_element("st__big__number", context = @__MODULE__)
function __init__()
Genie.Renderer.Html.register_normal_element("st__big__number", context = Genie.Renderer.Html)
end

"""
bignumber(label::String = "",
Expand All @@ -28,7 +30,7 @@ function bignumber( label::Union{String,Symbol} = "",
wrap::Function = StippleUI.DEFAULT_WRAPPER,
kwargs...)
wrap() do
st__big__number(args...; attributes([:title => label, :number => number, kwargs...])...)
Genie.Renderer.Html.st__big__number(args...; attributes([:title => label, :number => number, kwargs...])...)
end
end

Expand Down
10 changes: 6 additions & 4 deletions src/Buttons.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import Genie.Renderer.Html: HTMLString, normal_element

export btn, btngroup, Btn

Genie.Renderer.Html.register_normal_element("q__btn", context = @__MODULE__)
Genie.Renderer.Html.register_normal_element("q__btn__group", context = @__MODULE__)
function __init__()
Genie.Renderer.Html.register_normal_element("q__btn", context = Genie.Renderer.Html)
Genie.Renderer.Html.register_normal_element("q__btn__group", context = Genie.Renderer.Html)
end

function btn( label::String = "",
args...;
Expand All @@ -15,7 +17,7 @@ function btn( label::String = "",
kwargs...)

wrap() do
q__btn([isa(content, Function) ? content() : join(content)],
Genie.Renderer.Html.q__btn([isa(content, Function) ? content() : join(content)],
args...;
attributes([:label => label, kwargs...], StippleUI.API.ATTRIBUTES_MAPPINGS)...)
end
Expand Down Expand Up @@ -59,7 +61,7 @@ function btngroup(args...;
wrap::Function = StippleUI.DEFAULT_WRAPPER,
kwargs...)
wrap() do
q__btn__group(args...; kwargs...)
Genie.Renderer.Html.q__btn__group(args...; kwargs...)
end
end

Expand Down
14 changes: 8 additions & 6 deletions src/Cards.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,26 @@ import Genie.Renderer.Html: HTMLString, normal_element

export card, card_section, card_actions

Genie.Renderer.Html.register_normal_element("q__card", context = @__MODULE__)
Genie.Renderer.Html.register_normal_element("q__card__section", context = @__MODULE__)
Genie.Renderer.Html.register_normal_element("q__card__actions", context = @__MODULE__)
function __init__()
Genie.Renderer.Html.register_normal_element("q__card", context = Genie.Renderer.Html)
Genie.Renderer.Html.register_normal_element("q__card__section", context = Genie.Renderer.Html)
Genie.Renderer.Html.register_normal_element("q__card__actions", context = Genie.Renderer.Html)
end

function card(args...;
wrap::Function = StippleUI.DEFAULT_WRAPPER,
kwargs...)
wrap() do
q__card(args...; kwargs...)
Genie.Renderer.Html.q__card(args...; kwargs...)
end
end

function card_section(args...; kwargs...)
q__card__section(args...; kwargs...)
Genie.Renderer.Html.q__card__section(args...; kwargs...)
end

function card_actions(args...; kwargs...)
q__card__actions(args...; kwargs...)
Genie.Renderer.Html.q__card__actions(args...; kwargs...)
end

end
7 changes: 5 additions & 2 deletions src/Checkboxes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import Genie.Renderer.Html: HTMLString, normal_element

export checkbox

Genie.Renderer.Html.register_normal_element("q__checkbox", context = @__MODULE__)
function __init__()
Genie.Renderer.Html.register_normal_element("q__checkbox", context = Genie.Renderer.Html)
end

function checkbox(label::String = "",
fieldname::Union{Symbol,Nothing} = nothing,
Expand All @@ -14,7 +16,8 @@ function checkbox(label::String = "",
kwargs...)

wrap() do
q__checkbox(args...; attributes([:label => label, :fieldname => fieldname, kwargs...], StippleUI.API.ATTRIBUTES_MAPPINGS)...)
Genie.Renderer.Html.q__checkbox(args...; attributes([:label => label, :fieldname => fieldname, kwargs...],
StippleUI.API.ATTRIBUTES_MAPPINGS)...)
end
end

Expand Down
7 changes: 5 additions & 2 deletions src/Chips.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import Genie.Renderer.Html: HTMLString, normal_element

export chip

Genie.Renderer.Html.register_normal_element("q__chip", context = @__MODULE__)
function __init__()
Genie.Renderer.Html.register_normal_element("q__chip", context = Genie.Renderer.Html)
end

function chip(label::String = "",
fieldname::Union{Symbol,Nothing} = nothing,
Expand All @@ -14,7 +16,8 @@ function chip(label::String = "",
kwargs...)

wrap() do
q__chip(args...; attributes([:label => label, :fieldname => fieldname, kwargs...], StippleUI.API.ATTRIBUTES_MAPPINGS)...)
Genie.Renderer.Html.q__chip(args...; attributes([:label => label, :fieldname => fieldname, kwargs...],
StippleUI.API.ATTRIBUTES_MAPPINGS)...)
end
end

Expand Down
8 changes: 5 additions & 3 deletions src/Dashboards.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ module Dashboards
using Genie, Stipple, StippleUI, StippleUI.API
import Genie.Renderer.Html: HTMLString, normal_element

export dashboard
function __init__()
Genie.Renderer.Html.register_normal_element("st__dashboard", context = Genie.Renderer.Html)
end

Genie.Renderer.Html.register_normal_element("st__dashboard", context = @__MODULE__)
export dashboard

function dashboard( args...;
wrap::Function = StippleUI.DEFAULT_WRAPPER,
kwargs...)

wrap() do
st__dashboard(args...; kwargs...)
Genie.Renderer.Html.st__dashboard(args...; kwargs...)
end
end

Expand Down
6 changes: 4 additions & 2 deletions src/DatePickers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import Genie.Renderer.Html: HTMLString, normal_element, template

export datepicker, DateRange, DatePicker

Genie.Renderer.Html.register_normal_element("q__date", context = @__MODULE__)
function __init__()
Genie.Renderer.Html.register_normal_element("q__date", context = Genie.Renderer.Html)
end

"""
DateRange
Expand Down Expand Up @@ -49,7 +51,7 @@ function datepicker(
kwargs...)

wrap() do
q__date([isa(content, Function) ? content() : join(content)],
Genie.Renderer.Html.q__date([isa(content, Function) ? content() : join(content)],
args...;
attributes(
[ :fieldname => fieldname,
Expand Down
6 changes: 4 additions & 2 deletions src/Dialogs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ import Genie.Renderer.Html: HTMLString, normal_element

export dialog

Genie.Renderer.Html.register_normal_element("q__dialog", context = @__MODULE__)
function __init__()
Genie.Renderer.Html.register_normal_element("q__dialog", context = Genie.Renderer.Html)
end

function dialog(args...;
wrap::Function = StippleUI.DEFAULT_WRAPPER,
kwargs...)

wrap() do
q__dialog(args...; attributes([kwargs...], StippleUI.API.ATTRIBUTES_MAPPINGS)...)
Genie.Renderer.Html.q__dialog(args...; attributes([kwargs...], StippleUI.API.ATTRIBUTES_MAPPINGS)...)
end
end

Expand Down
6 changes: 4 additions & 2 deletions src/Drawers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ import Genie.Renderer.Html: HTMLString, normal_element

export drawer

Genie.Renderer.Html.register_normal_element("q__drawer", context = @__MODULE__)
function __init__()
Genie.Renderer.Html.register_normal_element("q__drawer", context = Genie.Renderer.Html)
end

function drawer(args...;
wrap::Function = StippleUI.DEFAULT_WRAPPER,
kwargs...)

wrap() do
q__drawer(args...; attributes([kwargs...], StippleUI.API.ATTRIBUTES_MAPPINGS)...)
Genie.Renderer.Html.q__drawer(args...; attributes([kwargs...], StippleUI.API.ATTRIBUTES_MAPPINGS)...)
end
end

Expand Down
6 changes: 4 additions & 2 deletions src/Editors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import Genie.Renderer.Html: HTMLString, normal_element, select, template

export editor

Genie.Renderer.Html.register_normal_element("q__editor", context = @__MODULE__)
function __init__()
Genie.Renderer.Html.register_normal_element("q__editor", context = Genie.Renderer.Html)
end

"""
editor(fieldname, args...; wrap, kwargs...)
Expand All @@ -26,7 +28,7 @@ function editor(fieldname::Symbol,
wrap::Function = StippleUI.DEFAULT_WRAPPER,
kwargs...)
wrap() do
q__editor(args...; attributes([:fieldname => fieldname, kwargs...], StippleUI.API.ATTRIBUTES_MAPPINGS)...)
Genie.Renderer.Html.q__editor(args...; attributes([:fieldname => fieldname, kwargs...], StippleUI.API.ATTRIBUTES_MAPPINGS)...)
end
end

Expand Down
13 changes: 8 additions & 5 deletions src/FormInputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import Genie.Renderer.Html: HTMLString, normal_element, template

export textfield, numberfield, textarea, filefield

Genie.Renderer.Html.register_normal_element("q__input", context = @__MODULE__)
Genie.Renderer.Html.register_normal_element("q__file", context = @__MODULE__)
function __init__()
Genie.Renderer.Html.register_normal_element("q__input", context = Genie.Renderer.Html)
Genie.Renderer.Html.register_normal_element("q__file", context = Genie.Renderer.Html)
end

function textfield( label::String = "",
fieldname::Union{Symbol,Nothing} = nothing,
Expand All @@ -15,7 +17,7 @@ function textfield( label::String = "",
wrap::Function = StippleUI.DEFAULT_WRAPPER,
kwargs...)
wrap() do
q__input([isa(content, Function) ? content() : join(content)],
Genie.Renderer.Html.q__input([isa(content, Function) ? content() : join(content)],
args...;
attributes([:label => label,
:fieldname => fieldname,
Expand All @@ -38,7 +40,7 @@ function numberfield( label::String = "",
wrap::Function = StippleUI.DEFAULT_WRAPPER,
kwargs...)
wrap() do
q__input( [isa(content, Function) ? content() : join(content)],
Genie.Renderer.Html.q__input( [isa(content, Function) ? content() : join(content)],
args...;
attributes([:label => label,
:fieldname => fieldname, kwargs...],
Expand All @@ -64,7 +66,8 @@ function filefield( label::String = "",
kwargs...)

wrap() do
q__file(args...; attributes(
Genie.Renderer.Html.q__file(args...;
attributes(
[:label => label, :fieldname => fieldname, kwargs...],
Dict("fieldname" => "v-model",
"itemaligned" => "item-aligned", "stacklabel" => "stack-label", "bottomslots" => "bottom-slots",
Expand Down
6 changes: 4 additions & 2 deletions src/Forms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ import Genie.Renderer.Html: HTMLString, normal_element

export form

Genie.Renderer.Html.register_normal_element("q__form", context = @__MODULE__)
function __init__()
Genie.Renderer.Html.register_normal_element("q__form", context = Genie.Renderer.Html)
end

function form(args...;
wrap::Function = StippleUI.DEFAULT_WRAPPER,
noresetfocus::Bool = false,
kwargs...)
wrap() do
q__form(args...; attributes([kwargs...], StippleUI.API.ATTRIBUTES_MAPPINGS)...)
Genie.Renderer.Html.q__form(args...; attributes([kwargs...], StippleUI.API.ATTRIBUTES_MAPPINGS)...)
end
end

Expand Down
6 changes: 4 additions & 2 deletions src/Icons.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import Genie.Renderer.Html: HTMLString, normal_element

export icon

Genie.Renderer.Html.register_normal_element("q__icon", context = @__MODULE__)
function __init__()
Genie.Renderer.Html.register_normal_element("q__icon", context = Genie.Renderer.Html)
end

function icon(name::Union{String,Symbol},
args...;
Expand All @@ -14,7 +16,7 @@ function icon(name::Union{String,Symbol},
kwargs...)

wrap() do
q__icon([isa(content, Function) ? content() : join(content)], args...; attributes([:name => name, kwargs...])...)
Genie.Renderer.Html.q__icon([isa(content, Function) ? content() : join(content)], args...; attributes([:name => name, kwargs...])...)
end
end

Expand Down
6 changes: 4 additions & 2 deletions src/Intersections.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ import Genie.Renderer.Html: HTMLString, normal_element

export intersection

Genie.Renderer.Html.register_normal_element("q__intersection", context = @__MODULE__)
function __init__()
Genie.Renderer.Html.register_normal_element("q__intersection", context = Genie.Renderer.Html)
end

function intersection(args...;
wrap::Function = StippleUI.DEFAULT_WRAPPER,
kwargs...)

wrap() do
q__intersection(args...; attributes([kwargs...], StippleUI.API.ATTRIBUTES_MAPPINGS)...)
Genie.Renderer.Html.q__intersection(args...; attributes([kwargs...], StippleUI.API.ATTRIBUTES_MAPPINGS)...)
end
end

Expand Down
Loading

0 comments on commit 41580c4

Please sign in to comment.