@cynnie/ui-shadcn 0.1.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.
Files changed (114) hide show
  1. package/README.md +49 -0
  2. package/dist/Checkbox-DswwIgpU.js +38 -0
  3. package/dist/Checkbox-DswwIgpU.js.map +1 -0
  4. package/dist/DialogTitle-CCJNart2.js +107 -0
  5. package/dist/DialogTitle-CCJNart2.js.map +1 -0
  6. package/dist/Input-BQYIq9cS.js +24 -0
  7. package/dist/Input-BQYIq9cS.js.map +1 -0
  8. package/dist/Loader-DZyMmrI8.js +19 -0
  9. package/dist/Loader-DZyMmrI8.js.map +1 -0
  10. package/dist/ProButton-BQWpTTCy.js +84 -0
  11. package/dist/ProButton-BQWpTTCy.js.map +1 -0
  12. package/dist/ProCheckboxGroup-DX6c9gx-.js +71 -0
  13. package/dist/ProCheckboxGroup-DX6c9gx-.js.map +1 -0
  14. package/dist/ProConfirmButton-zcvp7NcN.js +175 -0
  15. package/dist/ProConfirmButton-zcvp7NcN.js.map +1 -0
  16. package/dist/ProDescriptions-B1znLzkY.js +45 -0
  17. package/dist/ProDescriptions-B1znLzkY.js.map +1 -0
  18. package/dist/ProFormBuilder-CsNShZ0y.js +1138 -0
  19. package/dist/ProFormBuilder-CsNShZ0y.js.map +1 -0
  20. package/dist/ProInput-D20F1Xx-.js +91 -0
  21. package/dist/ProInput-D20F1Xx-.js.map +1 -0
  22. package/dist/ProModal-DsIFQ8y5.js +109 -0
  23. package/dist/ProModal-DsIFQ8y5.js.map +1 -0
  24. package/dist/ProRadioGroup-CTxqLQjw.js +138 -0
  25. package/dist/ProRadioGroup-CTxqLQjw.js.map +1 -0
  26. package/dist/ProSelect-DT0zjDjT.js +90 -0
  27. package/dist/ProSelect-DT0zjDjT.js.map +1 -0
  28. package/dist/ProTable-CP1Mc52q.js +349 -0
  29. package/dist/ProTable-CP1Mc52q.js.map +1 -0
  30. package/dist/SelectValue-CWl9zUW3.js +163 -0
  31. package/dist/SelectValue-CWl9zUW3.js.map +1 -0
  32. package/dist/button-BQVT6mY3.js +60 -0
  33. package/dist/button-BQVT6mY3.js.map +1 -0
  34. package/dist/components/ProButton/ProCountdownButton.vue.d.ts +28 -0
  35. package/dist/components/ProButton/index.js +2 -0
  36. package/dist/components/ProButton/index.vue.d.ts +31 -0
  37. package/dist/components/ProCheckboxGroup/index.js +2 -0
  38. package/dist/components/ProCheckboxGroup/index.vue.d.ts +18 -0
  39. package/dist/components/ProConfirmButton/index.js +2 -0
  40. package/dist/components/ProConfirmButton/index.vue.d.ts +43 -0
  41. package/dist/components/ProDescriptions/index.js +2 -0
  42. package/dist/components/ProDescriptions/index.vue.d.ts +40 -0
  43. package/dist/components/ProFormBuilder/index.js +2 -0
  44. package/dist/components/ProFormBuilder/index.vue.d.ts +43 -0
  45. package/dist/components/ProInput/index.js +2 -0
  46. package/dist/components/ProInput/index.vue.d.ts +27 -0
  47. package/dist/components/ProModal/index.js +2 -0
  48. package/dist/components/ProModal/index.vue.d.ts +45 -0
  49. package/dist/components/ProRadioGroup/index.js +2 -0
  50. package/dist/components/ProRadioGroup/index.vue.d.ts +20 -0
  51. package/dist/components/ProSelect/index.js +2 -0
  52. package/dist/components/ProSelect/index.vue.d.ts +28 -0
  53. package/dist/components/ProTable/ProTableForm.vue.d.ts +91 -0
  54. package/dist/components/ProTable/index.js +2 -0
  55. package/dist/components/ProTable/index.vue.d.ts +36 -0
  56. package/dist/components/index.d.ts +12 -0
  57. package/dist/components/ui/alert/Alert.vue.d.ts +22 -0
  58. package/dist/components/ui/alert/index.d.ts +6 -0
  59. package/dist/components/ui/button/Button.vue.d.ts +27 -0
  60. package/dist/components/ui/button/index.d.ts +7 -0
  61. package/dist/components/ui/checkbox/Checkbox.vue.d.ts +11 -0
  62. package/dist/components/ui/checkbox/index.d.ts +1 -0
  63. package/dist/components/ui/dialog/Dialog.vue.d.ts +22 -0
  64. package/dist/components/ui/dialog/DialogClose.vue.d.ts +18 -0
  65. package/dist/components/ui/dialog/DialogContent.vue.d.ts +36 -0
  66. package/dist/components/ui/dialog/DialogDescription.vue.d.ts +22 -0
  67. package/dist/components/ui/dialog/DialogFooter.vue.d.ts +21 -0
  68. package/dist/components/ui/dialog/DialogHeader.vue.d.ts +21 -0
  69. package/dist/components/ui/dialog/DialogTitle.vue.d.ts +22 -0
  70. package/dist/components/ui/dialog/DialogTrigger.vue.d.ts +18 -0
  71. package/dist/components/ui/dialog/index.d.ts +8 -0
  72. package/dist/components/ui/index.d.ts +12 -0
  73. package/dist/components/ui/input/Input.vue.d.ts +13 -0
  74. package/dist/components/ui/input/index.d.ts +1 -0
  75. package/dist/components/ui/label/Label.vue.d.ts +24 -0
  76. package/dist/components/ui/label/index.d.ts +1 -0
  77. package/dist/components/ui/loader/Loader.vue.d.ts +6 -0
  78. package/dist/components/ui/loader/index.d.ts +1 -0
  79. package/dist/components/ui/popover/Popover.vue.d.ts +22 -0
  80. package/dist/components/ui/popover/PopoverContent.vue.d.ts +38 -0
  81. package/dist/components/ui/popover/PopoverTrigger.vue.d.ts +18 -0
  82. package/dist/components/ui/popover/index.d.ts +3 -0
  83. package/dist/components/ui/radio-group/RadioGroup.vue.d.ts +22 -0
  84. package/dist/components/ui/radio-group/RadioGroupItem.vue.d.ts +7 -0
  85. package/dist/components/ui/radio-group/index.d.ts +2 -0
  86. package/dist/components/ui/select/Select.vue.d.ts +19 -0
  87. package/dist/components/ui/select/SelectContent.vue.d.ts +32 -0
  88. package/dist/components/ui/select/SelectItem.vue.d.ts +22 -0
  89. package/dist/components/ui/select/SelectTrigger.vue.d.ts +21 -0
  90. package/dist/components/ui/select/SelectValue.vue.d.ts +21 -0
  91. package/dist/components/ui/select/index.d.ts +5 -0
  92. package/dist/components/ui/table/Table.vue.d.ts +21 -0
  93. package/dist/components/ui/table/TableBody.vue.d.ts +21 -0
  94. package/dist/components/ui/table/TableCell.vue.d.ts +21 -0
  95. package/dist/components/ui/table/TableHead.vue.d.ts +21 -0
  96. package/dist/components/ui/table/TableHeader.vue.d.ts +21 -0
  97. package/dist/components/ui/table/TableRow.vue.d.ts +21 -0
  98. package/dist/components/ui/table/index.d.ts +6 -0
  99. package/dist/components/ui/textarea/Textarea.vue.d.ts +13 -0
  100. package/dist/components/ui/textarea/index.d.ts +1 -0
  101. package/dist/index.d.ts +8 -0
  102. package/dist/index.js +65 -0
  103. package/dist/index.js.map +1 -0
  104. package/dist/lib/utils.d.ts +3 -0
  105. package/dist/openDialog-CVp3qAfm.js +95 -0
  106. package/dist/openDialog-CVp3qAfm.js.map +1 -0
  107. package/dist/utils/openDialog.d.ts +25 -0
  108. package/dist/utils/openDialog.js +2 -0
  109. package/dist/utils/uiMessage.d.ts +8 -0
  110. package/dist/utils-Dg1mr-yh.js +8 -0
  111. package/dist/utils-Dg1mr-yh.js.map +1 -0
  112. package/package.json +108 -0
  113. package/src/style.css +14 -0
  114. package/src/tailwind.preset.css +139 -0
