@ninebone/util 0.9.188 → 0.9.190

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
@@ -9,7 +9,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
- var _name, _color, _Trace_instances, isTraceEnabled_fn, _a, _timer, _queue, _delay, _TaskDebouncer_instances, flush_fn, _request, _shift, _dialog, _init, _onMouseDown, _onTouchStart, _NineUxUtil_instances, prepare_fn, _mode, _detectMode, _startDrag, _init2, _prepareLayout, _onCloseCallback, _isInitialized, _NinePopup_instances, renderStructure_fn;
12
+ var _name, _color, _Trace_instances, isTraceEnabled_fn, _a, _timer, _queue, _delay, _TaskDebouncer_instances, flush_fn, _request, _shift, _dialog, _init, _onMouseDown, _onTouchStart, _NineUxUtil_instances, prepare_fn, _mode, _detectMode, _startDrag, _init2, _prepareLayout;
13
13
  import React from "react";
14
14
  import { createRoot } from "react-dom/client";
15
15
  const listeners = /* @__PURE__ */ new Set();
@@ -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.188"}/dist/css/nine-util.css";
1195
+ @import "https://cdn.jsdelivr.net/npm/@ninebone/util@${"0.9.190"}/dist/css/nine-util.css";
1196
1196
  ${customImport}
1197
1197
  </style>
1198
1198
  ${gripTmpl}
@@ -1539,22 +1539,34 @@ class NineUtil {
1539
1539
  * @param {Object} props - 팝업 알맹이에 넘겨줄 Props 데이터 (선택)
1540
1540
  * @param {Function} onCloseCallback - 팝업이 닫힐 때 데이터를 받아먹을 콜백 함수 (선택)
1541
1541
  */
1542
- __publicField(this, "popup", (ContentComponent, props = {}, onCloseCallback = null) => {
1543
- const $popupWrapper = document.createElement("nine-popup");
1544
- document.body.appendChild($popupWrapper);
1545
- const $bodySpace = $popupWrapper.popupBody || $popupWrapper;
1546
- const root = createRoot($bodySpace);
1547
- $popupWrapper.onclose = (resultData) => {
1542
+ __publicField(this, "popup", (ContentComponent, options = {}, onCloseCallback = null) => {
1543
+ const title = options.title || "Details";
1544
+ 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) => {
1548
1556
  if (typeof onCloseCallback === "function") {
1549
1557
  onCloseCallback(resultData);
1550
1558
  }
1551
- setTimeout(() => {
1552
- root.unmount();
1553
- $popupWrapper.remove();
1554
- }, 300);
1555
- };
1556
- root.render(React.createElement(ContentComponent, props));
1557
- setTimeout(() => $popupWrapper.open(), 0);
1559
+ });
1560
+ const $popupWrapper = document.querySelector(NinePopup.tagName);
1561
+ if ($popupWrapper) {
1562
+ const $bodySpace = $popupWrapper.popupBody;
1563
+ 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);
1567
+ });
1568
+ root.render(React.createElement(ContentComponent, componentProps));
1569
+ }
1558
1570
  });
1559
1571
  /**
1560
1572
  * 🎯 2. Shadow DOM 경계를 무력화하고 깊이 상관없이 모든 요소를 수집하는 만능 쿼리
@@ -1608,82 +1620,50 @@ class NineUtil {
1608
1620
  }
1609
1621
  }
1610
1622
  Object.assign(nine$1, new NineUtil());
1611
- class NinePopup extends HTMLElement {
1623
+ let NinePopup$1 = class NinePopup2 extends BasePopup {
1624
+ static get tagName() {
1625
+ return "nine-popup";
1626
+ }
1612
1627
  constructor() {
1613
1628
  super();
1614
- __privateAdd(this, _NinePopup_instances);
1615
- __privateAdd(this, _onCloseCallback, null);
1616
- __privateAdd(this, _isInitialized, false);
1617
- }
1618
- get _onCloseCallback() {
1619
- return __privateGet(this, _onCloseCallback);
1620
- }
1621
- set onclose(callbackFunc) {
1622
- if (typeof callbackFunc === "function") __privateSet(this, _onCloseCallback, callbackFunc);
1623
- }
1624
- connectedCallback() {
1625
- if (__privateGet(this, _isInitialized)) return;
1626
- if (!this.shadowRoot) {
1627
- this.attachShadow({ mode: "open" });
1628
- }
1629
- __privateMethod(this, _NinePopup_instances, renderStructure_fn).call(this);
1630
- __privateSet(this, _isInitialized, true);
1631
1629
  }
1632
- open() {
1633
- this.classList.add("open");
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
+ `;
1634
1648
  }
1635
- close(callbackData = null) {
1636
- this.classList.remove("open");
1637
- if (typeof __privateGet(this, _onCloseCallback) === "function") {
1638
- __privateGet(this, _onCloseCallback).call(this, callbackData);
1639
- }
1649
+ /**
1650
+ * 버튼 이벤트 바인딩 배선 (BasePopup.open의 내부 명세)
1651
+ */
1652
+ setupEvents(resolve, dialogComp) {
1653
+ this.popupBody;
1654
+ this.addEventListener("request-close", (e) => {
1655
+ dialogComp.closeWithAnimation(e.detail);
1656
+ });
1640
1657
  }
