@repobit/dex-system-design 2.5.1 → 2.7.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 (175) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/README.md +2 -1
  3. package/package.json +14 -27
  4. package/schemas/component-manifest.json +233 -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 +228 -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 +56 -20
  75. package/src/components/grid/grid.js +20 -15
  76. package/src/components/grid/grid.stories.js +39 -11
  77. package/src/components/header/header-code.css.js +20 -11
  78. package/src/components/header/header-code.js +1 -1
  79. package/src/components/header/header.css.js +20 -14
  80. package/src/components/header/header.js +6 -7
  81. package/src/components/header/header.stories.js +29 -24
  82. package/src/components/heading/heading.css.js +11 -0
  83. package/src/components/hero/hero.js +10 -2
  84. package/src/components/highlight/highlight.css.js +30 -6
  85. package/src/components/icons/arrow-icon.js +4 -1
  86. package/src/components/icons/arrow-right-icon.js +5 -1
  87. package/src/components/icons/icon-element.js +18 -0
  88. package/src/components/image/image.js +29 -9
  89. package/src/components/image/image.stories.js +38 -2
  90. package/src/components/input/custom-form.stories.js +38 -7
  91. package/src/components/input/input-clipboard.css.js +15 -1
  92. package/src/components/input/input-clipboard.js +84 -21
  93. package/src/components/input/input.js +27 -7
  94. package/src/components/install-options/install-options.css.js +26 -6
  95. package/src/components/install-options/install-options.js +32 -8
  96. package/src/components/label/label.css.js +1 -1
  97. package/src/components/light-carousel/light-carousel.css.js +100 -48
  98. package/src/components/light-carousel/light-carousel.js +43 -5
  99. package/src/components/link/link.css.js +15 -15
  100. package/src/components/link/link.js +17 -1
  101. package/src/components/link/link.stories.js +20 -7
  102. package/src/components/list/list.css.js +3 -3
  103. package/src/components/logo-marquee/logo-marquee.css.js +12 -1
  104. package/src/components/logo-marquee/logo-marquee.js +33 -8
  105. package/src/components/logo-marquee/logo-marquee.stories.js +10 -4
  106. package/src/components/modal/modal.css.js +74 -40
  107. package/src/components/modal/modal.js +85 -74
  108. package/src/components/modal/modal.stories.js +27 -14
  109. package/src/components/motion-art/motion-art.js +67 -1
  110. package/src/components/page-switcher/page-switcher.css.js +27 -9
  111. package/src/components/page-switcher/page-switcher.js +11 -8
  112. package/src/components/partner-banner/partner-banner.css.js +2 -0
  113. package/src/components/picture/picture.css.js +4 -4
  114. package/src/components/picture/picture.js +13 -3
  115. package/src/components/picture/picture.stories.js +28 -2
  116. package/src/components/post-card/post-card.css.js +18 -3
  117. package/src/components/pricing-cards/adopt-styles.js +16 -0
  118. package/src/components/pricing-cards/new-pricing-card.js +2 -4
  119. package/src/components/pricing-cards/new-pricing-card.stories.js +20 -22
  120. package/src/components/pricing-cards/pricing-card-actions.css.js +8 -12
  121. package/src/components/pricing-cards/pricing-card-actions.js +26 -13
  122. package/src/components/pricing-cards/pricing-card-container.css.js +4 -3
  123. package/src/components/pricing-cards/pricing-card-container.js +10 -4
  124. package/src/components/pricing-cards/pricing-card-header.css.js +5 -4
  125. package/src/components/pricing-cards/pricing-card-header.js +18 -31
  126. package/src/components/pricing-cards/pricing-card-pricing.css.js +84 -61
  127. package/src/components/pricing-cards/pricing-card-pricing.js +38 -24
  128. package/src/components/pricing-cards/pricing-card-show-more.js +8 -3
  129. package/src/components/pricing-cards/pricing-card.css.js +75 -41
  130. package/src/components/pricing-cards/pricing-card.js +356 -308
  131. package/src/components/progress/progress.css.js +58 -13
  132. package/src/components/progress/progress.js +13 -10
  133. package/src/components/progress/progress.stories.js +9 -7
  134. package/src/components/radio/radio-group.css.js +42 -0
  135. package/src/components/radio/radio-group.js +89 -0
  136. package/src/components/radio/radio.css.js +63 -6
  137. package/src/components/radio/radio.js +173 -140
  138. package/src/components/radio/radio.stories.js +99 -44
  139. package/src/components/radio/toggle-radio.js +44 -0
  140. package/src/components/review/review-grid.css.js +5 -1
  141. package/src/components/review/review-grid.js +2 -0
  142. package/src/components/review/review.js +13 -0
  143. package/src/components/shared/announcer.js +37 -0
  144. package/src/components/shared/fill-width.css.js +29 -0
  145. package/src/components/shared/form-control.js +194 -0
  146. package/src/components/shared/form-field.css.js +31 -3
  147. package/src/components/shared/token-scales.js +75 -26
  148. package/src/components/spotlight-section/spotlight-section.js +2 -2
  149. package/src/components/stat/stat-highlight.js +1 -1
  150. package/src/components/stat/stat.css.js +18 -3
  151. package/src/components/switch/switch.css.js +58 -5
  152. package/src/components/switch/switch.js +53 -5
  153. package/src/components/switch/switch.stories.js +30 -8
  154. package/src/components/tab-list/tab-list.css.js +51 -13
  155. package/src/components/tab-list/tab-list.js +7 -2
  156. package/src/components/tab-list/tab-list.stories.js +2 -2
  157. package/src/components/tabs/tabs.css.js +18 -1
  158. package/src/components/tabs/tabs.js +119 -41
  159. package/src/components/terminal/terminal-message.css.js +6 -1
  160. package/src/components/termsOfUse/terms.css.js +4 -2
  161. package/src/components/textarea/textarea.js +22 -7
  162. package/src/components/textarea/textarea.stories.js +12 -9
  163. package/src/components/trust-panel/trust-panel.css.js +13 -3
  164. package/src/components/ultimate-security-demo.stories.js +5 -5
  165. package/src/components/video/video.css.js +5 -0
  166. package/src/components/video/video.js +5 -0
  167. package/src/components/video/video.stories.js +12 -0
  168. package/src/components/video-player/video-player.css.js +20 -8
  169. package/src/components/video-player/video-player.js +74 -20
  170. package/src/components/video-player/video-player.stories.js +17 -3
  171. package/src/tokens/brands.stories.js +1 -1
  172. package/src/tokens/themes/index.js +2 -2
  173. package/src/tokens/typography.stories.js +4 -3
  174. package/src/vendor/motion-art/README.md +4 -1
  175. package/src/components/footer/footer-lp.css.js +0 -159
