@linktr.ee/arbor-mcp 0.1.1 → 0.1.2
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/index.js +85 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -580,6 +580,20 @@ var compositions_default = [
|
|
|
580
580
|
<AvatarGroupCount count={5} size="sm" />
|
|
581
581
|
</AvatarGroup>`
|
|
582
582
|
},
|
|
583
|
+
// ── Backdrop ──
|
|
584
|
+
// Maps to figma-mappings `Backdrop` (node 11643-116065). DNG-196 follow-up of DNG-50.
|
|
585
|
+
// Default = dark scrim (matches production parity for Dialog/Drawer);
|
|
586
|
+
// `inverted` flips to light scrim for dark surfaces.
|
|
587
|
+
{
|
|
588
|
+
group: "Backdrop",
|
|
589
|
+
name: "Backdrop",
|
|
590
|
+
code: "<Backdrop />"
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
group: "Backdrop",
|
|
594
|
+
name: "Backdrop (inverted)",
|
|
595
|
+
code: "<Backdrop inverted />"
|
|
596
|
+
},
|
|
583
597
|
// ── Badge ──
|
|
584
598
|
{
|
|
585
599
|
group: "Badge",
|
|
@@ -929,6 +943,31 @@ var compositions_default = [
|
|
|
929
943
|
<Text variant="body-sm-regular">This setting controls who can see your profile. Changes take effect immediately.</Text>
|
|
930
944
|
</PopoverContent>
|
|
931
945
|
</Popover>`
|
|
946
|
+
},
|
|
947
|
+
// ── RichTooltip ──
|
|
948
|
+
{
|
|
949
|
+
group: "RichTooltip",
|
|
950
|
+
name: "RichTooltip",
|
|
951
|
+
code: `<RichTooltip defaultOpen>
|
|
952
|
+
<RichTooltipTrigger asChild>
|
|
953
|
+
<Button variant="secondary" shape="squircle">Show tip</Button>
|
|
954
|
+
</RichTooltipTrigger>
|
|
955
|
+
<RichTooltipContent>
|
|
956
|
+
<RichTooltipIcon>
|
|
957
|
+
<InfoIcon size={16} weight="bold" />
|
|
958
|
+
</RichTooltipIcon>
|
|
959
|
+
<RichTooltipBody>
|
|
960
|
+
<RichTooltipTitle>Customize your link</RichTooltipTitle>
|
|
961
|
+
<RichTooltipDescription>
|
|
962
|
+
Pick a colour, add an icon, and reorder anything on your Linktree to match your style.
|
|
963
|
+
</RichTooltipDescription>
|
|
964
|
+
</RichTooltipBody>
|
|
965
|
+
<RichTooltipClose aria-label="Dismiss tip">
|
|
966
|
+
<XIcon size={16} weight="bold" />
|
|
967
|
+
</RichTooltipClose>
|
|
968
|
+
<RichTooltipArrow />
|
|
969
|
+
</RichTooltipContent>
|
|
970
|
+
</RichTooltip>`
|
|
932
971
|
},
|
|
933
972
|
// ── RadioGroup ──
|
|
934
973
|
{
|
|
@@ -1379,30 +1418,46 @@ function buildPlayroomUrl(jsx) {
|
|
|
1379
1418
|
);
|
|
1380
1419
|
return `${PLAYROOM_HOMEPAGE_URL}#?code=${compressed}`;
|
|
1381
1420
|
}
|
|
1382
|
-
async function mintPlayroomUrl(jsx, slugClient) {
|
|
1421
|
+
async function mintPlayroomUrl(jsx, slugClient, opts) {
|
|
1422
|
+
const title = typeof opts?.title === "string" && opts.title.length > 0 ? opts.title : void 0;
|
|
1423
|
+
const derivedTitleAtSave = typeof opts?.derivedTitleAtSave === "string" && opts.derivedTitleAtSave.length > 0 ? opts.derivedTitleAtSave : void 0;
|
|
1383
1424
|
let result;
|
|
1384
1425
|
try {
|
|
1385
|
-
|
|
1426
|
+
const mintOpts = title === void 0 ? void 0 : derivedTitleAtSave === void 0 ? { title } : { title, derivedTitleAtSave };
|
|
1427
|
+
result = await slugClient.mintOrReuse(jsx, mintOpts);
|
|
1386
1428
|
} catch {
|
|
1387
1429
|
return {
|
|
1388
|
-
url: buildPlayroomUrl(jsx),
|
|
1430
|
+
url: appendTitleParam(buildPlayroomUrl(jsx), title),
|
|
1389
1431
|
source: "lz-string-fallback",
|
|
1390
1432
|
reason: "network"
|
|
1391
1433
|
};
|
|
1392
1434
|
}
|
|
1393
1435
|
if (result.ok) {
|
|
1394
1436
|
return {
|
|
1395
|
-
url: result.url,
|
|
1437
|
+
url: appendTitleParam(result.url, title),
|
|
1396
1438
|
source: result.source,
|
|
1397
1439
|
slug: result.slug
|
|
1398
1440
|
};
|
|
1399
1441
|
}
|
|
1400
1442
|
return {
|
|
1401
|
-
url: buildPlayroomUrl(jsx),
|
|
1443
|
+
url: appendTitleParam(buildPlayroomUrl(jsx), title),
|
|
1402
1444
|
source: "lz-string-fallback",
|
|
1403
1445
|
reason: result.reason
|
|
1404
1446
|
};
|
|
1405
1447
|
}
|
|
1448
|
+
function appendTitleParam(url, title) {
|
|
1449
|
+
if (!title) return url;
|
|
1450
|
+
const encoded = encodeURIComponent(title);
|
|
1451
|
+
const hashIdx = url.indexOf("#");
|
|
1452
|
+
if (hashIdx === -1) {
|
|
1453
|
+
const sep2 = url.indexOf("?") === -1 ? "?" : "&";
|
|
1454
|
+
return `${url}${sep2}title=${encoded}`;
|
|
1455
|
+
}
|
|
1456
|
+
const before = url.slice(0, hashIdx);
|
|
1457
|
+
const hash = url.slice(hashIdx);
|
|
1458
|
+
const sep = before.indexOf("?") === -1 ? "?" : "&";
|
|
1459
|
+
return `${before}${sep}title=${encoded}${hash}`;
|
|
1460
|
+
}
|
|
1406
1461
|
function lookupByArborName(arborName) {
|
|
1407
1462
|
const normalized = typeof arborName === "string" ? arborName.trim() : "";
|
|
1408
1463
|
if (!normalized) {
|
|
@@ -1467,7 +1522,7 @@ function createSlugClient(opts) {
|
|
|
1467
1522
|
const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1468
1523
|
const endpointUrl = opts.endpoint.toString();
|
|
1469
1524
|
const inflight = /* @__PURE__ */ new Map();
|
|
1470
|
-
async function performMint(jsx, key) {
|
|
1525
|
+
async function performMint(jsx, key, mintOpts) {
|
|
1471
1526
|
const controller = new AbortController();
|
|
1472
1527
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
1473
1528
|
const headers = {
|
|
@@ -1479,12 +1534,19 @@ function createSlugClient(opts) {
|
|
|
1479
1534
|
if (opts.producerName) {
|
|
1480
1535
|
headers["X-Arbor-Producer"] = opts.producerName;
|
|
1481
1536
|
}
|
|
1537
|
+
const requestBody = { snippet: jsx };
|
|
1538
|
+
if (mintOpts && typeof mintOpts.title === "string" && mintOpts.title.length > 0) {
|
|
1539
|
+
requestBody.title = mintOpts.title;
|
|
1540
|
+
if (typeof mintOpts.derivedTitleAtSave === "string" && mintOpts.derivedTitleAtSave.length > 0) {
|
|
1541
|
+
requestBody.derivedTitleAtSave = mintOpts.derivedTitleAtSave;
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1482
1544
|
let response;
|
|
1483
1545
|
try {
|
|
1484
1546
|
response = await fetchImpl(endpointUrl, {
|
|
1485
1547
|
method: "POST",
|
|
1486
1548
|
headers,
|
|
1487
|
-
body: JSON.stringify(
|
|
1549
|
+
body: JSON.stringify(requestBody),
|
|
1488
1550
|
signal: controller.signal
|
|
1489
1551
|
});
|
|
1490
1552
|
} catch (err) {
|
|
@@ -1511,24 +1573,28 @@ function createSlugClient(opts) {
|
|
|
1511
1573
|
cache.set(key, branded);
|
|
1512
1574
|
return { ok: true, source: "minted", slug: branded, url };
|
|
1513
1575
|
}
|
|
1514
|
-
async function mintOrReuse(jsx) {
|
|
1576
|
+
async function mintOrReuse(jsx, mintOpts) {
|
|
1515
1577
|
const byteLength = new TextEncoder().encode(jsx).length;
|
|
1516
1578
|
if (byteLength > MAX_SNIPPET_BYTES) {
|
|
1517
1579
|
return { ok: false, reason: "oversize" };
|
|
1518
1580
|
}
|
|
1519
1581
|
const key = hashCode(jsx);
|
|
1520
|
-
const
|
|
1521
|
-
if (
|
|
1522
|
-
const
|
|
1523
|
-
|
|
1582
|
+
const hasTitleOverride = typeof mintOpts?.title === "string" && mintOpts.title.length > 0;
|
|
1583
|
+
if (!hasTitleOverride) {
|
|
1584
|
+
const cached = cache.get(key);
|
|
1585
|
+
if (cached) {
|
|
1586
|
+
const url = `${PLAYROOM_BASE_URL}?slug=${cached}`;
|
|
1587
|
+
return { ok: true, source: "cached", slug: cached, url };
|
|
1588
|
+
}
|
|
1589
|
+
const existing = inflight.get(key);
|
|
1590
|
+
if (existing) return existing;
|
|
1591
|
+
const promise = performMint(jsx, key, mintOpts).finally(() => {
|
|
1592
|
+
inflight.delete(key);
|
|
1593
|
+
});
|
|
1594
|
+
inflight.set(key, promise);
|
|
1595
|
+
return promise;
|
|
1524
1596
|
}
|
|
1525
|
-
|
|
1526
|
-
if (existing) return existing;
|
|
1527
|
-
const promise = performMint(jsx, key).finally(() => {
|
|
1528
|
-
inflight.delete(key);
|
|
1529
|
-
});
|
|
1530
|
-
inflight.set(key, promise);
|
|
1531
|
-
return promise;
|
|
1597
|
+
return performMint(jsx, key, mintOpts);
|
|
1532
1598
|
}
|
|
1533
1599
|
return { mintOrReuse };
|
|
1534
1600
|
}
|