@limetech/lime-web-components 4.51.3 → 4.51.6

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/CHANGELOG.md CHANGED
@@ -3,6 +3,39 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.51.6](https://github.com/Lundalogik/lime-web-components/compare/v4.51.5...v4.51.6) (2022-07-15)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **testing:** create empty hook if component's `componentWillLoad` is undefined ([be371a8](https://github.com/Lundalogik/lime-web-components/commit/be371a8eca26b9e29f8dfa462cdf77b992a278b6))
12
+
13
+
14
+
15
+
16
+
17
+ ## [4.51.5](https://github.com/Lundalogik/lime-web-components/compare/v4.51.4...v4.51.5) (2022-07-14)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **build:** include required libraries ([d2efa0e](https://github.com/Lundalogik/lime-web-components/commit/d2efa0e59b7a23188afbecf842832123e4233f41))
23
+
24
+
25
+
26
+
27
+
28
+ ## [4.51.4](https://github.com/Lundalogik/lime-web-components/compare/v4.51.3...v4.51.4) (2022-07-14)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * **decorators:** emit context changes correctly ([01b8333](https://github.com/Lundalogik/lime-web-components/commit/01b8333be51017d1400557e63814803de14c9a54)), closes [Lundalogik/crm-feature#2891](https://github.com/Lundalogik/crm-feature/issues/2891)
34
+
35
+
36
+
37
+
38
+
6
39
  ## [4.51.3](https://github.com/Lundalogik/lime-web-components/compare/v4.51.2...v4.51.3) (2022-07-13)
7
40
 
8
41
 
@@ -19,8 +19,6 @@ export function createStateDecorator(options, config) {
19
19
  };
20
20
  }
21
21
  const componentProperties = new WeakMap();
22
- const contexts = new WeakMap();
23
- const contextObservables = new WeakMap();
24
22
  const componentSubscriptions = new WeakMap();
25
23
  const connectedComponents = new WeakMap();
26
24
  /**
@@ -65,7 +63,6 @@ function extendLifecycleMethods(component, properties) {
65
63
  // on the interface.
66
64
  component.connectedCallback = createConnectedCallback(component.connectedCallback, properties);
67
65
  component.componentWillLoad = createComponentWillLoad(component.componentWillLoad, properties);
68
- component.componentWillUpdate = createComponentWillUpdate(component.componentWillUpdate);
69
66
  component.componentDidUnload = createDisconnectedCallback(component.componentDidUnload);
70
67
  component.disconnectedCallback = createDisconnectedCallback(component.disconnectedCallback);
71
68
  }
@@ -75,8 +72,7 @@ function createConnectedCallback(original, properties) {
75
72
  componentSubscriptions.set(this, []);
76
73
  await ensureLimeProps(this);
77
74
  const observable = new BehaviorSubject(this.context);
78
- contexts.set(this, this.context);
79
- contextObservables.set(this, observable);
75
+ watchProp(this, 'context', observable);
80
76
  properties.forEach((property) => {
81
77
  property.options = property.optionFactory(property.options, this);
82
78
  if (isContextAware(property.options)) {
@@ -102,19 +98,6 @@ function createComponentWillLoad(original, properties) {
102
98
  return connectedCallback.apply(this, args);
103
99
  };
104
100
  }
105
- function createComponentWillUpdate(original) {
106
- return async function (...args) {
107
- const context = contexts.get(this);
108
- if (context !== this.context) {
109
- contexts.set(this, this.context);
110
- const observable = contextObservables.get(this);
111
- observable.next(this.context);
112
- }
113
- if (original) {
114
- return original.apply(this, args);
115
- }
116
- };
117
- }
118
101
  function createDisconnectedCallback(original) {
119
102
  return async function (...args) {
120
103
  let result;
@@ -164,6 +147,7 @@ function waitForProp(target, property) {
164
147
  const element = getElement(target);
165
148
  return new Promise((resolve) => {
166
149
  Object.defineProperty(element, property, {
150
+ configurable: true,
167
151
  set: (value) => {
168
152
  delete element[property];
169
153
  element[property] = value;
@@ -172,6 +156,18 @@ function waitForProp(target, property) {
172
156
  });
173
157
  });
174
158
  }
159
+ function watchProp(target, property, observer) {
160
+ const element = getElement(target);
161
+ const { get, set } = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(element), property);
162
+ Object.defineProperty(element, property, {
163
+ configurable: true,
164
+ get: get,
165
+ set: function (value) {
166
+ set.call(this, value);
167
+ observer.next(value);
168
+ },
169
+ });
170
+ }
175
171
  /**
176
172
  * Subscribe to changes from the state
177
173
  *
@@ -1,13 +1,12 @@
1
1
  import { __decorate } from "tslib";
2
2
  /* eslint-disable max-classes-per-file */
