@rxap/directives 19.2.0 → 21.0.1-dev.1

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 (137) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/compodoc/changelog.html +34 -0
  3. package/compodoc/dependencies.html +7 -7
  4. package/compodoc/directives/AvatarBackgroundImageDirective.html +216 -386
  5. package/compodoc/directives/BackgroundImageDirective.html +230 -243
  6. package/compodoc/directives/ConfirmClick.html +466 -0
  7. package/compodoc/directives/ContenteditableDirective.html +137 -373
  8. package/compodoc/directives/FullWidthDirective.html +8 -139
  9. package/compodoc/directives/IfTruthyDirective.html +136 -182
  10. package/compodoc/directives/IsDevModeDirective.html +4 -74
  11. package/compodoc/directives/MethodDirective.html +272 -346
  12. package/compodoc/directives/MethodTemplateDirective.html +736 -697
  13. package/compodoc/directives/MovableDividerDirective.html +103 -243
  14. package/compodoc/directives/PreventDefaultDirective.html +6 -65
  15. package/compodoc/directives/ShareButtonDirective.html +14 -62
  16. package/compodoc/directives/StopImmediatePropagationDirective.html +6 -65
  17. package/compodoc/directives/StopPropagationDirective.html +6 -65
  18. package/compodoc/injectables/ShareService.html +6 -5
  19. package/compodoc/interfaces/ContenteditableEvent.html +25 -32
  20. package/compodoc/interfaces/IfTruthyDirectiveTemplateContext.html +22 -36
  21. package/compodoc/interfaces/MethodTemplateDirectiveContext.html +42 -66
  22. package/compodoc/interfaces/MethodTemplateDirectiveErrorContext.html +42 -66
  23. package/compodoc/interfaces/ShareData.html +3 -2
  24. package/compodoc/js/menu-wc.js +3 -3
  25. package/compodoc/js/menu-wc_es5.js +1 -1
  26. package/compodoc/js/search/search_index.js +2 -2
  27. package/compodoc/overview.html +2 -2
  28. package/compodoc/properties.html +1 -1
  29. package/docs/documentation.json +2282 -2793
  30. package/docs/html/assets/hierarchy.js +1 -1
  31. package/docs/html/assets/search.js +1 -1
  32. package/docs/html/classes/AvatarBackgroundImageDirective.html +9 -16
  33. package/docs/html/classes/BackgroundImageDirective.html +8 -17
  34. package/docs/html/classes/ConfirmClick.html +3 -3
  35. package/docs/html/classes/ContenteditableDirective.html +8 -7
  36. package/docs/html/classes/FullWidthDirective.html +2 -3
  37. package/docs/html/classes/IfTruthyDirective.html +3 -9
  38. package/docs/html/classes/IsDevModeDirective.html +4 -4
  39. package/docs/html/classes/MethodDirective.html +8 -7
  40. package/docs/html/classes/MethodTemplateDirective.html +10 -15
  41. package/docs/html/classes/MovableDividerDirective.html +3 -13
  42. package/docs/html/classes/PreventDefaultDirective.html +2 -2
  43. package/docs/html/classes/ShareButtonDirective.html +2 -2
  44. package/docs/html/classes/ShareService.html +2 -2
  45. package/docs/html/classes/StopImmediatePropagationDirective.html +2 -2
  46. package/docs/html/classes/StopPropagationDirective.html +2 -2
  47. package/docs/html/enums/BackgroundPositionOptions.html +2 -2
  48. package/docs/html/enums/BackgroundRepeatOptions.html +2 -2
  49. package/docs/html/enums/BackgroundSizeOptions.html +2 -2
  50. package/docs/html/enums/GlobalStyleOptions.html +2 -2
  51. package/docs/html/hierarchy.html +1 -1
  52. package/docs/html/index.html +2 -2
  53. package/docs/html/interfaces/ContenteditableEvent.html +2 -2
  54. package/docs/html/interfaces/IfTruthyDirectiveTemplateContext.html +2 -2
  55. package/docs/html/interfaces/MethodTemplateDirectiveContext.html +2 -2
  56. package/docs/html/interfaces/MethodTemplateDirectiveErrorContext.html +2 -2
  57. package/docs/html/interfaces/ShareData.html +2 -2
  58. package/docs/html/modules.html +1 -1
  59. package/docs/html/types/BackgroundPosition.html +1 -1
  60. package/docs/html/types/BackgroundRepeat.html +1 -1
  61. package/docs/html/types/BackgroundSize.html +1 -1
  62. package/docs/markdown/README.md +1 -1
  63. package/docs/markdown/classes/AvatarBackgroundImageDirective.md +40 -103
  64. package/docs/markdown/classes/BackgroundImageDirective.md +24 -83
  65. package/docs/markdown/classes/ConfirmClick.md +8 -20
  66. package/docs/markdown/classes/ContenteditableDirective.md +21 -34
  67. package/docs/markdown/classes/FullWidthDirective.md +2 -10
  68. package/docs/markdown/classes/IfTruthyDirective.md +14 -71
  69. package/docs/markdown/classes/IsDevModeDirective.md +5 -17
  70. package/docs/markdown/classes/MethodDirective.md +40 -44
  71. package/docs/markdown/classes/MethodTemplateDirective.md +50 -86
  72. package/docs/markdown/classes/MovableDividerDirective.md +11 -71
  73. package/docs/markdown/classes/PreventDefaultDirective.md +3 -3
  74. package/docs/markdown/classes/ShareButtonDirective.md +9 -9
  75. package/docs/markdown/classes/ShareService.md +4 -4
  76. package/docs/markdown/classes/StopImmediatePropagationDirective.md +3 -3
  77. package/docs/markdown/classes/StopPropagationDirective.md +3 -3
  78. package/docs/markdown/enumerations/BackgroundPositionOptions.md +4 -4
  79. package/docs/markdown/enumerations/BackgroundRepeatOptions.md +3 -3
  80. package/docs/markdown/enumerations/BackgroundSizeOptions.md +5 -5
  81. package/docs/markdown/enumerations/GlobalStyleOptions.md +4 -4
  82. package/docs/markdown/globals.md +2 -2
  83. package/docs/markdown/interfaces/ContenteditableEvent.md +4 -4
  84. package/docs/markdown/interfaces/IfTruthyDirectiveTemplateContext.md +3 -3
  85. package/docs/markdown/interfaces/MethodTemplateDirectiveContext.md +3 -3
  86. package/docs/markdown/interfaces/MethodTemplateDirectiveErrorContext.md +4 -4
  87. package/docs/markdown/interfaces/ShareData.md +6 -6
  88. package/docs/markdown/type-aliases/BackgroundPosition.md +2 -2
  89. package/docs/markdown/type-aliases/BackgroundRepeat.md +2 -2
  90. package/docs/markdown/type-aliases/BackgroundSize.md +2 -2
  91. package/docs/wiki/Class.AvatarBackgroundImageDirective.md +39 -102
  92. package/docs/wiki/Class.BackgroundImageDirective.md +23 -82
  93. package/docs/wiki/Class.ConfirmClick.md +7 -19
  94. package/docs/wiki/Class.ContenteditableDirective.md +20 -33
  95. package/docs/wiki/Class.FullWidthDirective.md +1 -9
  96. package/docs/wiki/Class.IfTruthyDirective.md +13 -70
  97. package/docs/wiki/Class.IsDevModeDirective.md +4 -16
  98. package/docs/wiki/Class.MethodDirective.md +39 -43
  99. package/docs/wiki/Class.MethodTemplateDirective.md +49 -85
  100. package/docs/wiki/Class.MovableDividerDirective.md +10 -70
  101. package/docs/wiki/Class.PreventDefaultDirective.md +2 -2
  102. package/docs/wiki/Class.ShareButtonDirective.md +8 -8
  103. package/docs/wiki/Class.ShareService.md +3 -3
  104. package/docs/wiki/Class.StopImmediatePropagationDirective.md +2 -2
  105. package/docs/wiki/Class.StopPropagationDirective.md +2 -2
  106. package/docs/wiki/Enumeration.BackgroundPositionOptions.md +3 -3
  107. package/docs/wiki/Enumeration.BackgroundRepeatOptions.md +2 -2
  108. package/docs/wiki/Enumeration.BackgroundSizeOptions.md +4 -4
  109. package/docs/wiki/Enumeration.GlobalStyleOptions.md +3 -3
  110. package/docs/wiki/Interface.ContenteditableEvent.md +3 -3
  111. package/docs/wiki/Interface.IfTruthyDirectiveTemplateContext.md +2 -2
  112. package/docs/wiki/Interface.MethodTemplateDirectiveContext.md +2 -2
  113. package/docs/wiki/Interface.MethodTemplateDirectiveErrorContext.md +3 -3
  114. package/docs/wiki/Interface.ShareData.md +5 -5
  115. package/docs/wiki/TypeAlias.BackgroundPosition.md +1 -1
  116. package/docs/wiki/TypeAlias.BackgroundRepeat.md +1 -1
  117. package/docs/wiki/TypeAlias.BackgroundSize.md +1 -1
  118. package/docs/wiki/globals.md +1 -1
  119. package/fesm2022/rxap-directives.mjs +291 -392
  120. package/fesm2022/rxap-directives.mjs.map +1 -1
  121. package/package.json +22 -17
  122. package/types/rxap-directives.d.ts +272 -0
  123. package/index.d.ts +0 -14
  124. package/lib/avatar-background-image.directive.d.ts +0 -14
  125. package/lib/background-image.directive.d.ts +0 -42
  126. package/lib/confirm-click.d.ts +0 -10
  127. package/lib/contenteditable.directive.d.ts +0 -21
  128. package/lib/full-width.directive.d.ts +0 -6
  129. package/lib/if-truthy.directive.d.ts +0 -28
  130. package/lib/is-dev-mode.directive.d.ts +0 -12
  131. package/lib/method-template.directive.d.ts +0 -46
  132. package/lib/method.directive.d.ts +0 -29
  133. package/lib/movable-divider.directive.d.ts +0 -28
  134. package/lib/prevent-default.directive.d.ts +0 -6
  135. package/lib/share-button.directive.d.ts +0 -25
  136. package/lib/stop-immediate-propagation.directive.d.ts +0 -6
  137. package/lib/stop-propagation.directive.d.ts +0 -6
