@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
@@ -2,6 +2,18 @@
2
2
  import "../../tokens/tokens.js";
3
3
  import { BdHero as MotionArtElement } from "../../vendor/motion-art/motion-art-element.js";
4
4
 
5
+ const BRAND_GROUND = "var(--color-surface-brand)";
6
+
7
+ /* Each palette made once per ground and then reused: the generated element
8
+ restarts its clock whenever its palette is a different object. */
9
+ const grounded = new WeakMap();
10
+ function onGround(palette, ground) {
11
+ let byGround = grounded.get(palette);
12
+ if (!byGround) grounded.set(palette, byGround = new Map());
13
+ if (!byGround.has(ground)) byGround.set(ground, { ...palette, substrate: ground });
14
+ return byGround.get(ground);
15
+ }
16
+
5
17
  /**
6
18
  * The homepage's animated illustrations, one canvas each, square:
7
19
  * brand-surface the B on a glass sphere of network (bd-hero, media slot)
@@ -14,9 +26,11 @@ import { BdHero as MotionArtElement } from "../../vendor/motion-art/motion-art-e
14
26
  * this module imports it as MotionArtElement and registers it under the
15
27
  * package's own name, because bd-hero is the homepage band.
16
28
  *
17
- * Two defaults differ from the generated element's:
29
+ * Three things differ from the generated element:
18
30
  * - no substrate: it draws on a transparent canvas, so the ground is the
19
31
  * component's own --color-surface-brand and a partner brand shows through;
32
+ * - the brand tones' ground colour is that token too, where the generated
33
+ * element paints its own blue -- see willUpdate();
20
34
  * - the pill and badge type is the foundation's sans, read from the token.
21
35
  *
22
36
  * It draws only while on screen, holds a still frame under
@@ -27,6 +41,8 @@ export class MotionArt extends MotionArtElement {
27
41
  constructor() {
28
42
  super();
29
43
  this.substrate = false;
44
+ // The generated element starts on its brand tone, so this is the blue it is drawn on.
45
+ this._generatedGround = this.palette.substrate;
30
46
  }
31
47
 
32
48
  connectedCallback() {
@@ -36,6 +52,56 @@ export class MotionArt extends MotionArtElement {
36
52
  .trim();
37
53
  if (sans) this.labelFont = sans;
38
54
  }
55
+ /* The art takes its size from its first ResizeObserver delivery, and until
56
+ then has no tile and draws nothing. That delivery comes a frame after
57
+ connect, after the generated element's own observer, which it follows
58
+ because observers deliver in the order they were created. */
59
+ this._sized = new Promise(resolve => {
60
+ this._resolveSized = resolve;
61
+ const first = new ResizeObserver(() => { first.disconnect(); resolve(); });
62
+ first.observe(this);
63
+ });
64
+ }
65
+
66
+ disconnectedCallback() {
67
+ // Removed before its first delivery: nothing is coming, so nobody waits.
68
+ this._resolveSized?.();
69
+ super.disconnectedCallback();
70
+ }
71
+
72
+ /* The brand and solid tones were drawn on that blue and paint with it
73
+ wherever the ground should show through: the caption and badge type,
74
+ knocked out of a white pill, and the faces the canvas hides behind
75
+ others. Here the ground is --color-surface-brand, so they take that,
76
+ through the custom property itself so the type follows the brand. */
77
+ willUpdate(changed) {
78
+ super.willUpdate(changed);
79
+ if (this.palette?.substrate === this._generatedGround) this.palette = onGround(this.palette, BRAND_GROUND);
80
+ }
81
+
82
+ /* A canvas takes no var(): the clock gets the colour the property resolves
83
+ to when it starts, and keeps it until the next update starts another. */
84
+ runClock() {
85
+ const palette = this.palette;
86
+ if (palette?.substrate === BRAND_GROUND) {
87
+ const ground = getComputedStyle(this).getPropertyValue("--color-surface-brand")
88
+ .trim();
89
+ this.palette = onGround(palette, ground || this._generatedGround);
90
+ }
91
+ try {
92
+ super.runClock();
93
+ } finally {
94
+ this.palette = palette;
95
+ }
96
+ }
97
+
98
+ /* updateComplete covers the sizing, so `await el.updateComplete` means the
99
+ art is drawn at its size -- the delivery sets the tile, which is one more
100
+ update. */
101
+ async getUpdateComplete() {
102
+ const first = await super.getUpdateComplete();
103
+ await this._sized;
104
+ return (await super.getUpdateComplete()) && first;
39
105
  }
