UNPKG

@angular/cdk

Version:

Angular Material Component Development Kit

1 lines 4.66 kB
{"version":3,"file":"bidi-module-04c03e58.mjs","sources":["../../../../../k8-fastbuild-ST-46c76129e412/bin/src/cdk/bidi/dir.ts","../../../../../k8-fastbuild-ST-46c76129e412/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 {Directive, Output, Input, EventEmitter, AfterContentInit, OnDestroy} 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 /** Normalized direction that accounts for invalid/unsupported values. */\n private _dir: Direction = 'ltr';\n\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._dir;\n }\n set dir(value: Direction | 'auto') {\n const previousValue = this._dir;\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._dir = _resolveDirectionality(value);\n this._rawDir = value;\n\n if (previousValue !== this._dir && this._isInitialized) {\n this.change.emit(this._dir);\n }\n }\n\n /** Current layout direction of the element. */\n get value(): Direction {\n return this.dir;\n }\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":";;;;AAYA;;;;;AAKG;MAOU,GAAG,CAAA;;IAEN,IAAI,GAAc,KAAK,CAAA;;IAGvB,cAAc,GAAY,KAAK,CAAA;;AAGvC,IAAA,OAAO,CAAA;;AAGuB,IAAA,MAAM,GAAG,IAAI,YAAY,EAAa,CAAA;;AAGpE,IAAA,IACI,GAAG,GAAA;QACL,OAAO,IAAI,CAAC,IAAI,CAAA;KAClB;IACA,IAAI,GAAG,CAAC,KAAyB,EAAA;AAC/B,QAAA,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAA;;;;AAK/B,QAAA,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAA;AACzC,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;QAEpB,IAAI,aAAa,KAAK,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,cAAc,EAAE;YACtD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;SAC7B;KACF;;AAGA,IAAA,IAAI,KAAK,GAAA;QACP,OAAO,IAAI,CAAC,GAAG,CAAA;KACjB;;IAGA,kBAAkB,GAAA;AAChB,QAAA,IAAI,CAAC,cAAc,GAAG,IAAI,CAAA;KAC5B;IAEA,WAAW,GAAA;AACT,QAAA,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAA;KACxB;uGA5CW,GAAG,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;2FAAH,GAAG,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,OAAA,EAAA,MAAA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