@flamingo-stack/openframe-frontend-core 0.0.192 → 0.0.193-snapshot.20260518191824

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.
@@ -5521,6 +5521,28 @@ function CyclingPhrase({
5521
5521
  ] });
5522
5522
  }
5523
5523
 
5524
+ // src/components/chat/types/message.types.ts
5525
+ var MESSAGE_TYPE = {
5526
+ TEXT: "TEXT",
5527
+ THINKING: "THINKING",
5528
+ EXECUTING_TOOL: "EXECUTING_TOOL",
5529
+ EXECUTED_TOOL: "EXECUTED_TOOL",
5530
+ APPROVAL_REQUEST: "APPROVAL_REQUEST",
5531
+ APPROVAL_RESULT: "APPROVAL_RESULT",
5532
+ ERROR: "ERROR",
5533
+ MESSAGE_START: "MESSAGE_START",
5534
+ MESSAGE_END: "MESSAGE_END",
5535
+ MESSAGE_REQUEST: "MESSAGE_REQUEST",
5536
+ AI_METADATA: "AI_METADATA",
5537
+ TOKEN_USAGE: "TOKEN_USAGE",
5538
+ CONTEXT_COMPACTION_START: "CONTEXT_COMPACTION_START",
5539
+ CONTEXT_COMPACTION_END: "CONTEXT_COMPACTION_END",
5540
+ DIRECT_MESSAGE: "DIRECT_MESSAGE",
5541
+ SYSTEM: "SYSTEM",
5542
+ DIALOG_CLOSED: "DIALOG_CLOSED"
5543
+ };
5544
+ var SCROLL_ANCHOR = { TOP: "top", BOTTOM: "bottom" };
5545
+
5524
5546
  // src/components/chat/chat-message-list.tsx