40
106
  }
41
107
 
@@ -72,17 +72,16 @@ export const pageSwitcherStyles = css`
72
72
 
73
73
  The last row is the one that changed behaviour rather than value: the
74
74
  current item used to turn blue under the pointer, because
75
- .bd-link--primary:hover outweighed .bd-link--active. bd-link now declares
76
- .bd-link--active:hover and it holds.
75
+ .bd-link--primary:hover outweighed the atom's current class. bd-link now
76
+ declares a current-and-hovered rule and it holds.
77
77
 
78
78
  None of those was what this sheet declared: the host went to
79
79
  --color-action-primary-hover on hover and no text ever read it, and the
80
- semibold on .page-link.active lost to the atom's .bd-link--active bold.
80
+ semibold on the current item lost to the atom's own current bold.
81
81
  What is left here is the box -- position, padding, the indicator -- and the
82
82
  ink is asked for through the atom's API, which is where it renders. */
83
83
  .page-link {
84
84
  position: relative;
85
- text-decoration: none !important;
86
85
  display: inline-block;
87
86
  font-size: var(--typography-body-regular-fontSize);
88
87
  font-family: var(--typography-body-regular-fontFamily);
@@ -93,7 +92,7 @@ export const pageSwitcherStyles = css`
93
92
  A host's padding does not extend the anchor inside it, so this rule used
94
93
  to build a 44px-tall row around a 24px-tall target: measured 93x44 on the
95
94
  host with a 93x24 <a> inside it, and elementsFromPoint 4px below the top
96
- edge came back bd-page-switcher > bd-root > div with no <a> in the stack at
95
+ edge came back bd-page-switcher > bd-root (the former Storybook wrapper) > div with no <a> in the stack at
97
96
  all. The top and bottom 10px of every item were dead, 45% of the height a
98
97
  reader aims at.
99
98
 
@@ -130,14 +129,24 @@ export const pageSwitcherStyles = css`
130
129
  position: absolute;
131
130
  left: var(--spacing-0);
132
131
  bottom: calc(-1 * var(--spacing-16));
133
- width: 0%;
132
+ /* Grown with scale from the inline start, not with width -- see
133
+ bd-tab-list's underline, the same line. */
134
+ width: 100%;
135
+ scale: 0 1;
136
+ transform-origin: left center;
134
137
  height: var(--indicator-underline-height);
135
138
  background-color: var(--indicator-color);
136
- transition: width var(--indicator-underline-duration) var(--indicator-underline-easing);
139
+ transition: scale var(--indicator-underline-duration) var(--indicator-underline-easing);
137
140
  }
138
141
 
139
- .page-link.active::after {
140
- width: 100%;
142
+ .page-link:dir(rtl)::after {
143
+ transform-origin: right center;
144
+ }
145
+
146
+ /* [current] is the bd-link attribute that becomes aria-current on its <a>,
147
+ so the indicator and the announcement are one state. */
148
+ .page-link[current]::after {
149
+ scale: 1;
141
150
  }
142
151
 
143
152
  /* No .page-link:focus-visible rule. .page-link is the class this component
@@ -154,4 +163,13 @@ export const pageSwitcherStyles = css`
154
163
  transition: none !important;
155
164
  }
156
165
  }
