@repobit/dex-system-design 2.5.1 → 2.6.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 (173) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/README.md +2 -1
  3. package/package.json +14 -27
  4. package/schemas/component-manifest.json +226 -33
  5. package/schemas/manifest-omissions.json +23 -0
  6. package/src/components/accordion/accordion-bg.css.js +39 -30
  7. package/src/components/accordion/accordion-bg.js +17 -28
  8. package/src/components/accordion/accordion-bg.stories.js +5 -0
  9. package/src/components/accordion/accordion-panel.js +24 -0
  10. package/src/components/accordion/accordion.css.js +105 -111
  11. package/src/components/accordion/accordion.js +23 -37
  12. package/src/components/accordion/accordion.stories.js +5 -1
  13. package/src/components/anchor/anchor-nav.css.js +131 -53
  14. package/src/components/anchor/anchor-nav.js +276 -201
  15. package/src/components/annotation/annotation.css.js +7 -4
  16. package/src/components/architecture.stories.js +8 -7
  17. package/src/components/audience-card/audience-card.css.js +30 -4
  18. package/src/components/audience-card/audience-card.js +8 -13
  19. package/src/components/awards/awards-flex.css.js +23 -6
  20. package/src/components/awards/awards-flex.js +21 -6
  21. package/src/components/awards/awards-spotlight.css.js +25 -5
  22. package/src/components/awards/awards-spotlight.js +19 -7
  23. package/src/components/awards/awards.css.js +20 -8
  24. package/src/components/awards/awards.js +30 -91
  25. package/src/components/awards/awards.stories.js +5 -5
  26. package/src/components/awards/scroll-slides.js +128 -0
  27. package/src/components/back/back.css.js +2 -0
  28. package/src/components/badge/badge.css.js +15 -0
  29. package/src/components/bento-grid/bento-grid.css.js +105 -11
  30. package/src/components/bento-grid/bento-grid.js +37 -124
  31. package/src/components/bento-grid/bento-grid.stories.js +3 -2
  32. package/src/components/bento-grid/bento-item.css.js +71 -32
  33. package/src/components/bento-grid/bento-item.js +1 -30
  34. package/src/components/blockquote/blockquote.css.js +2 -2
  35. package/src/components/breadcrumb/breadcrumb.css.js +10 -9
  36. package/src/components/breadcrumb/breadcrumb.js +35 -34
  37. package/src/components/button/button.css.js +42 -17
  38. package/src/components/button/button.js +84 -3
  39. package/src/components/button/button.stories.js +17 -0
  40. package/src/components/card-features/card-features.css.js +23 -2
  41. package/src/components/card-features/card-features.js +6 -48
  42. package/src/components/cards/card.css.js +43 -14
  43. package/src/components/cards/card.js +43 -177
  44. package/src/components/cards/card.stories.js +8 -10
  45. package/src/components/carousel/carousel.css.js +101 -70
  46. package/src/components/carousel/carousel.js +107 -71
  47. package/src/components/carousel/carousel.stories.js +18 -16
  48. package/src/components/checkbox/checkbox.css.js +26 -9
  49. package/src/components/checkbox/checkbox.js +73 -39
  50. package/src/components/checkbox/checkbox.stories.js +35 -18
  51. package/src/components/compare/compare.css.js +68 -10
  52. package/src/components/compare/compare.js +40 -103
  53. package/src/components/compare/compare.stories.js +1 -1
  54. package/src/components/compatibility-table/compatibility-table.css.js +70 -37
  55. package/src/components/compatibility-table/compatibility-table.js +47 -40
  56. package/src/components/compatibility-table/compatibility-table.stories.js +78 -1
  57. package/src/components/display/display.css.js +7 -0
  58. package/src/components/dropdown/dropdown.css.js +20 -3
  59. package/src/components/dropdown/dropdown.js +57 -21
  60. package/src/components/dropdown/dropdown.stories.js +31 -9
  61. package/src/components/features/features.css.js +56 -21
  62. package/src/components/features/features.js +7 -117
  63. package/src/components/fieldset/fieldset.stories.js +68 -0
  64. package/src/components/footer/footer-images.js +34 -0
  65. package/src/components/footer/footer-links-group.css.js +10 -10
  66. package/src/components/footer/footer-locale.js +47 -0
  67. package/src/components/footer/footer-lp.js +27 -114
  68. package/src/components/footer/footer-lp.stories.js +2 -2
  69. package/src/components/footer/footer-nav-menu.css.js +2 -2
  70. package/src/components/footer/footer-nav-menu.js +8 -3
  71. package/src/components/footer/footer.css.js +238 -197
  72. package/src/components/footer/footer.js +109 -187
  73. package/src/components/footer/footer.stories.js +14 -4
  74. package/src/components/grid/grid.css.js +64 -5
  75. package/src/components/header/header-code.css.js +20 -11
  76. package/src/components/header/header-code.js +1 -1
  77. package/src/components/header/header.css.js +20 -14
  78. package/src/components/header/header.js +6 -7
  79. package/src/components/header/header.stories.js +29 -24
  80. package/src/components/heading/heading.css.js +11 -0
  81. package/src/components/hero/hero.js +10 -2
  82. package/src/components/highlight/highlight.css.js +30 -6
  83. package/src/components/icons/arrow-icon.js +4 -1
  84. package/src/components/icons/arrow-right-icon.js +5 -1
  85. package/src/components/icons/icon-element.js +18 -0
  86. package/src/components/image/image.js +29 -9
  87. package/src/components/image/image.stories.js +38 -2
  88. package/src/components/input/custom-form.stories.js +38 -7
  89. package/src/components/input/input-clipboard.css.js +15 -1
  90. package/src/components/input/input-clipboard.js +84 -21
  91. package/src/components/input/input.js +27 -7
  92. package/src/components/install-options/install-options.css.js +26 -6
  93. package/src/components/install-options/install-options.js +32 -8
  94. package/src/components/label/label.css.js +1 -1
  95. package/src/components/light-carousel/light-carousel.css.js +100 -48
  96. package/src/components/light-carousel/light-carousel.js +43 -5
  97. package/src/components/link/link.css.js +15 -15
  98. package/src/components/link/link.js +17 -1
  99. package/src/components/link/link.stories.js +20 -7
  100. package/src/components/list/list.css.js +3 -3
  101. package/src/components/logo-marquee/logo-marquee.css.js +12 -1
  102. package/src/components/logo-marquee/logo-marquee.js +33 -8
  103. package/src/components/logo-marquee/logo-marquee.stories.js +10 -4
  104. package/src/components/modal/modal.css.js +74 -40
  105. package/src/components/modal/modal.js +85 -74
  106. package/src/components/modal/modal.stories.js +27 -14
  107. package/src/components/motion-art/motion-art.js +67 -1
  108. package/src/components/page-switcher/page-switcher.css.js +27 -9
  109. package/src/components/page-switcher/page-switcher.js +11 -8
  110. package/src/components/partner-banner/partner-banner.css.js +2 -0
  111. package/src/components/picture/picture.css.js +4 -4
  112. package/src/components/picture/picture.js +13 -3
  113. package/src/components/picture/picture.stories.js +28 -2
  114. package/src/components/post-card/post-card.css.js +18 -3
  115. package/src/components/pricing-cards/adopt-styles.js +16 -0
  116. package/src/components/pricing-cards/new-pricing-card.js +2 -4
  117. package/src/components/pricing-cards/new-pricing-card.stories.js +20 -22
  118. package/src/components/pricing-cards/pricing-card-actions.css.js +8 -12
  119. package/src/components/pricing-cards/pricing-card-actions.js +26 -13
  120. package/src/components/pricing-cards/pricing-card-container.css.js +4 -3
  121. package/src/components/pricing-cards/pricing-card-container.js +10 -4
  122. package/src/components/pricing-cards/pricing-card-header.css.js +5 -4
  123. package/src/components/pricing-cards/pricing-card-header.js +18 -31
  124. package/src/components/pricing-cards/pricing-card-pricing.css.js +84 -61
  125. package/src/components/pricing-cards/pricing-card-pricing.js +38 -24
  126. package/src/components/pricing-cards/pricing-card-show-more.js +8 -3
  127. package/src/components/pricing-cards/pricing-card.css.js +75 -41
  128. package/src/components/pricing-cards/pricing-card.js +356 -308
  129. package/src/components/progress/progress.css.js +58 -13
  130. package/src/components/progress/progress.js +13 -10
  131. package/src/components/progress/progress.stories.js +9 -7
  132. package/src/components/radio/radio-group.css.js +42 -0
  133. package/src/components/radio/radio-group.js +89 -0
  134. package/src/components/radio/radio.css.js +63 -6
  135. package/src/components/radio/radio.js +173 -140
  136. package/src/components/radio/radio.stories.js +99 -44
  137. package/src/components/radio/toggle-radio.js +44 -0
  138. package/src/components/review/review-grid.css.js +5 -1
  139. package/src/components/review/review-grid.js +2 -0
  140. package/src/components/review/review.js +13 -0
  141. package/src/components/shared/announcer.js +37 -0
  142. package/src/components/shared/fill-width.css.js +33 -0
  143. package/src/components/shared/form-control.js +194 -0
  144. package/src/components/shared/form-field.css.js +31 -3
  145. package/src/components/shared/token-scales.js +75 -26
  146. package/src/components/spotlight-section/spotlight-section.js +2 -2
  147. package/src/components/stat/stat-highlight.js +1 -1
  148. package/src/components/stat/stat.css.js +18 -3
  149. package/src/components/switch/switch.css.js +58 -5
  150. package/src/components/switch/switch.js +53 -5
  151. package/src/components/switch/switch.stories.js +30 -8
  152. package/src/components/tab-list/tab-list.css.js +51 -13
  153. package/src/components/tab-list/tab-list.js +7 -2
  154. package/src/components/tab-list/tab-list.stories.js +2 -2
  155. package/src/components/tabs/tabs.css.js +18 -1
  156. package/src/components/tabs/tabs.js +119 -41
  157. package/src/components/terminal/terminal-message.css.js +6 -1
  158. package/src/components/termsOfUse/terms.css.js +4 -2
  159. package/src/components/textarea/textarea.js +22 -7
  160. package/src/components/textarea/textarea.stories.js +12 -9
  161. package/src/components/trust-panel/trust-panel.css.js +13 -3
  162. package/src/components/ultimate-security-demo.stories.js +5 -5
  163. package/src/components/video/video.css.js +5 -0
  164. package/src/components/video/video.js +5 -0
  165. package/src/components/video/video.stories.js +12 -0
  166. package/src/components/video-player/video-player.css.js +20 -8
  167. package/src/components/video-player/video-player.js +74 -20
  168. package/src/components/video-player/video-player.stories.js +17 -3
  169. package/src/tokens/brands.stories.js +1 -1
  170. package/src/tokens/themes/index.js +2 -2
  171. package/src/tokens/typography.stories.js +4 -3
  172. package/src/vendor/motion-art/README.md +4 -1
  173. package/src/components/footer/footer-lp.css.js +0 -159
