Browse Source

一些问题

master
1549469775 3 years ago
parent
commit
7f3d698b2b
  1. 5
      .gitignore
  2. 3
      docs/.vitepress/theme/index.js
  3. 8
      packages/components/captcha/index.ts
  4. 15
      packages/components/captcha/index.vue
  5. 6
      packages/components/components.ts
  6. 8
      packages/components/send/index.ts
  7. 3
      packages/playground/components.d.ts
  8. 24
      packages/playground/src/App.vue
  9. 2
      packages/playground/vite.config.ts
  10. 40
      packages/princess-ui/PrincessResolver.js
  11. 6
      packages/princess-ui/components.d.ts
  12. 20
      packages/princess-ui/lib/button/index.d.ts
  13. 19
      packages/princess-ui/lib/button/index.js
  14. 2
      packages/princess-ui/lib/button/index.umd.js
  15. 1
      packages/princess-ui/lib/button/style.css
  16. 84
      packages/princess-ui/lib/captcha/index.d.ts
  17. 75
      packages/princess-ui/lib/captcha/index.js
  18. 1
      packages/princess-ui/lib/captcha/index.umd.js
  19. 4
      packages/princess-ui/lib/components.d.ts
  20. 129
      packages/princess-ui/lib/index.js
  21. 2
      packages/princess-ui/lib/index.umd.js
  22. 16
      packages/princess-ui/lib/send/index.js
  23. 1
      packages/princess-ui/lib/send/index.umd.js
  24. 1
      packages/princess-ui/lib/send/style.css
  25. 2
      packages/princess-ui/lib/style.css
  26. 4
      packages/theme-chalk/src/captcha.scss
  27. 1
      packages/theme-chalk/src/index.scss

5
.gitignore

@ -1,4 +1,7 @@
node_modules
.temp
.cache
dist
dist
princess-ui/lib
princess-ui/theme-chalk
princess-ui/components.d.ts

3
docs/.vitepress/theme/index.js

@ -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)
}
}

8
packages/components/captcha/index.ts

@ -0,0 +1,8 @@
import PsCaptcha from "./index.vue"
PsCaptcha.name = "ps-captcha"
export {
PsCaptcha
}
export default PsCaptcha

15
packages/components/send/index.vue → packages/components/captcha/index.vue

