@starley/ion-directives 1.2.5 → 1.2.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.
@@ -3,6 +3,7 @@ import { PressHoldDirective } from './press-hold/press-hold.directive';
3
3
  import { TapDirective } from './tap/tap.directive';
4
4
  import { IonInputMaskDirective } from './input-mask/input-mask.directive';
5
5
  import { CommonModule } from '@angular/common';
6
+ import { IonInputMaskService } from './input-mask/input-mask.service';
6
7
  import * as i0 from "@angular/core";
7
8
  /**
8
9
  * Gerencia precionamento de enventos
@@ -19,7 +20,9 @@ var DirectivesModule = /** @class */ (function () {
19
20
  };
20
21
  DirectivesModule.ɵfac = function DirectivesModule_Factory(t) { return new (t || DirectivesModule)(); };
21
22
  DirectivesModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: DirectivesModule });
22
- DirectivesModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule] });
23
+ DirectivesModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ providers: [
24
+ IonInputMaskService
25
+ ], imports: [CommonModule] });
23
26
  return DirectivesModule;
24
27
  }());
25
28
  export { DirectivesModule };
@@ -39,6 +42,9 @@ export { DirectivesModule };
39
42
  TapDirective,
40
43
  IonInputMaskDirective
41
44
  ],
45
+ providers: [
46
+ IonInputMaskService
47
+ ],
42
48
  schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA]
43
49
  }]
44
50
  }], null, null); })();
