fantasia-ui 0.2.50 → 0.2.52

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.
@@ -37,7 +37,7 @@ var __async = (__this, __arguments, generator) => {
37
37
  step((generator = generator.apply(__this, __arguments)).next());
38
38
  });
39
39
  };
40
- import { defineComponent, computed, createElementBlock, openBlock, normalizeStyle, unref, renderSlot, normalizeClass, createCommentVNode, Fragment, renderList, createElementVNode, toDisplayString, ref, watch, createVNode, withDirectives, Transition, withCtx, vShow, mergeModels, useModel, inject, createBlock, resolveDynamicComponent, nextTick, onUnmounted, Teleport, withModifiers, withKeys, isRef, vModelText, createTextVNode, TransitionGroup, useSlots, provide, onMounted, readonly, onBeforeUnmount, reactive, toRefs, createStaticVNode, render, h } from "vue";
40
+ import { defineComponent, computed, createElementBlock, openBlock, normalizeStyle, unref, renderSlot, normalizeClass, createCommentVNode, Fragment, renderList, createElementVNode, toDisplayString, ref, watch, createVNode, withDirectives, Transition, withCtx, vShow, mergeModels, useModel, inject, createBlock, resolveDynamicComponent, nextTick, onUnmounted, Teleport, withModifiers, withKeys, isRef, vModelText, createTextVNode, TransitionGroup, useSlots, provide, onMounted, readonly, onBeforeUnmount, reactive, toRefs, createStaticVNode, h, render } from "vue";
41
41
  import { CloseCircleOutline, EyeOutline, EyeOffOutline, StarOutline, StarHalf, Star, ChevronDownOutline, ChevronBackOutline, EllipsisHorizontal, ChevronForwardOutline, CloseCircle, Close, Person, InformationCircleOutline, WarningOutline, AlertCircleOutline, CheckmarkCircleOutline, CloudUpload, DocumentOutline, RemoveOutline, AddOutline, ChevronUpOutline, InformationCircle, AlertCircle, CheckmarkCircle, Warning } from "@vicons/ionicons5";
42
42
  import { useEventListener } from "@vueuse/core";
43
43
  const _sfc_main$Q = /* @__PURE__ */ defineComponent({
@@ -4569,6 +4569,131 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
4569
4569
  };
4570
4570
  }
4571
4571
  });
4572
+ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4573
+ __proto__: null,
4574
+ FAffix,
4575
+ FAlert,
4576
+ FAvatar,
4577
+ FBadge,
4578
+ FBreadcrumb,
4579
+ FButton,
4580
+ FButtonGroup,
4581
+ FCard,
4582
+ FCheckbox,
4583
+ FCol,
4584
+ FCollapse: _sfc_main$d,
4585
+ FCollapseItem: _sfc_main$c,
4586
+ FColorPicker: _sfc_main$b,
4587
+ FContainer,
4588
+ FDialog: _sfc_main$2,
4589
+ FDivider,
4590
+ FDropdown,
4591
+ FEditor,
4592
+ FEmpty: _sfc_main$a,
4593
+ FForm,
4594
+ FFormItem,
4595
+ FIcon,
4596
+ FImage,
4597
+ FInput,
4598
+ FInputNumber,
4599
+ FLink,
4600
+ FLoading,
4601
+ FMarquee,
4602
+ FMask,
4603
+ FPagination,
4604
+ FProgress,
4605
+ FRadio,
4606
+ FRadioGroup,
4607
+ FRate,
4608
+ FResult,
4609
+ FRow,
4610
+ FScrollbar: _sfc_main$8,
4611
+ FSelect,
4612
+ FSlider: _sfc_main$9,
4613
+ FSpace,
4614
+ FSteps,
4615
+ FSwitch,
4616
+ FTable,
4617
+ FTabs,
4618
+ FTag,
4619
+ FText,
4620
+ FTooltip,
4621
+ FTransfer,
4622
+ FTreeSelect,
4623
+ FTypography,
4624
+ FUpload
4625
+ }, Symbol.toStringTag, { value: "Module" }));
4626
+ const showDialog = (options) => {
4627
+ return new Promise((resolve) => {
4628
+ const container = document.createElement("div");
4629
+ document.body.appendChild(container);
4630
+ const visible = ref(true);
4631
+ const handleConfirm = () => {
4632
+ cleanup();
4633
+ resolve(true);
4634
+ };
4635
+ const handleCancel = () => {
4636
+ cleanup();
4637
+ resolve(false);
4638
+ };
4639
+ const cleanup = () => {
4640
+ visible.value = false;
4641
+ render(null, container);
4642
+ document.body.removeChild(container);
4643
+ };
4644
+ const vnode = h(_sfc_main$2, __spreadValues({
4645
+ modelValue: visible.value,
4646
+ "onUpdate:modelValue": (val) => {
4647
+ visible.value = val;
4648
+ if (!val) {
4649
+ cleanup();
4650
+ }
4651
+ },
4652
+ onConfirm: handleConfirm,
4653
+ onCancel: handleCancel
4654
+ }, options));
4655
+ render(vnode, container);
4656
+ });
4657
+ };
4658
+ const confirm = (content, title = "确认") => {
4659
+ return showDialog({
4660
+ title,
4661
+ content,
4662
+ type: "confirm",
4663
+ showCancel: true
4664
+ });
4665
+ };
4666
+ const alert = (content, title = "提示", type = "info") => {
4667
+ return showDialog({
4668
+ title,
4669
+ content,
4670
+ type,
4671
+ showCancel: false,
4672
+ confirmText: "知道了"
4673
+ });
4674
+ };
4675
+ const success = (content, title = "成功") => {
4676
+ return alert(content, title, "success");
4677
+ };
4678
+ const warning = (content, title = "警告") => {
4679
+ return alert(content, title, "warning");
4680
+ };
4681
+ const error = (content, title = "错误") => {
4682
+ return alert(content, title, "error");
4683
+ };
4684
+ const info = (content, title = "提示") => {
4685
+ return alert(content, title, "info");
4686
+ };
4687
+ const FDialog = (options) => {
4688
+ return showDialog(options);
4689
+ };
4690
+ FDialog.showDialog = showDialog;
4691
+ FDialog.confirm = confirm;
4692
+ FDialog.alert = alert;
4693
+ FDialog.success = success;
4694
+ FDialog.warning = warning;
4695
+ FDialog.error = error;
4696
+ FDialog.info = info;
4572
4697
  const _hoisted_1$1 = { class: "f-message__content" };
