From 027cb7a95c985a4f8b9f4cd69bfde813d4dea5fb Mon Sep 17 00:00:00 2001
From: hhaensel <31985040+hhaensel@users.noreply.github.com>
Date: Mon, 23 Oct 2023 10:34:48 +0200
Subject: [PATCH] fix docs (#229)
* fix documenter issues, part I
* fix doc errors, part II
* switch to warnonly mode instead of commenting out
---
docs/make.jl | 3 ++-
docs/src/API/elements.md | 4 ++--
docs/src/API/layout.md | 3 ++-
docs/src/API/namedtuples.md | 2 +-
docs/src/API/stipple.md | 15 ++++++---------
docs/src/API/typography.md | 2 +-
src/Stipple.jl | 16 ++++++++++++++++
src/stipple/reactivity.jl | 28 ++++++++++++++++++++++++++++
8 files changed, 58 insertions(+), 15 deletions(-)
diff --git a/docs/make.jl b/docs/make.jl
index 0dcb0b8b..533f21e8 100644
--- a/docs/make.jl
+++ b/docs/make.jl
@@ -2,11 +2,12 @@ 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",
format = Documenter.HTML(prettyurls = false),
+ warnonly = true,
pages = [
"Home" => "index.md",
"Tutorials" => [
diff --git a/docs/src/API/elements.md b/docs/src/API/elements.md
index 62e0ec05..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
@@ -8,7 +8,7 @@ elem
vm
vue_integration
@iif
-@elsiff
+@elsiif
@els
@recur
@text
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 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/docs/src/API/stipple.md b/docs/src/API/stipple.md
index 363eaee1..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,7 +31,7 @@ julia_to_vue
parse_jsfunction
replace_jsfunction!
replace_jsfunction
-deps_routes
+deps_routes # missing docstring
deps
@R_str
on
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 60ed3f73..a7a1c084 100644
--- a/src/Stipple.jl
+++ b/src/Stipple.jl
@@ -772,6 +772,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 af5dbd5f..52274fb4 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
@@ -15,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)