feat: initial commit - Phase 1 & 2 core features

This commit is contained in:
hiderfong
2026-04-22 17:07:33 +08:00
commit 1773bda06b
25005 changed files with 6252106 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
import { SFCWithInstall } from "../../utils/vue/typescript.js";
import "../../utils/index.js";
import { Timeline, TimelineInstance, TimelineProps, TimelinePropsPublic, timelineProps } from "./src/timeline.js";
import { TimelineItemInstance, TimelineItemProps, TimelineItemPropsPublic, timelineItemProps } from "./src/timeline-item.js";
import { _default } from "./src/timeline-item.vue.js";
import { TIMELINE_INJECTION_KEY, TimelineProvider } from "./src/tokens.js";
//#region ../../packages/components/timeline/index.d.ts
declare const ElTimeline: SFCWithInstall<typeof Timeline> & {
TimelineItem: typeof _default;
};
declare const ElTimelineItem: SFCWithInstall<typeof _default>;
//#endregion
export { ElTimeline, ElTimeline as default, ElTimelineItem, TIMELINE_INJECTION_KEY, TimelineInstance, TimelineItemInstance, TimelineItemProps, TimelineItemPropsPublic, TimelineProps, TimelinePropsPublic, TimelineProvider, timelineItemProps, timelineProps };
+13
View File
@@ -0,0 +1,13 @@
import { withInstall, withNoopInstall } from "../../utils/vue/install.mjs";
import { TIMELINE_INJECTION_KEY } from "./src/tokens.mjs";
import Timeline, { timelineProps } from "./src/timeline.mjs";
import { timelineItemProps } from "./src/timeline-item.mjs";
import timeline_item_default from "./src/timeline-item2.mjs";
//#region ../../packages/components/timeline/index.ts
const ElTimeline = withInstall(Timeline, { TimelineItem: timeline_item_default });
const ElTimelineItem = withNoopInstall(timeline_item_default);
//#endregion
export { ElTimeline, ElTimeline as default, ElTimelineItem, TIMELINE_INJECTION_KEY, timelineItemProps, timelineProps };
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","names":["TimelineItem"],"sources":["../../../../../packages/components/timeline/index.ts"],"sourcesContent":["import { withInstall, withNoopInstall } from '@element-plus/utils'\nimport Timeline from './src/timeline'\nimport TimelineItem from './src/timeline-item.vue'\n\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nexport const ElTimeline: SFCWithInstall<typeof Timeline> & {\n TimelineItem: typeof TimelineItem\n} = withInstall(Timeline, {\n TimelineItem,\n})\nexport default ElTimeline\nexport const ElTimelineItem: SFCWithInstall<typeof TimelineItem> =\n withNoopInstall(TimelineItem)\n\nexport * from './src/timeline'\nexport * from './src/timeline-item'\nexport * from './src/tokens'\n"],"mappings":";;;;;;;AAMA,MAAa,aAET,YAAY,UAAU,EACxB,qCACD,CAAC;AAEF,MAAa,iBACX,gBAAgBA,sBAAa"}
@@ -0,0 +1,72 @@
import { IconPropType } from "../../../utils/vue/icon.js";
import { EpPropFinalized, EpPropMergeType } from "../../../utils/vue/props/types.js";
import "../../../utils/index.js";
import { _default } from "./timeline-item.vue.js";
import * as vue from "vue";
import { ExtractPublicPropTypes } from "vue";
//#region ../../packages/components/timeline/src/timeline-item.d.ts
interface TimelineItemProps {
/**
* @description timestamp content
*/
timestamp?: string;
/**
* @description whether to show timestamp
*/
hideTimestamp?: boolean;
/**
* @description whether vertically centered
*/
center?: boolean;
/**
* @description position of timestamp
*/
placement?: 'top' | 'bottom';
/**
* @description node type
*/
type?: 'primary' | 'success' | 'warning' | 'danger' | 'info' | '';
/**
* @description background color of node
*/
color?: string;
/**
* @description node size
*/
size?: 'normal' | 'large';
/**
* @description icon component
*/
icon?: IconPropType;
/**
* @description icon is hollow
*/
hollow?: boolean;
}
/**
* @deprecated Removed after 3.0.0, Use `TimelineItemProps` instead.
*/
declare const timelineItemProps: {
readonly timestamp: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly hideTimestamp: BooleanConstructor;
readonly center: BooleanConstructor;
readonly placement: EpPropFinalized<StringConstructor, "top" | "bottom", unknown, "bottom", boolean>;
readonly type: EpPropFinalized<StringConstructor, "info" | "primary" | "success" | "warning" | "danger", unknown, "", boolean>;
readonly color: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly size: EpPropFinalized<StringConstructor, "large" | "normal", unknown, "normal", boolean>;
readonly icon: {
readonly type: vue.PropType<EpPropMergeType<(new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component) | (((new (...args: any[]) => (string | vue.Component) & {}) | (() => string | vue.Component)) | null)[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly hollow: BooleanConstructor;
};
/**
* @deprecated Removed after 3.0.0, Use `TimelineItemProps` instead.
*/
type TimelineItemPropsPublic = ExtractPublicPropTypes<typeof timelineItemProps>;
type TimelineItemInstance = InstanceType<typeof _default> & unknown;
//#endregion
export { TimelineItemInstance, TimelineItemProps, TimelineItemPropsPublic, timelineItemProps };
@@ -0,0 +1,46 @@
import { buildProps } from "../../../utils/vue/props/runtime.mjs";
import { iconPropType } from "../../../utils/vue/icon.mjs";
//#region ../../packages/components/timeline/src/timeline-item.ts
/**
* @deprecated Removed after 3.0.0, Use `TimelineItemProps` instead.
*/
const timelineItemProps = buildProps({
timestamp: {
type: String,
default: ""
},
hideTimestamp: Boolean,
center: Boolean,
placement: {
type: String,
values: ["top", "bottom"],
default: "bottom"
},
type: {
type: String,
values: [
"primary",
"success",
"warning",
"danger",
"info"
],
default: ""
},
color: {
type: String,
default: ""
},
size: {
type: String,
values: ["normal", "large"],
default: "normal"
},
icon: { type: iconPropType },
hollow: Boolean
});
//#endregion
export { timelineItemProps };
//# sourceMappingURL=timeline-item.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"timeline-item.mjs","names":[],"sources":["../../../../../../packages/components/timeline/src/timeline-item.ts"],"sourcesContent":["import { buildProps, iconPropType } from '@element-plus/utils'\n\nimport type { ExtractPublicPropTypes } from 'vue'\nimport type { IconPropType } from '@element-plus/utils'\nimport type TimelineItem from './timeline-item.vue'\n\nexport interface TimelineItemProps {\n /**\n * @description timestamp content\n */\n timestamp?: string\n /**\n * @description whether to show timestamp\n */\n hideTimestamp?: boolean\n /**\n * @description whether vertically centered\n */\n center?: boolean\n /**\n * @description position of timestamp\n */\n placement?: 'top' | 'bottom'\n /**\n * @description node type\n */\n type?: 'primary' | 'success' | 'warning' | 'danger' | 'info' | ''\n /**\n * @description background color of node\n */\n color?: string\n /**\n * @description node size\n */\n size?: 'normal' | 'large'\n /**\n * @description icon component\n */\n icon?: IconPropType\n /**\n * @description icon is hollow\n */\n hollow?: boolean\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `TimelineItemProps` instead.\n */\nexport const timelineItemProps = buildProps({\n /**\n * @description timestamp content\n */\n timestamp: {\n type: String,\n default: '',\n },\n /**\n * @description whether to show timestamp\n */\n hideTimestamp: Boolean,\n /**\n * @description whether vertically centered\n */\n center: Boolean,\n /**\n * @description position of timestamp\n */\n placement: {\n type: String,\n values: ['top', 'bottom'],\n default: 'bottom',\n },\n /**\n * @description node type\n */\n type: {\n type: String,\n values: ['primary', 'success', 'warning', 'danger', 'info'],\n default: '',\n },\n /**\n * @description background color of node\n */\n color: {\n type: String,\n default: '',\n },\n /**\n * @description node size\n */\n size: {\n type: String,\n values: ['normal', 'large'],\n default: 'normal',\n },\n /**\n * @description icon component\n */\n icon: {\n type: iconPropType,\n },\n /**\n * @description icon is hollow\n */\n hollow: Boolean,\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `TimelineItemProps` instead.\n */\nexport type TimelineItemPropsPublic = ExtractPublicPropTypes<\n typeof timelineItemProps\n>\n\nexport type TimelineItemInstance = InstanceType<typeof TimelineItem> & unknown\n"],"mappings":";;;;;;;AAgDA,MAAa,oBAAoB,WAAW;CAI1C,WAAW;EACT,MAAM;EACN,SAAS;EACV;CAID,eAAe;CAIf,QAAQ;CAIR,WAAW;EACT,MAAM;EACN,QAAQ,CAAC,OAAO,SAAS;EACzB,SAAS;EACV;CAID,MAAM;EACJ,MAAM;EACN,QAAQ;GAAC;GAAW;GAAW;GAAW;GAAU;GAAO;EAC3D,SAAS;EACV;CAID,OAAO;EACL,MAAM;EACN,SAAS;EACV;CAID,MAAM;EACJ,MAAM;EACN,QAAQ,CAAC,UAAU,QAAQ;EAC3B,SAAS;EACV;CAID,MAAM,EACJ,MAAM,cACP;CAID,QAAQ;CACT,CAAU"}
@@ -0,0 +1,26 @@
import { TimelineItemProps } from "./timeline-item.js";
import * as vue from "vue";
//#region ../../packages/components/timeline/src/timeline-item.vue.d.ts
declare var __VLS_12: {}, __VLS_14: {};
type __VLS_Slots = {} & {
dot?: (props: typeof __VLS_12) => any;
} & {
default?: (props: typeof __VLS_14) => any;
};
declare const __VLS_base: vue.DefineComponent<TimelineItemProps, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<TimelineItemProps> & Readonly<{}>, {
type: "primary" | "success" | "warning" | "danger" | "info" | "";
size: "normal" | "large";
color: string;
placement: "top" | "bottom";
timestamp: string;
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
declare const _default: typeof __VLS_export;
type __VLS_WithSlots<T, S> = T & {
new (): {
$slots: S;
};
};
//#endregion
export { _default };
@@ -0,0 +1,63 @@
import { useNamespace } from "../../../hooks/use-namespace/index.mjs";
import { ElIcon } from "../../icon/index.mjs";
import { TIMELINE_INJECTION_KEY } from "./tokens.mjs";
import { timelineItemProps } from "./timeline-item.mjs";
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, inject, normalizeClass, normalizeStyle, openBlock, renderSlot, resolveDynamicComponent, toDisplayString, unref, withCtx } from "vue";
//#region ../../packages/components/timeline/src/timeline-item.vue?vue&type=script&setup=true&lang.ts
var timeline_item_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
name: "ElTimelineItem",
__name: "timeline-item",
props: timelineItemProps,
setup(__props) {
const props = __props;
const { props: timelineProps } = inject(TIMELINE_INJECTION_KEY);
const ns = useNamespace("timeline-item");
const defaultNodeKls = computed(() => [
ns.e("node"),
ns.em("node", props.size || ""),
ns.em("node", props.type || ""),
ns.is("hollow", props.hollow)
]);
const timelineItemKls = computed(() => [
ns.b(),
{ [ns.e("center")]: props.center },
ns.is(timelineProps.mode)
]);
return (_ctx, _cache) => {
return openBlock(), createElementBlock("li", { class: normalizeClass(timelineItemKls.value) }, [
createElementVNode("div", { class: normalizeClass(unref(ns).e("tail")) }, null, 2),
!_ctx.$slots.dot ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(defaultNodeKls.value),
style: normalizeStyle({ backgroundColor: __props.color })
}, [__props.icon ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass(unref(ns).e("icon"))
}, {
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.icon)))]),
_: 1
}, 8, ["class"])) : createCommentVNode("v-if", true)], 6)) : createCommentVNode("v-if", true),
_ctx.$slots.dot ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass(unref(ns).e("dot"))
}, [renderSlot(_ctx.$slots, "dot")], 2)) : createCommentVNode("v-if", true),
createElementVNode("div", { class: normalizeClass(unref(ns).e("wrapper")) }, [
!__props.hideTimestamp && __props.placement === "top" ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass([unref(ns).e("timestamp"), unref(ns).is("top")])
}, toDisplayString(__props.timestamp), 3)) : createCommentVNode("v-if", true),
createElementVNode("div", { class: normalizeClass(unref(ns).e("content")) }, [renderSlot(_ctx.$slots, "default")], 2),
!__props.hideTimestamp && __props.placement === "bottom" ? (openBlock(), createElementBlock("div", {
key: 1,
class: normalizeClass([unref(ns).e("timestamp"), unref(ns).is("bottom")])
}, toDisplayString(__props.timestamp), 3)) : createCommentVNode("v-if", true)
], 2)
], 2);
};
}
});
//#endregion
export { timeline_item_vue_vue_type_script_setup_true_lang_default as default };
//# sourceMappingURL=timeline-item.vue_vue_type_script_setup_true_lang.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"timeline-item.vue_vue_type_script_setup_true_lang.mjs","names":["$slots"],"sources":["../../../../../../packages/components/timeline/src/timeline-item.vue"],"sourcesContent":["<template>\n <li :class=\"timelineItemKls\">\n <div :class=\"ns.e('tail')\" />\n <div\n v-if=\"!$slots.dot\"\n :class=\"defaultNodeKls\"\n :style=\"{\n backgroundColor: color,\n }\"\n >\n <el-icon v-if=\"icon\" :class=\"ns.e('icon')\">\n <component :is=\"icon\" />\n </el-icon>\n </div>\n <div v-if=\"$slots.dot\" :class=\"ns.e('dot')\">\n <slot name=\"dot\" />\n </div>\n\n <div :class=\"ns.e('wrapper')\">\n <div\n v-if=\"!hideTimestamp && placement === 'top'\"\n :class=\"[ns.e('timestamp'), ns.is('top')]\"\n >\n {{ timestamp }}\n </div>\n\n <div :class=\"ns.e('content')\">\n <slot />\n </div>\n\n <div\n v-if=\"!hideTimestamp && placement === 'bottom'\"\n :class=\"[ns.e('timestamp'), ns.is('bottom')]\"\n >\n {{ timestamp }}\n </div>\n </div>\n </li>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject } from 'vue'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { useNamespace } from '@element-plus/hooks'\nimport { TIMELINE_INJECTION_KEY } from './tokens'\n\nimport type { TimelineProvider } from './tokens'\nimport type { TimelineItemProps } from './timeline-item'\n\ndefineOptions({\n name: 'ElTimelineItem',\n})\n\nconst props = withDefaults(defineProps<TimelineItemProps>(), {\n timestamp: '',\n placement: 'bottom',\n type: '',\n color: '',\n size: 'normal',\n})\nconst { props: timelineProps } = inject<TimelineProvider>(\n TIMELINE_INJECTION_KEY\n)!\n\nconst ns = useNamespace('timeline-item')\nconst defaultNodeKls = computed(() => [\n ns.e('node'),\n ns.em('node', props.size || ''),\n ns.em('node', props.type || ''),\n ns.is('hollow', props.hollow),\n])\n\nconst timelineItemKls = computed(() => [\n ns.b(),\n { [ns.e('center')]: props.center },\n ns.is(timelineProps.mode),\n])\n</script>\n"],"mappings":";;;;;;;;;;;;EAqDA,MAAM,QAAQ;EAOd,MAAM,EAAE,OAAO,kBAAkB,OAC/B,uBACD;EAED,MAAM,KAAK,aAAa,gBAAe;EACvC,MAAM,iBAAiB,eAAe;GACpC,GAAG,EAAE,OAAO;GACZ,GAAG,GAAG,QAAQ,MAAM,QAAQ,GAAG;GAC/B,GAAG,GAAG,QAAQ,MAAM,QAAQ,GAAG;GAC/B,GAAG,GAAG,UAAU,MAAM,OAAO;GAC9B,CAAA;EAED,MAAM,kBAAkB,eAAe;GACrC,GAAG,GAAG;GACN,GAAG,GAAG,EAAE,SAAS,GAAG,MAAM,QAAQ;GAClC,GAAG,GAAG,cAAc,KAAK;GAC1B,CAAA;;uBA3EC,mBAoCK,MAAA,EApCA,OAAK,eAAE,gBAAA,MAAe;IACzB,mBAA6B,OAAA,EAAvB,OAAK,eAAE,MAAA,GAAE,CAAC,EAAC,OAAA,CAAA;KAERA,KAAAA,OAAO,oBADhB,mBAUM,OAAA;;KARH,OAAK,eAAE,eAAA,MAAc;KACrB,OAAK,eAAA,mBAA6B,QAAA;QAIpB,QAAA,qBAAf,YAEU,MAAA,OAAA,EAAA;;KAFY,OAAK,eAAE,MAAA,GAAE,CAAC,EAAC,OAAA,CAAA;;4BACP,eAAxB,YAAwB,wBAAR,QAAA,KAAI,CAAA;;;IAGbA,KAAAA,OAAO,oBAAlB,mBAEM,OAAA;;KAFkB,OAAK,eAAE,MAAA,GAAE,CAAC,EAAC,MAAA,CAAA;QACjC,WAAmB,KAAA,QAAA,MAAA;IAGrB,mBAkBM,OAAA,EAlBA,OAAK,eAAE,MAAA,GAAE,CAAC,EAAC,UAAA,CAAA;MAEN,QAAA,iBAAiB,QAAA,cAAS,sBADnC,mBAKM,OAAA;;MAHH,OAAK,eAAA,CAAG,MAAA,GAAE,CAAC,EAAC,YAAA,EAAe,MAAA,GAAE,CAAC,GAAE,MAAA,CAAA,CAAA;wBAE9B,QAAA,UAAS,EAAA,EAAA;KAGd,mBAEM,OAAA,EAFA,OAAK,eAAE,MAAA,GAAE,CAAC,EAAC,UAAA,CAAA,KACf,WAAQ,KAAA,QAAA,UAAA;MAID,QAAA,iBAAiB,QAAA,cAAS,yBADnC,mBAKM,OAAA;;MAHH,OAAK,eAAA,CAAG,MAAA,GAAE,CAAC,EAAC,YAAA,EAAe,MAAA,GAAE,CAAC,GAAE,SAAA,CAAA,CAAA;wBAE9B,QAAA,UAAS,EAAA,EAAA"}
@@ -0,0 +1,8 @@
import timeline_item_vue_vue_type_script_setup_true_lang_default from "./timeline-item.vue_vue_type_script_setup_true_lang.mjs";
//#region ../../packages/components/timeline/src/timeline-item.vue
var timeline_item_default = timeline_item_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { timeline_item_default as default };
//# sourceMappingURL=timeline-item2.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"timeline-item2.mjs","names":[],"sources":["../../../../../../packages/components/timeline/src/timeline-item.vue"],"sourcesContent":["<template>\n <li :class=\"timelineItemKls\">\n <div :class=\"ns.e('tail')\" />\n <div\n v-if=\"!$slots.dot\"\n :class=\"defaultNodeKls\"\n :style=\"{\n backgroundColor: color,\n }\"\n >\n <el-icon v-if=\"icon\" :class=\"ns.e('icon')\">\n <component :is=\"icon\" />\n </el-icon>\n </div>\n <div v-if=\"$slots.dot\" :class=\"ns.e('dot')\">\n <slot name=\"dot\" />\n </div>\n\n <div :class=\"ns.e('wrapper')\">\n <div\n v-if=\"!hideTimestamp && placement === 'top'\"\n :class=\"[ns.e('timestamp'), ns.is('top')]\"\n >\n {{ timestamp }}\n </div>\n\n <div :class=\"ns.e('content')\">\n <slot />\n </div>\n\n <div\n v-if=\"!hideTimestamp && placement === 'bottom'\"\n :class=\"[ns.e('timestamp'), ns.is('bottom')]\"\n >\n {{ timestamp }}\n </div>\n </div>\n </li>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject } from 'vue'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { useNamespace } from '@element-plus/hooks'\nimport { TIMELINE_INJECTION_KEY } from './tokens'\n\nimport type { TimelineProvider } from './tokens'\nimport type { TimelineItemProps } from './timeline-item'\n\ndefineOptions({\n name: 'ElTimelineItem',\n})\n\nconst props = withDefaults(defineProps<TimelineItemProps>(), {\n timestamp: '',\n placement: 'bottom',\n type: '',\n color: '',\n size: 'normal',\n})\nconst { props: timelineProps } = inject<TimelineProvider>(\n TIMELINE_INJECTION_KEY\n)!\n\nconst ns = useNamespace('timeline-item')\nconst defaultNodeKls = computed(() => [\n ns.e('node'),\n ns.em('node', props.size || ''),\n ns.em('node', props.type || ''),\n ns.is('hollow', props.hollow),\n])\n\nconst timelineItemKls = computed(() => [\n ns.b(),\n { [ns.e('center')]: props.center },\n ns.is(timelineProps.mode),\n])\n</script>\n"],"mappings":""}
@@ -0,0 +1,27 @@
import { EpPropFinalized, EpPropMergeType } from "../../../utils/vue/props/types.js";
import "../../../utils/index.js";
import * as vue from "vue";
import { ExtractPropTypes, ExtractPublicPropTypes } from "vue";
//#region ../../packages/components/timeline/src/timeline.d.ts
declare const timelineProps: {
readonly mode: EpPropFinalized<StringConstructor, "end" | "start" | "alternate" | "alternate-reverse", unknown, "start", boolean>;
readonly reverse: BooleanConstructor;
};
type TimelineProps = ExtractPropTypes<typeof timelineProps>;
type TimelinePropsPublic = ExtractPublicPropTypes<typeof timelineProps>;
declare const Timeline: vue.DefineComponent<ExtractPropTypes<{
readonly mode: EpPropFinalized<StringConstructor, "end" | "start" | "alternate" | "alternate-reverse", unknown, "start", boolean>;
readonly reverse: BooleanConstructor;
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
[key: string]: any;
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<ExtractPropTypes<{
readonly mode: EpPropFinalized<StringConstructor, "end" | "start" | "alternate" | "alternate-reverse", unknown, "start", boolean>;
readonly reverse: BooleanConstructor;
}>> & Readonly<{}>, {
readonly reverse: boolean;
readonly mode: EpPropMergeType<StringConstructor, "end" | "start" | "alternate" | "alternate-reverse", unknown>;
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
type TimelineInstance = InstanceType<typeof Timeline> & unknown;
//#endregion
export { Timeline, TimelineInstance, TimelineProps, TimelinePropsPublic, timelineProps };
@@ -0,0 +1,40 @@
import { buildProps } from "../../../utils/vue/props/runtime.mjs";
import { flattedChildren } from "../../../utils/vue/vnode.mjs";
import { useNamespace } from "../../../hooks/use-namespace/index.mjs";
import { TIMELINE_INJECTION_KEY } from "./tokens.mjs";
import { computed, defineComponent, h, provide } from "vue";
//#region ../../packages/components/timeline/src/timeline.ts
const timelineProps = buildProps({
mode: {
type: String,
values: [
"start",
"alternate",
"alternate-reverse",
"end"
],
default: "start"
},
reverse: Boolean
});
const Timeline = defineComponent({
name: "ElTimeline",
props: timelineProps,
setup(props, { slots }) {
const ns = useNamespace("timeline");
provide(TIMELINE_INJECTION_KEY, {
props,
slots
});
const timelineKls = computed(() => [ns.b(), ns.is(props.mode)]);
return () => {
const children = flattedChildren(slots.default?.() ?? []);
return h("ul", { class: timelineKls.value }, props.reverse ? children.reverse() : children);
};
}
});
//#endregion
export { Timeline as default, timelineProps };
//# sourceMappingURL=timeline.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"timeline.mjs","names":[],"sources":["../../../../../../packages/components/timeline/src/timeline.ts"],"sourcesContent":["import { computed, defineComponent, h, provide } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { TIMELINE_INJECTION_KEY } from './tokens'\nimport { buildProps, flattedChildren } from '@element-plus/utils'\n\nimport type { VNodeChildAtom } from '@element-plus/utils'\nimport type { ExtractPropTypes, ExtractPublicPropTypes } from 'vue'\nimport type { TimelineProvider } from './tokens'\n\nexport const timelineProps = buildProps({\n /**\n * @description relative position of timeline and content\n */\n mode: {\n type: String,\n values: ['start', 'alternate', 'alternate-reverse', 'end'],\n default: 'start',\n },\n /**\n * @description whether reverse order\n */\n reverse: Boolean,\n} as const)\nexport type TimelineProps = ExtractPropTypes<typeof timelineProps>\nexport type TimelinePropsPublic = ExtractPublicPropTypes<typeof timelineProps>\n\nconst Timeline = defineComponent({\n name: 'ElTimeline',\n props: timelineProps,\n\n setup(props, { slots }) {\n const ns = useNamespace('timeline')\n\n provide<TimelineProvider>(TIMELINE_INJECTION_KEY, { props, slots })\n\n const timelineKls = computed(() => [ns.b(), ns.is(props.mode)])\n\n return () => {\n const children = flattedChildren(\n slots.default?.() ?? []\n ) as VNodeChildAtom[]\n\n return h(\n 'ul',\n { class: timelineKls.value },\n props.reverse ? children.reverse() : children\n )\n }\n },\n})\n\nexport default Timeline\nexport type TimelineInstance = InstanceType<typeof Timeline> & unknown\n"],"mappings":";;;;;;;AASA,MAAa,gBAAgB,WAAW;CAItC,MAAM;EACJ,MAAM;EACN,QAAQ;GAAC;GAAS;GAAa;GAAqB;GAAM;EAC1D,SAAS;EACV;CAID,SAAS;CACV,CAAU;AAIX,MAAM,WAAW,gBAAgB;CAC/B,MAAM;CACN,OAAO;CAEP,MAAM,OAAO,EAAE,SAAS;EACtB,MAAM,KAAK,aAAa,WAAW;AAEnC,UAA0B,wBAAwB;GAAE;GAAO;GAAO,CAAC;EAEnE,MAAM,cAAc,eAAe,CAAC,GAAG,GAAG,EAAE,GAAG,GAAG,MAAM,KAAK,CAAC,CAAC;AAE/D,eAAa;GACX,MAAM,WAAW,gBACf,MAAM,WAAW,IAAI,EAAE,CACxB;AAED,UAAO,EACL,MACA,EAAE,OAAO,YAAY,OAAO,EAC5B,MAAM,UAAU,SAAS,SAAS,GAAG,SACtC;;;CAGN,CAAC"}
@@ -0,0 +1,11 @@
import { TimelineProps } from "./timeline.js";
import { Slots } from "vue";
//#region ../../packages/components/timeline/src/tokens.d.ts
interface TimelineProvider {
props: TimelineProps;
slots: Slots;
}
declare const TIMELINE_INJECTION_KEY = "timeline";
//#endregion
export { TIMELINE_INJECTION_KEY, TimelineProvider };
@@ -0,0 +1,6 @@
//#region ../../packages/components/timeline/src/tokens.ts
const TIMELINE_INJECTION_KEY = "timeline";
//#endregion
export { TIMELINE_INJECTION_KEY };
//# sourceMappingURL=tokens.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"tokens.mjs","names":[],"sources":["../../../../../../packages/components/timeline/src/tokens.ts"],"sourcesContent":["import type { Slots } from 'vue'\nimport type { TimelineProps } from './timeline'\n\nexport interface TimelineProvider {\n props: TimelineProps\n slots: Slots\n}\n\nexport const TIMELINE_INJECTION_KEY = 'timeline'\n"],"mappings":";AAQA,MAAa,yBAAyB"}
@@ -0,0 +1,2 @@
import "../../base/style/css.mjs";
import "element-plus/theme-chalk/el-timeline.css";
@@ -0,0 +1,2 @@
import "../../base/style/index.mjs";
import "element-plus/theme-chalk/src/timeline.scss";