@4sh/ui-kit 0.16.0 → 0.17.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 (219) hide show
  1. package/README.fr.md +10 -10
  2. package/README.md +10 -10
  3. package/fesm2022/4sh-ui-kit-actions-ui-button-split.mjs +542 -150
  4. package/fesm2022/4sh-ui-kit-actions-ui-button-split.mjs.map +1 -1
  5. package/fesm2022/4sh-ui-kit-actions-ui-button.mjs +622 -248
  6. package/fesm2022/4sh-ui-kit-actions-ui-button.mjs.map +1 -1
  7. package/fesm2022/4sh-ui-kit-actions-ui-link.mjs +385 -152
  8. package/fesm2022/4sh-ui-kit-actions-ui-link.mjs.map +1 -1
  9. package/fesm2022/4sh-ui-kit-actions-ui-speed-dial.mjs +748 -433
  10. package/fesm2022/4sh-ui-kit-actions-ui-speed-dial.mjs.map +1 -1
  11. package/fesm2022/4sh-ui-kit-base-ui-icon.mjs +227 -135
  12. package/fesm2022/4sh-ui-kit-base-ui-icon.mjs.map +1 -1
  13. package/fesm2022/4sh-ui-kit-base-ui-image.mjs +1200 -633
  14. package/fesm2022/4sh-ui-kit-base-ui-image.mjs.map +1 -1
  15. package/fesm2022/4sh-ui-kit-forms-ui-autocomplete.mjs +1675 -1000
  16. package/fesm2022/4sh-ui-kit-forms-ui-autocomplete.mjs.map +1 -1
  17. package/fesm2022/4sh-ui-kit-forms-ui-checkbox.mjs +243 -117
  18. package/fesm2022/4sh-ui-kit-forms-ui-checkbox.mjs.map +1 -1
  19. package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs +2294 -2048
  20. package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs.map +1 -1
  21. package/fesm2022/4sh-ui-kit-forms-ui-editor.mjs +1058 -1113
  22. package/fesm2022/4sh-ui-kit-forms-ui-editor.mjs.map +1 -1
  23. package/fesm2022/4sh-ui-kit-forms-ui-field-sign.mjs +1108 -0
  24. package/fesm2022/4sh-ui-kit-forms-ui-field-sign.mjs.map +1 -0
  25. package/fesm2022/4sh-ui-kit-forms-ui-field.mjs +397 -141
  26. package/fesm2022/4sh-ui-kit-forms-ui-field.mjs.map +1 -1
  27. package/fesm2022/4sh-ui-kit-forms-ui-file-upload.mjs +1529 -583
  28. package/fesm2022/4sh-ui-kit-forms-ui-file-upload.mjs.map +1 -1
  29. package/fesm2022/4sh-ui-kit-forms-ui-input-date.mjs +383 -224
  30. package/fesm2022/4sh-ui-kit-forms-ui-input-date.mjs.map +1 -1
  31. package/fesm2022/4sh-ui-kit-forms-ui-input-group.mjs +345 -177
  32. package/fesm2022/4sh-ui-kit-forms-ui-input-group.mjs.map +1 -1
  33. package/fesm2022/4sh-ui-kit-forms-ui-input-mask.mjs +280 -138
  34. package/fesm2022/4sh-ui-kit-forms-ui-input-mask.mjs.map +1 -1
  35. package/fesm2022/4sh-ui-kit-forms-ui-input-number.mjs +507 -257
  36. package/fesm2022/4sh-ui-kit-forms-ui-input-number.mjs.map +1 -1
  37. package/fesm2022/4sh-ui-kit-forms-ui-input-otp.mjs +401 -312
  38. package/fesm2022/4sh-ui-kit-forms-ui-input-otp.mjs.map +1 -1
  39. package/fesm2022/4sh-ui-kit-forms-ui-input-tags.mjs +1277 -697
  40. package/fesm2022/4sh-ui-kit-forms-ui-input-tags.mjs.map +1 -1
  41. package/fesm2022/4sh-ui-kit-forms-ui-input.mjs +467 -199
  42. package/fesm2022/4sh-ui-kit-forms-ui-input.mjs.map +1 -1
  43. package/fesm2022/4sh-ui-kit-forms-ui-knob.mjs +394 -270
  44. package/fesm2022/4sh-ui-kit-forms-ui-knob.mjs.map +1 -1
  45. package/fesm2022/4sh-ui-kit-forms-ui-label.mjs +140 -60
  46. package/fesm2022/4sh-ui-kit-forms-ui-label.mjs.map +1 -1
  47. package/fesm2022/4sh-ui-kit-forms-ui-nudger.mjs +386 -167
  48. package/fesm2022/4sh-ui-kit-forms-ui-nudger.mjs.map +1 -1
  49. package/fesm2022/4sh-ui-kit-forms-ui-radio.mjs +150 -87
  50. package/fesm2022/4sh-ui-kit-forms-ui-radio.mjs.map +1 -1
  51. package/fesm2022/4sh-ui-kit-forms-ui-rating.mjs +345 -180
  52. package/fesm2022/4sh-ui-kit-forms-ui-rating.mjs.map +1 -1
  53. package/fesm2022/4sh-ui-kit-forms-ui-segment-control.mjs +582 -392
  54. package/fesm2022/4sh-ui-kit-forms-ui-segment-control.mjs.map +1 -1
  55. package/fesm2022/4sh-ui-kit-forms-ui-select.mjs +1552 -888
  56. package/fesm2022/4sh-ui-kit-forms-ui-select.mjs.map +1 -1
  57. package/fesm2022/4sh-ui-kit-forms-ui-slider.mjs +485 -338
  58. package/fesm2022/4sh-ui-kit-forms-ui-slider.mjs.map +1 -1
  59. package/fesm2022/4sh-ui-kit-forms-ui-swatch-picker.mjs +503 -311
  60. package/fesm2022/4sh-ui-kit-forms-ui-swatch-picker.mjs.map +1 -1
  61. package/fesm2022/4sh-ui-kit-forms-ui-textarea.mjs +271 -137
  62. package/fesm2022/4sh-ui-kit-forms-ui-textarea.mjs.map +1 -1
  63. package/fesm2022/4sh-ui-kit-forms-ui-toggle-block.mjs +457 -214
  64. package/fesm2022/4sh-ui-kit-forms-ui-toggle-block.mjs.map +1 -1
  65. package/fesm2022/4sh-ui-kit-forms-ui-toggle-button.mjs +711 -371
  66. package/fesm2022/4sh-ui-kit-forms-ui-toggle-button.mjs.map +1 -1
  67. package/fesm2022/4sh-ui-kit-forms-ui-toggle.mjs +235 -121
  68. package/fesm2022/4sh-ui-kit-forms-ui-toggle.mjs.map +1 -1
  69. package/fesm2022/4sh-ui-kit-forms.mjs +721 -638
  70. package/fesm2022/4sh-ui-kit-forms.mjs.map +1 -1
  71. package/fesm2022/4sh-ui-kit-informative-ui-accordion.mjs +546 -242
  72. package/fesm2022/4sh-ui-kit-informative-ui-accordion.mjs.map +1 -1
  73. package/fesm2022/4sh-ui-kit-informative-ui-alert.mjs +335 -157
  74. package/fesm2022/4sh-ui-kit-informative-ui-alert.mjs.map +1 -1
  75. package/fesm2022/4sh-ui-kit-informative-ui-avatar-group.mjs +53 -33
  76. package/fesm2022/4sh-ui-kit-informative-ui-avatar-group.mjs.map +1 -1
  77. package/fesm2022/4sh-ui-kit-informative-ui-avatar.mjs +218 -121
  78. package/fesm2022/4sh-ui-kit-informative-ui-avatar.mjs.map +1 -1
  79. package/fesm2022/4sh-ui-kit-informative-ui-badge.mjs +192 -100
  80. package/fesm2022/4sh-ui-kit-informative-ui-badge.mjs.map +1 -1
  81. package/fesm2022/4sh-ui-kit-informative-ui-chip.mjs +456 -204
  82. package/fesm2022/4sh-ui-kit-informative-ui-chip.mjs.map +1 -1
  83. package/fesm2022/4sh-ui-kit-informative-ui-empty-state.mjs +314 -147
  84. package/fesm2022/4sh-ui-kit-informative-ui-empty-state.mjs.map +1 -1
  85. package/fesm2022/4sh-ui-kit-informative-ui-helper.mjs +179 -82
  86. package/fesm2022/4sh-ui-kit-informative-ui-helper.mjs.map +1 -1
  87. package/fesm2022/4sh-ui-kit-informative-ui-progress-bar.mjs +268 -123
  88. package/fesm2022/4sh-ui-kit-informative-ui-progress-bar.mjs.map +1 -1
  89. package/fesm2022/4sh-ui-kit-informative-ui-read-only.mjs +391 -146
  90. package/fesm2022/4sh-ui-kit-informative-ui-read-only.mjs.map +1 -1
  91. package/fesm2022/4sh-ui-kit-informative-ui-separator.mjs +158 -76
  92. package/fesm2022/4sh-ui-kit-informative-ui-separator.mjs.map +1 -1
  93. package/fesm2022/4sh-ui-kit-informative-ui-skeleton.mjs +159 -80
  94. package/fesm2022/4sh-ui-kit-informative-ui-skeleton.mjs.map +1 -1
  95. package/fesm2022/4sh-ui-kit-informative-ui-spinner.mjs +295 -131
  96. package/fesm2022/4sh-ui-kit-informative-ui-spinner.mjs.map +1 -1
  97. package/fesm2022/4sh-ui-kit-informative-ui-tag.mjs +211 -83
  98. package/fesm2022/4sh-ui-kit-informative-ui-tag.mjs.map +1 -1
  99. package/fesm2022/4sh-ui-kit-informative-ui-toast.mjs +784 -414
  100. package/fesm2022/4sh-ui-kit-informative-ui-toast.mjs.map +1 -1
  101. package/fesm2022/4sh-ui-kit-informative-ui-tooltip.mjs +822 -476
  102. package/fesm2022/4sh-ui-kit-informative-ui-tooltip.mjs.map +1 -1
  103. package/fesm2022/4sh-ui-kit-layout-ui-bottom-sheet.mjs +1014 -599
  104. package/fesm2022/4sh-ui-kit-layout-ui-bottom-sheet.mjs.map +1 -1
  105. package/fesm2022/4sh-ui-kit-layout-ui-card.mjs +403 -189
  106. package/fesm2022/4sh-ui-kit-layout-ui-card.mjs.map +1 -1
  107. package/fesm2022/4sh-ui-kit-layout-ui-drawer.mjs +707 -272
  108. package/fesm2022/4sh-ui-kit-layout-ui-drawer.mjs.map +1 -1
  109. package/fesm2022/4sh-ui-kit-layout-ui-modal.mjs +1146 -568
  110. package/fesm2022/4sh-ui-kit-layout-ui-modal.mjs.map +1 -1
  111. package/fesm2022/4sh-ui-kit-layout-ui-popover.mjs +519 -308
  112. package/fesm2022/4sh-ui-kit-layout-ui-popover.mjs.map +1 -1
  113. package/fesm2022/4sh-ui-kit-motion.mjs +252 -150
  114. package/fesm2022/4sh-ui-kit-motion.mjs.map +1 -1
  115. package/fesm2022/4sh-ui-kit-navigation-ui-bottom-tab-bar.mjs +793 -341
  116. package/fesm2022/4sh-ui-kit-navigation-ui-bottom-tab-bar.mjs.map +1 -1
  117. package/fesm2022/4sh-ui-kit-navigation-ui-breadcrumb.mjs +351 -194
  118. package/fesm2022/4sh-ui-kit-navigation-ui-breadcrumb.mjs.map +1 -1
  119. package/fesm2022/4sh-ui-kit-navigation-ui-context-menu.mjs +511 -220
  120. package/fesm2022/4sh-ui-kit-navigation-ui-context-menu.mjs.map +1 -1
  121. package/fesm2022/4sh-ui-kit-navigation-ui-menu.mjs +910 -548
  122. package/fesm2022/4sh-ui-kit-navigation-ui-menu.mjs.map +1 -1
  123. package/fesm2022/4sh-ui-kit-navigation-ui-sidebar.mjs +1128 -555
  124. package/fesm2022/4sh-ui-kit-navigation-ui-sidebar.mjs.map +1 -1
  125. package/fesm2022/4sh-ui-kit-navigation-ui-stepper.mjs +915 -470
  126. package/fesm2022/4sh-ui-kit-navigation-ui-stepper.mjs.map +1 -1
  127. package/fesm2022/4sh-ui-kit-navigation-ui-tabs.mjs +931 -474
  128. package/fesm2022/4sh-ui-kit-navigation-ui-tabs.mjs.map +1 -1
  129. package/fesm2022/4sh-ui-kit-overlay.mjs +26 -109
  130. package/fesm2022/4sh-ui-kit-overlay.mjs.map +1 -1
  131. package/fesm2022/4sh-ui-kit-ripple.mjs +329 -290
  132. package/fesm2022/4sh-ui-kit-ripple.mjs.map +1 -1
  133. package/fesm2022/4sh-ui-kit-table-ui-paginator.mjs +709 -248
  134. package/fesm2022/4sh-ui-kit-table-ui-paginator.mjs.map +1 -1
  135. package/fesm2022/4sh-ui-kit-table-ui-table.mjs +2633 -1370
  136. package/fesm2022/4sh-ui-kit-table-ui-table.mjs.map +1 -1
  137. package/fesm2022/4sh-ui-kit-theming.mjs +112 -113
  138. package/fesm2022/4sh-ui-kit-theming.mjs.map +1 -1
  139. package/fesm2022/4sh-ui-kit-types.mjs +0 -12
  140. package/fesm2022/4sh-ui-kit.mjs +3 -15
  141. package/fesm2022/4sh-ui-kit.mjs.map +1 -1
  142. package/mcp/data/component-api.json +299 -2
  143. package/mcp/data/text-search-docs.json +149 -9
  144. package/mcp/data/ui-config.json +378 -1
  145. package/mcp/index.js +8190 -2876
  146. package/mcp/package.json +1 -1
  147. package/package.json +5 -1
  148. package/styles/component-vars.scss +22 -1
  149. package/types/4sh-ui-kit-actions-ui-button-split.d.ts +198 -87
  150. package/types/4sh-ui-kit-actions-ui-button.d.ts +240 -116
  151. package/types/4sh-ui-kit-actions-ui-link.d.ts +136 -67
  152. package/types/4sh-ui-kit-actions-ui-speed-dial.d.ts +287 -180
  153. package/types/4sh-ui-kit-base-ui-icon.d.ts +92 -58
  154. package/types/4sh-ui-kit-base-ui-image.d.ts +406 -205
  155. package/types/4sh-ui-kit-forms-ui-autocomplete.d.ts +573 -376
  156. package/types/4sh-ui-kit-forms-ui-checkbox.d.ts +77 -42
  157. package/types/4sh-ui-kit-forms-ui-datepicker.d.ts +953 -700
  158. package/types/4sh-ui-kit-forms-ui-editor.d.ts +374 -340
  159. package/types/4sh-ui-kit-forms-ui-field-sign.d.ts +325 -0
  160. package/types/4sh-ui-kit-forms-ui-field.d.ts +150 -64
  161. package/types/4sh-ui-kit-forms-ui-file-upload.d.ts +583 -241
  162. package/types/4sh-ui-kit-forms-ui-input-date.d.ts +152 -103
  163. package/types/4sh-ui-kit-forms-ui-input-group.d.ts +109 -63
  164. package/types/4sh-ui-kit-forms-ui-input-mask.d.ts +93 -59
  165. package/types/4sh-ui-kit-forms-ui-input-number.d.ts +171 -96
  166. package/types/4sh-ui-kit-forms-ui-input-otp.d.ts +137 -104
  167. package/types/4sh-ui-kit-forms-ui-input-tags.d.ts +469 -309
  168. package/types/4sh-ui-kit-forms-ui-input.d.ts +198 -118
  169. package/types/4sh-ui-kit-forms-ui-knob.d.ts +132 -80
  170. package/types/4sh-ui-kit-forms-ui-label.d.ts +47 -22
  171. package/types/4sh-ui-kit-forms-ui-nudger.d.ts +134 -67
  172. package/types/4sh-ui-kit-forms-ui-radio.d.ts +48 -33
  173. package/types/4sh-ui-kit-forms-ui-rating.d.ts +120 -86
  174. package/types/4sh-ui-kit-forms-ui-segment-control.d.ts +221 -147
  175. package/types/4sh-ui-kit-forms-ui-select.d.ts +561 -357
  176. package/types/4sh-ui-kit-forms-ui-slider.d.ts +156 -105
  177. package/types/4sh-ui-kit-forms-ui-swatch-picker.d.ts +133 -97
  178. package/types/4sh-ui-kit-forms-ui-textarea.d.ts +90 -56
  179. package/types/4sh-ui-kit-forms-ui-toggle-block.d.ts +158 -94
  180. package/types/4sh-ui-kit-forms-ui-toggle-button.d.ts +314 -178
  181. package/types/4sh-ui-kit-forms-ui-toggle.d.ts +88 -54
  182. package/types/4sh-ui-kit-forms.d.ts +275 -194
  183. package/types/4sh-ui-kit-informative-ui-accordion.d.ts +162 -92
  184. package/types/4sh-ui-kit-informative-ui-alert.d.ts +128 -62
  185. package/types/4sh-ui-kit-informative-ui-avatar-group.d.ts +8 -8
  186. package/types/4sh-ui-kit-informative-ui-avatar.d.ts +81 -44
  187. package/types/4sh-ui-kit-informative-ui-badge.d.ts +71 -41
  188. package/types/4sh-ui-kit-informative-ui-chip.d.ts +194 -99
  189. package/types/4sh-ui-kit-informative-ui-empty-state.d.ts +105 -65
  190. package/types/4sh-ui-kit-informative-ui-helper.d.ts +64 -34
  191. package/types/4sh-ui-kit-informative-ui-progress-bar.d.ts +120 -65
  192. package/types/4sh-ui-kit-informative-ui-read-only.d.ts +147 -67
  193. package/types/4sh-ui-kit-informative-ui-separator.d.ts +65 -35
  194. package/types/4sh-ui-kit-informative-ui-skeleton.d.ts +62 -32
  195. package/types/4sh-ui-kit-informative-ui-spinner.d.ts +111 -50
  196. package/types/4sh-ui-kit-informative-ui-tag.d.ts +77 -37
  197. package/types/4sh-ui-kit-informative-ui-toast.d.ts +300 -180
  198. package/types/4sh-ui-kit-informative-ui-tooltip.d.ts +269 -141
  199. package/types/4sh-ui-kit-layout-ui-bottom-sheet.d.ts +360 -221
  200. package/types/4sh-ui-kit-layout-ui-card.d.ts +119 -79
  201. package/types/4sh-ui-kit-layout-ui-drawer.d.ts +244 -120
  202. package/types/4sh-ui-kit-layout-ui-modal.d.ts +409 -222
  203. package/types/4sh-ui-kit-layout-ui-popover.d.ts +149 -91
  204. package/types/4sh-ui-kit-motion.d.ts +117 -67
  205. package/types/4sh-ui-kit-navigation-ui-bottom-tab-bar.d.ts +279 -145
  206. package/types/4sh-ui-kit-navigation-ui-breadcrumb.d.ts +134 -96
  207. package/types/4sh-ui-kit-navigation-ui-context-menu.d.ts +148 -89
  208. package/types/4sh-ui-kit-navigation-ui-menu.d.ts +282 -201
  209. package/types/4sh-ui-kit-navigation-ui-sidebar.d.ts +425 -261
  210. package/types/4sh-ui-kit-navigation-ui-stepper.d.ts +279 -183
  211. package/types/4sh-ui-kit-navigation-ui-tabs.d.ts +275 -173
  212. package/types/4sh-ui-kit-overlay.d.ts +6 -6
  213. package/types/4sh-ui-kit-ripple.d.ts +99 -74
  214. package/types/4sh-ui-kit-table-ui-paginator.d.ts +237 -133
  215. package/types/4sh-ui-kit-table-ui-table.d.ts +769 -470
  216. package/types/4sh-ui-kit-theming.d.ts +27 -29
  217. package/types/4sh-ui-kit-types.d.ts +6 -5
  218. package/types/4sh-ui-kit.d.ts +4 -3
  219. package/fesm2022/4sh-ui-kit-types.mjs.map +0 -1
