canvas-ui-sdk 0.3.2 → 0.3.3

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 CHANGED
@@ -27442,13 +27442,11 @@ function generateBakePrompt(theme) {
27442
27442
  return header + sections.join("\n");
27443
27443
  }
27444
27444
  function ExportPanel({ theme }) {
27445
- const [importValue, setImportValue] = useState("");
27446
- const [importStatus, setImportStatus] = useState("idle");
27447
27445
  const [copyStatus, setCopyStatus] = useState(null);
27448
- const handleCopy = async (content, type) => {
27446
+ const handleCopy = async (content) => {
27449
27447
  try {
27450
27448
  await navigator.clipboard.writeText(content);
27451
- setCopyStatus(type);
27449
+ setCopyStatus("bake");
27452
27450
  setTimeout(() => setCopyStatus(null), 2e3);
27453
27451
  } catch {
27454
27452
  const textarea = document.createElement("textarea");
@@ -27457,16 +27455,10 @@ function ExportPanel({ theme }) {
27457
27455
  textarea.select();
27458
27456
  document.execCommand("copy");
27459
27457
  document.body.removeChild(textarea);
27460
- setCopyStatus(type);
27458
+ setCopyStatus("bake");
27461
27459
  setTimeout(() => setCopyStatus(null), 2e3);
27462
27460
  }
27463
27461
  };
27464
- const handleImport = () => {
27465
- const success = theme.importJSON(importValue);
27466
- setImportStatus(success ? "success" : "error");
27467
- if (success) setImportValue("");
27468
- setTimeout(() => setImportStatus("idle"), 3e3);
27469
- };
27470
27462
  const overrideCount = Object.keys(theme.overrides).length;
27471
27463
  return /* @__PURE__ */ jsxs("div", { "data-theme-drawer-panel": true, className: "flex flex-col gap-5 p-4", children: [
27472
27464
  /* @__PURE__ */ jsx(
@@ -27482,7 +27474,7 @@ function ExportPanel({ theme }) {
27482
27474
  children: theme.isDirty ? `${overrideCount} variable${overrideCount !== 1 ? "s" : ""} modified` : "No modifications \u2014 using defaults"
27483
27475
  }
27484
27476
  ),
27485
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
27477
+ overrideCount > 0 && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
27486
27478
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
27487
27479
  /* @__PURE__ */ jsx(
27488
27480
  "h3",
@@ -27494,206 +27486,37 @@ function ExportPanel({ theme }) {
27494
27486
  textTransform: "uppercase",
27495
27487
  letterSpacing: "0.05em"
27496
27488
  },
27497
- children: "Export CSS"
27489
+ children: "Bake into source code"
27498
27490
  }
27499
27491
  ),
27500
27492
  /* @__PURE__ */ jsx(
27501
27493
  "button",
27502
27494
  {
27503
- onClick: () => handleCopy(theme.exportCSS(), "css"),
27495
+ onClick: () => handleCopy(generateBakePrompt(theme)),
27504
27496
  style: {
27505
27497
  fontSize: "12px",
27506
- color: copyStatus === "css" ? "#059669" : "#1165ef",
27498
+ color: copyStatus === "bake" ? "#059669" : "#1165ef",
27507
27499
  background: "none",
27508
27500
  border: "none",
27509
27501
  cursor: "pointer",
27510
27502
  fontWeight: 500
27511
27503
  },
27512
- children: copyStatus === "css" ? "Copied!" : "Copy"
27504
+ children: copyStatus === "bake" ? "Copied!" : "Copy prompt"
27513
27505
  }
27514
27506
  )
27515
27507
  ] }),
27516
27508
  /* @__PURE__ */ jsx(
27517
- "pre",
27518
- {
27519
- style: {
27520
- fontSize: "11px",
27521
- fontFamily: "monospace",
27522
- padding: "12px",
27523
- background: "#f9fafb",
27524
- border: "1px solid #e5e7eb",
27525
- borderRadius: "6px",
27526
- overflowX: "auto",
27527
- maxHeight: "200px",
27528
- overflowY: "auto",
27529
- color: "#374151",
27530
- whiteSpace: "pre-wrap",
27531
- wordBreak: "break-all"
27532
- },
27533
- children: theme.exportCSS()
27534
- }
27535
- )
27536
- ] }),
27537
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
27538
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
27539
- /* @__PURE__ */ jsx(
27540
- "h3",
27541
- {
27542
- style: {
27543
- fontSize: "13px",
27544
- fontWeight: 600,
27545
- color: "#374151",
27546
- textTransform: "uppercase",
27547
- letterSpacing: "0.05em"
27548
- },
27549
- children: "Export JSON"
27550
- }
27551
- ),
27552
- /* @__PURE__ */ jsx(
27553
- "button",
27554
- {
27555
- onClick: () => handleCopy(theme.exportJSON(), "json"),
27556
- style: {
27557
- fontSize: "12px",
27558
- color: copyStatus === "json" ? "#059669" : "#1165ef",
27559
- background: "none",
27560
- border: "none",
27561
- cursor: "pointer",
27562
- fontWeight: 500
27563
- },
27564
- children: copyStatus === "json" ? "Copied!" : "Copy"
27565
- }
27566
- )
27567
- ] }),
27568
- /* @__PURE__ */ jsx(
27569
- "pre",
27509
+ "p",
27570
27510
  {
27571
27511
  style: {
27572
- fontSize: "11px",
27573
- fontFamily: "monospace",
27574
- padding: "12px",
27575
- background: "#f9fafb",
27576
- border: "1px solid #e5e7eb",
27577
- borderRadius: "6px",
27578
- overflowX: "auto",
27579
- maxHeight: "200px",
27580
- overflowY: "auto",
27581
- color: "#374151",
27582
- whiteSpace: "pre-wrap",
27583
- wordBreak: "break-all"
27512
+ fontSize: "12px",
27513
+ color: "#6b7280",
27514
+ lineHeight: "1.4"
27584
27515
  },
27585
- children: theme.exportJSON()
27516
+ children: "Copies a prompt for Claude Code that updates your source files with the current theme values."
27586
27517
  }
27587
27518
  )
