@uibit/360-viewer 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/LICENSE +21 -0
- package/README.md +22 -0
- package/custom-elements.json +461 -0
- package/dist/360-viewer.d.ts +57 -0
- package/dist/360-viewer.d.ts.map +1 -0
- package/dist/360-viewer.js +320 -0
- package/dist/360-viewer.js.map +1 -0
- package/dist/frameworks/angular/index.ts +50 -0
- package/dist/frameworks/astro/index.d.ts +10 -0
- package/dist/frameworks/nuxt/index.ts +7 -0
- package/dist/frameworks/preact/index.d.ts +17 -0
- package/dist/frameworks/qwik/index.tsx +10 -0
- package/dist/frameworks/react/index.d.ts +22 -0
- package/dist/frameworks/solid/index.d.ts +18 -0
- package/dist/frameworks/stencil/index.d.ts +16 -0
- package/dist/frameworks/svelte/index.svelte +51 -0
- package/dist/frameworks/vue/index.ts +28 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.d.ts +2 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +194 -0
- package/dist/styles.js.map +1 -0
- package/dist/types.d.ts +20 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +91 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 UIBit Contributors
|
|
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.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# 360 Viewer
|
|
2
|
+
|
|
3
|
+
[Interactive Demonstration](https://rawlings.github.io/uibit/viewer-360)
|
|
4
|
+
|
|
5
|
+
The 360 Viewer allows customers to explore products with tactile, interactive control. By converting a series of static images into an immersive, rotatable object, it provides a comprehensive look at physical products, building customer confidence and increasing conversion rates.
|
|
6
|
+
|
|
7
|
+
## Value Delivery
|
|
8
|
+
|
|
9
|
+
- **Purchase Confidence** – Customers can inspect details from any angle, simulating an in-store physical experience.
|
|
10
|
+
- **Enhanced Engagement** – Interactive product exploration increases session times and strengthens user connection to products.
|
|
11
|
+
- **Reduced Return Rates** – Detailed, multi-angle visual inspection ensures buyer expectations align with reality.
|
|
12
|
+
- **Tactile Responsiveness** – Supports smooth drag-to-rotate interactions on desktop and natural touch controls on mobile devices.
|
|
13
|
+
|
|
14
|
+
## Ideal Applications
|
|
15
|
+
|
|
16
|
+
- **E-Commerce Showcases** – Premium product displays for retail, luxury goods, and consumer electronics.
|
|
17
|
+
- **Interactive Catalogs** – Highlighting product features, textures, and craftsmanship.
|
|
18
|
+
- **Product Portfolios** – Clean, minimal galleries for designers and manufacturers.
|
|
19
|
+
|
|
20
|
+
## Further Information
|
|
21
|
+
|
|
22
|
+
Detailed design guidelines, customizable attributes, and integration examples are available on our documentation site.
|
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"readme": "",
|
|
4
|
+
"modules": [
|
|
5
|
+
{
|
|
6
|
+
"kind": "javascript-module",
|
|
7
|
+
"path": "src/360-viewer.ts",
|
|
8
|
+
"declarations": [
|
|
9
|
+
{
|
|
10
|
+
"kind": "class",
|
|
11
|
+
"description": "360° product viewer driven by an array of sequential images.\nSupports drag, touch, auto-rotation, and keyboard controls.",
|
|
12
|
+
"name": "Viewer360",
|
|
13
|
+
"cssProperties": [
|
|
14
|
+
{
|
|
15
|
+
"description": "Background color of the viewer container",
|
|
16
|
+
"name": "--uibit-360-viewer-bg",
|
|
17
|
+
"default": "#f9fafb"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"description": "Border color of the viewer container",
|
|
21
|
+
"name": "--uibit-360-viewer-border",
|
|
22
|
+
"default": "#e5e7eb"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"description": "Background of control buttons",
|
|
26
|
+
"name": "--uibit-360-viewer-button-bg",
|
|
27
|
+
"default": "rgba(255,255,255,0.75)"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"description": "Hover background of control buttons",
|
|
31
|
+
"name": "--uibit-360-viewer-button-bg-hover",
|
|
32
|
+
"default": "rgba(255,255,255,0.95)"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"description": "Icon/text color of control buttons",
|
|
36
|
+
"name": "--uibit-360-viewer-button-color",
|
|
37
|
+
"default": "#374151"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"description": "Focus outline color for interactive elements",
|
|
41
|
+
"name": "--uibit-360-viewer-focus-color",
|
|
42
|
+
"default": "#000000"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"description": "Background of the progress bar track",
|
|
46
|
+
"name": "--uibit-360-viewer-progress-track-bg",
|
|
47
|
+
"default": "rgba(0,0,0,0.08)"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"description": "Background of the drag hint overlay",
|
|
51
|
+
"name": "--uibit-360-viewer-hint-bg",
|
|
52
|
+
"default": "rgba(17,24,39,0.65)"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
"members": [
|
|
56
|
+
{
|
|
57
|
+
"kind": "field",
|
|
58
|
+
"name": "images",
|
|
59
|
+
"type": {
|
|
60
|
+
"text": "string[]"
|
|
61
|
+
},
|
|
62
|
+
"privacy": "private",
|
|
63
|
+
"default": "[]"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"kind": "field",
|
|
67
|
+
"name": "autoRotate",
|
|
68
|
+
"type": {
|
|
69
|
+
"text": "boolean"
|
|
70
|
+
},
|
|
71
|
+
"default": "false",
|
|
72
|
+
"description": "Automatically rotate through frames when no user interaction is occurring.",
|
|
73
|
+
"attribute": "auto-rotate"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"kind": "field",
|
|
77
|
+
"name": "rotationSpeed",
|
|
78
|
+
"type": {
|
|
79
|
+
"text": "number"
|
|
80
|
+
},
|
|
81
|
+
"default": "150",
|
|
82
|
+
"description": "Milliseconds between frames during auto-rotation. Lower values spin faster.",
|
|
83
|
+
"attribute": "rotation-speed"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"kind": "field",
|
|
87
|
+
"name": "dragSensitivity",
|
|
88
|
+
"type": {
|
|
89
|
+
"text": "number"
|
|
90
|
+
},
|
|
91
|
+
"default": "15",
|
|
92
|
+
"description": "Horizontal pixel distance a drag must travel before advancing one frame.",
|
|
93
|
+
"attribute": "drag-sensitivity"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"kind": "field",
|
|
97
|
+
"name": "showControls",
|
|
98
|
+
"type": {
|
|
99
|
+
"text": "boolean"
|
|
100
|
+
},
|
|
101
|
+
"default": "true",
|
|
102
|
+
"description": "Show the play/pause and directional control buttons.",
|
|
103
|
+
"attribute": "show-controls"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"kind": "field",
|
|
107
|
+
"name": "showProgressBar",
|
|
108
|
+
"type": {
|
|
109
|
+
"text": "boolean"
|
|
110
|
+
},
|
|
111
|
+
"default": "true",
|
|
112
|
+
"description": "Show the frame progress bar at the bottom of the viewer.",
|
|
113
|
+
"attribute": "show-progress-bar"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"kind": "field",
|
|
117
|
+
"name": "currentIndex",
|
|
118
|
+
"type": {
|
|
119
|
+
"text": "number"
|
|
120
|
+
},
|
|
121
|
+
"privacy": "private",
|
|
122
|
+
"default": "0"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"kind": "field",
|
|
126
|
+
"name": "isDragging",
|
|
127
|
+
"type": {
|
|
128
|
+
"text": "boolean"
|
|
129
|
+
},
|
|
130
|
+
"privacy": "private",
|
|
131
|
+
"default": "false"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"kind": "field",
|
|
135
|
+
"name": "firstFrameReady",
|
|
136
|
+
"type": {
|
|
137
|
+
"text": "boolean"
|
|
138
|
+
},
|
|
139
|
+
"privacy": "private",
|
|
140
|
+
"default": "false"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"kind": "field",
|
|
144
|
+
"name": "aspectRatio",
|
|
145
|
+
"type": {
|
|
146
|
+
"text": "string"
|
|
147
|
+
},
|
|
148
|
+
"privacy": "private",
|
|
149
|
+
"default": "'16 / 9'"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"kind": "field",
|
|
153
|
+
"name": "autoRotateTimer",
|
|
154
|
+
"type": {
|
|
155
|
+
"text": "number | undefined"
|
|
156
|
+
},
|
|
157
|
+
"privacy": "private"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"kind": "field",
|
|
161
|
+
"name": "resumeTimer",
|
|
162
|
+
"type": {
|
|
163
|
+
"text": "number | undefined"
|
|
164
|
+
},
|
|
165
|
+
"privacy": "private"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"kind": "field",
|
|
169
|
+
"name": "startX",
|
|
170
|
+
"type": {
|
|
171
|
+
"text": "number"
|
|
172
|
+
},
|
|
173
|
+
"privacy": "private",
|
|
174
|
+
"default": "0"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"kind": "field",
|
|
178
|
+
"name": "startImageIndex",
|
|
179
|
+
"type": {
|
|
180
|
+
"text": "number"
|
|
181
|
+
},
|
|
182
|
+
"privacy": "private",
|
|
183
|
+
"default": "0"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"kind": "method",
|
|
187
|
+
"name": "startAutoRotate",
|
|
188
|
+
"privacy": "private"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"kind": "method",
|
|
192
|
+
"name": "stopAutoRotate",
|
|
193
|
+
"privacy": "private"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"kind": "method",
|
|
197
|
+
"name": "scheduleAutoRotateResume",
|
|
198
|
+
"privacy": "private"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"kind": "method",
|
|
202
|
+
"name": "clearResumeTimer",
|
|
203
|
+
"privacy": "private"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"kind": "method",
|
|
207
|
+
"name": "handleFrameLoad",
|
|
208
|
+
"privacy": "private",
|
|
209
|
+
"parameters": [
|
|
210
|
+
{
|
|
211
|
+
"name": "e",
|
|
212
|
+
"type": {
|
|
213
|
+
"text": "Event"
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"name": "index",
|
|
218
|
+
"type": {
|
|
219
|
+
"text": "number"
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
]
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"kind": "method",
|
|
226
|
+
"name": "next"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"kind": "method",
|
|
230
|
+
"name": "prev"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"kind": "method",
|
|
234
|
+
"name": "emitChange",
|
|
235
|
+
"privacy": "private"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"kind": "method",
|
|
239
|
+
"name": "handlePointerDown",
|
|
240
|
+
"privacy": "private",
|
|
241
|
+
"parameters": [
|
|
242
|
+
{
|
|
243
|
+
"name": "e",
|
|
244
|
+
"type": {
|
|
245
|
+
"text": "PointerEvent"
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
]
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"kind": "method",
|
|
252
|
+
"name": "handlePointerMove",
|
|
253
|
+
"privacy": "private",
|
|
254
|
+
"parameters": [
|
|
255
|
+
{
|
|
256
|
+
"name": "e",
|
|
257
|
+
"type": {
|
|
258
|
+
"text": "PointerEvent"
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
]
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"kind": "method",
|
|
265
|
+
"name": "handlePointerUp",
|
|
266
|
+
"privacy": "private",
|
|
267
|
+
"parameters": [
|
|
268
|
+
{
|
|
269
|
+
"name": "e",
|
|
270
|
+
"type": {
|
|
271
|
+
"text": "PointerEvent"
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
]
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"kind": "method",
|
|
278
|
+
"name": "handleKeyDown",
|
|
279
|
+
"privacy": "private",
|
|
280
|
+
"parameters": [
|
|
281
|
+
{
|
|
282
|
+
"name": "e",
|
|
283
|
+
"type": {
|
|
284
|
+
"text": "KeyboardEvent"
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
]
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"kind": "method",
|
|
291
|
+
"name": "handleSlotChange",
|
|
292
|
+
"privacy": "private",
|
|
293
|
+
"parameters": [
|
|
294
|
+
{
|
|
295
|
+
"name": "e",
|
|
296
|
+
"type": {
|
|
297
|
+
"text": "Event"
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
]
|
|
301
|
+
}
|
|
302
|
+
],
|
|
303
|
+
"events": [
|
|
304
|
+
{
|
|
305
|
+
"type": {
|
|
306
|
+
"text": "{ index: number, total: number }"
|
|
307
|
+
},
|
|
308
|
+
"description": "Fired each time the displayed frame changes",
|
|
309
|
+
"name": "change"
|
|
310
|
+
}
|
|
311
|
+
],
|
|
312
|
+
"attributes": [
|
|
313
|
+
{
|
|
314
|
+
"name": "auto-rotate",
|
|
315
|
+
"type": {
|
|
316
|
+
"text": "boolean"
|
|
317
|
+
},
|
|
318
|
+
"default": "false",
|
|
319
|
+
"description": "Automatically rotate through frames when no user interaction is occurring.",
|
|
320
|
+
"fieldName": "autoRotate"
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"name": "rotation-speed",
|
|
324
|
+
"type": {
|
|
325
|
+
"text": "number"
|
|
326
|
+
},
|
|
327
|
+
"default": "150",
|
|
328
|
+
"description": "Milliseconds between frames during auto-rotation. Lower values spin faster.",
|
|
329
|
+
"fieldName": "rotationSpeed"
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"name": "drag-sensitivity",
|
|
333
|
+
"type": {
|
|
334
|
+
"text": "number"
|
|
335
|
+
},
|
|
336
|
+
"default": "15",
|
|
337
|
+
"description": "Horizontal pixel distance a drag must travel before advancing one frame.",
|
|
338
|
+
"fieldName": "dragSensitivity"
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"name": "show-controls",
|
|
342
|
+
"type": {
|
|
343
|
+
"text": "boolean"
|
|
344
|
+
},
|
|
345
|
+
"default": "true",
|
|
346
|
+
"description": "Show the play/pause and directional control buttons.",
|
|
347
|
+
"fieldName": "showControls"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"name": "show-progress-bar",
|
|
351
|
+
"type": {
|
|
352
|
+
"text": "boolean"
|
|
353
|
+
},
|
|
354
|
+
"default": "true",
|
|
355
|
+
"description": "Show the frame progress bar at the bottom of the viewer.",
|
|
356
|
+
"fieldName": "showProgressBar"
|
|
357
|
+
}
|
|
358
|
+
],
|
|
359
|
+
"superclass": {
|
|
360
|
+
"name": "UIBitElement",
|
|
361
|
+
"package": "@uibit/core"
|
|
362
|
+
},
|
|
363
|
+
"tagName": "uibit-360-viewer",
|
|
364
|
+
"customElement": true
|
|
365
|
+
}
|
|
366
|
+
],
|
|
367
|
+
"exports": [
|
|
368
|
+
{
|
|
369
|
+
"kind": "js",
|
|
370
|
+
"name": "Viewer360",
|
|
371
|
+
"declaration": {
|
|
372
|
+
"name": "Viewer360",
|
|
373
|
+
"module": "src/360-viewer.ts"
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
"kind": "custom-element-definition",
|
|
378
|
+
"name": "uibit-360-viewer",
|
|
379
|
+
"declaration": {
|
|
380
|
+
"name": "Viewer360",
|
|
381
|
+
"module": "src/360-viewer.ts"
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
"kind": "js",
|
|
386
|
+
"name": "default",
|
|
387
|
+
"declaration": {
|
|
388
|
+
"name": "Viewer360",
|
|
389
|
+
"module": "src/360-viewer.ts"
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
]
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
"kind": "javascript-module",
|
|
396
|
+
"path": "src/index.ts",
|
|
397
|
+
"declarations": [],
|
|
398
|
+
"exports": [
|
|
399
|
+
{
|
|
400
|
+
"kind": "js",
|
|
401
|
+
"name": "default",
|
|
402
|
+
"declaration": {
|
|
403
|
+
"name": "default",
|
|
404
|
+
"module": "./360-viewer"
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
"kind": "js",
|
|
409
|
+
"name": "Viewer360",
|
|
410
|
+
"declaration": {
|
|
411
|
+
"name": "Viewer360",
|
|
412
|
+
"module": "./360-viewer"
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
"kind": "js",
|
|
417
|
+
"name": "Viewer360Config",
|
|
418
|
+
"declaration": {
|
|
419
|
+
"name": "Viewer360Config",
|
|
420
|
+
"module": "./types"
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
"kind": "js",
|
|
425
|
+
"name": "Hotspot360",
|
|
426
|
+
"declaration": {
|
|
427
|
+
"name": "Hotspot360",
|
|
428
|
+
"module": "./types"
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
]
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
"kind": "javascript-module",
|
|
435
|
+
"path": "src/styles.ts",
|
|
436
|
+
"declarations": [
|
|
437
|
+
{
|
|
438
|
+
"kind": "variable",
|
|
439
|
+
"name": "styles",
|
|
440
|
+
"default": "css` :host { --uibit-360-viewer-bg: #f9fafb; --uibit-360-viewer-border: #e5e7eb; --uibit-360-viewer-button-bg: rgba(255, 255, 255, 0.75); --uibit-360-viewer-button-bg-hover: rgba(255, 255, 255, 0.95); --uibit-360-viewer-button-color: #374151; --uibit-360-viewer-focus-color: #000000; --uibit-360-viewer-progress-track-bg: rgba(0, 0, 0, 0.08); --uibit-360-viewer-hint-bg: rgba(17, 24, 39, 0.65); display: block; width: 100%; } .viewer { position: relative; width: 100%; overflow: hidden; background: var(--uibit-360-viewer-bg); border: 0.0625rem solid var(--uibit-360-viewer-border); touch-action: none; user-select: none; -webkit-user-drag: none; outline: none; min-height: 4rem; } .viewer:focus-visible { box-shadow: 0 0 0 0.125rem var(--uibit-360-viewer-focus-color); } .frames { position: relative; width: 100%; overflow: hidden; } .frames:not(.ready) { visibility: hidden; } .frame { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; -webkit-user-drag: none; opacity: 0; will-change: opacity; } .frame-active { opacity: 1; } @keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } } .skeleton { position: absolute; inset: 0; background: linear-gradient( 90deg, var(--uibit-360-viewer-bg) 25%, rgba(0, 0, 0, 0.06) 50%, var(--uibit-360-viewer-bg) 75% ); background-size: 200% 100%; animation: shimmer 1.4s ease infinite; aspect-ratio: inherit; } .nav-button { position: absolute; top: 50%; transform: translateY(-50%); background: var(--uibit-360-viewer-button-bg, rgba(255, 255, 255, 0.75)); backdrop-filter: blur(0.5rem); -webkit-backdrop-filter: blur(0.5rem); border: none; color: var(--uibit-360-viewer-button-color, #111827); width: 2.25rem; height: 2.25rem; border-radius: 9999rem; display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0; z-index: 10; box-shadow: none; transition: opacity 250ms ease, background-color 150ms ease, color 150ms ease, transform 150ms ease; } .viewer:hover .nav-button, .nav-button:focus-visible { opacity: 1; } .nav-button:focus-visible { outline: 0.125rem solid var(--uibit-360-viewer-focus-color, #000000); outline-offset: 0.125rem; } .nav-button:hover { background: var(--uibit-360-viewer-button-bg-hover, rgba(255, 255, 255, 0.95)); color: #000000; box-shadow: none; } .nav-button-prev:hover { transform: translateY(-50%) translateX(-0.125rem) scale(1.05); } .nav-button-next:hover { transform: translateY(-50%) translateX(0.125rem) scale(1.05); } .nav-button:active { transform: translateY(-50%) scale(0.95); } .nav-button-prev { left: 0.75rem; } .nav-button-next { right: 0.75rem; } .nav-button svg { width: 1.125rem; height: 1.125rem; } .drag-hint { position: absolute; bottom: 0.75rem; left: 50%; transform: translateX(-50%); background: var(--uibit-360-viewer-hint-bg, rgba(17, 24, 39, 0.65)); color: #ffffff; padding: 0.375rem 0.75rem; border-radius: 9999rem; font-size: 0.75rem; pointer-events: none; opacity: 0.85; transition: opacity 300ms ease; display: flex; align-items: center; gap: 0.375rem; backdrop-filter: blur(0.25rem); -webkit-backdrop-filter: blur(0.25rem); z-index: 5; } .viewer.dragging .drag-hint { opacity: 0; } .progress-track { position: absolute; bottom: 0; left: 0; width: 100%; height: 0.1875rem; background: var(--uibit-360-viewer-progress-track-bg, rgba(0, 0, 0, 0.08)); z-index: 5; } .progress-bar { height: 100%; background: var(--uibit-360-viewer-focus-color, #000000); transition: width 100ms ease; } .sr-only { position: absolute; width: 0.0625rem; height: 0.0625rem; padding: 0; margin: -0.0625rem; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; } `"
|
|
441
|
+
}
|
|
442
|
+
],
|
|
443
|
+
"exports": [
|
|
444
|
+
{
|
|
445
|
+
"kind": "js",
|
|
446
|
+
"name": "styles",
|
|
447
|
+
"declaration": {
|
|
448
|
+
"name": "styles",
|
|
449
|
+
"module": "src/styles.ts"
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
]
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
"kind": "javascript-module",
|
|
456
|
+
"path": "src/types.ts",
|
|
457
|
+
"declarations": [],
|
|
458
|
+
"exports": []
|
|
459
|
+
}
|
|
460
|
+
]
|
|
461
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { UIBitElement } from '@uibit/core';
|
|
2
|
+
/**
|
|
3
|
+
* 360° product viewer driven by an array of sequential images.
|
|
4
|
+
* Supports drag, touch, auto-rotation, and keyboard controls.
|
|
5
|
+
*
|
|
6
|
+
* @fires {{ index: number, total: number }} change - Fired each time the displayed frame changes
|
|
7
|
+
*
|
|
8
|
+
* @cssprop [--uibit-360-viewer-bg=#f9fafb] - Background color of the viewer container
|
|
9
|
+
* @cssprop [--uibit-360-viewer-border=#e5e7eb] - Border color of the viewer container
|
|
10
|
+
* @cssprop [--uibit-360-viewer-button-bg=rgba(255,255,255,0.75)] - Background of control buttons
|
|
11
|
+
* @cssprop [--uibit-360-viewer-button-bg-hover=rgba(255,255,255,0.95)] - Hover background of control buttons
|
|
12
|
+
* @cssprop [--uibit-360-viewer-button-color=#374151] - Icon/text color of control buttons
|
|
13
|
+
* @cssprop [--uibit-360-viewer-focus-color=#000000] - Focus outline color for interactive elements
|
|
14
|
+
* @cssprop [--uibit-360-viewer-progress-track-bg=rgba(0,0,0,0.08)] - Background of the progress bar track
|
|
15
|
+
* @cssprop [--uibit-360-viewer-hint-bg=rgba(17,24,39,0.65)] - Background of the drag hint overlay
|
|
16
|
+
*/
|
|
17
|
+
export declare class Viewer360 extends UIBitElement {
|
|
18
|
+
static styles: import("lit").CSSResult;
|
|
19
|
+
private images;
|
|
20
|
+
/** Automatically rotate through frames when no user interaction is occurring. */
|
|
21
|
+
autoRotate: boolean;
|
|
22
|
+
/** Milliseconds between frames during auto-rotation. Lower values spin faster. */
|
|
23
|
+
rotationSpeed: number;
|
|
24
|
+
/** Horizontal pixel distance a drag must travel before advancing one frame. */
|
|
25
|
+
dragSensitivity: number;
|
|
26
|
+
/** Show the play/pause and directional control buttons. */
|
|
27
|
+
showControls: boolean;
|
|
28
|
+
/** Show the frame progress bar at the bottom of the viewer. */
|
|
29
|
+
showProgressBar: boolean;
|
|
30
|
+
private currentIndex;
|
|
31
|
+
private isDragging;
|
|
32
|
+
private firstFrameReady;
|
|
33
|
+
private aspectRatio;
|
|
34
|
+
private autoRotateTimer?;
|
|
35
|
+
private resumeTimer?;
|
|
36
|
+
private startX;
|
|
37
|
+
private startImageIndex;
|
|
38
|
+
connectedCallback(): void;
|
|
39
|
+
disconnectedCallback(): void;
|
|
40
|
+
updated(changedProperties: Map<string, unknown>): void;
|
|
41
|
+
private startAutoRotate;
|
|
42
|
+
private stopAutoRotate;
|
|
43
|
+
private scheduleAutoRotateResume;
|
|
44
|
+
private clearResumeTimer;
|
|
45
|
+
private handleFrameLoad;
|
|
46
|
+
next(): void;
|
|
47
|
+
prev(): void;
|
|
48
|
+
private emitChange;
|
|
49
|
+
private handlePointerDown;
|
|
50
|
+
private handlePointerMove;
|
|
51
|
+
private handlePointerUp;
|
|
52
|
+
private handleKeyDown;
|
|
53
|
+
private handleSlotChange;
|
|
54
|
+
render(): import("lit").TemplateResult<1>;
|
|
55
|
+
}
|
|
56
|
+
export default Viewer360;
|
|
57
|
+
//# sourceMappingURL=360-viewer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"360-viewer.d.ts","sourceRoot":"","sources":["../src/360-viewer.ts"],"names":[],"mappings":"AACA,OAAO,EAA2C,YAAY,EAAE,MAAM,aAAa,CAAC;AAKpF;;;;;;;;;;;;;;GAcG;AACH,qBACa,SAAU,SAAQ,YAAY;IACzC,MAAM,CAAC,MAAM,0BAAU;IAEd,OAAO,CAAC,MAAM,CAAgB;IACvC,iFAAiF;IAC1B,UAAU,UAAS;IAC1E,kFAAkF;IACzB,aAAa,SAAO;IAC7E,+EAA+E;IACpB,eAAe,SAAM;IAChF,2DAA2D;IACF,YAAY,UAAQ;IAC7E,+DAA+D;IACF,eAAe,UAAQ;IAE3E,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,WAAW,CAAY;IAExC,OAAO,CAAC,eAAe,CAAC,CAAS;IACjC,OAAO,CAAC,WAAW,CAAC,CAAS;IAC7B,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,eAAe,CAAK;IAE5B,iBAAiB,SAEhB;IAED,oBAAoB,SAInB;IAED,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,QAa9C;IAED,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,wBAAwB;IAQhC,OAAO,CAAC,gBAAgB;IAOxB,OAAO,CAAC,eAAe;IAWvB,IAAI,SAIH;IAED,IAAI,SAIH;IAED,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,iBAAiB;IAczB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,aAAa;IAgBrB,OAAO,CAAC,gBAAgB;IAUxB,MAAM,oCA4FL;CACF;eAEc,SAAS"}
|