From edaf758b80fed1f5f14cd4b192e661c8863e84bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 23 Aug 2020 23:22:10 +0200 Subject: Move html modules under calp. --- module/html/components.scm | 127 --------------------------------------------- 1 file changed, 127 deletions(-) delete mode 100644 module/html/components.scm (limited to 'module/html/components.scm') diff --git a/module/html/components.scm b/module/html/components.scm deleted file mode 100644 index 2580ea55..00000000 --- a/module/html/components.scm +++ /dev/null @@ -1,127 +0,0 @@ -(define-module (html components) - :use-module (util) - :use-module (util exceptions) - :export (xhtml-doc) - ) - -;; Wraps a number of sxml forms into a valid sxhtml-tree. -(define-syntax xhtml-doc - (syntax-rules (@) - ((_ (@ attr ...) body ...) - `(*TOP* - (*PI* xml "version=\"1.0\" encoding=\"utf-8\"") - (html (@ (xmlns "http://www.w3.org/1999/xhtml") attr ...) - body ...))) - ((_ body ...) - (xhtml-doc (@) body ...)))) - - -;; Add a slider with an associated number input. Keeps the two in check. -;; Uses the js function setVar (which must be provided elsewhere) -;; set the the value of @var{variable}. -(define*-public (slider-input key: variable - (min 0) - (max 10) - (step 1) - (value 1) - (unit "")) - (let ((groupname (symbol->string (gensym "slider")))) - `(div (@ (class "input-group")) - (script - "function " ,groupname "fn (value) {" - "setVar('" ,variable "', value + '" ,unit "');" - "for (let el of document.getElementsByClassName('" ,groupname "')) {" - " el.value = value;" - "}}") - (input (@ (type "range") - (class ,groupname) - (min ,min) - (max ,max) - (step ,step) - (value ,value) - (oninput ,groupname "fn(this.value)") - )) - (input (@ (type "number") - (class ,groupname) - (min ,min) - (max ,max) - (step ,step) - (value ,value) - (oninput ,groupname "fn(this.value)")) - )))) - -;; Generates a button or button-like link. -;; TODO
inside