@ninebone/util 0.9.190 โ†’ 0.9.192

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.
package/dist/nine-util.js CHANGED
@@ -1192,7 +1192,7 @@ class UxSplitter extends HTMLElement {
1192
1192
  const htmlTmpl = document.createElement("template");
1193
1193
  htmlTmpl.innerHTML = `
1194
1194
  <style>
1195
- @import "https://cdn.jsdelivr.net/npm/@ninebone/util@${"0.9.190"}/dist/css/nine-util.css";
1195
+ @import "https://cdn.jsdelivr.net/npm/@ninebone/util@${"0.9.192"}/dist/css/nine-util.css";
1196
1196
  ${customImport}
1197
1197
  </style>
1198
1198
  ${gripTmpl}
@@ -1527,6 +1527,33 @@ function requireDayjs_min() {
1527
1527
  }
1528
1528
  var dayjs_minExports = requireDayjs_min();
1529
1529
  const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
1530
+ class NinePopup extends HTMLElement {
1531
+ static get tagName() {
1532
+ return "nine-popup";
1533
+ }
1534
+ constructor() {
1535
+ super();
1536
+ this.attachShadow({ mode: "open" });
1537
+ }
1538
+ connectedCallback() {
1539
+ this.shadowRoot.innerHTML = `
1540
+ <nine-dialog>
1541
+ <div class="popup-body"></div>
1542
+ </nine-dialog>
1543
+ `;
1544
+ }
1545
+ // ๐Ÿ”“ ๋ฆฌ์•กํŠธ ์—”์ง„์ด ๊ฝ‚์•„ ๋„ฃ์„ ์ž…๊ตฌ ํฌ์ธํ„ฐ ๊ฐœ๋ฐฉ
1546
+ get popupBody() {
1547
+ var _a2;
1548
+ return ((_a2 = this.shadowRoot) == null ? void 0 : _a2.querySelector("nine-dialog .popup-body")) || null;
1549
+ }
1550
+ // ๐Ÿ”“ ๋ฆฌ์•กํŠธ๋‚˜ ์™ธ๋ถ€ ์œ ํ‹ธ์—์„œ ์ง์ ‘ ์ œ์–ดํ•  ์ˆ˜ ์žˆ๋Š” ์ œ์–ด ํ†ต๋กœ
1551
+ get dialog() {
1552
+ var _a2;
1553
+ return ((_a2 = this.shadowRoot) == null ? void 0 : _a2.querySelector("nine-dialog")) || null;
1554
+ }
1555
+ }
1556
+ if (!customElements.get("nine-popup")) customElements.define("nine-popup", NinePopup);
1530
1557
  class NineUtil {
1531
1558
  constructor() {
1532
1559
  // ๐Ÿ“… 1. ๋‚ ์งœ ํฌ๋งท ํ—ฌํผ (์ธ์Šคํ„ด์Šค ๋ฉ”์„œ๋“œ)
@@ -1542,31 +1569,31 @@ class NineUtil {
1542
1569
  __publicField(this, "popup", (ContentComponent, options = {}, onCloseCallback = null) => {
1543
1570
  const title = options.title || "Details";
1544
1571
  const componentProps = options.props || {};
1545
- NinePopup.open(
1546
- NinePopup,
1547
- null,
1548
- // message (์ผ๋ฐ˜ ์–ผ๋Ÿฟ์ด ์•„๋‹ˆ๋ฏ€๋กœ ํŒจ์Šค)
1549
- title,
1550
- // ์‹ญ์ž ๋“œ๋ž˜๊ทธ ๋ฐ” ํ—ค๋”์— ๊ฝ‚ํž ํƒ€์ดํ‹€๋ช…
1551
- options,
1552
- // ์ถ”๊ฐ€ ์• ๋‹ˆ๋ฉ”์ด์…˜ ๋ฐ ํด๋ž˜์Šค ์˜ต์…˜
1553
- (el, msg, cfg) => el.render(cfg)
1554
- // ๋ Œ๋”๋ง ํƒ€๊ฒŸ ๋ฐฐ์„ 
1555
- ).then((resultData) => {
1556
- if (typeof onCloseCallback === "function") {
1557
- onCloseCallback(resultData);
1558
- }
1559
- });
1560
- const $popupWrapper = document.querySelector(NinePopup.tagName);
1561
- if ($popupWrapper) {
1572
+ document.querySelectorAll(NinePopup.tagName).forEach((el) => el.remove());
1573
+ const $popupWrapper = document.createElement(NinePopup.tagName);
1574
+ document.body.appendChild($popupWrapper);
1575
+ return new Promise((resolve) => {
1562
1576
  const $bodySpace = $popupWrapper.popupBody;
1577
+ const $dialogComp = $popupWrapper.dialog;
1578
+ if ($dialogComp) $dialogComp.setAttribute("subject", title);
1563
1579
  const root = createRoot($bodySpace);
1564
- const dialogComp = $popupWrapper.shadowRoot.querySelector("nine-dialog");
1565
- dialogComp == null ? void 0 : dialogComp.addEventListener("closed", () => {
1566
- setTimeout(() => root.unmount(), 0);
1580
+ $dialogComp == null ? void 0 : $dialogComp.addEventListener("closed", (e) => {
1581
+ const resultData = e.detail;
1582
+ if (typeof onCloseCallback === "function") onCloseCallback(resultData);
1583
+ resolve(resultData);
1584
+ setTimeout(() => {
1585
+ root.unmount();
1586
+ $popupWrapper.remove();
1587
+ }, 0);
1588
+ });
1589
+ $popupWrapper.addEventListener("request-close", (e) => {
1590
+ $dialogComp == null ? void 0 : $dialogComp.closeWithAnimation(e.detail);
1567
1591
  });
1568
1592
  root.render(React.createElement(ContentComponent, componentProps));
1569
- }
1593
+ setTimeout(() => {
1594
+ $dialogComp == null ? void 0 : $dialogComp.showModal();
1595
+ }, 0);
1596
+ });
1570
1597
  });
1571
1598
  /**
1572
1599
  * ๐ŸŽฏ 2. Shadow DOM ๊ฒฝ๊ณ„๋ฅผ ๋ฌด๋ ฅํ™”ํ•˜๊ณ  ๊นŠ์ด ์ƒ๊ด€์—†์ด ๋ชจ๋“  ์š”์†Œ๋ฅผ ์ˆ˜์ง‘ํ•˜๋Š” ๋งŒ๋Šฅ ์ฟผ๋ฆฌ
@@ -1620,50 +1647,6 @@ class NineUtil {
1620
1647
  }
1621
1648
  }
1622
1649
  Object.assign(nine$1, new NineUtil());
1623
- let NinePopup$1 = class NinePopup2 extends BasePopup {
1624
- static get tagName() {
1625
- return "nine-popup";
1626
- }
1627
- constructor() {
1628
- super();
1629
- }
1630
- /**
1631
- * ๋ผˆ๋Œ€ ๋ Œ๋”๋ง ํ•จ์ˆ˜ (BasePopup.open์˜ renderFn์œผ๋กœ ๋ฐ”์ธ๋”ฉ๋  ๋…€์„)
1632
- */
1633
- render(config2) {
1634
- this.shadowRoot.innerHTML = `
1635
- <style>
1636
- :host { display: block; }
1637
- /* ํŒ์—… ์ฐฝ ์ž์ฒด๋ฅผ ๊ฐ์‹ธ๋Š” ์˜ค๋ฒ„๋ ˆ์ด ์ตœ์†Œํ•œ์˜ ๋ฐฉ์–ด์„  */
1638
- nine-dialog::part(dialog) {
1639
- min-width: 500px;
1640
- max-width: 90%;
1641
- }
1642
- </style>
1643
- <nine-dialog>
1644
- <div class="popup-body">
1645
- </div>
1646
- </nine-dialog>
1647
- `;
1648
- }
1649
- /**
1650
- * ๋ฒ„ํŠผ ์ด๋ฒคํŠธ ๋ฐ”์ธ๋”ฉ ๋ฐฐ์„  (BasePopup.open์˜ ๋‚ด๋ถ€ ๋ช…์„ธ)
1651
- */
1652
- setupEvents(resolve, dialogComp) {
1653
- this.popupBody;
1654
- this.addEventListener("request-close", (e) => {
1655
- dialogComp.closeWithAnimation(e.detail);
1656
- });
1657
- }
1658
- // ๐Ÿ”’ ๋งŒ๋Šฅ ๋™์  ํŒ์—… ์—”์ง„์ด ๋ฆฌ์•กํŠธ 19 ๋ฃจํŠธ๋ฅผ ๊ฝ‚์„ ์ž…๊ตฌ ๊ฒŒํ„ฐ
1659
- get popupBody() {
1660
- var _a2;
1661
- return ((_a2 = this.shadowRoot) == null ? void 0 : _a2.querySelector("nine-dialog .popup-body")) || null;
1662
- }
1663
- };
1664
- if (!customElements.get("nine-popup")) {
1665
- customElements.define("nine-popup", NinePopup$1);
1666
- }
1667
1650
  nine$1.safe = safe;
1668
1651
  nine$1.api = api;
1669
1652
  nine$1.trace = trace$2;