ninegrid2 6.752.0 → 6.754.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.
@@ -120963,7 +120963,6 @@ class nxTab extends HTMLElement {
120963
120963
  this.shadowRoot.querySelectorAll('.tab-page:not(.active)').forEach(el => { el.classList.add('exit-right'); });
120964
120964
 
120965
120965
  const resizeObserver = new ResizeObserver(() => {
120966
- console.log("111");
120967
120966
  const activeContent = this.shadowRoot.querySelector('.tab-page.active');
120968
120967
  if (activeContent) {
120969
120968
  this.shadowRoot.querySelector('.tab-pages').style.height = `${activeContent.scrollHeight}px`;
@@ -121167,30 +121166,60 @@ class nxSplitter extends HTMLElement {
121167
121166
  return allSplitters.at(-1) === this;
121168
121167
  };
121169
121168
 
121169
+ #getSiblingSizes = () => {
121170
+ const parent = this.parentElement;
121171
+ if (!parent) return [];
121172
+
121173
+ const children = Array.from(parent.children);
121174
+ return children.map((child) => {
121175
+ const rect = child.getBoundingClientRect();
121176
+ return {
121177
+ element: child,
121178
+ width: child.offsetWidth,
121179
+ height: child.offsetHeight,
121180
+ rect: {
121181
+ x: rect.x,
121182
+ y: rect.y,
121183
+ width: rect.width,
121184
+ height: rect.height,
121185
+ }
121186
+ };
121187
+ });
121188
+ };
121189
+
121170
121190
  #prepareLayout = () => {
121191
+
121192
+
121193
+
121171
121194
  const isHorizontal = this.#mode === "h";
121172
- const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
121195
+ isHorizontal ? this.offsetWidth : this.offsetHeight;
121173
121196
  const prev = this.previousElementSibling;
121174
121197
  const next = this.nextElementSibling;
121175
121198
  const parent = this.parentElement;
121176
121199
  if (!prev || !next || !parent) return;
121177
121200
 
121178
- isHorizontal
121201
+ const siblingSize = this.#getSiblingSizes();
121202
+ console.log(siblingSize);
121203
+
121204
+ const parentSize = isHorizontal
121179
121205
  ? parent.getBoundingClientRect().width
121180
121206
  : parent.getBoundingClientRect().height;
121181
121207
 
121182
121208
  // 현재 패널 크기 측정
121183
121209
  const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
121184
- const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
121185
- const totalPanelSize = prevSize + nextSize;
121210
+ isHorizontal ? next.offsetWidth : next.offsetHeight;
121211
+ const totalPanelSize = isHorizontal ? siblingSize.width : siblingSize.height;
121186
121212
 
121187
121213
  // 현재 비율 계산
121188
- ///const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
121189
- const prevRatio = totalPanelSize ? prevSize / (totalPanelSize + splitterSize) : 0.5;
121214
+ const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
121190
121215
 
121191
- const newPrevSize = (totalPanelSize + splitterSize) * prevRatio;
121216
+ const newPrevSize = parentSize * prevRatio;
121192
121217
  const newNextSize = totalPanelSize - newPrevSize;
121193
121218
 
121219
+
121220
+
121221
+ console.log(newPrevSize, newNextSize, prevRatio);
121222
+
121194
121223
  if (isHorizontal) {
121195
121224
  prev.style.width = `${newPrevSize}px`;
121196
121225
  //this.style.width = `${splitterSize}px`;
@@ -120959,7 +120959,6 @@ class nxTab extends HTMLElement {
120959
120959
  this.shadowRoot.querySelectorAll('.tab-page:not(.active)').forEach(el => { el.classList.add('exit-right'); });
120960
120960
 
120961
120961
  const resizeObserver = new ResizeObserver(() => {
120962
- console.log("111");
120963
120962
  const activeContent = this.shadowRoot.querySelector('.tab-page.active');
120964
120963
  if (activeContent) {
120965
120964
  this.shadowRoot.querySelector('.tab-pages').style.height = `${activeContent.scrollHeight}px`;
@@ -121163,30 +121162,60 @@ class nxSplitter extends HTMLElement {
121163
121162
  return allSplitters.at(-1) === this;
121164
121163
  };
121165
121164
 
121165
+ #getSiblingSizes = () => {
121166
+ const parent = this.parentElement;
121167
+ if (!parent) return [];
121168
+
121169
+ const children = Array.from(parent.children);
121170
+ return children.map((child) => {
121171
+ const rect = child.getBoundingClientRect();
121172
+ return {
121173
+ element: child,
121174
+ width: child.offsetWidth,
121175
+ height: child.offsetHeight,
121176
+ rect: {
121177
+ x: rect.x,
121178
+ y: rect.y,
121179
+ width: rect.width,
121180
+ height: rect.height,
121181
+ }
121182
+ };
121183
+ });
121184
+ };
121185
+
121166
121186
  #prepareLayout = () => {
121187
+
121188
+
121189
+
121167
121190
  const isHorizontal = this.#mode === "h";
121168
- const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
121191
+ isHorizontal ? this.offsetWidth : this.offsetHeight;
121169
121192
  const prev = this.previousElementSibling;
121170
121193
  const next = this.nextElementSibling;
121171
121194
  const parent = this.parentElement;
121172
121195
  if (!prev || !next || !parent) return;
121173
121196
 
121174
- isHorizontal
121197
+ const siblingSize = this.#getSiblingSizes();
121198
+ console.log(siblingSize);
121199
+
121200
+ const parentSize = isHorizontal
121175
121201
  ? parent.getBoundingClientRect().width
121176
121202
  : parent.getBoundingClientRect().height;
121177
121203
 
121178
121204
  // 현재 패널 크기 측정
121179
121205
  const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
121180
- const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
121181
- const totalPanelSize = prevSize + nextSize;
121206
+ isHorizontal ? next.offsetWidth : next.offsetHeight;
121207
+ const totalPanelSize = isHorizontal ? siblingSize.width : siblingSize.height;
121182
121208
 
121183
121209
  // 현재 비율 계산
121184
- ///const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
121185
- const prevRatio = totalPanelSize ? prevSize / (totalPanelSize + splitterSize) : 0.5;
121210
+ const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
121186
121211
 
121187
- const newPrevSize = (totalPanelSize + splitterSize) * prevRatio;
121212
+ const newPrevSize = parentSize * prevRatio;
121188
121213
  const newNextSize = totalPanelSize - newPrevSize;
121189
121214
 
121215
+
121216
+
121217
+ console.log(newPrevSize, newNextSize, prevRatio);
121218
+
121190
121219
  if (isHorizontal) {
121191
121220
  prev.style.width = `${newPrevSize}px`;
121192
121221
  //this.style.width = `${splitterSize}px`;
@@ -179,7 +179,31 @@ class nxSplitter extends HTMLElement {
179
179
  return allSplitters.at(-1) === this;
180
180
  };
181
181
 
182
+ #getSiblingSizes = () => {
183
+ const parent = this.parentElement;
184
+ if (!parent) return [];
185
+
186
+ const children = Array.from(parent.children);
187
+ return children.map((child) => {
188
+ const rect = child.getBoundingClientRect();
189
+ return {
190
+ element: child,
191
+ width: child.offsetWidth,
192
+ height: child.offsetHeight,
193
+ rect: {
194
+ x: rect.x,
195
+ y: rect.y,
196
+ width: rect.width,
197
+ height: rect.height,
198
+ }
199
+ };
200
+ });
201
+ };
202
+
182
203
  #prepareLayout = () => {
204
+
205
+
206
+
183
207
  const isHorizontal = this.#mode === "h";
184
208
  const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
185
209
  const prev = this.previousElementSibling;
@@ -187,6 +211,9 @@ class nxSplitter extends HTMLElement {
187
211
  const parent = this.parentElement;
188
212
  if (!prev || !next || !parent) return;
189
213
 
214
+ const siblingSize = this.#getSiblingSizes();
215
+ console.log(siblingSize);
216
+
190
217
  const parentSize = isHorizontal
191
218
  ? parent.getBoundingClientRect().width
192
219
  : parent.getBoundingClientRect().height;
@@ -194,19 +221,23 @@ class nxSplitter extends HTMLElement {
194
221
  // 현재 패널 크기 측정
195
222
  const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
196
223
  const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
197
- const totalPanelSize = prevSize + nextSize;
224
+ const totalPanelSize = isHorizontal ? siblingSize.width : siblingSize.height;
198
225
 
199
226
  // 현재 비율 계산
200
- ///const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
201
- const prevRatio = totalPanelSize ? prevSize / (totalPanelSize + splitterSize) : 0.5;
202
- const nextRatio = 1 - prevRatio;
227
+ const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
228
+ //const prevRatio = parentSize ? prevSize / parentSize : 0.5;
229
+ //const nextRatio = 1 - prevRatio;
203
230
 
204
231
  // 새로운 available 크기
205
232
  const available = parentSize - splitterSize;
206
233
 
207
- const newPrevSize = (totalPanelSize + splitterSize) * prevRatio;
234
+ const newPrevSize = parentSize * prevRatio;
208
235
  const newNextSize = totalPanelSize - newPrevSize;
209
236
 
237
+
238
+
239
+ console.log(newPrevSize, newNextSize, prevRatio);
240
+
210
241
  if (isHorizontal) {
211
242
  prev.style.width = `${newPrevSize}px`;
212
243
  //this.style.width = `${splitterSize}px`;
package/dist/nx/nxTab.js CHANGED
@@ -115,7 +115,6 @@ class nxTab extends HTMLElement {
115
115
  this.shadowRoot.querySelectorAll('.tab-page:not(.active)').forEach(el => { el.classList.add('exit-right') });
116
116
 
117
117
  const resizeObserver = new ResizeObserver(() => {
118
- console.log("111");
119
118
  const activeContent = this.shadowRoot.querySelector('.tab-page.active');
120
119
  if (activeContent) {
121
120
  this.shadowRoot.querySelector('.tab-pages').style.height = `${activeContent.scrollHeight}px`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.752.0",
4
+ "version": "6.754.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -179,7 +179,31 @@ class nxSplitter extends HTMLElement {
179
179
  return allSplitters.at(-1) === this;
180
180
  };
181
181
 
182
+ #getSiblingSizes = () => {
183
+ const parent = this.parentElement;
184
+ if (!parent) return [];
185
+
186
+ const children = Array.from(parent.children);
187
+ return children.map((child) => {
188
+ const rect = child.getBoundingClientRect();
189
+ return {
190
+ element: child,
191
+ width: child.offsetWidth,
192
+ height: child.offsetHeight,
193
+ rect: {
194
+ x: rect.x,
195
+ y: rect.y,
196
+ width: rect.width,
197
+ height: rect.height,
198
+ }
199
+ };
200
+ });
201
+ };
202
+
182
203
  #prepareLayout = () => {
204
+
205
+
206
+
183
207
  const isHorizontal = this.#mode === "h";
184
208
  const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
185
209
  const prev = this.previousElementSibling;
@@ -187,6 +211,9 @@ class nxSplitter extends HTMLElement {
187
211
  const parent = this.parentElement;
188
212
  if (!prev || !next || !parent) return;
189
213
 
214
+ const siblingSize = this.#getSiblingSizes();
215
+ console.log(siblingSize);
216
+
190
217
  const parentSize = isHorizontal
191
218
  ? parent.getBoundingClientRect().width
192
219
  : parent.getBoundingClientRect().height;
@@ -194,19 +221,23 @@ class nxSplitter extends HTMLElement {
194
221
  // 현재 패널 크기 측정
195
222
  const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
196
223
  const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
197
- const totalPanelSize = prevSize + nextSize;
224
+ const totalPanelSize = isHorizontal ? siblingSize.width : siblingSize.height;
198
225
 
199
226
  // 현재 비율 계산
200
- ///const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
201
- const prevRatio = totalPanelSize ? prevSize / (totalPanelSize + splitterSize) : 0.5;
202
- const nextRatio = 1 - prevRatio;
227
+ const prevRatio = totalPanelSize ? prevSize / totalPanelSize : 0.5;
228
+ //const prevRatio = parentSize ? prevSize / parentSize : 0.5;
229
+ //const nextRatio = 1 - prevRatio;
203
230
 
204
231
  // 새로운 available 크기
205
232
  const available = parentSize - splitterSize;
206
233
 
207
- const newPrevSize = (totalPanelSize + splitterSize) * prevRatio;
234
+ const newPrevSize = parentSize * prevRatio;
208
235
  const newNextSize = totalPanelSize - newPrevSize;
209
236
 
237
+
238
+
239
+ console.log(newPrevSize, newNextSize, prevRatio);
240
+
210
241
  if (isHorizontal) {
211
242
  prev.style.width = `${newPrevSize}px`;
212
243
  //this.style.width = `${splitterSize}px`;
package/src/nx/nxTab.js CHANGED
@@ -115,7 +115,6 @@ class nxTab extends HTMLElement {
115
115
  this.shadowRoot.querySelectorAll('.tab-page:not(.active)').forEach(el => { el.classList.add('exit-right') });
116
116
 
117
117
  const resizeObserver = new ResizeObserver(() => {
118
- console.log("111");
119
118
  const activeContent = this.shadowRoot.querySelector('.tab-page.active');
120
119
  if (activeContent) {
121
120
  this.shadowRoot.querySelector('.tab-pages').style.height = `${activeContent.scrollHeight}px`;