sard 1.1.0 → 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 (99) hide show
  1. package/README.md +1 -2
  2. package/all-components.js +2 -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/datetime-picker-popout/common.d.ts +1 -1
  12. package/components/datetime-range-picker-popout/common.d.ts +1 -1
  13. package/components/descriptions/common.d.ts +8 -3
  14. package/components/descriptions/descriptions-item.vue.d.ts +0 -2
  15. package/components/descriptions/descriptions-item.vue.js +20 -21
  16. package/components/descriptions/descriptions.vue.js +56 -28
  17. package/components/descriptions/index.css +1 -1
  18. package/components/dialog/common.d.ts +1 -1
  19. package/components/dnd/dnd-item.vue.js +19 -9
  20. package/components/dnd/index.css +1 -1
  21. package/components/dropdown/common.d.ts +1 -1
  22. package/components/ellipsis/ellipsis.vue.js +62 -58
  23. package/components/ellipsis/index.css +1 -1
  24. package/components/image/image.vue.d.ts +1 -1
  25. package/components/index.d.ts +1 -0
  26. package/components/index.js +2 -1
  27. package/components/keyboard/keyboard.vue.d.ts +1 -1
  28. package/components/keyboard-popout/common.d.ts +1 -1
  29. package/components/keyboard-popout/keyboard-popout.vue.d.ts +1 -1
  30. package/components/list/index.css +1 -1
  31. package/components/load-more/load-more.vue.js +2 -2
  32. package/components/loading/loading.vue.js +1 -1
  33. package/components/motion/motion.vue.js +1 -1
  34. package/components/notify/common.d.ts +1 -1
  35. package/components/overlay/overlay.vue.js +6 -5
  36. package/components/picker/picker.vue.js +8 -5
  37. package/components/picker-popout/common.d.ts +1 -1
  38. package/components/picker-view/common.d.ts +22 -2
  39. package/components/picker-view/index.d.ts +2 -2
  40. package/components/picker-view/index.js +2 -2
  41. package/components/picker-view/picker-view-column.vue.d.ts +19 -0
  42. package/components/picker-view/picker-view-column.vue.js +167 -0
  43. package/components/picker-view/picker-view.vue.d.ts +55 -0
  44. package/components/picker-view/picker-view.vue.js +60 -0
  45. package/components/popout/common.d.ts +1 -1
  46. package/components/popout/popout.vue.js +2 -4
  47. package/components/popover/popover.vue.js +11 -10
  48. package/components/popup/popup.vue.js +1 -1
  49. package/components/preview-image/common.d.ts +1 -1
  50. package/components/preview-image/preview-image.vue.js +4 -4
  51. package/components/pull-down-refresh/pull-down-refresh.vue.js +4 -7
  52. package/components/radio-popout/common.d.ts +1 -1
  53. package/components/rate/rate.vue.js +2 -2
  54. package/components/select-popout/common.d.ts +1 -1
  55. package/components/share-sheet/common.d.ts +1 -1
  56. package/components/skeleton/skeleton.vue.js +1 -1
  57. package/components/swiper/index.d.ts +2 -2
  58. package/components/swiper/index.js +2 -2
  59. package/components/swiper/swiper-item.vue.d.ts +11 -0
  60. package/components/swiper/swiper-item.vue.js +32 -0
  61. package/components/swiper/swiper.vue.d.ts +147 -0
  62. package/components/swiper/swiper.vue.js +51 -0
  63. package/components/swiper/useSwiper.d.ts +1 -2
  64. package/components/swiper/useSwiper.js +12 -12
  65. package/components/table/table.vue.js +1 -2
  66. package/components/text-shrink/common.d.ts +28 -0
  67. package/components/text-shrink/common.js +8 -0
  68. package/components/text-shrink/index.css +1 -0
  69. package/components/text-shrink/index.d.ts +5 -0
  70. package/components/text-shrink/index.js +6 -0
  71. package/components/text-shrink/text-shrink.vue.d.ts +16 -0
  72. package/components/text-shrink/text-shrink.vue.js +252 -0
  73. package/components/toast/common.d.ts +1 -1
  74. package/global.d.ts +1 -0
  75. package/index.css +1 -1
  76. package/index.js +2 -2
  77. package/package.json +1 -1
  78. package/utils/createImperativeComponent.d.ts +12 -5
  79. package/utils/createImperativeComponent.js +13 -37
  80. package/utils/imperative/agent-runtime.d.ts +28 -0
  81. package/utils/imperative/agent-runtime.js +33 -0
  82. package/utils/imperative/imperative-agent.vue.d.ts +35 -0
  83. package/utils/imperative/imperative-agent.vue.js +60 -0
  84. package/utils/index.d.ts +0 -1
  85. package/utils/index.js +1 -2
  86. package/utils/is.d.ts +4 -1
  87. package/utils/is.js +5 -3
  88. package/utils/number.d.ts +1 -1
  89. package/utils/number.js +20 -19
  90. package/components/picker-view/picker-view-column.d.ts +0 -3
  91. package/components/picker-view/picker-view-column.js +0 -139
  92. package/components/picker-view/picker-view.d.ts +0 -21
  93. package/components/picker-view/picker-view.js +0 -57
  94. package/components/swiper/swiper-item.d.ts +0 -3
  95. package/components/swiper/swiper-item.js +0 -34
  96. package/components/swiper/swiper.d.ts +0 -57
  97. package/components/swiper/swiper.js +0 -43
  98. package/utils/vnode.d.ts +0 -9
  99. package/utils/vnode.js +0 -69
