solely 0.5.3 → 0.5.4

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.
Files changed (47) hide show
  1. package/dist/components/commands/drawer/index.cjs +1 -1
  2. package/dist/components/commands/drawer/index.js +1 -1
  3. package/dist/components/commands/drawer/types.d.ts +2 -0
  4. package/dist/components/commands/index.cjs +1 -1
  5. package/dist/components/commands/index.d.ts +2 -2
  6. package/dist/components/commands/index.js +1 -1
  7. package/dist/components/commands/message/index.cjs +1 -1
  8. package/dist/components/commands/message/index.js +1 -1
  9. package/dist/components/commands/message/types.d.ts +2 -0
  10. package/dist/components/commands/modal/index.cjs +1 -1
  11. package/dist/components/commands/modal/index.js +1 -1
  12. package/dist/components/commands/modal/types.d.ts +2 -0
  13. package/dist/components/commands/popconfirm/index.cjs +1 -1
  14. package/dist/components/commands/popconfirm/index.d.ts +3 -4
  15. package/dist/components/commands/popconfirm/index.js +1 -1
  16. package/dist/components/commands/popconfirm/types.d.ts +10 -0
  17. package/dist/components/commands/tooltip/index.cjs +1 -1
  18. package/dist/components/commands/tooltip/index.d.ts +13 -0
  19. package/dist/components/commands/tooltip/index.js +1 -1
  20. package/dist/components/commands/tooltip/types.d.ts +2 -0
  21. package/dist/components/commands/utils.cjs +1 -1
  22. package/dist/components/commands/utils.d.ts +6 -0
  23. package/dist/components/commands/utils.js +1 -1
  24. package/dist/components/elements/button/index.cjs +1 -1
  25. package/dist/components/elements/button/index.js +1 -1
  26. package/dist/components/elements/card/index.cjs +1 -1
  27. package/dist/components/elements/card/index.js +1 -1
  28. package/dist/components/elements/card/types.d.ts +1 -1
  29. package/dist/components/elements/input/index.cjs +1 -1
  30. package/dist/components/elements/input/index.js +1 -1
  31. package/dist/components/elements/pagination/index.cjs +1 -1
  32. package/dist/components/elements/pagination/index.js +1 -1
  33. package/dist/components/elements/pagination/types.d.ts +1 -1
  34. package/dist/components/elements/steps/index.cjs +1 -1
  35. package/dist/components/elements/steps/index.js +1 -1
  36. package/dist/components/elements/steps/types.d.ts +1 -1
  37. package/dist/components/elements/table/index.cjs +1 -1
  38. package/dist/components/elements/table/index.js +1 -1
  39. package/dist/components/elements/table/types.d.ts +1 -1
  40. package/dist/components/elements/tabs/index.cjs +1 -1
  41. package/dist/components/elements/tabs/index.js +1 -1
  42. package/dist/components/elements/tabs/types.d.ts +1 -1
  43. package/dist/components/index.cjs +1 -1
  44. package/dist/components/index.js +1 -1
  45. package/dist/shared/env.cjs +1 -1
  46. package/dist/shared/env.js +1 -1
  47. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),l={width:378,height:378,mask:!0,maskClosable:!0,closable:!0},n=[],s=new Set;let o=null;async function a(t){var l;if(!s.has(t)){s.add(t);try{const s=n.findIndex(e=>e.id===t);if(-1===s)return;const o=n[s],a=o.element.querySelector(".solely-drawer-mask"),i=o.element.querySelector(".solely-drawer");a&&a.classList.add("is-closing"),i&&i.classList.add("is-closing"),await e.addClosingAnimation(o.element,e.ANIMATION_DURATION.NORMAL),null==(l=o.cleanup)||l.call(o);const r=n.findIndex(e=>e.id===t);-1!==r&&(n[r].element.remove(),n.splice(r,1)),0===n.length&&document.body.classList.remove("solely-drawer-open")}finally{s.delete(t)}}}const i={open:function(s){const i=e.generateId();e.injectStyle("solely-drawer-styles",t.default);const r=s.placement||"right",d=s.width??l.width,c=s.height??l.height,m=s.mask??l.mask,y=s.maskClosable??l.maskClosable,h=s.closable??l.closable,p=e.createElement("div",{className:"solely-drawer-wrap"}),u=function(e){return(()=>{const t=document.documentElement.getAttribute("data-theme");t?e.setAttribute("data-theme",t):e.removeAttribute("data-theme")})(),o||(o=new MutationObserver(()=>{n.forEach(e=>{const t=document.documentElement.getAttribute("data-theme");t?e.element.setAttribute("data-theme",t):e.element.removeAttribute("data-theme")})}),o.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})),()=>{o&&0===n.length&&(o.disconnect(),o=null)}}(p),f=[];if(!1!==m){const t=e.createElement("div",{className:"solely-drawer-mask"});if(y){const e=()=>{var e;a(i),null==(e=s.onClose)||e.call(s)};t.addEventListener("click",e),f.push({element:t,type:"click",handler:e})}p.appendChild(t)}const b=e.createElement("div",{className:`solely-drawer solely-drawer--${r}${s.className?` ${s.className}`:""}`,styles:s.style});if("left"===r||"right"===r?b.style.width="number"==typeof d?`${d}px`:d:b.style.height="number"==typeof c?`${c}px`:c,s.title||!1!==h){const t=e.createElement("div",{className:"solely-drawer__header"});if(s.title){const l=e.createElement("h3",{className:"solely-drawer__title"});"string"==typeof s.title?l.textContent=s.title:s.title instanceof HTMLElement&&l.appendChild(s.title.cloneNode(!0)),t.appendChild(l)}if(!1!==h){const l=e.createElement("button",{className:"solely-drawer__close",textContent:"×",attrs:{type:"button","aria-label":"关闭"}}),n=()=>{var e;a(i),null==(e=s.onClose)||e.call(s)};l.addEventListener("click",n),f.push({element:l,type:"click",handler:n}),t.appendChild(l)}b.appendChild(t)}const w=e.createElement("div",{className:"solely-drawer__body",styles:s.bodyStyle});return"string"==typeof s.content?w.textContent=s.content||"":s.content instanceof HTMLElement&&w.appendChild(s.content.cloneNode(!0)),b.appendChild(w),p.appendChild(b),document.body.appendChild(p),document.body.classList.add("solely-drawer-open"),n.push({id:i,element:p,options:s,cleanup:()=>{f.forEach(({element:e,type:t,handler:l})=>{e.removeEventListener(t,l)}),u()}}),{close:()=>{var e;a(i),null==(e=s.onClose)||e.call(s)},update:t=>{if(void 0!==t.title){const l=p.querySelector(".solely-drawer__title");if(l)l.innerHTML="","string"==typeof t.title?l.textContent=t.title:t.title instanceof HTMLElement&&l.appendChild(t.title.cloneNode(!0));else if(t.title){const l=e.createElement("div",{className:"solely-drawer__header"}),n=e.createElement("h3",{className:"solely-drawer__title"});"string"==typeof t.title?n.textContent=t.title:t.title instanceof HTMLElement&&n.appendChild(t.title.cloneNode(!0)),l.appendChild(n);const s=p.querySelector(".solely-drawer");null==s||s.insertBefore(l,s.firstChild)}}if(void 0!==t.content){const e=p.querySelector(".solely-drawer__body");e&&(e.innerHTML="","string"==typeof t.content?e.textContent=t.content:t.content instanceof HTMLElement&&e.appendChild(t.content.cloneNode(!0)))}const l=p.querySelector(".solely-drawer");if(l){const e=t.placement||s.placement||"right";void 0===t.width||"left"!==e&&"right"!==e||(l.style.width="number"==typeof t.width?`${t.width}px`:t.width),void 0===t.height||"top"!==e&&"bottom"!==e||(l.style.height="number"==typeof t.height?`${t.height}px`:t.height)}if(void 0!==t.className&&l){const e=s.placement||"right";l.className=`solely-drawer solely-drawer--${e} ${t.className}`.trim()}if(void 0!==t.style&&l&&Object.assign(l.style,t.style),void 0!==t.bodyStyle){const e=p.querySelector(".solely-drawer__body");e&&Object.assign(e.style,t.bodyStyle)}}}},config:function(e){Object.assign(l,e)},destroy:async function(){const e=[...n].reverse();for(const t of e)await a(t.id)}};exports.Drawer=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),l={width:378,height:378,mask:!0,maskClosable:!0,closable:!0},n=[],s=new Set;async function o(t){var l;if(!s.has(t)){s.add(t);try{const s=n.findIndex(e=>e.id===t);if(-1===s)return;const o=n[s],i=o.element.querySelector(".solely-drawer-mask"),a=o.element.querySelector(".solely-drawer");i&&i.classList.add("is-closing"),a&&a.classList.add("is-closing"),await e.addClosingAnimation(o.element,e.ANIMATION_DURATION.NORMAL),null==(l=o.cleanup)||l.call(o);const r=n.findIndex(e=>e.id===t);-1!==r&&(n[r].element.remove(),n.splice(r,1)),0===n.length&&document.body.classList.remove("solely-drawer-open")}finally{s.delete(t)}}}const i={open:function(s){const i=e.generateId();e.injectStyle("solely-drawer-styles",t.default);const a=s.placement||"right",r=s.width??l.width,c=s.height??l.height,d=s.mask??l.mask,y=s.maskClosable??l.maskClosable,m=s.closable??l.closable,p=e.createElement("div",{className:"solely-drawer-wrap"}),h=e.observeTheme(()=>p),f=s.cloneElement??!0,u=[];if(!1!==d){const t=e.createElement("div",{className:"solely-drawer-mask"});if(y){const e=()=>{var e;o(i),null==(e=s.onClose)||e.call(s)};t.addEventListener("click",e),u.push({element:t,type:"click",handler:e})}p.appendChild(t)}const w=e.createElement("div",{className:`solely-drawer solely-drawer--${a}${s.className?` ${s.className}`:""}`,styles:s.style});if("left"===a||"right"===a?w.style.width="number"==typeof r?`${r}px`:r:w.style.height="number"==typeof c?`${c}px`:c,s.title||!1!==m){const t=e.createElement("div",{className:"solely-drawer__header"});if(s.title){const l=e.createElement("h3",{className:"solely-drawer__title"});"string"==typeof s.title?l.textContent=s.title:s.title instanceof HTMLElement&&l.appendChild(f?s.title.cloneNode(!0):s.title),t.appendChild(l)}if(!1!==m){const l=e.createElement("button",{className:"solely-drawer__close",textContent:"×",attrs:{type:"button","aria-label":"关闭"}}),n=()=>{var e;o(i),null==(e=s.onClose)||e.call(s)};l.addEventListener("click",n),u.push({element:l,type:"click",handler:n}),t.appendChild(l)}w.appendChild(t)}const g=e.createElement("div",{className:"solely-drawer__body",styles:s.bodyStyle});return"string"==typeof s.content?g.textContent=s.content||"":s.content instanceof HTMLElement&&g.appendChild(f?s.content.cloneNode(!0):s.content),w.appendChild(g),p.appendChild(w),document.body.appendChild(p),document.body.classList.add("solely-drawer-open"),n.push({id:i,element:p,options:s,cleanup:()=>{u.forEach(({element:e,type:t,handler:l})=>{e.removeEventListener(t,l)}),h()}}),{close:()=>{var e;o(i),null==(e=s.onClose)||e.call(s)},update:t=>{const l=t.cloneElement??f;if(void 0!==t.title){const n=p.querySelector(".solely-drawer__title");if(n)n.innerHTML="","string"==typeof t.title?n.textContent=t.title:t.title instanceof HTMLElement&&n.appendChild(l?t.title.cloneNode(!0):t.title);else if(t.title){const n=e.createElement("div",{className:"solely-drawer__header"}),s=e.createElement("h3",{className:"solely-drawer__title"});"string"==typeof t.title?s.textContent=t.title:t.title instanceof HTMLElement&&s.appendChild(l?t.title.cloneNode(!0):t.title),n.appendChild(s);const o=p.querySelector(".solely-drawer");null==o||o.insertBefore(n,o.firstChild)}}if(void 0!==t.content){const e=p.querySelector(".solely-drawer__body");e&&(e.innerHTML="","string"==typeof t.content?e.textContent=t.content:t.content instanceof HTMLElement&&e.appendChild(l?t.content.cloneNode(!0):t.content))}const n=p.querySelector(".solely-drawer");if(n){const e=t.placement||s.placement||"right";void 0===t.width||"left"!==e&&"right"!==e||(n.style.width="number"==typeof t.width?`${t.width}px`:t.width),void 0===t.height||"top"!==e&&"bottom"!==e||(n.style.height="number"==typeof t.height?`${t.height}px`:t.height)}if(void 0!==t.className&&n){const e=s.placement||"right";n.className=`solely-drawer solely-drawer--${e} ${t.className}`.trim()}if(void 0!==t.style&&n&&Object.assign(n.style,t.style),void 0!==t.bodyStyle){const e=p.querySelector(".solely-drawer__body");e&&Object.assign(e.style,t.bodyStyle)}}}},config:function(e){Object.assign(l,e)},destroy:async function(){const e=[...n].reverse();for(const t of e)await o(t.id)}};exports.Drawer=i;
@@ -1 +1 @@
1
- import{createElement as e,addClosingAnimation as t,ANIMATION_DURATION as l,injectStyle as n,generateId as s}from"../utils.js";import o from"./style.css.js";const i={width:378,height:378,mask:!0,maskClosable:!0,closable:!0},a=[],d=new Set;let r=null;async function c(e){var n;if(!d.has(e)){d.add(e);try{const s=a.findIndex(t=>t.id===e);if(-1===s)return;const o=a[s],i=o.element.querySelector(".solely-drawer-mask"),d=o.element.querySelector(".solely-drawer");i&&i.classList.add("is-closing"),d&&d.classList.add("is-closing"),await t(o.element,l.NORMAL),null==(n=o.cleanup)||n.call(o);const r=a.findIndex(t=>t.id===e);-1!==r&&(a[r].element.remove(),a.splice(r,1)),0===a.length&&document.body.classList.remove("solely-drawer-open")}finally{d.delete(e)}}}const m={open:function(t){const l=s();n("solely-drawer-styles",o);const d=t.placement||"right",m=t.width??i.width,y=t.height??i.height,h=t.mask??i.mask,p=t.maskClosable??i.maskClosable,u=t.closable??i.closable,f=e("div",{className:"solely-drawer-wrap"}),b=function(e){return(()=>{const t=document.documentElement.getAttribute("data-theme");t?e.setAttribute("data-theme",t):e.removeAttribute("data-theme")})(),r||(r=new MutationObserver(()=>{a.forEach(e=>{const t=document.documentElement.getAttribute("data-theme");t?e.element.setAttribute("data-theme",t):e.element.removeAttribute("data-theme")})}),r.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})),()=>{r&&0===a.length&&(r.disconnect(),r=null)}}(f),w=[];if(!1!==h){const n=e("div",{className:"solely-drawer-mask"});if(p){const e=()=>{var e;c(l),null==(e=t.onClose)||e.call(t)};n.addEventListener("click",e),w.push({element:n,type:"click",handler:e})}f.appendChild(n)}const g=e("div",{className:`solely-drawer solely-drawer--${d}${t.className?` ${t.className}`:""}`,styles:t.style});if("left"===d||"right"===d?g.style.width="number"==typeof m?`${m}px`:m:g.style.height="number"==typeof y?`${y}px`:y,t.title||!1!==u){const n=e("div",{className:"solely-drawer__header"});if(t.title){const l=e("h3",{className:"solely-drawer__title"});"string"==typeof t.title?l.textContent=t.title:t.title instanceof HTMLElement&&l.appendChild(t.title.cloneNode(!0)),n.appendChild(l)}if(!1!==u){const s=e("button",{className:"solely-drawer__close",textContent:"×",attrs:{type:"button","aria-label":"关闭"}}),o=()=>{var e;c(l),null==(e=t.onClose)||e.call(t)};s.addEventListener("click",o),w.push({element:s,type:"click",handler:o}),n.appendChild(s)}g.appendChild(n)}const v=e("div",{className:"solely-drawer__body",styles:t.bodyStyle});return"string"==typeof t.content?v.textContent=t.content||"":t.content instanceof HTMLElement&&v.appendChild(t.content.cloneNode(!0)),g.appendChild(v),f.appendChild(g),document.body.appendChild(f),document.body.classList.add("solely-drawer-open"),a.push({id:l,element:f,options:t,cleanup:()=>{w.forEach(({element:e,type:t,handler:l})=>{e.removeEventListener(t,l)}),b()}}),{close:()=>{var e;c(l),null==(e=t.onClose)||e.call(t)},update:l=>{if(void 0!==l.title){const t=f.querySelector(".solely-drawer__title");if(t)t.innerHTML="","string"==typeof l.title?t.textContent=l.title:l.title instanceof HTMLElement&&t.appendChild(l.title.cloneNode(!0));else if(l.title){const t=e("div",{className:"solely-drawer__header"}),n=e("h3",{className:"solely-drawer__title"});"string"==typeof l.title?n.textContent=l.title:l.title instanceof HTMLElement&&n.appendChild(l.title.cloneNode(!0)),t.appendChild(n);const s=f.querySelector(".solely-drawer");null==s||s.insertBefore(t,s.firstChild)}}if(void 0!==l.content){const e=f.querySelector(".solely-drawer__body");e&&(e.innerHTML="","string"==typeof l.content?e.textContent=l.content:l.content instanceof HTMLElement&&e.appendChild(l.content.cloneNode(!0)))}const n=f.querySelector(".solely-drawer");if(n){const e=l.placement||t.placement||"right";void 0===l.width||"left"!==e&&"right"!==e||(n.style.width="number"==typeof l.width?`${l.width}px`:l.width),void 0===l.height||"top"!==e&&"bottom"!==e||(n.style.height="number"==typeof l.height?`${l.height}px`:l.height)}if(void 0!==l.className&&n){const e=t.placement||"right";n.className=`solely-drawer solely-drawer--${e} ${l.className}`.trim()}if(void 0!==l.style&&n&&Object.assign(n.style,l.style),void 0!==l.bodyStyle){const e=f.querySelector(".solely-drawer__body");e&&Object.assign(e.style,l.bodyStyle)}}}},config:function(e){Object.assign(i,e)},destroy:async function(){const e=[...a].reverse();for(const t of e)await c(t.id)}};export{m as Drawer};
1
+ import{createElement as e,observeTheme as t,addClosingAnimation as l,ANIMATION_DURATION as n,injectStyle as s,generateId as o}from"../utils.js";import i from"./style.css.js";const a={width:378,height:378,mask:!0,maskClosable:!0,closable:!0},d=[],c=new Set;async function r(e){var t;if(!c.has(e)){c.add(e);try{const s=d.findIndex(t=>t.id===e);if(-1===s)return;const o=d[s],i=o.element.querySelector(".solely-drawer-mask"),a=o.element.querySelector(".solely-drawer");i&&i.classList.add("is-closing"),a&&a.classList.add("is-closing"),await l(o.element,n.NORMAL),null==(t=o.cleanup)||t.call(o);const c=d.findIndex(t=>t.id===e);-1!==c&&(d[c].element.remove(),d.splice(c,1)),0===d.length&&document.body.classList.remove("solely-drawer-open")}finally{c.delete(e)}}}const y={open:function(l){const n=o();s("solely-drawer-styles",i);const c=l.placement||"right",y=l.width??a.width,p=l.height??a.height,h=l.mask??a.mask,m=l.maskClosable??a.maskClosable,f=l.closable??a.closable,w=e("div",{className:"solely-drawer-wrap"}),u=t(()=>w),b=l.cloneElement??!0,g=[];if(!1!==h){const t=e("div",{className:"solely-drawer-mask"});if(m){const e=()=>{var e;r(n),null==(e=l.onClose)||e.call(l)};t.addEventListener("click",e),g.push({element:t,type:"click",handler:e})}w.appendChild(t)}const C=e("div",{className:`solely-drawer solely-drawer--${c}${l.className?` ${l.className}`:""}`,styles:l.style});if("left"===c||"right"===c?C.style.width="number"==typeof y?`${y}px`:y:C.style.height="number"==typeof p?`${p}px`:p,l.title||!1!==f){const t=e("div",{className:"solely-drawer__header"});if(l.title){const n=e("h3",{className:"solely-drawer__title"});"string"==typeof l.title?n.textContent=l.title:l.title instanceof HTMLElement&&n.appendChild(b?l.title.cloneNode(!0):l.title),t.appendChild(n)}if(!1!==f){const s=e("button",{className:"solely-drawer__close",textContent:"×",attrs:{type:"button","aria-label":"关闭"}}),o=()=>{var e;r(n),null==(e=l.onClose)||e.call(l)};s.addEventListener("click",o),g.push({element:s,type:"click",handler:o}),t.appendChild(s)}C.appendChild(t)}const v=e("div",{className:"solely-drawer__body",styles:l.bodyStyle});return"string"==typeof l.content?v.textContent=l.content||"":l.content instanceof HTMLElement&&v.appendChild(b?l.content.cloneNode(!0):l.content),C.appendChild(v),w.appendChild(C),document.body.appendChild(w),document.body.classList.add("solely-drawer-open"),d.push({id:n,element:w,options:l,cleanup:()=>{g.forEach(({element:e,type:t,handler:l})=>{e.removeEventListener(t,l)}),u()}}),{close:()=>{var e;r(n),null==(e=l.onClose)||e.call(l)},update:t=>{const n=t.cloneElement??b;if(void 0!==t.title){const l=w.querySelector(".solely-drawer__title");if(l)l.innerHTML="","string"==typeof t.title?l.textContent=t.title:t.title instanceof HTMLElement&&l.appendChild(n?t.title.cloneNode(!0):t.title);else if(t.title){const l=e("div",{className:"solely-drawer__header"}),s=e("h3",{className:"solely-drawer__title"});"string"==typeof t.title?s.textContent=t.title:t.title instanceof HTMLElement&&s.appendChild(n?t.title.cloneNode(!0):t.title),l.appendChild(s);const o=w.querySelector(".solely-drawer");null==o||o.insertBefore(l,o.firstChild)}}if(void 0!==t.content){const e=w.querySelector(".solely-drawer__body");e&&(e.innerHTML="","string"==typeof t.content?e.textContent=t.content:t.content instanceof HTMLElement&&e.appendChild(n?t.content.cloneNode(!0):t.content))}const s=w.querySelector(".solely-drawer");if(s){const e=t.placement||l.placement||"right";void 0===t.width||"left"!==e&&"right"!==e||(s.style.width="number"==typeof t.width?`${t.width}px`:t.width),void 0===t.height||"top"!==e&&"bottom"!==e||(s.style.height="number"==typeof t.height?`${t.height}px`:t.height)}if(void 0!==t.className&&s){const e=l.placement||"right";s.className=`solely-drawer solely-drawer--${e} ${t.className}`.trim()}if(void 0!==t.style&&s&&Object.assign(s.style,t.style),void 0!==t.bodyStyle){const e=w.querySelector(".solely-drawer__body");e&&Object.assign(e.style,t.bodyStyle)}}}},config:function(e){Object.assign(a,e)},destroy:async function(){const e=[...d].reverse();for(const t of e)await r(t.id)}};export{y as Drawer};
@@ -27,6 +27,8 @@ export interface DrawerOptions {
27
27
  style?: Partial<CSSStyleDeclaration>;
28
28
  /** 抽屉内容的样式 */
29
29
  bodyStyle?: Partial<CSSStyleDeclaration>;
30
+ /** 是否克隆传入的 HTMLElement 内容(默认 true) */
31
+ cloneElement?: boolean;
30
32
  }