166
+
167
+ /* The indicator is a background, which forced colours repaint as Canvas;
168
+ it opts out and draws in Highlight, as bd-tab-list's does. */
169
+ @media (forced-colors: active) {
170
+ .page-link::after {
171
+ forced-color-adjust: none;
172
+ background-color: Highlight;
173
+ }
174
+ }
157
175
  `;
@@ -14,19 +14,23 @@ import { ensembleCSS } from "../shared/ensemble.css.js";
14
14
  * The ink is Position 2 of the wayfinding family review: colour means
15
15
  * AVAILABLE and neutral means current. Every item is variant="primary", so a
16
16
  * resting item is --color-text-brand and hovers to --color-action-primary-active;
17
- * the current one carries `active`, which drops it to --color-text-primary at
18
- * weight 700 and takes the 3px indicator. bd-link's new .bd-link--active:hover
17
+ * the current one carries `current`, which drops it to --color-text-primary at
18
+ * weight 700 and takes the 3px indicator. bd-link's current-and-hovered rule
19
19
  * keeps it there under the pointer.
20
20
  *
21
21
  * The variant is no longer switched per item. It used to be primary for the
22
22
  * current one and secondary for the rest, which made the current item the only
23
23
  * blue one -- the inverse of what the indicator says -- and left the resting
24
- * items on the muted ramp. One variant plus `active` is the same information
24
+ * items on the muted ramp. One variant plus `current` is the same information
25
25
  * with one fewer thing to keep in step.
26
26
  *
27
- * `aria-current` is `page`, not the generic `true`. These items are pages; the
27
+ * `current` is `page`, not the generic `true`. These items are pages; the
28
28
  * anchor nav's items are positions inside one page and say `location`. Both are
29
- * current-location markers and they are not the same claim.
29
+ * current-location markers and they are not the same claim. bd-link puts it on
30
+ * its <a> as aria-current; written here as aria-current, on the bd-link
31
+ * element, it was never announced -- the <a> is in bd-link's shadow root. The
32
+ * look, the indicator below included, keys on the same attribute, so the item
33
+ * cannot be drawn current without being announced so.
30
34
  */
31
35
  class BdPageSwitcher extends LitElement {
32
36
  static properties = {
@@ -51,9 +55,8 @@ class BdPageSwitcher extends LitElement {
51
55
  href=${href}
52
56
  variant="primary"
53
57
  no-underline
54
- ?active=${active}
55
- aria-current=${active ? "page" : nothing}
56
- class="page-link ${active ? "active" : ""}"
58
+ current=${active ? "page" : nothing}
59
+ class="page-link"
57
60
  >${title || nothing}</bd-link>
58
61
  `)}
59
62
  </nav>
@@ -142,6 +142,8 @@ export const partnerBannerCSS = css`
142
142
  color-mix(in srgb, var(--color-surface-brand) 5%, transparent) 0%,
143
143
  var(--color-surface-brand) 35%
144
144
  );
145
+ /* Safari before 18 knows the blur only by its prefixed name */
146
+ -webkit-backdrop-filter: blur(29px);
145
147
  backdrop-filter: blur(29px);
146
148
  }
147
149
 
@@ -158,10 +158,10 @@ export default css`
158
158
  transform: scale(1);
159
159
  }
160
160
 
161
- /* Performance optimizations */
162
- .bd-picture img {
163
- will-change: transform, opacity;
164
- }
161
+ /* No will-change. It stood here on every image, at rest as well as
162
+ during the fade, which keeps a compositor layer per image for the life
163
+ of the page to speed up one transition that runs once. The browser
164
+ promotes an element for the length of a transition on its own. */
165
165
 
166
166
  /* Two @container queries used to sit here, for .mobile-full and
167
167
  .tablet-optimized. Neither could ever match: a container query needs an
@@ -32,6 +32,8 @@ export class BdPicture extends LitElement {
32
32
  width : { type: Number },
33
33
  height : { type: Number },
34
34
  loading : { type: String },
35
+ fetchPriority : { type: String, attribute: "fetchpriority" },
36
+ decoding : { type: String },
35
37
  fit : { type: String },
36
38
  radius : { type: String },
37
39
  referrerPolicy: { type: String, attribute: "referrer-policy" }
@@ -45,6 +47,8 @@ export class BdPicture extends LitElement {
45
47
  this.width = null;
46
48
  this.height = null;
47
49
  this.loading = "lazy";
50
+ this.fetchPriority = "";
51
+ this.decoding = "";
48
52
  this.fit = "cover";
49
53
  this.radius = "none";
50
54
  this.referrerPolicy = "";
@@ -58,6 +62,10 @@ export class BdPicture extends LitElement {
58
62
  `fit-${FITS.includes(this.fit) ? this.fit : 'cover'}`,
59
63
  `radius-${RADIUS_STEPS.includes(this.radius) ? this.radius : 'none'}`
60
64
  ].filter(Boolean).join(' ');
65
+ /* Never lazy at fetchpriority="high", as in bd-img. That also skips the
66
+ fade in picture.css.js, which is keyed on loading="lazy": an LCP image
67
+ held at opacity 0 until its load event is an LCP held back with it. */
68
+ const lcp = this.fetchPriority === 'high';
61
69
 
