ngwr 15.3.0 → 15.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bits/border-glow/styles/_rules.scss +60 -49
- package/bits/click-spark/click-spark.scss +5 -1
- package/bits/click-spark/styles/_index.scss +10 -15
- package/bits/click-spark/styles/_rules.scss +20 -0
- package/fesm2022/ngwr-bits-aurora.mjs +108 -52
- package/fesm2022/ngwr-bits-aurora.mjs.map +1 -1
- package/fesm2022/ngwr-bits-border-glow-testing.mjs +8 -8
- package/fesm2022/ngwr-bits-border-glow-testing.mjs.map +1 -1
- package/fesm2022/ngwr-bits-border-glow.mjs +29 -26
- package/fesm2022/ngwr-bits-border-glow.mjs.map +1 -1
- package/fesm2022/ngwr-bits-dot-grid.mjs +11 -14
- package/fesm2022/ngwr-bits-dot-grid.mjs.map +1 -1
- package/fesm2022/ngwr-bits-fuzzy-text.mjs +18 -4
- package/fesm2022/ngwr-bits-fuzzy-text.mjs.map +1 -1
- package/fesm2022/ngwr-bits-ripple-grid.mjs +14 -13
- package/fesm2022/ngwr-bits-ripple-grid.mjs.map +1 -1
- package/fesm2022/ngwr-bits-splash-cursor.mjs +21 -10
- package/fesm2022/ngwr-bits-splash-cursor.mjs.map +1 -1
- package/fesm2022/ngwr-bits-waves.mjs +10 -15
- package/fesm2022/ngwr-bits-waves.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +162 -51
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-statistic.mjs +11 -16
- package/fesm2022/ngwr-statistic.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/llms-full.txt +2 -2
- package/package.json +1 -1
- package/schematics/use/symbol-map.json +1 -0
- package/skills/ngwr/SKILL.md +3 -1
- package/types/ngwr-bits-aurora.d.ts +24 -2
- package/types/ngwr-bits-border-glow-testing.d.ts +9 -5
- package/types/ngwr-bits-border-glow.d.ts +10 -4
- package/types/ngwr-bits-fuzzy-text.d.ts +2 -1
- package/types/ngwr-bits-ripple-grid.d.ts +7 -2
- package/types/ngwr-bits-splash-cursor.d.ts +2 -1
- package/types/ngwr-pipes.d.ts +142 -32
- package/types/ngwr-version.d.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-bits-border-glow-testing.mjs","names":[],"sources":["../../../projects/lib/bits/border-glow/testing/wr-border-glow-harness.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\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrBorderGlowHarnessFilters } from './types';\n\n/** The seven halo steps, in the order the component writes them: 100%, 60%, 50%, 40%, 30%, 20%, 10%. */\nconst GLOW_VAR_SUFFIXES = ['', '-60', '-50', '-40', '-30', '-20', '-10'] as const;\n\n/** The seven mesh-gradient slots, spelled out rather than numbered — as the component names them. */\nconst GRADIENT_VAR_SLOTS = ['one', 'two', 'three', 'four', 'five', 'six', 'seven'] as const;\n\n/** `hsl(40deg 80% 80% / 65%)` — the alpha, which is the only part `glowIntensity` moves. */\nconst GLOW_ALPHA = /\\/\\s*(-?[\\d.]+)%\\s*\\)\\s*$/;\n\n/** `color-mix(in srgb, var(--wr-color-primary) 65%, transparent)` — the same alpha, for a CSS colour. */\nconst GLOW_MIX_ALPHA = /^color-mix\\(in srgb,\\s*.+\\s+(-?[\\d.]+)%\\s*,\\s*transparent\\s*\\)$/;\n\n/** `radial-gradient(at 80% 55%, #c084fc 0px, transparent 50%)` — the colour, not the position. */\nconst RADIAL_GRADIENT_COLOR = /^radial-gradient\\(\\s*at\\s+[^,]+,\\s*(.+?)\\s+0px\\s*,/;\n\n/** `linear-gradient(#c084fc 0 100%)` — the flat base slice. */\nconst LINEAR_GRADIENT_COLOR = /^linear-gradient\\(\\s*(.+?)\\s+0\\s+100%\\s*\\)$/;\n\n/**\n * Split an inline `style` attribute into its declarations.\n *\n * Read from the attribute rather than through `getCssValue()` on purpose. jsdom echoes\n * an inline custom property back through `getComputedStyle`, so the computed read passes\n * here and would answer something else entirely in a browser — where the stylesheet's\n * own per-theme default resolves and \"the author left this to the theme\" quietly becomes\n * a colour. The attribute holds what the component itself wrote, and nothing else.\n */\nfunction parseInlineDeclarations(style: string): Map<string, string> {\n const declarations = new Map<string, string>();\n for (const declaration of style.split(';')) {\n const colon = declaration.indexOf(':');\n if (colon === -1) continue;\n const name = declaration.slice(0, colon).trim();\n if (name !== '') declarations.set(name, declaration.slice(colon + 1).trim());\n }\n return declarations;\n}\n\n/**\n * Test harness for `<wr-border-glow>` — a card whose border lights up under the cursor.\n *\n * **Nearly all of this component is a bag of custom properties written onto the host,\n * and that is what the harness reads.** The paint itself — the conic mask, the stacked\n * `box-shadow` halo, the soft-light bloom — lives in the stylesheet, so a unit test can\n * never see it. What it CAN see is the arithmetic that feeds it, and that is where the\n * breakages are: the seven-step alpha ramp {@link getGlowAlphaRamp} derives from\n * `glowIntensity`, the `[0,1,2,0,1,2,1]` palette mapping in {@link getGradientColors}\n * with its clamp for short palettes, and the pointer maths behind\n * {@link getPointerAngle} / {@link getEdgeProximity}.\n *\n * **Every custom-property getter reads the inline declaration** — see\n * {@link parseInlineDeclarations} for why a computed read would be a different, and\n * wrong, question.\n *\n * **A colour getter answering `null` means that variable is not on the host now**, which\n * is the contract when the input is unset or its value was refused: the stylesheet's\n * per-theme default takes over. An input set and then put back to `null` comes off the\n * host, so `null` says nothing about whether it was ever set.\n *\n * There is deliberately no `getGlowOpacity()`, `isGlowVisible()` or `isHovered()`: the\n * visible strength is a `calc()` in the stylesheet gated behind `:not(:hover)`, and\n * jsdom loads no stylesheet and matches no `:hover`, so any number would be invented.\n * There is no measured halo extent either — `.wr-border-glow__edge` is 0×0 in a test,\n * and {@link getGlowRadius} reads what the component asked for instead. And there is no\n * `getSweepProgress()` / `waitForSweep()`: the mount sweep is a four-second chain of\n * `requestAnimationFrame` tweens, so awaiting it either hangs the spec or samples one\n * frame and reports a value that was never settled. {@link isSweeping} answers the one\n * durable fact — that the sweep started. Nor is there a `getLoopAngle()` or a wait for\n * the loop: `[loop]` writes a new angle on every frame for as long as it is on, so the\n * angle never settles and any sample is one frame of an endless animation.\n * {@link isLooping} answers that it is on.\n *\n * @example\n * ```ts\n * const card = await loader.getHarness(WrBorderGlowHarness.with({ text: /Hover me/ }));\n *\n * expect(await card.getBorderRadius()).toBe(28);\n * expect(await card.getPointerAngle()).toBeNull(); // no pointer, sweep or loop has written one yet\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrBorderGlowHarness extends ComponentHarness {\n static hostSelector = 'wr-border-glow';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrBorderGlowHarnessFilters = {}): HarnessPredicate<WrBorderGlowHarness> {\n return new HarnessPredicate(WrBorderGlowHarness, options)\n .addOption('text', options.text, (harness, text) =>\n HarnessPredicate.stringMatches(harness.getContentText(), text)\n )\n .addOption('sweeping', options.sweeping, async (harness, sweeping) => (await harness.isSweeping()) === sweeping)\n .addOption('looping', options.looping, async (harness, looping) => (await harness.isLooping()) === looping);\n }\n\n private readonly edge = this.locatorFor('.wr-border-glow__edge');\n\n /** The corner radius the stylesheet is told to round to, in pixels. */\n async getBorderRadius(): Promise<number> {\n return this.readNumberVar('--wr-border-glow-radius', 'getBorderRadius');\n }\n\n /** How far past the card edge the halo is told to reach, in pixels. */\n async getGlowRadius(): Promise<number> {\n return this.readNumberVar('--wr-border-glow-padding', 'getGlowRadius');\n }\n\n /**\n * The width of the lit cone, as a share of the perimeter.\n *\n * Unitless by contract — the stylesheet multiplies it — so a `px` creeping in here is\n * a real regression that leaves the mask with a length where it wants a number.\n */\n async getConeSpread(): Promise<number> {\n return this.readNumberVar('--wr-border-glow-cone-spread', 'getConeSpread');\n }\n\n /** How sharply the halo fades as the cursor leaves an edge; lower is a wider falloff. */\n async getEdgeSensitivity(): Promise<number> {\n return this.readNumberVar('--wr-border-glow-edge-sensitivity', 'getEdgeSensitivity');\n }\n\n /** Strength of the interior soft-light bloom, again unitless. */\n async getFillOpacity(): Promise<number> {\n return this.readNumberVar('--wr-border-glow-fill-opacity', 'getFillOpacity');\n }\n\n /**\n * The card fill the author asked for, or `null` when they left it to the theme.\n *\n * The distinction is the whole point: an unset `[backgroundColor]` means the surface\n * token decides, light or dark, and a card that starts declaring its own fill has\n * stopped following the theme.\n */\n async getBackgroundColor(): Promise<string | null> {\n return this.readVar('--wr-border-glow-bg');\n }\n\n /**\n * The halo colour at full strength, or `null` when the theme decides.\n *\n * Comes back as written, in one of two forms, so this also pins the assembly: the\n * `hsl(H deg S% L% / A%)` built from bare `'H S L'` parts, or\n * `color-mix(in srgb, <colour> 100%, transparent)` for any other value. Be aware the\n * second form is a containment check and not a colour parser — `'banana'` is written\n * just as faithfully as `'#3567ff'`, and the browser then drops every halo declaration\n * that reads it — so a plausible-looking value here does not mean it paints. A value\n * that could escape the `color-mix()` is never written, and reads `null`.\n */\n async getGlowColor(): Promise<string | null> {\n return this.readVar('--wr-border-glow-color');\n }\n\n /**\n * The seven halo alphas in percent, brightest first, or `null` when no glow colour\n * is set.\n *\n * This is the whole of `[glowIntensity]`: the steps are `[100, 60, 50, 40, 30, 20,\n * 10]` multiplied by the intensity and clamped at 100, so `0.5` gives\n * `[50, 30, 25, 20, 15, 10, 5]` and anything above 1 saturates from the top down. The\n * clamp is one-sided — a negative intensity produces negative percentages, which a\n * browser drops as invalid declarations and the halo vanishes — so the numbers are\n * returned as written rather than corrected, which is how a spec can see it.\n *\n * Read from either form {@link getGlowColor} describes: the `/ A%` of an `hsl()`, or\n * the colour's share in a `color-mix()`. All seven steps must be in the form the first\n * one is — they are written together from one value, so a mix of the two is a ramp\n * that broke half way.\n */\n async getGlowAlphaRamp(): Promise<number[] | null> {\n const declarations = await this.declarations();\n const first = declarations.get('--wr-border-glow-color');\n if (first === undefined) return null;\n const form = first.startsWith('color-mix(') ? GLOW_MIX_ALPHA : GLOW_ALPHA;\n\n return GLOW_VAR_SUFFIXES.map(suffix => {\n const name = `--wr-border-glow-color${suffix}`;\n const raw = declarations.get(name);\n const alpha = raw === undefined ? null : form.exec(raw);\n if (!alpha) {\n throw new Error(\n `WrBorderGlowHarness.getGlowAlphaRamp(): \\`${name}\\` reads \"${raw ?? '(absent)'}\". The seven halo steps ` +\n 'are written together from one glow colour, so a step that is missing, carries no alpha, or is not ' +\n `the same \\`${form === GLOW_ALPHA ? 'hsl(… / N%)' : 'color-mix(in srgb, … N%, transparent)'}\\` as the ` +\n 'first means the ramp stopped being built — the halo would fade in bands the stylesheet cannot use.'\n );\n }\n return Number.parseFloat(alpha[1]);\n });\n }\n\n /**\n * The seven mesh-gradient colours, in slot order, or `null` when no palette was set.\n *\n * The slots do not map one-to-one onto the palette: they take colours\n * `[0, 1, 2, 0, 1, 2, 1]`, each index clamped to the last entry the palette actually\n * has. So a two-colour palette repeats the second colour rather than reading past the\n * end — which is the case worth a spec, since `undefined` in a `radial-gradient()`\n * kills the whole declaration silently.\n */\n async getGradientColors(): Promise<string[] | null> {\n const declarations = await this.declarations();\n if (!declarations.has('--wr-border-glow-gradient-one')) return null;\n\n return GRADIENT_VAR_SLOTS.map(slot => {\n const name = `--wr-border-glow-gradient-${slot}`;\n const raw = declarations.get(name);\n const colour = raw === undefined ? null : RADIAL_GRADIENT_COLOR.exec(raw);\n if (!colour) {\n throw new Error(\n `WrBorderGlowHarness.getGradientColors(): \\`${name}\\` reads \"${raw ?? '(absent)'}\", which is not the ` +\n '`radial-gradient(at X% Y%, <colour> 0px, …)` the component builds. All seven slots are written from ' +\n 'one palette, so one of them being different means the mapping broke, not the palette.'\n );\n }\n return colour[1];\n });\n }\n\n /**\n * The flat colour behind the mesh, or `null` when no palette was set.\n *\n * Always the palette's FIRST entry. Worth its own method because the base slice is the\n * one that shows where the gradients are transparent, and it drifting to the last\n * colour changes the card's whole cast without touching a gradient.\n */\n async getBaseGradientColor(): Promise<string | null> {\n const raw = await this.readVar('--wr-border-glow-gradient-base');\n if (raw === null) return null;\n\n const colour = LINEAR_GRADIENT_COLOR.exec(raw);\n if (!colour) {\n throw new Error(\n `WrBorderGlowHarness.getBaseGradientColor(): \\`--wr-border-glow-gradient-base\\` reads \"${raw}\", which is ` +\n 'not the `linear-gradient(<colour> 0 100%)` the component builds from the palette.'\n );\n }\n return colour[1];\n }\n\n /**\n * Where the lit cone points, in degrees: `0` is straight up and the angle grows\n * clockwise. Three things write it — the pointer, from where it sits; the mount sweep;\n * and `[loop]`, on every frame, or once at a resting 45 under reduced motion — so a\n * looping card answers with no pointer at all. `null` means nothing has written it yet.\n *\n * `null` is a state of its own rather than a stand-in for zero — the stylesheet's own\n * default applies until the first write, and a pointer at dead centre legitimately\n * reports `0`, so a harness that folded the two together could not tell an untouched\n * card from one being pointed at from the middle.\n */\n async getPointerAngle(): Promise<number | null> {\n const raw = await this.readVar('--wr-border-glow-angle');\n return raw === null ? null : Number.parseFloat(raw);\n }\n\n /**\n * How lit the edge is told to be: `0` at dead centre, `100` at the edge. The pointer\n * writes it from where it sits, the mount sweep as it lights and fades, and `[loop]` holds it at\n * 100 for as long as it is on, re-lighting it when a pointer leaves. `null` means\n * nothing has written it yet.\n *\n * For a pointer on a diagonal the NEARER axis wins rather than the two averaging, so a\n * cursor level with the bottom edge reads 100 wherever it is along it.\n */\n async getEdgeProximity(): Promise<number | null> {\n const raw = await this.readVar('--wr-border-glow-edge-proximity');\n return raw === null ? null : Number.parseFloat(raw);\n }\n\n /**\n * Point at the card, in client coordinates.\n *\n * **Refuses on a card with no box, which in a unit test is every card.** The component\n * measures the pointer against its own centre, and with a 0×0 rect that maths\n * degenerates: the centre is the top-left corner, and `1 / Math.min(0, 0)` pins the\n * proximity at 100 for every position on the page. Both would come back as confident\n * numbers describing nothing. Give the host a box first, exactly as the component's own\n * spec does:\n *\n * ```ts\n * const card = fixture.nativeElement.querySelector('wr-border-glow');\n * card.getBoundingClientRect = () => ({ left: 0, top: 0, width: 200, height: 100 }) as DOMRect;\n * ```\n *\n * A `pointermove` is dispatched on the host itself, so it needs no hit test and cannot\n * miss — the coordinates only ever reach the component's own arithmetic.\n */\n async movePointerTo(clientX: number, clientY: number): Promise<void> {\n const host = await this.host();\n const { width, height } = await host.getDimensions();\n if (!width || !height) {\n throw new Error(\n `WrBorderGlowHarness.movePointerTo(${clientX}, ${clientY}): this card measures ${width}×${height}, so a ` +\n 'pointer position over it means nothing — the component reads the cursor against the card centre, and ' +\n 'with no box the centre is the top-left corner and the proximity saturates for every coordinate. Stub ' +\n '`getBoundingClientRect` on the host first.'\n );\n }\n await host.dispatchEvent('pointermove', { clientX, clientY, pointerId: 1, isPrimary: true });\n }\n\n /**\n * Whether the one-shot mount sweep is running.\n *\n * The class is added synchronously when the sweep starts and removed when it ends\n * about four seconds later, or when the component is torn down — so a spec asserts\n * that it STARTED, and leaves the angle alone while it does. This is also the\n * reduced-motion assertion: `[animated]=\"true\"` for someone who asked for less motion\n * must leave this `false`, and no angle written at all.\n */\n async isSweeping(): Promise<boolean> {\n return (await this.host()).hasClass('wr-border-glow--sweeping');\n }\n\n /**\n * Whether the endless loop holds the card.\n *\n * The class is added when `[loop]` turns on, under reduced motion too — there the edge\n * stays lit and still, so the glow layers must stay visible — and removed when it turns\n * off. Like {@link isSweeping}, it answers that the loop is ON, not where the cone is:\n * the angle moves on every `requestAnimationFrame` and never settles, which is why the\n * class JSDoc lists no wait for it.\n */\n async isLooping(): Promise<boolean> {\n return (await this.host()).hasClass('wr-border-glow--looping');\n }\n\n /** Whether the halo layer is in the markup — the element the whole outer glow paints on. */\n async hasHaloLayer(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-border-glow__edge')()) !== null;\n }\n\n /**\n * Whether the decoration stays out of the accessibility tree.\n *\n * The halo layer is the component's only decorative NODE — every other layer is a\n * pseudo-element and so was never in the tree to begin with. It carries no text and no\n * name, so losing its `aria-hidden` puts an anonymous element between the reader and\n * the card's content.\n */\n async isDecorationHiddenFromAssistiveTech(): Promise<boolean> {\n return (await (await this.edge()).getAttribute('aria-hidden')) === 'true';\n }\n\n /**\n * The projected content's text, trimmed.\n *\n * Read from `.wr-border-glow__inner` rather than the host, which is the assertion:\n * content that lands as a bare host child instead of inside the wrapper renders\n * underneath the interior bloom, and reading the host would report the same string\n * either way.\n */\n async getContentText(): Promise<string> {\n return (await this.locatorFor('.wr-border-glow__inner')()).text();\n }\n\n /** The host's inline declarations — the component's whole written output. */\n private async declarations(): Promise<Map<string, string>> {\n return parseInlineDeclarations((await (await this.host()).getAttribute('style')) ?? '');\n }\n\n /** One inline custom property, or `null` when the component has not written it. */\n private async readVar(name: string): Promise<string | null> {\n return (await this.declarations()).get(name) ?? null;\n }\n\n /** One inline custom property that is always written, as a number. */\n private async readNumberVar(name: string, method: string): Promise<number> {\n const raw = await this.readVar(name);\n const value = raw === null ? Number.NaN : Number.parseFloat(raw);\n if (Number.isNaN(value)) {\n throw new Error(\n `WrBorderGlowHarness.${method}(): \\`${name}\\` reads \"${raw ?? '(absent)'}\" on the host. The component ` +\n 'writes this one on every input change whatever the inputs say, so a missing or unreadable value means ' +\n 'the variable bag stopped reaching the element at all.'\n );\n }\n return value;\n }\n}\n"],"mappings":";;;;;;;AAYA,MAAM,oBAAoB;CAAC;CAAI;CAAO;CAAO;CAAO;CAAO;CAAO;AAAK;AAGvE,MAAM,qBAAqB;CAAC;CAAO;CAAO;CAAS;CAAQ;CAAQ;CAAO;AAAO;AAGjF,MAAM,aAAa;AAGnB,MAAM,iBAAiB;AAGvB,MAAM,wBAAwB;AAG9B,MAAM,wBAAwB;AAW9B,SAAS,wBAAwB,OAAa;CAC5C,MAAM,+BAAe,IAAI,IAAG;CAC5B,KAAK,MAAM,eAAe,MAAM,MAAM,GAAG,GAAG;EAC1C,MAAM,QAAQ,YAAY,QAAQ,GAAG;EACrC,IAAI,UAAU,IAAI;EAClB,MAAM,O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its/border-glow/testing/wr-border-glow-harness.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\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrBorderGlowHarnessFilters } from './types';\n\n/** The seven halo steps, in the order the component writes them: 100%, 60%, 50%, 40%, 30%, 20%, 10%. */\nconst GLOW_VAR_SUFFIXES = ['', '-60', '-50', '-40', '-30', '-20', '-10'] as const;\n\n/** The seven mesh-gradient slots, spelled out rather than numbered — as the component names them. */\nconst GRADIENT_VAR_SLOTS = ['one', 'two', 'three', 'four', 'five', 'six', 'seven'] as const;\n\n/** `hsl(40deg 80% 80% / 65%)` — the alpha, which is the only part `glowIntensity` moves. */\nconst GLOW_ALPHA = /\\/\\s*(-?[\\d.]+)%\\s*\\)\\s*$/;\n\n/** `color-mix(in srgb, var(--wr-color-primary) 65%, transparent)` — the same alpha, for a CSS colour. */\nconst GLOW_MIX_ALPHA = /^color-mix\\(in srgb,\\s*.+\\s+(-?[\\d.]+)%\\s*,\\s*transparent\\s*\\)$/;\n\n/** `radial-gradient(at 80% 55%, #c084fc 0px, transparent 50%)` — the colour, not the position. */\nconst RADIAL_GRADIENT_COLOR = /^radial-gradient\\(\\s*at\\s+[^,]+,\\s*(.+?)\\s+0px\\s*,/;\n\n/** `linear-gradient(#c084fc 0 100%)` — the flat base slice. */\nconst LINEAR_GRADIENT_COLOR = /^linear-gradient\\(\\s*(.+?)\\s+0\\s+100%\\s*\\)$/;\n\n/**\n * Split an inline `style` attribute into its declarations.\n *\n * Read from the attribute rather than through `getCssValue()` on purpose. jsdom echoes\n * an inline custom property back through `getComputedStyle`, so the computed read passes\n * here and would answer something else entirely in a browser — where the stylesheet's\n * own per-theme default resolves and \"the author left this to the theme\" quietly becomes\n * a colour. The attribute holds what the component itself wrote, and nothing else.\n */\nfunction parseInlineDeclarations(style: string): Map<string, string> {\n const declarations = new Map<string, string>();\n for (const declaration of style.split(';')) {\n const colon = declaration.indexOf(':');\n if (colon === -1) continue;\n const name = declaration.slice(0, colon).trim();\n if (name !== '') declarations.set(name, declaration.slice(colon + 1).trim());\n }\n return declarations;\n}\n\n/**\n * Test harness for `<wr-border-glow>` — a card whose border lights up under the cursor.\n *\n * **Nearly all of this component is a bag of custom properties written onto the host,\n * and that is what the harness reads.** The paint itself — the conic mask, the stacked\n * `box-shadow` halo, the soft-light bloom — lives in the stylesheet, so a unit test can\n * never see it. What it CAN see is the arithmetic that feeds it, and that is where the\n * breakages are: the seven-step alpha ramp {@link getGlowAlphaRamp} derives from\n * `glowIntensity`, the `[0,1,2,0,1,2,1]` palette mapping in {@link getGradientColors}\n * with its clamp for short palettes, and the pointer maths behind\n * {@link getPointerAngle} / {@link getEdgeProximity}.\n *\n * **Every custom-property getter reads the inline declaration** — see\n * {@link parseInlineDeclarations} for why a computed read would be a different, and\n * wrong, question.\n *\n * **A colour getter answering `null` means the input is not on the host now**, which is\n * the contract when it is unset or its value was refused: the stylesheet's per-theme\n * default takes over. An input set and then put back to `null` comes off the host, so\n * `null` says nothing about whether it was ever set. Each colour input writes its own\n * `--wr-border-glow-input-*` twin, and that twin is what these read — never the hook it\n * stands in for (`--wr-border-glow-bg`, `-color`, `-gradient-*`), which stays the\n * author's, so a value an author put there is not what a getter reports.\n *\n * There is deliberately no `getGlowOpacity()`, `isGlowVisible()` or `isHovered()`: the\n * visible strength is a `calc()` in the stylesheet gated behind `:not(:hover)`, and\n * jsdom loads no stylesheet and matches no `:hover`, so any number would be invented.\n * There is no measured halo extent either — `.wr-border-glow__edge` is 0×0 in a test,\n * and {@link getGlowRadius} reads what the component asked for instead. And there is no\n * `getSweepProgress()` / `waitForSweep()`: the mount sweep is a four-second chain of\n * `requestAnimationFrame` tweens, so awaiting it either hangs the spec or samples one\n * frame and reports a value that was never settled. {@link isSweeping} answers the one\n * durable fact — that the sweep started. Nor is there a `getLoopAngle()` or a wait for\n * the loop: `[loop]` writes a new angle on every frame for as long as it is on, so the\n * angle never settles and any sample is one frame of an endless animation.\n * {@link isLooping} answers that it is on.\n *\n * @example\n * ```ts\n * const card = await loader.getHarness(WrBorderGlowHarness.with({ text: /Hover me/ }));\n *\n * expect(await card.getBorderRadius()).toBe(28);\n * expect(await card.getPointerAngle()).toBeNull(); // no pointer, sweep or loop has written one yet\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrBorderGlowHarness extends ComponentHarness {\n static hostSelector = 'wr-border-glow';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrBorderGlowHarnessFilters = {}): HarnessPredicate<WrBorderGlowHarness> {\n return new HarnessPredicate(WrBorderGlowHarness, options)\n .addOption('text', options.text, (harness, text) =>\n HarnessPredicate.stringMatches(harness.getContentText(), text)\n )\n .addOption('sweeping', options.sweeping, async (harness, sweeping) => (await harness.isSweeping()) === sweeping)\n .addOption('looping', options.looping, async (harness, looping) => (await harness.isLooping()) === looping);\n }\n\n private readonly edge = this.locatorFor('.wr-border-glow__edge');\n\n /** The corner radius the stylesheet is told to round to, in pixels. */\n async getBorderRadius(): Promise<number> {\n return this.readNumberVar('--wr-border-glow-radius', 'getBorderRadius');\n }\n\n /** How far past the card edge the halo is told to reach, in pixels. */\n async getGlowRadius(): Promise<number> {\n return this.readNumberVar('--wr-border-glow-padding', 'getGlowRadius');\n }\n\n /**\n * The width of the lit cone, as a share of the perimeter.\n *\n * Unitless by contract — the stylesheet multiplies it — so a `px` creeping in here is\n * a real regression that leaves the mask with a length where it wants a number.\n */\n async getConeSpread(): Promise<number> {\n return this.readNumberVar('--wr-border-glow-cone-spread', 'getConeSpread');\n }\n\n /** How sharply the halo fades as the cursor leaves an edge; lower is a wider falloff. */\n async getEdgeSensitivity(): Promise<number> {\n return this.readNumberVar('--wr-border-glow-edge-sensitivity', 'getEdgeSensitivity');\n }\n\n /** Strength of the interior soft-light bloom, again unitless. */\n async getFillOpacity(): Promise<number> {\n return this.readNumberVar('--wr-border-glow-fill-opacity', 'getFillOpacity');\n }\n\n /**\n * The card fill `[backgroundColor]` asked for, or `null` when it left the fill to the\n * `--wr-border-glow-bg` hook, and so to the theme.\n *\n * The distinction is the whole point: an unset `[backgroundColor]` means the surface\n * token decides, light or dark, and a card that starts declaring its own fill has\n * stopped following the theme.\n */\n async getBackgroundColor(): Promise<string | null> {\n return this.readVar('--wr-border-glow-input-bg');\n }\n\n /**\n * The halo colour at full strength, or `null` when the theme decides.\n *\n * Comes back as written, in one of two forms, so this also pins the assembly: the\n * `hsl(H deg S% L% / A%)` built from bare `'H S L'` parts, or\n * `color-mix(in srgb, <colour> 100%, transparent)` for any other value. Be aware the\n * second form is a containment check and not a colour parser — `'banana'` is written\n * just as faithfully as `'#3567ff'`, and the browser then drops every halo declaration\n * that reads it — so a plausible-looking value here does not mean it paints. A value\n * that could escape the `color-mix()` is never written, and reads `null`.\n */\n async getGlowColor(): Promise<string | null> {\n return this.readVar('--wr-border-glow-input-color');\n }\n\n /**\n * The seven halo alphas in percent, brightest first, or `null` when no glow colour\n * is set.\n *\n * This is the whole of `[glowIntensity]`: the steps are `[100, 60, 50, 40, 30, 20,\n * 10]` multiplied by the intensity and clamped at 100, so `0.5` gives\n * `[50, 30, 25, 20, 15, 10, 5]` and anything above 1 saturates from the top down. The\n * clamp is one-sided — a negative intensity produces negative percentages, which a\n * browser drops as invalid declarations and the halo vanishes — so the numbers are\n * returned as written rather than corrected, which is how a spec can see it.\n *\n * Read from either form {@link getGlowColor} describes: the `/ A%` of an `hsl()`, or\n * the colour's share in a `color-mix()`. All seven steps must be in the form the first\n * one is — they are written together from one value, so a mix of the two is a ramp\n * that broke half way.\n */\n async getGlowAlphaRamp(): Promise<number[] | null> {\n const declarations = await this.declarations();\n const first = declarations.get('--wr-border-glow-input-color');\n if (first === undefined) return null;\n const form = first.startsWith('color-mix(') ? GLOW_MIX_ALPHA : GLOW_ALPHA;\n\n return GLOW_VAR_SUFFIXES.map(suffix => {\n const name = `--wr-border-glow-input-color${suffix}`;\n const raw = declarations.get(name);\n const alpha = raw === undefined ? null : form.exec(raw);\n if (!alpha) {\n throw new Error(\n `WrBorderGlowHarness.getGlowAlphaRamp(): \\`${name}\\` reads \"${raw ?? '(absent)'}\". The seven halo steps ` +\n 'are written together from one glow colour, so a step that is missing, carries no alpha, or is not ' +\n `the same \\`${form === GLOW_ALPHA ? 'hsl(… / N%)' : 'color-mix(in srgb, … N%, transparent)'}\\` as the ` +\n 'first means the ramp stopped being built — the halo would fade in bands the stylesheet cannot use.'\n );\n }\n return Number.parseFloat(alpha[1]);\n });\n }\n\n /**\n * The seven mesh-gradient colours, in slot order, or `null` when no palette was set.\n *\n * The slots do not map one-to-one onto the palette: they take colours\n * `[0, 1, 2, 0, 1, 2, 1]`, each index clamped to the last entry the palette actually\n * has. So a two-colour palette repeats the second colour rather than reading past the\n * end — which is the case worth a spec, since `undefined` in a `radial-gradient()`\n * kills the whole declaration silently.\n */\n async getGradientColors(): Promise<string[] | null> {\n const declarations = await this.declarations();\n if (!declarations.has('--wr-border-glow-input-gradient-one')) return null;\n\n return GRADIENT_VAR_SLOTS.map(slot => {\n const name = `--wr-border-glow-input-gradient-${slot}`;\n const raw = declarations.get(name);\n const colour = raw === undefined ? null : RADIAL_GRADIENT_COLOR.exec(raw);\n if (!colour) {\n throw new Error(\n `WrBorderGlowHarness.getGradientColors(): \\`${name}\\` reads \"${raw ?? '(absent)'}\", which is not the ` +\n '`radial-gradient(at X% Y%, <colour> 0px, …)` the component builds. All seven slots are written from ' +\n 'one palette, so one of them being different means the mapping broke, not the palette.'\n );\n }\n return colour[1];\n });\n }\n\n /**\n * The flat colour behind the mesh, or `null` when no palette was set.\n *\n * Always the palette's FIRST entry. Worth its own method because the base slice is the\n * one that shows where the gradients are transparent, and it drifting to the last\n * colour changes the card's whole cast without touching a gradient.\n */\n async getBaseGradientColor(): Promise<string | null> {\n const raw = await this.readVar('--wr-border-glow-input-gradient-base');\n if (raw === null) return null;\n\n const colour = LINEAR_GRADIENT_COLOR.exec(raw);\n if (!colour) {\n throw new Error(\n `WrBorderGlowHarness.getBaseGradientColor(): \\`--wr-border-glow-input-gradient-base\\` reads \"${raw}\", which is ` +\n 'not the `linear-gradient(<colour> 0 100%)` the component builds from the palette.'\n );\n }\n return colour[1];\n }\n\n /**\n * Where the lit cone points, in degrees: `0` is straight up and the angle grows\n * clockwise. Three things write it — the pointer, from where it sits; the mount sweep;\n * and `[loop]`, on every frame, or once at a resting 45 under reduced motion — so a\n * looping card answers with no pointer at all. `null` means nothing has written it yet.\n *\n * `null` is a state of its own rather than a stand-in for zero — the stylesheet's own\n * default applies until the first write, and a pointer at dead centre legitimately\n * reports `0`, so a harness that folded the two together could not tell an untouched\n * card from one being pointed at from the middle.\n */\n async getPointerAngle(): Promise<number | null> {\n const raw = await this.readVar('--wr-border-glow-angle');\n return raw === null ? null : Number.parseFloat(raw);\n }\n\n /**\n * How lit the edge is told to be: `0` at dead centre, `100` at the edge. The pointer\n * writes it from where it sits, the mount sweep as it lights and fades, and `[loop]` holds it at\n * 100 for as long as it is on, re-lighting it when a pointer leaves. `null` means\n * nothing has written it yet.\n *\n * For a pointer on a diagonal the NEARER axis wins rather than the two averaging, so a\n * cursor level with the bottom edge reads 100 wherever it is along it.\n */\n async getEdgeProximity(): Promise<number | null> {\n const raw = await this.readVar('--wr-border-glow-edge-proximity');\n return raw === null ? null : Number.parseFloat(raw);\n }\n\n /**\n * Point at the card, in client coordinates.\n *\n * **Refuses on a card with no box, which in a unit test is every card.** The component\n * measures the pointer against its own centre, and with a 0×0 rect that maths\n * degenerates: the centre is the top-left corner, and `1 / Math.min(0, 0)` pins the\n * proximity at 100 for every position on the page. Both would come back as confident\n * numbers describing nothing. Give the host a box first, exactly as the component's own\n * spec does:\n *\n * ```ts\n * const card = fixture.nativeElement.querySelector('wr-border-glow');\n * card.getBoundingClientRect = () => ({ left: 0, top: 0, width: 200, height: 100 }) as DOMRect;\n * ```\n *\n * A `pointermove` is dispatched on the host itself, so it needs no hit test and cannot\n * miss — the coordinates only ever reach the component's own arithmetic.\n */\n async movePointerTo(clientX: number, clientY: number): Promise<void> {\n const host = await this.host();\n const { width, height } = await host.getDimensions();\n if (!width || !height) {\n throw new Error(\n `WrBorderGlowHarness.movePointerTo(${clientX}, ${clientY}): this card measures ${width}×${height}, so a ` +\n 'pointer position over it means nothing — the component reads the cursor against the card centre, and ' +\n 'with no box the centre is the top-left corner and the proximity saturates for every coordinate. Stub ' +\n '`getBoundingClientRect` on the host first.'\n );\n }\n await host.dispatchEvent('pointermove', { clientX, clientY, pointerId: 1, isPrimary: true });\n }\n\n /**\n * Whether the one-shot mount sweep is running.\n *\n * The class is added synchronously when the sweep starts and removed when it ends\n * about four seconds later, or when the component is torn down — so a spec asserts\n * that it STARTED, and leaves the angle alone while it does. This is also the\n * reduced-motion assertion: `[animated]=\"true\"` for someone who asked for less motion\n * must leave this `false`, and no angle written at all.\n */\n async isSweeping(): Promise<boolean> {\n return (await this.host()).hasClass('wr-border-glow--sweeping');\n }\n\n /**\n * Whether the endless loop holds the card.\n *\n * The class is added when `[loop]` turns on, under reduced motion too — there the edge\n * stays lit and still, so the glow layers must stay visible — and removed when it turns\n * off. Like {@link isSweeping}, it answers that the loop is ON, not where the cone is:\n * the angle moves on every `requestAnimationFrame` and never settles, which is why the\n * class JSDoc lists no wait for it.\n */\n async isLooping(): Promise<boolean> {\n return (await this.host()).hasClass('wr-border-glow--looping');\n }\n\n /** Whether the halo layer is in the markup — the element the whole outer glow paints on. */\n async hasHaloLayer(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-border-glow__edge')()) !== null;\n }\n\n /**\n * Whether the decoration stays out of the accessibility tree.\n *\n * The halo layer is the component's only decorative NODE — every other layer is a\n * pseudo-element and so was never in the tree to begin with. It carries no text and no\n * name, so losing its `aria-hidden` puts an anonymous element between the reader and\n * the card's content.\n */\n async isDecorationHiddenFromAssistiveTech(): Promise<boolean> {\n return (await (await this.edge()).getAttribute('aria-hidden')) === 'true';\n }\n\n /**\n * The projected content's text, trimmed.\n *\n * Read from `.wr-border-glow__inner` rather than the host, which is the assertion:\n * content that lands as a bare host child instead of inside the wrapper renders\n * underneath the interior bloom, and reading the host would report the same string\n * either way.\n */\n async getContentText(): Promise<string> {\n return (await this.locatorFor('.wr-border-glow__inner')()).text();\n }\n\n /** The host's inline declarations — the component's whole written output. */\n private async declarations(): Promise<Map<string, string>> {\n return parseInlineDeclarations((await (await this.host()).getAttribute('style')) ?? '');\n }\n\n /** One inline custom property, or `null` when the component has not written it. */\n private async readVar(name: string): Promise<string | null> {\n return (await this.declarations()).get(name) ?? null;\n }\n\n /** One inline custom property that is always written, as a number. */\n private async readNumberVar(name: string, method: string): Promise<number> {\n const raw = await this.readVar(name);\n const value = raw === null ? Number.NaN : Number.parseFloat(raw);\n if (Number.isNaN(value)) {\n throw new Error(\n `WrBorderGlowHarness.${method}(): \\`${name}\\` reads \"${raw ?? '(absent)'}\" on the host. The component ` +\n 'writes this one on every input change whatever the inputs say, so a missing or unreadable value means ' +\n 'the variable bag stopped reaching the element at all.'\n );\n }\n return value;\n }\n}\n"],"mappings":";;;;;;;AAYA,MAAM,oBAAoB;CAAC;CAAI;CAAO;CAAO;CAAO;CAAO;CAAO;AAAK;AAGvE,MAAM,qBAAqB;CAAC;CAAO;CAAO;CAAS;CAAQ;CAAQ;CAAO;AAAO;AAGjF,MAAM,aAAa;AAGnB,MAAM,iBAAiB;AAGvB,MAAM,wBAAwB;AAG9B,MAAM,wBAAwB;AAW9B,SAAS,wBAAwB,OAAa;CAC5C,MAAM,+BAAe,IAAI,IAAG;CAC5B,KAAK,MAAM,eAAe,MAAM,MAAM,GAAG,GAAG;EAC1C,MAAM,QAAQ,YAAY,QAAQ,GAAG;EACrC,IAAI,UAAU,IAAI;EAClB,MAAM,OAAO,YAAY,MAAM,GAAG,KAAK,CAAC,CAAC,KAAI;EAC7C,IAAI,SAAS,IAAI,aAAa,IAAI,MAAM,Y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wr-border-glow-gradient-two",
|
|
52
|
-
"--wr-border-glow-gradient-three",
|
|
53
|
-
"--wr-border-glow-gradient-four",
|
|
54
|
-
"--wr-border-glow-gradient-five",
|
|
55
|
-
"--wr-border-glow-gradient-six",
|
|
56
|
-
"--wr-border-glow-gradient-seven"
|
|
50
|
+
"--wr-border-glow-input-gradient-one",
|
|
51
|
+
"--wr-border-glow-input-gradient-two",
|
|
52
|
+
"--wr-border-glow-input-gradient-three",
|
|
53
|
+
"--wr-border-glow-input-gradient-four",
|
|
54
|
+
"--wr-border-glow-input-gradient-five",
|
|
55
|
+
"--wr-border-glow-input-gradient-six",
|
|
56
|
+
"--wr-border-glow-input-gradient-seven"
|
|
57
57
|
];
|
|
58
58
|
const GRADIENT_COLOR_INDEX = [
|
|
59
59
|
0,
|
|
@@ -76,7 +76,7 @@ function buildGlowVars(glowColor, intensity) {
|
|
|
76
76
|
const out = {};
|
|
77
77
|
for (let i = 0; i < GLOW_OPACITY_STEPS.length; i++) {
|
|
78
78
|
const alpha = Math.min(GLOW_OPACITY_STEPS[i] * intensity, 100);
|
|
79
|
-
out[`--wr-border-glow-color${GLOW_VAR_SUFFIXES[i]}`] = parts ? `hsl(${base} / ${alpha}%)` : `color-mix(in srgb, ${base} ${alpha}%, transparent)`;
|
|
79
|
+
out[`--wr-border-glow-input-color${GLOW_VAR_SUFFIXES[i]}`] = parts ? `hsl(${base} / ${alpha}%)` : `color-mix(in srgb, ${base} ${alpha}%, transparent)`;
|
|
80
80
|
}
|
|
81
81
|
return out;
|
|
82
82
|
}
|
|
@@ -87,7 +87,7 @@ function buildGradientVars(colors) {
|
|
|
87
87
|
const colour = palette[Math.min(GRADIENT_COLOR_INDEX[i], palette.length - 1)];
|
|
88
88
|
out[GRADIENT_VAR_NAMES[i]] = `radial-gradient(at ${GRADIENT_POSITIONS[i]}, ${colour} 0px, transparent 50%)`;
|
|
89
89
|
}
|
|
90
|
-
out["--wr-border-glow-gradient-base"] = `linear-gradient(${palette[0]} 0 100%)`;
|
|
90
|
+
out["--wr-border-glow-input-gradient-base"] = `linear-gradient(${palette[0]} 0 100%)`;
|
|
91
91
|
return out;
|
|
92
92
|
}
|
|
93
93
|
function animateValue(opts) {
|
|
@@ -157,33 +157,24 @@ var WrBorderGlow = class WrBorderGlow {
|
|
|
157
157
|
isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
158
158
|
pointerInside = false;
|
|
159
159
|
cssVars = computed(() => {
|
|
160
|
-
const vars = {
|
|
161
|
-
"--wr-border-glow-radius": `${this.borderRadius()}px`,
|
|
162
|
-
"--wr-border-glow-padding": `${this.glowRadius()}px`,
|
|
163
|
-
"--wr-border-glow-cone-spread": String(this.coneSpread()),
|
|
164
|
-
"--wr-border-glow-edge-sensitivity": String(this.edgeSensitivity()),
|
|
165
|
-
"--wr-border-glow-fill-opacity": String(this.fillOpacity())
|
|
166
|
-
};
|
|
160
|
+
const vars = {};
|
|
167
161
|
const colors = this.colors();
|
|
168
162
|
if (colors !== null) Object.assign(vars, buildGradientVars(colors));
|
|
169
163
|
const bg = this.backgroundColor();
|
|
170
|
-
if (bg !== null && isSafeCssValue(bg)) vars["--wr-border-glow-bg"] = bg;
|
|
164
|
+
if (bg !== null && isSafeCssValue(bg)) vars["--wr-border-glow-input-bg"] = bg;
|
|
171
165
|
const glow = this.glowColor();
|
|
172
166
|
const glowVars = glow === null ? null : buildGlowVars(glow, this.glowIntensity());
|
|
173
167
|
if (glowVars !== null) Object.assign(vars, glowVars);
|
|
174
168
|
return vars;
|
|
175
169
|
}, ...ngDevMode ? [{ debugName: "cssVars" }] : /* istanbul ignore next */ []);
|
|
176
170
|
constructor() {
|
|
177
|
-
let written =
|
|
171
|
+
let written = [];
|
|
178
172
|
effect(() => {
|
|
179
173
|
const { style } = this.el.nativeElement;
|
|
180
174
|
const vars = this.cssVars();
|
|
181
|
-
for (const
|
|
182
|
-
written =
|
|
183
|
-
for (const
|
|
184
|
-
style.setProperty(k, v);
|
|
185
|
-
written[k] = style.getPropertyValue(k);
|
|
186
|
-
}
|
|
175
|
+
for (const k of written) if (!Object.hasOwn(vars, k)) style.removeProperty(k);
|
|
176
|
+
written = Object.keys(vars);
|
|
177
|
+
for (const k of written) style.setProperty(k, vars[k]);
|
|
187
178
|
});
|
|
188
179
|
if (!this.isBrowser) return;
|
|
189
180
|
effect((onCleanup) => {
|
|
@@ -425,11 +416,18 @@ var WrBorderGlow = class WrBorderGlow {
|
|
|
425
416
|
"pointermove": "onPointerMove($event)",
|
|
426
417
|
"pointerleave": "onPointerLeave()"
|
|
427
418
|
},
|
|
419
|
+
properties: {
|
|
420
|
+
"style.--wr-border-glow-radius.px": "borderRadius()",
|
|
421
|
+
"style.--wr-border-glow-padding.px": "glowRadius()",
|
|
422
|
+
"style.--wr-border-glow-cone-spread": "coneSpread()",
|
|
423
|
+
"style.--wr-border-glow-edge-sensitivity": "edgeSensitivity()",
|
|
424
|
+
"style.--wr-border-glow-fill-opacity": "fillOpacity()"
|
|
425
|
+
},
|
|
428
426
|
classAttribute: "wr-border-glow"
|
|
429
427
|
},
|
|
430
428
|
ngImport: i0,
|
|
431
429
|
template: "<span class=\"wr-border-glow__edge\" aria-hidden=\"true\"></span>\n<div class=\"wr-border-glow__inner\">\n <ng-content />\n</div>\n",
|
|
432
|
-
styles: [".wr-border-glow{--wr-border-glow-edge-proximity: 0;--wr-border-glow-angle: 45deg;--wr-border-glow-color: light-dark(hsl(40deg 90% 45% / 100%), hsl(40deg 80% 80% / 100%));--wr-border-glow-color-60: light-dark(hsl(40deg 90% 45% / 60%), hsl(40deg 80% 80% / 60%));--wr-border-glow-color-50: light-dark(hsl(40deg 90% 45% / 50%), hsl(40deg 80% 80% / 50%));--wr-border-glow-color-40: light-dark(hsl(40deg 90% 45% / 40%), hsl(40deg 80% 80% / 40%));--wr-border-glow-color-30: light-dark(hsl(40deg 90% 45% / 30%), hsl(40deg 80% 80% / 30%));--wr-border-glow-color-20: light-dark(hsl(40deg 90% 45% / 20%), hsl(40deg 80% 80% / 20%));--wr-border-glow-color-10: light-dark(hsl(40deg 90% 45% / 10%), hsl(40deg 80% 80% / 10%));--wr-border-glow-gradient-one: radial-gradient( at 80% 55%, light-dark(hsl(268deg 80% 50%), hsl(268deg 100% 76%)) 0px, transparent 50% );--wr-border-glow-gradient-two: radial-gradient( at 69% 34%, light-dark(hsl(349deg 85% 52%), hsl(349deg 100% 74%)) 0px, transparent 50% );--wr-border-glow-gradient-three: radial-gradient( at 8% 6%, light-dark(hsl(136deg 70% 38%), hsl(136deg 100% 78%)) 0px, transparent 50% );--wr-border-glow-gradient-four: radial-gradient( at 41% 38%, light-dark(hsl(192deg 90% 40%), hsl(192deg 100% 64%)) 0px, transparent 50% );--wr-border-glow-gradient-five: radial-gradient( at 86% 85%, light-dark(hsl(186deg 90% 38%), hsl(186deg 100% 74%)) 0px, transparent 50% );--wr-border-glow-gradient-six: radial-gradient( at 82% 18%, light-dark(hsl(40deg 95% 45%), hsl(52deg 100% 65%)) 0px, transparent 50% );--wr-border-glow-gradient-seven: radial-gradient( at 51% 4%, light-dark(hsl(12deg 90% 50%), hsl(12deg 100% 72%)) 0px, transparent 50% );--wr-border-glow-gradient-base: linear-gradient(light-dark(hsl(262deg 70% 50%), #c299ff) 0 100%);--wr-border-glow-outline: light-dark(var(--wr-border-base), rgb(255 255 255 / 15%));--wr-border-glow-edge-shadow: inset 0 0 0 1px var(--wr-border-glow-color), inset 0 0 1px 0 light-dark(transparent, var(--wr-border-glow-color-60)), inset 0 0 3px 0 light-dark(transparent, var(--wr-border-glow-color-50)), inset 0 0 6px 0 light-dark(transparent, var(--wr-border-glow-color-40)), inset 0 0 15px 0 light-dark(transparent, var(--wr-border-glow-color-30)), inset 0 0 25px 2px light-dark(transparent, var(--wr-border-glow-color-20)), inset 0 0 50px 2px light-dark(transparent, var(--wr-border-glow-color-10)), 0 0 1px 0 var(--wr-border-glow-color-60), 0 0 3px 0 var(--wr-border-glow-color-50), 0 0 6px 0 var(--wr-border-glow-color-40), 0 0 15px 0 var(--wr-border-glow-color-30), 0 0 25px 2px var(--wr-border-glow-color-20), 0 0 50px 2px var(--wr-border-glow-color-10);--wr-border-glow-halo-blend: normal;--wr-border-glow-fill-blend: normal;--wr-border-glow-fill-scale: .25;--wr-border-glow-edge-sensitivity: 30;--wr-border-glow-color-sensitivity: calc(var(--wr-border-glow-edge-sensitivity) + 20);--wr-border-glow-radius: 28px;--wr-border-glow-padding: 40px;--wr-border-glow-cone-spread: 25;position:relative;display:grid;border-radius:var(--wr-border-glow-radius);background:var(--wr-border-glow-bg, var(--wr-
|
|
430
|
+
styles: [".wr-border-glow{--wr-border-glow-edge-proximity: 0;--wr-border-glow-angle: 45deg;--wr-border-glow-bg: var(--wr-color-surface);--wr-border-glow-input-bg: initial;--wr-border-glow-input-color: initial;--wr-border-glow-input-color-60: initial;--wr-border-glow-input-color-50: initial;--wr-border-glow-input-color-40: initial;--wr-border-glow-input-color-30: initial;--wr-border-glow-input-color-20: initial;--wr-border-glow-input-color-10: initial;--wr-border-glow-input-gradient-one: initial;--wr-border-glow-input-gradient-two: initial;--wr-border-glow-input-gradient-three: initial;--wr-border-glow-input-gradient-four: initial;--wr-border-glow-input-gradient-five: initial;--wr-border-glow-input-gradient-six: initial;--wr-border-glow-input-gradient-seven: initial;--wr-border-glow-input-gradient-base: initial;--wr-border-glow-color: light-dark(hsl(40deg 90% 45% / 100%), hsl(40deg 80% 80% / 100%));--wr-border-glow-color-60: light-dark(hsl(40deg 90% 45% / 60%), hsl(40deg 80% 80% / 60%));--wr-border-glow-color-50: light-dark(hsl(40deg 90% 45% / 50%), hsl(40deg 80% 80% / 50%));--wr-border-glow-color-40: light-dark(hsl(40deg 90% 45% / 40%), hsl(40deg 80% 80% / 40%));--wr-border-glow-color-30: light-dark(hsl(40deg 90% 45% / 30%), hsl(40deg 80% 80% / 30%));--wr-border-glow-color-20: light-dark(hsl(40deg 90% 45% / 20%), hsl(40deg 80% 80% / 20%));--wr-border-glow-color-10: light-dark(hsl(40deg 90% 45% / 10%), hsl(40deg 80% 80% / 10%));--wr-border-glow-gradient-one: radial-gradient( at 80% 55%, light-dark(hsl(268deg 80% 50%), hsl(268deg 100% 76%)) 0px, transparent 50% );--wr-border-glow-gradient-two: radial-gradient( at 69% 34%, light-dark(hsl(349deg 85% 52%), hsl(349deg 100% 74%)) 0px, transparent 50% );--wr-border-glow-gradient-three: radial-gradient( at 8% 6%, light-dark(hsl(136deg 70% 38%), hsl(136deg 100% 78%)) 0px, transparent 50% );--wr-border-glow-gradient-four: radial-gradient( at 41% 38%, light-dark(hsl(192deg 90% 40%), hsl(192deg 100% 64%)) 0px, transparent 50% );--wr-border-glow-gradient-five: radial-gradient( at 86% 85%, light-dark(hsl(186deg 90% 38%), hsl(186deg 100% 74%)) 0px, transparent 50% );--wr-border-glow-gradient-six: radial-gradient( at 82% 18%, light-dark(hsl(40deg 95% 45%), hsl(52deg 100% 65%)) 0px, transparent 50% );--wr-border-glow-gradient-seven: radial-gradient( at 51% 4%, light-dark(hsl(12deg 90% 50%), hsl(12deg 100% 72%)) 0px, transparent 50% );--wr-border-glow-gradient-base: linear-gradient(light-dark(hsl(262deg 70% 50%), #c299ff) 0 100%);--wr-border-glow-outline: light-dark(var(--wr-border-base), rgb(255 255 255 / 15%));--wr-border-glow-edge-shadow: inset 0 0 0 1px var(--wr-border-glow-input-color, var(--wr-border-glow-color)), inset 0 0 1px 0 light-dark(transparent, var(--wr-border-glow-input-color-60, var(--wr-border-glow-color-60))), inset 0 0 3px 0 light-dark(transparent, var(--wr-border-glow-input-color-50, var(--wr-border-glow-color-50))), inset 0 0 6px 0 light-dark(transparent, var(--wr-border-glow-input-color-40, var(--wr-border-glow-color-40))), inset 0 0 15px 0 light-dark(transparent, var(--wr-border-glow-input-color-30, var(--wr-border-glow-color-30))), inset 0 0 25px 2px light-dark(transparent, var(--wr-border-glow-input-color-20, var(--wr-border-glow-color-20))), inset 0 0 50px 2px light-dark(transparent, var(--wr-border-glow-input-color-10, var(--wr-border-glow-color-10))), 0 0 1px 0 var(--wr-border-glow-input-color-60, var(--wr-border-glow-color-60)), 0 0 3px 0 var(--wr-border-glow-input-color-50, var(--wr-border-glow-color-50)), 0 0 6px 0 var(--wr-border-glow-input-color-40, var(--wr-border-glow-color-40)), 0 0 15px 0 var(--wr-border-glow-input-color-30, var(--wr-border-glow-color-30)), 0 0 25px 2px var(--wr-border-glow-input-color-20, var(--wr-border-glow-color-20)), 0 0 50px 2px var(--wr-border-glow-input-color-10, var(--wr-border-glow-color-10));--wr-border-glow-halo-blend: normal;--wr-border-glow-fill-blend: normal;--wr-border-glow-fill-scale: .25;--wr-border-glow-edge-sensitivity: 30;--wr-border-glow-color-sensitivity: calc(var(--wr-border-glow-edge-sensitivity) + 20);--wr-border-glow-radius: 28px;--wr-border-glow-padding: 40px;--wr-border-glow-cone-spread: 25;position:relative;display:grid;border-radius:var(--wr-border-glow-radius);background:var(--wr-border-glow-input-bg, var(--wr-border-glow-bg));overflow:visible;isolation:isolate;transform:translateZ(.01px);box-shadow:inset 0 0 0 1px var(--wr-border-glow-outline)}.wr-border-glow:before,.wr-border-glow:after,.wr-border-glow>.wr-border-glow__edge{content:\"\";position:absolute;inset:0;border-radius:inherit;transition:opacity .25s ease-out;z-index:-1}.wr-border-glow:not(:hover):not(.wr-border-glow--sweeping):not(.wr-border-glow--looping):before,.wr-border-glow:not(:hover):not(.wr-border-glow--sweeping):not(.wr-border-glow--looping):after,.wr-border-glow:not(:hover):not(.wr-border-glow--sweeping):not(.wr-border-glow--looping)>.wr-border-glow__edge{opacity:0;transition:opacity .75s ease-in-out}.wr-border-glow:before{border:1px solid transparent;background:linear-gradient(var(--wr-border-glow-input-bg, var(--wr-border-glow-bg)) 0 100%) padding-box,linear-gradient(#fff0 0 100%) border-box,var(--wr-border-glow-input-gradient-one, var(--wr-border-glow-gradient-one)) border-box,var(--wr-border-glow-input-gradient-two, var(--wr-border-glow-gradient-two)) border-box,var(--wr-border-glow-input-gradient-three, var(--wr-border-glow-gradient-three)) border-box,var(--wr-border-glow-input-gradient-four, var(--wr-border-glow-gradient-four)) border-box,var(--wr-border-glow-input-gradient-five, var(--wr-border-glow-gradient-five)) border-box,var(--wr-border-glow-input-gradient-six, var(--wr-border-glow-gradient-six)) border-box,var(--wr-border-glow-input-gradient-seven, var(--wr-border-glow-gradient-seven)) border-box,var(--wr-border-glow-input-gradient-base, var(--wr-border-glow-gradient-base)) border-box;opacity:calc((var(--wr-border-glow-edge-proximity) - var(--wr-border-glow-color-sensitivity)) / (100 - var(--wr-border-glow-color-sensitivity)));-webkit-mask-image:conic-gradient(from var(--wr-border-glow-angle) at center,black calc(var(--wr-border-glow-cone-spread) * 1%),transparent calc((var(--wr-border-glow-cone-spread) + 15) * 1%),transparent calc((100 - var(--wr-border-glow-cone-spread) - 15) * 1%),black calc((100 - var(--wr-border-glow-cone-spread)) * 1%));mask-image:conic-gradient(from var(--wr-border-glow-angle) at center,black calc(var(--wr-border-glow-cone-spread) * 1%),transparent calc((var(--wr-border-glow-cone-spread) + 15) * 1%),transparent calc((100 - var(--wr-border-glow-cone-spread) - 15) * 1%),black calc((100 - var(--wr-border-glow-cone-spread)) * 1%))}.wr-border-glow:after{border:1px solid transparent;background:var(--wr-border-glow-input-gradient-one, var(--wr-border-glow-gradient-one)) padding-box,var(--wr-border-glow-input-gradient-two, var(--wr-border-glow-gradient-two)) padding-box,var(--wr-border-glow-input-gradient-three, var(--wr-border-glow-gradient-three)) padding-box,var(--wr-border-glow-input-gradient-four, var(--wr-border-glow-gradient-four)) padding-box,var(--wr-border-glow-input-gradient-five, var(--wr-border-glow-gradient-five)) padding-box,var(--wr-border-glow-input-gradient-six, var(--wr-border-glow-gradient-six)) padding-box,var(--wr-border-glow-input-gradient-seven, var(--wr-border-glow-gradient-seven)) padding-box,var(--wr-border-glow-input-gradient-base, var(--wr-border-glow-gradient-base)) padding-box;-webkit-mask-image:linear-gradient(to bottom,#000,#000),radial-gradient(ellipse at 50% 50%,black 40%,transparent 65%),radial-gradient(ellipse at 66% 66%,black 5%,transparent 40%),radial-gradient(ellipse at 33% 33%,black 5%,transparent 40%),radial-gradient(ellipse at 66% 33%,black 5%,transparent 40%),radial-gradient(ellipse at 33% 66%,black 5%,transparent 40%),conic-gradient(from var(--wr-border-glow-angle) at center,transparent 5%,black 15%,black 85%,transparent 95%);mask-image:linear-gradient(to bottom,#000,#000),radial-gradient(ellipse at 50% 50%,black 40%,transparent 65%),radial-gradient(ellipse at 66% 66%,black 5%,transparent 40%),radial-gradient(ellipse at 33% 33%,black 5%,transparent 40%),radial-gradient(ellipse at 66% 33%,black 5%,transparent 40%),radial-gradient(ellipse at 33% 66%,black 5%,transparent 40%),conic-gradient(from var(--wr-border-glow-angle) at center,transparent 5%,black 15%,black 85%,transparent 95%);-webkit-mask-composite:source-out,source-over,source-over,source-over,source-over,source-over;mask-composite:subtract,add,add,add,add,add;opacity:calc(var(--wr-border-glow-fill-opacity, .5) * var(--wr-border-glow-fill-scale) * (var(--wr-border-glow-edge-proximity) - var(--wr-border-glow-color-sensitivity)) / (100 - var(--wr-border-glow-color-sensitivity)));mix-blend-mode:var(--wr-border-glow-fill-blend)}.wr-border-glow>.wr-border-glow__edge{inset:calc(var(--wr-border-glow-padding) * -1);pointer-events:none;z-index:1;-webkit-mask-image:conic-gradient(from var(--wr-border-glow-angle) at center,black 2.5%,transparent 10%,transparent 90%,black 97.5%);mask-image:conic-gradient(from var(--wr-border-glow-angle) at center,black 2.5%,transparent 10%,transparent 90%,black 97.5%);opacity:calc((var(--wr-border-glow-edge-proximity) - var(--wr-border-glow-edge-sensitivity)) / (100 - var(--wr-border-glow-edge-sensitivity)));mix-blend-mode:var(--wr-border-glow-halo-blend)}.wr-border-glow>.wr-border-glow__edge:before{content:\"\";position:absolute;inset:var(--wr-border-glow-padding);border-radius:inherit;box-shadow:var(--wr-border-glow-edge-shadow)}.wr-border-glow__inner{position:relative;z-index:1;display:flex;flex-direction:column}\n"],
|
|
433
431
|
encapsulation: i0.ViewEncapsulation.None
|
|
434
432
|
});
|
|
435
433
|
};
|
|
@@ -445,12 +443,17 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
445
443
|
encapsulation: ViewEncapsulation.None,
|
|
446
444
|
host: {
|
|
447
445
|
class: "wr-border-glow",
|
|
446
|
+
"[style.--wr-border-glow-radius.px]": "borderRadius()",
|
|
447
|
+
"[style.--wr-border-glow-padding.px]": "glowRadius()",
|
|
448
|
+
"[style.--wr-border-glow-cone-spread]": "coneSpread()",
|
|
449
|
+
"[style.--wr-border-glow-edge-sensitivity]": "edgeSensitivity()",
|
|
450
|
+
"[style.--wr-border-glow-fill-opacity]": "fillOpacity()",
|
|
448
451
|
"(pointerenter)": "onPointerEnter()",
|
|
449
452
|
"(pointermove)": "onPointerMove($event)",
|
|
450
453
|
"(pointerleave)": "onPointerLeave()"
|
|
451
454
|
},
|
|
452
455
|
template: "<span class=\"wr-border-glow__edge\" aria-hidden=\"true\"></span>\n<div class=\"wr-border-glow__inner\">\n <ng-content />\n</div>\n",
|
|
453
|
-
styles: [".wr-border-glow{--wr-border-glow-edge-proximity: 0;--wr-border-glow-angle: 45deg;--wr-border-glow-color: light-dark(hsl(40deg 90% 45% / 100%), hsl(40deg 80% 80% / 100%));--wr-border-glow-color-60: light-dark(hsl(40deg 90% 45% / 60%), hsl(40deg 80% 80% / 60%));--wr-border-glow-color-50: light-dark(hsl(40deg 90% 45% / 50%), hsl(40deg 80% 80% / 50%));--wr-border-glow-color-40: light-dark(hsl(40deg 90% 45% / 40%), hsl(40deg 80% 80% / 40%));--wr-border-glow-color-30: light-dark(hsl(40deg 90% 45% / 30%), hsl(40deg 80% 80% / 30%));--wr-border-glow-color-20: light-dark(hsl(40deg 90% 45% / 20%), hsl(40deg 80% 80% / 20%));--wr-border-glow-color-10: light-dark(hsl(40deg 90% 45% / 10%), hsl(40deg 80% 80% / 10%));--wr-border-glow-gradient-one: radial-gradient( at 80% 55%, light-dark(hsl(268deg 80% 50%), hsl(268deg 100% 76%)) 0px, transparent 50% );--wr-border-glow-gradient-two: radial-gradient( at 69% 34%, light-dark(hsl(349deg 85% 52%), hsl(349deg 100% 74%)) 0px, transparent 50% );--wr-border-glow-gradient-three: radial-gradient( at 8% 6%, light-dark(hsl(136deg 70% 38%), hsl(136deg 100% 78%)) 0px, transparent 50% );--wr-border-glow-gradient-four: radial-gradient( at 41% 38%, light-dark(hsl(192deg 90% 40%), hsl(192deg 100% 64%)) 0px, transparent 50% );--wr-border-glow-gradient-five: radial-gradient( at 86% 85%, light-dark(hsl(186deg 90% 38%), hsl(186deg 100% 74%)) 0px, transparent 50% );--wr-border-glow-gradient-six: radial-gradient( at 82% 18%, light-dark(hsl(40deg 95% 45%), hsl(52deg 100% 65%)) 0px, transparent 50% );--wr-border-glow-gradient-seven: radial-gradient( at 51% 4%, light-dark(hsl(12deg 90% 50%), hsl(12deg 100% 72%)) 0px, transparent 50% );--wr-border-glow-gradient-base: linear-gradient(light-dark(hsl(262deg 70% 50%), #c299ff) 0 100%);--wr-border-glow-outline: light-dark(var(--wr-border-base), rgb(255 255 255 / 15%));--wr-border-glow-edge-shadow: inset 0 0 0 1px var(--wr-border-glow-color), inset 0 0 1px 0 light-dark(transparent, var(--wr-border-glow-color-60)), inset 0 0 3px 0 light-dark(transparent, var(--wr-border-glow-color-50)), inset 0 0 6px 0 light-dark(transparent, var(--wr-border-glow-color-40)), inset 0 0 15px 0 light-dark(transparent, var(--wr-border-glow-color-30)), inset 0 0 25px 2px light-dark(transparent, var(--wr-border-glow-color-20)), inset 0 0 50px 2px light-dark(transparent, var(--wr-border-glow-color-10)), 0 0 1px 0 var(--wr-border-glow-color-60), 0 0 3px 0 var(--wr-border-glow-color-50), 0 0 6px 0 var(--wr-border-glow-color-40), 0 0 15px 0 var(--wr-border-glow-color-30), 0 0 25px 2px var(--wr-border-glow-color-20), 0 0 50px 2px var(--wr-border-glow-color-10);--wr-border-glow-halo-blend: normal;--wr-border-glow-fill-blend: normal;--wr-border-glow-fill-scale: .25;--wr-border-glow-edge-sensitivity: 30;--wr-border-glow-color-sensitivity: calc(var(--wr-border-glow-edge-sensitivity) + 20);--wr-border-glow-radius: 28px;--wr-border-glow-padding: 40px;--wr-border-glow-cone-spread: 25;position:relative;display:grid;border-radius:var(--wr-border-glow-radius);background:var(--wr-border-glow-bg, var(--wr-
|
|
456
|
+
styles: [".wr-border-glow{--wr-border-glow-edge-proximity: 0;--wr-border-glow-angle: 45deg;--wr-border-glow-bg: var(--wr-color-surface);--wr-border-glow-input-bg: initial;--wr-border-glow-input-color: initial;--wr-border-glow-input-color-60: initial;--wr-border-glow-input-color-50: initial;--wr-border-glow-input-color-40: initial;--wr-border-glow-input-color-30: initial;--wr-border-glow-input-color-20: initial;--wr-border-glow-input-color-10: initial;--wr-border-glow-input-gradient-one: initial;--wr-border-glow-input-gradient-two: initial;--wr-border-glow-input-gradient-three: initial;--wr-border-glow-input-gradient-four: initial;--wr-border-glow-input-gradient-five: initial;--wr-border-glow-input-gradient-six: initial;--wr-border-glow-input-gradient-seven: initial;--wr-border-glow-input-gradient-base: initial;--wr-border-glow-color: light-dark(hsl(40deg 90% 45% / 100%), hsl(40deg 80% 80% / 100%));--wr-border-glow-color-60: light-dark(hsl(40deg 90% 45% / 60%), hsl(40deg 80% 80% / 60%));--wr-border-glow-color-50: light-dark(hsl(40deg 90% 45% / 50%), hsl(40deg 80% 80% / 50%));--wr-border-glow-color-40: light-dark(hsl(40deg 90% 45% / 40%), hsl(40deg 80% 80% / 40%));--wr-border-glow-color-30: light-dark(hsl(40deg 90% 45% / 30%), hsl(40deg 80% 80% / 30%));--wr-border-glow-color-20: light-dark(hsl(40deg 90% 45% / 20%), hsl(40deg 80% 80% / 20%));--wr-border-glow-color-10: light-dark(hsl(40deg 90% 45% / 10%), hsl(40deg 80% 80% / 10%));--wr-border-glow-gradient-one: radial-gradient( at 80% 55%, light-dark(hsl(268deg 80% 50%), hsl(268deg 100% 76%)) 0px, transparent 50% );--wr-border-glow-gradient-two: radial-gradient( at 69% 34%, light-dark(hsl(349deg 85% 52%), hsl(349deg 100% 74%)) 0px, transparent 50% );--wr-border-glow-gradient-three: radial-gradient( at 8% 6%, light-dark(hsl(136deg 70% 38%), hsl(136deg 100% 78%)) 0px, transparent 50% );--wr-border-glow-gradient-four: radial-gradient( at 41% 38%, light-dark(hsl(192deg 90% 40%), hsl(192deg 100% 64%)) 0px, transparent 50% );--wr-border-glow-gradient-five: radial-gradient( at 86% 85%, light-dark(hsl(186deg 90% 38%), hsl(186deg 100% 74%)) 0px, transparent 50% );--wr-border-glow-gradient-six: radial-gradient( at 82% 18%, light-dark(hsl(40deg 95% 45%), hsl(52deg 100% 65%)) 0px, transparent 50% );--wr-border-glow-gradient-seven: radial-gradient( at 51% 4%, light-dark(hsl(12deg 90% 50%), hsl(12deg 100% 72%)) 0px, transparent 50% );--wr-border-glow-gradient-base: linear-gradient(light-dark(hsl(262deg 70% 50%), #c299ff) 0 100%);--wr-border-glow-outline: light-dark(var(--wr-border-base), rgb(255 255 255 / 15%));--wr-border-glow-edge-shadow: inset 0 0 0 1px var(--wr-border-glow-input-color, var(--wr-border-glow-color)), inset 0 0 1px 0 light-dark(transparent, var(--wr-border-glow-input-color-60, var(--wr-border-glow-color-60))), inset 0 0 3px 0 light-dark(transparent, var(--wr-border-glow-input-color-50, var(--wr-border-glow-color-50))), inset 0 0 6px 0 light-dark(transparent, var(--wr-border-glow-input-color-40, var(--wr-border-glow-color-40))), inset 0 0 15px 0 light-dark(transparent, var(--wr-border-glow-input-color-30, var(--wr-border-glow-color-30))), inset 0 0 25px 2px light-dark(transparent, var(--wr-border-glow-input-color-20, var(--wr-border-glow-color-20))), inset 0 0 50px 2px light-dark(transparent, var(--wr-border-glow-input-color-10, var(--wr-border-glow-color-10))), 0 0 1px 0 var(--wr-border-glow-input-color-60, var(--wr-border-glow-color-60)), 0 0 3px 0 var(--wr-border-glow-input-color-50, var(--wr-border-glow-color-50)), 0 0 6px 0 var(--wr-border-glow-input-color-40, var(--wr-border-glow-color-40)), 0 0 15px 0 var(--wr-border-glow-input-color-30, var(--wr-border-glow-color-30)), 0 0 25px 2px var(--wr-border-glow-input-color-20, var(--wr-border-glow-color-20)), 0 0 50px 2px var(--wr-border-glow-input-color-10, var(--wr-border-glow-color-10));--wr-border-glow-halo-blend: normal;--wr-border-glow-fill-blend: normal;--wr-border-glow-fill-scale: .25;--wr-border-glow-edge-sensitivity: 30;--wr-border-glow-color-sensitivity: calc(var(--wr-border-glow-edge-sensitivity) + 20);--wr-border-glow-radius: 28px;--wr-border-glow-padding: 40px;--wr-border-glow-cone-spread: 25;position:relative;display:grid;border-radius:var(--wr-border-glow-radius);background:var(--wr-border-glow-input-bg, var(--wr-border-glow-bg));overflow:visible;isolation:isolate;transform:translateZ(.01px);box-shadow:inset 0 0 0 1px var(--wr-border-glow-outline)}.wr-border-glow:before,.wr-border-glow:after,.wr-border-glow>.wr-border-glow__edge{content:\"\";position:absolute;inset:0;border-radius:inherit;transition:opacity .25s ease-out;z-index:-1}.wr-border-glow:not(:hover):not(.wr-border-glow--sweeping):not(.wr-border-glow--looping):before,.wr-border-glow:not(:hover):not(.wr-border-glow--sweeping):not(.wr-border-glow--looping):after,.wr-border-glow:not(:hover):not(.wr-border-glow--sweeping):not(.wr-border-glow--looping)>.wr-border-glow__edge{opacity:0;transition:opacity .75s ease-in-out}.wr-border-glow:before{border:1px solid transparent;background:linear-gradient(var(--wr-border-glow-input-bg, var(--wr-border-glow-bg)) 0 100%) padding-box,linear-gradient(#fff0 0 100%) border-box,var(--wr-border-glow-input-gradient-one, var(--wr-border-glow-gradient-one)) border-box,var(--wr-border-glow-input-gradient-two, var(--wr-border-glow-gradient-two)) border-box,var(--wr-border-glow-input-gradient-three, var(--wr-border-glow-gradient-three)) border-box,var(--wr-border-glow-input-gradient-four, var(--wr-border-glow-gradient-four)) border-box,var(--wr-border-glow-input-gradient-five, var(--wr-border-glow-gradient-five)) border-box,var(--wr-border-glow-input-gradient-six, var(--wr-border-glow-gradient-six)) border-box,var(--wr-border-glow-input-gradient-seven, var(--wr-border-glow-gradient-seven)) border-box,var(--wr-border-glow-input-gradient-base, var(--wr-border-glow-gradient-base)) border-box;opacity:calc((var(--wr-border-glow-edge-proximity) - var(--wr-border-glow-color-sensitivity)) / (100 - var(--wr-border-glow-color-sensitivity)));-webkit-mask-image:conic-gradient(from var(--wr-border-glow-angle) at center,black calc(var(--wr-border-glow-cone-spread) * 1%),transparent calc((var(--wr-border-glow-cone-spread) + 15) * 1%),transparent calc((100 - var(--wr-border-glow-cone-spread) - 15) * 1%),black calc((100 - var(--wr-border-glow-cone-spread)) * 1%));mask-image:conic-gradient(from var(--wr-border-glow-angle) at center,black calc(var(--wr-border-glow-cone-spread) * 1%),transparent calc((var(--wr-border-glow-cone-spread) + 15) * 1%),transparent calc((100 - var(--wr-border-glow-cone-spread) - 15) * 1%),black calc((100 - var(--wr-border-glow-cone-spread)) * 1%))}.wr-border-glow:after{border:1px solid transparent;background:var(--wr-border-glow-input-gradient-one, var(--wr-border-glow-gradient-one)) padding-box,var(--wr-border-glow-input-gradient-two, var(--wr-border-glow-gradient-two)) padding-box,var(--wr-border-glow-input-gradient-three, var(--wr-border-glow-gradient-three)) padding-box,var(--wr-border-glow-input-gradient-four, var(--wr-border-glow-gradient-four)) padding-box,var(--wr-border-glow-input-gradient-five, var(--wr-border-glow-gradient-five)) padding-box,var(--wr-border-glow-input-gradient-six, var(--wr-border-glow-gradient-six)) padding-box,var(--wr-border-glow-input-gradient-seven, var(--wr-border-glow-gradient-seven)) padding-box,var(--wr-border-glow-input-gradient-base, var(--wr-border-glow-gradient-base)) padding-box;-webkit-mask-image:linear-gradient(to bottom,#000,#000),radial-gradient(ellipse at 50% 50%,black 40%,transparent 65%),radial-gradient(ellipse at 66% 66%,black 5%,transparent 40%),radial-gradient(ellipse at 33% 33%,black 5%,transparent 40%),radial-gradient(ellipse at 66% 33%,black 5%,transparent 40%),radial-gradient(ellipse at 33% 66%,black 5%,transparent 40%),conic-gradient(from var(--wr-border-glow-angle) at center,transparent 5%,black 15%,black 85%,transparent 95%);mask-image:linear-gradient(to bottom,#000,#000),radial-gradient(ellipse at 50% 50%,black 40%,transparent 65%),radial-gradient(ellipse at 66% 66%,black 5%,transparent 40%),radial-gradient(ellipse at 33% 33%,black 5%,transparent 40%),radial-gradient(ellipse at 66% 33%,black 5%,transparent 40%),radial-gradient(ellipse at 33% 66%,black 5%,transparent 40%),conic-gradient(from var(--wr-border-glow-angle) at center,transparent 5%,black 15%,black 85%,transparent 95%);-webkit-mask-composite:source-out,source-over,source-over,source-over,source-over,source-over;mask-composite:subtract,add,add,add,add,add;opacity:calc(var(--wr-border-glow-fill-opacity, .5) * var(--wr-border-glow-fill-scale) * (var(--wr-border-glow-edge-proximity) - var(--wr-border-glow-color-sensitivity)) / (100 - var(--wr-border-glow-color-sensitivity)));mix-blend-mode:var(--wr-border-glow-fill-blend)}.wr-border-glow>.wr-border-glow__edge{inset:calc(var(--wr-border-glow-padding) * -1);pointer-events:none;z-index:1;-webkit-mask-image:conic-gradient(from var(--wr-border-glow-angle) at center,black 2.5%,transparent 10%,transparent 90%,black 97.5%);mask-image:conic-gradient(from var(--wr-border-glow-angle) at center,black 2.5%,transparent 10%,transparent 90%,black 97.5%);opacity:calc((var(--wr-border-glow-edge-proximity) - var(--wr-border-glow-edge-sensitivity)) / (100 - var(--wr-border-glow-edge-sensitivity)));mix-blend-mode:var(--wr-border-glow-halo-blend)}.wr-border-glow>.wr-border-glow__edge:before{content:\"\";position:absolute;inset:var(--wr-border-glow-padding);border-radius:inherit;box-shadow:var(--wr-border-glow-edge-shadow)}.wr-border-glow__inner{position:relative;z-index:1;display:flex;flex-direction:column}\n"]
|
|
454
457
|
}]
|
|
455
458
|
}],
|
|
456
459
|
ctorParameters: () => [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-bits-border-glow.mjs","names":[],"sources":["../../../projects/lib/bits/border-glow/border-glow.ts","../../../projects/lib/bits/border-glow/border-glow.html"],"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 * Port of the reactbits.dev BorderGlow effect — a cursor-tracked cone of\n * mesh-gradient light that follows the pointer along the card's perimeter,\n * with an outer halo, an optional auto-sweep on mount and an optional endless\n * loop.\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport { Component, ElementRef, PLATFORM_ID, ViewEncapsulation, computed, effect, inject, input } from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\nimport { isSafeCssValue, numAttr } from 'ngwr/utils';\n\nconst RADIANS_TO_DEG = 180 / Math.PI;\n\n/**\n * Where a looping cone rests under reduced motion, and where it starts when\n * nothing has written an angle yet — the stylesheet's own default.\n */\nconst REST_ANGLE = 45;\n\n/**\n * The most frame time one loop step may count, in ms. A hidden tab, a long task\n * or a debugger stops frames without telling the loop, and the first frame back\n * would otherwise jump the cone by the whole time away.\n */\nconst MAX_LOOP_STEP_MS = 100;\n\n/** `'40 80 80'`, `'268 100% 76%'`, `'40deg 80% 80%'` — the bare HSL parts `glowColor` has always taken. */\nconst HSL_PARTS = /^\\s*([\\d.]+)(?:deg)?\\s+([\\d.]+)%?\\s+([\\d.]+)%?\\s*$/;\n\nconst GLOW_OPACITY_STEPS = [100, 60, 50, 40, 30, 20, 10] as const;\nconst GLOW_VAR_SUFFIXES = ['', '-60', '-50', '-40', '-30', '-20', '-10'] as const;\n\nconst GRADIENT_POSITIONS = ['80% 55%', '69% 34%', '8% 6%', '41% 38%', '86% 85%', '82% 18%', '51% 4%'] as const;\nconst GRADIENT_VAR_NAMES = [\n '--wr-border-glow-gradient-one',\n '--wr-border-glow-gradient-two',\n '--wr-border-glow-gradient-three',\n '--wr-border-glow-gradient-four',\n '--wr-border-glow-gradient-five',\n '--wr-border-glow-gradient-six',\n '--wr-border-glow-gradient-seven',\n] as const;\nconst GRADIENT_COLOR_INDEX = [0, 1, 2, 0, 1, 2, 1] as const;\n\nconst DEFAULT_COLORS: readonly string[] = ['#c084fc', '#f472b6', '#38bdf8'];\n\nfunction buildGlowVars(glowColor: string, intensity: number): Record<string, string> | null {\n const parts = HSL_PARTS.exec(glowColor);\n // Anything else is a CSS colour, interpolated into a `color-mix()` — so it is\n // held to the containment check `colors` and `backgroundColor` pass, and an\n // unsafe value leaves the halo to the theme.\n if (!parts && !isSafeCssValue(glowColor)) return null;\n const base = parts\n ? `${Number.parseFloat(parts[1])}deg ${Number.parseFloat(parts[2])}% ${Number.parseFloat(parts[3])}%`\n : glowColor.trim();\n const out: Record<string, string> = {};\n for (let i = 0; i < GLOW_OPACITY_STEPS.length; i++) {\n const alpha = Math.min(GLOW_OPACITY_STEPS[i] * intensity, 100);\n out[`--wr-border-glow-color${GLOW_VAR_SUFFIXES[i]}`] = parts\n ? `hsl(${base} / ${alpha}%)`\n : `color-mix(in srgb, ${base} ${alpha}%, transparent)`;\n }\n return out;\n}\n\nfunction buildGradientVars(colors: readonly string[]): Record<string, string> {\n const out: Record<string, string> = {};\n // Each entry is INTERPOLATED into the `radial-gradient()` below, so a value\n // that balances the parens around it escapes into a sibling layer and can add\n // a `url()` the browser fetches. One unsafe entry discards the palette — the\n // same all-or-nothing rule `wr-gradient-text` follows, for the same reason.\n const palette = colors.length > 0 && colors.every(color => isSafeCssValue(color)) ? colors : DEFAULT_COLORS;\n for (let i = 0; i < GRADIENT_VAR_NAMES.length; i++) {\n const colour = palette[Math.min(GRADIENT_COLOR_INDEX[i], palette.length - 1)];\n out[GRADIENT_VAR_NAMES[i]] = `radial-gradient(at ${GRADIENT_POSITIONS[i]}, ${colour} 0px, transparent 50%)`;\n }\n out['--wr-border-glow-gradient-base'] = `linear-gradient(${palette[0]} 0 100%)`;\n return out;\n}\n\ninterface AnimateOptions {\n readonly start?: number;\n readonly end?: number;\n readonly duration?: number;\n readonly delay?: number;\n readonly ease?: (t: number) => number;\n readonly onUpdate: (v: number) => void;\n readonly onEnd?: () => void;\n}\n\n/** Tiny rAF-driven tweener. Returns a cancel function so callers can clean up on destroy. */\nfunction animateValue(opts: AnimateOptions): () => void {\n const { start = 0, end = 100, duration = 1000, delay = 0, ease = (t: number): number => t, onUpdate, onEnd } = opts;\n let raf = 0;\n let cancelled = false;\n\n const startAt = performance.now() + delay;\n const tick = (): void => {\n if (cancelled) return;\n const elapsed = performance.now() - startAt;\n const t = Math.min(Math.max(elapsed / duration, 0), 1);\n onUpdate(start + (end - start) * ease(t));\n if (t < 1) raf = requestAnimationFrame(tick);\n else if (onEnd) onEnd();\n };\n\n const timer = setTimeout(() => {\n raf = requestAnimationFrame(tick);\n }, delay);\n\n return () => {\n cancelled = true;\n clearTimeout(timer);\n cancelAnimationFrame(raf);\n };\n}\n\n/**\n * Cursor-tracked glowing border card. A cone of light follows the pointer\n * along the card's perimeter, brightening as the cursor approaches an edge.\n *\n * - Outer halo via stacked `box-shadow` on an inner `.edge-light` element.\n * - Inner bloom near the edges, painted with a normal blend by default and\n * overridable through `--wr-border-glow-fill-blend` (subtle; control the\n * strength via `[fillOpacity]`).\n * - Optional `[animated]` mode performs a one-shot sweep on mount, useful\n * for drawing attention to a freshly-rendered card.\n * - Optional `[loop]` mode circles the perimeter for ever, edge fully lit —\n * a frame for a call to action rather than a reaction to the cursor.\n *\n * @example\n * ```html\n * <wr-border-glow [animated]=\"true\" [colors]=\"['#c084fc', '#f472b6', '#38bdf8']\">\n * <h3>Hover me</h3>\n * <p>The border lights up where the cursor is.</p>\n * </wr-border-glow>\n * ```\n *\n * @see https://www.reactbits.dev/components/border-glow (visual reference)\n */\n@Component({\n selector: 'wr-border-glow',\n templateUrl: './border-glow.html',\n styleUrl: './border-glow.scss',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-border-glow',\n '(pointerenter)': 'onPointerEnter()',\n '(pointermove)': 'onPointerMove($event)',\n '(pointerleave)': 'onPointerLeave()',\n },\n})\nexport class WrBorderGlow {\n /**\n * Card background fill. When unset, uses the theme surface token. A hook set inline on\n * the same element is replaced by this input and does not come back when it is unset,\n * so set it from a stylesheet rule. The same goes for `glowColor` and `colors`.\n */\n readonly backgroundColor = input<string | null>(null);\n\n /** Corner radius in pixels. @default 28 */\n readonly borderRadius = input(28, { transform: numAttr(28) });\n\n /** Halo extent in pixels — how far the outer glow reaches past the card edge. @default 40 */\n readonly glowRadius = input(40, { transform: numAttr(40) });\n\n /**\n * Halo opacity multiplier (1 = full strength).\n *\n * Applies only alongside an explicit `glowColor`: the halo variables are\n * built from the two together, so on the default palette this input is read\n * and never reaches a declaration.\n *\n * @default 1\n */\n readonly glowIntensity = input(1, { transform: numAttr(1) });\n\n /** Width of the lit cone as a percentage of the perimeter. @default 25 */\n readonly coneSpread = input(25, { transform: numAttr(25) });\n\n /** How sharply the halo fades as the cursor leaves the edge. Lower = wider falloff. @default 30 */\n readonly edgeSensitivity = input(30, { transform: numAttr(30) });\n\n /** Strength of the interior bloom near edges (blend: `--wr-border-glow-fill-blend`). @default 0.5 */\n readonly fillOpacity = input(0.5, { transform: numAttr(0.5) });\n\n /**\n * Halo colour: any CSS colour (`'#3567ff'`, `'var(--wr-color-primary)'`), or\n * the bare `'H S L'` parts (no commas) it has always taken. A value that\n * could escape the `color-mix()` it is composed into is ignored. When unset,\n * the theme decides: a deep amber on light surfaces, pale amber on dark.\n * Note `glowIntensity` only applies alongside an explicit `glowColor`.\n */\n readonly glowColor = input<string | null>(null);\n\n /**\n * Mesh-gradient palette for the colored border slice. When unset, the\n * theme decides: deep tones on light, pastels on dark.\n */\n readonly colors = input<readonly string[] | null>(null);\n\n /** Play a one-shot perimeter sweep on mount, then fade out. @default false */\n readonly animated = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Circle the perimeter for ever at a constant pace, edge fully lit. The\n * pointer still drives while it is over the card, and the loop picks up from\n * where it left. Replaces the `animated` sweep; under reduced motion the edge\n * stays lit and still.\n *\n * @default false\n */\n readonly loop = input(false, { transform: coerceBooleanProperty });\n\n /** Seconds per lap while `loop` is on. @default 6 */\n readonly speed = input(6, { transform: numAttr(6) });\n\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly platform = inject(WrPlatform);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n /** Whether a pointer is over the card — the loop holds still while it drives. */\n private pointerInside = false;\n\n /** Inline CSS variable bag — recomputed when colour / radius / sensitivity inputs change. */\n protected readonly cssVars = computed<Record<string, string>>(() => {\n const vars: Record<string, string> = {\n '--wr-border-glow-radius': `${this.borderRadius()}px`,\n '--wr-border-glow-padding': `${this.glowRadius()}px`,\n '--wr-border-glow-cone-spread': String(this.coneSpread()),\n '--wr-border-glow-edge-sensitivity': String(this.edgeSensitivity()),\n '--wr-border-glow-fill-opacity': String(this.fillOpacity()),\n };\n const colors = this.colors();\n if (colors !== null) Object.assign(vars, buildGradientVars(colors));\n // Colour vars are written only when set — otherwise the stylesheet's\n // per-theme defaults (light vs dark) take over.\n // Composed, not passed through: `_rules.scss` reads this var inside a\n // `linear-gradient()` and again in a `background` shorthand, where a `url()`\n // is valid and fetches. An audit bound `url(\"…\")` here and recorded the\n // request. Validated like its `colors` sibling on this same component —\n // leaving one of the two unchecked is two rules inside one component.\n const bg = this.backgroundColor();\n if (bg !== null && isSafeCssValue(bg)) vars['--wr-border-glow-bg'] = bg;\n const glow = this.glowColor();\n const glowVars = glow === null ? null : buildGlowVars(glow, this.glowIntensity());\n if (glowVars !== null) Object.assign(vars, glowVars);\n return vars;\n });\n\n constructor() {\n // Apply the variable bag to the host on every input change. Bind in an\n // effect rather than `host: { '[style.--foo]': '...' }` so a single\n // `setProperty` loop handles the lot. What left the bag comes off the host, or an\n // input set and then unset stays over the stylesheet's default for good, but only\n // while the host still holds what this wrote: anything else there is someone else's.\n // Read back rather than kept as written, because the browser trims a custom property.\n let written: Record<string, string> = {};\n effect(() => {\n const { style } = this.el.nativeElement;\n const vars = this.cssVars();\n for (const [k, held] of Object.entries(written)) {\n if (!Object.hasOwn(vars, k) && style.getPropertyValue(k) === held) style.removeProperty(k);\n }\n written = {};\n for (const [k, v] of Object.entries(vars)) {\n style.setProperty(k, v);\n written[k] = style.getPropertyValue(k);\n }\n });\n\n if (!this.isBrowser) return;\n\n // Auto-sweep on mount — fires once when `animated` is true, unless `loop`\n // replaces it.\n effect(onCleanup => {\n if (!this.animated() || this.loop()) return;\n onCleanup(this.runAutoSweep());\n });\n\n // Endless loop. Reduced motion is read here, so a change to the preference\n // swaps the rotation for a still, lit edge and back.\n effect(onCleanup => {\n if (!this.loop()) return;\n onCleanup(this.runLoop(this.platform.prefersReducedMotion()));\n });\n }\n\n protected onPointerEnter(): void {\n this.pointerInside = true;\n }\n\n /** Hands the cone back to the loop, re-lit, from wherever the pointer left it. */\n protected onPointerLeave(): void {\n this.pointerInside = false;\n if (this.loop()) this.el.nativeElement.style.setProperty('--wr-border-glow-edge-proximity', '100');\n }\n\n /** Pointer-driven update of `--wr-border-glow-angle` + `--wr-border-glow-edge-proximity`. */\n protected onPointerMove(event: PointerEvent): void {\n const host = this.el.nativeElement;\n const rect = host.getBoundingClientRect();\n const x = event.clientX - rect.left;\n const y = event.clientY - rect.top;\n const cx = rect.width / 2;\n const cy = rect.height / 2;\n\n const dx = x - cx;\n const dy = y - cy;\n\n // `edge-proximity`: 0 at centre, 1 at the perimeter (whichever axis hits first).\n let edge = 0;\n if (dx !== 0 || dy !== 0) {\n const kx = dx === 0 ? Infinity : cx / Math.abs(dx);\n const ky = dy === 0 ? Infinity : cy / Math.abs(dy);\n edge = Math.min(Math.max(1 / Math.min(kx, ky), 0), 1);\n }\n\n // `cursor-angle`: 0deg = top, increases clockwise.\n let angle = 0;\n if (dx !== 0 || dy !== 0) {\n angle = Math.atan2(dy, dx) * RADIANS_TO_DEG + 90;\n if (angle < 0) angle += 360;\n }\n\n host.style.setProperty('--wr-border-glow-edge-proximity', (edge * 100).toFixed(3));\n host.style.setProperty('--wr-border-glow-angle', `${angle.toFixed(3)}deg`);\n }\n\n /** One-shot perimeter sweep: in → around → out, mirroring the reactbits behaviour. */\n private runAutoSweep(): () => void {\n // Reduced motion: skip the decorative mount sweep. The pointer-driven\n // glow stays — it maps 1:1 to the cursor with no autonomous motion.\n if (this.platform.prefersReducedMotion()) return () => undefined;\n const host = this.el.nativeElement;\n const ANGLE_START = 110;\n const ANGLE_END = 465;\n host.classList.add('wr-border-glow--sweeping');\n host.style.setProperty('--wr-border-glow-angle', `${ANGLE_START}deg`);\n\n const easeOutCubic = (t: number): number => 1 - (1 - t) ** 3;\n const easeInCubic = (t: number): number => t * t * t;\n const lerpAngle = (v: number): string => `${(ANGLE_END - ANGLE_START) * (v / 100) + ANGLE_START}deg`;\n\n // 1. Ramp edge-proximity up to 100 quickly.\n const cancelA = animateValue({\n duration: 500,\n onUpdate: v => host.style.setProperty('--wr-border-glow-edge-proximity', `${v}`),\n });\n // 2. Sweep angle first half (ease-in).\n const cancelB = animateValue({\n duration: 1500,\n end: 50,\n ease: easeInCubic,\n onUpdate: v => host.style.setProperty('--wr-border-glow-angle', lerpAngle(v)),\n });\n // 3. Sweep angle second half (ease-out).\n const cancelC = animateValue({\n delay: 1500,\n duration: 2250,\n start: 50,\n end: 100,\n ease: easeOutCubic,\n onUpdate: v => host.style.setProperty('--wr-border-glow-angle', lerpAngle(v)),\n });\n // 4. Fade proximity back to 0.\n const cancelD = animateValue({\n delay: 2500,\n duration: 1500,\n start: 100,\n end: 0,\n ease: easeInCubic,\n onUpdate: v => host.style.setProperty('--wr-border-glow-edge-proximity', `${v}`),\n onEnd: () => host.classList.remove('wr-border-glow--sweeping'),\n });\n\n // Returned rather than registered on `destroyRef`: this method runs from an\n // effect, so registering there stacked one more teardown per re-run and none\n // of them fired until the component died. The caller ties it to the effect's\n // own cleanup instead.\n return () => {\n cancelA();\n cancelB();\n cancelC();\n cancelD();\n host.classList.remove('wr-border-glow--sweeping');\n };\n }\n\n /** Endless perimeter loop at a constant pace. Returns its canceller, like `runAutoSweep`. */\n private runLoop(reducedMotion: boolean): () => void {\n const host = this.el.nativeElement;\n host.classList.add('wr-border-glow--looping');\n host.style.setProperty('--wr-border-glow-edge-proximity', '100');\n\n // Reduced motion: no rotation at all. The edge stays lit and still, so a\n // card that uses it as a frame keeps one.\n if (reducedMotion) {\n host.style.setProperty('--wr-border-glow-angle', `${REST_ANGLE}deg`);\n return () => host.classList.remove('wr-border-glow--looping');\n }\n\n let raf = 0;\n let angle = REST_ANGLE;\n // `null` until there is a frame to measure from: the first frame, and the\n // first after the pointer leaves or the card scrolls back into view, pick up\n // the painted angle instead of jumping by the time that passed.\n let last: number | null = null;\n\n const tick = (now: number): void => {\n raf = requestAnimationFrame(tick);\n if (this.pointerInside) {\n last = null;\n return;\n }\n if (last === null) {\n angle = this.paintedAngle();\n } else {\n // By elapsed time rather than per frame, so the pace is the same at\n // any refresh rate. `speed` is in seconds, the timestamps in ms.\n const lap = this.speed() * 1000;\n const step = Math.min(now - last, MAX_LOOP_STEP_MS);\n if (lap > 0) angle = (angle + (360 * step) / lap) % 360;\n }\n last = now;\n host.style.setProperty('--wr-border-glow-angle', `${angle.toFixed(3)}deg`);\n };\n const start = (): void => {\n if (raf === 0) raf = requestAnimationFrame(tick);\n };\n const pause = (): void => {\n cancelAnimationFrame(raf);\n raf = 0;\n last = null;\n };\n\n // Off screen the loop stops asking for frames. Without an observer (jsdom)\n // it simply runs.\n let observer: IntersectionObserver | null = null;\n if (typeof IntersectionObserver === 'undefined') {\n start();\n } else {\n observer = new IntersectionObserver(entries => (entries[entries.length - 1].isIntersecting ? start() : pause()));\n observer.observe(host);\n }\n\n return () => {\n observer?.disconnect();\n pause();\n host.classList.remove('wr-border-glow--looping');\n };\n }\n\n /** The angle the host paints now — the pointer's, a sweep's or the loop's own. */\n private paintedAngle(): number {\n const angle = Number.parseFloat(this.el.nativeElement.style.getPropertyValue('--wr-border-glow-angle'));\n return Number.isNaN(angle) ? REST_ANGLE : angle;\n }\n}\n","<span class=\"wr-border-glow__edge\" aria-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/lib/bits/border-glow/border-glow.html"],"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 * Port of the reactbits.dev BorderGlow effect — a cursor-tracked cone of\n * mesh-gradient light that follows the pointer along the card's perimeter,\n * with an outer halo, an optional auto-sweep on mount and an optional endless\n * loop.\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport { Component, ElementRef, PLATFORM_ID, ViewEncapsulation, computed, effect, inject, input } from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\nimport { isSafeCssValue, numAttr } from 'ngwr/utils';\n\nconst RADIANS_TO_DEG = 180 / Math.PI;\n\n/**\n * Where a looping cone rests under reduced motion, and where it starts when\n * nothing has written an angle yet — the stylesheet's own default.\n */\nconst REST_ANGLE = 45;\n\n/**\n * The most frame time one loop step may count, in ms. A hidden tab, a long task\n * or a debugger stops frames without telling the loop, and the first frame back\n * would otherwise jump the cone by the whole time away.\n */\nconst MAX_LOOP_STEP_MS = 100;\n\n/** `'40 80 80'`, `'268 100% 76%'`, `'40deg 80% 80%'` — the bare HSL parts `glowColor` has always taken. */\nconst HSL_PARTS = /^\\s*([\\d.]+)(?:deg)?\\s+([\\d.]+)%?\\s+([\\d.]+)%?\\s*$/;\n\nconst GLOW_OPACITY_STEPS = [100, 60, 50, 40, 30, 20, 10] as const;\nconst GLOW_VAR_SUFFIXES = ['', '-60', '-50', '-40', '-30', '-20', '-10'] as const;\n\nconst GRADIENT_POSITIONS = ['80% 55%', '69% 34%', '8% 6%', '41% 38%', '86% 85%', '82% 18%', '51% 4%'] as const;\n// Every name a nullable colour input writes is the `--wr-border-glow-input-*`\n// twin of a hook, never the hook itself: `_rules.scss` reads\n// `var(--wr-border-glow-input-x, var(--wr-border-glow-x))`, so an author's own\n// value on the hook survives the input and is read again once it is unset.\nconst GRADIENT_VAR_NAMES = [\n '--wr-border-glow-input-gradient-one',\n '--wr-border-glow-input-gradient-two',\n '--wr-border-glow-input-gradient-three',\n '--wr-border-glow-input-gradient-four',\n '--wr-border-glow-input-gradient-five',\n '--wr-border-glow-input-gradient-six',\n '--wr-border-glow-input-gradient-seven',\n] as const;\nconst GRADIENT_COLOR_INDEX = [0, 1, 2, 0, 1, 2, 1] as const;\n\nconst DEFAULT_COLORS: readonly string[] = ['#c084fc', '#f472b6', '#38bdf8'];\n\nfunction buildGlowVars(glowColor: string, intensity: number): Record<string, string> | null {\n const parts = HSL_PARTS.exec(glowColor);\n // Anything else is a CSS colour, interpolated into a `color-mix()` — so it is\n // held to the containment check `colors` and `backgroundColor` pass, and an\n // unsafe value leaves the halo to the theme.\n if (!parts && !isSafeCssValue(glowColor)) return null;\n const base = parts\n ? `${Number.parseFloat(parts[1])}deg ${Number.parseFloat(parts[2])}% ${Number.parseFloat(parts[3])}%`\n : glowColor.trim();\n const out: Record<string, string> = {};\n for (let i = 0; i < GLOW_OPACITY_STEPS.length; i++) {\n const alpha = Math.min(GLOW_OPACITY_STEPS[i] * intensity, 100);\n out[`--wr-border-glow-input-color${GLOW_VAR_SUFFIXES[i]}`] = parts\n ? `hsl(${base} / ${alpha}%)`\n : `color-mix(in srgb, ${base} ${alpha}%, transparent)`;\n }\n return out;\n}\n\nfunction buildGradientVars(colors: readonly string[]): Record<string, string> {\n const out: Record<string, string> = {};\n // Each entry is INTERPOLATED into the `radial-gradient()` below, so a value\n // that balances the parens around it escapes into a sibling layer and can add\n // a `url()` the browser fetches. One unsafe entry discards the palette — the\n // same all-or-nothing rule `wr-gradient-text` follows, for the same reason.\n const palette = colors.length > 0 && colors.every(color => isSafeCssValue(color)) ? colors : DEFAULT_COLORS;\n for (let i = 0; i < GRADIENT_VAR_NAMES.length; i++) {\n const colour = palette[Math.min(GRADIENT_COLOR_INDEX[i], palette.length - 1)];\n out[GRADIENT_VAR_NAMES[i]] = `radial-gradient(at ${GRADIENT_POSITIONS[i]}, ${colour} 0px, transparent 50%)`;\n }\n out['--wr-border-glow-input-gradient-base'] = `linear-gradient(${palette[0]} 0 100%)`;\n return out;\n}\n\ninterface AnimateOptions {\n readonly start?: number;\n readonly end?: number;\n readonly duration?: number;\n readonly delay?: number;\n readonly ease?: (t: number) => number;\n readonly onUpdate: (v: number) => void;\n readonly onEnd?: () => void;\n}\n\n/** Tiny rAF-driven tweener. Returns a cancel function so callers can clean up on destroy. */\nfunction animateValue(opts: AnimateOptions): () => void {\n const { start = 0, end = 100, duration = 1000, delay = 0, ease = (t: number): number => t, onUpdate, onEnd } = opts;\n let raf = 0;\n let cancelled = false;\n\n const startAt = performance.now() + delay;\n const tick = (): void => {\n if (cancelled) return;\n const elapsed = performance.now() - startAt;\n const t = Math.min(Math.max(elapsed / duration, 0), 1);\n onUpdate(start + (end - start) * ease(t));\n if (t < 1) raf = requestAnimationFrame(tick);\n else if (onEnd) onEnd();\n };\n\n const timer = setTimeout(() => {\n raf = requestAnimationFrame(tick);\n }, delay);\n\n return () => {\n cancelled = true;\n clearTimeout(timer);\n cancelAnimationFrame(raf);\n };\n}\n\n/**\n * Cursor-tracked glowing border card. A cone of light follows the pointer\n * along the card's perimeter, brightening as the cursor approaches an edge.\n *\n * - Outer halo via stacked `box-shadow` on an inner `.edge-light` element.\n * - Inner bloom near the edges, painted with a normal blend by default and\n * overridable through `--wr-border-glow-fill-blend` (subtle; control the\n * strength via `[fillOpacity]`).\n * - Optional `[animated]` mode performs a one-shot sweep on mount, useful\n * for drawing attention to a freshly-rendered card.\n * - Optional `[loop]` mode circles the perimeter for ever, edge fully lit —\n * a frame for a call to action rather than a reaction to the cursor.\n *\n * @example\n * ```html\n * <wr-border-glow [animated]=\"true\" [colors]=\"['#c084fc', '#f472b6', '#38bdf8']\">\n * <h3>Hover me</h3>\n * <p>The border lights up where the cursor is.</p>\n * </wr-border-glow>\n * ```\n *\n * @see https://www.reactbits.dev/components/border-glow (visual reference)\n */\n@Component({\n selector: 'wr-border-glow',\n templateUrl: './border-glow.html',\n styleUrl: './border-glow.scss',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-border-glow',\n // The geometry is written whatever the inputs say — none of these can be\n // unset — so each goes on the host as a binding to the hook's own name, the\n // way `wr-threads` binds `--wr-threads-count`. Bound here rather than through\n // the colour bag below, because `gen:css-vars` reads host bindings and literal\n // `setProperty` names and nothing else: written through the bag, the four\n // hooks the stylesheet declares were documented as a rule's to set while every\n // instance overwrote them inline.\n '[style.--wr-border-glow-radius.px]': 'borderRadius()',\n '[style.--wr-border-glow-padding.px]': 'glowRadius()',\n '[style.--wr-border-glow-cone-spread]': 'coneSpread()',\n '[style.--wr-border-glow-edge-sensitivity]': 'edgeSensitivity()',\n '[style.--wr-border-glow-fill-opacity]': 'fillOpacity()',\n '(pointerenter)': 'onPointerEnter()',\n '(pointermove)': 'onPointerMove($event)',\n '(pointerleave)': 'onPointerLeave()',\n },\n})\nexport class WrBorderGlow {\n /**\n * Card background fill. When unset, `--wr-border-glow-bg` decides, which defaults to\n * the theme surface. Written to `--wr-border-glow-input-bg` rather than to the hook,\n * so a `--wr-border-glow-bg` an author set on the element — inline or from a rule —\n * stays there under this input and is read again when it is unset. The same goes\n * for `glowColor` and `colors`.\n */\n readonly backgroundColor = input<string | null>(null);\n\n /** Corner radius in pixels. @default 28 */\n readonly borderRadius = input(28, { transform: numAttr(28) });\n\n /** Halo extent in pixels — how far the outer glow reaches past the card edge. @default 40 */\n readonly glowRadius = input(40, { transform: numAttr(40) });\n\n /**\n * Halo opacity multiplier (1 = full strength).\n *\n * Applies only alongside an explicit `glowColor`: the halo variables are\n * built from the two together, so on the default palette this input is read\n * and never reaches a declaration.\n *\n * @default 1\n */\n readonly glowIntensity = input(1, { transform: numAttr(1) });\n\n /** Width of the lit cone as a percentage of the perimeter. @default 25 */\n readonly coneSpread = input(25, { transform: numAttr(25) });\n\n /** How sharply the halo fades as the cursor leaves the edge. Lower = wider falloff. @default 30 */\n readonly edgeSensitivity = input(30, { transform: numAttr(30) });\n\n /** Strength of the interior bloom near edges (blend: `--wr-border-glow-fill-blend`). @default 0.5 */\n readonly fillOpacity = input(0.5, { transform: numAttr(0.5) });\n\n /**\n * Halo colour: any CSS colour (`'#3567ff'`, `'var(--wr-color-primary)'`), or\n * the bare `'H S L'` parts (no commas) it has always taken. A value that\n * could escape the `color-mix()` it is composed into is ignored. When unset,\n * the theme decides: a deep amber on light surfaces, pale amber on dark.\n * Note `glowIntensity` only applies alongside an explicit `glowColor`.\n */\n readonly glowColor = input<string | null>(null);\n\n /**\n * Mesh-gradient palette for the colored border slice. When unset, the\n * theme decides: deep tones on light, pastels on dark.\n */\n readonly colors = input<readonly string[] | null>(null);\n\n /** Play a one-shot perimeter sweep on mount, then fade out. @default false */\n readonly animated = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Circle the perimeter for ever at a constant pace, edge fully lit. The\n * pointer still drives while it is over the card, and the loop picks up from\n * where it left. Replaces the `animated` sweep; under reduced motion the edge\n * stays lit and still.\n *\n * @default false\n */\n readonly loop = input(false, { transform: coerceBooleanProperty });\n\n /** Seconds per lap while `loop` is on. @default 6 */\n readonly speed = input(6, { transform: numAttr(6) });\n\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly platform = inject(WrPlatform);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n /** Whether a pointer is over the card — the loop holds still while it drives. */\n private pointerInside = false;\n\n /**\n * Inline CSS variable bag — the colour inputs, recomputed when one changes. Every\n * name in it is an `--wr-border-glow-input-*` twin that is there only while its\n * input is set; the geometry, which is always set, is bound in `host`.\n */\n protected readonly cssVars = computed<Record<string, string>>(() => {\n const vars: Record<string, string> = {};\n const colors = this.colors();\n if (colors !== null) Object.assign(vars, buildGradientVars(colors));\n // Colour vars are written only when set — otherwise the stylesheet's\n // per-theme defaults (light vs dark) take over.\n // Composed, not passed through: `_rules.scss` reads this var inside a\n // `linear-gradient()` and again in a `background` shorthand, where a `url()`\n // is valid and fetches. An audit bound `url(\"…\")` here and recorded the\n // request. Validated like its `colors` sibling on this same component —\n // leaving one of the two unchecked is two rules inside one component.\n const bg = this.backgroundColor();\n if (bg !== null && isSafeCssValue(bg)) vars['--wr-border-glow-input-bg'] = bg;\n const glow = this.glowColor();\n const glowVars = glow === null ? null : buildGlowVars(glow, this.glowIntensity());\n if (glowVars !== null) Object.assign(vars, glowVars);\n return vars;\n });\n\n constructor() {\n // Apply the variable bag to the host on every colour input change. An effect\n // rather than one `host: { '[style.--foo]': '...' }` per name, because a\n // palette is seven names and a glow colour another seven, and a single\n // `setProperty` loop handles the lot. What left the bag comes off the host, or\n // an input set and then unset stays over the stylesheet's default for good.\n // Every name here is an `--wr-border-glow-input-*` twin nothing else declares\n // inline, so removing one takes nothing of the author's: their value sits on\n // the hook itself, which this never writes.\n let written: string[] = [];\n effect(() => {\n const { style } = this.el.nativeElement;\n const vars = this.cssVars();\n for (const k of written) {\n if (!Object.hasOwn(vars, k)) style.removeProperty(k);\n }\n written = Object.keys(vars);\n for (const k of written) style.setProperty(k, vars[k]);\n });\n\n if (!this.isBrowser) return;\n\n // Auto-sweep on mount — fires once when `animated` is true, unless `loop`\n // replaces it.\n effect(onCleanup => {\n if (!this.animated() || this.loop()) return;\n onCleanup(this.runAutoSweep());\n });\n\n // Endless loop. Reduced motion is read here, so a change to the preference\n // swaps the rotation for a still, lit edge and back.\n effect(onCleanup => {\n if (!this.loop()) return;\n onCleanup(this.runLoop(this.platform.prefersReducedMotion()));\n });\n }\n\n protected onPointerEnter(): void {\n this.pointerInside = true;\n }\n\n /** Hands the cone back to the loop, re-lit, from wherever the pointer left it. */\n protected onPointerLeave(): void {\n this.pointerInside = false;\n if (this.loop()) this.el.nativeElement.style.setProperty('--wr-border-glow-edge-proximity', '100');\n }\n\n /** Pointer-driven update of `--wr-border-glow-angle` + `--wr-border-glow-edge-proximity`. */\n protected onPointerMove(event: PointerEvent): void {\n const host = this.el.nativeElement;\n const rect = host.getBoundingClientRect();\n const x = event.clientX - rect.left;\n const y = event.clientY - rect.top;\n const cx = rect.width / 2;\n const cy = rect.height / 2;\n\n const dx = x - cx;\n const dy = y - cy;\n\n // `edge-proximity`: 0 at centre, 1 at the perimeter (whichever axis hits first).\n let edge = 0;\n if (dx !== 0 || dy !== 0) {\n const kx = dx === 0 ? Infinity : cx / Math.abs(dx);\n const ky = dy === 0 ? Infinity : cy / Math.abs(dy);\n edge = Math.min(Math.max(1 / Math.min(kx, ky), 0), 1);\n }\n\n // `cursor-angle`: 0deg = top, increases clockwise.\n let angle = 0;\n if (dx !== 0 || dy !== 0) {\n angle = Math.atan2(dy, dx) * RADIANS_TO_DEG + 90;\n if (angle < 0) angle += 360;\n }\n\n host.style.setProperty('--wr-border-glow-edge-proximity', (edge * 100).toFixed(3));\n host.style.setProperty('--wr-border-glow-angle', `${angle.toFixed(3)}deg`);\n }\n\n /** One-shot perimeter sweep: in → around → out, mirroring the reactbits behaviour. */\n private runAutoSweep(): () => void {\n // Reduced motion: skip the decorative mount sweep. The pointer-driven\n // glow stays — it maps 1:1 to the cursor with no autonomous motion.\n if (this.platform.prefersReducedMotion()) return () => undefined;\n const host = this.el.nativeElement;\n const ANGLE_START = 110;\n const ANGLE_END = 465;\n host.classList.add('wr-border-glow--sweeping');\n host.style.setProperty('--wr-border-glow-angle', `${ANGLE_START}deg`);\n\n const easeOutCubic = (t: number): number => 1 - (1 - t) ** 3;\n const easeInCubic = (t: number): number => t * t * t;\n const lerpAngle = (v: number): string => `${(ANGLE_END - ANGLE_START) * (v / 100) + ANGLE_START}deg`;\n\n // 1. Ramp edge-proximity up to 100 quickly.\n const cancelA = animateValue({\n duration: 500,\n onUpdate: v => host.style.setProperty('--wr-border-glow-edge-proximity', `${v}`),\n });\n // 2. Sweep angle first half (ease-in).\n const cancelB = animateValue({\n duration: 1500,\n end: 50,\n ease: easeInCubic,\n onUpdate: v => host.style.setProperty('--wr-border-glow-angle', lerpAngle(v)),\n });\n // 3. Sweep angle second half (ease-out).\n const cancelC = animateValue({\n delay: 1500,\n duration: 2250,\n start: 50,\n end: 100,\n ease: easeOutCubic,\n onUpdate: v => host.style.setProperty('--wr-border-glow-angle', lerpAngle(v)),\n });\n // 4. Fade proximity back to 0.\n const cancelD = animateValue({\n delay: 2500,\n duration: 1500,\n start: 100,\n end: 0,\n ease: easeInCubic,\n onUpdate: v => host.style.setProperty('--wr-border-glow-edge-proximity', `${v}`),\n onEnd: () => host.classList.remove('wr-border-glow--sweeping'),\n });\n\n // Returned rather than registered on `destroyRef`: this method runs from an\n // effect, so registering there stacked one more teardown per re-run and none\n // of them fired until the component died. The caller ties it to the effect's\n // own cleanup instead.\n return () => {\n cancelA();\n cancelB();\n cancelC();\n cancelD();\n host.classList.remove('wr-border-glow--sweeping');\n };\n }\n\n /** Endless perimeter loop at a constant pace. Returns its canceller, like `runAutoSweep`. */\n private runLoop(reducedMotion: boolean): () => void {\n const host = this.el.nativeElement;\n host.classList.add('wr-border-glow--looping');\n host.style.setProperty('--wr-border-glow-edge-proximity', '100');\n\n // Reduced motion: no rotation at all. The edge stays lit and still, so a\n // card that uses it as a frame keeps one.\n if (reducedMotion) {\n host.style.setProperty('--wr-border-glow-angle', `${REST_ANGLE}deg`);\n return () => host.classList.remove('wr-border-glow--looping');\n }\n\n let raf = 0;\n let angle = REST_ANGLE;\n // `null` until there is a frame to measure from: the first frame, and the\n // first after the pointer leaves or the card scrolls back into view, pick up\n // the painted angle instead of jumping by the time that passed.\n let last: number | null = null;\n\n const tick = (now: number): void => {\n raf = requestAnimationFrame(tick);\n if (this.pointerInside) {\n last = null;\n return;\n }\n if (last === null) {\n angle = this.paintedAngle();\n } else {\n // By elapsed time rather than per frame, so the pace is the same at\n // any refresh rate. `speed` is in seconds, the timestamps in ms.\n const lap = this.speed() * 1000;\n const step = Math.min(now - last, MAX_LOOP_STEP_MS);\n if (lap > 0) angle = (angle + (360 * step) / lap) % 360;\n }\n last = now;\n host.style.setProperty('--wr-border-glow-angle', `${angle.toFixed(3)}deg`);\n };\n const start = (): void => {\n if (raf === 0) raf = requestAnimationFrame(tick);\n };\n const pause = (): void => {\n cancelAnimationFrame(raf);\n raf = 0;\n last = null;\n };\n\n // Off screen the loop stops asking for frames. Without an observer (jsdom)\n // it simply runs.\n let observer: IntersectionObserver | null = null;\n if (typeof IntersectionObserver === 'undefined') {\n start();\n } else {\n observer = new IntersectionObserver(entries => (entries[entries.length - 1].isIntersecting ? start() : pause()));\n observer.observe(host);\n }\n\n return () => {\n observer?.disconnect();\n pause();\n host.classList.remove('wr-border-glow--looping');\n };\n }\n\n /** The angle the host paints now — the pointer's, a sweep's or the loop's own. */\n private paintedAngle(): number {\n const angle = Number.parseFloat(this.el.nativeElement.style.getPropertyValue('--wr-border-glow-angle'));\n return Number.isNaN(angle) ? REST_ANGLE : angle;\n }\n}\n","<span class=\"wr-border-glow__edge\" aria-hidden=\"true\"></span>\n<div class=\"wr-border-glow__inner\">\n <ng-content />\n</div>\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,MAAM,iBAAiB,MAAM,KAAK;AAMlC,MAAM,aAAa;AAOnB,MAAM,mBAAmB;AAGzB,MAAM,YAAY;AAElB,MAAM,qBAAqB;CAAC;CAAK;CAAI;CAAI;CAAI;CAAI;CAAI;AAAE;AACvD,MAAM,oBAAoB;CAAC;CAAI;CAAO;CAAO;CAAO;CAAO;CAAO;AAAK;AAEvE,MAAM,qBAAqB;CAAC;CAAW;CAAW;CAAS;CAAW;CAAW;CAAW;AAAQ;AAKpG,MAAM,qBAAqB;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;AACQ;AACV,MAAM,uBAAuB;CAAC;CAAG;CAAG;CAAG;CAAG;CAAG;CAAG;AAAC;AAEjD,MAAM,iBAAoC;CAAC;CAAW;CAAW;AAAS;AAE1E,SAAS,cAAc,WAAmB,WAAiB;CACzD,MAAM,QAAQ,UAAU,KAAK,SAAS;CAItC,IAAI,CAAC,SAAS,CAAC,eAAe,SAAS,GAAG,OAAO;CACjD,MAAM,OAAO,Q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CAAA;EAxBxB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAgB,eAGX,kBAAkB;GAAI,MAC/B;IACJ,OAAO;IAQP,sCAAsC;IACtC,uCAAuC;IACvC,wCAAwC;IACxC,6CAA6C;IAC7C,yCAAyC;IACzC,kBAAkB;IAClB,iBAAiB;IACjB,kBAAkB;GACnB;GAAA,UAAA;GAAA,QAAA,CAAA,85SAAA;EAAA,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { Component, DestroyRef, ElementRef, NgZone, PLATFORM_ID, ViewEncapsulation, afterNextRender, computed, effect, inject, input, signal, untracked, viewChild } from "@angular/core";
|
|
2
|
+
import { Component, DestroyRef, ElementRef, NgZone, PLATFORM_ID, ViewEncapsulation, afterNextRender, afterRenderEffect, computed, effect, inject, input, signal, untracked, viewChild } from "@angular/core";
|
|
3
3
|
import { isPlatformBrowser } from "@angular/common";
|
|
4
4
|
import { numAttr, resolveCssColor, watchColorScheme } from "ngwr/utils";
|
|
5
5
|
import { WrPlatform } from "ngwr/platform";
|
|
@@ -80,29 +80,26 @@ var WrDotGrid = class WrDotGrid {
|
|
|
80
80
|
effect(() => {
|
|
81
81
|
this.pitch();
|
|
82
82
|
untracked(() => {
|
|
83
|
-
if (
|
|
84
|
-
this.placeDots();
|
|
85
|
-
this.requestDraw();
|
|
83
|
+
if (this.ctx) this.placeDots();
|
|
86
84
|
});
|
|
87
85
|
});
|
|
88
|
-
|
|
86
|
+
afterRenderEffect(() => {
|
|
87
|
+
if (!this.booted()) return;
|
|
88
|
+
const still = this.platform.prefersReducedMotion();
|
|
89
|
+
this.pitch();
|
|
89
90
|
this.size();
|
|
90
91
|
this.dotColor();
|
|
91
92
|
this.activeColor();
|
|
92
93
|
this.radius();
|
|
93
94
|
this.strength();
|
|
94
|
-
untracked(() =>
|
|
95
|
+
untracked(() => {
|
|
96
|
+
if (still) this.rest();
|
|
97
|
+
this.requestDraw();
|
|
98
|
+
});
|
|
95
99
|
});
|
|
96
100
|
watchColorScheme(() => this.requestDraw());
|
|
97
101
|
effect((onCleanup) => {
|
|
98
|
-
if (!this.booted()) return;
|
|
99
|
-
if (this.platform.prefersReducedMotion()) {
|
|
100
|
-
untracked(() => {
|
|
101
|
-
this.rest();
|
|
102
|
-
this.draw();
|
|
103
|
-
});
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
102
|
+
if (!this.booted() || this.platform.prefersReducedMotion()) return;
|
|
106
103
|
onCleanup(untracked(() => this.zone.runOutsideAngular(() => this.interact())));
|
|
107
104
|
});
|
|
108
105
|
}
|