@atomic-ui/ui 0.10.1 → 0.12.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 (208) hide show
  1. package/custom-elements.json +9839 -6255
  2. package/dist/base/FieldElement.d.ts +10 -3
  3. package/dist/{chunk-YWP2Z3JN.js → chunk-2TNF7O43.js} +7 -5
  4. package/dist/{chunk-YWP2Z3JN.js.map → chunk-2TNF7O43.js.map} +1 -1
  5. package/dist/{chunk-FKUBEVCU.js → chunk-2WHOBIOY.js} +11 -9
  6. package/dist/{chunk-FKUBEVCU.js.map → chunk-2WHOBIOY.js.map} +1 -1
  7. package/dist/{chunk-26BO3W56.js → chunk-3BWCD5U5.js} +5 -3
  8. package/dist/{chunk-26BO3W56.js.map → chunk-3BWCD5U5.js.map} +1 -1
  9. package/dist/chunk-3GPGDERO.js +201 -0
  10. package/dist/chunk-3GPGDERO.js.map +1 -0
  11. package/dist/{chunk-3T7J66Z2.js → chunk-3KAFK24X.js} +13 -11
  12. package/dist/chunk-3KAFK24X.js.map +1 -0
  13. package/dist/{chunk-5OJAJA3U.js → chunk-5HCWL2YD.js} +6 -4
  14. package/dist/{chunk-5OJAJA3U.js.map → chunk-5HCWL2YD.js.map} +1 -1
  15. package/dist/{chunk-AG4EP3OY.js → chunk-5IGBH4GL.js} +8 -6
  16. package/dist/{chunk-AG4EP3OY.js.map → chunk-5IGBH4GL.js.map} +1 -1
  17. package/dist/{chunk-AL4IUSML.js → chunk-5OYQZWP2.js} +5 -3
  18. package/dist/{chunk-AL4IUSML.js.map → chunk-5OYQZWP2.js.map} +1 -1
  19. package/dist/chunk-5PRB7P7N.js +167 -0
  20. package/dist/chunk-5PRB7P7N.js.map +1 -0
  21. package/dist/chunk-6CDQSHVW.js +21 -0
  22. package/dist/chunk-6CDQSHVW.js.map +1 -0
  23. package/dist/{chunk-MLKNZL5J.js → chunk-6J22I7F6.js} +14 -12
  24. package/dist/chunk-6J22I7F6.js.map +1 -0
  25. package/dist/chunk-72WNCCDC.js +136 -0
  26. package/dist/chunk-72WNCCDC.js.map +1 -0
  27. package/dist/chunk-7UI3OBXL.js +104 -0
  28. package/dist/chunk-7UI3OBXL.js.map +1 -0
  29. package/dist/{chunk-D6NET2VB.js → chunk-ALFE35FS.js} +30 -3
  30. package/dist/chunk-ALFE35FS.js.map +1 -0
  31. package/dist/chunk-AYINRYNC.js +184 -0
  32. package/dist/chunk-AYINRYNC.js.map +1 -0
  33. package/dist/{chunk-2D2IMQII.js → chunk-BAITBJUC.js} +51 -29
  34. package/dist/chunk-BAITBJUC.js.map +1 -0
  35. package/dist/{chunk-2EP3IV3G.js → chunk-BGHAANTP.js} +22 -8
  36. package/dist/chunk-BGHAANTP.js.map +1 -0
  37. package/dist/{chunk-OJO62KRX.js → chunk-CFCFKLTN.js} +85 -10
  38. package/dist/chunk-CFCFKLTN.js.map +1 -0
  39. package/dist/{chunk-UFPI4I2Y.js → chunk-CQT3VPYK.js} +8 -29
  40. package/dist/chunk-CQT3VPYK.js.map +1 -0
  41. package/dist/{chunk-AURT72IC.js → chunk-DXLEYNID.js} +13 -7
  42. package/dist/chunk-DXLEYNID.js.map +1 -0
  43. package/dist/{chunk-L4CIBOGK.js → chunk-EKPTMRBG.js} +5 -3
  44. package/dist/{chunk-L4CIBOGK.js.map → chunk-EKPTMRBG.js.map} +1 -1
  45. package/dist/{chunk-7UWJXPR3.js → chunk-F3NHPQU5.js} +17 -36
  46. package/dist/chunk-F3NHPQU5.js.map +1 -0
  47. package/dist/{chunk-Z2EWQMTR.js → chunk-F4IXELLK.js} +5 -3
  48. package/dist/{chunk-Z2EWQMTR.js.map → chunk-F4IXELLK.js.map} +1 -1
  49. package/dist/{chunk-APQEXM4I.js → chunk-FJHPGOGS.js} +5 -3
  50. package/dist/{chunk-APQEXM4I.js.map → chunk-FJHPGOGS.js.map} +1 -1
  51. package/dist/chunk-FLAUZU7Y.js +345 -0
  52. package/dist/chunk-FLAUZU7Y.js.map +1 -0
  53. package/dist/{chunk-3NEWOO2P.js → chunk-FZWUQC42.js} +7 -5
  54. package/dist/{chunk-3NEWOO2P.js.map → chunk-FZWUQC42.js.map} +1 -1
  55. package/dist/{chunk-ONED3PUB.js → chunk-HSXLSJVG.js} +54 -8
  56. package/dist/chunk-HSXLSJVG.js.map +1 -0
  57. package/dist/{chunk-V7EB7Q2M.js → chunk-JTCTQBAX.js} +2 -131
  58. package/dist/chunk-JTCTQBAX.js.map +1 -0
  59. package/dist/{chunk-ZL3JFUIE.js → chunk-K5QFVLCI.js} +7 -5
  60. package/dist/{chunk-ZL3JFUIE.js.map → chunk-K5QFVLCI.js.map} +1 -1
  61. package/dist/{chunk-DN5YZFSG.js → chunk-KE6WCXQP.js} +55 -9
  62. package/dist/chunk-KE6WCXQP.js.map +1 -0
  63. package/dist/chunk-LBHTXY7K.js +75 -0
  64. package/dist/chunk-LBHTXY7K.js.map +1 -0
  65. package/dist/{chunk-OZGKK3N5.js → chunk-LP4RTYTL.js} +88 -9
  66. package/dist/chunk-LP4RTYTL.js.map +1 -0
  67. package/dist/{chunk-MOO63SHZ.js → chunk-LXVPWTSY.js} +80 -23
  68. package/dist/chunk-LXVPWTSY.js.map +1 -0
  69. package/dist/{chunk-JNLKM3JT.js → chunk-N6EEW2GF.js} +6 -4
  70. package/dist/{chunk-JNLKM3JT.js.map → chunk-N6EEW2GF.js.map} +1 -1
  71. package/dist/chunk-NHEU5FT6.js +115 -0
  72. package/dist/chunk-NHEU5FT6.js.map +1 -0
  73. package/dist/chunk-P3BPW446.js +294 -0
  74. package/dist/chunk-P3BPW446.js.map +1 -0
  75. package/dist/chunk-QPOM7W3D.js +104 -0
  76. package/dist/chunk-QPOM7W3D.js.map +1 -0
  77. package/dist/{chunk-FU3CEHBS.js → chunk-R6PBY3YN.js} +6 -4
  78. package/dist/{chunk-FU3CEHBS.js.map → chunk-R6PBY3YN.js.map} +1 -1
  79. package/dist/{chunk-TJOYBDKS.js → chunk-R6YMSJR7.js} +65 -36
  80. package/dist/chunk-R6YMSJR7.js.map +1 -0
  81. package/dist/{chunk-ZEIV5X3U.js → chunk-SOYKSPPX.js} +73 -23
  82. package/dist/chunk-SOYKSPPX.js.map +1 -0
  83. package/dist/{chunk-NKMJMVZP.js → chunk-T52CUOCJ.js} +5 -3
  84. package/dist/{chunk-NKMJMVZP.js.map → chunk-T52CUOCJ.js.map} +1 -1
  85. package/dist/chunk-UFENSIWD.js +135 -0
  86. package/dist/chunk-UFENSIWD.js.map +1 -0
  87. package/dist/{chunk-A4M3A4SZ.js → chunk-UYTIJCCW.js} +10 -42
  88. package/dist/chunk-UYTIJCCW.js.map +1 -0
  89. package/dist/chunk-XX6JZW5N.js +36 -0
  90. package/dist/chunk-XX6JZW5N.js.map +1 -0
  91. package/dist/{chunk-2ZF3J7OO.js → chunk-XXSZL5CY.js} +17 -5
  92. package/dist/chunk-XXSZL5CY.js.map +1 -0
  93. package/dist/{chunk-6PMA6NHE.js → chunk-Y55FNQHS.js} +5 -3
  94. package/dist/{chunk-6PMA6NHE.js.map → chunk-Y55FNQHS.js.map} +1 -1
  95. package/dist/chunk-ZAWGJC4I.js +176 -0
  96. package/dist/chunk-ZAWGJC4I.js.map +1 -0
  97. package/dist/chunk-ZUQ3DOG2.js +110 -0
  98. package/dist/chunk-ZUQ3DOG2.js.map +1 -0
  99. package/dist/components/accordion.d.ts +22 -0
  100. package/dist/components/accordion.js +6 -2
  101. package/dist/components/alert.d.ts +22 -1
  102. package/dist/components/alert.js +3 -2
  103. package/dist/components/app-bar.d.ts +153 -0
  104. package/dist/components/app-bar.js +15 -0
  105. package/dist/components/app-bar.js.map +1 -0
  106. package/dist/components/app-ui.d.ts +29 -2
  107. package/dist/components/app-ui.js +5 -4
  108. package/dist/components/badge.d.ts +17 -1
  109. package/dist/components/badge.js +4 -3
  110. package/dist/components/blocks.js +5 -4
  111. package/dist/components/button.d.ts +18 -2
  112. package/dist/components/button.js +4 -3
  113. package/dist/components/checkbox-group.js +4 -3
  114. package/dist/components/checkbox.js +4 -3
  115. package/dist/components/checked.d.ts +77 -0
  116. package/dist/components/checked.js +10 -0
  117. package/dist/components/checked.js.map +1 -0
  118. package/dist/components/chip-group.d.ts +113 -0
  119. package/dist/components/chip-group.js +11 -0
  120. package/dist/components/chip-group.js.map +1 -0
  121. package/dist/components/chip.d.ts +11 -0
  122. package/dist/components/chip.js +3 -2
  123. package/dist/components/code-diff.d.ts +77 -0
  124. package/dist/components/code-diff.js +10 -0
  125. package/dist/components/code-diff.js.map +1 -0
  126. package/dist/components/date-input.js +4 -3
  127. package/dist/components/dialog.d.ts +15 -0
  128. package/dist/components/dialog.js +3 -2
  129. package/dist/components/fieldset.js +3 -2
  130. package/dist/components/grid.js +3 -2
  131. package/dist/components/help.js +3 -2
  132. package/dist/components/icon.js +3 -2
  133. package/dist/components/journey.js +4 -3
  134. package/dist/components/language-switch.d.ts +59 -0
  135. package/dist/components/language-switch.js +10 -0
  136. package/dist/components/language-switch.js.map +1 -0
  137. package/dist/components/layout.d.ts +8 -2
  138. package/dist/components/layout.js +3 -2
  139. package/dist/components/link.js +4 -3
  140. package/dist/components/list.js +3 -2
  141. package/dist/components/media.js +3 -2
  142. package/dist/components/meter.d.ts +112 -0
  143. package/dist/components/meter.js +13 -0
  144. package/dist/components/meter.js.map +1 -0
  145. package/dist/components/navigation.d.ts +52 -0
  146. package/dist/components/navigation.js +4 -3
  147. package/dist/components/page.d.ts +13 -8
  148. package/dist/components/page.js +3 -2
  149. package/dist/components/price.js +3 -2
  150. package/dist/components/progress.d.ts +16 -2
  151. package/dist/components/progress.js +3 -2
  152. package/dist/components/radio-group.js +4 -3
  153. package/dist/components/redaction.d.ts +51 -0
  154. package/dist/components/redaction.js +10 -0
  155. package/dist/components/redaction.js.map +1 -0
  156. package/dist/components/rows.d.ts +28 -0
  157. package/dist/components/rows.js +7 -3
  158. package/dist/components/select.js +4 -3
  159. package/dist/components/shell.js +4 -3
  160. package/dist/components/source.d.ts +68 -0
  161. package/dist/components/source.js +10 -0
  162. package/dist/components/source.js.map +1 -0
  163. package/dist/components/status-pill-style.d.ts +16 -0
  164. package/dist/components/status-pill-style.js +15 -0
  165. package/dist/components/status-pill-style.js.map +1 -0
  166. package/dist/components/status.d.ts +66 -0
  167. package/dist/components/status.js +10 -0
  168. package/dist/components/status.js.map +1 -0
  169. package/dist/components/summary-list.js +3 -2
  170. package/dist/components/switch.js +4 -3
  171. package/dist/components/table.d.ts +19 -0
  172. package/dist/components/table.js +4 -3
  173. package/dist/components/text-input.js +5 -4
  174. package/dist/components/textarea.d.ts +5 -0
  175. package/dist/components/textarea.js +4 -3
  176. package/dist/components/tool-card.d.ts +107 -0
  177. package/dist/components/tool-card.js +11 -0
  178. package/dist/components/tool-card.js.map +1 -0
  179. package/dist/components/tool-kit-tokens.d.ts +25 -0
  180. package/dist/components/tool-kit-tokens.js +8 -0
  181. package/dist/components/tool-kit-tokens.js.map +1 -0
  182. package/dist/index.d.ts +11 -0
  183. package/dist/index.js +116 -70
  184. package/dist/standalone/atomic-ui.js +2047 -733
  185. package/dist/standalone/atomic-ui.js.map +4 -4
  186. package/package.json +2 -2
  187. package/dist/chunk-2D2IMQII.js.map +0 -1
  188. package/dist/chunk-2EP3IV3G.js.map +0 -1
  189. package/dist/chunk-2ZF3J7OO.js.map +0 -1
  190. package/dist/chunk-3T7J66Z2.js.map +0 -1
  191. package/dist/chunk-7UWJXPR3.js.map +0 -1
  192. package/dist/chunk-A4M3A4SZ.js.map +0 -1
  193. package/dist/chunk-AURT72IC.js.map +0 -1
  194. package/dist/chunk-AYKYHZGQ.js +0 -108
  195. package/dist/chunk-AYKYHZGQ.js.map +0 -1
  196. package/dist/chunk-D6NET2VB.js.map +0 -1
  197. package/dist/chunk-DN5YZFSG.js.map +0 -1
  198. package/dist/chunk-MLKNZL5J.js.map +0 -1
  199. package/dist/chunk-MOO63SHZ.js.map +0 -1
  200. package/dist/chunk-OJO62KRX.js.map +0 -1
  201. package/dist/chunk-ONED3PUB.js.map +0 -1
  202. package/dist/chunk-OZGKK3N5.js.map +0 -1
  203. package/dist/chunk-QU3U2CS2.js +0 -144
  204. package/dist/chunk-QU3U2CS2.js.map +0 -1
  205. package/dist/chunk-TJOYBDKS.js.map +0 -1
  206. package/dist/chunk-UFPI4I2Y.js.map +0 -1
  207. package/dist/chunk-V7EB7Q2M.js.map +0 -1
  208. package/dist/chunk-ZEIV5X3U.js.map +0 -1
