feat:组件框架
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
// @ts-nocheck
|
||||
// This file is generated by Umi automatically
|
||||
// DO NOT CHANGE IT MANUALLY!
|
||||
export const locales = [
|
||||
{
|
||||
"id": "zh-CN",
|
||||
"name": "中文",
|
||||
"base": "/"
|
||||
}
|
||||
];
|
||||
export const messages = {
|
||||
"en-US": {
|
||||
"header.search.placeholder": "Type keywords...",
|
||||
"header.color.mode.light": "Light Mode",
|
||||
"header.color.mode.dark": "Dark Mode",
|
||||
"header.color.mode.auto": "Follow System",
|
||||
"header.social.github": "GitHub",
|
||||
"header.social.weibo": "Weibo",
|
||||
"header.social.twitter": "Twitter",
|
||||
"header.social.x": "X",
|
||||
"header.social.gitlab": "GitLab",
|
||||
"header.social.facebook": "Facebook",
|
||||
"header.social.zhihu": "Zhihu",
|
||||
"header.social.yuque": "Yuque",
|
||||
"header.social.linkedin": "Linkedin",
|
||||
"previewer.actions.code.expand": "Show Code",
|
||||
"previewer.actions.code.shrink": "Hide Code",
|
||||
"previewer.actions.code.editable": "Edit code with real-time preview",
|
||||
"previewer.actions.code.readonly": "Only index file is editable",
|
||||
"previewer.actions.sketch": "Copy to Sketch app",
|
||||
"previewer.actions.sketch.group": "Copy as Sketch Group",
|
||||
"previewer.actions.sketch.symbol": "Copy as Sketch Symbol",
|
||||
"previewer.actions.sketch.divider": "------------------------",
|
||||
"previewer.actions.sketch.guide": "How to paste to Sketch?",
|
||||
"previewer.actions.codesandbox": "Open in CodeSandbox",
|
||||
"previewer.actions.codepen": "Open in CodePen (Not implemented)",
|
||||
"previewer.actions.stackblitz": "Open in StackBlitz",
|
||||
"previewer.actions.separate": "Open in separate page",
|
||||
"404.title": "PAGE NOT FOUND",
|
||||
"404.back": "Back to homepage",
|
||||
"api.component.name": "Name",
|
||||
"api.component.description": "Description",
|
||||
"api.component.type": "Type",
|
||||
"api.component.default": "Default",
|
||||
"api.component.required": "(required)",
|
||||
"api.component.release.alpha": "Alpha",
|
||||
"api.component.release.beta": "Beta",
|
||||
"api.component.release.experimental": "Experimental",
|
||||
"api.component.release.deprecated": "Deprecated",
|
||||
"api.component.unavailable": "Properties definition is resolving, wait a moment...",
|
||||
"api.component.loading": "Properties definition is resolving, wait a moment...",
|
||||
"api.component.not.found": "Properties definition not found for {id} component",
|
||||
"content.tabs.default": "Doc",
|
||||
"content.footer.last.updated": "Last updated: ",
|
||||
"content.footer.actions.edit": "Improve this documentation",
|
||||
"content.footer.actions.previous": "PREV",
|
||||
"content.footer.actions.next": "NEXT",
|
||||
"search.not.found": "No content was found",
|
||||
"search.loading": "Loading...",
|
||||
"layout.sidebar.btn": "Sidebar"
|
||||
},
|
||||
"zh-CN": {
|
||||
"header.search.placeholder": "输入关键字搜索...",
|
||||
"header.color.mode.light": "亮色模式",
|
||||
"header.color.mode.dark": "暗色模式",
|
||||
"header.color.mode.auto": "跟随系统",
|
||||
"header.social.github": "GitHub",
|
||||
"header.social.weibo": "微博",
|
||||
"header.social.twitter": "Twitter",
|
||||
"header.social.x": "X",
|
||||
"header.social.gitlab": "GitLab",
|
||||
"header.social.facebook": "Facebook",
|
||||
"header.social.zhihu": "知乎",
|
||||
"header.social.yuque": "语雀",
|
||||
"header.social.linkedin": "Linkedin",
|
||||
"previewer.actions.code.expand": "展开代码",
|
||||
"previewer.actions.code.shrink": "收起代码",
|
||||
"previewer.actions.code.editable": "编辑代码可实时预览",
|
||||
"previewer.actions.code.readonly": "仅 index 可编辑",
|
||||
"previewer.actions.codesandbox": "在 CodeSandbox 中打开",
|
||||
"previewer.actions.sketch": "拷贝到 Sketch",
|
||||
"previewer.actions.sketch.group": "拷贝为 Sketch Group",
|
||||
"previewer.actions.sketch.symbol": "拷贝为 Sketch Symbol",
|
||||
"previewer.actions.sketch.divider": "----------------------",
|
||||
"previewer.actions.sketch.guide": "如何粘贴到 SKetch?",
|
||||
"previewer.actions.stackblitz": "在 StackBlitz 中打开",
|
||||
"previewer.actions.separate": "在独立页面中打开",
|
||||
"404.title": "页面未找到",
|
||||
"404.back": "返回首页",
|
||||
"api.component.name": "属性名",
|
||||
"api.component.description": "描述",
|
||||
"api.component.type": "类型",
|
||||
"api.component.default": "默认值",
|
||||
"api.component.required": "(必选)",
|
||||
"api.component.release.alpha": "Alpha",
|
||||
"api.component.release.beta": "Beta",
|
||||
"api.component.release.experimental": "实验性",
|
||||
"api.component.release.deprecated": "废弃",
|
||||
"api.component.unavailable": "属性定义正在解析中,稍等片刻...",
|
||||
"api.component.loading": "属性定义正在解析中,稍等片刻...",
|
||||
"api.component.not.found": "未找到 {id} 组件的属性定义",
|
||||
"content.tabs.default": "文档",
|
||||
"content.footer.last.updated": "最后更新时间:",
|
||||
"content.footer.actions.edit": "帮助改进此文档",
|
||||
"content.footer.actions.previous": "上一篇",
|
||||
"content.footer.actions.next": "下一篇",
|
||||
"search.not.found": "未找到相关内容",
|
||||
"search.loading": "加载中...",
|
||||
"layout.sidebar.btn": "侧边菜单"
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
// @ts-nocheck
|
||||
// This file is generated by Umi automatically
|
||||
// DO NOT CHANGE IT MANUALLY!
|
||||
import { history } from 'dumi';
|
||||
import React, { useState, useLayoutEffect, useCallback, type ReactNode } from 'react';
|
||||
import { RawIntlProvider, createIntl, createIntlCache } from '/Users/donghym/Desktop/day/UI/Nova/node_modules/.pnpm/react-intl@7.0.0_react@19.2.6_typescript@6.0.3/node_modules/react-intl';
|
||||
import { useIsomorphicLayoutEffect } from '/Users/donghym/Desktop/day/UI/Nova/node_modules/.pnpm/dumi@2.4.28_@babel+core@7.29.7_@swc+helpers@0.5.15_@types+node@25.9.1_@types+react@18.3_cf46fd6bbea4e97c0978eb785c920599/node_modules/dumi/dist/client/theme-api/utils.js'
|
||||
import { locales, messages } from './config';
|
||||
|
||||
const cache = createIntlCache();
|
||||
|
||||
const LocalesContainer: FC<{ children: ReactNode }> = (props) => {
|
||||
const getIntl = useCallback(() => {
|
||||
const base = ""
|
||||
const matched = locales.slice().reverse().find((locale) => (
|
||||
'suffix' in locale
|
||||
// suffix mode
|
||||
? history.location.pathname.replace(/([^/])\/$/, '$1').endsWith(locale.suffix)
|
||||
// base mode
|
||||
: history.location.pathname.replace(/([^/])\/$/, '$1')
|
||||
.startsWith(base + locale.base)
|
||||
));
|
||||
let locale = matched ? matched.id : locales[0].id;
|
||||
// using query on demos
|
||||
if(history.location.pathname.startsWith(base + '/~demos')){
|
||||
const params = new URLSearchParams(history.location.search);
|
||||
// match the locale of the query
|
||||
if (params.get('locale')){
|
||||
locale = params.get('locale');
|
||||
}
|
||||
}
|
||||
const localeMessages = messages[locale] || {};
|
||||
|
||||
// append internal message, for use intl as string template util
|
||||
localeMessages['$internal.edit.link'] = undefined;
|
||||
|
||||
localeMessages['$internal.api.sourceLink'] = undefined;
|
||||
|
||||
return createIntl({ locale, messages: localeMessages }, cache);
|
||||
}, []);
|
||||
const [intl, setIntl] = useState(() => getIntl());
|
||||
|
||||
useIsomorphicLayoutEffect(() => {
|
||||
return history.listen(() => {
|
||||
setIntl(getIntl());
|
||||
});
|
||||
}, []);
|
||||
|
||||
return <RawIntlProvider value={intl} key={intl.locale}>{props.children}</RawIntlProvider>;
|
||||
}
|
||||
|
||||
export function i18nProvider(container: Element) {
|
||||
return React.createElement(LocalesContainer, null, container);
|
||||
}
|
||||
Reference in New Issue
Block a user