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