@v-c/tabs 1.0.1 → 1.1.0-rc.1

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.
@@ -1,4 +1,5 @@
1
1
  import { inject, provide } from "vue";
2
+ //#region src/TabContext.ts
2
3
  var TabContextKey = Symbol("TabContext");
3
4
  function provideTabContext(value) {
4
5
  provide(TabContextKey, value);
@@ -6,4 +7,5 @@ function provideTabContext(value) {
6
7
  function useTabContext() {
7
8
  return inject(TabContextKey, {});
8
9
  }
10
+ //#endregion
9
11
  export { provideTabContext, useTabContext };
@@ -1,3 +1,5 @@
1
1
  import AddButton_vue_vue_type_script_setup_true_lang_default from "./AddButton.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/TabNavList/AddButton.vue
2
3
  var AddButton_default = AddButton_vue_vue_type_script_setup_true_lang_default;
4
+ //#endregion
3
5
  export { AddButton_default as default };
@@ -1,5 +1,6 @@
1
1
  import { createCommentVNode, createElementBlock, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, ref, toRefs, unref } from "vue";
2
2
  import { RenderComponent } from "@v-c/util";
3
+ //#region src/TabNavList/AddButton.vue?vue&type=script&setup=true&lang.ts
3
4
  var _hoisted_1 = ["aria-label"];
4
5
  var AddButton_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
5
6
  name: "AddButton",
@@ -32,4 +33,5 @@ var AddButton_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
32
33
  };
33
34
  }
34
35
  });
36
+ //#endregion
35
37
  export { AddButton_vue_vue_type_script_setup_true_lang_default as default };
@@ -1,3 +1,5 @@
1
1
  import ExtraContent_vue_vue_type_script_setup_true_lang_default from "./ExtraContent.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/TabNavList/ExtraContent.vue
2
3
  var ExtraContent_default = ExtraContent_vue_vue_type_script_setup_true_lang_default;
4
+ //#endregion
3
5
  export { ExtraContent_default as default };
@@ -1,6 +1,7 @@
1
1
  import { computed, createCommentVNode, createElementBlock, createVNode, defineComponent, isVNode, normalizeClass, openBlock, ref, toRefs, unref } from "vue";
2
2
  import RenderComponent from "@v-c/util/dist/RenderComponent";
3
3
  import { ensureValidVNode } from "@v-c/util/dist/vnode";
4
+ //#region src/TabNavList/ExtraContent.vue?vue&type=script&setup=true&lang.ts
4
5
  var ExtraContent_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
5
6
  __name: "ExtraContent",
6
7
  props: {
@@ -46,4 +47,5 @@ var ExtraContent_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
46
47
  };
47
48
  }
48
49
  });
50
+ //#endregion
49
51
  export { ExtraContent_vue_vue_type_script_setup_true_lang_default as default };
@@ -1,3 +1,5 @@
1
1
  import OperationNode_vue_vue_type_script_setup_true_lang_default from "./OperationNode.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/TabNavList/OperationNode.vue
2
3
  var OperationNode_default = OperationNode_vue_vue_type_script_setup_true_lang_default;
4
+ //#endregion
3
5
  export { OperationNode_default as default };
@@ -6,6 +6,7 @@ import RenderComponent$1 from "@v-c/util/dist/RenderComponent";
6
6
  import DropDown from "@v-c/dropdown";
7
7
  import Menu from "@v-c/menu";
8
8
  import KeyCode from "@v-c/util/dist/KeyCode";
9
+ //#region src/TabNavList/OperationNode.vue?vue&type=script&setup=true&lang.ts
9
10
  var _hoisted_1 = [
10
11
  "id",
11
12
  "aria-controls",
@@ -31,7 +32,9 @@ var OperationNode_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
31
32
  tabMoving: { type: Boolean },
32
33
  getPopupContainer: {},
33
34
  popupClassName: {},
34
- popupStyle: {}
35
+ popupStyle: {},
36
+ classNames: {},
37
+ styles: {}
35
38
  },
