ngwr 7.2.0 → 8.0.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 (275) hide show
  1. package/README.md +8 -7
  2. package/alert/styles/_index.scss +44 -17
  3. package/avatar/styles/_index.scss +2 -2
  4. package/badge/styles/_index.scss +11 -7
  5. package/badge/styles/_tag.scss +1 -1
  6. package/bar-chart/styles/_index.scss +1 -2
  7. package/breadcrumbs/styles/_index.scss +4 -2
  8. package/burger/styles/_index.scss +2 -2
  9. package/button/styles/_index.scss +30 -20
  10. package/calendar/styles/_index.scss +11 -9
  11. package/calendar-heatmap/styles/_index.scss +2 -0
  12. package/card/styles/_index.scss +1 -1
  13. package/carousel/styles/_index.scss +3 -1
  14. package/cascader/styles/_index.scss +54 -14
  15. package/checkbox/styles/_index.scss +21 -4
  16. package/collapse/styles/_index.scss +1 -1
  17. package/color-picker/styles/_index.scss +18 -12
  18. package/command-palette/styles/_index.scss +3 -3
  19. package/compare/styles/_index.scss +3 -3
  20. package/context-menu/styles/_index.scss +1 -1
  21. package/date-picker/styles/_index.scss +5 -6
  22. package/density/styles/_index.scss +13 -3
  23. package/dialog/styles/_index.scss +3 -3
  24. package/divider/styles/_index.scss +1 -1
  25. package/drawer/styles/_index.scss +13 -11
  26. package/dropdown/styles/_index.scss +2 -2
  27. package/fesm2022/ngwr-affix.mjs +3 -3
  28. package/fesm2022/ngwr-alert.mjs +22 -10
  29. package/fesm2022/ngwr-alert.mjs.map +1 -1
  30. package/fesm2022/ngwr-anchor.mjs +3 -3
  31. package/fesm2022/ngwr-aurora.mjs +3 -3
  32. package/fesm2022/ngwr-avatar.mjs +3 -3
  33. package/fesm2022/ngwr-back-top.mjs +3 -3
  34. package/fesm2022/ngwr-badge.mjs +6 -6
  35. package/fesm2022/ngwr-bar-chart.mjs +3 -3
  36. package/fesm2022/ngwr-blur-text.mjs +3 -3
  37. package/fesm2022/ngwr-border-glow.mjs +3 -3
  38. package/fesm2022/ngwr-breadcrumbs.mjs +7 -7
  39. package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
  40. package/fesm2022/ngwr-burger.mjs +3 -3
  41. package/fesm2022/ngwr-button.mjs +6 -6
  42. package/fesm2022/ngwr-calendar-heatmap.mjs +3 -3
  43. package/fesm2022/ngwr-calendar.mjs +4 -4
  44. package/fesm2022/ngwr-calendar.mjs.map +1 -1
  45. package/fesm2022/ngwr-card.mjs +10 -10
  46. package/fesm2022/ngwr-card.mjs.map +1 -1
  47. package/fesm2022/ngwr-carousel.mjs +50 -9
  48. package/fesm2022/ngwr-carousel.mjs.map +1 -1
  49. package/fesm2022/ngwr-cascader.mjs +12 -35
  50. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  51. package/fesm2022/ngwr-checkbox.mjs +13 -30
  52. package/fesm2022/ngwr-checkbox.mjs.map +1 -1
  53. package/fesm2022/ngwr-circular-text.mjs +3 -3
  54. package/fesm2022/ngwr-click-spark.mjs +25 -6
  55. package/fesm2022/ngwr-click-spark.mjs.map +1 -1
  56. package/fesm2022/ngwr-clipboard.mjs +27 -6
  57. package/fesm2022/ngwr-clipboard.mjs.map +1 -1
  58. package/fesm2022/ngwr-collapse.mjs +9 -9
  59. package/fesm2022/ngwr-color-picker.mjs +7 -7
  60. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  61. package/fesm2022/ngwr-command-palette.mjs +3 -3
  62. package/fesm2022/ngwr-compare.mjs +3 -3
  63. package/fesm2022/ngwr-confetti.mjs +3 -3
  64. package/fesm2022/ngwr-context-menu.mjs +39 -15
  65. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  66. package/fesm2022/ngwr-cookie.mjs +3 -3
  67. package/fesm2022/ngwr-counter.mjs +12 -8
  68. package/fesm2022/ngwr-counter.mjs.map +1 -1
  69. package/fesm2022/ngwr-date-adapter-fns.mjs +3 -3
  70. package/fesm2022/ngwr-date-adapter-luxon.mjs +3 -3
  71. package/fesm2022/ngwr-date-adapter.mjs +3 -3
  72. package/fesm2022/ngwr-date-picker.mjs +25 -11
  73. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  74. package/fesm2022/ngwr-decrypt-text.mjs +3 -3
  75. package/fesm2022/ngwr-density.mjs +14 -14
  76. package/fesm2022/ngwr-density.mjs.map +1 -1
  77. package/fesm2022/ngwr-descriptions.mjs +6 -6
  78. package/fesm2022/ngwr-dialog.mjs +15 -15
  79. package/fesm2022/ngwr-directives.mjs +15 -87
  80. package/fesm2022/ngwr-directives.mjs.map +1 -1
  81. package/fesm2022/ngwr-divider.mjs +3 -3
  82. package/fesm2022/ngwr-donut-chart.mjs +10 -4
  83. package/fesm2022/ngwr-donut-chart.mjs.map +1 -1
  84. package/fesm2022/ngwr-drag-drop.mjs +18 -8
  85. package/fesm2022/ngwr-drag-drop.mjs.map +1 -1
  86. package/fesm2022/ngwr-drawer.mjs +80 -19
  87. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  88. package/fesm2022/ngwr-dropdown.mjs +9 -9
  89. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  90. package/fesm2022/ngwr-empty.mjs +3 -3
  91. package/fesm2022/ngwr-falling-text.mjs +3 -3
  92. package/fesm2022/ngwr-file-upload.mjs +3 -3
  93. package/fesm2022/ngwr-form.mjs +9 -9
  94. package/fesm2022/ngwr-fuzzy-text.mjs +8 -7
  95. package/fesm2022/ngwr-fuzzy-text.mjs.map +1 -1
  96. package/fesm2022/ngwr-gauge.mjs +3 -3
  97. package/fesm2022/ngwr-glitch-text.mjs +15 -7
  98. package/fesm2022/ngwr-glitch-text.mjs.map +1 -1
  99. package/fesm2022/ngwr-gradient-text.mjs +3 -3
  100. package/fesm2022/ngwr-hotkey.mjs +6 -6
  101. package/fesm2022/ngwr-i18n.mjs +9 -9
  102. package/fesm2022/ngwr-icon.mjs +3 -3
  103. package/fesm2022/ngwr-image-cropper.mjs +3 -3
  104. package/fesm2022/ngwr-input-number.mjs +4 -4
  105. package/fesm2022/ngwr-input-number.mjs.map +1 -1
  106. package/fesm2022/ngwr-input-otp.mjs +10 -4
  107. package/fesm2022/ngwr-input-otp.mjs.map +1 -1
  108. package/fesm2022/ngwr-input.mjs +25 -16
  109. package/fesm2022/ngwr-input.mjs.map +1 -1
  110. package/fesm2022/ngwr-keyboard.mjs +3 -3
  111. package/fesm2022/ngwr-knob.mjs +3 -3
  112. package/fesm2022/ngwr-layout.mjs +15 -15
  113. package/fesm2022/ngwr-lightbox.mjs +60 -5
  114. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  115. package/fesm2022/ngwr-line-chart.mjs +3 -3
  116. package/fesm2022/ngwr-list.mjs +7 -7
  117. package/fesm2022/ngwr-list.mjs.map +1 -1
  118. package/fesm2022/ngwr-loading-bar.mjs +6 -6
  119. package/fesm2022/ngwr-marquee.mjs +3 -3
  120. package/fesm2022/ngwr-media.mjs +3 -3
  121. package/fesm2022/ngwr-mention.mjs +6 -6
  122. package/fesm2022/ngwr-meta.mjs +6 -6
  123. package/fesm2022/ngwr-meter-group.mjs +3 -3
  124. package/fesm2022/ngwr-overlay.mjs +3 -3
  125. package/fesm2022/ngwr-page-header.mjs +3 -3
  126. package/fesm2022/ngwr-pagination.mjs +14 -16
  127. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  128. package/fesm2022/ngwr-pipes.mjs +21 -21
  129. package/fesm2022/ngwr-platform.mjs +3 -3
  130. package/fesm2022/ngwr-popconfirm.mjs +6 -6
  131. package/fesm2022/ngwr-popover.mjs +6 -6
  132. package/fesm2022/ngwr-progress.mjs +3 -3
  133. package/fesm2022/ngwr-qr.mjs +3 -3
  134. package/fesm2022/ngwr-radio.mjs +28 -26
  135. package/fesm2022/ngwr-radio.mjs.map +1 -1
  136. package/fesm2022/ngwr-rating.mjs +12 -23
  137. package/fesm2022/ngwr-rating.mjs.map +1 -1
  138. package/fesm2022/ngwr-result.mjs +12 -12
  139. package/fesm2022/ngwr-rotating-text.mjs +18 -7
  140. package/fesm2022/ngwr-rotating-text.mjs.map +1 -1
  141. package/fesm2022/ngwr-scroll.mjs +3 -3
  142. package/fesm2022/ngwr-segmented.mjs +10 -22
  143. package/fesm2022/ngwr-segmented.mjs.map +1 -1
  144. package/fesm2022/ngwr-select.mjs +26 -13
  145. package/fesm2022/ngwr-select.mjs.map +1 -1
  146. package/fesm2022/ngwr-shiny-text.mjs +6 -6
  147. package/fesm2022/ngwr-sidebar.mjs +3 -3
  148. package/fesm2022/ngwr-skeleton.mjs +3 -3
  149. package/fesm2022/ngwr-slider.mjs +3 -3
  150. package/fesm2022/ngwr-sparkline.mjs +3 -3
  151. package/fesm2022/ngwr-speed-dial.mjs +3 -3
  152. package/fesm2022/ngwr-spinner.mjs +3 -3
  153. package/fesm2022/ngwr-splash-cursor.mjs +3 -3
  154. package/fesm2022/ngwr-split-text.mjs +3 -3
  155. package/fesm2022/ngwr-splitter.mjs +3 -3
  156. package/fesm2022/ngwr-spotlight-card.mjs +8 -8
  157. package/fesm2022/ngwr-spotlight-card.mjs.map +1 -1
  158. package/fesm2022/ngwr-squircle.mjs +6 -6
  159. package/fesm2022/ngwr-star-border.mjs +3 -3
  160. package/fesm2022/ngwr-statistic.mjs +79 -10
  161. package/fesm2022/ngwr-statistic.mjs.map +1 -1
  162. package/fesm2022/ngwr-stepper.mjs +6 -6
  163. package/fesm2022/ngwr-storage.mjs +3 -3
  164. package/fesm2022/ngwr-switch.mjs +10 -14
  165. package/fesm2022/ngwr-switch.mjs.map +1 -1
  166. package/fesm2022/ngwr-table.mjs +20 -14
  167. package/fesm2022/ngwr-table.mjs.map +1 -1
  168. package/fesm2022/ngwr-tabs.mjs +45 -11
  169. package/fesm2022/ngwr-tabs.mjs.map +1 -1
  170. package/fesm2022/ngwr-textarea.mjs +84 -25
  171. package/fesm2022/ngwr-textarea.mjs.map +1 -1
  172. package/fesm2022/ngwr-theme.mjs +3 -3
  173. package/fesm2022/ngwr-tilt-card.mjs +6 -6
  174. package/fesm2022/ngwr-timeline.mjs +6 -6
  175. package/fesm2022/ngwr-toast.mjs +99 -25
  176. package/fesm2022/ngwr-toast.mjs.map +1 -1
  177. package/fesm2022/ngwr-toolbar.mjs +13 -6
  178. package/fesm2022/ngwr-toolbar.mjs.map +1 -1
  179. package/fesm2022/ngwr-tree.mjs +3 -3
  180. package/fesm2022/ngwr-typewriter.mjs +3 -3
  181. package/fesm2022/ngwr-typography.mjs +3 -3
  182. package/fesm2022/ngwr-validators.mjs +41 -3
  183. package/fesm2022/ngwr-validators.mjs.map +1 -1
  184. package/fesm2022/ngwr-version.mjs +1 -1
  185. package/fesm2022/ngwr-version.mjs.map +1 -1
  186. package/fesm2022/ngwr-virtual-scroll.mjs +3 -3
  187. package/fesm2022/ngwr-waves.mjs +3 -3
  188. package/fesm2022/ngwr-window.mjs +12 -12
  189. package/file-upload/styles/_index.scss +3 -3
  190. package/form/styles/_index.scss +5 -5
  191. package/glitch-text/styles/_index.scss +3 -6
  192. package/image-cropper/styles/_index.scss +3 -3
  193. package/input/styles/_index.scss +26 -7
  194. package/input-otp/styles/_index.scss +23 -5
  195. package/keyboard/styles/_index.scss +6 -4
  196. package/knob/styles/_index.scss +1 -1
  197. package/lightbox/styles/_index.scss +31 -10
  198. package/list/styles/_index.scss +3 -3
  199. package/llms-full.txt +668 -0
  200. package/llms.txt +106 -0
  201. package/mention/styles/_index.scss +2 -2
  202. package/overlay/styles/_index.scss +1 -1
  203. package/package.json +1 -6
  204. package/pagination/styles/_index.scss +36 -25
  205. package/popconfirm/styles/_index.scss +1 -1
  206. package/popover/styles/_index.scss +2 -2
  207. package/radio/styles/_index.scss +20 -5
  208. package/rating/styles/_index.scss +12 -1
  209. package/schematics/migrations/v8/index.js +122 -0
  210. package/schematics/migrations.json +5 -0
  211. package/schematics/ng-add/index.js +3 -3
  212. package/schematics/ng-add/schema.json +6 -6
  213. package/schematics/provider/schema.json +1 -1
  214. package/schematics/use/symbol-map.json +11 -2
  215. package/segmented/styles/_index.scss +31 -8
  216. package/select/styles/_index.scss +73 -25
  217. package/sidebar/styles/_index.scss +3 -3
  218. package/slider/styles/_index.scss +5 -3
  219. package/speed-dial/styles/_index.scss +1 -0
  220. package/splitter/styles/_index.scss +7 -4
  221. package/spotlight-card/styles/_index.scss +8 -4
  222. package/stepper/styles/_index.scss +4 -4
  223. package/styles/_animations.scss +0 -23
  224. package/styles.scss +0 -1
  225. package/switch/styles/_index.scss +25 -6
  226. package/table/styles/_index.scss +69 -8
  227. package/tabs/styles/_index.scss +46 -3
  228. package/textarea/styles/_index.scss +59 -4
  229. package/theme/styles/_colors.scss +57 -0
  230. package/theme/styles/_dark.scss +22 -8
  231. package/theme/styles/_focus.scss +5 -0
  232. package/theme/styles/_variables.scss +24 -0
  233. package/timeline/styles/_index.scss +11 -2
  234. package/toast/styles/_index.scss +15 -5
  235. package/toolbar/styles/_index.scss +30 -1
  236. package/tree/styles/_index.scss +18 -17
  237. package/types/ngwr-alert.d.ts +16 -6
  238. package/types/ngwr-carousel.d.ts +8 -1
  239. package/types/ngwr-cascader.d.ts +5 -2
  240. package/types/ngwr-checkbox.d.ts +5 -2
  241. package/types/ngwr-click-spark.d.ts +13 -1
  242. package/types/ngwr-clipboard.d.ts +12 -1
  243. package/types/ngwr-context-menu.d.ts +20 -3
  244. package/types/ngwr-date-picker.d.ts +3 -0
  245. package/types/ngwr-density.d.ts +7 -7
  246. package/types/ngwr-directives.d.ts +17 -49
  247. package/types/ngwr-drag-drop.d.ts +13 -1
  248. package/types/ngwr-drawer.d.ts +11 -3
  249. package/types/ngwr-fuzzy-text.d.ts +1 -1
  250. package/types/ngwr-glitch-text.d.ts +9 -3
  251. package/types/ngwr-input-otp.d.ts +6 -2
  252. package/types/ngwr-input.d.ts +27 -13
  253. package/types/ngwr-lightbox.d.ts +14 -1
  254. package/types/ngwr-pagination.d.ts +10 -10
  255. package/types/ngwr-radio.d.ts +14 -3
  256. package/types/ngwr-rating.d.ts +5 -1
  257. package/types/ngwr-rotating-text.d.ts +1 -0
  258. package/types/ngwr-segmented.d.ts +5 -2
  259. package/types/ngwr-select.d.ts +6 -2
  260. package/types/ngwr-spotlight-card.d.ts +1 -1
  261. package/types/ngwr-statistic.d.ts +35 -1
  262. package/types/ngwr-switch.d.ts +5 -1
  263. package/types/ngwr-table.d.ts +7 -1
  264. package/types/ngwr-tabs.d.ts +6 -0
  265. package/types/ngwr-textarea.d.ts +25 -3
  266. package/types/ngwr-toast.d.ts +7 -1
  267. package/types/ngwr-toolbar.d.ts +7 -1
  268. package/types/ngwr-validators.d.ts +3 -1
  269. package/types/ngwr-version.d.ts +1 -1
  270. package/window/styles/_index.scss +8 -8
  271. package/fesm2022/ngwr-scramble-text.mjs +0 -165
  272. package/fesm2022/ngwr-scramble-text.mjs.map +0 -1
  273. package/scramble-text/scramble-text.scss +0 -1
  274. package/scramble-text/styles/_index.scss +0 -8
  275. package/types/ngwr-scramble-text.d.ts +0 -49
