planning
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s

This commit is contained in:
2024-10-14 09:15:30 +02:00
parent bcba00a730
commit 6e64e138e2
21059 changed files with 2317811 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2
[*.md]
# Allow <br/> from Markdown
trim_trailing_whitespace = false

View File

@@ -0,0 +1,14 @@
[ignore]
.*/node_modules/.*
.*/lib/.*
.*/__tests__/.*
[include]
node_modules
[libs]
interfaces
[options]
esproposal.class_instance_fields=enable
esproposal.class_static_fields=enable

View File

@@ -0,0 +1,30 @@
name: Build
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 8.x
- 10.x
- 12.x
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: |
yarn install \
--non-interactive \
--frozen-lockfile
- name: Test
run: yarn test
env:
CI: true

View File

@@ -0,0 +1 @@
12

View File

@@ -0,0 +1,7 @@
{
"javascript.validate.enable": false,
"typescript.format.enable": false,
"typescript.validate.enable": false,
"flow.useBundledFlow": false,
"eslint.enable": true
}

View File

@@ -0,0 +1,47 @@
# Changelog of `react-topbar-progress-indicator`
## 4.1.1 - 2022-03-07
- Fix TypeScript declaration: Remove unnecessary generic args [#28](https://github.com/MoOx/react-topbar-progress-indicator/pull/28) by [@lpsinger](https://github.com/lpsinger)
## 4.1.0 - 2020-01-31
- Add Typescript declaration [#10](https://github.com/MoOx/react-topbar-progress-indicator/pull/10) by @komsitr
## 4.0.2 - 2019-09-30
- Fix: avoid arrow function to improve browser compatibility
## 4.0.1 - 2019-08-16
- Fix: use var instead of const/let for compatibility as this module is not transpiled
## 4.0.0 - 2019-08-16
- Switch from a React class to a function with `useEffect()` (require React 16.8)
### Internal
- No more babel, just vanilla JS (typed with flow annotations in comments)
## 3.0.0 - 2019-08-16
- React 16.9.0 compat (replace `componentWillMount` by `componentDidMount`) [#5](https://github.com/MoOx/react-topbar-progress-indicator/issues/5)
### Internal
- Test on node 8 & 10
- Babel 6 -> 7
- Test ava -> jest
- Removed eslint & nyc on the codebase (unecessary considering the non complexity of the code of this component)
- Added prettier
## 2.0.0 - 2016-04-01
- react 16 compat
- update props type via babel-plugin-flow-react-proptypes
- use of babel-preset-env for transpilation instead of es2015
## 1.0.0 - 2016-04-01
✨ Initial release

View File

@@ -0,0 +1,78 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and our
community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and
expression, level of experience, education, socio-economic status, nationality,
personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, or to ban temporarily or permanently any
contributor for other behaviors that they deem inappropriate, threatening,
offensive, or harmful.
## Scope
This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at <opensource-conduct@moox.io>. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an
incident. Further details of specific enforcement policies may be posted
separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.4, available at
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

View File

@@ -0,0 +1,103 @@
# Contributing Guide to `react-topbar-progress-indicator`
<!--
In case of copy/paste, remember to update:
- https://github.com/MoOx/react-topbar-progress-indicator
- react-topbar-progress-indicator
-->
We love your input! We want to make contributing to this project as easy and
transparent as possible, whether it's:
- Reporting a bug
- Discussing the current state of the code
- Submitting a fix
- Proposing new features
- Becoming a maintainer
We use GitHub to
- host code
- track issues and feature requests
- accept pull requests.
- tag & publish release as well as pushing those to npm.
## Reporting bugs or requesting a feature
We use GitHub issues to track public bugs or discuss about new features. Please
write bug reports or feature requests with detail, background, and sample code
if necessary.
Just try to
[open a new issue](https://github.com/MoOx/react-topbar-progress-indicator/issues/new/choose)
& follow the instructions that should be prefilled for
[bug](.github/ISSUE_TEMPLATE/bug.md) or
[feature request](.github/ISSUE_TEMPLATE/feature.md).
People _love_ thorough bug reports. Not even kidding.
## Fixing bugs & implementing features
We use [Github flow](https://guides.github.com/introduction/flow/index.html), so
most code changes happen through Pull Requests.
[Pull Requests](https://help.github.com/en/articles/about-pull-requests) are the
best way to propose changes to the codebase since they notify watchers & allow
contributors to discuss about changes.
We actively welcome your pull requests.
To make a pull request, you need to:
1. [Fork the repo](https://help.github.com/en/articles/fork-a-repo)
2. Clone it and install dependencies
```console
git clone https://github.com/MoOx/react-topbar-progress-indicator
cd react-native
yarn
```
3. Create a local branch, from `master` (unless specified differently)
```console
git checkout -b <name-of-your-branch>
```
4. Add your changes!
- If you've added code that should be tested, add tests.
- If you've changed APIs, update the documentation.
5. Ensure the everything is still fine.
```console
yarn test
```
6. Commit & push your branch online
```console
git add -A .
git commit -m "Your commit message"
```
7. [Create a pull request](https://help.github.com/en/articles/creating-a-pull-request)
_If you are new to Git or GitHub, we encourage you to have a look to
[makeapullrequest.com](http://makeapullrequest.com)._
## Code styling
Everything as been automated: as soon as you commit, everything should be
automatically reformated if necessary (thanks to a transparent git hook) so we
don't have to think about it!
## Licensing
By contributing, you agree that your contributions will be licensed under our
MIT License.
When you submit code changes, your submissions are understood to be under the
same [MIT License](./LICENSE) that covers the project. Feel free to contact the
maintainers if that's a concern.

20
node_modules/react-topbar-progress-indicator/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2016 "MoOx" Maxime Thirouin
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.

97
node_modules/react-topbar-progress-indicator/README.md generated vendored Normal file
View File

@@ -0,0 +1,97 @@
# react-topbar-progress-indicator
[![Build Status](https://github.com/MoOx/react-topbar-progress-indicator/workflows/Build/badge.svg)](https://github.com/MoOx/react-topbar-progress-indicator/actions)
[![Version](https://img.shields.io/npm/v/react-topbar-progress-indicator.svg)](https://github.com/MoOx/react-topbar-progress-indicator/blob/master/CHANGELOG.md)
> `topbar` progress indicator as a React component
Will simply `show()` and `hide()` [topbar](https://github.com/buunguyen/topbar)
when the component is respectively mounted and unmounted.
**Since topbar is a singleton, using `<TopBarProgress />` multiples times will
take this in consideration. This means that `hide()` will only be called when
all `<TopBarProgress />` have been unmounted.**
For example, if you render 2 `<TopBarProgress />` and unmount one (eg: you are doing 2
async things and only once is done), `hide()` won't be called.
You will need to have both instances unmounted.
## Installation
```console
npm install react-topbar-progress-indicator
## or
yarn add react-topbar-progress-indicator
```
## Usage
```js
import TopBarProgress from "react-topbar-progress-indicator";
TopBarProgress.config({
barColors: {
"0": "#fff",
"1.0": "#fff"
},
shadowBlur: 5
});
const YourThing = () => {
return <div>{this.state.loading && <TopBarProgress />}</div>;
};
```
### Config
Since `topbar` is a singleton, you should configure via `Topbar.config()`.
#### `barThickness` (Integer, px)
The progress bar thickness in `px` (default: 3).
#### `barColors` (Object { progress: color })
Object of gradient color stops used to draw the progress bar.
Example:
```js
barColors: {
"0": "#f00",
"0.5": "#0f0",
"1.0": "#00f",
},
```
#### `shadowBlur`
Integer of the shadow blur in `px` (default: `10`).
#### `shadowColor`
String that represent the shadow color (hexa, default: `#000`).
---
## Changelog
Check the [changelog](./CHANGELOG.md) for more informations about recent
releases.
You might also find [releases notes on GitHub](https://github.com/MoOx/react-topbar-progress-indicator/releases).
## Contribute
_⇄ Pull requests and ★ Stars are always welcome._
Please read the [contribution guidelines](./CONTRIBUTING.md) before contributing.
## Code of Conduct
We want the community to be friendly and respectful to each other. Please read
[our full code of conduct](./CODE_OF_CONDUCT.md) so that you can understand what
actions will and will not be tolerated.
## License
[MIT](./LICENSE)

View File

@@ -0,0 +1,7 @@
declare module "topbar" {
declare module.exports: {
show: () => void,
hide: () => void,
config: (?Object) => void
};
}

View File

@@ -0,0 +1,45 @@
{
"name": "react-topbar-progress-indicator",
"version": "4.1.1",
"description": "topbar progress indicator React component",
"keywords": [
"react",
"topbar",
"progress",
"progressbar",
"loading",
"loader",
"indicator"
],
"author": "Maxime Thirouin",
"license": "MIT",
"repository": "https://github.com/MoOx/react-topbar-progress-indicator.git",
"main": "src/index.js",
"types": "src/index.d.ts",
"dependencies": {
"topbar": "^0.1.3"
},
"devDependencies": {
"flow-bin": "^0.105.2",
"husky": "^3.0.3",
"jest": "^24.9.0",
"npmpub": "^5.0.0",
"prettier": "^1.18.2",
"pretty-quick": "^1.11.1",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-test-renderer": "^16.9.0"
},
"peerDependencies": {
"react": ">=16.8.0"
},
"scripts": {
"test": "flow src && jest src",
"release": "npmpub"
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
}
}

View File

@@ -0,0 +1,114 @@
const React = require("react");
const renderer = require("react-test-renderer");
const ReactTopBar = require("../index");
test("ReactTopBar can show topbar", () => {
let count = 0;
const topbar = {
show() {
count++;
},
hide() {}
};
let root;
renderer.act(() => {
root = renderer.create(
React.createElement(ReactTopBar, { topbar: topbar })
);
});
renderer.act(() => {
root.unmount();
});
expect(count).toBe(1);
});
test("ReactTopBar can hide topbar", () => {
let count = 0;
const topbar = {
show() {},
hide() {
count++;
}
};
let root;
renderer.act(() => {
root = renderer.create(
React.createElement(ReactTopBar, { topbar: topbar })
);
});
renderer.act(() => {
root.unmount();
});
expect(count).toBe(1);
});
test("ReactTopBar can show/hide topbar", () => {
let count = 0;
const topbar = {
show() {
count++;
},
hide() {
count++;
}
};
let root;
renderer.act(() => {
root = renderer.create(
React.createElement(ReactTopBar, { topbar: topbar })
);
});
renderer.act(() => {
root.unmount();
});
expect(count).toBe(2);
});
test("ReactTopBar can show/hide topbar even with multiples call, but once", () => {
let count = 0;
const topbar = {
show() {
count++;
},
hide() {
count++;
}
};
let root;
renderer.act(() => {
root = renderer.create(
React.createElement(ReactTopBar, { topbar: topbar })
);
});
let root2;
renderer.act(() => {
root2 = renderer.create(
React.createElement(ReactTopBar, { topbar: topbar })
);
});
renderer.act(() => {
root.unmount();
});
renderer.act(() => {
root2.unmount();
});
expect(count).toBe(2);
});
test("ReactTopBar exposes topbar config function", () => {
expect(typeof ReactTopBar.config).toBe("function");
});

View File

@@ -0,0 +1,14 @@
/// <reference types="react" />
import * as React from "react";
export interface TopBarConfig {
barThickness?: number;
barColors?: any;
shadowBlur?: number;
shadowColor?: string;
}
export default class TopBarProgress extends React.Component {
static config(config: TopBarConfig): void;
}

View File

@@ -0,0 +1,47 @@
// @flow
var React = require("react");
// topbar require window, so here is an universal workaround
var topbar =
typeof window === "undefined"
? {
show: function() {},
hide: function() {},
config: function() {}
}
: require("topbar");
var semaphore /*: number*/ = 0;
/*::
type Props = {
topbar?: typeof topbar
};
*/
var getTopBar = function(props /*: Props*/) /*: typeof topbar*/ {
return props.topbar || topbar;
};
function TopBar(props /*: Props */) {
React.useEffect(function() {
if (semaphore === 0) {
getTopBar(props).show();
}
semaphore++;
return function() {
semaphore--;
if (semaphore === 0) {
getTopBar(props).hide();
}
};
}, []);
return null;
}
TopBar.config = topbar.config;
module.exports = TopBar;