@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/dist/styles.js ADDED
@@ -0,0 +1,194 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `
3
+ :host {
4
+ --uibit-360-viewer-bg: #f9fafb;
5
+ --uibit-360-viewer-border: #e5e7eb;
6
+ --uibit-360-viewer-button-bg: rgba(255, 255, 255, 0.75);
7
+ --uibit-360-viewer-button-bg-hover: rgba(255, 255, 255, 0.95);
8
+ --uibit-360-viewer-button-color: #374151;
9
+ --uibit-360-viewer-focus-color: #000000;
10
+ --uibit-360-viewer-progress-track-bg: rgba(0, 0, 0, 0.08);
11
+ --uibit-360-viewer-hint-bg: rgba(17, 24, 39, 0.65);
12
+ display: block;
13
+ width: 100%;
14
+ }
15
+
16
+ .viewer {
17
+ position: relative;
18
+ width: 100%;
19
+ overflow: hidden;
20
+ background: var(--uibit-360-viewer-bg);
21
+ border: 0.0625rem solid var(--uibit-360-viewer-border);
22
+ touch-action: none;
23
+ user-select: none;
24
+ -webkit-user-drag: none;
25
+ outline: none;
26
+ min-height: 4rem;
27
+ }
28
+
29
+ .viewer:focus-visible {
30
+ box-shadow: 0 0 0 0.125rem var(--uibit-360-viewer-focus-color);
31
+ }
32
+
33
+ .frames {
34
+ position: relative;
35
+ width: 100%;
36
+ overflow: hidden;
37
+ }
38
+
39
+ .frames:not(.ready) {
40
+ visibility: hidden;
41
+ }
42
+
43
+ .frame {
44
+ position: absolute;
45
+ inset: 0;
46
+ width: 100%;
47
+ height: 100%;
48
+ object-fit: contain;
49
+ pointer-events: none;
50
+ user-select: none;
51
+ -webkit-user-drag: none;
52
+ opacity: 0;
53
+ will-change: opacity;
54
+ }
55
+
56
+ .frame-active {
57
+ opacity: 1;
58
+ }
59
+
60
+ @keyframes shimmer {
61
+ 0% { background-position: -200% 0; }
62
+ 100% { background-position: 200% 0; }
63
+ }
64
+
65
+ .skeleton {
66
+ position: absolute;
67
+ inset: 0;
68
+ background: linear-gradient(
69
+ 90deg,
70
+ var(--uibit-360-viewer-bg) 25%,
71
+ rgba(0, 0, 0, 0.06) 50%,
72
+ var(--uibit-360-viewer-bg) 75%
73
+ );
74
+ background-size: 200% 100%;
75
+ animation: shimmer 1.4s ease infinite;
76
+ aspect-ratio: inherit;
77
+ }
78
+
79
+ .nav-button {
80
+ position: absolute;
81
+ top: 50%;
82
+ transform: translateY(-50%);
83
+ background: var(--uibit-360-viewer-button-bg, rgba(255, 255, 255, 0.75));
84
+ backdrop-filter: blur(0.5rem);
85
+ -webkit-backdrop-filter: blur(0.5rem);
86
+ border: none;
87
+ color: var(--uibit-360-viewer-button-color, #111827);
88
+ width: 2.25rem;
89
+ height: 2.25rem;
90
+ border-radius: 9999rem;
91
+ display: flex;
92
+ align-items: center;
93
+ justify-content: center;
94
+ cursor: pointer;
95
+ opacity: 0;
96
+ z-index: 10;
97
+ box-shadow: none;
98
+ transition: opacity 250ms ease, background-color 150ms ease, color 150ms ease, transform 150ms ease;
99
+ }
100
+
101
+ .viewer:hover .nav-button,
102
+ .nav-button:focus-visible {
103
+ opacity: 1;
104
+ }
105
+
106
+ .nav-button:focus-visible {
107
+ outline: 0.125rem solid var(--uibit-360-viewer-focus-color, #000000);
108
+ outline-offset: 0.125rem;
109
+ }
110
+
111
+ .nav-button:hover {
112
+ background: var(--uibit-360-viewer-button-bg-hover, rgba(255, 255, 255, 0.95));
113
+ color: #000000;
114
+ box-shadow: none;
115
+ }
116
+
117
+ .nav-button-prev:hover {
118
+ transform: translateY(-50%) translateX(-0.125rem) scale(1.05);
119
+ }
120
+
121
+ .nav-button-next:hover {
122
+ transform: translateY(-50%) translateX(0.125rem) scale(1.05);
123
+ }
124
+
125
+ .nav-button:active {
126
+ transform: translateY(-50%) scale(0.95);
127
+ }
128
+
129
+ .nav-button-prev {
130
+ left: 0.75rem;
131
+ }
132
+
133
+ .nav-button-next {
134
+ right: 0.75rem;
135
+ }
136
+
137
+ .nav-button svg {
138
+ width: 1.125rem;
139
+ height: 1.125rem;
140
+ }
141
+
142
+ .drag-hint {
143
+ position: absolute;
144
+ bottom: 0.75rem;
145
+ left: 50%;
146
+ transform: translateX(-50%);
147
+ background: var(--uibit-360-viewer-hint-bg, rgba(17, 24, 39, 0.65));
148
+ color: #ffffff;
149
+ padding: 0.375rem 0.75rem;
150
+ border-radius: 9999rem;
151
+ font-size: 0.75rem;
152
+ pointer-events: none;
153
+ opacity: 0.85;
154
+ transition: opacity 300ms ease;
155
+ display: flex;
156
+ align-items: center;
157
+ gap: 0.375rem;
158
+ backdrop-filter: blur(0.25rem);
159
+ -webkit-backdrop-filter: blur(0.25rem);
160
+ z-index: 5;
161
+ }
162
+
163
+ .viewer.dragging .drag-hint {
164
+ opacity: 0;
165
+ }
166
+
167
+ .progress-track {
168
+ position: absolute;
169
+ bottom: 0;
170
+ left: 0;
171
+ width: 100%;
172
+ height: 0.1875rem;
173
+ background: var(--uibit-360-viewer-progress-track-bg, rgba(0, 0, 0, 0.08));
174
+ z-index: 5;
175
+ }
176
+
177
+ .progress-bar {
178
+ height: 100%;
179
+ background: var(--uibit-360-viewer-focus-color, #000000);
180
+ transition: width 100ms ease;
181
+ }
182
+
183
+ .sr-only {
184
+ position: absolute;
185
+ width: 0.0625rem;
186
+ height: 0.0625rem;
187
+ padding: 0;
188
+ margin: -0.0625rem;
189
+ overflow: hidden;
190
+ clip: rect(0, 0, 0, 0);
191
+ border: 0;
192
+ }
193
+ `;
194
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+LxB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type Viewer360 from './360-viewer';
2
+ export interface Hotspot360 {
3
+ id: string;
4
+ x: number;
5
+ y: number;
6
+ label?: string;
7
+ }
8
+ export interface Viewer360Config {
9
+ images: string[];
10
+ autoRotate?: boolean;
11
+ rotationSpeed?: number;
12
+ allowZoom?: boolean;
13
+ zoomLevel?: number;
14
+ }
15
+ declare global {
16
+ interface HTMLElementTagNameMap {
17
+ 'uibit-360-viewer': Viewer360;
18
+ }
19
+ }
20
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAE1C,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,OAAO,CAAC,MAAM,CAAC;IACf,UAAU,qBAAqB;QAC3B,kBAAkB,EAAE,SAAS,CAAC;KACjC;CACA"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,91 @@
1
+ {
2
+ "name": "@uibit/360-viewer",
3
+ "version": "0.1.0",
4
+ "description": "Interactive 360-degree image viewer component. Display products and objects from every angle with smooth mouse/touch dragging, auto-rotation, and preloading.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./360-viewer.css": "./dist/360-viewer.css",
14
+ "./custom-elements.json": "./custom-elements.json",
15
+ "./react": "./dist/frameworks/react/index.d.ts",
16
+ "./vue": "./dist/frameworks/vue/index.ts",
17
+ "./svelte": "./dist/frameworks/svelte/index.svelte",
18
+ "./angular": "./dist/frameworks/angular/index.ts",
19
+ "./solid": "./dist/frameworks/solid/index.d.ts",
20
+ "./astro": "./dist/frameworks/astro/index.astro",
21
+ "./qwik": "./dist/frameworks/qwik/index.tsx",
22
+ "./nuxt": "./dist/frameworks/nuxt/index.ts",
23
+ "./preact": "./dist/frameworks/preact/index.d.ts",
24
+ "./stencil": "./dist/frameworks/stencil/index.d.ts"
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "package.json",
29
+ "README.md",
30
+ "LICENSE",
31
+ "custom-elements.json"
32
+ ],
33
+ "keywords": [
34
+ "360-viewer",
35
+ "product-view",
36
+ "web-component",
37
+ "lit",
38
+ "interactive"
39
+ ],
40
+ "author": "Jonathan Rawlings",
41
+ "license": "MIT",
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "https://github.com/Rawlings/uibit",
45
+ "directory": "packages/components/360-viewer"
46
+ },
47
+ "dependencies": {
48
+ "lucide": "^1.24.0",
49
+ "@uibit/core": "0.1.0"
50
+ },
51
+ "devDependencies": {
52
+ "@types/node": "^20.19.43",
53
+ "lit": "^3.3.3",
54
+ "typescript": "7.0.2",
55
+ "@uibit/codegen": "0.1.0"
56
+ },
57
+ "peerDependencies": {
58
+ "lit": "^3.0.0",
59
+ "react": ">=18",
60
+ "vue": ">=3",
61
+ "svelte": ">=4 || ^5",
62
+ "@angular/core": ">=14"
63
+ },
64
+ "customElements": "custom-elements.json",
65
+ "peerDependenciesMeta": {
66
+ "react": {
67
+ "optional": true
68
+ },
69
+ "vue": {
70
+ "optional": true
71
+ },
72
+ "svelte": {
73
+ "optional": true
74
+ },
75
+ "@angular/core": {
76
+ "optional": true
77
+ }
78
+ },
79
+ "uibit": {
80
+ "id": "360-viewer",
81
+ "title": "360-Viewer",
82
+ "category": "Media",
83
+ "tagName": "uibit-360-viewer"
84
+ },
85
+ "scripts": {
86
+ "build": "cem analyze --globs 'src/**/*.ts' --litelement && uibit-codegen --package . && tsc",
87
+ "dev": "concurrently \"cem analyze --globs 'src/**/*.ts' --litelement --watch\" \"tsc --watch\"",
88
+ "analyze": "cem analyze --globs 'src/**/*.ts' --litelement",
89
+ "typecheck": "tsc --noEmit"
90
+ }
91
+ }