├── .env ├── packages ├── mindflow │ ├── .npmignore │ ├── src │ │ ├── definition │ │ │ ├── shapes │ │ │ │ ├── index.ts │ │ │ │ └── MinimalNode.ts │ │ │ ├── graphOpts.test.ts │ │ │ ├── label.tsx │ │ │ ├── edge.ts │ │ │ ├── connector.ts │ │ │ ├── minimapOpts.ts │ │ │ ├── graphOpts.ts │ │ │ ├── __snapshots__ │ │ │ │ └── graphOpts.test.ts.snap │ │ │ └── port.tsx │ │ ├── components │ │ │ ├── Port │ │ │ │ ├── index.ts │ │ │ │ ├── __snapshots__ │ │ │ │ │ ├── InPort.test.tsx.snap │ │ │ │ │ └── OutPort.test.tsx.snap │ │ │ │ ├── style.less │ │ │ │ ├── InPort.test.tsx │ │ │ │ ├── OutPort.test.tsx │ │ │ │ ├── InPort.tsx │ │ │ │ └── OutPort.tsx │ │ │ ├── MindNode │ │ │ │ ├── ImageNode.less │ │ │ │ ├── UrlNode.tsx │ │ │ │ ├── ImageNode.tsx │ │ │ │ └── useFolded.ts │ │ │ ├── index.ts │ │ │ ├── CollapseIcon │ │ │ │ ├── style.less │ │ │ │ └── index.test.tsx │ │ │ ├── EvidenceEdge │ │ │ │ ├── style.less │ │ │ │ ├── Reference.less │ │ │ │ └── Reference.test.tsx │ │ │ └── ErrorBoundary.tsx │ │ ├── types │ │ │ ├── index.ts │ │ │ ├── cell.ts │ │ │ ├── graph.ts │ │ │ └── mindflow.ts │ │ ├── themes │ │ │ ├── theme.less │ │ │ └── nodeColor.ts │ │ ├── utils │ │ │ ├── index.ts │ │ │ └── getServiceToken.ts │ │ ├── store │ │ │ └── key.ts │ │ ├── hooks │ │ │ ├── useGraph.test.ts │ │ │ ├── useRegister.test.ts │ │ │ ├── useRegister.tsx │ │ │ └── useGraph.ts │ │ ├── index.test.tsx │ │ ├── style.less │ │ ├── mindflow.md │ │ └── index.tsx │ ├── tsconfig.json │ ├── .fatherrc.ts │ ├── demos │ │ ├── Museum.tsx │ │ ├── Demo.tsx │ │ └── Thinking.tsx │ ├── jest.config.js │ ├── README.md │ ├── tests │ │ └── index.test.tsx │ └── package.json ├── user-panel │ ├── tests │ │ ├── setup.ts │ │ ├── matchMedia.mock.ts │ │ └── index.test.tsx │ ├── tsconfig.json │ ├── src │ │ ├── locales │ │ │ ├── en-US │ │ │ │ └── index.ts │ │ │ ├── zh-CN │ │ │ │ ├── index.ts │ │ │ │ └── login.ts │ │ │ └── index.ts │ │ ├── components │ │ │ ├── index.ts │ │ │ ├── Header │ │ │ │ ├── style.less │ │ │ │ ├── index.test.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── index.test.tsx.snap │ │ │ │ └── index.tsx │ │ │ ├── Intl.ts │ │ │ ├── WechatLogin │ │ │ │ ├── style.less │ │ │ │ ├── index.test.tsx │ │ │ │ └── index.tsx │ │ │ └── Footer │ │ │ │ ├── style.less │ │ │ │ └── index.test.tsx │ │ ├── types │ │ │ ├── index.ts │ │ │ └── IUserLogin.ts │ │ ├── index.ts │ │ ├── login │ │ │ ├── LoginErrorMessage.test.tsx │ │ │ ├── LoginErrorMessage.tsx │ │ │ ├── index.test.tsx │ │ │ └── __snapshots__ │ │ │ │ └── LoginErrorMessage.test.tsx.snap │ │ ├── layout │ │ │ ├── style.less │ │ │ └── index.tsx │ │ ├── user-panel.md │ │ ├── register.md │ │ ├── login.md │ │ └── UserLogin.tsx │ ├── .fatherrc.ts │ ├── demos │ │ ├── Login.tsx │ │ ├── LoginWithLogo.tsx │ │ ├── LoginWithForgotUrl.tsx │ │ └── LoginWithFooter.tsx │ ├── jest.config.js │ ├── README.md │ └── package.json ├── heatmap-calendar │ ├── src │ │ ├── hooks │ │ │ ├── index.ts │ │ │ └── useDarkTheme.ts │ │ ├── type.ts │ │ ├── style.less │ │ ├── utils │ │ │ ├── index.test.ts │ │ │ └── index.ts │ │ ├── shape.ts │ │ └── heatmap-calendar.md │ ├── tsconfig.json │ ├── .fatherrc.ts │ ├── demos │ │ └── Demo.tsx │ ├── jest.config.js │ ├── README.md │ ├── package.json │ └── tests │ │ └── index.test.tsx ├── preloader │ ├── src │ │ ├── index.ts │ │ ├── demos │ │ │ └── Square.tsx │ │ ├── Square.less │ │ ├── preloader.md │ │ └── Square.tsx │ ├── tsconfig.json │ ├── .fatherrc.ts │ ├── tests │ │ ├── index.test.tsx │ │ └── __snapshots__ │ │ │ └── index.test.tsx.snap │ ├── jest.config.ts │ ├── README.md │ ├── package.json │ └── CHANGELOG.md ├── journey-map │ ├── tsconfig.json │ ├── src │ │ ├── Chart │ │ │ ├── style.less │ │ │ ├── index.test.tsx │ │ │ └── __snapshots__ │ │ │ │ └── index.test.tsx.snap │ │ ├── types │ │ │ ├── index.ts │ │ │ └── yml.ts │ │ ├── utils │ │ │ ├── index.ts │ │ │ ├── getServiceToken.ts │ │ │ ├── length.test.ts │ │ │ └── yml.ts │ │ ├── components │ │ │ ├── ErrorFallback.less │ │ │ ├── index.ts │ │ │ ├── ErrorFallback.test.tsx │ │ │ ├── Section.less │ │ │ ├── ListSection.less │ │ │ ├── Section.tsx │ │ │ ├── __snapshots__ │ │ │ │ └── OverflowTitle.test.tsx.snap │ │ │ ├── OverflowTitle.test.tsx │ │ │ ├── OverflowTitle.tsx │ │ │ └── ErrorFallback.tsx │ │ ├── token.less │ │ ├── styles.less │ │ ├── Thoughts │ │ │ └── index.tsx │ │ ├── Stages │ │ │ ├── style.less │ │ │ └── index.test.tsx │ │ ├── PainPoints │ │ │ ├── index.tsx │ │ │ ├── index.test.tsx │ │ │ └── __snapshots__ │ │ │ │ └── index.test.tsx.snap │ │ └── Actions │ │ │ ├── style.less │ │ │ └── index.test.tsx │ ├── .fatherrc.ts │ ├── demos │ │ ├── YAMLWithString.tsx │ │ ├── CustomColor.tsx │ │ ├── Demo.tsx │ │ └── YAMLWithURL.tsx │ ├── tests │ │ ├── index.test.tsx │ │ └── __snapshots__ │ │ │ └── index.test.tsx.snap │ ├── jest.config.js │ └── README.md ├── page-loading │ ├── tsconfig.json │ ├── .fatherrc.ts │ ├── types │ │ └── multi-ngprogress.d.ts │ ├── src │ │ ├── demos │ │ │ ├── Basic.tsx │ │ │ ├── CustomLoader.tsx │ │ │ ├── WithoutProgress.tsx │ │ │ ├── Fullscreen.tsx │ │ │ ├── LoadingState.tsx │ │ │ └── CustomColor.tsx │ │ └── style.less │ ├── jest.config.js │ ├── README.md │ ├── package.json │ └── tests │ │ └── index.test.tsx ├── sortable-list │ ├── tsconfig.json │ ├── src │ │ ├── components │ │ │ ├── Remove │ │ │ │ ├── index.ts │ │ │ │ └── Remove.tsx │ │ │ ├── index.ts │ │ │ ├── Handle │ │ │ │ └── index.tsx │ │ │ ├── Action │ │ │ │ ├── index.tsx │ │ │ │ └── style.ts │ │ │ └── DraggingOverlay.tsx │ │ ├── types │ │ │ ├── index.ts │ │ │ └── common.ts │ │ ├── index.ts │ │ ├── store │ │ │ ├── initialState.ts │ │ │ ├── utils.ts │ │ │ └── utils.test.ts │ │ ├── container │ │ │ ├── StoreUpdater.tsx │ │ │ └── Wrapper.tsx │ │ └── hooks │ │ │ └── useStoreUpdater.ts │ ├── .fatherrc.ts │ ├── jest.config.js │ ├── tests │ │ └── index.test.tsx │ ├── README.md │ ├── demos │ │ ├── Basic.tsx │ │ └── CustomStyle.tsx │ └── package.json ├── tag-selector │ ├── tsconfig.json │ ├── .fatherrc.ts │ ├── src │ │ ├── tag-selector.md │ │ ├── type.ts │ │ ├── components │ │ │ ├── NewTag.less │ │ │ └── Group.less │ │ ├── demos │ │ │ └── index.tsx │ │ ├── useLabel.ts │ │ ├── theme │ │ │ └── token.less │ │ └── style.less │ ├── jest.config.js │ ├── README.md │ ├── tests │ │ └── __snapshots__ │ │ │ ├── NewTag.test.tsx.snap │ │ │ ├── Group.test.tsx.snap │ │ │ └── EditableTags.test.tsx.snap │ └── package.json ├── macos-traffic-light │ ├── tsconfig.json │ ├── .fatherrc.ts │ ├── src │ │ ├── icon.less │ │ ├── MinimizeIcon.tsx │ │ ├── useTrafficLight.ts │ │ ├── MaximizeIcon.tsx │ │ ├── macos-traffic-light.md │ │ └── CloseIcon.tsx │ ├── jest.config.js │ ├── demos │ │ ├── Basic.tsx │ │ └── DisableMax.tsx │ ├── tests │ │ └── __snapshots__ │ │ │ └── index.test.tsx.snap │ └── package.json ├── asset-gallery │ ├── tsconfig.json │ ├── src │ │ ├── utils │ │ │ ├── index.ts │ │ │ ├── checkSvg.ts │ │ │ ├── sketch.ts │ │ │ ├── checkSvg.test.ts │ │ │ ├── clipboard.ts │ │ │ ├── helper.ts │ │ │ └── yml.ts │ │ ├── index.tsx │ │ └── components │ │ │ ├── Layout.test.tsx │ │ │ ├── Layout.style.ts │ │ │ ├── ActionButton.tsx │ │ │ ├── LayoutButton.tsx │ │ │ ├── Header.test.tsx │ │ │ └── AssetCard.test.tsx │ ├── .fatherrc.ts │ ├── types │ │ └── index.d.ts │ ├── demos │ │ ├── png.ts │ │ ├── sketch.ts │ │ ├── PngDemo.tsx │ │ ├── Demo.tsx │ │ ├── YAMLDemo.tsx │ │ ├── SketchDemo.tsx │ │ └── yml.ts │ ├── jest.config.js │ ├── tests │ │ ├── index.test.tsx │ │ └── data.ts │ ├── README.md │ └── package.json ├── layout-kit │ └── src │ │ └── flexbox.md ├── i18n │ ├── .fatherrc.ts │ ├── src │ │ ├── types.ts │ │ ├── IntlProvider.tsx │ │ ├── useStoredLocale.ts │ │ ├── useLocaleMessages.ts │ │ └── index.tsx │ ├── jest.config.js │ ├── tsconfig.json │ ├── README.md │ ├── CHANGELOG.md │ └── package.json └── float-label-input │ ├── .fatherrc.ts │ ├── src │ ├── demos │ │ ├── Height.tsx │ │ └── Basic.tsx │ ├── style.less │ ├── float-label-input.md │ └── useHover.ts │ ├── tsconfig.json │ ├── jest.config.js │ ├── README.md │ ├── tests │ ├── __snapshots__ │ │ └── index.spec.tsx.snap │ └── index.spec.tsx │ └── package.json ├── types └── index.d.ts ├── .commitlintrc ├── .eslintrc.js ├── .stylelintrc.js ├── public └── favicon.ico ├── codecov.yml ├── scripts └── create-package │ └── template │ ├── tsconfig.json.ejs │ ├── .fatherrc.ts.ejs │ ├── src │ └── index.tsx.ejs │ ├── tests │ └── index.test.tsx.ejs │ ├── jest.config.js.ejs │ ├── README.md.ejs │ └── package.json.ejs ├── pnpm-workspace.yaml ├── .husky ├── pre-commit └── commit-msg ├── .fatherrc.ts ├── .npmrc ├── .releaserc.js ├── .eslintignore ├── docs ├── biz-components.md ├── guide.md └── components.md ├── tests └── setup.ts ├── renovate.json ├── tsconfig-check.json ├── lerna.json ├── .changelogrc.js ├── .prettierignore ├── .editorconfig ├── .prettierrc.js ├── jest.config.ts ├── .github └── workflows │ ├── test.yml │ └── release.yml ├── .gitignore ├── typedoc.js ├── config └── menu.ts ├── LICENSE └── .dumirc.ts /.env: -------------------------------------------------------------------------------- 1 | PORT=9012 2 | -------------------------------------------------------------------------------- /packages/mindflow/.npmignore: -------------------------------------------------------------------------------- 1 | __snapshots__ 2 | -------------------------------------------------------------------------------- /types/index.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.less'; 2 | -------------------------------------------------------------------------------- /.commitlintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["gitmoji"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/user-panel/tests/setup.ts: -------------------------------------------------------------------------------- 1 | import './matchMedia.mock'; 2 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = require('@umijs/lint/dist/config/eslint'); 2 | -------------------------------------------------------------------------------- /.stylelintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = require('@umijs/lint/dist/config/stylelint'); 2 | -------------------------------------------------------------------------------- /packages/heatmap-calendar/src/hooks/index.ts: -------------------------------------------------------------------------------- 1 | export * from './useDarkTheme'; 2 | -------------------------------------------------------------------------------- /packages/mindflow/src/definition/shapes/index.ts: -------------------------------------------------------------------------------- 1 | export * from './MinimalNode'; 2 | -------------------------------------------------------------------------------- /packages/mindflow/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /packages/preloader/src/index.ts: -------------------------------------------------------------------------------- 1 | export { default as Square } from './Square'; 2 | -------------------------------------------------------------------------------- /packages/preloader/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /packages/journey-map/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /packages/page-loading/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /packages/sortable-list/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /packages/tag-selector/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /packages/user-panel/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /packages/heatmap-calendar/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /packages/macos-traffic-light/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /packages/sortable-list/src/components/Remove/index.ts: -------------------------------------------------------------------------------- 1 | export {Remove} from './Remove'; 2 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvinxx/components/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | fixes: 2 | - '/home/runner/work/components/components/::' # 修正 github ci 路径问题 3 | -------------------------------------------------------------------------------- /packages/journey-map/src/Chart/style.less: -------------------------------------------------------------------------------- 1 | .avx-journey-map-chart { 2 | display: flex; 3 | } 4 | -------------------------------------------------------------------------------- /packages/journey-map/src/types/index.ts: -------------------------------------------------------------------------------- 1 | export * from './type'; 2 | export * from './yml'; 3 | -------------------------------------------------------------------------------- /scripts/create-package/template/tsconfig.json.ejs: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /packages/sortable-list/src/types/index.ts: -------------------------------------------------------------------------------- 1 | export * from './components'; 2 | export * from './store'; 3 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | # 所有在 packages/ 和 components/ 子目录下的 package 3 | - 'packages/**' 4 | -------------------------------------------------------------------------------- /packages/asset-gallery/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/user-panel/src/locales/en-US/index.ts: -------------------------------------------------------------------------------- 1 | import pages from './login'; 2 | 3 | export default pages; 4 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | npx --no-install lint-staged 5 | -------------------------------------------------------------------------------- /.fatherrc.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'father'; 2 | 3 | export default defineConfig({ esm: { output: 'dist' } }); 4 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | npx --no-install commitlint --edit $1 5 | -------------------------------------------------------------------------------- /packages/asset-gallery/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from './svg'; 2 | export * from './png'; 3 | export * from './checkSvg'; 4 | -------------------------------------------------------------------------------- /packages/mindflow/src/components/Port/index.ts: -------------------------------------------------------------------------------- 1 | export { InPort } from './InPort'; 2 | export { OutPort } from './OutPort'; 3 | -------------------------------------------------------------------------------- /packages/mindflow/src/types/index.ts: -------------------------------------------------------------------------------- 1 | export * from './graph'; 2 | export * from './mindflow'; 3 | export * from './cell'; 4 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | shamefully-hoist=true 2 | registry=https://registry.npmmirror.com/ 3 | lockfile=false 4 | strict-peer-dependencies=false 5 | -------------------------------------------------------------------------------- /.releaserc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['semantic-release-config-gitmoji'], 3 | branches: ['master', 'beta'], 4 | }; 5 | -------------------------------------------------------------------------------- /packages/asset-gallery/src/utils/checkSvg.ts: -------------------------------------------------------------------------------- 1 | export const checkSvg = (url: string) => { 2 | return url.endsWith('.svg'); 3 | }; 4 | -------------------------------------------------------------------------------- /packages/user-panel/src/components/index.ts: -------------------------------------------------------------------------------- 1 | export * from './Intl'; 2 | export * from './Header'; 3 | export * from './Footer'; 4 | -------------------------------------------------------------------------------- /packages/journey-map/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from './getServiceToken'; 2 | export * from './yml'; 3 | export * from './length'; 4 | -------------------------------------------------------------------------------- /packages/asset-gallery/.fatherrc.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'father'; 2 | 3 | export default defineConfig({ 4 | esm: { output: 'dist' }, 5 | }); 6 | -------------------------------------------------------------------------------- /packages/layout-kit/src/flexbox.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Layout Kit(废弃) 3 | group: 4 | title: 废弃 5 | order: 1000 6 | --- 7 | 8 | 已迁移至 `react-layout-kit` 9 | -------------------------------------------------------------------------------- /packages/user-panel/src/types/index.ts: -------------------------------------------------------------------------------- 1 | export type PanelContentType = 'login' | 'register' | 'forgot'; 2 | 3 | export * as IUserLogin from './IUserLogin'; 4 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /lambda/mock/** 2 | /scripts 3 | /config 4 | /example 5 | _test_ 6 | __test__ 7 | 8 | /node_modules 9 | jest* 10 | es 11 | lib 12 | /docs 13 | -------------------------------------------------------------------------------- /packages/i18n/.fatherrc.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'father'; 2 | import config from '../../.fatherrc'; 3 | 4 | export default defineConfig({ ...config }); 5 | -------------------------------------------------------------------------------- /packages/mindflow/.fatherrc.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'father'; 2 | import config from '../../.fatherrc'; 3 | 4 | export default defineConfig({ ...config }); 5 | -------------------------------------------------------------------------------- /packages/mindflow/src/themes/theme.less: -------------------------------------------------------------------------------- 1 | @text-color: rgba(0, 0, 0, 0.85); 2 | @text-color-secondary: rgba(0, 0, 0, 0.5); 3 | @text-color-third: rgba(0, 0, 0, 0.3); 4 | -------------------------------------------------------------------------------- /packages/mindflow/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from './dataMap'; 2 | export * from './layout'; 3 | export * from './getServiceToken'; 4 | export * from './color'; 5 | -------------------------------------------------------------------------------- /packages/journey-map/.fatherrc.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'father'; 2 | import config from '../../.fatherrc'; 3 | 4 | export default defineConfig({ ...config }); 5 | -------------------------------------------------------------------------------- /packages/mindflow/src/store/key.ts: -------------------------------------------------------------------------------- 1 | export const KEYS = { 2 | collapseList: 'MF.collapseList', 3 | unfoldedList: 'MF.unfoldedList', 4 | graph: 'MF.graph', 5 | }; 6 | -------------------------------------------------------------------------------- /packages/page-loading/.fatherrc.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'father'; 2 | import config from '../../.fatherrc'; 3 | 4 | export default defineConfig({ ...config }); 5 | -------------------------------------------------------------------------------- /packages/preloader/.fatherrc.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'father'; 2 | import config from '../../.fatherrc'; 3 | 4 | export default defineConfig({ ...config }); 5 | -------------------------------------------------------------------------------- /packages/tag-selector/.fatherrc.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'father'; 2 | import config from '../../.fatherrc'; 3 | 4 | export default defineConfig({ ...config }); 5 | -------------------------------------------------------------------------------- /packages/user-panel/.fatherrc.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'father'; 2 | import config from '../../.fatherrc'; 3 | 4 | export default defineConfig({ ...config }); 5 | -------------------------------------------------------------------------------- /packages/user-panel/src/locales/zh-CN/index.ts: -------------------------------------------------------------------------------- 1 | import login from './login'; 2 | import register from './register'; 3 | 4 | export default { ...login, ...register }; 5 | -------------------------------------------------------------------------------- /docs/biz-components.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 说明 3 | order: 0 4 | nav: 5 | title: 高阶组件 6 | order: 3 7 | --- 8 | 9 | ## 高阶组件 10 | 11 | 高阶组件基本上都是一些业务组件,具有很明确的特定领域属性。 12 | -------------------------------------------------------------------------------- /packages/float-label-input/.fatherrc.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'father'; 2 | import config from '../../.fatherrc'; 3 | 4 | export default defineConfig({ ...config }); 5 | -------------------------------------------------------------------------------- /packages/heatmap-calendar/.fatherrc.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'father'; 2 | import config from '../../.fatherrc'; 3 | 4 | export default defineConfig({ ...config }); 5 | -------------------------------------------------------------------------------- /packages/macos-traffic-light/.fatherrc.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'father'; 2 | import config from '../../.fatherrc'; 3 | 4 | export default defineConfig({ ...config }); 5 | -------------------------------------------------------------------------------- /packages/mindflow/src/types/cell.ts: -------------------------------------------------------------------------------- 1 | import type { Hook } from '@antv/x6/es/graph/hook'; 2 | 3 | export interface PortProps { 4 | node?: Hook.OnPortRenderedArgs['node']; 5 | } 6 | -------------------------------------------------------------------------------- /tests/setup.ts: -------------------------------------------------------------------------------- 1 | function noOp() {} 2 | if (typeof window.URL.createObjectURL === 'undefined') { 3 | Object.defineProperty(window.URL, 'createObjectURL', { value: noOp }); 4 | } 5 | -------------------------------------------------------------------------------- /packages/journey-map/src/components/ErrorFallback.less: -------------------------------------------------------------------------------- 1 | @import '../token'; 2 | 3 | .avx-journey-error { 4 | &-detail { 5 | margin-top: 8px; 6 | .secondText; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /scripts/create-package/template/.fatherrc.ts.ejs: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'father'; 2 | import config from '../../.fatherrc'; 3 | 4 | export default defineConfig({ ...config }); 5 | -------------------------------------------------------------------------------- /packages/sortable-list/src/components/index.ts: -------------------------------------------------------------------------------- 1 | export { Action } from './Action'; 2 | export { Handle } from './Handle'; 3 | export { Remove } from './Remove'; 4 | export { Item } from './BaseItem'; 5 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["config:base"], 3 | "packageRules": [ 4 | { 5 | "matchPackagePatterns": ["*"], 6 | "rangeStrategy": "replace" 7 | } 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/sortable-list/.fatherrc.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'father'; 2 | 3 | export default defineConfig({ 4 | esm: { output: 'es' }, 5 | cjs: { output: 'lib', platform: 'browser' }, 6 | }); 7 | -------------------------------------------------------------------------------- /packages/user-panel/src/components/Header/style.less: -------------------------------------------------------------------------------- 1 | .avx-user-panel { 2 | &-logo { 3 | margin-bottom: 24px; 4 | text-align: center; 5 | img { 6 | height: 72px; 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/mindflow/src/components/MindNode/ImageNode.less: -------------------------------------------------------------------------------- 1 | @import '../../themes/theme'; 2 | 3 | .mind-node { 4 | &-image { 5 | width: 194px; 6 | margin-top: 2px; 7 | border-radius: 2px; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/tag-selector/src/tag-selector.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: TagSelector 3 | group: 4 | path: / 5 | nav: 6 | path: /components 7 | --- 8 | 9 | ## TagSelector 组件 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/page-loading/types/multi-ngprogress.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'multi-nprogress' { 2 | import { NProgress } from 'nprogress'; 3 | 4 | declare const nProgress = () => NProgress; 5 | 6 | export default nProgress; 7 | } 8 | -------------------------------------------------------------------------------- /packages/preloader/src/demos/Square.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import { Square } from '@arvinxu/preloader'; 4 | 5 | const Loading = () => { 6 | return ; 7 | }; 8 | 9 | export default Loading; 10 | -------------------------------------------------------------------------------- /tsconfig-check.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "noEmit": true, 5 | "skipLibCheck": true, 6 | "jsx": "react-jsx" 7 | }, 8 | "include": ["packages", "types"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/user-panel/src/components/Intl.ts: -------------------------------------------------------------------------------- 1 | import { useTranslation } from 'react-i18next'; 2 | 3 | export const useFormatMessage = () => { 4 | const { t } = useTranslation(); 5 | 6 | return (id, values?) => t(id, values); 7 | }; 8 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": ["packages/*"], 3 | "command": { 4 | "bootstrap": { 5 | "hoist": true 6 | } 7 | }, 8 | "useWorkspaces": true, 9 | "version": "independent", 10 | "npmClient": "pnpm" 11 | } 12 | -------------------------------------------------------------------------------- /packages/sortable-list/src/index.ts: -------------------------------------------------------------------------------- 1 | import SortableList from './container'; 2 | 3 | export default SortableList; 4 | 5 | export type { 6 | SortableBaseItem, 7 | SortableItemList, 8 | SortableListProps, 9 | } from './types'; 10 | -------------------------------------------------------------------------------- /packages/i18n/src/types.ts: -------------------------------------------------------------------------------- 1 | export type LocalesType = 'en-US' | 'zh-CN'; 2 | 3 | export type LocaleMessageMaps> = { 4 | 'zh-CN': T; 5 | 'en-US'?: T; 6 | }; 7 | 8 | export type { PrimitiveType } from 'intl-messageformat'; 9 | -------------------------------------------------------------------------------- /packages/mindflow/src/components/index.ts: -------------------------------------------------------------------------------- 1 | export { default as ErrorBoundary } from './ErrorBoundary'; 2 | export { default as MindNode } from './MindNode'; 3 | export { default as EvidenceEdge } from './EvidenceEdge'; 4 | export { InPort, OutPort } from './Port'; 5 | -------------------------------------------------------------------------------- /docs/guide.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 缘起 3 | nav: 4 | title: 指南 5 | order: 1 6 | --- 7 | 8 | # 缘起 9 | 10 | 该仓库是我自行积累的设计组件库 11 | 12 | ## 为什么会有这个? 13 | 14 | - 做过的设计挺多, 但是缺少总结 15 | - 业务组件如果可以沉淀,那么未来可以给自己复用 16 | - 终身计划的一环 17 | 18 | 首要目的不是给外部使用,而是作为我个人设计资源的整理。 19 | -------------------------------------------------------------------------------- /packages/asset-gallery/src/index.tsx: -------------------------------------------------------------------------------- 1 | import AssetGallery from './AssetGallery'; 2 | 3 | export { 4 | AssetGalleryProps, 5 | Asset, 6 | ImageEntryYML, 7 | AssetGalleryYML, 8 | AssetList, 9 | } from './types'; 10 | 11 | export default AssetGallery; 12 | -------------------------------------------------------------------------------- /packages/asset-gallery/src/utils/sketch.ts: -------------------------------------------------------------------------------- 1 | /* istanbul ignore file */ 2 | 3 | import copy from 'copy-to-clipboard'; 4 | import { copySuccess } from './helper'; 5 | 6 | export const copySketch = (url: string) => { 7 | copy(url); 8 | copySuccess(); 9 | }; 10 | -------------------------------------------------------------------------------- /packages/sortable-list/src/store/initialState.ts: -------------------------------------------------------------------------------- 1 | import type { SortableListState } from '../types'; 2 | 3 | const initialState: SortableListState = { 4 | data: [], 5 | onDataChange: null, 6 | activeId: null, 7 | }; 8 | 9 | export default initialState; 10 | -------------------------------------------------------------------------------- /packages/user-panel/src/index.ts: -------------------------------------------------------------------------------- 1 | import { UserLogin } from './UserLogin'; 2 | 3 | const UserPanel = { 4 | Login: UserLogin, 5 | }; 6 | 7 | export default UserPanel; 8 | 9 | export * from './UserLogin'; 10 | 11 | export { IUserLogin } from './types'; 12 | -------------------------------------------------------------------------------- /packages/heatmap-calendar/src/hooks/useDarkTheme.ts: -------------------------------------------------------------------------------- 1 | import { useState } from 'react'; 2 | 3 | /** 4 | * DarkMode 需要的状态 5 | */ 6 | export const useDarkTheme = () => { 7 | const [theme] = useState<'light' | 'dark'>('light'); 8 | 9 | return { theme }; 10 | }; 11 | -------------------------------------------------------------------------------- /packages/journey-map/src/token.less: -------------------------------------------------------------------------------- 1 | @prefix: avx-journey-map; 2 | 3 | .centerStyle { 4 | display: flex; 5 | align-content: center; 6 | justify-content: center; 7 | } 8 | 9 | .secondText { 10 | color: rgba(0, 0, 0, 0.45); 11 | font-size: 12px; 12 | } 13 | -------------------------------------------------------------------------------- /packages/asset-gallery/types/index.d.ts: -------------------------------------------------------------------------------- 1 | declare class ClipboardItem { 2 | constructor(data: Record); 3 | } 4 | 5 | interface Clipboard { 6 | read?: () => Promise; 7 | 8 | write?: (items: ClipboardItem[]) => Promise; 9 | } 10 | -------------------------------------------------------------------------------- /packages/mindflow/src/components/Port/__snapshots__/InPort.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`InPort 默认 1`] = ` 4 |
5 |
9 |
10 | `; 11 | -------------------------------------------------------------------------------- /.changelogrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | scopeDisplayName: { 3 | scripts: '脚本', 4 | changelog: '日志', 5 | config: '配置', 6 | release: '自动发布', 7 | types: '类型', 8 | readme: '说明文档', 9 | guide: '指南', 10 | }, 11 | titleLanguage: 'zh-CN', 12 | }; 13 | -------------------------------------------------------------------------------- /packages/journey-map/src/components/index.ts: -------------------------------------------------------------------------------- 1 | export { default as Section } from './Section'; 2 | export { default as OverflowTitle } from './OverflowTitle'; 3 | export { default as ErrorFallback } from './ErrorFallback'; 4 | export { default as ListSection } from './ListSection'; 5 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | **/*.svg 2 | .umi 3 | .umi-production 4 | /dist 5 | .dockerignore 6 | .DS_Store 7 | .eslintignore 8 | *.png 9 | *.toml 10 | docker 11 | .editorconfig 12 | Dockerfile* 13 | .gitignore 14 | .prettierignore 15 | LICENSE 16 | .eslintcache 17 | *.lock 18 | yarn-error.log 19 | -------------------------------------------------------------------------------- /packages/asset-gallery/src/utils/checkSvg.test.ts: -------------------------------------------------------------------------------- 1 | import { checkSvg } from './checkSvg'; 2 | 3 | test('checkSvg', () => { 4 | const isSvg = checkSvg( 5 | 'https://gw.alipayobjects.com/zos/antfincdn/LFmaI3%26OJh/logo.svg', 6 | ); 7 | 8 | expect(isSvg).toBeTruthy(); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/heatmap-calendar/demos/Demo.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import HeatmapCalendar from '@arvinxu/heatmap-calendar'; 3 | 4 | import { data } from './data'; 5 | 6 | const Demo = () => { 7 | return ; 8 | }; 9 | 10 | export default Demo; 11 | -------------------------------------------------------------------------------- /packages/mindflow/demos/Museum.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Mindflow from '@arvinxu/mindflow'; 3 | import * as datasource from './data'; 4 | 5 | const Museum = () => { 6 | return ; 7 | }; 8 | 9 | export default Museum; 10 | -------------------------------------------------------------------------------- /packages/mindflow/demos/Demo.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import Mindflow from '@arvinxu/mindflow'; 4 | import * as datasource from './data'; 5 | 6 | const MindflowDemo = () => { 7 | return ; 8 | }; 9 | 10 | export default MindflowDemo; 11 | -------------------------------------------------------------------------------- /packages/mindflow/demos/Thinking.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Mindflow from '@arvinxu/mindflow'; 3 | 4 | import * as datasource from './data'; 5 | 6 | const Thinking = () => { 7 | return ; 8 | }; 9 | 10 | export default Thinking; 11 | -------------------------------------------------------------------------------- /packages/asset-gallery/demos/png.ts: -------------------------------------------------------------------------------- 1 | export const yml = ` 2 | - 标题: 渐变色 Logo 3 | 描述: 渐变色 4 | 链接: https://gw.alipayobjects.com/zos/antfincdn/OuMB9liYZV/tupian%2525201.png 5 | 6 | - 标题: 黑色 Logo 7 | 描述: 亮色背景下使用 8 | 链接: https://gw.alipayobjects.com/zos/antfincdn/5vmPNr6Qqz/tupian%2525202.png 9 | `; 10 | -------------------------------------------------------------------------------- /packages/macos-traffic-light/src/icon.less: -------------------------------------------------------------------------------- 1 | @mac-control-icon-color: rgba(0, 0, 0, 0.65); 2 | 3 | .avx-traffic-light-icon { 4 | position: absolute; 5 | top: 50%; 6 | left: 50%; 7 | color: @mac-control-icon-color; 8 | transform: translate(-50%, -50%); 9 | fill: @mac-control-icon-color; 10 | } 11 | -------------------------------------------------------------------------------- /docs/components.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 说明 3 | order: 1 4 | apiHeader: false 5 | nav: 6 | title: 基础组件 7 | order: 2 8 | --- 9 | 10 | ## 基础组件 11 | 12 | 一些简单的基础组件, 在特定的一些场景下做到了基本上可以直接拿来就用。 13 | 14 | 通用组件的开发主要目的是为了满足自己使用的诉求,并做个组件资产沉淀。因为有些组件是 antd 肯定不会准备做的(例如 macOSTrafficLight),但是在一些特定的场景中会反复用到(例如 Electron)。 15 | -------------------------------------------------------------------------------- /packages/page-loading/src/demos/Basic.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import PageLoading from '@arvinxu/page-loading'; 4 | 5 | const Loading = () => { 6 | return ( 7 |
8 | 9 |
10 | ); 11 | }; 12 | 13 | export default Loading; 14 | -------------------------------------------------------------------------------- /packages/sortable-list/src/store/utils.ts: -------------------------------------------------------------------------------- 1 | import type { SortableItemList } from '../types'; 2 | 3 | export const getIndexOfActiveItem = < 4 | T extends SortableItemList = SortableItemList, 5 | >( 6 | list: T, 7 | id?: string, 8 | ) => { 9 | return id ? list.findIndex((i) => i.id === id) : -1; 10 | }; 11 | -------------------------------------------------------------------------------- /packages/tag-selector/src/type.ts: -------------------------------------------------------------------------------- 1 | export interface Value { 2 | key: string; 3 | text: string; 4 | refText?: string; 5 | value?: number; 6 | editable?: boolean; 7 | } 8 | 9 | export interface Item { 10 | key: string; 11 | title: string; 12 | value: Value[]; 13 | inputVisible?: boolean; 14 | } 15 | -------------------------------------------------------------------------------- /scripts/create-package/template/src/index.tsx.ejs: -------------------------------------------------------------------------------- 1 | import type { FC } from 'react'; 2 | 3 | export interface <%- componentName %>Props {} 4 | 5 | const <%- componentName %>: FC<<%- componentName %>Props> = () => { 6 | return
<%- componentName %>
; 7 | }; 8 | 9 | export default <%- componentName %>; 10 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | 15 | [Makefile] 16 | indent_style = tab 17 | -------------------------------------------------------------------------------- /packages/journey-map/demos/YAMLWithString.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * compact: true 3 | */ 4 | import React from 'react'; 5 | import JourneyMap from '@arvinxu/journey-map'; 6 | import { data } from './yml'; 7 | 8 | const YAML = () => { 9 | return ; 10 | }; 11 | 12 | export default YAML; 13 | -------------------------------------------------------------------------------- /packages/float-label-input/src/demos/Height.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import FloatLabelInput from '@arvinxu/float-label-input'; 4 | 5 | const Basic = () => { 6 | return ( 7 |
8 | 9 |
10 | ); 11 | }; 12 | 13 | export default Basic; 14 | -------------------------------------------------------------------------------- /packages/sortable-list/src/container/StoreUpdater.tsx: -------------------------------------------------------------------------------- 1 | import { useStoreUpdater } from '../hooks/useStoreUpdater'; 2 | import type { StoreUpdaterProps } from '../types'; 3 | 4 | const StoreUpdater = (props: StoreUpdaterProps) => { 5 | useStoreUpdater(props); 6 | 7 | return null; 8 | }; 9 | 10 | export default StoreUpdater; 11 | -------------------------------------------------------------------------------- /packages/mindflow/src/definition/graphOpts.test.ts: -------------------------------------------------------------------------------- 1 | import { graphOpts } from './graphOpts'; 2 | 3 | describe('graphOpts', () => { 4 | it('返回正常值', () => { 5 | const ctn = document.createElement('div'); 6 | const minimap = document.createElement('div'); 7 | expect(graphOpts(ctn, minimap)).toMatchSnapshot(); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/mindflow/src/components/MindNode/UrlNode.tsx: -------------------------------------------------------------------------------- 1 | import type { FC } from 'react'; 2 | import React from 'react'; 3 | 4 | import './style.less'; 5 | 6 | interface LinkProps { 7 | link?: string; 8 | } 9 | 10 | const UrlNode: FC = ({ link }) => { 11 | return
{link}
; 12 | }; 13 | 14 | export default UrlNode; 15 | -------------------------------------------------------------------------------- /packages/mindflow/src/components/Port/style.less: -------------------------------------------------------------------------------- 1 | .mind-port-in-port { 2 | width: 100%; 3 | height: 100%; 4 | background: #fff; 5 | border: 2px solid transparent; 6 | border-radius: 100%; 7 | } 8 | 9 | .mind-port-out-port { 10 | width: 18px; 11 | height: 18px; 12 | } 13 | 14 | .x6-node [magnet='true']:hover { 15 | opacity: 1; 16 | } 17 | -------------------------------------------------------------------------------- /packages/mindflow/src/hooks/useGraph.test.ts: -------------------------------------------------------------------------------- 1 | import { renderHook } from '@testing-library/react-hooks'; 2 | import { useGraph } from './useGraph'; 3 | 4 | describe('useGraph', () => { 5 | it('初始值', () => { 6 | const { result } = renderHook(() => useGraph([])); 7 | expect(result.current.container.current).toBeUndefined(); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/preloader/tests/index.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import { Square } from '@arvinxu/preloader'; 5 | 6 | describe('Preloader', () => { 7 | it('Square', () => { 8 | const { container } = render(); 9 | expect(container).toMatchSnapshot(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/tag-selector/jest.config.js: -------------------------------------------------------------------------------- 1 | const base = require('../../jest.config.base'); 2 | 3 | const packageName = '@arvinxu/tag-selector'; 4 | 5 | const root = '/packages/tag-selector'; 6 | 7 | module.exports = { 8 | ...base, 9 | rootDir: '../..', 10 | roots: [root], 11 | name: packageName, 12 | displayName: packageName, 13 | }; 14 | -------------------------------------------------------------------------------- /packages/mindflow/src/hooks/useRegister.test.ts: -------------------------------------------------------------------------------- 1 | import { renderHook } from '@testing-library/react-hooks'; 2 | import { useGraphRegister } from './useRegister'; 3 | 4 | describe('useGraphRegister', () => { 5 | it('初始值', () => { 6 | renderHook(() => useGraphRegister()); 7 | expect(window.__IS_REGISTERED_MIND_NODE__).toBeTruthy(); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/page-loading/src/demos/CustomLoader.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import PageLoading from '@arvinxu/page-loading'; 4 | 5 | const Loading = () => { 6 | return ( 7 |
8 | loading...
} id={'custom'} /> 9 |
10 | ); 11 | }; 12 | 13 | export default Loading; 14 | -------------------------------------------------------------------------------- /packages/page-loading/src/demos/WithoutProgress.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import PageLoading from '@arvinxu/page-loading'; 4 | 5 | const Loading = () => { 6 | return ( 7 |
8 | 9 |
10 | ); 11 | }; 12 | 13 | export default Loading; 14 | -------------------------------------------------------------------------------- /packages/journey-map/demos/CustomColor.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * compact: true 3 | */ 4 | import React from 'react'; 5 | import JourneyMap from '@arvinxu/journey-map'; 6 | 7 | import { customColor } from './color'; 8 | 9 | const CustomColor = () => { 10 | return ; 11 | }; 12 | 13 | export default CustomColor; 14 | -------------------------------------------------------------------------------- /packages/mindflow/src/components/Port/InPort.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import { InPort } from './InPort'; 5 | 6 | describe('InPort', () => { 7 | it('默认', () => { 8 | const { container } = render(); 9 | expect(container).toMatchSnapshot(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/i18n/src/IntlProvider.tsx: -------------------------------------------------------------------------------- 1 | import type { ComponentProps, FC } from 'react'; 2 | import React from 'react'; 3 | 4 | import { IntlProvider as IntlProvider_ } from 'react-intl'; 5 | 6 | export const Intl: FC< 7 | Omit, 'messages'> & { 8 | messages: Record; 9 | } 10 | > = (props) => ; 11 | -------------------------------------------------------------------------------- /packages/mindflow/src/index.test.tsx: -------------------------------------------------------------------------------- 1 | // import React from 'react'; 2 | // import { render } from '@testing-library/react'; 3 | // 4 | // import Mindflow from './index'; 5 | 6 | describe('Mindflow', () => { 7 | it('默认', () => { 8 | // const { container } = render(); 9 | // expect(container).toMatchSnapshot(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/journey-map/src/styles.less: -------------------------------------------------------------------------------- 1 | .avx-journey-map { 2 | &-container { 3 | font-size: 14px; 4 | } 5 | 6 | &-title { 7 | display: flex; 8 | justify-content: center; 9 | margin-bottom: 16px; 10 | font-weight: bold; 11 | font-size: 16px; 12 | } 13 | &-content { 14 | > *:not(:first-child) { 15 | margin-top: 24px; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/mindflow/src/components/MindNode/ImageNode.tsx: -------------------------------------------------------------------------------- 1 | import type { FC } from 'react'; 2 | import React from 'react'; 3 | 4 | import './ImageNode.less'; 5 | 6 | interface ImageNodeProps { 7 | src?: string; 8 | } 9 | 10 | const ImageNode: FC = ({ src }) => { 11 | return ; 12 | }; 13 | 14 | export default ImageNode; 15 | -------------------------------------------------------------------------------- /packages/journey-map/src/components/ErrorFallback.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import ErrorFallback from './ErrorFallback'; 5 | 6 | describe('ErrorFallback', () => { 7 | it('默认', () => { 8 | const { container } = render(); 9 | expect(container).toMatchSnapshot(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/i18n/jest.config.js: -------------------------------------------------------------------------------- 1 | const base = require('../../jest.config.base'); 2 | 3 | const packageName = '@arvinxu/i18n'; 4 | 5 | const root = '/packages/i18n'; 6 | 7 | module.exports = { 8 | ...base, 9 | rootDir: '../..', 10 | roots: [root], 11 | name: packageName, 12 | displayName: packageName, 13 | collectCoverageFrom: [`${root}/src/**/*.tsx`, `${root}/src/**/*.ts`], 14 | }; 15 | -------------------------------------------------------------------------------- /packages/mindflow/src/style.less: -------------------------------------------------------------------------------- 1 | .mindflow { 2 | &-container { 3 | position: relative; 4 | display: flex; 5 | } 6 | &-minimap { 7 | position: absolute; 8 | bottom: 0; 9 | left: 0; 10 | overflow: hidden; 11 | border: 1px solid #eee; 12 | border-radius: 2px; 13 | } 14 | } 15 | 16 | .x6-widget-minimap-viewport { 17 | border-color: rgba(24, 144, 255, 0.5); 18 | } 19 | -------------------------------------------------------------------------------- /packages/user-panel/src/components/Header/index.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import { Header } from './index'; 5 | import '../../locales'; 6 | 7 | describe('Header 组件', () => { 8 | it('登录头部', () => { 9 | const { container } = render(
); 10 | expect(container).toMatchSnapshot(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/user-panel/src/components/WechatLogin/style.less: -------------------------------------------------------------------------------- 1 | @wechat-color: #44b549; 2 | .avx-user-panel-wechat { 3 | width: 100%; 4 | height: 44px; 5 | 6 | &:hover, 7 | &:active, 8 | &:focus { 9 | color: @wechat-color; 10 | border-color: @wechat-color; 11 | } 12 | 13 | &-icon { 14 | margin-right: 8px; 15 | color: @wechat-color; 16 | font-size: 16px; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/journey-map/demos/Demo.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * compact: true 3 | */ 4 | import React from 'react'; 5 | import JourneyMap from '@arvinxu/journey-map'; 6 | 7 | import { data } from './data'; 8 | 9 | const Demo = () => { 10 | return ( 11 | 16 | ); 17 | }; 18 | 19 | export default Demo; 20 | -------------------------------------------------------------------------------- /packages/user-panel/src/login/LoginErrorMessage.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import LoginErrorMessage from './LoginErrorMessage'; 5 | 6 | describe('LoginMessage', () => { 7 | it('默认状态', () => { 8 | const { container } = render(); 9 | expect(container).toMatchSnapshot(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/user-panel/src/login/LoginErrorMessage.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Alert } from 'antd'; 3 | 4 | const LoginErrorMessage: React.FC<{ 5 | content: string; 6 | }> = ({ content }) => ( 7 | 15 | ); 16 | 17 | export default LoginErrorMessage; 18 | -------------------------------------------------------------------------------- /scripts/create-package/template/tests/index.test.tsx.ejs: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import <%- componentName %> from '@arvinxu/<%- pkg %>'; 5 | 6 | describe('<%- componentName %>', () => { 7 | it('默认状态', () => { 8 | const { container } = render(<<%- componentName %> />); 9 | expect(container).toMatchSnapshot(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/journey-map/demos/YAMLWithURL.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * compact: true 3 | */ 4 | import React from 'react'; 5 | import JourneyMap from '@arvinxu/journey-map'; 6 | 7 | const YAMLWithURL = () => { 8 | return ( 9 | 13 | ); 14 | }; 15 | 16 | export default YAMLWithURL; 17 | -------------------------------------------------------------------------------- /packages/journey-map/tests/index.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import JourneyMap from '@arvinxu/journey-map'; 5 | 6 | describe('JourneyMap', () => { 7 | it('默认状态', () => { 8 | const { container } = render( 9 | , 10 | ); 11 | expect(container).toMatchSnapshot(); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /packages/mindflow/jest.config.js: -------------------------------------------------------------------------------- 1 | const base = require('../../jest.config.base'); 2 | 3 | const packageName = '@arvinxu/mindflow'; 4 | 5 | const root = '/packages/mindflow'; 6 | 7 | module.exports = { 8 | ...base, 9 | rootDir: '../..', 10 | roots: [root], 11 | name: packageName, 12 | displayName: packageName, 13 | collectCoverageFrom: [`${root}/src/**/*.tsx`, `${root}/src/**/*.ts`], 14 | }; 15 | -------------------------------------------------------------------------------- /packages/i18n/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "declaration": true, 5 | "jsx": "react-jsx", 6 | "skipLibCheck": true, 7 | /* babel 输出类型 */ 8 | "moduleResolution": "Node", 9 | "target": "ESNext", 10 | "module": "ESNext", 11 | /* 模块导入配置项 */ 12 | "esModuleInterop": true, 13 | "types": ["../../types", "@types/jest"] 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/mindflow/src/components/Port/OutPort.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import { OutPort } from './OutPort'; 5 | 6 | describe('OutPort', () => { 7 | it('默认', () => { 8 | const { container } = render( 9 | , 10 | ); 11 | expect(container).toMatchSnapshot(); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /packages/journey-map/jest.config.js: -------------------------------------------------------------------------------- 1 | const base = require('../../jest.config.base'); 2 | 3 | const packageName = '@arvinxu/journey-map'; 4 | 5 | const root = '/packages/journey-map'; 6 | 7 | module.exports = { 8 | ...base, 9 | rootDir: '../..', 10 | roots: [root], 11 | name: packageName, 12 | displayName: packageName, 13 | collectCoverageFrom: [`${root}/src/**/*.tsx`, `${root}/src/**/*.ts`], 14 | }; 15 | -------------------------------------------------------------------------------- /packages/page-loading/jest.config.js: -------------------------------------------------------------------------------- 1 | const base = require('../../jest.config.base'); 2 | 3 | const packageName = '@arvinxu/page-loading'; 4 | 5 | const root = '/packages/page-loading'; 6 | 7 | module.exports = { 8 | ...base, 9 | rootDir: '../..', 10 | roots: [root], 11 | name: packageName, 12 | displayName: packageName, 13 | collectCoverageFrom: [`${root}/src/**/*.tsx`, `${root}/src/**/*.ts`], 14 | }; 15 | -------------------------------------------------------------------------------- /packages/user-panel/src/components/Header/__snapshots__/index.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Header 组件 登录头部 1`] = ` 4 |
5 |
8 |

12 | Login 13 |

14 |
15 |
16 | `; 17 | -------------------------------------------------------------------------------- /packages/asset-gallery/jest.config.js: -------------------------------------------------------------------------------- 1 | const base = require('../../jest.config.base'); 2 | 3 | const packageName = '@arvinxu/asset-gallery'; 4 | 5 | const root = '/packages/asset-gallery'; 6 | 7 | module.exports = { 8 | ...base, 9 | rootDir: '../..', 10 | roots: [root], 11 | name: packageName, 12 | displayName: packageName, 13 | collectCoverageFrom: [`${root}/src/**/*.tsx`, `${root}/src/**/*.ts`], 14 | }; 15 | -------------------------------------------------------------------------------- /packages/mindflow/src/components/CollapseIcon/style.less: -------------------------------------------------------------------------------- 1 | @import '../../themes/theme'; 2 | 3 | .mind-node-collapse { 4 | display: flex; 5 | align-items: center; 6 | justify-content: center; 7 | width: 18px; 8 | height: 18px; 9 | border: 1px solid transparent; 10 | border-radius: 20px; 11 | cursor: pointer; 12 | transition: all 150ms ease-in-out; 13 | 14 | &-icon { 15 | font-size: 12px; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/float-label-input/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "declaration": true, 5 | "jsx": "react-jsx", 6 | "skipLibCheck": true, 7 | /* babel 输出类型 */ 8 | "moduleResolution": "Node", 9 | "target": "ESNext", 10 | "module": "ESNext", 11 | /* 模块导入配置项 */ 12 | "esModuleInterop": true, 13 | "types": ["../../types", "@types/jest"] 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/mindflow/src/components/Port/InPort.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import type { FC } from 'react'; 3 | 4 | import './style.less'; 5 | 6 | interface InPortProps { 7 | color: string; 8 | } 9 | 10 | export const InPort: FC = ({ color }) => { 11 | return ( 12 |
18 | ); 19 | }; 20 | -------------------------------------------------------------------------------- /packages/float-label-input/jest.config.js: -------------------------------------------------------------------------------- 1 | const base = require('../../jest.config.base'); 2 | 3 | const packageName = '@arvinxu/float-label-input'; 4 | 5 | const root = '/packages/float-label-input'; 6 | 7 | module.exports = { 8 | ...base, 9 | rootDir: '../..', 10 | roots: [root], 11 | name: packageName, 12 | displayName: packageName, 13 | collectCoverageFrom: [`${root}/src/**/*.tsx`, `${root}/src/**/*.ts`], 14 | }; 15 | -------------------------------------------------------------------------------- /packages/heatmap-calendar/jest.config.js: -------------------------------------------------------------------------------- 1 | const base = require('../../jest.config.base'); 2 | 3 | const packageName = '@arvinxu/heatmap-calendar'; 4 | 5 | const root = '/packages/heatmap-calendar'; 6 | 7 | module.exports = { 8 | ...base, 9 | rootDir: '../..', 10 | roots: [root], 11 | name: packageName, 12 | displayName: packageName, 13 | collectCoverageFrom: [`${root}/src/**/*.tsx`, `${root}/src/**/*.ts`], 14 | }; 15 | -------------------------------------------------------------------------------- /packages/i18n/src/useStoredLocale.ts: -------------------------------------------------------------------------------- 1 | import type { LocalesType } from './types'; 2 | import { useLocalStorage } from './useLocalStorage'; 3 | 4 | /** 5 | * 创建本地语料库 6 | */ 7 | export const useStoredLocale = () => { 8 | const [locale, setLocale] = useLocalStorage('locale', 'zh-CN'); 9 | 10 | const switchLocale = (l: LocalesType): void => { 11 | setLocale(l); 12 | }; 13 | 14 | return { locale, switchLocale }; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/macos-traffic-light/jest.config.js: -------------------------------------------------------------------------------- 1 | const base = require('../../jest.config.base'); 2 | 3 | const packageName = '@arvinxu/macos-traffic-light'; 4 | 5 | const root = '/packages/macos-traffic-light'; 6 | 7 | module.exports = { 8 | ...base, 9 | rootDir: '../..', 10 | roots: [root], 11 | name: packageName, 12 | displayName: packageName, 13 | collectCoverageFrom: [`${root}/src/**/*.tsx`, `${root}/src/**/*.ts`], 14 | }; 15 | -------------------------------------------------------------------------------- /packages/sortable-list/jest.config.js: -------------------------------------------------------------------------------- 1 | const base = require('../../jest.config.base'); 2 | 3 | const packageName = '@arvinxu/sortable-list'; 4 | 5 | const root = '/packages/sortable-list'; 6 | 7 | module.exports = { 8 | ...base, 9 | rootDir: '../..', 10 | roots: [root], 11 | name: packageName, 12 | displayName: packageName, 13 | collectCoverageFrom: [`${root}/src/**/*.tsx`, `${root}/src/**/*.ts`], 14 | }; 15 | 16 | -------------------------------------------------------------------------------- /packages/asset-gallery/demos/sketch.ts: -------------------------------------------------------------------------------- 1 | export const sketch = ` 2 | - sketch: https://gw.alipayobjects.com/os/kitchen/oLQZFZVkmdvqpKRQDCuU.json 3 | 链接: https://gw.alipayobjects.com/zos/antfincdn/G5sZluNGGA/25c4fe16-7d52-4b32-904e-3eccb4a1ff47.png 4 | 5 | - 标题: 卡片组件 6 | sketch: https://gw.alipayobjects.com/os/kitchen/IiFvADxdyqKABLzWKZWT.json 7 | 描述: 一个 C2D 组件 8 | 链接: https://gw.alipayobjects.com/zos/antfincdn/KGTSum12Re/qiapianzujian.png 9 | `; 10 | -------------------------------------------------------------------------------- /packages/journey-map/src/components/Section.less: -------------------------------------------------------------------------------- 1 | .avx-journey-map { 2 | &-section { 3 | display: flex; 4 | align-items: center; 5 | justify-content: center; 6 | width: 40px; 7 | margin-right: 8px; 8 | background-color: #f1f1f1; 9 | border-radius: 4px; 10 | 11 | &-text { 12 | margin: 0; 13 | color: rgba(0, 0, 0, 0.45); 14 | font-size: 12px; 15 | writing-mode: vertical-lr; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /scripts/create-package/template/jest.config.js.ejs: -------------------------------------------------------------------------------- 1 | const base = require('../../jest.config.base'); 2 | 3 | const packageName = '@arvinxu/<%- pkg %>'; 4 | 5 | const root = '/packages/<%- pkg %>'; 6 | 7 | module.exports = { 8 | ...base, 9 | rootDir: '../..', 10 | roots: [root], 11 | name: packageName, 12 | displayName: packageName, 13 | collectCoverageFrom: [`${root}/src/**/*.tsx`, `${root}/src/**/*.ts`], 14 | }; 15 | 16 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | pluginSearchDirs: false, 3 | plugins: [ 4 | require.resolve('prettier-plugin-organize-imports'), 5 | require.resolve('prettier-plugin-packagejson'), 6 | ], 7 | printWidth: 100, 8 | proseWrap: 'never', 9 | singleQuote: true, 10 | trailingComma: 'all', 11 | overrides: [ 12 | { 13 | files: '*.md', 14 | options: { 15 | proseWrap: 'preserve', 16 | }, 17 | }, 18 | ], 19 | }; 20 | -------------------------------------------------------------------------------- /packages/user-panel/tests/matchMedia.mock.ts: -------------------------------------------------------------------------------- 1 | Object.defineProperty(window, 'matchMedia', { 2 | writable: true, 3 | value: jest.fn().mockImplementation((query) => ({ 4 | matches: false, 5 | media: query, 6 | onchange: null, 7 | addListener: jest.fn(), // deprecated 8 | removeListener: jest.fn(), // deprecated 9 | addEventListener: jest.fn(), 10 | removeEventListener: jest.fn(), 11 | dispatchEvent: jest.fn(), 12 | })), 13 | }); 14 | -------------------------------------------------------------------------------- /packages/page-loading/src/style.less: -------------------------------------------------------------------------------- 1 | @keyframes pulse { 2 | 0% { 3 | opacity: 1; 4 | } 5 | 100% { 6 | opacity: 0; 7 | } 8 | } 9 | 10 | .avx-page-loading { 11 | &-container { 12 | display: flex; 13 | height: 100%; 14 | } 15 | 16 | &-fullscreen { 17 | position: fixed; 18 | top: 0; 19 | right: 0; 20 | bottom: 0; 21 | left: 0; 22 | z-index: 9900; 23 | } 24 | 25 | &-loader { 26 | margin: auto; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/float-label-input/src/style.less: -------------------------------------------------------------------------------- 1 | .avx-float-input { 2 | &-container { 3 | padding-top: 22px; 4 | } 5 | 6 | &-label { 7 | position: absolute; 8 | z-index: 2; 9 | display: block; 10 | font-size: 14px; 11 | transition: all 150ms ease-out; 12 | user-select: none; 13 | pointer-events: none; 14 | 15 | &-required { 16 | color: red; 17 | } 18 | &-hover { 19 | color: fade(#000, 45%); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/sortable-list/src/store/utils.test.ts: -------------------------------------------------------------------------------- 1 | import { getIndexOfActiveItem } from './utils'; 2 | 3 | const list = [{ id: '123' }, { id: '3245' }]; 4 | 5 | describe('getIndexOfActiveItem', () => { 6 | it('找到 index', () => { 7 | const index = getIndexOfActiveItem(list, '123'); 8 | expect(index).toEqual(0); 9 | }); 10 | it('没找到 index', () => { 11 | const index = getIndexOfActiveItem(list, '135'); 12 | 13 | expect(index).toEqual(-1); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /packages/preloader/jest.config.ts: -------------------------------------------------------------------------------- 1 | import base from '../../jest.config.base'; 2 | import { Config } from '@umijs/test'; 3 | 4 | const packageName = '@arvinxu/preloader'; 5 | 6 | const root = '/packages/preloader'; 7 | 8 | const config: Config.InitialOptions = { 9 | ...base, 10 | rootDir: '../..', 11 | roots: [root], 12 | displayName: packageName, 13 | collectCoverageFrom: [`${root}/src/**/*.tsx`, `${root}/src/**/*.ts`], 14 | }; 15 | 16 | export default config; 17 | -------------------------------------------------------------------------------- /packages/user-panel/demos/Login.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * compact: true 3 | */ 4 | import React from 'react'; 5 | 6 | import UserPanel from '@arvinxu/user-panel'; 7 | 8 | const Login = () => { 9 | return ( 10 |
18 | 19 |
20 | ); 21 | }; 22 | 23 | export default Login; 24 | -------------------------------------------------------------------------------- /packages/user-panel/jest.config.js: -------------------------------------------------------------------------------- 1 | const base = require('../../jest.config.base'); 2 | 3 | const packageName = '@arvinxu/user-panel'; 4 | 5 | const root = '/packages/user-panel'; 6 | 7 | module.exports = { 8 | ...base, 9 | rootDir: '../..', 10 | roots: [root], 11 | name: packageName, 12 | displayName: packageName, 13 | collectCoverageFrom: [`${root}/src/**/*.tsx`, `${root}/src/**/*.ts`], 14 | setupFiles: [...base.setupFiles, `${root}/tests/setup.ts`], 15 | }; 16 | -------------------------------------------------------------------------------- /jest.config.ts: -------------------------------------------------------------------------------- 1 | import baseConfig from './jest.config.base'; 2 | import { Config } from '@umijs/test'; 3 | 4 | const config: Config.InitialOptions = { 5 | ...baseConfig, 6 | projects: ['/packages/*/jest.config.ts'], 7 | moduleDirectories: ['node_modules'], 8 | collectCoverageFrom: [ 9 | '/packages/*/src/**/*.ts', 10 | '/packages/*/src/**/*.tsx', 11 | ], 12 | coverageDirectory: '/coverage/', 13 | }; 14 | 15 | export default config; 16 | -------------------------------------------------------------------------------- /packages/heatmap-calendar/src/type.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 热力图数据结构 3 | */ 4 | export interface ItemData { 5 | /** 6 | * 日期 7 | */ 8 | date: string; 9 | /** 10 | * 天数 11 | */ 12 | day: number; 13 | /** 14 | * 月份 15 | */ 16 | month: number; 17 | /** 18 | * 热点数 19 | */ 20 | total: number; 21 | /** 22 | * 周 23 | */ 24 | week: number; 25 | /** 26 | * 年 27 | */ 28 | year: number; 29 | } 30 | 31 | export type HeatmapCalendarData = ItemData[]; 32 | -------------------------------------------------------------------------------- /packages/user-panel/src/layout/style.less: -------------------------------------------------------------------------------- 1 | .avx-user-panel { 2 | &-container { 3 | z-index: 2; 4 | display: flex; 5 | flex-direction: column; 6 | align-items: center; 7 | width: 480px; 8 | padding: 48px 64px; 9 | background: white; 10 | border-radius: 4px; 11 | box-shadow: 0 24px 36px hsla(210, 20%, 39%, 0.16); 12 | @media (max-width: 512px) { 13 | width: 100%; 14 | margin: 0 16px; 15 | padding: 16px; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/journey-map/src/Thoughts/index.tsx: -------------------------------------------------------------------------------- 1 | import type { FC } from 'react'; 2 | import React, { useContext } from 'react'; 3 | 4 | import { ListSection } from '../components'; 5 | import { JourneyMapStore } from '../useJourneyMap'; 6 | 7 | const Thoughts: FC = () => { 8 | const { config } = useContext(JourneyMapStore); 9 | const height = config?.height?.thought; 10 | return ; 11 | }; 12 | 13 | export default Thoughts; 14 | -------------------------------------------------------------------------------- /packages/journey-map/src/components/ListSection.less: -------------------------------------------------------------------------------- 1 | @import '../token'; 2 | 3 | .avx-journey-map-list { 4 | &-container { 5 | display: flex; 6 | flex: 1; 7 | } 8 | 9 | &-content { 10 | display: flex; 11 | flex: 1; 12 | } 13 | 14 | &-card { 15 | padding: 8px; 16 | font-size: 12px; 17 | border: 1px solid transparent; 18 | border-radius: 4px; 19 | 20 | .secondText; 21 | ul { 22 | padding-inline-start: 16px; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/journey-map/src/components/Section.tsx: -------------------------------------------------------------------------------- 1 | import type { FC } from 'react'; 2 | import React from 'react'; 3 | 4 | import './Section.less'; 5 | 6 | interface StageProps { 7 | height?: number; 8 | } 9 | const Section: FC = ({ children, height }) => { 10 | return ( 11 |
12 |
{children}
13 |
14 | ); 15 | }; 16 | 17 | export default Section; 18 | -------------------------------------------------------------------------------- /packages/heatmap-calendar/src/style.less: -------------------------------------------------------------------------------- 1 | :root { 2 | --activity-color-level-1: #ebedf0; 3 | --activity-color-level-2: #9be9a8; 4 | --activity-color-level-3: #40c463; 5 | --activity-color-level-4: #30a14e; 6 | --activity-color-level-5: #216e39; 7 | } 8 | 9 | :root[theme='dark'] { 10 | --activity-color-level-1: #161b22; 11 | --activity-color-level-2: #003820; 12 | --activity-color-level-3: #00602d; 13 | --activity-color-level-4: #1d9d47; 14 | --activity-color-level-5: #26d545; 15 | } 16 | -------------------------------------------------------------------------------- /packages/journey-map/src/Stages/style.less: -------------------------------------------------------------------------------- 1 | .avx-journey-map-stage { 2 | &-container { 3 | display: flex; 4 | flex: 1; 5 | } 6 | 7 | &-content { 8 | display: flex; 9 | flex: 1; 10 | } 11 | 12 | &-step { 13 | display: flex; 14 | align-items: center; 15 | justify-content: center; 16 | padding: 8px; 17 | border-radius: 4px; 18 | 19 | &-text { 20 | height: 32px; 21 | line-height: 32px; 22 | text-align: center; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/i18n/README.md: -------------------------------------------------------------------------------- 1 | # @arvinxu/i18n 2 | 3 | [![NPM version][version-image]][version-url] [![NPM downloads][download-image]][download-url] 4 | 5 | ## License 6 | 7 | [MIT](../../LICENSE) ® Arvin Xu 8 | 9 | 10 | 11 | [version-image]: http://img.shields.io/npm/v/@arvinxu/i18n.svg?color=deepgreen&label=latest 12 | [version-url]: http://npmjs.org/package/@arvinxu/i18n 13 | [download-image]: https://img.shields.io/npm/dm/@arvinxu/i18n.svg 14 | [download-url]: https://npmjs.org/package/@arvinxu/i18n 15 | -------------------------------------------------------------------------------- /packages/mindflow/src/definition/shapes/MinimalNode.ts: -------------------------------------------------------------------------------- 1 | /* istanbul ignore file */ 2 | import { NodeView } from '@antv/x6'; 3 | 4 | export class MinimalNode extends NodeView { 5 | protected renderMarkup() { 6 | return this.renderJSONMarkup({ 7 | tagName: 'rect', 8 | selector: 'body', 9 | }); 10 | } 11 | 12 | update() { 13 | super.update({ 14 | body: { 15 | refWidth: '100%', 16 | refHeight: '100%', 17 | fill: '#1890ff', 18 | }, 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/asset-gallery/src/components/Layout.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import Layout from './Layout'; 5 | 6 | describe('Layout', () => { 7 | it('瀑布流布局', () => { 8 | const { container } = render(); 9 | expect(container).toMatchSnapshot(); 10 | }); 11 | // it('Grid 布局', () => { 12 | // const { container } = render(); 13 | // expect(container).toMatchSnapshot(); 14 | // }); 15 | }); 16 | -------------------------------------------------------------------------------- /packages/macos-traffic-light/demos/Basic.tsx: -------------------------------------------------------------------------------- 1 | import TrafficLight from '@arvinxu/macos-traffic-light'; 2 | 3 | const Basic = () => { 4 | return ( 5 |
6 | { 8 | alert('Pressed closed'); 9 | }} 10 | onMinimize={() => { 11 | alert('Pressed minimize'); 12 | }} 13 | onMaximize={() => { 14 | alert('Pressed maximize'); 15 | }} 16 | /> 17 |
18 | ); 19 | }; 20 | 21 | export default Basic; 22 | -------------------------------------------------------------------------------- /packages/journey-map/src/PainPoints/index.tsx: -------------------------------------------------------------------------------- 1 | import type { FC } from 'react'; 2 | import React, { useContext } from 'react'; 3 | 4 | import { ListSection } from '../components'; 5 | import { JourneyMapStore } from '../useJourneyMap'; 6 | 7 | const PainPoints: FC = () => { 8 | const { config } = useContext(JourneyMapStore); 9 | const height = config?.height?.painPoint; 10 | 11 | return ( 12 | 13 | ); 14 | }; 15 | 16 | export default PainPoints; 17 | -------------------------------------------------------------------------------- /packages/journey-map/src/utils/getServiceToken.ts: -------------------------------------------------------------------------------- 1 | /* istanbul ignore file */ 2 | import { createContext } from 'react'; 3 | 4 | /** 5 | * 泛型约束,对注入数据的类型推断支持 6 | * 7 | * @export 8 | * @template T 9 | * @param {(...args: any) => T} useFunc 10 | * @param {(T | undefined)} [initialData=undefined] 11 | * @returns 12 | */ 13 | export const getServiceToken = ( 14 | // @ts-ignore 15 | useFunc: (...args: any) => T, 16 | initialData: T | undefined = undefined, 17 | ) => { 18 | return createContext(initialData as T); 19 | }; 20 | -------------------------------------------------------------------------------- /packages/mindflow/src/utils/getServiceToken.ts: -------------------------------------------------------------------------------- 1 | /* istanbul ignore file */ 2 | import { createContext } from 'react'; 3 | 4 | /** 5 | * 泛型约束,对注入数据的类型推断支持 6 | * 7 | * @export 8 | * @template T 9 | * @param {(...args: any) => T} useFunc 10 | * @param {(T | undefined)} [initialData=undefined] 11 | * @returns 12 | */ 13 | export const getServiceToken = ( 14 | // @ts-ignore 15 | useFunc: (...args: any) => T, 16 | initialData: T | undefined = undefined, 17 | ) => { 18 | return createContext(initialData as T); 19 | }; 20 | -------------------------------------------------------------------------------- /packages/preloader/README.md: -------------------------------------------------------------------------------- 1 | # @arvinxu/preloader 2 | 3 | [![NPM version][version-image]][version-url] [![NPM downloads][download-image]][download-url] 4 | 5 | ## License 6 | 7 | [MIT](../../LICENSE) ® Arvin Xu 8 | 9 | 10 | 11 | [version-image]: http://img.shields.io/npm/v/@arvinxu/preloader.svg?color=deepgreen&label=latest 12 | [version-url]: http://npmjs.org/package/@arvinxu/preloader 13 | [download-image]: https://img.shields.io/npm/dm/@arvinxu/preloader.svg 14 | [download-url]: https://npmjs.org/package/@arvinxu/preloader 15 | -------------------------------------------------------------------------------- /packages/mindflow/src/definition/label.tsx: -------------------------------------------------------------------------------- 1 | /* istanbul ignore file */ 2 | 3 | import ReactDOM from 'react-dom'; 4 | import React from 'react'; 5 | 6 | import { EvidenceEdge } from '../components'; 7 | import type { Hook } from '@antv/x6/lib/graph/hook'; 8 | 9 | export const edgeLabel = (args: Hook.OnEdgeLabelRenderedArgs) => { 10 | const { selectors, edge, label } = args; 11 | const content = selectors.foContent as HTMLDivElement; 12 | if (content) { 13 | ReactDOM.render(, content); 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /packages/i18n/src/useLocaleMessages.ts: -------------------------------------------------------------------------------- 1 | import { useEffect, useState } from 'react'; 2 | import { useStoredLocale } from './useStoredLocale'; 3 | import type { LocaleMessageMaps } from './types'; 4 | 5 | /** 6 | * 创建本地语料库 7 | */ 8 | export const useLocaleMessages = (messageObj: LocaleMessageMaps) => { 9 | const { locale } = useStoredLocale(); 10 | const [messages, setMessages] = useState(messageObj[locale]); 11 | 12 | useEffect(() => { 13 | setMessages(messageObj[locale]); 14 | }, [locale]); 15 | 16 | return { locale, messages }; 17 | }; 18 | -------------------------------------------------------------------------------- /packages/tag-selector/src/components/NewTag.less: -------------------------------------------------------------------------------- 1 | @import '../theme/token'; 2 | 3 | .input { 4 | align-self: center; 5 | width: 80px; 6 | background-color: @base-white; 7 | border-radius: 4px; 8 | box-shadow: none; 9 | } 10 | 11 | .plus { 12 | align-self: center; 13 | width: 24px; 14 | margin-right: 0; 15 | padding-left: 5px; 16 | color: @transBlack-4; 17 | background: @base-white; 18 | border-color: @transBlack-6; 19 | &:hover { 20 | color: @transBlack-2; 21 | } 22 | &:active { 23 | color: @base-black; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/page-loading/README.md: -------------------------------------------------------------------------------- 1 | # @arvinxu/page-loading 2 | 3 | [![NPM version][version-image]][version-url] [![NPM downloads][download-image]][download-url] 4 | 5 | ## License 6 | 7 | [MIT](../../LICENSE) ® Arvin Xu 8 | 9 | 10 | 11 | [version-image]: http://img.shields.io/npm/v/@arvinxu/page-loading.svg?color=deepgreen&label=latest 12 | [version-url]: http://npmjs.org/package/@arvinxu/page-loading 13 | [download-image]: https://img.shields.io/npm/dm/@arvinxu/page-loading.svg 14 | [download-url]: https://npmjs.org/package/@arvinxu/page-loading 15 | -------------------------------------------------------------------------------- /packages/sortable-list/tests/index.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import SortableList from '@arvinxu/sortable-list'; 5 | 6 | describe('SortableList', () => { 7 | it('默认状态', () => { 8 | const { container } = render(); 9 | expect(container).toMatchSnapshot(); 10 | }); 11 | it('有数据', () => { 12 | const { container } = render( 13 | , 14 | ); 15 | expect(container).toMatchSnapshot(); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/tag-selector/README.md: -------------------------------------------------------------------------------- 1 | # @arvinxu/tag-selector 2 | 3 | [![NPM version][version-image]][version-url] [![NPM downloads][download-image]][download-url] 4 | 5 | ## License 6 | 7 | [MIT](../../LICENSE) ® Arvin Xu 8 | 9 | 10 | 11 | [version-image]: http://img.shields.io/npm/v/@arvinxu/tag-selector.svg?color=deepgreen&label=latest 12 | [version-url]: http://npmjs.org/package/@arvinxu/tag-selector 13 | [download-image]: https://img.shields.io/npm/dm/@arvinxu/tag-selector.svg 14 | [download-url]: https://npmjs.org/package/@arvinxu/tag-selector 15 | -------------------------------------------------------------------------------- /packages/asset-gallery/demos/PngDemo.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * compact: true 3 | * inherit: true 4 | */ 5 | import AssetGallery from '@arvinxu/asset-gallery'; 6 | 7 | import { useTheme } from 'antd-style'; 8 | import { yml } from './png'; 9 | 10 | const PngDemo = () => { 11 | const token = useTheme(); 12 | return ( 13 |
19 | 20 |
21 | ); 22 | }; 23 | 24 | export default PngDemo; 25 | -------------------------------------------------------------------------------- /packages/macos-traffic-light/src/MinimizeIcon.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import type { FC } from 'react'; 3 | import './icon.less'; 4 | 5 | const MinimizeIcon: FC = () => { 6 | return ( 7 | 15 | 16 | 17 | ); 18 | }; 19 | 20 | export default MinimizeIcon; 21 | -------------------------------------------------------------------------------- /packages/user-panel/README.md: -------------------------------------------------------------------------------- 1 | # @arvinxu/user-panel 2 | 3 | [![NPM version][version-image]][version-url] [![NPM downloads][download-image]][download-url] 4 | 5 | 用户登录注册面板 6 | 7 | ## License 8 | 9 | [MIT](../../LICENSE) ® Arvin Xu 10 | 11 | 12 | 13 | [version-image]: http://img.shields.io/npm/v/@arvinxu/user-panel.svg?color=deepgreen&label=latest 14 | [version-url]: http://npmjs.org/package/@arvinxu/user-panel 15 | [download-image]: https://img.shields.io/npm/dm/@arvinxu/user-panel.svg 16 | [download-url]: https://npmjs.org/package/@arvinxu/user-panel 17 | -------------------------------------------------------------------------------- /scripts/create-package/template/README.md.ejs: -------------------------------------------------------------------------------- 1 | # @arvinxu/<%- pkg %> 2 | 3 | 4 | [![NPM version][version-image]][version-url] [![NPM downloads][download-image]][download-url] 5 | 6 | ## License 7 | 8 | [MIT](../../LICENSE) ® Arvin Xu 9 | 10 | 11 | 12 | [version-image]: http://img.shields.io/npm/v/@arvinxu/<%- pkg %>.svg?color=deepgreen&label=latest 13 | [version-url]: http://npmjs.org/package/@arvinxu/<%- pkg %> 14 | [download-image]: https://img.shields.io/npm/dm/@arvinxu/<%- pkg %>.svg 15 | [download-url]: https://npmjs.org/package/@arvinxu/<%- pkg %> 16 | -------------------------------------------------------------------------------- /packages/user-panel/src/user-panel.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: UserPanel 用户面板 3 | group: 登录/注册面板 4 | --- 5 | 6 | # UserPanel 用户面板 7 | 8 | [![NPM version][version-image]][version-url] [![NPM downloads][download-image]][download-url] 9 | 10 | 用户登录注册集成面板 11 | 12 | [version-image]: http://img.shields.io/npm/v/@arvinxu/user-panel.svg?color=deepgreen&label=latest 13 | [version-url]: http://npmjs.org/package/@arvinxu/user-panel 14 | [download-image]: https://img.shields.io/npm/dm/@arvinxu/user-panel.svg 15 | [download-url]: https://github.com/arvinxx/components/tree/master/packages/user-panel 16 | -------------------------------------------------------------------------------- /packages/asset-gallery/demos/Demo.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * compact: true 3 | * inherit: true 4 | */ 5 | import AssetGallery from '@arvinxu/asset-gallery'; 6 | 7 | import { useTheme } from 'antd-style'; 8 | import { images } from './data'; 9 | 10 | const Demo = () => { 11 | const token = useTheme(); 12 | return ( 13 | 22 | ); 23 | }; 24 | 25 | export default Demo; 26 | -------------------------------------------------------------------------------- /packages/mindflow/src/components/Port/OutPort.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import type { FC } from 'react'; 3 | 4 | import './style.less'; 5 | 6 | import CollapseIcon from '../CollapseIcon'; 7 | 8 | interface OutPortProps { 9 | color: string; 10 | collapsed: boolean; 11 | id: string; 12 | } 13 | 14 | export const OutPort: FC = ({ 15 | color, 16 | collapsed, 17 | 18 | id, 19 | }) => { 20 | return ( 21 |
22 | 23 |
24 | ); 25 | }; 26 | -------------------------------------------------------------------------------- /packages/sortable-list/README.md: -------------------------------------------------------------------------------- 1 | # @arvinxu/sortable-list 2 | 3 | [![NPM version][version-image]][version-url] [![NPM downloads][download-image]][download-url] 4 | 5 | 可排序列表 6 | 7 | ## License 8 | 9 | [MIT](../../LICENSE) ® Arvin Xu 10 | 11 | 12 | 13 | [version-image]: http://img.shields.io/npm/v/@arvinxu/sortable-list.svg?color=deepgreen&label=latest 14 | [version-url]: http://npmjs.org/package/@arvinxu/sortable-list 15 | [download-image]: https://img.shields.io/npm/dm/@arvinxu/sortable-list.svg 16 | [download-url]: https://npmjs.org/package/@arvinxu/sortable-list 17 | -------------------------------------------------------------------------------- /packages/asset-gallery/demos/YAMLDemo.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * compact: true 3 | * inherit: true 4 | */ 5 | import AssetGallery from '@arvinxu/asset-gallery'; 6 | 7 | import { useTheme } from 'antd-style'; 8 | import { yml } from './yml'; 9 | 10 | const YAMLDemo = () => { 11 | const token = useTheme(); 12 | return ( 13 | 22 | ); 23 | }; 24 | 25 | export default YAMLDemo; 26 | -------------------------------------------------------------------------------- /packages/heatmap-calendar/README.md: -------------------------------------------------------------------------------- 1 | # @arvinxu/heatmap-calendar 2 | 3 | [![NPM version][version-image]][version-url] [![NPM downloads][download-image]][download-url] 4 | 5 | ## License 6 | 7 | [MIT](../../LICENSE) ® Arvin Xu 8 | 9 | 10 | 11 | [version-image]: http://img.shields.io/npm/v/@arvinxu/heatmap-calendar.svg?color=deepgreen&label=latest 12 | [version-url]: http://npmjs.org/package/@arvinxu/heatmap-calendar 13 | [download-image]: https://img.shields.io/npm/dm/@arvinxu/heatmap-calendar.svg 14 | [download-url]: https://npmjs.org/package/@arvinxu/heatmap-calendar 15 | -------------------------------------------------------------------------------- /packages/float-label-input/README.md: -------------------------------------------------------------------------------- 1 | # @arvinxu/float-label-input 2 | 3 | [![NPM version][version-image]][version-url] [![NPM downloads][download-image]][download-url] 4 | 5 | ## License 6 | 7 | [MIT](../../LICENSE) ® Arvin Xu 8 | 9 | 10 | 11 | [version-image]: http://img.shields.io/npm/v/@arvinxu/float-label-input.svg?color=deepgreen&label=latest 12 | [version-url]: http://npmjs.org/package/@arvinxu/float-label-input 13 | [download-image]: https://img.shields.io/npm/dm/@arvinxu/float-label-input.svg 14 | [download-url]: https://npmjs.org/package/@arvinxu/float-label-input 15 | -------------------------------------------------------------------------------- /packages/macos-traffic-light/tests/__snapshots__/index.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`TrafficLight 默认状态 1`] = ` 4 |
5 |
9 |
13 |
17 |
21 |
22 |
23 | `; 24 | -------------------------------------------------------------------------------- /packages/asset-gallery/src/utils/clipboard.ts: -------------------------------------------------------------------------------- 1 | /* istanbul ignore file */ 2 | 3 | /** 4 | * 利用 Clipboard 剪切板 5 | * @param type 6 | * @param blob 7 | */ 8 | export const copyToClipboard = async (type: string, blob: Blob) => { 9 | const { state } = await navigator.permissions.query({ 10 | // @ts-ignore 11 | name: 'clipboard-write', 12 | }); 13 | 14 | const isAllowed = state === 'granted'; 15 | if (navigator.clipboard && isAllowed) { 16 | // @ts-ignore 17 | await navigator.clipboard.write([new ClipboardItem({ [type]: blob })]); 18 | } 19 | 20 | return isAllowed; 21 | }; 22 | -------------------------------------------------------------------------------- /packages/float-label-input/tests/__snapshots__/index.spec.tsx.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`FloatLabelInput 正常渲染 1`] = ` 4 |
5 |
9 | 15 | 22 |
23 |
24 | `; 25 | -------------------------------------------------------------------------------- /packages/journey-map/src/utils/length.test.ts: -------------------------------------------------------------------------------- 1 | import { calcStageLength } from './length'; 2 | 3 | describe('calcStageLength', () => { 4 | it('前后符合目标值', () => { 5 | expect( 6 | calcStageLength({ 7 | totalCount: 21, 8 | actionCount: 3, 9 | stageCount: 5, 10 | index: 0, 11 | }).width, 12 | ).toEqual(11.25); 13 | }); 14 | it('中间符合目标值', () => { 15 | expect( 16 | calcStageLength({ 17 | totalCount: 21, 18 | actionCount: 4, 19 | stageCount: 5, 20 | index: 1, 21 | }).width, 22 | ).toEqual(17.5); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /packages/sortable-list/src/components/Handle/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import { Action, ActionProps } from '../Action'; 4 | 5 | export const Handle = (props: ActionProps) => ( 6 | 7 | 8 | 9 | 10 | 11 | ); 12 | -------------------------------------------------------------------------------- /packages/user-panel/src/components/Footer/style.less: -------------------------------------------------------------------------------- 1 | .avx-user-panel-footer { 2 | width: 95%; 3 | max-width: 328px; 4 | 5 | &-divider { 6 | margin: 8px 0; 7 | padding: 0 16px; 8 | } 9 | 10 | .ant-divider-horizontal.ant-divider-with-text { 11 | color: hsla(0, 0%, 0%, 0.25); 12 | font-size: 14px; 13 | } 14 | 15 | &-other { 16 | display: flex; 17 | flex-direction: column; 18 | align-items: center; 19 | margin-top: 24px; 20 | font-size: 12px; 21 | line-height: 22px; 22 | } 23 | 24 | &-register { 25 | margin-top: 8px; 26 | font-size: 16px; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/float-label-input/src/demos/Basic.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | 3 | import FloatLabelInput from '@arvinxu/float-label-input'; 4 | 5 | const Basic = () => { 6 | const [value, setValue] = useState(''); 7 | return ( 8 |
9 | 10 | 11 | 17 |
18 | ); 19 | }; 20 | 21 | export default Basic; 22 | -------------------------------------------------------------------------------- /packages/user-panel/demos/LoginWithLogo.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * compact: true 3 | */ 4 | import React from 'react'; 5 | 6 | import UserPanel from '@arvinxu/user-panel'; 7 | 8 | const LoginWithLogo = () => { 9 | return ( 10 |
18 | 23 |
24 | ); 25 | }; 26 | 27 | export default LoginWithLogo; 28 | -------------------------------------------------------------------------------- /packages/user-panel/src/register.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: UserPanel.Register 注册面板 3 | group: 登录/注册面板 4 | --- 5 | 6 | # UserPanel.Register 注册 7 | 8 | [![NPM version][version-image]][version-url] [![NPM downloads][download-image]][download-url] 9 | 10 | 用户登录注册集成面板 11 | 12 | [version-image]: http://img.shields.io/npm/v/@arvinxu/user-panel.svg?color=deepgreen&label=latest 13 | [version-url]: http://npmjs.org/package/@arvinxu/user-panel 14 | [download-image]: https://img.shields.io/npm/dm/@arvinxu/user-panel.svg 15 | [download-url]: https://github.com/arvinxx/components/tree/master/packages/user-panel 16 | 17 | ## 注册面板 18 | 19 | TODO 20 | -------------------------------------------------------------------------------- /packages/mindflow/src/components/EvidenceEdge/style.less: -------------------------------------------------------------------------------- 1 | @import '../../themes/theme'; 2 | 3 | .mind-edge { 4 | &-container { 5 | width: 30px; 6 | height: 30px; 7 | } 8 | 9 | &-content { 10 | position: absolute; 11 | top: 50%; 12 | left: 50%; 13 | width: 10px; 14 | height: 10px; 15 | background: @text-color-third; 16 | border-radius: 100%; 17 | transform: translate(-50%, -50%); 18 | cursor: pointer; 19 | &:hover { 20 | background: @text-color-secondary; 21 | } 22 | } 23 | &-empty { 24 | background: white; 25 | border: 1px solid @text-color-third; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/sortable-list/demos/Basic.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * compact: true 3 | */ 4 | import SortableList from '@arvinxu/sortable-list'; 5 | import { useTheme } from 'antd-style'; 6 | import { useState } from 'react'; 7 | import { Flexbox } from 'react-layout-kit'; 8 | 9 | const Demo = () => { 10 | const [list, setList] = useState([{ id: 'hello' }, { id: 'world' }]); 11 | 12 | const token = useTheme(); 13 | return ( 14 | 15 | setList(value)} /> 16 | 17 | ); 18 | }; 19 | 20 | export default Demo; 21 | -------------------------------------------------------------------------------- /packages/user-panel/demos/LoginWithForgotUrl.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * compact: true 3 | */ 4 | import React from 'react'; 5 | 6 | import UserPanel from '@arvinxu/user-panel'; 7 | 8 | const LoginWithLogo = () => { 9 | return ( 10 |
18 | { 20 | history.push('/components/biz/user-panel'); 21 | }} 22 | /> 23 |
24 | ); 25 | }; 26 | 27 | export default LoginWithLogo; 28 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test CI 2 | on: [push, pull_request] 3 | jobs: 4 | test: 5 | runs-on: ubuntu-latest 6 | 7 | steps: 8 | - uses: actions/checkout@v3 9 | 10 | - name: ⚙ 设置 pnpm 11 | uses: pnpm/action-setup@v2 12 | with: 13 | version: latest 14 | 15 | - name: 🏗 准备 Node.js 环境 16 | uses: actions/setup-node@v3 17 | with: 18 | node-version: '18' 19 | 20 | - name: 🗳 安装依赖 21 | run: pnpm install 22 | 23 | - name: ✅ 测试检查 24 | run: pnpm run test:cov 25 | 26 | - name: ⬆️上传至 Codecov 27 | uses: codecov/codecov-action@v3 28 | -------------------------------------------------------------------------------- /packages/i18n/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## @arvinxu/i18n [1.0.1](https://github.com/arvinxx/components/compare/@arvinxu/i18n@1.0.0...@arvinxu/i18n@1.0.1) (2021-07-13) 4 | 5 | ### 🐛 修复 6 | 7 | - 修正类型无法自动提示的问题 ([189f722](https://github.com/arvinxx/components/commit/189f722)) 8 | 9 | ### 🔧 持续集成 10 | 11 | - 修正 lint ([8f940b6](https://github.com/arvinxx/components/commit/8f940b6)) 12 | 13 | # @arvinxu/i18n 1.0.0 (2021-07-03) 14 | 15 | ### ✨ 新特性 16 | 17 | - 实现 i18n 组件 ([5ebe6c5](https://github.com/arvinxx/components/commit/5ebe6c5)) 18 | 19 | ### 🎫 杂项 20 | 21 | - 初始化 i18n ([bc0d1f1](https://github.com/arvinxx/components/commit/bc0d1f1)) 22 | -------------------------------------------------------------------------------- /packages/preloader/src/Square.less: -------------------------------------------------------------------------------- 1 | @keyframes pulse { 2 | 0% { 3 | opacity: 1; 4 | } 5 | 100% { 6 | opacity: 0; 7 | } 8 | } 9 | 10 | .avx-preloader-square { 11 | &-container { 12 | display: flex; 13 | flex-direction: row; 14 | flex-wrap: wrap; 15 | align-items: center; 16 | justify-content: space-around; 17 | width: 36px; 18 | height: 36px; 19 | } 20 | 21 | &-item { 22 | width: 35%; 23 | height: 35%; 24 | animation: pulse 0.75s ease-in infinite alternate; 25 | } 26 | 27 | &-animation-delay { 28 | -webkit-animation-delay: 0.75s; 29 | animation-delay: 0.75s; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/user-panel/src/locales/index.ts: -------------------------------------------------------------------------------- 1 | import i18n from 'i18next'; 2 | import { initReactI18next } from 'react-i18next'; 3 | import LanguageDetector from 'i18next-browser-languagedetector'; 4 | 5 | import zhCN from './zh-CN'; 6 | import en from './en-US'; 7 | 8 | const resources = { 9 | en: { translation: en }, 10 | 'zh-CN': { translation: zhCN }, 11 | }; 12 | 13 | i18n 14 | .use(initReactI18next) 15 | 16 | .use(LanguageDetector) 17 | .init({ 18 | resources, 19 | 20 | fallbackLng: 'zh-CN', 21 | interpolation: { 22 | escapeValue: false, // react already safes from xss 23 | }, 24 | }); 25 | 26 | export default i18n; 27 | -------------------------------------------------------------------------------- /packages/mindflow/src/themes/nodeColor.ts: -------------------------------------------------------------------------------- 1 | const baseGreen = '#52c41a'; 2 | const baseYellow = '#faad14'; 3 | const baseRed = '#ff4d4f'; 4 | const baseBlue = '#69c0ff'; 5 | const baseCyan = '#5cdbd3'; 6 | const basePurple = '#b37feb'; 7 | const baseGray = '#8f8f8f'; 8 | 9 | const black009 = 'rgba(0,0,0,0.09)'; 10 | const black002 = 'rgba(0,0,0,0.02)'; 11 | 12 | export const mindFlowColors = { 13 | white: '#ffffff', 14 | blue: baseBlue, 15 | cyan: baseCyan, 16 | green: baseGreen, 17 | yellow: baseYellow, 18 | red: baseRed, 19 | purple: basePurple, 20 | gray: baseGray, 21 | black009, 22 | shadowColor: black009, 23 | menuHoverBg: black002, 24 | }; 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules 5 | 6 | # production 7 | dist 8 | /.vscode 9 | es 10 | lib 11 | 12 | # misc 13 | .DS_Store 14 | storybook-static 15 | npm-debug.log* 16 | yarn-error.log 17 | 18 | coverage 19 | .idea 20 | package-lock.json 21 | *bak 22 | .vscode 23 | 24 | # visual studio code 25 | .history 26 | *.log 27 | functions/* 28 | lambda/mock/index.js 29 | .temp/** 30 | 31 | # umi 32 | .umi 33 | .umi-production 34 | .dumi/tmp 35 | .dumi/tmp-test 36 | .dumi/tmp-production 37 | 38 | # screenshot 39 | screenshot 40 | .firebase 41 | example/.temp/* 42 | .eslintcache 43 | 44 | apis 45 | -------------------------------------------------------------------------------- /packages/mindflow/src/components/EvidenceEdge/Reference.less: -------------------------------------------------------------------------------- 1 | @import '../../themes/theme'; 2 | 3 | .mind-edge-references { 4 | color: @text-color-secondary; 5 | 6 | &-text { 7 | display: flex; 8 | max-width: 200px; 9 | } 10 | 11 | &-item { 12 | display: flex; 13 | margin-bottom: 12px; 14 | color: @text-color-secondary; 15 | font-size: 14px; 16 | } 17 | 18 | &-tag { 19 | margin-left: 4px; 20 | padding: 0 4px; 21 | } 22 | 23 | &-foot { 24 | display: flex; 25 | flex-direction: row-reverse; 26 | } 27 | } 28 | .ant-popover { 29 | z-index: 2000; 30 | &-inner-content { 31 | padding: 8px; 32 | padding-top: 16px; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /packages/mindflow/src/definition/edge.ts: -------------------------------------------------------------------------------- 1 | /* istanbul ignore file */ 2 | import { Markup, Shape } from '@antv/x6'; 3 | import './connector'; 4 | 5 | Shape.Edge.config({ 6 | connector: 'curve', 7 | attrs: { 8 | line: { 9 | stroke: '#d9d9d9', 10 | strokeWidth: 1, 11 | targetMarker: { 12 | tagName: 'path', 13 | d: 'M0 0 Z', 14 | }, 15 | }, 16 | }, 17 | 18 | defaultLabel: { 19 | markup: Markup.getForeignObjectMarkup(), 20 | attrs: { 21 | fo: { 22 | width: 30, 23 | height: 30, 24 | x: -15, 25 | y: -15, 26 | }, 27 | }, 28 | }, 29 | label: { 30 | position: 0.55, 31 | }, 32 | }); 33 | -------------------------------------------------------------------------------- /packages/asset-gallery/src/utils/helper.ts: -------------------------------------------------------------------------------- 1 | /* istanbul ignore file */ 2 | 3 | import { message } from 'antd'; 4 | 5 | /** 6 | * 利用 Canvas 生成 png dataURL 7 | * @param image 8 | * @param scale 缩放 9 | */ 10 | export const getImageBase64 = (image: HTMLImageElement, scale = 1) => { 11 | const canvas = document.getElementById('canvas') as HTMLCanvasElement; 12 | canvas.width = image.width * scale; 13 | canvas.height = image.height * scale; 14 | 15 | const context = canvas.getContext('2d'); 16 | context?.drawImage(image, 0, 0, image.width, image.height); 17 | 18 | return canvas.toDataURL('image/png'); 19 | }; 20 | 21 | export const copySuccess = () => { 22 | message.success('🎉 复制成功!'); 23 | }; 24 | -------------------------------------------------------------------------------- /packages/mindflow/src/definition/connector.ts: -------------------------------------------------------------------------------- 1 | /* istanbul ignore file */ 2 | import { Graph, Path } from '@antv/x6'; 3 | 4 | Graph.registerConnector( 5 | 'curve', 6 | (sourcePoint, targetPoint) => { 7 | const path = new Path(); 8 | path.appendSegment(Path.createSegment('M', sourcePoint)); 9 | const distance = (targetPoint.x - sourcePoint.x) / 2; 10 | path.appendSegment( 11 | Path.createSegment( 12 | 'C', 13 | sourcePoint.x + distance, 14 | sourcePoint.y, 15 | targetPoint.x - distance, 16 | targetPoint.y, 17 | targetPoint.x, 18 | targetPoint.y, 19 | ), 20 | ); 21 | return path.serialize(); 22 | }, 23 | true, 24 | ); 25 | -------------------------------------------------------------------------------- /packages/heatmap-calendar/src/utils/index.test.ts: -------------------------------------------------------------------------------- 1 | import { mapDataCountToLevel, mapToMonth } from './index'; 2 | 3 | test('mapDataCountToLevel', () => { 4 | expect(mapDataCountToLevel(0)).toBe(0); 5 | expect(mapDataCountToLevel(1)).toBe(1); 6 | expect(mapDataCountToLevel(4)).toBe(2); 7 | expect(mapDataCountToLevel(12)).toBe(3); 8 | expect(mapDataCountToLevel(20)).toBe(4); 9 | }); 10 | 11 | test('mapToMonth', () => { 12 | expect(mapToMonth(0)).toBe(''); 13 | expect(mapToMonth(2)).toBe('MAY'); 14 | expect(mapToMonth(6)).toBe('JUN'); 15 | expect(mapToMonth(10)).toBe('JUL'); 16 | expect(mapToMonth(15)).toBe('AUG'); 17 | expect(mapToMonth(19)).toBe('SEP'); 18 | expect(mapToMonth(24)).toBe('OCT'); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/tag-selector/src/demos/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import TagSelector from '@arvinxu/tag-selector'; 3 | import { Item } from '@arvinxu/tag-selector/type'; 4 | export const smallLabel: Item[] = [ 5 | { 6 | title: '未分组', 7 | key: '1526132530988', 8 | value: [ 9 | { 10 | text: '测试标签1', 11 | key: 'rJecwftRf', 12 | refText: '21312', 13 | }, 14 | { 15 | text: '测试标签2', 16 | key: 'rJecwfsdstRf', 17 | refText: '1352dx', 18 | }, 19 | ], 20 | }, 21 | ]; 22 | 23 | const Simple = () => { 24 | return ( 25 |
26 | 27 |
28 | ); 29 | }; 30 | 31 | export default Simple; 32 | -------------------------------------------------------------------------------- /packages/heatmap-calendar/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 活跃等级映射 3 | * @param count 4 | */ 5 | export const mapDataCountToLevel = (count: number) => { 6 | if (count === 0) return 0; 7 | if (count < 2) return 1; 8 | if (count < 5) return 2; 9 | if (count < 15) return 3; 10 | return 4; 11 | }; 12 | /** 13 | * 映射位月份 14 | * @param week 15 | */ 16 | export const mapToMonth = (week: number) => { 17 | switch (week) { 18 | case 2: 19 | return 'MAY'; 20 | case 6: 21 | return 'JUN'; 22 | case 10: 23 | return 'JUL'; 24 | case 15: 25 | return 'AUG'; 26 | case 19: 27 | return 'SEP'; 28 | case 24: 29 | return 'OCT'; 30 | default: 31 | return ''; 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /packages/sortable-list/src/container/Wrapper.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import type { FC } from 'react'; 3 | 4 | import { Provider, createStore, useStoreApi } from '../store'; 5 | 6 | const StoreWrapper: FC = ({ children }) => { 7 | let isWrapped = true; 8 | 9 | try { 10 | useStoreApi(); 11 | } catch (e) { 12 | isWrapped = false; 13 | } 14 | 15 | if (isWrapped) { 16 | // we need to wrap it with a fragment because it's not allowed for children to be a ReactNode 17 | // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18051 18 | return <>{children}; 19 | } 20 | 21 | return {children}; 22 | }; 23 | 24 | export default StoreWrapper; 25 | -------------------------------------------------------------------------------- /packages/mindflow/src/definition/minimapOpts.ts: -------------------------------------------------------------------------------- 1 | /* istanbul ignore file */ 2 | import { MinimalNode } from './shapes'; 3 | import type { MiniMapManager } from '@antv/x6/lib/graph/minimap'; 4 | 5 | export const minimapOpts = (container): Partial => ({ 6 | container, 7 | enabled: true, 8 | maxScale: 1, 9 | scalable: false, 10 | width: 120, 11 | height: 100, 12 | graphOptions: { 13 | async: true, 14 | // 用指定的 View 替换节点默认的 View 15 | getCellView(cell) { 16 | if (cell.isNode()) { 17 | return MinimalNode; 18 | } 19 | }, 20 | // 在小地图中不渲染边 21 | createCellView(cell) { 22 | if (cell.isEdge()) { 23 | return null; 24 | } 25 | }, 26 | }, 27 | }); 28 | -------------------------------------------------------------------------------- /packages/journey-map/README.md: -------------------------------------------------------------------------------- 1 | # @arvinxu/journey-map 2 | 3 | [![NPM version][version-image]][version-url] [![NPM downloads][download-image]][download-url] 4 | 5 | 用户旅程地图 6 | 7 | [![Journey Map YAML Template](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/journey-map-yaml-template-lmxez?file=/map.yml) 8 | 9 | ## License 10 | 11 | [MIT](../../LICENSE) ® Arvin Xu 12 | 13 | 14 | 15 | [version-image]: http://img.shields.io/npm/v/@arvinxu/journey-map.svg?color=deepgreen&label=latest 16 | [version-url]: http://npmjs.org/package/@arvinxu/journey-map 17 | [download-image]: https://img.shields.io/npm/dm/@arvinxu/journey-map.svg 18 | [download-url]: https://npmjs.org/package/@arvinxu/journey-map 19 | -------------------------------------------------------------------------------- /packages/asset-gallery/tests/index.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import AssetGallery from '@arvinxu/asset-gallery'; 5 | 6 | import { images, pngYML } from './data'; 7 | 8 | describe('AssetGallery', () => { 9 | it('默认状态', () => { 10 | const { container } = render(); 11 | expect(container).toMatchSnapshot(); 12 | }); 13 | 14 | it('加载数据', () => { 15 | const { container } = render(); 16 | expect(container).toMatchSnapshot(); 17 | }); 18 | 19 | it('图片源为 PNG', () => { 20 | const { container } = render(); 21 | expect(container).toMatchSnapshot(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /packages/asset-gallery/demos/SketchDemo.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * compact: true 3 | * inherit: true 4 | */ 5 | import AssetGallery from '@arvinxu/asset-gallery'; 6 | 7 | import { useTheme } from 'antd-style'; 8 | import { sketch } from './sketch'; 9 | 10 | const SketchDemo = () => { 11 | const token = useTheme(); 12 | return ( 13 |
19 | 26 |
27 | ); 28 | }; 29 | 30 | export default SketchDemo; 31 | -------------------------------------------------------------------------------- /packages/float-label-input/src/float-label-input.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: FloatLabelInput 3 | order: 5 4 | group: 5 | path: / 6 | nav: 7 | path: /components 8 | --- 9 | 10 | # FloatLabelInput 11 | 12 | [![NPM version][version-image]][version-url] [![NPM downloads][download-image]][download-url] 13 | 14 | 15 | 16 | [version-image]: http://img.shields.io/npm/v/@arvinxu/float-label-input.svg?color=deepgreen&label=latest 17 | [version-url]: http://npmjs.org/package/@arvinxu/float-label-input 18 | [download-image]: https://img.shields.io/npm/dm/@arvinxu/float-label-input.svg 19 | [download-url]: https://npmjs.org/package/@arvinxu/float-label-input 20 | 21 | ## Demo 22 | 23 | ### 默认 24 | 25 | 26 | 27 | ### 高度 28 | 29 | 30 | -------------------------------------------------------------------------------- /packages/mindflow/src/hooks/useRegister.tsx: -------------------------------------------------------------------------------- 1 | import '@antv/x6-react-shape'; 2 | import React from 'react'; 3 | import { Graph } from '@antv/x6'; 4 | import { useEffect } from 'react'; 5 | import { MindNode } from '../components'; 6 | 7 | declare global { 8 | interface Window { 9 | __IS_REGISTERED_MIND_NODE__: boolean; 10 | } 11 | } 12 | 13 | export const useGraphRegister = () => { 14 | useEffect(() => { 15 | if (!window.__IS_REGISTERED_MIND_NODE__) { 16 | // 注册返回 React 组件的函数 17 | Graph.registerReactComponent('mind-node', ); 18 | window.__IS_REGISTERED_MIND_NODE__ = true; 19 | } 20 | return () => { 21 | Graph.unregisterReactComponent('mind-node'); 22 | window.__IS_REGISTERED_MIND_NODE__ = false; 23 | }; 24 | }, []); 25 | }; 26 | -------------------------------------------------------------------------------- /packages/asset-gallery/src/components/Layout.style.ts: -------------------------------------------------------------------------------- 1 | import { createStyles } from 'antd-style'; 2 | 3 | export const useStyles = createStyles(({ prefixCls, cx, css }) => { 4 | const prefix = `${prefixCls}-asset-gallery`; 5 | return { 6 | container: cx(`${prefix}-container`), 7 | grid: cx( 8 | `${prefix}-grid`, 9 | css` 10 | display: grid; 11 | grid-template-columns: repeat(3, 1fr); 12 | `, 13 | ), 14 | masonry: cx( 15 | `${prefix}-masonry`, 16 | css` 17 | column-count: 4; 18 | column-gap: 0; 19 | 20 | @media (max-width: 400px) { 21 | column-count: 2; 22 | } 23 | 24 | @media (max-width: 1200px) { 25 | column-count: 3; 26 | } 27 | `, 28 | ), 29 | }; 30 | }); 31 | -------------------------------------------------------------------------------- /packages/preloader/tests/__snapshots__/index.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Preloader Square 1`] = ` 4 |
5 |
8 |
12 |
16 |
20 |
24 |
25 |
26 | `; 27 | -------------------------------------------------------------------------------- /packages/user-panel/demos/LoginWithFooter.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * compact: true 3 | */ 4 | import React from 'react'; 5 | 6 | import UserPanel from '@arvinxu/user-panel'; 7 | import { message } from 'antd'; 8 | 9 | const LoginWithFooter = () => { 10 | return ( 11 |
19 | { 22 | message.info('微信登录实现方法'); 23 | }} 24 | onRegisterClick={(history) => { 25 | history.push('/components/biz/user-panel#显示底部'); 26 | }} 27 | /> 28 |
29 | ); 30 | }; 31 | 32 | export default LoginWithFooter; 33 | -------------------------------------------------------------------------------- /packages/journey-map/src/components/__snapshots__/OverflowTitle.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`OverflowTitle x 轴 1`] = ` 4 |
5 |
8 | hello 9 |
10 |
11 | `; 12 | 13 | exports[`OverflowTitle x 轴 overflow 1`] = ` 14 |
15 |
18 |
21 | hello 22 |
23 |
24 |
25 | `; 26 | 27 | exports[`OverflowTitle y 轴 1`] = ` 28 |
29 |
32 | hello 33 |
34 |
35 | `; 36 | -------------------------------------------------------------------------------- /packages/journey-map/tests/__snapshots__/index.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`JourneyMap 默认状态 1`] = ` 4 |
5 |
8 |
11 |
15 |
19 |
22 | 阶段 23 |
24 |
25 |
28 |
29 |
30 |
31 |
32 | `; 33 | -------------------------------------------------------------------------------- /packages/asset-gallery/tests/data.ts: -------------------------------------------------------------------------------- 1 | import type { AssetList } from '@arvinxu/asset-gallery'; 2 | 3 | export const images: AssetList = [ 4 | { 5 | title: '渐变色 Logo', 6 | description: '渐变色', 7 | url: 'https://gw.alipayobjects.com/zos/antfincdn/LFmaI3%26OJh/logo.svg', 8 | }, 9 | { 10 | title: '白色 Logo', 11 | description: '暗色背景下使用', 12 | dark: true, 13 | padding: 12, 14 | darkBackground: 'black', 15 | url: 'https://gw.alipayobjects.com/zos/antfincdn/5qY87lPw9U/white-logo.svg', 16 | }, 17 | ]; 18 | 19 | export const pngYML = ` 20 | - 标题: 渐变色 Logo 21 | 描述: 渐变色 22 | 链接: https://gw.alipayobjects.com/zos/antfincdn/OuMB9liYZV/tupian%2525201.png 23 | 24 | - 标题: 黑色 Logo 25 | 描述: 亮色背景下使用 26 | 链接: https://gw.alipayobjects.com/zos/antfincdn/5vmPNr6Qqz/tupian%2525202.png 27 | `; 28 | -------------------------------------------------------------------------------- /packages/float-label-input/src/useHover.ts: -------------------------------------------------------------------------------- 1 | import { useRef } from 'react'; 2 | import { useSize } from 'ahooks'; 3 | import type { InputRef } from 'antd'; 4 | 5 | export const useHover = () => { 6 | const inputRef = useRef(null); 7 | const labelRef = useRef(null); 8 | const { height: inputHeight } = useSize(inputRef.current && inputRef.current.input); 9 | 10 | let baseGap = 8; 11 | const { height: labelHeight } = useSize(labelRef); 12 | let isReady = true; 13 | 14 | if (!inputHeight || !labelHeight) { 15 | isReady = false; 16 | } else { 17 | baseGap = (inputHeight - labelHeight) / 2; 18 | } 19 | 20 | return { 21 | inputRef, 22 | labelRef, 23 | isReady, 24 | baseGap, 25 | labelPosition: isReady ? labelHeight! + baseGap : 26, 26 | }; 27 | }; 28 | -------------------------------------------------------------------------------- /packages/preloader/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@arvinxu/preloader", 3 | "version": "1.0.2", 4 | "files": [ 5 | "dist" 6 | ], 7 | "main": "dist/index.js", 8 | "module": "dist/index.js", 9 | "types": "dist/index.d.ts", 10 | "sideEffects": [ 11 | "*.less" 12 | ], 13 | "homepage": "https://github.com/arvinxx/components/tree/master/packages/preloader#readme", 14 | "repository": "git+https://github.com/arvinxx/components.git", 15 | "publishConfig": { 16 | "registry": "https://registry.npmjs.org", 17 | "access": "public" 18 | }, 19 | "scripts": { 20 | "build": "father build", 21 | "test": "jest", 22 | "test:update": "jest -u", 23 | "prepublishOnly": "pnpm run build", 24 | "cov": "jest --coverage", 25 | "clean": "rm -rf es lib dist build coverage .umi" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/journey-map/src/components/OverflowTitle.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import OverflowTitle from './OverflowTitle'; 5 | 6 | describe('OverflowTitle', () => { 7 | it('x 轴', () => { 8 | const { container } = render(); 9 | expect(container).toMatchSnapshot(); 10 | }); 11 | it('x 轴 overflow', () => { 12 | const { container } = render( 13 |
14 | 15 |
, 16 | ); 17 | expect(container).toMatchSnapshot(); 18 | }); 19 | 20 | it('y 轴', () => { 21 | const { container } = render(); 22 | expect(container).toMatchSnapshot(); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /packages/journey-map/src/types/yml.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 阶段 3 | */ 4 | import type { CommonSection, Config, JourneyMapData, UserAction } from './type'; 5 | 6 | /** 7 | * YML 的阶段类型 8 | */ 9 | interface YMLStage extends CommonSection { 10 | /** 11 | * 阶段名称 12 | */ 13 | name: string; 14 | 15 | /** 16 | * 该阶段所有用户行为 17 | */ 18 | actions: UserAction[]; 19 | } 20 | 21 | /** 22 | * 解析后的 YML 数据 23 | */ 24 | export interface YMLJourneyMapRawData { 25 | /** 26 | * 标题名 27 | */ 28 | title?: string; 29 | /** 30 | * 配置参数 31 | */ 32 | config?: Config; 33 | /** 34 | * 步骤 35 | */ 36 | stages: YMLStage[]; 37 | } 38 | 39 | /** 40 | * 从 YML 转过来的数据 41 | * 包含有 title config 等其他参数 42 | */ 43 | export interface YMLJourneyMapData extends JourneyMapData { 44 | title?: string; 45 | config?: Config; 46 | } 47 | -------------------------------------------------------------------------------- /packages/tag-selector/src/components/Group.less: -------------------------------------------------------------------------------- 1 | @import '../theme/token'; 2 | 3 | .container { 4 | display: inline-flex; 5 | align-items: center; 6 | justify-content: flex-end; 7 | width: 136px; 8 | text-align: right; 9 | .delete { 10 | color: @white-5; 11 | cursor: pointer; 12 | opacity: 0; 13 | transition: @animation-duration-base; 14 | &:active { 15 | color: @dark-2; 16 | transform: scale(0.9); 17 | } 18 | &:hover { 19 | color: @white-7; 20 | transform: scale(1.1); 21 | } 22 | } 23 | &:hover .delete { 24 | opacity: 1; 25 | } 26 | } 27 | 28 | .exist-key { 29 | .container; 30 | 31 | max-width: 112px; 32 | height: 28px; 33 | margin-left: 4px; 34 | background: none; 35 | &:hover, 36 | &:focus { 37 | background-color: @base-white; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/mindflow/README.md: -------------------------------------------------------------------------------- 1 | # @arvinxu/mindflow 2 | 3 | [![NPM version][version-image]][version-url] [![NPM downloads][download-image]][download-url] 4 | 5 | Mindflow 是基于 [溯因推理][reason] 与 [图尔敏推论模型][toulmin] 构建的推理组件。 6 | 7 | [reason]: https://zh.wikipedia.org/wiki/溯因推理 8 | [toulmin]: https://www.yuque.com/arvinxx/tu0agc/c8b5bad3-e002-4a02-81fc-c8ea0b41a21f#409fc6f3 9 | 10 | ## 文档 11 | 12 | [演示 demo](https://components.arvinx.com/components/biz/mindflow) 13 | 14 | ## License 15 | 16 | [MIT](../../LICENSE) ® Arvin Xu 17 | 18 | 19 | 20 | [version-image]: http://img.shields.io/npm/v/@arvinxu/mindflow.svg?color=deepgreen&label=latest 21 | [version-url]: http://npmjs.org/package/@arvinxu/mindflow 22 | [download-image]: https://img.shields.io/npm/dm/@arvinxu/mindflow.svg 23 | [download-url]: https://npmjs.org/package/@arvinxu/mindflow 24 | -------------------------------------------------------------------------------- /packages/preloader/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## @arvinxu/preloader [1.0.2](https://github.com/arvinxx/components/compare/@arvinxu/preloader@1.0.1...@arvinxu/preloader@1.0.2) (2021-03-20) 4 | 5 | 6 | ### 👷 构建系统 7 | 8 | * 修正构建配置问题 ([d232d17](https://github.com/arvinxx/components/commit/d232d17)) 9 | 10 | ## @arvinxu/preloader [1.0.1](https://github.com/arvinxx/components/compare/@arvinxu/preloader@1.0.0...@arvinxu/preloader@1.0.1) (2021-03-20) 11 | 12 | 13 | ### 👷 构建系统 14 | 15 | * 修改构建配置 ([e827348](https://github.com/arvinxx/components/commit/e827348)) 16 | 17 | # @arvinxu/preloader 1.0.0 (2021-03-20) 18 | 19 | 20 | ### 🎫 杂项 21 | 22 | * 初始化 Preloader 组件 ([fa12d88](https://github.com/arvinxx/components/commit/fa12d88)) 23 | 24 | 25 | ### 👷 构建系统 26 | 27 | * 修改构建配置 ([5d6552e](https://github.com/arvinxx/components/commit/5d6552e)) 28 | -------------------------------------------------------------------------------- /packages/page-loading/src/demos/Fullscreen.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { Button, Card } from 'antd'; 3 | 4 | import PageLoading from '@arvinxu/page-loading'; 5 | 6 | const FullScreenLoading = () => { 7 | const [fullscreen, setFullScreen] = useState(false); 8 | 9 | return ( 10 |
11 | {fullscreen ? ( 12 | 15 | ) : ( 16 | 17 | )} 18 | 19 |
20 | 21 | 内容卡片 22 | 23 |
24 |
25 | ); 26 | }; 27 | 28 | export default FullScreenLoading; 29 | -------------------------------------------------------------------------------- /packages/i18n/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@arvinxu/i18n", 3 | "version": "1.0.1", 4 | "files": [ 5 | "dist" 6 | ], 7 | "main": "dist/index.js", 8 | "module": "dist/index.js", 9 | "types": "dist/index.d.ts", 10 | "sideEffects": [ 11 | "*.less" 12 | ], 13 | "homepage": "https://github.com/arvinxx/components/tree/master/packages/i18n#readme", 14 | "repository": "git+https://github.com/arvinxx/components.git", 15 | "publishConfig": { 16 | "registry": "https://registry.npmjs.org", 17 | "access": "public" 18 | }, 19 | "dependencies": { 20 | "react-intl": "^5.20.4" 21 | }, 22 | "scripts": { 23 | "build": "father build", 24 | "test": "jest", 25 | "test:update": "jest -u", 26 | "prepublishOnly": "pnpm run build", 27 | "cov": "jest --coverage", 28 | "clean": "rm -rf dist coverage .umi" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/mindflow/src/types/graph.ts: -------------------------------------------------------------------------------- 1 | import type { MindflowEdge, MindflowNode } from './mindflow'; 2 | 3 | export interface GraphData { 4 | nodes: BaseNode[]; 5 | edges: BaseEdge[]; 6 | } 7 | 8 | export interface BaseNode { 9 | id: string; 10 | data?: BizData; 11 | } 12 | 13 | export interface EdgePort { 14 | cell: string; 15 | port: string; 16 | } 17 | 18 | export interface BaseEdge { 19 | source: T; 20 | target: T; 21 | data?: BizData; 22 | } 23 | 24 | export interface NodeData extends MindflowNode { 25 | collapsed?: boolean; 26 | leaf?: boolean; 27 | } 28 | 29 | export type PreMindflowData = GraphData; 30 | export type MindflowData = GraphData< 31 | MindflowNode, 32 | MindflowEdge, 33 | EdgePort | string 34 | >; 35 | -------------------------------------------------------------------------------- /packages/user-panel/src/login/index.test.tsx: -------------------------------------------------------------------------------- 1 | import '../../tests/matchMedia.mock'; 2 | 3 | import React from 'react'; 4 | import { render, fireEvent, act } from '@testing-library/react'; 5 | 6 | import Login from './index'; 7 | import '../locales'; 8 | import i18n from '../locales'; 9 | 10 | i18n.changeLanguage('zh-CN'); 11 | 12 | describe('Login 组件', () => { 13 | it('默认状态', () => { 14 | const { container } = render(); 15 | expect(container).toMatchSnapshot(); 16 | }); 17 | 18 | it('获取验证码', async () => { 19 | const { 20 | // container, 21 | findByText, 22 | } = render(); 23 | const btn = await findByText('手机号登录'); 24 | 25 | await act(async () => { 26 | fireEvent.click(btn); 27 | const captcha = await findByText('获取验证码'); 28 | fireEvent.click(captcha); 29 | }); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /packages/asset-gallery/src/components/ActionButton.tsx: -------------------------------------------------------------------------------- 1 | import type { FC } from 'react'; 2 | import React from 'react'; 3 | import type { ButtonProps } from 'antd'; 4 | import { Button, Tooltip } from 'antd'; 5 | 6 | export interface ActionButtonProps { 7 | onClick: ButtonProps['onClick']; 8 | tooltip?: string; 9 | content?: string; 10 | icon?: string; 11 | } 12 | 13 | const ActionButton: FC = ({ 14 | icon, 15 | onClick, 16 | tooltip, 17 | content, 18 | }) => { 19 | return ( 20 | 21 | 29 | 30 | ); 31 | }; 32 | 33 | export default ActionButton; 34 | -------------------------------------------------------------------------------- /packages/page-loading/src/demos/LoadingState.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { Button, Card } from 'antd'; 3 | 4 | import PageLoading from '@arvinxu/page-loading'; 5 | 6 | const { Group } = Button; 7 | const Loading = () => { 8 | const [loading, setLoading] = useState(false); 9 | 10 | return ( 11 |
12 | 13 | 14 | 15 | 16 | 17 | 状态: {loading ? '加载中' : '加载完成'} 18 | 19 |
20 | 21 | 内容卡片 22 | 23 |
24 |
25 | ); 26 | }; 27 | 28 | export default Loading; 29 | -------------------------------------------------------------------------------- /packages/macos-traffic-light/src/useTrafficLight.ts: -------------------------------------------------------------------------------- 1 | import { useEffect, useState } from 'react'; 2 | 3 | export const useTrafficLight = () => { 4 | const [hover, handleHover] = useState(false); 5 | 6 | const [isFocus, setIsFocus] = useState(true); 7 | 8 | const focus = () => { 9 | setIsFocus(true); 10 | }; 11 | const blur = () => { 12 | setIsFocus(false); 13 | }; 14 | 15 | const hoverOn = () => { 16 | handleHover(true); 17 | }; 18 | const hoverOff = () => { 19 | handleHover(false); 20 | }; 21 | 22 | useEffect(() => { 23 | window.addEventListener('focus', focus); 24 | window.addEventListener('blur', blur); 25 | 26 | return () => { 27 | window.removeEventListener('focus', focus); 28 | window.removeEventListener('blur', blur); 29 | }; 30 | }, []); 31 | 32 | return { hover, isFocus, hoverOn, hoverOff }; 33 | }; 34 | -------------------------------------------------------------------------------- /packages/mindflow/src/components/MindNode/useFolded.ts: -------------------------------------------------------------------------------- 1 | import { useEffect } from 'react'; 2 | import { useMindflowService } from '../../store/useMindflowContext'; 3 | import type { ReactShape } from '@antv/x6-react-shape'; 4 | import type { NodeData } from '../../types'; 5 | 6 | export const useFolded = (node: ReactShape) => { 7 | const { isNodeUnfolded, toggleNodeUnfold } = useMindflowService(); 8 | const unfolded = isNodeUnfolded(node.id); 9 | const data = node.getData(); 10 | const { description, references = [] } = data; 11 | 12 | const cantFold = !description && references.length === 0; 13 | 14 | useEffect(() => { 15 | // 展开的节点在前面显示 16 | 17 | if (unfolded) { 18 | node.setZIndex(100); 19 | } else { 20 | node.removeZIndex(); 21 | } 22 | }, [unfolded, node]); 23 | 24 | return { unfolded, cantFold, toggleNodeUnfold }; 25 | }; 26 | -------------------------------------------------------------------------------- /packages/journey-map/src/utils/yml.ts: -------------------------------------------------------------------------------- 1 | import { load } from 'js-yaml'; 2 | import type { YMLJourneyMapRawData, YMLJourneyMapData } from '../types'; 3 | 4 | /** 5 | * YML 转 JSON 6 | * @param yml 7 | * @constructor 8 | */ 9 | export const YMLToJSON = (yml: string): YMLJourneyMapData => { 10 | try { 11 | const json = load(yml) as YMLJourneyMapRawData; 12 | 13 | const { stages, title, config } = json; 14 | 15 | const validAction = {}; 16 | 17 | stages.forEach((stage) => { 18 | validAction[stage.name] = stage.actions; 19 | }); 20 | 21 | return { 22 | stages: stages.map((stage) => { 23 | const { actions, ...res } = stage; 24 | return { id: stage.name, ...res }; 25 | }), 26 | actions: validAction, 27 | title, 28 | config, 29 | }; 30 | } catch (e) { 31 | throw Error(`YML 不符合规范: \n${e}`); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /scripts/create-package/template/package.json.ejs: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@arvinxu/<%- pkg %>", 3 | "version": "1.0.0", 4 | "files": [ 5 | "dist" 6 | ], 7 | "main": "dist/index.js", 8 | "module": "dist/index.js", 9 | "types": "dist/index.d.ts", 10 | "sideEffects": [ 11 | "*.less" 12 | ], 13 | "homepage": "https://github.com/arvinxx/components/tree/master/packages/<%- pkg %>#readme", 14 | "repository": "git+https://github.com/arvinxx/components.git", 15 | "publishConfig": { 16 | "registry": "https://registry.npmjs.org", 17 | "access": "public" 18 | }, 19 | "scripts": { 20 | "build": "father build", 21 | "test": "jest", 22 | "test:update": "jest -u", 23 | "test:cov": "jest --coverage", 24 | "clean": "rm -rf es lib dist build coverage .umi", 25 | "prebuild": "pnpm run clean", 26 | "prepublishOnly": "pnpm run build" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/tag-selector/tests/__snapshots__/NewTag.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Tag render 1`] = ` 4 |
5 | 8 | 13 | 32 | 33 | 34 |
35 | `; 36 | -------------------------------------------------------------------------------- /typedoc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * typedoc 配置项 3 | * 快查地址: https://typedoc.org/guides/options/ 4 | */ 5 | module.exports = { 6 | name: 'template', 7 | // 以 modules 的形式输出文档 8 | out: 'apis', 9 | exclude: '**/*+(index|.spec|.e2e).ts', 10 | excludePrivate: true, 11 | excludeProtected: true, 12 | excludeExternals: true, 13 | excludeNotExported: true, 14 | /** 15 | * 如果注释里包含 @category 16 | * 设为 false 则按照 category 分组显示 17 | * 否则按照 class interface 等默认分组显示 18 | */ 19 | categorizeByGroup: false, 20 | categoryOrder: ['节点', '样式', '对象', '抽象对象'], 21 | includeDeclarations: true, 22 | includeVersion: true, 23 | /** 24 | * 不显示源码来源 25 | * 作为文档查阅的过程中这个信息比较干扰 26 | */ 27 | disableSources: true, 28 | readme: './README.md', 29 | // 标记有 @internal 的代码将不会输出 30 | stripInternal: true, 31 | // 用于将 monorepo 的 路径 映射为 modules 名称 32 | 'external-modulemap': 'packages/(.*)/src', 33 | }; 34 | -------------------------------------------------------------------------------- /packages/asset-gallery/src/utils/yml.ts: -------------------------------------------------------------------------------- 1 | import { load } from 'js-yaml'; 2 | import type { AssetGalleryData, AssetGalleryYML, Asset } from '../types'; 3 | 4 | /** 5 | * YML 转 JSON 6 | * @param yml 7 | * @constructor 8 | */ 9 | export const YMLToJSON = (yml: string): AssetGalleryData => { 10 | try { 11 | const data = load(yml) as AssetGalleryYML; 12 | 13 | return { 14 | data: data.map( 15 | (item): Asset => ({ 16 | title: item.标题 || item.title, 17 | description: item.描述 || item.description, 18 | dark: item.反色 || item.dark, 19 | padding: item.padding, 20 | url: item.链接 || item.url, 21 | darkBackground: item.反色背景色 || item.darkBackground, 22 | sketch: item.sketch, 23 | }), 24 | ), 25 | }; 26 | } catch (e) { 27 | /* istanbul ignore next */ 28 | throw Error(`YML 不符合规范: \n${e}`); 29 | } 30 | }; 31 | -------------------------------------------------------------------------------- /packages/heatmap-calendar/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@arvinxu/heatmap-calendar", 3 | "version": "1.0.1", 4 | "files": [ 5 | "dist" 6 | ], 7 | "main": "dist/index.js", 8 | "module": "dist/index.js", 9 | "types": "dist/index.d.ts", 10 | "sideEffects": [ 11 | "*.less" 12 | ], 13 | "homepage": "https://github.com/arvinxx/components/tree/master/packages/heatmap-calendar#readme", 14 | "repository": "git+https://github.com/arvinxx/components.git", 15 | "publishConfig": { 16 | "registry": "https://registry.npmjs.org", 17 | "access": "public" 18 | }, 19 | "scripts": { 20 | "build": "father build", 21 | "test": "jest", 22 | "test:update": "jest -u", 23 | "prepublishOnly": "pnpm run build", 24 | "cov": "jest --coverage", 25 | "clean": "rm -rf dist build coverage .umi" 26 | }, 27 | "dependencies": { 28 | "@ant-design/charts": "^1.1.3" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/preloader/src/preloader.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Preloader 3 | order: 1 4 | group: 信息展示 5 | apiHeader: 6 | pkg: '@arvinxu/preloader' 7 | defaultImport: true 8 | docUrl: https://github.com/arvinxx/components/blob/master/packages/preloader/src/preloader.md 9 | sourceUrl: https://github.com/arvinxx/components/blob/master/packages/preloader/src/index.ts 10 | --- 11 | 12 | # Preloader 13 | 14 | [![NPM version][version-image]][version-url] [![NPM downloads][download-image]][download-url] 15 | 16 | 17 | 18 | [version-image]: http://img.shields.io/npm/v/@arvinxu/preloader.svg?color=deepgreen&label=latest 19 | [version-url]: http://npmjs.org/package/@arvinxu/preloader 20 | [download-image]: https://img.shields.io/npm/dm/@arvinxu/preloader.svg 21 | [download-url]: https://npmjs.org/package/@arvinxu/preloader 22 | 23 | ## 图形一览 24 | 25 | ### Square 26 | 27 | 28 | -------------------------------------------------------------------------------- /packages/user-panel/src/components/Footer/index.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import { Footer } from './index'; 5 | import '../../locales'; 6 | 7 | describe('Footer 组件', () => { 8 | it('登录页脚', () => { 9 | const { container } = render(
); 10 | expect(container).toMatchSnapshot(); 11 | }); 12 | it('微信登陆页面', () => { 13 | const { container } = render(
{}} />); 14 | expect(container).toMatchSnapshot(); 15 | }); 16 | it('忘记密码', () => { 17 | const { container } = render(
); 18 | expect(container).toMatchSnapshot(); 19 | }); 20 | it('空', () => { 21 | const { container } = render( 22 | // @ts-ignore 23 |
, 24 | ); 25 | expect(container).toMatchSnapshot(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /packages/macos-traffic-light/src/MaximizeIcon.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import type { FC } from 'react'; 3 | import './icon.less'; 4 | 5 | const MaximizeIcon: FC = () => { 6 | return ( 7 | 16 | 21 | 22 | ); 23 | }; 24 | 25 | export default MaximizeIcon; 26 | -------------------------------------------------------------------------------- /packages/mindflow/src/definition/graphOpts.ts: -------------------------------------------------------------------------------- 1 | import type { Options } from '@antv/x6/lib/graph/options'; 2 | import { minimapOpts } from './minimapOpts'; 3 | import { port } from './port'; 4 | import './edge'; 5 | import { edgeLabel } from './label'; 6 | 7 | /** 8 | * 生成图的配置项 9 | * @param container 10 | * @param minimapCtn 11 | */ 12 | export const graphOpts = (container, minimapCtn): Partial => ({ 13 | container, 14 | background: { 15 | color: '#fafafa', 16 | }, 17 | grid: 1, 18 | interacting: { 19 | // nodeMovable: false, 20 | edgeLabelMovable: false, 21 | edgeMovable: false, 22 | }, 23 | autoResize: true, 24 | mousewheel: true, 25 | scroller: { 26 | enabled: true, 27 | pannable: true, 28 | autoResize: true, 29 | }, 30 | minimap: minimapOpts(minimapCtn), 31 | // @ts-ignore 32 | onPortRendered: port, 33 | onEdgeLabelRendered: edgeLabel, 34 | }); 35 | -------------------------------------------------------------------------------- /packages/sortable-list/src/components/Action/index.tsx: -------------------------------------------------------------------------------- 1 | import type { CSSProperties, FC } from 'react'; 2 | import React from 'react'; 3 | import { useStyles } from './style'; 4 | 5 | export interface ActionProps extends React.HTMLAttributes { 6 | active?: { 7 | fill: string; 8 | background: string; 9 | }; 10 | cursor?: CSSProperties['cursor']; 11 | } 12 | 13 | export const Action: FC = ({ active, className, cursor, style, ...props }) => { 14 | const { styles, cx } = useStyles(); 15 | return ( 16 | 37 | ); 38 | }; 39 | 40 | export default WechatLogin; 41 | -------------------------------------------------------------------------------- /packages/page-loading/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@arvinxu/page-loading", 3 | "version": "1.3.4", 4 | "files": [ 5 | "dist" 6 | ], 7 | "main": "dist/index.js", 8 | "module": "dist/index.js", 9 | "types": "dist/index.d.ts", 10 | "sideEffects": [ 11 | "*.less" 12 | ], 13 | "homepage": "https://github.com/arvinxx/components/tree/master/packages/page-loading#readme", 14 | "repository": "git+https://github.com/arvinxx/components.git", 15 | "publishConfig": { 16 | "registry": "https://registry.npmjs.org", 17 | "access": "public" 18 | }, 19 | "license": "MIT", 20 | "dependencies": { 21 | "multi-nprogress": "^0.3.5", 22 | "classnames": "^2.2.6", 23 | "insert-css": "^2.0.0", 24 | "@arvinxu/preloader": "1.0.2" 25 | }, 26 | "devDependencies": { 27 | "@types/nprogress": "^0.2.0", 28 | "@types/insert-css": "^2.0.0" 29 | }, 30 | "scripts": { 31 | "build": "father build", 32 | "test": "jest", 33 | "test:update": "jest -u", 34 | "prepublishOnly": "pnpm run build", 35 | "cov": "jest --coverage", 36 | "clean": "rm -rf dist coverage .umi" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /packages/mindflow/src/components/Port/__snapshots__/OutPort.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`OutPort 默认 1`] = ` 4 |
5 |
8 |
13 |
17 | 22 | 35 | 36 |
37 |
38 |
39 |
40 | `; 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Arvin Xu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/tag-selector/src/style.less: -------------------------------------------------------------------------------- 1 | @import './theme/token'; 2 | 3 | .avx-tag-selector { 4 | &-container { 5 | padding: @padding-lg @padding-md @padding-md @padding-md; 6 | :global { 7 | .ant-input { 8 | border-color: transparent; 9 | box-shadow: none; 10 | &:hover { 11 | border: solid 1px @white-5; 12 | box-shadow: none; 13 | } 14 | &:focus { 15 | color: @text-color; 16 | border: solid 1px @white-7; 17 | box-shadow: none; 18 | } 19 | } 20 | } 21 | } 22 | 23 | &-key-container { 24 | display: flex; 25 | align-items: center; 26 | min-height: 32px; 27 | &:not(:last-child) { 28 | margin-bottom: @padding-md; 29 | } 30 | } 31 | 32 | &-value-container { 33 | display: inline-flex; 34 | //max-width: 480px; 35 | flex-wrap: wrap; 36 | margin-left: @padding-md; 37 | } 38 | 39 | &-add-key { 40 | display: inline-flex; 41 | justify-content: flex-end; 42 | width: 136px; 43 | padding-right: 11px; 44 | text-align: right; 45 | background: none; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /packages/user-panel/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@arvinxu/user-panel", 3 | "version": "1.0.3", 4 | "files": [ 5 | "dist" 6 | ], 7 | "main": "dist/index.js", 8 | "module": "dist/index.js", 9 | "types": "dist/index.d.ts", 10 | "sideEffects": [ 11 | "*.less" 12 | ], 13 | "homepage": "https://github.com/arvinxx/components/tree/master/packages/user-panel#readme", 14 | "repository": "git+https://github.com/arvinxx/components.git", 15 | "publishConfig": { 16 | "registry": "https://registry.npmjs.org", 17 | "access": "public" 18 | }, 19 | "scripts": { 20 | "build": "father build", 21 | "test": "jest", 22 | "test:update": "jest -u", 23 | "cov": "jest --coverage", 24 | "prepublishOnly": "pnpm run build", 25 | "clean": "rm -rf dist build coverage .umi" 26 | }, 27 | "dependencies": { 28 | "@ant-design/icons": "^4.x", 29 | "@ant-design/pro-form": "^1.x", 30 | "antd": "^4.x", 31 | "classnames": "^2.3.1", 32 | "i18next": "^21.6.14", 33 | "i18next-browser-languagedetector": "^6.1.3", 34 | "react-i18next": "^11.16.1", 35 | "react-router": "^5.2.1" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /packages/journey-map/src/PainPoints/index.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import PainPoints from './index'; 5 | import { JourneyMapStore, useJourneyMap } from '../useJourneyMap'; 6 | 7 | import type { FC } from 'react'; 8 | import type { UserAction } from '../types'; 9 | 10 | const Demo: FC<{ actions: Record }> = ({ actions }) => { 11 | const value = useJourneyMap({ 12 | data: { 13 | actions, 14 | stages: [ 15 | { id: '1', name: '1' }, 16 | { id: '2', name: '2', color: 'blue' }, 17 | ], 18 | }, 19 | }); 20 | return ( 21 | 22 | 23 | 24 | ); 25 | }; 26 | 27 | describe('Actions', () => { 28 | it('默认状态', () => { 29 | const { container } = render( 30 | , 36 | ); 37 | expect(container).toMatchSnapshot(); 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /packages/mindflow/src/mindflow.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Mindflow 思流 3 | order: 1 4 | group: 5 | path: / 6 | nav: 7 | path: /biz-components 8 | --- 9 | 10 | # Mindflow 思流 11 | 12 | [![NPM version][version-image]][version-url] [![NPM downloads][download-image]][download-url] 13 | 14 | [version-image]: http://img.shields.io/npm/v/@arvinxu/mindflow.svg?color=deepgreen&label=latest 15 | [version-url]: http://npmjs.org/package/@arvinxu/mindflow 16 | [download-image]: https://img.shields.io/npm/dm/@arvinxu/mindflow.svg 17 | [download-url]: https://github.com/arvinxx/components/tree/master/packages/mindflow 18 | 19 | Mindflow 是基于 [溯因推理][reason] 与 [图尔敏推论模型][toulmin] 构建的推理组件。 20 | 21 | [reason]: https://zh.wikipedia.org/wiki/溯因推理 22 | [toulmin]: https://www.yuque.com/arvinxx/tu0agc/c8b5bad3-e002-4a02-81fc-c8ea0b41a21f#409fc6f3 23 | 24 | ## 功能特性 25 | 26 | - [x] 自由画布 27 | - [x] 折叠节点 28 | - [x] 证据可视化 29 | - [ ] 节点下钻 30 | - [ ] 节点筛选 31 | 32 | ## 演示 33 | 34 | ### 基本 Demo 35 | 36 | 37 | 38 | ### 博物馆案例 39 | 40 | 41 | 42 | ### 思维结构 43 | 44 | 45 | -------------------------------------------------------------------------------- /packages/asset-gallery/src/components/Header.test.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { render, act } from '@testing-library/react'; 3 | 4 | import Header from './Header'; 5 | import { LayoutType } from '../types'; 6 | 7 | describe('Header', () => { 8 | it('默认', () => { 9 | const { container } = render(
); 10 | expect(container).toMatchSnapshot(); 11 | }); 12 | it('有 logo', () => { 13 | const { container } = render(
); 14 | expect(container).toMatchSnapshot(); 15 | }); 16 | it('切换布局', async () => { 17 | const App = () => { 18 | const [layout, setLayout] = useState('grid'); 19 | return ( 20 |
26 | ); 27 | }; 28 | act(() => {}); 29 | const { findByTestId } = render(); 30 | const masonryBtn = await findByTestId('masonry-icon'); 31 | const gridBtn = await findByTestId('grid-icon'); 32 | 33 | masonryBtn.click(); 34 | gridBtn.click(); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /packages/heatmap-calendar/src/heatmap-calendar.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: HeatmapCalendar 活跃日历 3 | group: 4 | path: / 5 | nav: 6 | path: /biz-components 7 | --- 8 | 9 | # HeatmapCalendar 活跃日历 10 | 11 | [![NPM version][version-image]][version-url] [![NPM downloads][download-image]][download-url] 12 | 13 | [version-image]: http://img.shields.io/npm/v/@arvinxu/heatmap-calendar.svg?color=deepgreen&label=latest 14 | [version-url]: http://npmjs.org/package/@arvinxu/heatmap-calendar 15 | [download-image]: https://img.shields.io/npm/dm/@arvinxu/heatmap-calendar.svg 16 | [download-url]: https://github.com/arvinxx/components/tree/master/packages/heatmap-calendar 17 | 18 | 活跃日历 19 | 20 | ## 数据需求 21 | 22 | 每一项需要传入的数据如下: 23 | 24 | ```typescript 25 | interface Item { 26 | total: number; // 数量 27 | 28 | date: string; // 日期 29 | day: number; // 天数 30 | month: number; // 月份 31 | week: number; // 周 32 | year: number; // 年 33 | } 34 | ``` 35 | 36 | 示例: 37 | 38 | ```json 39 | { 40 | "date": "2020-03-31", 41 | "day": 2, 42 | "month": 3, 43 | "total": 0, 44 | "week": 14, 45 | "year": 2020 46 | } 47 | ``` 48 | 49 | ## 演示 50 | 51 | 52 | -------------------------------------------------------------------------------- /packages/journey-map/src/PainPoints/__snapshots__/index.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Actions 默认状态 1`] = ` 4 |
5 |
8 |
11 |
14 | 痛点 15 |
16 |
17 |
20 |
24 |
    25 |
  • 26 | 1 27 |
  • 28 |
  • 29 | 2 30 |
  • 31 |
32 |
33 |
37 |
    38 |
  • 39 | 2-1 40 |
  • 41 |
  • 42 | 2-2 43 |
  • 44 |
45 |
46 |
47 |
48 |
49 | `; 50 | -------------------------------------------------------------------------------- /packages/sortable-list/demos/CustomStyle.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * iframe: true 3 | */ 4 | import SortableList from '@arvinxu/sortable-list'; 5 | import { useState } from 'react'; 6 | 7 | const Demo = () => { 8 | const [list, setList] = useState([ 9 | { id: '关关雎鸠' }, 10 | { id: '在河之洲' }, 11 | { id: '窈窕淑女' }, 12 | { id: '君子好逑' }, 13 | ]); 14 | 15 | return ( 16 | { 24 | // overlay 使用默认样式 25 | if (isDragOverlay) return; 26 | 27 | return { 28 | padding: 24, 29 | // 拖拽项修改背景色 30 | background: isDragging ? 'rgb(74,135,82)' : 'pink', 31 | color: isDragging ? 'rgb(139,212,148)' : 'rgb(135,74,74)', 32 | // 在 拖拽过程中放大所有item的圆角 33 | borderRadius: isSorting ? 100 : 16, 34 | boxShadow: 'none', 35 | }; 36 | }} 37 | /> 38 | ); 39 | }; 40 | 41 | export default Demo; 42 | -------------------------------------------------------------------------------- /packages/tag-selector/tests/__snapshots__/EditableTags.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`EditableTags 正常渲染 1`] = ` 4 |
5 |
8 |
9 | 12 | test 13 | 14 | 20 | 33 | 34 |
35 |
36 |
37 | `; 38 | -------------------------------------------------------------------------------- /packages/journey-map/src/Chart/index.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import Chart from './index'; 5 | import { JourneyMapStore, useJourneyMap } from '../useJourneyMap'; 6 | 7 | import type { FC } from 'react'; 8 | import type { JourneyMapData } from '../types'; 9 | 10 | const Demo: FC<{ data: JourneyMapData }> = ({ data }) => { 11 | const value = useJourneyMap({ 12 | data, 13 | }); 14 | return ( 15 | 16 | 17 | 18 | ); 19 | }; 20 | 21 | describe('Chart', () => { 22 | it('默认状态', async () => { 23 | const { container } = render( 24 | , 37 | ); 38 | expect(container).toMatchSnapshot(); 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /packages/mindflow/src/hooks/useGraph.ts: -------------------------------------------------------------------------------- 1 | import { useEffect, useRef } from 'react'; 2 | import { Graph } from '@antv/x6'; 3 | 4 | import { graphOpts } from '../definition/graphOpts'; 5 | import { layout, preprocessData } from '../utils'; 6 | import { useGraphRegister } from './useRegister'; 7 | import { useMindflowService } from '../store/useMindflowContext'; 8 | 9 | export const useGraph = (data) => { 10 | const container = useRef(); 11 | const minimapContainer = useRef(); 12 | 13 | const { collapseList, setGraph, graph } = useMindflowService(); 14 | 15 | useGraphRegister(); 16 | 17 | useEffect(() => { 18 | if (!container.current) return; 19 | 20 | if (!graph) { 21 | // 初始化画布 22 | setGraph( 23 | new Graph(graphOpts(container.current, minimapContainer.current)), 24 | ); 25 | } 26 | return () => { 27 | setGraph(null); 28 | }; 29 | }, [container]); 30 | 31 | // 更新数据 32 | useEffect(() => { 33 | if (!graph) return; 34 | 35 | graph.fromJSON(preprocessData(data, collapseList)); 36 | layout('LR', graph); 37 | }, [graph, data, collapseList]); 38 | 39 | return { 40 | container, 41 | minimapContainer, 42 | }; 43 | }; 44 | -------------------------------------------------------------------------------- /packages/sortable-list/src/components/Action/style.ts: -------------------------------------------------------------------------------- 1 | import { createStyles } from 'antd-style'; 2 | 3 | export const useStyles = createStyles(({ token, css }) => ({ 4 | action: css` 5 | display: flex; 6 | flex: 0 0 auto; 7 | align-items: center; 8 | justify-content: center; 9 | width: 12px; 10 | padding: 15px; 11 | background-color: transparent; 12 | border: none; 13 | border-radius: 5px; 14 | outline: none; 15 | cursor: var(--cursor, pointer); 16 | appearance: none; 17 | touch-action: none; 18 | -webkit-tap-highlight-color: transparent; 19 | 20 | @media (hover: hover) { 21 | &:hover { 22 | background-color: var(--action-background, rgba(0, 0, 0, 0.05)); 23 | 24 | svg { 25 | fill: #6f7b88; 26 | } 27 | } 28 | } 29 | 30 | svg { 31 | flex: 0 0 auto; 32 | height: 100%; 33 | margin: auto; 34 | overflow: visible; 35 | fill: ${token.colorTextTertiary}; 36 | } 37 | 38 | &:active { 39 | background-color: var(--background, ${token.colorFillTertiary}); 40 | 41 | svg { 42 | fill: var(--fill, ${token.colorTextSecondary}); 43 | } 44 | } 45 | `, 46 | })); 47 | -------------------------------------------------------------------------------- /.dumirc.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'dumi'; 2 | import path from 'path'; 3 | 4 | const basicComponents = [ 5 | 'preloader', 6 | 'layout-kit', 7 | 'macos-traffic-light', 8 | 'page-loading', 9 | 'sortable-list', 10 | 'color-picker', 11 | ]; 12 | 13 | const bizComponents = [ 14 | 'asset-gallery', 15 | 'journey-map', 16 | 'heatmap-calendar', 17 | 'mindflow', 18 | 'user-panel', 19 | ]; 20 | 21 | const alias = Object.fromEntries( 22 | [...basicComponents, ...bizComponents].map((name) => [ 23 | `@arvinxu/${name}`, 24 | path.join(__dirname, `./packages/${name}/src`), 25 | ]), 26 | ); 27 | 28 | export default defineConfig({ 29 | themeConfig: { 30 | name: '空谷的组件库', 31 | logo: 'https://gw.alipayobjects.com/zos/antfincdn/mj85r7V5aX/konggu.svg', 32 | github: 'https://github.com/arvinxx/components', 33 | }, 34 | resolve: { 35 | atomDirs: [ 36 | ...basicComponents.map((c) => ({ 37 | type: 'component', 38 | dir: `packages/${c}/src`, 39 | })), 40 | ...bizComponents.map((c) => ({ 41 | type: 'biz-component', 42 | dir: `packages/${c}/src`, 43 | })), 44 | ], 45 | }, 46 | 47 | alias, 48 | 49 | monorepoRedirect: {}, 50 | }); 51 | -------------------------------------------------------------------------------- /packages/user-panel/src/locales/zh-CN/login.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'login.header': '立即登录', 3 | 'login.accountLogin.tab': '账户密码登录', 4 | 'login.phoneLogin.tab': '手机号登录', 5 | 'login.accountLogin.errorMessage': '错误的用户名和密码', 6 | 'login.username.placeholder': '用户名', 7 | 'login.username.required': '用户名是必填项!', 8 | 'login.password.placeholder': '密码', 9 | 'login.password.required': '密码是必填项!', 10 | 'login.phoneLogin.errorMessage': '验证码错误', 11 | 'login.phoneNumber.placeholder': '请输入手机号', 12 | 'login.phoneNumber.required': '手机号是必填项!', 13 | 'login.phoneNumber.invalid': '不合法的手机号!', 14 | 'login.captcha.placeholder': '请输入验证码', 15 | 'login.captcha.required': '验证码是必填项!', 16 | 'login.captcha.function.required': '获取验证码方法未实现,请检查代码!', 17 | 'login.captcha.fetch.success': '获取验证码成功!', 18 | 'login.phoneLogin.getVerificationCode': '获取验证码', 19 | 'pages.getCaptchaSecondText': '秒后重新获取', 20 | 'login.rememberMe': '自动登录', 21 | 'login.forgotPassword': '忘记密码 ?', 22 | 'login.submit': '登录', 23 | 'login.or': '或', 24 | 'login.registerAccount': '注册账户', 25 | 'login.wechat-login.btn': '微信登录', 26 | 'login.wechat-login.function.error': '微信登录方法未实现,请检查代码!', 27 | 'login.no-account': '没有账号?', 28 | 'login.signup': '创建账户', 29 | }; 30 | -------------------------------------------------------------------------------- /packages/sortable-list/src/components/Remove/Remove.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import type { ActionProps } from '../Action'; 4 | import { Action } from '../Action'; 5 | 6 | export function Remove(props: ActionProps) { 7 | return ( 8 | 15 | 16 | 17 | 18 | 19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /packages/i18n/src/index.tsx: -------------------------------------------------------------------------------- 1 | import type { FC } from 'react'; 2 | import React from 'react'; 3 | import { useIntl } from 'react-intl'; 4 | 5 | import { Intl } from './IntlProvider'; 6 | import { useLocaleMessages } from './useLocaleMessages'; 7 | import { useStoredLocale } from './useStoredLocale'; 8 | 9 | import type { LocaleMessageMaps, PrimitiveType } from './types'; 10 | 11 | /** 12 | * 13 | */ 14 | const createI18n = >( 15 | messageObj: LocaleMessageMaps, 16 | ) => { 17 | const IntlProvider: FC = ({ children }) => { 18 | const { locale, messages } = useLocaleMessages(messageObj); 19 | return ( 20 | 21 | {children} 22 | 23 | ); 24 | }; 25 | 26 | const useFormatMessage = (): (( 27 | id: keyof T, 28 | values?: Record, 29 | ) => string) => { 30 | const intl = useIntl(); 31 | 32 | // @ts-ignore 33 | return (id, values) => intl.formatMessage({ id }, values); 34 | }; 35 | 36 | return { useFormatMessage, IntlProvider, useStoredLocale }; 37 | }; 38 | 39 | export type { LocaleMessageMaps } from './types'; 40 | 41 | export default createI18n; 42 | -------------------------------------------------------------------------------- /packages/user-panel/src/layout/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import type { FC, CSSProperties } from 'react'; 3 | import cls from 'classnames'; 4 | 5 | import type { FooterProps, HeaderProps } from '../components'; 6 | import { Header, Footer } from '../components'; 7 | import '../locales'; 8 | 9 | import './style.less'; 10 | 11 | export interface LayoutProps extends FooterProps, HeaderProps { 12 | /** 13 | * 显示底部 14 | */ 15 | showFooter?: boolean; 16 | style?: CSSProperties; 17 | className?: string; 18 | } 19 | 20 | const Layout: FC = ({ 21 | logo, 22 | logoUrl, 23 | onWechatLoginClick, 24 | children, 25 | showFooter, 26 | type, 27 | onRegisterClick, 28 | style, 29 | className, 30 | }) => { 31 | return ( 32 |
33 |
34 | {children} 35 | {(onWechatLoginClick || onRegisterClick) && showFooter ? ( 36 |
41 | ) : null} 42 |
43 | ); 44 | }; 45 | 46 | export default Layout; 47 | -------------------------------------------------------------------------------- /packages/asset-gallery/src/components/AssetCard.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import AssetCard from './AssetCard'; 5 | 6 | describe('AssetCard', () => { 7 | it('图片 Png', () => { 8 | const { container } = render( 9 | , 15 | ); 16 | expect(container).toMatchSnapshot(); 17 | }); 18 | it('图片 Svg', () => { 19 | const { container } = render( 20 | , 24 | ); 25 | expect(container).toMatchSnapshot(); 26 | }); 27 | it('Sketch 测试', () => { 28 | const { container } = render( 29 | , 36 | ); 37 | expect(container).toMatchSnapshot(); 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /packages/macos-traffic-light/demos/DisableMax.tsx: -------------------------------------------------------------------------------- 1 | import { Col, Row } from 'antd'; 2 | import { FC } from 'react'; 3 | 4 | import TrafficLight from '@arvinxu/macos-traffic-light'; 5 | 6 | const DisableMaximize = () => { 7 | const Block: FC<{ title: string }> = ({ children, title }) => ( 8 | 9 | {title} 10 | {children} 11 | 12 | ); 13 | const props = { 14 | close: () => { 15 | alert('Pressed closed'); 16 | }, 17 | minimize: () => { 18 | alert('Pressed minimize'); 19 | }, 20 | maximize: () => { 21 | alert('Pressed maximize'); 22 | }, 23 | }; 24 | return ( 25 |
26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
39 | ); 40 | }; 41 | 42 | export default DisableMaximize; 43 | -------------------------------------------------------------------------------- /packages/macos-traffic-light/src/macos-traffic-light.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: macOS TrafficLight 3 | atomId: TrafficLight 4 | group: 基础 5 | apiHeader: 6 | pkg: '@arvinxu/macos-traffic-light' 7 | defaultImport: true 8 | docUrl: https://github.com/arvinxx/components/blob/master/packages/macos-traffic-light/src/macos-traffic-light.md 9 | sourceUrl: https://github.com/arvinxx/components/blob/master/packages/macos-traffic-light/src/index.tsx 10 | --- 11 | 12 | ## Traffic Light 13 | 14 | [![NPM version][version-image]][version-url] [![NPM downloads][download-image]][download-url] 15 | 16 | macOS 上的 Traffic Light 控制按钮 17 | 18 | ![](https://gw.alipayobjects.com/zos/antfincdn/o6BBRY4gaO/5d51620f-922e-4090-9546-8cc7d60b635b.png) 19 | 20 | 21 | 22 | [version-image]: http://img.shields.io/npm/v/@arvinxu/macos-traffic-light.svg?color=deepgreen&label=latest 23 | [version-url]: http://npmjs.org/package/@arvinxu/macos-traffic-light 24 | [download-image]: https://img.shields.io/npm/dm/@arvinxu/macos-traffic-light.svg 25 | [download-url]: https://npmjs.org/package/@arvinxu/macos-traffic-light 26 | 27 | ## 默认状态 28 | 29 | 包含三个红绿灯,点击有事件反馈 30 | 31 | 32 | 33 | ## 其他配置 34 | 35 | 36 | -------------------------------------------------------------------------------- /packages/user-panel/src/components/Header/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import type { FC } from 'react'; 3 | import { Typography } from 'antd'; 4 | 5 | import { useFormatMessage } from '../Intl'; 6 | import type { PanelContentType } from '../../types'; 7 | 8 | import './style.less'; 9 | 10 | const { Title } = Typography; 11 | 12 | export interface HeaderProps { 13 | /** 14 | * 内容类型 15 | */ 16 | type: PanelContentType; 17 | 18 | /** 19 | * logo 链接 20 | */ 21 | logo?: string; 22 | /** 23 | * 点击 logo 跳转的 URL 24 | */ 25 | logoUrl?: string; 26 | } 27 | 28 | export const Header: FC = ({ type, logo, logoUrl }) => { 29 | const f = useFormatMessage(); 30 | 31 | return ( 32 |
33 | {!logo ? null : ( 34 |
35 | 36 | {'logo'} 37 | 38 |
39 | )} 40 | 41 | 49 | {f(`${type}.header`)} 50 | 51 |
52 | ); 53 | }; 54 | -------------------------------------------------------------------------------- /packages/sortable-list/src/types/common.ts: -------------------------------------------------------------------------------- 1 | import type { 2 | DraggableSyntheticListeners, 3 | UniqueIdentifier, 4 | } from '@dnd-kit/core'; 5 | import type { CSSProperties, ReactElement, Ref } from 'react'; 6 | import type { SortableItem } from './store'; 7 | 8 | export type RenderItem = ( 9 | item: T, 10 | options: { 11 | dragOverlay: boolean; 12 | dragging: boolean; 13 | sorting: boolean; 14 | index: number | undefined; 15 | fadeIn: boolean; 16 | listeners: DraggableSyntheticListeners; 17 | ref: Ref; 18 | style: CSSProperties | undefined; 19 | transform: any; 20 | transition: any; 21 | onRemove: () => void; 22 | onAddItem: (index: number, newItem: T) => void; 23 | }, 24 | ) => ReactElement; 25 | 26 | interface GetWrapperStyleArgs { 27 | index: number; 28 | isDragging: boolean; 29 | id: UniqueIdentifier; 30 | } 31 | 32 | export type GetWrapperStyle = ({ 33 | index, 34 | isDragging, 35 | id, 36 | }: GetWrapperStyleArgs) => CSSProperties; 37 | 38 | interface GetItemStylesArgs extends GetWrapperStyleArgs { 39 | isSorting: boolean; 40 | overIndex: number; 41 | isDragOverlay: boolean; 42 | } 43 | 44 | export type GetItemStyles = (status: GetItemStylesArgs) => CSSProperties; 45 | -------------------------------------------------------------------------------- /packages/mindflow/src/components/EvidenceEdge/Reference.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import Reference from './Reference'; 5 | 6 | describe('Reference', () => { 7 | it('空档案', () => { 8 | const { container } = render( 9 | {}} />, 10 | ); 11 | expect(container).toMatchSnapshot(); 12 | }); 13 | it('列表', () => { 14 | const { container } = render( 15 | {}} 24 | />, 25 | ); 26 | expect(container).toMatchSnapshot(); 27 | }); 28 | 29 | it('点击关闭', async () => { 30 | const onClick = jest.fn(); 31 | const { findByText } = render( 32 | , 33 | ); 34 | const btn = await findByText('关 闭'); 35 | 36 | btn.click(); 37 | 38 | expect(onClick).toBeCalledTimes(1); 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /packages/user-panel/tests/index.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render, fireEvent, act } from '@testing-library/react'; 3 | 4 | import UserPanel from '@arvinxu/user-panel'; 5 | import i18n from '../src/locales'; 6 | 7 | i18n.changeLanguage('zh-CN'); 8 | 9 | describe('UserPanel', () => { 10 | it('登录面板', async () => { 11 | const { 12 | // container, 13 | findByText, 14 | } = render( 15 | { 17 | console.log(mobile); 18 | return new Promise((resolve) => { 19 | resolve(true); 20 | }); 21 | }} 22 | onLoginSubmit={() => { 23 | return new Promise((resolve) => { 24 | resolve({ 25 | type: 'account', 26 | status: 'ok', 27 | currentAuthority: 'user', 28 | }); 29 | }); 30 | }} 31 | />, 32 | ); 33 | const btn = await findByText('手机号登录'); 34 | 35 | await act(async () => { 36 | fireEvent.click(btn); 37 | const captcha = await findByText('获取验证码'); 38 | fireEvent.click(captcha); 39 | }); 40 | 41 | // setTimeout(() => { 42 | // expect(container).toMatchSnapshot(); 43 | // }, 1000); 44 | }); 45 | }); 46 | -------------------------------------------------------------------------------- /packages/page-loading/tests/index.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import PageLoading from '@arvinxu/page-loading'; 5 | 6 | describe('PageLoading', () => { 7 | it('默认状态', () => { 8 | const { container } = render(); 9 | expect(container).toMatchSnapshot(); 10 | }); 11 | it('不带加载条', () => { 12 | const { container } = render(); 13 | expect(container).toMatchSnapshot(); 14 | }); 15 | it('全屏', () => { 16 | const { container } = render(); 17 | expect(container).toMatchSnapshot(); 18 | }); 19 | describe('加载态', () => { 20 | it('加载完毕', () => { 21 | const { container } = render( 22 | 加载完毕, 23 | ); 24 | expect(container).toMatchSnapshot(); 25 | }); 26 | it('加载中', () => { 27 | const { container } = render( 28 | 加载完毕, 29 | ); 30 | expect(container).toMatchSnapshot(); 31 | }); 32 | }); 33 | 34 | it('自定义加载图形', () => { 35 | const { container } = render( 36 | loading...
} />, 37 | ); 38 | expect(container).toMatchSnapshot(); 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /packages/user-panel/src/UserLogin.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import type { FC } from 'react'; 3 | import type { LayoutProps } from './layout'; 4 | import type { LoginProps } from './login'; 5 | 6 | import Layout from './layout'; 7 | import Login from './login'; 8 | import type { IUserLogin } from './types'; 9 | 10 | export interface UserLoginProps 11 | extends Omit, 12 | Pick { 13 | /** 14 | * 登录方法 15 | */ 16 | onLoginSubmit?: IUserLogin.LoginSubmit; 17 | } 18 | 19 | export const UserLogin: FC = ({ 20 | onCaptchaClick, 21 | onLoginSubmit, 22 | logo, 23 | logoUrl, 24 | onWechatLoginClick, 25 | showFooter, 26 | onForgotClick, 27 | onRegisterClick, 28 | style, 29 | className, 30 | }) => { 31 | return ( 32 | 42 | 47 | 48 | ); 49 | }; 50 | -------------------------------------------------------------------------------- /packages/sortable-list/src/components/DraggingOverlay.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { DragOverlay } from '@dnd-kit/core'; 3 | import { Item } from './BaseItem'; 4 | import type { FC } from 'react'; 5 | 6 | import type { DraggingOverlayProps } from '../types'; 7 | 8 | const DraggingOverlay: FC = ({ 9 | dragging, 10 | dropAnimation, 11 | adjustScale, 12 | item, 13 | renderItem, 14 | handle, 15 | getItemStyles, 16 | getWrapperStyle, 17 | activeIndex, 18 | }) => { 19 | return ( 20 | 21 | {dragging ? ( 22 | 41 | ) : null} 42 | 43 | ); 44 | }; 45 | 46 | export default DraggingOverlay; 47 | -------------------------------------------------------------------------------- /packages/mindflow/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@arvinxu/mindflow", 3 | "version": "1.8.1", 4 | "main": "lib/index.js", 5 | "module": "es/index.js", 6 | "homepage": "https://github.com/arvinxx/components/tree/master/packages/mindflow#readme", 7 | "repository": "git+https://github.com/arvinxx/components.git", 8 | "publishConfig": { 9 | "registry": "https://registry.npmjs.org", 10 | "access": "public" 11 | }, 12 | "scripts": { 13 | "build": "father build", 14 | "test": "jest", 15 | "test:debug": "DEBUG_MODE=1 jest", 16 | "test:update": "jest -u", 17 | "prepublishOnly": "pnpm run build", 18 | "cov": "jest --coverage", 19 | "clean": "rm -rf es lib dist build coverage .umi" 20 | }, 21 | "dependencies": { 22 | "@antv/layout": "^0.2.0", 23 | "@antv/x6": "^1.13.1", 24 | "@antv/x6-react-shape": "^1.3.1", 25 | "antd": "^4.12.3", 26 | "chroma-js": "^2.1.1", 27 | "classnames": "^2.2.6", 28 | "dagre": "^0.8.5", 29 | "immer": "^9.0.1", 30 | "stook": "^1.0.0", 31 | "use-overflow": "^1.1.0" 32 | }, 33 | "peerDependencies": { 34 | "react": "^17.0.1", 35 | "react-dom": "^17.0.1" 36 | }, 37 | "devDependencies": { 38 | "@types/chroma-js": "^2.1.3", 39 | "@types/dagre": "^0.7.44", 40 | "stook-devtools": "^1.0.0" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /packages/mindflow/src/components/ErrorBoundary.tsx: -------------------------------------------------------------------------------- 1 | /* istanbul ignore file */ 2 | import React, { Fragment } from 'react'; 3 | 4 | class ErrorBoundary extends React.Component<{ errorTemplate?: any }> { 5 | static getDerivedStateFromError(error: Error) { 6 | return { hasError: true, error }; 7 | } 8 | 9 | static getDerivedStateFromProps(nextProps: any, state: any) { 10 | if (state.children !== nextProps.children) { 11 | return { 12 | children: nextProps.children, 13 | hasError: false, 14 | error: undefined, 15 | }; 16 | } 17 | return null; 18 | } 19 | 20 | state: { 21 | hasError: boolean; 22 | error?: Error; 23 | } = { 24 | hasError: false, 25 | }; 26 | 27 | renderError = (e: Error) => { 28 | const { errorTemplate } = this.props; 29 | switch (e) { 30 | default: 31 | // fallback 32 | return errorTemplate && typeof errorTemplate === 'function' ? ( 33 | errorTemplate(e) 34 | ) : ( 35 |
组件出错了,请核查后重试: {e.message}
36 | ); 37 | } 38 | }; 39 | 40 | render() { 41 | if (this.state.hasError) { 42 | return this.renderError(this.state.error!); 43 | } 44 | return {this.props.children}; 45 | } 46 | } 47 | 48 | export default ErrorBoundary; 49 | -------------------------------------------------------------------------------- /packages/sortable-list/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@arvinxu/sortable-list", 3 | "version": "2.0.0", 4 | "homepage": "https://github.com/arvinxx/components/tree/master/packages/sortable-list#readme", 5 | "repository": "git+https://github.com/arvinxx/components.git", 6 | "sideEffects": false, 7 | "main": "lib/index.js", 8 | "module": "es/index.js", 9 | "types": "es/index.d.ts", 10 | "files": [ 11 | "lib", 12 | "es" 13 | ], 14 | "scripts": { 15 | "build": "father build", 16 | "clean": "rm -rf dist build coverage .umi", 17 | "cov": "jest --coverage", 18 | "doctor": "father doctor", 19 | "prepublishOnly": "npm run doctor && npm run build", 20 | "test": "jest", 21 | "test:update": "jest -u" 22 | }, 23 | "dependencies": { 24 | "@babel/runtime": "^7", 25 | "@dnd-kit/core": "^5.0.1", 26 | "@dnd-kit/modifiers": "^5.0.0", 27 | "@dnd-kit/sortable": "^6.0.0", 28 | "immer": "^9", 29 | "lodash.isequal": "^4", 30 | "react-layout-kit": "^1", 31 | "zustand": "^4", 32 | "zustand-utils": "^1" 33 | }, 34 | "peerDependencies": { 35 | "antd": ">=5", 36 | "antd-style": ">=2", 37 | "react": ">=18", 38 | "react-dom": ">=18" 39 | }, 40 | "publishConfig": { 41 | "access": "public", 42 | "registry": "https://registry.npmjs.org" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /packages/journey-map/src/Chart/__snapshots__/index.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Chart 默认状态 1`] = ` 4 |
5 |
8 |
12 |
15 | 体验情绪 16 |
17 |
18 |
21 |
26 |
29 | 34 |
35 | 42 | 43 | 44 | 45 | 46 | `; 47 | -------------------------------------------------------------------------------- /packages/mindflow/src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import type { FC } from 'react'; 3 | 4 | import { useGraph } from './hooks/useGraph'; 5 | import ErrorBoundary from './components/ErrorBoundary'; 6 | import type { MindflowData } from './types'; 7 | 8 | import './style.less'; 9 | 10 | export { useMindflowService as useMindflowContext } from './store/useMindflowContext'; 11 | export * from './types'; 12 | 13 | export interface MindflowProps { 14 | /** 15 | * 待消费数据 16 | */ 17 | data: MindflowData; 18 | /** 19 | * 画布宽度 20 | */ 21 | width?: number | string; 22 | /** 23 | * 单个节点的宽度 24 | */ 25 | nodeWidth?: number; 26 | /** 27 | * 画布高度 28 | * @default 400 29 | */ 30 | height?: number; 31 | /** 32 | * 节点的点击回调 33 | */ 34 | onNodeClick?: (node) => void; 35 | } 36 | 37 | const Mindflow: FC = ({ data, width, height }) => { 38 | const { container, minimapContainer } = useGraph(data); 39 | 40 | return ( 41 | 42 |
43 |
47 |
48 |
49 | 50 | ); 51 | }; 52 | 53 | export default Mindflow; 54 | -------------------------------------------------------------------------------- /packages/user-panel/src/login/__snapshots__/LoginErrorMessage.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`LoginMessage 默认状态 1`] = ` 4 |
5 | 40 |
41 | `; 42 | -------------------------------------------------------------------------------- /packages/macos-traffic-light/src/CloseIcon.tsx: -------------------------------------------------------------------------------- 1 | import styled from '@emotion/styled'; 2 | import type { FC } from 'react'; 3 | 4 | const CloseIcon: FC<{ className?: string }> = ({ className }) => { 5 | return ( 6 | 15 | 20 | 21 | ); 22 | }; 23 | 24 | export default styled(CloseIcon)` 25 | position: absolute; 26 | top: 50%; 27 | left: 50%; 28 | transform: translate(-50%, -50%); 29 | 30 | color: rgba(0, 0, 0, 0.65); 31 | fill: rgba(0, 0, 0, 0.65); 32 | ` as any; 33 | -------------------------------------------------------------------------------- /packages/float-label-input/tests/index.spec.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { fireEvent, render } from '@testing-library/react'; 3 | 4 | import FloatLabelInput from '@arvinxu/float-label-input'; 5 | 6 | describe('FloatLabelInput', () => { 7 | it('正常渲染', () => { 8 | const { container } = render(); 9 | expect(container).toMatchSnapshot(); 10 | }); 11 | 12 | it('受控组件', () => { 13 | // const { container } = render(); 14 | }); 15 | 16 | it('focus 向上移动; blur 返回', () => { 17 | const { queryByTestId } = render(); 18 | 19 | const input = queryByTestId('input'); 20 | const label = queryByTestId('label'); 21 | 22 | expect(label.style.transform).toBe(''); 23 | fireEvent.focus(input); 24 | expect(label.style.transform).toBe('translateY(-28px)'); 25 | fireEvent.blur(input); 26 | expect(label.style.transform).toBe(''); 27 | }); 28 | 29 | it('可输入外部高度', () => { 30 | // const { queryByTestId } = render( 31 | // , 32 | // ); 33 | // const input = queryByTestId('input'); 34 | // fireEvent.focus(input); 35 | // const label = queryByTestId('label'); 36 | // debug(label); 37 | // expect(label.style.transform).toBe('translateY(-32px)'); 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /packages/mindflow/src/types/mindflow.ts: -------------------------------------------------------------------------------- 1 | export interface Reference { 2 | /** 3 | * 参考资料的 id 4 | */ 5 | id: string; 6 | /** 7 | * 参考资料标题 8 | */ 9 | title: string; 10 | /** 11 | * 相关参考资料的 Url 12 | */ 13 | url?: string; 14 | } 15 | 16 | /** 17 | * 节点类型 18 | */ 19 | export type NodeType = 20 | | 'question' // 问题 21 | | 'action' // 行动点 22 | | 'idea' // 想法 23 | | 'subject' // 主题 24 | | 'information' // 信息 25 | | string; 26 | 27 | export interface MindflowNode { 28 | /** 29 | * 节点标题 30 | */ 31 | title: string; 32 | /** 33 | * 节点的类型 34 | */ 35 | type?: NodeType; 36 | /** 37 | * 有关问题的详细描述 38 | */ 39 | description?: string; 40 | /** 41 | * 参考资料 42 | */ 43 | references?: Reference[]; 44 | /** 45 | * 信息的类型 46 | */ 47 | infoType?: 'url' | 'image' | 'text'; 48 | } 49 | 50 | /** 51 | * 作为支撑的类型 52 | */ 53 | type EdgeType = 54 | /** 55 | * 依据 56 | */ 57 | | 'ground' 58 | /** 59 | * 正当理由 60 | */ 61 | | 'warrant' 62 | /** 63 | * 支援 64 | */ 65 | | 'backing' 66 | /** 67 | * 反驳 68 | */ 69 | | 'rebuttal'; 70 | 71 | export interface EdgeReference extends Reference { 72 | /** 73 | * 理论依据的类型 74 | */ 75 | type?: EdgeType; 76 | } 77 | /** 78 | * Mindflow Edge 结构 79 | */ 80 | export interface MindflowEdge { 81 | /** 82 | * 依据资料 83 | */ 84 | references?: EdgeReference[]; 85 | } 86 | --------------------------------------------------------------------------------