31
33
  export interface DrawerInstance {
32
34
  /** 关闭抽屉 */
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./message/index.cjs"),r=require("./modal/index.cjs"),o=require("./tooltip/index.cjs"),t=require("./drawer/index.cjs"),s=require("./popconfirm/index.cjs"),i=require("./utils.cjs");exports.Message=e.Message,exports.Modal=r.Modal,exports.Tooltip=o.Tooltip,exports.Drawer=t.Drawer,exports.Popconfirm=s.Popconfirm,exports.ANIMATION_DURATION=i.ANIMATION_DURATION,exports.Z_INDEX=i.Z_INDEX,exports.addClosingAnimation=i.addClosingAnimation,exports.calculatePosition=i.calculatePosition,exports.createElement=i.createElement,exports.generateId=i.generateId,exports.injectStyle=i.injectStyle,exports.removeStyle=i.removeStyle,exports.safeAsyncCallback=i.safeAsyncCallback;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./message/index.cjs"),r=require("./modal/index.cjs"),o=require("./tooltip/index.cjs"),t=require("./drawer/index.cjs"),s=require("./popconfirm/index.cjs"),i=require("./utils.cjs");exports.Message=e.Message,exports.Modal=r.Modal,exports.Tooltip=o.Tooltip,exports.Drawer=t.Drawer,exports.Popconfirm=s.Popconfirm,exports.ANIMATION_DURATION=i.ANIMATION_DURATION,exports.Z_INDEX=i.Z_INDEX,exports.addClosingAnimation=i.addClosingAnimation,exports.calculatePosition=i.calculatePosition,exports.createElement=i.createElement,exports.generateId=i.generateId,exports.injectStyle=i.injectStyle,exports.observeTheme=i.observeTheme,exports.removeStyle=i.removeStyle,exports.safeAsyncCallback=i.safeAsyncCallback;
@@ -10,6 +10,6 @@ export type { MessageOptions, MessageInstance, MessageConfig, MessageType, Messa
10
10
  export type { ModalOptions, ModalInstance, ModalConfig, ModalType, ModalButton } from './modal/types';
11
11
  export type { TooltipOptions, TooltipInstance, TooltipConfig, TooltipPlacement, TooltipTrigger } from './tooltip/types';
12
12
  export type { DrawerOptions, DrawerInstance, DrawerConfig, DrawerPlacement } from './drawer/types';
13
- export type { PopconfirmOptions, PopconfirmInstance, PopconfirmConfig, PopconfirmPlacement } from './popconfirm/types';
14
- export { generateId, injectStyle, removeStyle, createElement, calculatePosition, safeAsyncCallback, addClosingAnimation, ANIMATION_DURATION, Z_INDEX, } from './utils';
13
+ export type { PopconfirmOptions, PopconfirmInstance, PopconfirmResult, PopconfirmConfig, PopconfirmPlacement, } from './popconfirm/types';
14
+ export { generateId, injectStyle, removeStyle, createElement, calculatePosition, safeAsyncCallback, addClosingAnimation, observeTheme, ANIMATION_DURATION, Z_INDEX, } from './utils';
15
15
  export type { PositionResult, Placement } from './utils';
@@ -1 +1 @@
1
- import{Message as o}from"./message/index.js";import{Modal as r}from"./modal/index.js";import{Tooltip as m}from"./tooltip/index.js";import{Drawer as i}from"./drawer/index.js";import{Popconfirm as p}from"./popconfirm/index.js";import{ANIMATION_DURATION as t,Z_INDEX as e,addClosingAnimation as s,calculatePosition as d,createElement as f,generateId as j,injectStyle as n,removeStyle as x,safeAsyncCallback as a}from"./utils.js";export{t as ANIMATION_DURATION,i as Drawer,o as Message,r as Modal,p as Popconfirm,m as Tooltip,e as Z_INDEX,s as addClosingAnimation,d as calculatePosition,f as createElement,j as generateId,n as injectStyle,x as removeStyle,a as safeAsyncCallback};
1
+ import{Message as o}from"./message/index.js";import{Modal as r}from"./modal/index.js";import{Tooltip as m}from"./tooltip/index.js";import{Drawer as i}from"./drawer/index.js";import{Popconfirm as p}from"./popconfirm/index.js";import{ANIMATION_DURATION as t,Z_INDEX as e,addClosingAnimation as s,calculatePosition as d,createElement as f,generateId as j,injectStyle as n,observeTheme as x,removeStyle as a,safeAsyncCallback as l}from"./utils.js";export{t as ANIMATION_DURATION,i as Drawer,o as Message,r as Modal,p as Popconfirm,m as Tooltip,e as Z_INDEX,s as addClosingAnimation,d as calculatePosition,f as createElement,j as generateId,n as injectStyle,x as observeTheme,a as removeStyle,l as safeAsyncCallback};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),n={duration:3e3,maxCount:5,gap:8,top:24,bottom:24,left:24,right:24,placement:"top"};let o,s=null;const i=new Set,l=[],a={info:"ℹ",success:"✓",warning:"⚠",error:"✕",loading:e.createElement("span",{className:"solely-message__loading-spinner"})},r=new Map;function c(t,n){const o=e.createElement("span",{className:`solely-message__icon solely-message__icon--${n}`});return"string"==typeof t?o.textContent=t:o.appendChild(t.cloneNode(!0)),o}async function p(t){var n;if(!i.has(t)){i.add(t);try{const i=l.findIndex(e=>e.id===t);if(-1===i)return;const c=l[i];c.timer&&(clearTimeout(c.timer),c.timer=void 0),await e.addClosingAnimation(c.element,e.ANIMATION_DURATION.NORMAL),c.element.remove();const p=l.findIndex(e=>e.id===t);-1!==p&&l.splice(p,1);try{null==(n=c.onClose)||n.call(c)}catch(a){console.error("[Solely Message] onClose callback error:",a)}o&&clearTimeout(o),o=window.setTimeout(()=>{0===l.length&&(r.forEach((e,t)=>{0===e.childElementCount&&(e.remove(),r.delete(t))}),0===r.size&&s&&(s.disconnect(),s=null)),o=void 0},300)}finally{i.delete(t)}}}function d(o){const i=e.generateId(),d=o.placement||n.placement,m=function(o=n.placement){const i=o;if(r.has(i))return r.get(i);const l=e.createElement("div",{className:"solely-message-container"}),a={position:"fixed",display:"flex",flexDirection:"column",gap:`${n.gap}px`,pointerEvents:"none",zIndex:String(e.Z_INDEX.TOAST)};switch(o){case"top":a.top=`${n.top}px`,a.left="50%",a.transform="translateX(-50%)";break;case"topLeft":a.top=`${n.top}px`,a.left=`${n.left}px`,a.alignItems="flex-start";break;case"topRight":a.top=`${n.top}px`,a.right=`${n.right}px`,a.alignItems="flex-end";break;case"bottom":a.bottom=`${n.bottom}px`,a.left="50%",a.transform="translateX(-50%)";break;case"bottomLeft":a.bottom=`${n.bottom}px`,a.left=`${n.left}px`,a.alignItems="flex-start";break;case"bottomRight":a.bottom=`${n.bottom}px`,a.right=`${n.right}px`,a.alignItems="flex-end";break;case"left":a.top="50%",a.left=`${n.left}px`,a.transform="translateY(-50%)",a.alignItems="flex-start";break;case"right":a.top="50%",a.right=`${n.right}px`,a.transform="translateY(-50%)",a.alignItems="flex-end"}Object.assign(l.style,a);const c=document.documentElement.getAttribute("data-theme");return c&&l.setAttribute("data-theme",c),document.body.appendChild(l),e.injectStyle("solely-message-styles",t.default),function(e){s&&s.disconnect(),s=new MutationObserver(()=>{const t=document.documentElement.getAttribute("data-theme");t?e.setAttribute("data-theme",t):e.removeAttribute("data-theme")}),s.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}(l),r.set(i,l),l}(d),u=l.filter(e=>e.placement===d);if(u.length>=n.maxCount){const e=u[0];e&&p(e.id)}const f=function(t,n){const o=t.type||"info",s=!1!==t.showIcon,i=e.createElement("div",{className:`solely-message solely-message--${o}${t.className?` ${t.className}`:""}`,styles:t.style});if(i.setAttribute("role","error"===o||"warning"===o?"alert":"status"),i.setAttribute("aria-live","error"===o||"warning"===o?"assertive":"polite"),s){const e=t.icon?c(t.icon,o):c(a[o],o);i.appendChild(e)}const l=e.createElement("span",{className:"solely-message__content"}),r=e.createElement("span",{className:"solely-message__text"});if("string"==typeof t.content?r.textContent=t.content:t.content instanceof HTMLElement&&r.appendChild(t.content.cloneNode(!0)),l.appendChild(r),t.description){const n=e.createElement("span",{className:"solely-message__description"});"string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(t.description.cloneNode(!0)),l.appendChild(n)}if(i.appendChild(l),t.closable){const t=e.createElement("button",{className:"solely-message__close",textContent:"×",attrs:{type:"button","aria-label":"关闭"}});t.onclick=()=>p(n),i.appendChild(t)}return i}(o,i);m.appendChild(f);const g={id:i,element:f,onClose:o.onClose,placement:d},y=o.duration??n.duration;return y>0&&(g.timer=window.setTimeout(()=>{p(i)},y)),l.push(g),{close:()=>p(i),update:t=>{if("string"==typeof t||t instanceof HTMLElement){const e=f.querySelector(".solely-message__text");return void(e&&(e.innerHTML="","string"==typeof t?e.textContent=t:t instanceof HTMLElement&&e.appendChild(t.cloneNode(!0))))}if(void 0!==t.content){const e=f.querySelector(".solely-message__text");e&&(e.innerHTML="","string"==typeof t.content?e.textContent=t.content:t.content instanceof HTMLElement&&e.appendChild(t.content.cloneNode(!0)))}if(void 0!==t.description){let n=f.querySelector(".solely-message__description");if(!n&&t.description){n=e.createElement("span",{className:"solely-message__description"}),"string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(t.description.cloneNode(!0));const o=f.querySelector(".solely-message__content");null==o||o.appendChild(n)}else n&&(t.description?(n.innerHTML="","string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(t.description.cloneNode(!0))):n.remove())}}}}const m={open:d,info:function(e,t){return d({content:e,type:"info",..."number"==typeof t?{duration:t}:t})},success:function(e,t){return d({content:e,type:"success",..."number"==typeof t?{duration:t}:t})},warning:function(e,t){return d({content:e,type:"warning",..."number"==typeof t?{duration:t}:t})},error:function(e,t){return d({content:e,type:"error",..."number"==typeof t?{duration:t}:t})},loading:function(e,t){return d(void 0===t?{content:e,type:"loading",duration:0,closable:!0}:"number"==typeof t?{content:e,type:"loading",duration:t,closable:!0}:{content:e,type:"loading",duration:0,closable:!0,...t})},config:function(e){Object.assign(n,e),r.forEach((t,n)=>{void 0!==e.top&&["top","topLeft","topRight"].includes(n)&&(t.style.top=`${e.top}px`),void 0!==e.bottom&&["bottom","bottomLeft","bottomRight"].includes(n)&&(t.style.bottom=`${e.bottom}px`),void 0!==e.left&&["topLeft","bottomLeft","left"].includes(n)&&(t.style.left=`${e.left}px`),void 0!==e.right&&["topRight","bottomRight","right"].includes(n)&&(t.style.right=`${e.right}px`),void 0!==e.gap&&(t.style.gap=`${e.gap}px`)})},destroy:async function(){o&&(clearTimeout(o),o=void 0);const e=[...l];await Promise.all(e.map(e=>p(e.id)))}};exports.Message=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),n={duration:3e3,maxCount:5,gap:8,top:24,bottom:24,left:24,right:24,placement:"top"};let o;const s=new Set,i=[],l={info:"ℹ",success:"✓",warning:"⚠",error:"✕",loading:e.createElement("span",{className:"solely-message__loading-spinner"})},a=new Map;function r(t,n){const o=e.createElement("span",{className:`solely-message__icon solely-message__icon--${n}`});return"string"==typeof t?o.textContent=t:o.appendChild(t.cloneNode(!0)),o}async function c(t){var n;if(!s.has(t)){s.add(t);try{const s=i.findIndex(e=>e.id===t);if(-1===s)return;const r=i[s];r.timer&&(clearTimeout(r.timer),r.timer=void 0),await e.addClosingAnimation(r.element,e.ANIMATION_DURATION.NORMAL),r.element.remove();const c=i.findIndex(e=>e.id===t);-1!==c&&i.splice(c,1);try{null==(n=r.onClose)||n.call(r)}catch(l){console.error("[Solely Message] onClose callback error:",l)}o&&clearTimeout(o),o=window.setTimeout(()=>{0===i.length&&a.forEach((e,t)=>{0===e.element.childElementCount&&(e.element.remove(),e.cleanupTheme(),a.delete(t))}),o=void 0},300)}finally{s.delete(t)}}}function p(o){const s=e.generateId(),p=o.placement||n.placement,d=function(o=n.placement){const s=o;if(a.has(s))return a.get(s).element;const i=e.createElement("div",{className:"solely-message-container"}),l={position:"fixed",display:"flex",flexDirection:"column",gap:`${n.gap}px`,pointerEvents:"none",zIndex:String(e.Z_INDEX.TOAST)};switch(o){case"top":l.top=`${n.top}px`,l.left="50%",l.transform="translateX(-50%)";break;case"topLeft":l.top=`${n.top}px`,l.left=`${n.left}px`,l.alignItems="flex-start";break;case"topRight":l.top=`${n.top}px`,l.right=`${n.right}px`,l.alignItems="flex-end";break;case"bottom":l.bottom=`${n.bottom}px`,l.left="50%",l.transform="translateX(-50%)";break;case"bottomLeft":l.bottom=`${n.bottom}px`,l.left=`${n.left}px`,l.alignItems="flex-start";break;case"bottomRight":l.bottom=`${n.bottom}px`,l.right=`${n.right}px`,l.alignItems="flex-end";break;case"left":l.top="50%",l.left=`${n.left}px`,l.transform="translateY(-50%)",l.alignItems="flex-start";break;case"right":l.top="50%",l.right=`${n.right}px`,l.transform="translateY(-50%)",l.alignItems="flex-end"}Object.assign(i.style,l),document.body.appendChild(i),e.injectStyle("solely-message-styles",t.default);const r=e.observeTheme(()=>i);return a.set(s,{element:i,cleanupTheme:r}),i}(p),m=i.filter(e=>e.placement===p);if(m.length>=n.maxCount){const e=m[0];e&&c(e.id)}const f=function(t,n){const o=t.type||"info",s=!1!==t.showIcon,i=t.cloneElement??!0,a=e.createElement("div",{className:`solely-message solely-message--${o}${t.className?` ${t.className}`:""}`,styles:t.style});if(a.setAttribute("role","error"===o||"warning"===o?"alert":"status"),a.setAttribute("aria-live","error"===o||"warning"===o?"assertive":"polite"),s){const e=t.icon?r(t.icon,o):r(l[o],o);a.appendChild(e)}const p=e.createElement("span",{className:"solely-message__content"}),d=e.createElement("span",{className:"solely-message__text"});if("string"==typeof t.content?d.textContent=t.content:t.content instanceof HTMLElement&&d.appendChild(i?t.content.cloneNode(!0):t.content),p.appendChild(d),t.description){const n=e.createElement("span",{className:"solely-message__description"});"string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(i?t.description.cloneNode(!0):t.description),p.appendChild(n)}if(a.appendChild(p),t.closable){const t=e.createElement("button",{className:"solely-message__close",textContent:"×",attrs:{type:"button","aria-label":"关闭"}});t.onclick=()=>c(n),a.appendChild(t)}return a}(o,s);d.appendChild(f);const g={id:s,element:f,onClose:o.onClose,placement:p},u=o.duration??n.duration;return u>0&&(g.timer=window.setTimeout(()=>{c(s)},u)),i.push(g),{close:()=>c(s),update:t=>{if("string"==typeof t||t instanceof HTMLElement){const e=f.querySelector(".solely-message__text");return void(e&&(e.innerHTML="","string"==typeof t?e.textContent=t:t instanceof HTMLElement&&e.appendChild(t.cloneNode(!0))))}if(void 0!==t.content){const e=f.querySelector(".solely-message__text");e&&(e.innerHTML="","string"==typeof t.content?e.textContent=t.content:t.content instanceof HTMLElement&&e.appendChild(t.content.cloneNode(!0)))}if(void 0!==t.description){let n=f.querySelector(".solely-message__description");if(!n&&t.description){n=e.createElement("span",{className:"solely-message__description"}),"string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(t.description.cloneNode(!0));const o=f.querySelector(".solely-message__content");null==o||o.appendChild(n)}else n&&(t.description?(n.innerHTML="","string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(t.description.cloneNode(!0))):n.remove())}}}}const d={open:p,info:function(e,t){return p({content:e,type:"info",..."number"==typeof t?{duration:t}:t})},success:function(e,t){return p({content:e,type:"success",..."number"==typeof t?{duration:t}:t})},warning:function(e,t){return p({content:e,type:"warning",..."number"==typeof t?{duration:t}:t})},error:function(e,t){return p({content:e,type:"error",..."number"==typeof t?{duration:t}:t})},loading:function(e,t){return p(void 0===t?{content:e,type:"loading",duration:0,closable:!0}:"number"==typeof t?{content:e,type:"loading",duration:t,closable:!0}:{content:e,type:"loading",duration:0,closable:!0,...t})},config:function(e){Object.assign(n,e),a.forEach((t,n)=>{const o=t.element;void 0!==e.top&&["top","topLeft","topRight"].includes(n)&&(o.style.top=`${e.top}px`),void 0!==e.bottom&&["bottom","bottomLeft","bottomRight"].includes(n)&&(o.style.bottom=`${e.bottom}px`),void 0!==e.left&&["topLeft","bottomLeft","left"].includes(n)&&(o.style.left=`${e.left}px`),void 0!==e.right&&["topRight","bottomRight","right"].includes(n)&&(o.style.right=`${e.right}px`),void 0!==e.gap&&(o.style.gap=`${e.gap}px`)})},destroy:async function(){o&&(clearTimeout(o),o=void 0);const e=[...i];await Promise.all(e.map(e=>c(e.id)))}};exports.Message=d;
@@ -1 +1 @@
1
- import{createElement as t,addClosingAnimation as e,ANIMATION_DURATION as n,Z_INDEX as o,generateId as s,injectStyle as i}from"../utils.js";import l from"./style.css.js";const a={duration:3e3,maxCount:5,gap:8,top:24,bottom:24,left:24,right:24,placement:"top"};let r,c=null;const p=new Set,d=[],m={info:"ℹ",success:"✓",warning:"⚠",error:"✕",loading:t("span",{className:"solely-message__loading-spinner"})},f=new Map;function u(e,n){const o=t("span",{className:`solely-message__icon solely-message__icon--${n}`});return"string"==typeof e?o.textContent=e:o.appendChild(e.cloneNode(!0)),o}async function g(t){var o;if(!p.has(t)){p.add(t);try{const i=d.findIndex(e=>e.id===t);if(-1===i)return;const l=d[i];l.timer&&(clearTimeout(l.timer),l.timer=void 0),await e(l.element,n.NORMAL),l.element.remove();const a=d.findIndex(e=>e.id===t);-1!==a&&d.splice(a,1);try{null==(o=l.onClose)||o.call(l)}catch(s){console.error("[Solely Message] onClose callback error:",s)}r&&clearTimeout(r),r=window.setTimeout(()=>{0===d.length&&(f.forEach((t,e)=>{0===t.childElementCount&&(t.remove(),f.delete(e))}),0===f.size&&c&&(c.disconnect(),c=null)),r=void 0},300)}finally{p.delete(t)}}}function y(e){const n=s(),r=e.placement||a.placement,p=function(e=a.placement){const n=e;if(f.has(n))return f.get(n);const s=t("div",{className:"solely-message-container"}),r={position:"fixed",display:"flex",flexDirection:"column",gap:`${a.gap}px`,pointerEvents:"none",zIndex:String(o.TOAST)};switch(e){case"top":r.top=`${a.top}px`,r.left="50%",r.transform="translateX(-50%)";break;case"topLeft":r.top=`${a.top}px`,r.left=`${a.left}px`,r.alignItems="flex-start";break;case"topRight":r.top=`${a.top}px`,r.right=`${a.right}px`,r.alignItems="flex-end";break;case"bottom":r.bottom=`${a.bottom}px`,r.left="50%",r.transform="translateX(-50%)";break;case"bottomLeft":r.bottom=`${a.bottom}px`,r.left=`${a.left}px`,r.alignItems="flex-start";break;case"bottomRight":r.bottom=`${a.bottom}px`,r.right=`${a.right}px`,r.alignItems="flex-end";break;case"left":r.top="50%",r.left=`${a.left}px`,r.transform="translateY(-50%)",r.alignItems="flex-start";break;case"right":r.top="50%",r.right=`${a.right}px`,r.transform="translateY(-50%)",r.alignItems="flex-end"}Object.assign(s.style,r);const p=document.documentElement.getAttribute("data-theme");return p&&s.setAttribute("data-theme",p),document.body.appendChild(s),i("solely-message-styles",l),function(t){c&&c.disconnect(),c=new MutationObserver(()=>{const e=document.documentElement.getAttribute("data-theme");e?t.setAttribute("data-theme",e):t.removeAttribute("data-theme")}),c.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}(s),f.set(n,s),s}(r),y=d.filter(t=>t.placement===r);if(y.length>=a.maxCount){const t=y[0];t&&g(t.id)}const b=function(e,n){const o=e.type||"info",s=!1!==e.showIcon,i=t("div",{className:`solely-message solely-message--${o}${e.className?` ${e.className}`:""}`,styles:e.style});if(i.setAttribute("role","error"===o||"warning"===o?"alert":"status"),i.setAttribute("aria-live","error"===o||"warning"===o?"assertive":"polite"),s){const t=e.icon?u(e.icon,o):u(m[o],o);i.appendChild(t)}const l=t("span",{className:"solely-message__content"}),a=t("span",{className:"solely-message__text"});if("string"==typeof e.content?a.textContent=e.content:e.content instanceof HTMLElement&&a.appendChild(e.content.cloneNode(!0)),l.appendChild(a),e.description){const n=t("span",{className:"solely-message__description"});"string"==typeof e.description?n.textContent=e.description:e.description instanceof HTMLElement&&n.appendChild(e.description.cloneNode(!0)),l.appendChild(n)}if(i.appendChild(l),e.closable){const e=t("button",{className:"solely-message__close",textContent:"×",attrs:{type:"button","aria-label":"关闭"}});e.onclick=()=>g(n),i.appendChild(e)}return i}(e,n);p.appendChild(b);const h={id:n,element:b,onClose:e.onClose,placement:r},x=e.duration??a.duration;return x>0&&(h.timer=window.setTimeout(()=>{g(n)},x)),d.push(h),{close:()=>g(n),update:e=>{if("string"==typeof e||e instanceof HTMLElement){const t=b.querySelector(".solely-message__text");return void(t&&(t.innerHTML="","string"==typeof e?t.textContent=e:e instanceof HTMLElement&&t.appendChild(e.cloneNode(!0))))}if(void 0!==e.content){const t=b.querySelector(".solely-message__text");t&&(t.innerHTML="","string"==typeof e.content?t.textContent=e.content:e.content instanceof HTMLElement&&t.appendChild(e.content.cloneNode(!0)))}if(void 0!==e.description){let n=b.querySelector(".solely-message__description");if(!n&&e.description){n=t("span",{className:"solely-message__description"}),"string"==typeof e.description?n.textContent=e.description:e.description instanceof HTMLElement&&n.appendChild(e.description.cloneNode(!0));const o=b.querySelector(".solely-message__content");null==o||o.appendChild(n)}else n&&(e.description?(n.innerHTML="","string"==typeof e.description?n.textContent=e.description:e.description instanceof HTMLElement&&n.appendChild(e.description.cloneNode(!0))):n.remove())}}}}const b={open:y,info:function(t,e){return y({content:t,type:"info",..."number"==typeof e?{duration:e}:e})},success:function(t,e){return y({content:t,type:"success",..."number"==typeof e?{duration:e}:e})},warning:function(t,e){return y({content:t,type:"warning",..."number"==typeof e?{duration:e}:e})},error:function(t,e){return y({content:t,type:"error",..."number"==typeof e?{duration:e}:e})},loading:function(t,e){return y(void 0===e?{content:t,type:"loading",duration:0,closable:!0}:"number"==typeof e?{content:t,type:"loading",duration:e,closable:!0}:{content:t,type:"loading",duration:0,closable:!0,...e})},config:function(t){Object.assign(a,t),f.forEach((e,n)=>{void 0!==t.top&&["top","topLeft","topRight"].includes(n)&&(e.style.top=`${t.top}px`),void 0!==t.bottom&&["bottom","bottomLeft","bottomRight"].includes(n)&&(e.style.bottom=`${t.bottom}px`),void 0!==t.left&&["topLeft","bottomLeft","left"].includes(n)&&(e.style.left=`${t.left}px`),void 0!==t.right&&["topRight","bottomRight","right"].includes(n)&&(e.style.right=`${t.right}px`),void 0!==t.gap&&(e.style.gap=`${t.gap}px`)})},destroy:async function(){r&&(clearTimeout(r),r=void 0);const t=[...d];await Promise.all(t.map(t=>g(t.id)))}};export{b as Message};
1
+ import{createElement as e,addClosingAnimation as t,ANIMATION_DURATION as n,Z_INDEX as o,observeTheme as s,generateId as i,injectStyle as l}from"../utils.js";import a from"./style.css.js";const r={duration:3e3,maxCount:5,gap:8,top:24,bottom:24,left:24,right:24,placement:"top"};let c;const p=new Set,d=[],m={info:"ℹ",success:"✓",warning:"⚠",error:"✕",loading:e("span",{className:"solely-message__loading-spinner"})},f=new Map;function g(t,n){const o=e("span",{className:`solely-message__icon solely-message__icon--${n}`});return"string"==typeof t?o.textContent=t:o.appendChild(t.cloneNode(!0)),o}async function u(e){var o;if(!p.has(e)){p.add(e);try{const i=d.findIndex(t=>t.id===e);if(-1===i)return;const l=d[i];l.timer&&(clearTimeout(l.timer),l.timer=void 0),await t(l.element,n.NORMAL),l.element.remove();const a=d.findIndex(t=>t.id===e);-1!==a&&d.splice(a,1);try{null==(o=l.onClose)||o.call(l)}catch(s){console.error("[Solely Message] onClose callback error:",s)}c&&clearTimeout(c),c=window.setTimeout(()=>{0===d.length&&f.forEach((e,t)=>{0===e.element.childElementCount&&(e.element.remove(),e.cleanupTheme(),f.delete(t))}),c=void 0},300)}finally{p.delete(e)}}}function y(t){const n=i(),c=t.placement||r.placement,p=function(t=r.placement){const n=t;if(f.has(n))return f.get(n).element;const i=e("div",{className:"solely-message-container"}),c={position:"fixed",display:"flex",flexDirection:"column",gap:`${r.gap}px`,pointerEvents:"none",zIndex:String(o.TOAST)};switch(t){case"top":c.top=`${r.top}px`,c.left="50%",c.transform="translateX(-50%)";break;case"topLeft":c.top=`${r.top}px`,c.left=`${r.left}px`,c.alignItems="flex-start";break;case"topRight":c.top=`${r.top}px`,c.right=`${r.right}px`,c.alignItems="flex-end";break;case"bottom":c.bottom=`${r.bottom}px`,c.left="50%",c.transform="translateX(-50%)";break;case"bottomLeft":c.bottom=`${r.bottom}px`,c.left=`${r.left}px`,c.alignItems="flex-start";break;case"bottomRight":c.bottom=`${r.bottom}px`,c.right=`${r.right}px`,c.alignItems="flex-end";break;case"left":c.top="50%",c.left=`${r.left}px`,c.transform="translateY(-50%)",c.alignItems="flex-start";break;case"right":c.top="50%",c.right=`${r.right}px`,c.transform="translateY(-50%)",c.alignItems="flex-end"}Object.assign(i.style,c),document.body.appendChild(i),l("solely-message-styles",a);const p=s(()=>i);return f.set(n,{element:i,cleanupTheme:p}),i}(c),y=d.filter(e=>e.placement===c);if(y.length>=r.maxCount){const e=y[0];e&&u(e.id)}const h=function(t,n){const o=t.type||"info",s=!1!==t.showIcon,i=t.cloneElement??!0,l=e("div",{className:`solely-message solely-message--${o}${t.className?` ${t.className}`:""}`,styles:t.style});if(l.setAttribute("role","error"===o||"warning"===o?"alert":"status"),l.setAttribute("aria-live","error"===o||"warning"===o?"assertive":"polite"),s){const e=t.icon?g(t.icon,o):g(m[o],o);l.appendChild(e)}const a=e("span",{className:"solely-message__content"}),r=e("span",{className:"solely-message__text"});if("string"==typeof t.content?r.textContent=t.content:t.content instanceof HTMLElement&&r.appendChild(i?t.content.cloneNode(!0):t.content),a.appendChild(r),t.description){const n=e("span",{className:"solely-message__description"});"string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(i?t.description.cloneNode(!0):t.description),a.appendChild(n)}if(l.appendChild(a),t.closable){const t=e("button",{className:"solely-message__close",textContent:"×",attrs:{type:"button","aria-label":"关闭"}});t.onclick=()=>u(n),l.appendChild(t)}return l}(t,n);p.appendChild(h);const x={id:n,element:h,onClose:t.onClose,placement:c},b=t.duration??r.duration;return b>0&&(x.timer=window.setTimeout(()=>{u(n)},b)),d.push(x),{close:()=>u(n),update:t=>{if("string"==typeof t||t instanceof HTMLElement){const e=h.querySelector(".solely-message__text");return void(e&&(e.innerHTML="","string"==typeof t?e.textContent=t:t instanceof HTMLElement&&e.appendChild(t.cloneNode(!0))))}if(void 0!==t.content){const e=h.querySelector(".solely-message__text");e&&(e.innerHTML="","string"==typeof t.content?e.textContent=t.content:t.content instanceof HTMLElement&&e.appendChild(t.content.cloneNode(!0)))}if(void 0!==t.description){let n=h.querySelector(".solely-message__description");if(!n&&t.description){n=e("span",{className:"solely-message__description"}),"string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(t.description.cloneNode(!0));const o=h.querySelector(".solely-message__content");null==o||o.appendChild(n)}else n&&(t.description?(n.innerHTML="","string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(t.description.cloneNode(!0))):n.remove())}}}}const h={open:y,info:function(e,t){return y({content:e,type:"info",..."number"==typeof t?{duration:t}:t})},success:function(e,t){return y({content:e,type:"success",..."number"==typeof t?{duration:t}:t})},warning:function(e,t){return y({content:e,type:"warning",..."number"==typeof t?{duration:t}:t})},error:function(e,t){return y({content:e,type:"error",..."number"==typeof t?{duration:t}:t})},loading:function(e,t){return y(void 0===t?{content:e,type:"loading",duration:0,closable:!0}:"number"==typeof t?{content:e,type:"loading",duration:t,closable:!0}:{content:e,type:"loading",duration:0,closable:!0,...t})},config:function(e){Object.assign(r,e),f.forEach((t,n)=>{const o=t.element;void 0!==e.top&&["top","topLeft","topRight"].includes(n)&&(o.style.top=`${e.top}px`),void 0!==e.bottom&&["bottom","bottomLeft","bottomRight"].includes(n)&&(o.style.bottom=`${e.bottom}px`),void 0!==e.left&&["topLeft","bottomLeft","left"].includes(n)&&(o.style.left=`${e.left}px`),void 0!==e.right&&["topRight","bottomRight","right"].includes(n)&&(o.style.right=`${e.right}px`),void 0!==e.gap&&(o.style.gap=`${e.gap}px`)})},destroy:async function(){c&&(clearTimeout(c),c=void 0);const e=[...d];await Promise.all(e.map(e=>u(e.id)))}};export{h as Message};
@@ -23,6 +23,8 @@ export interface MessageOptions {
23
23
  onClose?: () => void;
24
24
  /** 消息位置,默认 'top' */
25
25
  placement?: MessagePlacement;
26
+ /** 是否克隆传入的 HTMLElement 内容(默认 true) */
27
+ cloneElement?: boolean;
26
28
  }
27
29
  export interface MessageInstance {
28
30
  /** 手动关闭当前消息 */
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),n={width:520,mask:!0,maskClosable:!1,okText:"确定",cancelText:"取消"},l=[],o=new Set;let a=null;const s={info:"ℹ",success:"✓",warning:"⚠",error:"✕",confirm:"?"};async function c(t){var n;if(!o.has(t)){o.add(t);try{const o=l.findIndex(e=>e.id===t);if(-1===o)return;const a=l[o],s=a.element.querySelector(".solely-modal-mask"),c=a.element.querySelector(".solely-modal");s&&s.classList.add("is-closing"),c&&c.classList.add("is-closing"),await e.addClosingAnimation(a.element,e.ANIMATION_DURATION.NORMAL),null==(n=a.cleanup)||n.call(a);const i=l.findIndex(e=>e.id===t);-1!==i&&(l[i].element.remove(),l.splice(i,1))}finally{o.delete(t)}}}async function i(){if(0===l.length)return;const e=l[l.length-1];await c(e.id)}function d(t,n,l,o=!1){const a=e.createElement("button",{className:`solely-modal__btn solely-modal__btn--${"default"===n?"default":n}`,attrs:{type:"button"}});return"string"==typeof t?a.textContent=t:t instanceof HTMLElement&&a.appendChild(o?t.cloneNode(!0):t),a.onclick=()=>e.safeAsyncCallback(l),a}function r(o){const i=e.generateId();e.injectStyle("solely-modal-styles",t.default);const r=o.type||"info",m=o.width??n.width,u=o.showCancel??"confirm"===r,p=o.maskClosable??n.maskClosable,y=e.createElement("div",{className:"solely-modal-wrap",attrs:{tabIndex:"-1",part:"wrap"}}),f=function(e){return(()=>{const t=document.documentElement.getAttribute("data-theme");t?e.setAttribute("data-theme",t):e.removeAttribute("data-theme")})(),a||(a=new MutationObserver(()=>{l.forEach(e=>{const t=document.documentElement.getAttribute("data-theme");t?e.element.setAttribute("data-theme",t):e.element.removeAttribute("data-theme")})}),a.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})),()=>{a&&0===l.length&&(a.disconnect(),a=null)}}(y),h=[];if(!1!==o.mask){const t=e.createElement("div",{className:"solely-modal-mask"});if(p){const e=()=>{var e;c(i),null==(e=o.onCancel)||e.call(o)};t.onclick=e,h.push({element:t,type:"click",handler:e})}y.appendChild(t)}const C=e.createElement("div",{className:"solely-modal"+(o.className?` ${o.className}`:""),styles:{...o.style,width:"number"==typeof m?`${m}px`:m}}),b=e.createElement("div",{className:"solely-modal__header"}),E=e.createElement("h3",{className:"solely-modal__title"});if("string"==typeof o.title)E.textContent=o.title||"";else if(o.title instanceof HTMLElement){const e=o.cloneElement??!1;E.appendChild(e?o.title.cloneNode(!0):o.title)}if(b.appendChild(E),!1!==o.closable){const t=e.createElement("button",{className:"solely-modal__close",textContent:"×",attrs:{type:"button","aria-label":"关闭",part:"close"}}),n=()=>{var e;c(i),null==(e=o.onClose)||e.call(o)};t.onclick=n,h.push({element:t,type:"click",handler:n}),b.appendChild(t)}C.appendChild(b);const _=e.createElement("div",{className:"solely-modal__body"}),v=e.createElement("div",{className:"solely-modal__content-wrapper"});if(!1!==o.showIcon){const t=e.createElement("span",{className:`solely-modal__icon solely-modal__icon--${r}`,textContent:s[r]});v.appendChild(t)}const N=e.createElement("div",{className:"solely-modal__content"});if("string"==typeof o.content)N.textContent=o.content||"";else if(o.content instanceof HTMLElement){const e=o.cloneElement??!1;N.appendChild(e?o.content.cloneNode(!0):o.content)}v.appendChild(N),_.appendChild(v),C.appendChild(_);const g=e.createElement("div",{className:"solely-modal__footer"});if(o.buttons&&o.buttons.length>0)o.buttons.forEach(t=>{const n=d(t.text,t.type||"default",async()=>{await e.safeAsyncCallback(()=>t.onClick())},o.cloneElement);t.style&&Object.assign(n.style,t.style),g.appendChild(n)});else{if(u){const e=d(o.cancelText||n.cancelText,"default",()=>{var e;c(i),null==(e=o.onCancel)||e.call(o)},o.cloneElement);g.appendChild(e)}const t=d(o.okText||n.okText,o.okType||"primary",async()=>{o.onOk&&!1===await e.safeAsyncCallback(()=>o.onOk())||c(i)},o.cloneElement);g.appendChild(t)}C.appendChild(g),y.appendChild(C),document.body.appendChild(y),l.push({id:i,element:y,instance:null,cleanup:()=>{h.forEach(({element:e,type:t,handler:n})=>{e.removeEventListener(t,n)}),f()}});const w={close:()=>{var e;c(i),null==(e=o.onClose)||e.call(o)},update:e=>{if(void 0!==e.title){const t=y.querySelector(".solely-modal__title");if(t)if(t.innerHTML="","string"==typeof e.title)t.textContent=e.title;else if(e.title instanceof HTMLElement){const n=e.cloneElement??!1;t.appendChild(n?e.title.cloneNode(!0):e.title)}}if(void 0!==e.content){const t=y.querySelector(".solely-modal__content");if(t)if(t.innerHTML="","string"==typeof e.content)t.textContent=e.content;else if(e.content instanceof HTMLElement){const n=e.cloneElement??!1;t.appendChild(n?e.content.cloneNode(!0):e.content)}}if(void 0!==e.width){const t=y.querySelector(".solely-modal");t&&(t.style.width="number"==typeof e.width?`${e.width}px`:e.width)}if(void 0!==e.className){const t=y.querySelector(".solely-modal");t&&(t.className=`solely-modal ${e.className}`.trim())}if(void 0!==e.style){const t=y.querySelector(".solely-modal");t&&Object.assign(t.style,e.style)}}},k=l.find(e=>e.id===i);return k&&(k.instance=w),w}const m={open:r,confirm:function(e){return r({...e,type:"confirm",showCancel:!0})},info:function(e){return r({...e,type:"info"})},success:function(e){return r({...e,type:"success"})},error:function(e){return r({...e,type:"error"})},warning:function(e){return r({...e,type:"warning"})},config:function(e){Object.assign(n,e)},destroy:async function(){for(;l.length>0;)await i()}};exports.Modal=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),n={width:520,mask:!0,maskClosable:!1,okText:"确定",cancelText:"取消"},l=[],o=new Set,s={info:"ℹ",success:"✓",warning:"⚠",error:"✕",confirm:"?"};async function a(t){var n;if(!o.has(t)){o.add(t);try{const o=l.findIndex(e=>e.id===t);if(-1===o)return;const s=l[o],a=s.element.querySelector(".solely-modal-mask"),c=s.element.querySelector(".solely-modal");a&&a.classList.add("is-closing"),c&&c.classList.add("is-closing"),await e.addClosingAnimation(s.element,e.ANIMATION_DURATION.NORMAL),null==(n=s.cleanup)||n.call(s);const i=l.findIndex(e=>e.id===t);-1!==i&&(l[i].element.remove(),l.splice(i,1))}finally{o.delete(t)}}}async function c(){if(0===l.length)return;const e=l[l.length-1];await a(e.id)}function i(t,n,l,o=!1){const s=e.createElement("button",{className:`solely-modal__btn solely-modal__btn--${"default"===n?"default":n}`,attrs:{type:"button"}});return"string"==typeof t?s.textContent=t:t instanceof HTMLElement&&s.appendChild(o?t.cloneNode(!0):t),s.onclick=()=>e.safeAsyncCallback(l),s}function d(o){const c=e.generateId();e.injectStyle("solely-modal-styles",t.default);const d=o.type||"info",r=o.width??n.width,m=o.showCancel??"confirm"===d,p=o.maskClosable??n.maskClosable,y=e.createElement("div",{className:"solely-modal-wrap",attrs:{tabIndex:"-1",part:"wrap"}}),f=e.observeTheme(()=>y),u=[];if(!1!==o.mask){const t=e.createElement("div",{className:"solely-modal-mask"});if(p){const e=()=>{var e;a(c),null==(e=o.onCancel)||e.call(o)};t.onclick=e,u.push({element:t,type:"click",handler:e})}y.appendChild(t)}const h=e.createElement("div",{className:"solely-modal"+(o.className?` ${o.className}`:""),styles:{...o.style,width:"number"==typeof r?`${r}px`:r}}),C=e.createElement("div",{className:"solely-modal__header"}),b=e.createElement("h3",{className:"solely-modal__title"});if("string"==typeof o.title)b.textContent=o.title||"";else if(o.title instanceof HTMLElement){const e=o.cloneElement??!1;b.appendChild(e?o.title.cloneNode(!0):o.title)}if(C.appendChild(b),!1!==o.closable){const t=e.createElement("button",{className:"solely-modal__close",textContent:"×",attrs:{type:"button","aria-label":"关闭",part:"close"}}),n=()=>{var e;a(c),null==(e=o.onClose)||e.call(o)};t.onclick=n,u.push({element:t,type:"click",handler:n}),C.appendChild(t)}h.appendChild(C);const E=e.createElement("div",{className:"solely-modal__body"}),_=e.createElement("div",{className:"solely-modal__content-wrapper"});if(!1!==o.showIcon){const t=e.createElement("span",{className:`solely-modal__icon solely-modal__icon--${d}`,textContent:s[d]});_.appendChild(t)}const N=e.createElement("div",{className:"solely-modal__content"});if("string"==typeof o.content)N.textContent=o.content||"";else if(o.content instanceof HTMLElement){const e=o.cloneElement??!1;N.appendChild(e?o.content.cloneNode(!0):o.content)}_.appendChild(N),E.appendChild(_),h.appendChild(E);const w=e.createElement("div",{className:"solely-modal__footer"});if(o.buttons&&o.buttons.length>0)o.buttons.forEach(t=>{const n=i(t.text,t.type||"default",async()=>{await e.safeAsyncCallback(()=>t.onClick())},o.cloneElement);t.style&&Object.assign(n.style,t.style),w.appendChild(n)});else{if(m){const e=i(o.cancelText||n.cancelText,"default",()=>{var e;a(c),null==(e=o.onCancel)||e.call(o)},o.cloneElement);w.appendChild(e)}const t=i(o.okText||n.okText,o.okType||"primary",async()=>{const t=o.onConfirm||o.onOk;t&&!1===await e.safeAsyncCallback(()=>t())||a(c)},o.cloneElement);w.appendChild(t)}h.appendChild(w),y.appendChild(h),document.body.appendChild(y),l.push({id:c,element:y,instance:null,cleanup:()=>{u.forEach(({element:e,type:t,handler:n})=>{e.removeEventListener(t,n)}),f()}});const v={close:()=>{var e;a(c),null==(e=o.onClose)||e.call(o)},update:e=>{if(void 0!==e.title){const t=y.querySelector(".solely-modal__title");if(t)if(t.innerHTML="","string"==typeof e.title)t.textContent=e.title;else if(e.title instanceof HTMLElement){const n=e.cloneElement??!1;t.appendChild(n?e.title.cloneNode(!0):e.title)}}if(void 0!==e.content){const t=y.querySelector(".solely-modal__content");if(t)if(t.innerHTML="","string"==typeof e.content)t.textContent=e.content;else if(e.content instanceof HTMLElement){const n=e.cloneElement??!1;t.appendChild(n?e.content.cloneNode(!0):e.content)}}if(void 0!==e.width){const t=y.querySelector(".solely-modal");t&&(t.style.width="number"==typeof e.width?`${e.width}px`:e.width)}if(void 0!==e.className){const t=y.querySelector(".solely-modal");t&&(t.className=`solely-modal ${e.className}`.trim())}if(void 0!==e.style){const t=y.querySelector(".solely-modal");t&&Object.assign(t.style,e.style)}}},g=l.find(e=>e.id===c);return g&&(g.instance=v),v}const r={open:d,confirm:function(e){return d({...e,type:"confirm",showCancel:!0})},info:function(e){return d({...e,type:"info"})},success:function(e){return d({...e,type:"success"})},error:function(e){return d({...e,type:"error"})},warning:function(e){return d({...e,type:"warning"})},config:function(e){Object.assign(n,e)},destroy:async function(){for(;l.length>0;)await c()}};exports.Modal=r;
@@ -1 +1 @@
1
- import{createElement as e,safeAsyncCallback as t,injectStyle as n,addClosingAnimation as l,ANIMATION_DURATION as o,generateId as s}from"../utils.js";import a from"./style.css.js";const c={width:520,mask:!0,maskClosable:!1,okText:"确定",cancelText:"取消"},i=[],d=new Set;let r=null;const m={info:"ℹ",success:"✓",warning:"⚠",error:"✕",confirm:"?"};async function p(e){var t;if(!d.has(e)){d.add(e);try{const n=i.findIndex(t=>t.id===e);if(-1===n)return;const s=i[n],a=s.element.querySelector(".solely-modal-mask"),c=s.element.querySelector(".solely-modal");a&&a.classList.add("is-closing"),c&&c.classList.add("is-closing"),await l(s.element,o.NORMAL),null==(t=s.cleanup)||t.call(s);const d=i.findIndex(t=>t.id===e);-1!==d&&(i[d].element.remove(),i.splice(d,1))}finally{d.delete(e)}}}async function u(){if(0===i.length)return;const e=i[i.length-1];await p(e.id)}function f(n,l,o,s=!1){const a=e("button",{className:`solely-modal__btn solely-modal__btn--${"default"===l?"default":l}`,attrs:{type:"button"}});return"string"==typeof n?a.textContent=n:n instanceof HTMLElement&&a.appendChild(s?n.cloneNode(!0):n),a.onclick=()=>t(o),a}function y(l){const o=s();n("solely-modal-styles",a);const d=l.type||"info",u=l.width??c.width,y=l.showCancel??"confirm"===d,h=l.maskClosable??c.maskClosable,C=e("div",{className:"solely-modal-wrap",attrs:{tabIndex:"-1",part:"wrap"}}),b=function(e){return(()=>{const t=document.documentElement.getAttribute("data-theme");t?e.setAttribute("data-theme",t):e.removeAttribute("data-theme")})(),r||(r=new MutationObserver(()=>{i.forEach(e=>{const t=document.documentElement.getAttribute("data-theme");t?e.element.setAttribute("data-theme",t):e.element.removeAttribute("data-theme")})}),r.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})),()=>{r&&0===i.length&&(r.disconnect(),r=null)}}(C),_=[];if(!1!==l.mask){const t=e("div",{className:"solely-modal-mask"});if(h){const e=()=>{var e;p(o),null==(e=l.onCancel)||e.call(l)};t.onclick=e,_.push({element:t,type:"click",handler:e})}C.appendChild(t)}const v=e("div",{className:"solely-modal"+(l.className?` ${l.className}`:""),styles:{...l.style,width:"number"==typeof u?`${u}px`:u}}),w=e("div",{className:"solely-modal__header"}),N=e("h3",{className:"solely-modal__title"});if("string"==typeof l.title)N.textContent=l.title||"";else if(l.title instanceof HTMLElement){const e=l.cloneElement??!1;N.appendChild(e?l.title.cloneNode(!0):l.title)}if(w.appendChild(N),!1!==l.closable){const t=e("button",{className:"solely-modal__close",textContent:"×",attrs:{type:"button","aria-label":"关闭",part:"close"}}),n=()=>{var e;p(o),null==(e=l.onClose)||e.call(l)};t.onclick=n,_.push({element:t,type:"click",handler:n}),w.appendChild(t)}v.appendChild(w);const g=e("div",{className:"solely-modal__body"}),x=e("div",{className:"solely-modal__content-wrapper"});if(!1!==l.showIcon){const t=e("span",{className:`solely-modal__icon solely-modal__icon--${d}`,textContent:m[d]});x.appendChild(t)}const k=e("div",{className:"solely-modal__content"});if("string"==typeof l.content)k.textContent=l.content||"";else if(l.content instanceof HTMLElement){const e=l.cloneElement??!1;k.appendChild(e?l.content.cloneNode(!0):l.content)}x.appendChild(k),g.appendChild(x),v.appendChild(g);const E=e("div",{className:"solely-modal__footer"});if(l.buttons&&l.buttons.length>0)l.buttons.forEach(e=>{const n=f(e.text,e.type||"default",async()=>{await t(()=>e.onClick())},l.cloneElement);e.style&&Object.assign(n.style,e.style),E.appendChild(n)});else{if(y){const e=f(l.cancelText||c.cancelText,"default",()=>{var e;p(o),null==(e=l.onCancel)||e.call(l)},l.cloneElement);E.appendChild(e)}const e=f(l.okText||c.okText,l.okType||"primary",async()=>{l.onOk&&!1===await t(()=>l.onOk())||p(o)},l.cloneElement);E.appendChild(e)}v.appendChild(E),C.appendChild(v),document.body.appendChild(C),i.push({id:o,element:C,instance:null,cleanup:()=>{_.forEach(({element:e,type:t,handler:n})=>{e.removeEventListener(t,n)}),b()}});const T={close:()=>{var e;p(o),null==(e=l.onClose)||e.call(l)},update:e=>{if(void 0!==e.title){const t=C.querySelector(".solely-modal__title");if(t)if(t.innerHTML="","string"==typeof e.title)t.textContent=e.title;else if(e.title instanceof HTMLElement){const n=e.cloneElement??!1;t.appendChild(n?e.title.cloneNode(!0):e.title)}}if(void 0!==e.content){const t=C.querySelector(".solely-modal__content");if(t)if(t.innerHTML="","string"==typeof e.content)t.textContent=e.content;else if(e.content instanceof HTMLElement){const n=e.cloneElement??!1;t.appendChild(n?e.content.cloneNode(!0):e.content)}}if(void 0!==e.width){const t=C.querySelector(".solely-modal");t&&(t.style.width="number"==typeof e.width?`${e.width}px`:e.width)}if(void 0!==e.className){const t=C.querySelector(".solely-modal");t&&(t.className=`solely-modal ${e.className}`.trim())}if(void 0!==e.style){const t=C.querySelector(".solely-modal");t&&Object.assign(t.style,e.style)}}},L=i.find(e=>e.id===o);return L&&(L.instance=T),T}const h={open:y,confirm:function(e){return y({...e,type:"confirm",showCancel:!0})},info:function(e){return y({...e,type:"info"})},success:function(e){return y({...e,type:"success"})},error:function(e){return y({...e,type:"error"})},warning:function(e){return y({...e,type:"warning"})},config:function(e){Object.assign(c,e)},destroy:async function(){for(;i.length>0;)await u()}};export{h as Modal};
1
+ import{createElement as e,observeTheme as t,safeAsyncCallback as n,injectStyle as l,addClosingAnimation as o,ANIMATION_DURATION as s,generateId as a}from"../utils.js";import c from"./style.css.js";const i={width:520,mask:!0,maskClosable:!1,okText:"确定",cancelText:"取消"},d=[],r=new Set,m={info:"ℹ",success:"✓",warning:"⚠",error:"✕",confirm:"?"};async function p(e){var t;if(!r.has(e)){r.add(e);try{const n=d.findIndex(t=>t.id===e);if(-1===n)return;const l=d[n],a=l.element.querySelector(".solely-modal-mask"),c=l.element.querySelector(".solely-modal");a&&a.classList.add("is-closing"),c&&c.classList.add("is-closing"),await o(l.element,s.NORMAL),null==(t=l.cleanup)||t.call(l);const i=d.findIndex(t=>t.id===e);-1!==i&&(d[i].element.remove(),d.splice(i,1))}finally{r.delete(e)}}}async function y(){if(0===d.length)return;const e=d[d.length-1];await p(e.id)}function f(t,l,o,s=!1){const a=e("button",{className:`solely-modal__btn solely-modal__btn--${"default"===l?"default":l}`,attrs:{type:"button"}});return"string"==typeof t?a.textContent=t:t instanceof HTMLElement&&a.appendChild(s?t.cloneNode(!0):t),a.onclick=()=>n(o),a}function u(o){const s=a();l("solely-modal-styles",c);const r=o.type||"info",y=o.width??i.width,u=o.showCancel??"confirm"===r,h=o.maskClosable??i.maskClosable,C=e("div",{className:"solely-modal-wrap",attrs:{tabIndex:"-1",part:"wrap"}}),_=t(()=>C),w=[];if(!1!==o.mask){const t=e("div",{className:"solely-modal-mask"});if(h){const e=()=>{var e;p(s),null==(e=o.onCancel)||e.call(o)};t.onclick=e,w.push({element:t,type:"click",handler:e})}C.appendChild(t)}const N=e("div",{className:"solely-modal"+(o.className?` ${o.className}`:""),styles:{...o.style,width:"number"==typeof y?`${y}px`:y}}),b=e("div",{className:"solely-modal__header"}),v=e("h3",{className:"solely-modal__title"});if("string"==typeof o.title)v.textContent=o.title||"";else if(o.title instanceof HTMLElement){const e=o.cloneElement??!1;v.appendChild(e?o.title.cloneNode(!0):o.title)}if(b.appendChild(v),!1!==o.closable){const t=e("button",{className:"solely-modal__close",textContent:"×",attrs:{type:"button","aria-label":"关闭",part:"close"}}),n=()=>{var e;p(s),null==(e=o.onClose)||e.call(o)};t.onclick=n,w.push({element:t,type:"click",handler:n}),b.appendChild(t)}N.appendChild(b);const x=e("div",{className:"solely-modal__body"}),g=e("div",{className:"solely-modal__content-wrapper"});if(!1!==o.showIcon){const t=e("span",{className:`solely-modal__icon solely-modal__icon--${r}`,textContent:m[r]});g.appendChild(t)}const k=e("div",{className:"solely-modal__content"});if("string"==typeof o.content)k.textContent=o.content||"";else if(o.content instanceof HTMLElement){const e=o.cloneElement??!1;k.appendChild(e?o.content.cloneNode(!0):o.content)}g.appendChild(k),x.appendChild(g),N.appendChild(x);const E=e("div",{className:"solely-modal__footer"});if(o.buttons&&o.buttons.length>0)o.buttons.forEach(e=>{const t=f(e.text,e.type||"default",async()=>{await n(()=>e.onClick())},o.cloneElement);e.style&&Object.assign(t.style,e.style),E.appendChild(t)});else{if(u){const e=f(o.cancelText||i.cancelText,"default",()=>{var e;p(s),null==(e=o.onCancel)||e.call(o)},o.cloneElement);E.appendChild(e)}const e=f(o.okText||i.okText,o.okType||"primary",async()=>{const e=o.onConfirm||o.onOk;e&&!1===await n(()=>e())||p(s)},o.cloneElement);E.appendChild(e)}N.appendChild(E),C.appendChild(N),document.body.appendChild(C),d.push({id:s,element:C,instance:null,cleanup:()=>{w.forEach(({element:e,type:t,handler:n})=>{e.removeEventListener(t,n)}),_()}});const T={close:()=>{var e;p(s),null==(e=o.onClose)||e.call(o)},update:e=>{if(void 0!==e.title){const t=C.querySelector(".solely-modal__title");if(t)if(t.innerHTML="","string"==typeof e.title)t.textContent=e.title;else if(e.title instanceof HTMLElement){const n=e.cloneElement??!1;t.appendChild(n?e.title.cloneNode(!0):e.title)}}if(void 0!==e.content){const t=C.querySelector(".solely-modal__content");if(t)if(t.innerHTML="","string"==typeof e.content)t.textContent=e.content;else if(e.content instanceof HTMLElement){const n=e.cloneElement??!1;t.appendChild(n?e.content.cloneNode(!0):e.content)}}if(void 0!==e.width){const t=C.querySelector(".solely-modal");t&&(t.style.width="number"==typeof e.width?`${e.width}px`:e.width)}if(void 0!==e.className){const t=C.querySelector(".solely-modal");t&&(t.className=`solely-modal ${e.className}`.trim())}if(void 0!==e.style){const t=C.querySelector(".solely-modal");t&&Object.assign(t.style,e.style)}}},L=d.find(e=>e.id===s);return L&&(L.instance=T),T}const h={open:u,confirm:function(e){return u({...e,type:"confirm",showCancel:!0})},info:function(e){return u({...e,type:"info"})},success:function(e){return u({...e,type:"success"})},error:function(e){return u({...e,type:"error"})},warning:function(e){return u({...e,type:"warning"})},config:function(e){Object.assign(i,e)},destroy:async function(){for(;d.length>0;)await y()}};export{h as Modal};
@@ -40,6 +40,8 @@ export interface ModalOptions {
40
40
  /** 自定义按钮数组(如果提供,将忽略 okText/cancelText/showCancel) */
41
41
  buttons?: ModalButton[];
42
42
  /** 确定按钮回调 - 返回 false 阻止关闭,返回 HTMLElement 或数据作为结果 */
43
+ onConfirm?: () => void | false | HTMLElement | Record<string, unknown> | Promise<void | false | HTMLElement | Record<string, unknown>>;
44
+ /** @deprecated 请使用 onConfirm,此别名仅为向后兼容保留 */
43
45
  onOk?: () => void | false | HTMLElement | Record<string, unknown> | Promise<void | false | HTMLElement | Record<string, unknown>>;
44
46
  /** 取消按钮回调 */
45
47
  onCancel?: () => void;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),n={okText:"确定",cancelText:"取消",okType:"primary",showCancel:!0,placement:"top"};let o=null,l=null;const a=new WeakSet;async function s(){if(!o)return;const{element:t}=o,n=t.querySelector(".solely-popconfirm");n&&n.classList.add("is-closing"),await e.addClosingAnimation(t,e.ANIMATION_DURATION.FAST),t.remove(),o=null}async function c(a,c){if(o&&o.target===a)return await s(),{destroy:()=>{}};await s();const i=e.generateId();e.injectStyle("solely-popconfirm-styles",t.default);const r=c.placement??n.placement,d=c.okType??n.okType,p=c.showCancel??n.showCancel,m=e.createElement("div",{className:"solely-popconfirm-overlay"}),u=(y=m,(()=>{const e=document.documentElement.getAttribute("data-theme");e?y.setAttribute("data-theme",e):y.removeAttribute("data-theme")})(),l||(l=new MutationObserver(()=>{if(o){const e=document.documentElement.getAttribute("data-theme");e?o.element.setAttribute("data-theme",e):o.element.removeAttribute("data-theme")}}),l.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})),()=>{l&&!o&&(l.disconnect(),l=null)});var y;const f=e.createElement("div",{className:`solely-popconfirm solely-popconfirm--${r}${c.className?` ${c.className}`:""}`,styles:c.style}),v=e.createElement("div",{className:"solely-popconfirm__content"});if(!1!==c.showIcon){const t=e.createElement("span",{className:"solely-popconfirm__icon",textContent:"⚠"});v.appendChild(t)}const h=e.createElement("div",{className:"solely-popconfirm__text"}),E=e.createElement("div",{className:"solely-popconfirm__title"});if("string"==typeof c.title?E.textContent=c.title:c.title instanceof HTMLElement&&E.appendChild(c.title.cloneNode(!0)),h.appendChild(E),c.description){const t=e.createElement("div",{className:"solely-popconfirm__description"});"string"==typeof c.description?t.textContent=c.description:c.description instanceof HTMLElement&&t.appendChild(c.description.cloneNode(!0)),h.appendChild(t)}v.appendChild(h);const C=e.createElement("div",{className:"solely-popconfirm__buttons"}),b=async()=>{var e;await s(),null==(e=c.onCancel)||e.call(c)};if(p){const t=e.createElement("button",{className:"solely-popconfirm__btn solely-popconfirm__btn--cancel",attrs:{type:"button"}}),o=c.cancelText??n.cancelText;"string"==typeof o?t.textContent=o:o instanceof HTMLElement&&t.appendChild(o.cloneNode(!0)),t.onclick=b,C.appendChild(t)}const w=e.createElement("button",{className:"solely-popconfirm__btn solely-popconfirm__btn--ok"+("danger"===d?" solely-popconfirm__btn--danger":""),attrs:{type:"button"}}),_=c.okText??n.okText;"string"==typeof _?w.textContent=_:_ instanceof HTMLElement&&w.appendChild(_.cloneNode(!0)),w.onclick=async()=>{var e;await s(),null==(e=c.onConfirm)||e.call(c)},C.appendChild(w);const g=e.createElement("div",{className:"solely-popconfirm__arrow"});f.appendChild(g),f.appendChild(v),f.appendChild(C),m.appendChild(f),document.body.appendChild(m);const N=e.calculatePosition(a,f,r);f.style.top=`${N.top}px`,f.style.left=`${N.left}px`,void 0!==N.arrowLeft&&(g.style.left=`${N.arrowLeft}px`),void 0!==N.arrowTop&&(g.style.top=`${N.arrowTop}px`);const T=e=>{e.target===m&&b()},k=e=>{"Escape"===e.key&&(b(),document.removeEventListener("keydown",k))};m.addEventListener("click",T),document.addEventListener("keydown",k);const x=()=>{document.removeEventListener("keydown",k),m.removeEventListener("click",T),u(),s()};return o={id:i,target:a,element:m,destroy:x},{destroy:x}}const i={show:c,bind:function(e,t){if(a.has(e))return{destroy:()=>{}};a.add(e);let n=null;const l=async l=>{l.stopPropagation(),o?(await s(),n=null):n=await c(e,t)},i=async t=>{if(!o)return;const l=t.target;o.element.contains(l)||e.contains(l)||(await s(),n=null)};return e.addEventListener("click",l),document.addEventListener("mousedown",i),{destroy:()=>{a.delete(e),e.removeEventListener("click",l),document.removeEventListener("mousedown",i),null==n||n.destroy(),n=null}}},config:function(e){Object.assign(n,e)},destroy:s};exports.Popconfirm=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),n=require("./style.css.cjs"),t={okText:"确定",cancelText:"取消",okType:"primary",showCancel:!0,placement:"top"};let o=null;const l=new WeakSet;function c(){o&&(o.cleanup(),o.element.remove(),o=null)}function s(){if(!o)return;const{element:n,cleanup:t}=o,l=n.querySelector(".solely-popconfirm");l&&l.classList.add("is-closing"),o=null,e.addClosingAnimation(n,e.ANIMATION_DURATION.FAST).then(()=>{t(),n.remove()})}function r(e,n,t){void 0!==n&&("string"==typeof n?e.textContent=n:n instanceof HTMLElement&&e.appendChild(t?n.cloneNode(!0):n))}function i(e){return{...e,then:n=>Promise.resolve(n(e))}}function a(l,a){if(o&&o.target===l)return c(),i({close:()=>{},destroy:()=>{}});c();const p=e.generateId();e.injectStyle("solely-popconfirm-styles",n.default);const d=a.placement??t.placement,m=a.okType??t.okType,u=a.showCancel??t.showCancel,y=a.cloneElement??!0,f=e.createElement("div",{className:"solely-popconfirm-overlay"}),v=e.observeTheme(()=>f),_=[`solely-popconfirm solely-popconfirm--${d}`,a.className].filter(Boolean).join(" "),E=e.createElement("div",{className:_,styles:a.style}),h=e.createElement("div",{className:"solely-popconfirm__content"});if(!1!==a.showIcon){const n=e.createElement("span",{className:"solely-popconfirm__icon",textContent:"⚠"});h.appendChild(n)}const C=e.createElement("div",{className:"solely-popconfirm__text"}),k=e.createElement("div",{className:"solely-popconfirm__title"});if(r(k,a.title,y),C.appendChild(k),a.description){const n=e.createElement("div",{className:"solely-popconfirm__description"});r(n,a.description,y),C.appendChild(n)}h.appendChild(C);const T=e.createElement("div",{className:"solely-popconfirm__buttons"}),b=()=>{var e;s(),null==(e=a.onCancel)||e.call(a)};if(u){const n=e.createElement("button",{className:"solely-popconfirm__btn solely-popconfirm__btn--cancel",attrs:{type:"button"}});r(n,a.cancelText??t.cancelText,y),n.onclick=b,T.appendChild(n)}const w=["solely-popconfirm__btn solely-popconfirm__btn--ok","danger"===m?"solely-popconfirm__btn--danger":""].filter(Boolean).join(" "),N=e.createElement("button",{className:w,attrs:{type:"button"}});r(N,a.okText??t.okText,y),N.onclick=()=>{var e;s(),null==(e=a.onConfirm)||e.call(a)},T.appendChild(N);const g=e.createElement("div",{className:"solely-popconfirm__arrow"});E.appendChild(g),E.appendChild(h),E.appendChild(T),f.appendChild(E),document.body.appendChild(f);const x=e.calculatePosition(l,E,d);E.style.top=`${x.top}px`,E.style.left=`${x.left}px`,void 0!==x.arrowLeft&&(g.style.left=`${x.arrowLeft}px`),void 0!==x.arrowTop&&(g.style.top=`${x.arrowTop}px`);const L=e=>{e.target===f&&b()},j=e=>{"Escape"===e.key&&(b(),document.removeEventListener("keydown",j))};f.addEventListener("click",L),document.addEventListener("keydown",j);const S=()=>{document.removeEventListener("keydown",j),f.removeEventListener("click",L),v()};return o={id:p,target:l,element:f,cleanup:S},i({close:()=>{o&&o.element===f&&(S(),s())},destroy:()=>{o&&o.element===f&&(S(),s())}})}const p={show:a,bind:function(e,n){if(l.has(e))return{close:()=>{},destroy:()=>{}};l.add(e);let t=null;const s=l=>{l.stopPropagation(),o?(c(),t=null):t=a(e,n)},r=n=>{if(!o)return;const l=n.target;o.element.contains(l)||e.contains(l)||(c(),t=null)};return e.addEventListener("click",s),document.addEventListener("mousedown",r),{close:()=>{null==t||t.close(),t=null},destroy:()=>{l.delete(e),e.removeEventListener("click",s),document.removeEventListener("mousedown",r),null==t||t.destroy(),t=null}}},config:function(e){Object.assign(t,e)},destroy:()=>{s()}};exports.Popconfirm=p;