@@ -36,8 +36,13 @@ const EASINGS = {
36
36
  * @see https://www.reactbits.dev/animations/click-spark
37
37
  */
38
38
  class WrClickSpark {
39
- /** Spark line colour. @default '#fff' */
40
- sparkColor = input('#fff', /* @ts-ignore */
39
+ /**
40
+ * Spark line colour. Accepts any CSS colour, or a `var(--wr-…)` token which is
41
+ * resolved against the host so it tracks the theme. The default flips with the
42
+ * theme — dark sparks in light mode, light sparks in dark.
43
+ * @default 'var(--wr-color-dark)'
44
+ */
45
+ sparkColor = input('var(--wr-color-dark)', /* @ts-ignore */
41
46
  ...(ngDevMode ? [{ debugName: "sparkColor" }] : /* istanbul ignore next */ []));
42
47
  /** Length of each spark line in pixels (at t=0; tapers to 0 at t=1). @default 10 */
43
48
  sparkSize = input(10, { ...(ngDevMode ? { debugName: "sparkSize" } : /* istanbul ignore next */ {}), transform: numAttr(10) });
@@ -82,6 +87,20 @@ class WrClickSpark {
82
87
  }
83
88
  }
84
89
  // Internals
90
+ /**
91
+ * Canvas `strokeStyle` can't read CSS custom properties, so a `var(--wr-…)`
92
+ * token is resolved against the host's computed style here. Plain colours
93
+ * pass through untouched. Falls back to a dark literal if the custom
94
+ * property resolves to nothing.
95
+ */
96
+ resolveColor() {
97
+ const color = this.sparkColor();
98
+ const match = /^var\((--[\w-]+)\)$/.exec(color.trim());
99
+ if (!match)
100
+ return color;
101
+ const resolved = getComputedStyle(this.host.nativeElement).getPropertyValue(match[1]).trim();
102
+ return resolved || '#0f172a';
103
+ }
85
104
  syncCanvasSize() {
86
105
  const canvas = this.canvasRef().nativeElement;
87
106
  const host = this.host.nativeElement;
@@ -118,7 +137,7 @@ class WrClickSpark {
118
137
  const sparkRadius = this.sparkRadius();
119
138
  const sparkSize = this.sparkSize();
120
139
  const extraScale = this.extraScale();
121
- const color = this.sparkColor();
140
+ const color = this.resolveColor();
122
141
  this.sparks = this.sparks.filter(spark => {
123
142
  const elapsed = ts - spark.startTime;
124
143
  if (elapsed >= duration)
@@ -144,10 +163,10 @@ class WrClickSpark {
144
163
  raf = requestAnimationFrame(draw);
145
164
  this.destroyRef.onDestroy(() => cancelAnimationFrame(raf));
146
165
  }
147
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrClickSpark, deps: [], target: i0.ɵɵFactoryTarget.Component });
148
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.2", type: WrClickSpark, isStandalone: true, selector: "wr-click-spark", inputs: { sparkColor: { classPropertyName: "sparkColor", publicName: "sparkColor", isSignal: true, isRequired: false, transformFunction: null }, sparkSize: { classPropertyName: "sparkSize", publicName: "sparkSize", isSignal: true, isRequired: false, transformFunction: null }, sparkRadius: { classPropertyName: "sparkRadius", publicName: "sparkRadius", isSignal: true, isRequired: false, transformFunction: null }, sparkCount: { classPropertyName: "sparkCount", publicName: "sparkCount", isSignal: true, isRequired: false, transformFunction: null }, duration: { classPropertyName: "duration", publicName: "duration", isSignal: true, isRequired: false, transformFunction: null }, easing: { classPropertyName: "easing", publicName: "easing", isSignal: true, isRequired: false, transformFunction: null }, extraScale: { classPropertyName: "extraScale", publicName: "extraScale", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick($event)" }, classAttribute: "wr-click-spark" }, viewQueries: [{ propertyName: "canvasRef", first: true, predicate: ["canvas"], descendants: true, isSignal: true }], ngImport: i0, template: "<canvas #canvas class=\"wr-click-spark__canvas\"></canvas>\n<ng-content />\n", styles: [".wr-click-spark{position:relative;display:block}.wr-click-spark__canvas{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;user-select:none;z-index:1}\n"], encapsulation: i0.ViewEncapsulation.None });
166
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: WrClickSpark, deps: [], target: i0.ɵɵFactoryTarget.Component });
167
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.4", type: WrClickSpark, isStandalone: true, selector: "wr-click-spark", inputs: { sparkColor: { classPropertyName: "sparkColor", publicName: "sparkColor", isSignal: true, isRequired: false, transformFunction: null }, sparkSize: { classPropertyName: "sparkSize", publicName: "sparkSize", isSignal: true, isRequired: false, transformFunction: null }, sparkRadius: { classPropertyName: "sparkRadius", publicName: "sparkRadius", isSignal: true, isRequired: false, transformFunction: null }, sparkCount: { classPropertyName: "sparkCount", publicName: "sparkCount", isSignal: true, isRequired: false, transformFunction: null }, duration: { classPropertyName: "duration", publicName: "duration", isSignal: true, isRequired: false, transformFunction: null }, easing: { classPropertyName: "easing", publicName: "easing", isSignal: true, isRequired: false, transformFunction: null }, extraScale: { classPropertyName: "extraScale", publicName: "extraScale", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick($event)" }, classAttribute: "wr-click-spark" }, viewQueries: [{ propertyName: "canvasRef", first: true, predicate: ["canvas"], descendants: true, isSignal: true }], ngImport: i0, template: "<canvas #canvas class=\"wr-click-spark__canvas\"></canvas>\n<ng-content />\n", styles: [".wr-click-spark{position:relative;display:block}.wr-click-spark__canvas{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;user-select:none;z-index:1}\n"], encapsulation: i0.ViewEncapsulation.None });
149
168
  }
