@mogura/moguchart-core 1.0.0 → 1.1.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.
package/CHANGELOG.ja.md CHANGED
@@ -7,6 +7,59 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  > 英語版は [CHANGELOG.md](./CHANGELOG.md) をご覧ください。
9
9
 
10
+ ## [1.1.1] - 2026-09-19
11
+
12
+ ### Fixed
13
+
14
+ - **パッケージドキュメント同梱の修正**:
15
+ - `@mogura/moguchart-core` パッケージ配布物(npmパッケージ)に `README.md`、`README.ja.md`、`LICENSE`、`CHANGELOG.md`、`CHANGELOG.ja.md` を直接同梱し、npm および GitHub 上でドキュメントが正しく表示されるよう修正
16
+ - 各ラッパー・プラグインパッケージ(`@mogura/moguchart-plugin-export`, `@mogura/moguchart-react`, `@mogura/moguchart-vue`)に `LICENSE` ファイルを同梱
17
+ - `packages/core/package.json` に `repository.directory` 設定を追加し、npm から GitHub へのリンク解決を適正化
18
+ - ルートのビルドパイプラインにドキュメント自動同期(`sync:docs`)スクリプトを導入
19
+
20
+ ## [1.1.0] - 2026-09-19
21
+
22
+ 本バージョンでは、ライブラリの拡張性を飛躍的に高める **プラグインアーキテクチャ** を導入し、PNG / PDF エクスポート機能を独立パッケージ `@mogura/moguchart-plugin-export` としてプラグイン化・切り出しました。
23
+ これにより、コアライブラリ(`@mogura/moguchart-core`)から重量級ライブラリ(`html2canvas-pro`, `jspdf`、計約600KB)が完全に排除され、**コア本体の超軽量化(gzip約44KB)** を達成しました。
24
+
25
+ ### Added
26
+
27
+ - **統一プラグインアーキテクチャ(`GanttPlugin` API)の導入**:
28
+ - `GanttPlugin` 型定義および `PluginManager` を追加
29
+ - `GanttChartElement.use(plugin, config?)`: プラグインを動的に登録・初期化するメソッドを追加
30
+ - `GanttChartOption.plugins`: オプション経由で宣言的にプラグイン配列を渡して自動登録する機能を追加
31
+ - プラグインのライフサイクルフック(`install`, `destroy`, `beforeTaskUpdate`, `afterTaskUpdate`, `afterRender`)をサポート
32
+ - 未登録状態でプラグイン依存メソッド(`chart.exportImage` 等)が呼ばれた際、導入案内と登録方法を親切に伝えるエラーハンドリングを実装
33
+ - **独立プラグインパッケージ `@mogura/moguchart-plugin-export` を新設**:
34
+ - PNG 画像および PDF への高解像度エクスポート(ヘッダー分割・スクロール位置保持対応)を独立パッケージへ移行
35
+ - `exportPlugin(config?)`: ガントチャートインスタンスに登録して `chart.exportImage()` を有効化するプラグインファクトリ
36
+ - `exportChart(chart, format, options)`: エクスポートボタン押下時など必要なタイミングでのみ遅延ロード(Dynamic Import)して直接呼び出せるスタンドアロン関数を提供
37
+ - **公式 React ラッパーパッケージ `@mogura/moguchart-react` を新設**:
38
+ - Lit 公式の `@lit/react` (`createComponent`) を基盤に採用し、`<gantt-chart>` を型安全な React コンポーネント `<GanttChart />` として提供
39
+ - 全25種類のカスタムイベントをキャメルケースの props(`onTaskUpdate`, `onTaskClick`, `onRowReordered` 等)として型安全にサポート
40
+ - `ref` を通じた基底 `GanttChartElement` へのアクセスおよび命令的メソッド(`exportImage` 等)の呼び出しに対応
41
+ - コアの型定義・関数・定数をすべて re-export
42
+ - **公式 Vue 3 ラッパーパッケージ `@mogura/moguchart-vue` を新設**:
43
+ - Vue 3 の `defineComponent` を使用した公式 `<GanttChart />` コンポーネントを提供
44
+ - Composition API(`<script setup>`)および Options API の双方に対応
45
+ - リアクティブな props(`rows`, `option`, `theme` 等)の自動同期
46
+ - 全25種類のカスタムイベントの Vue emits(`@task-update`, `@task-click` 等)バインディング
47
+ - Template Ref から呼び出せる命令的メソッドの公開(`expose`)
48
+ - Vue プラグイン(`app.use(MoguchartVue)`)としてのグローバル登録に対応
49
+ - コアの型定義・関数・定数をすべて re-export
50
+ - **pnpm workspaces によるモノレポ構成への移行**:
51
+ - `packages/core`: `@mogura/moguchart-core`(超軽量コア Web Component)
52
+ - `packages/plugin-export`: `@mogura/moguchart-plugin-export`(PNG/PDF エクスポートプラグイン)
53
+ - `packages/react`: `@mogura/moguchart-react`(React 公式ラッパー)
54
+ - `packages/vue`: `@mogura/moguchart-vue`(Vue 3 公式ラッパー)
55
+
56
+ ### Changed
57
+
58
+ - **`@mogura/moguchart-core` の dependencies から `html2canvas-pro` および `jspdf` を削除**:
59
+ - エクスポート機能を使わないユーザーにも同梱されていた約600KB超の重量級コードがコアから完全に分離され、初期読み込み・バンドルサイズが大幅に改善されました。
60
+ - **デモ画面のエクスポート機能連携**:
61
+ - デモ画面(`main.ts`)で `@mogura/moguchart-plugin-export` を登録し、PNG / PDF エクスポートボタンが継続してシームレスに動作するよう対応
62
+
10
63
  ## [1.0.0] - 2026-09-13