@@ -120,13 +120,6 @@
120
120
 
121
121
 
122
122
 
123
- <p class="comment">
124
- <h3>Implements</h3>
125
- </p>
126
- <p class="comment">
127
- <code>OnChanges</code>
128
- <code>OnInit</code>
129
- </p>
130
123
 
131
124
 
132
125
  <section data-compodoc="block-metadata">
@@ -154,29 +147,42 @@
154
147
  <h3 id="index">Index</h3>
155
148
  <table class="table table-sm table-bordered index-table">
156
149
  <tbody>
157
-
158
-
159
150
  <tr>
160
151
  <td class="col-md-4">
161
- <h6><b>Inputs</b></h6>
152
+ <h6><b>Properties</b></h6>
162
153
  </td>
163
154
  </tr>
164
155
  <tr>
165
156
  <td class="col-md-4">
166
157
  <ul class="index-list">
167
158
  <li>
159
+ <span class="modifier">Public</span>
160
+ <span class="modifier">Readonly</span>
161
+ <a href="#imageUrl" >imageUrl</a>
162
+ </li>
163
+ <li>
164
+ <span class="modifier">Protected</span>
165
+ <span class="modifier">Readonly</span>
166
+ <a href="#placeholder" >placeholder</a>
167
+ </li>
168
+ <li>
169
+ <span class="modifier">Public</span>
170
+ <span class="modifier">Readonly</span>
168
171
  <a href="#placeholderImageUrl" >placeholderImageUrl</a>
