28 changed files with 434 additions and 198 deletions
@ -1,4 +1,7 @@ |
|||
node_modules |
|||
.temp |
|||
.cache |
|||
dist |
|||
dist |
|||
princess-ui/lib |
|||
princess-ui/theme-chalk |
|||
princess-ui/components.d.ts |
@ -1,10 +1,11 @@ |
|||
import DefaultTheme from 'vitepress/dist/client/theme-default' |
|||
|
|||
import PrincessUI from "@princess-ui/components" |
|||
export default { |
|||
...DefaultTheme, |
|||
|
|||
enhanceApp({ app, router, siteData }) { |
|||
// app is the Vue 3 app instance from `createApp()`. router is VitePress'
|
|||
// custom router. `siteData`` is a `ref`` of current site-level metadata.
|
|||
app.use(PrincessUI) |
|||
} |
|||
} |
|||
|
@ -0,0 +1,8 @@ |
|||
import PsCaptcha from "./index.vue" |
|||
|
|||
PsCaptcha.name = "ps-captcha" |
|||
|
|||
export { |
|||
PsCaptcha |
|||
} |
|||
export default PsCaptcha |
@ -1,9 +1,9 @@ |
|||
// 该文件为自动生成,请勿修改!!!
|
|||
import PsButton from "./button" |
|||
import PsCaptcha from "./captcha" |
|||
import PsFuck from "./fuck" |
|||
import PsSend from "./send" |
|||
export { |
|||
PsButton, |
|||
PsFuck, |
|||
PsSend |
|||
PsCaptcha, |
|||
PsFuck |
|||
} |
@ -1,8 +0,0 @@ |
|||
import PsSend from "./index.vue" |
|||
|
|||
PsSend.name = "ps-send" |
|||
|
|||
export { |
|||
PsSend |
|||
} |
|||
export default PsSend |
@ -1,8 +1,8 @@ |
|||
declare module 'vue' { |
|||
export interface GlobalComponents { |
|||
PsButton: typeof import('./lib')['PsButton'], |
|||
PsFuck: typeof import('./lib')['PsFuck'], |
|||
PsSend: typeof import('./lib')['PsSend'] |
|||
PsButton: typeof import('./lib/button')['PsButton'], |
|||
PsCaptcha: typeof import('./lib/captcha')['PsCaptcha'], |
|||
PsFuck: typeof import('./lib/fuck')['PsFuck'] |
|||
} |
|||
} |
|||
export { } |
@ -1,21 +1,7 @@ |
|||
import type { DefineComponent, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes, PropType } from 'vue'; |
|||
import type { DefineComponent, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes } from 'vue'; |
|||
declare const _sfc_main: DefineComponent<{ |
|||
color: { |
|||
type: PropType<"blue" | "red">; |
|||
required: true; |
|||
}; |
|||
aaa: { |
|||
type: PropType<"red" | "dd">; |
|||
required: true; |
|||
}; |
|||
text: StringConstructor; |
|||
}, unknown, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{ |
|||
color: { |
|||
type: PropType<"blue" | "red">; |
|||
required: true; |
|||
}; |
|||
aaa: { |
|||
type: PropType<"red" | "dd">; |
|||
required: true; |
|||
}; |
|||
text: StringConstructor; |
|||
}>>, {}>; |
|||
export default _sfc_main; |
|||
|
@ -1 +1 @@ |
|||
(function(e,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,t(e.psButton={},e.Vue))})(this,function(e,t){"use strict";var c="",d=(n,i)=>{const r=n.__vccOpts||n;for(const[u,s]of i)r[u]=s;return r};const p=t.defineComponent({props:{color:{type:String,required:!0},aaa:{type:String,required:!0}}});function a(n,i,r,u,s,f){return t.openBlock(),t.createElementBlock("div",null," sada"+t.toDisplayString(n.color),1)}var o=d(p,[["render",a]]);o.name="ps-button",e.PsButton=o,e.default=o,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
|||
(function(t,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t.psButton={},t.Vue))})(this,function(t,e){"use strict";var u=(n,r)=>{const s=n.__vccOpts||n;for(const[i,d]of r)s[i]=d;return s};const f=e.defineComponent({props:{text:String}}),p={class:"ps-button"};function c(n,r,s,i,d,a){return e.openBlock(),e.createElementBlock("div",p,[e.renderSlot(n.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(n.text),1)])])}var o=u(f,[["render",c]]);o.name="ps-button",t.PsButton=o,t.default=o,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
|||
|
@ -1 +0,0 @@ |
|||
div{background-color:#639}div{color:red} |
@ -0,0 +1,84 @@ |
|||
import type { DefineComponent, Ref, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes } from 'vue'; |
|||
declare const _sfc_main: DefineComponent<{ |
|||
duration: { |
|||
type: NumberConstructor; |
|||
required: false; |
|||
default: number; |
|||
}; |
|||
initText: { |
|||
type: StringConstructor; |
|||
required: false; |
|||
default: string; |
|||
}; |
|||
runText: { |
|||
type: StringConstructor; |
|||
required: false; |
|||
default: string; |
|||
}; |
|||
loadingText: { |
|||
type: StringConstructor; |
|||
required: false; |
|||
default: string; |
|||
}; |
|||
resetText: { |
|||
type: StringConstructor; |
|||
required: false; |
|||
default: string; |
|||
}; |
|||
}, { |
|||
props: { |
|||
duration: number; |
|||
initText: string; |
|||
runText: string; |
|||
loadingText: string; |
|||
resetText: string; |
|||
}; |
|||
emits: { |
|||
(event: "update:modelValue", show: boolean): void; |
|||
(event: "send", start: () => void, done: (isDone?: boolean) => void): void; |
|||
}; |
|||
text: Ref<string>; |
|||
isDisabled: Ref<boolean>; |
|||
isLoading: Ref<boolean>; |
|||
timeID: any; |
|||
stop: () => void; |
|||
getText: (second: string | number) => string; |
|||
run: () => void; |
|||
onClick: () => void; |
|||
}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ("update:modelValue" | "send")[], "update:modelValue" | "send", VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{ |
|||
duration: { |
|||
type: NumberConstructor; |
|||
required: false; |
|||
default: number; |
|||
}; |
|||
initText: { |
|||
type: StringConstructor; |
|||
required: false; |
|||
default: string; |
|||
}; |
|||
runText: { |
|||
type: StringConstructor; |
|||
required: false; |
|||
default: string; |
|||
}; |
|||
loadingText: { |
|||
type: StringConstructor; |
|||
required: false; |
|||
default: string; |
|||
}; |
|||
resetText: { |
|||
type: StringConstructor; |
|||
required: false; |
|||
default: string; |
|||
}; |
|||
}>> & { |
|||
"onUpdate:modelValue"?: (...args: any[]) => any; |
|||
onSend?: (...args: any[]) => any; |
|||
}, { |
|||
duration: number; |
|||
initText: string; |
|||
runText: string; |
|||
loadingText: string; |
|||
resetText: string; |
|||
}>; |
|||
export default _sfc_main; |
@ -0,0 +1,75 @@ |
|||
import { defineComponent, ref, onBeforeUnmount, openBlock, createElementBlock, toDisplayString } from "vue"; |
|||
const _hoisted_1 = ["disabled", "loading"]; |
|||
const _sfc_main = /* @__PURE__ */ defineComponent({ |
|||
name: "index", |
|||
props: { |
|||
duration: { default: 60 }, |
|||
initText: { default: "\u83B7\u53D6\u9A8C\u8BC1\u7801" }, |
|||
runText: { default: "{%s}s \u540E\u91CD\u65B0\u53D1\u9001" }, |
|||
loadingText: { default: "\u6B63\u5728\u53D1\u9001" }, |
|||
resetText: { default: "\u91CD\u65B0\u83B7\u53D6" } |
|||
}, |
|||
emits: ["update:modelValue", "send"], |
|||
setup(__props, { emit: emits }) { |
|||
const props = __props; |
|||
const text = ref(props.initText); |
|||
const isDisabled = ref(false); |
|||
const isLoading = ref(false); |
|||
let timeID; |
|||
onBeforeUnmount(() => { |
|||
stop(); |
|||
}); |
|||
function stop() { |
|||
clearInterval(timeID); |
|||
text.value = props.resetText; |
|||
isLoading.value = false; |
|||
isDisabled.value = false; |
|||
emits("update:modelValue", false); |
|||
} |
|||
function getText(second) { |
|||
return props.runText.replace(/\{([^{]*?)%s(.*?)\}/g, String(second)); |
|||
} |
|||
function run() { |
|||
isLoading.value = false; |
|||
let number = props.duration; |
|||
text.value = getText(number); |
|||
clearInterval(timeID); |
|||
timeID = setInterval(() => { |
|||
number--; |
|||
text.value = getText(number); |
|||
if (number <= 0) { |
|||
stop(); |
|||
} |
|||
}, 1e3); |
|||
} |
|||
function onClick() { |
|||
if (isDisabled.value) |
|||
return; |
|||
if (isLoading.value) |
|||
return; |
|||
emits("send", () => { |
|||
isDisabled.value = true; |
|||
isLoading.value = true; |
|||
text.value = props.loadingText; |
|||
}, (isDone = true) => { |
|||
if (isDone) { |
|||
run(); |
|||
} else { |
|||
stop(); |
|||
} |
|||
}); |
|||
} |
|||
return (_ctx, _cache) => { |
|||
return openBlock(), createElementBlock("div", { |
|||
class: "ps-send", |
|||
onClick, |
|||
disabled: isDisabled.value, |
|||
loading: isLoading.value, |
|||
type: "button", |
|||
size: "small" |
|||
}, toDisplayString(text.value), 9, _hoisted_1); |
|||
}; |
|||
} |
|||
}); |
|||
_sfc_main.name = "ps-captcha"; |
|||
export { _sfc_main as PsCaptcha, _sfc_main as default }; |
@ -0,0 +1 @@ |
|||
(function(u,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(u=typeof globalThis!="undefined"?globalThis:u||self,e(u.psCaptcha={},u.Vue))})(this,function(u,e){"use strict";const c=["disabled","loading"],s=e.defineComponent({name:"index",props:{duration:{default:60},initText:{default:"\u83B7\u53D6\u9A8C\u8BC1\u7801"},runText:{default:"{%s}s \u540E\u91CD\u65B0\u53D1\u9001"},loadingText:{default:"\u6B63\u5728\u53D1\u9001"},resetText:{default:"\u91CD\u65B0\u83B7\u53D6"}},emits:["update:modelValue","send"],setup(p,{emit:d}){const n=p,a=e.ref(n.initText),i=e.ref(!1),l=e.ref(!1);let o;e.onBeforeUnmount(()=>{r()});function r(){clearInterval(o),a.value=n.resetText,l.value=!1,i.value=!1,d("update:modelValue",!1)}function f(t){return n.runText.replace(/\{([^{]*?)%s(.*?)\}/g,String(t))}function m(){l.value=!1;let t=n.duration;a.value=f(t),clearInterval(o),o=setInterval(()=>{t--,a.value=f(t),t<=0&&r()},1e3)}function v(){i.value||l.value||d("send",()=>{i.value=!0,l.value=!0,a.value=n.loadingText},(t=!0)=>{t?m():r()})}return(t,x)=>(e.openBlock(),e.createElementBlock("div",{class:"ps-send",onClick:v,disabled:i.value,loading:l.value,type:"button",size:"small"},e.toDisplayString(a.value),9,c))}});s.name="ps-captcha",u.PsCaptcha=s,u.default=s,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
@ -1,4 +1,4 @@ |
|||
import PsButton from "./button"; |
|||
import PsCaptcha from "./captcha"; |
|||
import PsFuck from "./fuck"; |
|||
import PsSend from "./send"; |
|||
export { PsButton, PsFuck, PsSend }; |
|||
export { PsButton, PsCaptcha, PsFuck }; |
|||
|
@ -1 +1 @@ |
|||
(function(n,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(n=typeof globalThis!="undefined"?globalThis:n||self,e(n.ps={},n.Vue))})(this,function(n,e){"use strict";var g="",i=(t,o)=>{const r=t.__vccOpts||t;for(const[_,u]of o)r[_]=u;return r};const p=e.defineComponent({props:{color:{type:String,required:!0},aaa:{type:String,required:!0}}});function f(t,o,r,_,u,x){return e.openBlock(),e.createElementBlock("div",null," sada"+e.toDisplayString(t.color),1)}var c=i(p,[["render",f]]);c.name="ps-button";var k="";const s=e.defineComponent({name:"index",props:{color:null},setup(t){return(o,r)=>(e.openBlock(),e.createElementBlock("div",null,[e.createTextVNode(" sada"+e.toDisplayString(t.color)+" ",1),e.createVNode(e.unref(c),{color:"red",aaa:"red"})]))}});s.name="ps-fuck";var S="";const m={};function y(t,o){return e.openBlock(),e.createElementBlock("div",null," send ")}var a=i(m,[["render",y]]);a.name="ps-send";var d=Object.freeze(Object.defineProperty({__proto__:null,PsButton:c,PsFuck:s,PsSend:a},Symbol.toStringTag,{value:"Module"}));function l(t){for(const o in d){const r=d[o];t.component(r.name||"ps-"+o,r)}}var v={install:l};n.PsButton=c,n.PsFuck=s,n.PsSend=a,n.default=v,n.install=l,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
|||
(function(n,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(n=typeof globalThis!="undefined"?globalThis:n||self,e(n.ps={},n.Vue))})(this,function(n,e){"use strict";var b=(o,a)=>{const t=o.__vccOpts||o;for(const[r,u]of a)t[r]=u;return t};const x=e.defineComponent({props:{text:String}}),v={class:"ps-button"};function y(o,a,t,r,u,i){return e.openBlock(),e.createElementBlock("div",v,[e.renderSlot(o.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(o.text),1)])])}var s=b(x,[["render",y]]);s.name="ps-button";var T=Object.freeze(Object.defineProperty({__proto__:null,PsButton:s,default:s},Symbol.toStringTag,{value:"Module"}));const B=["disabled","loading"],c=e.defineComponent({name:"index",props:{duration:{default:60},initText:{default:"\u83B7\u53D6\u9A8C\u8BC1\u7801"},runText:{default:"{%s}s \u540E\u91CD\u65B0\u53D1\u9001"},loadingText:{default:"\u6B63\u5728\u53D1\u9001"},resetText:{default:"\u91CD\u65B0\u83B7\u53D6"}},emits:["update:modelValue","send"],setup(o,{emit:a}){const t=o,r=e.ref(t.initText),u=e.ref(!1),i=e.ref(!1);let f;e.onBeforeUnmount(()=>{p()});function p(){clearInterval(f),r.value=t.resetText,i.value=!1,u.value=!1,a("update:modelValue",!1)}function g(l){return t.runText.replace(/\{([^{]*?)%s(.*?)\}/g,String(l))}function h(){i.value=!1;let l=t.duration;r.value=g(l),clearInterval(f),f=setInterval(()=>{l--,r.value=g(l),l<=0&&p()},1e3)}function C(){u.value||i.value||a("send",()=>{u.value=!0,i.value=!0,r.value=t.loadingText},(l=!0)=>{l?h():p()})}return(l,j)=>(e.openBlock(),e.createElementBlock("div",{class:"ps-send",onClick:C,disabled:u.value,loading:i.value,type:"button",size:"small"},e.toDisplayString(r.value),9,B))}});c.name="ps-captcha";var S=Object.freeze(Object.defineProperty({__proto__:null,PsCaptcha:c,default:c},Symbol.toStringTag,{value:"Module"})),D="";const d=e.defineComponent({name:"index",props:{color:null},setup(o){return(a,t)=>(e.openBlock(),e.createElementBlock("div",null,[e.createTextVNode(" sada"+e.toDisplayString(o.color)+" ",1),e.createVNode(e.unref(s),{color:"red",aaa:"red"})]))}});d.name="ps-fuck";var P=Object.freeze(Object.defineProperty({__proto__:null,PsFuck:d,default:d},Symbol.toStringTag,{value:"Module"})),_=Object.freeze(Object.defineProperty({__proto__:null,PsButton:s,PsCaptcha:c,PsFuck:d},Symbol.toStringTag,{value:"Module"}));console.log({"./button/index.ts":T,"./captcha/index.ts":S,"./fuck/index.ts":P});function m(o){for(const a in _){const t=_[a];o.component(t.name||"ps-"+a,t)}}var k={install:m};n.PsButton=s,n.PsCaptcha=c,n.PsFuck=d,n.default=k,n.install=m,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
|||
|
@ -1,16 +0,0 @@ |
|||
import { openBlock, createElementBlock } from "vue"; |
|||
var index_vue_vue_type_style_index_0_lang = ""; |
|||
var _export_sfc = (sfc, props) => { |
|||
const target = sfc.__vccOpts || sfc; |
|||
for (const [key, val] of props) { |
|||
target[key] = val; |
|||
} |
|||
return target; |
|||
}; |
|||
const _sfc_main = {}; |
|||
function _sfc_render(_ctx, _cache) { |
|||
return openBlock(), createElementBlock("div", null, " send "); |
|||
} |
|||
var PsSend = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); |
|||
PsSend.name = "ps-send"; |
|||
export { PsSend, PsSend as default }; |
@ -1 +0,0 @@ |
|||
(function(e,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(e=typeof globalThis!="undefined"?globalThis:e||self,n(e.psSend={},e.Vue))})(this,function(e,n){"use strict";var f="",u=(d,o)=>{const s=d.__vccOpts||d;for(const[_,c]of o)s[_]=c;return s};const i={};function r(d,o){return n.openBlock(),n.createElementBlock("div",null," send ")}var t=u(i,[["render",r]]);t.name="ps-send",e.PsSend=t,e.default=t,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
@ -1 +0,0 @@ |
|||
div{color:gold} |
@ -1 +1 @@ |
|||
div{background-color:#639}div{color:red}div{color:green}div{color:gold} |
|||
div{color:green} |
|||
|
@ -0,0 +1,4 @@ |
|||
.ps-send{ |
|||
color: blue; |
|||
cursor: pointer; |
|||
} |
@ -1,4 +1,5 @@ |
|||
@import "./button.scss"; |
|||
@import "./send.scss"; |
|||
div{ |
|||
color: rosybrown; |
|||
} |
Loading…
Reference in new issue