4573
4698
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
4574
4699
  __name: "FMessage",
@@ -4672,6 +4797,78 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
4672
4797
  }
4673
4798
  });
4674
4799
  const FMessageComp = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-97556afa"]]);
4800
+ const GAP$1 = 16;
4801
+ const BASE_OFFSET$1 = 20;
4802
+ let seed$1 = 0;
4803
+ const instances = [];
4804
+ const normalizeOptions$1 = (options) => {
4805
+ return typeof options === "string" ? { message: options } : options;
4806
+ };
4807
+ const repositionAll = () => {
4808
+ let offset = BASE_OFFSET$1;
4809
+ instances.forEach((item) => {
4810
+ const vm = item.vnode.component;
4811
+ if (vm) {
4812
+ vm.props.offset = offset;
4813
+ }
4814
+ offset += item.height + GAP$1;
4815
+ });
4816
+ };
4817
+ const removeInstance$1 = (id) => {
4818
+ const index = instances.findIndex((item) => item.id === id);
4819
+ if (index === -1) return;
4820
+ const { container } = instances[index];
4821
+ render(null, container);
4822
+ container.remove();
4823
+ instances.splice(index, 1);
4824
+ repositionAll();
4825
+ };
4826
+ const createInstance$1 = (options) => {
4827
+ var _a;
4828
+ const id = seed$1++;
4829
+ const container = document.createElement("div");
4830
+ const offset = instances.length === 0 ? BASE_OFFSET$1 : (() => {
4831
+ var _a2;
4832
+ const last = instances[instances.length - 1];
4833
+ return ((_a2 = last.vnode.component) == null ? void 0 : _a2.props.offset) + last.height + GAP$1;
4834
+ })();
4835
+ const vnode = createVNode(FMessageComp, __spreadProps(__spreadValues({}, options), {
4836
+ offset,
4837
+ onClose: () => {
4838
+ var _a2;
4839
+ (_a2 = options.onClose) == null ? void 0 : _a2.call(options);
4840
+ },
4841
+ onDestroy: () => {
4842
+ removeInstance$1(id);
4843
+ }
4844
+ }));
4845
+ render(vnode, container);
4846
+ document.body.appendChild(container);
4847
+ const el = vnode.el;
4848
+ const height = (_a = el == null ? void 0 : el.offsetHeight) != null ? _a : 44;
4849
+ instances.push({ id, vnode, container, height });
4850
+ return {
4851
+ id,
4852
+ close: () => {
4853
+ var _a2, _b, _c;
4854
+ (_c = (_b = (_a2 = vnode.component) == null ? void 0 : _a2.exposed) == null ? void 0 : _b.close) == null ? void 0 : _c.call(_b);
4855
+ }
4856
+ };
4857
+ };
4858
+ const FMessage = (options) => {
4859
+ return createInstance$1(normalizeOptions$1(options));
4860
+ };
4861
+ const withType$1 = (type) => (options) => createInstance$1(__spreadProps(__spreadValues({}, normalizeOptions$1(options)), { type }));
4862
+ FMessage.info = withType$1("info");
4863
+ FMessage.success = withType$1("success");
4864
+ FMessage.warning = withType$1("warning");
4865
+ FMessage.failed = withType$1("failed");
4866
+ FMessage.closeAll = () => {
4867
+ [...instances].forEach((item) => {
4868
+ var _a, _b, _c;
4869
+ (_c = (_b = (_a = item.vnode.component) == null ? void 0 : _a.exposed) == null ? void 0 : _b.close) == null ? void 0 : _c.call(_b);
4870
+ });
4871
+ };
4675
4872
  const _hoisted_1 = { class: "f-notification__body" };
4676
4873
  const _hoisted_2 = {
4677
4874
  key: 0,
@@ -4790,78 +4987,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4790
4987
  }
4791
4988
  });
4792
4989
  const FNotificationComp = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0a7315d6"]]);
