@schukai/monster 5.2.1 → 5.2.3

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/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
 
4
4
 
5
+ ## [5.2.3] - 2026-11-09
6
+
7
+ ### Bug Fixes
8
+
9
+ - **datatable:** preserve neighboring column widths during resize ([#608](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/608))
10
+
11
+
12
+
13
+ ## [5.2.2] - 2026-11-08
14
+
15
+ ### Bug Fixes
16
+
17
+ - **updater:** scope inserted node ownership to its container ([#607](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/607))
18
+ ### Tests
19
+
20
+ - **tabs:** normalize mocked button geometry across browsers ([#607](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/607))
21
+
22
+
23
+
5
24
  ## [5.2.1] - 2026-10-12
6
25
 
7
26
  ### Bug Fixes
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.6"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","exports":{".":"./source/monster.mjs","./CHANGELOG.md":"./CHANGELOG.md","./LICENSE":"./LICENSE","./README.md":"./README.md","./documentation/migrations/monster-5-options.md":"./documentation/migrations/monster-5-options.md","./package.json":"./package.json","./source/*":"./source/*","./test/*":"./test/*"},"files":["source","test/cases","test/util","documentation/migrations/monster-5-options.md","CHANGELOG.md"],"homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"sideEffects":["./source/monster.mjs","./source/components/**","./source/i18n/**","./test/**"],"type":"module","version":"5.2.1"}
1
+ {"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.6"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","exports":{".":"./source/monster.mjs","./CHANGELOG.md":"./CHANGELOG.md","./LICENSE":"./LICENSE","./README.md":"./README.md","./documentation/migrations/monster-5-options.md":"./documentation/migrations/monster-5-options.md","./package.json":"./package.json","./source/*":"./source/*","./test/*":"./test/*"},"files":["source","test/cases","test/util","documentation/migrations/monster-5-options.md","CHANGELOG.md"],"homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"sideEffects":["./source/monster.mjs","./source/components/**","./source/i18n/**","./test/**"],"type":"module","version":"5.2.3"}
@@ -299,7 +299,7 @@ function updateStruct() {
299
299
  const isResizable = this.getInternal("resizable");
300
300
 
301
301
  let order = "";
302
- let htmlContent = label;
302
+ let htmlContent = `<span class="header-label">${label}</span>`;
303
303
 
304
304
  if (field) {
305
305
  if (direction) {
@@ -833,6 +833,7 @@ function initEventHandler() {
833
833
  let resizingColumnIndex = -1;
834
834
  let startX = 0;
835
835
  let startWidth = 0;
836
+ let resizeColumnWidths = null;
836
837
 
837
838
  // --- Table drag scrolling state ---
838
839
  let isTableDragging = false;
@@ -1013,6 +1014,7 @@ function initEventHandler() {
1013
1014
  "resize-handle",
1014
1015
  );
1015
1016
  if (!resizeHandle) return;
1017
+ if (event.button !== 0 || event.isPrimary === false) return;
1016
1018
 
1017
1019
  event.preventDefault();
1018
1020
  isResizing = true;
@@ -1023,13 +1025,24 @@ function initEventHandler() {
1023
1025
  10,
1024
1026
  );
1025
1027
  startX = event.clientX;
1026
- startWidth = headerCell.offsetWidth;
1028
+ startWidth = headerCell.getBoundingClientRect().width;
1029
+ const headers = self.getOption("headers");
1030
+ resizeColumnWidths = Array.from(
1031
+ self[gridHeadersElementSymbol].children,
1032
+ ).flatMap((cell) => {
1033
+ const index = Number(cell.getAttribute("data-monster-index"));
1034
+ if (headers[index].mode === ATTRIBUTE_DATATABLE_MODE_HIDDEN) return [];
1035
+ return [
1036
+ { header: headers[index], width: cell.getBoundingClientRect().width },
1037
+ ];
1038
+ });
1027
1039
 
1028
1040
  // Capture to prevent losing events during fast dragging
1029
- event.target.setPointerCapture?.(event.pointerId);
1041
+ self[gridHeadersElementSymbol].setPointerCapture?.(event.pointerId);
1030
1042
 
1031
1043
  getWindow().addEventListener("pointermove", onPointerMove);
1032
1044
  getWindow().addEventListener("pointerup", onPointerUp);
1045
+ getWindow().addEventListener("pointercancel", onPointerUp);
1033
1046
 
1034
1047
  // Global cursor styling during resizing
1035
1048
  self.shadowRoot.host.classList.add("is-resizing");
@@ -1039,24 +1052,20 @@ function initEventHandler() {
1039
1052
  if (!isResizing) return;
1040
1053
 
1041
1054
  const deltaX = event.clientX - startX;
1042
- let newWidth = startWidth + deltaX;
1055
+ if (deltaX === 0 && resizeColumnWidths !== null) return;
1043
1056
 
1044
1057
  const headers = self.getOption("headers");
1045
1058
  const resizingHeader = headers[resizingColumnIndex];
1046
1059
 
1047
- const minWidth = 50;
1048
-
1049
- const visibleHeaders = headers.filter(
1050
- (h) => h.getInternal("mode") !== ATTRIBUTE_DATATABLE_MODE_HIDDEN,
1051
- );
1052
- const numOtherVisibleColumns =
1053
- visibleHeaders.length > 1 ? visibleHeaders.length - 1 : 0;
1054
-
1055
- const reservedSpaceForOthers = numOtherVisibleColumns * 50;
1056
- const tableContainerWidth = self[gridElementSymbol].clientWidth;
1057
- const maxWidth = tableContainerWidth - reservedSpaceForOthers;
1058
-
1059
- newWidth = Math.max(minWidth, Math.min(newWidth, maxWidth));
1060
+ // Keep neighboring tracks at their rendered widths. Overflow belongs to
1061
+ // the table scroll container, rather than collapsing flexible columns.
1062
+ if (resizeColumnWidths !== null) {
1063
+ for (const { header, width } of resizeColumnWidths) {
1064
+ if (header !== resizingHeader) header.setInternal("grid", `${width}px`);
1065
+ }
1066
+ resizeColumnWidths = null;
1067
+ }
1068
+ const newWidth = Math.max(50, startWidth + deltaX);
1060
1069
 
1061
1070
  resizingHeader.setInternal("grid", `${newWidth}px`);
1062
1071
 
@@ -1067,8 +1076,10 @@ function initEventHandler() {
1067
1076
  if (!isResizing) return;
1068
1077
 
1069
1078
  isResizing = false;
1079
+ resizeColumnWidths = null;
1070
1080
  getWindow().removeEventListener("pointermove", onPointerMove);
1071
1081
  getWindow().removeEventListener("pointerup", onPointerUp);
1082
+ getWindow().removeEventListener("pointercancel", onPointerUp);
1072
1083
 
1073
1084
  self.shadowRoot.host.classList.remove("is-resizing");
1074
1085
  };
@@ -204,14 +204,17 @@
204
204
  display: flex;
205
205
  align-items: center;
206
206
  justify-content: flex-start;
207
+ min-width: 0;
207
208
  overflow: visible;
208
209
  padding-right: var(
209
210
  --monster-datatable-header-cell-padding-inline-end,
210
211
  28px
211
212
  );
212
213
 
214
+ & .header-label,
213
215
  & a[data-monster-sortable] {
214
216
  flex-grow: 1;
217
+ min-width: 0;
215
218
  overflow: hidden;
216
219
  text-overflow: ellipsis;
217
220
  white-space: nowrap;