From 005852e3a2e5aa31d457452bd8602df4e05675c5 Mon Sep 17 00:00:00 2001 From: afeiship <1290657123@qq.com> Date: Wed, 3 Mar 2021 09:54:00 +0800 Subject: [PATCH] chore: use jswork scope --- .babelrc | 21 ++-- .gitignore | 4 + .npmignore | 17 +++- .prettierrc | 1 + .release-it.json | 14 +++ Gemfile | 5 - LICENSE.txt | 21 ++++ README.md | 88 ++++++++++++++--- Rakefile | 4 - __tests__/basic.test.js | 12 --- __tests__/index.spec.js | 12 +++ bin/docs.rb | 48 +++++++++ build/TEMPLATE.md | 50 ++++++++++ build/base.js | 29 ++++++ build/build.js | 21 ---- build/{dev.js => development.js} | 10 +- build/docs.js | 20 +++- build/index.js | 15 --- build/markdown.js | 30 ++++++ build/production.js | 22 +++++ build/release.js | 6 -- dist/index.js | 11 ++- dist/style.scss | 1 + docs/assets/bundle.543799c6ea8bb88b1d33.js | 35 ------- docs/assets/bundle.cd333132d4f9a48f679b.js | 71 ++++++++++++++ .../styles/main.31d4a06ab3a4445442c3.css | 2 + .../styles/main.aef6c218a0305c7bb1f1.css | 2 - docs/index.html | 17 +--- docs/sw.js | 3 + jest.config.js | 10 ++ jest.setup.js | 3 + jsconfig.json | 5 + package.json | 97 ++++++++++++------- public/assets/style.scss | 37 ++----- public/index.ejs | 7 +- public/index.js | 48 ++++++--- src/components/index.js | 27 ++++-- src/components/style.scss | 1 + webpack.config.babel.js | 3 +- 39 files changed, 589 insertions(+), 241 deletions(-) create mode 100644 .release-it.json delete mode 100644 Gemfile create mode 100644 LICENSE.txt delete mode 100644 Rakefile delete mode 100644 __tests__/basic.test.js create mode 100644 __tests__/index.spec.js create mode 100755 bin/docs.rb create mode 100644 build/TEMPLATE.md create mode 100644 build/base.js delete mode 100644 build/build.js rename build/{dev.js => development.js} (62%) delete mode 100644 build/index.js create mode 100644 build/markdown.js create mode 100644 build/production.js delete mode 100644 build/release.js delete mode 100644 docs/assets/bundle.543799c6ea8bb88b1d33.js create mode 100644 docs/assets/bundle.cd333132d4f9a48f679b.js create mode 100644 docs/assets/styles/main.31d4a06ab3a4445442c3.css delete mode 100644 docs/assets/styles/main.aef6c218a0305c7bb1f1.css create mode 100644 docs/sw.js create mode 100644 jest.config.js create mode 100644 jest.setup.js create mode 100644 jsconfig.json diff --git a/.babelrc b/.babelrc index c8c5fe5..ed26ba0 100644 --- a/.babelrc +++ b/.babelrc @@ -1,17 +1,14 @@ { - "presets": ["@babel/preset-env", "@babel/react"], - "plugins": [ - [ - "@babel/plugin-proposal-decorators", - { - "legacy": true - } - ], - [ - "@babel/plugin-proposal-class-properties", + "presets": [[ + "@babel/preset-env", { - "loose": true + "targets": { "browsers": [ "last 2 versions" ] } } - ] + ], "@babel/react"], + "plugins": [ + [ "@babel/plugin-proposal-decorators", { "legacy": true } ], + [ "@babel/plugin-proposal-class-properties", { "loose": true } ], + "@babel/plugin-proposal-optional-chaining", + "@babel/plugin-transform-parameters" ] } diff --git a/.gitignore b/.gitignore index 736ebbc..dfc9f5b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,9 @@ Gemfile.lock yarn-error.log package-lock.json .DS_Store +dist + +# editor .idea .vscode +.history diff --git a/.npmignore b/.npmignore index 71025a2..6289597 100644 --- a/.npmignore +++ b/.npmignore @@ -8,9 +8,8 @@ postcss.config.js Rakefile **/npm-debug.log **/node_modules -test -__test__ -__tests__ + +bin src docs build @@ -19,6 +18,18 @@ public tests postcss.config.js webpack.config.babel.js +example +examples +# vscode +jsconfig.json +.history +# tests +test +__test__ +__tests__ +jest.config.js +jest.setup.js +.release-it.json diff --git a/.prettierrc b/.prettierrc index cc1879e..afe7997 100644 --- a/.prettierrc +++ b/.prettierrc @@ -6,6 +6,7 @@ "jsxBracketSameLine": true, "tabWidth": 2, "semi": true, + "quoteProps": "consistent", "singleQuote": true, "overrides": [ { diff --git a/.release-it.json b/.release-it.json new file mode 100644 index 0000000..ed9a004 --- /dev/null +++ b/.release-it.json @@ -0,0 +1,14 @@ +{ + "hooks": { + "after:init": [ + "t2k" + ], + "after:bump": [ + "npm run docs", + "npm run build" + ] + }, + "github": { + "release": true + } +} \ No newline at end of file diff --git a/Gemfile b/Gemfile deleted file mode 100644 index 2b5ea5a..0000000 --- a/Gemfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://rubygems.org' - -gem 'fileutils' -gem 'sshkit' -gem 'semver' diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..be1fbb9 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020 afei <1290657123@qq.com> + +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 index 81114d0..bc7edd6 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,43 @@ # react-status-manager > React component for status manager. -## install +[![version][version-image]][version-url] +[![license][license-image]][license-url] +[![size][size-image]][size-url] +[![download][download-image]][download-url] + +## installation ```shell -npm install -S afeiship/react-status-manager +npm install -S @jswork/react-status-manager ``` +## properties +| Name | Type | Required | Default | Description | +| --------- | ------ | -------- | ------- | ------------------------------------- | +| className | string | false | - | The extended className for component. | +| items | array | false | [] | The status list. | +| value | any | false | - | Current status value. | +| nodeName | any | false | 'div' | The node name. | +| virtual | bool | false | false | If use React.Fragment element. | + + ## usage 1. import css ```scss - @import "~react-status-manager/style.scss"; + @import "~@jswork/react-status-manager/dist/style.css"; + + // or use sass + @import "~@jswork/react-status-manager/dist/style.scss"; // customize your styles: $react-status-manager-options: () ``` 2. import js ```js - import ReactStatusManager from '../src/main'; - import ReactDOM from 'react-dom'; + import ReactDemokit from '@jswork/react-demokit'; import React from 'react'; + import ReactDOM from 'react-dom'; + import ReactStatusManager from '@jswork/react-status-manager'; import './assets/style.scss'; class App extends React.Component { @@ -63,7 +82,9 @@ npm install -S afeiship/react-status-manager render() { return ( -
P(l,n))void 0!==u&&0>P(u,l)?(e[r]=u,e[a]=n,r=a):(e[r]=l,e[i]=n,r=i);else{if(!(void 0!==u&&0>P(u,n)))break e;e[r]=u,e[a]=n,r=a}}}return t}return null}function P(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var O=[],N=[],R=1,j=null,M=3,z=!1,I=!1,D=!1;function F(e){for(var t=S(N);null!==t;){if(null===t.callback)C(N);else{if(!(t.startTime<=e))break;C(N),t.sortIndex=t.expirationTime,T(O,t)}t=S(N)}}function L(e){if(D=!1,F(e),!I)if(null!==S(O))I=!0,r(A);else{var t=S(N);null!==t&&o(L,t.startTime-e)}}function A(e,n){I=!1,D&&(D=!1,i()),z=!0;var r=M;try{for(F(n),j=S(O);null!==j&&(!(j.expirationTime>n)||e&&!l());){var a=j.callback;if(null!==a){j.callback=null,M=j.priorityLevel;var u=a(j.expirationTime<=n);n=t.unstable_now(),"function"==typeof u?j.callback=u:j===S(O)&&C(O),F(n)}else C(O);j=S(O)}if(null!==j)var c=!0;else{var s=S(N);null!==s&&o(L,s.startTime-n),c=!1}return c}finally{j=null,M=r,z=!1}}function U(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var W=a;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){I||z||(I=!0,r(A))},t.unstable_getCurrentPriorityLevel=function(){return M},t.unstable_getFirstCallbackNode=function(){return S(O)},t.unstable_next=function(e){switch(M){case 1:case 2:case 3:var t=3;break;default:t=M}var n=M;M=t;try{return e()}finally{M=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=W,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=M;M=e;try{return t()}finally{M=n}},t.unstable_scheduleCallback=function(e,n,l){var a=t.unstable_now();if("object"==typeof l&&null!==l){var u=l.delay;u="number"==typeof u&&0a?(e.sortIndex=u,T(N,e),null===S(O)&&e===S(N)&&(D?i():D=!0,o(L,u-a))):(e.sortIndex=l,T(O,e),I||z||(I=!0,r(A))),e},t.unstable_shouldYield=function(){var e=t.unstable_now();F(e);var n=S(O);return n!==j&&null!==j&&null!==n&&null!==n.callback&&n.startTime<=e&&n.expirationTimeWizard
-
+