@aiquants/daily-report 0.3.1 → 0.4.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.
Files changed (36) hide show
  1. package/README.md +24 -22
  2. package/dist/client.d.mts +3 -10
  3. package/dist/client.d.ts +3 -10
  4. package/dist/client.js +4 -4
  5. package/dist/client.js.map +1 -1
  6. package/dist/client.mjs +4 -4
  7. package/dist/client.mjs.map +1 -1
  8. package/dist/index.d.mts +2 -2
  9. package/dist/index.d.ts +2 -2
  10. package/dist/index.js +1 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.mjs +1 -1
  13. package/dist/index.mjs.map +1 -1
  14. package/dist/server.d.mts +1 -6
  15. package/dist/server.d.ts +1 -6
  16. package/dist/server.js +4 -4
  17. package/dist/server.js.map +1 -1
  18. package/dist/server.mjs +4 -4
  19. package/dist/server.mjs.map +1 -1
  20. package/dist/{sse-schema-DO9Qe8XF.d.ts → sse-schema-CK7cUnEo.d.ts} +1 -34
  21. package/dist/{sse-schema-DKUjXMW3.d.mts → sse-schema-yl5AaSsj.d.mts} +1 -34
  22. package/dist/styles/daily-report.standalone.css +3 -0
  23. package/dist/{types-DrjeK3_G.d.mts → types-CVhwLhSN.d.mts} +0 -1
  24. package/dist/{types-DrjeK3_G.d.ts → types-CVhwLhSN.d.ts} +0 -1
  25. package/package.json +21 -13
  26. package/src/client/components/daily-report-comment-item.tsx +4 -1
  27. package/src/client/components/daily-report-detail-list.tsx +16 -25
  28. package/src/client/components/daily-report-list.tsx +17 -24
  29. package/src/client/config-context.tsx +0 -9
  30. package/src/client/contexts/daily-report-action-context.tsx +0 -1
  31. package/src/server/cache.ts +0 -18
  32. package/src/server/service.ts +0 -2
  33. package/src/shared/sse-schema.ts +0 -1
  34. package/src/shared/types.ts +0 -1
  35. package/src/styles/standalone.entry.css +51 -0
  36. package/src/server/cache.spec.ts +0 -47
package/README.md CHANGED
@@ -29,14 +29,37 @@ pnpm add @aiquants/daily-report react react-dom react-router drizzle-orm zod
29
29
 
30
30
  ### Tailwind CSS
31
31
 
32
- Components carry Tailwind utility classes in JSX (no compiled CSS is shipped). Add the package source to your app's Tailwind scan targets:
32
+ This package has **no hand-written component CSS**, so it ships **no components-only artifact** only a standalone build for non-Tailwind hosts. Components carry Tailwind utility classes in JSX. Pick one consumption mode:
33
+
34
+ **Tailwind v4 host (required if your app builds Tailwind itself)** — add the package source to your app's scan targets so all utilities are generated in one canonical build, define the `dark:` variant, and map the shadcn tokens the components reference (`bg-background`, `text-muted-foreground`, ... do not exist in Tailwind's default theme, so those utilities are not generated unless the tokens are mapped):
33
35
 
34
36
  ```css
35
37
  /* app tailwind.css (Tailwind v4) */
36
38
  @source "../node_modules/@aiquants/daily-report/src/**/*.{ts,tsx}";
37
39
  /* monorepo: @source "../../../../packages/daily-report/src/**/*.{ts,tsx}"; */
40
+ @plugin "tailwindcss-animate";
41
+ @custom-variant dark (&:where(.dark, .dark *));
42
+ @theme inline {
43
+ --color-background: hsl(var(--background));
44
+ --color-muted-foreground: hsl(var(--muted-foreground));
45
+ /* map every shadcn token the components use; full set in src/styles/standalone.entry.css */
46
+ }
47
+ ```
48
+
49
+ The host must also:
50
+
51
+ - Load the `tailwindcss-animate` plugin. The components use `animate-in` / `fade-in` / `zoom-in-95` entrance animations; without `@plugin "tailwindcss-animate"` those classes are not generated and the animations silently no-op.
52
+ - Define the shadcn CSS variables themselves (`--background`, `--muted`, `--radius`, ...).
53
+ - Import the `@aiquants/virtualscroll` peer CSS once. Do NOT `@import` the standalone build alongside your own Tailwind build: it duplicates utilities your build also emits, and concatenated builds cannot reproduce the single-build canonical order (base utilities before variants), so base/variant winners flip regardless of `@layer` wrapping (e.g. a later duplicate `.flex` beats an earlier `.sm:hidden`).
54
+
55
+ **Non-Tailwind host** — import the single self-contained standalone build (`pnpm run build:css` → `dist/styles/daily-report.standalone.css`):
56
+
57
+ ```css
58
+ @import "@aiquants/daily-report/styles/daily-report.standalone.css";
38
59
  ```