@ -1,11 +1,11 @@
<template>
<button @click="onClick" :disabled="isDisabled" :loading="isLoading" type="button" size="small">
<div class="ps-send" @click="onClick" :disabled="isDisabled" :loading="isLoading" type="button" size="small">
{{ text }}
</button>
</div>
</template>
<script lang="ts" setup>
import { onBeforeUnmount, ref, watchEffect } from "vue"
import { onBeforeUnmount, ref } from "vue"
const props = withDefaults(
defineProps<{
duration?: number
@ -24,13 +24,12 @@ const props = withDefaults(
)
const emits = defineEmits<{
(event: "update:modelValue", show: boolean): void
(event: "send", start: () => void, done: (isDone: boolean) => void): void
(event: "send", start: () => void, done: (isDone?: boolean) => void): void
}>()
const text = ref(props.initText)
const isDisabled = ref(false)
const isLoading = ref(false)
let number = props.duration
let timeID: any
onBeforeUnmount(() => {
@ -39,7 +38,6 @@ onBeforeUnmount(() => {
function stop() {
clearInterval(timeID)
number = props.duration
text.value = props.resetText
isLoading.value = false
isDisabled.value = false
@ -51,6 +49,7 @@ function getText(second: string | number): string {
}
function run() {
isLoading.value = false
let number = props.duration
text.value = getText(number)
clearInterval(timeID)
timeID = setInterval(() => {
@ -63,6 +62,8 @@ function run() {
}
function onClick() {
if (isDisabled.value) return
if (isLoading.value) return
emits(
"send",
() => {
@ -70,7 +71,7 @@ function onClick() {
isLoading.value = true
text.value = props.loadingText
},
(isDone: boolean) => {
(isDone: boolean = true) => {
if (isDone) {
run()
} else {

6
packages/components/components.ts

@ -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
}

8
packages/components/send/index.ts

@ -1,8 +0,0 @@
import PsSend from "./index.vue"
PsSend.name = "ps-send"
export {
PsSend
}
export default PsSend

3
packages/playground/components.d.ts

@ -6,8 +6,7 @@ import '@vue/runtime-core'
declare module '@vue/runtime-core' {
export interface GlobalComponents {
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
PsButton: typeof import('@princess-ui/components/button')['PsButton']
PsSend: typeof import('@princess-ui/components/send')['PsSend']
PsCaptcha: typeof import('@princess-ui/components/captcha')['PsCaptcha']
}
}

24
packages/playground/src/App.vue

@ -2,22 +2,26 @@
// This starter template is using Vue 3 <script setup> SFCs
// Check out https://vuejs.org/api/sfc-script-setup.html#script-setup
import HelloWorld from './components/HelloWorld.vue'
function send(start: () => void, done: (isDone: boolean) => void) {
start()
setTimeout(() => {
done(true)
}, 2500);
}
</script>
<template>
<img alt="Vue logo" src="./assets/logo.png" />
<HelloWorld msg="Hello Vue 3 + TypeScript + Vite" />
<ps-button color="red" aaa="dd">sada</ps-button>
<ps-send color="red" aaa="dd">sada</ps-send>
<ps-captcha @send="send" :duration="5">sada</ps-captcha>
</template>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>

2
packages/playground/vite.config.ts

@ -22,7 +22,7 @@ export default defineConfig({
type: 'component',
resolve: (componentName: string) => {
if (componentName.startsWith('Ps')) {
const name = _.lowerFirst(componentName.slice(2))
const name = _.lowerFirst(componentName.slice(2))
return {
name: componentName,
from: `@princess-ui/components/${name}`,

40
packages/princess-ui/PrincessResolver.js

@ -6,24 +6,44 @@ exports.__esModule = true;
var fs_1 = __importDefault(require("fs"));
var path_1 = __importDefault(require("path"));
function existCss(compName) {
if (fs_1["default"].existsSync(path_1["default"].resolve(__dirname, "./lib/" + compName[0].toLowerCase() + compName.slice(1) + "/style.css"))) {
if (fs_1["default"].existsSync(path_1["default"].resolve(__dirname, './lib/' +
compName[0].toLowerCase() +
compName.slice(1) +
'/style.css'))) {
return true;
}
return false;
}
exports["default"] = (function (name, p) {
if (name === void 0) { name = "princess-ui"; }
if (p === void 0) { p = "/lib"; }
function existTheme(compName) {
if (fs_1["default"].existsSync(path_1["default"].resolve(__dirname, './theme-chalk/ps-' +
compName[0].toLowerCase() +
compName.slice(1) +
'.css'))) {
return true;
}
return false;
}
exports["default"] = (function () {
return {
type: "component",
type: 'component',
resolve: function (componentName) {
if (componentName.startsWith("Ps")) {
if (componentName.startsWith('Ps')) {
var css = [];
var n = componentName.slice(2);
if (existCss(n)) {
css.push((function getSideEffects(compName) {
return "princess-ui/lib/".concat(compName[0].toLowerCase() + compName.slice(1), "/style.css");
})(n));
}
if (existTheme(n)) {
css.push((function getSideEffects(compName) {
return "princess-ui/theme-chalk/ps-".concat(compName[0].toLowerCase() + compName.slice(1), ".css");
})(n));
}
return {
name: componentName,
from: name,
sideEffects: existCss(componentName.slice(2)) ? (function getSideEffects(compName) {
return "".concat(name).concat(p, "/").concat(compName[0].toLowerCase() + compName.slice(1), "/style.css");
})(componentName.slice(2)) : undefined
from: 'princess-ui',
sideEffects: css
};
}
}

6
packages/princess-ui/components.d.ts

@ -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 { }

20
packages/princess-ui/lib/button/index.d.ts

@ -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;

19
packages/princess-ui/lib/button/index.js

@ -1,5 +1,4 @@
import { defineComponent, openBlock, createElementBlock, toDisplayString } from "vue";
var index_vue_vue_type_style_index_0_lang = "";
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) {
@ -9,18 +8,16 @@ var _export_sfc = (sfc, props) => {
};
const _sfc_main = defineComponent({
props: {
color: {
type: String,
required: true
},
aaa: {
type: String,
required: true
}
text: String
}
});
const _hoisted_1 = { class: "ps-button" };
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", null, " sada" + toDisplayString(_ctx.color), 1);
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";

2
packages/princess-ui/lib/button/index.umd.js

@ -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
packages/princess-ui/lib/button/style.css

@ -1 +0,0 @@
div{background-color:#639}div{color:red}

84
packages/princess-ui/lib/captcha/index.d.ts

@ -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;

75
packages/princess-ui/lib/captcha/index.js

@ -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 };

1
packages/princess-ui/lib/captcha/index.umd.js

@ -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"}})});

4
packages/princess-ui/lib/components.d.ts

@ -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 };

129
packages/princess-ui/lib/index.js

@ -1,5 +1,4 @@
import { defineComponent, openBlock, createElementBlock, toDisplayString, createTextVNode, createVNode, unref } from "vue";
var index_vue_vue_type_style_index_0_lang$2 = "";
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) {
@ -9,25 +8,106 @@ var _export_sfc = (sfc, props) => {
};
const _sfc_main$2 = defineComponent({
props: {
color: {
type: String,
required: true
},
aaa: {
type: String,
required: true
}
text: String
}
});
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", null, " sada" + toDisplayString(_ctx.color), 1);
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$1]]);
var PsButton = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render]]);
PsButton.name = "ps-button";
var index_vue_vue_type_style_index_0_lang$1 = "";
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) {
@ -42,20 +122,19 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
};
}
});
_sfc_main$1.name = "ps-fuck";
var index_vue_vue_type_style_index_0_lang = "";
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";
_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,
PsFuck: _sfc_main$1,
PsSend
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];
@ -65,4 +144,4 @@ function install(app) {
var index = {
install
};
export { PsButton, _sfc_main$1 as PsFuck, PsSend, index as default, install };
export { PsButton, _sfc_main$1 as PsCaptcha, _sfc_main as PsFuck, index as default, install };

2
packages/princess-ui/lib/index.umd.js

@ -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"}})});

16
packages/princess-ui/lib/send/index.js

@ -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
packages/princess-ui/lib/send/index.umd.js

@ -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
packages/princess-ui/lib/send/style.css

@ -1 +0,0 @@
div{color:gold}

2
packages/princess-ui/lib/style.css

@ -1 +1 @@
div{background-color:#639}div{color:red}div{color:green}div{color:gold}
div{color:green}

4
packages/theme-chalk/src/captcha.scss

@ -0,0 +1,4 @@
.ps-send{
color: blue;
cursor: pointer;
}

1
packages/theme-chalk/src/index.scss

@ -1,4 +1,5 @@
@import "./button.scss";
@import "./send.scss";
div{
color: rosybrown;
}
Loading…
Cancel
Save