From 0171bb5aed302e8f3ccf8c743f7e97fee8813aa8 Mon Sep 17 00:00:00 2001 From: Josh Day Date: Wed, 2 Oct 2024 15:26:09 -0400 Subject: [PATCH] bump version, remove Unitful ext for now --- Project.toml | 6 +++--- src/PlotlyLight.jl | 9 +++++---- test/runtests.jl | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Project.toml b/Project.toml index d975ec1..7d37d4a 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PlotlyLight" uuid = "ca7969ec-10b3-423e-8d99-40f33abb42bf" authors = ["joshday "] -version = "0.9.2" +version = "0.10.0" [deps] Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" @@ -14,9 +14,9 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" StructTypes = "856f2bd8-1eba-4b0a-8007-ebc267875bd4" [compat] -Artifacts = "1.3" Aqua = "0.8" -Cobweb = "0.6" +Artifacts = "1.3" +Cobweb = "0.6, 0.7" Downloads = "1.6" EasyConfig = "0.1" JSON3 = "1.14" diff --git a/src/PlotlyLight.jl b/src/PlotlyLight.jl index d5ec008..cf43ce3 100644 --- a/src/PlotlyLight.jl +++ b/src/PlotlyLight.jl @@ -39,9 +39,10 @@ end settings::Settings = Settings() #-----------------------------------------------------------------------------# utils/other -fix_matrix(x::Config) = Config(k => fix_matrix(v) for (k,v) in pairs(x)) -fix_matrix(x) = x -fix_matrix(x::AbstractMatrix) = eachrow(x) +# Hack to change behavior of `JSON3.write` for `AbstractMatrix` +_fix(x::Config) = Config(k => _fix(v) for (k,v) in pairs(x)) +_fix(x) = x +_fix(x::AbstractMatrix) = eachrow(x) attributes(t::Symbol) = plotly.schema.traces[t].attributes check_attribute(trace, attr::Symbol) = haskey(attributes(Symbol(trace)), attr) || @warn("`$trace` does not have attribute `$attr`.") @@ -78,7 +79,7 @@ Base.getproperty(::typeof(plot), x::Symbol) = (; kw...) -> plot(x; kw...) #-----------------------------------------------------------------------------# display/show function html_div(o::Plot; id=randstring(10)) - data = JSON3.write(fix_matrix.(o.data); allow_inf=true) + data = JSON3.write(_fix.(o.data); allow_inf=true) layout = JSON3.write(merge(settings.layout, o.layout); allow_inf=true) config = JSON3.write(merge(settings.config, o.config); allow_inf=true) h.div(class="plotlylight-parent-div", diff --git a/test/runtests.jl b/test/runtests.jl index a55ffbe..c675fa5 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -61,7 +61,7 @@ end @testset "other" begin @test propertynames(Plot()) isa Vector{Symbol} @test all(x in propertynames(Plot()) for x in propertynames(plot)) - @test PlotlyLight.fix_matrix([1 2; 3 4]) == [[1, 2], [3, 4]] + @test PlotlyLight._fix([1 2; 3 4]) == [[1, 2], [3, 4]] @test propertynames(JSON3.read(JSON3.write(Plot()))) == [:data, :layout, :config] end