@aiquants/daily-report 0.20.0 → 0.20.1

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.
Files changed (115) hide show
  1. package/dist/client.d.mts +11 -706
  2. package/dist/client.d.ts +11 -706
  3. package/dist/client.js +0 -1
  4. package/dist/client.mjs +0 -1
  5. package/dist/index.d.mts +5 -197
  6. package/dist/index.d.ts +5 -197
  7. package/dist/index.js +0 -1
  8. package/dist/index.mjs +0 -1
  9. package/dist/logger-D3krZrNK.d.mts +0 -14
  10. package/dist/logger-D3krZrNK.d.ts +0 -14
  11. package/dist/server.d.mts +114 -744
  12. package/dist/server.d.ts +114 -744
  13. package/dist/server.js +0 -1
  14. package/dist/server.mjs +0 -1
  15. package/dist/sse-schema-BdUGThiz.d.ts +1025 -1009
  16. package/dist/sse-schema-ChSFm-4q.d.mts +1025 -1009
  17. package/dist/types-CqgYQgbH.d.mts +0 -34
  18. package/dist/types-CqgYQgbH.d.ts +0 -34
  19. package/package.json +7 -8
  20. package/dist/client.js.map +0 -1
  21. package/dist/client.mjs.map +0 -1
  22. package/dist/index.js.map +0 -1
  23. package/dist/index.mjs.map +0 -1
  24. package/dist/server.js.map +0 -1
  25. package/dist/server.mjs.map +0 -1
  26. package/src/client/components/business-day-thumb-overlay.tsx +0 -19
  27. package/src/client/components/daily-report-attachment-indicator.spec.tsx +0 -51
  28. package/src/client/components/daily-report-attachment-indicator.tsx +0 -45
  29. package/src/client/components/daily-report-attachment-list.spec.tsx +0 -94
  30. package/src/client/components/daily-report-attachment-list.tsx +0 -112
  31. package/src/client/components/daily-report-comment-item.tsx +0 -89
  32. package/src/client/components/daily-report-comment-section.tsx +0 -166
  33. package/src/client/components/daily-report-detail-list.tsx +0 -842
  34. package/src/client/components/daily-report-edit-form.tsx +0 -87
  35. package/src/client/components/daily-report-ids-stream-status.spec.tsx +0 -93
  36. package/src/client/components/daily-report-ids-stream-status.tsx +0 -67
  37. package/src/client/components/daily-report-list.tsx +0 -1232
  38. package/src/client/components/daily-report-page.spec.tsx +0 -119
  39. package/src/client/components/daily-report-page.tsx +0 -140
  40. package/src/client/components/daily-report-resize-panels.spec.tsx +0 -307
  41. package/src/client/components/daily-report-resolved-content.tsx +0 -207
  42. package/src/client/components/daily-report-scroll-restoration.spec.tsx +0 -422
  43. package/src/client/components/report-views.spec.tsx +0 -375
  44. package/src/client/components/unread-indicator.tsx +0 -13
  45. package/src/client/config-context.tsx +0 -184
  46. package/src/client/contexts/daily-report-action-context.spec.tsx +0 -433
  47. package/src/client/contexts/daily-report-action-context.tsx +0 -1147
  48. package/src/client/contexts/daily-report-error-context.spec.tsx +0 -66
  49. package/src/client/contexts/daily-report-error-context.tsx +0 -98
  50. package/src/client/hooks/use-animated-number.spec.ts +0 -103
  51. package/src/client/hooks/use-animated-number.ts +0 -69
  52. package/src/client/hooks/use-daily-report-comments.ts +0 -73
  53. package/src/client/hooks/use-daily-report-sse-connection.ts +0 -86
  54. package/src/client/hooks/use-daily-report.spec.ts +0 -546
  55. package/src/client/hooks/use-daily-report.ts +0 -549
  56. package/src/client/hooks/use-dynamic-viewport-height.ts +0 -127
  57. package/src/client/hooks/use-responsive-layout.spec.ts +0 -74
  58. package/src/client/hooks/use-responsive-layout.ts +0 -63
  59. package/src/client/route-helpers.spec.ts +0 -100
  60. package/src/client/route-helpers.ts +0 -61
  61. package/src/client/streaming/daily-report-ids-stream-client.spec.ts +0 -910
  62. package/src/client/streaming/daily-report-ids-stream-client.ts +0 -730
  63. package/src/client/streaming/daily-report-ids-stream-session.spec.ts +0 -401
  64. package/src/client/streaming/daily-report-ids-stream-session.ts +0 -319
  65. package/src/client/ui/button.tsx +0 -42
  66. package/src/client/ui/cn.ts +0 -14
  67. package/src/client/ui/input.tsx +0 -21
  68. package/src/client/ui/label.tsx +0 -16
  69. package/src/client/ui/switch.tsx +0 -19
  70. package/src/client/ui/tabs.tsx +0 -40
  71. package/src/client/ui/textarea.tsx +0 -19
  72. package/src/client/utils/constants.spec.ts +0 -96
  73. package/src/client/utils/constants.ts +0 -84
  74. package/src/client.ts +0 -28
  75. package/src/index.ts +0 -11
  76. package/src/lucide-icons.d.ts +0 -6
  77. package/src/server/authz.spec.ts +0 -57
  78. package/src/server/authz.ts +0 -99
  79. package/src/server/cache.spec.ts +0 -556
  80. package/src/server/cache.ts +0 -303
  81. package/src/server/etag.ts +0 -18
  82. package/src/server/external-source.ts +0 -60
  83. package/src/server/handlers.action.spec.ts +0 -44
  84. package/src/server/handlers.attachment.spec.ts +0 -470
  85. package/src/server/handlers.ids-stream.spec.ts +0 -618
  86. package/src/server/handlers.ts +0 -1638
  87. package/src/server/handlers.unauthorized-cookie.spec.ts +0 -187
  88. package/src/server/handlers.visibility.spec.ts +0 -774
  89. package/src/server/ports.ts +0 -222
  90. package/src/server/response.ts +0 -37
  91. package/src/server/schema.spec.ts +0 -30
  92. package/src/server/schema.ts +0 -344
  93. package/src/server/service.spec.ts +0 -1130
  94. package/src/server/service.ts +0 -2045
  95. package/src/server/sse-reader.spec.ts +0 -302
  96. package/src/server/sse-reader.ts +0 -267
  97. package/src/server/test-helpers/handlers-config.ts +0 -321
  98. package/src/server/transaction-retry.spec.ts +0 -63
  99. package/src/server/visibility.spec.ts +0 -403
  100. package/src/server/visibility.ts +0 -373
  101. package/src/server.spec.ts +0 -160
  102. package/src/server.ts +0 -131
  103. package/src/shared/business-date.spec.ts +0 -82
  104. package/src/shared/business-date.ts +0 -104
  105. package/src/shared/comment-adapter.spec.ts +0 -38
  106. package/src/shared/comment-adapter.ts +0 -80
  107. package/src/shared/ids-stream.spec.ts +0 -154
  108. package/src/shared/ids-stream.ts +0 -279
  109. package/src/shared/logger.ts +0 -47
  110. package/src/shared/sse-schema.spec.ts +0 -50
  111. package/src/shared/sse-schema.ts +0 -198
  112. package/src/shared/text-utils.spec.ts +0 -42
  113. package/src/shared/text-utils.ts +0 -65
  114. package/src/shared/types.ts +0 -109
  115. package/src/styles/standalone.entry.css +0 -51
