sard 1.0.29 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/README.md +1 -2
  2. package/all-components.js +4 -0
  3. package/components/action-sheet/action-sheet-item.vue.js +1 -1
  4. package/components/action-sheet/common.d.ts +1 -1
  5. package/components/button/button.vue.js +1 -1
  6. package/components/calendar-popout/common.d.ts +1 -1
  7. package/components/cascader-popout/common.d.ts +1 -1
  8. package/components/checkbox-popout/common.d.ts +1 -1
  9. package/components/color-picker-popout/common.d.ts +1 -1
  10. package/components/crop-image/common.d.ts +1 -1
  11. package/components/danmaku/common.d.ts +38 -0
  12. package/components/danmaku/common.js +14 -0
  13. package/components/danmaku/danmaku.vue.d.ts +23 -0
  14. package/components/danmaku/danmaku.vue.js +370 -0
  15. package/components/danmaku/index.css +1 -0
  16. package/components/danmaku/index.d.ts +5 -0
  17. package/components/danmaku/index.js +6 -0
  18. package/components/datetime-picker-popout/common.d.ts +1 -1
  19. package/components/datetime-range-picker-popout/common.d.ts +1 -1
  20. package/components/descriptions/common.d.ts +8 -3
  21. package/components/descriptions/descriptions-item.vue.d.ts +0 -2
  22. package/components/descriptions/descriptions-item.vue.js +20 -21
  23. package/components/descriptions/descriptions.vue.js +56 -28
  24. package/components/descriptions/index.css +1 -1
  25. package/components/dialog/common.d.ts +1 -1
  26. package/components/dnd/dnd-item.vue.js +19 -9
  27. package/components/dnd/index.css +1 -1
  28. package/components/dropdown/common.d.ts +1 -1
  29. package/components/ellipsis/ellipsis.vue.js +62 -58
  30. package/components/ellipsis/index.css +1 -1
  31. package/components/image/image.vue.d.ts +1 -1
  32. package/components/index.d.ts +2 -0
  33. package/components/index.js +3 -1
  34. package/components/keyboard/keyboard.vue.d.ts +1 -1
  35. package/components/keyboard-popout/common.d.ts +1 -1
  36. package/components/keyboard-popout/keyboard-popout.vue.d.ts +1 -1
  37. package/components/list/index.css +1 -1
  38. package/components/load-more/load-more.vue.js +2 -2
  39. package/components/loading/loading.vue.js +1 -1
  40. package/components/motion/motion.vue.js +1 -1
  41. package/components/notify/common.d.ts +1 -1
  42. package/components/overlay/overlay.vue.js +6 -5
  43. package/components/picker/picker.vue.js +8 -5
  44. package/components/picker-popout/common.d.ts +1 -1
  45. package/components/picker-view/common.d.ts +22 -2
  46. package/components/picker-view/index.d.ts +2 -2
  47. package/components/picker-view/index.js +2 -2
  48. package/components/picker-view/picker-view-column.vue.d.ts +19 -0
  49. package/components/picker-view/picker-view-column.vue.js +167 -0
  50. package/components/picker-view/picker-view.vue.d.ts +55 -0
  51. package/components/picker-view/picker-view.vue.js +60 -0
  52. package/components/popout/common.d.ts +1 -1
  53. package/components/popout/popout.vue.js +2 -4
  54. package/components/popover/common.js +1 -1
  55. package/components/popover/popover.vue.js +11 -10
  56. package/components/popup/popup.vue.js +1 -1
  57. package/components/preview-image/common.d.ts +1 -1
  58. package/components/preview-image/preview-image.vue.d.ts +1 -1
  59. package/components/preview-image/preview-image.vue.js +4 -4
  60. package/components/pull-down-refresh/pull-down-refresh.vue.js +4 -7
  61. package/components/radio-popout/common.d.ts +1 -1
  62. package/components/rate/rate.vue.js +2 -2
  63. package/components/select-popout/common.d.ts +1 -1
  64. package/components/share-sheet/common.d.ts +1 -1
  65. package/components/skeleton/skeleton.vue.js +1 -1
  66. package/components/swiper/index.d.ts +2 -2
  67. package/components/swiper/index.js +2 -2
  68. package/components/swiper/swiper-item.vue.d.ts +11 -0
  69. package/components/swiper/swiper-item.vue.js +32 -0
  70. package/components/swiper/swiper.vue.d.ts +147 -0
  71. package/components/swiper/swiper.vue.js +51 -0
  72. package/components/swiper/useSwiper.d.ts +1 -2
  73. package/components/swiper/useSwiper.js +12 -12
  74. package/components/table/table.vue.js +1 -2
  75. package/components/text-shrink/common.d.ts +28 -0
  76. package/components/text-shrink/common.js +8 -0
  77. package/components/text-shrink/index.css +1 -0
  78. package/components/text-shrink/index.d.ts +5 -0
  79. package/components/text-shrink/index.js +6 -0
  80. package/components/text-shrink/text-shrink.vue.d.ts +16 -0
  81. package/components/text-shrink/text-shrink.vue.js +252 -0
  82. package/components/toast/common.d.ts +1 -1
  83. package/global.d.ts +2 -0
  84. package/index.css +1 -1
  85. package/index.js +3 -2
  86. package/package.json +1 -1
  87. package/utils/createImperativeComponent.d.ts +12 -5
  88. package/utils/createImperativeComponent.js +13 -37
  89. package/utils/imperative/agent-runtime.d.ts +28 -0
  90. package/utils/imperative/agent-runtime.js +33 -0
  91. package/utils/imperative/imperative-agent.vue.d.ts +35 -0
  92. package/utils/imperative/imperative-agent.vue.js +60 -0
  93. package/utils/index.d.ts +0 -1
  94. package/utils/index.js +1 -2
  95. package/utils/is.d.ts +4 -1
  96. package/utils/is.js +5 -3
  97. package/utils/number.d.ts +1 -1
  98. package/utils/number.js +20 -19
  99. package/components/picker-view/picker-view-column.d.ts +0 -3
  100. package/components/picker-view/picker-view-column.js +0 -139
  101. package/components/picker-view/picker-view.d.ts +0 -21
  102. package/components/picker-view/picker-view.js +0 -57
  103. package/components/swiper/swiper-item.d.ts +0 -3
  104. package/components/swiper/swiper-item.js +0 -34
  105. package/components/swiper/swiper.d.ts +0 -57
  106. package/components/swiper/swiper.js +0 -43
  107. package/utils/vnode.d.ts +0 -9
  108. package/utils/vnode.js +0 -69
