ninegrid2 6.1119.0 → 6.1121.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.
@@ -122060,7 +122060,7 @@ class nxPanel extends HTMLElement {
122060
122060
  ${ninegrid.getCustomPath(this,"nxPanel.css")}
122061
122061
  </style>
122062
122062
 
122063
- <div class="head">
122063
+ <div class="head ${caption ? '' : 'hide'}">
122064
122064
  <div class="caption"><span>${caption}</span></div>
122065
122065
  </div>
122066
122066
  <div class="body">
@@ -122056,7 +122056,7 @@ class nxPanel extends HTMLElement {
122056
122056
  ${ninegrid.getCustomPath(this,"nxPanel.css")}
122057
122057
  </style>
122058
122058
 
122059
- <div class="head">
122059
+ <div class="head ${caption ? '' : 'hide'}">
122060
122060
  <div class="caption"><span>${caption}</span></div>
122061
122061
  </div>
122062
122062
  <div class="body">
@@ -0,0 +1,46 @@
1
+ import ninegrid from "../index.js";
2
+
3
+ class nxButtons extends HTMLElement {
4
+ // 1. 초기화 상태를 저장할 플래그를 추가합니다.
5
+ #isInitialized = false;
6
+
7
+ constructor() {
8
+ super();
9
+ this.attachShadow({ mode: "open" });
10
+ }
11
+
12
+ connectedCallback() {
13
+ // 2. 초기화되지 않았을 때만 #init 함수를 호출합니다.
14
+ if (!this.#isInitialized) {
15
+ this.#init();
16
+ this.#isInitialized = true; // 3. 초기화 후 플래그를 true로 변경합니다.
17
+ }
18
+ }
19
+
20
+ #init = () => {
21
+ const contents = this.innerHTML.trim();
22
+
23
+ for (const attr of this.attributes) {
24
+ if (attr.name.startsWith("css-")) {
25
+ // "css-" 접두사를 제거하고 CSS 속성명으로 변환
26
+ this.style.setProperty(attr.name.substring(4), attr.value);
27
+ }
28
+ }
29
+
30
+ this.innerHTML = ""; // 기존 내부 HTML 제거
31
+
32
+ const htmlTmpl = document.createElement("template");
33
+ htmlTmpl.innerHTML = `
34
+ <style>
35
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxButtons.css";
36
+ ${ninegrid.getCustomPath(this,"nxButtons.css")}
37
+ </style>
38
+
39
+ ${contents}
40
+ `;
41
+
42
+ this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
43
+ }
44
+ }
45
+
46
+ customElements.define("nx-buttons", nxButtons);
@@ -30,7 +30,7 @@ class nxPanel extends HTMLElement {
30
30
  ${ninegrid.getCustomPath(this,"nxPanel.css")}
31
31
  </style>
32
32
 
33
- <div class="head">
33
+ <div class="head ${caption ? '' : 'hide'}">
34
34
  <div class="caption"><span>${caption}</span></div>
35
35
  </div>
36
36
  <div class="body">
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.1119.0",
4
+ "version": "6.1121.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -0,0 +1,46 @@
1
+ import ninegrid from "../index.js";
2
+
3
+ class nxButtons extends HTMLElement {
4
+ // 1. 초기화 상태를 저장할 플래그를 추가합니다.
5
+ #isInitialized = false;
6
+
7
+ constructor() {
8
+ super();
9
+ this.attachShadow({ mode: "open" });
10
+ }
11
+
12
+ connectedCallback() {
13
+ // 2. 초기화되지 않았을 때만 #init 함수를 호출합니다.
14
+ if (!this.#isInitialized) {
15
+ this.#init();
16
+ this.#isInitialized = true; // 3. 초기화 후 플래그를 true로 변경합니다.
17
+ }
18
+ }
19
+
20
+ #init = () => {
21
+ const contents = this.innerHTML.trim();
22
+
23
+ for (const attr of this.attributes) {
24
+ if (attr.name.startsWith("css-")) {
25
+ // "css-" 접두사를 제거하고 CSS 속성명으로 변환
26
+ this.style.setProperty(attr.name.substring(4), attr.value);
27
+ }
28
+ }
29
+
30
+ this.innerHTML = ""; // 기존 내부 HTML 제거
31
+
32
+ const htmlTmpl = document.createElement("template");
33
+ htmlTmpl.innerHTML = `
34
+ <style>
35
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxButtons.css";
36
+ ${ninegrid.getCustomPath(this,"nxButtons.css")}
37
+ </style>
38
+
39
+ ${contents}
40
+ `;
41
+
42
+ this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
43
+ }
44
+ }
45
+
46
+ customElements.define("nx-buttons", nxButtons);
package/src/nx/nxPanel.js CHANGED
@@ -30,7 +30,7 @@ class nxPanel extends HTMLElement {
30
30
  ${ninegrid.getCustomPath(this,"nxPanel.css")}
31
31
  </style>
32
32
 
33
- <div class="head">
33
+ <div class="head ${caption ? '' : 'hide'}">
34
34
  <div class="caption"><span>${caption}</span></div>
35
35
  </div>
36
36
  <div class="body">