@pixelume/sdk 0.1.1 → 0.3.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 +39 -1
- package/README.md +166 -102
- package/dist/contracts/index.d.ts +17 -0
- package/dist/contracts/index.js +36 -0
- package/dist/contracts/index.js.map +1 -1
- package/dist/core/PixelumeClient.d.ts +10 -0
- package/dist/core/PixelumeClient.js +18 -0
- package/dist/core/PixelumeClient.js.map +1 -1
- package/dist/core/config.d.ts +9 -0
- package/dist/core/config.js +70 -2
- package/dist/core/config.js.map +1 -1
- package/dist/core/errors.d.ts +11 -2
- package/dist/core/errors.js +9 -0
- package/dist/core/errors.js.map +1 -1
- package/dist/core/types.d.ts +37 -0
- package/dist/core/types.js.map +1 -1
- package/dist/http/HttpClient.js +8 -0
- package/dist/http/HttpClient.js.map +1 -1
- package/dist/http/types.d.ts +2 -0
- package/dist/http/types.js.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/modules/auth/AuthModule.d.ts +55 -0
- package/dist/modules/auth/AuthModule.js +424 -0
- package/dist/modules/auth/AuthModule.js.map +1 -0
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.js +2 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/styles.d.ts +1 -0
- package/dist/ui/styles.js +402 -0
- package/dist/ui/styles.js.map +1 -0
- package/dist/ui/widget.d.ts +29 -0
- package/dist/ui/widget.js +378 -0
- package/dist/ui/widget.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +7 -2
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
export const WIDGET_STYLES = `
|
|
2
|
+
:host {
|
|
3
|
+
all: initial;
|
|
4
|
+
position: fixed;
|
|
5
|
+
z-index: var(--pixelume-z-index, 2147483000);
|
|
6
|
+
display: block;
|
|
7
|
+
color-scheme: dark;
|
|
8
|
+
contain: layout style;
|
|
9
|
+
pointer-events: none;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
:host([hidden]) {
|
|
13
|
+
display: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:host([data-contained]) {
|
|
17
|
+
position: absolute;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:host([data-position="top-left"]) {
|
|
21
|
+
inset-block-start: calc(var(--pixelume-offset) + env(safe-area-inset-top, 0px));
|
|
22
|
+
inset-inline-start: calc(var(--pixelume-offset) + env(safe-area-inset-left, 0px));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host([data-position="top-right"]) {
|
|
26
|
+
inset-block-start: calc(var(--pixelume-offset) + env(safe-area-inset-top, 0px));
|
|
27
|
+
inset-inline-end: calc(var(--pixelume-offset) + env(safe-area-inset-right, 0px));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
:host([data-position="bottom-left"]) {
|
|
31
|
+
inset-block-end: calc(var(--pixelume-offset) + env(safe-area-inset-bottom, 0px));
|
|
32
|
+
inset-inline-start: calc(var(--pixelume-offset) + env(safe-area-inset-left, 0px));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:host([data-position="bottom-right"]) {
|
|
36
|
+
inset-block-end: calc(var(--pixelume-offset) + env(safe-area-inset-bottom, 0px));
|
|
37
|
+
inset-inline-end: calc(var(--pixelume-offset) + env(safe-area-inset-right, 0px));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
*,
|
|
41
|
+
*::before,
|
|
42
|
+
*::after {
|
|
43
|
+
box-sizing: border-box;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
button {
|
|
47
|
+
font: inherit;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.root {
|
|
51
|
+
--night: oklch(25% 0.035 263);
|
|
52
|
+
--night-deep: oklch(18% 0.03 263);
|
|
53
|
+
--surface: oklch(30% 0.04 263);
|
|
54
|
+
--surface-raised: oklch(35% 0.045 263);
|
|
55
|
+
--lume: oklch(79% 0.13 67);
|
|
56
|
+
--lume-bright: oklch(88% 0.1 76);
|
|
57
|
+
--lume-deep: oklch(63% 0.13 48);
|
|
58
|
+
--mint: oklch(81% 0.08 171);
|
|
59
|
+
--text: oklch(94% 0.02 78);
|
|
60
|
+
--muted: oklch(80% 0.02 78);
|
|
61
|
+
--danger: oklch(78% 0.12 24);
|
|
62
|
+
--line: oklch(92% 0.02 78 / 0.24);
|
|
63
|
+
--pixel: 3px;
|
|
64
|
+
display: flex;
|
|
65
|
+
gap: 0.75rem;
|
|
66
|
+
align-items: flex-end;
|
|
67
|
+
inline-size: max-content;
|
|
68
|
+
max-inline-size: calc(100vw - 2rem);
|
|
69
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
|
|
70
|
+
font-size: 1rem;
|
|
71
|
+
line-height: 1.45;
|
|
72
|
+
color: var(--text);
|
|
73
|
+
pointer-events: auto;
|
|
74
|
+
-webkit-font-smoothing: antialiased;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
:host([data-position^="bottom"]) .root {
|
|
78
|
+
flex-direction: column-reverse;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
:host([data-position^="top"]) .root {
|
|
82
|
+
flex-direction: column;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
:host([data-position$="left"]) .root {
|
|
86
|
+
align-items: flex-start;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.trigger,
|
|
90
|
+
.panel,
|
|
91
|
+
.action,
|
|
92
|
+
.close {
|
|
93
|
+
border: 0;
|
|
94
|
+
border-radius: 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.trigger,
|
|
98
|
+
.action {
|
|
99
|
+
box-shadow:
|
|
100
|
+
0 calc(-1 * var(--pixel)) 0 var(--edge),
|
|
101
|
+
0 var(--pixel) 0 var(--edge-bottom),
|
|
102
|
+
calc(-1 * var(--pixel)) 0 var(--edge),
|
|
103
|
+
var(--pixel) 0 var(--edge);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.trigger {
|
|
107
|
+
--edge: var(--lume);
|
|
108
|
+
--edge-bottom: var(--lume-deep);
|
|
109
|
+
display: inline-flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
gap: 0.625rem;
|
|
112
|
+
min-block-size: 2.75rem;
|
|
113
|
+
margin: var(--pixel);
|
|
114
|
+
padding: 0.625rem 0.875rem;
|
|
115
|
+
color: var(--night-deep);
|
|
116
|
+
background: var(--lume);
|
|
117
|
+
font-weight: 750;
|
|
118
|
+
cursor: pointer;
|
|
119
|
+
touch-action: manipulation;
|
|
120
|
+
transition:
|
|
121
|
+
transform 160ms cubic-bezier(0.16, 1, 0.3, 1),
|
|
122
|
+
background-color 160ms linear;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.trigger:hover {
|
|
126
|
+
background: var(--lume-bright);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.trigger:active {
|
|
130
|
+
transform: translateY(2px);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.trigger:focus-visible,
|
|
134
|
+
.action:focus-visible,
|
|
135
|
+
.close:focus-visible {
|
|
136
|
+
outline: 3px solid var(--mint);
|
|
137
|
+
outline-offset: 4px;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.mark {
|
|
141
|
+
position: relative;
|
|
142
|
+
flex: none;
|
|
143
|
+
inline-size: 1rem;
|
|
144
|
+
block-size: 1rem;
|
|
145
|
+
color: currentColor;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.mark::before,
|
|
149
|
+
.mark::after {
|
|
150
|
+
content: "";
|
|
151
|
+
position: absolute;
|
|
152
|
+
background: currentColor;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.mark::before {
|
|
156
|
+
inset: 0.25rem;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.mark::after {
|
|
160
|
+
inset: 0;
|
|
161
|
+
clip-path: polygon(37.5% 0, 62.5% 0, 62.5% 37.5%, 100% 37.5%, 100% 62.5%, 62.5% 62.5%, 62.5% 100%, 37.5% 100%, 37.5% 62.5%, 0 62.5%, 0 37.5%, 37.5% 37.5%);
|
|
162
|
+
opacity: 0.72;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.presence {
|
|
166
|
+
inline-size: 0.5rem;
|
|
167
|
+
block-size: 0.5rem;
|
|
168
|
+
background: var(--night-deep);
|
|
169
|
+
opacity: 0.5;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.trigger[data-authenticated] .presence {
|
|
173
|
+
background: oklch(48% 0.12 168);
|
|
174
|
+
opacity: 1;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.panel {
|
|
178
|
+
inline-size: min(21.5rem, calc(100vw - 2rem));
|
|
179
|
+
margin: var(--pixel);
|
|
180
|
+
color: var(--text);
|
|
181
|
+
background: var(--night);
|
|
182
|
+
box-shadow:
|
|
183
|
+
0 calc(-1 * var(--pixel)) 0 var(--line),
|
|
184
|
+
0 var(--pixel) 0 var(--surface-raised),
|
|
185
|
+
calc(-1 * var(--pixel)) 0 var(--line),
|
|
186
|
+
var(--pixel) 0 var(--line),
|
|
187
|
+
0 1rem 2.5rem oklch(8% 0.03 263 / 0.42);
|
|
188
|
+
overflow: hidden;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.panel[hidden] {
|
|
192
|
+
display: none;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.panel-header {
|
|
196
|
+
display: flex;
|
|
197
|
+
align-items: center;
|
|
198
|
+
justify-content: space-between;
|
|
199
|
+
gap: 1rem;
|
|
200
|
+
min-block-size: 3rem;
|
|
201
|
+
padding: 0.625rem 0.75rem 0.625rem 1rem;
|
|
202
|
+
border-block-end: 1px solid var(--line);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.brand {
|
|
206
|
+
display: inline-flex;
|
|
207
|
+
align-items: center;
|
|
208
|
+
gap: 0.5rem;
|
|
209
|
+
color: var(--lume-bright);
|
|
210
|
+
font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
|
|
211
|
+
font-size: 0.8125rem;
|
|
212
|
+
font-weight: 750;
|
|
213
|
+
letter-spacing: 0.08em;
|
|
214
|
+
text-transform: uppercase;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.brand .mark {
|
|
218
|
+
inline-size: 0.75rem;
|
|
219
|
+
block-size: 0.75rem;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.close {
|
|
223
|
+
display: grid;
|
|
224
|
+
place-items: center;
|
|
225
|
+
inline-size: 2.5rem;
|
|
226
|
+
block-size: 2.5rem;
|
|
227
|
+
padding: 0;
|
|
228
|
+
color: var(--muted);
|
|
229
|
+
background: transparent;
|
|
230
|
+
font-size: 1.5rem;
|
|
231
|
+
line-height: 1;
|
|
232
|
+
cursor: pointer;
|
|
233
|
+
touch-action: manipulation;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.close:hover {
|
|
237
|
+
color: var(--text);
|
|
238
|
+
background: var(--surface);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.content {
|
|
242
|
+
display: grid;
|
|
243
|
+
gap: 1rem;
|
|
244
|
+
padding: 1.25rem;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.identity {
|
|
248
|
+
display: grid;
|
|
249
|
+
grid-template-columns: auto minmax(0, 1fr);
|
|
250
|
+
align-items: center;
|
|
251
|
+
gap: 0.875rem;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.avatar {
|
|
255
|
+
display: grid;
|
|
256
|
+
place-items: center;
|
|
257
|
+
inline-size: 2.75rem;
|
|
258
|
+
block-size: 2.75rem;
|
|
259
|
+
color: var(--night-deep);
|
|
260
|
+
background: var(--mint);
|
|
261
|
+
box-shadow:
|
|
262
|
+
0 -3px 0 var(--mint),
|
|
263
|
+
0 3px 0 oklch(62% 0.08 171),
|
|
264
|
+
-3px 0 0 var(--mint),
|
|
265
|
+
3px 0 0 var(--mint);
|
|
266
|
+
font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
|
|
267
|
+
font-weight: 800;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.title,
|
|
271
|
+
.message {
|
|
272
|
+
margin: 0;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.title {
|
|
276
|
+
color: var(--text);
|
|
277
|
+
font-size: 1.125rem;
|
|
278
|
+
font-weight: 760;
|
|
279
|
+
line-height: 1.25;
|
|
280
|
+
overflow-wrap: anywhere;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.message {
|
|
284
|
+
max-inline-size: 34ch;
|
|
285
|
+
color: var(--muted);
|
|
286
|
+
font-size: 0.875rem;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.state-copy {
|
|
290
|
+
display: grid;
|
|
291
|
+
gap: 0.375rem;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.notice {
|
|
295
|
+
margin: 0;
|
|
296
|
+
padding: 0.75rem;
|
|
297
|
+
color: var(--danger);
|
|
298
|
+
background: oklch(25% 0.055 24);
|
|
299
|
+
border: 1px solid oklch(78% 0.12 24 / 0.35);
|
|
300
|
+
font-size: 0.8125rem;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.action {
|
|
304
|
+
--edge: var(--lume);
|
|
305
|
+
--edge-bottom: var(--lume-deep);
|
|
306
|
+
display: inline-flex;
|
|
307
|
+
align-items: center;
|
|
308
|
+
justify-content: center;
|
|
309
|
+
min-block-size: 2.75rem;
|
|
310
|
+
inline-size: calc(100% - 2 * var(--pixel));
|
|
311
|
+
margin: var(--pixel);
|
|
312
|
+
padding: 0.6875rem 1rem;
|
|
313
|
+
color: var(--night-deep);
|
|
314
|
+
background: var(--lume);
|
|
315
|
+
font-weight: 750;
|
|
316
|
+
cursor: pointer;
|
|
317
|
+
touch-action: manipulation;
|
|
318
|
+
transition:
|
|
319
|
+
transform 160ms cubic-bezier(0.16, 1, 0.3, 1),
|
|
320
|
+
background-color 160ms linear;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.action:hover:not(:disabled) {
|
|
324
|
+
background: var(--lume-bright);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.action:active:not(:disabled) {
|
|
328
|
+
transform: translateY(2px);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.action.secondary {
|
|
332
|
+
--edge: var(--line);
|
|
333
|
+
--edge-bottom: var(--surface-raised);
|
|
334
|
+
color: var(--text);
|
|
335
|
+
background: var(--surface);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.action.secondary:hover:not(:disabled) {
|
|
339
|
+
--edge: var(--mint);
|
|
340
|
+
color: var(--mint);
|
|
341
|
+
background: var(--surface-raised);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.action:disabled {
|
|
345
|
+
cursor: wait;
|
|
346
|
+
opacity: 0.68;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.loading {
|
|
350
|
+
display: grid;
|
|
351
|
+
gap: 0.625rem;
|
|
352
|
+
padding-block: 0.25rem;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.loading-line {
|
|
356
|
+
block-size: 0.75rem;
|
|
357
|
+
background: var(--surface-raised);
|
|
358
|
+
animation: pixel-pulse 1.2s steps(4, end) infinite;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.loading-line:first-child {
|
|
362
|
+
inline-size: 62%;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.loading-line:last-child {
|
|
366
|
+
inline-size: 88%;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.sr-only {
|
|
370
|
+
position: absolute;
|
|
371
|
+
inline-size: 1px;
|
|
372
|
+
block-size: 1px;
|
|
373
|
+
padding: 0;
|
|
374
|
+
margin: -1px;
|
|
375
|
+
overflow: hidden;
|
|
376
|
+
clip: rect(0, 0, 0, 0);
|
|
377
|
+
white-space: nowrap;
|
|
378
|
+
border: 0;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
@keyframes pixel-pulse {
|
|
382
|
+
0%, 100% { opacity: 0.45; }
|
|
383
|
+
50% { opacity: 1; }
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
@media (max-width: 30rem) {
|
|
387
|
+
.trigger {
|
|
388
|
+
padding-inline: 0.75rem;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
@media (prefers-reduced-motion: reduce) {
|
|
393
|
+
*,
|
|
394
|
+
*::before,
|
|
395
|
+
*::after {
|
|
396
|
+
animation-duration: 0.01ms !important;
|
|
397
|
+
animation-iteration-count: 1 !important;
|
|
398
|
+
transition-duration: 0.01ms !important;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
`;
|
|
402
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/ui/styles.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgZ5B,CAAC","sourcesContent":["export const WIDGET_STYLES = `\n:host {\n all: initial;\n position: fixed;\n z-index: var(--pixelume-z-index, 2147483000);\n display: block;\n color-scheme: dark;\n contain: layout style;\n pointer-events: none;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n:host([data-contained]) {\n position: absolute;\n}\n\n:host([data-position=\"top-left\"]) {\n inset-block-start: calc(var(--pixelume-offset) + env(safe-area-inset-top, 0px));\n inset-inline-start: calc(var(--pixelume-offset) + env(safe-area-inset-left, 0px));\n}\n\n:host([data-position=\"top-right\"]) {\n inset-block-start: calc(var(--pixelume-offset) + env(safe-area-inset-top, 0px));\n inset-inline-end: calc(var(--pixelume-offset) + env(safe-area-inset-right, 0px));\n}\n\n:host([data-position=\"bottom-left\"]) {\n inset-block-end: calc(var(--pixelume-offset) + env(safe-area-inset-bottom, 0px));\n inset-inline-start: calc(var(--pixelume-offset) + env(safe-area-inset-left, 0px));\n}\n\n:host([data-position=\"bottom-right\"]) {\n inset-block-end: calc(var(--pixelume-offset) + env(safe-area-inset-bottom, 0px));\n inset-inline-end: calc(var(--pixelume-offset) + env(safe-area-inset-right, 0px));\n}\n\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\nbutton {\n font: inherit;\n}\n\n.root {\n --night: oklch(25% 0.035 263);\n --night-deep: oklch(18% 0.03 263);\n --surface: oklch(30% 0.04 263);\n --surface-raised: oklch(35% 0.045 263);\n --lume: oklch(79% 0.13 67);\n --lume-bright: oklch(88% 0.1 76);\n --lume-deep: oklch(63% 0.13 48);\n --mint: oklch(81% 0.08 171);\n --text: oklch(94% 0.02 78);\n --muted: oklch(80% 0.02 78);\n --danger: oklch(78% 0.12 24);\n --line: oklch(92% 0.02 78 / 0.24);\n --pixel: 3px;\n display: flex;\n gap: 0.75rem;\n align-items: flex-end;\n inline-size: max-content;\n max-inline-size: calc(100vw - 2rem);\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif;\n font-size: 1rem;\n line-height: 1.45;\n color: var(--text);\n pointer-events: auto;\n -webkit-font-smoothing: antialiased;\n}\n\n:host([data-position^=\"bottom\"]) .root {\n flex-direction: column-reverse;\n}\n\n:host([data-position^=\"top\"]) .root {\n flex-direction: column;\n}\n\n:host([data-position$=\"left\"]) .root {\n align-items: flex-start;\n}\n\n.trigger,\n.panel,\n.action,\n.close {\n border: 0;\n border-radius: 0;\n}\n\n.trigger,\n.action {\n box-shadow:\n 0 calc(-1 * var(--pixel)) 0 var(--edge),\n 0 var(--pixel) 0 var(--edge-bottom),\n calc(-1 * var(--pixel)) 0 var(--edge),\n var(--pixel) 0 var(--edge);\n}\n\n.trigger {\n --edge: var(--lume);\n --edge-bottom: var(--lume-deep);\n display: inline-flex;\n align-items: center;\n gap: 0.625rem;\n min-block-size: 2.75rem;\n margin: var(--pixel);\n padding: 0.625rem 0.875rem;\n color: var(--night-deep);\n background: var(--lume);\n font-weight: 750;\n cursor: pointer;\n touch-action: manipulation;\n transition:\n transform 160ms cubic-bezier(0.16, 1, 0.3, 1),\n background-color 160ms linear;\n}\n\n.trigger:hover {\n background: var(--lume-bright);\n}\n\n.trigger:active {\n transform: translateY(2px);\n}\n\n.trigger:focus-visible,\n.action:focus-visible,\n.close:focus-visible {\n outline: 3px solid var(--mint);\n outline-offset: 4px;\n}\n\n.mark {\n position: relative;\n flex: none;\n inline-size: 1rem;\n block-size: 1rem;\n color: currentColor;\n}\n\n.mark::before,\n.mark::after {\n content: \"\";\n position: absolute;\n background: currentColor;\n}\n\n.mark::before {\n inset: 0.25rem;\n}\n\n.mark::after {\n inset: 0;\n clip-path: polygon(37.5% 0, 62.5% 0, 62.5% 37.5%, 100% 37.5%, 100% 62.5%, 62.5% 62.5%, 62.5% 100%, 37.5% 100%, 37.5% 62.5%, 0 62.5%, 0 37.5%, 37.5% 37.5%);\n opacity: 0.72;\n}\n\n.presence {\n inline-size: 0.5rem;\n block-size: 0.5rem;\n background: var(--night-deep);\n opacity: 0.5;\n}\n\n.trigger[data-authenticated] .presence {\n background: oklch(48% 0.12 168);\n opacity: 1;\n}\n\n.panel {\n inline-size: min(21.5rem, calc(100vw - 2rem));\n margin: var(--pixel);\n color: var(--text);\n background: var(--night);\n box-shadow:\n 0 calc(-1 * var(--pixel)) 0 var(--line),\n 0 var(--pixel) 0 var(--surface-raised),\n calc(-1 * var(--pixel)) 0 var(--line),\n var(--pixel) 0 var(--line),\n 0 1rem 2.5rem oklch(8% 0.03 263 / 0.42);\n overflow: hidden;\n}\n\n.panel[hidden] {\n display: none;\n}\n\n.panel-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 1rem;\n min-block-size: 3rem;\n padding: 0.625rem 0.75rem 0.625rem 1rem;\n border-block-end: 1px solid var(--line);\n}\n\n.brand {\n display: inline-flex;\n align-items: center;\n gap: 0.5rem;\n color: var(--lume-bright);\n font-family: ui-monospace, \"SFMono-Regular\", Consolas, monospace;\n font-size: 0.8125rem;\n font-weight: 750;\n letter-spacing: 0.08em;\n text-transform: uppercase;\n}\n\n.brand .mark {\n inline-size: 0.75rem;\n block-size: 0.75rem;\n}\n\n.close {\n display: grid;\n place-items: center;\n inline-size: 2.5rem;\n block-size: 2.5rem;\n padding: 0;\n color: var(--muted);\n background: transparent;\n font-size: 1.5rem;\n line-height: 1;\n cursor: pointer;\n touch-action: manipulation;\n}\n\n.close:hover {\n color: var(--text);\n background: var(--surface);\n}\n\n.content {\n display: grid;\n gap: 1rem;\n padding: 1.25rem;\n}\n\n.identity {\n display: grid;\n grid-template-columns: auto minmax(0, 1fr);\n align-items: center;\n gap: 0.875rem;\n}\n\n.avatar {\n display: grid;\n place-items: center;\n inline-size: 2.75rem;\n block-size: 2.75rem;\n color: var(--night-deep);\n background: var(--mint);\n box-shadow:\n 0 -3px 0 var(--mint),\n 0 3px 0 oklch(62% 0.08 171),\n -3px 0 0 var(--mint),\n 3px 0 0 var(--mint);\n font-family: ui-monospace, \"SFMono-Regular\", Consolas, monospace;\n font-weight: 800;\n}\n\n.title,\n.message {\n margin: 0;\n}\n\n.title {\n color: var(--text);\n font-size: 1.125rem;\n font-weight: 760;\n line-height: 1.25;\n overflow-wrap: anywhere;\n}\n\n.message {\n max-inline-size: 34ch;\n color: var(--muted);\n font-size: 0.875rem;\n}\n\n.state-copy {\n display: grid;\n gap: 0.375rem;\n}\n\n.notice {\n margin: 0;\n padding: 0.75rem;\n color: var(--danger);\n background: oklch(25% 0.055 24);\n border: 1px solid oklch(78% 0.12 24 / 0.35);\n font-size: 0.8125rem;\n}\n\n.action {\n --edge: var(--lume);\n --edge-bottom: var(--lume-deep);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-block-size: 2.75rem;\n inline-size: calc(100% - 2 * var(--pixel));\n margin: var(--pixel);\n padding: 0.6875rem 1rem;\n color: var(--night-deep);\n background: var(--lume);\n font-weight: 750;\n cursor: pointer;\n touch-action: manipulation;\n transition:\n transform 160ms cubic-bezier(0.16, 1, 0.3, 1),\n background-color 160ms linear;\n}\n\n.action:hover:not(:disabled) {\n background: var(--lume-bright);\n}\n\n.action:active:not(:disabled) {\n transform: translateY(2px);\n}\n\n.action.secondary {\n --edge: var(--line);\n --edge-bottom: var(--surface-raised);\n color: var(--text);\n background: var(--surface);\n}\n\n.action.secondary:hover:not(:disabled) {\n --edge: var(--mint);\n color: var(--mint);\n background: var(--surface-raised);\n}\n\n.action:disabled {\n cursor: wait;\n opacity: 0.68;\n}\n\n.loading {\n display: grid;\n gap: 0.625rem;\n padding-block: 0.25rem;\n}\n\n.loading-line {\n block-size: 0.75rem;\n background: var(--surface-raised);\n animation: pixel-pulse 1.2s steps(4, end) infinite;\n}\n\n.loading-line:first-child {\n inline-size: 62%;\n}\n\n.loading-line:last-child {\n inline-size: 88%;\n}\n\n.sr-only {\n position: absolute;\n inline-size: 1px;\n block-size: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n}\n\n@keyframes pixel-pulse {\n 0%, 100% { opacity: 0.45; }\n 50% { opacity: 1; }\n}\n\n@media (max-width: 30rem) {\n .trigger {\n padding-inline: 0.75rem;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n *,\n *::before,\n *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n }\n}\n`;\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { PixelumeClient } from '../core/PixelumeClient.js';
|
|
2
|
+
export type PixelumeWidgetPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
3
|
+
export interface PixelumeWidgetOptions {
|
|
4
|
+
/** Corner used by the widget. Defaults to `bottom-right`. */
|
|
5
|
+
readonly position?: PixelumeWidgetPosition;
|
|
6
|
+
/** Distance from the selected edges in CSS pixels. Defaults to `16`. */
|
|
7
|
+
readonly offset?: number;
|
|
8
|
+
/** Mount target. Defaults to `document.body`; custom targets should establish a containing block. */
|
|
9
|
+
readonly container?: HTMLElement;
|
|
10
|
+
/** Visual treatment. `pixel` is currently the only supported theme. */
|
|
11
|
+
readonly theme?: 'pixel';
|
|
12
|
+
/** Stacking order for the host. Defaults to `2147483000`. */
|
|
13
|
+
readonly zIndex?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface PixelumeWidgetController {
|
|
16
|
+
/** The Shadow DOM host created by the widget. */
|
|
17
|
+
readonly element: HTMLElement;
|
|
18
|
+
/** Hides the widget and closes its panel without changing authentication state. */
|
|
19
|
+
hide(): void;
|
|
20
|
+
/** Shows a previously hidden widget. */
|
|
21
|
+
show(): void;
|
|
22
|
+
/** Removes DOM/listeners/subscriptions. Safe to call more than once. */
|
|
23
|
+
destroy(): void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Mounts the optional Pixelume account widget. Importing this module alone has no DOM side effects.
|
|
27
|
+
* Repeating the call with the same client and container returns the existing controller.
|
|
28
|
+
*/
|
|
29
|
+
export declare function mountPixelumeWidget(pixelume: PixelumeClient, options?: PixelumeWidgetOptions): PixelumeWidgetController;
|