Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix unexpected removal of initial values #1565

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
671 changes: 329 additions & 342 deletions package-lock.json

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions plugin-packs/postcss-preset-env/test/logical-properties.css
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,46 @@
contain-intrinsic-width: inherit;
}

.corner-shape {
/* corner-bottom-left-shape */
corner-bottom-left-shape: inherit;
}

.corner-shape {
/* corner-bottom-right-shape */
corner-bottom-right-shape: inherit;
}

.corner-shape {
/* corner-end-end-shape */
corner-end-end-shape: inherit;
}

.corner-shape {
/* corner-end-start-shape */
corner-end-start-shape: inherit;
}

.corner-shape {
/* corner-start-end-shape */
corner-start-end-shape: inherit;
}

.corner-shape {
/* corner-start-start-shape */
corner-start-start-shape: inherit;
}

.corner-shape {
/* corner-top-left-shape */
corner-top-left-shape: inherit;
}

.corner-shape {
/* corner-top-right-shape */
corner-top-right-shape: inherit;
}

.inset {
/* bottom */
bottom: inherit;
Expand Down
40 changes: 40 additions & 0 deletions plugin-packs/postcss-preset-env/test/logical-properties.expect.css
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,46 @@
contain-intrinsic-width: inherit;
}

.corner-shape {
/* corner-bottom-left-shape */
corner-bottom-left-shape: inherit;
}

.corner-shape {
/* corner-bottom-right-shape */
corner-bottom-right-shape: inherit;
}

.corner-shape {
/* corner-end-end-shape */
corner-end-end-shape: inherit;
}

.corner-shape {
/* corner-end-start-shape */
corner-end-start-shape: inherit;
}

.corner-shape {
/* corner-start-end-shape */
corner-start-end-shape: inherit;
}

.corner-shape {
/* corner-start-start-shape */
corner-start-start-shape: inherit;
}

.corner-shape {
/* corner-top-left-shape */
corner-top-left-shape: inherit;
}

.corner-shape {
/* corner-top-right-shape */
corner-top-right-shape: inherit;
}

