25 changed files with 4 additions and 420 deletions
@ -1,4 +1,7 @@ |
|||
node_modules |
|||
.temp |
|||
.cache |
|||
dist |
|||
dist |
|||
**/princess-ui/lib |
|||
**/princess-ui/theme-chalk |
|||
**/princess-ui/components.d.ts |
@ -1,8 +0,0 @@ |
|||
declare module 'vue' { |
|||
export interface GlobalComponents { |
|||
PsButton: typeof import('./lib/button')['PsButton'], |
|||
PsCaptcha: typeof import('./lib/captcha')['PsCaptcha'], |
|||
PsFuck: typeof import('./lib/fuck')['PsFuck'] |
|||
} |
|||
} |
|||
export { } |
@ -1,7 +0,0 @@ |
|||
import type { DefineComponent, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes } from 'vue'; |
|||
declare const _sfc_main: DefineComponent<{ |
|||
text: StringConstructor; |
|||
}, unknown, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{ |
|||
text: StringConstructor; |
|||
}>>, {}>; |
|||
export default _sfc_main; |
@ -1,24 +0,0 @@ |
|||
import { defineComponent, openBlock, createElementBlock, renderSlot, createTextVNode, toDisplayString } from "vue"; |
|||
var _export_sfc = (sfc, props) => { |
|||
const target = sfc.__vccOpts || sfc; |
|||
for (const [key, val] of props) { |
|||
target[key] = val; |
|||
} |
|||
return target; |
|||
}; |
|||
const _sfc_main = defineComponent({ |
|||
props: { |
|||
text: String |
|||
} |
|||
}); |
|||
const _hoisted_1 = { class: "ps-button" }; |
|||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { |
|||
return openBlock(), createElementBlock("div", _hoisted_1, [ |
|||
renderSlot(_ctx.$slots, "default", {}, () => [ |
|||
createTextVNode(toDisplayString(_ctx.text), 1) |
|||
]) |
|||
]); |
|||
} |
|||
var PsButton = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); |
|||
PsButton.name = "ps-button"; |
|||
export { PsButton, PsButton as default }; |
@ -1 +0,0 @@ |
|||
(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,84 +0,0 @@ |
|||
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; |
@ -1,75 +0,0 @@ |
|||
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 }; |
@ -1 +0,0 @@ |
|||
(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 +0,0 @@ |
|||
import PsButton from "./button"; |
|||
import PsCaptcha from "./captcha"; |
|||
import PsFuck from "./fuck"; |
|||
export { PsButton, PsCaptcha, PsFuck }; |
@ -1,18 +0,0 @@ |
|||
import type { DefineComponent, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes } from 'vue'; |
|||
declare const _sfc_main: DefineComponent<{ |
|||
color: { |
|||
type: StringConstructor; |
|||
required: true; |
|||
}; |
|||
}, { |
|||
props: { |
|||
color: 'aaa'; |
|||
}; |
|||
PsButton: any; |
|||
}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{ |
|||
color: { |
|||
type: StringConstructor; |
|||
required: true; |
|||
}; |
|||
}>>, {}>; |
|||
export default _sfc_main; |
@ -1,22 +0,0 @@ |
|||
import { defineComponent, openBlock, createElementBlock, createTextVNode, toDisplayString, createVNode, unref } from "vue"; |
|||
import PsButton from "princess-ui/lib/button"; |
|||
var index_vue_vue_type_style_index_0_lang = ""; |
|||
const _sfc_main = /* @__PURE__ */ defineComponent({ |
|||
name: "index", |
|||
props: { |
|||
color: null |
|||
}, |
|||
setup(__props) { |
|||
return (_ctx, _cache) => { |
|||
return openBlock(), createElementBlock("div", null, [ |
|||
createTextVNode(" sada" + toDisplayString(__props.color) + " ", 1), |
|||
createVNode(unref(PsButton), { |
|||
color: "red", |
|||
aaa: "red" |
|||
}) |
|||
]); |
|||
}; |
|||
} |
|||
}); |
|||
_sfc_main.name = "ps-fuck"; |
|||
export { _sfc_main as PsFuck, _sfc_main as default }; |
@ -1 +0,0 @@ |
|||
(function(t,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue"),require("princess-ui/lib/button")):typeof define=="function"&&define.amd?define(["exports","vue","princess-ui/lib/button"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t.psFuck={},t.Vue,t.psButton))})(this,function(t,e,o){"use strict";function i(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var r=i(o),d="";const u=e.defineComponent({name:"index",props:{color:null},setup(n){return(c,s)=>(e.openBlock(),e.createElementBlock("div",null,[e.createTextVNode(" sada"+e.toDisplayString(n.color)+" ",1),e.createVNode(e.unref(r.default),{color:"red",aaa:"red"})]))}});u.name="ps-fuck",t.PsFuck=u,t.default=u,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
@ -1 +0,0 @@ |
|||
div{color:green} |
@ -1,7 +0,0 @@ |
|||
export * from "./components"; |
|||
declare function install(app: any): void; |
|||
export { install }; |
|||
declare const _default: { |
|||
install: typeof install; |
|||
}; |
|||
export default _default; |
@ -1,147 +0,0 @@ |
|||
import { defineComponent, openBlock, createElementBlock, renderSlot, createTextVNode, toDisplayString, ref, onBeforeUnmount, createVNode, unref } from "vue"; |
|||
var _export_sfc = (sfc, props) => { |
|||
const target = sfc.__vccOpts || sfc; |
|||
for (const [key, val] of props) { |
|||
target[key] = val; |
|||
} |
|||
return target; |
|||
}; |
|||
const _sfc_main$2 = defineComponent({ |
|||
props: { |
|||
text: String |
|||
} |
|||
}); |
|||
const _hoisted_1$1 = { class: "ps-button" }; |
|||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { |
|||
return openBlock(), createElementBlock("div", _hoisted_1$1, [ |
|||
renderSlot(_ctx.$slots, "default", {}, () => [ |
|||
createTextVNode(toDisplayString(_ctx.text), 1) |
|||
]) |
|||
]); |
|||
} |
|||
var PsButton = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render]]); |
|||
PsButton.name = "ps-button"; |
|||
var __glob_2_0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ |
|||
__proto__: null, |
|||
PsButton, |
|||
"default": PsButton |
|||
}, Symbol.toStringTag, { value: "Module" })); |
|||
const _hoisted_1 = ["disabled", "loading"]; |
|||
const _sfc_main$1 = /* @__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$1.name = "ps-captcha"; |
|||
var __glob_2_1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ |
|||
__proto__: null, |
|||
PsCaptcha: _sfc_main$1, |
|||
"default": _sfc_main$1 |
|||
}, Symbol.toStringTag, { value: "Module" })); |
|||
var index_vue_vue_type_style_index_0_lang = ""; |
|||
const _sfc_main = /* @__PURE__ */ defineComponent({ |
|||
name: "index", |
|||
props: { |
|||
color: null |
|||
}, |
|||
setup(__props) { |
|||
return (_ctx, _cache) => { |
|||
return openBlock(), createElementBlock("div", null, [ |
|||
createTextVNode(" sada" + toDisplayString(__props.color) + " ", 1), |
|||
createVNode(unref(PsButton), { |
|||
color: "red", |
|||
aaa: "red" |
|||
}) |
|||
]); |
|||
}; |
|||
} |
|||
}); |
|||
_sfc_main.name = "ps-fuck"; |
|||
var __glob_2_2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ |
|||
__proto__: null, |
|||
PsFuck: _sfc_main, |
|||
"default": _sfc_main |
|||
}, Symbol.toStringTag, { value: "Module" })); |
|||
var componets = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ |
|||
__proto__: null, |
|||
PsButton, |
|||
PsCaptcha: _sfc_main$1, |
|||
PsFuck: _sfc_main |
|||
}, Symbol.toStringTag, { value: "Module" })); |
|||
console.log({ "./button/index.ts": __glob_2_0, "./captcha/index.ts": __glob_2_1, "./fuck/index.ts": __glob_2_2 }); |
|||
function install(app) { |
|||
for (const key in componets) { |
|||
const component = componets[key]; |
|||
app.component(component.name || "ps-" + key, component); |
|||
} |
|||
} |
|||
var index = { |
|||
install |
|||
}; |
|||
export { PsButton, _sfc_main$1 as PsCaptcha, _sfc_main as PsFuck, index as default, install }; |
@ -1 +0,0 @@ |
|||
(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 +0,0 @@ |
|||
div{color:green} |
@ -1 +0,0 @@ |
|||
div{color:red}div{color:#bc8f8f} |
@ -1 +0,0 @@ |
|||
div{color:red} |
@ -1,4 +0,0 @@ |
|||
|
|||
div{ |
|||
color: red; |
|||
} |
@ -1,3 +0,0 @@ |
|||
div{ |
|||
color: rosybrown; |
|||
} |
@ -1,4 +0,0 @@ |
|||
@import "./button.scss"; |
|||
div{ |
|||
color: rosybrown; |
|||
} |
@ -1,4 +0,0 @@ |
|||
|
|||
div{ |
|||
color: red; |
|||
} |
Loading…
Reference in new issue