3
- let getElement;
3
+ const getElement = (component) => component.el || (component.el = new LimeWebComponentElement(component));
4
4
  jest.mock('@stencil/core', () => {
5
5
  const original = jest.requireActual('@stencil/core');
6
- return Object.assign(Object.assign({}, original), { getElement: () => getElement() });
6
+ return Object.assign(Object.assign({}, original), { getElement: getElement });
7
7
  });
8
8
  import { createStateDecorator } from './factory';
9
- import { Subject } from 'rxjs';
10
- import { take } from 'rxjs/operators';
9
+ import { Subject, firstValueFrom } from 'rxjs';
11
10
  describe('createStateDecorator', () => {
12
11
  let platform;
13
12
  let context;
@@ -34,7 +33,6 @@ describe('createStateDecorator', () => {
34
33
  const component = new MyComponent();
35
34
  expect(typeof component.connectedCallback).toEqual('function');
36
35
  expect(typeof component.componentWillLoad).toEqual('function');
37
- expect(typeof component.componentWillUpdate).toEqual('function');
38
36
  expect(typeof component.componentDidUnload).toEqual('function');
39
37
  expect(typeof component.disconnectedCallback).toEqual('function');
40
38
  });
@@ -50,13 +48,11 @@ describe('createStateDecorator', () => {
50
48
  const component = new MyComponent();
51
49
  const connectedCallback = component.connectedCallback;
52
50
  const componentWillLoad = component.componentWillLoad;
53
- const componentWillUpdate = component.componentWillUpdate;
54
51
  const componentDidUnload = component.componentDidUnload;
55
52
  const disconnectedCallback = component.disconnectedCallback;
56
53
  Decorator()(MyComponent.prototype, 'bar');
57
54
  expect(component.connectedCallback).toEqual(connectedCallback);
58
55
  expect(component.componentWillLoad).toEqual(componentWillLoad);
59
- expect(component.componentWillUpdate).toEqual(componentWillUpdate);
60
56
  expect(component.componentDidUnload).toEqual(componentDidUnload);
61
57
  expect(component.disconnectedCallback).toEqual(disconnectedCallback);
62
58
  });
@@ -67,20 +63,17 @@ describe('createStateDecorator', () => {
67
63
  class MyComponent {
68
64
  connectedCallback() { }
69
65
  componentWillLoad() { }
70
- componentWillUpdate() { }
71
66
  componentDidUnload() { }
72
67
  disconnectedCallback() { }
73
68
  }
74
69
  const component = new MyComponent();
75
70
  const connectedCallback = component.connectedCallback;
76
71
  const componentWillLoad = component.componentWillLoad;
77
- const componentWillUpdate = component.componentWillUpdate;
78
72
  const componentDidUnload = component.componentDidUnload;
79
73
  const disconnectedCallback = component.disconnectedCallback;
80
74
  Decorator()(MyComponent.prototype, 'foo');
81
75
  expect(component.connectedCallback).not.toEqual(connectedCallback);
82
76
  expect(component.componentWillLoad).not.toEqual(componentWillLoad);
83
- expect(component.componentWillUpdate).not.toEqual(componentWillUpdate);
84
77
  expect(component.componentDidUnload).not.toEqual(componentDidUnload);
85
78
  expect(component.disconnectedCallback).not.toEqual(disconnectedCallback);
86
79
  });
@@ -96,8 +89,7 @@ describe('createStateDecorator', () => {
96
89
  Decorator()
97
90
  ], MyComponent.prototype, "foo", void 0);
98
91
  component = new MyComponent();
99
- element = { platform: null, context: null };
100
- getElement = () => element;
92
+ element = getElement(component);
101
93
  });
