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.
- package/README.md +1 -2
- package/all-components.js +2 -0
- package/components/action-sheet/action-sheet-item.vue.js +1 -1
- package/components/action-sheet/common.d.ts +1 -1
- package/components/button/button.vue.js +1 -1
- package/components/calendar-popout/common.d.ts +1 -1
- package/components/cascader-popout/common.d.ts +1 -1
- package/components/checkbox-popout/common.d.ts +1 -1
- package/components/color-picker-popout/common.d.ts +1 -1
- package/components/crop-image/common.d.ts +1 -1
- package/components/datetime-picker-popout/common.d.ts +1 -1
- package/components/datetime-range-picker-popout/common.d.ts +1 -1
- package/components/descriptions/common.d.ts +8 -3
- package/components/descriptions/descriptions-item.vue.d.ts +0 -2
- package/components/descriptions/descriptions-item.vue.js +20 -21
- package/components/descriptions/descriptions.vue.js +56 -28
- package/components/descriptions/index.css +1 -1
- package/components/dialog/common.d.ts +1 -1
- package/components/dnd/dnd-item.vue.js +19 -9
- package/components/dnd/index.css +1 -1
- package/components/dropdown/common.d.ts +1 -1
- package/components/ellipsis/ellipsis.vue.js +62 -58
- package/components/ellipsis/index.css +1 -1
- package/components/image/image.vue.d.ts +1 -1
- package/components/index.d.ts +1 -0
- package/components/index.js +2 -1
- package/components/keyboard/keyboard.vue.d.ts +1 -1
- package/components/keyboard-popout/common.d.ts +1 -1
- package/components/keyboard-popout/keyboard-popout.vue.d.ts +1 -1
- package/components/list/index.css +1 -1
- package/components/load-more/load-more.vue.js +2 -2
- package/components/loading/loading.vue.js +1 -1
- package/components/motion/motion.vue.js +1 -1
- package/components/notify/common.d.ts +1 -1
- package/components/overlay/overlay.vue.js +6 -5
- package/components/picker/picker.vue.js +8 -5
- package/components/picker-popout/common.d.ts +1 -1
- package/components/picker-view/common.d.ts +22 -2
- package/components/picker-view/index.d.ts +2 -2
- package/components/picker-view/index.js +2 -2
- package/components/picker-view/picker-view-column.vue.d.ts +19 -0
- package/components/picker-view/picker-view-column.vue.js +167 -0
- package/components/picker-view/picker-view.vue.d.ts +55 -0
- package/components/picker-view/picker-view.vue.js +60 -0
- package/components/popout/common.d.ts +1 -1
- package/components/popout/popout.vue.js +2 -4
- package/components/popover/popover.vue.js +11 -10
- package/components/popup/popup.vue.js +1 -1
- package/components/preview-image/common.d.ts +1 -1
- package/components/preview-image/preview-image.vue.js +4 -4
- package/components/pull-down-refresh/pull-down-refresh.vue.js +4 -7
- package/components/radio-popout/common.d.ts +1 -1
- package/components/rate/rate.vue.js +2 -2
- package/components/select-popout/common.d.ts +1 -1
- package/components/share-sheet/common.d.ts +1 -1
- package/components/skeleton/skeleton.vue.js +1 -1
- package/components/swiper/index.d.ts +2 -2
- package/components/swiper/index.js +2 -2
- package/components/swiper/swiper-item.vue.d.ts +11 -0
- package/components/swiper/swiper-item.vue.js +32 -0
- package/components/swiper/swiper.vue.d.ts +147 -0
- package/components/swiper/swiper.vue.js +51 -0
- package/components/swiper/useSwiper.d.ts +1 -2
- package/components/swiper/useSwiper.js +12 -12
- package/components/table/table.vue.js +1 -2
- package/components/text-shrink/common.d.ts +28 -0
- package/components/text-shrink/common.js +8 -0
- package/components/text-shrink/index.css +1 -0
- package/components/text-shrink/index.d.ts +5 -0
- package/components/text-shrink/index.js +6 -0
- package/components/text-shrink/text-shrink.vue.d.ts +16 -0
- package/components/text-shrink/text-shrink.vue.js +252 -0
- package/components/toast/common.d.ts +1 -1
- package/global.d.ts +1 -0
- package/index.css +1 -1
- package/index.js +2 -2
- package/package.json +1 -1
- package/utils/createImperativeComponent.d.ts +12 -5
- package/utils/createImperativeComponent.js +13 -37
- package/utils/imperative/agent-runtime.d.ts +28 -0
- package/utils/imperative/agent-runtime.js +33 -0
- package/utils/imperative/imperative-agent.vue.d.ts +35 -0
- package/utils/imperative/imperative-agent.vue.js +60 -0
- package/utils/index.d.ts +0 -1
- package/utils/index.js +1 -2
- package/utils/is.d.ts +4 -1
- package/utils/is.js +5 -3
- package/utils/number.d.ts +1 -1
- package/utils/number.js +20 -19
- package/components/picker-view/picker-view-column.d.ts +0 -3
- package/components/picker-view/picker-view-column.js +0 -139
- package/components/picker-view/picker-view.d.ts +0 -21
- package/components/picker-view/picker-view.js +0 -57
- package/components/swiper/swiper-item.d.ts +0 -3
- package/components/swiper/swiper-item.js +0 -34
- package/components/swiper/swiper.d.ts +0 -57
- package/components/swiper/swiper.js +0 -43
- package/utils/vnode.d.ts +0 -9
- package/utils/vnode.js +0 -69
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { createBem } from "../../utils/bem.js";
|
|
2
|
-
import { defineSetupFnComponent } from "../../utils/component.js";
|
|
3
|
-
import { swiperItemProps } from "./common.js";
|
|
4
|
-
import { useSwiperItem } from "./useSwiper.js";
|
|
5
|
-
import { createVNode, watchPostEffect } from "vue";
|
|
6
|
-
//#region packages/sard/components/swiper/swiper-item.tsx
|
|
7
|
-
var swiper_item_default = defineSetupFnComponent((_props, { slots }) => {
|
|
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 () => {
|
|
19
|
-
return createVNode("div", {
|
|
20
|
-
"ref": elRef,
|
|
21
|
-
"class": [
|
|
22
|
-
bem.e("item"),
|
|
23
|
-
bem.is("vertical", vertical.value),
|
|
24
|
-
bem.is("auto-height", autoHeight.value)
|
|
25
|
-
]
|
|
26
|
-
}, [slots.default && slots.default()]);
|
|
27
|
-
};
|
|
28
|
-
}, {
|
|
29
|
-
name: "SwiperItem",
|
|
30
|
-
props: swiperItemProps,
|
|
31
|
-
slots: null
|
|
32
|
-
});
|
|
33
|
-
//#endregion
|
|
34
|
-
export { swiper_item_default as default };
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { type SwiperEmits, type SwiperSlots, type SwiperContext, type AddSwiperContext, type RemoveSwiperContext } from './common';
|
|
2
|
-
export type { SwiperContext, AddSwiperContext, RemoveSwiperContext };
|
|
3
|
-
declare const _default: import("vue").DefineSetupFnComponent<import("vue").ExtractPublicPropTypes<{
|
|
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
|
-
}>, SwiperEmits, SwiperSlots>;
|
|
57
|
-
export default _default;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { createBem } from "../../utils/bem.js";
|
|
2
|
-
import { flatVNode } from "../../utils/vnode.js";
|
|
3
|
-
import { defineSetupFnComponent } from "../../utils/component.js";
|
|
4
|
-
import { swiperProps } from "./common.js";
|
|
5
|
-
import { useSwiper } from "./useSwiper.js";
|
|
6
|
-
import { createVNode } from "vue";
|
|
7
|
-
//#region packages/sard/components/swiper/swiper.tsx
|
|
8
|
-
var swiper_default = defineSetupFnComponent((props, { slots, emit }) => {
|
|
9
|
-
const bem = createBem("swiper");
|
|
10
|
-
const { rootRef, wrapperRef, activeIndex, pageCount, setSwiperItems, onTouchStart, onTouchMove, onTouchEnd, onPointerDown } = useSwiper(props, emit);
|
|
11
|
-
return () => {
|
|
12
|
-
const defaultSlots = slots.default && slots.default();
|
|
13
|
-
setSwiperItems(flatVNode(defaultSlots));
|
|
14
|
-
return createVNode("div", {
|
|
15
|
-
"ref": rootRef,
|
|
16
|
-
"class": [
|
|
17
|
-
bem.b(),
|
|
18
|
-
bem.m("vertical", props.vertical),
|
|
19
|
-
bem.is("auto-height", props.autoHeight)
|
|
20
|
-
],
|
|
21
|
-
"onTouchstart": onTouchStart,
|
|
22
|
-
"onTouchmove": onTouchMove,
|
|
23
|
-
"onTouchend": onTouchEnd,
|
|
24
|
-
"onTouchcancel": onTouchEnd,
|
|
25
|
-
"onPointerdown": onPointerDown
|
|
26
|
-
}, [createVNode("div", {
|
|
27
|
-
"ref": wrapperRef,
|
|
28
|
-
"class": [bem.e("wrapper"), bem.is("vertical", props.vertical)]
|
|
29
|
-
}, [defaultSlots]), props.showIndicator && createVNode("div", { "class": [bem.e("dots"), bem.is("vertical", props.vertical)] }, [Array(pageCount.value).fill(0).map((_, index) => createVNode("div", { "class": [bem.e("dot"), bem.is("active", activeIndex.value === index)] }, null))])]);
|
|
30
|
-
};
|
|
31
|
-
}, {
|
|
32
|
-
name: "Swiper",
|
|
33
|
-
props: swiperProps,
|
|
34
|
-
emits: [
|
|
35
|
-
"change",
|
|
36
|
-
"transition",
|
|
37
|
-
"animationfinish",
|
|
38
|
-
"update:modelValue"
|
|
39
|
-
],
|
|
40
|
-
slots: null
|
|
41
|
-
});
|
|
42
|
-
//#endregion
|
|
43
|
-
export { swiper_default as default };
|
package/utils/vnode.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type VNode } from 'vue';
|
|
2
|
-
export declare function flatVNode(nodes: any): VNode[];
|
|
3
|
-
export declare const OnlyChild: import("vue").DefineComponent<{}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
|
-
update(_el: HTMLElement | null): true;
|
|
7
|
-
}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
|
|
8
|
-
onUpdate?: ((_el: HTMLElement | null) => any) | undefined;
|
|
9
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
package/utils/vnode.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { isObject } from "./is.js";
|
|
2
|
-
import { logError } from "./log.js";
|
|
3
|
-
import { Comment, Fragment, Text, cloneVNode, createVNode, defineComponent, isVNode, withDirectives } from "vue";
|
|
4
|
-
//#region packages/sard/utils/vnode.tsx
|
|
5
|
-
function flatVNode(nodes) {
|
|
6
|
-
const array = [];
|
|
7
|
-
if (Array.isArray(nodes)) nodes.forEach((vnode) => {
|
|
8
|
-
if (isVNode(vnode)) {
|
|
9
|
-
if (vnode.type === Fragment) array.push(...flatVNode(vnode.children));
|
|
10
|
-
else if (vnode.type !== Comment) array.push(vnode);
|
|
11
|
-
} else if (Array.isArray(vnode)) array.push(...flatVNode(vnode));
|
|
12
|
-
});
|
|
13
|
-
return array;
|
|
14
|
-
}
|
|
15
|
-
function wrapTextContent(s) {
|
|
16
|
-
return createVNode("span", null, [s]);
|
|
17
|
-
}
|
|
18
|
-
function findFirstLegitChild(node) {
|
|
19
|
-
if (!node) return [null, 0];
|
|
20
|
-
const children = node;
|
|
21
|
-
const len = children.filter((c) => c.type !== Comment).length;
|
|
22
|
-
for (const child of children) {
|
|
23
|
-
/**
|
|
24
|
-
* when user uses h(Fragment, [text]) to render plain string,
|
|
25
|
-
* this switch case just cannot handle, when the value is primitives
|
|
26
|
-
* we should just return the wrapped string
|
|
27
|
-
*/
|
|
28
|
-
if (isObject(child)) switch (child.type) {
|
|
29
|
-
case Comment: continue;
|
|
30
|
-
case Text:
|
|
31
|
-
case "svg": return [wrapTextContent(child), len];
|
|
32
|
-
case Fragment: return findFirstLegitChild(child.children);
|
|
33
|
-
default: return [child, len];
|
|
34
|
-
}
|
|
35
|
-
return [wrapTextContent(child), len];
|
|
36
|
-
}
|
|
37
|
-
return [null, 0];
|
|
38
|
-
}
|
|
39
|
-
const OnlyChild = defineComponent({
|
|
40
|
-
emits: { update(_el) {
|
|
41
|
-
return true;
|
|
42
|
-
} },
|
|
43
|
-
setup(_, { slots, attrs, emit }) {
|
|
44
|
-
const getElDirective = {
|
|
45
|
-
mounted(el) {
|
|
46
|
-
emit("update", el);
|
|
47
|
-
},
|
|
48
|
-
updated(el) {
|
|
49
|
-
emit("update", el);
|
|
50
|
-
},
|
|
51
|
-
unmounted() {
|
|
52
|
-
emit("update", null);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
return () => {
|
|
56
|
-
const defaultSlot = slots.default?.(attrs);
|
|
57
|
-
if (!defaultSlot) return null;
|
|
58
|
-
const [firstLegitNode, length] = findFirstLegitChild(defaultSlot);
|
|
59
|
-
if (!firstLegitNode) {
|
|
60
|
-
logError("no valid child node found");
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
if (length > 1) logError("requires exact only one valid child.");
|
|
64
|
-
return withDirectives(cloneVNode(firstLegitNode, attrs), [[getElDirective]]);
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
//#endregion
|
|
69
|
-
export { OnlyChild, flatVNode };
|