fauna-api 1.0.676 → 1.0.679
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/src/extensions/web/session.d.ts +9 -7
- package/dist/src/extensions/web/session.js +10 -9
- package/dist/src/marmot/web.js +1 -1
- package/dist/src/private/cards.css +75 -75
- package/dist/src/ui/brands.css +11 -11
- package/dist/src/ui/ui.css +4763 -4763
- package/package.json +89 -89
|
@@ -63,33 +63,35 @@ export declare function ensureChatRoom(authorization: Credentials | ApiKey, cach
|
|
|
63
63
|
export type WebShareSession = {
|
|
64
64
|
web: WebRoom;
|
|
65
65
|
webSelf: Presence;
|
|
66
|
-
|
|
66
|
+
/** Reference of the Parrot room paired with the share. */
|
|
67
|
+
room: string;
|
|
67
68
|
webCode: string;
|
|
68
69
|
reference: string;
|
|
69
70
|
shareCode(): string;
|
|
70
71
|
close(): void;
|
|
71
72
|
};
|
|
72
73
|
/**
|
|
73
|
-
* Bind (host) or open the Parrot
|
|
74
|
-
*
|
|
74
|
+
* Bind (host) or open the Parrot room paired with a web room. The host binds a
|
|
75
|
+
* room it opened (`room` is its reference). Always returns a fresh Parrot access
|
|
76
|
+
* code for `connectRoom({ code })`.
|
|
75
77
|
*/
|
|
76
78
|
export declare function ensureChatFromWebAccess(authorization: Credentials | ApiKey, scope: {
|
|
77
79
|
accessCode: string;
|
|
78
80
|
} | {
|
|
79
81
|
reference: string;
|
|
80
82
|
}, opts?: {
|
|
81
|
-
|
|
83
|
+
room?: string;
|
|
82
84
|
}): Promise<{
|
|
83
|
-
|
|
85
|
+
room: string;
|
|
84
86
|
code: string;
|
|
85
87
|
}>;
|
|
86
88
|
/**
|
|
87
89
|
* Start the web room only (chat room must already exist). Uploads HTML + assets
|
|
88
90
|
* with progress, publishes bootstrap meta, starts mutation streaming + tools.
|
|
89
|
-
*
|
|
91
|
+
* Pairs the chat room with the web room so guests can ensure a Parrot code later.
|
|
90
92
|
*/
|
|
91
93
|
export declare function startWebShare(authorization: Credentials | ApiKey, chat: {
|
|
92
|
-
|
|
94
|
+
reference: string;
|
|
93
95
|
}, options?: {
|
|
94
96
|
hooks?: WebRoomHooks;
|
|
95
97
|
root?: Node;
|
|
@@ -192,8 +192,9 @@ export async function ensureChatRoom(authorization, cached) {
|
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
195
|
-
* Bind (host) or open the Parrot
|
|
196
|
-
*
|
|
195
|
+
* Bind (host) or open the Parrot room paired with a web room. The host binds a
|
|
196
|
+
* room it opened (`room` is its reference). Always returns a fresh Parrot access
|
|
197
|
+
* code for `connectRoom({ code })`.
|
|
197
198
|
*/
|
|
198
199
|
export async function ensureChatFromWebAccess(authorization, scope, opts) {
|
|
199
200
|
const headers = {
|
|
@@ -207,19 +208,19 @@ export async function ensureChatFromWebAccess(authorization, scope, opts) {
|
|
|
207
208
|
const response = await fetch(`${Marmot.getURL()}/extensions/web/chat/ensure`, {
|
|
208
209
|
method: "POST",
|
|
209
210
|
headers,
|
|
210
|
-
body: JSON.stringify(opts?.
|
|
211
|
+
body: JSON.stringify(opts?.room ? { room: opts.room } : {}),
|
|
211
212
|
});
|
|
212
213
|
if (!response.ok)
|
|
213
214
|
throw new Error(await response.text());
|
|
214
215
|
const json = await response.json();
|
|
215
|
-
if (!json.
|
|
216
|
+
if (!json.room || !json.code)
|
|
216
217
|
throw new Error("Invalid web chat ensure response.");
|
|
217
|
-
return {
|
|
218
|
+
return { room: json.room, code: json.code };
|
|
218
219
|
}
|
|
219
220
|
/**
|
|
220
221
|
* Start the web room only (chat room must already exist). Uploads HTML + assets
|
|
221
222
|
* with progress, publishes bootstrap meta, starts mutation streaming + tools.
|
|
222
|
-
*
|
|
223
|
+
* Pairs the chat room with the web room so guests can ensure a Parrot code later.
|
|
223
224
|
*/
|
|
224
225
|
export async function startWebShare(authorization, chat, options = {}) {
|
|
225
226
|
const reference = `web:${crypto.randomUUID()}`;
|
|
@@ -229,7 +230,7 @@ export async function startWebShare(authorization, chat, options = {}) {
|
|
|
229
230
|
const { room: web, self: webSelf } = await connectWebRoom(authorization, { reference }, options.hooks ?? {});
|
|
230
231
|
const webCode = await web.generateAccessCode();
|
|
231
232
|
// Durable web → chat pairing (not encoded in the share URL).
|
|
232
|
-
await ensureChatFromWebAccess(authorization, { reference }, {
|
|
233
|
+
await ensureChatFromWebAccess(authorization, { reference }, { room: chat.reference });
|
|
233
234
|
await publishPageBootstrap(web, authorization, root, options.onProgress, { reference });
|
|
234
235
|
recorder = new DomRecorder(root);
|
|
235
236
|
recorder.bindIds();
|
|
@@ -246,7 +247,7 @@ export async function startWebShare(authorization, chat, options = {}) {
|
|
|
246
247
|
return {
|
|
247
248
|
web,
|
|
248
249
|
webSelf,
|
|
249
|
-
|
|
250
|
+
room: chat.reference,
|
|
250
251
|
webCode,
|
|
251
252
|
reference,
|
|
252
253
|
shareCode: () => webCode,
|
|
@@ -277,7 +278,7 @@ export async function openSession(authorization, hooks = {}) {
|
|
|
277
278
|
const reference = `web:${crypto.randomUUID()}`;
|
|
278
279
|
const { room: web, self: webSelf } = await connectWebRoom(authorization, { reference }, webHooks);
|
|
279
280
|
const webCode = await web.generateAccessCode();
|
|
280
|
-
await ensureChatFromWebAccess(authorization, { reference }, {
|
|
281
|
+
await ensureChatFromWebAccess(authorization, { reference }, { room: openedChat.reference });
|
|
281
282
|
const { room: chat, self: chatSelf } = await connectRoom(authorization, { code: chatCode }, hooks.chat ?? {});
|
|
282
283
|
session = new ExtensionWebSession({
|
|
283
284
|
web, chat, webSelf, chatSelf,
|
package/dist/src/marmot/web.js
CHANGED
|
@@ -699,7 +699,7 @@ export class DomRecorder {
|
|
|
699
699
|
}
|
|
700
700
|
/** An iframe's own defaults, for the divs inlined frames become. A framed document inherits
|
|
701
701
|
* nothing from the page around it, so its html starts from initial values. */
|
|
702
|
-
const FRAME_BOX_CSS = `:where([data-fauna-iframe]) { display: inline-block; width: 300px; height: 150px; border: 2px inset; overflow: hidden; vertical-align: baseline }
|
|
702
|
+
const FRAME_BOX_CSS = `:where([data-fauna-iframe]) { display: inline-block; width: 300px; height: 150px; border: 2px inset; overflow: hidden; vertical-align: baseline }
|
|
703
703
|
:where([data-fauna-iframe]) > :where([data-fauna-frame="html"]) { all: initial; display: block; width: 100%; height: 100%; overflow: auto }`;
|
|
704
704
|
const FRAME_ELEMENT_SELECTOR = /(^|[\s>+~,(])i?frame(?=$|[\s>+~,.#:[)])/gi;
|
|
705
705
|
const FRAME_ROOT_SELECTOR = /(^|[\s>+~,(])(?:html|:root)(?=$|[\s>+~,.#:[)])/g;
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
/* The card for links to another Fauna product. Sites theme it through --product-card-*. */
|
|
2
|
-
.product-card {
|
|
3
|
-
position: fixed;
|
|
4
|
-
top: 0;
|
|
5
|
-
left: 0;
|
|
6
|
-
z-index: 1000;
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
gap: 12px;
|
|
10
|
-
width: max-content;
|
|
11
|
-
max-width: min(330px, calc(100vw - 24px));
|
|
12
|
-
padding: 12px 16px 12px 12px;
|
|
13
|
-
border: 1px solid var(--product-card-border, rgba(255, 255, 255, 0.1));
|
|
14
|
-
border-radius: var(--product-card-radius, 14px);
|
|
15
|
-
background: var(--product-card-background, #151515);
|
|
16
|
-
box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.65);
|
|
17
|
-
color: var(--product-card-color, #f5f3ea);
|
|
18
|
-
font-family: var(--product-card-font, inherit);
|
|
19
|
-
font-size: 14px;
|
|
20
|
-
line-height: 1.35;
|
|
21
|
-
text-align: left;
|
|
22
|
-
pointer-events: none;
|
|
23
|
-
visibility: hidden;
|
|
24
|
-
opacity: 0;
|
|
25
|
-
transition: opacity 0.15s ease, visibility 0.15s;
|
|
26
|
-
}
|
|
27
|
-
.product-card.is-open {
|
|
28
|
-
visibility: visible;
|
|
29
|
-
opacity: 1;
|
|
30
|
-
}
|
|
31
|
-
.product-card-icon {
|
|
32
|
-
flex: none;
|
|
33
|
-
display: block;
|
|
34
|
-
width: 40px;
|
|
35
|
-
height: 40px;
|
|
36
|
-
border-radius: 26%;
|
|
37
|
-
}
|
|
38
|
-
.product-card-icon[hidden] {
|
|
39
|
-
display: none;
|
|
40
|
-
}
|
|
41
|
-
.product-card-crown {
|
|
42
|
-
background: #151515;
|
|
43
|
-
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
|
|
44
|
-
}
|
|
45
|
-
.product-card-text {
|
|
46
|
-
display: flex;
|
|
47
|
-
flex-direction: column;
|
|
48
|
-
min-width: 0;
|
|
49
|
-
}
|
|
50
|
-
.product-card-name {
|
|
51
|
-
font-size: 15px;
|
|
52
|
-
font-weight: 600;
|
|
53
|
-
}
|
|
54
|
-
.product-card-tagline {
|
|
55
|
-
color: var(--product-card-muted, rgba(245, 243, 234, 0.72));
|
|
56
|
-
}
|
|
57
|
-
.product-card-domain {
|
|
58
|
-
margin-top: 3px;
|
|
59
|
-
font-size: 12px;
|
|
60
|
-
color: var(--product-card-muted, rgba(245, 243, 234, 0.72));
|
|
61
|
-
opacity: 0.8;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/* Links to another product inside copy. */
|
|
65
|
-
a.product-ref {
|
|
66
|
-
color: inherit;
|
|
67
|
-
text-decoration: underline;
|
|
68
|
-
text-decoration-thickness: 1px;
|
|
69
|
-
text-underline-offset: 0.18em;
|
|
70
|
-
text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
|
|
71
|
-
transition: text-decoration-color 0.2s;
|
|
72
|
-
}
|
|
73
|
-
a.product-ref:hover {
|
|
74
|
-
text-decoration-color: currentColor;
|
|
75
|
-
}
|
|
1
|
+
/* The card for links to another Fauna product. Sites theme it through --product-card-*. */
|
|
2
|
+
.product-card {
|
|
3
|
+
position: fixed;
|
|
4
|
+
top: 0;
|
|
5
|
+
left: 0;
|
|
6
|
+
z-index: 1000;
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: 12px;
|
|
10
|
+
width: max-content;
|
|
11
|
+
max-width: min(330px, calc(100vw - 24px));
|
|
12
|
+
padding: 12px 16px 12px 12px;
|
|
13
|
+
border: 1px solid var(--product-card-border, rgba(255, 255, 255, 0.1));
|
|
14
|
+
border-radius: var(--product-card-radius, 14px);
|
|
15
|
+
background: var(--product-card-background, #151515);
|
|
16
|
+
box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.65);
|
|
17
|
+
color: var(--product-card-color, #f5f3ea);
|
|
18
|
+
font-family: var(--product-card-font, inherit);
|
|
19
|
+
font-size: 14px;
|
|
20
|
+
line-height: 1.35;
|
|
21
|
+
text-align: left;
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
visibility: hidden;
|
|
24
|
+
opacity: 0;
|
|
25
|
+
transition: opacity 0.15s ease, visibility 0.15s;
|
|
26
|
+
}
|
|
27
|
+
.product-card.is-open {
|
|
28
|
+
visibility: visible;
|
|
29
|
+
opacity: 1;
|
|
30
|
+
}
|
|
31
|
+
.product-card-icon {
|
|
32
|
+
flex: none;
|
|
33
|
+
display: block;
|
|
34
|
+
width: 40px;
|
|
35
|
+
height: 40px;
|
|
36
|
+
border-radius: 26%;
|
|
37
|
+
}
|
|
38
|
+
.product-card-icon[hidden] {
|
|
39
|
+
display: none;
|
|
40
|
+
}
|
|
41
|
+
.product-card-crown {
|
|
42
|
+
background: #151515;
|
|
43
|
+
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
|
|
44
|
+
}
|
|
45
|
+
.product-card-text {
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
min-width: 0;
|
|
49
|
+
}
|
|
50
|
+
.product-card-name {
|
|
51
|
+
font-size: 15px;
|
|
52
|
+
font-weight: 600;
|
|
53
|
+
}
|
|
54
|
+
.product-card-tagline {
|
|
55
|
+
color: var(--product-card-muted, rgba(245, 243, 234, 0.72));
|
|
56
|
+
}
|
|
57
|
+
.product-card-domain {
|
|
58
|
+
margin-top: 3px;
|
|
59
|
+
font-size: 12px;
|
|
60
|
+
color: var(--product-card-muted, rgba(245, 243, 234, 0.72));
|
|
61
|
+
opacity: 0.8;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Links to another product inside copy. */
|
|
65
|
+
a.product-ref {
|
|
66
|
+
color: inherit;
|
|
67
|
+
text-decoration: underline;
|
|
68
|
+
text-decoration-thickness: 1px;
|
|
69
|
+
text-underline-offset: 0.18em;
|
|
70
|
+
text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
|
|
71
|
+
transition: text-decoration-color 0.2s;
|
|
72
|
+
}
|
|
73
|
+
a.product-ref:hover {
|
|
74
|
+
text-decoration-color: currentColor;
|
|
75
|
+
}
|
package/dist/src/ui/brands.css
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/* Powered by Fauna: the crown's charcoal tile. Sites size and tint it through --powered-crown-*. */
|
|
2
|
-
.fauna-powered-crown {
|
|
3
|
-
flex: none;
|
|
4
|
-
|
|
5
|
-
width: var(--powered-crown-size, 1.6em);
|
|
6
|
-
height: var(--powered-crown-size, 1.6em);
|
|
7
|
-
|
|
8
|
-
border-radius: 26%;
|
|
9
|
-
|
|
10
|
-
background: var(--powered-crown-background, #151515);
|
|
11
|
-
}
|
|
1
|
+
/* Powered by Fauna: the crown's charcoal tile. Sites size and tint it through --powered-crown-*. */
|
|
2
|
+
.fauna-powered-crown {
|
|
3
|
+
flex: none;
|
|
4
|
+
|
|
5
|
+
width: var(--powered-crown-size, 1.6em);
|
|
6
|
+
height: var(--powered-crown-size, 1.6em);
|
|
7
|
+
|
|
8
|
+
border-radius: 26%;
|
|
9
|
+
|
|
10
|
+
background: var(--powered-crown-background, #151515);
|
|
11
|
+
}
|