@hanzo/rooms 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/LICENSE-APACHE +205 -0
- package/LICENSE-MIT +21 -0
- package/README.md +23 -0
- package/dist/Account.d.ts +8 -0
- package/dist/Account.js +58 -0
- package/dist/Beluga.d.ts +12 -0
- package/dist/Beluga.js +152 -0
- package/dist/Billing.d.ts +1 -0
- package/dist/Billing.js +31 -0
- package/dist/Board.d.ts +9 -0
- package/dist/Board.js +447 -0
- package/dist/Boxes.d.ts +1 -0
- package/dist/Boxes.js +173 -0
- package/dist/CalScheduler.d.ts +15 -0
- package/dist/CalScheduler.js +196 -0
- package/dist/Chat.d.ts +35 -0
- package/dist/Chat.js +1049 -0
- package/dist/Column.d.ts +15 -0
- package/dist/Column.js +88 -0
- package/dist/Contacts.d.ts +1 -0
- package/dist/Contacts.js +301 -0
- package/dist/Directory.d.ts +24 -0
- package/dist/Directory.js +356 -0
- package/dist/Drive.d.ts +2 -0
- package/dist/Drive.js +466 -0
- package/dist/Find.d.ts +7 -0
- package/dist/Find.js +82 -0
- package/dist/Guide.d.ts +6 -0
- package/dist/Guide.js +272 -0
- package/dist/Home.d.ts +39 -0
- package/dist/Home.js +306 -0
- package/dist/Inbox.d.ts +9 -0
- package/dist/Inbox.js +193 -0
- package/dist/Market.d.ts +3 -0
- package/dist/Market.js +149 -0
- package/dist/Me.d.ts +27 -0
- package/dist/Me.js +251 -0
- package/dist/Meet.d.ts +9 -0
- package/dist/Meet.js +370 -0
- package/dist/ModeMark.d.ts +8 -0
- package/dist/ModeMark.js +18 -0
- package/dist/OrgSwitcher.d.ts +31 -0
- package/dist/OrgSwitcher.js +120 -0
- package/dist/Orgs.d.ts +10 -0
- package/dist/Orgs.js +582 -0
- package/dist/Profile.d.ts +4 -0
- package/dist/Profile.js +67 -0
- package/dist/Prose.d.ts +5 -0
- package/dist/Prose.js +111 -0
- package/dist/ProviderMark.d.ts +17 -0
- package/dist/ProviderMark.js +277 -0
- package/dist/Recents.d.ts +10 -0
- package/dist/Recents.js +91 -0
- package/dist/RightPane.d.ts +13 -0
- package/dist/RightPane.js +426 -0
- package/dist/Room.d.ts +8 -0
- package/dist/Room.js +50 -0
- package/dist/Scene.d.ts +12 -0
- package/dist/Scene.js +105 -0
- package/dist/Settings.d.ts +46 -0
- package/dist/Settings.js +321 -0
- package/dist/Setup.d.ts +1 -0
- package/dist/Setup.js +36 -0
- package/dist/Share.d.ts +3 -0
- package/dist/Share.js +130 -0
- package/dist/Shared.d.ts +1 -0
- package/dist/Shared.js +113 -0
- package/dist/Shell.d.ts +63 -0
- package/dist/Shell.js +1225 -0
- package/dist/Start.d.ts +1 -0
- package/dist/Start.js +96 -0
- package/dist/Support.d.ts +14 -0
- package/dist/Support.js +122 -0
- package/dist/Talk.d.ts +4 -0
- package/dist/Talk.js +107 -0
- package/dist/Upgrade.d.ts +11 -0
- package/dist/Upgrade.js +75 -0
- package/dist/Usage.d.ts +1 -0
- package/dist/Usage.js +21 -0
- package/dist/Vibe.d.ts +2 -0
- package/dist/Vibe.js +188 -0
- package/dist/Work.d.ts +12 -0
- package/dist/Work.js +256 -0
- package/dist/bots/Bots.d.ts +2 -0
- package/dist/bots/Bots.js +456 -0
- package/dist/bots/Lights.d.ts +8 -0
- package/dist/bots/Lights.js +13 -0
- package/dist/bots/api.d.ts +120 -0
- package/dist/bots/api.js +75 -0
- package/dist/bots/face.d.ts +5 -0
- package/dist/bots/face.js +13 -0
- package/dist/bots/ink.d.ts +7 -0
- package/dist/bots/ink.js +29 -0
- package/dist/bots/kit.d.ts +113 -0
- package/dist/bots/kit.js +43 -0
- package/dist/bots/runtime.d.ts +4 -0
- package/dist/bots/runtime.js +326 -0
- package/dist/card.d.ts +52 -0
- package/dist/card.js +52 -0
- package/dist/cast.d.ts +143 -0
- package/dist/cast.js +251 -0
- package/dist/connect.d.ts +29 -0
- package/dist/connect.js +64 -0
- package/dist/contacts-store.d.ts +111 -0
- package/dist/contacts-store.js +276 -0
- package/dist/conversations.d.ts +54 -0
- package/dist/conversations.js +98 -0
- package/dist/copy.d.ts +23 -0
- package/dist/copy.js +39 -0
- package/dist/crew.d.ts +36 -0
- package/dist/crew.js +304 -0
- package/dist/dev.d.ts +3 -0
- package/dist/dev.js +102 -0
- package/dist/enso.d.ts +70 -0
- package/dist/enso.js +112 -0
- package/dist/failure.d.ts +57 -0
- package/dist/failure.js +143 -0
- package/dist/ground.d.ts +32 -0
- package/dist/ground.js +32 -0
- package/dist/host.d.ts +76 -0
- package/dist/host.js +76 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +12 -0
- package/dist/kept.d.ts +5 -0
- package/dist/kept.js +27 -0
- package/dist/lib/account.d.ts +49 -0
- package/dist/lib/account.js +229 -0
- package/dist/lib/ai.d.ts +46 -0
- package/dist/lib/ai.js +140 -0
- package/dist/lib/api.d.ts +43 -0
- package/dist/lib/api.js +62 -0
- package/dist/lib/bare.d.ts +9 -0
- package/dist/lib/bare.js +7 -0
- package/dist/lib/coding.d.ts +105 -0
- package/dist/lib/coding.js +87 -0
- package/dist/lib/destination.d.ts +102 -0
- package/dist/lib/destination.js +260 -0
- package/dist/lib/durable.d.ts +66 -0
- package/dist/lib/durable.js +107 -0
- package/dist/lib/first.d.ts +11 -0
- package/dist/lib/first.js +23 -0
- package/dist/lib/home.d.ts +61 -0
- package/dist/lib/home.js +54 -0
- package/dist/lib/host.d.ts +104 -0
- package/dist/lib/host.js +132 -0
- package/dist/lib/hostname.d.ts +1 -0
- package/dist/lib/hostname.js +14 -0
- package/dist/lib/hydrated.d.ts +1 -0
- package/dist/lib/hydrated.js +20 -0
- package/dist/lib/integrations.d.ts +21 -0
- package/dist/lib/integrations.js +1 -0
- package/dist/lib/intent.d.ts +6 -0
- package/dist/lib/intent.js +71 -0
- package/dist/lib/invite.d.ts +155 -0
- package/dist/lib/invite.js +245 -0
- package/dist/lib/limits.d.ts +55 -0
- package/dist/lib/limits.js +119 -0
- package/dist/lib/list.d.ts +9 -0
- package/dist/lib/list.js +11 -0
- package/dist/lib/mark.d.ts +13 -0
- package/dist/lib/mark.js +85 -0
- package/dist/lib/mix.d.ts +22 -0
- package/dist/lib/mix.js +22 -0
- package/dist/lib/models.d.ts +27 -0
- package/dist/lib/models.js +106 -0
- package/dist/lib/org.d.ts +109 -0
- package/dist/lib/org.js +140 -0
- package/dist/lib/path.d.ts +9 -0
- package/dist/lib/path.js +29 -0
- package/dist/lib/plans.d.ts +193 -0
- package/dist/lib/plans.js +310 -0
- package/dist/lib/prose.d.ts +13 -0
- package/dist/lib/prose.js +62 -0
- package/dist/lib/reach.d.ts +17 -0
- package/dist/lib/reach.js +70 -0
- package/dist/lib/rooms.json +23 -0
- package/dist/lib/served.d.ts +20 -0
- package/dist/lib/served.js +92 -0
- package/dist/lib/session.d.ts +211 -0
- package/dist/lib/session.js +493 -0
- package/dist/lib/share.d.ts +131 -0
- package/dist/lib/share.js +216 -0
- package/dist/lib/signout.d.ts +14 -0
- package/dist/lib/signout.js +40 -0
- package/dist/lib/tags.d.ts +27 -0
- package/dist/lib/tags.js +46 -0
- package/dist/lib/tap.d.ts +17 -0
- package/dist/lib/tap.js +9 -0
- package/dist/lib/tier.d.ts +115 -0
- package/dist/lib/tier.js +207 -0
- package/dist/lib/tiers.d.ts +9 -0
- package/dist/lib/tiers.js +141 -0
- package/dist/lib/todo.d.ts +125 -0
- package/dist/lib/todo.js +379 -0
- package/dist/look.d.ts +1 -0
- package/dist/look.js +21 -0
- package/dist/meters.d.ts +8 -0
- package/dist/meters.js +31 -0
- package/dist/model.d.ts +4 -0
- package/dist/model.js +44 -0
- package/dist/network.d.ts +64 -0
- package/dist/network.js +216 -0
- package/dist/open.d.ts +81 -0
- package/dist/open.js +149 -0
- package/dist/pane.d.ts +92 -0
- package/dist/pane.js +231 -0
- package/dist/progress.d.ts +46 -0
- package/dist/progress.js +51 -0
- package/dist/recent.d.ts +67 -0
- package/dist/recent.js +161 -0
- package/dist/rooms.d.ts +131 -0
- package/dist/rooms.js +195 -0
- package/dist/roster.d.ts +28 -0
- package/dist/roster.js +70 -0
- package/dist/span.d.ts +14 -0
- package/dist/span.js +50 -0
- package/dist/speech.d.ts +44 -0
- package/dist/speech.js +229 -0
- package/dist/stars.d.ts +16 -0
- package/dist/stars.js +75 -0
- package/dist/tabs.d.ts +26 -0
- package/dist/tabs.js +25 -0
- package/dist/team.d.ts +11 -0
- package/dist/team.gen.d.ts +10 -0
- package/dist/team.gen.js +11 -0
- package/dist/team.js +30 -0
- package/dist/tools.d.ts +35 -0
- package/dist/tools.js +143 -0
- package/dist/tours.d.ts +24 -0
- package/dist/tours.js +311 -0
- package/dist/waiting.d.ts +15 -0
- package/dist/waiting.js +17 -0
- package/dist/where.d.ts +54 -0
- package/dist/where.js +14 -0
- package/package.json +108 -0
package/dist/Profile.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
// The reader's own profile, in the column beside the room.
|
|
4
|
+
//
|
|
5
|
+
// A WORKSPACE OPENS A PROFILE IN A PANEL, not a page. The page exists — it is
|
|
6
|
+
// /account, and it is where the whole record is edited — but reaching it from a
|
|
7
|
+
// conversation costs the conversation: the room, the sidebar and the rail all
|
|
8
|
+
// go, and coming back is a navigation rather than a close. Slack, Teams and
|
|
9
|
+
// every app shaped like them put this in the right column for that reason, and
|
|
10
|
+
// so does the thread view that will share this slot.
|
|
11
|
+
//
|
|
12
|
+
// EVERY CONTROL DOES ITS VERB. Slack's panel carries "Set a status" and "View
|
|
13
|
+
// as" and this one does not, because IAM stores no status and there is nobody
|
|
14
|
+
// to view as. What is here is what there is: the picture can be changed, the
|
|
15
|
+
// record can be edited, and the rest is read.
|
|
16
|
+
import { useRooms } from './host.js';
|
|
17
|
+
import { site } from './where.js';
|
|
18
|
+
import { useRef, useState } from 'react';
|
|
19
|
+
import { Camera, Mail, Phone, X } from 'lucide-react';
|
|
20
|
+
import { Box, Text, View, XStack, YStack } from '@hanzo/ui';
|
|
21
|
+
import { sheet } from '@hanzo/ui/glass';
|
|
22
|
+
import { pane } from './ground.js';
|
|
23
|
+
import { useAccount } from './lib/account.js';
|
|
24
|
+
import { reach } from './lib/reach.js';
|
|
25
|
+
import { mark } from './lib/mark.js';
|
|
26
|
+
import { BAD } from './lib/mix.js';
|
|
27
|
+
/** Slack's is 380 and the thread panel that shares this slot is the same. */
|
|
28
|
+
const WIDTH = 380;
|
|
29
|
+
const ACCOUNT = '/account';
|
|
30
|
+
export function Profile({ open, onClose }) {
|
|
31
|
+
const { Link } = useRooms();
|
|
32
|
+
const { user, updateUserProfile } = useAccount();
|
|
33
|
+
const picker = useRef(null);
|
|
34
|
+
const [busy, setBusy] = useState(false);
|
|
35
|
+
const [failed, setFailed] = useState(null);
|
|
36
|
+
if (!open || !user)
|
|
37
|
+
return null;
|
|
38
|
+
const pick = async (file) => {
|
|
39
|
+
if (!file)
|
|
40
|
+
return;
|
|
41
|
+
setBusy(true);
|
|
42
|
+
setFailed(null);
|
|
43
|
+
try {
|
|
44
|
+
await updateUserProfile({ avatar: await mark(file) });
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
// In the panel rather than a toast: the picture is here, so the reason it
|
|
48
|
+
// did not change belongs here too.
|
|
49
|
+
setFailed(reach(e));
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
setBusy(false);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
return (_jsxs(YStack, { ...pane(sheet(2).backgroundColor), width: WIDTH, maxW: "100%", shrink: 0, minH: 0,
|
|
56
|
+
// A column on a laptop. On a phone the room is already the whole screen,
|
|
57
|
+
// so this covers it rather than squeezing it to nothing.
|
|
58
|
+
position: "absolute", t: 0, r: 0, b: 0, l: 0, z: "var(--z-panel)", $lg: { position: 'relative', z: 'var(--z-base)', l: 'auto' }, children: [_jsxs(XStack, { items: "center", px: "$4", py: "$3", gap: "$2", children: [_jsx(Text, { flex: 1, fontSize: "$5", fontWeight: "600", color: "$ink", children: "Profile" }), _jsx(Box, { render: "button", onClick: onClose, "aria-label": "Close profile", p: "$2", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(X, { size: 16, "aria-hidden": true }) })] }), _jsxs(YStack, { flex: 1, minH: 0, overflow: "scroll", px: "$4", pb: "$5", gap: "$4", children: [_jsx("input", { ref: picker, type: "file", accept: "image/png,image/jpeg,image/gif,image/webp", hidden: true, onChange: (e) => {
|
|
59
|
+
const file = e.target.files?.[0];
|
|
60
|
+
e.target.value = '';
|
|
61
|
+
void pick(file);
|
|
62
|
+
} }), _jsxs(Box, { render: "button", onClick: () => {
|
|
63
|
+
if (busy)
|
|
64
|
+
return;
|
|
65
|
+
picker.current?.click();
|
|
66
|
+
}, "aria-label": "Change your picture", "aria-disabled": busy, width: "100%", aspectRatio: 1, rounded: "$5", overflow: "hidden", borderWidth: 1, borderColor: "$borderColor", bg: "$raised", position: "relative", children: [user.avatar ? (_jsx(View, { render: _jsx("img", { src: user.avatar, alt: "" }), width: "100%", height: "100%", objectFit: "cover", display: "block" })) : (_jsx(YStack, { width: "100%", height: "100%", items: "center", justify: "center", children: _jsx(Text, { fontSize: 72, fontWeight: "600", color: "$soft", children: (user.name?.trim()[0] ?? '?').toUpperCase() }) })), _jsxs(XStack, { position: "absolute", l: 0, r: 0, b: 0, items: "center", justify: "center", gap: "$2", py: "$2", bg: "$background", opacity: 0.85, children: [_jsx(Camera, { size: 14, "aria-hidden": true }), _jsx(Text, { fontSize: "$2", color: "$ink", children: busy ? 'Saving…' : user.avatar ? 'Change picture' : 'Add a picture' })] })] }), failed ? (_jsx(Text, { fontSize: "$2", color: BAD, children: failed })) : null, _jsxs(XStack, { items: "baseline", gap: "$3", children: [_jsx(Text, { flex: 1, fontSize: "$6", fontWeight: "600", color: "$ink", numberOfLines: 2, children: user.name }), _jsx(Link, { href: site(ACCOUNT), children: _jsx(Text, { fontSize: "$2", color: "$quiet", children: "Edit" }) })] }), user.bio ? (_jsx(Text, { fontSize: "$3", color: "$soft", children: user.bio })) : null, _jsxs(YStack, { gap: "$2", pt: "$3", borderTopWidth: 1, borderColor: "$edge", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: "Contact information" }), _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Mail, { size: 14, "aria-hidden": true }), _jsx(Text, { fontSize: "$3", color: "$soft", children: user.email })] }), user.phone ? (_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Phone, { size: 14, "aria-hidden": true }), _jsx(Text, { fontSize: "$3", color: "$soft", children: user.phone })] })) : null] })] })] }));
|
|
67
|
+
}
|
package/dist/Prose.d.ts
ADDED
package/dist/Prose.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Anchor, Text, View, XStack, YStack } from '@hanzo/gui';
|
|
4
|
+
import { destination, read } from './lib/prose.js';
|
|
5
|
+
const INK = 'var(--foreground)';
|
|
6
|
+
const QUIET = 'var(--muted-foreground)';
|
|
7
|
+
const EDGE = 'var(--border)';
|
|
8
|
+
const GROUND = 'var(--secondary)';
|
|
9
|
+
/** A heading's rung, by depth: one step down the type ramp per level. */
|
|
10
|
+
const RUNG = ['$6', '$4', '$3', '$2', '$2', '$2'];
|
|
11
|
+
/** The character references a model writes, as the characters they name. An
|
|
12
|
+
* HTML renderer let the browser decode `&`; a string React sets is shown
|
|
13
|
+
* exactly as written. */
|
|
14
|
+
const NAMED = { amp: '&', lt: '<', gt: '>', quot: '"', apos: "'", nbsp: ' ' };
|
|
15
|
+
const decode = (s) => s.replace(/&(?:#x([0-9a-f]{1,6})|#(\d{1,7})|([a-z]+));/gi, (all, hex, dec, name) => {
|
|
16
|
+
if (hex || dec) {
|
|
17
|
+
const n = hex ? parseInt(hex, 16) : Number(dec);
|
|
18
|
+
return n > 0 && n <= 0x10ffff ? String.fromCodePoint(n) : all;
|
|
19
|
+
}
|
|
20
|
+
return NAMED[name.toLowerCase()] ?? all;
|
|
21
|
+
});
|
|
22
|
+
/** One run of inline tokens, in `tone`, at the block's `rung`. */
|
|
23
|
+
function inline(tokens, tone, rung = '$2') {
|
|
24
|
+
return (tokens ?? []).map((t, i) => {
|
|
25
|
+
switch (t.type) {
|
|
26
|
+
case 'strong':
|
|
27
|
+
return (_jsx(Text, { render: "strong", color: tone, fontWeight: "600", children: inline(t.tokens, tone, rung) }, i));
|
|
28
|
+
case 'em':
|
|
29
|
+
return (_jsx(Text, { render: "em", color: tone, fontStyle: "italic", children: inline(t.tokens, tone, rung) }, i));
|
|
30
|
+
case 'del':
|
|
31
|
+
return (_jsx(Text, { render: "del", color: tone, textDecorationLine: "line-through", opacity: 0.7, children: inline(t.tokens, tone, rung) }, i));
|
|
32
|
+
case 'codespan':
|
|
33
|
+
return (_jsx(Text, { render: "code", color: tone, fontFamily: "$mono", fontSize: "$1", px: "$1", rounded: 4, bg: GROUND, children: decode(t.text) }, i));
|
|
34
|
+
case 'br':
|
|
35
|
+
return _jsx("br", {}, i);
|
|
36
|
+
case 'link': {
|
|
37
|
+
const to = destination(t.href);
|
|
38
|
+
if (!to)
|
|
39
|
+
return inline(t.tokens, tone, rung);
|
|
40
|
+
// AWAY IS A NEW TAB, HOME IS NOT. Someone else's page opened from a
|
|
41
|
+
// message never gets a handle on this one and never inherits the
|
|
42
|
+
// referrer; a link back into this app is a link.
|
|
43
|
+
return (_jsx(Anchor, { href: to.href, ...(to.away ? { target: '_blank', rel: 'noopener noreferrer nofollow' } : {}), ...(t.title ? { title: t.title } : {}), size: rung, color: INK, textDecorationLine: "underline", children: inline(t.tokens, INK, rung) }, i));
|
|
44
|
+
}
|
|
45
|
+
// An image is a fetch to wherever the message says, which is a reader's
|
|
46
|
+
// address leaking to whoever wrote it. The alt text is the message.
|
|
47
|
+
case 'image':
|
|
48
|
+
return decode(t.text);
|
|
49
|
+
// Raw HTML in a message is text somebody typed, shown as what it is.
|
|
50
|
+
case 'html':
|
|
51
|
+
return t.text;
|
|
52
|
+
case 'text':
|
|
53
|
+
return 'tokens' in t && t.tokens ? inline(t.tokens, tone, rung) : decode(t.text);
|
|
54
|
+
default:
|
|
55
|
+
return 'text' in t ? decode(String(t.text)) : null;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/** Running text: a paragraph, or a list item's own words. */
|
|
60
|
+
function Line({ tokens, tone }) {
|
|
61
|
+
return (_jsx(Text, { render: "p", color: tone, fontSize: "$2", lineHeight: "$3", children: inline(tokens, tone) }));
|
|
62
|
+
}
|
|
63
|
+
function List({ list, tone }) {
|
|
64
|
+
const start = typeof list.start === 'number' ? list.start : 1;
|
|
65
|
+
return (_jsx(YStack, { render: list.ordered ? 'ol' : 'ul', m: 0, p: 0, gap: "$1", children: list.items.map((item, i) => (_jsxs(XStack, { render: "li", gap: "$1", children: [_jsx(Text, { "aria-hidden": true, color: tone, fontSize: "$2", lineHeight: "$3", minW: 14, text: "right", children: item.task ? (item.checked ? '☑' : '☐') : list.ordered ? `${start + i}.` : '•' }), _jsx(YStack, { flex: 1, minW: 0, gap: "$1", children: blocks(item.tokens, tone) })] }, i))) }));
|
|
66
|
+
}
|
|
67
|
+
/** A table is a grid: one track per column, as wide as what the column holds,
|
|
68
|
+
* in a box that scrolls sideways rather than widening the message. Cells
|
|
69
|
+
* share an edge by drawing their right and bottom ones; the first row adds
|
|
70
|
+
* the top and the first column the left. */
|
|
71
|
+
function Table({ table, tone }) {
|
|
72
|
+
const align = (c) => table.align[c] ?? 'left';
|
|
73
|
+
return (_jsx(View, { role: "table", display: "grid", gridTemplateColumns: `repeat(${table.header.length}, max-content)`, self: "flex-start", maxW: "100%", overflowX: "auto", children: [table.header, ...table.rows].map((row, r) => (_jsx(View, { role: "row", display: "contents", children: row.map((cell, c) => (_jsx(Text, { role: r ? 'cell' : 'columnheader', color: tone, fontSize: "$2", lineHeight: "$3", fontWeight: r ? '400' : '600', text: align(c), px: "$2", py: "$1", bg: r ? undefined : GROUND, borderColor: EDGE, borderStyle: "solid", borderRightWidth: 1, borderBottomWidth: 1, borderTopWidth: r ? 0 : 1, borderLeftWidth: c ? 0 : 1, children: inline(cell.tokens, tone) }, c))) }, r))) }));
|
|
74
|
+
}
|
|
75
|
+
/** A run of block tokens. A tight list item's words arrive as a `text` block. */
|
|
76
|
+
function blocks(tokens, tone) {
|
|
77
|
+
return (tokens ?? []).map((t, i) => {
|
|
78
|
+
switch (t.type) {
|
|
79
|
+
case 'paragraph':
|
|
80
|
+
return _jsx(Line, { tokens: t.tokens, tone: tone }, i);
|
|
81
|
+
case 'text':
|
|
82
|
+
return _jsx(Line, { tokens: 'tokens' in t && t.tokens ? t.tokens : [t], tone: tone }, i);
|
|
83
|
+
case 'heading':
|
|
84
|
+
return (_jsx(Text, { render: `h${t.depth}`, m: 0, color: tone, fontSize: RUNG[t.depth - 1], lineHeight: RUNG[t.depth - 1], fontWeight: "600", children: inline(t.tokens, tone, RUNG[t.depth - 1]) }, i));
|
|
85
|
+
case 'list':
|
|
86
|
+
return _jsx(List, { list: t, tone: tone }, i);
|
|
87
|
+
case 'table':
|
|
88
|
+
return _jsx(Table, { table: t, tone: tone }, i);
|
|
89
|
+
// A fenced block scrolls SIDEWAYS on its own: wrapping code changes what
|
|
90
|
+
// it says, and letting it push the message wider drags the whole
|
|
91
|
+
// transcript into a horizontal scroll.
|
|
92
|
+
case 'code':
|
|
93
|
+
return (_jsx(View, { render: "pre", m: 0, overflowX: "auto", px: "$3.5", py: "$3", rounded: "$3", bg: GROUND, children: _jsx(Text, { render: "code", color: tone, fontFamily: "$mono", fontSize: "$1", lineHeight: "$2", whiteSpace: "pre", children: t.text }) }, i));
|
|
94
|
+
case 'blockquote':
|
|
95
|
+
return (_jsx(YStack, { render: "blockquote", m: 0, pl: "$3", gap: "$2", borderWidth: 0, borderLeftWidth: 2, borderStyle: "solid", borderColor: EDGE, children: blocks(t.tokens, QUIET) }, i));
|
|
96
|
+
case 'hr':
|
|
97
|
+
return _jsx(View, { render: "hr", m: 0, height: 0, borderWidth: 0, borderTopWidth: 1, borderStyle: "solid", borderColor: EDGE }, i);
|
|
98
|
+
case 'html':
|
|
99
|
+
return _jsx(Line, { tokens: [t], tone: tone }, i);
|
|
100
|
+
default:
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/** One message's markdown, drawn. Empty in, nothing out — a streaming turn
|
|
106
|
+
* asks on every token and the first is nothing. */
|
|
107
|
+
export function Prose({ text }) {
|
|
108
|
+
if (!text)
|
|
109
|
+
return null;
|
|
110
|
+
return (_jsx(YStack, { "data-slot": "prose", gap: "$2", minW: 0, children: blocks(read(text), INK) }));
|
|
111
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare function ProviderMark({ org, provider, model, size, ink, }: {
|
|
2
|
+
org?: string;
|
|
3
|
+
provider?: string;
|
|
4
|
+
model?: string;
|
|
5
|
+
/** Edge of the square the glyph is drawn in, in px. */
|
|
6
|
+
size?: number;
|
|
7
|
+
/**
|
|
8
|
+
* Draw in the page's own colour rather than the lab's brand hue.
|
|
9
|
+
*
|
|
10
|
+
* A brand hue is IDENTIFICATION: in the catalog, in a scatter plot, in the
|
|
11
|
+
* integrations list, the colour is how a reader picks one lab out of forty,
|
|
12
|
+
* and dropping it there would cost real information. On a marketing band it
|
|
13
|
+
* identifies nothing — the name is right next to the mark — and eight brand
|
|
14
|
+
* palettes in a row on a monochrome page is a row of stickers.
|
|
15
|
+
*/
|
|
16
|
+
ink?: boolean;
|
|
17
|
+
}): import("react").JSX.Element;
|