@getflip/swirl-components-angular 0.197.0 → 0.198.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getflip/swirl-components-angular",
3
- "version": "0.197.0",
3
+ "version": "0.198.0",
4
4
  "scripts": {
5
5
  "ng": "ng",
6
6
  "build": "ng build"
@@ -14,7 +14,7 @@
14
14
  "@angular/platform-browser": "^16.2.12",
15
15
  "@angular/platform-browser-dynamic": "^16.2.12",
16
16
  "@angular/router": "^16.2.12",
17
- "@getflip/swirl-components": "^0.197.0",
17
+ "@getflip/swirl-components": "^0.198.0",
18
18
  "rxjs": "~7.5.0",
19
19
  "tslib": "^2.3.0",
20
20
  "zone.js": "~0.13.3"
@@ -4,46 +4,48 @@ import { fromEvent } from 'rxjs';
4
4
 
5
5
  export const proxyInputs = (Cmp: any, inputs: string[]) => {
6
6
  const Prototype = Cmp.prototype;
7
- inputs.forEach(item => {
7
+ inputs.forEach((item) => {
8
8
  Object.defineProperty(Prototype, item, {
9
9
  get() {
10
10
  return this.el[item];
11
11
  },
12
12
  set(val: any) {
13
13
  this.z.runOutsideAngular(() => (this.el[item] = val));
14
- }
14
+ },
15
+ /**
16
+ * In the event that proxyInputs is called
17
+ * multiple times re-defining these inputs
18
+ * will cause an error to be thrown. As a result
19
+ * we set configurable: true to indicate these
20
+ * properties can be changed.
21
+ */
22
+ configurable: true,
15
23
  });
16
24
  });
17
25
  };
18
26
 
19
27
  export const proxyMethods = (Cmp: any, methods: string[]) => {
20
28
  const Prototype = Cmp.prototype;
21
- methods.forEach(methodName => {
29
+ methods.forEach((methodName) => {
22
30
  Prototype[methodName] = function () {
23
31
  const args = arguments;
24
- return this.z.runOutsideAngular(() =>
25
- this.el[methodName].apply(this.el, args)
26
- );
32
+ return this.z.runOutsideAngular(() => this.el[methodName].apply(this.el, args));
27
33
  };
28
34
  });
29
35
  };
30
36
 
31
37
  export const proxyOutputs = (instance: any, el: any, events: string[]) => {
32
- events.forEach(eventName => instance[eventName] = fromEvent(el, eventName));
33
- }
38
+ events.forEach((eventName) => (instance[eventName] = fromEvent(el, eventName)));
39
+ };
34
40
 
35
41
  export const defineCustomElement = (tagName: string, customElement: any) => {
36
- if (
37
- customElement !== undefined &&
38
- typeof customElements !== 'undefined' &&
39
- !customElements.get(tagName)
40
- ) {
42
+ if (customElement !== undefined && typeof customElements !== 'undefined' && !customElements.get(tagName)) {
41
43
  customElements.define(tagName, customElement);
42
44
  }
43
- }
45
+ };
44
46
 
45
47
  // tslint:disable-next-line: only-arrow-functions
46
- export function ProxyCmp(opts: { defineCustomElementFn?: () => void, inputs?: any; methods?: any }) {
48
+ export function ProxyCmp(opts: { defineCustomElementFn?: () => void; inputs?: any; methods?: any }) {
47
49
  const decorator = function (cls: any) {
48
50
  const { defineCustomElementFn, inputs, methods } = opts;
49
51