little-dizzy 2.1.0 → 2.3.0

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.
@@ -1,4 +1,87 @@
1
- (function(l,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(l=typeof globalThis<"u"?globalThis:l||self,e(l.LittleDizzy={},l.Vue))})(this,(function(l,e){"use strict";const r=(t,n)=>{const o=t.__vccOpts||t;for(const[a,s]of n)o[a]=s;return o},h=["disabled"],d=r({__name:"Button",props:{type:{type:String,default:"primary",validator:t=>["primary","success","warning","danger","info","secondary"].includes(t)},size:{type:String,default:"medium",validator:t=>["small","medium","large"].includes(t)},block:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:n}){return(o,a)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["btn",[`btn-${t.type}`,`btn-${t.size}`,{"btn-block":t.block},{"btn-disabled":t.disabled}]]),disabled:t.disabled,onClick:a[0]||(a[0]=s=>o.$emit("click",s))},[e.renderSlot(o.$slots,"default",{},void 0,!0)],10,h))}},[["__scopeId","data-v-75f082b2"]]),_={key:0,class:"card-header"},k={key:0,class:"card-header-title"},S={class:"card-body"},g={key:1,class:"card-footer"},m=r({__name:"Card",props:{title:{type:String,default:""},shadow:{type:Boolean,default:!0}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["card",{"card-shadow":t.shadow}])},[n.$slots.header||t.title?(e.openBlock(),e.createElementBlock("div",_,[t.title?(e.openBlock(),e.createElementBlock("h3",k,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"header",{},void 0,!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",S,[e.renderSlot(n.$slots,"default",{},void 0,!0)]),n.$slots.footer?(e.openBlock(),e.createElementBlock("div",g,[e.renderSlot(n.$slots,"footer",{},void 0,!0)])):e.createCommentVNode("",!0)],2))}},[["__scopeId","data-v-2d83e63a"]]),$={class:"modal-dialog"},C={class:"modal-content"},z={class:"modal-header"},E={key:0,class:"modal-header-title"},V={class:"modal-body"},N={key:0,class:"modal-footer"},w={key:1,class:"modal-footer"},p=r({__name:"Modal",props:{visible:{type:Boolean,default:!1},title:{type:String,default:""},showFooter:{type:Boolean,default:!0}},emits:["close","cancel","confirm"],setup(t,{emit:n}){const o=n,a=()=>{o("close")},s=()=>{o("cancel")},q=()=>{o("confirm")};return(c,W)=>t.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["modal",{"modal-show":t.visible}])},[e.createElementVNode("div",$,[e.createElementVNode("div",C,[e.createElementVNode("div",z,[t.title?(e.openBlock(),e.createElementBlock("h3",E,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"modal-header-close",onClick:a},"×")]),e.createElementVNode("div",V,[e.renderSlot(c.$slots,"default",{},void 0,!0)]),c.$slots.footer?(e.openBlock(),e.createElementBlock("div",N,[e.renderSlot(c.$slots,"footer",{},void 0,!0)])):t.showFooter?(e.openBlock(),e.createElementBlock("div",w,[e.createElementVNode("button",{class:"btn btn-secondary",onClick:s},"取消"),e.createElementVNode("button",{class:"btn btn-primary",onClick:q},"确定")])):e.createCommentVNode("",!0)])])],2)):e.createCommentVNode("",!0)}},[["__scopeId","data-v-c66cec30"]]),M={class:"lzbutton-wrapper"},u=r(Object.assign({name:"Lzbutton"},{__name:"lzbutton",setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",M,[...o[0]||(o[0]=[e.createElementVNode("button",{class:"button"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 36 24"},[e.createElementVNode("path",{d:"m18 0 8 12 10-8-4 20H4L0 4l10 8 8-12z"})]),e.createTextVNode(" Unlock Pro ")],-1)])]))}}),[["__scopeId","data-v-c2498af3"]]),f={Lzbutton:u},L=[{name:"Button",type:"vue",label:"Button 按钮",code:`<template>
1
+ (function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o.LittleDizzy={},o.Vue))})(this,(function(o,e){"use strict";const m=(t,s)=>{const n=t.__vccOpts||t;for(const[r,i]of s)n[r]=i;return n},M=["disabled"],_=m({__name:"Button",props:{type:{type:String,default:"primary",validator:t=>["primary","success","warning","danger","info","secondary"].includes(t)},size:{type:String,default:"medium",validator:t=>["small","medium","large"].includes(t)},block:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:s}){return(n,r)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["btn",[`btn-${t.type}`,`btn-${t.size}`,{"btn-block":t.block},{"btn-disabled":t.disabled}]]),disabled:t.disabled,onClick:r[0]||(r[0]=i=>n.$emit("click",i))},[e.renderSlot(n.$slots,"default",{},void 0,!0)],10,M))}},[["__scopeId","data-v-75f082b2"]]),V={key:0,class:"card-header"},N={key:0,class:"card-header-title"},v={class:"card-body"},L={key:1,class:"card-footer"},b=m({__name:"Card",props:{title:{type:String,default:""},shadow:{type:Boolean,default:!0}},setup(t){return(s,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["card",{"card-shadow":t.shadow}])},[s.$slots.header||t.title?(e.openBlock(),e.createElementBlock("div",V,[t.title?(e.openBlock(),e.createElementBlock("h3",N,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"header",{},void 0,!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",v,[e.renderSlot(s.$slots,"default",{},void 0,!0)]),s.$slots.footer?(e.openBlock(),e.createElementBlock("div",L,[e.renderSlot(s.$slots,"footer",{},void 0,!0)])):e.createCommentVNode("",!0)],2))}},[["__scopeId","data-v-2d83e63a"]]),I={class:"modal-dialog"},T={class:"modal-header"},j={key:0,class:"modal-header-title"},O={class:"modal-body"},A={key:0,class:"modal-footer"},D={key:1,class:"modal-footer"},k=m({__name:"Modal",props:{visible:{type:Boolean,default:!1},title:{type:String,default:""},width:{type:String,default:"500px"},showFooter:{type:Boolean,default:!0}},emits:["close","cancel","confirm"],setup(t,{emit:s}){const n=s,r=()=>{n("close")},i=()=>{n("cancel")},p=()=>{n("confirm")};return(c,f)=>t.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["modal",{"modal-show":t.visible}])},[e.createElementVNode("div",I,[e.createElementVNode("div",{class:"modal-content",style:e.normalizeStyle({width:t.width})},[e.createElementVNode("div",T,[t.title?(e.openBlock(),e.createElementBlock("h3",j,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"modal-header-close",onClick:r},"×")]),e.createElementVNode("div",O,[e.renderSlot(c.$slots,"default",{},void 0,!0)]),c.$slots.footer?(e.openBlock(),e.createElementBlock("div",A,[e.renderSlot(c.$slots,"footer",{},void 0,!0)])):t.showFooter?(e.openBlock(),e.createElementBlock("div",D,[e.createElementVNode("button",{class:"btn btn-secondary",onClick:i},"取消"),e.createElementVNode("button",{class:"btn btn-primary",onClick:p},"确定")])):e.createCommentVNode("",!0)],4)])],2)):e.createCommentVNode("",!0)}},[["__scopeId","data-v-39af2dcd"]]),H=["innerHTML"],F={class:"text-sm font-medium"},Y=["onClick"],w=m(Object.assign({name:"Message"},{__name:"Message",setup(t,{expose:s}){const n=e.ref([]),r={success:"bg-emerald-500/95 text-white",warning:"bg-amber-500/95 text-white",error:"bg-rose-500/95 text-white",info:"bg-sky-500/95 text-white"},i={success:`<svg class="w-5 h-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
2
+ <path d="M20 6L9 17l-5-5" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>`,warning:`<svg class="w-5 h-5" viewBox="0 0 24 24" fill="currentColor">
4
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/>
5
+ </svg>`,error:`<svg class="w-5 h-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
6
+ <circle cx="12" cy="12" r="10"/>
7
+ <path d="M15 9l-6 6M9 9l6 6" stroke-linecap="round"/>
8
+ </svg>`,info:`<svg class="w-5 h-5" viewBox="0 0 24 24" fill="currentColor">
9
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/>
10
+ </svg>`};let p=0;const c=l=>{const a=++p,d={id:a,type:l.type||"info",content:l.content||"",duration:l.duration??3e3,closable:l.closable??!1};return n.value.push(d),d.duration>0&&setTimeout(()=>{f(a)},d.duration),a},f=l=>{const a=n.value.findIndex(d=>d.id===l);a>-1&&n.value.splice(a,1)};return s({addMessage:c,removeMessage:f,clearAll:()=>{n.value=[]},success:(l,a={})=>c({...a,type:"success",content:l}),warning:(l,a={})=>c({...a,type:"warning",content:l}),error:(l,a={})=>c({...a,type:"error",content:l}),info:(l,a={})=>c({...a,type:"info",content:l})}),(l,a)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.TransitionGroup,{name:"message",tag:"div",class:"fixed top-4 left-1/2 -translate-x-1/2 z-[9999] flex flex-col items-center gap-3 pointer-events-none"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,d=>(e.openBlock(),e.createElementBlock("div",{key:d.id,class:e.normalizeClass(["pointer-events-auto flex items-center gap-3 px-5 py-3 rounded-lg shadow-lg backdrop-blur-sm transition-all duration-300",r[d.type]])},[e.createElementVNode("span",{class:"flex-shrink-0",innerHTML:i[d.type]},null,8,H),e.createElementVNode("span",F,e.toDisplayString(d.content),1),d.closable?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:ye=>f(d.id),class:"flex-shrink-0 ml-2 p-1 rounded-full hover:bg-black/10 transition-colors"},[...a[0]||(a[0]=[e.createElementVNode("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"})],-1)])],8,Y)):e.createCommentVNode("",!0)],2))),128))]),_:1})]))}}),[["__scopeId","data-v-d727fd6c"]]);e.ref([]);let q=0;const G=t=>{const s=++q,n=t.type||"info",r=t.content||"",i=t.duration??3e3,p=t.closable??!1,c=document.createElement("div");c.className=`ld-message ld-message--${n}`,c.setAttribute("data-id",s);let y=`${{success:`<svg class="ld-message-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
11
+ <path d="M20 6L9 17l-5-5" stroke-linecap="round" stroke-linejoin="round"/>
12
+ </svg>`,warning:`<svg class="ld-message-icon" viewBox="0 0 24 24" fill="currentColor">
13
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/>
14
+ </svg>`,error:`<svg class="ld-message-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
15
+ <circle cx="12" cy="12" r="10"/>
16
+ <path d="M15 9l-6 6M9 9l6 6" stroke-linecap="round"/>
17
+ </svg>`,info:`<svg class="ld-message-icon" viewBox="0 0 24 24" fill="currentColor">
18
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/>
19
+ </svg>`}[n]}<span class="ld-message-content">${r}</span>`;return p&&(y+=`<button class="ld-message-close" onclick="window.__ldMessageClose(${s})">
20
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
21
+ <path d="M18 6L6 18M6 6l12 12"/>
22
+ </svg>
23
+ </button>`),c.innerHTML=y,{id:s,element:c,duration:i}},P=()=>{let t=document.getElementById("ld-message-root");if(!t){t=document.createElement("div"),t.id="ld-message-root",document.body.appendChild(t);const s=document.createElement("style");s.textContent=`
24
+ #ld-message-root {
25
+ position: fixed;
26
+ top: 16px;
27
+ left: 50%;
28
+ transform: translateX(-50%);
29
+ z-index: 9999;
30
+ display: flex;
31
+ flex-direction: column;
32
+ align-items: center;
33
+ gap: 12px;
34
+ pointer-events: none;
35
+ }
36
+ .ld-message {
37
+ pointer-events: auto;
38
+ display: flex;
39
+ align-items: center;
40
+ gap: 12px;
41
+ padding: 12px 20px;
42
+ border-radius: 8px;
43
+ box-shadow: 0 4px 12px rgba(0,0,0,0.15);
44
+ backdrop-filter: blur(8px);
45
+ animation: ldMessageIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
46
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
47
+ font-size: 14px;
48
+ font-weight: 500;
49
+ }
50
+ .ld-message.ld-message--closing {
51
+ animation: ldMessageOut 0.2s ease-in forwards;
52
+ }
53
+ .ld-message--success { background: rgba(16, 185, 129, 0.95); color: white; }
54
+ .ld-message--warning { background: rgba(245, 158, 11, 0.95); color: white; }
55
+ .ld-message--error { background: rgba(239, 68, 68, 0.95); color: white; }
56
+ .ld-message--info { background: rgba(14, 165, 233, 0.95); color: white; }
57
+ .ld-message-icon { width: 20px; height: 20px; flex-shrink: 0; }
58
+ .ld-message-content { white-space: nowrap; }
59
+ .ld-message-close {
60
+ display: flex;
61
+ align-items: center;
62
+ justify-content: center;
63
+ width: 20px;
64
+ height: 20px;
65
+ margin-left: 4px;
66
+ padding: 0;
67
+ border: none;
68
+ background: transparent;
69
+ color: currentColor;
70
+ cursor: pointer;
71
+ border-radius: 50%;
72
+ transition: background 0.2s;
73
+ }
74
+ .ld-message-close:hover { background: rgba(255,255,255,0.2); }
75
+ .ld-message-close svg { width: 14px; height: 14px; }
76
+ @keyframes ldMessageIn {
77
+ from { opacity: 0; transform: translateY(-20px) scale(0.9); }
78
+ to { opacity: 1; transform: translateY(0) scale(1); }
79
+ }
80
+ @keyframes ldMessageOut {
81
+ from { opacity: 1; transform: translateY(0) scale(1); }
82
+ to { opacity: 0; transform: translateY(-10px) scale(0.95); }
83
+ }
84
+ `,document.head.appendChild(s)}return t},u=t=>{const s=document.getElementById("ld-message-root");if(!s)return;const n=s.querySelector(`[data-id="${t}"]`);n&&(n.classList.add("ld-message--closing"),setTimeout(()=>{n.remove()},200))};typeof window<"u"&&(window.__ldMessageClose=u);const g=t=>{const s=P(),{id:n,element:r,duration:i}=G(t);return s.appendChild(r),i>0&&setTimeout(()=>{u(n)},i),n},R={success:(t,s={})=>g({...s,type:"success",content:t}),warning:(t,s={})=>g({...s,type:"warning",content:t}),error:(t,s={})=>g({...s,type:"error",content:t}),info:(t,s={})=>g({...s,type:"info",content:t}),close:u,closeAll:()=>{const t=document.getElementById("ld-message-root");t&&(t.innerHTML="")}},U={class:"lzbutton-wrapper"},W={class:"button"},B=m(Object.assign({name:"Lzbutton"},{__name:"lzbutton",setup(t){return(s,n)=>(e.openBlock(),e.createElementBlock("div",U,[e.createElementVNode("button",W,[n[1]||(n[1]=e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 36 24"},[e.createElementVNode("path",{d:"m18 0 8 12 10-8-4 20H4L0 4l10 8 8-12z"})],-1)),e.renderSlot(s.$slots,"default",{},()=>[n[0]||(n[0]=e.createTextVNode("Unlock Pro",-1))],!0)])]))}}),[["__scopeId","data-v-7124b716"]]),X={class:"Lztext-wrapper"},x=m(Object.assign({name:"Lztext"},{__name:"Lztext",setup(t){return(s,n)=>(e.openBlock(),e.createElementBlock("div",X,[...n[0]||(n[0]=[e.createStaticVNode('<div class="loader-wrapper" data-v-f22456dd><span class="loader-letter" data-v-f22456dd>G</span><span class="loader-letter" data-v-f22456dd>e</span><span class="loader-letter" data-v-f22456dd>n</span><span class="loader-letter" data-v-f22456dd>e</span><span class="loader-letter" data-v-f22456dd>r</span><span class="loader-letter" data-v-f22456dd>a</span><span class="loader-letter" data-v-f22456dd>t</span><span class="loader-letter" data-v-f22456dd>i</span><span class="loader-letter" data-v-f22456dd>n</span><span class="loader-letter" data-v-f22456dd>g</span><div class="loader" data-v-f22456dd></div></div>',1)])]))}}),[["__scopeId","data-v-f22456dd"]]),J={class:"lztheme-wrapper"},E=m(Object.assign({name:"Lztheme"},{__name:"lztheme",setup(t){return(s,n)=>(e.openBlock(),e.createElementBlock("div",J,[...n[0]||(n[0]=[e.createElementVNode("label",{for:"theme",class:"theme"},[e.createElementVNode("span",{class:"theme__toggle-wrap"},[e.createElementVNode("input",{id:"theme",class:"theme__toggle",type:"checkbox",role:"switch",name:"theme",value:"dark"}),e.createElementVNode("span",{class:"theme__fill"}),e.createElementVNode("span",{class:"theme__icon"},[e.createElementVNode("span",{class:"theme__icon-part"}),e.createElementVNode("span",{class:"theme__icon-part"}),e.createElementVNode("span",{class:"theme__icon-part"}),e.createElementVNode("span",{class:"theme__icon-part"}),e.createElementVNode("span",{class:"theme__icon-part"}),e.createElementVNode("span",{class:"theme__icon-part"}),e.createElementVNode("span",{class:"theme__icon-part"}),e.createElementVNode("span",{class:"theme__icon-part"}),e.createElementVNode("span",{class:"theme__icon-part"})])])],-1)])]))}}),[["__scopeId","data-v-0b85d094"]]),z={Lzbutton:B,Lztext:x,Lztheme:E},K=[{name:"Button",type:"vue",label:"Button 按钮",code:`<template>
2
85
  <Button type="primary">主要按钮</Button>
3
86
  <Button type="success">成功按钮</Button>
4
87
  <Button type="warning">警告按钮</Button>
@@ -42,4 +125,39 @@ import { ref } from 'vue'
42
125
  import { Modal, Button } from 'little-dizzy'
43
126
 
44
127
  const visible = ref(false)
45
- <\/script>`}],i=new Map;function y(t){return!t||!t.name?(console.warn("[LittleDizzy] Snippet must have a name property"),!1):(i.set(t.name,{name:t.name,type:t.type||"html",label:t.label||t.name,code:t.code||"",isCustom:t.isCustom||!1,...t}),!0)}function b(t){if(!Array.isArray(t))return console.warn("[LittleDizzy] registerSnippets expects an array"),0;let n=0;return t.forEach(o=>{y(o)&&n++}),n}function D(){const t={};return i.forEach((n,o)=>{t[o]=n}),t}function j(t){return i.get(t)}b(L);const B={Button:d,Card:m,Modal:p,...f},I=(t,n={})=>{Object.entries(B).forEach(([o,a])=>{t.component(n.prefix?`${n.prefix}${o}`:o,a)})},O=D,T=y,A=b,F=j,P={install:I,...B};l.Button=d,l.Card=m,l.Lzbutton=u,l.Modal=p,l.customComponents=f,l.default=P,l.getSnippet=F,l.registerSnippet=T,l.registerSnippets=A,l.snippets=O,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
128
+ <\/script>`},{name:"Message",type:"vue",label:"Message 消息提示",code:`<template>
129
+ <div class="message-demo">
130
+ <Button type="success" @click="showSuccess">成功提示</Button>
131
+ <Button type="warning" @click="showWarning">警告提示</Button>
132
+ <Button type="danger" @click="showError">错误提示</Button>
133
+ <Button type="info" @click="showInfo">信息提示</Button>
134
+ </div>
135
+ </template>
136
+
137
+ <script setup>
138
+ import { Button, message } from 'little-dizzy'
139
+
140
+ const showSuccess = () => {
141
+ message.success('操作成功!')
142
+ }
143
+
144
+ const showWarning = () => {
145
+ message.warning('请注意!')
146
+ }
147
+
148
+ const showError = () => {
149
+ message.error('操作失败!')
150
+ }
151
+
152
+ const showInfo = () => {
153
+ message.info('这是一条提示信息', { duration: 5000, closable: true })
154
+ }
155
+ <\/script>
156
+
157
+ <style scoped>
158
+ .message-demo {
159
+ display: flex;
160
+ gap: 12px;
161
+ flex-wrap: wrap;
162
+ }
163
+ </style>`}],h=new Map;function C(t){return!t||!t.name?(console.warn("[LittleDizzy] Snippet must have a name property"),!1):(h.set(t.name,{name:t.name,type:t.type||"html",label:t.label||t.name,code:t.code||"",isCustom:t.isCustom||!1,...t}),!0)}function S(t){if(!Array.isArray(t))return console.warn("[LittleDizzy] registerSnippets expects an array"),0;let s=0;return t.forEach(n=>{C(n)&&s++}),s}function Q(){const t={};return h.forEach((s,n)=>{t[n]=s}),t}function Z(t){return h.get(t)}S(K);const $={Button:_,Card:b,Modal:k,Message:w,...z},ee=(t,s={})=>{Object.entries($).forEach(([n,r])=>{t.component(s.prefix?`${s.prefix}${n}`:n,r)})},te=Q,se=C,ne=S,oe=Z,ae={install:ee,...$};o.Button=_,o.Card=b,o.Lzbutton=B,o.Lztext=x,o.Lztheme=E,o.Message=w,o.Modal=k,o.customComponents=z,o.default=ae,o.getSnippet=oe,o.message=R,o.registerSnippet=se,o.registerSnippets=ne,o.snippets=te,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
package/dist/vite.svg CHANGED
@@ -1 +1,25 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
1
+ <svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
2
+ <defs>
3
+ <!-- 紫色系线性渐变 -->
4
+ <linearGradient id="ldGradient" x1="0%" y1="0%" x2="100%" y2="100%">
5
+ <stop offset="0%" stop-color="#d8b5ff">
6
+ <animate attributeName="stop-color" values="#d8b5ff;#a770ef;#7b2cbf;#a770ef;#d8b5ff" dur="6s" repeatCount="indefinite" />
7
+ </stop>
8
+ <stop offset="100%" stop-color="#7b2cbf">
9
+ <animate attributeName="stop-color" values="#7b2cbf;#5a189a;#7b2cbf;#a770ef;#7b2cbf" dur="6s" repeatCount="indefinite" />
10
+ </stop>
11
+ </linearGradient>
12
+ </defs>
13
+
14
+ <!-- LD 字母组合(精美设计) -->
15
+ <g transform="translate(16, 16)">
16
+ <!-- L 字母 - 精致优雅 -->
17
+ <!-- 垂直笔画 -->
18
+ <rect x="-7" y="-5.5" width="2.2" height="10.5" rx="0.5" fill="url(#ldGradient)" />
19
+ <!-- 水平笔画 -->
20
+ <rect x="-7" y="2.8" width="7" height="2.2" rx="0.5" fill="url(#ldGradient)" />
21
+
22
+ <!-- D 字母 - 流畅优雅的曲线 -->
23
+ <path d="M 0.5 -5.5 L 0.5 5 L 2.8 5 C 5.6 5 6.2 3.2 6.2 1.8 C 6.2 0.4 6.2 -0.4 6.2 -1.8 C 6.2 -3.2 5.6 -5 2.8 -5 Z M 2.8 -3.6 L 2.8 3.6 C 4.4 3.6 4.8 2 4.8 0 C 4.8 -2 4.4 -3.6 2.8 -3.6 Z" fill-rule="evenodd" fill="url(#ldGradient)" />
24
+ </g>
25
+ </svg>
package/package.json CHANGED
@@ -1,59 +1,63 @@
1
- {
2
- "name": "little-dizzy",
3
- "version": "2.1.0",
4
- "description": "LittleDizzy - 一个支持代码片段的 Vue 3 UI 组件库",
5
- "type": "module",
6
- "main": "dist/little-dizzy.umd.cjs",
7
- "module": "dist/little-dizzy.js",
8
- "exports": {
9
- ".": {
10
- "import": "./dist/little-dizzy.js",
11
- "require": "./dist/little-dizzy.umd.cjs"
12
- },
13
- "./dist/*": "./dist/*",
14
- "./src/*": "./src/*"
15
- },
16
- "files": [
17
- "dist",
18
- "src/components",
19
- "src/snippets",
20
- "src/styles",
21
- "src/index.js"
22
- ],
23
- "scripts": {
24
- "dev": "vite",
25
- "build": "vite build",
26
- "build:lib": "vite build --config vite.lib.config.js",
27
- "preview": "vite preview",
28
- "prepublishOnly": "npm run build:lib",
29
- "publish:patch": "npm version patch --no-git-tag-version && npm run build:lib && npm publish --registry https://registry.npmjs.org",
30
- "publish:minor": "npm version minor --no-git-tag-version && npm run build:lib && npm publish --registry https://registry.npmjs.org",
31
- "publish:major": "npm version major --no-git-tag-version && npm run build:lib && npm publish --registry https://registry.npmjs.org"
32
- },
33
- "keywords": [
34
- "vue",
35
- "vue3",
36
- "ui",
37
- "components",
38
- "snippets",
39
- "little-dizzy",
40
- "LittleDizzy"
41
- ],
42
- "author": "fsk",
43
- "license": "MIT",
44
- "repository": {
45
- "type": "git",
46
- "url": "https://gitee.com/nizuinande/little-dizzy"
47
- },
48
- "peerDependencies": {
49
- "vue": "^3.0.0"
50
- },
51
- "dependencies": {
52
- "vue": "^3.5.24"
53
- },
54
- "devDependencies": {
55
- "@vitejs/plugin-vue": "^6.0.1",
56
- "sass": "^1.97.1",
57
- "vite": "^7.2.4"
58
- }
59
- }
1
+ {
2
+ "name": "little-dizzy",
3
+ "version": "2.3.0",
4
+ "description": "LittleDizzy - 一个支持代码片段的 Vue 3 UI 组件库",
5
+ "type": "module",
6
+ "main": "dist/little-dizzy.umd.cjs",
7
+ "module": "dist/little-dizzy.js",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/little-dizzy.js",
11
+ "require": "./dist/little-dizzy.umd.cjs"
12
+ },
13
+ "./dist/*": "./dist/*",
14
+ "./src/*": "./src/*"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "src/components",
19
+ "src/snippets",
20
+ "src/styles",
21
+ "src/index.js"
22
+ ],
23
+ "scripts": {
24
+ "dev": "vite",
25
+ "build": "vite build",
26
+ "build:lib": "vite build --config vite.lib.config.js",
27
+ "preview": "vite preview",
28
+ "prepublishOnly": "npm run build:lib",
29
+ "publish:patch": "npm version patch --no-git-tag-version && npm run build:lib && npm publish --registry https://registry.npmjs.org",
30
+ "publish:minor": "npm version minor --no-git-tag-version && npm run build:lib && npm publish --registry https://registry.npmjs.org",
31
+ "publish:major": "npm version major --no-git-tag-version && npm run build:lib && npm publish --registry https://registry.npmjs.org"
32
+ },
33
+ "keywords": [
34
+ "vue",
35
+ "vue3",
36
+ "ui",
37
+ "components",
38
+ "snippets",
39
+ "little-dizzy",
40
+ "LittleDizzy"
41
+ ],
42
+ "author": "fsk",
43
+ "license": "MIT",
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "https://gitee.com/nizuinande/little-dizzy"
47
+ },
48
+ "peerDependencies": {
49
+ "vue": "^3.0.0"
50
+ },
51
+ "dependencies": {
52
+ "little-dizzy": "^2.1.1",
53
+ "vue": "^3.0.0",
54
+ "vue-router": "^4.6.4"
55
+ },
56
+ "devDependencies": {
57
+ "@tailwindcss/vite": "^4.1.18",
58
+ "@vitejs/plugin-vue": "^6.0.1",
59
+ "sass": "^1.97.1",
60
+ "tailwindcss": "^4.1.18",
61
+ "vite": "^7.2.4"
62
+ }
63
+ }
@@ -0,0 +1,156 @@
1
+ <template>
2
+ <Teleport to="body">
3
+ <TransitionGroup
4
+ name="message"
5
+ tag="div"
6
+ class="fixed top-4 left-1/2 -translate-x-1/2 z-[9999] flex flex-col items-center gap-3 pointer-events-none"
7
+ >
8
+ <div
9
+ v-for="msg in messages"
10
+ :key="msg.id"
11
+ class="pointer-events-auto flex items-center gap-3 px-5 py-3 rounded-lg shadow-lg backdrop-blur-sm transition-all duration-300"
12
+ :class="typeClasses[msg.type]"
13
+ >
14
+ <!-- Icon -->
15
+ <span class="flex-shrink-0" v-html="typeIcons[msg.type]"></span>
16
+ <!-- Content -->
17
+ <span class="text-sm font-medium">{{ msg.content }}</span>
18
+ <!-- Close Button -->
19
+ <button
20
+ v-if="msg.closable"
21
+ @click="removeMessage(msg.id)"
22
+ class="flex-shrink-0 ml-2 p-1 rounded-full hover:bg-black/10 transition-colors"
23
+ >
24
+ <svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
25
+ <path d="M18 6L6 18M6 6l12 12" />
26
+ </svg>
27
+ </button>
28
+ </div>
29
+ </TransitionGroup>
30
+ </Teleport>
31
+ </template>
32
+
33
+ <script setup>
34
+ import { ref, reactive } from 'vue'
35
+
36
+ defineOptions({
37
+ name: 'Message'
38
+ })
39
+
40
+ // Message list
41
+ const messages = ref([])
42
+
43
+ // Type styles
44
+ const typeClasses = {
45
+ success: 'bg-emerald-500/95 text-white',
46
+ warning: 'bg-amber-500/95 text-white',
47
+ error: 'bg-rose-500/95 text-white',
48
+ info: 'bg-sky-500/95 text-white'
49
+ }
50
+
51
+ // Type icons
52
+ const typeIcons = {
53
+ success: `<svg class="w-5 h-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
54
+ <path d="M20 6L9 17l-5-5" stroke-linecap="round" stroke-linejoin="round"/>
55
+ </svg>`,
56
+ warning: `<svg class="w-5 h-5" viewBox="0 0 24 24" fill="currentColor">
57
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/>
58
+ </svg>`,
59
+ error: `<svg class="w-5 h-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
60
+ <circle cx="12" cy="12" r="10"/>
61
+ <path d="M15 9l-6 6M9 9l6 6" stroke-linecap="round"/>
62
+ </svg>`,
63
+ info: `<svg class="w-5 h-5" viewBox="0 0 24 24" fill="currentColor">
64
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/>
65
+ </svg>`
66
+ }
67
+
68
+ let messageId = 0
69
+
70
+ // Add message
71
+ const addMessage = (options) => {
72
+ const id = ++messageId
73
+ const msg = {
74
+ id,
75
+ type: options.type || 'info',
76
+ content: options.content || '',
77
+ duration: options.duration ?? 3000,
78
+ closable: options.closable ?? false
79
+ }
80
+
81
+ messages.value.push(msg)
82
+
83
+ if (msg.duration > 0) {
84
+ setTimeout(() => {
85
+ removeMessage(id)
86
+ }, msg.duration)
87
+ }
88
+
89
+ return id
90
+ }
91
+
92
+ // Remove message
93
+ const removeMessage = (id) => {
94
+ const index = messages.value.findIndex(m => m.id === id)
95
+ if (index > -1) {
96
+ messages.value.splice(index, 1)
97
+ }
98
+ }
99
+
100
+ // Clear all messages
101
+ const clearAll = () => {
102
+ messages.value = []
103
+ }
104
+
105
+ // Expose methods
106
+ defineExpose({
107
+ addMessage,
108
+ removeMessage,
109
+ clearAll,
110
+ // Shorthand methods
111
+ success: (content, options = {}) => addMessage({ ...options, type: 'success', content }),
112
+ warning: (content, options = {}) => addMessage({ ...options, type: 'warning', content }),
113
+ error: (content, options = {}) => addMessage({ ...options, type: 'error', content }),
114
+ info: (content, options = {}) => addMessage({ ...options, type: 'info', content })
115
+ })
116
+ </script>
117
+
118
+ <style scoped>
119
+ /* Enter animation */
120
+ .message-enter-active {
121
+ animation: message-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
122
+ }
123
+
124
+ /* Leave animation */
125
+ .message-leave-active {
126
+ animation: message-out 0.2s ease-in forwards;
127
+ }
128
+
129
+ /* Move animation */
130
+ .message-move {
131
+ transition: transform 0.3s ease;
132
+ }
133
+
134
+ @keyframes message-in {
135
+ 0% {
136
+ opacity: 0;
137
+ transform: translateY(-20px) scale(0.9);
138
+ }
139
+ 100% {
140
+ opacity: 1;
141
+ transform: translateY(0) scale(1);
142
+ }
143
+ }
144
+
145
+ @keyframes message-out {
146
+ 0% {
147
+ opacity: 1;
148
+ transform: translateY(0) scale(1);
149
+ }
150
+ 100% {
151
+ opacity: 0;
152
+ transform: translateY(-10px) scale(0.95);
153
+ }
154
+ }
155
+ </style>
156
+
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="modal" :class="{ 'modal-show': visible }" v-if="visible">
3
3
  <div class="modal-dialog">
4
- <div class="modal-content">
4
+ <div class="modal-content" :style="{ width: width }">
5
5
  <!-- 模态框头部 -->
6
6
  <div class="modal-header">
7
7
  <h3 class="modal-header-title" v-if="title">{{ title }}</h3>
@@ -43,6 +43,10 @@ const props = defineProps({
43
43
  type: String,
44
44
  default: ''
45
45
  },
46
+ width: {
47
+ type: String,
48
+ default: '500px'
49
+ },
46
50
  // 是否显示默认底部按钮
47
51
  showFooter: {
48
52
  type: Boolean,
@@ -96,14 +100,12 @@ const handleConfirm = () => {
96
100
  // 模态框对话框
97
101
  &-dialog {
98
102
  position: relative;
99
- width: auto;
100
- margin: 10px;
103
+ display: flex;
104
+ justify-content: center;
105
+ align-items: center;
106
+ width: 100%;
107
+ max-width: 90vw;
101
108
  pointer-events: none;
102
-
103
- @media (min-width: 576px) {
104
- max-width: 500px;
105
- margin: 1.75rem auto;
106
- }
107
109
  }
108
110
 
109
111
  // 模态框内容
@@ -111,14 +113,17 @@ const handleConfirm = () => {
111
113
  position: relative;
112
114
  display: flex;
113
115
  flex-direction: column;
114
- width: 100%;
116
+ width: 500px;
117
+ max-width: 100%;
118
+ max-height: 90vh;
115
119
  pointer-events: auto;
116
- background-color: #fff;
120
+ background-color: var(--ld-card-bg, #fff);
117
121
  background-clip: padding-box;
118
- border: 1px solid rgba(0, 0, 0, 0.2);
122
+ border: 1px solid var(--ld-border-color, rgba(0, 0, 0, 0.2));
119
123
  border-radius: $border-radius-lg;
120
124
  outline: 0;
121
- box-shadow: $shadow-lg;
125
+ box-shadow: var(--ld-card-shadow, $shadow-lg);
126
+ overflow: hidden;
122
127
  }
123
128
 
124
129
  // 模态框头部
@@ -127,9 +132,10 @@ const handleConfirm = () => {
127
132
  justify-content: space-between;
128
133
  align-items: center;
129
134
  padding: 16px;
130
- border-bottom: 1px solid #dee2e6;
135
+ border-bottom: 1px solid var(--ld-border-color-light, #dee2e6);
131
136
  border-top-left-radius: calc($border-radius-lg - 1px);
132
137
  border-top-right-radius: calc($border-radius-lg - 1px);
138
+ background-color: var(--ld-card-bg, #fff);
133
139
  }
134
140
 
135
141
  // 模态框头部标题
@@ -137,7 +143,7 @@ const handleConfirm = () => {
137
143
  margin: 0;
138
144
  font-size: $font-size-large;
139
145
  font-weight: 600;
140
- color: #303133;
146
+ color: var(--ld-text-primary, #303133);
141
147
  }
142
148
 
143
149
  // 模态框头部关闭按钮
@@ -148,11 +154,13 @@ const handleConfirm = () => {
148
154
  cursor: pointer;
149
155
  font-size: 1.5rem;
150
156
  line-height: 1;
151
- color: #6c757d;
157
+ color: var(--ld-text-secondary, #6c757d);
152
158
  opacity: 0.5;
159
+ transition: all 0.2s;
153
160
 
154
161
  &:hover {
155
162
  opacity: 1;
163
+ color: var(--ld-text-primary, #303133);
156
164
  }
157
165
  }
158
166
 
@@ -161,7 +169,8 @@ const handleConfirm = () => {
161
169
  position: relative;
162
170
  flex: 1 1 auto;
163
171
  padding: 16px;
164
- color: #606266;
172
+ color: var(--ld-text-regular, #606266);
173
+ background-color: var(--ld-card-bg, #fff);
165
174
  }
166
175
 
167
176
  // 模态框底部
@@ -170,9 +179,10 @@ const handleConfirm = () => {
170
179
  justify-content: flex-end;
171
180
  align-items: center;
172
181
  padding: 16px;
173
- border-top: 1px solid #dee2e6;
182
+ border-top: 1px solid var(--ld-border-color-light, #dee2e6);
174
183
  border-bottom-left-radius: calc($border-radius-lg - 1px);
175
184
  border-bottom-right-radius: calc($border-radius-lg - 1px);
185
+ background-color: var(--ld-card-bg, #fff);
176
186
 
177
187
  >*+* {
178
188
  margin-left: 8px;