ngwr 16.3.0 → 16.4.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 (142) hide show
  1. package/carousel/styles/_index.scss +53 -1
  2. package/fesm2022/ngwr-breadcrumbs.mjs +2 -2
  3. package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
  4. package/fesm2022/ngwr-carousel-testing.mjs +24 -1
  5. package/fesm2022/ngwr-carousel-testing.mjs.map +1 -1
  6. package/fesm2022/ngwr-carousel.mjs +67 -4
  7. package/fesm2022/ngwr-carousel.mjs.map +1 -1
  8. package/fesm2022/ngwr-cascader.mjs +10 -23
  9. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  10. package/fesm2022/ngwr-context-menu.mjs +16 -1
  11. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  12. package/fesm2022/ngwr-dropdown.mjs +18 -4
  13. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  14. package/fesm2022/ngwr-file-upload.mjs +7 -3
  15. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  16. package/fesm2022/ngwr-graph-testing.mjs +27 -0
  17. package/fesm2022/ngwr-graph-testing.mjs.map +1 -1
  18. package/fesm2022/ngwr-graph.mjs +568 -7
  19. package/fesm2022/ngwr-graph.mjs.map +1 -1
  20. package/fesm2022/ngwr-i18n-ar.mjs +8 -4
  21. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  22. package/fesm2022/ngwr-i18n-cs.mjs +8 -4
  23. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  24. package/fesm2022/ngwr-i18n-de.mjs +8 -4
  25. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  26. package/fesm2022/ngwr-i18n-en.mjs +8 -4
  27. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  28. package/fesm2022/ngwr-i18n-es.mjs +8 -4
  29. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  30. package/fesm2022/ngwr-i18n-fr.mjs +8 -4
  31. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  32. package/fesm2022/ngwr-i18n-he.mjs +8 -4
  33. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  34. package/fesm2022/ngwr-i18n-hi.mjs +8 -4
  35. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  36. package/fesm2022/ngwr-i18n-id.mjs +8 -4
  37. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  38. package/fesm2022/ngwr-i18n-it.mjs +8 -4
  39. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  40. package/fesm2022/ngwr-i18n-ja.mjs +8 -4
  41. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  42. package/fesm2022/ngwr-i18n-ko.mjs +8 -4
  43. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  44. package/fesm2022/ngwr-i18n-nl.mjs +8 -4
  45. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  46. package/fesm2022/ngwr-i18n-pl.mjs +8 -4
  47. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  48. package/fesm2022/ngwr-i18n-pt.mjs +8 -4
  49. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  50. package/fesm2022/ngwr-i18n-ru.mjs +8 -4
  51. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  52. package/fesm2022/ngwr-i18n-sv.mjs +8 -4
  53. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  54. package/fesm2022/ngwr-i18n-tr.mjs +8 -4
  55. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  56. package/fesm2022/ngwr-i18n-uk.mjs +8 -4
  57. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  58. package/fesm2022/ngwr-i18n-vi.mjs +8 -4
  59. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  60. package/fesm2022/ngwr-i18n-zh-tw.mjs +8 -4
  61. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  62. package/fesm2022/ngwr-i18n-zh.mjs +8 -4
  63. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  64. package/fesm2022/ngwr-lightbox.mjs +2 -2
  65. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  66. package/fesm2022/ngwr-list.mjs +2 -2
  67. package/fesm2022/ngwr-list.mjs.map +1 -1
  68. package/fesm2022/ngwr-pagination.mjs +1 -0
  69. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  70. package/fesm2022/ngwr-schema-form.mjs +1 -0
  71. package/fesm2022/ngwr-schema-form.mjs.map +1 -1
  72. package/fesm2022/ngwr-select.mjs +100 -3
  73. package/fesm2022/ngwr-select.mjs.map +1 -1
  74. package/fesm2022/ngwr-sortable-list.mjs +2 -2
  75. package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
  76. package/fesm2022/ngwr-table-testing.mjs +71 -3
  77. package/fesm2022/ngwr-table-testing.mjs.map +1 -1
  78. package/fesm2022/ngwr-table.mjs +171 -11
  79. package/fesm2022/ngwr-table.mjs.map +1 -1
  80. package/fesm2022/ngwr-tour-testing.mjs +13 -1
  81. package/fesm2022/ngwr-tour-testing.mjs.map +1 -1
  82. package/fesm2022/ngwr-tour.mjs +13 -9
  83. package/fesm2022/ngwr-tour.mjs.map +1 -1
  84. package/fesm2022/ngwr-tree.mjs +12 -1
  85. package/fesm2022/ngwr-tree.mjs.map +1 -1
  86. package/fesm2022/ngwr-utils.mjs +64 -1
  87. package/fesm2022/ngwr-utils.mjs.map +1 -1
  88. package/fesm2022/ngwr-version.mjs +1 -1
  89. package/fesm2022/ngwr-version.mjs.map +1 -1
  90. package/graph/styles/_index.scss +87 -0
  91. package/i18n/ar.json +8 -4
  92. package/i18n/cs.json +8 -4
  93. package/i18n/de.json +8 -4
  94. package/i18n/en.json +8 -4
  95. package/i18n/es.json +8 -4
  96. package/i18n/fr.json +8 -4
  97. package/i18n/he.json +8 -4
  98. package/i18n/hi.json +8 -4
  99. package/i18n/id.json +8 -4
  100. package/i18n/it.json +8 -4
  101. package/i18n/ja.json +8 -4
  102. package/i18n/ko.json +8 -4
  103. package/i18n/nl.json +8 -4
  104. package/i18n/pl.json +8 -4
  105. package/i18n/pt.json +8 -4
  106. package/i18n/ru.json +8 -4
  107. package/i18n/sv.json +8 -4
  108. package/i18n/tr.json +8 -4
  109. package/i18n/uk.json +8 -4
  110. package/i18n/vi.json +8 -4
  111. package/i18n/zh-TW.json +8 -4
  112. package/i18n/zh.json +8 -4
  113. package/llms-full.txt +4 -4
  114. package/llms.txt +57 -24
  115. package/package.json +1 -1
  116. package/schematics/collection.json +5 -0
  117. package/schematics/eject/index.js +158 -0
  118. package/schematics/eject/schema.js +8 -0
  119. package/schematics/eject/schema.json +24 -0
  120. package/schematics/eject/source.js +295 -0
  121. package/schematics/use/symbol-map.json +1 -0
  122. package/select/styles/_index.scss +13 -0
  123. package/skills/ngwr/SKILL.md +30 -3
  124. package/skills/ngwr/references/catalog.md +1 -1
  125. package/table/styles/_index.scss +24 -0
  126. package/theme/styles/_focus.scss +11 -1
  127. package/types/ngwr-carousel-testing.d.ts +27 -6
  128. package/types/ngwr-carousel.d.ts +42 -6
  129. package/types/ngwr-cascader.d.ts +3 -5
  130. package/types/ngwr-context-menu.d.ts +2 -0
  131. package/types/ngwr-dropdown.d.ts +2 -0
  132. package/types/ngwr-file-upload.d.ts +8 -2
  133. package/types/ngwr-graph-testing.d.ts +28 -0
  134. package/types/ngwr-graph.d.ts +247 -91
  135. package/types/ngwr-select.d.ts +37 -0
  136. package/types/ngwr-table-testing.d.ts +52 -1
  137. package/types/ngwr-table.d.ts +101 -9
  138. package/types/ngwr-tour-testing.d.ts +10 -0
  139. package/types/ngwr-tour.d.ts +11 -2
  140. package/types/ngwr-tree.d.ts +2 -0
  141. package/types/ngwr-utils.d.ts +79 -1
  142. package/types/ngwr-version.d.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-file-upload.mjs","names":[],"sources":["../../../projects/lib/file-upload/file-upload.ts","../../../projects/lib/file-upload/file-upload.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n Injector,\n LOCALE_ID,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { WrButton } from 'ngwr/button';\nimport { useFormFieldAria } from 'ngwr/form';\nimport { wrReadI18nText, useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { WrProgress } from 'ngwr/progress';\nimport { wrRandomId, wrCheckStyles } from 'ngwr/utils';\n\nimport type {\n WrFileUploadRejection,\n WrFileUploadRejectionReason,\n WrFileUploadSize,\n WrFileUploadState,\n WrFileUploadStatusMap,\n} from './types';\n\n/** One list row: the file, what `[status]` says about it and its thumbnail. */\ninterface FileRow {\n readonly file: File;\n readonly classes: string;\n readonly state: WrFileUploadState | null;\n readonly percent: number | null;\n readonly message: string | null;\n readonly preview: string | null;\n}\n\n/** Does `file` match the `accept` attribute (extensions or MIME globs)? */\nfunction matchesAccept(file: File, accept: string): boolean {\n if (!accept) return true;\n const tokens = accept\n .split(',')\n .map(t => t.trim().toLowerCase())\n .filter(Boolean);\n if (tokens.length === 0) return true;\n const name = file.name.toLowerCase();\n const mime = file.type.toLowerCase();\n return tokens.some(token => {\n if (token.startsWith('.')) return name.endsWith(token);\n if (token.endsWith('/*')) return mime.startsWith(token.slice(0, -1));\n return mime === token;\n });\n}\n\n/**\n * Drag-and-drop file upload zone. Click to browse, drag-and-drop to add,\n * with an optional file list + remove buttons.\n *\n * A signal-forms native control: it implements\n * `FormValueControl<File | readonly File[] | null>`, so `[formField]` binds\n * straight to its `value` model — no `ControlValueAccessor` in between.\n * `[(value)]` works standalone. The value shape follows `multiple`: a single\n * `File` (or `null`), or a `File[]` array.\n *\n * @example\n * ```html\n * <!-- signal forms -->\n * <wr-file-upload [formField]=\"form.files\" [multiple]=\"true\" accept=\"image/*\" />\n *\n * <!-- standalone two-way binding -->\n * <wr-file-upload [(value)]=\"avatar\" accept=\".png,.jpg\" [maxSize]=\"2 * 1024 * 1024\" />\n * ```\n *\n * The component does no HTTP. The app uploads, and tells the list where each\n * file stands through `[status]`, a `Map` keyed by the `File` objects in `value`:\n *\n * ```html\n * <wr-file-upload [(value)]=\"files\" multiple [status]=\"statuses()\" (retry)=\"upload($event)\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/file-upload\n */\n@Component({\n selector: 'wr-file-upload',\n templateUrl: './file-upload.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-file-upload', '[class]': 'classes()' },\n imports: [WrButton, WrProgress],\n})\nexport class WrFileUpload implements FormValueControl<File | readonly File[] | null> {\n /** Allow multiple files. Single mode replaces on each add. @default false */\n readonly multiple = input(false, { transform: coerceBooleanProperty });\n\n /** `accept` attribute — comma-separated MIME types or extensions. @default '' */\n readonly accept = input<string>('');\n\n /**\n * Control size: the drop zone's padding, icon and text, and the list rows.\n *\n * @default 'md'\n */\n readonly size = input<WrFileUploadSize>('md');\n\n /** Max bytes per file. `0` disables the check. @default 0 */\n readonly maxSize = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /** Max files (multi mode only). `0` disables the check. @default 0 */\n readonly maxFiles = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /** Render the picked-files list below the zone. @default true */\n readonly showList = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Disable interaction. Bound automatically from the field's disabled state\n * when used with `[formField]`.\n *\n * @default false\n */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Refuse changes to the selection while the zone stays focusable and the files\n * still submit. Bound automatically from the field's readonly state when used\n * with `[formField]`.\n *\n * The zone stops opening the picker, a drop is refused and the per-file remove\n * buttons go inert — but the list stays readable, which is the point. No\n * `aria-readonly`: the zone is a `role=\"button\"`, and ARIA does not define the\n * state for that role, so `aria-disabled` would be the only mirror available\n * and it would say the wrong thing.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Where the app's upload of each file stands, keyed by the `File` objects in\n * `value`. A row with an entry draws its state: a progress bar while\n * `uploading` (indeterminate without a `percent`), a mark when `done`, the\n * `message` and a retry button on `error`. A file with no entry is a plain row.\n *\n * Pass a new `Map` on each change: an input sees a new reference, not a `set()`\n * on the one it already holds. `null` (the default) renders nothing extra.\n *\n * @default null\n */\n readonly status = input<WrFileUploadStatusMap | null>(null);\n\n /**\n * Show a thumbnail beside each image file. The thumbnail is an object URL,\n * revoked when its file leaves the list or the component is destroyed. Browser\n * only: nothing is created on the server.\n *\n * @default false\n */\n readonly previews = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Take files pasted with Ctrl/Cmd+V while the drop zone has focus. They go\n * through the same `accept`, `maxSize` and `maxFiles` rules as a drop. A paste\n * that carries no file is left alone.\n *\n * @default false\n */\n readonly acceptPaste = input(false, { transform: coerceBooleanProperty });\n\n /** The surrounding `<wr-form-field>`'s error state. @internal */\n protected readonly fieldAria = useFormFieldAria();\n\n /** id of the zone's visible copy, which names it. @internal */\n protected readonly hintId = wrRandomId('wr-file-upload-hint');\n\n /**\n * The zone's name, as `aria-labelledby`: the field's label when a\n * `<wr-form-field>` wraps it, then the zone's own visible copy.\n *\n * The zone is a `div[role=\"button\"]`, so `<wr-form-field>`'s `<label for>`\n * cannot reach it, and `aria-labelledby` is the direction that works for a\n * role. The visible copy is always part of the name (WCAG 2.5.3, Label in\n * Name): a speech-input user says what they see, and a name without it leaves\n * \"Click to browse\" matching nothing. `null` while `dropZoneLabel` overrides.\n */\n protected readonly labelledBy = computed(() =>\n this.dropZoneLabel() ? null : [this.fieldAria.labelledBy(), this.hintId].filter(Boolean).join(' ')\n );\n\n /** The `dropZoneLabel` override, or `null` so the visible copy names the zone. */\n protected readonly zoneName = computed(() => {\n const label = this.dropZoneLabel();\n return label === '' ? null : label;\n });\n\n /** Primary call-to-action label. Falls back to `fileUpload.browse`. */\n readonly pickLabel = input<string | null>(null);\n\n /** Secondary instruction below the CTA. Falls back to `fileUpload.dropZone`. */\n readonly dropLabel = input<string | null>(null);\n\n /**\n * Overrides the drop zone's accessible name. Unset, the zone is named by its\n * visible copy, after the field's label inside a `<wr-form-field>`. An\n * override must contain that copy, or speech input cannot reach the control\n * (WCAG 2.5.3).\n */\n readonly dropZoneLabel = input<string | null>(null);\n\n /** Remove-file button aria-label. Falls back to `fileUpload.removeFile`. */\n readonly removeFileLabel = input<string | null>(null);\n\n /** Retry button text on a failed row. Falls back to `fileUpload.retry`. */\n readonly retryLabel = input<string | null>(null);\n\n /** Name of the `uploading` state: the progress bar's name and the announcement. Falls back to `fileUpload.uploading`. */\n readonly uploadingLabel = input<string | null>(null);\n\n /** Name of the `done` state: the mark's name and the announcement. Falls back to `fileUpload.uploaded`. */\n readonly uploadedLabel = input<string | null>(null);\n\n /** Text of a failed row whose status carries no `message`. Falls back to `fileUpload.failed`. */\n readonly failedLabel = input<string | null>(null);\n\n protected readonly resolvedPick = useI18nText(this.pickLabel, 'fileUpload.browse', 'Click to browse');\n protected readonly resolvedDrop = useI18nText(this.dropLabel, 'fileUpload.dropZone', 'or drop files here');\n protected readonly resolvedRemove = useI18nText(this.removeFileLabel, 'fileUpload.removeFile', 'Remove file');\n\n protected readonly resolvedRetry = useI18nText(this.retryLabel, 'fileUpload.retry', 'Try again');\n protected readonly resolvedUploading = useI18nText(this.uploadingLabel, 'fileUpload.uploading', 'Uploading');\n protected readonly resolvedUploaded = useI18nText(this.uploadedLabel, 'fileUpload.uploaded', 'Uploaded');\n protected readonly resolvedFailed = useI18nText(this.failedLabel, 'fileUpload.failed', 'Upload failed');\n\n /** `{{name}}: {{status}}`: a state said about one file. */\n protected readonly statusText = useI18nFormatter('fileUpload.status', '{{name}}: {{status}}');\n\n /** Optional helper text shown below the labels (e.g. accepted formats). */\n readonly helperText = input<string>('');\n\n /**\n * Selected file(s). Bound by `[formField]`, or two-way via `[(value)]`. Shape\n * follows `multiple`: a single `File` (or `null`), or a `File[]` array.\n */\n readonly value = model<File | readonly File[] | null>(null);\n\n /** Emitted when files are rejected for type / size / count reasons. */\n readonly rejected = output<readonly WrFileUploadRejection[]>();\n\n /** Emitted with the file when the retry button of a failed row is pressed. */\n readonly retry = output<File>();\n\n /** Emitted on commit so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n protected readonly picker = viewChild.required<ElementRef<HTMLInputElement>>('picker');\n private readonly zone = viewChild.required<ElementRef<HTMLElement>>('zone');\n\n protected readonly files = signal<readonly File[]>([]);\n protected readonly dragging = signal(false);\n\n /**\n * How many elements of the zone the drag is inside. The browser fires `dragleave`\n * on the zone when the pointer moves onto its own label or icon, with `dragenter`\n * on the child just before it, so \"left the zone\" read off a single event switched\n * the highlight off over the zone's text and back on over its padding. Every enter\n * counts up and every leave down; the drag has left when the count is back to 0.\n */\n private dragDepth = 0;\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly injector = inject(Injector);\n private readonly browser = isPlatformBrowser(inject(PLATFORM_ID));\n\n /** id prefix of the file names, which describe each row's retry button. @internal */\n protected readonly nameId = wrRandomId('wr-file-upload-name');\n\n /** The object URL of each previewed image file. */\n private readonly previewUrls = signal<ReadonlyMap<File, string>>(new Map());\n\n protected readonly rows = computed<readonly FileRow[]>(() => {\n const status = this.status();\n const urls = this.previewUrls();\n return this.files().map(file => {\n const entry = status?.get(file);\n const percent = entry?.state === 'uploading' ? entry.percent : null;\n const state = entry?.state ?? null;\n return {\n file,\n classes: state ? `wr-file-upload__item wr-file-upload__item--${state}` : 'wr-file-upload__item',\n state,\n percent: typeof percent === 'number' && Number.isFinite(percent) ? percent : null,\n message: entry?.state === 'error' && entry.message ? entry.message : null,\n preview: urls.get(file) ?? null,\n };\n });\n });\n\n /** `aria-busy` on the list: at least one file is uploading. */\n protected readonly busy = computed(() => this.rows().some(row => row.state === 'uploading'));\n\n /** What the one live region says: the states that changed in the last `[status]` write. */\n protected readonly announcement = signal('');\n\n /** The state each file had at the last `[status]` write, to tell a change from a percent tick. */\n private lastStates: ReadonlyMap<File, WrFileUploadState> | null = null;\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n const size = this.size();\n if (size !== 'md') parts.push(`wr-file-upload--${size}`);\n if (this.dragging()) parts.push('wr-file-upload--dragging');\n if (this.disabled()) parts.push('wr-file-upload--disabled');\n else if (this.readonly()) parts.push('wr-file-upload--readonly');\n return parts.join(' ');\n });\n\n /**\n * Human-readable file size (e.g. `1.2 MB`).\n *\n * Every piece of this used to be English and unreachable: a module-level unit\n * table with no catalog key, and `toFixed()`, which writes an ASCII decimal\n * point whatever `LOCALE_ID` says. A Russian page showed translated drop-zone\n * copy above `3.4 KB`. The number now goes through `Intl.NumberFormat` and the\n * unit through the catalog, joined by a template the catalog also owns — so a\n * locale controls the separator, the digits and whether a space sits before\n * the unit.\n *\n * Not a `computed`: it is called per file, with the file's size as its\n * argument. It still re-runs on a locale switch, because the formatters it\n * calls are signals read during the same change detection that renders the row.\n */\n protected formatBytes(bytes: number): string {\n if (!Number.isFinite(bytes) || bytes <= 0) {\n return this.sizeText({ value: this.number(0, 0), unit: this.unitTexts[0]() });\n }\n const i = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), this.unitTexts.length - 1);\n const v = bytes / 1024 ** i;\n const digits = v >= 100 || i === 0 ? 0 : 1;\n return this.sizeText({ value: this.number(v, digits), unit: this.unitTexts[i]() });\n }\n\n /** `{{value}} {{unit}}` — the join, so a locale owns the space too. */\n private readonly sizeText = useI18nFormatter('fileUpload.size', '{{value}} {{unit}}');\n\n /**\n * One resolved signal per binary unit, indexed by the power of 1024 the\n * arithmetic lands on.\n *\n * Spelled out rather than built from a key list: `i18n.spec.ts` reads every\n * catalog key the library asks for out of the SOURCE, by matching a quoted\n * dotted string inside the call, so a key built by interpolation is invisible\n * to it. That spec fails rather than passing quietly, but either way the key\n * would stop being checked.\n */\n private readonly unitTexts = [\n wrReadI18nText('fileUpload.unitByte', 'B'),\n wrReadI18nText('fileUpload.unitKb', 'KB'),\n wrReadI18nText('fileUpload.unitMb', 'MB'),\n wrReadI18nText('fileUpload.unitGb', 'GB'),\n wrReadI18nText('fileUpload.unitTb', 'TB'),\n ] as const;\n\n private readonly locale = inject(LOCALE_ID);\n\n private number(value: number, digits: number): string {\n return new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: digits,\n maximumFractionDigits: digits,\n }).format(value);\n }\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('file-upload');\n // Rebuild the internal file list from an external `value` write (mirrors the\n // old `writeValue`). Skipped when the value is merely the echo of an\n // in-component edit, so re-syncing can never clobber a live selection.\n effect(() => {\n const v = this.value();\n untracked(() => {\n // Coerce null/undefined to `[]` — a classic-forms binding can write\n // null, which the old `writeValue(v: … | null)` accepted too.\n const next: readonly File[] = v === null || v === undefined ? [] : Array.isArray(v) ? v : [v as File];\n const current = this.files();\n if (current.length === next.length && current.every((file, i) => file === next[i])) return;\n this.files.set(next);\n });\n });\n\n effect(() => {\n const rows = this.status() === null ? null : this.rows();\n untracked(() => this.announce(rows));\n });\n\n effect(() => {\n const images = this.previews() && this.browser ? this.files().filter(file => file.type.startsWith('image/')) : [];\n untracked(() => this.syncPreviews(images));\n });\n inject(DestroyRef).onDestroy(() => this.syncPreviews([]));\n }\n\n /**\n * Focus the drop zone — what Signal Forms calls to focus this control, from\n * `focusBoundControl()`. The zone is the control: the real file input beside\n * it is hidden and out of the tab order, and the host has no tab stop. A\n * read-only zone still takes it; a disabled one is left alone, as a disabled\n * native control refuses the same call.\n */\n focus(options?: FocusOptions): void {\n if (!this.disabled()) this.zone().nativeElement.focus(options);\n }\n\n // Template handlers\n\n protected openPicker(): void {\n if (this.disabled() || this.readonly()) return;\n this.picker().nativeElement.click();\n }\n\n protected onZoneKey(event: KeyboardEvent): void {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.openPicker();\n }\n }\n\n protected onPickerChange(event: Event): void {\n const target = event.target as HTMLInputElement;\n if (target.files) this.acceptFiles(Array.from(target.files));\n // Reset so picking the same file twice re-fires `change`.\n target.value = '';\n }\n\n protected onDragEnter(event: DragEvent): void {\n if (this.disabled() || this.readonly()) return;\n event.preventDefault();\n this.dragDepth++;\n this.dragging.set(true);\n }\n\n protected onDragOver(event: DragEvent): void {\n if (this.disabled() || this.readonly()) return;\n event.preventDefault();\n if (event.dataTransfer) event.dataTransfer.dropEffect = 'copy';\n }\n\n protected onDragLeave(): void {\n // See `dragDepth`: a leave onto one of the zone's own children is not leaving.\n this.dragDepth = Math.max(0, this.dragDepth - 1);\n if (this.dragDepth === 0) this.dragging.set(false);\n }\n\n protected onDrop(event: DragEvent): void {\n event.preventDefault();\n this.dragDepth = 0;\n this.dragging.set(false);\n if (this.disabled() || this.readonly()) return;\n const dropped = event.dataTransfer?.files ? Array.from(event.dataTransfer.files) : [];\n if (dropped.length > 0) this.acceptFiles(dropped);\n }\n\n protected onPaste(event: ClipboardEvent): void {\n if (!this.acceptPaste() || this.disabled() || this.readonly()) return;\n const pasted = event.clipboardData?.files ? Array.from(event.clipboardData.files) : [];\n if (pasted.length === 0) return;\n event.preventDefault();\n this.acceptFiles(pasted);\n }\n\n protected onRetry(file: File, index: number): void {\n if (this.disabled()) return;\n const button = this.host.nativeElement.ownerDocument.activeElement;\n const hadFocus = !!button?.matches('.wr-file-upload__retry') && this.host.nativeElement.contains(button);\n this.retry.emit(file);\n if (!hadFocus) return;\n // A handler that moves the file out of `error` takes the button away, and\n // focus with it. The row's remove button is what is left to hold it.\n afterNextRender(\n () => {\n if (button?.isConnected) return;\n this.host.nativeElement.querySelectorAll<HTMLElement>('.wr-file-upload__remove')[index]?.focus();\n },\n { injector: this.injector }\n );\n }\n\n protected removeAt(index: number): void {\n if (this.disabled() || this.readonly()) return;\n // Read before the row goes: the button that holds focus is about to leave the\n // document, and focus with it — to `<body>`, so the next Tab restarted at the top\n // of the page. A middle row only kept it by accident, through `track $index`\n // reusing the button for the file that moved up.\n const focused = this.host.nativeElement.ownerDocument.activeElement;\n const hadFocus = !!focused?.matches('.wr-file-upload__remove') && this.host.nativeElement.contains(focused);\n const next = this.files().filter((_, i) => i !== index);\n this.files.set(next);\n this.emit();\n if (!hadFocus) return;\n afterNextRender(\n () => {\n // The row that took this one's place, else the one before it, else the zone.\n const buttons = this.host.nativeElement.querySelectorAll<HTMLElement>('.wr-file-upload__remove');\n const target = buttons[Math.min(index, buttons.length - 1)] ?? this.zone().nativeElement;\n target.focus();\n },\n { injector: this.injector }\n );\n }\n\n // Internals\n\n private acceptFiles(incoming: readonly File[]): void {\n if (this.disabled() || this.readonly()) return;\n const accept = this.accept();\n const maxSize = this.maxSize();\n const rejections: WrFileUploadRejection[] = [];\n const accepted: File[] = [];\n\n for (const file of incoming) {\n const reason = this.reject(file, accept, maxSize);\n if (reason) rejections.push({ file, reason });\n else accepted.push(file);\n }\n\n let next: File[];\n if (this.multiple()) {\n const listed = this.files();\n const maxFiles = this.maxFiles();\n // The cap rejects incoming files only: a list already over it keeps what it holds.\n const room = maxFiles > 0 ? Math.max(0, maxFiles - listed.length) : accepted.length;\n for (const file of accepted.slice(room)) rejections.push({ file, reason: 'count' });\n next = [...listed, ...accepted.slice(0, room)];\n } else {\n // Single mode — last accepted wins, prior selection cleared.\n next = accepted.length > 0 ? [accepted[accepted.length - 1]] : [...this.files()];\n }\n\n this.files.set(next);\n this.touch.emit();\n this.emit();\n if (rejections.length > 0) this.rejected.emit(rejections);\n }\n\n /**\n * Say each state a file has just entered, in one string. `pending` is the\n * resting state and a percent tick is not a change, so neither is said, and\n * the states present when `[status]` is first bound are a starting point\n * rather than news.\n */\n private announce(rows: readonly FileRow[] | null): void {\n if (rows === null) {\n this.lastStates = null;\n return;\n }\n const next = new Map<File, WrFileUploadState>();\n const changed: string[] = [];\n for (const row of rows) {\n if (row.state === null) continue;\n next.set(row.file, row.state);\n if (this.lastStates === null || row.state === 'pending' || this.lastStates.get(row.file) === row.state) continue;\n const status =\n row.state === 'uploading'\n ? this.resolvedUploading()\n : row.state === 'done'\n ? this.resolvedUploaded()\n : (row.message ?? this.resolvedFailed());\n changed.push(this.statusText({ name: row.file.name, status }));\n }\n this.lastStates = next;\n if (changed.length > 0) {\n this.announcement.set(new Intl.ListFormat(this.locale, { style: 'short', type: 'unit' }).format(changed));\n }\n }\n\n /** Hold one object URL per file in `images`, and revoke the ones that left. */\n private syncPreviews(images: readonly File[]): void {\n const current = this.previewUrls();\n if (current.size === images.length && images.every(file => current.has(file))) return;\n if (typeof URL === 'undefined' || typeof URL.createObjectURL !== 'function') return;\n const next = new Map<File, string>();\n for (const file of images) next.set(file, current.get(file) ?? URL.createObjectURL(file));\n for (const [file, url] of current) if (!next.has(file)) URL.revokeObjectURL(url);\n this.previewUrls.set(next);\n }\n\n private reject(file: File, accept: string, maxSize: number): WrFileUploadRejectionReason | null {\n if (accept && !matchesAccept(file, accept)) return 'type';\n if (maxSize > 0 && file.size > maxSize) return 'size';\n return null;\n }\n\n private emit(): void {\n const list = this.files();\n if (this.multiple()) {\n this.value.set(list);\n } else {\n this.value.set(list.length > 0 ? list[0] : null);\n }\n }\n}\n","<div\n #zone\n class=\"wr-file-upload__zone\"\n role=\"button\"\n tabindex=\"0\"\n [attr.aria-label]=\"zoneName()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-disabled]=\"disabled() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (click)=\"openPicker()\"\n (keydown)=\"onZoneKey($event)\"\n (dragenter)=\"onDragEnter($event)\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave()\"\n (drop)=\"onDrop($event)\"\n (paste)=\"onPaste($event)\"\n>\n <svg class=\"wr-file-upload__icon\" width=\"32\" height=\"32\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path\n d=\"M12 16V4M12 4l-4 4M12 4l4 4M4 16v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n <div class=\"wr-file-upload__hint\" [id]=\"hintId\">\n <strong>{{ resolvedPick() }}</strong>\n <span>{{ resolvedDrop() }}</span>\n @if (helperText()) {\n <small>{{ helperText() }}</small>\n }\n </div>\n</div>\n\n<!--\n The real <input type=\"file\"> is never operated directly — the zone above is\n the control and forwards clicks here, so the input is visually hidden and kept\n OUTSIDE the zone: inside, it nested one interactive element within another\n (the zone is role=\"button\") and put two tab stops where users see one. It is\n positioned absolutely and clipped, so being a sibling changes nothing visually.\n aria-hidden must be paired with tabindex=\"-1\", or hiding a focusable element is\n itself a violation.\n-->\n<input\n #picker\n class=\"wr-file-upload__picker\"\n type=\"file\"\n aria-hidden=\"true\"\n tabindex=\"-1\"\n [attr.accept]=\"accept() || null\"\n [attr.multiple]=\"multiple() ? '' : null\"\n [disabled]=\"disabled() || readonly()\"\n (change)=\"onPickerChange($event)\"\n/>\n\n@if (showList() && files().length > 0) {\n <ul class=\"wr-file-upload__list\" [attr.aria-busy]=\"busy() || null\">\n @for (row of rows(); track $index) {\n <li [class]=\"row.classes\">\n @if (row.preview; as url) {\n <img class=\"wr-file-upload__preview\" alt=\"\" [src]=\"url\" />\n }\n <span\n class=\"wr-file-upload__name\"\n [attr.id]=\"row.state === 'error' ? `${nameId}-${$index}` : null\"\n [title]=\"row.file.name\"\n >{{ row.file.name }}</span\n >\n <span class=\"wr-file-upload__size\">{{ formatBytes(row.file.size) }}</span>\n @switch (row.state) {\n @case ('done') {\n <span class=\"wr-file-upload__done\" role=\"img\" [attr.aria-label]=\"resolvedUploaded()\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path\n d=\"M20 6 9 17l-5-5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </span>\n }\n @case ('error') {\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-file-upload__retry\"\n [attr.aria-describedby]=\"`${nameId}-${$index}`\"\n [disabled]=\"disabled()\"\n (click)=\"onRetry(row.file, $index)\"\n >\n {{ resolvedRetry() }}\n </button>\n }\n }\n <button\n type=\"button\"\n class=\"wr-file-upload__remove\"\n [attr.aria-label]=\"resolvedRemove()\"\n [disabled]=\"disabled() || readonly()\"\n (click)=\"removeAt($index)\"\n >\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" aria-hidden=\"true\">\n <path\n d=\"M2 2 L10 10 M10 2 L2 10\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n />\n </svg>\n </button>\n @if (row.state === 'uploading') {\n <wr-progress\n class=\"wr-file-upload__progress\"\n size=\"sm\"\n [indeterminate]=\"row.percent === null\"\n [value]=\"row.percent ?? 0\"\n [ariaLabel]=\"statusText({ name: row.file.name, status: resolvedUploading() })\"\n />\n } @else if (row.state === 'error') {\n <span class=\"wr-file-upload__error\">{{ row.message ?? resolvedFailed() }}</span>\n }\n </li>\n }\n </ul>\n}\n\n<!-- One live region for the whole list, in the DOM before any state changes: a\n region inserted together with its text is often not read. -->\n@if (status() !== null) {\n <span class=\"wr-file-upload__announce\" role=\"status\" aria-live=\"polite\">{{ announcement() }}</span>\n}\n"],"mappings":";;;;;;;;;;;;;;;AAuDA,SAAS,cAAc,MAAY,QAAc;CAC/C,IAAI,CAAC,QAAQ,OAAO;CACpB,MAAM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AA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-file-upload.mjs","names":[],"sources":["../../../projects/lib/file-upload/file-upload.ts","../../../projects/lib/file-upload/file-upload.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n Injector,\n LOCALE_ID,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { WrButton } from 'ngwr/button';\nimport { useFormFieldAria } from 'ngwr/form';\nimport { wrReadI18nText, useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { WrProgress } from 'ngwr/progress';\nimport { wrRandomId, wrCheckStyles } from 'ngwr/utils';\n\nimport type {\n WrFileUploadRejection,\n WrFileUploadRejectionReason,\n WrFileUploadSize,\n WrFileUploadState,\n WrFileUploadStatusMap,\n} from './types';\n\n/** One list row: the file, what `[status]` says about it and its thumbnail. */\ninterface FileRow {\n readonly file: File;\n readonly classes: string;\n readonly state: WrFileUploadState | null;\n readonly percent: number | null;\n readonly message: string | null;\n readonly preview: string | null;\n}\n\n/** Does `file` match the `accept` attribute (extensions or MIME globs)? */\nfunction matchesAccept(file: File, accept: string): boolean {\n if (!accept) return true;\n const tokens = accept\n .split(',')\n .map(t => t.trim().toLowerCase())\n .filter(Boolean);\n if (tokens.length === 0) return true;\n const name = file.name.toLowerCase();\n const mime = file.type.toLowerCase();\n return tokens.some(token => {\n if (token.startsWith('.')) return name.endsWith(token);\n if (token.endsWith('/*')) return mime.startsWith(token.slice(0, -1));\n return mime === token;\n });\n}\n\n/**\n * Drag-and-drop file upload zone. Click to browse, drag-and-drop to add,\n * with an optional file list + remove buttons.\n *\n * A signal-forms native control: it implements\n * `FormValueControl<File | readonly File[] | null>`, so `[formField]` binds\n * straight to its `value` model — no `ControlValueAccessor` in between.\n * `[(value)]` works standalone. The value shape follows `multiple`: a single\n * `File` (or `null`), or a `File[]` array.\n *\n * @example\n * ```html\n * <!-- signal forms -->\n * <wr-file-upload [formField]=\"form.files\" [multiple]=\"true\" accept=\"image/*\" />\n *\n * <!-- standalone two-way binding -->\n * <wr-file-upload [(value)]=\"avatar\" accept=\".png,.jpg\" [maxSize]=\"2 * 1024 * 1024\" />\n * ```\n *\n * The component does no HTTP. The app uploads, and tells the list where each\n * file stands through `[status]`, a `Map` keyed by the `File` objects in `value`:\n *\n * ```html\n * <wr-file-upload [(value)]=\"files\" multiple [status]=\"statuses()\" (retry)=\"upload($event)\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/file-upload\n */\n@Component({\n selector: 'wr-file-upload',\n templateUrl: './file-upload.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-file-upload', '[class]': 'classes()' },\n imports: [WrButton, WrProgress],\n})\nexport class WrFileUpload implements FormValueControl<File | readonly File[] | null> {\n /** Allow multiple files. Single mode replaces on each add. @default false */\n readonly multiple = input(false, { transform: coerceBooleanProperty });\n\n /** `accept` attribute — comma-separated MIME types or extensions. @default '' */\n readonly accept = input<string>('');\n\n /**\n * Control size: the drop zone's padding, icon and text, and the list rows.\n *\n * @default 'md'\n */\n readonly size = input<WrFileUploadSize>('md');\n\n /** Max bytes per file. `0` disables the check. @default 0 */\n readonly maxSize = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /** Max files (multi mode only). `0` disables the check. @default 0 */\n readonly maxFiles = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /** Render the picked-files list below the zone. @default true */\n readonly showList = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Disable interaction. Bound automatically from the field's disabled state\n * when used with `[formField]`.\n *\n * @default false\n */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Refuse changes to the selection while the zone stays focusable and the files\n * still submit. Bound automatically from the field's readonly state when used\n * with `[formField]`.\n *\n * The zone stops opening the picker, a drop is refused and the per-file remove\n * buttons go inert — but the list stays readable, which is the point. No\n * `aria-readonly`: the zone is a `role=\"button\"`, and ARIA does not define the\n * state for that role, so `aria-disabled` would be the only mirror available\n * and it would say the wrong thing.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Where the app's upload of each file stands, keyed by the `File` objects in\n * `value`. A row with an entry draws its state: a progress bar while\n * `uploading` (indeterminate without a `percent`), a mark when `done`, the\n * `message` and a retry button on `error`. A file with no entry is a plain row.\n *\n * Pass a new `Map` on each change: an input sees a new reference, not a `set()`\n * on the one it already holds. `null` (the default) renders nothing extra.\n *\n * @default null\n */\n readonly status = input<WrFileUploadStatusMap | null>(null);\n\n /**\n * Show a thumbnail beside each image file. The thumbnail is an object URL,\n * revoked when its file leaves the list or the component is destroyed. Browser\n * only: nothing is created on the server.\n *\n * @default false\n */\n readonly previews = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Take files pasted with Ctrl/Cmd+V while the drop zone has focus. They go\n * through the same `accept`, `maxSize` and `maxFiles` rules as a drop. A paste\n * that carries no file is left alone.\n *\n * @default false\n */\n readonly acceptPaste = input(false, { transform: coerceBooleanProperty });\n\n /** The surrounding `<wr-form-field>`'s error state. @internal */\n protected readonly fieldAria = useFormFieldAria();\n\n /** id of the zone's visible copy, which names it. @internal */\n protected readonly hintId = wrRandomId('wr-file-upload-hint');\n\n /**\n * The zone's name, as `aria-labelledby`: the field's label when a\n * `<wr-form-field>` wraps it, then the zone's own visible copy.\n *\n * The zone is a `div[role=\"button\"]`, so `<wr-form-field>`'s `<label for>`\n * cannot reach it, and `aria-labelledby` is the direction that works for a\n * role. The visible copy is always part of the name (WCAG 2.5.3, Label in\n * Name): a speech-input user says what they see, and a name without it leaves\n * \"Click to browse\" matching nothing. `null` while `dropZoneLabel` overrides.\n */\n protected readonly labelledBy = computed(() =>\n this.dropZoneLabel() ? null : [this.fieldAria.labelledBy(), this.hintId].filter(Boolean).join(' ')\n );\n\n /** The `dropZoneLabel` override, or `null` so the visible copy names the zone. */\n protected readonly zoneName = computed(() => {\n const label = this.dropZoneLabel();\n return label === '' ? null : label;\n });\n\n /** Primary call-to-action label. Falls back to `fileUpload.browse`. */\n readonly pickLabel = input<string | null>(null);\n\n /** Secondary instruction below the CTA. Falls back to `fileUpload.dropZone`. */\n readonly dropLabel = input<string | null>(null);\n\n /**\n * Overrides the drop zone's accessible name. Unset, the zone is named by its\n * visible copy, after the field's label inside a `<wr-form-field>`. An\n * override must contain that copy, or speech input cannot reach the control\n * (WCAG 2.5.3).\n */\n readonly dropZoneLabel = input<string | null>(null);\n\n /**\n * Name of each row's remove button. `{{name}}` is the row's file name, so the\n * buttons of a list are told apart. Falls back to `fileUpload.removeFile`,\n * \"Remove {{name}}\" in English.\n */\n readonly removeFileLabel = input<string | null>(null);\n\n /** Retry button text on a failed row. Falls back to `fileUpload.retry`. */\n readonly retryLabel = input<string | null>(null);\n\n /** Name of the `uploading` state: the progress bar's name and the announcement. Falls back to `fileUpload.uploading`. */\n readonly uploadingLabel = input<string | null>(null);\n\n /** Name of the `done` state: the mark's name and the announcement. Falls back to `fileUpload.uploaded`. */\n readonly uploadedLabel = input<string | null>(null);\n\n /** Text of a failed row whose status carries no `message`. Falls back to `fileUpload.failed`. */\n readonly failedLabel = input<string | null>(null);\n\n protected readonly resolvedPick = useI18nText(this.pickLabel, 'fileUpload.browse', 'Click to browse');\n protected readonly resolvedDrop = useI18nText(this.dropLabel, 'fileUpload.dropZone', 'or drop files here');\n private readonly removeText = useI18nFormatter('fileUpload.removeFile', 'Remove {{name}}');\n\n /** The remove button of one row, named after its file. */\n protected removeName(name: string): string {\n const given = this.removeFileLabel();\n return given ? given.replace(/\\{\\{\\s*name\\s*\\}\\}/g, () => name) : this.removeText({ name });\n }\n\n protected readonly resolvedRetry = useI18nText(this.retryLabel, 'fileUpload.retry', 'Try again');\n protected readonly resolvedUploading = useI18nText(this.uploadingLabel, 'fileUpload.uploading', 'Uploading');\n protected readonly resolvedUploaded = useI18nText(this.uploadedLabel, 'fileUpload.uploaded', 'Uploaded');\n protected readonly resolvedFailed = useI18nText(this.failedLabel, 'fileUpload.failed', 'Upload failed');\n\n /** `{{name}}: {{status}}`: a state said about one file. */\n protected readonly statusText = useI18nFormatter('fileUpload.status', '{{name}}: {{status}}');\n\n /** Optional helper text shown below the labels (e.g. accepted formats). */\n readonly helperText = input<string>('');\n\n /**\n * Selected file(s). Bound by `[formField]`, or two-way via `[(value)]`. Shape\n * follows `multiple`: a single `File` (or `null`), or a `File[]` array.\n */\n readonly value = model<File | readonly File[] | null>(null);\n\n /** Emitted when files are rejected for type / size / count reasons. */\n readonly rejected = output<readonly WrFileUploadRejection[]>();\n\n /** Emitted with the file when the retry button of a failed row is pressed. */\n readonly retry = output<File>();\n\n /** Emitted on commit so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n protected readonly picker = viewChild.required<ElementRef<HTMLInputElement>>('picker');\n private readonly zone = viewChild.required<ElementRef<HTMLElement>>('zone');\n\n protected readonly files = signal<readonly File[]>([]);\n protected readonly dragging = signal(false);\n\n /**\n * How many elements of the zone the drag is inside. The browser fires `dragleave`\n * on the zone when the pointer moves onto its own label or icon, with `dragenter`\n * on the child just before it, so \"left the zone\" read off a single event switched\n * the highlight off over the zone's text and back on over its padding. Every enter\n * counts up and every leave down; the drag has left when the count is back to 0.\n */\n private dragDepth = 0;\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly injector = inject(Injector);\n private readonly browser = isPlatformBrowser(inject(PLATFORM_ID));\n\n /** id prefix of the file names, which describe each row's retry button. @internal */\n protected readonly nameId = wrRandomId('wr-file-upload-name');\n\n /** The object URL of each previewed image file. */\n private readonly previewUrls = signal<ReadonlyMap<File, string>>(new Map());\n\n protected readonly rows = computed<readonly FileRow[]>(() => {\n const status = this.status();\n const urls = this.previewUrls();\n return this.files().map(file => {\n const entry = status?.get(file);\n const percent = entry?.state === 'uploading' ? entry.percent : null;\n const state = entry?.state ?? null;\n return {\n file,\n classes: state ? `wr-file-upload__item wr-file-upload__item--${state}` : 'wr-file-upload__item',\n state,\n percent: typeof percent === 'number' && Number.isFinite(percent) ? percent : null,\n message: entry?.state === 'error' && entry.message ? entry.message : null,\n preview: urls.get(file) ?? null,\n };\n });\n });\n\n /** `aria-busy` on the list: at least one file is uploading. */\n protected readonly busy = computed(() => this.rows().some(row => row.state === 'uploading'));\n\n /** What the one live region says: the states that changed in the last `[status]` write. */\n protected readonly announcement = signal('');\n\n /** The state each file had at the last `[status]` write, to tell a change from a percent tick. */\n private lastStates: ReadonlyMap<File, WrFileUploadState> | null = null;\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n const size = this.size();\n if (size !== 'md') parts.push(`wr-file-upload--${size}`);\n if (this.dragging()) parts.push('wr-file-upload--dragging');\n if (this.disabled()) parts.push('wr-file-upload--disabled');\n else if (this.readonly()) parts.push('wr-file-upload--readonly');\n return parts.join(' ');\n });\n\n /**\n * Human-readable file size (e.g. `1.2 MB`).\n *\n * Every piece of this used to be English and unreachable: a module-level unit\n * table with no catalog key, and `toFixed()`, which writes an ASCII decimal\n * point whatever `LOCALE_ID` says. A Russian page showed translated drop-zone\n * copy above `3.4 KB`. The number now goes through `Intl.NumberFormat` and the\n * unit through the catalog, joined by a template the catalog also owns — so a\n * locale controls the separator, the digits and whether a space sits before\n * the unit.\n *\n * Not a `computed`: it is called per file, with the file's size as its\n * argument. It still re-runs on a locale switch, because the formatters it\n * calls are signals read during the same change detection that renders the row.\n */\n protected formatBytes(bytes: number): string {\n if (!Number.isFinite(bytes) || bytes <= 0) {\n return this.sizeText({ value: this.number(0, 0), unit: this.unitTexts[0]() });\n }\n const i = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), this.unitTexts.length - 1);\n const v = bytes / 1024 ** i;\n const digits = v >= 100 || i === 0 ? 0 : 1;\n return this.sizeText({ value: this.number(v, digits), unit: this.unitTexts[i]() });\n }\n\n /** `{{value}} {{unit}}` — the join, so a locale owns the space too. */\n private readonly sizeText = useI18nFormatter('fileUpload.size', '{{value}} {{unit}}');\n\n /**\n * One resolved signal per binary unit, indexed by the power of 1024 the\n * arithmetic lands on.\n *\n * Spelled out rather than built from a key list: `i18n.spec.ts` reads every\n * catalog key the library asks for out of the SOURCE, by matching a quoted\n * dotted string inside the call, so a key built by interpolation is invisible\n * to it. That spec fails rather than passing quietly, but either way the key\n * would stop being checked.\n */\n private readonly unitTexts = [\n wrReadI18nText('fileUpload.unitByte', 'B'),\n wrReadI18nText('fileUpload.unitKb', 'KB'),\n wrReadI18nText('fileUpload.unitMb', 'MB'),\n wrReadI18nText('fileUpload.unitGb', 'GB'),\n wrReadI18nText('fileUpload.unitTb', 'TB'),\n ] as const;\n\n private readonly locale = inject(LOCALE_ID);\n\n private number(value: number, digits: number): string {\n return new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: digits,\n maximumFractionDigits: digits,\n }).format(value);\n }\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('file-upload');\n // Rebuild the internal file list from an external `value` write (mirrors the\n // old `writeValue`). Skipped when the value is merely the echo of an\n // in-component edit, so re-syncing can never clobber a live selection.\n effect(() => {\n const v = this.value();\n untracked(() => {\n // Coerce null/undefined to `[]` — a classic-forms binding can write\n // null, which the old `writeValue(v: … | null)` accepted too.\n const next: readonly File[] = v === null || v === undefined ? [] : Array.isArray(v) ? v : [v as File];\n const current = this.files();\n if (current.length === next.length && current.every((file, i) => file === next[i])) return;\n this.files.set(next);\n });\n });\n\n effect(() => {\n const rows = this.status() === null ? null : this.rows();\n untracked(() => this.announce(rows));\n });\n\n effect(() => {\n const images = this.previews() && this.browser ? this.files().filter(file => file.type.startsWith('image/')) : [];\n untracked(() => this.syncPreviews(images));\n });\n inject(DestroyRef).onDestroy(() => this.syncPreviews([]));\n }\n\n /**\n * Focus the drop zone — what Signal Forms calls to focus this control, from\n * `focusBoundControl()`. The zone is the control: the real file input beside\n * it is hidden and out of the tab order, and the host has no tab stop. A\n * read-only zone still takes it; a disabled one is left alone, as a disabled\n * native control refuses the same call.\n */\n focus(options?: FocusOptions): void {\n if (!this.disabled()) this.zone().nativeElement.focus(options);\n }\n\n // Template handlers\n\n protected openPicker(): void {\n if (this.disabled() || this.readonly()) return;\n this.picker().nativeElement.click();\n }\n\n protected onZoneKey(event: KeyboardEvent): void {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.openPicker();\n }\n }\n\n protected onPickerChange(event: Event): void {\n const target = event.target as HTMLInputElement;\n if (target.files) this.acceptFiles(Array.from(target.files));\n // Reset so picking the same file twice re-fires `change`.\n target.value = '';\n }\n\n protected onDragEnter(event: DragEvent): void {\n if (this.disabled() || this.readonly()) return;\n event.preventDefault();\n this.dragDepth++;\n this.dragging.set(true);\n }\n\n protected onDragOver(event: DragEvent): void {\n if (this.disabled() || this.readonly()) return;\n event.preventDefault();\n if (event.dataTransfer) event.dataTransfer.dropEffect = 'copy';\n }\n\n protected onDragLeave(): void {\n // See `dragDepth`: a leave onto one of the zone's own children is not leaving.\n this.dragDepth = Math.max(0, this.dragDepth - 1);\n if (this.dragDepth === 0) this.dragging.set(false);\n }\n\n protected onDrop(event: DragEvent): void {\n event.preventDefault();\n this.dragDepth = 0;\n this.dragging.set(false);\n if (this.disabled() || this.readonly()) return;\n const dropped = event.dataTransfer?.files ? Array.from(event.dataTransfer.files) : [];\n if (dropped.length > 0) this.acceptFiles(dropped);\n }\n\n protected onPaste(event: ClipboardEvent): void {\n if (!this.acceptPaste() || this.disabled() || this.readonly()) return;\n const pasted = event.clipboardData?.files ? Array.from(event.clipboardData.files) : [];\n if (pasted.length === 0) return;\n event.preventDefault();\n this.acceptFiles(pasted);\n }\n\n protected onRetry(file: File, index: number): void {\n if (this.disabled()) return;\n const button = this.host.nativeElement.ownerDocument.activeElement;\n const hadFocus = !!button?.matches('.wr-file-upload__retry') && this.host.nativeElement.contains(button);\n this.retry.emit(file);\n if (!hadFocus) return;\n // A handler that moves the file out of `error` takes the button away, and\n // focus with it. The row's remove button is what is left to hold it.\n afterNextRender(\n () => {\n if (button?.isConnected) return;\n this.host.nativeElement.querySelectorAll<HTMLElement>('.wr-file-upload__remove')[index]?.focus();\n },\n { injector: this.injector }\n );\n }\n\n protected removeAt(index: number): void {\n if (this.disabled() || this.readonly()) return;\n // Read before the row goes: the button that holds focus is about to leave the\n // document, and focus with it — to `<body>`, so the next Tab restarted at the top\n // of the page. A middle row only kept it by accident, through `track $index`\n // reusing the button for the file that moved up.\n const focused = this.host.nativeElement.ownerDocument.activeElement;\n const hadFocus = !!focused?.matches('.wr-file-upload__remove') && this.host.nativeElement.contains(focused);\n const next = this.files().filter((_, i) => i !== index);\n this.files.set(next);\n this.emit();\n if (!hadFocus) return;\n afterNextRender(\n () => {\n // The row that took this one's place, else the one before it, else the zone.\n const buttons = this.host.nativeElement.querySelectorAll<HTMLElement>('.wr-file-upload__remove');\n const target = buttons[Math.min(index, buttons.length - 1)] ?? this.zone().nativeElement;\n target.focus();\n },\n { injector: this.injector }\n );\n }\n\n // Internals\n\n private acceptFiles(incoming: readonly File[]): void {\n if (this.disabled() || this.readonly()) return;\n const accept = this.accept();\n const maxSize = this.maxSize();\n const rejections: WrFileUploadRejection[] = [];\n const accepted: File[] = [];\n\n for (const file of incoming) {\n const reason = this.reject(file, accept, maxSize);\n if (reason) rejections.push({ file, reason });\n else accepted.push(file);\n }\n\n let next: File[];\n if (this.multiple()) {\n const listed = this.files();\n const maxFiles = this.maxFiles();\n // The cap rejects incoming files only: a list already over it keeps what it holds.\n const room = maxFiles > 0 ? Math.max(0, maxFiles - listed.length) : accepted.length;\n for (const file of accepted.slice(room)) rejections.push({ file, reason: 'count' });\n next = [...listed, ...accepted.slice(0, room)];\n } else {\n // Single mode — last accepted wins, prior selection cleared.\n next = accepted.length > 0 ? [accepted[accepted.length - 1]] : [...this.files()];\n }\n\n this.files.set(next);\n this.touch.emit();\n this.emit();\n if (rejections.length > 0) this.rejected.emit(rejections);\n }\n\n /**\n * Say each state a file has just entered, in one string. `pending` is the\n * resting state and a percent tick is not a change, so neither is said, and\n * the states present when `[status]` is first bound are a starting point\n * rather than news.\n */\n private announce(rows: readonly FileRow[] | null): void {\n if (rows === null) {\n this.lastStates = null;\n return;\n }\n const next = new Map<File, WrFileUploadState>();\n const changed: string[] = [];\n for (const row of rows) {\n if (row.state === null) continue;\n next.set(row.file, row.state);\n if (this.lastStates === null || row.state === 'pending' || this.lastStates.get(row.file) === row.state) continue;\n const status =\n row.state === 'uploading'\n ? this.resolvedUploading()\n : row.state === 'done'\n ? this.resolvedUploaded()\n : (row.message ?? this.resolvedFailed());\n changed.push(this.statusText({ name: row.file.name, status }));\n }\n this.lastStates = next;\n if (changed.length > 0) {\n this.announcement.set(new Intl.ListFormat(this.locale, { style: 'short', type: 'unit' }).format(changed));\n }\n }\n\n /** Hold one object URL per file in `images`, and revoke the ones that left. */\n private syncPreviews(images: readonly File[]): void {\n const current = this.previewUrls();\n if (current.size === images.length && images.every(file => current.has(file))) return;\n if (typeof URL === 'undefined' || typeof URL.createObjectURL !== 'function') return;\n const next = new Map<File, string>();\n for (const file of images) next.set(file, current.get(file) ?? URL.createObjectURL(file));\n for (const [file, url] of current) if (!next.has(file)) URL.revokeObjectURL(url);\n this.previewUrls.set(next);\n }\n\n private reject(file: File, accept: string, maxSize: number): WrFileUploadRejectionReason | null {\n if (accept && !matchesAccept(file, accept)) return 'type';\n if (maxSize > 0 && file.size > maxSize) return 'size';\n return null;\n }\n\n private emit(): void {\n const list = this.files();\n if (this.multiple()) {\n this.value.set(list);\n } else {\n this.value.set(list.length > 0 ? list[0] : null);\n }\n }\n}\n","<div\n #zone\n class=\"wr-file-upload__zone\"\n role=\"button\"\n tabindex=\"0\"\n [attr.aria-label]=\"zoneName()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-disabled]=\"disabled() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (click)=\"openPicker()\"\n (keydown)=\"onZoneKey($event)\"\n (dragenter)=\"onDragEnter($event)\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave()\"\n (drop)=\"onDrop($event)\"\n (paste)=\"onPaste($event)\"\n>\n <svg class=\"wr-file-upload__icon\" width=\"32\" height=\"32\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path\n d=\"M12 16V4M12 4l-4 4M12 4l4 4M4 16v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n <div class=\"wr-file-upload__hint\" [id]=\"hintId\">\n <strong>{{ resolvedPick() }}</strong>\n <span>{{ resolvedDrop() }}</span>\n @if (helperText()) {\n <small>{{ helperText() }}</small>\n }\n </div>\n</div>\n\n<!--\n The real <input type=\"file\"> is never operated directly — the zone above is\n the control and forwards clicks here, so the input is visually hidden and kept\n OUTSIDE the zone: inside, it nested one interactive element within another\n (the zone is role=\"button\") and put two tab stops where users see one. It is\n positioned absolutely and clipped, so being a sibling changes nothing visually.\n aria-hidden must be paired with tabindex=\"-1\", or hiding a focusable element is\n itself a violation.\n-->\n<input\n #picker\n class=\"wr-file-upload__picker\"\n type=\"file\"\n aria-hidden=\"true\"\n tabindex=\"-1\"\n [attr.accept]=\"accept() || null\"\n [attr.multiple]=\"multiple() ? '' : null\"\n [disabled]=\"disabled() || readonly()\"\n (change)=\"onPickerChange($event)\"\n/>\n\n@if (showList() && files().length > 0) {\n <ul class=\"wr-file-upload__list\" [attr.aria-busy]=\"busy() || null\">\n @for (row of rows(); track $index) {\n <li [class]=\"row.classes\">\n @if (row.preview; as url) {\n <img class=\"wr-file-upload__preview\" alt=\"\" [src]=\"url\" />\n }\n <span\n class=\"wr-file-upload__name\"\n [attr.id]=\"row.state === 'error' ? `${nameId}-${$index}` : null\"\n [title]=\"row.file.name\"\n >{{ row.file.name }}</span\n >\n <span class=\"wr-file-upload__size\">{{ formatBytes(row.file.size) }}</span>\n @switch (row.state) {\n @case ('done') {\n <span class=\"wr-file-upload__done\" role=\"img\" [attr.aria-label]=\"resolvedUploaded()\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path\n d=\"M20 6 9 17l-5-5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </span>\n }\n @case ('error') {\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-file-upload__retry\"\n [attr.aria-describedby]=\"`${nameId}-${$index}`\"\n [disabled]=\"disabled()\"\n (click)=\"onRetry(row.file, $index)\"\n >\n {{ resolvedRetry() }}\n </button>\n }\n }\n <button\n type=\"button\"\n class=\"wr-file-upload__remove\"\n [attr.aria-label]=\"removeName(row.file.name)\"\n [disabled]=\"disabled() || readonly()\"\n (click)=\"removeAt($index)\"\n >\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" aria-hidden=\"true\">\n <path\n d=\"M2 2 L10 10 M10 2 L2 10\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n />\n </svg>\n </button>\n @if (row.state === 'uploading') {\n <wr-progress\n class=\"wr-file-upload__progress\"\n size=\"sm\"\n [indeterminate]=\"row.percent === null\"\n [value]=\"row.percent ?? 0\"\n [ariaLabel]=\"statusText({ name: row.file.name, status: resolvedUploading() })\"\n />\n } @else if (row.state === 'error') {\n <span class=\"wr-file-upload__error\">{{ row.message ?? resolvedFailed() }}</span>\n }\n </li>\n }\n </ul>\n}\n\n<!-- One live region for the whole list, in the DOM before any state changes: a\n region inserted together with its text is often not read. -->\n@if (status() !== null) {\n <span class=\"wr-file-upload__announce\" role=\"status\" aria-live=\"polite\">{{ announcement() }}</span>\n}\n"],"mappings":";;;;;;;;;;;;;;;AAuDA,SAAS,cAAc,MAAY,QAAc;CAC/C,IAAI,CAAC,QAAQ,OAAO;CACpB,MAAM,SAAS,OACZ,MAAM,GAAG,CAAC,CACV,KAAI,MAAK,EAAE,KAAI,CAAE,CAAC,YAAW,CAAE,CAAC,CAChC,OAAO,OAAO;CACjB,IAAI,OAAO,WAAW,GAAG,OAAO;CAChC,MAAM,OAAO,KAAK,KAAK,YAAW;CAClC,MAAM,OAAO,KAAK,KAAK,YAAW;CAClC,OAAO,OAAO,MAAK,UAAQ;EACzB,IAAI,MAAM,WAAW,GAAG,GAAG,OAAO,KAAK,SAAS,KAAK;EACrD,IAAI,MAAM,SAAS,IAAI,GAAG,OAAO,KAAK,WAAW,MAAM,MAAM,GAAG,EAAE,CAAC;EACnE,OAAO,SAAS;CAClB,CAAC;AACH;AAqCA,IAAa,eAAb,MAAa,aAAY;CAEd,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAG1D,SAAS,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAO1B,OAAO,MAAwB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAGpC,UAAU,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,UAAA,+BAAA,CAAA;EAAI,YAAY,MAAuB,KAAK,IAAI,GAAG,qBAAqB,GAAG,CAAC,CAAC;CAAC,CAAA;CAG/F,WAAW,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,YAAY,MA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AA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,UAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,UAAQ,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CACjB,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -29,6 +29,7 @@ var WrGraphNodeHarness = class extends ComponentHarness {
