Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: bump vitepress docs to v1.2.3 #1898

Open
wants to merge 30 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
82967e6
refactor(cli): rename `children` to `items` to fix changes with vitep…
fu050409 Jun 21, 2024
ab4cd16
refactor(config): refactor config for vitepress@latest
fu050409 Jun 21, 2024
0741ac6
refactor(home): refactor `index.md` hero settings
fu050409 Jun 21, 2024
1c5b5c6
chore(cache): ignore vitepress caches
fu050409 Jun 21, 2024
18d23ef
refactor(button): merge all vue files into `index.md`
fu050409 Jun 21, 2024
2aba868
refactor(theme): migrate theme config from old version
fu050409 Jun 21, 2024
5dc533c
fix(md): fix multi-single line `<script setup>` tag
fu050409 Jun 21, 2024
e4815e3
fix(demo): try use official demo block instead of custom
fu050409 Jun 21, 2024
18f0806
fix(log): remove some debug patterns
fu050409 Jun 21, 2024
5ecc4f2
refactor(docs): refactor all the documentation
fu050409 Jun 21, 2024
88f6e3f
chore(deps): update dependencies
fu050409 Jun 21, 2024
494a4b0
revert(home): use old version of home `index.md`
fu050409 Jun 21, 2024
c0d2ee2
refactor(layout): refactor layout to fit changes with vitepress@latest
fu050409 Jun 21, 2024
6ea38a5
chore: remove some debug expressions
fu050409 Jun 27, 2024
a24274f
fix(code): fix codeblock errors
fu050409 Jun 27, 2024
a17460b
chore(layout): add `@ts-ignore` for `@devui/button`
fu050409 Jun 27, 2024
d287216
chore(deps): bump pnpm to `v9.4.0`
fu050409 Jun 27, 2024
ec6654f
fix(active): fix errors in active bars
fu050409 Jun 27, 2024
bdc8cee
chore(vitepress): allow localhost dead links
fu050409 Jun 27, 2024
c22fded
fix(toc): fix headers is empty in toc
fu050409 Jun 30, 2024
8aee49a
chore: remove debug log
fu050409 Jun 30, 2024
59d55a4
fix(esm): fix lodash failed to load
fu050409 Jul 6, 2024
221d02d
chore(git): add `.temp` in `.gitignore`
fu050409 Jul 6, 2024
dcb29d5
fix(cpy): add `cpy` to build in Windows
fu050409 Jul 6, 2024
12c5e5b
fix(echarts): fix echarts for `window`
fu050409 Jul 6, 2024
166c5b2
fix(xss): fix xss unable to load
fu050409 Jul 6, 2024
d2bfddd
chore(deps): add `cpy`
fu050409 Jul 6, 2024
984ef80
fix(docs): refactor for `en-US` docs
fu050409 Jul 6, 2024
af2257b
fix(docs): fix `menu.md` in build process
fu050409 Jul 6, 2024
9e67267
perf(docs): fix code block padding
fu050409 Jul 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/devui-vue/devui-cli/templates/vitepress-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const { isReadyToRelease } = require('../shared/utils');
// return { text, link: `/${SITES_COMPONENTS_DIR_NAME}/${kebabCase(name)}/`, status }
// }

function buildCategoryOptions(text, children = []) {
return { text, children };
function buildCategoryOptions(text, items = []) {
return { text, items };
}

function generateZhMenus(componentsInfo) {
Expand Down Expand Up @@ -72,7 +72,7 @@ exports.createVitepressSidebarTemplates = (componentsInfo = []) => {
},
{
"text": "Design Token",
"children": DESIGN_TOKENS_INFO
"items": DESIGN_TOKENS_INFO
},
],
handler: generateZhMenus,
Expand All @@ -94,7 +94,7 @@ exports.createVitepressSidebarTemplates = (componentsInfo = []) => {
},
{
"text": "Design Token",
"children": DESIGN_TOKENS_INFO
"items": DESIGN_TOKENS_INFO
},
],
handler: generateEnMenus,
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/button/src/use-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { computed, inject } from 'vue';
import type { SetupContext } from 'vue';
import { ButtonProps, UseButtonReturnType, buttonGroupInjectionKey } from './button-types';
import { useNamespace } from '../../shared/hooks/use-namespace';
import { isString } from 'lodash';
import { isString } from 'lodash-es';

