@keepkit/ui 0.22.0 → 0.23.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 CHANGED
@@ -93,13 +93,18 @@ const onFeedback = useKeepToastFeedback(toast);
93
93
  <KeepKitProvider storage={storage} onFeedback={onFeedback}>{children}</KeepKitProvider>;
94
94
  ```
95
95
 
96
- v0.22.0では保存直後の`KeepSavePopover`自動編集、`KeepQuickEditorState.saveStatus`、`KeepItemCard.Save` / `KeepItemCard.Remove`、管理モード向け`KeepBulkActions`、通知からのコレクション再訪導線を追加しました。`KeepTourBar` / `KeepNavigator`、`KeepReorderableList`、`useKeepTourShortcuts`、16言語の`locale`/`labels`上書きも引き続き利用できます。
96
+ v0.23.0ではTailwind CSS v4との統合、ホストテーマ変数との衝突回避、CSS cascade layer対応を追加しました。保存直後の`KeepSavePopover`自動編集、`KeepQuickEditorState.saveStatus`、`KeepItemCard.Save` / `KeepItemCard.Remove`、管理モード向け`KeepBulkActions`、通知からのコレクション再訪導線も引き続き利用できます。
97
97
  Phase 4の状態UIとして`KeepItemStatusBadge`、`KeepStaleNotice`、`KeepPruneStaleButton`、`KeepSyncStatusBanner`、`KeepSyncRecoveryDialog`を利用できます。`import "@keepkit/ui/theme.css"`でテーマCSSを有効にできます。
98
98
 
99
99
  ### Tailwind/shadcnテーマ
100
100
 
101
+ ```css
102
+ /* globals.css */
103
+ @import "tailwindcss";
104
+ @import "@keepkit/ui/tailwind.css";
105
+ ```
106
+
101
107
  ```tsx
102
- import "@keepkit/ui/tailwind.css";
103
108
  import { KeepThemeProvider, KeepCollection } from "@keepkit/ui";
104
109
 
105
110
  <KeepThemeProvider theme="ocean" mode="system" density="comfortable" radius="medium">
@@ -109,7 +114,7 @@ import { KeepThemeProvider, KeepCollection } from "@keepkit/ui";
109
114
 
110
115
  色テーマは`default`、`ocean`、`forest`、`sunset`、`lavender`から選べます。既存の`compact`、`minimal`、`rounded`、`high-contrast`、`dark`も引き続き利用できます。`theme`は`mode`、`density`、`radius`と独立しており、`KeepKitProvider theme="forest" mode="dark"`のように組み合わせられます。選択肢をUIへ表示する場合は`keepThemeNames`を利用できます。
111
116
 
112
- shadcn/uiの`--background`、`--foreground`、`--card`、`--muted`、`--border`、`--primary`、`--destructive`、`--ring`を継承し、KeepKit固有の値は`--keep-*`に分離されます。`variables`、`accentColor`、`highContrast`、`reducedMotion`による上書きも維持されます。`keepKitTheme`は`@keepkit/ui/tailwind`から、分割CSSは`@keepkit/ui/styles/base.css`、`button.css`、`collection.css`、`sync.css`から読み込めます。`KeepButton icons={{ save, saved, remove }}`と`iconOnly`でLucide等へ差し替えられます。
117
+ Tailwind v4の`--color-background`、`--color-foreground`、`--color-card`、`--color-muted`、`--color-border`、`--color-primary`、`--color-destructive`、`--color-ring`をKeepKitのスコープ内へ継承します。KeepKitはホストの`--color-*`変数を上書きせず、`--color-keep-*`としてTailwindへ公開します。`variables`、`accentColor`、`highContrast`、`reducedMotion`による上書きも維持されます。`keepKitTheme`は`@keepkit/ui/tailwind`から、分割CSSは`@keepkit/ui/styles/base.css`、`button.css`、`collection.css`、`sync.css`から読み込めます。`KeepButton icons={{ save, saved, remove }}`と`iconOnly`でLucide等へ差し替えられます。
113
118
 
114
119
  Viewer向け保存カードとカスタムテーマは次のように構成できます。`savedAt`、タイトル、タグ、詳細リンク、保存解除ボタン、期限切れ表示は`KeepItemCard`の標準markupに含まれます。