@@ -10,8 +10,11 @@ export const annotationCSS = css`
10
10
  line-height: var(--footnote-reference-lineHeight);
11
11
  vertical-align: var(--footnote-reference-verticalAlign);
12
12
  color: var(--footnote-reference-color);
13
- margin-left: var(--footnote-reference-marginLeft);
14
- margin-right: var(--footnote-reference-marginRight);
13
+ /* The marker's gap before and after it in the line, wherever the line
14
+ runs; the tokens keep their physical names. Here and on .sup/.sub the
15
+ logical shorthand rather than its longhands: check:spacing-scale reads
16
+ margin-inline, and these em values are registered exceptions there. */
17
+ margin-inline: var(--footnote-reference-marginLeft) var(--footnote-reference-marginRight);
15
18
  text-decoration: none;
16
19
  }
17
20
 
@@ -48,7 +51,7 @@ export const annotationCSS = css`
48
51
  font-weight: var(--math-superscript-fontWeight);
49
52
  line-height: var(--math-superscript-lineHeight);
50
53
  vertical-align: var(--math-superscript-verticalAlign);
51
- margin-left: var(--math-superscript-marginLeft);
54
+ margin-inline: var(--math-superscript-marginLeft) 0;
52
55
  }
53
56
 
54
57
  .sub {
@@ -56,7 +59,7 @@ export const annotationCSS = css`
56
59
  font-weight: var(--math-subscript-fontWeight);
57
60
  line-height: var(--math-subscript-lineHeight);
58
61
  vertical-align: var(--math-subscript-verticalAlign);
59
- margin-left: var(--math-subscript-marginLeft);
62
+ margin-inline: var(--math-subscript-marginLeft) 0;
60
63
  }
61
64
  `;
62
65
 
@@ -7,10 +7,11 @@ import { docsPage, refSection } from '../tokens/story-chrome.js';
7
7
  *
8
8
  * Documentation only: this file renders no product component and owns no
9
9
  * contract. It is filed under its own group rather than under `Atoms/` or
10
- * `Components/` on purpose -- `lint:tokens` reads the atom tier from a story's
11
- * `title`, and `verify:typography` builds its population from the same two
12
- * prefixes, so a documentation page filed under either would either claim to
13
- * be vocabulary or add itself to a contract gate.
10
+ * `Components/` on purpose. The gates no longer read a story's `title` --
11
+ * `lint:tokens` and typography coverage take a unit's layer from
12
+ * scripts/architecture.json, keyed on its source path -- but the two groups are
13
+ * still where vocabulary and contract units are filed, so a documentation page
14
+ * belongs in neither.
14
15
  */
15
16
  export default {
16
17
  title: 'Foundations/Layer Model',
@@ -147,7 +148,7 @@ export const LayerModel = () =>
147
148
  'this repository, with the rules for adding to them. Derived from the library as it stands, not from a ' +
148
149
  'textbook hierarchy.',
149
150
  note: html`This page is documentation, and where it is filed changes nothing the gates
150
- believe. <code>lint:tokens</code> and <code>verify:typography</code> read each unit&rsquo;s layer
151
+ believe. <code>lint:tokens</code> and typography coverage (<code>npm run test:browser</code>) read each unit&rsquo;s layer
151
152
  from <code>scripts/architecture.json</code>, keyed on its source path — not from a story&rsquo;s
152
153
  <code>title</code>, which is what they used to read — so a page can be moved between groups
153
154
  without changing what is enforced. This one is recorded there as <code>FOUNDATION</code>; see
@@ -195,7 +196,7 @@ export const LayerModel = () =>
195
196
  <td>5.59 &rarr; 86.3%, <strong>5.89 &rarr; 71.4%</strong> — <strong>not even monotonic</strong></td></tr>
196
197
  <tr><td>why</td><td>value / max, linear</td>
197
198
  <td>per-card reference score through a gamma-shaped stretch; <code>variant="primary"</code> is pinned at 100%</td></tr>
198
- <tr><td>ARIA</td><td><code>role="progressbar"</code> with <code>aria-valuenow/min/max</code></td>
199
+ <tr><td>ARIA</td><td>a native <code>&lt;progress&gt;</code>: the progressbar role, its value and its range</td>
199
200
  <td>no role; the value reaches the tree only as a sentence on a generic node</td></tr>
200
201
  <tr><td>track</td><td>8px, label above it</td><td>48px row, label and score inside the fill</td></tr>
201
202
  <tr><td>colour</td><td><code>--status-*-accent</code> — tone carries meaning</td>
@@ -231,7 +232,7 @@ export const LayerModel = () =>
231
232
  children: html`
232
233
  <p>A unit&rsquo;s layer is recorded in <code>scripts/architecture.json</code>, keyed on its
233
234
  <strong>source path</strong>. Both governance gates read it from there: <code>lint:tokens</code> asks which
234
- files are atom-tier, and <code>verify:typography</code> asks which stories are a typography contract.</p>
235
+ files are atom-tier, and typography coverage asks which stories are a typography contract.</p>
235
236
  <table class="ref">
236
237
  <thead><tr><th>Rule</th><th>Why</th></tr></thead>
237
238
  <tbody>
@@ -1,15 +1,24 @@
1
1
  import { css, unsafeCSS } from "lit";
2
- import { above, below } from "../shared/token-scales.js";
2
+ import { above } from "../shared/token-scales.js";
3
+ import { hostFillsWidth } from "../shared/fill-width.css.js";
3
4
 
4
5
  /* The card sits on the hero's brand band and the page below it at once, so
5
6
  it takes the second clause of the card rule: surface/default with a
6
7
  border/container edge, at the card corner and the compact inset. */
7
8
  export const audienceCardCSS = css`
9
+ /* The card is a size container, so its content gives it no width: it
10
+ takes its cell's whole width, as it takes the row's height, and lays
11
+ itself out for that. Left to fit its content -- bd-grid places its items
12
+ at start -- a container measures 0 wide. The width is the column less
13
+ the card's margins (shared/fill-width.css.js). */
8
14
  :host {
9
15
  display: block;
10
16
  height: 100%;
17
+ container-type: inline-size;
11
18
  }
12
19
 
20
+ ${hostFillsWidth()}
21
+
13
22
  .card {
14
23
  box-sizing: border-box;
15
24
  height: 100%;
@@ -22,7 +31,8 @@ export const audienceCardCSS = css`
22
31
  background: var(--color-surface-default);
23
32
  border: var(--border-width-1) solid var(--color-border-container);
24
33
  border-radius: var(--card-radius);
25
- cursor: pointer;
34
+ /* the containing block for the link's stretched hit area, below */
35
+ position: relative;
26
36
  }
27
37
 
28
38
  .copy {
@@ -72,8 +82,24 @@ export const audienceCardCSS = css`
72
82
  flex: none;
73
83
  }
74
84
 
75
- /* The tablet row: copy left, the arrow right and centred on it. */
76
- @media ${unsafeCSS(above("md"))} and ${unsafeCSS(below("lg"))} {
85
+ /* The stretched link: the arrow's own <a> (bd-button-link's part="button")
86
+ draws an ::after over the whole card, so the card is the link's hit area
87
+ -- middle-click, Ctrl/Cmd-click and the link menu included -- with no
88
+ script. Nothing between the card and the <a> is positioned, so the card
89
+ is what it fills. The pointer over it is the link's own. It paints
90
+ nothing, so it takes no corner of its own. */
91
+ .arrow::part(button)::after {
92
+ content: "";
93
+ position: absolute;
94
+ inset: 0;
95
+ }
96
+
97
+ /* The tablet row, copy left and the arrow right and centred on it,
98
+ wherever the card is wide enough for it -- not wherever the screen is.
99
+ Following the viewport from md to lg, a card in a two- or three-column
100
+ grid at tablet width took the row with no room for it, and a lone card
101
+ on a desktop page stayed a column with its arrow far below the copy. */
102
+ @container ${unsafeCSS(above("sm"))} {
77
103
  .card {
78
104
  flex-direction: row;
79
105
  align-items: center;
@@ -10,9 +10,13 @@ import { audienceCardCSS } from "./audience-card.css.js";
10
10
  * foundation Figma file as Audience card.
11
11
  *
12
12
  * One link, not three. The arrow is the link and carries the accessible name
13
- * (`label`, the eyebrow by default, e.g. "For home"); a click anywhere else on
14
- * the card follows it too, as a convenience for the pointer, so the page reads
15
- * one link per card instead of a title, a paragraph and an arrow.
13
+ * (`label`, the eyebrow by default, e.g. "For home"), so the page reads one
14
+ * link per card instead of a title, a paragraph and an arrow. Its hit area is
15
+ * stretched across the card by an ::after on the link itself (see
16
+ * audience-card.css.js), so a click anywhere on the card is a click on the
17
+ * link: middle-click and Ctrl/Cmd-click open it in a new tab and the link's
18
+ * context menu is there, which the click handler that stood here could not
19
+ * do -- it forwarded a plain click() whatever the reader had asked for.
16
20
  *
17
21
  * Between md and lg -- the tablet frame -- the card turns into a row, the copy
18
22
  * on the left and the arrow on the right; above and below it stacks.
@@ -42,18 +46,9 @@ export class AudienceCard extends LitElement {
42
46
  this.as = "h2";
43
47
  }
44
48
 
45
- /* The pointer convenience: a click that did not land on the link itself
46
- follows it. Text selection is left alone. */
47
- _onCardClick(e) {
48
- const link = this.renderRoot.querySelector(".arrow");
49
- if (!link || !this.href || e.composedPath().includes(link)) return;
50
- if (window.getSelection()?.toString()) return;
51
- link.shadowRoot?.querySelector("a")?.click();
52
- }
53
-
54
49
  render() {
55
50
  return html`
56
- <article class="card" @click=${this._onCardClick}>
51
+ <article class="card">
57
52
  <div class="copy">
58
53
  ${this.eyebrow
59
54
  ? html`<p class="eyebrow"><slot name="icon"></slot><span class="text">${this.eyebrow}</span></p>`
@@ -128,19 +128,36 @@ export const awardsFlexCSS = css`
128
128
  width: 100%;
129
129
  }
130
130
 
131
+ /* A scroller the browser drives: a swipe, a trackpad and a wheel all move
132
+ it, and the snap settles each of them on a whole slide. */
131
133
  .bd-awardsflex-carousel-viewport {
132
134
  width: 100%;
133
- overflow: hidden;
135
+ overflow-x: auto;
136
+ overflow-y: hidden;
137
+ scroll-snap-type: x mandatory;
138
+ /* a sideways swipe that reaches either end stops here, rather than
139
+ carrying on into the browser's back and forward gesture */
140
+ overscroll-behavior-x: contain;
141
+ /* No scrollbar: the dots say where the slides are. */
142
+ scrollbar-width: none;
143
+ /* a dot's jump glides; see the reduced-motion block for who it does not */
144
+ scroll-behavior: smooth;
145
+ }
146
+
147
+ .bd-awardsflex-carousel-viewport::-webkit-scrollbar {
148
+ display: none;
134
149
  }
135
150
 
136
151
  .bd-awardsflex-carousel-track {
137
152
  display: flex;
138
- transition: transform 0.4s ease;
139
- will-change: transform;
140
153
  }
141
154
 
142
- /* each slide/page holds a group of quote cards (default 3), shown side by side */
155
+ /* each slide/page holds a group of quote cards (default 3), shown side by
156
+ side; one stop a slide, and a swipe moves one slide however hard it is
157
+ flung */
143
158
  .bd-awardsflex-carousel-slide {
159
+ scroll-snap-align: start;
160
+ scroll-snap-stop: always;
144
161
  flex: 0 0 100%;
145
162
  display: flex;
146
163
  justify-content: center;
@@ -215,8 +232,8 @@ export const awardsFlexCSS = css`
215
232
  }
216
233
 
217
234
  @media (prefers-reduced-motion: reduce) {
218
- .bd-awardsflex-carousel-track {
219
- transition: none;
235
+ .bd-awardsflex-carousel-viewport {
236
+ scroll-behavior: auto;
220
237
  }
221
238
  }
222
239
 
@@ -14,6 +14,7 @@ import "../pagination-dots/pagination-dots.js";
14
14
  import { awardsFlexCSS } from "./awards-flex.css.js";
15
15
  import { ensembleCSS } from "../shared/ensemble.css.js";
16
16
  import { below } from "../shared/token-scales.js";
17
+ import { ScrollSlides } from "./scroll-slides.js";
17
18
 
18
19
  /* How many quote cards one carousel slide holds: three side by side, and one
19
20
  below sm. Three used to stack in a column on a phone, so a slide was about
@@ -65,6 +66,10 @@ export class AwardsFlex extends LitElement {
65
66
  once they are still, so a change the visitor asks for is announced.
66
67
  bd-pagination-dots says which, through bd-toggle. */
67
68
  this._live = "polite";
69
+ this._slides = new ScrollSlides(this, {
70
+ scroller: ".bd-awardsflex-carousel-viewport",
71
+ onSlide : i => this._onScrolled(i)
72
+ });
68
73
  }
69
74
 
70
75
  connectedCallback() {
@@ -106,6 +111,17 @@ export class AwardsFlex extends LitElement {
106
111
  this._slide = 0;
107
112
  }
108
113
  }
114
+ // a dot, the clock or a re-paging chose a slide: bring it in
115
+ if (changed.has("_slide") || changed.has("_groupSize")) this._slides.go(this._slide);
116
+ }
117
+
118
+ /* A visitor scrolled to another slide. That is a choice of slide, as a dot
119
+ is, so it stops autoplay for good the way a dot does. */
120
+ _onScrolled(index) {
121
+ if (index === this._slide) return;
122
+ this._slide = index;
123
+ const dots = this.renderRoot.querySelector("bd-pagination-dots");
124
+ if (dots?.autoplay) dots.paused = true;
109
125
  }
110
126
 
111
127
  get _groups() {
@@ -196,8 +212,11 @@ export class AwardsFlex extends LitElement {
196
212
  `;
197
213
  }
198
214
 
215
+ /* The window is a scroll-snap scroller the browser drives -- a swipe, a
216
+ trackpad and a wheel move it, and the dots follow (scroll-slides.js). It
217
+ used to be overflow: hidden around a track moved by an inline
218
+ translateX, which nothing but the dots could move. */
199
219
  _renderCarousel() {
200
- const offset = -100 * this._slide;
201
220
  return html`
202
221
  <div
203
222
  class="bd-awardsflex-carousel-viewport"
@@ -206,11 +225,7 @@ export class AwardsFlex extends LitElement {
206
225
  @focusin=${() => { this._focusWithin = true; }}
207
226
  @focusout=${e => { this._focusWithin = e.currentTarget.contains(e.relatedTarget); }}
208
227
  >
209
- <div
210
- class="bd-awardsflex-carousel-track"
211
- style="transform: translateX(${offset}%);"
212
- aria-live=${this._live}
213
- >
228
+ <div class="bd-awardsflex-carousel-track" aria-live=${this._live}>
214
229
  ${this._groups.map(
215
230
  (group, i) => html`
216
231
  <div class="bd-awardsflex-carousel-slide" ?inert=${i !== this._slide}>
@@ -30,11 +30,25 @@ export const awardsSpotlightCSS = css`
30
30
  fades out across the padding. A slide at rest starts where the fade
31
31
  ends, so it is untouched; a slide on the move dissolves into the card's
32
32
  edge instead of being cut on a hard line inside it -- which is what
33
- clipping at the padding did. */
33
+ clipping at the padding did.
34
+
35
+ It is a scroller the browser drives: a swipe, a trackpad and a wheel all
36
+ move it, and the snap settles each of them on a whole slide. It used to
37
+ be overflow: hidden around a track moved by an inline translateX, which
38
+ nothing but the dots could move. */
34
39
  .viewport {
35
40
  width: calc(100% + 2 * var(--bd-awards-spotlight-inset));
36
41
  margin-inline: calc(-1 * var(--bd-awards-spotlight-inset));
37
- overflow: hidden;
42
+ overflow-x: auto;
43
+ overflow-y: hidden;
44
+ scroll-snap-type: x mandatory;
45
+ /* a sideways swipe that reaches either end stops here, rather than
46
+ carrying on into the browser's back and forward gesture */
47
+ overscroll-behavior-x: contain;
48
+ /* No scrollbar: the dots say where the slides are. */
49
+ scrollbar-width: none;
50
+ /* a dot's jump glides; see the reduced-motion block for who it does not */
51
+ scroll-behavior: smooth;
38
52
  /* no token: a mask is read for its alpha only, so the colour is a
39
53
  placeholder for "opaque" and carries no ink */
40
54
  mask-image: linear-gradient(
@@ -48,12 +62,18 @@ export const awardsSpotlightCSS = css`
48
62
 
49
63
  /* Every slide stretches to the tallest, which is what keeps the dots in one
50
64
  place as the slides change. */
65
+ .viewport::-webkit-scrollbar {
66
+ display: none;
67
+ }
68
+
51
69
  .track {
52
70
  display: flex;
53
- transition: transform var(--transition-duration-slower) var(--transition-easing-smooth);
54
71
  }
55
72
 
73
+ /* One stop a slide, and a swipe moves one slide however hard it is flung. */
56
74
  .slide {
75
+ scroll-snap-align: start;
76
+ scroll-snap-stop: always;
57
77
  flex: 0 0 100%;
58
78
  display: flex;
59
79
  flex-direction: column;
@@ -125,8 +145,8 @@ export const awardsSpotlightCSS = css`
125
145
  }
126
146
 
127
147
  @media (prefers-reduced-motion: reduce) {
128
- .track {
129
- transition: none;
148
+ .viewport {
149
+ scroll-behavior: auto;
130
150
  }
131
151
  }
132
152
 
@@ -5,6 +5,7 @@ import "../image/image.js";
5
5
  import "../pagination-dots/pagination-dots.js";
6
6
  import { awardsSpotlightCSS } from "./awards-spotlight.css.js";
7
7
  import { ensembleCSS } from "../shared/ensemble.css.js";
8
+ import { ScrollSlides } from "./scroll-slides.js";
8
9
 
9
10
  /**
10
11
  * The homepage awards carousel: one award a slide, on a card. Each slide is
@@ -17,11 +18,14 @@ import { ensembleCSS } from "../shared/ensemble.css.js";
17
18
  * it was won, and leaves the section heading to the page around it.
18
19
  *
19
20
  * The slides are as tall as the tallest one -- the track stretches them -- so
20
- * the dots stay put from slide to slide and the section does not jump.
21
+ * the dots stay put from slide to slide and the section does not jump. They
22
+ * sit in a scroll-snap scroller, so a swipe, a trackpad or a wheel moves them
23
+ * and the dots follow (scroll-slides.js).
21
24
  *
22
25
  * Autoplay is bd-pagination-dots': the progress in the current pill is the
23
26
  * clock. The pointer or focus on the slides holds it, a visitor picking a dot
24
- * stops it for good, and under prefers-reduced-motion it never starts.
27
+ * or swiping to another slide stops it for good, and under
28
+ * prefers-reduced-motion it never starts.
25
29
  */
26
30
  export class AwardsSpotlight extends LitElement {
27
31
  static properties = {
@@ -53,11 +57,23 @@ export class AwardsSpotlight extends LitElement {
53
57
  read a new award every few seconds; polite once they are still, so a
54
58
  change the visitor asks for is announced. The dots say which. */
55
59
  this._live = "polite";
60
+ this._slides = new ScrollSlides(this, { scroller: ".viewport", onSlide: i => this._onScrolled(i) });
56
61
  }
57
62
 
58
63
  updated(changed) {
59
64
  // a shorter list must not leave the carousel on a slide that is gone
60
65
  if (changed.has("awards") && this._slide >= this.awards.length) this._slide = 0;
66
+ // a dot or the clock chose a slide: bring it in
67
+ if (changed.has("_slide")) this._slides.go(this._slide);
68
+ }
69
+
70
+ /* A visitor scrolled to another slide. That is a choice of slide, as a dot
71
+ is, so it stops autoplay for good the way a dot does. */
72
+ _onScrolled(index) {
73
+ if (index === this._slide) return;
74
+ this._slide = index;
75
+ const dots = this.renderRoot.querySelector("bd-pagination-dots");
76
+ if (dots?.autoplay) dots.paused = true;
61
77
  }
62
78
 
63
79
  _renderSlide(award, i) {
@@ -102,11 +118,7 @@ export class AwardsSpotlight extends LitElement {
102
118
  @focusin=${() => { this._focusWithin = true; }}
103
119
  @focusout=${e => { this._focusWithin = e.currentTarget.contains(e.relatedTarget); }}
104
120
  >
105
- <div
106
- class="track"
107
- style="transform: translateX(${-100 * this._slide}%);"
108
- aria-live=${this._live}
109
- >
121
+ <div class="track" aria-live=${this._live}>
110
122
  ${this.awards.map((a, i) => this._renderSlide(a, i))}
111
123
  </div>
112
124
  </div>
@@ -1,5 +1,5 @@
1
1
  import { css, unsafeCSS } from "lit";
2
- import { below } from "../shared/token-scales.js";
2
+ import { below, readAs } from "../shared/token-scales.js";
3
3
 
4
4
  export const awardsCSS = css`
5
5
 
@@ -140,13 +140,6 @@ export const awardsCSS = css`
140
140
  boundary. The atom sizes itself -- see its defaultSize -- so the sizing
141
141
  this rule tried to impose was already handled a layer down. */
142
142
 
143
- .bd-awards-headline-line {
144
- display: block;
145
- width: 100%;
146
- white-space: normal;
147
- word-break: break-word;
148
- }
149
-
150
143
  .bd-awards-trust-intro .bd-awards-subtext {
151
144
  width: 100%;
152
145
  max-width: 100%;
@@ -386,5 +379,24 @@ export const awardsCSS = css`
386
379
  gap: var(--spacing-32);
387
380
  padding: 0;
388
381
  }
382
+
383
+ /* The banner and the secret section a step down the type scale: the
384
+ tagline large to small, the headline and the section title h3 to the
385
+ h4 size, the two paragraphs regular to small. The levels stay h3; see
386
+ readAs() in token-scales.js. awards.js used to re-render these with
387
+ other variants and visual levels from a matchMedia listener. */
388
+ .bd-awards-tagline { ${unsafeCSS(readAs('body-large', 'body-small'))} }
389
+ .bd-awards-headline,
390
+ .bd-awards-section-title { ${unsafeCSS(readAs('heading-h3', 'heading-h4'))} }
391
+ .bd-awards-subtext,
392
+ .bd-awards-section-subtext { ${unsafeCSS(readAs('body-regular', 'body-small'))} }
393
+ }
394
+
395
+ /* The feature cards step down a breakpoint later: the title from the h4
396
+ size to h6 (still bold, which it sets itself), the description regular to
397
+ small. */
398
+ @media ${unsafeCSS(below('md'))} {
399
+ .bd-awards-feature-title { ${unsafeCSS(readAs('heading-h4', 'heading-h6'))} }
400
+ .bd-awards-feature-desc { ${unsafeCSS(readAs('body-regular', 'body-small'))} }
389
401
  }
390
402
  `;
@@ -16,7 +16,6 @@ import "../heading/heading.js";
16
16
  import "../paragraph/paragraph.js";
17
17
  import { awardsCSS } from "./awards.css.js";
18
18
  import { ensembleCSS } from "../shared/ensemble.css.js";
19
- import { below } from "../shared/token-scales.js";
20
19
 
21
20
  const ICON_RENDERERS = {
22
21
  "bd-pc-mag-icon" : () => html`<bd-pc-mag-icon></bd-pc-mag-icon>`,
@@ -54,25 +53,18 @@ export class AwardsSection extends LitElement {
54
53
  * the lower content present that padding would be wrong, which is exactly
55
54
  * what makes it a consequence of the scope rather than a theme.
56
55
  */
57
- content : { type: String, reflect: true },
58
- tagline : { type: String },
59
- headline : { type: String },
60
- subtext : { type: String },
61
- secretTitle : { type: String },
62
- secretSubtext : { type: String },
63
- desktopAwards : { type: Array },
64
- features : { type: Array },
65
- _narrow : { state: true },
66
- _featureNarrow: { state: true }
56
+ content : { type: String, reflect: true },
57
+ tagline : { type: String },
58
+ headline : { type: String },
59
+ subtext : { type: String },
60
+ secretTitle : { type: String },
61
+ secretSubtext: { type: String },
62
+ desktopAwards: { type: Array },
63
+ features : { type: Array }
67
64
  };
68
65
 
69
66
  static styles = [ensembleCSS, awardsCSS];
70
67
 
71
- _mqlSm = null;
72
- _mqlMd = null;
73
- _onSm = () => { this._narrow = this._mqlSm?.matches ?? false; };
74
- _onMd = () => { this._featureNarrow = this._mqlMd?.matches ?? false; };
75
-
76
68
  constructor() {
77
69
  super();
78
70
  this.content = "full";
@@ -104,28 +96,14 @@ export class AwardsSection extends LitElement {
104
96
  description: "Bitdefender keeps an eye on how you and your devices normally behave. So, when something unusual happens, like a strange file trying to sneak into your computer or a suspicious website trying to steal your info, Bitdefender sounds the alarm. It's like having a loyal sidekick that never sleeps, always on the lookout for trouble and ready to jump into action to keep you safe."
105
97
  }
106
98
  ];
107
-
108
- this._narrow = false;
109
- this._featureNarrow = false;
110
99
  }
111
100
 
112
- connectedCallback() {
113
- super.connectedCallback();
114
- if (typeof window !== "undefined" && window.matchMedia) {
115
- this._mqlSm = window.matchMedia(below('sm'));
116
- this._mqlMd = window.matchMedia(below('md'));
117
- this._narrow = this._mqlSm.matches;
118
- this._featureNarrow = this._mqlMd.matches;
119
- this._mqlSm.addEventListener("change", this._onSm);
120
- this._mqlMd.addEventListener("change", this._onMd);
121
- }
122
- }
123
-
124
- disconnectedCallback() {
125
- super.disconnectedCallback();
126
- this._mqlSm?.removeEventListener("change", this._onSm);
127
- this._mqlMd?.removeEventListener("change", this._onMd);
128
- }
101
+ /* The type steps down below sm (the banner and the secret section) and
102
+ below md (the feature cards) in awards.css.js. It used to be two
103
+ matchMedia listeners here re-rendering every heading and paragraph with
104
+ another level or variant -- the levels moved with the size -- and, below
105
+ sm, swapping the headline for three hard-coded lines, so a page that set
106
+ its own headline lost it on a phone. */
129
107
 
130
108
  _renderBadge(award) {
131
109
  const iconFn = ICON_RENDERERS[award.tag];
@@ -138,28 +116,12 @@ export class AwardsSection extends LitElement {
138
116
  `;
139
117
  }
140
118
 
141
- /* The narrow branches below change visual-level, not as.
142
-
143
- They used to change `as`, which made the document outline depend on the
144
- viewport: measured on Modules/Awards Section, the same content rendered
145
- h6/h4 at 375 and 576 and h4/h3 from 768 up, so a reader on a phone got a
146
- different heading structure from a reader on a laptop -- and the narrow
147
- version put feature titles at h6 directly under an h4, skipping h5.
148
-
149
- CLAUDE.md already separates these two questions: `as` is the document
150
- outline, which the composing page owns, and `visual-level` is the type
151
- role, which the component owns. A responsive size change belongs to the
152
- second. The outline now holds at the wider levels -- h3 for the headline
153
- and the secret-section title, h4 for feature titles -- at every width, and
154
- the smaller rendering at narrow widths is expressed as the type role it
155
- always was.
156
-
157
- Nothing about the narrow layout changes visually: h6 as a visual-level
158
- resolves to the same type role the h6 element resolved to. The content
159
- branches stay as they are; the narrow headline genuinely renders different
160
- copy. */
119
+ /* The outline holds at every width: h3 for the headline and the
120
+ secret-section title, h4 for feature titles. It used to depend on the
121
+ viewport -- measured on Modules/Awards Section, h6/h4 at 375 and 576 and
122
+ h4/h3 from 768 up, skipping h5 under an h4 -- which moved to visual-level
123
+ and now to awards.css.js, where only the size steps down. */
161
124
  _renderFeature(f) {
162
- const narrow = this._featureNarrow;
163
125
  const iconFn = ICON_RENDERERS[f.tag];
164
126
  return html`
165
127
  <article class="bd-awards-feature-card">
@@ -167,29 +129,24 @@ export class AwardsSection extends LitElement {
167
129
  ${iconFn ? iconFn() : ""}
168
130
  </div>
169
131
  <div class="bd-awards-feature-text">
170
- ${narrow
171
- ? html`<bd-h as="h4" visual-level="h6" fontWeight="bold" class="bd-awards-feature-title">${f.title}</bd-h>`
172
- : html`<bd-h as="h4" fontWeight="bold" class="bd-awards-feature-title">${f.title}</bd-h>`}
173
- ${narrow
174
- ? html`<bd-p variant="small" class="bd-awards-feature-desc">${f.description}</bd-p>`
175
- : html`<bd-p variant="regular" class="bd-awards-feature-desc">${f.description}</bd-p>`}
132
+ <bd-h as="h4" fontWeight="bold" class="bd-awards-feature-title">${f.title}</bd-h>
133
+ <bd-p variant="regular" class="bd-awards-feature-desc">${f.description}</bd-p>
176
134
  </div>
177
135
  </article>
178
136
  `;
179
137
  }
180
138
 
181
139
  render() {
182
- const narrow = this._narrow;
183
140
  /* `summary` needs the section to carry its own block padding, because
184
141
  nothing follows the award bar. `full` must not get that wrapper: its
185
142
  rhythm comes from the lower content, and adding padding there would move
186
143
  a component this phase is not allowed to move. */
187
144
  return this.content === "summary"
188
- ? html`<div class="bd-ensemble bd-awards-root">${this._renderUpper(narrow)}</div>`
189
- : html`${this._renderUpper(narrow)}${this._renderLower(narrow)}`;
145
+ ? html`<div class="bd-ensemble bd-awards-root">${this._renderUpper()}</div>`
146
+ : html`${this._renderUpper()}${this._renderLower()}`;
190
147
  }
191
148
 
192
- _renderUpper(narrow) {
149
+ _renderUpper() {
193
150
  return html`
194
151
  <div class="bd-awards-trust-banner">
195
152
  <div class="bd-awards-trust-intro">
@@ -197,23 +154,9 @@ export class AwardsSection extends LitElement {
197
154
  <bd-laurel-icon></bd-laurel-icon>
198
155
  </span>
199
156
 
200
- ${narrow
201
- ? html`<bd-p variant="small" class="bd-awards-tagline">${this.tagline}</bd-p>`
202
- : html`<bd-p variant="large" class="bd-awards-tagline">${this.tagline}</bd-p>`}
203
-
204
- ${narrow
205
- ? html`
206
- <bd-h as="h3" visual-level="h4" class="bd-awards-headline">
207
- <span class="bd-awards-headline-line">World-class security</span>
208
- <span class="bd-awards-headline-line">software you can trust.</span>
209
- <span class="bd-awards-headline-line">Always.</span>
210
- </bd-h>
211
- `
212
- : html`<bd-h as="h3" class="bd-awards-headline">${this.headline}</bd-h>`}
213
-
214
- ${narrow
215
- ? html`<bd-p variant="small" class="bd-awards-subtext">${this.subtext}</bd-p>`
216
- : html`<bd-p variant="regular" class="bd-awards-subtext">${this.subtext}</bd-p>`}
157
+ <bd-p variant="large" class="bd-awards-tagline">${this.tagline}</bd-p>
158
+ <bd-h as="h3" class="bd-awards-headline">${this.headline}</bd-h>
159
+ <bd-p variant="regular" class="bd-awards-subtext">${this.subtext}</bd-p>
217
160
  </div>
218
161
 
219
162
  <div class="bd-awards-bar" role="list" aria-label="Industry awards">
@@ -238,17 +181,13 @@ export class AwardsSection extends LitElement {
238
181
  * a `gap: 0` override. Omitting the element removes both the phantom gap and
239
182
  * the reason for the override.
240
183
  */
241
- _renderLower(narrow) {
184
+ _renderLower() {
242
185
  if (this.content === "summary") return nothing;
243
186
  return html`
244
187
  <div class="bd-awards-lower">
245
188
  <section class="bd-awards-secret-section">
246
- ${narrow
247
- ? html`<bd-h as="h3" visual-level="h4" class="bd-awards-section-title">${this.secretTitle}</bd-h>`
248
- : html`<bd-h as="h3" class="bd-awards-section-title">${this.secretTitle}</bd-h>`}
249
- ${narrow
250
- ? html`<bd-p variant="small" class="bd-awards-section-subtext">${this.secretSubtext}</bd-p>`
251
- : html`<bd-p variant="regular" class="bd-awards-section-subtext">${this.secretSubtext}</bd-p>`}
189
+ <bd-h as="h3" class="bd-awards-section-title">${this.secretTitle}</bd-h>
190
+ <bd-p variant="regular" class="bd-awards-section-subtext">${this.secretSubtext}</bd-p>
252
191
  </section>
253
192
 
254
193
  <div class="bd-awards-features-grid">