@fruit-ui/core 1.2.8 → 1.2.10
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/package.json +1 -1
- package/src/index.js +8 -5
package/package.json
CHANGED
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
|
|
|
@@ -178,7 +181,7 @@ function createElementFromTemplate(template, onMounts, producer = null) {
|
|
|
178
181
|
}
|
|
179
182
|
if (template.style) {
|
|
180
183
|
for (const k in template.style) {
|
|
181
|
-
element.style
|
|
184
|
+
element.style.setProperty(k, template.style[k]);
|
|
182
185
|
}
|
|
183
186
|
}
|
|
184
187
|
if (template.on) {
|
|
@@ -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
|
}
|
|
@@ -429,8 +432,8 @@ function rerenderElementFromTemplate(element, template, onMounts) {
|
|
|
429
432
|
}
|
|
430
433
|
}
|
|
431
434
|
if (template.style) {
|
|
432
|
-
for (
|
|
433
|
-
element.style
|
|
435
|
+
for (const k in template.style) {
|
|
436
|
+
element.style.setProperty(k, template.style[k]);
|
|
434
437
|
}
|
|
435
438
|
}
|
|
436
439
|
if (template.dataset) {
|