@ninebone/util 1.0.19 → 1.0.21
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/nine-util.js +33 -22
- package/dist/nine-util.js.map +1 -1
- package/dist/nine-util.umd.js +1 -1
- package/dist/nine-util.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-util.js
CHANGED
|
@@ -9,7 +9,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
9
9
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
10
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
11
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
12
|
-
var _name, _color, _Trace_instances, isTraceEnabled_fn, _a, _timer, _queue, _delay, _TaskDebouncer_instances, flush_fn, _request, _shift, _dialog, _init, _onMouseDown, _onTouchStart, _NineUxUtil_instances, prepare_fn, _mode, _detectMode, _startDrag, _init2, _prepareLayout;
|
|
12
|
+
var _name, _color, _Trace_instances, isTraceEnabled_fn, _a, _timer, _queue, _delay, _TaskDebouncer_instances, flush_fn, _request, _shift, _dialog, _init, _onMouseDown, _onTouchStart, _NineUxUtil_instances, prepare_fn, _mode, _isSiblingOnly, _detectMode, _startDrag, _init2, _prepareLayout;
|
|
13
13
|
import React from "react";
|
|
14
14
|
import { createRoot } from "react-dom/client";
|
|
15
15
|
const listeners = /* @__PURE__ */ new Set();
|
|
@@ -1130,6 +1130,11 @@ class UxSplitter extends HTMLElement {
|
|
|
1130
1130
|
constructor() {
|
|
1131
1131
|
super();
|
|
1132
1132
|
__privateAdd(this, _mode);
|
|
1133
|
+
__privateAdd(this, _isSiblingOnly, () => {
|
|
1134
|
+
const attr = this.getAttribute("only-sibling");
|
|
1135
|
+
if (attr === null) return false;
|
|
1136
|
+
return attr.toLowerCase() === "false" ? false : true;
|
|
1137
|
+
});
|
|
1133
1138
|
__privateAdd(this, _detectMode, (el) => {
|
|
1134
1139
|
const prev = el.previousElementSibling;
|
|
1135
1140
|
const next = el.nextElementSibling;
|
|
@@ -1247,27 +1252,32 @@ class UxSplitter extends HTMLElement {
|
|
|
1247
1252
|
trace$1.log(`[Debug] Panel[${index}] (${isChartPanel ? "Canvas" : "Normal"}): Current=${currentSize.toFixed(2)}, New=${(panel === prev ? newPrevSize : panel === next ? newNextSize : initialSizes[index]).toFixed(2)}`);
|
|
1248
1253
|
});
|
|
1249
1254
|
trace$1.log(`[Debug] ---------------------------`);
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
if (
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
newSize = newNextSize;
|
|
1257
|
-
} else {
|
|
1258
|
-
newSize = initialSizes[index];
|
|
1255
|
+
if (__privateGet(this, _isSiblingOnly).call(this)) {
|
|
1256
|
+
const prev2 = this.previousElementSibling;
|
|
1257
|
+
const next2 = this.nextElementSibling;
|
|
1258
|
+
if (prev2 && next2) {
|
|
1259
|
+
prev2.style.flex = `0 0 ${newPrevSize}px`;
|
|
1260
|
+
next2.style.flex = `0 0 ${newNextSize}px`;
|
|
1259
1261
|
}
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
panel
|
|
1264
|
-
|
|
1265
|
-
panel
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1262
|
+
} else {
|
|
1263
|
+
allPanels.forEach((panel, index) => {
|
|
1264
|
+
let newSize;
|
|
1265
|
+
if (panel === prev) {
|
|
1266
|
+
newSize = newPrevSize;
|
|
1267
|
+
} else if (panel === next) {
|
|
1268
|
+
newSize = newNextSize;
|
|
1269
|
+
} else {
|
|
1270
|
+
newSize = initialSizes[index];
|
|
1271
|
+
}
|
|
1272
|
+
const newFlexBasis = newSize / totalFlexSpace;
|
|
1273
|
+
trace$1.log(panel);
|
|
1274
|
+
if (panel.classList.contains("sidebar")) {
|
|
1275
|
+
panel.style.flex = `0 0 ${newSize}px`;
|
|
1276
|
+
} else {
|
|
1277
|
+
panel.style.flex = `${newFlexBasis} ${newFlexBasis} 0`;
|
|
1278
|
+
}
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1271
1281
|
};
|
|
1272
1282
|
window.addEventListener("mousemove", onMove);
|
|
1273
1283
|
window.addEventListener("mouseup", onUp);
|
|
@@ -1282,7 +1292,7 @@ class UxSplitter extends HTMLElement {
|
|
|
1282
1292
|
const htmlTmpl = document.createElement("template");
|
|
1283
1293
|
htmlTmpl.innerHTML = `
|
|
1284
1294
|
<style>
|
|
1285
|
-
@import "https://cdn.jsdelivr.net/npm/@ninebone/util@${"1.0.
|
|
1295
|
+
@import "https://cdn.jsdelivr.net/npm/@ninebone/util@${"1.0.21"}/dist/css/nine-util.css";
|
|
1286
1296
|
${customImport}
|
|
1287
1297
|
</style>
|
|
1288
1298
|
${gripTmpl}
|
|
@@ -1322,6 +1332,7 @@ class UxSplitter extends HTMLElement {
|
|
|
1322
1332
|
}
|
|
1323
1333
|
}
|
|
1324
1334
|
_mode = new WeakMap();
|
|
1335
|
+
_isSiblingOnly = new WeakMap();
|
|
1325
1336
|
_detectMode = new WeakMap();
|
|
1326
1337
|
_startDrag = new WeakMap();
|
|
1327
1338
|
_init2 = new WeakMap();
|