169
172
  </li>
170
173
  <li>
174
+ <span class="modifier">Public</span>
175
+ <span class="modifier">Readonly</span>
171
176
  <a href="#position" >position</a>
172
177
  </li>
173
178
  <li>
179
+ <span class="modifier">Public</span>
180
+ <span class="modifier">Readonly</span>
174
181
  <a href="#repeat" >repeat</a>
175
182
  </li>
176
183
  <li>
177
- <a href="#rxapBackgroundImage" >rxapBackgroundImage</a>
178
- </li>
179
- <li>
184
+ <span class="modifier">Public</span>
185
+ <span class="modifier">Readonly</span>
180
186
  <a href="#size" >size</a>
181
187
  </li>
182
188
  </ul>
@@ -186,6 +192,8 @@
186
192
 
187
193
 
188
194
 
195
+
196
+
189
197
  </tbody>
190
198
  </table>
191
199
  </section>
@@ -196,206 +204,206 @@
196
204
  <tbody>
197
205
  <tr>
198
206
  <td class="col-md-4">
199
- <code>constructor(host: ElementRef, renderer: Renderer2, imageLoader: ImageLoaderService)</code>
207
+ <code>constructor()</code>
200
208
  </td>
201
209
  </tr>
202
210
  <tr>
203
211
  <td class="col-md-4">