@@ -0,0 +1,167 @@
1
+ import {
2
+ kit
3
+ } from "./chunk-XX6JZW5N.js";
4
+ import {
5
+ ImpaktElement,
6
+ focusRing
7
+ } from "./chunk-72WNCCDC.js";
8
+ import {
9
+ space,
10
+ t,
11
+ token
12
+ } from "./chunk-JTCTQBAX.js";
13
+
14
+ // packages/ui/src/components/tool-card.ts
15
+ import { css, html, nothing } from "lit";
16
+ var ImpaktToolCard = class extends ImpaktElement {
17
+ static {
18
+ this.properties = {
19
+ name: { type: String },
20
+ description: { type: String },
21
+ status: { type: String },
22
+ statusTone: { type: String, attribute: "status-tone" },
23
+ note: { type: String },
24
+ href: { type: String },
25
+ actionLabel: { type: String, attribute: "action-label" },
26
+ owned: { type: Boolean, reflect: true },
27
+ state: { type: String, reflect: true },
28
+ headingLevel: { type: Number, attribute: "heading-level" },
29
+ comingSoonText: { type: String, attribute: "coming-soon-text" },
30
+ notOpenText: { type: String, attribute: "not-open-text" }
31
+ };
32
+ }
33
+ constructor() {
34
+ super();
35
+ this.name = "";
36
+ this.description = "";
37
+ this.status = "";
38
+ this.statusTone = "ok";
39
+ this.note = "";
40
+ this.href = "";
41
+ this.actionLabel = "";
42
+ this.owned = false;
43
+ this.state = "open";
44
+ this.headingLevel = 3;
45
+ this.comingSoonText = "Coming soon";
46
+ this.notOpenText = "Not open yet.";
47
+ }
48
+ static {
49
+ this.styles = [
50
+ ...ImpaktElement.styles,
51
+ focusRing,
52
+ css`
53
+ :host {
54
+ display: block;
55
+ }
56
+ .card {
57
+ display: flex;
58
+ flex-direction: column;
59
+ gap: ${space(4)};
60
+ block-size: 100%;
61
+ padding: ${space(6)};
62
+ background: ${t.surfaceCard};
63
+ border: 1px solid ${t.text};
64
+ border-radius: 0;
65
+ }
66
+ :host([state='coming-soon']) .card {
67
+ background: ${t.surfaceSubtle};
68
+ }
69
+ .name {
70
+ margin: 0;
71
+ font-family: ${t.fontHeading};
72
+ font-size: 2rem;
73
+ font-weight: ${kit.medium};
74
+ line-height: 1.1;
75
+ letter-spacing: ${t.trackingTight};
76
+ color: ${t.text};
77
+ overflow-wrap: anywhere;
78
+ }
79
+ :host([state='coming-soon']) .name {
80
+ color: ${t.textMuted};
81
+ }
82
+ .description {
83
+ margin: 0;
84
+ color: ${t.textMuted};
85
+ }
86
+ .status {
87
+ display: flex;
88
+ flex-wrap: wrap;
89
+ align-items: center;
90
+ gap: ${space(2)} ${space(2.5)};
91
+ }
92
+ .note {
93
+ font-family: ${t.fontMono};
94
+ font-size: ${kit.small};
95
+ color: ${t.textMuted};
96
+ }
97
+ .muted {
98
+ margin: 0;
99
+ font-size: ${kit.small};
100
+ color: ${t.textMuted};
101
+ }
102
+ .action {
103
+ display: flex;
104
+ align-items: center;
105
+ justify-content: space-between;
106
+ gap: ${space(3)};
107
+ min-block-size: 46px;
108
+ margin-block-start: auto;
109
+ padding: ${space(2.5)} ${space(5)};
110
+ font-family: ${t.fontBody};
111
+ font-size: ${token("font.size.md", "1rem")};
112
+ color: ${t.text};
113
+ background: ${t.surfaceCard};
114
+ border: 1px solid ${t.text};
115
+ border-radius: 0;
116
+ text-decoration: none;
117
+ }
118
+ .action:hover {
119
+ background: ${t.surfaceSubtle};
120
+ }
121
+ :host([owned]) .action {
122
+ color: ${kit.onInverse};
123
+ background: ${kit.inverse};
124
+ }
125
+ :host([owned]) .action:hover {
126
+ background: color-mix(in srgb, ${kit.inverse} 88%, ${kit.onInverse});
127
+ }
128
+ .arrow {
129
+ font-size: 1.25em;
130
+ line-height: 1;
131
+ }
132
+ @media (forced-colors: active) {
133
+ .card,
134
+ .action {
135
+ border-color: CanvasText;
136
+ }
137
+ }
138
+ `
139
+ ];
140
+ }
141
+ renderStatus() {
142
+ if (this.state === "coming-soon")
143
+ return html`<div class="status"><impakt-status tone="neutral">${this.comingSoonText}</impakt-status></div>
144
+ <p class="muted">${this.notOpenText}</p>`;
145
+ if (!this.status && !this.note) return nothing;
146
+ return html`<div class="status">
147
+ ${this.status ? html`<impakt-status tone=${this.statusTone}>${this.status}</impakt-status>` : nothing}
148
+ ${this.note ? html`<span class="note">${this.note}</span>` : nothing}
149
+ </div>`;
150
+ }
151
+ render() {
152
+ const level = Math.min(6, Math.max(2, Number(this.headingLevel) || 3));
153
+ const action = this.actionLabel || `Open ${this.name}`;
154
+ return html`<article class="card" part="card" aria-labelledby=${this.id_("name")}>
155
+ <div class="name" role="heading" aria-level=${level} id=${this.id_("name")}>${this.name}</div>
156
+ ${this.description ? html`<p class="description">${this.description}</p>` : nothing}
157
+ ${this.renderStatus()}
158
+ ${this.state !== "coming-soon" && this.href ? html`<a class="action" part="action" href=${this.href}><span>${action}</span><span class="arrow" aria-hidden="true">→</span></a>` : nothing}
159
+ </article>`;
160
+ }
161
+ };
162
+ customElements.define("impakt-tool-card", ImpaktToolCard);
163
+
164
+ export {
165
+ ImpaktToolCard
166
+ };
167
+ //# sourceMappingURL=chunk-5PRB7P7N.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/tool-card.ts"],"sourcesContent":["/**\n * A tool on the account home: its name, what it does, where it stands, and the way in.\n */\nimport { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing } from '../base/styles';\nimport { space, t, token } from '../base/tokens';\nimport { kit } from './tool-kit-tokens';\nimport type { StatusTone } from './status';\nimport './status';\n\n/**\n * One tool on the account home: a large name, one line on what it does, a\n * status pill, and a full-width button into it.\n *\n * A tool the organisation has bought (`owned`) has the primary ink button and\n * a status such as \"Monitoring · 1 site\". One it has not bought has the\n * outline button, a neutral \"Nothing bought yet\" pill and a price line such as\n * \"From £59 a dispute\". A tool that is not open yet (`state=\"coming-soon\"`) is\n * drawn on the soft surface with a muted name, a \"Coming soon\" pill and \"Not\n * open yet.\", and has no link at all, so there is nothing to press that leads\n * nowhere.\n *\n * The name is a heading; set `heading-level` to fit the page round it.\n *\n * Figma: Account home `53:708`.\n *\n * @category content\n * @icon card\n * @csspart card - The card.\n * @csspart action - The button into the tool.\n */\nexport class ImpaktToolCard extends ImpaktElement {\n static properties = {\n name: { type: String },\n description: { type: String },\n status: { type: String },\n statusTone: { type: String, attribute: 'status-tone' },\n note: { type: String },\n href: { type: String },\n actionLabel: { type: String, attribute: 'action-label' },\n owned: { type: Boolean, reflect: true },\n state: { type: String, reflect: true },\n headingLevel: { type: Number, attribute: 'heading-level' },\n comingSoonText: { type: String, attribute: 'coming-soon-text' },\n notOpenText: { type: String, attribute: 'not-open-text' },\n };\n\n /** The tool's name, such as \"Accessibility\". */\n declare name: string;\n /** One line on what it does. */\n declare description: string;\n /** The words of the status pill: \"Monitoring · 1 site\", \"Nothing bought yet\". */\n declare status: string;\n /** The pill's tone. `ok` for a tool in use, `neutral` for one not bought. */\n declare statusTone: StatusTone;\n /** A mono line after the pill, such as a price: \"From £59 a dispute\". */\n declare note: string;\n /** Where the tool opens. */\n declare href: string;\n /** The button's words. \"Open\" and the tool's name when empty. */\n declare actionLabel: string;\n /** The organisation has this tool: the button is the primary ink one. */\n declare owned: boolean;\n /** `open`, or `coming-soon` for a tool with no way in yet. */\n declare state: 'open' | 'coming-soon';\n declare headingLevel: 2 | 3 | 4 | 5 | 6;\n /** The pill on a tool that is not open yet. */\n declare comingSoonText: string;\n /** The line under that pill. */\n declare notOpenText: string;\n\n constructor() {\n super();\n this.name = '';\n this.description = '';\n this.status = '';\n this.statusTone = 'ok';\n this.note = '';\n this.href = '';\n this.actionLabel = '';\n this.owned = false;\n this.state = 'open';\n this.headingLevel = 3;\n this.comingSoonText = 'Coming soon';\n this.notOpenText = 'Not open yet.';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host {\n display: block;\n }\n .card {\n display: flex;\n flex-direction: column;\n gap: ${space(4)};\n block-size: 100%;\n padding: ${space(6)};\n background: ${t.surfaceCard};\n border: 1px solid ${t.text};\n border-radius: 0;\n }\n :host([state='coming-soon']) .card {\n background: ${t.surfaceSubtle};\n }\n .name {\n margin: 0;\n font-family: ${t.fontHeading};\n font-size: 2rem;\n font-weight: ${kit.medium};\n line-height: 1.1;\n letter-spacing: ${t.trackingTight};\n color: ${t.text};\n overflow-wrap: anywhere;\n }\n :host([state='coming-soon']) .name {\n color: ${t.textMuted};\n }\n .description {\n margin: 0;\n color: ${t.textMuted};\n }\n .status {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: ${space(2)} ${space(2.5)};\n }\n .note {\n font-family: ${t.fontMono};\n font-size: ${kit.small};\n color: ${t.textMuted};\n }\n .muted {\n margin: 0;\n font-size: ${kit.small};\n color: ${t.textMuted};\n }\n .action {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: ${space(3)};\n min-block-size: 46px;\n margin-block-start: auto;\n padding: ${space(2.5)} ${space(5)};\n font-family: ${t.fontBody};\n font-size: ${token('font.size.md', '1rem')};\n color: ${t.text};\n background: ${t.surfaceCard};\n border: 1px solid ${t.text};\n border-radius: 0;\n text-decoration: none;\n }\n .action:hover {\n background: ${t.surfaceSubtle};\n }\n :host([owned]) .action {\n color: ${kit.onInverse};\n background: ${kit.inverse};\n }\n :host([owned]) .action:hover {\n background: color-mix(in srgb, ${kit.inverse} 88%, ${kit.onInverse});\n }\n .arrow {\n font-size: 1.25em;\n line-height: 1;\n }\n @media (forced-colors: active) {\n .card,\n .action {\n border-color: CanvasText;\n }\n }\n `,\n ];\n\n private renderStatus(): TemplateResult | typeof nothing {\n if (this.state === 'coming-soon')\n return html`<div class=\"status\"><impakt-status tone=\"neutral\">${this.comingSoonText}</impakt-status></div>\n <p class=\"muted\">${this.notOpenText}</p>`;\n if (!this.status && !this.note) return nothing;\n return html`<div class=\"status\">\n ${this.status ? html`<impakt-status tone=${this.statusTone}>${this.status}</impakt-status>` : nothing}\n ${this.note ? html`<span class=\"note\">${this.note}</span>` : nothing}\n </div>`;\n }\n\n render(): TemplateResult {\n const level = Math.min(6, Math.max(2, Number(this.headingLevel) || 3));\n const action = this.actionLabel || `Open ${this.name}`;\n return html`<article class=\"card\" part=\"card\" aria-labelledby=${this.id_('name')}>\n <div class=\"name\" role=\"heading\" aria-level=${level} id=${this.id_('name')}>${this.name}</div>\n ${this.description ? html`<p class=\"description\">${this.description}</p>` : nothing}\n ${this.renderStatus()}\n ${\n this.state !== 'coming-soon' && this.href\n ? html`<a class=\"action\" part=\"action\" href=${this.href}><span>${action}</span><span class=\"arrow\" aria-hidden=\"true\">→</span></a>`\n : nothing\n }\n </article>`;\n }\n}\n\ncustomElements.define('impakt-tool-card', ImpaktToolCard);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-tool-card': ImpaktToolCard;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAGA,SAAS,KAAK,MAAM,eAAoC;AA6BjD,IAAM,iBAAN,cAA6B,cAAc;AAAA,EAChD;AAAA,SAAO,aAAa;AAAA,MAClB,MAAM,EAAE,MAAM,OAAO;AAAA,MACrB,aAAa,EAAE,MAAM,OAAO;AAAA,MAC5B,QAAQ,EAAE,MAAM,OAAO;AAAA,MACvB,YAAY,EAAE,MAAM,QAAQ,WAAW,cAAc;AAAA,MACrD,MAAM,EAAE,MAAM,OAAO;AAAA,MACrB,MAAM,EAAE,MAAM,OAAO;AAAA,MACrB,aAAa,EAAE,MAAM,QAAQ,WAAW,eAAe;AAAA,MACvD,OAAO,EAAE,MAAM,SAAS,SAAS,KAAK;AAAA,MACtC,OAAO,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACrC,cAAc,EAAE,MAAM,QAAQ,WAAW,gBAAgB;AAAA,MACzD,gBAAgB,EAAE,MAAM,QAAQ,WAAW,mBAAmB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-pill-style.ts
2
+ import { css, html, nothing } from "lit";
3
+ var STATUS_TONES = ["ok", "bad", "warn", "info", "neutral", "solid"];
4
+ var statusPillStyles = css`
5
+ .status-pill {
6
+ flex: none;
7
+ inline-size: fit-content;
8
+ }
9
+ `;
10
+ var statusPill = (text, tone, part = "status") => {
11
+ if (!text) return nothing;
12
+ const known = STATUS_TONES.includes(tone) ? tone : "neutral";
13
+ return html`<impakt-status class="status-pill" part=${part} tone=${known} label=${text}></impakt-status>`;
14
+ };
15
+
16
+ export {
17
+ STATUS_TONES,
18
+ statusPillStyles,
19
+ statusPill
20
+ };
21
+ //# sourceMappingURL=chunk-6CDQSHVW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/status-pill-style.ts"],"sourcesContent":["/**\n * The G2 status pill inside another element's shadow root: the summary tile\n * and the accordion draw one with `statusPill(text, tone)`.\n *\n * The pill itself is `impakt-status`, so there is one drawing of it. This only\n * places it, and says nothing when there are no words. The word carries the\n * status, so it never rests on the dot's colour alone (1.4.1).\n */\nimport { css, html, nothing, type TemplateResult } from 'lit';\nimport './status';\nimport type { StatusTone } from './status';\n\nexport type { StatusTone };\nexport const STATUS_TONES: StatusTone[] = ['ok', 'bad', 'warn', 'info', 'neutral', 'solid'];\n\nexport const statusPillStyles = css`\n .status-pill {\n flex: none;\n inline-size: fit-content;\n }\n`;\n\n/** A status pill, or nothing when there are no words. */\nexport const statusPill = (text: string | undefined, tone: StatusTone | string | undefined, part = 'status'): TemplateResult | typeof nothing => {\n if (!text) return nothing;\n const known = STATUS_TONES.includes(tone as StatusTone) ? (tone as StatusTone) : 'neutral';\n return html`<impakt-status class=\"status-pill\" part=${part} tone=${known} label=${text}></impakt-status>`;\n};\n"],"mappings":";AAQA,SAAS,KAAK,MAAM,eAAoC;AAKjD,IAAM,eAA6B,CAAC,MAAM,OAAO,QAAQ,QAAQ,WAAW,OAAO;AAEnF,IAAM,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAQzB,IAAM,aAAa,CAAC,MAA0B,MAAuC,OAAO,aAA8C;AAC/I,MAAI,CAAC,KAAM,QAAO;AAClB,QAAM,QAAQ,aAAa,SAAS,IAAkB,IAAK,OAAsB;AACjF,SAAO,+CAA+C,IAAI,SAAS,KAAK,UAAU,IAAI;AACxF;","names":[]}
@@ -1,17 +1,19 @@
1
1
  import {
2
2
  announceNavigate
3
- } from "./chunk-JNLKM3JT.js";
3
+ } from "./chunk-N6EEW2GF.js";
4
4
  import {
5
5
  ImpaktElement,
6
6
  focusRing,
7
- fontWeight,
8
- lineHeight,
9
- space,
10
- t,
11
7
  targetSize,
12
8
  touchTarget,
13
9
  visuallyHidden
14
- } from "./chunk-V7EB7Q2M.js";
10
+ } from "./chunk-72WNCCDC.js";
11
+ import {
12
+ fontWeight,
13
+ lineHeight,
14
+ space,
15
+ t
16
+ } from "./chunk-JTCTQBAX.js";
15
17
 