@@ -151,10 +151,7 @@ var pull_down_refresh_default = /*@__PURE__*/ defineComponent({
151
151
  }, [createElementVNode("div", {
152
152
  class: normalizeClass(unref(bem).e("header")),
153
153
  style: normalizeStyle(headerStyle.value)
154
- }, [status.value === "unready" ? renderSlot(_ctx.$slots, "unready", {
155
- key: 0,
156
- progress: progress.value
157
- }, () => [createVNode(loading_default, {
154
+ }, [status.value === "unready" ? renderSlot(_ctx.$slots, "unready", { progress: progress.value }, () => [createVNode(loading_default, {
158
155
  type: "clock",
159
156
  size: "16px",
160
157
  animated: false,
@@ -162,20 +159,20 @@ var pull_down_refresh_default = /*@__PURE__*/ defineComponent({
162
159
  }, {
163
160
  default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("unready")), 1)]),
164
161
  _: 1
165
- }, 8, ["progress"])]) : status.value === "ready" ? renderSlot(_ctx.$slots, "ready", { key: 1 }, () => [createVNode(loading_default, {
162
+ }, 8, ["progress"])], void 0, 0) : status.value === "ready" ? renderSlot(_ctx.$slots, "ready", {}, () => [createVNode(loading_default, {
166
163
  type: "clock",
167
164
  size: "16px",
168
165
  animated: false
169
166
  }, {
170
167
  default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("ready")), 1)]),
171
168
  _: 1
172
- })]) : status.value === "loading" ? renderSlot(_ctx.$slots, "loading", { key: 2 }, () => [createVNode(loading_default, {
169
+ })], void 0, 1) : status.value === "loading" ? renderSlot(_ctx.$slots, "loading", {}, () => [createVNode(loading_default, {
173
170
  type: "clock",
174
171
  size: "16px"
175
172
  }, {
176
173
  default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("loading")), 1)]),
177
174
  _: 1
178
- })]) : status.value === "done" ? renderSlot(_ctx.$slots, "done", { key: 3 }, () => [createTextVNode(toDisplayString(__props.error ? unref(t)("doneFail") : unref(t)("doneSuccess")), 1)]) : createCommentVNode("v-if", true)], 6), renderSlot(_ctx.$slots, "default")], 38)], 2);
175
+ })], void 0, 2) : status.value === "done" ? renderSlot(_ctx.$slots, "done", {}, () => [createTextVNode(toDisplayString(__props.error ? unref(t)("doneFail") : unref(t)("doneSuccess")), 1)], void 0, 3) : createCommentVNode("v-if", true)], 6), renderSlot(_ctx.$slots, "default")], 38)], 2);
179
176
  };
