@fruit-ui/core 1.2.6 → 1.2.7

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
@@ -64,7 +64,7 @@ Smaller apps don't always warrant heavyweight frameworks, but interfacing with t
64
64
  ## Getting started
65
65
 
66
66
  There are three ways to use FRUIT in your projects:
67
- - Download and copy the [Terser-compressed JS file](https://github.com/asantagata/fruit-ui/blob/main/core/dist/index.js) file into your project. (This is a compressed version built with Terser; you can just as well use the [non-compressed version](https://github.com/asantagata/fruit-ui/blob/main/core/src/index.js) which uses JSDoc annotations.) Then you can use `import * as fruit from "./modules/fruit.js"` or `<script type="module" src="./modules/fruit.js">` to access FRUIT in your JS apps.
67
+ - Download and copy the [Terser-compressed JS file](https://github.com/asantagata/fruit-ui/blob/main/core/dist/index.js) file into your project. (This is a compressed version built with Terser; you can just as well use the [non-compressed version](https://github.com/asantagata/fruit-ui/blob/main/core/src/index.js) which uses JSDoc annotations). Then you can use `import * as fruit from "./modules/fruit.js"` or `<script type="module" src="./modules/fruit.js">` to access FRUIT in your JS apps.
68
68
  - Access via browser loading, i.e., `import * as fruit from "https://cdn.jsdelivr.net/npm/@fruit-ui/core@latest/src/index.js"`.
69
69
  - With NPM installed, run `npm install @fruit-ui/core`. Then use `import * as fruit from "@fruit-ui/core"`.
70
70
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fruit-ui/core",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "description": "A vanilla JS toolkit for reactive UI",
5
5
  "main": "src/index.js",
6
6
  "homepage": "https://asantagata.github.io/fruit-ui/",
package/src/index.js CHANGED
@@ -649,6 +649,21 @@ function rerenderChildren(element, template, onMounts) {
649
649
  childEl.remove();
650
650
  }
651
651
  }
652
+ } else if (tmChildrenArray.length === 0 && elChildrenArray.length > 0) {
653
+ // delete all children
654
+ for (let i = elChildrenArray.length - 1; i >= 0; i--) {
655
+ let childEl = elChildrenArray[i];
656
+ if ('componentId' in childEl.dataset) delete thisRecord[childEl.dataset.componentId];
657
+ if ('binding' in childEl.dataset) delete this.bindings[childEl.dataset.binding];
658
+ childEl.remove();
659
+ }
660
+ } else if (tmChildrenArray.length > 0 && elChildrenArray.length === 0) {
661
+ // create all children
662
+ for (let i = 0; i < tmChildrenArray.length; i++) {
663
+ let childTm = tmChildrenArray[i];
664
+ const newChild = createElementFromElementable.call(this, childTm, onMounts);
665
+ element.appendChild(newChild);
666
+ }
652
667
  }
653
668
 
654
669
  // handle bindings