16
18
  // packages/ui/src/components/blocks.ts
17
19
  import { css, html, nothing } from "lit";
@@ -120,7 +122,7 @@ var ImpaktTabs = class extends ImpaktElement {
120
122
  :host([two-rows]) .many [role='tab'][aria-selected='true'] { border-block-end-color: currentColor; background: ${t.brandSubtle}; }
121
123
  }
122
124
  @media (forced-colors: active) { [role='tab'][aria-selected='true'] { border-block-end-color: Highlight; } }
123
- .count { display: inline-flex; align-items: center; justify-content: center; min-inline-size: 20px; block-size: 20px; margin-inline-start: ${space(2)}; padding: 0 ${space(1.5)}; border-radius: 999px; font-size: 12px; font-weight: ${fontWeight("semibold")}; background: ${t.brand}; color: ${t.onBrand}; font-variant-numeric: tabular-nums; }
125
+ .count { display: inline-flex; align-items: center; justify-content: center; min-inline-size: 20px; block-size: 20px; margin-inline-start: ${space(2)}; padding: 0 ${space(1.5)}; border-radius: var(--impakt-radius-pill, calc(${t.radius} * 9999)); font-size: 12px; font-weight: ${fontWeight("semibold")}; background: ${t.brand}; color: ${t.onBrand}; font-variant-numeric: tabular-nums; }
124
126
  .sr-only { ${visuallyHidden} }
