@thi.ng/rdom 1.0.5 → 1.1.0

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-01-30T21:37:19Z
3
+ - **Last updated**: 2024-02-10T08:59:56Z
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,12 @@ 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.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/rdom@1.1.0) (2024-02-10)
13
+
14
+ #### 🚀 Features
15
+
16
+ - add $toggleClasses() DOM util ([31d19b1](https://github.com/thi-ng/umbrella/commit/31d19b1))
17
+
12
18
  # [1.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/rdom@1.0.0) (2024-01-23)
13
19
 
14
20
  #### 🛑 Breaking changes
package/README.md CHANGED
@@ -1,5 +1,15 @@
1
1
  <!-- This file is generated - DO NOT EDIT! -->
2
2
  <!-- Please see: https://github.com/thi-ng/umbrella/blob/develop/CONTRIBUTING.md#changes-to-readme-files -->
3
+ > [!IMPORTANT]
4
+ > ‼️ Announcing the thi.ng user survey 2024 📋
5
+ >
6
+ > [Please participate in the survey here!](https://forms.gle/XacbSDEmQMPZg8197)\
7
+ > (open until end of February)
8
+ >
9
+ > **To achieve a better sample size, I'd highly appreciate if you could
10
+ > circulate the link to this survey in your own networks.**
11
+ >
12
+ > [Discussion](https://github.com/thi-ng/umbrella/discussions/447)
3
13
 
4
14
  # ![@thi.ng/rdom](https://media.thi.ng/umbrella/banners-20230807/thing-rdom.svg?2193a58e)
5
15
 
@@ -280,7 +290,7 @@ For Node.js REPL:
280
290
  const rdom = await import("@thi.ng/rdom");
281
291
  ```
282
292
 
283
- Package sizes (brotli'd, pre-treeshake): ESM: 3.99 KB
293
+ Package sizes (brotli'd, pre-treeshake): ESM: 4.02 KB
284
294
 
285
295
  ## Dependencies
286
296
 
@@ -332,6 +342,7 @@ directory are using this package:
332
342
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/related-images.jpg" width="240"/> | Responsive image gallery with tag-based Jaccard similarity ranking | [Demo](https://demo.thi.ng/umbrella/related-images/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/related-images) |
333
343
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/render-audio.png" width="240"/> | Generative audio synth offline renderer and WAV file export | [Demo](https://demo.thi.ng/umbrella/render-audio/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/render-audio) |
334
344
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rstream-sync.png" width="240"/> | Minimal rstream sync() example using rdom | [Demo](https://demo.thi.ng/umbrella/rstream-sync/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rstream-sync) |
345
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rstream-system-bus.png" width="240"/> | Declarative component-based system with central rstream-based pubsub event bus | [Demo](https://demo.thi.ng/umbrella/rstream-system-bus/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rstream-system-bus) |
335
346
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/stacked-layout.png" width="240"/> | Responsive & reactively computed stacked column layout | [Demo](https://demo.thi.ng/umbrella/stacked-layout/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/stacked-layout) |
336
347
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/svg-resample.png" width="240"/> | SVG path parsing & dynamic resampling | [Demo](https://demo.thi.ng/umbrella/svg-resample/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/svg-resample) |
337
348
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/trace-bitmap.jpg" width="240"/> | Multi-layer vectorization & dithering of bitmap images | [Demo](https://demo.thi.ng/umbrella/trace-bitmap/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/trace-bitmap) |
package/dom.d.ts CHANGED
@@ -164,6 +164,14 @@ export declare const $attribs: (el: Element, attribs: any) => Element;
164
164
  * @param rules -
165
165
  */
166
166
  export declare const $style: (el: Element, rules: string | any) => void;
167
+ /**
168
+ * Adds or removes the given CSS classes from a DOM element. If a class is
169
+ * currently present it will be removed, otherwise added.
170
+ *
171
+ * @param el
172
+ * @param classes
173
+ */
174
+ export declare const $toggleClasses: (el: Element, ...classes: string[]) => void;
167
175
  /**
168
176
  * Registers an XML namespace prefix and its URL for later use, e.g. to define
169
177
  * namespaced elements/attributes via {@link $el}, {@link $tree}.
package/dom.js CHANGED
@@ -200,6 +200,12 @@ const $style = (el, rules) => {
200
200
  }
201
201
  }
202
202
  };
203
+ const $toggleClasses = (el, ...classes) => {
204
+ const list = el.classList;
205
+ for (let c of classes) {
206
+ list.contains(c) ? list.remove(c) : list.add(c);
207
+ }
208
+ };
203
209
  const PREFIXES = {
204
210
  svg: XML_SVG,
205
211
  xlink: XML_XLINK,
@@ -223,6 +229,7 @@ export {
223
229
  $remove,
224
230
  $style,
225
231
  $text,
232
+ $toggleClasses,
226
233
  $tree,
227
234
  registerPrefix
228
235
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/rdom",
3
- "version": "1.0.5",
3
+ "version": "1.1.0",
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",
@@ -36,20 +36,20 @@
36
36
  "test": "bun test"
37
37
  },
38
38
  "dependencies": {
39
- "@thi.ng/api": "^8.9.22",
40
- "@thi.ng/checks": "^3.4.22",
41
- "@thi.ng/errors": "^2.4.15",
42
- "@thi.ng/hiccup": "^5.1.11",
43
- "@thi.ng/paths": "^5.1.63",
44
- "@thi.ng/prefixes": "^2.3.7",
45
- "@thi.ng/rstream": "^8.2.25",
46
- "@thi.ng/strings": "^3.7.13"
39
+ "@thi.ng/api": "^8.9.23",
40
+ "@thi.ng/checks": "^3.4.23",
41
+ "@thi.ng/errors": "^2.4.16",
42
+ "@thi.ng/hiccup": "^5.1.12",
43
+ "@thi.ng/paths": "^5.1.65",
44
+ "@thi.ng/prefixes": "^2.3.8",
45
+ "@thi.ng/rstream": "^8.3.1",
46
+ "@thi.ng/strings": "^3.7.14"
47
47
  },
48
48
  "devDependencies": {
49
- "@microsoft/api-extractor": "^7.39.0",
50
- "esbuild": "^0.19.10",
49
+ "@microsoft/api-extractor": "^7.40.1",
50
+ "esbuild": "^0.20.0",
51
51
  "rimraf": "^5.0.5",
52
- "typedoc": "^0.25.4",
52
+ "typedoc": "^0.25.7",
53
53
  "typescript": "^5.3.3"
54
54
  },
55
55
  "keywords": [
@@ -142,5 +142,5 @@
142
142
  ],
143
143
  "year": 2020
144
144
  },
145
- "gitHead": "a86521dfac00768f7e51a607209325eb72004730\n"
145
+ "gitHead": "e5e7d5c6ed2eadee7a91d59cbd0c86ce880ab1c5\n"
146
146
  }