@@ -0,0 +1,167 @@
1
+ import { createBem } from "../../utils/bem.js";
2
+ import { Friction } from "../../utils/scroller/Friction.js";
3
+ import { Spring } from "../../utils/scroller/Spring.js";
4
+ import { usePointerDown } from "../../use/usePointerDown.js";
5
+ import { useResizeObserver } from "../../use/useResizeObserver.js";
6
+ import { useScroller } from "../../utils/scroller/useScroller.js";
7
+ import { pickerViewContextKey } from "./common.js";
8
+ import { computed, createElementBlock, createElementVNode, defineComponent, inject, normalizeClass, normalizeStyle, onUnmounted, openBlock, ref, renderSlot, unref, watch, watchPostEffect } from "vue";
9
+ //#region packages/sard/components/picker-view/picker-view-column.vue
10
+ var picker_view_column_default = /*@__PURE__*/ defineComponent({
11
+ __name: "picker-view-column",
12
+ props: { itemCount: {
13
+ type: Number,
14
+ required: false
15
+ } },
16
+ setup(__props) {
17
+ const props = __props;
18
+ const bem = createBem("picker-view-column");
19
+ const handle = { __pickerViewColumn: true };
20
+ const rootRef = ref(null);
21
+ const contentRef = ref(null);
22
+ const indicatorRef = ref(null);
23
+ const context = inject(pickerViewContextKey);
24
+ context.registerColumn(handle);
25
+ onUnmounted(() => {
26
+ context.unregisterColumn(handle);
27
+ });
28
+ const columnValue = context.getColumnValue(handle);
29
+ const domItemCount = ref(0);
30
+ const itemCount = computed(() => props.itemCount ?? domItemCount.value);
31
+ const updateItemCount = () => {
32
+ domItemCount.value = contentRef.value?.children.length ?? 0;
33
+ };
34
+ let contentObserver = null;
35
+ watch(contentRef, (el, _oldEl, onCleanup) => {
36
+ contentObserver?.disconnect();
37
+ contentObserver = null;
38
+ if (!el) return;
39
+ updateItemCount();
40
+ contentObserver = new MutationObserver(updateItemCount);
41
+ contentObserver.observe(el, { childList: true });
42
+ onCleanup(() => {
43
+ contentObserver?.disconnect();
44
+ contentObserver = null;
45
+ });
46
+ }, {
47
+ immediate: true,
48
+ flush: "post"
49
+ });
50
+ const rootSize = useResizeObserver(rootRef);
51
+ const contentSize = useResizeObserver(contentRef);
52
+ const indicatorSize = useResizeObserver(indicatorRef);
53
+ const maskSize = computed(() => (rootSize.height - indicatorSize.height) / 2);
54
+ const contentHeight = computed(() => {
55
+ return contentSize.height + maskSize.value * 2;
56
+ });
57
+ const padding = computed(() => `${maskSize.value}px 0`);
58
+ const { position, update, scrollTo, isIdle, handleTouchStart, handleTouchMove, handleTouchEnd } = useScroller({
59
+ itemSize: indicatorSize.height,
60
+ friction: new Friction(1e-4),
61
+ spring: new Spring(2, 90, 20),
62
+ onSnap: (index) => {
63
+ if (!isNaN(index) && index !== columnValue.value) columnValue.value = index;
64
+ },
65
+ onTap: (event) => {
66
+ handleTap(event);
67
+ }
68
+ });
69
+ let updatePending = false;
70
+ watch([
71
+ () => indicatorSize.height,
72
+ columnValue,
73
+ itemCount,
74
+ () => rootSize.height,
75
+ contentHeight
76
+ ], () => {
77
+ if (updatePending) return;
78
+ updatePending = true;
79
+ setTimeout(() => {
80
+ updatePending = false;
81
+ if (indicatorSize.height) {
82
+ const current = Math.max(Math.min(columnValue.value, itemCount.value - 1), 0);
83
+ update(current * indicatorSize.height, indicatorSize.height, rootSize.height, contentHeight.value);
84
+ }
85
+ });
86
+ }, { flush: "post" });
87
+ watchPostEffect(() => {
88
+ const el = contentRef.value;
89
+ if (!el) return;
90
+ const transform = "translateY(" + position.value + "px) translateZ(0)";
91
+ el.style.transform = transform;
92
+ });
93
+ let oldDeltaY = 0;
94
+ function handleWheel(event) {
95
+ const deltaY = oldDeltaY + event.deltaY;
96
+ if (Math.abs(deltaY) > 10) {
97
+ oldDeltaY = 0;
98
+ let current = Math.min(columnValue.value + (deltaY < 0 ? -1 : 1), itemCount.value - 1);
99
+ columnValue.value = current = Math.max(current, 0);
100
+ scrollTo(current * indicatorSize.height);
101
+ } else oldDeltaY = deltaY;
102
+ event.preventDefault();
103
+ }
104
+ function handleTap({ changedTouches: [{ clientY }] }) {
105
+ const el = rootRef.value;
106
+ if (isIdle()) {
107
+ const r = clientY - el.getBoundingClientRect().top - rootSize.height / 2;
108
+ const o = indicatorSize.height / 2;
109
+ if (!(Math.abs(r) <= o)) {
110
+ const a = Math.ceil((Math.abs(r) - o) / indicatorSize.height);
111
+ const s = r < 0 ? -a : a;
112
+ let current = Math.min(columnValue.value + s, itemCount.value - 1);
113
+ columnValue.value = current = Math.max(current, 0);
114
+ scrollTo(current * indicatorSize.height);
115
+ }
116
+ }
117
+ }
118
+ const onTouchStart = (event) => {
119
+ handleTouchStart(event);
120
+ };
121
+ const onTouchMove = (event) => {
122
+ handleTouchMove(event);
123
+ event.stopPropagation();
124
+ };
125
+ const onTouchEnd = (event) => {
126
+ handleTouchEnd(event);
127
+ };
128
+ const onPointerDown = usePointerDown(onTouchStart, onTouchMove, onTouchEnd);
129
+ return (_ctx, _cache) => {
130
+ return openBlock(), createElementBlock("div", {
131
+ ref_key: "rootRef",
132
+ ref: rootRef,
133
+ class: normalizeClass(unref(bem).b()),
134
+ onTouchstart: onTouchStart,
135
+ onTouchmove: onTouchMove,
136
+ onTouchend: onTouchEnd,
137
+ onTouchcancel: onTouchEnd,
138
+ onPointerdown: _cache[0] || (_cache[0] = (...args) => unref(onPointerDown) && unref(onPointerDown)(...args))
139
+ }, [createElementVNode("div", {
140
+ class: normalizeClass(unref(bem).e("group")),
141
+ onWheel: handleWheel
142
+ }, [
143
+ createElementVNode("div", {
144
+ class: normalizeClass([unref(bem).e("mask"), unref(context).maskClass]),
145
+ style: normalizeStyle([`background-size: 100% ${maskSize.value}px;`, unref(context).maskStyle])
146
+ }, null, 6),
147
+ createElementVNode("div", {
148
+ ref_key: "indicatorRef",
149
+ ref: indicatorRef,
150
+ class: normalizeClass([unref(bem).e("indicator"), unref(context).indicatorClass]),
151
+ style: normalizeStyle(unref(context).indicatorStyle)
152
+ }, null, 6),
153
+ createElementVNode("div", {
154
+ ref_key: "contentRef",
155
+ ref: contentRef,
156
+ class: normalizeClass([unref(bem).e("content")]),
157
+ style: normalizeStyle({
158
+ padding: padding.value,
159
+ "--picker-view-indicator-height": `${unref(indicatorSize).height}px`
160
+ })
161
+ }, [renderSlot(_ctx.$slots, "default")], 6)
162
+ ], 34)], 34);
163
+ };
164
+ }
165
+ });
166
+ //#endregion
167
+ export { picker_view_column_default as default };
@@ -0,0 +1,55 @@
1
+ import { type PickerViewSlots } from './common';
2
+ type __VLS_Slots = PickerViewSlots;
3
+ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ value: {
5
+ type: import("vue").PropType<number[]>;
6
+ default(): never[];
7
+ validator(val: any): boolean;
8
+ };
9
+ indicatorStyle: {
10
+ type: import("vue").PropType<import("vue").StyleValue>;
11
+ };
12
+ indicatorClass: {
13
+ type: import("vue").PropType<import("vue").ClassValue>;
14
+ };
15
+ maskStyle: {
16
+ type: import("vue").PropType<import("vue").StyleValue>;
17
+ };
18
+ maskClass: {
19
+ type: import("vue").PropType<import("vue").ClassValue>;
20
+ };
21
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
22
+ change: (value: number[]) => any;
23
+ "update:value": (value: number[]) => any;
24
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
25
+ value: {
26
+ type: import("vue").PropType<number[]>;
27
+ default(): never[];
28
+ validator(val: any): boolean;
29
+ };
30
+ indicatorStyle: {
31
+ type: import("vue").PropType<import("vue").StyleValue>;
32
+ };
33
+ indicatorClass: {
34
+ type: import("vue").PropType<import("vue").ClassValue>;
35
+ };
36
+ maskStyle: {
37
+ type: import("vue").PropType<import("vue").StyleValue>;
38
+ };
39
+ maskClass: {
40
+ type: import("vue").PropType<import("vue").ClassValue>;
41
+ };
42
+ }>> & Readonly<{
43
+ onChange?: ((value: number[]) => any) | undefined;
44
+ "onUpdate:value"?: ((value: number[]) => any) | undefined;
45
+ }>, {
46
+ value: number[];
47
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
48
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
49
+ declare const _default: typeof __VLS_export;
50
+ export default _default;
51
+ type __VLS_WithSlots<T, S> = T & {
52
+ new (): {
53
+ $slots: S;
54
+ };
55
+ };
@@ -0,0 +1,60 @@
1
+ import { createBem } from "../../utils/bem.js";
2
+ import { pickerViewContextKey, pickerViewProps } from "./common.js";
3
+ import { computed, createElementBlock, createElementVNode, defineComponent, normalizeClass, openBlock, provide, reactive, renderSlot, shallowRef, toRef, unref, watch } from "vue";
4
+ //#region packages/sard/components/picker-view/picker-view.vue
5
+ var picker_view_default = /*@__PURE__*/ defineComponent({
6
+ __name: "picker-view",
7
+ props: pickerViewProps,
8
+ emits: ["update:value", "change"],
9
+ setup(__props, { emit: __emit }) {
10
+ const props = __props;
11
+ const emit = __emit;
12
+ const bem = createBem("picker-view");
13
+ const innerValue = reactive([...props.value]);
14
+ watch(() => props.value, (value) => {
15
+ innerValue.length = value.length;
16
+ value.forEach((val, index) => {
17
+ if (val !== innerValue[index]) innerValue.splice(index, 1, val);
18
+ });
19
+ });
20
+ const columnHandles = shallowRef([]);
21
+ function registerColumn(handle) {
22
+ if (!columnHandles.value.includes(handle)) columnHandles.value.push(handle);
23
+ }
24
+ function unregisterColumn(handle) {
25
+ const index = columnHandles.value.indexOf(handle);
26
+ if (index > -1) columnHandles.value.splice(index, 1);
27
+ }
28
+ const getColumnValue = (handle) => {
29
+ return computed({
30
+ get() {
31
+ return innerValue[columnHandles.value.indexOf(handle)] || 0;
32
+ },
33
+ set(current) {
34
+ const index = columnHandles.value.indexOf(handle);
35
+ if (index < 0) return;
36
+ if (innerValue[index] !== current) {
37
+ innerValue[index] = current;
38
+ const value = [...innerValue];
39
+ emit("update:value", value);
40
+ emit("change", value);
41
+ }
42
+ }
43
+ });
44
+ };
45
+ provide(pickerViewContextKey, reactive({
46
+ maskStyle: toRef(() => props.maskStyle),
47
+ maskClass: toRef(() => props.maskClass),
48
+ indicatorClass: toRef(() => props.indicatorClass),
49
+ indicatorStyle: toRef(() => props.indicatorStyle),
50
+ registerColumn,
51
+ unregisterColumn,
52
+ getColumnValue
53
+ }));
54
+ return (_ctx, _cache) => {
55
+ return openBlock(), createElementBlock("div", { class: normalizeClass(unref(bem).b()) }, [createElementVNode("div", { class: normalizeClass(unref(bem).e("wrapper")) }, [renderSlot(_ctx.$slots, "default")], 2)], 2);
56
+ };
57
+ }
58
+ });
59
+ //#endregion
60
+ export { picker_view_default as default };
@@ -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 type PopoutBeforeClose = (type: 'close' | 'cancel' | 'confirm', loading: {
4
4
  readonly cancel: boolean;
5
5
  readonly confirm: boolean;
@@ -266,7 +266,6 @@ var popout_default = /*@__PURE__*/ defineComponent({
266
266
  key: 0,
267
267
  class: normalizeClass(unref(bem).e("footer"))
268
268
  }, [mergedShowCancel.value ? renderSlot(_ctx.$slots, "cancel", {
269
- key: 0,
270
269
  onClick: onCancel,
271
270
  loading: loading.cancel,
272
271
  text: mergedCancelText.value
@@ -280,8 +279,7 @@ var popout_default = /*@__PURE__*/ defineComponent({
280
279
  }, {
281
280
  default: withCtx(() => [createTextVNode(toDisplayString(mergedCancelText.value), 1)]),
282
281
  _: 1
283
- }, 8, ["loading"])]) : createCommentVNode("v-if", true), __props.showConfirm ? renderSlot(_ctx.$slots, "confirm", {
284
- key: 1,
282
+ }, 8, ["loading"])], void 0, 0) : createCommentVNode("v-if", true), __props.showConfirm ? renderSlot(_ctx.$slots, "confirm", {
285
283
  onClick: onConfirm,
286
284
  disabled: __props.confirmDisabled,
287
285
  loading: loading.confirm,
@@ -297,7 +295,7 @@ var popout_default = /*@__PURE__*/ defineComponent({
297
295
  }, {
298
296
  default: withCtx(() => [createTextVNode(toDisplayString(mergedConfirmText.value), 1)]),
299
297
  _: 1
300
- }, 8, ["loading", "disabled"])]) : createCommentVNode("v-if", true)], 2)) : createCommentVNode("v-if", true)
298
+ }, 8, ["loading", "disabled"])], void 0, 1) : createCommentVNode("v-if", true)], 2)) : createCommentVNode("v-if", true)
301
299
  ], 34)]),