package/dist/client.d.mts CHANGED
@@ -1,50 +1,23 @@
1
- import * as react from 'react';
2
- import { RefObject, ReactNode, Context } from 'react';
3
- import { ScrollBarThumbOverlayRenderProps, ScrollPaneInertiaOptions, ScrollBarTapCircleOptions } from '@aiquants/virtualscroll';
4
- import { D as DailyReportAttachmentSummary, a as DailyReportItem, b as DailyReportDetail, c as DailyReportUser } from './types-CqgYQgbH.mjs';
5
- import { U as UIComment, D as DailyReportSseMessage } from './sse-schema-ChSFm-4q.mjs';
6
- import { ShouldRevalidateFunction } from 'react-router';
7
- import 'zod';
8
-
9
- /**
10
- * Tooltip bubble that anchors to the scrollbar thumb while interacting.
11
- * スクロール操作中にスクロールバーのサムへ連動表示するツールチップのコンポーネント。
12
- */
1
+ import * as react from "react";
2
+ import { RefObject, ReactNode, Context } from "react";
3
+ import { ScrollBarThumbOverlayRenderProps, ScrollPaneInertiaOptions, ScrollBarTapCircleOptions } from "@aiquants/virtualscroll";
4
+ import { D as DailyReportAttachmentSummary, a as DailyReportItem, b as DailyReportDetail, c as DailyReportUser } from "./types-CqgYQgbH.mjs";
5
+ import { U as UIComment, D as DailyReportSseMessage } from "./sse-schema-ChSFm-4q.mjs";
6
+ import { ShouldRevalidateFunction } from "react-router";
7
+ import "zod";
13
8
  declare const BusinessDayThumbOverlay: ({ orientation, thumbCenter, label, isDragging, isTapScrollActive, isWheelScrollActive }: ScrollBarThumbOverlayRenderProps & {
14
9
  label: string;
15
10
  isWheelScrollActive: boolean;
16
11
  }) => react.JSX.Element | null;
17
-
18
12
  type DailyReportAttachmentIndicatorProps = {
19
- /** 添付の件数。0 なら何も描画しない。 */
20
13
  count: number;
21
- /** 読み上げ・ツールチップ用の見出し。消費アプリの `fieldLabels.attachments` を渡す。 */
22
14
  label: string;
23
15
  };
24
- /**
25
- * Renders the attachment marker, or nothing when the report has no attachment.
26
- * 添付の目印を描画する (添付が無ければ何も描画しない)。
27
- *
28
- * @param props Attachment count and the label. 添付件数と見出し。
29
- * @returns The marker element, or null. 目印の要素 (添付が無ければ null)。
30
- */
31
16
  declare const DailyReportAttachmentIndicator: ({ count, label }: DailyReportAttachmentIndicatorProps) => react.JSX.Element | null;
32
-
33
17
  type DailyReportAttachmentListProps = {
34
- /** 表示する添付一覧。空配列ならこのコンポーネントは何も描画しない。 */
35
18
  attachments: DailyReportAttachmentSummary[];
36
19
  };
37
- /**
38
- * Renders the attachment section of a daily report detail card.
39
- * 日報詳細カードの添付ファイル節を描画するコンポーネント。
40
- *
41
- * 表示文言はすべて `fieldLabels` から取る (パッケージは業務ドメインの語彙も言語も持たない)。
42
- *
43
- * @param props Attachments to render. 描画する添付一覧。
44
- * @returns The section element, or null when there is nothing to show. 節の要素 (表示対象が無ければ null)。
45
- */
46
20
  declare const DailyReportAttachmentList: ({ attachments }: DailyReportAttachmentListProps) => react.JSX.Element | null;