@@ -1,9 +1,11 @@
1
1
  import { css } from "lit";
2
2
 
3
3
  export default css`
4
+ /* No font smoothing. -webkit-font-smoothing: antialiased and its Firefox
5
+ twin stood here, the only ones in the package: non-standard, macOS-only,
6
+ and they drew this module's type thinner than the same roles everywhere
7
+ else on the page. */
4
8
  :host {
5
- -webkit-font-smoothing: antialiased;
6
- -moz-osx-font-smoothing: grayscale;
7
9
  display: block;
8
10
  /* the band runs full-bleed on the host; the column inside it is bd-ensemble,
9
11
  and the prose inside that keeps its own readable measure */
@@ -1,9 +1,11 @@
1
1
  import { LitElement, html, nothing } from 'lit';
2
+ import { keyed } from 'lit/directives/keyed.js';
2
3
  // Installs the design tokens into document scope; see src/tokens/tokens.js
3
4
  import '../../tokens/tokens.js';
4
5
  import { formFieldCSS } from '../shared/form-field.css.js';
5
6
  import { textareaCSS } from './textarea.css.js';
6
7
  import { resolveSize } from '../shared/prop-vocabulary.js';
8
+ import { ValueControl, omitEmpty } from '../shared/form-control.js';
7
9
 
8
10
  // ids are scoped to the shadow root, so fixed ones are safe here
9
11
  const TEXTAREA_ID = 'custom-textarea';
@@ -23,12 +25,14 @@ const HELP_ID = 'custom-textarea-help';
23
25
  * an input of the same size are the same control with a different number of
24
26
  * lines.
25
27
  */
26
- export class BdTextarea extends LitElement {
28
+ export class BdTextarea extends ValueControl(LitElement) {
27
29
  static styles = [formFieldCSS, textareaCSS];
28
30
 
29
31
  static properties = {
30
32
  label : { type: String },
31
33
  size : { type: String, reflect: true },
34
+ /* The current value; the value attribute is the default a form reset
35
+ returns to, as on bd-custom-input. See ValueControl. */
32
36
  value : { type: String },
33
37
  placeholder: { type: String },
34
38
  rows : { type: Number },
@@ -37,7 +41,8 @@ export class BdTextarea extends LitElement {
37
41
  invalid : { type: Boolean },
38
42
  validated : { type: Boolean, reflect: true },
39
43
  disabled : { type: Boolean, reflect: true },
40
- name : { type: String }
44
+ // reflected, because a form reads the name off the element
45
+ name : { type: String, reflect: true, converter: omitEmpty }
41
46
  };
42
47
 
43
48
  constructor() {
@@ -55,16 +60,25 @@ export class BdTextarea extends LitElement {
55
60
  this.name = '';
56
61
  }
57
62
 
63
+ get _control() {
64
+ return this.renderRoot?.querySelector?.('textarea');
65
+ }
66
+
58
67
  willUpdate(changed) {
59
68
  if (changed.has('size')) this.size = resolveSize(this.size);
60
69
  }
61
70
 
71
+ updated() {
72
+ this._sync();
73
+ }
74
+
62
75
  /* The native event retargets to the host, which has no value property of its
63
76
  own, so the host mirrors it — the same arrangement bd-custom-input uses.
64
77
  `bd-input` keeps its original detail shape (the raw string) because
65
78
  consumers already read it that way. */
66
79
  _onInput(e) {
67
80
  this.value = e.target.value;
81
+ this._sync();
68
82
  this.dispatchEvent(new CustomEvent('bd-input', {
69
83
  detail : e.target.value,
70
84
  bubbles : true,
@@ -85,7 +99,8 @@ export class BdTextarea extends LitElement {
85
99
  const inputClass = { sm: 'input-sm', md: 'input-md', lg: 'input-lg' }[this.size];
86
100
  const labelClass = { sm: 'label-sm', md: 'label-md', lg: 'label-lg' }[this.size];
87
101
 
88
- const stateClass = this.disabled
102
+ const disabled = this.disabled || this._formDisabled;
103
+ const stateClass = disabled
89
104
  ? 'form-input--disabled'
90
105
  : this.invalid
91
106
  ? 'form-input--error'
@@ -109,20 +124,20 @@ export class BdTextarea extends LitElement {
109
124
  : ''}
110
125
  </label>`
