@braincrew-lab/langchain-canvas 0.1.9 → 0.1.10
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 +108 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -180,7 +180,7 @@ var INSPECTOR_SCRIPT = `
|
|
|
180
180
|
fmtBar.className = "lcx-fmt";
|
|
181
181
|
fmtBar.style.left = Math.max(4, r.left) + "px";
|
|
182
182
|
fmtBar.style.top = Math.max(4, r.top - 40) + "px";
|
|
183
|
-
var specs = [["<b>B</b>", "bold"], ["<i>I</i>", "italic"], ["<u>U</u>", "underline"], ["\\uD83D\\uDD17", "createLink"]];
|
|
183
|
+
var specs = [["<b>B</b>", "bold"], ["<i>I</i>", "italic"], ["<u>U</u>", "underline"], ["•", "insertUnorderedList"], ["1.", "insertOrderedList"], ["\\uD83D\\uDD17", "createLink"]];
|
|
184
184
|
for (var i = 0; i < specs.length; i++) {
|
|
185
185
|
(function (spec) {
|
|
186
186
|
var btn = document.createElement("button");
|
|
@@ -1527,6 +1527,87 @@ var TEMPLATES = {
|
|
|
1527
1527
|
<p style="margin:0 0 22px;opacity:.9">Join thousands of teams already building with us.</p>
|
|
1528
1528
|
<a href="#" style="display:inline-block;padding:12px 24px;background:#fff;color:#4338ca;border-radius:10px;text-decoration:none;font-weight:700">Sign up</a>
|
|
1529
1529
|
</section>`
|
|
1530
|
+
},
|
|
1531
|
+
navbar: {
|
|
1532
|
+
label: "Nav bar",
|
|
1533
|
+
html: `<nav style="display:flex;align-items:center;justify-content:space-between;padding:18px 32px;background:#0b1020;color:#e6e8ef;border-bottom:1px solid #232a44">
|
|
1534
|
+
<strong style="font-size:18px;letter-spacing:-.01em">Brand</strong>
|
|
1535
|
+
<div style="display:flex;gap:26px;align-items:center;font-size:15px">
|
|
1536
|
+
<a href="#" style="color:#c7cddb;text-decoration:none">Product</a>
|
|
1537
|
+
<a href="#" style="color:#c7cddb;text-decoration:none">Pricing</a>
|
|
1538
|
+
<a href="#" style="color:#c7cddb;text-decoration:none">Docs</a>
|
|
1539
|
+
<a href="#" style="padding:9px 18px;background:#6366f1;color:#fff;border-radius:9px;text-decoration:none;font-weight:600">Sign in</a>
|
|
1540
|
+
</div>
|
|
1541
|
+
</nav>`
|
|
1542
|
+
},
|
|
1543
|
+
pricing: {
|
|
1544
|
+
label: "Pricing",
|
|
1545
|
+
html: `<section style="padding:56px 24px;background:#0b1020;color:#e6e8ef">
|
|
1546
|
+
<div style="max-width:960px;margin:0 auto;display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:20px">
|
|
1547
|
+
<div style="background:#151a2e;border:1px solid #232a44;border-radius:16px;padding:28px"><h3 style="margin:0 0 6px">Starter</h3><p style="font-size:34px;font-weight:800;margin:0 0 4px">$0<span style="font-size:15px;font-weight:400;color:#9aa4b2">/mo</span></p><ul style="margin:16px 0 0;padding-left:1.1em;color:#9aa4b2;line-height:1.9"><li>1 project</li><li>Community support</li></ul></div>
|
|
1548
|
+
<div style="background:#1b2140;border:1px solid #3a44f1;border-radius:16px;padding:28px"><h3 style="margin:0 0 6px">Pro</h3><p style="font-size:34px;font-weight:800;margin:0 0 4px">$29<span style="font-size:15px;font-weight:400;color:#9aa4b2">/mo</span></p><ul style="margin:16px 0 0;padding-left:1.1em;color:#c7cddb;line-height:1.9"><li>Unlimited projects</li><li>Priority support</li></ul></div>
|
|
1549
|
+
<div style="background:#151a2e;border:1px solid #232a44;border-radius:16px;padding:28px"><h3 style="margin:0 0 6px">Team</h3><p style="font-size:34px;font-weight:800;margin:0 0 4px">$99<span style="font-size:15px;font-weight:400;color:#9aa4b2">/mo</span></p><ul style="margin:16px 0 0;padding-left:1.1em;color:#9aa4b2;line-height:1.9"><li>SSO & roles</li><li>SLA</li></ul></div>
|
|
1550
|
+
</div>
|
|
1551
|
+
</section>`
|
|
1552
|
+
},
|
|
1553
|
+
stats: {
|
|
1554
|
+
label: "Stats",
|
|
1555
|
+
html: `<section style="padding:56px 24px;background:#0b1020;color:#e6e8ef">
|
|
1556
|
+
<div style="max-width:900px;margin:0 auto;display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:24px;text-align:center">
|
|
1557
|
+
<div><div style="font-size:44px;font-weight:800">12k+</div><div style="color:#9aa4b2">Customers</div></div>
|
|
1558
|
+
<div><div style="font-size:44px;font-weight:800">99.9%</div><div style="color:#9aa4b2">Uptime</div></div>
|
|
1559
|
+
<div><div style="font-size:44px;font-weight:800">4.9/5</div><div style="color:#9aa4b2">Rating</div></div>
|
|
1560
|
+
</div>
|
|
1561
|
+
</section>`
|
|
1562
|
+
},
|
|
1563
|
+
testimonial: {
|
|
1564
|
+
label: "Testimonial",
|
|
1565
|
+
html: `<section style="padding:64px 24px;background:#151a2e;color:#e6e8ef;text-align:center">
|
|
1566
|
+
<p style="max-width:640px;margin:0 auto 20px;font-size:24px;line-height:1.5;font-weight:600">\u201CThis is the tool our team didn't know it was missing. Shipped a landing page in an afternoon.\u201D</p>
|
|
1567
|
+
<p style="margin:0;color:#9aa4b2">Jordan Lee \xB7 Head of Product, Acme</p>
|
|
1568
|
+
</section>`
|
|
1569
|
+
},
|
|
1570
|
+
faq: {
|
|
1571
|
+
label: "FAQ",
|
|
1572
|
+
html: `<section style="padding:56px 24px;background:#0b1020;color:#e6e8ef">
|
|
1573
|
+
<div style="max-width:720px;margin:0 auto">
|
|
1574
|
+
<h2 style="margin:0 0 24px;font-size:26px">Frequently asked</h2>
|
|
1575
|
+
<div style="border-top:1px solid #232a44;padding:18px 0"><h4 style="margin:0 0 6px">Is there a free plan?</h4><p style="margin:0;color:#9aa4b2">Yes \u2014 the Starter plan is free forever.</p></div>
|
|
1576
|
+
<div style="border-top:1px solid #232a44;padding:18px 0"><h4 style="margin:0 0 6px">Can I cancel anytime?</h4><p style="margin:0;color:#9aa4b2">Absolutely, no questions asked.</p></div>
|
|
1577
|
+
</div>
|
|
1578
|
+
</section>`
|
|
1579
|
+
},
|
|
1580
|
+
gallery: {
|
|
1581
|
+
label: "Gallery",
|
|
1582
|
+
html: `<section style="padding:40px 24px;background:#0b1020">
|
|
1583
|
+
<div style="max-width:960px;margin:0 auto;display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:14px">
|
|
1584
|
+
<img src="https://placehold.co/400x300/1b2140/9aa4b2?text=1" alt="" style="width:100%;border-radius:12px;display:block" />
|
|
1585
|
+
<img src="https://placehold.co/400x300/1b2140/9aa4b2?text=2" alt="" style="width:100%;border-radius:12px;display:block" />
|
|
1586
|
+
<img src="https://placehold.co/400x300/1b2140/9aa4b2?text=3" alt="" style="width:100%;border-radius:12px;display:block" />
|
|
1587
|
+
</div>
|
|
1588
|
+
</section>`
|
|
1589
|
+
},
|
|
1590
|
+
contact: {
|
|
1591
|
+
label: "Contact form",
|
|
1592
|
+
html: `<section style="padding:56px 24px;background:#151a2e;color:#e6e8ef">
|
|
1593
|
+
<form style="max-width:480px;margin:0 auto;display:flex;flex-direction:column;gap:12px">
|
|
1594
|
+
<h2 style="margin:0 0 6px;font-size:24px">Get in touch</h2>
|
|
1595
|
+
<input placeholder="Your name" style="padding:12px 14px;border-radius:10px;border:1px solid #232a44;background:#0b1020;color:#e6e8ef" />
|
|
1596
|
+
<input placeholder="Email" style="padding:12px 14px;border-radius:10px;border:1px solid #232a44;background:#0b1020;color:#e6e8ef" />
|
|
1597
|
+
<textarea placeholder="Message" rows="4" style="padding:12px 14px;border-radius:10px;border:1px solid #232a44;background:#0b1020;color:#e6e8ef"></textarea>
|
|
1598
|
+
<button style="padding:12px;background:#6366f1;color:#fff;border:0;border-radius:10px;font-weight:700;cursor:pointer">Send</button>
|
|
1599
|
+
</form>
|
|
1600
|
+
</section>`
|
|
1601
|
+
},
|
|
1602
|
+
footer: {
|
|
1603
|
+
label: "Footer",
|
|
1604
|
+
html: `<footer style="padding:40px 32px;background:#080b16;color:#9aa4b2;display:flex;flex-wrap:wrap;gap:24px;justify-content:space-between;border-top:1px solid #232a44">
|
|
1605
|
+
<div><strong style="color:#e6e8ef;font-size:16px">Brand</strong><p style="margin:8px 0 0;max-width:260px;font-size:14px">Build faster with confidence.</p></div>
|
|
1606
|
+
<div style="display:flex;gap:48px;font-size:14px">
|
|
1607
|
+
<div style="display:flex;flex-direction:column;gap:8px"><a href="#" style="color:#9aa4b2;text-decoration:none">Product</a><a href="#" style="color:#9aa4b2;text-decoration:none">Pricing</a></div>
|
|
1608
|
+
<div style="display:flex;flex-direction:column;gap:8px"><a href="#" style="color:#9aa4b2;text-decoration:none">About</a><a href="#" style="color:#9aa4b2;text-decoration:none">Contact</a></div>
|
|
1609
|
+
</div>
|
|
1610
|
+
</footer>`
|
|
1530
1611
|
}
|
|
1531
1612
|
};
|
|
1532
1613
|
var SLIDE_TEMPLATES = {
|
|
@@ -2231,6 +2312,30 @@ function ExportMenu({ artifact: artifact2, getRenderedHtml }) {
|
|
|
2231
2312
|
}
|
|
2232
2313
|
setOpen(false);
|
|
2233
2314
|
};
|
|
2315
|
+
const openInTab = () => {
|
|
2316
|
+
const html = artifact2.type === "html" ? artifact2.data.html : artifact2.type === "slides" ? slidesToPrintHtml(artifact2.data, artifact2.title) : (() => {
|
|
2317
|
+
const h = getRenderedHtml();
|
|
2318
|
+
return h == null ? null : toStandaloneHtml(artifact2.title, h);
|
|
2319
|
+
})();
|
|
2320
|
+
if (html == null) return;
|
|
2321
|
+
const url = URL.createObjectURL(new Blob([html], { type: "text/html" }));
|
|
2322
|
+
window.open(url, "_blank", "noopener");
|
|
2323
|
+
setTimeout(() => URL.revokeObjectURL(url), 1e4);
|
|
2324
|
+
setOpen(false);
|
|
2325
|
+
};
|
|
2326
|
+
const [copied, setCopied] = useState(false);
|
|
2327
|
+
const copyHtml = async () => {
|
|
2328
|
+
const html = artifact2.type === "html" ? artifact2.data.html : getRenderedHtml();
|
|
2329
|
+
if (html == null) return;
|
|
2330
|
+
try {
|
|
2331
|
+
await navigator.clipboard.writeText(
|
|
2332
|
+
artifact2.type === "html" ? html : toStandaloneHtml(artifact2.title, html)
|
|
2333
|
+
);
|
|
2334
|
+
setCopied(true);
|
|
2335
|
+
setTimeout(() => setCopied(false), 1400);
|
|
2336
|
+
} catch {
|
|
2337
|
+
}
|
|
2338
|
+
};
|
|
2234
2339
|
return /* @__PURE__ */ jsxs("div", { className: "cv-export", children: [
|
|
2235
2340
|
/* @__PURE__ */ jsx(
|
|
2236
2341
|
"button",
|
|
@@ -2245,6 +2350,8 @@ function ExportMenu({ artifact: artifact2, getRenderedHtml }) {
|
|
|
2245
2350
|
open && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2246
2351
|
/* @__PURE__ */ jsx("div", { className: "cv-export__scrim", onClick: () => setOpen(false) }),
|
|
2247
2352
|
/* @__PURE__ */ jsxs("div", { className: "cv-export__menu", role: "menu", children: [
|
|
2353
|
+
/* @__PURE__ */ jsx("button", { role: "menuitem", onClick: openInTab, children: "Open in new tab \u2197" }),
|
|
2354
|
+
/* @__PURE__ */ jsx("button", { role: "menuitem", onClick: copyHtml, children: copied ? "Copied \u2713" : "Copy HTML" }),
|
|
2248
2355
|
/* @__PURE__ */ jsxs("button", { role: "menuitem", onClick: exportHtml, children: [
|
|
2249
2356
|
"HTML ",
|
|
2250
2357
|
/* @__PURE__ */ jsx("span", { className: "cv-export__ext", children: ".html" })
|
package/package.json
CHANGED