@kohryan/moodui 0.0.15 → 0.0.16
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.mjs +28 -1
- package/dist/index.d.mts +26 -3
- package/dist/index.d.ts +26 -3
- package/dist/index.js +229 -34
- package/dist/index.mjs +227 -34
- package/dist/ui/assets/index-C2YFmKz4.js +64 -0
- package/dist/ui/index.html +1 -1
- package/package.json +2 -1
- package/src/ui/main.tsx +746 -225
- package/dist/ui/assets/index-ViFb9uE_.js +0 -58
package/dist/index.mjs
CHANGED
|
@@ -64,13 +64,19 @@ function validateNode(input, path) {
|
|
|
64
64
|
else if (!isString(props.src)) errors.push(`${path}.props.src must be a string`);
|
|
65
65
|
break;
|
|
66
66
|
}
|
|
67
|
+
case "icon": {
|
|
68
|
+
const props = input.props;
|
|
69
|
+
if (!isObject(props)) errors.push(`${path}.props must be an object`);
|
|
70
|
+
else if (!isString(props.name)) errors.push(`${path}.props.name must be a string`);
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
67
73
|
case "spacer": {
|
|
68
74
|
const props = input.props;
|
|
69
75
|
if (props != null && !isObject(props)) errors.push(`${path}.props must be an object if provided`);
|
|
70
76
|
break;
|
|
71
77
|
}
|
|
72
78
|
default:
|
|
73
|
-
errors.push(`${path}.type must be one of: box | text | button | input | image | spacer`);
|
|
79
|
+
errors.push(`${path}.type must be one of: box | text | button | input | image | icon | spacer`);
|
|
74
80
|
}
|
|
75
81
|
if (errors.length > 0) return { ok: false, errors };
|
|
76
82
|
return { ok: true, value: input };
|
|
@@ -86,9 +92,11 @@ function isString(value) {
|
|
|
86
92
|
function renderReact(specInput, options = {}) {
|
|
87
93
|
const spec = assertMoodUISpec(specInput);
|
|
88
94
|
const componentName = options.componentName ?? "MoodUIScreen";
|
|
89
|
-
const
|
|
95
|
+
const hasIcons = containsIconNode(spec.root);
|
|
96
|
+
const jsx4 = renderNode(spec.root, { indent: 2, onActionProp: "onAction" });
|
|
90
97
|
return [
|
|
91
98
|
'import * as React from "react";',
|
|
99
|
+
hasIcons ? 'import { MoodUIIcon } from "@kohryan/moodui";' : "",
|
|
92
100
|
"",
|
|
93
101
|
"export type MoodUIScreenActionHandler = (actionId: string) => void;",
|
|
94
102
|
"",
|
|
@@ -99,7 +107,7 @@ function renderReact(specInput, options = {}) {
|
|
|
99
107
|
`export function ${componentName}(props: MoodUIScreenProps) {`,
|
|
100
108
|
" const { onAction } = props;",
|
|
101
109
|
" return (",
|
|
102
|
-
|
|
110
|
+
jsx4,
|
|
103
111
|
" );",
|
|
104
112
|
"}",
|
|
105
113
|
""
|
|
@@ -136,6 +144,8 @@ function renderNode(node, ctx) {
|
|
|
136
144
|
return renderSelfClosingElement("input", node, ctx);
|
|
137
145
|
case "image":
|
|
138
146
|
return renderSelfClosingElement("img", node, ctx);
|
|
147
|
+
case "icon":
|
|
148
|
+
return renderSelfClosingElement("MoodUIIcon", node, ctx);
|
|
139
149
|
case "spacer": {
|
|
140
150
|
const size = node.props?.size ?? 8;
|
|
141
151
|
const style = { width: normalizeCssValue(size), height: normalizeCssValue(size) };
|
|
@@ -182,6 +192,12 @@ function buildProps(tag, node, extraProps) {
|
|
|
182
192
|
if (props.alt) out.push(`alt=${serializeJsxAttrValue(props.alt)}`);
|
|
183
193
|
if (props.fit) mergedStyle.objectFit = props.fit;
|
|
184
194
|
}
|
|
195
|
+
if (tag === "MoodUIIcon") {
|
|
196
|
+
if (props.name) out.push(`name=${serializeJsxAttrValue(props.name)}`);
|
|
197
|
+
if (props.size != null) out.push(`size={${serializeJsValue(props.size)}}`);
|
|
198
|
+
if (props.color) out.push(`color=${serializeJsxAttrValue(props.color)}`);
|
|
199
|
+
if (props.strokeWidth != null) out.push(`strokeWidth={${serializeJsValue(props.strokeWidth)}}`);
|
|
200
|
+
}
|
|
185
201
|
if (Object.keys(mergedStyle).length > 0) {
|
|
186
202
|
out.push(`style={(${serializeJsValue(mergedStyle)} as React.CSSProperties)}`);
|
|
187
203
|
}
|
|
@@ -311,32 +327,184 @@ function safeObjectKey(key) {
|
|
|
311
327
|
function escapeText(value) {
|
|
312
328
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
313
329
|
}
|
|
330
|
+
function containsIconNode(node) {
|
|
331
|
+
if (node.type === "icon") return true;
|
|
332
|
+
if (node.type !== "box") return false;
|
|
333
|
+
return (node.children ?? []).some((child) => containsIconNode(child));
|
|
334
|
+
}
|
|
314
335
|
function indent(spaces) {
|
|
315
336
|
return " ".repeat(spaces);
|
|
316
337
|
}
|
|
317
338
|
|
|
339
|
+
// src/react/MoodUIIcon.tsx
|
|
340
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
341
|
+
var MOODUI_ICON_NAMES = [
|
|
342
|
+
"sparkles",
|
|
343
|
+
"search",
|
|
344
|
+
"settings",
|
|
345
|
+
"user",
|
|
346
|
+
"mail",
|
|
347
|
+
"heart",
|
|
348
|
+
"home",
|
|
349
|
+
"plus",
|
|
350
|
+
"check",
|
|
351
|
+
"arrow-right",
|
|
352
|
+
"calendar",
|
|
353
|
+
"bell",
|
|
354
|
+
"star",
|
|
355
|
+
"chart-bar",
|
|
356
|
+
"message-circle",
|
|
357
|
+
"shield"
|
|
358
|
+
];
|
|
359
|
+
function MoodUIIcon(props) {
|
|
360
|
+
const {
|
|
361
|
+
name,
|
|
362
|
+
size = 20,
|
|
363
|
+
color,
|
|
364
|
+
strokeWidth = 1.8,
|
|
365
|
+
className,
|
|
366
|
+
style,
|
|
367
|
+
title
|
|
368
|
+
} = props;
|
|
369
|
+
return /* @__PURE__ */ jsx(
|
|
370
|
+
"span",
|
|
371
|
+
{
|
|
372
|
+
className,
|
|
373
|
+
style: {
|
|
374
|
+
display: "inline-flex",
|
|
375
|
+
alignItems: "center",
|
|
376
|
+
justifyContent: "center",
|
|
377
|
+
width: size,
|
|
378
|
+
height: size,
|
|
379
|
+
color,
|
|
380
|
+
lineHeight: 0,
|
|
381
|
+
flexShrink: 0,
|
|
382
|
+
...style
|
|
383
|
+
},
|
|
384
|
+
"aria-hidden": title ? void 0 : true,
|
|
385
|
+
title,
|
|
386
|
+
children: /* @__PURE__ */ jsx(
|
|
387
|
+
"svg",
|
|
388
|
+
{
|
|
389
|
+
viewBox: "0 0 24 24",
|
|
390
|
+
width: "100%",
|
|
391
|
+
height: "100%",
|
|
392
|
+
fill: "none",
|
|
393
|
+
stroke: "currentColor",
|
|
394
|
+
strokeWidth,
|
|
395
|
+
strokeLinecap: "round",
|
|
396
|
+
strokeLinejoin: "round",
|
|
397
|
+
role: "presentation",
|
|
398
|
+
children: renderIconPath(name)
|
|
399
|
+
}
|
|
400
|
+
)
|
|
401
|
+
}
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
function renderIconPath(name) {
|
|
405
|
+
switch (name) {
|
|
406
|
+
case "sparkles":
|
|
407
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
408
|
+
/* @__PURE__ */ jsx("path", { d: "M12 3l1.4 3.6L17 8l-3.6 1.4L12 13l-1.4-3.6L7 8l3.6-1.4L12 3z" }),
|
|
409
|
+
/* @__PURE__ */ jsx("path", { d: "M5 14l.9 2.1L8 17l-2.1.9L5 20l-.9-2.1L2 17l2.1-.9L5 14z" }),
|
|
410
|
+
/* @__PURE__ */ jsx("path", { d: "M19 13l.9 2.1L22 16l-2.1.9L19 19l-.9-2.1L16 16l2.1-.9L19 13z" })
|
|
411
|
+
] });
|
|
412
|
+
case "search":
|
|
413
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
414
|
+
/* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "6.5" }),
|
|
415
|
+
/* @__PURE__ */ jsx("path", { d: "M16 16l4 4" })
|
|
416
|
+
] });
|
|
417
|
+
case "settings":
|
|
418
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
419
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3" }),
|
|
420
|
+
/* @__PURE__ */ jsx("path", { d: "M19.4 15a1 1 0 0 0 .2 1.1l.1.1a2 2 0 0 1-2.8 2.8l-.1-.1a1 1 0 0 0-1.1-.2 1 1 0 0 0-.6.9V20a2 2 0 0 1-4 0v-.1a1 1 0 0 0-.6-.9 1 1 0 0 0-1.1.2l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1 1 0 0 0 .2-1.1 1 1 0 0 0-.9-.6H4a2 2 0 0 1 0-4h.1a1 1 0 0 0 .9-.6 1 1 0 0 0-.2-1.1l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1 1 0 0 0 1.1.2 1 1 0 0 0 .6-.9V4a2 2 0 0 1 4 0v.1a1 1 0 0 0 .6.9 1 1 0 0 0 1.1-.2l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1 1 0 0 0-.2 1.1 1 1 0 0 0 .9.6H20a2 2 0 0 1 0 4h-.1a1 1 0 0 0-.9.6z" })
|
|
421
|
+
] });
|
|
422
|
+
case "user":
|
|
423
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
424
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "8", r: "3.5" }),
|
|
425
|
+
/* @__PURE__ */ jsx("path", { d: "M5 19a7 7 0 0 1 14 0" })
|
|
426
|
+
] });
|
|
427
|
+
case "mail":
|
|
428
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
429
|
+
/* @__PURE__ */ jsx("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2.5" }),
|
|
430
|
+
/* @__PURE__ */ jsx("path", { d: "M4 7l8 6 8-6" })
|
|
431
|
+
] });
|
|
432
|
+
case "heart":
|
|
433
|
+
return /* @__PURE__ */ jsx("path", { d: "M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z" });
|
|
434
|
+
case "home":
|
|
435
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
436
|
+
/* @__PURE__ */ jsx("path", { d: "M3 10.5L12 3l9 7.5" }),
|
|
437
|
+
/* @__PURE__ */ jsx("path", { d: "M5 9.8V20h14V9.8" }),
|
|
438
|
+
/* @__PURE__ */ jsx("path", { d: "M10 20v-5h4v5" })
|
|
439
|
+
] });
|
|
440
|
+
case "plus":
|
|
441
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
442
|
+
/* @__PURE__ */ jsx("path", { d: "M12 5v14" }),
|
|
443
|
+
/* @__PURE__ */ jsx("path", { d: "M5 12h14" })
|
|
444
|
+
] });
|
|
445
|
+
case "check":
|
|
446
|
+
return /* @__PURE__ */ jsx("path", { d: "M5 12.5l4.2 4.2L19 7.5" });
|
|
447
|
+
case "arrow-right":
|
|
448
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
449
|
+
/* @__PURE__ */ jsx("path", { d: "M5 12h14" }),
|
|
450
|
+
/* @__PURE__ */ jsx("path", { d: "M13 6l6 6-6 6" })
|
|
451
|
+
] });
|
|
452
|
+
case "calendar":
|
|
453
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
454
|
+
/* @__PURE__ */ jsx("rect", { x: "3", y: "5", width: "18", height: "16", rx: "2.5" }),
|
|
455
|
+
/* @__PURE__ */ jsx("path", { d: "M8 3v4" }),
|
|
456
|
+
/* @__PURE__ */ jsx("path", { d: "M16 3v4" }),
|
|
457
|
+
/* @__PURE__ */ jsx("path", { d: "M3 10h18" })
|
|
458
|
+
] });
|
|
459
|
+
case "bell":
|
|
460
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
461
|
+
/* @__PURE__ */ jsx("path", { d: "M15 18H5.8a1 1 0 0 1-.8-1.6l1-1.4V11a6 6 0 1 1 12 0v4l1 1.4a1 1 0 0 1-.8 1.6H15" }),
|
|
462
|
+
/* @__PURE__ */ jsx("path", { d: "M10 20a2 2 0 0 0 4 0" })
|
|
463
|
+
] });
|
|
464
|
+
case "star":
|
|
465
|
+
return /* @__PURE__ */ jsx("path", { d: "M12 3l2.8 5.7L21 9.6l-4.5 4.3 1 6.1L12 17l-5.5 3 1-6.1L3 9.6l6.2-.9L12 3z" });
|
|
466
|
+
case "chart-bar":
|
|
467
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
468
|
+
/* @__PURE__ */ jsx("path", { d: "M4 20V10" }),
|
|
469
|
+
/* @__PURE__ */ jsx("path", { d: "M10 20V4" }),
|
|
470
|
+
/* @__PURE__ */ jsx("path", { d: "M16 20v-7" }),
|
|
471
|
+
/* @__PURE__ */ jsx("path", { d: "M22 20V8" })
|
|
472
|
+
] });
|
|
473
|
+
case "message-circle":
|
|
474
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
475
|
+
/* @__PURE__ */ jsx("path", { d: "M20 11.5a7.5 7.5 0 1 1-3-6" }),
|
|
476
|
+
/* @__PURE__ */ jsx("path", { d: "M20 4v5h-5" })
|
|
477
|
+
] });
|
|
478
|
+
case "shield":
|
|
479
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
480
|
+
/* @__PURE__ */ jsx("path", { d: "M12 3l7 3v5c0 5-2.7 8.6-7 10-4.3-1.4-7-5-7-10V6l7-3z" }),
|
|
481
|
+
/* @__PURE__ */ jsx("path", { d: "M9.5 12.5l1.8 1.8 3.7-4.3" })
|
|
482
|
+
] });
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
318
486
|
// src/react/MoodUIRuntime.tsx
|
|
319
487
|
import * as React from "react";
|
|
320
|
-
import { Fragment as
|
|
488
|
+
import { Fragment as Fragment3, jsx as jsx2 } from "react/jsx-runtime";
|
|
321
489
|
function MoodUIRuntime(props) {
|
|
322
|
-
return /* @__PURE__ */
|
|
490
|
+
return /* @__PURE__ */ jsx2(Fragment3, { children: renderNode2(props.spec.root, props.onAction) });
|
|
323
491
|
}
|
|
324
492
|
function renderNode2(node, onAction) {
|
|
325
493
|
switch (node.type) {
|
|
326
494
|
case "box": {
|
|
327
495
|
const style = computeStyle2(node);
|
|
328
|
-
const children = node.children?.map((c, i) => /* @__PURE__ */
|
|
329
|
-
return /* @__PURE__ */
|
|
496
|
+
const children = node.children?.map((c, i) => /* @__PURE__ */ jsx2(React.Fragment, { children: renderNode2(c, onAction) }, i));
|
|
497
|
+
return /* @__PURE__ */ jsx2("div", { ...commonAttrs(node), style, children });
|
|
330
498
|
}
|
|
331
499
|
case "text": {
|
|
332
500
|
const Tag = node.props?.as ?? "p";
|
|
333
501
|
const style = computeStyle2(node);
|
|
334
|
-
return /* @__PURE__ */
|
|
502
|
+
return /* @__PURE__ */ jsx2(Tag, { ...commonAttrs(node), style, children: node.props?.value ?? "" });
|
|
335
503
|
}
|
|
336
504
|
case "button": {
|
|
337
505
|
const style = computeStyle2(node);
|
|
338
506
|
const actionId = node.props?.actionId;
|
|
339
|
-
return /* @__PURE__ */
|
|
507
|
+
return /* @__PURE__ */ jsx2(
|
|
340
508
|
"button",
|
|
341
509
|
{
|
|
342
510
|
...commonAttrs(node),
|
|
@@ -349,7 +517,7 @@ function renderNode2(node, onAction) {
|
|
|
349
517
|
}
|
|
350
518
|
case "input": {
|
|
351
519
|
const style = computeStyle2(node);
|
|
352
|
-
return /* @__PURE__ */
|
|
520
|
+
return /* @__PURE__ */ jsx2(
|
|
353
521
|
"input",
|
|
354
522
|
{
|
|
355
523
|
...commonAttrs(node),
|
|
@@ -362,11 +530,25 @@ function renderNode2(node, onAction) {
|
|
|
362
530
|
}
|
|
363
531
|
case "image": {
|
|
364
532
|
const style = computeStyle2(node);
|
|
365
|
-
return /* @__PURE__ */
|
|
533
|
+
return /* @__PURE__ */ jsx2("img", { ...commonAttrs(node), style, src: node.props?.src, alt: node.props?.alt ?? "" });
|
|
534
|
+
}
|
|
535
|
+
case "icon": {
|
|
536
|
+
const style = computeStyle2(node);
|
|
537
|
+
return /* @__PURE__ */ jsx2(
|
|
538
|
+
MoodUIIcon,
|
|
539
|
+
{
|
|
540
|
+
...commonAttrs(node),
|
|
541
|
+
style,
|
|
542
|
+
name: node.props?.name,
|
|
543
|
+
size: node.props?.size,
|
|
544
|
+
color: node.props?.color,
|
|
545
|
+
strokeWidth: node.props?.strokeWidth
|
|
546
|
+
}
|
|
547
|
+
);
|
|
366
548
|
}
|
|
367
549
|
case "spacer": {
|
|
368
550
|
const size = node.props?.size ?? 8;
|
|
369
|
-
return /* @__PURE__ */
|
|
551
|
+
return /* @__PURE__ */ jsx2("div", { style: { width: size, height: size } });
|
|
370
552
|
}
|
|
371
553
|
}
|
|
372
554
|
}
|
|
@@ -438,6 +620,9 @@ function computeStyle2(node) {
|
|
|
438
620
|
const fit = node.props?.fit;
|
|
439
621
|
if (fit != null) style.objectFit = fit;
|
|
440
622
|
}
|
|
623
|
+
if (node.type === "icon") {
|
|
624
|
+
if (typeof props.color === "string") style.color = props.color;
|
|
625
|
+
}
|
|
441
626
|
if (props.style && typeof props.style === "object" && !Array.isArray(props.style)) {
|
|
442
627
|
Object.assign(style, props.style);
|
|
443
628
|
}
|
|
@@ -535,14 +720,20 @@ function buildSystemPrompt() {
|
|
|
535
720
|
"- button: { type:'button', props: { label: string, variant?, actionId?, disabled?, ...common } }",
|
|
536
721
|
"- input: { type:'input', props?: { name?, placeholder?, defaultValue?, ...common } }",
|
|
537
722
|
"- image: { type:'image', props: { src: string, alt?, fit?, ...common } }",
|
|
723
|
+
"- icon: { type:'icon', props: { name, size?, color?, strokeWidth?, ...common } }",
|
|
538
724
|
"- spacer: { type:'spacer', props?: { size? } }",
|
|
539
725
|
"",
|
|
540
726
|
"common props:",
|
|
541
727
|
"- id, testId, className, style(object), padding, margin, background, borderRadius, width, height",
|
|
542
728
|
"",
|
|
729
|
+
"Reusable icon names:",
|
|
730
|
+
"- sparkles, search, settings, user, mail, heart, home, plus, check, arrow-right, calendar, bell, star, chart-bar, message-circle, shield",
|
|
731
|
+
"",
|
|
543
732
|
"Rules:",
|
|
544
733
|
"- root wajib ada",
|
|
545
734
|
"- minimal pakai box sebagai container utama",
|
|
735
|
+
"- gunakan icon node bila UI membutuhkan icon navigasi, status, statistik, CTA, atau dekorasi ringan",
|
|
736
|
+
"- utamakan layout modern: card, section, spacing konsisten, hierarchy yang jelas",
|
|
546
737
|
"- semua string pakai double quotes (JSON standard)",
|
|
547
738
|
"- jangan pakai function / JS expression apa pun"
|
|
548
739
|
].join("\n");
|
|
@@ -721,7 +912,7 @@ async function generateReactFromPrompt(options) {
|
|
|
721
912
|
}
|
|
722
913
|
|
|
723
914
|
// src/react/MoodUIPromptPlayground.tsx
|
|
724
|
-
import { jsx as
|
|
915
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
725
916
|
function MoodUIPromptPlayground(props) {
|
|
726
917
|
const provider = props.provider ?? "gemini";
|
|
727
918
|
const [model, setModel] = React2.useState(props.model ?? "gemini-3-flash-preview");
|
|
@@ -812,11 +1003,11 @@ function MoodUIPromptPlayground(props) {
|
|
|
812
1003
|
}
|
|
813
1004
|
}
|
|
814
1005
|
}, [code, componentName]);
|
|
815
|
-
return /* @__PURE__ */
|
|
816
|
-
/* @__PURE__ */
|
|
817
|
-
/* @__PURE__ */
|
|
818
|
-
/* @__PURE__ */
|
|
819
|
-
/* @__PURE__ */
|
|
1006
|
+
return /* @__PURE__ */ jsxs2("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 16 }, children: [
|
|
1007
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
1008
|
+
/* @__PURE__ */ jsx3("div", { style: { fontWeight: 700, fontSize: 16 }, children: "MoodUI Prompt" }),
|
|
1009
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: 8, flexWrap: "wrap" }, children: [
|
|
1010
|
+
/* @__PURE__ */ jsx3(
|
|
820
1011
|
"input",
|
|
821
1012
|
{
|
|
822
1013
|
value: provider,
|
|
@@ -830,7 +1021,7 @@ function MoodUIPromptPlayground(props) {
|
|
|
830
1021
|
}
|
|
831
1022
|
}
|
|
832
1023
|
),
|
|
833
|
-
/* @__PURE__ */
|
|
1024
|
+
/* @__PURE__ */ jsx3(
|
|
834
1025
|
"input",
|
|
835
1026
|
{
|
|
836
1027
|
value: model,
|
|
@@ -840,7 +1031,7 @@ function MoodUIPromptPlayground(props) {
|
|
|
840
1031
|
}
|
|
841
1032
|
)
|
|
842
1033
|
] }),
|
|
843
|
-
provider !== "ollama" ? /* @__PURE__ */
|
|
1034
|
+
provider !== "ollama" ? /* @__PURE__ */ jsx3(
|
|
844
1035
|
"input",
|
|
845
1036
|
{
|
|
846
1037
|
value: apiKey,
|
|
@@ -850,7 +1041,7 @@ function MoodUIPromptPlayground(props) {
|
|
|
850
1041
|
style: { padding: "10px 12px", borderRadius: 10, border: "1px solid #d1d5db" }
|
|
851
1042
|
}
|
|
852
1043
|
) : null,
|
|
853
|
-
/* @__PURE__ */
|
|
1044
|
+
/* @__PURE__ */ jsx3(
|
|
854
1045
|
"input",
|
|
855
1046
|
{
|
|
856
1047
|
value: baseUrl,
|
|
@@ -859,7 +1050,7 @@ function MoodUIPromptPlayground(props) {
|
|
|
859
1050
|
style: { padding: "10px 12px", borderRadius: 10, border: "1px solid #d1d5db" }
|
|
860
1051
|
}
|
|
861
1052
|
),
|
|
862
|
-
/* @__PURE__ */
|
|
1053
|
+
/* @__PURE__ */ jsx3(
|
|
863
1054
|
"textarea",
|
|
864
1055
|
{
|
|
865
1056
|
value: prompt,
|
|
@@ -874,7 +1065,7 @@ function MoodUIPromptPlayground(props) {
|
|
|
874
1065
|
}
|
|
875
1066
|
}
|
|
876
1067
|
),
|
|
877
|
-
/* @__PURE__ */
|
|
1068
|
+
/* @__PURE__ */ jsx3(
|
|
878
1069
|
"button",
|
|
879
1070
|
{
|
|
880
1071
|
type: "button",
|
|
@@ -891,7 +1082,7 @@ function MoodUIPromptPlayground(props) {
|
|
|
891
1082
|
children: loading ? "Generating..." : "Generate"
|
|
892
1083
|
}
|
|
893
1084
|
),
|
|
894
|
-
error ? /* @__PURE__ */
|
|
1085
|
+
error ? /* @__PURE__ */ jsx3(
|
|
895
1086
|
"pre",
|
|
896
1087
|
{
|
|
897
1088
|
style: {
|
|
@@ -907,13 +1098,13 @@ function MoodUIPromptPlayground(props) {
|
|
|
907
1098
|
}
|
|
908
1099
|
) : null
|
|
909
1100
|
] }),
|
|
910
|
-
/* @__PURE__ */
|
|
911
|
-
/* @__PURE__ */
|
|
912
|
-
/* @__PURE__ */
|
|
913
|
-
/* @__PURE__ */
|
|
914
|
-
/* @__PURE__ */
|
|
915
|
-
/* @__PURE__ */
|
|
916
|
-
/* @__PURE__ */
|
|
1101
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
1102
|
+
/* @__PURE__ */ jsx3("div", { style: { fontWeight: 700, fontSize: 16 }, children: "Preview" }),
|
|
1103
|
+
/* @__PURE__ */ jsx3("div", { style: { minHeight: 240, padding: 16, borderRadius: 16, background: "#ffffff", border: "1px solid #e5e7eb" }, children: spec ? /* @__PURE__ */ jsx3(MoodUIRuntime, { spec }) : /* @__PURE__ */ jsx3("div", { style: { color: "#6b7280" }, children: "Belum ada hasil" }) }),
|
|
1104
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
1105
|
+
/* @__PURE__ */ jsx3("div", { style: { fontWeight: 700, fontSize: 16 }, children: "React Code" }),
|
|
1106
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: 8 }, children: [
|
|
1107
|
+
/* @__PURE__ */ jsx3(
|
|
917
1108
|
"button",
|
|
918
1109
|
{
|
|
919
1110
|
type: "button",
|
|
@@ -931,7 +1122,7 @@ function MoodUIPromptPlayground(props) {
|
|
|
931
1122
|
children: copied ? "Copied!" : "Copy"
|
|
932
1123
|
}
|
|
933
1124
|
),
|
|
934
|
-
/* @__PURE__ */
|
|
1125
|
+
/* @__PURE__ */ jsx3(
|
|
935
1126
|
"button",
|
|
936
1127
|
{
|
|
937
1128
|
type: "button",
|
|
@@ -949,7 +1140,7 @@ function MoodUIPromptPlayground(props) {
|
|
|
949
1140
|
children: "Save to File"
|
|
950
1141
|
}
|
|
951
1142
|
),
|
|
952
|
-
/* @__PURE__ */
|
|
1143
|
+
/* @__PURE__ */ jsx3(
|
|
953
1144
|
"button",
|
|
954
1145
|
{
|
|
955
1146
|
type: "button",
|
|
@@ -969,7 +1160,7 @@ function MoodUIPromptPlayground(props) {
|
|
|
969
1160
|
)
|
|
970
1161
|
] })
|
|
971
1162
|
] }),
|
|
972
|
-
/* @__PURE__ */
|
|
1163
|
+
/* @__PURE__ */ jsx3(
|
|
973
1164
|
"textarea",
|
|
974
1165
|
{
|
|
975
1166
|
value: code,
|
|
@@ -988,6 +1179,8 @@ function MoodUIPromptPlayground(props) {
|
|
|
988
1179
|
] });
|
|
989
1180
|
}
|
|
990
1181
|
export {
|
|
1182
|
+
MOODUI_ICON_NAMES,
|
|
1183
|
+
MoodUIIcon,
|
|
991
1184
|
MoodUIPromptPlayground,
|
|
992
1185
|
MoodUIRuntime,
|
|
993
1186
|
assertMoodUISpec,
|