ninegrid2 6.1120.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.
@@ -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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.1120.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);