solely 0.5.3 → 0.5.5

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 (61) 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/router/core.cjs +1 -1
  46. package/dist/router/core.d.ts +1 -0
  47. package/dist/router/core.js +1 -1
  48. package/dist/router/router-link.cjs +1 -1
  49. package/dist/router/router-link.d.ts +5 -0
  50. package/dist/router/router-link.js +1 -1
  51. package/dist/runtime/component/base-element.cjs +1 -1
  52. package/dist/runtime/component/base-element.js +1 -1
  53. package/dist/runtime/reactivity/observe.cjs +1 -1
  54. package/dist/runtime/reactivity/observe.js +1 -1
  55. package/dist/runtime/reactivity/watch.cjs +1 -1
  56. package/dist/runtime/reactivity/watch.js +1 -1
  57. package/dist/shared/env.cjs +1 -1
  58. package/dist/shared/env.js +1 -1
  59. package/dist/shared/url.cjs +1 -1
  60. package/dist/shared/url.js +1 -1
  61. package/package.json +1 -1
@@ -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";var e=Object.defineProperty,t=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,"symbol"!=typeof s?s+"":s,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../shared/env.cjs");let i=null,r=null,a=null;function n(){return i?Promise.resolve(i):(a||(a=new Promise(e=>{r=e})),a)}const h=(()=>{const e=()=>n();return Object.defineProperties(e,{then:{value:(e,t)=>n().then(e,t),writable:!1,enumerable:!1,configurable:!0},catch:{value:e=>n().catch(e),writable:!1,enumerable:!1,configurable:!0},finally:{value:e=>n().finally(e),writable:!1,enumerable:!1,configurable:!0},[Symbol.toStringTag]:{value:"Promise",writable:!1,enumerable:!1,configurable:!0}}),e})(),o=class e{constructor(e){t(this,"routes"),t(this,"base"),t(this,"mode"),t(this,"beforeEachGuard"),t(this,"afterEachGuard"),t(this,"currentRoute",null),t(this,"listeners",new Set),t(this,"componentCache",new Map),t(this,"keepAliveCache",new Map),t(this,"keepAliveKeys",[]),t(this,"navigationId",0),t(this,"maxKeepAlive"),t(this,"isStarted",!1),t(this,"handleRouteChange",null),this.routes=e.routes,this.base=e.base??"/",this.mode=e.mode||"history",this.beforeEachGuard=e.beforeEach,this.afterEachGuard=e.afterEach,this.maxKeepAlive=e.maxKeepAlive}matchRoute(e="/"){return this.matchRouteInternal(e,new Set,0)}matchRouteInternal(t,i,r){if(r>=e.MAX_REDIRECTS)return s.IS_DEV&&console.error(`[Router] Too many redirects (max ${e.MAX_REDIRECTS}), last path: ${t}`),null;const a=this.normalizePath(t);if(i.has(a))return s.IS_DEV&&console.error(`[Router] Circular redirect detected: ${a}`),null;i.add(a);const[n,h]=a.split("?"),o=n.split("/").filter(Boolean),c=this.parseQuery(h),l=this.recursiveMatch(this.routes,o);if(l){const e=l.matched[l.matched.length-1];return e.config.redirect?this.matchRouteInternal(e.config.redirect,i,r+1):{matched:l.matched,params:l.params,query:c,fullPath:a,meta:l.matched.reduce((e,t)=>({...e,...t.config.meta||{}}),{})}}return null}recursiveMatch(e,t){const s=[...e].sort((e,t)=>this.calculateScore(t.path)-this.calculateScore(e.path));for(const i of s){const e=i.path.split("/").filter(Boolean),s={};let r=!0;if(0===e.length&&0===t.length)return{matched:[{config:i,params:{}}],params:{}};for(let i=0;i<e.length;i++){const a=e[i],n=t[i];if(a.startsWith(":")){if(!n){r=!1;break}s[a.slice(1)]=n}else{if("*"===a){r=!0;break}if(a!==n){r=!1;break}}}if(r){const r=e.length,a=t.slice(r),n={config:i,params:s};if(a.length>0&&i.children){const e=this.recursiveMatch(i.children,a);if(e)return{matched:[n,...e.matched],params:{...s,...e.params}}}else if(0===a.length||e.includes("*"))return{matched:[n],params:s}}}return null}calculateScore(e="/"){const t=e.split("/").filter(Boolean);return 0===t.length?1:t.reduce((e,t)=>t.startsWith(":")?e+5:"*"===t?e+0:e+10,0)}parseQuery(e){const t={};return e?(new URLSearchParams(e).forEach((e,s)=>{t[s]=e}),t):t}normalizePath(e="/"){const t=e&&"string"==typeof e?e:"/",s=t.indexOf("?"),i=-1===s?t:t.slice(0,s),r=-1===s?"":t.slice(s+1);let a=i;return a.startsWith("/")||(a="/"+a),a.length>1&&a.endsWith("/")&&(a=a.slice(0,-1)),r?`${a}?${r}`:a}getPath(){let e;try{e="hash"===this.mode?window.location.hash.slice(1)||"/":`${window.location.pathname}${window.location.search}`}catch{e="/"}const t=this.base||"/";return"/"!==t&&e.startsWith(t)&&(e=e.slice(t.length)||"/"),this.normalizePath(e)}updateBrowserHistory(e="/",t){const s=this.normalizePath(e),i=this.base||"/";if("hash"===this.mode)t?window.location.replace(`#${s}`):window.location.hash=s;else{const e=i.endsWith("/")?i.slice(0,-1):i,r="/"===e?s:e+s;t?window.history.replaceState({path:r},"",r):window.history.pushState({path:r},"",r)}}async navigate(e="/",t=!1,s=!1){const i=++this.navigationId,r=this.normalizePath(e),a=this.currentRoute,n=this.matchRoute(r);if(!n)return{success:!1,error:`No route matched: ${r}`};if(a&&a.fullPath===n.fullPath)return{success:!0};if(this.beforeEachGuard)try{const e=await this.beforeEachGuard(n,a);if(i!==this.navigationId)return{success:!1,cancelled:!0};if(!1===e)return{success:!1,cancelled:!0};if("string"==typeof e)return this.navigate(e,t)}catch(h){return i!==this.navigationId?{success:!1,cancelled:!0}:{success:!1,error:h instanceof Error?h.message:"Guard Error"}}return i!==this.navigationId?{success:!1,cancelled:!0}:(this.currentRoute=n,s||this.updateBrowserHistory(r,t),this.notifyListeners(),this.afterEachGuard&&this.afterEachGuard(n,a),{success:!0})}resolve(e="/"){const t=this.normalizePath(e);if("hash"===this.mode)return`#${t}`;const s=this.base.endsWith("/")?this.base.slice(0,-1):this.base;return"/"===s?t:s+t}get modeType(){return this.mode}pushWithQuery(e="/",t){const s=new URLSearchParams(t).toString(),i=e.includes("?")?"&":"?";return this.push(e+(s?i+s:""))}push(e="/"){return this.navigate(e,!1)}replace(e="/"){return this.navigate(e,!0)}back(){window.history.back()}forward(){window.history.forward()}listen(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notifyListeners(){this.listeners.forEach(e=>e())}setupListeners(){this.isStarted||(this.isStarted=!0,this.handleRouteChange=()=>{this.navigate(this.getPath(),!0,!0)},"hash"===this.mode?window.addEventListener("hashchange",this.handleRouteChange):window.addEventListener("popstate",this.handleRouteChange),"hash"!==this.mode||window.location.hash||(window.location.hash="/"),this.navigate(this.getPath(),!0))}destroy(){this.handleRouteChange&&("hash"===this.mode?window.removeEventListener("hashchange",this.handleRouteChange):window.removeEventListener("popstate",this.handleRouteChange),this.handleRouteChange=null),this.isStarted=!1,this.listeners.clear(),this.componentCache.clear(),this.keepAliveCache.clear(),this.keepAliveKeys=[],this.currentRoute=null,i=null}getCurrentRoute(){return this.currentRoute}getKeepAlive(e){const t=this.keepAliveCache.get(e);if(t){const t=this.keepAliveKeys.indexOf(e);-1!==t&&(this.keepAliveKeys.splice(t,1),this.keepAliveKeys.push(e))}return t}setKeepAlive(e,t){if(this.keepAliveCache.has(e)){this.keepAliveCache.set(e,t);const s=this.keepAliveKeys.indexOf(e);-1!==s&&(this.keepAliveKeys.splice(s,1),this.keepAliveKeys.push(e))}else this.keepAliveCache.set(e,t),this.keepAliveKeys.push(e),this.evictKeepAlive()}hasKeepAlive(e){return this.keepAliveCache.has(e)}evictKeepAlive(){if(this.maxKeepAlive)for(;this.keepAliveKeys.length>this.maxKeepAlive;){const e=this.keepAliveKeys.shift();e&&this.keepAliveCache.delete(e)}}cacheKey(e){return this.normalizePath(e)}prefetch(e){const t=this.matchRoute(e);if(!t)return;const s=this.cacheKey(t.fullPath),i=t.matched[t.matched.length-1];if(!(null==i?void 0:i.config.component))return;const r=i.config.component;if("function"!=typeof r)return;if(this.componentCache.has(s))return;const a=r();this.componentCache.set(s,a),a.catch(()=>{this.componentCache.delete(s)})}getComponentFromCache(e){return this.componentCache.get(this.cacheKey(e))}};t(o,"MAX_REDIRECTS",20);let c=o;exports.Router=c,exports.createRouter=function(e){return i||(i=new c(e),r&&r(i),r=null,a=null,i)},exports.getRouter=function(){return i},exports.routerReady=h;
1
+ "use strict";var e=Object.defineProperty,t=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,"symbol"!=typeof s?s+"":s,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../shared/env.cjs");let i=null,r=null,a=null;function n(){return i?Promise.resolve(i):(a||(a=new Promise(e=>{r=e})),a)}const h=(()=>{const e=()=>n();return Object.defineProperties(e,{then:{value:(e,t)=>n().then(e,t),writable:!1,enumerable:!1,configurable:!0},catch:{value:e=>n().catch(e),writable:!1,enumerable:!1,configurable:!0},finally:{value:e=>n().finally(e),writable:!1,enumerable:!1,configurable:!0},[Symbol.toStringTag]:{value:"Promise",writable:!1,enumerable:!1,configurable:!0}}),e})(),o=class e{constructor(e){t(this,"routes"),t(this,"base"),t(this,"mode"),t(this,"beforeEachGuard"),t(this,"afterEachGuard"),t(this,"currentRoute",null),t(this,"listeners",new Set),t(this,"componentCache",new Map),t(this,"keepAliveCache",new Map),t(this,"keepAliveKeys",[]),t(this,"navigationId",0),t(this,"maxKeepAlive"),t(this,"isStarted",!1),t(this,"handleRouteChange",null),this.routes=e.routes,this.base=this.normalizeBase(e.base),this.mode=e.mode||"history",this.beforeEachGuard=e.beforeEach,this.afterEachGuard=e.afterEach,this.maxKeepAlive=e.maxKeepAlive}normalizeBase(e){let t=e||"/";return t.startsWith("/")||(t="/"+t),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t}matchRoute(e="/"){return this.matchRouteInternal(e,new Set,0)}matchRouteInternal(t,i,r){if(r>=e.MAX_REDIRECTS)return s.IS_DEV&&console.error(`[Router] Too many redirects (max ${e.MAX_REDIRECTS}), last path: ${t}`),null;const a=this.normalizePath(t);if(i.has(a))return s.IS_DEV&&console.error(`[Router] Circular redirect detected: ${a}`),null;i.add(a);const[n,h]=a.split("?"),o=n.split("/").filter(Boolean),c=this.parseQuery(h),l=this.recursiveMatch(this.routes,o);if(l){const e=l.matched[l.matched.length-1];return e.config.redirect?this.matchRouteInternal(e.config.redirect,i,r+1):{matched:l.matched,params:l.params,query:c,fullPath:a,meta:l.matched.reduce((e,t)=>({...e,...t.config.meta||{}}),{})}}return null}recursiveMatch(e,t){const s=[...e].sort((e,t)=>this.calculateScore(t.path)-this.calculateScore(e.path));for(const i of s){const e=i.path.split("/").filter(Boolean),s={};let r=!0;if(0===e.length&&0===t.length)return{matched:[{config:i,params:{}}],params:{}};for(let i=0;i<e.length;i++){const a=e[i],n=t[i];if(a.startsWith(":")){if(!n){r=!1;break}Object.defineProperty(s,a.slice(1),{value:n,writable:!0,enumerable:!0,configurable:!0})}else{if("*"===a){r=!0;break}if(a!==n){r=!1;break}}}if(r){const r=e.length,a=t.slice(r),n={config:i,params:s};if(a.length>0&&i.children){const e=this.recursiveMatch(i.children,a);if(e)return{matched:[n,...e.matched],params:{...s,...e.params}}}else if(0===a.length||e.includes("*"))return{matched:[n],params:s}}}return null}calculateScore(e="/"){const t=e.split("/").filter(Boolean);return 0===t.length?1:t.reduce((e,t)=>t.startsWith(":")?e+5:"*"===t?e+0:e+10,0)}parseQuery(e){const t={};return e?(new URLSearchParams(e).forEach((e,s)=>{Object.defineProperty(t,s,{value:e,writable:!0,enumerable:!0,configurable:!0})}),t):t}normalizePath(e="/"){const t=e&&"string"==typeof e?e:"/",s=t.indexOf("?"),i=-1===s?t:t.slice(0,s),r=-1===s?"":t.slice(s+1);let a=i;return a.startsWith("/")||(a="/"+a),a.length>1&&a.endsWith("/")&&(a=a.slice(0,-1)),r?`${a}?${r}`:a}getPath(){let e;try{e="hash"===this.mode?window.location.hash.slice(1)||"/":`${window.location.pathname}${window.location.search}`}catch{e="/"}const t=this.base||"/";return"/"===t||e!==t&&!e.startsWith(t+"/")||(e=e.slice(t.length)||"/"),this.normalizePath(e)}updateBrowserHistory(e="/",t){const s=this.normalizePath(e),i=this.base||"/";if("hash"===this.mode)t?window.location.replace(`#${s}`):window.location.hash=s;else{const e=i.endsWith("/")?i.slice(0,-1):i,r="/"===e?s:e+s;t?window.history.replaceState({path:r},"",r):window.history.pushState({path:r},"",r)}}async navigate(e="/",t=!1,s=!1){const i=++this.navigationId,r=this.normalizePath(e),a=this.currentRoute,n=this.matchRoute(r);if(!n)return{success:!1,error:`No route matched: ${r}`};if(a&&a.fullPath===n.fullPath)return{success:!0};if(this.beforeEachGuard)try{const e=await this.beforeEachGuard(n,a);if(i!==this.navigationId)return{success:!1,cancelled:!0};if(!1===e)return{success:!1,cancelled:!0};if("string"==typeof e)return this.navigate(e,t)}catch(h){return i!==this.navigationId?{success:!1,cancelled:!0}:{success:!1,error:h instanceof Error?h.message:"Guard Error"}}return i!==this.navigationId?{success:!1,cancelled:!0}:(this.currentRoute=n,s||this.updateBrowserHistory(r,t),this.notifyListeners(),this.afterEachGuard&&this.afterEachGuard(n,a),{success:!0})}resolve(e="/"){const t=this.normalizePath(e);if("hash"===this.mode)return`#${t}`;const s=this.base.endsWith("/")?this.base.slice(0,-1):this.base;return"/"===s?t:s+t}get modeType(){return this.mode}pushWithQuery(e="/",t){const s=new URLSearchParams(t).toString(),i=e.includes("?")?"&":"?";return this.push(e+(s?i+s:""))}push(e="/"){return this.navigate(e,!1)}replace(e="/"){return this.navigate(e,!0)}back(){window.history.back()}forward(){window.history.forward()}listen(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notifyListeners(){this.listeners.forEach(e=>e())}setupListeners(){this.isStarted||(this.isStarted=!0,this.handleRouteChange=()=>{this.navigate(this.getPath(),!0,!0)},"hash"===this.mode?window.addEventListener("hashchange",this.handleRouteChange):window.addEventListener("popstate",this.handleRouteChange),"hash"!==this.mode||window.location.hash||(window.location.hash="/"),this.navigate(this.getPath(),!0))}destroy(){this.handleRouteChange&&("hash"===this.mode?window.removeEventListener("hashchange",this.handleRouteChange):window.removeEventListener("popstate",this.handleRouteChange),this.handleRouteChange=null),this.isStarted=!1,this.listeners.clear(),this.componentCache.clear(),this.keepAliveCache.clear(),this.keepAliveKeys=[],this.currentRoute=null,i=null}getCurrentRoute(){return this.currentRoute}getKeepAlive(e){const t=this.keepAliveCache.get(e);if(t){const t=this.keepAliveKeys.indexOf(e);-1!==t&&(this.keepAliveKeys.splice(t,1),this.keepAliveKeys.push(e))}return t}setKeepAlive(e,t){if(this.keepAliveCache.has(e)){this.keepAliveCache.set(e,t);const s=this.keepAliveKeys.indexOf(e);-1!==s&&(this.keepAliveKeys.splice(s,1),this.keepAliveKeys.push(e))}else this.keepAliveCache.set(e,t),this.keepAliveKeys.push(e),this.evictKeepAlive()}hasKeepAlive(e){return this.keepAliveCache.has(e)}evictKeepAlive(){if(this.maxKeepAlive)for(;this.keepAliveKeys.length>this.maxKeepAlive;){const e=this.keepAliveKeys.shift();e&&this.keepAliveCache.delete(e)}}cacheKey(e){return this.normalizePath(e)}prefetch(e){const t=this.matchRoute(e);if(!t)return;const s=this.cacheKey(t.fullPath),i=t.matched[t.matched.length-1];if(!(null==i?void 0:i.config.component))return;const r=i.config.component;if("function"!=typeof r)return;if(this.componentCache.has(s))return;const a=r();this.componentCache.set(s,a),a.catch(()=>{this.componentCache.delete(s)})}getComponentFromCache(e){return this.componentCache.get(this.cacheKey(e))}};t(o,"MAX_REDIRECTS",20);let c=o;exports.Router=c,exports.createRouter=function(e){return i||(i=new c(e),r&&r(i),r=null,a=null,i)},exports.getRouter=function(){return i},exports.routerReady=h;
@@ -33,6 +33,7 @@ export declare class Router {
33
33
  private navigationId;
34
34
  private maxKeepAlive;
35
35
  constructor(options: RouterOptions);
36
+ private normalizeBase;
36
37
  private static readonly MAX_REDIRECTS;
37
38
  matchRoute(path?: string): RouteMatch | null;
38
39
  private matchRouteInternal;
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,"symbol"!=typeof s?s+"":s,i);import{IS_DEV as s}from"../shared/env.js";let i=null,a=null,r=null;function n(){return i?Promise.resolve(i):(r||(r=new Promise(e=>{a=e})),r)}const h=(()=>{const e=()=>n();return Object.defineProperties(e,{then:{value:(e,t)=>n().then(e,t),writable:!1,enumerable:!1,configurable:!0},catch:{value:e=>n().catch(e),writable:!1,enumerable:!1,configurable:!0},finally:{value:e=>n().finally(e),writable:!1,enumerable:!1,configurable:!0},[Symbol.toStringTag]:{value:"Promise",writable:!1,enumerable:!1,configurable:!0}}),e})();function o(e){return i||(i=new u(e),a&&a(i),a=null,r=null,i)}function c(){return i}const l=class e{constructor(e){t(this,"routes"),t(this,"base"),t(this,"mode"),t(this,"beforeEachGuard"),t(this,"afterEachGuard"),t(this,"currentRoute",null),t(this,"listeners",new Set),t(this,"componentCache",new Map),t(this,"keepAliveCache",new Map),t(this,"keepAliveKeys",[]),t(this,"navigationId",0),t(this,"maxKeepAlive"),t(this,"isStarted",!1),t(this,"handleRouteChange",null),this.routes=e.routes,this.base=e.base??"/",this.mode=e.mode||"history",this.beforeEachGuard=e.beforeEach,this.afterEachGuard=e.afterEach,this.maxKeepAlive=e.maxKeepAlive}matchRoute(e="/"){return this.matchRouteInternal(e,new Set,0)}matchRouteInternal(t,i,a){if(a>=e.MAX_REDIRECTS)return s&&console.error(`[Router] Too many redirects (max ${e.MAX_REDIRECTS}), last path: ${t}`),null;const r=this.normalizePath(t);if(i.has(r))return s&&console.error(`[Router] Circular redirect detected: ${r}`),null;i.add(r);const[n,h]=r.split("?"),o=n.split("/").filter(Boolean),c=this.parseQuery(h),l=this.recursiveMatch(this.routes,o);if(l){const e=l.matched[l.matched.length-1];return e.config.redirect?this.matchRouteInternal(e.config.redirect,i,a+1):{matched:l.matched,params:l.params,query:c,fullPath:r,meta:l.matched.reduce((e,t)=>({...e,...t.config.meta||{}}),{})}}return null}recursiveMatch(e,t){const s=[...e].sort((e,t)=>this.calculateScore(t.path)-this.calculateScore(e.path));for(const i of s){const e=i.path.split("/").filter(Boolean),s={};let a=!0;if(0===e.length&&0===t.length)return{matched:[{config:i,params:{}}],params:{}};for(let i=0;i<e.length;i++){const r=e[i],n=t[i];if(r.startsWith(":")){if(!n){a=!1;break}s[r.slice(1)]=n}else{if("*"===r){a=!0;break}if(r!==n){a=!1;break}}}if(a){const a=e.length,r=t.slice(a),n={config:i,params:s};if(r.length>0&&i.children){const e=this.recursiveMatch(i.children,r);if(e)return{matched:[n,...e.matched],params:{...s,...e.params}}}else if(0===r.length||e.includes("*"))return{matched:[n],params:s}}}return null}calculateScore(e="/"){const t=e.split("/").filter(Boolean);return 0===t.length?1:t.reduce((e,t)=>t.startsWith(":")?e+5:"*"===t?e+0:e+10,0)}parseQuery(e){const t={};return e?(new URLSearchParams(e).forEach((e,s)=>{t[s]=e}),t):t}normalizePath(e="/"){const t=e&&"string"==typeof e?e:"/",s=t.indexOf("?"),i=-1===s?t:t.slice(0,s),a=-1===s?"":t.slice(s+1);let r=i;return r.startsWith("/")||(r="/"+r),r.length>1&&r.endsWith("/")&&(r=r.slice(0,-1)),a?`${r}?${a}`:r}getPath(){let e;try{e="hash"===this.mode?window.location.hash.slice(1)||"/":`${window.location.pathname}${window.location.search}`}catch{e="/"}const t=this.base||"/";return"/"!==t&&e.startsWith(t)&&(e=e.slice(t.length)||"/"),this.normalizePath(e)}updateBrowserHistory(e="/",t){const s=this.normalizePath(e),i=this.base||"/";if("hash"===this.mode)t?window.location.replace(`#${s}`):window.location.hash=s;else{const e=i.endsWith("/")?i.slice(0,-1):i,a="/"===e?s:e+s;t?window.history.replaceState({path:a},"",a):window.history.pushState({path:a},"",a)}}async navigate(e="/",t=!1,s=!1){const i=++this.navigationId,a=this.normalizePath(e),r=this.currentRoute,n=this.matchRoute(a);if(!n)return{success:!1,error:`No route matched: ${a}`};if(r&&r.fullPath===n.fullPath)return{success:!0};if(this.beforeEachGuard)try{const e=await this.beforeEachGuard(n,r);if(i!==this.navigationId)return{success:!1,cancelled:!0};if(!1===e)return{success:!1,cancelled:!0};if("string"==typeof e)return this.navigate(e,t)}catch(h){return i!==this.navigationId?{success:!1,cancelled:!0}:{success:!1,error:h instanceof Error?h.message:"Guard Error"}}return i!==this.navigationId?{success:!1,cancelled:!0}:(this.currentRoute=n,s||this.updateBrowserHistory(a,t),this.notifyListeners(),this.afterEachGuard&&this.afterEachGuard(n,r),{success:!0})}resolve(e="/"){const t=this.normalizePath(e);if("hash"===this.mode)return`#${t}`;const s=this.base.endsWith("/")?this.base.slice(0,-1):this.base;return"/"===s?t:s+t}get modeType(){return this.mode}pushWithQuery(e="/",t){const s=new URLSearchParams(t).toString(),i=e.includes("?")?"&":"?";return this.push(e+(s?i+s:""))}push(e="/"){return this.navigate(e,!1)}replace(e="/"){return this.navigate(e,!0)}back(){window.history.back()}forward(){window.history.forward()}listen(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notifyListeners(){this.listeners.forEach(e=>e())}setupListeners(){this.isStarted||(this.isStarted=!0,this.handleRouteChange=()=>{this.navigate(this.getPath(),!0,!0)},"hash"===this.mode?window.addEventListener("hashchange",this.handleRouteChange):window.addEventListener("popstate",this.handleRouteChange),"hash"!==this.mode||window.location.hash||(window.location.hash="/"),this.navigate(this.getPath(),!0))}destroy(){this.handleRouteChange&&("hash"===this.mode?window.removeEventListener("hashchange",this.handleRouteChange):window.removeEventListener("popstate",this.handleRouteChange),this.handleRouteChange=null),this.isStarted=!1,this.listeners.clear(),this.componentCache.clear(),this.keepAliveCache.clear(),this.keepAliveKeys=[],this.currentRoute=null,i=null}getCurrentRoute(){return this.currentRoute}getKeepAlive(e){const t=this.keepAliveCache.get(e);if(t){const t=this.keepAliveKeys.indexOf(e);-1!==t&&(this.keepAliveKeys.splice(t,1),this.keepAliveKeys.push(e))}return t}setKeepAlive(e,t){if(this.keepAliveCache.has(e)){this.keepAliveCache.set(e,t);const s=this.keepAliveKeys.indexOf(e);-1!==s&&(this.keepAliveKeys.splice(s,1),this.keepAliveKeys.push(e))}else this.keepAliveCache.set(e,t),this.keepAliveKeys.push(e),this.evictKeepAlive()}hasKeepAlive(e){return this.keepAliveCache.has(e)}evictKeepAlive(){if(this.maxKeepAlive)for(;this.keepAliveKeys.length>this.maxKeepAlive;){const e=this.keepAliveKeys.shift();e&&this.keepAliveCache.delete(e)}}cacheKey(e){return this.normalizePath(e)}prefetch(e){const t=this.matchRoute(e);if(!t)return;const s=this.cacheKey(t.fullPath),i=t.matched[t.matched.length-1];if(!(null==i?void 0:i.config.component))return;const a=i.config.component;if("function"!=typeof a)return;if(this.componentCache.has(s))return;const r=a();this.componentCache.set(s,r),r.catch(()=>{this.componentCache.delete(s)})}getComponentFromCache(e){return this.componentCache.get(this.cacheKey(e))}};t(l,"MAX_REDIRECTS",20);let u=l;export{u as Router,o as createRouter,c as getRouter,h as routerReady};
1
+ var e=Object.defineProperty,t=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,"symbol"!=typeof s?s+"":s,i);import{IS_DEV as s}from"../shared/env.js";let i=null,a=null,r=null;function n(){return i?Promise.resolve(i):(r||(r=new Promise(e=>{a=e})),r)}const h=(()=>{const e=()=>n();return Object.defineProperties(e,{then:{value:(e,t)=>n().then(e,t),writable:!1,enumerable:!1,configurable:!0},catch:{value:e=>n().catch(e),writable:!1,enumerable:!1,configurable:!0},finally:{value:e=>n().finally(e),writable:!1,enumerable:!1,configurable:!0},[Symbol.toStringTag]:{value:"Promise",writable:!1,enumerable:!1,configurable:!0}}),e})();function o(e){return i||(i=new u(e),a&&a(i),a=null,r=null,i)}function c(){return i}const l=class e{constructor(e){t(this,"routes"),t(this,"base"),t(this,"mode"),t(this,"beforeEachGuard"),t(this,"afterEachGuard"),t(this,"currentRoute",null),t(this,"listeners",new Set),t(this,"componentCache",new Map),t(this,"keepAliveCache",new Map),t(this,"keepAliveKeys",[]),t(this,"navigationId",0),t(this,"maxKeepAlive"),t(this,"isStarted",!1),t(this,"handleRouteChange",null),this.routes=e.routes,this.base=this.normalizeBase(e.base),this.mode=e.mode||"history",this.beforeEachGuard=e.beforeEach,this.afterEachGuard=e.afterEach,this.maxKeepAlive=e.maxKeepAlive}normalizeBase(e){let t=e||"/";return t.startsWith("/")||(t="/"+t),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t}matchRoute(e="/"){return this.matchRouteInternal(e,new Set,0)}matchRouteInternal(t,i,a){if(a>=e.MAX_REDIRECTS)return s&&console.error(`[Router] Too many redirects (max ${e.MAX_REDIRECTS}), last path: ${t}`),null;const r=this.normalizePath(t);if(i.has(r))return s&&console.error(`[Router] Circular redirect detected: ${r}`),null;i.add(r);const[n,h]=r.split("?"),o=n.split("/").filter(Boolean),c=this.parseQuery(h),l=this.recursiveMatch(this.routes,o);if(l){const e=l.matched[l.matched.length-1];return e.config.redirect?this.matchRouteInternal(e.config.redirect,i,a+1):{matched:l.matched,params:l.params,query:c,fullPath:r,meta:l.matched.reduce((e,t)=>({...e,...t.config.meta||{}}),{})}}return null}recursiveMatch(e,t){const s=[...e].sort((e,t)=>this.calculateScore(t.path)-this.calculateScore(e.path));for(const i of s){const e=i.path.split("/").filter(Boolean),s={};let a=!0;if(0===e.length&&0===t.length)return{matched:[{config:i,params:{}}],params:{}};for(let i=0;i<e.length;i++){const r=e[i],n=t[i];if(r.startsWith(":")){if(!n){a=!1;break}Object.defineProperty(s,r.slice(1),{value:n,writable:!0,enumerable:!0,configurable:!0})}else{if("*"===r){a=!0;break}if(r!==n){a=!1;break}}}if(a){const a=e.length,r=t.slice(a),n={config:i,params:s};if(r.length>0&&i.children){const e=this.recursiveMatch(i.children,r);if(e)return{matched:[n,...e.matched],params:{...s,...e.params}}}else if(0===r.length||e.includes("*"))return{matched:[n],params:s}}}return null}calculateScore(e="/"){const t=e.split("/").filter(Boolean);return 0===t.length?1:t.reduce((e,t)=>t.startsWith(":")?e+5:"*"===t?e+0:e+10,0)}parseQuery(e){const t={};return e?(new URLSearchParams(e).forEach((e,s)=>{Object.defineProperty(t,s,{value:e,writable:!0,enumerable:!0,configurable:!0})}),t):t}normalizePath(e="/"){const t=e&&"string"==typeof e?e:"/",s=t.indexOf("?"),i=-1===s?t:t.slice(0,s),a=-1===s?"":t.slice(s+1);let r=i;return r.startsWith("/")||(r="/"+r),r.length>1&&r.endsWith("/")&&(r=r.slice(0,-1)),a?`${r}?${a}`:r}getPath(){let e;try{e="hash"===this.mode?window.location.hash.slice(1)||"/":`${window.location.pathname}${window.location.search}`}catch{e="/"}const t=this.base||"/";return"/"===t||e!==t&&!e.startsWith(t+"/")||(e=e.slice(t.length)||"/"),this.normalizePath(e)}updateBrowserHistory(e="/",t){const s=this.normalizePath(e),i=this.base||"/";if("hash"===this.mode)t?window.location.replace(`#${s}`):window.location.hash=s;else{const e=i.endsWith("/")?i.slice(0,-1):i,a="/"===e?s:e+s;t?window.history.replaceState({path:a},"",a):window.history.pushState({path:a},"",a)}}async navigate(e="/",t=!1,s=!1){const i=++this.navigationId,a=this.normalizePath(e),r=this.currentRoute,n=this.matchRoute(a);if(!n)return{success:!1,error:`No route matched: ${a}`};if(r&&r.fullPath===n.fullPath)return{success:!0};if(this.beforeEachGuard)try{const e=await this.beforeEachGuard(n,r);if(i!==this.navigationId)return{success:!1,cancelled:!0};if(!1===e)return{success:!1,cancelled:!0};if("string"==typeof e)return this.navigate(e,t)}catch(h){return i!==this.navigationId?{success:!1,cancelled:!0}:{success:!1,error:h instanceof Error?h.message:"Guard Error"}}return i!==this.navigationId?{success:!1,cancelled:!0}:(this.currentRoute=n,s||this.updateBrowserHistory(a,t),this.notifyListeners(),this.afterEachGuard&&this.afterEachGuard(n,r),{success:!0})}resolve(e="/"){const t=this.normalizePath(e);if("hash"===this.mode)return`#${t}`;const s=this.base.endsWith("/")?this.base.slice(0,-1):this.base;return"/"===s?t:s+t}get modeType(){return this.mode}pushWithQuery(e="/",t){const s=new URLSearchParams(t).toString(),i=e.includes("?")?"&":"?";return this.push(e+(s?i+s:""))}push(e="/"){return this.navigate(e,!1)}replace(e="/"){return this.navigate(e,!0)}back(){window.history.back()}forward(){window.history.forward()}listen(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notifyListeners(){this.listeners.forEach(e=>e())}setupListeners(){this.isStarted||(this.isStarted=!0,this.handleRouteChange=()=>{this.navigate(this.getPath(),!0,!0)},"hash"===this.mode?window.addEventListener("hashchange",this.handleRouteChange):window.addEventListener("popstate",this.handleRouteChange),"hash"!==this.mode||window.location.hash||(window.location.hash="/"),this.navigate(this.getPath(),!0))}destroy(){this.handleRouteChange&&("hash"===this.mode?window.removeEventListener("hashchange",this.handleRouteChange):window.removeEventListener("popstate",this.handleRouteChange),this.handleRouteChange=null),this.isStarted=!1,this.listeners.clear(),this.componentCache.clear(),this.keepAliveCache.clear(),this.keepAliveKeys=[],this.currentRoute=null,i=null}getCurrentRoute(){return this.currentRoute}getKeepAlive(e){const t=this.keepAliveCache.get(e);if(t){const t=this.keepAliveKeys.indexOf(e);-1!==t&&(this.keepAliveKeys.splice(t,1),this.keepAliveKeys.push(e))}return t}setKeepAlive(e,t){if(this.keepAliveCache.has(e)){this.keepAliveCache.set(e,t);const s=this.keepAliveKeys.indexOf(e);-1!==s&&(this.keepAliveKeys.splice(s,1),this.keepAliveKeys.push(e))}else this.keepAliveCache.set(e,t),this.keepAliveKeys.push(e),this.evictKeepAlive()}hasKeepAlive(e){return this.keepAliveCache.has(e)}evictKeepAlive(){if(this.maxKeepAlive)for(;this.keepAliveKeys.length>this.maxKeepAlive;){const e=this.keepAliveKeys.shift();e&&this.keepAliveCache.delete(e)}}cacheKey(e){return this.normalizePath(e)}prefetch(e){const t=this.matchRoute(e);if(!t)return;const s=this.cacheKey(t.fullPath),i=t.matched[t.matched.length-1];if(!(null==i?void 0:i.config.component))return;const a=i.config.component;if("function"!=typeof a)return;if(this.componentCache.has(s))return;const r=a();this.componentCache.set(s,r),r.catch(()=>{this.componentCache.delete(s)})}getComponentFromCache(e){return this.componentCache.get(this.cacheKey(e))}};t(l,"MAX_REDIRECTS",20);let u=l;export{u as Router,o as createRouter,c as getRouter,h as routerReady};
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./core.cjs"),e=require("./router-link.html.cjs"),a=require("../runtime/component/base-element.cjs"),s=require("../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;var r,o=t=>{throw TypeError(t)},n=(t,e,a)=>e.has(t)||o("Cannot "+a);exports.default=class extends a.default{constructor(){var t,e;super(...arguments),t=this,(e=r).has(t)?o("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,false)}set to(t){this.$data.to=t,this.updateState()}get to(){return this.$data.to}async mounted(){(await t.routerReady()).listen(()=>this.updateState()),this.updateState(),this.addEventListener("click",e=>{var a,s;e.defaultPrevented||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||0===e.button&&((null==(a=e.target.closest("a"))?void 0:a.getAttribute("target"))||(e.preventDefault(),null==(s=t.getRouter())||s.push(this.$data.to)))}),this.addEventListener("mouseenter",()=>{this.prefetchRoute()},{once:!0})}updateState(){const e=t.getRouter();if(!e)return;this.$data.href=e.resolve(this.$data.to);let a=!1;if(this.$data.active)a=!0;else{const t=e.getCurrentRoute();if(t){const e=t.fullPath;a=this.hasAttribute("exact")?e===this.$data.to:e===this.$data.to||e.startsWith(this.$data.to+"/")}}this.$data.isActive=a;const s=this.$data.activeClass||"active";this.classList.toggle(s,a)}prefetchRoute(){if(n(this,e=r,"read from private field"),e.get(this)||!this.hasAttribute("prefetch"))return;var e;const a=t.getRouter();a&&(a.prefetch(this.$data.to),((t,e)=>{n(t,e,"write to private field"),e.set(t,!0)})(this,r))}},r=new WeakMap,exports.default=((t,e)=>{for(var a,s=e,r=t.length-1;r>=0;r--)(a=t[r])&&(s=a(s)||s);return s})([s.CustomElement({tagName:"router-link",template:e.__SOLELY_IR__,styles:"\n :host {\n }\n\n a {\n text-decoration: none;\n color: inherit;\n cursor: pointer;\n }\n\n /* 内部 <a> 标签的默认高亮 */\n a.active {\n font-weight: 600;\n }\n\n /* custom 模式:消除包裹 a 标签的视觉/布局影响,由 slot 内部元素接管 */\n :host([custom]) a {\n display: contents;\n }\n ",shadowDOM:{use:!0,mode:"open"},props:["to","active","exact","label","custom","activeClass","prefetch"]})],exports.default);
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./core.cjs"),e=require("./router-link.html.cjs"),s=require("../runtime/component/base-element.cjs"),a=require("../runtime/component/decorators.cjs");var i,n=Object.defineProperty,r=(Object.getOwnPropertyDescriptor,t=>{throw TypeError(t)}),o=(t,e,s)=>((t,e,s)=>e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s)(t,"symbol"!=typeof e?e+"":e,s),u=(t,e,s)=>e.has(t)||r("Cannot "+s);exports.default=class extends s.default{constructor(){var e,s;super(...arguments),e=this,(s=i).has(e)?r("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(e):s.set(e,false),o(this,"unsubscribe"),o(this,"mountVersion",0),o(this,"handleClick",e=>{var s,a;e.defaultPrevented||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||0===e.button&&((null==(s=e.target.closest("a"))?void 0:s.getAttribute("target"))||(e.preventDefault(),null==(a=t.getRouter())||a.push(this.$data.to)))}),o(this,"handleMouseEnter",()=>{this.prefetchRoute()})}set to(t){this.$data.to=t,this.updateState()}get to(){return this.$data.to}async mounted(){const e=++this.mountVersion,s=await t.routerReady();this.mountVersion===e&&(this.unsubscribe=s.listen(()=>this.updateState()),this.updateState(),this.addEventListener("click",this.handleClick),this.addEventListener("mouseenter",this.handleMouseEnter,{once:!0}))}unmounted(){var t;this.mountVersion++,null==(t=this.unsubscribe)||t.call(this),this.unsubscribe=void 0,this.removeEventListener("click",this.handleClick),this.removeEventListener("mouseenter",this.handleMouseEnter)}updateState(){const e=t.getRouter();if(!e)return;this.$data.href=e.resolve(this.$data.to);let s=!1;if(this.$data.active)s=!0;else{const t=e.getCurrentRoute();if(t){const e=t.fullPath;if(this.hasAttribute("exact"))s=e===this.$data.to;else{const t=e.split("?")[0],a=this.$data.to.split("?")[0];s=t===a||t.startsWith(a+"/")}}}this.$data.isActive=s;const a=this.$data.activeClass||"active";this.classList.toggle(a,s)}prefetchRoute(){if(u(this,e=i,"read from private field"),e.get(this)||!this.hasAttribute("prefetch"))return;var e;const s=t.getRouter();s&&(s.prefetch(this.$data.to),((t,e)=>{u(t,e,"write to private field"),e.set(t,!0)})(this,i))}},i=new WeakMap,exports.default=((t,e)=>{for(var s,a=e,i=t.length-1;i>=0;i--)(s=t[i])&&(a=s(a)||a);return a})([a.CustomElement({tagName:"router-link",template:e.__SOLELY_IR__,styles:"\n :host {\n }\n\n a {\n text-decoration: none;\n color: inherit;\n cursor: pointer;\n }\n\n /* 内部 <a> 标签的默认高亮 */\n a.active {\n font-weight: 600;\n }\n\n /* custom 模式:消除包裹 a 标签的视觉/布局影响,由 slot 内部元素接管 */\n :host([custom]) a {\n display: contents;\n }\n ",shadowDOM:{use:!0,mode:"open"},props:["to","active","exact","label","custom","activeClass","prefetch"]})],exports.default);
@@ -12,7 +12,12 @@ declare class RouterLink extends BaseElement<{
12
12
  #private;
13
13
  set to(value: string);
14
14
  get to(): string;
15
+ private unsubscribe?;
16
+ private mountVersion;
17
+ private readonly handleClick;
18
+ private readonly handleMouseEnter;
15
19
  mounted(): Promise<void>;
20
+ unmounted(): void;
16
21
  updateState(): void;
17
22
  private prefetchRoute;
18
23
  }
@@ -1 +1 @@
1
- import{routerReady as t,getRouter as e}from"./core.js";import{__SOLELY_IR__ as a}from"./router-link.html.js";import s from"../runtime/component/base-element.js";import{CustomElement as r}from"../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;var o,n=t=>{throw TypeError(t)},i=(t,e,a)=>e.has(t)||n("Cannot "+a);let h=class extends s{constructor(){var t,e;super(...arguments),t=this,(e=o).has(t)?n("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,false)}set to(t){this.$data.to=t,this.updateState()}get to(){return this.$data.to}async mounted(){(await t()).listen(()=>this.updateState()),this.updateState(),this.addEventListener("click",t=>{var a,s;t.defaultPrevented||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||0===t.button&&((null==(a=t.target.closest("a"))?void 0:a.getAttribute("target"))||(t.preventDefault(),null==(s=e())||s.push(this.$data.to)))}),this.addEventListener("mouseenter",()=>{this.prefetchRoute()},{once:!0})}updateState(){const t=e();if(!t)return;this.$data.href=t.resolve(this.$data.to);let a=!1;if(this.$data.active)a=!0;else{const e=t.getCurrentRoute();if(e){const t=e.fullPath;a=this.hasAttribute("exact")?t===this.$data.to:t===this.$data.to||t.startsWith(this.$data.to+"/")}}this.$data.isActive=a;const s=this.$data.activeClass||"active";this.classList.toggle(s,a)}prefetchRoute(){if(i(this,t=o,"read from private field"),t.get(this)||!this.hasAttribute("prefetch"))return;var t;const a=e();a&&(a.prefetch(this.$data.to),((t,e)=>{i(t,e,"write to private field"),e.set(t,!0)})(this,o))}};o=new WeakMap,h=((t,e)=>{for(var a,s=e,r=t.length-1;r>=0;r--)(a=t[r])&&(s=a(s)||s);return s})([r({tagName:"router-link",template:a,styles:"\n :host {\n }\n\n a {\n text-decoration: none;\n color: inherit;\n cursor: pointer;\n }\n\n /* 内部 <a> 标签的默认高亮 */\n a.active {\n font-weight: 600;\n }\n\n /* custom 模式:消除包裹 a 标签的视觉/布局影响,由 slot 内部元素接管 */\n :host([custom]) a {\n display: contents;\n }\n ",shadowDOM:{use:!0,mode:"open"},props:["to","active","exact","label","custom","activeClass","prefetch"]})],h);export{h as default};
1
+ import{routerReady as t,getRouter as e}from"./core.js";import{__SOLELY_IR__ as s}from"./router-link.html.js";import i from"../runtime/component/base-element.js";import{CustomElement as n}from"../runtime/component/decorators.js";var a,r=Object.defineProperty,o=(Object.getOwnPropertyDescriptor,t=>{throw TypeError(t)}),h=(t,e,s)=>((t,e,s)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s)(t,"symbol"!=typeof e?e+"":e,s),l=(t,e,s)=>e.has(t)||o("Cannot "+s);let c=class extends i{constructor(){var t,s;super(...arguments),t=this,(s=a).has(t)?o("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(t):s.set(t,false),h(this,"unsubscribe"),h(this,"mountVersion",0),h(this,"handleClick",t=>{var s,i;t.defaultPrevented||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||0===t.button&&((null==(s=t.target.closest("a"))?void 0:s.getAttribute("target"))||(t.preventDefault(),null==(i=e())||i.push(this.$data.to)))}),h(this,"handleMouseEnter",()=>{this.prefetchRoute()})}set to(t){this.$data.to=t,this.updateState()}get to(){return this.$data.to}async mounted(){const e=++this.mountVersion,s=await t();this.mountVersion===e&&(this.unsubscribe=s.listen(()=>this.updateState()),this.updateState(),this.addEventListener("click",this.handleClick),this.addEventListener("mouseenter",this.handleMouseEnter,{once:!0}))}unmounted(){var t;this.mountVersion++,null==(t=this.unsubscribe)||t.call(this),this.unsubscribe=void 0,this.removeEventListener("click",this.handleClick),this.removeEventListener("mouseenter",this.handleMouseEnter)}updateState(){const t=e();if(!t)return;this.$data.href=t.resolve(this.$data.to);let s=!1;if(this.$data.active)s=!0;else{const e=t.getCurrentRoute();if(e){const t=e.fullPath;if(this.hasAttribute("exact"))s=t===this.$data.to;else{const e=t.split("?")[0],i=this.$data.to.split("?")[0];s=e===i||e.startsWith(i+"/")}}}this.$data.isActive=s;const i=this.$data.activeClass||"active";this.classList.toggle(i,s)}prefetchRoute(){if(l(this,t=a,"read from private field"),t.get(this)||!this.hasAttribute("prefetch"))return;var t;const s=e();s&&(s.prefetch(this.$data.to),((t,e)=>{l(t,e,"write to private field"),e.set(t,!0)})(this,a))}};a=new WeakMap,c=((t,e)=>{for(var s,i=e,n=t.length-1;n>=0;n--)(s=t[n])&&(i=s(i)||i);return i})([n({tagName:"router-link",template:s,styles:"\n :host {\n }\n\n a {\n text-decoration: none;\n color: inherit;\n cursor: pointer;\n }\n\n /* 内部 <a> 标签的默认高亮 */\n a.active {\n font-weight: 600;\n }\n\n /* custom 模式:消除包裹 a 标签的视觉/布局影响,由 slot 内部元素接管 */\n :host([custom]) a {\n display: contents;\n }\n ",shadowDOM:{use:!0,mode:"open"},props:["to","active","exact","label","custom","activeClass","prefetch"]})],c);export{c as default};