@starley/ion-directives 1.1.1 → 1.1.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.
Files changed (42) hide show
  1. package/dist/{cjs/directives → directives}/input-mask/input-mask.directive.d.ts +0 -0
  2. package/dist/{esm/directives → directives}/input-mask/input-mask.directive.js +1 -9
  3. package/dist/directives/input-mask/input-mask.directive.js.map +1 -0
  4. package/dist/{cjs/directives → directives}/press-hold/press-hold.directive.d.ts +0 -0
  5. package/dist/{esm/directives → directives}/press-hold/press-hold.directive.js +1 -6
  6. package/dist/directives/press-hold/press-hold.directive.js.map +1 -0
  7. package/dist/{cjs/directives → directives}/tap/tap.directive.d.ts +0 -0
  8. package/dist/{esm/directives → directives}/tap/tap.directive.js +1 -6
  9. package/dist/directives/tap/tap.directive.js.map +1 -0
  10. package/dist/index.d.ts +3 -0
  11. package/dist/index.js +4 -0
  12. package/dist/index.js.map +1 -0
  13. package/package.json +4 -8
  14. package/{dist/cjs/directives/input-mask/input-mask.directive.js → src/directives/input-mask/input-mask.directive.ts} +24 -34
  15. package/src/directives/press-hold/press-hold.directive.ts +66 -0
  16. package/src/directives/tap/tap.directive.ts +70 -0
  17. package/src/index.ts +3 -0
  18. package/tsconfig.json +30 -0
  19. package/tslint.json +17 -0
  20. package/dist/cjs/directives/directive.module.d.ts +0 -6
  21. package/dist/cjs/directives/directive.module.js +0 -39
  22. package/dist/cjs/directives/directive.module.js.map +0 -1
  23. package/dist/cjs/directives/input-mask/input-mask.directive.js.map +0 -1
  24. package/dist/cjs/directives/press-hold/press-hold.directive.js +0 -76
  25. package/dist/cjs/directives/press-hold/press-hold.directive.js.map +0 -1
  26. package/dist/cjs/directives/tap/tap.directive.js +0 -84
  27. package/dist/cjs/directives/tap/tap.directive.js.map +0 -1
  28. package/dist/cjs/index.d.ts +0 -1
  29. package/dist/cjs/index.js +0 -6
  30. package/dist/cjs/index.js.map +0 -1
  31. package/dist/esm/directives/directive.module.d.ts +0 -6
  32. package/dist/esm/directives/directive.module.js +0 -36
  33. package/dist/esm/directives/directive.module.js.map +0 -1
  34. package/dist/esm/directives/input-mask/input-mask.directive.d.ts +0 -19
  35. package/dist/esm/directives/input-mask/input-mask.directive.js.map +0 -1
  36. package/dist/esm/directives/press-hold/press-hold.directive.d.ts +0 -25
  37. package/dist/esm/directives/press-hold/press-hold.directive.js.map +0 -1
  38. package/dist/esm/directives/tap/tap.directive.d.ts +0 -29
  39. package/dist/esm/directives/tap/tap.directive.js.map +0 -1
  40. package/dist/esm/index.d.ts +0 -1
  41. package/dist/esm/index.js +0 -2
  42. package/dist/esm/index.js.map +0 -1
@@ -1,12 +1,4 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __param = (this && this.__param) || function (paramIndex, decorator) {
8
- return function (target, key) { decorator(target, key, paramIndex); }
9
- };
1
+ import { __decorate, __param } from "tslib";
10
2
  import { Attribute, Directive } from '@angular/core';
11
3
  import { NgModel } from "@angular/forms";