180
177
  }
181
178
  });
@@ -1,7 +1,7 @@
1
1
  import { type RadioGroupProps } from '../radio/common';
2
2
  import { type DefaultProps } from '../config';
3
3
  import { type FormPopoutProps } from '../popout/useFormPopout';
4
- import type { MotionEmits } from '../motion';
4
+ import type { MotionEmits } from '../motion/common';
5
5
  export interface RadioPopoutProps extends FormPopoutProps, RadioGroupProps {
6
6
  searchable?: boolean;
7
7
  filterPlaceholder?: string;
@@ -175,13 +175,13 @@ var rate_default = /*@__PURE__*/ defineComponent({
175
175
  }, [createElementVNode("div", {
176
176
  class: normalizeClass(unref(bem).e("void-star")),
177
177
  style: normalizeStyle({ color: isDisabled.value ? void 0 : __props.voidColor })
178
- }, [__props.voidText || slots["void-star"] ? renderSlot(_ctx.$slots, "void-star", { key: 0 }, () => [createTextVNode(toDisplayString(__props.voidText), 1)]) : (openBlock(), createBlock(unref(Star), { key: 1 }))], 6), createElementVNode("div", {
178
+ }, [__props.voidText || slots["void-star"] ? renderSlot(_ctx.$slots, "void-star", {}, () => [createTextVNode(toDisplayString(__props.voidText), 1)], void 0, 0) : (openBlock(), createBlock(unref(Star), { key: 1 }))], 6), createElementVNode("div", {
179
179
  class: normalizeClass(unref(bem).e("star")),
180
180
  style: normalizeStyle({
181
181
  color: isDisabled.value ? void 0 : __props.color,
182
182
  width: item.width
183
183
  })
184
- }, [__props.text || slots["star"] ? renderSlot(_ctx.$slots, "star", { key: 0 }, () => [createTextVNode(toDisplayString(__props.text), 1)]) : (openBlock(), createBlock(unref(StarFill), { key: 1 }))], 6)], 14, _hoisted_1);
184
+ }, [__props.text || slots["star"] ? renderSlot(_ctx.$slots, "star", {}, () => [createTextVNode(toDisplayString(__props.text), 1)], void 0, 0) : (openBlock(), createBlock(unref(StarFill), { key: 1 }))], 6)], 14, _hoisted_1);
185
185
  }), 128))], 38)], 2);
186
186
  };
187
187
  }
@@ -1,7 +1,7 @@
1
1
  import { type DefaultProps } from '../config';
2
2
  import { type SelectSlots, type SelectProps, type SelectEmits, type SelectExpose } from '../select/common';
3
3
  import { type FormPopoutProps } from '../popout/useFormPopout';
4
- import type { MotionEmits } from '../motion';
4
+ import type { MotionEmits } from '../motion/common';
5
5
  export interface SelectPopoutProps extends FormPopoutProps, SelectProps {
6
6
  }
