structured-fw 0.9.2 → 0.9.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.
@@ -215,8 +215,9 @@ function base64ToBytes(base64) {
215
215
  return Uint8Array.from(binString, (m) => m.codePointAt(0));
216
216
  }
217
217
  function bytesToBase64(bytes) {
218
- const binString = String.fromCodePoint(...bytes);
219
- return btoa(binString);
218
+ return btoa(bytes.reduce((prev, curr) => {
219
+ return prev + String.fromCharCode(curr);
220
+ }, ''));
220
221
  }
221
222
  export function attributeValueToString(key, value) {
222
223
  return 'base64:' + bytesToBase64(new TextEncoder().encode(JSON.stringify({ key, value })));
@@ -88,19 +88,18 @@ export class Component extends EventEmitter {
88
88
  this.setAttributes({ deferred: true }, 'data-', true);
89
89
  return;
90
90
  }
91
- if (typeof this.attributes.use === 'string' && this.parent !== null) {
92
- this.attributes = Object.assign(this.importedParentData(this.parent.data) || {}, this.attributes);
93
- }
91
+ const importedParentData = this.parent ? this.importedParentData(this.parent.data) : {};
94
92
  if (data === undefined) {
95
93
  if (this.entry && this.entry.module) {
96
- this.data = Object.assign(this.data, await this.entry.module.getData(this.attributes, this.document.ctx, this.document.application, this) || {});
94
+ this.data = Object.assign(this.data, await this.entry.module.getData(Object.assign(importedParentData, this.attributes), this.document.ctx, this.document.application, this) || {});
97
95
  }
98
96
  else {
97
+ this.attributes = Object.assign(importedParentData, this.attributes);
99
98
  this.data = Object.assign(exportedContextData, this.attributes);
100
99
  }
101
100
  }
102
101
  else {
103
- this.data = Object.assign(exportedContextData, data, this.attributes);
102
+ this.data = Object.assign(exportedContextData, Object.assign(importedParentData, data), this.attributes);
104
103
  }
105
104
  this.fillData(this.data);
106
105
  if (this.entry === null || this.entry.exportData) {
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "license": "MIT",
15
15
  "type": "module",
16
16
  "main": "build/index",
17
- "version": "0.9.2",
17
+ "version": "0.9.3",
18
18
  "scripts": {
19
19
  "develop": "tsc --watch",
20
20
  "startDev": "cd build && nodemon --watch '../app/**/*' --watch '../build/**/*' -e js,html,css index.js",