compostrap 1.0.1 → 1.0.2
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/css/compostrap.css
CHANGED
|
@@ -1940,14 +1940,9 @@ button[data-vc-week-day] {
|
|
|
1940
1940
|
}
|
|
1941
1941
|
}
|
|
1942
1942
|
html.lightbox-open {
|
|
1943
|
-
|
|
1943
|
+
overflow: hidden;
|
|
1944
1944
|
}
|
|
1945
1945
|
|
|
1946
|
-
@supports (-webkit-touch-callout: none) {
|
|
1947
|
-
.lightbox-open {
|
|
1948
|
-
overflow: hidden;
|
|
1949
|
-
}
|
|
1950
|
-
}
|
|
1951
1946
|
.lightbox {
|
|
1952
1947
|
overscroll-behavior: contain;
|
|
1953
1948
|
width: 100%;
|
package/dist/css/lightbox.css
CHANGED
package/dist/css/theme.css
CHANGED
|
@@ -12996,6 +12996,7 @@ li + li > .dropdown-item {
|
|
|
12996
12996
|
.dropdown-menu[data-bs-theme=dark] {
|
|
12997
12997
|
--bs-dropdown-bg: var(--bs-secondary-bg);
|
|
12998
12998
|
--bs-dropdown-link-hover-bg: rgba(var(--bs-body-color-rgb), .08);
|
|
12999
|
+
--bs-dropdown-header-color: var(--bs-secondary-color);
|
|
12999
13000
|
}
|
|
13000
13001
|
|
|
13001
13002
|
[data-bs-theme=dark] .toast,
|
package/dist/js/lightbox.js
CHANGED
|
@@ -29,7 +29,15 @@ var e = {
|
|
|
29
29
|
}
|
|
30
30
|
static open(e) {
|
|
31
31
|
let t = this._getDialog();
|
|
32
|
-
this._setLabels(t), t.classList.toggle("lightbox-single", this._links.length < 2), this._show(e), t.open
|
|
32
|
+
if (this._setLabels(t), t.classList.toggle("lightbox-single", this._links.length < 2), this._show(e), !t.open) {
|
|
33
|
+
let e = document.documentElement, n = window.innerWidth - e.clientWidth;
|
|
34
|
+
if (n > 0) {
|
|
35
|
+
this._bodyPadding = document.body.style.paddingRight;
|
|
36
|
+
let e = parseFloat(getComputedStyle(document.body).paddingRight) || 0;
|
|
37
|
+
document.body.style.paddingRight = `${e + n}px`;
|
|
38
|
+
}
|
|
39
|
+
e.classList.add("lightbox-open"), t.showModal();
|
|
40
|
+
}
|
|
33
41
|
}
|
|
34
42
|
static close() {
|
|
35
43
|
this._dialog?.close();
|
|
@@ -70,7 +78,7 @@ var e = {
|
|
|
70
78
|
let t = e.changedTouches[0].clientX - n;
|
|
71
79
|
n = null, Math.abs(t) > 50 && this._show(this._index + (t < 0 ? 1 : -1));
|
|
72
80
|
}), e.addEventListener("close", () => {
|
|
73
|
-
document.documentElement.classList.remove("lightbox-open"), e.querySelector(".lightbox-image").removeAttribute("src");
|
|
81
|
+
document.documentElement.classList.remove("lightbox-open"), this._bodyPadding !== void 0 && (document.body.style.paddingRight = this._bodyPadding, this._bodyPadding = void 0), e.querySelector(".lightbox-image").removeAttribute("src");
|
|
74
82
|
}), document.body.append(e), this._dialog = e, e;
|
|
75
83
|
}
|
|
76
84
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "compostrap",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Bootstrap 5 for administrations and websites: a theme with the look and classes of Bootstrap 6, a layout with a sidebar, a multi-level menu and a navbar, and components Bootstrap does not have (datepicker, charts, gallery, lightbox, dropzone, sign-in pages, shop, blog).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/js/lightbox.js
CHANGED
|
@@ -60,7 +60,16 @@ export class Lightbox {
|
|
|
60
60
|
dialog.classList.toggle('lightbox-single', this._links.length < 2);
|
|
61
61
|
this._show(index);
|
|
62
62
|
if (!dialog.open) {
|
|
63
|
-
|
|
63
|
+
// the page is locked and its scrollbar hidden; the body is padded by the width of a classic scrollbar
|
|
64
|
+
// meanwhile, so the page does not shift (a page without one, short or with an overlay scrollbar, gets none)
|
|
65
|
+
const root = document.documentElement;
|
|
66
|
+
const gutter = window.innerWidth - root.clientWidth;
|
|
67
|
+
if (gutter > 0) {
|
|
68
|
+
this._bodyPadding = document.body.style.paddingRight;
|
|
69
|
+
const padding = parseFloat(getComputedStyle(document.body).paddingRight) || 0;
|
|
70
|
+
document.body.style.paddingRight = `${padding + gutter}px`;
|
|
71
|
+
}
|
|
72
|
+
root.classList.add('lightbox-open');
|
|
64
73
|
dialog.showModal();
|
|
65
74
|
}
|
|
66
75
|
}
|
|
@@ -155,6 +164,10 @@ export class Lightbox {
|
|
|
155
164
|
|
|
156
165
|
dialog.addEventListener('close', () => {
|
|
157
166
|
document.documentElement.classList.remove('lightbox-open');
|
|
167
|
+
if (this._bodyPadding !== undefined) {
|
|
168
|
+
document.body.style.paddingRight = this._bodyPadding;
|
|
169
|
+
this._bodyPadding = undefined;
|
|
170
|
+
}
|
|
158
171
|
dialog.querySelector('.lightbox-image').removeAttribute('src');
|
|
159
172
|
});
|
|
160
173
|
|
|
@@ -3,24 +3,16 @@
|
|
|
3
3
|
// on a dark backdrop, its caption, a counter and round buttons to close and to browse
|
|
4
4
|
//
|
|
5
5
|
|
|
6
|
-
// The page under it
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
6
|
+
// The page under it is locked and its scrollbar hidden (a scrollbar that showed only on a long page looked random), so
|
|
7
|
+
// the dialog has the whole window and its buttons stand symmetrically. The script pads the body by the width of the
|
|
8
|
+
// scrollbar meanwhile (like the modals of Bootstrap), so the page under it does not shift. Keeping the room of the
|
|
9
|
+
// scrollbar empty (scrollbar-gutter) was tried: a dialog widened over it was cut off in some browsers.
|
|
10
10
|
html.lightbox-open {
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
@supports (-webkit-touch-callout: none) {
|
|
15
|
-
.lightbox-open {
|
|
16
|
-
overflow: hidden;
|
|
17
|
-
}
|
|
11
|
+
overflow: hidden;
|
|
18
12
|
}
|
|
19
13
|
|
|
20
14
|
.lightbox {
|
|
21
15
|
overscroll-behavior: contain;
|
|
22
|
-
// 100 %, not 100vw: the window without the scrollbar of the page, so the buttons at the right edge keep their
|
|
23
|
-
// distance from it and are not drawn under it
|
|
24
16
|
width: 100%;
|
|
25
17
|
max-width: 100%;
|
|
26
18
|
height: 100dvh;
|
|
@@ -119,6 +119,9 @@ li + li > .dropdown-item {
|
|
|
119
119
|
.dropdown-menu[data-bs-theme='dark'] {
|
|
120
120
|
--bs-dropdown-bg: var(--bs-secondary-bg);
|
|
121
121
|
--bs-dropdown-link-hover-bg: rgba(var(--bs-body-color-rgb), .08);
|
|
122
|
+
// the header of Bootstrap is $gray-600 in both themes, too dark on the dark surface; the quiet text color of the
|
|
123
|
+
// theme like the header of the compact sidebar menu
|
|
124
|
+
--bs-dropdown-header-color: var(--bs-secondary-color);
|
|
122
125
|
}
|
|
123
126
|
|
|
124
127
|
// a toast is a floating surface like a dropdown: lighter in the dark theme, where a shadow is not seen
|