@@ -1,6 +1,5 @@
1
- import { PopconfirmOptions, PopconfirmInstance, PopconfirmPlacement, PopconfirmConfig } from './types';
2
- declare function destroyCurrent(): Promise<void>;
3
- declare function show(target: HTMLElement, options: PopconfirmOptions): Promise<PopconfirmInstance>;
1
+ import { PopconfirmOptions, PopconfirmInstance, PopconfirmResult, PopconfirmPlacement, PopconfirmConfig } from './types';
2
+ declare function show(target: HTMLElement, options: PopconfirmOptions): PopconfirmResult;
4
3
  declare function bind(target: HTMLElement, options: Omit<PopconfirmOptions, 'placement'> & {
5
4
  placement?: PopconfirmPlacement;
6
5
  }): PopconfirmInstance;
@@ -9,6 +8,6 @@ export declare const Popconfirm: {
9
8
  show: typeof show;
10
9
  bind: typeof bind;
11
10
  config: typeof config;
12
- destroy: typeof destroyCurrent;
11
+ destroy: () => void;
13
12
  };
14
13
  export default Popconfirm;
@@ -1 +1 @@
1
- import{createElement as e,calculatePosition as t,injectStyle as n,addClosingAnimation as o,ANIMATION_DURATION as l,generateId as s}from"../utils.js";import a from"./style.css.js";const c={okText:"确定",cancelText:"取消",okType:"primary",showCancel:!0,placement:"top"};let i=null,r=null;const d=new WeakSet;async function p(){if(!i)return;const{element:e}=i,t=e.querySelector(".solely-popconfirm");t&&t.classList.add("is-closing"),await o(e,l.FAST),e.remove(),i=null}async function m(o,l){if(i&&i.target===o)return await p(),{destroy:()=>{}};await p();const d=s();n("solely-popconfirm-styles",a);const m=l.placement??c.placement,y=l.okType??c.okType,u=l.showCancel??c.showCancel,f=e("div",{className:"solely-popconfirm-overlay"}),v=(h=f,(()=>{const e=document.documentElement.getAttribute("data-theme");e?h.setAttribute("data-theme",e):h.removeAttribute("data-theme")})(),r||(r=new MutationObserver(()=>{if(i){const e=document.documentElement.getAttribute("data-theme");e?i.element.setAttribute("data-theme",e):i.element.removeAttribute("data-theme")}}),r.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})),()=>{r&&!i&&(r.disconnect(),r=null)});var h;const w=e("div",{className:`solely-popconfirm solely-popconfirm--${m}${l.className?` ${l.className}`:""}`,styles:l.style}),C=e("div",{className:"solely-popconfirm__content"});if(!1!==l.showIcon){const t=e("span",{className:"solely-popconfirm__icon",textContent:"⚠"});C.appendChild(t)}const _=e("div",{className:"solely-popconfirm__text"}),b=e("div",{className:"solely-popconfirm__title"});if("string"==typeof l.title?b.textContent=l.title:l.title instanceof HTMLElement&&b.appendChild(l.title.cloneNode(!0)),_.appendChild(b),l.description){const t=e("div",{className:"solely-popconfirm__description"});"string"==typeof l.description?t.textContent=l.description:l.description instanceof HTMLElement&&t.appendChild(l.description.cloneNode(!0)),_.appendChild(t)}C.appendChild(_);const k=e("div",{className:"solely-popconfirm__buttons"}),x=async()=>{var e;await p(),null==(e=l.onCancel)||e.call(l)};if(u){const t=e("button",{className:"solely-popconfirm__btn solely-popconfirm__btn--cancel",attrs:{type:"button"}}),n=l.cancelText??c.cancelText;"string"==typeof n?t.textContent=n:n instanceof HTMLElement&&t.appendChild(n.cloneNode(!0)),t.onclick=x,k.appendChild(t)}const E=e("button",{className:"solely-popconfirm__btn solely-popconfirm__btn--ok"+("danger"===y?" solely-popconfirm__btn--danger":""),attrs:{type:"button"}}),N=l.okText??c.okText;"string"==typeof N?E.textContent=N:N instanceof HTMLElement&&E.appendChild(N.cloneNode(!0)),E.onclick=async()=>{var e;await p(),null==(e=l.onConfirm)||e.call(l)},k.appendChild(E);const g=e("div",{className:"solely-popconfirm__arrow"});w.appendChild(g),w.appendChild(C),w.appendChild(k),f.appendChild(w),document.body.appendChild(f);const L=t(o,w,m);w.style.top=`${L.top}px`,w.style.left=`${L.left}px`,void 0!==L.arrowLeft&&(g.style.left=`${L.arrowLeft}px`),void 0!==L.arrowTop&&(g.style.top=`${L.arrowTop}px`);const T=e=>{e.target===f&&x()},A=e=>{"Escape"===e.key&&(x(),document.removeEventListener("keydown",A))};f.addEventListener("click",T),document.addEventListener("keydown",A);const $=()=>{document.removeEventListener("keydown",A),f.removeEventListener("click",T),v(),p()};return i={id:d,target:o,element:f,destroy:$},{destroy:$}}const y={show:m,bind:function(e,t){if(d.has(e))return{destroy:()=>{}};d.add(e);let n=null;const o=async o=>{o.stopPropagation(),i?(await p(),n=null):n=await m(e,t)},l=async t=>{if(!i)return;const o=t.target;i.element.contains(o)||e.contains(o)||(await p(),n=null)};return e.addEventListener("click",o),document.addEventListener("mousedown",l),{destroy:()=>{d.delete(e),e.removeEventListener("click",o),document.removeEventListener("mousedown",l),null==n||n.destroy(),n=null}}},config:function(e){Object.assign(c,e)},destroy:p};export{y as Popconfirm};
1
+ import{createElement as e,observeTheme as n,calculatePosition as o,injectStyle as t,addClosingAnimation as l,ANIMATION_DURATION as s,generateId as c}from"../utils.js";import i from"./style.css.js";const r={okText:"确定",cancelText:"取消",okType:"primary",showCancel:!0,placement:"top"};let p=null;const a=new WeakSet;function d(){p&&(p.cleanup(),p.element.remove(),p=null)}function m(){if(!p)return;const{element:e,cleanup:n}=p,o=e.querySelector(".solely-popconfirm");o&&o.classList.add("is-closing"),p=null,l(e,s.FAST).then(()=>{n(),e.remove()})}function y(e,n,o){void 0!==n&&("string"==typeof n?e.textContent=n:n instanceof HTMLElement&&e.appendChild(o?n.cloneNode(!0):n))}function f(e){return{...e,then:n=>Promise.resolve(n(e))}}function u(l,s){if(p&&p.target===l)return d(),f({close:()=>{},destroy:()=>{}});d();const a=c();t("solely-popconfirm-styles",i);const u=s.placement??r.placement,v=s.okType??r.okType,_=s.showCancel??r.showCancel,h=s.cloneElement??!0,C=e("div",{className:"solely-popconfirm-overlay"}),k=n(()=>C),w=[`solely-popconfirm solely-popconfirm--${u}`,s.className].filter(Boolean).join(" "),x=e("div",{className:w,styles:s.style}),b=e("div",{className:"solely-popconfirm__content"});if(!1!==s.showIcon){const n=e("span",{className:"solely-popconfirm__icon",textContent:"⚠"});b.appendChild(n)}const L=e("div",{className:"solely-popconfirm__text"}),N=e("div",{className:"solely-popconfirm__title"});if(y(N,s.title,h),L.appendChild(N),s.description){const n=e("div",{className:"solely-popconfirm__description"});y(n,s.description,h),L.appendChild(n)}b.appendChild(L);const T=e("div",{className:"solely-popconfirm__buttons"}),E=()=>{var e;m(),null==(e=s.onCancel)||e.call(s)};if(_){const n=e("button",{className:"solely-popconfirm__btn solely-popconfirm__btn--cancel",attrs:{type:"button"}});y(n,s.cancelText??r.cancelText,h),n.onclick=E,T.appendChild(n)}const g=["solely-popconfirm__btn solely-popconfirm__btn--ok","danger"===v?"solely-popconfirm__btn--danger":""].filter(Boolean).join(" "),j=e("button",{className:g,attrs:{type:"button"}});y(j,s.okText??r.okText,h),j.onclick=()=>{var e;m(),null==(e=s.onConfirm)||e.call(s)},T.appendChild(j);const $=e("div",{className:"solely-popconfirm__arrow"});x.appendChild($),x.appendChild(b),x.appendChild(T),C.appendChild(x),document.body.appendChild(C);const S=o(l,x,u);x.style.top=`${S.top}px`,x.style.left=`${S.left}px`,void 0!==S.arrowLeft&&($.style.left=`${S.arrowLeft}px`),void 0!==S.arrowTop&&($.style.top=`${S.arrowTop}px`);const B=e=>{e.target===C&&E()},P=e=>{"Escape"===e.key&&(E(),document.removeEventListener("keydown",P))};C.addEventListener("click",B),document.addEventListener("keydown",P);const q=()=>{document.removeEventListener("keydown",P),C.removeEventListener("click",B),k()};return p={id:a,target:l,element:C,cleanup:q},f({close:()=>{p&&p.element===C&&(q(),m())},destroy:()=>{p&&p.element===C&&(q(),m())}})}const v={show:u,bind:function(e,n){if(a.has(e))return{close:()=>{},destroy:()=>{}};a.add(e);let o=null;const t=t=>{t.stopPropagation(),p?(d(),o=null):o=u(e,n)},l=n=>{if(!p)return;const t=n.target;p.element.contains(t)||e.contains(t)||(d(),o=null)};return e.addEventListener("click",t),document.addEventListener("mousedown",l),{close:()=>{null==o||o.close(),o=null},destroy:()=>{a.delete(e),e.removeEventListener("click",t),document.removeEventListener("mousedown",l),null==o||o.destroy(),o=null}}},config:function(e){Object.assign(r,e)},destroy:()=>{m()}};export{v as Popconfirm};
@@ -27,11 +27,21 @@ export interface PopconfirmOptions {
27
27
  className?: string;
28
28
  /** 自定义样式 */
29
29
  style?: Partial<CSSStyleDeclaration>;
30
+ /** 是否克隆传入的 HTMLElement 内容(默认 true) */
31
+ cloneElement?: boolean;
30
32
  }
