haru-cat 0.0.1 → 0.0.3

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/CHANGELOG.md ADDED
@@ -0,0 +1,46 @@
1
+ # Changelog
2
+
3
+ This file records notable changes to Haru Cat. It is maintained manually and
4
+ organized by release.
5
+
6
+ ## 0.0.3 — 2026-07-26
7
+
8
+ ### Added
9
+
10
+ - Add a `visible` prop for controlling whether Haru-kun is shown.
11
+ - Add a `fadeDuration` prop for customizing visibility transitions.
12
+ - Add controls to the development playground for checking visibility and fade
13
+ duration.
14
+
15
+ ### Changed
16
+
17
+ - Respect the user's reduced-motion preference by disabling visibility fades.
18
+ - Mark the package as a Client Component for React Server Components
19
+ environments.
20
+ - Fall back safely when the environment does not provide `matchMedia`.
21
+
22
+ ## 0.0.2 — 2026-07-26
23
+
24
+ ### Added
25
+
26
+ - Add `offsetX` and `offsetY` props for independent horizontal and vertical
27
+ spacing.
28
+ - Add a `responsive` prop for controlling automatic sizing on smaller screens.
29
+ - Add controls to the development playground for checking size, offsets, and
30
+ responsive behavior.
31
+
32
+ ### Changed
33
+
34
+ - Enable responsive sizing by default, including for existing usage. On smaller
35
+ screens, the image is limited to 30% of the viewport's shorter side. Set
36
+ `responsive={false}` to preserve the exact `size`.
37
+ - Account for viewport safe-area insets when positioning Haru-kun.
38
+
39
+ ## 0.0.1 — 2026-07-23
40
+
41
+ ### Added
42
+
43
+ - Publish the initial Haru Cat npm package.
44
+ - Add the static `HaruCat` React component and Haru-kun artwork.
45
+ - Support bottom placement, size, offset, z-index, and custom class names.
46
+ - Include TypeScript types and ESM and CommonJS builds.
package/README.ja.md CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  Haru Catは、小さなオリジナルキャラクター「ハルくん」をWebサイトの下部に表示するためのReactコンポーネントです。
4
4
 
5
- 最初のリリースでは静止画像を表示します。
6
- アニメーションや新しい振る舞いは、今後のバージョンで追加する予定です。
5
+ 現在のHaru Catは静止画像を表示します。
6
+ アニメーションはまだ含まれていません。
7
7
 
8
8
  [English](./README.md)
9
9
 
