{"version":3,"file":"ng-let.mjs","sources":["../../../projects/ng-let/src/lib/ng-let.directive.ts","../../../projects/ng-let/src/public-api.ts","../../../projects/ng-let/src/ng-let.ts"],"sourcesContent":["import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core';\r\n\r\ninterface NgLetContext<T> {\r\n    /**\r\n     * using `ngLet` to enable `as` syntax: `*ngLet=\"foo as bar\"`\r\n     */\r\n    ngLet: T;\r\n    /**\r\n     * using `$implicit` to enable `let` syntax: `*ngLet=\"foo; let bar\"`\r\n     */\r\n    $implicit: T;\r\n}\r\n\r\n/**\r\n * @description\r\n *\r\n * The `*ngLet` directive it's a Angular structural directive for sharing data as local variable into html component template.\r\n *\r\n * @usageNotes\r\n *\r\n * ### Usage\r\n *\r\n * ```html\r\n * <ng-container *ngLet=\"(num1 + num2); let total\"> <!-- single computation -->\r\n *    <div>\r\n *       1: {{ total }}\r\n *     </div>\r\n *     <div>\r\n *       2: {{ total }}\r\n *     </div>\r\n * </ng-container> \r\n * ```\r\n *\r\n * @publicApi\r\n */\r\n@Directive({\r\n    selector: '[ngLet]',\r\n    standalone: true\r\n})\r\nexport class NgLetDirective<T> {\r\n\r\n    private readonly context: NgLetContext<T | null> = { ngLet: null, $implicit: null };\r\n\r\n    // eslint-disable-next-line @angular-eslint/prefer-inject\r\n    constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef<NgLetContext<T>>) {\r\n        viewContainer.createEmbeddedView(templateRef, this.context);\r\n    }\r\n\r\n    /**\r\n     * @description\r\n     *\r\n     * The `*ngLet` directive it's a Angular structural directive for sharing data as local variable into html component template.\r\n     *\r\n     * @usageNotes\r\n     *\r\n     * ### Usage\r\n     *\r\n     * ```html\r\n     * <ng-container *ngLet=\"(num1 + num2); let total\"> <!-- single computation -->\r\n     *    <div>\r\n     *       1: {{ total }}\r\n     *     </div>\r\n     *     <div>\r\n     *       2: {{ total }}\r\n     *     </div>\r\n     * </ng-container> \r\n     * ```\r\n     */\r\n    @Input({ required: true })\r\n    set ngLet(value: T) {\r\n        this.context.$implicit = this.context.ngLet = value;\r\n    }\r\n\r\n    /** \r\n     * @internal \r\n     * Directives that behave like *ngIf can declare that they want the same treatment by including a \r\n     * static member marker that is a signal to the template compiler to treat them like *ngIf.\r\n     * \r\n     * @see https://v17.angular.io/guide/aot-compiler#custom-ngif-like-directives\r\n     */\r\n    public static ngLetUseIfTypeGuard: void;\r\n\r\n    /**\r\n     * Assert the correct type of the expression bound to the `NgLet` input within the template.\r\n     *\r\n     * The presence of this static field is a signal to the Ivy template type check compiler that\r\n     * when the `NgLet` structural directive renders its template, the type of the expression bound\r\n     * to `NgLet` should be narrowed in some way. For `NgLet`, the binding expression itself is used to\r\n     * narrow its type, which allows the strictNullChecks feature of TypeScript to work with `NgLet`.\r\n     * \r\n     * @see https://angular.dev/guide/directives/structural-directives#typing-the-directives-context\r\n     */\r\n    static ngTemplateGuard_ngLet: 'binding';\r\n\r\n    /**\r\n     * Asserts the correct type of the context for the template that `NgLet` will render.\r\n     *\r\n     * The presence of this method is a signal to the Ivy template type-check compiler that the\r\n     * `NgLet` structural directive renders its template with a specific context type.\r\n     * \r\n     * @see https://angular.dev/guide/directives/structural-directives#typing-the-directives-context\r\n     */\r\n    static ngTemplateContextGuard<T>(_dir: NgLetDirective<T>, _ctx: unknown): _ctx is NgLetContext<T> {\r\n        return true;\r\n    }\r\n}\r\n\r\n/** \r\n * @deprecated import the standalone NgLetDirective\r\n */\r\nexport const NgLetModule = NgLetDirective;","/*\r\n * Public API Surface of ng-let\r\n */\r\nexport * from './lib/ng-let.directive';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAaA;;;;;;;;;;;;;;;;;;;;;AAqBG;MAKU,cAAc,CAAA;;IAKvB,WAAA,CAAY,aAA+B,EAAE,WAAyC,EAAA;QAHrE,IAAA,CAAA,OAAO,GAA2B,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;QAI/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