Skip to content

Commit 14674eb

Browse files
committed
fix perf & bump 📦
1 parent 874a16e commit 14674eb

5 files changed

Lines changed: 12 additions & 18 deletions

File tree

bun.lock

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sileo",
3-
"version": "0.0.8",
3+
"version": "0.0.9",
44
"description": "An opinionated, physics based toast notification library for react.",
55
"license": "MIT",
66
"repository": {
@@ -19,21 +19,20 @@
1919
},
2020
"default": "./dist/index.js"
2121
},
22-
"./dist/styles.css": "./dist/styles.css"
22+
"./styles.css": "./dist/styles.css"
2323
},
2424
"main": "./dist/index.js",
2525
"types": "./dist/index.d.ts",
2626
"files": [
2727
"dist"
2828
],
2929
"scripts": {
30-
"build": "rm -rf dist && bunchee && cp src/sileo.css dist/styles.css",
30+
"build": "rm -rf dist && bunchee && cp src/styles.css dist/styles.css",
3131
"dev": "bunchee --watch"
3232
},
3333
"peerDependencies": {
3434
"react": ">=18",
35-
"react-dom": ">=18",
36-
"lucide-react": ">=0.300"
35+
"react-dom": ">=18"
3736
},
3837
"devDependencies": {
3938
"bunchee": "^6.9.4"

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import "./sileo.css";
3+
import "./styles.css";
44

55
export { sileo, Toaster } from "./toast";
66
export type {

src/sileo.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
useState,
1313
} from "react";
1414
import type { SileoButton, SileoState, SileoStyles } from "./types";
15-
import "./sileo.css";
15+
import "./styles.css";
1616
import {
1717
ArrowRight,
1818
Check,
@@ -368,6 +368,7 @@ export const Sileo = memo(function Sileo({
368368
const svgHeight = hasDesc ? Math.max(expanded, minExpanded) : HEIGHT;
369369
const expandedContent = Math.max(0, expanded - HEIGHT);
370370
const resolvedPillWidth = Math.max(pillWidth || HEIGHT, HEIGHT);
371+
const pillHeight = HEIGHT + blur * 3;
371372

372373
const pillX =
373374
position === "right"
@@ -383,13 +384,13 @@ export const Sileo = memo(function Sileo({
383384
"--_h": `${open ? expanded : HEIGHT}px`,
384385
"--_pw": `${resolvedPillWidth}px`,
385386
"--_px": `${pillX}px`,
386-
"--_sy": `${open ? 1 : HEIGHT / expanded}`,
387-
"--_ph": `${open ? expanded - 5 : expanded}px`,
387+
"--_sy": `${open ? 1 : HEIGHT / pillHeight}`,
388+
"--_ph": `${pillHeight}px`,
388389
"--_by": `${open ? 1 : 0}`,
389390
"--_ht": `translateY(${open ? (expand === "bottom" ? 3 : -3) : 0}px) scale(${open ? 0.9 : 1})`,
390391
"--_co": `${open ? 1 : 0}`,
391392
}),
392-
[open, expanded, resolvedPillWidth, pillX, expand],
393+
[open, expanded, resolvedPillWidth, pillX, expand, pillHeight],
393394
);
394395

395396
/* -------------------------------- Handlers -------------------------------- */

src/sileo.css renamed to src/styles.css

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,7 @@
158158
transition:
159159
transform var(--sileo-duration) var(--sileo-spring-easing),
160160
width var(--sileo-duration) var(--sileo-spring-easing),
161-
height var(--sileo-duration) var(--sileo-spring-easing),
162-
x var(--sileo-duration) var(--sileo-spring-easing),
163-
fill var(--sileo-duration) var(--sileo-spring-easing);
161+
x var(--sileo-duration) var(--sileo-spring-easing);
164162
}
165163

166164
[data-sileo-toast][data-ready="true"][data-expanded="true"] [data-sileo-pill] {
@@ -170,8 +168,7 @@
170168
[data-sileo-toast][data-ready="true"] [data-sileo-body] {
171169
transition:
172170
transform var(--sileo-duration) var(--sileo-spring-easing),
173-
opacity var(--sileo-duration) var(--sileo-spring-easing),
174-
fill var(--sileo-duration) var(--sileo-spring-easing);
171+
opacity var(--sileo-duration) var(--sileo-spring-easing);
175172
}
176173

177174
/* --------------------------------- Header --------------------------------- */

0 commit comments

Comments
 (0)