@angular/cdk
Version:
Angular Material Component Development Kit
1 lines • 4.7 kB
Source Map (JSON)
{"version":3,"file":"bidi.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/cdk/bidi/dir.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/cdk/bidi/bidi-module.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n AfterContentInit,\n Directive,\n EventEmitter,\n Input,\n OnDestroy,\n Output,\n signal,\n} from '@angular/core';\n\nimport {Direction, Directionality, _resolveDirectionality} from './directionality';\n\n/**\n * Directive to listen for changes of direction of part of the DOM.\n *\n * Provides itself as Directionality such that descendant directives only need to ever inject\n * Directionality to get the closest direction.\n */\n@Directive({\n selector: '[dir]',\n providers: [{provide: Directionality, useExisting: Dir}],\n host: {'[attr.dir]': '_rawDir'},\n exportAs: 'dir',\n})\nexport class Dir implements Directionality, AfterContentInit, OnDestroy {\n /** Whether the `value` has been set to its initial value. */\n private _isInitialized: boolean = false;\n\n /** Direction as passed in by the consumer. */\n _rawDir: string = '';\n\n /** Event emitted when the direction changes. */\n @Output('dirChange') readonly change = new EventEmitter<Direction>();\n\n /** @docs-private */\n @Input()\n get dir(): Direction {\n return this.valueSignal();\n }\n set dir(value: Direction | 'auto') {\n const previousValue = this.valueSignal();\n\n // Note: `_resolveDirectionality` resolves the language based on the browser's language,\n // whereas the browser does it based on the content of the element. Since doing so based\n // on the content can be expensive, for now we're doing the simpler matching.\n this.valueSignal.set(_resolveDirectionality(value));\n this._rawDir = value;\n\n if (previousValue !== this.valueSignal() && this._isInitialized) {\n this.change.emit(this.valueSignal());\n }\n }\n\n /** Current layout direction of the element. */\n get value(): Direction {\n return this.dir;\n }\n\n readonly valueSignal = signal<Direction>('ltr');\n\n /** Initialize once default value has been set. */\n ngAfterContentInit() {\n this._isInitialized = true;\n }\n\n ngOnDestroy() {\n this.change.complete();\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {NgModule} from '@angular/core';\nimport {Dir} from './dir';\n\n@NgModule({\n imports: [Dir],\n exports: [Dir],\n})\nexport class BidiModule {}\n"],"names":[],"mappings":";;;;;MAgCa,GAAG,CAAA;AAEN,EAAA,cAAc,GAAY,KAAK;AAGvC,EAAA,OAAO,GAAW,EAAE;AAGU,EAAA,MAAM,GAAG,IAAI,YAAY,EAAa;AAGpE,EAAA,IACI,GAAG,GAAA;AACL,IAAA,OAAO,IAAI,CAAC,WAAW,EAAE;AAC3B,EAAA;EACA,IAAI,GAAG,CAAC,KAAyB,EAAA;AAC/B,IAAA,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,EAAE;IAKxC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;IACnD,IAAI,CAAC,OAAO,GAAG,KAAK;IAEpB,IAAI,aAAa,KAAK,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC,cAAc,EAAE;MAC/D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;AACtC,IAAA;AACF,EAAA;AAGA,EAAA,IAAI,KAAK,GAAA;IACP,OAAO,IAAI,CAAC,GAAG;AACjB,EAAA;EAES,WAAW,GAAG,MAAM,CAAY,KAAK;;WAAC;AAG/C,EAAA,kBAAkB,GAAA;IAChB,IAAI,CAAC,cAAc,GAAG,IAAI;AAC5B,EAAA;AAEA,EAAA,WAAW,GAAA;AACT,IAAA,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;AACxB,EAAA;;;;;UA3CW,GAAG;AAAA,IAAA,IAAA,EAAA,EAAA;AAAA,IAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA;AAAA,GAAA,CAAA;;;;UAA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