@vantageos/mosaic-blocks 0.5.18-alpha → 0.5.19-alpha
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 +36 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +36 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -20,7 +20,7 @@ import { Switch } from '@base-ui/react/switch';
|
|
|
20
20
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
21
21
|
export { Tooltip } from '@base-ui/react/tooltip';
|
|
22
22
|
|
|
23
|
-
declare const version = "0.5.
|
|
23
|
+
declare const version = "0.5.19-alpha";
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Placeholder component — infra scaffold only.
|
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ import { Switch } from '@base-ui/react/switch';
|
|
|
20
20
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
21
21
|
export { Tooltip } from '@base-ui/react/tooltip';
|
|
22
22
|
|
|
23
|
-
declare const version = "0.5.
|
|
23
|
+
declare const version = "0.5.19-alpha";
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Placeholder component — infra scaffold only.
|
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import { Menu } from '@base-ui/react/menu';
|
|
|
27
27
|
import { AlertDialog } from '@base-ui/react/alert-dialog';
|
|
28
28
|
|
|
29
29
|
// src/version.ts
|
|
30
|
-
var version = "0.5.
|
|
30
|
+
var version = "0.5.19-alpha";
|
|
31
31
|
function Placeholder({ label = "mosaic-blocks placeholder" }) {
|
|
32
32
|
return /* @__PURE__ */ jsx("div", { "data-mosaic-block": "placeholder", children: label });
|
|
33
33
|
}
|
|
@@ -11464,7 +11464,8 @@ var chatThreadRootVariants = cva([
|
|
|
11464
11464
|
"relative flex min-h-0 flex-1 flex-col overflow-y-auto"
|
|
11465
11465
|
]);
|
|
11466
11466
|
var chatThreadContentVariants = cva([
|
|
11467
|
-
"mx-auto flex w-full max-w-2xl flex-col gap-4 px-4 py-6 sm:px-6"
|
|
11467
|
+
"mx-auto flex w-full max-w-2xl flex-col gap-4 px-4 py-6 sm:px-6",
|
|
11468
|
+
"[&>*]:[content-visibility:auto] [&>*]:[contain-intrinsic-size:auto_4rem]"
|
|
11468
11469
|
]);
|
|
11469
11470
|
var chatThreadScrollButtonVariants = cva([
|
|
11470
11471
|
"absolute bottom-4 left-1/2 -translate-x-1/2 inline-flex size-9",
|
|
@@ -11478,6 +11479,7 @@ var BOTTOM_THRESHOLD_PX = 24;
|
|
|
11478
11479
|
function isNearBottom(element) {
|
|
11479
11480
|
return element.scrollHeight - element.scrollTop - element.clientHeight <= BOTTOM_THRESHOLD_PX;
|
|
11480
11481
|
}
|
|
11482
|
+
var NAVIGATION_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "PageUp", "PageDown", "Home", "End"]);
|
|
11481
11483
|
function MosaicChatThread({
|
|
11482
11484
|
children,
|
|
11483
11485
|
scrollToBottomLabel,
|
|
@@ -11509,6 +11511,37 @@ function MosaicChatThread({
|
|
|
11509
11511
|
isAtBottomRef.current = true;
|
|
11510
11512
|
setIsAtBottom(true);
|
|
11511
11513
|
}
|
|
11514
|
+
function disengageBottomAnchor() {
|
|
11515
|
+
isAtBottomRef.current = false;
|
|
11516
|
+
setIsAtBottom(false);
|
|
11517
|
+
}
|
|
11518
|
+
function handleKeyDown(event) {
|
|
11519
|
+
if (NAVIGATION_KEYS.has(event.key)) {
|
|
11520
|
+
disengageBottomAnchor();
|
|
11521
|
+
}
|
|
11522
|
+
}
|
|
11523
|
+
useEffect(() => {
|
|
11524
|
+
function handleSelectionChange() {
|
|
11525
|
+
const container = containerRef.current;
|
|
11526
|
+
if (!container) {
|
|
11527
|
+
return;
|
|
11528
|
+
}
|
|
11529
|
+
const selection = document.getSelection();
|
|
11530
|
+
if (!selection || selection.isCollapsed || selection.rangeCount === 0) {
|
|
11531
|
+
return;
|
|
11532
|
+
}
|
|
11533
|
+
const { anchorNode, focusNode } = selection;
|
|
11534
|
+
const touchesThread = anchorNode !== null && container.contains(anchorNode) || focusNode !== null && container.contains(focusNode);
|
|
11535
|
+
if (touchesThread) {
|
|
11536
|
+
isAtBottomRef.current = false;
|
|
11537
|
+
setIsAtBottom(false);
|
|
11538
|
+
}
|
|
11539
|
+
}
|
|
11540
|
+
document.addEventListener("selectionchange", handleSelectionChange);
|
|
11541
|
+
return () => {
|
|
11542
|
+
document.removeEventListener("selectionchange", handleSelectionChange);
|
|
11543
|
+
};
|
|
11544
|
+
}, []);
|
|
11512
11545
|
useLayoutEffect(() => {
|
|
11513
11546
|
const element = containerRef.current;
|
|
11514
11547
|
if (element && isAtBottomRef.current) {
|
|
@@ -11522,6 +11555,7 @@ function MosaicChatThread({
|
|
|
11522
11555
|
"data-slot": "chat-thread",
|
|
11523
11556
|
role: "log",
|
|
11524
11557
|
onScroll: handleScroll,
|
|
11558
|
+
onKeyDown: handleKeyDown,
|
|
11525
11559
|
className: cn73(chatThreadRootVariants(), className),
|
|
11526
11560
|
children: [
|
|
11527
11561
|
/* @__PURE__ */ jsx("div", { "data-slot": "chat-thread-content", className: chatThreadContentVariants(), children }),
|