@c4h/chuci 0.2.4 → 0.2.5
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/LICENSE +1 -1
- package/README.ja.md +152 -16
- package/README.md +66 -12
- package/package.json +1 -1
package/LICENSE
CHANGED
package/README.ja.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Chuci (楚辞)
|
|
2
2
|
|
|
3
|
+
[](https://github.com/code4history/Chuci/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/@c4h/chuci)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
|
|
3
8
|
[Quyuan](https://github.com/code4history/Quyuan)から抽出されたスタンドアロンのマルチメディアスワイパーとビューアWebコンポーネントライブラリです。フレームワークに依存せず、タッチ対応のカルーセルとマルチメディアビューアを提供します。
|
|
4
9
|
|
|
5
10
|
## 特徴
|
|
@@ -11,12 +16,39 @@
|
|
|
11
16
|
- 📦 **軽量**: tree-shakingサポートによる最適化されたバンドルサイズ
|
|
12
17
|
- 🛠️ **TypeScript**: 型定義付きの完全なTypeScriptサポート
|
|
13
18
|
|
|
19
|
+
## 要件
|
|
20
|
+
|
|
21
|
+
- **Node.js**: 20以降
|
|
22
|
+
- **パッケージマネージャー**: pnpm 9.0.0以降(推奨)
|
|
23
|
+
- **ブラウザ**: Web Componentsをサポートするモダンブラウザ
|
|
24
|
+
- Chrome/Edge 79+
|
|
25
|
+
- Firefox 63+
|
|
26
|
+
- Safari 12.1+
|
|
27
|
+
|
|
14
28
|
## インストール
|
|
15
29
|
|
|
30
|
+
### pnpmを使用(推奨)
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pnpm add @c4h/chuci
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### npmを使用
|
|
37
|
+
|
|
16
38
|
```bash
|
|
17
39
|
npm install @c4h/chuci
|
|
18
40
|
```
|
|
19
41
|
|
|
42
|
+
### CDN(ブラウザ)
|
|
43
|
+
|
|
44
|
+
```html
|
|
45
|
+
<script src="https://cdn.jsdelivr.net/npm/@c4h/chuci@latest/dist/chuci.umd.js"></script>
|
|
46
|
+
<script>
|
|
47
|
+
// コンポーネントはグローバルにChuciとして利用可能
|
|
48
|
+
// HTMLで直接カスタム要素を使用できます
|
|
49
|
+
</script>
|
|
50
|
+
```
|
|
51
|
+
|
|
20
52
|
## 使用方法
|
|
21
53
|
|
|
22
54
|
### 基本的なスワイパー
|
|
@@ -42,6 +74,23 @@ npm install @c4h/chuci
|
|
|
42
74
|
</script>
|
|
43
75
|
```
|
|
44
76
|
|
|
77
|
+
### プログラムによる使用
|
|
78
|
+
|
|
79
|
+
```javascript
|
|
80
|
+
import '@c4h/chuci';
|
|
81
|
+
|
|
82
|
+
// スワイパー要素を取得
|
|
83
|
+
const swiper = document.querySelector('cc-swiper');
|
|
84
|
+
|
|
85
|
+
// プログラムでビューアを開く
|
|
86
|
+
swiper.openViewer('path/to/image.jpg', 'image', 0);
|
|
87
|
+
|
|
88
|
+
// スライド変更イベントをリッスン
|
|
89
|
+
swiper.addEventListener('slidechange', (e) => {
|
|
90
|
+
console.log('現在のスライド:', e.detail.activeIndex);
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
45
94
|
### サムネイルギャラリー付き
|
|
46
95
|
|
|
47
96
|
```html
|
|
@@ -78,24 +127,89 @@ npm install @c4h/chuci
|
|
|
78
127
|
- `has-thumb`: サムネイルギャラリーを表示
|
|
79
128
|
- `autoplay`: 自動再生を有効化
|
|
80
129
|
|
|
130
|
+
**メソッド:**
|
|
131
|
+
- `openViewer(imageUrl: string, imageType: string, slideIndex?: number)`: プログラムでビューアを開く
|
|
132
|
+
- `imageUrl`: 表示するメディアのURL
|
|
133
|
+
- `imageType`: メディアのタイプ(上記のサポートされるタイプを参照)
|
|
134
|
+
- `slideIndex`: オプションのスライドインデックス(デフォルト: 0)
|
|
135
|
+
|
|
136
|
+
**イベント:**
|
|
137
|
+
- `slidechange`: スライドが変更されたときに発火
|
|
138
|
+
- `detail.activeIndex`: 現在のアクティブなスライドインデックス
|
|
139
|
+
|
|
140
|
+
**プロパティ:**
|
|
141
|
+
- `slider`: 基盤となるSwiperインスタンスへのアクセス
|
|
142
|
+
|
|
81
143
|
### `<cc-swiper-slide>`
|
|
82
144
|
|
|
83
145
|
個別のスライドコンポーネント。
|
|
84
146
|
|
|
85
147
|
**属性:**
|
|
86
|
-
- `thumbnail-url`: サムネイル画像のURL
|
|
87
|
-
- `image-url`: フルメディアのURL
|
|
88
|
-
- `image-type`:
|
|
148
|
+
- `thumbnail-url`: サムネイル画像のURL(必須)
|
|
149
|
+
- `image-url`: フルメディアのURL(必須)
|
|
150
|
+
- `image-type`: メディアタイプ(上記のサポートされるタイプを参照)(必須)
|
|
89
151
|
- `caption`: オプションのキャプションテキスト
|
|
90
152
|
|
|
91
|
-
|
|
153
|
+
**3DモデルとGaussianスプラット用の属性:**
|
|
154
|
+
- `material-url`: 3Dモデル用のマテリアルファイルURL(OBJ/MTL)
|
|
155
|
+
- `debug-mode`: デバッグ情報の表示を有効化(`"true"` または `"false"`)
|
|
156
|
+
- `camera-position`: 初期カメラ位置を `"x,y,z"` 形式で指定(例: `"0,1,5"`)
|
|
157
|
+
- `camera-target`: カメラターゲット位置を `"x,y,z"` 形式で指定(例: `"0,0,0"`)
|
|
158
|
+
- `show-texture`: 3Dモデルのテクスチャの表示/非表示(`"true"` または `"false"`)
|
|
159
|
+
- `fit-to-container`: モデルをコンテナサイズに合わせる(`"true"` または `"false"`)
|
|
160
|
+
|
|
161
|
+
### ビューアコンポーネント
|
|
162
|
+
|
|
163
|
+
すべてのビューアコンポーネントは`CcViewerBase`を継承し、以下をサポートします:
|
|
164
|
+
|
|
165
|
+
**メソッド:**
|
|
166
|
+
- `open(url: string)`: メディアURLでビューアを開く
|
|
167
|
+
- `close()`: ビューアを閉じる
|
|
168
|
+
|
|
169
|
+
**プロパティ:**
|
|
170
|
+
- `showPrevButton` (boolean): 前へナビゲーションボタンの表示/非表示
|
|
171
|
+
- `showNextButton` (boolean): 次へナビゲーションボタンの表示/非表示
|
|
92
172
|
|
|
93
|
-
|
|
94
|
-
- `
|
|
95
|
-
- `
|
|
96
|
-
- `
|
|
97
|
-
|
|
98
|
-
|
|
173
|
+
**イベント:**
|
|
174
|
+
- `close`: ビューアが閉じられたときに発火
|
|
175
|
+
- `navigate-prev`: 前へボタンがクリックされたときに発火
|
|
176
|
+
- `navigate-next`: 次へボタンがクリックされたときに発火
|
|
177
|
+
|
|
178
|
+
### メディア固有の例
|
|
179
|
+
|
|
180
|
+
#### 3Dモデルビューア
|
|
181
|
+
```html
|
|
182
|
+
<cc-swiper-slide
|
|
183
|
+
thumbnail-url="thumb.jpg"
|
|
184
|
+
image-url="model.obj"
|
|
185
|
+
image-type="3dmodel"
|
|
186
|
+
material-url="model.mtl"
|
|
187
|
+
debug-mode="true"
|
|
188
|
+
camera-position="0,1,5"
|
|
189
|
+
camera-target="0,0,0"
|
|
190
|
+
show-texture="true">
|
|
191
|
+
</cc-swiper-slide>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
#### Gaussianスプラッティングビューア
|
|
195
|
+
```html
|
|
196
|
+
<cc-swiper-slide
|
|
197
|
+
thumbnail-url="thumb.jpg"
|
|
198
|
+
image-url="scene.splat"
|
|
199
|
+
image-type="gaussian"
|
|
200
|
+
debug-mode="true"
|
|
201
|
+
camera-position="0,0,10">
|
|
202
|
+
</cc-swiper-slide>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
#### YouTube動画
|
|
206
|
+
```html
|
|
207
|
+
<cc-swiper-slide
|
|
208
|
+
thumbnail-url="thumb.jpg"
|
|
209
|
+
image-url="https://www.youtube.com/watch?v=VIDEO_ID"
|
|
210
|
+
image-type="youtube">
|
|
211
|
+
</cc-swiper-slide>
|
|
212
|
+
```
|
|
99
213
|
|
|
100
214
|
## スタイリング
|
|
101
215
|
|
|
@@ -107,17 +221,20 @@ cc-swiper {
|
|
|
107
221
|
--cc-slider-navigation-color: #007aff;
|
|
108
222
|
}
|
|
109
223
|
|
|
110
|
-
cc-viewer
|
|
224
|
+
cc-viewer-base,
|
|
225
|
+
cc-viewer-image,
|
|
226
|
+
cc-viewer-panorama,
|
|
227
|
+
cc-viewer-youtube,
|
|
228
|
+
cc-viewer-video,
|
|
229
|
+
cc-viewer-3dmodel,
|
|
230
|
+
cc-viewer-gaussian {
|
|
111
231
|
--cc-viewer-z-index: 1000;
|
|
112
232
|
}
|
|
113
233
|
```
|
|
114
234
|
|
|
115
235
|
## ブラウザサポート
|
|
116
236
|
|
|
117
|
-
|
|
118
|
-
- Chrome/Edge 79+
|
|
119
|
-
- Firefox 63+
|
|
120
|
-
- Safari 12.1+
|
|
237
|
+
ブラウザ互換性の詳細については、[要件](#要件)セクションを参照してください。
|
|
121
238
|
|
|
122
239
|
## 開発
|
|
123
240
|
|
|
@@ -137,7 +254,26 @@ pnpm run build
|
|
|
137
254
|
|
|
138
255
|
## ライセンス
|
|
139
256
|
|
|
140
|
-
MIT License
|
|
257
|
+
MIT License
|
|
258
|
+
|
|
259
|
+
Copyright (c) 2024-2026 Code for History
|
|
260
|
+
|
|
261
|
+
詳細は[LICENSE](LICENSE)ファイルを参照してください。
|
|
262
|
+
|
|
263
|
+
## Quyuanからの移行
|
|
264
|
+
|
|
265
|
+
元のQuyuan実装から移行する場合:
|
|
266
|
+
|
|
267
|
+
1. インポートを`quyuan`から`@c4h/chuci`に変更
|
|
268
|
+
2. コンポーネント名は同じまま(`cc-swiper`、`cc-swiper-slide`など)
|
|
269
|
+
3. 3DモデルのURLはパイプ区切り形式を使用しなくなりました:
|
|
270
|
+
```html
|
|
271
|
+
<!-- 旧 -->
|
|
272
|
+
<cc-swiper-slide image-url="model.obj|model.mtl" ...>
|
|
273
|
+
|
|
274
|
+
<!-- 新 -->
|
|
275
|
+
<cc-swiper-slide image-url="model.obj" material-url="model.mtl" ...>
|
|
276
|
+
```
|
|
141
277
|
|
|
142
278
|
## クレジット
|
|
143
279
|
|
package/README.md
CHANGED
|
@@ -15,12 +15,39 @@ A standalone multimedia swiper and viewer web components library extracted from
|
|
|
15
15
|
- 📦 **Lightweight**: Optimized bundle size with tree-shaking support
|
|
16
16
|
- 🛠️ **TypeScript**: Full TypeScript support with type definitions
|
|
17
17
|
|
|
18
|
+
## Requirements
|
|
19
|
+
|
|
20
|
+
- **Node.js**: 20 or higher
|
|
21
|
+
- **Package Manager**: pnpm 9.0.0 or higher (recommended)
|
|
22
|
+
- **Browser**: Any modern browser supporting Web Components
|
|
23
|
+
- Chrome/Edge 79+
|
|
24
|
+
- Firefox 63+
|
|
25
|
+
- Safari 12.1+
|
|
26
|
+
|
|
18
27
|
## Installation
|
|
19
28
|
|
|
29
|
+
### Using pnpm (recommended)
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pnpm add @c4h/chuci
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Using npm
|
|
36
|
+
|
|
20
37
|
```bash
|
|
21
38
|
npm install @c4h/chuci
|
|
22
39
|
```
|
|
23
40
|
|
|
41
|
+
### CDN (Browser)
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<script src="https://cdn.jsdelivr.net/npm/@c4h/chuci@latest/dist/chuci.umd.js"></script>
|
|
45
|
+
<script>
|
|
46
|
+
// Components are available globally as Chuci
|
|
47
|
+
// Use custom elements directly in HTML
|
|
48
|
+
</script>
|
|
49
|
+
```
|
|
50
|
+
|
|
24
51
|
## Usage
|
|
25
52
|
|
|
26
53
|
### Basic Swiper
|
|
@@ -101,31 +128,51 @@ Main carousel component.
|
|
|
101
128
|
|
|
102
129
|
**Methods:**
|
|
103
130
|
- `openViewer(imageUrl: string, imageType: string, slideIndex?: number)`: Programmatically open viewer
|
|
131
|
+
- `imageUrl`: URL of the media to display
|
|
132
|
+
- `imageType`: Type of media (see supported types above)
|
|
133
|
+
- `slideIndex`: Optional slide index (default: 0)
|
|
104
134
|
|
|
105
135
|
**Events:**
|
|
106
136
|
- `slidechange`: Fired when slide changes
|
|
137
|
+
- `detail.activeIndex`: Current active slide index
|
|
138
|
+
|
|
139
|
+
**Properties:**
|
|
140
|
+
- `slider`: Access to underlying Swiper instance
|
|
107
141
|
|
|
108
142
|
### `<cc-swiper-slide>`
|
|
109
143
|
|
|
110
144
|
Individual slide component.
|
|
111
145
|
|
|
112
146
|
**Attributes:**
|
|
113
|
-
- `thumbnail-url`: URL for thumbnail image
|
|
114
|
-
- `image-url`: URL for full media
|
|
115
|
-
- `image-type`: Media type (see supported types above)
|
|
147
|
+
- `thumbnail-url`: URL for thumbnail image (required)
|
|
148
|
+
- `image-url`: URL for full media (required)
|
|
149
|
+
- `image-type`: Media type (see supported types above) (required)
|
|
116
150
|
- `caption`: Optional caption text
|
|
117
151
|
|
|
152
|
+
**3D Model & Gaussian Splatting Attributes:**
|
|
153
|
+
- `material-url`: Material file URL for 3D models (OBJ/MTL)
|
|
154
|
+
- `debug-mode`: Enable debug information display (`"true"` or `"false"`)
|
|
155
|
+
- `camera-position`: Initial camera position as `"x,y,z"` (e.g., `"0,1,5"`)
|
|
156
|
+
- `camera-target`: Camera target position as `"x,y,z"` (e.g., `"0,0,0"`)
|
|
157
|
+
- `show-texture`: Show/hide texture for 3D models (`"true"` or `"false"`)
|
|
158
|
+
- `fit-to-container`: Fit model to container size (`"true"` or `"false"`)
|
|
159
|
+
|
|
118
160
|
### Viewer Components
|
|
119
161
|
|
|
120
162
|
All viewer components inherit from `CcViewerBase` and support:
|
|
121
163
|
|
|
122
164
|
**Methods:**
|
|
123
|
-
- `open(url: string)`: Open viewer with media
|
|
165
|
+
- `open(url: string)`: Open viewer with media URL
|
|
124
166
|
- `close()`: Close viewer
|
|
125
167
|
|
|
126
168
|
**Properties:**
|
|
127
|
-
- `showPrevButton
|
|
128
|
-
- `showNextButton
|
|
169
|
+
- `showPrevButton` (boolean): Show/hide previous navigation button
|
|
170
|
+
- `showNextButton` (boolean): Show/hide next navigation button
|
|
171
|
+
|
|
172
|
+
**Events:**
|
|
173
|
+
- `close`: Fired when viewer is closed
|
|
174
|
+
- `navigate-prev`: Fired when previous button is clicked
|
|
175
|
+
- `navigate-next`: Fired when next button is clicked
|
|
129
176
|
|
|
130
177
|
### Media-specific Examples
|
|
131
178
|
|
|
@@ -173,17 +220,20 @@ cc-swiper {
|
|
|
173
220
|
--cc-slider-navigation-color: #007aff;
|
|
174
221
|
}
|
|
175
222
|
|
|
176
|
-
cc-viewer
|
|
223
|
+
cc-viewer-base,
|
|
224
|
+
cc-viewer-image,
|
|
225
|
+
cc-viewer-panorama,
|
|
226
|
+
cc-viewer-youtube,
|
|
227
|
+
cc-viewer-video,
|
|
228
|
+
cc-viewer-3dmodel,
|
|
229
|
+
cc-viewer-gaussian {
|
|
177
230
|
--cc-viewer-z-index: 1000;
|
|
178
231
|
}
|
|
179
232
|
```
|
|
180
233
|
|
|
181
234
|
## Browser Support
|
|
182
235
|
|
|
183
|
-
|
|
184
|
-
- Chrome/Edge 79+
|
|
185
|
-
- Firefox 63+
|
|
186
|
-
- Safari 12.1+
|
|
236
|
+
See [Requirements](#requirements) section for browser compatibility details.
|
|
187
237
|
|
|
188
238
|
## Development
|
|
189
239
|
|
|
@@ -203,7 +253,11 @@ pnpm run build
|
|
|
203
253
|
|
|
204
254
|
## License
|
|
205
255
|
|
|
206
|
-
MIT License
|
|
256
|
+
MIT License
|
|
257
|
+
|
|
258
|
+
Copyright (c) 2024-2026 Code for History
|
|
259
|
+
|
|
260
|
+
See [LICENSE](LICENSE) file for details.
|
|
207
261
|
|
|
208
262
|
## Migration from Quyuan
|
|
209
263
|
|