31
33
  export interface PopconfirmInstance {
34
+ /** 关闭确认框(与 Modal/Drawer 的 close 保持一致) */
35
+ close: () => void;
32
36
  /** 销毁确认框 */
33
37
  destroy: () => void;
34
38
  }
39
+ /**
40
+ * show 方法的返回值类型。
41
+ * 既是 PopconfirmInstance(支持同步使用),又是 PromiseLike<PopconfirmInstance>(兼容 await/.then)。
42
+ * 这是为了向后兼容历史版本中 show 返回 Promise 的用法。
43
+ */
44
+ export type PopconfirmResult = PopconfirmInstance & PromiseLike<PopconfirmInstance>;
35
45
  export interface PopconfirmConfig {
36
46
  /** 默认确认按钮文字 */
37
47
  okText: string | HTMLElement;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),o={placement:"top",trigger:"hover",duration:3e3,singleton:!0},n=[],r=new WeakSet;let l=null;function s(e,t,o,n=8){const r=e.getBoundingClientRect(),l=t.offsetWidth||250,s=t.offsetHeight||100;let i,a,c=0,d=0;switch(o){case"top":c=r.top-s-n,d=r.left+(r.width-l)/2,i=l/2-4;break;case"topLeft":c=r.top-s-n,d=r.left,i=16;break;case"topRight":c=r.top-s-n,d=r.right-l,i=l-24;break;case"bottom":c=r.bottom+n,d=r.left+(r.width-l)/2,i=l/2-4;break;case"bottomLeft":c=r.bottom+n,d=r.left,i=16;break;case"bottomRight":c=r.bottom+n,d=r.right-l,i=l-24;break;case"left":c=r.top+(r.height-s)/2,d=r.left-l-n,a=s/2-4;break;case"leftTop":c=r.top,d=r.left-l-n,a=16;break;case"leftBottom":c=r.bottom-s,d=r.left-l-n,a=s-24;break;case"right":c=r.top+(r.height-s)/2,d=r.right+n,a=s/2-4;break;case"rightTop":c=r.top,d=r.right+n,a=16;break;case"rightBottom":c=r.bottom-s,d=r.right+n,a=s-24}return c=Math.max(8,Math.min(c,window.innerHeight-s-8)),d=Math.max(8,Math.min(d,window.innerWidth-l-8)),{top:c,left:d,arrowLeft:i,arrowTop:a}}let i=null,a=!1;function c(){i||(i=requestAnimationFrame(()=>{i=null,n.forEach(e=>{const t=e.element;if(!t||!e.target)return;const o=t.querySelector(".solely-tooltip__arrow"),n=s(e.target,t,e.placement);t.style.top=`${n.top}px`,t.style.left=`${n.left}px`,o&&(void 0!==n.arrowLeft&&(o.style.left=`${n.arrowLeft}px`,o.style.top=""),void 0!==n.arrowTop&&(o.style.top=`${n.arrowTop}px`,o.style.left=""))})}))}function d(){a&&(a=!1,window.removeEventListener("resize",c),i&&(cancelAnimationFrame(i),i=null))}async function m(e,t){const o=n.findIndex(t=>t.id===e);if(-1===o)return;const r=n[o];r.element.classList.add("is-closing"),r.element.remove(),r.scrollParents.forEach(e=>e.removeEventListener("scroll",c)),n.splice(o,1),0===n.length&&d(),null==t||t()}function u(){if(0===n.length)return;const e=new Set;n.forEach(t=>{t.scrollParents.forEach(t=>e.add(t)),t.element.classList.add("is-closing"),t.element.remove()}),e.forEach(e=>e.removeEventListener("scroll",c)),n.length=0,d()}function f(r,i){var d;const m=e.generateId();e.injectStyle("solely-tooltip-styles",t.default);const f=i.placement??o.placement,p=n.findIndex(e=>e.target===r);if(-1!==p){const e=n[p];e.element.remove(),e.scrollParents.forEach(e=>e.removeEventListener("scroll",c)),n.splice(p,1)}o.singleton&&n.length>0&&u();const h=e.createElement("div",{className:`solely-tooltip solely-tooltip--${f}${i.className?` ${i.className}`:""}`,styles:{...i.style,...i.color?{backgroundColor:i.color}:{}}});var v;v=h,(()=>{const e=document.documentElement.getAttribute("data-theme");e?v.setAttribute("data-theme",e):v.removeAttribute("data-theme")})(),l||(l=new MutationObserver(()=>{const e=document.documentElement.getAttribute("data-theme");n.forEach(t=>{e?t.element.setAttribute("data-theme",e):t.element.removeAttribute("data-theme")})}),l.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}));const g=e.createElement("div",{className:"solely-tooltip__content"});i.content&&("string"==typeof i.content?g.textContent=i.content:i.content instanceof HTMLElement&&g.appendChild(i.content.cloneNode(!0))),h.appendChild(g);const b=e.createElement("div",{className:"solely-tooltip__arrow"});i.color&&(b.style.backgroundColor=i.color),h.appendChild(b),document.body.appendChild(h),requestAnimationFrame(()=>{const e=s(r,h,f);h.style.top=`${e.top}px`,h.style.left=`${e.left}px`,void 0!==e.arrowLeft&&(b.style.left=`${e.arrowLeft}px`),void 0!==e.arrowTop&&(b.style.top=`${e.arrowTop}px`)});const E=function(e){const t=[];let o=e.parentElement;for(;o&&o!==document.body;){const e=getComputedStyle(o);"auto"!==e.overflow&&"scroll"!==e.overflow&&"auto"!==e.overflowY&&"scroll"!==e.overflowY||t.push(o),o=o.parentElement}return t}(r);return E.forEach(e=>e.addEventListener("scroll",c)),a||0===n.length||(a=!0,window.addEventListener("resize",c)),n.push({id:m,element:h,target:r,placement:f,scrollParents:E}),null==(d=i.onVisibleChange)||d.call(i,!0),m}const p={bind:function(e,t){if(r.has(e))return{show:()=>{},hide:()=>{},destroy:()=>{}};r.add(e);const n=t.trigger??o.trigger;let l=t.visible??t.defaultVisible??!1,s=null;const i=()=>{l||(l=!0,s=f(e,t))},a=()=>{if(!l||null===s)return;l=!1;const e=s;s=null,m(e,()=>{var e;null==(e=t.onVisibleChange)||e.call(t,!1)})},c=e=>{e.stopPropagation(),l?a():i()},d=t=>{l&&(e.contains(t.target)||a())};return"hover"===n?(e.addEventListener("mouseenter",i),e.addEventListener("mouseleave",a)):"click"===n?(e.addEventListener("click",c),document.addEventListener("click",d)):"focus"===n&&(e.addEventListener("focus",i),e.addEventListener("blur",a)),l&&(s=f(e,t)),{show:i,hide:a,destroy:()=>{a(),r.delete(e),"hover"===n?(e.removeEventListener("mouseenter",i),e.removeEventListener("mouseleave",a)):"click"===n?(e.removeEventListener("click",c),document.removeEventListener("click",d)):"focus"===n&&(e.removeEventListener("focus",i),e.removeEventListener("blur",a))}}},show:function(e,t){const n=f(e,t),r=t.duration??o.duration;r>0&&setTimeout(()=>m(n),r)},hide:async function(e){u(),null==e||e()},config:function(e){Object.assign(o,e)}};exports.Tooltip=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),o={placement:"top",trigger:"hover",duration:3e3,singleton:!0},n=[],l=new WeakSet;function r(e,t,o,n=8){const l=e.getBoundingClientRect(),r=t.offsetWidth||250,s=t.offsetHeight||100;let i,c,a=0,d=0;switch(o){case"top":a=l.top-s-n,d=l.left+(l.width-r)/2,i=r/2-4;break;case"topLeft":a=l.top-s-n,d=l.left,i=16;break;case"topRight":a=l.top-s-n,d=l.right-r,i=r-24;break;case"bottom":a=l.bottom+n,d=l.left+(l.width-r)/2,i=r/2-4;break;case"bottomLeft":a=l.bottom+n,d=l.left,i=16;break;case"bottomRight":a=l.bottom+n,d=l.right-r,i=r-24;break;case"left":a=l.top+(l.height-s)/2,d=l.left-r-n,c=s/2-4;break;case"leftTop":a=l.top,d=l.left-r-n,c=16;break;case"leftBottom":a=l.bottom-s,d=l.left-r-n,c=s-24;break;case"right":a=l.top+(l.height-s)/2,d=l.right+n,c=s/2-4;break;case"rightTop":a=l.top,d=l.right+n,c=16;break;case"rightBottom":a=l.bottom-s,d=l.right+n,c=s-24}return a=Math.max(8,Math.min(a,window.innerHeight-s-8)),d=Math.max(8,Math.min(d,window.innerWidth-r-8)),{top:a,left:d,arrowLeft:i,arrowTop:c}}let s=null,i=!1;function c(){s||(s=requestAnimationFrame(()=>{s=null,n.forEach(e=>{const t=e.element;if(!t||!e.target)return;const o=t.querySelector(".solely-tooltip__arrow"),n=r(e.target,t,e.placement);t.style.top=`${n.top}px`,t.style.left=`${n.left}px`,o&&(void 0!==n.arrowLeft&&(o.style.left=`${n.arrowLeft}px`,o.style.top=""),void 0!==n.arrowTop&&(o.style.top=`${n.arrowTop}px`,o.style.left=""))})}))}function a(){i&&(i=!1,window.removeEventListener("resize",c),s&&(cancelAnimationFrame(s),s=null))}async function d(e,t){const o=n.findIndex(t=>t.id===e);if(-1===o)return;const l=n[o];l.element.classList.add("is-closing"),l.element.remove(),l.cleanupTheme(),l.scrollParents.forEach(e=>e.removeEventListener("scroll",c)),n.splice(o,1),0===n.length&&a(),null==t||t()}function m(){if(0===n.length)return;const e=new Set;n.forEach(t=>{t.scrollParents.forEach(t=>e.add(t)),t.element.classList.add("is-closing"),t.element.remove(),t.cleanupTheme()}),e.forEach(e=>e.removeEventListener("scroll",c)),n.length=0,a()}function p(l,s){var a;const d=e.generateId();e.injectStyle("solely-tooltip-styles",t.default);const p=s.placement??o.placement,u=s.cloneElement??!0,f=n.findIndex(e=>e.target===l);if(-1!==f){const e=n[f];e.element.remove(),e.cleanupTheme(),e.scrollParents.forEach(e=>e.removeEventListener("scroll",c)),n.splice(f,1)}o.singleton&&n.length>0&&m();const h=e.createElement("div",{className:`solely-tooltip solely-tooltip--${p}${s.className?` ${s.className}`:""}`,styles:{...s.style,...s.color?{backgroundColor:s.color}:{}}}),v=e.observeTheme(()=>h),g=e.createElement("div",{className:"solely-tooltip__content"});s.content&&("string"==typeof s.content?g.textContent=s.content:s.content instanceof HTMLElement&&g.appendChild(u?s.content.cloneNode(!0):s.content)),h.appendChild(g);const b=e.createElement("div",{className:"solely-tooltip__arrow"});s.color&&(b.style.backgroundColor=s.color),h.appendChild(b),document.body.appendChild(h),requestAnimationFrame(()=>{const e=r(l,h,p);h.style.top=`${e.top}px`,h.style.left=`${e.left}px`,void 0!==e.arrowLeft&&(b.style.left=`${e.arrowLeft}px`),void 0!==e.arrowTop&&(b.style.top=`${e.arrowTop}px`)});const y=function(e){const t=[];let o=e.parentElement;for(;o&&o!==document.body;){const e=getComputedStyle(o);"auto"!==e.overflow&&"scroll"!==e.overflow&&"auto"!==e.overflowY&&"scroll"!==e.overflowY||t.push(o),o=o.parentElement}return t}(l);return y.forEach(e=>e.addEventListener("scroll",c)),i||0===n.length||(i=!0,window.addEventListener("resize",c)),n.push({id:d,element:h,target:l,placement:p,scrollParents:y,cleanupTheme:v}),null==(a=s.onVisibleChange)||a.call(s,!0),d}function u(e,t){const n=p(e,t),l=t.duration??o.duration;l>0&&setTimeout(()=>d(n),l)}const f={bind:function(e,t){if(l.has(e))return{show:()=>{},hide:()=>{},destroy:()=>{}};l.add(e);const n=t.trigger??o.trigger;let r=t.visible??t.defaultVisible??!1,s=null;const i=()=>{r||(r=!0,s=p(e,t))},c=()=>{if(!r||null===s)return;r=!1;const e=s;s=null,d(e,()=>{var e;null==(e=t.onVisibleChange)||e.call(t,!1)})},a=e=>{e.stopPropagation(),r?c():i()},m=t=>{r&&(e.contains(t.target)||c())};return"hover"===n?(e.addEventListener("mouseenter",i),e.addEventListener("mouseleave",c)):"click"===n?(e.addEventListener("click",a),document.addEventListener("click",m)):"focus"===n&&(e.addEventListener("focus",i),e.addEventListener("blur",c)),r&&(s=p(e,t)),{show:i,hide:c,destroy:()=>{c(),l.delete(e),"hover"===n?(e.removeEventListener("mouseenter",i),e.removeEventListener("mouseleave",c)):"click"===n?(e.removeEventListener("click",a),document.removeEventListener("click",m)):"focus"===n&&(e.removeEventListener("focus",i),e.removeEventListener("blur",c))}}},showOnce:u,show:u,hide:async function(e){m(),null==e||e()},destroy:m,config:function(e){Object.assign(o,e)}};exports.Tooltip=f;
@@ -1,14 +1,27 @@
1
1
  import { TooltipOptions, TooltipInstance, TooltipConfig } from './types';
2
+ declare function hideAllTooltipsSync(): void;
2
3
  declare function hideAllTooltips(callback?: () => void): Promise<void>;
3
4
  declare function bind(target: HTMLElement, options: TooltipOptions): TooltipInstance;
5
+ /**
6
+ * 一次性显示 Tooltip(自动隐藏)
7
+ * 如需手动控制显隐,请使用 bind() 方法
8
+ */
4
9
  declare function showOnce(target: HTMLElement, options: TooltipOptions & {
5
10
  duration?: number;
6
11
  }): void;
7
12
  declare function config(options: Partial<TooltipConfig>): void;
8
13
  export declare const Tooltip: {
14
+ /** 绑定到目标元素,返回可手动控制的实例 */
9
15
  bind: typeof bind;
16
+ /** 一次性显示(自动隐藏)。如需手动控制请用 bind() */
17
+ showOnce: typeof showOnce;
18
+ /** @deprecated show 的别名,仅为向后兼容保留,请使用 showOnce */
10
19
  show: typeof showOnce;
20
+ /** 隐藏所有 Tooltip */
11
21
  hide: typeof hideAllTooltips;
22
+ /** 销毁所有 Tooltip */
23
+ destroy: typeof hideAllTooltipsSync;
24
+ /** 配置全局默认值 */
12
25
  config: typeof config;
13
26
  };
14
27
  export default Tooltip;
@@ -1 +1 @@
1
- import{generateId as e,createElement as t,injectStyle as o}from"../utils.js";import n from"./style.css.js";const r={placement:"top",trigger:"hover",duration:3e3,singleton:!0},l=[],s=new WeakSet;let i=null;function a(e,t,o,n=8){const r=e.getBoundingClientRect(),l=t.offsetWidth||250,s=t.offsetHeight||100;let i,a,c=0,d=0;switch(o){case"top":c=r.top-s-n,d=r.left+(r.width-l)/2,i=l/2-4;break;case"topLeft":c=r.top-s-n,d=r.left,i=16;break;case"topRight":c=r.top-s-n,d=r.right-l,i=l-24;break;case"bottom":c=r.bottom+n,d=r.left+(r.width-l)/2,i=l/2-4;break;case"bottomLeft":c=r.bottom+n,d=r.left,i=16;break;case"bottomRight":c=r.bottom+n,d=r.right-l,i=l-24;break;case"left":c=r.top+(r.height-s)/2,d=r.left-l-n,a=s/2-4;break;case"leftTop":c=r.top,d=r.left-l-n,a=16;break;case"leftBottom":c=r.bottom-s,d=r.left-l-n,a=s-24;break;case"right":c=r.top+(r.height-s)/2,d=r.right+n,a=s/2-4;break;case"rightTop":c=r.top,d=r.right+n,a=16;break;case"rightBottom":c=r.bottom-s,d=r.right+n,a=s-24}return c=Math.max(8,Math.min(c,window.innerHeight-s-8)),d=Math.max(8,Math.min(d,window.innerWidth-l-8)),{top:c,left:d,arrowLeft:i,arrowTop:a}}let c=null,d=!1;function m(){c||(c=requestAnimationFrame(()=>{c=null,l.forEach(e=>{const t=e.element;if(!t||!e.target)return;const o=t.querySelector(".solely-tooltip__arrow"),n=a(e.target,t,e.placement);t.style.top=`${n.top}px`,t.style.left=`${n.left}px`,o&&(void 0!==n.arrowLeft&&(o.style.left=`${n.arrowLeft}px`,o.style.top=""),void 0!==n.arrowTop&&(o.style.top=`${n.arrowTop}px`,o.style.left=""))})}))}function u(){d&&(d=!1,window.removeEventListener("resize",m),c&&(cancelAnimationFrame(c),c=null))}async function f(e,t){const o=l.findIndex(t=>t.id===e);if(-1===o)return;const n=l[o];n.element.classList.add("is-closing"),n.element.remove(),n.scrollParents.forEach(e=>e.removeEventListener("scroll",m)),l.splice(o,1),0===l.length&&u(),null==t||t()}function p(){if(0===l.length)return;const e=new Set;l.forEach(t=>{t.scrollParents.forEach(t=>e.add(t)),t.element.classList.add("is-closing"),t.element.remove()}),e.forEach(e=>e.removeEventListener("scroll",m)),l.length=0,u()}function h(s,c){var u;const f=e();o("solely-tooltip-styles",n);const h=c.placement??r.placement,v=l.findIndex(e=>e.target===s);if(-1!==v){const e=l[v];e.element.remove(),e.scrollParents.forEach(e=>e.removeEventListener("scroll",m)),l.splice(v,1)}r.singleton&&l.length>0&&p();const g=t("div",{className:`solely-tooltip solely-tooltip--${h}${c.className?` ${c.className}`:""}`,styles:{...c.style,...c.color?{backgroundColor:c.color}:{}}});var b;b=g,(()=>{const e=document.documentElement.getAttribute("data-theme");e?b.setAttribute("data-theme",e):b.removeAttribute("data-theme")})(),i||(i=new MutationObserver(()=>{const e=document.documentElement.getAttribute("data-theme");l.forEach(t=>{e?t.element.setAttribute("data-theme",e):t.element.removeAttribute("data-theme")})}),i.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}));const w=t("div",{className:"solely-tooltip__content"});c.content&&("string"==typeof c.content?w.textContent=c.content:c.content instanceof HTMLElement&&w.appendChild(c.content.cloneNode(!0))),g.appendChild(w);const E=t("div",{className:"solely-tooltip__arrow"});c.color&&(E.style.backgroundColor=c.color),g.appendChild(E),document.body.appendChild(g),requestAnimationFrame(()=>{const e=a(s,g,h);g.style.top=`${e.top}px`,g.style.left=`${e.left}px`,void 0!==e.arrowLeft&&(E.style.left=`${e.arrowLeft}px`),void 0!==e.arrowTop&&(E.style.top=`${e.arrowTop}px`)});const y=function(e){const t=[];let o=e.parentElement;for(;o&&o!==document.body;){const e=getComputedStyle(o);"auto"!==e.overflow&&"scroll"!==e.overflow&&"auto"!==e.overflowY&&"scroll"!==e.overflowY||t.push(o),o=o.parentElement}return t}(s);return y.forEach(e=>e.addEventListener("scroll",m)),d||0===l.length||(d=!0,window.addEventListener("resize",m)),l.push({id:f,element:g,target:s,placement:h,scrollParents:y}),null==(u=c.onVisibleChange)||u.call(c,!0),f}const v={bind:function(e,t){if(s.has(e))return{show:()=>{},hide:()=>{},destroy:()=>{}};s.add(e);const o=t.trigger??r.trigger;let n=t.visible??t.defaultVisible??!1,l=null;const i=()=>{n||(n=!0,l=h(e,t))},a=()=>{if(!n||null===l)return;n=!1;const e=l;l=null,f(e,()=>{var e;null==(e=t.onVisibleChange)||e.call(t,!1)})},c=e=>{e.stopPropagation(),n?a():i()},d=t=>{n&&(e.contains(t.target)||a())};return"hover"===o?(e.addEventListener("mouseenter",i),e.addEventListener("mouseleave",a)):"click"===o?(e.addEventListener("click",c),document.addEventListener("click",d)):"focus"===o&&(e.addEventListener("focus",i),e.addEventListener("blur",a)),n&&(l=h(e,t)),{show:i,hide:a,destroy:()=>{a(),s.delete(e),"hover"===o?(e.removeEventListener("mouseenter",i),e.removeEventListener("mouseleave",a)):"click"===o?(e.removeEventListener("click",c),document.removeEventListener("click",d)):"focus"===o&&(e.removeEventListener("focus",i),e.removeEventListener("blur",a))}}},show:function(e,t){const o=h(e,t),n=t.duration??r.duration;n>0&&setTimeout(()=>f(o),n)},hide:async function(e){p(),null==e||e()},config:function(e){Object.assign(r,e)}};export{v as Tooltip};
1
+ import{generateId as e,createElement as t,observeTheme as o,injectStyle as n}from"../utils.js";import l from"./style.css.js";const r={placement:"top",trigger:"hover",duration:3e3,singleton:!0},s=[],i=new WeakSet;function c(e,t,o,n=8){const l=e.getBoundingClientRect(),r=t.offsetWidth||250,s=t.offsetHeight||100;let i,c,a=0,d=0;switch(o){case"top":a=l.top-s-n,d=l.left+(l.width-r)/2,i=r/2-4;break;case"topLeft":a=l.top-s-n,d=l.left,i=16;break;case"topRight":a=l.top-s-n,d=l.right-r,i=r-24;break;case"bottom":a=l.bottom+n,d=l.left+(l.width-r)/2,i=r/2-4;break;case"bottomLeft":a=l.bottom+n,d=l.left,i=16;break;case"bottomRight":a=l.bottom+n,d=l.right-r,i=r-24;break;case"left":a=l.top+(l.height-s)/2,d=l.left-r-n,c=s/2-4;break;case"leftTop":a=l.top,d=l.left-r-n,c=16;break;case"leftBottom":a=l.bottom-s,d=l.left-r-n,c=s-24;break;case"right":a=l.top+(l.height-s)/2,d=l.right+n,c=s/2-4;break;case"rightTop":a=l.top,d=l.right+n,c=16;break;case"rightBottom":a=l.bottom-s,d=l.right+n,c=s-24}return a=Math.max(8,Math.min(a,window.innerHeight-s-8)),d=Math.max(8,Math.min(d,window.innerWidth-r-8)),{top:a,left:d,arrowLeft:i,arrowTop:c}}let a=null,d=!1;function m(){a||(a=requestAnimationFrame(()=>{a=null,s.forEach(e=>{const t=e.element;if(!t||!e.target)return;const o=t.querySelector(".solely-tooltip__arrow"),n=c(e.target,t,e.placement);t.style.top=`${n.top}px`,t.style.left=`${n.left}px`,o&&(void 0!==n.arrowLeft&&(o.style.left=`${n.arrowLeft}px`,o.style.top=""),void 0!==n.arrowTop&&(o.style.top=`${n.arrowTop}px`,o.style.left=""))})}))}function f(){d&&(d=!1,window.removeEventListener("resize",m),a&&(cancelAnimationFrame(a),a=null))}async function p(e,t){const o=s.findIndex(t=>t.id===e);if(-1===o)return;const n=s[o];n.element.classList.add("is-closing"),n.element.remove(),n.cleanupTheme(),n.scrollParents.forEach(e=>e.removeEventListener("scroll",m)),s.splice(o,1),0===s.length&&f(),null==t||t()}function u(){if(0===s.length)return;const e=new Set;s.forEach(t=>{t.scrollParents.forEach(t=>e.add(t)),t.element.classList.add("is-closing"),t.element.remove(),t.cleanupTheme()}),e.forEach(e=>e.removeEventListener("scroll",m)),s.length=0,f()}function h(i,a){var f;const p=e();n("solely-tooltip-styles",l);const h=a.placement??r.placement,v=a.cloneElement??!0,g=s.findIndex(e=>e.target===i);if(-1!==g){const e=s[g];e.element.remove(),e.cleanupTheme(),e.scrollParents.forEach(e=>e.removeEventListener("scroll",m)),s.splice(g,1)}r.singleton&&s.length>0&&u();const w=t("div",{className:`solely-tooltip solely-tooltip--${h}${a.className?` ${a.className}`:""}`,styles:{...a.style,...a.color?{backgroundColor:a.color}:{}}}),b=o(()=>w),y=t("div",{className:"solely-tooltip__content"});a.content&&("string"==typeof a.content?y.textContent=a.content:a.content instanceof HTMLElement&&y.appendChild(v?a.content.cloneNode(!0):a.content)),w.appendChild(y);const E=t("div",{className:"solely-tooltip__arrow"});a.color&&(E.style.backgroundColor=a.color),w.appendChild(E),document.body.appendChild(w),requestAnimationFrame(()=>{const e=c(i,w,h);w.style.top=`${e.top}px`,w.style.left=`${e.left}px`,void 0!==e.arrowLeft&&(E.style.left=`${e.arrowLeft}px`),void 0!==e.arrowTop&&(E.style.top=`${e.arrowTop}px`)});const L=function(e){const t=[];let o=e.parentElement;for(;o&&o!==document.body;){const e=getComputedStyle(o);"auto"!==e.overflow&&"scroll"!==e.overflow&&"auto"!==e.overflowY&&"scroll"!==e.overflowY||t.push(o),o=o.parentElement}return t}(i);return L.forEach(e=>e.addEventListener("scroll",m)),d||0===s.length||(d=!0,window.addEventListener("resize",m)),s.push({id:p,element:w,target:i,placement:h,scrollParents:L,cleanupTheme:b}),null==(f=a.onVisibleChange)||f.call(a,!0),p}function v(e,t){const o=h(e,t),n=t.duration??r.duration;n>0&&setTimeout(()=>p(o),n)}const g={bind:function(e,t){if(i.has(e))return{show:()=>{},hide:()=>{},destroy:()=>{}};i.add(e);const o=t.trigger??r.trigger;let n=t.visible??t.defaultVisible??!1,l=null;const s=()=>{n||(n=!0,l=h(e,t))},c=()=>{if(!n||null===l)return;n=!1;const e=l;l=null,p(e,()=>{var e;null==(e=t.onVisibleChange)||e.call(t,!1)})},a=e=>{e.stopPropagation(),n?c():s()},d=t=>{n&&(e.contains(t.target)||c())};return"hover"===o?(e.addEventListener("mouseenter",s),e.addEventListener("mouseleave",c)):"click"===o?(e.addEventListener("click",a),document.addEventListener("click",d)):"focus"===o&&(e.addEventListener("focus",s),e.addEventListener("blur",c)),n&&(l=h(e,t)),{show:s,hide:c,destroy:()=>{c(),i.delete(e),"hover"===o?(e.removeEventListener("mouseenter",s),e.removeEventListener("mouseleave",c)):"click"===o?(e.removeEventListener("click",a),document.removeEventListener("click",d)):"focus"===o&&(e.removeEventListener("focus",s),e.removeEventListener("blur",c))}}},showOnce:v,show:v,hide:async function(e){u(),null==e||e()},destroy:u,config:function(e){Object.assign(r,e)}};export{g as Tooltip};
@@ -21,6 +21,8 @@ export interface TooltipOptions {
21
21
  style?: Partial<CSSStyleDeclaration>;
22
22
  /** 浮层渲染节点 */
23
23
  getPopupContainer?: () => HTMLElement;
24
+ /** 是否克隆传入的 HTMLElement 内容(默认 true) */
25
+ cloneElement?: boolean;
24
26
  }
