fantasia-ui 0.2.51 → 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.
@@ -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,149 +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 showDialog = (options) => {
4794
- return new Promise((resolve) => {
4795
- const container = document.createElement("div");
4796
- document.body.appendChild(container);
4797
- const visible = ref(true);
4798
- const handleConfirm = () => {
4799
- cleanup();
4800
- resolve(true);
4801
- };
4802
- const handleCancel = () => {
4803
- cleanup();
4804
- resolve(false);
4805
- };
4806
- const cleanup = () => {
4807
- visible.value = false;
4808
- render(null, container);
4809
- document.body.removeChild(container);
4810
- };
4811
- const vnode = h(_sfc_main$2, __spreadValues({
4812
- modelValue: visible.value,
4813
- "onUpdate:modelValue": (val) => {
4814
- visible.value = val;
4815
- if (!val) {
4816
- cleanup();
4817
- }
4818
- },
4819
- onConfirm: handleConfirm,
4820
- onCancel: handleCancel
4821
- }, options));
4822
- render(vnode, container);
4823
- });
4824
- };
4825
- const confirm = (content, title = "确认") => {
4826
- return showDialog({
4827
- title,
4828
- content,
4829
- type: "confirm",
4830
- showCancel: true
4831
- });
4832
- };
4833
- const alert = (content, title = "提示", type = "info") => {
4834
- return showDialog({
4835
- title,
4836
- content,
4837
- type,
4838
- showCancel: false,
4839
- confirmText: "知道了"
4840
- });
4841
- };
4842
- const success = (content, title = "成功") => {
4843
- return alert(content, title, "success");
4844
- };
4845
- const warning = (content, title = "警告") => {
4846
- return alert(content, title, "warning");
4847
- };
4848
- const error = (content, title = "错误") => {
4849
- return alert(content, title, "error");
4850
- };
4851
- const info = (content, title = "提示") => {
4852
- return alert(content, title, "info");
4853
- };
4854
- const FDialog = (options) => {
4855
- return showDialog(options);
4856
- };
4857
- FDialog.showDialog = showDialog;
4858
- FDialog.confirm = confirm;
4859
- FDialog.alert = alert;
4860
- FDialog.success = success;
4861
- FDialog.warning = warning;
4862
- FDialog.error = error;
4863
- FDialog.info = info;
4864
- const GAP$1 = 16;
4865
- const BASE_OFFSET$1 = 20;
4866
- let seed$1 = 0;
4867
- const instances = [];
4868
- const normalizeOptions$1 = (options) => {
4869
- return typeof options === "string" ? { message: options } : options;
4870
- };
4871
- const repositionAll = () => {
4872
- let offset = BASE_OFFSET$1;
4873
- instances.forEach((item) => {
4874
- const vm = item.vnode.component;
4875
- if (vm) {
4876
- vm.props.offset = offset;
4877
- }
4878
- offset += item.height + GAP$1;
4879
- });
4880
- };
4881
- const removeInstance$1 = (id) => {
4882
- const index = instances.findIndex((item) => item.id === id);
4883
- if (index === -1) return;
4884
- const { container } = instances[index];
4885
- render(null, container);
4886
- container.remove();
4887
- instances.splice(index, 1);
4888
- repositionAll();
4889
- };
4890
- const createInstance$1 = (options) => {
4891
- var _a;
4892
- const id = seed$1++;
4893
- const container = document.createElement("div");
4894
- const offset = instances.length === 0 ? BASE_OFFSET$1 : (() => {
4895
- var _a2;
4896
- const last = instances[instances.length - 1];
4897
- return ((_a2 = last.vnode.component) == null ? void 0 : _a2.props.offset) + last.height + GAP$1;
4898
- })();
4899
- const vnode = createVNode(FMessageComp, __spreadProps(__spreadValues({}, options), {
4900
- offset,
4901
- onClose: () => {
4902
- var _a2;
4903
- (_a2 = options.onClose) == null ? void 0 : _a2.call(options);
4904
- },
4905
- onDestroy: () => {
4906
- removeInstance$1(id);
4907
- }
4908
- }));
4909
- render(vnode, container);
4910
- document.body.appendChild(container);
4911
- const el = vnode.el;
4912
- const height = (_a = el == null ? void 0 : el.offsetHeight) != null ? _a : 44;
4913
- instances.push({ id, vnode, container, height });
4914
- return {
4915
- id,
4916
- close: () => {
4917
- var _a2, _b, _c;
4918
- (_c = (_b = (_a2 = vnode.component) == null ? void 0 : _a2.exposed) == null ? void 0 : _b.close) == null ? void 0 : _c.call(_b);
4919
- }
4920
- };
4921
- };
4922
- const FMessage = (options) => {
4923
- return createInstance$1(normalizeOptions$1(options));
4924
- };
4925
- const withType$1 = (type) => (options) => createInstance$1(__spreadProps(__spreadValues({}, normalizeOptions$1(options)), { type }));
4926
- FMessage.info = withType$1("info");
4927
- FMessage.success = withType$1("success");
4928
- FMessage.warning = withType$1("warning");
4929
- FMessage.failed = withType$1("failed");
4930
- FMessage.closeAll = () => {
4931
- [...instances].forEach((item) => {
4932
- var _a, _b, _c;
4933
- (_c = (_b = (_a = item.vnode.component) == null ? void 0 : _a.exposed) == null ? void 0 : _b.close) == null ? void 0 : _c.call(_b);
4934
- });
4935
- };
4936
4990
  const GAP = 16;
