@x33025/sveltely 0.0.53 → 0.0.54
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/Popover/Popover.svelte +16 -22
- package/dist/style/index.css +7 -1
- package/dist/style.css +34 -1
- package/package.json +1 -1
|
@@ -139,44 +139,43 @@
|
|
|
139
139
|
return Number.isFinite(parsed) ? parsed : 0;
|
|
140
140
|
};
|
|
141
141
|
|
|
142
|
-
const
|
|
142
|
+
const updateRadiusFromSource = () => {
|
|
143
143
|
if (!panelEl || !contentEl) {
|
|
144
144
|
computedPanelRadius = null;
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
contentEl.querySelector<HTMLElement>('.popover-item') ||
|
|
151
|
-
contentEl.querySelector<HTMLElement>('.dropdown-item');
|
|
152
|
-
if (!itemEl) {
|
|
148
|
+
const sourceEl = contentEl.querySelector<HTMLElement>('[data-popover-radius-source]');
|
|
149
|
+
if (!sourceEl) {
|
|
153
150
|
computedPanelRadius = null;
|
|
154
151
|
return;
|
|
155
152
|
}
|
|
156
153
|
|
|
157
|
-
const
|
|
158
|
-
const
|
|
159
|
-
const
|
|
160
|
-
const
|
|
161
|
-
|
|
154
|
+
const sourceStyle = getComputedStyle(sourceEl);
|
|
155
|
+
const sourceRadius = parsePx(sourceStyle.borderTopLeftRadius);
|
|
156
|
+
const sourceRect = sourceEl.getBoundingClientRect();
|
|
157
|
+
const effectiveSourceRadius = Math.min(
|
|
158
|
+
sourceRadius,
|
|
159
|
+
sourceRect.height / 2,
|
|
160
|
+
sourceRect.width / 2
|
|
161
|
+
);
|
|
162
162
|
const panelStyle = getComputedStyle(panelEl);
|
|
163
163
|
const panelPadding = Math.min(parsePx(panelStyle.paddingTop), parsePx(panelStyle.paddingLeft));
|
|
164
|
-
|
|
165
164
|
const panelRect = panelEl.getBoundingClientRect();
|
|
166
|
-
const
|
|
167
|
-
|
|
165
|
+
const panelRadius = Math.min(
|
|
166
|
+
Math.max(0, effectiveSourceRadius + panelPadding),
|
|
168
167
|
panelRect.height / 2,
|
|
169
168
|
panelRect.width / 2
|
|
170
169
|
);
|
|
171
170
|
|
|
172
|
-
computedPanelRadius = `${
|
|
171
|
+
computedPanelRadius = `${panelRadius}px`;
|
|
173
172
|
};
|
|
174
173
|
|
|
175
174
|
const positionAndMeasure = async () => {
|
|
176
175
|
await tick();
|
|
177
176
|
await new Promise<void>((resolve) => requestAnimationFrame(() => resolve()));
|
|
178
177
|
positionPanel();
|
|
179
|
-
|
|
178
|
+
updateRadiusFromSource();
|
|
180
179
|
};
|
|
181
180
|
|
|
182
181
|
const getPopoverIdsFromEvent = (event: Event) => {
|
|
@@ -256,11 +255,6 @@
|
|
|
256
255
|
if (!open) return;
|
|
257
256
|
void positionAndMeasure();
|
|
258
257
|
});
|
|
259
|
-
|
|
260
|
-
$effect(() => {
|
|
261
|
-
if (!open) return;
|
|
262
|
-
updateComputedPanelRadius();
|
|
263
|
-
});
|
|
264
258
|
</script>
|
|
265
259
|
|
|
266
260
|
<svelte:window
|
|
@@ -297,7 +291,7 @@
|
|
|
297
291
|
data-popover-id={popoverId}
|
|
298
292
|
data-popover-parent-id={parentPopoverId ?? ''}
|
|
299
293
|
style="top: {panelCoords.top}px; left: {panelCoords.left}px; transform: {panelTransform}; border-radius: {computedPanelRadius ??
|
|
300
|
-
'
|
|
294
|
+
''};"
|
|
301
295
|
role="dialog"
|
|
302
296
|
aria-modal="false"
|
|
303
297
|
tabindex="-1"
|
package/dist/style/index.css
CHANGED
|
@@ -95,9 +95,15 @@
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
.popover {
|
|
98
|
-
@apply
|
|
98
|
+
@apply border border-gray-200 bg-white p-1 shadow-md;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
.popover-item {
|
|
102
|
+
@apply rounded-md px-2 py-1;
|
|
103
|
+
}
|
|
104
|
+
.popover-item:hover {
|
|
105
|
+
@apply bg-zinc-200;
|
|
106
|
+
}
|
|
101
107
|
.sheet {
|
|
102
108
|
@apply rounded-md bg-white p-4 shadow-md;
|
|
103
109
|
}
|
package/dist/style.css
CHANGED
|
@@ -7,8 +7,11 @@
|
|
|
7
7
|
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
8
8
|
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
|
|
9
9
|
"Courier New", monospace;
|
|
10
|
+
--color-red-100: oklch(93.6% 0.032 17.717);
|
|
11
|
+
--color-red-200: oklch(88.5% 0.062 18.334);
|
|
10
12
|
--color-red-500: oklch(63.7% 0.237 25.331);
|
|
11
13
|
--color-red-600: oklch(57.7% 0.245 27.325);
|
|
14
|
+
--color-red-700: oklch(50.5% 0.213 27.518);
|
|
12
15
|
--color-gray-200: oklch(92.8% 0.006 264.531);
|
|
13
16
|
--color-gray-700: oklch(37.3% 0.034 259.733);
|
|
14
17
|
--color-gray-900: oklch(21% 0.034 264.665);
|
|
@@ -390,12 +393,18 @@
|
|
|
390
393
|
.border-zinc-300 {
|
|
391
394
|
border-color: var(--color-zinc-300);
|
|
392
395
|
}
|
|
396
|
+
.bg-red-100 {
|
|
397
|
+
background-color: var(--color-red-100);
|
|
398
|
+
}
|
|
393
399
|
.bg-white {
|
|
394
400
|
background-color: var(--color-white);
|
|
395
401
|
}
|
|
396
402
|
.bg-zinc-50 {
|
|
397
403
|
background-color: var(--color-zinc-50);
|
|
398
404
|
}
|
|
405
|
+
.bg-zinc-100 {
|
|
406
|
+
background-color: var(--color-zinc-100);
|
|
407
|
+
}
|
|
399
408
|
.bg-zinc-900 {
|
|
400
409
|
background-color: var(--color-zinc-900);
|
|
401
410
|
}
|
|
@@ -456,6 +465,9 @@
|
|
|
456
465
|
.text-red-600 {
|
|
457
466
|
color: var(--color-red-600);
|
|
458
467
|
}
|
|
468
|
+
.text-red-700 {
|
|
469
|
+
color: var(--color-red-700);
|
|
470
|
+
}
|
|
459
471
|
.text-white {
|
|
460
472
|
color: var(--color-white);
|
|
461
473
|
}
|
|
@@ -524,6 +536,13 @@
|
|
|
524
536
|
--tw-outline-style: none;
|
|
525
537
|
outline-style: none;
|
|
526
538
|
}
|
|
539
|
+
.hover\:bg-red-200 {
|
|
540
|
+
&:hover {
|
|
541
|
+
@media (hover: hover) {
|
|
542
|
+
background-color: var(--color-red-200);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
527
546
|
.hover\:bg-zinc-100 {
|
|
528
547
|
&:hover {
|
|
529
548
|
@media (hover: hover) {
|
|
@@ -531,6 +550,13 @@
|
|
|
531
550
|
}
|
|
532
551
|
}
|
|
533
552
|
}
|
|
553
|
+
.hover\:bg-zinc-200 {
|
|
554
|
+
&:hover {
|
|
555
|
+
@media (hover: hover) {
|
|
556
|
+
background-color: var(--color-zinc-200);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}
|
|
534
560
|
.focus\:border-zinc-400 {
|
|
535
561
|
&:focus {
|
|
536
562
|
border-color: var(--color-zinc-400);
|
|
@@ -686,7 +712,6 @@
|
|
|
686
712
|
}
|
|
687
713
|
}
|
|
688
714
|
.popover {
|
|
689
|
-
border-radius: var(--radius-md);
|
|
690
715
|
border-style: var(--tw-border-style);
|
|
691
716
|
border-width: 1px;
|
|
692
717
|
border-color: var(--color-gray-200);
|
|
@@ -695,6 +720,14 @@
|
|
|
695
720
|
--tw-shadow: 0 4px 6px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 2px 4px -2px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
|
|
696
721
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
697
722
|
}
|
|
723
|
+
.popover-item {
|
|
724
|
+
border-radius: var(--radius-md);
|
|
725
|
+
padding-inline: calc(var(--spacing) * 2);
|
|
726
|
+
padding-block: calc(var(--spacing) * 1);
|
|
727
|
+
}
|
|
728
|
+
.popover-item:hover {
|
|
729
|
+
background-color: var(--color-zinc-200);
|
|
730
|
+
}
|
|
698
731
|
.sheet {
|
|
699
732
|
border-radius: var(--radius-md);
|
|
700
733
|
background-color: var(--color-white);
|