@fruit-ui/core 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
@@ -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/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/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,12 +1,12 @@
1
1
  {
2
2
  "name": "@fruit-ui/core",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
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/",
7
7
  "scripts": {
8
8
  "test": "echo \"Error: no test specified\" && exit 1",
9
- "build": "terser .\\src\\index.js -o .\\dist\\index.js"
9
+ "build": "terser .\\src\\index.js -o .\\dist\\index.js && copy ..\\README.md ."
10
10
  },
11
11
  "keywords": [
12
12
  "fruit",
package/src/index.js CHANGED
@@ -116,7 +116,7 @@ function createThis(component) {
116
116
  state: {},
117
117
  setState: {},
118
118
  bindings: {},
119
- memo: component.memo
119
+ memo: structuredClone(component.memo)
120
120
  };
121
121
  }
122
122
 
@@ -450,6 +450,7 @@ function rerenderElementFromTemplate(element, template, onMounts) {
450
450
  * @returns {boolean} whether they are equal.
451
451
  */
452
452
  function deepEqual(a, b) {
453
+ if (a === b) return true;
453
454
  if (typeof a !== typeof b) return false;
454
455
  if (typeof a === 'function') return true;
455
456
  if (typeof a === 'object' && a !== null) {
@@ -469,7 +470,7 @@ function deepEqual(a, b) {
469
470
  if (keysA.length !== keysB.length) return false;
470
471
  return keysB.every(keyB => keyB in a && deepEqual(keysA[keyB], keysB[keyB]));
471
472
  }
472
- } else return a === b;
473
+ } else return false;
473
474
  }
474
475
 
475
476
  /**
@@ -482,7 +483,10 @@ function evaluateMemo(component) {
482
483
  if (component.memo && this.memo) {
483
484
  // for functional memos: rerender if returns false
484
485
  if (typeof component.memo === 'function') return !!component.memo.call(this);
485
- return deepEqual(component.memo, this.memo);
486
+ const equal = deepEqual(component.memo, this.memo);
487
+ this.memo = structuredClone(component.memo);
488
+ console.log(this.memo);
489
+ return equal;
486
490
  } else return false;
487
491
  }
488
492