fauna-api 0.0.0-stage → 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/brands.d.ts +2 -0
- package/dist/brands.js +2 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.js +121 -0
- package/dist/src/ant/chat.d.ts +130 -0
- package/dist/src/ant/chat.js +467 -0
- package/dist/src/ant/format.d.ts +40 -0
- package/dist/src/ant/format.js +143 -0
- package/dist/src/ant/graph.d.ts +130 -0
- package/dist/src/ant/graph.js +449 -0
- package/dist/src/ant/index.d.ts +16 -0
- package/dist/src/ant/index.js +61 -0
- package/dist/src/ant/persona.d.ts +151 -0
- package/dist/src/ant/persona.js +136 -0
- package/dist/src/ant/timeline.d.ts +283 -0
- package/dist/src/ant/timeline.js +1025 -0
- package/dist/src/authentification.d.ts +45 -0
- package/dist/src/authentification.js +194 -0
- package/dist/src/billing.d.ts +135 -0
- package/dist/src/billing.js +128 -0
- package/dist/src/calendar.d.ts +83 -0
- package/dist/src/calendar.js +133 -0
- package/dist/src/chats.d.ts +113 -0
- package/dist/src/chats.js +100 -0
- package/dist/src/cicada/contacts.d.ts +31 -0
- package/dist/src/cicada/contacts.js +28 -0
- package/dist/src/cicada/conversations.d.ts +73 -0
- package/dist/src/cicada/conversations.js +236 -0
- package/dist/src/cicada/inboxes.d.ts +48 -0
- package/dist/src/cicada/inboxes.js +82 -0
- package/dist/src/cicada/index.d.ts +16 -0
- package/dist/src/cicada/index.js +61 -0
- package/dist/src/cicada/phone.d.ts +48 -0
- package/dist/src/cicada/phone.js +306 -0
- package/dist/src/drive.d.ts +80 -0
- package/dist/src/drive.js +472 -0
- package/dist/src/extensions/index.d.ts +4 -0
- package/dist/src/extensions/index.js +5 -0
- package/dist/src/extensions/web/index.d.ts +6 -0
- package/dist/src/extensions/web/index.js +7 -0
- package/dist/src/extensions/web/session.d.ts +108 -0
- package/dist/src/extensions/web/session.js +470 -0
- package/dist/src/extensions/web/tools.d.ts +13 -0
- package/dist/src/extensions/web/tools.js +72 -0
- package/dist/src/friends.d.ts +39 -0
- package/dist/src/friends.js +119 -0
- package/dist/src/groups.d.ts +82 -0
- package/dist/src/groups.js +269 -0
- package/dist/src/inbox.d.ts +11 -0
- package/dist/src/inbox.js +35 -0
- package/dist/src/integrations.d.ts +52 -0
- package/dist/src/integrations.js +205 -0
- package/dist/src/magpie/explorer.d.ts +14 -0
- package/dist/src/magpie/explorer.js +36 -0
- package/dist/src/magpie/index.d.ts +16 -0
- package/dist/src/magpie/index.js +61 -0
- package/dist/src/magpie/portfolio.d.ts +52 -0
- package/dist/src/magpie/portfolio.js +179 -0
- package/dist/src/magpie/quotes.d.ts +35 -0
- package/dist/src/magpie/quotes.js +47 -0
- package/dist/src/magpie/room.d.ts +61 -0
- package/dist/src/magpie/room.js +238 -0
- package/dist/src/maps.d.ts +159 -0
- package/dist/src/maps.js +171 -0
- package/dist/src/marmot/browser.d.ts +139 -0
- package/dist/src/marmot/browser.js +389 -0
- package/dist/src/marmot/index.d.ts +20 -0
- package/dist/src/marmot/index.js +65 -0
- package/dist/src/marmot/media.d.ts +56 -0
- package/dist/src/marmot/media.js +265 -0
- package/dist/src/marmot/research.d.ts +337 -0
- package/dist/src/marmot/research.js +1138 -0
- package/dist/src/marmot/scraper.d.ts +59 -0
- package/dist/src/marmot/scraper.js +94 -0
- package/dist/src/marmot/web.d.ts +402 -0
- package/dist/src/marmot/web.js +2586 -0
- package/dist/src/marmot/workspace.d.ts +81 -0
- package/dist/src/marmot/workspace.js +263 -0
- package/dist/src/parrot/agent.d.ts +53 -0
- package/dist/src/parrot/agent.js +93 -0
- package/dist/src/parrot/chat.d.ts +84 -0
- package/dist/src/parrot/chat.js +237 -0
- package/dist/src/parrot/format.d.ts +128 -0
- package/dist/src/parrot/format.js +639 -0
- package/dist/src/parrot/generative.d.ts +261 -0
- package/dist/src/parrot/generative.js +185 -0
- package/dist/src/parrot/index.d.ts +22 -0
- package/dist/src/parrot/index.js +67 -0
- package/dist/src/parrot/room.d.ts +225 -0
- package/dist/src/parrot/room.js +466 -0
- package/dist/src/parrot/routing.d.ts +90 -0
- package/dist/src/parrot/routing.js +78 -0
- package/dist/src/parrot/share.d.ts +126 -0
- package/dist/src/parrot/share.js +261 -0
- package/dist/src/parrot/socket.d.ts +41 -0
- package/dist/src/parrot/socket.js +478 -0
- package/dist/src/payments.d.ts +73 -0
- package/dist/src/payments.js +107 -0
- package/dist/src/private/cards.css +75 -0
- package/dist/src/rooms.d.ts +76 -0
- package/dist/src/rooms.js +168 -0
- package/dist/src/shared/schema.d.ts +24 -0
- package/dist/src/shared/schema.js +1 -0
- package/dist/src/shared/server.d.ts +65 -0
- package/dist/src/shared/server.js +302 -0
- package/dist/src/termite/environment.d.ts +110 -0
- package/dist/src/termite/environment.js +263 -0
- package/dist/src/termite/index.d.ts +14 -0
- package/dist/src/termite/index.js +59 -0
- package/dist/src/termite/os.d.ts +326 -0
- package/dist/src/termite/os.js +572 -0
- package/dist/src/termite/versioning.d.ts +94 -0
- package/dist/src/termite/versioning.js +217 -0
- package/dist/src/tickets.d.ts +43 -0
- package/dist/src/tickets.js +138 -0
- package/dist/src/travel.d.ts +85 -0
- package/dist/src/travel.js +44 -0
- package/dist/src/ui/authentification.d.ts +24 -0
- package/dist/src/ui/authentification.js +177 -0
- package/dist/src/ui/brands.css +11 -0
- package/dist/src/ui/brands.d.ts +7 -0
- package/dist/src/ui/brands.js +14 -0
- package/dist/src/ui/browser.d.ts +74 -0
- package/dist/src/ui/browser.js +470 -0
- package/dist/src/ui/chat.d.ts +183 -0
- package/dist/src/ui/chat.js +2379 -0
- package/dist/src/ui/chatPanel.d.ts +109 -0
- package/dist/src/ui/chatPanel.js +768 -0
- package/dist/src/ui/chatSequence.d.ts +36 -0
- package/dist/src/ui/chatSequence.js +42 -0
- package/dist/src/ui/crown.d.ts +19 -0
- package/dist/src/ui/crown.js +199 -0
- package/dist/src/ui/cursor.d.ts +73 -0
- package/dist/src/ui/cursor.js +175 -0
- package/dist/src/ui/device.d.ts +33 -0
- package/dist/src/ui/device.js +49 -0
- package/dist/src/ui/drive.d.ts +69 -0
- package/dist/src/ui/drive.js +1243 -0
- package/dist/src/ui/generative.d.ts +39 -0
- package/dist/src/ui/generative.js +313 -0
- package/dist/src/ui/hover.d.ts +6 -0
- package/dist/src/ui/hover.js +210 -0
- package/dist/src/ui/index.d.ts +42 -0
- package/dist/src/ui/index.js +87 -0
- package/dist/src/ui/integrations.d.ts +13 -0
- package/dist/src/ui/integrations.js +175 -0
- package/dist/src/ui/maps.d.ts +87 -0
- package/dist/src/ui/maps.js +547 -0
- package/dist/src/ui/roster.d.ts +32 -0
- package/dist/src/ui/roster.js +163 -0
- package/dist/src/ui/talk.d.ts +12 -0
- package/dist/src/ui/talk.js +560 -0
- package/dist/src/ui/tickets.d.ts +13 -0
- package/dist/src/ui/tickets.js +966 -0
- package/dist/src/ui/toast.d.ts +7 -0
- package/dist/src/ui/toast.js +258 -0
- package/dist/src/ui/tokenText.d.ts +18 -0
- package/dist/src/ui/tokenText.js +96 -0
- package/dist/src/ui/tokenized.d.ts +42 -0
- package/dist/src/ui/tokenized.js +622 -0
- package/dist/src/ui/ui.css +4763 -0
- package/dist/src/ui/view.d.ts +23 -0
- package/dist/src/ui/view.js +584 -0
- package/dist/src/view.d.ts +113 -0
- package/dist/src/view.js +386 -0
- package/dist/src/webhooks.d.ts +66 -0
- package/dist/src/webhooks.js +78 -0
- package/dist/ui.d.ts +1 -0
- package/dist/ui.js +1 -0
- package/package.json +87 -4
- package/README.md +0 -3
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { Fauna } from "fauna-api";
|
|
2
|
+
const CREDENTIALS_COOKIE = 'fauna-credentials';
|
|
3
|
+
const CREDENTIALS_MAX_AGE = 60 * 60 * 24 * 30;
|
|
4
|
+
function isFaunaHost() {
|
|
5
|
+
if (typeof location === 'undefined')
|
|
6
|
+
return false;
|
|
7
|
+
const host = location.hostname;
|
|
8
|
+
return host === 'faunakit.com' || host.endsWith('.faunakit.com');
|
|
9
|
+
}
|
|
10
|
+
function cookieSuffix(maxAge) {
|
|
11
|
+
const parts = [`Path=/`, `SameSite=Lax`, `Max-Age=${maxAge}`];
|
|
12
|
+
if (isFaunaHost()) {
|
|
13
|
+
parts.push('Domain=.faunakit.com', 'Secure');
|
|
14
|
+
}
|
|
15
|
+
return parts.join('; ');
|
|
16
|
+
}
|
|
17
|
+
export function getToken() {
|
|
18
|
+
if (typeof document === 'undefined')
|
|
19
|
+
return undefined;
|
|
20
|
+
const prefix = `${CREDENTIALS_COOKIE}=`;
|
|
21
|
+
for (const part of document.cookie.split(';')) {
|
|
22
|
+
const trimmed = part.trim();
|
|
23
|
+
if (!trimmed.startsWith(prefix))
|
|
24
|
+
continue;
|
|
25
|
+
const raw = trimmed.slice(prefix.length);
|
|
26
|
+
if (!raw)
|
|
27
|
+
return undefined;
|
|
28
|
+
try {
|
|
29
|
+
return decodeURIComponent(raw);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return raw;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
export function setToken(token) {
|
|
38
|
+
if (typeof document === 'undefined')
|
|
39
|
+
return;
|
|
40
|
+
document.cookie = `${CREDENTIALS_COOKIE}=${encodeURIComponent(token)}; ${cookieSuffix(CREDENTIALS_MAX_AGE)}`;
|
|
41
|
+
}
|
|
42
|
+
export function clearToken() {
|
|
43
|
+
if (typeof document === 'undefined')
|
|
44
|
+
return;
|
|
45
|
+
document.cookie = `${CREDENTIALS_COOKIE}=; ${cookieSuffix(0)}`;
|
|
46
|
+
}
|
|
47
|
+
// Support sessions: Fauna's ticket board opens a reporter's page with `?token=...&support=1`.
|
|
48
|
+
// That token belongs to the reporter, so it lives in this tab only and never replaces the login cookie.
|
|
49
|
+
const SUPPORT_TOKEN_KEY = 'fauna-support-token';
|
|
50
|
+
function readSupportToken() {
|
|
51
|
+
try {
|
|
52
|
+
return sessionStorage.getItem(SUPPORT_TOKEN_KEY) || undefined;
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** Whether this tab is a support session opened from Fauna's ticket board. */
|
|
59
|
+
export function isSupportView() {
|
|
60
|
+
return Boolean(readSupportToken());
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Takes `token` and `support` off a page's query. A support token stays in this tab; any other token
|
|
64
|
+
* becomes the login cookie and ends the tab's support session. Returns whether the query changed.
|
|
65
|
+
*/
|
|
66
|
+
export function takeTokenFromURL(params) {
|
|
67
|
+
const token = params.get('token');
|
|
68
|
+
const changed = Boolean(token) || params.has('support');
|
|
69
|
+
if (token && params.get('support') === '1') {
|
|
70
|
+
try {
|
|
71
|
+
sessionStorage.setItem(SUPPORT_TOKEN_KEY, token);
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
/* no tab storage: drop it rather than sign in as the reporter */
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
else if (token) {
|
|
78
|
+
try {
|
|
79
|
+
sessionStorage.removeItem(SUPPORT_TOKEN_KEY);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
/* no tab storage, no support session to end */
|
|
83
|
+
}
|
|
84
|
+
setToken(token);
|
|
85
|
+
}
|
|
86
|
+
params.delete('token');
|
|
87
|
+
params.delete('support');
|
|
88
|
+
return changed;
|
|
89
|
+
}
|
|
90
|
+
/** The token this tab signs in with: the support session's in a support view, else the login cookie. */
|
|
91
|
+
export function sessionToken() {
|
|
92
|
+
return readSupportToken() ?? getToken();
|
|
93
|
+
}
|
|
94
|
+
const PROVIDER_LABELS = {
|
|
95
|
+
google: 'Google',
|
|
96
|
+
microsoft: 'Microsoft'
|
|
97
|
+
};
|
|
98
|
+
// Social sign-in round-trips through the real providers, whose redirect URIs
|
|
99
|
+
// point at production — so the flow can't complete from a localhost origin.
|
|
100
|
+
// Treat a localhost API host (or page) as development and hide the buttons.
|
|
101
|
+
function isDevelopmentOrigin() {
|
|
102
|
+
const hosts = [];
|
|
103
|
+
try {
|
|
104
|
+
hosts.push(new URL(Fauna.getURL()).hostname);
|
|
105
|
+
}
|
|
106
|
+
catch { /* ignore */ }
|
|
107
|
+
if (typeof window !== 'undefined')
|
|
108
|
+
hosts.push(window.location.hostname);
|
|
109
|
+
return hosts.some((host) => host === 'localhost' || host === '127.0.0.1' || host === '::1' || host.endsWith('.local'));
|
|
110
|
+
}
|
|
111
|
+
// Brand glyphs as inline SVG (Material Symbols has no brand logos).
|
|
112
|
+
const PROVIDER_ICONS = {
|
|
113
|
+
google: `<svg viewBox="0 0 18 18" width="18" height="18" aria-hidden="true"><path fill="#4285F4" d="M17.64 9.2c0-.64-.06-1.25-.16-1.84H9v3.48h4.84a4.14 4.14 0 0 1-1.8 2.72v2.26h2.92c1.7-1.57 2.68-3.88 2.68-6.62z"/><path fill="#34A853" d="M9 18c2.43 0 4.47-.8 5.96-2.18l-2.92-2.26c-.8.54-1.84.86-3.04.86-2.34 0-4.32-1.58-5.03-3.7H.96v2.33A9 9 0 0 0 9 18z"/><path fill="#FBBC05" d="M3.97 10.72a5.4 5.4 0 0 1 0-3.44V4.95H.96a9 9 0 0 0 0 8.1l3.01-2.33z"/><path fill="#EA4335" d="M9 3.58c1.32 0 2.5.46 3.44 1.35l2.58-2.58C13.46.9 11.43 0 9 0A9 9 0 0 0 .96 4.95l3.01 2.33C4.68 5.16 6.66 3.58 9 3.58z"/></svg>`,
|
|
114
|
+
microsoft: `<svg viewBox="0 0 21 21" width="18" height="18" aria-hidden="true"><rect x="1" y="1" width="9" height="9" fill="#F25022"/><rect x="11" y="1" width="9" height="9" fill="#7FBA00"/><rect x="1" y="11" width="9" height="9" fill="#00A4EF"/><rect x="11" y="11" width="9" height="9" fill="#FFB900"/></svg>`
|
|
115
|
+
};
|
|
116
|
+
export function createOAuthButtons(container, options = {}) {
|
|
117
|
+
const root = document.createElement('div');
|
|
118
|
+
root.className = 'oauth-buttons';
|
|
119
|
+
// Hidden in development — the provider redirect URIs are production-only.
|
|
120
|
+
if (isDevelopmentOrigin()) {
|
|
121
|
+
container.appendChild(root);
|
|
122
|
+
return {
|
|
123
|
+
getElement: () => root,
|
|
124
|
+
destroy: () => root.remove()
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
if (options.divider) {
|
|
128
|
+
const divider = document.createElement('div');
|
|
129
|
+
divider.className = 'oauth-divider';
|
|
130
|
+
const span = document.createElement('span');
|
|
131
|
+
span.textContent = typeof options.divider === 'string' ? options.divider : 'or';
|
|
132
|
+
divider.appendChild(span);
|
|
133
|
+
root.appendChild(divider);
|
|
134
|
+
}
|
|
135
|
+
const labelPrefix = options.label ?? 'Continue with';
|
|
136
|
+
function renderButton(provider) {
|
|
137
|
+
const button = document.createElement('button');
|
|
138
|
+
button.type = 'button';
|
|
139
|
+
button.className = 'oauth-button';
|
|
140
|
+
button.dataset.provider = provider;
|
|
141
|
+
const icon = document.createElement('span');
|
|
142
|
+
icon.className = 'oauth-button-icon';
|
|
143
|
+
icon.innerHTML = PROVIDER_ICONS[provider];
|
|
144
|
+
button.appendChild(icon);
|
|
145
|
+
const text = document.createElement('span');
|
|
146
|
+
text.className = 'oauth-button-label';
|
|
147
|
+
text.textContent = `${labelPrefix} ${PROVIDER_LABELS[provider]}`;
|
|
148
|
+
button.appendChild(text);
|
|
149
|
+
button.addEventListener('click', () => {
|
|
150
|
+
const url = new URL(`${Fauna.getURL()}/authentification/oauth/${provider}`);
|
|
151
|
+
if (options.redirect)
|
|
152
|
+
url.searchParams.set('redirect', options.redirect);
|
|
153
|
+
window.location.href = url.toString();
|
|
154
|
+
});
|
|
155
|
+
root.appendChild(button);
|
|
156
|
+
}
|
|
157
|
+
// Render only the providers the server reports as enabled (intersected with
|
|
158
|
+
// any caller-supplied allow-list, preserving the caller's order).
|
|
159
|
+
fetch(`${Fauna.getURL()}/authentification/oauth/providers`)
|
|
160
|
+
.then((response) => response.ok ? response.json() : [])
|
|
161
|
+
.then((enabled) => {
|
|
162
|
+
const order = options.providers ?? enabled;
|
|
163
|
+
for (const provider of order) {
|
|
164
|
+
if (enabled.includes(provider))
|
|
165
|
+
renderButton(provider);
|
|
166
|
+
}
|
|
167
|
+
})
|
|
168
|
+
.catch((err) => {
|
|
169
|
+
console.error('[oauth] failed to load providers:', err);
|
|
170
|
+
options.onError?.('Could not load sign-in options.');
|
|
171
|
+
});
|
|
172
|
+
container.appendChild(root);
|
|
173
|
+
return {
|
|
174
|
+
getElement: () => root,
|
|
175
|
+
destroy: () => root.remove()
|
|
176
|
+
};
|
|
177
|
+
}
|
|
@@ -0,0 +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
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type MountCrownOptions } from "./crown.js";
|
|
2
|
+
export * from "./crown.js";
|
|
3
|
+
export type CrownProps = MountCrownOptions & {
|
|
4
|
+
className?: string;
|
|
5
|
+
size?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function Crown({ className, size, ...options }: CrownProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { mountCrown } from "./crown.js";
|
|
4
|
+
export * from "./crown.js";
|
|
5
|
+
export function Crown({ className, size, ...options }) {
|
|
6
|
+
const ref = useRef(null);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const canvas = ref.current;
|
|
9
|
+
if (!canvas)
|
|
10
|
+
return;
|
|
11
|
+
return mountCrown(canvas, options);
|
|
12
|
+
}, []);
|
|
13
|
+
return (_jsx("canvas", { ref: ref, className: className, width: size, height: size, style: size ? { width: size, height: size } : undefined, "aria-hidden": "true" }));
|
|
14
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type HtmlPointer } from "../marmot/web.js";
|
|
2
|
+
import type { BrowserTool, PageRoom } from "../marmot/browser.js";
|
|
3
|
+
export type BrowserInstance = {
|
|
4
|
+
/** Page coordinates for a client point, or null outside the page. */
|
|
5
|
+
toPage(clientX: number, clientY: number): Point | null;
|
|
6
|
+
destroy(): void;
|
|
7
|
+
};
|
|
8
|
+
export type Point = {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
};
|
|
12
|
+
/** A press released at `up`: a click where it went down, or a drag once it moved past the slop. */
|
|
13
|
+
export declare function pressTool(down: Point, up: Point): BrowserTool;
|
|
14
|
+
type KeyLike = Pick<KeyboardEvent, "key" | "ctrlKey" | "altKey" | "metaKey" | "shiftKey" | "isComposing">;
|
|
15
|
+
/** Plain printable keys become text to batch, everything else a chord in the key tool's names. */
|
|
16
|
+
export declare function keyInput(event: KeyLike): {
|
|
17
|
+
text: string;
|
|
18
|
+
} | {
|
|
19
|
+
keys: string[];
|
|
20
|
+
} | null;
|
|
21
|
+
/**
|
|
22
|
+
* Forward a person's pointer, wheel, keyboard, and paste on `layer` to the room.
|
|
23
|
+
* Tools go out as soon as they're made, without waiting for replies; the host runs
|
|
24
|
+
* them in the order they arrive, so a click lands before the text typed after it.
|
|
25
|
+
* Bind it only while you control the room; the server refuses anyone else.
|
|
26
|
+
*/
|
|
27
|
+
export declare function bindInput<R extends PageRoom<any>>(room: R, layer: HTMLElement, opts: {
|
|
28
|
+
/** Page coordinates for a client point, or null outside the page. */
|
|
29
|
+
toPage: (clientX: number, clientY: number) => Point | null;
|
|
30
|
+
/** Send key chords as the key tool. Machine rooms have it; a browser page drops chords. */
|
|
31
|
+
keys?: boolean;
|
|
32
|
+
/** Handle a click here instead, like a machine's power button. True when it shouldn't reach the room. */
|
|
33
|
+
claimClick?: (point: Point) => boolean;
|
|
34
|
+
onHover?: (point: Point | null) => void;
|
|
35
|
+
}): () => void;
|
|
36
|
+
/** `R` is the room's own class, so a web page's BrowserRoom and a machine's MachineRoom both fit. */
|
|
37
|
+
export type BrowserMountOptions<R extends PageRoom<any> = PageRoom> = {
|
|
38
|
+
room: R;
|
|
39
|
+
url?: string;
|
|
40
|
+
seed?: string;
|
|
41
|
+
label?: string;
|
|
42
|
+
/** After each bootstrap renders, with the replay's document. Nodes added here aren't
|
|
43
|
+
* in the replay's id map, so keep them out of subtrees the page mutates. */
|
|
44
|
+
onFrame?: (doc: Document) => void;
|
|
45
|
+
/** One frame pixel is one page pixel, for a view drawn at its own size rather than
|
|
46
|
+
* the host's (a machine's desktop). The cursor, tools and `toPage` skip scaling. */
|
|
47
|
+
pagePixels?: boolean;
|
|
48
|
+
/** The page's real pointer moved or changed shape. The browser takes the room's
|
|
49
|
+
* `onCursor` hook, so follow the pointer here. */
|
|
50
|
+
onCursor?: (pointer: HtmlPointer) => void;
|
|
51
|
+
};
|
|
52
|
+
export declare function cursorSeed(options: {
|
|
53
|
+
seed?: string;
|
|
54
|
+
room?: {
|
|
55
|
+
id?: string;
|
|
56
|
+
};
|
|
57
|
+
}): string;
|
|
58
|
+
export declare function toolBadge(tool: BrowserTool): {
|
|
59
|
+
label: string;
|
|
60
|
+
tone: "neutral" | "good" | "bad";
|
|
61
|
+
};
|
|
62
|
+
export declare function playBrowserTool(opts: {
|
|
63
|
+
cursor: object;
|
|
64
|
+
ripple?: HTMLElement;
|
|
65
|
+
badge?: HTMLElement;
|
|
66
|
+
tool: BrowserTool;
|
|
67
|
+
toScreen: (x: number, y: number) => {
|
|
68
|
+
x: number;
|
|
69
|
+
y: number;
|
|
70
|
+
};
|
|
71
|
+
current: HtmlPointer;
|
|
72
|
+
}): gsap.core.Timeline;
|
|
73
|
+
export declare function createBrowser<R extends PageRoom<any>>(container: HTMLElement, options: BrowserMountOptions<R>): BrowserInstance;
|
|
74
|
+
export {};
|