From 7b72745661979fc4e896c1e124b3ad385f452538 Mon Sep 17 00:00:00 2001 From: hhaensel Date: Tue, 17 Oct 2023 09:52:43 +0200 Subject: [PATCH 1/3] fix documenter issues, part I --- docs/src/API/elements.md | 2 +- docs/src/API/namedtuples.md | 2 +- src/stipple/reactivity.jl | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/src/API/elements.md b/docs/src/API/elements.md index 62e0ec05..9d50b154 100644 --- a/docs/src/API/elements.md +++ b/docs/src/API/elements.md @@ -8,7 +8,7 @@ elem vm vue_integration @iif -@elsiff +@elsiif @els @recur @text diff --git a/docs/src/API/namedtuples.md b/docs/src/API/namedtuples.md index 309a5adc..586631d6 100644 --- a/docs/src/API/namedtuples.md +++ b/docs/src/API/namedtuples.md @@ -1,5 +1,5 @@ ```@meta -CurrentModule = NamedTuples +CurrentModule = Stipple.NamedTuples ``` ```@docs diff --git a/src/stipple/reactivity.jl b/src/stipple/reactivity.jl index af5dbd5f..0ee2846c 100644 --- a/src/stipple/reactivity.jl +++ b/src/stipple/reactivity.jl @@ -1,3 +1,17 @@ +""" + mutable struct Reactive{T} <: Observables.AbstractObservable{T} + +`Reactive` is a the base type for variables that are handled by a model. It is an `AbstractObservable` of which the content is +obtained by appending `[]` after the `Reactive` variable's name. +For convenience, `Reactive` can be abbreviated by `R`. + +There are several methods of creating a Reactive variable: +- `r = Reactive(8)` +- `r = Reactive{Float64}(8)` +- `r = Reactive{Float64}(8, READONLY)` +- `r = Reactive{String}("Hello", PRIVATE)` +- `r = Reactive(jsfunction"console.log('Hi')", JSFUNCTION)` +""" mutable struct Reactive{T} <: Observables.AbstractObservable{T} o::Observables.Observable{T} r_mode::Int From 7763fc2e51d1b04de0bd4e2a33388dc10d9cca4a Mon Sep 17 00:00:00 2001 From: hhaensel Date: Tue, 17 Oct 2023 15:01:14 +0200 Subject: [PATCH 2/3] fix doc errors, part II --- docs/make.jl | 2 +- docs/src/API/elements.md | 2 +- docs/src/API/layout.md | 3 ++- docs/src/API/namedtuples.md | 2 +- docs/src/API/stipple.md | 20 ++++++++++---------- docs/src/API/typography.md | 2 +- src/Stipple.jl | 16 ++++++++++++++++ src/stipple/reactivity.jl | 14 ++++++++++++++ 8 files changed, 46 insertions(+), 15 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index 0dcb0b8b..f3a93679 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -2,7 +2,7 @@ using Documenter push!(LOAD_PATH, "../../src") -using Stipple, Stipple.Elements, Stipple.Layout, Stipple.Typography +using Stipple, Stipple.Elements, Stipple.Layout, Stipple.Typography, Stipple.NamedTuples makedocs( sitename = "Stipple - data dashboards and reactive UIs for Julia", diff --git a/docs/src/API/elements.md b/docs/src/API/elements.md index 9d50b154..d0faa6ce 100644 --- a/docs/src/API/elements.md +++ b/docs/src/API/elements.md @@ -1,5 +1,5 @@ ```@meta -CurrentModule = Elements +CurrentModule = Stipple.Elements ``` ```@docs diff --git a/docs/src/API/layout.md b/docs/src/API/layout.md index aa9bcfde..b012a487 100644 --- a/docs/src/API/layout.md +++ b/docs/src/API/layout.md @@ -1,11 +1,12 @@ ```@meta -CurrentModule = Layout +CurrentModule = Stipple.Layout ``` ```@docs layout page row +column cell theme ``` diff --git a/docs/src/API/namedtuples.md b/docs/src/API/namedtuples.md index 586631d6..b1a76b89 100644 --- a/docs/src/API/namedtuples.md +++ b/docs/src/API/namedtuples.md @@ -3,5 +3,5 @@ CurrentModule = Stipple.NamedTuples ``` ```@docs -Core.NamedTuple +# Core.NamedTuple ``` diff --git a/docs/src/API/stipple.md b/docs/src/API/stipple.md index 363eaee1..914cbd9c 100644 --- a/docs/src/API/stipple.md +++ b/docs/src/API/stipple.md @@ -5,11 +5,11 @@ CurrentModule = Stipple ```@docs Reactive ReactiveModel -@reactors -@reactive -@reactive! -Settings -MissingPropertyException +# @reactors +# @reactive +# @reactive! +# Settings +# MissingPropertyException render update! watch @@ -23,10 +23,10 @@ register_components components setindex_withoutwatchers! setfield_withoutwatchers! -convertvalue -stipple_parse +# convertvalue +# stipple_parse init -stipple_deps +# stipple_deps setup Base.push!(m::M, vals::Pair{Symbol, T}; kwargs...) where {T, M <: ReactiveModel} rendering_mappings @@ -34,10 +34,10 @@ julia_to_vue parse_jsfunction replace_jsfunction! replace_jsfunction -deps_routes +# deps_routes deps @R_str -on +# on onbutton @js_str @kwredef diff --git a/docs/src/API/typography.md b/docs/src/API/typography.md index 689bea82..c44160d3 100644 --- a/docs/src/API/typography.md +++ b/docs/src/API/typography.md @@ -1,5 +1,5 @@ ```@meta -CurrentModule = Typography +CurrentModule = Stipple.Typography ``` ```@docs diff --git a/src/Stipple.jl b/src/Stipple.jl index 989b4b93..ce24d409 100644 --- a/src/Stipple.jl +++ b/src/Stipple.jl @@ -770,6 +770,22 @@ end @specialize +""" +Create a js expression that is bound to a field of a vue component. +Internally this is nothing than conversion to a Symbol, but it's a short version for creating symbols with spaces. + +### Example + +``` +julia> btn("", @click("toggleFullscreen"), icon = R"is_fullscreen ? 'fullscreen_exit' : 'fullscreen'") +"" +``` +Note: For expressions that contain only variable names, we recommend the Symbol notation +``` +julia> btn("", @click("toggleFullscreen"), icon = :fullscreen_icon) +"" +``` +""" macro R_str(s) :(Symbol($s)) end diff --git a/src/stipple/reactivity.jl b/src/stipple/reactivity.jl index 0ee2846c..52274fb4 100644 --- a/src/stipple/reactivity.jl +++ b/src/stipple/reactivity.jl @@ -29,6 +29,20 @@ mutable struct Reactive{T} <: Observables.AbstractObservable{T} Reactive{Any}(@nospecialize(o)) = new{Any}(Observable{Any}(o), PUBLIC, false, false, "") end +""" + mutable struct Reactive{T} <: Observables.AbstractObservable{T} + +`Reactive` is a the base type for variables that are handled by a model. It is an `AbstractObservable` of which the content is +obtained by appending `[]` after the `Reactive` variable's name. +For convenience, `Reactive` can be abbreviated by `R`. + +There are several methods of creating a Reactive variable: +- `r = Reactive(8)` +- `r = Reactive{Float64}(8)` +- `r = Reactive{Float64}(8, READONLY)` +- `r = Reactive{String}("Hello", PRIVATE)` +- `r = Reactive(jsfunction"console.log('Hi')", JSFUNCTION)` +""" Reactive(r::T, arg1, args...) where T = convert(Reactive{T}, (r, arg1, args...)) Reactive(r::T) where T = convert(Reactive{T}, r) From cb00b1f71d45540aab490885b1be74eb76e51c52 Mon Sep 17 00:00:00 2001 From: hhaensel Date: Wed, 18 Oct 2023 10:30:08 +0200 Subject: [PATCH 3/3] switch to warnonly mode instead of commenting out --- docs/make.jl | 1 + docs/src/API/namedtuples.md | 2 +- docs/src/API/stipple.md | 17 +++++++---------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index f3a93679..533f21e8 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -7,6 +7,7 @@ using Stipple, Stipple.Elements, Stipple.Layout, Stipple.Typography, Stipple.Nam makedocs( sitename = "Stipple - data dashboards and reactive UIs for Julia", format = Documenter.HTML(prettyurls = false), + warnonly = true, pages = [ "Home" => "index.md", "Tutorials" => [ diff --git a/docs/src/API/namedtuples.md b/docs/src/API/namedtuples.md index b1a76b89..586631d6 100644 --- a/docs/src/API/namedtuples.md +++ b/docs/src/API/namedtuples.md @@ -3,5 +3,5 @@ CurrentModule = Stipple.NamedTuples ``` ```@docs -# Core.NamedTuple +Core.NamedTuple ``` diff --git a/docs/src/API/stipple.md b/docs/src/API/stipple.md index 914cbd9c..2cf84eaa 100644 --- a/docs/src/API/stipple.md +++ b/docs/src/API/stipple.md @@ -5,11 +5,8 @@ CurrentModule = Stipple ```@docs Reactive ReactiveModel -# @reactors -# @reactive -# @reactive! -# Settings -# MissingPropertyException +Settings # missing docstring +MissingPropertyException # missing docstring render update! watch @@ -23,10 +20,10 @@ register_components components setindex_withoutwatchers! setfield_withoutwatchers! -# convertvalue -# stipple_parse +convertvalue # missing docstring +stipple_parse # missing docstring init -# stipple_deps +stipple_deps # missing docstring setup Base.push!(m::M, vals::Pair{Symbol, T}; kwargs...) where {T, M <: ReactiveModel} rendering_mappings @@ -34,10 +31,10 @@ julia_to_vue parse_jsfunction replace_jsfunction! replace_jsfunction -# deps_routes +deps_routes # missing docstring deps @R_str -# on +on onbutton @js_str @kwredef