Project files

This commit is contained in:
2023-11-09 18:47:11 +01:00
parent 695abe054b
commit c415135aae
8554 changed files with 858111 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
# Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
## 3.0.3 - 2020-09-27
- Use `Declaration` event to work faster
- Fast check with `startsWith` before running slow regexp
- Avoid adding duplicate
Thanks to @ai
## 3.0.0 - 2020-09-20
* Updated: Support for PostCSS v8
## 2.0 - 2018-09-18
* Updated: Support for PostCSS v7
## 1.0
* Initial release

View File

@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright 2017 AUTHOR_NAME <AUTHOR_EMAIL>
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.

View File

@@ -0,0 +1,83 @@
# postcss-page-break
[![NPM Package][npm-img]][npm]
[![Build Status][ci-img]][ci]
[![License: MIT][mit-img]][mit]
[PostCSS] plugin to fallback `break-` properties with `page-break-` alias.
[!['Can I use' table](https://caniuse.bitsofco.de/image/multicolumn.png)](https://caniuse.com/#feat=multicolumn)
[PostCSS]: https://github.com/postcss/postcss
[npm-img]: https://img.shields.io/npm/v/postcss-page-break.svg
[npm]: https://www.npmjs.org/package/postcss-page-break
[ci-img]: https://travis-ci.org/shrpne/postcss-page-break.svg
[ci]: https://travis-ci.org/shrpne/postcss-page-break
[mit-img]: https://img.shields.io/badge/License-MIT-yellow.svg
[mit]: https://github.com/shrpne/postcss-page-break/blob/master/LICENSE
```css
/* before */
.foo {
break-inside: avoid;
break-after: page;
}
/* after */
.foo {
page-break-inside: avoid;
break-inside: avoid;
page-break-after: always;
break-after: page;
}
```
Available fallbacks:
```
break-inside: auto => page-break-inside: auto
break-inside: avoid => page-break-inside: avoid
break-inside: avoid-page => page-break-inside: avoid
break-inside: inherit => page-break-inside: inherit
break-inside: initial => page-break-inside: initial
break-inside: unset => page-break-inside: unset
break-before: auto => page-break-before: auto;
break-before: avoid => page-break-before: avoid;
break-before: avoid-page => page-break-before: avoid;
break-before: page => page-break-before: always;
break-before: always => page-break-before: always;
break-before: left => page-break-before: left;
break-before: right => page-break-before: right;
break-before: recto => page-break-before: recto;
break-before: verso => page-break-before: verso;
break-before: inherit => page-break-before: inherit;
break-before: initial => page-break-before: initial;
break-before: unset => page-break-before: unset;
break-after: auto => page-break-after: auto;
break-after: avoid => page-break-after: avoid;
break-after: avoid-page => page-break-after: avoid;
break-after: page => page-break-after: always;
break-after: always => page-break-after: always;
break-after: left => page-break-after: left;
break-after: right => page-break-after: right;
break-after: recto => page-break-after: recto;
break-after: verso => page-break-after: verso;
break-after: inherit => page-break-after: inherit;
break-after: initial => page-break-after: initial;
break-after: unset => page-break-after: unset;
```
## Installation
```bash
npm install --save-dev postcss postcss-page-break
```
## Usage
```js
postcss([ require('postcss-page-break') ])
```
See [PostCSS] docs for examples for your environment (webpack, gulp, grunt).

View File

@@ -0,0 +1,35 @@
module.exports = function(options) {
return {
postcssPlugin: 'postcss-page-break',
Declaration(decl) {
if (decl.prop.startsWith('break-') && /^break-(inside|before|after)/.test(decl.prop)) {
// do not process column|region related properties
if (decl.value.search(/column|region/) >= 0) {
return;
}
let newValue;
switch (decl.value) {
case 'page':
newValue = 'always';
break;
case 'avoid-page':
newValue = 'avoid';
break;
default:
newValue = decl.value;
}
const newProperty = 'page-' + decl.prop;
if (decl.parent.every((sibling) => sibling.prop !== newProperty)) {
decl.cloneBefore({
prop: newProperty,
value: newValue,
});
}
}
},
};
};
module.exports.postcss = true;

View File

@@ -0,0 +1,44 @@
{
"name": "postcss-page-break",
"version": "3.0.4",
"description": "PostCSS plugin postcss-page-break to fallback `break-` properties with `page-break-` alias",
"files": [
"/index.js"
],
"scripts": {
"test": "jest && npm run lint",
"lint": "eslint *.js",
"lint:fix": "eslint *.js --fix"
},
"keywords": [
"postcss",
"css",
"postcss-plugin",
"break",
"break-inside",
"page-break-inside",
"avoid"
],
"author": "shrpne <shrpne@gmail.com>",
"license": "MIT",
"repository": {
"type" : "git",
"url" : "https://github.com/shrpne/postcss-page-break"
},
"bugs": {
"url": "https://github.com/shrpne/postcss-page-break/issues"
},
"peerDependencies": {
"postcss": "^8"
},
"devDependencies": {
"eslint": "^7.10.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-jest": "^24.0.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-security": "^1.4.0",
"eslint-plugin-unicorn": "^22.0.0",
"jest": "^26.4.2",
"postcss": "^8.1.0"
}
}