36
39
  setup(__props, { expose: __expose }) {
37
40
  const props = __props;
@@ -78,7 +81,8 @@ var OperationNode_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
78
81
  "type": "button",
79
82
  "aria-label": removeAriaLabel.value || "remove",
80
83
  "tabindex": 0,
81
- "class": `${dropdownPrefix.value}-menu-item-remove`,
84
+ "class": clsx(`${dropdownPrefix.value}-menu-item-remove`, props.classNames?.remove),
85
+ "style": props.styles?.remove,
82
86
  "onClick": (e) => {
83
87
  e.stopPropagation();
84
88
  onRemoveTab(e, key);
@@ -94,12 +98,12 @@ var OperationNode_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
94
98
  });
95
99
  const moreIconNode = computed(() => moreProps.value?.icon || "More");
96
100
  const moreStyle = computed(() => {
97
- const style$1 = { marginInlineStart: tabBarGutter.value ? `${tabBarGutter.value}px` : "0px" };
101
+ const style = { marginInlineStart: tabBarGutter.value ? `${tabBarGutter.value}px` : "0px" };
98
102
  if (!props.tabs.length) {
99
- style$1.visibility = "hidden";
100
- style$1.order = 1;
103
+ style.visibility = "hidden";
104
+ style.order = 1;
101
105
  }
102
- return style$1;
106
+ return style;
103
107
  });
104
108
  function selectOffset(offset) {
105
109
  const enabledTabs = props.tabs.filter((tab) => !tab.disabled);
@@ -202,4 +206,5 @@ var OperationNode_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
202
206
  };
203
207
  }
204
208
  });
209
+ //#endregion
205
210
  export { OperationNode_vue_vue_type_script_setup_true_lang_default as default };
@@ -1,3 +1,5 @@
1
1
  import TabNode_vue_vue_type_script_setup_true_lang_default from "./TabNode.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/TabNavList/TabNode.vue
2
3
  var TabNode_default = TabNode_vue_vue_type_script_setup_true_lang_default;
4
+ //#endregion
3
5
  export { TabNode_default as default };
@@ -2,6 +2,7 @@ import { genDataNodeKey, getRemovable } from "../utils.js";
2
2
  import { computed, createBlock, defineComponent, h, onMounted, openBlock, ref, toRefs, unref, watch } from "vue";
3
3
  import RenderComponent from "@v-c/util/dist/RenderComponent";
4
4
  import { isEmptyElement } from "@v-c/util/dist/props-util";
5
+ //#region src/TabNavList/TabNode.vue?vue&type=script&setup=true&lang.ts
5
6
  var TabNode_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
6
7
  name: "TabNode",
7
8
  inheritAttrs: false,
@@ -34,7 +35,9 @@ var TabNode_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
34
35
  onFocus: { type: Function },
35
36
  onBlur: { type: Function },
36
37
  style: {},
37
- className: {}
38
+ className: {},
39
+ classNames: {},
40
+ styles: {}
38
41
  },
39
42
  setup(__props) {
40
43
  const props = __props;
@@ -52,6 +55,7 @@ var TabNode_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
52
55
  const cls = computed(() => [
53
56
  tabPrefix.value,
54
57
  props.className,
58
+ props.classNames?.item,
55
59
  {
56
60
  [`${tabPrefix.value}-with-remove`]: removable.value,
57
61
  [`${tabPrefix.value}-active`]: active.value,
@@ -59,6 +63,10 @@ var TabNode_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
59
63
  [`${tabPrefix.value}-focus`]: focus.value
60
64
  }
61
65
  ]);
66
+ const mergedStyle = computed(() => ({
67
+ ...props.styles?.item,
68
+ ...props.style
69
+ }));
62
70
  function onRemove(event) {
63
71
  event.preventDefault();
64
72
  event.stopPropagation();
@@ -104,7 +112,8 @@ var TabNode_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
104
112
  "type": "button",
105
113
  "aria-label": props.removeAriaLabel || "remove",
106
114
  "tabindex": active.value ? 0 : -1,
107
- "class": [`${tabPrefix.value}-remove`],
115
+ "class": [`${tabPrefix.value}-remove`, props.classNames?.remove],
116
+ "style": props.styles?.remove,
108
117
  "onClick": (e) => {
109
118
  e.stopPropagation();
110
119
  onRemove(e);
@@ -114,7 +123,7 @@ var TabNode_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
114
123
  "key": tab.value.key,
115
124
  "data-node-key": genDataNodeKey(tab.value.key),
116
125
  "class": cls.value,
117
- "style": props.style,
126
+ "style": mergedStyle.value,
118
127
  "onClick": onInternalClick
119
128
  }, children);
120
129
  });