39
60
 
61
+ The standalone build bundles every JSX utility (and maps the shadcn tokens), but **not** the shadcn variable values themselves and **not** the virtualscroll CSS. So the host must still: define the shadcn variables (`--background`, `--muted`, `--radius`, ...), toggle the `.dark` class on `<html>` for `dark:` variants, and import `@aiquants/virtualscroll/styles/virtualscroll.standalone.css` separately (kept out to avoid a stale embedded copy overriding the host's fresh one).
62
+
40
63
  ## Required database schema
41
64
 
42
65
  Six tables: `DailyReportHub` (中核・出所横断), `DailyReportInternal` (アプリ内作成本文), `DailyReportComment`, `DailyReportLabel`, `DailyReportHub_Label`, `DailyReportUserStatus` (既読・スター)。
@@ -134,27 +157,6 @@ export default function Route() {
134
157
 
135
158
  詳細/一覧カードの見出し (`id` / `businessDate` / `author` / `visitTime` / `createdAt` / `updatedAt` / `updatedBy` / `category` / `categoryInfo` / `creationCategory` / `customer` / `subject` / `content` / `interviewers` / `comments` / `tabArticle` / `tabRelations` / `relationsEmpty`) はすべて DI。**パッケージは中立な英語 (`Business date` / `Customer` / `Content` 等) のみを既定で同梱**し、各見出しの言語・表記は消費アプリが `fieldLabels` で上書きする。これによりパッケージ本体は業務ドメイン固有の表記を持たない。部分指定した分だけ既定へ上書きされる (`DailyReportConfigProvider` が 1 段深くマージ)。
136
159
 
137
- ### 外部ソースバッジ設定 (`sourceTypeConfigs`)
138
-
139
- 外部ソースから取り込まれた日報の表示 (ラベル名やバッジの CSS クラス) を `sourceTypeConfigs` で上書き設定できます。これにより、パッケージ自身は特定の外部サービス ( NI 日報や Kintone など) の名前やデザインに依存せず、ホストアプリケーションから柔軟に表示をカスタマイズできます。
140
-
141
- ```tsx
142
- sourceTypeConfigs: {
143
- Internal: {
144
- label: "オリジナル",
145
- badgeClassName: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",
146
- },
147
- NI: {
148
- label: "NI 日報",
149
- badgeClassName: "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400",
150
- },
151
- Kintone: {
152
- label: "Kintone",
153
- badgeClassName: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400",
154
- },
155
- }
156
- ```
157
-
158
160
  ## Realtime architecture
159
161
 
160
162
  1. 変更系サービスは `invalidate → epoch increment → SSE publish` の順で Redis Stream (`daily-report:sse-stream`) へ発行。
package/dist/client.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, Context, RefObject } from 'react';
3
3
  import { ScrollBarThumbOverlayRenderProps, ScrollPaneInertiaOptions, ScrollBarTapCircleOptions } from '@aiquants/virtualscroll';
4
- import { U as UIComment, D as DailyReportSseMessage } from './sse-schema-DKUjXMW3.mjs';
5
- import { D as DailyReportItem, a as DailyReportDetail, b as DailyReportUser } from './types-DrjeK3_G.mjs';
4
+ import { U as UIComment, D as DailyReportSseMessage } from './sse-schema-yl5AaSsj.mjs';
5
+ import { D as DailyReportItem, a as DailyReportDetail, b as DailyReportUser } from './types-CVhwLhSN.mjs';
6
6
  import { ShouldRevalidateFunction } from 'react-router';
7
7
  import 'zod';
8
8
 
@@ -122,10 +122,6 @@ type DailyReportFieldLabels = {
122
122
  tabRelations: string;
123
123
  relationsEmpty: string;
124
124
  };
125
- type SourceTypeConfig = {
126
- label: string;
127
- badgeClassName?: string;
128
- };
129
125
  /** クライアント層の設定一式。 */
130
126
  type DailyReportClientConfig = {
131
127
  /** 画面タイトル (ヘッダーへ渡す)。 */
@@ -138,8 +134,6 @@ type DailyReportClientConfig = {
138
134
  draftLabelName: string;
139
135
  /** 詳細/一覧カードのフィールド見出しラベル。既定は中立英語。アプリが自ドメインの表記を注入する。 */
140
136
  fieldLabels: DailyReportFieldLabels;
141
- /** 外部ソース区分ごとのバッジ表示設定。 */
142
- sourceTypeConfigs?: Record<string, SourceTypeConfig>;
143
137
  /** ヘッダー描画スロット。アプリのヘッダーコンポーネントを差し込む。 */
144
138
  renderHeader: (props: DailyReportHeaderProps) => ReactNode;
145
139
  /** 開発向けコントロール (SSE 購読トグル等) を表示するか。 */
@@ -151,7 +145,6 @@ type DailyReportClientConfig = {
151
145
  */
152
146
  type DailyReportClientConfigInput = Partial<Omit<DailyReportClientConfig, "fieldLabels">> & {
153
147
  fieldLabels?: Partial<DailyReportFieldLabels>;
154
- sourceTypeConfigs?: Record<string, SourceTypeConfig>;
155
148
  };
156
149
  /** 中立英語のフィールドラベル既定 (ドメイン非依存)。 */
157
150
  declare const defaultDailyReportFieldLabels: DailyReportFieldLabels;
@@ -453,4 +446,4 @@ declare const SCROLL_BAR_WIDTH = 8;
453
446
  declare const MAX_PREVIEW_LINES = 3;
454
447
  declare const TAP_SCROLL_CIRCLE_OPTIONS: ScrollBarTapCircleOptions;
455
448
 
456
- export { BusinessDayThumbOverlay, DAILY_REPORT_FETCH_DEBOUNCE_MS, DEFAULT_ITEM_HEIGHT, DailyReportActionProvider, type DailyReportClientConfig, type DailyReportClientConfigInput, DailyReportCommentForm, DailyReportCommentItem, DailyReportCommentList, DailyReportConfigProvider, DailyReportDetailList, type DailyReportDetailResource, DailyReportEditForm, type DailyReportFieldLabels, type DailyReportHeaderProps, 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, type SourceTypeConfig, TAP_SCROLL_CIRCLE_OPTIONS, UnreadIndicator, VIRTUAL_SCROLL_OVERSCAN_COUNT, WHEEL_RESET_TIMEOUT_MS, acquireMutationLock, applyDailyReportServerUpdates, createDailyReportClientLoader, dailyReportShouldRevalidate, defaultDailyReportClientConfig, defaultDailyReportFieldLabels, deleteDailyReportCache, fetchDailyReportIds, getCachedReport, registerRecentDeletion, releaseMutationLock, subscribeCacheReady, updateDailyReportCache, useDailyReportActionContext, useDailyReportComments, useDailyReportConfig, useDailyReportDetail, useDailyReportPrefetch, useDailyReportSseConnection, useDynamicViewportHeight, writeCache };
449
+ export { BusinessDayThumbOverlay, DAILY_REPORT_FETCH_DEBOUNCE_MS, DEFAULT_ITEM_HEIGHT, DailyReportActionProvider, type DailyReportClientConfig, type DailyReportClientConfigInput, DailyReportCommentForm, DailyReportCommentItem, DailyReportCommentList, DailyReportConfigProvider, DailyReportDetailList, type DailyReportDetailResource, DailyReportEditForm, type DailyReportFieldLabels, type DailyReportHeaderProps, 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, TAP_SCROLL_CIRCLE_OPTIONS, UnreadIndicator, VIRTUAL_SCROLL_OVERSCAN_COUNT, WHEEL_RESET_TIMEOUT_MS, acquireMutationLock, applyDailyReportServerUpdates, createDailyReportClientLoader, dailyReportShouldRevalidate, defaultDailyReportClientConfig, defaultDailyReportFieldLabels, deleteDailyReportCache, fetchDailyReportIds, getCachedReport, registerRecentDeletion, releaseMutationLock, subscribeCacheReady, updateDailyReportCache, useDailyReportActionContext, useDailyReportComments, useDailyReportConfig, useDailyReportDetail, useDailyReportPrefetch, useDailyReportSseConnection, useDynamicViewportHeight, writeCache };
package/dist/client.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, Context, RefObject } from 'react';
3
3
  import { ScrollBarThumbOverlayRenderProps, ScrollPaneInertiaOptions, ScrollBarTapCircleOptions } from '@aiquants/virtualscroll';
4
- import { U as UIComment, D as DailyReportSseMessage } from './sse-schema-DO9Qe8XF.js';
5
- import { D as DailyReportItem, a as DailyReportDetail, b as DailyReportUser } from './types-DrjeK3_G.js';
4
+ import { U as UIComment, D as DailyReportSseMessage } from './sse-schema-CK7cUnEo.js';
5
+ import { D as DailyReportItem, a as DailyReportDetail, b as DailyReportUser } from './types-CVhwLhSN.js';
6
6
  import { ShouldRevalidateFunction } from 'react-router';
7
7
  import 'zod';
8
8
 
@@ -122,10 +122,6 @@ type DailyReportFieldLabels = {
122
122
  tabRelations: string;
123
123
  relationsEmpty: string;
124
124
  };
125
- type SourceTypeConfig = {
126
- label: string;
127
- badgeClassName?: string;
128
- };
129
125
  /** クライアント層の設定一式。 */
130
126
  type DailyReportClientConfig = {
131
127
  /** 画面タイトル (ヘッダーへ渡す)。 */
@@ -138,8 +134,6 @@ type DailyReportClientConfig = {
138
134
  draftLabelName: string;
139
135
  /** 詳細/一覧カードのフィールド見出しラベル。既定は中立英語。アプリが自ドメインの表記を注入する。 */
140
136
  fieldLabels: DailyReportFieldLabels;
141
- /** 外部ソース区分ごとのバッジ表示設定。 */
142
- sourceTypeConfigs?: Record<string, SourceTypeConfig>;
143
137
  /** ヘッダー描画スロット。アプリのヘッダーコンポーネントを差し込む。 */
144
138
  renderHeader: (props: DailyReportHeaderProps) => ReactNode;
145
139
  /** 開発向けコントロール (SSE 購読トグル等) を表示するか。 */
@@ -151,7 +145,6 @@ type DailyReportClientConfig = {
151
145
  */
152
146
  type DailyReportClientConfigInput = Partial<Omit<DailyReportClientConfig, "fieldLabels">> & {
153
147
  fieldLabels?: Partial<DailyReportFieldLabels>;
154
- sourceTypeConfigs?: Record<string, SourceTypeConfig>;
155
148
  };
156
149
  /** 中立英語のフィールドラベル既定 (ドメイン非依存)。 */
157
150
  declare const defaultDailyReportFieldLabels: DailyReportFieldLabels;
@@ -453,4 +446,4 @@ declare const SCROLL_BAR_WIDTH = 8;
453
446
  declare const MAX_PREVIEW_LINES = 3;
454
447
  declare const TAP_SCROLL_CIRCLE_OPTIONS: ScrollBarTapCircleOptions;
455
448
 
456
- export { BusinessDayThumbOverlay, DAILY_REPORT_FETCH_DEBOUNCE_MS, DEFAULT_ITEM_HEIGHT, DailyReportActionProvider, type DailyReportClientConfig, type DailyReportClientConfigInput, DailyReportCommentForm, DailyReportCommentItem, DailyReportCommentList, DailyReportConfigProvider, DailyReportDetailList, type DailyReportDetailResource, DailyReportEditForm, type DailyReportFieldLabels, type DailyReportHeaderProps, 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, type SourceTypeConfig, TAP_SCROLL_CIRCLE_OPTIONS, UnreadIndicator, VIRTUAL_SCROLL_OVERSCAN_COUNT, WHEEL_RESET_TIMEOUT_MS, acquireMutationLock, applyDailyReportServerUpdates, createDailyReportClientLoader, dailyReportShouldRevalidate, defaultDailyReportClientConfig, defaultDailyReportFieldLabels, deleteDailyReportCache, fetchDailyReportIds, getCachedReport, registerRecentDeletion, releaseMutationLock, subscribeCacheReady, updateDailyReportCache, useDailyReportActionContext, useDailyReportComments, useDailyReportConfig, useDailyReportDetail, useDailyReportPrefetch, useDailyReportSseConnection, useDynamicViewportHeight, writeCache };
449
+ export { BusinessDayThumbOverlay, DAILY_REPORT_FETCH_DEBOUNCE_MS, DEFAULT_ITEM_HEIGHT, DailyReportActionProvider, type DailyReportClientConfig, type DailyReportClientConfigInput, DailyReportCommentForm, DailyReportCommentItem, DailyReportCommentList, DailyReportConfigProvider, DailyReportDetailList, type DailyReportDetailResource, DailyReportEditForm, type DailyReportFieldLabels, type DailyReportHeaderProps, 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, TAP_SCROLL_CIRCLE_OPTIONS, UnreadIndicator, VIRTUAL_SCROLL_OVERSCAN_COUNT, WHEEL_RESET_TIMEOUT_MS, acquireMutationLock, applyDailyReportServerUpdates, createDailyReportClientLoader, dailyReportShouldRevalidate, defaultDailyReportClientConfig, defaultDailyReportFieldLabels, deleteDailyReportCache, fetchDailyReportIds, getCachedReport, registerRecentDeletion, releaseMutationLock, subscribeCacheReady, updateDailyReportCache, useDailyReportActionContext, useDailyReportComments, useDailyReportConfig, useDailyReportDetail, useDailyReportPrefetch, useDailyReportSseConnection, useDynamicViewportHeight, writeCache };