ninegrid2 6.1156.0 → 6.1157.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.
@@ -121946,23 +121946,30 @@ class NxLayout2 extends HTMLElement {
121946
121946
  };
121947
121947
 
121948
121948
  #position = () => {
121949
- // 요소를 복제하여 너비를 측정하는 헬퍼 함수
121950
121949
  const getRenderedWidthWithClone = (element) => {
121951
- // 1. 요소를 깊은 복제(deep clone)합니다.
121950
+ // 1. 요소의 모든 계산된 스타일을 가져옵니다.
121951
+ const computedStyle = window.getComputedStyle(element);
121952
+
121953
+ // 2. 요소를 깊은 복제합니다.
121952
121954
  const clone = element.cloneNode(true);
121953
121955
 
121954
- // 2. 복제본을 시각적으로 숨기고 레이아웃에 포함시킬 스타일을 적용합니다.
121956
+ // 3. 복사본에 가져온 모든 스타일을 적용합니다.
121957
+ for (const prop of computedStyle) {
121958
+ clone.style[prop] = computedStyle.getPropertyValue(prop);
121959
+ }
121960
+
121961
+ // 4. 복제본을 시각적으로 숨기고 레이아웃에 포함시킬 스타일을 적용합니다.
121955
121962
  clone.style.position = 'absolute';
121956
121963
  clone.style.left = '-9999px';
121957
121964
  clone.style.visibility = 'hidden';
121958
121965
 
121959
- // 3. 복제본을 body에 임시로 추가하여 렌더링되도록 합니다.
121966
+ // 5. 복제본을 body에 임시로 추가하여 렌더링되도록 합니다.
121960
121967
  document.body.appendChild(clone);
121961
121968
 
121962
- // 4. 너비 측정
121969
+ // 6. 너비 측정
121963
121970
  const width = clone.getBoundingClientRect().width;
121964
121971
 
121965
- // 5. 측정이 끝나면 복제본을 제거합니다.
121972
+ // 7. 측정이 끝나면 복제본을 제거합니다.
121966
121973
  document.body.removeChild(clone);
121967
121974
 
121968
121975
  return width;
@@ -121970,7 +121977,6 @@ class NxLayout2 extends HTMLElement {
121970
121977
 
121971
121978
  const allLabels = [];
121972
121979
 
121973
- // 모든 .row에서 .label 요소를 찾아서 위치별로 그룹화
121974
121980
  this.querySelectorAll(".row").forEach((el) => {
121975
121981
  const labelsInRow = el.querySelectorAll(".label");
121976
121982
  labelsInRow.forEach((label, index) => {
@@ -121981,10 +121987,8 @@ class NxLayout2 extends HTMLElement {
121981
121987
  });
121982
121988
  });
121983
121989
 
121984
- // 각 그룹별로 최대 너비를 계산하고 적용
121985
121990
  allLabels.forEach((labelGroup) => {
121986
121991
  if (labelGroup && labelGroup.length > 0) {
121987
- // ⭐⭐ 헬퍼 함수를 사용하여 너비 계산 ⭐⭐
121988
121992
  const renderedWidths = labelGroup.map(label => getRenderedWidthWithClone(label));
121989
121993
  const maxWidth = Math.max(...renderedWidths);
121990
121994
 
@@ -121942,23 +121942,30 @@ class NxLayout2 extends HTMLElement {
121942
121942
  };
121943
121943
 
121944
121944
  #position = () => {
121945
- // 요소를 복제하여 너비를 측정하는 헬퍼 함수
121946
121945
  const getRenderedWidthWithClone = (element) => {
121947
- // 1. 요소를 깊은 복제(deep clone)합니다.
121946
+ // 1. 요소의 모든 계산된 스타일을 가져옵니다.
121947
+ const computedStyle = window.getComputedStyle(element);
121948
+
121949
+ // 2. 요소를 깊은 복제합니다.
121948
121950
  const clone = element.cloneNode(true);
121949
121951
 
121950
- // 2. 복제본을 시각적으로 숨기고 레이아웃에 포함시킬 스타일을 적용합니다.
121952
+ // 3. 복사본에 가져온 모든 스타일을 적용합니다.
121953
+ for (const prop of computedStyle) {
121954
+ clone.style[prop] = computedStyle.getPropertyValue(prop);
121955
+ }
121956
+
121957
+ // 4. 복제본을 시각적으로 숨기고 레이아웃에 포함시킬 스타일을 적용합니다.
121951
121958
  clone.style.position = 'absolute';
121952
121959
  clone.style.left = '-9999px';
121953
121960
  clone.style.visibility = 'hidden';
121954
121961
 
121955
- // 3. 복제본을 body에 임시로 추가하여 렌더링되도록 합니다.
121962
+ // 5. 복제본을 body에 임시로 추가하여 렌더링되도록 합니다.
121956
121963
  document.body.appendChild(clone);
121957
121964
 
121958
- // 4. 너비 측정
121965
+ // 6. 너비 측정
121959
121966
  const width = clone.getBoundingClientRect().width;
121960
121967
 
121961
- // 5. 측정이 끝나면 복제본을 제거합니다.
121968
+ // 7. 측정이 끝나면 복제본을 제거합니다.
121962
121969
  document.body.removeChild(clone);
121963
121970
 
121964
121971
  return width;
@@ -121966,7 +121973,6 @@ class NxLayout2 extends HTMLElement {
121966
121973
 
121967
121974
  const allLabels = [];
121968
121975
 
121969
- // 모든 .row에서 .label 요소를 찾아서 위치별로 그룹화
121970
121976
  this.querySelectorAll(".row").forEach((el) => {
121971
121977
  const labelsInRow = el.querySelectorAll(".label");
121972
121978
  labelsInRow.forEach((label, index) => {
@@ -121977,10 +121983,8 @@ class NxLayout2 extends HTMLElement {
121977
121983
  });
121978
121984
  });
121979
121985
 
121980
- // 각 그룹별로 최대 너비를 계산하고 적용
121981
121986
  allLabels.forEach((labelGroup) => {
121982
121987
  if (labelGroup && labelGroup.length > 0) {
121983
- // ⭐⭐ 헬퍼 함수를 사용하여 너비 계산 ⭐⭐
121984
121988
  const renderedWidths = labelGroup.map(label => getRenderedWidthWithClone(label));
121985
121989
  const maxWidth = Math.max(...renderedWidths);
121986
121990
 
@@ -59,23 +59,30 @@ class NxLayout2 extends HTMLElement {
59
59
  };
60
60
 
61
61
  #position = () => {
62
- // 요소를 복제하여 너비를 측정하는 헬퍼 함수
63
62
  const getRenderedWidthWithClone = (element) => {
64
- // 1. 요소를 깊은 복제(deep clone)합니다.
63
+ // 1. 요소의 모든 계산된 스타일을 가져옵니다.
64
+ const computedStyle = window.getComputedStyle(element);
65
+
66
+ // 2. 요소를 깊은 복제합니다.
65
67
  const clone = element.cloneNode(true);
66
68
 
67
- // 2. 복제본을 시각적으로 숨기고 레이아웃에 포함시킬 스타일을 적용합니다.
69
+ // 3. 복사본에 가져온 모든 스타일을 적용합니다.
70
+ for (const prop of computedStyle) {
71
+ clone.style[prop] = computedStyle.getPropertyValue(prop);
72
+ }
73
+
74
+ // 4. 복제본을 시각적으로 숨기고 레이아웃에 포함시킬 스타일을 적용합니다.
68
75
  clone.style.position = 'absolute';
69
76
  clone.style.left = '-9999px';
70
77
  clone.style.visibility = 'hidden';
71
78
 
72
- // 3. 복제본을 body에 임시로 추가하여 렌더링되도록 합니다.
79
+ // 5. 복제본을 body에 임시로 추가하여 렌더링되도록 합니다.
73
80
  document.body.appendChild(clone);
74
81
 
75
- // 4. 너비 측정
82
+ // 6. 너비 측정
76
83
  const width = clone.getBoundingClientRect().width;
77
84
 
78
- // 5. 측정이 끝나면 복제본을 제거합니다.
85
+ // 7. 측정이 끝나면 복제본을 제거합니다.
79
86
  document.body.removeChild(clone);
80
87
 
81
88
  return width;
@@ -83,7 +90,6 @@ class NxLayout2 extends HTMLElement {
83
90
 
84
91
  const allLabels = [];
85
92
 
86
- // 모든 .row에서 .label 요소를 찾아서 위치별로 그룹화
87
93
  this.querySelectorAll(".row").forEach((el) => {
88
94
  const labelsInRow = el.querySelectorAll(".label");
89
95
  labelsInRow.forEach((label, index) => {
@@ -94,10 +100,8 @@ class NxLayout2 extends HTMLElement {
94
100
  });
95
101
  });
96
102
 
97
- // 각 그룹별로 최대 너비를 계산하고 적용
98
103
  allLabels.forEach((labelGroup) => {
99
104
  if (labelGroup && labelGroup.length > 0) {
100
- // ⭐⭐ 헬퍼 함수를 사용하여 너비 계산 ⭐⭐
101
105
  const renderedWidths = labelGroup.map(label => getRenderedWidthWithClone(label));
102
106
  const maxWidth = Math.max(...renderedWidths);
103
107
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.1156.0",
4
+ "version": "6.1157.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -59,23 +59,30 @@ class NxLayout2 extends HTMLElement {
59
59
  };
60
60
 
61
61
  #position = () => {
62
- // 요소를 복제하여 너비를 측정하는 헬퍼 함수
63
62
  const getRenderedWidthWithClone = (element) => {
64
- // 1. 요소를 깊은 복제(deep clone)합니다.
63
+ // 1. 요소의 모든 계산된 스타일을 가져옵니다.
64
+ const computedStyle = window.getComputedStyle(element);
65
+
66
+ // 2. 요소를 깊은 복제합니다.
65
67
  const clone = element.cloneNode(true);
66
68
 
67
- // 2. 복제본을 시각적으로 숨기고 레이아웃에 포함시킬 스타일을 적용합니다.
69
+ // 3. 복사본에 가져온 모든 스타일을 적용합니다.
70
+ for (const prop of computedStyle) {
71
+ clone.style[prop] = computedStyle.getPropertyValue(prop);
72
+ }
73
+
74
+ // 4. 복제본을 시각적으로 숨기고 레이아웃에 포함시킬 스타일을 적용합니다.
68
75
  clone.style.position = 'absolute';
69
76
  clone.style.left = '-9999px';
70
77
  clone.style.visibility = 'hidden';
71
78
 
72
- // 3. 복제본을 body에 임시로 추가하여 렌더링되도록 합니다.
79
+ // 5. 복제본을 body에 임시로 추가하여 렌더링되도록 합니다.
73
80
  document.body.appendChild(clone);
74
81
 
75
- // 4. 너비 측정
82
+ // 6. 너비 측정
76
83
  const width = clone.getBoundingClientRect().width;
77
84
 
78
- // 5. 측정이 끝나면 복제본을 제거합니다.
85
+ // 7. 측정이 끝나면 복제본을 제거합니다.
79
86
  document.body.removeChild(clone);
80
87
 
81
88
  return width;
@@ -83,7 +90,6 @@ class NxLayout2 extends HTMLElement {
83
90
 
84
91
  const allLabels = [];
85
92
 
86
- // 모든 .row에서 .label 요소를 찾아서 위치별로 그룹화
87
93
  this.querySelectorAll(".row").forEach((el) => {
88
94
  const labelsInRow = el.querySelectorAll(".label");
89
95
  labelsInRow.forEach((label, index) => {
@@ -94,10 +100,8 @@ class NxLayout2 extends HTMLElement {
94
100
  });
95
101
  });
96
102
 
97
- // 각 그룹별로 최대 너비를 계산하고 적용
98
103
  allLabels.forEach((labelGroup) => {
99
104
  if (labelGroup && labelGroup.length > 0) {
100
- // ⭐⭐ 헬퍼 함수를 사용하여 너비 계산 ⭐⭐
101
105
  const renderedWidths = labelGroup.map(label => getRenderedWidthWithClone(label));
102
106
  const maxWidth = Math.max(...renderedWidths);
103
107