4937
4991
  const BASE_OFFSET = 20;
4938
4992
  let seed = 0;
@@ -5021,71 +5075,9 @@ FNotification.closeAll = (position) => {
5021
5075
  });
5022
5076
  });
5023
5077
  };
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: _sfc_main$2,
5041
- FDialogAPI: FDialog,
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: FMessageComp,
5057
- FMessageAPI: FMessage,
5058
- FNotification: FNotificationComp,
5059
- FNotificationAPI: FNotification,
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
- dialog: FDialog,
5083
- message: FMessage,
5084
- notification: FNotification
5085
- }, Symbol.toStringTag, { value: "Module" }));
5086
5078
  const install = (app) => {
5087
5079
  Object.entries(components).forEach(([name, component]) => {
5088
- if (typeof component !== "function" && name.startsWith("F")) {
5080
+ if (name.startsWith("F")) {
5089
5081
  app.component(name, component);
5090
5082
  }
5091
5083
  });
@@ -5106,7 +5098,7 @@ export {
5106
5098
  _sfc_main$b as FColorPicker,
5107
5099
  FContainer,
5108
5100
  _sfc_main$2 as FDialog,
5109
- FDialog as FDialogAPI,
5101
+ FDialog as FDialogBox,
5110
5102
  FDivider,
5111
5103
  FDropdown,
5112
5104
  FEditor,
@@ -5121,10 +5113,8 @@ export {
5121
5113
  FLoading,
5122
5114
  FMarquee,
5123
5115
  FMask,
5124
- FMessageComp as FMessage,
5125
- FMessage as FMessageAPI,
5126
- FNotificationComp as FNotification,
5127
- FNotification as FNotificationAPI,
5116
+ FMessage,
5117
+ FNotification,
5128
5118
  FPagination,
5129
5119
  FProgress,
5130
5120
  FRadio,
@@ -5147,8 +5137,5 @@ export {
5147
5137
  FTreeSelect,
5148
5138
  FTypography,
5149
5139
  FUpload,
5150
- install as default,
5151
- FDialog as dialog,
5152
- FMessage as message,
5153
- FNotification as notification
5140
+ install as default
5154
5141
  };
@@ -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,149 +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 showDialog = (options) => {
4795
- return new Promise((resolve) => {
4796
- const container = document.createElement("div");
4797
- document.body.appendChild(container);
4798
- const visible = vue.ref(true);
4799
- const handleConfirm = () => {
4800
- cleanup();
4801
- resolve(true);
4802
- };
4803
- const handleCancel = () => {
4804
- cleanup();
4805
- resolve(false);
4806
- };
4807
- const cleanup = () => {
4808
- visible.value = false;
4809
- vue.render(null, container);
4810
- document.body.removeChild(container);
4811
- };
4812
- const vnode = vue.h(_sfc_main$2, __spreadValues({
4813
- modelValue: visible.value,
4814
- "onUpdate:modelValue": (val) => {
4815
- visible.value = val;
4816
- if (!val) {
4817
- cleanup();
4818
- }
4819
- },
4820
- onConfirm: handleConfirm,
4821
- onCancel: handleCancel
4822
- }, options));
4823
- vue.render(vnode, container);
4824
- });
4825
- };
4826
- const confirm = (content, title = "确认") => {
4827
- return showDialog({
4828
- title,
4829
- content,
4830
- type: "confirm",
4831
- showCancel: true
4832
- });
4833
- };
4834
- const alert = (content, title = "提示", type = "info") => {
4835
- return showDialog({
4836
- title,
4837
- content,
4838
- type,
4839
- showCancel: false,
4840
- confirmText: "知道了"
4841
- });
4842
- };
4843
- const success = (content, title = "成功") => {
4844
- return alert(content, title, "success");
4845
- };
4846
- const warning = (content, title = "警告") => {
4847
- return alert(content, title, "warning");
4848
- };
4849
- const error = (content, title = "错误") => {
4850
- return alert(content, title, "error");
4851
- };
4852
- const info = (content, title = "提示") => {
4853
- return alert(content, title, "info");
4854
- };
4855
- const FDialog = (options) => {
4856
- return showDialog(options);
4857
- };
4858
- FDialog.showDialog = showDialog;
4859
- FDialog.confirm = confirm;
4860
- FDialog.alert = alert;
4861
- FDialog.success = success;
4862
- FDialog.warning = warning;
4863
- FDialog.error = error;
4864
- FDialog.info = info;
4865
- const GAP$1 = 16;
4866
- const BASE_OFFSET$1 = 20;
4867
- let seed$1 = 0;
4868
- const instances = [];
4869
- const normalizeOptions$1 = (options) => {
4870
- return typeof options === "string" ? { message: options } : options;
4871
- };
4872
- const repositionAll = () => {
4873
- let offset = BASE_OFFSET$1;
4874
- instances.forEach((item) => {
4875
- const vm = item.vnode.component;
4876
- if (vm) {
4877
- vm.props.offset = offset;
4878
- }
4879
- offset += item.height + GAP$1;
4880
- });
4881
- };
4882
- const removeInstance$1 = (id) => {
4883
- const index = instances.findIndex((item) => item.id === id);
4884
- if (index === -1) return;
4885
- const { container } = instances[index];
4886
- vue.render(null, container);
4887
- container.remove();
4888
- instances.splice(index, 1);
4889
- repositionAll();
4890
- };
4891
- const createInstance$1 = (options) => {
4892
- var _a;
4893
- const id = seed$1++;
4894
- const container = document.createElement("div");
4895
- const offset = instances.length === 0 ? BASE_OFFSET$1 : (() => {
4896
- var _a2;
4897
- const last = instances[instances.length - 1];
4898
- return ((_a2 = last.vnode.component) == null ? void 0 : _a2.props.offset) + last.height + GAP$1;
4899
- })();
4900
- const vnode = vue.createVNode(FMessageComp, __spreadProps(__spreadValues({}, options), {
4901
- offset,
4902
- onClose: () => {
4903
- var _a2;
4904
- (_a2 = options.onClose) == null ? void 0 : _a2.call(options);
4905
- },
4906
- onDestroy: () => {
4907
- removeInstance$1(id);
4908
- }
4909
- }));
4910
- vue.render(vnode, container);
4911
- document.body.appendChild(container);
4912
- const el = vnode.el;
4913
- const height = (_a = el == null ? void 0 : el.offsetHeight) != null ? _a : 44;
4914
- instances.push({ id, vnode, container, height });
4915
- return {
4916
- id,
4917
- close: () => {
4918
- var _a2, _b, _c;
4919
- (_c = (_b = (_a2 = vnode.component) == null ? void 0 : _a2.exposed) == null ? void 0 : _b.close) == null ? void 0 : _c.call(_b);
4920
- }
4921
- };
4922
- };
4923
- const FMessage = (options) => {
4924
- return createInstance$1(normalizeOptions$1(options));
4925
- };
4926
- const withType$1 = (type) => (options) => createInstance$1(__spreadProps(__spreadValues({}, normalizeOptions$1(options)), { type }));
4927
- FMessage.info = withType$1("info");
4928
- FMessage.success = withType$1("success");
4929
- FMessage.warning = withType$1("warning");
4930
- FMessage.failed = withType$1("failed");
4931
- FMessage.closeAll = () => {
4932
- [...instances].forEach((item) => {
4933
- var _a, _b, _c;
4934
- (_c = (_b = (_a = item.vnode.component) == null ? void 0 : _a.exposed) == null ? void 0 : _b.close) == null ? void 0 : _c.call(_b);
4935
- });
4936
- };
4937
4991
  const GAP = 16;
4938
4992
  const BASE_OFFSET = 20;
4939
4993
  let seed = 0;
@@ -5022,71 +5076,9 @@ var __async = (__this, __arguments, generator) => {
5022
5076
  });
5023
5077
  });
5024
5078
  };
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: _sfc_main$2,
5042
- FDialogAPI: FDialog,
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: FMessageComp,
5058
- FMessageAPI: FMessage,
5059
- FNotification: FNotificationComp,
5060
- FNotificationAPI: FNotification,
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
- dialog: FDialog,
5084
- message: FMessage,
5085
- notification: FNotification
5086
- }, Symbol.toStringTag, { value: "Module" }));
5087
5079
  const install = (app) => {
5088
5080
  Object.entries(components).forEach(([name, component]) => {
5089
- if (typeof component !== "function" && name.startsWith("F")) {
5081
+ if (name.startsWith("F")) {
5090
5082
  app.component(name, component);
5091
5083
  }
5092
5084
  });
@@ -5106,7 +5098,7 @@ var __async = (__this, __arguments, generator) => {
5106
5098
  exports2.FColorPicker = _sfc_main$b;
5107
5099
  exports2.FContainer = FContainer;
5108
5100
  exports2.FDialog = _sfc_main$2;
5109
- exports2.FDialogAPI = FDialog;
5101
+ exports2.FDialogBox = FDialog;
5110
5102
  exports2.FDivider = FDivider;
5111
5103
  exports2.FDropdown = FDropdown;
5112
5104
  exports2.FEditor = FEditor;
@@ -5121,10 +5113,8 @@ var __async = (__this, __arguments, generator) => {
5121
5113
  exports2.FLoading = FLoading;
5122
5114
  exports2.FMarquee = FMarquee;
5123
5115
  exports2.FMask = FMask;
5124
- exports2.FMessage = FMessageComp;
5125
- exports2.FMessageAPI = FMessage;
5126
- exports2.FNotification = FNotificationComp;
5127
- exports2.FNotificationAPI = FNotification;
5116
+ exports2.FMessage = FMessage;
5117
+ exports2.FNotification = FNotification;
5128
5118
  exports2.FPagination = FPagination;
5129
5119
  exports2.FProgress = FProgress;
5130
5120
  exports2.FRadio = FRadio;
@@ -5148,8 +5138,5 @@ var __async = (__this, __arguments, generator) => {
5148
5138
  exports2.FTypography = FTypography;
5149
5139
  exports2.FUpload = FUpload;
5150
5140
  exports2.default = install;
5151
- exports2.dialog = FDialog;
5152
- exports2.message = FMessage;
5153
- exports2.notification = FNotification;
5154
5141
  Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
5155
5142
  });
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'
@@ -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.FMessage
59
- FNotification: typeof components.FNotification
60
58
  FResult: typeof components.FResult
59
+ // FMessage 和 FNotification 只作为函数式 API 使用,从 composables 导出
61
60
  }
62
61
  }
63
62
 
@@ -49,17 +49,3 @@ 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
51
  export { default as FDialog } from './modules/FDialog.vue';
52
- export { default as FMessage } from './modules/FMessage.vue';
53
- export { default as FNotification } from './modules/FNotification.vue';
54
- import FDialogAPI from '../composables/FDialog.js';
55
- import FMessageAPI from '../composables/FMessage.js';
56
- import FNotificationAPI from '../composables/FNotification.js';
57
- export { FDialogAPI as dialog };
58
- export { FMessageAPI as message };
59
- export { FNotificationAPI as notification };
60
- export { FDialogAPI };
61
- export { FMessageAPI };
62
- export { FNotificationAPI };
63
- export type { FMessageFn, FMessageOptions, FMessageInstance } from '@/types';
64
- export type { FNotificationFn, FNotificationOptions, FNotificationInstance } from '@/types';
65
- export type { FDialogFn, FDialogOptions } from '@/types';
@@ -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';
@@ -3,5 +3,7 @@ import './styles/base.scss';
3
3
  declare const install: Plugin;
4
4
  export default install;
5
5
  export * from './components';
6
- export { FDialog, FMessage, FNotification } from './components';
7
- export { dialog, message, notification, FDialogAPI, FMessageAPI, FNotificationAPI } 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';
@@ -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.FMessage
59
- FNotification: typeof components.FNotification
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.51",
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",