Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix docs #229

Merged
merged 3 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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" => [
Expand Down
4 changes: 2 additions & 2 deletions docs/src/API/elements.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```@meta
CurrentModule = Elements
CurrentModule = Stipple.Elements
```

```@docs
Expand All @@ -8,7 +8,7 @@ elem
vm
vue_integration
@iif
@elsiff
@elsiif
@els
@recur
@text
Expand Down
3 changes: 2 additions & 1 deletion docs/src/API/layout.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
```@meta
CurrentModule = Layout
CurrentModule = Stipple.Layout
```

```@docs
layout
page
row
column
cell
theme
```
2 changes: 1 addition & 1 deletion docs/src/API/namedtuples.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```@meta
CurrentModule = NamedTuples
CurrentModule = Stipple.NamedTuples
```

```@docs
Expand Down
15 changes: 6 additions & 9 deletions docs/src/API/stipple.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ CurrentModule = Stipple
```@docs
Reactive
ReactiveModel
@reactors
@reactive
@reactive!
Settings
MissingPropertyException
Settings # missing docstring
MissingPropertyException # missing docstring
render
update!
watch
Expand All @@ -23,18 +20,18 @@ 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
julia_to_vue
parse_jsfunction
replace_jsfunction!
replace_jsfunction
deps_routes
deps_routes # missing docstring
deps
@R_str
on
Expand Down
2 changes: 1 addition & 1 deletion docs/src/API/typography.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```@meta
CurrentModule = Typography
CurrentModule = Stipple.Typography
```

```@docs
Expand Down
16 changes: 16 additions & 0 deletions src/Stipple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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'")
"<q-btn label v-on:click=\"toggleFullscreen\" :icon=\"is_fullscreen ? 'fullscreen_exit' : 'fullscreen'\"></q-btn>"
```
Note: For expressions that contain only variable names, we recommend the Symbol notation
```
julia> btn("", @click("toggleFullscreen"), icon = :fullscreen_icon)
"<q-btn label v-on:click=\"toggleFullscreen\" :icon=\"fullscreen_icon\"></q-btn>"
```
"""
macro R_str(s)
:(Symbol($s))
end
Expand Down
28 changes: 28 additions & 0 deletions src/stipple/reactivity.jl
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)

Expand Down
Loading