@rettangoli/ui 1.0.11 → 1.0.14
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/dist/rettangoli-iife-layout.min.js +86 -53
- package/dist/rettangoli-iife-ui.min.js +88 -55
- package/package.json +2 -2
- package/src/components/sidebar/sidebar.store.js +2 -0
- package/src/components/sidebar/sidebar.view.yaml +1 -1
- package/src/primitives/grid.js +6 -3
- package/src/primitives/view.js +14 -60
- package/src/styles/scrollStyles.js +36 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rettangoli/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"description": "A UI component library for building web interfaces.",
|
|
5
5
|
"main": "dist/rettangoli-esm.min.js",
|
|
6
6
|
"type": "module",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"build": "rtgl fe build -o ./.generated/fe-entry.js && bun run esbuild.js && bun run esbuild-dev.js && npm run copy:css",
|
|
38
38
|
"prepack": "npm run build",
|
|
39
39
|
"vt:generate": "bun run build:dev && rtgl vt generate",
|
|
40
|
-
"vt:docker": "bun run build:dev && bash -lc 'IMAGE=\"han4wluc/rtgl:playwright-v1.57.0-rtgl-v1.0.
|
|
40
|
+
"vt:docker": "bun run build:dev && bash -lc 'IMAGE=\"han4wluc/rtgl:playwright-v1.57.0-rtgl-v1.0.10\"; docker pull \"$IMAGE\" >/dev/null 2>&1; docker run --rm --user $(id -u):$(id -g) -v \"$PWD:/app\" -w /app \"$IMAGE\" rtgl vt screenshot'",
|
|
41
41
|
"vt:report": "bun run vt:docker && rtgl vt report",
|
|
42
42
|
"vt:accept": "rtgl vt accept",
|
|
43
43
|
"serve": "bunx serve .rettangoli/vt/_site"
|
|
@@ -141,6 +141,7 @@ export const selectViewData = ({ props }) => {
|
|
|
141
141
|
const headerWidth = itemWidth;
|
|
142
142
|
|
|
143
143
|
const ah = mode === 'shrunk-lg' || mode === 'shrunk-md' ? 'c' : '';
|
|
144
|
+
const listAttrString = mode === 'full' ? 'sv' : 'sv hsb';
|
|
144
145
|
|
|
145
146
|
return {
|
|
146
147
|
containerAttrString,
|
|
@@ -163,6 +164,7 @@ export const selectViewData = ({ props }) => {
|
|
|
163
164
|
headerWidth,
|
|
164
165
|
selectedItemId,
|
|
165
166
|
ah,
|
|
167
|
+
listAttrString,
|
|
166
168
|
showHeader,
|
|
167
169
|
rightBorderWidth,
|
|
168
170
|
};
|
|
@@ -75,7 +75,7 @@ template:
|
|
|
75
75
|
- rtgl-text s=lg: ${header.label}
|
|
76
76
|
$else:
|
|
77
77
|
- rtgl-text s=lg: ${header.label}
|
|
78
|
-
- rtgl-view w=f h=1fg
|
|
78
|
+
- rtgl-view w=f h=1fg ph=${headerPadding} pb=lg g=xs ah=${ah} ${listAttrString}:
|
|
79
79
|
- $for item, i in items:
|
|
80
80
|
- $if item.type == "groupLabel":
|
|
81
81
|
- $if showGroupLabels:
|
package/src/primitives/grid.js
CHANGED
|
@@ -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 = "
|
|
187
|
+
this._styles[size].overflow = "auto";
|
|
188
|
+
this._styles[size]["scrollbar-gutter"] = "stable";
|
|
188
189
|
} else if (scrollHorizontal) {
|
|
189
|
-
this._styles[size]["overflow-x"] = "
|
|
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"] = "
|
|
193
|
+
this._styles[size]["overflow-y"] = "auto";
|
|
194
|
+
this._styles[size]["scrollbar-gutter"] = "stable";
|
|
192
195
|
}
|
|
193
196
|
|
|
194
197
|
if (overflow === "hidden") {
|
package/src/primitives/view.js
CHANGED
|
@@ -28,15 +28,6 @@ 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
|
-
|
|
40
31
|
// Internal implementation without uhtml
|
|
41
32
|
class RettangoliViewElement extends HTMLElement {
|
|
42
33
|
static styleSheet = null;
|
|
@@ -102,12 +93,7 @@ class RettangoliViewElement extends HTMLElement {
|
|
|
102
93
|
"bgs",
|
|
103
94
|
"bgp",
|
|
104
95
|
"bgr",
|
|
105
|
-
"
|
|
106
|
-
"sna",
|
|
107
|
-
"sns",
|
|
108
|
-
"sbh",
|
|
109
|
-
"spi",
|
|
110
|
-
"stg",
|
|
96
|
+
"hsb",
|
|
111
97
|
"hide",
|
|
112
98
|
"show",
|
|
113
99
|
"sh",
|
|
@@ -181,24 +167,6 @@ class RettangoliViewElement extends HTMLElement {
|
|
|
181
167
|
const backgroundRepeat = normalizeRawCssValue(
|
|
182
168
|
this.getAttribute(addSizePrefix("bgr")),
|
|
183
169
|
);
|
|
184
|
-
const scrollSnapType = normalizeRawCssValue(
|
|
185
|
-
this.getAttribute(addSizePrefix("sst")),
|
|
186
|
-
);
|
|
187
|
-
const scrollSnapAlign = normalizeRawCssValue(
|
|
188
|
-
this.getAttribute(addSizePrefix("sna")),
|
|
189
|
-
);
|
|
190
|
-
const scrollSnapStop = normalizeRawCssValue(
|
|
191
|
-
this.getAttribute(addSizePrefix("sns")),
|
|
192
|
-
);
|
|
193
|
-
const scrollBehavior = normalizeRawCssValue(
|
|
194
|
-
this.getAttribute(addSizePrefix("sbh")),
|
|
195
|
-
);
|
|
196
|
-
const scrollPaddingInline = normalizeDimensionOrRawCssValue(
|
|
197
|
-
this.getAttribute(addSizePrefix("spi")),
|
|
198
|
-
);
|
|
199
|
-
const scrollTargetGroup = normalizeRawCssValue(
|
|
200
|
-
this.getAttribute(addSizePrefix("stg")),
|
|
201
|
-
);
|
|
202
170
|
|
|
203
171
|
if (zIndex !== null) {
|
|
204
172
|
this._styles[size]["z-index"] = zIndex;
|
|
@@ -228,30 +196,6 @@ class RettangoliViewElement extends HTMLElement {
|
|
|
228
196
|
this._styles[size]["background-repeat"] = backgroundRepeat;
|
|
229
197
|
}
|
|
230
198
|
|
|
231
|
-
if (scrollSnapType !== null) {
|
|
232
|
-
this._styles[size]["scroll-snap-type"] = scrollSnapType;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
if (scrollSnapAlign !== null) {
|
|
236
|
-
this._styles[size]["scroll-snap-align"] = scrollSnapAlign;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
if (scrollSnapStop !== null) {
|
|
240
|
-
this._styles[size]["scroll-snap-stop"] = scrollSnapStop;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
if (scrollBehavior !== null) {
|
|
244
|
-
this._styles[size]["scroll-behavior"] = scrollBehavior;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
if (scrollPaddingInline !== null) {
|
|
248
|
-
this._styles[size]["scroll-padding-inline"] = scrollPaddingInline;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
if (scrollTargetGroup !== null) {
|
|
252
|
-
this._styles[size]["scroll-target-group"] = scrollTargetGroup;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
199
|
applyDimensionToStyleBucket({
|
|
256
200
|
styleBucket: this._styles[size],
|
|
257
201
|
axis: "width",
|
|
@@ -359,16 +303,20 @@ class RettangoliViewElement extends HTMLElement {
|
|
|
359
303
|
// Handle scroll properties
|
|
360
304
|
const scrollHorizontal = this.hasAttribute(addSizePrefix("sh"));
|
|
361
305
|
const scrollVertical = this.hasAttribute(addSizePrefix("sv"));
|
|
306
|
+
const hideScrollbar = this.hasAttribute(addSizePrefix("hsb"));
|
|
362
307
|
const overflow = this.getAttribute(addSizePrefix("overflow"));
|
|
363
308
|
|
|
364
309
|
if (scrollHorizontal && scrollVertical) {
|
|
365
|
-
this._styles[size]["overflow"] = "
|
|
310
|
+
this._styles[size]["overflow"] = "auto";
|
|
311
|
+
this._styles[size]["scrollbar-gutter"] = "stable";
|
|
366
312
|
this._styles[size]["flex-wrap"] = "nowrap";
|
|
367
313
|
} else if (scrollHorizontal) {
|
|
368
|
-
this._styles[size]["overflow-x"] = "
|
|
314
|
+
this._styles[size]["overflow-x"] = "auto";
|
|
315
|
+
this._styles[size]["scrollbar-gutter"] = "stable";
|
|
369
316
|
this._styles[size]["flex-wrap"] = "nowrap";
|
|
370
317
|
} else if (scrollVertical) {
|
|
371
|
-
this._styles[size]["overflow-y"] = "
|
|
318
|
+
this._styles[size]["overflow-y"] = "auto";
|
|
319
|
+
this._styles[size]["scrollbar-gutter"] = "stable";
|
|
372
320
|
this._styles[size]["flex-wrap"] = "nowrap";
|
|
373
321
|
}
|
|
374
322
|
|
|
@@ -376,6 +324,12 @@ class RettangoliViewElement extends HTMLElement {
|
|
|
376
324
|
this._styles[size]["overflow"] = "hidden";
|
|
377
325
|
this._styles[size]["flex-wrap"] = "nowrap";
|
|
378
326
|
}
|
|
327
|
+
|
|
328
|
+
if (hideScrollbar) {
|
|
329
|
+
this._styles[size]["-ms-overflow-style"] = "none";
|
|
330
|
+
this._styles[size]["scrollbar-gutter"] = "auto";
|
|
331
|
+
this._styles[size]["scrollbar-width"] = "none";
|
|
332
|
+
}
|
|
379
333
|
});
|
|
380
334
|
|
|
381
335
|
// Update styles only if changed
|
|
@@ -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:
|
|
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:
|
|
11
|
+
overflow-y: auto;
|
|
12
12
|
flex-wrap: nowrap;
|
|
13
13
|
min-height: 0;
|
|
14
14
|
}
|
|
15
15
|
:host([sh][sv]) {
|
|
16
|
-
overflow:
|
|
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
|
}
|
|
@@ -47,5 +48,37 @@ export default css`
|
|
|
47
48
|
overflow: hidden;
|
|
48
49
|
flex-wrap: nowrap;
|
|
49
50
|
}
|
|
51
|
+
:host([hsb])::-webkit-scrollbar {
|
|
52
|
+
width: 0;
|
|
53
|
+
height: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@media only screen and (max-width: 1280px) {
|
|
57
|
+
:host([xl-hsb])::-webkit-scrollbar {
|
|
58
|
+
width: 0;
|
|
59
|
+
height: 0;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@media only screen and (max-width: 1024px) {
|
|
64
|
+
:host([lg-hsb])::-webkit-scrollbar {
|
|
65
|
+
width: 0;
|
|
66
|
+
height: 0;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@media only screen and (max-width: 768px) {
|
|
71
|
+
:host([md-hsb])::-webkit-scrollbar {
|
|
72
|
+
width: 0;
|
|
73
|
+
height: 0;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@media only screen and (max-width: 640px) {
|
|
78
|
+
:host([sm-hsb])::-webkit-scrollbar {
|
|
79
|
+
width: 0;
|
|
80
|
+
height: 0;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
50
83
|
|
|
51
84
|
`
|