@aiquants/daily-report 0.10.0 → 0.12.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/dist/client.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ReactNode, Context, RefObject } from 'react';
2
+ import { RefObject, ReactNode, Context } from 'react';
3
3
  import { ScrollBarThumbOverlayRenderProps, ScrollPaneInertiaOptions, ScrollBarTapCircleOptions } from '@aiquants/virtualscroll';
4
4
  import { D as DailyReportAttachmentSummary, a as DailyReportItem, b as DailyReportDetail, c as DailyReportUser } from './types-Ct1ggzy-.mjs';
5
5
  import { U as UIComment, D as DailyReportSseMessage } from './sse-schema-BiUnufrI.mjs';
@@ -86,19 +86,45 @@ type DailyReportCommentFormProps = {
86
86
  */
87
87
  declare const DailyReportCommentForm: ({ reportHubId, businessDate, onAddComment }: DailyReportCommentFormProps) => react.JSX.Element;
88
88
 
89
+ /**
90
+ * Scroll restore slot for DailyReportDetailList that survives tab unmounting.
91
+ * タブアンマウントをまたいで DailyReportDetailList のスクロール位置を持ち回る共有スロット。
92
+ *
93
+ * topItem は先頭可視カードの**同一性アンカー** (reportHubId + 行内オフセット px + 保存時 index)。
94
+ * ❗ 生の論理 px を保存してはならない: 可変高さでは px→行変換が再マウントの推定空間で行われ、
95
+ * 深い位置で別のカードに着地する (実機で確定した実害バグ)。同一性アンカーは一覧が留守中に
96
+ * 変わっても findIndex で正しいカードへ再解決される。index は該当カードが消えていたときの
97
+ * 近似フォールバック。offsetPx はカード上端がビューポート上端より上に隠れている px (論理座標)。
98
+ * anchorReportHubId は「記録時点の選択日報」。復元はこれが現在の選択と一致するときだけ行う:
99
+ * 選択が他ビューで変わっていたら、復元よりも「選択日報へのスクロール」(既存 UX) を優先する。
100
+ * measuredHeights は実測カード高さ (reportHubId → px)。着地窓の行内オフセットの厳密さと
101
+ * 総高さ推定の質を保つため、実測をアンマウント越しに持ち回る。
102
+ */
103
+ type DailyReportDetailListScrollRestore = {
104
+ topItem: {
105
+ reportHubId: number;
106
+ index: number;
107
+ offsetPx: number;
108
+ } | null;
109
+ anchorReportHubId: number | null;
110
+ measuredHeights: Map<number, number>;
111
+ };
89
112
  type DailyReportDetailListProps = {
90
113
  dailyReportItems: DailyReportItem[];
91
114
  userId?: string | null;
92
115
  selectedItemId?: number | null;
93
116
  onSelectItem?: (id: number | null) => void;
94
- initialScrollOffset?: number;
95
- onScrollOffsetChange?: (offset: number) => void;
117
+ /**
118
+ * スクロール位置の共有スロット。マウント時に一度だけ読み、スクロールのたびに書き戻す。
119
+ * ❗ 値をレンダー時に読んで props へ焼き込む方式は禁止 (daily-report-list.tsx 参照)
120
+ */
121
+ scrollRestoreRef?: RefObject<DailyReportDetailListScrollRestore>;
96
122
  };
97
123
  /**
98
124
  * Daily report detail cards rendered with dynamic height virtual scroll.
99
125
  * 動的高さの仮想スクロールで日報詳細カードを描画するコンポーネント。
100
126
  */
101
- declare const DailyReportDetailList: ({ dailyReportItems, userId, selectedItemId, onSelectItem, initialScrollOffset, onScrollOffsetChange }: DailyReportDetailListProps) => react.JSX.Element;
127
+ declare const DailyReportDetailList: ({ dailyReportItems, userId, selectedItemId, onSelectItem, scrollRestoreRef }: DailyReportDetailListProps) => react.JSX.Element;
102
128
 
103
129
  type DailyReportEditFormProps = {
104
130
  report: DailyReportDetail;
@@ -119,14 +145,20 @@ type DailyReportListProps = {
119
145
  selectedReportHubId: number | null;
120
146
  onSelectItem: (reportHubId: number | null) => void;
121
147
  userId?: string | null;
122
- initialScrollOffset?: number;
123
- onScrollOffsetChange?: (offset: number) => void;
148
+ /**
149
+ * タブ切替 (アンマウント) をまたいでスクロール位置を持ち回る共有スロット。
150
+ * 値は VirtualScroll の**論理座標** (inset 非依存。onScroll が配信する座標系)。
151
+ * マウント時に一度だけ読み、スクロールのたびに書き戻す。
152
+ * ❗ 値をレンダー時に読んで props へ焼き込む方式は禁止: 非制御タブでは親が
153
+ * 再レンダーされず、復帰マウントに古い値が渡る (実測で再現した実害バグ)
154
+ */
155
+ scrollOffsetRef?: RefObject<number>;
124
156
  };
125
157
  /**
126
158
  * Daily report list cards with key metadata and preview content via virtual scrolling.
127
159
  * 主なメタデータと内容プレビューを仮想スクロール表示する日報リスト。
128
160
  */
129
- declare const DailyReportList: ({ dailyReportItems, autoMarkRead, selectedReportHubId, onSelectItem, userId, initialScrollOffset, onScrollOffsetChange }: DailyReportListProps) => react.JSX.Element;
161
+ declare const DailyReportList: ({ dailyReportItems, autoMarkRead, selectedReportHubId, onSelectItem, userId, scrollOffsetRef }: DailyReportListProps) => react.JSX.Element;
130
162
 
131
163
  /** ヘッダー描画スロットに渡される引数。 */
132
164
  type DailyReportHeaderProps = {
@@ -1043,4 +1075,4 @@ declare const TAP_SCROLL_CIRCLE_OPTIONS: ScrollBarTapCircleOptions;
1043
1075
  */
1044
1076
  declare const CONTENT_DRAG_POINTER_INPUTS: readonly ["pen", "touch"];
1045
1077
 
1046
- export { BusinessDayThumbOverlay, CONTENT_DRAG_POINTER_INPUTS, DAILY_REPORT_FETCH_DEBOUNCE_MS, DEFAULT_ITEM_HEIGHT, type DailyReportActionContextType, DailyReportActionProvider, DailyReportAttachmentIndicator, DailyReportAttachmentList, DailyReportCache, type DailyReportClientConfig, type DailyReportClientConfigInput, DailyReportCommentForm, DailyReportCommentItem, DailyReportCommentList, DailyReportConfigProvider, DailyReportDetailList, type DailyReportDetailResource, DailyReportEditForm, type DailyReportErrorInfo, DailyReportErrorProvider, type DailyReportFieldLabels, type DailyReportHeaderProps, DailyReportIdsStreamClient, type DailyReportIdsStreamClientOptions, type DailyReportIdsStreamPhase, type DailyReportIdsStreamState, DailyReportIdsStreamStatus, DailyReportList, DailyReportLoadError, DailyReportLoading, DailyReportPage, type DailyReportPageProps, DailyReportResolvedContent, EMPTY_DETAIL, EMPTY_ITEM, FAST_SCROLL_INERTIA_OPTIONS, FAST_SCROLL_WHEEL_MULTIPLIER, ITEM_CONTAINER_HEIGHT, ITEM_VERTICAL_PADDING, MAX_PREVIEW_LINES, PREFETCH_LOOKAHEAD, PREFETCH_MAX_DATES, SCROLL_BAR_WIDTH, SSE_INITIAL_CONNECT_DEFER_MS, type SourceTypeConfig, TAP_SCROLL_CIRCLE_OPTIONS, UnreadIndicator, VIRTUAL_SCROLL_OVERSCAN_COUNT, WHEEL_RESET_TIMEOUT_MS, acquireMutationLock, applyBroadcastReportUpdate, applyDailyReportServerUpdates, bootstrapDailyReportIdsStreamSession, clearDailyReportCache, createDailyReportClientLoader, dailyReportShouldRevalidate, defaultDailyReportClientConfig, defaultDailyReportFieldLabels, deleteDailyReportCache, ensureDailyReportIdsStreamSession, getCachedReport, getDailyReportIdsStreamSessionUserKey, primeDailyReportIdsStreamSession, refreshDailyReportIdsStream, registerRecentDeletion, releaseMutationLock, reloadDocument, removeDailyReportIdsStreamItem, resetDailyReportIdsStreamSessionForTesting, resolveSourceTypeConfig, retryDailyReportIdsStream, subscribeCacheReady, updateDailyReportCache, upsertDailyReportIdsStreamItem, useAnimatedNumber, useDailyReportActionContext, useDailyReportComments, useDailyReportConfig, useDailyReportDetail, useDailyReportErrorSurface, useDailyReportIdsStream, useDailyReportPrefetch, useDailyReportSseConnection, useDynamicViewportHeight, writeCache };
1078
+ export { BusinessDayThumbOverlay, CONTENT_DRAG_POINTER_INPUTS, DAILY_REPORT_FETCH_DEBOUNCE_MS, DEFAULT_ITEM_HEIGHT, type DailyReportActionContextType, DailyReportActionProvider, DailyReportAttachmentIndicator, DailyReportAttachmentList, DailyReportCache, type DailyReportClientConfig, type DailyReportClientConfigInput, DailyReportCommentForm, DailyReportCommentItem, DailyReportCommentList, DailyReportConfigProvider, DailyReportDetailList, type DailyReportDetailListScrollRestore, type DailyReportDetailResource, DailyReportEditForm, type DailyReportErrorInfo, DailyReportErrorProvider, type DailyReportFieldLabels, type DailyReportHeaderProps, DailyReportIdsStreamClient, type DailyReportIdsStreamClientOptions, type DailyReportIdsStreamPhase, type DailyReportIdsStreamState, DailyReportIdsStreamStatus, DailyReportList, DailyReportLoadError, DailyReportLoading, DailyReportPage, type DailyReportPageProps, DailyReportResolvedContent, EMPTY_DETAIL, EMPTY_ITEM, FAST_SCROLL_INERTIA_OPTIONS, FAST_SCROLL_WHEEL_MULTIPLIER, ITEM_CONTAINER_HEIGHT, ITEM_VERTICAL_PADDING, MAX_PREVIEW_LINES, PREFETCH_LOOKAHEAD, PREFETCH_MAX_DATES, SCROLL_BAR_WIDTH, SSE_INITIAL_CONNECT_DEFER_MS, type SourceTypeConfig, TAP_SCROLL_CIRCLE_OPTIONS, UnreadIndicator, VIRTUAL_SCROLL_OVERSCAN_COUNT, WHEEL_RESET_TIMEOUT_MS, acquireMutationLock, applyBroadcastReportUpdate, applyDailyReportServerUpdates, bootstrapDailyReportIdsStreamSession, clearDailyReportCache, createDailyReportClientLoader, dailyReportShouldRevalidate, defaultDailyReportClientConfig, defaultDailyReportFieldLabels, deleteDailyReportCache, ensureDailyReportIdsStreamSession, getCachedReport, getDailyReportIdsStreamSessionUserKey, primeDailyReportIdsStreamSession, refreshDailyReportIdsStream, registerRecentDeletion, releaseMutationLock, reloadDocument, removeDailyReportIdsStreamItem, resetDailyReportIdsStreamSessionForTesting, resolveSourceTypeConfig, retryDailyReportIdsStream, subscribeCacheReady, updateDailyReportCache, upsertDailyReportIdsStreamItem, useAnimatedNumber, useDailyReportActionContext, useDailyReportComments, useDailyReportConfig, useDailyReportDetail, useDailyReportErrorSurface, useDailyReportIdsStream, useDailyReportPrefetch, useDailyReportSseConnection, useDynamicViewportHeight, writeCache };
package/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ReactNode, Context, RefObject } from 'react';
2
+ import { RefObject, ReactNode, Context } from 'react';
3
3
  import { ScrollBarThumbOverlayRenderProps, ScrollPaneInertiaOptions, ScrollBarTapCircleOptions } from '@aiquants/virtualscroll';
4
4
  import { D as DailyReportAttachmentSummary, a as DailyReportItem, b as DailyReportDetail, c as DailyReportUser } from './types-Ct1ggzy-.js';
5
5
  import { U as UIComment, D as DailyReportSseMessage } from './sse-schema-YZh7Pz7i.js';
@@ -86,19 +86,45 @@ type DailyReportCommentFormProps = {
86
86
  */
87
87
  declare const DailyReportCommentForm: ({ reportHubId, businessDate, onAddComment }: DailyReportCommentFormProps) => react.JSX.Element;
88
88
 
89
+ /**
90
+ * Scroll restore slot for DailyReportDetailList that survives tab unmounting.
91
+ * タブアンマウントをまたいで DailyReportDetailList のスクロール位置を持ち回る共有スロット。
92
+ *
93
+ * topItem は先頭可視カードの**同一性アンカー** (reportHubId + 行内オフセット px + 保存時 index)。
94
+ * ❗ 生の論理 px を保存してはならない: 可変高さでは px→行変換が再マウントの推定空間で行われ、
95
+ * 深い位置で別のカードに着地する (実機で確定した実害バグ)。同一性アンカーは一覧が留守中に
96
+ * 変わっても findIndex で正しいカードへ再解決される。index は該当カードが消えていたときの
97
+ * 近似フォールバック。offsetPx はカード上端がビューポート上端より上に隠れている px (論理座標)。
98
+ * anchorReportHubId は「記録時点の選択日報」。復元はこれが現在の選択と一致するときだけ行う:
99
+ * 選択が他ビューで変わっていたら、復元よりも「選択日報へのスクロール」(既存 UX) を優先する。
100
+ * measuredHeights は実測カード高さ (reportHubId → px)。着地窓の行内オフセットの厳密さと
101
+ * 総高さ推定の質を保つため、実測をアンマウント越しに持ち回る。
102
+ */
103
+ type DailyReportDetailListScrollRestore = {
104
+ topItem: {
105
+ reportHubId: number;
106
+ index: number;
107
+ offsetPx: number;
108
+ } | null;
109
+ anchorReportHubId: number | null;
110
+ measuredHeights: Map<number, number>;
111
+ };
89
112
  type DailyReportDetailListProps = {
90
113
  dailyReportItems: DailyReportItem[];
91
114
  userId?: string | null;
92
115
  selectedItemId?: number | null;
93
116
  onSelectItem?: (id: number | null) => void;
94
- initialScrollOffset?: number;
95
- onScrollOffsetChange?: (offset: number) => void;
117
+ /**
118
+ * スクロール位置の共有スロット。マウント時に一度だけ読み、スクロールのたびに書き戻す。
119
+ * ❗ 値をレンダー時に読んで props へ焼き込む方式は禁止 (daily-report-list.tsx 参照)
120
+ */
121
+ scrollRestoreRef?: RefObject<DailyReportDetailListScrollRestore>;
96
122
  };
97
123
  /**
98
124
  * Daily report detail cards rendered with dynamic height virtual scroll.
99
125
  * 動的高さの仮想スクロールで日報詳細カードを描画するコンポーネント。
100
126
  */
101
- declare const DailyReportDetailList: ({ dailyReportItems, userId, selectedItemId, onSelectItem, initialScrollOffset, onScrollOffsetChange }: DailyReportDetailListProps) => react.JSX.Element;
127
+ declare const DailyReportDetailList: ({ dailyReportItems, userId, selectedItemId, onSelectItem, scrollRestoreRef }: DailyReportDetailListProps) => react.JSX.Element;
102
128
 
103
129
  type DailyReportEditFormProps = {
104
130
  report: DailyReportDetail;
@@ -119,14 +145,20 @@ type DailyReportListProps = {
119
145
  selectedReportHubId: number | null;
120
146
  onSelectItem: (reportHubId: number | null) => void;
121
147
  userId?: string | null;
122
- initialScrollOffset?: number;
123
- onScrollOffsetChange?: (offset: number) => void;
148
+ /**
149
+ * タブ切替 (アンマウント) をまたいでスクロール位置を持ち回る共有スロット。
150
+ * 値は VirtualScroll の**論理座標** (inset 非依存。onScroll が配信する座標系)。
151
+ * マウント時に一度だけ読み、スクロールのたびに書き戻す。
152
+ * ❗ 値をレンダー時に読んで props へ焼き込む方式は禁止: 非制御タブでは親が
153
+ * 再レンダーされず、復帰マウントに古い値が渡る (実測で再現した実害バグ)
154
+ */
155
+ scrollOffsetRef?: RefObject<number>;
124
156
  };
125
157
  /**
126
158
  * Daily report list cards with key metadata and preview content via virtual scrolling.
127
159
  * 主なメタデータと内容プレビューを仮想スクロール表示する日報リスト。
128
160
  */
129
- declare const DailyReportList: ({ dailyReportItems, autoMarkRead, selectedReportHubId, onSelectItem, userId, initialScrollOffset, onScrollOffsetChange }: DailyReportListProps) => react.JSX.Element;
161
+ declare const DailyReportList: ({ dailyReportItems, autoMarkRead, selectedReportHubId, onSelectItem, userId, scrollOffsetRef }: DailyReportListProps) => react.JSX.Element;
130
162
 
131
163
  /** ヘッダー描画スロットに渡される引数。 */
132
164
  type DailyReportHeaderProps = {
@@ -1043,4 +1075,4 @@ declare const TAP_SCROLL_CIRCLE_OPTIONS: ScrollBarTapCircleOptions;
1043
1075
  */
1044
1076
  declare const CONTENT_DRAG_POINTER_INPUTS: readonly ["pen", "touch"];
1045
1077
 
1046
- export { BusinessDayThumbOverlay, CONTENT_DRAG_POINTER_INPUTS, DAILY_REPORT_FETCH_DEBOUNCE_MS, DEFAULT_ITEM_HEIGHT, type DailyReportActionContextType, DailyReportActionProvider, DailyReportAttachmentIndicator, DailyReportAttachmentList, DailyReportCache, type DailyReportClientConfig, type DailyReportClientConfigInput, DailyReportCommentForm, DailyReportCommentItem, DailyReportCommentList, DailyReportConfigProvider, DailyReportDetailList, type DailyReportDetailResource, DailyReportEditForm, type DailyReportErrorInfo, DailyReportErrorProvider, type DailyReportFieldLabels, type DailyReportHeaderProps, DailyReportIdsStreamClient, type DailyReportIdsStreamClientOptions, type DailyReportIdsStreamPhase, type DailyReportIdsStreamState, DailyReportIdsStreamStatus, DailyReportList, DailyReportLoadError, DailyReportLoading, DailyReportPage, type DailyReportPageProps, DailyReportResolvedContent, EMPTY_DETAIL, EMPTY_ITEM, FAST_SCROLL_INERTIA_OPTIONS, FAST_SCROLL_WHEEL_MULTIPLIER, ITEM_CONTAINER_HEIGHT, ITEM_VERTICAL_PADDING, MAX_PREVIEW_LINES, PREFETCH_LOOKAHEAD, PREFETCH_MAX_DATES, SCROLL_BAR_WIDTH, SSE_INITIAL_CONNECT_DEFER_MS, type SourceTypeConfig, TAP_SCROLL_CIRCLE_OPTIONS, UnreadIndicator, VIRTUAL_SCROLL_OVERSCAN_COUNT, WHEEL_RESET_TIMEOUT_MS, acquireMutationLock, applyBroadcastReportUpdate, applyDailyReportServerUpdates, bootstrapDailyReportIdsStreamSession, clearDailyReportCache, createDailyReportClientLoader, dailyReportShouldRevalidate, defaultDailyReportClientConfig, defaultDailyReportFieldLabels, deleteDailyReportCache, ensureDailyReportIdsStreamSession, getCachedReport, getDailyReportIdsStreamSessionUserKey, primeDailyReportIdsStreamSession, refreshDailyReportIdsStream, registerRecentDeletion, releaseMutationLock, reloadDocument, removeDailyReportIdsStreamItem, resetDailyReportIdsStreamSessionForTesting, resolveSourceTypeConfig, retryDailyReportIdsStream, subscribeCacheReady, updateDailyReportCache, upsertDailyReportIdsStreamItem, useAnimatedNumber, useDailyReportActionContext, useDailyReportComments, useDailyReportConfig, useDailyReportDetail, useDailyReportErrorSurface, useDailyReportIdsStream, useDailyReportPrefetch, useDailyReportSseConnection, useDynamicViewportHeight, writeCache };
1078
+ export { BusinessDayThumbOverlay, CONTENT_DRAG_POINTER_INPUTS, DAILY_REPORT_FETCH_DEBOUNCE_MS, DEFAULT_ITEM_HEIGHT, type DailyReportActionContextType, DailyReportActionProvider, DailyReportAttachmentIndicator, DailyReportAttachmentList, DailyReportCache, type DailyReportClientConfig, type DailyReportClientConfigInput, DailyReportCommentForm, DailyReportCommentItem, DailyReportCommentList, DailyReportConfigProvider, DailyReportDetailList, type DailyReportDetailListScrollRestore, type DailyReportDetailResource, DailyReportEditForm, type DailyReportErrorInfo, DailyReportErrorProvider, type DailyReportFieldLabels, type DailyReportHeaderProps, DailyReportIdsStreamClient, type DailyReportIdsStreamClientOptions, type DailyReportIdsStreamPhase, type DailyReportIdsStreamState, DailyReportIdsStreamStatus, DailyReportList, DailyReportLoadError, DailyReportLoading, DailyReportPage, type DailyReportPageProps, DailyReportResolvedContent, EMPTY_DETAIL, EMPTY_ITEM, FAST_SCROLL_INERTIA_OPTIONS, FAST_SCROLL_WHEEL_MULTIPLIER, ITEM_CONTAINER_HEIGHT, ITEM_VERTICAL_PADDING, MAX_PREVIEW_LINES, PREFETCH_LOOKAHEAD, PREFETCH_MAX_DATES, SCROLL_BAR_WIDTH, SSE_INITIAL_CONNECT_DEFER_MS, type SourceTypeConfig, TAP_SCROLL_CIRCLE_OPTIONS, UnreadIndicator, VIRTUAL_SCROLL_OVERSCAN_COUNT, WHEEL_RESET_TIMEOUT_MS, acquireMutationLock, applyBroadcastReportUpdate, applyDailyReportServerUpdates, bootstrapDailyReportIdsStreamSession, clearDailyReportCache, createDailyReportClientLoader, dailyReportShouldRevalidate, defaultDailyReportClientConfig, defaultDailyReportFieldLabels, deleteDailyReportCache, ensureDailyReportIdsStreamSession, getCachedReport, getDailyReportIdsStreamSessionUserKey, primeDailyReportIdsStreamSession, refreshDailyReportIdsStream, registerRecentDeletion, releaseMutationLock, reloadDocument, removeDailyReportIdsStreamItem, resetDailyReportIdsStreamSessionForTesting, resolveSourceTypeConfig, retryDailyReportIdsStream, subscribeCacheReady, updateDailyReportCache, upsertDailyReportIdsStreamItem, useAnimatedNumber, useDailyReportActionContext, useDailyReportComments, useDailyReportConfig, useDailyReportDetail, useDailyReportErrorSurface, useDailyReportIdsStream, useDailyReportPrefetch, useDailyReportSseConnection, useDynamicViewportHeight, writeCache };