62
70
  // Each source's optional attributes are left off when not given. type
63
71
  // used to be written as-is, so a source without one rendered
@@ -73,9 +81,11 @@ export class BdPicture extends LitElement {
73
81
  sizes="${source.sizes || nothing}"
74
82
  >
75
83
  `)}
76
- <img
77
- loading="${this.loading}"
78
- alt="${this.alt}"
84
+ <img
85
+ loading="${lcp ? nothing : this.loading}"
86
+ fetchpriority="${this.fetchPriority || nothing}"
87
+ decoding="${this.decoding || nothing}"
88
+ alt="${this.alt}"
79
89
  src="${this.fallbackSrc}"
80
90
  width="${this.width ?? nothing}"
81
91
  height="${this.height ?? nothing}"
@@ -1,4 +1,4 @@
1
- import { html } from 'lit';
1
+ import { html, nothing } from 'lit';
2
2
  import './picture.js';
3
3
 
4
4
  export default {
@@ -27,6 +27,10 @@ export default {
27
27
  ></bd-picture>
28
28
  \`\`\`
29
29
 
30
+ An image the page is waiting for -- a hero, its Largest Contentful Paint --
31
+ takes \`fetchpriority="high"\`: it is never lazy then, and it skips the fade-in,
32
+ which would hold it at opacity 0 until its load event.
33
+
30
34
  ### Sources Array
31
35
  Each source object supports:
32
36
  - \`type\` — MIME type (e.g. \`"image/webp"\`)
@@ -75,6 +79,18 @@ Each source object supports:
75
79
  description: 'Native browser loading strategy',
76
80
  table : { type: { summary: "'lazy'|'eager'" }, defaultValue: { summary: 'lazy' }, category: 'Performance' }
77
81
  },
82
+ fetchpriority: {
83
+ control : { type: 'select' },
84
+ options : [undefined, 'high', 'low'],
85
+ description: '`high` for the image the page is waiting for (its Largest Contentful Paint) -- never lazy then; `low` for one that is above the fold but hidden at first. Leave it unset otherwise.',
86
+ table : { type: { summary: "'high' | 'low'" }, defaultValue: { summary: 'unset' }, category: 'Performance' }
87
+ },
88
+ decoding: {
89
+ control : { type: 'select' },
90
+ options : [undefined, 'async', 'sync'],
91
+ description: 'Decoding hint for the browser',
92
+ table : { type: { summary: "'async' | 'sync' | 'auto'" }, defaultValue: { summary: 'unset' }, category: 'Performance' }
93
+ },
78
94
  fit: {
79
95
  control : { type: 'select' },
80
96
  options : ['cover', 'contain', 'fill', 'none', 'scale-down'],
@@ -90,7 +106,7 @@ Each source object supports:
90
106
  }
91
107
  };
92
108
 
93
- const placeholder = 'https://via.placeholder.com/800x450';
109
+ const placeholder = '/assets/bd-header-img.jpg';
94
110
 
95
111
  const defaultSources = [
96
112
  { type: 'image/webp', srcset: placeholder + '?format=webp', media: '(min-width: 600px)' },
@@ -110,6 +126,8 @@ const render = (args) => html`
110
126
  width="${args.width}"
111
127
  height="${args.height}"
112
128
  loading="${args.loading}"
129
+ fetchpriority="${args.fetchpriority || nothing}"
130
+ decoding="${args.decoding || nothing}"
113
131
  fit="${args.fit}"
114
132
  radius="${args.radius}"
115
133
  .sources="${args.sources}"
@@ -198,6 +216,14 @@ export const LazyVsEager = {
198
216
  parameters: { docs: { description: { story: 'Comparison of `loading="lazy"` and `loading="eager"` side by side.' } } }
199
217
  };
200
218
 
219
+ export const HighPriority = {
220
+ name : 'High Priority (LCP)',
221
+ render: () => html`
222
+ <bd-picture fallback-src="${placeholder}" alt="Product image" width="800" height="450" fetchpriority="high" .sources="${[]}"></bd-picture>
223
+ `,
224
+ parameters: { docs: { description: { story: '`fetchpriority="high"` -- never lazy, and no fade: the image paints as it arrives, which is when the page counts it as painted.' } } }
225
+ };
226
+
201
227
  export const Playground = {
202
228
  name : '🛝 Playground',
203
229
  args : { ...defaultArgs },
@@ -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
  /* A post card on the page ground beside two others, where the design draws
5
6
  an edge: surface/default with a border/container edge, at the card corner.
6
7
  The cover runs to the card's edges and the copy takes the compact inset. */
7
8
  export const postCardCSS = 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
  position: relative;
15
24
  box-sizing: border-box;
@@ -113,8 +122,14 @@ export const postCardCSS = css`
113
122
  color: var(--color-text-brand);
114
123
  }
115
124
 
116
- /* The tablet row: the cover on the left. */
117
- @media ${unsafeCSS(above("md"))} and ${unsafeCSS(below("lg"))} {
125
+ /* The tablet row, the cover on the left, wherever the card is wide enough
126
+ for it -- not wherever the screen is. It used to follow the viewport
127
+ from md to lg, which put a card in a two- or three-column grid at tablet
128
+ width into a row it had no room for (a 384 card: a 154 cover beside
129
+ 230 of copy), and a lone card on a desktop page under a full-width
130
+ cover. A card in a three-up grid is at most 415 wide; one alone in the
131
+ tablet column is 656. */
132
+ @container ${unsafeCSS(above("sm"))} {
118
133
  .card {
119
134
  flex-direction: row;
120
135
  }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The pricing elements that render into light DOM -- so a crawler reading the
3
+ * page, and the store filling it, find the prices in the document -- used to
4
+ * put a <style> copy of their stylesheet inside every card they rendered. The
5
+ * sheet now goes to the tree the element sits in once, adopted by its root:
6
+ * the document, or the shadow root of the section that renders the card. A
7
+ * card inside bd-pricing-container finds the sheet already there.
8
+ */
9
+ export function adoptStyles(host, ...sheets) {
10
+ const root = host.getRootNode();
11
+ if (!("adoptedStyleSheets" in root)) return;
12
+ const missing = sheets
13
+ .map(sheet => sheet.styleSheet)
14
+ .filter(sheet => sheet && !root.adoptedStyleSheets.includes(sheet));
15
+ if (missing.length) root.adoptedStyleSheets = [...root.adoptedStyleSheets, ...missing];
16
+ }
@@ -21,12 +21,10 @@ class PricingCard extends LitElement {
21
21
  this.shadow = true;
22
22
  }
23
23
 
24
+ static styles = [newPricingCSS];
25
+
24
26
  render() {
25
27
  return html`
26
- <style>
27
- ${newPricingCSS}
28
- </style>
29
-
30
28
  <div class="card-wrapper">
31
29
  ${this.highlight
32
30
  ? html`<div class="highlight-banner">Best Value</div>`
@@ -62,10 +62,8 @@ export default {
62
62
  const PricingCardTemplate = (args) => html`
63
63
  <new-pricing-card
64
64
  ?highlight="${args.highlight}"
65
- product-id="${args.productId}"
66
65
  devices="${args.devices}"
67
66
  subscription="${args.subscription}"
68
- data-layer-event="${args.dataLayerEvent}"
69
67
  >
70
68
  <pricing-card-header
71
69
  slot="header"
@@ -79,7 +77,7 @@ const PricingCardTemplate = (args) => html`
79
77
  product-id="${args.productId}"
80
78
  devices="${args.devices}"
81
79
  subscription="${args.subscription}"
82
- data-layer-event="${args.dataLayerEvent}"
80
+ .dataLayerEvent="${args.dataLayerEvent}"
83
81
  ></pricing-card-pricing>
84
82
 
85
83
  <pricing-card-actions
@@ -87,7 +85,7 @@ const PricingCardTemplate = (args) => html`
87
85
  product-id="${args.productId}"
88
86
  devices="${args.devices}"
89
87
  subscription="${args.subscription}"
90
- data-layer-event="${args.dataLayerEvent}"
88
+ .dataLayerEvent="${args.dataLayerEvent}"
91
89
  ></pricing-card-actions>
92
90
 
93
91
  <pricing-card-show-more slot="features">
@@ -106,7 +104,7 @@ VSBCard.args = {
106
104
  devices : '5',
107
105
  subscription : '1',
108
106
  dataLayerEvent: 'info',
109
- title : 'Bitdefender Total Security',
107
+ title : 'Bitdefender Ultimate Small Business Security',
110
108
  subtitle : '1 account – 5 devices',
111
109
  badges : 'Premium',
112
110
  features : [
@@ -123,7 +121,7 @@ VSBCard.args = {
123
121
  VSBCard.parameters = {
124
122
  docs: {
125
123
  description: {
126
- story: 'Premium security card with product ID "vsb" (Bitdefender Total Security). Includes all advanced features.'
124
+ story: 'Premium card with product ID "vsb" (Bitdefender Ultimate Small Business Security). Includes all advanced features.'
127
125
  }
128
126
  }
129
127
  };
@@ -134,7 +132,7 @@ TSI_Card.args = {
134
132
  devices : '5',
135
133
  subscription : '1',
136
134
  dataLayerEvent: 'info',
137
- title : 'Bitdefender Internet Security',
135
+ title : 'Bitdefender Total Security',
138
136
  subtitle : '1 account – 5 devices',
139
137
  badges : 'Most Popular',
140
138
  features : [
@@ -151,7 +149,7 @@ TSI_Card.args = {
151
149
  TSI_Card.parameters = {
152
150
  docs: {
153
151
  description: {
154
- story: 'Internet Security card with product ID "ts_i". Balanced protection for everyday use.'
152
+ story: 'Total Security card with product ID "ts_i". Balanced protection for everyday use.'
155
153
  }
156
154
  }
157
155
  };
@@ -162,9 +160,9 @@ PSI_Card.args = {
162
160
  devices : '5',
163
161
  subscription : '1',
164
162
  dataLayerEvent: 'info',
165
- title : 'Bitdefender Antivirus Plus',
166
- subtitle : 'Basic protection for your devices',
167
- badges : '1 account – 5 devices',
163
+ title : 'Bitdefender Premium Security',
164
+ subtitle : '1 account – 5 devices',
165
+ badges : 'Privacy',
168
166
  features : [
169
167
  'Antivirus protection',
170
168
  'Real-time scanning',
@@ -178,7 +176,7 @@ PSI_Card.args = {
178
176
  PSI_Card.parameters = {
179
177
  docs: {
180
178
  description: {
181
- story: 'Basic antivirus card with product ID "ps_i". Lightweight protection for fewer devices.'
179
+ story: 'Premium Security card with product ID "ps_i".'
182
180
  }
183
181
  }
184
182
  };
@@ -275,9 +273,9 @@ export const ThreeProductGrid = () => html`
275
273
  <h2 style="text-align: center; margin-bottom: 30px; color: #212529;">Compare Security Plans</h2>
276
274
 
277
275
  <pricing-cards-container count="3">
278
- <!-- Card 1: PSI - Basic -->
276
+ <!-- Card 1: Antivirus Plus - Basic -->
279
277
  ${PricingCardTemplate({
280
- productId : 'ps_i',
278
+ productId : 'av',
281
279
  devices : '5',
282
280
  subscription : '1',
283
281
  dataLayerEvent: 'info',
@@ -294,14 +292,14 @@ export const ThreeProductGrid = () => html`
294
292
  shadow : true
295
293
  })}
296
294
 
297
- <!-- Card 2: TSI - Standard (Highlighted) -->
295
+ <!-- Card 2: Internet Security - Standard (Highlighted) -->
298
296
  ${PricingCardTemplate({
299
- productId : 'ts_i',
300
- devices : '5',
297
+ productId : 'is',
298
+ devices : '3',
301
299
  subscription : '1',
302
300
  dataLayerEvent: 'info',
303
301
  title : 'Bitdefender Internet Security',
304
- subtitle : '1 account – 5 devices',
302
+ subtitle : '1 account – 3 devices',
305
303
  badges : 'Most Popular',
306
304
  features : [
307
305
  'All Antivirus Plus features',
@@ -315,10 +313,10 @@ export const ThreeProductGrid = () => html`
315
313
  shadow : true
316
314
  })}
317
315
 
318
- <!-- Card 3: VSB - Premium -->
316
+ <!-- Card 3: Total Security - Premium -->
319
317
  ${PricingCardTemplate({
320
- productId : 'vsb',
321
- devices : '10',
318
+ productId : 'ts_i',
319
+ devices : '5',
322
320
  subscription : '1',
323
321
  dataLayerEvent: 'info',
324
322
  title : 'Bitdefender Total Security',
@@ -346,7 +344,7 @@ export const ThreeProductGrid = () => html`
346
344
  ThreeProductGrid.parameters = {
347
345
  docs: {
348
346
  description: {
349
- story: 'Grid comparing three different security products: Basic (ps_i), Standard (ts_i), and Premium (vsb). Each card has independent store integration.'
347
+ story: 'Grid comparing three different security products: Basic (av, Antivirus Plus), Standard (is, Internet Security), and Premium (ts_i, Total Security). Each card has independent store integration.'
350
348
  }
351
349
  }
352
350
  };
@@ -1,16 +1,12 @@
1
1
  import { css } from "lit";
2
2
 
3
+ /* Adopted by the document (or the shadow root the card sits in), so each
4
+ selector starts at the element; see pricing-card-pricing.css.js. */
3
5
  export default css`
4
- .actions {
5
- display: flex;
6
- flex-direction: column;
7
- gap: 0.5rem;
8
- margin-top: 1rem;
9
- }
10
-
11
- .hr-line {
12
- border: none;
13
- border-top: 1px solid var(--color-border-subtle);
14
- margin: 1.5rem 0;
15
- }
6
+ pricing-card-actions .actions {
7
+ display: flex;
8
+ flex-direction: column;
9
+ gap: 0.5rem;
10
+ margin-top: 1rem;
11
+ }
16
12
  `;
@@ -1,8 +1,9 @@
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 "../button/button.js";
5
5
  import newPricingActionsCSS from "../pricing-cards/pricing-card-actions.css.js";
6
+ import { adoptStyles } from "./adopt-styles.js";
6
7
 
7
8
  class PricingCardActions extends LitElement {
8
9
  static properties = {
@@ -24,23 +25,35 @@ class PricingCardActions extends LitElement {
24
25
  return this;
25
26
  }
26
27
 
28
+ connectedCallback() {
29
+ super.connectedCallback();
30
+ adoptStyles(this, newPricingActionsCSS);
31
+ }
32
+
33
+ /* Every card's button reads "Buy Now", so a page's list of links held one
34
+ name three times. The card's product follows the visible words in the
35
+ accessible name, which keeps those words first (WCAG 2.5.3). The title is
36
+ the header's, read from the card this sits in. */
37
+ get _label() {
38
+ const title = this.closest("new-pricing-card")
39
+ ?.querySelector("pricing-card-header")
40
+ ?.getAttribute("title");
41
+ return title ? `Buy Now, ${title}` : nothing;
42
+ }
43
+
27
44
  render() {
28
45
  return html`
29
- <style>
30
- ${newPricingActionsCSS}
31
- </style>
32
-
33
46
  <bd-context ignore-events-parent>
34
47
  <!-- AICI TREBUIE product-id CU CRATIMĂ! -->
35
- <bd-product product-id="${this.productId}">
36
- <bd-option
37
- devices="${this.devices}"
38
- subscription="${this.subscription}"
48
+ <bd-product product-id="${this.productId}">
49
+ <bd-option
50
+ devices="${this.devices}"
51
+ subscription="${this.subscription}"
39
52
  data-layer-event="${this.dataLayerEvent}">
40
-
53
+
41
54
  <div class="actions">
42
55
  <bd-button-link
43
- label="Buy now"
56
+ label=${this._label}
44
57
  variant="accent"
45
58
  fullwidth
46
59
  buyLink
@@ -48,7 +61,7 @@ class PricingCardActions extends LitElement {
48
61
  Buy Now
49
62
  </bd-button-link>
50
63
  </div>
51
-
64
+
52
65
  </bd-option>
53
66
  </bd-product>
54
67
  </bd-context>
@@ -56,4 +69,4 @@ class PricingCardActions extends LitElement {
56
69
  }
57
70
  }
58
71
 
59
- customElements.define("pricing-card-actions", PricingCardActions);
72
+ customElements.define("pricing-card-actions", PricingCardActions);