@underverse-ui/underverse 0.2.100 → 0.2.101
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/index.cjs +49 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +52 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7874,7 +7874,7 @@ var DateTimePicker = ({
|
|
|
7874
7874
|
|
|
7875
7875
|
// ../../components/ui/CalendarTimeline/CalendarTimeline.tsx
|
|
7876
7876
|
import * as React28 from "react";
|
|
7877
|
-
import { Dot } from "lucide-react";
|
|
7877
|
+
import { Dot, Plus as Plus2 } from "lucide-react";
|
|
7878
7878
|
|
|
7879
7879
|
// ../../components/ui/CalendarTimeline/date.ts
|
|
7880
7880
|
function toDate2(input) {
|
|
@@ -9063,6 +9063,7 @@ function CalendarTimeline({
|
|
|
9063
9063
|
const dragRef = React28.useRef(null);
|
|
9064
9064
|
const [preview, setPreview] = React28.useState(null);
|
|
9065
9065
|
const suppressNextEventClickRef = React28.useRef(false);
|
|
9066
|
+
const [hoverCell, setHoverCell] = React28.useState(null);
|
|
9066
9067
|
const autoScrollStateRef = React28.useRef({
|
|
9067
9068
|
dir: 0,
|
|
9068
9069
|
speed: 0,
|
|
@@ -9272,7 +9273,32 @@ function CalendarTimeline({
|
|
|
9272
9273
|
};
|
|
9273
9274
|
const onPointerMove = (e) => {
|
|
9274
9275
|
const drag = dragRef.current;
|
|
9275
|
-
if (!drag
|
|
9276
|
+
if (!drag) {
|
|
9277
|
+
if (isViewOnly) return;
|
|
9278
|
+
if (!(interactions?.creatable ?? false)) return;
|
|
9279
|
+
const target = e.target;
|
|
9280
|
+
if (target?.closest?.("[data-uv-ct-event]")) {
|
|
9281
|
+
if (hoverCell) setHoverCell(null);
|
|
9282
|
+
return;
|
|
9283
|
+
}
|
|
9284
|
+
const ctx = getPointerContext(e.clientX, e.clientY);
|
|
9285
|
+
if (!ctx) {
|
|
9286
|
+
if (hoverCell) setHoverCell(null);
|
|
9287
|
+
return;
|
|
9288
|
+
}
|
|
9289
|
+
const rowEl = target?.closest?.("[data-uv-ct-row]");
|
|
9290
|
+
if (!rowEl) {
|
|
9291
|
+
if (hoverCell) setHoverCell(null);
|
|
9292
|
+
return;
|
|
9293
|
+
}
|
|
9294
|
+
const rect = rowEl.getBoundingClientRect();
|
|
9295
|
+
const y = clamp3(e.clientY - rect.top, 0, rect.height);
|
|
9296
|
+
if (!hoverCell || hoverCell.resourceId !== ctx.resourceId || hoverCell.slotIdx !== ctx.slotIdx || Math.abs(hoverCell.y - y) > 0.5) {
|
|
9297
|
+
setHoverCell({ resourceId: ctx.resourceId, slotIdx: ctx.slotIdx, y });
|
|
9298
|
+
}
|
|
9299
|
+
return;
|
|
9300
|
+
}
|
|
9301
|
+
if (drag.pointerId !== e.pointerId) return;
|
|
9276
9302
|
updateAutoScrollFromPointer(e.clientX, e.clientY);
|
|
9277
9303
|
updateDragPreview(e.clientX, e.clientY);
|
|
9278
9304
|
};
|
|
@@ -9281,6 +9307,7 @@ function CalendarTimeline({
|
|
|
9281
9307
|
if (!drag || drag.pointerId !== e.pointerId) return;
|
|
9282
9308
|
dragRef.current = null;
|
|
9283
9309
|
stopAutoScroll();
|
|
9310
|
+
setHoverCell(null);
|
|
9284
9311
|
if (!preview) {
|
|
9285
9312
|
setPreview(null);
|
|
9286
9313
|
return;
|
|
@@ -9453,6 +9480,7 @@ function CalendarTimeline({
|
|
|
9453
9480
|
className: "relative flex-1 overflow-auto scrollbar-thin scrollbar-thumb-muted scrollbar-track-transparent",
|
|
9454
9481
|
onPointerMove,
|
|
9455
9482
|
onPointerUp,
|
|
9483
|
+
onPointerLeave: () => setHoverCell(null),
|
|
9456
9484
|
children: [
|
|
9457
9485
|
/* @__PURE__ */ jsx36("div", { style: { height: topSpacer } }),
|
|
9458
9486
|
rows.slice(startRow, endRow).map((row, idx) => {
|
|
@@ -9464,6 +9492,7 @@ function CalendarTimeline({
|
|
|
9464
9492
|
const r = row.resource;
|
|
9465
9493
|
const layout = layoutsByResource.get(r.id) ?? { visible: [], hidden: [], baseTop: lanePaddingY, eventHeight };
|
|
9466
9494
|
const canMore = layout.hidden.length > 0 && !!onMoreClick;
|
|
9495
|
+
const showCreateHint = !isViewOnly && (interactions?.creatable ?? false) && !preview && hoverCell?.resourceId === r.id;
|
|
9467
9496
|
return /* @__PURE__ */ jsx36(
|
|
9468
9497
|
"div",
|
|
9469
9498
|
{
|
|
@@ -9536,6 +9565,7 @@ function CalendarTimeline({
|
|
|
9536
9565
|
ev.className,
|
|
9537
9566
|
isPreview && "ring-2 ring-primary/50 ring-offset-1 ring-offset-background scale-[1.02] z-10"
|
|
9538
9567
|
),
|
|
9568
|
+
"data-uv-ct-event": true,
|
|
9539
9569
|
style: {
|
|
9540
9570
|
left,
|
|
9541
9571
|
top,
|
|
@@ -9606,6 +9636,24 @@ function CalendarTimeline({
|
|
|
9606
9636
|
}
|
|
9607
9637
|
);
|
|
9608
9638
|
})() : null,
|
|
9639
|
+
showCreateHint ? /* @__PURE__ */ jsx36(
|
|
9640
|
+
"div",
|
|
9641
|
+
{
|
|
9642
|
+
className: cn(
|
|
9643
|
+
"pointer-events-none absolute z-20",
|
|
9644
|
+
"h-5 w-5 rounded-full",
|
|
9645
|
+
"bg-background/80 backdrop-blur-sm",
|
|
9646
|
+
"border border-border/60 shadow-xs",
|
|
9647
|
+
"flex items-center justify-center"
|
|
9648
|
+
),
|
|
9649
|
+
style: {
|
|
9650
|
+
left: hoverCell.slotIdx * slotWidth + slotWidth / 2 - 10,
|
|
9651
|
+
top: clamp3(Math.round(hoverCell.y - 10), 6, Math.max(6, h - 26))
|
|
9652
|
+
},
|
|
9653
|
+
"aria-hidden": true,
|
|
9654
|
+
children: /* @__PURE__ */ jsx36(Plus2, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
9655
|
+
}
|
|
9656
|
+
) : null,
|
|
9609
9657
|
canMore ? /* @__PURE__ */ jsxs31(
|
|
9610
9658
|
"button",
|
|
9611
9659
|
{
|
|
@@ -18760,7 +18808,7 @@ import {
|
|
|
18760
18808
|
ListTodo as ListTodo3,
|
|
18761
18809
|
Minus as Minus2,
|
|
18762
18810
|
Palette as Palette3,
|
|
18763
|
-
Plus as
|
|
18811
|
+
Plus as Plus3,
|
|
18764
18812
|
Quote as QuoteIcon2,
|
|
18765
18813
|
Subscript as SubscriptIcon2,
|
|
18766
18814
|
Superscript as SuperscriptIcon2,
|
|
@@ -18938,7 +18986,7 @@ var FloatingMenuContent = ({ editor }) => {
|
|
|
18938
18986
|
onClick: () => setShowCommands(true),
|
|
18939
18987
|
className: "flex items-center gap-1 px-2 py-1.5 rounded-lg hover:bg-accent transition-all group",
|
|
18940
18988
|
children: [
|
|
18941
|
-
/* @__PURE__ */ jsx77(
|
|
18989
|
+
/* @__PURE__ */ jsx77(Plus3, { className: "w-4 h-4 text-muted-foreground group-hover:text-foreground" }),
|
|
18942
18990
|
/* @__PURE__ */ jsx77("span", { className: "text-sm text-muted-foreground group-hover:text-foreground", children: t("floatingMenu.addBlock") })
|
|
18943
18991
|
]
|
|
18944
18992
|
}
|