111
126
  : nothing}
112
- <textarea
127
+ ${keyed(this._resets, html`<textarea
113
128
  id="${TEXTAREA_ID}"
114
- class="form-input-bd ${inputClass} ${stateClass}"
129
+ class="form-input-bd ${inputClass} ${stateClass} ${this._attempted ? 'form-input--attempted' : ''}"
115
130
  rows=${this.rows}
116
131
  name="${this.name || nothing}"
117
132
  placeholder=${this.placeholder || nothing}
118
133
  ?required=${this.required}
119
- ?disabled=${this.disabled}
134
+ ?disabled=${disabled}
120
135
  aria-invalid="${this.invalid ? 'true' : nothing}"
121
136
  aria-describedby="${this.tooltip ? HELP_ID : nothing}"
122
137
  .value=${this.value}
123
138
  @input=${this._onInput}
124
139
  @change=${this._onChange}
125
- ></textarea>
140
+ ></textarea>`)}
126
141
  ${this.tooltip
127
142
  ? html`<div id="${HELP_ID}" class="form-help-text ${helpTextClass}">
128
143
  ${this.tooltip}
@@ -52,11 +52,14 @@ the prop:
52
52
  A \`placeholder\` is not a substitute. It disappears as soon as the user types,
53
53
  it is not reliably announced, and its contrast is set by the browser.
54
54
 
55
- ### Not form-associated
56
- The \`<textarea>\` lives in this element's shadow root, so it does not
57
- participate in an outer \`<form>\`. \`name\` is carried on the events for your own
58
- submit handling; read the value from \`bd-input\`, \`bd-change\` or the \`value\`
59
- property.
55
+ ### In a form
56
+ \`bd-textarea\` is **form-associated**, as \`bd-custom-input\` is: a \`<form>\`
57
+ around it submits \`name=value\`, reset returns it to its \`value\` attribute,
58
+ \`required\` blocks an empty submit with the browser's own message, and a
59
+ \`<fieldset disabled>\` disables it. The error state follows the
60
+ \`<textarea>\`'s own checks once it has been changed and left, or once a
61
+ submit has been tried; \`invalid\` still forces it. Enter is a new line, as in
62
+ any textarea. **Fieldset → In a form** shows every control together.
60
63
 
61
64
  ### Events
62
65
  \`bd-input\` — every keystroke, \`detail\` is the current value (a string).
@@ -122,7 +125,7 @@ The vertical resize handle is left enabled, so a user can grow the field beyond
122
125
  },
123
126
  name: {
124
127
  control : 'text',
125
- description: 'Carried on the bd-change detail as { value, name }, for your own submit handling. NOT submitted with a form — the <textarea> is in a shadow root.',
128
+ description: 'The name it submits under in a form. Also carried on the bd-change detail as { value, name }.',
126
129
  table : { type: { summary: 'string' }, defaultValue: { summary: "''" }, category: 'Content' }
127
130
  }
128
131
  }
@@ -133,9 +136,9 @@ export const Default = () => html`
133
136
  `;
134
137
 
135
138
  /**
136
- * `name` reaches no form -- the <textarea> is in this element's shadow root --
137
- * so it is carried on the event instead. Type, then click away: the line
138
- * below shows the bd-change detail as it arrives.
139
+ * `name` is what a form submits the value under, and it is carried on the
140
+ * event too, for a page that saves field by field. Type, then click away: the
141
+ * line below shows the bd-change detail as it arrives.
139
142
  */
140
143
  export const NameOnTheEvent = {
141
144
  name : 'name on the event',
@@ -142,9 +142,19 @@ export default css`
142
142
  box-shadow var(--transition-duration-normal) var(--transition-easing-ease);
143
143
  }