12
4
  /**
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-mask.directive.js","sourceRoot":"","sources":["../../../src/directives/input-mask/input-mask.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC;;GAEG;AAQI,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAI9B;;;;OAIG;IACH,YAAmB,KAAc,EACV,OAAe;QADnB,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E,CAAC;iBACf;aACJ;YACD,KAAK,GAAG,SAAS,CAAC;SACrB;QACD,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;QAC3B,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACjC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CAEJ,CAAA;AAtDY,qBAAqB;IAPjC,SAAS,CAAC;QACP,QAAQ,EAAE,WAAW;QACrB,IAAI,EAAE;YACF,WAAW,EAAE,mBAAmB;SACnC;QACD,SAAS,EAAE,CAAC,OAAO,CAAC;KACvB,CAAC;IAWO,WAAA,SAAS,CAAC,MAAM,CAAC,CAAA;GAVb,qBAAqB,CAsDjC;SAtDY,qBAAqB"}
@@ -1,9 +1,4 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
1
+ import { __decorate } from "tslib";
7
2
  import { Directive, EventEmitter, HostListener, Output } from '@angular/core';
8
3
  /**
9
4
  * Gerencia pressHold
@@ -0,0 +1 @@
1
+ {"version":3,"file":"press-hold.directive.js","sourceRoot":"","sources":["../../../src/directives/press-hold/press-hold.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AAEtF;;;GAGG;AAKI,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAc3B;QAZU,UAAK,GAAG,IAAI,YAAY,EAAE,C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,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,wBAAwB;QACvD,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;IACrB,CAAC;CAEJ,CAAA;AArDa;IAAT,MAAM,EAAE;iDAA4B;AAsBrC;IAFC,YAAY,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,CAAC;IACtC,YAAY,CAAC,UAAU,EAAE,CAAC,QAAQ,CAAC,CAAC;iDAMpC;AA7BQ,kBAAkB;IAH9B,SAAS,CAAC;QACP,QAAQ,EAAE,gBAAgB;KAC7B,CAAC;GACW,kBAAkB,CAuD9B;SAvDY,kBAAkB"}
@@ -1,9 +1,4 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
1
+ import { __decorate } from "tslib";
7
2
  import { Directive, EventEmitter, HostListener, Output } from '@angular/core';
8
3
  /**
9
4
  * Gerencia tap e doubleTap
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tap.directive.js","sourceRoot":"","sources":["../../../src/directives/tap/tap.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AAEtF;;;GAGG;AAKI,IAAM,YAAY,GAAlB,MAAM,YAAY;IAkBrB;QAhBU,QAAG,GAAG,IAAI,YAAY,EAAE,CAAC;QACzB,cAAS,GAAG,IAAI,YAAY,EAAE,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,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE;YAChD,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;SACnB;aAAM,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE;YAC7D,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;SACzB;QACD,IAAI,CAAC,SAAS,EAAE,CAAC;IACrB,CAAC;IAEO,SAAS;QACb,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,wBAAwB;QACvD,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;IACrB,CAAC;CAEJ,CAAA;AAzDa;IAAT,MAAM,EAAE;yCAA0B;AACzB;IAAT,MAAM,EAAE;+CAAgC;AAyBzC;IADC,YAAY,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,CAAC;8CAcjC;AAzCQ,YAAY;IAHxB,SAAS,CAAC;QACP,QAAQ,EAAE,UAAU;KACvB,CAAC;GACW,YAAY,CA2DxB;SA3DY,YAAY"}
@@ -0,0 +1,3 @@
1
+ export { IonInputMaskDirective } from './directives/input-mask/input-mask.directive';
2
+ export { PressHoldDirective } from './directives/press-hold/press-hold.directive';
3
+ export { TapDirective } from './directives/tap/tap.directive';
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export { IonInputMaskDirective } from './directives/input-mask/input-mask.directive';
2
+ export { PressHoldDirective } from './directives/press-hold/press-hold.directive';
3
+ export { TapDirective } from './directives/tap/tap.directive';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC"}
package/package.json CHANGED
@@ -1,16 +1,12 @@
1
1
  {
2
2
  "name": "@starley/ion-directives",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Directivas internas para ionic",
5
5
  "main": "dist/index.js",
6
- "module": "dist/index.d.ts",
7
- "files": [
8
- "dist"
9
- ],
6
+ "types": "dist/index.d.ts",
10
7
  "scripts": {
11
- "build": "rm -rf dist/ && npm run build:esm && npm run build:cjs",
12
- "build:esm": "tsc",
13
- "build:cjs": "tsc --module CommonJS --outDir dist/cjs"
8
+ "build": "tsc --declaration",
9
+ "dev": "nodemon --watch \"scr//\" --exec \"ts-node dist/index.js\" -e ts"
14
10
  },
15
11
  "peerDependencies": {
16
12
  "@angular/common": "^15.1.1 || ^11.2.4 || ~10.0.0",
@@ -1,37 +1,39 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __param = (this && this.__param) || function (paramIndex, decorator) {
9
- return function (target, key) { decorator(target, key, paramIndex); }
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.IonInputMaskDirective = void 0;
13
- const core_1 = require("@angular/core");
14
- const forms_1 = require("@angular/forms");
1
+ import { Attribute, Directive } from '@angular/core';
2
+ import { NgModel } from "@angular/forms";
3
+
15
4
  /**
16
5
  * Responsavel pelo mascaramento de inputs
17
6
  */