11
64
 
12
65
  祝・正式リリース!🎉
package/CHANGELOG.md CHANGED
@@ -7,6 +7,58 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  > Read this in [日本語 (Japanese)](./CHANGELOG.ja.md).
9
9
 
10
+ ## [1.1.1] - 2026-09-19
11
+
12
+ ### Fixed
13
+
14
+ - **Package Documentation Bundle**:
15
+ - Bundled `README.md`, `README.ja.md`, `LICENSE`, `CHANGELOG.md`, and `CHANGELOG.ja.md` directly into the `@mogura/moguchart-core` package distribution so that documentation is correctly rendered on npm and GitHub.
16
+ - Added `LICENSE` files to all wrapper and plugin packages (`@mogura/moguchart-plugin-export`, `@mogura/moguchart-react`, `@mogura/moguchart-vue`).
17
+ - Added repository `directory` configuration to `packages/core/package.json` for proper npm GitHub link resolution.
18
+ - Added automated `sync:docs` script into the root build pipeline to keep all package documentation synchronized.
19
+
20
+ ## [1.1.0] - 2026-09-19
21
+
22
+ This release introduces a modular **Plugin Architecture** that significantly elevates the extensibility of Moguchart, extracting the PNG and PDF export features into a dedicated package: `@mogura/moguchart-plugin-export`.
23
+ As a result, heavy third-party dependencies (`html2canvas-pro` and `jspdf`, ~600KB unminified) have been completely removed from the core library (`@mogura/moguchart-core`), making the core bundle ultra-lightweight (**~44KB gzipped**).
24
+
25
+ ### Added
26
+
27
+ - **Unified Plugin Architecture (`GanttPlugin` API)**:
28
+ - Added `GanttPlugin` interface and `PluginManager`
29
+ - `GanttChartElement.use(plugin, config?)`: Public method to dynamically register and initialize plugins
30
+ - `GanttChartOption.plugins`: Option property allowing declarative registration of an array of plugins
31
+ - Plugin lifecycle hooks (`install`, `destroy`, `beforeTaskUpdate`, `afterTaskUpdate`, `afterRender`)
32
+ - Clear, user-friendly error guidance when calling plugin-dependent methods (such as `chart.exportImage`) without the plugin installed
33
+ - **Dedicated Plugin Package `@mogura/moguchart-plugin-export`**:
34
+ - High-fidelity PNG and multi-page PDF export utility migrated into an independent workspace package
35
+ - `exportPlugin(config?)`: Plugin factory to register with the Gantt chart instance and enable `chart.exportImage()`
36
+ - `exportChart(chart, format, options)`: Standalone export function enabling on-demand, dynamic imports for code-splitting
37
+ - **Official React Wrapper Package `@mogura/moguchart-react`**:
38
+ - Built on `@lit/react` (`createComponent`) to provide `<GanttChart />` as a fully type-safe React component
39
+ - All 25 custom events mapped to camelCase props (`onTaskUpdate`, `onTaskClick`, `onRowReordered`, etc.)
40
+ - Seamless `ref` support to access the underlying `GanttChartElement` instance and imperative methods (`exportImage`, etc.)
41
+ - Full re-export of all `@mogura/moguchart-core` types and utilities
42
+ - **Official Vue 3 Wrapper Package `@mogura/moguchart-vue`**:
43
+ - Built with Vue 3 `defineComponent` supporting both Composition API (`<script setup>`) and Options API
44
+ - Automatic reactive synchronization of props (`rows`, `option`, `theme`, etc.)
45
+ - All 25 custom events forwarded to standard Vue emits (`@task-update`, `@task-click`, etc.)
46
+ - Public imperative methods exposed via Template Ref
47
+ - Global registration support via Vue Plugin (`app.use(MoguchartVue)`)
48
+ - Full re-export of all `@mogura/moguchart-core` types and utilities
49
+ - **pnpm Workspaces Monorepo Setup**:
50
+ - `packages/core`: `@mogura/moguchart-core` (ultra-lightweight core Web Component)
51
+ - `packages/plugin-export`: `@mogura/moguchart-plugin-export` (PNG/PDF export plugin)
52
+ - `packages/react`: `@mogura/moguchart-react` (official React wrapper)
53
+ - `packages/vue`: `@mogura/moguchart-vue` (official Vue 3 wrapper)
54
+
55
+ ### Changed
56
+
57
+ - **Removed `html2canvas-pro` and `jspdf` from `@mogura/moguchart-core` dependencies**:
58
+ - Over 600KB of export dependencies are no longer imposed on users who only need the Gantt chart display and scheduling capabilities.
59
+ - **Updated Demo Application**:
60
+ - Registered `@mogura/moguchart-plugin-export` in the demo page (`main.ts`) so that PNG and PDF export buttons continue to work seamlessly.
61
+
10
62
  ## [1.0.0] - 2026-09-13