144
144
 
145
- .bd-trustpanel-card:hover {
146
- transform: translateY(-3px);
147
- box-shadow: 0px 14px 40px #00000012;
145
+ /* Only where something can hover: a tap leaves :hover on the card it
146
+ touched, so a touch screen kept the last card lifted. */
147
+ @media (hover: hover) {
148
+ .bd-trustpanel-card:hover {
149
+ transform: translateY(-3px);
150
+ /* no token: the hover lift bd-bento-item shares -- one wide, soft layer of
151
+ black at 7%. Every --shadow-* step is tighter and darker (10%, two
152
+ layers from md up), so none of them draws this; a card-hover elevation
153
+ would be a new step, decided for both cards at once. The colour is
154
+ mixed over the palette, the house pattern for a black with an alpha
155
+ (see the modal's scrim): it was #00000012, the same pixels. */
156
+ box-shadow: 0px 14px 40px color-mix(in srgb, var(--color-neutral-1000) 7%, transparent);
157
+ }
148
158
  }
149
159
 
150
160
  /* The shadow stays and the movement goes. Turning the transition off alone
@@ -76,9 +76,9 @@ Where the vocabulary ran out, the page says so rather than inventing:
76
76
  and title are carried by a bd-highlight in front of the module and the
77
77
  module's own title is left empty.
78
78
  - The hero's price comes from the store integration inside bd-header
79
- (bd-product / bd-option). Without a store context the price zones render
80
- empty; the fullPrice / discount / finalPrice attributes exist on the element
81
- and are passed, but the template reads the store, not them.
79
+ (bd-product / bd-option): live in Storybook, for \`us_i\` — Ultimate
80
+ Security, 5 devices, 1 year — and empty in the Vitest story tests, which
81
+ run without the store.
82
82
  - bd-pricing-container carries its own product content. It is the closest
83
83
  match to the reference's plan cards and switches, and it is frozen, so the
84
84
  copy is its copy.
@@ -242,7 +242,7 @@ export const Landing = {
242
242
  title="Bitdefender Ultimate Security"
243
243
  subtitle="Complete Security, Enhanced Privacy, and Identity Protection"
244
244
  description="All-in-one plan to provide personalized digital safety. Incorporates AI-powered scams & device protection, secure password management, unlimited VPN traffic & online identity protection for individuals and families."
245
- product-id="vsb"
245
+ product-id="us_i"
246
246
  devices="5"
247
247
  subscription="1"
248
248
  >
@@ -287,7 +287,7 @@ export const Landing = {
287
287
  <bd-highlight highlight-text="digital life">
288
288
  Live your digital life confidently with award-winning online protection
289
289
  </bd-highlight>
290
- <bd-pricing-container id="section-pricing"></bd-pricing-container>
290
+ <bd-pricing-container id="section-pricing" terms-href="#section-terms"></bd-pricing-container>
291
291
 
292
292
  <!-- Scam Copilot -->
293
293
  <bd-highlight id="section-scam-copilot" sub-title="Introducing Bitdefender Scam Copilot">
@@ -8,6 +8,11 @@ export const videoCSS = css`
8
8
  display: block;
9
9
  width: 100%;
10
10
  height: auto;
11
+ /* A video has no shape until its poster or its metadata arrives, so it
12
+ was laid out at the 300x150 default and jumped when either landed.
13
+ 16 / 9 holds the box until then; auto keeps the media's own ratio once
14
+ it is known. */
15
+ aspect-ratio: auto 16 / 9;
11
16
  border-radius: var(--shape-radius-lg);
12
17
  /* the frame around media, dark in every theme (dark mode decision 15) */
13
18
  background: var(--color-surface-media);
@@ -15,6 +15,9 @@ export class BdVideo extends LitElement {
15
15
  controls: { converter: { fromAttribute: value => value !== 'false' } },
16
16
  muted : { type: Boolean },
17
17
  loop : { type: Boolean },
18
+ /* What to fetch before playback: metadata by default, so the frame and the
19
+ duration are there without the file; none for a video far down a page. */
20
+ preload : { type: String },
18
21
  _media : { state: true }
19
22
  };
20
23
 
@@ -25,6 +28,7 @@ export class BdVideo extends LitElement {
25
28
  this.controls = true;
26
29
  this.muted = false;
27
30
  this.loop = false;
31
+ this.preload = 'metadata';
28
32
  this._media = [];
29
33
  }
30
34
 
@@ -66,6 +70,7 @@ export class BdVideo extends LitElement {
66
70
  ?muted=${this.muted}
67
71
  .muted=${this.muted}
68
72
  ?loop=${this.loop}
73
+ preload=${this.preload || nothing}
69
74
  playsinline
70
75
  >${this._media}</video>
71
76
  `;
@@ -28,6 +28,7 @@ export default {
28
28
  | \`controls\` | boolean, native controls | \`true\` |
29
29
  | \`muted\` | boolean | \`false\` |
30
30
  | \`loop\` | boolean | \`false\` |
31
+ | \`preload\` | \`metadata\`, \`none\`, \`auto\` | \`metadata\` |
31
32
 
32
33
  ### Captions go inside the element
33
34
  \`<track>\` and \`<source>\` children are copied into the \`<video>\` — a media
@@ -48,6 +49,11 @@ cannot turn off a default that is on. From script, \`.controls = false\`.
48
49
  \`muted\` follows the property as well as the attribute, so changing it on a
49
50
  playing video takes effect.
50
51
 
52
+ The box is 16:9 until the poster or the video's metadata arrives, then takes
53
+ the media's own shape, so a 16:9 video no longer jumps from the 300x150 a
54
+ media element is laid out at before it knows its size. \`preload="none"\`
55
+ fetches nothing before playback, for a video far down a page.
56
+
51
57
  There is no \`autoplay\` prop, deliberately — autoplay with sound is both
52
58
  disruptive and blocked by most browsers anyway.
53
59
  `
@@ -79,6 +85,12 @@ disruptive and blocked by most browsers anyway.
79
85
  control : 'boolean',
80
86
  description: 'Repeat on end.',
81
87
  table : { type: { summary: 'boolean' }, defaultValue: { summary: "false" }, category: 'Playback' }
88
+ },
89
+ preload: {
90
+ control : { type: 'select' },
91
+ options : ['metadata', 'none', 'auto'],
92
+ description: 'What to fetch before playback.',
93
+ table : { type: { summary: "'metadata' | 'none' | 'auto'" }, defaultValue: { summary: "metadata" }, category: 'Playback' }
82
94
  }
83
95
  }