@@ -0,0 +1,1108 @@
1
+ import * as i0 from "@angular/core";
2
+ import { Component, DestroyRef, ElementRef, afterNextRender, booleanAttribute, computed, effect, forwardRef, inject, input, isDevMode, output, signal, untracked, viewChild } from "@angular/core";
3
+ import { DOCUMENT } from "@angular/common";
4
+ import { NG_VALUE_ACCESSOR } from "@angular/forms";
5
+ import { BaseFormField, warnMissingAccessibleName } from "@4sh/ui-kit/forms";
6
+ import { UiField } from "@4sh/ui-kit/forms/ui-field";
7
+ import { UiIcon } from "@4sh/ui-kit/base/ui-icon";
8
+ const DOT_LENGTH = .2;
9
+ const tenths = (n) => Math.round(n * 10);
10
+ function isTap(stroke) {
11
+ if (stroke.length === 0) return false;
12
+ const [first] = stroke;
13
+ const x = tenths(first.x);
14
+ const y = tenths(first.y);
15
+ return stroke.every((p) => tenths(p.x) === x && tenths(p.y) === y);
16
+ }
17
+ function traceStroke(sink, stroke) {
18
+ if (stroke.length === 0) return;
19
+ const [first] = stroke;
20
+ sink.moveTo(first.x, first.y);
21
+ if (isTap(stroke)) {
22
+ sink.lineTo(first.x + DOT_LENGTH, first.y);
23
+ return;
24
+ }
25
+ for (let i = 1; i < stroke.length - 1; i++) {
26
+ const p = stroke[i];
27
+ const next = stroke[i + 1];
28
+ sink.quadraticCurveTo(p.x, p.y, (p.x + next.x) / 2, (p.y + next.y) / 2);
29
+ }
30
+ const last = stroke[stroke.length - 1];
31
+ sink.lineTo(last.x, last.y);
32
+ }
33
+ const round = (n) => String(Math.round(n * 10) / 10);
34
+ var SvgPathBuilder = class {
35
+ constructor() {
36
+ this.parts = [];
37
+ }
38
+ moveTo(x, y) {
39
+ this.parts.push(`M${round(x)} ${round(y)}`);
40
+ }
41
+ lineTo(x, y) {
42
+ this.parts.push(`L${round(x)} ${round(y)}`);
43
+ }
44
+ quadraticCurveTo(cpx, cpy, x, y) {
45
+ this.parts.push(`Q${round(cpx)} ${round(cpy)} ${round(x)} ${round(y)}`);
46
+ }
47
+ toString() {
48
+ return this.parts.join("");
49
+ }
50
+ };
51
+ function strokeToPath(stroke) {
52
+ const builder = new SvgPathBuilder();
53
+ traceStroke(builder, stroke);
54
+ return builder.toString();
55
+ }
56
+ function strokesBounds(strokes, pad = 0) {
57
+ let minX = Infinity;
58
+ let minY = Infinity;
59
+ let maxX = -Infinity;
60
+ let maxY = -Infinity;
61
+ const add = (x, y) => {
62
+ if (x < minX) minX = x;
63
+ if (y < minY) minY = y;
64
+ if (x > maxX) maxX = x;
65
+ if (y > maxY) maxY = y;
66
+ };
67
+ for (const stroke of strokes) {
68
+ for (const { x, y } of stroke) add(x, y);
69
+ if (isTap(stroke)) add(stroke[0].x + DOT_LENGTH, stroke[0].y);
70
+ }
71
+ if (minX === Infinity) return null;
72
+ return {
73
+ x: minX - pad,
74
+ y: minY - pad,
75
+ width: maxX - minX + 2 * pad,
76
+ height: maxY - minY + 2 * pad
77
+ };
78
+ }
79
+ function unionRect(a, b) {
80
+ if (!b) return a;
81
+ const x = Math.min(a.x, b.x);
82
+ const y = Math.min(a.y, b.y);
83
+ return {
84
+ x,
85
+ y,
86
+ width: Math.max(a.x + a.width, b.x + b.width) - x,
87
+ height: Math.max(a.y + a.height, b.y + b.height) - y
88
+ };
89
+ }
90
+ const IMAGE_DATA_URL = /^data:image\/(png|jpeg|webp|svg\+xml)[;,]/i;
91
+ const attr = (value) => value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "&#10;").replace(/\r/g, "&#13;").replace(/\t/g, "&#9;");
92
+ const compose = (then, first) => ({
93
+ scale: first.scale * then.scale,
94
+ x: first.x * then.scale + then.x,
95
+ y: first.y * then.scale + then.y
96
+ });
97
+ const fitTransform = (source, target) => {
98
+ const r = containRect(source.width, source.height, target.width, target.height);
99
+ const scale = source.width > 0 ? r.width / source.width : 1;
100
+ return {
101
+ scale,
102
+ x: target.x + r.x - source.x * scale,
103
+ y: target.y + r.y - source.y * scale
104
+ };
105
+ };
106
+ const roundScale = (n) => String(Number(n.toPrecision(6)));
107
+ const transformAttr = ({ scale, x, y }) => scale === 1 && x === 0 && y === 0 ? "" : ` transform="matrix(${roundScale(scale)} 0 0 ${roundScale(scale)} ${round(x)} ${round(y)})"`;
108
+ const rectAttrs = (r) => `x="${round(r.x)}" y="${round(r.y)}" width="${round(r.width)}" height="${round(r.height)}"`;
109
+ const imageElement = (href, rect, transform = "") => `<image href="${attr(href)}" ${rectAttrs(rect)} preserveAspectRatio="xMidYMid meet"${transform}/>`;
110
+ const inkGroup = (paths, color, width, transform = "") => `<g fill="none" stroke="${attr(color)}" stroke-width="${round(width)}" stroke-linecap="round" stroke-linejoin="round"${transform}>` + paths.map((d) => `<path d="${attr(d)}"/>`).join("") + `</g>`;
111
+ function backgroundMarkup(background) {
112
+ if (!background) return "";
113
+ const { drawing, href, rect } = background;
114
+ if (!drawing) return imageElement(href, rect);
115
+ const fit = fitTransform(drawing.viewBox, rect);
116
+ return drawing.layers.filter((layer) => layer.kind === "image" || layer.paths.length > 0).map((layer) => {
117
+ const transform = transformAttr(compose(fit, layer.transform));
118
+ return layer.kind === "image" ? imageElement(layer.href, layer.rect, transform) : inkGroup(layer.paths, layer.color, layer.width, transform);
119
+ }).join("");
120
+ }
121
+ function strokesToSvg(strokes, options) {
122
+ const { frame, color, lineWidth, background } = options;
123
+ const paths = strokes.filter((s) => s.length > 0).map(strokeToPath);
124
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${round(frame.x)} ${round(frame.y)} ${round(frame.width)} ${round(frame.height)}" width="${round(frame.width)}" height="${round(frame.height)}">` + backgroundMarkup(background) + (paths.length > 0 ? inkGroup(paths, color, lineWidth) : "") + `</svg>`;
125
+ }
126
+ function svgToDataUrl(svg) {
127
+ return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
128
+ }
129
+ function containRect(sourceWidth, sourceHeight, width, height) {
130
+ if (sourceWidth <= 0 || sourceHeight <= 0) return {
131
+ x: 0,
132
+ y: 0,
133
+ width,
134
+ height
135
+ };
136
+ const scale = Math.min(width / sourceWidth, height / sourceHeight);
137
+ const w = sourceWidth * scale;
138
+ const h = sourceHeight * scale;
139
+ return {
140
+ x: (width - w) / 2,
141
+ y: (height - h) / 2,
142
+ width: w,
143
+ height: h
144
+ };
145
+ }
146
+ const SVG_NS = "http://www.w3.org/2000/svg";
147
+ const IDENTITY = {
148
+ scale: 1,
149
+ x: 0,
150
+ y: 0
151
+ };
152
+ const NUMBER = /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
153
+ const PATH_COMMAND = /([MLQ])([^MLQ]*)/g;
154
+ const COLOR = /^(#[\da-f]{3,8}|[a-z]+|[a-z-]+\([\w\s.,%/+-]*\))$/i;
155
+ const REFERENCE_FUNCTIONS = [
156
+ "url(",
157
+ "var(",
158
+ "attr(",
159
+ "env("
160
+ ];
161
+ const NOT_AN_INK = /* @__PURE__ */ new Set([
162
+ "none",
163
+ "transparent",
164
+ "currentcolor",
165
+ "inherit",
166
+ "initial",
167
+ "unset",
168
+ "revert",
169
+ "revert-layer",
170
+ "context-fill",
171
+ "context-stroke"
172
+ ]);
173
+ const MATRIX = /^matrix\(\s*(\S+)\s+0\s+0\s+(\S+)\s+(\S+)\s+(\S+)\s*\)$/;
174
+ const SLACK = .5;
175
+ function decodeSvgDataUrl(src) {
176
+ const match = /^data:image\/svg\+xml((?:;[^,]*)?),(.*)$/is.exec(src);
177
+ if (!match) return null;
178
+ try {
179
+ if (/;base64$/i.test(match[1])) {
180
+ const binary = atob(match[2]);
181
+ const bytes = Uint8Array.from(binary, (c) => c.charCodeAt(0));
182
+ return new TextDecoder().decode(bytes);
183
+ }
184
+ return decodeURIComponent(match[2]);
185
+ } catch {
186
+ return null;
187
+ }
188
+ }
189
+ const num = (value) => {
190
+ const v = value?.trim() ?? "";
191
+ const n = NUMBER.test(v) ? Number(v) : NaN;
192
+ return Number.isFinite(n) ? n : NaN;
193
+ };
194
+ const isInk = (color) => {
195
+ const lower = color.toLowerCase();
196
+ return COLOR.test(color) && !NOT_AN_INK.has(lower) && !REFERENCE_FUNCTIONS.some((f) => lower.startsWith(f));
197
+ };
198
+ const onlyAttributes = (el, allowed) => Array.from(el.attributes).every((a) => allowed.includes(a.name));
199
+ function elementChildren(el) {
200
+ const out = [];
201
+ for (const node of Array.from(el.childNodes)) if (node.nodeType === 1 && node.namespaceURI === SVG_NS) out.push(node);
202
+ else if (node.nodeType !== 3 || node.textContent?.trim()) return null;
203
+ return out;
204
+ }
205
+ function readPath(d) {
206
+ const body = d.trim();
207
+ if (!body.startsWith("M")) return null;
208
+ const points = [];
209
+ for (const [, command, args] of body.matchAll(PATH_COMMAND)) {
210
+ const values = args.trim().split(/[\s,]+/).map(num);
211
+ if (values.length !== (command === "Q" ? 4 : 2) || values.some(Number.isNaN)) return null;
212
+ for (let i = 0; i < values.length; i += 2) points.push([values[i], values[i + 1]]);
213
+ }
214
+ return points.length > 0 ? points : null;
215
+ }
216
+ function readTransform(el) {
217
+ const value = el.getAttribute("transform");
218
+ if (value === null) return IDENTITY;
219
+ const m = MATRIX.exec(value);
220
+ if (!m) return null;
221
+ const [a, d, x, y] = [
222
+ m[1],
223
+ m[2],
224
+ m[3],
225
+ m[4]
226
+ ].map(num);
227
+ return a === d && a > 0 && Number.isFinite(x) && Number.isFinite(y) ? {
228
+ scale: a,
229
+ x,
230
+ y
231
+ } : null;
232
+ }
233
+ function readRect(el) {
234
+ const [x, y, width, height] = [
235
+ "x",
236
+ "y",
237
+ "width",
238
+ "height"
239
+ ].map((n) => num(el.getAttribute(n)));
240
+ return [
241
+ x,
242
+ y,
243
+ width,
244
+ height
245
+ ].every(Number.isFinite) && width > 0 && height > 0 ? {
246
+ x,
247
+ y,
248
+ width,
249
+ height
250
+ } : null;
251
+ }
252
+ function readImage(el) {
253
+ if (!onlyAttributes(el, [
254
+ "href",
255
+ "x",
256
+ "y",
257
+ "width",
258
+ "height",
259
+ "preserveAspectRatio",
260
+ "transform"
261
+ ])) return null;
262
+ const href = el.getAttribute("href") ?? "";
263
+ const aspect = el.getAttribute("preserveAspectRatio");
264
+ const rect = readRect(el);
265
+ const transform = readTransform(el);
266
+ if (!IMAGE_DATA_URL.test(href) || aspect !== null && aspect !== "xMidYMid meet") return null;
267
+ if (!rect || !transform || elementChildren(el)?.length !== 0) return null;
268
+ return {
269
+ layer: {
270
+ kind: "image",
271
+ href,
272
+ rect,
273
+ transform
274
+ },
275
+ points: [[rect.x, rect.y], [rect.x + rect.width, rect.y + rect.height]],
276
+ pad: 0
277
+ };
278
+ }
279
+ function readInk(el) {
280
+ if (!onlyAttributes(el, [
281
+ "fill",
282
+ "stroke",
283
+ "stroke-width",
284
+ "stroke-linecap",
285
+ "stroke-linejoin",
286
+ "transform"
287
+ ])) return null;
288
+ const color = el.getAttribute("stroke") ?? "";
289
+ const width = num(el.getAttribute("stroke-width"));
290
+ const transform = readTransform(el);
291
+ if (el.getAttribute("fill") !== "none" || el.getAttribute("stroke-linecap") !== "round" || el.getAttribute("stroke-linejoin") !== "round" || !isInk(color) || !(width > 0) || !transform) return null;
292
+ const children = elementChildren(el);
293
+ if (!children) return null;
294
+ const paths = [];
295
+ const points = [];
296
+ for (const path of children) {
297
+ const d = path.getAttribute("d") ?? "";
298
+ const read = path.localName === "path" && onlyAttributes(path, ["d"]) ? readPath(d) : null;
299
+ if (!read || elementChildren(path)?.length !== 0) return null;
300
+ paths.push(d);
301
+ points.push(...read);
302
+ }
303
+ return {
304
+ layer: {
305
+ kind: "ink",
306
+ paths,
307
+ color,
308
+ width,
309
+ transform
310
+ },
311
+ points,
312
+ pad: width / 2
313
+ };
314
+ }
315
+ function insideViewBox({ layer, points, pad }, viewBox) {
316
+ const { scale, x: dx, y: dy } = layer.transform;
317
+ const reach = pad * scale;
318
+ return points.every(([px, py]) => {
319
+ const x = px * scale + dx;
320
+ const y = py * scale + dy;
321
+ return x - reach >= viewBox.x - SLACK && y - reach >= viewBox.y - SLACK && x + reach <= viewBox.x + viewBox.width + SLACK && y + reach <= viewBox.y + viewBox.height + SLACK;
322
+ });
323
+ }
324
+ function readSignSvg(src) {
325
+ const text = decodeSvgDataUrl(src);
326
+ if (text === null || typeof DOMParser === "undefined") return null;
327
+ if (/<!(DOCTYPE|ENTITY)/i.test(text)) return null;
328
+ const doc = new DOMParser().parseFromString(text, "image/svg+xml");
329
+ const root = doc.documentElement;
330
+ if (root.localName !== "svg" || root.namespaceURI !== SVG_NS || doc.doctype) return null;
331
+ if (doc.getElementsByTagName("parsererror").length > 0) return null;
332
+ if (!onlyAttributes(root, [
333
+ "xmlns",
334
+ "viewBox",
335
+ "width",
336
+ "height"
337
+ ])) return null;
338
+ const box = (root.getAttribute("viewBox") ?? "").trim().split(/[\s,]+/).map(num);
339
+ const width = num(root.getAttribute("width"));
340
+ const height = num(root.getAttribute("height"));
341
+ if (box.length !== 4 || box.some(Number.isNaN) || !(box[2] > 0) || !(box[3] > 0)) return null;
342
+ if (!(width > 0) || !(height > 0) || Math.abs(width / height - box[2] / box[3]) > .01) return null;
343
+ const viewBox = {
344
+ x: box[0],
345
+ y: box[1],
346
+ width: box[2],
347
+ height: box[3]
348
+ };
349
+ const children = elementChildren(root);
350
+ if (!children) return null;
351
+ const layers = [];
352
+ for (const child of children) {
353
+ const read = child.localName === "image" ? readImage(child) : child.localName === "g" ? readInk(child) : null;
354
+ if (!read || !insideViewBox(read, viewBox)) return null;
355
+ layers.push(read.layer);
356
+ }
357
+ return {
358
+ viewBox,
359
+ layers
360
+ };
361
+ }
362
+ const PNG_EXPORT_SCALE = 2;
363
+ const FALLBACK_INK_WIDTH = 2;
364
+ const UNRESOLVED_COLOR = "rgb(1, 2, 3)";
365
+ var UiFieldSign = class UiFieldSign extends BaseFormField {
366
+ constructor() {
367
+ super();
368
+ this.exportColor = input("black", ...ngDevMode ? [{ debugName: "exportColor" }] : /* istanbul ignore next */ []);
369
+ this.format = input("png", ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
370
+ this.placeholder = input("Signez ici", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
371
+ this.clearable = input(true, {
372
+ ...ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {},
373
+ transform: booleanAttribute
374
+ });
375
+ this.clearAriaLabel = input("Effacer la signature", ...ngDevMode ? [{ debugName: "clearAriaLabel" }] : /* istanbul ignore next */ []);
376
+ this.signedLabel = input("Signature saisie", ...ngDevMode ? [{ debugName: "signedLabel" }] : /* istanbul ignore next */ []);
377
+ this.requiredLabel = input("obligatoire", ...ngDevMode ? [{ debugName: "requiredLabel" }] : /* istanbul ignore next */ []);
378
+ this.unreadableLabel = input("Signature illisible", ...ngDevMode ? [{ debugName: "unreadableLabel" }] : /* istanbul ignore next */ []);
379
+ this.valueChange = output();
380
+ this.padFocus = output();
381
+ this.padBlur = output();
382
+ this.imageError = output();
383
+ this.canvasEl = viewChild.required("canvasEl", ...ngDevMode ? [{ debugName: "canvasEl" }] : /* istanbul ignore next */ []);
384
+ this.host = inject(ElementRef);
385
+ this.document = inject(DOCUMENT);
386
+ this.strokes = signal([], ...ngDevMode ? [{ debugName: "strokes" }] : /* istanbul ignore next */ []);
387
+ this.background = signal(null, ...ngDevMode ? [{ debugName: "background" }] : /* istanbul ignore next */ []);
388
+ this.drawing = signal(false, ...ngDevMode ? [{ debugName: "drawing" }] : /* istanbul ignore next */ []);
389
+ this.unreadable = signal(null, ...ngDevMode ? [{ debugName: "unreadable" }] : /* istanbul ignore next */ []);
390
+ this.isEmpty = computed(() => this.strokes().length === 0 && !this.background() && !this.drawing(), ...ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []);
391
+ this.showUnreadable = computed(() => this.unreadable() !== null && this.strokes().length === 0 && !this.drawing(), ...ngDevMode ? [{ debugName: "showUnreadable" }] : /* istanbul ignore next */ []);
392
+ this.canClear = computed(() => !this.isEmpty() || this.showUnreadable(), ...ngDevMode ? [{ debugName: "canClear" }] : /* istanbul ignore next */ []);
393
+ this.fieldLevel = computed(() => this.showUnreadable() ? "error" : this.effectiveLevel(), ...ngDevMode ? [{ debugName: "fieldLevel" }] : /* istanbul ignore next */ []);
394
+ this.isInteractive = computed(() => !this.isDisabled() && !this.readonly(), ...ngDevMode ? [{ debugName: "isInteractive" }] : /* istanbul ignore next */ []);
395
+ this.iconSize = computed(() => this.size() === "small" ? "sm" : "md", ...ngDevMode ? [{ debugName: "iconSize" }] : /* istanbul ignore next */ []);
396
+ this.statusId = computed(() => `${this.resolvedId()}-status`, ...ngDevMode ? [{ debugName: "statusId" }] : /* istanbul ignore next */ []);
397
+ this.statusText = computed(() => {
398
+ const state = this.showUnreadable() ? this.unreadableLabel() : this.isEmpty() ? this.placeholder() : this.signedLabel();
399
+ return this.required() && this.requiredLabel() ? `${state}, ${this.requiredLabel()}` : state;
400
+ }, ...ngDevMode ? [{ debugName: "statusText" }] : /* istanbul ignore next */ []);
401
+ this.describedByIds = computed(() => [this.statusId(), this.displayMessage() ? this.messageId() : null].filter(Boolean).join(" "), ...ngDevMode ? [{ debugName: "describedByIds" }] : /* istanbul ignore next */ []);
402
+ this.region = null;
403
+ this.view = {
404
+ scale: 1,
405
+ x: 0,
406
+ y: 0
407
+ };
408
+ this.cleared = null;
409
+ this.current = null;
410
+ this.activePointerId = null;
411
+ this.padRect = null;
412
+ this.boxWidth = 0;
413
+ this.boxHeight = 0;
414
+ this.silhouette = null;
415
+ this.commitPending = false;
416
+ this.embedsUnloaded = false;
417
+ this.viewStale = false;
418
+ this.edgeMargin = 0;
419
+ this.readBack = null;
420
+ this.animationFrame = null;
421
+ const destroyRef = inject(DestroyRef);
422
+ effect(() => {
423
+ this.strokes();
424
+ this.background();
425
+ this.isDisabled();
426
+ this.scheduleRedraw();
427
+ });
428
+ effect(() => {
429
+ if (!this.isInteractive()) untracked(() => this.abandonStroke());
430
+ });
431
+ afterNextRender(() => {
432
+ if (!this.label() && !this.ariaLabel() && !this.ariaLabelledBy()) warnMissingAccessibleName("ui-field-sign", "No accessible name: provide `label`, `ariaLabel` or `ariaLabelledBy`.");
433
+ const canvas = this.canvasEl().nativeElement;
434
+ this.measure();
435
+ if (typeof ResizeObserver !== "undefined") {
436
+ const resize = new ResizeObserver(() => {
437
+ this.measure();
438
+ this.redraw();
439
+ });
440
+ resize.observe(canvas);
441
+ destroyRef.onDestroy(() => resize.disconnect());
442
+ }
443
+ if (typeof MutationObserver !== "undefined") {
444
+ const theme = new MutationObserver(() => this.scheduleRedraw());
445
+ theme.observe(this.document.documentElement, {
446
+ attributes: true,
447
+ attributeFilter: [
448
+ "data-theme",
449
+ "data-brand",
450
+ "class",
451
+ "style"
452
+ ]
453
+ });
454
+ destroyRef.onDestroy(() => theme.disconnect());
455
+ }
456
+ this.redraw();
457
+ });
458
+ destroyRef.onDestroy(() => {
459
+ if (this.animationFrame !== null) cancelAnimationFrame(this.animationFrame);
460
+ });
461
+ }
462
+ writeValue(value) {
463
+ let next = value || null;
464
+ if (next && !IMAGE_DATA_URL.test(next)) {
465
+ if (isDevMode()) console.warn("[ui-field-sign] Ignored a value that is not an image data URL: convert a remote signature to a data URL before handing it to the field.");
466
+ next = null;
467
+ }
468
+ super.writeValue(next);
469
+ if (next !== null && next === this.lastEmitted) return;
470
+ this.lastEmitted = void 0;
471
+ this.current = null;
472
+ this.activePointerId = null;
473
+ this.commitPending = false;
474
+ this.embedsUnloaded = false;
475
+ this.cleared = null;
476
+ this.viewStale = false;
477
+ this.setRegion(null);
478
+ this.drawing.set(false);
479
+ this.unreadable.set(null);
480
+ this.strokes.set([]);
481
+ this.background.set(next ? {
482
+ src: next,
483
+ image: null
484
+ } : null);
485
+ if (next) this.loadBackground(next);
486
+ }
487
+ clear() {
488
+ if (!this.canClear() || this.drawing()) return;
489
+ this.cleared = {
490
+ strokes: this.strokes(),
491
+ background: this.background(),
492
+ region: this.region,
493
+ unreadable: this.unreadable()
494
+ };
495
+ this.setRegion(null);
496
+ this.strokes.set([]);
497
+ this.background.set(null);
498
+ this.unreadable.set(null);
499
+ this.commit();
500
+ }
501
+ undo() {
502
+ if (this.drawing()) return;
503
+ if (this.strokes().length > 0) this.strokes.update((s) => s.slice(0, -1));
504
+ else if (this.cleared) {
505
+ const { strokes, background, region, unreadable } = this.cleared;
506
+ this.cleared = null;
507
+ this.setRegion(region);
508
+ this.strokes.set(strokes);
509
+ this.background.set(background);
510
+ this.unreadable.set(unreadable);
511
+ if (background && !background.image) this.loadBackground(background.src);
512
+ } else return;
513
+ if (this.strokes().length === 0 && !this.background()) this.setRegion(null);
514
+ this.commit();
515
+ }
516
+ abandonStroke() {
517
+ if (!this.current) return;
518
+ const canvas = this.canvasEl().nativeElement;
519
+ const pointerId = this.activePointerId;
520
+ this.current = null;
521
+ this.activePointerId = null;
522
+ this.padRect = null;
523
+ this.drawing.set(false);
524
+ if (pointerId !== null && canvas.hasPointerCapture?.(pointerId)) canvas.releasePointerCapture(pointerId);
525
+ if (this.strokes().length === 0 && !this.background()) this.setRegion(null);
526
+ this.refitIfStale();
527
+ this.scheduleRedraw();
528
+ }
529
+ focus(options) {
530
+ this.canvasEl().nativeElement.focus(options);
531
+ }
532
+ hasSignature() {
533
+ return this.strokes().length > 0 || !!this.background() || this.unreadable() !== null;
534
+ }
535
+ uidPrefix() {
536
+ return "ui-field-sign";
537
+ }
538
+ onPointerDown(event) {
539
+ if (!this.isInteractive() || this.activePointerId !== null) return;
540
+ if (event.button !== 0) return;
541
+ const canvas = this.canvasEl().nativeElement;
542
+ event.preventDefault();
543
+ canvas.focus({ preventScroll: true });
544
+ canvas.setPointerCapture?.(event.pointerId);
545
+ if (!this.region) this.setRegion(this.boxRect());
546
+ this.edgeMargin = this.inkWidth() / 2 * this.view.scale;
547
+ this.activePointerId = event.pointerId;
548
+ this.padRect = canvas.getBoundingClientRect();
549
+ this.current = [this.toPoint(event)];
550
+ this.drawing.set(true);
551
+ this.scheduleRedraw();
552
+ }
553
+ onPointerMove(event) {
554
+ if (event.pointerId !== this.activePointerId || !this.current) return;
555
+ if (this.dropIfLocked()) return;
556
+ const samples = event.getCoalescedEvents?.() ?? [];
557
+ for (const sample of samples.length ? samples : [event]) this.current.push(this.toPoint(sample));
558
+ this.scheduleRedraw();
559
+ }
560
+ onPointerEnd(event) {
561
+ if (event.pointerId !== this.activePointerId || !this.current) return;
562
+ if (this.dropIfLocked()) return;
563
+ const stroke = this.current;
564
+ this.current = null;
565
+ this.activePointerId = null;
566
+ this.padRect = null;
567
+ this.drawing.set(false);
568
+ this.strokes.update((s) => [...s, stroke]);
569
+ this.refitIfStale();
570
+ this.commit();
571
+ }
572
+ dropIfLocked() {
573
+ if (this.isInteractive()) return false;
574
+ this.abandonStroke();
575
+ return true;
576
+ }
577
+ refitIfStale() {
578
+ if (!this.viewStale) return;
579
+ this.viewStale = false;
580
+ this.fitView();
581
+ }
582
+ onKeydown(event) {
583
+ if (!this.isInteractive()) return;
584
+ const undoChord = (event.ctrlKey || event.metaKey) && !event.shiftKey && event.key.toLowerCase() === "z";
585
+ if (event.key === "Backspace" || undoChord) {
586
+ event.preventDefault();
587
+ this.undo();
588
+ } else if (event.key === "Delete") {
589
+ event.preventDefault();
590
+ this.clear();
591
+ }
592
+ }
593
+ onBlur(event) {
594
+ this.emitTouch();
595
+ this.padBlur.emit(event);
596
+ }
597
+ onClearClick() {
598
+ this.clear();
599
+ this.focus();
600
+ }
601
+ commit() {
602
+ const bg = this.background();
603
+ let value;
604
+ if (this.showUnreadable()) value = this.unreadable();
605
+ else if (this.strokes().length === 0) value = bg?.src ?? null;
606
+ else if (this.format() === "png" && bg && !bg.image) {
607
+ this.commitPending = true;
608
+ return;
609
+ } else value = this.export();
610
+ this.commitPending = false;
611
+ this.embedsUnloaded = this.strokes().length > 0 && !!bg && !bg.image;
612
+ this.lastEmitted = value;
613
+ this.modelValue.set(value);
614
+ this.emitChange(value);
615
+ this.valueChange.emit(value);
616
+ }
617
+ export() {
618
+ const lineWidth = this.inkWidth();
619
+ const color = this.resolveExportColor();
620
+ if (this.format() === "png") {
621
+ const png = this.exportPng(color, lineWidth);
622
+ if (png) return png;
623
+ }
624
+ const bg = this.background();
625
+ return svgToDataUrl(strokesToSvg(this.strokes(), {
626
+ frame: this.frame(lineWidth),
627
+ color,
628
+ lineWidth,
629
+ background: bg ? {
630
+ href: bg.src,
631
+ rect: this.backgroundSlot(),
632
+ drawing: this.readBackground(bg.src)
633
+ } : null
634
+ }));
635
+ }
636
+ readBackground(src) {
637
+ if (this.readBack?.src !== src) {
638
+ let drawing;
639
+ try {
640
+ drawing = readSignSvg(src);
641
+ } catch {
642
+ drawing = null;
643
+ }
644
+ this.readBack = {
645
+ src,
646
+ drawing
647
+ };
648
+ }
649
+ return this.readBack.drawing;
650
+ }
651
+ exportPng(color, lineWidth) {
652
+ const frame = this.frame(lineWidth);
653
+ if (frame.width <= 0 || frame.height <= 0) return null;
654
+ const canvas = this.document.createElement("canvas");
655
+ canvas.width = Math.round(frame.width * PNG_EXPORT_SCALE);
656
+ canvas.height = Math.round(frame.height * PNG_EXPORT_SCALE);
657
+ const ctx = canvas.getContext("2d");
658
+ if (!ctx) return null;
659
+ ctx.scale(PNG_EXPORT_SCALE, PNG_EXPORT_SCALE);
660
+ ctx.translate(-frame.x, -frame.y);
661
+ const image = this.background()?.image;
662
+ if (image) {
663
+ const slot = this.backgroundSlot();
664
+ const r = containRect(image.naturalWidth, image.naturalHeight, slot.width, slot.height);
665
+ ctx.drawImage(image, slot.x + r.x, slot.y + r.y, r.width, r.height);
666
+ }
667
+ this.paintStrokes(ctx, this.strokes(), color, lineWidth);
668
+ try {
669
+ const png = canvas.toDataURL("image/png");
670
+ return png.startsWith("data:image/png") ? png : null;
671
+ } catch {
672
+ if (isDevMode()) console.warn("[ui-field-sign] PNG export refused: emitting SVG instead.");
673
+ return null;
674
+ }
675
+ }
676
+ resolveExportColor() {
677
+ const value = this.exportColor();
678
+ const host = this.host.nativeElement;
679
+ if (typeof getComputedStyle === "undefined" || !host.isConnected) return value || "black";
680
+ const outer = this.document.createElement("span");
681
+ const probe = this.document.createElement("span");
682
+ outer.style.color = UNRESOLVED_COLOR;
683
+ outer.hidden = true;
684
+ probe.style.color = value;
685
+ const parsed = probe.style.color !== "";
686
+ outer.appendChild(probe);
687
+ host.appendChild(outer);
688
+ const resolved = getComputedStyle(probe).color;
689
+ outer.remove();
690
+ if (parsed && resolved && resolved !== UNRESOLVED_COLOR) return resolved;
691
+ if (isDevMode()) console.warn(`[ui-field-sign] \`exportColor\` "${value}" is not a colour here: using black.`);
692
+ return "black";
693
+ }
694
+ loadBackground(src) {
695
+ if (typeof Image === "undefined") return;
696
+ const image = new Image();
697
+ image.onload = () => {
698
+ if (this.background()?.src !== src) return;
699
+ this.background.set({
700
+ src,
701
+ image
702
+ });
703
+ if (this.commitPending) this.commit();
704
+ };
705
+ image.onerror = (event) => {
706
+ if (this.background()?.src !== src) return;
707
+ if (isDevMode()) console.warn("[ui-field-sign] The previous signature could not be loaded.");
708
+ this.background.set(null);
709
+ this.unreadable.set(src);
710
+ if (this.strokes().length === 0 && !this.current) this.setRegion(null);
711
+ if (this.commitPending || this.embedsUnloaded) this.commit();
712
+ this.imageError.emit(event instanceof Event ? event : new Event("error"));
713
+ };
714
+ image.src = src;
715
+ }
716
+ boxRect() {
717
+ return {
718
+ x: 0,
719
+ y: 0,
720
+ width: this.boxWidth,
721
+ height: this.boxHeight
722
+ };
723
+ }
724
+ setRegion(region) {
725
+ this.region = region;
726
+ this.fitView();
727
+ }
728
+ frame(lineWidth = this.inkWidth()) {
729
+ if (!this.region) return this.boxRect();
730
+ return unionRect(this.region, strokesBounds(this.strokes(), lineWidth / 2));
731
+ }
732
+ backgroundSlot() {
733
+ return this.region ?? this.boxRect();
734
+ }
735
+ fitView() {
736
+ if (!this.region) {
737
+ this.view = {
738
+ scale: 1,
739
+ x: 0,
740
+ y: 0
741
+ };
742
+ return;
743
+ }
744
+ const frame = this.frame();
745
+ if (frame.width <= 0 || frame.height <= 0 || this.boxWidth <= 0 || this.boxHeight <= 0) {
746
+ this.view = {
747
+ scale: 1,
748
+ x: -frame.x,
749
+ y: -frame.y
750
+ };
751
+ return;
752
+ }
753
+ const r = containRect(frame.width, frame.height, this.boxWidth, this.boxHeight);
754
+ const scale = r.width / frame.width;
755
+ this.view = {
756
+ scale,
757
+ x: r.x - frame.x * scale,
758
+ y: r.y - frame.y * scale
759
+ };
760
+ }
761
+ toPoint(event) {
762
+ const rect = this.padRect;
763
+ const canvas = this.canvasEl().nativeElement;
764
+ const css = rect && rect.width > 0 ? canvas.clientWidth / rect.width || 1 : 1;
765
+ const rawX = rect ? (event.clientX - rect.left) * css : event.offsetX;
766
+ const rawY = rect ? (event.clientY - rect.top) * css : event.offsetY;
767
+ const x = this.clamp(rawX, this.boxWidth);
768
+ const y = this.clamp(rawY, this.boxHeight);
769
+ const { scale, x: dx, y: dy } = this.view;
770
+ return {
771
+ x: (x - dx) / scale,
772
+ y: (y - dy) / scale
773
+ };
774
+ }
775
+ clamp(value, size) {
776
+ if (size <= 0) return value;
777
+ const margin = Math.min(this.edgeMargin, size / 2);
778
+ return Math.min(Math.max(value, margin), size - margin);
779
+ }
780
+ measure() {
781
+ const canvas = this.canvasEl().nativeElement;
782
+ this.boxWidth = canvas.clientWidth;
783
+ this.boxHeight = canvas.clientHeight;
784
+ const ratio = window.devicePixelRatio || 1;
785
+ canvas.width = Math.max(1, Math.round(this.boxWidth * ratio));
786
+ canvas.height = Math.max(1, Math.round(this.boxHeight * ratio));
787
+ if (this.drawing()) {
788
+ this.viewStale = true;
789
+ this.padRect = canvas.getBoundingClientRect();
790
+ } else this.fitView();
791
+ }
792
+ scheduleRedraw() {
793
+ if (this.animationFrame !== null || typeof requestAnimationFrame === "undefined") return;
794
+ this.animationFrame = requestAnimationFrame(() => {
795
+ this.animationFrame = null;
796
+ this.redraw();
797
+ });
798
+ }
799
+ redraw() {
800
+ const ctx = this.ctx();
801
+ if (!ctx) return;
802
+ const canvas = ctx.canvas;
803
+ const ratio = this.boxWidth > 0 ? canvas.width / this.boxWidth : 1;
804
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
805
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
806
+ const k = ratio * this.view.scale;
807
+ ctx.setTransform(k, 0, 0, k, ratio * this.view.x, ratio * this.view.y);
808
+ const color = this.inkColor();
809
+ const image = this.background()?.image;
810
+ if (image) this.paintSilhouette(ctx, image, color, k);
811
+ const strokes = this.current ? [...this.strokes(), this.current] : this.strokes();
812
+ this.paintStrokes(ctx, strokes, color, this.inkWidth());
813
+ }
814
+ paintStrokes(ctx, strokes, color, lineWidth) {
815
+ ctx.strokeStyle = color;
816
+ ctx.lineWidth = lineWidth;
817
+ ctx.lineCap = "round";
818
+ ctx.lineJoin = "round";
819
+ for (const stroke of strokes) {
820
+ ctx.beginPath();
821
+ traceStroke(ctx, stroke);
822
+ ctx.stroke();
823
+ }
824
+ }
825
+ paintSilhouette(ctx, image, color, pixelScale) {
826
+ const slot = this.backgroundSlot();
827
+ const key = `${slot.width}x${slot.height}@${pixelScale}`;
828
+ const cached = this.silhouette;
829
+ if (cached?.image !== image || cached.color !== color || cached.key !== key) {
830
+ const scratch = this.document.createElement("canvas");
831
+ scratch.width = Math.max(1, Math.round(slot.width * pixelScale));
832
+ scratch.height = Math.max(1, Math.round(slot.height * pixelScale));
833
+ const s = scratch.getContext("2d");
834
+ if (!s) return;
835
+ const r = containRect(image.naturalWidth, image.naturalHeight, slot.width, slot.height);
836
+ s.setTransform(pixelScale, 0, 0, pixelScale, 0, 0);
837
+ s.drawImage(image, r.x, r.y, r.width, r.height);
838
+ s.globalCompositeOperation = "source-in";
839
+ s.fillStyle = color;
840
+ s.fillRect(0, 0, slot.width, slot.height);
841
+ this.silhouette = {
842
+ image,
843
+ color,
844
+ key,
845
+ canvas: scratch
846
+ };
847
+ }
848
+ ctx.drawImage(this.silhouette.canvas, slot.x, slot.y, slot.width, slot.height);
849
+ }
850
+ ctx() {
851
+ if (this.context === void 0) this.context = this.canvasEl().nativeElement.getContext("2d") ?? null;
852
+ return this.context;
853
+ }
854
+ inkColor() {
855
+ return getComputedStyle(this.canvasEl().nativeElement).color;
856
+ }
857
+ inkWidth() {
858
+ const canvas = this.canvasEl().nativeElement;
859
+ const raw = getComputedStyle(canvas).getPropertyValue("--_field-sign-ink-width").trim();
860
+ const value = parseFloat(raw);
861
+ return raw.endsWith("px") && Number.isFinite(value) && value > 0 ? value : FALLBACK_INK_WIDTH;
862
+ }
863
+ static {
864
+ this.ɵfac = i0.ɵɵngDeclareFactory({
865
+ minVersion: "12.0.0",
866
+ version: "22.3.0",
867
+ ngImport: i0,
868
+ type: UiFieldSign,
869
+ deps: [],
870
+ target: i0.ɵɵFactoryTarget.Component
871
+ });
872
+ }
873
+ static {
874
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
875
+ minVersion: "17.0.0",
876
+ version: "22.3.0",
877
+ type: UiFieldSign,
878
+ isStandalone: true,
879
+ selector: "ui-field-sign",
880
+ inputs: {
881
+ exportColor: {
882
+ classPropertyName: "exportColor",
883
+ publicName: "exportColor",
884
+ isSignal: true,
885
+ isRequired: false,
886
+ transformFunction: null
887
+ },
888
+ format: {
889
+ classPropertyName: "format",
890
+ publicName: "format",
891
+ isSignal: true,
892
+ isRequired: false,
893
+ transformFunction: null
894
+ },
895
+ placeholder: {
896
+ classPropertyName: "placeholder",
897
+ publicName: "placeholder",
898
+ isSignal: true,
899
+ isRequired: false,
900
+ transformFunction: null
901
+ },
902
+ clearable: {
903
+ classPropertyName: "clearable",
904
+ publicName: "clearable",
905
+ isSignal: true,
906
+ isRequired: false,
907
+ transformFunction: null
908
+ },
909
+ clearAriaLabel: {
910
+ classPropertyName: "clearAriaLabel",
911
+ publicName: "clearAriaLabel",
912
+ isSignal: true,
913
+ isRequired: false,
914
+ transformFunction: null
915
+ },
916
+ signedLabel: {
917
+ classPropertyName: "signedLabel",
918
+ publicName: "signedLabel",
919
+ isSignal: true,
920
+ isRequired: false,
921
+ transformFunction: null
922
+ },
923
+ requiredLabel: {
924
+ classPropertyName: "requiredLabel",
925
+ publicName: "requiredLabel",
926
+ isSignal: true,
927
+ isRequired: false,
928
+ transformFunction: null
929
+ },
930
+ unreadableLabel: {
931
+ classPropertyName: "unreadableLabel",
932
+ publicName: "unreadableLabel",
933
+ isSignal: true,
934
+ isRequired: false,
935
+ transformFunction: null
936
+ }
937
+ },
938
+ outputs: {
939
+ valueChange: "valueChange",
940
+ padFocus: "padFocus",
941
+ padBlur: "padBlur",
942
+ imageError: "imageError"
943
+ },
944
+ providers: [{
945
+ provide: NG_VALUE_ACCESSOR,
946
+ useExisting: forwardRef(() => UiFieldSign),
947
+ multi: true
948
+ }],
949
+ viewQueries: [{
950
+ propertyName: "canvasEl",
951
+ first: true,
952
+ predicate: ["canvasEl"],
953
+ descendants: true,
954
+ isSignal: true
955
+ }],
956
+ usesInheritance: true,
957
+ ngImport: i0,
958
+ template: "<ui-field\n multiline\n [label]=\"label()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"fieldLevel()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n>\n <!-- No `for` on the label: a <canvas> is not labelable. The name reaches it through\n `aria-label` below, and `floatLabel` is not forwarded — there is no value for a\n resting label to stand in for, the box being the drawing itself. -->\n <div class=\"ui-field-sign-pad\" [class._small]=\"size() === 'small'\">\n <canvas\n #canvasEl\n class=\"ui-field-sign-canvas\"\n role=\"img\"\n [class._disabled]=\"isDisabled()\"\n [class._interactive]=\"isInteractive()\"\n [id]=\"resolvedId()\"\n [attr.tabindex]=\"isDisabled() ? null : (tabindex() ?? 0)\"\n [attr.aria-label]=\"label() || ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"describedByIds()\"\n [attr.aria-disabled]=\"isDisabled() ? 'true' : null\"\n (pointerdown)=\"onPointerDown($event)\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerup)=\"onPointerEnd($event)\"\n (pointercancel)=\"onPointerEnd($event)\"\n (lostpointercapture)=\"onPointerEnd($event)\"\n (keydown)=\"onKeydown($event)\"\n (focus)=\"padFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n ></canvas>\n\n @if (showUnreadable()) {\n <span class=\"ui-field-sign-placeholder\" [class._disabled]=\"isDisabled()\" aria-hidden=\"true\">\n {{ unreadableLabel() }}\n </span>\n } @else if (isEmpty() && placeholder()) {\n <span class=\"ui-field-sign-placeholder\" [class._disabled]=\"isDisabled()\" aria-hidden=\"true\">\n {{ placeholder() }}\n </span>\n }\n\n <!-- The state, for assistive tech: `aria-describedby` reads hidden nodes. -->\n <span hidden [id]=\"statusId()\">{{ statusText() }}</span>\n </div>\n\n @if (clearable() && !readonly()) {\n <button\n uiFieldSuffix\n type=\"button\"\n class=\"ui-field-sign-clear\"\n [class._small]=\"size() === 'small'\"\n [attr.aria-label]=\"clearAriaLabel()\"\n [disabled]=\"isDisabled() || !canClear()\"\n (click)=\"onClearClick()\"\n >\n <ui-icon name=\"eraser\" [size]=\"iconSize()\" />\n </button>\n }\n</ui-field>\n",
959
+ styles: ["@property --_field-sign-ink-width{syntax: \"<length>\"; inherits: false; initial-value: 2px;}.ui-field-sign-pad{display:grid;grid-template:minmax(0,1fr)/minmax(0,1fr);flex:1 1 auto;min-width:0;height:var(--ui-field-sign-height, calc(4 * var(--size-components-default)))}.ui-field-sign-pad>*{grid-area:1/1}.ui-field-sign-pad._small{height:var(--ui-field-sign-height-small, calc(3 * var(--size-components-sm)))}.ui-field-sign-canvas{--_field-sign-ink-width: var(--ui-field-sign-ink-stroke-width, var(--stroke-default));display:block;width:100%;height:100%;min-width:0;min-height:0;color:var(--ui-field-sign-ink-color, var(--form-high-content-default));outline:none;user-select:none;-webkit-user-select:none}.ui-field-sign-canvas._interactive{cursor:crosshair;touch-action:none}.ui-field-sign-canvas._disabled{color:var(--ui-field-sign-ink-color-disabled, var(--form-high-content-disabled));cursor:not-allowed}.ui-field-sign-placeholder{place-self:center;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--ui-field-sign-placeholder-font-size, var(--size-typography-text-default));color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));pointer-events:none;-webkit-user-select:none;user-select:none}.ui-field-sign-placeholder._disabled{color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-field-sign-pad._small .ui-field-sign-placeholder{font-size:var(--ui-field-sign-placeholder-font-size-small, var(--size-typography-text-md))}.ui-field-sign-clear{display:flex;align-items:center;justify-content:center;align-self:stretch;aspect-ratio:1;flex-shrink:0;padding:0;border:none;background:none;color:var(--ui-form-field-action-color, var(--form-low-content-default));cursor:pointer;transition:color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-field-sign-clear:hover:not(:disabled){color:var(--ui-form-field-action-color-hover, var(--form-high-content-hover));background-color:var(--ui-form-field-action-surface-hover, var(--form-high-surface-hover))}.ui-field-sign-clear:focus-visible{outline:none;color:var(--ui-form-field-action-color-focus, var(--form-high-content-focused));background-color:var(--ui-form-field-action-surface-focus, var(--form-high-surface-focused))}.ui-field-sign-clear:disabled{cursor:not-allowed;color:var(--ui-form-field-action-color-disabled, var(--form-high-content-disabled))}.ui-field-sign-clear{align-self:flex-start;height:var(--ui-field-sign-action-height, var(--ui-form-field-height, var(--size-components-default)))}.ui-field-sign-clear._small{height:var(--ui-field-sign-action-height-small, var(--ui-form-field-height-small, var(--size-components-sm)))}\n"],
960
+ dependencies: [{
961
+ kind: "component",
962
+ type: UiField,
963
+ selector: "ui-field",
964
+ inputs: [
965
+ "label",
966
+ "for",
967
+ "required",
968
+ "size",
969
+ "level",
970
+ "floatLabel",
971
+ "filled",
972
+ "disabled",
973
+ "readonly",
974
+ "multiline",
975
+ "autoHeight",
976
+ "message",
977
+ "messageId",
978
+ "showMessageIcon",
979
+ "messageIcon",
980
+ "hasFooter",
981
+ "hasPrefix"
982
+ ]
983
+ }, {
984
+ kind: "component",
985
+ type: UiIcon,
986
+ selector: "ui-icon",
987
+ inputs: [
988
+ "name",
989
+ "size",
990
+ "type",
991
+ "family",
992
+ "decorative",
993
+ "ariaLabel"
994
+ ]
995
+ }]
996
+ });
997
+ }
998
+ };
999
+ i0.ɵɵngDeclareClassMetadata({
1000
+ minVersion: "12.0.0",
1001
+ version: "22.3.0",
1002
+ ngImport: i0,
1003
+ type: UiFieldSign,
1004
+ decorators: [{
1005
+ type: Component,
1006
+ args: [{
1007
+ selector: "ui-field-sign",
1008
+ imports: [UiField, UiIcon],
1009
+ providers: [{
1010
+ provide: NG_VALUE_ACCESSOR,
1011
+ useExisting: forwardRef(() => UiFieldSign),
1012
+ multi: true
1013
+ }],
1014
+ template: "<ui-field\n multiline\n [label]=\"label()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"fieldLevel()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n>\n <!-- No `for` on the label: a <canvas> is not labelable. The name reaches it through\n `aria-label` below, and `floatLabel` is not forwarded — there is no value for a\n resting label to stand in for, the box being the drawing itself. -->\n <div class=\"ui-field-sign-pad\" [class._small]=\"size() === 'small'\">\n <canvas\n #canvasEl\n class=\"ui-field-sign-canvas\"\n role=\"img\"\n [class._disabled]=\"isDisabled()\"\n [class._interactive]=\"isInteractive()\"\n [id]=\"resolvedId()\"\n [attr.tabindex]=\"isDisabled() ? null : (tabindex() ?? 0)\"\n [attr.aria-label]=\"label() || ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"describedByIds()\"\n [attr.aria-disabled]=\"isDisabled() ? 'true' : null\"\n (pointerdown)=\"onPointerDown($event)\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerup)=\"onPointerEnd($event)\"\n (pointercancel)=\"onPointerEnd($event)\"\n (lostpointercapture)=\"onPointerEnd($event)\"\n (keydown)=\"onKeydown($event)\"\n (focus)=\"padFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n ></canvas>\n\n @if (showUnreadable()) {\n <span class=\"ui-field-sign-placeholder\" [class._disabled]=\"isDisabled()\" aria-hidden=\"true\">\n {{ unreadableLabel() }}\n </span>\n } @else if (isEmpty() && placeholder()) {\n <span class=\"ui-field-sign-placeholder\" [class._disabled]=\"isDisabled()\" aria-hidden=\"true\">\n {{ placeholder() }}\n </span>\n }\n\n <!-- The state, for assistive tech: `aria-describedby` reads hidden nodes. -->\n <span hidden [id]=\"statusId()\">{{ statusText() }}</span>\n </div>\n\n @if (clearable() && !readonly()) {\n <button\n uiFieldSuffix\n type=\"button\"\n class=\"ui-field-sign-clear\"\n [class._small]=\"size() === 'small'\"\n [attr.aria-label]=\"clearAriaLabel()\"\n [disabled]=\"isDisabled() || !canClear()\"\n (click)=\"onClearClick()\"\n >\n <ui-icon name=\"eraser\" [size]=\"iconSize()\" />\n </button>\n }\n</ui-field>\n",
1015
+ styles: ["@property --_field-sign-ink-width{syntax: \"<length>\"; inherits: false; initial-value: 2px;}.ui-field-sign-pad{display:grid;grid-template:minmax(0,1fr)/minmax(0,1fr);flex:1 1 auto;min-width:0;height:var(--ui-field-sign-height, calc(4 * var(--size-components-default)))}.ui-field-sign-pad>*{grid-area:1/1}.ui-field-sign-pad._small{height:var(--ui-field-sign-height-small, calc(3 * var(--size-components-sm)))}.ui-field-sign-canvas{--_field-sign-ink-width: var(--ui-field-sign-ink-stroke-width, var(--stroke-default));display:block;width:100%;height:100%;min-width:0;min-height:0;color:var(--ui-field-sign-ink-color, var(--form-high-content-default));outline:none;user-select:none;-webkit-user-select:none}.ui-field-sign-canvas._interactive{cursor:crosshair;touch-action:none}.ui-field-sign-canvas._disabled{color:var(--ui-field-sign-ink-color-disabled, var(--form-high-content-disabled));cursor:not-allowed}.ui-field-sign-placeholder{place-self:center;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--ui-field-sign-placeholder-font-size, var(--size-typography-text-default));color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));pointer-events:none;-webkit-user-select:none;user-select:none}.ui-field-sign-placeholder._disabled{color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-field-sign-pad._small .ui-field-sign-placeholder{font-size:var(--ui-field-sign-placeholder-font-size-small, var(--size-typography-text-md))}.ui-field-sign-clear{display:flex;align-items:center;justify-content:center;align-self:stretch;aspect-ratio:1;flex-shrink:0;padding:0;border:none;background:none;color:var(--ui-form-field-action-color, var(--form-low-content-default));cursor:pointer;transition:color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-field-sign-clear:hover:not(:disabled){color:var(--ui-form-field-action-color-hover, var(--form-high-content-hover));background-color:var(--ui-form-field-action-surface-hover, var(--form-high-surface-hover))}.ui-field-sign-clear:focus-visible{outline:none;color:var(--ui-form-field-action-color-focus, var(--form-high-content-focused));background-color:var(--ui-form-field-action-surface-focus, var(--form-high-surface-focused))}.ui-field-sign-clear:disabled{cursor:not-allowed;color:var(--ui-form-field-action-color-disabled, var(--form-high-content-disabled))}.ui-field-sign-clear{align-self:flex-start;height:var(--ui-field-sign-action-height, var(--ui-form-field-height, var(--size-components-default)))}.ui-field-sign-clear._small{height:var(--ui-field-sign-action-height-small, var(--ui-form-field-height-small, var(--size-components-sm)))}\n"]
1016
+ }]
1017
+ }],
1018
+ ctorParameters: () => [],
1019
+ propDecorators: {
1020
+ exportColor: [{
1021
+ type: i0.Input,
1022
+ args: [{
1023
+ isSignal: true,
1024
+ alias: "exportColor",
1025
+ required: false
1026
+ }]
1027
+ }],
1028
+ format: [{
1029
+ type: i0.Input,
1030
+ args: [{
1031
+ isSignal: true,
1032
+ alias: "format",
1033
+ required: false
1034
+ }]
1035
+ }],
1036
+ placeholder: [{
1037
+ type: i0.Input,
1038
+ args: [{
1039
+ isSignal: true,
1040
+ alias: "placeholder",
1041
+ required: false
1042
+ }]
1043
+ }],
1044
+ clearable: [{
1045
+ type: i0.Input,
1046
+ args: [{
1047
+ isSignal: true,
1048
+ alias: "clearable",
1049
+ required: false
1050
+ }]
1051
+ }],
1052
+ clearAriaLabel: [{
1053
+ type: i0.Input,
1054
+ args: [{
1055
+ isSignal: true,
1056
+ alias: "clearAriaLabel",
1057
+ required: false
1058
+ }]
1059
+ }],
1060
+ signedLabel: [{
1061
+ type: i0.Input,
1062
+ args: [{
1063
+ isSignal: true,
1064
+ alias: "signedLabel",
1065
+ required: false
1066
+ }]
1067
+ }],
1068
+ requiredLabel: [{
1069
+ type: i0.Input,
1070
+ args: [{
1071
+ isSignal: true,
1072
+ alias: "requiredLabel",
1073
+ required: false
1074
+ }]
1075
+ }],
1076
+ unreadableLabel: [{
1077
+ type: i0.Input,
1078
+ args: [{
1079
+ isSignal: true,
1080
+ alias: "unreadableLabel",
1081
+ required: false
1082
+ }]
1083
+ }],
1084
+ valueChange: [{
1085
+ type: i0.Output,
1086
+ args: ["valueChange"]
1087
+ }],
1088
+ padFocus: [{
1089
+ type: i0.Output,
1090
+ args: ["padFocus"]
1091
+ }],
1092
+ padBlur: [{
1093
+ type: i0.Output,
1094
+ args: ["padBlur"]
1095
+ }],
1096
+ imageError: [{
1097
+ type: i0.Output,
1098
+ args: ["imageError"]
1099
+ }],
1100
+ canvasEl: [{
1101
+ type: i0.ViewChild,
1102
+ args: ["canvasEl", { isSignal: true }]
1103
+ }]
1104
+ }
1105
+ });
1106
+ export { UiFieldSign };
1107
+
1108
+ //# sourceMappingURL=4sh-ui-kit-forms-ui-field-sign.mjs.map