@thi.ng/rdom 1.7.3 → 1.7.5

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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-09-19T21:09:34Z
3
+ - **Last updated**: 2024-10-03T15:37:53Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -9,6 +9,21 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
9
9
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
10
  and/or version bumps of transitive dependencies.
11
11
 
12
+ ### [1.7.5](https://github.com/thi-ng/umbrella/tree/@thi.ng/rdom@1.7.5) (2024-10-03)
13
+
14
+ #### ⏱ Performance improvements
15
+
16
+ - internal update __setAttrib() ([15ed31d](https://github.com/thi-ng/umbrella/commit/15ed31d))
17
+ - only lookup property setters if value non-nullish
18
+
19
+ ### [1.7.4](https://github.com/thi-ng/umbrella/tree/@thi.ng/rdom@1.7.4) (2024-09-22)
20
+
21
+ #### 🩹 Bug fixes
22
+
23
+ - further fix __updateValueAttrib() ([378441c](https://github.com/thi-ng/umbrella/commit/378441c))
24
+ - also skip cursor pos update for readonly elements
25
+ - fix textarea handling
26
+
12
27
  ### [1.7.3](https://github.com/thi-ng/umbrella/tree/@thi.ng/rdom@1.7.3) (2024-09-19)
13
28
 
14
29
  #### 🩹 Bug fixes
package/dom.d.ts CHANGED
@@ -137,14 +137,15 @@ export declare const $html: (el: HTMLElement | SVGElement, body: MaybeDeref<stri
137
137
  * [`mergeClasses()`](https://docs.thi.ng/umbrella/hiccup/functions/mergeClasses.html)
138
138
  * for details.
139
139
  *
140
- * CSS style rules can be defined via the `style` attrib. Please {@link $style}
141
- * for further details.
140
+ * CSS style rules can be defined via the `style` attrib. Please see
141
+ * {@link $style} for further details.
142
142
  *
143
143
  * Data attributes are to be given as object under the `data` attribute name,
144
144
  * with its values being merged with the element's current `dataset` property.
145
145
  *
146
- * Depending on element type the `value` attribute will be updated keeping the
147
- * current cursor position / selection intact.
146
+ * Depending on element type, the `value` attribute will be updated keeping the
147
+ * current cursor position / selection intact. (**NOT** done for disabled or
148
+ * readonly elements due to issues with Safari)
148
149
  *
149
150
  * @param el -
150
151
  * @param attribs -
package/dom.js CHANGED
@@ -141,9 +141,9 @@ const __setAttrib = (el, id, val, attribs) => {
141
141
  el.setAttribute(id, isString(val) ? val : formatPrefixes(val));
142
142
  break;
143
143
  default: {
144
- const setter = __setter(el, id);
145
- if (setter && val != null) {
146
- return setter.call(el, val);
144
+ if (val != null) {
145
+ const setter = __setter(el, id);
146
+ if (setter) return setter.call(el, val);
147
147
  }
148
148
  const idx = id.indexOf(":");
149
149
  if (idx < 0) {
@@ -156,7 +156,8 @@ const __setAttrib = (el, id, val, attribs) => {
156
156
  }
157
157
  };
158
158
  const __updateValueAttrib = (el, value) => {
159
- switch (el.type) {
159
+ const type = el instanceof HTMLTextAreaElement ? "text" : el.type;
160
+ switch (type) {
160
161
  case "text":
161
162
  case "textarea":
162
163
  case "password":
@@ -168,7 +169,7 @@ const __updateValueAttrib = (el, value) => {
168
169
  const start = el.selectionStart;
169
170
  const end = el.selectionEnd;
170
171
  el.value = value;
171
- !el.disabled && el.setSelectionRange(start, end);
172
+ !(el.disabled || el.readOnly) && el.setSelectionRange(start, end);
172
173
  break;
173
174
  }
174
175
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/rdom",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
4
4
  "description": "Lightweight, reactive, VDOM-less UI/DOM components with async lifecycle and @thi.ng/hiccup compatible",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -146,5 +146,5 @@
146
146
  ],
147
147
  "year": 2020
148
148
  },
149
- "gitHead": "b52baa3750ddd1256892df966ab7ac9b4806a9ef\n"
149
+ "gitHead": "dadc6e71940c091e50fbf9f88ea3ba115d3937df\n"
150
150
  }