4793
- const GAP$1 = 16;
4794
- const BASE_OFFSET$1 = 20;
4795
- let seed$1 = 0;
4796
- const instances = [];
4797
- const normalizeOptions$1 = (options) => {
4798
- return typeof options === "string" ? { message: options } : options;
4799
- };
4800
- const repositionAll = () => {
4801
- let offset = BASE_OFFSET$1;
4802
- instances.forEach((item) => {
4803
- const vm = item.vnode.component;
4804
- if (vm) {
4805
- vm.props.offset = offset;
4806
- }
4807
- offset += item.height + GAP$1;
4808
- });
4809
- };
4810
- const removeInstance$1 = (id) => {
4811
- const index = instances.findIndex((item) => item.id === id);
4812
- if (index === -1) return;
4813
- const { container } = instances[index];
4814
- render(null, container);
4815
- container.remove();
4816
- instances.splice(index, 1);
4817
- repositionAll();
4818
- };
4819
- const createInstance$1 = (options) => {
4820
- var _a;
4821
- const id = seed$1++;
4822
- const container = document.createElement("div");
4823
- const offset = instances.length === 0 ? BASE_OFFSET$1 : (() => {
4824
- var _a2;
4825
- const last = instances[instances.length - 1];
4826
- return ((_a2 = last.vnode.component) == null ? void 0 : _a2.props.offset) + last.height + GAP$1;
4827
- })();
4828
- const vnode = createVNode(FMessageComp, __spreadProps(__spreadValues({}, options), {
4829
- offset,
4830
- onClose: () => {
4831
- var _a2;
4832
- (_a2 = options.onClose) == null ? void 0 : _a2.call(options);
4833
- },
4834
- onDestroy: () => {
4835
- removeInstance$1(id);
4836
- }
4837
- }));
4838
- render(vnode, container);
4839
- document.body.appendChild(container);
4840
- const el = vnode.el;
4841
- const height = (_a = el == null ? void 0 : el.offsetHeight) != null ? _a : 44;
4842
- instances.push({ id, vnode, container, height });
4843
- return {
4844
- id,
4845
- close: () => {
4846
- var _a2, _b, _c;
4847
- (_c = (_b = (_a2 = vnode.component) == null ? void 0 : _a2.exposed) == null ? void 0 : _b.close) == null ? void 0 : _c.call(_b);
4848
- }
4849
- };
4850
- };
4851
- const FMessage = (options) => {
4852
- return createInstance$1(normalizeOptions$1(options));
4853
- };
4854
- const withType$1 = (type) => (options) => createInstance$1(__spreadProps(__spreadValues({}, normalizeOptions$1(options)), { type }));
4855
- FMessage.info = withType$1("info");
4856
- FMessage.success = withType$1("success");
4857
- FMessage.warning = withType$1("warning");
4858
- FMessage.failed = withType$1("failed");
4859
- FMessage.closeAll = () => {
4860
- [...instances].forEach((item) => {
4861
- var _a, _b, _c;
4862
- (_c = (_b = (_a = item.vnode.component) == null ? void 0 : _a.exposed) == null ? void 0 : _b.close) == null ? void 0 : _c.call(_b);
4863
- });
4864
- };
4865
4990
  const GAP = 16;
4866
4991
  const BASE_OFFSET = 20;
4867
4992
  let seed = 0;
@@ -4950,139 +5075,11 @@ FNotification.closeAll = (position) => {
4950
5075
  });
4951
5076
  });
4952
5077
  };
4953
- const showDialog = (options) => {
4954
- return new Promise((resolve) => {
4955
- const container = document.createElement("div");
4956
- document.body.appendChild(container);
4957
- const visible = ref(true);
4958
- const handleConfirm = () => {
4959
- cleanup();
4960
- resolve(true);
4961
- };
4962
- const handleCancel = () => {
4963
- cleanup();
4964
- resolve(false);
4965
- };
4966
- const cleanup = () => {
4967
- visible.value = false;
4968
- render(null, container);
4969
- document.body.removeChild(container);
4970
- };
4971
- const vnode = h(_sfc_main$2, __spreadValues({
4972
- modelValue: visible.value,
4973
- "onUpdate:modelValue": (val) => {
4974
- visible.value = val;
4975
- if (!val) {
4976
- cleanup();
4977
- }
4978
- },
4979
- onConfirm: handleConfirm,
4980
- onCancel: handleCancel
4981
- }, options));
4982
- render(vnode, container);
4983
- });
4984
- };
4985
- const confirm = (content, title = "确认") => {
4986
- return showDialog({
4987
- title,
4988
- content,
4989
- type: "confirm",
4990
- showCancel: true
4991
- });
4992
- };
4993
- const alert = (content, title = "提示", type = "info") => {
4994
- return showDialog({
4995
- title,
4996
- content,
4997
- type,
4998
- showCancel: false,
4999
- confirmText: "知道了"
5000
- });
5001
- };
5002
- const success = (content, title = "成功") => {
5003
- return alert(content, title, "success");
5004
- };
5005
- const warning = (content, title = "警告") => {
5006
- return alert(content, title, "warning");
5007
- };
5008
- const error = (content, title = "错误") => {
5009
- return alert(content, title, "error");
5010
- };
5011
- const info = (content, title = "提示") => {
5012
- return alert(content, title, "info");
5013
- };
5014
- const FDialog = (options) => {
5015
- return showDialog(options);
5016
- };
5017
- FDialog.showDialog = showDialog;
5018
- FDialog.confirm = confirm;
5019
- FDialog.alert = alert;
5020
- FDialog.success = success;
5021
- FDialog.warning = warning;
5022
- FDialog.error = error;
5023
- FDialog.info = info;
5024
- const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5025
- __proto__: null,
5026
- FAffix,
5027
- FAlert,
5028
- FAvatar,
5029
- FBadge,
5030
- FBreadcrumb,
5031
- FButton,
5032
- FButtonGroup,
5033
- FCard,
5034
- FCheckbox,
5035
- FCol,
5036
- FCollapse: _sfc_main$d,
5037
- FCollapseItem: _sfc_main$c,
5038
- FColorPicker: _sfc_main$b,
5039
- FContainer,
5040
- FDialog,
5041
- FDialogComponent: _sfc_main$2,
5042
- FDivider,
5043
- FDropdown,
5044
- FEditor,
5045
- FEmpty: _sfc_main$a,
5046
- FForm,
5047
- FFormItem,
5048
- FIcon,
5049
- FImage,
5050
- FInput,
5051
- FInputNumber,
5052
- FLink,
5053
- FLoading,
5054
- FMarquee,
5055
- FMask,
5056
- FMessage,
5057
- FMessageComponent: FMessageComp,
5058
- FNotification,
5059
- FNotificationComponent: FNotificationComp,
5060
- FPagination,
5061
- FProgress,
5062
- FRadio,
5063
- FRadioGroup,
5064
- FRate,
5065
- FResult,
5066
- FRow,
5067
- FScrollbar: _sfc_main$8,
5068
- FSelect,
5069
- FSlider: _sfc_main$9,
5070
- FSpace,
5071
- FSteps,
5072
- FSwitch,
5073
- FTable,
5074
- FTabs,
5075
- FTag,
5076
- FText,
5077
- FTooltip,
5078
- FTransfer,
5079
- FTreeSelect,
5080
- FTypography,
5081
- FUpload
5082
- }, Symbol.toStringTag, { value: "Module" }));
5083
5078
  const install = (app) => {
5084
5079
  Object.entries(components).forEach(([name, component]) => {
5085
- app.component(name, component);
5080
+ if (name.startsWith("F")) {
5081
+ app.component(name, component);
5082
+ }
5086
5083
  });
5087
5084
  };