11
63
 
12
64
  Official Major Release! 🎉
package/README.ja.md CHANGED
@@ -44,9 +44,8 @@ Vue, React, Angular, Svelte など、どのフレームワークでも動作す
44
44
  - 進捗ラベル表示(配置カスタマイズ・カスタムフォーマット対応)
45
45
  - 進捗変更イベント(`task-progress-change`)の発火
46
46
  - 行・プロジェクト全体の進捗率計算ユーティリティ関数
47
- - ミニマップへの進捗状況の自動反映
48
- - 📷 **エクスポート**: PNG画像およびPDF形式でのガントチャート全体エクスポート(自動ダウンロード対応、スクロール位置保持)
49
- - ✨ **高度な連携**:
47
+ - 🧩 **プラグインアーキテクチャ**: コア本体を超軽量(数十KB)に保ちつつ、画像・PDFエクスポート等の機能をプラグインとして柔軟に拡張可能
48
+ - 📷 **エクスポート(プラグイン)**: `@mogura/moguchart-plugin-export` による PNG画像およびPDF形式でのガントチャート全体エクスポート(自動ダウンロード対応、スクロール位置保持)
50
49
  - 外部からのドラッグ&ドロップによるタスク作成
51
50
  - タスクの移動/コピーモード
52
51
  - スナップ機能(時間単位でのグリッドスナップ)
