From 03a8e70b4dda39776fed4f4e435b551a261a07d5 Mon Sep 17 00:00:00 2001 From: Zainab Ali Date: Sat, 17 Aug 2024 20:18:36 +0100 Subject: [PATCH] Support a single input element. (#58) --- build.sbt | 2 +- docs/aquascape.js | 55 +++++++++++ docs/basic/take.md | 26 +++-- docs/highlightWrapper.js | 23 ----- docs/main.css | 14 +++ examples/src/main/scala/Example.scala | 89 +++++++++++++++-- examples/src/main/scala/Examples.scala | 53 +++++----- examples/src/main/scala/formCodecs.scala | 30 ++++++ project/AquascapeDirectives.scala | 117 +++++++++++++++-------- 9 files changed, 305 insertions(+), 104 deletions(-) create mode 100644 docs/aquascape.js delete mode 100644 docs/highlightWrapper.js create mode 100644 examples/src/main/scala/formCodecs.scala diff --git a/build.sbt b/build.sbt index 521b0d1..f0a9039 100644 --- a/build.sbt +++ b/build.sbt @@ -99,7 +99,7 @@ lazy val docs = project // Add highlight.js for code examples .internalJS(Root / "highlight.min.js") .site - .internalJS(Root / "highlightWrapper.js") + .internalJS(Root / "aquascape.js") .site .internalCSS(Root / "a11y-dark.min.css"), laikaExtensions += AquascapeDirectives, diff --git a/docs/aquascape.js b/docs/aquascape.js new file mode 100644 index 0000000..0ebccd1 --- /dev/null +++ b/docs/aquascape.js @@ -0,0 +1,55 @@ +var aquascape = (function () { + + /** Draws an aquascape svg in-browser. + * + * @param exampleObject An instance of `aquascape.examples.Example`. + * @param codeId The html id of the element that should be populated. + * @param frameIds An instance of `aquascape.examples.FrameIds` + */ + function example(exampleObject, codeId, frameIds) { + highlightExampleCode(codeId); + exampleObject.draw(codeId, frameIds); + }; + + /** Draws an aquascape svg in-browser with a single user input. + * + * The user-input is provided through an element. + * + * @param exampleObject An instance of `aquascape.examples.Example`. + * @param codeId The html id of the element that should be populated. + * @param frameIds An instance of `aquascape.examples.FrameIds` + * @param labelId The html id of the