leanweb 1.2.2 → 1.2.3

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/README.md CHANGED
@@ -251,6 +251,11 @@ items = ["one", "two", "three"];
251
251
  2: three
252
252
  ```
253
253
 
254
+ #### access DOM from lw-for
255
+
256
+ `lw-for` binds the DOM to the list of elements respectively if `typeof element`
257
+ evaluates `object`. To access the DOM node, use `element.getDom()`.
258
+
254
259
  ### lw-model and lw-on:
255
260
 
256
261
  ```html
@@ -350,6 +355,8 @@ Here is a few examples how Leanweb helps web components work with form binding.
350
355
 
351
356
  ### Checkbox
352
357
 
358
+ #### Multiple chechboxes bound to an array
359
+
353
360
  ```javascript
354
361
  // ...
355
362
  items = ['one', 'two', 'three'];
@@ -375,6 +382,24 @@ checkedValues = [];
375
382
 
376
383
  <img src='https://leanweb.app/images/leanweb-form-binding-checkbox.gif' alt='Leanweb Form Binding Checkbox'/>
377
384
 
385
+ #### Single checkbox bound to a boolean value
386
+
387
+ ```javascript
388
+ checked = false;
389
+ toggleCheckbox() {
390
+ this.checked = !this.checked;
391
+ this.update();
392
+ }
393
+ ```
394
+
395
+ ```html
396
+ <button lw-on:click="toggleCheckbox()">Toggle Checkbox</button>
397
+ <div>
398
+ <input type="checkbox" lw-model="checked" />
399
+ <span lw>checked</span>
400
+ </div>
401
+ ```
402
+
378
403
  ### Select
379
404
 
380
405
  ```javascript
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leanweb",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Builds framework agnostic web components.",
5
5
  "bin": {
6
6
  "leanweb": "leanweb.js",
@@ -462,6 +462,9 @@ export default class LWElement extends HTMLElement {
462
462
  node.setAttribute('lw-context', '');
463
463
  currentNode.insertAdjacentElement('afterend', node);
464
464
  }
465
+ if (item && typeof item === 'object') {
466
+ item.getDom = () => node;
467
+ }
465
468
  currentNode = node;
466
469
  const itemContext = { [interpolation.itemExpr]: item };
467
470
  if (interpolation.indexExpr) {