@@ -64,181 +63,228 @@ Vue, React, Angular, Svelte など、どのフレームワークでも動作す
64
63
  - プログラムからの開閉操作(`toggleRowCollapse`, `collapseAll`, `expandAll`)
65
64
  - ⌨️ **キーボード操作**: 矢印キーでのナビゲーション・選択・Shift+矢印キーでのタスク移動・Deleteキーでの削除
66
65
 
66
+ ## パッケージ一覧(エコシステム)
67
+
68
+ Moguchart は柔軟なモノレポ構成となっており、用途やフレームワークに合わせてパッケージを選択できます:
69
+
70
+ | パッケージ | 説明 |
71
+ |---|---|
72
+ | **[@mogura/moguchart-core](https://www.npmjs.com/package/@mogura/moguchart-core)** | コア Web Component(Lit製)。フレームワーク非依存で単体動作します。 |
73
+ | **[@mogura/moguchart-react](https://www.npmjs.com/package/@mogura/moguchart-react)** | **公式 React ラッパー**。型安全な Props、イベント、ref を提供します。 |
74
+ | **[@mogura/moguchart-vue](https://www.npmjs.com/package/@mogura/moguchart-vue)** | **公式 Vue 3 ラッパー**。Composition API、リアクティブ Props、emits を提供します。 |
75
+ | **[@mogura/moguchart-plugin-export](https://www.npmjs.com/package/@mogura/moguchart-plugin-export)** | **公式エクスポートプラグイン**。高解像度 PNG および PDF 出力を提供します。 |
76
+
77
+ ---
78
+
67
79
  ## インストール
68
80
 
81
+ お使いの環境に合わせてインストールしてください:
82
+
69
83
  ```bash
84
+ # Core (Web Components / Vanilla JS)
70
85
  pnpm add @mogura/moguchart-core
71
- # または
72
- npm install @mogura/moguchart-core
86
+
87
+ # React アプリケーションの場合
88
+ pnpm add @mogura/moguchart-react @mogura/moguchart-core
89
+
90
+ # Vue 3 アプリケーションの場合
91
+ pnpm add @mogura/moguchart-vue @mogura/moguchart-core
73
92
  ```
74
93
 
75
94
  ## APIリファレンス
76
95
 
77
96
  詳細な API リファレンスは [API.ja.md](./doc/API.ja.md) または [英語版 (API.md)](./doc/API.md) を参照してください。
78
97
 
79
- ## Vue.js での使用例
98
+ ---
80
99
 
81
- Vue.js (Vue 3) で使用する場合のサンプルです。
82
- Web Components を使用するため、`vite.config.ts` などでカスタム要素として認識させる設定が必要な場合があります。
100
+ ## React での使用例(公式ラッパー)
83
101
 
84
- ```html
85
- <script setup lang="ts">
86
- import { ref } from 'vue'
87
- import '@mogura/moguchart-core'
88
- import type { GanttRow, GanttChartOption, TaskUpdateEventDetail } from '@mogura/moguchart-core'
102
+ [`@mogura/moguchart-react`](./packages/react/README.ja.md) を使用すると、React の合成イベントや Props、`ref` を通じた命令的メソッド呼び出しが完全に型安全に動作します:
103
+
104
+ ```tsx
105
+ import React, { useRef } from 'react'
106
+ import {
107
+ GanttChart,
108
+ type GanttChartElement,
109
+ type GanttRow,
110
+ type GanttChartOption,
111
+ type TaskUpdateEventDetail,
112
+ } from '@mogura/moguchart-react'
113
+ import { ExportPlugin } from '@mogura/moguchart-plugin-export'
89
114
 
90
- const rows = ref<GanttRow[]>([
115
+ export default function App() {
116
+ const chartRef = useRef<GanttChartElement>(null)
117
+
118
+ const rows: GanttRow[] = [
91
119
  {
92
120
  id: 'row-1',
93
- name: 'Project A',
121
+ name: '開発フェーズ',
94
122
  tasks: [
95
123
  {
96
- id: 't-1',
97
- name: 'Task 1',
98
- start: new Date('2024-01-01'),
99
- end: new Date('2024-01-05'),
100
- style: 'background-color: #60a5fa',
124
+ id: 'task-1',
125
+ name: '要件定義',
126
+ start: new Date('2026-04-01'),
127
+ end: new Date('2026-04-10'),
128
+ progress: 100,
101
129
  },
102
- ],
103
- markers: [
104
130
  {
105
- id: 'marker-1',
106
- name: 'レビュー期限',
107
- date: new Date('2024-01-03'),
108
- type: 'triangle-down',
109
- color: '#ef4444',
131
+ id: 'task-2',
132
+ name: '実装',
133
+ start: new Date('2026-04-11'),
134
+ end: new Date('2026-04-25'),
135
+ progress: 50,
110
136
  },
111
137
  ],
112
138
  },
113
- ])
139
+ ]
114
140
 
115
- const option = ref<GanttChartOption>({
141
+ const option: GanttChartOption = {
116
142
  calendar: {
117
- start: new Date('2024-01-01'),
118
- end: new Date('2024-03-31'),
119
- pxPerDay: 30,
120
- showCurrentTime: true,
121
- milestones: [
122
- {
123
- id: 'ms-1',
124
- name: 'リリース',
125
- start: new Date('2024-02-01'),
126
- color: '#8b5cf6',
127
- },
128
- ],
143
+ start: new Date('2026-04-01'),
144
+ end: new Date('2026-04-30'),
145
+ pxPerDay: 40,
129
146
  },
130
- bar: { height: 28 },
131
- rowHeader: { width: 200 },
132
- theme: 'system',
133
- })
134
-
135
- const handleTaskUpdate = (e: Event) => {
136
- const detail = (e as CustomEvent<TaskUpdateEventDetail>).detail
137
- console.log('Task updated:', detail)
147
+ plugins: [new ExportPlugin()],
138
148
  }
139
- </script>
140
149
 
141
- <template>
142
- <div style="height: 500px;">
143
- <gantt-chart :rows="rows" :option="option" @task-update="handleTaskUpdate"></gantt-chart>
144
- </div>
145
- </template>
150
+ const handleTaskUpdate = (e: CustomEvent<TaskUpdateEventDetail>) => {
151
+ console.log('タスクが更新されました:', e.detail)
152
+ }
153
+
154
+ const handleExportPng = async () => {
155
+ await chartRef.current?.exportImage({ format: 'png', scale: 2 })
156
+ }
157
+
158
+ return (
159
+ <div style={{ height: '600px' }}>
160
+ <button onClick={handleExportPng}>PNGエクスポート</button>
161
+ <GanttChart
162
+ ref={chartRef}
163
+ rows={rows}
164
+ option={option}
165
+ theme="light"
166
+ onTaskUpdate={handleTaskUpdate}
167
+ style={{ width: '100%', height: '100%' }}
168
+ />
169
+ </div>
170
+ )
171
+ }
146
172
  ```
147
173
 
148
- ## React での使用例
174
+ ---
149
175
 
150
- React で使用する場合のサンプルです。
151
- Web Components のプロパティやイベントを扱うため、`ref` を使用して実装します。
176
+ ## Vue 3 での使用例(公式ラッパー)
152
177
 
153
- ```tsx
154
- import { useEffect, useRef, useState } from 'react'
155
- import '@mogura/moguchart-core'
156
- import type { GanttRow, GanttChartOption, TaskUpdateEventDetail } from '@mogura/moguchart-core'
178
+ [`@mogura/moguchart-vue`](./packages/vue/README.ja.md) を使用すると、Composition API(`<script setup>`)でリアクティブな Props や Vue 標準のイベントハンドリング(`@task-update` 等)を直感的に扱えます:
157
179
 
158
- // TypeScript で使用する場合の型定義
159
- declare global {
160
- namespace JSX {
161
- interface IntrinsicElements {
162
- 'gantt-chart': any
163
- }
164
- }
180
+ ```vue
181
+ <script setup lang="ts">
182
+ import { ref } from 'vue'
183
+ import {
184
+ GanttChart,
185
+ type GanttChartInstance,
186
+ type GanttRow,
187
+ type GanttChartOption,
188
+ type TaskUpdateEventDetail,
189
+ } from '@mogura/moguchart-vue'
190
+ import { ExportPlugin } from '@mogura/moguchart-plugin-export'
191
+
192
+ const chartRef = ref<GanttChartInstance | null>(null)
193
+
194
+ const rows = ref<GanttRow[]>([
195
+ {
196
+ id: 'row-1',
197
+ name: '開発フェーズ',
198
+ tasks: [
199
+ {
200
+ id: 'task-1',
201
+ name: '要件定義',
202
+ start: new Date('2026-04-01'),
203
+ end: new Date('2026-04-10'),
204
+ progress: 100,
205
+ },
206
+ ],
207
+ },
208
+ ])
209
+
210
+ const option: GanttChartOption = {
211
+ calendar: {
212
+ start: new Date('2026-04-01'),
213
+ end: new Date('2026-04-30'),
214
+ pxPerDay: 40,
215
+ },
216
+ plugins: [new ExportPlugin()],
165
217
  }
166
218
 
167
- export default function App() {
168
- const chartRef = useRef<any>(null)
219
+ const handleTaskUpdate = (detail: TaskUpdateEventDetail) => {
220
+ console.log('タスクが更新されました:', detail)
221
+ }
169
222
 
170
- const [rows] = useState<GanttRow[]>([
171
- {
172
- id: 'row-1',
173
- name: 'Project A',
174
- tasks: [
175
- {
176
- id: 't-1',
177
- name: 'Task 1',
178
- start: new Date('2024-01-01'),
179
- end: new Date('2024-01-05'),
180
- style: 'background-color: #60a5fa',
181
- },
182
- ],
183
- markers: [
184
- {
185
- id: 'marker-1',
186
- name: 'レビュー期限',
187
- date: new Date('2024-01-03'),
188
- type: 'triangle-down',
189
- color: '#ef4444',
190
- },
191
- ],
192
- },
193
- ])
223
+ const handleExportPng = async () => {
224
+ await chartRef.value?.exportImage({ format: 'png', scale: 2 })
225
+ }
226
+ </script>
194
227
 
195
- const [option] = useState<GanttChartOption>({
196
- calendar: {
197
- start: new Date('2024-01-01'),
198
- end: new Date('2024-03-31'),
199
- pxPerDay: 30,
200
- showCurrentTime: true,
201
- milestones: [
202
- {
203
- id: 'ms-1',
204
- name: 'リリース',
205
- start: new Date('2024-02-01'),
206
- color: '#8b5cf6',
207
- },
208
- ],
209
- },
210
- bar: { height: 28 },
211
- rowHeader: { width: 200 },
212
- theme: 'system',
213
- })
214
-
215
- useEffect(() => {
216
- const chart = chartRef.current
217
- if (!chart) return
218
-
219
- // プロパティの設定
220
- chart.rows = rows
221
- chart.option = option
222
-
223
- // イベントリスナーの設定
224
- const handleTaskUpdate = (e: Event) => {
225
- const detail = (e as CustomEvent<TaskUpdateEventDetail>).detail
226
- console.log('Task updated:', detail)
227
- }
228
+ <template>
229
+ <div style="height: 600px;">
230
+ <button @click="handleExportPng">PNGエクスポート</button>
231
+ <GanttChart
232
+ ref="chartRef"
233
+ :rows="rows"
234
+ :option="option"
235
+ theme="light"
236
+ @task-update="handleTaskUpdate"
237
+ style="width: 100%; height: 100%;"
238
+ />
239
+ </div>
240
+ </template>
241
+ ```
242
+
243
+ ---
244
+
245
+ ## Web Components (Vanilla JS) での使用例
228
246
 
229
- chart.addEventListener('task-update', handleTaskUpdate)
247
+ フレームワークを使わずにプレーンな HTML / JavaScript で使用する場合:
230
248
 
231
- return () => {
232
- chart.removeEventListener('task-update', handleTaskUpdate)
249
+ ```html
250
+ <!DOCTYPE html>
251
+ <html>
252
+ <head>
253
+ <script type="module">
254
+ import '@mogura/moguchart-core'
255
+
256
+ const chart = document.querySelector('gantt-chart')
257
+ chart.rows = [
258
+ {
259
+ id: 'row-1',
260
+ name: 'タスクグループ 1',
261
+ tasks: [
262
+ {
263
+ id: 'task-1',
264
+ name: 'タスク 1',
265
+ start: new Date('2026-04-01'),
266
+ end: new Date('2026-04-10'),
267
+ },
268
+ ],
269
+ },
270
+ ]
271
+ chart.option = {
272
+ calendar: {
273
+ start: new Date('2026-04-01'),
274
+ end: new Date('2026-04-30'),
275
+ pxPerDay: 40,
276
+ },
233
277
  }
234
- }, [rows, option])
235
278
 
236
- return (
237
- <div style={{ height: '500px' }}>
238
- <gantt-chart ref={chartRef}></gantt-chart>
239
- </div>
240
- )
241
- }
279
+ chart.addEventListener('task-update', (e) => {
280
+ console.log('Updated:', e.detail)
281
+ })
282
+ </script>
283
+ </head>
284
+ <body>
285
+ <gantt-chart style="width: 100%; height: 500px;"></gantt-chart>
286
+ </body>
287
+ </html>
242
288
  ```
243
289
 
244
290
  ## 主要機能
@@ -671,19 +717,40 @@ document.addEventListener('mousemove', (e) => {
671
717
  })
672
718
  ```
673
719
 
674
- #### exportImage
720
+ #### エクスポートプラグイン (`@mogura/moguchart-plugin-export`)
675
721
 
676
- ガントチャート全体を PNG 画像または PDF 形式でエクスポートします。
722
+ ガントチャート全体を PNG 画像または PDF 形式でエクスポートします。エクスポート機能はプラグイン(`@mogura/moguchart-plugin-export`)として提供されており、必要な場合のみ導入することでコア本体を超軽量に保てます。
723
+
724
+ ```bash
725
+ pnpm add @mogura/moguchart-plugin-export
726
+ ```
677
727
 
678
728
  ```javascript
729
+ import '@mogura/moguchart-core'
730
+ import { exportPlugin } from '@mogura/moguchart-plugin-export'
731
+
732
+ // チャートにプラグインを登録(chart.use または option.plugins)
733
+ chart.use(exportPlugin())
734
+
679
735
  // PNG画像として自動ダウンロード
680
736
  await chart.exportImage('png', {
681
- fileName: 'gantt-chart.png',
737
+ filename: 'gantt-chart',
682
738
  download: true,
739
+ scale: 2,
683
740
  })
684
741
 
685
742
  // PDFとしてBlobを取得
686
- const pdfBlob = await chart.exportImage('pdf')
743
+ const pdfBlob = await chart.exportImage('pdf', {
744
+ filename: 'gantt-chart',
745
+ download: true,
746
+ })
747
+ ```
748
+
749
+ または、エクスポートボタン押下時など必要なタイミングでのみ遅延ロード(Dynamic Import)してスタンドアロン関数を実行することも可能です:
750
+
751
+ ```javascript
752
+ const { exportChart } = await import('@mogura/moguchart-plugin-export')
753
+ await exportChart(chart, 'png', { download: true })
687
754
  ```
688
755
 
689
756
  #### ズーム操作 (zoomTo / zoomToFit / resetZoom)