@c4h/chuci 0.1.0
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 +33 -0
- package/LICENSE +21 -0
- package/README.ja.md +144 -0
- package/README.md +225 -0
- package/dist/assets/azumaya_panorama1.png +0 -0
- package/dist/chuci.cjs +4483 -0
- package/dist/chuci.js +21710 -0
- package/dist/chuci.umd.js +4737 -0
- package/dist/index-8VMexD2a.cjs +255 -0
- package/dist/index-kvsisbKS.js +2125 -0
- package/dist/index.d.ts +203 -0
- package/dist/index.html +241 -0
- package/dist/test-image.html +63 -0
- package/package.json +86 -0
- package/src/components/swiper/cc-swiper-slide.ts +50 -0
- package/src/components/swiper/cc-swiper-styles.ts +29 -0
- package/src/components/swiper/cc-swiper.ts +362 -0
- package/src/components/swiper/swiper-styles.css +5 -0
- package/src/components/viewer/cc-viewer-3dmodel.ts +492 -0
- package/src/components/viewer/cc-viewer-base.ts +279 -0
- package/src/components/viewer/cc-viewer-gaussian.ts +381 -0
- package/src/components/viewer/cc-viewer-image.ts +190 -0
- package/src/components/viewer/cc-viewer-panorama.ts +86 -0
- package/src/components/viewer/cc-viewer-styles.ts +56 -0
- package/src/components/viewer/cc-viewer-video.ts +110 -0
- package/src/components/viewer/cc-viewer-youtube.ts +76 -0
- package/src/components/viewer/cc-viewer.ts +291 -0
- package/src/index.ts +25 -0
- package/src/types/css-modules.d.ts +1 -0
- package/src/types/global.d.ts +11 -0
- package/src/utils/base-element.ts +77 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2025-01-13
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Initial release of Chuci Web Components library
|
|
12
|
+
- `cc-swiper` component for creating multimedia carousels
|
|
13
|
+
- `cc-swiper-slide` component for individual carousel slides
|
|
14
|
+
- `cc-viewer` base viewer component with navigation support
|
|
15
|
+
- `cc-viewer-image` for displaying images with ViewerJS integration
|
|
16
|
+
- `cc-viewer-video` for HTML5 video playback
|
|
17
|
+
- `cc-viewer-youtube` for YouTube video embedding
|
|
18
|
+
- `cc-viewer-panorama` for 360° panoramic images
|
|
19
|
+
- `cc-viewer-3dmodel` for 3D model viewing with Three.js
|
|
20
|
+
- `cc-viewer-gaussian` for Gaussian Splatting visualization
|
|
21
|
+
- TypeScript type definitions
|
|
22
|
+
- ESM, CommonJS, and UMD build outputs
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
- Shadow DOM rendering issues for WebGL-based viewers (3D Model and Gaussian)
|
|
26
|
+
- Navigation button event handling across all viewer types
|
|
27
|
+
- Duplicate event listener registration
|
|
28
|
+
- ViewerJS timing issues in image viewer
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
- Unified viewer implementation using Template Method pattern
|
|
32
|
+
- Simplified 3D model data format from pipe-separated to separate attributes
|
|
33
|
+
- Migrated to Code4History standards with @c4h scope
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Code for History
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.ja.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Chuci (楚辞)
|
|
2
|
+
|
|
3
|
+
[Quyuan](https://github.com/code4history/Quyuan)から抽出されたスタンドアロンのマルチメディアスワイパーとビューアWebコンポーネントライブラリです。フレームワークに依存せず、タッチ対応のカルーセルとマルチメディアビューアを提供します。
|
|
4
|
+
|
|
5
|
+
## 特徴
|
|
6
|
+
|
|
7
|
+
- 🚀 **フレームワーク非依存**: 純粋なWeb Components、任意のフレームワークまたはバニラJSで動作
|
|
8
|
+
- 📱 **タッチ対応**: Swiper.jsをベースとしたスムーズなタッチ操作
|
|
9
|
+
- 🎬 **複数のメディアタイプ**: 画像、パノラマ、動画、YouTube、3Dモデル、Gaussianスプラットに対応
|
|
10
|
+
- 🔧 **ゼロ依存関係**: すべての依存関係がバンドル済み(Lit依存なし)
|
|
11
|
+
- 📦 **軽量**: tree-shakingサポートによる最適化されたバンドルサイズ
|
|
12
|
+
- 🛠️ **TypeScript**: 型定義付きの完全なTypeScriptサポート
|
|
13
|
+
|
|
14
|
+
## インストール
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @c4h/chuci
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 使用方法
|
|
21
|
+
|
|
22
|
+
### 基本的なスワイパー
|
|
23
|
+
|
|
24
|
+
```html
|
|
25
|
+
<cc-swiper>
|
|
26
|
+
<cc-swiper-slide
|
|
27
|
+
thumbnail-url="thumb1.jpg"
|
|
28
|
+
image-url="full1.jpg"
|
|
29
|
+
image-type="image"
|
|
30
|
+
caption="最初の画像">
|
|
31
|
+
</cc-swiper-slide>
|
|
32
|
+
<cc-swiper-slide
|
|
33
|
+
thumbnail-url="thumb2.jpg"
|
|
34
|
+
image-url="full2.jpg"
|
|
35
|
+
image-type="image"
|
|
36
|
+
caption="2番目の画像">
|
|
37
|
+
</cc-swiper-slide>
|
|
38
|
+
</cc-swiper>
|
|
39
|
+
|
|
40
|
+
<script type="module">
|
|
41
|
+
import '@c4h/chuci'
|
|
42
|
+
</script>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### サムネイルギャラリー付き
|
|
46
|
+
|
|
47
|
+
```html
|
|
48
|
+
<cc-swiper has-thumb>
|
|
49
|
+
<cc-swiper-slide thumbnail-url="..." image-url="..." image-type="image"></cc-swiper-slide>
|
|
50
|
+
<cc-swiper-slide thumbnail-url="..." image-url="..." image-type="image"></cc-swiper-slide>
|
|
51
|
+
</cc-swiper>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 自動再生
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<cc-swiper autoplay>
|
|
58
|
+
<!-- スライド -->
|
|
59
|
+
</cc-swiper>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## サポートされるメディアタイプ
|
|
63
|
+
|
|
64
|
+
- **image**: 通常の画像(jpg, png, gif など)
|
|
65
|
+
- **panorama**: 360°パノラマ画像
|
|
66
|
+
- **youtube**: YouTube動画(YouTube URLを提供)
|
|
67
|
+
- **video**: HTML5動画(mp4, webm など)
|
|
68
|
+
- **3dmodel**: 3Dモデル(OBJ/MTL形式)
|
|
69
|
+
- **gaussian**: Gaussianスプラッティングファイル(.splat, .ply)
|
|
70
|
+
|
|
71
|
+
## コンポーネント
|
|
72
|
+
|
|
73
|
+
### `<cc-swiper>`
|
|
74
|
+
|
|
75
|
+
メインのカルーセルコンポーネント。
|
|
76
|
+
|
|
77
|
+
**属性:**
|
|
78
|
+
- `has-thumb`: サムネイルギャラリーを表示
|
|
79
|
+
- `autoplay`: 自動再生を有効化
|
|
80
|
+
|
|
81
|
+
### `<cc-swiper-slide>`
|
|
82
|
+
|
|
83
|
+
個別のスライドコンポーネント。
|
|
84
|
+
|
|
85
|
+
**属性:**
|
|
86
|
+
- `thumbnail-url`: サムネイル画像のURL
|
|
87
|
+
- `image-url`: フルメディアのURL
|
|
88
|
+
- `image-type`: メディアタイプ(上記のサポートされるタイプを参照)
|
|
89
|
+
- `caption`: オプションのキャプションテキスト
|
|
90
|
+
|
|
91
|
+
### ビューア固有の属性
|
|
92
|
+
|
|
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モデル用)
|
|
99
|
+
|
|
100
|
+
## スタイリング
|
|
101
|
+
|
|
102
|
+
CSSカスタムプロパティ:
|
|
103
|
+
|
|
104
|
+
```css
|
|
105
|
+
cc-swiper {
|
|
106
|
+
--cc-slider-theme-color: #007aff;
|
|
107
|
+
--cc-slider-navigation-color: #007aff;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
cc-viewer {
|
|
111
|
+
--cc-viewer-z-index: 1000;
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## ブラウザサポート
|
|
116
|
+
|
|
117
|
+
Web Componentsをサポートするすべてのモダンブラウザで動作:
|
|
118
|
+
- Chrome/Edge 79+
|
|
119
|
+
- Firefox 63+
|
|
120
|
+
- Safari 12.1+
|
|
121
|
+
|
|
122
|
+
## 開発
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# 依存関係のインストール
|
|
126
|
+
pnpm install
|
|
127
|
+
|
|
128
|
+
# 開発サーバーの起動
|
|
129
|
+
pnpm run dev
|
|
130
|
+
|
|
131
|
+
# テストの実行
|
|
132
|
+
pnpm test
|
|
133
|
+
|
|
134
|
+
# ライブラリのビルド
|
|
135
|
+
pnpm run build
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## ライセンス
|
|
139
|
+
|
|
140
|
+
MIT License - 詳細はLICENSEファイルを参照してください。
|
|
141
|
+
|
|
142
|
+
## クレジット
|
|
143
|
+
|
|
144
|
+
Code for Historyによる[Quyuan](https://github.com/code4history/Quyuan)から抽出。
|
package/README.md
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# Chuci (楚辞)
|
|
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
|
+
A standalone multimedia swiper and viewer web components library extracted from [Quyuan](https://github.com/code4history/Quyuan). Provides touch-enabled carousel and multimedia viewers without any framework dependencies.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- 🚀 **Framework-agnostic**: Pure Web Components, works with any framework or vanilla JS
|
|
12
|
+
- 📱 **Touch-enabled**: Built on Swiper.js for smooth touch interactions
|
|
13
|
+
- 🎬 **Multiple media types**: Support for images, panoramas, videos, YouTube, 3D models, and Gaussian splats
|
|
14
|
+
- 🔧 **Zero dependencies**: All dependencies are bundled (no Lit dependency)
|
|
15
|
+
- 📦 **Lightweight**: Optimized bundle size with tree-shaking support
|
|
16
|
+
- 🛠️ **TypeScript**: Full TypeScript support with type definitions
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @c4h/chuci
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
### Basic Swiper
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<cc-swiper>
|
|
30
|
+
<cc-swiper-slide
|
|
31
|
+
thumbnail-url="thumb1.jpg"
|
|
32
|
+
image-url="full1.jpg"
|
|
33
|
+
image-type="image"
|
|
34
|
+
caption="First image">
|
|
35
|
+
</cc-swiper-slide>
|
|
36
|
+
<cc-swiper-slide
|
|
37
|
+
thumbnail-url="thumb2.jpg"
|
|
38
|
+
image-url="full2.jpg"
|
|
39
|
+
image-type="image"
|
|
40
|
+
caption="Second image">
|
|
41
|
+
</cc-swiper-slide>
|
|
42
|
+
</cc-swiper>
|
|
43
|
+
|
|
44
|
+
<script type="module">
|
|
45
|
+
import '@c4h/chuci'
|
|
46
|
+
</script>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Programmatic Usage
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
import '@c4h/chuci';
|
|
53
|
+
|
|
54
|
+
// Get swiper element
|
|
55
|
+
const swiper = document.querySelector('cc-swiper');
|
|
56
|
+
|
|
57
|
+
// Open viewer programmatically
|
|
58
|
+
swiper.openViewer('path/to/image.jpg', 'image', 0);
|
|
59
|
+
|
|
60
|
+
// Listen to slide changes
|
|
61
|
+
swiper.addEventListener('slidechange', (e) => {
|
|
62
|
+
console.log('Current slide:', e.detail.activeIndex);
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### With Thumbnails Gallery
|
|
67
|
+
|
|
68
|
+
```html
|
|
69
|
+
<cc-swiper has-thumb>
|
|
70
|
+
<cc-swiper-slide thumbnail-url="..." image-url="..." image-type="image"></cc-swiper-slide>
|
|
71
|
+
<cc-swiper-slide thumbnail-url="..." image-url="..." image-type="image"></cc-swiper-slide>
|
|
72
|
+
</cc-swiper>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Autoplay
|
|
76
|
+
|
|
77
|
+
```html
|
|
78
|
+
<cc-swiper autoplay>
|
|
79
|
+
<!-- slides -->
|
|
80
|
+
</cc-swiper>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Supported Media Types
|
|
84
|
+
|
|
85
|
+
- **image**: Regular images (jpg, png, gif, etc.)
|
|
86
|
+
- **panorama**: 360° panoramic images
|
|
87
|
+
- **youtube**: YouTube videos (provide YouTube URL)
|
|
88
|
+
- **video**: HTML5 videos (mp4, webm, etc.)
|
|
89
|
+
- **3dmodel**: 3D models (OBJ/MTL format)
|
|
90
|
+
- **gaussian**: Gaussian splatting files (.splat, .ply)
|
|
91
|
+
|
|
92
|
+
## Components
|
|
93
|
+
|
|
94
|
+
### `<cc-swiper>`
|
|
95
|
+
|
|
96
|
+
Main carousel component.
|
|
97
|
+
|
|
98
|
+
**Attributes:**
|
|
99
|
+
- `has-thumb`: Show thumbnail gallery
|
|
100
|
+
- `autoplay`: Enable autoplay
|
|
101
|
+
|
|
102
|
+
**Methods:**
|
|
103
|
+
- `openViewer(imageUrl: string, imageType: string, slideIndex?: number)`: Programmatically open viewer
|
|
104
|
+
|
|
105
|
+
**Events:**
|
|
106
|
+
- `slidechange`: Fired when slide changes
|
|
107
|
+
|
|
108
|
+
### `<cc-swiper-slide>`
|
|
109
|
+
|
|
110
|
+
Individual slide component.
|
|
111
|
+
|
|
112
|
+
**Attributes:**
|
|
113
|
+
- `thumbnail-url`: URL for thumbnail image
|
|
114
|
+
- `image-url`: URL for full media
|
|
115
|
+
- `image-type`: Media type (see supported types above)
|
|
116
|
+
- `caption`: Optional caption text
|
|
117
|
+
|
|
118
|
+
### Viewer Components
|
|
119
|
+
|
|
120
|
+
All viewer components inherit from `CcViewerBase` and support:
|
|
121
|
+
|
|
122
|
+
**Methods:**
|
|
123
|
+
- `open(url: string)`: Open viewer with media
|
|
124
|
+
- `close()`: Close viewer
|
|
125
|
+
|
|
126
|
+
**Properties:**
|
|
127
|
+
- `showPrevButton`: Show/hide previous button
|
|
128
|
+
- `showNextButton`: Show/hide next button
|
|
129
|
+
|
|
130
|
+
### Media-specific Examples
|
|
131
|
+
|
|
132
|
+
#### 3D Model Viewer
|
|
133
|
+
```html
|
|
134
|
+
<cc-swiper-slide
|
|
135
|
+
thumbnail-url="thumb.jpg"
|
|
136
|
+
image-url="model.obj"
|
|
137
|
+
image-type="3dmodel"
|
|
138
|
+
material-url="model.mtl"
|
|
139
|
+
debug-mode="true"
|
|
140
|
+
camera-position="0,1,5"
|
|
141
|
+
camera-target="0,0,0"
|
|
142
|
+
show-texture="true">
|
|
143
|
+
</cc-swiper-slide>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
#### Gaussian Splatting Viewer
|
|
147
|
+
```html
|
|
148
|
+
<cc-swiper-slide
|
|
149
|
+
thumbnail-url="thumb.jpg"
|
|
150
|
+
image-url="scene.splat"
|
|
151
|
+
image-type="gaussian"
|
|
152
|
+
debug-mode="true"
|
|
153
|
+
camera-position="0,0,10">
|
|
154
|
+
</cc-swiper-slide>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
#### YouTube Video
|
|
158
|
+
```html
|
|
159
|
+
<cc-swiper-slide
|
|
160
|
+
thumbnail-url="thumb.jpg"
|
|
161
|
+
image-url="https://www.youtube.com/watch?v=VIDEO_ID"
|
|
162
|
+
image-type="youtube">
|
|
163
|
+
</cc-swiper-slide>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Styling
|
|
167
|
+
|
|
168
|
+
CSS Custom Properties:
|
|
169
|
+
|
|
170
|
+
```css
|
|
171
|
+
cc-swiper {
|
|
172
|
+
--cc-slider-theme-color: #007aff;
|
|
173
|
+
--cc-slider-navigation-color: #007aff;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
cc-viewer {
|
|
177
|
+
--cc-viewer-z-index: 1000;
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Browser Support
|
|
182
|
+
|
|
183
|
+
Works in all modern browsers that support Web Components:
|
|
184
|
+
- Chrome/Edge 79+
|
|
185
|
+
- Firefox 63+
|
|
186
|
+
- Safari 12.1+
|
|
187
|
+
|
|
188
|
+
## Development
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# Install dependencies
|
|
192
|
+
pnpm install
|
|
193
|
+
|
|
194
|
+
# Start development server
|
|
195
|
+
pnpm run dev
|
|
196
|
+
|
|
197
|
+
# Run tests
|
|
198
|
+
pnpm test
|
|
199
|
+
|
|
200
|
+
# Build library
|
|
201
|
+
pnpm run build
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## License
|
|
205
|
+
|
|
206
|
+
MIT License - see LICENSE file for details.
|
|
207
|
+
|
|
208
|
+
## Migration from Quyuan
|
|
209
|
+
|
|
210
|
+
If you're migrating from the original Quyuan implementation:
|
|
211
|
+
|
|
212
|
+
1. Change imports from `quyuan` to `@c4h/chuci`
|
|
213
|
+
2. Component names remain the same (`cc-swiper`, `cc-swiper-slide`, etc.)
|
|
214
|
+
3. 3D model URLs no longer use pipe-separated format:
|
|
215
|
+
```html
|
|
216
|
+
<!-- Old -->
|
|
217
|
+
<cc-swiper-slide image-url="model.obj|model.mtl" ...>
|
|
218
|
+
|
|
219
|
+
<!-- New -->
|
|
220
|
+
<cc-swiper-slide image-url="model.obj" material-url="model.mtl" ...>
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Credits
|
|
224
|
+
|
|
225
|
+
Extracted from [Quyuan](https://github.com/code4history/Quyuan) by Code for History.
|
|
Binary file
|