@sveltia/ui 0.81.1 → 0.81.3
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.
- package/dist/components/scroll/infinite-scroll.svelte +4 -2
- package/dist/components/text-editor/shiki/version.d.ts +1 -1
- package/dist/components/text-editor/shiki/version.js +1 -1
- package/dist/components/toast/toast.svelte +79 -56
- package/dist/services/popup.svelte.js +4 -2
- package/package.json +6 -6
|
@@ -73,8 +73,10 @@
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
const observer = new IntersectionObserver(
|
|
76
|
-
(
|
|
77
|
-
|
|
76
|
+
(entries) => {
|
|
77
|
+
// A busy browser can report several changes at once, oldest first, so only the last entry
|
|
78
|
+
// tells whether the spinner is near the view now
|
|
79
|
+
if (entries.at(-1)?.isIntersecting && loading) {
|
|
78
80
|
loadedItemSize += itemChunkSize;
|
|
79
81
|
}
|
|
80
82
|
},
|
|
@@ -74,6 +74,30 @@
|
|
|
74
74
|
return true;
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Get the lane in the toast base for the toasts at the given position, creating it if needed.
|
|
79
|
+
* The toasts at the same position are stacked in their lane rather than laid on top of each
|
|
80
|
+
* other.
|
|
81
|
+
* @param {HTMLElement} base Toast base.
|
|
82
|
+
* @param {string} position Toast position, e.g. `bottom-right`.
|
|
83
|
+
* @returns {HTMLElement} Lane.
|
|
84
|
+
*/
|
|
85
|
+
const getLane = (base, position) => {
|
|
86
|
+
let lane = /** @type {HTMLElement[]} */ ([...base.children]).find(
|
|
87
|
+
(child) => child.dataset.position === position,
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
if (!lane) {
|
|
91
|
+
lane = document.createElement('div');
|
|
92
|
+
lane.setAttribute('role', 'none');
|
|
93
|
+
lane.className = `toast-lane ${position}`;
|
|
94
|
+
lane.dataset.position = position;
|
|
95
|
+
base.appendChild(lane);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return lane;
|
|
99
|
+
};
|
|
100
|
+
|
|
77
101
|
/**
|
|
78
102
|
* Toast base shared by all the toasts. It’s created by the first toast mounted and removed with
|
|
79
103
|
* the last one unmounted, rather than rendered by a component, so it doesn’t go away with the
|
|
@@ -292,7 +316,16 @@
|
|
|
292
316
|
|
|
293
317
|
// Make sure the base is in the topmost modal dialog, in case a dialog event has been missed
|
|
294
318
|
moveBase(popover);
|
|
295
|
-
|
|
319
|
+
|
|
320
|
+
// The newest toast goes next to the edge of the screen: last at the bottom, first at the top
|
|
321
|
+
const lane = getLane(popover, position);
|
|
322
|
+
|
|
323
|
+
if (position.startsWith('top-')) {
|
|
324
|
+
lane.prepend(toast);
|
|
325
|
+
} else {
|
|
326
|
+
lane.append(toast);
|
|
327
|
+
}
|
|
328
|
+
|
|
296
329
|
raiseBase(popover);
|
|
297
330
|
});
|
|
298
331
|
|
|
@@ -362,11 +395,6 @@
|
|
|
362
395
|
position: fixed;
|
|
363
396
|
inset: 16px;
|
|
364
397
|
z-index: 99999;
|
|
365
|
-
display: flex;
|
|
366
|
-
flex-direction: column;
|
|
367
|
-
justify-content: flex-end;
|
|
368
|
-
align-items: flex-end;
|
|
369
|
-
gap: 8px;
|
|
370
398
|
overflow: visible;
|
|
371
399
|
margin: 0;
|
|
372
400
|
border: 0;
|
|
@@ -387,10 +415,38 @@
|
|
|
387
415
|
bottom: calc(var(--sui-bottom-navigation-height) + 16px);
|
|
388
416
|
}
|
|
389
417
|
|
|
390
|
-
.toast {
|
|
418
|
+
:global(.sui.toast-base) > :global(.toast-lane) {
|
|
391
419
|
position: absolute;
|
|
420
|
+
display: flex;
|
|
421
|
+
flex-direction: column;
|
|
422
|
+
margin-block: -4px;
|
|
423
|
+
max-width: 100%;
|
|
424
|
+
}
|
|
425
|
+
:global(.sui.toast-base) > :global(.toast-lane.top-left), :global(.sui.toast-base) > :global(.toast-lane.top-center), :global(.sui.toast-base) > :global(.toast-lane.top-right) {
|
|
426
|
+
inset-block-start: 0;
|
|
427
|
+
}
|
|
428
|
+
:global(.sui.toast-base) > :global(.toast-lane.bottom-left), :global(.sui.toast-base) > :global(.toast-lane.bottom-center), :global(.sui.toast-base) > :global(.toast-lane.bottom-right) {
|
|
429
|
+
inset-block-end: 0;
|
|
430
|
+
}
|
|
431
|
+
:global(.sui.toast-base) > :global(.toast-lane.top-left), :global(.sui.toast-base) > :global(.toast-lane.bottom-left) {
|
|
432
|
+
inset-inline-start: 0;
|
|
433
|
+
align-items: flex-start;
|
|
434
|
+
}
|
|
435
|
+
:global(.sui.toast-base) > :global(.toast-lane.top-center), :global(.sui.toast-base) > :global(.toast-lane.bottom-center) {
|
|
436
|
+
inset-inline: 0;
|
|
437
|
+
align-items: center;
|
|
438
|
+
}
|
|
439
|
+
:global(.sui.toast-base) > :global(.toast-lane.top-right), :global(.sui.toast-base) > :global(.toast-lane.bottom-right) {
|
|
440
|
+
inset-inline-end: 0;
|
|
441
|
+
align-items: flex-end;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
.toast {
|
|
445
|
+
margin-block: 4px;
|
|
392
446
|
width: max-content;
|
|
393
447
|
max-width: 80dvw;
|
|
448
|
+
height: auto;
|
|
449
|
+
overflow: clip;
|
|
394
450
|
opacity: 1;
|
|
395
451
|
transition-duration: 250ms;
|
|
396
452
|
will-change: opacity;
|
|
@@ -408,54 +464,21 @@
|
|
|
408
464
|
opacity: 0;
|
|
409
465
|
pointer-events: none;
|
|
410
466
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
.toast.top-center:dir(rtl) {
|
|
427
|
-
transform: translateX(50%);
|
|
428
|
-
}
|
|
429
|
-
.toast.top-right {
|
|
430
|
-
inset-block-start: 0;
|
|
431
|
-
inset-block-end: auto;
|
|
432
|
-
inset-inline-start: auto;
|
|
433
|
-
inset-inline-end: 0;
|
|
434
|
-
}
|
|
435
|
-
.toast.bottom-left {
|
|
436
|
-
inset-block-start: auto;
|
|
437
|
-
inset-block-end: 0;
|
|
438
|
-
inset-inline-start: 0;
|
|
439
|
-
inset-inline-end: auto;
|
|
440
|
-
}
|
|
441
|
-
.toast.bottom-center {
|
|
442
|
-
inset-block-start: auto;
|
|
443
|
-
inset-block-end: 0;
|
|
444
|
-
inset-inline-start: 50%;
|
|
445
|
-
inset-inline-end: auto;
|
|
446
|
-
}
|
|
447
|
-
.toast.bottom-center:dir(ltr) {
|
|
448
|
-
transform: translateX(-50%);
|
|
449
|
-
}
|
|
450
|
-
.toast.bottom-center:dir(rtl) {
|
|
451
|
-
transform: translateX(50%);
|
|
452
|
-
}
|
|
453
|
-
.toast.bottom-right {
|
|
454
|
-
inset-block-start: auto;
|
|
455
|
-
inset-block-end: 0;
|
|
456
|
-
inset-inline-start: auto;
|
|
457
|
-
inset-inline-end: 0;
|
|
467
|
+
@supports (interpolate-size: allow-keywords) {
|
|
468
|
+
.toast {
|
|
469
|
+
interpolate-size: allow-keywords;
|
|
470
|
+
}
|
|
471
|
+
@starting-style {
|
|
472
|
+
.toast {
|
|
473
|
+
margin-block: 0;
|
|
474
|
+
height: 0;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
.toast[aria-hidden=true] {
|
|
478
|
+
margin-block: 0;
|
|
479
|
+
height: 0;
|
|
480
|
+
}
|
|
458
481
|
}
|
|
459
|
-
.toast
|
|
460
|
-
|
|
482
|
+
.toast:has(:global(.alert)) {
|
|
483
|
+
filter: drop-shadow(0 8px 8px var(--sui-popup-shadow-color));
|
|
461
484
|
}</style>
|
|
@@ -170,8 +170,10 @@ class Popup {
|
|
|
170
170
|
removeTransitionStartListener,
|
|
171
171
|
];
|
|
172
172
|
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
// A busy browser can report several changes at once, oldest first, so only the last entry tells
|
|
174
|
+
// whether the anchor is visible now
|
|
175
|
+
this.intersectionObserver = new IntersectionObserver((entries) => {
|
|
176
|
+
if (!entries.at(-1)?.isIntersecting && this.open) {
|
|
175
177
|
this.hideImmediately();
|
|
176
178
|
}
|
|
177
179
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltia/ui",
|
|
3
|
-
"version": "0.81.
|
|
3
|
+
"version": "0.81.3",
|
|
4
4
|
"description": "A collection of Svelte components and utilities for building user interfaces.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@lexical/utils": "^0.52.0",
|
|
62
62
|
"@shikijs/langs": "4.5.0",
|
|
63
63
|
"@shikijs/themes": "4.5.0",
|
|
64
|
-
"@sveltia/i18n": "^1.
|
|
64
|
+
"@sveltia/i18n": "^1.5.0",
|
|
65
65
|
"@sveltia/utils": "^0.12.4",
|
|
66
66
|
"lexical": "^0.52.0"
|
|
67
67
|
},
|
|
@@ -74,14 +74,14 @@
|
|
|
74
74
|
"@sveltejs/kit": "^3.0.1",
|
|
75
75
|
"@sveltejs/package": "^3.0.0",
|
|
76
76
|
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
|
77
|
-
"@vitest/browser-playwright": "^5.0.
|
|
78
|
-
"@vitest/coverage-v8": "^5.0.
|
|
77
|
+
"@vitest/browser-playwright": "^5.0.4",
|
|
78
|
+
"@vitest/coverage-v8": "^5.0.4",
|
|
79
79
|
"cspell": "^10.3.6",
|
|
80
80
|
"eslint": "^9.39.5",
|
|
81
81
|
"eslint-config-airbnb-extended": "^3.3.0",
|
|
82
82
|
"eslint-config-prettier": "^10.1.8",
|
|
83
83
|
"eslint-plugin-import": "^2.32.0",
|
|
84
|
-
"eslint-plugin-jsdoc": "^65.3.
|
|
84
|
+
"eslint-plugin-jsdoc": "^65.3.1",
|
|
85
85
|
"eslint-plugin-package-json": "^1.10.1",
|
|
86
86
|
"eslint-plugin-svelte": "^3.23.1",
|
|
87
87
|
"globals": "^17.13.0",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"svelte-preprocess": "^6.0.5",
|
|
104
104
|
"tslib": "^2.8.1",
|
|
105
105
|
"vite": "^8.3.4",
|
|
106
|
-
"vitest": "^5.0.
|
|
106
|
+
"vitest": "^5.0.4",
|
|
107
107
|
"vitest-browser-svelte": "^3.1.0"
|
|
108
108
|
},
|
|
109
109
|
"peerDependencies": {
|