@@ -0,0 +1,21 @@
1
+ import { HTMLAttributes } from 'vue';
2
+ type __VLS_Props = {
3
+ class?: HTMLAttributes["class"];
4
+ };
5
+ declare function __VLS_template(): {
6
+ attrs: Partial<{}>;
7
+ slots: {
8
+ default?(_: {}): any;
9
+ };
10
+ refs: {};
11
+ rootEl: HTMLTableCellElement;
12
+ };
13
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
14
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLTableCellElement>;
15
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
16
+ export default _default;
17
+ type __VLS_WithTemplateSlots<T, S> = T & {
18
+ new (): {
19
+ $slots: S;
20
+ };
21
+ };
@@ -0,0 +1,21 @@
1
+ import { HTMLAttributes } from 'vue';
2
+ type __VLS_Props = {
3
+ class?: HTMLAttributes["class"];
4
+ };
5
+ declare function __VLS_template(): {
6
+ attrs: Partial<{}>;
7
+ slots: {
8
+ default?(_: {}): any;
9
+ };
10
+ refs: {};
11
+ rootEl: HTMLTableCellElement;
12
+ };
13
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
14
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLTableCellElement>;
15
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
16
+ export default _default;
17
+ type __VLS_WithTemplateSlots<T, S> = T & {
18
+ new (): {
19
+ $slots: S;
20
+ };
21
+ };
@@ -0,0 +1,21 @@
1
+ import { HTMLAttributes } from 'vue';
2
+ type __VLS_Props = {
3
+ class?: HTMLAttributes["class"];
4
+ };
5
+ declare function __VLS_template(): {
6
+ attrs: Partial<{}>;
7
+ slots: {
8
+ default?(_: {}): any;
9
+ };
10
+ refs: {};
11
+ rootEl: HTMLTableSectionElement;
12
+ };
13
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
14
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLTableSectionElement>;
15
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
16
+ export default _default;
17
+ type __VLS_WithTemplateSlots<T, S> = T & {
18
+ new (): {
19
+ $slots: S;
20
+ };
21
+ };
@@ -0,0 +1,21 @@
1
+ import { HTMLAttributes } from 'vue';
2
+ type __VLS_Props = {
3
+ class?: HTMLAttributes["class"];
4
+ };
5
+ declare function __VLS_template(): {
6
+ attrs: Partial<{}>;
7
+ slots: {
8
+ default?(_: {}): any;
9
+ };
10
+ refs: {};
11
+ rootEl: HTMLTableRowElement;
12
+ };
13
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
14
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLTableRowElement>;
15
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
16
+ export default _default;
17
+ type __VLS_WithTemplateSlots<T, S> = T & {
18
+ new (): {
19
+ $slots: S;
20
+ };
21
+ };
@@ -0,0 +1,6 @@
1
+ export { default as Table } from './Table.vue';
2
+ export { default as TableBody } from './TableBody.vue';
3
+ export { default as TableCell } from './TableCell.vue';
4
+ export { default as TableHead } from './TableHead.vue';
5
+ export { default as TableHeader } from './TableHeader.vue';
6
+ export { default as TableRow } from './TableRow.vue';
@@ -0,0 +1,13 @@
1
+ import { HTMLAttributes } from 'vue';
2
+ type __VLS_Props = {
3
+ class?: HTMLAttributes["class"];
4
+ };
5
+ type __VLS_PublicProps = {
6
+ modelValue?: any;
7
+ } & __VLS_Props;
8
+ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
9
+ "update:modelValue": (value: any) => any;
10
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
11
+ "onUpdate:modelValue"?: (value: any) => any;
12
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLTextAreaElement>;
13
+ export default _default;
@@ -0,0 +1 @@
1
+ export { default as Textarea } from './Textarea.vue';
@@ -0,0 +1,8 @@
1
+ export { openDialog, renderDialogForm } from './utils/openDialog.js';
2
+ export { uiMessage, Toaster } from './utils/uiMessage.js';
3
+ export { createApis } from '@cynnie/ui-core';
4
+ export { useOptions } from '@cynnie/ui-core';
5
+ export { useDebounce, useThrottle, useAsyncLoading } from '@cynnie/ui-core';
6
+ export type { DictOption, UseOptionsOptions, PageApis, PromiseFn, CreateApisOptions, FormItem, FormRules, TableColumn, DialogOptions, DialogHandle, } from '@cynnie/ui-core';
7
+ export type { DescriptionItem } from './components/ProDescriptions/index.vue';
8
+ export { ProTable, ProTableForm, ProFormBuilder, ProButton, ProCountdownButton, ProInput, ProSelect, ProCheckboxGroup, ProRadioGroup, ProModal, ProConfirmButton, ProDescriptions, } from './components/index.js';
package/dist/index.js ADDED
@@ -0,0 +1,65 @@
1
+ import { t as Button_default } from "./button-BQVT6mY3.js";
2
+ import { t as ProFormBuilder_default } from "./ProFormBuilder-CsNShZ0y.js";
3
+ import { t as ProRadioGroup_default } from "./ProRadioGroup-CTxqLQjw.js";
4
+ import { t as ProConfirmButton_default } from "./ProConfirmButton-zcvp7NcN.js";
5
+ import { i as uiMessage, n as ProTableForm_default, r as Toaster, t as ProTable_default } from "./ProTable-CP1Mc52q.js";
6
+ import { n as renderDialogForm, t as openDialog } from "./openDialog-CVp3qAfm.js";
7
+ import { t as ProButton_default } from "./ProButton-BQWpTTCy.js";
8
+ import { t as ProInput_default } from "./ProInput-D20F1Xx-.js";
9
+ import { t as ProSelect_default } from "./ProSelect-DT0zjDjT.js";
10
+ import { t as ProCheckboxGroup_default } from "./ProCheckboxGroup-DX6c9gx-.js";
11
+ import { t as ProModal_default } from "./ProModal-DsIFQ8y5.js";
12
+ import { t as ProDescriptions_default } from "./ProDescriptions-B1znLzkY.js";
13
+ import { Fragment, createBlock, createCommentVNode, createElementBlock, createTextVNode, defineComponent, mergeProps, openBlock, ref, renderSlot, toDisplayString, unref, withCtx } from "vue";
14
+ import { createApis, useAsyncLoading, useDebounce, useOptions, useThrottle } from "@cynnie/ui-core";
15
+ var ProCountdownButton_default = /* @__PURE__ */ defineComponent({
16
+ name: "ProCountdownButton",
17
+ inheritAttrs: false,
18
+ __name: "ProCountdownButton",
19
+ props: {
20
+ seconds: { default: 60 },
21
+ countingText: { default: "{n}s 后重发" },
22
+ onClick: {}
23
+ },
24
+ setup(__props) {
25
+ const props = __props;
26
+ const remaining = ref(0);
27
+ let timer;
28
+ function stopTimer() {
29
+ if (timer) {
30
+ clearInterval(timer);
31
+ timer = void 0;
32
+ }
33
+ }
34
+ async function handleClick(...args) {
35
+ if (remaining.value > 0) return;
36
+ if (props.onClick) {
37
+ const result = props.onClick(...args);
38
+ if (result instanceof Promise) await result;
39
+ }
40
+ remaining.value = props.seconds;
41
+ timer = setInterval(() => {
42
+ remaining.value -= 1;
43
+ if (remaining.value <= 0) stopTimer();
44
+ }, 1e3);
45
+ }
46
+ return (_ctx, _cache) => {
47
+ return openBlock(), createBlock(unref(Button_default), mergeProps({
48
+ variant: "outline",
49
+ disabled: remaining.value > 0 || void 0
50
+ }, {
51
+ ..._ctx.$attrs,
52
+ class: void 0
53
+ }, {
54
+ class: _ctx.$attrs.class,
55
+ onClick: handleClick
56
+ }), {
57
+ default: withCtx(() => [remaining.value > 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(props.countingText.replace("{n}", String(remaining.value))), 1)], 64)) : renderSlot(_ctx.$slots, "default", { key: 1 })]),
58
+ _: 3
59
+ }, 16, ["disabled", "class"]);
60
+ };
61
+ }
62
+ });
63
+ export { ProButton_default as ProButton, ProCheckboxGroup_default as ProCheckboxGroup, ProConfirmButton_default as ProConfirmButton, ProCountdownButton_default as ProCountdownButton, ProDescriptions_default as ProDescriptions, ProFormBuilder_default as ProFormBuilder, ProInput_default as ProInput, ProModal_default as ProModal, ProRadioGroup_default as ProRadioGroup, ProSelect_default as ProSelect, ProTable_default as ProTable, ProTableForm_default as ProTableForm, Toaster, createApis, openDialog, renderDialogForm, uiMessage, useAsyncLoading, useDebounce, useOptions, useThrottle };
64
+
65
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["$attrs"],"sources":["../src/components/ProButton/ProCountdownButton.vue","../src/components/ProButton/ProCountdownButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ref } from \"vue\";\nimport { Button } from \"../ui/button\";\n\ndefineOptions({\n name: \"ProCountdownButton\",\n inheritAttrs: false,\n});\n\nconst props = withDefaults(\n defineProps<{\n /** 倒计时秒数 */\n seconds?: number;\n /** 倒计时期间按钮文案,{} 会替换为剩余秒数 */\n countingText?: string;\n /** 点击处理函数:返回 Promise 且 resolve 后才开始倒计时(适合发验证码接口) */\n onClick?: (...args: any[]) => any;\n }>(),\n {\n seconds: 60,\n countingText: \"{n}s 后重发\",\n },\n);\n\nconst remaining = ref(0);\nlet timer: ReturnType<typeof setInterval> | undefined;\n\nfunction stopTimer() {\n if (timer) {\n clearInterval(timer);\n timer = undefined;\n }\n}\n\nasync function handleClick(...args: any[]) {\n if (remaining.value > 0) return;\n\n if (props.onClick) {\n const result = props.onClick(...args);\n if (result instanceof Promise) await result;\n }\n\n remaining.value = props.seconds;\n timer = setInterval(() => {\n remaining.value -= 1;\n if (remaining.value <= 0) stopTimer();\n }, 1000);\n}\n</script>\n\n<template>\n <Button\n variant=\"outline\"\n :disabled=\"remaining > 0 || undefined\"\n v-bind=\"{ ...$attrs, class: undefined }\"\n :class=\"($attrs.class as any)\"\n @click=\"handleClick\"\n >\n <template v-if=\"remaining > 0\">{{\n props.countingText.replace(\"{n}\", String(remaining))\n }}</template>\n <slot v-else></slot>\n </Button>\n</template>\n","<script setup lang=\"ts\">\nimport { ref } from \"vue\";\nimport { Button } from \"../ui/button\";\n\ndefineOptions({\n name: \"ProCountdownButton\",\n inheritAttrs: false,\n});\n\nconst props = withDefaults(\n defineProps<{\n /** 倒计时秒数 */\n seconds?: number;\n /** 倒计时期间按钮文案,{} 会替换为剩余秒数 */\n countingText?: string;\n /** 点击处理函数:返回 Promise 且 resolve 后才开始倒计时(适合发验证码接口) */\n onClick?: (...args: any[]) => any;\n }>(),\n {\n seconds: 60,\n countingText: \"{n}s 后重发\",\n },\n);\n\nconst remaining = ref(0);\nlet timer: ReturnType<typeof setInterval> | undefined;\n\nfunction stopTimer() {\n if (timer) {\n clearInterval(timer);\n timer = undefined;\n }\n}\n\nasync function handleClick(...args: any[]) {\n if (remaining.value > 0) return;\n\n if (props.onClick) {\n const result = props.onClick(...args);\n if (result instanceof Promise) await result;\n }\n\n remaining.value = props.seconds;\n timer = setInterval(() => {\n remaining.value -= 1;\n if (remaining.value <= 0) stopTimer();\n }, 1000);\n}\n</script>\n\n<template>\n <Button\n variant=\"outline\"\n :disabled=\"remaining > 0 || undefined\"\n v-bind=\"{ ...$attrs, class: undefined }\"\n :class=\"($attrs.class as any)\"\n @click=\"handleClick\"\n >\n <template v-if=\"remaining > 0\">{{\n props.countingText.replace(\"{n}\", String(remaining))\n }}</template>\n <slot v-else></slot>\n </Button>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;ECSA,MAAM,QAAQ;EAed,MAAM,YAAY,IAAI,EAAE;EACxB,IAAI;EAEJ,SAAS,YAAY;AACnB,OAAI,OAAO;AACT,kBAAc,MAAM;AACpB,YAAQ,KAAA;;;EAIZ,eAAe,YAAY,GAAG,MAAa;AACzC,OAAI,UAAU,QAAQ,EAAG;AAEzB,OAAI,MAAM,SAAS;IACjB,MAAM,SAAS,MAAM,QAAQ,GAAG,KAAK;AACrC,QAAI,kBAAkB,QAAS,OAAM;;AAGvC,aAAU,QAAQ,MAAM;AACxB,WAAQ,kBAAkB;AACxB,cAAU,SAAS;AACnB,QAAI,UAAU,SAAS,EAAG,YAAW;MACpC,IAAK;;;uBAKR,YAWS,MAAA,eAAA,EAXT,WAWS;IAVP,SAAQ;IACP,UAAU,UAAA,QAAS,KAAQ,KAAA;;OACfA,KAAAA;IAAM,OAAS,KAAA;IAAS,EAAA;IACpC,OAAQA,KAAAA,OAAO;IACf,SAAO;;2BAIK,CAFG,UAAA,QAAS,KAAA,WAAA,EAAzB,mBAEa,UAAA,EAAA,KAAA,GAAA,EAAA,CAAA,gBAAA,gBADX,MAAM,aAAa,QAAO,OAAQ,OAAO,UAAA,MAAS,CAAA,CAAA,EAAA,EAAA,CAAA,EAAA,GAAA,IAEpD,WAAoB,KAAA,QAAA,WAAA,EAAA,KAAA,GAAA,CAAA,CAAA,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { ClassValue } from 'clsx';
2
+ /** shadcn 惯用的类名合并工具 */
3
+ export declare function cn(...inputs: ClassValue[]): string;
@@ -0,0 +1,95 @@
1
+ import { t as Button_default } from "./button-BQVT6mY3.js";
2
+ import { t as ProFormBuilder_default } from "./ProFormBuilder-CsNShZ0y.js";
3
+ import { a as Dialog_default, i as DialogContent_default, n as DialogHeader_default, r as DialogFooter_default, t as DialogTitle_default } from "./DialogTitle-CCJNart2.js";
4
+ import { t as Loader_default } from "./Loader-DZyMmrI8.js";
5
+ import { createApp, defineComponent, h, reactive, ref } from "vue";
6
+ var EMPTY_OBJ = Object.freeze({});
7
+ function openDialog(component, props = EMPTY_OBJ, modelProps = EMPTY_OBJ) {
8
+ const { methodKey = "submit", onSubmit, ...restProps } = props;
9
+ const open = ref(true);
10
+ const instance = ref();
11
+ const container = document.createElement("div");
12
+ container.setAttribute("data-snowui-dialog-container", "");
13
+ const loading = ref(false);
14
+ document.body.appendChild(container);
15
+ const reactiveModelProps = reactive(modelProps);
16
+ async function handleOk() {
17
+ loading.value = true;
18
+ try {
19
+ let result;
20
+ if (onSubmit) result = await onSubmit(instance.value);
21
+ else if (instance.value?.[methodKey]) result = await instance.value[methodKey]();
22
+ open.value = false;
23
+ reactiveModelProps.onOk?.(result);
24
+ } catch {} finally {
25
+ loading.value = false;
26
+ }
27
+ }
28
+ function unmount() {
29
+ app.unmount();
30
+ document.body.removeChild(container);
31
+ }
32
+ function watchClose() {
33
+ const stop = setInterval(() => {
34
+ if (!open.value) {
35
+ clearInterval(stop);
36
+ setTimeout(unmount, 250);
37
+ }
38
+ }, 100);
39
+ }
40
+ const app = createApp(defineComponent({ setup() {
41
+ return () => {
42
+ const title = typeof reactiveModelProps.title === "function" ? reactiveModelProps.title() : reactiveModelProps.title;
43
+ const widthStyle = reactiveModelProps.width != null ? {
44
+ width: typeof reactiveModelProps.width === "number" ? `${reactiveModelProps.width}px` : reactiveModelProps.width,
45
+ maxWidth: "calc(100% - 2rem)"
46
+ } : void 0;
47
+ return h(Dialog_default, {
48
+ open: open.value,
49
+ "onUpdate:open": (value) => open.value = value
50
+ }, { default: () => h(DialogContent_default, {
51
+ style: widthStyle,
52
+ onEscapeKeyDown: (event) => {
53
+ reactiveModelProps.onCancel?.(event);
54
+ },
55
+ onInteractOutside: (event) => {
56
+ reactiveModelProps.onCancel?.(event);
57
+ }
58
+ }, { default: () => [
59
+ h(DialogHeader_default, {}, () => h(DialogTitle_default, {}, { default: () => title })),
60
+ h("div", { class: "py-1" }, [h(component, {
61
+ ...restProps,
62
+ ref: instance
63
+ })]),
64
+ h(DialogFooter_default, { class: "gap-2" }, () => [h(Button_default, {
65
+ variant: "outline",
66
+ onClick: () => open.value = false
67
+ }, () => "取 消"), loading.value ? h(Button_default, { disabled: true }, () => [h(Loader_default, { class: "text-current" }), "确 定"]) : h(Button_default, { onClick: handleOk }, () => "确 定")])
68
+ ] }) });
69
+ };
70
+ } }));
71
+ app.mount(container);
72
+ watchClose();
73
+ function close() {
74
+ open.value = false;
75
+ }
76
+ return { close };
77
+ }
78
+ function renderDialogForm(formProps, modelProps = EMPTY_OBJ) {
79
+ const reactiveFormProps = reactive(formProps);
80
+ return openDialog({ setup(_, { expose }) {
81
+ const formInstance = ref();
82
+ expose({ async submit() {
83
+ await formInstance.value?.validate?.();
84
+ return reactiveFormProps.modelValue;
85
+ } });
86
+ const FormComp = ProFormBuilder_default;
87
+ return () => h(FormComp, {
88
+ ...reactiveFormProps,
89
+ ref: formInstance
90
+ });
91
+ } }, {}, modelProps);
92
+ }
93
+ export { renderDialogForm as n, openDialog as t };
94
+
95
+ //# sourceMappingURL=openDialog-CVp3qAfm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openDialog-CVp3qAfm.js","names":["result: any"],"sources":["../src/utils/openDialog.ts"],"sourcesContent":["import { type Component, h, createApp, reactive, ref, defineComponent } from \"vue\";\nimport { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, Button, Loader } from \"../components/ui/index.js\";\nimport ProFormBuilder from \"../components/ProFormBuilder/index.vue\";\nimport type { DialogHandle } from \"@cynnie/ui-core\";\n\n// 避免每次调用都创建新空对象\nconst EMPTY_OBJ = Object.freeze({});\n\n/** openDialog 的弹窗配置:与 antd / element 版的公共字段对齐(title / width / onOk / onCancel 等) */\ninterface ShadcnDialogProps extends Record<string, any> {\n title?: any;\n width?: string | number;\n onOk?: (result?: any) => any;\n onCancel?: (e?: any) => any;\n}\n\nexport function openDialog(\n component: Component,\n props: Record<string, any> = EMPTY_OBJ,\n modelProps: ShadcnDialogProps = EMPTY_OBJ,\n): DialogHandle {\n // 调用方可通过 props 传 methodKey / onSubmit 自定义确定按钮的行为:\n // - methodKey:内容组件暴露的方法名,默认 'submit'\n // - onSubmit:直接传函数(拿到内容组件实例),优先级高于 methodKey\n const { methodKey = \"submit\", onSubmit, ...restProps } = props;\n const open = ref(true);\n const instance = ref<Record<string, any>>();\n const container = document.createElement(\"div\");\n container.setAttribute(\"data-snowui-dialog-container\", \"\");\n const loading = ref(false);\n document.body.appendChild(container);\n\n // reactive 包一层:外部传 ref 的 title 等配置可动态响应\n const reactiveModelProps = reactive(modelProps);\n\n async function handleOk() {\n loading.value = true;\n try {\n let result: any;\n if (onSubmit) {\n result = await onSubmit(instance.value);\n } else if (instance.value?.[methodKey]) {\n result = await instance.value[methodKey]();\n }\n open.value = false;\n // 内容组件提交方法(或 onSubmit)的返回值交给 onOk\n reactiveModelProps.onOk?.(result);\n } catch {\n // 提交失败(校验不通过 / 请求报错)保持弹窗打开\n } finally {\n loading.value = false;\n }\n }\n\n function unmount() {\n app.unmount();\n document.body.removeChild(container);\n }\n\n // 关闭动画结束后再卸载\n function watchClose() {\n const stop = setInterval(() => {\n if (!open.value) {\n clearInterval(stop);\n setTimeout(unmount, 250);\n }\n }, 100);\n }\n\n const DialogWithFooter = defineComponent({\n setup() {\n return () => {\n const title =\n typeof reactiveModelProps.title === \"function\"\n ? (reactiveModelProps.title as any)()\n : reactiveModelProps.title;\n const widthStyle =\n reactiveModelProps.width != null\n ? {\n width:\n typeof reactiveModelProps.width === \"number\"\n ? `${reactiveModelProps.width}px`\n : reactiveModelProps.width,\n maxWidth: \"calc(100% - 2rem)\",\n }\n : undefined;\n return h(\n Dialog,\n { open: open.value, \"onUpdate:open\": (value: boolean) => (open.value = value) },\n {\n default: () =>\n h(\n DialogContent,\n {\n style: widthStyle,\n onEscapeKeyDown: (event: any) => {\n // ESC / 点遮罩关闭都走 onCancel,与 antd / element 版对齐\n reactiveModelProps.onCancel?.(event);\n },\n onInteractOutside: (event: any) => {\n reactiveModelProps.onCancel?.(event);\n },\n },\n {\n default: () => [\n h(DialogHeader, {}, () => h(DialogTitle, {}, { default: () => title })),\n h(\"div\", { class: \"py-1\" }, [h(component, { ...restProps, ref: instance })]),\n h(\n DialogFooter,\n { class: \"gap-2\" },\n () => [\n h(Button, { variant: \"outline\", onClick: () => (open.value = false) }, () => \"取 消\"),\n loading.value\n ? h(Button, { disabled: true }, () => [h(Loader, { class: \"text-current\" }), \"确 定\"])\n : h(Button, { onClick: handleOk }, () => \"确 定\"),\n ],\n ),\n ],\n },\n ),\n },\n );\n };\n },\n });\n\n const app = createApp(DialogWithFooter);\n app.mount(container);\n watchClose();\n\n // 返回 close 方法,调用方可编程式关闭弹窗\n function close() {\n open.value = false;\n }\n return { close };\n}\n\n/**\n * 命令式弹窗表单:一行代码弹出一个「确定时自动校验」的表单弹窗。\n *\n * @param formProps ProFormBuilder 的配置:formItems / rules / modelValue 等\n * @param modelProps 弹窗的配置(title / width / onOk 等)\n * @returns { close } 关闭弹窗\n *\n * @example\n * const { close } = renderDialogForm(\n * { formItems: [{ label: '姓名', key: 'name' }], rules: { name: [{ required: true }] } },\n * { title: '新增用户', onOk: (data) => console.log('提交', data) },\n * );\n */\nexport function renderDialogForm(formProps: Record<string, any>, modelProps: ShadcnDialogProps = EMPTY_OBJ): DialogHandle {\n const reactiveFormProps = reactive(formProps);\n return openDialog(\n {\n setup(_: any, { expose }: any) {\n const formInstance = ref();\n expose({\n // 点确定时先跑表单校验,通过后把表单数据交给 onOk\n async submit() {\n await formInstance.value?.validate?.();\n return reactiveFormProps.modelValue;\n },\n });\n // formProps 是运行时动态对象,断言绕开 h() 对 .vue 组件的严格 props 推断\n const FormComp = ProFormBuilder as unknown as Component;\n return () => h(FormComp, { ...reactiveFormProps, ref: formInstance });\n },\n },\n {},\n modelProps,\n );\n}\n"],"mappings":";;;;;AAMA,IAAM,YAAY,OAAO,OAAO,EAAE,CAAC;AAUnC,SAAgB,WACd,WACA,QAA6B,WAC7B,aAAgC,WAClB;CAId,MAAM,EAAE,YAAY,UAAU,UAAU,GAAG,cAAc;CACzD,MAAM,OAAO,IAAI,KAAK;CACtB,MAAM,WAAW,KAA0B;CAC3C,MAAM,YAAY,SAAS,cAAc,MAAM;AAC/C,WAAU,aAAa,gCAAgC,GAAG;CAC1D,MAAM,UAAU,IAAI,MAAM;AAC1B,UAAS,KAAK,YAAY,UAAU;CAGpC,MAAM,qBAAqB,SAAS,WAAW;CAE/C,eAAe,WAAW;AACxB,UAAQ,QAAQ;AAChB,MAAI;GACF,IAAIA;AACJ,OAAI,SACF,UAAS,MAAM,SAAS,SAAS,MAAM;YAC9B,SAAS,QAAQ,WAC1B,UAAS,MAAM,SAAS,MAAM,YAAY;AAE5C,QAAK,QAAQ;AAEb,sBAAmB,OAAO,OAAO;UAC3B,WAEE;AACR,WAAQ,QAAQ;;;CAIpB,SAAS,UAAU;AACjB,MAAI,SAAS;AACb,WAAS,KAAK,YAAY,UAAU;;CAItC,SAAS,aAAa;EACpB,MAAM,OAAO,kBAAkB;AAC7B,OAAI,CAAC,KAAK,OAAO;AACf,kBAAc,KAAK;AACnB,eAAW,SAAS,IAAI;;KAEzB,IAAI;;CA4DT,MAAM,MAAM,UAzDa,gBAAgB,EACvC,QAAQ;AACN,eAAa;GACX,MAAM,QACJ,OAAO,mBAAmB,UAAU,aAC/B,mBAAmB,OAAe,GACnC,mBAAmB;GACzB,MAAM,aACJ,mBAAmB,SAAS,OACxB;IACE,OACE,OAAO,mBAAmB,UAAU,WAChC,GAAG,mBAAmB,MAAM,MAC5B,mBAAmB;IACzB,UAAU;IACX,GACD,KAAA;AACN,UAAO,EACL,gBACA;IAAE,MAAM,KAAK;IAAO,kBAAkB,UAAoB,KAAK,QAAQ;IAAQ,EAC/E,EACE,eACE,EACE,uBACA;IACE,OAAO;IACP,kBAAkB,UAAe;AAE/B,wBAAmB,WAAW,MAAM;;IAEtC,oBAAoB,UAAe;AACjC,wBAAmB,WAAW,MAAM;;IAEvC,EACD,EACE,eAAe;IACb,EAAE,sBAAc,EAAE,QAAQ,EAAE,qBAAa,EAAE,EAAE,EAAE,eAAe,OAAO,CAAC,CAAC;IACvE,EAAE,OAAO,EAAE,OAAO,QAAQ,EAAE,CAAC,EAAE,WAAW;KAAE,GAAG;KAAW,KAAK;KAAU,CAAC,CAAC,CAAC;IAC5E,EACE,sBACA,EAAE,OAAO,SAAS,QACZ,CACJ,EAAE,gBAAQ;KAAE,SAAS;KAAW,eAAgB,KAAK,QAAQ;KAAQ,QAAQ,MAAM,EACnF,QAAQ,QACJ,EAAE,gBAAQ,EAAE,UAAU,MAAM,QAAQ,CAAC,EAAE,gBAAQ,EAAE,OAAO,gBAAgB,CAAC,EAAE,MAAM,CAAC,GAClF,EAAE,gBAAQ,EAAE,SAAS,UAAU,QAAQ,MAAM,CAClD,CACF;IACF,EACF,CACF,EACJ,CACF;;IAGN,CAAC,CAEqC;AACvC,KAAI,MAAM,UAAU;AACpB,aAAY;CAGZ,SAAS,QAAQ;AACf,OAAK,QAAQ;;AAEf,QAAO,EAAE,OAAO;;AAgBlB,SAAgB,iBAAiB,WAAgC,aAAgC,WAAyB;CACxH,MAAM,oBAAoB,SAAS,UAAU;AAC7C,QAAO,WACL,EACE,MAAM,GAAQ,EAAE,UAAe;EAC7B,MAAM,eAAe,KAAK;AAC1B,SAAO,EAEL,MAAM,SAAS;AACb,SAAM,aAAa,OAAO,YAAY;AACtC,UAAO,kBAAkB;KAE5B,CAAC;EAEF,MAAM,WAAW;AACjB,eAAa,EAAE,UAAU;GAAE,GAAG;GAAmB,KAAK;GAAc,CAAC;IAExE,EACD,EAAE,EACF,WACD"}
@@ -0,0 +1,25 @@
1
+ import { Component } from 'vue';
2
+ import { DialogHandle } from '@cynnie/ui-core';
3
+ /** openDialog 的弹窗配置:与 antd / element 版的公共字段对齐(title / width / onOk / onCancel 等) */
4
+ interface ShadcnDialogProps extends Record<string, any> {
5
+ title?: any;
6
+ width?: string | number;
7
+ onOk?: (result?: any) => any;
8
+ onCancel?: (e?: any) => any;
9
+ }
10
+ export declare function openDialog(component: Component, props?: Record<string, any>, modelProps?: ShadcnDialogProps): DialogHandle;
11
+ /**
12
+ * 命令式弹窗表单:一行代码弹出一个「确定时自动校验」的表单弹窗。
13
+ *
14
+ * @param formProps ProFormBuilder 的配置:formItems / rules / modelValue 等
15
+ * @param modelProps 弹窗的配置(title / width / onOk 等)
16
+ * @returns { close } 关闭弹窗
17
+ *
18
+ * @example
19
+ * const { close } = renderDialogForm(
20
+ * { formItems: [{ label: '姓名', key: 'name' }], rules: { name: [{ required: true }] } },
21
+ * { title: '新增用户', onOk: (data) => console.log('提交', data) },
22
+ * );
23
+ */
24
+ export declare function renderDialogForm(formProps: Record<string, any>, modelProps?: ShadcnDialogProps): DialogHandle;
25
+ export {};
@@ -0,0 +1,2 @@
1
+ import { n as renderDialogForm, t as openDialog } from "../openDialog-CVp3qAfm.js";
2
+ export { openDialog, renderDialogForm };
@@ -0,0 +1,8 @@
1
+ import { Toaster, toast } from 'vue-sonner';
2
+ export declare const uiMessage: {
3
+ success: (content: string) => any;
4
+ info: (content: string) => any;
5
+ error: (content: string) => any;
6
+ warning: (content: string) => any;
7
+ };
8
+ export { Toaster, toast };
@@ -0,0 +1,8 @@
1
+ import { clsx } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+ function cn(...inputs) {
4
+ return twMerge(clsx(inputs));
5
+ }
6
+ export { cn as t };
7
+
8
+ //# sourceMappingURL=utils-Dg1mr-yh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-Dg1mr-yh.js","names":[],"sources":["../src/lib/utils.ts"],"sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/** shadcn 惯用的类名合并工具 */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"],"mappings":";;AAIA,SAAgB,GAAG,GAAG,QAAsB;AAC1C,QAAO,QAAQ,KAAK,OAAO,CAAC"}
package/package.json ADDED
@@ -0,0 +1,108 @@
1
+ {
2
+ "name": "@cynnie/ui-shadcn",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "基于 shadcn-vue(reka-ui + Tailwind CSS v4)的 SnowUI 二次封装组件库,API 与 @cynnie/ui-antd / @cynnie/ui-element 对齐",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/snowbitx/ui.git",
10
+ "directory": "packages/ui-shadcn"
11
+ },
12
+ "main": "./dist/index.js",
13
+ "module": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.js"
19
+ },
20
+ "./style.css": "./src/style.css",
21
+ "./tailwind.preset.css": "./src/tailwind.preset.css",
22
+ "./components/ProTable": {
23
+ "types": "./dist/components/ProTable/index.vue.d.ts",
24
+ "import": "./dist/components/ProTable/index.js"
25
+ },
26
+ "./components/ProFormBuilder": {
27
+ "types": "./dist/components/ProFormBuilder/index.vue.d.ts",
28
+ "import": "./dist/components/ProFormBuilder/index.js"
29
+ },
30
+ "./utils/openDialog": {
31
+ "types": "./dist/utils/openDialog.d.ts",
32
+ "import": "./dist/utils/openDialog.js"
33
+ },
34
+ "./components/ProButton": {
35
+ "types": "./dist/components/ProButton/index.vue.d.ts",
36
+ "import": "./dist/components/ProButton/index.js"
37
+ },
38
+ "./components/ProInput": {
39
+ "types": "./dist/components/ProInput/index.vue.d.ts",
40
+ "import": "./dist/components/ProInput/index.js"
41
+ },
42
+ "./components/ProSelect": {
43
+ "types": "./dist/components/ProSelect/index.vue.d.ts",
44
+ "import": "./dist/components/ProSelect/index.js"
45
+ },
46
+ "./components/ProCheckboxGroup": {
47
+ "types": "./dist/components/ProCheckboxGroup/index.vue.d.ts",
48
+ "import": "./dist/components/ProCheckboxGroup/index.js"
49
+ },
50
+ "./components/ProRadioGroup": {
51
+ "types": "./dist/components/ProRadioGroup/index.vue.d.ts",
52
+ "import": "./dist/components/ProRadioGroup/index.js"
53
+ },
54
+ "./components/ProModal": {
55
+ "types": "./dist/components/ProModal/index.vue.d.ts",
56
+ "import": "./dist/components/ProModal/index.js"
57
+ },
58
+ "./components/ProConfirmButton": {
59
+ "types": "./dist/components/ProConfirmButton/index.vue.d.ts",
60
+ "import": "./dist/components/ProConfirmButton/index.js"
61
+ },
62
+ "./components/ProDescriptions": {
63
+ "types": "./dist/components/ProDescriptions/index.vue.d.ts",
64
+ "import": "./dist/components/ProDescriptions/index.js"
65
+ },
66
+ "./package.json": "./package.json"
67
+ },
68
+ "files": [
69
+ "dist",
70
+ "src/style.css",
71
+ "src/tailwind.preset.css"
72
+ ],
73
+ "publishConfig": {
74
+ "access": "public"
75
+ },
76
+ "sideEffects": false,
77
+ "peerDependencies": {
78
+ "tailwindcss": "^4.3.3",
79
+ "vue": "^3.5.17"
80
+ },
81
+ "dependencies": {
82
+ "class-variance-authority": "^0.7.1",
83
+ "clsx": "^2.1.1",
84
+ "lodash-es": "^4.17.21",
85
+ "lucide-vue-next": "^0.545.0",
86
+ "reka-ui": "^2.10.4",
87
+ "tailwind-merge": "^3.3.1",
88
+ "vue-sonner": "^2.0.9",
89
+ "@cynnie/ui-core": "^0.1.0"
90
+ },
91
+ "devDependencies": {
92
+ "@types/lodash-es": "^4.17.12",
93
+ "@vitejs/plugin-vue": "^6.0.0",
94
+ "@vitejs/plugin-vue-jsx": "^5.0.0",
95
+ "@vue/tsconfig": "^0.7.0",
96
+ "tailwindcss": "^4.3.3",
97
+ "tw-animate-css": "^1.4.0",
98
+ "vite": "npm:rolldown-vite@^7.3.1",
99
+ "vite-plugin-dts": "^4.5.4",
100
+ "vue": "^3.5.17",
101
+ "vue-tsc": "^2.2.10"
102
+ },
103
+ "scripts": {
104
+ "build": "vite build",
105
+ "format": "prettier --write src/",
106
+ "type-check": "vue-tsc --noEmit -p tsconfig.json"
107
+ }
108
+ }
package/src/style.css ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * SnowUI shadcn 版的全局样式(开箱即用入口):
3
+ * - Tailwind CSS v4(@tailwindcss/vite 插件编译,@import "tailwindcss")
4
+ * - tw-animate-css 提供 data-[state] 进出场动画工具类
5
+ * - 设计令牌与主题映射在同目录 tailwind.preset.css
6
+ *
7
+ * 使用方:`import "@cynnie/ui-shadcn/style.css"`。
8
+ * 已有自己的 Tailwind 入口、只要令牌的,用
9
+ * `@import "@cynnie/ui-shadcn/tailwind.preset.css"`。
10
+ * 与 antd / element 的 reset 样式互斥,切换 UI 模式时由使用方动态加载其一。
11
+ */
12
+ @import "tailwindcss";
13
+ @import "tw-animate-css";
14
+ @import "./tailwind.preset.css";
@@ -0,0 +1,139 @@
1
+ /**
2
+ * SnowUI shadcn 版的设计令牌与主题映射(不含 @import "tailwindcss"):
3
+ * - shadcn 设计令牌(CSS variables,语义色 primary / destructive / muted ...)
4
+ * - @theme inline 把 CSS variables 映射成 Tailwind 语义色工具类
5
+ * - @layer base 的全局 reset
6
+ *
7
+ * 使用方二选一:
8
+ * 1. 已有自己的 Tailwind 入口,只要 SnowUI 令牌:
9
+ * `@import "@cynnie/ui-shadcn/tailwind.preset.css";`
10
+ * 2. 想要开箱即用的完整样式:`import "@cynnie/ui-shadcn/style.css"`。
11
+ * 与 antd / element 的 reset 样式互斥,切换 UI 模式时由使用方动态加载其一。
12
+ */
13
+ @custom-variant dark (&:is(.dark *));
14
+
15
+ :root {
16
+ --radius: 0.625rem;
17
+ --background: oklch(1 0 0);
18
+ --foreground: oklch(0.141 0.005 285.823);
19
+ --card: oklch(1 0 0);
20
+ --card-foreground: oklch(0.141 0.005 285.823);
21
+ --popover: oklch(1 0 0);
22
+ --popover-foreground: oklch(0.141 0.005 285.823);
23
+ --primary: oklch(0.21 0.006 285.885);
24
+ --primary-foreground: oklch(0.985 0 0);
25
+ --secondary: oklch(0.967 0.001 286.375);
26
+ --secondary-foreground: oklch(0.21 0.006 285.885);
27
+ --muted: oklch(0.967 0.001 286.375);
28
+ --muted-foreground: oklch(0.552 0.016 285.938);
29
+ --accent: oklch(0.967 0.001 286.375);
30
+ --accent-foreground: oklch(0.21 0.006 285.885);
31
+ --destructive: oklch(0.577 0.245 27.325);
32
+ --border: oklch(0.92 0.004 286.32);
33
+ --input: oklch(0.92 0.004 286.32);
34
+ --ring: oklch(0.705 0.015 286.067);
35
+ --chart-1: oklch(0.646 0.222 41.116);
36
+ --chart-2: oklch(0.6 0.118 184.704);
37
+ --chart-3: oklch(0.398 0.07 227.392);
38
+ --chart-4: oklch(0.828 0.189 84.429);
39
+ --chart-5: oklch(0.769 0.188 70.08);
40
+ --sidebar: oklch(0.985 0 0);
41
+ --sidebar-foreground: oklch(0.141 0.005 285.823);
42
+ --sidebar-primary: oklch(0.21 0.006 285.885);
43
+ --sidebar-primary-foreground: oklch(0.985 0 0);
44
+ --sidebar-accent: oklch(0.967 0.001 286.375);
45
+ --sidebar-accent-foreground: oklch(0.21 0.006 285.885);
46
+ --sidebar-border: oklch(0.92 0.004 286.32);
47
+ --sidebar-ring: oklch(0.705 0.015 286.067);
48
+ }
49
+
50
+ .dark {
51
+ --background: oklch(0.141 0.005 285.823);
52
+ --foreground: oklch(0.985 0 0);
53
+ --card: oklch(0.21 0.006 285.885);
54
+ --card-foreground: oklch(0.985 0 0);
55
+ --popover: oklch(0.21 0.006 285.885);
56
+ --popover-foreground: oklch(0.985 0 0);
57
+ --primary: oklch(0.92 0.004 286.32);
58
+ --primary-foreground: oklch(0.21 0.006 285.885);
59
+ --secondary: oklch(0.274 0.006 286.033);
60
+ --secondary-foreground: oklch(0.985 0 0);
61
+ --muted: oklch(0.274 0.006 286.033);
62
+ --muted-foreground: oklch(0.705 0.015 286.067);
63
+ --accent: oklch(0.274 0.006 286.033);
64
+ --accent-foreground: oklch(0.985 0 0);
65
+ --destructive: oklch(0.704 0.191 22.216);
66
+ --border: oklch(1 0 0 / 10%);
67
+ --input: oklch(1 0 0 / 15%);
68
+ --ring: oklch(0.552 0.016 285.938);
69
+ --chart-1: oklch(0.488 0.243 264.376);
70
+ --chart-2: oklch(0.696 0.17 162.48);
71
+ --chart-3: oklch(0.769 0.188 70.08);
72
+ --chart-4: oklch(0.627 0.265 303.9);
73
+ --chart-5: oklch(0.645 0.246 16.439);
74
+ --sidebar: oklch(0.21 0.006 285.885);
75
+ --sidebar-foreground: oklch(0.985 0 0);
76
+ --sidebar-primary: oklch(0.488 0.243 264.376);
77
+ --sidebar-primary-foreground: oklch(0.985 0 0);
78
+ --sidebar-accent: oklch(0.274 0.006 286.033);
79
+ --sidebar-accent-foreground: oklch(0.985 0 0);
80
+ --sidebar-border: oklch(1 0 0 / 10%);
81
+ --sidebar-ring: oklch(0.552 0.016 285.938);
82
+ }
83
+
84
+ @theme inline {
85
+ --radius-sm: calc(var(--radius) - 4px);
86
+ --radius-md: calc(var(--radius) - 2px);
87
+ --radius-lg: var(--radius);
88
+ --radius-xl: calc(var(--radius) + 4px);
89
+ --color-background: var(--background);
90
+ --color-foreground: var(--foreground);
91
+ --color-card: var(--card);
92
+ --color-card-foreground: var(--card-foreground);
93
+ --color-popover: var(--popover);
94
+ --color-popover-foreground: var(--popover-foreground);
95
+ --color-primary: var(--primary);
96
+ --color-primary-foreground: var(--primary-foreground);
97
+ --color-secondary: var(--secondary);
98
+ --color-secondary-foreground: var(--secondary-foreground);
99
+ --color-muted: var(--muted);
100
+ --color-muted-foreground: var(--muted-foreground);
101
+ --color-accent: var(--accent);
102
+ --color-accent-foreground: var(--accent-foreground);
103
+ --color-destructive: var(--destructive);
104
+ --color-border: var(--border);
105
+ --color-input: var(--input);
106
+ --color-ring: var(--ring);
107
+ --color-chart-1: var(--chart-1);
108
+ --color-chart-2: var(--chart-2);
109
+ --color-chart-3: var(--chart-3);
110
+ --color-chart-4: var(--chart-4);
111
+ --color-chart-5: var(--chart-5);
112
+ --color-sidebar: var(--sidebar);
113
+ --color-sidebar-foreground: var(--sidebar-foreground);
114
+ --color-sidebar-primary: var(--sidebar-primary);
115
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
116
+ --color-sidebar-accent: var(--sidebar-accent);
117
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
118
+ --color-sidebar-border: var(--sidebar-border);
119
+ --color-sidebar-ring: var(--sidebar-ring);
120
+ }
121
+
122
+ @layer base {
123
+ * {
124
+ @apply border-border outline-ring/50;
125
+ }
126
+ body {
127
+ @apply bg-background text-foreground;
128
+ }
129
+ }
130
+
131
+ /* 独立 createApp 挂载的命令式弹窗容器:避免挂在文档流里产生滚动条位移 */
132
+ [data-snowui-dialog-container] {
133
+ position: fixed;
134
+ top: 0;
135
+ left: 0;
136
+ width: 0;
137
+ height: 0;
138
+ overflow: visible;
139
+ }