47
-
48
21
  type DailyReportPostedCommentProps = {
49
22
  comment: UIComment;
50
23
  reportHubId: number;
@@ -55,12 +28,7 @@ type DailyReportPostedCommentProps = {
55
28
  onTrashClick: (e: React.MouseEvent | React.TouchEvent, commentId: number | string) => void;
56
29
  resolvedIdMap?: Map<number, number>;
57
30
  };
58
- /**
59
- * Renders a single comment item with delete functionality.
60
- * 削除機能付きの単一コメントアイテムを描画するコンポーネント。
61
- */
62
31
  declare const DailyReportPostedComment: ({ comment, reportHubId: _reportHubId, businessDate: _businessDate, onOptimisticDelete, pendingDeleteId, onPendingDeleteIdChange, onTrashClick, resolvedIdMap }: DailyReportPostedCommentProps) => react.JSX.Element;
63
-
64
32
  type DailyReportCommentListProps = {
65
33
  comments: UIComment[];
66
34
  reportHubId: number;
@@ -70,36 +38,13 @@ type DailyReportCommentListProps = {
70
38
  onPendingDeleteIdChange: (id: number | string | null) => void;
71
39
  resolvedIdMap?: Map<number, number>;
72
40
  };
73
- /**
74
- * Renders a list of daily report comments.
75
- * 日報コメントのリストを描画するコンポーネント。
76
- */
77
41
  declare const DailyReportCommentList: ({ comments, reportHubId, businessDate, onDeleteComment, pendingDeleteId, onPendingDeleteIdChange, resolvedIdMap }: DailyReportCommentListProps) => react.JSX.Element | null;
78
42
  type DailyReportCommentFormProps = {
79
43
  reportHubId: number;
80
44
  businessDate: string;
81
45
  onAddComment?: (content: string) => Promise<void> | void;
82
46
  };
83
- /**
84
- * Renders a form to add a new comment to a daily report.
85
- * 日報に新しいコメントを追加するためのフォームを描画するコンポーネント。
86
- */
87
47
  declare const DailyReportCommentForm: ({ reportHubId, businessDate, onAddComment }: DailyReportCommentFormProps) => react.JSX.Element;
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
48
  type DailyReportDetailListScrollRestore = {
104
49
  topItem: {
105
50
  reportHubId: number;
@@ -114,67 +59,29 @@ type DailyReportDetailListProps = {
114
59
  userId?: string | null;
115
60
  selectedItemId?: number | null;
116
61
  onSelectItem?: (id: number | null) => void;
117
- /**
118
- * スクロール位置の共有スロット。マウント時に一度だけ読み、スクロールのたびに書き戻す。
119
- * ❗ 値をレンダー時に読んで props へ焼き込む方式は禁止 (daily-report-list.tsx 参照)
120
- */
121
62
  scrollRestoreRef?: RefObject<DailyReportDetailListScrollRestore>;
122
63
  };
123
- /**
124
- * Daily report detail cards rendered with dynamic height virtual scroll.
125
- * 動的高さの仮想スクロールで日報詳細カードを描画するコンポーネント。
126
- */
127
64
  declare const DailyReportDetailList: ({ dailyReportItems, userId, selectedItemId, onSelectItem, scrollRestoreRef }: DailyReportDetailListProps) => react.JSX.Element;
128
-
129
65
  type DailyReportEditFormProps = {
130
66
  report: DailyReportDetail;
131
67
  onCancel?: () => void;
132
68
  onPublishSuccess?: () => void;
133
69
  };
134
70
  declare const DailyReportEditForm: ({ report, onCancel, onPublishSuccess }: DailyReportEditFormProps) => react.JSX.Element;
135
-
136
- /**
137
- * Renders the streaming progress / recovery badge for the ids stream.
138
- * ids ストリームの進捗・復旧バッジを描画するコンポーネント。
139
- */
140
71
  declare const DailyReportIdsStreamStatus: () => react.JSX.Element | null;
141
-
142
- /**
143
- * Props for the DailyReportList component.
144
- * DailyReportList コンポーネントのプロパティ型定義。
145
- */
146
72
  type DailyReportListProps = {
147
73
  dailyReportItems: DailyReportItem[];
148
74
  autoMarkRead?: boolean;
149
75
  selectedReportHubId: number | null;
150
76
  onSelectItem: (reportHubId: number | null) => void;
151
77
  userId?: string | null;
152
- /**
153
- * Shared slot to preserve scroll position across unmounted tab switches.
154
- * タブ切替 (アンマウント) をまたいでスクロール位置を持ち回る共有スロット。
155
- * 値は VirtualScroll の論理座標 (inset 非依存。onScroll が配信する座標系)。
156
- * マウント時に一度だけ読み、スクロールのたびに書き戻す。
157
- */
158
78
  scrollOffsetRef?: RefObject<number>;
159
79
  };
160
- /**
161
- * Daily report list cards with key metadata and preview content via virtual scrolling.
162
- * 主なメタデータと内容プレビューを仮想スクロール表示する日報リスト。
163
- */
164
80
  declare const DailyReportList: ({ dailyReportItems, autoMarkRead, selectedReportHubId, onSelectItem, userId, scrollOffsetRef }: DailyReportListProps) => react.JSX.Element;
165
-
166
- /** ヘッダー描画スロットに渡される引数。 */
167
81
  type DailyReportHeaderProps = {
168
82
  title: string;
169
83
  annotation?: ReactNode;
170
84
  };
171
- /**
172
- * Display labels for the report detail/list fields, sections, and side-pane tabs.
173
- * 日報の詳細/一覧カードのフィールド・セクション・タブ見出しの表示ラベル群。
174
- *
175
- * パッケージは中立な英語ラベルのみを既定として同梱し、ドメイン固有の表現 (言語・業務語彙) は
176
- * 消費アプリが `fieldLabels` で注入する。これによりパッケージ本体が業務ドメイン知識を持たない。
177
- */
178
85
  type DailyReportFieldLabels = {
179
86
  id: string;
180
87
  businessDate: string;
@@ -192,182 +99,75 @@ type DailyReportFieldLabels = {
192
99
  interviewers: string;
193
100
  comments: string;
194
101
  attachments: string;
195
- /** 実体の消失が確認された添付に添える注記。 */
196
102
  attachmentMissing: string;
197
- /** 添付をダウンロードするリンクのラベル。 */
198
103
  attachmentDownload: string;
199
104
  tabArticle: string;
200
105
  tabRelations: string;
201
106
  relationsEmpty: string;
202
107
  };
203
- /**
204
- * Mutation-failure notification payload (for a host-supplied error surface).
205
- * ミューテーション失敗の通知情報 (ホストが独自の通知 UI を出すための口)。
206
- */
207
108
  type DailyReportErrorInfo = {
208
- /** 失敗した操作の種別 (create / update / publish / delete / addComment / deleteComment / toggleStar / toggleRead)。 */
209
109
  operation: string;
210
- /** 表示用のメッセージ (パッケージ内蔵バナー用)。 */
211
110
  message: string;
212
- /** 元例外 (診断用)。 */
213
111
  cause?: unknown;
214
112
  };
215
- /** データソースごとのバッジ表示設定。 */
216
113
  type SourceTypeConfig = {
217
114
  label: string;
218
115
  badgeClassName?: string;
219
- /** コメント投稿を許可するかどうか (既定 true)。false の場合、該当ソースの日報でコメント投稿フォームを非表示にする。 */
220
116
  allowComment?: boolean;
221
117
  };
222
- /** クライアント層の設定一式。 */
223
118
  type DailyReportClientConfig = {
224
- /** 画面タイトル (ヘッダーへ渡す)。 */
225
119
  title: string;
226
- /** API ベースパス (例 `/daily_report/api`)。末尾スラッシュ無し。 */
227
120
  apiBasePath: string;
228
- /** SSE エンドポイントパス (例 `/sse/daily_report/updates`)。 */
229
121
  ssePath: string;
230
- /** 下書き状態を表すラベル名。UI の編集モード判定に使う。既定はプレースホルダーなので消費側で自アプリのラベル名へ上書きする。 */
231
122
  draftLabelName: string;
232
- /** 詳細/一覧カード of field 見出しラベル。既定は中立英語。アプリが自ドメインの表記を注入する。 */
233
123
  fieldLabels: DailyReportFieldLabels;
234
- /** 外部ソース区分ごとのバッジ表示設定。 */
235
124
  sourceTypeConfigs?: Record<string, SourceTypeConfig>;
236
- /** ヘッダー描画スロット。アプリのヘッダーコンポーネントを差し込む。 */
237
125
  renderHeader: (props: DailyReportHeaderProps) => ReactNode;
238
- /** 開発向けコントロール (SSE 購読トグル等) を表示するか。 */
239
126
  showDevControls: boolean;
240
- /**
241
- * ミューテーション失敗時の通知ポート。未指定ならパッケージ内蔵の role="alert"
242
- * バナーで表示する。ホストが独自トースト等を持つ場合はここへ委譲する。
243
- */
244
127
  onError?: (info: DailyReportErrorInfo) => void;
245
128
  };
246
- /**
247
- * Partial client-config override. `fieldLabels` may itself be partially overridden.
248
- * クライアント設定の部分上書き型。`fieldLabels` も部分上書き可 (プロバイダーが深くマージする)。
249
- */
250
129
  type DailyReportClientConfigInput = Partial<Omit<DailyReportClientConfig, "fieldLabels">> & {
251
130
  fieldLabels?: Partial<DailyReportFieldLabels>;
252
131
  sourceTypeConfigs?: Record<string, SourceTypeConfig>;
253
132
  };
254
- /** 中立英語のフィールドラベル既定 (ドメイン非依存)。 */
255
133
  declare const defaultDailyReportFieldLabels: DailyReportFieldLabels;
256
- /** 既定設定 (消費側は必要なフィールドのみ部分上書きする)。 */
257
134
  declare const defaultDailyReportClientConfig: DailyReportClientConfig;
258
- /**
259
- * Provides a partial override of the daily-report client configuration.
260
- * 日報クライアント設定の部分上書きを提供するプロバイダー。
261
- */
262
135
  declare const DailyReportConfigProvider: ({ config, children }: {
263
136
  config?: DailyReportClientConfigInput;
264
137
  children: ReactNode;
265
138
  }) => react.JSX.Element;
266
- /**
267
- * Reads the daily-report client configuration (defaults when no provider).
268
- * 日報クライアント設定を読む (プロバイダー未設置時は既定値)。
269
- */
270
139
  declare const useDailyReportConfig: () => DailyReportClientConfig;
271
- /**
272
- * Resolves source type badge configuration with case-insensitive fallback.
273
- * ケースインセンシティブなフォールバック付きでデータソースバッジ設定を解決する。
274
- */
275
140
  declare const resolveSourceTypeConfig: (sourceType?: string | null, sourceTypeConfigs?: Record<string, SourceTypeConfig>) => SourceTypeConfig | undefined;
276
-
277
- /**
278
- * Error display when the ids stream terminally failed before any data arrived.
279
- * データ未受信のまま ID ストリームが力尽きたときのエラー表示コンポーネント。
280
- *
281
- * 再試行はストリームセッションの retry へ直結する (受信済みカーソルから再開)。
282
- */
283
141
  declare const DailyReportLoadError: () => react.JSX.Element;
284
- /**
285
- * Loading screen shown only until the first stream chunk arrives.
286
- * 最初のストリームチャンクが届くまでの間だけ表示するローディング画面。
287
- */
288
142
  declare const DailyReportLoading: () => react.JSX.Element;
289
143
  type DailyReportPageProps = {
290
- /** 表示中ユーザー (楽観的コメントの作者名等に使用)。 */
291
144
  user?: DailyReportUser;
292
- /** 難読化済みの内部ユーザー ID (未登録ユーザーは null)。 */
293
145
  userId?: string | null;
294
- /** クライアント設定の部分上書き (ヘッダー描画・パス・ラベル名・フィールドラベルなど)。 */
295
146
  config?: DailyReportClientConfigInput;
296
147
  };
297
- /**
298
- * Chrome-agnostic daily report page with client configuration provider.
299
- * 設定プロバイダー込みの日報ページコンポーネント。
300
- */
301
148
  declare const DailyReportPage: ({ config, ...rest }: DailyReportPageProps) => react.JSX.Element;
302
-
303
149
  type DailyReportResolvedContentProps = {
304
150
  userId?: string | null;
305
151
  };
306
- /**
307
- * Displays streamed daily reports with layout and tabbed virtual scroll views.
308
- * レイアウトとタブ付き仮想スクロールでストリーム受信済み日報を表示するコンポーネント。
309
- *
310
- * アイテムは Action Context (ストリームチャンクをマージ済み) から読む。
311
- */
312
152
  declare const DailyReportResolvedContent: ({ userId }: DailyReportResolvedContentProps) => react.JSX.Element;
313
-
314
153
  type UnreadIndicatorProps = {
315
154
  className?: string;
316
155
  };
317
- /**
318
- * A simple blue dot indicator used to represent unread status.
319
- * 未読状態を表すためのシンプルな青いドットインジケーター。
320
- */
321
156
  declare const UnreadIndicator: ({ className }: UnreadIndicatorProps) => react.JSX.Element;
322
-
323
157
  type DailyReportActionContextType = {
324
- /** 表示中ユーザー (楽観的コメントの作者名等に使用)。 */
325
158
  user?: DailyReportUser;
326
- /** reportHubId -> Map<tempCommentId, content> (追加コメントの一時IDと内容) */
327
159
  pendingAddCommentIds: React.MutableRefObject<Map<number, Map<number, string>>>;
328
- /** reportHubId -> Set<tempCommentId> (削除された一時ID) */
329
160
  pendingDeleteCommentIds: React.MutableRefObject<Map<number, Set<number>>>;
330
- /** reportHubId -> boolean (スターの保留状態) */
331
161
  pendingStarUpdates: React.MutableRefObject<Map<number, boolean>>;
332
- /** reportHubId -> boolean (既読の保留状態) */
333
162
  pendingReadUpdates: React.MutableRefObject<Map<number, boolean>>;
334
- /** tempId -> realId (解決されたID) */
335
163
  resolvedIdMap: React.MutableRefObject<Map<number, number>>;
336
- /** 状態変更通知用バージョン */
337
164
  version: number;
338
- /** 日報リスト */
339
165
  items: DailyReportItem[];
340
- /** SSE購読が有効かどうか */
341
166
  isSseEnabled: boolean;
342
- /** SSE購読の有効/無効を切り替える */
343
167
  toggleSse: () => void;
344
- /**
345
- * コメントを追加します。
346
- * @param reportHubId 日報HubID
347
- * @param content コメント内容
348
- * @param businessDate 営業日
349
- */
350
168
  addComment: (reportHubId: number, content: string, businessDate: string) => Promise<void>;
351
- /**
352
- * コメントを削除します。
353
- * @param reportHubId 日報HubID
354
- * @param commentId コメントID (一時IDまたは実ID)
355
- * @param businessDate 営業日
356
- */
357
169
  deleteComment: (reportHubId: number, commentId: number, businessDate: string) => Promise<void>;
358
- /**
359
- * スターの状態を切り替えます。
360
- * @param reportHubId 日報HubID
361
- * @param isStarred 新しいスター状態
362
- * @param businessDate 営業日
363
- */
364
170
  toggleStar: (reportHubId: number, isStarred: boolean, businessDate: string) => Promise<void>;
365
- /**
366
- * 既読の状態を切り替えます。
367
- * @param reportHubId 日報HubID
368
- * @param isRead 新しい既読状態
369
- * @param businessDate 営業日
370
- */
371
171
  toggleRead: (reportHubId: number, isRead: boolean, businessDate: string) => Promise<void>;
372
172
  createReport: (businessDate: string) => Promise<number>;
373
173
  updateReport: (reportHubId: number, data: {
@@ -376,59 +176,28 @@ type DailyReportActionContextType = {
376
176
  }, businessDate: string) => Promise<void>;
377
177
  publishReport: (reportHubId: number, businessDate: string) => Promise<void>;
378
178
  deleteReport: (reportHubId: number, businessDate: string) => Promise<void>;
379
- /** stale アイテムをリストから除去する安全弁 */
380
179
  removeStaleItem: (reportHubId: number) => void;
381
- /** データのみリロード (ページリロードなし) */
382
180
  refetchData: () => Promise<void>;
383
- /** キャッシュを破棄してデータのみ再読み込み (ページリロードなし) */
384
181
  clearCacheAndRefetch: () => Promise<void>;
385
182
  };
386
183
  declare global {
387
184
  var __DailyReportActionContext: Context<DailyReportActionContextType | null> | undefined;
388
185
  }
389
186
  declare const useDailyReportActionContext: () => DailyReportActionContextType;
390
- /**
391
- * Provides a context for daily report actions including comments, stars, leads, and basic CRUD operations.
392
- * Also manages optimistic UI updates and real-time synchronization via SSE.
393
- * 日報のアクション(コメント追加・削除、スター、既読)を管理するプロバイダー。
394
- * 楽観的UI更新とAPI通信の抽象化を提供します。
395
- */
396
187
  declare const DailyReportActionProvider: ({ children, user, initialItems, userId }: {
397
188
  children: ReactNode;
398
189
  user?: DailyReportUser;
399
190
  initialItems?: DailyReportItem[];
400
191
  userId?: string | null;
401
192
  }) => react.JSX.Element;
402
-
403
193
  type DailyReportErrorSurface = {
404
- /** ミューテーション失敗を通知する。 */
405
194
  notifyError: (info: DailyReportErrorInfo) => void;
406
195
  };
407
- /**
408
- * Returns the error-surface API (safe no-op outside the provider).
409
- * 通知 API を返す処理 (Provider 外では no-op)。
410
- */
411
196
  declare const useDailyReportErrorSurface: () => DailyReportErrorSurface;
412
- /**
413
- * Provides the mutation error surface and renders the default alert banner.
414
- * ミューテーション通知シームを供給し、既定のアラートバナーを描画するプロバイダー。
415
- *
416
- * `config.onError` があればホストへ委譲し、内蔵バナーは描画しない (二重表示防止)。
417
- */
418
197
  declare const DailyReportErrorProvider: ({ children }: {
419
198
  children: ReactNode;
420
199
  }) => react.JSX.Element;
421
-
422
- /**
423
- * Animates numeric changes with ease-out cubic.
424
- * 数値変化をイーズアウト 3 次で補間するフック。
425
- *
426
- * @param value Target value. 目標値。
427
- * @param durationMs Animation duration. アニメーション時間 (既定 250ms)。
428
- * @returns Displayed (interpolated) value. 表示用の補間値。
429
- */
430
200
  declare const useAnimatedNumber: (value: number, durationMs?: number) => number;
431
-
432
201
  type CacheEntry<T> = {
433
202
  data: T;
434
203
  expiresAt: number;
@@ -443,114 +212,30 @@ declare const DailyReportCache: {
443
212
  lastMutations: Map<number, number>;
444
213
  recentDeletes: Map<number, number>;
445
214
  lastPrune: number;
446
- /**
447
- * Prune expired entries from the cache.
448
- * キャッシュから期限切れのエントリを削除する。
449
- */
450
215
  prune(): void;
451
- /**
452
- * Clear all cached entries and pending requests.
453
- * すべてのキャッシュエントリおよび待機中リクエストをクリアする。
454
- */
455
216
  clear(): void;
456
- /**
457
- * Check if the cache entry is still valid.
458
- * キャッシュエントリがまだ有効かを確認する。
459
- */
460
217
  isValid: (ex: number) => boolean;
461
- /**
462
- * Notify all listeners of a report update.
463
- * レポートの更新をすべてのリスナーに通知する。
464
- */
465
218
  notify: (id: number) => void;
466
- /**
467
- * Retrieve a cached report by ID.
468
- * ID でキャッシュされたレポートを取得する。
469
- */
470
219
  getReport(id: number, ignoreExpiry?: boolean): DailyReportDetail | null;
471
- /**
472
- * Retrieve a cached list of reports by business date key.
473
- * 営業日キーでレポートのキャッシュリストを取得する。
474
- */
475
220
  getList(dateKey: string | null, ignoreExpiry?: boolean): DailyReportDetail[] | null;
476
- /**
477
- * Set a report in the cache and optionally sync with the list cache.
478
- * キャッシュにレポートを設定し、必要に応じてリストキャッシュと同期する。
479
- */
480
221
  set(report: DailyReportDetail, expiresAt: number, syncList?: boolean): void;
481
- /**
482
- * Update a cached report with partial data.
483
- * 部分的なデータでキャッシュされたレポートを更新する。
484
- */
485
222
  update(id: number, updates: Partial<DailyReportDetail>, strict?: boolean): void;
486
- /**
487
- * Delete a report from the cache and update the corresponding list.
488
- * キャッシュからレポートを削除し、対応するリストを更新する。
489
- */
490
223
  delete(id: number, date: string): void;
491
- /**
492
- * Merge server report with cached report to handle optimistic updates and zombies.
493
- * サーバーレポートとキャッシュレポートをマージして、楽観的更新とゾンビコメントを処理する。
494
- */
495
224
  merge(serverReport: DailyReportDetail, cachedReport?: DailyReportDetail | null): DailyReportDetail;
496
- /**
497
- * Hydrate the cache with fetched reports, handling comment merges and locks.
498
- * フェッチされたレポートでキャッシュをハイドレートし、コメントのマージとロックを処理する。
499
- */
500
225
  cacheMany(reports: DailyReportDetail[], dateKey: string | null, fetchStart: number): DailyReportDetail[];
501
226
  };
502
- /**
503
- * Update the cache for a single report.
504
- * 単一レポートのキャッシュを更新する。
505
- */
506
227
  declare const writeCache: (r: DailyReportDetail, exp: number, sync?: boolean) => void;
507
- /**
508
- * Get a cached report by ID.
509
- * ID でキャッシュされたレポートを取得する。
510
- */
511
228
  declare const getCachedReport: (id: number, opts?: {
512
229
  ignoreExpiry?: boolean;
513
230
  }) => DailyReportDetail | null;
514
- /**
515
- * Update specific fields of a cached report.
516
- * キャッシュされたレポートの特定のフィールドを更新する。
517
- */
518
231
  declare const updateDailyReportCache: (id: number, u: Partial<DailyReportDetail>) => void;
519
- /**
520
- * Delete a report from the cache.
521
- * キャッシュからレポートを削除する。
522
- */
523
232
  declare const deleteDailyReportCache: (id: number, d: string) => void;
524
- /**
525
- * Clear all daily report cache store entries.
526
- * 日報の全キャッシュストアを消去する。
527
- */
528
233
  declare const clearDailyReportCache: () => void;
529
234
  declare const acquireMutationLock: (id: number) => void;
530
235
  declare const releaseMutationLock: (id: number) => void;
531
236
  declare const registerRecentDeletion: (cId: number) => Map<number, number>;
532
- /**
533
- * Subscribe to cache-ready events for a specific report.
534
- * Returns an unsubscribe function.
535
- *
536
- * 特定レポートのキャッシュ書き込みを監視する。
537
- * 解除関数を返す。
538
- */
539
237
  declare const subscribeCacheReady: (reportHubId: number, callback: () => void) => (() => void);
540
238
  declare const applyDailyReportServerUpdates: (_reportHubId: number, report: DailyReportDetail) => void;
541
- /**
542
- * Applies a broadcast (cross-user SSE) report while preserving the viewer's own per-viewer state.
543
- * 全ユーザー放送 (SSE) の report を、受信者自身の per-viewer 状態を保持したまま反映する処理。
544
- *
545
- * SSE の report-create/update/publish が運ぶ isRead/isStarred は**操作した本人の状態**。
546
- * そのまま書くと受信者の既読/スター表示が他人の状態で上書きされる。共有フィールドだけを
547
- * 取り込み、per-viewer フィールドは受信者のキャッシュ値を保持する。ローカルに無い日報は
548
- * 種まきしない (送信者の per-viewer 値で汚すより、次のフェッチが受信者視点の正しい値を
549
- * 取るのに任せるほうが安全)。
550
- *
551
- * ❗ 信頼できる経路 (自分の HTTP 応答・recipient フィルタ済みの自分宛 status-update) は
552
- * {@link applyDailyReportServerUpdates} を使うこと — そちらは値をそのまま書く。
553
- */
554
239
  declare const applyBroadcastReportUpdate: (report: DailyReportDetail) => void;
555
240
  type DailyReportDetailResource = {
556
241
  report: DailyReportDetail | null;
@@ -558,17 +243,8 @@ type DailyReportDetailResource = {
558
243
  isLoading: boolean;
559
244
  isRefetching: boolean;
560
245
  };
561
- /**
562
- * Provides a fetcher-driven daily report detail reader with business-date aware caching.
563
- * 営業日キャッシュ対応の日報詳細取得フック。
564
- */
565
246
  declare const useDailyReportDetail: (reportHubId: number, businessDate: string | null) => DailyReportDetailResource;
566
- /**
567
- * Provides a business-date aware prefetch helper.
568
- * 営業日キャッシュを活用した日報プリフェッチ補助フック。
569
- */
570
247
  declare const useDailyReportPrefetch: () => (date: string | null) => void;
571
-
572
248
  type User = {
573
249
  displayName?: string;
574
250
  name?: {
@@ -579,10 +255,6 @@ type User = {
579
255
  value: string;
580
256
  }[];
581
257
  };
582
- /**
583
- * Manages daily report comments, integrating server data with optimistic local updates.
584
- * サーバーデータとローカルの楽観的更新を統合して日報コメントを管理するフック。
585
- */
586
258
  declare const useDailyReportComments: (report: DailyReportDetail | null, user: User | null | undefined, userId?: string | null) => {
587
259
  uiComments: UIComment[];
588
260
  handleAddComment: (content: string) => Promise<void>;
@@ -591,27 +263,13 @@ declare const useDailyReportComments: (report: DailyReportDetail | null, user: U
591
263
  setPendingDeleteId: react.Dispatch<react.SetStateAction<string | number | null>>;
592
264
  resolvedIdMap: Map<number, number>;
593
265
  };
594
-
595
266
  type UseDailyReportSseConnectionOptions = {
596
267
  isSseEnabled: boolean;
597
268
  onMessage: (payload: Exclude<DailyReportSseMessage, {
598
269
  type: "connected";
599
270
  }>) => void;
600
271
  };
601
- /**
602
- * Manages Daily Report SSE connection lifecycle with reconnect handling.
603
- * Handles open, message parse/dispatch, error logging, retry, and cleanup.
604
- *
605
- * 日報 SSE 接続のライフサイクルを管理する Hook。
606
- * 接続開始、メッセージ解析と配送、エラー時再接続、クリーンアップを管理します。
607
- */
608
272
  declare const useDailyReportSseConnection: ({ isSseEnabled, onMessage }: UseDailyReportSseConnectionOptions) => void;
609
-
610
- /**
611
- * Shared hook for calculating viewport height of virtual scroll containers.
612
- * 仮想スクロールコンテナのビューポート高さを計測する共通フック。
613
- */
614
-
615
273
  type UseDynamicViewportHeightOptions = {
616
274
  enableMutationObserver?: boolean;
617
275
  bottomGap?: number;
@@ -621,37 +279,8 @@ type UseDynamicViewportHeightResult = {
621
279
  viewportHeight: number;
622
280
  updateViewportHeight: () => void;
623
281
  };
624
- /**
625
- * Computes and updates the viewport height for scroll containers while reacting to layout changes.
626
- * レイアウト変化に追従しながらスクロールコンテナのビューポート高さを算出して更新する関数。
627
- */
628
282
  declare const useDynamicViewportHeight: (containerRef: RefObject<HTMLDivElement | null>, options?: UseDynamicViewportHeightOptions) => UseDynamicViewportHeightResult;
629
-
630
- /**
631
- * React Router route helpers for the daily-report page (revalidation policy / client loader).
632
- * 日報ページ向け React Router ルートヘルパー (再検証ポリシー / クライアントローダー)。
633
- */
634
-
635
- /**
636
- * Prevents loader revalidation when POP navigations keep identical URL state.
637
- * URL 状態が同一の POP ナビゲーション時にローダー再検証を抑止。
638
- */
639
283
  declare const dailyReportShouldRevalidate: ShouldRevalidateFunction;
640
- /**
641
- * Creates a React Router clientLoader that bootstraps the ids stream session.
642
- * ID ストリームセッションを起動する React Router clientLoader を生成する処理。
643
- *
644
- * ID 一覧は Promise で返さず、モジュール常駐のストリームセッションが供給する
645
- * (ページ側は `useDailyReportIdsStream` で購読する)。ローダー時点でセッションを
646
- * 生成することが**コールドロードの最重要最適化** — ページマウントの effect まで
647
- * 遅らせると、ストリームの開始が「ハイドレーション完了 + effect flush」の後ろに
648
- * 直列化される。再訪 (セッション既存) は serverLoader を待たずに鮮度確認を先行させる。
649
- *
650
- * `config.apiBasePath` を上書きするアプリは同じ値を `options.apiBasePath` にも渡すこと
651
- * (渡し忘れは初回 1 回だけ誤パス生成 → ページマウントの ensure が自己修復する)。
652
- *
653
- * 返す関数へ `hydrate = true as const` を付与済み (初期ハイドレーションでも実行される)。
654
- */
655
284
  declare const createDailyReportClientLoader: <TServerData extends Record<string, unknown>>(options?: {
656
285
  apiBasePath?: string;
657
286
  }) => {
@@ -660,382 +289,98 @@ declare const createDailyReportClientLoader: <TServerData extends Record<string,
660
289
  }): Promise<TServerData>;
661
290
  hydrate: true;
662
291
  };
663
-
664
- /** ストリームのライフサイクル局面。 */
665
292
  type DailyReportIdsStreamPhase = "idle" | "streaming" | "retrying" | "complete" | "failed" | "auth-required";
666
- /** publish されるスナップショット。publish 間で参照が安定している。 */
667
293
  type DailyReportIdsStreamState = {
668
- /** 受信済みアイテム (reportHubId で重複排除済み)。 */
669
294
  items: DailyReportItem[];
670
- /** 一意アイテム件数 (`items.length` と同値。表示用の別名)。 */
671
295
  loadedCount: number;
672
- /** サーバー申告の全体件数。先頭行未着なら null。 */
673
296
  totalCount: number | null;
674
- /** ライフサイクル局面。 */
675
297
  phase: DailyReportIdsStreamPhase;
676
- /** complete 後のバックグラウンド再検証が走っているか。 */
677
298
  isRevalidating: boolean;
678
- /** 一度でも完走したか (再検証中の UI 判定に使う)。 */
679
299
  hasCompletedOnce: boolean;
680
- /**
681
- * 直近の「実際の完走」時刻 (未完走は null)。鮮度判定 (SWR 窓) の唯一の根拠。
682
- * 完走の publish でのみ更新される — 再検証の諦めなど phase が complete のままの
683
- * publish で更新すると、古いデータが新鮮扱いされ再検証が永久に走らなくなる。
684
- */
685
300
  completedAt: number | null;
686
- /** 直近の失敗 (成功で null に戻る)。 */
687
301
  error: Error | null;
688
302
  };
689
- /** テスト注入用の依存一式。 */
690
303
  type DailyReportIdsStreamClientOptions = {
691
- /** API ベースパス (既定 `/daily_report/api`)。 */
692
304
  apiBasePath?: string;
693
- /** fetch 実装 (既定 globalThis.fetch)。 */
694
305
  fetchFn?: (input: string, init: {
695
306
  signal: AbortSignal;
696
307
  headers: Record<string, string>;
697
308
  cache: RequestCache;
698
309
  }) => Promise<Response>;
699
- /** タイマー実装 (既定 setTimeout / clearTimeout)。 */
700
310
  setTimeoutFn?: (handler: () => void, ms: number) => ReturnType<typeof setTimeout>;
701
311
  clearTimeoutFn?: (id: ReturnType<typeof setTimeout>) => void;
702
- /**
703
- * 1 回の read が無音でいられる上限 (ms)。0 以下で無効。
704
- * これを超えたら接続を half-open とみなして中断し、retryable として
705
- * カーソル再開へ倒す。サーバーのハートビート間隔より必ず長く取る
706
- * (生きているが遅いだけの全量クエリ待ちを誤って切らないため)。
707
- */
708
312
  readStallTimeoutMs?: number;
709
- /** 警告ロガー (既定 console.warn)。 */
710
313
  warn?: (...args: unknown[]) => void;
711
- /**
712
- * チャンク由来 publish の合体窓 (ms)。0 で無効 (毎チャンク即時 publish)。
713
- * 高速回線ではネットワーク read が密集し、publish ごとに全件ソート + 全行再レンダーが
714
- * 走るため、先頭は即時 (初回描画優先)・後続は窓内で合体するスロットルを掛ける。
715
- * 完走 publish と外部ミューテーション (ユーザー操作の即時フィードバック) は対象外。
716
- */
717
314
  publishCoalesceMs?: number;
718
315
  };
719
- /**
720
- * NDJSON ids stream client with dedupe, cursor resume, and exponential backoff.
721
- * 重複排除・カーソル再開・指数バックオフを備えた NDJSON ids ストリームクライアント。
722
- */
723
316
  declare class DailyReportIdsStreamClient {
724
317
  private readonly apiBasePath;
725
318
  private readonly fetchFn;
726
319
  private readonly setTimeoutFn;
727
320
  private readonly clearTimeoutFn;
728
321
  private readonly warn;
729
- /** 1 回の read が無音でいられる上限 (ms)。0 以下で無効。 */
730
322
  private readonly readStallTimeoutMs;
731
- /** reportHubId → アイテム。挿入順を保ち、再開の重複到着を吸収する。 */
732
323
  private readonly itemMap;
733
324
  private readonly listeners;
734
325
  private state;
735
326
  private lastCursor;
736
- /**
737
- * 最後に受け取ったスナップショットトークン。カーソルと**対**で意味を持つ。
738
- *
739
- * サーバーはこのトークンが現在の配列と一致するときだけカーソルを信用する。
740
- * トークンを欠いたカーソルは安全側 (先頭から再送) へ倒されるため、対で送れないなら
741
- * 送らないのと同じコスト (全量再送) になる。
742
- */
743
327
  private lastSnapshot;
744
328
  private consecutiveFailures;
745
329
  private started;
746
330
  private disposed;
747
- /** 実行中ループの世代。refresh/dispose で進め、旧ループの続行を無効化する。 */
748
331
  private loopGeneration;
749
332
  private activeAbortController;
750
- /**
751
- * 先頭 (cursor 無し) から始まった走査で観測した ID の集合。
752
- * 完走時にこの集合へ含まれない Map エントリを剪定し、サーバー側で削除された
753
- * 日報がモジュール常駐データに永久残留するのを防ぐ。途中失敗のカーソル再開は
754
- * 同じ走査の続きなので集合を引き継ぐ (全区間の和 = サーバーの全量)。
755
- */
756
333
  private activeSeenIds;
757
- /**
758
- * 外部削除のトゥームストーン。サーバーは配列全体を先に確定させてから送出するため、
759
- * 走査中に届いた削除の後、同じ削除前スナップショットの後続チャンクが同 ID を
760
- * 再配送してくる。これを吸収せずに素通しすると、削除済み日報が Map へ戻り
761
- * 完走剪定も免れてしまう (観測集合に再記録されるため)。新しい走査の開始
762
- * (削除コミット後のスナップショット) でクリアする。
763
- */
764
334
  private readonly externalRemovalTombstones;
765
- /**
766
- * 走行中の再検証中に届いた明示的キャッシュバイパス要求の持ち越しフラグ。
767
- * 走行中の再検証は中断しない方針のため、要求を黙って捨てず完走後に連結実行する。
768
- */
769
335
  private pendingForceRefresh;
770
336
  private wakeRetryWait;
771
337
  private readonly handleOnline;
772
- /** チャンク由来 publish の合体窓 (ms)。 */
773
338
  private readonly publishCoalesceMs;
774
- /** 合体窓のトレーリングタイマー。 */
775
339
  private publishCoalesceTimer;
776
- /** 直近のアイテム publish 時刻 (leading edge 判定用)。 */
777
340
  private lastItemsPublishAt;
778
341
  constructor(options?: DailyReportIdsStreamClientOptions);
779
- /**
780
- * Returns the current snapshot (stable reference between publishes).
781
- * 現在のスナップショットを返す処理 (publish 間で参照が安定)。
782
- */
783
342
  getState(): DailyReportIdsStreamState;
784
- /**
785
- * Subscribes to snapshot updates.
786
- * スナップショット更新の購読を登録する処理。
787
- *
788
- * @param listener Change callback. 変更通知コールバック。
789
- * @returns Unsubscribe function. 購読解除関数。
790
- */
791
343
  subscribe(listener: () => void): () => void;
792
- /**
793
- * Starts the initial stream (idempotent).
794
- * 初回ストリーミングを開始する処理 (冪等)。
795
- */
796
344
  start(): void;
797
- /**
798
- * Restarts after a terminal failure (no-op unless phase is "failed").
799
- * failed からの手動再開処理 (failed 以外では何もしない)。
800
- *
801
- * 受信済みデータと再開カーソルは保持したまま続きから読む。
802
- */
803
345
  retry(): void;
804
- /**
805
- * Revalidates a completed stream in the background (SWR-style).
806
- * 完走済みストリームをバックグラウンドで再検証する処理 (SWR)。
807
- *
808
- * カーソルを捨てて先頭から読み直し、Map の重複排除で差分を上書き吸収し、
809
- * 完走時に「今回の走査で観測されなかった行」を剪定する (サーバー側削除の反映)。
810
- * failed のときはカーソルを保持した再開に切り替える (forceRefresh 指定は失わない)。
811
- * streaming/retrying 中は何もしない。
812
- *
813
- * @param options.forceRefresh サーバー側 SqlResultCache をバイパスするか。
814
- */
815
346
  refresh(options?: {
816
347
  forceRefresh?: boolean;
817
348
  }): void;
818
- /**
819
- * Applies an externally-known upsert (SSE / local mutation) to the resident data.
820
- * 外部由来 (SSE / ローカル操作) の upsert を常駐データへ反映する処理。
821
- *
822
- * これを欠くと、マウント中に作成された日報がストリームセッションに存在せず、
823
- * 鮮度窓内の再訪 (再検証なし) で一覧から消える。アクティブな走査中は観測集合にも
824
- * 刻み、完走時の剪定で「生きていると分かっている行」を誤って落とさないようにする。
825
- */
826
349
  applyExternalUpsert(item: DailyReportItem): void;
827
- /**
828
- * Applies an externally-known removal (SSE report-delete / stale valve) to the resident data.
829
- * 外部由来 (SSE report-delete / stale 安全弁) の削除を常駐データへ反映する処理。
830
- *
831
- * 走査中の後続チャンク (削除前スナップショット) による同一行の再配送は、
832
- * クライアント側トゥームストーンが次の新しい走査までブロックする。
833
- */
834
350
  applyExternalRemoval(reportHubId: number): void;
835
- /**
836
- * Aborts everything and detaches listeners (terminal).
837
- * すべてを中断しリスナーを外す終了処理 (以後再利用不可)。
838
- */
839
351
  dispose(): void;
840
- /**
841
- * Connection-retry loop: stream → classify → backoff → resume.
842
- * 接続リトライループ。ストリーム → 結果分類 → バックオフ → カーソル再開。
843
- */
844
352
  private runStreamLoop;
845
- /**
846
- * Prunes map entries not observed by the completed full scan.
847
- * 完走した全量走査で観測されなかった Map エントリを剪定する処理。
848
- *
849
- * サーバー側で削除された日報の残留 (再訪時の亡霊復活・loadedCount > totalCount) を防ぐ。
850
- * 観測集合が無い場合 (理論上到達しない防御) は何も消さない。
851
- */
852
353
  private pruneUnseenItems;
853
- /**
854
- * Runs one streaming attempt and classifies its outcome.
855
- * 1 回のストリーミング試行を実行し、結末を分類する処理。
856
- */
857
354
  private streamOnce;
858
- /**
859
- * Reads one chunk, racing the read against a stall watchdog.
860
- * 1 チャンクを読む処理。読み取りを stall ウォッチドッグと競争させる。
861
- *
862
- * サーバーが無音のまま接続を half-open で放置しても (NAT/プロキシのアイドル切断・
863
- * VPN 断・スリープ)、`reader.read()` は永久に保留したままになる。これを検知するため
864
- * read とタイマーを競争させ、無音が上限を超えたら番兵を返す。生きているが遅いだけの
865
- * 全量クエリ待ちはサーバーのハートビート (空行) が read を解決するので誤検知しない。
866
- * `readStallTimeoutMs <= 0` のときは素の read (タイマーを張らない・テスト用)。
867
- *
868
- * @returns 読み取り結果、または stall を表す番兵。read の reject はそのまま伝播する。
869
- */
870
355
  private readWithStallGuard;
871
- /**
872
- * Merges chunk items into the dedupe map.
873
- * チャンクのアイテム群を重複排除 Map へ取り込む処理。
874
- *
875
- * @returns True when anything was added or changed. 追加または内容変化があれば true。
876
- */
877
- /**
878
- * Absorbs one chunk line, applying its restart directive first.
879
- * チャンク行を 1 行吸収する処理。再開指示があれば最初に適用する。
880
- *
881
- * ❗ リセット (restarted) とトークン記録を**この関数の内部**に置くのは意図的。
882
- * 「吸収より前に初期化せよ」を呼び出し側の責務にすると、順序を間違えたとき
883
- * 再開直後の行が新しい観測集合へ入らず完走剪定で即座に消える。関数へ畳み込めば
884
- * 呼び出し側に順序という概念が存在しなくなる。
885
- */
886
356
  private absorbChunkLine;
887
- /** アイテム配列を再スナップショットして即時 publish する。 */
888
357
  private publishItems;
889
- /**
890
- * チャンク由来のアイテム publish をスロットルする (leading edge 即時 + trailing 合体)。
891
- * 最初のチャンクは即時に描画へ届け、窓内に密集した後続チャンクは 1 回の publish
892
- * (= 1 回の全件ソートと再レンダー) へ合体する。合体窓 0 は無効 (常に即時)。
893
- */
894
358
  private schedulePublishItems;
895
- /** 保留中のトレーリング publish を破棄する (完走 publish が全量を運ぶ場合など)。 */
896
359
  private cancelScheduledPublishItems;
897
- /** 部分状態をマージした新スナップショットを作り、購読者へ通知する。 */
898
360
  private publish;
899
- /** 再開カーソル付きのストリーム URL を構築する。 */
900
361
  private buildStreamUrl;
901
- /**
902
- * バックオフ待機。online イベント・dispose・後続ループの開始で早期解除される。
903
- *
904
- * タイマー ID は待機ごとのローカルに閉じ、共有スロット (wakeRetryWait) は
905
- * 「まだ自分を指しているときだけ」外す。単一スロットへ素朴に書くと、
906
- * 追い越された旧待機の finish が新しいループのタイマーを消してしまい、
907
- * 再検証が永久に固まる (実測済みの競合)。
908
- */
909
362
  private waitBeforeRetry;
910
363
  }
911
-
912
- /**
913
- * Full-document reload indirection (mockable seam for auth-expiry tests).
914
- * ドキュメント全体を再読込する間接層 (認証切れテストで差し替え可能にする継ぎ目)。
915
- */
916
364
  declare const reloadDocument: () => void;
917
- /**
918
- * Ensures a stream session for the given user, creating/refreshing as needed.
919
- * 指定ユーザーのストリームセッションを確立する処理 (必要に応じ生成/再検証)。
920
- *
921
- * - ユーザーまたは API パスが変わっていれば作り直す (別ユーザーのデータを見せない)。
922
- * - failed なら自動 retry (再訪 = ユーザーの再試行意思とみなす)。
923
- * - 完走から {@link REVALIDATE_AFTER_MS} 経過していればバックグラウンド再検証。
924
- *
925
- * SSR では何もしない。clientLoader とページマウントの両方から呼ばれ、冪等。
926
- *
927
- * @param options.apiBasePath API ベースパス (config の apiBasePath)。
928
- * @param options.userKey 難読化ユーザー ID (未登録ユーザーは null)。
929
- */
930
365
  declare const ensureDailyReportIdsStreamSession: (options: {
931
366
  apiBasePath?: string;
932
367
  userKey: string | null;
933
368
  }) => void;
934
- /**
935
- * Bootstraps the session from the clientLoader: create when absent, else reconcile.
936
- * clientLoader からのセッション起動処理。不在なら生成、既存なら照合と鮮度確認。
937
- *
938
- * コールドロードの最重要ゲート対策: 生成をページマウントの effect まで遅らせると、
939
- * ストリームの最初のバイト要求が「serverLoader 完了 → ハイドレーション → effect flush」
940
- * の後ろに直列化される。ローダー時点で生成すればハイドレーションと並行してフェッチが走る。
941
- *
942
- * パス契約: 生成時のパスは factory オプション (未指定は既定値へ正規化)。
943
- * `config.apiBasePath` だけを上書きした利用者では初回のみ誤パスで生成されるが、
944
- * ページマウント側の ensure がパス不一致を検知して作り直す (自己修復・初回 1 回きり)。
945
- * **既存セッションのパスはここでは照合しない** — 照合すると、factory 未指定 ×
946
- * config 上書きの組み合わせでナビゲーションごとにセッションが破棄されるスラッシングになる。
947
- *
948
- * @param options.apiBasePath 生成時に使う API ベースパス (未指定は既定値)。
949
- * @param options.userKey 難読化ユーザー ID (未登録ユーザーは null)。
950
- */
951
369
  declare const bootstrapDailyReportIdsStreamSession: (options: {
952
370
  apiBasePath?: string;
953
371
  userKey: string | null;
954
372
  }) => void;
955
- /**
956
- * Kicks a freshness check for an existing session before the user is known.
957
- * ユーザー確定前に既存セッションの鮮度確認だけを先行させる処理。
958
- *
959
- * clientLoader が serverLoader を await する前に呼び、再訪 (支配的経路) の
960
- * 再検証開始を数十〜数百 ms 前倒しする。セッションが無ければ何もしない
961
- * (誰のデータを読むべきか分からないため)。直後の reconcile が userKey を照合し、
962
- * ユーザーが変わっていればセッションごと破棄されるので先行は安全。
963
- * 走行中の再検証は中断しない (runFreshnessCheck の isRevalidating ガード)。
964
- */
965
373
  declare const primeDailyReportIdsStreamSession: () => void;
966
- /**
967
- * Relays an externally-known item upsert into the resident stream data.
968
- * 外部由来のアイテム upsert を常駐ストリームデータへ中継する処理。
969
- *
970
- * プロバイダーの作成/公開系ミューテーション (ローカル操作と SSE) から呼ばれる。
971
- * これを欠くと、鮮度窓内の再訪で「作成したばかりの日報が消える」。
972
- */
973
374
  declare const upsertDailyReportIdsStreamItem: (item: DailyReportItem) => void;
974
- /**
975
- * Relays an externally-known item removal into the resident stream data.
976
- * 外部由来のアイテム削除を常駐ストリームデータへ中継する処理。
977
- *
978
- * report-delete SSE・ローカル削除・stale 安全弁から呼ばれる。
979
- * これを欠くと、鮮度窓内の再訪で「削除したはずの日報が蘇る」。
980
- */
981
375
  declare const removeDailyReportIdsStreamItem: (reportHubId: number) => void;
982
- /**
983
- * Restarts a failed stream (UI retry button entry point).
984
- * failed ストリームを再開する処理 (UI の再試行ボタン入口)。
985
- */
986
376
  declare const retryDailyReportIdsStream: () => void;
987
- /**
988
- * Re-validates the stream, optionally bypassing the server-side cache.
989
- * ストリームを再検証する処理 (サーバーキャッシュのバイパス指定可)。
990
- *
991
- * 開発向けリロード/キャッシュクリアボタンから呼ばれる。
992
- *
993
- * @param options.forceRefresh サーバー側 SqlResultCache をバイパスするか。
994
- */
995
377
  declare const refreshDailyReportIdsStream: (options?: {
996
378
  forceRefresh?: boolean;
997
379
  }) => void;
998
- /**
999
- * Returns the current session's owner key (undefined when no session exists).
1000
- * 現行セッションの持ち主 (userKey) を返す処理 (セッション不在時は undefined)。
1001
- *
1002
- * 遅延解決するミューテーション継続の門番に使う。POST /action の待機中にリロード無しの
1003
- * ユーザー切替が起きると、切替時の三重遮断 (セッション破棄 + 詳細キャッシュ破棄 +
1004
- * プロバイダーリマウント) の**後**に旧ユーザーの継続が解決し、モジュール常駐状態
1005
- * (新ユーザーのセッション・詳細キャッシュ) へ旧ユーザーのデータを注入してしまう。
1006
- * 継続側は開始時点の userKey とこの値を比較し、不一致 (undefined 含む) なら
1007
- * モジュール常駐状態への書き込みを放棄する (fail-closed)。
1008
- */
1009
380
  declare const getDailyReportIdsStreamSessionUserKey: () => string | null | undefined;
1010
- /**
1011
- * React binding for the module-resident ids stream session.
1012
- * モジュール常駐 ids ストリームセッションの React バインディング。
1013
- *
1014
- * セッションが後から生成されても再購読なしで追従する (リスナーはセッションではなく
1015
- * モジュールに属する)。スナップショット参照は publish 単位で安定している。
1016
- *
1017
- * @returns Current stream state. 現在のストリーム状態。
1018
- */
1019
381
  declare const useDailyReportIdsStream: () => DailyReportIdsStreamState;
1020
- /**
1021
- * Destroys the session (test isolation helper).
1022
- * セッションを破棄するテスト用ヘルパー。
1023
- */
1024
382
  declare const resetDailyReportIdsStreamSessionForTesting: () => void;
1025
-
1026
- /**
1027
- * Shared constants for Daily Report data fetching parameters.
1028
- * 日報データ取得で利用する共通パラメーター。
1029
- */
1030
383
  declare const DAILY_REPORT_FETCH_DEBOUNCE_MS = 120;
1031
- /**
1032
- * Delay before the provider auto-connects SSE, freeing a browser connection slot for first paint.
1033
- * SSE を自動接続するまでの遅延。初回描画とその中身フェッチへ接続枠を譲るための猶予。
1034
- *
1035
- * HTTP/1.1 のオリジン当たり 6 接続のうち、ids ストリームと SSE で 2 枠を常時占有する。
1036
- * SSE 接続を初回描画直後まで遅らせ、その 1 枠を初回の中身フェッチ (`/business-date`) に回す。
1037
- * リアルタイム更新の初動がこの分だけ遅れるが、その間の状態はストリーム / SWR が担保する。
1038
- */
1039
384
  declare const SSE_INITIAL_CONNECT_DEFER_MS = 1000;
1040
385
  declare const DEFAULT_ITEM_HEIGHT = 160;
1041
386
  declare const ITEM_VERTICAL_PADDING = 6;
@@ -1050,49 +395,9 @@ declare const WHEEL_RESET_TIMEOUT_MS = 240;
1050
395
  declare const VIRTUAL_SCROLL_OVERSCAN_COUNT = 15;
1051
396
  declare const SCROLL_BAR_WIDTH = 8;
1052
397
  declare const MAX_PREVIEW_LINES = 3;
1053
- /**
1054
- * Tap-scroll circle tuning shared by every daily-report list.
1055
- * 日報のすべての一覧が共有するタップスクロールサークルの調整値。
1056
- *
1057
- * ❗ **List タブと DetailList タブで同じ値を使うこと。** 片方だけ独自定義にすると、
1058
- * 同じ指の位置でタブごとに速度が何十倍も違う (実測で最大 77 倍) という事故になる。
1059
- *
1060
- * 値の根拠 (ビューポート 800px で実測):
1061
- *
1062
- * | 引き距離 | 速度 | List (行 160px) |
1063
- * | --- | --- | --- |
1064
- * | 0 | 160 px/s | 1 行/秒 |
1065
- * | 1/4 | 525 px/s | 3.3 行/秒 |
1066
- * | 1/2 | 1,298 px/s | 8 行/秒 |
1067
- * | 最大 | 6,400 px/s | 40 行/秒 (0.67 行/フレーム) |
1068
- *
1069
- * - `exponentialSteepness: 3` — 引き幅の前半をゆっくりにして微速の分解能を確保する。
1070
- * 大きくしすぎると低速域が最小速度へ張り付いて**引いても動かない死角**になる
1071
- * (旧値 7.5 では引き幅の 43.85% が死角だった)。
1072
- * - `exponentialScale: 8` — 最高速の上限 (ビューポート比)。`maxSpeedMultiplier` と揃えて
1073
- * 上限がどちらで決まるかを一意にする。1 フレームあたりの移動をオーバースキャン
1074
- * (`VIRTUAL_SCROLL_OVERSCAN_COUNT`) の行数より十分小さく保つ値にすること。
1075
- * - `easedOffset` は使わない。最小速度 160 px/s で十分に遅く、下駄を履かせると
1076
- * 低速域の分解能がその分だけ失われる。
1077
- *
1078
- * 長距離の移動はタップスクロールではなくスクロールバーのつまみ (と
1079
- * `BusinessDayThumbOverlay` の日付表示) が担う。ここを速くして解こうとしない。
1080
- */
1081
398
  declare const TAP_SCROLL_CIRCLE_OPTIONS: ScrollBarTapCircleOptions;
1082
- /**
1083
- * Pointer types allowed to drag-scroll the list content.
1084
- * 一覧のコンテンツ領域をドラッグしてスクロールできるポインタ種別。
1085
- *
1086
- * ❗ **`enablePointerDrag` を丸ごと切ってはならない。** `ScrollPane` はコンテンツを
1087
- * transform で動かしておりネイティブのスクロール領域を持たない
1088
- * (`.aqvs-scroll-pane-content` は `overflow: hidden`) ため、切るとタッチ端末から
1089
- * スクロール手段が消える (一度そうしてしまい、モバイルで一切スクロールできなくなった)。
1090
- *
1091
- * マウスのドラッグだけを外す。行のタップ判定 (`useTapClick`) ・テキスト選択と競合するため。
1092
- * 画面幅のメディアクエリで切り替える案は採らなかった。画面幅は入力手段を表さないので
1093
- * 「主入力がマウスのタッチ対応ノート」のような端末を取りこぼす。判定は**イベントの
1094
- * ポインタ種別**で行うため、同一端末でマウスと指を使い分けても常に正しく振る舞う。
1095
- */
1096
- declare const CONTENT_DRAG_POINTER_INPUTS: readonly ["pen", "touch"];
1097
-
399
+ declare const CONTENT_DRAG_POINTER_INPUTS: readonly [
400
+ "pen",
401
+ "touch"
402
+ ];
1098
403
  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, 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, DailyReportPostedComment, 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 };