29
29
  */
30
30
  const VIEWPORT = ":scope > .wr-graph__viewport";
31
31
  const STAGE = `${VIEWPORT} > .wr-graph__stage`;
32
+ const CONTROL = ":scope > .wr-graph__controls > .wr-graph__control";
32
33
  const EDGE = `${STAGE} > .wr-graph__edges > .wr-graph__edge`;
33
34
  const NODE = `${STAGE} > .wr-graph__nodes > .wr-graph__node`;
34
35
  var WrGraphOwnNodeHarness = class extends WrGraphNodeHarness {
@@ -72,6 +73,32 @@ var WrGraphHarness = class WrGraphHarness extends ComponentHarness {
72
73
  };
73
74
  }));
74
75
  }
76
+ async isZoomable() {
77
+ return (await this.host()).hasClass("wr-graph--zoomable");
78
+ }
79
+ async zoomIn() {
80
+ await (await this.control("zoom-in", "zoomIn")).click();
81
+ }
82
+ async zoomOut() {
83
+ await (await this.control("zoom-out", "zoomOut")).click();
84
+ }
85
+ async fit() {
86
+ await (await this.control("fit", "fit")).click();
87
+ }
88
+ async getZoom() {
89
+ if (!await this.isZoomable()) throw new Error(this.notZoomable("getZoom"));
90
+ const style = await (await this.locatorFor(STAGE)()).getAttribute("style") ?? "";
91
+ const scale = /scale\(([\d.]+)\)/.exec(style);
92
+ return scale ? Number(scale[1]) : 1;
93
+ }
94
+ async control(name, method) {
95
+ const button = await this.locatorForOptional(`${CONTROL}--${name}`)();
96
+ if (!button) throw new Error(this.notZoomable(method));
97
+ return button;
98
+ }
99
+ notZoomable(method) {
100
+ return `WrGraphHarness.${method}(): the graph is not zoomable, so it draws no zoom buttons and never zooms — bind \`zoomable\` on <wr-graph> first.`;
101
+ }
75
102
  };
