be-hive 0.0.150 → 0.0.152

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/be-hive.js +29 -3
  2. package/package.json +3 -3
package/be-hive.js CHANGED
@@ -118,6 +118,7 @@ export class BeHive extends HTMLElement {
118
118
  beEnhanced[enhPropKey] = enhancementInstance;
119
119
  const initialAttrInfo = mo.readAttrs(mountedElement);
120
120
  if (map !== undefined) {
121
+ debugger;
121
122
  for (const attr of initialAttrInfo) {
122
123
  const leafIdx = 0;
123
124
  const { parts, newValue } = attr;
@@ -128,9 +129,34 @@ export class BeHive extends HTMLElement {
128
129
  const prop = map[key];
129
130
  if (prop === undefined)
130
131
  continue;
131
- if (initialPropValues[prop] !== undefined)
132
- continue;
133
- initialPropValues[prop] = newValue;
132
+ switch (typeof prop) {
133
+ case 'string':
134
+ if (initialPropValues[prop] !== undefined)
135
+ continue;
136
+ initialPropValues[prop] = newValue;
137
+ break;
138
+ case 'object':
139
+ const { instanceOf, mapsTo } = prop;
140
+ let valToSet = newValue;
141
+ switch (instanceOf) {
142
+ case 'Object':
143
+ try {
144
+ valToSet = JSON.parse(newValue);
145
+ }
146
+ catch (e) {
147
+ throw { err: 400, attr, newValue };
148
+ }
149
+ if (mapsTo === '.') {
150
+ Object.assign(initialPropValues, valToSet);
151
+ }
152
+ break;
153
+ default:
154
+ throw 'NI';
155
+ }
156
+ break;
157
+ default:
158
+ throw 'NI';
159
+ }
134
160
  }
135
161
  }
136
162
  enhancementInstance.attach(mountedElement, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "be-hive",
3
- "version": "0.0.150",
3
+ "version": "0.0.152",
4
4
  "keywords": [
5
5
  "web-components",
6
6
  "web-component",
@@ -28,9 +28,9 @@
28
28
  "update": "ncu -u && npm install"
29
29
  },
30
30
  "dependencies": {
31
- "be-enhanced": "0.0.83",
31
+ "be-enhanced": "0.0.84",
32
32
  "mount-observer": "0.0.20",
33
- "trans-render": "0.0.765"
33
+ "trans-render": "0.0.766"
34
34
  },
35
35
  "devDependencies": {
36
36
  "may-it-serve": "0.0.6"