export default function useButton(props: ButtonProps, ctx: SetupContext): UseButtonReturnType {
const ns = useNamespace('button');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* 处理cascader-item中需要的参数
*/
import { cloneDeep } from 'lodash';
import { cloneDeep } from 'lodash-es';
import { ref, reactive, Ref } from 'vue';
import { CascaderProps, UseCascaderItemCallback, CascaderItem } from '../src/cascader-types';

Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/cascader/hooks/use-cascader.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ref, SetupContext, toRef, reactive, Ref, watch, onMounted } from 'vue';
import { cloneDeep } from 'lodash';
import { cloneDeep } from 'lodash-es';
import { initActiveIndexs, initSingleIptValue } from './use-cascader-single';
import { initMultipleCascaderItem, initTagList, getMultiModelValues } from './use-cascader-multiple';
import type { CascaderItem, CascaderValueType, CascaderProps, UseCascaderFn } from '../src/cascader-types';
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/cascader/hooks/use-filter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { debounce, cloneDeep } from 'lodash';
import { debounce, cloneDeep } from 'lodash-es';
import { ref, SetupContext, UnwrapRef, Ref, watch } from 'vue';
import { initActiveIndexs } from './use-cascader-single';
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/cascader/src/cascader.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineComponent, Transition, SetupContext, provide, Teleport, ref, computed } from 'vue';
import { cloneDeep } from 'lodash';
import { cloneDeep } from 'lodash-es';
import { useNamespace } from '../../shared/hooks/use-namespace';
import DCascaderList from '../components/cascader-list';
import DMultipleBox from '../components/cascader-multiple/index';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ref, computed, toRefs, provide, watch, onMounted, reactive } from 'vue';
import type { Ref, SetupContext } from 'vue';
import { mergeWith, cloneDeep, merge } from 'lodash';
import { mergeWith, cloneDeep, merge } from 'lodash-es';
import RadioMenu from '../components/radio-menu';
import CheckboxMenu from '../components/checkbox-menu';
import LabelMenu from '../components/label-menu';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { inBrowser } from '../../../shared/utils/common-var';
import { throttle } from 'lodash';
import { throttle } from 'lodash-es';
import { onBeforeMount, onMounted, ref, SetupContext, toRefs, nextTick, watch } from 'vue';
import { CodeEditorProps, Comment, Decoration, LayoutInfo, PositionInfo } from '../code-editor-types';

Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/color-picker/src/color-picker.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineComponent, ref, computed, onMounted, watch, nextTick, provide, unref, readonly, Transition } from 'vue';
import type { StyleValue, Ref } from 'vue';
import { computePosition, flip } from '@floating-ui/dom';
import { throttle } from 'lodash';
import { throttle } from 'lodash-es';
import { useReactive, colorPickerResize, isExhibitionColorPicker, changeColorValue } from './utils/composable';
import { colorPickerProps, ColorPickerProps } from './color-picker-types';
import colorPanel from './components/color-picker-panel/color-picker-panel';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Icon } from '../../../../icon';
import './color-history.scss';
import { fromHexa } from '../../utils/color-utils';
import { ProvideColorOptions, ColorPickerColor } from '../../utils/color-utils-types';
import { debounce } from 'lodash';
import { debounce } from 'lodash-es';