102
94
  it('returns a promise that does not resolve', () => {
103
95
  expect.assertions(0);
@@ -132,8 +124,7 @@ describe('createStateDecorator', () => {
132
124
  Decorator()
133
125
  ], MyComponent.prototype, "foo", void 0);
134
126
  component = new MyComponent();
135
- element = { platform: null, context: null };
136
- getElement = () => element;
127
+ element = getElement(component);
137
128
  });
138
129
  it('returns a promise that does not resolve', () => {
139
130
  expect.assertions(0);
@@ -228,23 +219,12 @@ describe('createStateDecorator', () => {
228
219
  it('sets the context option to an observable', () => {
229
220
  expect(options.context).toBeInstanceOf(Subject);
230
221
  });
231
- describe('when componentWillUpdate is invoked without a context change', () => {
232
- it('does not emit a value on the observable', async () => {
233
- const spy = jest.spyOn(options.context, 'next');
234
- await component.componentWillUpdate();
235
- expect(spy).not.toHaveBeenCalled();
236
- });
237
- });
238
- describe('when componentWillUpdate is invoked with a context change', () => {
239
- it('emits a value on the observable', async () => {
240
- const spy = jest.spyOn(options.context, 'next');
241
- component.context = 'new context';
242
- await component.componentWillUpdate();
243
- expect(spy).toHaveBeenCalled();
244
- const subject = options.context;
245
- const value = await subject.pipe(take(1)).toPromise();
246
- expect(value).toEqual('new context');
247
- });
222
+ it('emits a value on the observable when property is changed', async () => {
223
+ const spy = jest.spyOn(options.context, 'next');
224
+ getElement(component).context = 'new context';
225
+ expect(spy).toHaveBeenCalled();
226
+ const value = await firstValueFrom(options.context);
227
+ expect(value).toEqual('new context');
248
228
  });
249
229
  });
250
230
  describe('when component has lifecycle methods', () => {
@@ -256,7 +236,6 @@ describe('createStateDecorator', () => {
256
236
  methods = {
257
237
  connectedCallback: jest.fn(),
258
238
  componentWillLoad: jest.fn(),
259
- componentWillUpdate: jest.fn(),
260
239
  componentDidUnload: jest.fn(),
261
240
  disconnectedCallback: jest.fn(),
262
241
  };
@@ -283,13 +262,6 @@ describe('createStateDecorator', () => {
283
262
  expect(methods.componentWillLoad).toHaveBeenCalledTimes(1);
284
263
  });
285
264
  });
286
- it('componentWillUpdate invokes the original componentWillUpdate', async () => {
287
- expect(methods.componentWillUpdate).toHaveBeenCalledTimes(0);
288
- expect(component.componentWillUpdate).not.toEqual(methods.componentWillUpdate);
289
- await component.connectedCallback();
290
- component.componentWillUpdate();
291
- expect(methods.componentWillUpdate).toHaveBeenCalledTimes(1);
292
- });
293
265
  it('componentDidUnload invokes the original componentDidUnload', async () => {
294
266
  expect(methods.componentDidUnload).toHaveBeenCalledTimes(0);
295
267
  expect(component.componentDidUnload).not.toEqual(methods.componentDidUnload);
@@ -335,3 +307,21 @@ class TestService {
335
307
  return this.subscriptions;
336
308
  }
337
309
  }
310
+ class LimeWebComponentElement extends HTMLElement {
311
+ constructor(component) {
312
+ super();
313
+ this.component = component;
314
+ }
315
+ get platform() {
316
+ return this.component.platform;
317
+ }
318
+ set platform(value) {
319
+ this.component.platform = value;
320
+ }
321
+ get context() {
322
+ return this.component.context;
323
+ }
324
+ set context(value) {
325
+ this.component.context = value;
326
+ }
327
+ }
@@ -17,8 +17,6 @@ function createStateDecorator(options, config) {
17
17
  }
18
18
  exports.createStateDecorator = createStateDecorator;
19
19
  var componentProperties = new WeakMap();
20
- var contexts = new WeakMap();
21
- var contextObservables = new WeakMap();
22
20
  var componentSubscriptions = new WeakMap();
23
21
  var connectedComponents = new WeakMap();
24
22
  function getComponentProperties(component, property, options, config) {
@@ -41,7 +39,6 @@ function getComponentProperties(component, property, options, config) {
41
39
  function extendLifecycleMethods(component, properties) {
42
40
  component.connectedCallback = createConnectedCallback(component.connectedCallback, properties);
43
41
  component.componentWillLoad = createComponentWillLoad(component.componentWillLoad, properties);
44
- component.componentWillUpdate = createComponentWillUpdate(component.componentWillUpdate);
45
42
  component.componentDidUnload = createDisconnectedCallback(component.componentDidUnload);
46
43
  component.disconnectedCallback = createDisconnectedCallback(component.disconnectedCallback);
47
44
  }
@@ -63,8 +60,7 @@ function createConnectedCallback(original, properties) {
63
60
  case 1:
64
61
  _a.sent();
65
62
  observable = new rxjs_1.BehaviorSubject(this.context);
66
- contexts.set(this, this.context);
67
- contextObservables.set(this, observable);
63
+ watchProp(this, 'context', observable);
68
64
  properties.forEach(function (property) {
69
65
  property.options = property.optionFactory(property.options, _this);
70
66
  if (isContextAware(property.options)) {
@@ -108,29 +104,6 @@ function createComponentWillLoad(original, properties) {
108
104
  });
109
105
  };
110
106
  }
111
- function createComponentWillUpdate(original) {
112
- return function () {
113
- var args = [];
114
- for (var _i = 0; _i < arguments.length; _i++) {
115
- args[_i] = arguments[_i];
116
- }
117
- return tslib_1.__awaiter(this, void 0, void 0, function () {
118
- var context, observable;
119
- return tslib_1.__generator(this, function (_a) {
120
- context = contexts.get(this);
121
- if (context !== this.context) {
122
- contexts.set(this, this.context);
123
- observable = contextObservables.get(this);
124
- observable.next(this.context);
125
- }
126
- if (original) {
127
- return [2, original.apply(this, args)];
128
- }
129
- return [2];
130
- });
131
- });
132
- };
133
- }
134
107
  function createDisconnectedCallback(original) {
135
108
  return function () {
136
109
  var args = [];
@@ -169,6 +142,7 @@ function waitForProp(target, property) {
169
142
  var element = (0, core_1.getElement)(target);
170
143
  return new Promise(function (resolve) {
171
144
  Object.defineProperty(element, property, {
145
+ configurable: true,
172
146
  set: function (value) {
173
147
  delete element[property];
174
148
  element[property] = value;
@@ -177,6 +151,18 @@ function waitForProp(target, property) {
177
151
  });
178
152
  });
179
153
  }
154
+ function watchProp(target, property, observer) {
155
+ var element = (0, core_1.getElement)(target);
156
+ var _a = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(element), property), get = _a.get, set = _a.set;
157
+ Object.defineProperty(element, property, {
158
+ configurable: true,
159
+ get: get,
160
+ set: function (value) {
161
+ set.call(this, value);
162
+ observer.next(value);
163
+ },
164
+ });
165
+ }
180
166
  function subscribe(component, property) {
181
167
  var subscription = createSubscription(component, property);
182
168
  var subscriptions = componentSubscriptions.get(component);
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var tslib_1 = require("tslib");
4
- var getElement;
4
+ var getElement = function (component) {
5
+ return component.el || (component.el = new LimeWebComponentElement(component));
6
+ };
5
7
  jest.mock('@stencil/core', function () {
6
8
  var original = jest.requireActual('@stencil/core');
7
- return tslib_1.__assign(tslib_1.__assign({}, original), { getElement: function () { return getElement(); } });
9
+ return tslib_1.__assign(tslib_1.__assign({}, original), { getElement: getElement });
8
10
  });
9
11
  var factory_1 = require("./factory");
10
12
  var rxjs_1 = require("rxjs");
11
- var operators_1 = require("rxjs/operators");
12
13
  describe('createStateDecorator', function () {
13
14
  var platform;
14
15
  var context;
@@ -38,7 +39,6 @@ describe('createStateDecorator', function () {
38
39
  var component = new MyComponent();
39
40
  expect(typeof component.connectedCallback).toEqual('function');
40
41
  expect(typeof component.componentWillLoad).toEqual('function');
41
- expect(typeof component.componentWillUpdate).toEqual('function');
42
42
  expect(typeof component.componentDidUnload).toEqual('function');
43
43
  expect(typeof component.disconnectedCallback).toEqual('function');
44
44
  });
@@ -57,13 +57,11 @@ describe('createStateDecorator', function () {
57
57
  var component = new MyComponent();
58
58
  var connectedCallback = component.connectedCallback;
59
59
  var componentWillLoad = component.componentWillLoad;
60
- var componentWillUpdate = component.componentWillUpdate;
61
60
  var componentDidUnload = component.componentDidUnload;
62
61
  var disconnectedCallback = component.disconnectedCallback;
63
62
  Decorator()(MyComponent.prototype, 'bar');
64
63
  expect(component.connectedCallback).toEqual(connectedCallback);
65
64
  expect(component.componentWillLoad).toEqual(componentWillLoad);
66
- expect(component.componentWillUpdate).toEqual(componentWillUpdate);
67
65
  expect(component.componentDidUnload).toEqual(componentDidUnload);
68
66
  expect(component.disconnectedCallback).toEqual(disconnectedCallback);
69
67
  });
@@ -76,7 +74,6 @@ describe('createStateDecorator', function () {
76
74
  }
77
75
  MyComponent.prototype.connectedCallback = function () { };
78
76
  MyComponent.prototype.componentWillLoad = function () { };
79
- MyComponent.prototype.componentWillUpdate = function () { };
80
77
  MyComponent.prototype.componentDidUnload = function () { };
81
78
  MyComponent.prototype.disconnectedCallback = function () { };
82
79
  return MyComponent;
@@ -84,13 +81,11 @@ describe('createStateDecorator', function () {
84
81
  var component = new MyComponent();
85
82
  var connectedCallback = component.connectedCallback;
86
83
  var componentWillLoad = component.componentWillLoad;
87
- var componentWillUpdate = component.componentWillUpdate;
88
84
  var componentDidUnload = component.componentDidUnload;
89
85
  var disconnectedCallback = component.disconnectedCallback;
90
86
  Decorator()(MyComponent.prototype, 'foo');
91
87
  expect(component.connectedCallback).not.toEqual(connectedCallback);
92
88
  expect(component.componentWillLoad).not.toEqual(componentWillLoad);
93
- expect(component.componentWillUpdate).not.toEqual(componentWillUpdate);
94
89
  expect(component.componentDidUnload).not.toEqual(componentDidUnload);
95
90
  expect(component.disconnectedCallback).not.toEqual(disconnectedCallback);
96
91
  });
@@ -109,8 +104,7 @@ describe('createStateDecorator', function () {
109
104
  return MyComponent;
110
105
  }());
111
106
  component = new MyComponent();
112
- element = { platform: null, context: null };
113
- getElement = function () { return element; };
107
+ element = getElement(component);
114
108
  });
115
109
  it('returns a promise that does not resolve', function () {
116
110
  expect.assertions(0);
@@ -148,8 +142,7 @@ describe('createStateDecorator', function () {
148
142
  return MyComponent;
149
143
  }());
150
144
  component = new MyComponent();
151
- element = { platform: null, context: null };
152
- getElement = function () { return element; };
145
+ element = getElement(component);
153
146
  });
154
147
  it('returns a promise that does not resolve', function () {
155
148
  expect.assertions(0);
@@ -301,44 +294,22 @@ describe('createStateDecorator', function () {
301
294
  it('sets the context option to an observable', function () {
302
295
  expect(options.context).toBeInstanceOf(rxjs_1.Subject);
303
296
  });
304
- describe('when componentWillUpdate is invoked without a context change', function () {
305
- it('does not emit a value on the observable', function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
306
- var spy;
307
- return tslib_1.__generator(this, function (_a) {
308
- switch (_a.label) {
309
- case 0:
310
- spy = jest.spyOn(options.context, 'next');
311
- return [4, component.componentWillUpdate()];
312
- case 1:
313
- _a.sent();
314
- expect(spy).not.toHaveBeenCalled();
315
- return [2];
316
- }
317
- });
318
- }); });
319
- });
320
- describe('when componentWillUpdate is invoked with a context change', function () {
321
- it('emits a value on the observable', function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
322
- var spy, subject, value;
323
- return tslib_1.__generator(this, function (_a) {
324
- switch (_a.label) {
325
- case 0:
326
- spy = jest.spyOn(options.context, 'next');
327
- component.context = 'new context';
328
- return [4, component.componentWillUpdate()];
329
- case 1:
330
- _a.sent();
331
- expect(spy).toHaveBeenCalled();
332
- subject = options.context;
333
- return [4, subject.pipe((0, operators_1.take)(1)).toPromise()];
334
- case 2:
335
- value = _a.sent();
336
- expect(value).toEqual('new context');
337
- return [2];
338
- }
339
- });
340
- }); });
341
- });
297
+ it('emits a value on the observable when property is changed', function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
298
+ var spy, value;
299
+ return tslib_1.__generator(this, function (_a) {
300
+ switch (_a.label) {
301
+ case 0:
302
+ spy = jest.spyOn(options.context, 'next');
303
+ getElement(component).context = 'new context';
304
+ expect(spy).toHaveBeenCalled();
305
+ return [4, (0, rxjs_1.firstValueFrom)(options.context)];
306
+ case 1:
307
+ value = _a.sent();
308
+ expect(value).toEqual('new context');
309
+ return [2];
310
+ }
311
+ });
312
+ }); });
342
313
  });
343
314
  describe('when component has lifecycle methods', function () {
344
315
  var component;
@@ -350,7 +321,6 @@ describe('createStateDecorator', function () {
350
321
  methods = {
351
322
  connectedCallback: jest.fn(),
352
323
  componentWillLoad: jest.fn(),
353
- componentWillUpdate: jest.fn(),
354
324
  componentDidUnload: jest.fn(),
355
325
  disconnectedCallback: jest.fn(),
356
326
  };
@@ -405,21 +375,6 @@ describe('createStateDecorator', function () {
405
375
  });
406
376
  }); });
407
377
  });
408
- it('componentWillUpdate invokes the original componentWillUpdate', function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
409
- return tslib_1.__generator(this, function (_a) {
410
- switch (_a.label) {
411
- case 0:
412
- expect(methods.componentWillUpdate).toHaveBeenCalledTimes(0);
413
- expect(component.componentWillUpdate).not.toEqual(methods.componentWillUpdate);
414
- return [4, component.connectedCallback()];
415
- case 1:
416
- _a.sent();
417
- component.componentWillUpdate();
418
- expect(methods.componentWillUpdate).toHaveBeenCalledTimes(1);
419
- return [2];
420
- }
421
- });
422
- }); });
423
378
  it('componentDidUnload invokes the original componentDidUnload', function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
424
379
  return tslib_1.__generator(this, function (_a) {
425
380
  switch (_a.label) {
@@ -493,3 +448,32 @@ var TestService = (function () {
493
448
  };
494
449
  return TestService;
495
450
  }());
451
+ var LimeWebComponentElement = (function (_super) {
452
+ tslib_1.__extends(LimeWebComponentElement, _super);
453
+ function LimeWebComponentElement(component) {
454
+ var _this = _super.call(this) || this;
455
+ _this.component = component;
456
+ return _this;
457
+ }
458
+ Object.defineProperty(LimeWebComponentElement.prototype, "platform", {
459
+ get: function () {
460
+ return this.component.platform;
461
+ },
462
+ set: function (value) {
463
+ this.component.platform = value;
464
+ },
465
+ enumerable: false,
466
+ configurable: true
467
+ });
468
+ Object.defineProperty(LimeWebComponentElement.prototype, "context", {
469
+ get: function () {
470
+ return this.component.context;
471
+ },
472
+ set: function (value) {
473
+ this.component.context = value;
474
+ },
475
+ enumerable: false,
476
+ configurable: true
477
+ });
478
+ return LimeWebComponentElement;
479
+ }(HTMLElement));
@@ -55,7 +55,7 @@ function extendLifecycleHook(component, name, hook) {
55
55
  }
56
56
  var hooks = originalHooks.get(component);
57
57
  if (!hooks[name]) {
58
- hooks[name] = component[name];
58
+ hooks[name] = component[name] ? component[name] : function () { };
59
59
  }
60
60
  component[name] = function () {
61
61
  var args = [];
@@ -63,9 +63,7 @@ function extendLifecycleHook(component, name, hook) {
63
63
  args[_i] = arguments[_i];
64
64
  }
65
65
  hook.apply(this, args);
66
- if (hooks[name]) {
67
- return hooks[name].apply(this, args);
68
- }
66
+ return hooks[name].apply(this, args);
69
67
  };
70
68
  }
71
69
  function setDefault(props) {
@@ -87,13 +87,11 @@ function extendLifecycleHook(component, name, hook) {
87
87
  }
88
88
  const hooks = originalHooks.get(component);
89
89
  if (!hooks[name]) {
90
- hooks[name] = component[name];
90
+ hooks[name] = component[name] ? component[name] : function () { };
91
91
  }
92
92
  component[name] = function (...args) {
93
93
  hook.apply(this, args);
94
- if (hooks[name]) {
95
- return hooks[name].apply(this, args);
96
- }
94
+ return hooks[name].apply(this, args);
97
95
  };
98
96
  }
99
97
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-web-components",
3
- "version": "4.51.3",
3
+ "version": "4.51.6",
4
4
  "author": "Lime Technologies",
5
5
  "homepage": "https://github.com/Lundalogik/lime-web-components",
6
6
  "license": "Apache-2.0",
@@ -39,7 +39,9 @@
39
39
  "@limetech/lime-web-components-commands": "^4.51.2",
40
40
  "@limetech/lime-web-components-decorators": "^4.51.2",
41
41
  "@limetech/lime-web-components-interfaces": "^4.51.2",
42
- "@limetech/lime-web-components-testing": "^4.51.2"
42
+ "@limetech/lime-web-components-testing": "^4.51.2",
43
+ "rxjs": "^7.5.6",
44
+ "tslib": "^2.4.0"
43
45
  },
44
46
  "devDependencies": {
45
47
  "@types/jest": "^27.5.0",
@@ -49,5 +51,5 @@
49
51
  "peerDependencies": {
50
52
  "@stencil/core": "^2.17.1"
51
53
  },
52
- "gitHead": "ed2a3da8138ef6cce7a0b5a5610e38d35d04c5fe"
54
+ "gitHead": "81c379c7688b02295a8f5ca978e5d346681cad6f"
53
55
  }