25
27
  export interface TooltipInstance {
26
28
  /** 显示提示 */
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t={FAST:200,NORMAL:300,SLOW:500};let e=0;exports.ANIMATION_DURATION=t,exports.Z_INDEX={TOOLTIP:1070,POPOVER:1060,MODAL:1050,TOAST:1100},exports.addClosingAnimation=function(e,o=t.NORMAL){return new Promise(t=>{e.classList.add("is-closing"),setTimeout(()=>t(),o)})},exports.calculatePosition=function(t,e,o="top",n=8){const r=t.getBoundingClientRect(),s=(null==e?void 0:e.offsetWidth)??250,a=(null==e?void 0:e.offsetHeight)??100,i=window.pageYOffset||document.documentElement.scrollTop,l=window.pageXOffset||document.documentElement.scrollLeft;let c,m,d=0,u=0;switch(o){case"top":d=r.top+i-a-n,u=r.left+l+(r.width-s)/2,c=s/2-4;break;case"topLeft":d=r.top+i-a-n,u=r.left+l,c=16;break;case"topRight":d=r.top+i-a-n,u=r.right+l-s,c=s-24;break;case"bottom":d=r.bottom+i+n,u=r.left+l+(r.width-s)/2,c=s/2-4;break;case"bottomLeft":d=r.bottom+i+n,u=r.left+l,c=16;break;case"bottomRight":d=r.bottom+i+n,u=r.right+l-s,c=s-24;break;case"left":d=r.top+i+(r.height-a)/2,u=r.left+l-s-n,m=a/2-4;break;case"leftTop":d=r.top+i,u=r.left+l-s-n,m=16;break;case"leftBottom":d=r.bottom+i-a,u=r.left+l-s-n,m=a-24;break;case"right":d=r.top+i+(r.height-a)/2,u=r.right+l+n,m=a/2-4;break;case"rightTop":d=r.top+i,u=r.right+l+n,m=16;break;case"rightBottom":d=r.bottom+i-a,u=r.right+l+n,m=a-24}return d=Math.max(8,Math.min(d,window.innerHeight+i-a-8)),u=Math.max(8,Math.min(u,window.innerWidth+l-s-8)),{top:d,left:u,arrowLeft:c,arrowTop:m}},exports.createElement=function(t,e){const o=document.createElement(t);return(null==e?void 0:e.className)&&(o.className=e.className),void 0!==(null==e?void 0:e.textContent)&&(o.textContent=e.textContent),(null==e?void 0:e.styles)&&Object.assign(o.style,e.styles),(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(([t,e])=>{o.setAttribute(t,e)}),o},exports.generateId=function(){return e=(e+1)%Number.MAX_SAFE_INTEGER,e},exports.injectStyle=function(t,e){if(document.getElementById(t))return;const o=document.createElement("style");o.id=t,o.textContent=e,document.head.appendChild(o)},exports.removeStyle=function(t){const e=document.getElementById(t);e&&e.remove()},exports.safeAsyncCallback=async function(t,e){try{return await t()}catch(o){return console.error("[Solely Commands] Async callback error:",o),void(null==e||e())}};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t={FAST:200,NORMAL:300,SLOW:500};let e=0,o=null;const n=new Set;exports.ANIMATION_DURATION=t,exports.Z_INDEX={TOOLTIP:1070,POPOVER:1060,MODAL:1050,TOAST:1100},exports.addClosingAnimation=function(e,o=t.NORMAL){return new Promise(t=>{e.classList.add("is-closing"),setTimeout(()=>t(),o)})},exports.calculatePosition=function(t,e,o="top",n=8){const r=t.getBoundingClientRect(),a=(null==e?void 0:e.offsetWidth)??250,s=(null==e?void 0:e.offsetHeight)??100,i=window.pageYOffset||document.documentElement.scrollTop,c=window.pageXOffset||document.documentElement.scrollLeft;let l,m,u=0,d=0;switch(o){case"top":u=r.top+i-s-n,d=r.left+c+(r.width-a)/2,l=a/2-4;break;case"topLeft":u=r.top+i-s-n,d=r.left+c,l=16;break;case"topRight":u=r.top+i-s-n,d=r.right+c-a,l=a-24;break;case"bottom":u=r.bottom+i+n,d=r.left+c+(r.width-a)/2,l=a/2-4;break;case"bottomLeft":u=r.bottom+i+n,d=r.left+c,l=16;break;case"bottomRight":u=r.bottom+i+n,d=r.right+c-a,l=a-24;break;case"left":u=r.top+i+(r.height-s)/2,d=r.left+c-a-n,m=s/2-4;break;case"leftTop":u=r.top+i,d=r.left+c-a-n,m=16;break;case"leftBottom":u=r.bottom+i-s,d=r.left+c-a-n,m=s-24;break;case"right":u=r.top+i+(r.height-s)/2,d=r.right+c+n,m=s/2-4;break;case"rightTop":u=r.top+i,d=r.right+c+n,m=16;break;case"rightBottom":u=r.bottom+i-s,d=r.right+c+n,m=s-24}return u=Math.max(8,Math.min(u,window.innerHeight+i-s-8)),d=Math.max(8,Math.min(d,window.innerWidth+c-a-8)),{top:u,left:d,arrowLeft:l,arrowTop:m}},exports.createElement=function(t,e){const o=document.createElement(t);return(null==e?void 0:e.className)&&(o.className=e.className),void 0!==(null==e?void 0:e.textContent)&&(o.textContent=e.textContent),(null==e?void 0:e.styles)&&Object.assign(o.style,e.styles),(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(([t,e])=>{o.setAttribute(t,e)}),o},exports.generateId=function(){return e=(e+1)%Number.MAX_SAFE_INTEGER,e},exports.injectStyle=function(t,e){if(document.getElementById(t))return;const o=document.createElement("style");o.id=t,o.textContent=e,document.head.appendChild(o)},exports.observeTheme=function(t){const e=()=>{const e=t();if(!e)return;const o=Array.isArray(e)?e:[e],n=document.documentElement.getAttribute("data-theme");o.forEach(t=>{n?t.setAttribute("data-theme",n):t.removeAttribute("data-theme")})};return e(),n.add(e),o||(o=new MutationObserver(()=>{n.forEach(t=>t())}),o.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})),()=>{n.delete(e),0===n.size&&o&&(o.disconnect(),o=null)}},exports.removeStyle=function(t){const e=document.getElementById(t);e&&e.remove()},exports.safeAsyncCallback=async function(t,e){try{return await t()}catch(o){return console.error("[Solely Commands] Async callback error:",o),void(null==e||e())}};
@@ -38,3 +38,9 @@ export declare function safeAsyncCallback<T>(callback: () => T | Promise<T>, fal
38
38
  * 添加关闭动画(使用 .is-closing 类)
39
39
  */
40
40
  export declare function addClosingAnimation(element: HTMLElement, duration?: number): Promise<void>;
41
+ /**
42
+ * 观察主题变化并同步到指定元素
43
+ * @param getElements 返回需要同步主题的元素(单个、数组或 null)
44
+ * @returns 清理函数(取消观察)
45
+ */
46
+ export declare function observeTheme(getElements: () => HTMLElement | HTMLElement[] | null): () => void;
@@ -1 +1 @@
1
- const t={FAST:200,NORMAL:300,SLOW:500},e={TOOLTIP:1070,POPOVER:1060,MODAL:1050,TOAST:1100};let o=0;function n(){return o=(o+1)%Number.MAX_SAFE_INTEGER,o}function r(t,e){if(document.getElementById(t))return;const o=document.createElement("style");o.id=t,o.textContent=e,document.head.appendChild(o)}function a(t){const e=document.getElementById(t);e&&e.remove()}function i(t,e){const o=document.createElement(t);return(null==e?void 0:e.className)&&(o.className=e.className),void 0!==(null==e?void 0:e.textContent)&&(o.textContent=e.textContent),(null==e?void 0:e.styles)&&Object.assign(o.style,e.styles),(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(([t,e])=>{o.setAttribute(t,e)}),o}function c(t,e,o="top",n=8){const r=t.getBoundingClientRect(),a=(null==e?void 0:e.offsetWidth)??250,i=(null==e?void 0:e.offsetHeight)??100,c=window.pageYOffset||document.documentElement.scrollTop,l=window.pageXOffset||document.documentElement.scrollLeft;let s,m,d=0,u=0;switch(o){case"top":d=r.top+c-i-n,u=r.left+l+(r.width-a)/2,s=a/2-4;break;case"topLeft":d=r.top+c-i-n,u=r.left+l,s=16;break;case"topRight":d=r.top+c-i-n,u=r.right+l-a,s=a-24;break;case"bottom":d=r.bottom+c+n,u=r.left+l+(r.width-a)/2,s=a/2-4;break;case"bottomLeft":d=r.bottom+c+n,u=r.left+l,s=16;break;case"bottomRight":d=r.bottom+c+n,u=r.right+l-a,s=a-24;break;case"left":d=r.top+c+(r.height-i)/2,u=r.left+l-a-n,m=i/2-4;break;case"leftTop":d=r.top+c,u=r.left+l-a-n,m=16;break;case"leftBottom":d=r.bottom+c-i,u=r.left+l-a-n,m=i-24;break;case"right":d=r.top+c+(r.height-i)/2,u=r.right+l+n,m=i/2-4;break;case"rightTop":d=r.top+c,u=r.right+l+n,m=16;break;case"rightBottom":d=r.bottom+c-i,u=r.right+l+n,m=i-24}return d=Math.max(8,Math.min(d,window.innerHeight+c-i-8)),u=Math.max(8,Math.min(u,window.innerWidth+l-a-8)),{top:d,left:u,arrowLeft:s,arrowTop:m}}async function l(t,e){try{return await t()}catch(o){return console.error("[Solely Commands] Async callback error:",o),void(null==e||e())}}function s(e,o=t.NORMAL){return new Promise(t=>{e.classList.add("is-closing"),setTimeout(()=>t(),o)})}export{t as ANIMATION_DURATION,e as Z_INDEX,s as addClosingAnimation,c as calculatePosition,i as createElement,n as generateId,r as injectStyle,a as removeStyle,l as safeAsyncCallback};
1
+ const t={FAST:200,NORMAL:300,SLOW:500},e={TOOLTIP:1070,POPOVER:1060,MODAL:1050,TOAST:1100};let o=0;function n(){return o=(o+1)%Number.MAX_SAFE_INTEGER,o}function r(t,e){if(document.getElementById(t))return;const o=document.createElement("style");o.id=t,o.textContent=e,document.head.appendChild(o)}function a(t){const e=document.getElementById(t);e&&e.remove()}function i(t,e){const o=document.createElement(t);return(null==e?void 0:e.className)&&(o.className=e.className),void 0!==(null==e?void 0:e.textContent)&&(o.textContent=e.textContent),(null==e?void 0:e.styles)&&Object.assign(o.style,e.styles),(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(([t,e])=>{o.setAttribute(t,e)}),o}function c(t,e,o="top",n=8){const r=t.getBoundingClientRect(),a=(null==e?void 0:e.offsetWidth)??250,i=(null==e?void 0:e.offsetHeight)??100,c=window.pageYOffset||document.documentElement.scrollTop,s=window.pageXOffset||document.documentElement.scrollLeft;let l,m,u=0,d=0;switch(o){case"top":u=r.top+c-i-n,d=r.left+s+(r.width-a)/2,l=a/2-4;break;case"topLeft":u=r.top+c-i-n,d=r.left+s,l=16;break;case"topRight":u=r.top+c-i-n,d=r.right+s-a,l=a-24;break;case"bottom":u=r.bottom+c+n,d=r.left+s+(r.width-a)/2,l=a/2-4;break;case"bottomLeft":u=r.bottom+c+n,d=r.left+s,l=16;break;case"bottomRight":u=r.bottom+c+n,d=r.right+s-a,l=a-24;break;case"left":u=r.top+c+(r.height-i)/2,d=r.left+s-a-n,m=i/2-4;break;case"leftTop":u=r.top+c,d=r.left+s-a-n,m=16;break;case"leftBottom":u=r.bottom+c-i,d=r.left+s-a-n,m=i-24;break;case"right":u=r.top+c+(r.height-i)/2,d=r.right+s+n,m=i/2-4;break;case"rightTop":u=r.top+c,d=r.right+s+n,m=16;break;case"rightBottom":u=r.bottom+c-i,d=r.right+s+n,m=i-24}return u=Math.max(8,Math.min(u,window.innerHeight+c-i-8)),d=Math.max(8,Math.min(d,window.innerWidth+s-a-8)),{top:u,left:d,arrowLeft:l,arrowTop:m}}async function s(t,e){try{return await t()}catch(o){return console.error("[Solely Commands] Async callback error:",o),void(null==e||e())}}function l(e,o=t.NORMAL){return new Promise(t=>{e.classList.add("is-closing"),setTimeout(()=>t(),o)})}let m=null;const u=new Set;function d(t){const e=()=>{const e=t();if(!e)return;const o=Array.isArray(e)?e:[e],n=document.documentElement.getAttribute("data-theme");o.forEach(t=>{n?t.setAttribute("data-theme",n):t.removeAttribute("data-theme")})};return e(),u.add(e),m||(m=new MutationObserver(()=>{u.forEach(t=>t())}),m.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})),()=>{u.delete(e),0===u.size&&m&&(m.disconnect(),m=null)}}export{t as ANIMATION_DURATION,e as Z_INDEX,l as addClosingAnimation,c as calculatePosition,i as createElement,n as generateId,r as injectStyle,d as observeTheme,a as removeStyle,s as safeAsyncCallback};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./style.css.cjs"),e=require("./index.html.cjs"),a=require("../../../runtime/component/base-element.cjs"),n=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyButton=class extends a.default{mounted(){this.refresh()}getButtonClasses(){const t={};return this.$data.type&&"default"!==this.$data.type?t[`btn--${this.$data.type}`]=!0:t["btn--default"]=!0,"small"===this.$data.size?t["btn--sm"]=!0:"large"===this.$data.size&&(t["btn--lg"]=!0),this.$data.shape&&"default"!==this.$data.shape&&(t[`btn--shape-${this.$data.shape}`]=!0),t["is-disabled"]=!!this.$data.disabled,t["is-loading"]=!!this.$data.loading,t["btn--ghost"]=!!this.$data.ghost,t["btn--danger"]=!!this.$data.danger,t["btn--icon-only"]=!!this.$data.iconOnly,t["btn--block"]=!!this.$data.block,t}getTagName(){return this.$data.href?"a":"button"}getLinkAttrs(){const t={};return this.$data.href&&(t.href=this.$data.href,this.$data.target&&(t.target=this.$data.target)),t}hasLoadingIconSlot(){return null!==this.querySelector('[slot="loading-icon"]')}getLoadingIcon(){return this.$data.loadingIcon||""}handleClick(t){if(this.$data.loading||this.$data.disabled)return t.preventDefault(),void t.stopPropagation()}setLoading(t){this.$data.loading=t}setDisabled(t){this.$data.disabled=t}focus(){var t;null==(t=this.$refs.buttonRef)||t.focus()}blur(){var t;null==(t=this.$refs.buttonRef)||t.blur()}hasDefaultSlotContent(){return Array.from(this.childNodes).filter(t=>{var e;return t.nodeType===Node.ELEMENT_NODE?!t.hasAttribute("slot"):t.nodeType===Node.TEXT_NODE&&""!==(null==(e=t.textContent)?void 0:e.trim())}).length>0}hasIconSlot(){return null!==this.querySelector('[slot="icon"]')}hasIconRightSlot(){return null!==this.querySelector('[slot="icon-right"]')}},exports.SolelyButton=((t,e)=>{for(var a,n=e,s=t.length-1;s>=0;s--)(a=t[s])&&(n=a(n)||n);return n})([n.CustomElement({tagName:"solely-button",template:e.__SOLELY_IR__,styles:t.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"default"},{name:"size",type:"string",default:""},{name:"shape",type:"string",default:""},{name:"disabled",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"ghost",type:"boolean",default:!1},{name:"danger",type:"boolean",default:!1},{name:"block",type:"boolean",default:!1},{name:"iconOnly",type:"boolean",default:!1},{name:"content",type:"string",default:""},{name:"icon",type:"string",default:""},{name:"iconRight",type:"string",default:""},{name:"loadingIcon",type:"string",default:""},{name:"href",type:"string",default:""},{name:"target",type:"string",default:""}]})],exports.SolelyButton);
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./style.css.cjs"),e=require("./index.html.cjs"),a=require("../../../runtime/component/base-element.cjs"),n=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyButton=class extends a.default{mounted(){this.refresh()}getButtonClasses(){const t={};return this.$data.type&&"default"!==this.$data.type?t[`btn--${this.$data.type}`]=!0:t["btn--default"]=!0,"small"===this.$data.size?t["btn--sm"]=!0:"large"===this.$data.size&&(t["btn--lg"]=!0),this.$data.shape&&"default"!==this.$data.shape&&(t[`btn--shape-${this.$data.shape}`]=!0),t["is-disabled"]=!!this.$data.disabled,t["is-loading"]=!!this.$data.loading,t["btn--ghost"]=!!this.$data.ghost,t["btn--danger"]=!!this.$data.danger,t["btn--icon-only"]=!!this.$data.iconOnly,t["btn--block"]=!!this.$data.block,t}getTagName(){return this.$data.href?"a":"button"}getLinkAttrs(){const t={};return this.$data.href&&(t.href=this.$data.href,this.$data.target&&(t.target=this.$data.target)),t}hasLoadingIconSlot(){return null!==this.querySelector('[slot="loading-icon"]')}getLoadingIcon(){return this.$data.loadingIcon||""}handleClick(t){if(this.$data.loading||this.$data.disabled)return t.preventDefault(),void t.stopPropagation()}setLoading(t){this.$data.loading=t}setDisabled(t){this.$data.disabled=t}focus(){var t;null==(t=this.$refs.buttonRef)||t.focus()}blur(){var t;null==(t=this.$refs.buttonRef)||t.blur()}hasDefaultSlotContent(){return Array.from(this.childNodes).filter(t=>{var e;return t.nodeType===Node.ELEMENT_NODE?!t.hasAttribute("slot"):t.nodeType===Node.TEXT_NODE&&""!==(null==(e=t.textContent)?void 0:e.trim())}).length>0}hasIconSlot(){return null!==this.querySelector('[slot="icon"]')}hasIconRightSlot(){return null!==this.querySelector('[slot="icon-right"]')}},exports.SolelyButton=((t,e)=>{for(var a,n=e,s=t.length-1;s>=0;s--)(a=t[s])&&(n=a(n)||n);return n})([n.CustomElement({tagName:"solely-button",template:e.__SOLELY_IR__,styles:t.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"default"},{name:"size",type:"string",default:"medium"},{name:"shape",type:"string",default:""},{name:"disabled",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"ghost",type:"boolean",default:!1},{name:"danger",type:"boolean",default:!1},{name:"block",type:"boolean",default:!1},{name:"iconOnly",type:"boolean",default:!1},{name:"content",type:"string",default:""},{name:"icon",type:"string",default:""},{name:"iconRight",type:"string",default:""},{name:"loadingIcon",type:"string",default:""},{name:"href",type:"string",default:""},{name:"target",type:"string",default:""}]})],exports.SolelyButton);
@@ -1 +1 @@
1
- import t from"./style.css.js";import{__SOLELY_IR__ as e}from"./index.html.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as n}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let s=class extends a{mounted(){this.refresh()}getButtonClasses(){const t={};return this.$data.type&&"default"!==this.$data.type?t[`btn--${this.$data.type}`]=!0:t["btn--default"]=!0,"small"===this.$data.size?t["btn--sm"]=!0:"large"===this.$data.size&&(t["btn--lg"]=!0),this.$data.shape&&"default"!==this.$data.shape&&(t[`btn--shape-${this.$data.shape}`]=!0),t["is-disabled"]=!!this.$data.disabled,t["is-loading"]=!!this.$data.loading,t["btn--ghost"]=!!this.$data.ghost,t["btn--danger"]=!!this.$data.danger,t["btn--icon-only"]=!!this.$data.iconOnly,t["btn--block"]=!!this.$data.block,t}getTagName(){return this.$data.href?"a":"button"}getLinkAttrs(){const t={};return this.$data.href&&(t.href=this.$data.href,this.$data.target&&(t.target=this.$data.target)),t}hasLoadingIconSlot(){return null!==this.querySelector('[slot="loading-icon"]')}getLoadingIcon(){return this.$data.loadingIcon||""}handleClick(t){if(this.$data.loading||this.$data.disabled)return t.preventDefault(),void t.stopPropagation()}setLoading(t){this.$data.loading=t}setDisabled(t){this.$data.disabled=t}focus(){var t;null==(t=this.$refs.buttonRef)||t.focus()}blur(){var t;null==(t=this.$refs.buttonRef)||t.blur()}hasDefaultSlotContent(){return Array.from(this.childNodes).filter(t=>{var e;return t.nodeType===Node.ELEMENT_NODE?!t.hasAttribute("slot"):t.nodeType===Node.TEXT_NODE&&""!==(null==(e=t.textContent)?void 0:e.trim())}).length>0}hasIconSlot(){return null!==this.querySelector('[slot="icon"]')}hasIconRightSlot(){return null!==this.querySelector('[slot="icon-right"]')}};s=((t,e)=>{for(var a,n=e,s=t.length-1;s>=0;s--)(a=t[s])&&(n=a(n)||n);return n})([n({tagName:"solely-button",template:e,styles:t,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"default"},{name:"size",type:"string",default:""},{name:"shape",type:"string",default:""},{name:"disabled",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"ghost",type:"boolean",default:!1},{name:"danger",type:"boolean",default:!1},{name:"block",type:"boolean",default:!1},{name:"iconOnly",type:"boolean",default:!1},{name:"content",type:"string",default:""},{name:"icon",type:"string",default:""},{name:"iconRight",type:"string",default:""},{name:"loadingIcon",type:"string",default:""},{name:"href",type:"string",default:""},{name:"target",type:"string",default:""}]})],s);export{s as SolelyButton};
1
+ import t from"./style.css.js";import{__SOLELY_IR__ as e}from"./index.html.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as n}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let s=class extends a{mounted(){this.refresh()}getButtonClasses(){const t={};return this.$data.type&&"default"!==this.$data.type?t[`btn--${this.$data.type}`]=!0:t["btn--default"]=!0,"small"===this.$data.size?t["btn--sm"]=!0:"large"===this.$data.size&&(t["btn--lg"]=!0),this.$data.shape&&"default"!==this.$data.shape&&(t[`btn--shape-${this.$data.shape}`]=!0),t["is-disabled"]=!!this.$data.disabled,t["is-loading"]=!!this.$data.loading,t["btn--ghost"]=!!this.$data.ghost,t["btn--danger"]=!!this.$data.danger,t["btn--icon-only"]=!!this.$data.iconOnly,t["btn--block"]=!!this.$data.block,t}getTagName(){return this.$data.href?"a":"button"}getLinkAttrs(){const t={};return this.$data.href&&(t.href=this.$data.href,this.$data.target&&(t.target=this.$data.target)),t}hasLoadingIconSlot(){return null!==this.querySelector('[slot="loading-icon"]')}getLoadingIcon(){return this.$data.loadingIcon||""}handleClick(t){if(this.$data.loading||this.$data.disabled)return t.preventDefault(),void t.stopPropagation()}setLoading(t){this.$data.loading=t}setDisabled(t){this.$data.disabled=t}focus(){var t;null==(t=this.$refs.buttonRef)||t.focus()}blur(){var t;null==(t=this.$refs.buttonRef)||t.blur()}hasDefaultSlotContent(){return Array.from(this.childNodes).filter(t=>{var e;return t.nodeType===Node.ELEMENT_NODE?!t.hasAttribute("slot"):t.nodeType===Node.TEXT_NODE&&""!==(null==(e=t.textContent)?void 0:e.trim())}).length>0}hasIconSlot(){return null!==this.querySelector('[slot="icon"]')}hasIconRightSlot(){return null!==this.querySelector('[slot="icon-right"]')}};s=((t,e)=>{for(var a,n=e,s=t.length-1;s>=0;s--)(a=t[s])&&(n=a(n)||n);return n})([n({tagName:"solely-button",template:e,styles:t,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"default"},{name:"size",type:"string",default:"medium"},{name:"shape",type:"string",default:""},{name:"disabled",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"ghost",type:"boolean",default:!1},{name:"danger",type:"boolean",default:!1},{name:"block",type:"boolean",default:!1},{name:"iconOnly",type:"boolean",default:!1},{name:"content",type:"string",default:""},{name:"icon",type:"string",default:""},{name:"iconRight",type:"string",default:""},{name:"loadingIcon",type:"string",default:""},{name:"href",type:"string",default:""},{name:"target",type:"string",default:""}]})],s);export{s as SolelyButton};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),a=require("../../../runtime/component/base-element.cjs"),r=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyCard=class extends a.default{getCardClasses(){const e={"card--bordered":!!this.$data.bordered,"card--hoverable":!!this.$data.hoverable};return"small"===this.$data.size?e["card--sm"]=!0:"large"===this.$data.size&&(e["card--lg"]=!0),e["is-loading"]=!!this.$data.loading,e}mounted(){this.refresh()}setLoading(e){this.$data.loading=e}setTitle(e){this.$data.title=e}getActionItems(){const e=this.$data.actions;return Array.isArray(e)?e.filter(e=>"string"==typeof e):[]}handleActionClick(e,t){const a=this.getActionItems();if(e<0||e>=a.length)return;const r=a[e];this.emit("action",{index:e,action:r})}},exports.SolelyCard=((e,t)=>{for(var a,r=t,s=e.length-1;s>=0;s--)(a=e[s])&&(r=a(r)||r);return r})([r.CustomElement({tagName:"solely-card",template:t.__SOLELY_IR__,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"title",type:"string",default:""},{name:"size",type:"string",default:"default"},{name:"bordered",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"hoverable",type:"boolean",default:!1},{name:"cover",type:"string",default:""},{name:"actions",type:"array",default:[]},{name:"extra",type:"string",default:""}]})],exports.SolelyCard);
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),a=require("../../../runtime/component/base-element.cjs"),r=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyCard=class extends a.default{getCardClasses(){const e={"card--bordered":!!this.$data.bordered,"card--hoverable":!!this.$data.hoverable};return"small"===this.$data.size?e["card--sm"]=!0:"large"===this.$data.size&&(e["card--lg"]=!0),e["is-loading"]=!!this.$data.loading,e}mounted(){this.refresh()}setLoading(e){this.$data.loading=e}setTitle(e){this.$data.title=e}getActionItems(){const e=this.$data.actions;return Array.isArray(e)?e.filter(e=>"string"==typeof e):[]}handleActionClick(e,t){const a=this.getActionItems();if(e<0||e>=a.length)return;const r=a[e];this.emit("action",{index:e,action:r})}},exports.SolelyCard=((e,t)=>{for(var a,r=t,s=e.length-1;s>=0;s--)(a=e[s])&&(r=a(r)||r);return r})([r.CustomElement({tagName:"solely-card",template:t.__SOLELY_IR__,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"title",type:"string",default:""},{name:"size",type:"string",default:"medium"},{name:"bordered",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"hoverable",type:"boolean",default:!1},{name:"cover",type:"string",default:""},{name:"actions",type:"array",default:[]},{name:"extra",type:"string",default:""}]})],exports.SolelyCard);
@@ -1 +1 @@
1
- import e from"./style.css.js";import{__SOLELY_IR__ as t}from"./index.html.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as r}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let s=class extends a{getCardClasses(){const e={"card--bordered":!!this.$data.bordered,"card--hoverable":!!this.$data.hoverable};return"small"===this.$data.size?e["card--sm"]=!0:"large"===this.$data.size&&(e["card--lg"]=!0),e["is-loading"]=!!this.$data.loading,e}mounted(){this.refresh()}setLoading(e){this.$data.loading=e}setTitle(e){this.$data.title=e}getActionItems(){const e=this.$data.actions;return Array.isArray(e)?e.filter(e=>"string"==typeof e):[]}handleActionClick(e,t){const a=this.getActionItems();if(e<0||e>=a.length)return;const r=a[e];this.emit("action",{index:e,action:r})}};s=((e,t)=>{for(var a,r=t,s=e.length-1;s>=0;s--)(a=e[s])&&(r=a(r)||r);return r})([r({tagName:"solely-card",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"title",type:"string",default:""},{name:"size",type:"string",default:"default"},{name:"bordered",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"hoverable",type:"boolean",default:!1},{name:"cover",type:"string",default:""},{name:"actions",type:"array",default:[]},{name:"extra",type:"string",default:""}]})],s);export{s as SolelyCard};
1
+ import e from"./style.css.js";import{__SOLELY_IR__ as t}from"./index.html.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as r}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let s=class extends a{getCardClasses(){const e={"card--bordered":!!this.$data.bordered,"card--hoverable":!!this.$data.hoverable};return"small"===this.$data.size?e["card--sm"]=!0:"large"===this.$data.size&&(e["card--lg"]=!0),e["is-loading"]=!!this.$data.loading,e}mounted(){this.refresh()}setLoading(e){this.$data.loading=e}setTitle(e){this.$data.title=e}getActionItems(){const e=this.$data.actions;return Array.isArray(e)?e.filter(e=>"string"==typeof e):[]}handleActionClick(e,t){const a=this.getActionItems();if(e<0||e>=a.length)return;const r=a[e];this.emit("action",{index:e,action:r})}};s=((e,t)=>{for(var a,r=t,s=e.length-1;s>=0;s--)(a=e[s])&&(r=a(r)||r);return r})([r({tagName:"solely-card",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"title",type:"string",default:""},{name:"size",type:"string",default:"medium"},{name:"bordered",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"hoverable",type:"boolean",default:!1},{name:"cover",type:"string",default:""},{name:"actions",type:"array",default:[]},{name:"extra",type:"string",default:""}]})],s);export{s as SolelyCard};
@@ -2,7 +2,7 @@
2
2
  * Card 组件类型定义
3
3
  */
4
4
  /** 卡片尺寸 */
5
- export type CardSize = 'default' | 'small' | 'large';
5
+ export type CardSize = 'small' | 'medium' | 'large';
6
6
  /** 卡片属性接口 */
