@thi.ng/hdom 9.4.93 → 9.4.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +1 -1
  2. package/dom.d.ts +1 -1
  3. package/dom.js +11 -2
  4. package/package.json +12 -12
package/README.md CHANGED
@@ -161,7 +161,7 @@ yarn install
161
161
  yarn start
162
162
  ```
163
163
 
164
- Package sizes (brotli'd, pre-treeshake): ESM: 3.49 KB
164
+ Package sizes (brotli'd, pre-treeshake): ESM: 3.52 KB
165
165
 
166
166
  ## Dependencies
167
167
 
package/dom.d.ts CHANGED
@@ -70,7 +70,7 @@ export declare const setAttrib: (el: Element, id: string, val: any, attribs?: an
70
70
  */
71
71
  export declare const updateValueAttrib: (el: HTMLInputElement, value: any) => void;
72
72
  export declare const removeAttribs: (el: Element, attribs: string[], prev: any) => void;
73
- export declare const setStyle: (el: Element, styles: any) => Element;
73
+ export declare const setStyle: (el: Element, rules: any) => Element;
74
74
  /**
75
75
  * Adds event listener (possibly with options).
76
76
  *
package/dom.js CHANGED
@@ -1,9 +1,10 @@
1
+ import { deref } from "@thi.ng/api/deref";
1
2
  import { implementsFunction } from "@thi.ng/checks/implements-function";
2
3
  import { isArray } from "@thi.ng/checks/is-array";
4
+ import { isFunction } from "@thi.ng/checks/is-function";
3
5
  import { isNotStringAndIterable } from "@thi.ng/checks/is-not-string-iterable";
4
6
  import { isString } from "@thi.ng/checks/is-string";
5
7
  import { ATTRIB_JOIN_DELIMS, SVG_TAGS } from "@thi.ng/hiccup/api";
6
- import { css } from "@thi.ng/hiccup/css";
7
8
  import { formatPrefixes } from "@thi.ng/hiccup/prefix";
8
9
  import { XML_SVG } from "@thi.ng/prefixes/xml";
9
10
  const __maybeInitElement = (el, tree) => tree.__init?.apply(tree.__this, [el, ...tree.__args]);
@@ -205,7 +206,15 @@ const removeAttribs = (el, attribs, prev) => {
205
206
  }
206
207
  }
207
208
  };
208
- const setStyle = (el, styles) => (el.setAttribute("style", css(styles)), el);
209
+ const setStyle = (el, rules) => {
210
+ let v;
211
+ for (let r in rules) {
212
+ v = deref(rules[r]);
213
+ if (isFunction(v)) v = v(rules);
214
+ if (v != null) el.style.setProperty(r, v);
215
+ }
216
+ return el;
217
+ };
209
218
  const setListener = (el, id, listener) => isString(listener) ? el.setAttribute("on" + id, listener) : isArray(listener) ? el.addEventListener(id, ...listener) : el.addEventListener(id, listener);
210
219
  const removeListener = (el, id, listener) => isArray(listener) ? el.removeEventListener(id, ...listener) : el.removeEventListener(id, listener);
211
220
  const clearDOM = (el) => el.innerHTML = "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/hdom",
3
- "version": "9.4.93",
3
+ "version": "9.4.95",
4
4
  "description": "Lightweight vanilla ES6 UI component trees with customizable branch-local behaviors",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -42,18 +42,18 @@
42
42
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
43
43
  },
44
44
  "dependencies": {
45
- "@thi.ng/api": "^8.12.7",
46
- "@thi.ng/checks": "^3.7.23",
47
- "@thi.ng/diff": "^5.1.108",
48
- "@thi.ng/equiv": "^2.1.97",
49
- "@thi.ng/errors": "^2.5.47",
50
- "@thi.ng/hiccup": "^5.3.30",
51
- "@thi.ng/logger": "^3.2.6",
52
- "@thi.ng/prefixes": "^2.3.58"
45
+ "@thi.ng/api": "^8.12.8",
46
+ "@thi.ng/checks": "^3.7.24",
47
+ "@thi.ng/diff": "^5.1.109",
48
+ "@thi.ng/equiv": "^2.1.98",
49
+ "@thi.ng/errors": "^2.5.48",
50
+ "@thi.ng/hiccup": "^5.3.31",
51
+ "@thi.ng/logger": "^3.2.7",
52
+ "@thi.ng/prefixes": "^2.3.59"
53
53
  },
54
54
  "devDependencies": {
55
- "@thi.ng/atom": "^5.3.48",
56
- "esbuild": "^0.25.11",
55
+ "@thi.ng/atom": "^5.3.49",
56
+ "esbuild": "^0.27.0",
57
57
  "typedoc": "^0.28.14",
58
58
  "typescript": "^5.9.3"
59
59
  },
@@ -133,5 +133,5 @@
133
133
  "status": "completed",
134
134
  "year": 2015
135
135
  },
136
- "gitHead": "74b6f319d8f52c9266d97f616be5298a6a5b96e4\n"
136
+ "gitHead": "be6e7657b1e5c54d7d648d1b52888a7297e95a17\n"
137
137
  }