7
7
  export declare const defaultSelectPopoutProps: DefaultProps<SelectPopoutProps>;
@@ -1,5 +1,5 @@
1
1
  import { type DefaultProps } from '../config';
2
- import type { MotionEmits } from '../motion';
2
+ import type { MotionEmits } from '../motion/common';
3
3
  export interface ShareSheetbeforeClose {
4
4
  (type: 'close' | 'cancel' | 'select'): boolean | Promise<any>;
5
5
  }
@@ -68,7 +68,7 @@ var skeleton_default = /*@__PURE__*/ defineComponent({
68
68
  "rows",
69
69
  "animated",
70
70
  "round"
71
- ])], 2)], 2)) : renderSlot(_ctx.$slots, "default", { key: 1 });
71
+ ])], 2)], 2)) : renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 1);
72
72
  };
73
73
  }
74
74
  });
@@ -1,6 +1,6 @@
1
1
  import { type EnhancedComponent } from '../../utils';
2
- import _Swiper from './swiper';
3
- import _SwiperItem from './swiper-item';
2
+ import _Swiper from './swiper.vue';
3
+ import _SwiperItem from './swiper-item.vue';
4
4
  export declare const Swiper: EnhancedComponent<typeof _Swiper>;
5
5
  export declare const SwiperItem: EnhancedComponent<typeof _SwiperItem>;
6
6
  export default Swiper;
@@ -1,7 +1,7 @@
1
1
  import { enhanceComponent } from "../../utils/component.js";
2
2
  import { ADD_SWIPER_CONTEXT_KEY, REMOVE_SWIPER_CONTEXT_KEY, SWIPER_AUTO_HEIGHT_KEY } from "./common.js";
3
- import swiper_default from "./swiper.js";
4
- import swiper_item_default from "./swiper-item.js";
3
+ import swiper_default from "./swiper.vue.js";
4
+ import swiper_item_default from "./swiper-item.vue.js";
5
5
  //#region packages/sard/components/swiper/index.ts
6
6
  const Swiper = enhanceComponent(swiper_default);
7
7
  const SwiperItem = enhanceComponent(swiper_item_default);