@@ -124,4 +133,5 @@ var TabNode_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
124
133
  };
125
134
  }
126
135
  });
136
+ //#endregion
127
137
  export { TabNode_vue_vue_type_script_setup_true_lang_default as default };
@@ -1,3 +1,5 @@
1
1
  import Wrapper_vue_vue_type_script_setup_true_lang_default from "./Wrapper.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/TabNavList/Wrapper.vue
2
3
  var Wrapper_default = Wrapper_vue_vue_type_script_setup_true_lang_default;
4
+ //#endregion
3
5
  export { Wrapper_default as default };
@@ -1,6 +1,7 @@
1
1
  import TabNavList_default from "./index.js";
2
2
  import { computed, createBlock, defineComponent, h, openBlock, unref } from "vue";
3
3
  import RenderComponent from "@v-c/util/dist/RenderComponent";
4
+ //#region src/TabNavList/Wrapper.vue?vue&type=script&setup=true&lang.ts
4
5
  var Wrapper_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
5
6
  name: "TabNavListWrapper",
6
7
  inheritAttrs: false,
@@ -49,4 +50,5 @@ var Wrapper_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
49
50
  };
50
51
  }
51
52
  });
53
+ //#endregion
52
54
  export { Wrapper_vue_vue_type_script_setup_true_lang_default as default };
@@ -1,3 +1,5 @@
1
1
  import index_vue_vue_type_script_setup_true_lang_default from "./index.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/TabNavList/index.vue
2
3
  var TabNavList_default = index_vue_vue_type_script_setup_true_lang_default;
4
+ //#endregion
3
5
  export { TabNavList_default as default };
@@ -1,5 +1,5 @@
1
1
  import { useTabContext } from "../TabContext.js";
2
- import useIndicator_default from "../hooks/useIndicator.js";
2
+ import useIndicator from "../hooks/useIndicator.js";
3
3
  import useOffsets from "../hooks/useOffsets.js";
4
4
  import useTouchMove from "../hooks/useTouchMove.js";
5
5
  import useVisibleRange from "../hooks/useVisibleRange.js";
@@ -8,9 +8,10 @@ import AddButton_default from "./AddButton.js";
8
8
  import ExtraContent_default from "./ExtraContent.js";
9
9
  import OperationNode_default from "./OperationNode.js";
10
10
  import TabNode_default from "./TabNode.js";
11
- import { computed, createBlock, createElementVNode, createVNode, defineComponent, h, mergeProps, nextTick, normalizeClass, normalizeStyle, onUnmounted, openBlock, ref, shallowRef, toRefs, unref, watch, withCtx } from "vue";
11
+ import { Fragment, computed, createBlock, createElementVNode, createVNode, defineComponent, h, mergeProps, nextTick, normalizeClass, normalizeStyle, onUnmounted, openBlock, ref, shallowRef, toRefs, unref, useSlots, watch, withCtx } from "vue";
12
12
  import RenderComponent from "@v-c/util/dist/RenderComponent";
13
13
  import ResizeObserver from "@v-c/resize-observer";
14
+ //#region src/TabNavList/index.vue?vue&type=script&setup=true&lang.ts
14
15
  var _hoisted_1 = ["aria-orientation"];
15
16
  var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
16
17
  name: "TabNavList",
@@ -51,6 +52,17 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
51
52
  const props = __props;