76
103
  export { WrGraphHarness, WrGraphNodeHarness };
77
104
 
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-graph-testing.mjs","names":[],"sources":["../../../projects/lib/graph/testing/wr-graph-node-harness.ts","../../../projects/lib/graph/testing/wr-graph-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, type ComponentHarnessConstructor, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrGraphNodeHarnessFilters } from './types';\n\n/** The visually hidden relation sentence the graph writes into every node that has an edge. */\nconst SR_ONLY = '.wr-graph__sr-only';\n\n/**\n * The node's OWN sentence. Anchored with `:scope >` because the graph writes it as a\n * direct child, after whatever the template drew — so a `<wr-graph>` nested inside a\n * node template would otherwise hand its first node's sentence to the outer node.\n */\nconst RELATION = `:scope > ${SR_ONLY}`;\n\n/**\n * What {@link WrGraphNodeHarness.getText} leaves out: the node's own sentence, and any\n * `<wr-graph>` a template drew inside the node. That inner graph is a graph of its own —\n * its cards are its nodes, read through its own harness — so counting its text as the\n * outer node's would let a RegExp label match the outer graph by a node it does not own.\n */\nconst NOT_DRAWN_BY_NODE = `${SR_ONLY}, wr-graph`;\n\n/**\n * Test harness for one node of a `<wr-graph>` — a `role=\"listitem\"` block.\n *\n * A node answers two questions, and they are kept apart on purpose. {@link getText} is\n * what is DRAWN: the default card, or whatever a `wrGraphNode` template rendered.\n * {@link getRelationText} is what is ANNOUNCED about its place in the graph: the\n * lines are `aria-hidden`, so the visually hidden sentence naming the parents and the\n * children is the only form the structure takes for a screen reader. A spec that read\n * the node's whole text would get both glued together, and would keep passing on a\n * graph whose relation sentences named the wrong neighbours.\n *\n * There is no `getId()`. The component writes a node's id nowhere in the DOM — only\n * an edge carries ids, on its `data-from` / `data-to` — so a node is addressed by what\n * it draws, and {@link WrGraphHarness.getEdges} is where ids are read.\n *\n * @example\n * ```ts\n * const birch = await graph.getNode({ label: 'Birch' });\n *\n * expect(await birch.getText()).toBe('Birch');\n * expect(await birch.getRelationText()).toBe('Parents: Atlas. Children: Dune.');\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrGraphNodeHarness extends ComponentHarness {\n static hostSelector = '.wr-graph__node';\n\n /**\n * Build a predicate that narrows the query.\n *\n * Typed on `this`, so the predicate is built for whichever node harness it is called\n * on — {@link WrGraphHarness.getNodes} narrows its own, direct-child query through\n * the same options.\n */\n static with<T extends WrGraphNodeHarness>(\n this: ComponentHarnessConstructor<T>,\n options: WrGraphNodeHarnessFilters = {}\n ): HarnessPredicate<T> {\n return new HarnessPredicate(this, options).addOption('label', options.label, (harness, label) =>\n HarnessPredicate.stringMatches(harness.getText(), label)\n );\n }\n\n /**\n * The text the node DRAWS, trimmed, with the relation sentence left out.\n *\n * The sentence is a real text node inside the block — visually hidden, not removed —\n * so a plain text read would end in `Parents: Atlas. Children: Dune.`. It is excluded\n * rather than subtracted.\n *\n * A `<wr-graph>` a template nests inside the node is left out whole, cards and\n * sentences alike: it is a graph of its own, and its nodes answer to its own harness.\n * So a node drawing `Harbor` above an inner graph of `Kestrel` and `Lark` reads\n * `Harbor`, and a `/Lark/` label does not match it.\n */\n async getText(): Promise<string> {\n return (await this.host()).text({ exclude: NOT_DRAWN_BY_NODE });\n }\n\n /**\n * The sentence a screen reader hears about the node's place in the graph — its\n * parents, then its children, as the catalog words them — or `null` for a node with\n * no edges, which the graph gives no sentence at all.\n *\n * `null` rather than `''`: the component never writes an empty sentence, so an empty\n * string could only mean the element exists and says nothing, which is a different\n * failure from a node that has nothing to say.\n */\n async getRelationText(): Promise<string | null> {\n const relation = await this.locatorForOptional(RELATION)();\n return relation ? relation.text() : null;\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrGraphHarnessFilters, WrGraphNodeHarnessFilters } from './types';\nimport { WrGraphNodeHarness } from './wr-graph-node-harness';\n\n/**\n * Every part of the graph is reached down one fixed chain of direct children. A node\n * template may draw anything, including another `<wr-graph>`, and a descendant query\n * from the outer host would count the inner graph's nodes and edges as its own.\n */\nconst VIEWPORT = ':scope > .wr-graph__viewport';\nconst STAGE = `${VIEWPORT} > .wr-graph__stage`;\nconst EDGE = `${STAGE} > .wr-graph__edges > .wr-graph__edge`;\nconst NODE = `${STAGE} > .wr-graph__nodes > .wr-graph__node`;\n\n/**\n * The same node harness, anchored to one graph. Not exported: queried from any other\n * root the `:scope` would be the wrong element, so a consumer loads\n * {@link WrGraphNodeHarness} and this class only ever comes back from\n * {@link WrGraphHarness.getNodes}.\n */\nclass WrGraphOwnNodeHarness extends WrGraphNodeHarness {\n static override hostSelector = NODE;\n}\n\n/**\n * The filters as a failure message should show them. Not `JSON.stringify`: it prints a\n * RegExp as `{}`, so a caller who had already passed one was shown nothing and then told\n * to use a RegExp. A RegExp reads as its literal, `/source/flags`; everything else as JSON.\n */\nfunction describeFilters(filters: WrGraphNodeHarnessFilters): string {\n const entries: [string, unknown][] = Object.entries(filters);\n const shown = entries\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => `${key}: ${value instanceof RegExp ? String(value) : JSON.stringify(value)}`);\n return shown.length ? `{ ${shown.join(', ')} }` : '{}';\n}\n\n/**\n * Test harness for `<wr-graph>` — blocks joined by parent-child lines, laid out in\n * layers, display only.\n *\n * The graph is read the way assistive technology reads it: the viewport's name, the\n * nodes as a list in READING order (layer, then inline position — which is DOM order),\n * each node's drawn text and its relation sentence, and the edges as the `from` / `to`\n * ids the component writes on each line. Those are what break when the data wiring\n * does.\n *\n * Three methods are deliberately absent, and each would answer the same for a working\n * graph and a broken one:\n *\n * - **No edge path `d`.** A path is a rendering detail: rounded to two decimals, mirrored\n * under RTL, and moved by every node size and gap. The same rule as\n * `WrLineChartHarness`.\n * - **No node positions.** jsdom lays nothing out, so every measured box is 0×0. The\n * inline `transform` IS the component's own write and would be readable, but its\n * numbers belong to the layout, built-in or provided — a harness method returning\n * them would make every layout improvement a breaking change to consumer specs. Coordinates are pinned in the layout's own pure spec, where the arithmetic is.\n * - **No \"is scrollable\".** Overflow is layout: in jsdom `scrollWidth` and `clientWidth`\n * are both 0 for a graph that fits and for one ten times wider. The viewport's\n * `tabindex` is no proxy either — it is always `0`, precisely so the tab stop never\n * depends on a measurement.\n *\n * An empty graph and a graph whose layout drew nothing render the same DOM, so the\n * harness cannot tell them apart. {@link getNodes} answers `[]` for both, which is the\n * honest way to assert emptiness; {@link getEdges} refuses instead, because \"no edges\"\n * would be vacuously true of a graph that drew nothing at all.\n *\n * @example\n * ```ts\n * const graph = await loader.getHarness(WrGraphHarness.with({ ariaLabel: 'Team structure' }));\n *\n * expect(await graph.getEdges()).toEqual([{ from: 'atlas', to: 'birch' }]);\n * const birch = await graph.getNode({ label: 'Birch' });\n * expect(await birch.getRelationText()).toBe('Parents: Atlas.');\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrGraphHarness extends ComponentHarness {\n static hostSelector = 'wr-graph';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrGraphHarnessFilters = {}): HarnessPredicate<WrGraphHarness> {\n return new HarnessPredicate(WrGraphHarness, options)\n .addOption('ariaLabel', options.ariaLabel, (harness, label) =>\n HarnessPredicate.stringMatches(harness.getAccessibleName(), label)\n )\n .addOption(\n 'nodeLabel',\n options.nodeLabel,\n async (harness, label) => (await harness.getNodes({ label })).length > 0\n );\n }\n\n /**\n * The viewport's accessible name — the scroller is the graph's one tab stop and the\n * element that carries it, never the host.\n */\n async getAccessibleName(): Promise<string | null> {\n return (await this.locatorFor(VIEWPORT)()).getAttribute('aria-label');\n }\n\n /**\n * Whether an asynchronous layout is still running, from the host's\n * `wr-graph--pending`. The graph draws its previous picture meanwhile, so wait\n * for this to turn `false` before reading the nodes of the new one.\n */\n async isPending(): Promise<boolean> {\n return (await this.host()).hasClass('wr-graph--pending');\n }\n\n /**\n * This graph's nodes, in reading order, narrowed by the filters.\n *\n * Only the graph's own: a graph drawn inside one of its node templates has nodes of\n * its own, and they are not this graph's. `[]` for a graph that draws no node — see\n * the class note for why that answer cannot tell empty data from a layout that drew\n * nothing.\n */\n async getNodes(filters: WrGraphNodeHarnessFilters = {}): Promise<WrGraphNodeHarness[]> {\n return this.locatorForAll(WrGraphOwnNodeHarness.with(filters))();\n }\n\n /** The first node matching the filters, or a failure that says what the graph draws. */\n async getNode(filters: WrGraphNodeHarnessFilters): Promise<WrGraphNodeHarness> {\n const [node] = await this.getNodes(filters);\n if (node) return node;\n\n const nodes = await this.getNodes();\n if (!nodes.length) {\n throw new Error(\n `WrGraphHarness.getNode(): no node matched ${describeFilters(filters)} because the graph draws no nodes ` +\n 'at all — its nodes are empty, or its layout returned nothing it could draw.'\n );\n }\n const texts = await Promise.all(nodes.map(each => each.getText()));\n throw new Error(\n `WrGraphHarness.getNode(): no node matched ${describeFilters(filters)}. The graph draws ` +\n `[${texts.join(', ')}] — a label is matched against the DRAWN text, so a template that renders more ` +\n 'than the label needs a RegExp.'\n );\n }\n\n /**\n * One `{ from, to }` per line drawn, read off the path's `data-from` / `data-to` —\n * node ids, the only place the DOM writes one — in the order the edges were given,\n * with the edges the graph skipped left out. Parallel edges each appear, since each is\n * its own line.\n *\n * Throws on a graph that draws no nodes, rather than answering `[]`: that answer would\n * be the same for empty data and for a layout that drew nothing, and a spec asserting\n * \"no edges\" would pass on both.\n */\n async getEdges(): Promise<{ from: string; to: string }[]> {\n if (!(await this.locatorForAll(NODE)()).length) {\n throw new Error(\n 'WrGraphHarness.getEdges(): the graph draws no nodes, so an empty edge list would be vacuously true — ' +\n 'it reads the same for empty data and for a layout that drew nothing. Assert getNodes() is empty ' +\n 'when an empty graph is what the spec means.'\n );\n }\n\n const paths = await this.locatorForAll(EDGE)();\n return Promise.all(\n paths.map(async (path, index) => {\n const [from, to] = await Promise.all([path.getAttribute('data-from'), path.getAttribute('data-to')]);\n if (from === null || to === null) {\n throw new Error(\n `WrGraphHarness.getEdges(): line #${index} carries no data-from / data-to, so which nodes it joins ` +\n 'is not written anywhere a test can read.'\n );\n }\n return { from, to };\n })\n );\n }\n}\n"],"mappings":";;;;;;;AAYA,MAAM,UAAU;AAOhB,MAAM,WAAW,YAAY;AAQ7B,MAAM,oBAAoB,GAAG,QAAO;AA2BpC,IAAa,qBAAb,cAAwC,iBAAgB;CACtD,OAAO,eAAe;CAStB,OAAO,KAEL,UAAqC,CAAA,GAAE;EAEvC,OAAO,IAAI,iBAAiB,MAAM,OAAO,CAAC,CAAC,UAAU,SAAS,QAAQ,QAAQ,SAAS,UACrF,iBAAiB,cAAc,QAAQ,QAAO,GAAI,KAAK,CAAC;CAE5D;CAcA,MAAM,UAAO;EACX,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,KAAK,EAAE,SAAS,kBAAiB,CAAE;CAChE;CAWA,MAAM,kBAAe;EACnB,MAAM,WAAW,MAAM,KAAK,mBAAmB,QAAQ,CAAC,CAAA;EACxD,OAAO,WAAW,SAAS,KAAI,IAAK;CACtC;;;;;;;;ACpFF,MAAM,WAAW;AACjB,MAAM,QAAQ,GAAG,SAAQ;AACzB,MAAM,OAAO,GAAG,MAAK;AACrB,MAAM,OAAO,GAAG,MAAK;AAQrB,IAAM,wBAAN,cAAoC,mBAAkB;CACpD,OAAgB,eAAe;;AAQjC,SAAS,gBAAgB,SAAkC;CAEzD,MAAM,QAD+B,OAAO,QAAQ,OACtC,CAAA,CACX,QAAQ,GAAG,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8GACY;CAEtC;CAYA,MAAM,WAAQ;EACZ,IAAI,EAAE,MAAM,KAAK,cAAc,IAAI,CAAC,CAAA,EAAA,CAAI,QACtC,MAAM,IAAI,MACR,kPAE+C;EAInD,MAAM,QAAQ,MAAM,KAAK,cAAc,IAAI,CAAC,CAAA;EAC5C,OAAO,QAAQ,IACb,MAAM,IAAI,OAAO,MAAM,UAAS;GAC9B,MAAM,CAAC,MAAM,MAAM,MAAM,QAAQ,IAAI,CAAC,KAAK,aAAa,WAAW,GAAG,KAAK,aAAa,SAAS,CAAC,CAAC;GACnG,IAAI,SAAS,QAAQ,OAAO,MAC1B,MAAM,IAAI,MACR,oCAAoC,MAAK,kGACG;GAGhD,OAAO;IAAE;IAAM;GAAE;EACnB,CAAC,CAAC;CAEN"}
1
+ {"version":3,"file":"ngwr-graph-testing.mjs","names":[],"sources":["../../../projects/lib/graph/testing/wr-graph-node-harness.ts","../../../projects/lib/graph/testing/wr-graph-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, type ComponentHarnessConstructor, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrGraphNodeHarnessFilters } from './types';\n\n/** The visually hidden relation sentence the graph writes into every node that has an edge. */\nconst SR_ONLY = '.wr-graph__sr-only';\n\n/**\n * The node's OWN sentence. Anchored with `:scope >` because the graph writes it as a\n * direct child, after whatever the template drew — so a `<wr-graph>` nested inside a\n * node template would otherwise hand its first node's sentence to the outer node.\n */\nconst RELATION = `:scope > ${SR_ONLY}`;\n\n/**\n * What {@link WrGraphNodeHarness.getText} leaves out: the node's own sentence, and any\n * `<wr-graph>` a template drew inside the node. That inner graph is a graph of its own —\n * its cards are its nodes, read through its own harness — so counting its text as the\n * outer node's would let a RegExp label match the outer graph by a node it does not own.\n */\nconst NOT_DRAWN_BY_NODE = `${SR_ONLY}, wr-graph`;\n\n/**\n * Test harness for one node of a `<wr-graph>` — a `role=\"listitem\"` block.\n *\n * A node answers two questions, and they are kept apart on purpose. {@link getText} is\n * what is DRAWN: the default card, or whatever a `wrGraphNode` template rendered.\n * {@link getRelationText} is what is ANNOUNCED about its place in the graph: the\n * lines are `aria-hidden`, so the visually hidden sentence naming the parents and the\n * children is the only form the structure takes for a screen reader. A spec that read\n * the node's whole text would get both glued together, and would keep passing on a\n * graph whose relation sentences named the wrong neighbours.\n *\n * There is no `getId()`. The component writes a node's id nowhere in the DOM — only\n * an edge carries ids, on its `data-from` / `data-to` — so a node is addressed by what\n * it draws, and {@link WrGraphHarness.getEdges} is where ids are read.\n *\n * @example\n * ```ts\n * const birch = await graph.getNode({ label: 'Birch' });\n *\n * expect(await birch.getText()).toBe('Birch');\n * expect(await birch.getRelationText()).toBe('Parents: Atlas. Children: Dune.');\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrGraphNodeHarness extends ComponentHarness {\n static hostSelector = '.wr-graph__node';\n\n /**\n * Build a predicate that narrows the query.\n *\n * Typed on `this`, so the predicate is built for whichever node harness it is called\n * on — {@link WrGraphHarness.getNodes} narrows its own, direct-child query through\n * the same options.\n */\n static with<T extends WrGraphNodeHarness>(\n this: ComponentHarnessConstructor<T>,\n options: WrGraphNodeHarnessFilters = {}\n ): HarnessPredicate<T> {\n return new HarnessPredicate(this, options).addOption('label', options.label, (harness, label) =>\n HarnessPredicate.stringMatches(harness.getText(), label)\n );\n }\n\n /**\n * The text the node DRAWS, trimmed, with the relation sentence left out.\n *\n * The sentence is a real text node inside the block — visually hidden, not removed —\n * so a plain text read would end in `Parents: Atlas. Children: Dune.`. It is excluded\n * rather than subtracted.\n *\n * A `<wr-graph>` a template nests inside the node is left out whole, cards and\n * sentences alike: it is a graph of its own, and its nodes answer to its own harness.\n * So a node drawing `Harbor` above an inner graph of `Kestrel` and `Lark` reads\n * `Harbor`, and a `/Lark/` label does not match it.\n */\n async getText(): Promise<string> {\n return (await this.host()).text({ exclude: NOT_DRAWN_BY_NODE });\n }\n\n /**\n * The sentence a screen reader hears about the node's place in the graph — its\n * parents, then its children, as the catalog words them — or `null` for a node with\n * no edges, which the graph gives no sentence at all.\n *\n * `null` rather than `''`: the component never writes an empty sentence, so an empty\n * string could only mean the element exists and says nothing, which is a different\n * failure from a node that has nothing to say.\n */\n async getRelationText(): Promise<string | null> {\n const relation = await this.locatorForOptional(RELATION)();\n return relation ? relation.text() : null;\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate, type TestElement } from '@angular/cdk/testing';\n\nimport type { WrGraphHarnessFilters, WrGraphNodeHarnessFilters } from './types';\nimport { WrGraphNodeHarness } from './wr-graph-node-harness';\n\n/**\n * Every part of the graph is reached down one fixed chain of direct children. A node\n * template may draw anything, including another `<wr-graph>`, and a descendant query\n * from the outer host would count the inner graph's nodes and edges as its own.\n */\nconst VIEWPORT = ':scope > .wr-graph__viewport';\nconst STAGE = `${VIEWPORT} > .wr-graph__stage`;\nconst CONTROL = ':scope > .wr-graph__controls > .wr-graph__control';\nconst EDGE = `${STAGE} > .wr-graph__edges > .wr-graph__edge`;\nconst NODE = `${STAGE} > .wr-graph__nodes > .wr-graph__node`;\n\n/**\n * The same node harness, anchored to one graph. Not exported: queried from any other\n * root the `:scope` would be the wrong element, so a consumer loads\n * {@link WrGraphNodeHarness} and this class only ever comes back from\n * {@link WrGraphHarness.getNodes}.\n */\nclass WrGraphOwnNodeHarness extends WrGraphNodeHarness {\n static override hostSelector = NODE;\n}\n\n/**\n * The filters as a failure message should show them. Not `JSON.stringify`: it prints a\n * RegExp as `{}`, so a caller who had already passed one was shown nothing and then told\n * to use a RegExp. A RegExp reads as its literal, `/source/flags`; everything else as JSON.\n */\nfunction describeFilters(filters: WrGraphNodeHarnessFilters): string {\n const entries: [string, unknown][] = Object.entries(filters);\n const shown = entries\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => `${key}: ${value instanceof RegExp ? String(value) : JSON.stringify(value)}`);\n return shown.length ? `{ ${shown.join(', ')} }` : '{}';\n}\n\n/**\n * Test harness for `<wr-graph>` — blocks joined by parent-child lines, laid out in\n * layers, display only.\n *\n * The graph is read the way assistive technology reads it: the viewport's name, the\n * nodes as a list in READING order (layer, then inline position — which is DOM order),\n * each node's drawn text and its relation sentence, and the edges as the `from` / `to`\n * ids the component writes on each line. Those are what break when the data wiring\n * does.\n *\n * Three methods are deliberately absent, and each would answer the same for a working\n * graph and a broken one:\n *\n * - **No edge path `d`.** A path is a rendering detail: rounded to two decimals, mirrored\n * under RTL, and moved by every node size and gap. The same rule as\n * `WrLineChartHarness`.\n * - **No node positions.** jsdom lays nothing out, so every measured box is 0×0. The\n * inline `transform` IS the component's own write and would be readable, but its\n * numbers belong to the layout, built-in or provided — a harness method returning\n * them would make every layout improvement a breaking change to consumer specs. Coordinates are pinned in the layout's own pure spec, where the arithmetic is.\n * - **No \"is scrollable\".** Overflow is layout: in jsdom `scrollWidth` and `clientWidth`\n * are both 0 for a graph that fits and for one ten times wider. The viewport's\n * `tabindex` is no proxy either — it is always `0`, precisely so the tab stop never\n * depends on a measurement.\n *\n * A `zoomable` graph is driven through its own three buttons, and its zoom is read off\n * the `scale()` the component wrote on the stage. The pan is not readable here for the\n * reason node positions are not: its pixels depend on a viewport box jsdom does not\n * have. Gestures have no method either, since the wheel, a drag and a pinch all read\n * that box.\n *\n * An empty graph and a graph whose layout drew nothing render the same DOM, so the\n * harness cannot tell them apart. {@link getNodes} answers `[]` for both, which is the\n * honest way to assert emptiness; {@link getEdges} refuses instead, because \"no edges\"\n * would be vacuously true of a graph that drew nothing at all.\n *\n * @example\n * ```ts\n * const graph = await loader.getHarness(WrGraphHarness.with({ ariaLabel: 'Team structure' }));\n *\n * expect(await graph.getEdges()).toEqual([{ from: 'atlas', to: 'birch' }]);\n * const birch = await graph.getNode({ label: 'Birch' });\n * expect(await birch.getRelationText()).toBe('Parents: Atlas.');\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrGraphHarness extends ComponentHarness {\n static hostSelector = 'wr-graph';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrGraphHarnessFilters = {}): HarnessPredicate<WrGraphHarness> {\n return new HarnessPredicate(WrGraphHarness, options)\n .addOption('ariaLabel', options.ariaLabel, (harness, label) =>\n HarnessPredicate.stringMatches(harness.getAccessibleName(), label)\n )\n .addOption(\n 'nodeLabel',\n options.nodeLabel,\n async (harness, label) => (await harness.getNodes({ label })).length > 0\n );\n }\n\n /**\n * The viewport's accessible name — the scroller is the graph's one tab stop and the\n * element that carries it, never the host.\n */\n async getAccessibleName(): Promise<string | null> {\n return (await this.locatorFor(VIEWPORT)()).getAttribute('aria-label');\n }\n\n /**\n * Whether an asynchronous layout is still running, from the host's\n * `wr-graph--pending`. The graph draws its previous picture meanwhile, so wait\n * for this to turn `false` before reading the nodes of the new one.\n */\n async isPending(): Promise<boolean> {\n return (await this.host()).hasClass('wr-graph--pending');\n }\n\n /**\n * This graph's nodes, in reading order, narrowed by the filters.\n *\n * Only the graph's own: a graph drawn inside one of its node templates has nodes of\n * its own, and they are not this graph's. `[]` for a graph that draws no node — see\n * the class note for why that answer cannot tell empty data from a layout that drew\n * nothing.\n */\n async getNodes(filters: WrGraphNodeHarnessFilters = {}): Promise<WrGraphNodeHarness[]> {\n return this.locatorForAll(WrGraphOwnNodeHarness.with(filters))();\n }\n\n /** The first node matching the filters, or a failure that says what the graph draws. */\n async getNode(filters: WrGraphNodeHarnessFilters): Promise<WrGraphNodeHarness> {\n const [node] = await this.getNodes(filters);\n if (node) return node;\n\n const nodes = await this.getNodes();\n if (!nodes.length) {\n throw new Error(\n `WrGraphHarness.getNode(): no node matched ${describeFilters(filters)} because the graph draws no nodes ` +\n 'at all — its nodes are empty, or its layout returned nothing it could draw.'\n );\n }\n const texts = await Promise.all(nodes.map(each => each.getText()));\n throw new Error(\n `WrGraphHarness.getNode(): no node matched ${describeFilters(filters)}. The graph draws ` +\n `[${texts.join(', ')}] — a label is matched against the DRAWN text, so a template that renders more ` +\n 'than the label needs a RegExp.'\n );\n }\n\n /**\n * One `{ from, to }` per line drawn, read off the path's `data-from` / `data-to` —\n * node ids, the only place the DOM writes one — in the order the edges were given,\n * with the edges the graph skipped left out. Parallel edges each appear, since each is\n * its own line.\n *\n * Throws on a graph that draws no nodes, rather than answering `[]`: that answer would\n * be the same for empty data and for a layout that drew nothing, and a spec asserting\n * \"no edges\" would pass on both.\n */\n async getEdges(): Promise<{ from: string; to: string }[]> {\n if (!(await this.locatorForAll(NODE)()).length) {\n throw new Error(\n 'WrGraphHarness.getEdges(): the graph draws no nodes, so an empty edge list would be vacuously true — ' +\n 'it reads the same for empty data and for a layout that drew nothing. Assert getNodes() is empty ' +\n 'when an empty graph is what the spec means.'\n );\n }\n\n const paths = await this.locatorForAll(EDGE)();\n return Promise.all(\n paths.map(async (path, index) => {\n const [from, to] = await Promise.all([path.getAttribute('data-from'), path.getAttribute('data-to')]);\n if (from === null || to === null) {\n throw new Error(\n `WrGraphHarness.getEdges(): line #${index} carries no data-from / data-to, so which nodes it joins ` +\n 'is not written anywhere a test can read.'\n );\n }\n return { from, to };\n })\n );\n }\n\n /** Whether the graph zooms and pans, from the host's `wr-graph--zoomable`. */\n async isZoomable(): Promise<boolean> {\n return (await this.host()).hasClass('wr-graph--zoomable');\n }\n\n /** Clicks the zoom-in button: one step, around the middle of the viewport. Throws unless `zoomable`. */\n async zoomIn(): Promise<void> {\n await (await this.control('zoom-in', 'zoomIn')).click();\n }\n\n /** Clicks the zoom-out button: one step, around the middle of the viewport. Throws unless `zoomable`. */\n async zoomOut(): Promise<void> {\n await (await this.control('zoom-out', 'zoomOut')).click();\n }\n\n /**\n * Clicks the fit button. Throws unless `zoomable`.\n *\n * A fit needs the viewport's box, and jsdom gives every element a 0×0 one, so there\n * the click changes nothing. A spec that asserts the fitted zoom has to stub\n * `getBoundingClientRect` on the `.wr-graph__viewport` element first.\n */\n async fit(): Promise<void> {\n await (await this.control('fit', 'fit')).click();\n }\n\n /**\n * The zoom the component drew, where `1` is 100%: the `scale()` in the stage's inline\n * `transform`, or `1` when it wrote none. Throws unless `zoomable`, where no zoom is\n * ever drawn and `1` would be vacuously true.\n */\n async getZoom(): Promise<number> {\n if (!(await this.isZoomable())) throw new Error(this.notZoomable('getZoom'));\n const style = (await (await this.locatorFor(STAGE)()).getAttribute('style')) ?? '';\n const scale = /scale\\(([\\d.]+)\\)/.exec(style);\n return scale ? Number(scale[1]) : 1;\n }\n\n private async control(name: string, method: string): Promise<TestElement> {\n const button = await this.locatorForOptional(`${CONTROL}--${name}`)();\n if (!button) throw new Error(this.notZoomable(method));\n return button;\n }\n\n private notZoomable(method: string): string {\n return (\n `WrGraphHarness.${method}(): the graph is not zoomable, so it draws no zoom buttons and never zooms — ` +\n 'bind `zoomable` on <wr-graph> first.'\n );\n }\n}\n"],"mappings":";;;;;;;AAYA,MAAM,UAAU;AAOhB,MAAM,WAAW,YAAY;AAQ7B,MAAM,oBAAoB,GAAG,QAAO;AA2BpC,IAAa,qBAAb,cAAwC,iBAAgB;CACtD,OAAO,eAAe;CAStB,OAAO,KAEL,UAAqC,CAAA,GAAE;EAEvC,OAAO,IAAI,iBAAiB,MAAM,OAAO,CAAC,CAAC,UAAU,SAAS,QAAQ,QAAQ,SAAS,UACrF,iBAAiB,cAAc,QAAQ,QAAO,GAAI,KAAK,CAAC;CAE5D;CAcA,MAAM,UAAO;EACX,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,KAAK,EAAE,SAAS,kBAAiB,CAAE;CAChE;CAWA,MAAM,kBAAe;EACnB,MAAM,WAAW,MAAM,KAAK,mBAAmB,QAAQ,CAAC,CAAA;EACxD,OAAO,WAAW,SAAS,KAAI,IAAK;CACtC;;;;;;;;ACpFF,MAAM,WAAW;AACjB,MAAM,QAAQ,GAAG,SAA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