5088
5085
  export {
@@ -5100,8 +5097,8 @@ export {
5100
5097
  _sfc_main$c as FCollapseItem,
5101
5098
  _sfc_main$b as FColorPicker,
5102
5099
  FContainer,
5103
- FDialog,
5104
- _sfc_main$2 as FDialogComponent,
5100
+ _sfc_main$2 as FDialog,
5101
+ FDialog as FDialogBox,
5105
5102
  FDivider,
5106
5103
  FDropdown,
5107
5104
  FEditor,
@@ -5117,9 +5114,7 @@ export {
5117
5114
  FMarquee,
5118
5115
  FMask,
5119
5116
  FMessage,
5120
- FMessageComp as FMessageComponent,
5121
5117
  FNotification,
5122
- FNotificationComp as FNotificationComponent,
5123
5118
  FPagination,
5124
5119
  FProgress,
5125
5120
  FRadio,
@@ -4570,6 +4570,131 @@ var __async = (__this, __arguments, generator) => {
4570
4570
  };
4571
4571
  }
4572
4572
  });
4573
+ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4574
+ __proto__: null,
4575
+ FAffix,
4576
+ FAlert,
4577
+ FAvatar,
4578
+ FBadge,
4579
+ FBreadcrumb,
4580
+ FButton,
4581
+ FButtonGroup,
4582
+ FCard,
4583
+ FCheckbox,
4584
+ FCol,
4585
+ FCollapse: _sfc_main$d,
4586
+ FCollapseItem: _sfc_main$c,
4587
+ FColorPicker: _sfc_main$b,
4588
+ FContainer,
4589
+ FDialog: _sfc_main$2,
4590
+ FDivider,
4591
+ FDropdown,
4592
+ FEditor,
4593
+ FEmpty: _sfc_main$a,
4594
+ FForm,
4595
+ FFormItem,
4596
+ FIcon,
4597
+ FImage,
4598
+ FInput,
4599
+ FInputNumber,
4600
+ FLink,
4601
+ FLoading,
4602
+ FMarquee,
4603
+ FMask,
4604
+ FPagination,
4605
+ FProgress,
4606
+ FRadio,
4607
+ FRadioGroup,
4608
+ FRate,
4609
+ FResult,
4610
+ FRow,
4611
+ FScrollbar: _sfc_main$8,
4612
+ FSelect,
4613
+ FSlider: _sfc_main$9,
4614
+ FSpace,
4615
+ FSteps,
4616
+ FSwitch,
4617
+ FTable,
4618
+ FTabs,
4619
+ FTag,
4620
+ FText,
4621
+ FTooltip,
4622
+ FTransfer,
4623
+ FTreeSelect,
4624
+ FTypography,
4625
+ FUpload
4626
+ }, Symbol.toStringTag, { value: "Module" }));
4627
+ const showDialog = (options) => {
4628
+ return new Promise((resolve) => {
4629
+ const container = document.createElement("div");
4630
+ document.body.appendChild(container);
4631
+ const visible = vue.ref(true);
4632
+ const handleConfirm = () => {
4633
+ cleanup();
4634
+ resolve(true);
4635
+ };
4636
+ const handleCancel = () => {
4637
+ cleanup();
4638
+ resolve(false);
4639
+ };
4640
+ const cleanup = () => {
4641
+ visible.value = false;
4642
+ vue.render(null, container);
4643
+ document.body.removeChild(container);
4644
+ };
4645
+ const vnode = vue.h(_sfc_main$2, __spreadValues({
4646
+ modelValue: visible.value,
4647
+ "onUpdate:modelValue": (val) => {
4648
+ visible.value = val;
4649
+ if (!val) {
4650
+ cleanup();
4651
+ }
4652
+ },
4653
+ onConfirm: handleConfirm,
4654
+ onCancel: handleCancel
4655
+ }, options));
4656
+ vue.render(vnode, container);
4657
+ });
4658
+ };
4659
+ const confirm = (content, title = "确认") => {
4660
+ return showDialog({
4661
+ title,
4662
+ content,
4663
+ type: "confirm",
4664
+ showCancel: true
4665
+ });
4666
+ };
4667
+ const alert = (content, title = "提示", type = "info") => {
4668
+ return showDialog({
4669
+ title,
4670
+ content,
4671
+ type,
4672
+ showCancel: false,
4673
+ confirmText: "知道了"
4674
+ });
4675
+ };
4676
+ const success = (content, title = "成功") => {
4677
+ return alert(content, title, "success");
4678
+ };
4679
+ const warning = (content, title = "警告") => {
4680
+ return alert(content, title, "warning");
4681
+ };
4682
+ const error = (content, title = "错误") => {
4683
+ return alert(content, title, "error");
4684
+ };
4685
+ const info = (content, title = "提示") => {
4686
+ return alert(content, title, "info");
4687
+ };
4688
+ const FDialog = (options) => {
4689
+ return showDialog(options);
4690
+ };
4691
+ FDialog.showDialog = showDialog;
4692
+ FDialog.confirm = confirm;
4693
+ FDialog.alert = alert;
4694
+ FDialog.success = success;
4695
+ FDialog.warning = warning;
4696
+ FDialog.error = error;
4697
+ FDialog.info = info;
4573
4698
  const _hoisted_1$1 = { class: "f-message__content" };