const STORAGE_KEY = 'STORAGE_COLOR_PICKER_HISTORY_KEY';
const MAX_HISTORY_COUNT = 8;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ref, onMounted, inject } from 'vue';
import type { Ref } from 'vue';
import { debounce } from 'lodash';
import { debounce } from 'lodash-es';
import { DataGridInjectionKey } from '../data-grid-types';
import type { InnerColumnConfig, InnerRowData, DataGridContext, ScrollYParams, ScrollXParams } from '../data-grid-types';
import { getXStartOrEndIndex, getYStartIndex } from '../utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ref, toRefs } from 'vue';
import type { SetupContext } from 'vue';
import { isFunction } from 'lodash';
import { isFunction } from 'lodash-es';
import type { DataGridProps, InnerRowData, RowData, IExpandLoadMoreResult } from '../data-grid-types';
import { generateInnerData } from '../utils';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ref } from 'vue';
import { debounce } from 'lodash';
import { debounce } from 'lodash-es';
import type { Placement } from '../../../overlay';
import type { InnerColumnConfig } from '../data-grid-types';

Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/data-grid/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { v4 as uuidv4 } from 'uuid';
import type { Ref } from 'vue';
import { isFunction } from 'lodash';
import { isFunction } from 'lodash-es';
import type { RowData, InnerRowData, RowKey, InnerColumnConfig, ColumnConfig } from './data-grid-types';
import { ColumnMinWidth } from './const';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DAY_DURATION, calendarItemHeight } from '../const';
import { CalendarDateItem, YearAndMonthItem, UseCalendarPanelReturnType, DatePickerProPanelProps } from '../date-picker-pro-types';
import dayjs from 'dayjs';
import type { Dayjs } from 'dayjs';
import { throttle } from 'lodash';
import { throttle } from 'lodash-es';
import useCalendarSelected from './use-calendar-selected';

export default function useCalendarPanel(props: DatePickerProPanelProps, ctx: SetupContext): UseCalendarPanelReturnType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { SetupContext } from 'vue';
import { useNamespace } from '../../../shared/hooks/use-namespace';
import { monthCalendarItemHeight } from '../const';
import { DatePickerProPanelProps, YearAndMonthItem, UseMonthCalendarPanelReturnType } from '../date-picker-pro-types';
import { throttle } from 'lodash';
import { throttle } from 'lodash-es';
import dayjs from 'dayjs';
import type { Dayjs } from 'dayjs';
import useCalendarSelected from './use-calendar-selected';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ref, onBeforeMount, nextTick, watch } from 'vue';
import type { SetupContext } from 'vue';
import { chunk } from 'lodash';
import { chunk } from 'lodash-es';
import { useNamespace } from '../../../shared/hooks/use-namespace';
import { DatePickerProPanelProps, UseYearCalendarPanelReturnType } from '../date-picker-pro-types';
import dayjs from 'dayjs';
Expand Down
26 changes: 14 additions & 12 deletions packages/devui-vue/devui/echarts/src/echarts.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { defineComponent, onMounted, onUnmounted, ref } from "vue";
import { DevuiChartProps, devuiChartProps } from "./echarts-types";
import * as echarts from 'echarts';
import { DEVUI_ECHART_THEME } from "./echarts-theme";
import { toRefs } from "@vueuse/core";

import { defineComponent, onMounted, onUnmounted, ref } from 'vue';
import { DevuiChartProps, devuiChartProps } from './echarts-types';
import { DEVUI_ECHART_THEME } from './echarts-theme';
import { toRefs } from '@vueuse/core';