@@ -1 +1 @@
1
- {"version":3,"file":"directive.module.js","sourceRoot":"","sources":["../src/directive.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAuB,QAAQ,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACxG,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;;AAE/C;;;GAGG;AAEH;IAAA;KAwBE;IANS,wBAAO,GAAd;QACI,OAAO;YACH,QAAQ,EAAE,gBAAgB;YAC1B,SAAS,EAAE,EAAE;SAChB,CAAC;IACN,CAAC;oFANQ,gBAAgB;sEAAhB,gBAAgB;0EAVrB,YAAY;2BAlBpB;CAmCE,AAxBF,IAwBE;SAPW,gBAAgB;uFAAhB,gBAAgB;cAjB5B,QAAQ;eAAC;gBACN,YAAY,EAAE;oBACV,kBAAkB;oBAClB,YAAY;oBACZ,qBAAqB;iBACxB;gBACD,OAAO,EAAE;oBACL,YAAY;iBACf;gBACD,OAAO,EAAE;oBACL,kBAAkB;oBAClB,YAAY;oBACZ,qBAAqB;iBACxB;gBACD,OAAO,EAAE,CAAC,sBAAsB,EAAE,gBAAgB,CAAC;aAEtD;;wFACY,gBAAgB,mBAfrB,kBAAkB;QAClB,YAAY;QACZ,qBAAqB,aAGrB,YAAY,aAGZ,kBAAkB;QAClB,YAAY;QACZ,qBAAqB","sourcesContent":["import { CUSTOM_ELEMENTS_SCHEMA, ModuleWithProviders, NgModule, NO_ERRORS_SCHEMA } from '@angular/core';\nimport { PressHoldDirective } from './press-hold/press-hold.directive';\nimport { TapDirective } from './tap/tap.directive';\nimport { IonInputMaskDirective } from './input-mask/input-mask.directive';\nimport { CommonModule } from '@angular/common';\n\n/**\n * Gerencia precionamento de enventos\n * @author Starley Cazorla\n */\n\n@NgModule({\n declarations: [\n PressHoldDirective,\n TapDirective,\n IonInputMaskDirective\n ],\n imports: [\n CommonModule\n ],\n exports: [\n PressHoldDirective,\n TapDirective,\n IonInputMaskDirective\n ],\n schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA]\n\n})\nexport class DirectivesModule {\n static forRoot(): ModuleWithProviders<DirectivesModule> {\n return {\n ngModule: DirectivesModule,\n providers: []\n };\n }\n }\n"]}
1
+ {"version":3,"file":"directive.module.js","sourceRoot":"","sources":["../src/directive.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAuB,QAAQ,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACxG,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;;AAEtE;;;GAGG;AAEH;IAAA;KA2BC;IANU,wBAAO,GAAd;QACI,OAAO;YACH,QAAQ,EAAE,gBAAgB;YAC1B,SAAS,EAAE,EAAE;SAChB,CAAC;IACN,CAAC;oFANQ,gBAAgB;sEAAhB,gBAAgB;2EANd;YACP,mBAAmB;SACtB,YATG,YAAY;2BAnBpB;CAuCC,AA3BD,IA2BC;SAPY,gBAAgB;uFAAhB,gBAAgB;cApB5B,QAAQ;eAAC;gBACN,YAAY,EAAE;oBACV,kBAAkB;oBAClB,YAAY;oBACZ,qBAAqB;iBACxB;gBACD,OAAO,EAAE;oBACL,YAAY;iBACf;gBACD,OAAO,EAAE;oBACL,kBAAkB;oBAClB,YAAY;oBACZ,qBAAqB;iBACxB;gBACD,SAAS,EAAE;oBACP,mBAAmB;iBACtB;gBACD,OAAO,EAAE,CAAC,sBAAsB,EAAE,gBAAgB,CAAC;aAEtD;;wFACY,gBAAgB,mBAlBrB,kBAAkB;QAClB,YAAY;QACZ,qBAAqB,aAGrB,YAAY,aAGZ,kBAAkB;QAClB,YAAY;QACZ,qBAAqB","sourcesContent":["import { CUSTOM_ELEMENTS_SCHEMA, ModuleWithProviders, NgModule, NO_ERRORS_SCHEMA } from '@angular/core';\nimport { PressHoldDirective } from './press-hold/press-hold.directive';\nimport { TapDirective } from './tap/tap.directive';\nimport { IonInputMaskDirective } from './input-mask/input-mask.directive';\nimport { CommonModule } from '@angular/common';\nimport { IonInputMaskService } from './input-mask/input-mask.service';\n\n/**\n * Gerencia precionamento de enventos\n * @author Starley Cazorla\n */\n\n@NgModule({\n declarations: [\n PressHoldDirective,\n TapDirective,\n IonInputMaskDirective\n ],\n imports: [\n CommonModule\n ],\n exports: [\n PressHoldDirective,\n TapDirective,\n IonInputMaskDirective\n ],\n providers: [\n IonInputMaskService\n ],\n schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA]\n\n})\nexport class DirectivesModule {\n static forRoot(): ModuleWithProviders<DirectivesModule> {\n return {\n ngModule: DirectivesModule,\n providers: []\n };\n }\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './input-mask/input-mask.directive';
2
2
  export * from './press-hold/press-hold.directive';
3
+ export * from './input-mask/input-mask.service';
3
4
  export * from './tap/tap.directive';
4
5
  export * from './directive.module';
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './input-mask/input-mask.directive';
2
2
  export * from './press-hold/press-hold.directive';
3
+ export * from './input-mask/input-mask.service';
3
4
  export * from './tap/tap.directive';
4
5
  export * from './directive.module';
5
6
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAA;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './input-mask/input-mask.directive'\nexport * from './press-hold/press-hold.directive';\nexport * from './tap/tap.directive'\nexport * from './directive.module';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAA;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './input-mask/input-mask.directive'\nexport * from './press-hold/press-hold.directive';\nexport * from './input-mask/input-mask.service';\nexport * from './tap/tap.directive'\nexport * from './directive.module';\n"]}
@@ -19,13 +19,6 @@ export declare class IonInputMaskDirective {
19
19
  * @param event
20
20
  */
21
21
  onKeyDown(event: any): boolean;
22
- /**
23
- * Aplica mascara via metodo
24
- * @author Starley Cazorla
25
- * @param value - Valor a ser mascarado
26
- * @param mask - Mascara desejada; Ex: "(**) ****-****"
27
- */
28
- applyMask(value: any, mask: string): boolean;
29
22
  static ɵfac: i0.ɵɵFactoryDeclaration<IonInputMaskDirective, [null, { attribute: "appMask"; }]>;
30
23
  static ɵdir: i0.ɵɵDirectiveDeclaration<IonInputMaskDirective, "[appMask]", never, {}, {}, never, never, false, never>;
31
24
  }
@@ -58,16 +58,6 @@ var IonInputMaskDirective = /** @class */ (function () {
58
58
  }
59
59
  return true;
60
60
  };
61
- /**
62
- * Aplica mascara via metodo
63
- * @author Starley Cazorla
64
- * @param value - Valor a ser mascarado
65
- * @param mask - Mascara desejada; Ex: "(**) ****-****"
66
- */
67
- IonInputMaskDirective.prototype.applyMask = function (value, mask) {
68
- this.pattern = mask;
69
- return this.onKeyDown(value);
70
- };
71
61
  IonInputMaskDirective.ɵfac = function IonInputMaskDirective_Factory(t) { return new (t || IonInputMaskDirective)(i0.ɵɵdirectiveInject(i1.NgModel), i0.ɵɵinjectAttribute('appMask')); };
72
62
  IonInputMaskDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: IonInputMaskDirective, selectors: [["", "appMask", ""]], hostBindings: function IonInputMaskDirective_HostBindings(rf, ctx) { if (rf & 1) {
73
63
  i0.ɵɵlistener("keydown", function IonInputMaskDirective_keydown_HostBindingHandler($event) { return ctx.onKeyDown($event); });
@@ -1 +1 @@
1
- {"version":3,"file":"input-mask.directive.js","sour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G,KAAK,CAAC,MAAM,CAAC;gBAC7B,IAAI,SAAS,GAAG,EAAE,CAAC;gBACnB,SAAS,IAAI,KAAK,CAAC;gBACnB,IAAI,SAAS,GAAG,OAAO,CAAC,MAAM,EAAE;oBAC5B,2BAA2B;oBAC3B,OAAO,OAAO,CAAC,SAAS,CAAC,KAAK,GAAG,EAAE;wBAC/B,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;wBAChC,SAAS,EAAE,CAAC;qBACf;iBACJ;gBACD,KAAK,GAAG,SAAS,CAAC;aACrB;SACJ;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;IAED;;;;;OAKG;IACI,yCAAS,GAAhB,UAAiB,KAAU,EAAE,IAAY;QACrC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;8FAjEQ,qBAAqB,yDAUf,SAAS;4EAVf,qBAAqB;gHAArB,qBAAiB;8CAFf,CAAC,OAAO,CAAC;gCAdxB;CAmFC,AA1ED,IA0EC;SAnEY,qBAAqB;uFAArB,qBAAqB;cAPjC,SAAS;eAAC;gBACP,QAAQ,EAAE,WAAW;gBACrB,IAAI,EAAE;oBACF,WAAW,EAAE,mBAAmB;iBACnC;gBACD,SAAS,EAAE,CAAC,OAAO,CAAC;aACvB;;sBAWQ,SAAS;uBAAC,SAAS","sourcesContent":["import { Attribute, Directive } from '@angular/core';\nimport { NgModel } from \"@angular/forms\";\n\n/**\n * Responsavel pelo mascaramento de inputs\n * @author Thiago Przyczynski\n * przyczynski@gmail.com\n */\n\n@Directive({\n selector: '[appMask]',\n host: {\n '(keydown)': 'onKeyDown($event)'\n },\n providers: [NgModel]\n})\nexport class IonInputMaskDirective {\n\n pattern: string;\n\n /**\n * Construtor\n * @param {NgModel} model\n * @param {string} pattern\n */\n constructor(public model: NgModel,\n @Attribute('appMask') pattern: string = null) {\n this.pattern = pattern;\n }\n\n /**\n * Listener para mudança de valor do input\n * @param event\n */\n onKeyDown(event: any) {\n let value = event.target.value,\n pattern = this.pattern;\n if (pattern !== null) {\n if (event.keyIdentifier === 'U+0008' || event.keyCode === 8 || event.key === 'Backspace') {\n if (value.length) { //prevent fatal exception when backspacing empty value in progressive web app\n //remove all trailing formatting then delete character\n while (pattern[value.length] && pattern[value.length] !== '*') {\n value = value.substring(0, value.length - 1);\n }\n //remove all leading formatting to restore placeholder\n if (pattern.substring(0, value.length).indexOf('*') < 0) {\n value = value.substring(0, value.length - 1);\n }\n }\n\n // Caso o padrao esteja definido como null ira retornar o valor digitado!\n } else {\n let maskIndex = value.length;\n let formatted = '';\n formatted += value;\n if (maskIndex < pattern.length) {\n //apply trailing formatting\n while (pattern[maskIndex] !== '*') {\n formatted += pattern[maskIndex];\n maskIndex++;\n }\n }\n value = formatted;\n }\n }\n event.target.value = value;\n if (this.model) {\n this.model.update.emit(value);\n }\n return true;\n }\n\n /**\n * Aplica mascara via metodo\n * @author Starley Cazorla\n * @param value - Valor a ser mascarado \n * @param mask - Mascara desejada; Ex: \"(**) ****-****\"\n */\n public applyMask(value: any, mask: string) {\n this.pattern = mask;\n return this.onKeyDown(value);\n }\n\n}"]}
1
+ {"version":3,"file":"input-mask.directive.js","sourceRoot":"","sources":["../../src/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;;;;GAIG;AAEH;IAWI;;;;OAIG;IACH,+BAAmB,KAAc,EACP,OAAsB;QAA5C,wBAAA,EAAA,cAA4C;QAD7B,UAAK,GAAL,KAAK,CA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AAC;qBACf;iBACJ;gBACD,KAAK,GAAG,SAAS,CAAC;aACrB;SACJ;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;8FAtDQ,qBAAqB,yDAUf,SAAS;4EAVf,qBAAqB;gHAArB,qBAAiB;8CAFf,CAAC,OAAO,CAAC;gCAdxB;CA0EC,AAjED,IAiEC;SA1DY,qBAAqB;uFAArB,qBAAqB;cAPjC,SAAS;eAAC;gBACP,QAAQ,EAAE,WAAW;gBACrB,IAAI,EAAE;oBACF,WAAW,EAAE,mBAAmB;iBACnC;gBACD,SAAS,EAAE,CAAC,OAAO,CAAC;aACvB;;sBAWQ,SAAS;uBAAC,SAAS","sourcesContent":["import { Attribute, Directive } from '@angular/core';\nimport { NgModel } from \"@angular/forms\";\n\n/**\n * Responsavel pelo mascaramento de inputs\n * @author Thiago Przyczynski\n * przyczynski@gmail.com\n */\n\n@Directive({\n selector: '[appMask]',\n host: {\n '(keydown)': 'onKeyDown($event)'\n },\n providers: [NgModel]\n})\nexport class IonInputMaskDirective {\n\n pattern: string;\n\n /**\n * Construtor\n * @param {NgModel} model\n * @param {string} pattern\n */\n constructor(public model: NgModel,\n @Attribute('appMask') pattern: string = null) {\n this.pattern = pattern;\n }\n\n /**\n * Listener para mudança de valor do input\n * @param event\n */\n onKeyDown(event: any) {\n let value = event.target.value,\n pattern = this.pattern;\n if (pattern !== null) {\n if (event.keyIdentifier === 'U+0008' || event.keyCode === 8 || event.key === 'Backspace') {\n if (value.length) { //prevent fatal exception when backspacing empty value in progressive web app\n //remove all trailing formatting then delete character\n while (pattern[value.length] && pattern[value.length] !== '*') {\n value = value.substring(0, value.length - 1);\n }\n //remove all leading formatting to restore placeholder\n if (pattern.substring(0, value.length).indexOf('*') < 0) {\n value = value.substring(0, value.length - 1);\n }\n }\n\n // Caso o padrao esteja definido como null ira retornar o valor digitado!\n } else {\n let maskIndex = value.length;\n let formatted = '';\n formatted += value;\n if (maskIndex < pattern.length) {\n //apply trailing formatting\n while (pattern[maskIndex] !== '*') {\n formatted += pattern[maskIndex];\n maskIndex++;\n }\n }\n value = formatted;\n }\n }\n event.target.value = value;\n if (this.model) {\n this.model.update.emit(value);\n }\n return true;\n }\n\n \n\n}"]}
@@ -0,0 +1,15 @@
1
+ import { IonInputMaskDirective } from "./input-mask.directive";
2
+ import * as i0 from "@angular/core";
3
+ export declare class IonInputMaskService {
4
+ private inputMaskDirective;
5
+ constructor(inputMaskDirective: IonInputMaskDirective);
6
+ /**
7
+ * Aplica mascara via metodo
8
+ * @author Starley Cazorla
9
+ * @param value - Valor a ser mascarado
10
+ * @param mask - Mascara desejada; Ex: "(**) ****-****"
11
+ */
12
+ applyMask(value: any, mask: string): boolean;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<IonInputMaskService, never>;
14
+ static ɵprov: i0.ɵɵInjectableDeclaration<IonInputMaskService>;
15
+ }
@@ -0,0 +1,26 @@
1
+ import { Injectable } from "@angular/core";
2
+ import * as i0 from "@angular/core";
3
+ import * as i1 from "./input-mask.directive";
4
+ var IonInputMaskService = /** @class */ (function () {
5
+ function IonInputMaskService(inputMaskDirective) {
6
+ this.inputMaskDirective = inputMaskDirective;
7
+ }
8
+ /**
9
+ * Aplica mascara via metodo
10
+ * @author Starley Cazorla
11
+ * @param value - Valor a ser mascarado
12
+ * @param mask - Mascara desejada; Ex: "(**) ****-****"
13
+ */
14
+ IonInputMaskService.prototype.applyMask = function (value, mask) {
15
+ this.inputMaskDirective.pattern = mask;
16
+ return this.inputMaskDirective.onKeyDown(value);
17
+ };
18
+ IonInputMaskService.ɵfac = function IonInputMaskService_Factory(t) { return new (t || IonInputMaskService)(i0.ɵɵinject(i1.IonInputMaskDirective)); };
19
+ IonInputMaskService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: IonInputMaskService, factory: IonInputMaskService.ɵfac });
20
+ return IonInputMaskService;
21
+ }());
22
+ export { IonInputMaskService };
23
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IonInputMaskService, [{
24
+ type: Injectable
25
+ }], function () { return [{ type: i1.IonInputMaskDirective }]; }, null); })();
26
+ //# sourceMappingURL=input-mask.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-mask.service.js","sourceRoot":"","sources":["../../src/input-mask/input-mask.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;;;AAG3C;IAGI,6BAAoB,kBAAyC;QAAzC,uBAAkB,GAAlB,kBAAkB,CAAuB;IAAI,CAAC;IAElE;;;;;MAKE;IACK,uCAAS,GAAhB,UAAiB,KAAU,EAAE,IAAY;QACrC,IAAI,CAAC,kBAAkB,CAAC,OAAO,GAAG,IAAI,CAAC;QACvC,OAAO,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC;0FAbQ,mBAAmB;6EAAnB,mBAAmB,WAAnB,mBAAmB;8BAJhC;CAoBC,AAjBD,IAiBC;SAhBY,mBAAmB;uFAAnB,mBAAmB;cAD/B,UAAU","sourcesContent":["import { Injectable } from \"@angular/core\";\nimport { IonInputMaskDirective } from \"./input-mask.directive\";\n\n@Injectable()\nexport class IonInputMaskService {\n\n constructor(private inputMaskDirective: IonInputMaskDirective) { }\n\n /**\n * Aplica mascara via metodo\n * @author Starley Cazorla\n * @param value - Valor a ser mascarado \n * @param mask - Mascara desejada; Ex: \"(**) ****-****\"\n */\n public applyMask(value: any, mask: string) {\n this.inputMaskDirective.pattern = mask;\n return this.inputMaskDirective.onKeyDown(value);\n }\n\n\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starley/ion-directives",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "Directivas internas para ionic",
5
5
  "main": "./dist/index.js",
6
6
  "typings": "./dist/index.d.ts",