4574
4699
  const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
4575
4700
  __name: "FMessage",
@@ -4673,6 +4798,78 @@ var __async = (__this, __arguments, generator) => {
4673
4798
  }
4674
4799
  });
4675
4800
  const FMessageComp = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-97556afa"]]);
4801
+ const GAP$1 = 16;
4802
+ const BASE_OFFSET$1 = 20;
4803
+ let seed$1 = 0;
4804
+ const instances = [];
4805
+ const normalizeOptions$1 = (options) => {
4806
+ return typeof options === "string" ? { message: options } : options;
4807
+ };
4808
+ const repositionAll = () => {
4809
+ let offset = BASE_OFFSET$1;
4810
+ instances.forEach((item) => {
4811
+ const vm = item.vnode.component;
4812
+ if (vm) {
4813
+ vm.props.offset = offset;
4814
+ }
4815
+ offset += item.height + GAP$1;
4816
+ });
4817
+ };
4818
+ const removeInstance$1 = (id) => {
4819
+ const index = instances.findIndex((item) => item.id === id);
4820
+ if (index === -1) return;
4821
+ const { container } = instances[index];
4822
+ vue.render(null, container);
4823
+ container.remove();
4824
+ instances.splice(index, 1);
4825
+ repositionAll();
4826
+ };
4827
+ const createInstance$1 = (options) => {
4828
+ var _a;
4829
+ const id = seed$1++;
4830
+ const container = document.createElement("div");
4831
+ const offset = instances.length === 0 ? BASE_OFFSET$1 : (() => {
4832
+ var _a2;
4833
+ const last = instances[instances.length - 1];
4834
+ return ((_a2 = last.vnode.component) == null ? void 0 : _a2.props.offset) + last.height + GAP$1;
4835
+ })();
4836
+ const vnode = vue.createVNode(FMessageComp, __spreadProps(__spreadValues({}, options), {
4837
+ offset,
4838
+ onClose: () => {
4839
+ var _a2;
4840
+ (_a2 = options.onClose) == null ? void 0 : _a2.call(options);
4841
+ },
4842
+ onDestroy: () => {
4843
+ removeInstance$1(id);
4844
+ }
4845
+ }));
4846
+ vue.render(vnode, container);
4847
+ document.body.appendChild(container);
4848
+ const el = vnode.el;
4849
+ const height = (_a = el == null ? void 0 : el.offsetHeight) != null ? _a : 44;
4850
+ instances.push({ id, vnode, container, height });
4851
+ return {
4852
+ id,
4853
+ close: () => {
4854
+ var _a2, _b, _c;
4855
+ (_c = (_b = (_a2 = vnode.component) == null ? void 0 : _a2.exposed) == null ? void 0 : _b.close) == null ? void 0 : _c.call(_b);
4856
+ }
4857
+ };
4858
+ };
4859
+ const FMessage = (options) => {
4860
+ return createInstance$1(normalizeOptions$1(options));
4861
+ };
4862
+ const withType$1 = (type) => (options) => createInstance$1(__spreadProps(__spreadValues({}, normalizeOptions$1(options)), { type }));
4863
+ FMessage.info = withType$1("info");
4864
+ FMessage.success = withType$1("success");
4865
+ FMessage.warning = withType$1("warning");
4866
+ FMessage.failed = withType$1("failed");
4867
+ FMessage.closeAll = () => {
4868
+ [...instances].forEach((item) => {
4869
+ var _a, _b, _c;
4870
+ (_c = (_b = (_a = item.vnode.component) == null ? void 0 : _a.exposed) == null ? void 0 : _b.close) == null ? void 0 : _c.call(_b);
4871
+ });
4872
+ };
4676
4873
  const _hoisted_1 = { class: "f-notification__body" };
4677
4874
  const _hoisted_2 = {
4678
4875
  key: 0,
@@ -4791,78 +4988,6 @@ var __async = (__this, __arguments, generator) => {
4791
4988
  }
4792
4989
  });
4793
4990
  const FNotificationComp = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0a7315d6"]]);