7
7
  export interface CardProps {
8
8
  /** 卡片标题 */
@@ -1 +1 @@
1
- "use strict";var e=Object.defineProperty,t=(t,a,s)=>((t,a,s)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s)(t,"symbol"!=typeof a?a+"":a,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./style.css.cjs"),s=require("./index.html.cjs"),r=require("../../../runtime/component/base-element.cjs"),i=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyInput=class extends r.default{constructor(){super(...arguments),t(this,"_filteredSuggestions",[]),t(this,"inputElement"),t(this,"searchDebounceTimer")}get filteredSuggestions(){return this._filteredSuggestions}mounted(){var e;this.refresh(),this.inputElement=null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"),this.$data.autofocus&&this.focus()}unmounted(){this.searchDebounceTimer&&(clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=void 0)}hasPrefixSlot(){return null!==this.querySelector('[slot="prefix"]')}hasSuffixSlot(){return null!==this.querySelector('[slot="suffix"]')}getWrapperClasses(){const e={};return"small"===this.$data.size?e["form-control--sm"]=!0:"large"===this.$data.size&&(e["form-control--lg"]=!0),"error"===this.$data.status?e["is-error"]=!0:"warning"===this.$data.status?e["is-warning"]=!0:"success"===this.$data.status&&(e["is-success"]=!0),"textarea"===this.$data.type&&(e["form-control--textarea"]=!0),e["is-focused"]=!!this.$data.focused,e["is-disabled"]=!!this.$data.disabled,e["is-readonly"]=!!this.$data.readonly,e["form-control--block"]=!!this.$data.block,e}getCharCount(){var e;return(null==(e=this.$data.value)?void 0:e.length)||0}formatValue(e){if(!e)return"";switch(this.$data.format){case"phone":return e.replace(/(\d{3})(\d{4})(\d{4})/,"$1 $2 $3").trim();case"bankcard":return e.replace(/(\d{4})(?=\d)/g,"$1 ").trim();case"idcard":return e.replace(/(\d{6})(\d{4})(\d{4})(\d{4})(\d{0,4})/,"$1 $2 $3 $4 $5").trim();default:return e}}unformatValue(e){return e?e.replace(/\s/g,""):""}handleInput(e){const t=e.target;let a=t.value;if("none"!==this.$data.format&&"textarea"!==this.$data.type){const e=this.unformatValue(a),s=this.formatValue(e);s!==a&&(t.value=s,a=s)}this.$data.value=a,this.$data.suggestions&&this.$data.suggestions.length>0&&this.updateSuggestions(a)}handleFocus(e){this.$data.focused=!0,this.$data.selectall&&this.$data.value&&this.select()}handleBlur(e){this.$data.focused=!1}handleChange(e){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}handleKeydown(e){"Enter"===e.key&&"search"===this.$data.type&&this.emit("search",{value:this.$data.value})}handleClear(){this.$data.value="",this.dispatchEvent(new Event("clear",{bubbles:!0,composed:!0})),this.focus()}togglePassword(){this.$data.passwordVisible=!this.$data.passwordVisible}async handleCopy(){try{const e=this.unformatValue(this.$data.value);await navigator.clipboard.writeText(e),this.emit("copy",{value:e})}catch(e){this.emit("copy-error",{error:e})}}updateSuggestions(e){this.searchDebounceTimer&&clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=setTimeout(()=>{this._updateSuggestionsImpl(e),this.searchDebounceTimer=void 0},300)}_updateSuggestionsImpl(e){if(!e||!this.$data.suggestions)return this._filteredSuggestions=[],void this.refresh();this._filteredSuggestions=this.$data.suggestions.filter(t=>t.toLowerCase().includes(e.toLowerCase())),this.refresh()}selectSuggestion(e){this.$data.value=e,this._filteredSuggestions=[],this.refresh(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}focus(){var e;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.focus(),this.$data.focused=!0}blur(){var e;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.blur(),this.$data.focused=!1}setValue(e){this.$data.value=e}getValue(){return this.unformatValue(this.$data.value)}get value(){return this.getValue()}set value(e){this.setValue(e)}select(){var e;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.select()}},exports.SolelyInput=((e,t)=>{for(var a,s=t,r=e.length-1;r>=0;r--)(a=e[r])&&(s=a(s)||s);return s})([i.CustomElement({tagName:"solely-input",template:s.__SOLELY_IR__,styles:a.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"text"},{name:"size",type:"string",default:""},{name:"value",type:"string",default:""},{name:"placeholder",type:"string",default:""},{name:"disabled",type:"boolean",default:!1},{name:"readonly",type:"boolean",default:!1},{name:"required",type:"boolean",default:!1},{name:"maxlength",type:"number"},{name:"minlength",type:"number"},{name:"clearable",type:"boolean",default:!1},{name:"showpassword",type:"boolean",default:!1},{name:"passwordVisible",type:"boolean",default:!1},{name:"focused",type:"boolean",default:!1},{name:"prefix",type:"string",default:""},{name:"suffix",type:"string",default:""},{name:"status",type:"string",default:""},{name:"message",type:"string",default:""},{name:"showcount",type:"boolean",default:!1},{name:"rows",type:"number",default:3},{name:"autofocus",type:"boolean",default:!1},{name:"selectall",type:"boolean",default:!1},{name:"copyable",type:"boolean",default:!1},{name:"format",type:"string",default:"none"},{name:"suggestions",type:"array",default:[]},{name:"block",type:"boolean",default:!1}]})],exports.SolelyInput);
1
+ "use strict";var e=Object.defineProperty,t=(t,a,s)=>((t,a,s)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s)(t,"symbol"!=typeof a?a+"":a,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./style.css.cjs"),s=require("./index.html.cjs"),r=require("../../../runtime/component/base-element.cjs"),i=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyInput=class extends r.default{constructor(){super(...arguments),t(this,"_filteredSuggestions",[]),t(this,"inputElement"),t(this,"searchDebounceTimer")}get filteredSuggestions(){return this._filteredSuggestions}mounted(){var e;this.refresh(),this.inputElement=null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"),this.$data.autofocus&&this.focus()}unmounted(){this.searchDebounceTimer&&(clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=void 0)}hasPrefixSlot(){return null!==this.querySelector('[slot="prefix"]')}hasSuffixSlot(){return null!==this.querySelector('[slot="suffix"]')}getWrapperClasses(){const e={};return"small"===this.$data.size?e["form-control--sm"]=!0:"large"===this.$data.size&&(e["form-control--lg"]=!0),"error"===this.$data.status?e["is-error"]=!0:"warning"===this.$data.status?e["is-warning"]=!0:"success"===this.$data.status&&(e["is-success"]=!0),"textarea"===this.$data.type&&(e["form-control--textarea"]=!0),e["is-focused"]=!!this.$data.focused,e["is-disabled"]=!!this.$data.disabled,e["is-readonly"]=!!this.$data.readonly,e["form-control--block"]=!!this.$data.block,e}getCharCount(){var e;return(null==(e=this.$data.value)?void 0:e.length)||0}formatValue(e){if(!e)return"";switch(this.$data.format){case"phone":return e.replace(/(\d{3})(\d{4})(\d{4})/,"$1 $2 $3").trim();case"bankcard":return e.replace(/(\d{4})(?=\d)/g,"$1 ").trim();case"idcard":return e.replace(/(\d{6})(\d{4})(\d{4})(\d{4})(\d{0,4})/,"$1 $2 $3 $4 $5").trim();default:return e}}unformatValue(e){return e?e.replace(/\s/g,""):""}handleInput(e){const t=e.target;let a=t.value;if("none"!==this.$data.format&&"textarea"!==this.$data.type){const e=this.unformatValue(a),s=this.formatValue(e);s!==a&&(t.value=s,a=s)}this.$data.value=a,this.$data.suggestions&&this.$data.suggestions.length>0&&this.updateSuggestions(a)}handleFocus(e){this.$data.focused=!0,this.$data.selectall&&this.$data.value&&this.select()}handleBlur(e){this.$data.focused=!1}handleChange(e){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}handleKeydown(e){"Enter"===e.key&&"search"===this.$data.type&&this.emit("search",{value:this.$data.value})}handleClear(){this.$data.value="",this.dispatchEvent(new Event("clear",{bubbles:!0,composed:!0})),this.focus()}togglePassword(){this.$data.passwordVisible=!this.$data.passwordVisible}async handleCopy(){try{const e=this.unformatValue(this.$data.value);await navigator.clipboard.writeText(e),this.emit("copy",{value:e})}catch(e){this.emit("copy-error",{error:e})}}updateSuggestions(e){this.searchDebounceTimer&&clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=setTimeout(()=>{this._updateSuggestionsImpl(e),this.searchDebounceTimer=void 0},300)}_updateSuggestionsImpl(e){if(!e||!this.$data.suggestions)return this._filteredSuggestions=[],void this.refresh();this._filteredSuggestions=this.$data.suggestions.filter(t=>t.toLowerCase().includes(e.toLowerCase())),this.refresh()}selectSuggestion(e){this.$data.value=e,this._filteredSuggestions=[],this.refresh(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}focus(){var e;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.focus(),this.$data.focused=!0}blur(){var e;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.blur(),this.$data.focused=!1}setValue(e){this.$data.value=e}getValue(){return this.unformatValue(this.$data.value)}get value(){return this.getValue()}set value(e){this.setValue(e)}select(){var e;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.select()}},exports.SolelyInput=((e,t)=>{for(var a,s=t,r=e.length-1;r>=0;r--)(a=e[r])&&(s=a(s)||s);return s})([i.CustomElement({tagName:"solely-input",template:s.__SOLELY_IR__,styles:a.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"text"},{name:"size",type:"string",default:"medium"},{name:"value",type:"string",default:""},{name:"placeholder",type:"string",default:""},{name:"disabled",type:"boolean",default:!1},{name:"readonly",type:"boolean",default:!1},{name:"required",type:"boolean",default:!1},{name:"maxlength",type:"number"},{name:"minlength",type:"number"},{name:"clearable",type:"boolean",default:!1},{name:"showpassword",type:"boolean",default:!1},{name:"passwordVisible",type:"boolean",default:!1},{name:"focused",type:"boolean",default:!1},{name:"prefix",type:"string",default:""},{name:"suffix",type:"string",default:""},{name:"status",type:"string",default:""},{name:"message",type:"string",default:""},{name:"showcount",type:"boolean",default:!1},{name:"rows",type:"number",default:3},{name:"autofocus",type:"boolean",default:!1},{name:"selectall",type:"boolean",default:!1},{name:"copyable",type:"boolean",default:!1},{name:"format",type:"string",default:"none"},{name:"suggestions",type:"array",default:[]},{name:"block",type:"boolean",default:!1}]})],exports.SolelyInput);
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,a,s)=>((t,a,s)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s)(t,"symbol"!=typeof a?a+"":a,s);import a from"./style.css.js";import{__SOLELY_IR__ as s}from"./index.html.js";import r from"../../../runtime/component/base-element.js";import{CustomElement as i}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let o=class extends r{constructor(){super(...arguments),t(this,"_filteredSuggestions",[]),t(this,"inputElement"),t(this,"searchDebounceTimer")}get filteredSuggestions(){return this._filteredSuggestions}mounted(){var e;this.refresh(),this.inputElement=null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"),this.$data.autofocus&&this.focus()}unmounted(){this.searchDebounceTimer&&(clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=void 0)}hasPrefixSlot(){return null!==this.querySelector('[slot="prefix"]')}hasSuffixSlot(){return null!==this.querySelector('[slot="suffix"]')}getWrapperClasses(){const e={};return"small"===this.$data.size?e["form-control--sm"]=!0:"large"===this.$data.size&&(e["form-control--lg"]=!0),"error"===this.$data.status?e["is-error"]=!0:"warning"===this.$data.status?e["is-warning"]=!0:"success"===this.$data.status&&(e["is-success"]=!0),"textarea"===this.$data.type&&(e["form-control--textarea"]=!0),e["is-focused"]=!!this.$data.focused,e["is-disabled"]=!!this.$data.disabled,e["is-readonly"]=!!this.$data.readonly,e["form-control--block"]=!!this.$data.block,e}getCharCount(){var e;return(null==(e=this.$data.value)?void 0:e.length)||0}formatValue(e){if(!e)return"";switch(this.$data.format){case"phone":return e.replace(/(\d{3})(\d{4})(\d{4})/,"$1 $2 $3").trim();case"bankcard":return e.replace(/(\d{4})(?=\d)/g,"$1 ").trim();case"idcard":return e.replace(/(\d{6})(\d{4})(\d{4})(\d{4})(\d{0,4})/,"$1 $2 $3 $4 $5").trim();default:return e}}unformatValue(e){return e?e.replace(/\s/g,""):""}handleInput(e){const t=e.target;let a=t.value;if("none"!==this.$data.format&&"textarea"!==this.$data.type){const e=this.unformatValue(a),s=this.formatValue(e);s!==a&&(t.value=s,a=s)}this.$data.value=a,this.$data.suggestions&&this.$data.suggestions.length>0&&this.updateSuggestions(a)}handleFocus(e){this.$data.focused=!0,this.$data.selectall&&this.$data.value&&this.select()}handleBlur(e){this.$data.focused=!1}handleChange(e){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}handleKeydown(e){"Enter"===e.key&&"search"===this.$data.type&&this.emit("search",{value:this.$data.value})}handleClear(){this.$data.value="",this.dispatchEvent(new Event("clear",{bubbles:!0,composed:!0})),this.focus()}togglePassword(){this.$data.passwordVisible=!this.$data.passwordVisible}async handleCopy(){try{const e=this.unformatValue(this.$data.value);await navigator.clipboard.writeText(e),this.emit("copy",{value:e})}catch(e){this.emit("copy-error",{error:e})}}updateSuggestions(e){this.searchDebounceTimer&&clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=setTimeout(()=>{this._updateSuggestionsImpl(e),this.searchDebounceTimer=void 0},300)}_updateSuggestionsImpl(e){if(!e||!this.$data.suggestions)return this._filteredSuggestions=[],void this.refresh();this._filteredSuggestions=this.$data.suggestions.filter(t=>t.toLowerCase().includes(e.toLowerCase())),this.refresh()}selectSuggestion(e){this.$data.value=e,this._filteredSuggestions=[],this.refresh(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}focus(){var e;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.focus(),this.$data.focused=!0}blur(){var e;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.blur(),this.$data.focused=!1}setValue(e){this.$data.value=e}getValue(){return this.unformatValue(this.$data.value)}get value(){return this.getValue()}set value(e){this.setValue(e)}select(){var e;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.select()}};o=((e,t)=>{for(var a,s=t,r=e.length-1;r>=0;r--)(a=e[r])&&(s=a(s)||s);return s})([i({tagName:"solely-input",template:s,styles:a,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"text"},{name:"size",type:"string",default:""},{name:"value",type:"string",default:""},{name:"placeholder",type:"string",default:""},{name:"disabled",type:"boolean",default:!1},{name:"readonly",type:"boolean",default:!1},{name:"required",type:"boolean",default:!1},{name:"maxlength",type:"number"},{name:"minlength",type:"number"},{name:"clearable",type:"boolean",default:!1},{name:"showpassword",type:"boolean",default:!1},{name:"passwordVisible",type:"boolean",default:!1},{name:"focused",type:"boolean",default:!1},{name:"prefix",type:"string",default:""},{name:"suffix",type:"string",default:""},{name:"status",type:"string",default:""},{name:"message",type:"string",default:""},{name:"showcount",type:"boolean",default:!1},{name:"rows",type:"number",default:3},{name:"autofocus",type:"boolean",default:!1},{name:"selectall",type:"boolean",default:!1},{name:"copyable",type:"boolean",default:!1},{name:"format",type:"string",default:"none"},{name:"suggestions",type:"array",default:[]},{name:"block",type:"boolean",default:!1}]})],o);export{o as SolelyInput};
1
+ var e=Object.defineProperty,t=(t,a,s)=>((t,a,s)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s)(t,"symbol"!=typeof a?a+"":a,s);import a from"./style.css.js";import{__SOLELY_IR__ as s}from"./index.html.js";import r from"../../../runtime/component/base-element.js";import{CustomElement as i}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let o=class extends r{constructor(){super(...arguments),t(this,"_filteredSuggestions",[]),t(this,"inputElement"),t(this,"searchDebounceTimer")}get filteredSuggestions(){return this._filteredSuggestions}mounted(){var e;this.refresh(),this.inputElement=null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"),this.$data.autofocus&&this.focus()}unmounted(){this.searchDebounceTimer&&(clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=void 0)}hasPrefixSlot(){return null!==this.querySelector('[slot="prefix"]')}hasSuffixSlot(){return null!==this.querySelector('[slot="suffix"]')}getWrapperClasses(){const e={};return"small"===this.$data.size?e["form-control--sm"]=!0:"large"===this.$data.size&&(e["form-control--lg"]=!0),"error"===this.$data.status?e["is-error"]=!0:"warning"===this.$data.status?e["is-warning"]=!0:"success"===this.$data.status&&(e["is-success"]=!0),"textarea"===this.$data.type&&(e["form-control--textarea"]=!0),e["is-focused"]=!!this.$data.focused,e["is-disabled"]=!!this.$data.disabled,e["is-readonly"]=!!this.$data.readonly,e["form-control--block"]=!!this.$data.block,e}getCharCount(){var e;return(null==(e=this.$data.value)?void 0:e.length)||0}formatValue(e){if(!e)return"";switch(this.$data.format){case"phone":return e.replace(/(\d{3})(\d{4})(\d{4})/,"$1 $2 $3").trim();case"bankcard":return e.replace(/(\d{4})(?=\d)/g,"$1 ").trim();case"idcard":return e.replace(/(\d{6})(\d{4})(\d{4})(\d{4})(\d{0,4})/,"$1 $2 $3 $4 $5").trim();default:return e}}unformatValue(e){return e?e.replace(/\s/g,""):""}handleInput(e){const t=e.target;let a=t.value;if("none"!==this.$data.format&&"textarea"!==this.$data.type){const e=this.unformatValue(a),s=this.formatValue(e);s!==a&&(t.value=s,a=s)}this.$data.value=a,this.$data.suggestions&&this.$data.suggestions.length>0&&this.updateSuggestions(a)}handleFocus(e){this.$data.focused=!0,this.$data.selectall&&this.$data.value&&this.select()}handleBlur(e){this.$data.focused=!1}handleChange(e){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}handleKeydown(e){"Enter"===e.key&&"search"===this.$data.type&&this.emit("search",{value:this.$data.value})}handleClear(){this.$data.value="",this.dispatchEvent(new Event("clear",{bubbles:!0,composed:!0})),this.focus()}togglePassword(){this.$data.passwordVisible=!this.$data.passwordVisible}async handleCopy(){try{const e=this.unformatValue(this.$data.value);await navigator.clipboard.writeText(e),this.emit("copy",{value:e})}catch(e){this.emit("copy-error",{error:e})}}updateSuggestions(e){this.searchDebounceTimer&&clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=setTimeout(()=>{this._updateSuggestionsImpl(e),this.searchDebounceTimer=void 0},300)}_updateSuggestionsImpl(e){if(!e||!this.$data.suggestions)return this._filteredSuggestions=[],void this.refresh();this._filteredSuggestions=this.$data.suggestions.filter(t=>t.toLowerCase().includes(e.toLowerCase())),this.refresh()}selectSuggestion(e){this.$data.value=e,this._filteredSuggestions=[],this.refresh(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}focus(){var e;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.focus(),this.$data.focused=!0}blur(){var e;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.blur(),this.$data.focused=!1}setValue(e){this.$data.value=e}getValue(){return this.unformatValue(this.$data.value)}get value(){return this.getValue()}set value(e){this.setValue(e)}select(){var e;const t=this.inputElement||(null==(e=this.shadowRoot)?void 0:e.querySelector("input, textarea"));null==t||t.select()}};o=((e,t)=>{for(var a,s=t,r=e.length-1;r>=0;r--)(a=e[r])&&(s=a(s)||s);return s})([i({tagName:"solely-input",template:s,styles:a,shadowDOM:{use:!0,mode:"open"},props:[{name:"type",type:"string",default:"text"},{name:"size",type:"string",default:"medium"},{name:"value",type:"string",default:""},{name:"placeholder",type:"string",default:""},{name:"disabled",type:"boolean",default:!1},{name:"readonly",type:"boolean",default:!1},{name:"required",type:"boolean",default:!1},{name:"maxlength",type:"number"},{name:"minlength",type:"number"},{name:"clearable",type:"boolean",default:!1},{name:"showpassword",type:"boolean",default:!1},{name:"passwordVisible",type:"boolean",default:!1},{name:"focused",type:"boolean",default:!1},{name:"prefix",type:"string",default:""},{name:"suffix",type:"string",default:""},{name:"status",type:"string",default:""},{name:"message",type:"string",default:""},{name:"showcount",type:"boolean",default:!1},{name:"rows",type:"number",default:3},{name:"autofocus",type:"boolean",default:!1},{name:"selectall",type:"boolean",default:!1},{name:"copyable",type:"boolean",default:!1},{name:"format",type:"string",default:"none"},{name:"suggestions",type:"array",default:[]},{name:"block",type:"boolean",default:!1}]})],o);export{o as SolelyInput};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),a=require("../utils/helpers.cjs"),s=require("../../../runtime/component/base-element.cjs"),i=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyPagination=class extends s.default{get current(){return this.$data.current}set current(e){this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:e,pageSize:this.$data.pageSize}}))}get pageSize(){return this.$data.pageSize}set pageSize(e){this.$data.pageSize=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:this.$data.current,pageSize:e}}))}getPaginationClasses(){const e={};return"small"===this.$data.size?e["pagination--sm"]=!0:"large"===this.$data.size?e["pagination--lg"]=!0:e["pagination--md"]=!0,e["is-disabled"]=!!this.$data.disabled,e}getPrevClasses(){return{"pagination__item--disabled":(this.$data.current||1)<=1}}getNextClasses(){return{"pagination__item--disabled":(this.$data.current||1)>=this.totalPages}}getItemClasses(e){return{"pagination__item--active":e===this.$data.current}}mounted(){this.refresh(),this.$data.jumperValue="",this.parsePageSizeOptions()}parsePageSizeOptions(){this.$data.parsedPageSizeOptions=a.safeJsonParse(this.$data.pageSizeOptions,[10,20,50,100])}get totalPages(){return Math.ceil((this.$data.total||0)/(this.$data.pageSize||10))}calculateVisiblePages(){const e=this.$data.current||1,t=this.totalPages,a=[];if(t<=7)for(let s=1;s<=t;s++)a.push(s);else e<=3?a.push(1,2,3,4,5,"...",t):e>=t-2?a.push(1,"...",t-4,t-3,t-2,t-1,t):a.push(1,"...",e-1,e,e+1,"...",t);return a}handlePageClick(e){this.$data.disabled||e===this.$data.current||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:e,pageSize:this.$data.pageSize}})))}handlePrev(){this.$data.disabled||this.$data.current<=1||this.handlePageClick(this.$data.current-1)}handleNext(){this.$data.disabled||this.$data.current>=this.totalPages||this.handlePageClick(this.$data.current+1)}handleSizeChange(e){if(this.$data.disabled)return;const t=e.target,a=parseInt(t.value,10);this.$data.pageSize=a,this.$data.current=1;const s={current:1,pageSize:a};this.emit("sizeChange",s),this.emit("showSizeChange",s)}handleJumperKeydown(e){if("Enter"!==e.key)return;const t=e.target,a=parseInt(t.value,10);a>=1&&a<=this.totalPages&&this.handlePageClick(a),this.$data.jumperValue=""}handleJumperStep(e){if(this.$data.disabled)return;const t=this.$data.current+e;t>=1&&t<=this.totalPages&&(this.handlePageClick(t),this.$data.jumperValue=String(t))}setCurrent(e){this.$data.current=e}getCurrent(){return this.$data.current}},exports.SolelyPagination=((e,t)=>{for(var a,s=t,i=e.length-1;i>=0;i--)(a=e[i])&&(s=a(s)||s);return s})([i.CustomElement({tagName:"solely-pagination",template:t.__SOLELY_IR__,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"current",type:"number",default:1},{name:"total",type:"number",default:0},{name:"pageSize",type:"number",default:10},{name:"size",type:"string",default:"default"},{name:"simple",type:"boolean",default:!1},{name:"showQuickJumper",type:"boolean",default:!1},{name:"showSizeChanger",type:"boolean",default:!1},{name:"pageSizeOptions",type:"string",default:"[10, 20, 50, 100]"},{name:"disabled",type:"boolean",default:!1},{name:"showTotal",type:"boolean",default:!1}]})],exports.SolelyPagination);
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),a=require("../utils/helpers.cjs"),s=require("../../../runtime/component/base-element.cjs"),i=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyPagination=class extends s.default{get current(){return this.$data.current}set current(e){this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:e,pageSize:this.$data.pageSize}}))}get pageSize(){return this.$data.pageSize}set pageSize(e){this.$data.pageSize=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:this.$data.current,pageSize:e}}))}getPaginationClasses(){const e={};return"small"===this.$data.size?e["pagination--sm"]=!0:"large"===this.$data.size?e["pagination--lg"]=!0:e["pagination--md"]=!0,e["is-disabled"]=!!this.$data.disabled,e}getPrevClasses(){return{"pagination__item--disabled":(this.$data.current||1)<=1}}getNextClasses(){return{"pagination__item--disabled":(this.$data.current||1)>=this.totalPages}}getItemClasses(e){return{"pagination__item--active":e===this.$data.current}}mounted(){this.refresh(),this.$data.jumperValue="",this.parsePageSizeOptions()}parsePageSizeOptions(){this.$data.parsedPageSizeOptions=a.safeJsonParse(this.$data.pageSizeOptions,[10,20,50,100])}get totalPages(){return Math.ceil((this.$data.total||0)/(this.$data.pageSize||10))}calculateVisiblePages(){const e=this.$data.current||1,t=this.totalPages,a=[];if(t<=7)for(let s=1;s<=t;s++)a.push(s);else e<=3?a.push(1,2,3,4,5,"...",t):e>=t-2?a.push(1,"...",t-4,t-3,t-2,t-1,t):a.push(1,"...",e-1,e,e+1,"...",t);return a}handlePageClick(e){this.$data.disabled||e===this.$data.current||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:e,pageSize:this.$data.pageSize}})))}handlePrev(){this.$data.disabled||this.$data.current<=1||this.handlePageClick(this.$data.current-1)}handleNext(){this.$data.disabled||this.$data.current>=this.totalPages||this.handlePageClick(this.$data.current+1)}handleSizeChange(e){if(this.$data.disabled)return;const t=e.target,a=parseInt(t.value,10);this.$data.pageSize=a,this.$data.current=1;const s={current:1,pageSize:a};this.emit("size-change",s),this.emit("show-size-change",s)}handleJumperKeydown(e){if("Enter"!==e.key)return;const t=e.target,a=parseInt(t.value,10);a>=1&&a<=this.totalPages&&this.handlePageClick(a),this.$data.jumperValue=""}handleJumperStep(e){if(this.$data.disabled)return;const t=this.$data.current+e;t>=1&&t<=this.totalPages&&(this.handlePageClick(t),this.$data.jumperValue=String(t))}setCurrent(e){this.$data.current=e}getCurrent(){return this.$data.current}},exports.SolelyPagination=((e,t)=>{for(var a,s=t,i=e.length-1;i>=0;i--)(a=e[i])&&(s=a(s)||s);return s})([i.CustomElement({tagName:"solely-pagination",template:t.__SOLELY_IR__,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"current",type:"number",default:1},{name:"total",type:"number",default:0},{name:"pageSize",type:"number",default:10},{name:"size",type:"string",default:"medium"},{name:"simple",type:"boolean",default:!1},{name:"showQuickJumper",type:"boolean",default:!1},{name:"showSizeChanger",type:"boolean",default:!1},{name:"pageSizeOptions",type:"string",default:"[10, 20, 50, 100]"},{name:"disabled",type:"boolean",default:!1},{name:"showTotal",type:"boolean",default:!1}]})],exports.SolelyPagination);
@@ -1 +1 @@
1
- import e from"./style.css.js";import{__SOLELY_IR__ as t}from"./index.html.js";import{safeJsonParse as a}from"../utils/helpers.js";import s from"../../../runtime/component/base-element.js";import{CustomElement as i}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let n=class extends s{get current(){return this.$data.current}set current(e){this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:e,pageSize:this.$data.pageSize}}))}get pageSize(){return this.$data.pageSize}set pageSize(e){this.$data.pageSize=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:this.$data.current,pageSize:e}}))}getPaginationClasses(){const e={};return"small"===this.$data.size?e["pagination--sm"]=!0:"large"===this.$data.size?e["pagination--lg"]=!0:e["pagination--md"]=!0,e["is-disabled"]=!!this.$data.disabled,e}getPrevClasses(){return{"pagination__item--disabled":(this.$data.current||1)<=1}}getNextClasses(){return{"pagination__item--disabled":(this.$data.current||1)>=this.totalPages}}getItemClasses(e){return{"pagination__item--active":e===this.$data.current}}mounted(){this.refresh(),this.$data.jumperValue="",this.parsePageSizeOptions()}parsePageSizeOptions(){this.$data.parsedPageSizeOptions=a(this.$data.pageSizeOptions,[10,20,50,100])}get totalPages(){return Math.ceil((this.$data.total||0)/(this.$data.pageSize||10))}calculateVisiblePages(){const e=this.$data.current||1,t=this.totalPages,a=[];if(t<=7)for(let s=1;s<=t;s++)a.push(s);else e<=3?a.push(1,2,3,4,5,"...",t):e>=t-2?a.push(1,"...",t-4,t-3,t-2,t-1,t):a.push(1,"...",e-1,e,e+1,"...",t);return a}handlePageClick(e){this.$data.disabled||e===this.$data.current||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:e,pageSize:this.$data.pageSize}})))}handlePrev(){this.$data.disabled||this.$data.current<=1||this.handlePageClick(this.$data.current-1)}handleNext(){this.$data.disabled||this.$data.current>=this.totalPages||this.handlePageClick(this.$data.current+1)}handleSizeChange(e){if(this.$data.disabled)return;const t=e.target,a=parseInt(t.value,10);this.$data.pageSize=a,this.$data.current=1;const s={current:1,pageSize:a};this.emit("sizeChange",s),this.emit("showSizeChange",s)}handleJumperKeydown(e){if("Enter"!==e.key)return;const t=e.target,a=parseInt(t.value,10);a>=1&&a<=this.totalPages&&this.handlePageClick(a),this.$data.jumperValue=""}handleJumperStep(e){if(this.$data.disabled)return;const t=this.$data.current+e;t>=1&&t<=this.totalPages&&(this.handlePageClick(t),this.$data.jumperValue=String(t))}setCurrent(e){this.$data.current=e}getCurrent(){return this.$data.current}};n=((e,t)=>{for(var a,s=t,i=e.length-1;i>=0;i--)(a=e[i])&&(s=a(s)||s);return s})([i({tagName:"solely-pagination",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"current",type:"number",default:1},{name:"total",type:"number",default:0},{name:"pageSize",type:"number",default:10},{name:"size",type:"string",default:"default"},{name:"simple",type:"boolean",default:!1},{name:"showQuickJumper",type:"boolean",default:!1},{name:"showSizeChanger",type:"boolean",default:!1},{name:"pageSizeOptions",type:"string",default:"[10, 20, 50, 100]"},{name:"disabled",type:"boolean",default:!1},{name:"showTotal",type:"boolean",default:!1}]})],n);export{n as SolelyPagination};
1
+ import e from"./style.css.js";import{__SOLELY_IR__ as t}from"./index.html.js";import{safeJsonParse as a}from"../utils/helpers.js";import s from"../../../runtime/component/base-element.js";import{CustomElement as i}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let n=class extends s{get current(){return this.$data.current}set current(e){this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:e,pageSize:this.$data.pageSize}}))}get pageSize(){return this.$data.pageSize}set pageSize(e){this.$data.pageSize=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:this.$data.current,pageSize:e}}))}getPaginationClasses(){const e={};return"small"===this.$data.size?e["pagination--sm"]=!0:"large"===this.$data.size?e["pagination--lg"]=!0:e["pagination--md"]=!0,e["is-disabled"]=!!this.$data.disabled,e}getPrevClasses(){return{"pagination__item--disabled":(this.$data.current||1)<=1}}getNextClasses(){return{"pagination__item--disabled":(this.$data.current||1)>=this.totalPages}}getItemClasses(e){return{"pagination__item--active":e===this.$data.current}}mounted(){this.refresh(),this.$data.jumperValue="",this.parsePageSizeOptions()}parsePageSizeOptions(){this.$data.parsedPageSizeOptions=a(this.$data.pageSizeOptions,[10,20,50,100])}get totalPages(){return Math.ceil((this.$data.total||0)/(this.$data.pageSize||10))}calculateVisiblePages(){const e=this.$data.current||1,t=this.totalPages,a=[];if(t<=7)for(let s=1;s<=t;s++)a.push(s);else e<=3?a.push(1,2,3,4,5,"...",t):e>=t-2?a.push(1,"...",t-4,t-3,t-2,t-1,t):a.push(1,"...",e-1,e,e+1,"...",t);return a}handlePageClick(e){this.$data.disabled||e===this.$data.current||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:e,pageSize:this.$data.pageSize}})))}handlePrev(){this.$data.disabled||this.$data.current<=1||this.handlePageClick(this.$data.current-1)}handleNext(){this.$data.disabled||this.$data.current>=this.totalPages||this.handlePageClick(this.$data.current+1)}handleSizeChange(e){if(this.$data.disabled)return;const t=e.target,a=parseInt(t.value,10);this.$data.pageSize=a,this.$data.current=1;const s={current:1,pageSize:a};this.emit("size-change",s),this.emit("show-size-change",s)}handleJumperKeydown(e){if("Enter"!==e.key)return;const t=e.target,a=parseInt(t.value,10);a>=1&&a<=this.totalPages&&this.handlePageClick(a),this.$data.jumperValue=""}handleJumperStep(e){if(this.$data.disabled)return;const t=this.$data.current+e;t>=1&&t<=this.totalPages&&(this.handlePageClick(t),this.$data.jumperValue=String(t))}setCurrent(e){this.$data.current=e}getCurrent(){return this.$data.current}};n=((e,t)=>{for(var a,s=t,i=e.length-1;i>=0;i--)(a=e[i])&&(s=a(s)||s);return s})([i({tagName:"solely-pagination",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"current",type:"number",default:1},{name:"total",type:"number",default:0},{name:"pageSize",type:"number",default:10},{name:"size",type:"string",default:"medium"},{name:"simple",type:"boolean",default:!1},{name:"showQuickJumper",type:"boolean",default:!1},{name:"showSizeChanger",type:"boolean",default:!1},{name:"pageSizeOptions",type:"string",default:"[10, 20, 50, 100]"},{name:"disabled",type:"boolean",default:!1},{name:"showTotal",type:"boolean",default:!1}]})],n);export{n as SolelyPagination};
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Pagination 组件类型定义
3
3
  */