302
300
  _: 3
303
301
  }, 8, [
@@ -1,11 +1,10 @@
1
1
  import { createBem } from "../../utils/bem.js";
2
- import { OnlyChild } from "../../utils/vnode.js";
3
2
  import { useZIndex } from "../../use/useZIndex.js";
4
3
  import { usePopper } from "../../use/usePopper.js";
5
4
  import { useClickOutside } from "../../use/useClickOutside.js";
6
5
  import motion_default from "../motion/motion.vue.js";
7
6
  import { defaultPopoverProps } from "./common.js";
8
- import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeDefaults, mergeProps, normalizeClass, normalizeStyle, openBlock, renderSlot, shallowRef, unref, useAttrs, useModel, useSlots, useTemplateRef, vShow, watch, withCtx, withDirectives } from "vue";
7
+ import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeDefaults, mergeProps, normalizeClass, normalizeStyle, onMounted, onUpdated, openBlock, renderSlot, shallowRef, unref, useAttrs, useModel, useSlots, useTemplateRef, vShow, watch, withCtx, withDirectives } from "vue";
9
8
  //#region packages/sard/components/popover/popover.vue
10
9
  var popover_default = /*@__PURE__*/ defineComponent({
11
10
  inheritAttrs: false,
@@ -50,10 +49,13 @@ var popover_default = /*@__PURE__*/ defineComponent({
50
49
  const attrs = useAttrs();
51
50
  const slots = useSlots();
52
51
  const bem = createBem("popover");
52
+ const referenceRef = useTemplateRef("referenceRef");
53
53
  const elRef = shallowRef(null);
54
- const onUpdate = (el) => {
55
- elRef.value = el;
54
+ const syncElRef = () => {
55
+ elRef.value = referenceRef.value?.firstElementChild ?? referenceRef.value;
56
56
  };
57
+ onMounted(syncElRef);
58
+ onUpdated(syncElRef);
57
59
  const mergedRef = computed(() => {
58
60
  return props.reference || elRef.value;
59
61
  });
@@ -97,14 +99,13 @@ var popover_default = /*@__PURE__*/ defineComponent({
97
99
  }, popperStyle.value];
98
100
  });
99
101
  return (_ctx, _cache) => {
100
- return openBlock(), createElementBlock(Fragment, null, [slots.reference ? (openBlock(), createBlock(unref(OnlyChild), {
102
+ return openBlock(), createElementBlock(Fragment, null, [slots.reference ? (openBlock(), createElementBlock("span", {
101
103
  key: 0,
102
- onUpdate,
104
+ ref_key: "referenceRef",
105
+ ref: referenceRef,
106
+ style: { "display": "contents" },
103
107
  onClick: onReferenceClick
104
- }, {
105
- default: withCtx(() => [renderSlot(_ctx.$slots, "reference")]),
106
- _: 3
107
- })) : createCommentVNode("v-if", true), (openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(motion_default, { name: "wide-zoom" }, {
108
+ }, [renderSlot(_ctx.$slots, "reference")], 512)) : createCommentVNode("v-if", true), (openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(motion_default, { name: "wide-zoom" }, {
108
109
  default: withCtx(() => [withDirectives(createElementVNode("div", mergeProps({
109
110
  ref: "popper",
110
111
  class: popoverClass.value,
@@ -153,7 +153,7 @@ var popup_default = /*@__PURE__*/ defineComponent({
153
153
  default: withCtx(() => [withDirectives(createElementVNode("div", mergeProps(_ctx.$attrs, {
154
154
  class: popupClass.value,
155
155
  style: popupStyle.value
156
- }), [rendered.value ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)], 16), [[vShow, __props.visible]])]),
156
+ }), [rendered.value ? renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 0) : createCommentVNode("v-if", true)], 16), [[vShow, __props.visible]])]),
157
157
  _: 3
158
158
  }, 8, ["name"])]);
159
159
  };
@@ -1,6 +1,6 @@
1
1
  import type { InjectionKey } from 'vue';
2
2
  import { type DefaultProps } from '../config';
3
- import type { MotionEmits } from '../motion';
3
+ import type { MotionEmits } from '../motion/common';
4
4
  export interface PreviewImageProps {
5
5
  urls?: string[];
6
6
  visible?: boolean;
@@ -5,8 +5,8 @@ import { usePointerDown } from "../../use/usePointerDown.js";
5
5
  import { useInitialVelocity } from "../../use/useInitialVelocity.js";
6
6
  import popup_default from "../popup/popup.vue.js";
7
7
  import { defaultPreviewImageProps, previewImageContextKey } from "./common.js";
8
- import swiper_default from "../swiper/swiper.js";
9
- import swiper_item_default from "../swiper/swiper-item.js";
8
+ import swiper_default from "../swiper/swiper.vue.js";
9
+ import swiper_item_default from "../swiper/swiper-item.vue.js";
10
10
  import preview_image_item_default from "./preview-image-item.vue.js";
11
11
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, isRef, mergeDefaults, normalizeClass, normalizeStyle, openBlock, provide, reactive, ref, renderList, toDisplayString, unref, useModel, watch, withCtx } from "vue";
12
12
  //#region packages/sard/components/preview-image/preview-image.vue
@@ -160,7 +160,7 @@ var preview_image_default = /*@__PURE__*/ defineComponent({
160
160
  onTouchend: onTouchEnd,
161
161
  onTouchcancel: onTouchEnd,
162
162
  onPointerdown: _cache[1] || (_cache[1] = (...args) => unref(onPointerDown) && unref(onPointerDown)(...args))
163
- }, [createVNode(unref(swiper_default), {
163
+ }, [createVNode(swiper_default, {
164
164
  modelValue: unref(current),
165
165
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(current) ? current.value = $event : null),
166
166
  loop: __props.loop,
@@ -169,7 +169,7 @@ var preview_image_default = /*@__PURE__*/ defineComponent({
169
169
  class: normalizeClass([unref(bem).e("swiper"), unref(bem).is("preview-image")])
170
170
  }, {
171
171
  default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.urls, (url, index) => {
172
- return openBlock(), createBlock(unref(swiper_item_default), { key: index }, {
172
+ return openBlock(), createBlock(swiper_item_default, { key: index }, {
173
173
  default: withCtx(() => [createVNode(preview_image_item_default, { url }, null, 8, ["url"])]),
174
174
  _: 2
175
175
  }, 1024);
@@ -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 };