blue-web 1.36.3 → 1.37.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.
- package/dist/js/701.bundle.js +1 -0
- package/dist/js/776.bundle.js +1 -0
- package/dist/js/actions.js +48 -57
- package/dist/js/color-mode.js +23 -29
- package/dist/js/dialog.js +82 -64
- package/dist/js/edit-view.js +52 -55
- package/dist/js/input-splitted.js +193 -244
- package/dist/js/layout.js +151 -192
- package/dist/js/modal-responsive.js +35 -48
- package/dist/js/odometer.js +132 -131
- package/dist/js/overflow-detector.js +51 -62
- package/dist/js/progress.js +41 -59
- package/dist/js/quick-look.bundle.js +1 -0
- package/dist/js/quick-look.d.ts +15 -0
- package/dist/js/quick-look.js +168 -0
- package/dist/js/read-view.js +125 -91
- package/dist/js/select-list.js +168 -177
- package/dist/js/shared.js +21 -26
- package/dist/js/utils.d.ts +1 -1
- package/dist/js/utils.js +4 -106
- package/dist/merged.scss +58 -1
- package/dist/style.css +53 -2
- package/dist/style.css.map +1 -1
- package/dist/style.min.css +3 -3
- package/dist/style.scss +2 -1
- package/dist/styles/_quick-look.scss +56 -0
- package/package.json +7 -6
package/dist/js/layout.js
CHANGED
|
@@ -1,212 +1,171 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
initInspector(layoutEl, instance);
|
|
36
|
-
}
|
|
37
|
-
mrInit(modalEl);
|
|
38
|
-
layoutSideEl.classList.add("with-transition");
|
|
39
|
-
return instance;
|
|
1
|
+
import { dispose as dispose$1, init as init$1 } from "./modal-responsive.js";
|
|
2
|
+
// src/js/layout.ts
|
|
3
|
+
var instances = /* @__PURE__ */ new Map();
|
|
4
|
+
function init(layoutEl) {
|
|
5
|
+
if (!layoutEl) return;
|
|
6
|
+
if (instances.has(layoutEl)) dispose(layoutEl);
|
|
7
|
+
const toggleLayoutSideEl = layoutEl.querySelector("[data-blue-toggle=\"layout-side\"]");
|
|
8
|
+
const layoutSideEl = layoutEl.querySelector(".blue-layout-side");
|
|
9
|
+
const modalEl = layoutEl.querySelector(".blue-layout-side > dialog");
|
|
10
|
+
const splitterEl = layoutEl.querySelector(".blue-layout-main > sp-split-view.blue-layout-splitter");
|
|
11
|
+
const inspectorEl = layoutEl.querySelector(".blue-layout-inspector");
|
|
12
|
+
if (!toggleLayoutSideEl || !layoutSideEl || !modalEl) return;
|
|
13
|
+
const controller = new AbortController();
|
|
14
|
+
const instance = {
|
|
15
|
+
toggleLayoutSideEl,
|
|
16
|
+
layoutSideEl,
|
|
17
|
+
modalEl,
|
|
18
|
+
splitterEl,
|
|
19
|
+
inspectorEl,
|
|
20
|
+
controller
|
|
21
|
+
};
|
|
22
|
+
instances.set(layoutEl, instance);
|
|
23
|
+
if (localStorage.getItem("blueLayoutSideShrink") != null) {
|
|
24
|
+
layoutSideEl.classList.add("d-lg-none", "w-lg-0");
|
|
25
|
+
toggleLayoutSideEl.setAttribute("aria-expanded", "false");
|
|
26
|
+
}
|
|
27
|
+
toggleLayoutSideEl.addEventListener("click", () => toggleSidebar(layoutEl), { signal: controller.signal });
|
|
28
|
+
if (splitterEl && inspectorEl) {
|
|
29
|
+
init$1(inspectorEl);
|
|
30
|
+
initInspector(layoutEl, instance);
|
|
31
|
+
}
|
|
32
|
+
init$1(modalEl);
|
|
33
|
+
layoutSideEl.classList.add("with-transition");
|
|
34
|
+
return instance;
|
|
40
35
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
instances.delete(layoutEl);
|
|
36
|
+
function dispose(layoutEl) {
|
|
37
|
+
const instance = instances.get(layoutEl);
|
|
38
|
+
if (!instance) return;
|
|
39
|
+
const { controller, modalEl } = instance;
|
|
40
|
+
controller.abort();
|
|
41
|
+
if (modalEl) dispose$1(modalEl);
|
|
42
|
+
instances.delete(layoutEl);
|
|
49
43
|
}
|
|
50
44
|
function toggleSidebar(layoutEl) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
if (!splitterEl) return;
|
|
67
|
-
setTimeout(() => {
|
|
68
|
-
adjustSplitter(layoutEl, splitterEl);
|
|
69
|
-
}, 10);
|
|
45
|
+
const instance = instances.get(layoutEl);
|
|
46
|
+
if (!instance) return;
|
|
47
|
+
const { layoutSideEl, toggleLayoutSideEl, splitterEl } = instance;
|
|
48
|
+
if (!layoutSideEl || !toggleLayoutSideEl) return;
|
|
49
|
+
layoutSideEl.classList.toggle("d-lg-none");
|
|
50
|
+
layoutSideEl.classList.toggle("w-lg-0");
|
|
51
|
+
const expanded = !layoutSideEl.classList.contains("d-lg-none");
|
|
52
|
+
toggleLayoutSideEl.setAttribute("aria-expanded", expanded.toString());
|
|
53
|
+
if (expanded) localStorage.removeItem("blueLayoutSideShrink");
|
|
54
|
+
else localStorage.setItem("blueLayoutSideShrink", "");
|
|
55
|
+
if (!splitterEl) return;
|
|
56
|
+
setTimeout(() => {
|
|
57
|
+
adjustSplitter(layoutEl, splitterEl);
|
|
58
|
+
}, 10);
|
|
70
59
|
}
|
|
71
60
|
function setSplitterPosition(splitterEl, value) {
|
|
72
|
-
|
|
61
|
+
if (value < 0) splitterEl.splitterPos = 0;
|
|
62
|
+
else if (splitterEl.maxPos && value > splitterEl.maxPos) splitterEl.splitterPos = splitterEl.maxPos;
|
|
63
|
+
else splitterEl.splitterPos = value;
|
|
73
64
|
}
|
|
74
65
|
function enableSplitter(layoutEl, splitterEl) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
66
|
+
const inspectorSizeEntry = localStorage.getItem("blueLayoutInspectorSize");
|
|
67
|
+
const inspectorSize = inspectorSizeEntry ? Number.parseInt(inspectorSizeEntry, 10) : NaN;
|
|
68
|
+
setSplitterPosition(splitterEl, splitterEl.viewSize - (Number.isFinite(inspectorSize) ? inspectorSize : 244));
|
|
69
|
+
splitterEl.resizable = true;
|
|
70
|
+
splitterEl.dataset.blueInspectorSize = (splitterEl.viewSize - splitterEl.splitterPos).toString();
|
|
71
|
+
layoutEl.dataset.blueSplitterEnabled = "";
|
|
81
72
|
}
|
|
82
73
|
function disableSplitter(layoutEl, splitterEl) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
74
|
+
setSplitterPosition(splitterEl, splitterEl.maxPos || splitterEl.viewSize);
|
|
75
|
+
splitterEl.resizable = false;
|
|
76
|
+
delete layoutEl.dataset.blueSplitterEnabled;
|
|
86
77
|
}
|
|
87
78
|
function adjustSplitter(layoutEl, splitterEl) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
79
|
+
if (splitterEl.resizable && splitterEl.dataset.blueInspectorSize) {
|
|
80
|
+
setSplitterPosition(splitterEl, splitterEl.viewSize - parseInt(splitterEl.dataset.blueInspectorSize));
|
|
81
|
+
updateInspectorState(layoutEl);
|
|
82
|
+
}
|
|
92
83
|
}
|
|
93
84
|
function initInspector(layoutEl, instance) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
let secondPaneSize = splitterEl.viewSize - splitterEl.splitterPos;
|
|
120
|
-
if (secondPaneSize) {
|
|
121
|
-
secondPaneSize = Math.round(secondPaneSize);
|
|
122
|
-
splitterEl.dataset.blueInspectorSize = secondPaneSize.toString();
|
|
123
|
-
localStorage.setItem("blueLayoutInspectorSize", secondPaneSize.toString());
|
|
124
|
-
}
|
|
125
|
-
}, {
|
|
126
|
-
signal: controller.signal
|
|
127
|
-
});
|
|
128
|
-
inspectorEl.addEventListener("close", () => {
|
|
129
|
-
updateInspectorState(layoutEl);
|
|
130
|
-
}, {
|
|
131
|
-
signal: controller.signal
|
|
132
|
-
});
|
|
85
|
+
const { splitterEl, inspectorEl, controller } = instance;
|
|
86
|
+
if (!splitterEl || !inspectorEl || !controller) return;
|
|
87
|
+
if (localStorage.getItem("blueLayoutInspectorEnabled") != null && getComputedStyle(inspectorEl).position !== "fixed") enableSplitter(layoutEl, splitterEl);
|
|
88
|
+
else disableSplitter(layoutEl, splitterEl);
|
|
89
|
+
updateInspectorState(layoutEl);
|
|
90
|
+
window.addEventListener("resize", () => {
|
|
91
|
+
if (splitterEl) {
|
|
92
|
+
if (inspectorEl && getComputedStyle(inspectorEl).display === "none" || !splitterEl.resizable) {
|
|
93
|
+
disableSplitter(layoutEl, splitterEl);
|
|
94
|
+
updateInspectorState(layoutEl);
|
|
95
|
+
} else adjustSplitter(layoutEl, splitterEl);
|
|
96
|
+
}
|
|
97
|
+
}, { signal: controller.signal });
|
|
98
|
+
splitterEl.addEventListener("change", (e) => {
|
|
99
|
+
const splitterEl = e.target;
|
|
100
|
+
let secondPaneSize = splitterEl.viewSize - splitterEl.splitterPos;
|
|
101
|
+
if (secondPaneSize) {
|
|
102
|
+
secondPaneSize = Math.round(secondPaneSize);
|
|
103
|
+
splitterEl.dataset.blueInspectorSize = secondPaneSize.toString();
|
|
104
|
+
localStorage.setItem("blueLayoutInspectorSize", secondPaneSize.toString());
|
|
105
|
+
}
|
|
106
|
+
}, { signal: controller.signal });
|
|
107
|
+
inspectorEl.addEventListener("close", () => {
|
|
108
|
+
updateInspectorState(layoutEl);
|
|
109
|
+
}, { signal: controller.signal });
|
|
133
110
|
}
|
|
134
111
|
function updateInspectorState(layoutTarget) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
layoutEl.dispatchEvent(new Event("blue-inspector-change"));
|
|
146
|
-
}
|
|
112
|
+
const layoutEl = typeof layoutTarget === "string" ? document.querySelector(layoutTarget) : layoutTarget;
|
|
113
|
+
if (!layoutEl) return;
|
|
114
|
+
const instance = instances.get(layoutEl);
|
|
115
|
+
if (!instance?.splitterEl || !instance.inspectorEl) return;
|
|
116
|
+
const { splitterEl, inspectorEl } = instance;
|
|
117
|
+
const isOpen = getComputedStyle(inspectorEl).position === "fixed" ? inspectorEl.open : splitterEl.resizable;
|
|
118
|
+
const previousState = layoutEl.dataset.blueInspectorOpen;
|
|
119
|
+
if (isOpen) layoutEl.dataset.blueInspectorOpen = "";
|
|
120
|
+
else delete layoutEl.dataset.blueInspectorOpen;
|
|
121
|
+
if (previousState !== layoutEl.dataset.blueInspectorOpen) layoutEl.dispatchEvent(new Event("blue-inspector-change"));
|
|
147
122
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
} else {
|
|
164
|
-
// Is active as split view
|
|
165
|
-
enableSplitter(layoutEl, splitterEl);
|
|
166
|
-
localStorage.setItem("blueLayoutInspectorEnabled", "");
|
|
167
|
-
}
|
|
168
|
-
updateInspectorState(layoutEl);
|
|
123
|
+
function openInspector(layoutTarget, showCommand = "show-modal") {
|
|
124
|
+
const layoutEl = typeof layoutTarget === "string" ? document.querySelector(layoutTarget) : layoutTarget;
|
|
125
|
+
if (!layoutEl) return;
|
|
126
|
+
const instance = instances.get(layoutEl);
|
|
127
|
+
if (!instance?.splitterEl || !instance.inspectorEl) return;
|
|
128
|
+
const { splitterEl, inspectorEl } = instance;
|
|
129
|
+
if (getComputedStyle(inspectorEl).position === "fixed") {
|
|
130
|
+
if (showCommand === "show") inspectorEl.show();
|
|
131
|
+
else inspectorEl.showModal();
|
|
132
|
+
} else {
|
|
133
|
+
enableSplitter(layoutEl, splitterEl);
|
|
134
|
+
localStorage.setItem("blueLayoutInspectorEnabled", "");
|
|
135
|
+
}
|
|
136
|
+
updateInspectorState(layoutEl);
|
|
169
137
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
disableSplitter(layoutEl, splitterEl);
|
|
183
|
-
localStorage.removeItem("blueLayoutInspectorEnabled");
|
|
184
|
-
}
|
|
185
|
-
updateInspectorState(layoutEl);
|
|
138
|
+
function closeInspector(layoutTarget) {
|
|
139
|
+
const layoutEl = typeof layoutTarget === "string" ? document.querySelector(layoutTarget) : layoutTarget;
|
|
140
|
+
if (!layoutEl) return;
|
|
141
|
+
const instance = instances.get(layoutEl);
|
|
142
|
+
if (!instance?.splitterEl || !instance.inspectorEl) return;
|
|
143
|
+
const { splitterEl, inspectorEl } = instance;
|
|
144
|
+
if (getComputedStyle(inspectorEl).position === "fixed") inspectorEl.close();
|
|
145
|
+
else {
|
|
146
|
+
disableSplitter(layoutEl, splitterEl);
|
|
147
|
+
localStorage.removeItem("blueLayoutInspectorEnabled");
|
|
148
|
+
}
|
|
149
|
+
updateInspectorState(layoutEl);
|
|
186
150
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
const isOpen = getComputedStyle(inspectorEl).position === "fixed" ? inspectorEl.open : splitterEl.resizable;
|
|
196
|
-
if (isOpen) {
|
|
197
|
-
closeInspector(layoutTarget);
|
|
198
|
-
} else {
|
|
199
|
-
openInspector(layoutTarget, showCommand);
|
|
200
|
-
}
|
|
151
|
+
function toggleInspector(layoutTarget, showCommand = "show-modal") {
|
|
152
|
+
const layoutEl = typeof layoutTarget === "string" ? document.querySelector(layoutTarget) : layoutTarget;
|
|
153
|
+
if (!layoutEl) return;
|
|
154
|
+
const instance = instances.get(layoutEl);
|
|
155
|
+
if (!instance?.splitterEl || !instance.inspectorEl) return;
|
|
156
|
+
const { splitterEl, inspectorEl } = instance;
|
|
157
|
+
if (getComputedStyle(inspectorEl).position === "fixed" ? inspectorEl.open : splitterEl.resizable) closeInspector(layoutTarget);
|
|
158
|
+
else openInspector(layoutTarget, showCommand);
|
|
201
159
|
}
|
|
202
160
|
if (typeof window !== "undefined") {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}
|
|
161
|
+
window.blueWeb = window.blueWeb || {};
|
|
162
|
+
window.blueWeb.layout = {
|
|
163
|
+
init,
|
|
164
|
+
dispose,
|
|
165
|
+
instances,
|
|
166
|
+
toggleInspector,
|
|
167
|
+
openInspector,
|
|
168
|
+
closeInspector
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
export { closeInspector, dispose, init, openInspector, toggleInspector };
|
|
@@ -1,51 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25
|
-
args[_key] = arguments[_key];
|
|
26
|
-
}
|
|
27
|
-
originalPushState.apply(history, args);
|
|
28
|
-
modalEl === null || modalEl === void 0 || modalEl.close();
|
|
29
|
-
};
|
|
30
|
-
const originalReplaceState = history.replaceState;
|
|
31
|
-
history.replaceState = function () {
|
|
32
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
33
|
-
args[_key2] = arguments[_key2];
|
|
34
|
-
}
|
|
35
|
-
originalReplaceState.apply(history, args);
|
|
36
|
-
modalEl === null || modalEl === void 0 || modalEl.close();
|
|
37
|
-
};
|
|
1
|
+
// src/js/modal-responsive.ts
|
|
2
|
+
var instances = /* @__PURE__ */ new Map();
|
|
3
|
+
function init(modalEl) {
|
|
4
|
+
if (!modalEl) return;
|
|
5
|
+
if (instances.has(modalEl)) dispose(modalEl);
|
|
6
|
+
if (!modalEl.querySelector(".offcanvas")) return;
|
|
7
|
+
const controller = new AbortController();
|
|
8
|
+
instances.set(modalEl, controller);
|
|
9
|
+
window.addEventListener("popstate", () => modalEl?.close(), { signal: controller.signal });
|
|
10
|
+
window.addEventListener("resize", () => {
|
|
11
|
+
const offcanvasEl = modalEl.querySelector(".offcanvas");
|
|
12
|
+
if (offcanvasEl && getComputedStyle(offcanvasEl).position !== "fixed") modalEl?.close();
|
|
13
|
+
}, { signal: controller.signal });
|
|
14
|
+
const originalPushState = history.pushState;
|
|
15
|
+
history.pushState = function(...args) {
|
|
16
|
+
originalPushState.apply(history, args);
|
|
17
|
+
modalEl?.close();
|
|
18
|
+
};
|
|
19
|
+
const originalReplaceState = history.replaceState;
|
|
20
|
+
history.replaceState = function(...args) {
|
|
21
|
+
originalReplaceState.apply(history, args);
|
|
22
|
+
modalEl?.close();
|
|
23
|
+
};
|
|
38
24
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
25
|
+
function dispose(modalEl) {
|
|
26
|
+
const controller = instances.get(modalEl);
|
|
27
|
+
if (!controller) return;
|
|
28
|
+
controller.abort();
|
|
29
|
+
instances.delete(modalEl);
|
|
44
30
|
}
|
|
45
31
|
if (typeof window !== "undefined") {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
32
|
+
window.blueWeb = window.blueWeb || {};
|
|
33
|
+
window.blueWeb.modalResponsive = {
|
|
34
|
+
init,
|
|
35
|
+
dispose
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export { dispose, init };
|