204
- <div class="io-line">Defined in <a href="" data-line="69" class="link-to-prism">src/lib/background-image.directive.ts:69</a></div>
212
+ <div class="io-line">Defined in <a href="" data-line="65" class="link-to-prism">src/lib/background-image.directive.ts:65</a></div>
205
213
  </td>
206
214
  </tr>
207
215
 
208
- <tr>
209
- <td class="col-md-4">
210
- <div>
211
- <b>Parameters :</b>
212
- <table class="params">
213
- <thead>
214
- <tr>
215
- <td>Name</td>
216
- <td>Type</td>
217
- <td>Optional</td>
218
- </tr>
219
- </thead>
220
- <tbody>
221
- <tr>
222
- <td>host</td>
223
-
224
- <td>
225
- <code>ElementRef</code>
226
- </td>
227
-
228
- <td>
229
- No
230
- </td>
231
-
232
- </tr>
233
- <tr>
234
- <td>renderer</td>
235
-
236
- <td>
237
- <code>Renderer2</code>
238
- </td>
239
-
240
- <td>
241
- No
242
- </td>
243
-
244
- </tr>
245
- <tr>
246
- <td>imageLoader</td>
247
-
248
- <td>
249
- <code>ImageLoaderService</code>
250
- </td>
251
-
252
- <td>
253
- No
254
- </td>
255
-
256
- </tr>
257
- </tbody>
258
- </table>
259
- </div>
260
- </td>
261
- </tr>
262
216
  </tbody>
263
217
  </table>
264
218
  </section>
265
219
 
266
- <section data-compodoc="block-inputs">
267
- <h3 id="inputs">Inputs</h3>
268
- <table class="table table-sm table-bordered">
269
- <tbody>
270
- <tr>
271
- <td class="col-md-4">
272
- <a name="placeholderImageUrl"></a>
273
- <b>placeholderImageUrl</b>
274
- </td>
275
- </tr>
276
- <tr>
277
- <td class="col-md-4">
278
- <i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
279
220
 
280
- </td>
281
- </tr>
282
- <tr>
283
- <td class="col-md-2" colspan="2">
284
- <div class="io-line">Defined in <a href="" data-line="60" class="link-to-prism">src/lib/background-image.directive.ts:60</a></div>
285
- </td>
286
- </tr>
287
- </tbody>
288
- </table>
289
- <table class="table table-sm table-bordered">
290
- <tbody>
221
+
222
+
223
+
224
+
225
+ <section data-compodoc="block-properties">
226
+
227
+ <h3 id="inputs">
228
+ Properties
229
+ </h3>
230
+ <table class="table table-sm table-bordered">
231
+ <tbody>
232
+ <tr>
233
+ <td class="col-md-4">
234
+ <a name="imageUrl"></a>
235
+ <span class="name">
236
+ <span class="modifier">Public</span>
237
+ <span class="modifier">Readonly</span>
238
+ <span ><b>imageUrl</b></span>
239
+ <a href="#imageUrl"><span class="icon ion-ios-link"></span></a>
240
+ </span>
241
+ </td>
242
+ </tr>
291
243
  <tr>
292
244
  <td class="col-md-4">
293
- <a name="position"></a>
294
- <b>position</b>
245
+ <i>Default value : </i><code>input&lt;string | null | undefined&gt;(null, { alias: &quot;rxapBackgroundImage&quot; })</code>
295
246
  </td>