84
96
  };
@@ -31,19 +31,26 @@ export default css`
31
31
  }
32
32
 
33
33
  .bd-video-play-btn {
34
+ /* Centred by inset and auto margins, so the hover can scale it without
35
+ restating a centring transform. */
34
36
  position: absolute;
35
- top: 50%;
36
- left: 50%;
37
- transform: translate(-50%, -50%);
37
+ inset: 0;
38
+ margin: auto;
38
39
  width: 64px;
39
40
  height: 64px;
40
41
  pointer-events: none;
41
- filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
42
- transition: transform var(--transition-duration-slow) var(--transition-easing-ease);
42
+ /* no token: drop-shadow() takes one shadow with no spread, and every
43
+ --shadow-* step is spelled with a spread (two layers from md up), so
44
+ none of them parses here. 30% black, not a card's 10%, because the
45
+ glyph sits on whatever frame the thumbnail shows -- mixed over the
46
+ palette like the close button's ground below, the same pixels as the
47
+ rgba it replaces. */
48
+ filter: drop-shadow(0 4px 12px color-mix(in srgb, var(--color-neutral-1000) 30%, transparent));
49
+ transition: scale var(--transition-duration-slow) var(--transition-easing-ease);
43
50
  }
44
51
 
45
52
  .bd-video-thumb:hover .bd-video-play-btn {
46
- transform: translate(-50%, -50%) scale(1.1);
53
+ scale: 1.1;
47
54
  }
48
55
 
49
56
  .bd-video-play-btn svg {
@@ -54,7 +61,7 @@ export default css`
54
61
  .bd-video-player {
55
62
  position: relative;
56
63
  width: 100%;
57
- padding-bottom: 56.25%;
64
+ aspect-ratio: 16 / 9;
58
65
  border-radius: var(--shape-radius-lg);
59
66
  overflow: hidden;
60
67
  /* The media frame, --color-surface-media: around a video, dark in every theme.
@@ -149,8 +156,13 @@ export default css`
149
156
  transform: none;
150
157
  }
151
158
 
159
+ /* scale, not transform. This used to restate a translate(-50%, -50%)
160
+ left from when the mark was centred by top/left 50%; it is centred by
161
+ inset and auto margins now, so the translate threw it up and left by
162
+ half its size on hover -- and the scale it was meant to cancel is
163
+ the individual property, which a transform does not reset. */
152
164
  .bd-video-thumb:hover .bd-video-play-btn {
153
- transform: translate(-50%, -50%);
165
+ scale: none;
154
166
  }
155
167
  }