52
53
  const { className, style, id, animated, activeKey, rtl, extra, editable, locale, tabPosition, tabBarGutter: tabBarGutterProp, children, onTabClick, onTabScroll, indicator, classNames: tabsClassNames, styles, mobile, more, getPopupContainer, popupClassName } = toRefs(props);
53
54
  const tabBarGutter = computed(() => tabBarGutterProp.value ? `${tabBarGutterProp.value}px` : void 0);
55
+ const slots = useSlots();
56
+ const defaultSlotWrapper = computed(() => {
57
+ if (!slots.default) return void 0;
58
+ return (node) => {
59
+ const slotResult = slots.default?.(node);
60
+ if (!slotResult) return node;
61
+ if (Array.isArray(slotResult)) return slotResult.length ? h(Fragment, null, slotResult) : node;
62
+ return slotResult;
63
+ };
64
+ });
65
+ const renderWrapper = computed(() => children.value ?? defaultSlotWrapper.value);
54
66
  const ctx = useTabContext();
55
67
  const tabs = computed(() => ctx?.value.tabs || []);
56
68
  const prefixCls = computed(() => ctx?.value.prefixCls || "");
@@ -77,8 +89,11 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
77
89
  const tabOffsets = useOffsets(tabs, tabSizes, firstTabContentSize);
78
90
  const operationsRef = ref(null);
79
91
  const innerAddButtonRef = ref(null);
80
- function getUnitValue(size, tabPositionTopOrBottom$1) {
81
- return size[tabPositionTopOrBottom$1 ? 0 : 1];
92
+ /**
93
+ * Convert `SizeInfo` to unit value. Such as [123, 456] with `top` position get `123`
94
+ */
95
+ function getUnitValue(size, tabPositionTopOrBottom) {
96
+ return size[tabPositionTopOrBottom ? 0 : 1];
82
97
  }
83
98
  const containerExcludeExtraSizeValue = computed(() => getUnitValue(containerExcludeExtraSize.value, tabPositionTopOrBottom.value));
84
99
  const tabContentSizeValue = computed(() => getUnitValue(tabContentSize.value, tabPositionTopOrBottom.value));
@@ -285,7 +300,7 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
285
300
  if (!rtl.value) wrap.scrollLeft = 0;
286
301
  wrap.scrollTop = 0;
287
302
  }
288
- const inkStyle = useIndicator_default({
303
+ const inkStyle = useIndicator({
289
304
  activeTabOffset: computed(() => tabOffsets.value.get(activeKey.value)),
290
305
  horizontal: isHorizontal,
291
306
  indicator,
@@ -414,15 +429,20 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
414
429
  key: tab.key,
415
430
  tab,
416
431
  className: unref(tabsClassNames)?.item,
417
- style: i === 0 ? unref(styles)?.item : {
418
- ...isHorizontal.value ? { marginInlineStart: tabBarGutter.value } : { marginTop: tabBarGutter.value },
419
- ...unref(styles)?.item || {}
432
+ style: i === 0 ? void 0 : isHorizontal.value ? { marginInlineStart: tabBarGutter.value } : { marginTop: tabBarGutter.value },
433
+ classNames: {
434
+ item: unref(tabsClassNames)?.item,
435
+ remove: unref(tabsClassNames)?.remove
436
+ },
437
+ styles: {
438
+ item: unref(styles)?.item,
439
+ remove: unref(styles)?.remove
420
440
  },
421
441
  closable: tab.closable,
422
442
  editable: unref(editable),
423
443
  active: tab.key === unref(activeKey),
424
444
  focus: tab.key === focusKey.value,
425
- renderWrapper: unref(children),
445
+ renderWrapper: renderWrapper.value,
426
446
  removeAriaLabel: unref(locale)?.removeAriaLabel,
427
447
  tabCount: tabs.value.filter((t) => !t.disabled).length,
428
448
  currentPosition: i + 1,
@@ -475,7 +495,9 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
475
495
  tabs: hiddenTabs.value,
476
496
  "class-name": [unref(tabsClassNames)?.operations, !hasDropdown.value ? operationsHiddenClassName.value : void 0],
477
497
  "popup-style": unref(styles)?.popup,
478
- "tab-moving": !!lockAnimation.value
498
+ "tab-moving": !!lockAnimation.value,
499
+ "class-names": { remove: unref(tabsClassNames)?.remove },
500
+ styles: { remove: unref(styles)?.remove }
479
501
  }, {
480
502
  id: unref(id),
481
503
  rtl: unref(rtl),
@@ -494,7 +516,9 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
494
516
  "tabs",
495
517
  "class-name",
496
518
  "popup-style",
497
- "tab-moving"
519
+ "tab-moving",
520
+ "class-names",
521
+ "styles"
498
522
  ]),
499
523
  createVNode(ExtraContent_default, {
500
524
  ref_key: "extraRightRef",
@@ -502,12 +526,12 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
502
526
  position: "right",
503
527
  "prefix-cls": prefixCls.value,
504
528
  extra: unref(extra)
505
- }, null, 8, ["prefix-cls", "extra"]),
506
- createVNode(unref(RenderComponent), { render: unref(children) }, null, 8, ["render"])
529
+ }, null, 8, ["prefix-cls", "extra"])
507
530
  ], 46, _hoisted_1)]),
