@repobit/dex-system-design 2.6.0 → 2.7.1

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,20 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.7.1](https://github.com/bitdefender/dex-core/compare/@repobit/dex-system-design@2.7.0...@repobit/dex-system-design@2.7.1) (2026-10-29)
7
+
8
+ ### Bug Fixes
9
+
10
+ * **DEX-29014:** bd-tabs copies follow their panels
11
+
12
+
13
+ ## [2.7.0](https://github.com/bitdefender/dex-core/compare/@repobit/dex-system-design@2.6.0...@repobit/dex-system-design@2.7.0) (2026-10-29)
14
+
15
+ ### Features
16
+
17
+ * **DEX-29014:** bd-grid steps with the screen again; min-col-width for collections
18
+
19
+
6
20
  ## [2.6.0](https://github.com/bitdefender/dex-core/compare/@repobit/dex-system-design@2.5.1...@repobit/dex-system-design@2.6.0) (2026-10-29)
7
21
 
8
22
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@repobit/dex-system-design",
3
- "version": "2.6.0",
3
+ "version": "2.7.1",
4
4
  "description": "Design system based on Web Components.",
5
5
  "author": "Iordache Matei Cezar <miordache@bitdefender.com>",
6
6
  "homepage": "https://github.com/bitdefender/dex-core#readme",
@@ -180,5 +180,5 @@
180
180
  "volta": {
181
181
  "node": "24.22.1"
182
182
  },
183
- "gitHead": "5ecc0d0c37a690c24001288eee166470a271e815"
183
+ "gitHead": "d1a11b82de2a73a18c8b52705f5b64cafef64e58"
184
184
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifestVersion": 1,
3
3
  "package": "@repobit/dex-system-design",
4
- "packageVersion": "2.6.0",
4
+ "packageVersion": "2.7.1",
5
5
  "generatedFrom": [
6
6
  "package.json exports",
7
7
  "Lit static properties",
@@ -1892,6 +1892,13 @@
1892
1892
  "4xl",
1893
1893
  "5xl"
1894
1894
  ]
1895
+ },
1896
+ {
1897
+ "name": "minColWidth",
1898
+ "type": "number",
1899
+ "attributeName": "min-col-width",
1900
+ "default": 0,
1901
+ "description": "The narrowest a column may be, in px at the default text size (laid out in rem, so it grows with the reader's text). Set, each step's cols is the most columns there will be, and the grid takes fewer where that many would not fit. Unset (0), cols is the count."
1895
1902
  }
1896
1903
  ],
1897
1904
  "notes": [
@@ -151,16 +151,6 @@ padding-bottom: var(--spacing-12);
151
151
  gap: var(--spacing-32);
152
152
  }
153
153
 
