be-hive 0.0.214 → 0.0.216

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 (3) hide show
  1. package/aggEvt.js +36 -0
  2. package/aggEvt.ts +40 -0
  3. package/package.json +5 -1
package/aggEvt.js ADDED
@@ -0,0 +1,36 @@
1
+ export const rguid = 'XM5dz7tqZkeFCtytNXHPzw';
2
+ export class AggEvent extends Event {
3
+ r = rguid;
4
+ args;
5
+ // /**
6
+ // * Event view model
7
+ // * @type {{[key: string]: any}}
8
+ // */
9
+ // f;
10
+ /**
11
+ * @type {Element}
12
+ */
13
+ target;
14
+ // /**
15
+ // *
16
+ // * @param {Array<any>} args
17
+ // * @param {{[key: string]: any}} f
18
+ // */
19
+ // constructor(args, f, target){
20
+ // super(CalcEvent.eventName);
21
+ // this.args = args;
22
+ // this.f = f;
23
+ // }
24
+ constructor(type, args, target) {
25
+ super(type);
26
+ this.args = args;
27
+ this.target = target;
28
+ }
29
+ }
30
+ export const aggs = {
31
+ '+': (e) => e.r = e.args.reduce((acc, arg) => acc + arg),
32
+ '*': (e) => e.r = e.args.reduce((acc, arg) => acc * arg),
33
+ max: (e) => e.r = Math.max(...e.args),
34
+ min: (e) => e.r = Math.min(...e.args),
35
+ nearlyEq: (e) => e.r = Math.max(...e.args) - Math.min(...e.args) < Number(e.target.dataset.maxDiff)
36
+ };
package/aggEvt.ts ADDED
@@ -0,0 +1,40 @@
1
+ import { EventListenerOrFn } from "./ts-refs/trans-render/be/types";
2
+
3
+ export const rguid = 'XM5dz7tqZkeFCtytNXHPzw';
4
+ export abstract class AggEvent extends Event {
5
+ r: any = rguid;
6
+ args: Array<any>;
7
+ // /**
8
+ // * Event view model
9
+ // * @type {{[key: string]: any}}
10
+ // */
11
+ // f;
12
+ /**
13
+ * @type {Element}
14
+ */
15
+ target
16
+ // /**
17
+ // *
18
+ // * @param {Array<any>} args
19
+ // * @param {{[key: string]: any}} f
20
+ // */
21
+ // constructor(args, f, target){
22
+ // super(CalcEvent.eventName);
23
+ // this.args = args;
24
+ // this.f = f;
25
+ // }
26
+ constructor(type: string, args: Array<any>, target: Element){
27
+ super(type);
28
+ this.args = args;
29
+ this.target = target;
30
+ }
31
+ }
32
+
33
+ export const aggs: {[key: string]: (e: AggEvent) => void} = {
34
+ '+': (e: AggEvent) => e.r = e.args.reduce((acc, arg) => acc + arg),
35
+ '*': (e: AggEvent) => e.r = e.args.reduce((acc, arg) => acc * arg),
36
+ max: (e: AggEvent) => e.r = Math.max(...(e.args as Array<number>)),
37
+ min: (e: AggEvent) => e.r = Math.min(...(e.args as Array<number>)),
38
+ nearlyEq: (e: AggEvent) => e.r = Math.max(...(e.args as Array<number>)) - Math.min(...(e.args as Array<number>)) < Number((e.target as HTMLElement).dataset.maxDiff)
39
+ };
40
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "be-hive",
3
- "version": "0.0.214",
3
+ "version": "0.0.216",
4
4
  "keywords": [
5
5
  "web-components",
6
6
  "web-component",
@@ -15,6 +15,10 @@
15
15
  "default": "./be-hive.js",
16
16
  "types": "./be-hive.ts"
17
17
  },
18
+ "./aggEvt.js": {
19
+ "default": "./aggEvt.js",
20
+ "types": "./aggEvt.ts"
21
+ },
18
22
  "./be-hive.js": {
19
23
  "default": "./be-hive.js",
20
24
  "types": "./be-hive.ts"