{"version":3,"file":"skeletonizer-angular.mjs","sources":["../../../projects/skeletonizer/src/lib/skeletonize.directive.ts","../../../projects/skeletonizer/src/lib/skeletonizer.skeleton.component.ts","../../../projects/skeletonizer/src/lib/skeletonizer.skeleton.component.html","../../../projects/skeletonizer/src/lib/skeleton-abstract.component.ts","../../../projects/skeletonizer/src/public-api.ts","../../../projects/skeletonizer/src/skeletonizer-angular.ts"],"sourcesContent":["import { AfterViewInit, Directive, ElementRef, inject, input, InputSignal } from '@angular/core';\nimport { ISkeletonizerColorSchema, SkeletonDirective } from '@skeletonizer/utils';\n\n@Directive({\n  selector: '[skeletonize]',\n  standalone: true,\n})\nexport class SkeletonizeDirective implements AfterViewInit {\n  public readonly colorSchema: InputSignal<ISkeletonizerColorSchema | undefined> = input<ISkeletonizerColorSchema | undefined>(\n    undefined,\n    { alias: 'skeletonize' },\n  );\n\n  private readonly el: ElementRef = inject(ElementRef);\n\n  public ngAfterViewInit(): void {\n    SkeletonDirective.skeletonizeProjectedTemplate(this.el.nativeElement, this.colorSchema());\n  }\n}\n","import { Component, ContentChild, effect, input, InputSignal, TemplateRef, ViewEncapsulation } from '@angular/core';\nimport { ISkeletonizerColorSchema, Schema, SkeletonAdapterComponent, TSchemaConfig } from '@skeletonizer/utils';\nimport { SkeletonizeDirective } from './skeletonize.directive';\nimport { NgTemplateOutlet } from '@angular/common';\n\n@Component({\n  selector: 'skeletonizer-skeleton',\n  templateUrl: './skeletonizer.skeleton.component.html',\n  styleUrls: ['./skeletonizer.skeleton.component.scss'],\n  encapsulation: ViewEncapsulation.None,\n  standalone: true,\n  imports: [\n    SkeletonizeDirective,\n    NgTemplateOutlet,\n  ],\n})\nexport class SkeletonizerSkeletonComponent<T extends object, Scope extends T> extends SkeletonAdapterComponent<T> {\n  @ContentChild(TemplateRef) public readonly templateRef!: TemplateRef<{ $implicit: Schema<T> | Scope }>;\n\n  public readonly showSkeleton: InputSignal<boolean> = input.required<boolean>();\n  public readonly scope: InputSignal<Scope> = input.required<Scope>();\n  public readonly configInput: InputSignal<TSchemaConfig<T>> = input.required<TSchemaConfig<T>>({ alias: 'config' });\n  public readonly colorSchema: InputSignal<ISkeletonizerColorSchema | undefined> = input<ISkeletonizerColorSchema | undefined>(undefined);\n\n  public constructor() {\n    super();\n\n    effect(() => {\n      this.config = this.configInput();\n      this.setupModels();\n    });\n  }\n}\n","@if (showSkeleton()) {\n  @for (model of viewModels; track model.uuid) {\n    <div [skeletonize]=\"colorSchema()\">\n      <ng-container *ngTemplateOutlet=\"templateRef; context: { $implicit: model }\"></ng-container>\n    </div>\n  }\n} @else {\n  <ng-container *ngTemplateOutlet=\"templateRef; context: { $implicit: scope() }\"></ng-container>\n}\n","import { Signal } from '@angular/core';\nimport { Schema, TSchemaConfig, SkeletonAbstractComponent as BaseAbstract } from '@skeletonizer/utils';\n\ntype TAbstractComponent<T extends object> = {\n  [K in keyof BaseAbstract<T>]: K extends 'proxy' ? BaseAbstract<T>[K] : Signal<BaseAbstract<T>[K]>;\n};\n\n/**\n * Angular-specific abstract component for skeletonizer.\n * Every Angular component that uses Skeletonizer should extend this class.\n *\n * This version uses Angular signals for reactive state management.\n *\n * @template T - The type of the data model for the skeletonized part of the component\n */\nexport abstract class SkeletonAbstractComponent<T extends object> implements TAbstractComponent<T> {\n  /**\n   * Configuration for the skeleton schema.\n   * Defines how the skeleton data should be generated.\n   */\n  public abstract skeletonConfig: Signal<TSchemaConfig<T>>;\n\n  /**\n   * Signal that controls whether the skeleton is shown or the actual content.\n   * Use `.set()` to update the value if using WritableSignal.\n   */\n  public abstract showSkeleton: Signal<boolean>;\n\n  /**\n   * Proxy method for type-safe access to properties/methods within the skeletonized part of the view.\n   *\n   * When accessing component properties/methods from within the skeletonized template,\n   * they should be accessed via this proxy method. This ensures:\n   * - All accessed properties/methods are part of the skeleton schema\n   * - TypeScript understands the correct type of each property/method\n   *\n   * @param scope - Either the skeleton schema or the actual scope object\n   * @returns The unwrapped scope object with proper typing\n   *\n   * @example\n   * ```html\n   * <ng-template let-context>\n   *   <div>{{ proxy(context).userName }}</div>\n   * </ng-template>\n   * ```\n   */\n  public proxy(scope: T | Schema<T>): T {\n    return scope instanceof Schema ? scope.value : scope;\n  }\n}\n","/*\n * Public API Surface of skeletonizer\n */\n\nimport './lib/schema-leaf-types';\n\nexport * from './lib/skeletonizer.skeleton.component';\nexport * from './lib/skeleton-abstract.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAOa,oBAAoB,CAAA;AAJjC,IAAA,WAAA,GAAA;QAKkB,IAAA,CAAA,WAAW,GAAsD,KAAK,CACpF,SAAS,mFACP,KAAK,EAAE,aAAa,EAAA,CACvB;AAEgB,QAAA,IAAA,CAAA,EAAE,GAAe,MAAM,CAAC,UAAU,CAAC;AAKrD,IAAA;IAHQ,eAAe,GAAA;AACpB,QAAA,iBAAiB,CAAC,4BAA4B,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;IAC3F;8GAVW,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAApB,oBAAoB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,eAAA,EAAA,MAAA,EAAA,EAAA,WAAA,EAAA,EAAA,iBAAA,EAAA,aAAA,EAAA,UAAA,EAAA,aAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAJhC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;;ACUK,MAAO,6BAAiE,SAAQ,wBAA2B,CAA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