diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index d6c9537..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,18 +0,0 @@ -module.exports = { - root: true, - env: { browser: true, es2020: true }, - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:react-hooks/recommended', - ], - ignorePatterns: ['dist', '.eslintrc.cjs'], - parser: '@typescript-eslint/parser', - plugins: ['react-refresh'], - rules: { - 'react-refresh/only-export-components': [ - 'warn', - { allowConstantExport: true }, - ], - }, -} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 663f144..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: Release with Changelog, Build Docs, Deploy to Github Pages, Publish to NPM -# concat workflows because it is not easy to run trigger multiple. https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow -permissions: - contents: write -on: - push: - tags: - - "v*" - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: "20.x" - registry-url: "https://registry.npmjs.org" - - - name: Install - run: npm install - - - name: Release with Changelog - run: npx changelogithub # or changelogithub@0.12 if ensure the stable result - continue-on-error: true # failed when only tag pushed - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - - - name: Build Demo - run: npm run build:web - - name: Build Docs - run: npm run docs:build - - - name: Extra Files - run: | - # Switch to the generated directory - cd docs/.vitepress/dist - - # cp demo to here - cp -r ../../../dist v1-demo-windowed - - # Set custom domain for GitHub Pages - echo "he-tree-react.phphe.com" > CNAME - - # Required to bypass Jekyll on GitHub Pages - echo "" > .nojekyll - - - name: Deploy - uses: JamesIves/github-pages-deploy-action@v4 - with: - single-commit: true - branch: gh-pages - clean: true - folder: docs/.vitepress/dist - - name: Remove Dist - run: rm -rf dist - - name: Build Library - run: npm run build - - run: rm -rf node_modules && npm ci - - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 535dd9f..0000000 --- a/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* -lerna-debug.log* - -node_modules -dist -dist-ssr -*.local - -# Editor directories and files -.vscode/* -!.vscode/extensions.json -.idea -.DS_Store -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw? - -# test -/coverage \ No newline at end of file diff --git a/LICENSE b/LICENSE index b490f51..337f71c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017 phphe +Copyright (c) 2020 Xinxin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 607c08e..9c00088 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,2 @@ -

react draggable tree, he-tree-react

- -# he-tree-react ![GitHub License](https://img.shields.io/github/license/phphe/he-tree-react) ![NPM Version](https://img.shields.io/npm/v/he-tree-react) ![NPM Type Definitions](https://img.shields.io/npm/types/he-tree-react) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/he-tree-react) - -React draggable sortable tree component. [Document](https://he-tree-react.phphe.com), [demo](https://he-tree-react.phphe.com/v1/examples). - -React 可拖拽树组件. [文档](https://he-tree-react.phphe.com/zh), [演示](https://he-tree-react.phphe.com/zh/v1/examples). - -## Features - -- Drag with a customizable placeholder. -- The height of the node is not fixed. -- Based on HTML Drag and Drop API. -- Both flat data and tree-shaped data supported. -- Drag from external. -- Open or expand. Open node when drag onto it. -- Checked, semi-checked. -- Big data, virtual list. -- Examples for update data. -- rtl, display from right to left. - -## Changelog - -https://github.com/phphe/he-tree-react/releases +# he-tree-react +A draggable sortable nested react tree component. diff --git a/docs/.gitignore b/docs/.gitignore deleted file mode 100644 index 5921e8c..0000000 --- a/docs/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.vitepress/dist -.vitepress/cache \ No newline at end of file diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts deleted file mode 100644 index 1300c27..0000000 --- a/docs/.vitepress/config.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { defineConfig } from "vitepress"; -import { version } from "../../package.json"; - -const GTAG_ID = "G-GVYKBNTKPG"; -const vVersion = `v${version}`; - -// https://vitepress.dev/reference/site-config -export default defineConfig({ - title: "He Tree React", - description: "A VitePress Site", - cleanUrls: true, - themeConfig: { - search: { - provider: "local", - }, - // https://vitepress.dev/reference/default-theme-config - // nav: [ - // { text: "Home", link: "/" }, - // { text: "Guide", link: "/v1/guide" }, - // { text: "API", link: "/v1/api" }, - // ], - - // sidebar: [ - // { - // text: "Examples", - // items: [ - // { text: "Markdown Examples", link: "/markdown-examples" }, - // { text: "Runtime API Examples", link: "/api-examples" }, - // ], - // }, - // ], - - socialLinks: [ - { icon: "github", link: "https://github.com/phphe/he-tree-react" }, - ], - }, - markdown: { - // lineNumbers: true, - }, - locales: { - root: { - label: "English", - lang: "en", - themeConfig: { - nav: [ - { text: "Home", link: "/" }, - { text: "Guide", link: "/v1/guide" }, - { text: "Examples", link: "/v1/examples" }, - { text: "API", link: "/v1/api" }, - { - text: vVersion, - items: [ - { - text: "Changelog", - link: "https://github.com/phphe/he-tree-react/releases", - }, - ], - }, - ], - }, - }, - zh: { - label: "中文", - lang: "zh", - themeConfig: { - nav: [ - { text: "首页", link: "/zh/" }, - { text: "使用", link: "/zh/v1/guide" }, - { text: "例子", link: "/zh/v1/examples" }, - { text: "API", link: "/zh/v1/api" }, - { - text: vVersion, - items: [ - { - text: "更新日志", - link: "https://github.com/phphe/he-tree-react/releases", - }, - ], - }, - ], - }, - }, - }, - head: [ - [ - "script", - { - async: "", - src: `https://www.googletagmanager.com/gtag/js?id=${GTAG_ID}`, - }, - ], - [ - "script", - {}, - `window.dataLayer = window.dataLayer || []; - function gtag(){dataLayer.push(arguments);} - gtag('js', new Date()); - gtag('config', '${GTAG_ID}');`, - ], - ], - sitemap: { - hostname: "https://he-tree-react.phphe.com", - }, - lastUpdated: true, -}); diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts deleted file mode 100644 index 1c7bb0e..0000000 --- a/docs/.vitepress/theme/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// https://vitepress.dev/guide/custom-theme -import { h } from "vue"; -import type { Theme } from "vitepress"; -import DefaultTheme from "vitepress/theme"; -import "./style.css"; -import DemoIframe from "../../components/DemoIframe.vue"; - -export default { - extends: DefaultTheme, - Layout: () => { - return h(DefaultTheme.Layout, null, { - // https://vitepress.dev/guide/extending-default-theme#layout-slots - }); - }, - enhanceApp({ app, router, siteData }) { - // ... - app.component("DemoIframe", DemoIframe); - }, -} satisfies Theme; diff --git a/docs/.vitepress/theme/style.css b/docs/.vitepress/theme/style.css deleted file mode 100644 index d63aee8..0000000 --- a/docs/.vitepress/theme/style.css +++ /dev/null @@ -1,139 +0,0 @@ -/** - * Customize default theme styling by overriding CSS variables: - * https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css - */ - -/** - * Colors - * - * Each colors have exact same color scale system with 3 levels of solid - * colors with different brightness, and 1 soft color. - * - * - `XXX-1`: The most solid color used mainly for colored text. It must - * satisfy the contrast ratio against when used on top of `XXX-soft`. - * - * - `XXX-2`: The color used mainly for hover state of the button. - * - * - `XXX-3`: The color for solid background, such as bg color of the button. - * It must satisfy the contrast ratio with pure white (#ffffff) text on - * top of it. - * - * - `XXX-soft`: The color used for subtle background such as custom container - * or badges. It must satisfy the contrast ratio when putting `XXX-1` colors - * on top of it. - * - * The soft color must be semi transparent alpha channel. This is crucial - * because it allows adding multiple "soft" colors on top of each other - * to create a accent, such as when having inline code block inside - * custom containers. - * - * - `default`: The color used purely for subtle indication without any - * special meanings attched to it such as bg color for menu hover state. - * - * - `brand`: Used for primary brand colors, such as link text, button with - * brand theme, etc. - * - * - `tip`: Used to indicate useful information. The default theme uses the - * brand color for this by default. - * - * - `warning`: Used to indicate warning to the users. Used in custom - * container, badges, etc. - * - * - `danger`: Used to show error, or dangerous message to the users. Used - * in custom container, badges, etc. - * -------------------------------------------------------------------------- */ - - :root { - --vp-c-default-1: var(--vp-c-gray-1); - --vp-c-default-2: var(--vp-c-gray-2); - --vp-c-default-3: var(--vp-c-gray-3); - --vp-c-default-soft: var(--vp-c-gray-soft); - - --vp-c-brand-1: var(--vp-c-indigo-1); - --vp-c-brand-2: var(--vp-c-indigo-2); - --vp-c-brand-3: var(--vp-c-indigo-3); - --vp-c-brand-soft: var(--vp-c-indigo-soft); - - --vp-c-tip-1: var(--vp-c-brand-1); - --vp-c-tip-2: var(--vp-c-brand-2); - --vp-c-tip-3: var(--vp-c-brand-3); - --vp-c-tip-soft: var(--vp-c-brand-soft); - - --vp-c-warning-1: var(--vp-c-yellow-1); - --vp-c-warning-2: var(--vp-c-yellow-2); - --vp-c-warning-3: var(--vp-c-yellow-3); - --vp-c-warning-soft: var(--vp-c-yellow-soft); - - --vp-c-danger-1: var(--vp-c-red-1); - --vp-c-danger-2: var(--vp-c-red-2); - --vp-c-danger-3: var(--vp-c-red-3); - --vp-c-danger-soft: var(--vp-c-red-soft); -} - -/** - * Component: Button - * -------------------------------------------------------------------------- */ - -:root { - --vp-button-brand-border: transparent; - --vp-button-brand-text: var(--vp-c-white); - --vp-button-brand-bg: var(--vp-c-brand-3); - --vp-button-brand-hover-border: transparent; - --vp-button-brand-hover-text: var(--vp-c-white); - --vp-button-brand-hover-bg: var(--vp-c-brand-2); - --vp-button-brand-active-border: transparent; - --vp-button-brand-active-text: var(--vp-c-white); - --vp-button-brand-active-bg: var(--vp-c-brand-1); -} - -/** - * Component: Home - * -------------------------------------------------------------------------- */ - -:root { - --vp-home-hero-name-color: transparent; - --vp-home-hero-name-background: -webkit-linear-gradient( - 120deg, - #bd34fe 30%, - #41d1ff - ); - - --vp-home-hero-image-background-image: linear-gradient( - -45deg, - #bd34fe 50%, - #47caff 50% - ); - --vp-home-hero-image-filter: blur(44px); -} - -@media (min-width: 640px) { - :root { - --vp-home-hero-image-filter: blur(56px); - } -} - -@media (min-width: 960px) { - :root { - --vp-home-hero-image-filter: blur(68px); - } -} - -/** - * Component: Custom Block - * -------------------------------------------------------------------------- */ - -:root { - --vp-custom-block-tip-border: transparent; - --vp-custom-block-tip-text: var(--vp-c-text-1); - --vp-custom-block-tip-bg: var(--vp-c-brand-soft); - --vp-custom-block-tip-code-bg: var(--vp-c-brand-soft); -} - -/** - * Component: Algolia - * -------------------------------------------------------------------------- */ - -.DocSearch { - --docsearch-primary-color: var(--vp-c-brand-1) !important; -} - diff --git a/docs/components/DemoIframe.vue b/docs/components/DemoIframe.vue deleted file mode 100644 index 1a56856..0000000 --- a/docs/components/DemoIframe.vue +++ /dev/null @@ -1,105 +0,0 @@ -