@@ -0,0 +1,11 @@
1
+ import type { SwiperItemSlots } from './common';
2
+ type __VLS_Slots = SwiperItemSlots;
3
+ declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
4
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
5
+ declare const _default: typeof __VLS_export;
6
+ export default _default;
7
+ type __VLS_WithSlots<T, S> = T & {
8
+ new (): {
9
+ $slots: S;
10
+ };
11
+ };
@@ -0,0 +1,32 @@
1
+ import { createBem } from "../../utils/bem.js";
2
+ import { useSwiperItem } from "./useSwiper.js";
3
+ import { createElementBlock, defineComponent, normalizeClass, openBlock, renderSlot, unref, watchPostEffect } from "vue";
4
+ //#region packages/sard/components/swiper/swiper-item.vue
5
+ var swiper_item_default = /*@__PURE__*/ defineComponent({
6
+ __name: "swiper-item",
7
+ setup(__props) {
8
+ const bem = createBem("swiper");
9
+ const { elRef, member, context: { vertical, spaceBetween, autoHeight } } = useSwiperItem();
10
+ watchPostEffect(() => {
11
+ const el = elRef.value;
12
+ if (el) {
13
+ el.style.setProperty("--swiper-item-offset-raw", member.offset + "px");
14
+ el.style.setProperty("--swiper-item-size", member.size + "px");
15
+ el.style.setProperty("--swiper-item-margin", spaceBetween.value + "px");
16
+ }
17
+ });
18
+ return (_ctx, _cache) => {
19
+ return openBlock(), createElementBlock("div", {
20
+ ref_key: "elRef",
21
+ ref: elRef,
22
+ class: normalizeClass([
23
+ unref(bem).e("item"),
24
+ unref(bem).is("vertical", unref(vertical)),
25
+ unref(bem).is("auto-height", unref(autoHeight))
26
+ ])
27
+ }, [renderSlot(_ctx.$slots, "default")], 2);
28
+ };
29
+ }
30
+ });
31
+ //#endregion
32
+ export { swiper_item_default as default };
@@ -0,0 +1,147 @@
1
+ import { type SwiperSlots } from './common';
2
+ type __VLS_Slots = SwiperSlots;
3
+ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ modelValue: {
5
+ type: NumberConstructor;
6
+ default: number;
7
+ };
8
+ showIndicator: {
9
+ type: BooleanConstructor;
10
+ default: boolean;
11
+ };
12
+ vertical: {
13
+ type: BooleanConstructor;
14
+ default: boolean;
15
+ };
16
+ speed: {
17
+ type: NumberConstructor;
18
+ default: number;
19
+ };
20
+ autoplay: {
21
+ type: BooleanConstructor;
22
+ default: boolean;
23
+ };
24
+ delay: {
25
+ type: NumberConstructor;
26
+ default: number;
27
+ };
28
+ loop: {
29
+ type: BooleanConstructor;
30
+ default: boolean;
31
+ };
32
+ slidesPerView: {
33
+ type: NumberConstructor;
34
+ default: number;
35
+ };
36
+ slidesPerGroup: {
37
+ type: NumberConstructor;
38
+ default: number;
39
+ };
40
+ spaceBetween: {
41
+ type: NumberConstructor;
42
+ default: number;
43
+ };
44
+ centeredSlides: {
45
+ type: BooleanConstructor;
46
+ default: boolean;
47
+ };
48
+ allowTouchMove: {
49
+ type: BooleanConstructor;
50
+ default: boolean;
51
+ };
52
+ autoHeight: {
53
+ type: BooleanConstructor;
54
+ default: boolean;
55
+ };
56
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
57
+ change: (value: number) => any;
58
+ transition: (event: {
59
+ dx: number;
60
+ dy: number;
61
+ }) => any;
62
+ "update:modelValue": (value: number) => any;
63
+ animationfinish: (value: number) => any;
64
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
65
+ modelValue: {
66
+ type: NumberConstructor;
67
+ default: number;
68
+ };
69
+ showIndicator: {
70
+ type: BooleanConstructor;
71
+ default: boolean;
72
+ };
73
+ vertical: {
74
+ type: BooleanConstructor;
75
+ default: boolean;
76
+ };
77
+ speed: {
78
+ type: NumberConstructor;
79
+ default: number;
80
+ };
81
+ autoplay: {
82
+ type: BooleanConstructor;
83
+ default: boolean;
84
+ };
85
+ delay: {
86
+ type: NumberConstructor;
87
+ default: number;
88
+ };
89
+ loop: {
90
+ type: BooleanConstructor;
91
+ default: boolean;
92
+ };
93
+ slidesPerView: {
94
+ type: NumberConstructor;
95
+ default: number;
96
+ };
97
+ slidesPerGroup: {
98
+ type: NumberConstructor;
99
+ default: number;
100
+ };
101
+ spaceBetween: {
102
+ type: NumberConstructor;
103
+ default: number;
104
+ };
105
+ centeredSlides: {
106
+ type: BooleanConstructor;
107
+ default: boolean;
108
+ };
109
+ allowTouchMove: {
110
+ type: BooleanConstructor;
111
+ default: boolean;
112
+ };
113
+ autoHeight: {
114
+ type: BooleanConstructor;
115
+ default: boolean;
116
+ };
117
+ }>> & Readonly<{
118
+ onChange?: ((value: number) => any) | undefined;
119
+ onTransition?: ((event: {
120
+ dx: number;
121
+ dy: number;
122
+ }) => any) | undefined;
123
+ "onUpdate:modelValue"?: ((value: number) => any) | undefined;
124
+ onAnimationfinish?: ((value: number) => any) | undefined;
125
+ }>, {
126
+ vertical: boolean;
127
+ modelValue: number;
128
+ autoHeight: boolean;
129
+ speed: number;
130
+ loop: boolean;
131
+ showIndicator: boolean;
132
+ autoplay: boolean;
133
+ delay: number;
134
+ slidesPerView: number;
135
+ slidesPerGroup: number;
136
+ spaceBetween: number;
137
+ centeredSlides: boolean;
138
+ allowTouchMove: boolean;
139
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
140
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
141
+ declare const _default: typeof __VLS_export;
142
+ export default _default;
143
+ type __VLS_WithSlots<T, S> = T & {
144
+ new (): {
145
+ $slots: S;
146
+ };
147
+ };
@@ -0,0 +1,51 @@
1
+ import { createBem } from "../../utils/bem.js";
2
+ import { swiperProps } from "./common.js";
3
+ import { useSwiper } from "./useSwiper.js";
4
+ import { Fragment, createCommentVNode, createElementBlock, createElementVNode, defineComponent, normalizeClass, openBlock, renderList, renderSlot, unref } from "vue";
5
+ //#region packages/sard/components/swiper/swiper.vue
6
+ var swiper_default = /*@__PURE__*/ defineComponent({
7
+ __name: "swiper",
8
+ props: swiperProps,
9
+ emits: [
10
+ "change",
11
+ "transition",
12
+ "animationfinish",
13
+ "update:modelValue"
14
+ ],
15
+ setup(__props, { emit: __emit }) {
16
+ const props = __props;
17
+ const emit = __emit;
18
+ const bem = createBem("swiper");
19
+ const { rootRef, wrapperRef, activeIndex, pageCount, onTouchStart, onTouchMove, onTouchEnd, onPointerDown } = useSwiper(props, emit);
20
+ return (_ctx, _cache) => {
21
+ return openBlock(), createElementBlock("div", {
22
+ ref_key: "rootRef",
23
+ ref: rootRef,
24
+ class: normalizeClass([
25
+ unref(bem).b(),
26
+ unref(bem).m("vertical", _ctx.vertical),
27
+ unref(bem).is("auto-height", _ctx.autoHeight)
28
+ ]),
29
+ onTouchstart: _cache[0] || (_cache[0] = (...args) => unref(onTouchStart) && unref(onTouchStart)(...args)),
30
+ onTouchmove: _cache[1] || (_cache[1] = (...args) => unref(onTouchMove) && unref(onTouchMove)(...args)),
31
+ onTouchend: _cache[2] || (_cache[2] = (...args) => unref(onTouchEnd) && unref(onTouchEnd)(...args)),
32
+ onTouchcancel: _cache[3] || (_cache[3] = (...args) => unref(onTouchEnd) && unref(onTouchEnd)(...args)),
33
+ onPointerdown: _cache[4] || (_cache[4] = (...args) => unref(onPointerDown) && unref(onPointerDown)(...args))
34
+ }, [createElementVNode("div", {
35
+ ref_key: "wrapperRef",
36
+ ref: wrapperRef,
37
+ class: normalizeClass([unref(bem).e("wrapper"), unref(bem).is("vertical", _ctx.vertical)])
38
+ }, [renderSlot(_ctx.$slots, "default")], 2), _ctx.showIndicator ? (openBlock(), createElementBlock("div", {
39
+ key: 0,
40
+ class: normalizeClass([unref(bem).e("dots"), unref(bem).is("vertical", _ctx.vertical)])
41
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(pageCount), (index) => {
42
+ return openBlock(), createElementBlock("div", {
43
+ key: index,
44
+ class: normalizeClass([unref(bem).e("dot"), unref(bem).is("active", unref(activeIndex) === index - 1)])
45
+ }, null, 2);
46
+ }), 128))], 2)) : createCommentVNode("v-if", true)], 34);
47
+ };
48
+ }
49
+ });
50
+ //#endregion
51
+ export { swiper_default as default };
@@ -1,4 +1,4 @@
1
- import { type Ref, type VNode } from 'vue';
1
+ import { type Ref } from 'vue';
2
2
  import { type SwiperSlideData } from './useSwiperData';
