@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.
@@ -0,0 +1,203 @@
1
+ export declare class CcSwiper extends ChuciElement {
2
+ private slider?;
3
+ private divContainer?;
4
+ private divSlides?;
5
+ private divGallery?;
6
+ private divPagination?;
7
+ private divPrevious?;
8
+ private divNext?;
9
+ static get observedAttributes(): string[];
10
+ get hasThumb(): boolean;
11
+ get autoplay(): boolean;
12
+ get slides(): CcSwiperSlide[];
13
+ openViewer(imageUrl: string, imageType: string, slideIndex?: number): Promise<void>;
14
+ protected firstUpdated(): void;
15
+ protected render(): void;
16
+ private initializeSwiper;
17
+ }
18
+
19
+ export declare class CcSwiperSlide extends ChuciElement {
20
+ static get observedAttributes(): string[];
21
+ get thumbnailUrl(): string;
22
+ get imageUrl(): string;
23
+ get imageType(): string;
24
+ get caption(): string;
25
+ protected render(): void;
26
+ }
27
+
28
+ export declare class CcViewer extends ChuciElement {
29
+ private swiper;
30
+ private currentSlideIndex;
31
+ private currentType;
32
+ private boundHandleNavigatePrev?;
33
+ private boundHandleNavigateNext?;
34
+ open(imgUrl: string, type: string, attributes?: Record<string, any>): void;
35
+ protected firstUpdated(): void;
36
+ private handleNavigatePrev;
37
+ private handleNavigateNext;
38
+ private navigateToSlide;
39
+ private updateNavigationButtons;
40
+ private setNavigationVisibility;
41
+ setSwiper(swiper: any): void;
42
+ setCurrentSlideIndex(index: number): void;
43
+ protected render(): void;
44
+ }
45
+
46
+ export declare class CcViewer3DModel extends CcViewerBase {
47
+ private modelUrl;
48
+ private materialUrl;
49
+ private debugMode;
50
+ private cameraPosition;
51
+ private cameraTarget;
52
+ private showTexture;
53
+ private scene?;
54
+ private camera?;
55
+ private renderer?;
56
+ private controls?;
57
+ private animationId?;
58
+ private container?;
59
+ private currentModel?;
60
+ private originalMaterials;
61
+ private resizeObserver?;
62
+ private externalCanvas?;
63
+ static get observedAttributes(): string[];
64
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
65
+ protected doOpen(url: string): Promise<void>;
66
+ protected doClose(): void;
67
+ protected getViewerContent(): string;
68
+ protected getCustomStyles(): string;
69
+ protected onAfterRender(): void;
70
+ private cleanup;
71
+ private storeOriginalMaterials;
72
+ private toggleTexture;
73
+ private getCameraDebugInfo;
74
+ private getTargetDebugInfo;
75
+ private updateDebugInfo;
76
+ private initializeViewer;
77
+ private loadModel;
78
+ private animateLoop;
79
+ private handleResize;
80
+ }
81
+
82
+ export declare abstract class CcViewerBase extends ChuciElement {
83
+ private _showPrevButton;
84
+ private _showNextButton;
85
+ protected isShow: boolean;
86
+ protected isLoading: boolean;
87
+ get showPrevButton(): boolean;
88
+ set showPrevButton(value: boolean);
89
+ get showNextButton(): boolean;
90
+ set showNextButton(value: boolean);
91
+ protected abstract doOpen(url: string): void | Promise<void>;
92
+ protected abstract doClose(): void;
93
+ protected abstract getViewerContent(): string;
94
+ open(url: string): void;
95
+ close(): void;
96
+ protected cleanupNavigationListeners(): void;
97
+ protected render(): void;
98
+ protected shouldUseCustomRender(): boolean;
99
+ protected customRender(): void;
100
+ protected getCustomStyles(): string;
101
+ protected onAfterRender(): void;
102
+ protected navigatePrev(): void;
103
+ protected navigateNext(): void;
104
+ protected getNavigationButtons(): string;
105
+ protected getNavigationStyles(): string;
106
+ protected addNavigationListeners(): void;
107
+ protected updateNavigationVisibility(): void;
108
+ }
109
+
110
+ export declare class CcViewerGaussian extends CcViewerBase {
111
+ private splatUrl;
112
+ private debugMode;
113
+ private cameraPosition;
114
+ private _cameraTarget;
115
+ private scene?;
116
+ private camera?;
117
+ private renderer?;
118
+ private controls?;
119
+ private animationId?;
120
+ private canvas?;
121
+ private swiper?;
122
+ static get observedAttributes(): string[];
123
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
124
+ protected doOpen(url: string): Promise<void>;
125
+ protected doClose(): void;
126
+ protected getViewerContent(): string;
127
+ protected shouldUseCustomRender(): boolean;
128
+ protected customRender(): void;
129
+ private cleanup;
130
+ private getCameraDebugInfo;
131
+ private getTargetDebugInfo;
132
+ private updateDebugInfo;
133
+ private initializeViewer;
134
+ private handleResize;
135
+ }
136
+
137
+ export declare class CcViewerImage extends CcViewerBase {
138
+ private viewer?;
139
+ private container?;
140
+ private imageUrl;
141
+ protected doOpen(url: string): void;
142
+ protected doClose(): void;
143
+ protected getViewerContent(): string;
144
+ protected getCustomStyles(): string;
145
+ protected onAfterRender(): void;
146
+ }
147
+
148
+ export declare class CcViewerPanorama extends CcViewerBase {
149
+ private imgUrl;
150
+ static get observedAttributes(): string[];
151
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
152
+ protected doOpen(imgUrl: string): void;
153
+ protected doClose(): void;
154
+ protected getViewerContent(): string;
155
+ protected getCustomStyles(): string;
156
+ protected onAfterRender(): void;
157
+ }
158
+
159
+ export declare class CcViewerVideo extends CcViewerBase {
160
+ private videoUrl;
161
+ private fitToContainer;
162
+ static get observedAttributes(): string[];
163
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
164
+ protected doOpen(url: string): void;
165
+ protected doClose(): void;
166
+ protected getViewerContent(): string;
167
+ protected getCustomStyles(): string;
168
+ protected onAfterRender(): void;
169
+ private handleVideoError;
170
+ }
171
+
172
+ export declare class CcViewerYoutube extends CcViewerBase {
173
+ private videoUrl;
174
+ static get observedAttributes(): string[];
175
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
176
+ protected doOpen(videoUrl: string): void;
177
+ private extractYouTubeId;
178
+ protected doClose(): void;
179
+ protected getViewerContent(): string;
180
+ protected getCustomStyles(): string;
181
+ }
182
+
183
+ /**
184
+ * Base class for Chuci web components without Lit dependency
185
+ */
186
+ export declare abstract class ChuciElement extends HTMLElement {
187
+ private _shadowRoot;
188
+ private _connected;
189
+ constructor();
190
+ connectedCallback(): void;
191
+ disconnectedCallback(): void;
192
+ attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void;
193
+ protected firstUpdated(): void;
194
+ protected abstract render(): void;
195
+ protected html(strings: TemplateStringsArray, ...values: any[]): string;
196
+ protected css(strings: TemplateStringsArray, ...values: any[]): string;
197
+ protected updateShadowRoot(content: string): void;
198
+ protected query<T extends HTMLElement>(selector: string): T | null;
199
+ protected queryAll<T extends HTMLElement>(selector: string): NodeListOf<T>;
200
+ protected dispatch(eventName: string, detail?: any): void;
201
+ }
202
+
203
+ export { }
@@ -0,0 +1,241 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Chuci Demo</title>
7
+ <style>
8
+ body {
9
+ margin: 0;
10
+ padding: 20px;
11
+ font-family: Arial, sans-serif;
12
+ background: #f5f5f5;
13
+ }
14
+ .demo-container {
15
+ max-width: 800px;
16
+ margin: 0 auto;
17
+ background: white;
18
+ padding: 20px;
19
+ border-radius: 8px;
20
+ box-shadow: 0 2px 8px rgba(0,0,0,0.1);
21
+ }
22
+ h1 {
23
+ color: #333;
24
+ text-align: center;
25
+ }
26
+ .swiper-demo {
27
+ height: 400px;
28
+ margin: 20px 0;
29
+ }
30
+ .section {
31
+ margin: 40px 0;
32
+ }
33
+ h2 {
34
+ color: #555;
35
+ border-bottom: 2px solid #eee;
36
+ padding-bottom: 10px;
37
+ }
38
+ </style>
39
+ </head>
40
+ <body>
41
+ <div class="demo-container">
42
+ <h1>Chuci (楚辞) Demo</h1>
43
+
44
+ <div class="section">
45
+ <h2>Basic Swiper</h2>
46
+ <div class="swiper-demo">
47
+ <cc-swiper>
48
+ <cc-swiper-slide
49
+ thumbnail-url="https://picsum.photos/300/200?random=1"
50
+ image-url="https://picsum.photos/800/600?random=1"
51
+ image-type="image"
52
+ caption="First slide caption">
53
+ </cc-swiper-slide>
54
+ <cc-swiper-slide
55
+ thumbnail-url="https://picsum.photos/300/200?random=2"
56
+ image-url="https://picsum.photos/800/600?random=2"
57
+ image-type="image"
58
+ caption="Second slide caption">
59
+ </cc-swiper-slide>
60
+ <cc-swiper-slide
61
+ thumbnail-url="https://picsum.photos/300/200?random=3"
62
+ image-url="https://picsum.photos/800/600?random=3"
63
+ image-type="image"
64
+ caption="Third slide caption">
65
+ </cc-swiper-slide>
66
+ </cc-swiper>
67
+ </div>
68
+ </div>
69
+
70
+ <div class="section">
71
+ <h2>Swiper with Thumbnails</h2>
72
+ <div class="swiper-demo">
73
+ <cc-swiper has-thumb>
74
+ <cc-swiper-slide
75
+ thumbnail-url="https://picsum.photos/300/200?random=4"
76
+ image-url="https://picsum.photos/800/600?random=4"
77
+ image-type="image">
78
+ </cc-swiper-slide>
79
+ <cc-swiper-slide
80
+ thumbnail-url="https://picsum.photos/300/200?random=5"
81
+ image-url="https://picsum.photos/800/600?random=5"
82
+ image-type="image">
83
+ </cc-swiper-slide>
84
+ <cc-swiper-slide
85
+ thumbnail-url="https://picsum.photos/300/200?random=6"
86
+ image-url="https://picsum.photos/800/600?random=6"
87
+ image-type="image">
88
+ </cc-swiper-slide>
89
+ <cc-swiper-slide
90
+ thumbnail-url="https://picsum.photos/300/200?random=7"
91
+ image-url="https://picsum.photos/800/600?random=7"
92
+ image-type="image">
93
+ </cc-swiper-slide>
94
+ </cc-swiper>
95
+ </div>
96
+ </div>
97
+
98
+ <div class="section">
99
+ <h2>Autoplay Swiper</h2>
100
+ <div class="swiper-demo">
101
+ <cc-swiper autoplay>
102
+ <cc-swiper-slide
103
+ thumbnail-url="https://picsum.photos/300/200?random=8"
104
+ image-url="https://picsum.photos/800/600?random=8"
105
+ image-type="image">
106
+ </cc-swiper-slide>
107
+ <cc-swiper-slide
108
+ thumbnail-url="https://picsum.photos/300/200?random=9"
109
+ image-url="https://picsum.photos/800/600?random=9"
110
+ image-type="image">
111
+ </cc-swiper-slide>
112
+ <cc-swiper-slide
113
+ thumbnail-url="https://picsum.photos/300/200?random=10"
114
+ image-url="https://picsum.photos/800/600?random=10"
115
+ image-type="image">
116
+ </cc-swiper-slide>
117
+ </cc-swiper>
118
+ </div>
119
+ </div>
120
+
121
+ <div class="section">
122
+ <h2>All Media Types Demo</h2>
123
+ <p>Demonstrates all supported media types: Image, Panorama, YouTube, Video, 3D Model, and Gaussian Splatting</p>
124
+ <div class="swiper-demo">
125
+ <cc-swiper>
126
+ <!-- Regular Image -->
127
+ <cc-swiper-slide
128
+ thumbnail-url="https://images.unsplash.com/photo-1542281286-9e0a16bb7366?w=400"
129
+ image-url="https://images.unsplash.com/photo-1542281286-9e0a16bb7366?w=1600"
130
+ image-type="image"
131
+ caption="Regular Image">
132
+ </cc-swiper-slide>
133
+
134
+ <!-- 360° Panorama -->
135
+ <cc-swiper-slide
136
+ thumbnail-url="./assets/azumaya_panorama1.png"
137
+ image-url="./assets/azumaya_panorama1.png"
138
+ image-type="panorama"
139
+ caption="360° Panorama Image">
140
+ </cc-swiper-slide>
141
+
142
+ <!-- YouTube Video -->
143
+ <cc-swiper-slide
144
+ thumbnail-url="https://img.youtube.com/vi/dQw4w9WgXcQ/mqdefault.jpg"
145
+ image-url="https://www.youtube.com/watch?v=dQw4w9WgXcQ"
146
+ image-type="youtube"
147
+ caption="YouTube Video">
148
+ </cc-swiper-slide>
149
+
150
+ <!-- MP4 Video -->
151
+ <cc-swiper-slide
152
+ thumbnail-url="https://images.unsplash.com/photo-1536240478700-b869070f9279?w=400"
153
+ image-url="https://www.w3schools.com/html/mov_bbb.mp4"
154
+ image-type="video"
155
+ caption="MP4 Video File">
156
+ </cc-swiper-slide>
157
+
158
+ <!-- MP4 Video with fit-to-container -->
159
+ <cc-swiper-slide
160
+ thumbnail-url="https://images.unsplash.com/photo-1574375927938-d5a98e8ffe85?w=400"
161
+ image-url="https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4"
162
+ image-type="video"
163
+ caption="MP4 Video (fit-to-container)"
164
+ fit-to-container>
165
+ </cc-swiper-slide>
166
+
167
+ <!-- 3D Model (OBJ/MTL) -->
168
+ <cc-swiper-slide
169
+ thumbnail-url="https://images.unsplash.com/photo-1559827260-dc66d52bef19?w=400"
170
+ image-url="https://t.tilemap.jp/3ddata/okuman.obj"
171
+ material-url="https://t.tilemap.jp/3ddata/okuman.mtl"
172
+ image-type="3dmodel"
173
+ caption="3D OBJ/MTL Model (Debug Mode)"
174
+ debug-mode
175
+ camera-position="5,5,5"
176
+ camera-target="0,0,0">
177
+ </cc-swiper-slide>
178
+
179
+ <!-- Simple 3D Model (OBJ only, no material) -->
180
+ <cc-swiper-slide
181
+ thumbnail-url="https://images.unsplash.com/photo-1609205807490-b15b9d5d5a28?w=400"
182
+ image-url="https://raw.githubusercontent.com/mrdoob/three.js/dev/examples/models/obj/walt/WaltHead.obj"
183
+ image-type="3dmodel"
184
+ caption="Simple 3D Model (OBJ only)"
185
+ camera-position="0,0,100"
186
+ camera-target="0,0,0">
187
+ </cc-swiper-slide>
188
+
189
+ <!-- 3D Gaussian Splatting -->
190
+ <cc-swiper-slide
191
+ thumbnail-url="https://images.unsplash.com/photo-1633613286991-611fe299c4be?w=400"
192
+ image-url="https://t.tilemap.jp/3ddata/okuman.splat"
193
+ image-type="gaussian"
194
+ caption="Gaussian Splatting Model"
195
+ debug-mode>
196
+ </cc-swiper-slide>
197
+ </cc-swiper>
198
+ </div>
199
+ </div>
200
+
201
+ <div class="section">
202
+ <h2>Media Types with Thumbnails Navigation</h2>
203
+ <div class="swiper-demo">
204
+ <cc-swiper has-thumb>
205
+ <cc-swiper-slide
206
+ thumbnail-url="https://images.unsplash.com/photo-1542281286-9e0a16bb7366?w=400"
207
+ image-url="https://images.unsplash.com/photo-1542281286-9e0a16bb7366?w=1600"
208
+ image-type="image"
209
+ caption="Image with Thumbnail">
210
+ </cc-swiper-slide>
211
+
212
+ <cc-swiper-slide
213
+ thumbnail-url="./assets/azumaya_panorama1.png"
214
+ image-url="./assets/azumaya_panorama1.png"
215
+ image-type="panorama"
216
+ caption="Panorama with Thumbnail">
217
+ </cc-swiper-slide>
218
+
219
+ <cc-swiper-slide
220
+ thumbnail-url="https://img.youtube.com/vi/dQw4w9WgXcQ/mqdefault.jpg"
221
+ image-url="https://www.youtube.com/watch?v=dQw4w9WgXcQ"
222
+ image-type="youtube"
223
+ caption="YouTube with Thumbnail">
224
+ </cc-swiper-slide>
225
+
226
+ <cc-swiper-slide
227
+ thumbnail-url="https://images.unsplash.com/photo-1633613286991-611fe299c4be?w=400"
228
+ image-url="https://t.tilemap.jp/3ddata/okuman.splat"
229
+ image-type="gaussian"
230
+ caption="3DGS with Thumbnail"
231
+ camera-position="500,500,500"
232
+ camera-target="0,0,0">
233
+ </cc-swiper-slide>
234
+ </cc-swiper>
235
+ </div>
236
+ </div>
237
+ </div>
238
+
239
+ <script type="module" src="/src/index.ts"></script>
240
+ </body>
241
+ </html>
@@ -0,0 +1,63 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Generate Test Images</title>
6
+ </head>
7
+ <body>
8
+ <h1>Test Image Generator</h1>
9
+ <p>Save these canvases as images for testing:</p>
10
+
11
+ <div id="images"></div>
12
+
13
+ <script>
14
+ const colors = [
15
+ { bg: '#FF6B6B', name: 'Red' },
16
+ { bg: '#4ECDC4', name: 'Green' },
17
+ { bg: '#45B7D1', name: 'Blue' },
18
+ { bg: '#F7DC6F', name: 'Yellow' },
19
+ { bg: '#BB8FCE', name: 'Purple' },
20
+ { bg: '#85C1E2', name: 'Light Blue' }
21
+ ];
22
+
23
+ const container = document.getElementById('images');
24
+
25
+ colors.forEach((color, index) => {
26
+ // Thumbnail
27
+ const thumbCanvas = document.createElement('canvas');
28
+ thumbCanvas.width = 300;
29
+ thumbCanvas.height = 200;
30
+ const thumbCtx = thumbCanvas.getContext('2d');
31
+ thumbCtx.fillStyle = color.bg;
32
+ thumbCtx.fillRect(0, 0, 300, 200);
33
+ thumbCtx.fillStyle = '#FFF';
34
+ thumbCtx.font = '24px Arial';
35
+ thumbCtx.textAlign = 'center';
36
+ thumbCtx.fillText(`Thumb ${index + 1}`, 150, 100);
37
+
38
+ // Full size
39
+ const fullCanvas = document.createElement('canvas');
40
+ fullCanvas.width = 800;
41
+ fullCanvas.height = 600;
42
+ const fullCtx = fullCanvas.getContext('2d');
43
+ fullCtx.fillStyle = color.bg;
44
+ fullCtx.fillRect(0, 0, 800, 600);
45
+ fullCtx.fillStyle = '#FFF';
46
+ fullCtx.font = '48px Arial';
47
+ fullCtx.textAlign = 'center';
48
+ fullCtx.fillText(`Full Image ${index + 1}`, 400, 300);
49
+
50
+ const div = document.createElement('div');
51
+ div.innerHTML = `
52
+ <h3>${color.name} (${index + 1})</h3>
53
+ <p>Thumbnail (300x200):</p>
54
+ ${thumbCanvas.outerHTML}
55
+ <p>Full (800x600):</p>
56
+ ${fullCanvas.outerHTML}
57
+ <hr>
58
+ `;
59
+ container.appendChild(div);
60
+ });
61
+ </script>
62
+ </body>
63
+ </html>
package/package.json ADDED
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "@c4h/chuci",
3
+ "version": "0.1.0",
4
+ "description": "Standalone multimedia swiper and viewer web components",
5
+ "type": "module",
6
+ "private": false,
7
+ "main": "./dist/chuci.cjs",
8
+ "module": "./dist/chuci.js",
9
+ "browser": "./dist/chuci.umd.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "browser": "./dist/chuci.umd.js",
15
+ "import": "./dist/chuci.js",
16
+ "require": "./dist/chuci.cjs"
17
+ },
18
+ "./package.json": "./package.json",
19
+ "./dist/*": "./dist/*"
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "src",
24
+ "README.md",
25
+ "CHANGELOG.md",
26
+ "LICENSE"
27
+ ],
28
+ "scripts": {
29
+ "dev": "vite --host='0.0.0.0'",
30
+ "build": "npm run typecheck && cross-env BUILD_MODE=package vite build",
31
+ "typecheck": "tsc --noEmit",
32
+ "test": "vitest run",
33
+ "test:watch": "vitest",
34
+ "coverage": "vitest run --coverage",
35
+ "lint": "eslint src tests",
36
+ "lint:fix": "eslint src tests --fix",
37
+ "prepublishOnly": "npm run typecheck && npm run build"
38
+ },
39
+ "dependencies": {
40
+ "@photo-sphere-viewer/core": "^5.11.4",
41
+ "gsplat": "^1.2.4",
42
+ "swiper": "^11.1.15",
43
+ "three": "^0.171.0",
44
+ "viewerjs": "^1.11.7"
45
+ },
46
+ "devDependencies": {
47
+ "@eslint/js": "^9.17.0",
48
+ "@testing-library/dom": "^10.4.0",
49
+ "@testing-library/jest-dom": "^6.6.3",
50
+ "@types/jsdom": "^21.1.6",
51
+ "@types/node": "^22.10.2",
52
+ "@types/three": "^0.171.0",
53
+ "@typescript-eslint/eslint-plugin": "^8.18.2",
54
+ "@typescript-eslint/parser": "^8.18.2",
55
+ "@vitest/coverage-v8": "^3.2.4",
56
+ "cross-env": "^7.0.3",
57
+ "eslint": "^9.17.0",
58
+ "eslint-config-prettier": "^9.1.0",
59
+ "jsdom": "^25.0.1",
60
+ "prettier": "^3.4.2",
61
+ "typescript": "^5.7.2",
62
+ "vite": "^6.3.5",
63
+ "vite-plugin-dts": "^4.4.0",
64
+ "vitest": "^3.2.4"
65
+ },
66
+ "keywords": [
67
+ "swiper",
68
+ "viewer",
69
+ "webcomponents",
70
+ "multimedia",
71
+ "carousel",
72
+ "panorama",
73
+ "3d"
74
+ ],
75
+ "author": "Code for History",
76
+ "contributors": ["kobakazu0429 <kobakazu10@gmail.com>"],
77
+ "license": "MIT",
78
+ "repository": {
79
+ "type": "git",
80
+ "url": "git+https://github.com/code4history/Chuci.git"
81
+ },
82
+ "bugs": {
83
+ "url": "https://github.com/code4history/Chuci/issues"
84
+ },
85
+ "homepage": "https://github.com/code4history/Chuci#readme"
86
+ }
@@ -0,0 +1,50 @@
1
+ import { ChuciElement } from '@/utils/base-element'
2
+
3
+ export class CcSwiperSlide extends ChuciElement {
4
+ static get observedAttributes() {
5
+ return ['thumbnail-url', 'image-url', 'image-type', 'caption']
6
+ }
7
+
8
+ get thumbnailUrl() {
9
+ return this.getAttribute('thumbnail-url') || ''
10
+ }
11
+
12
+ get imageUrl() {
13
+ return this.getAttribute('image-url') || ''
14
+ }
15
+
16
+ get imageType() {
17
+ return this.getAttribute('image-type') || ''
18
+ }
19
+
20
+ get caption() {
21
+ return this.getAttribute('caption') || ''
22
+ }
23
+
24
+ protected render() {
25
+ const styles = this.css`
26
+ :host {
27
+ display: flex;
28
+ justify-content: center;
29
+ align-items: center;
30
+ height: 100%;
31
+ width: 100%;
32
+ background-size: cover !important;
33
+ background-repeat: no-repeat !important;
34
+ background-position: center !important;
35
+ }
36
+ `
37
+
38
+ this.updateShadowRoot(styles)
39
+ }
40
+ }
41
+
42
+ if (!customElements.get('cc-swiper-slide')) {
43
+ customElements.define('cc-swiper-slide', CcSwiperSlide)
44
+ }
45
+
46
+ declare global {
47
+ interface HTMLElementTagNameMap {
48
+ 'cc-swiper-slide': CcSwiperSlide
49
+ }
50
+ }
@@ -0,0 +1,29 @@
1
+ export const swiperStyles = `
2
+ :host {
3
+ display: block;
4
+ --swiper-theme-color: #007aff;
5
+ --swiper-navigation-size: 44px;
6
+ --swiper-navigation-color: #007aff;
7
+ }
8
+
9
+ .swiper {
10
+ width: 100%;
11
+ height: 100%;
12
+ }
13
+
14
+ .swiper-slide {
15
+ text-align: center;
16
+ font-size: 18px;
17
+ background: #fff;
18
+ display: flex;
19
+ justify-content: center;
20
+ align-items: center;
21
+ }
22
+
23
+ .swiper-slide img {
24
+ display: block;
25
+ width: 100%;
26
+ height: 100%;
27
+ object-fit: cover;
28
+ }
29
+ `