impact-nova 2.5.16 → 2.6.0-alpha.0
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/README.md +27 -25
- package/dist/components/data/ag-grid-react/ag-grid.types.d.ts +28 -1
- package/dist/components/data/ag-grid-react/cell-renderers/date-display-renderer.d.ts +0 -3
- package/dist/components/data/ag-grid-react/cell-renderers/date-display-renderer.js +31 -38
- package/dist/components/data/ag-grid-react/cell-renderers/input-display-renderer.d.ts +1 -1
- package/dist/components/data/ag-grid-react/chat/chat-capabilities.d.ts +9 -0
- package/dist/components/data/ag-grid-react/chat/chat-capabilities.js +22 -0
- package/dist/components/data/ag-grid-react/chat/chat-column.d.ts +20 -0
- package/dist/components/data/ag-grid-react/chat/chat-column.js +81 -0
- package/dist/components/data/ag-grid-react/chat/chat-composer.d.ts +10 -0
- package/dist/components/data/ag-grid-react/chat/chat-composer.js +352 -0
- package/dist/components/data/ag-grid-react/chat/chat-constants.d.ts +17 -0
- package/dist/components/data/ag-grid-react/chat/chat-constants.js +22 -0
- package/dist/components/data/ag-grid-react/chat/chat-format.d.ts +41 -0
- package/dist/components/data/ag-grid-react/chat/chat-format.js +94 -0
- package/dist/components/data/ag-grid-react/chat/chat-host.d.ts +10 -0
- package/dist/components/data/ag-grid-react/chat/chat-host.js +651 -0
- package/dist/components/data/ag-grid-react/chat/chat-host.types.d.ts +13 -0
- package/dist/components/data/ag-grid-react/chat/chat-html.d.ts +2 -0
- package/dist/components/data/ag-grid-react/chat/chat-html.js +40 -0
- package/dist/components/data/ag-grid-react/chat/chat-identity.d.ts +13 -0
- package/dist/components/data/ag-grid-react/chat/chat-identity.js +24 -0
- package/dist/components/data/ag-grid-react/chat/chat-menu.d.ts +13 -0
- package/dist/components/data/ag-grid-react/chat/chat-menu.js +15 -0
- package/dist/components/data/ag-grid-react/chat/chat-notify.d.ts +17 -0
- package/dist/components/data/ag-grid-react/chat/chat-notify.js +124 -0
- package/dist/components/data/ag-grid-react/chat/chat-persist.d.ts +13 -0
- package/dist/components/data/ag-grid-react/chat/chat-persist.js +34 -0
- package/dist/components/data/ag-grid-react/chat/chat-priority.d.ts +13 -0
- package/dist/components/data/ag-grid-react/chat/chat-priority.js +79 -0
- package/dist/components/data/ag-grid-react/chat/chat-summaries.d.ts +2 -0
- package/dist/components/data/ag-grid-react/chat/chat-summaries.js +24 -0
- package/dist/components/data/ag-grid-react/chat/chat-thread-ui.d.ts +72 -0
- package/dist/components/data/ag-grid-react/chat/chat-thread-ui.js +713 -0
- package/dist/components/data/ag-grid-react/chat/chat-toggle.d.ts +6 -0
- package/dist/components/data/ag-grid-react/chat/chat-toggle.js +25 -0
- package/dist/components/data/ag-grid-react/chat/chat-ui-actions.d.ts +13 -0
- package/dist/components/data/ag-grid-react/chat/chat-ui-actions.js +26 -0
- package/dist/components/data/ag-grid-react/chat/chat-window.d.ts +14 -0
- package/dist/components/data/ag-grid-react/chat/chat-window.js +82 -0
- package/dist/components/data/ag-grid-react/chat/chat-workspace.d.ts +91 -0
- package/dist/components/data/ag-grid-react/chat/chat-workspace.js +555 -0
- package/dist/components/data/ag-grid-react/chat/chat.types.d.ts +319 -0
- package/dist/components/data/ag-grid-react/chat/index.d.ts +6 -0
- package/dist/components/data/ag-grid-react/chat/index.js +24 -0
- package/dist/components/data/ag-grid-react/chat.story-data.d.ts +34 -0
- package/dist/components/data/ag-grid-react/chat.story-sources.d.ts +4 -0
- package/dist/components/data/ag-grid-react/comments/assets/comments-no-results.png.js +4 -0
- package/dist/components/data/ag-grid-react/comments/comment-mode-toggle.d.ts +6 -0
- package/dist/components/data/ag-grid-react/comments/comment-mode-toggle.js +29 -0
- package/dist/components/data/ag-grid-react/comments/comments-actions-menu.d.ts +8 -0
- package/dist/components/data/ag-grid-react/comments/comments-actions-menu.js +18 -0
- package/dist/components/data/ag-grid-react/comments/comments-ag-grid-presence.d.ts +18 -0
- package/dist/components/data/ag-grid-react/comments/comments-ag-grid-presence.js +16 -0
- package/dist/components/data/ag-grid-react/comments/comments-capabilities.d.ts +11 -0
- package/dist/components/data/ag-grid-react/comments/comments-capabilities.js +26 -0
- package/dist/components/data/ag-grid-react/comments/comments-constants.d.ts +12 -0
- package/dist/components/data/ag-grid-react/comments/comments-constants.js +21 -0
- package/dist/components/data/ag-grid-react/comments/comments-format.d.ts +20 -0
- package/dist/components/data/ag-grid-react/comments/comments-format.js +49 -0
- package/dist/components/data/ag-grid-react/comments/comments-generation.d.ts +14 -0
- package/dist/components/data/ag-grid-react/comments/comments-generation.js +18 -0
- package/dist/components/data/ag-grid-react/comments/comments-host.d.ts +10 -0
- package/dist/components/data/ag-grid-react/comments/comments-host.js +343 -0
- package/dist/components/data/ag-grid-react/comments/comments-host.types.d.ts +18 -0
- package/dist/components/data/ag-grid-react/comments/comments-identity.d.ts +7 -0
- package/dist/components/data/ag-grid-react/comments/comments-identity.js +20 -0
- package/dist/components/data/ag-grid-react/comments/comments-menu.d.ts +29 -0
- package/dist/components/data/ag-grid-react/comments/comments-menu.js +35 -0
- package/dist/components/data/ag-grid-react/comments/comments-overlay-anchor.d.ts +22 -0
- package/dist/components/data/ag-grid-react/comments/comments-overlay-anchor.js +98 -0
- package/dist/components/data/ag-grid-react/comments/comments-overlay.d.ts +21 -0
- package/dist/components/data/ag-grid-react/comments/comments-overlay.js +406 -0
- package/dist/components/data/ag-grid-react/comments/comments-panel.d.ts +9 -0
- package/dist/components/data/ag-grid-react/comments/comments-panel.js +272 -0
- package/dist/components/data/ag-grid-react/comments/comments-persist.d.ts +11 -0
- package/dist/components/data/ag-grid-react/comments/comments-persist.js +19 -0
- package/dist/components/data/ag-grid-react/comments/comments-reveal.d.ts +11 -0
- package/dist/components/data/ag-grid-react/comments/comments-reveal.js +31 -0
- package/dist/components/data/ag-grid-react/comments/comments-ui-actions.d.ts +18 -0
- package/dist/components/data/ag-grid-react/comments/comments-ui-actions.js +22 -0
- package/dist/components/data/ag-grid-react/comments/comments-window.d.ts +10 -0
- package/dist/components/data/ag-grid-react/comments/comments-window.js +62 -0
- package/dist/components/data/ag-grid-react/comments/comments.types.d.ts +178 -0
- package/dist/components/data/ag-grid-react/comments/index.d.ts +5 -0
- package/dist/components/data/ag-grid-react/comments/index.js +15 -0
- package/dist/components/data/ag-grid-react/comments-cell-renderers-showcase.d.ts +25 -0
- package/dist/components/data/ag-grid-react/comments.story-data.d.ts +37 -0
- package/dist/components/data/ag-grid-react/comments.story-sources.d.ts +11 -0
- package/dist/components/data/ag-grid-react/grid-cell-address.d.ts +21 -0
- package/dist/components/data/ag-grid-react/grid-cell-address.js +21 -0
- package/dist/components/data/ag-grid-react/grid-row-reveal.d.ts +34 -0
- package/dist/components/data/ag-grid-react/grid-row-reveal.js +33 -0
- package/dist/components/data/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.js +75 -65
- package/dist/components/data/ag-grid-react/headers/advanced-filter/column-filter-section.d.ts +1 -1
- package/dist/components/data/ag-grid-react/headers/advanced-filter/column-filter-section.js +54 -54
- package/dist/components/data/ag-grid-react/headers/components/date-filter-picker.d.ts +1 -1
- package/dist/components/data/ag-grid-react/headers/header-search-input.js +122 -119
- package/dist/components/data/ag-grid-react/headers/utils/date-utils.d.ts +2 -1
- package/dist/components/data/ag-grid-react/headers/utils/date-utils.js +25 -20
- package/dist/components/data/ag-grid-react/headers/utils/filter-utils.d.ts +1 -1
- package/dist/components/data/ag-grid-react/index.d.ts +1 -1
- package/dist/components/data/ag-grid-react/index.js +481 -254
- package/dist/components/data/ag-grid-react/notes/index.d.ts +2 -0
- package/dist/components/data/ag-grid-react/notes/index.js +1 -0
- package/dist/components/data/ag-grid-react/notes/notes-ag-grid-adapter.d.ts +25 -0
- package/dist/components/data/ag-grid-react/notes/notes-ag-grid-adapter.js +32 -0
- package/dist/components/data/ag-grid-react/notes/notes-constants.d.ts +2 -0
- package/dist/components/data/ag-grid-react/notes/notes-constants.js +4 -0
- package/dist/components/data/ag-grid-react/notes/notes.types.d.ts +12 -0
- package/dist/components/data/ag-grid-react/notes.story-sources.d.ts +7 -0
- package/dist/components/data/ag-grid-react/nova-system-column.d.ts +7 -0
- package/dist/components/data/ag-grid-react/nova-system-column.js +18 -0
- package/dist/components/data/ag-grid-react/theme.js +6 -2
- package/dist/components/data/ag-grid-react/value-formatter.types.d.ts +4 -0
- package/dist/components/data/ag-grid-react/value-formatters.d.ts +0 -19
- package/dist/components/data/ag-grid-react/value-formatters.js +88 -90
- package/dist/components/data/data-table/build-column-tree-from-grid.d.ts +0 -1
- package/dist/components/data/data-table/build-column-tree-from-grid.js +49 -53
- package/dist/components/data/data-table/data-table-column-apply.d.ts +0 -2
- package/dist/components/data/data-table/data-table-column-apply.js +73 -84
- package/dist/components/data/data-table/data-table-column-def-pin.js +34 -31
- package/dist/components/data/data-table/data-table-column-list.js +64 -94
- package/dist/components/data/data-table/data-table-column-tree-cache.d.ts +6 -12
- package/dist/components/data/data-table/data-table-column-tree-cache.js +131 -250
- package/dist/components/data/data-table/data-table-context.js +5 -5
- package/dist/components/data/data-table/data-table-sheet-context.js +1 -1
- package/dist/components/data/data-table/data-table-sheet.js +2 -1
- package/dist/components/data/data-table/patch-column-tree-indicators-from-grid.d.ts +0 -5
- package/dist/components/data/data-table/patch-column-tree-indicators-from-grid.js +11 -28
- package/dist/components/data/data-table/use-data-table-column-list-sync.d.ts +0 -10
- package/dist/components/data/data-table/use-data-table-column-list-sync.js +196 -250
- package/dist/components/data/nested-list/components/NestedListContent.d.ts +2 -10
- package/dist/components/data/nested-list/components/NestedListContent.js +138 -253
- package/dist/components/data/nested-list/components/SortableItem.d.ts +1 -2
- package/dist/components/data/nested-list/components/SortableItem.js +60 -62
- package/dist/components/data/nested-list/hooks/useNestedListDragDrop.d.ts +20 -10
- package/dist/components/data/nested-list/hooks/useNestedListDragDrop.js +233 -44
- package/dist/components/data/nested-list/nested-list-constants.d.ts +1 -4
- package/dist/components/data/nested-list/nested-list-constants.js +4 -10
- package/dist/components/data/nested-list/nested-list.js +336 -322
- package/dist/components/data/nested-list/nested-list.types.d.ts +0 -17
- package/dist/components/data-display/calendar/calendar-config.js +22 -21
- package/dist/components/data-display/calendar/calendar-day-button.js +21 -21
- package/dist/components/data-display/calendar/calendar-day-picker-view.js +36 -35
- package/dist/components/data-display/calendar/calendar-fiscal-labels.d.ts +3 -3
- package/dist/components/data-display/calendar/calendar-fiscal-labels.js +50 -62
- package/dist/components/data-display/calendar/calendar.js +138 -137
- package/dist/components/data-display/calendar/fiscal-period-caption-select.js +23 -22
- package/dist/components/data-display/calendar/use-calendar-i18n.d.ts +1 -0
- package/dist/components/data-display/calendar/use-calendar-i18n.js +10 -9
- package/dist/components/data-display/chart/chart.js +72 -72
- package/dist/components/data-display/chart/chart.utils.d.ts +1 -1
- package/dist/components/data-display/chart/chart.utils.js +40 -31
- package/dist/components/feedback/sheet/sheet.js +1 -1
- package/dist/components/feedback/toast/toast.d.ts +1 -1
- package/dist/components/feedback/toast/toast.variants.d.ts +1 -1
- package/dist/components/flows/filter-panel/filter-panel.d.ts +1 -1
- package/dist/components/flows/filter-panel/filter-panel.js +65 -64
- package/dist/components/flows/filter-panel/filter-panel.types.d.ts +1 -0
- package/dist/components/forms/date-picker/date-picker.js +125 -126
- package/dist/components/forms/date-picker/date-range-picker.js +191 -192
- package/dist/components/forms/date-picker/multi-date-picker.js +66 -67
- package/dist/components/forms/date-picker/multi-week-picker.js +82 -83
- package/dist/components/forms/date-picker/use-picker-i18n.d.ts +6 -0
- package/dist/components/forms/date-picker/use-picker-i18n.js +11 -0
- package/dist/components/forms/date-picker/week-picker.js +146 -147
- package/dist/components/forms/date-picker/week-range-picker.js +158 -159
- package/dist/components/ui/local-raster-icons/message3d.webp.js +4 -0
- package/dist/components/ui/local-raster-icons/rasterIcons.d.ts +1 -0
- package/dist/components/ui/local-raster-icons/rasterIcons.js +27 -25
- package/dist/form-react/Fields/WeekRangePicker.js +16 -16
- package/dist/i18n/defaultMessages.d.ts +144 -0
- package/dist/i18n/defaultMessages.js +161 -19
- package/dist/i18n/format/collator.d.ts +1 -0
- package/dist/i18n/format/collator.js +7 -0
- package/dist/i18n/format/date-pattern.d.ts +5 -0
- package/dist/i18n/format/date-pattern.js +20 -0
- package/dist/i18n/format/format-date.d.ts +9 -0
- package/dist/i18n/format/format-date.js +56 -0
- package/dist/i18n/format/format-number.d.ts +20 -0
- package/dist/i18n/format/format-number.js +68 -0
- package/dist/i18n/format/formatter-cache.d.ts +9 -0
- package/dist/i18n/format/formatter-cache.js +66 -0
- package/dist/i18n/format/index.d.ts +6 -0
- package/dist/i18n/format/parse-number.d.ts +6 -0
- package/dist/i18n/format/parse-number.js +53 -0
- package/dist/i18n/getDateFnsLocale.d.ts +5 -4
- package/dist/i18n/getDateFnsLocale.js +46 -16
- package/dist/i18n/i18n.types.d.ts +13 -0
- package/dist/i18n/impact-nova-i18n-context.d.ts +1 -1
- package/dist/i18n/impact-nova-i18n-context.js +33 -25
- package/dist/i18n/impact-nova-i18n-defaults.js +8 -6
- package/dist/i18n/index.d.ts +4 -1
- package/dist/i18n/index.js +41 -16
- package/dist/i18n/locale-config.d.ts +28 -0
- package/dist/i18n/locale-config.js +32 -0
- package/dist/i18n/locales/de.js +142 -0
- package/dist/i18n/locales/es.js +142 -0
- package/dist/i18n/locales/hi.js +142 -0
- package/dist/i18n/locales/kn.js +142 -0
- package/dist/i18n/week-start.d.ts +6 -0
- package/dist/i18n/week-start.js +30 -0
- package/dist/impact-nova-components.css +249 -0
- package/dist/impact-nova-tokens.scss +6 -0
- package/dist/impact-nova.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +624 -601
- package/dist/llms/index.js +26 -2
- package/dist/llms/rules/ag-grid.js +1 -1
- package/dist/llms/rules/best-practices.js +1 -1
- package/dist/llms/rules/data-table-chat.js +1 -0
- package/dist/llms/rules/data-table-comments.js +1 -0
- package/dist/llms/rules/data-table-notes.js +1 -0
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/migration.js +1 -1
- package/dist/llms/rules/real-world-patterns.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/dist/llms/rules/troubleshooting.js +1 -1
- package/dist/providers/app-providers.d.ts +3 -1
- package/dist/providers/app-providers.js +22 -11
- package/package.json +13 -1
- package/dist/components/data/data-table/column-picker-authority.d.ts +0 -34
- package/dist/components/data/data-table/column-picker-authority.js +0 -116
- package/dist/components/data/data-table/column-picker-drop-validation.d.ts +0 -7
- package/dist/components/data/data-table/column-picker-drop-validation.js +0 -37
- package/dist/components/data/data-table/data-table-column-list-tree-apply.d.ts +0 -10
- package/dist/components/data/data-table/data-table-column-list-tree-apply.js +0 -79
- package/dist/components/data/data-table/data-table-flat-column-virtual-rows.d.ts +0 -26
- package/dist/components/data/data-table/data-table-flat-column-virtual-rows.js +0 -195
- package/dist/components/data/data-table/data-table-picker-column-eligibility.d.ts +0 -1
- package/dist/components/data/data-table/data-table-picker-column-eligibility.js +0 -7
- package/dist/components/data/data-table/reconcile-column-tree-from-grid.d.ts +0 -12
- package/dist/components/data/data-table/reconcile-column-tree-from-grid.js +0 -12
- package/dist/components/data/nested-list/hooks/useVirtualNestedListDrag.d.ts +0 -24
- package/dist/components/data/nested-list/hooks/useVirtualNestedListDrag.js +0 -128
- package/dist/components/data/nested-list/nested-list-display-utils.d.ts +0 -11
- package/dist/components/data/nested-list/nested-list-display-utils.js +0 -74
- package/dist/components/data/nested-list/nested-list-drop-engine.d.ts +0 -31
- package/dist/components/data/nested-list/nested-list-drop-engine.js +0 -209
- package/dist/components/data/nested-list/nested-list-flat-virtual-handlers.d.ts +0 -26
- package/dist/components/data/nested-list/nested-list-flat-virtual-handlers.js +0 -67
- package/dist/components/data/nested-list/nested-list-item-tree-mutations.d.ts +0 -4
- package/dist/components/data/nested-list/nested-list-item-tree-mutations.js +0 -43
- package/dist/components/data/nested-list/nested-list-lazy-flat-rows.d.ts +0 -3
- package/dist/components/data/nested-list/nested-list-lazy-flat-rows.js +0 -34
- package/dist/components/data/nested-list/nested-list-row-estimates.d.ts +0 -9
- package/dist/components/data/nested-list/nested-list-row-estimates.js +0 -14
- package/dist/components/data/nested-list/nested-list-scroll-anchor.d.ts +0 -36
- package/dist/components/data/nested-list/nested-list-scroll-anchor.js +0 -47
- package/dist/components/data/nested-list/nested-list-virtual-drop.d.ts +0 -59
- package/dist/components/data/nested-list/nested-list-virtual-drop.js +0 -341
- package/dist/lib/hash/fnv1a128.d.ts +0 -16
- package/dist/lib/hash/fnv1a128.js +0 -21
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { jsx as t, jsxs as o } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as ie, useState as c, useEffect as $ } from "react";
|
|
3
|
+
import { useVirtualizedList as de } from "../../../../lib/virtualized/useVirtualizedList.js";
|
|
4
|
+
import { Avatar as ce, AvatarFallback as me } from "../../../data-display/avatar/avatar.js";
|
|
5
|
+
import { DataTableSheet as he, DataTableSheetContent as pe, DataTableSheetHeader as ue } from "../../data-table/data-table-sheet.js";
|
|
6
|
+
import { DataTableSheetBody as xe, DataTableSheetSection as fe } from "../../data-table/data-table-sheet-layout.js";
|
|
7
|
+
import { Button as J } from "../../../primitives/button/button.js";
|
|
8
|
+
import { Input as ve } from "../../../forms/input/input.js";
|
|
9
|
+
import { DropdownMenu as ge, DropdownMenuTrigger as be, DropdownMenuContent as Ne, DropdownMenuItem as q } from "../../../feedback/dropdown-menu/dropdown-menu.js";
|
|
10
|
+
import { EmptyContainer as F, EmptyContainerImage as K, EmptyContainerTitle as H, EmptyContainerDescription as Q } from "../../../primitives/empty-container/empty-container.js";
|
|
11
|
+
import { useImpactNovaI18n as Y } from "../../../../i18n/use-impact-nova-i18n.js";
|
|
12
|
+
import { cn as I } from "../../../../lib/utils.js";
|
|
13
|
+
import { Cross as Ce, Search as we, Filterlist as Te, FillTick as Se, CheckTickcircle as ye } from "impact-nova-icons";
|
|
14
|
+
import { COMMENTS_VIRTUALIZE_AFTER as Ee, COMMENTS_PANEL_PAGE_SIZE as U } from "./comments-constants.js";
|
|
15
|
+
import { resolveCommentsCapabilities as Ie, commentsOverlayActions as Ae } from "./comments-capabilities.js";
|
|
16
|
+
import { commentInitials as De, commentAvatarTone as Me, formatPanelTimestamp as Re } from "./comments-format.js";
|
|
17
|
+
import { buildCommentThreadMenuItems as ke } from "./comments-ui-actions.js";
|
|
18
|
+
import { CommentActionsMenu as Le } from "./comments-actions-menu.js";
|
|
19
|
+
import Pe from "./assets/comments-no-results.png.js";
|
|
20
|
+
import { Message3d as ze } from "../../../ui/local-raster-icons/rasterIcons.js";
|
|
21
|
+
const _e = "!h-8 !w-8 !rounded-md text-sm font-extrabold", V = "flex-1 h-full w-full min-w-0 max-w-none animate-none rounded-none border-0 bg-transparent px-3 py-0 shadow-none [&>div]:max-w-[284px] [&>div]:gap-[10px]";
|
|
22
|
+
function j(n, u, a) {
|
|
23
|
+
return n < u - 1 && !a ? "border-b border-stroke-hairline" : void 0;
|
|
24
|
+
}
|
|
25
|
+
function Be({
|
|
26
|
+
summary: n,
|
|
27
|
+
selected: u,
|
|
28
|
+
config: a,
|
|
29
|
+
persist: w,
|
|
30
|
+
onSelect: T,
|
|
31
|
+
onReload: x,
|
|
32
|
+
onError: r
|
|
33
|
+
}) {
|
|
34
|
+
const { t: d, dateLocale: i } = Y(), h = Ie(a.getCapabilities, n.address), g = Ae(h), b = Math.max(0, n.messageCount - 1), m = n.author ?? d("comments.title"), N = {
|
|
35
|
+
address: n.address,
|
|
36
|
+
threadId: n.threadId,
|
|
37
|
+
resolved: n.resolved
|
|
38
|
+
}, l = ke({
|
|
39
|
+
showDelete: g.showDelete && !n.resolved,
|
|
40
|
+
deleteLabel: d("comments.deleteThread"),
|
|
41
|
+
extras: a.threadActions,
|
|
42
|
+
context: N,
|
|
43
|
+
onDelete: () => {
|
|
44
|
+
w({
|
|
45
|
+
type: "delete-thread",
|
|
46
|
+
threadId: n.threadId,
|
|
47
|
+
address: n.address
|
|
48
|
+
}).then(x).catch(() => r(d("comments.saveError")));
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return /* @__PURE__ */ o(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
"data-iv-comments-summary": "",
|
|
55
|
+
"data-slot": "comments-summary",
|
|
56
|
+
className: I("relative flex items-start rounded-2xl", u && "bg-brand-tint"),
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ o(
|
|
59
|
+
"button",
|
|
60
|
+
{
|
|
61
|
+
type: "button",
|
|
62
|
+
className: "flex min-w-0 flex-1 flex-col items-start gap-3 p-4 pr-16 text-left",
|
|
63
|
+
"aria-current": u ? "true" : void 0,
|
|
64
|
+
onClick: () => T(n.address, n.threadId),
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ o("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
67
|
+
a.renderAvatar ? a.renderAvatar({ author: m }) : /* @__PURE__ */ t(ce, { size: "sm", shape: "square", className: _e, children: /* @__PURE__ */ t(me, { className: I("text-sm font-extrabold", Me(m)), children: De(m) }) }),
|
|
68
|
+
/* @__PURE__ */ o("div", { className: "min-w-0", children: [
|
|
69
|
+
/* @__PURE__ */ t("p", { className: "truncate text-sm font-semibold leading-[21px] text-content-secondary", children: m }),
|
|
70
|
+
n.updatedAt ? /* @__PURE__ */ t("p", { className: "text-xs font-medium leading-4 text-content-tertiary", children: Re(n.updatedAt, i) }) : null
|
|
71
|
+
] })
|
|
72
|
+
] }),
|
|
73
|
+
/* @__PURE__ */ t("p", { className: "line-clamp-3 text-sm font-medium leading-5 text-content", children: n.preview }),
|
|
74
|
+
b > 0 && !n.resolved ? /* @__PURE__ */ t("span", { className: "text-sm font-medium leading-5 text-brand", children: d("comments.replies", { count: b }) }) : null
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ o("div", { className: "absolute right-2 top-3 flex items-center", children: [
|
|
79
|
+
/* @__PURE__ */ t(
|
|
80
|
+
Le,
|
|
81
|
+
{
|
|
82
|
+
label: d("comments.threadActions"),
|
|
83
|
+
items: l,
|
|
84
|
+
align: "end",
|
|
85
|
+
render: a.renderThreadActions ? (S) => a.renderThreadActions({ items: S, context: N }) : void 0
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
g.showResolve ? /* @__PURE__ */ t(
|
|
89
|
+
J,
|
|
90
|
+
{
|
|
91
|
+
type: "button",
|
|
92
|
+
size: "iconSm",
|
|
93
|
+
variant: "ghost",
|
|
94
|
+
className: I(n.resolved && "text-success"),
|
|
95
|
+
"aria-label": n.resolved ? d("comments.unresolve") : d("comments.resolve"),
|
|
96
|
+
onClick: () => {
|
|
97
|
+
w({
|
|
98
|
+
type: "resolve",
|
|
99
|
+
threadId: n.threadId,
|
|
100
|
+
address: n.address,
|
|
101
|
+
resolved: !n.resolved
|
|
102
|
+
}).then(x).catch(() => r(d("comments.saveError")));
|
|
103
|
+
},
|
|
104
|
+
children: n.resolved ? /* @__PURE__ */ t(Se, {}) : /* @__PURE__ */ t(ye, {})
|
|
105
|
+
}
|
|
106
|
+
) : null
|
|
107
|
+
] })
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
function rt({
|
|
113
|
+
open: n,
|
|
114
|
+
onOpenChange: u,
|
|
115
|
+
config: a,
|
|
116
|
+
onSelect: w,
|
|
117
|
+
status: T,
|
|
118
|
+
locating: x = !1
|
|
119
|
+
}) {
|
|
120
|
+
const { t: r } = Y(), d = ie(null), [i, h] = c([]), [g, b] = c(), [m, N] = c(!1), [l, S] = c({}), [f, P] = c(""), [A, z] = c(!1), [D, p] = c(null), [Z, G] = c(null), [M, W] = c(0), [X, ee] = c(!1), [R, te] = c(null), C = a.getSummaries, ne = a.persist, le = n ? `${JSON.stringify(l)}:${M}` : null, y = !!(n && le !== Z && !D), k = !!l.text || l.resolved !== void 0, re = !X || k, _ = !y && i.length === 0 && !k, B = !y && i.length === 0 && k, se = m || i.length > Ee;
|
|
121
|
+
$(() => {
|
|
122
|
+
if (!n || !C) return;
|
|
123
|
+
let e = !1;
|
|
124
|
+
const s = `${JSON.stringify(l)}:${M}`;
|
|
125
|
+
return C({ limit: U, query: l }).then((v) => {
|
|
126
|
+
e || (h([...v.items]), b(v.nextCursor), N(!!v.nextCursor), G(s), p(null), !l.text && l.resolved === void 0 && ee(v.items.length === 0));
|
|
127
|
+
}).catch(() => {
|
|
128
|
+
e || p(r("comments.loadError"));
|
|
129
|
+
}), () => {
|
|
130
|
+
e = !0;
|
|
131
|
+
};
|
|
132
|
+
}, [C, n, l, M, r]), $(() => {
|
|
133
|
+
if (!n) return;
|
|
134
|
+
const e = f.trim() || void 0;
|
|
135
|
+
if (e === l.text) return;
|
|
136
|
+
const s = window.setTimeout(() => {
|
|
137
|
+
h([]), p(null), S((v) => ({ ...v, text: e }));
|
|
138
|
+
}, 250);
|
|
139
|
+
return () => window.clearTimeout(s);
|
|
140
|
+
}, [n, l.text, f]);
|
|
141
|
+
const E = (e) => {
|
|
142
|
+
h([]), p(null), S(e);
|
|
143
|
+
}, oe = () => {
|
|
144
|
+
h([]), p(null), W((e) => e + 1);
|
|
145
|
+
}, L = de({
|
|
146
|
+
scrollElementRef: d,
|
|
147
|
+
rowCount: i.length,
|
|
148
|
+
getRowId: (e) => i[e]?.threadId ?? String(e),
|
|
149
|
+
getRowData: (e) => i[e],
|
|
150
|
+
estimateSize: () => 156,
|
|
151
|
+
hasMore: m,
|
|
152
|
+
onEndReached: () => {
|
|
153
|
+
!C || !m || !g || A || (z(!0), C({ cursor: g, limit: U, query: l }).then((e) => {
|
|
154
|
+
h((s) => [...s, ...e.items]), b(e.nextCursor), N(!!e.nextCursor);
|
|
155
|
+
}).catch(() => p(r("comments.loadError"))).finally(() => z(!1)));
|
|
156
|
+
}
|
|
157
|
+
}), ae = (e, s) => {
|
|
158
|
+
te(s), w(e, s);
|
|
159
|
+
}, O = (e) => /* @__PURE__ */ t(
|
|
160
|
+
Be,
|
|
161
|
+
{
|
|
162
|
+
summary: e,
|
|
163
|
+
selected: e.threadId === R,
|
|
164
|
+
config: a,
|
|
165
|
+
persist: ne,
|
|
166
|
+
onSelect: ae,
|
|
167
|
+
onReload: oe,
|
|
168
|
+
onError: p
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
return /* @__PURE__ */ t(he, { open: n, onOpenChange: u, children: /* @__PURE__ */ t(pe, { children: /* @__PURE__ */ o("div", { "data-iv-comments-panel": "", "data-slot": "comments-panel", className: "flex h-full min-h-0 flex-1 flex-col", children: [
|
|
172
|
+
/* @__PURE__ */ t(ue, { title: r("comments.panelTitle") }),
|
|
173
|
+
/* @__PURE__ */ o(xe, { children: [
|
|
174
|
+
re ? /* @__PURE__ */ o(fe, { className: "flex items-center gap-3 px-3 pb-2", children: [
|
|
175
|
+
/* @__PURE__ */ t("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ t(
|
|
176
|
+
ve,
|
|
177
|
+
{
|
|
178
|
+
value: f,
|
|
179
|
+
prefix: /* @__PURE__ */ t(we, { className: "size-4" }),
|
|
180
|
+
suffix: f ? /* @__PURE__ */ t(Ce, { className: "size-3.5", "aria-hidden": !0 }) : void 0,
|
|
181
|
+
suffixClick: f ? () => {
|
|
182
|
+
P(""), E({ ...l, text: void 0 });
|
|
183
|
+
} : void 0,
|
|
184
|
+
placeholder: r("comments.searchPlaceholder"),
|
|
185
|
+
"aria-label": r("comments.searchPlaceholder"),
|
|
186
|
+
onChange: (e) => P(e.target.value),
|
|
187
|
+
onKeyDown: (e) => {
|
|
188
|
+
e.key === "Enter" && E({ ...l, text: f.trim() || void 0 });
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
) }),
|
|
192
|
+
/* @__PURE__ */ o(ge, { children: [
|
|
193
|
+
/* @__PURE__ */ t(be, { asChild: !0, children: /* @__PURE__ */ t(J, { type: "button", size: "icon", variant: "tertiary", "aria-label": r("comments.filterComments"), children: /* @__PURE__ */ t(Te, {}) }) }),
|
|
194
|
+
/* @__PURE__ */ o(Ne, { align: "end", children: [
|
|
195
|
+
/* @__PURE__ */ t(q, { onSelect: () => E({ resolved: !1, text: l.text }), children: r("comments.filterUnresolved") }),
|
|
196
|
+
/* @__PURE__ */ t(q, { onSelect: () => E({ resolved: !0, text: l.text }), children: r("comments.filterResolved") })
|
|
197
|
+
] })
|
|
198
|
+
] })
|
|
199
|
+
] }) : null,
|
|
200
|
+
D ? /* @__PURE__ */ t("p", { role: "alert", className: "px-3 text-sm text-destructive", children: D }) : null,
|
|
201
|
+
T ? /* @__PURE__ */ t("p", { role: "status", "data-iv-comments-panel-status": "", className: "px-3 pb-2 text-sm text-content-secondary", children: T }) : null,
|
|
202
|
+
_ ? /* @__PURE__ */ o(F, { className: V, "data-iv-comments-panel-empty": "", children: [
|
|
203
|
+
/* @__PURE__ */ t(K, { width: 89, height: 70, className: "mb-0 after:hidden", children: /* @__PURE__ */ t(ze, { alt: "", className: "size-full", style: { width: 89, height: 70 } }) }),
|
|
204
|
+
/* @__PURE__ */ o("div", { className: "flex flex-col items-center gap-[3px] text-center", children: [
|
|
205
|
+
/* @__PURE__ */ t(H, { headingLevel: 3, className: "text-sm font-bold leading-[21px] tracking-normal", children: r("comments.emptyPanelTitle") }),
|
|
206
|
+
/* @__PURE__ */ t(Q, { className: "mt-0 max-w-[284px] text-[10px] font-medium leading-[14px] text-content-tertiary", children: r("comments.emptyPanelDescription") })
|
|
207
|
+
] })
|
|
208
|
+
] }) : null,
|
|
209
|
+
B ? /* @__PURE__ */ o(F, { className: V, "data-iv-comments-panel-no-results": "", children: [
|
|
210
|
+
/* @__PURE__ */ t(
|
|
211
|
+
K,
|
|
212
|
+
{
|
|
213
|
+
src: Pe,
|
|
214
|
+
alt: "",
|
|
215
|
+
width: 96,
|
|
216
|
+
height: 95,
|
|
217
|
+
className: "mb-2.5 after:hidden"
|
|
218
|
+
}
|
|
219
|
+
),
|
|
220
|
+
/* @__PURE__ */ t(H, { headingLevel: 3, className: "text-sm font-bold leading-[21px] tracking-normal", children: r("comments.noResultsTitle") }),
|
|
221
|
+
/* @__PURE__ */ t(Q, { className: "mt-0.5 max-w-[284px] text-[10px] font-medium leading-[14px] text-content-tertiary", children: r("comments.noResultsDescription", { query: l.text ?? "" }) })
|
|
222
|
+
] }) : null,
|
|
223
|
+
!_ && !B ? /* @__PURE__ */ o(
|
|
224
|
+
"div",
|
|
225
|
+
{
|
|
226
|
+
ref: d,
|
|
227
|
+
"data-iv-comments-panel-list": "",
|
|
228
|
+
"aria-busy": x || y || A || void 0,
|
|
229
|
+
"data-iv-comments-panel-locating": x ? "" : void 0,
|
|
230
|
+
className: I("min-h-0 flex-1 overflow-auto px-3 pb-3 pt-2", x && "pointer-events-none"),
|
|
231
|
+
children: [
|
|
232
|
+
se ? /* @__PURE__ */ t("div", { style: { height: L.totalSize, position: "relative" }, children: L.virtualItems.map((e) => {
|
|
233
|
+
const s = i[e.index];
|
|
234
|
+
return s ? /* @__PURE__ */ t(
|
|
235
|
+
"div",
|
|
236
|
+
{
|
|
237
|
+
ref: L.measureElement,
|
|
238
|
+
"data-index": e.index,
|
|
239
|
+
className: j(
|
|
240
|
+
e.index,
|
|
241
|
+
i.length,
|
|
242
|
+
s.threadId === R
|
|
243
|
+
),
|
|
244
|
+
style: {
|
|
245
|
+
position: "absolute",
|
|
246
|
+
top: 0,
|
|
247
|
+
left: 0,
|
|
248
|
+
width: "100%",
|
|
249
|
+
transform: `translateY(${e.start}px)`
|
|
250
|
+
},
|
|
251
|
+
children: O(s)
|
|
252
|
+
},
|
|
253
|
+
s.threadId
|
|
254
|
+
) : null;
|
|
255
|
+
}) }) : i.map((e, s) => /* @__PURE__ */ t(
|
|
256
|
+
"div",
|
|
257
|
+
{
|
|
258
|
+
className: j(s, i.length, e.threadId === R),
|
|
259
|
+
children: O(e)
|
|
260
|
+
},
|
|
261
|
+
e.threadId
|
|
262
|
+
)),
|
|
263
|
+
y || A ? /* @__PURE__ */ t("p", { "aria-busy": "true", children: r("comments.loading") }) : null
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
) : null
|
|
267
|
+
] })
|
|
268
|
+
] }) }) });
|
|
269
|
+
}
|
|
270
|
+
export {
|
|
271
|
+
rt as CommentsPanel
|
|
272
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ThreadGenerationMap } from './comments-generation';
|
|
2
|
+
import { CommentsRefreshApi } from './comments-ag-grid-presence';
|
|
3
|
+
import { CommentsPersistEvent, ThreadId } from './comments.types';
|
|
4
|
+
export declare function isCommentsConflictError(error: unknown): boolean;
|
|
5
|
+
export declare function commitCommentsPersist(args: {
|
|
6
|
+
persist: (event: CommentsPersistEvent) => Promise<void>;
|
|
7
|
+
event: CommentsPersistEvent;
|
|
8
|
+
generations: ThreadGenerationMap;
|
|
9
|
+
threadId: ThreadId;
|
|
10
|
+
api: CommentsRefreshApi;
|
|
11
|
+
}): Promise<"applied" | "stale" | "failed" | "conflict" | "rejected">;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { isValidCommentMessageText as i } from "./comments-identity.js";
|
|
2
|
+
import { refreshCommentsPresence as r } from "./comments-ag-grid-presence.js";
|
|
3
|
+
function s(e) {
|
|
4
|
+
return typeof e == "object" && e !== null && "status" in e && e.status === 409;
|
|
5
|
+
}
|
|
6
|
+
async function d(e) {
|
|
7
|
+
if ((e.event.type === "add-message" || e.event.type === "edit-message") && !i(e.event.message.text))
|
|
8
|
+
return "rejected";
|
|
9
|
+
const t = e.generations.next(e.threadId);
|
|
10
|
+
try {
|
|
11
|
+
return await e.persist(e.event), e.generations.isCurrent(e.threadId, t) ? (r(e.api, e.event.address), "applied") : "stale";
|
|
12
|
+
} catch (n) {
|
|
13
|
+
return e.generations.isCurrent(e.threadId, t) ? s(n) ? "conflict" : "failed" : "stale";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
d as commitCommentsPersist,
|
|
18
|
+
s as isCommentsConflictError
|
|
19
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CellAddress, CommentsLocateResult } from './comments.types';
|
|
2
|
+
import { GridRowRevealApi } from '../grid-row-reveal';
|
|
3
|
+
export type CommentsGridRevealApi = GridRowRevealApi & {
|
|
4
|
+
ensureColumnVisible: (key: string, position?: "auto" | "start" | "middle" | "end") => void;
|
|
5
|
+
};
|
|
6
|
+
export type RevealCommentCellOptions = {
|
|
7
|
+
locateRow?: (address: CellAddress) => Promise<CommentsLocateResult>;
|
|
8
|
+
pagination?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare function revealCommentCell(gridApi: CommentsGridRevealApi | null | undefined, address: CellAddress, options?: RevealCommentCellOptions): Promise<"revealed" | "missing">;
|
|
11
|
+
export declare function waitForCommentCell(container: HTMLElement | null, address: CellAddress, frames?: number): Promise<HTMLElement | null>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { revealGridRow as c } from "../grid-row-reveal.js";
|
|
2
|
+
import { cellElementFromAddress as a } from "../grid-cell-address.js";
|
|
3
|
+
async function s(r, e, t) {
|
|
4
|
+
const o = t?.locateRow;
|
|
5
|
+
return await c(r, e.rowId, {
|
|
6
|
+
pagination: t?.pagination,
|
|
7
|
+
colId: e.colId,
|
|
8
|
+
locateRow: o ? (n) => o({ rowId: n, colId: e.colId }) : void 0
|
|
9
|
+
}) === "revealed" ? "revealed" : "missing";
|
|
10
|
+
}
|
|
11
|
+
function w(r, e, t = 24) {
|
|
12
|
+
return new Promise((o) => {
|
|
13
|
+
const i = (n) => {
|
|
14
|
+
const l = a(r, e);
|
|
15
|
+
if (l || n <= 0) {
|
|
16
|
+
o(l);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (typeof requestAnimationFrame == "function") {
|
|
20
|
+
requestAnimationFrame(() => i(n - 1));
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
o(l);
|
|
24
|
+
};
|
|
25
|
+
i(t);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
s as revealCommentCell,
|
|
30
|
+
w as waitForCommentCell
|
|
31
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CommentMenuItem, CommentMessageActionContext, CommentThreadActionContext, CommentUiAction } from './comments.types';
|
|
2
|
+
export declare function buildCommentMessageMenuItems(args: {
|
|
3
|
+
showEdit: boolean;
|
|
4
|
+
showDelete: boolean;
|
|
5
|
+
editLabel: string;
|
|
6
|
+
deleteLabel: string;
|
|
7
|
+
extras?: readonly CommentUiAction<CommentMessageActionContext>[];
|
|
8
|
+
context: CommentMessageActionContext;
|
|
9
|
+
onEdit: () => void;
|
|
10
|
+
onDelete: () => void;
|
|
11
|
+
}): CommentMenuItem[];
|
|
12
|
+
export declare function buildCommentThreadMenuItems(args: {
|
|
13
|
+
showDelete: boolean;
|
|
14
|
+
deleteLabel: string;
|
|
15
|
+
extras?: readonly CommentUiAction<CommentThreadActionContext>[];
|
|
16
|
+
context: CommentThreadActionContext;
|
|
17
|
+
onDelete: () => void;
|
|
18
|
+
}): CommentMenuItem[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function d(e) {
|
|
2
|
+
const t = [];
|
|
3
|
+
return e.showEdit && t.push({ id: "edit", label: e.editLabel, onSelect: e.onEdit }), e.showDelete && t.push({ id: "delete", label: e.deleteLabel, onSelect: e.onDelete }), n(t, e.extras, e.context), t;
|
|
4
|
+
}
|
|
5
|
+
function i(e) {
|
|
6
|
+
const t = [];
|
|
7
|
+
return e.showDelete && t.push({ id: "delete-thread", label: e.deleteLabel, onSelect: e.onDelete }), n(t, e.extras, e.context), t;
|
|
8
|
+
}
|
|
9
|
+
function n(e, t, o) {
|
|
10
|
+
if (t)
|
|
11
|
+
for (const l of t)
|
|
12
|
+
e.push({
|
|
13
|
+
id: l.id,
|
|
14
|
+
label: l.label,
|
|
15
|
+
disabled: l.disabled,
|
|
16
|
+
onSelect: () => l.onSelect(o)
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
d as buildCommentMessageMenuItems,
|
|
21
|
+
i as buildCommentThreadMenuItems
|
|
22
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CellCommentThread, CommentMessage, CommentsThreadPageRequest } from './comments.types';
|
|
2
|
+
export type CommentsThreadWindow = {
|
|
3
|
+
messages: CommentMessage[];
|
|
4
|
+
hasMoreOlder: boolean;
|
|
5
|
+
hiddenCount: number;
|
|
6
|
+
messageCount: number;
|
|
7
|
+
};
|
|
8
|
+
export declare function commentsThreadPageRequest(purpose: CommentsThreadPageRequest["purpose"], before?: string): CommentsThreadPageRequest;
|
|
9
|
+
export declare function selectCommentThreadWindow(messages: readonly CommentMessage[], request: CommentsThreadPageRequest): CommentsThreadWindow;
|
|
10
|
+
export declare function boundLoadedThread(thread: CellCommentThread, request: CommentsThreadPageRequest): CellCommentThread;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { COMMENTS_PREVIEW_VISIBLE as r, commentPreviewSlice as l } from "./comments-format.js";
|
|
2
|
+
import { COMMENTS_THREAD_PAGE_SIZE as a } from "./comments-constants.js";
|
|
3
|
+
function C(e, n) {
|
|
4
|
+
return {
|
|
5
|
+
purpose: e,
|
|
6
|
+
limit: e === "preview" ? r : a,
|
|
7
|
+
before: n
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function m(e, n) {
|
|
11
|
+
const d = e.length;
|
|
12
|
+
if (n.purpose === "preview") {
|
|
13
|
+
const s = l(e);
|
|
14
|
+
return s.kind === "all" ? { messages: [...s.messages], hasMoreOlder: !1, hiddenCount: 0, messageCount: d } : {
|
|
15
|
+
messages: [...s.head, ...s.tail],
|
|
16
|
+
hasMoreOlder: s.hiddenCount > 0,
|
|
17
|
+
hiddenCount: s.hiddenCount,
|
|
18
|
+
messageCount: d
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if (n.before) {
|
|
22
|
+
const s = e.findIndex((t) => t.id === n.before);
|
|
23
|
+
if (s <= 0)
|
|
24
|
+
return { messages: [], hasMoreOlder: !1, hiddenCount: 0, messageCount: d };
|
|
25
|
+
const i = Math.max(0, s - n.limit);
|
|
26
|
+
return {
|
|
27
|
+
messages: e.slice(i, s),
|
|
28
|
+
hasMoreOlder: i > 0,
|
|
29
|
+
hiddenCount: i,
|
|
30
|
+
messageCount: d
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const o = Math.max(0, d - n.limit);
|
|
34
|
+
return {
|
|
35
|
+
messages: e.slice(o),
|
|
36
|
+
hasMoreOlder: o > 0,
|
|
37
|
+
hiddenCount: o,
|
|
38
|
+
messageCount: d
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function c(e, n) {
|
|
42
|
+
if (e.messages.length <= n.limit && (e.hasMoreOlder != null || e.hiddenCount != null || e.messageCount != null))
|
|
43
|
+
return {
|
|
44
|
+
...e,
|
|
45
|
+
hasMoreOlder: e.hasMoreOlder ?? !1,
|
|
46
|
+
hiddenCount: e.hiddenCount ?? 0,
|
|
47
|
+
messageCount: e.messageCount ?? e.messages.length
|
|
48
|
+
};
|
|
49
|
+
const o = m(e.messages, n);
|
|
50
|
+
return {
|
|
51
|
+
...e,
|
|
52
|
+
messages: o.messages,
|
|
53
|
+
hasMoreOlder: o.hasMoreOlder,
|
|
54
|
+
hiddenCount: o.hiddenCount,
|
|
55
|
+
messageCount: o.messageCount
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
c as boundLoadedThread,
|
|
60
|
+
C as commentsThreadPageRequest,
|
|
61
|
+
m as selectCommentThreadWindow
|
|
62
|
+
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { GridCellAddress } from '../grid-cell-address';
|
|
3
|
+
export type ThreadId = string;
|
|
4
|
+
/** Logical grid cell. Shared identity — not Comment-specific. */
|
|
5
|
+
export type CellAddress = GridCellAddress;
|
|
6
|
+
export type CommentMessage = {
|
|
7
|
+
id: string;
|
|
8
|
+
text: string;
|
|
9
|
+
author: string;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
updatedAt?: string;
|
|
12
|
+
};
|
|
13
|
+
export type CellCommentThread = {
|
|
14
|
+
threadId: ThreadId;
|
|
15
|
+
address: CellAddress;
|
|
16
|
+
messages: CommentMessage[];
|
|
17
|
+
resolved: boolean;
|
|
18
|
+
/** Older history exists beyond `messages`. Omit when the window is the full thread. */
|
|
19
|
+
hasMoreOlder?: boolean;
|
|
20
|
+
/** Messages not in this window (older and/or collapsed preview middle). */
|
|
21
|
+
hiddenCount?: number;
|
|
22
|
+
/** Total messages in the thread when known. */
|
|
23
|
+
messageCount?: number;
|
|
24
|
+
};
|
|
25
|
+
export type CellCommentSummary = {
|
|
26
|
+
threadId: ThreadId;
|
|
27
|
+
address: CellAddress;
|
|
28
|
+
preview: string;
|
|
29
|
+
author?: string;
|
|
30
|
+
updatedAt?: string;
|
|
31
|
+
resolved: boolean;
|
|
32
|
+
messageCount: number;
|
|
33
|
+
};
|
|
34
|
+
/** Result of locating a commented row that is not in the current grid model. */
|
|
35
|
+
export type CommentsLocateResult = {
|
|
36
|
+
status: "ready";
|
|
37
|
+
rowIndex?: number;
|
|
38
|
+
} | {
|
|
39
|
+
status: "missing";
|
|
40
|
+
};
|
|
41
|
+
export type CommentsCapabilities = {
|
|
42
|
+
canView: boolean;
|
|
43
|
+
canCreate: boolean;
|
|
44
|
+
canReply: boolean;
|
|
45
|
+
canEdit: boolean;
|
|
46
|
+
canDelete: boolean;
|
|
47
|
+
canResolve: boolean;
|
|
48
|
+
};
|
|
49
|
+
export type CommentsPersistEvent = {
|
|
50
|
+
type: "add-message";
|
|
51
|
+
threadId: ThreadId;
|
|
52
|
+
address: CellAddress;
|
|
53
|
+
message: CommentMessage;
|
|
54
|
+
} | {
|
|
55
|
+
type: "edit-message";
|
|
56
|
+
threadId: ThreadId;
|
|
57
|
+
address: CellAddress;
|
|
58
|
+
message: CommentMessage;
|
|
59
|
+
} | {
|
|
60
|
+
type: "delete-message";
|
|
61
|
+
threadId: ThreadId;
|
|
62
|
+
address: CellAddress;
|
|
63
|
+
messageId: string;
|
|
64
|
+
} | {
|
|
65
|
+
type: "delete-thread";
|
|
66
|
+
threadId: ThreadId;
|
|
67
|
+
address: CellAddress;
|
|
68
|
+
} | {
|
|
69
|
+
type: "resolve";
|
|
70
|
+
threadId: ThreadId;
|
|
71
|
+
address: CellAddress;
|
|
72
|
+
resolved: boolean;
|
|
73
|
+
};
|
|
74
|
+
export type CommentsSummaryPageRequest = {
|
|
75
|
+
cursor?: string;
|
|
76
|
+
limit: number;
|
|
77
|
+
query?: {
|
|
78
|
+
resolved?: boolean;
|
|
79
|
+
text?: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
export type CommentsSummaryPage = {
|
|
83
|
+
items: readonly CellCommentSummary[];
|
|
84
|
+
nextCursor?: string;
|
|
85
|
+
};
|
|
86
|
+
export type CommentsThreadPageRequest = {
|
|
87
|
+
purpose: "preview" | "page";
|
|
88
|
+
limit: number;
|
|
89
|
+
/** Oldest message id currently loaded; return the page older than this. */
|
|
90
|
+
before?: string;
|
|
91
|
+
};
|
|
92
|
+
export type DataTableCommentsConfig = {
|
|
93
|
+
hasIndicator: (address: CellAddress) => boolean;
|
|
94
|
+
getThreadId?: (address: CellAddress) => ThreadId;
|
|
95
|
+
/**
|
|
96
|
+
* Load the active thread. Optional `request` asks for a bounded window
|
|
97
|
+
* (newest page, older page, or hover preview). Extra arg is ignored by
|
|
98
|
+
* existing `(threadId, address) => thread` adapters; the host still windows
|
|
99
|
+
* oversized payloads before render.
|
|
100
|
+
*/
|
|
101
|
+
loadThread: (threadId: ThreadId, address: CellAddress, request?: CommentsThreadPageRequest) => Promise<CellCommentThread | undefined>;
|
|
102
|
+
persist: (event: CommentsPersistEvent) => Promise<void>;
|
|
103
|
+
getAuthor: () => string;
|
|
104
|
+
getCapabilities?: (address: CellAddress) => CommentsCapabilities;
|
|
105
|
+
getSummaries?: (request: CommentsSummaryPageRequest) => Promise<CommentsSummaryPage>;
|
|
106
|
+
/**
|
|
107
|
+
* Load a commented row that is not in the current grid model (SSRM block,
|
|
108
|
+
* infinite row, or app-replaced `rowData` page). Identity stays `{ rowId, colId }`.
|
|
109
|
+
* Return `{ status: "ready", rowIndex }` so the host can `paginationGoToPage`
|
|
110
|
+
* from the **live** index, then `ensureIndexVisible`. Do not persist page numbers.
|
|
111
|
+
* Omit when every commented row is already in client-side `rowData`.
|
|
112
|
+
*/
|
|
113
|
+
locateRow?: (address: CellAddress) => Promise<CommentsLocateResult>;
|
|
114
|
+
commentMode?: boolean;
|
|
115
|
+
onCommentModeChange?: (on: boolean) => void;
|
|
116
|
+
previewOnHover?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Extra items after Edit/Delete on the message `…` menu.
|
|
119
|
+
* Omit for the default menu. Does not replace Edit/Delete.
|
|
120
|
+
*/
|
|
121
|
+
messageActions?: readonly CommentUiAction<CommentMessageActionContext>[];
|
|
122
|
+
/**
|
|
123
|
+
* Extra items after Delete thread on overlay and panel `…` menus.
|
|
124
|
+
* Omit for the default menu.
|
|
125
|
+
*/
|
|
126
|
+
threadActions?: readonly CommentUiAction<CommentThreadActionContext>[];
|
|
127
|
+
/** Replace the author glyph. Overlay/panel only — never per cell. */
|
|
128
|
+
renderAvatar?: (props: {
|
|
129
|
+
author: string;
|
|
130
|
+
}) => ReactNode;
|
|
131
|
+
/** Replace message text rendering (markdown, links, …). */
|
|
132
|
+
renderMessageBody?: (props: {
|
|
133
|
+
message: CommentMessage;
|
|
134
|
+
}) => ReactNode;
|
|
135
|
+
/** Replace the reply box. Host still owns draft state and persist. */
|
|
136
|
+
renderComposer?: (props: CommentComposerRenderProps) => ReactNode;
|
|
137
|
+
/** Replace the message `…` menu. `items` is Edit/Delete plus `messageActions`. */
|
|
138
|
+
renderMessageActions?: (props: {
|
|
139
|
+
items: CommentMenuItem[];
|
|
140
|
+
context: CommentMessageActionContext;
|
|
141
|
+
}) => ReactNode;
|
|
142
|
+
/** Replace the thread `…` menu. `items` is Delete thread plus `threadActions`. */
|
|
143
|
+
renderThreadActions?: (props: {
|
|
144
|
+
items: CommentMenuItem[];
|
|
145
|
+
context: CommentThreadActionContext;
|
|
146
|
+
}) => ReactNode;
|
|
147
|
+
};
|
|
148
|
+
export type CommentMenuItem = {
|
|
149
|
+
id: string;
|
|
150
|
+
label: string;
|
|
151
|
+
disabled?: boolean;
|
|
152
|
+
onSelect: () => void;
|
|
153
|
+
};
|
|
154
|
+
export type CommentUiAction<TContext> = {
|
|
155
|
+
id: string;
|
|
156
|
+
label: string;
|
|
157
|
+
disabled?: boolean;
|
|
158
|
+
onSelect: (context: TContext) => void;
|
|
159
|
+
};
|
|
160
|
+
export type CommentMessageActionContext = {
|
|
161
|
+
address: CellAddress;
|
|
162
|
+
threadId: ThreadId;
|
|
163
|
+
resolved: boolean;
|
|
164
|
+
message: CommentMessage;
|
|
165
|
+
};
|
|
166
|
+
export type CommentThreadActionContext = {
|
|
167
|
+
address: CellAddress;
|
|
168
|
+
threadId: ThreadId;
|
|
169
|
+
resolved: boolean;
|
|
170
|
+
};
|
|
171
|
+
export type CommentComposerRenderProps = {
|
|
172
|
+
value: string;
|
|
173
|
+
onChange: (value: string) => void;
|
|
174
|
+
onSave: () => void;
|
|
175
|
+
disabled: boolean;
|
|
176
|
+
saving: boolean;
|
|
177
|
+
author: string;
|
|
178
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { CellAddress, CellCommentSummary, CellCommentThread, CommentComposerRenderProps, CommentMenuItem, CommentMessage, CommentMessageActionContext, CommentThreadActionContext, CommentUiAction, CommentsCapabilities, CommentsLocateResult, CommentsPersistEvent, CommentsSummaryPage, CommentsSummaryPageRequest, CommentsThreadPageRequest, DataTableCommentsConfig, ThreadId, } from './comments.types';
|
|
2
|
+
export { defaultGetThreadId, mintCommentMessageId, THREAD_ID_SEPARATOR } from './comments-identity';
|
|
3
|
+
export { boundLoadedThread, commentsThreadPageRequest, selectCommentThreadWindow, } from './comments-window';
|
|
4
|
+
export { COMMENTS_THREAD_PAGE_SIZE, COMMENTS_PANEL_PAGE_SIZE } from './comments-constants';
|
|
5
|
+
export { CommentModeToggle, type CommentModeToggleProps } from './comment-mode-toggle';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { THREAD_ID_SEPARATOR as m, defaultGetThreadId as t, mintCommentMessageId as d } from "./comments-identity.js";
|
|
2
|
+
import { boundLoadedThread as E, commentsThreadPageRequest as T, selectCommentThreadWindow as a } from "./comments-window.js";
|
|
3
|
+
import { COMMENTS_PANEL_PAGE_SIZE as n, COMMENTS_THREAD_PAGE_SIZE as A } from "./comments-constants.js";
|
|
4
|
+
import { CommentModeToggle as f } from "./comment-mode-toggle.js";
|
|
5
|
+
export {
|
|
6
|
+
n as COMMENTS_PANEL_PAGE_SIZE,
|
|
7
|
+
A as COMMENTS_THREAD_PAGE_SIZE,
|
|
8
|
+
f as CommentModeToggle,
|
|
9
|
+
m as THREAD_ID_SEPARATOR,
|
|
10
|
+
E as boundLoadedThread,
|
|
11
|
+
T as commentsThreadPageRequest,
|
|
12
|
+
t as defaultGetThreadId,
|
|
13
|
+
d as mintCommentMessageId,
|
|
14
|
+
a as selectCommentThreadWindow
|
|
15
|
+
};
|