@mingto/mt-ui 1.1.41 → 1.1.43

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.
package/dist/index.es.js CHANGED
@@ -4704,6 +4704,9 @@ function useLocale() {
4704
4704
  //#region src/hooks/use-namespace/index.ts
4705
4705
  var defaultNamespace = "mt";
4706
4706
  var statePrefix$1 = "is-";
4707
+ function toKebabCase(key) {
4708
+ return key.replace(/([A-Z])/g, "-$1").toLowerCase();
4709
+ }
4707
4710
  function _bem$1(namespace, block, blockSuffix, element, modifier) {
4708
4711
  let cls = `${namespace}-${block}`;
4709
4712
  if (blockSuffix) cls += `-${blockSuffix}`;
@@ -4733,12 +4736,12 @@ function useNamespace(block, namespaceOverrides) {
4733
4736
  };
4734
4737
  const cssVar = (object) => {
4735
4738
  const styles = {};
4736
- for (const key in object) if (object[key]) styles[`--${namespace.value}-${key}`] = object[key];
4739
+ for (const key in object) if (object[key]) styles[`--${namespace.value}-${toKebabCase(key)}`] = object[key];
4737
4740
  return styles;
4738
4741
  };
4739
4742
  const cssVarBlock = (object) => {
4740
4743
  const styles = {};
4741
- for (const key in object) if (object[key]) styles[`--${namespace.value}-${block}-${key}`] = object[key];
4744
+ for (const key in object) if (object[key]) styles[`--${namespace.value}-${block}-${toKebabCase(key)}`] = object[key];
4742
4745
  return styles;
4743
4746
  };
4744
4747
  const cssVarName = (name) => `--${namespace.value}-${name}`;
@@ -9702,10 +9705,13 @@ var content_default$2 = /* @__PURE__ */ defineComponent({
9702
9705
  setup(__props, { emit: __emit }) {
9703
9706
  const props = __props;
9704
9707
  const emits = __emit;
9705
- const { contentVisible, onShow, onHide } = inject(POPPER_INJECTION_KEY$1);
9708
+ const { contentRef, contentVisible, onShow, onHide } = inject(POPPER_INJECTION_KEY$1);
9706
9709
  const ns = useNamespace("popover");
9707
9710
  const { nextZIndex } = useZIndex(void 0, "popover");
9708
9711
  const contentZIndex = ref(props.zIndex ?? nextZIndex());
9712
+ onBeforeUnmount(() => {
9713
+ contentRef.value = null;
9714
+ });
9709
9715
  const contentStyles = computed(() => {
9710
9716
  const styles = {};
9711
9717
  styles.zIndex = contentZIndex.value;
@@ -9755,6 +9761,8 @@ var content_default$2 = /* @__PURE__ */ defineComponent({
9755
9761
  onBeforeLeave
9756
9762
  }, {
9757
9763
  default: withCtx(() => [withDirectives(createElementVNode("div", {
9764
+ ref_key: "contentRef",
9765
+ ref: contentRef,
9758
9766
  style: normalizeStyle(contentStyles.value),
9759
9767
  class: normalizeClass(popoverContentClass.value),
9760
9768
  onMouseenter: onContentEnter,
package/dist/index.umd.js CHANGED
@@ -4733,6 +4733,9 @@
4733
4733
  //#region src/hooks/use-namespace/index.ts
4734
4734
  var defaultNamespace = "mt";
4735
4735
  var statePrefix$1 = "is-";
4736
+ function toKebabCase(key) {
4737
+ return key.replace(/([A-Z])/g, "-$1").toLowerCase();
4738
+ }
4736
4739
  function _bem$1(namespace, block, blockSuffix, element, modifier) {
4737
4740
  let cls = `${namespace}-${block}`;
4738
4741
  if (blockSuffix) cls += `-${blockSuffix}`;
@@ -4762,12 +4765,12 @@
4762
4765
  };
4763
4766
  const cssVar = (object) => {
4764
4767
  const styles = {};
4765
- for (const key in object) if (object[key]) styles[`--${namespace.value}-${key}`] = object[key];
4768
+ for (const key in object) if (object[key]) styles[`--${namespace.value}-${toKebabCase(key)}`] = object[key];
4766
4769
  return styles;
4767
4770
  };
4768
4771
  const cssVarBlock = (object) => {
4769
4772
  const styles = {};
4770
- for (const key in object) if (object[key]) styles[`--${namespace.value}-${block}-${key}`] = object[key];
4773
+ for (const key in object) if (object[key]) styles[`--${namespace.value}-${block}-${toKebabCase(key)}`] = object[key];
4771
4774
  return styles;
4772
4775
  };
4773
4776
  const cssVarName = (name) => `--${namespace.value}-${name}`;
@@ -9761,10 +9764,13 @@
9761
9764
  setup(__props, { emit: __emit }) {
9762
9765
  const props = __props;
9763
9766
  const emits = __emit;
9764
- const { contentVisible, onShow, onHide } = (0, vue.inject)(POPPER_INJECTION_KEY$1);
9767
+ const { contentRef, contentVisible, onShow, onHide } = (0, vue.inject)(POPPER_INJECTION_KEY$1);
9765
9768
  const ns = useNamespace("popover");
9766
9769
  const { nextZIndex } = useZIndex(void 0, "popover");
9767
9770
  const contentZIndex = (0, vue.ref)(props.zIndex ?? nextZIndex());
9771
+ (0, vue.onBeforeUnmount)(() => {
9772
+ contentRef.value = null;
9773
+ });
9768
9774
  const contentStyles = (0, vue.computed)(() => {
9769
9775
  const styles = {};
9770
9776
  styles.zIndex = contentZIndex.value;
@@ -9814,6 +9820,8 @@
9814
9820
  onBeforeLeave
9815
9821
  }, {
9816
9822
  default: (0, vue.withCtx)(() => [(0, vue.withDirectives)((0, vue.createElementVNode)("div", {
9823
+ ref_key: "contentRef",
9824
+ ref: contentRef,
9817
9825
  style: (0, vue.normalizeStyle)(contentStyles.value),
9818
9826
  class: (0, vue.normalizeClass)(popoverContentClass.value),
9819
9827
  onMouseenter: onContentEnter,
@@ -3,7 +3,9 @@ declare function __VLS_template(): {
3
3
  slots: {
4
4
  default?(_: {}): any;
5
5
  };
6
- refs: {};
6
+ refs: {
7
+ contentRef: HTMLDivElement;
8
+ };
7
9
  rootEl: any;
8
10
  };
9
11
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
@@ -202,7 +204,9 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
202
204
  enterable: boolean;
203
205
  teleported: boolean;
204
206
  controlled: boolean;
205
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
207
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
208
+ contentRef: HTMLDivElement;
209
+ }, any>;
206
210
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
207
211
  export default _default;
208
212
  type __VLS_WithTemplateSlots<T, S> = T & {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mingto/mt-ui",
3
3
  "type": "module",
4
- "version": "1.1.41",
4
+ "version": "1.1.43",
5
5
  "description": "UI组件库",
6
6
  "publishConfig": {
7
7
  "access": "public"