@4sh/ui-kit 0.16.0 → 0.17.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.
- package/README.fr.md +10 -10
- package/README.md +10 -10
- package/fesm2022/4sh-ui-kit-actions-ui-button-split.mjs +542 -150
- package/fesm2022/4sh-ui-kit-actions-ui-button-split.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-actions-ui-button.mjs +622 -248
- package/fesm2022/4sh-ui-kit-actions-ui-button.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-actions-ui-link.mjs +385 -152
- package/fesm2022/4sh-ui-kit-actions-ui-link.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-actions-ui-speed-dial.mjs +748 -433
- package/fesm2022/4sh-ui-kit-actions-ui-speed-dial.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-base-ui-icon.mjs +227 -135
- package/fesm2022/4sh-ui-kit-base-ui-icon.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-base-ui-image.mjs +1200 -633
- package/fesm2022/4sh-ui-kit-base-ui-image.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-autocomplete.mjs +1675 -1000
- package/fesm2022/4sh-ui-kit-forms-ui-autocomplete.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-checkbox.mjs +243 -117
- package/fesm2022/4sh-ui-kit-forms-ui-checkbox.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs +2294 -2048
- package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-editor.mjs +1058 -1113
- package/fesm2022/4sh-ui-kit-forms-ui-editor.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-field-sign.mjs +1108 -0
- package/fesm2022/4sh-ui-kit-forms-ui-field-sign.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-forms-ui-field.mjs +397 -141
- package/fesm2022/4sh-ui-kit-forms-ui-field.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-file-upload.mjs +1529 -583
- package/fesm2022/4sh-ui-kit-forms-ui-file-upload.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-date.mjs +383 -224
- package/fesm2022/4sh-ui-kit-forms-ui-input-date.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-group.mjs +345 -177
- package/fesm2022/4sh-ui-kit-forms-ui-input-group.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-mask.mjs +280 -138
- package/fesm2022/4sh-ui-kit-forms-ui-input-mask.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-number.mjs +507 -257
- package/fesm2022/4sh-ui-kit-forms-ui-input-number.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-otp.mjs +401 -312
- package/fesm2022/4sh-ui-kit-forms-ui-input-otp.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-tags.mjs +1277 -697
- package/fesm2022/4sh-ui-kit-forms-ui-input-tags.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input.mjs +467 -199
- package/fesm2022/4sh-ui-kit-forms-ui-input.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-knob.mjs +394 -270
- package/fesm2022/4sh-ui-kit-forms-ui-knob.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-label.mjs +140 -60
- package/fesm2022/4sh-ui-kit-forms-ui-label.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-nudger.mjs +386 -167
- package/fesm2022/4sh-ui-kit-forms-ui-nudger.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-radio.mjs +150 -87
- package/fesm2022/4sh-ui-kit-forms-ui-radio.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-rating.mjs +345 -180
- package/fesm2022/4sh-ui-kit-forms-ui-rating.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-segment-control.mjs +582 -392
- package/fesm2022/4sh-ui-kit-forms-ui-segment-control.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-select.mjs +1552 -888
- package/fesm2022/4sh-ui-kit-forms-ui-select.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-slider.mjs +485 -338
- package/fesm2022/4sh-ui-kit-forms-ui-slider.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-swatch-picker.mjs +503 -311
- package/fesm2022/4sh-ui-kit-forms-ui-swatch-picker.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-textarea.mjs +271 -137
- package/fesm2022/4sh-ui-kit-forms-ui-textarea.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-toggle-block.mjs +457 -214
- package/fesm2022/4sh-ui-kit-forms-ui-toggle-block.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-toggle-button.mjs +711 -371
- package/fesm2022/4sh-ui-kit-forms-ui-toggle-button.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-toggle.mjs +235 -121
- package/fesm2022/4sh-ui-kit-forms-ui-toggle.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms.mjs +721 -638
- package/fesm2022/4sh-ui-kit-forms.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-accordion.mjs +546 -242
- package/fesm2022/4sh-ui-kit-informative-ui-accordion.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-alert.mjs +335 -157
- package/fesm2022/4sh-ui-kit-informative-ui-alert.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-avatar-group.mjs +53 -33
- package/fesm2022/4sh-ui-kit-informative-ui-avatar-group.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-avatar.mjs +218 -121
- package/fesm2022/4sh-ui-kit-informative-ui-avatar.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-badge.mjs +192 -100
- package/fesm2022/4sh-ui-kit-informative-ui-badge.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-chip.mjs +456 -204
- package/fesm2022/4sh-ui-kit-informative-ui-chip.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-empty-state.mjs +314 -147
- package/fesm2022/4sh-ui-kit-informative-ui-empty-state.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-helper.mjs +179 -82
- package/fesm2022/4sh-ui-kit-informative-ui-helper.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-progress-bar.mjs +268 -123
- package/fesm2022/4sh-ui-kit-informative-ui-progress-bar.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-read-only.mjs +391 -146
- package/fesm2022/4sh-ui-kit-informative-ui-read-only.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-separator.mjs +158 -76
- package/fesm2022/4sh-ui-kit-informative-ui-separator.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-skeleton.mjs +159 -80
- package/fesm2022/4sh-ui-kit-informative-ui-skeleton.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-spinner.mjs +295 -131
- package/fesm2022/4sh-ui-kit-informative-ui-spinner.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-tag.mjs +211 -83
- package/fesm2022/4sh-ui-kit-informative-ui-tag.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-toast.mjs +784 -414
- package/fesm2022/4sh-ui-kit-informative-ui-toast.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-tooltip.mjs +822 -476
- package/fesm2022/4sh-ui-kit-informative-ui-tooltip.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-layout-ui-bottom-sheet.mjs +1014 -599
- package/fesm2022/4sh-ui-kit-layout-ui-bottom-sheet.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-layout-ui-card.mjs +403 -189
- package/fesm2022/4sh-ui-kit-layout-ui-card.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-layout-ui-drawer.mjs +707 -272
- package/fesm2022/4sh-ui-kit-layout-ui-drawer.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-layout-ui-modal.mjs +1146 -568
- package/fesm2022/4sh-ui-kit-layout-ui-modal.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-layout-ui-popover.mjs +519 -308
- package/fesm2022/4sh-ui-kit-layout-ui-popover.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-motion.mjs +252 -150
- package/fesm2022/4sh-ui-kit-motion.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-bottom-tab-bar.mjs +793 -341
- package/fesm2022/4sh-ui-kit-navigation-ui-bottom-tab-bar.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-breadcrumb.mjs +351 -194
- package/fesm2022/4sh-ui-kit-navigation-ui-breadcrumb.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-context-menu.mjs +511 -220
- package/fesm2022/4sh-ui-kit-navigation-ui-context-menu.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-menu.mjs +910 -548
- package/fesm2022/4sh-ui-kit-navigation-ui-menu.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-sidebar.mjs +1128 -555
- package/fesm2022/4sh-ui-kit-navigation-ui-sidebar.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-stepper.mjs +915 -470
- package/fesm2022/4sh-ui-kit-navigation-ui-stepper.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-tabs.mjs +931 -474
- package/fesm2022/4sh-ui-kit-navigation-ui-tabs.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-overlay.mjs +26 -109
- package/fesm2022/4sh-ui-kit-overlay.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-ripple.mjs +329 -290
- package/fesm2022/4sh-ui-kit-ripple.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-table-ui-paginator.mjs +709 -248
- package/fesm2022/4sh-ui-kit-table-ui-paginator.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-table-ui-table.mjs +2633 -1370
- package/fesm2022/4sh-ui-kit-table-ui-table.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-theming.mjs +112 -113
- package/fesm2022/4sh-ui-kit-theming.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-types.mjs +0 -12
- package/fesm2022/4sh-ui-kit.mjs +3 -15
- package/fesm2022/4sh-ui-kit.mjs.map +1 -1
- package/mcp/data/component-api.json +299 -2
- package/mcp/data/text-search-docs.json +149 -9
- package/mcp/data/ui-config.json +378 -1
- package/mcp/index.js +8190 -2876
- package/mcp/package.json +1 -1
- package/package.json +5 -1
- package/styles/component-vars.scss +22 -1
- package/types/4sh-ui-kit-actions-ui-button-split.d.ts +198 -87
- package/types/4sh-ui-kit-actions-ui-button.d.ts +240 -116
- package/types/4sh-ui-kit-actions-ui-link.d.ts +136 -67
- package/types/4sh-ui-kit-actions-ui-speed-dial.d.ts +287 -180
- package/types/4sh-ui-kit-base-ui-icon.d.ts +92 -58
- package/types/4sh-ui-kit-base-ui-image.d.ts +406 -205
- package/types/4sh-ui-kit-forms-ui-autocomplete.d.ts +573 -376
- package/types/4sh-ui-kit-forms-ui-checkbox.d.ts +77 -42
- package/types/4sh-ui-kit-forms-ui-datepicker.d.ts +953 -700
- package/types/4sh-ui-kit-forms-ui-editor.d.ts +374 -340
- package/types/4sh-ui-kit-forms-ui-field-sign.d.ts +325 -0
- package/types/4sh-ui-kit-forms-ui-field.d.ts +150 -64
- package/types/4sh-ui-kit-forms-ui-file-upload.d.ts +583 -241
- package/types/4sh-ui-kit-forms-ui-input-date.d.ts +152 -103
- package/types/4sh-ui-kit-forms-ui-input-group.d.ts +109 -63
- package/types/4sh-ui-kit-forms-ui-input-mask.d.ts +93 -59
- package/types/4sh-ui-kit-forms-ui-input-number.d.ts +171 -96
- package/types/4sh-ui-kit-forms-ui-input-otp.d.ts +137 -104
- package/types/4sh-ui-kit-forms-ui-input-tags.d.ts +469 -309
- package/types/4sh-ui-kit-forms-ui-input.d.ts +198 -118
- package/types/4sh-ui-kit-forms-ui-knob.d.ts +132 -80
- package/types/4sh-ui-kit-forms-ui-label.d.ts +47 -22
- package/types/4sh-ui-kit-forms-ui-nudger.d.ts +134 -67
- package/types/4sh-ui-kit-forms-ui-radio.d.ts +48 -33
- package/types/4sh-ui-kit-forms-ui-rating.d.ts +120 -86
- package/types/4sh-ui-kit-forms-ui-segment-control.d.ts +221 -147
- package/types/4sh-ui-kit-forms-ui-select.d.ts +561 -357
- package/types/4sh-ui-kit-forms-ui-slider.d.ts +156 -105
- package/types/4sh-ui-kit-forms-ui-swatch-picker.d.ts +133 -97
- package/types/4sh-ui-kit-forms-ui-textarea.d.ts +90 -56
- package/types/4sh-ui-kit-forms-ui-toggle-block.d.ts +158 -94
- package/types/4sh-ui-kit-forms-ui-toggle-button.d.ts +314 -178
- package/types/4sh-ui-kit-forms-ui-toggle.d.ts +88 -54
- package/types/4sh-ui-kit-forms.d.ts +275 -194
- package/types/4sh-ui-kit-informative-ui-accordion.d.ts +162 -92
- package/types/4sh-ui-kit-informative-ui-alert.d.ts +128 -62
- package/types/4sh-ui-kit-informative-ui-avatar-group.d.ts +8 -8
- package/types/4sh-ui-kit-informative-ui-avatar.d.ts +81 -44
- package/types/4sh-ui-kit-informative-ui-badge.d.ts +71 -41
- package/types/4sh-ui-kit-informative-ui-chip.d.ts +194 -99
- package/types/4sh-ui-kit-informative-ui-empty-state.d.ts +105 -65
- package/types/4sh-ui-kit-informative-ui-helper.d.ts +64 -34
- package/types/4sh-ui-kit-informative-ui-progress-bar.d.ts +120 -65
- package/types/4sh-ui-kit-informative-ui-read-only.d.ts +147 -67
- package/types/4sh-ui-kit-informative-ui-separator.d.ts +65 -35
- package/types/4sh-ui-kit-informative-ui-skeleton.d.ts +62 -32
- package/types/4sh-ui-kit-informative-ui-spinner.d.ts +111 -50
- package/types/4sh-ui-kit-informative-ui-tag.d.ts +77 -37
- package/types/4sh-ui-kit-informative-ui-toast.d.ts +300 -180
- package/types/4sh-ui-kit-informative-ui-tooltip.d.ts +269 -141
- package/types/4sh-ui-kit-layout-ui-bottom-sheet.d.ts +360 -221
- package/types/4sh-ui-kit-layout-ui-card.d.ts +119 -79
- package/types/4sh-ui-kit-layout-ui-drawer.d.ts +244 -120
- package/types/4sh-ui-kit-layout-ui-modal.d.ts +409 -222
- package/types/4sh-ui-kit-layout-ui-popover.d.ts +149 -91
- package/types/4sh-ui-kit-motion.d.ts +117 -67
- package/types/4sh-ui-kit-navigation-ui-bottom-tab-bar.d.ts +279 -145
- package/types/4sh-ui-kit-navigation-ui-breadcrumb.d.ts +134 -96
- package/types/4sh-ui-kit-navigation-ui-context-menu.d.ts +148 -89
- package/types/4sh-ui-kit-navigation-ui-menu.d.ts +282 -201
- package/types/4sh-ui-kit-navigation-ui-sidebar.d.ts +425 -261
- package/types/4sh-ui-kit-navigation-ui-stepper.d.ts +279 -183
- package/types/4sh-ui-kit-navigation-ui-tabs.d.ts +275 -173
- package/types/4sh-ui-kit-overlay.d.ts +6 -6
- package/types/4sh-ui-kit-ripple.d.ts +99 -74
- package/types/4sh-ui-kit-table-ui-paginator.d.ts +237 -133
- package/types/4sh-ui-kit-table-ui-table.d.ts +769 -470
- package/types/4sh-ui-kit-theming.d.ts +27 -29
- package/types/4sh-ui-kit-types.d.ts +6 -5
- package/types/4sh-ui-kit.d.ts +4 -3
- package/fesm2022/4sh-ui-kit-types.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"4sh-ui-kit-forms-ui-field-sign.mjs","names":[],"sources":["../../../projects/ui-kit/forms/ui-field-sign/src/lib/ui-field-sign-strokes.ts","../../../projects/ui-kit/forms/ui-field-sign/src/lib/ui-field-sign-svg.ts","../../../projects/ui-kit/forms/ui-field-sign/src/lib/ui-field-sign.ts","../../../projects/ui-kit/forms/ui-field-sign/src/lib/ui-field-sign.html"],"sourcesContent":["/**\n * Pure geometry of `ui-field-sign`: how a stroke is smoothed, and how a set of strokes\n * becomes an SVG. No DOM, no canvas — the component and the tests share this one path\n * builder, so what is drawn on screen and what is exported cannot drift apart.\n */\n\n/** A point of a stroke, in CSS pixels from the top-left corner of the drawing area. */\nexport interface SignPoint {\n readonly x: number;\n readonly y: number;\n}\n\n/** One continuous stroke: everything between a pointer going down and coming back up. */\nexport type SignStroke = readonly SignPoint[];\n\n/**\n * The subset of `CanvasRenderingContext2D` / `Path2D` a stroke is traced with — also\n * implemented by {@link SvgPathBuilder}, which is how the SVG export reuses the exact\n * curve drawn on screen.\n */\nexport interface SignPathSink {\n moveTo(x: number, y: number): void;\n lineTo(x: number, y: number): void;\n quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;\n}\n\n/**\n * Length given to a tap (the dot of an \"i\"). A zero-length segment is not painted by every\n * renderer even with round caps — the canvas spec prunes it, so do some PDF converters. Two\n * tenths of a pixel survive the SVG export's rounding (a tenth could round back onto the\n * start point) and still read as a dot.\n */\nconst DOT_LENGTH = 0.2;\n\n/** A coordinate as the SVG export writes it: in tenths of a pixel. */\nconst tenths = (n: number): number => Math.round(n * 10);\n\n/**\n * Whether `stroke` is a tap: every point lands on the first once rounded as the export\n * rounds them. A finger or a stylus that does not move still sends `pointermove` events, at\n * the same spot or a hair away — exported as is, that would be a zero-length segment.\n */\nexport function isTap(stroke: SignStroke): boolean {\n if (stroke.length === 0) return false;\n const [first] = stroke;\n const x = tenths(first.x);\n const y = tenths(first.y);\n return stroke.every((p) => tenths(p.x) === x && tenths(p.y) === y);\n}\n\n/**\n * Traces `stroke` into `sink`, smoothed: each point becomes the control point of a\n * quadratic curve running between the midpoints of its two segments. The curve still\n * starts on the first point and ends on the last, so a stroke never loses its ends.\n */\nexport function traceStroke(sink: SignPathSink, stroke: SignStroke): void {\n if (stroke.length === 0) return;\n const [first] = stroke;\n sink.moveTo(first.x, first.y);\n if (isTap(stroke)) {\n sink.lineTo(first.x + DOT_LENGTH, first.y);\n return;\n }\n for (let i = 1; i < stroke.length - 1; i++) {\n const p = stroke[i];\n const next = stroke[i + 1];\n sink.quadraticCurveTo(p.x, p.y, (p.x + next.x) / 2, (p.y + next.y) / 2);\n }\n const last = stroke[stroke.length - 1];\n sink.lineTo(last.x, last.y);\n}\n\n/** Rounds to a tenth of a pixel: below what a screen or a printer resolves, and it keeps\n * the exported path short. */\nconst round = (n: number): string => String(Math.round(n * 10) / 10);\n\n/** Records traced commands as an SVG path `d` attribute. */\nexport class SvgPathBuilder implements SignPathSink {\n private readonly parts: string[] = [];\n\n moveTo(x: number, y: number): void {\n this.parts.push(`M${round(x)} ${round(y)}`);\n }\n\n lineTo(x: number, y: number): void {\n this.parts.push(`L${round(x)} ${round(y)}`);\n }\n\n quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void {\n this.parts.push(`Q${round(cpx)} ${round(cpy)} ${round(x)} ${round(y)}`);\n }\n\n toString(): string {\n return this.parts.join('');\n }\n}\n\n/** Smoothed SVG path of one stroke (`''` for an empty one). */\nexport function strokeToPath(stroke: SignStroke): string {\n const builder = new SvgPathBuilder();\n traceStroke(builder, stroke);\n return builder.toString();\n}\n\n/** An axis-aligned rectangle, in CSS pixels of the drawing space. */\nexport interface SignRect {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n}\n\n/**\n * Bounding box of every point of `strokes` — the segment a tap is drawn as included — grown by\n * `pad` on each side (half the ink width, so a round cap is not shaved off). `null` when there\n * is no point at all.\n */\nexport function strokesBounds(strokes: readonly SignStroke[], pad = 0): SignRect | null {\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n const add = (x: number, y: number) => {\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n };\n for (const stroke of strokes) {\n for (const { x, y } of stroke) add(x, y);\n if (isTap(stroke)) add(stroke[0].x + DOT_LENGTH, stroke[0].y);\n }\n if (minX === Infinity) return null;\n return {\n x: minX - pad,\n y: minY - pad,\n width: maxX - minX + 2 * pad,\n height: maxY - minY + 2 * pad,\n };\n}\n\n/** Smallest rectangle holding both — `b` may be `null`. */\nexport function unionRect(a: SignRect, b: SignRect | null): SignRect {\n if (!b) return a;\n const x = Math.min(a.x, b.x);\n const y = Math.min(a.y, b.y);\n return {\n x,\n y,\n width: Math.max(a.x + a.width, b.x + b.width) - x,\n height: Math.max(a.y + a.height, b.y + b.height) - y,\n };\n}\n\n/**\n * Images the field accepts as a previous signature: an image **data URL**, what it emits\n * itself. A remote URL is refused on purpose — drawn on a canvas it taints it (the PNG export\n * then throws), and carried into an SVG export it would be fetched by whatever renders it.\n */\nexport const IMAGE_DATA_URL = /^data:image\\/(png|jpeg|webp|svg\\+xml)[;,]/i;\n\n/** Uniform scale then translation: `p × scale + (x, y)`. */\nexport interface SignTransform {\n readonly scale: number;\n readonly x: number;\n readonly y: number;\n}\n\n/** What a layer of a previous export paints: an image, or a group of strokes in one ink. */\nexport type SignSvgLayer =\n | {\n readonly kind: 'image';\n readonly href: string;\n readonly rect: SignRect;\n readonly transform: SignTransform;\n }\n | {\n readonly kind: 'ink';\n readonly paths: readonly string[];\n readonly color: string;\n readonly width: number;\n readonly transform: SignTransform;\n };\n\n/** One of this field's own SVG exports, read back: its frame and its layers, bottom first. */\nexport interface SignSvgDrawing {\n readonly viewBox: SignRect;\n readonly layers: readonly SignSvgLayer[];\n}\n\n/** A previous signature laid under the strokes: fitted (`contain`, centred) into `rect`. */\nexport interface SignSvgBackground {\n readonly href: string;\n readonly rect: SignRect;\n /**\n * The same signature read back as one of this field's own exports. Its layers are then\n * copied next to the new strokes instead of nesting the whole previous value in an\n * `<image>`: a data URL nested in a data URL is encoded once more (`%3C` → `%253C`), and the\n * value would grow on every edit.\n */\n readonly drawing?: SignSvgDrawing | null;\n}\n\n/** Everything an export needs besides the strokes. */\nexport interface SignSvgOptions {\n /** Area exported, in drawing-space CSS pixels — the SVG's `viewBox`. */\n readonly frame: SignRect;\n /** Ink colour of the export (any CSS colour). */\n readonly color: string;\n /** Ink width, in CSS pixels. */\n readonly lineWidth: number;\n /** Previous signature to keep underneath (usually a data URL). */\n readonly background?: SignSvgBackground | null;\n}\n\n/**\n * Escapes a value for a double-quoted XML attribute — line breaks and tabs too, which an XML\n * parser would otherwise normalise to spaces: what is read back is what was written.\n */\nconst attr = (value: string): string =>\n value\n .replace(/&/g, '&')\n .replace(/\"/g, '"')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\\n/g, ' ')\n .replace(/\\r/g, ' ')\n .replace(/\\t/g, '	');\n\n/** `then` applied after `first`. */\nconst compose = (then: SignTransform, first: SignTransform): SignTransform => ({\n scale: first.scale * then.scale,\n x: first.x * then.scale + then.x,\n y: first.y * then.scale + then.y,\n});\n\n/** Transform that fits `source` into `target`, keeping its proportions, centred. */\nconst fitTransform = (source: SignRect, target: SignRect): SignTransform => {\n const r = containRect(source.width, source.height, target.width, target.height);\n const scale = source.width > 0 ? r.width / source.width : 1;\n return { scale, x: target.x + r.x - source.x * scale, y: target.y + r.y - source.y * scale };\n};\n\n/**\n * A scale keeps six significant digits — relative, not absolute: scaled down edit after edit,\n * a fixed number of decimals would end at `0` and the layer would vanish.\n */\nconst roundScale = (n: number): string => String(Number(n.toPrecision(6)));\n\n/** `transform` attribute, omitted for the identity. */\nconst transformAttr = ({ scale, x, y }: SignTransform): string =>\n scale === 1 && x === 0 && y === 0\n ? ''\n : ` transform=\"matrix(${roundScale(scale)} 0 0 ${roundScale(scale)} ${round(x)} ${round(y)})\"`;\n\nconst rectAttrs = (r: SignRect): string =>\n `x=\"${round(r.x)}\" y=\"${round(r.y)}\" width=\"${round(r.width)}\" height=\"${round(r.height)}\"`;\n\nconst imageElement = (href: string, rect: SignRect, transform = ''): string =>\n `<image href=\"${attr(href)}\" ${rectAttrs(rect)} preserveAspectRatio=\"xMidYMid meet\"${transform}/>`;\n\nconst inkGroup = (paths: readonly string[], color: string, width: number, transform = ''): string =>\n `<g fill=\"none\" stroke=\"${attr(color)}\" stroke-width=\"${round(width)}\" ` +\n `stroke-linecap=\"round\" stroke-linejoin=\"round\"${transform}>` +\n paths.map((d) => `<path d=\"${attr(d)}\"/>`).join('') +\n `</g>`;\n\n/** The previous signature: its own layers when it is one of this field's exports, else an image. */\nfunction backgroundMarkup(background: SignSvgBackground | null | undefined): string {\n if (!background) return '';\n const { drawing, href, rect } = background;\n if (!drawing) return imageElement(href, rect);\n const fit = fitTransform(drawing.viewBox, rect);\n return drawing.layers\n .filter((layer) => layer.kind === 'image' || layer.paths.length > 0)\n .map((layer) => {\n const transform = transformAttr(compose(fit, layer.transform));\n return layer.kind === 'image'\n ? imageElement(layer.href, layer.rect, transform)\n : inkGroup(layer.paths, layer.color, layer.width, transform);\n })\n .join('');\n}\n\n/**\n * Serializes strokes as a standalone SVG document, on a transparent background. One\n * `<path>` per stroke, round caps and joins — the same pen the canvas uses on screen.\n * A `background` is laid underneath, fitted into its rectangle the way the component\n * draws it (`contain`, centred).\n */\nexport function strokesToSvg(strokes: readonly SignStroke[], options: SignSvgOptions): string {\n const { frame, color, lineWidth, background } = options;\n const paths = strokes.filter((s) => s.length > 0).map(strokeToPath);\n return (\n `<svg xmlns=\"http://www.w3.org/2000/svg\" ` +\n `viewBox=\"${round(frame.x)} ${round(frame.y)} ${round(frame.width)} ${round(frame.height)}\" ` +\n `width=\"${round(frame.width)}\" height=\"${round(frame.height)}\">` +\n backgroundMarkup(background) +\n (paths.length > 0 ? inkGroup(paths, color, lineWidth) : '') +\n `</svg>`\n );\n}\n\n/** Data URL of an SVG document — the shape the field emits in `format=\"svg\"`. */\nexport function svgToDataUrl(svg: string): string {\n return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;\n}\n\n/**\n * Rectangle that fits a `sourceWidth × sourceHeight` image inside the drawing area while\n * keeping its proportions, centred — the canvas counterpart of the SVG export's\n * `preserveAspectRatio=\"xMidYMid meet\"`.\n */\nexport function containRect(\n sourceWidth: number,\n sourceHeight: number,\n width: number,\n height: number,\n): { x: number; y: number; width: number; height: number } {\n if (sourceWidth <= 0 || sourceHeight <= 0) return { x: 0, y: 0, width, height };\n const scale = Math.min(width / sourceWidth, height / sourceHeight);\n const w = sourceWidth * scale;\n const h = sourceHeight * scale;\n return { x: (width - w) / 2, y: (height - h) / 2, width: w, height: h };\n}\n","/**\n * Reads back an SVG value `ui-field-sign` exported itself, so that a signature edited again\n * is re-exported **flat** — its strokes copied next to the new ones — rather than nested as\n * an `<image>` whose data URL is encoded once more on every edit.\n *\n * Only this field's own shape is recognised, attribute by attribute: anything else (another\n * element, an unknown attribute, a script, a remote reference, a DOCTYPE) is \"foreign\" and the\n * caller keeps it as an image. What is recognised is rebuilt from the values read, never copied\n * as markup.\n *\n * The geometry is checked too, not only the shape. As an `<image>`, the value is clipped to its\n * viewBox; copied flat, nothing would clip it — so a layer reaching outside the viewBox (ink\n * hidden off-frame on screen, that would show in the export only) is foreign as well.\n *\n * Needs `DOMParser` (browser, jsdom); `null` without it.\n */\nimport {\n IMAGE_DATA_URL,\n type SignRect,\n type SignSvgDrawing,\n type SignSvgLayer,\n type SignTransform,\n} from './ui-field-sign-strokes';\n\nconst SVG_NS = 'http://www.w3.org/2000/svg';\nconst IDENTITY: SignTransform = { scale: 1, x: 0, y: 0 };\n\n/** A plain decimal number — no hexadecimal, no `Infinity`, which `Number()` would accept. */\nconst NUMBER = /^[+-]?(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?$/i;\n/** One command of a path the field writes: `M x y`, `L x y`, `Q cx cy x y`. */\nconst PATH_COMMAND = /([MLQ])([^MLQ]*)/g;\n/** A colour as `getComputedStyle` hands it back, or a colour keyword. */\nconst COLOR = /^(#[\\da-f]{3,8}|[a-z]+|[a-z-]+\\([\\w\\s.,%/+-]*\\))$/i;\n/** Functions that are references rather than colours. */\nconst REFERENCE_FUNCTIONS = ['url(', 'var(', 'attr(', 'env('];\n/** Keywords that carry no colour of their own. */\nconst NOT_AN_INK = new Set([\n 'none',\n 'transparent',\n 'currentcolor',\n 'inherit',\n 'initial',\n 'unset',\n 'revert',\n 'revert-layer',\n 'context-fill',\n 'context-stroke',\n]);\n/** The `transform` the field writes: a uniform scale and a translation. */\nconst MATRIX = /^matrix\\(\\s*(\\S+)\\s+0\\s+0\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s*\\)$/;\n/**\n * Rounding the export may have introduced: coordinates to a tenth of a pixel, each edge of the\n * frame too, and composed transforms on top. Far below anything a stroke could hide in.\n */\nconst SLACK = 0.5;\n\n/** Text of an SVG data URL, percent-encoded or base64. `null` for anything else. */\nexport function decodeSvgDataUrl(src: string): string | null {\n const match = /^data:image\\/svg\\+xml((?:;[^,]*)?),(.*)$/is.exec(src);\n if (!match) return null;\n try {\n if (/;base64$/i.test(match[1])) {\n const binary = atob(match[2]);\n const bytes = Uint8Array.from(binary, (c) => c.charCodeAt(0));\n return new TextDecoder().decode(bytes);\n }\n return decodeURIComponent(match[2]);\n } catch {\n return null;\n }\n}\n\n/** `value` as a finite plain number, else `NaN`. */\nconst num = (value: string | null | undefined): number => {\n const v = value?.trim() ?? '';\n const n = NUMBER.test(v) ? Number(v) : NaN;\n return Number.isFinite(n) ? n : NaN;\n};\n\n/** A colour the field could have written. */\nconst isInk = (color: string): boolean => {\n const lower = color.toLowerCase();\n return (\n COLOR.test(color) &&\n !NOT_AN_INK.has(lower) &&\n !REFERENCE_FUNCTIONS.some((f) => lower.startsWith(f))\n );\n};\n\n/** Every attribute of `el` is in `allowed`. */\nconst onlyAttributes = (el: Element, allowed: readonly string[]): boolean =>\n Array.from(el.attributes).every((a) => allowed.includes(a.name));\n\n/** Element children, `null` as soon as a node is neither an element nor blank text. */\nfunction elementChildren(el: Element): Element[] | null {\n const out: Element[] = [];\n for (const node of Array.from(el.childNodes)) {\n if (node.nodeType === 1 && (node as Element).namespaceURI === SVG_NS) {\n out.push(node as Element);\n } else if (node.nodeType !== 3 || node.textContent?.trim()) {\n return null;\n }\n }\n return out;\n}\n\n/**\n * Points of a path the field wrote — every command explicit, `M`/`L` with 2 numbers, `Q` with\n * 4, starting with `M`. Control points included: a quadratic curve stays inside the hull of\n * its points, so they bound it. `null` for any other path.\n */\nfunction readPath(d: string): [number, number][] | null {\n const body = d.trim();\n if (!body.startsWith('M')) return null;\n const points: [number, number][] = [];\n // Starting with `M`, every character belongs to a command: the pattern leaves none out.\n for (const [, command, args] of body.matchAll(PATH_COMMAND)) {\n const values = args\n .trim()\n .split(/[\\s,]+/)\n .map(num);\n if (values.length !== (command === 'Q' ? 4 : 2) || values.some(Number.isNaN)) return null;\n for (let i = 0; i < values.length; i += 2) points.push([values[i], values[i + 1]]);\n }\n return points.length > 0 ? points : null;\n}\n\nfunction readTransform(el: Element): SignTransform | null {\n const value = el.getAttribute('transform');\n if (value === null) return IDENTITY;\n const m = MATRIX.exec(value);\n if (!m) return null;\n const [a, d, x, y] = [m[1], m[2], m[3], m[4]].map(num);\n return a === d && a > 0 && Number.isFinite(x) && Number.isFinite(y) ? { scale: a, x, y } : null;\n}\n\nfunction readRect(el: Element): SignRect | null {\n const [x, y, width, height] = ['x', 'y', 'width', 'height'].map((n) => num(el.getAttribute(n)));\n return [x, y, width, height].every(Number.isFinite) && width > 0 && height > 0\n ? { x, y, width, height }\n : null;\n}\n\n/** A layer as read, with every point its ink reaches — for {@link insideViewBox}. */\ninterface ReadLayer {\n readonly layer: SignSvgLayer;\n readonly points: readonly [number, number][];\n /** Half the painted width around each point (a round cap), before the transform. */\n readonly pad: number;\n}\n\nfunction readImage(el: Element): ReadLayer | null {\n if (\n !onlyAttributes(el, ['href', 'x', 'y', 'width', 'height', 'preserveAspectRatio', 'transform'])\n )\n return null;\n const href = el.getAttribute('href') ?? '';\n const aspect = el.getAttribute('preserveAspectRatio');\n const rect = readRect(el);\n const transform = readTransform(el);\n if (!IMAGE_DATA_URL.test(href) || (aspect !== null && aspect !== 'xMidYMid meet')) return null;\n if (!rect || !transform || elementChildren(el)?.length !== 0) return null;\n return {\n layer: { kind: 'image', href, rect, transform },\n points: [\n [rect.x, rect.y],\n [rect.x + rect.width, rect.y + rect.height],\n ],\n pad: 0,\n };\n}\n\nfunction readInk(el: Element): ReadLayer | null {\n const allowed = [\n 'fill',\n 'stroke',\n 'stroke-width',\n 'stroke-linecap',\n 'stroke-linejoin',\n 'transform',\n ];\n if (!onlyAttributes(el, allowed)) return null;\n const color = el.getAttribute('stroke') ?? '';\n const width = num(el.getAttribute('stroke-width'));\n const transform = readTransform(el);\n if (\n el.getAttribute('fill') !== 'none' ||\n el.getAttribute('stroke-linecap') !== 'round' ||\n el.getAttribute('stroke-linejoin') !== 'round' ||\n !isInk(color) ||\n !(width > 0) ||\n !transform\n ) {\n return null;\n }\n const children = elementChildren(el);\n if (!children) return null;\n const paths: string[] = [];\n const points: [number, number][] = [];\n for (const path of children) {\n const d = path.getAttribute('d') ?? '';\n const read = path.localName === 'path' && onlyAttributes(path, ['d']) ? readPath(d) : null;\n if (!read || elementChildren(path)?.length !== 0) return null;\n paths.push(d);\n points.push(...read);\n }\n return { layer: { kind: 'ink', paths, color, width, transform }, points, pad: width / 2 };\n}\n\n/**\n * Whether everything a layer paints stays inside `viewBox` — the field never exports ink\n * outside its frame: the frame is grown to every stroke, cap included. Each point once\n * transformed, **with the ink around it** (half the width, a round cap), must fit; only the\n * export's rounding is forgiven.\n */\nfunction insideViewBox({ layer, points, pad }: ReadLayer, viewBox: SignRect): boolean {\n const { scale, x: dx, y: dy } = layer.transform;\n const reach = pad * scale;\n return points.every(([px, py]) => {\n const x = px * scale + dx;\n const y = py * scale + dy;\n return (\n x - reach >= viewBox.x - SLACK &&\n y - reach >= viewBox.y - SLACK &&\n x + reach <= viewBox.x + viewBox.width + SLACK &&\n y + reach <= viewBox.y + viewBox.height + SLACK\n );\n });\n}\n\n/**\n * The layers of an SVG data URL this field exported, or `null` when the value is anything\n * else — another image type, someone else's SVG, or one of ours altered by hand.\n */\nexport function readSignSvg(src: string): SignSvgDrawing | null {\n const text = decodeSvgDataUrl(src);\n if (text === null || typeof DOMParser === 'undefined') return null;\n // Never written by the field — and entities are best not expanded at all (billion laughs).\n if (/<!(DOCTYPE|ENTITY)/i.test(text)) return null;\n const doc = new DOMParser().parseFromString(text, 'image/svg+xml');\n const root = doc.documentElement;\n if (root.localName !== 'svg' || root.namespaceURI !== SVG_NS || doc.doctype) return null;\n if (doc.getElementsByTagName('parsererror').length > 0) return null;\n if (!onlyAttributes(root, ['xmlns', 'viewBox', 'width', 'height'])) return null;\n\n const box = (root.getAttribute('viewBox') ?? '')\n .trim()\n .split(/[\\s,]+/)\n .map(num);\n const width = num(root.getAttribute('width'));\n const height = num(root.getAttribute('height'));\n if (box.length !== 4 || box.some(Number.isNaN) || !(box[2] > 0) || !(box[3] > 0)) {\n return null;\n }\n // On screen the value is fitted by its width / height, here by its viewBox: they must agree.\n if (!(width > 0) || !(height > 0) || Math.abs(width / height - box[2] / box[3]) > 0.01) {\n return null;\n }\n const viewBox: SignRect = { x: box[0], y: box[1], width: box[2], height: box[3] };\n\n const children = elementChildren(root);\n if (!children) return null;\n const layers: SignSvgLayer[] = [];\n for (const child of children) {\n const read =\n child.localName === 'image'\n ? readImage(child)\n : child.localName === 'g'\n ? readInk(child)\n : null;\n if (!read || !insideViewBox(read, viewBox)) return null;\n layers.push(read.layer);\n }\n return { viewBox, layers };\n}\n","import {\n afterNextRender,\n booleanAttribute,\n Component,\n computed,\n DestroyRef,\n effect,\n ElementRef,\n forwardRef,\n inject,\n input,\n isDevMode,\n output,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { BaseFormField, type FieldLevel, warnMissingAccessibleName } from '@4sh/ui-kit/forms';\nimport { UiField } from '@4sh/ui-kit/forms/ui-field';\nimport { UiIcon, type UiIconSize } from '@4sh/ui-kit/base/ui-icon';\nimport {\n containRect,\n IMAGE_DATA_URL,\n type SignPoint,\n type SignRect,\n type SignStroke,\n type SignSvgDrawing,\n strokesBounds,\n strokesToSvg,\n svgToDataUrl,\n traceStroke,\n unionRect,\n} from './ui-field-sign-strokes';\nimport { readSignSvg } from './ui-field-sign-svg';\n\n/** Image format of the emitted value. */\nexport type FieldSignFormat = 'png' | 'svg';\n\n/** Value carried by the field: a data URL, or `null` while nothing is signed. */\nexport type FieldSignValue = string | null;\n\n/**\n * Resolution of a PNG export, relative to the drawing frame: crisp on a high-density screen\n * and in print, and the same on every device — the device pixel ratio is a property of the\n * screen the person signed on, not of the document the signature ends up in.\n */\nconst PNG_EXPORT_SCALE = 2;\n\n/** Ink width used when the custom property cannot be read (no layout: SSR, tests). */\nconst FALLBACK_INK_WIDTH = 2;\n\n/**\n * Colour a probe inherits when `exportColor` does not resolve (a `var()` with no value): an\n * unlikely `rgb()` that tells \"unresolved\" apart from a genuine black.\n */\nconst UNRESOLVED_COLOR = 'rgb(1, 2, 3)';\n\n/** Where drawing space sits in the box: `box = drawing × scale + (x, y)`. */\ninterface SignView {\n readonly scale: number;\n readonly x: number;\n readonly y: number;\n}\n\n/** A previous signature received from the form, kept underneath the new strokes. */\ninterface SignBackground {\n readonly src: string;\n /** `null` until the image has loaded — it is drawn from then on. */\n readonly image: HTMLImageElement | null;\n}\n\n/** Everything `clear()` wipes, kept so that `undo()` can bring it back. */\ninterface SignSnapshot {\n readonly strokes: readonly SignStroke[];\n readonly background: SignBackground | null;\n readonly region: SignRect | null;\n readonly unreadable: string | null;\n}\n\n/**\n * ui-field-sign — handwritten signature field on the `ui-field` shell (label + box +\n * helper). **The box is the drawing area**: finger, stylus or mouse, through Pointer\n * Events, on a `<canvas>`.\n *\n * Four choices shape it:\n *\n * 1. **The value is an image, emitted once a stroke ends** — a data URL (`format`: PNG or\n * SVG), `null` when empty, so `required` works as is. Never mid-stroke: a form bound to\n * an autosave would otherwise receive an image per pointer move.\n * 2. **The screen and the export use two inks.** On screen the ink follows the tokens, dark\n * theme included; the export is painted with `exportColor` on a transparent background.\n * A signature drawn in dark mode would otherwise come out white — invisible on the PDF it\n * is meant for.\n * 3. **What is on screen is what is exported.** The box at the first stroke is the\n * signature's region; the exported frame is that region grown to every stroke. A resized\n * box (a phone rotated) refits the frame, scaled and centred — and a stroke drawn in the\n * room this leaves around it grows the frame instead of falling outside the value. Points\n * are clamped to the box: nothing drawn can be invisible, nothing visible can be lost.\n * 4. **The page does not scroll under the pen.** `touch-action: none` on the drawing area,\n * pointer capture for the whole stroke.\n *\n * A value written by the form must be an image data URL — what this field emits. It is shown\n * in the box and kept underneath any new stroke until cleared; on screen it is redrawn as a\n * silhouette in the current ink, so that a black signature stays legible on a dark field.\n *\n * Standalone, `[(ngModel)]`, reactive forms or Signal Forms (ControlValueAccessor via\n * BaseFormField).\n */\n@Component({\n selector: 'ui-field-sign',\n imports: [UiField, UiIcon],\n templateUrl: './ui-field-sign.html',\n styleUrl: './ui-field-sign.scss',\n providers: [\n { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiFieldSign), multi: true },\n ],\n})\nexport class UiFieldSign extends BaseFormField<FieldSignValue> {\n /**\n * Ink colour of the **export**: any CSS colour, `var(--token)` included — resolved to\n * `rgb()` where the field sits. `black` when it is not a colour or does not resolve. The\n * screen ink follows the tokens.\n */\n exportColor = input<string>('black');\n /** Image format of the emitted data URL. */\n format = input<FieldSignFormat>('png');\n /** Hint shown in the empty box. */\n placeholder = input<string>('Signez ici');\n /** Renders the button that clears the signature. */\n clearable = input(true, { transform: booleanAttribute });\n /** Accessible name of the clear button. */\n clearAriaLabel = input<string>('Effacer la signature');\n /** State announced once the box holds a signature (the placeholder is announced while empty). */\n signedLabel = input<string>('Signature saisie');\n /** Announced after the state when the field is `required` (the visual `*` is hidden from assistive tech). */\n requiredLabel = input<string>('obligatoire');\n /** Shown and announced in place of a signature from the form that cannot be loaded. */\n unreadableLabel = input<string>('Signature illisible');\n\n /** Emitted when a stroke ends, and when the signature is cleared or undone — never mid-stroke. */\n valueChange = output<FieldSignValue>();\n /** Emitted when the drawing area receives focus. */\n padFocus = output<FocusEvent>();\n /** Emitted when the drawing area loses focus. */\n padBlur = output<FocusEvent>();\n /**\n * Emitted when the signature written by the form cannot be loaded. The field shows it as\n * unreadable (`unreadableLabel`, error level) and keeps it as its value until it is\n * cleared or signed over — it never drops what it could not read on its own.\n */\n imageError = output<Event>();\n\n /** @ignore */\n private readonly canvasEl = viewChild.required<ElementRef<HTMLCanvasElement>>('canvasEl');\n /** @ignore */\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n /** @ignore */\n private readonly document = inject(DOCUMENT);\n\n /** @ignore Finished strokes, oldest first, in drawing space — `undo()` pops from the end. */\n protected readonly strokes = signal<readonly SignStroke[]>([]);\n /** @ignore A value received from the form, drawn underneath the strokes. */\n protected readonly background = signal<SignBackground | null>(null);\n /** @ignore A stroke is in progress. */\n protected readonly drawing = signal(false);\n /**\n * @ignore The value received from the form, when it could not be loaded: still the field's\n * value until cleared or signed over, shown as unreadable meanwhile.\n */\n protected readonly unreadable = signal<string | null>(null);\n\n /** @ignore Nothing signed: no stroke, no previous signature, no stroke under way. */\n protected readonly isEmpty = computed(\n () => this.strokes().length === 0 && !this.background() && !this.drawing(),\n );\n /** @ignore An unreadable value is all the field holds: no stroke drawn over it yet. */\n protected readonly showUnreadable = computed(\n () => this.unreadable() !== null && this.strokes().length === 0 && !this.drawing(),\n );\n /** @ignore Something to clear: a signature, or an unreadable value. */\n protected readonly canClear = computed(() => !this.isEmpty() || this.showUnreadable());\n /** @ignore The shell's level: `error` while an unreadable value stands. */\n protected readonly fieldLevel = computed<FieldLevel>(() =>\n this.showUnreadable() ? 'error' : this.effectiveLevel(),\n );\n /** @ignore */\n protected readonly isInteractive = computed(() => !this.isDisabled() && !this.readonly());\n /** @ignore */\n protected readonly iconSize = computed<UiIconSize>(() => (this.size() === 'small' ? 'sm' : 'md'));\n /** @ignore */\n protected readonly statusId = computed(() => `${this.resolvedId()}-status`);\n /** @ignore The state, then \"required\" — `role=\"img\"` takes no `aria-required`. */\n protected readonly statusText = computed(() => {\n const state = this.showUnreadable()\n ? this.unreadableLabel()\n : this.isEmpty()\n ? this.placeholder()\n : this.signedLabel();\n return this.required() && this.requiredLabel() ? `${state}, ${this.requiredLabel()}` : state;\n });\n /** @ignore The state first, then the helper/error message when one is rendered. */\n protected readonly describedByIds = computed(() =>\n [this.statusId(), this.displayMessage() ? this.messageId() : null].filter(Boolean).join(' '),\n );\n\n /**\n * @ignore The box at the first stroke: where the previous signature is fitted, and the\n * smallest frame the export can have. `null` until a stroke (the box stands in).\n */\n private region: SignRect | null = null;\n /** @ignore Drawing space → box. Changes on resize only, never under the pen. */\n private view: SignView = { scale: 1, x: 0, y: 0 };\n /** @ignore What the last `clear()` removed, for `undo()`. */\n private cleared: SignSnapshot | null = null;\n /** @ignore The stroke under the pen — plain array, mutated per pointer move. */\n private current: SignPoint[] | null = null;\n /** @ignore Pointer that owns {@link current}: a second finger does not draw. */\n private activePointerId: number | null = null;\n /** @ignore Drawing area at stroke start, so a move does not force a layout. */\n private padRect: DOMRect | null = null;\n /** @ignore Size of the drawing area, in CSS pixels, as last observed. */\n private boxWidth = 0;\n private boxHeight = 0;\n /** @ignore `undefined` = not asked yet; `null` = no 2D canvas here (tests, old engines). */\n private context: CanvasRenderingContext2D | null | undefined;\n /** @ignore Previous signature recoloured in the screen ink, rebuilt only when its inputs change. */\n private silhouette: {\n image: HTMLImageElement;\n color: string;\n key: string;\n canvas: HTMLCanvasElement;\n } | null = null;\n /** @ignore Last value this field emitted — see {@link writeValue}. */\n private lastEmitted: FieldSignValue | undefined;\n /** @ignore A stroke ended while the previous signature was still loading (PNG export). */\n private commitPending = false;\n /**\n * @ignore The last value emitted embeds a previous signature not loaded yet (SVG export):\n * should it turn out unreadable, the value is emitted again without it.\n */\n private embedsUnloaded = false;\n /** @ignore The box was resized under the pen: the view is refitted once the stroke ends. */\n private viewStale = false;\n /** @ignore Half the ink width, in box pixels, at stroke start — how far points stay from the edge. */\n private edgeMargin = 0;\n /** @ignore The previous signature read back as one of this field's exports, per source. */\n private readBack: { src: string; drawing: SignSvgDrawing | null } | null = null;\n /** @ignore */\n private animationFrame: number | null = null;\n\n constructor() {\n super();\n const destroyRef = inject(DestroyRef);\n\n // Anything that changes the picture: strokes, previous signature, disabled ink.\n effect(() => {\n this.strokes();\n this.background();\n this.isDisabled();\n this.scheduleRedraw();\n });\n\n // Disabled or made read-only under the pen (a form disabled by an autosave): the stroke\n // is dropped, not committed — the field no longer accepts input.\n effect(() => {\n if (!this.isInteractive()) untracked(() => this.abandonStroke());\n });\n\n afterNextRender(() => {\n if (!this.label() && !this.ariaLabel() && !this.ariaLabelledBy()) {\n warnMissingAccessibleName(\n 'ui-field-sign',\n 'No accessible name: provide `label`, `ariaLabel` or `ariaLabelledBy`.',\n );\n }\n const canvas = this.canvasEl().nativeElement;\n this.measure();\n\n if (typeof ResizeObserver !== 'undefined') {\n const resize = new ResizeObserver(() => {\n this.measure();\n this.redraw();\n });\n resize.observe(canvas);\n destroyRef.onDestroy(() => resize.disconnect());\n }\n\n // The screen ink is a token: a theme or brand switch on <html> repaints it.\n if (typeof MutationObserver !== 'undefined') {\n const theme = new MutationObserver(() => this.scheduleRedraw());\n theme.observe(this.document.documentElement, {\n attributes: true,\n attributeFilter: ['data-theme', 'data-brand', 'class', 'style'],\n });\n destroyRef.onDestroy(() => theme.disconnect());\n }\n this.redraw();\n });\n\n destroyRef.onDestroy(() => {\n if (this.animationFrame !== null) cancelAnimationFrame(this.animationFrame);\n });\n }\n\n override writeValue(value: FieldSignValue): void {\n let next = value || null;\n if (next && !IMAGE_DATA_URL.test(next)) {\n if (isDevMode()) {\n console.warn(\n '[ui-field-sign] Ignored a value that is not an image data URL: convert a remote ' +\n 'signature to a data URL before handing it to the field.',\n );\n }\n next = null;\n }\n super.writeValue(next);\n // A form writing back the very value the field just emitted (`control.setValue(\n // control.value)`, a `patchValue` of the whole form…) must not flatten the strokes into a\n // background: `undo()` would lose its history.\n if (next !== null && next === this.lastEmitted) return;\n this.lastEmitted = undefined;\n this.current = null;\n this.activePointerId = null;\n this.commitPending = false;\n this.embedsUnloaded = false;\n this.cleared = null;\n this.viewStale = false;\n this.setRegion(null);\n this.drawing.set(false);\n this.unreadable.set(null);\n this.strokes.set([]);\n this.background.set(next ? { src: next, image: null } : null);\n if (next) this.loadBackground(next);\n }\n\n /** Removes the whole signature, previous one included, and emits `null`. `undo()` brings it back. */\n clear(): void {\n // Not under the pen: emptying mid-stroke would emit a blank image that `required` takes\n // for a signature.\n if (!this.canClear() || this.drawing()) return;\n this.cleared = {\n strokes: this.strokes(),\n background: this.background(),\n region: this.region,\n unreadable: this.unreadable(),\n };\n this.setRegion(null);\n this.strokes.set([]);\n this.background.set(null);\n this.unreadable.set(null);\n this.commit();\n }\n\n /**\n * Removes the last stroke drawn in this field; with none left, brings back what the last\n * `clear()` removed. A signature received from the form is not a stroke: only `clear()`\n * removes it.\n */\n undo(): void {\n if (this.drawing()) return;\n if (this.strokes().length > 0) {\n this.strokes.update((s) => s.slice(0, -1));\n } else if (this.cleared) {\n const { strokes, background, region, unreadable } = this.cleared;\n this.cleared = null;\n this.setRegion(region);\n this.strokes.set(strokes);\n this.background.set(background);\n this.unreadable.set(unreadable);\n // Cleared before it had loaded: its `onload` was dropped meanwhile, ask again.\n if (background && !background.image) this.loadBackground(background.src);\n } else {\n return;\n }\n if (this.strokes().length === 0 && !this.background()) this.setRegion(null);\n this.commit();\n }\n\n /** @ignore Drops the stroke under the pen, if any, without committing it. */\n private abandonStroke(): void {\n if (!this.current) return;\n const canvas = this.canvasEl().nativeElement;\n const pointerId = this.activePointerId;\n this.current = null;\n this.activePointerId = null;\n this.padRect = null;\n this.drawing.set(false);\n if (pointerId !== null && canvas.hasPointerCapture?.(pointerId)) {\n canvas.releasePointerCapture(pointerId);\n }\n // A first stroke abandoned leaves nothing: the region it set goes with it, as on undo.\n if (this.strokes().length === 0 && !this.background()) this.setRegion(null);\n this.refitIfStale();\n this.scheduleRedraw();\n }\n\n /** Focuses the drawing area. */\n focus(options?: FocusOptions): void {\n this.canvasEl().nativeElement.focus(options);\n }\n\n /**\n * Whether the field holds a signature — an unreadable one included, it is still the value.\n * A stroke under way does not count until it ends.\n */\n hasSignature(): boolean {\n return this.strokes().length > 0 || !!this.background() || this.unreadable() !== null;\n }\n\n /** @ignore */\n protected override uidPrefix(): string {\n return 'ui-field-sign';\n }\n\n // --- Pointer ---------------------------------------------------------\n\n /** @ignore */\n protected onPointerDown(event: PointerEvent): void {\n if (!this.isInteractive() || this.activePointerId !== null) return;\n // Main button only: a mouse right-click, or a stylus eraser (button 5), does not draw.\n if (event.button !== 0) return;\n const canvas = this.canvasEl().nativeElement;\n // No text selection, no synthetic mouse events — which also means no native focus:\n // given back right below.\n event.preventDefault();\n canvas.focus({ preventScroll: true });\n canvas.setPointerCapture?.(event.pointerId);\n\n if (!this.region) this.setRegion(this.boxRect());\n this.edgeMargin = (this.inkWidth() / 2) * this.view.scale;\n this.activePointerId = event.pointerId;\n this.padRect = canvas.getBoundingClientRect();\n this.current = [this.toPoint(event)];\n this.drawing.set(true);\n this.scheduleRedraw();\n }\n\n /** @ignore */\n protected onPointerMove(event: PointerEvent): void {\n if (event.pointerId !== this.activePointerId || !this.current) return;\n if (this.dropIfLocked()) return;\n // Coalesced events: a fast stroke is sampled at the device rate, not the frame rate.\n const samples = event.getCoalescedEvents?.() ?? [];\n for (const sample of samples.length ? samples : [event]) {\n this.current.push(this.toPoint(sample));\n }\n this.scheduleRedraw();\n }\n\n /** @ignore `pointerup`, `pointercancel` and a lost capture alike: what was drawn is kept. */\n protected onPointerEnd(event: PointerEvent): void {\n if (event.pointerId !== this.activePointerId || !this.current) return;\n if (this.dropIfLocked()) return;\n const stroke = this.current;\n this.current = null;\n this.activePointerId = null;\n this.padRect = null;\n this.drawing.set(false);\n this.strokes.update((s) => [...s, stroke]);\n this.refitIfStale();\n this.commit();\n }\n\n /**\n * @ignore Disabled or made read-only under the pen: the stroke is dropped. Checked on the\n * pointer events themselves — the effect that does the same only runs at the next change\n * detection, and a `pointerup` may land before it.\n */\n private dropIfLocked(): boolean {\n if (this.isInteractive()) return false;\n this.abandonStroke();\n return true;\n }\n\n /** @ignore Refits the view the box changed size for while a stroke was drawn. */\n private refitIfStale(): void {\n if (!this.viewStale) return;\n this.viewStale = false;\n this.fitView();\n }\n\n // --- Keyboard / focus ------------------------------------------------\n\n /** @ignore `Backspace` / `Ctrl`+`Z` undo, `Delete` clears (undoable too). */\n protected onKeydown(event: KeyboardEvent): void {\n if (!this.isInteractive()) return;\n const undoChord =\n (event.ctrlKey || event.metaKey) && !event.shiftKey && event.key.toLowerCase() === 'z';\n if (event.key === 'Backspace' || undoChord) {\n event.preventDefault();\n this.undo();\n } else if (event.key === 'Delete') {\n event.preventDefault();\n this.clear();\n }\n }\n\n /** @ignore */\n protected onBlur(event: FocusEvent): void {\n this.emitTouch();\n this.padBlur.emit(event);\n }\n\n /** @ignore The clear button hands focus back to the drawing area it just emptied. */\n protected onClearClick(): void {\n this.clear();\n this.focus();\n }\n\n // --- Value -------------------------------------------------------------\n\n /** @ignore Current picture → value, pushed to the form and to `valueChange`. */\n private commit(): void {\n const bg = this.background();\n let value: FieldSignValue;\n if (this.showUnreadable()) {\n // An unreadable value stands until something is drawn over it: undoing that stroke\n // brings the form's value back, not `null`.\n value = this.unreadable();\n } else if (this.strokes().length === 0) {\n // Nothing drawn over the previous signature (a clear undone, the last stroke undone):\n // the value received, word for word — not re-exported, which would change it.\n value = bg?.src ?? null;\n } else if (this.format() === 'png' && bg && !bg.image) {\n // A PNG export paints the previous signature: wait for it rather than drop it.\n this.commitPending = true;\n return;\n } else {\n value = this.export();\n }\n this.commitPending = false;\n // An SVG export carries the previous signature by reference, loaded or not: should it\n // turn out unreadable, the value is emitted again without it.\n this.embedsUnloaded = this.strokes().length > 0 && !!bg && !bg.image;\n this.lastEmitted = value;\n this.modelValue.set(value);\n this.emitChange(value);\n this.valueChange.emit(value);\n }\n\n /** @ignore */\n private export(): string {\n const lineWidth = this.inkWidth();\n const color = this.resolveExportColor();\n if (this.format() === 'png') {\n const png = this.exportPng(color, lineWidth);\n if (png) return png;\n // No 2D canvas here, or a canvas the browser refuses to read back: SVG needs neither.\n }\n const bg = this.background();\n return svgToDataUrl(\n strokesToSvg(this.strokes(), {\n frame: this.frame(lineWidth),\n color,\n lineWidth,\n background: bg\n ? { href: bg.src, rect: this.backgroundSlot(), drawing: this.readBackground(bg.src) }\n : null,\n }),\n );\n }\n\n /**\n * @ignore The previous signature as one of this field's own SVG exports, read once per\n * value. Never throws: on the commit path, a value it cannot read is kept as an image.\n */\n private readBackground(src: string): SignSvgDrawing | null {\n if (this.readBack?.src !== src) {\n let drawing: SignSvgDrawing | null;\n try {\n drawing = readSignSvg(src);\n } catch {\n drawing = null;\n }\n this.readBack = { src, drawing };\n }\n return this.readBack.drawing;\n }\n\n /** @ignore Repaints on a detached canvas, in the export ink and without the tint. */\n private exportPng(color: string, lineWidth: number): string | null {\n const frame = this.frame(lineWidth);\n if (frame.width <= 0 || frame.height <= 0) return null;\n const canvas = this.document.createElement('canvas');\n canvas.width = Math.round(frame.width * PNG_EXPORT_SCALE);\n canvas.height = Math.round(frame.height * PNG_EXPORT_SCALE);\n const ctx = canvas.getContext('2d');\n if (!ctx) return null;\n ctx.scale(PNG_EXPORT_SCALE, PNG_EXPORT_SCALE);\n ctx.translate(-frame.x, -frame.y);\n const image = this.background()?.image;\n if (image) {\n const slot = this.backgroundSlot();\n const r = containRect(image.naturalWidth, image.naturalHeight, slot.width, slot.height);\n ctx.drawImage(image, slot.x + r.x, slot.y + r.y, r.width, r.height);\n }\n this.paintStrokes(ctx, this.strokes(), color, lineWidth);\n try {\n const png = canvas.toDataURL('image/png');\n // A canvas past the engine's size limit gives `data:,` (iOS) instead of throwing.\n return png.startsWith('data:image/png') ? png : null;\n } catch {\n // A tainted canvas (an SVG previous signature on older WebKit): fall back to SVG\n // rather than leave the form on the old value while the screen shows the new stroke.\n if (isDevMode()) console.warn('[ui-field-sign] PNG export refused: emitting SVG instead.');\n return null;\n }\n }\n\n /**\n * @ignore `exportColor` resolved where the field sits — a `var(--token)` included — into\n * an `rgb()` an image can carry: a `var()` in an SVG served as an image resolves to nothing,\n * and the stroke would not be painted at all. `black` when the value is not a colour or\n * does not resolve.\n */\n private resolveExportColor(): string {\n const value = this.exportColor();\n const host = this.host.nativeElement;\n if (typeof getComputedStyle === 'undefined' || !host.isConnected) return value || 'black';\n const outer = this.document.createElement('span');\n const probe = this.document.createElement('span');\n outer.style.color = UNRESOLVED_COLOR;\n outer.hidden = true;\n probe.style.color = value;\n const parsed = probe.style.color !== '';\n outer.appendChild(probe);\n host.appendChild(outer);\n const resolved = getComputedStyle(probe).color;\n outer.remove();\n if (parsed && resolved && resolved !== UNRESOLVED_COLOR) return resolved;\n if (isDevMode())\n console.warn(`[ui-field-sign] \\`exportColor\\` \"${value}\" is not a colour here: using black.`);\n return 'black';\n }\n\n /** @ignore */\n private loadBackground(src: string): void {\n if (typeof Image === 'undefined') return;\n const image = new Image();\n image.onload = () => {\n if (this.background()?.src !== src) return;\n this.background.set({ src, image });\n if (this.commitPending) this.commit();\n };\n image.onerror = (event) => {\n if (this.background()?.src !== src) return;\n if (isDevMode()) console.warn('[ui-field-sign] The previous signature could not be loaded.');\n // Shown as unreadable — neither as a signature over a blank box, nor as empty while the\n // form holds a value. The value is left alone: an image this browser cannot decode may\n // be a valid signature elsewhere, and dropping it would lose it silently. Clearing it, or\n // signing over it, is the person's call; `imageError` tells the host.\n this.background.set(null);\n this.unreadable.set(src);\n // Not under the pen: the first stroke's region stays until that stroke ends.\n if (this.strokes().length === 0 && !this.current) this.setRegion(null);\n // A value already out with this image in it (SVG), or held for it (PNG): the strokes\n // replace it, alone — what the screen shows.\n if (this.commitPending || this.embedsUnloaded) this.commit();\n this.imageError.emit(event instanceof Event ? event : new Event('error'));\n };\n image.src = src;\n }\n\n // --- Geometry ------------------------------------------------------------\n\n /** @ignore The whole box, in box coordinates. */\n private boxRect(): SignRect {\n return { x: 0, y: 0, width: this.boxWidth, height: this.boxHeight };\n }\n\n /** @ignore Sets the region and fits the view on it: identity when it is the box itself. */\n private setRegion(region: SignRect | null): void {\n this.region = region;\n this.fitView();\n }\n\n /**\n * @ignore The exported frame: the region grown to every stroke (half the ink width around\n * them, so round caps are not shaved). The box until a first stroke.\n */\n private frame(lineWidth = this.inkWidth()): SignRect {\n if (!this.region) return this.boxRect();\n return unionRect(this.region, strokesBounds(this.strokes(), lineWidth / 2));\n }\n\n /** @ignore Where the previous signature is fitted: the region, or the box until a stroke. */\n private backgroundSlot(): SignRect {\n return this.region ?? this.boxRect();\n }\n\n /** @ignore Fits the frame into the box, scaled and centred. Called on resize, never mid-stroke. */\n private fitView(): void {\n if (!this.region) {\n this.view = { scale: 1, x: 0, y: 0 };\n return;\n }\n const frame = this.frame();\n if (frame.width <= 0 || frame.height <= 0 || this.boxWidth <= 0 || this.boxHeight <= 0) {\n this.view = { scale: 1, x: -frame.x, y: -frame.y };\n return;\n }\n const r = containRect(frame.width, frame.height, this.boxWidth, this.boxHeight);\n const scale = r.width / frame.width;\n this.view = { scale, x: r.x - frame.x * scale, y: r.y - frame.y * scale };\n }\n\n /**\n * @ignore Pointer position → drawing space, clamped to the box: a captured pointer dragged\n * past the edge draws along it, never somewhere the screen does not show.\n */\n private toPoint(event: PointerEvent): SignPoint {\n const rect = this.padRect;\n const canvas = this.canvasEl().nativeElement;\n // Screen pixels → CSS pixels of the box, should an ancestor scale it.\n const css = rect && rect.width > 0 ? canvas.clientWidth / rect.width || 1 : 1;\n const rawX = rect ? (event.clientX - rect.left) * css : event.offsetX;\n const rawY = rect ? (event.clientY - rect.top) * css : event.offsetY;\n const x = this.clamp(rawX, this.boxWidth);\n const y = this.clamp(rawY, this.boxHeight);\n const { scale, x: dx, y: dy } = this.view;\n return { x: (x - dx) / scale, y: (y - dy) / scale };\n }\n\n /**\n * @ignore Keeps a coordinate half the ink width inside the box: a stroke along the edge then\n * fits the frame cap included, and the frame does not grow — nor the previous signature\n * shrink — edit after edit.\n */\n private clamp(value: number, size: number): number {\n if (size <= 0) return value;\n const margin = Math.min(this.edgeMargin, size / 2);\n return Math.min(Math.max(value, margin), size - margin);\n }\n\n /** @ignore Size the bitmap on the CSS box × device pixel ratio, and refit the view. */\n private measure(): void {\n const canvas = this.canvasEl().nativeElement;\n this.boxWidth = canvas.clientWidth;\n this.boxHeight = canvas.clientHeight;\n const ratio = window.devicePixelRatio || 1;\n canvas.width = Math.max(1, Math.round(this.boxWidth * ratio));\n canvas.height = Math.max(1, Math.round(this.boxHeight * ratio));\n // Not mid-stroke: the points already drawn would no longer line up with the pen. Refitted\n // once the stroke ends instead.\n if (this.drawing()) {\n this.viewStale = true;\n // The pointer keeps mapping onto the box as it is now.\n this.padRect = canvas.getBoundingClientRect();\n } else {\n this.fitView();\n }\n }\n\n // --- Rendering -----------------------------------------------------------\n\n /** @ignore One repaint per frame, however many pointer moves arrive in it. */\n private scheduleRedraw(): void {\n if (this.animationFrame !== null || typeof requestAnimationFrame === 'undefined') return;\n this.animationFrame = requestAnimationFrame(() => {\n this.animationFrame = null;\n this.redraw();\n });\n }\n\n /** @ignore */\n private redraw(): void {\n const ctx = this.ctx();\n if (!ctx) return;\n const canvas = ctx.canvas;\n const ratio = this.boxWidth > 0 ? canvas.width / this.boxWidth : 1;\n ctx.setTransform(1, 0, 0, 1, 0, 0);\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n\n // Everything below is drawn in drawing space.\n const k = ratio * this.view.scale;\n ctx.setTransform(k, 0, 0, k, ratio * this.view.x, ratio * this.view.y);\n\n const color = this.inkColor();\n const image = this.background()?.image;\n if (image) this.paintSilhouette(ctx, image, color, k);\n const strokes = this.current ? [...this.strokes(), this.current] : this.strokes();\n this.paintStrokes(ctx, strokes, color, this.inkWidth());\n }\n\n /** @ignore */\n private paintStrokes(\n ctx: CanvasRenderingContext2D,\n strokes: readonly SignStroke[],\n color: string,\n lineWidth: number,\n ): void {\n ctx.strokeStyle = color;\n ctx.lineWidth = lineWidth;\n ctx.lineCap = 'round';\n ctx.lineJoin = 'round';\n for (const stroke of strokes) {\n ctx.beginPath();\n traceStroke(ctx, stroke);\n ctx.stroke();\n }\n }\n\n /**\n * @ignore The previous signature, recoloured in the screen ink: drawn on a scratch canvas,\n * then `source-in` keeps its shape and replaces its colour. A black export stays legible on\n * a dark field this way. The scratch canvas is cached — rebuilt only when the image (by\n * identity: each value gets its own element), the ink or the pixel size changes, never per\n * frame while a stroke is drawn over it.\n */\n private paintSilhouette(\n ctx: CanvasRenderingContext2D,\n image: HTMLImageElement,\n color: string,\n pixelScale: number,\n ): void {\n const slot = this.backgroundSlot();\n const key = `${slot.width}x${slot.height}@${pixelScale}`;\n const cached = this.silhouette;\n if (cached?.image !== image || cached.color !== color || cached.key !== key) {\n const scratch = this.document.createElement('canvas');\n scratch.width = Math.max(1, Math.round(slot.width * pixelScale));\n scratch.height = Math.max(1, Math.round(slot.height * pixelScale));\n const s = scratch.getContext('2d');\n if (!s) return;\n const r = containRect(image.naturalWidth, image.naturalHeight, slot.width, slot.height);\n s.setTransform(pixelScale, 0, 0, pixelScale, 0, 0);\n s.drawImage(image, r.x, r.y, r.width, r.height);\n s.globalCompositeOperation = 'source-in';\n s.fillStyle = color;\n s.fillRect(0, 0, slot.width, slot.height);\n this.silhouette = { image, color, key, canvas: scratch };\n }\n ctx.drawImage(this.silhouette!.canvas, slot.x, slot.y, slot.width, slot.height);\n }\n\n /** @ignore */\n private ctx(): CanvasRenderingContext2D | null {\n if (this.context === undefined) {\n // jsdom logs on every `getContext` call: ask once, remember the answer.\n this.context = this.canvasEl().nativeElement.getContext('2d') ?? null;\n }\n return this.context;\n }\n\n /** @ignore Screen ink: the canvas `color`, which the stylesheet binds to the ink token. */\n private inkColor(): string {\n return getComputedStyle(this.canvasEl().nativeElement).color;\n }\n\n /**\n * @ignore Ink width, in CSS pixels. `--_field-sign-ink-width` is registered as a\n * `<length>` (`@property`), so the browser hands back an absolute `px` value whatever unit\n * the hook was set in.\n */\n private inkWidth(): number {\n const canvas = this.canvasEl().nativeElement;\n const raw = getComputedStyle(canvas).getPropertyValue('--_field-sign-ink-width').trim();\n const value = parseFloat(raw);\n return raw.endsWith('px') && Number.isFinite(value) && value > 0 ? value : FALLBACK_INK_WIDTH;\n }\n}\n","<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 <!-- Laid over the drawing area, not beside it: the area keeps the full width of the\n box, so the hint and the signature centre on the box itself. -->\n @if (clearable() && !readonly()) {\n <button\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\n <!-- The state, for assistive tech: `aria-describedby` reads hidden nodes. -->\n <span hidden [id]=\"statusId()\">{{ statusText() }}</span>\n </div>\n</ui-field>\n"],"mappings":";;;;;;;AAgCA,MAAM,aAAa;AAGnB,MAAM,UAAU,MAAsB,KAAK,MAAM,IAAI,EAAE;AAOvD,SAAgB,MAAM,QAAkB;CACtC,IAAI,OAAO,WAAW,GAAG,OAAO;CAChC,MAAM,CAAC,SAAS;CAChB,MAAM,IAAI,OAAO,MAAM,CAAC;CACxB,MAAM,IAAI,OAAO,MAAM,CAAC;CACxB,OAAO,OAAO,OAAO,MAAM,OAAO,EAAE,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC,MAAM,CAAC;AACnE;AAOA,SAAgB,YAAY,MAAoB,QAAkB;CAChE,IAAI,OAAO,WAAW,GAAG;CACzB,MAAM,CAAC,SAAS;CAChB,KAAK,OAAO,MAAM,GAAG,MAAM,CAAC;CAC5B,IAAI,MAAM,MAAM,GAAG;EACjB,KAAK,OAAO,MAAM,IAAI,YAAY,MAAM,CAAC;EACzC;CACF;CACA,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,SAAS,GAAG,KAAK;EAC1C,MAAM,IA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