diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..219711f9 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,12 @@ +# don't ever lint node_modules +node_modules +# don't lint distribute package output +dist +# don't lint build folder output +build +# don't lint coverage output +coverage +# don't lint storybook files +.storybook/ +# don't lint stories +*.stories.* \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..80cee734 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,20 @@ +module.exports = { + extends: ['@microsoft/eslint-config-fast-dna', 'prettier'], + rules: { + 'no-extra-boolean-cast': 'off', + '@typescript-eslint/no-use-before-define': 'off', + '@typescript-eslint/typedef': 'off', + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/interface-name-prefix': 'off', + }, + overrides: [ + { + files: ['*.ts'], + parserOptions: { + project: ['./tsconfig.eslint.json'], + }, + }, + ], +}; diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..4219dd41 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,79 @@ +name: toolkit-ci + +on: pull_request + +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v2 + + - name: Setup Node ๐Ÿ’พ + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Install Dependencies ๐Ÿ“ฅ + run: npm install + + - name: Run Tests ๐Ÿงช + run: npm run test + + lint: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v2 + + - name: Setup Node ๐Ÿ’พ + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Install Dependencies ๐Ÿ“ฅ + run: npm install + + - name: Run Lint Check ๐Ÿ” + run: npm run lint + + - name: Run Format Check ๐ŸŒธ + run: npm run fmt + + build-toolkit: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v2 + + - name: Setup Node ๐Ÿ’พ + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Install Dependencies ๐Ÿ“ฅ + run: npm install + + - name: Build Toolkit ๐Ÿ— + run: npm run build + + build-docs: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v2 + + - name: Setup Node ๐Ÿ’พ + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Install Dependencies ๐Ÿ“ฅ + run: npm install + + - name: Build Docs ๐Ÿ— + run: npm run build:docs diff --git a/.github/workflows/docs-cd.yml b/.github/workflows/docs-cd.yml new file mode 100644 index 00000000..b17f0cd4 --- /dev/null +++ b/.github/workflows/docs-cd.yml @@ -0,0 +1,26 @@ +name: docs + +on: + push: + branches: + - main + +jobs: + deploy-docs: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v2 + + - name: Install Dependencies ๐Ÿ“ฅ + run: npm install + + - name: Build Docs ๐Ÿ”ง + run: npm run build:docs + + - name: Deploy Docs ๐Ÿš€ + uses: JamesIves/github-pages-deploy-action@4.1.3 + with: + branch: gh-pages + folder: storybook-static diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..6b97199e --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +# Dependencies +node_modules/ + +# Production +dist/ +storybook-static/ + +# Misc +.DS_Store +.vscode +.env.local +.env.development.local +.env.test.local +.env.production.local +.eslintcache +coverage/ +.npmrc + +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Cache +temp diff --git a/.npmignore b/.npmignore new file mode 100644 index 00000000..d5f0c8c3 --- /dev/null +++ b/.npmignore @@ -0,0 +1,37 @@ +# Source files +src/ + +# Docs +docs/ +samples/ +CODE_OF_CONDUCT.md +SECURITY.md +CONTRIBUTING.md + +# Tests +*.spec.* +coverage/ + +# Builds +build/ +storybook-static/ + +# Config files +.vscode +.github +.eslintrc.js +.eslintignore +.prettierrc +.prettierignore +.storybook +babel.config.js +tsconfig.json +tsconfig.build.json +webpack.config.js +rollup.config.js +policheck +azure-pipelines.yml +api-extractor.json + +# Cache +temp \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..b2d1905f --- /dev/null +++ b/.prettierignore @@ -0,0 +1,23 @@ +# Dependencies +node_modules/ + +# Production +build/ +dist/ +storybook-static/ + +# Misc +.DS_Store +.vscode +.env.local +.env.development.local +.env.test.local +.env.production.local +.eslintcache +coverage/ +temp/ +docs/api-report.md + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..c4db7bf9 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,36 @@ +{ + "printWidth": 80, + "tabWidth": 4, + "useTabs": true, + "semi": true, + "singleQuote": true, + "quoteProps": "consistent", + "jsxSingleQuote": false, + "trailingComma": "es5", + "bracketSpacing": false, + "arrowParens": "avoid", + "overrides": [ + { + "files": "docs/*.md", + "options": { + "printWidth": 130, + "singleQuote": false, + "useTabs": false, + "tabWidth": 2, + "bracketSpacing": true + } + }, + { + "files": "src/data-grid/README.md", + "options": { + "printWidth": 110 + } + }, + { + "files": "src/design-tokens.ts", + "options": { + "printWidth": 200 + } + } + ] +} diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..ed61467d --- /dev/null +++ b/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2021 Project Jupyter Contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/NOTICES b/NOTICES new file mode 100644 index 00000000..cd706c67 --- /dev/null +++ b/NOTICES @@ -0,0 +1,1075 @@ +jupyter-ui-toolkit + +THIRD-PARTY SOFTWARE NOTICES AND INFORMATION +Do Not Translate or Localize + +This project incorporates components from the projects listed below. The original copyright notices and the licenses under which we received such components are set forth below. + +--- + +vscode-webview-ui-toolkit 0.8.4 - MIT +https://github.com/microsoft/vscode-webview-ui-toolkit + +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE 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 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- + +--- + +tslib 2.2.0 - 0BSD +https://www.typescriptlang.org/ + +Copyright (c) Microsoft Corporation. + +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +--- + +--- + +tslib 1.14.1 - 0BSD +https://www.typescriptlang.org/ + +Copyright (c) Microsoft Corporation. + +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +--- + +--- + +uri-js 4.4.1 - BSD-2-Clause +https://github.com/garycourt/uri-js + +(c) 2011 Gary Court. +Copyright 2011 Gary Court. + +Copyright 2011 Gary Court. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY GARY COURT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of Gary Court. + +--- + +--- + +@vscode/codicons 0.0.22 - CC-BY-4.0 +https://github.com/microsoft/vscode-codicons#readme + +Copyright (c) Microsoft Corporation. + +Attribution 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More_considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution 4.0 International Public License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution 4.0 International Public License ("Public License"). To the +extent this Public License may be interpreted as a contract, You are +granted the Licensed Rights in consideration of Your acceptance of +these terms and conditions, and the Licensor grants You such rights in +consideration of benefits the Licensor receives from making the +Licensed Material available under these terms and conditions. + +Section 1 -- Definitions. + +a. Adapted Material means material subject to Copyright and Similar +Rights that is derived from or based upon the Licensed Material +and in which the Licensed Material is translated, altered, +arranged, transformed, or otherwise modified in a manner requiring +permission under the Copyright and Similar Rights held by the +Licensor. For purposes of this Public License, where the Licensed +Material is a musical work, performance, or sound recording, +Adapted Material is always produced where the Licensed Material is +synched in timed relation with a moving image. + +b. Adapter's License means the license You apply to Your Copyright +and Similar Rights in Your contributions to Adapted Material in +accordance with the terms and conditions of this Public License. + +c. Copyright and Similar Rights means copyright and/or similar rights +closely related to copyright including, without limitation, +performance, broadcast, sound recording, and Sui Generis Database +Rights, without regard to how the rights are labeled or +categorized. For purposes of this Public License, the rights +specified in Section 2(b)(1)-(2) are not Copyright and Similar +Rights. + +d. Effective Technological Measures means those measures that, in the +absence of proper authority, may not be circumvented under laws +fulfilling obligations under Article 11 of the WIPO Copyright +Treaty adopted on December 20, 1996, and/or similar international +agreements. + +e. Exceptions and Limitations means fair use, fair dealing, and/or +any other exception or limitation to Copyright and Similar Rights +that applies to Your use of the Licensed Material. + +f. Licensed Material means the artistic or literary work, database, +or other material to which the Licensor applied this Public +License. + +g. Licensed Rights means the rights granted to You subject to the +terms and conditions of this Public License, which are limited to +all Copyright and Similar Rights that apply to Your use of the +Licensed Material and that the Licensor has authority to license. + +h. Licensor means the individual(s) or entity(ies) granting rights +under this Public License. + +i. Share means to provide material to the public by any means or +process that requires permission under the Licensed Rights, such +as reproduction, public display, public performance, distribution, +dissemination, communication, or importation, and to make material +available to the public including in ways that members of the +public may access the material from a place and at a time +individually chosen by them. + +j. Sui Generis Database Rights means rights other than copyright +resulting from Directive 96/9/EC of the European Parliament and of +the Council of 11 March 1996 on the legal protection of databases, +as amended and/or succeeded, as well as other essentially +equivalent rights anywhere in the world. + +k. You means the individual or entity exercising the Licensed Rights +under this Public License. Your has a corresponding meaning. + +Section 2 -- Scope. + +a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part; and + + b. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + +b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + +a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + 4. If You Share Adapted Material You produce, the Adapter's + License You apply must not prevent recipients of the Adapted + Material from complying with this Public License. + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + +a. for the avoidance of doubt, Section 2(a)(1) grants You the right +to extract, reuse, reproduce, and Share all or a substantial +portion of the contents of the database; + +b. if You include all or a substantial portion of the database +contents in a database in which You have Sui Generis Database +Rights, then the database in which You have Sui Generis Database +Rights (but not its individual contents) is Adapted Material; and + +c. You must comply with the conditions in Section 3(a) if You Share +all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + +a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE +EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS +AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF +ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, +IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, +WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, +ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT +KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT +ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + +b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE +TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, +NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, +INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, +COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR +USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN +ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR +DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR +IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + +c. The disclaimer of warranties and limitation of liability provided +above shall be interpreted in a manner that, to the extent +possible, most closely approximates an absolute disclaimer and +waiver of all liability. + +Section 6 -- Term and Termination. + +a. This Public License applies for the term of the Copyright and +Similar Rights licensed here. However, if You fail to comply with +this Public License, then Your rights under this Public License +terminate automatically. + +b. Where Your right to use the Licensed Material has terminated under +Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + +c. For the avoidance of doubt, the Licensor may also offer the +Licensed Material under separate terms or conditions or stop +distributing the Licensed Material at any time; however, doing so +will not terminate this Public License. + +d. Sections 1, 5, 6, 7, and 8 survive termination of this Public +License. + +Section 7 -- Other Terms and Conditions. + +a. The Licensor shall not be bound by any additional or different +terms or conditions communicated by You unless expressly agreed. + +b. Any arrangements, understandings, or agreements regarding the +Licensed Material not stated herein are separate from and +independent of the terms and conditions of this Public License. + +Section 8 -- Interpretation. + +a. For the avoidance of doubt, this Public License does not, and +shall not be interpreted to, reduce, limit, restrict, or impose +conditions on any use of the Licensed Material that could lawfully +be made without permission under this Public License. + +b. To the extent possible, if any provision of this Public License is +deemed unenforceable, it shall be automatically reformed to the +minimum extent necessary to make it enforceable. If the provision +cannot be reformed, it shall be severed from this Public License +without affecting the enforceability of the remaining terms and +conditions. + +c. No term or condition of this Public License will be waived and no +failure to comply consented to unless expressly agreed to by the +Licensor. + +d. Nothing in this Public License constitutes or may be interpreted +as a limitation upon, or waiver of, any privileges and immunities +that apply to the Licensor or You, including from the legal +processes of any jurisdiction or authority. + +======================================================================= + +Creative Commons is not a party to its public +licenses. Notwithstanding, Creative Commons may elect to apply one of +its public licenses to material it publishes and in those instances +will be considered the โ€œLicensor.โ€ The text of the Creative Commons +public licenses is dedicated to the public domain under the CC0 Public +Domain Dedication. Except for the limited purpose of indicating that +material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the +public licenses. + +Creative Commons may be contacted at creativecommons.org. + +--- + +--- + +@microsoft/fast-element 1.4.0 - MIT +https://github.com/Microsoft/fast#readme + +MIT License + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- + +--- + +@microsoft/fast-foundation 1.24.7 - MIT +https://github.com/Microsoft/fast#readme + +Copyright (c) Microsoft Corporation. + +MIT License + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- + +--- + +@microsoft/fast-web-utilities 4.8.0 - MIT +https://github.com/Microsoft/fast#readme + +MIT License + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- + +--- + +@microsoft/tsdoc 0.12.24 - MIT +https://tsdoc.org/ + +Copyright (c) Microsoft Corporation. + +Copyright (c) Microsoft Corporation. All rights reserved. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE 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 AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- + +--- + +@microsoft/tsdoc-config 0.13.9 - MIT +https://tsdoc.org/ + +Copyright (c) Microsoft Corporation. + +Copyright (c) Microsoft Corporation. All rights reserved. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE 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 AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- + +--- + +ajv 6.12.6 - MIT +https://github.com/ajv-validator/ajv + +(c) 2011 Gary Court. +Copyright 2011 Gary Court. +Copyright (c) 2015-2017 Evgeny Poberezkin + +The MIT License (MIT) + +Copyright (c) 2015-2017 Evgeny Poberezkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE 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 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- + +--- + +exenv-es6 1.0.0 - MIT +https://github.com/chrisdholt/exenv-es6#readme + +Copyright (c) 2018 Chris Holt + +MIT License + +Copyright (c) 2018 Chris Holt + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE 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 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- + +--- + +fast-deep-equal 3.1.3 - MIT +https://github.com/epoberezkin/fast-deep-equal#readme + +Copyright (c) 2017 Evgeny Poberezkin + +MIT License + +Copyright (c) 2017 Evgeny Poberezkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE 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 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- + +--- + +fast-json-stable-stringify 2.1.0 - MIT +https://github.com/epoberezkin/fast-json-stable-stringify + +Copyright (c) 2013 James Halliday +Copyright (c) 2017 Evgeny Poberezkin + +This software is released under the MIT license: + +Copyright (c) 2017 Evgeny Poberezkin +Copyright (c) 2013 James Halliday + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE 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 AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- + +--- + +function-bind 1.1.1 - MIT +https://github.com/Raynos/function-bind + +Copyright (c) 2013 Raynos. + +Copyright (c) 2013 Raynos. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE 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 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +--- + +--- + +has 1.0.3 - MIT +https://github.com/tarruda/has + +Copyright (c) 2013 Thiago de Arruda + +Copyright (c) 2013 Thiago de Arruda + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE 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 AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +--- + +--- + +is-core-module 2.3.0 - MIT +https://github.com/inspect-js/is-core-module + +Copyright (c) 2014 Dave Justice + +The MIT License (MIT) + +Copyright (c) 2014 Dave Justice + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE 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 AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- + +--- + +jju 1.4.0 - MIT +http://rlidwka.github.io/jju/ + +Copyright (c) 2013 Alex Kocharin + +(The MIT License) + +Copyright (c) 2013 Alex Kocharin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE 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 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +--- + +--- + +json-schema-traverse 0.4.1 - MIT +https://github.com/epoberezkin/json-schema-traverse#readme + +Copyright (c) 2017 Evgeny Poberezkin + +MIT License + +Copyright (c) 2017 Evgeny Poberezkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE 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 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- + +--- + +lodash-es 4.17.21 - MIT +https://lodash.com/custom-builds + +Copyright OpenJS Foundation and other contributors +Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors +copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + +Copyright OpenJS Foundation and other contributors + +Based on Underscore.js, copyright Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash + +The following license applies to all parts of this software except as +documented below: + +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE 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 AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. + +--- + +--- + +path-parse 1.0.6 - MIT +https://github.com/jbgutierrez/path-parse#readme + +Copyright (c) 2015 Javier Blanco +(c) Javier Blanco (http://jbgutierrez.info) + +The MIT License (MIT) + +Copyright (c) 2015 Javier Blanco + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE 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 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- + +--- + +punycode 2.1.1 - MIT +https://mths.be/punycode + +Copyright Mathias Bynens + +Copyright Mathias Bynens + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE 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 AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- + +--- + +resolve 1.19.0 - MIT +https://github.com/browserify/resolve#readme + +Copyright (c) 2012 James Halliday + +MIT License + +Copyright (c) 2012 James Halliday + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE 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 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- + +--- + +tabbable 5.2.0 - MIT +https://github.com/focus-trap/tabbable#readme + +The MIT License (MIT) + +Copyright (c) 2015 David Clark + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE 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 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- diff --git a/README.md b/README.md new file mode 100644 index 00000000..9ff46790 --- /dev/null +++ b/README.md @@ -0,0 +1,67 @@ +# Webview UI Toolkit for Visual Studio Code + +![Release: Public Preview](https://img.shields.io/badge/release-public%20preview-orange) +[![NPM Version](https://img.shields.io/npm/v/@vscode/webview-ui-toolkit?color=blue)](https://www.npmjs.com/package/@vscode/webview-ui-toolkit) +[![License: MIT](https://img.shields.io/badge/license-MIT-brightgreen)](./LICENSE) +![Toolkit CI Status](https://github.com/microsoft/vscode-webview-ui-toolkit/actions/workflows/ci.yml/badge.svg) +![Deploy Docs Status](https://github.com/microsoft/vscode-webview-ui-toolkit/actions/workflows/docs-cd.yml/badge.svg) + +![Webview Toolkit for Visual Studio Code Artwork](./docs/assets/toolkit-artwork.png) + +## Introduction + +The Webview UI Toolkit is a component library for building [webview-based extensions](https://code.visualstudio.com/api/extension-guides/webview) in Visual Studio Code. + +Features of the library include: + +- **Implements the Visual Studio Code design language:** All components follow the design language of Visual Studio Code โ€“ enabling developers to create extensions that have a consistent look and feel with the rest of the editor. +- **Automatic support for color themes:** All components are designed with theming in mind and will automatically display the current editor theme. +- **Use any tech stack:** The library ships as a set of web components, meaning developers can use the toolkit no matter what tech stack (React, Vue, Svelte, etc.) their extension is built with. +- **Accessible out of the box:** All components ship with web standard compliant ARIA labels and keyboard navigation. + +Note that this doesn't change our recommendation of [avoiding the use of webviews](https://code.visualstudio.com/api/references/extension-guidelines#webviews) in extensions unless you absolutely need them. + +## Release + +The Webview UI Toolkit is currently in a public preview. Track progress towards 1.0 [here](https://github.com/microsoft/vscode-webview-ui-toolkit/issues?q=is%3Aopen+is%3Aissue+milestone%3Av1.0). + +### Known issues + +Medium to high-visibility issues that are intended to be fixed with high priority. + +- Options within `vscode-dropdown` do not announce their text content on selection change [#181](https://github.com/microsoft/vscode-webview-ui-toolkit/issues/181) + +## Getting started + +Follow the [Getting Started Guide](./docs/getting-started.md). + +If you already have a webview-based extension, you can install the toolkit with the following command: + +``` +npm install --save @vscode/webview-ui-toolkit +``` + +## Documentation + +Further documentation can be found in the following places: + +- [Component Docs](./docs/components.md) +- [Storybook (Interactive Component Sandbox)](https://microsoft.github.io/vscode-webview-ui-toolkit/) +- [Toolkit Extension Samples](https://github.com/microsoft/vscode-webview-ui-toolkit-samples) +- [Visual Studio Code Webview Guide](https://code.visualstudio.com/api/extension-guides/webview) +- [Visual Studio Code Webview Guidelines](https://code.visualstudio.com/api/references/extension-guidelines#webviews) +- [Visual Studio Code Extension API Docs](https://code.visualstudio.com/api) + +## Contributing + +See the [contributing](./CONTRIBUTING.md) documentation. + +## Legal notices + +Microsoft and any contributors grant you a license to any code in the repository under the [MIT License](https://opensource.org/licenses/MIT), see the [LICENSE](LICENSE) file. + +This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoftโ€™s Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-partyโ€™s policies. + +Privacy information can be found [here](https://privacy.microsoft.com/en-us/). + +Microsoft and any contributors reserve all other rights, whether under their respective copyrights, patents, or trademarks, whether by implication, estoppel or otherwise. diff --git a/package.json b/package.json new file mode 100644 index 00000000..4172717b --- /dev/null +++ b/package.json @@ -0,0 +1,13 @@ +{ + "name": "@jupyter/root-ui-toolkit", + "private": true, + "scripts": {}, + "devDependencies": { + "lerna": "^4.0.0" + }, + "workspaces": { + "packages": [ + "packages/components" + ] + } +} diff --git a/packages/components/.storybook/babel.config.js b/packages/components/.storybook/babel.config.js new file mode 100644 index 00000000..a00d4b5b --- /dev/null +++ b/packages/components/.storybook/babel.config.js @@ -0,0 +1,7 @@ +module.exports = { + presets: ['@babel/preset-env', '@babel/preset-typescript'], + plugins: [ + ['@babel/plugin-proposal-decorators', {legacy: true}], + ['@babel/plugin-proposal-class-properties', {loose: true}], + ], +}; diff --git a/packages/components/.storybook/customTheme.js b/packages/components/.storybook/customTheme.js new file mode 100644 index 00000000..e5c2c9ff --- /dev/null +++ b/packages/components/.storybook/customTheme.js @@ -0,0 +1,7 @@ +import {create} from '@storybook/theming/create'; + +export default create({ + base: 'light', + brandTitle: 'Jupyter UI Toolkit', + brandUrl: 'https://github.com/microsoft/vscode-webview-ui-toolkit', +}); diff --git a/packages/components/.storybook/main.js b/packages/components/.storybook/main.js new file mode 100644 index 00000000..e2caf7d2 --- /dev/null +++ b/packages/components/.storybook/main.js @@ -0,0 +1,15 @@ +module.exports = { + stories: [ + '../src/**/*.stories.mdx', + '../src/**/*.stories.@(js|jsx|ts|tsx)', + '../docs/**/*.stories.mdx', + ], + addons: [ + '@storybook/addon-links', + '@storybook/addon-essentials', + '@storybook/addon-a11y', + ], + features: { + postcss: false, + }, +}; diff --git a/packages/components/.storybook/manager.js b/packages/components/.storybook/manager.js new file mode 100644 index 00000000..d9ddf162 --- /dev/null +++ b/packages/components/.storybook/manager.js @@ -0,0 +1,16 @@ +import {addons} from '@storybook/addons'; +import customTheme from './customTheme'; + +addons.setConfig({ + isFullscreen: false, + showNav: true, + showPanel: true, + panelPosition: 'bottom', + sidebarAnimations: true, + enableShortcuts: false, + isToolshown: true, + theme: customTheme, + selectedPanel: undefined, + initialActive: 'sidebar', + showRoots: true, +}); diff --git a/packages/components/.storybook/preview-head.html b/packages/components/.storybook/preview-head.html new file mode 100644 index 00000000..1001f6c7 --- /dev/null +++ b/packages/components/.storybook/preview-head.html @@ -0,0 +1,15 @@ + diff --git a/packages/components/.storybook/preview.js b/packages/components/.storybook/preview.js new file mode 100644 index 00000000..aaf0edf7 --- /dev/null +++ b/packages/components/.storybook/preview.js @@ -0,0 +1,35 @@ +import * as JupyterComponents from '../src/index-rollup'; +import {themes} from '@storybook/theming'; + +JupyterComponents; + +export const parameters = { + actions: {argTypesRegex: '^on[A-Z].*'}, + options: { + storySort: { + order: ['Docs', 'Library'], + }, + isToolshown: true, + enableShortcuts: false, + }, + docs: { + theme: themes.light, + }, + backgrounds: { + default: 'dark', + values: [ + { + name: 'light', + value: '#f9f9f9', + }, + { + name: 'grey', + value: '#929396', + }, + { + name: 'dark', + value: '#252526', + }, + ], + }, +}; diff --git a/packages/components/api-extractor.json b/packages/components/api-extractor.json new file mode 100644 index 00000000..0451e991 --- /dev/null +++ b/packages/components/api-extractor.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "dist/dts/index.d.ts", + "apiReport": { + "enabled": true, + "reportFolder": "docs", + "reportFileName": "api-report.md" + }, + "docModel": { + "enabled": false + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "dist/toolkit.d.ts" + } +} diff --git a/packages/components/docs/api-report.md b/packages/components/docs/api-report.md new file mode 100644 index 00000000..00491860 --- /dev/null +++ b/packages/components/docs/api-report.md @@ -0,0 +1,247 @@ +## API Report File for "@jupyter/ui-components" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Anchor } from '@microsoft/fast-foundation'; +import { AnchorOptions } from '@microsoft/fast-foundation'; +import { Badge as Badge_2 } from '@microsoft/fast-foundation'; +import { BaseProgress } from '@microsoft/fast-foundation'; +import { Button as Button_2 } from '@microsoft/fast-foundation'; +import { ButtonOptions } from '@microsoft/fast-foundation'; +import { Checkbox as Checkbox_2 } from '@microsoft/fast-foundation'; +import { CheckboxOptions } from '@microsoft/fast-foundation'; +import { Constructable } from '@microsoft/fast-element'; +import type { Container } from '@microsoft/fast-foundation'; +import { DataGrid as DataGrid_2 } from '@microsoft/fast-foundation'; +import { DataGridCell as DataGridCell_2 } from '@microsoft/fast-foundation'; +import { DataGridRow as DataGridRow_2 } from '@microsoft/fast-foundation'; +import { DesignSystem } from '@microsoft/fast-foundation'; +import { Divider as Divider_2 } from '@microsoft/fast-foundation'; +import { FoundationElement } from '@microsoft/fast-foundation'; +import { FoundationElementDefinition } from '@microsoft/fast-foundation'; +import { FoundationElementRegistry } from '@microsoft/fast-foundation'; +import { ListboxOption } from '@microsoft/fast-foundation'; +import { ListboxOptionOptions } from '@microsoft/fast-foundation'; +import { OverrideFoundationElementDefinition } from '@microsoft/fast-foundation'; +import { ProgressRingOptions } from '@microsoft/fast-foundation'; +import { Radio as Radio_2 } from '@microsoft/fast-foundation'; +import { RadioGroup as RadioGroup_2 } from '@microsoft/fast-foundation'; +import { RadioOptions } from '@microsoft/fast-foundation'; +import { Select } from '@microsoft/fast-foundation'; +import { SelectOptions } from '@microsoft/fast-foundation'; +import { Tab } from '@microsoft/fast-foundation'; +import { TabPanel } from '@microsoft/fast-foundation'; +import { Tabs } from '@microsoft/fast-foundation'; +import { TextArea as TextArea_2 } from '@microsoft/fast-foundation'; +import { TextField as TextField_2 } from '@microsoft/fast-foundation'; +import { TextFieldOptions } from '@microsoft/fast-foundation'; + +// @public +export const allComponents: { + jpBadge: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + jpButton: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry>; + jpCheckbox: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry>; + jpDataGrid: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + jpDataGridCell: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + jpDataGridRow: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + jpDivider: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + jpDropdown: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry>; + jpLink: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry>; + jpOption: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry>; + jpPanels: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + jpPanelTab: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + jpPanelView: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + jpProgressRing: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry>; + jpRadioGroup: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + jpRadio: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry>; + jpTag: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + jpTextArea: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + jpTextField: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry>; + register(container?: Container | undefined, ...rest: any[]): void; +}; + +// @public +export class Badge extends Badge_2 { + // @internal + connectedCallback(): void; +} + +// @public +export class Button extends Button_2 { + appearance: ButtonAppearance; + // @internal + attributeChangedCallback(attrName: string, oldVal: string, newVal: string): void; + // @internal + connectedCallback(): void; +} + +// @public +export type ButtonAppearance = 'primary' | 'secondary' | 'icon'; + +// @public +export class Checkbox extends Checkbox_2 { + // @internal + connectedCallback(): void; +} + +// @public +export class DataGrid extends DataGrid_2 { + // @internal + connectedCallback(): void; +} + +// @public +export class DataGridCell extends DataGridCell_2 { +} + +// @public +export class DataGridRow extends DataGridRow_2 { +} + +// @public +export class Divider extends Divider_2 { +} + +// @public +export class Dropdown extends Select { +} + +// @public +export type DropdownOptions = SelectOptions; + +// @public +export const jpBadge: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + +// @public +export const jpButton: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry>; + +// @public +export const jpCheckbox: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry>; + +// @public +export const jpDataGrid: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + +// @public +export const jpDataGridCell: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + +// @public +export const jpDataGridRow: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + +// @public +export const jpDivider: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + +// @public +export const jpDropdown: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry>; + +// @public +export const jpLink: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry>; + +// @public +export const jpOption: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry>; + +// @public +export const jpPanels: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + +// @public +export const jpPanelTab: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + +// @public +export const jpPanelView: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + +// @public +export const jpProgressRing: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry>; + +// @public +export const jpRadio: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry>; + +// @public +export const jpRadioGroup: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + +// @public +export const jpTag: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + +// @public +export const jpTextArea: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry; + +// @public +export const jpTextField: (overrideDefinition?: OverrideFoundationElementDefinition | undefined) => FoundationElementRegistry>; + +// @public +export class Link extends Anchor { +} + +// @public +export type LinkOptions = AnchorOptions; + +// @public +class Option_2 extends ListboxOption { + // @internal + connectedCallback(): void; +} +export { Option_2 as Option } + +// @public +export type OptionOptions = ListboxOptionOptions; + +// @public +export class Panels extends Tabs { + // @internal + connectedCallback(): void; +} + +// @public +export class PanelTab extends Tab { + // @internal + connectedCallback(): void; +} + +// @public +export class PanelView extends TabPanel { +} + +// @public +export class ProgressRing extends BaseProgress { + // @internal + attributeChangedCallback(attrName: string, oldVal: string, newVal: string): void; + // @internal + connectedCallback(): void; +} + +// @public +export function provideJupyterDesignSystem(element?: HTMLElement): DesignSystem; + +// @public +export class Radio extends Radio_2 { + // @internal + connectedCallback(): void; +} + +// @public +export class RadioGroup extends RadioGroup_2 { + // @internal + connectedCallback(): void; +} + +// @public +export class Tag extends Badge_2 { + // @internal + connectedCallback(): void; +} + +// @public +export class TextArea extends TextArea_2 { + // @internal + connectedCallback(): void; +} + +// @public +export class TextField extends TextField_2 { + // @internal + connectedCallback(): void; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/packages/components/docs/components.md b/packages/components/docs/components.md new file mode 100644 index 00000000..cec254c5 --- /dev/null +++ b/packages/components/docs/components.md @@ -0,0 +1,21 @@ +# Component Documentation List + +Here you can find a list of all the components currently available in the toolkit with links to documentation for each component. + +| Component | Doc Link | +| --------------- | ------------------------------------------------------------- | +| `badge` | [Badge Documentation](../src/badge/README.md) | +| `button` | [Button Documentation](../src/button/README.md) | +| `checkbox` | [Checkbox Documentation](../src/checkbox/README.md) | +| `data-grid` | [Data Grid Documentation](../src/data-grid/README.md) | +| `divider` | [Divider Documentation](../src/divider/README.md) | +| `dropdown` | [Dropdown Documentation](../src/dropdown/README.md) | +| `link` | [Link Documentation](../src/link/README.md) | +| `option` | [Option Documentation](../src/option/README.md) | +| `panels` | [Panels Documentation](../src/panels/README.md) | +| `progress-ring` | [Progress Ring Documentation](../src/progress-ring/README.md) | +| `radio` | [Radio Documentation](../src/radio/README.md) | +| `radio-group` | [Radio Group Documentation](../src/radio-group/README.md) | +| `tag` | [Tag Documentation](../src/tag/README.md) | +| `text-area` | [Text Area Documentation](../src/text-area/README.md) | +| `text-field` | [Text Field Documentation](../src/text-field/README.md) | diff --git a/packages/components/package.json b/packages/components/package.json new file mode 100644 index 00000000..6633f4c8 --- /dev/null +++ b/packages/components/package.json @@ -0,0 +1,72 @@ +{ + "name": "@jupyter/ui-components", + "version": "0.1.0", + "description": "A component library for building extensions in Jupyter frontends.", + "homepage": "https://github.com/microsoft/vscode-webview-ui-toolkit#readme", + "license": "BSD-3-Clause", + "author": "Project Jupyter", + "bugs": { + "url": "https://github.com/microsoft/vscode-webview-ui-toolkit/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/microsoft/vscode-webview-ui-toolkit.git" + }, + "main": "dist/esm/index.js", + "types": "dist/dts/index.d.ts", + "sideEffects": false, + "scripts": { + "start": "start-storybook -p 6006", + "build": "rollup -c && tsc -p ./tsconfig.json && npm run doc", + "build:docs": "build-storybook", + "deploy:docs": "npm run build:docs && gh-pages -d storybook-static", + "doc": "api-extractor run --local", + "fmt": "prettier --config ./.prettierrc --check \"**/*.{ts,js,md}\"", + "fmt:fix": "prettier --config ./.prettierrc --write \"**/*.{ts,js,md}\"", + "lint": "eslint . --ext .ts", + "lint:fix": "eslint . --ext .ts --fix", + "prepublishOnly": "npm run build", + "test": "jest --verbose --coverage" + }, + "dependencies": { + "@microsoft/fast-element": "^1.6.0", + "@microsoft/fast-foundation": "^2.21.0" + }, + "devDependencies": { + "@babel/core": "^7.14.3", + "@babel/plugin-proposal-decorators": "^7.14.2", + "@babel/preset-env": "^7.14.2", + "@babel/preset-typescript": "^7.13.0", + "@microsoft/api-extractor": "7.18.9", + "@microsoft/eslint-config-fast-dna": "^1.2.0", + "@rollup/plugin-commonjs": "^17.1.0", + "@rollup/plugin-node-resolve": "^11.2.0", + "@rollup/plugin-typescript": "^8.2.0", + "@storybook/addon-a11y": "^6.4.0-beta.4", + "@storybook/addon-actions": "^6.4.0-beta.4", + "@storybook/addon-essentials": "^6.4.0-beta.4", + "@storybook/addon-links": "^6.4.0-beta.4", + "@storybook/html": "^6.4.0-beta.4", + "@storybook/theming": "^6.4.0-beta.4", + "@types/jest": "^26.0.20", + "@typescript-eslint/eslint-plugin": "^2.23.0", + "@vscode/codicons": "^0.0.22", + "babel-jest": "^27.2.4", + "babel-loader": "^8.2.2", + "babel-plugin-transform-class-properties": "^6.24.1", + "eslint": "6.8.0", + "eslint-config-prettier": "6.10.1", + "eslint-plugin-import": "^2.25.2", + "gh-pages": "^3.1.0", + "jest": "^27.2.4", + "prettier": "^2.2.1", + "rollup": "^2.40.0", + "rollup-plugin-delete": "^2.0.0", + "rollup-plugin-filesize": "^9.1.1", + "rollup-plugin-terser": "^7.0.2", + "rollup-plugin-transform-tagged-template": "0.0.3", + "tslib": "^2.1.0", + "typescript": "4.3.5", + "webpack": "^4.46.0" + } +} diff --git a/packages/components/rollup.config.js b/packages/components/rollup.config.js new file mode 100644 index 00000000..a0cc491c --- /dev/null +++ b/packages/components/rollup.config.js @@ -0,0 +1,75 @@ +/* eslint-env node */ +import commonjs from '@rollup/plugin-commonjs'; +import filesize from 'rollup-plugin-filesize'; +import {nodeResolve} from '@rollup/plugin-node-resolve'; +import transformTaggedTemplate from 'rollup-plugin-transform-tagged-template'; +import typescript from '@rollup/plugin-typescript'; +import {terser} from 'rollup-plugin-terser'; +import del from 'rollup-plugin-delete'; + +// ----- Rollup Config ----- + +const parserOptions = { + sourceType: 'module', +}; + +export default [ + { + context: 'this', + input: 'src/index-rollup.ts', + output: [ + { + file: 'dist/toolkit.js', + format: 'esm', + }, + { + file: 'dist/toolkit.min.js', + format: 'esm', + plugins: [terser()], + }, + ], + plugins: [ + del({targets: 'dist/*'}), + nodeResolve(), + commonjs(), + typescript(), + transformTaggedTemplate({ + tagsToProcess: ['css'], + transformer: transformCSSFragment, + parserOptions, + }), + transformTaggedTemplate({ + tagsToProcess: ['html'], + transformer: transformHTMLFragment, + parserOptions, + }), + filesize({ + showMinifiedSize: false, + showBrotliSize: true, + }), + ], + }, +]; + +// ----- Helper Functions ----- + +function transformHTMLFragment(data) { + const spaceBeforeAfterAngleBrackets = /\s*([<>])\s*/g; // remove spaces before and after angle brackets + + data = data.replace(spaceBeforeAfterAngleBrackets, '$1'); + return data.replace(/\s{2,}/g, ' '); // Collapse all sequences to 1 space +} + +function transformCSSFragment(data) { + const newlines = /\n/g; + const separators = /\s*([{};])\s*/g; + const lastProp = /;\s*(\})/g; + const extraSpaces = /\s\s+/g; + const endingSpaces = / ?\s+$/g; + + data = data.replace(newlines, ''); + data = data.replace(separators, '$1'); + data = data.replace(lastProp, '$1'); + data = data.replace(endingSpaces, ' '); + return data.replace(extraSpaces, ' '); +} diff --git a/packages/components/src/badge/README.md b/packages/components/src/badge/README.md new file mode 100644 index 00000000..c4e09832 --- /dev/null +++ b/packages/components/src/badge/README.md @@ -0,0 +1,21 @@ +# Visual Studio Code Badge + +The `vscode-badge` component is used to highlight an item, attract attention, and/or flag status. + +## Attributes + +None + +## Usage + +A `vscode-badge` can only contain numbers to follow the conventions of the Visual Studio Code design language. + +If a component that labels an item with a string is desired, see the `vscode-tag` component. + +### Basic Usage + +[Interactive Storybook Example](https://microsoft.github.io/vscode-webview-ui-toolkit/?path=/story/library-badge--default) + +```html +1 +``` diff --git a/packages/components/src/badge/badge.stories.ts b/packages/components/src/badge/badge.stories.ts new file mode 100644 index 00000000..e867ad48 --- /dev/null +++ b/packages/components/src/badge/badge.stories.ts @@ -0,0 +1,33 @@ +// Copyright (c) Jupyter Development Team. +// Copyright (c) Microsoft Corporation. +// Distributed under the terms of the Modified BSD License. + +import {BadgeArgs, createBadge} from './fixtures/createBadge'; + +export default { + title: 'Library/Badge', + argTypes: { + label: {control: 'number'}, + }, + parameters: { + actions: { + disabled: true, + }, + }, +}; + +const Template = ({...args}: BadgeArgs) => { + return createBadge({...args}); +}; + +export const Default: any = Template.bind({}); +Default.args = { + label: '1', +}; +Default.parameters = { + docs: { + source: { + code: `1`, + }, + }, +}; diff --git a/packages/components/src/badge/badge.styles.ts b/packages/components/src/badge/badge.styles.ts new file mode 100644 index 00000000..7f2e91bf --- /dev/null +++ b/packages/components/src/badge/badge.styles.ts @@ -0,0 +1,45 @@ +// Copyright (c) Jupyter Development Team. +// Copyright (c) Microsoft Corporation. +// Distributed under the terms of the Modified BSD License. + +import {css} from '@microsoft/fast-element'; +import { + display, + ElementDefinitionContext, + FoundationElementDefinition, +} from '@microsoft/fast-foundation'; +import { + badgeBackground, + badgeForeground, + borderWidth, + buttonBorder, + designUnit, + fontFamily, + typeRampMinus1FontSize, + typeRampMinus1LineHeight, +} from '../design-tokens'; + +export const badgeStyles = ( + context: ElementDefinitionContext, + definition: FoundationElementDefinition +) => css` + ${display('inline-block')} :host { + box-sizing: border-box; + font-family: ${fontFamily}; + font-size: ${typeRampMinus1FontSize}; + line-height: ${typeRampMinus1LineHeight}; + } + .control { + align-items: center; + background-color: ${badgeBackground}; + border: calc(${borderWidth} * 1px) solid ${buttonBorder}; + border-radius: 100px; + box-sizing: border-box; + color: ${badgeForeground}; + display: flex; + height: calc(${designUnit} * 4px); + justify-content: center; + min-width: calc(${designUnit} * 4px); + padding: 0 calc(${designUnit} * 1px); + } +`; diff --git a/packages/components/src/badge/fixtures/createBadge.ts b/packages/components/src/badge/fixtures/createBadge.ts new file mode 100644 index 00000000..02a61ea2 --- /dev/null +++ b/packages/components/src/badge/fixtures/createBadge.ts @@ -0,0 +1,19 @@ +// Copyright (c) Jupyter Development Team. +// Copyright (c) Microsoft Corporation. +// Distributed under the terms of the Modified BSD License. + +import {Badge} from '../index'; + +export type BadgeArgs = { + label: string; +}; + +export function createBadge({label}: BadgeArgs) { + const badge = new Badge(); + + if (label) { + badge.textContent = label; + } + + return badge; +} diff --git a/packages/components/src/badge/index.ts b/packages/components/src/badge/index.ts new file mode 100644 index 00000000..a3631b87 --- /dev/null +++ b/packages/components/src/badge/index.ts @@ -0,0 +1,47 @@ +// Copyright (c) Jupyter Development Team. +// Copyright (c) Microsoft Corporation. +// Distributed under the terms of the Modified BSD License. + +import { + Badge as FoundationBadge, + badgeTemplate as template, +} from '@microsoft/fast-foundation'; +import {badgeStyles as styles} from './badge.styles'; + +/** + * The badge class. + * + * @public + */ +export class Badge extends FoundationBadge { + /** + * Component lifecycle method that runs when the component is inserted + * into the DOM. + * + * @internal + */ + public connectedCallback() { + super.connectedCallback(); + + // This will override any usage of the circular attribute + // inherited by the FAST Foundation Badge component so + // that Jupyter Badges are always circular + if (!this.circular) { + this.circular = true; + } + } +} + +/** + * The badge component registration. + * + * @remarks + * HTML Element: `` + * + * @public + */ +export const jpBadge = Badge.compose({ + baseName: 'badge', + template, + styles, +}); diff --git a/packages/components/src/button/README.md b/packages/components/src/button/README.md new file mode 100644 index 00000000..faf5d213 --- /dev/null +++ b/packages/components/src/button/README.md @@ -0,0 +1,98 @@ +# Visual Studio Code Button + +The `vscode-button` is a web component implementation of a [button element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button). The `vscode-button` also supports several visual appearancesโ€“โ€“primary, secondary, and icon. + +## Attributes + +| Attribute | Type | Description | +| ---------------- | ------- | --------------------------------------------------------------------------------------- | +| `appearance` | string | Determines the visual appearance _(primary, secondary, icon)_ of the button. | +| `aria-label` | string | Defines a label for buttons that screen readers can use. | +| `autofocus` | boolean | Determines if the element should receive document focus on page load. | +| `disabled` | boolean | Prevents the user from interacting with the buttonโ€“โ€“it cannot be pressed or focused. | +| `form` | string | See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes). | +| `formaction` | string | See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes). | +| `formenctype` | string | See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes). | +| `formmethod` | string | See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes). | +| `formnovalidate` | string | See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes). | +| `formtarget` | string | See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes). | +| `name` | string | See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes). | +| `type` | string | See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes). | +| `value` | string | See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes). | + +## Usage + +### Basic Usage + +[Interactive Storybook Example](https://microsoft.github.io/vscode-webview-ui-toolkit/?path=/story/library-button--default) + +```html +Button Text +``` + +### Appearance Attribute + +There are a number of visual appearances that the `vscode-button` can have. The default appearance is `primary`. + +[Interactive Storybook Example](https://microsoft.github.io/vscode-webview-ui-toolkit/?path=/story/library-button--default) + +```html +Button Text +Button Text + + + +``` + +### Autofocus Attribute + +[Interactive Storybook Example](https://microsoft.github.io/vscode-webview-ui-toolkit/?path=/story/library-button--with-autofocus) + +```html +Button Text +``` + +### Disabled Attribute + +[Interactive Storybook Example](https://microsoft.github.io/vscode-webview-ui-toolkit/?path=/story/library-button--with-disabled) + +```html +Button Text +``` + +### Start Icon + +An icon can be added to the left of Button text by adding an element with the attribute `slot="start"`. + +[Interactive Storybook Example](https://microsoft.github.io/vscode-webview-ui-toolkit/?path=/story/library-button--with-start-icon) + +```html + + + + Button Text + + +``` + +### Icon Only + +An icon can also fill the default slot of the Button component (instead of text) to create an icon button by using the `appearance="icon"` attribute and value. + +**โ—๏ธโ—๏ธโ—๏ธ Important โ—๏ธโ—๏ธโ—๏ธ** + +Because icon buttons do not have text that can be used by screen readers, they are not meaningfully/semantically accessible by default. + +An `aria-label` of "Icon Button" is automatically defined on all icon buttons so they are still technically accessible out of the box, however, a descriptive and meaningful label that fits the use case or context of the icon button should be defined to replace the default label. + +For example, if you're using an icon button to confirm a state change, adding an `aria-label` with the value "Confirm" or "Confirm Changes" would be appropriate. + +[Interactive Storybook Example](https://microsoft.github.io/vscode-webview-ui-toolkit/?path=/story/library-button--with-icon-only) + +```html + + + + + +``` diff --git a/packages/components/src/button/button.stories.ts b/packages/components/src/button/button.stories.ts new file mode 100644 index 00000000..09149c10 --- /dev/null +++ b/packages/components/src/button/button.stories.ts @@ -0,0 +1,119 @@ +// Copyright (c) Jupyter Development Team. +// Copyright (c) Microsoft Corporation. +// Distributed under the terms of the Modified BSD License. + +import {action} from '@storybook/addon-actions'; +import {ButtonArgs, createButton} from './fixtures/createButton'; + +export default { + title: 'Library/Button', + argTypes: { + label: {control: 'text'}, + appearance: { + control: { + type: 'select', + options: ['Primary', 'Secondary', 'Icon'], + }, + }, + isDisabled: {control: 'boolean'}, + isAutoFocused: {control: 'boolean'}, + startIcon: {control: 'boolean'}, + iconOnly: {control: 'boolean'}, + ariaLabel: {control: 'text'}, + onClick: { + action: 'clicked', + table: { + disable: true, + }, + }, + }, +}; + +const Template = ({...args}: ButtonArgs) => { + return createButton({...args}); +}; + +export const Default: any = Template.bind({}); +Default.args = { + label: 'Button Text', + appearance: 'Primary', + isDisabled: false, + isAutoFocused: false, + startIcon: false, + iconOnly: false, + onClick: action('button-clicked'), +}; +Default.parameters = { + docs: { + source: { + code: `Button Text`, + }, + }, +}; + +export const Secondary: any = Template.bind({}); +Secondary.args = { + ...Default.args, + appearance: 'Secondary', +}; +Secondary.parameters = { + docs: { + source: { + code: `Button Text`, + }, + }, +}; + +export const WithAutofocus: any = Template.bind({}); +WithAutofocus.args = { + ...Default.args, + isAutoFocused: true, +}; +WithAutofocus.parameters = { + docs: { + source: { + code: `Button Text`, + }, + }, +}; + +export const WithDisabled: any = Template.bind({}); +WithDisabled.args = { + ...Default.args, + isDisabled: true, +}; +WithDisabled.parameters = { + docs: { + source: { + code: `Button Text`, + }, + }, +}; + +export const WithStartIcon: any = Template.bind({}); +WithStartIcon.args = { + ...Default.args, + startIcon: true, +}; +WithStartIcon.parameters = { + docs: { + source: { + code: `\n\n\n\tButton Text\n\t\n`, + }, + }, +}; + +export const WithIconOnly: any = Template.bind({}); +WithIconOnly.args = { + ...Default.args, + appearance: 'Icon', + iconOnly: true, + ariaLabel: 'Confirm', +}; +WithIconOnly.parameters = { + docs: { + source: { + code: `\n\n\n\t\n`, + }, + }, +}; diff --git a/packages/components/src/button/button.styles.ts b/packages/components/src/button/button.styles.ts new file mode 100644 index 00000000..cd5d4565 --- /dev/null +++ b/packages/components/src/button/button.styles.ts @@ -0,0 +1,189 @@ +// Copyright (c) Jupyter Development Team. +// Copyright (c) Microsoft Corporation. +// Distributed under the terms of the Modified BSD License. + +import {css} from '@microsoft/fast-element'; +import { + ButtonOptions, + disabledCursor, + display, + ElementDefinitionContext, + focusVisible, +} from '@microsoft/fast-foundation'; +import { + borderWidth, + buttonBorder, + buttonIconBackground, + buttonIconCornerRadius, + buttonIconFocusBorderOffset, + buttonIconHoverBackground, + buttonIconPadding, + buttonPaddingHorizontal, + buttonPaddingVertical, + buttonPrimaryBackground, + buttonPrimaryForeground, + buttonPrimaryHoverBackground, + buttonSecondaryBackground, + buttonSecondaryForeground, + buttonSecondaryHoverBackground, + cornerRadius, + designUnit, + disabledOpacity, + focusBorder, + fontFamily, + foreground, + typeRampBaseFontSize, + typeRampBaseLineHeight, +} from '../design-tokens'; + +/** + * @internal + */ +const BaseButtonStyles = css` + ${display('inline-flex')} :host { + outline: none; + font-family: ${fontFamily}; + font-size: ${typeRampBaseFontSize}; + line-height: ${typeRampBaseLineHeight}; + color: ${buttonPrimaryForeground}; + background: ${buttonPrimaryBackground}; + border-radius: calc(${cornerRadius} * 1px); + fill: currentColor; + cursor: pointer; + } + .control { + background: transparent; + height: inherit; + flex-grow: 1; + box-sizing: border-box; + display: inline-flex; + justify-content: center; + align-items: center; + padding: ${buttonPaddingVertical} ${buttonPaddingHorizontal}; + white-space: wrap; + outline: none; + text-decoration: none; + border: calc(${borderWidth} * 1px) solid ${buttonBorder}; + color: inherit; + border-radius: inherit; + fill: inherit; + cursor: inherit; + font-family: inherit; + max-width: 300px; + } + :host(:hover) { + background: ${buttonPrimaryHoverBackground}; + } + :host(:active) { + background: ${buttonPrimaryBackground}; + } + .control: ${focusVisible} { + outline: calc(${borderWidth} * 1px) solid ${focusBorder}; + outline-offset: calc(${borderWidth} * 2px); + } + .control::-moz-focus-inner { + border: 0; + } + :host([disabled]) { + opacity: ${disabledOpacity}; + background: ${buttonPrimaryBackground}; + cursor: ${disabledCursor}; + } + .content { + display: flex; + } + .start { + display: flex; + } + ::slotted(svg), + ::slotted(span) { + width: calc(${designUnit} * 4px); + height: calc(${designUnit} * 4px); + } + .start { + margin-inline-end: 8px; + } +`; + +/** + * @internal + */ +const PrimaryButtonStyles = css` + :host([appearance='primary']) { + background: ${buttonPrimaryBackground}; + color: ${buttonPrimaryForeground}; + } + :host([appearance='primary']:hover) { + background: ${buttonPrimaryHoverBackground}; + } + :host([appearance='primary']:active) .control:active { + background: ${buttonPrimaryBackground}; + } + :host([appearance='primary']) .control:${focusVisible} { + outline: calc(${borderWidth} * 1px) solid ${focusBorder}; + outline-offset: calc(${borderWidth} * 2px); + } + :host([appearance='primary'][disabled]) { + background: ${buttonPrimaryBackground}; + } +`; + +/** + * @internal + */ +const SecondaryButtonStyles = css` + :host([appearance='secondary']) { + background: ${buttonSecondaryBackground}; + color: ${buttonSecondaryForeground}; + } + :host([appearance='secondary']:hover) { + background: ${buttonSecondaryHoverBackground}; + } + :host([appearance='secondary']:active) .control:active { + background: ${buttonSecondaryBackground}; + } + :host([appearance='secondary']) .control:${focusVisible} { + outline: calc(${borderWidth} * 1px) solid ${focusBorder}; + outline-offset: calc(${borderWidth} * 2px); + } + :host([appearance='secondary'][disabled]) { + background: ${buttonSecondaryBackground}; + } +`; + +/** + * @internal + */ +const IconButtonStyles = css` + :host([appearance='icon']) { + background: ${buttonIconBackground}; + border-radius: ${buttonIconCornerRadius}; + color: ${foreground}; + } + :host([appearance='icon']:hover) { + background: ${buttonIconHoverBackground}; + } + :host([appearance='icon']) .control { + padding: ${buttonIconPadding}; + } + :host([appearance='icon']:active) .control:active { + background: ${buttonIconHoverBackground}; + } + :host([appearance='icon']) .control:${focusVisible} { + outline: calc(${borderWidth} * 1px) solid ${focusBorder}; + outline-offset: ${buttonIconFocusBorderOffset}; + } + :host([appearance='icon'][disabled]) { + background: ${buttonIconBackground}; + } +`; + +export const buttonStyles = ( + context: ElementDefinitionContext, + definition: ButtonOptions +) => css` + ${BaseButtonStyles} + ${PrimaryButtonStyles} + ${SecondaryButtonStyles} + ${IconButtonStyles} +`; diff --git a/packages/components/src/button/fixtures/createButton.ts b/packages/components/src/button/fixtures/createButton.ts new file mode 100644 index 00000000..57078dce --- /dev/null +++ b/packages/components/src/button/fixtures/createButton.ts @@ -0,0 +1,63 @@ +// Copyright (c) Jupyter Development Team. +// Copyright (c) Microsoft Corporation. +// Distributed under the terms of the Modified BSD License. + +import {Button, ButtonAppearance} from '../index'; +import { + createCodiconIcon, + focusObserver, +} from '../../utilities/storybook/index'; + +export type ButtonArgs = { + label: string; + appearance: ButtonAppearance; + isDisabled: boolean; + isAutoFocused: boolean; + startIcon: boolean; + iconOnly: boolean; + ariaLabel: string; + onClick: any; +}; + +export function createButton({ + label, + appearance, + isDisabled, + isAutoFocused, + startIcon, + iconOnly, + ariaLabel, + onClick, +}: ButtonArgs) { + const button = new Button(); + + if (label && !iconOnly) { + button.textContent = label; + } + if (appearance) { + button.setAttribute('appearance', appearance.toLowerCase()); + } + if (isDisabled) { + button.setAttribute('disabled', ''); + } + if (isAutoFocused) { + button.setAttribute('autofocus', ''); + // Focus observer will force focus if button focus is lost after page load + focusObserver(button); + } + if (startIcon) { + const start = createCodiconIcon({ + iconName: 'add', + slotName: 'start', + }); + button.appendChild(start); + } + if (iconOnly) { + const icon = createCodiconIcon({iconName: 'check'}); + button.appendChild(icon); + button.setAttribute('aria-label', ariaLabel); + } + button.addEventListener('click', onClick); + + return button; +} diff --git a/packages/components/src/button/index.ts b/packages/components/src/button/index.ts new file mode 100644 index 00000000..e556ddc0 --- /dev/null +++ b/packages/components/src/button/index.ts @@ -0,0 +1,104 @@ +// Copyright (c) Jupyter Development Team. +// Copyright (c) Microsoft Corporation. +// Distributed under the terms of the Modified BSD License. + +import {attr} from '@microsoft/fast-element'; +import { + ButtonOptions, + Button as FoundationButton, + buttonTemplate as template, +} from '@microsoft/fast-foundation'; +import {buttonStyles as styles} from './button.styles'; + +/** + * Types of button appearance. + * @public + */ +export type ButtonAppearance = 'primary' | 'secondary' | 'icon'; + +/** + * The button class. + * + * @public + */ +export class Button extends FoundationButton { + /** + * The appearance the button should have. + * + * @public + */ + @attr public appearance: ButtonAppearance; + + /** + * Component lifecycle method that runs when the component is inserted + * into the DOM. + * + * @internal + */ + public connectedCallback() { + super.connectedCallback(); + + // If the appearance property has not been set, set it to the + // value of the appearance attribute. + if (!this.appearance) { + const appearanceValue = this.getAttribute('appearance'); + this.appearance = appearanceValue as ButtonAppearance; + } + } + + /** + * Component lifecycle method that runs when an attribute of the + * element is changed. + * + * @param attrName - The attribute that was changed + * @param oldVal - The old value of the attribute + * @param newVal - The new value of the attribute + * + * @internal + */ + public attributeChangedCallback( + attrName: string, + oldVal: string, + newVal: string + ) { + // In the case when an icon only button is created add a default ARIA + // label to the button since there is no longer button text to use + // as the label + if (attrName === 'appearance' && newVal === 'icon') { + // Only set the ARIA label to the default text if an aria-label attribute + // does not exist on the button + const ariaLabelValue = this.getAttribute('aria-label'); + if (!ariaLabelValue) { + this.ariaLabel = 'Icon Button'; + } + } + + // In the case when the aria-label attribute has been defined on the + // , this will programmatically propogate the value to + // the