diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..da5f0fc --- /dev/null +++ b/.babelrc @@ -0,0 +1,30 @@ +{ + "presets": [ + [ + "@babel/preset-env", + { + "targets": { + "ie": 11 + } + } + ] + ], + "plugins": [ + [ + "babel-plugin-inline-import", + { + "extensions": [ + ".html", + ".css", + ".json" + ] + } + ], + [ + "@babel/plugin-proposal-decorators", + { + "decoratorsBeforeExport": true + } + ] + ] +} diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e291365 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 4 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.esdoc.json b/.esdoc.json new file mode 100644 index 0000000..206feed --- /dev/null +++ b/.esdoc.json @@ -0,0 +1,41 @@ +{ + "index": "./ReadMe.md", + "source": "./source", + "destination": "./docs", + "plugins": [ + { + "name": "esdoc-standard-plugin", + "option": { + "accessor": { + "access": ["public", "protected"], + "autoPrivate": false + }, + "test": { + "source": "./test", + "interfaces": ["describe", "it"], + "includes": ["\\.test\\.js$"] + }, + "manual": { + "files": [ + "./manual/API.md", + "./manual/Router.md", + "./manual/Node.JS.md", + "./manual/Integration.md" + ] + } + } + }, + { + "name": "esdoc-external-webapi-plugin", + "option": { + "enable": true + } + }, + { + "name": "esdoc-ecmascript-proposal-plugin", + "option": { + "all": true + } + } + ] +} diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..b5e3523 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,41 @@ +{ + "env": { + "es6": true, + "node": true, + "browser": true, + "mocha": true + }, + "parser": "babel-eslint", + "parserOptions": { + "ecmaVersion": 8, + "sourceType": "module", + "ecmaFeatures": { + "legacyDecorators": true + } + }, + "extends": "eslint:recommended", + "rules": { + "indent": [ + "error", 4, {"SwitchCase": 1} + ], + "linebreak-style": ["error", "unix"], + "quotes": ["error", "single"], + "semi": ["error", "always"], + "no-cond-assign": "off", + "getter-return": "warn", + "no-console": ["error", { + "allow": ["info", "warn", "error", "time", "timeEnd"] + }], + "valid-jsdoc": ["error", { + "prefer": { + "returns": "return" + }, + "requireParamDescription": false, + "requireReturn": false, + "requireReturnDescription": false + }] + }, + "globals": { + "ShadyCSS": true + } +} diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 76ea2fd..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,3 +0,0 @@ -custom: - - https://paypal.me/TechQuery - - https://tech-query.me/image/TechQuery-Alipay.jpg diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md new file mode 100644 index 0000000..b735373 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -0,0 +1,35 @@ +--- +name: Bug report +about: Create a report to help us improve + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/Feature_request.md b/.github/ISSUE_TEMPLATE/Feature_request.md new file mode 100644 index 0000000..066b2d9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Feature_request.md @@ -0,0 +1,17 @@ +--- +name: Feature request +about: Suggest an idea for this project + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/pr-badge.yml b/.github/pr-badge.yml deleted file mode 100644 index 7400516..0000000 --- a/.github/pr-badge.yml +++ /dev/null @@ -1,17 +0,0 @@ -- icon: visualstudio - label: 'GitHub.dev' - message: 'PR-$prNumber' - color: 'blue' - url: 'https://github.dev/$owner/$repo/pull/$prNumber' - -- icon: github - label: 'GitHub codespaces' - message: 'PR-$prNumber' - color: 'black' - url: 'https://codespaces.new/$owner/$repo/pull/$prNumber' - -- icon: git - label: 'GitPod.io' - message: 'PR-$prNumber' - color: 'orange' - url: 'https://gitpod.io/?autostart=true#https://github.com/$owner/$repo/pull/$prNumber' diff --git a/.github/settings.yml b/.github/settings.yml deleted file mode 100644 index 72e1ca6..0000000 --- a/.github/settings.yml +++ /dev/null @@ -1,85 +0,0 @@ -# These settings are synced to GitHub by https://probot.github.io/apps/settings/ - -repository: - allow_merge_commit: false - - delete_branch_on_merge: true - - enable_vulnerability_alerts: true - -labels: - - name: bug - color: '#d73a4a' - description: Something isn't working - - - name: documentation - color: '#0075ca' - description: Improvements or additions to documentation - - - name: duplicate - color: '#cfd3d7' - description: This issue or pull request already exists - - - name: enhancement - color: '#a2eeef' - description: Some improvements - - - name: feature - color: '#16b33f' - description: New feature or request - - - name: good first issue - color: '#7057ff' - description: Good for newcomers - - - name: help wanted - color: '#008672' - description: Extra attention is needed - - - name: invalid - color: '#e4e669' - description: This doesn't seem right - - - name: question - color: '#d876e3' - description: Further information is requested - - - name: wontfix - color: '#ffffff' - description: This will not be worked on - -branches: - - name: main - # https://docs.github.com/en/rest/reference/repos#update-branch-protection - protection: - # Required. Require at least one approving review on a pull request, before merging. Set to null to disable. - required_pull_request_reviews: - # The number of approvals required. (1-6) - required_approving_review_count: 1 - # Dismiss approved reviews automatically when a new commit is pushed. - dismiss_stale_reviews: true - # Blocks merge until code owners have reviewed. - require_code_owner_reviews: true - # Specify which users and teams can dismiss pull request reviews. - # Pass an empty dismissal_restrictions object to disable. - # User and team dismissal_restrictions are only available for organization-owned repositories. - # Omit this parameter for personal repositories. - dismissal_restrictions: - # users: [] - # teams: [] - # Required. Require status checks to pass before merging. Set to null to disable - required_status_checks: - # Required. Require branches to be up to date before merging. - strict: true - # Required. The list of status checks to require in order to merge into this branch - contexts: [] - # Required. Enforce all configured restrictions for administrators. - # Set to true to enforce required status checks for repository administrators. - # Set to null to disable. - enforce_admins: true - # Prevent merge commits from being pushed to matching branches - required_linear_history: true - # Required. Restrict who can push to this branch. - # Team and user restrictions are only available for organization-owned repositories. - # Set to null to disable. - restrictions: null diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 3ab305e..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: CI & CD -on: - push: - tags: - - v* -jobs: - Build-and-Publish: - runs-on: ubuntu-latest - permissions: - contents: write - id-token: write - steps: - - uses: actions/checkout@v4 - - - uses: pnpm/action-setup@v4 - with: - version: 10 - - uses: actions/setup-node@v4 - with: - node-version: 22 - registry-url: https://registry.npmjs.org - cache: pnpm - - name: Install Dependencies - run: pnpm i --frozen-lockfile - - - name: Build & Publish - run: npm publish --access public --provenance - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - - name: Update document - uses: peaceiris/actions-gh-pages@v4 - with: - publish_dir: ./docs - personal_token: ${{ secrets.GITHUB_TOKEN }} - force_orphan: true - - - uses: amondnet/vercel-action@v25 - with: - vercel-token: ${{ secrets.VERCEL_TOKEN }} - github-token: ${{ secrets.GITHUB_TOKEN }} - vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} - vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} - working-directory: ./docs - vercel-args: --prod diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml deleted file mode 100644 index 834b9d2..0000000 --- a/.github/workflows/push.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Commit preview -on: - push: - branches-ignore: - - main -jobs: - Build-and-Deploy: - env: - VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: pnpm/action-setup@v4 - with: - version: 10 - - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: pnpm - - name: Install & Build - run: | - pnpm i --frozen-lockfile - pnpm build - - - uses: amondnet/vercel-action@v25 - if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }} - with: - vercel-token: ${{ secrets.VERCEL_TOKEN }} - github-token: ${{ secrets.GITHUB_TOKEN }} - vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} - vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} - working-directory: ./docs diff --git a/.gitignore b/.gitignore index 8445b39..a488b5e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,68 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency node_modules/ +jspm_packages/ package-lock.json -yarn.lock + +# Typescript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +# Editor & IDE configuration +.vscode/ +.idea/ + +# Project building +test/**/dist/ dist/ -.parcel-cache/ docs/ -.vscode/settings.json -.vercel diff --git a/.gitpod.yml b/.gitpod.yml deleted file mode 100644 index 168fada..0000000 --- a/.gitpod.yml +++ /dev/null @@ -1,21 +0,0 @@ -# This configuration file was automatically generated by Gitpod. -# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml) -# and commit this file to your remote git repository to share the goodness with others. - -# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart - -vscode: - extensions: - - yzhang.markdown-all-in-one - - redhat.vscode-yaml - - akamud.vscode-caniuse - - visualstudioexptteam.intellicode-api-usage-examples - - pflannery.vscode-versionlens - - christian-kohler.npm-intellisense - - esbenp.prettier-vscode - - eamodio.gitlens - - github.vscode-pull-request-github - - github.vscode-github-actions -tasks: - - init: pnpm i - command: npm test diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100644 index 72c4429..0000000 --- a/.husky/pre-commit +++ /dev/null @@ -1 +0,0 @@ -npm test diff --git a/.husky/pre-push b/.husky/pre-push deleted file mode 100644 index d6cb288..0000000 --- a/.husky/pre-push +++ /dev/null @@ -1 +0,0 @@ -npm run build diff --git a/.npmignore b/.npmignore index fcb235d..2c3aa83 100644 --- a/.npmignore +++ b/.npmignore @@ -1,7 +1,8 @@ -*.sh -.* -*.config.ts +.editorconfig +.eslintrc.json +.babelrc test/ -preview/ -Contributing.md -docs/ \ No newline at end of file +.esdoc.json +docs/ +.github/ +.travis.yml diff --git a/.npmrc b/.npmrc deleted file mode 100644 index f048ded..0000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -auto-install-peers = false diff --git a/.parcelrc b/.parcelrc deleted file mode 100644 index a8f22fc..0000000 --- a/.parcelrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "@parcel/config-default", - "transformers": { - "*.{ts,tsx}": [ - "@parcel/transformer-typescript-tsc" - ] - } -} diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..935d885 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,22 @@ +branches: + only: + - master + +language: node_js +node_js: + - lts/* +cache: + directories: + - node_modules + +install: + - npm install +script: + - npm run docs + - cd ${FOLDER} + - git init + - git config user.name ${UID} + - git config user.email ${EMAIL} + - git add . + - git commit -m "${MESSAGE}" + - git push --force --quiet https://${TOKEN}@${GIT_URI}.git master:gh-pages diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index 2999a2a..0000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "recommendations": [ - "yzhang.markdown-all-in-one", - "redhat.vscode-yaml", - "akamud.vscode-caniuse", - "visualstudioexptteam.intellicode-api-usage-examples", - "pflannery.vscode-versionlens", - "christian-kohler.npm-intellisense", - "esbenp.prettier-vscode", - "eamodio.gitlens", - "github.vscode-pull-request-github", - "github.vscode-github-actions", - "GitHub.copilot" - ] -} diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index d8ddc2b..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "name": "Debug Jest", - "type": "node", - "request": "launch", - "port": 9229, - "runtimeArgs": [ - "--inspect-brk", - "${workspaceRoot}/node_modules/jest/bin/jest.js", - "--runInBand" - ], - "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen" - } - ] -} diff --git a/License b/LICENSE similarity index 97% rename from License rename to LICENSE index 6efec6d..e537f8f 100644 --- a/License +++ b/LICENSE @@ -1,243 +1,243 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. - ---- - -版权所有(c)2019 - 2024 TechQuery - -反 996 许可证版本 1.0(草案) - -在符合下列条件的情况下, -特此免费向任何得到本授权作品的副本(包括源代码、文件和/或相关内容,以下统称为“授权作品” -)的个人和法人实体授权:被授权个人或法人实体有权以任何目的处置授权作品,包括但不限于使 -用、复制,修改,衍生利用、散布,发布和再许可: - - -1. 个人或法人实体必须在许可作品的每个再散布或衍生副本上包含以上版权声明和本许可证,不 - 得自行修改。 -2. 个人或法人实体必须严格遵守与个人实际所在地或个人出生地或归化地、或法人实体注册地或 - 经营地(以较严格者为准)的司法管辖区所有适用的与劳动和就业相关法律、法规、规则和 - 标准。如果该司法管辖区没有此类法律、法规、规章和标准或其法律、法规、规章和标准不可 - 执行,则个人或法人实体必须遵守国际劳工标准的核心公约。 -3. 个人或法人不得以任何方式诱导或强迫其全职或兼职员工或其独立承包人以口头或书面形式同 - 意直接或间接限制、削弱或放弃其所拥有的,受相关与劳动和就业有关的法律、法规、规则和 - 标准保护的权利或补救措施,无论该等书面或口头协议是否被该司法管辖区的法律所承认,该 - 等个人或法人实体也不得以任何方法限制其雇员或独立承包人向版权持有人或监督许可证合规 - 情况的有关当局报告或投诉上述违反许可证的行为的权利。 - -该授权作品是"按原样"提供,不做任何明示或暗示的保证,包括但不限于对适销性、特定用途适用 -性和非侵权性的保证。在任何情况下,无论是在合同诉讼、侵权诉讼或其他诉讼中,版权持有人均 -不承担因本软件或本软件的使用或其他交易而产生、引起或与之相关的任何索赔、损害或其他责任。 - - -------------------------- ENGLISH ------------------------------ - - -Copyright (c) 2019 - 2024 TechQuery - -Anti 996 License Version 1.0 (Draft) - -Permission is hereby granted to any individual or legal entity obtaining a copy -of this licensed work (including the source code, documentation and/or related -items, hereinafter collectively referred to as the "licensed work"), free of -charge, to deal with the licensed work for any purpose, including without -limitation, the rights to use, reproduce, modify, prepare derivative works of, -publish, distribute and sublicense the licensed work, subject to the following -conditions: - -1. The individual or the legal entity must conspicuously display, without - modification, this License on each redistributed or derivative copy of the - Licensed Work. - -2. The individual or the legal entity must strictly comply with all applicable - laws, regulations, rules and standards of the jurisdiction relating to - labor and employment where the individual is physically located or where - the individual was born or naturalized; or where the legal entity is - registered or is operating (whichever is stricter). In case that the - jurisdiction has no such laws, regulations, rules and standards or its - laws, regulations, rules and standards are unenforceable, the individual - or the legal entity are required to comply with Core International Labor - Standards. - -3. The individual or the legal entity shall not induce or force its - employee(s), whether full-time or part-time, or its independent - contractor(s), in any methods, to agree in oral or written form, - to directly or indirectly restrict, weaken or relinquish his or - her rights or remedies under such laws, regulations, rules and - standards relating to labor and employment as mentioned above, - no matter whether such written or oral agreement are enforceable - under the laws of the said jurisdiction, nor shall such individual - or the legal entity limit, in any methods, the rights of its employee(s) - or independent contractor(s) from reporting or complaining to the copyright - holder or relevant authorities monitoring the compliance of the license - about its violation(s) of the said license. - -THE LICENSED WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT -HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ANY WAY CONNECTION -WITH THE LICENSED WORK OR THE USE OR OTHER DEALINGS IN THE LICENSED WORK. + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. + +--- + +版权所有 (C)2019 TechQuery + +反 996 许可证版本 1.0(草案) + +在符合下列条件的情况下, +特此免费向任何得到本授权作品的副本(包括源代码、文件和/或相关内容,以下统称为“授权作品” +)的个人和法人实体授权:被授权个人或法人实体有权以任何目的处置授权作品,包括但不限于使 +用、复制,修改,衍生利用、散布,发布和再许可: + + +1. 个人或法人实体必须在许可作品的每个再散布或衍生副本上包含以上版权声明和本许可证,不 + 得自行修改。 +2. 个人或法人实体必须严格遵守与个人实际所在地或个人出生地或归化地、或法人实体注册地或 + 经营地(以较严格者为准)的司法管辖区所有适用的与劳动和就业相关法律、法规、规则和 + 标准。如果该司法管辖区没有此类法律、法规、规章和标准或其法律、法规、规章和标准不可 + 执行,则个人或法人实体必须遵守国际劳工标准的核心公约。 +3. 个人或法人不得以任何方式诱导或强迫其全职或兼职员工或其独立承包人以口头或书面形式同 + 意直接或间接限制、削弱或放弃其所拥有的,受相关与劳动和就业有关的法律、法规、规则和 + 标准保护的权利或补救措施,无论该等书面或口头协议是否被该司法管辖区的法律所承认,该 + 等个人或法人实体也不得以任何方法限制其雇员或独立承包人向版权持有人或监督许可证合规 + 情况的有关当局报告或投诉上述违反许可证的行为的权利。 + +该授权作品是"按原样"提供,不做任何明示或暗示的保证,包括但不限于对适销性、特定用途适用 +性和非侵权性的保证。在任何情况下,无论是在合同诉讼、侵权诉讼或其他诉讼中,版权持有人均 +不承担因本软件或本软件的使用或其他交易而产生、引起或与之相关的任何索赔、损害或其他责任。 + + +------------------------- ENGLISH ------------------------------ + + +Copyright (C)2019 TechQuery + +Anti 996 License Version 1.0 (Draft) + +Permission is hereby granted to any individual or legal entity obtaining a copy +of this licensed work (including the source code, documentation and/or related +items, hereinafter collectively referred to as the "licensed work"), free of +charge, to deal with the licensed work for any purpose, including without +limitation, the rights to use, reproduce, modify, prepare derivative works of, +publish, distribute and sublicense the licensed work, subject to the following +conditions: + +1. The individual or the legal entity must conspicuously display, without + modification, this License on each redistributed or derivative copy of the + Licensed Work. + +2. The individual or the legal entity must strictly comply with all applicable + laws, regulations, rules and standards of the jurisdiction relating to + labor and employment where the individual is physically located or where + the individual was born or naturalized; or where the legal entity is + registered or is operating (whichever is stricter). In case that the + jurisdiction has no such laws, regulations, rules and standards or its + laws, regulations, rules and standards are unenforceable, the individual + or the legal entity are required to comply with Core International Labor + Standards. + +3. The individual or the legal entity shall not induce or force its + employee(s), whether full-time or part-time, or its independent + contractor(s), in any methods, to agree in oral or written form, + to directly or indirectly restrict, weaken or relinquish his or + her rights or remedies under such laws, regulations, rules and + standards relating to labor and employment as mentioned above, + no matter whether such written or oral agreement are enforceable + under the laws of the said jurisdiction, nor shall such individual + or the legal entity limit, in any methods, the rights of its employee(s) + or independent contractor(s) from reporting or complaining to the copyright + holder or relevant authorities monitoring the compliance of the license + about its violation(s) of the said license. + +THE LICENSED WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT +HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ANY WAY CONNECTION +WITH THE LICENSED WORK OR THE USE OR OTHER DEALINGS IN THE LICENSED WORK. diff --git a/ReadMe.md b/ReadMe.md index e44f59c..fd18cb9 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,645 +1,269 @@ -# WebCell - -![WebCell logo](https://web-cell.dev/WebCell-0.f9823b00.png) +![WebCell logo](https://web-cell.dev/image/WebCell-0.png) -[简体中文](./guide/ReadMe-zh.md) | English - -[Web Components][1] engine based on VDOM, [JSX][2], [MobX][3] & [TypeScript][4] +# WebCell -[![NPM Dependency](https://img.shields.io/librariesio/github/EasyWebApp/WebCell.svg)][5] -[![CI & CD](https://github.com/EasyWebApp/WebCell/actions/workflows/main.yml/badge.svg)][6] +Light-weight **[Web Components](https://www.webcomponents.org/) framework** (with MVVM support) based on [ECMAScript 2018][1] & [Decorator proposal][2], powered by the practice & experience from developing [EWA v1.0 ~ 4.0](https://gitee.com/Tech_Query/EasyWebApp/). -[![Anti 996 license](https://img.shields.io/badge/license-Anti%20996-blue.svg)][7] -[![UI library recommendation list](https://jaywcjlove.github.io/sb/ico/awesome.svg)][8] +[![NPM Dependency](https://david-dm.org/EasyWebApp/WebCell.svg)](https://david-dm.org/EasyWebApp/WebCell) +[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FEasyWebApp%2FWebCell.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FEasyWebApp%2FWebCell?ref=badge_shield) +[![Build Status](https://travis-ci.com/EasyWebApp/WebCell.svg?branch=master)](https://travis-ci.com/EasyWebApp/WebCell) +[![](https://data.jsdelivr.com/v1/package/npm/web-cell/badge?style=rounded)](https://www.jsdelivr.com/package/npm/web-cell) -[![Slideshow](https://img.shields.io/badge/learn-Slideshow-blue)][9] -[![Gitter](https://badges.gitter.im/EasyWebApp/community.svg)][10] +[![NPM](https://nodei.co/npm/web-cell.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/web-cell/) -[![Edit WebCell demo](https://codesandbox.io/static/img/play-codesandbox.svg)][11] +[![Anti 996 license](https://img.shields.io/badge/license-Anti%20996-blue.svg)](https://github.com/996icu/996.ICU/blob/master/LICENSE) +[![Join the chat at https://gitter.im/EasyWebApp-js/Lobby](https://badges.gitter.im/EasyWebApp-js/Lobby.svg)](https://gitter.im/EasyWebApp-js/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![NPM](https://nodei.co/npm/web-cell.png?downloads=true&downloadRank=true&stars=true)][12] -## Feature +## Basic knowledge -### Engines comparison + 1. [Web components](https://developer.mozilla.org/en-US/docs/Web/Web_Components) -| feature | WebCell 3 | WebCell 2 | React | Vue | -| :-----------: | :------------------------: | :------------------: | :---------------------------: | :---------------------------------: | -| JS language | [TypeScript 5][13] | TypeScript 4 | ECMAScript or TypeScript | ECMAScript or TypeScript | -| JS syntax | [ES decorator stage-3][14] | ES decorator stage-2 | | | -| XML syntax | [JSX import][15] | JSX factory | JSX factory/import | HTML/Vue template or JSX (optional) | -| DOM API | [Web components][16] | Web components | HTML 5+ | HTML 5+ | -| view renderer | [DOM Renderer 2][17] | SnabbDOM | (built-in) | SnabbDOM (forked) | -| state API | [MobX `@observable`][18] | `this.state` | `this.state` or `useState()` | `this.$data` or `ref()` | -| props API | MobX `@observable` | `@watch` | `this.props` or `props => {}` | `this.$props` or `defineProps()` | -| state manager | [MobX 6+][19] | MobX 4/5 | Redux | VueX | -| page router | [JSX][20] tags | JSX tags + JSON data | JSX tags | JSON data | -| asset bundler | [Parcel 2][21] | Parcel 1 | webpack | Vite | + 2. [Custom elements](https://developers.google.com/web/fundamentals/web-components/customelements) -## Installation + 3. [Shadow DOM](https://developers.google.com/web/fundamentals/web-components/shadowdom) -```shell -npm install dom-renderer mobx web-cell -``` + 4. [CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables) -## Web browser usage + 5. [ECMAScript 6+](http://es6-features.org/) -[Demo & **GitHub template**][22] + 6. [Decorator](https://github.com/tc39/proposal-decorators/tree/master/previous#decorators) -### Project bootstrap -#### Tool chain -```shell -npm install parcel @parcel/config-default @parcel/transformer-typescript-tsc -D -``` - -#### `package.json` - -```json -{ - "scripts": { - "start": "parcel source/index.html --open", - "build": "parcel build source/index.html --public-url ." - } -} -``` +## Basic Usage -#### `tsconfig.json` -```json -{ - "compilerOptions": { - "target": "ES6", - "module": "ES2020", - "moduleResolution": "Node", - "useDefineForClassFields": true, - "jsx": "react-jsx", - "jsxImportSource": "dom-renderer" - } -} -``` +### Quick start -#### `.parcelrc` +```Shell +npm init web-cell path/to/your_project \ + --remote https://git-example.com/your_id/repo_name.git -```json -{ - "extends": "@parcel/config-default", - "transformers": { - "*.{ts,tsx}": ["@parcel/transformer-typescript-tsc"] - } -} +web-cell new your-tag attr1,attr2 ``` +(More configuration & template files can be found in the document of [WebCell DevCLI](https://web-cell.dev/DevCLI/)) -#### `source/index.html` -```html - - - +### Component - +Create [files as shown below](https://github.com/EasyWebApp/DevCLI/tree/master/test/example-js) in `path/to/your-component` directory: - -``` - -### Function component - -```tsx -import { DOMRenderer } from 'dom-renderer'; -import { FC, PropsWithChildren } from 'web-cell'; +#### `index.html` -const Hello: FC = ({ children = 'World' }) =>

Hello, {children}!

; +[Template syntax of Data binding](https://web-cell.dev/DOM-Renderer/manual/Template.html) -new DOMRenderer().render(WebCell); +```HTML +