ngwr 11.0.0 → 11.2.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.
Files changed (237) hide show
  1. package/action-sheet/styles/_index.scss +4 -1
  2. package/anchor/styles/_index.scss +2 -1
  3. package/calendar/styles/_index.scss +11 -2
  4. package/cascader/styles/_index.scss +3 -1
  5. package/circular-text/styles/_index.scss +11 -0
  6. package/command-palette/styles/_index.scss +14 -1
  7. package/context-menu/styles/_index.scss +2 -1
  8. package/falling-text/styles/_index.scss +2 -1
  9. package/fesm2022/ngwr-action-sheet-testing.mjs +313 -0
  10. package/fesm2022/ngwr-action-sheet-testing.mjs.map +1 -0
  11. package/fesm2022/ngwr-bar-chart-testing.mjs +89 -0
  12. package/fesm2022/ngwr-bar-chart-testing.mjs.map +1 -0
  13. package/fesm2022/ngwr-blur-text-testing.mjs +203 -0
  14. package/fesm2022/ngwr-blur-text-testing.mjs.map +1 -0
  15. package/fesm2022/ngwr-blur-text.mjs +15 -1
  16. package/fesm2022/ngwr-blur-text.mjs.map +1 -1
  17. package/fesm2022/ngwr-border-glow-testing.mjs +325 -0
  18. package/fesm2022/ngwr-border-glow-testing.mjs.map +1 -0
  19. package/fesm2022/ngwr-border-glow.mjs +2 -2
  20. package/fesm2022/ngwr-breadcrumbs.mjs +2 -2
  21. package/fesm2022/ngwr-calendar-heatmap-testing.mjs +95 -0
  22. package/fesm2022/ngwr-calendar-heatmap-testing.mjs.map +1 -0
  23. package/fesm2022/ngwr-calendar-testing.mjs +368 -0
  24. package/fesm2022/ngwr-calendar-testing.mjs.map +1 -0
  25. package/fesm2022/ngwr-calendar.mjs +43 -3
  26. package/fesm2022/ngwr-calendar.mjs.map +1 -1
  27. package/fesm2022/ngwr-card.mjs +2 -2
  28. package/fesm2022/ngwr-cascader.mjs +14 -2
  29. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  30. package/fesm2022/ngwr-checkbox.mjs +8 -0
  31. package/fesm2022/ngwr-checkbox.mjs.map +1 -1
  32. package/fesm2022/ngwr-circular-text-testing.mjs +230 -0
  33. package/fesm2022/ngwr-circular-text-testing.mjs.map +1 -0
  34. package/fesm2022/ngwr-circular-text.mjs +2 -2
  35. package/fesm2022/ngwr-circular-text.mjs.map +1 -1
  36. package/fesm2022/ngwr-color-picker-testing.mjs +432 -0
  37. package/fesm2022/ngwr-color-picker-testing.mjs.map +1 -0
  38. package/fesm2022/ngwr-color-picker.mjs +29 -3
  39. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  40. package/fesm2022/ngwr-context-menu.mjs +25 -5
  41. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  42. package/fesm2022/ngwr-date-picker-testing.mjs +10 -79
  43. package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
  44. package/fesm2022/ngwr-decrypt-text-testing.mjs +261 -0
  45. package/fesm2022/ngwr-decrypt-text-testing.mjs.map +1 -0
  46. package/fesm2022/ngwr-decrypt-text.mjs +6 -1
  47. package/fesm2022/ngwr-decrypt-text.mjs.map +1 -1
  48. package/fesm2022/ngwr-donut-chart-testing.mjs +93 -0
  49. package/fesm2022/ngwr-donut-chart-testing.mjs.map +1 -0
  50. package/fesm2022/ngwr-drag-drop.mjs +2 -2
  51. package/fesm2022/ngwr-drawer.mjs +36 -7
  52. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  53. package/fesm2022/ngwr-dropdown.mjs +32 -2
  54. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  55. package/fesm2022/ngwr-event-calendar-testing.mjs +446 -0
  56. package/fesm2022/ngwr-event-calendar-testing.mjs.map +1 -0
  57. package/fesm2022/ngwr-event-calendar.mjs +43 -18
  58. package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
  59. package/fesm2022/ngwr-falling-text-testing.mjs +218 -0
  60. package/fesm2022/ngwr-falling-text-testing.mjs.map +1 -0
  61. package/fesm2022/ngwr-falling-text.mjs +2 -2
  62. package/fesm2022/ngwr-falling-text.mjs.map +1 -1
  63. package/fesm2022/ngwr-fuzzy-text-testing.mjs +134 -0
  64. package/fesm2022/ngwr-fuzzy-text-testing.mjs.map +1 -0
  65. package/fesm2022/ngwr-gauge-testing.mjs +86 -0
  66. package/fesm2022/ngwr-gauge-testing.mjs.map +1 -0
  67. package/fesm2022/ngwr-glitch-text-testing.mjs +181 -0
  68. package/fesm2022/ngwr-glitch-text-testing.mjs.map +1 -0
  69. package/fesm2022/ngwr-glitch-text.mjs +2 -2
  70. package/fesm2022/ngwr-gradient-text-testing.mjs +223 -0
  71. package/fesm2022/ngwr-gradient-text-testing.mjs.map +1 -0
  72. package/fesm2022/ngwr-gradient-text.mjs +2 -2
  73. package/fesm2022/ngwr-i18n-en.mjs +14 -0
  74. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  75. package/fesm2022/ngwr-i18n-ru.mjs +14 -0
  76. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  77. package/fesm2022/ngwr-image-cropper-testing.mjs +156 -0
  78. package/fesm2022/ngwr-image-cropper-testing.mjs.map +1 -0
  79. package/fesm2022/ngwr-image-cropper.mjs +10 -3
  80. package/fesm2022/ngwr-image-cropper.mjs.map +1 -1
  81. package/fesm2022/ngwr-input-number.mjs +73 -6
  82. package/fesm2022/ngwr-input-number.mjs.map +1 -1
  83. package/fesm2022/ngwr-knob-testing.mjs +220 -0
  84. package/fesm2022/ngwr-knob-testing.mjs.map +1 -0
  85. package/fesm2022/ngwr-lightbox-testing.mjs +223 -0
  86. package/fesm2022/ngwr-lightbox-testing.mjs.map +1 -0
  87. package/fesm2022/ngwr-lightbox.mjs +9 -2
  88. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  89. package/fesm2022/ngwr-line-chart-testing.mjs +119 -0
  90. package/fesm2022/ngwr-line-chart-testing.mjs.map +1 -0
  91. package/fesm2022/ngwr-list.mjs +2 -2
  92. package/fesm2022/ngwr-loading-bar.mjs +2 -2
  93. package/fesm2022/ngwr-marquee-testing.mjs +336 -0
  94. package/fesm2022/ngwr-marquee-testing.mjs.map +1 -0
  95. package/fesm2022/ngwr-marquee.mjs +2 -2
  96. package/fesm2022/ngwr-meter-group-testing.mjs +80 -0
  97. package/fesm2022/ngwr-meter-group-testing.mjs.map +1 -0
  98. package/fesm2022/ngwr-overlay.mjs +28 -1
  99. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  100. package/fesm2022/ngwr-popover.mjs +14 -0
  101. package/fesm2022/ngwr-popover.mjs.map +1 -1
  102. package/fesm2022/ngwr-rotating-text-testing.mjs +220 -0
  103. package/fesm2022/ngwr-rotating-text-testing.mjs.map +1 -0
  104. package/fesm2022/ngwr-rotating-text.mjs +2 -2
  105. package/fesm2022/ngwr-rotating-text.mjs.map +1 -1
  106. package/fesm2022/ngwr-select.mjs +70 -11
  107. package/fesm2022/ngwr-select.mjs.map +1 -1
  108. package/fesm2022/ngwr-shiny-text-testing.mjs +237 -0
  109. package/fesm2022/ngwr-shiny-text-testing.mjs.map +1 -0
  110. package/fesm2022/ngwr-shiny-text.mjs +2 -2
  111. package/fesm2022/ngwr-slider.mjs +44 -6
  112. package/fesm2022/ngwr-slider.mjs.map +1 -1
  113. package/fesm2022/ngwr-sparkline-testing.mjs +76 -0
  114. package/fesm2022/ngwr-sparkline-testing.mjs.map +1 -0
  115. package/fesm2022/ngwr-speed-dial-testing.mjs +279 -0
  116. package/fesm2022/ngwr-speed-dial-testing.mjs.map +1 -0
  117. package/fesm2022/ngwr-splash-cursor-testing.mjs +89 -0
  118. package/fesm2022/ngwr-splash-cursor-testing.mjs.map +1 -0
  119. package/fesm2022/ngwr-split-text-testing.mjs +224 -0
  120. package/fesm2022/ngwr-split-text-testing.mjs.map +1 -0
  121. package/fesm2022/ngwr-split-text.mjs +15 -1
  122. package/fesm2022/ngwr-split-text.mjs.map +1 -1
  123. package/fesm2022/ngwr-splitter-testing.mjs +245 -0
  124. package/fesm2022/ngwr-splitter-testing.mjs.map +1 -0
  125. package/fesm2022/ngwr-spotlight-card-testing.mjs +368 -0
  126. package/fesm2022/ngwr-spotlight-card-testing.mjs.map +1 -0
  127. package/fesm2022/ngwr-spotlight-card.mjs +2 -2
  128. package/fesm2022/ngwr-star-border-testing.mjs +172 -0
  129. package/fesm2022/ngwr-star-border-testing.mjs.map +1 -0
  130. package/fesm2022/ngwr-star-border.mjs +2 -2
  131. package/fesm2022/ngwr-table.mjs +13 -3
  132. package/fesm2022/ngwr-table.mjs.map +1 -1
  133. package/fesm2022/ngwr-tabs.mjs +15 -1
  134. package/fesm2022/ngwr-tabs.mjs.map +1 -1
  135. package/fesm2022/ngwr-tilt-card-testing.mjs +190 -0
  136. package/fesm2022/ngwr-tilt-card-testing.mjs.map +1 -0
  137. package/fesm2022/ngwr-tilt-card.mjs +21 -3
  138. package/fesm2022/ngwr-tilt-card.mjs.map +1 -1
  139. package/fesm2022/ngwr-toast.mjs +36 -7
  140. package/fesm2022/ngwr-toast.mjs.map +1 -1
  141. package/fesm2022/ngwr-tour-testing.mjs +173 -0
  142. package/fesm2022/ngwr-tour-testing.mjs.map +1 -0
  143. package/fesm2022/ngwr-tour.mjs +2 -2
  144. package/fesm2022/ngwr-tour.mjs.map +1 -1
  145. package/fesm2022/ngwr-tree.mjs +10 -3
  146. package/fesm2022/ngwr-tree.mjs.map +1 -1
  147. package/fesm2022/ngwr-typewriter-testing.mjs +228 -0
  148. package/fesm2022/ngwr-typewriter-testing.mjs.map +1 -0
  149. package/fesm2022/ngwr-typewriter.mjs +2 -2
  150. package/fesm2022/ngwr-version.mjs +1 -1
  151. package/fesm2022/ngwr-version.mjs.map +1 -1
  152. package/fesm2022/ngwr-virtual-scroll.mjs +2 -2
  153. package/fesm2022/ngwr-waves-testing.mjs +128 -0
  154. package/fesm2022/ngwr-waves-testing.mjs.map +1 -0
  155. package/fesm2022/ngwr-waves.mjs +2 -2
  156. package/fesm2022/ngwr-window-testing.mjs +361 -0
  157. package/fesm2022/ngwr-window-testing.mjs.map +1 -0
  158. package/fesm2022/ngwr-window.mjs +84 -10
  159. package/fesm2022/ngwr-window.mjs.map +1 -1
  160. package/file-upload/styles/_index.scss +7 -2
  161. package/i18n/en.json +16 -2
  162. package/i18n/ru.json +16 -2
  163. package/llms-full.txt +147 -0
  164. package/llms.txt +27 -8
  165. package/mcp/providers.js +29 -0
  166. package/mcp/tools.js +1 -29
  167. package/package.json +145 -1
  168. package/result/styles/_index.scss +3 -1
  169. package/segmented/styles/_index.scss +5 -1
  170. package/select/styles/_index.scss +3 -1
  171. package/skills/ngwr/SKILL.md +115 -0
  172. package/skills/ngwr/references/catalog.md +212 -0
  173. package/skills/ngwr/references/setup.md +73 -0
  174. package/stepper/styles/_index.scss +18 -2
  175. package/table/styles/_index.scss +3 -1
  176. package/theme/styles/_colors.scss +15 -2
  177. package/theme/styles/_dark.scss +24 -12
  178. package/tree/styles/_index.scss +4 -2
  179. package/types/ngwr-action-sheet-testing.d.ts +260 -0
  180. package/types/ngwr-bar-chart-testing.d.ts +77 -0
  181. package/types/ngwr-blur-text-testing.d.ts +180 -0
  182. package/types/ngwr-blur-text.d.ts +12 -0
  183. package/types/ngwr-border-glow-testing.d.ts +219 -0
  184. package/types/ngwr-calendar-heatmap-testing.d.ts +79 -0
  185. package/types/ngwr-calendar-testing.d.ts +277 -0
  186. package/types/ngwr-calendar.d.ts +10 -0
  187. package/types/ngwr-checkbox.d.ts +13 -0
  188. package/types/ngwr-circular-text-testing.d.ts +196 -0
  189. package/types/ngwr-color-picker-testing.d.ts +291 -0
  190. package/types/ngwr-color-picker.d.ts +13 -1
  191. package/types/ngwr-context-menu.d.ts +15 -1
  192. package/types/ngwr-date-picker-testing.d.ts +6 -66
  193. package/types/ngwr-decrypt-text-testing.d.ts +222 -0
  194. package/types/ngwr-donut-chart-testing.d.ts +79 -0
  195. package/types/ngwr-drawer.d.ts +12 -0
  196. package/types/ngwr-dropdown.d.ts +9 -0
  197. package/types/ngwr-event-calendar-testing.d.ts +301 -0
  198. package/types/ngwr-event-calendar.d.ts +9 -6
  199. package/types/ngwr-falling-text-testing.d.ts +186 -0
  200. package/types/ngwr-fuzzy-text-testing.d.ts +130 -0
  201. package/types/ngwr-gauge-testing.d.ts +71 -0
  202. package/types/ngwr-glitch-text-testing.d.ts +172 -0
  203. package/types/ngwr-gradient-text-testing.d.ts +173 -0
  204. package/types/ngwr-image-cropper-testing.d.ts +134 -0
  205. package/types/ngwr-image-cropper.d.ts +1 -0
  206. package/types/ngwr-input-number.d.ts +33 -1
  207. package/types/ngwr-knob-testing.d.ts +150 -0
  208. package/types/ngwr-lightbox-testing.d.ts +154 -0
  209. package/types/ngwr-lightbox.d.ts +6 -0
  210. package/types/ngwr-line-chart-testing.d.ts +93 -0
  211. package/types/ngwr-marquee-testing.d.ts +280 -0
  212. package/types/ngwr-meter-group-testing.d.ts +67 -0
  213. package/types/ngwr-overlay.d.ts +19 -1
  214. package/types/ngwr-rotating-text-testing.d.ts +191 -0
  215. package/types/ngwr-select.d.ts +32 -0
  216. package/types/ngwr-shiny-text-testing.d.ts +165 -0
  217. package/types/ngwr-slider.d.ts +15 -0
  218. package/types/ngwr-sparkline-testing.d.ts +69 -0
  219. package/types/ngwr-speed-dial-testing.d.ts +195 -0
  220. package/types/ngwr-splash-cursor-testing.d.ts +95 -0
  221. package/types/ngwr-split-text-testing.d.ts +209 -0
  222. package/types/ngwr-split-text.d.ts +12 -0
  223. package/types/ngwr-splitter-testing.d.ts +174 -0
  224. package/types/ngwr-spotlight-card-testing.d.ts +303 -0
  225. package/types/ngwr-star-border-testing.d.ts +135 -0
  226. package/types/ngwr-table.d.ts +10 -1
  227. package/types/ngwr-tilt-card-testing.d.ts +158 -0
  228. package/types/ngwr-tilt-card.d.ts +2 -0
  229. package/types/ngwr-toast.d.ts +14 -5
  230. package/types/ngwr-tour-testing.d.ts +143 -0
  231. package/types/ngwr-tree.d.ts +7 -0
  232. package/types/ngwr-typewriter-testing.d.ts +201 -0
  233. package/types/ngwr-version.d.ts +1 -1
  234. package/types/ngwr-waves-testing.d.ts +121 -0
  235. package/types/ngwr-window-testing.d.ts +263 -0
  236. package/types/ngwr-window.d.ts +27 -10
  237. package/window/styles/_index.scss +44 -16
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngwr-splitter-testing.mjs","sources":["../../../projects/lib/splitter/testing/wr-splitter-harness.ts","../../../projects/lib/splitter/testing/ngwr-splitter-testing.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, TestKey } from '@angular/cdk/testing';\n\nimport type { WrSplitterHarnessFilters, WrSplitterPaneSizes } from './interfaces';\n\n/** The four arrow keys, by the direction a user would say out loud. */\ntype Arrow = 'left' | 'right' | 'up' | 'down';\n\nconst ARROWS: Record<Arrow, TestKey> = {\n left: TestKey.LEFT_ARROW,\n right: TestKey.RIGHT_ARROW,\n up: TestKey.UP_ARROW,\n down: TestKey.DOWN_ARROW,\n};\n\n/**\n * Test harness for `<wr-splitter>` — two panes and the divider between them.\n *\n * **Everything here is the keyboard, and that is not a workaround.** The divider is\n * dragged with a pointer in a browser, but the drag reads\n * `getBoundingClientRect()` and turns a client coordinate into a percentage; jsdom\n * lays nothing out, so every rect is 0×0 and a synthetic drag writes `NaN` into the\n * position. The arrow keys reach the same state, are the accessible path anyway, and\n * are what the WAI-ARIA separator pattern is judged on.\n *\n * **Two words for the axis, and they are opposites.** The component's\n * `orientation=\"horizontal\"` means the panes sit side by side, which needs a\n * VERTICAL divider — so that is what `aria-orientation` says. {@link getOrientation}\n * answers the component's word and {@link getDividerOrientation} the divider's; both\n * are here because a spec that conflated them would look right and assert nothing.\n *\n * **Arrows follow the VISUAL axis.** Under `dir=\"rtl\"` the start pane is the one on\n * the right, so ArrowRight SHRINKS the position. {@link pressArrow} takes the key a\n * user presses rather than a semantic direction, which is the only way a spec can\n * pin that mirroring; {@link setPosition} walks with whichever key currently grows\n * the number, and reports where it landed.\n *\n * @example\n * ```ts\n * const splitter = await loader.getHarness(WrSplitterHarness);\n *\n * expect(await splitter.getPosition()).toBe(50);\n * await splitter.setPosition(70);\n * expect(await splitter.getPaneSizes()).toEqual({ start: 70, end: 30 });\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrSplitterHarness extends ComponentHarness {\n static hostSelector = 'wr-splitter';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrSplitterHarnessFilters = {}): HarnessPredicate<WrSplitterHarness> {\n return new HarnessPredicate(WrSplitterHarness, options)\n .addOption(\n 'orientation',\n options.orientation,\n async (harness, orientation) => (await harness.getOrientation()) === orientation\n )\n .addOption('dividerLabel', options.dividerLabel, (harness, label) =>\n HarnessPredicate.stringMatches(harness.getDividerLabel(), label)\n )\n .addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled);\n }\n\n private readonly divider = this.locatorFor('.wr-splitter__divider');\n\n /**\n * The splitter's own axis: `horizontal` when the panes sit side by side.\n *\n * Read from the host modifier rather than from `aria-orientation`, which says the\n * opposite thing about the same layout — see {@link getDividerOrientation}.\n */\n async getOrientation(): Promise<'horizontal' | 'vertical'> {\n return (await (await this.host()).hasClass('wr-splitter--vertical')) ? 'vertical' : 'horizontal';\n }\n\n /**\n * What the divider announces — the INVERSE of {@link getOrientation}, and correct:\n * a separator's orientation is the line it draws, not the axis it travels along.\n */\n async getDividerOrientation(): Promise<string | null> {\n return (await this.divider()).getAttribute('aria-orientation');\n }\n\n /** The divider's position as a percentage, from `aria-valuenow`. */\n async getPosition(): Promise<number> {\n return this.numeric('aria-valuenow');\n }\n\n /** The lowest position the divider will accept, from `aria-valuemin`. */\n async getMinPosition(): Promise<number> {\n return this.numeric('aria-valuemin');\n }\n\n /** The highest position the divider will accept, from `aria-valuemax`. */\n async getMaxPosition(): Promise<number> {\n return this.numeric('aria-valuemax');\n }\n\n /**\n * What each pane is asking for, in percent, from the `flex-basis` the component\n * writes inline.\n *\n * This is the only evidence a spec without layout has that the panes followed the\n * divider — a measured width is zero for both. They should always sum to 100:\n * the end pane is `100 - position`, so a pair that does not is a component bug\n * rather than a rounding artefact.\n */\n async getPaneSizes(): Promise<WrSplitterPaneSizes> {\n const start = await this.locatorFor('.wr-splitter__pane--start')();\n const end = await this.locatorFor('.wr-splitter__pane--end')();\n\n return {\n start: Number.parseFloat(await start.getCssValue('flex-basis')),\n end: Number.parseFloat(await end.getCssValue('flex-basis')),\n };\n }\n\n /** The start pane's projected text, trimmed. */\n async getStartText(): Promise<string> {\n return (await this.locatorFor('.wr-splitter__pane--start')()).text();\n }\n\n /** The end pane's projected text, trimmed. */\n async getEndText(): Promise<string> {\n return (await this.locatorFor('.wr-splitter__pane--end')()).text();\n }\n\n /** The divider's accessible name — a focusable separator is a widget and needs one. */\n async getDividerLabel(): Promise<string | null> {\n return (await this.divider()).getAttribute('aria-label');\n }\n\n /**\n * Whether the splitter refuses to resize.\n *\n * From the divider's `aria-disabled`, which is the half a screen reader acts on.\n * The component also drops the divider out of the tab order and paints a modifier\n * on the host, and {@link isDividerFocusable} answers the first of those — worth\n * asking separately, because a divider that is announced as disabled and still a\n * tab stop is a control the keyboard can reach and not use.\n */\n async isDisabled(): Promise<boolean> {\n return (await (await this.divider()).getAttribute('aria-disabled')) === 'true';\n }\n\n /** Whether the divider is a tab stop (`tabindex=\"0\"`). */\n async isDividerFocusable(): Promise<boolean> {\n return (await (await this.divider()).getAttribute('tabindex')) === '0';\n }\n\n /** Move keyboard focus to the divider. */\n async focusDivider(): Promise<void> {\n return (await this.divider()).focus();\n }\n\n /** Whether the divider currently holds focus. */\n async isDividerFocused(): Promise<boolean> {\n return (await this.divider()).isFocused();\n }\n\n /**\n * Press one arrow key on the divider.\n *\n * The key rather than a direction, deliberately: which way the position moves is a\n * function of the key AND the reading direction, and a `grow()` / `shrink()` pair\n * would hide exactly the behaviour worth asserting. An arrow off the splitter's own\n * axis does nothing at all — the horizontal splitter ignores Up and Down.\n *\n * `shift` is the coarse step: 10 instead of 1.\n */\n async pressArrow(arrow: Arrow, options: { shift?: boolean } = {}): Promise<void> {\n const divider = await this.divider();\n await (options.shift ? divider.sendKeys({ shift: true }, ARROWS[arrow]) : divider.sendKeys(ARROWS[arrow]));\n }\n\n /** Press Home — jumping to `minPosition`, whatever the reading direction. */\n async pressHome(): Promise<void> {\n return (await this.divider()).sendKeys(TestKey.HOME);\n }\n\n /** Press End — jumping to `maxPosition`. Semantic, so it never mirrors under RTL. */\n async pressEnd(): Promise<void> {\n return (await this.divider()).sendKeys(TestKey.END);\n }\n\n /**\n * Walk the divider to a position with the keyboard, and assert it landed there.\n *\n * Ten-unit hops first, then single steps — the same two strides a user has. It\n * walks rather than assigning, because assigning would prove the harness can write\n * a signal and nothing about the component: the clamp, the min / max and the\n * mirroring all live on this path.\n *\n * Throws rather than half-arriving. A target outside `[min, max]` is unreachable by\n * construction, and so is any target the walk cannot hit exactly — the position is a\n * float that a previous drag may have left mid-step, and whole-unit keys cannot get\n * off a fractional offset. Both say so, with where it actually stopped.\n */\n async setPosition(target: number): Promise<void> {\n const [min, max] = [await this.getMinPosition(), await this.getMaxPosition()];\n if (target < min || target > max) {\n throw new Error(\n `WrSplitterHarness.setPosition(${target}): out of range — this splitter accepts ${min}–${max}. ` +\n 'The component clamps, so the walk would stop at the bound and never reach the number asked for.'\n );\n }\n\n if (target === min) return this.pressHome();\n if (target === max) return this.pressEnd();\n\n await this.focusDivider();\n // The block axis never mirrors, so only the horizontal splitter needs the probe.\n const vertical = (await this.getOrientation()) === 'vertical';\n const [grow, shrink]: [Arrow, Arrow] = vertical\n ? ['down', 'up']\n : (await this.growsWithRight())\n ? ['right', 'left']\n : ['left', 'right'];\n\n for (const shift of [true, false]) {\n const step = shift ? 10 : 1;\n // Recomputed each pass: the coarse hops clamp at the bounds, so the remaining\n // distance is not what simple arithmetic on the starting point would predict.\n let delta = target - (await this.getPosition());\n\n while (Math.abs(delta) >= step) {\n const before = await this.getPosition();\n await this.pressArrow(delta > 0 ? grow : shrink, { shift });\n const now = await this.getPosition();\n\n if (now === before) {\n throw new Error(\n `WrSplitterHarness.setPosition(${target}): the divider stopped moving at ${now}. A disabled ` +\n 'splitter ignores its arrows, which is the usual reason this happens.'\n );\n }\n delta = target - now;\n }\n }\n\n const landed = await this.getPosition();\n if (landed !== target) {\n throw new Error(\n `WrSplitterHarness.setPosition(${target}): the walk stopped at ${landed}. The arrows move in whole ` +\n 'units, so a position left on a fraction by a drag cannot be walked onto a whole number.'\n );\n }\n }\n\n /**\n * Whether ArrowRight is currently the key that GROWS the position — true in LTR,\n * false in RTL, where the start pane is the one on the right.\n *\n * Probed rather than read off `Directionality`, which a harness has no access to:\n * press, look, and put it back. At the top of the range a growing press is clamped\n * and would prove nothing, so the probe presses the other way there instead. The\n * undo is conditional — a press that moved nothing has nothing to undo, and undoing\n * it anyway would move the divider by one in the direction the probe was testing.\n */\n private async growsWithRight(): Promise<boolean> {\n const before = await this.getPosition();\n const atCeiling = before >= (await this.getMaxPosition());\n const [probe, undo]: [Arrow, Arrow] = atCeiling ? ['left', 'right'] : ['right', 'left'];\n\n await this.pressArrow(probe);\n const after = await this.getPosition();\n if (after !== before) await this.pressArrow(undo);\n\n return atCeiling ? after < before : after > before;\n }\n\n private async numeric(attribute: string): Promise<number> {\n const raw = await (await this.divider()).getAttribute(attribute);\n return raw === null ? Number.NaN : Number(raw);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;;;;AAKG;AASH,MAAM,MAAM,GAA2B;IACrC,IAAI,EAAE,OAAO,CAAC,UAAU;IACxB,KAAK,EAAE,OAAO,CAAC,WAAW;IAC1B,EAAE,EAAE,OAAO,CAAC,QAAQ;IACpB,IAAI,EAAE,OAAO,CAAC,UAAU;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCG;AACG,MAAO,iBAAkB,SAAQ,gBAAgB,CAAA;AACrD,IAA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AAiC,MAAM,CAAA,uBAAA,EAA0B,MAAM,CAAA,2BAAA,CAA6B;AAClG,gBAAA,yFAAyF,CAC5F;QACH;IACF;AAEA;;;;;;;;;AASG;AACK,IAAA,MAAM,cAAc,GAAA;AAC1B,QAAA,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE;QACvC,MAAM,SAAS,GAAG,MAAM,KAAK,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QACzD,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAmB,SAAS,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC;AAEvF,QAAA,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;AAC5B,QAAA,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE;QACtC,IAAI,KAAK,KAAK,MAAM;AAAE,YAAA,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;AAEjD,QAAA,OAAO,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM;IACpD;IAEQ,MAAM,OAAO,CAAC,SAAiB,EAAA;AACrC,QAAA,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,SAAS,CAAC;AAChE,QAAA,OAAO,GAAG,KAAK,IAAI,GAAG,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;IAChD;;;AC1RF;;AAEG;;;;"}
@@ -0,0 +1,368 @@
1
+ import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
2
+
3
+ /**
4
+ * @license
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
8
+ */
9
+ /**
10
+ * Split an inline `style` attribute into its declarations.
11
+ *
12
+ * Read from the attribute rather than through `getCssValue()`, and the difference is not
13
+ * cosmetic. `getCssValue()` is `getComputedStyle()`, which in a browser resolves the
14
+ * stylesheet's own `--wr-spotlight-x: 50%` / `--wr-spotlight-color: rgba(…)` defaults —
15
+ * so "the component has written nothing here yet, and the theme decides" would come back
16
+ * as a concrete value and the assertion would invert. jsdom loads no stylesheet, so the
17
+ * computed read happens to agree today and would start lying the moment these harnesses
18
+ * ran anywhere else. The attribute holds what the component or the directive itself
19
+ * wrote, and nothing else.
20
+ *
21
+ * Shared by both harnesses in this entry point because both read the same three
22
+ * variables off their host — in different units. See each class for which.
23
+ */
24
+ function wrSpotlightInlineVars(style) {
25
+ const declarations = new Map();
26
+ for (const declaration of style.split(';')) {
27
+ const colon = declaration.indexOf(':');
28
+ if (colon === -1)
29
+ continue;
30
+ const name = declaration.slice(0, colon).trim();
31
+ if (name !== '')
32
+ declarations.set(name, declaration.slice(colon + 1).trim());
33
+ }
34
+ return declarations;
35
+ }
36
+
37
+ /**
38
+ * @license
39
+ *
40
+ * Use of this source code is governed by an MIT-style license that can be
41
+ * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
42
+ */
43
+ /** `120px` — the card writes its pointer coordinates as a pixel length, always. */
44
+ const PIXEL_LENGTH = /^(-?[\d.]+)px$/;
45
+ /** `80%` — the radius, whose `%` suffix is the half that makes the gradient legal. */
46
+ const PERCENTAGE = /^(-?[\d.]+)%$/;
47
+ /**
48
+ * Test harness for `<wr-spotlight-card>` — a card with a soft radial highlight that
49
+ * follows the cursor.
50
+ *
51
+ * **The component's entire output is three custom properties on its own host, and this
52
+ * harness reads them off the inline declaration.** There is no DOM for the highlight at
53
+ * all: it is a `::before` pseudo-element, painted by the stylesheet from those three
54
+ * values. So the paint is out of reach here and always will be — what is in reach is the
55
+ * arithmetic and the exact spelling that feeds it, which is where this component breaks.
56
+ *
57
+ * **This harness reads PIXELS. {@link WrSpotlightHarness}, the `[wrSpotlight]` directive
58
+ * shipped from the same entry point, reads PERCENTAGES.** Both write
59
+ * `--wr-spotlight-x` / `--wr-spotlight-y`, in different units, off different events —
60
+ * the card listens for `mousemove`, the directive for `pointermove`. That is deliberate
61
+ * and documented, and it is also the mistake waiting to happen: putting `wrSpotlight` on
62
+ * a `<wr-spotlight-card>` gives you two handlers overwriting one variable in units that
63
+ * do not agree. Reach for the harness that matches the thing under test.
64
+ *
65
+ * **{@link movePointerTo} needs the card to have a box, and in a unit test it has none.**
66
+ * The component subtracts its own `getBoundingClientRect()` from the client coordinate,
67
+ * and jsdom answers that with a 0×0 rect at the origin — so the subtraction is a no-op
68
+ * and the coordinate comes back unchanged. No throw here, unlike the directive's version:
69
+ * the answer is degenerate rather than wrong, and it is legitimately what a real card
70
+ * with no box would report. But a spec that asserts `x === clientX` against an unstubbed
71
+ * rect has proved nothing about the box-relative conversion, which is the only thing
72
+ * {@link getSpotlightPosition} is for. Give the host a box first:
73
+ *
74
+ * ```ts
75
+ * const card = fixture.nativeElement.querySelector('wr-spotlight-card');
76
+ * card.getBoundingClientRect = () => ({ left: 40, top: 20, width: 200, height: 100 }) as DOMRect;
77
+ * ```
78
+ *
79
+ * Several plausible methods are deliberately absent. There is no `isSpotlightVisible()`
80
+ * or `getSpotlightOpacity()`: the highlight sits at `opacity: 0` and is lifted to `0.6`
81
+ * only under `:hover` / `:focus-within`, both of which are stylesheet selectors on a
82
+ * pseudo-element — jsdom loads no stylesheet, matches no `:hover`, and cannot read a
83
+ * pseudo-element's style at any time, so any answer would be invented. No `getGradient()`
84
+ * for the same reason. No `hover()` / `mouseAway()` wrappers, which would be worse than
85
+ * missing: the CDK's versions dispatch `mouseenter` / `mouseover` / `mouseleave`, none of
86
+ * which this component listens to and none of which changes a `:hover` match in a test —
87
+ * a spec calling them would look like it exercised the reveal and would have exercised
88
+ * nothing. No `getSpotlightRect()` or `getCardSize()`, which are layout. And no
89
+ * `respectsReducedMotion()`: this is the one animation component in the library that
90
+ * deliberately does not implement the preference — a gradient tracks the cursor and no
91
+ * content moves — so the method would answer identically for a component that honoured it
92
+ * and one that ignored it.
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * const card = await loader.getHarness(WrSpotlightCardHarness.with({ text: 'Hover me' }));
97
+ *
98
+ * expect(await card.getRadiusPercent()).toBe(80);
99
+ * expect(await card.getSpotlightColor()).toBeNull(); // the theme decides
100
+ * expect(await card.getSpotlightPosition()).toBeNull(); // nothing has pointed at it
101
+ * ```
102
+ *
103
+ * @see https://ngwr.dev/guides/testing
104
+ */
105
+ class WrSpotlightCardHarness extends ComponentHarness {
106
+ static hostSelector = 'wr-spotlight-card';
107
+ /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */
108
+ static with(options = {}) {
109
+ return new HarnessPredicate(WrSpotlightCardHarness, options).addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getContentText(), text));
110
+ }
111
+ /**
112
+ * Where the gradient fades out, as a percentage of its own radius.
113
+ *
114
+ * Returns the number, but the assertion it really makes is about the `%` that was
115
+ * stripped to get it — this method refuses a bare `80`. The stylesheet interpolates the
116
+ * variable straight into `transparent var(--wr-spotlight-radius, 80%)`, where a unitless
117
+ * value is not a length, so the whole `radial-gradient()` declaration is dropped and the
118
+ * highlight disappears with nothing in the console to say why. Reading this as a plain
119
+ * number would sail past exactly that.
120
+ *
121
+ * Always present, whatever the input says: a `[radius]` that is not a number coerces
122
+ * back to the default 80 rather than writing nonsense into the sheet.
123
+ */
124
+ async getRadiusPercent() {
125
+ const raw = (await this.vars()).get('--wr-spotlight-radius') ?? null;
126
+ const match = raw === null ? null : PERCENTAGE.exec(raw);
127
+ if (!match) {
128
+ throw new Error(`WrSpotlightCardHarness.getRadiusPercent(): \`--wr-spotlight-radius\` reads "${raw ?? '(absent)'}" on the ` +
129
+ 'host, and the stylesheet needs a percentage there — it drops the whole gradient for a bare number. The ' +
130
+ 'card writes this one on every render whatever the input says, so a missing or unsuffixed value means ' +
131
+ 'the binding itself stopped reaching the element.');
132
+ }
133
+ return Number.parseFloat(match[1]);
134
+ }
135
+ /**
136
+ * The highlight colour the author asked for, or `null` when they left it to the theme.
137
+ *
138
+ * `null` IS the contract for an unset `[spotlightColor]`, not a gap in it. The
139
+ * stylesheet's own default is `rgba(var(--wr-color-on-surface-rgb), .15)`, and that
140
+ * token flips per theme — which is what makes one component read as a dark glow on a
141
+ * light surface and a light beam on a dark one. A card that started writing a concrete
142
+ * colour here would look right in whichever theme it was authored against and wrong in
143
+ * the other, and this is the only method that can tell.
144
+ */
145
+ async getSpotlightColor() {
146
+ return (await this.vars()).get('--wr-spotlight-color') ?? null;
147
+ }
148
+ /**
149
+ * Where the highlight last sat, in pixels from the card's own top-left corner. `null`
150
+ * until something has pointed at the card.
151
+ *
152
+ * Pixels, not percentages — see this class's docs for why the distinction matters
153
+ * inside this one entry point.
154
+ *
155
+ * `null` is a state of its own rather than a stand-in for `{ x: 0, y: 0 }`: before the
156
+ * first move the stylesheet's `50% / 50%` default applies, and a pointer at the card's
157
+ * own origin legitimately reports zero, so folding the two together would make an
158
+ * untouched card indistinguishable from one being pointed at in its corner.
159
+ *
160
+ * Note there is no reset when the cursor leaves, and that is not an oversight the
161
+ * harness papers over: the stylesheet fades the whole overlay to `opacity: 0` on leave,
162
+ * so nothing is parked visibly — but the coordinate stays written for the life of the
163
+ * element. `null` therefore means "no pointer has EVER arrived", not "none is here now".
164
+ */
165
+ async getSpotlightPosition() {
166
+ const vars = await this.vars();
167
+ const x = vars.get('--wr-spotlight-x');
168
+ const y = vars.get('--wr-spotlight-y');
169
+ if (x === undefined || y === undefined)
170
+ return null;
171
+ return { x: this.parsePixels(x, '--wr-spotlight-x'), y: this.parsePixels(y, '--wr-spotlight-y') };
172
+ }
173
+ /**
174
+ * Point at the card, in client coordinates.
175
+ *
176
+ * A `mousemove`, not a `pointermove` — the component listens for the former, and the
177
+ * directive in the same entry point for the latter, so a pointer event dispatched here
178
+ * is silently ignored. It goes to the host itself, so it needs no hit test and cannot
179
+ * miss in a test that has no layout; the coordinates only ever reach the component's
180
+ * own subtraction.
181
+ *
182
+ * Stub the host's `getBoundingClientRect` before calling this, or the subtraction is
183
+ * invisible — see this class's docs.
184
+ */
185
+ async movePointerTo(clientX, clientY) {
186
+ await (await this.host()).dispatchEvent('mousemove', { clientX, clientY });
187
+ }
188
+ /**
189
+ * The projected content's text, trimmed.
190
+ *
191
+ * Read from the host, which is the whole assertion: the template is a bare
192
+ * `<ng-content />` with no wrapper element, so content lands as a direct child and an
193
+ * interactive one keeps its own name and role. The component adds no ARIA and no node
194
+ * of its own — there is nothing else here for a harness to ask about.
195
+ */
196
+ async getContentText() {
197
+ return (await this.host()).text();
198
+ }
199
+ /** The host's inline declarations — the component's whole written output. */
200
+ async vars() {
201
+ return wrSpotlightInlineVars((await (await this.host()).getAttribute('style')) ?? '');
202
+ }
203
+ /** One written coordinate, as a number, insisting on the `px` the card promises. */
204
+ parsePixels(raw, name) {
205
+ const match = PIXEL_LENGTH.exec(raw);
206
+ if (!match) {
207
+ throw new Error(`WrSpotlightCardHarness.getSpotlightPosition(): \`${name}\` reads "${raw}", which is not the pixel length ` +
208
+ 'the card writes. A percentage here is the tell that `[wrSpotlight]` is on the same element — the two ' +
209
+ 'exports of this entry point share these variables and disagree about the unit.');
210
+ }
211
+ return Number.parseFloat(match[1]);
212
+ }
213
+ }
214
+
215
+ /**
216
+ * @license
217
+ *
218
+ * Use of this source code is governed by an MIT-style license that can be
219
+ * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
220
+ */
221
+ /**
222
+ * Test harness for `[wrSpotlight]` — the directive that makes a cursor-following
223
+ * gradient possible on an element the consumer owns.
224
+ *
225
+ * **This harness reads PERCENTAGES. {@link WrSpotlightCardHarness}, shipped from the same
226
+ * entry point, reads PIXELS.** Both write `--wr-spotlight-x` / `--wr-spotlight-y`; the
227
+ * directive writes them as a share of its own box off `pointermove`, the card as a pixel
228
+ * offset off `mousemove`. That is why {@link getSpotlightPosition} hands back raw strings
229
+ * and not numbers — collapsing `'37.5%'` to `37.5` would hide the one thing that decides
230
+ * whether the gradient lands where the cursor is, and would make the two halves of this
231
+ * entry point look interchangeable when they are not.
232
+ *
233
+ * **The directive ships no styles and adds no node.** There is no class to assert, no
234
+ * wrapper, no ARIA: whatever the element announced before the directive applies is
235
+ * exactly what it announces after, and the gradient is entirely the consumer's own CSS.
236
+ * So there is no `isSpotlightVisible()` — there is nothing here to be visible — and no
237
+ * `getResetX()` / `getResetY()`, which would echo the inputs back rather than report the
238
+ * coordinate the directive actually WROTE. The echo would pass while the written value
239
+ * was wrong, which is not hypothetical (see {@link getSpotlightPosition}). And no
240
+ * `respectsReducedMotion()`: neither export in this entry point implements the
241
+ * preference — it is the library's one documented exemption, since a gradient tracks the
242
+ * cursor and no content moves — so the method would answer the same for a directive that
243
+ * honoured it and one that ignored it.
244
+ *
245
+ * @example
246
+ * ```ts
247
+ * const spotlight = await loader.getHarness(WrSpotlightHarness.with({ hostClass: 'card' }));
248
+ *
249
+ * expect(await spotlight.getSpotlightPosition()).toEqual({ x: '50%', y: '50%' });
250
+ * await spotlight.movePointerTo(150, 25); // stub the host's rect first
251
+ * ```
252
+ *
253
+ * @see https://ngwr.dev/guides/testing
254
+ */
255
+ class WrSpotlightHarness extends ComponentHarness {
256
+ static hostSelector = '[wrSpotlight]';
257
+ /**
258
+ * Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`.
259
+ *
260
+ * Both options describe the HOST rather than the directive, because the directive
261
+ * leaves no mark of its own to match on.
262
+ */
263
+ static with(options = {}) {
264
+ return new HarnessPredicate(WrSpotlightHarness, options)
265
+ .addOption('text', options.text, async (harness, text) => HarnessPredicate.stringMatches((await harness.host()).text(), text))
266
+ .addOption('hostClass', options.hostClass, async (harness, hostClass) => (await harness.host()).hasClass(hostClass));
267
+ }
268
+ /**
269
+ * The coordinates the directive has written, as the raw strings it wrote them.
270
+ *
271
+ * Strings on purpose — see this class's docs. The values are percentages of the host's
272
+ * own box while a pointer is over it, and whatever `[resetX]` / `[resetY]` say
273
+ * otherwise, so a `px` appearing here means something else is writing these variables.
274
+ *
275
+ * **Present from construction, before any pointer arrives.** The directive seeds the
276
+ * reset coordinates in its constructor, so the first read is `50%` / `50%` on a fresh
277
+ * host — do not mistake that for a pointer having been tracked. Worth knowing that the
278
+ * constructor runs before signal inputs are bound, so a bound (or even a static)
279
+ * `resetX` is NOT what appears here initially: it is honoured from the first
280
+ * {@link leave} onward, and the highlight jumps at that point. Reading the written
281
+ * coordinate rather than the input is what makes that visible at all.
282
+ *
283
+ * Throws once the directive has been destroyed, rather than answering with the last
284
+ * value it happened to leave behind — {@link hasTrackedPointer} is the question to ask
285
+ * when the host may be gone.
286
+ */
287
+ async getSpotlightPosition() {
288
+ const vars = await this.vars();
289
+ const x = vars.get('--wr-spotlight-x');
290
+ const y = vars.get('--wr-spotlight-y');
291
+ if (x === undefined || y === undefined) {
292
+ throw new Error('WrSpotlightHarness.getSpotlightPosition(): the host carries no `--wr-spotlight-x` / `--wr-spotlight-y`. ' +
293
+ 'The directive writes both in its constructor and removes both on destroy, so this is a torn-down ' +
294
+ 'directive rather than one that has not started — ask hasTrackedPointer() when the host may be gone.');
295
+ }
296
+ return { x, y };
297
+ }
298
+ /**
299
+ * Point at the host, in client coordinates.
300
+ *
301
+ * **Refuses on a host with no box, which in a unit test is every host.** The directive
302
+ * divides the cursor offset by the element's own width and height, so a 0×0 rect writes
303
+ * literally `Infinity%` or — at the origin — `NaN%` into the style. jsdom accepts either
304
+ * string without complaint, so an unguarded harness would hand back something that looks
305
+ * like a coordinate and describes nothing. Give the host a box first:
306
+ *
307
+ * ```ts
308
+ * const el = fixture.nativeElement.querySelector('[wrSpotlight]');
309
+ * el.getBoundingClientRect = () => ({ left: 0, top: 0, width: 200, height: 100 }) as DOMRect;
310
+ * ```
311
+ *
312
+ * A `pointermove`, not a `mousemove` — the directive listens for the former, and the
313
+ * component in the same entry point for the latter. It is dispatched on the host itself,
314
+ * so it needs no hit test and cannot miss.
315
+ */
316
+ async movePointerTo(clientX, clientY) {
317
+ const host = await this.host();
318
+ const { width, height } = await host.getDimensions();
319
+ if (!width || !height) {
320
+ throw new Error(`WrSpotlightHarness.movePointerTo(${clientX}, ${clientY}): this host measures ${width}×${height}, so a ` +
321
+ 'pointer position over it means nothing — the directive divides the offset by the box, and the result ' +
322
+ 'goes into the style as `Infinity%` or `NaN%`. Stub `getBoundingClientRect` on the host first.');
323
+ }
324
+ await host.dispatchEvent('pointermove', { clientX, clientY, pointerId: 1, isPrimary: true });
325
+ }
326
+ /**
327
+ * Take the pointer away.
328
+ *
329
+ * Dispatches `pointerleave` — the directive's reset path, and the only place `[resetX]`
330
+ * / `[resetY]` are read after construction. Needs no box: the handler writes the reset
331
+ * strings straight through without measuring anything, which is why this one does not
332
+ * refuse the way {@link movePointerTo} does.
333
+ *
334
+ * Not the CDK's `mouseAway()`, though that dispatches `pointerleave` too. This says what
335
+ * it does, and it does not also fire the `mouseleave` / `mouseout` that the CDK helper
336
+ * sends alongside it — events this directive ignores, and that would make a spec look
337
+ * like it had covered more than it did.
338
+ */
339
+ async leave() {
340
+ await (await this.host()).dispatchEvent('pointerleave');
341
+ }
342
+ /**
343
+ * Whether the directive still owns the host's spotlight variables.
344
+ *
345
+ * **This is "the directive is alive", not "a pointer has moved over it".** It is `true`
346
+ * from the moment the directive constructs, because the constructor seeds the reset
347
+ * coordinates — there is no earlier state to catch. What it distinguishes is a live
348
+ * directive from a torn-down one: destroy removes both declarations from the element,
349
+ * and nothing else in the repo asserts that cleanup. A directive that stopped removing
350
+ * them would leave a stale gradient position on an element the consumer went on using,
351
+ * and the only trace would be these two declarations outliving it.
352
+ */
353
+ async hasTrackedPointer() {
354
+ const vars = await this.vars();
355
+ return vars.has('--wr-spotlight-x') && vars.has('--wr-spotlight-y');
356
+ }
357
+ /** The host's inline declarations — the directive's whole written output. */
358
+ async vars() {
359
+ return wrSpotlightInlineVars((await (await this.host()).getAttribute('style')) ?? '');
360
+ }
361
+ }
362
+
363
+ /**
364
+ * Generated bundle index. Do not edit.
365
+ */
366
+
367
+ export { WrSpotlightCardHarness, WrSpotlightHarness };
368
+ //# sourceMappingURL=ngwr-spotlight-card-testing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngwr-spotlight-card-testing.mjs","sources":["../../../projects/lib/spotlight-card/testing/wr-spotlight-harness-vars.ts","../../../projects/lib/spotlight-card/testing/wr-spotlight-card-harness.ts","../../../projects/lib/spotlight-card/testing/wr-spotlight-harness.ts","../../../projects/lib/spotlight-card/testing/ngwr-spotlight-card-testing.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\n/**\n * Split an inline `style` attribute into its declarations.\n *\n * Read from the attribute rather than through `getCssValue()`, and the difference is not\n * cosmetic. `getCssValue()` is `getComputedStyle()`, which in a browser resolves the\n * stylesheet's own `--wr-spotlight-x: 50%` / `--wr-spotlight-color: rgba(…)` defaults —\n * so \"the component has written nothing here yet, and the theme decides\" would come back\n * as a concrete value and the assertion would invert. jsdom loads no stylesheet, so the\n * computed read happens to agree today and would start lying the moment these harnesses\n * ran anywhere else. The attribute holds what the component or the directive itself\n * wrote, and nothing else.\n *\n * Shared by both harnesses in this entry point because both read the same three\n * variables off their host — in different units. See each class for which.\n */\nexport function wrSpotlightInlineVars(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 * @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 { WrSpotlightCardHarnessFilters } from './interfaces';\nimport { wrSpotlightInlineVars } from './wr-spotlight-harness-vars';\n\n/** `120px` — the card writes its pointer coordinates as a pixel length, always. */\nconst PIXEL_LENGTH = /^(-?[\\d.]+)px$/;\n\n/** `80%` — the radius, whose `%` suffix is the half that makes the gradient legal. */\nconst PERCENTAGE = /^(-?[\\d.]+)%$/;\n\n/**\n * Test harness for `<wr-spotlight-card>` — a card with a soft radial highlight that\n * follows the cursor.\n *\n * **The component's entire output is three custom properties on its own host, and this\n * harness reads them off the inline declaration.** There is no DOM for the highlight at\n * all: it is a `::before` pseudo-element, painted by the stylesheet from those three\n * values. So the paint is out of reach here and always will be — what is in reach is the\n * arithmetic and the exact spelling that feeds it, which is where this component breaks.\n *\n * **This harness reads PIXELS. {@link WrSpotlightHarness}, the `[wrSpotlight]` directive\n * shipped from the same entry point, reads PERCENTAGES.** Both write\n * `--wr-spotlight-x` / `--wr-spotlight-y`, in different units, off different events —\n * the card listens for `mousemove`, the directive for `pointermove`. That is deliberate\n * and documented, and it is also the mistake waiting to happen: putting `wrSpotlight` on\n * a `<wr-spotlight-card>` gives you two handlers overwriting one variable in units that\n * do not agree. Reach for the harness that matches the thing under test.\n *\n * **{@link movePointerTo} needs the card to have a box, and in a unit test it has none.**\n * The component subtracts its own `getBoundingClientRect()` from the client coordinate,\n * and jsdom answers that with a 0×0 rect at the origin — so the subtraction is a no-op\n * and the coordinate comes back unchanged. No throw here, unlike the directive's version:\n * the answer is degenerate rather than wrong, and it is legitimately what a real card\n * with no box would report. But a spec that asserts `x === clientX` against an unstubbed\n * rect has proved nothing about the box-relative conversion, which is the only thing\n * {@link getSpotlightPosition} is for. Give the host a box first:\n *\n * ```ts\n * const card = fixture.nativeElement.querySelector('wr-spotlight-card');\n * card.getBoundingClientRect = () => ({ left: 40, top: 20, width: 200, height: 100 }) as DOMRect;\n * ```\n *\n * Several plausible methods are deliberately absent. There is no `isSpotlightVisible()`\n * or `getSpotlightOpacity()`: the highlight sits at `opacity: 0` and is lifted to `0.6`\n * only under `:hover` / `:focus-within`, both of which are stylesheet selectors on a\n * pseudo-element — jsdom loads no stylesheet, matches no `:hover`, and cannot read a\n * pseudo-element's style at any time, so any answer would be invented. No `getGradient()`\n * for the same reason. No `hover()` / `mouseAway()` wrappers, which would be worse than\n * missing: the CDK's versions dispatch `mouseenter` / `mouseover` / `mouseleave`, none of\n * which this component listens to and none of which changes a `:hover` match in a test —\n * a spec calling them would look like it exercised the reveal and would have exercised\n * nothing. No `getSpotlightRect()` or `getCardSize()`, which are layout. And no\n * `respectsReducedMotion()`: this is the one animation component in the library that\n * deliberately does not implement the preference — a gradient tracks the cursor and no\n * content moves — so the method would answer identically for a component that honoured it\n * and one that ignored it.\n *\n * @example\n * ```ts\n * const card = await loader.getHarness(WrSpotlightCardHarness.with({ text: 'Hover me' }));\n *\n * expect(await card.getRadiusPercent()).toBe(80);\n * expect(await card.getSpotlightColor()).toBeNull(); // the theme decides\n * expect(await card.getSpotlightPosition()).toBeNull(); // nothing has pointed at it\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrSpotlightCardHarness extends ComponentHarness {\n static hostSelector = 'wr-spotlight-card';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrSpotlightCardHarnessFilters = {}): HarnessPredicate<WrSpotlightCardHarness> {\n return new HarnessPredicate(WrSpotlightCardHarness, options).addOption('text', options.text, (harness, text) =>\n HarnessPredicate.stringMatches(harness.getContentText(), text)\n );\n }\n\n /**\n * Where the gradient fades out, as a percentage of its own radius.\n *\n * Returns the number, but the assertion it really makes is about the `%` that was\n * stripped to get it — this method refuses a bare `80`. The stylesheet interpolates the\n * variable straight into `transparent var(--wr-spotlight-radius, 80%)`, where a unitless\n * value is not a length, so the whole `radial-gradient()` declaration is dropped and the\n * highlight disappears with nothing in the console to say why. Reading this as a plain\n * number would sail past exactly that.\n *\n * Always present, whatever the input says: a `[radius]` that is not a number coerces\n * back to the default 80 rather than writing nonsense into the sheet.\n */\n async getRadiusPercent(): Promise<number> {\n const raw = (await this.vars()).get('--wr-spotlight-radius') ?? null;\n const match = raw === null ? null : PERCENTAGE.exec(raw);\n if (!match) {\n throw new Error(\n `WrSpotlightCardHarness.getRadiusPercent(): \\`--wr-spotlight-radius\\` reads \"${raw ?? '(absent)'}\" on the ` +\n 'host, and the stylesheet needs a percentage there — it drops the whole gradient for a bare number. The ' +\n 'card writes this one on every render whatever the input says, so a missing or unsuffixed value means ' +\n 'the binding itself stopped reaching the element.'\n );\n }\n return Number.parseFloat(match[1]);\n }\n\n /**\n * The highlight colour the author asked for, or `null` when they left it to the theme.\n *\n * `null` IS the contract for an unset `[spotlightColor]`, not a gap in it. The\n * stylesheet's own default is `rgba(var(--wr-color-on-surface-rgb), .15)`, and that\n * token flips per theme — which is what makes one component read as a dark glow on a\n * light surface and a light beam on a dark one. A card that started writing a concrete\n * colour here would look right in whichever theme it was authored against and wrong in\n * the other, and this is the only method that can tell.\n */\n async getSpotlightColor(): Promise<string | null> {\n return (await this.vars()).get('--wr-spotlight-color') ?? null;\n }\n\n /**\n * Where the highlight last sat, in pixels from the card's own top-left corner. `null`\n * until something has pointed at the card.\n *\n * Pixels, not percentages — see this class's docs for why the distinction matters\n * inside this one entry point.\n *\n * `null` is a state of its own rather than a stand-in for `{ x: 0, y: 0 }`: before the\n * first move the stylesheet's `50% / 50%` default applies, and a pointer at the card's\n * own origin legitimately reports zero, so folding the two together would make an\n * untouched card indistinguishable from one being pointed at in its corner.\n *\n * Note there is no reset when the cursor leaves, and that is not an oversight the\n * harness papers over: the stylesheet fades the whole overlay to `opacity: 0` on leave,\n * so nothing is parked visibly — but the coordinate stays written for the life of the\n * element. `null` therefore means \"no pointer has EVER arrived\", not \"none is here now\".\n */\n async getSpotlightPosition(): Promise<{ x: number; y: number } | null> {\n const vars = await this.vars();\n const x = vars.get('--wr-spotlight-x');\n const y = vars.get('--wr-spotlight-y');\n if (x === undefined || y === undefined) return null;\n\n return { x: this.parsePixels(x, '--wr-spotlight-x'), y: this.parsePixels(y, '--wr-spotlight-y') };\n }\n\n /**\n * Point at the card, in client coordinates.\n *\n * A `mousemove`, not a `pointermove` — the component listens for the former, and the\n * directive in the same entry point for the latter, so a pointer event dispatched here\n * is silently ignored. It goes to the host itself, so it needs no hit test and cannot\n * miss in a test that has no layout; the coordinates only ever reach the component's\n * own subtraction.\n *\n * Stub the host's `getBoundingClientRect` before calling this, or the subtraction is\n * invisible — see this class's docs.\n */\n async movePointerTo(clientX: number, clientY: number): Promise<void> {\n await (await this.host()).dispatchEvent('mousemove', { clientX, clientY });\n }\n\n /**\n * The projected content's text, trimmed.\n *\n * Read from the host, which is the whole assertion: the template is a bare\n * `<ng-content />` with no wrapper element, so content lands as a direct child and an\n * interactive one keeps its own name and role. The component adds no ARIA and no node\n * of its own — there is nothing else here for a harness to ask about.\n */\n async getContentText(): Promise<string> {\n return (await this.host()).text();\n }\n\n /** The host's inline declarations — the component's whole written output. */\n private async vars(): Promise<Map<string, string>> {\n return wrSpotlightInlineVars((await (await this.host()).getAttribute('style')) ?? '');\n }\n\n /** One written coordinate, as a number, insisting on the `px` the card promises. */\n private parsePixels(raw: string, name: string): number {\n const match = PIXEL_LENGTH.exec(raw);\n if (!match) {\n throw new Error(\n `WrSpotlightCardHarness.getSpotlightPosition(): \\`${name}\\` reads \"${raw}\", which is not the pixel length ` +\n 'the card writes. A percentage here is the tell that `[wrSpotlight]` is on the same element — the two ' +\n 'exports of this entry point share these variables and disagree about the unit.'\n );\n }\n return Number.parseFloat(match[1]);\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrSpotlightHarnessFilters } from './interfaces';\nimport { wrSpotlightInlineVars } from './wr-spotlight-harness-vars';\n\n/**\n * Test harness for `[wrSpotlight]` — the directive that makes a cursor-following\n * gradient possible on an element the consumer owns.\n *\n * **This harness reads PERCENTAGES. {@link WrSpotlightCardHarness}, shipped from the same\n * entry point, reads PIXELS.** Both write `--wr-spotlight-x` / `--wr-spotlight-y`; the\n * directive writes them as a share of its own box off `pointermove`, the card as a pixel\n * offset off `mousemove`. That is why {@link getSpotlightPosition} hands back raw strings\n * and not numbers — collapsing `'37.5%'` to `37.5` would hide the one thing that decides\n * whether the gradient lands where the cursor is, and would make the two halves of this\n * entry point look interchangeable when they are not.\n *\n * **The directive ships no styles and adds no node.** There is no class to assert, no\n * wrapper, no ARIA: whatever the element announced before the directive applies is\n * exactly what it announces after, and the gradient is entirely the consumer's own CSS.\n * So there is no `isSpotlightVisible()` — there is nothing here to be visible — and no\n * `getResetX()` / `getResetY()`, which would echo the inputs back rather than report the\n * coordinate the directive actually WROTE. The echo would pass while the written value\n * was wrong, which is not hypothetical (see {@link getSpotlightPosition}). And no\n * `respectsReducedMotion()`: neither export in this entry point implements the\n * preference — it is the library's one documented exemption, since a gradient tracks the\n * cursor and no content moves — so the method would answer the same for a directive that\n * honoured it and one that ignored it.\n *\n * @example\n * ```ts\n * const spotlight = await loader.getHarness(WrSpotlightHarness.with({ hostClass: 'card' }));\n *\n * expect(await spotlight.getSpotlightPosition()).toEqual({ x: '50%', y: '50%' });\n * await spotlight.movePointerTo(150, 25); // stub the host's rect first\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrSpotlightHarness extends ComponentHarness {\n static hostSelector = '[wrSpotlight]';\n\n /**\n * Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`.\n *\n * Both options describe the HOST rather than the directive, because the directive\n * leaves no mark of its own to match on.\n */\n static with(options: WrSpotlightHarnessFilters = {}): HarnessPredicate<WrSpotlightHarness> {\n return new HarnessPredicate(WrSpotlightHarness, options)\n .addOption('text', options.text, async (harness, text) =>\n HarnessPredicate.stringMatches((await harness.host()).text(), text)\n )\n .addOption('hostClass', options.hostClass, async (harness, hostClass) =>\n (await harness.host()).hasClass(hostClass)\n );\n }\n\n /**\n * The coordinates the directive has written, as the raw strings it wrote them.\n *\n * Strings on purpose — see this class's docs. The values are percentages of the host's\n * own box while a pointer is over it, and whatever `[resetX]` / `[resetY]` say\n * otherwise, so a `px` appearing here means something else is writing these variables.\n *\n * **Present from construction, before any pointer arrives.** The directive seeds the\n * reset coordinates in its constructor, so the first read is `50%` / `50%` on a fresh\n * host — do not mistake that for a pointer having been tracked. Worth knowing that the\n * constructor runs before signal inputs are bound, so a bound (or even a static)\n * `resetX` is NOT what appears here initially: it is honoured from the first\n * {@link leave} onward, and the highlight jumps at that point. Reading the written\n * coordinate rather than the input is what makes that visible at all.\n *\n * Throws once the directive has been destroyed, rather than answering with the last\n * value it happened to leave behind — {@link hasTrackedPointer} is the question to ask\n * when the host may be gone.\n */\n async getSpotlightPosition(): Promise<{ x: string; y: string }> {\n const vars = await this.vars();\n const x = vars.get('--wr-spotlight-x');\n const y = vars.get('--wr-spotlight-y');\n if (x === undefined || y === undefined) {\n throw new Error(\n 'WrSpotlightHarness.getSpotlightPosition(): the host carries no `--wr-spotlight-x` / `--wr-spotlight-y`. ' +\n 'The directive writes both in its constructor and removes both on destroy, so this is a torn-down ' +\n 'directive rather than one that has not started — ask hasTrackedPointer() when the host may be gone.'\n );\n }\n return { x, y };\n }\n\n /**\n * Point at the host, in client coordinates.\n *\n * **Refuses on a host with no box, which in a unit test is every host.** The directive\n * divides the cursor offset by the element's own width and height, so a 0×0 rect writes\n * literally `Infinity%` or — at the origin — `NaN%` into the style. jsdom accepts either\n * string without complaint, so an unguarded harness would hand back something that looks\n * like a coordinate and describes nothing. Give the host a box first:\n *\n * ```ts\n * const el = fixture.nativeElement.querySelector('[wrSpotlight]');\n * el.getBoundingClientRect = () => ({ left: 0, top: 0, width: 200, height: 100 }) as DOMRect;\n * ```\n *\n * A `pointermove`, not a `mousemove` — the directive listens for the former, and the\n * component in the same entry point for the latter. It is dispatched on the host itself,\n * so it needs no hit test and cannot miss.\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 `WrSpotlightHarness.movePointerTo(${clientX}, ${clientY}): this host measures ${width}×${height}, so a ` +\n 'pointer position over it means nothing — the directive divides the offset by the box, and the result ' +\n 'goes into the style as `Infinity%` or `NaN%`. Stub `getBoundingClientRect` on the host first.'\n );\n }\n await host.dispatchEvent('pointermove', { clientX, clientY, pointerId: 1, isPrimary: true });\n }\n\n /**\n * Take the pointer away.\n *\n * Dispatches `pointerleave` — the directive's reset path, and the only place `[resetX]`\n * / `[resetY]` are read after construction. Needs no box: the handler writes the reset\n * strings straight through without measuring anything, which is why this one does not\n * refuse the way {@link movePointerTo} does.\n *\n * Not the CDK's `mouseAway()`, though that dispatches `pointerleave` too. This says what\n * it does, and it does not also fire the `mouseleave` / `mouseout` that the CDK helper\n * sends alongside it — events this directive ignores, and that would make a spec look\n * like it had covered more than it did.\n */\n async leave(): Promise<void> {\n await (await this.host()).dispatchEvent('pointerleave');\n }\n\n /**\n * Whether the directive still owns the host's spotlight variables.\n *\n * **This is \"the directive is alive\", not \"a pointer has moved over it\".** It is `true`\n * from the moment the directive constructs, because the constructor seeds the reset\n * coordinates — there is no earlier state to catch. What it distinguishes is a live\n * directive from a torn-down one: destroy removes both declarations from the element,\n * and nothing else in the repo asserts that cleanup. A directive that stopped removing\n * them would leave a stale gradient position on an element the consumer went on using,\n * and the only trace would be these two declarations outliving it.\n */\n async hasTrackedPointer(): Promise<boolean> {\n const vars = await this.vars();\n return vars.has('--wr-spotlight-x') && vars.has('--wr-spotlight-y');\n }\n\n /** The host's inline declarations — the directive's whole written output. */\n private async vars(): Promise<Map<string, string>> {\n return wrSpotlightInlineVars((await (await this.host()).getAttribute('style')) ?? '');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;;;;AAKG;AAEH;;;;;;;;;;;;;;AAcG;AACG,SAAU,qBAAqB,CAAC,KAAa,EAAA;AACjD,IAAA,MAAM,YAAY,GAAG,IAAI,GAAG,EAAkB;IAC9C,KAA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