150
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrClickSpark, decorators: [{
169
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: WrClickSpark, decorators: [{
151
170
  type: Component,
152
171
  args: [{ selector: 'wr-click-spark', encapsulation: ViewEncapsulation.None, host: {
153
172
  class: 'wr-click-spark',
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-click-spark.mjs","sources":["../../../projects/lib/click-spark/click-spark.ts","../../../projects/lib/click-spark/click-spark.html","../../../projects/lib/click-spark/ngwr-click-spark.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n *\n * Angular adaptation of the ClickSpark effect by David Haz / reactbits.dev.\n * Original: https://www.reactbits.dev/animations/click-spark\n */\n\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n inject,\n input,\n viewChild,\n} from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\nimport { numAttr } from 'ngwr/utils';\n\nimport type { WrClickSparkEasing } from './interfaces';\n\ninterface Spark {\n readonly x: number;\n readonly y: number;\n readonly angle: number;\n readonly startTime: number;\n}\n\nconst EASINGS: Readonly<Record<WrClickSparkEasing, (t: number) => number>> = {\n linear: t => t,\n 'ease-in': t => t * t,\n 'ease-in-out': t => (t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t),\n 'ease-out': t => t * (2 - t),\n};\n\n/**\n * Click ripple — bursts a ring of short line sparks from the click point\n * across any projected content. Wraps children in a positioned container\n * with a `pointer-events: none` canvas overlay, so projected DOM stays\n * fully interactive.\n *\n * @example\n * ```html\n * <wr-click-spark>\n * <h1>Click anywhere</h1>\n * <button>Buttons still work</button>\n * </wr-click-spark>\n * ```\n *\n * @see https://www.reactbits.dev/animations/click-spark\n */\n@Component({\n selector: 'wr-click-spark',\n templateUrl: './click-spark.html',\n styleUrl: './click-spark.scss',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-click-spark',\n '(click)': 'onClick($event)',\n },\n})\nexport class WrClickSpark {\n /** Spark line colour. @default '#fff' */\n readonly sparkColor = input('#fff');\n\n /** Length of each spark line in pixels (at t=0; tapers to 0 at t=1). @default 10 */\n readonly sparkSize = input(10, { transform: numAttr(10) });\n\n /** Distance each spark travels from origin in pixels. @default 15 */\n readonly sparkRadius = input(15, { transform: numAttr(15) });\n\n /** Number of sparks per click (evenly distributed around the circle). @default 8 */\n readonly sparkCount = input(8, { transform: numAttr(8) });\n\n /** Animation duration in ms. @default 400 */\n readonly duration = input(400, { transform: numAttr(400) });\n\n /** Easing function applied to the travel distance. @default 'ease-out' */\n readonly easing = input<WrClickSparkEasing>('ease-out');\n\n /** Multiplier on the travel distance — bumps the radius without changing `sparkRadius`. @default 1 */\n readonly extraScale = input(1, { transform: numAttr(1) });\n\n private readonly canvasRef = viewChild.required<ElementRef<HTMLCanvasElement>>('canvas');\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly destroyRef = inject(DestroyRef);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly platform = inject(WrPlatform);\n\n private sparks: Spark[] = [];\n\n constructor() {\n if (!this.isBrowser) return;\n afterNextRender(() => {\n this.syncCanvasSize();\n this.watchResize();\n this.startLoop();\n });\n }\n\n protected onClick(event: MouseEvent): void {\n // Reduced motion: no spark bursts — same policy as wr-confetti.\n if (this.platform.prefersReducedMotion()) return;\n const canvas = this.canvasRef().nativeElement;\n const rect = canvas.getBoundingClientRect();\n const x = event.clientX - rect.left;\n const y = event.clientY - rect.top;\n const now = performance.now();\n const count = this.sparkCount();\n for (let i = 0; i < count; i++) {\n this.sparks.push({ x, y, angle: (2 * Math.PI * i) / count, startTime: now });\n }\n }\n\n // Internals\n\n private syncCanvasSize(): void {\n const canvas = this.canvasRef().nativeElement;\n const host = this.host.nativeElement;\n const { width, height } = host.getBoundingClientRect();\n if (canvas.width !== Math.round(width)) canvas.width = Math.round(width);\n if (canvas.height !== Math.round(height)) canvas.height = Math.round(height);\n }\n\n private watchResize(): void {\n if (typeof ResizeObserver === 'undefined') return;\n let resizeTimer: ReturnType<typeof setTimeout> | undefined;\n const ro = new ResizeObserver(() => {\n clearTimeout(resizeTimer);\n resizeTimer = setTimeout(() => this.syncCanvasSize(), 100);\n });\n ro.observe(this.host.nativeElement);\n this.destroyRef.onDestroy(() => {\n ro.disconnect();\n clearTimeout(resizeTimer);\n });\n }\n\n private startLoop(): void {\n const canvas = this.canvasRef().nativeElement;\n const ctx = canvas.getContext('2d');\n if (!ctx) return;\n\n let raf = 0;\n\n const draw = (ts: number): void => {\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n const ease = EASINGS[this.easing()];\n const duration = this.duration();\n const sparkRadius = this.sparkRadius();\n const sparkSize = this.sparkSize();\n const extraScale = this.extraScale();\n const color = this.sparkColor();\n\n this.sparks = this.sparks.filter(spark => {\n const elapsed = ts - spark.startTime;\n if (elapsed >= duration) return false;\n const progress = elapsed / duration;\n const eased = ease(progress);\n const distance = eased * sparkRadius * extraScale;\n const lineLength = sparkSize * (1 - eased);\n\n const x1 = spark.x + distance * Math.cos(spark.angle);\n const y1 = spark.y + distance * Math.sin(spark.angle);\n const x2 = spark.x + (distance + lineLength) * Math.cos(spark.angle);\n const y2 = spark.y + (distance + lineLength) * Math.sin(spark.angle);\n\n ctx.strokeStyle = color;\n ctx.lineWidth = 2;\n ctx.beginPath();\n ctx.moveTo(x1, y1);\n ctx.lineTo(x2, y2);\n ctx.stroke();\n return true;\n });\n\n raf = requestAnimationFrame(draw);\n };\n\n raf = requestAnimationFrame(draw);\n this.destroyRef.onDestroy(() => cancelAnimationFrame(raf));\n }\n}\n\nexport type { WrClickSparkEasing } from './interfaces';\n","<canvas #canvas class=\"wr-click-spark__canvas\"></canvas>\n<ng-content />\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;AAQG;AA2BH,MAAM,OAAO,GAAgE;AAC3E,IAAA,MAAM,EAAE,CAAC,IAAI,CAAC;AACd,IAAA,SAAS,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC;AACrB,IAAA,aAAa,EAAE,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChE,UAAU,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;AAeG;MAWU,YAAY,CAAA;;IAEd,UAAU,GAAG,KAAK,CAAC,MAAM;mFAAC;;AAG1B,IAAA,SAAS,GAAG,KAAK,CAAC,EAAE,EAAA,EAAA,IAAA,SAAA,GAAA,EAAA,SAAA,EAAA,WAAA,EAAA,8BAAA,EAAA,CAAA,EAAI,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,EAAA,CAAG;;AAGjD,IAAA,WAAW,GAAG,KAAK,CAAC,EAAE,EAAA,EAAA,IAAA,SAAA,GAAA,EAAA,SAAA,EAAA,aAAA,EAAA,8BAAA,EAAA,CAAA,EAAI,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,EAAA,CAAG;;AAGnD,IAAA,UAAU,GAAG,KAAK,CAAC,CAAC,EAAA,EAAA,IAAA,SAAA,GAAA,EAAA,SAAA,EAAA,YAAA,EAAA,8BAAA,EAAA,CAAA,EAAI,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,EAAA,CAAG;;AAGhD,IAAA,QAAQ,GAAG,KAAK,C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A,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,YAAY,isCCpEzB,8EAEA,EAAA,MAAA,EAAA,CAAA,qMAAA,CAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FDkEa,YAAY,EAAA,UAAA,EAAA,CAAA;kBAVxB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,gBAAgB,EAAA,aAAA,EAGX,iBAAiB,CAAC,IAAI,EAAA,IAAA,EAC/B;AACJ,wBAAA,KAAK,EAAE,gBAAgB;AACvB,wBAAA,SAAS,EAAE,iBAAiB;AAC7B,qBAAA,EAAA,QAAA,EAAA,8EAAA,EAAA,MAAA,EAAA,CAAA,qMAAA,CAAA,EAAA;ixBAwB8E,QAAQ,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE1FzF;;AAEG;;;;"}
1
+ {"version":3,"file":"ngwr-click-spark.mjs","sources":["../../../projects/lib/click-spark/click-spark.ts","../../../projects/lib/click-spark/click-spark.html","../../../projects/lib/click-spark/ngwr-click-spark.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n *\n * Angular adaptation of the ClickSpark effect by David Haz / reactbits.dev.\n * Original: https://www.reactbits.dev/animations/click-spark\n */\n\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n inject,\n input,\n viewChild,\n} from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\nimport { numAttr } from 'ngwr/utils';\n\nimport type { WrClickSparkEasing } from './interfaces';\n\ninterface Spark {\n readonly x: number;\n readonly y: number;\n readonly angle: number;\n readonly startTime: number;\n}\n\nconst EASINGS: Readonly<Record<WrClickSparkEasing, (t: number) => number>> = {\n linear: t => t,\n 'ease-in': t => t * t,\n 'ease-in-out': t => (t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t),\n 'ease-out': t => t * (2 - t),\n};\n\n/**\n * Click ripple — bursts a ring of short line sparks from the click point\n * across any projected content. Wraps children in a positioned container\n * with a `pointer-events: none` canvas overlay, so projected DOM stays\n * fully interactive.\n *\n * @example\n * ```html\n * <wr-click-spark>\n * <h1>Click anywhere</h1>\n * <button>Buttons still work</button>\n * </wr-click-spark>\n * ```\n *\n * @see https://www.reactbits.dev/animations/click-spark\n */\n@Component({\n selector: 'wr-click-spark',\n templateUrl: './click-spark.html',\n styleUrl: './click-spark.scss',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-click-spark',\n '(click)': 'onClick($event)',\n },\n})\nexport class WrClickSpark {\n /**\n * Spark line colour. Accepts any CSS colour, or a `var(--wr-…)` token which is\n * resolved against the host so it tracks the theme. The default flips with the\n * theme — dark sparks in light mode, light sparks in dark.\n * @default 'var(--wr-color-dark)'\n */\n readonly sparkColor = input('var(--wr-color-dark)');\n\n /** Length of each spark line in pixels (at t=0; tapers to 0 at t=1). @default 10 */\n readonly sparkSize = input(10, { transform: numAttr(10) });\n\n /** Distance each spark travels from origin in pixels. @default 15 */\n readonly sparkRadius = input(15, { transform: numAttr(15) });\n\n /** Number of sparks per click (evenly distributed around the circle). @default 8 */\n readonly sparkCount = input(8, { transform: numAttr(8) });\n\n /** Animation duration in ms. @default 400 */\n readonly duration = input(400, { transform: numAttr(400) });\n\n /** Easing function applied to the travel distance. @default 'ease-out' */\n readonly easing = input<WrClickSparkEasing>('ease-out');\n\n /** Multiplier on the travel distance — bumps the radius without changing `sparkRadius`. @default 1 */\n readonly extraScale = input(1, { transform: numAttr(1) });\n\n private readonly canvasRef = viewChild.required<ElementRef<HTMLCanvasElement>>('canvas');\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly destroyRef = inject(DestroyRef);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly platform = inject(WrPlatform);\n\n private sparks: Spark[] = [];\n\n constructor() {\n if (!this.isBrowser) return;\n afterNextRender(() => {\n this.syncCanvasSize();\n this.watchResize();\n this.startLoop();\n });\n }\n\n protected onClick(event: MouseEvent): void {\n // Reduced motion: no spark bursts — same policy as wr-confetti.\n if (this.platform.prefersReducedMotion()) return;\n const canvas = this.canvasRef().nativeElement;\n const rect = canvas.getBoundingClientRect();\n const x = event.clientX - rect.left;\n const y = event.clientY - rect.top;\n const now = performance.now();\n const count = this.sparkCount();\n for (let i = 0; i < count; i++) {\n this.sparks.push({ x, y, angle: (2 * Math.PI * i) / count, startTime: now });\n }\n }\n\n // Internals\n\n /**\n * Canvas `strokeStyle` can't read CSS custom properties, so a `var(--wr-…)`\n * token is resolved against the host's computed style here. Plain colours\n * pass through untouched. Falls back to a dark literal if the custom\n * property resolves to nothing.\n */\n private resolveColor(): string {\n const color = this.sparkColor();\n const match = /^var\\((--[\\w-]+)\\)$/.exec(color.trim());\n if (!match) return color;\n const resolved = getComputedStyle(this.host.nativeElement).getPropertyValue(match[1]).trim();\n return resolved || '#0f172a';\n }\n\n private syncCanvasSize(): void {\n const canvas = this.canvasRef().nativeElement;\n const host = this.host.nativeElement;\n const { width, height } = host.getBoundingClientRect();\n if (canvas.width !== Math.round(width)) canvas.width = Math.round(width);\n if (canvas.height !== Math.round(height)) canvas.height = Math.round(height);\n }\n\n private watchResize(): void {\n if (typeof ResizeObserver === 'undefined') return;\n let resizeTimer: ReturnType<typeof setTimeout> | undefined;\n const ro = new ResizeObserver(() => {\n clearTimeout(resizeTimer);\n resizeTimer = setTimeout(() => this.syncCanvasSize(), 100);\n });\n ro.observe(this.host.nativeElement);\n this.destroyRef.onDestroy(() => {\n ro.disconnect();\n clearTimeout(resizeTimer);\n });\n }\n\n private startLoop(): void {\n const canvas = this.canvasRef().nativeElement;\n const ctx = canvas.getContext('2d');\n if (!ctx) return;\n\n let raf = 0;\n\n const draw = (ts: number): void => {\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n const ease = EASINGS[this.easing()];\n const duration = this.duration();\n const sparkRadius = this.sparkRadius();\n const sparkSize = this.sparkSize();\n const extraScale = this.extraScale();\n const color = this.resolveColor();\n\n this.sparks = this.sparks.filter(spark => {\n const elapsed = ts - spark.startTime;\n if (elapsed >= duration) return false;\n const progress = elapsed / duration;\n const eased = ease(progress);\n const distance = eased * sparkRadius * extraScale;\n const lineLength = sparkSize * (1 - eased);\n\n const x1 = spark.x + distance * Math.cos(spark.angle);\n const y1 = spark.y + distance * Math.sin(spark.angle);\n const x2 = spark.x + (distance + lineLength) * Math.cos(spark.angle);\n const y2 = spark.y + (distance + lineLength) * Math.sin(spark.angle);\n\n ctx.strokeStyle = color;\n ctx.lineWidth = 2;\n ctx.beginPath();\n ctx.moveTo(x1, y1);\n ctx.lineTo(x2, y2);\n ctx.stroke();\n return true;\n });\n\n raf = requestAnimationFrame(draw);\n };\n\n raf = requestAnimationFrame(draw);\n this.destroyRef.onDestroy(() => cancelAnimationFrame(raf));\n }\n}\n\nexport type { WrClickSparkEasing } from './interfaces';\n","<canvas #canvas class=\"wr-click-spark__canvas\"></canvas>\n<ng-content />\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;AAQG;AA2BH,MAAM,OAAO,GAAgE;AAC3E,IAAA,MAAM,EAAE,CAAC,IAAI,CAAC;AACd,IAAA,SAAS,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC;AACrB,IAAA,aAAa,EAAE,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChE,UAAU,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;C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EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FDkEa,YAAY,EAAA,UAAA,EAAA,CAAA;kBAVxB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,gBAAgB,EAAA,aAAA,EAGX,iBAAiB,CAAC,IAAI,EAAA,IAAA,EAC/B;AACJ,wBAAA,KAAK,EAAE,gBAAgB;AACvB,wBAAA,SAAS,EAAE,iBAAiB;AAC7B,qBAAA,EAAA,QAAA,EAAA,8EAAA,EAAA,MAAA,EAAA,CAAA,qMAAA,CAAA,EAAA;ixBA6B8E,QAAQ,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE/FzF;;AAEG;;;;"}
@@ -77,11 +77,31 @@ class WrClipboard {
77
77
  return null;
78
78
  }
79
79
  }
80
- /** Probe the Permissions API for `clipboard-read` / `clipboard-write`. */
80
+ /**
81
+ * Report whether clipboard read / write is available and, when the
82
+ * browser exposes it, what the user has granted.
83
+ *
84
+ * The answer is grounded in the actual Clipboard API capability
85
+ * (`writeText` / `readText`), then refined by the Permissions API when
86
+ * it can speak for the requested name. `clipboard-read` / `clipboard-write`
87
+ * are not recognised everywhere — Firefox and Safari throw on the query —
88
+ * so a missing or throwing Permissions API is treated as "supported,
89
+ * will resolve at use time" (`'prompt'`), not `'unsupported'`. We only
90
+ * return `'unsupported'` when the capability genuinely isn't there.
91
+ */
81
92
  async permission(name) {
82
93
  const view = this.doc.defaultView;
83
- if (!view?.navigator?.permissions?.query)
94
+ if (!view)
84
95
  return 'unsupported';
96
+ const clipboard = view.navigator?.clipboard;
97
+ const capable = name === 'write'
98
+ ? typeof clipboard?.writeText === 'function' || typeof this.doc.execCommand === 'function'
99
+ : typeof clipboard?.readText === 'function';
100
+ if (!capable)
101
+ return 'unsupported';
102
+ // Capability exists; ask the Permissions API to refine the state when it can.
103
+ if (typeof view.navigator?.permissions?.query !== 'function')
104
+ return 'prompt';
85
105
  try {
86
106
  const status = await view.navigator.permissions.query({
87
107
  name: `clipboard-${name}`,
@@ -89,7 +109,8 @@ class WrClipboard {
89
109
  return status.state;
90
110
  }
91
111
  catch {
92
- return 'unsupported';
112
+ // Name not recognised by this browser — capability is still present.
113
+ return 'prompt';
93
114
  }
94
115
  }
95
116
  // Internals
@@ -115,10 +136,10 @@ class WrClipboard {
115
136
  this.doc.body.removeChild(node);
116
137
  }
117
138
  }
118
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrClipboard, deps: [], target: i0.ɵɵFactoryTarget.Service });
119
- static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.0.2", ngImport: i0, type: WrClipboard });
139
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: WrClipboard, deps: [], target: i0.ɵɵFactoryTarget.Service });
140
+ static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.0.4", ngImport: i0, type: WrClipboard });
120
141
  }
121
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrClipboard, decorators: [{
142
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: WrClipboard, decorators: [{
122
143
  type: Service
123
144
  }] });
124
145
 
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-clipboard.mjs","sources":["../../../projects/lib/clipboard/clipboard.ts","../../../projects/lib/clipboard/ngwr-clipboard.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 { DOCUMENT } from '@angular/common';\nimport { Service, inject } from '@angular/core';\n\nimport type { WrClipboardPermission } from './interfaces';\n\n/**\n * Programmatic clipboard read / write.\n *\n * - **Write** uses `navigator.clipboard.writeText` with a hidden\n * `<textarea>` + `execCommand('copy')` fallback for non-secure contexts.\n * - **Read** uses `navigator.clipboard.readText` (no fallback — older\n * browsers expose no equivalent).\n * - **Available** / **permission** check what the current browser allows\n * so UI can disable the action when it would silently no-op.\n *\n * SSR-safe: every method short-circuits when there's no `document.defaultView`.\n *\n * @example\n * ```ts\n * const clip = inject(WrClipboard);\n *\n * await clip.write('Hello'); // resolves to true on success\n * const text = await clip.read(); // string | null\n * clip.available(); // boolean\n * await clip.permission('write'); // 'granted' | 'denied' | 'prompt' | 'unsupported'\n * ```\n *\n * @see https://ngwr.dev/services/clipboard\n */\n@Service()\nexport class WrClipboard {\n private readonly doc = inject(DOCUMENT);\n\n /** Is any clipboard write path available (async API or `execCommand`)? */\n available(): boolean {\n const view = this.doc.defaultView;\n if (!view) return false;\n if (view.navigator?.clipboard) return true;\n return typeof this.doc.execCommand === 'function';\n }\n\n /**\n * Write text. Resolves to `true` on success, `false` on failure (denied\n * permission, no clipboard, etc).\n */\n async write(text: string): Promise<boolean> {\n const view = this.doc.defaultView;\n if (!view) return false;\n\n try {\n if (view.navigator?.clipboard) {\n await view.navigator.clipboard.writeText(text);\n return true;\n }\n return this.legacyWrite(text);\n } catch {\n return this.legacyWrite(text);\n }\n }\n\n /**\n * Read text from the clipboard. Returns `null` when unsupported or\n * when the user denied the permission prompt.\n */\n async read(): Promise<string | null> {\n const view = this.doc.defaultView;\n if (!view?.navigator?.clipboard?.readText) return null;\n try {\n return await view.navigator.clipboard.readText();\n } catch {\n return null;\n }\n }\n\n /** Probe the Permissions API for `clipboard-read` / `clipboard-write`. */\n async permission(name: 'read' | 'write'): Promise<WrClipboardPermission> {\n const view = this.doc.defaultView;\n if (!view?.navigator?.permissions?.query) return 'unsupported';\n try {\n const status = await view.navigator.permissions.query({\n name: `clipboard-${name}` as PermissionName,\n });\n return status.state;\n } catch {\n return 'unsupported';\n }\n }\n\n // Internals\n\n /** Hidden-textarea + `execCommand('copy')` write. Synchronous, no permissions. */\n private legacyWrite(text: string): boolean {\n const node = this.doc.createElement('textarea');\n node.value = text;\n node.setAttribute('readonly', '');\n node.style.position = 'fixed';\n node.style.top = '0';\n node.style.left = '0';\n node.style.opacity = '0';\n node.style.pointerEvents = 'none';\n this.doc.body.appendChild(node);\n node.select();\n try {\n return this.doc.execCommand('copy');\n } catch {\n return false;\n } finally {\n this.doc.body.removeChild(node);\n }\n }\n}\n\nexport type { WrClipboardPermission } from './interfaces';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAAA;;;;;AAKG;AAOH;;;;;;;;;;;;;;;;;;;;;;;AAuBG;MAEU,WAAW,CAAA;AACL,IAAA,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC;;IAGvC,SAAS,GAAA;AACP,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW;AACjC,QAAA,IAAI,CAAC,IAAI;AAAE,YAAA,OAAO,KAAK;AACvB,QAAA,IAAI,IAAI,CAAC,SAAS,EAAE,SAAS;AAAE,YAAA,OAAO,IAAI;QAC1C,OAAO,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,KAAK,UAAU;IACnD;AAEA;;;AAGG;IACH,MAAM,KAAK,CAAC,IAAY,EAAA;AACtB,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW;AACjC,QAAA,IAAI,CAAC,IAAI;AAAE,YAAA,OAAO,KAAK;AAEvB,QAAA,IAAI;AACF,YAAA,IAAI,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE;gBAC7B,MAAM,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC;AAC9C,gBAAA,OAAO,IAAI;YACb;AACA,YAAA,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAC/B;AAAE,QAAA,MAAM;AACN,YAAA,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAC/B;IACF;AAEA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AAC,KAAK,CAAC,aAAa,GAAG,MAAM;QACjC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAC/B,IAAI,CAAC,MAAM,EAAE;AACb,QAAA,IAAI;YACF,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC;QACrC;AAAE,QAAA,MAAM;AACN,YAAA,OAAO,KAAK;QACd;gBAAU;YACR,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QACjC;IACF;uGA/EW,WAAW,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,OAAA,EAAA,CAAA;wGAAX,WAAW,EAAA,CAAA;;2FAAX,WAAW,EAAA,UAAA,EAAA,CAAA;kBADvB;;;ACpCD;;AAEG;;;;"}
1
+ {"version":3,"file":"ngwr-clipboard.mjs","sources":["../../../projects/lib/clipboard/clipboard.ts","../../../projects/lib/clipboard/ngwr-clipboard.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 { DOCUMENT } from '@angular/common';\nimport { Service, inject } from '@angular/core';\n\nimport type { WrClipboardPermission } from './interfaces';\n\n/**\n * Programmatic clipboard read / write.\n *\n * - **Write** uses `navigator.clipboard.writeText` with a hidden\n * `<textarea>` + `execCommand('copy')` fallback for non-secure contexts.\n * - **Read** uses `navigator.clipboard.readText` (no fallback — older\n * browsers expose no equivalent).\n * - **Available** / **permission** check what the current browser allows\n * so UI can disable the action when it would silently no-op.\n *\n * SSR-safe: every method short-circuits when there's no `document.defaultView`.\n *\n * @example\n * ```ts\n * const clip = inject(WrClipboard);\n *\n * await clip.write('Hello'); // resolves to true on success\n * const text = await clip.read(); // string | null\n * clip.available(); // boolean\n * await clip.permission('write'); // 'granted' | 'denied' | 'prompt' | 'unsupported'\n * ```\n *\n * @see https://ngwr.dev/services/clipboard\n */\n@Service()\nexport class WrClipboard {\n private readonly doc = inject(DOCUMENT);\n\n /** Is any clipboard write path available (async API or `execCommand`)? */\n available(): boolean {\n const view = this.doc.defaultView;\n if (!view) return false;\n if (view.navigator?.clipboard) return true;\n return typeof this.doc.execCommand === 'function';\n }\n\n /**\n * Write text. Resolves to `true` on success, `false` on failure (denied\n * permission, no clipboard, etc).\n */\n async write(text: string): Promise<boolean> {\n const view = this.doc.defaultView;\n if (!view) return false;\n\n try {\n if (view.navigator?.clipboard) {\n await view.navigator.clipboard.writeText(text);\n return true;\n }\n return this.legacyWrite(text);\n } catch {\n return this.legacyWrite(text);\n }\n }\n\n /**\n * Read text from the clipboard. Returns `null` when unsupported or\n * when the user denied the permission prompt.\n */\n async read(): Promise<string | null> {\n const view = this.doc.defaultView;\n if (!view?.navigator?.clipboard?.readText) return null;\n try {\n return await view.navigator.clipboard.readText();\n } catch {\n return null;\n }\n }\n\n /**\n * Report whether clipboard read / write is available and, when the\n * browser exposes it, what the user has granted.\n *\n * The answer is grounded in the actual Clipboard API capability\n * (`writeText` / `readText`), then refined by the Permissions API when\n * it can speak for the requested name. `clipboard-read` / `clipboard-write`\n * are not recognised everywhere — Firefox and Safari throw on the query —\n * so a missing or throwing Permissions API is treated as \"supported,\n * will resolve at use time\" (`'prompt'`), not `'unsupported'`. We only\n * return `'unsupported'` when the capability genuinely isn't there.\n */\n async permission(name: 'read' | 'write'): Promise<WrClipboardPermission> {\n const view = this.doc.defaultView;\n if (!view) return 'unsupported';\n\n const clipboard = view.navigator?.clipboard;\n const capable =\n name === 'write'\n ? typeof clipboard?.writeText === 'function' || typeof this.doc.execCommand === 'function'\n : typeof clipboard?.readText === 'function';\n if (!capable) return 'unsupported';\n\n // Capability exists; ask the Permissions API to refine the state when it can.\n if (typeof view.navigator?.permissions?.query !== 'function') return 'prompt';\n try {\n const status = await view.navigator.permissions.query({\n name: `clipboard-${name}` as PermissionName,\n });\n return status.state;\n } catch {\n // Name not recognised by this browser — capability is still present.\n return 'prompt';\n }\n }\n\n // Internals\n\n /** Hidden-textarea + `execCommand('copy')` write. Synchronous, no permissions. */\n private legacyWrite(text: string): boolean {\n const node = this.doc.createElement('textarea');\n node.value = text;\n node.setAttribute('readonly', '');\n node.style.position = 'fixed';\n node.style.top = '0';\n node.style.left = '0';\n node.style.opacity = '0';\n node.style.pointerEvents = 'none';\n this.doc.body.appendChild(node);\n node.select();\n try {\n return this.doc.execCommand('copy');\n } catch {\n return false;\n } finally {\n this.doc.body.removeChild(node);\n }\n }\n}\n\nexport type { WrClipboardPermission } from './interfaces';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAAA;;;;;AAKG;AAOH;;;;;;;;;;;;;;;;;;;;;;;AAuBG;MAEU,WAAW,CAAA;AACL,IAAA,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC;;IAGvC,SAAS,GAAA;AACP,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW;AACjC,QAAA,IAAI,CAAC,IAAI;AAAE,YAAA,OAAO,KAAK;AACvB,QAAA,IAAI,IAAI,CAAC,SAAS,EAAE,SAAS;AAAE,YAAA,OAAO,IAAI;QAC1C,OAAO,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,KAAK,UAAU;IACnD;AAEA;;;AAGG;IACH,MAAM,KAAK,CAAC,IAAY,EAAA;AACtB,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW;AACjC,QAAA,IAAI,CAAC,IAAI;AAAE,YAAA,OAAO,KAAK;AAEvB,QAAA,IAAI;AACF,YAAA,IAAI,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE;gBAC7B,MAAM,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC;AAC9C,gBAAA,OAAO,IAAI;YACb;AACA,YAAA,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CA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AAEN,YAAA,OAAO,QAAQ;QACjB;IACF;;;AAKQ,IAAA,WAAW,CAAC,IAAY,EAAA;QAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,UAAU,CAAC;AAC/C,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI;AACjB,QAAA,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,EAAE,CAAC;AACjC,QAAA,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO;AAC7B,QAAA,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG;AACpB,QAAA,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG;AACrB,QAAA,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,GAAG;AACxB,QAAA,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,MAAM;QACjC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAC/B,IAAI,CAAC,MAAM,EAAE;AACb,QAAA,IAAI;YACF,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC;QACrC;AAAE,QAAA,MAAM;AACN,YAAA,OAAO,KAAK;QACd;gBAAU;YACR,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QACjC;IACF;uGArGW,WAAW,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,OAAA,EAAA,CAAA;wGAAX,WAAW,EAAA,CAAA;;2FAAX,WAAW,EAAA,UAAA,EAAA,CAAA;kBADvB;;;ACpCD;;AAEG;;;;"}
@@ -94,10 +94,10 @@ class WrCollapse {
94
94
  return;
95
95
  this.open.update(v => !v);
96
96
  }
97
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrCollapse, deps: [], target: i0.ɵɵFactoryTarget.Component });
98
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: WrCollapse, isStandalone: true, selector: "wr-collapse", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange" }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: "<button\n type=\"button\"\n class=\"wr-collapse__header\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"bodyId\"\n [disabled]=\"disabled()\"\n (click)=\"toggle()\"\n>\n <span class=\"wr-collapse__title\">{{ title() }}</span>\n <svg\n class=\"wr-icon__svg wr-collapse__chevron\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n</button>\n\n<div\n class=\"wr-collapse__body\"\n [attr.id]=\"bodyId\"\n [class.wr-collapse__body--open]=\"open()\"\n [attr.aria-hidden]=\"!open()\"\n [attr.inert]=\"!open() ? '' : null\"\n>\n <div class=\"wr-collapse__content\">\n <div class=\"wr-collapse__inner\">\n <ng-content />\n </div>\n </div>\n</div>\n", encapsulation: i0.ViewEncapsulation.None });
97
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: WrCollapse, deps: [], target: i0.ɵɵFactoryTarget.Component });
98
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.4", type: WrCollapse, isStandalone: true, selector: "wr-collapse", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange" }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: "<button\n type=\"button\"\n class=\"wr-collapse__header\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"bodyId\"\n [disabled]=\"disabled()\"\n (click)=\"toggle()\"\n>\n <span class=\"wr-collapse__title\">{{ title() }}</span>\n <svg\n class=\"wr-icon__svg wr-collapse__chevron\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n</button>\n\n<div\n class=\"wr-collapse__body\"\n [attr.id]=\"bodyId\"\n [class.wr-collapse__body--open]=\"open()\"\n [attr.aria-hidden]=\"!open()\"\n [attr.inert]=\"!open() ? '' : null\"\n>\n <div class=\"wr-collapse__content\">\n <div class=\"wr-collapse__inner\">\n <ng-content />\n </div>\n </div>\n</div>\n", encapsulation: i0.ViewEncapsulation.None });
99
99
  }