154
- /* bd-grid is a size container, and a container cannot take its width from
155
- its content. These groups hug theirs in a flex row, so the grid steps
156
- with the screen, as it did before it read its own width: without this
157
- it filled the row and spread the groups across it (the second group at
158
- x 608 rather than 316 at 1440). */
159
- .footer-links-left bd-grid {
160
- --bd-grid-container-type: normal;
161
- --bd-grid-width: auto;
162
- }
163
-
164
154
  .footer-links-right {
165
155
  display: flex;
166
156
  align-items: center;
@@ -1,102 +1,79 @@
1
1
  import { css, unsafeCSS } from "lit";
2
2
  import { above } from "../shared/token-scales.js";
3
- import { hostFillsWidth } from "../shared/fill-width.css.js";
4
3
 
5
- /* The column steps follow the grid's own width, not the screen's. A grid is
6
- what a component is laid out on, and it is as often in a half column, a
7
- card or a tab as across the page; a 3-column step taken at a 992 screen
8
- gave a 360 column 104px cells.
4
+ /* The column steps follow the screen: cols, then cols-sm, cols-md and
5
+ cols-lg from 576, 768 and 992 -- the sm, md and lg every other breakpoint
6
+ in this package means. A grid's steps are a page's structure, and that is
7
+ a question about the screen; it can answer differently at the same width
8
+ in two places -- a 492 grid across a 600 screen and a 518 one beside the
9
+ stat highlight at 1280 hold different layouts on the homepage.
9
10
 
10
- The widths it steps at are the page column's at sm, md and lg -- 492, 656
11
- and 880, --grid-container-max-* less twice --grid-padding-* -- so a grid
12
- as wide as the page column steps exactly where it did when it read the
13
- screen (at 768 and 992; at 524 rather than 576 for sm, because the xs
14
- column runs wider than the sm one), and a grid in anything narrower steps
15
- later. One of the four always applies, so nothing the screen-width rules
16
- below say survives in a grid that is a container.
11
+ 2.6.0 stepped by the grid's own width instead, at the page column's widths
12
+ (492, 656, 880). A grid as wide as the page stepped where it always had; a
13
+ narrower one never reached its upper steps, so the homepage's stat tiles,
14
+ two across beside the highlight since they were drawn, stacked one a row
15
+ on every desktop, and bd-footer opted its grid out to keep its layout.
16
+ Nothing that was measured gained from it, so the steps read the screen
17
+ again.
17
18
 
18
- The grid fills its column, less its own margins (shared/fill-width.css.js),
19
- because a size container contributes nothing to its own intrinsic width:
20
- in a parent that sizes it to its content (a flex row, a grid with
21
- justify-items: start -- this one's own default) it would measure 0. A page
22
- that wants that, a grid hugging its content, sets
23
- --bd-grid-container-type: normal and --bd-grid-width: auto on it, and the
24
- grid steps with the screen, as it always did. */
19
+ What reading its own width was for -- a 3-column step taken at a 992
20
+ screen gave a 360 column 104px cells -- is min-col-width's: each step's
21
+ count becomes the most columns there will be, and a column is never
22
+ narrower than min-col-width, so a grid in a narrow column takes fewer,
23
+ wider ones, wherever it is laid out. It asks the cells, which is the
24
+ question a collection has, where the page's widths could only be answered
25
+ by a grid as wide as the page. */
25
26
  export default css`
26
- :host {
27
+ :host {
27
28
  display: block;
28
- container-name: bd-grid;
29
- container-type: var(--bd-grid-container-type, inline-size);
30
- box-sizing: border-box;
31
29
  }
32
30
 
33
- ${hostFillsWidth("--bd-grid-width")}
34
-
31
+ /* Each step below says only which columns and which gap apply; they are
32
+ laid out here, once, so that min-col-width reads the same two. */
35
33
  .grid {
36
34
  display: grid;
37
- gap: var(--spacing-24);
38
35
  align-items: stretch;
39
36
  justify-items: start;
37
+ --grid-cols-active: var(--grid-cols);
38
+ --grid-gap-active: var(--grid-gap, var(--spacing-24));
39
+ grid-template-columns: repeat(var(--grid-cols-active), 1fr);
40
+ gap: var(--grid-gap-active);
40
41
  }
41
42
 
42
- /* Default */
43
- .grid {
44
- grid-template-columns: repeat(var(--grid-cols), 1fr);
45
- gap: var(--grid-gap, var(--spacing-24));
46
- }
47
-
48
- /* Responsive overrides: the columns and the gap step together; a gap
49
- left unset carries the one below it up.
50
-
51
- By the screen: only where the page has opted the grid out of being a
52
- container, since the container rules after these always win. */
43
+ /* The columns and the gap step together; a gap left unset carries the
44
+ one below it up. */
53
45
  @media ${unsafeCSS(above('sm'))} {
54
46
  .grid {
55
- grid-template-columns: repeat(var(--grid-cols-sm), 1fr);
56
- gap: var(--grid-gap-sm, var(--spacing-24));
47
+ --grid-cols-active: var(--grid-cols-sm);
48
+ --grid-gap-active: var(--grid-gap-sm, var(--spacing-24));
57
49
  }
58
50
  }
59
51
 
60
52
  @media ${unsafeCSS(above('md'))} {
61
53
  .grid {
62
- grid-template-columns: repeat(var(--grid-cols-md), 1fr);
63
- gap: var(--grid-gap-md, var(--spacing-24));
54
+ --grid-cols-active: var(--grid-cols-md);
55
+ --grid-gap-active: var(--grid-gap-md, var(--spacing-24));
64
56
  }
65
57
  }
66
58
 
67
59
  @media ${unsafeCSS(above('lg'))} {
68
60
  .grid {
69
- grid-template-columns: repeat(var(--grid-cols-lg), 1fr);
70
- gap: var(--grid-gap-lg, var(--spacing-24));
61
+ --grid-cols-active: var(--grid-cols-lg);
62
+ --grid-gap-active: var(--grid-gap-lg, var(--spacing-24));
71
63
  }
72
64
  }
73
65
 
74
- /* By the grid's own width. */
75
- @container bd-grid (width < 492px) {
76
- .grid {
77
- grid-template-columns: repeat(var(--grid-cols), 1fr);
78
- gap: var(--grid-gap, var(--spacing-24));
79
- }
80
- }
81
-
82
- @container bd-grid (492px <= width < 656px) {
83
- .grid {
84
- grid-template-columns: repeat(var(--grid-cols-sm), 1fr);
85
- gap: var(--grid-gap-sm, var(--spacing-24));
86
- }
87
- }
88
-
89
- @container bd-grid (656px <= width < 880px) {
90
- .grid {
91
- grid-template-columns: repeat(var(--grid-cols-md), 1fr);
92
- gap: var(--grid-gap-md, var(--spacing-24));
93
- }
94
- }
95
-
96
- @container bd-grid (width >= 880px) {
97
- .grid {
98
- grid-template-columns: repeat(var(--grid-cols-lg), 1fr);
99
- gap: var(--grid-gap-lg, var(--spacing-24));
100
- }
66
+ /* min-col-width: as many columns as fit at min-col-width, up to the
67
+ step's count. auto-fill takes as many as fit; the second term of max()
68
+ is what holds it to the count -- a column at least the grid less the
69
+ count's gaps, over the count, leaves no room for one more, with a gap
70
+ to spare so rounding cannot drop one either; and min(100%, ...) keeps
71
+ one column inside a grid narrower than the floor. The columns then
72
+ share what is left, as 1fr always has. */
73
+ .grid.grid--fit {
74
+ grid-template-columns: repeat(auto-fill, minmax(min(100%, max(
75
+ var(--grid-min-col-width),
76
+ (100% - var(--grid-cols-active) * var(--grid-gap-active)) / var(--grid-cols-active)
77
+ )), 1fr));
101
78
  }
102
79
  `;
@@ -46,18 +46,23 @@ class BdGrid extends LitElement {
46
46
  the ones that were already there, and this adds no smartness to a layout
47
47
  primitive -- it only lets the primitive hear what it is told. */
48
48
  static properties = {
49
- cols : { type: Number }, // default cols
50
- colsSm : { type: Number, attribute: "cols-sm" }, // optional cols on small screens
51
- colsMd : { type: Number, attribute: "cols-md" }, // optional cols on medium
52
- colsLg : { type: Number, attribute: "cols-lg" }, // optional cols on large
53
- gap : { type: String }, // e.g., 'sm', 'md'
54
- gapSm : { type: String, attribute: "gap-sm" }, // optional gap from sm; unset keeps the step below
55
- gapMd : { type: String, attribute: "gap-md" }, // optional gap from md
56
- gapLg : { type: String, attribute: "gap-lg" }, // optional gap from lg
57
- align : { type: String }, // start, center, end, stretch
58
- justify: { type: String }, // start, center, end, space-between
59
- padding: { type: String } // e.g., 'none', 'sm', 'md', 'lg'
60
-
49
+ cols : { type: Number }, // default cols
50
+ colsSm : { type: Number, attribute: "cols-sm" }, // optional cols on small screens
51
+ colsMd : { type: Number, attribute: "cols-md" }, // optional cols on medium
52
+ colsLg : { type: Number, attribute: "cols-lg" }, // optional cols on large
53
+ gap : { type: String }, // e.g., 'sm', 'md'
54
+ gapSm : { type: String, attribute: "gap-sm" }, // optional gap from sm; unset keeps the step below
55
+ gapMd : { type: String, attribute: "gap-md" }, // optional gap from md
56
+ gapLg : { type: String, attribute: "gap-lg" }, // optional gap from lg
57
+ align : { type: String }, // start, center, end, stretch
58
+ justify : { type: String }, // start, center, end, space-between
59
+ padding : { type: String }, // e.g., 'none', 'sm', 'md', 'lg'
60
+ /* The narrowest a column may be. Unset, each step's count is the
61
+ columns there are; set, it is the most there will be, and the grid
62
+ takes fewer, wider ones where that many would not fit (grid.css.js).
63
+ A number of px at the default text size, laid out in rem: a cell holds
64
+ text, so its floor grows with the reader's text, as the gaps do. */
65
+ minColWidth: { type: Number, attribute: "min-col-width" }
61
66
  };
62
67
 
63
68
  constructor() {
@@ -73,14 +78,14 @@ class BdGrid extends LitElement {
73
78
  this.align = "stretch";
74
79
  this.justify = "start";
75
80
  this.padding = "none";
76
-
81
+ this.minColWidth = 0;
77
82
  }
78
83
 
79
84
 
80
85
  render() {
81
86
  return html`
82
87
  <div
83
- class="grid"
88
+ class="grid ${this.minColWidth > 0 ? "grid--fit" : ""}"
84
89
  style="
85
90
  --grid-cols: ${this.cols};
86
91
  --grid-cols-sm: ${this.colsSm};
@@ -93,7 +98,7 @@ class BdGrid extends LitElement {
93
98
  align-items: ${this.align};
94
99
  justify-items: ${this.justify};
95
100
  padding: ${space(this.padding)};
96
-
101
+ ${this.minColWidth > 0 ? `--grid-min-col-width: ${this.minColWidth / 16}rem;` : ""}
97
102
  "
98
103
  >
99
104
  <slot></slot>
@@ -20,23 +20,31 @@ Columns are set per breakpoint and the component steps between them on its own:
20
20
  The gap steps the same way: \`gap\` below 576, then \`gap-sm\`, \`gap-md\` and
21
21
  \`gap-lg\`, each one left out keeping the step below it.
22
22
 
23
+ The steps are the page's structure, so they read the screen. A grid that holds
24
+ a collection -- tiles, cards -- in whatever column it lands in sets
25
+ \`min-col-width\` as well: each step's count becomes the most columns there will
26
+ be, and a column is never narrower than \`min-col-width\` (px at the default text
27
+ size; it grows with the reader's text), so in a narrow column the grid takes
28
+ fewer, wider columns.
29
+
23
30
  Its one consumer today is the footer's link columns.
24
31
  `
25
32
  }
26
33
  }
27
34
  },
28
35
  argTypes: {
29
- cols : { control: { type: "number", min: 1, max: 6 }, description: "Columns below 576px." },
30
- colsSm : { name: "cols-sm", control: { type: "number", min: 1, max: 6 }, description: "Columns from 576px." },
31
- colsMd : { name: "cols-md", control: { type: "number", min: 1, max: 6 }, description: "Columns from 768px." },
32
- colsLg : { name: "cols-lg", control: { type: "number", min: 1, max: 6 }, description: "Columns from 992px." },
33
- gap : { control: "select", options: ["none", "2xs", "xs", "sm", "md", "lg", "xl"], description: "Space step between cells, below 576px." },
34
- gapSm : { name: "gap-sm", control: "select", options: ["", "none", "2xs", "xs", "sm", "md", "lg", "xl"], description: "Space step between cells from 576px; unset keeps the step below." },
35
- gapMd : { name: "gap-md", control: "select", options: ["", "none", "2xs", "xs", "sm", "md", "lg", "xl"], description: "Space step between cells from 768px; unset keeps the step below." },
36
- gapLg : { name: "gap-lg", control: "select", options: ["", "none", "2xs", "xs", "sm", "md", "lg", "xl"], description: "Space step between cells from 992px; unset keeps the step below." },
37
- padding: { control: "select", options: ["none", "xs", "sm", "md", "lg"], description: "Space step inside the grid." },
38
- align : { control: "select", options: ["start", "center", "end", "stretch"] },
39
- justify: { control: "select", options: ["start", "center", "end", "stretch"] }
36
+ cols : { control: { type: "number", min: 1, max: 6 }, description: "Columns below 576px." },
37
+ colsSm : { name: "cols-sm", control: { type: "number", min: 1, max: 6 }, description: "Columns from 576px." },
38
+ colsMd : { name: "cols-md", control: { type: "number", min: 1, max: 6 }, description: "Columns from 768px." },
39
+ colsLg : { name: "cols-lg", control: { type: "number", min: 1, max: 6 }, description: "Columns from 992px." },
40
+ gap : { control: "select", options: ["none", "2xs", "xs", "sm", "md", "lg", "xl"], description: "Space step between cells, below 576px." },
41
+ gapSm : { name: "gap-sm", control: "select", options: ["", "none", "2xs", "xs", "sm", "md", "lg", "xl"], description: "Space step between cells from 576px; unset keeps the step below." },
42
+ gapMd : { name: "gap-md", control: "select", options: ["", "none", "2xs", "xs", "sm", "md", "lg", "xl"], description: "Space step between cells from 768px; unset keeps the step below." },
43
+ gapLg : { name: "gap-lg", control: "select", options: ["", "none", "2xs", "xs", "sm", "md", "lg", "xl"], description: "Space step between cells from 992px; unset keeps the step below." },
44
+ minColWidth: { name: "min-col-width", control: { type: "number", min: 0, step: 20 }, description: "The narrowest a column may be, in px at the default text size. Set, each step's count is the most columns there will be. 0 (unset) leaves the count as it is." },
45
+ padding : { control: "select", options: ["none", "xs", "sm", "md", "lg"], description: "Space step inside the grid." },
46
+ align : { control: "select", options: ["start", "center", "end", "stretch"] },
47
+ justify : { control: "select", options: ["start", "center", "end", "stretch"] }
40
48
  }
41
49
  };
