diff --git a/CHANGELOG.md b/CHANGELOG.md index 58cb6e4..abb55ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,11 +15,13 @@ - Add `defprop`, for CSS custom properties (aka variables) - Add `defutil`, for standalone utility classes - Add `import-tokens!`, for importing W3C design token JSON files as properties (as per `defprop`) +- Allow setting metadata on a child list, useful for reagent/react keys ## Fixed - Fix `defined-garden` - Use of `defrules` in pure-cljs namespaces +- Fix implementation of ILookup on cljs # 1.12.107 (2023-09-27 / 2444e34) diff --git a/src/lambdaisland/ornament.cljc b/src/lambdaisland/ornament.cljc index 8089314..4278be6 100644 --- a/src/lambdaisland/ornament.cljc +++ b/src/lambdaisland/ornament.cljc @@ -429,7 +429,8 @@ "Expand an ornament component being called directly with child elements, without custom render function." [tag css-class children extra-attrs] - (let [[tag attrs children :as result] + (let [child-meta (meta children) + [tag attrs children :as result] (if (sequential? children) (as-> children $ (if (= :<> (first $)) (next $) $) @@ -441,7 +442,10 @@ (merge-attrs (meta children) extra-attrs) css-class)] (if (vector? $) (list $) $)))) - [tag (attr-add-class extra-attrs css-class) children])] + [tag (attr-add-class extra-attrs css-class) children]) + result (if child-meta + (with-meta result child-meta) + result)] (if (= :<> (first children)) (recur tag nil children attrs) result))) @@ -832,9 +836,8 @@ (lvalue [_] (str "--" (name prop-name))) (rvalue [_] (str "var(--" (name prop-name) ")")) ILookup - (-valAt [this kw] (when (= :default kw) default)) - (-valAt [this kw fallback] (if (= :default kw) default fallback)) - ) + (-lookup [this kw] (when (= :default kw) default)) + (-lookup [this kw fallback] (if (= :default kw) default fallback))) {:type ::prop}))) #?(:clj