4
- export type PaginationSize = 'small' | 'default' | 'large';
4
+ export type PaginationSize = 'small' | 'medium' | 'large';
5
5
  export interface PaginationProps {
6
6
  /** 当前页码 */
7
7
  current: number;
@@ -1 +1 @@
1
- "use strict";var t=Object.defineProperty,e=(e,s,r)=>((e,s,r)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r)(e,"symbol"!=typeof s?s+"":s,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./style.css.cjs"),r=require("./index.html.cjs"),i=require("../utils/helpers.cjs"),o=require("../../../runtime/component/base-element.cjs"),a=require("../../../runtime/component/decorators.cjs");var n,l,d,c=Object.defineProperty;Object.getOwnPropertyDescriptor;exports.SolelySteps=class extends o.default{constructor(){super(...arguments),e(this,"slotObserver"),e(this,"slotInitTimer")}get current(){return this.$data.current}set current(t){this.$data.current=t,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:t}}))}getStepsClasses(){const t={};return this.$data.direction&&(t[`steps--${this.$data.direction}`]=!0),t["steps--dot"]=!!this.$data.progressDot,"small"===this.$data.size?t["steps--sm"]=!0:"large"===this.$data.size&&(t["steps--lg"]=!0),t["use-slot"]=this.$data.useSlot,t}getStepClasses(t,e){const s=this.getStepStatus(e);return{"step--wait":"wait"===s,"step--process":"process"===s,"step--finish":"finish"===s,"step--error":"error"===s,"step--disabled":!!t.disabled}}getSlotStepClasses(t,e){const s=this.getSlotStepStatus(e);return{"step--wait":"wait"===s,"step--process":"process"===s,"step--finish":"finish"===s,"step--error":"error"===s,"step--disabled":!!t.disabled}}getIconClasses(t){const e={};return t.icon&&t.color&&exports.SolelySteps.PRESET_COLORS.includes(t.color)&&(e[`step__icon-wrapper--${t.color}`]=!0),e}getIconStyle(t){return t.icon&&t.color?exports.SolelySteps.PRESET_COLORS.includes(t.color)?"":`color: ${t.color}; background-color: ${t.color}15;`:""}collectSlotItems(){const t=Array.from(this.children).filter(t=>t.hasAttribute("data-step"));0!==t.length?(this.$data.useSlot=!0,this.$data.slotItems=t.map((t,e)=>{var s;const r=t;return{step:r.getAttribute("data-step")||String(e+1),title:r.getAttribute("data-title")||(null==(s=r.textContent)?void 0:s.trim())||"",description:r.getAttribute("data-description")||void 0,disabled:r.hasAttribute("disabled"),iconHtml:r.innerHTML}})):this.$data.useSlot=!1}mounted(){this.refresh(),this.setupSlotObserver()}getParsedItems(){const t=this.$data.items;return Array.isArray(t)?t:"string"==typeof t&&t?i.safeJsonParse(t,[]):[]}setupSlotObserver(){this.slotInitTimer=setTimeout(()=>{this.collectSlotItems(),this.slotInitTimer=void 0},0),this.slotObserver=new MutationObserver(()=>{this.collectSlotItems()}),this.slotObserver.observe(this,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["data-step","data-title","data-description","disabled"]})}unmounted(){this.slotObserver&&this.slotObserver.disconnect(),this.slotInitTimer&&(clearTimeout(this.slotInitTimer),this.slotInitTimer=void 0)}getStepStatus(t){const e=this.$data.current||0,s=this.getParsedItems();if(!Array.isArray(s)||t<0||t>=s.length)return"wait";const r=s[t];return(null==r?void 0:r.status)?r.status:t<e?"finish":t===e?"process":"wait"}getSlotStepStatus(t){const e=this.$data.current||0;return t<e?"finish":t===e?"process":"wait"}getStepIcon(t,e){if(t.icon)return t.icon;const s=this.getStepStatus(e);return"finish"===s?"✓":"error"===s?"✕":String(e+1)}handleStepClick(t,e){t.disabled||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:e,item:t}})))}handleSlotStepClick(t,e){t.disabled||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:e,item:t}})))}setCurrent(t){this.$data.current=t}getCurrent(){return this.$data.current}next(){const t=this.$data.useSlot?this.$data.slotItems.length-1:this.getParsedItems().length-1;this.$data.current<t&&this.$data.current++}prev(){this.$data.current>0&&this.$data.current--}setItems(t){this.$data.items=JSON.stringify(t),this.$data.useSlot=!1,this.refresh()}},n=exports.SolelySteps,d=["blue","green","red","orange","gray"],(l="PRESET_COLORS")in n?c(n,l,{enumerable:!0,configurable:!0,writable:!0,value:d}):n[l]=d,exports.SolelySteps=((t,e)=>{for(var s,r=e,i=t.length-1;i>=0;i--)(s=t[i])&&(r=s(r)||r);return r})([a.CustomElement({tagName:"solely-steps",template:r.__SOLELY_IR__,styles:s.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"current",type:"number",default:0},{name:"direction",type:"string",default:"horizontal"},{name:"size",type:"string",default:"default"},{name:"items",type:"string",default:"[]"},{name:"progressDot",type:"boolean",default:!1}]})],exports.SolelySteps);
1
+ "use strict";var t=Object.defineProperty,e=(e,s,r)=>((e,s,r)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r)(e,"symbol"!=typeof s?s+"":s,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./style.css.cjs"),r=require("./index.html.cjs"),i=require("../utils/helpers.cjs"),o=require("../../../runtime/component/base-element.cjs"),a=require("../../../runtime/component/decorators.cjs");var n,l,d,c=Object.defineProperty;Object.getOwnPropertyDescriptor;exports.SolelySteps=class extends o.default{constructor(){super(...arguments),e(this,"slotObserver"),e(this,"slotInitTimer")}get current(){return this.$data.current}set current(t){this.$data.current=t,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:t}}))}getStepsClasses(){const t={};return this.$data.direction&&(t[`steps--${this.$data.direction}`]=!0),t["steps--dot"]=!!this.$data.progressDot,"small"===this.$data.size?t["steps--sm"]=!0:"large"===this.$data.size?t["steps--lg"]=!0:t["steps--md"]=!0,t["use-slot"]=this.$data.useSlot,t}getStepClasses(t,e){const s=this.getStepStatus(e);return{"step--wait":"wait"===s,"step--process":"process"===s,"step--finish":"finish"===s,"step--error":"error"===s,"step--disabled":!!t.disabled}}getSlotStepClasses(t,e){const s=this.getSlotStepStatus(e);return{"step--wait":"wait"===s,"step--process":"process"===s,"step--finish":"finish"===s,"step--error":"error"===s,"step--disabled":!!t.disabled}}getIconClasses(t){const e={};return t.icon&&t.color&&exports.SolelySteps.PRESET_COLORS.includes(t.color)&&(e[`step__icon-wrapper--${t.color}`]=!0),e}getIconStyle(t){return t.icon&&t.color?exports.SolelySteps.PRESET_COLORS.includes(t.color)?"":`color: ${t.color}; background-color: ${t.color}15;`:""}collectSlotItems(){const t=Array.from(this.children).filter(t=>t.hasAttribute("data-step"));0!==t.length?(this.$data.useSlot=!0,this.$data.slotItems=t.map((t,e)=>{var s;const r=t;return{step:r.getAttribute("data-step")||String(e+1),title:r.getAttribute("data-title")||(null==(s=r.textContent)?void 0:s.trim())||"",description:r.getAttribute("data-description")||void 0,disabled:r.hasAttribute("disabled"),iconHtml:r.innerHTML}})):this.$data.useSlot=!1}mounted(){this.refresh(),this.setupSlotObserver()}getParsedItems(){const t=this.$data.items;return Array.isArray(t)?t:"string"==typeof t&&t?i.safeJsonParse(t,[]):[]}setupSlotObserver(){this.slotInitTimer=setTimeout(()=>{this.collectSlotItems(),this.slotInitTimer=void 0},0),this.slotObserver=new MutationObserver(()=>{this.collectSlotItems()}),this.slotObserver.observe(this,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["data-step","data-title","data-description","disabled"]})}unmounted(){this.slotObserver&&this.slotObserver.disconnect(),this.slotInitTimer&&(clearTimeout(this.slotInitTimer),this.slotInitTimer=void 0)}getStepStatus(t){const e=this.$data.current||0,s=this.getParsedItems();if(!Array.isArray(s)||t<0||t>=s.length)return"wait";const r=s[t];return(null==r?void 0:r.status)?r.status:t<e?"finish":t===e?"process":"wait"}getSlotStepStatus(t){const e=this.$data.current||0;return t<e?"finish":t===e?"process":"wait"}getStepIcon(t,e){if(t.icon)return t.icon;const s=this.getStepStatus(e);return"finish"===s?"✓":"error"===s?"✕":String(e+1)}handleStepClick(t,e){t.disabled||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:e,item:t}})))}handleSlotStepClick(t,e){t.disabled||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:e,item:t}})))}setCurrent(t){this.$data.current=t}getCurrent(){return this.$data.current}next(){const t=this.$data.useSlot?this.$data.slotItems.length-1:this.getParsedItems().length-1;this.$data.current<t&&this.$data.current++}prev(){this.$data.current>0&&this.$data.current--}setItems(t){this.$data.items=JSON.stringify(t),this.$data.useSlot=!1,this.refresh()}},n=exports.SolelySteps,d=["blue","green","red","orange","gray"],(l="PRESET_COLORS")in n?c(n,l,{enumerable:!0,configurable:!0,writable:!0,value:d}):n[l]=d,exports.SolelySteps=((t,e)=>{for(var s,r=e,i=t.length-1;i>=0;i--)(s=t[i])&&(r=s(r)||r);return r})([a.CustomElement({tagName:"solely-steps",template:r.__SOLELY_IR__,styles:s.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"current",type:"number",default:0},{name:"direction",type:"string",default:"horizontal"},{name:"size",type:"string",default:"medium"},{name:"items",type:"string",default:"[]"},{name:"progressDot",type:"boolean",default:!1}]})],exports.SolelySteps);
@@ -1 +1 @@
1
- var t=Object.defineProperty,e=(e,s,r)=>((e,s,r)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r)(e,"symbol"!=typeof s?s+"":s,r);import s from"./style.css.js";import{__SOLELY_IR__ as r}from"./index.html.js";import{safeJsonParse as i}from"../utils/helpers.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as o}from"../../../runtime/component/decorators.js";var n=Object.defineProperty;Object.getOwnPropertyDescriptor;let l=class extends a{constructor(){super(...arguments),e(this,"slotObserver"),e(this,"slotInitTimer")}get current(){return this.$data.current}set current(t){this.$data.current=t,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:t}}))}getStepsClasses(){const t={};return this.$data.direction&&(t[`steps--${this.$data.direction}`]=!0),t["steps--dot"]=!!this.$data.progressDot,"small"===this.$data.size?t["steps--sm"]=!0:"large"===this.$data.size&&(t["steps--lg"]=!0),t["use-slot"]=this.$data.useSlot,t}getStepClasses(t,e){const s=this.getStepStatus(e);return{"step--wait":"wait"===s,"step--process":"process"===s,"step--finish":"finish"===s,"step--error":"error"===s,"step--disabled":!!t.disabled}}getSlotStepClasses(t,e){const s=this.getSlotStepStatus(e);return{"step--wait":"wait"===s,"step--process":"process"===s,"step--finish":"finish"===s,"step--error":"error"===s,"step--disabled":!!t.disabled}}getIconClasses(t){const e={};return t.icon&&t.color&&l.PRESET_COLORS.includes(t.color)&&(e[`step__icon-wrapper--${t.color}`]=!0),e}getIconStyle(t){return t.icon&&t.color?l.PRESET_COLORS.includes(t.color)?"":`color: ${t.color}; background-color: ${t.color}15;`:""}collectSlotItems(){const t=Array.from(this.children).filter(t=>t.hasAttribute("data-step"));0!==t.length?(this.$data.useSlot=!0,this.$data.slotItems=t.map((t,e)=>{var s;const r=t;return{step:r.getAttribute("data-step")||String(e+1),title:r.getAttribute("data-title")||(null==(s=r.textContent)?void 0:s.trim())||"",description:r.getAttribute("data-description")||void 0,disabled:r.hasAttribute("disabled"),iconHtml:r.innerHTML}})):this.$data.useSlot=!1}mounted(){this.refresh(),this.setupSlotObserver()}getParsedItems(){const t=this.$data.items;return Array.isArray(t)?t:"string"==typeof t&&t?i(t,[]):[]}setupSlotObserver(){this.slotInitTimer=setTimeout(()=>{this.collectSlotItems(),this.slotInitTimer=void 0},0),this.slotObserver=new MutationObserver(()=>{this.collectSlotItems()}),this.slotObserver.observe(this,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["data-step","data-title","data-description","disabled"]})}unmounted(){this.slotObserver&&this.slotObserver.disconnect(),this.slotInitTimer&&(clearTimeout(this.slotInitTimer),this.slotInitTimer=void 0)}getStepStatus(t){const e=this.$data.current||0,s=this.getParsedItems();if(!Array.isArray(s)||t<0||t>=s.length)return"wait";const r=s[t];return(null==r?void 0:r.status)?r.status:t<e?"finish":t===e?"process":"wait"}getSlotStepStatus(t){const e=this.$data.current||0;return t<e?"finish":t===e?"process":"wait"}getStepIcon(t,e){if(t.icon)return t.icon;const s=this.getStepStatus(e);return"finish"===s?"✓":"error"===s?"✕":String(e+1)}handleStepClick(t,e){t.disabled||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:e,item:t}})))}handleSlotStepClick(t,e){t.disabled||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:e,item:t}})))}setCurrent(t){this.$data.current=t}getCurrent(){return this.$data.current}next(){const t=this.$data.useSlot?this.$data.slotItems.length-1:this.getParsedItems().length-1;this.$data.current<t&&this.$data.current++}prev(){this.$data.current>0&&this.$data.current--}setItems(t){this.$data.items=JSON.stringify(t),this.$data.useSlot=!1,this.refresh()}};var d,c,u;u=["blue","green","red","orange","gray"],(c="PRESET_COLORS")in(d=l)?n(d,c,{enumerable:!0,configurable:!0,writable:!0,value:u}):d[c]=u,l=((t,e)=>{for(var s,r=e,i=t.length-1;i>=0;i--)(s=t[i])&&(r=s(r)||r);return r})([o({tagName:"solely-steps",template:r,styles:s,shadowDOM:{use:!0,mode:"open"},props:[{name:"current",type:"number",default:0},{name:"direction",type:"string",default:"horizontal"},{name:"size",type:"string",default:"default"},{name:"items",type:"string",default:"[]"},{name:"progressDot",type:"boolean",default:!1}]})],l);export{l as SolelySteps};
1
+ var t=Object.defineProperty,e=(e,s,r)=>((e,s,r)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r)(e,"symbol"!=typeof s?s+"":s,r);import s from"./style.css.js";import{__SOLELY_IR__ as r}from"./index.html.js";import{safeJsonParse as i}from"../utils/helpers.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as o}from"../../../runtime/component/decorators.js";var n=Object.defineProperty;Object.getOwnPropertyDescriptor;let l=class extends a{constructor(){super(...arguments),e(this,"slotObserver"),e(this,"slotInitTimer")}get current(){return this.$data.current}set current(t){this.$data.current=t,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{current:t}}))}getStepsClasses(){const t={};return this.$data.direction&&(t[`steps--${this.$data.direction}`]=!0),t["steps--dot"]=!!this.$data.progressDot,"small"===this.$data.size?t["steps--sm"]=!0:"large"===this.$data.size?t["steps--lg"]=!0:t["steps--md"]=!0,t["use-slot"]=this.$data.useSlot,t}getStepClasses(t,e){const s=this.getStepStatus(e);return{"step--wait":"wait"===s,"step--process":"process"===s,"step--finish":"finish"===s,"step--error":"error"===s,"step--disabled":!!t.disabled}}getSlotStepClasses(t,e){const s=this.getSlotStepStatus(e);return{"step--wait":"wait"===s,"step--process":"process"===s,"step--finish":"finish"===s,"step--error":"error"===s,"step--disabled":!!t.disabled}}getIconClasses(t){const e={};return t.icon&&t.color&&l.PRESET_COLORS.includes(t.color)&&(e[`step__icon-wrapper--${t.color}`]=!0),e}getIconStyle(t){return t.icon&&t.color?l.PRESET_COLORS.includes(t.color)?"":`color: ${t.color}; background-color: ${t.color}15;`:""}collectSlotItems(){const t=Array.from(this.children).filter(t=>t.hasAttribute("data-step"));0!==t.length?(this.$data.useSlot=!0,this.$data.slotItems=t.map((t,e)=>{var s;const r=t;return{step:r.getAttribute("data-step")||String(e+1),title:r.getAttribute("data-title")||(null==(s=r.textContent)?void 0:s.trim())||"",description:r.getAttribute("data-description")||void 0,disabled:r.hasAttribute("disabled"),iconHtml:r.innerHTML}})):this.$data.useSlot=!1}mounted(){this.refresh(),this.setupSlotObserver()}getParsedItems(){const t=this.$data.items;return Array.isArray(t)?t:"string"==typeof t&&t?i(t,[]):[]}setupSlotObserver(){this.slotInitTimer=setTimeout(()=>{this.collectSlotItems(),this.slotInitTimer=void 0},0),this.slotObserver=new MutationObserver(()=>{this.collectSlotItems()}),this.slotObserver.observe(this,{childList:!0,subtree:!1,attributes:!0,attributeFilter:["data-step","data-title","data-description","disabled"]})}unmounted(){this.slotObserver&&this.slotObserver.disconnect(),this.slotInitTimer&&(clearTimeout(this.slotInitTimer),this.slotInitTimer=void 0)}getStepStatus(t){const e=this.$data.current||0,s=this.getParsedItems();if(!Array.isArray(s)||t<0||t>=s.length)return"wait";const r=s[t];return(null==r?void 0:r.status)?r.status:t<e?"finish":t===e?"process":"wait"}getSlotStepStatus(t){const e=this.$data.current||0;return t<e?"finish":t===e?"process":"wait"}getStepIcon(t,e){if(t.icon)return t.icon;const s=this.getStepStatus(e);return"finish"===s?"✓":"error"===s?"✕":String(e+1)}handleStepClick(t,e){t.disabled||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:e,item:t}})))}handleSlotStepClick(t,e){t.disabled||(this.$data.current=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{index:e,item:t}})))}setCurrent(t){this.$data.current=t}getCurrent(){return this.$data.current}next(){const t=this.$data.useSlot?this.$data.slotItems.length-1:this.getParsedItems().length-1;this.$data.current<t&&this.$data.current++}prev(){this.$data.current>0&&this.$data.current--}setItems(t){this.$data.items=JSON.stringify(t),this.$data.useSlot=!1,this.refresh()}};var d,c,u;u=["blue","green","red","orange","gray"],(c="PRESET_COLORS")in(d=l)?n(d,c,{enumerable:!0,configurable:!0,writable:!0,value:u}):d[c]=u,l=((t,e)=>{for(var s,r=e,i=t.length-1;i>=0;i--)(s=t[i])&&(r=s(r)||r);return r})([o({tagName:"solely-steps",template:r,styles:s,shadowDOM:{use:!0,mode:"open"},props:[{name:"current",type:"number",default:0},{name:"direction",type:"string",default:"horizontal"},{name:"size",type:"string",default:"medium"},{name:"items",type:"string",default:"[]"},{name:"progressDot",type:"boolean",default:!1}]})],l);export{l as SolelySteps};
@@ -1,5 +1,5 @@
1
1
  export type StepsDirection = 'horizontal' | 'vertical';
2
- export type StepsSize = 'default' | 'small' | 'large';
2
+ export type StepsSize = 'small' | 'medium' | 'large';
3
3
  export type StepStatus = 'wait' | 'process' | 'finish' | 'error';
4
4
  export interface StepItem {
5
5
  title: string;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),a=require("../utils/helpers.cjs"),s=require("../../../runtime/component/base-element.cjs"),r=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyTable=class extends s.default{getTableClasses(){const e={};return"small"===this.$data.size?e["table--sm"]=!0:"large"===this.$data.size?e["table--lg"]=!0:e["table--md"]=!0,e["table--bordered"]=!!this.$data.bordered,e["is-loading"]=!!this.$data.loading,e["table--striped"]=!!this.$data.striped,e["table--clickable"]=!!this.$data.rowClickable,e}getParsedColumns(){const e=this.$data.columns;return Array.isArray(e)?e:"string"==typeof e&&e?a.safeJsonParse(e,[]):[]}getParsedDataSource(){const e=this.$data.dataSource;return Array.isArray(e)?e:"string"==typeof e&&e?a.safeJsonParse(e,[]):[]}getThClasses(e){const t={};return"left"===e.fixed&&(t["fixed-left"]=!0),"right"===e.fixed&&(t["fixed-right"]=!0),t[`align-${e.align||"left"}`]=!0,t}getTdClasses(e){const t={};return"left"===e.fixed&&(t["fixed-left"]=!0),"right"===e.fixed&&(t["fixed-right"]=!0),t[`align-${e.align||"left"}`]=!0,t}mounted(){this.refresh()}getCellValue(e,t){return e[t.dataIndex]}handleRowClick(e,t){this.$data.rowClickable&&(this.emit("row-click",{row:e,index:t}),this.dispatchEvent(new Event("click",{bubbles:!0,composed:!0})))}setColumns(e){this.$data.columns=JSON.stringify(e)}setDataSource(e){this.$data.dataSource=JSON.stringify(e)}getDataSource(){return this.getParsedDataSource()}},exports.SolelyTable=((e,t)=>{for(var a,s=t,r=e.length-1;r>=0;r--)(a=e[r])&&(s=a(s)||s);return s})([r.CustomElement({tagName:"solely-table",template:t.__SOLELY_IR__,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"columns",type:"string"},{name:"dataSource",type:"string"},{name:"size",type:"string"},{name:"bordered",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"striped",type:"boolean",default:!1},{name:"rowClickable",type:"boolean",default:!1},{name:"rowKey",type:"string"}]})],exports.SolelyTable);
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),a=require("../utils/helpers.cjs"),s=require("../../../runtime/component/base-element.cjs"),r=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyTable=class extends s.default{getTableClasses(){const e={};return"small"===this.$data.size?e["table--sm"]=!0:"large"===this.$data.size?e["table--lg"]=!0:e["table--md"]=!0,e["table--bordered"]=!!this.$data.bordered,e["is-loading"]=!!this.$data.loading,e["table--striped"]=!!this.$data.striped,e["table--clickable"]=!!this.$data.rowClickable,e}getParsedColumns(){const e=this.$data.columns;return Array.isArray(e)?e:"string"==typeof e&&e?a.safeJsonParse(e,[]):[]}getParsedDataSource(){const e=this.$data.dataSource;return Array.isArray(e)?e:"string"==typeof e&&e?a.safeJsonParse(e,[]):[]}getThClasses(e){const t={};return"left"===e.fixed&&(t["fixed-left"]=!0),"right"===e.fixed&&(t["fixed-right"]=!0),t[`align-${e.align||"left"}`]=!0,t}getTdClasses(e){const t={};return"left"===e.fixed&&(t["fixed-left"]=!0),"right"===e.fixed&&(t["fixed-right"]=!0),t[`align-${e.align||"left"}`]=!0,t}mounted(){this.refresh()}getCellValue(e,t){return e[t.dataIndex]}handleRowClick(e,t){this.$data.rowClickable&&(this.emit("row-click",{row:e,index:t}),this.dispatchEvent(new Event("click",{bubbles:!0,composed:!0})))}setColumns(e){this.$data.columns=JSON.stringify(e)}setDataSource(e){this.$data.dataSource=JSON.stringify(e)}getDataSource(){return this.getParsedDataSource()}},exports.SolelyTable=((e,t)=>{for(var a,s=t,r=e.length-1;r>=0;r--)(a=e[r])&&(s=a(s)||s);return s})([r.CustomElement({tagName:"solely-table",template:t.__SOLELY_IR__,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"columns",type:"string"},{name:"dataSource",type:"string"},{name:"size",type:"string",default:"medium"},{name:"bordered",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"striped",type:"boolean",default:!1},{name:"rowClickable",type:"boolean",default:!1},{name:"rowKey",type:"string"}]})],exports.SolelyTable);
@@ -1 +1 @@
1
- import e from"./style.css.js";import{__SOLELY_IR__ as t}from"./index.html.js";import{safeJsonParse as a}from"../utils/helpers.js";import r from"../../../runtime/component/base-element.js";import{CustomElement as s}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let i=class extends r{getTableClasses(){const e={};return"small"===this.$data.size?e["table--sm"]=!0:"large"===this.$data.size?e["table--lg"]=!0:e["table--md"]=!0,e["table--bordered"]=!!this.$data.bordered,e["is-loading"]=!!this.$data.loading,e["table--striped"]=!!this.$data.striped,e["table--clickable"]=!!this.$data.rowClickable,e}getParsedColumns(){const e=this.$data.columns;return Array.isArray(e)?e:"string"==typeof e&&e?a(e,[]):[]}getParsedDataSource(){const e=this.$data.dataSource;return Array.isArray(e)?e:"string"==typeof e&&e?a(e,[]):[]}getThClasses(e){const t={};return"left"===e.fixed&&(t["fixed-left"]=!0),"right"===e.fixed&&(t["fixed-right"]=!0),t[`align-${e.align||"left"}`]=!0,t}getTdClasses(e){const t={};return"left"===e.fixed&&(t["fixed-left"]=!0),"right"===e.fixed&&(t["fixed-right"]=!0),t[`align-${e.align||"left"}`]=!0,t}mounted(){this.refresh()}getCellValue(e,t){return e[t.dataIndex]}handleRowClick(e,t){this.$data.rowClickable&&(this.emit("row-click",{row:e,index:t}),this.dispatchEvent(new Event("click",{bubbles:!0,composed:!0})))}setColumns(e){this.$data.columns=JSON.stringify(e)}setDataSource(e){this.$data.dataSource=JSON.stringify(e)}getDataSource(){return this.getParsedDataSource()}};i=((e,t)=>{for(var a,r=t,s=e.length-1;s>=0;s--)(a=e[s])&&(r=a(r)||r);return r})([s({tagName:"solely-table",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"columns",type:"string"},{name:"dataSource",type:"string"},{name:"size",type:"string"},{name:"bordered",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"striped",type:"boolean",default:!1},{name:"rowClickable",type:"boolean",default:!1},{name:"rowKey",type:"string"}]})],i);export{i as SolelyTable};
1
+ import e from"./style.css.js";import{__SOLELY_IR__ as t}from"./index.html.js";import{safeJsonParse as a}from"../utils/helpers.js";import r from"../../../runtime/component/base-element.js";import{CustomElement as s}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let i=class extends r{getTableClasses(){const e={};return"small"===this.$data.size?e["table--sm"]=!0:"large"===this.$data.size?e["table--lg"]=!0:e["table--md"]=!0,e["table--bordered"]=!!this.$data.bordered,e["is-loading"]=!!this.$data.loading,e["table--striped"]=!!this.$data.striped,e["table--clickable"]=!!this.$data.rowClickable,e}getParsedColumns(){const e=this.$data.columns;return Array.isArray(e)?e:"string"==typeof e&&e?a(e,[]):[]}getParsedDataSource(){const e=this.$data.dataSource;return Array.isArray(e)?e:"string"==typeof e&&e?a(e,[]):[]}getThClasses(e){const t={};return"left"===e.fixed&&(t["fixed-left"]=!0),"right"===e.fixed&&(t["fixed-right"]=!0),t[`align-${e.align||"left"}`]=!0,t}getTdClasses(e){const t={};return"left"===e.fixed&&(t["fixed-left"]=!0),"right"===e.fixed&&(t["fixed-right"]=!0),t[`align-${e.align||"left"}`]=!0,t}mounted(){this.refresh()}getCellValue(e,t){return e[t.dataIndex]}handleRowClick(e,t){this.$data.rowClickable&&(this.emit("row-click",{row:e,index:t}),this.dispatchEvent(new Event("click",{bubbles:!0,composed:!0})))}setColumns(e){this.$data.columns=JSON.stringify(e)}setDataSource(e){this.$data.dataSource=JSON.stringify(e)}getDataSource(){return this.getParsedDataSource()}};i=((e,t)=>{for(var a,r=t,s=e.length-1;s>=0;s--)(a=e[s])&&(r=a(r)||r);return r})([s({tagName:"solely-table",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"columns",type:"string"},{name:"dataSource",type:"string"},{name:"size",type:"string",default:"medium"},{name:"bordered",type:"boolean",default:!1},{name:"loading",type:"boolean",default:!1},{name:"striped",type:"boolean",default:!1},{name:"rowClickable",type:"boolean",default:!1},{name:"rowKey",type:"string"}]})],i);export{i as SolelyTable};
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Table 组件类型定义
3
3
  */