4794
- const GAP$1 = 16;
4795
- const BASE_OFFSET$1 = 20;
4796
- let seed$1 = 0;
4797
- const instances = [];
4798
- const normalizeOptions$1 = (options) => {
4799
- return typeof options === "string" ? { message: options } : options;
4800
- };
4801
- const repositionAll = () => {
4802
- let offset = BASE_OFFSET$1;
4803
- instances.forEach((item) => {
4804
- const vm = item.vnode.component;
4805
- if (vm) {
4806
- vm.props.offset = offset;
4807
- }
4808
- offset += item.height + GAP$1;
4809
- });
4810
- };
4811
- const removeInstance$1 = (id) => {
4812
- const index = instances.findIndex((item) => item.id === id);
4813
- if (index === -1) return;
4814
- const { container } = instances[index];
4815
- vue.render(null, container);
4816
- container.remove();
4817
- instances.splice(index, 1);
4818
- repositionAll();
4819
- };
4820
- const createInstance$1 = (options) => {
4821
- var _a;
4822
- const id = seed$1++;
4823
- const container = document.createElement("div");
4824
- const offset = instances.length === 0 ? BASE_OFFSET$1 : (() => {
4825
- var _a2;
4826
- const last = instances[instances.length - 1];
4827
- return ((_a2 = last.vnode.component) == null ? void 0 : _a2.props.offset) + last.height + GAP$1;
4828
- })();
4829
- const vnode = vue.createVNode(FMessageComp, __spreadProps(__spreadValues({}, options), {
4830
- offset,
4831
- onClose: () => {
4832
- var _a2;
4833
- (_a2 = options.onClose) == null ? void 0 : _a2.call(options);
4834
- },
4835
- onDestroy: () => {
4836
- removeInstance$1(id);
4837
- }
4838
- }));
4839
- vue.render(vnode, container);
4840
- document.body.appendChild(container);
4841
- const el = vnode.el;
4842
- const height = (_a = el == null ? void 0 : el.offsetHeight) != null ? _a : 44;
4843
- instances.push({ id, vnode, container, height });
4844
- return {
4845
- id,
4846
- close: () => {
4847
- var _a2, _b, _c;
4848
- (_c = (_b = (_a2 = vnode.component) == null ? void 0 : _a2.exposed) == null ? void 0 : _b.close) == null ? void 0 : _c.call(_b);
4849
- }
4850
- };
4851
- };
4852
- const FMessage = (options) => {
4853
- return createInstance$1(normalizeOptions$1(options));
4854
- };
4855
- const withType$1 = (type) => (options) => createInstance$1(__spreadProps(__spreadValues({}, normalizeOptions$1(options)), { type }));
4856
- FMessage.info = withType$1("info");
4857
- FMessage.success = withType$1("success");
4858
- FMessage.warning = withType$1("warning");
4859
- FMessage.failed = withType$1("failed");
4860
- FMessage.closeAll = () => {
4861
- [...instances].forEach((item) => {
4862
- var _a, _b, _c;
4863
- (_c = (_b = (_a = item.vnode.component) == null ? void 0 : _a.exposed) == null ? void 0 : _b.close) == null ? void 0 : _c.call(_b);
4864
- });
4865
- };
4866
4991
  const GAP = 16;
4867
4992
  const BASE_OFFSET = 20;
4868
4993
  let seed = 0;
@@ -4951,139 +5076,11 @@ var __async = (__this, __arguments, generator) => {
4951
5076
  });
4952
5077
  });
4953
5078
  };
4954
- const showDialog = (options) => {
4955
- return new Promise((resolve) => {
4956
- const container = document.createElement("div");
4957
- document.body.appendChild(container);
4958
- const visible = vue.ref(true);
4959
- const handleConfirm = () => {
4960
- cleanup();
4961
- resolve(true);
4962
- };
4963
- const handleCancel = () => {
4964
- cleanup();
4965
- resolve(false);
4966
- };
4967
- const cleanup = () => {
4968
- visible.value = false;
4969
- vue.render(null, container);
4970
- document.body.removeChild(container);
4971
- };
4972
- const vnode = vue.h(_sfc_main$2, __spreadValues({
4973
- modelValue: visible.value,
4974
- "onUpdate:modelValue": (val) => {
4975
- visible.value = val;
4976
- if (!val) {
4977
- cleanup();
4978
- }
4979
- },
4980
- onConfirm: handleConfirm,
4981
- onCancel: handleCancel
4982
- }, options));
4983
- vue.render(vnode, container);
4984
- });
4985
- };
4986
- const confirm = (content, title = "确认") => {
4987
- return showDialog({
4988
- title,
4989
- content,
4990
- type: "confirm",
4991
- showCancel: true
4992
- });
4993
- };
4994
- const alert = (content, title = "提示", type = "info") => {
4995
- return showDialog({
4996
- title,
4997
- content,
4998
- type,
4999
- showCancel: false,
5000
- confirmText: "知道了"
5001
- });
5002
- };
5003
- const success = (content, title = "成功") => {
5004
- return alert(content, title, "success");
5005
- };
5006
- const warning = (content, title = "警告") => {
5007
- return alert(content, title, "warning");
5008
- };
5009
- const error = (content, title = "错误") => {
5010
- return alert(content, title, "error");
5011
- };
5012
- const info = (content, title = "提示") => {
5013
- return alert(content, title, "info");
5014
- };
5015
- const FDialog = (options) => {
5016
- return showDialog(options);
5017
- };
5018
- FDialog.showDialog = showDialog;
5019
- FDialog.confirm = confirm;
5020
- FDialog.alert = alert;
5021
- FDialog.success = success;
5022
- FDialog.warning = warning;
5023
- FDialog.error = error;
5024
- FDialog.info = info;
5025
- const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5026
- __proto__: null,
5027
- FAffix,
5028
- FAlert,
5029
- FAvatar,
5030
- FBadge,
5031
- FBreadcrumb,
5032
- FButton,
5033
- FButtonGroup,
5034
- FCard,
5035
- FCheckbox,
5036
- FCol,
5037
- FCollapse: _sfc_main$d,
5038
- FCollapseItem: _sfc_main$c,
5039
- FColorPicker: _sfc_main$b,
5040
- FContainer,
5041
- FDialog,
5042
- FDialogComponent: _sfc_main$2,
5043
- FDivider,
5044
- FDropdown,
5045
- FEditor,
5046
- FEmpty: _sfc_main$a,
5047
- FForm,
5048
- FFormItem,
5049
- FIcon,
5050
- FImage,
5051
- FInput,
5052
- FInputNumber,
5053
- FLink,
5054
- FLoading,
5055
- FMarquee,
5056
- FMask,
5057
- FMessage,
5058
- FMessageComponent: FMessageComp,
5059
- FNotification,
5060
- FNotificationComponent: FNotificationComp,
5061
- FPagination,
5062
- FProgress,
5063
- FRadio,
5064
- FRadioGroup,
5065
- FRate,
5066
- FResult,
5067
- FRow,
5068
- FScrollbar: _sfc_main$8,
5069
- FSelect,
5070
- FSlider: _sfc_main$9,
5071
- FSpace,
5072
- FSteps,
5073
- FSwitch,
5074
- FTable,
5075
- FTabs,
5076
- FTag,
5077
- FText,
5078
- FTooltip,
5079
- FTransfer,
5080
- FTreeSelect,
5081
- FTypography,
5082
- FUpload
5083
- }, Symbol.toStringTag, { value: "Module" }));
5084
5079
  const install = (app) => {
5085
5080
  Object.entries(components).forEach(([name, component]) => {
5086
- app.component(name, component);
5081
+ if (name.startsWith("F")) {
5082
+ app.component(name, component);
5083
+ }
5087
5084
  });
5088
5085
  };