18
- let IonInputMaskDirective = class IonInputMaskDirective {
7
+ @Directive({
8
+ selector: '[appMask]',
9
+ host: {
10
+ '(keydown)': 'onKeyDown($event)'
11
+ },
12
+ providers: [NgModel]
13
+ })
14
+ export class IonInputMaskDirective {
15
+
16
+ pattern: string;
17
+
19
18
  /**
20
19
  * Construtor
21
20
  * @param {NgModel} model
22
21
  * @param {string} pattern
23
22
  */
24
- constructor(model, pattern) {
25
- this.model = model;
23
+ constructor(public model: NgModel,
24
+ @Attribute('mask') pattern: string) {
26
25
  this.pattern = pattern;
26
+
27
27
  console.log('Inicou inputMask');
28
28
  }
29
+
29
30
  /**
30
31
  * Listener para mudança de valor do input
31
32
  * @param event
32
33
  */
33
- onKeyDown(event) {
34
- let value = event.target.value, pattern = this.pattern;
34
+ onKeyDown(event: any) {
35
+ let value = event.target.value,
36
+ pattern = this.pattern;
35
37
  if (event.keyIdentifier === 'U+0008' || event.keyCode === 8 || event.key === 'Backspace') {
36
38
  if (value.length) { //prevent fatal exception when backspacing empty value in progressive web app
37
39
  //remove all trailing formatting then delete character
@@ -43,8 +45,7 @@ let IonInputMaskDirective = class IonInputMaskDirective {
43
45
  value = value.substring(0, value.length - 1);
44
46
  }
45
47
  }
46
- }
47
- else {
48
+ } else {
48
49
  let maskIndex = value.length;
49
50
  let formatted = '';
50
51
  formatted += value;
@@ -63,16 +64,5 @@ let IonInputMaskDirective = class IonInputMaskDirective {
63
64
  }
64
65
  return true;
65
66
  }
66
- };
67
- IonInputMaskDirective = __decorate([
68
- (0, core_1.Directive)({
69
- selector: '[appMask]',
70
- host: {
71
- '(keydown)': 'onKeyDown($event)'
72
- },
73
- providers: [forms_1.NgModel]
74
- }),
75
- __param(1, (0, core_1.Attribute)('mask'))
76
- ], IonInputMaskDirective);
77
- exports.IonInputMaskDirective = IonInputMaskDirective;
78
- //# sourceMappingURL=input-mask.directive.js.map
67
+
68
+ }
@@ -0,0 +1,66 @@
1
+ import { Directive, EventEmitter, HostListener, OnInit, Output } from '@angular/core';
2
+
3
+ /**
4
+ * Gerencia pressHold
5
+ * @author Starley Cazorla
6
+ */
7
+
8
+ @Directive({
9
+ selector: '[appPressHold]'
10
+ })
11
+ export class PressHoldDirective implements OnInit {
12
+
13
+ @Output() press = new EventEmitter();
14
+ pressGesture = {
15
+ name: 'press',
16
+ enabled: false,
17
+ interval: 350
18
+ };
19
+ pressTimeout: any = null;
20
+ isPressing: boolean = false;
21
+ lastTap = 0;
22
+ tapCount = 0;
23
+ tapTimeout: any = null;
24
+
25
+ constructor() {
26
+ console.log('Inicou appPressHold');
27
+ }
28
+
29
+ ngOnInit(): void {
30
+ this.pressGesture.enabled = true;
31
+ }
32
+
33
+ @HostListener('touchstart', ['$event'])
34
+ @HostListener('touchend', ['$event'])
35
+ onPress(event: { type: any; }) {
36
+ if (!this.pressGesture.enabled) {
37
+ return;
38
+ } // Press is not enabled, don't do anything.
39
+ this.handlePressing(event.type);
40
+ }
41
+
42
+ private handlePressing(type: string) { // touchend or touchstart
43
+ if (type == 'touchstart') {
44
+ this.pressTimeout = setTimeout(() => {
45
+ this.isPressing = true;
46
+ }, this.pressGesture.interval); // Considered a press if it's longer than interval (default: 251).
47
+ } else if (type == 'touchend') {
48
+ clearTimeout(this.pressTimeout);
49
+ if (this.isPressing) {
50
+ this.press.emit('end');
51
+ this.resetTaps(); // Just incase this gets passed as a tap event too.
52
+ }
53
+ // Clicks have a natural delay of 300ms, so we have to account for that, before resetting isPressing.
54
+ // Otherwise a tap event is emitted.
55
+ setTimeout(() => this.isPressing = false, 50);
56
+ }
57
+ }
58
+
59
+ private resetTaps() {
60
+ clearTimeout(this.tapTimeout); // clear the old timeout
61
+ this.tapCount = 0;
62
+ this.tapTimeout = null;
63
+ this.lastTap = 0;
64
+ }
65
+
66
+ }
@@ -0,0 +1,70 @@
1
+ import { Directive, EventEmitter, HostListener, OnInit, Output } from '@angular/core';
2
+
3
+ /**
4
+ * Gerencia tap e doubleTap
5
+ * @author Starley Cazorla
6
+ */
7
+
8
+ @Directive({
9
+ selector: '[appTap]'
10
+ })
11
+ export class TapDirective implements OnInit {
12
+
13
+ @Output() tap = new EventEmitter();
14
+ @Output() doubleTap = new EventEmitter();
15
+ lastTap = 0;
16
+ tapCount = 0;
17
+ tapTimeout: any = null;
18
+ tapGesture = {
19
+ name: 'tap',
20
+ enabled: false,
21
+ interval: 250,
22
+ };
23
+ doubleTapGesture = {
24
+ name: 'doubleTap',
25
+ enabled: false,
26
+ interval: 300,
27
+ };
28
+
29
+ constructor() {
30
+ console.log('Inicou appTap');
31
+ }
32
+
33
+ ngOnInit(): void {
34
+ this.tapGesture.enabled = true;
35
+ this.doubleTapGesture.enabled = true;
36
+ }
37
+
38
+ @HostListener('click', ['$event'])
39
+ handleTaps(e: { timeStamp: number; }) {
40
+ const tapTimestamp = Math.floor(e.timeStamp);
41
+ const isDoubleTap = this.lastTap + this.tapGesture.interval > tapTimestamp;
42
+ if (!this.tapGesture.enabled && !this.doubleTapGesture.enabled) {
43
+ return this.resetTaps();
44
+ }
45
+ this.tapCount++;
46
+ if (isDoubleTap && this.doubleTapGesture.enabled) {
47
+ this.emitTaps();
48
+ } else if (!isDoubleTap) {
49
+ this.tapTimeout = setTimeout(() => this.emitTaps(), this.tapGesture.interval);
50
+ }
51
+ this.lastTap = tapTimestamp;
52
+ }
53
+
54
+ private emitTaps() {
55
+ if (this.tapCount === 1 && this.tapGesture.enabled) {
56
+ this.tap.emit();
57
+ } else if (this.tapCount === 2 && this.doubleTapGesture.enabled) {
58
+ this.doubleTap.emit();
59
+ }
60
+ this.resetTaps();
61
+ }
62
+
63
+ private resetTaps() {
64
+ clearTimeout(this.tapTimeout); // clear the old timeout
65
+ this.tapCount = 0;
66
+ this.tapTimeout = null;
67
+ this.lastTap = 0;
68
+ }
69
+
70
+ }
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { IonInputMaskDirective } from './directives/input-mask/input-mask.directive';
2
+ export { PressHoldDirective } from './directives/press-hold/press-hold.directive';
3
+ export { TapDirective } from './directives/tap/tap.directive';
package/tsconfig.json ADDED
@@ -0,0 +1,30 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "compileOnSave": false,
4
+ "compilerOptions": {
5
+ "baseUrl": "./",
6
+ "outDir": "./dist",
7
+ "forceConsistentCasingInFileNames": true,
8
+ "allowSyntheticDefaultImports": true,
9
+ "strict": true,
10
+ "noImplicitOverride": true,
11
+ "noPropertyAccessFromIndexSignature": true,
12
+ "noImplicitReturns": true,
13
+ "noFallthroughCasesInSwitch": true,
14
+ "sourceMap": true,
15
+ "declaration": false,
16
+ "downlevelIteration": true,
17
+ "experimentalDecorators": true,
18
+ "moduleResolution": "node",
19
+ "importHelpers": true,
20
+ "target": "es2015",
21
+ "module": "es2020",
22
+ "lib": [
23
+ "es2018",
24
+ "dom"
25
+ ],
26
+ "useDefineForClassFields": false
27
+ },
28
+ "include": ["src/**/*"],
29
+ "exclude": ["node_modules", "**/*.test.ts"]
30
+ }
package/tslint.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "extends": "../../../tslint.json",
3
+ "rules": {
4
+ "directive-selector": [
5
+ true,
6
+ "attribute",
7
+ "lib",
8
+ "camelCase"
9
+ ],
10
+ "component-selector": [
11
+ true,
12
+ "element",
13
+ "lib",
14
+ "kebab-case"
15
+ ]
16
+ }
17
+ }
@@ -1,6 +0,0 @@
1
- /**
2
- * Gerencia precionamento de enventos
3
- * @author Starley Cazorla
4
- */
5
- export declare class DirectivesModule {
6
- }
@@ -1,39 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.DirectivesModule = void 0;
10
- const core_1 = require("@angular/core");
11
- const common_1 = require("@angular/common");
12
- const press_hold_directive_1 = require("./press-hold/press-hold.directive");
13
- const tap_directive_1 = require("./tap/tap.directive");
14
- const input_mask_directive_1 = require("./input-mask/input-mask.directive");
15
- /**
16
- * Gerencia precionamento de enventos
17
- * @author Starley Cazorla
18
- */
19
- let DirectivesModule = class DirectivesModule {
20
- };
21
- DirectivesModule = __decorate([
22
- (0, core_1.NgModule)({
23
- declarations: [
24
- press_hold_directive_1.PressHoldDirective,
25
- tap_directive_1.TapDirective,
26
- input_mask_directive_1.IonInputMaskDirective
27
- ],
28
- imports: [
29
- common_1.CommonModule
30
- ],
31
- exports: [
32
- press_hold_directive_1.PressHoldDirective,
33
- tap_directive_1.TapDirective,
34
- input_mask_directive_1.IonInputMaskDirective
35
- ]
36
- })
37
- ], DirectivesModule);
38
- exports.DirectivesModule = DirectivesModule;
39
- //# sourceMappingURL=directive.module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"directive.module.js","sourceRoot":"","sources":["../../../src/directives/directive.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,wCAAyC;AACzC,4CAA+C;AAC/C,4EAAuE;AACvE,uDAAmD;AACnD,4EAA0E;AAE1E;;;GAGG;AAkBI,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAAI,CAAA;AAApB,gBAAgB;IAhB5B,IAAA,eAAQ,EAAC;QACN,YAAY,EAAE;YACV,yCAAkB;YAClB,4BAAY;YACZ,4CAAqB;SACxB;QACD,OAAO,EAAE;YACL,qBAAY;SACf;QACD,OAAO,EAAE;YACL,yCAAkB;YAClB,4BAAY;YACZ,4CAAqB;SACxB;KAEJ,CAAC;GACW,gBAAgB,CAAI;AAApB,4CAAgB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"input-mask.directive.js","sourceRoot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I,KAAK,CAAC;YACnB,IAAI,SAAS,GAAG,OAAO,CAAC,MAAM,EAAE;gBAC5B,2BAA2B;gBAC3B,OAAO,OAAO,CAAC,SAAS,CAAC,KAAK,GAAG,EAAE;oBAC/B,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;oBAChC,SAAS,EAAE,CAAC;iBACf;aACJ;YACD,KAAK,GAAG,SAAS,CAAC;SACrB;QACD,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;QAC3B,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACjC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CAEJ,CAAA;AAtDY,qBAAqB;IAPjC,IAAA,gBAAS,EAAC;QACP,QAAQ,EAAE,WAAW;QACrB,IAAI,EAAE;YACF,WAAW,EAAE,mBAAmB;SACnC;QACD,SAAS,EAAE,CAAC,eAAO,CAAC;KACvB,CAAC;IAWO,WAAA,IAAA,gBAAS,EAAC,MAAM,CAAC,CAAA;GAVb,qBAAqB,CAsDjC;AAtDY,sDAAqB"}
@@ -1,76 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.PressHoldDirective = void 0;
10
- const core_1 = require("@angular/core");
11
- /**
12
- * Gerencia pressHold
13
- * @author Starley Cazorla
14
- */
15
- let PressHoldDirective = class PressHoldDirective {
16
- constructor() {
17
- this.press = new core_1.EventEmitter();
18
- this.pressGesture = {
19
- name: 'press',
20
- enabled: false,
21
- interval: 350
22
- };
23
- this.pressTimeout = null;
24
- this.isPressing = false;
25
- this.lastTap = 0;
26
- this.tapCount = 0;
27
- this.tapTimeout = null;
28
- console.log('Inicou appPressHold');
29
- }
30
- ngOnInit() {
31
- this.pressGesture.enabled = true;
32
- }
33
- onPress(event) {
34
- if (!this.pressGesture.enabled) {
35
- return;
36
- } // Press is not enabled, don't do anything.
37
- this.handlePressing(event.type);
38
- }
39
- handlePressing(type) {
40
- if (type == 'touchstart') {
41
- this.pressTimeout = setTimeout(() => {
42
- this.isPressing = true;
43
- }, this.pressGesture.interval); // Considered a press if it's longer than interval (default: 251).
44
- }
45
- else if (type == 'touchend') {
46
- clearTimeout(this.pressTimeout);
47
- if (this.isPressing) {
48
- this.press.emit('end');
49
- this.resetTaps(); // Just incase this gets passed as a tap event too.
50
- }
51
- // Clicks have a natural delay of 300ms, so we have to account for that, before resetting isPressing.
52
- // Otherwise a tap event is emitted.
53
- setTimeout(() => this.isPressing = false, 50);
54
- }
55
- }
56
- resetTaps() {
57
- clearTimeout(this.tapTimeout); // clear the old timeout
58
- this.tapCount = 0;
59
- this.tapTimeout = null;
60
- this.lastTap = 0;
61
- }
62
- };
63
- __decorate([
64
- (0, core_1.Output)()
65
- ], PressHoldDirective.prototype, "press", void 0);
66
- __decorate([
67
- (0, core_1.HostListener)('touchstart', ['$event']),
68
- (0, core_1.HostListener)('touchend', ['$event'])
69
- ], PressHoldDirective.prototype, "onPress", null);
70
- PressHoldDirective = __decorate([
71
- (0, core_1.Directive)({
72
- selector: '[appPressHold]'
73
- })
74
- ], PressHoldDirective);
75
- exports.PressHoldDirective = PressHoldDirective;
76
- //# sourceMappingURL=press-hold.directive.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"press-hold.directive.js","sourceRoot":"","sources":["../../../../src/directives/press-hold/press-hold.directive.ts"],"names":[],"mappings":";;;;;;;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AC,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,GAAG,KAAK,EAAE,EAAE,CAAC,CAAC;SACjD;IACL,CAAC;IAEO,SAAS;QACb,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,wBAAwB;QACvD,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;IACrB,CAAC;CAEJ,CAAA;AArDa;IAAT,IAAA,aAAM,GAAE;iDAA4B;AAsBrC;IAFC,IAAA,mBAAY,EAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,CAAC;IACtC,IAAA,mBAAY,EAAC,UAAU,EAAE,CAAC,QAAQ,CAAC,CAAC;iDAMpC;AA7BQ,kBAAkB;IAH9B,IAAA,gBAAS,EAAC;QACP,QAAQ,EAAE,gBAAgB;KAC7B,CAAC;GACW,kBAAkB,CAuD9B;AAvDY,gDAAkB"}
@@ -1,84 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.TapDirective = void 0;
10
- const core_1 = require("@angular/core");
11
- /**
12
- * Gerencia tap e doubleTap
13
- * @author Starley Cazorla
14
- */
15
- let TapDirective = class TapDirective {
16
- constructor() {
17
- this.tap = new core_1.EventEmitter();
18
- this.doubleTap = new core_1.EventEmitter();
19
- this.lastTap = 0;
20
- this.tapCount = 0;
21
- this.tapTimeout = null;
22
- this.tapGesture = {
23
- name: 'tap',
24
- enabled: false,
25
- interval: 250,
26
- };
27
- this.doubleTapGesture = {
28
- name: 'doubleTap',
29
- enabled: false,
30
- interval: 300,
31
- };
32
- console.log('Inicou appTap');
33
- }
34
- ngOnInit() {
35
- this.tapGesture.enabled = true;
36
- this.doubleTapGesture.enabled = true;
37
- }
38
- handleTaps(e) {
39
- const tapTimestamp = Math.floor(e.timeStamp);
40
- const isDoubleTap = this.lastTap + this.tapGesture.interval > tapTimestamp;
41
- if (!this.tapGesture.enabled && !this.doubleTapGesture.enabled) {
42
- return this.resetTaps();
43
- }
44
- this.tapCount++;
45
- if (isDoubleTap && this.doubleTapGesture.enabled) {
46
- this.emitTaps();
47
- }
48
- else if (!isDoubleTap) {
49
- this.tapTimeout = setTimeout(() => this.emitTaps(), this.tapGesture.interval);
50
- }
51
- this.lastTap = tapTimestamp;
52
- }
53
- emitTaps() {
54
- if (this.tapCount === 1 && this.tapGesture.enabled) {
55
- this.tap.emit();
56
- }
57
- else if (this.tapCount === 2 && this.doubleTapGesture.enabled) {
58
- this.doubleTap.emit();
59
- }
60
- this.resetTaps();
61
- }
62
- resetTaps() {
63
- clearTimeout(this.tapTimeout); // clear the old timeout
64
- this.tapCount = 0;
65
- this.tapTimeout = null;
66
- this.lastTap = 0;
67
- }
68
- };
69
- __decorate([
70
- (0, core_1.Output)()
71
- ], TapDirective.prototype, "tap", void 0);
72
- __decorate([
73
- (0, core_1.Output)()
74
- ], TapDirective.prototype, "doubleTap", void 0);
75
- __decorate([
76
- (0, core_1.HostListener)('click', ['$event'])
77
- ], TapDirective.prototype, "handleTaps", null);
78
- TapDirective = __decorate([
79
- (0, core_1.Directive)({
80
- selector: '[appTap]'
81
- })
82
- ], TapDirective);
83
- exports.TapDirective = TapDirective;
84
- //# sourceMappingURL=tap.directive.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tap.directive.js","sourceRoot":"","sources":["../../../../src/directives/tap/tap.directive.ts"],"names":[],"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AAC,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;SACjF;QACD,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC;IAChC,CAAC;IAEO,QAAQ;QACZ,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE;YAChD,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;SACnB;aAAM,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE;YAC7D,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;SACzB;QACD,IAAI,CAAC,SAAS,EAAE,CAAC;IACrB,CAAC;IAEO,SAAS;QACb,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,wBAAwB;QACvD,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;IACrB,CAAC;CAEJ,CAAA;AAzDa;IAAT,IAAA,aAAM,GAAE;yCAA0B;AACzB;IAAT,IAAA,aAAM,GAAE;+CAAgC;AAyBzC;IADC,IAAA,mBAAY,EAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,CAAC;8CAcjC;AAzCQ,YAAY;IAHxB,IAAA,gBAAS,EAAC;QACP,QAAQ,EAAE,UAAU;KACvB,CAAC;GACW,YAAY,CA2DxB;AA3DY,oCAAY"}
@@ -1 +0,0 @@
1
- export { DirectivesModule } from './directives/directive.module';
package/dist/cjs/index.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DirectivesModule = void 0;
4
- var directive_module_1 = require("./directives/directive.module");
5
- Object.defineProperty(exports, "DirectivesModule", { enumerable: true, get: function () { return directive_module_1.DirectivesModule; } });
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,kEAAiE;AAAxD,oHAAA,gBAAgB,OAAA"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Gerencia precionamento de enventos
3
- * @author Starley Cazorla
4
- */
5
- export declare class DirectivesModule {
6
- }
@@ -1,36 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { NgModule } from '@angular/core';
8
- import { CommonModule } from '@angular/common';
9
- import { PressHoldDirective } from './press-hold/press-hold.directive';
10
- import { TapDirective } from './tap/tap.directive';
11
- import { IonInputMaskDirective } from './input-mask/input-mask.directive';
12
- /**
13
- * Gerencia precionamento de enventos
14
- * @author Starley Cazorla
15
- */
16
- let DirectivesModule = class DirectivesModule {
17
- };
18
- DirectivesModule = __decorate([
19
- NgModule({
20
- declarations: [
21
- PressHoldDirective,
22
- TapDirective,
23
- IonInputMaskDirective
24
- ],
25
- imports: [
26
- CommonModule
27
- ],
28
- exports: [
29
- PressHoldDirective,
30
- TapDirective,
31
- IonInputMaskDirective
32
- ]
33
- })
34
- ], DirectivesModule);
35
- export { DirectivesModule };
36
- //# sourceMappingURL=directive.module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"directive.module.js","sourceRoot":"","sources":["../../../src/directives/directive.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E;;;GAGG;AAkBI,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAAI,CAAA;AAApB,gBAAgB;IAhB5B,QAAQ,CAAC;QACN,YAAY,EAAE;YACV,kBAAkB;YAClB,YAAY;YACZ,qBAAqB;SACxB;QACD,OAAO,EAAE;YACL,YAAY;SACf;QACD,OAAO,EAAE;YACL,kBAAkB;YAClB,YAAY;YACZ,qBAAqB;SACxB;KAEJ,CAAC;GACW,gBAAgB,CAAI;SAApB,gBAAgB"}
@@ -1,19 +0,0 @@
1
- import { NgModel } from "@angular/forms";
2
- /**
3
- * Responsavel pelo mascaramento de inputs
4
- */
5
- export declare class IonInputMaskDirective {
6
- model: NgModel;
7
- pattern: string;
8
- /**
9
- * Construtor
10
- * @param {NgModel} model
11
- * @param {string} pattern
12
- */
13
- constructor(model: NgModel, pattern: string);
14
- /**
15
- * Listener para mudança de valor do input
16
- * @param event
17
- */
18
- onKeyDown(event: any): boolean;
19
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"input-mask.directive.js","sourceRoot":"","sources":["../../../../src/directives/input-mask/input-mask.directive.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC;;GAEG;AAQI,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAI9B;;;;OAIG;IACH,YAAmB,KAAc,EACV,OAAe;QADnB,UAAK,GAAL,KAAK,CAAS;QAE7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,OAAO,CAAC,GAAG,CAA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KAAK,CAAC;QAC3B,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACjC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CAEJ,CAAA;AAtDY,qBAAqB;IAPjC,SAAS,CAAC;QACP,QAAQ,EAAE,WAAW;QACrB,IAAI,EAAE;YACF,WAAW,EAAE,mBAAmB;SACnC;QACD,SAAS,EAAE,CAAC,OAAO,CAAC;KACvB,CAAC;IAWO,WAAA,SAAS,CAAC,MAAM,CAAC,CAAA;GAVb,qBAAqB,CAsDjC;SAtDY,qBAAqB"}
@@ -1,25 +0,0 @@
1
- import { EventEmitter, OnInit } from '@angular/core';
2
- /**
3
- * Gerencia pressHold
4
- * @author Starley Cazorla
5
- */
6
- export declare class PressHoldDirective implements OnInit {
7
- press: EventEmitter<any>;
8
- pressGesture: {
9
- name: string;
10
- enabled: boolean;
11
- interval: number;
12
- };
13
- pressTimeout: any;
14
- isPressing: boolean;
15
- lastTap: number;
16
- tapCount: number;
17
- tapTimeout: any;
18
- constructor();
19
- ngOnInit(): void;
20
- onPress(event: {
21
- type: any;
22
- }): void;
23
- private handlePressing;
24
- private resetTaps;
25
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"press-hold.directive.js","sourceRoot":"","sources":["../../../../src/directives/press-hold/press-hold.directive.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AAEtF;;;GAGG;AAKI,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAc3B;QAZU,UAAK,GAAG,IAAI,YAAY,EAAE,CAAC;QACrC,iBAAY,GAAG;YACX,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,KAAK;YACd,QAAQ,EAAE,GAAG;SAChB,CAAC;QACF,iBAAY,GAAQ,IAAI,CAAC;QACzB,eAAU,GAAY,K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AAG,CAAC,CAAC;IACrB,CAAC;CAEJ,CAAA;AArDa;IAAT,MAAM,EAAE;iDAA4B;AAsBrC;IAFC,YAAY,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,CAAC;IACtC,YAAY,CAAC,UAAU,EAAE,CAAC,QAAQ,CAAC,CAAC;iDAMpC;AA7BQ,kBAAkB;IAH9B,SAAS,CAAC;QACP,QAAQ,EAAE,gBAAgB;KAC7B,CAAC;GACW,kBAAkB,CAuD9B;SAvDY,kBAAkB"}
@@ -1,29 +0,0 @@
1
- import { EventEmitter, OnInit } from '@angular/core';
2
- /**
3
- * Gerencia tap e doubleTap
4
- * @author Starley Cazorla
5
- */
6
- export declare class TapDirective implements OnInit {
7
- tap: EventEmitter<any>;
8
- doubleTap: EventEmitter<any>;
9
- lastTap: number;
10
- tapCount: number;
11
- tapTimeout: any;
12
- tapGesture: {
13
- name: string;
14
- enabled: boolean;
15
- interval: number;
16
- };
17
- doubleTapGesture: {
18
- name: string;
19
- enabled: boolean;
20
- interval: number;
21
- };
22
- constructor();
23
- ngOnInit(): void;
24
- handleTaps(e: {
25
- timeStamp: number;
26
- }): void;
27
- private emitTaps;
28
- private resetTaps;
29
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"tap.directive.js","sourceRoot":"","sources":["../../../../src/directives/tap/tap.directive.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AAEtF;;;GAGG;AAKI,IAAM,YAAY,GAAlB,MAAM,YAAY;IAkBrB;QAhBU,QAAG,GAAG,IAAI,YAAY,EAAE,CAAC;QACzB,cAAS,GAAG,IAAI,YAAY,EAAE,CAAC;QACzC,YAAO,GAAG,CAAC,CAAC;QACZ,aAAQ,GAAG,CAAC,CAAC;QACb,eAAU,GAAQ,IAAI,CAAC;QACvB,eAAU,GAAG;YACT,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,KAAK;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AAQ,KAAK,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE;YAC7D,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;SACzB;QACD,IAAI,CAAC,SAAS,EAAE,CAAC;IACrB,CAAC;IAEO,SAAS;QACb,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,wBAAwB;QACvD,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;IACrB,CAAC;CAEJ,CAAA;AAzDa;IAAT,MAAM,EAAE;yCAA0B;AACzB;IAAT,MAAM,EAAE;+CAAgC;AAyBzC;IADC,YAAY,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,CAAC;8CAcjC;AAzCQ,YAAY;IAHxB,SAAS,CAAC;QACP,QAAQ,EAAE,UAAU;KACvB,CAAC;GACW,YAAY,CA2DxB;SA3DY,YAAY"}
@@ -1 +0,0 @@
1
- export { DirectivesModule } from './directives/directive.module';
package/dist/esm/index.js DELETED
@@ -1,2 +0,0 @@
1
- export { DirectivesModule } from './directives/directive.module';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC"}