115
120
 
@@ -212,13 +217,18 @@ const onFeedback = useKeepToastFeedback(toast);
212
217
  <KeepKitProvider storage={storage} onFeedback={onFeedback}>{children}</KeepKitProvider>;
213
218
  ```
214
219
 
215
- In v0.22.0, `KeepSavePopover` supports post-save editing, `KeepQuickEditorState.saveStatus`, `KeepItemCard.Save` / `KeepItemCard.Remove`, management-mode `KeepBulkActions`, and notification-driven return to the collection. `KeepTourBar` / `KeepNavigator`, `KeepReorderableList`, `useKeepTourShortcuts`, 16 built-in locales, and `labels` overrides remain available.
220
+ In v0.23.0, Tailwind CSS v4 integration, host-theme isolation, and cascade-layer support are included. `KeepSavePopover` post-save editing, `KeepQuickEditorState.saveStatus`, `KeepItemCard.Save` / `KeepItemCard.Remove`, management-mode `KeepBulkActions`, and notification-driven return to the collection remain available.
216
221
  Phase 4 adds `KeepItemStatusBadge`, `KeepStaleNotice`, `KeepPruneStaleButton`, `KeepSyncStatusBanner`, and `KeepSyncRecoveryDialog` for unavailable items, sync failures, conflict resolution, and backup recovery. Import `@keepkit/ui/theme.css` or `@keepkit/ui/tailwind.css` for the opt-in theme layer.
217
222
 
218
223
  ### Tailwind and shadcn theme
219
224
 
225
+ ```css
226
+ /* globals.css */
227
+ @import "tailwindcss";
228
+ @import "@keepkit/ui/tailwind.css";
229
+ ```
230
+
220
231
  ```tsx
221
- import "@keepkit/ui/tailwind.css";
222
232
  import { KeepThemeProvider, KeepCollection } from "@keepkit/ui";
223
233
 
224
234
  <KeepThemeProvider theme="ocean" mode="system" density="comfortable" radius="medium">
@@ -228,7 +238,7 @@ import { KeepThemeProvider, KeepCollection } from "@keepkit/ui";
228
238
 
229
239
  Color themes include `default`, `ocean`, `forest`, `sunset`, and `lavender`. Existing `compact`, `minimal`, `rounded`, `high-contrast`, and `dark` presets remain available. `theme` composes independently with `mode`, `density`, and `radius`, so `theme="forest" mode="dark"` is supported. Use the exported `keepThemeNames` list when building a selector.
230
240
 
231
- The scoped `--keep-*` tokens inherit shadcn/ui variables, and the provider supports `.dark`, system preference, `variables`, `accentColor`, `highContrast`, and `reducedMotion`. Use `keepKitTheme` from `@keepkit/ui/tailwind`, feature CSS from `@keepkit/ui/styles/*`, and `icons={{ save, saved, remove }}` / `iconOnly` on `KeepButton` for Lucide or shadcn replacements. The existing Next.js Pages Router recipe remains unchanged: inject `createNextPagesRouterAdapter(router)` into `urlAdapter`.
241
+ The scoped `--keep-*` tokens inherit complete Tailwind v4 `--color-*` values from shadcn/ui when present. KeepKit does not replace the host's generic color aliases; its Tailwind aliases are namespaced as `--color-keep-*`. The provider supports `.dark`, system preference, `variables`, `accentColor`, `highContrast`, and `reducedMotion`. Use `keepKitTheme` from `@keepkit/ui/tailwind`, feature CSS from `@keepkit/ui/styles/*`, and `icons={{ save, saved, remove }}` / `iconOnly` on `KeepButton` for Lucide or shadcn replacements. The existing Next.js Pages Router recipe remains unchanged: inject `createNextPagesRouterAdapter(router)` into `urlAdapter`.
232
242
 
233
243
  For a Viewer card, the default `KeepItemCard` markup includes the title, tags, saved date, detail link, remove action, thumbnail, and expired-item notice. Override tokens without replacing the markup, or use render props for a complete replacement:
234
244
 
package/dist/tailwind.css CHANGED
@@ -1,24 +1,49 @@
1
- @import "./theme.css";
1
+ @import "./theme.css" layer(components);
2
2
 