3
3
  import type { SwiperEmits, SwiperPrivateProps } from './common';
4
4
  type SwiperMember = SwiperSlideData;
@@ -15,7 +15,6 @@ export declare function useSwiper(props: SwiperPrivateProps, emit: SwiperEmits):
15
15
  members: import("vue").ShallowRef<SwiperSlideData[], SwiperSlideData[]>;
16
16
  activeIndex: Ref<number, number>;
17
17
  pageCount: import("vue").ComputedRef<number>;
18
- setSwiperItems: (_swiperItems: VNode[]) => void;
19
18
  onTouchStart: (event: TouchEvent) => void;
20
19
  onTouchMove: (event: TouchEvent) => void;
21
20
  onTouchEnd: () => void;
@@ -17,17 +17,21 @@ function useSwiper(props, emit) {
17
17
  const rootRef = ref(null);
18
18
  const wrapperRef = ref(null);
19
19
  const isRtl = useRtl();
20
- let swiperItems = [];
21
20
  const members = shallowRef([]);
22
21
  function updateMembers(rawMembers) {
23
- const _members = [];
24
- for (let i = 0; i < swiperItems.length; i++) {
25
- let swiperItem = swiperItems[i];
26
- if (!(swiperItem instanceof Element)) swiperItem = swiperItem.el;
27
- const member = rawMembers.find((member) => swiperItem === member.el);
28
- if (member) _members.push(member);
22
+ const uniqueMembers = [];
23
+ const seen = /* @__PURE__ */ new Set();
24
+ for (const member of rawMembers) {
25
+ const el = member.el;
26
+ if (el && !seen.has(el)) {
27
+ seen.add(el);
28
+ uniqueMembers.push(member);
29
+ }
29
30
  }
30
- members.value = _members;
31
+ uniqueMembers.sort((a, b) => {
32
+ return a.el.compareDocumentPosition(b.el) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
33
+ });
34
+ members.value = uniqueMembers;
31
35
  }
32
36
  provide(swiperContextKey, {
33
37
  autoHeight: toRef(() => props.autoHeight),
@@ -40,9 +44,6 @@ function useSwiper(props, emit) {
40
44
  updateMembers(members.value.filter((m) => m !== member));
41
45
  }
42
46
  });
43
- const setSwiperItems = (_swiperItems) => {
44
- swiperItems = _swiperItems;
45
- };
46
47
  const { offset, swiperSize, startEdge, endEdge, activeIndex, slidesPerView, slidesPerGroup, spaceBetween, centeredSlides, pageCount, loop, slides, setSlides, getNearestOffset, getPreviousNearestOffset, getNextNearestOffset, getNextIndexOffset, normalizeLoopOffset, snapTo } = useSwiperData();
47
48
  watchSyncEffect(() => {
48
49
  slidesPerView.value = props.slidesPerView;
@@ -159,7 +160,6 @@ function useSwiper(props, emit) {
159
160
  members,
160
161
  activeIndex,
161
162
  pageCount,
162
- setSwiperItems,
163
163
  onTouchStart,
164
164
  onTouchMove,
165
165
  onTouchEnd,
@@ -381,12 +381,11 @@ var table_default = /*@__PURE__*/ defineComponent({
381
381
  style: normalizeStyle(getCellStyle(cell.row, cell.rowIndex, cell.column, cell.columnIndex)),
382
382
  class: normalizeClass(getCellClassName(cell.row, cell.rowIndex, cell.column, cell.columnIndex))
383
383
  }, [cell.column.slot && _ctx.$slots[cell.column.slot] ? renderSlot(_ctx.$slots, cell.column.slot, {
384
- key: 0,
385
384
  row: cell.row,
386
385
  column: cell.column,
387
386
  rowIndex: cell.rowIndex,
388
387
  columnIndex: cell.columnIndex
389
- }) : cell.column.formatter ? (openBlock(), createBlock(resolveDynamicComponent(() => cell.column.formatter({
388
+ }, void 0, void 0, 0) : cell.column.formatter ? (openBlock(), createBlock(resolveDynamicComponent(() => cell.column.formatter({
390
389
  row: cell.row,
391
390
  rowIndex: cell.rowIndex,
392
391
  column: cell.column,
@@ -0,0 +1,28 @@
1
+ import { type Ref } from 'vue';
2
+ import { type DefaultProps } from '../config';
3
+ export interface TextShrinkProps {
4
+ /** 要渲染的纯文本,不解析 HTML */
5
+ text?: string;
6
+ /** 允许渲染的最大行数,1 表示单行不换行 */
7
+ maxLines?: number;
8
+ /** 字号上界(px);不传时在首次适配时读取根元素 computed font-size 并固化 */
9
+ baseFontSize?: number;
10
+ /**
11
+ * 缩放下限(px),默认 1。
12
+ * 需要在小于等于该字号时才放得下时,不再继续缩小,停在该字号并显示省略号。
13
+ */
14
+ minFontSize?: number;
15
+ }
16
+ export declare const defaultTextShrinkProps: DefaultProps<TextShrinkProps>;
17
+ export interface TextShrinkSlots {
18
+ }
19
+ export interface TextShrinkEmits {
20
+ }
21
+ export interface TextShrinkExpose {
22
+ /** 当前生效的字号(px),首次适配完成前为 undefined */
23
+ fontSize: Ref<number | undefined>;
24
+ /** 是否已停在缩放下限仍溢出(此时按 maxLines 截断) */
25
+ overflow: Ref<boolean>;
26
+ /** 手动触发一次重新适配(在下一帧执行) */
27
+ refit: () => void;
28
+ }
@@ -0,0 +1,8 @@
1
+ //#region packages/sard/components/text-shrink/common.ts
2
+ const defaultTextShrinkProps = {
3
+ text: "",
4
+ maxLines: 1,
5
+ minFontSize: 1
6
+ };
7
+ //#endregion
8
+ export { defaultTextShrinkProps };
@@ -0,0 +1 @@
1
+ .s-text-shrink{position:relative;display:block;min-width:0}.s-text-shrink:is(.is-measuring){visibility:hidden}.s-text-shrink__text{position:relative;display:block;overflow:hidden;word-break:normal;overflow-wrap:break-word}.s-text-shrink__text--nowrap{white-space:nowrap;text-overflow:ellipsis}.s-text-shrink__text--clamp{display:-webkit-box;-webkit-box-orient:vertical}.s-text-shrink__measure{position:absolute;top:0;left:0;z-index:-1;box-sizing:border-box;width:100%;padding:inherit;overflow:visible;visibility:hidden;pointer-events:none;contain:layout style}
@@ -0,0 +1,5 @@
1
+ import { type EnhancedComponent } from '../../utils';
2
+ import _TextShrink from './text-shrink.vue';
3
+ export declare const TextShrink: EnhancedComponent<typeof _TextShrink>;
4
+ export default TextShrink;
5
+ export type { TextShrinkProps, TextShrinkSlots, TextShrinkEmits, TextShrinkExpose } from './common';
@@ -0,0 +1,6 @@
1
+ import { enhanceComponent } from "../../utils/component.js";
2
+ import text_shrink_default from "./text-shrink.vue.js";
3
+ //#region packages/sard/components/text-shrink/index.ts
4
+ const TextShrink = enhanceComponent(text_shrink_default);
5
+ //#endregion
6
+ export { TextShrink, TextShrink as default };
@@ -0,0 +1,16 @@
1
+ import { type TextShrinkExpose, type TextShrinkProps, type TextShrinkSlots } from './common';
2
+ type __VLS_Slots = TextShrinkSlots;
3
+ declare const __VLS_base: import("vue").DefineComponent<TextShrinkProps, TextShrinkExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TextShrinkProps> & Readonly<{}>, {
4
+ text: string;
5
+ maxLines: number;
6
+ baseFontSize: number;
7
+ minFontSize: number;
8
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
12
+ type __VLS_WithSlots<T, S> = T & {
13
+ new (): {
14
+ $slots: S;
15
+ };
16
+ };