4
- export type TableSize = 'small' | 'middle' | 'default' | 'large';
4
+ export type TableSize = 'small' | 'medium' | 'large' | 'middle' | 'default';
5
5
  export interface TableColumn {
6
6
  /** 列标题 */
7
7
  title: string;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),s=require("../utils/helpers.cjs"),a=require("../../../runtime/component/base-element.cjs"),i=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyTabs=class extends a.default{get activeKey(){return this.$data.activeKey}set activeKey(e){this.$data.activeKey=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{activeKey:e}}))}getTabsClasses(){const e={};return this.$data.type&&(e[`tabs--${this.$data.type}`]=!0),"small"===this.$data.size?e["tabs--sm"]=!0:"large"===this.$data.size?e["tabs--lg"]=!0:e["tabs--md"]=!0,e}getTabClasses(e){return{"tabs__tab--active":e.key===this.$data.activeKey,"tabs__tab--disabled":!!e.disabled}}getPaneClasses(e){return{"tabs__pane--active":e.key===this.$data.activeKey}}mounted(){this.refresh();const e=this.getParsedItems();if(!this.$data.activeKey&&Array.isArray(e)&&e.length>0){const t=e[0];t&&t.key&&(this.$data.activeKey=t.key)}}getParsedItems(){const e=this.$data.items;return Array.isArray(e)?e:"string"==typeof e&&e?s.safeJsonParse(e,[]):[]}handleTabClick(e){e.disabled||(this.$data.activeKey=e.key,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleClose(e,t){t.stopPropagation();const s=this.getParsedItems(),a=s.findIndex(t=>t.key===e.key);if(a>-1){if(s.splice(a,1),this.$data.activeKey===e.key&&Array.isArray(s)&&s.length>0){const e=s[Math.min(a,s.length-1)];e&&e.key&&(this.$data.activeKey=e.key)}this.$data.items=JSON.stringify(s)}this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0,detail:{key:e.key,label:e.label}}))}handleAdd(){const e=this.getParsedItems(),t=e.length+1,s={key:`new-${Date.now()}`,label:`新标签 ${t}`};e.push(s),this.$data.activeKey=s.key,this.$data.items=JSON.stringify(e),this.dispatchEvent(new CustomEvent("add",{bubbles:!0,composed:!0,detail:{key:s.key,label:s.label}}))}setActiveKey(e){this.$data.activeKey=e}getActiveKey(){return this.$data.activeKey}setItems(e){this.$data.items=JSON.stringify(e),this.refresh()}},exports.SolelyTabs=((e,t)=>{for(var s,a=t,i=e.length-1;i>=0;i--)(s=e[i])&&(a=s(a)||a);return a})([i.CustomElement({tagName:"solely-tabs",template:t.__SOLELY_IR__,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"activeKey",type:"string",default:""},{name:"type",type:"string",default:"line"},{name:"position",type:"string",default:"top"},{name:"size",type:"string",default:"default"},{name:"items",type:"string",default:"[]"},{name:"closable",type:"boolean",default:!1},{name:"addable",type:"boolean",default:!1}]})],exports.SolelyTabs);
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),s=require("../utils/helpers.cjs"),a=require("../../../runtime/component/base-element.cjs"),i=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyTabs=class extends a.default{get activeKey(){return this.$data.activeKey}set activeKey(e){this.$data.activeKey=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{activeKey:e}}))}getTabsClasses(){const e={};return this.$data.type&&(e[`tabs--${this.$data.type}`]=!0),"small"===this.$data.size?e["tabs--sm"]=!0:"large"===this.$data.size?e["tabs--lg"]=!0:e["tabs--md"]=!0,e}getTabClasses(e){return{"tabs__tab--active":e.key===this.$data.activeKey,"tabs__tab--disabled":!!e.disabled}}getPaneClasses(e){return{"tabs__pane--active":e.key===this.$data.activeKey}}mounted(){this.refresh();const e=this.getParsedItems();if(!this.$data.activeKey&&Array.isArray(e)&&e.length>0){const t=e[0];t&&t.key&&(this.$data.activeKey=t.key)}}getParsedItems(){const e=this.$data.items;return Array.isArray(e)?e:"string"==typeof e&&e?s.safeJsonParse(e,[]):[]}handleTabClick(e){e.disabled||(this.$data.activeKey=e.key,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleClose(e,t){t.stopPropagation();const s=this.getParsedItems(),a=s.findIndex(t=>t.key===e.key);if(a>-1){if(s.splice(a,1),this.$data.activeKey===e.key&&Array.isArray(s)&&s.length>0){const e=s[Math.min(a,s.length-1)];e&&e.key&&(this.$data.activeKey=e.key)}this.$data.items=JSON.stringify(s)}this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0,detail:{key:e.key,label:e.label}}))}handleAdd(){const e=this.getParsedItems(),t=e.length+1,s={key:`new-${Date.now()}`,label:`新标签 ${t}`};e.push(s),this.$data.activeKey=s.key,this.$data.items=JSON.stringify(e),this.dispatchEvent(new CustomEvent("add",{bubbles:!0,composed:!0,detail:{key:s.key,label:s.label}}))}setActiveKey(e){this.$data.activeKey=e}getActiveKey(){return this.$data.activeKey}setItems(e){this.$data.items=JSON.stringify(e),this.refresh()}},exports.SolelyTabs=((e,t)=>{for(var s,a=t,i=e.length-1;i>=0;i--)(s=e[i])&&(a=s(a)||a);return a})([i.CustomElement({tagName:"solely-tabs",template:t.__SOLELY_IR__,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"activeKey",type:"string",default:""},{name:"type",type:"string",default:"line"},{name:"position",type:"string",default:"top"},{name:"size",type:"string",default:"medium"},{name:"items",type:"string",default:"[]"},{name:"closable",type:"boolean",default:!1},{name:"addable",type:"boolean",default:!1}]})],exports.SolelyTabs);
@@ -1 +1 @@
1
- import e from"./style.css.js";import{__SOLELY_IR__ as t}from"./index.html.js";import{safeJsonParse as a}from"../utils/helpers.js";import s from"../../../runtime/component/base-element.js";import{CustomElement as i}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let n=class extends s{get activeKey(){return this.$data.activeKey}set activeKey(e){this.$data.activeKey=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{activeKey:e}}))}getTabsClasses(){const e={};return this.$data.type&&(e[`tabs--${this.$data.type}`]=!0),"small"===this.$data.size?e["tabs--sm"]=!0:"large"===this.$data.size?e["tabs--lg"]=!0:e["tabs--md"]=!0,e}getTabClasses(e){return{"tabs__tab--active":e.key===this.$data.activeKey,"tabs__tab--disabled":!!e.disabled}}getPaneClasses(e){return{"tabs__pane--active":e.key===this.$data.activeKey}}mounted(){this.refresh();const e=this.getParsedItems();if(!this.$data.activeKey&&Array.isArray(e)&&e.length>0){const t=e[0];t&&t.key&&(this.$data.activeKey=t.key)}}getParsedItems(){const e=this.$data.items;return Array.isArray(e)?e:"string"==typeof e&&e?a(e,[]):[]}handleTabClick(e){e.disabled||(this.$data.activeKey=e.key,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleClose(e,t){t.stopPropagation();const a=this.getParsedItems(),s=a.findIndex(t=>t.key===e.key);if(s>-1){if(a.splice(s,1),this.$data.activeKey===e.key&&Array.isArray(a)&&a.length>0){const e=a[Math.min(s,a.length-1)];e&&e.key&&(this.$data.activeKey=e.key)}this.$data.items=JSON.stringify(a)}this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0,detail:{key:e.key,label:e.label}}))}handleAdd(){const e=this.getParsedItems(),t=e.length+1,a={key:`new-${Date.now()}`,label:`新标签 ${t}`};e.push(a),this.$data.activeKey=a.key,this.$data.items=JSON.stringify(e),this.dispatchEvent(new CustomEvent("add",{bubbles:!0,composed:!0,detail:{key:a.key,label:a.label}}))}setActiveKey(e){this.$data.activeKey=e}getActiveKey(){return this.$data.activeKey}setItems(e){this.$data.items=JSON.stringify(e),this.refresh()}};n=((e,t)=>{for(var a,s=t,i=e.length-1;i>=0;i--)(a=e[i])&&(s=a(s)||s);return s})([i({tagName:"solely-tabs",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"activeKey",type:"string",default:""},{name:"type",type:"string",default:"line"},{name:"position",type:"string",default:"top"},{name:"size",type:"string",default:"default"},{name:"items",type:"string",default:"[]"},{name:"closable",type:"boolean",default:!1},{name:"addable",type:"boolean",default:!1}]})],n);export{n as SolelyTabs};
1
+ import e from"./style.css.js";import{__SOLELY_IR__ as t}from"./index.html.js";import{safeJsonParse as a}from"../utils/helpers.js";import s from"../../../runtime/component/base-element.js";import{CustomElement as i}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let n=class extends s{get activeKey(){return this.$data.activeKey}set activeKey(e){this.$data.activeKey=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{activeKey:e}}))}getTabsClasses(){const e={};return this.$data.type&&(e[`tabs--${this.$data.type}`]=!0),"small"===this.$data.size?e["tabs--sm"]=!0:"large"===this.$data.size?e["tabs--lg"]=!0:e["tabs--md"]=!0,e}getTabClasses(e){return{"tabs__tab--active":e.key===this.$data.activeKey,"tabs__tab--disabled":!!e.disabled}}getPaneClasses(e){return{"tabs__pane--active":e.key===this.$data.activeKey}}mounted(){this.refresh();const e=this.getParsedItems();if(!this.$data.activeKey&&Array.isArray(e)&&e.length>0){const t=e[0];t&&t.key&&(this.$data.activeKey=t.key)}}getParsedItems(){const e=this.$data.items;return Array.isArray(e)?e:"string"==typeof e&&e?a(e,[]):[]}handleTabClick(e){e.disabled||(this.$data.activeKey=e.key,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleClose(e,t){t.stopPropagation();const a=this.getParsedItems(),s=a.findIndex(t=>t.key===e.key);if(s>-1){if(a.splice(s,1),this.$data.activeKey===e.key&&Array.isArray(a)&&a.length>0){const e=a[Math.min(s,a.length-1)];e&&e.key&&(this.$data.activeKey=e.key)}this.$data.items=JSON.stringify(a)}this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0,detail:{key:e.key,label:e.label}}))}handleAdd(){const e=this.getParsedItems(),t=e.length+1,a={key:`new-${Date.now()}`,label:`新标签 ${t}`};e.push(a),this.$data.activeKey=a.key,this.$data.items=JSON.stringify(e),this.dispatchEvent(new CustomEvent("add",{bubbles:!0,composed:!0,detail:{key:a.key,label:a.label}}))}setActiveKey(e){this.$data.activeKey=e}getActiveKey(){return this.$data.activeKey}setItems(e){this.$data.items=JSON.stringify(e),this.refresh()}};n=((e,t)=>{for(var a,s=t,i=e.length-1;i>=0;i--)(a=e[i])&&(s=a(s)||s);return s})([i({tagName:"solely-tabs",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"activeKey",type:"string",default:""},{name:"type",type:"string",default:"line"},{name:"position",type:"string",default:"top"},{name:"size",type:"string",default:"medium"},{name:"items",type:"string",default:"[]"},{name:"closable",type:"boolean",default:!1},{name:"addable",type:"boolean",default:!1}]})],n);export{n as SolelyTabs};
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export type TabsType = 'line' | 'card';
5
5
  export type TabsPosition = 'top' | 'right' | 'bottom' | 'left';
6
- export type TabsSize = 'small' | 'default' | 'large';
6
+ export type TabsSize = 'small' | 'medium' | 'large';
7
7
  export interface TabItem {
8
8
  /** 标签页标题 */
9
9
  label: string;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./theme/index.cjs"),r=require("./elements/button/index.cjs"),t=require("./elements/icon/index.cjs"),o=require("./elements/input/index.cjs"),l=require("./elements/fab/index.cjs"),n=require("./elements/card/index.cjs"),s=require("./elements/tag/index.cjs"),i=require("./elements/badge/index.cjs"),c=require("./elements/alert/index.cjs"),p=require("./elements/switch/index.cjs"),d=require("./elements/checkbox/index.cjs"),a=require("./elements/radio/index.cjs"),m=require("./elements/select/index.cjs"),y=require("./elements/progress/index.cjs"),x=require("./elements/divider/index.cjs"),u=require("./elements/tabs/index.cjs"),b=require("./elements/table/index.cjs"),S=require("./elements/skeleton/index.cjs"),j=require("./elements/empty/index.cjs"),g=require("./elements/pagination/index.cjs"),P=require("./elements/breadcrumb/index.cjs"),f=require("./elements/steps/index.cjs"),q=require("./elements/timeline/index.cjs"),O=require("./elements/backtop/index.cjs"),T=require("./elements/upload/index.cjs"),I=require("./elements/rate/index.cjs"),h=require("./elements/slider/index.cjs"),A=require("./elements/tree/index.cjs"),k=require("./elements/coordinate-input/index.cjs"),C=require("./elements/tooltip/index.cjs"),N=require("./elements/not-found/index.cjs"),B=require("./commands/message/index.cjs"),D=require("./commands/modal/index.cjs"),R=require("./commands/tooltip/index.cjs"),M=require("./commands/drawer/index.cjs"),v=require("./commands/popconfirm/index.cjs"),w=require("./commands/utils.cjs");exports.getTheme=e.getTheme,exports.initTheme=e.initTheme,exports.persistTheme=e.persistTheme,exports.setTheme=e.setTheme,exports.toggleTheme=e.toggleTheme,Object.defineProperty(exports,"SolelyButton",{enumerable:!0,get:()=>r.SolelyButton}),Object.defineProperty(exports,"SolelyIcon",{enumerable:!0,get:()=>t.SolelyIcon}),exports.getIcon=t.getIcon,exports.getRegisteredIcons=t.getRegisteredIcons,exports.hasIcon=t.hasIcon,exports.registerIcon=t.registerIcon,exports.registerIcons=t.registerIcons,Object.defineProperty(exports,"SolelyInput",{enumerable:!0,get:()=>o.SolelyInput}),Object.defineProperty(exports,"SolelyFab",{enumerable:!0,get:()=>l.SolelyFab}),Object.defineProperty(exports,"SolelyCard",{enumerable:!0,get:()=>n.SolelyCard}),Object.defineProperty(exports,"SolelyTag",{enumerable:!0,get:()=>s.SolelyTag}),Object.defineProperty(exports,"SolelyBadge",{enumerable:!0,get:()=>i.SolelyBadge}),Object.defineProperty(exports,"SolelyAlert",{enumerable:!0,get:()=>c.SolelyAlert}),Object.defineProperty(exports,"SolelySwitch",{enumerable:!0,get:()=>p.SolelySwitch}),Object.defineProperty(exports,"SolelyCheckbox",{enumerable:!0,get:()=>d.SolelyCheckbox}),Object.defineProperty(exports,"SolelyRadio",{enumerable:!0,get:()=>a.SolelyRadio}),Object.defineProperty(exports,"SolelySelect",{enumerable:!0,get:()=>m.SolelySelect}),Object.defineProperty(exports,"SolelyProgress",{enumerable:!0,get:()=>y.SolelyProgress}),Object.defineProperty(exports,"SolelyDivider",{enumerable:!0,get:()=>x.SolelyDivider}),Object.defineProperty(exports,"SolelyTabs",{enumerable:!0,get:()=>u.SolelyTabs}),Object.defineProperty(exports,"SolelyTable",{enumerable:!0,get:()=>b.SolelyTable}),Object.defineProperty(exports,"SolelySkeleton",{enumerable:!0,get:()=>S.SolelySkeleton}),Object.defineProperty(exports,"SolelyEmpty",{enumerable:!0,get:()=>j.SolelyEmpty}),Object.defineProperty(exports,"SolelyPagination",{enumerable:!0,get:()=>g.SolelyPagination}),Object.defineProperty(exports,"SolelyBreadcrumb",{enumerable:!0,get:()=>P.SolelyBreadcrumb}),Object.defineProperty(exports,"SolelySteps",{enumerable:!0,get:()=>f.SolelySteps}),Object.defineProperty(exports,"SolelyTimeline",{enumerable:!0,get:()=>q.SolelyTimeline}),Object.defineProperty(exports,"SolelyBackTop",{enumerable:!0,get:()=>O.SolelyBackTop}),Object.defineProperty(exports,"SolelyUpload",{enumerable:!0,get:()=>T.SolelyUpload}),Object.defineProperty(exports,"SolelyRate",{enumerable:!0,get:()=>I.SolelyRate}),Object.defineProperty(exports,"SolelySlider",{enumerable:!0,get:()=>h.SolelySlider}),Object.defineProperty(exports,"SolelyTree",{enumerable:!0,get:()=>A.SolelyTree}),Object.defineProperty(exports,"SolelyCoordinateInput",{enumerable:!0,get:()=>k.SolelyCoordinateInput}),Object.defineProperty(exports,"SolelyTooltip",{enumerable:!0,get:()=>C.SolelyTooltip}),Object.defineProperty(exports,"SolelyNotFound",{enumerable:!0,get:()=>N.SolelyNotFound}),exports.Message=B.Message,exports.Modal=D.Modal,exports.Tooltip=R.Tooltip,exports.Drawer=M.Drawer,exports.Popconfirm=v.Popconfirm,exports.ANIMATION_DURATION=w.ANIMATION_DURATION,exports.Z_INDEX=w.Z_INDEX,exports.addClosingAnimation=w.addClosingAnimation,exports.calculatePosition=w.calculatePosition,exports.createElement=w.createElement,exports.generateId=w.generateId,exports.injectStyle=w.injectStyle,exports.removeStyle=w.removeStyle,exports.safeAsyncCallback=w.safeAsyncCallback;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./theme/index.cjs"),r=require("./elements/button/index.cjs"),t=require("./elements/icon/index.cjs"),o=require("./elements/input/index.cjs"),l=require("./elements/fab/index.cjs"),n=require("./elements/card/index.cjs"),s=require("./elements/tag/index.cjs"),i=require("./elements/badge/index.cjs"),c=require("./elements/alert/index.cjs"),p=require("./elements/switch/index.cjs"),d=require("./elements/checkbox/index.cjs"),a=require("./elements/radio/index.cjs"),m=require("./elements/select/index.cjs"),y=require("./elements/progress/index.cjs"),x=require("./elements/divider/index.cjs"),u=require("./elements/tabs/index.cjs"),b=require("./elements/table/index.cjs"),S=require("./elements/skeleton/index.cjs"),j=require("./elements/empty/index.cjs"),g=require("./elements/pagination/index.cjs"),P=require("./elements/breadcrumb/index.cjs"),f=require("./elements/steps/index.cjs"),q=require("./elements/timeline/index.cjs"),O=require("./elements/backtop/index.cjs"),T=require("./elements/upload/index.cjs"),I=require("./elements/rate/index.cjs"),h=require("./elements/slider/index.cjs"),A=require("./elements/tree/index.cjs"),k=require("./elements/coordinate-input/index.cjs"),C=require("./elements/tooltip/index.cjs"),N=require("./elements/not-found/index.cjs"),v=require("./commands/message/index.cjs"),B=require("./commands/modal/index.cjs"),D=require("./commands/tooltip/index.cjs"),R=require("./commands/drawer/index.cjs"),M=require("./commands/popconfirm/index.cjs"),w=require("./commands/utils.cjs");exports.getTheme=e.getTheme,exports.initTheme=e.initTheme,exports.persistTheme=e.persistTheme,exports.setTheme=e.setTheme,exports.toggleTheme=e.toggleTheme,Object.defineProperty(exports,"SolelyButton",{enumerable:!0,get:()=>r.SolelyButton}),Object.defineProperty(exports,"SolelyIcon",{enumerable:!0,get:()=>t.SolelyIcon}),exports.getIcon=t.getIcon,exports.getRegisteredIcons=t.getRegisteredIcons,exports.hasIcon=t.hasIcon,exports.registerIcon=t.registerIcon,exports.registerIcons=t.registerIcons,Object.defineProperty(exports,"SolelyInput",{enumerable:!0,get:()=>o.SolelyInput}),Object.defineProperty(exports,"SolelyFab",{enumerable:!0,get:()=>l.SolelyFab}),Object.defineProperty(exports,"SolelyCard",{enumerable:!0,get:()=>n.SolelyCard}),Object.defineProperty(exports,"SolelyTag",{enumerable:!0,get:()=>s.SolelyTag}),Object.defineProperty(exports,"SolelyBadge",{enumerable:!0,get:()=>i.SolelyBadge}),Object.defineProperty(exports,"SolelyAlert",{enumerable:!0,get:()=>c.SolelyAlert}),Object.defineProperty(exports,"SolelySwitch",{enumerable:!0,get:()=>p.SolelySwitch}),Object.defineProperty(exports,"SolelyCheckbox",{enumerable:!0,get:()=>d.SolelyCheckbox}),Object.defineProperty(exports,"SolelyRadio",{enumerable:!0,get:()=>a.SolelyRadio}),Object.defineProperty(exports,"SolelySelect",{enumerable:!0,get:()=>m.SolelySelect}),Object.defineProperty(exports,"SolelyProgress",{enumerable:!0,get:()=>y.SolelyProgress}),Object.defineProperty(exports,"SolelyDivider",{enumerable:!0,get:()=>x.SolelyDivider}),Object.defineProperty(exports,"SolelyTabs",{enumerable:!0,get:()=>u.SolelyTabs}),Object.defineProperty(exports,"SolelyTable",{enumerable:!0,get:()=>b.SolelyTable}),Object.defineProperty(exports,"SolelySkeleton",{enumerable:!0,get:()=>S.SolelySkeleton}),Object.defineProperty(exports,"SolelyEmpty",{enumerable:!0,get:()=>j.SolelyEmpty}),Object.defineProperty(exports,"SolelyPagination",{enumerable:!0,get:()=>g.SolelyPagination}),Object.defineProperty(exports,"SolelyBreadcrumb",{enumerable:!0,get:()=>P.SolelyBreadcrumb}),Object.defineProperty(exports,"SolelySteps",{enumerable:!0,get:()=>f.SolelySteps}),Object.defineProperty(exports,"SolelyTimeline",{enumerable:!0,get:()=>q.SolelyTimeline}),Object.defineProperty(exports,"SolelyBackTop",{enumerable:!0,get:()=>O.SolelyBackTop}),Object.defineProperty(exports,"SolelyUpload",{enumerable:!0,get:()=>T.SolelyUpload}),Object.defineProperty(exports,"SolelyRate",{enumerable:!0,get:()=>I.SolelyRate}),Object.defineProperty(exports,"SolelySlider",{enumerable:!0,get:()=>h.SolelySlider}),Object.defineProperty(exports,"SolelyTree",{enumerable:!0,get:()=>A.SolelyTree}),Object.defineProperty(exports,"SolelyCoordinateInput",{enumerable:!0,get:()=>k.SolelyCoordinateInput}),Object.defineProperty(exports,"SolelyTooltip",{enumerable:!0,get:()=>C.SolelyTooltip}),Object.defineProperty(exports,"SolelyNotFound",{enumerable:!0,get:()=>N.SolelyNotFound}),exports.Message=v.Message,exports.Modal=B.Modal,exports.Tooltip=D.Tooltip,exports.Drawer=R.Drawer,exports.Popconfirm=M.Popconfirm,exports.ANIMATION_DURATION=w.ANIMATION_DURATION,exports.Z_INDEX=w.Z_INDEX,exports.addClosingAnimation=w.addClosingAnimation,exports.calculatePosition=w.calculatePosition,exports.createElement=w.createElement,exports.generateId=w.generateId,exports.injectStyle=w.injectStyle,exports.observeTheme=w.observeTheme,exports.removeStyle=w.removeStyle,exports.safeAsyncCallback=w.safeAsyncCallback;
@@ -1 +1 @@
1
- import{getTheme as e,initTheme as m,persistTheme as o,setTheme as t,toggleTheme as i}from"./theme/index.js";import{SolelyButton as r}from"./elements/button/index.js";import{SolelyIcon as s,getIcon as n,getRegisteredIcons as d,hasIcon as p,registerIcon as l,registerIcons as f}from"./elements/icon/index.js";import{SolelyInput as x}from"./elements/input/index.js";import{SolelyFab as j}from"./elements/fab/index.js";import{SolelyCard as a}from"./elements/card/index.js";import{SolelyTag as c}from"./elements/tag/index.js";import{SolelyBadge as b}from"./elements/badge/index.js";import{SolelyAlert as u}from"./elements/alert/index.js";import{SolelySwitch as g}from"./elements/switch/index.js";import{SolelyCheckbox as h}from"./elements/checkbox/index.js";import{SolelyRadio as k}from"./elements/radio/index.js";import{SolelySelect as w}from"./elements/select/index.js";import{SolelyProgress as v}from"./elements/progress/index.js";import{SolelyDivider as y}from"./elements/divider/index.js";import{SolelyTabs as q}from"./elements/tabs/index.js";import{SolelyTable as z}from"./elements/table/index.js";import{SolelySkeleton as A}from"./elements/skeleton/index.js";import{SolelyEmpty as B}from"./elements/empty/index.js";import{SolelyPagination as C}from"./elements/pagination/index.js";import{SolelyBreadcrumb as D}from"./elements/breadcrumb/index.js";import{SolelySteps as E}from"./elements/steps/index.js";import{SolelyTimeline as F}from"./elements/timeline/index.js";import{SolelyBackTop as G}from"./elements/backtop/index.js";import{SolelyUpload as H}from"./elements/upload/index.js";import{SolelyRate as I}from"./elements/rate/index.js";import{SolelySlider as J}from"./elements/slider/index.js";import{SolelyTree as K}from"./elements/tree/index.js";import{SolelyCoordinateInput as L}from"./elements/coordinate-input/index.js";import{SolelyTooltip as M}from"./elements/tooltip/index.js";import{SolelyNotFound as N}from"./elements/not-found/index.js";import{Message as O}from"./commands/message/index.js";import{Modal as P}from"./commands/modal/index.js";import{Tooltip as Q}from"./commands/tooltip/index.js";import{Drawer as R}from"./commands/drawer/index.js";import{Popconfirm as S}from"./commands/popconfirm/index.js";import{ANIMATION_DURATION as T,Z_INDEX as U,addClosingAnimation as V,calculatePosition as W,createElement as X,generateId as Y,injectStyle as Z,removeStyle as $,safeAsyncCallback as _}from"./commands/utils.js";export{T as ANIMATION_DURATION,R as Drawer,O as Message,P as Modal,S as Popconfirm,u as SolelyAlert,G as SolelyBackTop,b as SolelyBadge,D as SolelyBreadcrumb,r as SolelyButton,a as SolelyCard,h as SolelyCheckbox,L as SolelyCoordinateInput,y as SolelyDivider,B as SolelyEmpty,j as SolelyFab,s as SolelyIcon,x as SolelyInput,N as SolelyNotFound,C as SolelyPagination,v as SolelyProgress,k as SolelyRadio,I as SolelyRate,w as SolelySelect,A as SolelySkeleton,J as SolelySlider,E as SolelySteps,g as SolelySwitch,z as SolelyTable,q as SolelyTabs,c as SolelyTag,F as SolelyTimeline,M as SolelyTooltip,K as SolelyTree,H as SolelyUpload,Q as Tooltip,U as Z_INDEX,V as addClosingAnimation,W as calculatePosition,X as createElement,Y as generateId,n as getIcon,d as getRegisteredIcons,e as getTheme,p as hasIcon,m as initTheme,Z as injectStyle,o as persistTheme,l as registerIcon,f as registerIcons,$ as removeStyle,_ as safeAsyncCallback,t as setTheme,i as toggleTheme};
1
+ import{getTheme as e,initTheme as m,persistTheme as o,setTheme as t,toggleTheme as i}from"./theme/index.js";import{SolelyButton as r}from"./elements/button/index.js";import{SolelyIcon as s,getIcon as n,getRegisteredIcons as d,hasIcon as p,registerIcon as l,registerIcons as f}from"./elements/icon/index.js";import{SolelyInput as x}from"./elements/input/index.js";import{SolelyFab as j}from"./elements/fab/index.js";import{SolelyCard as a}from"./elements/card/index.js";import{SolelyTag as c}from"./elements/tag/index.js";import{SolelyBadge as b}from"./elements/badge/index.js";import{SolelyAlert as u}from"./elements/alert/index.js";import{SolelySwitch as g}from"./elements/switch/index.js";import{SolelyCheckbox as h}from"./elements/checkbox/index.js";import{SolelyRadio as k}from"./elements/radio/index.js";import{SolelySelect as w}from"./elements/select/index.js";import{SolelyProgress as v}from"./elements/progress/index.js";import{SolelyDivider as y}from"./elements/divider/index.js";import{SolelyTabs as q}from"./elements/tabs/index.js";import{SolelyTable as z}from"./elements/table/index.js";import{SolelySkeleton as A}from"./elements/skeleton/index.js";import{SolelyEmpty as B}from"./elements/empty/index.js";import{SolelyPagination as C}from"./elements/pagination/index.js";import{SolelyBreadcrumb as D}from"./elements/breadcrumb/index.js";import{SolelySteps as E}from"./elements/steps/index.js";import{SolelyTimeline as F}from"./elements/timeline/index.js";import{SolelyBackTop as G}from"./elements/backtop/index.js";import{SolelyUpload as H}from"./elements/upload/index.js";import{SolelyRate as I}from"./elements/rate/index.js";import{SolelySlider as J}from"./elements/slider/index.js";import{SolelyTree as K}from"./elements/tree/index.js";import{SolelyCoordinateInput as L}from"./elements/coordinate-input/index.js";import{SolelyTooltip as M}from"./elements/tooltip/index.js";import{SolelyNotFound as N}from"./elements/not-found/index.js";import{Message as O}from"./commands/message/index.js";import{Modal as P}from"./commands/modal/index.js";import{Tooltip as Q}from"./commands/tooltip/index.js";import{Drawer as R}from"./commands/drawer/index.js";import{Popconfirm as S}from"./commands/popconfirm/index.js";import{ANIMATION_DURATION as T,Z_INDEX as U,addClosingAnimation as V,calculatePosition as W,createElement as X,generateId as Y,injectStyle as Z,observeTheme as $,removeStyle as _,safeAsyncCallback as ee}from"./commands/utils.js";export{T as ANIMATION_DURATION,R as Drawer,O as Message,P as Modal,S as Popconfirm,u as SolelyAlert,G as SolelyBackTop,b as SolelyBadge,D as SolelyBreadcrumb,r as SolelyButton,a as SolelyCard,h as SolelyCheckbox,L as SolelyCoordinateInput,y as SolelyDivider,B as SolelyEmpty,j as SolelyFab,s as SolelyIcon,x as SolelyInput,N as SolelyNotFound,C as SolelyPagination,v as SolelyProgress,k as SolelyRadio,I as SolelyRate,w as SolelySelect,A as SolelySkeleton,J as SolelySlider,E as SolelySteps,g as SolelySwitch,z as SolelyTable,q as SolelyTabs,c as SolelyTag,F as SolelyTimeline,M as SolelyTooltip,K as SolelyTree,H as SolelyUpload,Q as Tooltip,U as Z_INDEX,V as addClosingAnimation,W as calculatePosition,X as createElement,Y as generateId,n as getIcon,d as getRegisteredIcons,e as getTheme,p as hasIcon,m as initTheme,Z as injectStyle,$ as observeTheme,o as persistTheme,l as registerIcon,f as registerIcons,_ as removeStyle,ee as safeAsyncCallback,t as setTheme,i as toggleTheme};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=(()=>{var o,e;if("undefined"!=typeof window){if(null==(o=window.location)?void 0:o.search.includes("debug"))return!0;const e=globalThis;if(!0===e.__DEBUG__||!0===e.__IS_DEV__)return!0}return!("undefined"==typeof window||!["localhost","127.0.0.1","0.0.0.0"].includes((null==(e=window.location)?void 0:e.hostname)||""))})(),e=!o;exports.IS_DEV=o,exports.IS_PROD=e,exports.SOLELY_VERSION="0.5.3";
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=(()=>{var o,e;if("undefined"!=typeof window){if(null==(o=window.location)?void 0:o.search.includes("debug"))return!0;const e=globalThis;if(!0===e.__DEBUG__||!0===e.__IS_DEV__)return!0}return!("undefined"==typeof window||!["localhost","127.0.0.1","0.0.0.0"].includes((null==(e=window.location)?void 0:e.hostname)||""))})(),e=!o;exports.IS_DEV=o,exports.IS_PROD=e,exports.SOLELY_VERSION="0.5.4";
@@ -1 +1 @@
1
- const n=(()=>{var n,o;if("undefined"!=typeof window){if(null==(n=window.location)?void 0:n.search.includes("debug"))return!0;const o=globalThis;if(!0===o.__DEBUG__||!0===o.__IS_DEV__)return!0}return!("undefined"==typeof window||!["localhost","127.0.0.1","0.0.0.0"].includes((null==(o=window.location)?void 0:o.hostname)||""))})(),o=!n,i="0.5.3";export{n as IS_DEV,o as IS_PROD,i as SOLELY_VERSION};
1
+ const n=(()=>{var n,o;if("undefined"!=typeof window){if(null==(n=window.location)?void 0:n.search.includes("debug"))return!0;const o=globalThis;if(!0===o.__DEBUG__||!0===o.__IS_DEV__)return!0}return!("undefined"==typeof window||!["localhost","127.0.0.1","0.0.0.0"].includes((null==(o=window.location)?void 0:o.hostname)||""))})(),o=!n,i="0.5.4";export{n as IS_DEV,o as IS_PROD,i as SOLELY_VERSION};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "solely",
3
3
  "private": false,
4
- "version": "0.5.3",
4
+ "version": "0.5.4",
5
5
  "description": "A lightweight TypeScript framework for building web components with compile-time optimizations",
6
6
  "type": "module",
7
7
  "sideEffects": [