rotion 1.13.0 → 1.13.2
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.ja.md +117 -0
- package/README.md +101 -11
- package/dist/ui/cjs/index.js +1 -1
- package/dist/ui/cjs/index.js.map +1 -1
- package/dist/ui/cjs/types/ui/components/Page/BulletedListBlock/BulletedListBlock.d.ts +2 -2
- package/dist/ui/cjs/types/ui/components/Page/ListBlocks/ListBlocks.types.d.ts +1 -0
- package/dist/ui/cjs/types/ui/components/Page/NumberedListBlock/NumberedListBlock.d.ts +2 -2
- package/dist/ui/cjs/types/ui/components/Page/Page.d.ts +2 -2
- package/dist/ui/cjs/types/ui/components/Page/PageHandler.d.ts +2 -2
- package/dist/ui/cjs/types/ui/components/Page/TextBlock/TextBlock.types.d.ts +1 -0
- package/dist/ui/esm/index.js +1 -1
- package/dist/ui/esm/index.js.map +1 -1
- package/dist/ui/esm/types/ui/components/Page/BulletedListBlock/BulletedListBlock.d.ts +2 -2
- package/dist/ui/esm/types/ui/components/Page/ListBlocks/ListBlocks.types.d.ts +1 -0
- package/dist/ui/esm/types/ui/components/Page/NumberedListBlock/NumberedListBlock.d.ts +2 -2
- package/dist/ui/esm/types/ui/components/Page/Page.d.ts +2 -2
- package/dist/ui/esm/types/ui/components/Page/PageHandler.d.ts +2 -2
- package/dist/ui/esm/types/ui/components/Page/TextBlock/TextBlock.types.d.ts +1 -0
- package/dist/ui/types.d.ts +6 -5
- package/dist/ui/umd/index.js +1 -1
- package/dist/ui/umd/index.js.map +1 -1
- package/dist/ui/umd/types/ui/components/Page/BulletedListBlock/BulletedListBlock.d.ts +2 -2
- package/dist/ui/umd/types/ui/components/Page/ListBlocks/ListBlocks.types.d.ts +1 -0
- package/dist/ui/umd/types/ui/components/Page/NumberedListBlock/NumberedListBlock.d.ts +2 -2
- package/dist/ui/umd/types/ui/components/Page/Page.d.ts +2 -2
- package/dist/ui/umd/types/ui/components/Page/PageHandler.d.ts +2 -2
- package/dist/ui/umd/types/ui/components/Page/TextBlock/TextBlock.types.d.ts +1 -0
- package/package.json +3 -4
package/README.ja.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<p align="right"><a href="https://github.com/linyows/rotion/blob/main/README.md">English</a> | 日本語</p>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://rotion.linyo.ws">
|
|
5
|
+
<picture>
|
|
6
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/linyows/rotion/blob/main/misc/rotion-dark-bg.svg?raw=true">
|
|
7
|
+
<img alt="Rotion" src="https://github.com/linyows/rotion/blob/main/misc/rotion.svg?raw=true" width="300">
|
|
8
|
+
</picture>
|
|
9
|
+
</a>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="https://github.com/linyows/rotion/actions">
|
|
14
|
+
<img src="https://img.shields.io/github/actions/workflow/status/linyows/rotion/build.yml?branch=main&style=for-the-badge&labelColor=000000" alt="Github Actions" />
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://www.npmjs.com/package/rotion">
|
|
17
|
+
<img src="http://img.shields.io/npm/v/rotion.svg?style=for-the-badge&labelColor=000000" alt="NPM" />
|
|
18
|
+
</a>
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
**Rotion**は、Notion APIとReactを活用して、Notionのデータベースやページを静的ウェブサイトとして生成するためのコンポーネント&ツール群です。
|
|
22
|
+
Next.jsをはじめとしたReact系フレームワークでの利用を想定していますが、他のフレームワークでも動作します。
|
|
23
|
+
画像や必要なファイルはローカルに保存されるため、完全な静的サイト生成が可能です。
|
|
24
|
+
|
|
25
|
+
公式サイト: https://rotion.linyo.ws
|
|
26
|
+
|
|
27
|
+
主な特徴
|
|
28
|
+
--
|
|
29
|
+
|
|
30
|
+
- Notion APIからデータベース・ページを取得し、静的サイト用データとして変換
|
|
31
|
+
- 画像やPDFなどのファイルもローカル保存
|
|
32
|
+
- 豊富なReactコンポーネント(Gallery, Table, List, Page, 各種Blockなど)
|
|
33
|
+
- Next.jsなどの静的サイトジェネレーターと親和性が高い
|
|
34
|
+
- TypeScript対応
|
|
35
|
+
|
|
36
|
+
インストール
|
|
37
|
+
--
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install rotion
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
または
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
yarn add rotion
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
使い方
|
|
50
|
+
--
|
|
51
|
+
|
|
52
|
+
### 1. Notion APIのセットアップ
|
|
53
|
+
|
|
54
|
+
Notionのインテグレーションを作成し、APIキーとデータベースIDを取得してください。
|
|
55
|
+
|
|
56
|
+
### 2. データのエクスポート
|
|
57
|
+
|
|
58
|
+
`src/exporter`配下のAPIを使って、Notionからデータを取得し、静的ファイルとして保存します。
|
|
59
|
+
|
|
60
|
+
例:
|
|
61
|
+
```ts
|
|
62
|
+
import { FetchDatabase, FetchBlocks } from 'rotion'
|
|
63
|
+
|
|
64
|
+
const db = await FetchDatabase({ database_id: 'YOUR_DATABASE_ID' })
|
|
65
|
+
const page = await FetchBlocks({ block_id: 'YOUR_PAGE_ID' })
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 3. Reactコンポーネントで表示
|
|
69
|
+
|
|
70
|
+
`src/ui`配下の各種コンポーネントを使って、取得したデータを表示できます。
|
|
71
|
+
|
|
72
|
+
例:
|
|
73
|
+
```tsx
|
|
74
|
+
import { Gallery } from 'rotion/ui'
|
|
75
|
+
|
|
76
|
+
<Gallery db={db} keys={['Name', 'Description']} />
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
主なエクスポート
|
|
80
|
+
--
|
|
81
|
+
|
|
82
|
+
### データ取得用関数(exporter)
|
|
83
|
+
|
|
84
|
+
- `FetchDatabase` - データベースの取得・ローカルキャッシュ
|
|
85
|
+
- `FetchBlocks` - ページブロックの取得・ローカルキャッシュ
|
|
86
|
+
- `FetchPage` - ページ情報の取得
|
|
87
|
+
- `FetchBreadcrumbs` - パンくずリスト情報の取得
|
|
88
|
+
|
|
89
|
+
### UIコンポーネント
|
|
90
|
+
|
|
91
|
+
- `Gallery`, `Table`, `List` - Notionデータベースの各種表示
|
|
92
|
+
- `Page` - Notionページの表示
|
|
93
|
+
- 各種Blockコンポーネント(TextBlock, ImageBlock, CodeBlock, ...)
|
|
94
|
+
- `Icon`, `RichText`, `Checkbox` など
|
|
95
|
+
|
|
96
|
+
スクリプト
|
|
97
|
+
--
|
|
98
|
+
|
|
99
|
+
- `npm run build` - ビルド
|
|
100
|
+
- `npm run test` - テスト
|
|
101
|
+
- `npm run story` - Storybookの起動
|
|
102
|
+
|
|
103
|
+
必要な環境
|
|
104
|
+
--
|
|
105
|
+
|
|
106
|
+
- Node.js 18以上推奨
|
|
107
|
+
- React 17/18/19対応
|
|
108
|
+
|
|
109
|
+
ライセンス
|
|
110
|
+
--
|
|
111
|
+
|
|
112
|
+
MIT
|
|
113
|
+
|
|
114
|
+
作者
|
|
115
|
+
--
|
|
116
|
+
|
|
117
|
+
[@linyows](https://github.com/linyows)
|
package/README.md
CHANGED
|
@@ -1,26 +1,116 @@
|
|
|
1
|
+
<p align="right">English | <a href="https://github.com/linyows/rotion/blob/main/README.ja.md">日本語</a></p>
|
|
2
|
+
|
|
1
3
|
<p align="center">
|
|
2
4
|
<a href="https://rotion.linyo.ws">
|
|
3
|
-
<picture
|
|
5
|
+
<picture>
|
|
4
6
|
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/linyows/rotion/blob/main/misc/rotion-dark-bg.svg?raw=true">
|
|
5
7
|
<img alt="Rotion" src="https://github.com/linyows/rotion/blob/main/misc/rotion.svg?raw=true" width="300">
|
|
6
|
-
</picture
|
|
8
|
+
</picture>
|
|
7
9
|
</a>
|
|
8
10
|
</p>
|
|
9
11
|
|
|
10
|
-
<strong>Rotion</strong> makes it easy to generate a Static Website using React and the Notion API.
|
|
11
|
-
Therefore, images and other necessary files are stored locally. Basically, it is designed to use Next.js, but it will work with other frameworks as well. https://rotion.linyo.ws
|
|
12
|
-
|
|
13
|
-
<br>
|
|
14
12
|
<p align="center">
|
|
15
|
-
<a href="https://github.com/linyows/rotion/actions"
|
|
16
|
-
<img
|
|
13
|
+
<a href="https://github.com/linyows/rotion/actions">
|
|
14
|
+
<img src="https://img.shields.io/github/actions/workflow/status/linyows/rotion/build.yml?branch=main&style=for-the-badge&labelColor=000000" alt="Github Actions" />
|
|
17
15
|
</a>
|
|
18
|
-
<a href="https://www.npmjs.com/package/rotion"
|
|
19
|
-
<img
|
|
16
|
+
<a href="https://www.npmjs.com/package/rotion">
|
|
17
|
+
<img src="http://img.shields.io/npm/v/rotion.svg?style=for-the-badge&labelColor=000000" alt="NPM" />
|
|
20
18
|
</a>
|
|
21
19
|
</p>
|
|
22
20
|
|
|
21
|
+
**Rotion** is a set of components and tools that utilize the Notion API and React to generate a static website from your Notion databases and pages.
|
|
22
|
+
It is designed primarily for use with Next.js (or other React frameworks) and stores images and other files locally, so that you can build a fully static site.
|
|
23
|
+
|
|
24
|
+
Official site: https://rotion.linyo.ws
|
|
25
|
+
|
|
26
|
+
Features
|
|
27
|
+
--
|
|
28
|
+
|
|
29
|
+
- Fetch and convert Notion databases and pages into static site data via the Notion API.
|
|
30
|
+
- Local storage of images, PDFs, and other files.
|
|
31
|
+
- Rich React components (Gallery, Table, List, Page, and various Blocks).
|
|
32
|
+
- Compatible with static site generators such as Next.js.
|
|
33
|
+
- TypeScript support.
|
|
34
|
+
|
|
35
|
+
Installation
|
|
36
|
+
--
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install rotion
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
or
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
yarn add rotion
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Usage
|
|
49
|
+
--
|
|
50
|
+
|
|
51
|
+
### 1. Set Up Notion API
|
|
52
|
+
|
|
53
|
+
Create a Notion integration and obtain your API key and database ID.
|
|
54
|
+
|
|
55
|
+
### 2. Export Data
|
|
56
|
+
|
|
57
|
+
Use the APIs under `src/exporter` to fetch data from Notion and save it as static files.
|
|
58
|
+
|
|
59
|
+
Example:
|
|
60
|
+
```ts
|
|
61
|
+
import { FetchDatabase, FetchBlocks } from 'rotion'
|
|
62
|
+
|
|
63
|
+
const db = await FetchDatabase({ database_id: 'YOUR_DATABASE_ID' })
|
|
64
|
+
const page = await FetchBlocks({ block_id: 'YOUR_PAGE_ID' })
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 3. Render with React Components
|
|
68
|
+
|
|
69
|
+
Use the components under `src/ui` to display the fetched data.
|
|
70
|
+
|
|
71
|
+
Example:
|
|
72
|
+
```tsx
|
|
73
|
+
import { Gallery } from 'rotion/ui'
|
|
74
|
+
|
|
75
|
+
<Gallery db={db} keys={['Name', 'Description']} />
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Main Exports
|
|
79
|
+
--
|
|
80
|
+
|
|
81
|
+
### Data Fetching Functions (exporter)
|
|
82
|
+
|
|
83
|
+
- `FetchDatabase` – Fetches and caches the database.
|
|
84
|
+
- `FetchBlocks` – Fetches and caches page blocks.
|
|
85
|
+
- `FetchPage` – Fetches page information.
|
|
86
|
+
- `FetchBreadcrumbs` – Fetches breadcrumb information.
|
|
87
|
+
|
|
88
|
+
### UI Components
|
|
89
|
+
|
|
90
|
+
- `Gallery`, `Table`, `List` – Various displays for Notion databases.
|
|
91
|
+
- `Page` – Renders a Notion page.
|
|
92
|
+
- Various Block components (TextBlock, ImageBlock, CodeBlock, ...).
|
|
93
|
+
- `Icon`, `RichText`, `Checkbox`, etc.
|
|
94
|
+
|
|
95
|
+
Scripts
|
|
96
|
+
--
|
|
97
|
+
|
|
98
|
+
- `npm run build` – Build.
|
|
99
|
+
- `npm run test` – Run tests.
|
|
100
|
+
- `npm run story` – Launch Storybook.
|
|
101
|
+
|
|
102
|
+
Requirements
|
|
103
|
+
--
|
|
104
|
+
|
|
105
|
+
- Node.js 18 or later (recommended).
|
|
106
|
+
- Compatible with React 17, 18, and 19.
|
|
107
|
+
|
|
108
|
+
License
|
|
109
|
+
--
|
|
110
|
+
|
|
111
|
+
MIT
|
|
112
|
+
|
|
23
113
|
Author
|
|
24
114
|
--
|
|
25
115
|
|
|
26
|
-
[@linyows](https://github.com/linyows)
|
|
116
|
+
[@linyows](https://github.com/linyows)
|