100
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrCollapse, decorators: [{
100
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: WrCollapse, decorators: [{
101
101
  type: Component,
102
102
  args: [{ selector: 'wr-collapse', encapsulation: ViewEncapsulation.None, host: { '[class]': 'classes()' }, template: "<button\n type=\"button\"\n class=\"wr-collapse__header\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"bodyId\"\n [disabled]=\"disabled()\"\n (click)=\"toggle()\"\n>\n <span class=\"wr-collapse__title\">{{ title() }}</span>\n <svg\n class=\"wr-icon__svg wr-collapse__chevron\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n</button>\n\n<div\n class=\"wr-collapse__body\"\n [attr.id]=\"bodyId\"\n [class.wr-collapse__body--open]=\"open()\"\n [attr.aria-hidden]=\"!open()\"\n [attr.inert]=\"!open() ? '' : null\"\n>\n <div class=\"wr-collapse__content\">\n <div class=\"wr-collapse__inner\">\n <ng-content />\n </div>\n </div>\n</div>\n" }]
103
103
  }], ctorParameters: () => [], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: true }] }], open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
@@ -132,8 +132,8 @@ class WrCollapseGroup {
132
132
  member.close();
133
133
  }
134
134
  }
135
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrCollapseGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
136
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: WrCollapseGroup, isStandalone: true, selector: "wr-collapse-group", inputs: { accordion: { classPropertyName: "accordion", publicName: "accordion", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "wr-collapse-group" }, providers: [
135
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: WrCollapseGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
136
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.4", type: WrCollapseGroup, isStandalone: true, selector: "wr-collapse-group", inputs: { accordion: { classPropertyName: "accordion", publicName: "accordion", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "wr-collapse-group" }, providers: [
137
137
  {
138
138
  provide: WR_COLLAPSE_GROUP,
139
139
  // eslint-disable-next-line @angular-eslint/no-forward-ref
@@ -141,7 +141,7 @@ class WrCollapseGroup {
141
141
  },
142
142
  ], ngImport: i0, template: '<ng-content />', isInline: true, encapsulation: i0.ViewEncapsulation.None });