27588
27519
  ] }),
27589
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
27590
- /* @__PURE__ */ jsx(
27591
- "h3",
27592
- {
27593
- style: {
27594
- fontSize: "13px",
27595
- fontWeight: 600,
27596
- color: "#374151",
27597
- textTransform: "uppercase",
27598
- letterSpacing: "0.05em"
27599
- },
27600
- children: "Import JSON"
27601
- }
27602
- ),
27603
- /* @__PURE__ */ jsx(
27604
- "textarea",
27605
- {
27606
- value: importValue,
27607
- onChange: (e) => setImportValue(e.target.value),
27608
- placeholder: "Paste exported JSON here...",
27609
- rows: 5,
27610
- style: {
27611
- fontSize: "11px",
27612
- fontFamily: "monospace",
27613
- padding: "12px",
27614
- border: "1px solid #e5e7eb",
27615
- borderRadius: "6px",
27616
- color: "#374151",
27617
- background: "#ffffff",
27618
- resize: "vertical"
27619
- }
27620
- }
27621
- ),
27622
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
27623
- /* @__PURE__ */ jsx(
27624
- "button",
27625
- {
27626
- onClick: handleImport,
27627
- disabled: !importValue.trim(),
27628
- style: {
27629
- fontSize: "13px",
27630
- fontWeight: 500,
27631
- color: "#ffffff",
27632
- background: importValue.trim() ? "#1165ef" : "#9ca3af",
27633
- border: "none",
27634
- cursor: importValue.trim() ? "pointer" : "not-allowed",
27635
- padding: "8px 16px",
27636
- borderRadius: "6px"
27637
- },
27638
- children: "Import"
27639
- }
27640
- ),
27641
- importStatus === "success" && /* @__PURE__ */ jsx("span", { style: { fontSize: "12px", color: "#059669" }, children: "Theme imported!" }),
27642
- importStatus === "error" && /* @__PURE__ */ jsx("span", { style: { fontSize: "12px", color: "#dc2626" }, children: "Invalid JSON format" })
27643
- ] })
27644
- ] }),
27645
- overrideCount > 0 && /* @__PURE__ */ jsx(
27646
- "div",
27647
- {
27648
- style: {
27649
- borderTop: "1px solid #e5e7eb",
27650
- paddingTop: "16px"
27651
- },
27652
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
27653
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
27654
- /* @__PURE__ */ jsx(
27655
- "h3",
27656
- {
27657
- style: {
27658
- fontSize: "13px",
27659
- fontWeight: 600,
27660
- color: "#374151",
27661
- textTransform: "uppercase",
27662
- letterSpacing: "0.05em"
27663
- },
27664
- children: "Bake into source code"
27665
- }
27666
- ),
27667
- /* @__PURE__ */ jsx(
27668
- "button",
27669
- {
27670
- onClick: () => handleCopy(generateBakePrompt(theme), "bake"),
27671
- style: {
27672
- fontSize: "12px",
27673
- color: copyStatus === "bake" ? "#059669" : "#1165ef",
27674
- background: "none",
27675
- border: "none",
27676
- cursor: "pointer",
27677
- fontWeight: 500
27678
- },
27679
- children: copyStatus === "bake" ? "Copied!" : "Copy prompt"
27680
- }
27681
- )
27682
- ] }),
27683
- /* @__PURE__ */ jsx(
27684
- "p",
27685
- {
27686
- style: {
27687
- fontSize: "12px",
27688
- color: "#6b7280",
27689
- lineHeight: "1.4"
27690
- },
27691
- children: "Copies a prompt for Claude Code that updates your source files with the current theme values."
27692
- }
27693
- )
27694
- ] })
27695
- }
27696
- ),
27697
27520
  theme.isDirty && /* @__PURE__ */ jsx(
27698
27521
  "div",
27699
27522
  {