sileo-solid 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,478 @@
1
+ /* -------------------------------- Variables ------------------------------- */
2
+
3
+ :root {
4
+ --sileo-spring-easing: linear(
5
+ 0,
6
+ 0.002 0.6%,
7
+ 0.007 1.2%,
8
+ 0.015 1.8%,
9
+ 0.026 2.4%,
10
+ 0.041 3.1%,
11
+ 0.06 3.8%,
12
+ 0.108 5.3%,
13
+ 0.157 6.6%,
14
+ 0.214 8%,
15
+ 0.467 13.7%,
16
+ 0.577 16.3%,
17
+ 0.631 17.7%,
18
+ 0.682 19.1%,
19
+ 0.73 20.5%,
20
+ 0.771 21.8%,
21
+ 0.808 23.1%,
22
+ 0.844 24.5%,
23
+ 0.874 25.8%,
24
+ 0.903 27.2%,
25
+ 0.928 28.6%,
26
+ 0.952 30.1%,
27
+ 0.972 31.6%,
28
+ 0.988 33.1%,
29
+ 1.01 35.7%,
30
+ 1.025 38.5%,
31
+ 1.034 41.6%,
32
+ 1.038 45%,
33
+ 1.035 50.1%,
34
+ 1.012 64.2%,
35
+ 1.003 73%,
36
+ 0.999 83.7%,
37
+ 1
38
+ );
39
+
40
+ --sileo-duration: 600ms;
41
+ --sileo-height: 40px;
42
+ --sileo-width: 350px;
43
+
44
+ --sileo-state-success: oklch(0.723 0.219 142.136);
45
+ --sileo-state-loading: oklch(0.556 0 0);
46
+ --sileo-state-error: oklch(0.637 0.237 25.331);
47
+ --sileo-state-warning: oklch(0.795 0.184 86.047);
48
+ --sileo-state-info: oklch(0.685 0.169 237.323);
49
+ --sileo-state-action: oklch(0.623 0.214 259.815);
50
+ }
51
+
52
+ /* ---------------------------------- Toast --------------------------------- */
53
+
54
+ [data-sileo-toast] {
55
+ position: relative;
56
+ cursor: pointer;
57
+ pointer-events: auto;
58
+ touch-action: none;
59
+ border: 0;
60
+ background: transparent;
61
+ padding: 0;
62
+ width: var(--sileo-width);
63
+ height: var(--_h, var(--sileo-height));
64
+ opacity: 0;
65
+ transform: translateZ(0) scale(0.95);
66
+ transform-origin: center;
67
+ contain: layout style;
68
+ overflow: visible;
69
+ }
70
+
71
+ [data-sileo-toast][data-state="loading"] {
72
+ cursor: default;
73
+ }
74
+
75
+ [data-sileo-toast][data-ready="true"] {
76
+ opacity: 1;
77
+ transform: translateZ(0) scale(1);
78
+ transition:
79
+ transform calc(var(--sileo-duration) * 0.66) var(--sileo-spring-easing),
80
+ opacity calc(var(--sileo-duration) * 0.66) var(--sileo-spring-easing),
81
+ margin-bottom calc(var(--sileo-duration) * 0.66) var(--sileo-spring-easing),
82
+ margin-top calc(var(--sileo-duration) * 0.66) var(--sileo-spring-easing),
83
+ height var(--sileo-duration) var(--sileo-spring-easing);
84
+ }
85
+
86
+ /* Entry animation direction */
87
+ [data-sileo-viewport][data-position^="top"]
88
+ [data-sileo-toast]:not([data-ready="true"]) {
89
+ transform: translateY(-6px) scale(0.95);
90
+ }
91
+
92
+ [data-sileo-viewport][data-position^="bottom"]
93
+ [data-sileo-toast]:not([data-ready="true"]) {
94
+ transform: translateY(6px) scale(0.95);
95
+ }
96
+
97
+ /* Exit */
98
+ [data-sileo-toast][data-ready="true"][data-exiting="true"] {
99
+ opacity: 0;
100
+ pointer-events: none;
101
+ }
102
+
103
+ [data-sileo-viewport][data-position^="top"]
104
+ [data-sileo-toast][data-ready="true"][data-exiting="true"] {
105
+ transform: translateY(-6px) scale(0.95);
106
+ }
107
+
108
+ [data-sileo-viewport][data-position^="bottom"]
109
+ [data-sileo-toast][data-ready="true"][data-exiting="true"] {
110
+ transform: translateY(6px) scale(0.95);
111
+ }
112
+
113
+ /* ------------------------------- SVG Canvas ------------------------------- */
114
+
115
+ [data-sileo-canvas] {
116
+ position: absolute;
117
+ left: 0;
118
+ right: 0;
119
+ pointer-events: none;
120
+ transform: translateZ(0);
121
+ contain: layout style;
122
+ overflow: visible;
123
+ }
124
+
125
+ [data-sileo-canvas][data-edge="top"] {
126
+ bottom: 0;
127
+ transform: scaleY(-1) translateZ(0);
128
+ }
129
+
130
+ [data-sileo-canvas][data-edge="bottom"] {
131
+ top: 0;
132
+ }
133
+
134
+ [data-sileo-svg] {
135
+ overflow: visible;
136
+ }
137
+
138
+ /* --------------------------------- Shapes --------------------------------- */
139
+
140
+ /* --------------------------------- Header --------------------------------- */
141
+
142
+ [data-sileo-header] {
143
+ position: absolute;
144
+ z-index: 20;
145
+ display: flex;
146
+ align-items: center;
147
+ padding: 0.5rem;
148
+ height: var(--sileo-height);
149
+ overflow: hidden;
150
+ left: var(--_px, 0px);
151
+ transform: var(--_ht);
152
+ max-width: var(--_pw);
153
+ }
154
+
155
+ [data-sileo-toast][data-ready="true"] [data-sileo-header] {
156
+ transition:
157
+ transform var(--sileo-duration) var(--sileo-spring-easing),
158
+ left var(--sileo-duration) var(--sileo-spring-easing),
159
+ max-width var(--sileo-duration) var(--sileo-spring-easing);
160
+ }
161
+
162
+ [data-sileo-header][data-edge="top"] {
163
+ bottom: 0;
164
+ }
165
+
166
+ [data-sileo-header][data-edge="bottom"] {
167
+ top: 0;
168
+ }
169
+
170
+ /* Header inner morphing */
171
+ [data-sileo-header-stack] {
172
+ position: relative;
173
+ display: inline-flex;
174
+ align-items: center;
175
+ height: 100%;
176
+ }
177
+
178
+ [data-sileo-header-inner] {
179
+ display: flex;
180
+ align-items: center;
181
+ gap: 0.5rem;
182
+ white-space: nowrap;
183
+ opacity: 1;
184
+ filter: blur(0px);
185
+ transform: translateZ(0);
186
+ }
187
+
188
+ [data-sileo-header-inner][data-layer="current"] {
189
+ position: relative;
190
+ z-index: 1;
191
+ animation: sileo-header-enter var(--sileo-duration) var(--sileo-spring-easing)
192
+ both;
193
+ }
194
+
195
+ [data-sileo-header-inner][data-layer="current"]:not(:only-child),
196
+ [data-sileo-header-inner][data-exiting="true"] {
197
+ will-change: opacity, filter;
198
+ }
199
+
200
+ [data-sileo-header-inner][data-layer="prev"] {
201
+ position: absolute;
202
+ left: 0;
203
+ top: 0;
204
+ z-index: 0;
205
+ pointer-events: none;
206
+ }
207
+
208
+ [data-sileo-header-inner][data-exiting="true"] {
209
+ animation: sileo-header-exit calc(var(--sileo-duration) * 0.7) ease forwards;
210
+ }
211
+
212
+ /* ---------------------------------- Badge --------------------------------- */
213
+
214
+ [data-sileo-badge] {
215
+ display: flex;
216
+ height: 24px;
217
+ width: 24px;
218
+ flex-shrink: 0;
219
+ align-items: center;
220
+ justify-content: center;
221
+ padding: 2px;
222
+ box-sizing: border-box;
223
+ border-radius: 9999px;
224
+ color: var(--sileo-tone, currentColor);
225
+ background-color: var(--sileo-tone-bg, transparent);
226
+ }
227
+
228
+ /* ---------------------------------- Title --------------------------------- */
229
+
230
+ [data-sileo-title] {
231
+ font-size: 0.825rem;
232
+ line-height: 1rem;
233
+ font-weight: 500;
234
+ text-transform: capitalize;
235
+ color: var(--sileo-tone, currentColor);
236
+ }
237
+
238
+ /* ------------------------------ State Colors ------------------------------ */
239
+
240
+ :is([data-sileo-badge], [data-sileo-title], [data-sileo-button])[data-state] {
241
+ --_c: var(--sileo-state-success);
242
+ }
243
+
244
+ :is(
245
+ [data-sileo-badge],
246
+ [data-sileo-title],
247
+ [data-sileo-button]
248
+ )[data-state="loading"] {
249
+ --_c: var(--sileo-state-loading);
250
+ }
251
+
252
+ :is(
253
+ [data-sileo-badge],
254
+ [data-sileo-title],
255
+ [data-sileo-button]
256
+ )[data-state="error"] {
257
+ --_c: var(--sileo-state-error);
258
+ }
259
+
260
+ :is(
261
+ [data-sileo-badge],
262
+ [data-sileo-title],
263
+ [data-sileo-button]
264
+ )[data-state="warning"] {
265
+ --_c: var(--sileo-state-warning);
266
+ }
267
+
268
+ :is(
269
+ [data-sileo-badge],
270
+ [data-sileo-title],
271
+ [data-sileo-button]
272
+ )[data-state="info"] {
273
+ --_c: var(--sileo-state-info);
274
+ }
275
+
276
+ :is(
277
+ [data-sileo-badge],
278
+ [data-sileo-title],
279
+ [data-sileo-button]
280
+ )[data-state="action"] {
281
+ --_c: var(--sileo-state-action);
282
+ }
283
+
284
+ :is([data-sileo-badge], [data-sileo-title])[data-state] {
285
+ --sileo-tone: var(--_c);
286
+ --sileo-tone-bg: color-mix(in oklch, var(--_c) 20%, transparent);
287
+ }
288
+
289
+ /* --------------------------------- Content -------------------------------- */
290
+
291
+ [data-sileo-content] {
292
+ position: absolute;
293
+ left: 0;
294
+ z-index: 10;
295
+ width: 100%;
296
+ pointer-events: none;
297
+ opacity: var(--_co, 0);
298
+ }
299
+
300
+ [data-sileo-content]:not([data-visible="true"]) {
301
+ content-visibility: hidden;
302
+ }
303
+
304
+ [data-sileo-toast][data-ready="true"] [data-sileo-content] {
305
+ transition: opacity calc(var(--sileo-duration) * 0.08) ease
306
+ calc(var(--sileo-duration) * 0.04);
307
+ }
308
+
309
+ [data-sileo-content][data-edge="top"] {
310
+ top: 0;
311
+ }
312
+
313
+ [data-sileo-content][data-edge="bottom"] {
314
+ top: var(--sileo-height);
315
+ }
316
+
317
+ [data-sileo-content][data-visible="true"] {
318
+ pointer-events: auto;
319
+ }
320
+
321
+ [data-sileo-toast][data-ready="true"]
322
+ [data-sileo-content][data-visible="true"] {
323
+ transition: opacity calc(var(--sileo-duration) * 0.6) ease
324
+ calc(var(--sileo-duration) * 0.3);
325
+ }
326
+
327
+ [data-sileo-description] {
328
+ width: 100%;
329
+ text-align: left;
330
+ padding: 1rem;
331
+ font-size: 0.875rem;
332
+ line-height: 1.25rem;
333
+ contain: layout style paint;
334
+ content-visibility: auto;
335
+ color: rgba(0, 0, 0, 0.7);
336
+ }
337
+
338
+ /* --------------------------------- Button --------------------------------- */
339
+
340
+ [data-sileo-button] {
341
+ display: flex;
342
+ align-items: center;
343
+ justify-content: center;
344
+ height: 1.75rem;
345
+ padding: 0 0.625rem;
346
+ margin-top: 0.75rem;
347
+ border-radius: 9999px;
348
+ border: 0;
349
+ font-size: 0.75rem;
350
+ font-weight: 500;
351
+ cursor: pointer;
352
+ color: var(--sileo-btn-color, currentColor);
353
+ background-color: var(--sileo-btn-bg, transparent);
354
+ transition: background-color 150ms ease;
355
+ }
356
+
357
+ [data-sileo-button]:hover {
358
+ background-color: var(--sileo-btn-bg-hover, transparent);
359
+ }
360
+
361
+ [data-sileo-button][data-state] {
362
+ --sileo-btn-color: var(--_c);
363
+ --sileo-btn-bg: color-mix(in oklch, var(--_c) 15%, transparent);
364
+ --sileo-btn-bg-hover: color-mix(in oklch, var(--_c) 25%, transparent);
365
+ }
366
+
367
+ /* -------------------------------- Animations ------------------------------ */
368
+
369
+ [data-sileo-icon="spin"] {
370
+ animation: sileo-spin 1s linear infinite;
371
+ }
372
+
373
+ @keyframes sileo-spin {
374
+ to {
375
+ transform: rotate(360deg);
376
+ }
377
+ }
378
+
379
+ @keyframes sileo-header-enter {
380
+ from {
381
+ opacity: 0;
382
+ filter: blur(6px);
383
+ }
384
+ to {
385
+ opacity: 1;
386
+ filter: blur(0px);
387
+ }
388
+ }
389
+
390
+ @keyframes sileo-header-exit {
391
+ from {
392
+ opacity: 1;
393
+ filter: blur(0px);
394
+ }
395
+ to {
396
+ opacity: 0;
397
+ filter: blur(6px);
398
+ }
399
+ }
400
+
401
+ /* -------------------------------- Viewports ------------------------------- */
402
+
403
+ [data-sileo-viewport] {
404
+ position: fixed;
405
+ z-index: 50;
406
+ display: flex;
407
+ gap: 0.75rem;
408
+ padding: 0.75rem;
409
+ pointer-events: none;
410
+ max-width: calc(100vw - 1.5rem);
411
+ contain: layout style;
412
+ }
413
+
414
+ [data-sileo-viewport][data-position^="top"]
415
+ [data-sileo-toast]:not([data-ready="true"]) {
416
+ margin-bottom: calc(-1 * (var(--sileo-height) + 0.75rem));
417
+ }
418
+
419
+ [data-sileo-viewport][data-position^="bottom"]
420
+ [data-sileo-toast]:not([data-ready="true"]) {
421
+ margin-top: calc(-1 * (var(--sileo-height) + 0.75rem));
422
+ }
423
+
424
+ /* Vertical edge */
425
+ [data-sileo-viewport][data-position^="top"] {
426
+ top: 0;
427
+ flex-direction: column-reverse;
428
+ }
429
+
430
+ [data-sileo-viewport][data-position^="bottom"] {
431
+ bottom: 0;
432
+ flex-direction: column;
433
+ }
434
+
435
+ /* Horizontal alignment */
436
+ [data-sileo-viewport][data-position$="left"] {
437
+ left: 0;
438
+ align-items: flex-start;
439
+ }
440
+
441
+ [data-sileo-viewport][data-position$="right"] {
442
+ right: 0;
443
+ align-items: flex-end;
444
+ }
445
+
446
+ [data-sileo-viewport][data-position$="center"] {
447
+ left: 50%;
448
+ transform: translateX(-50%);
449
+ align-items: center;
450
+ }
451
+
452
+ @media (prefers-reduced-motion: no-preference) {
453
+ [data-sileo-toast][data-ready="true"]:hover,
454
+ [data-sileo-toast][data-ready="true"][data-exiting="true"] {
455
+ will-change: transform, opacity, height;
456
+ }
457
+ }
458
+
459
+ @media (prefers-reduced-motion: reduce) {
460
+ [data-sileo-viewport],
461
+ [data-sileo-viewport] *,
462
+ [data-sileo-viewport] *::before,
463
+ [data-sileo-viewport] *::after {
464
+ animation-duration: 0.01ms;
465
+ animation-iteration-count: 1;
466
+ transition-duration: 0.01ms;
467
+ }
468
+ }
469
+
470
+ /* --------------------------------- Themes -------------------------------- */
471
+
472
+ [data-sileo-viewport][data-theme="dark"] [data-sileo-description] {
473
+ color: rgba(0, 0, 0, 0.7);
474
+ }
475
+
476
+ [data-sileo-viewport][data-theme="light"] [data-sileo-description] {
477
+ color: rgba(255, 255, 255, 0.5);
478
+ }
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "sileo-solid",
3
+ "version": "0.1.0",
4
+ "description": "An opinionated, physics-based toast notification library for SolidJS.",
5
+ "license": "MIT",
6
+ "author": "Klaus",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/klaus-2/Sileo-SolidJS.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/klaus-2/Sileo-SolidJS/issues"
13
+ },
14
+ "homepage": "https://github.com/klaus-2/Sileo-SolidJS#readme",
15
+ "keywords": [
16
+ "solid-js",
17
+ "solidjs",
18
+ "toast",
19
+ "notification",
20
+ "physics",
21
+ "animation",
22
+ "motion",
23
+ "ui",
24
+ "component"
25
+ ],
26
+ "exports": {
27
+ ".": {
28
+ "import": {
29
+ "types": "./dist/index.d.mts",
30
+ "default": "./dist/index.mjs"
31
+ },
32
+ "require": {
33
+ "types": "./dist/index.d.ts",
34
+ "default": "./dist/index.js"
35
+ },
36
+ "default": "./dist/index.js"
37
+ },
38
+ "./styles.css": "./dist/styles.css"
39
+ },
40
+ "main": "./dist/index.js",
41
+ "module": "./dist/index.mjs",
42
+ "types": "./dist/index.d.ts",
43
+ "sideEffects": [
44
+ "**/*.css"
45
+ ],
46
+ "files": [
47
+ "dist"
48
+ ],
49
+ "scripts": {
50
+ "build": "rimraf dist && node build.js",
51
+ "dev": "bunchee --watch",
52
+ "prepublishOnly": "npm run build",
53
+ "clean": "rimraf dist"
54
+ },
55
+ "peerDependencies": {
56
+ "solid-js": ">=1.8"
57
+ },
58
+ "dependencies": {
59
+ "motion": "^12.34.0"
60
+ },
61
+ "devDependencies": {
62
+ "bunchee": "^6.9.4",
63
+ "rimraf": "^6.0.0",
64
+ "solid-js": "^1.9.0"
65
+ },
66
+ "publishConfig": {
67
+ "access": "public"
68
+ }
69
+ }