solely 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/commands/drawer/index.cjs +1 -1
- package/dist/components/commands/drawer/index.js +1 -1
- package/dist/components/commands/drawer/style.css.cjs +1 -1
- package/dist/components/commands/drawer/style.css.js +1 -1
- package/dist/components/commands/message/index.cjs +1 -1
- package/dist/components/commands/message/index.js +1 -1
- package/dist/components/commands/message/style.css.cjs +1 -1
- package/dist/components/commands/message/style.css.js +1 -1
- package/dist/components/commands/modal/index.cjs +1 -1
- package/dist/components/commands/modal/index.js +1 -1
- package/dist/components/commands/modal/style.css.cjs +1 -1
- package/dist/components/commands/modal/style.css.js +1 -1
- package/dist/components/commands/popconfirm/index.cjs +1 -1
- package/dist/components/commands/popconfirm/index.js +1 -1
- package/dist/components/commands/popconfirm/style.css.cjs +1 -1
- package/dist/components/commands/popconfirm/style.css.js +1 -1
- package/dist/components/commands/tooltip/index.cjs +1 -1
- package/dist/components/commands/tooltip/index.js +1 -1
- package/dist/components/commands/tooltip/style.css.cjs +1 -1
- package/dist/components/commands/tooltip/style.css.js +1 -1
- package/dist/router/core.cjs +1 -1
- package/dist/router/core.d.ts +20 -28
- package/dist/router/core.js +1 -1
- package/dist/router/router-link.cjs +1 -1
- package/dist/router/router-link.js +1 -1
- package/dist/router/router-view.cjs +1 -1
- package/dist/router/router-view.d.ts +6 -4
- package/dist/router/router-view.js +1 -1
- package/dist/router/types.d.ts +7 -0
- package/dist/shared/env.cjs +1 -1
- package/dist/shared/env.js +1 -1
- package/package.json +32 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),l={width:378,height:378,mask:!0,maskClosable:!0,closable:!0},n=[],s=new Set;let o=null;async function a(t){var l;if(!s.has(t)){s.add(t);try{const s=n.findIndex(e=>e.id===t);if(-1===s)return;const o=n[s],a=o.element.querySelector(".solely-drawer-mask"),i=o.element.querySelector(".solely-drawer");a&&a.classList.add("is-closing"),i&&i.classList.add("is-closing"),await e.addClosingAnimation(o.element,e.ANIMATION_DURATION.NORMAL),null==(l=o.cleanup)||l.call(o);const r=n.findIndex(e=>e.id===t);-1!==r&&(n[r].element.remove(),n.splice(r,1)),0===n.length&&document.body.classList.remove("solely-drawer-open")}finally{s.delete(t)}}}const i={open:function(s){const i=e.generateId();e.injectStyle("solely-drawer-styles",t.default);const r=s.placement||"right",d=s.width??l.width,c=s.height??l.height,m=s.mask??l.mask,y=s.maskClosable??l.maskClosable,h=s.closable??l.closable,p=e.createElement("div",{className:"solely-drawer-wrap"}),u=function(e){return(()=>{const t=document.documentElement.getAttribute("data-theme");t?e.setAttribute("data-theme",t):e.removeAttribute("data-theme")})(),o||(o=new MutationObserver(()=>{n.forEach(e=>{const t=document.documentElement.getAttribute("data-theme");t?e.element.setAttribute("data-theme",t):e.element.removeAttribute("data-theme")})}),o.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})),()=>{o&&0===n.length&&(o.disconnect(),o=null)}}(p),f=[];if(!1!==m){const t=e.createElement("div",{className:"solely-drawer-mask"});if(y){const e=()=>{var e;a(i),null==(e=s.onClose)||e.call(s)};t.addEventListener("click",e),f.push({element:t,type:"click",handler:e})}p.appendChild(t)}const b=e.createElement("div",{className:`solely-drawer solely-drawer--${r}${s.className?` ${s.className}`:""}`,styles:s.style});if("left"===r||"right"===r?b.style.width="number"==typeof d?`${d}px`:d:b.style.height="number"==typeof c?`${c}px`:c,s.title||!1!==h){const t=e.createElement("div",{className:"solely-drawer__header"});if(s.title){const l=e.createElement("h3",{className:"solely-drawer__title"});"string"==typeof s.title?l.textContent=s.title:s.title instanceof HTMLElement&&l.appendChild(s.title.cloneNode(!0)),t.appendChild(l)}if(!1!==h){const l=e.createElement("button",{className:"solely-drawer__close",textContent:"×",attrs:{type:"button","aria-label":"关闭"}}),n=()=>{var e;a(i),null==(e=s.onClose)||e.call(s)};l.addEventListener("click",n),f.push({element:l,type:"click",handler:n}),t.appendChild(l)}b.appendChild(t)}const w=e.createElement("div",{className:"solely-drawer__body",styles:s.bodyStyle});return"string"==typeof s.content?w.textContent=s.content||"":s.content instanceof HTMLElement&&w.appendChild(s.content.cloneNode(!0)),b.appendChild(w),p.appendChild(b),document.body.appendChild(p),document.body.classList.add("solely-drawer-open"),n.push({id:i,element:p,options:s,cleanup:()=>{f.forEach(({element:e,type:t,handler:l})=>{e.removeEventListener(t,l)}),u()}}),{close:()=>{var e;a(i),null==(e=s.onClose)||e.call(s)},update:t=>{if(void 0!==t.title){const l=p.querySelector(".solely-drawer__title");if(l)l.innerHTML="","string"==typeof t.title?l.textContent=t.title:t.title instanceof HTMLElement&&l.appendChild(t.title.cloneNode(!0));else if(t.title){const l=e.createElement("div",{className:"solely-drawer__header"}),n=e.createElement("h3",{className:"solely-drawer__title"});"string"==typeof t.title?n.textContent=t.title:t.title instanceof HTMLElement&&n.appendChild(t.title.cloneNode(!0)),l.appendChild(n);const s=p.querySelector(".solely-drawer");null==s||s.insertBefore(l,s.firstChild)}}if(void 0!==t.content){const e=p.querySelector(".solely-drawer__body");e&&(e.innerHTML="","string"==typeof t.content?e.textContent=t.content:t.content instanceof HTMLElement&&e.appendChild(t.content.cloneNode(!0)))}const l=p.querySelector(".solely-drawer");if(l){const e=t.placement||s.placement||"right";void 0===t.width||"left"!==e&&"right"!==e||(l.style.width="number"==typeof t.width?`${t.width}px`:t.width),void 0===t.height||"top"!==e&&"bottom"!==e||(l.style.height="number"==typeof t.height?`${t.height}px`:t.height)}if(void 0!==t.className&&l){const e=s.placement||"right";l.className=`solely-drawer solely-drawer--${e} ${t.className}`.trim()}if(void 0!==t.style&&l&&Object.assign(l.style,t.style),void 0!==t.bodyStyle){const e=p.querySelector(".solely-drawer__body");e&&Object.assign(e.style,t.bodyStyle)}}}},config:function(e){Object.assign(l,e)},destroy:async function(){const e=[...n].reverse();for(const t of e)await a(t.id)}};exports.Drawer=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createElement as e,addClosingAnimation as t,ANIMATION_DURATION as
|
|
1
|
+
import{createElement as e,addClosingAnimation as t,ANIMATION_DURATION as l,injectStyle as n,generateId as s}from"../utils.js";import o from"./style.css.js";const i={width:378,height:378,mask:!0,maskClosable:!0,closable:!0},a=[],d=new Set;let r=null;async function c(e){var n;if(!d.has(e)){d.add(e);try{const s=a.findIndex(t=>t.id===e);if(-1===s)return;const o=a[s],i=o.element.querySelector(".solely-drawer-mask"),d=o.element.querySelector(".solely-drawer");i&&i.classList.add("is-closing"),d&&d.classList.add("is-closing"),await t(o.element,l.NORMAL),null==(n=o.cleanup)||n.call(o);const r=a.findIndex(t=>t.id===e);-1!==r&&(a[r].element.remove(),a.splice(r,1)),0===a.length&&document.body.classList.remove("solely-drawer-open")}finally{d.delete(e)}}}const m={open:function(t){const l=s();n("solely-drawer-styles",o);const d=t.placement||"right",m=t.width??i.width,y=t.height??i.height,h=t.mask??i.mask,p=t.maskClosable??i.maskClosable,u=t.closable??i.closable,f=e("div",{className:"solely-drawer-wrap"}),b=function(e){return(()=>{const t=document.documentElement.getAttribute("data-theme");t?e.setAttribute("data-theme",t):e.removeAttribute("data-theme")})(),r||(r=new MutationObserver(()=>{a.forEach(e=>{const t=document.documentElement.getAttribute("data-theme");t?e.element.setAttribute("data-theme",t):e.element.removeAttribute("data-theme")})}),r.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})),()=>{r&&0===a.length&&(r.disconnect(),r=null)}}(f),w=[];if(!1!==h){const n=e("div",{className:"solely-drawer-mask"});if(p){const e=()=>{var e;c(l),null==(e=t.onClose)||e.call(t)};n.addEventListener("click",e),w.push({element:n,type:"click",handler:e})}f.appendChild(n)}const g=e("div",{className:`solely-drawer solely-drawer--${d}${t.className?` ${t.className}`:""}`,styles:t.style});if("left"===d||"right"===d?g.style.width="number"==typeof m?`${m}px`:m:g.style.height="number"==typeof y?`${y}px`:y,t.title||!1!==u){const n=e("div",{className:"solely-drawer__header"});if(t.title){const l=e("h3",{className:"solely-drawer__title"});"string"==typeof t.title?l.textContent=t.title:t.title instanceof HTMLElement&&l.appendChild(t.title.cloneNode(!0)),n.appendChild(l)}if(!1!==u){const s=e("button",{className:"solely-drawer__close",textContent:"×",attrs:{type:"button","aria-label":"关闭"}}),o=()=>{var e;c(l),null==(e=t.onClose)||e.call(t)};s.addEventListener("click",o),w.push({element:s,type:"click",handler:o}),n.appendChild(s)}g.appendChild(n)}const v=e("div",{className:"solely-drawer__body",styles:t.bodyStyle});return"string"==typeof t.content?v.textContent=t.content||"":t.content instanceof HTMLElement&&v.appendChild(t.content.cloneNode(!0)),g.appendChild(v),f.appendChild(g),document.body.appendChild(f),document.body.classList.add("solely-drawer-open"),a.push({id:l,element:f,options:t,cleanup:()=>{w.forEach(({element:e,type:t,handler:l})=>{e.removeEventListener(t,l)}),b()}}),{close:()=>{var e;c(l),null==(e=t.onClose)||e.call(t)},update:l=>{if(void 0!==l.title){const t=f.querySelector(".solely-drawer__title");if(t)t.innerHTML="","string"==typeof l.title?t.textContent=l.title:l.title instanceof HTMLElement&&t.appendChild(l.title.cloneNode(!0));else if(l.title){const t=e("div",{className:"solely-drawer__header"}),n=e("h3",{className:"solely-drawer__title"});"string"==typeof l.title?n.textContent=l.title:l.title instanceof HTMLElement&&n.appendChild(l.title.cloneNode(!0)),t.appendChild(n);const s=f.querySelector(".solely-drawer");null==s||s.insertBefore(t,s.firstChild)}}if(void 0!==l.content){const e=f.querySelector(".solely-drawer__body");e&&(e.innerHTML="","string"==typeof l.content?e.textContent=l.content:l.content instanceof HTMLElement&&e.appendChild(l.content.cloneNode(!0)))}const n=f.querySelector(".solely-drawer");if(n){const e=l.placement||t.placement||"right";void 0===l.width||"left"!==e&&"right"!==e||(n.style.width="number"==typeof l.width?`${l.width}px`:l.width),void 0===l.height||"top"!==e&&"bottom"!==e||(n.style.height="number"==typeof l.height?`${l.height}px`:l.height)}if(void 0!==l.className&&n){const e=t.placement||"right";n.className=`solely-drawer solely-drawer--${e} ${l.className}`.trim()}if(void 0!==l.style&&n&&Object.assign(n.style,l.style),void 0!==l.bodyStyle){const e=f.querySelector(".solely-drawer__body");e&&Object.assign(e.style,l.bodyStyle)}}}},config:function(e){Object.assign(i,e)},destroy:async function(){const e=[...a].reverse();for(const t of e)await c(t.id)}};export{m as Drawer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default="
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default=".solely-drawer,.solely-drawer *,.solely-drawer *:before,.solely-drawer *:after,.solely-drawer-mask,.solely-drawer-wrap{box-sizing:border-box}.solely-drawer-mask{position:fixed;top:0;left:0;right:0;bottom:0;background-color:var(--solely-mask-bg);z-index:1;pointer-events:auto;animation:solely-drawer-mask-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-drawer-mask.is-closing{animation:solely-drawer-mask-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-drawer-wrap{position:fixed;top:0;left:0;right:0;bottom:0;z-index:var(--solely-z-index-modal);pointer-events:none}.solely-drawer{position:absolute;background-color:var(--solely-component-bg);box-shadow:var(--solely-shadow-lg);pointer-events:auto;display:flex;flex-direction:column;z-index:2}.solely-drawer--left{left:0;top:0;bottom:0;animation:solely-drawer-left-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-drawer--right{right:0;top:0;bottom:0;animation:solely-drawer-right-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-drawer--top{top:0;left:0;right:0;animation:solely-drawer-top-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-drawer--bottom{bottom:0;left:0;right:0;animation:solely-drawer-bottom-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-drawer.is-closing.solely-drawer--left{animation:solely-drawer-left-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-drawer.is-closing.solely-drawer--right{animation:solely-drawer-right-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-drawer.is-closing.solely-drawer--top{animation:solely-drawer-top-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-drawer.is-closing.solely-drawer--bottom{animation:solely-drawer-bottom-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-drawer__header{display:flex;align-items:center;justify-content:space-between;padding:var(--solely-spacing-lg) var(--solely-spacing-xl);border-bottom:1px solid var(--solely-border-color-split)}.solely-drawer__title{margin:0;font-size:var(--solely-font-size-lg);font-weight:500;color:var(--solely-text-primary);line-height:var(--solely-line-height-lg)}.solely-drawer__close{width:var(--solely-height-sm);height:var(--solely-height-sm);display:flex;align-items:center;justify-content:center;color:var(--solely-text-tertiary);cursor:pointer;transition:color var(--solely-transition-duration);font-size:var(--solely-font-size-lg);line-height:1;border:none;background:none;border-radius:var(--solely-border-radius-sm)}.solely-drawer__close:hover{color:var(--solely-text-secondary);background-color:var(--solely-gray-3)}.solely-drawer__close:active{color:var(--solely-text-primary)}.solely-drawer__body{flex:1;padding:var(--solely-spacing-xl);overflow:auto;font-size:var(--solely-font-size-md);line-height:var(--solely-line-height-md);color:var(--solely-text-secondary)}@keyframes solely-drawer-mask-in{0%{opacity:0}to{opacity:1}}@keyframes solely-drawer-mask-out{0%{opacity:1}to{opacity:0}}@keyframes solely-drawer-left-in{0%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes solely-drawer-left-out{0%{transform:translate(0)}to{transform:translate(-100%)}}@keyframes solely-drawer-right-in{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes solely-drawer-right-out{0%{transform:translate(0)}to{transform:translate(100%)}}@keyframes solely-drawer-top-in{0%{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes solely-drawer-top-out{0%{transform:translateY(0)}to{transform:translateY(-100%)}}@keyframes solely-drawer-bottom-in{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes solely-drawer-bottom-out{0%{transform:translateY(0)}to{transform:translateY(100%)}}";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const r="
|
|
1
|
+
const r=".solely-drawer,.solely-drawer *,.solely-drawer *:before,.solely-drawer *:after,.solely-drawer-mask,.solely-drawer-wrap{box-sizing:border-box}.solely-drawer-mask{position:fixed;top:0;left:0;right:0;bottom:0;background-color:var(--solely-mask-bg);z-index:1;pointer-events:auto;animation:solely-drawer-mask-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-drawer-mask.is-closing{animation:solely-drawer-mask-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-drawer-wrap{position:fixed;top:0;left:0;right:0;bottom:0;z-index:var(--solely-z-index-modal);pointer-events:none}.solely-drawer{position:absolute;background-color:var(--solely-component-bg);box-shadow:var(--solely-shadow-lg);pointer-events:auto;display:flex;flex-direction:column;z-index:2}.solely-drawer--left{left:0;top:0;bottom:0;animation:solely-drawer-left-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-drawer--right{right:0;top:0;bottom:0;animation:solely-drawer-right-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-drawer--top{top:0;left:0;right:0;animation:solely-drawer-top-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-drawer--bottom{bottom:0;left:0;right:0;animation:solely-drawer-bottom-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-drawer.is-closing.solely-drawer--left{animation:solely-drawer-left-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-drawer.is-closing.solely-drawer--right{animation:solely-drawer-right-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-drawer.is-closing.solely-drawer--top{animation:solely-drawer-top-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-drawer.is-closing.solely-drawer--bottom{animation:solely-drawer-bottom-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-drawer__header{display:flex;align-items:center;justify-content:space-between;padding:var(--solely-spacing-lg) var(--solely-spacing-xl);border-bottom:1px solid var(--solely-border-color-split)}.solely-drawer__title{margin:0;font-size:var(--solely-font-size-lg);font-weight:500;color:var(--solely-text-primary);line-height:var(--solely-line-height-lg)}.solely-drawer__close{width:var(--solely-height-sm);height:var(--solely-height-sm);display:flex;align-items:center;justify-content:center;color:var(--solely-text-tertiary);cursor:pointer;transition:color var(--solely-transition-duration);font-size:var(--solely-font-size-lg);line-height:1;border:none;background:none;border-radius:var(--solely-border-radius-sm)}.solely-drawer__close:hover{color:var(--solely-text-secondary);background-color:var(--solely-gray-3)}.solely-drawer__close:active{color:var(--solely-text-primary)}.solely-drawer__body{flex:1;padding:var(--solely-spacing-xl);overflow:auto;font-size:var(--solely-font-size-md);line-height:var(--solely-line-height-md);color:var(--solely-text-secondary)}@keyframes solely-drawer-mask-in{0%{opacity:0}to{opacity:1}}@keyframes solely-drawer-mask-out{0%{opacity:1}to{opacity:0}}@keyframes solely-drawer-left-in{0%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes solely-drawer-left-out{0%{transform:translate(0)}to{transform:translate(-100%)}}@keyframes solely-drawer-right-in{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes solely-drawer-right-out{0%{transform:translate(0)}to{transform:translate(100%)}}@keyframes solely-drawer-top-in{0%{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes solely-drawer-top-out{0%{transform:translateY(0)}to{transform:translateY(-100%)}}@keyframes solely-drawer-bottom-in{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes solely-drawer-bottom-out{0%{transform:translateY(0)}to{transform:translateY(100%)}}";export{r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),n={duration:3e3,maxCount:5,gap:8,top:24,bottom:24,left:24,right:24,placement:"top"};let o,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),n={duration:3e3,maxCount:5,gap:8,top:24,bottom:24,left:24,right:24,placement:"top"};let o,s=null;const i=new Set,l=[],a={info:"ℹ",success:"✓",warning:"⚠",error:"✕",loading:e.createElement("span",{className:"solely-message__loading-spinner"})},r=new Map;function c(t,n){const o=e.createElement("span",{className:`solely-message__icon solely-message__icon--${n}`});return"string"==typeof t?o.textContent=t:o.appendChild(t.cloneNode(!0)),o}async function p(t){var n;if(!i.has(t)){i.add(t);try{const i=l.findIndex(e=>e.id===t);if(-1===i)return;const c=l[i];c.timer&&(clearTimeout(c.timer),c.timer=void 0),await e.addClosingAnimation(c.element,e.ANIMATION_DURATION.NORMAL),c.element.remove();const p=l.findIndex(e=>e.id===t);-1!==p&&l.splice(p,1);try{null==(n=c.onClose)||n.call(c)}catch(a){console.error("[Solely Message] onClose callback error:",a)}o&&clearTimeout(o),o=window.setTimeout(()=>{0===l.length&&(r.forEach((e,t)=>{0===e.childElementCount&&(e.remove(),r.delete(t))}),0===r.size&&s&&(s.disconnect(),s=null)),o=void 0},300)}finally{i.delete(t)}}}function d(o){const i=e.generateId(),d=o.placement||n.placement,m=function(o=n.placement){const i=o;if(r.has(i))return r.get(i);const l=e.createElement("div",{className:"solely-message-container"}),a={position:"fixed",display:"flex",flexDirection:"column",gap:`${n.gap}px`,pointerEvents:"none",zIndex:String(e.Z_INDEX.TOAST)};switch(o){case"top":a.top=`${n.top}px`,a.left="50%",a.transform="translateX(-50%)";break;case"topLeft":a.top=`${n.top}px`,a.left=`${n.left}px`,a.alignItems="flex-start";break;case"topRight":a.top=`${n.top}px`,a.right=`${n.right}px`,a.alignItems="flex-end";break;case"bottom":a.bottom=`${n.bottom}px`,a.left="50%",a.transform="translateX(-50%)";break;case"bottomLeft":a.bottom=`${n.bottom}px`,a.left=`${n.left}px`,a.alignItems="flex-start";break;case"bottomRight":a.bottom=`${n.bottom}px`,a.right=`${n.right}px`,a.alignItems="flex-end";break;case"left":a.top="50%",a.left=`${n.left}px`,a.transform="translateY(-50%)",a.alignItems="flex-start";break;case"right":a.top="50%",a.right=`${n.right}px`,a.transform="translateY(-50%)",a.alignItems="flex-end"}Object.assign(l.style,a);const c=document.documentElement.getAttribute("data-theme");return c&&l.setAttribute("data-theme",c),document.body.appendChild(l),e.injectStyle("solely-message-styles",t.default),function(e){s&&s.disconnect(),s=new MutationObserver(()=>{const t=document.documentElement.getAttribute("data-theme");t?e.setAttribute("data-theme",t):e.removeAttribute("data-theme")}),s.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}(l),r.set(i,l),l}(d),u=l.filter(e=>e.placement===d);if(u.length>=n.maxCount){const e=u[0];e&&p(e.id)}const f=function(t,n){const o=t.type||"info",s=!1!==t.showIcon,i=e.createElement("div",{className:`solely-message solely-message--${o}${t.className?` ${t.className}`:""}`,styles:t.style});if(i.setAttribute("role","error"===o||"warning"===o?"alert":"status"),i.setAttribute("aria-live","error"===o||"warning"===o?"assertive":"polite"),s){const e=t.icon?c(t.icon,o):c(a[o],o);i.appendChild(e)}const l=e.createElement("span",{className:"solely-message__content"}),r=e.createElement("span",{className:"solely-message__text"});if("string"==typeof t.content?r.textContent=t.content:t.content instanceof HTMLElement&&r.appendChild(t.content.cloneNode(!0)),l.appendChild(r),t.description){const n=e.createElement("span",{className:"solely-message__description"});"string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(t.description.cloneNode(!0)),l.appendChild(n)}if(i.appendChild(l),t.closable){const t=e.createElement("button",{className:"solely-message__close",textContent:"×",attrs:{type:"button","aria-label":"关闭"}});t.onclick=()=>p(n),i.appendChild(t)}return i}(o,i);m.appendChild(f);const g={id:i,element:f,onClose:o.onClose,placement:d},y=o.duration??n.duration;return y>0&&(g.timer=window.setTimeout(()=>{p(i)},y)),l.push(g),{close:()=>p(i),update:t=>{if("string"==typeof t||t instanceof HTMLElement){const e=f.querySelector(".solely-message__text");return void(e&&(e.innerHTML="","string"==typeof t?e.textContent=t:t instanceof HTMLElement&&e.appendChild(t.cloneNode(!0))))}if(void 0!==t.content){const e=f.querySelector(".solely-message__text");e&&(e.innerHTML="","string"==typeof t.content?e.textContent=t.content:t.content instanceof HTMLElement&&e.appendChild(t.content.cloneNode(!0)))}if(void 0!==t.description){let n=f.querySelector(".solely-message__description");if(!n&&t.description){n=e.createElement("span",{className:"solely-message__description"}),"string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(t.description.cloneNode(!0));const o=f.querySelector(".solely-message__content");null==o||o.appendChild(n)}else n&&(t.description?(n.innerHTML="","string"==typeof t.description?n.textContent=t.description:t.description instanceof HTMLElement&&n.appendChild(t.description.cloneNode(!0))):n.remove())}}}}const m={open:d,info:function(e,t){return d({content:e,type:"info",..."number"==typeof t?{duration:t}:t})},success:function(e,t){return d({content:e,type:"success",..."number"==typeof t?{duration:t}:t})},warning:function(e,t){return d({content:e,type:"warning",..."number"==typeof t?{duration:t}:t})},error:function(e,t){return d({content:e,type:"error",..."number"==typeof t?{duration:t}:t})},loading:function(e,t){return d(void 0===t?{content:e,type:"loading",duration:0,closable:!0}:"number"==typeof t?{content:e,type:"loading",duration:t,closable:!0}:{content:e,type:"loading",duration:0,closable:!0,...t})},config:function(e){Object.assign(n,e),r.forEach((t,n)=>{void 0!==e.top&&["top","topLeft","topRight"].includes(n)&&(t.style.top=`${e.top}px`),void 0!==e.bottom&&["bottom","bottomLeft","bottomRight"].includes(n)&&(t.style.bottom=`${e.bottom}px`),void 0!==e.left&&["topLeft","bottomLeft","left"].includes(n)&&(t.style.left=`${e.left}px`),void 0!==e.right&&["topRight","bottomRight","right"].includes(n)&&(t.style.right=`${e.right}px`),void 0!==e.gap&&(t.style.gap=`${e.gap}px`)})},destroy:async function(){o&&(clearTimeout(o),o=void 0);const e=[...l];await Promise.all(e.map(e=>p(e.id)))}};exports.Message=m;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createElement as t,addClosingAnimation as e,ANIMATION_DURATION as n,Z_INDEX as o,generateId as
|
|
1
|
+
import{createElement as t,addClosingAnimation as e,ANIMATION_DURATION as n,Z_INDEX as o,generateId as s,injectStyle as i}from"../utils.js";import l from"./style.css.js";const a={duration:3e3,maxCount:5,gap:8,top:24,bottom:24,left:24,right:24,placement:"top"};let r,c=null;const p=new Set,d=[],m={info:"ℹ",success:"✓",warning:"⚠",error:"✕",loading:t("span",{className:"solely-message__loading-spinner"})},f=new Map;function u(e,n){const o=t("span",{className:`solely-message__icon solely-message__icon--${n}`});return"string"==typeof e?o.textContent=e:o.appendChild(e.cloneNode(!0)),o}async function g(t){var o;if(!p.has(t)){p.add(t);try{const i=d.findIndex(e=>e.id===t);if(-1===i)return;const l=d[i];l.timer&&(clearTimeout(l.timer),l.timer=void 0),await e(l.element,n.NORMAL),l.element.remove();const a=d.findIndex(e=>e.id===t);-1!==a&&d.splice(a,1);try{null==(o=l.onClose)||o.call(l)}catch(s){console.error("[Solely Message] onClose callback error:",s)}r&&clearTimeout(r),r=window.setTimeout(()=>{0===d.length&&(f.forEach((t,e)=>{0===t.childElementCount&&(t.remove(),f.delete(e))}),0===f.size&&c&&(c.disconnect(),c=null)),r=void 0},300)}finally{p.delete(t)}}}function y(e){const n=s(),r=e.placement||a.placement,p=function(e=a.placement){const n=e;if(f.has(n))return f.get(n);const s=t("div",{className:"solely-message-container"}),r={position:"fixed",display:"flex",flexDirection:"column",gap:`${a.gap}px`,pointerEvents:"none",zIndex:String(o.TOAST)};switch(e){case"top":r.top=`${a.top}px`,r.left="50%",r.transform="translateX(-50%)";break;case"topLeft":r.top=`${a.top}px`,r.left=`${a.left}px`,r.alignItems="flex-start";break;case"topRight":r.top=`${a.top}px`,r.right=`${a.right}px`,r.alignItems="flex-end";break;case"bottom":r.bottom=`${a.bottom}px`,r.left="50%",r.transform="translateX(-50%)";break;case"bottomLeft":r.bottom=`${a.bottom}px`,r.left=`${a.left}px`,r.alignItems="flex-start";break;case"bottomRight":r.bottom=`${a.bottom}px`,r.right=`${a.right}px`,r.alignItems="flex-end";break;case"left":r.top="50%",r.left=`${a.left}px`,r.transform="translateY(-50%)",r.alignItems="flex-start";break;case"right":r.top="50%",r.right=`${a.right}px`,r.transform="translateY(-50%)",r.alignItems="flex-end"}Object.assign(s.style,r);const p=document.documentElement.getAttribute("data-theme");return p&&s.setAttribute("data-theme",p),document.body.appendChild(s),i("solely-message-styles",l),function(t){c&&c.disconnect(),c=new MutationObserver(()=>{const e=document.documentElement.getAttribute("data-theme");e?t.setAttribute("data-theme",e):t.removeAttribute("data-theme")}),c.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}(s),f.set(n,s),s}(r),y=d.filter(t=>t.placement===r);if(y.length>=a.maxCount){const t=y[0];t&&g(t.id)}const b=function(e,n){const o=e.type||"info",s=!1!==e.showIcon,i=t("div",{className:`solely-message solely-message--${o}${e.className?` ${e.className}`:""}`,styles:e.style});if(i.setAttribute("role","error"===o||"warning"===o?"alert":"status"),i.setAttribute("aria-live","error"===o||"warning"===o?"assertive":"polite"),s){const t=e.icon?u(e.icon,o):u(m[o],o);i.appendChild(t)}const l=t("span",{className:"solely-message__content"}),a=t("span",{className:"solely-message__text"});if("string"==typeof e.content?a.textContent=e.content:e.content instanceof HTMLElement&&a.appendChild(e.content.cloneNode(!0)),l.appendChild(a),e.description){const n=t("span",{className:"solely-message__description"});"string"==typeof e.description?n.textContent=e.description:e.description instanceof HTMLElement&&n.appendChild(e.description.cloneNode(!0)),l.appendChild(n)}if(i.appendChild(l),e.closable){const e=t("button",{className:"solely-message__close",textContent:"×",attrs:{type:"button","aria-label":"关闭"}});e.onclick=()=>g(n),i.appendChild(e)}return i}(e,n);p.appendChild(b);const h={id:n,element:b,onClose:e.onClose,placement:r},x=e.duration??a.duration;return x>0&&(h.timer=window.setTimeout(()=>{g(n)},x)),d.push(h),{close:()=>g(n),update:e=>{if("string"==typeof e||e instanceof HTMLElement){const t=b.querySelector(".solely-message__text");return void(t&&(t.innerHTML="","string"==typeof e?t.textContent=e:e instanceof HTMLElement&&t.appendChild(e.cloneNode(!0))))}if(void 0!==e.content){const t=b.querySelector(".solely-message__text");t&&(t.innerHTML="","string"==typeof e.content?t.textContent=e.content:e.content instanceof HTMLElement&&t.appendChild(e.content.cloneNode(!0)))}if(void 0!==e.description){let n=b.querySelector(".solely-message__description");if(!n&&e.description){n=t("span",{className:"solely-message__description"}),"string"==typeof e.description?n.textContent=e.description:e.description instanceof HTMLElement&&n.appendChild(e.description.cloneNode(!0));const o=b.querySelector(".solely-message__content");null==o||o.appendChild(n)}else n&&(e.description?(n.innerHTML="","string"==typeof e.description?n.textContent=e.description:e.description instanceof HTMLElement&&n.appendChild(e.description.cloneNode(!0))):n.remove())}}}}const b={open:y,info:function(t,e){return y({content:t,type:"info",..."number"==typeof e?{duration:e}:e})},success:function(t,e){return y({content:t,type:"success",..."number"==typeof e?{duration:e}:e})},warning:function(t,e){return y({content:t,type:"warning",..."number"==typeof e?{duration:e}:e})},error:function(t,e){return y({content:t,type:"error",..."number"==typeof e?{duration:e}:e})},loading:function(t,e){return y(void 0===e?{content:t,type:"loading",duration:0,closable:!0}:"number"==typeof e?{content:t,type:"loading",duration:e,closable:!0}:{content:t,type:"loading",duration:0,closable:!0,...e})},config:function(t){Object.assign(a,t),f.forEach((e,n)=>{void 0!==t.top&&["top","topLeft","topRight"].includes(n)&&(e.style.top=`${t.top}px`),void 0!==t.bottom&&["bottom","bottomLeft","bottomRight"].includes(n)&&(e.style.bottom=`${t.bottom}px`),void 0!==t.left&&["topLeft","bottomLeft","left"].includes(n)&&(e.style.left=`${t.left}px`),void 0!==t.right&&["topRight","bottomRight","right"].includes(n)&&(e.style.right=`${t.right}px`),void 0!==t.gap&&(e.style.gap=`${t.gap}px`)})},destroy:async function(){r&&(clearTimeout(r),r=void 0);const t=[...d];await Promise.all(t.map(t=>g(t.id)))}};export{b as Message};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default="
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default=".solely-message,.solely-message *,.solely-message *:before,.solely-message *:after,.solely-message-container{box-sizing:border-box}.solely-message{display:inline-flex;align-items:center;gap:var(--solely-spacing-sm);padding:var(--solely-spacing-sm) var(--solely-spacing-md);font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);line-height:var(--solely-line-height-md);color:var(--solely-text-primary);background-color:var(--solely-component-bg);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-md);pointer-events:auto;animation:solely-message-slide-in var(--solely-transition-duration) var(--solely-transition-timing);transition:opacity var(--solely-transition-duration) var(--solely-transition-timing),transform var(--solely-transition-duration) var(--solely-transition-timing)}.solely-message.is-closing{opacity:0;transform:translateY(-10px);pointer-events:none}.solely-message--info{border-left:4px solid var(--solely-primary)}.solely-message--success{border-left:4px solid var(--solely-success)}.solely-message--warning{border-left:4px solid var(--solely-warning)}.solely-message--error{border-left:4px solid var(--solely-error)}.solely-message--loading{border-left:4px solid var(--solely-primary)}.solely-message__icon{display:inline-flex;align-items:center;justify-content:center;width:var(--solely-height-sm);height:var(--solely-height-sm);flex-shrink:0}.solely-message__icon--info{color:var(--solely-primary)}.solely-message__icon--success{color:var(--solely-success)}.solely-message__icon--warning{color:var(--solely-warning)}.solely-message__icon--error{color:var(--solely-error)}.solely-message__icon--loading{color:var(--solely-primary)}.solely-message__loading-spinner{display:inline-block;width:14px;height:14px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:solely-message-spin .8s linear infinite}.solely-message__content{flex:1;min-width:0}.solely-message__text{display:block;font-weight:500}.solely-message__description{display:block;font-size:var(--solely-font-size-sm);color:var(--solely-text-secondary);margin-top:var(--solely-spacing-xs);line-height:var(--solely-line-height-sm)}.solely-message__close{display:inline-flex;align-items:center;justify-content:center;width:var(--solely-height-sm);height:var(--solely-height-sm);margin-left:var(--solely-spacing-sm);padding:0;font-size:var(--solely-font-size-lg);line-height:1;color:var(--solely-text-tertiary);background:none;border:none;border-radius:var(--solely-border-radius-sm);cursor:pointer;transition:all var(--solely-transition-duration) var(--solely-transition-timing);flex-shrink:0}.solely-message__close:hover{color:var(--solely-text-secondary);background-color:var(--solely-gray-3)}.solely-message__close:active{color:var(--solely-text-primary)}@keyframes solely-message-slide-in{0%{opacity:0;transform:translateY(-20px)}to{opacity:1;transform:translateY(0)}}@keyframes solely-message-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="
|
|
1
|
+
const e=".solely-message,.solely-message *,.solely-message *:before,.solely-message *:after,.solely-message-container{box-sizing:border-box}.solely-message{display:inline-flex;align-items:center;gap:var(--solely-spacing-sm);padding:var(--solely-spacing-sm) var(--solely-spacing-md);font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);line-height:var(--solely-line-height-md);color:var(--solely-text-primary);background-color:var(--solely-component-bg);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-md);pointer-events:auto;animation:solely-message-slide-in var(--solely-transition-duration) var(--solely-transition-timing);transition:opacity var(--solely-transition-duration) var(--solely-transition-timing),transform var(--solely-transition-duration) var(--solely-transition-timing)}.solely-message.is-closing{opacity:0;transform:translateY(-10px);pointer-events:none}.solely-message--info{border-left:4px solid var(--solely-primary)}.solely-message--success{border-left:4px solid var(--solely-success)}.solely-message--warning{border-left:4px solid var(--solely-warning)}.solely-message--error{border-left:4px solid var(--solely-error)}.solely-message--loading{border-left:4px solid var(--solely-primary)}.solely-message__icon{display:inline-flex;align-items:center;justify-content:center;width:var(--solely-height-sm);height:var(--solely-height-sm);flex-shrink:0}.solely-message__icon--info{color:var(--solely-primary)}.solely-message__icon--success{color:var(--solely-success)}.solely-message__icon--warning{color:var(--solely-warning)}.solely-message__icon--error{color:var(--solely-error)}.solely-message__icon--loading{color:var(--solely-primary)}.solely-message__loading-spinner{display:inline-block;width:14px;height:14px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:solely-message-spin .8s linear infinite}.solely-message__content{flex:1;min-width:0}.solely-message__text{display:block;font-weight:500}.solely-message__description{display:block;font-size:var(--solely-font-size-sm);color:var(--solely-text-secondary);margin-top:var(--solely-spacing-xs);line-height:var(--solely-line-height-sm)}.solely-message__close{display:inline-flex;align-items:center;justify-content:center;width:var(--solely-height-sm);height:var(--solely-height-sm);margin-left:var(--solely-spacing-sm);padding:0;font-size:var(--solely-font-size-lg);line-height:1;color:var(--solely-text-tertiary);background:none;border:none;border-radius:var(--solely-border-radius-sm);cursor:pointer;transition:all var(--solely-transition-duration) var(--solely-transition-timing);flex-shrink:0}.solely-message__close:hover{color:var(--solely-text-secondary);background-color:var(--solely-gray-3)}.solely-message__close:active{color:var(--solely-text-primary)}@keyframes solely-message-slide-in{0%{opacity:0;transform:translateY(-20px)}to{opacity:1;transform:translateY(0)}}@keyframes solely-message-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}";export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),n={width:520,mask:!0,maskClosable:!1,okText:"确定",cancelText:"取消"},l=[],o=new Set;let a=null;const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),n={width:520,mask:!0,maskClosable:!1,okText:"确定",cancelText:"取消"},l=[],o=new Set;let a=null;const s={info:"ℹ",success:"✓",warning:"⚠",error:"✕",confirm:"?"};async function c(t){var n;if(!o.has(t)){o.add(t);try{const o=l.findIndex(e=>e.id===t);if(-1===o)return;const a=l[o],s=a.element.querySelector(".solely-modal-mask"),c=a.element.querySelector(".solely-modal");s&&s.classList.add("is-closing"),c&&c.classList.add("is-closing"),await e.addClosingAnimation(a.element,e.ANIMATION_DURATION.NORMAL),null==(n=a.cleanup)||n.call(a);const i=l.findIndex(e=>e.id===t);-1!==i&&(l[i].element.remove(),l.splice(i,1))}finally{o.delete(t)}}}async function i(){if(0===l.length)return;const e=l[l.length-1];await c(e.id)}function d(t,n,l,o=!1){const a=e.createElement("button",{className:`solely-modal__btn solely-modal__btn--${"default"===n?"default":n}`,attrs:{type:"button"}});return"string"==typeof t?a.textContent=t:t instanceof HTMLElement&&a.appendChild(o?t.cloneNode(!0):t),a.onclick=()=>e.safeAsyncCallback(l),a}function r(o){const i=e.generateId();e.injectStyle("solely-modal-styles",t.default);const r=o.type||"info",m=o.width??n.width,u=o.showCancel??"confirm"===r,p=o.maskClosable??n.maskClosable,y=e.createElement("div",{className:"solely-modal-wrap",attrs:{tabIndex:"-1",part:"wrap"}}),f=function(e){return(()=>{const t=document.documentElement.getAttribute("data-theme");t?e.setAttribute("data-theme",t):e.removeAttribute("data-theme")})(),a||(a=new MutationObserver(()=>{l.forEach(e=>{const t=document.documentElement.getAttribute("data-theme");t?e.element.setAttribute("data-theme",t):e.element.removeAttribute("data-theme")})}),a.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})),()=>{a&&0===l.length&&(a.disconnect(),a=null)}}(y),h=[];if(!1!==o.mask){const t=e.createElement("div",{className:"solely-modal-mask"});if(p){const e=()=>{var e;c(i),null==(e=o.onCancel)||e.call(o)};t.onclick=e,h.push({element:t,type:"click",handler:e})}y.appendChild(t)}const C=e.createElement("div",{className:"solely-modal"+(o.className?` ${o.className}`:""),styles:{...o.style,width:"number"==typeof m?`${m}px`:m}}),b=e.createElement("div",{className:"solely-modal__header"}),E=e.createElement("h3",{className:"solely-modal__title"});if("string"==typeof o.title)E.textContent=o.title||"";else if(o.title instanceof HTMLElement){const e=o.cloneElement??!1;E.appendChild(e?o.title.cloneNode(!0):o.title)}if(b.appendChild(E),!1!==o.closable){const t=e.createElement("button",{className:"solely-modal__close",textContent:"×",attrs:{type:"button","aria-label":"关闭",part:"close"}}),n=()=>{var e;c(i),null==(e=o.onClose)||e.call(o)};t.onclick=n,h.push({element:t,type:"click",handler:n}),b.appendChild(t)}C.appendChild(b);const _=e.createElement("div",{className:"solely-modal__body"}),v=e.createElement("div",{className:"solely-modal__content-wrapper"});if(!1!==o.showIcon){const t=e.createElement("span",{className:`solely-modal__icon solely-modal__icon--${r}`,textContent:s[r]});v.appendChild(t)}const N=e.createElement("div",{className:"solely-modal__content"});if("string"==typeof o.content)N.textContent=o.content||"";else if(o.content instanceof HTMLElement){const e=o.cloneElement??!1;N.appendChild(e?o.content.cloneNode(!0):o.content)}v.appendChild(N),_.appendChild(v),C.appendChild(_);const g=e.createElement("div",{className:"solely-modal__footer"});if(o.buttons&&o.buttons.length>0)o.buttons.forEach(t=>{const n=d(t.text,t.type||"default",async()=>{await e.safeAsyncCallback(()=>t.onClick())},o.cloneElement);t.style&&Object.assign(n.style,t.style),g.appendChild(n)});else{if(u){const e=d(o.cancelText||n.cancelText,"default",()=>{var e;c(i),null==(e=o.onCancel)||e.call(o)},o.cloneElement);g.appendChild(e)}const t=d(o.okText||n.okText,o.okType||"primary",async()=>{o.onOk&&!1===await e.safeAsyncCallback(()=>o.onOk())||c(i)},o.cloneElement);g.appendChild(t)}C.appendChild(g),y.appendChild(C),document.body.appendChild(y),l.push({id:i,element:y,instance:null,cleanup:()=>{h.forEach(({element:e,type:t,handler:n})=>{e.removeEventListener(t,n)}),f()}});const w={close:()=>{var e;c(i),null==(e=o.onClose)||e.call(o)},update:e=>{if(void 0!==e.title){const t=y.querySelector(".solely-modal__title");if(t)if(t.innerHTML="","string"==typeof e.title)t.textContent=e.title;else if(e.title instanceof HTMLElement){const n=e.cloneElement??!1;t.appendChild(n?e.title.cloneNode(!0):e.title)}}if(void 0!==e.content){const t=y.querySelector(".solely-modal__content");if(t)if(t.innerHTML="","string"==typeof e.content)t.textContent=e.content;else if(e.content instanceof HTMLElement){const n=e.cloneElement??!1;t.appendChild(n?e.content.cloneNode(!0):e.content)}}if(void 0!==e.width){const t=y.querySelector(".solely-modal");t&&(t.style.width="number"==typeof e.width?`${e.width}px`:e.width)}if(void 0!==e.className){const t=y.querySelector(".solely-modal");t&&(t.className=`solely-modal ${e.className}`.trim())}if(void 0!==e.style){const t=y.querySelector(".solely-modal");t&&Object.assign(t.style,e.style)}}},k=l.find(e=>e.id===i);return k&&(k.instance=w),w}const m={open:r,confirm:function(e){return r({...e,type:"confirm",showCancel:!0})},info:function(e){return r({...e,type:"info"})},success:function(e){return r({...e,type:"success"})},error:function(e){return r({...e,type:"error"})},warning:function(e){return r({...e,type:"warning"})},config:function(e){Object.assign(n,e)},destroy:async function(){for(;l.length>0;)await i()}};exports.Modal=m;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createElement as e,safeAsyncCallback as t,injectStyle as n,addClosingAnimation as l,ANIMATION_DURATION as o,generateId as
|
|
1
|
+
import{createElement as e,safeAsyncCallback as t,injectStyle as n,addClosingAnimation as l,ANIMATION_DURATION as o,generateId as s}from"../utils.js";import a from"./style.css.js";const c={width:520,mask:!0,maskClosable:!1,okText:"确定",cancelText:"取消"},i=[],d=new Set;let r=null;const m={info:"ℹ",success:"✓",warning:"⚠",error:"✕",confirm:"?"};async function p(e){var t;if(!d.has(e)){d.add(e);try{const n=i.findIndex(t=>t.id===e);if(-1===n)return;const s=i[n],a=s.element.querySelector(".solely-modal-mask"),c=s.element.querySelector(".solely-modal");a&&a.classList.add("is-closing"),c&&c.classList.add("is-closing"),await l(s.element,o.NORMAL),null==(t=s.cleanup)||t.call(s);const d=i.findIndex(t=>t.id===e);-1!==d&&(i[d].element.remove(),i.splice(d,1))}finally{d.delete(e)}}}async function u(){if(0===i.length)return;const e=i[i.length-1];await p(e.id)}function f(n,l,o,s=!1){const a=e("button",{className:`solely-modal__btn solely-modal__btn--${"default"===l?"default":l}`,attrs:{type:"button"}});return"string"==typeof n?a.textContent=n:n instanceof HTMLElement&&a.appendChild(s?n.cloneNode(!0):n),a.onclick=()=>t(o),a}function y(l){const o=s();n("solely-modal-styles",a);const d=l.type||"info",u=l.width??c.width,y=l.showCancel??"confirm"===d,h=l.maskClosable??c.maskClosable,C=e("div",{className:"solely-modal-wrap",attrs:{tabIndex:"-1",part:"wrap"}}),b=function(e){return(()=>{const t=document.documentElement.getAttribute("data-theme");t?e.setAttribute("data-theme",t):e.removeAttribute("data-theme")})(),r||(r=new MutationObserver(()=>{i.forEach(e=>{const t=document.documentElement.getAttribute("data-theme");t?e.element.setAttribute("data-theme",t):e.element.removeAttribute("data-theme")})}),r.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})),()=>{r&&0===i.length&&(r.disconnect(),r=null)}}(C),_=[];if(!1!==l.mask){const t=e("div",{className:"solely-modal-mask"});if(h){const e=()=>{var e;p(o),null==(e=l.onCancel)||e.call(l)};t.onclick=e,_.push({element:t,type:"click",handler:e})}C.appendChild(t)}const v=e("div",{className:"solely-modal"+(l.className?` ${l.className}`:""),styles:{...l.style,width:"number"==typeof u?`${u}px`:u}}),w=e("div",{className:"solely-modal__header"}),N=e("h3",{className:"solely-modal__title"});if("string"==typeof l.title)N.textContent=l.title||"";else if(l.title instanceof HTMLElement){const e=l.cloneElement??!1;N.appendChild(e?l.title.cloneNode(!0):l.title)}if(w.appendChild(N),!1!==l.closable){const t=e("button",{className:"solely-modal__close",textContent:"×",attrs:{type:"button","aria-label":"关闭",part:"close"}}),n=()=>{var e;p(o),null==(e=l.onClose)||e.call(l)};t.onclick=n,_.push({element:t,type:"click",handler:n}),w.appendChild(t)}v.appendChild(w);const g=e("div",{className:"solely-modal__body"}),x=e("div",{className:"solely-modal__content-wrapper"});if(!1!==l.showIcon){const t=e("span",{className:`solely-modal__icon solely-modal__icon--${d}`,textContent:m[d]});x.appendChild(t)}const k=e("div",{className:"solely-modal__content"});if("string"==typeof l.content)k.textContent=l.content||"";else if(l.content instanceof HTMLElement){const e=l.cloneElement??!1;k.appendChild(e?l.content.cloneNode(!0):l.content)}x.appendChild(k),g.appendChild(x),v.appendChild(g);const E=e("div",{className:"solely-modal__footer"});if(l.buttons&&l.buttons.length>0)l.buttons.forEach(e=>{const n=f(e.text,e.type||"default",async()=>{await t(()=>e.onClick())},l.cloneElement);e.style&&Object.assign(n.style,e.style),E.appendChild(n)});else{if(y){const e=f(l.cancelText||c.cancelText,"default",()=>{var e;p(o),null==(e=l.onCancel)||e.call(l)},l.cloneElement);E.appendChild(e)}const e=f(l.okText||c.okText,l.okType||"primary",async()=>{l.onOk&&!1===await t(()=>l.onOk())||p(o)},l.cloneElement);E.appendChild(e)}v.appendChild(E),C.appendChild(v),document.body.appendChild(C),i.push({id:o,element:C,instance:null,cleanup:()=>{_.forEach(({element:e,type:t,handler:n})=>{e.removeEventListener(t,n)}),b()}});const T={close:()=>{var e;p(o),null==(e=l.onClose)||e.call(l)},update:e=>{if(void 0!==e.title){const t=C.querySelector(".solely-modal__title");if(t)if(t.innerHTML="","string"==typeof e.title)t.textContent=e.title;else if(e.title instanceof HTMLElement){const n=e.cloneElement??!1;t.appendChild(n?e.title.cloneNode(!0):e.title)}}if(void 0!==e.content){const t=C.querySelector(".solely-modal__content");if(t)if(t.innerHTML="","string"==typeof e.content)t.textContent=e.content;else if(e.content instanceof HTMLElement){const n=e.cloneElement??!1;t.appendChild(n?e.content.cloneNode(!0):e.content)}}if(void 0!==e.width){const t=C.querySelector(".solely-modal");t&&(t.style.width="number"==typeof e.width?`${e.width}px`:e.width)}if(void 0!==e.className){const t=C.querySelector(".solely-modal");t&&(t.className=`solely-modal ${e.className}`.trim())}if(void 0!==e.style){const t=C.querySelector(".solely-modal");t&&Object.assign(t.style,e.style)}}},L=i.find(e=>e.id===o);return L&&(L.instance=T),T}const h={open:y,confirm:function(e){return y({...e,type:"confirm",showCancel:!0})},info:function(e){return y({...e,type:"info"})},success:function(e){return y({...e,type:"success"})},error:function(e){return y({...e,type:"error"})},warning:function(e){return y({...e,type:"warning"})},config:function(e){Object.assign(c,e)},destroy:async function(){for(;i.length>0;)await u()}};export{h as Modal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default="
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default=".solely-modal,.solely-modal *,.solely-modal *:before,.solely-modal *:after,.solely-modal-mask,.solely-modal-wrap{box-sizing:border-box}.solely-modal-mask{position:fixed;top:0;left:0;right:0;bottom:0;background-color:var(--solely-mask-bg);z-index:1;pointer-events:auto;animation:solely-modal-mask-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-modal-mask.is-closing{animation:solely-modal-mask-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-modal-wrap{position:fixed;top:0;left:0;right:0;bottom:0;z-index:var(--solely-z-index-modal);display:flex;align-items:center;justify-content:center;overflow:auto;outline:0;pointer-events:none}.solely-modal{position:relative;z-index:2;background-color:var(--solely-component-bg);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-lg);animation:solely-modal-container-in var(--solely-transition-duration) var(--solely-transition-timing);max-width:calc(100vw - var(--solely-spacing-xl));margin:var(--solely-spacing-md);pointer-events:auto}.solely-modal.is-closing{animation:solely-modal-container-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-modal__header{padding:var(--solely-spacing-lg) var(--solely-spacing-xl);border-bottom:1px solid var(--solely-border-color-split);display:flex;align-items:center;justify-content:space-between}.solely-modal__title{margin:0;font-size:var(--solely-font-size-lg);font-weight:500;color:var(--solely-text-primary);line-height:var(--solely-line-height-lg)}.solely-modal__close{width:var(--solely-height-sm);height:var(--solely-height-sm);display:flex;align-items:center;justify-content:center;color:var(--solely-text-tertiary);cursor:pointer;transition:color var(--solely-transition-duration);font-size:var(--solely-font-size-lg);line-height:1;border:none;background:none;border-radius:var(--solely-border-radius-sm)}.solely-modal__close:hover{color:var(--solely-text-secondary);background-color:var(--solely-gray-3)}.solely-modal__close:active{color:var(--solely-text-primary)}.solely-modal__body{padding:var(--solely-spacing-xl);font-size:var(--solely-font-size-md);line-height:var(--solely-line-height-md);color:var(--solely-text-secondary)}.solely-modal__content-wrapper{display:flex;align-items:flex-start;gap:var(--solely-spacing-sm)}.solely-modal__footer{padding:var(--solely-spacing-md) var(--solely-spacing-lg);border-top:1px solid var(--solely-border-color-split);display:flex;justify-content:flex-end;gap:var(--solely-spacing-sm)}.solely-modal__icon{display:inline-flex;align-items:center;justify-content:center;width:var(--solely-height-sm);height:var(--solely-height-sm);border-radius:var(--solely-border-radius-circle);margin-right:var(--solely-spacing-sm);font-size:var(--solely-font-size-md)}.solely-modal__icon--info{background-color:var(--solely-info-light);color:var(--solely-info)}.solely-modal__icon--success{background-color:var(--solely-success-light);color:var(--solely-success)}.solely-modal__icon--warning{background-color:var(--solely-warning-light);color:var(--solely-warning)}.solely-modal__icon--error{background-color:var(--solely-error-light);color:var(--solely-error)}.solely-modal__icon--confirm{background-color:var(--solely-warning-light);color:var(--solely-warning)}.solely-modal__btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--solely-spacing-xs);height:var(--solely-height-md);padding:0 var(--solely-spacing-md);font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);font-weight:400;line-height:var(--solely-line-height-md);white-space:nowrap;text-align:center;text-decoration:none;vertical-align:middle;background-image:none;border:1px solid transparent;border-radius:var(--solely-border-radius-md);cursor:pointer;transition:all var(--solely-transition-duration) var(--solely-transition-timing);-webkit-user-select:none;user-select:none;touch-action:manipulation;outline:none;position:relative}.solely-modal__btn:hover:not(:disabled){opacity:.9}.solely-modal__btn:active:not(:disabled){opacity:.8}.solely-modal__btn:disabled{opacity:.4;cursor:not-allowed}.solely-modal__btn--primary{color:var(--solely-white);background-color:var(--solely-primary);border-color:var(--solely-primary)}.solely-modal__btn--default{color:var(--solely-text-primary);background-color:var(--solely-component-bg);border-color:var(--solely-border-color)}.solely-modal__btn--danger{color:var(--solely-white);background-color:var(--solely-error);border-color:var(--solely-error)}@keyframes solely-modal-mask-in{0%{opacity:0}to{opacity:1}}@keyframes solely-modal-mask-out{0%{opacity:1}to{opacity:0}}@keyframes solely-modal-container-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes solely-modal-container-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const o="
|
|
1
|
+
const o=".solely-modal,.solely-modal *,.solely-modal *:before,.solely-modal *:after,.solely-modal-mask,.solely-modal-wrap{box-sizing:border-box}.solely-modal-mask{position:fixed;top:0;left:0;right:0;bottom:0;background-color:var(--solely-mask-bg);z-index:1;pointer-events:auto;animation:solely-modal-mask-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-modal-mask.is-closing{animation:solely-modal-mask-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-modal-wrap{position:fixed;top:0;left:0;right:0;bottom:0;z-index:var(--solely-z-index-modal);display:flex;align-items:center;justify-content:center;overflow:auto;outline:0;pointer-events:none}.solely-modal{position:relative;z-index:2;background-color:var(--solely-component-bg);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-lg);animation:solely-modal-container-in var(--solely-transition-duration) var(--solely-transition-timing);max-width:calc(100vw - var(--solely-spacing-xl));margin:var(--solely-spacing-md);pointer-events:auto}.solely-modal.is-closing{animation:solely-modal-container-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-modal__header{padding:var(--solely-spacing-lg) var(--solely-spacing-xl);border-bottom:1px solid var(--solely-border-color-split);display:flex;align-items:center;justify-content:space-between}.solely-modal__title{margin:0;font-size:var(--solely-font-size-lg);font-weight:500;color:var(--solely-text-primary);line-height:var(--solely-line-height-lg)}.solely-modal__close{width:var(--solely-height-sm);height:var(--solely-height-sm);display:flex;align-items:center;justify-content:center;color:var(--solely-text-tertiary);cursor:pointer;transition:color var(--solely-transition-duration);font-size:var(--solely-font-size-lg);line-height:1;border:none;background:none;border-radius:var(--solely-border-radius-sm)}.solely-modal__close:hover{color:var(--solely-text-secondary);background-color:var(--solely-gray-3)}.solely-modal__close:active{color:var(--solely-text-primary)}.solely-modal__body{padding:var(--solely-spacing-xl);font-size:var(--solely-font-size-md);line-height:var(--solely-line-height-md);color:var(--solely-text-secondary)}.solely-modal__content-wrapper{display:flex;align-items:flex-start;gap:var(--solely-spacing-sm)}.solely-modal__footer{padding:var(--solely-spacing-md) var(--solely-spacing-lg);border-top:1px solid var(--solely-border-color-split);display:flex;justify-content:flex-end;gap:var(--solely-spacing-sm)}.solely-modal__icon{display:inline-flex;align-items:center;justify-content:center;width:var(--solely-height-sm);height:var(--solely-height-sm);border-radius:var(--solely-border-radius-circle);margin-right:var(--solely-spacing-sm);font-size:var(--solely-font-size-md)}.solely-modal__icon--info{background-color:var(--solely-info-light);color:var(--solely-info)}.solely-modal__icon--success{background-color:var(--solely-success-light);color:var(--solely-success)}.solely-modal__icon--warning{background-color:var(--solely-warning-light);color:var(--solely-warning)}.solely-modal__icon--error{background-color:var(--solely-error-light);color:var(--solely-error)}.solely-modal__icon--confirm{background-color:var(--solely-warning-light);color:var(--solely-warning)}.solely-modal__btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--solely-spacing-xs);height:var(--solely-height-md);padding:0 var(--solely-spacing-md);font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);font-weight:400;line-height:var(--solely-line-height-md);white-space:nowrap;text-align:center;text-decoration:none;vertical-align:middle;background-image:none;border:1px solid transparent;border-radius:var(--solely-border-radius-md);cursor:pointer;transition:all var(--solely-transition-duration) var(--solely-transition-timing);-webkit-user-select:none;user-select:none;touch-action:manipulation;outline:none;position:relative}.solely-modal__btn:hover:not(:disabled){opacity:.9}.solely-modal__btn:active:not(:disabled){opacity:.8}.solely-modal__btn:disabled{opacity:.4;cursor:not-allowed}.solely-modal__btn--primary{color:var(--solely-white);background-color:var(--solely-primary);border-color:var(--solely-primary)}.solely-modal__btn--default{color:var(--solely-text-primary);background-color:var(--solely-component-bg);border-color:var(--solely-border-color)}.solely-modal__btn--danger{color:var(--solely-white);background-color:var(--solely-error);border-color:var(--solely-error)}@keyframes solely-modal-mask-in{0%{opacity:0}to{opacity:1}}@keyframes solely-modal-mask-out{0%{opacity:1}to{opacity:0}}@keyframes solely-modal-container-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes solely-modal-container-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}";export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),n={okText:"确定",cancelText:"取消",okType:"primary",showCancel:!0,placement:"top"};let o=null,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),n={okText:"确定",cancelText:"取消",okType:"primary",showCancel:!0,placement:"top"};let o=null,l=null;const a=new WeakSet;async function s(){if(!o)return;const{element:t}=o,n=t.querySelector(".solely-popconfirm");n&&n.classList.add("is-closing"),await e.addClosingAnimation(t,e.ANIMATION_DURATION.FAST),t.remove(),o=null}async function c(a,c){if(o&&o.target===a)return await s(),{destroy:()=>{}};await s();const i=e.generateId();e.injectStyle("solely-popconfirm-styles",t.default);const r=c.placement??n.placement,d=c.okType??n.okType,p=c.showCancel??n.showCancel,m=e.createElement("div",{className:"solely-popconfirm-overlay"}),u=(y=m,(()=>{const e=document.documentElement.getAttribute("data-theme");e?y.setAttribute("data-theme",e):y.removeAttribute("data-theme")})(),l||(l=new MutationObserver(()=>{if(o){const e=document.documentElement.getAttribute("data-theme");e?o.element.setAttribute("data-theme",e):o.element.removeAttribute("data-theme")}}),l.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})),()=>{l&&!o&&(l.disconnect(),l=null)});var y;const f=e.createElement("div",{className:`solely-popconfirm solely-popconfirm--${r}${c.className?` ${c.className}`:""}`,styles:c.style}),v=e.createElement("div",{className:"solely-popconfirm__content"});if(!1!==c.showIcon){const t=e.createElement("span",{className:"solely-popconfirm__icon",textContent:"⚠"});v.appendChild(t)}const h=e.createElement("div",{className:"solely-popconfirm__text"}),E=e.createElement("div",{className:"solely-popconfirm__title"});if("string"==typeof c.title?E.textContent=c.title:c.title instanceof HTMLElement&&E.appendChild(c.title.cloneNode(!0)),h.appendChild(E),c.description){const t=e.createElement("div",{className:"solely-popconfirm__description"});"string"==typeof c.description?t.textContent=c.description:c.description instanceof HTMLElement&&t.appendChild(c.description.cloneNode(!0)),h.appendChild(t)}v.appendChild(h);const C=e.createElement("div",{className:"solely-popconfirm__buttons"}),b=async()=>{var e;await s(),null==(e=c.onCancel)||e.call(c)};if(p){const t=e.createElement("button",{className:"solely-popconfirm__btn solely-popconfirm__btn--cancel",attrs:{type:"button"}}),o=c.cancelText??n.cancelText;"string"==typeof o?t.textContent=o:o instanceof HTMLElement&&t.appendChild(o.cloneNode(!0)),t.onclick=b,C.appendChild(t)}const w=e.createElement("button",{className:"solely-popconfirm__btn solely-popconfirm__btn--ok"+("danger"===d?" solely-popconfirm__btn--danger":""),attrs:{type:"button"}}),_=c.okText??n.okText;"string"==typeof _?w.textContent=_:_ instanceof HTMLElement&&w.appendChild(_.cloneNode(!0)),w.onclick=async()=>{var e;await s(),null==(e=c.onConfirm)||e.call(c)},C.appendChild(w);const g=e.createElement("div",{className:"solely-popconfirm__arrow"});f.appendChild(g),f.appendChild(v),f.appendChild(C),m.appendChild(f),document.body.appendChild(m);const N=e.calculatePosition(a,f,r);f.style.top=`${N.top}px`,f.style.left=`${N.left}px`,void 0!==N.arrowLeft&&(g.style.left=`${N.arrowLeft}px`),void 0!==N.arrowTop&&(g.style.top=`${N.arrowTop}px`);const T=e=>{e.target===m&&b()},k=e=>{"Escape"===e.key&&(b(),document.removeEventListener("keydown",k))};m.addEventListener("click",T),document.addEventListener("keydown",k);const x=()=>{document.removeEventListener("keydown",k),m.removeEventListener("click",T),u(),s()};return o={id:i,target:a,element:m,destroy:x},{destroy:x}}const i={show:c,bind:function(e,t){if(a.has(e))return{destroy:()=>{}};a.add(e);let n=null;const l=async l=>{l.stopPropagation(),o?(await s(),n=null):n=await c(e,t)},i=async t=>{if(!o)return;const l=t.target;o.element.contains(l)||e.contains(l)||(await s(),n=null)};return e.addEventListener("click",l),document.addEventListener("mousedown",i),{destroy:()=>{a.delete(e),e.removeEventListener("click",l),document.removeEventListener("mousedown",i),null==n||n.destroy(),n=null}}},config:function(e){Object.assign(n,e)},destroy:s};exports.Popconfirm=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createElement as e,calculatePosition as t,injectStyle as n,addClosingAnimation as o,ANIMATION_DURATION as
|
|
1
|
+
import{createElement as e,calculatePosition as t,injectStyle as n,addClosingAnimation as o,ANIMATION_DURATION as l,generateId as s}from"../utils.js";import a from"./style.css.js";const c={okText:"确定",cancelText:"取消",okType:"primary",showCancel:!0,placement:"top"};let i=null,r=null;const d=new WeakSet;async function p(){if(!i)return;const{element:e}=i,t=e.querySelector(".solely-popconfirm");t&&t.classList.add("is-closing"),await o(e,l.FAST),e.remove(),i=null}async function m(o,l){if(i&&i.target===o)return await p(),{destroy:()=>{}};await p();const d=s();n("solely-popconfirm-styles",a);const m=l.placement??c.placement,y=l.okType??c.okType,u=l.showCancel??c.showCancel,f=e("div",{className:"solely-popconfirm-overlay"}),v=(h=f,(()=>{const e=document.documentElement.getAttribute("data-theme");e?h.setAttribute("data-theme",e):h.removeAttribute("data-theme")})(),r||(r=new MutationObserver(()=>{if(i){const e=document.documentElement.getAttribute("data-theme");e?i.element.setAttribute("data-theme",e):i.element.removeAttribute("data-theme")}}),r.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})),()=>{r&&!i&&(r.disconnect(),r=null)});var h;const w=e("div",{className:`solely-popconfirm solely-popconfirm--${m}${l.className?` ${l.className}`:""}`,styles:l.style}),C=e("div",{className:"solely-popconfirm__content"});if(!1!==l.showIcon){const t=e("span",{className:"solely-popconfirm__icon",textContent:"⚠"});C.appendChild(t)}const _=e("div",{className:"solely-popconfirm__text"}),b=e("div",{className:"solely-popconfirm__title"});if("string"==typeof l.title?b.textContent=l.title:l.title instanceof HTMLElement&&b.appendChild(l.title.cloneNode(!0)),_.appendChild(b),l.description){const t=e("div",{className:"solely-popconfirm__description"});"string"==typeof l.description?t.textContent=l.description:l.description instanceof HTMLElement&&t.appendChild(l.description.cloneNode(!0)),_.appendChild(t)}C.appendChild(_);const k=e("div",{className:"solely-popconfirm__buttons"}),x=async()=>{var e;await p(),null==(e=l.onCancel)||e.call(l)};if(u){const t=e("button",{className:"solely-popconfirm__btn solely-popconfirm__btn--cancel",attrs:{type:"button"}}),n=l.cancelText??c.cancelText;"string"==typeof n?t.textContent=n:n instanceof HTMLElement&&t.appendChild(n.cloneNode(!0)),t.onclick=x,k.appendChild(t)}const E=e("button",{className:"solely-popconfirm__btn solely-popconfirm__btn--ok"+("danger"===y?" solely-popconfirm__btn--danger":""),attrs:{type:"button"}}),N=l.okText??c.okText;"string"==typeof N?E.textContent=N:N instanceof HTMLElement&&E.appendChild(N.cloneNode(!0)),E.onclick=async()=>{var e;await p(),null==(e=l.onConfirm)||e.call(l)},k.appendChild(E);const g=e("div",{className:"solely-popconfirm__arrow"});w.appendChild(g),w.appendChild(C),w.appendChild(k),f.appendChild(w),document.body.appendChild(f);const L=t(o,w,m);w.style.top=`${L.top}px`,w.style.left=`${L.left}px`,void 0!==L.arrowLeft&&(g.style.left=`${L.arrowLeft}px`),void 0!==L.arrowTop&&(g.style.top=`${L.arrowTop}px`);const T=e=>{e.target===f&&x()},A=e=>{"Escape"===e.key&&(x(),document.removeEventListener("keydown",A))};f.addEventListener("click",T),document.addEventListener("keydown",A);const $=()=>{document.removeEventListener("keydown",A),f.removeEventListener("click",T),v(),p()};return i={id:d,target:o,element:f,destroy:$},{destroy:$}}const y={show:m,bind:function(e,t){if(d.has(e))return{destroy:()=>{}};d.add(e);let n=null;const o=async o=>{o.stopPropagation(),i?(await p(),n=null):n=await m(e,t)},l=async t=>{if(!i)return;const o=t.target;i.element.contains(o)||e.contains(o)||(await p(),n=null)};return e.addEventListener("click",o),document.addEventListener("mousedown",l),{destroy:()=>{d.delete(e),e.removeEventListener("click",o),document.removeEventListener("mousedown",l),null==n||n.destroy(),n=null}}},config:function(e){Object.assign(c,e)},destroy:p};export{y as Popconfirm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default="
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default=".solely-popconfirm,.solely-popconfirm *,.solely-popconfirm *:before,.solely-popconfirm *:after,.solely-popconfirm-overlay{box-sizing:border-box}.solely-popconfirm-overlay{position:absolute;top:0;left:0;width:100%;min-height:100%;z-index:var(--solely-z-index-popover)}.solely-popconfirm{position:absolute;background-color:var(--solely-component-bg);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-lg);padding:var(--solely-spacing-lg);min-width:200px;max-width:300px;font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);z-index:var(--solely-z-index-popover);animation:solely-popconfirm-fade-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-popconfirm.is-closing{animation:solely-popconfirm-fade-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-popconfirm__arrow{position:absolute;width:var(--solely-popconfirm-arrow-size, 8px);height:var(--solely-popconfirm-arrow-size, 8px);background-color:var(--solely-component-bg);transform:rotate(45deg)}.solely-popconfirm--top .solely-popconfirm__arrow,.solely-popconfirm--topLeft .solely-popconfirm__arrow,.solely-popconfirm--topRight .solely-popconfirm__arrow{bottom:calc(var(--solely-popconfirm-arrow-size, 8px) / -2);border-bottom:1px solid var(--solely-border-color-split);border-right:1px solid var(--solely-border-color-split)}.solely-popconfirm--bottom .solely-popconfirm__arrow,.solely-popconfirm--bottomLeft .solely-popconfirm__arrow,.solely-popconfirm--bottomRight .solely-popconfirm__arrow{top:calc(var(--solely-popconfirm-arrow-size, 8px) / -2);border-top:1px solid var(--solely-border-color-split);border-left:1px solid var(--solely-border-color-split)}.solely-popconfirm--left .solely-popconfirm__arrow,.solely-popconfirm--leftTop .solely-popconfirm__arrow,.solely-popconfirm--leftBottom .solely-popconfirm__arrow{right:calc(var(--solely-popconfirm-arrow-size, 8px) / -2);border-top:1px solid var(--solely-border-color-split);border-right:1px solid var(--solely-border-color-split)}.solely-popconfirm--right .solely-popconfirm__arrow,.solely-popconfirm--rightTop .solely-popconfirm__arrow,.solely-popconfirm--rightBottom .solely-popconfirm__arrow{left:calc(var(--solely-popconfirm-arrow-size, 8px) / -2);border-bottom:1px solid var(--solely-border-color-split);border-left:1px solid var(--solely-border-color-split)}.solely-popconfirm__content{display:flex;align-items:flex-start;gap:var(--solely-spacing-sm);margin-bottom:var(--solely-spacing-md)}.solely-popconfirm__icon{color:var(--solely-warning);font-size:var(--solely-font-size-lg);flex-shrink:0}.solely-popconfirm__text{flex:1}.solely-popconfirm__title{font-weight:500;color:var(--solely-text-primary);line-height:var(--solely-line-height-md)}.solely-popconfirm__description{font-size:var(--solely-font-size-sm);color:var(--solely-text-secondary);margin-top:var(--solely-spacing-xs);line-height:var(--solely-line-height-sm)}.solely-popconfirm__buttons{display:flex;justify-content:flex-end;gap:var(--solely-spacing-sm)}.solely-popconfirm__btn{padding:var(--solely-spacing-xs) var(--solely-spacing-md);border-radius:var(--solely-border-radius-sm);font-size:var(--solely-font-size-sm);cursor:pointer;transition:all var(--solely-transition-duration) var(--solely-transition-timing);border:1px solid transparent;font-family:var(--solely-font-family);line-height:var(--solely-line-height-sm)}.solely-popconfirm__btn--cancel{background-color:var(--solely-component-bg);border-color:var(--solely-border-color);color:var(--solely-text-primary)}.solely-popconfirm__btn--cancel:hover{border-color:var(--solely-primary);color:var(--solely-primary)}.solely-popconfirm__btn--ok{background-color:var(--solely-primary);border-color:var(--solely-primary);color:var(--solely-white)}.solely-popconfirm__btn--ok:hover{background-color:var(--solely-primary-hover);border-color:var(--solely-primary-hover)}.solely-popconfirm__btn--danger{background-color:var(--solely-error);border-color:var(--solely-error)}.solely-popconfirm__btn--danger:hover{background-color:var(--solely-error-hover);border-color:var(--solely-error-hover)}@keyframes solely-popconfirm-fade-in{0%{opacity:0;transform:scale(.9)}to{opacity:1;transform:scale(1)}}@keyframes solely-popconfirm-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.9)}}";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const o="
|
|
1
|
+
const o=".solely-popconfirm,.solely-popconfirm *,.solely-popconfirm *:before,.solely-popconfirm *:after,.solely-popconfirm-overlay{box-sizing:border-box}.solely-popconfirm-overlay{position:absolute;top:0;left:0;width:100%;min-height:100%;z-index:var(--solely-z-index-popover)}.solely-popconfirm{position:absolute;background-color:var(--solely-component-bg);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-lg);padding:var(--solely-spacing-lg);min-width:200px;max-width:300px;font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);z-index:var(--solely-z-index-popover);animation:solely-popconfirm-fade-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-popconfirm.is-closing{animation:solely-popconfirm-fade-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-popconfirm__arrow{position:absolute;width:var(--solely-popconfirm-arrow-size, 8px);height:var(--solely-popconfirm-arrow-size, 8px);background-color:var(--solely-component-bg);transform:rotate(45deg)}.solely-popconfirm--top .solely-popconfirm__arrow,.solely-popconfirm--topLeft .solely-popconfirm__arrow,.solely-popconfirm--topRight .solely-popconfirm__arrow{bottom:calc(var(--solely-popconfirm-arrow-size, 8px) / -2);border-bottom:1px solid var(--solely-border-color-split);border-right:1px solid var(--solely-border-color-split)}.solely-popconfirm--bottom .solely-popconfirm__arrow,.solely-popconfirm--bottomLeft .solely-popconfirm__arrow,.solely-popconfirm--bottomRight .solely-popconfirm__arrow{top:calc(var(--solely-popconfirm-arrow-size, 8px) / -2);border-top:1px solid var(--solely-border-color-split);border-left:1px solid var(--solely-border-color-split)}.solely-popconfirm--left .solely-popconfirm__arrow,.solely-popconfirm--leftTop .solely-popconfirm__arrow,.solely-popconfirm--leftBottom .solely-popconfirm__arrow{right:calc(var(--solely-popconfirm-arrow-size, 8px) / -2);border-top:1px solid var(--solely-border-color-split);border-right:1px solid var(--solely-border-color-split)}.solely-popconfirm--right .solely-popconfirm__arrow,.solely-popconfirm--rightTop .solely-popconfirm__arrow,.solely-popconfirm--rightBottom .solely-popconfirm__arrow{left:calc(var(--solely-popconfirm-arrow-size, 8px) / -2);border-bottom:1px solid var(--solely-border-color-split);border-left:1px solid var(--solely-border-color-split)}.solely-popconfirm__content{display:flex;align-items:flex-start;gap:var(--solely-spacing-sm);margin-bottom:var(--solely-spacing-md)}.solely-popconfirm__icon{color:var(--solely-warning);font-size:var(--solely-font-size-lg);flex-shrink:0}.solely-popconfirm__text{flex:1}.solely-popconfirm__title{font-weight:500;color:var(--solely-text-primary);line-height:var(--solely-line-height-md)}.solely-popconfirm__description{font-size:var(--solely-font-size-sm);color:var(--solely-text-secondary);margin-top:var(--solely-spacing-xs);line-height:var(--solely-line-height-sm)}.solely-popconfirm__buttons{display:flex;justify-content:flex-end;gap:var(--solely-spacing-sm)}.solely-popconfirm__btn{padding:var(--solely-spacing-xs) var(--solely-spacing-md);border-radius:var(--solely-border-radius-sm);font-size:var(--solely-font-size-sm);cursor:pointer;transition:all var(--solely-transition-duration) var(--solely-transition-timing);border:1px solid transparent;font-family:var(--solely-font-family);line-height:var(--solely-line-height-sm)}.solely-popconfirm__btn--cancel{background-color:var(--solely-component-bg);border-color:var(--solely-border-color);color:var(--solely-text-primary)}.solely-popconfirm__btn--cancel:hover{border-color:var(--solely-primary);color:var(--solely-primary)}.solely-popconfirm__btn--ok{background-color:var(--solely-primary);border-color:var(--solely-primary);color:var(--solely-white)}.solely-popconfirm__btn--ok:hover{background-color:var(--solely-primary-hover);border-color:var(--solely-primary-hover)}.solely-popconfirm__btn--danger{background-color:var(--solely-error);border-color:var(--solely-error)}.solely-popconfirm__btn--danger:hover{background-color:var(--solely-error-hover);border-color:var(--solely-error-hover)}@keyframes solely-popconfirm-fade-in{0%{opacity:0;transform:scale(.9)}to{opacity:1;transform:scale(1)}}@keyframes solely-popconfirm-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.9)}}";export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),o={placement:"top",trigger:"hover",duration:3e3,singleton:!0},n=[],r=new WeakSet;let l=null;function s(e,t,o,n=8){const r=e.getBoundingClientRect(),l=t.offsetWidth||250,s=t.offsetHeight||100;let i,a,c=0,d=0;switch(o){case"top":c=r.top-s-n,d=r.left+(r.width-l)/2,i=l/2-4;break;case"topLeft":c=r.top-s-n,d=r.left,i=16;break;case"topRight":c=r.top-s-n,d=r.right-l,i=l-24;break;case"bottom":c=r.bottom+n,d=r.left+(r.width-l)/2,i=l/2-4;break;case"bottomLeft":c=r.bottom+n,d=r.left,i=16;break;case"bottomRight":c=r.bottom+n,d=r.right-l,i=l-24;break;case"left":c=r.top+(r.height-s)/2,d=r.left-l-n,a=s/2-4;break;case"leftTop":c=r.top,d=r.left-l-n,a=16;break;case"leftBottom":c=r.bottom-s,d=r.left-l-n,a=s-24;break;case"right":c=r.top+(r.height-s)/2,d=r.right+n,a=s/2-4;break;case"rightTop":c=r.top,d=r.right+n,a=16;break;case"rightBottom":c=r.bottom-s,d=r.right+n,a=s-24}return c=Math.max(8,Math.min(c,window.innerHeight-s-8)),d=Math.max(8,Math.min(d,window.innerWidth-l-8)),{top:c,left:d,arrowLeft:i,arrowTop:a}}let i=null,a=!1;function c(){i||(i=requestAnimationFrame(()=>{i=null,n.forEach(e=>{const t=e.element;if(!t||!e.target)return;const o=t.querySelector(".tooltip__arrow"),n=s(e.target,t,e.placement);t.style.top=`${n.top}px`,t.style.left=`${n.left}px`,o&&(void 0!==n.arrowLeft&&(o.style.left=`${n.arrowLeft}px`,o.style.top=""),void 0!==n.arrowTop&&(o.style.top=`${n.arrowTop}px`,o.style.left=""))})}))}function d(){a&&(a=!1,window.removeEventListener("resize",c),i&&(cancelAnimationFrame(i),i=null))}async function m(e,t){const o=n.findIndex(t=>t.id===e);if(-1===o)return;const r=n[o];r.element.classList.add("is-closing"),r.element.remove(),r.scrollParents.forEach(e=>e.removeEventListener("scroll",c)),n.splice(o,1),0===n.length&&d(),null==t||t()}function u(){if(0===n.length)return;const e=new Set;n.forEach(t=>{t.scrollParents.forEach(t=>e.add(t)),t.element.classList.add("is-closing"),t.element.remove()}),e.forEach(e=>e.removeEventListener("scroll",c)),n.length=0,d()}function f(r,i){var d;const m=e.generateId();e.injectStyle("solely-tooltip-styles",t.default);const f=i.placement??o.placement,p=n.findIndex(e=>e.target===r);if(-1!==p){const e=n[p];e.element.remove(),e.scrollParents.forEach(e=>e.removeEventListener("scroll",c)),n.splice(p,1)}o.singleton&&n.length>0&&u();const h=e.createElement("div",{className:`tooltip tooltip--${f}${i.className?` ${i.className}`:""}`,styles:{...i.style,...i.color?{backgroundColor:i.color}:{}}});var v;v=h,(()=>{const e=document.documentElement.getAttribute("data-theme");e?v.setAttribute("data-theme",e):v.removeAttribute("data-theme")})(),l||(l=new MutationObserver(()=>{const e=document.documentElement.getAttribute("data-theme");n.forEach(t=>{e?t.element.setAttribute("data-theme",e):t.element.removeAttribute("data-theme")})}),l.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}));const g=e.createElement("div",{className:"tooltip__content"});i.content&&("string"==typeof i.content?g.textContent=i.content:i.content instanceof HTMLElement&&g.appendChild(i.content.cloneNode(!0))),h.appendChild(g);const b=e.createElement("div",{className:"tooltip__arrow"});i.color&&(b.style.backgroundColor=i.color),h.appendChild(b),document.body.appendChild(h),requestAnimationFrame(()=>{const e=s(r,h,f);h.style.top=`${e.top}px`,h.style.left=`${e.left}px`,void 0!==e.arrowLeft&&(b.style.left=`${e.arrowLeft}px`),void 0!==e.arrowTop&&(b.style.top=`${e.arrowTop}px`)});const E=function(e){const t=[];let o=e.parentElement;for(;o&&o!==document.body;){const e=getComputedStyle(o);"auto"!==e.overflow&&"scroll"!==e.overflow&&"auto"!==e.overflowY&&"scroll"!==e.overflowY||t.push(o),o=o.parentElement}return t}(r);return E.forEach(e=>e.addEventListener("scroll",c)),a||0===n.length||(a=!0,window.addEventListener("resize",c)),n.push({id:m,element:h,target:r,placement:f,scrollParents:E}),null==(d=i.onVisibleChange)||d.call(i,!0),m}const p={bind:function(e,t){if(r.has(e))return{show:()=>{},hide:()=>{},destroy:()=>{}};r.add(e);const n=t.trigger??o.trigger;let l=t.visible??t.defaultVisible??!1,s=null;const i=()=>{l||(l=!0,s=f(e,t))},a=()=>{if(!l||null===s)return;l=!1;const e=s;s=null,m(e,()=>{var e;null==(e=t.onVisibleChange)||e.call(t,!1)})},c=e=>{e.stopPropagation(),l?a():i()},d=t=>{l&&(e.contains(t.target)||a())};return"hover"===n?(e.addEventListener("mouseenter",i),e.addEventListener("mouseleave",a)):"click"===n?(e.addEventListener("click",c),document.addEventListener("click",d)):"focus"===n&&(e.addEventListener("focus",i),e.addEventListener("blur",a)),l&&(s=f(e,t)),{show:i,hide:a,destroy:()=>{a(),r.delete(e),"hover"===n?(e.removeEventListener("mouseenter",i),e.removeEventListener("mouseleave",a)):"click"===n?(e.removeEventListener("click",c),document.removeEventListener("click",d)):"focus"===n&&(e.removeEventListener("focus",i),e.removeEventListener("blur",a))}}},show:function(e,t){const n=f(e,t),r=t.duration??o.duration;r>0&&setTimeout(()=>m(n),r)},hide:async function(e){u(),null==e||e()},config:function(e){Object.assign(o,e)}};exports.Tooltip=p;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../utils.cjs"),t=require("./style.css.cjs"),o={placement:"top",trigger:"hover",duration:3e3,singleton:!0},n=[],r=new WeakSet;let l=null;function s(e,t,o,n=8){const r=e.getBoundingClientRect(),l=t.offsetWidth||250,s=t.offsetHeight||100;let i,a,c=0,d=0;switch(o){case"top":c=r.top-s-n,d=r.left+(r.width-l)/2,i=l/2-4;break;case"topLeft":c=r.top-s-n,d=r.left,i=16;break;case"topRight":c=r.top-s-n,d=r.right-l,i=l-24;break;case"bottom":c=r.bottom+n,d=r.left+(r.width-l)/2,i=l/2-4;break;case"bottomLeft":c=r.bottom+n,d=r.left,i=16;break;case"bottomRight":c=r.bottom+n,d=r.right-l,i=l-24;break;case"left":c=r.top+(r.height-s)/2,d=r.left-l-n,a=s/2-4;break;case"leftTop":c=r.top,d=r.left-l-n,a=16;break;case"leftBottom":c=r.bottom-s,d=r.left-l-n,a=s-24;break;case"right":c=r.top+(r.height-s)/2,d=r.right+n,a=s/2-4;break;case"rightTop":c=r.top,d=r.right+n,a=16;break;case"rightBottom":c=r.bottom-s,d=r.right+n,a=s-24}return c=Math.max(8,Math.min(c,window.innerHeight-s-8)),d=Math.max(8,Math.min(d,window.innerWidth-l-8)),{top:c,left:d,arrowLeft:i,arrowTop:a}}let i=null,a=!1;function c(){i||(i=requestAnimationFrame(()=>{i=null,n.forEach(e=>{const t=e.element;if(!t||!e.target)return;const o=t.querySelector(".solely-tooltip__arrow"),n=s(e.target,t,e.placement);t.style.top=`${n.top}px`,t.style.left=`${n.left}px`,o&&(void 0!==n.arrowLeft&&(o.style.left=`${n.arrowLeft}px`,o.style.top=""),void 0!==n.arrowTop&&(o.style.top=`${n.arrowTop}px`,o.style.left=""))})}))}function d(){a&&(a=!1,window.removeEventListener("resize",c),i&&(cancelAnimationFrame(i),i=null))}async function m(e,t){const o=n.findIndex(t=>t.id===e);if(-1===o)return;const r=n[o];r.element.classList.add("is-closing"),r.element.remove(),r.scrollParents.forEach(e=>e.removeEventListener("scroll",c)),n.splice(o,1),0===n.length&&d(),null==t||t()}function u(){if(0===n.length)return;const e=new Set;n.forEach(t=>{t.scrollParents.forEach(t=>e.add(t)),t.element.classList.add("is-closing"),t.element.remove()}),e.forEach(e=>e.removeEventListener("scroll",c)),n.length=0,d()}function f(r,i){var d;const m=e.generateId();e.injectStyle("solely-tooltip-styles",t.default);const f=i.placement??o.placement,p=n.findIndex(e=>e.target===r);if(-1!==p){const e=n[p];e.element.remove(),e.scrollParents.forEach(e=>e.removeEventListener("scroll",c)),n.splice(p,1)}o.singleton&&n.length>0&&u();const h=e.createElement("div",{className:`solely-tooltip solely-tooltip--${f}${i.className?` ${i.className}`:""}`,styles:{...i.style,...i.color?{backgroundColor:i.color}:{}}});var v;v=h,(()=>{const e=document.documentElement.getAttribute("data-theme");e?v.setAttribute("data-theme",e):v.removeAttribute("data-theme")})(),l||(l=new MutationObserver(()=>{const e=document.documentElement.getAttribute("data-theme");n.forEach(t=>{e?t.element.setAttribute("data-theme",e):t.element.removeAttribute("data-theme")})}),l.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}));const g=e.createElement("div",{className:"solely-tooltip__content"});i.content&&("string"==typeof i.content?g.textContent=i.content:i.content instanceof HTMLElement&&g.appendChild(i.content.cloneNode(!0))),h.appendChild(g);const b=e.createElement("div",{className:"solely-tooltip__arrow"});i.color&&(b.style.backgroundColor=i.color),h.appendChild(b),document.body.appendChild(h),requestAnimationFrame(()=>{const e=s(r,h,f);h.style.top=`${e.top}px`,h.style.left=`${e.left}px`,void 0!==e.arrowLeft&&(b.style.left=`${e.arrowLeft}px`),void 0!==e.arrowTop&&(b.style.top=`${e.arrowTop}px`)});const E=function(e){const t=[];let o=e.parentElement;for(;o&&o!==document.body;){const e=getComputedStyle(o);"auto"!==e.overflow&&"scroll"!==e.overflow&&"auto"!==e.overflowY&&"scroll"!==e.overflowY||t.push(o),o=o.parentElement}return t}(r);return E.forEach(e=>e.addEventListener("scroll",c)),a||0===n.length||(a=!0,window.addEventListener("resize",c)),n.push({id:m,element:h,target:r,placement:f,scrollParents:E}),null==(d=i.onVisibleChange)||d.call(i,!0),m}const p={bind:function(e,t){if(r.has(e))return{show:()=>{},hide:()=>{},destroy:()=>{}};r.add(e);const n=t.trigger??o.trigger;let l=t.visible??t.defaultVisible??!1,s=null;const i=()=>{l||(l=!0,s=f(e,t))},a=()=>{if(!l||null===s)return;l=!1;const e=s;s=null,m(e,()=>{var e;null==(e=t.onVisibleChange)||e.call(t,!1)})},c=e=>{e.stopPropagation(),l?a():i()},d=t=>{l&&(e.contains(t.target)||a())};return"hover"===n?(e.addEventListener("mouseenter",i),e.addEventListener("mouseleave",a)):"click"===n?(e.addEventListener("click",c),document.addEventListener("click",d)):"focus"===n&&(e.addEventListener("focus",i),e.addEventListener("blur",a)),l&&(s=f(e,t)),{show:i,hide:a,destroy:()=>{a(),r.delete(e),"hover"===n?(e.removeEventListener("mouseenter",i),e.removeEventListener("mouseleave",a)):"click"===n?(e.removeEventListener("click",c),document.removeEventListener("click",d)):"focus"===n&&(e.removeEventListener("focus",i),e.removeEventListener("blur",a))}}},show:function(e,t){const n=f(e,t),r=t.duration??o.duration;r>0&&setTimeout(()=>m(n),r)},hide:async function(e){u(),null==e||e()},config:function(e){Object.assign(o,e)}};exports.Tooltip=p;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{generateId as e,createElement as t,injectStyle as o}from"../utils.js";import n from"./style.css.js";const r={placement:"top",trigger:"hover",duration:3e3,singleton:!0},l=[],s=new WeakSet;let i=null;function a(e,t,o,n=8){const r=e.getBoundingClientRect(),l=t.offsetWidth||250,s=t.offsetHeight||100;let i,a,c=0,d=0;switch(o){case"top":c=r.top-s-n,d=r.left+(r.width-l)/2,i=l/2-4;break;case"topLeft":c=r.top-s-n,d=r.left,i=16;break;case"topRight":c=r.top-s-n,d=r.right-l,i=l-24;break;case"bottom":c=r.bottom+n,d=r.left+(r.width-l)/2,i=l/2-4;break;case"bottomLeft":c=r.bottom+n,d=r.left,i=16;break;case"bottomRight":c=r.bottom+n,d=r.right-l,i=l-24;break;case"left":c=r.top+(r.height-s)/2,d=r.left-l-n,a=s/2-4;break;case"leftTop":c=r.top,d=r.left-l-n,a=16;break;case"leftBottom":c=r.bottom-s,d=r.left-l-n,a=s-24;break;case"right":c=r.top+(r.height-s)/2,d=r.right+n,a=s/2-4;break;case"rightTop":c=r.top,d=r.right+n,a=16;break;case"rightBottom":c=r.bottom-s,d=r.right+n,a=s-24}return c=Math.max(8,Math.min(c,window.innerHeight-s-8)),d=Math.max(8,Math.min(d,window.innerWidth-l-8)),{top:c,left:d,arrowLeft:i,arrowTop:a}}let c=null,d=!1;function m(){c||(c=requestAnimationFrame(()=>{c=null,l.forEach(e=>{const t=e.element;if(!t||!e.target)return;const o=t.querySelector(".tooltip__arrow"),n=a(e.target,t,e.placement);t.style.top=`${n.top}px`,t.style.left=`${n.left}px`,o&&(void 0!==n.arrowLeft&&(o.style.left=`${n.arrowLeft}px`,o.style.top=""),void 0!==n.arrowTop&&(o.style.top=`${n.arrowTop}px`,o.style.left=""))})}))}function u(){d&&(d=!1,window.removeEventListener("resize",m),c&&(cancelAnimationFrame(c),c=null))}async function f(e,t){const o=l.findIndex(t=>t.id===e);if(-1===o)return;const n=l[o];n.element.classList.add("is-closing"),n.element.remove(),n.scrollParents.forEach(e=>e.removeEventListener("scroll",m)),l.splice(o,1),0===l.length&&u(),null==t||t()}function p(){if(0===l.length)return;const e=new Set;l.forEach(t=>{t.scrollParents.forEach(t=>e.add(t)),t.element.classList.add("is-closing"),t.element.remove()}),e.forEach(e=>e.removeEventListener("scroll",m)),l.length=0,u()}function h(s,c){var u;const f=e();o("solely-tooltip-styles",n);const h=c.placement??r.placement,v=l.findIndex(e=>e.target===s);if(-1!==v){const e=l[v];e.element.remove(),e.scrollParents.forEach(e=>e.removeEventListener("scroll",m)),l.splice(v,1)}r.singleton&&l.length>0&&p();const g=t("div",{className:`tooltip tooltip--${h}${c.className?` ${c.className}`:""}`,styles:{...c.style,...c.color?{backgroundColor:c.color}:{}}});var b;b=g,(()=>{const e=document.documentElement.getAttribute("data-theme");e?b.setAttribute("data-theme",e):b.removeAttribute("data-theme")})(),i||(i=new MutationObserver(()=>{const e=document.documentElement.getAttribute("data-theme");l.forEach(t=>{e?t.element.setAttribute("data-theme",e):t.element.removeAttribute("data-theme")})}),i.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}));const w=t("div",{className:"tooltip__content"});c.content&&("string"==typeof c.content?w.textContent=c.content:c.content instanceof HTMLElement&&w.appendChild(c.content.cloneNode(!0))),g.appendChild(w);const E=t("div",{className:"tooltip__arrow"});c.color&&(E.style.backgroundColor=c.color),g.appendChild(E),document.body.appendChild(g),requestAnimationFrame(()=>{const e=a(s,g,h);g.style.top=`${e.top}px`,g.style.left=`${e.left}px`,void 0!==e.arrowLeft&&(E.style.left=`${e.arrowLeft}px`),void 0!==e.arrowTop&&(E.style.top=`${e.arrowTop}px`)});const
|
|
1
|
+
import{generateId as e,createElement as t,injectStyle as o}from"../utils.js";import n from"./style.css.js";const r={placement:"top",trigger:"hover",duration:3e3,singleton:!0},l=[],s=new WeakSet;let i=null;function a(e,t,o,n=8){const r=e.getBoundingClientRect(),l=t.offsetWidth||250,s=t.offsetHeight||100;let i,a,c=0,d=0;switch(o){case"top":c=r.top-s-n,d=r.left+(r.width-l)/2,i=l/2-4;break;case"topLeft":c=r.top-s-n,d=r.left,i=16;break;case"topRight":c=r.top-s-n,d=r.right-l,i=l-24;break;case"bottom":c=r.bottom+n,d=r.left+(r.width-l)/2,i=l/2-4;break;case"bottomLeft":c=r.bottom+n,d=r.left,i=16;break;case"bottomRight":c=r.bottom+n,d=r.right-l,i=l-24;break;case"left":c=r.top+(r.height-s)/2,d=r.left-l-n,a=s/2-4;break;case"leftTop":c=r.top,d=r.left-l-n,a=16;break;case"leftBottom":c=r.bottom-s,d=r.left-l-n,a=s-24;break;case"right":c=r.top+(r.height-s)/2,d=r.right+n,a=s/2-4;break;case"rightTop":c=r.top,d=r.right+n,a=16;break;case"rightBottom":c=r.bottom-s,d=r.right+n,a=s-24}return c=Math.max(8,Math.min(c,window.innerHeight-s-8)),d=Math.max(8,Math.min(d,window.innerWidth-l-8)),{top:c,left:d,arrowLeft:i,arrowTop:a}}let c=null,d=!1;function m(){c||(c=requestAnimationFrame(()=>{c=null,l.forEach(e=>{const t=e.element;if(!t||!e.target)return;const o=t.querySelector(".solely-tooltip__arrow"),n=a(e.target,t,e.placement);t.style.top=`${n.top}px`,t.style.left=`${n.left}px`,o&&(void 0!==n.arrowLeft&&(o.style.left=`${n.arrowLeft}px`,o.style.top=""),void 0!==n.arrowTop&&(o.style.top=`${n.arrowTop}px`,o.style.left=""))})}))}function u(){d&&(d=!1,window.removeEventListener("resize",m),c&&(cancelAnimationFrame(c),c=null))}async function f(e,t){const o=l.findIndex(t=>t.id===e);if(-1===o)return;const n=l[o];n.element.classList.add("is-closing"),n.element.remove(),n.scrollParents.forEach(e=>e.removeEventListener("scroll",m)),l.splice(o,1),0===l.length&&u(),null==t||t()}function p(){if(0===l.length)return;const e=new Set;l.forEach(t=>{t.scrollParents.forEach(t=>e.add(t)),t.element.classList.add("is-closing"),t.element.remove()}),e.forEach(e=>e.removeEventListener("scroll",m)),l.length=0,u()}function h(s,c){var u;const f=e();o("solely-tooltip-styles",n);const h=c.placement??r.placement,v=l.findIndex(e=>e.target===s);if(-1!==v){const e=l[v];e.element.remove(),e.scrollParents.forEach(e=>e.removeEventListener("scroll",m)),l.splice(v,1)}r.singleton&&l.length>0&&p();const g=t("div",{className:`solely-tooltip solely-tooltip--${h}${c.className?` ${c.className}`:""}`,styles:{...c.style,...c.color?{backgroundColor:c.color}:{}}});var b;b=g,(()=>{const e=document.documentElement.getAttribute("data-theme");e?b.setAttribute("data-theme",e):b.removeAttribute("data-theme")})(),i||(i=new MutationObserver(()=>{const e=document.documentElement.getAttribute("data-theme");l.forEach(t=>{e?t.element.setAttribute("data-theme",e):t.element.removeAttribute("data-theme")})}),i.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}));const w=t("div",{className:"solely-tooltip__content"});c.content&&("string"==typeof c.content?w.textContent=c.content:c.content instanceof HTMLElement&&w.appendChild(c.content.cloneNode(!0))),g.appendChild(w);const E=t("div",{className:"solely-tooltip__arrow"});c.color&&(E.style.backgroundColor=c.color),g.appendChild(E),document.body.appendChild(g),requestAnimationFrame(()=>{const e=a(s,g,h);g.style.top=`${e.top}px`,g.style.left=`${e.left}px`,void 0!==e.arrowLeft&&(E.style.left=`${e.arrowLeft}px`),void 0!==e.arrowTop&&(E.style.top=`${e.arrowTop}px`)});const y=function(e){const t=[];let o=e.parentElement;for(;o&&o!==document.body;){const e=getComputedStyle(o);"auto"!==e.overflow&&"scroll"!==e.overflow&&"auto"!==e.overflowY&&"scroll"!==e.overflowY||t.push(o),o=o.parentElement}return t}(s);return y.forEach(e=>e.addEventListener("scroll",m)),d||0===l.length||(d=!0,window.addEventListener("resize",m)),l.push({id:f,element:g,target:s,placement:h,scrollParents:y}),null==(u=c.onVisibleChange)||u.call(c,!0),f}const v={bind:function(e,t){if(s.has(e))return{show:()=>{},hide:()=>{},destroy:()=>{}};s.add(e);const o=t.trigger??r.trigger;let n=t.visible??t.defaultVisible??!1,l=null;const i=()=>{n||(n=!0,l=h(e,t))},a=()=>{if(!n||null===l)return;n=!1;const e=l;l=null,f(e,()=>{var e;null==(e=t.onVisibleChange)||e.call(t,!1)})},c=e=>{e.stopPropagation(),n?a():i()},d=t=>{n&&(e.contains(t.target)||a())};return"hover"===o?(e.addEventListener("mouseenter",i),e.addEventListener("mouseleave",a)):"click"===o?(e.addEventListener("click",c),document.addEventListener("click",d)):"focus"===o&&(e.addEventListener("focus",i),e.addEventListener("blur",a)),n&&(l=h(e,t)),{show:i,hide:a,destroy:()=>{a(),s.delete(e),"hover"===o?(e.removeEventListener("mouseenter",i),e.removeEventListener("mouseleave",a)):"click"===o?(e.removeEventListener("click",c),document.removeEventListener("click",d)):"focus"===o&&(e.removeEventListener("focus",i),e.removeEventListener("blur",a))}}},show:function(e,t){const o=h(e,t),n=t.duration??r.duration;n>0&&setTimeout(()=>f(o),n)},hide:async function(e){p(),null==e||e()},config:function(e){Object.assign(r,e)}};export{v as Tooltip};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default=".tooltip{position:fixed;background-color:var(--solely-inverted-bg);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-md);padding:var(--solely-spacing-sm) var(--solely-spacing-md);width:max-content;max-width:250px;font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);font-weight:400;line-height:var(--solely-line-height-md);color:var(--solely-inverted-text);text-align:left;text-decoration:none;z-index:var(--solely-z-index-tooltip);pointer-events:auto;animation:tooltip-fade-in var(--solely-transition-duration) var(--solely-transition-timing)}.tooltip.is-closing{animation:tooltip-fade-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.tooltip__content{position:relative;z-index:1;word-wrap:break-word;overflow-wrap:break-word}.tooltip__arrow{position:absolute;width:var(--solely-tooltip-arrow-size, 8px);height:var(--solely-tooltip-arrow-size, 8px);background-color:var(--solely-inverted-bg);transform:rotate(45deg);z-index:0}.tooltip--top .tooltip__arrow,.tooltip--topLeft .tooltip__arrow,.tooltip--topRight .tooltip__arrow{bottom:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.tooltip--bottom .tooltip__arrow,.tooltip--bottomLeft .tooltip__arrow,.tooltip--bottomRight .tooltip__arrow{top:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.tooltip--left .tooltip__arrow,.tooltip--leftTop .tooltip__arrow,.tooltip--leftBottom .tooltip__arrow{right:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.tooltip--right .tooltip__arrow,.tooltip--rightTop .tooltip__arrow,.tooltip--rightBottom .tooltip__arrow{left:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}@keyframes tooltip-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes tooltip-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}";
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default=".solely-tooltip,.solely-tooltip *,.solely-tooltip *:before,.solely-tooltip *:after{box-sizing:border-box}.solely-tooltip{position:fixed;background-color:var(--solely-inverted-bg);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-md);padding:var(--solely-spacing-sm) var(--solely-spacing-md);width:max-content;max-width:250px;font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);font-weight:400;line-height:var(--solely-line-height-md);color:var(--solely-inverted-text);text-align:left;text-decoration:none;z-index:var(--solely-z-index-tooltip);pointer-events:auto;animation:solely-tooltip-fade-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-tooltip.is-closing{animation:solely-tooltip-fade-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-tooltip__content{position:relative;z-index:1;word-wrap:break-word;overflow-wrap:break-word}.solely-tooltip__arrow{position:absolute;width:var(--solely-tooltip-arrow-size, 8px);height:var(--solely-tooltip-arrow-size, 8px);background-color:var(--solely-inverted-bg);transform:rotate(45deg);z-index:0}.solely-tooltip--top .solely-tooltip__arrow,.solely-tooltip--topLeft .solely-tooltip__arrow,.solely-tooltip--topRight .solely-tooltip__arrow{bottom:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.solely-tooltip--bottom .solely-tooltip__arrow,.solely-tooltip--bottomLeft .solely-tooltip__arrow,.solely-tooltip--bottomRight .solely-tooltip__arrow{top:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.solely-tooltip--left .solely-tooltip__arrow,.solely-tooltip--leftTop .solely-tooltip__arrow,.solely-tooltip--leftBottom .solely-tooltip__arrow{right:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.solely-tooltip--right .solely-tooltip__arrow,.solely-tooltip--rightTop .solely-tooltip__arrow,.solely-tooltip--rightBottom .solely-tooltip__arrow{left:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}@keyframes solely-tooltip-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes solely-tooltip-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const o=".tooltip{position:fixed;background-color:var(--solely-inverted-bg);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-md);padding:var(--solely-spacing-sm) var(--solely-spacing-md);width:max-content;max-width:250px;font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);font-weight:400;line-height:var(--solely-line-height-md);color:var(--solely-inverted-text);text-align:left;text-decoration:none;z-index:var(--solely-z-index-tooltip);pointer-events:auto;animation:tooltip-fade-in var(--solely-transition-duration) var(--solely-transition-timing)}.tooltip.is-closing{animation:tooltip-fade-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.tooltip__content{position:relative;z-index:1;word-wrap:break-word;overflow-wrap:break-word}.tooltip__arrow{position:absolute;width:var(--solely-tooltip-arrow-size, 8px);height:var(--solely-tooltip-arrow-size, 8px);background-color:var(--solely-inverted-bg);transform:rotate(45deg);z-index:0}.tooltip--top .tooltip__arrow,.tooltip--topLeft .tooltip__arrow,.tooltip--topRight .tooltip__arrow{bottom:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.tooltip--bottom .tooltip__arrow,.tooltip--bottomLeft .tooltip__arrow,.tooltip--bottomRight .tooltip__arrow{top:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.tooltip--left .tooltip__arrow,.tooltip--leftTop .tooltip__arrow,.tooltip--leftBottom .tooltip__arrow{right:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.tooltip--right .tooltip__arrow,.tooltip--rightTop .tooltip__arrow,.tooltip--rightBottom .tooltip__arrow{left:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}@keyframes tooltip-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes tooltip-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}";export{o as default};
|
|
1
|
+
const o=".solely-tooltip,.solely-tooltip *,.solely-tooltip *:before,.solely-tooltip *:after{box-sizing:border-box}.solely-tooltip{position:fixed;background-color:var(--solely-inverted-bg);border-radius:var(--solely-border-radius-md);box-shadow:var(--solely-shadow-md);padding:var(--solely-spacing-sm) var(--solely-spacing-md);width:max-content;max-width:250px;font-family:var(--solely-font-family);font-size:var(--solely-font-size-md);font-weight:400;line-height:var(--solely-line-height-md);color:var(--solely-inverted-text);text-align:left;text-decoration:none;z-index:var(--solely-z-index-tooltip);pointer-events:auto;animation:solely-tooltip-fade-in var(--solely-transition-duration) var(--solely-transition-timing)}.solely-tooltip.is-closing{animation:solely-tooltip-fade-out var(--solely-transition-duration) var(--solely-transition-timing) forwards}.solely-tooltip__content{position:relative;z-index:1;word-wrap:break-word;overflow-wrap:break-word}.solely-tooltip__arrow{position:absolute;width:var(--solely-tooltip-arrow-size, 8px);height:var(--solely-tooltip-arrow-size, 8px);background-color:var(--solely-inverted-bg);transform:rotate(45deg);z-index:0}.solely-tooltip--top .solely-tooltip__arrow,.solely-tooltip--topLeft .solely-tooltip__arrow,.solely-tooltip--topRight .solely-tooltip__arrow{bottom:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.solely-tooltip--bottom .solely-tooltip__arrow,.solely-tooltip--bottomLeft .solely-tooltip__arrow,.solely-tooltip--bottomRight .solely-tooltip__arrow{top:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.solely-tooltip--left .solely-tooltip__arrow,.solely-tooltip--leftTop .solely-tooltip__arrow,.solely-tooltip--leftBottom .solely-tooltip__arrow{right:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}.solely-tooltip--right .solely-tooltip__arrow,.solely-tooltip--rightTop .solely-tooltip__arrow,.solely-tooltip--rightBottom .solely-tooltip__arrow{left:calc(var(--solely-tooltip-arrow-size, 8px) / -2)}@keyframes solely-tooltip-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes solely-tooltip-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}";export{o as default};
|
package/dist/router/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
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;
|
package/dist/router/core.d.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { RouteMatch, RouterOptions, NavigationResult } from './types';
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* 路由器就绪 Promise(向后兼容)
|
|
4
|
+
*
|
|
5
|
+
* 支持两种用法:
|
|
6
|
+
* - await routerReady // 旧版用法,直接 await 常量
|
|
7
|
+
* - await routerReady() // 新版用法,函数调用
|
|
8
|
+
* - routerReady.then(...) // Promise 链式调用
|
|
9
|
+
*/
|
|
10
|
+
export declare const routerReady: Promise<Router> & (() => Promise<Router>);
|
|
4
11
|
/**
|
|
5
12
|
* 创建路由器实例(单例)
|
|
6
|
-
* @param options 路由器配置选项
|
|
7
|
-
* @returns 路由器实例
|
|
8
13
|
*/
|
|
9
14
|
export declare function createRouter(options: RouterOptions): Router;
|
|
10
15
|
/**
|
|
11
16
|
* 获取路由器实例
|
|
12
|
-
* @returns 路由器实例,如果未创建则返回 null
|
|
13
17
|
*/
|
|
14
18
|
export declare function getRouter(): Router | null;
|
|
15
19
|
/**
|
|
@@ -24,27 +28,22 @@ export declare class Router {
|
|
|
24
28
|
private currentRoute;
|
|
25
29
|
private listeners;
|
|
26
30
|
private componentCache;
|
|
27
|
-
private
|
|
31
|
+
private keepAliveCache;
|
|
32
|
+
private keepAliveKeys;
|
|
33
|
+
private navigationId;
|
|
34
|
+
private maxKeepAlive;
|
|
28
35
|
constructor(options: RouterOptions);
|
|
36
|
+
private static readonly MAX_REDIRECTS;
|
|
29
37
|
matchRoute(path?: string): RouteMatch | null;
|
|
38
|
+
private matchRouteInternal;
|
|
30
39
|
private recursiveMatch;
|
|
31
40
|
private calculateScore;
|
|
32
41
|
private parseQuery;
|
|
33
42
|
private normalizePath;
|
|
34
43
|
getPath(): string;
|
|
35
44
|
private updateBrowserHistory;
|
|
36
|
-
/**
|
|
37
|
-
* @param fromEvent 标志位:是否由浏览器 popstate 事件触发
|
|
38
|
-
*/
|
|
39
45
|
navigate(path?: string, replace?: boolean, fromEvent?: boolean): Promise<NavigationResult>;
|
|
40
|
-
/**
|
|
41
|
-
* 将逻辑路径解析为浏览器真实的 URL 路径
|
|
42
|
-
* 供 RouterLink 等组件生成 href 使用
|
|
43
|
-
*/
|
|
44
46
|
resolve(path?: string): string;
|
|
45
|
-
/**
|
|
46
|
-
* 获取当前模式(供外部组件判断,如 RouterLink)
|
|
47
|
-
*/
|
|
48
47
|
get modeType(): 'hash' | 'history';
|
|
49
48
|
pushWithQuery(path: string | undefined, query: Record<string, string>): Promise<NavigationResult>;
|
|
50
49
|
push(path?: string): Promise<NavigationResult>;
|
|
@@ -56,21 +55,14 @@ export declare class Router {
|
|
|
56
55
|
private isStarted;
|
|
57
56
|
private handleRouteChange;
|
|
58
57
|
setupListeners(): void;
|
|
59
|
-
/**
|
|
60
|
-
* 销毁路由器,清理事件监听和缓存
|
|
61
|
-
*/
|
|
62
58
|
destroy(): void;
|
|
63
59
|
getCurrentRoute(): RouteMatch | null;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
getKeepAlive(key: string): HTMLElement | undefined;
|
|
61
|
+
setKeepAlive(key: string, el: HTMLElement): void;
|
|
62
|
+
hasKeepAlive(key: string): boolean;
|
|
63
|
+
private evictKeepAlive;
|
|
64
|
+
private cacheKey;
|
|
68
65
|
prefetch(path: string): void;
|
|
69
|
-
/**
|
|
70
|
-
* 从缓存中获取已加载的组件
|
|
71
|
-
* @param path 路径
|
|
72
|
-
* @returns 缓存的组件 Promise 或 undefined
|
|
73
|
-
*/
|
|
74
66
|
getComponentFromCache(path: string): Promise<string | {
|
|
75
67
|
tagName: string;
|
|
76
68
|
}> | undefined;
|
package/dist/router/core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
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 +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"),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 +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 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 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var e=Object.defineProperty,t=(t,r,o)=>((t,r,o)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o)(t,"symbol"!=typeof r?r+"":r,o);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("./core.cjs"),o=require("../runtime/component/base-element.cjs"),s=require("../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;const n=new WeakMap;exports.default=class extends o.default{constructor(){super(...arguments),t(this,"unsubscribe"),t(this,"level",0),t(this,"currentElement",null),t(this,"currentTagName",null),t(this,"managedNodes",new Set),t(this,"scheduled",!1),t(this,"latestLoadId",0),t(this,"abortController",null),t(this,"disposed",!1),t(this,"router",null)}async mounted(){this.disposed=!1,this.detectLevel(),this.router=await r.routerReady(),this.disposed||(this.unsubscribe=this.router.listen(()=>this.scheduleLoad()),this.loadRoute(this.router.getCurrentRoute()))}unmounted(){var e,t;this.disposed=!0,null==(e=this.abortController)||e.abort(),this.abortController=null,null==(t=this.unsubscribe)||t.call(this),this.clear()}scheduleLoad(){!this.router||this.scheduled||this.disposed||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1,!this.disposed&&this.router&&this.loadRoute(this.router.getCurrentRoute())}))}detectLevel(){let e=0,t=this.parentElement;for(;t;){const r=t.closest("router-view");if(r){if(e++,t=r.parentElement,!t){const e=r.getRootNode();t=e instanceof ShadowRoot?e.host:null}}else{const e=t.getRootNode();t=e instanceof ShadowRoot?e.host:null}}this.level=e}async loadRoute(e){var t,r;this.abortController&&(this.abortController.abort(),this.abortController=null);const o=++this.latestLoadId,s=null==e?void 0:e.matched[this.level];if(!s)return void this.handleEmptyRoute(e);const{config:n}=s;let i=n.tagName;if(!i&&"function"==typeof n.component){this.renderLoading();const s=new AbortController;this.abortController=s;try{const l=null==(r=null==(t=this.router)?void 0:t.getComponentFromCache)?void 0:r.call(t,null==e?void 0:e.fullPath),a=l?await l:await n.component();if(s.signal.aborted||o!==this.latestLoadId||this.disposed)return;i="string"==typeof a?a:a.tagName}catch(l){if(s.signal.aborted||o!==this.latestLoadId||this.disposed)return;return void this.renderError(`Load Error: ${l}`)}finally{this.abortController===s&&(this.abortController=null)}}if(o===this.latestLoadId&&!this.disposed)if(i)if(!n.forceReload&&this.currentElement&&this.currentTagName===i.toLowerCase())this.syncState(this.currentElement,(null==e?void 0:e.params)||{},(null==e?void 0:e.query)||{},n.props);else{this.clear();const t=this.getOrCreateComponent(i,n,e);this.syncState(t,(null==e?void 0:e.params)||{},(null==e?void 0:e.query)||{},n.props),this.appendManagedNode(t),this.currentElement=t,this.currentTagName=i.toLowerCase()}else this.clear()}syncState(e,t,r,o={}){const s=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=function(e){let t=n.get(e);return t||(t={routerAttrs:new Set,propKeys:new Set},n.set(e,t)),t}(e),l=new Map;Object.entries(t).forEach(([e,t])=>l.set(s(e),String(t))),Object.entries(r).forEach(([e,t])=>l.set(`query-${s(e)}`,String(t))),i.routerAttrs.forEach(t=>{l.has(t)||(e.removeAttribute(t),i.routerAttrs.delete(t))}),l.forEach((t,r)=>{e.getAttribute(r)!==t&&e.setAttribute(r,t),i.routerAttrs.add(r)});const a=new Set(Object.keys(o)),d=e;i.propKeys.forEach(e=>{a.has(e)||(d[e]=void 0)}),Object.entries(o).forEach(([e,t])=>{d[e]!==t&&(d[e]=t)}),i.propKeys=a}getOrCreateComponent(e,t,r){var o,s;if(!r)throw new Error("Route is required to create or retrieve component");const n=t.keepAliveKey?t.keepAliveKey(r,this.level):this.buildKeepAliveKey(e,r),i=t.keepAlive&&(null==(o=this.router)?void 0:o.getKeepAlive(n));if(i)return i;const l=document.createElement(e);return t.keepAlive&&(null==(s=this.router)||s.setKeepAlive(n,l)),l}buildKeepAliveKey(e,t){const r=t.matched[this.level],o=(null==r?void 0:r.config.path)??e.toLowerCase(),s=Object.values((null==r?void 0:r.params)??{});return s.length?`${this.level}:${o}:${s.join("|")}`:`${this.level}:${o}`}handleEmptyRoute(e){var t,r;if(0===this.level){this.clear();const o=null==(t=null==e?void 0:e.matched)?void 0:t[0],s=(null==(r=null==o?void 0:o.config)?void 0:r.notFoundComponent)||this.$data.notFound;if(s){const e=document.createElement(s);this.appendManagedNode(e),this.currentElement=e,this.currentTagName=s.toLowerCase()}else this.renderError("404 Not Found")}else this.clear()}appendManagedNode(e){e.parentNode!==this&&this.appendChild(e),this.managedNodes.add(e)}clear(){this.managedNodes.forEach(e=>{e.parentNode===this&&this.removeChild(e)}),this.managedNodes.clear(),this.currentElement=null,this.currentTagName=null}renderLoading(){this.clear();const e=document.createElement("div");e.style.cssText="padding:20px; color:#999;",e.textContent="Loading...",this.appendManagedNode(e)}renderError(e){this.clear();const t=document.createElement("div");t.style.cssText="padding:20px; color:#ff4d4f;",t.textContent=e,this.appendManagedNode(t)}},exports.default=((e,t)=>{for(var r,o=t,s=e.length-1;s>=0;s--)(r=e[s])&&(o=r(o)||o);return o})([s.CustomElement({tagName:"router-view",props:[{name:"notFound",type:"string",default:""}]})],exports.default);
|
|
@@ -7,22 +7,24 @@ declare class RouterView extends BaseElement<{
|
|
|
7
7
|
private level;
|
|
8
8
|
private currentElement;
|
|
9
9
|
private currentTagName;
|
|
10
|
-
private
|
|
11
|
-
private prevPropKeys;
|
|
10
|
+
private managedNodes;
|
|
12
11
|
private scheduled;
|
|
13
12
|
private latestLoadId;
|
|
14
13
|
private abortController;
|
|
14
|
+
private disposed;
|
|
15
15
|
private router;
|
|
16
16
|
mounted(): Promise<void>;
|
|
17
17
|
unmounted(): void;
|
|
18
18
|
private scheduleLoad;
|
|
19
19
|
private detectLevel;
|
|
20
20
|
loadRoute(route: RouteMatch | null): Promise<void>;
|
|
21
|
-
private getOrCreateComponent;
|
|
22
21
|
private syncState;
|
|
22
|
+
private getOrCreateComponent;
|
|
23
|
+
private buildKeepAliveKey;
|
|
23
24
|
private handleEmptyRoute;
|
|
25
|
+
private appendManagedNode;
|
|
26
|
+
private clear;
|
|
24
27
|
private renderLoading;
|
|
25
28
|
private renderError;
|
|
26
|
-
private clear;
|
|
27
29
|
}
|
|
28
30
|
export default RouterView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var e=Object.defineProperty,t=(t,o,r)=>((t,o,r)=>o in t?e(t,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[o]=r)(t,"symbol"!=typeof o?o+"":o,r);import{routerReady as o}from"./core.js";import r from"../runtime/component/base-element.js";import{CustomElement as s}from"../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;const n=new WeakMap;let i=class extends r{constructor(){super(...arguments),t(this,"unsubscribe"),t(this,"level",0),t(this,"currentElement",null),t(this,"currentTagName",null),t(this,"managedNodes",new Set),t(this,"scheduled",!1),t(this,"latestLoadId",0),t(this,"abortController",null),t(this,"disposed",!1),t(this,"router",null)}async mounted(){this.disposed=!1,this.detectLevel(),this.router=await o(),this.disposed||(this.unsubscribe=this.router.listen(()=>this.scheduleLoad()),this.loadRoute(this.router.getCurrentRoute()))}unmounted(){var e,t;this.disposed=!0,null==(e=this.abortController)||e.abort(),this.abortController=null,null==(t=this.unsubscribe)||t.call(this),this.clear()}scheduleLoad(){!this.router||this.scheduled||this.disposed||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1,!this.disposed&&this.router&&this.loadRoute(this.router.getCurrentRoute())}))}detectLevel(){let e=0,t=this.parentElement;for(;t;){const o=t.closest("router-view");if(o){if(e++,t=o.parentElement,!t){const e=o.getRootNode();t=e instanceof ShadowRoot?e.host:null}}else{const e=t.getRootNode();t=e instanceof ShadowRoot?e.host:null}}this.level=e}async loadRoute(e){var t,o;this.abortController&&(this.abortController.abort(),this.abortController=null);const r=++this.latestLoadId,s=null==e?void 0:e.matched[this.level];if(!s)return void this.handleEmptyRoute(e);const{config:n}=s;let i=n.tagName;if(!i&&"function"==typeof n.component){this.renderLoading();const s=new AbortController;this.abortController=s;try{const l=null==(o=null==(t=this.router)?void 0:t.getComponentFromCache)?void 0:o.call(t,null==e?void 0:e.fullPath),a=l?await l:await n.component();if(s.signal.aborted||r!==this.latestLoadId||this.disposed)return;i="string"==typeof a?a:a.tagName}catch(l){if(s.signal.aborted||r!==this.latestLoadId||this.disposed)return;return void this.renderError(`Load Error: ${l}`)}finally{this.abortController===s&&(this.abortController=null)}}if(r===this.latestLoadId&&!this.disposed)if(i)if(!n.forceReload&&this.currentElement&&this.currentTagName===i.toLowerCase())this.syncState(this.currentElement,(null==e?void 0:e.params)||{},(null==e?void 0:e.query)||{},n.props);else{this.clear();const t=this.getOrCreateComponent(i,n,e);this.syncState(t,(null==e?void 0:e.params)||{},(null==e?void 0:e.query)||{},n.props),this.appendManagedNode(t),this.currentElement=t,this.currentTagName=i.toLowerCase()}else this.clear()}syncState(e,t,o,r={}){const s=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=function(e){let t=n.get(e);return t||(t={routerAttrs:new Set,propKeys:new Set},n.set(e,t)),t}(e),l=new Map;Object.entries(t).forEach(([e,t])=>l.set(s(e),String(t))),Object.entries(o).forEach(([e,t])=>l.set(`query-${s(e)}`,String(t))),i.routerAttrs.forEach(t=>{l.has(t)||(e.removeAttribute(t),i.routerAttrs.delete(t))}),l.forEach((t,o)=>{e.getAttribute(o)!==t&&e.setAttribute(o,t),i.routerAttrs.add(o)});const a=new Set(Object.keys(r)),d=e;i.propKeys.forEach(e=>{a.has(e)||(d[e]=void 0)}),Object.entries(r).forEach(([e,t])=>{d[e]!==t&&(d[e]=t)}),i.propKeys=a}getOrCreateComponent(e,t,o){var r,s;if(!o)throw new Error("Route is required to create or retrieve component");const n=t.keepAliveKey?t.keepAliveKey(o,this.level):this.buildKeepAliveKey(e,o),i=t.keepAlive&&(null==(r=this.router)?void 0:r.getKeepAlive(n));if(i)return i;const l=document.createElement(e);return t.keepAlive&&(null==(s=this.router)||s.setKeepAlive(n,l)),l}buildKeepAliveKey(e,t){const o=t.matched[this.level],r=(null==o?void 0:o.config.path)??e.toLowerCase(),s=Object.values((null==o?void 0:o.params)??{});return s.length?`${this.level}:${r}:${s.join("|")}`:`${this.level}:${r}`}handleEmptyRoute(e){var t,o;if(0===this.level){this.clear();const r=null==(t=null==e?void 0:e.matched)?void 0:t[0],s=(null==(o=null==r?void 0:r.config)?void 0:o.notFoundComponent)||this.$data.notFound;if(s){const e=document.createElement(s);this.appendManagedNode(e),this.currentElement=e,this.currentTagName=s.toLowerCase()}else this.renderError("404 Not Found")}else this.clear()}appendManagedNode(e){e.parentNode!==this&&this.appendChild(e),this.managedNodes.add(e)}clear(){this.managedNodes.forEach(e=>{e.parentNode===this&&this.removeChild(e)}),this.managedNodes.clear(),this.currentElement=null,this.currentTagName=null}renderLoading(){this.clear();const e=document.createElement("div");e.style.cssText="padding:20px; color:#999;",e.textContent="Loading...",this.appendManagedNode(e)}renderError(e){this.clear();const t=document.createElement("div");t.style.cssText="padding:20px; color:#ff4d4f;",t.textContent=e,this.appendManagedNode(t)}};i=((e,t)=>{for(var o,r=t,s=e.length-1;s>=0;s--)(o=e[s])&&(r=o(r)||r);return r})([s({tagName:"router-view",props:[{name:"notFound",type:"string",default:""}]})],i);export{i as default};
|
package/dist/router/types.d.ts
CHANGED
|
@@ -17,6 +17,11 @@ export interface RouteConfig {
|
|
|
17
17
|
* 开启后,切换路由时组件不会被销毁,而是保存在 RouterView 的缓存池中。
|
|
18
18
|
*/
|
|
19
19
|
keepAlive?: boolean;
|
|
20
|
+
/** * 自定义 keepAlive 缓存 key。
|
|
21
|
+
* 默认使用 route.fullPath,动态路由如 /article/:id 会按不同 id 分别缓存。
|
|
22
|
+
* 如果希望同一路由模板共享缓存,可设为 (route) => route.matched[level].config.path
|
|
23
|
+
*/
|
|
24
|
+
keepAliveKey?: (route: RouteMatch, level: number) => string;
|
|
20
25
|
/** * 是否强制重新加载。
|
|
21
26
|
* 即使 tagName 相同,如果为 true,也会销毁重建组件而不是复用。
|
|
22
27
|
*/
|
|
@@ -60,6 +65,8 @@ export interface RouterOptions {
|
|
|
60
65
|
mode?: 'hash' | 'history';
|
|
61
66
|
beforeEach?: NavigationGuard;
|
|
62
67
|
afterEach?: (to: RouteMatch, from: RouteMatch | null) => void;
|
|
68
|
+
/** keepAlive 最大缓存数量,超出后淘汰最久未访问的实例。默认不限制 */
|
|
69
|
+
maxKeepAlive?: number;
|
|
63
70
|
}
|
|
64
71
|
export interface NavigationResult {
|
|
65
72
|
success: boolean;
|
package/dist/shared/env.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=(()=>{var o,e;if("undefined"!=typeof window){if(null==(o=window.location)?void 0:o.search.includes("debug"))return!0;const e=globalThis;if(!0===e.__DEBUG__||!0===e.__IS_DEV__)return!0}return!("undefined"==typeof window||!["localhost","127.0.0.1","0.0.0.0"].includes((null==(e=window.location)?void 0:e.hostname)||""))})(),e=!o;exports.IS_DEV=o,exports.IS_PROD=e,exports.SOLELY_VERSION="0.5.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=(()=>{var o,e;if("undefined"!=typeof window){if(null==(o=window.location)?void 0:o.search.includes("debug"))return!0;const e=globalThis;if(!0===e.__DEBUG__||!0===e.__IS_DEV__)return!0}return!("undefined"==typeof window||!["localhost","127.0.0.1","0.0.0.0"].includes((null==(e=window.location)?void 0:e.hostname)||""))})(),e=!o;exports.IS_DEV=o,exports.IS_PROD=e,exports.SOLELY_VERSION="0.5.3";
|
package/dist/shared/env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const n=(()=>{var n,o;if("undefined"!=typeof window){if(null==(n=window.location)?void 0:n.search.includes("debug"))return!0;const o=globalThis;if(!0===o.__DEBUG__||!0===o.__IS_DEV__)return!0}return!("undefined"==typeof window||!["localhost","127.0.0.1","0.0.0.0"].includes((null==(o=window.location)?void 0:o.hostname)||""))})(),o=!n,i="0.5.
|
|
1
|
+
const n=(()=>{var n,o;if("undefined"!=typeof window){if(null==(n=window.location)?void 0:n.search.includes("debug"))return!0;const o=globalThis;if(!0===o.__DEBUG__||!0===o.__IS_DEV__)return!0}return!("undefined"==typeof window||!["localhost","127.0.0.1","0.0.0.0"].includes((null==(o=window.location)?void 0:o.hostname)||""))})(),o=!n,i="0.5.3";export{n as IS_DEV,o as IS_PROD,i as SOLELY_VERSION};
|
package/package.json
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solely",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.3",
|
|
5
5
|
"description": "A lightweight TypeScript framework for building web components with compile-time optimizations",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"sideEffects":
|
|
7
|
+
"sideEffects": [
|
|
8
|
+
"*.css",
|
|
9
|
+
"**/*.css?inline",
|
|
10
|
+
"**/*.css?raw",
|
|
11
|
+
"src/components/elements/*/index.ts",
|
|
12
|
+
"dist/components/elements/*/index.js",
|
|
13
|
+
"dist/components/elements/*/index.cjs",
|
|
14
|
+
"src/components/commands/*/index.ts",
|
|
15
|
+
"dist/components/commands/*/index.js",
|
|
16
|
+
"dist/components/commands/*/index.cjs"
|
|
17
|
+
],
|
|
8
18
|
"main": "./dist/index.cjs",
|
|
9
19
|
"module": "./dist/index.js",
|
|
10
20
|
"types": "./dist/index.d.ts",
|
|
@@ -99,6 +109,16 @@
|
|
|
99
109
|
"default": "./dist/components/elements/index.cjs"
|
|
100
110
|
}
|
|
101
111
|
},
|
|
112
|
+
"./components/elements/*": {
|
|
113
|
+
"import": {
|
|
114
|
+
"types": "./dist/components/elements/*/index.d.ts",
|
|
115
|
+
"default": "./dist/components/elements/*/index.js"
|
|
116
|
+
},
|
|
117
|
+
"require": {
|
|
118
|
+
"types": "./dist/components/elements/*/index.d.ts",
|
|
119
|
+
"default": "./dist/components/elements/*/index.cjs"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
102
122
|
"./components/commands": {
|
|
103
123
|
"import": {
|
|
104
124
|
"types": "./dist/components/commands/index.d.ts",
|
|
@@ -109,6 +129,16 @@
|
|
|
109
129
|
"default": "./dist/components/commands/index.cjs"
|
|
110
130
|
}
|
|
111
131
|
},
|
|
132
|
+
"./components/commands/*": {
|
|
133
|
+
"import": {
|
|
134
|
+
"types": "./dist/components/commands/*/index.d.ts",
|
|
135
|
+
"default": "./dist/components/commands/*/index.js"
|
|
136
|
+
},
|
|
137
|
+
"require": {
|
|
138
|
+
"types": "./dist/components/commands/*/index.d.ts",
|
|
139
|
+
"default": "./dist/components/commands/*/index.cjs"
|
|
140
|
+
}
|
|
141
|
+
},
|
|
112
142
|
"./components/theme": {
|
|
113
143
|
"import": {
|
|
114
144
|
"types": "./dist/components/theme/index.d.ts",
|