@@ -38,18 +38,55 @@ export default function App() {
38
38
  <HaruCat position="bottom-center" />
39
39
  ```
40
40
 
41
+ 横方向と縦方向で異なる余白を指定する場合は、`offsetX`と`offsetY`を使用します。
42
+
43
+ ```tsx
44
+ <HaruCat offset={16} offsetX={32} offsetY={24} />
45
+ ```
46
+
47
+ `offsetX`と`offsetY`は、それぞれの方向で`offset`より優先されます。
48
+ `bottom-center`では、横方向の余白は適用されません。
49
+
50
+ `visible`を使用すると、ハルくんの表示と非表示を切り替えられます。
51
+ `visible`の値を切り替えると、初期設定では300ミリ秒かけてフェードイン・フェードアウトします。
52
+
53
+ ```tsx
54
+ <HaruCat visible={isVisible} />
55
+ ```
56
+
57
+ フェード時間を変更する場合は、`fadeDuration`へミリ秒単位で指定します。
58
+ `0`を指定すると、フェードせず即座に切り替わります。
59
+
60
+ ```tsx
61
+ <HaruCat visible={isVisible} fadeDuration={500} />
62
+ ```
63
+
64
+ フェードは`visible`の値が変更されたときに適用されます。
65
+ `<HaruCat />`は初回レンダー時から表示されるため、ページ読み込み時のフェードインは行いません。
66
+
41
67
  ## Props
42
68
 
43
69
  | Prop | 型 | 初期値 | 説明 |
44
70
  | --- | --- | --- | --- |
45
71
  | `position` | `'bottom-left' \| 'bottom-center' \| 'bottom-right'` | `'bottom-right'` | 画面下部での表示位置です。 |
46
- | `size` | `number` | `120` | 画像の幅と高さをピクセル単位で指定します。 |
72
+ | `size` | `number` | `120` | 画像の基準となる幅と高さをピクセル単位で指定します。 |
47
73
  | `offset` | `number` | `16` | 画面下端、および左右配置の場合は画面の端からの距離をピクセル単位で指定します。 |
74
+ | `offsetX` | `number` | `undefined` | 左端または右端からの距離です。横方向では`offset`より優先されます。 |
75
+ | `offsetY` | `number` | `undefined` | 画面下端からの距離です。縦方向では`offset`より優先されます。 |
76
+ | `responsive` | `boolean` | `true` | 小さい画面で、画像の大きさを画面の短い辺の30%以下に調整します。 |
77
+ | `visible` | `boolean` | `true` | ハルくんを表示するかどうかを指定します。 |
78
+ | `fadeDuration` | `number` | `300` | フェードイン・フェードアウトの時間をミリ秒単位で指定します。`0`未満の値は`0`として扱われます。 |
48
79
  | `zIndex` | `number` | `9999` | コンポーネントのCSS `z-index`です。 |
49
80
  | `className` | `string` | `undefined` | 外側の要素に設定するクラス名です。 |
50
81
 
51
82
  コンポーネントには`position: fixed`と`pointer-events: none`が設定されています。
52
83
  そのため、ハルくんは画面下部に表示され続け、Webサイト上のボタンやリンク操作を妨げません。
84
+ 利用するWebサイトで`viewport-fit=cover`が設定されている場合、Haru Catはブラウザが提供するセーフエリアの余白を自動的に画面端からの余白へ加算します。
85
+
86
+ 小さい画面でも`size`を正確なピクセル値として使用したい場合は、`responsive={false}`を指定してください。
87
+
88
+ Haru Catは、利用者の`prefers-reduced-motion`設定に対応しています。
89
+ 動きを減らす設定が有効な場合、表示と非表示はフェードせず即座に切り替わります。
53
90
 
54
91
  ## TypeScript
55
92
 
@@ -74,6 +111,7 @@ npm run build
74
111
  npm pack --dry-run
75
112
  ```
76
113
 
114
+ バージョンごとの変更内容は[CHANGELOG](./CHANGELOG.md)に記録しています。
77
115
  プロジェクトの方針と今後の計画は、[Design Notes](https://github.com/Colorful12/haru-cat/blob/main/docs/design-notes.md)にまとめています。
78
116
 
79
117
  ## 制作者
package/README.md CHANGED
@@ -3,8 +3,7 @@
3
3
  Haru Cat is a React component for placing Haru-kun, a small original cat
4
4
  character, at the bottom of your website.
5
5
 
6
- This first release displays a static image. Animations and additional behaviors
7
- are planned for future versions.
6
+ Haru Cat currently displays a static image. Animation is not included yet.
8
7
 
9
8
  [日本語](./README.ja.md)
10
9
 
@@ -39,18 +38,58 @@ You can also place Haru-kun at the bottom-left or bottom-center of the viewport.
39
38
  <HaruCat position="bottom-center" />
40
39
  ```
41
40
 
41
+ Use `offsetX` and `offsetY` when the horizontal and vertical spacing should be
42
+ different.
43
+
44
+ ```tsx
45
+ <HaruCat offset={16} offsetX={32} offsetY={24} />
46
+ ```
47
+
48
+ `offsetX` and `offsetY` override `offset` on their respective axes. The
49
+ horizontal offset does not apply to `bottom-center`.
50
+
51
+ Use `visible` to show or hide Haru-kun. Changes fade over 300 milliseconds by
52
+ default.
53
+
54
+ ```tsx
55
+ <HaruCat visible={isVisible} />
56
+ ```
57
+
58
+ Customize the fade duration in milliseconds with `fadeDuration`. Set it to `0`
59
+ for an immediate change.
60
+
61
+ ```tsx
62
+ <HaruCat visible={isVisible} fadeDuration={500} />
63
+ ```
64
+
65
+ The fade applies when `visible` changes. `<HaruCat />` is shown immediately on
66
+ its initial render.
67
+
42
68
  ## Props
43
69
 
44
70
  | Prop | Type | Default | Description |
45
71
  | --- | --- | --- | --- |
46
72
  | `position` | `'bottom-left' \| 'bottom-center' \| 'bottom-right'` | `'bottom-right'` | Position along the bottom of the viewport. |
47
- | `size` | `number` | `120` | Width and height of the image in pixels. |
73
+ | `size` | `number` | `120` | Preferred width and height of the image in pixels. |
48
74
  | `offset` | `number` | `16` | Distance from the bottom and, when applicable, the left or right edge in pixels. |
75
+ | `offsetX` | `number` | `undefined` | Left or right distance in pixels. Overrides `offset` on the horizontal axis. |
76
+ | `offsetY` | `number` | `undefined` | Bottom distance in pixels. Overrides `offset` on the vertical axis. |
77
+ | `responsive` | `boolean` | `true` | Limits the image to 30% of the viewport's shorter side on smaller screens. |
78
+ | `visible` | `boolean` | `true` | Whether Haru-kun is shown. |
79
+ | `fadeDuration` | `number` | `300` | Fade-in and fade-out duration in milliseconds. Values below `0` are treated as `0`. |
49
80
  | `zIndex` | `number` | `9999` | CSS `z-index` of the component. |
50
81
  | `className` | `string` | `undefined` | Class name applied to the wrapper element. |
51
82
 
52
83
  The component uses `position: fixed` and `pointer-events: none`, so Haru-kun
53
84
  stays at the bottom of the viewport without blocking buttons or links.
85
+ When the host website uses `viewport-fit=cover`, Haru Cat automatically adds
86
+ the safe-area insets provided by the browser to the configured edge offsets.
87
+
88
+ Set `responsive={false}` when `size` must remain an exact pixel size on small
89
+ screens.
90
+
91
+ Haru Cat respects the user's `prefers-reduced-motion` setting. When reduced
92
+ motion is requested, visibility changes happen immediately instead of fading.
54
93
 
55
94
  ## TypeScript
56
95
 
@@ -75,7 +114,8 @@ npm run build
75
114
  npm pack --dry-run
76
115
  ```
77
116
 
78
- See the [design notes](https://github.com/Colorful12/haru-cat/blob/main/docs/design-notes.md)
117
+ See the [changelog](./CHANGELOG.md) for version history and the
118
+ [design notes](https://github.com/Colorful12/haru-cat/blob/main/docs/design-notes.md)
79
119
  for the project's principles and planned direction.
80
120
 
81
121
  ## Creators
package/dist/HaruCat.d.ts CHANGED
@@ -3,7 +3,12 @@ export type HaruCatProps = {
3
3
  position?: HaruCatPosition;
4
4
  size?: number;
5
5
  offset?: number;
6
+ offsetX?: number;
7
+ offsetY?: number;
8
+ responsive?: boolean;
9
+ visible?: boolean;
10
+ fadeDuration?: number;
6
11
  zIndex?: number;
7
12
  className?: string;
8
13
  };
9
- export declare function HaruCat({ position, size, offset, zIndex, className, }: HaruCatProps): import("react").JSX.Element;
14
+ export declare function HaruCat({ position, size, offset, offsetX, offsetY, responsive, visible, fadeDuration, zIndex, className, }: HaruCatProps): import("react").JSX.Element;