296
247
  </tr>
297
- <tr>
298
- <td class="col-md-4">
299
- <i>Type : </i> <code><a href="../miscellaneous/typealiases.html#BackgroundPosition" target="_self" >BackgroundPosition</a></code>
248
+ <tr>
249
+ <td class="col-md-4">
250
+ <div class="io-line">Defined in <a href="" data-line="51" class="link-to-prism">src/lib/background-image.directive.ts:51</a></div>
251
+ </td>
252
+ </tr>
300
253
 
301
- </td>
302
- </tr>
303
- <tr>
304
- <td class="col-md-2" colspan="2">
305
- <div class="io-line">Defined in <a href="" data-line="69" class="link-to-prism">src/lib/background-image.directive.ts:69</a></div>
306
- </td>
307
- </tr>
308
- </tbody>
309
- </table>
310
- <table class="table table-sm table-bordered">
311
- <tbody>
254
+
255
+ </tbody>
256
+ </table>
257
+ <table class="table table-sm table-bordered">
258
+ <tbody>
259
+ <tr>
260
+ <td class="col-md-4">
261
+ <a name="placeholder"></a>
262
+ <span class="name">
263
+ <span class="modifier">Protected</span>
264
+ <span class="modifier">Readonly</span>
265
+ <span ><b>placeholder</b></span>
266
+ <a href="#placeholder"><span class="icon ion-ios-link"></span></a>
267
+ </span>
268
+ </td>
269
+ </tr>
312
270
  <tr>
313
271
  <td class="col-md-4">