508
531
  _: 1
509
532
  });
510
533
  };
511
534
  }
512
535
  });
536
+ //#endregion
513
537
  export { index_vue_vue_type_script_setup_true_lang_default as default };
@@ -1,3 +1,5 @@
1
1
  import TabPane_vue_vue_type_script_setup_true_lang_default from "./TabPane.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/TabPanelList/TabPane.vue
2
3
  var TabPane_default = TabPane_vue_vue_type_script_setup_true_lang_default;
4
+ //#endregion
3
5
  export { TabPane_default as default };
@@ -1,6 +1,7 @@
1
1
  import { computed, createElementBlock, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, ref, unref, useSlots } from "vue";
2
2
  import RenderComponent from "@v-c/util/dist/RenderComponent";
3
3
  import { ensureValidVNode } from "@v-c/util/dist/vnode";
4
+ //#region src/TabPanelList/TabPane.vue?vue&type=script&setup=true&lang.ts
4
5
  var _hoisted_1 = [
5
6
  "id",
6
7
  "tabindex",
@@ -80,4 +81,5 @@ var TabPane_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
80
81
  };
81
82
  }
82
83
  });
84
+ //#endregion
83
85
  export { TabPane_vue_vue_type_script_setup_true_lang_default as default };
@@ -1,3 +1,5 @@
1
1
  import index_vue_vue_type_script_setup_true_lang_default from "./index.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/TabPanelList/index.vue
2
3
  var TabPanelList_default = index_vue_vue_type_script_setup_true_lang_default;
4
+ //#endregion
3
5
  export { TabPanelList_default as default };
@@ -3,6 +3,7 @@ import TabPane_default from "./TabPane.js";
3
3
  import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, normalizeClass, normalizeStyle, openBlock, renderList, toRefs, unref, vShow, withCtx, withDirectives } from "vue";
4
4
  import RenderComponent from "@v-c/util/dist/RenderComponent";
5
5
  import { getTransitionProps } from "@v-c/util/dist/utils/transition";
6
+ //#region src/TabPanelList/index.vue?vue&type=script&setup=true&lang.ts
6
7
  var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
7
8
  __name: "index",
8
9
  props: {
@@ -100,4 +101,5 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
100
101
  };
101
102
  }
102
103
  });
104
+ //#endregion
103
105
  export { index_vue_vue_type_script_setup_true_lang_default as default };
package/dist/Tabs.js CHANGED
@@ -1,3 +1,5 @@
1
1
  import Tabs_vue_vue_type_script_setup_true_lang_default from "./Tabs.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/Tabs.vue
2
3
  var Tabs_default = Tabs_vue_vue_type_script_setup_true_lang_default;
