ngx-mask 22.2.0 → 22.2.2

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/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ <p align="center">
2
+ <img src=".github/assets/logo.svg" alt="ngx-mask logo" width="120" height="120" />
3
+ </p>
4
+
1
5
  <h1 align="center">ngx-mask</h1>
2
6
 
3
7
  <p align="center">
@@ -17,8 +21,8 @@ A powerful Angular directive for input masking with customizable patterns
17
21
  <a href="https://www.npmjs.com/package/ngx-mask">
18
22
  <img src="https://img.shields.io/npm/dm/ngx-mask.svg" alt="npm monthly downloads">
19
23
  </a>
20
- <a href="https://bundlephobia.com/package/ngx-mask">
21
- <img src="https://img.shields.io/bundlephobia/minzip/ngx-mask.svg" alt="Bundle size">
24
+ <a href="https://github.com/NepipenkoIgor/ngx-mask/commits/develop">
25
+ <img src="https://img.shields.io/github/last-commit/NepipenkoIgor/ngx-mask.svg" alt="Last commit">
22
26
  </a>
23
27
  <a href="https://www.npmjs.com/package/ngx-mask">
24
28
  <img src="https://img.shields.io/npm/types/ngx-mask.svg" alt="TypeScript support">
@@ -45,6 +49,7 @@ A powerful Angular directive for input masking with customizable patterns
45
49
  - [Quick Start](#quick-start)
46
50
  - [Standalone Applications](#standalone-applications)
47
51
  - [NgModule-based Applications](#ngmodule-based-applications)
52
+ - [For AI Agents](#for-ai-agents)
48
53
  - [Contributing](#contributing)
49
54
 
50
55
  ## Features
@@ -251,6 +256,10 @@ export class AppModule {}
251
256
  export class AppModule {}
252
257
  ```
253
258
 
259
+ ## For AI Agents
260
+
261
+ ngx-mask ships an [`llms.txt`](llms.txt) (index) and [`llms-full.txt`](llms-full.txt) (full API reference with inline code snippets), following the [llmstxt.org](https://llmstxt.org) convention, so tools like Claude Code, Codex and other coding agents can ground themselves in the current API without guessing. The library is also indexed on [Context7](https://context7.com/nepipenkoigor/ngx-mask) for MCP-based doc retrieval.
262
+
254
263
  ## Contributing
255
264
 
256
265
  We welcome contributions! Please read our [contributing guidelines](CONTRIBUTING.md) to learn about our development process and how you can propose bugfixes and improvements.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, EventEmitter, inject, Injectable, signal, ElementRef, Renderer2, makeEnvironmentProviders, input, model, booleanAttribute, output, ChangeDetectorRef, Injector, effect, untracked, HostListener, Directive, Pipe } from '@angular/core';
2
+ import { InjectionToken, EventEmitter, inject, Injectable, signal, ElementRef, Renderer2, makeEnvironmentProviders, input, model, booleanAttribute, output, ChangeDetectorRef, Injector, effect, untracked, HostListener, Directive, EnvironmentInjector, Pipe } from '@angular/core';
3
3
  import { DOCUMENT } from '@angular/common';
4
4
  import { NgControl, NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
5
5
 
@@ -4033,11 +4033,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
4033
4033
 
4034
4034
  class NgxMaskPipe {
4035
4035
  defaultOptions = inject(NGX_MASK_CONFIG);
4036
- _maskService = inject(NgxMaskService);
4036
+ _environmentInjector = inject(EnvironmentInjector);
4037
+ _maskService;
4037
4038
  _maskExpressionArray = [];
4038
4039
  mask = '';
4039
4040
  transform(value, mask, { patterns, maskAliases, ...config } = {}) {
4040
4041
  let processedValue = value;
4042
+ // NgxMaskService is stateful (built for the directive, which keeps value history across
4043
+ // keystrokes), so each transform gets a fresh instance: nothing from a previous call can
4044
+ // leak into this one (#1669).
4045
+ this._maskService = Injector.create({
4046
+ providers: [
4047
+ NgxMaskService,
4048
+ { provide: NGX_MASK_CONFIG, useValue: this.defaultOptions },
4049
+ ],
4050
+ parent: this._environmentInjector,
4051
+ }).get(NgxMaskService);
4041
4052
  // User-defined aliases expand BEFORE any other mask processing (incl. `||` handling).
4042
4053
  const resolvedMask = resolveMaskAlias(mask, {
4043
4054
  ...this.defaultOptions.maskAliases,
@@ -4048,7 +4059,7 @@ class NgxMaskPipe {
4048
4059
  ...this.defaultOptions,
4049
4060
  ...config,
4050
4061
  patterns: {
4051
- ...this._maskService.patterns,
4062
+ ...this.defaultOptions.patterns,
4052
4063
  ...patterns,
4053
4064
  },
4054
4065
  };
@@ -4096,7 +4107,6 @@ class NgxMaskPipe {
4096
4107
  if (this._maskService.decimalMarker === MaskExpression.COMMA) {
4097
4108
  processedValue = processedValue.replace(MaskExpression.DOT, MaskExpression.COMMA);
4098
4109
  }
4099
- this._maskService.isNumberValue = true;
4100
4110
  }
4101
4111
  if (processedValue === null || typeof processedValue === 'undefined') {
4102
4112
  return this._maskService.applyMask('', resolvedMask);