314
- <a name="repeat"></a>
315
- <b>repeat</b>
272
+ <i>Default value : </i><code>computed(() &#x3D;&gt; this.placeholderImageUrl())</code>
316
273
  </td>
317
274
  </tr>
318
- <tr>
319
- <td class="col-md-4">
320
- <i>Type : </i> <code><a href="../miscellaneous/typealiases.html#BackgroundRepeat" target="_self" >BackgroundRepeat</a></code>
275
+ <tr>
276
+ <td class="col-md-4">
277
+ <div class="io-line">Defined in <a href="" data-line="65" class="link-to-prism">src/lib/background-image.directive.ts:65</a></div>
278
+ </td>
279
+ </tr>
321
280
 
322
- </td>
323
- </tr>
324
- <tr>
325
- <td class="col-md-2" colspan="2">
326
- <div class="io-line">Defined in <a href="" data-line="66" class="link-to-prism">src/lib/background-image.directive.ts:66</a></div>
327
- </td>
328
- </tr>
329
- </tbody>
330
- </table>
331
- <table class="table table-sm table-bordered">
332
- <tbody>
281
+ <tr>
282
+ <td class="col-md-4">
283
+ <div class="io-description"><p>The placeholder url that is used until the image is loaded. Derived
284
+ directives can override this to provide a fallback.</p>
285
+ </div>
286
+ </td>
287
+ </tr>
288
+
289
+ </tbody>
290
+ </table>
291
+ <table class="table table-sm table-bordered">
292
+ <tbody>
293
+ <tr>
294
+ <td class="col-md-4">
295
+ <a name="placeholderImageUrl"></a>
296
+ <span class="name">
297
+ <span class="modifier">Public</span>
298
+ <span class="modifier">Readonly</span>
299
+ <span ><b>placeholderImageUrl</b></span>
300
+ <a href="#placeholderImageUrl"><span class="icon ion-ios-link"></span></a>
301
+ </span>
302
+ </td>
303
+ </tr>
333
304
  <tr>
334
305
  <td class="col-md-4">
335
- <a name="rxapBackgroundImage"></a>
336
- <b>rxapBackgroundImage</b>
306
+ <i>Default value : </i><code>input&lt;string | null | undefined&gt;()</code>
337
307
  </td>
338
308
  </tr>
339
- <tr>
340
- <td class="col-md-4">
341
- <i>Type : </i> <code>string | null | undefined</code>
309
+ <tr>
310
+ <td class="col-md-4">
311
+ <div class="io-line">Defined in <a href="" data-line="53" class="link-to-prism">src/lib/background-image.directive.ts:53</a></div>
312
+ </td>
313
+ </tr>
342
314
 
343
- </td>
344
- </tr>
315
+
316
+ </tbody>
317
+ </table>
318
+ <table class="table table-sm table-bordered">
319
+ <tbody>
320
+ <tr>
321
+ <td class="col-md-4">
322
+ <a name="position"></a>
323
+ <span class="name">
324
+ <span class="modifier">Public</span>
325
+ <span class="modifier">Readonly</span>
326
+ <span ><b>position</b></span>
327
+ <a href="#position"><span class="icon ion-ios-link"></span></a>
328
+ </span>
329
+ </td>
330
+ </tr>
345
331
  <tr>
346
332
  <td class="col-md-4">
347
- <i>Default value : </i><code>null</code>
333
+ <i>Default value : </i><code>input&lt;BackgroundPosition | null | undefined&gt;()</code>
348
334
  </td>
349
335
  </tr>
350
- <tr>
351
- <td class="col-md-2" colspan="2">
352
- <div class="io-line">Defined in <a href="" data-line="57" class="link-to-prism">src/lib/background-image.directive.ts:57</a></div>
353
- </td>
354
- </tr>
355
- </tbody>
356
- </table>
357
- <table class="table table-sm table-bordered">
358
- <tbody>
336
+ <tr>
337
+ <td class="col-md-4">
338
+ <div class="io-line">Defined in <a href="" data-line="59" class="link-to-prism">src/lib/background-image.directive.ts:59</a></div>
339
+ </td>
340
+ </tr>
341
+
342
+
343
+ </tbody>
344
+ </table>
345
+ <table class="table table-sm table-bordered">
346
+ <tbody>
347
+ <tr>
348
+ <td class="col-md-4">
349
+ <a name="repeat"></a>
350
+ <span class="name">
351
+ <span class="modifier">Public</span>
352
+ <span class="modifier">Readonly</span>
353
+ <span ><b>repeat</b></span>
354
+ <a href="#repeat"><span class="icon ion-ios-link"></span></a>
355
+ </span>
356
+ </td>
357
+ </tr>
359
358
  <tr>
360
359
  <td class="col-md-4">
361
- <a name="size"></a>
362
- <b>size</b>
360
+ <i>Default value : </i><code>input&lt;BackgroundRepeat | null | undefined&gt;()</code>
363
361
  </td>
364
362
  </tr>
363
+ <tr>
364
+ <td class="col-md-4">
365
+ <div class="io-line">Defined in <a href="" data-line="57" class="link-to-prism">src/lib/background-image.directive.ts:57</a></div>
366
+ </td>
367
+ </tr>
368
+
369
+
370
+ </tbody>
371
+ </table>
372
+ <table class="table table-sm table-bordered">
373
+ <tbody>
374
+ <tr>
375
+ <td class="col-md-4">
376
+ <a name="size"></a>
377
+ <span class="name">
378
+ <span class="modifier">Public</span>
379
+ <span class="modifier">Readonly</span>
380
+ <span ><b>size</b></span>
381
+ <a href="#size"><span class="icon ion-ios-link"></span></a>
382
+ </span>
383
+ </td>
384
+ </tr>
365
385
  <tr>
366
386
  <td class="col-md-4">
367
- <i>Type : </i> <code><a href="../miscellaneous/typealiases.html#BackgroundSize" target="_self" >BackgroundSize</a></code>
368
-
387
+ <i>Default value : </i><code>input&lt;BackgroundSize | null | undefined&gt;()</code>
369
388
  </td>
370
389
  </tr>
371
- <tr>
372
- <td class="col-md-2" colspan="2">
373
- <div class="io-line">Defined in <a href="" data-line="63" class="link-to-prism">src/lib/background-image.directive.ts:63</a></div>
374
- </td>
375
- </tr>
376
- </tbody>
377
- </table>
378
- </section>
379
-
380
-
390
+ <tr>
391
+ <td class="col-md-4">
392
+ <div class="io-line">Defined in <a href="" data-line="55" class="link-to-prism">src/lib/background-image.directive.ts:55</a></div>
393
+ </td>
394
+ </tr>
381
395
 
382
396
 
397
+ </tbody>
398
+ </table>
399
+ </section>
383
400
 
384
401
 
385
402
  </div>
386
403
 
387
404
 
388
405
  <div class="tab-pane fade tab-source-code" id="source">
389
- <pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {
390
- Directive,
391
- ElementRef,
392
- Inject,
393
- Input,
394
- OnChanges,
395
- OnInit,
396
- Renderer2,
397
- SimpleChanges,
398
- } from &#x27;@angular/core&#x27;;
406
+ <pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { computed, Directive, effect, ElementRef, inject, input, Renderer2, untracked } from &#x27;@angular/core&#x27;;
399
407
  import { ImageLoaderService } from &#x27;@rxap/services&#x27;;
400
408
 
401
409
  export enum GlobalStyleOptions {
@@ -440,87 +448,67 @@ export type BackgroundPosition &#x3D;
440
448
  selector: &#x27;[rxapBackgroundImage]&#x27;,
441
449
  standalone: true,
442
450
  })