4
+ //#endregion
3
5
  export { Tabs_default as default };
@@ -8,6 +8,7 @@ import { clsx } from "@v-c/util";
8
8
  import useMergedState from "@v-c/util/dist/hooks/useMergedState";
9
9
  import isMobile from "@v-c/util/dist/isMobile";
10
10
  import omit from "@v-c/util/dist/omit";
11
+ //#region src/Tabs.vue?vue&type=script&setup=true&lang.ts
11
12
  var _hoisted_1 = ["id"];
12
13
  var Tabs_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
13
14
  name: "Tabs",
@@ -186,4 +187,5 @@ var Tabs_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
186
187
  };
187
188
  }
188
189
  });
190
+ //#endregion
189
191
  export { Tabs_vue_vue_type_script_setup_true_lang_default as default };
@@ -1,4 +1,5 @@
1
1
  import { warning } from "@v-c/util/dist/warning";
2
+ //#region src/hooks/useAnimateConfig.ts
2
3
  function useAnimateConfig(animated = {
3
4
  inkBar: true,
4
5
  tabPane: false
@@ -23,4 +24,5 @@ function useAnimateConfig(animated = {
23
24
  }
24
25
  return mergedAnimated;
25
26
  }
27
+ //#endregion
26
28
  export { useAnimateConfig as default };
@@ -1,5 +1,6 @@
1
1
  import { nextTick, onUnmounted, ref, watch } from "vue";
2
2
  import raf from "@v-c/util/dist/raf";
3
+ //#region src/hooks/useIndicator.ts
3
4
  function useIndicator(options) {
4
5
  const { activeTabOffset, horizontal, rtl, indicator } = options;
5
6
  const inkStyle = ref();
@@ -61,5 +62,5 @@ function useIndicator(options) {
61
62
  });
62
63
  return inkStyle;
63
64
  }
64
- var useIndicator_default = useIndicator;
65
- export { useIndicator_default as default };
65
+ //#endregion
66
+ export { useIndicator as default };
@@ -1,4 +1,5 @@
1
1
  import { shallowRef, watch } from "vue";
2
+ //#region src/hooks/useOffsets.ts
2
3
  var DEFAULT_SIZE = {
3
4
  width: 0,
4
5
  height: 0,
@@ -34,4 +35,5 @@ function useOffsets(tabs, tabSizes, holderScrollWidth) {
34
35
  }, { immediate: true });
35
36
  return mapRef;
36
37
  }
38
+ //#endregion
37
39
  export { useOffsets as default };
@@ -1,4 +1,5 @@
1
1
  import { onMounted, onUnmounted, ref } from "vue";
2
+ //#region src/hooks/useTouchMove.ts
2
3
  var MIN_SWIPE_DISTANCE = .1;
3
4
  var STOP_SWIPE_DISTANCE = .01;
4
5
  var REFRESH_INTERVAL = 20;
@@ -45,9 +46,7 @@ function useTouchMove(elRef, onOffset) {
45
46
  if (lo) {
46
47
  const distanceX = lo.x / (lastTimeDiff.value || 1);
47
48
  const distanceY = lo.y / (lastTimeDiff.value || 1);
48
- const absX = Math.abs(distanceX);
49
- const absY = Math.abs(distanceY);
50
- if (Math.max(absX, absY) < MIN_SWIPE_DISTANCE) return;
49
+ if (Math.max(Math.abs(distanceX), Math.abs(distanceY)) < MIN_SWIPE_DISTANCE) return;
51
50
  let currentX = distanceX;
52
51
  let currentY = distanceY;
53
52
  motionRef.value = window.setInterval(() => {
@@ -114,4 +113,5 @@ function useTouchMove(elRef, onOffset) {
114
113
  });
115
114
  });
116
115
  }
116
+ //#endregion
117
117
  export { useTouchMove as default };
@@ -1,4 +1,5 @@
1
1
  import { computed, shallowRef, watch } from "vue";
