{"version":3,"file":"ngwr-shiny-text.mjs","sources":["../../../projects/lib/shiny-text/shiny-text.ts","../../../projects/lib/shiny-text/shimmer.ts","../../../projects/lib/shiny-text/ngwr-shiny-text.ts"],"sourcesContent":["/**\n * @license\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://github.com/thekhegay/ngwr/blob/main/LICENSE\n *\n * Angular adaptation of the ShinyText effect by David Haz / reactbits.dev.\n * Original: https://www.reactbits.dev/text-animations/shiny-text\n *\n * The reactbits version uses `motion/react` to drive `background-position`\n * via rAF. This port is pure CSS — the same effect via a keyframe that\n * sweeps `background-position`, parameterised by `[speed]` / `[delay]` /\n * `[yoyo]` / `[direction]`.\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport { numAttr } from 'ngwr/utils';\n\n/**\n * Animated shimmer-over-text effect. A bright stripe sweeps across the\n * text using `background-clip: text` + an animated `background-position`.\n *\n * @example\n * ```html\n * <wr-shiny-text text=\"Premium\" />\n * <wr-shiny-text\n *   text=\"Custom\"\n *   color=\"#444\"\n *   shineColor=\"#a0e0ff\"\n *   [speed]=\"3\"\n *   [delay]=\"0.5\"\n *   [yoyo]=\"true\"\n *   [pauseOnHover]=\"true\"\n * />\n * ```\n *\n * @see https://www.reactbits.dev/text-animations/shiny-text\n */\n@Component({\n  selector: 'wr-shiny-text',\n  template: '{{ text() }}',\n  styleUrl: './shiny-text.scss',\n  encapsulation: ViewEncapsulation.None,\n  host: {\n    class: 'wr-shiny-text',\n    '[class.wr-shiny-text--paused]': 'disabled()',\n    '[class.wr-shiny-text--pause-on-hover]': 'pauseOnHover()',\n    '[class.wr-shiny-text--yoyo]': 'yoyo()',\n    '[class.wr-shiny-text--reverse]': \"direction() === 'right'\",\n    '[style.background-image]': 'gradient()',\n    '[style.animation-duration]': \"totalDuration() + 's'\",\n  },\n})\nexport class WrShinyText {\n  /** Text to render. */\n  readonly text = input.required<string>();\n\n  /** Pause the animation. @default false */\n  readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n  /** Time for the bright stripe to traverse the text, in seconds. @default 2 */\n  readonly speed = input(2, { transform: numAttr(2) });\n\n  /** Base text colour (outside the bright stripe). @default '#b5b5b5' */\n  /** Base text colour. When unset, the theme decides. */\n  readonly color = input<string | null>(null);\n\n  /** Bright stripe colour. @default '#ffffff' */\n  /** Sweep highlight colour. When unset, the theme decides. */\n  readonly shineColor = input<string | null>(null);\n\n  /** Gradient angle in degrees. @default 120 */\n  readonly spread = input(120, { transform: numAttr(120) });\n\n  /** Bounce the stripe back-and-forth instead of restarting. @default false */\n  readonly yoyo = input(false, { transform: coerceBooleanProperty });\n\n  /** Pause the animation while hovered. @default false */\n  readonly pauseOnHover = input(false, { transform: coerceBooleanProperty });\n\n  /** Sweep direction. @default 'left' */\n  readonly direction = input<'left' | 'right'>('left');\n\n  /** Pause between sweeps in seconds. @default 0 */\n  readonly delay = input(0, { transform: numAttr(0) });\n\n  /** Total animation cycle (speed + delay) in seconds. */\n  protected readonly totalDuration = computed(() => this.speed() + this.delay());\n\n  protected readonly gradient = computed(() => {\n    const base = this.color() ?? 'var(--wr-shiny-text-base)';\n    const shine = this.shineColor() ?? 'var(--wr-shiny-text-shine)';\n    return `linear-gradient(${this.spread()}deg, ${base} 0%, ${base} 35%, ${shine} 50%, ${base} 65%, ${base} 100%)`;\n  });\n}\n","/**\n * @license\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://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directive } from '@angular/core';\n\n/**\n * Gradient sweep over text. Applies a `background-clip: text` gradient\n * with a moving highlight — gives any text a subtle shimmer.\n *\n * The directive only adds the `wr-shimmer` host class. Pair with the\n * styles in `ngwr/animations` (which include the `wr-shimmer` keyframes).\n *\n * @example\n * ```html\n * <h1 wrShimmer>Premium</h1>\n * ```\n */\n@Directive({\n  selector: '[wrShimmer]',\n  host: { class: 'wr-sh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