@fruit-ui/core 1.2.8 → 1.2.9

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +5 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fruit-ui/core",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
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
@@ -113,10 +113,13 @@ function enqueueToRerender(componentId) {
113
113
  */
114
114
  function createThis(component) {
115
115
  return {
116
+ rerender() {},
117
+ producer() {},
118
+ element: null,
116
119
  state: {},
117
120
  setState: {},
118
121
  bindings: {},
119
- memo: deepClone(component.memo)
122
+ memo: typeof component.memo === 'object' ? deepClone(component.memo) : component.memo
120
123
  };
121
124
  }
122
125
 
@@ -288,7 +291,7 @@ function createElementFromElementable(elementable, onMounts) {
288
291
  function createElementFromComponent(component, onMounts) {
289
292
  const boundProducer = bindTemplateProducer(component.render, component);
290
293
  thisRecord[boundProducer.componentId] = boundProducer.this;
291
- boundProducer.this.state = component.state ? component.state() : {};
294
+ boundProducer.this.state = component.state ? component.state.call(boundProducer.this) : {};
292
295
  const template = boundProducer();
293
296
  return createElementFromTemplate.call(boundProducer.this, giveTemplateComponentMetadata(template, boundProducer.componentId, component.key, component.binding), onMounts, boundProducer);
294
297
  }