Skip to content

Commit 92506da

Browse files
committed
fix(packages.ts): wrong code copied in gradient border generator
fix Dun-sin#396
1 parent 0c784f0 commit 92506da

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

src/lib/packages.ts

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,29 @@ const actOnGenerator = (attribute: string, outputElement: HTMLElement) => {
123123
break;
124124
case 'gradient-border':
125125
element = outputElement.style;
126+
const content = window.getComputedStyle(outputElement, '::before');
127+
126128
codeToCopy = `
127129
div {
128-
border-width:8px;
129-
border-style:solid;
130-
border-radius:${element.getPropertyValue(`--${attribute}-radius`)};
131-
border-image:linear-gradient(${element.getPropertyValue(
132-
`--${attribute}-degree`
133-
)}, ${element.getPropertyValue(
134-
`--${attribute}-color-1`
135-
)}, ${element.getPropertyValue(`--${attribute}-color-2`)}) 1;
130+
position: relative;
131+
}
132+
133+
div::before {
134+
content: '';
135+
position: absolute;
136+
inset: 0;
137+
padding: 6px;
138+
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
139+
mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
140+
-webkit-mask-composite: xor;
141+
mask-composite: exclude;
142+
background: ${content.background};
143+
background-clip: 'border-box';
144+
${
145+
content.borderRadius !== '0px'
146+
? `border-radius: ${content.borderRadius};`
147+
: ''
148+
}
136149
}
137150
`;
138151
break;

src/style.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,6 @@ input[type='number']::-webkit-outer-spin-button {
791791
position: relative;
792792
width: var(--output-width);
793793
height: 300px;
794-
word-wrap: break-word;
795794
margin-bottom: 1rem;
796795
}
797796

0 commit comments

Comments
 (0)