125
127
  /* Links drawn as tabs. */
126
128
  nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: ${space(1)}; overflow-x: auto; scrollbar-width: thin; border-block-end: ${t.borderThin} solid ${t.border}; }
@@ -128,11 +130,11 @@ var ImpaktTabs = class extends ImpaktElement {
128
130
  nav a:hover { color: ${t.text}; background: ${t.surfaceInset}; }
129
131
  nav a[aria-current='page'] { color: ${t.link}; border-block-end-color: currentColor; }
130
132
  nav a:focus-visible { box-shadow: inset 0 0 0 2px ${t.text}, inset 0 0 0 4px ${t.surfaceCard}; outline: none; }
131
- /* The pill look, for either kind. */
132
- :host([look='pill']) :is([role='tablist'], nav ul) { padding: ${space(1)}; border: 0; border-radius: 999px; background: ${t.surfaceCard}; gap: ${space(0.5)}; }
133
- :host([look='pill']) :is([role='tab'], nav a) { padding: ${space(2)} ${space(4)}; margin: 0; border: 0; border-radius: 999px; font-weight: ${fontWeight("medium")}; color: ${t.text}; }
133
+ /* The pill look, for either kind. Its corners come from the brand's radius, so it is square under Noire. */
134
+ :host([look='pill']) :is([role='tablist'], nav ul) { padding: ${space(1)}; border: 0; border-radius: var(--impakt-radius-pill, calc(${t.radius} * 9999)); background: ${t.surfaceCard}; gap: ${space(0.5)}; }
135
+ :host([look='pill']) :is([role='tab'], nav a) { padding: ${space(2)} ${space(4)}; margin: 0; border: 0; border-radius: var(--impakt-radius-pill, calc(${t.radius} * 9999)); font-weight: ${fontWeight("medium")}; color: ${t.text}; }
134
136
  :host([look='pill']) :is([role='tab'], nav a):hover { background: ${t.surfaceInset}; }
135
- :host([look='pill']) :is([role='tab'][aria-selected='true'], nav a[aria-current='page']) { background: ${t.text}; color: ${t.surfaceCard}; }
137
+ :host([look='pill']) :is([role='tab'][aria-selected='true'], nav a[aria-current='page']) { background: ${t.text}; color: var(--impakt-color-text-inverse, var(--impakt-solid-card, ${t.surfaceCard})); }
136
138
  @media (forced-colors: active) { :host([look='pill']) :is([role='tab'][aria-selected='true'], nav a[aria-current='page']) { border: 2px solid Highlight; } }
137
139
  `
138
140
  ];
@@ -206,4 +208,4 @@ export {
206
208
  ImpaktVisuallyHidden,
207
209
  ImpaktTabs
208
210
  };
209
- //# sourceMappingURL=chunk-MLKNZL5J.js.map
211
+ //# sourceMappingURL=chunk-6J22I7F6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/blocks.ts"],"sourcesContent":["import { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize, touchTarget, visuallyHidden } from '../base/styles';\nimport { fontWeight, lineHeight, space, t } from '../base/tokens';\nimport { announceNavigate } from './shell';\n\n/**\n * A line between two parts of a page.\n *\n * It is decoration, so a screen reader passes over it. Where the change of\n * subject matters, a heading says so better.\n *\n * @category layout\n * @icon divider\n */\nexport class ImpaktDivider extends ImpaktElement {\n static properties = {\n spacing: { type: String, reflect: true },\n tone: { type: String, reflect: true },\n };\n /** Space above and below the line. */\n declare spacing: 'sm' | 'md' | 'lg' | 'xl';\n declare tone: 'subtle' | 'strong';\n\n constructor() {\n super();\n this.spacing = 'md';\n this.tone = 'subtle';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host { display: block; }\n hr { margin: ${space(4)} 0; border: 0; border-block-start: ${t.borderThin} solid ${t.border}; opacity: 0.5; }\n :host([tone='strong']) hr { opacity: 1; border-block-start-width: ${t.borderThick}; }\n :host([spacing='sm']) hr { margin-block: ${space(2)}; }\n :host([spacing='lg']) hr { margin-block: ${space(8)}; }\n :host([spacing='xl']) hr { margin-block: ${space(12)}; }\n `,\n ];\n\n render(): TemplateResult {\n return html`<hr aria-hidden=\"true\" part=\"line\" />`;\n }\n}\n\n/**\n * Empty space, from the spacing scale, for the rare place where the gaps of the\n * containers around it are not enough.\n *\n * @category layout\n * @icon spacer\n */\nexport class ImpaktSpacer extends ImpaktElement {\n static properties = { size: { type: String, reflect: true } };\n declare size: 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.size = 'md';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host { display: block; block-size: ${space(4)}; }\n :host([size='sm']) { block-size: ${space(2)}; }\n :host([size='lg']) { block-size: ${space(8)}; }\n :host([size='xl']) { block-size: ${space(12)}; }\n :host([size='2xl']) { block-size: ${space(16)}; }\n `,\n ];\n\n render(): TemplateResult {\n return html``;\n }\n}\n\n/**\n * Words a screen reader says that are not shown: \"(opens a map)\" after a link\n * whose purpose is clear on screen from where it sits.\n *\n * @category typography\n * @icon hidden\n * @slot - The words to say.\n */\nexport class ImpaktVisuallyHidden extends ImpaktElement {\n static styles = [...ImpaktElement.styles, css`:host { ${visuallyHidden} }`];\n render(): TemplateResult {\n return html`<slot></slot>`;\n }\n}\n\n/** One tab and what it shows. */\nexport interface TabItem {\n id: string;\n label: string;\n /** The panel's words. A child with `slot` set to the tab's id is shown instead, for anything richer. */\n body?: string;\n /** A number shown on the tab, such as the open tasks behind it. */\n count?: number;\n /** The count in words for a screen reader, such as \"2 overdue tasks\". The number alone when empty. */\n countLabel?: string;\n /** Where the tab goes. When every tab has one, the tabs are links to pages, not panels. */\n href?: string;\n}\n\n/**\n * Panels of content behind a row of tabs, one shown at a time: the floor plans\n * of three house types, or a case's summary, tasks and files.\n *\n * It follows the ARIA tabs pattern. The tabs are one stop in the tab order,\n * the arrow keys, Home and End move between them, and each panel is labelled\n * by its tab. Use an accordion instead when someone may want to compare panels.\n *\n * **The tabs stay on one row** and scroll sideways when they do not fit, as the\n * design guide sets, and the chosen tab is scrolled into view, so on a phone it\n * is never hidden off the edge. With `two-rows`, a set of more than four tabs is\n * laid out in two rows on a narrow screen instead, so every tab can be seen.\n *\n * **The chosen tab is kept** when the tabs are given again, as a React or Vue app\n * does on every render, so long as a tab with that id is still there.\n *\n * A panel shows its item's `body`, or a child whose `slot` is the item's id.\n *\n * **Tabs that go to pages are links.** When every item has an `href`, such as\n * a job's Overview, Money and Notes, each of which has its own address, the\n * tabs are drawn the same but are a `nav` of links, the current one marked\n * `aria-current=\"page\"`, with no panels. A row of links is not the ARIA tabs\n * pattern, and announcing it as one would promise arrow keys and panels that\n * are not there. They send `impakt-navigate` like the side navigation, so an\n * app can route without a reload.\n *\n * `look=\"pill\"` draws the tabs as pills in a rounded bar, with the chosen one\n * filled, as a product's workspace tabs are.\n *\n * @category content\n * @icon tabs\n * @slot - A child with `slot` set to a tab's id is that tab's panel.\n * @fires {CustomEvent<{ value: string }>} impakt-change - When another tab is chosen.\n * @fires {CustomEvent<{ href: string; id: string }>} impakt-navigate - When a tab that is a link is followed. Cancel it to route in the app.\n */\nexport class ImpaktTabs extends ImpaktElement {\n static properties = {\n items: { type: Array },\n selected: { type: String, reflect: true },\n label: { type: String },\n twoRows: { type: Boolean, reflect: true, attribute: 'two-rows' },\n look: { type: String, reflect: true },\n };\n declare items: TabItem[];\n /** The id of the tab shown first. The first tab when it is empty. */\n declare selected: string;\n /** What the set of tabs is about, for a screen reader. */\n declare label: string;\n /** On a narrow screen, lay more than four tabs out in two rows rather than scroll them. */\n declare twoRows: boolean;\n /** `line` underlines the chosen tab; `pill` fills it, in a rounded bar. */\n declare look: 'line' | 'pill';\n\n constructor() {\n super();\n this.items = [];\n this.selected = '';\n this.label = '';\n this.twoRows = false;\n this.look = 'line';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget(\"[role='tab']\"),\n css`\n /* Only the two-row layout needs a size container. Making every tab set one\n would take its width from its parent alone, so in a flex row, with no\n width given, it would shrink to nothing. In a row it may still shrink\n below its tabs, which then scroll, rather than widen the page. */\n :host { display: block; min-inline-size: 0; }\n :host([two-rows]) { container-type: inline-size; }\n [role='tablist'] { display: flex; gap: ${space(1)}; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; border-block-end: ${t.borderThin} solid ${t.border}; }\n [role='tab'] { ${targetSize} position: relative; flex: none; padding: ${space(3)} ${space(4)}; font: inherit; font-weight: ${fontWeight('semibold')}; white-space: nowrap; color: ${t.textMuted}; background: transparent; border: 0; border-block-end: 3px solid transparent; margin-block-end: -1px; cursor: pointer; border-radius: ${t.radius} ${t.radius} 0 0; }\n /* Inside a box that scrolls the ring would be clipped, so it is drawn inside the tab. */\n [role='tab']:focus-visible { box-shadow: inset 0 0 0 2px ${t.text}, inset 0 0 0 4px ${t.surfaceCard}; }\n [role='tab']:hover { color: ${t.text}; background: ${t.surfaceInset}; }\n [role='tab'][aria-selected='true'] { color: ${t.link}; border-block-end-color: currentColor; }\n [role='tabpanel'] { padding-block: ${space(5)}; line-height: ${lineHeight('normal')}; }\n .body { white-space: pre-line; }\n @container (max-width: 40rem) {\n :host([two-rows]) [role='tablist'].many { display: grid; grid-template-columns: repeat(var(--columns), minmax(0, 1fr)); overflow: visible; border-block-end: 0; gap: ${space(1)}; }\n :host([two-rows]) .many [role='tab'] { white-space: normal; padding-inline: ${space(2)}; margin: 0; border-block-end-width: 3px; border-block-end-color: ${t.rule}; border-radius: ${t.radius}; }\n :host([two-rows]) .many [role='tab'][aria-selected='true'] { border-block-end-color: currentColor; background: ${t.brandSubtle}; }\n }\n @media (forced-colors: active) { [role='tab'][aria-selected='true'] { border-block-end-color: Highlight; } }\n .count { display: inline-flex; align-items: center; justify-content: center; min-inline-size: 20px; block-size: 20px; margin-inline-start: ${space(2)}; padding: 0 ${space(1.5)}; border-radius: var(--impakt-radius-pill, calc(${t.radius} * 9999)); font-size: 12px; font-weight: ${fontWeight('semibold')}; background: ${t.brand}; color: ${t.onBrand}; font-variant-numeric: tabular-nums; }\n .sr-only { ${visuallyHidden} }\n /* Links drawn as tabs. */\n nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: ${space(1)}; overflow-x: auto; scrollbar-width: thin; border-block-end: ${t.borderThin} solid ${t.border}; }\n nav a { ${targetSize} position: relative; display: inline-flex; align-items: center; flex: none; padding: ${space(3)} ${space(4)}; font-weight: ${fontWeight('semibold')}; white-space: nowrap; color: ${t.textMuted}; text-decoration: none; border-block-end: 3px solid transparent; margin-block-end: -1px; border-radius: ${t.radius} ${t.radius} 0 0; }\n nav a:hover { color: ${t.text}; background: ${t.surfaceInset}; }\n nav a[aria-current='page'] { color: ${t.link}; border-block-end-color: currentColor; }\n nav a:focus-visible { box-shadow: inset 0 0 0 2px ${t.text}, inset 0 0 0 4px ${t.surfaceCard}; outline: none; }\n /* The pill look, for either kind. Its corners come from the brand's radius, so it is square under Noire. */\n :host([look='pill']) :is([role='tablist'], nav ul) { padding: ${space(1)}; border: 0; border-radius: var(--impakt-radius-pill, calc(${t.radius} * 9999)); background: ${t.surfaceCard}; gap: ${space(0.5)}; }\n :host([look='pill']) :is([role='tab'], nav a) { padding: ${space(2)} ${space(4)}; margin: 0; border: 0; border-radius: var(--impakt-radius-pill, calc(${t.radius} * 9999)); font-weight: ${fontWeight('medium')}; color: ${t.text}; }\n :host([look='pill']) :is([role='tab'], nav a):hover { background: ${t.surfaceInset}; }\n :host([look='pill']) :is([role='tab'][aria-selected='true'], nav a[aria-current='page']) { background: ${t.text}; color: var(--impakt-color-text-inverse, var(--impakt-solid-card, ${t.surfaceCard})); }\n @media (forced-colors: active) { :host([look='pill']) :is([role='tab'][aria-selected='true'], nav a[aria-current='page']) { border: 2px solid Highlight; } }\n `,\n ];\n\n private countOf(item: TabItem): TemplateResult | typeof nothing {\n if (typeof item.count !== 'number') return nothing;\n return item.countLabel\n ? html`<span class=\"count\" aria-hidden=\"true\">${item.count}</span><span class=\"sr-only\">, ${item.countLabel}</span>`\n : html`<span class=\"count\">${item.count}</span>`;\n }\n\n private get linked(): boolean {\n const items = this.items ?? [];\n return items.length > 0 && items.every((i) => Boolean(i.href));\n }\n\n private current(): string {\n const items = this.items ?? [];\n return items.some((i) => i.id === this.selected) ? this.selected : (items[0]?.id ?? '');\n }\n\n private choose(id: string, focus: boolean): void {\n if (id === this.current()) return;\n this.selected = id;\n this.dispatchEvent(new CustomEvent('impakt-change', { detail: { value: id }, bubbles: true, composed: true }));\n if (focus) void this.updateComplete.then(() => this.renderRoot.querySelector<HTMLElement>(`#${this.id_(`tab-${id}`)}`)?.focus({ preventScroll: true }));\n }\n\n private onKey(event: KeyboardEvent): void {\n const items = this.items ?? [];\n const at = items.findIndex((i) => i.id === this.current());\n const to = { ArrowRight: at + 1, ArrowLeft: at - 1, Home: 0, End: items.length - 1 }[event.key];\n if (to === undefined || !items.length) return;\n event.preventDefault();\n this.choose(items[(to + items.length) % items.length]!.id, true);\n }\n\n /**\n * Bring the chosen tab into view inside the row of tabs. Only the row scrolls:\n * `scrollIntoView` would scroll the page too, and move someone who is reading\n * further down.\n */\n private reveal(): void {\n const list = this.renderRoot.querySelector<HTMLElement>(\"[role='tablist']\");\n const tab = this.renderRoot.querySelector<HTMLElement>(\"[role='tab'][aria-selected='true']\");\n if (!list || !tab || list.scrollWidth <= list.clientWidth) return;\n const start = tab.offsetLeft - list.offsetLeft;\n const end = start + tab.offsetWidth;\n if (start < list.scrollLeft) list.scrollLeft = start - 16;\n else if (end > list.scrollLeft + list.clientWidth) list.scrollLeft = end - list.clientWidth + 16;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('selected') || changed.has('items')) this.reveal();\n }\n\n render(): TemplateResult {\n const items = this.items ?? [];\n const current = this.current();\n if (this.linked) {\n return html`<nav aria-label=${this.label || nothing} part=\"tabs\"><ul>\n ${items.map((item) => html`<li><a href=${item.href!} part=\"tab\" aria-current=${item.id === current ? 'page' : nothing} @click=${(e: MouseEvent) => announceNavigate(this, e, { href: item.href!, id: item.id })}>${item.label}${this.countOf(item)}</a></li>`)}\n </ul></nav>`;\n }\n const many = items.length > 4;\n return html`<div role=\"tablist\" aria-label=${this.label || nothing} part=\"tabs\" class=${many ? 'many' : ''} style=${many ? `--columns:${Math.ceil(items.length / 2)}` : nothing} @keydown=${this.onKey}>\n ${items.map((item) => html`<button role=\"tab\" type=\"button\" id=${this.id_(`tab-${item.id}`)} aria-selected=${item.id === current ? 'true' : 'false'} aria-controls=${this.id_(`panel-${item.id}`)} tabindex=${item.id === current ? '0' : '-1'} @click=${() => this.choose(item.id, false)}>${item.label}${this.countOf(item)}</button>`)}\n </div>\n ${items.map((item) => html`<div role=\"tabpanel\" id=${this.id_(`panel-${item.id}`)} aria-labelledby=${this.id_(`tab-${item.id}`)} tabindex=\"0\" ?hidden=${item.id !== current} part=\"panel\"><slot name=${item.id}><span class=\"body\">${item.body ?? ''}</span></slot></div>`)}`;\n }\n}\n\ncustomElements.define('impakt-divider', ImpaktDivider);\ncustomElements.define('impakt-spacer', ImpaktSpacer);\ncustomElements.define('impakt-visually-hidden', ImpaktVisuallyHidden);\ncustomElements.define('impakt-tabs', ImpaktTabs);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-divider': ImpaktDivider;\n 'impakt-spacer': ImpaktSpacer;\n 'impakt-visually-hidden': ImpaktVisuallyHidden;\n 'impakt-tabs': ImpaktTabs;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,KAAK,MAAM,eAAoC;AAejD,IAAM,gBAAN,cAA4B,cAAc;AAAA,EAC/C;AAAA,SAAO,aAAa;AAAA,MAClB,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACvC,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,IACtC;AAAA;AAAA,EAKA,cAAc;AACZ,UAAM;AACN,SAAK,UAAU;AACf,SAAK,OAAO;AAAA,EACd;AAAA,EAEA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,cAAc;AAAA,MACjB;AAAA;AAAA,mBAEe,MAAM,CAAC,CAAC,sCAAsC,EAAE,UAAU,UAAU,EAAE,MAAM;AAAA,wEACvB,EAAE,WAAW;AAAA,+CACtC,MAAM,CAAC,CAAC;AAAA,+CACR,MAAM,CAAC,CAAC;AAAA,+CACR,MAAM,EAAE,CAAC;AAAA;AAAA,IAEtD;AAAA;AAAA,EAEA,SAAyB;AACvB,WAAO;AAAA,EACT;AACF;AASO,IAAM,eAAN,cAA2B,cAAc;AAAA,EAC9C;AAA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,SAAS,CAAC,CAAC,KAAK,OAAO,aAAa,KAAK,KAAK;AAAA,QAClM,MAAM,IAAI,CAAC,SAAS,2CAA2C,KAAK,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC,kBAAkB,KAAK,OAAO,UAAU,SAAS,OAAO,kBAAkB,KAAK,IAAI,SAAS,KAAK,EAAE,EAAE,CAAC,aAAa,KAAK,OAAO,UAAU,MAAM,IAAI,WAAW,MAAM,KAAK,OAAO,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,GAAG,KAAK,QAAQ,IAAI,CAAC,WAAW,CAAC;AAAA;AAAA,MAEzU,MAAM,IAAI,CAAC,SAAS,+BAA+B,KAAK,IAAI,SAAS,KAAK,EAAE,EAAE,CAAC,oBAAoB,KAAK,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC,yBAAyB,KAAK,OAAO,OAAO,4BAA4B,KAAK,EAAE,uBAAuB,KAAK,QAAQ,EAAE,sBAAsB,CAAC;AAAA,EAC7Q;AACF;AAEA,eAAe,OAAO,kBAAkB,aAAa;AACrD,eAAe,OAAO,iBAAiB,YAAY;AACnD,eAAe,OAAO,0BAA0B,oBAAoB;AACpE,eAAe,OAAO,eAAe,UAAU;","names":[]}
@@ -0,0 +1,136 @@
1
+ import {
2
+ t
3
+ } from "./chunk-JTCTQBAX.js";
4
+
5
+ // packages/ui/src/base/styles.ts
6
+ import { css, unsafeCSS } from "lit";
7
+ var focusRing = css`
8
+ :host(:focus-visible),
9
+ :host(:not([disabled])) :focus-visible {
10
+ outline: 2px solid transparent;
11
+ outline-offset: ${t.focusOffset};
12
+ box-shadow: ${t.focusShadow};
13
+ }
14
+ `;
15
+ var targetSize = css`
16
+ min-block-size: ${t.targetMin};
17
+ min-inline-size: ${t.targetMin};
18
+ `;
19
+ var visuallyHidden = css`
20
+ position: absolute;
21
+ inline-size: 1px;
22
+ block-size: 1px;
23
+ margin: -1px;
24
+ padding: 0;
25
+ overflow: hidden;
26
+ clip-path: inset(50%);
27
+ white-space: nowrap;
28
+ border: 0;
29
+ `;
30
+ var reducedMotion = css`
31
+ @media (prefers-reduced-motion: reduce) {
32
+ :host,
33
+ :host *,
34
+ :host *::before,
35
+ :host *::after {
36
+ animation-duration: 0.01ms !important;
37
+ animation-iteration-count: 1 !important;
38
+ transition-duration: 0.01ms !important;
39
+ scroll-behavior: auto !important;
40
+ }
41
+ }
42
+ `;
43
+ var base = css`
44
+ :host {
45
+ box-sizing: border-box;
46
+ font-family: ${t.fontBody};
47
+ color: ${t.text};
48
+ }
49
+ :host([hidden]) {
50
+ display: none !important;
51
+ }
52
+ *,
53
+ *::before,
54
+ *::after {
55
+ box-sizing: inherit;
56
+ }
57
+ `;
58
+ var touchTarget = (selector) => (
59
+ // Under :host, so it outweighs the component's own rule for the same control whatever the order.
60
+ unsafeCSS(`@media (pointer: coarse) { :host :is(${selector}) { min-block-size: 44px; min-inline-size: 44px; } }`)
61
+ );
62
+ var hideOn = css`
63
+ @media (max-width: 40rem) { :host([hide-on='phone']) { display: none !important; } }
64
+ @media (min-width: 40.0625rem) { :host([hide-on='wide']) { display: none !important; } }
65
+ `;
66
+
67
+ // packages/ui/src/base/say.ts
68
+ var WORDING = Symbol.for("strata.wording");
69
+ function say(english, values) {
70
+ const words = globalThis[WORDING]?.words;
71
+ const chosen = words?.[english];
72
+ const text = typeof chosen === "string" && chosen.trim() ? chosen : english;
73
+ return values ? text.replace(/\{(\w+)\}/g, (whole, name) => name in values ? String(values[name]) : whole) : text;
74
+ }
75
+
76
+ // packages/ui/src/base/ImpaktElement.ts
77
+ import { LitElement, css as css2 } from "lit";
78
+ var counter = 0;
79
+ var ImpaktElement = class extends LitElement {
80
+ constructor() {
81
+ super(...arguments);
82
+ /**
83
+ * A unique id for this instance, for `aria-describedby` and friends.
84
+ *
85
+ * Generated once in the constructor rather than in `render`, because an id
86
+ * that changes between renders breaks the relationship it exists to express
87
+ * — and it breaks it silently, since the markup still looks correct.
88
+ */
89
+ this.uid = `impakt-${counter += 1}`;
90
+ }
91
+ static {
92
+ this.styles = [base, reducedMotion, css2``];
93
+ }
94
+ id_(part) {
95
+ return `${this.uid}-${part}`;
96
+ }
97
+ /** @ignore */
98
+ connectedCallback() {
99
+ super.connectedCallback();
100
+ this.sayDefaults();
101
+ }
102
+ /**
103
+ * The words a component ships with, in the page's language (ADR 0026).
104
+ *
105
+ * Defaults stay plain English in the constructor, so the component manifest
106
+ * still sees them (a prop with no default is read as required). When the
107
+ * element joins the page, each word it holds is looked up in the site's
108
+ * wording; anything that is not one of Strata's own words, such as a page's
109
+ * own text or a variant name, is left exactly as it is.
110
+ *
111
+ * @ignore
112
+ */
113
+ sayDefaults() {
114
+ const props = this.constructor.elementProperties;
115
+ const self = this;
116
+ for (const name of props.keys()) {
117
+ const value = self[name];
118
+ if (typeof value !== "string" || !value) continue;
119
+ const said = say(value);
120
+ if (said !== value) self[name] = said;
121
+ }
122
+ }
123
+ };
124
+
125
+ export {
126
+ focusRing,
127
+ targetSize,
128
+ visuallyHidden,
129
+ reducedMotion,
130
+ base,
131
+ touchTarget,
132
+ hideOn,
133
+ say,
134
+ ImpaktElement
135
+ };
136
+ //# sourceMappingURL=chunk-72WNCCDC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/base/styles.ts","../src/base/say.ts","../src/base/ImpaktElement.ts"],"sourcesContent":["/**\n * Shared style fragments.\n *\n * Three of these carry an accessibility guarantee and are therefore not\n * negotiable per component: the focus ring, the minimum target size and the\n * reduced-motion rule. A component that wants its own focus treatment is a\n * component that will get it subtly wrong on one brand, so there is one.\n */\nimport { css, unsafeCSS, type CSSResult } from 'lit';\nimport { t } from './tokens';\n\n/**\n * The focus ring.\n *\n * `:focus-visible` rather than `:focus`, so a mouse click on a button does not\n * draw a ring the user did not ask for while keyboard focus still does.\n *\n * The ring is two-tone — a light inner band inside a dark outer one — drawn\n * with `box-shadow` and a transparent `outline` behind it. The outline is not\n * decoration: it is what survives Windows High Contrast Mode, where box-shadow\n * is dropped entirely and a shadow-only ring disappears for exactly the users\n * who most need it.\n *\n * The colours come from locked tokens a brand cannot reach\n * ([ADR 0010](https://github.com/matthill8286/strata/blob/main/docs/decisions/0010-what-a-brand-may-set.md)).\n */\nexport const focusRing = css`\n :host(:focus-visible),\n :host(:not([disabled])) :focus-visible {\n outline: 2px solid transparent;\n outline-offset: ${t.focusOffset};\n box-shadow: ${t.focusShadow};\n }\n`;\n\n/**\n * WCAG 2.2, 2.5.8 Target Size (Minimum): 24 by 24 CSS pixels.\n *\n * Applied as a minimum rather than a fixed size so a control grows with its\n * content and never shrinks below the floor. It reads the locked token, which\n * is deliberately outside the spacing scale — otherwise a brand tightening its\n * spacing unit would shrink every tap target with it.\n */\nexport const targetSize = css`\n min-block-size: ${t.targetMin};\n min-inline-size: ${t.targetMin};\n`;\n\n/**\n * Visible to a screen reader, invisible on screen.\n *\n * `clip-path` with a 1px box rather than `display: none` or `visibility:\n * hidden`, both of which remove the text from the accessibility tree — which\n * is the one thing this must not do.\n */\nexport const visuallyHidden = css`\n position: absolute;\n inline-size: 1px;\n block-size: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n`;\n\n/**\n * 2.3.3 Animation from Interactions, and plain decency.\n *\n * `0.01ms` rather than `0` because a zero-duration transition does not fire a\n * `transitionend` event in every engine, and components that wait for one hang.\n */\nexport const reducedMotion = css`\n @media (prefers-reduced-motion: reduce) {\n :host,\n :host *,\n :host *::before,\n :host *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n scroll-behavior: auto !important;\n }\n }\n`;\n\n/** The base every component starts from. */\nexport const base = css`\n :host {\n box-sizing: border-box;\n font-family: ${t.fontBody};\n color: ${t.text};\n }\n :host([hidden]) {\n display: none !important;\n }\n *,\n *::before,\n *::after {\n box-sizing: inherit;\n }\n`;\n\n/**\n * On a touch screen a control is at least 44 by 44 CSS pixels.\n *\n * The 24px floor above is WCAG 2.2's minimum, and it is right for a mouse. A finger\n * is broader, and the design guide sets 44px on a touch screen, which is also\n * 2.5.5's enhanced size. It is applied by pointer rather than by width, because a\n * small laptop window is still driven by a mouse and a large tablet by a finger.\n * Pass the selectors that are the controls, inside the component's shadow root.\n */\nexport const touchTarget = (selector: string): CSSResult =>\n // Under :host, so it outweighs the component's own rule for the same control whatever the order.\n unsafeCSS(`@media (pointer: coarse) { :host :is(${selector}) { min-block-size: 44px; min-inline-size: 44px; } }`);\n\n/**\n * `hide-on`: an element left out on a phone, or on anything wider, so a phone's\n * header is built from the same pieces as a wide one. The width is the one the\n * nav folds at. A component that offers `hideOn` reflects it as `hide-on` and\n * adds this to its styles.\n */\nexport const hideOn = css`\n @media (max-width: 40rem) { :host([hide-on='phone']) { display: none !important; } }\n @media (min-width: 40.0625rem) { :host([hide-on='wide']) { display: none !important; } }\n`;\n","/**\n * The library's own words, in the page's language (ADR 0026).\n *\n * Every word a component shows that a page did not give it, such as \"Skip to\n * content\", \"Next slide\" or \"There is a problem\", goes through `say`. The\n * renderer puts the site's wording in place before it draws a page\n * (`applySiteLanguage` in `@atomic-ui/renderer-core`), translated into the page's\n * language and with any of the site's own rewording. Without it, the English\n * here is shown, which is what every site did before it had languages.\n *\n * The English is the key, with `{name}` for a value put in, so the list of\n * words to translate (`SITE_WORDING` in `@atomic-ui/content-schemas`) can be\n * checked against this library by a test.\n */\nconst WORDING = Symbol.for('strata.wording');\n\ntype Store = { words?: Record<string, string> };\n\nexport function say(english: string, values?: Record<string, string | number>): string {\n const words = (globalThis as Record<symbol, Store | undefined>)[WORDING]?.words;\n const chosen = words?.[english];\n const text = typeof chosen === 'string' && chosen.trim() ? chosen : english;\n return values ? text.replace(/\\{(\\w+)\\}/g, (whole, name: string) => (name in values ? String(values[name]) : whole)) : text;\n}\n","import { LitElement, css } from 'lit';\nimport { base, reducedMotion } from './styles';\nimport { say } from './say';\n\nlet counter = 0;\n\n/**\n * The base every Impakt component extends.\n *\n * It carries the two style fragments that are not a per-component choice — the\n * reset and the reduced-motion rule — and a stable id generator for the ARIA\n * wiring. It deliberately carries nothing else: a base class that grows\n * behaviour becomes the place every component's exceptions are negotiated.\n */\nexport class ImpaktElement extends LitElement {\n static styles = [base, reducedMotion, css``];\n\n /**\n * A unique id for this instance, for `aria-describedby` and friends.\n *\n * Generated once in the constructor rather than in `render`, because an id\n * that changes between renders breaks the relationship it exists to express\n * — and it breaks it silently, since the markup still looks correct.\n */\n protected readonly uid = `impakt-${(counter += 1)}`;\n\n protected id_(part: string): string {\n return `${this.uid}-${part}`;\n }\n\n /** @ignore */\n connectedCallback(): void {\n super.connectedCallback();\n this.sayDefaults();\n }\n\n /**\n * The words a component ships with, in the page's language (ADR 0026).\n *\n * Defaults stay plain English in the constructor, so the component manifest\n * still sees them (a prop with no default is read as required). When the\n * element joins the page, each word it holds is looked up in the site's\n * wording; anything that is not one of Strata's own words, such as a page's\n * own text or a variant name, is left exactly as it is.\n *\n * @ignore\n */\n private sayDefaults(): void {\n const props = (this.constructor as typeof LitElement).elementProperties;\n const self = this as unknown as Record<string, unknown>;\n for (const name of props.keys()) {\n const value = self[name as string];\n if (typeof value !== 'string' || !value) continue;\n const said = say(value);\n if (said !== value) self[name as string] = said;\n }\n }\n}\n"],"mappings":";;;;;AAQA,SAAS,KAAK,iBAAiC;AAkBxC,IAAM,YAAY;AAAA;AAAA;AAAA;AAAA,sBAIH,EAAE,WAAW;AAAA,kBACjB,EAAE,WAAW;AAAA;AAAA;AAYxB,IAAM,aAAa;AAAA,oBACN,EAAE,SAAS;AAAA,qBACV,EAAE,SAAS;AAAA;AAUzB,IAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBvB,IAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAetB,IAAM,OAAO;AAAA;AAAA;AAAA,mBAGD,EAAE,QAAQ;AAAA,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MAAO,MAAK,IAAc,IAAI;AAAA,IAC7C;AAAA,EACF;AACF;","names":["css","css"]}
@@ -0,0 +1,104 @@
1
+ import {
2
+ kit
3
+ } from "./chunk-XX6JZW5N.js";
4
+ import {
5
+ ImpaktElement,
6
+ focusRing,
7
+ visuallyHidden
8
+ } from "./chunk-72WNCCDC.js";
9
+ import {
10
+ space,
11
+ t
12
+ } from "./chunk-JTCTQBAX.js";
13
+
14
+ // packages/ui/src/components/code-diff.ts
15
+ import { css, html, nothing } from "lit";
16
+ var ImpaktCodeDiff = class extends ImpaktElement {
17
+ static {
18
+ this.properties = {
19
+ removed: { type: String },
20
+ added: { type: String },
21
+ lines: { type: Array },
22
+ label: { type: String },
23
+ removedText: { type: String, attribute: "removed-text" },
24
+ addedText: { type: String, attribute: "added-text" }
25
+ };
26
+ }
27
+ constructor() {
28
+ super();
29
+ this.removed = "";
30
+ this.added = "";
31
+ this.lines = [];
32
+ this.label = "Code change";
33
+ this.removedText = "Removed";
34
+ this.addedText = "Added";
35
+ }
36
+ static {
37
+ this.styles = [
38
+ ...ImpaktElement.styles,
39
+ focusRing,
40
+ css`
41
+ :host {
42
+ display: block;
43
+ }
44
+ .block {
45
+ overflow-x: auto;
46
+ padding: ${space(4)} ${space(4)};
47
+ color: ${kit.codeText};
48
+ background: ${kit.codeSurface};
49
+ border-radius: 0;
50
+ }
51
+ pre {
52
+ margin: 0;
53
+ font-family: ${t.fontMono};
54
+ font-size: ${kit.small};
55
+ line-height: 1.6;
56
+ }
57
+ code {
58
+ font: inherit;
59
+ }
60
+ .line {
61
+ position: relative;
62
+ display: block;
63
+ white-space: pre;
64
+ }
65
+ .sign {
66
+ display: inline-block;
67
+ inline-size: 2ch;
68
+ }
69
+ .removed {
70
+ color: ${kit.codeMuted};
71
+ }
72
+ .added {
73
+ color: ${kit.codeText};
74
+ }
75
+ .visually-hidden {
76
+ ${visuallyHidden}
77
+ }
78
+ @media (forced-colors: active) {
79
+ .block {
80
+ border: 1px solid CanvasText;
81
+ }
82
+ }
83
+ `
84
+ ];
85
+ }
86
+ get allLines() {
87
+ if (this.lines.length) return this.lines;
88
+ const split = (text, kind) => text ? text.split("\n").map((line) => ({ kind, text: line })) : [];
89
+ return [...split(this.removed, "removed"), ...split(this.added, "added")];
90
+ }
91
+ render() {
92
+ const sign = { removed: "\u2212", added: "+", context: " " };
93
+ const word = { removed: this.removedText, added: this.addedText, context: "" };
94
+ return html`<div class="block" part="block" role="region" aria-label=${this.label} tabindex="0"><pre part="code"><code>${this.allLines.map(
95
+ (line) => html`<span class="line ${line.kind}"><span class="sign" aria-hidden="true">${sign[line.kind]}</span>${word[line.kind] ? html`<span class="visually-hidden">${word[line.kind]}: </span>` : nothing}${line.text}</span>`
96
+ )}</code></pre></div>`;
97
+ }
98
+ };
99
+ customElements.define("impakt-code-diff", ImpaktCodeDiff);
100
+
101
+ export {
102
+ ImpaktCodeDiff
103
+ };
104
+ //# sourceMappingURL=chunk-7UI3OBXL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/code-diff.ts"],"sourcesContent":["/**\n * Lines of code before and after a change.\n */\nimport { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, visuallyHidden } from '../base/styles';\nimport { space, t } from '../base/tokens';\nimport { kit } from './tool-kit-tokens';\n\nexport interface DiffLine {\n /** `removed`, `added`, or `context` for a line that stays. */\n kind: 'removed' | 'added' | 'context';\n text: string;\n}\n\n/**\n * The lines a fix takes out and the lines it puts in, such as a proposed\n * accessibility fix.\n *\n * The block is ink in both themes, so the added line keeps its contrast in\n * dark. A removed line is muted with \"−\" and an added line is white with \"+\".\n * The signs are drawn for the eye and hidden from assistive technology; a\n * screen reader hears \"Removed\" and \"Added\" before each line instead, because a\n * minus sign read aloud says nothing about a change.\n *\n * Give the lines either as `removed` and `added`, one line per newline, or as\n * `lines`, which can also hold lines that stay. A long line scrolls sideways\n * rather than wrapping, because a wrapped line of code reads as two. The block\n * is then a named region that takes focus, so it can be scrolled from the keyboard.\n *\n * Figma: Accessibility proposed fix `36:553`; dark `48:624`.\n *\n * @category content\n * @icon document\n * @csspart block - The scrolling region.\n * @csspart code - The `pre` element.\n */\nexport class ImpaktCodeDiff extends ImpaktElement {\n static properties = {\n removed: { type: String },\n added: { type: String },\n lines: { type: Array },\n label: { type: String },\n removedText: { type: String, attribute: 'removed-text' },\n addedText: { type: String, attribute: 'added-text' },\n };\n\n /** The lines taken out, one per newline. */\n declare removed: string;\n /** The lines put in, one per newline. */\n declare added: string;\n /** Every line in order, in place of `removed` and `added`. */\n declare lines: DiffLine[];\n /** The block's name, read when it takes focus. */\n declare label: string;\n /** Read before a removed line. */\n declare removedText: string;\n /** Read before an added line. */\n declare addedText: string;\n\n constructor() {\n super();\n this.removed = '';\n this.added = '';\n this.lines = [];\n this.label = 'Code change';\n this.removedText = 'Removed';\n this.addedText = 'Added';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host {\n display: block;\n }\n .block {\n overflow-x: auto;\n padding: ${space(4)} ${space(4)};\n color: ${kit.codeText};\n background: ${kit.codeSurface};\n border-radius: 0;\n }\n pre {\n margin: 0;\n font-family: ${t.fontMono};\n font-size: ${kit.small};\n line-height: 1.6;\n }\n code {\n font: inherit;\n }\n .line {\n position: relative;\n display: block;\n white-space: pre;\n }\n .sign {\n display: inline-block;\n inline-size: 2ch;\n }\n .removed {\n color: ${kit.codeMuted};\n }\n .added {\n color: ${kit.codeText};\n }\n .visually-hidden {\n ${visuallyHidden}\n }\n @media (forced-colors: active) {\n .block {\n border: 1px solid CanvasText;\n }\n }\n `,\n ];\n\n private get allLines(): DiffLine[] {\n if (this.lines.length) return this.lines;\n const split = (text: string, kind: DiffLine['kind']): DiffLine[] => (text ? text.split('\\n').map((line) => ({ kind, text: line })) : []);\n return [...split(this.removed, 'removed'), ...split(this.added, 'added')];\n }\n\n render(): TemplateResult {\n const sign = { removed: '−', added: '+', context: ' ' } as const;\n const word = { removed: this.removedText, added: this.addedText, context: '' } as const;\n // No whitespace between the elements: inside a pre it would be drawn.\n return html`<div class=\"block\" part=\"block\" role=\"region\" aria-label=${this.label} tabindex=\"0\"><pre part=\"code\"><code>${this.allLines.map(\n (line) =>\n html`<span class=\"line ${line.kind}\"><span class=\"sign\" aria-hidden=\"true\">${sign[line.kind]}</span>${word[line.kind] ? html`<span class=\"visually-hidden\">${word[line.kind]}: </span>` : nothing}${line.text}</span>`,\n )}</code></pre></div>`;\n }\n}\n\ncustomElements.define('impakt-code-diff', ImpaktCodeDiff);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-code-diff': ImpaktCodeDiff;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAGA,SAAS,KAAK,MAAM,eAAoC;AAkCjD,IAAM,iBAAN,cAA6B,cAAc;AAAA,EAChD;AAAA,SAAO,aAAa;AAAA,MAClB,SAAS,EAAE,MAAM,OAAO;AAAA,MACxB,OAAO,EAAE,MAAM,OAAO;AAAA,MACtB,OAAO,EAAE,MAAM,MAAM;AAAA,MACrB,OAAO,EAAE,MAAM,OAAO;AAAA,MACtB,aAAa,EAAE,MAAM,QAAQ,WAAW,eAAe;AAAA,MACvD,WAAW,EAAE,MAAM,QAAQ,WAAW,aAAa;AAAA,IACrD;AAAA;AAAA,EAeA,cAAc;AACZ,UAAM;AACN,SAAK,UAAU;AACf,SAAK,QAAQ;AACb,SAAK,QAAQ,CAAC;AACd,SAAK,QAAQ;AACb,SAAK,cAAc;AACnB,SAAK,YAAY;AAAA,EACnB;AAAA,EAEA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,cAAc;AAAA,MACjB;AAAA,MACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAMe,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AAAA,iBACtB,IAAI,QAAQ;AAAA,sBACP,IAAI,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA,uBAKd,EAAE,QAAQ;AAAA,qBACZ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