443
- export class BackgroundImageDirective implements OnChanges, OnInit {
444
- @Input(&#x27;rxapBackgroundImage&#x27;)
445
- public imageUrl: string | null | undefined &#x3D; null;
446
-
447
- @Input()
448
- public placeholderImageUrl!: string;
449
-
450
- @Input()
451
- public size?: BackgroundSize;
452
-
453
- @Input()
454
- public repeat?: BackgroundRepeat;
455
-
456
- @Input()
457
- public position?: BackgroundPosition;
458
-
459
- // TODO : add inputs for all &#x27;background-*&#x27; styles
460
-
461
- constructor(
462
- @Inject(ElementRef)
463
- private readonly host: ElementRef,
464
- @Inject(Renderer2)
465
- private readonly renderer: Renderer2,
466
- @Inject(ImageLoaderService)
467
- private readonly imageLoader: ImageLoaderService,
468
- ) {
451
+ export class BackgroundImageDirective {
452
+ private readonly host &#x3D; inject&lt;ElementRef&gt;(ElementRef);
453
+ private readonly renderer &#x3D; inject&lt;Renderer2&gt;(Renderer2);
454
+ private readonly imageLoader &#x3D; inject&lt;ImageLoaderService&gt;(ImageLoaderService);
455
+
456
+ public readonly imageUrl &#x3D; input&lt;string | null | undefined&gt;(null, { alias: &quot;rxapBackgroundImage&quot; });
457
+
458
+ public readonly placeholderImageUrl &#x3D; input&lt;string | null | undefined&gt;();
459
+
460
+ public readonly size &#x3D; input&lt;BackgroundSize | null | undefined&gt;();
461
+
462
+ public readonly repeat &#x3D; input&lt;BackgroundRepeat | null | undefined&gt;();
463
+
464
+ public readonly position &#x3D; input&lt;BackgroundPosition | null | undefined&gt;();
465
+
466
+ /**
467
+ * The placeholder url that is used until the image is loaded. Derived
468
+ * directives can override this to provide a fallback.
469
+ */
470
+ protected readonly placeholder &#x3D; computed(() &#x3D;&gt; this.placeholderImageUrl());
471
+
472
+ constructor() {
473
+ effect(() &#x3D;&gt; {
474
+ const size &#x3D; this.size();
475
+ untracked(() &#x3D;&gt; this.sizeChange(size));
476
+ });
477
+ effect(() &#x3D;&gt; {
478
+ const position &#x3D; this.position();
479
+ untracked(() &#x3D;&gt; this.positionChange(position));
480
+ });
481
+ effect(() &#x3D;&gt; {
482
+ const repeat &#x3D; this.repeat();
483
+ untracked(() &#x3D;&gt; this.repeatChange(repeat));
484
+ });
485
+ effect(() &#x3D;&gt; {
486
+ const imageUrl &#x3D; this.imageUrl();
487
+ // the placeholder is tracked too, so it is applied as soon as it changes
488
+ this.placeholder();
489
+ // call unconditionally so clearing the value (null/empty) is handled
490
+ untracked(() &#x3D;&gt; this.imageUrlChange(imageUrl));
491
+ });
469
492
  }
470
493
 
471
- public ngOnInit() {
472
- if (this.size) {
473
- this.sizeChange(this.size);
474
- }
475
- if (this.position) {
476
- this.positionChange(this.position);
477
- }
478
- if (this.repeat) {
479
- this.repeatChange(this.repeat);
480
- }
481
- }
482
-
483
- public ngOnChanges(changes: SimpleChanges) {
484
- for (const propertyKey of Object.keys(changes)) {
485
- switch (propertyKey) {
486
- case &#x27;imageUrl&#x27;:
487
- // call unconditionally so clearing the value (null/empty) is handled
488
- this.imageUrlChange(changes[&#x27;imageUrl&#x27;].currentValue);
489
- break;
490
-
491
- case &#x27;size&#x27;:
492
- this.sizeChange(changes[&#x27;size&#x27;].currentValue);
493
- break;
494
-
495
- case &#x27;repeat&#x27;:
496
- this.repeatChange(changes[&#x27;repeat&#x27;].currentValue);
497
- break;
498
-
499
- case &#x27;position&#x27;:
500
- this.positionChange(changes[&#x27;position&#x27;].currentValue);
501
- break;
502
- }
494
+ private applyStyle(style: string, value: string | null | undefined): void {
495
+ if (value) {
496
+ this.renderer.setStyle(this.host.nativeElement, style, value);
497
+ } else {
498
+ this.renderer.removeStyle(this.host.nativeElement, style);
503
499
  }
504
500
  }
505
501
 
506
- private repeatChange(repeat: string): void {
507
- this.renderer.setStyle(
508
- this.host.nativeElement,
509
- &#x27;background-repeat&#x27;,
510
- repeat,
511
- );
502
+ private repeatChange(repeat: string | null | undefined): void {
503
+ this.applyStyle(&#x27;background-repeat&#x27;, repeat);
512
504
  }
513
505
 
514
- private positionChange(position: string): void {
515
- this.renderer.setStyle(
516
- this.host.nativeElement,
517
- &#x27;background-position&#x27;,
518
- position,
519
- );
506
+ private positionChange(position: string | null | undefined): void {
507
+ this.applyStyle(&#x27;background-position&#x27;, position);
520
508
  }
521
509
 
522
- private sizeChange(size: string): void {
523
- this.renderer.setStyle(this.host.nativeElement, &#x27;background-size&#x27;, size);
510
+ private sizeChange(size: string | null | undefined): void {
511
+ this.applyStyle(&#x27;background-size&#x27;, size);
524
512
  }
525
513
 
526
514
  private _latestImageUrl: string | null | undefined;
@@ -528,11 +516,12 @@ export class BackgroundImageDirective implements OnChanges, OnInit {
528
516
  private async imageUrlChange(imageUrl: string | null | undefined): Promise&lt;void&gt; {
529
517
  // track the most recently requested url so out-of-order loads can be ignored
530
518
  this._latestImageUrl &#x3D; imageUrl;
531
- if (this.placeholderImageUrl) {
519
+ const placeholderImageUrl &#x3D; this.placeholder();
520
+ if (placeholderImageUrl) {
532
521
  this.renderer.setStyle(
533
522
  this.host.nativeElement,
534
523
  &#x27;background-image&#x27;,
535
- &#x60;url(&quot;${ this.placeholderImageUrl }&quot;)&#x60;,
524
+ &#x60;url(&quot;${ placeholderImageUrl }&quot;)&#x60;,
536
525
  );
537
526
  }
538
527
  if (imageUrl) {
@@ -546,14 +535,12 @@ export class BackgroundImageDirective implements OnChanges, OnInit {
546
535
  &#x27;background-image&#x27;,
547
536
  &#x60;url(&quot;${ imageUrl }&quot;)&#x60;,
548
537
  );
549
- } else if (!this.placeholderImageUrl) {
538
+ } else if (!placeholderImageUrl) {
550
539
  // clearing the image and no placeholder to fall back to
551
540
  this.renderer.removeStyle(this.host.nativeElement, &#x27;background-image&#x27;);
552
541
  }
553
542
  }
554
543
  }
555
-
556
-
557
544
  </code></pre>
558
545
  </div>
559
546