42
50
 
@@ -114,3 +122,23 @@ export const Alignment = {
114
122
  </div>`,
115
123
  parameters: { docs: { description: { story: "justify sets justify-items on the cells. stretch is the default the footer relies on." } } }
116
124
  };
125
+
126
+ /* Three tiles' worth of column: a phone's (343) and two halves of a desktop
127
+ row (428 at a 992 screen, 588 at 1440). The steps alone would give every
128
+ one the screen's count -- three columns of 98px in the first. */
129
+ export const MinimumColumnWidth = {
130
+ name : "Minimum column width",
131
+ render: () => html`
132
+ <div style="display: grid; gap: var(--spacing-32)">
133
+ ${[343, 428, 588].map((w) => html`
134
+ <div style="max-width: ${w}px">
135
+ <p style="margin: 0 0 var(--spacing-8); font-family: var(--typography-fontFamily-mono); font-size: var(--typography-fontSize-xs); color: var(--color-text-muted)">
136
+ ${w}px column · cols="3" … min-col-width="160"
137
+ </p>
138
+ <bd-grid cols="3" cols-sm="3" cols-md="3" cols-lg="3" gap="md" min-col-width="160">${cells(6)}</bd-grid>
139
+ </div>`)}
140
+ </div>`,
141
+ parameters: {
142
+ docs: { description: { story: "The same grid, three columns at most and none narrower than 160px, in three columns: one column at 343, two at 428, three at 588. Without min-col-width every one of them would take three." } }
143
+ }
144
+ };
@@ -20,14 +20,10 @@ import { unsafeCSS } from "lit";
20
20
  *
21
21
  * :host { display: block; container-type: inline-size; }
22
22
  * ${hostFillsWidth()}
23
- * ${hostFillsWidth("--bd-grid-width")} a page may still set the width
24
23
  */
25
24
  const KEYWORDS = ["-moz-available", "-webkit-fill-available", "stretch"];
26
25
 
27
- export const hostFillsWidth = (hook = "") => {
28
- const width = value => (hook ? `var(${hook}, ${value})` : value);
29
- return unsafeCSS([
30
- `:host { width: ${width("100%")}; }`,
31
- ...KEYWORDS.map(keyword => `@supports (width: ${keyword}) { :host { width: ${width(keyword)}; } }`)
32
- ].join("\n"));
33
- };
26
+ export const hostFillsWidth = () => unsafeCSS([
27
+ ":host { width: 100%; }",
28
+ ...KEYWORDS.map(keyword => `@supports (width: ${keyword}) { :host { width: ${keyword}; } }`)
29
+ ].join("\n"));
@@ -93,6 +93,41 @@ class BdTabs extends LitElement {
93
93
  this.selectedTab = index;
94
94
  }
95
95
 
96
+ /* A copy is of its panel as it was when it was taken, and a page often
97
+ finishes a panel after bd-tabs is on it: the site's tabs block appends
98
+ the panels, then decorates the blocks inside them -- a features block
99
+ becomes bd-features -- and asks for an update. A copy used to be taken
100
+ on every render, so that update read the finished panels; once copies
101
+ were kept (_cloneOf), the open tab went on showing the raw block rows,
102
+ and the hidden ones sized the section from them -- 3822px for a panel
103
+ that is 735.
104
+
105
+ So the copies follow the panels. A change to what a panel holds, its
106
+ children or its text, has every copy taken again; so does an update
107
+ nobody named a property for -- a bare requestUpdate() -- which is how a
108
+ page says it changed something else, an attribute. Attributes are not
109
+ watched: the components inside a panel reflect their own, and a copy
110
+ taken again restarts what the open tab holds. */
111
+ connectedCallback() {
112
+ super.connectedCallback();
113
+ this._panelObserver ??= new MutationObserver(() => this._recopy());
114
+ this._panelObserver.observe(this, { childList: true, subtree: true, characterData: true });
115
+ }
116
+
117
+ disconnectedCallback() {
118
+ super.disconnectedCallback();
119
+ this._panelObserver.disconnect();
120
+ }
121
+
122
+ willUpdate(changed) {
123
+ if (!changed.size) this._clones = new WeakMap();
124
+ }
125
+
126
+ _recopy() {
127
+ this._clones = new WeakMap();
128
+ this.requestUpdate();
129
+ }
130
+
96
131
  /**
97
132
  * Every panel is rendered, all of them in one grid cell, so the wrapper is
98
133
  * as tall as the tallest panel and switching tabs moves nothing below it.
@@ -116,7 +151,8 @@ class BdTabs extends LitElement {
116
151
  * page; leaving it swaps the copy back for a sizer, so its accordions return
117
152
  * to their authored state and its video stops, which is what leaving did
118
153
  * when only the active panel was in the DOM. A copy is kept while its panel
119
- * stays as it is, so a re-render does not rebuild the panel being read.
154
+ * stays as it is, so a re-render does not rebuild the panel being read;
155
+ * when the panel changes, every copy is taken again (connectedCallback).
120
156
  */
121
157
  _cloneOf(panel, live) {
122
158
  let copy = this._clones.get(panel);