export default defineComponent({
name: 'DChart',
Expand All @@ -19,6 +17,12 @@ export default defineComponent({

const chartRef = ref();

// dynamic import echarts
let echarts: unknown;
if (typeof window !== 'undefined') {
echarts = import('echarts');
}

const themeChange = () => {
isDark = !!themeService?.currentTheme?.isDark;
theme = isDark ? DEVUI_ECHART_THEME.defaultDarkTheme : DEVUI_ECHART_THEME.defaultLightTheme;
Expand All @@ -44,7 +48,7 @@ export default defineComponent({
theme = isDark ? DEVUI_ECHART_THEME.defaultDarkTheme : DEVUI_ECHART_THEME.defaultLightTheme;
echartInstacne = echarts.init(chartRef.value, theme);

if(themeService) {
if (themeService) {
themeService.eventBus.add('themeChanged', themeChange);
}

Expand All @@ -56,14 +60,12 @@ export default defineComponent({

onUnmounted(() => {
echartInstacne?.dispatchAction({
type: 'hideTip'
type: 'hideTip',
});

themeService.eventBus.remove('themeChanged', themeChange);
});

return () => (
<div ref={chartRef} class="devui-charts"></div>
);
}
return () => <div ref={chartRef} class="devui-charts"></div>;
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { EditableSelectContext, Option as O, SELECT_KEY } from '../../editable-s
import Option from '../option/option';
import Loading from '../../../../loading/src/loading-directive';
import { useNamespace } from '../../../../shared/hooks/use-namespace';
import { debounce } from 'lodash';
import { debounce } from 'lodash-es';

export default defineComponent({
name: 'DEditableSelectDropdown',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { computed, Ref, SetupContext } from 'vue';
import { debounce, isFunction } from 'lodash';
import { debounce, isFunction } from 'lodash-es';
import { EditableSelectProps } from '../editable-select-types';
import { States } from './use-select';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { computed, ComputedRef, getCurrentInstance, nextTick, onMounted, reactive, ref, Ref, SetupContext, watch } from 'vue';
import { EditableSelectProps, Option, Options } from '../editable-select-types';
import { createI18nTranslate } from '../../../locale/create';
import { isFunction, isNil } from 'lodash';
import { isFunction, isNil } from 'lodash-es';

export interface UseSelectStatesReturnType {
hoveringIndex: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import hljs from 'highlight.js';
import MarkdownIt from 'markdown-it';
import { filterXSS, getDefaultCSSWhiteList, getDefaultWhiteList, IWhiteList } from 'xss';
import pkg from 'xss';
import { mermaidRender, refreshMermaid } from '../plugins/mermaid';
import tocAndAnchor from '../plugins/toc';
import type { MdPlugin, ICustomXssRule, ICustomRenderRule } from '../editor-md-types';

const { filterXSS, getDefaultWhiteList, getDefaultCSSWhiteList, IWhiteList } = pkg;

export class MDRenderService {
private xssWhiteList = getDefaultWhiteList();
private cssWhiteList = getDefaultCSSWhiteList();
Expand All @@ -19,7 +21,7 @@ export class MDRenderService {
}
return '';
},
}) as any;
});
private baseUrl = '';
private breaks = true;
private renderParse: Function | undefined;
Expand Down Expand Up @@ -50,27 +52,27 @@ export class MDRenderService {
this.xssWhiteList['td'] = ['style'];
}

setBaseUrl(url: string) {
setBaseUrl(url: string): void {
this.baseUrl = url;
}

setBreaks(breaks: boolean) {
setBreaks(breaks: boolean): void {
this.breaks = breaks;
}

setRenderParse(func: Function) {
setRenderParse(func: Function): void {
this.renderParse = func;
}

getXssWhiteList() {
getXssWhiteList(): IWhiteList {
return this.xssWhiteList;
}

setXssWhiteList(list: IWhiteList) {
setXssWhiteList(list: IWhiteList): void {
this.xssWhiteList = list;
}

setCustomXssRules(rules: ICustomXssRule[]) {
setCustomXssRules(rules: ICustomXssRule[]): void {
if (rules) {
rules.forEach((rule) => {
if (rule['value'] === null) {
Expand All @@ -82,19 +84,19 @@ export class MDRenderService {
}
}

setCustomRendererRules(rules: ICustomRenderRule[]) {
setCustomRendererRules(rules: ICustomRenderRule[]): void {
if (rules) {
rules.forEach((rule) => {
this.mdt.renderer.rules[rule['key']] = rule['value'];
});
}
}

setOptions(options = {}) {
setOptions(options = {}): void {
this.mdt.set(options);
}

setPlugins(plugins: Array<MdPlugin>) {
setPlugins(plugins: Array<MdPlugin>): void {
plugins.forEach((item) => {
const { plugin, opts } = item;
this.mdt.use(plugin, opts);
Expand Down Expand Up @@ -125,7 +127,7 @@ export class MDRenderService {
});
}

generateHTML(text: string) {
generateHTML(text: string): string {
this.mdt.set({
breaks: this.breaks,
});
Expand Down Expand Up @@ -156,7 +158,7 @@ export class MDRenderService {
return this.replaceInternalUrl(html);
}

public setRules(mdRules: Record<string, any>): void {
public setRules(mdRules: Record<string, unknown>): void {
if (mdRules) {
Object.keys(mdRules).forEach((rule) => {
this.mdt[rule].set(mdRules[rule]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import cloneDeep from 'lodash/cloneDeep';
import { throttle, cloneDeep }from 'lodash-es';
import { computed, nextTick, onMounted, reactive, Ref, ref, SetupContext, toRefs, watch, onBeforeUnmount } from 'vue';
import { debounce } from '../../../shared/utils';
import { EditorMdProps, Mode } from '../editor-md-types';
import { DEFAULT_TOOLBARS } from '../toolbar-config';
import { parseHTMLStringToDomList } from '../utils';
import { refreshEditorCursor, _enforceMaxLength } from './helper';
import { throttle } from 'lodash';

export function useEditorMd(props: EditorMdProps, ctx: SetupContext) {
const {
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/editor-md/src/plugins/checkbox.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { extend } from 'lodash';
import { extend } from 'lodash-es';

const checkboxReplace = function (md: any, options: any) {
let lastId: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/editor-md/src/plugins/toc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import cloneDeep from 'lodash/cloneDeep';
import { cloneDeep }from 'lodash-es';
import Token from 'markdown-it/lib/token';

const TOC = '[toc]';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { computed, inject, nextTick, onMounted, ref } from 'vue';
import { castArray, get, isFunction, clone, isEqual, set } from 'lodash';
import { castArray, get, isFunction, clone, isEqual, set } from 'lodash-es';
import Schema from 'async-validator';
import type { ComputedRef, Ref } from 'vue';
import type { RuleItem } from 'async-validator';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { castArray } from 'lodash';
import { castArray } from 'lodash-es';
import type { ValidateFieldsError } from 'async-validator';
import { UseFormValidation } from '../form-types';
import { FormItemContext, FormValidateCallback, FormValidateResult } from '../components/form-item/form-item-types';
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/git-graph/src/git-graph-class.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cloneDeep } from "lodash";
import { cloneDeep } from "lodash-es";
import { CommitInfo, GitGraphData } from "./git-graph-types";

export class GitGraph {
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/mention/src/mention.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import DTextarea from '../../textarea/src/textarea';
import DIcon from '../../icon/src/icon';
import './mention.scss';
import { useNamespace } from '../../shared/hooks/use-namespace';
import { debounce } from 'lodash';
import { debounce } from 'lodash-es';

export default defineComponent({
name: 'DMention',
Expand Down
2 changes: 1 addition & 1 deletion packages/devui-vue/devui/popover/src/use-popover.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { toRefs, ref, computed, watch, onUnmounted, onMounted } from 'vue';
import type { Ref, ComputedRef } from 'vue';
import { debounce } from 'lodash';
import { debounce } from 'lodash-es';
import { PopoverProps, UsePopoverEvent } from './popover-types';

const TransformOriginMap: Record<string, string> = {
Expand Down
Loading
Loading