3
+ /*
4
+ * Tailwind v4 exposes semantic colors as complete values through --color-*.
5
+ * Bridge those values into the scoped KeepKit tokens without replacing the
6
+ * host application's generic --color-background / --color-primary aliases.
7
+ * The explicit fallbacks also keep a plain Tailwind installation usable when
8
+ * no shadcn semantic colors are configured.
9
+ */
3
10
  @custom-variant dark (&:where(.dark, .dark *));
4
11
 
12
+ @layer components {
13
+ :where(.keep-theme, [data-keep-theme]) {
14
+ --keep-background: var(--color-background, #ffffff);
15
+ --keep-foreground: var(--color-foreground, #0f172a);
16
+ --keep-card: var(--color-card, var(--color-background, #ffffff));
17
+ --keep-card-foreground: var(--color-card-foreground, var(--color-foreground, #0f172a));
18
+ --keep-muted: var(--color-muted, #f1f5f9);
19
+ --keep-muted-foreground: var(--color-muted-foreground, #64748b);
20
+ --keep-border: var(--color-border, #d7dee8);
21
+ --keep-input: var(--color-input, var(--color-border, #d7dee8));
22
+ --keep-primary: var(--color-primary, #2563eb);
23
+ --keep-primary-foreground: var(--color-primary-foreground, #ffffff);
24
+ --keep-destructive: var(--color-destructive, #b91c1c);
25
+ --keep-destructive-foreground: var(--color-destructive-foreground, #ffffff);
26
+ --keep-ring: var(--color-ring, var(--color-primary, #2563eb));
27
+ }
28
+ }
29
+
5
30
  @theme inline {
6
- --color-background: var(--keep-background);
7
- --color-foreground: var(--keep-foreground);
8
- --color-card: var(--keep-card);
9
- --color-card-foreground: var(--keep-card-foreground);
10
- --color-muted: var(--keep-muted);
11
- --color-muted-foreground: var(--keep-muted-foreground);
12
- --color-border: var(--keep-border);
13
- --color-input: var(--keep-input);
14
- --color-primary: var(--keep-primary);
15
- --color-primary-foreground: var(--keep-primary-foreground);
16
- --color-destructive: var(--keep-destructive);
17
- --color-destructive-foreground: var(--keep-destructive-foreground);
18
- --color-success: var(--keep-success);
19
- --color-warning: var(--keep-warning);
20
- --color-ring: var(--keep-ring);
21
- --radius-sm: calc(var(--keep-radius) - 4px);
22
- --radius-md: calc(var(--keep-radius) - 2px);
23
- --radius-lg: var(--keep-radius);
31
+ --color-keep-background: var(--keep-background);
32
+ --color-keep-foreground: var(--keep-foreground);
33
+ --color-keep-card: var(--keep-card);
34
+ --color-keep-card-foreground: var(--keep-card-foreground);
35
+ --color-keep-muted: var(--keep-muted);
36
+ --color-keep-muted-foreground: var(--keep-muted-foreground);
37
+ --color-keep-border: var(--keep-border);
38
+ --color-keep-input: var(--keep-input);
39
+ --color-keep-primary: var(--keep-primary);
40
+ --color-keep-primary-foreground: var(--keep-primary-foreground);
41
+ --color-keep-destructive: var(--keep-destructive);
42
+ --color-keep-destructive-foreground: var(--keep-destructive-foreground);
43
+ --color-keep-success: var(--keep-success);
44
+ --color-keep-warning: var(--keep-warning);
45
+ --color-keep-ring: var(--keep-ring);
46
+ --radius-keep-sm: calc(var(--keep-radius) - 4px);
47
+ --radius-keep-md: calc(var(--keep-radius) - 2px);
48
+ --radius-keep-lg: var(--keep-radius);
24
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keepkit/ui",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "Headless, accessible React UI components for KeepKit.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -57,7 +57,7 @@
57
57
  "react": ">=18"
58
58
  },
59
59
  "dependencies": {
60
- "@keepkit/core": "0.22.0"
60
+ "@keepkit/core": "0.23.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@testing-library/react": "^16.3.3",