@robinandeer/rtc-session-components 0.1.0 → 0.2.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,193 @@
1
+ /* src/styles.css */
2
+ :root {
3
+ --avatar-bg-connecting: #1a1a1a;
4
+ --avatar-radius: 16px;
5
+ --avatar-control-bg: rgba(255, 255, 255, 0.1);
6
+ --avatar-control-bg-hover: rgba(255, 255, 255, 0.2);
7
+ --avatar-control-size: 48px;
8
+ --avatar-end-call-bg: #ef4444;
9
+ --avatar-end-call-bg-hover: #dc2626;
10
+ --avatar-text-color: #ffffff;
11
+ --avatar-text-secondary: rgba(255, 255, 255, 0.7);
12
+ --avatar-pip-size: 120px;
13
+ --avatar-pip-radius: 12px;
14
+ }
15
+ [data-avatar-call] {
16
+ position: relative;
17
+ width: 100%;
18
+ aspect-ratio: 16 / 9;
19
+ background: var(--avatar-bg-connecting);
20
+ border-radius: var(--avatar-radius);
21
+ overflow: hidden;
22
+ display: flex;
23
+ flex-direction: column;
24
+ }
25
+ [data-avatar-call]::before {
26
+ content: "";
27
+ position: absolute;
28
+ inset: 0;
29
+ background-image: var(--avatar-image);
30
+ background-size: cover;
31
+ background-position: center;
32
+ filter: blur(20px) brightness(0.5);
33
+ transform: scale(1.1);
34
+ z-index: 0;
35
+ }
36
+ [data-has-video] {
37
+ flex: 1;
38
+ display: flex;
39
+ align-items: center;
40
+ justify-content: center;
41
+ position: relative;
42
+ z-index: 1;
43
+ }
44
+ [data-has-video] video {
45
+ width: 100%;
46
+ height: 100%;
47
+ object-fit: cover;
48
+ }
49
+ [data-has-video=true] {
50
+ background: transparent;
51
+ }
52
+ [data-speaking=true] {
53
+ box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.5);
54
+ }
55
+ [data-active] {
56
+ position: absolute;
57
+ bottom: 0;
58
+ left: 0;
59
+ right: 0;
60
+ padding: 24px;
61
+ display: flex;
62
+ align-items: center;
63
+ justify-content: center;
64
+ gap: 12px;
65
+ background:
66
+ linear-gradient(
67
+ to top,
68
+ rgba(0, 0, 0, 0.4),
69
+ transparent);
70
+ z-index: 2;
71
+ }
72
+ @media (max-width: 480px) {
73
+ [data-active] {
74
+ padding: 16px;
75
+ gap: 8px;
76
+ }
77
+ }
78
+ [data-control] {
79
+ display: flex;
80
+ align-items: center;
81
+ justify-content: center;
82
+ width: var(--avatar-control-size);
83
+ height: var(--avatar-control-size);
84
+ border-radius: 50%;
85
+ border: none;
86
+ background: var(--avatar-control-bg);
87
+ color: var(--avatar-text-color);
88
+ cursor: pointer;
89
+ transition: background-color 0.15s ease;
90
+ }
91
+ @media (max-width: 480px) {
92
+ [data-control] {
93
+ width: 40px;
94
+ height: 40px;
95
+ }
96
+ [data-control] svg {
97
+ width: 18px;
98
+ height: 18px;
99
+ }
100
+ }
101
+ [data-control]:hover {
102
+ background: var(--avatar-control-bg-hover);
103
+ }
104
+ [data-control]:focus-visible {
105
+ outline: 2px solid var(--avatar-text-color);
106
+ outline-offset: 2px;
107
+ }
108
+ [data-control][data-enabled=false] {
109
+ background: rgba(239, 68, 68, 0.2);
110
+ color: #fca5a5;
111
+ }
112
+ [data-control=end-call] {
113
+ background: var(--avatar-end-call-bg);
114
+ }
115
+ [data-control=end-call]:hover {
116
+ background: var(--avatar-end-call-bg-hover);
117
+ }
118
+ [data-camera-enabled] {
119
+ position: absolute;
120
+ bottom: 88px;
121
+ right: 24px;
122
+ width: var(--avatar-pip-size);
123
+ aspect-ratio: 4 / 3;
124
+ border-radius: var(--avatar-pip-radius);
125
+ overflow: hidden;
126
+ background: var(--avatar-bg-connecting);
127
+ border: 2px solid rgba(255, 255, 255, 0.2);
128
+ z-index: 2;
129
+ }
130
+ @media (max-width: 480px) {
131
+ [data-camera-enabled] {
132
+ width: 80px;
133
+ bottom: 72px;
134
+ right: 12px;
135
+ border-radius: 8px;
136
+ }
137
+ }
138
+ [data-camera-enabled] video {
139
+ width: 100%;
140
+ height: 100%;
141
+ object-fit: cover;
142
+ }
143
+ [data-mirror=true] video {
144
+ transform: scaleX(-1);
145
+ }
146
+ [data-sharing] {
147
+ position: absolute;
148
+ inset: 0;
149
+ background: #000;
150
+ }
151
+ [data-sharing] video {
152
+ width: 100%;
153
+ height: 100%;
154
+ object-fit: contain;
155
+ }
156
+ @keyframes avatar-pulse {
157
+ 0%, 100% {
158
+ opacity: 1;
159
+ }
160
+ 50% {
161
+ opacity: 0.5;
162
+ }
163
+ }
164
+ [data-avatar-call][data-state=connecting]::after {
165
+ content: "Connecting\2026";
166
+ position: absolute;
167
+ inset: 0;
168
+ display: flex;
169
+ align-items: center;
170
+ justify-content: center;
171
+ color: var(--avatar-text-color);
172
+ font-size: 16px;
173
+ font-weight: 500;
174
+ z-index: 1;
175
+ animation: avatar-pulse 2s ease-in-out infinite;
176
+ }
177
+ @media (prefers-reduced-motion: reduce) {
178
+ [data-avatar-call][data-state=connecting]::after {
179
+ animation: none;
180
+ }
181
+ }
182
+ [data-avatar-call][data-state=error]::after {
183
+ content: "Connection failed";
184
+ position: absolute;
185
+ inset: 0;
186
+ display: flex;
187
+ align-items: center;
188
+ justify-content: center;
189
+ color: #fca5a5;
190
+ font-size: 16px;
191
+ font-weight: 500;
192
+ z-index: 1;
193
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robinandeer/rtc-session-components",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Headless React components for WebRTC video sessions",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -16,14 +16,18 @@
16
16
  "types": "./dist/index.d.cts",
17
17
  "default": "./dist/index.cjs"
18
18
  }
19
- }
19
+ },
20
+ "./styles.css": "./dist/styles.css"
20
21
  },
21
22
  "files": [
22
23
  "dist",
23
24
  "README.md",
24
- "LICENSE"
25
+ "LICENSE",
26
+ "NOTICES"
27
+ ],
28
+ "sideEffects": [
29
+ "*.css"
25
30
  ],
26
- "sideEffects": false,
27
31
  "scripts": {
28
32
  "dev": "tsup --watch",
29
33
  "build": "tsup",