diff --git a/.gitignore b/.gitignore index ba39cc5..3199bb7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ Manifest.toml +test*.jl \ No newline at end of file diff --git a/Project.toml b/Project.toml index ea1b9aa..3134bf2 100644 --- a/Project.toml +++ b/Project.toml @@ -12,6 +12,7 @@ OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" PlutoDevMacros = "a0499f29-c39b-4c5c-807c-88074221b949" PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8" REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" +Reexport = "189a3867-3050-52da-a836-e630ba90ab69" [compat] AbstractPlutoDingetjes = "1" diff --git a/src/PlutoExtras.jl b/src/PlutoExtras.jl index 233bf36..074d957 100644 --- a/src/PlutoExtras.jl +++ b/src/PlutoExtras.jl @@ -1,6 +1,7 @@ module PlutoExtras using HypertextLiteral using PlutoDevMacros +using Reexport include("editable.jl") # exports: Editable include("latex_equations.jl") # exports the following: texeq, eqref, initialize_eqref, @texeq_str @@ -8,9 +9,10 @@ module ExtendedToc include("extended_toc.jl") end import .ExtendedToc: ExtendedTableOfContents export ExtendedTableOfContents -include("toggle_reactive_bond.jl") # exports: ToggleReactiveBond +# include("toggle_reactive_bond.jl") # exports: ToggleReactiveBond include("structbond/StructBondModule.jl") +@reexport using .StructBondModule end # module diff --git a/src/bonds_dict.jl b/src/bonds_dict.jl index a193cad..6b09478 100644 --- a/src/bonds_dict.jl +++ b/src/bonds_dict.jl @@ -1,5 +1,7 @@ ### A Pluto.jl notebook ### -# v0.19.19 +# v0.19.22 + +#> custom_attrs = ["hide-enabled"] using Markdown using InteractiveUtils @@ -18,8 +20,9 @@ end # ╠═╡ skip_as_script = true #=╠═╡ begin - using PlutoPlotly - using PlutoUtils: ExtendedTableOfContents + using PlutoPlotly + using PlutoExtras: ExtendedTableOfContents + using PlutoTest end ╠═╡ =# @@ -36,6 +39,18 @@ md""" ExtendedTableOfContents() ╠═╡ =# +# ╔═╡ 413bf827-4c76-4956-a6cf-37ab5b6db171 +_floating_ui = HTLScript(@htl(""" + +""")) + +# ╔═╡ 982a6c18-ef9d-4f81-8004-a484802ee6a3 +@htl "$_floating_ui" + # ╔═╡ 278449d8-b67d-4ca9-9910-e19836e42a93 # ╠═╡ skip_as_script = true #=╠═╡ @@ -99,6 +114,7 @@ Base.show(io::IO, m::MIME"text/html", b::BondWrapper) = show(io,m,b.bond) is_table_name(b::BondWrapper) = b.description === "__table_name__" ? true : false # ╔═╡ ab41cb62-44b9-4994-90ef-a9ed329c9394 +# ╠═╡ custom_attrs = ["toc-collapsed"] md""" ## Script """ @@ -165,7 +181,7 @@ _interaction_handler = HTLScriptPart(@htl """ }) interact(tb) .resizable({ - edges: { top: true, left: true, bottom: true, right: true }, + edges: { top: true, left: false, bottom: true, right: true }, listeners: { move: function (event) { @@ -221,19 +237,41 @@ _table_container_style = @htl """ border-radius: 10px; box-shadow: 0 0 11px 0px #00000010; touch-action: none; + max-height: 70%; } .table_container.hide { transform: translateX(calc(-100% + 35px)); height: auto !important; left: 0px !important; + overflow: hidden; + } + .table_container .title { + font-weight: 800; + display: flex; + position: sticky; + top: 0px; + padding: 3px; + background: var(--main-bg-color); + z-index: 100; + } + .table_container .title > .name-container { + display: inline-block; + flex: 1; + text-align: center; } - .table_container > .resize_handler { - position: absolute; - right: 0px; - bottom: 0px; + .table_container > .title > .name-container { + cursor: move; + } + .table_container.hide > .title { + margin: 0px; + padding: 4px; + } + .table_container .separator { height: 10px; - width: 10px; - content: ''; + grid-column: 1 / -1; + } + .table_container .bondsdict_table:last-child .table-row:last-child > .separator { + height: 0px; } @media (prefers-color-scheme: dark) { .table_container { @@ -260,24 +298,47 @@ _params_container_style = @htl """ display: grid; grid-template-columns: 1fr minmax(50px, 100px) auto auto; grid-auto-rows: fit-content(40px); - row-gap: 10px; justify-items: center; - padding: 5px 5px 10px 0px; + padding: 2px 5px 10px 0px; align-items: center; } - .params_container.hide_extra { + .table_container.hide_extra .params_container { grid-template-columns: 1fr minmax(50px, 100px); } - .params_container.hide_extra .extra_item { + .table_container.hide_extra .params_container .extra_item { display: none !important; } - .table_container.hide > .params_container > *:not(.title) { + .table_container.hide > .params_container { display: none; } - .table_container.hide > .params_container { - padding-bottom: 5px; + .params_header { + display: contents; } - .params_container .title { + .params_container .extra_item { + margin-left: 10px; + margin-right: 10px; + } + +"""; + +# ╔═╡ 6c140675-2f64-408d-809f-2a24ee6f4872 +md""" +### Inner Table +""" + +# ╔═╡ 88d13b76-2eb1-4cd3-87ca-733bee714a04 +_inner_table_style = @htl """ + """; @@ -318,7 +418,6 @@ _icons_style = @htl """ cursor: help; --size: 22px; background-image: url("https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/help.svg"); - margin-left: 3px; } .title > .icon.collapse { cursor: pointer; @@ -334,6 +433,7 @@ _icons_style = @htl """ """; # ╔═╡ d4549cda-cd11-4c7d-9411-7ab0c56f9d2a +# ╠═╡ custom_attrs = ["toc-collapsed"] md""" # Helpers scripts """ @@ -496,6 +596,7 @@ function _popup_events(bypass, popup_id::String=FlexiBind.randstr(6), style="plu end # ╔═╡ 4efe496a-6cc7-49c4-9da5-96cc24db648e +# ╠═╡ custom_attrs = ["toc-collapsed"] md""" # Popup Contents """ @@ -732,11 +833,47 @@ is_table_name(b) && return @htl ""
$(rich_desc)$(_desc_script(b)) $(b.bond) - +
+
+""" +end + +# ╔═╡ 372443e8-668a-4e79-a9b3-33e038f42c50 +md""" +## bondsdict_table +""" + +# ╔═╡ 11a39a25-b1e2-47b1-977f-fd240b66caed +function bondsdict_table(d::BondTable; name = d["__table_name__"].description, class = nothing, id = nothing) +table_info = d["__table_name__"] +def = table_info.defines +desc = table_info.rich_description +@htl """ +
+
+
+ +
$desc
+
+
+
+
+ Name + Bond + Sync$(_sync_popup_script()) + Update$(_update_popup_script()) +
+
+ $(map(table_row, values(d))) +
+
""" end @@ -757,40 +894,30 @@ md""" """ ╠═╡ =# +# ╔═╡ 2bb62826-7b65-421f-86ff-8b55aa18f94e +show_bondsdict(d::BondTable;kwargs...) = show_bondsdict([d];kwargs...) + # ╔═╡ 72841851-4303-4b33-842b-d6812737023e -function show_bondsdict(d::BondTable; name = d["__table_name__"].bond.content, class = nothing, id = nothing) -table_name = d["__table_name__"] -def = table_name.defines -desc = table_name.bond.content +function show_bondsdict(d::AbstractVector{<:BondTable}; name = "Parameters", class = nothing, id = nothing) +def = :_parameters +desc = name @htl """ $_attach_to_window -
+
$_script -
$(_help_popup_script(desc, def)) -
$desc
+
$name
-
- Name - Bond - Sync$(_sync_popup_script()) - Update$(_update_popup_script()) -
- $(map(table_row, values(d))) +
+ $(map(bondsdict_table, d))
-
$([ _table_container_style, _params_container_style, + _inner_table_style, _icons_style, ]) +""" + +# ╔═╡ 4713435c-cda0-435e-a07f-28ce7530e5e8 +# ╠═╡ skip_as_script = true +#=╠═╡ +@bondsdict p3 "Third" + ╠═╡ =# + +# ╔═╡ 5653097d-9220-467c-989e-2760b5cbc4a1 +#=╠═╡ +let + show_bondsdict([params, p2, p3]) +end ╠═╡ =# # ╔═╡ ac5e41e2-89c7-4045-9275-7cebe6b6dd92 @@ -1000,7 +1183,47 @@ ciao # ╔═╡ 9f043f97-1f64-4eab-9749-c749c76759a7 #=╠═╡ -@addbond params["SANTO"] md"``C_n^2``" santo Slider(1:10) +@addbond p2["SANTO"] md"``C_n^2``" santo Slider(1:10) + ╠═╡ =# + +# ╔═╡ 142ebb26-09c4-4c07-a1a1-944c1dc15404 +#=╠═╡ +santo + ╠═╡ =# + +# ╔═╡ d0292ba7-030c-4251-a2ee-fe862041617c +#=╠═╡ +@addbond p2["SIGNORE"] Slider(1:10) + ╠═╡ =# + +# ╔═╡ 118feee5-9353-437d-953a-223edfb0c0db +#=╠═╡ +@addbond p3["B"] Slider(1:10) + ╠═╡ =# + +# ╔═╡ 09bab1dc-d024-4586-b57e-61c573bc7b7d +#=╠═╡ +@addbond p3["C"] Slider(1:10) + ╠═╡ =# + +# ╔═╡ 967e8b7f-cbbe-45a0-bd0a-8968db825c98 +#=╠═╡ +@addbond p3["D"] Slider(1:10) + ╠═╡ =# + +# ╔═╡ d85aa78b-93fb-40d5-b00a-e4d449965e48 +#=╠═╡ +@addbond p3["E"] Slider(1:10) + ╠═╡ =# + +# ╔═╡ d8bb923c-5904-41ca-a419-7bf49f15f8a3 +#=╠═╡ +@addbond p3["F"] Slider(1:10) + ╠═╡ =# + +# ╔═╡ 590ca2e8-0a48-4ba5-bf02-7ce9fd5a0a3a +#=╠═╡ +@addbond p3["G"] Slider(1:10) ╠═╡ =# # ╔═╡ b1f64f22-da01-45c0-a2f8-48cb6673d473 @@ -1104,27 +1327,29 @@ AbstractPlutoDingetjes = "6e696c72-6542-2067-7265-42206c756150" HypertextLiteral = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2" OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" PlutoDevMacros = "a0499f29-c39b-4c5c-807c-88074221b949" +PlutoExtras = "ed5d0301-4775-4676-b788-cf71e66ff8ed" PlutoPlotly = "8e989ff0-3d88-8e9f-f020-2b208a939ff0" +PlutoTest = "cb4044da-4d16-4ffa-a6a3-8cad7f73ebdc" PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8" -PlutoUtils = "ed5d0301-4775-4676-b788-cf71e66ff8ed" [compat] AbstractPlutoDingetjes = "~1.1.4" HypertextLiteral = "~0.9.3" OrderedCollections = "~1.4.1" PlutoDevMacros = "~0.4.8" +PlutoExtras = "~0.6.0" PlutoPlotly = "~0.3.6" +PlutoTest = "~0.2.2" PlutoUI = "~0.7.21" -PlutoUtils = "~0.5.13" """ # ╔═╡ 00000000-0000-0000-0000-000000000002 PLUTO_MANIFEST_TOML_CONTENTS = """ # This file is machine-generated - editing it directly is not advised -julia_version = "1.8.5" +julia_version = "1.9.0-beta3" manifest_format = "2.0" -project_hash = "f6140c95de62b5987e0b457fd5087a214a2b376c" +project_hash = "e1940684f13b250cb81be0ae46de8a5c67b8b9f5" [[deps.AbstractPlutoDingetjes]] deps = ["Pkg"] @@ -1142,28 +1367,17 @@ uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" [[deps.Base64]] uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" -[[deps.Chain]] -git-tree-sha1 = "8c4920235f6c561e401dfe569beb8b924adad003" -uuid = "8be319e6-bccf-4806-a6f7-6fae938471bc" -version = "0.5.0" - [[deps.ChainRulesCore]] deps = ["Compat", "LinearAlgebra", "SparseArrays"] -git-tree-sha1 = "e7ff6cadf743c098e08fca25c91103ee4303c9bb" +git-tree-sha1 = "c6d890a52d2c4d55d326439580c3b8d0875a77d9" uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" -version = "1.15.6" - -[[deps.ChangesOfVariables]] -deps = ["ChainRulesCore", "LinearAlgebra", "Test"] -git-tree-sha1 = "38f7a08f19d8810338d4f5085211c7dfa5d5bdd8" -uuid = "9e997f8a-9a97-42d5-a9f1-ce6bfc15e2c0" -version = "0.1.4" +version = "1.15.7" [[deps.ColorSchemes]] -deps = ["ColorTypes", "ColorVectorSpace", "Colors", "FixedPointNumbers", "Random"] -git-tree-sha1 = "1fd869cc3875b57347f7027521f561cf46d1fcd8" +deps = ["ColorTypes", "ColorVectorSpace", "Colors", "FixedPointNumbers", "Random", "SnoopPrecompile"] +git-tree-sha1 = "aa3edc8f8dea6cbfa176ee12f7c2fc82f0608ed3" uuid = "35d6a980-a343-548e-a6ea-1d62b119f2f4" -version = "3.19.0" +version = "3.20.0" [[deps.ColorTypes]] deps = ["FixedPointNumbers", "Random"] @@ -1173,26 +1387,26 @@ version = "0.11.4" [[deps.ColorVectorSpace]] deps = ["ColorTypes", "FixedPointNumbers", "LinearAlgebra", "SpecialFunctions", "Statistics", "TensorCore"] -git-tree-sha1 = "d08c20eef1f2cbc6e60fd3612ac4340b89fea322" +git-tree-sha1 = "600cc5508d66b78aae350f7accdb58763ac18589" uuid = "c3611d14-8923-5661-9e6a-0046d554d3a4" -version = "0.9.9" +version = "0.9.10" [[deps.Colors]] deps = ["ColorTypes", "FixedPointNumbers", "Reexport"] -git-tree-sha1 = "417b0ed7b8b838aa6ca0a87aadf1bb9eb111ce40" +git-tree-sha1 = "fc08e5930ee9a4e03f84bfb5211cb54e7769758a" uuid = "5ae59095-9a9b-59fe-a467-6f913c188581" -version = "0.12.8" +version = "0.12.10" [[deps.Compat]] deps = ["Dates", "LinearAlgebra", "UUIDs"] -git-tree-sha1 = "3ca828fe1b75fa84b021a7860bd039eaea84d2f2" +git-tree-sha1 = "00a2cccc7f098ff3b66806862d275ca3db9e6e5a" uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" -version = "4.3.0" +version = "4.5.0" [[deps.CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" -version = "1.0.1+0" +version = "1.0.2+0" [[deps.Dates]] deps = ["Printf"] @@ -1200,13 +1414,15 @@ uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" [[deps.DelimitedFiles]] deps = ["Mmap"] +git-tree-sha1 = "9e2f36d3c96a820c678f2f1f1782582fcf685bae" uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab" +version = "1.9.1" [[deps.DocStringExtensions]] deps = ["LibGit2"] -git-tree-sha1 = "c36550cb29cbe373e95b3f40486b9a4148f89ffd" +git-tree-sha1 = "2fb1e02f2b635d0845df5d7c167fec4dd739b00d" uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" -version = "0.9.2" +version = "0.9.3" [[deps.Downloads]] deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] @@ -1222,11 +1438,6 @@ git-tree-sha1 = "335bfdceacc84c5cdf16aadc768aa5ddfc5383cc" uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93" version = "0.8.4" -[[deps.Glob]] -git-tree-sha1 = "4df9f7e06108728ebf00a0a11edee4b29a482bb2" -uuid = "c27321d9-0574-5035-807b-f59d2c89b15c" -version = "1.3.0" - [[deps.Hyperscript]] deps = ["Test"] git-tree-sha1 = "8d511d5b81240fc8e6802386302675bdf47737b9" @@ -1249,12 +1460,6 @@ version = "0.2.2" deps = ["Markdown"] uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" -[[deps.InverseFunctions]] -deps = ["Test"] -git-tree-sha1 = "49510dfcb407e572524ba94aeae2fced1f3feb0f" -uuid = "3587e190-3f89-42d0-90ee-14403ec27112" -version = "0.1.8" - [[deps.IrrationalConstants]] git-tree-sha1 = "7fd44fd4ff43fc60815f8e764c0f352b83c49151" uuid = "92d709cd-6900-40b7-9082-c6be49f344b6" @@ -1300,14 +1505,24 @@ version = "1.10.2+0" uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" [[deps.LinearAlgebra]] -deps = ["Libdl", "libblastrampoline_jll"] +deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" [[deps.LogExpFunctions]] -deps = ["ChainRulesCore", "ChangesOfVariables", "DocStringExtensions", "InverseFunctions", "IrrationalConstants", "LinearAlgebra"] -git-tree-sha1 = "94d9c52ca447e23eac0c0f074effbcd38830deb5" +deps = ["DocStringExtensions", "IrrationalConstants", "LinearAlgebra"] +git-tree-sha1 = "45b288af6956e67e621c5cbb2d75a261ab58300b" uuid = "2ab3a3ac-af41-5b50-aa03-7779005ae688" -version = "0.3.18" +version = "0.3.20" + + [deps.LogExpFunctions.extensions] + ChainRulesCoreExt = "ChainRulesCore" + ChangesOfVariablesExt = "ChangesOfVariables" + InverseFunctionsExt = "InverseFunctions" + + [deps.LogExpFunctions.weakdeps] + ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" + ChangesOfVariables = "9e997f8a-9a97-42d5-a9f1-ce6bfc15e2c0" + InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112" [[deps.Logging]] uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" @@ -1337,7 +1552,7 @@ uuid = "a63ad114-7e13-5084-954f-fe012c677804" [[deps.MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" -version = "2022.2.1" +version = "2022.10.11" [[deps.NetworkOptions]] uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" @@ -1346,7 +1561,7 @@ version = "1.2.0" [[deps.OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" -version = "0.3.20+0" +version = "0.3.21+0" [[deps.OpenLibm_jll]] deps = ["Artifacts", "Libdl"] @@ -1372,14 +1587,14 @@ version = "0.12.3" [[deps.Parsers]] deps = ["Dates", "SnoopPrecompile"] -git-tree-sha1 = "cceb0257b662528ecdf0b4b4302eb00e767b38e7" +git-tree-sha1 = "8175fc2b118a3755113c8e68084dc1a9e63c61ee" uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" -version = "2.5.0" +version = "2.5.3" [[deps.Pkg]] -deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] +deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" -version = "1.8.0" +version = "1.9.0" [[deps.PlotlyBase]] deps = ["ColorSchemes", "Dates", "DelimitedFiles", "DocStringExtensions", "JSON", "LaTeXStrings", "Logging", "Parameters", "Pkg", "REPL", "Requires", "Statistics", "UUIDs"] @@ -1393,23 +1608,29 @@ git-tree-sha1 = "b4b23b981704ac3e2c771a389c2899e69306c091" uuid = "a0499f29-c39b-4c5c-807c-88074221b949" version = "0.4.8" +[[deps.PlutoExtras]] +deps = ["AbstractPlutoDingetjes", "HypertextLiteral", "InteractiveUtils", "Markdown", "OrderedCollections", "PlutoDevMacros", "PlutoUI"] +git-tree-sha1 = "14128b3beefcf20a62f6f92be570d770b027f04f" +uuid = "ed5d0301-4775-4676-b788-cf71e66ff8ed" +version = "0.6.0" + [[deps.PlutoPlotly]] deps = ["AbstractPlutoDingetjes", "Colors", "Dates", "HypertextLiteral", "InteractiveUtils", "LaTeXStrings", "Markdown", "PlotlyBase", "PlutoUI", "Reexport"] git-tree-sha1 = "dec81dcd52748ffc59ce3582e709414ff78d947f" uuid = "8e989ff0-3d88-8e9f-f020-2b208a939ff0" version = "0.3.6" +[[deps.PlutoTest]] +deps = ["HypertextLiteral", "InteractiveUtils", "Markdown", "Test"] +git-tree-sha1 = "17aa9b81106e661cffa1c4c36c17ee1c50a86eda" +uuid = "cb4044da-4d16-4ffa-a6a3-8cad7f73ebdc" +version = "0.2.2" + [[deps.PlutoUI]] deps = ["AbstractPlutoDingetjes", "Base64", "ColorTypes", "Dates", "FixedPointNumbers", "Hyperscript", "HypertextLiteral", "IOCapture", "InteractiveUtils", "JSON", "Logging", "MIMEs", "Markdown", "Random", "Reexport", "URIs", "UUIDs"] -git-tree-sha1 = "efc140104e6d0ae3e7e30d56c98c4a927154d684" +git-tree-sha1 = "eadad7b14cf046de6eb41f13c9275e5aa2711ab6" uuid = "7f904dfe-b85e-4ff6-b463-dae2292396a8" -version = "0.7.48" - -[[deps.PlutoUtils]] -deps = ["AbstractPlutoDingetjes", "Chain", "Colors", "DocStringExtensions", "Glob", "HypertextLiteral", "InteractiveUtils", "Markdown", "OrderedCollections", "PlutoDevMacros", "PlutoUI", "Reexport", "Requires", "StaticArrays", "UUIDs"] -git-tree-sha1 = "1e77b28b5d4bf2c0e8f3a3776b73a7a7f1c16236" -uuid = "ed5d0301-4775-4676-b788-cf71e66ff8ed" -version = "0.5.13" +version = "0.7.49" [[deps.Preferences]] deps = ["TOML"] @@ -1448,15 +1669,16 @@ version = "0.7.0" uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" [[deps.SnoopPrecompile]] -git-tree-sha1 = "f604441450a3c0569830946e5b33b78c928e1a85" +deps = ["Preferences"] +git-tree-sha1 = "e760a70afdcd461cf01a575947738d359234665c" uuid = "66db9d55-30c0-4569-8b51-7e840670fc0c" -version = "1.0.1" +version = "1.0.3" [[deps.Sockets]] uuid = "6462fe0b-24de-5631-8697-dd941f90decc" [[deps.SparseArrays]] -deps = ["LinearAlgebra", "Random"] +deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [[deps.SpecialFunctions]] @@ -1465,30 +1687,25 @@ git-tree-sha1 = "d75bda01f8c31ebb72df80a46c88b25d1c79c56d" uuid = "276daf66-3868-5448-9aa4-cd146d93841b" version = "2.1.7" -[[deps.StaticArrays]] -deps = ["LinearAlgebra", "Random", "StaticArraysCore", "Statistics"] -git-tree-sha1 = "4e051b85454b4e4f66e6a6b7bdc452ad9da3dcf6" -uuid = "90137ffa-7385-5640-81b9-e52037218182" -version = "1.5.10" - -[[deps.StaticArraysCore]] -git-tree-sha1 = "6b7ba252635a5eff6a0b0664a41ee140a1c9e72a" -uuid = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" -version = "1.4.0" - [[deps.Statistics]] deps = ["LinearAlgebra", "SparseArrays"] uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" +version = "1.9.0" + +[[deps.SuiteSparse_jll]] +deps = ["Artifacts", "Libdl", "Pkg", "libblastrampoline_jll"] +uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" +version = "5.10.1+0" [[deps.TOML]] deps = ["Dates"] uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" -version = "1.0.0" +version = "1.0.3" [[deps.Tar]] deps = ["ArgTools", "SHA"] uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" -version = "1.10.1" +version = "1.10.0" [[deps.TensorCore]] deps = ["LinearAlgebra"] @@ -1506,9 +1723,9 @@ uuid = "410a4b4d-49e4-4fbc-ab6d-cb71b17b3775" version = "0.1.6" [[deps.URIs]] -git-tree-sha1 = "e59ecc5a41b000fa94423a578d29290c7266fc10" +git-tree-sha1 = "ac00576f90d8a259f2c9d823e91d1de3fd44d348" uuid = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" -version = "1.4.0" +version = "1.4.1" [[deps.UUIDs]] deps = ["Random", "SHA"] @@ -1525,12 +1742,12 @@ uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" [[deps.Zlib_jll]] deps = ["Libdl"] uuid = "83775a58-1f1d-513f-b197-d71354ab007a" -version = "1.2.12+3" +version = "1.2.13+0" [[deps.libblastrampoline_jll]] -deps = ["Artifacts", "Libdl", "OpenBLAS_jll"] +deps = ["Artifacts", "Libdl"] uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" -version = "5.1.1+0" +version = "5.2.0+0" [[deps.nghttp2_jll]] deps = ["Artifacts", "Libdl"] @@ -1548,6 +1765,8 @@ version = "17.4.0+0" # ╠═6efb9ff0-52e7-11ec-2a4d-b788e3955703 # ╠═8179a3c3-dda2-47c2-9efc-014cce2d0c75 # ╠═7cdb1e47-b06b-4cff-ab7e-b9451d261487 +# ╠═413bf827-4c76-4956-a6cf-37ab5b6db171 +# ╠═982a6c18-ef9d-4f81-8004-a484802ee6a3 # ╟─278449d8-b67d-4ca9-9910-e19836e42a93 # ╠═f88ad8a5-8875-41b8-9680-8de93c27948d # ╠═48414943-3a16-4826-8098-19089ed00646 @@ -1571,6 +1790,8 @@ version = "17.4.0+0" # ╠═b5bcc803-e8f6-4bd6-ac6e-8d7c6ee38e68 # ╠═085a5a7b-e4e0-4dd0-af86-09c9d67c3e20 # ╠═d9cc094b-8453-4e74-9420-ec9c3be7f585 +# ╠═6c140675-2f64-408d-809f-2a24ee6f4872 +# ╠═88d13b76-2eb1-4cd3-87ca-733bee714a04 # ╠═b7b34f12-5930-4b6e-8a62-51b6b2b995ad # ╠═e9b706a0-276f-4f0e-8614-7cb4060457ea # ╟─d4549cda-cd11-4c7d-9411-7ab0c56f9d2a @@ -1606,8 +1827,13 @@ version = "17.4.0+0" # ╟─685e1202-a553-4fcd-ae9d-152b92aede9f # ╟─1defc7ea-501c-40a2-b311-c2d171a09401 # ╠═44cc8f3b-d633-47d4-b39b-7ea299ffe281 +# ╟─372443e8-668a-4e79-a9b3-33e038f42c50 +# ╠═11a39a25-b1e2-47b1-977f-fd240b66caed +# ╠═2bd7b82a-d0c4-48c3-88bf-2f6f7772598a +# ╠═142ebb26-09c4-4c07-a1a1-944c1dc15404 # ╟─c74801ab-de4e-4748-aec8-339d56789506 # ╟─ce661fec-c1b5-4150-b863-c42e47defd0a +# ╠═2bb62826-7b65-421f-86ff-8b55aa18f94e # ╠═72841851-4303-4b33-842b-d6812737023e # ╟─ad60610b-aebb-454a-9e33-bb8affb0d484 # ╠═4ee12b02-a0bb-4216-a9cf-92bcb89e664f @@ -1628,10 +1854,24 @@ version = "17.4.0+0" # ╠═f6d39c5e-4458-44ab-a8b2-ee74e921963d # ╠═7bce22ad-2de0-4d34-a660-0a3c059d9857 # ╠═32cac62a-66cb-467d-90ee-3c5c3dd4e9a2 +# ╠═84757e03-eab8-404a-ac2f-271febb9a603 # ╠═0596419d-d9cc-47e1-9ef3-77b0a48b50a5 # ╟─c0105f4e-632e-405a-b59d-25eaf17767ef -# ╠═d86e08a9-5efb-4c97-bd59-946b82f0f5fb +# ╠═efc0cae0-6a1f-4415-abc8-f955eba8a992 # ╠═ecf49c6a-fe57-41e0-9e6f-63c7e5176861 +# ╠═94ff65fe-4df4-4608-93c7-e13104784991 +# ╠═9f043f97-1f64-4eab-9749-c749c76759a7 +# ╠═d0292ba7-030c-4251-a2ee-fe862041617c +# ╠═3b740180-049b-406c-b29a-f6f436ee3b4d +# ╠═4151eaf4-fbbf-4136-a094-7ee555efdc50 +# ╠═4713435c-cda0-435e-a07f-28ce7530e5e8 +# ╠═118feee5-9353-437d-953a-223edfb0c0db +# ╠═09bab1dc-d024-4586-b57e-61c573bc7b7d +# ╠═967e8b7f-cbbe-45a0-bd0a-8968db825c98 +# ╠═d85aa78b-93fb-40d5-b00a-e4d449965e48 +# ╠═d8bb923c-5904-41ca-a419-7bf49f15f8a3 +# ╠═590ca2e8-0a48-4ba5-bf02-7ce9fd5a0a3a +# ╠═5653097d-9220-467c-989e-2760b5cbc4a1 # ╠═ac5e41e2-89c7-4045-9275-7cebe6b6dd92 # ╠═b1f64f22-da01-45c0-a2f8-48cb6673d473 # ╠═d53dbcb4-82f6-43c4-9859-eb233dbbf585 diff --git a/src/flexibond.jl b/src/flexibond.jl index 76e7eb3..c90213b 100644 --- a/src/flexibond.jl +++ b/src/flexibond.jl @@ -1,5 +1,5 @@ ### A Pluto.jl notebook ### -# v0.19.19 +# v0.19.22 using Markdown using InteractiveUtils @@ -519,7 +519,7 @@ PlutoUI = "~0.7.48" PLUTO_MANIFEST_TOML_CONTENTS = """ # This file is machine-generated - editing it directly is not advised -julia_version = "1.8.5" +julia_version = "1.9.0-beta3" manifest_format = "2.0" project_hash = "f4d870e97814c459000b597b650f9edd00acf5d9" @@ -548,7 +548,7 @@ version = "0.11.4" [[deps.CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" -version = "1.0.1+0" +version = "1.0.2+0" [[deps.Dates]] deps = ["Printf"] @@ -619,7 +619,7 @@ version = "1.10.2+0" uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" [[deps.LinearAlgebra]] -deps = ["Libdl", "libblastrampoline_jll"] +deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" [[deps.Logging]] @@ -650,7 +650,7 @@ uuid = "a63ad114-7e13-5084-954f-fe012c677804" [[deps.MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" -version = "2022.2.1" +version = "2022.10.11" [[deps.NetworkOptions]] uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" @@ -659,7 +659,7 @@ version = "1.2.0" [[deps.OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" -version = "0.3.20+0" +version = "0.3.21+0" [[deps.Parsers]] deps = ["Dates", "SnoopPrecompile"] @@ -668,9 +668,9 @@ uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" version = "2.5.0" [[deps.Pkg]] -deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] +deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" -version = "1.8.0" +version = "1.9.0" [[deps.PlutoDevMacros]] deps = ["HypertextLiteral", "InteractiveUtils", "MacroTools", "Markdown", "Random", "Requires"] @@ -723,22 +723,28 @@ version = "1.0.1" uuid = "6462fe0b-24de-5631-8697-dd941f90decc" [[deps.SparseArrays]] -deps = ["LinearAlgebra", "Random"] +deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [[deps.Statistics]] deps = ["LinearAlgebra", "SparseArrays"] uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" +version = "1.9.0" + +[[deps.SuiteSparse_jll]] +deps = ["Artifacts", "Libdl", "Pkg", "libblastrampoline_jll"] +uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" +version = "5.10.1+0" [[deps.TOML]] deps = ["Dates"] uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" -version = "1.0.0" +version = "1.0.3" [[deps.Tar]] deps = ["ArgTools", "SHA"] uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" -version = "1.10.1" +version = "1.10.0" [[deps.Test]] deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] @@ -764,12 +770,12 @@ uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" [[deps.Zlib_jll]] deps = ["Libdl"] uuid = "83775a58-1f1d-513f-b197-d71354ab007a" -version = "1.2.12+3" +version = "1.2.13+0" [[deps.libblastrampoline_jll]] -deps = ["Artifacts", "Libdl", "OpenBLAS_jll"] +deps = ["Artifacts", "Libdl"] uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" -version = "5.1.1+0" +version = "5.2.0+0" [[deps.nghttp2_jll]] deps = ["Artifacts", "Libdl"] diff --git a/src/latex_equations.jl b/src/latex_equations.jl index 2e06d6e..c76fbac 100644 --- a/src/latex_equations.jl +++ b/src/latex_equations.jl @@ -1,5 +1,5 @@ ### A Pluto.jl notebook ### -# v0.19.19 +# v0.19.26 using Markdown using InteractiveUtils @@ -15,12 +15,6 @@ md""" """ ╠═╡ =# -# ╔═╡ b8782294-d6b9-43ac-b745-b2cbb6ed06b1 -# ╠═╡ skip_as_script = true -#=╠═╡ -a = 1:10 - ╠═╡ =# - # ╔═╡ de8473c1-dea1-4221-9562-30679ae58e34 # ╠═╡ skip_as_script = true #=╠═╡ @@ -29,10 +23,10 @@ $$3+2$$ """ ╠═╡ =# -# ╔═╡ 900f494b-690d-43cf-b1b7-61c5d3e68a6d +# ╔═╡ b8782294-d6b9-43ac-b745-b2cbb6ed06b1 # ╠═╡ skip_as_script = true #=╠═╡ -"\n" +a = 1:15 ╠═╡ =# # ╔═╡ 9446acfc-a310-4de6-8876-e30ede527e9c @@ -296,6 +290,12 @@ $(texeq(" """ ╠═╡ =# +# ╔═╡ 7879d7e3-38ad-4a06-8057-ec30da534d76 +# ╠═╡ skip_as_script = true +#=╠═╡ +texeq("y=2x^2") + ╠═╡ =# + # ╔═╡ ea09b6ec-8d39-4cd9-9c79-85c1fcce3828 # ╠═╡ skip_as_script = true #=╠═╡ @@ -307,12 +307,6 @@ texeq(" ") ╠═╡ =# -# ╔═╡ 7879d7e3-38ad-4a06-8057-ec30da534d76 -# ╠═╡ skip_as_script = true -#=╠═╡ -texeq("y=2x^2") - ╠═╡ =# - # ╔═╡ 958531c1-fa83-477c-be3d-927155800f1b # ╠═╡ skip_as_script = true #=╠═╡ @@ -479,7 +473,7 @@ HypertextLiteral = "~0.9.3" PLUTO_MANIFEST_TOML_CONTENTS = """ # This file is machine-generated - editing it directly is not advised -julia_version = "1.8.5" +julia_version = "1.9.2" manifest_format = "2.0" project_hash = "12b2e5dab6bc229d7692234b6b2202f7e3ec539c" @@ -492,23 +486,22 @@ version = "0.9.3" # ╔═╡ Cell order: # ╠═945ee770-e082-11eb-0c8b-25e53f4d718c # ╟─b35233a0-6d2f-4eac-8cb0-e317eef4c835 -# ╠═b8782294-d6b9-43ac-b745-b2cbb6ed06b1 # ╠═0bfb8ee9-14e2-44ee-b0d5-98790d47f7b8 # ╠═1482e175-cf32-42f3-b8fb-64f1f14c1501 # ╠═0df86e0e-6813-4f9f-9f36-7badf2f85597 # ╠═0bd44757-90b8-452f-999f-6109239ac826 # ╠═de8473c1-dea1-4221-9562-30679ae58e34 # ╠═b9213424-f814-4bb8-a05f-33249f4f0a8f -# ╠═9e69e30e-506a-4bd7-b213-0b5c0b31a10d -# ╠═ea09b6ec-8d39-4cd9-9c79-85c1fcce3828 -# ╠═900f494b-690d-43cf-b1b7-61c5d3e68a6d -# ╠═7879d7e3-38ad-4a06-8057-ec30da534d76 +# ╟─9e69e30e-506a-4bd7-b213-0b5c0b31a10d +# ╟─7879d7e3-38ad-4a06-8057-ec30da534d76 +# ╟─ea09b6ec-8d39-4cd9-9c79-85c1fcce3828 +# ╠═b8782294-d6b9-43ac-b745-b2cbb6ed06b1 # ╠═958531c1-fa83-477c-be3d-927155800f1b -# ╠═9446acfc-a310-4de6-8876-e30ede527e9c -# ╠═6d750d01-b851-4614-b448-1a6e00fa5754 +# ╟─9446acfc-a310-4de6-8876-e30ede527e9c +# ╟─6d750d01-b851-4614-b448-1a6e00fa5754 # ╟─1471265c-4934-45e3-a4b2-37da94ff7472 # ╟─b6b08bf0-7282-40b9-ae87-b776a64c519f -# ╠═6584afb8-b085-4c56-93cb-a5b57e16520c +# ╟─6584afb8-b085-4c56-93cb-a5b57e16520c # ╠═a78aa624-6504-4b3f-914a-833261b92f19 # ╟─d14197d8-cab1-4d92-b81c-d826ea8183f3 # ╠═2ad9500c-187b-4b69-8e7b-ef76af8fc39a diff --git a/src/prettytable.jl b/src/prettytable.jl index 6cb90ad..0e67f18 100644 --- a/src/prettytable.jl +++ b/src/prettytable.jl @@ -8,23 +8,26 @@ using PrettyTables, HypertextLiteral, Chain, UUIDs # ╔═╡ afebdbb9-42a5-4640-ae38-12a105a70e05 -#=╠═╡ notebook_exclusive +# ╠═╡ skip_as_script = true +#=╠═╡ md""" PrettyTables does not provide yet a way to directly output a _showable_ HTML object so the function has to be customized to have nice printing on Pluto. We will create a custom function that always prints directly an html output (with the :html backend) and that won't allow for the `standalone` kwargs to be set to true as that always provide a full html page with header, that needs to be rendered in an `iframe` inside the pluto frontend """ - ╠═╡ notebook_exclusive =# + ╠═╡ =# # ╔═╡ b80ac7b8-11a4-45ef-8072-97a5ef0ab4e2 -#=╠═╡ notebook_exclusive +# ╠═╡ skip_as_script = true +#=╠═╡ pretty_table(String,rand(10,4);backend=:html) |> Text - ╠═╡ notebook_exclusive =# + ╠═╡ =# # ╔═╡ 5db046c0-48a2-478b-a8cd-a72c29c14444 -#=╠═╡ notebook_exclusive +# ╠═╡ skip_as_script = true +#=╠═╡ pretty_table(String,rand(10,4);backend=:html,standalone=false) |> Text - ╠═╡ notebook_exclusive =# + ╠═╡ =# # ╔═╡ 22386594-49c7-4c3b-948e-fd13d326d360 css = """ @@ -59,7 +62,8 @@ pretty_table(String,rand(10,4);backend=:html,standalone=false) |> Text """ # ╔═╡ b18e8c7f-467e-427c-8487-e021bd8c283a -#=╠═╡ notebook_exclusive +# ╠═╡ skip_as_script = true +#=╠═╡ @chain css begin split(_,'}') # Separate different style groups map(x -> lstrip(x,'\n'),_) # Remove trailing newlines @@ -76,7 +80,7 @@ pretty_table(String,rand(10,4);backend=:html,standalone=false) |> Text Text end - ╠═╡ notebook_exclusive =# + ╠═╡ =# # ╔═╡ e880d449-0e72-45ad-bea9-bbadcdcd523d """ @@ -185,7 +189,8 @@ function prepend_selector(css,custom_selector) end # ╔═╡ fec22aa8-ffee-4b6c-a46e-a82ed3f75a9d -#=╠═╡ notebook_exclusive +# ╠═╡ skip_as_script = true +#=╠═╡ prepend_selector(""" caption, magic { font-family: "asd", lol; @@ -195,27 +200,30 @@ prepend_selector(""" color: red; } """, "GESU") - ╠═╡ notebook_exclusive =# + ╠═╡ =# # ╔═╡ e11a10bd-8d8c-4e7f-ba3a-873a3e8d349f export prettytable # ╔═╡ 98765fad-7349-4791-a2c9-b60d6a33b1f3 -#=╠═╡ notebook_exclusive +# ╠═╡ skip_as_script = true +#=╠═╡ a = rand(10,4) - ╠═╡ notebook_exclusive =# + ╠═╡ =# # ╔═╡ 81d55931-6c5e-4211-86c7-d67681183cb7 -#=╠═╡ notebook_exclusive +# ╠═╡ skip_as_script = true +#=╠═╡ prettytable(a;caption = "GESU",append_css = """ caption { font-family: "Times New Roman", Times, serif; } """) - ╠═╡ notebook_exclusive =# + ╠═╡ =# # ╔═╡ ca56394b-b4a9-4c8f-a8cc-1592dc1b6bd5 -#=╠═╡ notebook_exclusive +# ╠═╡ skip_as_script = true +#=╠═╡ prettytable(a;tf=tf_html_minimalist,append_css=""" tr:nth-child(5) { font-weight: 800; @@ -224,17 +232,19 @@ tr:nth-child(5) { font-family: "Times New Roman", Times, serif; } """) - ╠═╡ notebook_exclusive =# + ╠═╡ =# # ╔═╡ b9953787-fd44-432a-b2c1-5f9de7cfccbe -#=╠═╡ notebook_exclusive +# ╠═╡ skip_as_script = true +#=╠═╡ prettytable(a;tf=tf_html_dark) - ╠═╡ notebook_exclusive =# + ╠═╡ =# # ╔═╡ 2e5c16de-957e-4f19-9a7e-2edc3ae2707c -#=╠═╡ notebook_exclusive +# ╠═╡ skip_as_script = true +#=╠═╡ prettytable(a) - ╠═╡ notebook_exclusive =# + ╠═╡ =# # ╔═╡ 00000000-0000-0000-0000-000000000001 PLUTO_PROJECT_TOML_CONTENTS = """ diff --git a/src/refdata.jl b/src/refdata.jl new file mode 100644 index 0000000..66240df --- /dev/null +++ b/src/refdata.jl @@ -0,0 +1,171 @@ +### A Pluto.jl notebook ### +# v0.19.19 + +using Markdown +using InteractiveUtils + +# ╔═╡ d925254a-935a-11ed-16a1-31e591bd76eb +using HypertextLiteral + +# ╔═╡ 5f9f532f-0e55-48c8-b1eb-974eebff3da8 +md""" +# RefData +""" + +# ╔═╡ dc94e2d3-e1c0-4d57-bea3-78b3c1ecc714 +Base.@kwdef struct RefData + tag::String = "" + title::String + authors::String + date::Int + link::String +end + +# ╔═╡ 610bd05c-e290-4946-a98f-b91170f7cef1 +a = md"**DIOGESU** re" + +# ╔═╡ 616ab525-e0b9-4cbc-a5d1-309df7a03f84 +a.content + +# ╔═╡ 25505430-db71-4270-8713-c240664f458e +md""" +## Show Methods +""" + +# ╔═╡ 8abcd4cf-6396-420e-91a2-5eb16e754207 +barrios = RefData(; + tag = "[Barrios2020]", + title = "Fading loss for Earth-to-space lasercom affected by scintillation and beam wander composite channel", + authors = "Barrios R.", + date = 2020, + link = "https://doi.org/10.1117/1.OE.59.5.056103" + ) + +# ╔═╡ 5d6bfbb5-2c40-4964-a65a-96591781c1a8 +Base.show(io::IO, mime::MIME"text/html", r::RefData) = show(io, mime, @htl(" +$(r.tag): +$(r.title), +$(r.authors), +$(r.date); +$(r.link) +")) + +# ╔═╡ 7886188b-c20a-4577-bc02-ca179aa661f4 +"$barrios" + +# ╔═╡ db00e747-628f-4350-836f-d855dbbbe630 +Base.show(io::IO, r::RefData) = begin +write(io, isempty(r.tag) ? "" : "$(r.tag): ") +write(io, "$(r.title), ") +write(io, "$(r.authors), ") +write(io, "$(r.date), ") +write(io, "$(r.link).") +end + +# ╔═╡ 66e2a004-c59a-43db-be71-f35d9c0d84f5 +Base.show(io, mime::MIME"text/markdown", r::RefData) = begin + tag = isempty(r.tag) ? "$(r.tag): " : "" + show(io, mime, md"$(tag)**$(r.title)**, _$(r.authors)_, $(r.date), [$(r.link)]($(r.link))") +end + +# ╔═╡ a243cc5d-2b67-4836-aa70-53b90a3b0a19 +let r= barrios + tag = "[gesu]: " + a = md"$(tag)**$(r.title)**, _$(r.authors)_, $(r.date), [$(r.link)]($(r.link))" + "$a" +end + +# ╔═╡ b8d12c1b-2721-41ed-9426-7cb37df1b3d0 +md"$barrios" + +# ╔═╡ 99e438d0-6938-4c5d-b287-90efee18596e +""" +$barrios +""" +function tooltip_text(text,link,title="") +default = @htl(""" + + $text + + """) +if title == "" + return default +else +return @htl(""" + + $default + $title + + +""") + end +end + +# ╔═╡ 00000000-0000-0000-0000-000000000001 +PLUTO_PROJECT_TOML_CONTENTS = """ +[deps] +HypertextLiteral = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2" + +[compat] +HypertextLiteral = "~0.9.4" +""" + +# ╔═╡ 00000000-0000-0000-0000-000000000002 +PLUTO_MANIFEST_TOML_CONTENTS = """ +# This file is machine-generated - editing it directly is not advised + +julia_version = "1.8.5" +manifest_format = "2.0" +project_hash = "312e4b9e605df01eeae246a2087d05a62416059a" + +[[deps.HypertextLiteral]] +deps = ["Tricks"] +git-tree-sha1 = "c47c5fa4c5308f27ccaac35504858d8914e102f9" +uuid = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2" +version = "0.9.4" + +[[deps.Tricks]] +git-tree-sha1 = "6bac775f2d42a611cdfcd1fb217ee719630c4175" +uuid = "410a4b4d-49e4-4fbc-ab6d-cb71b17b3775" +version = "0.1.6" +""" + +# ╔═╡ Cell order: +# ╠═d925254a-935a-11ed-16a1-31e591bd76eb +# ╟─5f9f532f-0e55-48c8-b1eb-974eebff3da8 +# ╠═dc94e2d3-e1c0-4d57-bea3-78b3c1ecc714 +# ╠═610bd05c-e290-4946-a98f-b91170f7cef1 +# ╠═616ab525-e0b9-4cbc-a5d1-309df7a03f84 +# ╟─25505430-db71-4270-8713-c240664f458e +# ╠═8abcd4cf-6396-420e-91a2-5eb16e754207 +# ╠═5d6bfbb5-2c40-4964-a65a-96591781c1a8 +# ╠═7886188b-c20a-4577-bc02-ca179aa661f4 +# ╠═db00e747-628f-4350-836f-d855dbbbe630 +# ╠═66e2a004-c59a-43db-be71-f35d9c0d84f5 +# ╠═a243cc5d-2b67-4836-aa70-53b90a3b0a19 +# ╠═b8d12c1b-2721-41ed-9426-7cb37df1b3d0 +# ╠═99e438d0-6938-4c5d-b287-90efee18596e +# ╟─00000000-0000-0000-0000-000000000001 +# ╟─00000000-0000-0000-0000-000000000002 diff --git a/src/structbond/StructBondModule.jl b/src/structbond/StructBondModule.jl index ea8a664..dd03278 100644 --- a/src/structbond/StructBondModule.jl +++ b/src/structbond/StructBondModule.jl @@ -1,9 +1,13 @@ module StructBondModule import PlutoUI.Experimental: wrapped + import AbstractPlutoDingetjes.Bonds + using HypertextLiteral export BondTable, StructBond, @NTBond, @BondsList, Popout, @popoutasfield, - @typeasfield, popoutwrap, @fieldbond, @fielddescription, @fielddata + @typeasfield, popoutwrap, @fieldbond, @fielddescription, @fielddata, + ToggleReactiveBond + include("toggle_reactive.jl") include("basics.jl") include("main_definitions.jl") include("macro.jl") diff --git a/src/structbond/basics.jl b/src/structbond/basics.jl index d33f02c..4bdd493 100644 --- a/src/structbond/basics.jl +++ b/src/structbond/basics.jl @@ -1,15 +1,28 @@ import REPL: fielddoc -import ..ToggleReactiveBond using HypertextLiteral import PlutoUI.Experimental: wrapped using PlutoUI: combine -CSS_Sheets = map(readdir(joinpath(@__DIR__, "css"))) do file +# Extract CSS that will be used in internal functions +const CSS_PARTS = map(readdir(joinpath(@__DIR__, "css"))) do file name = replace(file, r"\.[\w]+$" => "") |> Symbol path = joinpath(@__DIR__, "css", file) name => read(path, String) end |> NamedTuple + +# Extract JS code that will be used in funtctions +const JS_PARTS = open(joinpath(@__DIR__, "js/code_parts.js"), "r") do file + code_parts = [] + readuntil(file, "// NEW BLOCK:") + while !eof(file) + name = readline(file) |> strip |> Symbol + code = readuntil(file, "// NEW BLOCK:") |> strip |> HypertextLiteral.JavaScript + push!(code_parts, name => code) + end + code_parts +end |> NamedTuple + # StructBond Helpers # ## Structs ## struct NotDefined end @@ -107,31 +120,14 @@ function fieldhtml(s::Type, f::Symbol) $(Child(fieldbond(s, f))) """) end return out end -function typehtml(T::Type) +function typehtml(T::Type; description = typedescription(T)) inner_bond = combine() do Child @htl """ $([ @@ -162,58 +158,10 @@ function typehtml(T::Type) """) - end; description = typedescription(T)) + end; description) end ### Constructor ### diff --git a/src/structbond/css/fieldhtml.css b/src/structbond/css/fieldhtml.css new file mode 100644 index 0000000..a7480d6 --- /dev/null +++ b/src/structbond/css/fieldhtml.css @@ -0,0 +1,18 @@ +field-html { + display: grid; + grid-template-columns: 1fr minmax(min(50px, 100%), 0.4fr); + grid-auto-rows: fit-content(40px); + justify-items: center; + //padding: 2px 5px 10px 0px; + align-items: center; + row-gap: 5px; +} +field-bond { + display: flex; +} +field-bond input { + width: 100%; +} +field-description { + text-align: center; +} diff --git a/src/structbond/css/togglereactive.css b/src/structbond/css/togglereactive.css new file mode 100644 index 0000000..14589a9 --- /dev/null +++ b/src/structbond/css/togglereactive.css @@ -0,0 +1,32 @@ +togglereactive-header > .toggle { + cursor: pointer; + --size: 15px; + position: relative; + width: calc(2 * var(--size)); + height: var(--size); + appearance: none; + background: #c6c6c6; + outline: none; + border-radius: calc(var(--size) / 2); + box-shadow: inset 0 0 calc(var(--size) / 8) rgba(0, 0, 0, 0.2); + margin: 0 10px; +} +togglereactive-header > .toggle:checked { + background: #4bd865; +} +togglereactive-header > .toggle:before { + content: ""; + position: absolute; + width: var(--size); + height: var(--size); + border-radius: 50%; + top: 0px; + left: 0px; + background: #fff; + transform: scale(1.1); + box-shadow: 0 calc(var(--size) / 20) calc(var(--size) / 8) rgba(0, 0, 0, 0.2); + transition: 0.1s; +} +togglereactive-header > .toggle:checked:before { + left: var(--size); +} diff --git a/src/structbond/css/typehtml.css b/src/structbond/css/typehtml.css new file mode 100644 index 0000000..cc8848b --- /dev/null +++ b/src/structbond/css/typehtml.css @@ -0,0 +1,49 @@ +togglereactive-container field-html { + display: contents; +} +togglereactive-container { + display: grid; + grid-template-columns: 1fr minmax(min(50px, 100%), 0.4fr); + grid-auto-rows: fit-content(40px); + justify-items: center; + align-items: center; + row-gap: 5px; + /* The flex below is needed in some weird cases where the bond is display flex and the child becomes small. */ + flex: 1; +} +togglereactive-header { + grid-column: 1 / -1; + display: flex; +} +togglereactive-header > .collapse { + --size: 17px; + display: block; + align-self: stretch; + background-size: var(--size) var(--size); + background-repeat: no-repeat; + background-position: center; + width: var(--size); + filter: var(--image-filters); + background-image: url(https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/chevron-down.svg); + cursor: pointer; +} +togglereactive-container.collapsed > togglereactive-header > .collapse { + background-image: url(https://cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/chevron-forward.svg); +} +togglereactive-header { + display: flex; + align-items: stretch; + width: 100%; +} +togglereactive-header > .description { + text-align: center; + flex-grow: 1; + font-size: 18px; + font-weight: 600; +} +togglereactive-header > .toggle { + align-self: center; +} +togglereactive-container.collapsed togglereactive-header + * { + display: none !important; +} diff --git a/src/structbond/js/code_parts.js b/src/structbond/js/code_parts.js new file mode 100644 index 0000000..902e656 --- /dev/null +++ b/src/structbond/js/code_parts.js @@ -0,0 +1,63 @@ +// NEW BLOCK: replace_script_preamble +// This preamble is used to skip +let props = Object.keys(window).filter(function (q) { + return /FUNCTION_TO_RUN/.test(q); +}); +for (const prop of props) { + const obj = window[prop]; + if (obj === undefined) { + continue; + } + if (obj.currentScript === currentScript) { + const cell_id = currentScript.closest("pluto-cell").id; + const script_id = currentScript.id; + console.log("Saving this script for later execution"); + _.set(window, ["script_to_replace", cell_id, script_id], obj); + return; + } +} + +// NEW BLOCK: replace_html +// Taken from https://stackoverflow.com/questions/2592092/executing-script-elements-inserted-with-innerhtml +function setInnerHTML(elm, html) { + elm.innerHTML = html; + + Array.from(elm.querySelectorAll("script")).forEach((oldScriptEl) => { + const newScriptEl = document.createElement("script"); + + Array.from(oldScriptEl.attributes).forEach((attr) => { + newScriptEl.setAttribute(attr.name, attr.value); + }); + + const scriptText = document.createTextNode(oldScriptEl.innerHTML); + newScriptEl.appendChild(scriptText); + + oldScriptEl.parentNode.replaceChild(newScriptEl, oldScriptEl); + }); +} + +// NEW BLOCK: replace_style +function replaceStyle(name, content, priority = 1) { + const package_container = + document.head.querySelector("plutoextras-style") ?? + document.head.insertAdjacentElement( + "beforeend", + html`` + ); + const this_container = + package_container.querySelector(name) ?? + package_container.insertAdjacentElement( + "beforeend", + html`<${name}>` + ); + // Assign priority + this_container.priority = priority; + // Assign creation time + this_container.created_at = this_container.created_at ?? Date.now() + const style_element = this_container.firstElementChild; + style_element.innerHTML = content; + // Now we sort the children based on priority, using code from https://stackoverflow.com/a/50127768 + [...package_container.children] + .sort((a, b) => (a.priority < b.priority ? -1 : a.created_at >= b.created_at ? 1 : -1)) + .forEach((node) => package_container.appendChild(node)); +} diff --git a/src/structbond/main_definitions.jl b/src/structbond/main_definitions.jl index 6e69afc..66a9edf 100644 --- a/src/structbond/main_definitions.jl +++ b/src/structbond/main_definitions.jl @@ -31,7 +31,7 @@ Base.@kwdef struct StructBond{T} description::Any secret_key::String=String(rand('a':'z', 10)) end -StructBond(::Type{T}; description = typedescription(T)) where T = StructBond{T}(;widget = typehtml(T), description) +StructBond(::Type{T}; description = typedescription(T)) where T = StructBond{T}(;widget = typehtml(T; description), description) ## structbondtype ## structbondtype(::StructBond{T}) where T = T @@ -78,11 +78,7 @@ _show(t::StructBond{T}) where T = @htl(""" """)) @@ -364,7 +360,7 @@ _show_popout(p::Popout) = wrapped() do Child header.onmouseleave = (e) => container.classList.toggle('header-hover', false) """) end @@ -455,7 +451,7 @@ bondtable_interaction_handler = HTLScriptPart(@htl """ ## CSS - BondTable ## bondtable_style = @htl """ """; diff --git a/src/structbond/test_structbondmodule.jl b/src/structbond/test_structbondmodule.jl index 540dd5c..d34a391 100644 --- a/src/structbond/test_structbondmodule.jl +++ b/src/structbond/test_structbondmodule.jl @@ -34,6 +34,9 @@ md""" # Packages """ +# ╔═╡ bbba4947-4fc8-4c36-8510-6bdb34f0800f +ToggleReactiveBond(Slider(1:10); description = "ASD") + # ╔═╡ 707175a9-d356-43cf-8038-620ebc401c93 ExtendedTableOfContents() @@ -69,7 +72,66 @@ end d = TextField() # No description, defaults to the docstring since it's present e = Slider(20:25) # No description, defaults to the fieldname as no docstring is present end -asd_bond = @bind asd StructBond(ASD; description = "Custom Description") +asd_bond = @bind asd StructBond(ASD; description = @htl(""" +LOL + + +LOLOL + + + +""")) end # ╔═╡ cdc0a7ad-a3ac-4270-b707-35b1939da276 @@ -193,6 +255,10 @@ BondTable([ blc ]; description = "My Bonds") +# ╔═╡ 60ae886b-d6a5-452b-b1cd-a29e52564f80 +@BondsList "asd" begin +end; + # ╔═╡ 00000000-0000-0000-0000-000000000001 PLUTO_PROJECT_TOML_CONTENTS = """ [deps] @@ -365,27 +431,29 @@ version = "17.4.0+0" # ╠═9d4455af-96f1-46d7-a4f3-434495b11c8a # ╠═8db82e94-5c81-4c52-9228-7e22395fb68f # ╠═949ac1ef-c502-4e28-81ff-f99b0d19aa03 +# ╠═bbba4947-4fc8-4c36-8510-6bdb34f0800f # ╠═707175a9-d356-43cf-8038-620ebc401c93 -# ╠═4843983c-df64-4b94-8634-7a10d9423a70 +# ╟─4843983c-df64-4b94-8634-7a10d9423a70 # ╟─a8995224-83c6-4f82-b5a5-87a6f86fc7a0 # ╠═9e3601f5-efc2-44e9-83d8-5b65ce7e9ccf # ╠═cdc0a7ad-a3ac-4270-b707-35b1939da276 -# ╠═49516374-f625-4a84-ac5c-f92497d45025 -# ╠═8cc53cd2-9114-4067-ab0b-37fd8cd79240 +# ╟─49516374-f625-4a84-ac5c-f92497d45025 +# ╟─8cc53cd2-9114-4067-ab0b-37fd8cd79240 # ╠═0db51d39-7c05-4e00-b951-7fe776a8e0f9 # ╠═e2b79a58-e66e-4d40-8673-418823753b38 -# ╠═9d23382c-cf35-4b20-a46c-0f4e2de17fc7 -# ╠═959acb40-1fd6-43f5-a1a6-73a6ceaae1d7 +# ╟─9d23382c-cf35-4b20-a46c-0f4e2de17fc7 +# ╟─959acb40-1fd6-43f5-a1a6-73a6ceaae1d7 # ╠═4d611425-c8e3-4bc3-912b-8bc0465363bc # ╠═a5490a6b-dc11-42b7-87e0-d38870fc55e4 -# ╠═2ee7f26d-f383-4e7e-a69a-8fb72717467c -# ╠═79beba88-932f-4147-b3a0-d821ef1bc1e2 +# ╟─2ee7f26d-f383-4e7e-a69a-8fb72717467c +# ╟─79beba88-932f-4147-b3a0-d821ef1bc1e2 # ╠═63d6c2df-a411-407c-af11-4f5d09fbb322 # ╠═633029af-8cac-426e-b35c-c9fb3938b784 -# ╠═2073f11e-8196-4ebc-922f-5fa589e91797 +# ╟─2073f11e-8196-4ebc-922f-5fa589e91797 # ╠═811cf78b-e870-45bb-9173-89a3b3d495f5 -# ╠═3a066bf4-3466-469e-90d0-6b14be3ed8d5 -# ╠═3213d977-7b65-43b0-a881-10fcc2523f14 +# ╟─3a066bf4-3466-469e-90d0-6b14be3ed8d5 +# ╟─3213d977-7b65-43b0-a881-10fcc2523f14 # ╠═903fee67-6b23-41dc-a03d-f1040b696be6 +# ╠═60ae886b-d6a5-452b-b1cd-a29e52564f80 # ╟─00000000-0000-0000-0000-000000000001 # ╟─00000000-0000-0000-0000-000000000002 diff --git a/src/structbond/toggle_reactive.jl b/src/structbond/toggle_reactive.jl new file mode 100644 index 0000000..26af2ed --- /dev/null +++ b/src/structbond/toggle_reactive.jl @@ -0,0 +1,96 @@ +using HypertextLiteral +import AbstractPlutoDingetjes.Bonds + +# Structure # +Base.@kwdef struct ToggleReactiveBond + element::Any + description::Any = "" + secret_key::String=String(rand('a':'z', 10)) + classes::Vector{String} = String[] +end +ToggleReactiveBond(element; kwargs...) = ToggleReactiveBond(;kwargs..., element) + +# AbstractPlutoDingetjes.Bonds methods +function Bonds.initial_value(r::ToggleReactiveBond) + Bonds.initial_value(r.element) +end +function Bonds.validate_value(r::ToggleReactiveBond, from_js) + Bonds.validate_value(r.element, from_js) +end +function Bonds.transform_value(r::ToggleReactiveBond, from_js) + Bonds.transform_value(r.element, from_js) +end +function Bonds.possible_values(r::ToggleReactiveBond) + Bonds.possible_values(r.element) +end + +## Show ## +function _generate_html(r::ToggleReactiveBond) +tag = if isempty(r.classes) + @htl("") +else + @htl("") +end +out = @htl(""" +$tag + + + $(r.description) + + + $(r.element) + + + +""") +end +# Base.show +Base.show(io::IO, mime::MIME"text/html", r::ToggleReactiveBond) = show(io, mime, _generate_html(r)) \ No newline at end of file diff --git a/src/toggle_reactive_bond.jl b/src/toggle_reactive_bond.jl index 82e14cc..40f9c63 100644 --- a/src/toggle_reactive_bond.jl +++ b/src/toggle_reactive_bond.jl @@ -33,7 +33,7 @@ md""" begin Base.@kwdef struct ToggleReactiveBond element::Any - description::String + description::Any secret_key::String=String(rand('a':'z', 10)) end ToggleReactiveBond(element; description = "") = ToggleReactiveBond(;element, description) @@ -58,38 +58,7 @@ export ToggleReactiveBond # ╔═╡ b88012e8-62ac-4b2d-8b6d-5a6b4a26e63d _style = @htl """ """