1641
- // 🔒 만능 동적 팝업 엔진(NineUtil) 전용 입구 개방
1658
+ // 🔒 만능 동적 팝업 엔진이 리액트 19 루트를 꽂을 입구 게터
1642
1659
  get popupBody() {
1643
1660
  var _a2;
1644
- return ((_a2 = this.shadowRoot) == null ? void 0 : _a2.querySelector(".popup-body")) || null;
1645
- }
1646
- }
1647
- _onCloseCallback = new WeakMap();
1648
- _isInitialized = new WeakMap();
1649
- _NinePopup_instances = new WeakSet();
1650
- renderStructure_fn = function() {
1651
- if (this.shadowRoot.querySelector(".popup-dimmed")) return;
1652
- const customImport = nine.cssPath ? `@import "${nine.cssPath}/nine-util.css";` : "";
1653
- const $styleTmpl = document.createElement("template");
1654
- $styleTmpl.innerHTML = `
1655
- <style>
1656
- @import "https://cdn.jsdelivr.net/npm/@ninebone/util@${"0.9.188"}/dist/css/nine-util.css";
1657
- ${customImport}
1658
-
1659
- :host { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 9999; }
1660
- :host(.open) { display: block; }
1661
- .popup-dimmed { position: absolute; top:0; left:0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); display: flex; justify-content: center; align-items: center; }
1662
- .popup-content { background: #fff; border-radius: 8px; min-width: 500px; max-width: 90%; box-shadow: 0 4px 15px rgba(0,0,0,0.25); display: flex; flex-direction: column; overflow: hidden; }
1663
- .popup-header { padding: 15px 20px; border-bottom: 1px solid #eee; font-weight: bold; background: #f9f9f9; }
1664
- .popup-body { padding: 20px; min-height: 150px; overflow-y: auto; }
1665
- </style>
1666
- `;
1667
- this.shadowRoot.appendChild($styleTmpl.content.cloneNode(true));
1668
- const $dimmed = document.createElement("div");
1669
- $dimmed.className = "popup-dimmed";
1670
- $dimmed.addEventListener("click", (e) => {
1671
- if (e.target === $dimmed) this.close();
1672
- });
1673
- const $content = document.createElement("div");
1674
- $content.className = "popup-content";
1675
- $content.innerHTML = `
1676
- <div class="popup-header"></div>
1677
- <div class="popup-body"></div>
1678
- `;
1679
- const $bodySpace = $content.querySelector(".popup-body");
1680
- while (this.firstChild) {
1681
- $bodySpace.appendChild(this.firstChild);
1661
+ return ((_a2 = this.shadowRoot) == null ? void 0 : _a2.querySelector("nine-dialog .popup-body")) || null;
1682
1662
  }
1683
- $dimmed.appendChild($content);
1684
- this.shadowRoot.appendChild($dimmed);
1685
1663
  };
1686
- if (!customElements.get("nine-popup")) customElements.define("nine-popup", NinePopup);
1664
+ if (!customElements.get("nine-popup")) {
1665
+ customElements.define("nine-popup", NinePopup$1);
1666
+ }
1687
1667
  nine$1.safe = safe;
1688
1668
  nine$1.api = api;
1689
1669
  nine$1.trace = trace$2;