5525
5547
  import { jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
5526
5548
  var STREAMING_WORDS = [
@@ -5535,6 +5557,16 @@ var STREAMING_WORDS = [
5535
5557
  "Conjuring",
5536
5558
  "Riffing"
5537
5559
  ];
5560
+ function hasNonEmptyContent(content) {
5561
+ if (typeof content === "string") return content.length > 0;
5562
+ if (!Array.isArray(content)) return false;
5563
+ return content.some((s) => s.type === "text" && s.text.length > 0);
5564
+ }
5565
+ function disposeAnchorWatcher(w) {
5566
+ if (!w) return;
5567
+ w.ro.disconnect();
5568
+ clearTimeout(w.timer);
5569
+ }
5538
5570
  var ChatMessageList = forwardRef21(
5539
5571
  ({
5540
5572
  className,
@@ -5555,7 +5587,7 @@ var ChatMessageList = forwardRef21(
5555
5587
  NavLinkAnchor,
5556
5588
  ...props
5557
5589
  }, ref) => {
5558
- const { scrollRef, contentRef, scrollToBottom } = useStickToBottom({
5590
+ const { scrollRef, contentRef, scrollToBottom, stopScroll } = useStickToBottom({
5559
5591
  resize: "smooth",
5560
5592
  initial: false
5561
5593
  });
@@ -5619,6 +5651,68 @@ var ChatMessageList = forwardRef21(
5619
5651
  prependRef.current.firstMessageContent = currentFirstContent;
5620
5652
  }
5621
5653
  }, [messages, scrollRef]);
5654
+ const messageElsRef = useRef5(/* @__PURE__ */ new Map());
5655
+ const refCallbacksRef = useRef5(/* @__PURE__ */ new Map());
5656
+ const getRegisterMessageEl = (id) => {
5657
+ let cb = refCallbacksRef.current.get(id);
5658
+ if (cb) return cb;
5659
+ cb = (el) => {
5660
+ if (el) {
5661
+ messageElsRef.current.set(id, el);
5662
+ } else {
5663
+ messageElsRef.current.delete(id);
5664
+ refCallbacksRef.current.delete(id);
5665
+ }
5666
+ };
5667
+ refCallbacksRef.current.set(id, cb);
5668
+ return cb;
5669
+ };
5670
+ const scrolledIdsRef = useRef5(null);
5671
+ if (scrolledIdsRef.current === null) {
5672
+ scrolledIdsRef.current = new Set(
5673
+ messages.filter((m) => hasNonEmptyContent(m.content)).map((m) => m.id)
5674
+ );
5675
+ }
5676
+ const anchorWatcherRef = useRef5(null);
5677
+ useLayoutEffect2(() => {
5678
+ if (!autoScroll) return;
5679
+ const last = messages[messages.length - 1];
5680
+ if (!last || last.role !== "assistant" || last.scrollAnchor !== SCROLL_ANCHOR.TOP) return;
5681
+ if (!hasNonEmptyContent(last.content)) return;
5682
+ const seen = scrolledIdsRef.current;
5683
+ if (seen.has(last.id)) return;
5684
+ const node = messageElsRef.current.get(last.id);
5685
+ const container = scrollRef.current;
5686
+ if (!node || !node.isConnected || !container) return;
5687
+ seen.add(last.id);
5688
+ stopScroll();
5689
+ node.scrollIntoView({ block: "start" });
5690
+ disposeAnchorWatcher(anchorWatcherRef.current);
5691
+ const baselineScrollTop = container.scrollTop;
5692
+ const ro = new ResizeObserver(() => {
5693
+ if (!node.isConnected) {
5694
+ ro.disconnect();
5695
+ return;
5696
+ }
5697
+ if (container.scrollTop > baselineScrollTop + 200) {
5698
+ ro.disconnect();
5699
+ return;
5700
+ }
5701
+ node.scrollIntoView({ block: "start" });
5702
+ });
5703
+ ro.observe(node);
5704
+ const timer = setTimeout(() => {
5705
+ ro.disconnect();
5706
+ if (anchorWatcherRef.current?.id === last.id) {
5707
+ anchorWatcherRef.current = null;
5708
+ }
5709
+ }, 2e3);
5710
+ anchorWatcherRef.current = { id: last.id, ro, timer };
5711
+ }, [messages, autoScroll, stopScroll, scrollRef]);
5712
+ useEffect6(() => () => {
5713
+ disposeAnchorWatcher(anchorWatcherRef.current);
5714
+ anchorWatcherRef.current = null;
5715
+ }, []);
5622
5716
  useEffect6(() => {
5623
5717
  const scrollContainer = scrollRef.current;
5624
5718
  const sentinelElement = sentinelRef.current;
@@ -5686,6 +5780,7 @@ var ChatMessageList = forwardRef21(
5686
5780
  messages.map((message, index) => /* @__PURE__ */ jsx33(
5687
5781
  MemoizedChatMessageEnhanced,
5688
5782
  {
5783
+ ref: getRegisterMessageEl(message.id),
5689
5784
  role: message.role,
5690
5785
  name: message.name,
5691
5786
  content: message.content,
@@ -6924,27 +7019,6 @@ var CONNECTION_STATUS = {
6924
7019
  ERROR: "error"
6925
7020
  };
6926
7021
 
6927
- // src/components/chat/types/message.types.ts
6928
- var MESSAGE_TYPE = {
6929
- TEXT: "TEXT",
6930
- THINKING: "THINKING",
6931
- EXECUTING_TOOL: "EXECUTING_TOOL",
6932
- EXECUTED_TOOL: "EXECUTED_TOOL",
6933
- APPROVAL_REQUEST: "APPROVAL_REQUEST",
6934
- APPROVAL_RESULT: "APPROVAL_RESULT",
6935
- ERROR: "ERROR",
6936
- MESSAGE_START: "MESSAGE_START",
6937
- MESSAGE_END: "MESSAGE_END",
6938
- MESSAGE_REQUEST: "MESSAGE_REQUEST",
6939
- AI_METADATA: "AI_METADATA",
6940
- TOKEN_USAGE: "TOKEN_USAGE",
6941
- CONTEXT_COMPACTION_START: "CONTEXT_COMPACTION_START",
6942
- CONTEXT_COMPACTION_END: "CONTEXT_COMPACTION_END",
6943
- DIRECT_MESSAGE: "DIRECT_MESSAGE",
6944
- SYSTEM: "SYSTEM",
6945
- DIALOG_CLOSED: "DIALOG_CLOSED"
6946
- };
6947
-
6948
7022
  // src/components/chat/types/network.types.ts
6949
7023
  var NETWORK_CONFIG = {
6950
7024
  SHARED_CLOSE_DELAY_MS: 3e3,
@@ -32657,7 +32731,6 @@ function WaitlistForm({
32657
32731
  }
32658
32732
 
32659
32733
  // src/components/features/board/board.tsx
32660
- init_cn();
32661
32734
  import * as React102 from "react";
32662
32735
  import {
32663
32736
  DndContext,
@@ -32671,6 +32744,7 @@ import {
32671
32744
  useSensors
32672
32745
  } from "@dnd-kit/core";
32673
32746
  import { arrayMove, sortableKeyboardCoordinates } from "@dnd-kit/sortable";
32747
+ init_cn();
32674
32748
 
32675
32749
  // src/components/features/board/board-column.tsx
32676
32750
  import { useDroppable } from "@dnd-kit/core";
@@ -33110,6 +33184,18 @@ function Board({
33110
33184
  className
33111
33185
  }) {
33112
33186
  const { collapsed, toggle } = useBoardCollapse(collapseStorageKey);
33187
+ const {
33188
+ scrollRef,
33189
+ trackRef,
33190
+ thumbRef,
33191
+ thumbRatio,
33192
+ onScroll,
33193
+ onTrackClick,
33194
+ onTrackWheel,
33195
+ onThumbPointerDown,
33196
+ onThumbPointerMove,
33197
+ onThumbPointerUp
33198
+ } = useHorizontalScrollbar();
33113
33199
  const [items, setItems] = React102.useState(columns);
33114
33200
  const isDraggingRef = React102.useRef(false);
33115
33201
  React102.useEffect(() => {
@@ -33262,31 +33348,62 @@ function Board({
33262
33348
  onDragEnd: handleDragEnd,
33263
33349
  onDragCancel: handleDragCancel,
33264
33350
  children: [
33265
- /* @__PURE__ */ jsx299("div", { className: cn("flex h-full overflow-x-auto", className), children: items.map((column, i) => {
33266
- const prev = items[i - 1];
33267
- const next = items[i + 1];
33268
- const joinLeft = !!(column.system && prev?.system);
33269
- const joinRight = !!(column.system && next?.system);
33270
- const showGap = i > 0 && !joinLeft;
33271
- return /* @__PURE__ */ jsxs246(React102.Fragment, { children: [
33272
- showGap && /* @__PURE__ */ jsx299("div", { "aria-hidden": true, className: "w-[var(--spacing-system-mf)] shrink-0" }),
33273
- /* @__PURE__ */ jsx299(
33274
- BoardColumn,
33275
- {
33276
- column,
33277
- collapsed: !!collapsed[column.id],
33278
- onToggleCollapse: () => toggle(column.id),
33279
- onAddTicket,
33280
- getTicketHref,
33281
- renderAssignSlot,
33282
- onLoadMore,
33283
- loadMoreRootMargin,
33284
- joinLeft,
33285
- joinRight
33286
- }
33287
- )
33288
- ] }, column.id);
33289
- }) }),
33351
+ /* @__PURE__ */ jsxs246("div", { className: cn("flex flex-col h-full", className), children: [
33352
+ /* @__PURE__ */ jsx299(
33353
+ "div",
33354
+ {
33355
+ ref: scrollRef,
33356
+ onScroll,
33357
+ className: "flex flex-1 min-h-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
33358
+ children: items.map((column, i) => {
33359
+ const prev = items[i - 1];
33360
+ const next = items[i + 1];
33361
+ const joinLeft = !!(column.system && prev?.system);
33362
+ const joinRight = !!(column.system && next?.system);
33363
+ const showGap = i > 0 && !joinLeft;
33364
+ return /* @__PURE__ */ jsxs246(React102.Fragment, { children: [
33365
+ showGap && /* @__PURE__ */ jsx299("div", { "aria-hidden": true, className: "w-[var(--spacing-system-mf)] shrink-0" }),
33366
+ /* @__PURE__ */ jsx299(
33367
+ BoardColumn,
33368
+ {
33369
+ column,
33370
+ collapsed: !!collapsed[column.id],
33371
+ onToggleCollapse: () => toggle(column.id),
33372
+ onAddTicket,
33373
+ getTicketHref,
33374
+ renderAssignSlot,
33375
+ onLoadMore,
33376
+ loadMoreRootMargin,
33377
+ joinLeft,
33378
+ joinRight
33379
+ }
33380
+ )
33381
+ ] }, column.id);
33382
+ })
33383
+ }
33384
+ ),
33385
+ thumbRatio > 0 && /* @__PURE__ */ jsx299(
33386
+ "div",
33387
+ {
33388
+ ref: trackRef,
33389
+ onClick: onTrackClick,
33390
+ onWheel: onTrackWheel,
33391
+ className: "relative h-2 mt-[var(--spacing-system-mf)] rounded-full bg-ods-border cursor-pointer shrink-0",
33392
+ children: /* @__PURE__ */ jsx299(
33393
+ "div",
33394
+ {
33395
+ ref: thumbRef,
33396
+ "data-scrollbar-thumb": true,
33397
+ className: "absolute top-0 h-full rounded-full bg-ods-text-secondary transition-colors",
33398
+ style: { width: `${thumbRatio * 100}%`, cursor: "grab" },
33399
+ onPointerDown: onThumbPointerDown,
33400
+ onPointerMove: onThumbPointerMove,
33401
+ onPointerUp: onThumbPointerUp
33402
+ }
33403
+ )
33404
+ }
33405
+ )
33406
+ ] }),
33290
33407
  /* @__PURE__ */ jsx299(DragOverlay, { dropAnimation: null, children: activeTicket ? /* @__PURE__ */ jsx299(TicketCard, { ticket: activeTicket.ticket, columnId: activeTicket.columnId, isOverlay: true }) : null })
33291
33408
  ]
33292
33409
  }
@@ -33464,6 +33581,8 @@ export {
33464
33581
  remarkCardLinks,
33465
33582
  BlockCard,
33466
33583
  MemoizedChatMessageEnhanced,
33584
+ MESSAGE_TYPE,
33585
+ SCROLL_ANCHOR,
33467
33586
  ChatMessageList,
33468
33587
  Tabs,
33469
33588
  TabsList,
@@ -33497,7 +33616,6 @@ export {
33497
33616
  AUTHOR_TYPE,
33498
33617
  APPROVAL_STATUS,
33499
33618
  CONNECTION_STATUS,
33500
- MESSAGE_TYPE,
33501
33619
  NETWORK_CONFIG,
33502
33620
  useChunkCatchup,
33503
33621
  useNatsDialogSubscription,
@@ -33965,4 +34083,4 @@ export {
33965
34083
  TMCG_SOCIAL_PLATFORMS,
33966
34084
  assets
33967
34085
  };
33968
- //# sourceMappingURL=chunk-CDR4RZ5N.js.map
34086
+ //# sourceMappingURL=chunk-C5VTN2SB.js.map