143
143
  }
144
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrCollapseGroup, decorators: [{
144
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: WrCollapseGroup, decorators: [{
145
145
  type: Component,
146
146
  args: [{
147
147
  selector: 'wr-collapse-group',
@@ -198,8 +198,8 @@ class WrAccordion {
198
198
  member.close();
199
199
  }
200
200
  }
201
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrAccordion, deps: [], target: i0.ɵɵFactoryTarget.Component });
202
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.2", type: WrAccordion, isStandalone: true, selector: "wr-accordion", host: { classAttribute: "wr-collapse-group wr-collapse-group--accordion" }, providers: [
201
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: WrAccordion, deps: [], target: i0.ɵɵFactoryTarget.Component });
202
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.4", type: WrAccordion, isStandalone: true, selector: "wr-accordion", host: { classAttribute: "wr-collapse-group wr-collapse-group--accordion" }, providers: [
203
203
  {
204
204
  provide: WR_COLLAPSE_GROUP,
205
205
  // eslint-disable-next-line @angular-eslint/no-forward-ref
@@ -207,7 +207,7 @@ class WrAccordion {
207
207
  },
208
208
  ], ngImport: i0, template: '<ng-content />', isInline: true, encapsulation: i0.ViewEncapsulation.None });
209
209
  }
210
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrAccordion, decorators: [{
210
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: WrAccordion, decorators: [{
211
211
  type: Component,
212
212
  args: [{
213
213
  selector: 'wr-accordion',
@@ -468,17 +468,17 @@ class WrColorPicker {
468
468
  this.a.set(hsv.a);
469
469
  this.emit();
470
470
  }
471
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrColorPicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
472
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: WrColorPicker, isStandalone: true, selector: "wr-color-picker", inputs: { alpha: { classPropertyName: "alpha", publicName: "alpha", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, swatches: { classPropertyName: "swatches", publicName: "swatches", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "style.--wr-color-picker-hue": "hueCss()", "style.--wr-color-picker-rgb": "rgbCss()" } }, providers: [
471
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: WrColorPicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
472
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.4", type: WrColorPicker, isStandalone: true, selector: "wr-color-picker", inputs: { alpha: { classPropertyName: "alpha", publicName: "alpha", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, swatches: { classPropertyName: "swatches", publicName: "swatches", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "style.--wr-color-picker-hue": "hueCss()", "style.--wr-color-picker-rgb": "rgbCss()" } }, providers: [
473
473
  {
474
474
  provide: NG_VALUE_ACCESSOR,
475
475
  // eslint-disable-next-line @angular-eslint/no-forward-ref
476
476
  useExisting: forwardRef(() => WrColorPicker),
477
477
  multi: true,
478
478
  },
479
- ], ngImport: i0, template: "<div class=\"wr-color-picker__sv\" (pointerdown)=\"onPointerDown($event, 'sv')\">\n <span class=\"wr-color-picker__thumb\" [style.left.%]=\"svThumbX()\" [style.top.%]=\"svThumbY()\"></span>\n</div>\n\n<div class=\"wr-color-picker__slider wr-color-picker__slider--hue\" (pointerdown)=\"onPointerDown($event, 'hue')\">\n <span class=\"wr-color-picker__thumb wr-color-picker__thumb--slider\" [style.left.%]=\"hueThumbX()\"></span>\n</div>\n\n@if (alpha()) {\n <div class=\"wr-color-picker__slider wr-color-picker__slider--alpha\" (pointerdown)=\"onPointerDown($event, 'alpha')\">\n <span class=\"wr-color-picker__thumb wr-color-picker__thumb--slider\" [style.left.%]=\"alphaThumbX()\"></span>\n </div>\n}\n\n<div class=\"wr-color-picker__chrome\">\n <span class=\"wr-color-picker__preview\" [style.background]=\"hex()\"></span>\n <wr-segmented\n class=\"wr-color-picker__tabs\"\n [options]=\"tabOptions\"\n [value]=\"activeTab()\"\n (valueChange)=\"onTabChange($event)\"\n />\n</div>\n\n@switch (activeTab()) {\n @case ('hex') {\n <div class=\"wr-color-picker__inputs wr-color-picker__inputs--hex\">\n <label class=\"wr-color-picker__field wr-color-picker__field--wide\">\n <input\n type=\"text\"\n spellcheck=\"false\"\n autocomplete=\"off\"\n [value]=\"hexInput()\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onHexInput($event)\"\n (blur)=\"onHexBlur()\"\n />\n <span class=\"wr-color-picker__field-label\">HEX</span>\n </label>\n </div>\n }\n @case ('rgb') {\n <div class=\"wr-color-picker__inputs\">\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"255\"\n [value]=\"rgb().r\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onRgbChannel('r', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">R</span>\n </label>\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"255\"\n [value]=\"rgb().g\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onRgbChannel('g', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">G</span>\n </label>\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"255\"\n [value]=\"rgb().b\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onRgbChannel('b', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">B</span>\n </label>\n @if (alpha()) {\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"100\"\n [value]=\"alphaPercent()\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onAlphaPercent($event)\"\n />\n <span class=\"wr-color-picker__field-label\">A%</span>\n </label>\n }\n </div>\n }\n @case ('hsl') {\n <div class=\"wr-color-picker__inputs\">\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"360\"\n [value]=\"hslView().h | number: '1.0-0'\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onHslChannel('h', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">H</span>\n </label>\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"100\"\n [value]=\"hslView().s * 100 | number: '1.0-0'\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onHslChannel('s', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">S%</span>\n </label>\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"100\"\n [value]=\"hslView().l * 100 | number: '1.0-0'\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onHslChannel('l', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">L%</span>\n </label>\n @if (alpha()) {\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"100\"\n [value]=\"alphaPercent()\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onAlphaPercent($event)\"\n />\n <span class=\"wr-color-picker__field-label\">A%</span>\n </label>\n }\n </div>\n }\n}\n\n@if (swatches().length > 0) {\n <div class=\"wr-color-picker__swatches\">\n @for (color of swatches(); track color) {\n <button\n type=\"button\"\n class=\"wr-color-picker__swatch\"\n [style.background]=\"color\"\n [attr.aria-label]=\"color\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onSwatchClick(color)\"\n ></button>\n }\n </div>\n}\n", dependencies: [{ kind: "component", type: WrSegmented, selector: "wr-segmented", inputs: ["options", "value", "disabled"], outputs: ["valueChange"] }, { kind: "pipe", type: DecimalPipe, name: "number" }], encapsulation: i0.ViewEncapsulation.None });
479
+ ], ngImport: i0, template: "<div class=\"wr-color-picker__sv\" (pointerdown)=\"onPointerDown($event, 'sv')\">\n <span class=\"wr-color-picker__thumb\" [style.left.%]=\"svThumbX()\" [style.top.%]=\"svThumbY()\"></span>\n</div>\n\n<div class=\"wr-color-picker__slider wr-color-picker__slider--hue\" (pointerdown)=\"onPointerDown($event, 'hue')\">\n <span class=\"wr-color-picker__thumb wr-color-picker__thumb--slider\" [style.left.%]=\"hueThumbX()\"></span>\n</div>\n\n@if (alpha()) {\n <div class=\"wr-color-picker__slider wr-color-picker__slider--alpha\" (pointerdown)=\"onPointerDown($event, 'alpha')\">\n <span class=\"wr-color-picker__thumb wr-color-picker__thumb--slider\" [style.left.%]=\"alphaThumbX()\"></span>\n </div>\n}\n\n<div class=\"wr-color-picker__chrome\">\n <span class=\"wr-color-picker__preview\" [style.background]=\"hex()\"></span>\n <wr-segmented\n class=\"wr-color-picker__tabs\"\n [options]=\"tabOptions\"\n [value]=\"activeTab()\"\n (valueChange)=\"onTabChange($event)\"\n />\n</div>\n\n@switch (activeTab()) {\n @case ('hex') {\n <div class=\"wr-color-picker__inputs wr-color-picker__inputs--hex\">\n <label class=\"wr-color-picker__field wr-color-picker__field--wide\">\n <input\n type=\"text\"\n spellcheck=\"false\"\n autocomplete=\"off\"\n [value]=\"hexInput()\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onHexInput($event)\"\n (blur)=\"onHexBlur()\"\n />\n <span class=\"wr-color-picker__field-label\">HEX</span>\n </label>\n </div>\n }\n @case ('rgb') {\n <div class=\"wr-color-picker__inputs\">\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"255\"\n [value]=\"rgb().r\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onRgbChannel('r', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">R</span>\n </label>\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"255\"\n [value]=\"rgb().g\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onRgbChannel('g', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">G</span>\n </label>\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"255\"\n [value]=\"rgb().b\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onRgbChannel('b', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">B</span>\n </label>\n @if (alpha()) {\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"100\"\n [value]=\"alphaPercent()\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onAlphaPercent($event)\"\n />\n <span class=\"wr-color-picker__field-label\">A%</span>\n </label>\n }\n </div>\n }\n @case ('hsl') {\n <div class=\"wr-color-picker__inputs\">\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"360\"\n [value]=\"hslView().h | number: '1.0-0'\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onHslChannel('h', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">H</span>\n </label>\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"100\"\n [value]=\"hslView().s * 100 | number: '1.0-0'\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onHslChannel('s', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">S%</span>\n </label>\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"100\"\n [value]=\"hslView().l * 100 | number: '1.0-0'\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onHslChannel('l', $event)\"\n />\n <span class=\"wr-color-picker__field-label\">L%</span>\n </label>\n @if (alpha()) {\n <label class=\"wr-color-picker__field\">\n <input\n type=\"number\"\n min=\"0\"\n max=\"100\"\n [value]=\"alphaPercent()\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onAlphaPercent($event)\"\n />\n <span class=\"wr-color-picker__field-label\">A%</span>\n </label>\n }\n </div>\n }\n}\n\n@if (swatches().length > 0) {\n <div class=\"wr-color-picker__swatches\">\n @for (color of swatches(); track color) {\n <button\n type=\"button\"\n class=\"wr-color-picker__swatch\"\n [style.background]=\"color\"\n [attr.aria-label]=\"color\"\n [disabled]=\"effectiveDisabled()\"\n (click)=\"onSwatchClick(color)\"\n ></button>\n }\n </div>\n}\n", dependencies: [{ kind: "component", type: WrSegmented, selector: "wr-segmented", inputs: ["options", "value", "disabled", "size"], outputs: ["valueChange"] }, { kind: "pipe", type: DecimalPipe, name: "number" }], encapsulation: i0.ViewEncapsulation.None });
480
480
  }
481
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrColorPicker, decorators: [{
481
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: WrColorPicker, decorators: [{
482
482
  type: Component,
483
483
  args: [{ selector: 'wr-color-picker', encapsulation: ViewEncapsulation.None, host: {
484
484
  '[class]': 'classes()',
@@ -627,10 +627,10 @@ class WrColorPickerTrigger {
627
627
  this.overlayRef = null;
628
628
  }
629
629
  }
630
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrColorPickerTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
631
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.2", type: WrColorPickerTrigger, isStandalone: true, selector: "[wrColorPickerTrigger]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, alpha: { classPropertyName: "alpha", publicName: "alpha", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, swatches: { classPropertyName: "swatches", publicName: "swatches", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", opened: "opened", closed: "closed" }, host: { listeners: { "click": "toggle()" } }, ngImport: i0 });
630
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: WrColorPickerTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
631
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.4", type: WrColorPickerTrigger, isStandalone: true, selector: "[wrColorPickerTrigger]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, alpha: { classPropertyName: "alpha", publicName: "alpha", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, swatches: { classPropertyName: "swatches", publicName: "swatches", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", opened: "opened", closed: "closed" }, host: { listeners: { "click": "toggle()" } }, ngImport: i0 });
632
632
  }
633
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrColorPickerTrigger, decorators: [{
633
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: WrColorPickerTrigger, decorators: [{
634
634
  type: Directive,
635
635
  args: [{
636
636
  selector: '[wrColorPickerTrigger]',