This commit is contained in:
2026-03-18 20:54:43 +01:00
parent b3c8b77f12
commit 9fe656b34c
8058 changed files with 912898 additions and 23 deletions
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 Anton Korzunov
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.
+45
View File
@@ -0,0 +1,45 @@
react-style-singleton
====
__300b__ with all dependencies, minified and gzipped
Creates a style component with internal _tracker_.
- Adds styles to the browser on the __first__ instance mount.
- Removes after the __last__ instance unmount.
- Thus helps you deliver styles you need to the customer, and clean up later.
- Is not server-side rendering compatible!
# API
## Component
```js
import {styleSingleton} from 'react-style-singleton'
const Style = styleSingleton();
export const App = () => (
<Style styles={'body {color:red}'} />
);
```
## Hook
```js
import {styleHookSingleton} from 'react-style-singleton';
const useStyle = styleHookSingleton();
const useAnotherStyle = styleHookSingleton();
export const App = () => {
useStyle('div {color:red}');
useAnotherStyle('body { background-color:red }');
return (<div />);
}
```
# License
MIT
+90
View File
@@ -0,0 +1,90 @@
{
"name": "react-style-singleton",
"version": "2.2.3",
"description": "Just create a single stylesheet...",
"main": "dist/es5/index.js",
"types": "dist/es5/index.d.ts",
"jsnext:main": "dist/es2015/index.js",
"module": "dist/es2015/index.js",
"module:es2019": "dist/es2019/index.js",
"files": [
"dist"
],
"scripts": {
"dev": "lib-builder dev",
"test": "jest",
"test:ci": "jest --runInBand --coverage",
"build": "lib-builder build && yarn size:report",
"release": "yarn build && yarn test",
"size": "npx size-limit",
"size:report": "npx size-limit --json > .size.json",
"lint": "lib-builder lint",
"format": "lib-builder format",
"update": "lib-builder update",
"prepublish-only": "yarn build && yarn changelog",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"changelog:rewrite": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
},
"repository": {
"type": "git",
"url": "https://github.com/theKashey/react-style-singleton"
},
"bugs": {
"url": "https://github.com/theKashey/react-style-singleton/issues"
},
"homepage": "https://github.com/theKashey/react-style-singleton#readme",
"author": "Anton Korzunov (thekashey@gmail.com)",
"license": "MIT",
"devDependencies": {
"@theuiteam/lib-builder": "^0.1.4",
"@size-limit/preset-small-lib": "^11.0.2",
"size-limit": "^11.0.2",
"react": "^16.8.6",
"react-dom": "^16.8.6"
},
"peerDependencies": {
"@types/react": "*",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
},
"keywords": [
"react",
"style",
"css"
],
"dependencies": {
"tslib": "^2.0.0",
"get-nonce": "^1.0.0"
},
"engines": {
"node": ">=10"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{ts,tsx}": [
"prettier --write",
"eslint --fix",
"git add"
],
"*.{js,css,json,md}": [
"prettier --write",
"git add"
]
},
"prettier": {
"printWidth": 120,
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": true
},
"packageManager": "yarn@1.22.19"
}