.inset {
/* bottom */
bottom: inherit;
Expand Down
4 changes: 4 additions & 0 deletions plugins/postcss-initial/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes to PostCSS Initial

### Unreleased (patch)

- Fix unexpected removal of declarations that do not require a fallback.

### 2.0.0

_August 3, 2024_
Expand Down
2 changes: 1 addition & 1 deletion plugins/postcss-initial/dist/index.cjs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"use strict";const o=new Map([["animation","none 0s ease 0s 1 normal none running"],["animation-delay","0s"],["animation-direction","normal"],["animation-duration","0s"],["animation-fill-mode","none"],["animation-iteration-count","1"],["animation-name","none"],["animation-play-state","running"],["animation-timing-function","ease"],["backface-visibility","visible"],["background","transparent none repeat 0 0 / auto auto padding-box border-box scroll"],["background-attachment","scroll"],["background-clip","border-box"],["background-color","transparent"],["background-image","none"],["background-origin","padding-box"],["background-position","0 0"],["background-position-x","0"],["background-position-y","0"],["background-repeat","repeat"],["background-size","auto auto"],["border","medium none currentcolor"],["border-style","none"],["border-width","medium"],["border-color","currentcolor"],["border-bottom","0"],["border-bottom-color","currentcolor"],["border-bottom-left-radius","0"],["border-bottom-right-radius","0"],["border-bottom-style","none"],["border-bottom-width","medium"],["border-collapse","separate"],["border-image","none"],["border-left","0"],["border-left-color","currentcolor"],["border-left-style","none"],["border-left-width","medium"],["border-radius","0"],["border-right","0"],["border-right-color","currentcolor"],["border-right-style","none"],["border-right-width","medium"],["border-spacing","0"],["border-top","0"],["border-top-color","currentcolor"],["border-top-left-radius","0"],["border-top-right-radius","0"],["border-top-style","none"],["border-top-width","medium"],["bottom","auto"],["box-shadow","none"],["box-sizing","content-box"],["caption-side","top"],["clear","none"],["clip","auto"],["color","#000"],["columns","auto"],["column-count","auto"],["column-fill","balance"],["column-gap","normal"],["column-rule","medium none currentcolor"],["column-rule-color","currentcolor"],["column-rule-style","none"],["column-rule-width","medium"],["column-span","1"],["column-width","auto"],["content","normal"],["counter-increment","none"],["counter-reset","none"],["cursor","auto"],["direction","ltr"],["display","inline"],["empty-cells","show"],["float","none"],["font-family","serif"],["font-size","medium"],["font-style","normal"],["font-variant","normal"],["font-weight","normal"],["font-stretch","normal"],["line-height","normal"],["height","auto"],["hyphens","none"],["left","auto"],["letter-spacing","normal"],["list-style","disc outside none"],["list-style-image","none"],["list-style-position","outside"],["list-style-type","disc"],["margin","0"],["margin-bottom","0"],["margin-left","0"],["margin-right","0"],["margin-top","0"],["max-height","none"],["max-width","none"],["min-height","0"],["min-width","0"],["opacity","1"],["orphans","2"],["outline","medium none currentcolor"],["outline-color","currentcolor"],["outline-style","none"],["outline-width","medium"],["overflow","visible"],["overflow-x","visible"],["overflow-y","visible"],["padding","0"],["padding-bottom","0"],["padding-left","0"],["padding-right","0"],["padding-top","0"],["page-break-after","auto"],["page-break-before","auto"],["page-break-inside","auto"],["perspective","none"],["perspective-origin","50% 50%"],["position","static"],["quotes",'"“" "”" "‘" "’"'],["right","auto"],["tab-size","8"],["table-layout","auto"],["text-align","left"],["text-align-last","auto"],["text-decoration","none"],["text-decoration-color","currentcolor"],["text-decoration-line","none"],["text-decoration-style","solid"],["text-indent","0"],["text-shadow","none"],["text-transform","none"],["top","auto"],["transform","none"],["transform-origin","50% 50% 0"],["transform-style","flat"],["transition","none 0s ease 0s"],["transition-delay","0s"],["transition-duration","0s"],["transition-property","none"],["transition-timing-function","ease"],["unicode-bidi","normal"],["vertical-align","baseline"],["visibility","visible"],["white-space","normal"],["widows","2"],["width","auto"],["word-spacing","normal"],["z-index","auto"]]),t=["animation","backface-visibility","background","border","border-collapse","border-image","border-radius","border-spacing","bottom","box-shadow","box-sizing","caption-side","clear","clip","color","columns","column-count","column-fill","column-gap","column-rule","column-span","column-width","content","counter-increment","counter-reset","cursor","display","empty-cells","float","font-family","font-size","font-style","font-variant","font-weight","font-stretch","line-height","font","height","hyphens","left","letter-spacing","list-style","margin","max-height","max-width","min-height","min-width","opacity","orphans","outline","overflow","overflow-x","overflow-y","padding","page-break-after","page-break-before","page-break-inside","perspective","perspective-origin","position","right","tab-size","table-layout","text-align","text-align-last","text-decoration","text-indent","text-shadow","text-transform","top","transform","transform-origin","transform-style","transition","vertical-align","visibility","white-space","widows","width","word-spacing","z-index"];function hasExactFallback(o,t){const e=o.parent;if(!e)return!1;const n=o.prop.toLowerCase();for(let r=e.index(o)-1;r>=0;r--){const o=e.nodes[r];if("decl"===o.type&&o.prop.toLowerCase()===n)return o.value===t}return!1}const e=/^\s?initial\s?$/i,n=/^font$/i,r=/^all$/i,i=["font-family","font-size","font-style","font-variant","font-weight","font-stretch","line-height"],creator=a=>{const l=Object.assign({preserve:!0},a);return{postcssPlugin:"postcss-initial",Declaration(a){if(a.variable)return;if(!e.test(a.value))return;let s;s=n.test(a.prop)?i:r.test(a.prop)?t:[a.prop.toLowerCase()],s.forEach((t=>{const e=o.get(t);e&&(hasExactFallback(a,e)||a.cloneBefore({prop:t,value:e}))})),l.preserve||a.remove()}}};creator.postcss=!0,module.exports=creator;
"use strict";const o=new Map([["animation","none 0s ease 0s 1 normal none running"],["animation-delay","0s"],["animation-direction","normal"],["animation-duration","0s"],["animation-fill-mode","none"],["animation-iteration-count","1"],["animation-name","none"],["animation-play-state","running"],["animation-timing-function","ease"],["backface-visibility","visible"],["background","transparent none repeat 0 0 / auto auto padding-box border-box scroll"],["background-attachment","scroll"],["background-clip","border-box"],["background-color","transparent"],["background-image","none"],["background-origin","padding-box"],["background-position","0 0"],["background-position-x","0"],["background-position-y","0"],["background-repeat","repeat"],["background-size","auto auto"],["border","medium none currentcolor"],["border-style","none"],["border-width","medium"],["border-color","currentcolor"],["border-bottom","0"],["border-bottom-color","currentcolor"],["border-bottom-left-radius","0"],["border-bottom-right-radius","0"],["border-bottom-style","none"],["border-bottom-width","medium"],["border-collapse","separate"],["border-image","none"],["border-left","0"],["border-left-color","currentcolor"],["border-left-style","none"],["border-left-width","medium"],["border-radius","0"],["border-right","0"],["border-right-color","currentcolor"],["border-right-style","none"],["border-right-width","medium"],["border-spacing","0"],["border-top","0"],["border-top-color","currentcolor"],["border-top-left-radius","0"],["border-top-right-radius","0"],["border-top-style","none"],["border-top-width","medium"],["bottom","auto"],["box-shadow","none"],["box-sizing","content-box"],["caption-side","top"],["clear","none"],["clip","auto"],["color","#000"],["columns","auto"],["column-count","auto"],["column-fill","balance"],["column-gap","normal"],["column-rule","medium none currentcolor"],["column-rule-color","currentcolor"],["column-rule-style","none"],["column-rule-width","medium"],["column-span","1"],["column-width","auto"],["content","normal"],["counter-increment","none"],["counter-reset","none"],["cursor","auto"],["direction","ltr"],["display","inline"],["empty-cells","show"],["float","none"],["font-family","serif"],["font-size","medium"],["font-style","normal"],["font-variant","normal"],["font-weight","normal"],["font-stretch","normal"],["line-height","normal"],["height","auto"],["hyphens","none"],["left","auto"],["letter-spacing","normal"],["list-style","disc outside none"],["list-style-image","none"],["list-style-position","outside"],["list-style-type","disc"],["margin","0"],["margin-bottom","0"],["margin-left","0"],["margin-right","0"],["margin-top","0"],["max-height","none"],["max-width","none"],["min-height","0"],["min-width","0"],["opacity","1"],["orphans","2"],["outline","medium none currentcolor"],["outline-color","currentcolor"],["outline-style","none"],["outline-width","medium"],["overflow","visible"],["overflow-x","visible"],["overflow-y","visible"],["padding","0"],["padding-bottom","0"],["padding-left","0"],["padding-right","0"],["padding-top","0"],["page-break-after","auto"],["page-break-before","auto"],["page-break-inside","auto"],["perspective","none"],["perspective-origin","50% 50%"],["position","static"],["quotes",'"“" "”" "‘" "’"'],["right","auto"],["tab-size","8"],["table-layout","auto"],["text-align","left"],["text-align-last","auto"],["text-decoration","none"],["text-decoration-color","currentcolor"],["text-decoration-line","none"],["text-decoration-style","solid"],["text-indent","0"],["text-shadow","none"],["text-transform","none"],["top","auto"],["transform","none"],["transform-origin","50% 50% 0"],["transform-style","flat"],["transition","none 0s ease 0s"],["transition-delay","0s"],["transition-duration","0s"],["transition-property","none"],["transition-timing-function","ease"],["unicode-bidi","normal"],["vertical-align","baseline"],["visibility","visible"],["white-space","normal"],["widows","2"],["width","auto"],["word-spacing","normal"],["z-index","auto"]]),t=["animation","backface-visibility","background","border","border-collapse","border-image","border-radius","border-spacing","bottom","box-shadow","box-sizing","caption-side","clear","clip","color","columns","column-count","column-fill","column-gap","column-rule","column-span","column-width","content","counter-increment","counter-reset","cursor","display","empty-cells","float","font-family","font-size","font-style","font-variant","font-weight","font-stretch","line-height","font","height","hyphens","left","letter-spacing","list-style","margin","max-height","max-width","min-height","min-width","opacity","orphans","outline","overflow","overflow-x","overflow-y","padding","page-break-after","page-break-before","page-break-inside","perspective","perspective-origin","position","right","tab-size","table-layout","text-align","text-align-last","text-decoration","text-indent","text-shadow","text-transform","top","transform","transform-origin","transform-style","transition","vertical-align","visibility","white-space","widows","width","word-spacing","z-index"];function hasExactFallback(o,t){const e=o.parent;if(!e)return!1;const n=o.prop.toLowerCase();for(let r=e.index(o)-1;r>=0;r--){const o=e.nodes[r];if("decl"===o.type&&o.prop.toLowerCase()===n)return o.value===t}return!1}const e=/^\s?initial\s?$/i,n=/^font$/i,r=/^all$/i,i=["font-family","font-size","font-style","font-variant","font-weight","font-stretch","line-height"],creator=a=>{const l=Object.assign({preserve:!0},a);return{postcssPlugin:"postcss-initial",Declaration(a){if(a.variable)return;if(!e.test(a.value))return;let s;s=n.test(a.prop)?i:r.test(a.prop)?t:[a.prop.toLowerCase()];let c=!1;s.forEach((t=>{const e=o.get(t);e&&(hasExactFallback(a,e)||(c=!0,a.cloneBefore({prop:t,value:e})))})),!l.preserve&&c&&a.remove()}}};creator.postcss=!0,module.exports=creator;
Loading