156
168
  `;
@@ -1,4 +1,4 @@
1
- import { LitElement, html } from "lit";
1
+ import { LitElement, html, nothing } from "lit";
2
2
  // Installs the design tokens into document scope; see src/tokens/tokens.js
3
3
  import "../../tokens/tokens.js";
4
4
  import "../icons/close-icon.js";
@@ -6,26 +6,47 @@ import videoPlayerCSS from "./video-player.css.js";
6
6
 
7
7
  class BdVideoPlayer extends LitElement {
8
8
  static properties = {
9
- src : { type: String },
10
- thumb : { type: String },
11
- thumbAlt: { type: String, attribute: "thumb-alt" },
12
- _open : { state: true }
9
+ src : { type: String },
10
+ thumb : { type: String },
11
+ thumbAlt : { type: String, attribute: "thumb-alt" },
12
+ /* The embedded player's name, as a screen reader announces the iframe.
13
+ Every instance used to be titled "Video player", which says what the
14
+ frame is and nothing about which video it holds. */
15
+ videoTitle: { type: String, attribute: "video-title" },
16
+ _open : { state: true }
13
17
  };
14
18
 
15
19
  static styles = [videoPlayerCSS];
16
20
 
17
21
  constructor() {
18
22
  super();
19
- this.src = "";
20
- this.thumb = "";
21
- this.thumbAlt = "";
22
- this._open = false;
23
+ this.src = "";
24
+ this.thumb = "";
25
+ this.thumbAlt = "";
26
+ this.videoTitle = "";
27
+ this._open = false;
23
28
  }
24
29
 
25
30
  _isYoutube() {
26
31
  return this.src.includes("youtube.com") || this.src.includes("youtu.be");
27
32
  }
28
33
 
34
+ /* autoplay=1 is set on the URL's own query rather than appended to the
35
+ string. Appended, an embed URL that already had a query -- ?start=, ?list=,
36
+ or the ?autoplay=1 of the YouTube with Autoplay story -- came out as
37
+ ...?autoplay=1?autoplay=1, its second "?" read as part of the first
38
+ value. Only behind a thumbnail: the click on it is the request to play. */
39
+ get _embedSrc() {
40
+ if (!this.thumb) return this.src;
41
+ try {
42
+ const url = new URL(this.src, document.baseURI);
43
+ url.searchParams.set("autoplay", "1");
44
+ return url.href;
45
+ } catch {
46
+ return this.src;
47
+ }
48
+ }
49
+
29
50
  /**
30
51
  * Opening replaces the thumbnail button with the player, which destroys the
31
52
  * element that had focus. Measured with a real keyboard: Tab to the
@@ -47,9 +68,21 @@ class BdVideoPlayer extends LitElement {
47
68
  if (!this.thumb) return;
48
69
  this.updateComplete.then(() => {
49
70
  this.renderRoot?.querySelector(".bd-video-close")?.focus();
71
+ this._playOnOpen();
50
72
  });
51
73
  }
52
74
 
75
+ /* A direct video starts from the click on its thumbnail, with its sound.
76
+ It used to be <video autoplay> without muted, which a browser is free to
77
+ refuse -- most do for a video with sound -- and iOS played it full screen
78
+ besides. play() is called from the click's own task, which is the user
79
+ activation that lets unmuted playback start everywhere; if it is refused
80
+ anyway, the poster and the controls are still there. */
81
+ _playOnOpen() {
82
+ const video = this.renderRoot?.querySelector("video");
83
+ video?.play().catch(() => {});
84
+ }
85
+
53
86
  /**
54
87
  * Closing destroys the close button the same way, so focus returns to the
55
88
  * thumbnail it came from.
@@ -61,6 +94,34 @@ class BdVideoPlayer extends LitElement {
61
94
  });
62
95
  }
63
96
 
97
+ /* Behind a thumbnail the video is the thumbnail's click (see
98
+ _playOnOpen), so it never autoplays and keeps the thumbnail as its
99
+ poster. Without one it starts on its own, which a browser allows only
100
+ muted and inline -- and not at all under prefers-reduced-motion, where it
101
+ waits for its play button. Behind a thumbnail preload is "none": the
102
+ poster is the picture, and nothing is fetched before playback is asked
103
+ for. Without one it is "metadata", or a video held still under reduced
104
+ motion would be an empty box with controls -- no first frame, no
105
+ duration -- until it was played. muted is the property as well as the
106
+ attribute, because the attribute is only read when the element is
107
+ parsed, never when a template sets it. */
108
+ _renderVideo() {
109
+ const autoplay = !this.thumb &&
110
+ !window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
111
+ return html`
112
+ <video
113
+ src="${this.src}"
114
+ poster="${this.thumb || nothing}"
115
+ controls
116
+ playsinline
117
+ preload="${this.thumb ? "none" : "metadata"}"
118
+ ?autoplay=${autoplay}
119
+ ?muted=${autoplay}
120
+ .muted=${autoplay}
121
+ ></video>
122
+ `;
123
+ }
124
+
64
125
  render() {
65
126
  if (!this.thumb || this._open) {
66
127
  return html`