5089
5086
  exports2.FAffix = FAffix;
@@ -5100,8 +5097,8 @@ var __async = (__this, __arguments, generator) => {
5100
5097
  exports2.FCollapseItem = _sfc_main$c;
5101
5098
  exports2.FColorPicker = _sfc_main$b;
5102
5099
  exports2.FContainer = FContainer;
5103
- exports2.FDialog = FDialog;
5104
- exports2.FDialogComponent = _sfc_main$2;
5100
+ exports2.FDialog = _sfc_main$2;
5101
+ exports2.FDialogBox = FDialog;
5105
5102
  exports2.FDivider = FDivider;
5106
5103
  exports2.FDropdown = FDropdown;
5107
5104
  exports2.FEditor = FEditor;
@@ -5117,9 +5114,7 @@ var __async = (__this, __arguments, generator) => {
5117
5114
  exports2.FMarquee = FMarquee;
5118
5115
  exports2.FMask = FMask;
5119
5116
  exports2.FMessage = FMessage;
5120
- exports2.FMessageComponent = FMessageComp;
5121
5117
  exports2.FNotification = FNotification;
5122
- exports2.FNotificationComponent = FNotificationComp;
5123
5118
  exports2.FPagination = FPagination;
5124
5119
  exports2.FProgress = FProgress;
5125
5120
  exports2.FRadio = FRadio;
package/dist/index.d.ts CHANGED
@@ -5,9 +5,12 @@ declare const install: Plugin
5
5
  export default install
6
6
 
7
7
  // 导出所有组件
8
- export * from './types/components'
8
+ export * from './types/packages/components'
9
9
 
10
- // 显式导出 FMessage 和 FNotification
11
- export { FMessage, FNotification } from './types/components'
12
- export type { FMessageFn, FMessageOptions, FMessageInstance } from './types/components'
13
- export type { FNotificationFn, FNotificationOptions, FNotificationInstance } from './types/components'
10
+ // 导出所有 composables
11
+ export * from './types/packages/composables'
12
+
13
+ // 导出类型
14
+ export type { FDialogFn, FDialogOptions } from './types/packages/types/components'
15
+ export type { FMessageFn, FMessageOptions, FMessageInstance } from './types/packages/types/components'
16
+ export type { FNotificationFn, FNotificationOptions, FNotificationInstance } from './types/packages/types/components'
@@ -20,7 +20,7 @@ declare module '@vue/runtime-core' {
20
20
  FTransfer: typeof components.FTransfer
21
21
  FCol: typeof components.FCol
22
22
  FContainer: typeof components.FContainer
23
- FDialog: typeof components.FDialogComponent
23
+ FDialog: typeof components.FDialog
24
24
  FDivider: typeof components.FDivider
25
25
  FDropdown: typeof components.FDropdown
26
26
  FEditor: typeof components.FEditor
@@ -55,9 +55,8 @@ declare module '@vue/runtime-core' {
55
55
  FMask: typeof components.FMask
56
56
  FMarquee: typeof components.FMarquee
57
57
  FSteps: typeof components.FSteps
58
- FMessage: typeof components.FMessageComponent
59
- FNotification: typeof components.FNotificationComponent
60
58
  FResult: typeof components.FResult
59
+ // FMessage 和 FNotification 只作为函数式 API 使用,从 composables 导出
61
60
  }
62
61
  }
63
62
 
@@ -48,15 +48,4 @@ export { default as FResult } from './modules/FResult.vue';
48
48
  export { default as FMask } from './modules/FMask.vue';
49
49
  export { default as FMarquee } from './modules/FMarquee.vue';
50
50
  export { default as FSteps } from './modules/FSteps.vue';
51
- export { default as FDialogComponent } from './modules/FDialog.vue';
52
- export { default as FMessageComponent } from './modules/FMessage.vue';
53
- export { default as FNotificationComponent } from './modules/FNotification.vue';
54
- import FMessageDefault from '../composables/FMessage.js';
55
- import FNotificationDefault from '../composables/FNotification.js';
56
- import FDialogDefault from '../composables/FDialog.js';
57
- export { FMessageDefault as FMessage };
58
- export { FNotificationDefault as FNotification };
59
- export { FDialogDefault as FDialog };
60
- export type { FMessageFn, FMessageOptions, FMessageInstance } from '@/types';
61
- export type { FNotificationFn, FNotificationOptions, FNotificationInstance } from '@/types';
62
- export type { FDialogFn, FDialogOptions } from '@/types';
51
+ export { default as FDialog } from './modules/FDialog.vue';
@@ -0,0 +1,3 @@
1
+ export { default as FDialogBox } from './modules/FDialog';
2
+ export { default as FMessage } from './modules/FMessage';
3
+ export { default as FNotification } from './modules/FNotification';
@@ -0,0 +1,21 @@
1
+ import type { FDialogFn } from '@/types';
2
+ /**
3
+ * FDialog 函数式 API
4
+ *
5
+ * @example
6
+ * // 基础用法
7
+ * import { dialog } from 'fantasia-ui'
8
+ * dialog.confirm('确认删除吗?')
9
+ *
10
+ * @example
11
+ * // 或使用 FDialogAPI
12
+ * import { FDialogAPI } from 'fantasia-ui'
13
+ * FDialogAPI.alert('操作成功', '提示')
14
+ *
15
+ * @example
16
+ * // 组件用法
17
+ * import { FDialog } from 'fantasia-ui'
18
+ * // 在模板中使用 <FDialog />
19
+ */
20
+ declare const FDialog: FDialogFn;
21
+ export default FDialog;
@@ -0,0 +1,22 @@
1
+ import type { FMessageFn } from '@/types';
2
+ /**
3
+ * FMessage 函数式 API
4
+ *
5
+ * @example
6
+ * // 推荐用法 - 使用小写名称
7
+ * import { message } from 'fantasia-ui'
8
+ * message.success('操作成功')
9
+ * message.error('操作失败')
10
+ *
11
+ * @example
12
+ * // 或使用 FMessageAPI (向后兼容)
13
+ * import { FMessageAPI } from 'fantasia-ui'
14
+ * FMessageAPI.info('这是一条消息')
15
+ *
16
+ * @example
17
+ * // 组件用法
18
+ * import { FMessage } from 'fantasia-ui'
19
+ * // 在模板中使用 <FMessage />
20
+ */
21
+ declare const FMessage: FMessageFn;
22
+ export default FMessage;
@@ -0,0 +1,22 @@
1
+ import type { FNotificationFn } from '@/types';
2
+ /**
3
+ * FNotification 函数式 API
4
+ *
5
+ * @example
6
+ * // 推荐用法 - 使用小写名称
7
+ * import { notification } from 'fantasia-ui'
8
+ * notification.success('操作成功')
9
+ * notification.error('操作失败')
10
+ *
11
+ * @example
12
+ * // 或使用 FNotificationAPI (向后兼容)
13
+ * import { FNotificationAPI } from 'fantasia-ui'
14
+ * FNotificationAPI.info('这是一条通知')
15
+ *
16
+ * @example
17
+ * // 组件用法
18
+ * import { FNotification } from 'fantasia-ui'
19
+ * // 在模板中使用 <FNotification />
20
+ */
21
+ declare const FNotification: FNotificationFn;
22
+ export default FNotification;
@@ -3,4 +3,7 @@ import './styles/base.scss';
3
3
  declare const install: Plugin;
4
4
  export default install;
5
5
  export * from './components';
6
- export { FMessage, FNotification } from './components';
6
+ export * from './composables';
7
+ export type { FDialogFn, FDialogOptions } from './types/components';
8
+ export type { FMessageFn, FMessageOptions, FMessageInstance } from './types/components';
9
+ export type { FNotificationFn, FNotificationOptions, FNotificationInstance } from './types/components';
@@ -20,7 +20,7 @@ declare module '@vue/runtime-core' {
20
20
  FTransfer: typeof components.FTransfer
21
21
  FCol: typeof components.FCol
22
22
  FContainer: typeof components.FContainer
23
- FDialog: typeof components.FDialogComponent
23
+ FDialog: typeof components.FDialog
24
24
  FDivider: typeof components.FDivider
25
25
  FDropdown: typeof components.FDropdown
26
26
  FEditor: typeof components.FEditor
@@ -55,9 +55,8 @@ declare module '@vue/runtime-core' {
55
55
  FMask: typeof components.FMask
56
56
  FMarquee: typeof components.FMarquee
57
57
  FSteps: typeof components.FSteps
58
- FMessage: typeof components.FMessageComponent
59
- FNotification: typeof components.FNotificationComponent
60
58
  FResult: typeof components.FResult
59
+ // FMessage 和 FNotification 只作为函数式 API 使用,从 composables 导出
61
60
  }
62
61
  }
63
62
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "fantasia-ui",
3
3
  "private": false,
4
- "version": "0.2.50",
4
+ "version": "0.2.52",
5
5
  "type": "module",
6
6
  "main": "dist/fantasia-ui.umd.js",
7
7
  "module": "dist/fantasia-ui.es.js",
@@ -69,13 +69,11 @@
69
69
  "@vitejs/plugin-vue": "^5.2.3",
70
70
  "@vue/tsconfig": "^0.7.0",
71
71
  "@vueuse/core": "^14.3.0",
72
- "jsdom": "^30.0.1",
73
72
  "sass": "^1.89.0",
74
73
  "typescript": "~5.8.3",
75
74
  "unplugin-auto-import": "^19.3.0",
76
75
  "vite": "^6.3.5",
77
76
  "vite-plugin-dts": "^4.5.4",
78
- "vitest": "^4.1.8",
79
77
  "vue": "^3.5.13",
80
78
  "vue-tsc": "^2.2.8",
81
79
  "vue-docgen-api": "^4.79.2",
@@ -1,3 +0,0 @@
1
- import type { FDialogFn } from '@/types';
2
- declare const FDialog: FDialogFn;
3
- export default FDialog;
@@ -1,3 +0,0 @@
1
- import type { FMessageFn } from '@/types';
2
- declare const FMessage: FMessageFn;
3
- export default FMessage;
@@ -1,3 +0,0 @@
1
- import type { FNotificationFn } from '@/types';
2
- declare const FNotification: FNotificationFn;
3
- export default FNotification;