https://github.com/lilactown/dxl
https://github.com/lilactown/dxl
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/lilactown/dxl
- Owner: lilactown
- Created: 2023-12-21T17:56:53.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-21T18:00:08.000Z (almost 2 years ago)
- Last Synced: 2024-12-25T04:51:52.474Z (10 months ago)
- Language: Clojure
- Size: 6.84 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# dxl
dxl is the "**D**OM E**x**pression **L**anguage", a library for building web UI
frameworks heavily inspired by [ryansolid/dom-expressions](https://github.com/ryansolid/dom-expressions/tree/main)
used by [SolidJS](https://github.com/solidjs/solid).## Example
```clojure
(ns user
(:require
[dxl.core :as d :refer [! $]]))($ :div) ;; compiles to (.createElement js/document "div")
($ :input {:type "text"})
;; compiles to
;; (let [^js el0 (.createElement js/document "input")]
;; (set! (.-type el0) "text")
;; el0)(let [class (atom "foo")]
($ :div {:class (! class)}))
;; compiles to
;; (let [class (atom "foo")]
;; (let [^js el1 (.createElement js/document "div")]
;; (dx.core/-effect *runtime*
;; (fn []
;; (set! (.-className el1) (-current *runtime* class))))
;; el1))
```