@@ -68,22 +129,15 @@ class BdVideoPlayer extends LitElement {
68
129
  ${this._isYoutube()
69
130
  ? html`
70
131
  <iframe
71
- src="${this.src}${this.thumb ? '?autoplay=1' : ''}"
72
- title="Video player"
73
- frameborder="0"
132
+ src="${this._embedSrc}"
133
+ title="${this.videoTitle || "Video player"}"
134
+ loading="lazy"
74
135
  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
75
136
  referrerpolicy="strict-origin-when-cross-origin"
76
137
  allowfullscreen
77
138
  ></iframe>
78
139
  `
79
- : html`
80
- <video
81
- src="${this.src}"
82
- autoplay
83
- controls
84
- playsinline
85
- ></video>
86
- `}
140
+ : this._renderVideo()}
87
141
  ${this.thumb
88
142
  ? html`
89
143
  <button
@@ -21,6 +21,7 @@ export default {
21
21
  src="https://www.youtube.com/embed/zal9Mt02ErM"
22
22
  thumb="/assets/tabs-img1.png"
23
23
  thumb-alt="Video preview"
24
+ video-title="Bitdefender product video"
24
25
  ></bd-video-player>
25
26
  \`\`\`
26
27
 
@@ -30,6 +31,12 @@ export default {
30
31
  | \`src\` | String | \`''\` | Video source URL (YouTube embed or direct video) |
31
32
  | \`thumb\` | String | \`''\` | Thumbnail image URL |
32
33
  | \`thumb-alt\` | String | \`''\` | Alt text for the thumbnail image |
34
+ | \`video-title\` | String | \`''\` | The embedded player's title, which names it to a screen reader. Falls back to "Video player" |
35
+
36
+ A YouTube embed loads lazily and gets \`autoplay=1\` added to its own query when
37
+ it opens from a thumbnail. A direct video opened from a thumbnail starts with its
38
+ sound from that click; without a thumbnail it autoplays muted and inline, except
39
+ under \`prefers-reduced-motion\`.
33
40
  `
34
41
  }
35
42
  }
