@kohryan/moodui 0.0.5 → 0.0.7

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/cli.js CHANGED
File without changes
package/dist/index.js CHANGED
@@ -839,6 +839,25 @@ function MoodUIPromptPlayground(props) {
839
839
  document.body.removeChild(a);
840
840
  URL.revokeObjectURL(url);
841
841
  }, [code, componentName]);
842
+ const onSaveToFile = React2.useCallback(async () => {
843
+ if (!code) return;
844
+ try {
845
+ const handle = await window.showSaveFilePicker({
846
+ suggestedName: `${componentName}.tsx`,
847
+ types: [{
848
+ description: "TypeScript Files",
849
+ accept: { "text/plain": [".tsx"] }
850
+ }]
851
+ });
852
+ const writable = await handle.createWritable();
853
+ await writable.write(code);
854
+ await writable.close();
855
+ } catch (e) {
856
+ if (!e.name?.includes("AbortError")) {
857
+ console.error("Failed to save file:", e);
858
+ }
859
+ }
860
+ }, [code, componentName]);
842
861
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 16 }, children: [
843
862
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
844
863
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { fontWeight: 700, fontSize: 16 }, children: "MoodUI Prompt" }),
@@ -958,6 +977,24 @@ function MoodUIPromptPlayground(props) {
958
977
  children: copied ? "Copied!" : "Copy"
959
978
  }
960
979
  ),
980
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
981
+ "button",
982
+ {
983
+ type: "button",
984
+ onClick: onSaveToFile,
985
+ disabled: !code,
986
+ style: {
987
+ padding: "6px 12px",
988
+ borderRadius: 8,
989
+ border: "1px solid #059669",
990
+ background: "#059669",
991
+ color: "#ffffff",
992
+ cursor: !code ? "not-allowed" : "pointer",
993
+ fontSize: 12
994
+ },
995
+ children: "Save to File"
996
+ }
997
+ ),
961
998
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
962
999
  "button",
963
1000
  {
package/dist/index.mjs CHANGED
@@ -244,6 +244,25 @@ function MoodUIPromptPlayground(props) {
244
244
  document.body.removeChild(a);
245
245
  URL.revokeObjectURL(url);
246
246
  }, [code, componentName]);
247
+ const onSaveToFile = React2.useCallback(async () => {
248
+ if (!code) return;
249
+ try {
250
+ const handle = await window.showSaveFilePicker({
251
+ suggestedName: `${componentName}.tsx`,
252
+ types: [{
253
+ description: "TypeScript Files",
254
+ accept: { "text/plain": [".tsx"] }
255
+ }]
256
+ });
257
+ const writable = await handle.createWritable();
258
+ await writable.write(code);
259
+ await writable.close();
260
+ } catch (e) {
261
+ if (!e.name?.includes("AbortError")) {
262
+ console.error("Failed to save file:", e);
263
+ }
264
+ }
265
+ }, [code, componentName]);
247
266
  return /* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 16 }, children: [
248
267
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
249
268
  /* @__PURE__ */ jsx2("div", { style: { fontWeight: 700, fontSize: 16 }, children: "MoodUI Prompt" }),
@@ -363,6 +382,24 @@ function MoodUIPromptPlayground(props) {
363
382
  children: copied ? "Copied!" : "Copy"
364
383
  }
365
384
  ),
385
+ /* @__PURE__ */ jsx2(
386
+ "button",
387
+ {
388
+ type: "button",
389
+ onClick: onSaveToFile,
390
+ disabled: !code,
391
+ style: {
392
+ padding: "6px 12px",
393
+ borderRadius: 8,
394
+ border: "1px solid #059669",
395
+ background: "#059669",
396
+ color: "#ffffff",
397
+ cursor: !code ? "not-allowed" : "pointer",
398
+ fontSize: 12
399
+ },
400
+ children: "Save to File"
401
+ }
402
+ ),
366
403
  /* @__PURE__ */ jsx2(
367
404
  "button",
368
405
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kohryan/moodui",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "MoodUI - AI-friendly UI spec + React renderer",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
@@ -27,12 +27,15 @@
27
27
  "typecheck": "tsc -p tsconfig.json --noEmit"
28
28
  },
29
29
  "devDependencies": {
30
- "@types/react": "^19.2.0",
31
30
  "@types/node": "^24.0.0",
31
+ "@types/react": "^19.2.0",
32
32
  "tsup": "^8.5.0",
33
33
  "typescript": "^5.8.3"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": ">=18"
37
+ },
38
+ "dependencies": {
39
+ "@kohryan/moodui": "^0.0.6"
37
40
  }
38
41
  }