@c4h/chuci 0.2.3 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Code for History
3
+ Copyright (c) 2024-2026 Code for History
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.ja.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Chuci (楚辞)
2
2
 
3
+ [![CI](https://github.com/code4history/Chuci/actions/workflows/ci.yml/badge.svg)](https://github.com/code4history/Chuci/actions/workflows/ci.yml)
4
+ [![npm version](https://badge.fury.io/js/@c4h%2Fchuci.svg)](https://www.npmjs.com/package/@c4h/chuci)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](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
- 3DモデルとGaussianスプラット用:
94
- - `fit-to-container`: モデルをコンテナサイズに合わせる
95
- - `debug-mode`: デバッグ情報を表示
96
- - `camera-position`: 初期カメラ位置を設定(例: "0,0,5")
97
- - `camera-target`: カメラターゲットを設定(例: "0,0,0")
98
- - `show-texture`: テクスチャの表示/非表示(3Dモデル用)
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
- Web Componentsをサポートするすべてのモダンブラウザで動作:
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 - 詳細は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`: Show/hide previous button
128
- - `showNextButton`: Show/hide next button
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
- Works in all modern browsers that support Web Components:
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 - see LICENSE file for details.
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
 
package/dist/chuci.js CHANGED
@@ -21129,7 +21129,7 @@ class a_ extends os {
21129
21129
  ${this.modelUrl ? `
21130
21130
  ${this.isLoading ? '<div class="loading">Loading...</div>' : ""}
21131
21131
  ${!this.isLoading && this.debugMode ? `
21132
- <div class="debug-info" style="z-index: 1005;">
21132
+ <div class="debug-info" style="z-index: calc(var(--cc-viewer-z-index-each, 1000) + 5);">
21133
21133
  Camera Position: ${this.getCameraDebugInfo()}<br>
21134
21134
  Camera Target: ${this.getTargetDebugInfo()}<br>
21135
21135
  Controls: Rotate (drag), Zoom (scroll), Pan (right-drag)
@@ -21200,7 +21200,7 @@ class a_ extends os {
21200
21200
  font-size: 12px;
21201
21201
  border-radius: 4px;
21202
21202
  pointer-events: none;
21203
- z-index: 1010;
21203
+ z-index: calc(var(--cc-viewer-z-index-each, 1000) + 10);
21204
21204
  }
21205
21205
 
21206
21206
  .texture-toggle {
@@ -21214,7 +21214,7 @@ class a_ extends os {
21214
21214
  cursor: pointer;
21215
21215
  border-radius: 4px;
21216
21216
  transition: background 0.3s;
21217
- z-index: 1010;
21217
+ z-index: calc(var(--cc-viewer-z-index-each, 1000) + 10);
21218
21218
  pointer-events: auto;
21219
21219
  }
21220
21220
 
@@ -21394,7 +21394,7 @@ class o_ extends os {
21394
21394
  width: 100%;
21395
21395
  height: 100%;
21396
21396
  background-color: rgba(0, 0, 0, 0.9);
21397
- z-index: 1000;
21397
+ z-index: var(--cc-viewer-z-index-each, 1000);
21398
21398
  }
21399
21399
 
21400
21400
  .viewer {
@@ -21461,7 +21461,7 @@ class o_ extends os {
21461
21461
  pointer-events: none;
21462
21462
  white-space: pre-line;
21463
21463
  min-width: 200px;
21464
- z-index: 1003;
21464
+ z-index: calc(var(--cc-viewer-z-index-each, 1000) + 3);
21465
21465
  }
21466
21466
 
21467
21467
  ${this.getNavigationStyles()}
package/dist/chuci.umd.js CHANGED
@@ -4247,7 +4247,7 @@ void main() {
4247
4247
  ${this.modelUrl?`
4248
4248
  ${this.isLoading?'<div class="loading">Loading...</div>':""}
4249
4249
  ${!this.isLoading&&this.debugMode?`
4250
- <div class="debug-info" style="z-index: 1005;">
4250
+ <div class="debug-info" style="z-index: calc(var(--cc-viewer-z-index-each, 1000) + 5);">
4251
4251
  Camera Position: ${this.getCameraDebugInfo()}<br>
4252
4252
  Camera Target: ${this.getTargetDebugInfo()}<br>
4253
4253
  Controls: Rotate (drag), Zoom (scroll), Pan (right-drag)
@@ -4314,7 +4314,7 @@ void main() {
4314
4314
  font-size: 12px;
4315
4315
  border-radius: 4px;
4316
4316
  pointer-events: none;
4317
- z-index: 1010;
4317
+ z-index: calc(var(--cc-viewer-z-index-each, 1000) + 10);
4318
4318
  }
4319
4319
 
4320
4320
  .texture-toggle {
@@ -4328,7 +4328,7 @@ void main() {
4328
4328
  cursor: pointer;
4329
4329
  border-radius: 4px;
4330
4330
  transition: background 0.3s;
4331
- z-index: 1010;
4331
+ z-index: calc(var(--cc-viewer-z-index-each, 1000) + 10);
4332
4332
  pointer-events: auto;
4333
4333
  }
4334
4334
 
@@ -4355,7 +4355,7 @@ void main() {
4355
4355
  width: 100%;
4356
4356
  height: 100%;
4357
4357
  background-color: rgba(0, 0, 0, 0.9);
4358
- z-index: 1000;
4358
+ z-index: var(--cc-viewer-z-index-each, 1000);
4359
4359
  }
4360
4360
 
4361
4361
  .viewer {
@@ -4422,7 +4422,7 @@ void main() {
4422
4422
  pointer-events: none;
4423
4423
  white-space: pre-line;
4424
4424
  min-width: 200px;
4425
- z-index: 1003;
4425
+ z-index: calc(var(--cc-viewer-z-index-each, 1000) + 3);
4426
4426
  }
4427
4427
 
4428
4428
  ${this.getNavigationStyles()}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c4h/chuci",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Standalone multimedia swiper and viewer web components",
5
5
  "type": "module",
6
6
  "private": false,
@@ -74,7 +74,7 @@ export class CcViewer3DModel extends CcViewerBase {
74
74
  `
75
75
  ${this.isLoading ? '<div class="loading">Loading...</div>' : ''}
76
76
  ${!this.isLoading && this.debugMode ? `
77
- <div class="debug-info" style="z-index: 1005;">
77
+ <div class="debug-info" style="z-index: calc(var(--cc-viewer-z-index-each, 1000) + 5);">
78
78
  Camera Position: ${this.getCameraDebugInfo()}<br>
79
79
  Camera Target: ${this.getTargetDebugInfo()}<br>
80
80
  Controls: Rotate (drag), Zoom (scroll), Pan (right-drag)
@@ -150,7 +150,7 @@ export class CcViewer3DModel extends CcViewerBase {
150
150
  font-size: 12px;
151
151
  border-radius: 4px;
152
152
  pointer-events: none;
153
- z-index: 1010;
153
+ z-index: calc(var(--cc-viewer-z-index-each, 1000) + 10);
154
154
  }
155
155
 
156
156
  .texture-toggle {
@@ -164,7 +164,7 @@ export class CcViewer3DModel extends CcViewerBase {
164
164
  cursor: pointer;
165
165
  border-radius: 4px;
166
166
  transition: background 0.3s;
167
- z-index: 1010;
167
+ z-index: calc(var(--cc-viewer-z-index-each, 1000) + 10);
168
168
  pointer-events: auto;
169
169
  }
170
170
 
@@ -75,7 +75,7 @@ export class CcViewerGaussian extends CcViewerBase {
75
75
  width: 100%;
76
76
  height: 100%;
77
77
  background-color: rgba(0, 0, 0, 0.9);
78
- z-index: 1000;
78
+ z-index: var(--cc-viewer-z-index-each, 1000);
79
79
  }
80
80
 
81
81
  .viewer {
@@ -142,7 +142,7 @@ export class CcViewerGaussian extends CcViewerBase {
142
142
  pointer-events: none;
143
143
  white-space: pre-line;
144
144
  min-width: 200px;
145
- z-index: 1003;
145
+ z-index: calc(var(--cc-viewer-z-index-each, 1000) + 3);
146
146
  }
147
147
 
148
148
  ${this.getNavigationStyles()}