@@ -49,6 +56,11 @@ export default {
49
56
  control : 'text',
50
57
  description: 'Alt text for the thumbnail image',
51
58
  table : { type: { summary: 'string' }, defaultValue: { summary: '' }, category: 'Content' }
59
+ },
60
+ videoTitle: {
61
+ control : 'text',
62
+ description: "The embedded player's title, which names it to a screen reader",
63
+ table : { type: { summary: 'string' }, defaultValue: { summary: '' }, category: 'Content' }
52
64
  }
53
65
  }
54
66
  };
@@ -171,9 +183,10 @@ export const DifferentThumbnails = {
171
183
  export const VideoPlayerPlayground = {
172
184
  name: '🛝 Playground',
173
185
  args: {
174
- src : 'https://www.youtube.com/embed/zal9Mt02ErM',
175
- thumb : '/assets/tabs-img1.png',
176
- thumbAlt: 'Video preview'
186
+ src : 'https://www.youtube.com/embed/zal9Mt02ErM',
187
+ thumb : '/assets/tabs-img1.png',
188
+ thumbAlt : 'Video preview',
189
+ videoTitle: 'Bitdefender product video'
177
190
  },
178
191
  render: (args) => html`
179
192
  <div style="max-width: 800px; margin: 0 auto;">
@@ -181,6 +194,7 @@ export const VideoPlayerPlayground = {
181
194
  src="${args.src}"
182
195
  thumb="${args.thumb}"
183
196
  thumb-alt="${args.thumbAlt}"
197
+ video-title="${args.videoTitle}"
184
198
  ></bd-video-player>
185
199
  </div>
186
200
  `,
@@ -213,7 +213,7 @@ export default {
213
213
  <code>themes/index.js</code>.</li>
214
214
  <li><code>npm run build:tokens</code> — writes the block into <code>tokens.css</code>; components
215
215
  pick it up at runtime from the same generator.</li>
216
- <li><code>npm run verify:brands</code> — measures every registered brand against the contrast
216
+ <li><code>npm run test:browser</code> — measures every registered brand against the contrast
217
217
  floors, and <code>npm run verify:brands:sweep</code> renders every story to find anything
218
218
  still painting the old ramp, sitting at an old corner, or leaving ink a light brand cannot
219
219
  read.</li>
@@ -19,9 +19,9 @@
19
19
  * not change keeps following Bitdefender -- including later changes to it.
20
20
  * Copying works too, but freezes the copied values where they stood.
21
21
  *
22
- * A theme may only set tokens listed in ./contract.js. `npm run verify:brands`
22
+ * A theme may only set tokens listed in ./contract.js. `npm run test:browser`
23
23
  * then measures it against the contrast floors and renders real components
24
- * under it; `verify:brands:sweep` renders every story.
24
+ * under it; `npm run verify:brands:sweep` renders every story.
25
25
  *
26
26
  * On a co-branded page the partner theme goes on the content region. The site
27
27
  * navigation is bitdefender.com's own menu, outside this package; bd-footer
@@ -250,9 +250,10 @@ function widthPer100(text, weight) {
250
250
  That 3% is the whole of the "Figma renders 3.5% wider than the browser"
251
251
  discrepancy this study recorded and then reasoned from. There is no
252
252
  renderer difference. There was a font race.
253
- scripts/verify-runtime.mjs has carried the same lesson since P1.5 -- and
254
- its own header says why it recurred: the await had been written
255
- per-investigation. This was another investigation. */
253
+ The readiness harness has carried the same lesson since P1.5 -- now
254
+ __tests__/support/render.js and story-checks.js -- and it recurred because
255
+ the await had been written per-investigation. This was another
256
+ investigation. */
256
257
  if (!document.fonts.check(PLEX_BOLD)) measuredWithoutPlex = true;
257
258
  const el = document.createElement('span');
258
259
  el.style.cssText = 'position:absolute;visibility:hidden;white-space:nowrap;'
@@ -24,4 +24,7 @@ byte for byte.
24
24
 
25
25
  Third-party for the gates: `lint:tokens` excludes `src/**/vendor/`. The colours
26
26
  in it are the illustrations' own paint, drawn into a canvas, where no token
27
- reaches.
27
+ reaches. One of them reaches past the canvas: the brand and solid tones'
28
+ ground, `#006DFF`, is also the caption and badge type and the fill of the faces
29
+ the art hides, so `src/components/motion-art/motion-art.js` swaps it for
30
+ `--color-surface-brand` without touching this file.