2
+ //#region src/hooks/useVisibleRange.ts
2
3
  var DEFAULT_SIZE = {
3
4
  width: 0,
4
5
  height: 0,
@@ -46,4 +47,5 @@ function useVisibleRange(tabOffsets, visibleTabContentValue, transform, tabConte
46
47
  }, { immediate: true });
47
48
  return rangeRef;
48
49
  }
50
+ //#endregion
49
51
  export { useVisibleRange as default };
package/dist/index.js CHANGED
@@ -1,3 +1,5 @@
1
1
  import Tabs_default from "./Tabs.js";
2
+ //#region src/index.ts
2
3
  var src_default = Tabs_default;
4
+ //#endregion
3
5
  export { src_default as default };
@@ -84,6 +84,8 @@ export interface OperationNodeProps {
84
84
  getPopupContainer?: (node: HTMLElement) => HTMLElement;
85
85
  popupClassName?: string;
86
86
  popupStyle?: CSSProperties;
87
+ classNames?: Partial<Record<'remove', string>>;
88
+ styles?: Partial<Record<'remove', CSSProperties>>;
87
89
  }
88
90
  export interface TabNodeProps {
89
91
  id: string | null;
@@ -107,10 +109,12 @@ export interface TabNodeProps {
107
109
  onBlur: FocusEventHandler;
108
110
  style?: CSSProperties;
109
111
  className?: string;
112
+ classNames?: Partial<Record<'item' | 'remove', string>>;
113
+ styles?: Partial<Record<'item' | 'remove', CSSProperties>>;
110
114
  }
111
115
  export type TabPosition = 'left' | 'right' | 'top' | 'bottom';
112
116
  export type GetIndicatorSize = number | ((origin: number) => number);
113
- export type SemanticName = string;
117
+ export type SemanticName = 'popup' | 'item' | 'indicator' | 'content' | 'header' | 'remove';
114
118
  export type RenderTabBar = (props: Record<string, any>, TabNavListComponent: any) => VueNode;
115
119
  export interface IndicatorConfig {
116
120
  size?: GetIndicatorSize;
package/dist/utils.js CHANGED
@@ -1,11 +1,16 @@
1
1
  import { isEmptyElement } from "@v-c/util/dist/props-util";
2
- const tabsGlobal = { uuid: 0 };
2
+ //#region src/utils.ts
3
+ var tabsGlobal = { uuid: 0 };
3
4
  function setUUid(uuid) {
4
5
  tabsGlobal.uuid = uuid;
5
6
  }
6
7
  function getUUid() {
7
8
  return tabsGlobal.uuid;
8
9
  }
10
+ /**
11
+ * We trade Map as deps which may change with same value but different ref object.
12
+ * We should make it as hash for deps
13
+ */
9
14
  function stringify(obj) {
10
15
  let tgt;
11
16
  if (obj instanceof Map) {
@@ -24,4 +29,5 @@ var VC_TABS_DOUBLE_QUOTE = "TABS_DQ";
24
29
  function genDataNodeKey(key) {
25
30
  return String(key).replace(/"/g, VC_TABS_DOUBLE_QUOTE);
26
31
  }
32
+ //#endregion
27
33
  export { genDataNodeKey, getRemovable, getUUid, setUUid, stringify, tabsGlobal };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@v-c/tabs",
3
3
  "type": "module",
4
- "version": "1.0.1",
4
+ "version": "1.1.0-rc.1",
5
5
  "description": "tabs ui component for react",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -32,11 +32,11 @@
32
32
  "vue": "^3.0.0"
33
33
  },
34
34
  "dependencies": {
35
- "@v-c/menu": "^1.0.7",
35
+ "@v-c/menu": "^1.1.0-rc.1",
36
36
  "@v-c/dropdown": "^1.0.2",
37
- "@v-c/overflow": "^1.0.3",
38
37
  "@v-c/resize-observer": "^1.0.8",
39
- "@v-c/util": "^1.0.9"
38
+ "@v-c/overflow": "^1.0.5",
39
+ "@v-c/util": "^1.0.19"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "vite build",