@rettangoli/ui 1.0.10 → 1.0.13

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.
@@ -184,11 +184,14 @@ class RettangoliGridElement extends HTMLElement {
184
184
  const overflow = this.getAttribute(addSizePrefix("overflow"));
185
185
 
186
186
  if (scrollHorizontal && scrollVertical) {
187
- this._styles[size].overflow = "scroll";
187
+ this._styles[size].overflow = "auto";
188
+ this._styles[size]["scrollbar-gutter"] = "stable";
188
189
  } else if (scrollHorizontal) {
189
- this._styles[size]["overflow-x"] = "scroll";
190
+ this._styles[size]["overflow-x"] = "auto";
191
+ this._styles[size]["scrollbar-gutter"] = "stable";
190
192
  } else if (scrollVertical) {
191
- this._styles[size]["overflow-y"] = "scroll";
193
+ this._styles[size]["overflow-y"] = "auto";
194
+ this._styles[size]["scrollbar-gutter"] = "stable";
192
195
  }
193
196
 
194
197
  if (overflow === "hidden") {
@@ -28,6 +28,15 @@ const normalizeRawCssValue = (value) => {
28
28
  return normalizedValue.length > 0 ? normalizedValue : null;
29
29
  };
30
30
 
31
+ const normalizeDimensionOrRawCssValue = (value) => {
32
+ const normalizedValue = normalizeRawCssValue(value);
33
+ if (normalizedValue === null) {
34
+ return null;
35
+ }
36
+
37
+ return dimensionWithUnit(normalizedValue);
38
+ };
39
+
31
40
  // Internal implementation without uhtml
32
41
  class RettangoliViewElement extends HTMLElement {
33
42
  static styleSheet = null;
@@ -93,6 +102,9 @@ class RettangoliViewElement extends HTMLElement {
93
102
  "bgs",
94
103
  "bgp",
95
104
  "bgr",
105
+ "sbh",
106
+ "spi",
107
+ "stg",
96
108
  "hide",
97
109
  "show",
98
110
  "sh",
@@ -166,6 +178,15 @@ class RettangoliViewElement extends HTMLElement {
166
178
  const backgroundRepeat = normalizeRawCssValue(
167
179
  this.getAttribute(addSizePrefix("bgr")),
168
180
  );
181
+ const scrollBehavior = normalizeRawCssValue(
182
+ this.getAttribute(addSizePrefix("sbh")),
183
+ );
184
+ const scrollPaddingInline = normalizeDimensionOrRawCssValue(
185
+ this.getAttribute(addSizePrefix("spi")),
186
+ );
187
+ const scrollTargetGroup = normalizeRawCssValue(
188
+ this.getAttribute(addSizePrefix("stg")),
189
+ );
169
190
 
170
191
  if (zIndex !== null) {
171
192
  this._styles[size]["z-index"] = zIndex;
@@ -195,6 +216,18 @@ class RettangoliViewElement extends HTMLElement {
195
216
  this._styles[size]["background-repeat"] = backgroundRepeat;
196
217
  }
197
218
 
219
+ if (scrollBehavior !== null) {
220
+ this._styles[size]["scroll-behavior"] = scrollBehavior;
221
+ }
222
+
223
+ if (scrollPaddingInline !== null) {
224
+ this._styles[size]["scroll-padding-inline"] = scrollPaddingInline;
225
+ }
226
+
227
+ if (scrollTargetGroup !== null) {
228
+ this._styles[size]["scroll-target-group"] = scrollTargetGroup;
229
+ }
230
+
198
231
  applyDimensionToStyleBucket({
199
232
  styleBucket: this._styles[size],
200
233
  axis: "width",
@@ -305,13 +338,16 @@ class RettangoliViewElement extends HTMLElement {
305
338
  const overflow = this.getAttribute(addSizePrefix("overflow"));
306
339
 
307
340
  if (scrollHorizontal && scrollVertical) {
308
- this._styles[size]["overflow"] = "scroll";
341
+ this._styles[size]["overflow"] = "auto";
342
+ this._styles[size]["scrollbar-gutter"] = "stable";
309
343
  this._styles[size]["flex-wrap"] = "nowrap";
310
344
  } else if (scrollHorizontal) {
311
- this._styles[size]["overflow-x"] = "scroll";
345
+ this._styles[size]["overflow-x"] = "auto";
346
+ this._styles[size]["scrollbar-gutter"] = "stable";
312
347
  this._styles[size]["flex-wrap"] = "nowrap";
313
348
  } else if (scrollVertical) {
314
- this._styles[size]["overflow-y"] = "scroll";
349
+ this._styles[size]["overflow-y"] = "auto";
350
+ this._styles[size]["scrollbar-gutter"] = "stable";
315
351
  this._styles[size]["flex-wrap"] = "nowrap";
316
352
  }
317
353
 
@@ -3,17 +3,17 @@ import { css } from '../common.js'
3
3
 
4
4
  export default css`
5
5
  :host([sh]:not([sv])) {
6
- overflow-x: scroll;
6
+ overflow-x: auto;
7
7
  flex-wrap: nowrap;
8
8
  min-width: 0;
9
9
  }
10
10
  :host([sv]:not([sh])) {
11
- overflow-y: scroll;
11
+ overflow-y: auto;
12
12
  flex-wrap: nowrap;
13
13
  min-height: 0;
14
14
  }
15
15
  :host([sh][sv]) {
16
- overflow: scroll;
16
+ overflow: auto;
17
17
  flex-wrap: nowrap;
18
18
  min-height: 0;
19
19
  min-width: 0;
@@ -21,6 +21,7 @@ export default css`
21
21
  :host([sh]),
22
22
  :host([sv]) {
23
23
  -ms-overflow-style: auto;
24
+ scrollbar-gutter: stable;
24
25
  scrollbar-width: thin;
25
26
  scrollbar-color: var(--scrollbar-thumb, var(--muted-foreground)) var(--scrollbar-track, transparent);
26
27
  }