@window-splitter/vue 1.0.2 → 1.1.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/index.mjs CHANGED
@@ -339,7 +339,7 @@ const fe = {
339
339
  return +t;
340
340
  }
341
341
  };
342
- function xe(e) {
342
+ function Ae(e) {
343
343
  return e.orientation === "horizontal" ? e.dragOvershoot.gt(0) ? "w-resize" : e.dragOvershoot.lt(0) ? "e-resize" : "ew-resize" : e.dragOvershoot.gt(0) ? "n-resize" : e.dragOvershoot.lt(0) ? "s-resize" : "ns-resize";
344
344
  }
345
345
  function ut(e) {
@@ -513,7 +513,7 @@ function bt(e, t) {
513
513
  const a = O(e), r = k({ ...e, items: a }, t);
514
514
  return X(V(e), r.currentValue);
515
515
  }
516
- function Ae(e) {
516
+ function xe(e) {
517
517
  const t = ce(e);
518
518
  let a = !1;
519
519
  return e.items.map((r) => {
@@ -584,10 +584,10 @@ function O(e) {
584
584
  return a;
585
585
  }
586
586
  function ie(e, t) {
587
- var A, E, L, M;
587
+ var x, E, L, M;
588
588
  const a = He(e, t.handleId), r = e.items[a], l = [...e.items];
589
589
  let n = e.orientation === "horizontal" ? t.value.deltaX : t.value.deltaY;
590
- if (t.value.shiftKey && (n *= 15), n === 0)
590
+ if (t.value.shiftKey && (n *= e.shiftAmount ?? 15), n === 0)
591
591
  return {};
592
592
  const o = n / Math.abs(n), i = Le(e, l, a + o, o, "subtract", t.disregardCollapseBuffer);
593
593
  if (!i)
@@ -602,9 +602,9 @@ function ie(e, t) {
602
602
  };
603
603
  const d = e.dragOvershoot.add(n);
604
604
  if (!t.disregardCollapseBuffer) {
605
- const R = d.lt(0) && o > 0, w = d.gt(0) && o > 0, x = d.gt(0) && o < 0, U = d.lt(0) && o < 0, re = u.currentValue.value.add(new y(d).mul(x ? o : 1)), le = S(e, u.min), qe = d.abs().lt(Ce) && // Let the panel expand at it's min size
605
+ const R = d.lt(0) && o > 0, w = d.gt(0) && o > 0, A = d.gt(0) && o < 0, U = d.lt(0) && o < 0, re = u.currentValue.value.add(new y(d).mul(A ? o : 1)), le = S(e, u.min), qe = d.abs().lt(Ce) && // Let the panel expand at it's min size
606
606
  !u.currentValue.value.add(d.abs()).gte(u.min.value) && u.collapsible && u.collapsed && (w || U);
607
- if (re.lte(le) && (d.eq(0) || x || R || qe))
607
+ if (re.lte(le) && (d.eq(0) || A || R || qe))
608
608
  return { dragOvershoot: d };
609
609
  }
610
610
  if (!t.disregardCollapseBuffer && i.collapsible && i.currentValue.value.eq(S(e, i.min))) {
@@ -619,7 +619,7 @@ function ie(e, t) {
619
619
  if (t.disregardCollapseBuffer)
620
620
  u.collapsible && u.collapsed && (u.collapsed = !1);
621
621
  else if (u.collapsible && u.collapsed) {
622
- if ((A = u.onCollapseChange) != null && A.current && u.collapseIsControlled && !t.controlled && !t.isVirtual)
622
+ if ((x = u.onCollapseChange) != null && x.current && u.collapseIsControlled && !t.controlled && !t.isVirtual)
623
623
  return u.onCollapseChange.current(!1), { dragOvershoot: d };
624
624
  const R = (
625
625
  // Take the size it was at
@@ -789,7 +789,8 @@ function St(e, t) {
789
789
  orientation: e.orientation || "horizontal",
790
790
  dragOvershoot: new y(0),
791
791
  groupId: e.groupId || `group-${Pt++}`,
792
- autosaveStrategy: e.autosaveStrategy
792
+ autosaveStrategy: e.autosaveStrategy,
793
+ shiftAmount: e.shiftAmount ?? 15
793
794
  }, o = {
794
795
  prepare: () => {
795
796
  n.items = O(n);
@@ -1055,7 +1056,7 @@ function Ct({ groupId: e, id: t, collapsible: a, collapsed: r }) {
1055
1056
  };
1056
1057
  return a && (l["data-collapsed"] = r), l;
1057
1058
  }
1058
- function xt({ groupId: e, id: t, orientation: a, isDragging: r, activeDragHandleId: l, disabled: n, controlsId: o, min: i, max: u, currentValue: d, groupSize: c }) {
1059
+ function At({ groupId: e, id: t, orientation: a, isDragging: r, activeDragHandleId: l, disabled: n, controlsId: o, min: i, max: u, currentValue: d, groupSize: c }) {
1059
1060
  return {
1060
1061
  id: t,
1061
1062
  role: "separator",
@@ -1072,7 +1073,7 @@ function xt({ groupId: e, id: t, orientation: a, isDragging: r, activeDragHandle
1072
1073
  "aria-valuenow": d ? X(c, d) : void 0
1073
1074
  };
1074
1075
  }
1075
- function At(e, t) {
1076
+ function xt(e, t) {
1076
1077
  const a = new ResizeObserver((l) => {
1077
1078
  const n = {};
1078
1079
  for (const o of l) {
@@ -1203,14 +1204,14 @@ const Et = /* @__PURE__ */ ze({
1203
1204
  defaultCollapsed: m,
1204
1205
  default: s,
1205
1206
  isStaticAtRest: f
1206
- }), A = N(() => {
1207
- var x;
1208
- const w = (x = z == null ? void 0 : z.value) == null ? void 0 : x.items.find((U) => U.id === v);
1207
+ }), x = N(() => {
1208
+ var A;
1209
+ const w = (A = z == null ? void 0 : z.value) == null ? void 0 : A.items.find((U) => U.id === v);
1209
1210
  if (!(!w || !P(w)))
1210
1211
  return w;
1211
1212
  });
1212
1213
  let E = !1;
1213
- A.value ? h == null || h({
1214
+ x.value ? h == null || h({
1214
1215
  type: "rebindPanelCallbacks",
1215
1216
  data: {
1216
1217
  id: v,
@@ -1221,18 +1222,18 @@ const Et = /* @__PURE__ */ ze({
1221
1222
  var le;
1222
1223
  const w = (le = z == null ? void 0 : z.value) == null ? void 0 : le.groupId;
1223
1224
  if (!w || !E) return;
1224
- const x = document.getElementById(w);
1225
- if (!x) return;
1225
+ const A = document.getElementById(w);
1226
+ if (!A) return;
1226
1227
  const U = document.getElementById(v);
1227
1228
  if (!U) return;
1228
- const re = Array.from(x.children).indexOf(U);
1229
+ const re = Array.from(A.children).indexOf(U);
1229
1230
  typeof re == "number" && (h == null || h({
1230
1231
  type: "registerDynamicPanel",
1231
1232
  data: { ...C(), order: re }
1232
1233
  }), E = !1);
1233
1234
  });
1234
1235
  const L = N(
1235
- () => !E && dt(C(), A.value)
1236
+ () => !E && dt(C(), x.value)
1236
1237
  );
1237
1238
  se(() => {
1238
1239
  L.value && (h == null || h({ type: "updateConstraints", data: C() }));
@@ -1242,19 +1243,19 @@ const Et = /* @__PURE__ */ ze({
1242
1243
  getId: () => v,
1243
1244
  collapse: () => {
1244
1245
  var w;
1245
- (w = A.value) != null && w.collapsible && (h == null || h({ type: "collapsePanel", panelId: v, controlled: !0 }));
1246
+ (w = x.value) != null && w.collapsible && (h == null || h({ type: "collapsePanel", panelId: v, controlled: !0 }));
1246
1247
  },
1247
1248
  isCollapsed: () => {
1248
- var w, x;
1249
- return !!((w = A.value) != null && w.collapsible && ((x = A.value) != null && x.collapsed));
1249
+ var w, A;
1250
+ return !!((w = x.value) != null && w.collapsible && ((A = x.value) != null && A.collapsed));
1250
1251
  },
1251
1252
  expand: () => {
1252
1253
  var w;
1253
- (w = A.value) != null && w.collapsible && (h == null || h({ type: "expandPanel", panelId: v, controlled: !0 }));
1254
+ (w = x.value) != null && w.collapsible && (h == null || h({ type: "expandPanel", panelId: v, controlled: !0 }));
1254
1255
  },
1255
1256
  isExpanded: () => {
1256
- var w, x;
1257
- return !!((w = A.value) != null && w.collapsible && !((x = A.value) != null && x.collapsed));
1257
+ var w, A;
1258
+ return !!((w = x.value) != null && w.collapsible && !((A = x.value) != null && A.collapsed));
1258
1259
  },
1259
1260
  getPixelSize: () => wt(z.value, v),
1260
1261
  getPercentageSize: () => bt(z.value, v),
@@ -1263,7 +1264,7 @@ const Et = /* @__PURE__ */ ze({
1263
1264
  const M = N(
1264
1265
  () => {
1265
1266
  var w;
1266
- return (w = A.value) == null ? void 0 : w.collapseIsControlled;
1267
+ return (w = x.value) == null ? void 0 : w.collapseIsControlled;
1267
1268
  }
1268
1269
  );
1269
1270
  se(() => {
@@ -1272,12 +1273,12 @@ const Et = /* @__PURE__ */ ze({
1272
1273
  });
1273
1274
  });
1274
1275
  const R = N(() => {
1275
- var x;
1276
- const w = A.value;
1276
+ var A;
1277
+ const w = x.value;
1277
1278
  return {
1278
1279
  ...p,
1279
1280
  ...Ct({
1280
- groupId: (x = z == null ? void 0 : z.value) == null ? void 0 : x.groupId,
1281
+ groupId: (A = z == null ? void 0 : z.value) == null ? void 0 : A.groupId,
1281
1282
  id: v,
1282
1283
  collapsible: w == null ? void 0 : w.collapsible,
1283
1284
  collapsed: w == null ? void 0 : w.collapsed
@@ -1289,7 +1290,7 @@ const Et = /* @__PURE__ */ ze({
1289
1290
  }
1290
1291
  };
1291
1292
  });
1292
- return (w, x) => (Ie(), ye("div", Te(Fe(R.value)), [
1293
+ return (w, A) => (Ie(), ye("div", Te(Fe(R.value)), [
1293
1294
  Pe(w.$slots, "default")
1294
1295
  ], 16));
1295
1296
  }
@@ -1300,10 +1301,11 @@ const Et = /* @__PURE__ */ ze({
1300
1301
  autosaveId: {},
1301
1302
  orientation: { default: "horizontal" },
1302
1303
  autosaveStrategy: { default: "localStorage" },
1304
+ shiftAmount: {},
1303
1305
  id: {}
1304
1306
  },
1305
1307
  setup(e, { expose: t }) {
1306
- const a = ke(e, ["orientation", "autosaveStrategy", "snapshot", "autosaveId", "id"]);
1308
+ const a = ke(e, ["orientation", "autosaveStrategy", "snapshot", "autosaveId", "id", "shiftAmount"]);
1307
1309
  let r = e.snapshot;
1308
1310
  if (!r && typeof window < "u" && e.autosaveId && e.autosaveStrategy === "localStorage") {
1309
1311
  const f = localStorage.getItem(e.autosaveId);
@@ -1316,6 +1318,7 @@ const Et = /* @__PURE__ */ ze({
1316
1318
  orientation: e.orientation,
1317
1319
  groupId: n,
1318
1320
  autosaveStrategy: e.autosaveStrategy,
1321
+ shiftAmount: e.shiftAmount,
1319
1322
  ...r ? ut(r) : void 0
1320
1323
  },
1321
1324
  (f) => {
@@ -1326,7 +1329,7 @@ const Et = /* @__PURE__ */ ze({
1326
1329
  l.value = !1;
1327
1330
  });
1328
1331
  const d = de(o), c = N(() => {
1329
- const f = Ae(d.value);
1332
+ const f = xe(d.value);
1330
1333
  return {
1331
1334
  height: "100%",
1332
1335
  display: "grid",
@@ -1351,7 +1354,7 @@ const Et = /* @__PURE__ */ ze({
1351
1354
  return W(() => {
1352
1355
  se(() => {
1353
1356
  s.value;
1354
- const f = At(n, (g) => {
1357
+ const f = xt(n, (g) => {
1355
1358
  i({ type: "setActualItemsSize", childrenSizes: g });
1356
1359
  });
1357
1360
  je(f);
@@ -1360,7 +1363,7 @@ const Et = /* @__PURE__ */ ze({
1360
1363
  getId: () => n,
1361
1364
  getPixelSizes: () => vt(d.value),
1362
1365
  getPercentageSizes: () => zt(d.value),
1363
- getTemplate: () => Ae({
1366
+ getTemplate: () => xe({
1364
1367
  ...d.value,
1365
1368
  items: O(d.value)
1366
1369
  }),
@@ -1429,7 +1432,7 @@ const Et = /* @__PURE__ */ ze({
1429
1432
  const { moveProps: m } = Vt({
1430
1433
  onMoveStart: () => {
1431
1434
  var g;
1432
- l == null || l({ type: "dragHandleStart", handleId: r }), (g = e.onDragStart) == null || g.call(e), n != null && n.value && (document.body.style.cursor = xe(n == null ? void 0 : n.value) || "auto");
1435
+ l == null || l({ type: "dragHandleStart", handleId: r }), (g = e.onDragStart) == null || g.call(e), n != null && n.value && (document.body.style.cursor = Ae(n == null ? void 0 : n.value) || "auto");
1433
1436
  },
1434
1437
  onMove: (g) => {
1435
1438
  var p;
@@ -1447,16 +1450,16 @@ const Et = /* @__PURE__ */ ze({
1447
1450
  } catch {
1448
1451
  }
1449
1452
  }, f = N(() => {
1450
- var h, z, I, C, A, E, L, M, R;
1453
+ var h, z, I, C, x, E, L, M, R;
1451
1454
  const g = (h = n == null ? void 0 : n.value) == null ? void 0 : h.items.findIndex((w) => w.id === r);
1452
1455
  if (!g) return { id: r };
1453
1456
  const p = (z = n == null ? void 0 : n.value) == null ? void 0 : z.items[g], v = (I = n == null ? void 0 : n.value) == null ? void 0 : I.items[g - 1];
1454
1457
  return !v || !P(v) ? { id: r } : {
1455
1458
  ...t,
1456
- ...xt({
1459
+ ...At({
1457
1460
  groupId: (C = n == null ? void 0 : n.value) == null ? void 0 : C.groupId,
1458
1461
  id: r,
1459
- orientation: ((A = n == null ? void 0 : n.value) == null ? void 0 : A.orientation) || "horizontal",
1462
+ orientation: ((x = n == null ? void 0 : n.value) == null ? void 0 : x.orientation) || "horizontal",
1460
1463
  isDragging: ((E = n == null ? void 0 : n.value) == null ? void 0 : E.activeDragHandleId) === r,
1461
1464
  activeDragHandleId: (L = n == null ? void 0 : n.value) == null ? void 0 : L.activeDragHandleId,
1462
1465
  disabled: e.disabled,
@@ -1471,7 +1474,7 @@ const Et = /* @__PURE__ */ ze({
1471
1474
  m.onKeyDown(w), s(w);
1472
1475
  },
1473
1476
  style: {
1474
- cursor: n != null && n.value ? xe(n.value) : void 0,
1477
+ cursor: n != null && n.value ? Ae(n.value) : void 0,
1475
1478
  width: ((M = n == null ? void 0 : n.value) == null ? void 0 : M.orientation) === "horizontal" ? `${p == null ? void 0 : p.size.value.toNumber()}px` : "100%",
1476
1479
  height: ((R = n == null ? void 0 : n.value) == null ? void 0 : R.orientation) === "vertical" ? `${p == null ? void 0 : p.size.value.toNumber()}px` : "100%"
1477
1480
  }