@melony/ui-kit 0.1.28 → 0.1.30

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.
@@ -0,0 +1,49 @@
1
+ // src/server.ts
2
+ var ui = {
3
+ // ── Core ────────────────────────────────────────────────────────────────────
4
+ node: (type, props = {}, children = []) => ({ type, props, children }),
5
+ event: (node) => ({ type: "ui", data: node }),
6
+ // ── Layout ──────────────────────────────────────────────────────────────────
7
+ row: (props = {}, children = []) => ui.node("row", props, children),
8
+ col: (props = {}, children = []) => ui.node("col", props, children),
9
+ box: (props = {}, children = []) => ui.node("box", props, children),
10
+ spacer: (props = {}) => ui.node("spacer", props),
11
+ divider: (props = {}) => ui.node("divider", props),
12
+ // ── Content ─────────────────────────────────────────────────────────────────
13
+ text: (value, props = {}) => ui.node("text", { value, ...props }),
14
+ heading: (value, props = {}) => ui.node("heading", { value, ...props }),
15
+ markdown: (value, props = {}) => ui.node("markdown", { value, ...props }),
16
+ image: (src, props = {}) => ui.node("image", { src, ...props }),
17
+ video: (src, props = {}) => ui.node("video", { src, ...props }),
18
+ icon: (name, props = {}) => ui.node("icon", { name, ...props }),
19
+ // ── Interactive ─────────────────────────────────────────────────────────────
20
+ button: (props = {}, children = []) => ui.node("button", props, children),
21
+ badge: (label, props = {}) => ui.node("badge", { label, ...props }),
22
+ dropdown: (props = {}, children = []) => ui.node("dropdown", props, children),
23
+ popover: (props = {}, children = []) => ui.node("popover", props, children),
24
+ // ── Forms ───────────────────────────────────────────────────────────────────
25
+ form: (props = {}, children = []) => ui.node("form", props, children),
26
+ input: (name, props = {}) => ui.node("input", { name, ...props }),
27
+ textarea: (name, props = {}) => ui.node("textarea", { name, ...props }),
28
+ select: (name, options, props = {}) => ui.node("select", { name, options, ...props }),
29
+ checkbox: (name, props = {}) => ui.node("checkbox", { name, ...props }),
30
+ radioGroup: (name, options, props = {}) => ui.node("radioGroup", { name, options, ...props }),
31
+ label: (value, props = {}) => ui.node("label", { value, ...props }),
32
+ hidden: (name, value) => ui.node("hidden", { name, value }),
33
+ colorPicker: (name, props = {}) => ui.node("colorPicker", { name, ...props }),
34
+ upload: (props = {}) => ui.node("upload", props),
35
+ // ── Positioning ─────────────────────────────────────────────────────────────
36
+ float: (props = {}, children = []) => ui.node("float", props, children),
37
+ sticky: (props = {}, children = []) => ui.node("sticky", props, children),
38
+ // ── Compound ────────────────────────────────────────────────────────────────
39
+ card: (props = {}, children = []) => ui.node("card", props, children),
40
+ chart: (data, props = {}) => ui.node("chart", { data, ...props }),
41
+ list: (props = {}, children = []) => ui.node("list", props, children),
42
+ listItem: (props = {}, children = []) => ui.node("listItem", props, children),
43
+ streamingText: (eventType, props = {}) => ui.node("streamingText", { eventType, ...props }),
44
+ thread: (props = {}, children = []) => ui.node("thread", props, children)
45
+ };
46
+
47
+ export { ui };
48
+ //# sourceMappingURL=chunk-NC5WJY7M.js.map
49
+ //# sourceMappingURL=chunk-NC5WJY7M.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/server.ts"],"names":[],"mappings":";AAYO,IAAM,EAAA,GAAK;AAAA;AAAA,EAGhB,IAAA,EAAM,CACJ,IAAA,EACA,KAAA,GAAsB,EAAC,EACvB,QAAA,GAA0B,EAAC,MACZ,EAAE,IAAA,EAAM,KAAA,EAAO,QAAA,EAAS,CAAA;AAAA,EAEzC,OAAO,CAAC,IAAA,MAA2B,EAAE,IAAA,EAAM,IAAA,EAAM,MAAM,IAAA,EAAK,CAAA;AAAA;AAAA,EAI5D,GAAA,EAAK,CAAC,KAAA,GAA0B,EAAC,EAAG,QAAA,GAAqB,EAAC,KACxD,EAAA,CAAG,IAAA,CAAK,KAAA,EAAO,KAAA,EAAO,QAAQ,CAAA;AAAA,EAEhC,GAAA,EAAK,CAAC,KAAA,GAA0B,EAAC,EAAG,QAAA,GAAqB,EAAC,KACxD,EAAA,CAAG,IAAA,CAAK,KAAA,EAAO,KAAA,EAAO,QAAQ,CAAA;AAAA,EAEhC,GA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AAG,OAAO,CAAA;AAAA,EAErC,IAAA,EAAM,CAAC,KAAA,GAA2B,EAAC,EAAG,QAAA,GAAqB,EAAC,KAC1D,EAAA,CAAG,IAAA,CAAK,MAAA,EAAQ,KAAA,EAAO,QAAQ,CAAA;AAAA,EAEjC,QAAA,EAAU,CAAC,KAAA,GAA+B,EAAC,EAAG,QAAA,GAAqB,EAAC,KAClE,EAAA,CAAG,IAAA,CAAK,UAAA,EAAY,KAAA,EAAO,QAAQ,CAAA;AAAA,EAErC,aAAA,EAAe,CAAC,SAAA,EAAmB,KAAA,GAA6C,EAAC,KAC/E,EAAA,CAAG,IAAA,CAAK,eAAA,EAAiB,EAAE,SAAA,EAAW,GAAG,OAAO,CAAA;AAAA,EAElD,MAAA,EAAQ,CAAC,KAAA,GAA6B,EAAC,EAAG,QAAA,GAAqB,EAAC,KAC9D,EAAA,CAAG,IAAA,CAAK,QAAA,EAAU,KAAA,EAAO,QAAQ;AACrC","file":"chunk-NC5WJY7M.js","sourcesContent":["import { UIContract, UINode, UIEvent } from \"./types\";\n\nexport * from \"./types\";\n\ntype NodeProps<T extends keyof UIContract> = UIContract[T];\n\n/**\n * Builder helpers for creating UI nodes in Melony actions.\n *\n * All container helpers follow (props, children?) signature.\n * Content helpers with a required value follow (value, props?) signature.\n */\nexport const ui = {\n // ── Core ────────────────────────────────────────────────────────────────────\n\n node: <T extends keyof UIContract>(\n type: T,\n props: NodeProps<T> = {} as any,\n children: UINode<any>[] = [],\n ): UINode<T> => ({ type, props, children }),\n\n event: (node: UINode): UIEvent => ({ type: \"ui\", data: node }),\n\n // ── Layout ──────────────────────────────────────────────────────────────────\n\n row: (props: NodeProps<\"row\"> = {}, children: UINode[] = []) =>\n ui.node(\"row\", props, children),\n\n col: (props: NodeProps<\"col\"> = {}, children: UINode[] = []) =>\n ui.node(\"col\", props, children),\n\n box: (props: NodeProps<\"box\"> = {}, children: UINode[] = []) =>\n ui.node(\"box\", props, children),\n\n spacer: (props: NodeProps<\"spacer\"> = {}) =>\n ui.node(\"spacer\", props),\n\n divider: (props: NodeProps<\"divider\"> = {}) =>\n ui.node(\"divider\", props),\n\n // ── Content ─────────────────────────────────────────────────────────────────\n\n text: (value: string, props: Partial<NodeProps<\"text\">> = {}) =>\n ui.node(\"text\", { value, ...props }),\n\n heading: (value: string, props: Partial<NodeProps<\"heading\">> = {}) =>\n ui.node(\"heading\", { value, ...props }),\n\n markdown: (value: string, props: Partial<NodeProps<\"markdown\">> = {}) =>\n ui.node(\"markdown\", { value, ...props }),\n\n image: (src: string, props: Partial<NodeProps<\"image\">> = {}) =>\n ui.node(\"image\", { src, ...props }),\n\n video: (src: string, props: Partial<NodeProps<\"video\">> = {}) =>\n ui.node(\"video\", { src, ...props }),\n\n icon: (name: string, props: Partial<NodeProps<\"icon\">> = {}) =>\n ui.node(\"icon\", { name, ...props }),\n\n // ── Interactive ─────────────────────────────────────────────────────────────\n\n button: (props: NodeProps<\"button\"> = {}, children: UINode[] = []) =>\n ui.node(\"button\", props, children),\n\n badge: (label: string, props: Partial<NodeProps<\"badge\">> = {}) =>\n ui.node(\"badge\", { label, ...props }),\n\n dropdown: (props: NodeProps<\"dropdown\"> = {}, children: UINode[] = []) =>\n ui.node(\"dropdown\", props, children),\n\n popover: (props: NodeProps<\"popover\"> = {}, children: UINode[] = []) =>\n ui.node(\"popover\", props, children),\n\n // ── Forms ───────────────────────────────────────────────────────────────────\n\n form: (props: NodeProps<\"form\"> = {}, children: UINode[] = []) =>\n ui.node(\"form\", props, children),\n\n input: (name: string, props: Partial<NodeProps<\"input\">> = {}) =>\n ui.node(\"input\", { name, ...props }),\n\n textarea: (name: string, props: Partial<NodeProps<\"textarea\">> = {}) =>\n ui.node(\"textarea\", { name, ...props }),\n\n select: (name: string, options: NodeProps<\"select\">[\"options\"], props: Partial<NodeProps<\"select\">> = {}) =>\n ui.node(\"select\", { name, options, ...props }),\n\n checkbox: (name: string, props: Partial<NodeProps<\"checkbox\">> = {}) =>\n ui.node(\"checkbox\", { name, ...props }),\n\n radioGroup: (name: string, options: NodeProps<\"radioGroup\">[\"options\"], props: Partial<NodeProps<\"radioGroup\">> = {}) =>\n ui.node(\"radioGroup\", { name, options, ...props }),\n\n label: (value: string, props: Partial<NodeProps<\"label\">> = {}) =>\n ui.node(\"label\", { value, ...props }),\n\n hidden: (name: string, value: string) =>\n ui.node(\"hidden\", { name, value }),\n\n colorPicker: (name: string, props: Partial<NodeProps<\"colorPicker\">> = {}) =>\n ui.node(\"colorPicker\", { name, ...props }),\n\n upload: (props: NodeProps<\"upload\"> = {}) =>\n ui.node(\"upload\", props),\n\n // ── Positioning ─────────────────────────────────────────────────────────────\n\n float: (props: NodeProps<\"float\"> = {}, children: UINode[] = []) =>\n ui.node(\"float\", props, children),\n\n sticky: (props: NodeProps<\"sticky\"> = {}, children: UINode[] = []) =>\n ui.node(\"sticky\", props, children),\n\n // ── Compound ────────────────────────────────────────────────────────────────\n\n card: (props: NodeProps<\"card\"> = {}, children: UINode[] = []) =>\n ui.node(\"card\", props, children),\n\n chart: (data: NodeProps<\"chart\">[\"data\"], props: Partial<NodeProps<\"chart\">> = {}) =>\n ui.node(\"chart\", { data, ...props }),\n\n list: (props: NodeProps<\"list\"> = {}, children: UINode[] = []) =>\n ui.node(\"list\", props, children),\n\n listItem: (props: NodeProps<\"listItem\"> = {}, children: UINode[] = []) =>\n ui.node(\"listItem\", props, children),\n\n streamingText: (eventType: string, props: Partial<NodeProps<\"streamingText\">> = {}) =>\n ui.node(\"streamingText\", { eventType, ...props }),\n\n thread: (props: NodeProps<\"thread\"> = {}, children: UINode[] = []) =>\n ui.node(\"thread\", props, children),\n};\n"]}
package/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { j as UIContract, k as UINode } from './types-tSkCU6PC.js';
2
- export { a as UIAlign, e as UIColor, l as UIEvent, b as UIJustify, d as UIOrientation, i as UIRadius, h as UIShadow, U as UISize, f as UISpacing, g as UIWidth, c as UIWrap } from './types-tSkCU6PC.js';
1
+ import { m as UIContract, n as UINode } from './types-Dip78pyT.js';
2
+ export { f as UIAlign, d as UIColor, o as UIEvent, k as UIFontWeight, g as UIJustify, i as UIOrientation, j as UIOverflow, b as UIRadius, c as UIShadow, U as UISize, a as UISpacing, l as UITextAlign, e as UIWidth, h as UIWrap } from './types-Dip78pyT.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import React, { ReactNode } from 'react';
5
5
  import 'melony';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { ui } from './server.js';
2
- export { a as UIAlign, e as UIColor, j as UIContract, l as UIEvent, b as UIJustify, k as UINode, d as UIOrientation, i as UIRadius, h as UIShadow, U as UISize, f as UISpacing, g as UIWidth, c as UIWrap } from './types-tSkCU6PC.js';
2
+ export { f as UIAlign, d as UIColor, m as UIContract, o as UIEvent, k as UIFontWeight, g as UIJustify, n as UINode, i as UIOrientation, j as UIOverflow, b as UIRadius, c as UIShadow, U as UISize, a as UISpacing, l as UITextAlign, e as UIWidth, h as UIWrap } from './types-Dip78pyT.js';
3
3
  export { MelonyComponents, MelonyRenderer, MelonyRendererProps, MelonyUIContextValue, MelonyUIProvider, MelonyUIProviderProps, useMelonyUI } from './client.js';
4
4
  import 'melony';
5
5
  import 'react/jsx-runtime';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export { MelonyRenderer, MelonyUIProvider, useMelonyUI } from './chunk-7YJBGUKN.js';
2
- export { ui } from './chunk-3JCAOTZB.js';
2
+ export { ui } from './chunk-NC5WJY7M.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
package/dist/server.d.ts CHANGED
@@ -1,39 +1,50 @@
1
- import { j as UIContract, k as UINode, l as UIEvent } from './types-tSkCU6PC.js';
2
- export { a as UIAlign, e as UIColor, b as UIJustify, d as UIOrientation, i as UIRadius, h as UIShadow, U as UISize, f as UISpacing, g as UIWidth, c as UIWrap } from './types-tSkCU6PC.js';
1
+ import { m as UIContract, n as UINode, o as UIEvent } from './types-Dip78pyT.js';
2
+ export { f as UIAlign, d as UIColor, k as UIFontWeight, g as UIJustify, i as UIOrientation, j as UIOverflow, b as UIRadius, c as UIShadow, U as UISize, a as UISpacing, l as UITextAlign, e as UIWidth, h as UIWrap } from './types-Dip78pyT.js';
3
3
  import 'melony';
4
4
 
5
+ type NodeProps<T extends keyof UIContract> = UIContract[T];
5
6
  /**
6
- * Helper to create UI events in Melony actions.
7
+ * Builder helpers for creating UI nodes in Melony actions.
8
+ *
9
+ * All container helpers follow (props, children?) signature.
10
+ * Content helpers with a required value follow (value, props?) signature.
7
11
  */
8
12
  declare const ui: {
9
- /**
10
- * Creates a UI node.
11
- */
12
- node: <T extends keyof UIContract>(type: T, props?: UIContract[T], children?: UINode<any>[]) => UINode<T>;
13
- /**
14
- * Wraps a UI node in an event.
15
- */
13
+ node: <T extends keyof UIContract>(type: T, props?: NodeProps<T>, children?: UINode<any>[]) => UINode<T>;
16
14
  event: (node: UINode) => UIEvent;
17
- button: (props: UIContract["button"], children?: UINode[]) => UINode<"button">;
18
- text: (value: string, props?: Partial<UIContract["text"]>) => UINode<"text">;
19
- markdown: (value: string, props?: Partial<UIContract["markdown"]>) => UINode<"markdown">;
20
- heading: (value: string, level?: UIContract["heading"]["level"], props?: Partial<UIContract["heading"]>) => UINode<"heading">;
21
- row: (props?: UIContract["row"], children?: UINode[]) => UINode<"row">;
22
- col: (props?: UIContract["col"], children?: UINode[]) => UINode<"col">;
23
- box: (props?: UIContract["box"], children?: UINode[]) => UINode<"box">;
24
- input: (name: string, label?: string, props?: Partial<UIContract["input"]>) => UINode<"input">;
25
- textarea: (name: string, props?: Partial<UIContract["textarea"]>) => UINode<"textarea">;
26
- select: (name: string, options: UIContract["select"]["options"], label?: string, props?: Partial<UIContract["select"]>) => UINode<"select">;
27
- checkbox: (name: string, label?: string, props?: Partial<UIContract["checkbox"]>) => UINode<"checkbox">;
28
- form: (props?: UIContract["form"], children?: UINode[]) => UINode<"form">;
29
- icon: (name: string, props?: Partial<UIContract["icon"]>) => UINode<"icon">;
30
- image: (src: string, alt?: string, props?: Partial<UIContract["image"]>) => UINode<"image">;
31
- spacer: (props?: UIContract["spacer"]) => UINode<"spacer">;
32
- divider: (props?: UIContract["divider"]) => UINode<"divider">;
33
- popover: (props?: UIContract["popover"], children?: UINode[]) => UINode<"popover">;
34
- float: (props?: UIContract["float"], children?: UINode[]) => UINode<"float">;
35
- sticky: (props?: UIContract["sticky"], children?: UINode[]) => UINode<"sticky">;
36
- streamingText: (eventType: string, props?: Partial<UIContract["streamingText"]>) => UINode<"streamingText">;
15
+ row: (props?: NodeProps<"row">, children?: UINode[]) => UINode<"row">;
16
+ col: (props?: NodeProps<"col">, children?: UINode[]) => UINode<"col">;
17
+ box: (props?: NodeProps<"box">, children?: UINode[]) => UINode<"box">;
18
+ spacer: (props?: NodeProps<"spacer">) => UINode<"spacer">;
19
+ divider: (props?: NodeProps<"divider">) => UINode<"divider">;
20
+ text: (value: string, props?: Partial<NodeProps<"text">>) => UINode<"text">;
21
+ heading: (value: string, props?: Partial<NodeProps<"heading">>) => UINode<"heading">;
22
+ markdown: (value: string, props?: Partial<NodeProps<"markdown">>) => UINode<"markdown">;
23
+ image: (src: string, props?: Partial<NodeProps<"image">>) => UINode<"image">;
24
+ video: (src: string, props?: Partial<NodeProps<"video">>) => UINode<"video">;
25
+ icon: (name: string, props?: Partial<NodeProps<"icon">>) => UINode<"icon">;
26
+ button: (props?: NodeProps<"button">, children?: UINode[]) => UINode<"button">;
27
+ badge: (label: string, props?: Partial<NodeProps<"badge">>) => UINode<"badge">;
28
+ dropdown: (props?: NodeProps<"dropdown">, children?: UINode[]) => UINode<"dropdown">;
29
+ popover: (props?: NodeProps<"popover">, children?: UINode[]) => UINode<"popover">;
30
+ form: (props?: NodeProps<"form">, children?: UINode[]) => UINode<"form">;
31
+ input: (name: string, props?: Partial<NodeProps<"input">>) => UINode<"input">;
32
+ textarea: (name: string, props?: Partial<NodeProps<"textarea">>) => UINode<"textarea">;
33
+ select: (name: string, options: NodeProps<"select">["options"], props?: Partial<NodeProps<"select">>) => UINode<"select">;
34
+ checkbox: (name: string, props?: Partial<NodeProps<"checkbox">>) => UINode<"checkbox">;
35
+ radioGroup: (name: string, options: NodeProps<"radioGroup">["options"], props?: Partial<NodeProps<"radioGroup">>) => UINode<"radioGroup">;
36
+ label: (value: string, props?: Partial<NodeProps<"label">>) => UINode<"label">;
37
+ hidden: (name: string, value: string) => UINode<"hidden">;
38
+ colorPicker: (name: string, props?: Partial<NodeProps<"colorPicker">>) => UINode<"colorPicker">;
39
+ upload: (props?: NodeProps<"upload">) => UINode<"upload">;
40
+ float: (props?: NodeProps<"float">, children?: UINode[]) => UINode<"float">;
41
+ sticky: (props?: NodeProps<"sticky">, children?: UINode[]) => UINode<"sticky">;
42
+ card: (props?: NodeProps<"card">, children?: UINode[]) => UINode<"card">;
43
+ chart: (data: NodeProps<"chart">["data"], props?: Partial<NodeProps<"chart">>) => UINode<"chart">;
44
+ list: (props?: NodeProps<"list">, children?: UINode[]) => UINode<"list">;
45
+ listItem: (props?: NodeProps<"listItem">, children?: UINode[]) => UINode<"listItem">;
46
+ streamingText: (eventType: string, props?: Partial<NodeProps<"streamingText">>) => UINode<"streamingText">;
47
+ thread: (props?: NodeProps<"thread">, children?: UINode[]) => UINode<"thread">;
37
48
  };
38
49
 
39
50
  export { UIContract, UIEvent, UINode, ui };
package/dist/server.js CHANGED
@@ -1,3 +1,3 @@
1
- export { ui } from './chunk-3JCAOTZB.js';
1
+ export { ui } from './chunk-NC5WJY7M.js';
2
2
  //# sourceMappingURL=server.js.map
3
3
  //# sourceMappingURL=server.js.map
@@ -1,106 +1,80 @@
1
1
  import { Event } from 'melony';
2
2
 
3
- type UISize = "sm" | "md" | "lg" | (string & {});
4
- type UIAlign = "start" | "center" | "end" | "stretch" | (string & {});
5
- type UIJustify = "start" | "center" | "end" | "between" | "around" | (string & {});
6
- type UIWrap = "nowrap" | "wrap" | "wrap-reverse" | (string & {});
7
- type UIOrientation = "horizontal" | "vertical" | (string & {});
3
+ type UISize = "xs" | "sm" | "md" | "lg" | "xl";
4
+ type UISpacing = "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
5
+ type UIRadius = "none" | "sm" | "md" | "lg" | "full";
6
+ type UIShadow = "none" | "sm" | "md" | "lg" | "xl";
8
7
  type UIColor = "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "background" | "foreground" | "muted" | "mutedForeground" | "border" | "transparent" | (string & {});
9
- type UISpacing = "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | (string & {});
10
8
  type UIWidth = "auto" | "full" | "min" | "max" | "1/2" | "1/3" | "2/3" | "1/4" | "3/4" | number | (string & {});
11
- type UIShadow = "none" | "sm" | "md" | "lg" | "xl" | (string & {});
12
- type UIRadius = "none" | "sm" | "md" | "lg" | "full" | (string & {});
13
- /**
14
- * UI Component Contracts
15
- * This acts as the source of truth for the SDUI protocol.
16
- */
9
+ type UIAlign = "start" | "center" | "end" | "stretch";
10
+ type UIJustify = "start" | "center" | "end" | "between" | "around";
11
+ type UIWrap = "nowrap" | "wrap" | "wrap-reverse";
12
+ type UIOrientation = "horizontal" | "vertical";
13
+ type UIOverflow = "hidden" | "visible" | "scroll" | "auto";
14
+ type UIFontWeight = "normal" | "medium" | "semibold" | "bold";
15
+ type UITextAlign = "start" | "center" | "end";
16
+ interface UIBaseProps {
17
+ id?: string;
18
+ }
19
+ interface UIFlexProps {
20
+ align?: UIAlign;
21
+ justify?: UIJustify;
22
+ gap?: UISpacing;
23
+ wrap?: UIWrap;
24
+ }
25
+ interface UIContainerProps {
26
+ padding?: UISpacing;
27
+ width?: UIWidth;
28
+ maxWidth?: number | string;
29
+ height?: "auto" | "full";
30
+ flex?: number;
31
+ overflow?: UIOverflow;
32
+ background?: UIColor;
33
+ border?: boolean;
34
+ borderColor?: UIColor;
35
+ radius?: UIRadius;
36
+ shadow?: UIShadow;
37
+ }
17
38
  interface UIContract {
18
- row: {
19
- id?: string;
20
- align?: UIAlign;
21
- justify?: UIJustify;
22
- wrap?: UIWrap;
23
- gap?: UISpacing;
24
- padding?: UISpacing;
25
- width?: UIWidth;
26
- height?: "auto" | "full";
39
+ row: UIBaseProps & UIFlexProps & UIContainerProps & {
27
40
  group?: boolean;
28
- flex?: number;
29
- overflow?: "hidden" | "visible" | "scroll" | "auto";
30
41
  };
31
- col: {
32
- id?: string;
33
- align?: UIAlign;
34
- justify?: UIJustify;
35
- gap?: UISpacing;
36
- width?: UIWidth;
37
- height?: "auto" | "full";
38
- padding?: UISpacing;
39
- background?: UIColor;
40
- radius?: UIRadius;
42
+ col: UIBaseProps & UIFlexProps & UIContainerProps & {
41
43
  group?: boolean;
42
- flex?: number;
43
- overflow?: "hidden" | "visible" | "scroll" | "auto";
44
- maxWidth?: number | string;
45
44
  };
46
- box: {
47
- id?: string;
48
- padding?: UISpacing;
49
- paddingVertical?: UISpacing;
50
- paddingHorizontal?: UISpacing;
45
+ box: UIBaseProps & UIContainerProps & {
51
46
  margin?: UISpacing;
52
- marginVertical?: UISpacing;
53
- marginHorizontal?: UISpacing;
54
- background?: UIColor;
55
- border?: boolean;
56
- borderColor?: UIColor;
57
- radius?: UIRadius;
58
- width?: UIWidth;
59
- maxWidth?: number | string;
60
- height?: "auto" | "full";
61
- shadow?: UIShadow;
62
47
  group?: boolean;
63
- flex?: number;
64
- overflow?: "hidden" | "visible" | "scroll" | "auto";
65
48
  onClickAction?: Event;
66
49
  };
67
- spacer: {
68
- id?: string;
50
+ spacer: UIBaseProps & {
69
51
  size?: UISpacing;
70
52
  direction?: UIOrientation;
71
53
  };
72
- divider: {
73
- id?: string;
54
+ divider: UIBaseProps & {
74
55
  orientation?: UIOrientation;
75
56
  color?: UIColor;
76
57
  margin?: UISpacing;
77
58
  };
78
- text: {
79
- id?: string;
59
+ text: UIBaseProps & {
80
60
  value: string;
81
- size?: UISpacing;
82
- weight?: "normal" | "medium" | "semibold" | "bold";
61
+ size?: UISize;
62
+ weight?: UIFontWeight;
83
63
  color?: UIColor;
84
- align?: UIAlign;
85
- className?: string;
64
+ align?: UITextAlign;
86
65
  };
87
- heading: {
88
- id?: string;
66
+ heading: UIBaseProps & {
89
67
  value: string;
90
68
  level?: 1 | 2 | 3 | 4 | 5 | 6;
91
69
  color?: UIColor;
92
- align?: UIAlign;
70
+ align?: UITextAlign;
93
71
  };
94
- markdown: {
95
- id?: string;
72
+ markdown: UIBaseProps & {
96
73
  value: string;
97
- size?: UISpacing;
74
+ size?: UISize;
98
75
  color?: UIColor;
99
- align?: UIAlign;
100
- className?: string;
101
76
  };
102
- image: {
103
- id?: string;
77
+ image: UIBaseProps & {
104
78
  src: string;
105
79
  alt?: string;
106
80
  width?: UIWidth;
@@ -108,8 +82,7 @@ interface UIContract {
108
82
  radius?: UIRadius;
109
83
  objectFit?: "cover" | "contain" | "fill";
110
84
  };
111
- video: {
112
- id?: string;
85
+ video: UIBaseProps & {
113
86
  src: string;
114
87
  poster?: string;
115
88
  autoPlay?: boolean;
@@ -121,19 +94,46 @@ interface UIContract {
121
94
  height?: string | number;
122
95
  radius?: UIRadius;
123
96
  };
124
- icon: {
125
- id?: string;
97
+ icon: UIBaseProps & {
126
98
  name: string;
127
99
  size?: UISize | number;
128
100
  color?: UIColor;
129
101
  };
130
- form: {
131
- id?: string;
102
+ button: UIBaseProps & {
103
+ type?: "button" | "submit" | "reset";
104
+ variant?: "primary" | "secondary" | "success" | "danger" | "outline" | "ghost" | "link";
105
+ size?: UISize;
106
+ disabled?: boolean;
107
+ width?: UIWidth;
108
+ onClickAction?: Event;
109
+ justify?: UIJustify;
110
+ truncate?: boolean;
111
+ };
112
+ badge: UIBaseProps & {
113
+ label: string;
114
+ variant?: "primary" | "secondary" | "danger" | "success" | "warning" | "outline";
115
+ size?: UISize;
116
+ };
117
+ dropdown: UIBaseProps & {
118
+ items?: Array<{
119
+ label: string;
120
+ icon?: string;
121
+ onClickAction?: Event;
122
+ }>;
123
+ };
124
+ popover: UIBaseProps & {
125
+ side?: "top" | "right" | "bottom" | "left";
126
+ align?: "start" | "center" | "end";
127
+ sideOffset?: number;
128
+ alignOffset?: number;
129
+ modal?: boolean;
130
+ trigger?: UINode;
131
+ };
132
+ form: UIBaseProps & {
132
133
  onSubmitAction?: Event | ((data: any) => Event);
133
134
  gap?: UISpacing;
134
135
  };
135
- input: {
136
- id?: string;
136
+ input: UIBaseProps & {
137
137
  name: string;
138
138
  label?: string;
139
139
  placeholder?: string;
@@ -144,8 +144,7 @@ interface UIContract {
144
144
  required?: boolean;
145
145
  width?: UIWidth;
146
146
  };
147
- textarea: {
148
- id?: string;
147
+ textarea: UIBaseProps & {
149
148
  name: string;
150
149
  placeholder?: string;
151
150
  defaultValue?: string;
@@ -156,13 +155,8 @@ interface UIContract {
156
155
  disabled?: boolean;
157
156
  required?: boolean;
158
157
  width?: UIWidth;
159
- background?: UIColor;
160
- border?: boolean;
161
- shadow?: UIShadow;
162
- radius?: UIRadius;
163
158
  };
164
- select: {
165
- id?: string;
159
+ select: UIBaseProps & {
166
160
  name: string;
167
161
  label?: string;
168
162
  options: Array<{
@@ -176,21 +170,14 @@ interface UIContract {
176
170
  required?: boolean;
177
171
  width?: UIWidth;
178
172
  };
179
- checkbox: {
180
- id?: string;
173
+ checkbox: UIBaseProps & {
181
174
  name: string;
182
175
  label?: string;
183
176
  checked?: boolean;
184
177
  onChangeAction?: Event;
185
178
  disabled?: boolean;
186
179
  };
187
- hidden: {
188
- id?: string;
189
- name: string;
190
- value: string;
191
- };
192
- radioGroup: {
193
- id?: string;
180
+ radioGroup: UIBaseProps & {
194
181
  name: string;
195
182
  options: Array<{
196
183
  label: string;
@@ -203,24 +190,24 @@ interface UIContract {
203
190
  onChangeAction?: Event;
204
191
  disabled?: boolean;
205
192
  };
206
- label: {
207
- id?: string;
193
+ label: UIBaseProps & {
208
194
  value: string;
209
- htmlFor?: string;
210
195
  required?: boolean;
211
- size?: UISpacing;
196
+ size?: UISize;
212
197
  color?: UIColor;
213
198
  };
214
- colorPicker: {
215
- id?: string;
199
+ hidden: UIBaseProps & {
200
+ name: string;
201
+ value: string;
202
+ };
203
+ colorPicker: UIBaseProps & {
216
204
  name: string;
217
205
  label?: string;
218
206
  defaultValue?: string;
219
207
  onChangeAction?: Event;
220
208
  disabled?: boolean;
221
209
  };
222
- upload: {
223
- id?: string;
210
+ upload: UIBaseProps & {
224
211
  label?: string;
225
212
  multiple?: boolean;
226
213
  accept?: string;
@@ -232,35 +219,13 @@ interface UIContract {
232
219
  mode?: "append" | "replace";
233
220
  disabled?: boolean;
234
221
  };
235
- button: {
236
- id?: string;
237
- type?: "button" | "submit" | "reset";
238
- variant?: "primary" | "secondary" | "success" | "danger" | "outline" | "ghost" | "link";
239
- size?: UISize;
240
- disabled?: boolean;
241
- width?: UIWidth;
242
- onClickAction?: Event;
243
- justify?: UIJustify;
244
- truncate?: boolean;
245
- };
246
- popover: {
247
- id?: string;
248
- side?: "top" | "right" | "bottom" | "left";
249
- align?: "start" | "center" | "end";
250
- sideOffset?: number;
251
- alignOffset?: number;
252
- modal?: boolean;
253
- trigger?: UINode;
254
- };
255
- float: {
256
- id?: string;
222
+ float: UIBaseProps & {
257
223
  position?: "top-left" | "top-right" | "top-center" | "bottom-left" | "bottom-right" | "bottom-center" | "center" | "left-center" | "right-center";
258
224
  offsetX?: UISpacing;
259
225
  offsetY?: UISpacing;
260
226
  showOnHover?: boolean;
261
227
  };
262
- sticky: {
263
- id?: string;
228
+ sticky: UIBaseProps & {
264
229
  top?: UISpacing | number;
265
230
  bottom?: UISpacing | number;
266
231
  left?: UISpacing | number;
@@ -271,24 +236,7 @@ interface UIContract {
271
236
  width?: UIWidth;
272
237
  maxWidth?: number | string;
273
238
  };
274
- streamingText: {
275
- id?: string;
276
- eventType: string;
277
- size?: UISpacing;
278
- weight?: "normal" | "medium" | "semibold" | "bold";
279
- color?: UIColor;
280
- align?: UIAlign;
281
- className?: string;
282
- markdown?: boolean;
283
- };
284
- badge: {
285
- id?: string;
286
- label: string;
287
- variant?: "primary" | "secondary" | "danger" | "success" | "warning" | "outline";
288
- size?: UISize;
289
- };
290
- card: {
291
- id?: string;
239
+ card: UIBaseProps & {
292
240
  title?: string;
293
241
  subtitle?: string;
294
242
  background?: UIColor;
@@ -296,8 +244,7 @@ interface UIContract {
296
244
  radius?: UIRadius;
297
245
  shadow?: UIShadow;
298
246
  };
299
- chart: {
300
- id?: string;
247
+ chart: UIBaseProps & {
301
248
  data: Array<{
302
249
  label: string;
303
250
  value: number;
@@ -310,22 +257,12 @@ interface UIContract {
310
257
  showGrid?: boolean;
311
258
  showTooltips?: boolean;
312
259
  };
313
- dropdown: {
314
- id?: string;
315
- items?: Array<{
316
- label: string;
317
- icon?: string;
318
- onClickAction?: Event;
319
- }>;
320
- };
321
- list: {
322
- id?: string;
260
+ list: UIBaseProps & {
323
261
  padding?: UISpacing;
324
262
  gap?: UISpacing;
325
263
  width?: UIWidth;
326
264
  };
327
- listItem: {
328
- id?: string;
265
+ listItem: UIBaseProps & {
329
266
  onClickAction?: Event;
330
267
  gap?: UISpacing;
331
268
  padding?: UISpacing;
@@ -334,8 +271,15 @@ interface UIContract {
334
271
  align?: UIAlign;
335
272
  truncate?: boolean;
336
273
  };
337
- thread: {
338
- id?: string;
274
+ streamingText: UIBaseProps & {
275
+ eventType: string;
276
+ size?: UISize;
277
+ weight?: UIFontWeight;
278
+ color?: UIColor;
279
+ align?: UITextAlign;
280
+ markdown?: boolean;
281
+ };
282
+ thread: UIBaseProps & {
339
283
  placeholder?: string;
340
284
  messages?: Array<{
341
285
  role: string;
@@ -352,11 +296,8 @@ type UINode<T extends keyof UIContract = keyof UIContract> = {
352
296
  props?: UIContract[T];
353
297
  children?: UINode<any>[];
354
298
  };
355
- /**
356
- * Standard UI event type for Melony.
357
- */
358
299
  interface UIEvent extends Event<UINode> {
359
300
  type: "ui";
360
301
  }
361
302
 
362
- export type { UISize as U, UIAlign as a, UIJustify as b, UIWrap as c, UIOrientation as d, UIColor as e, UISpacing as f, UIWidth as g, UIShadow as h, UIRadius as i, UIContract as j, UINode as k, UIEvent as l };
303
+ export type { UISize as U, UISpacing as a, UIRadius as b, UIShadow as c, UIColor as d, UIWidth as e, UIAlign as f, UIJustify as g, UIWrap as h, UIOrientation as i, UIOverflow as j, UIFontWeight as k, UITextAlign as l, UIContract as m, UINode as n, UIEvent as o };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@melony/ui-kit",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -1,42 +0,0 @@
1
- // src/server.ts
2
- var ui = {
3
- /**
4
- * Creates a UI node.
5
- */
6
- node: (type, props = {}, children = []) => ({
7
- type,
8
- props,
9
- children
10
- }),
11
- /**
12
- * Wraps a UI node in an event.
13
- */
14
- event: (node) => ({
15
- type: "ui",
16
- data: node
17
- }),
18
- button: (props, children = []) => ui.node("button", props, children),
19
- text: (value, props = {}) => ui.node("text", { value, ...props }),
20
- markdown: (value, props = {}) => ui.node("markdown", { value, ...props }),
21
- heading: (value, level = 1, props = {}) => ui.node("heading", { value, level, ...props }),
22
- row: (props = {}, children = []) => ui.node("row", props, children),
23
- col: (props = {}, children = []) => ui.node("col", props, children),
24
- box: (props = {}, children = []) => ui.node("box", props, children),
25
- input: (name, label, props = {}) => ui.node("input", { name, label, ...props }),
26
- textarea: (name, props = {}) => ui.node("textarea", { name, ...props }),
27
- select: (name, options, label, props = {}) => ui.node("select", { name, options, label, ...props }),
28
- checkbox: (name, label, props = {}) => ui.node("checkbox", { name, label, ...props }),
29
- form: (props = {}, children = []) => ui.node("form", props, children),
30
- icon: (name, props = {}) => ui.node("icon", { name, ...props }),
31
- image: (src, alt, props = {}) => ui.node("image", { src, alt, ...props }),
32
- spacer: (props = {}) => ui.node("spacer", props),
33
- divider: (props = {}) => ui.node("divider", props),
34
- popover: (props = {}, children = []) => ui.node("popover", props, children),
35
- float: (props = {}, children = []) => ui.node("float", props, children),
36
- sticky: (props = {}, children = []) => ui.node("sticky", props, children),
37
- streamingText: (eventType, props = {}) => ui.node("streamingText", { eventType, ...props })
38
- };
39
-
40
- export { ui };
41
- //# sourceMappingURL=chunk-3JCAOTZB.js.map
42
- //# sourceMappingURL=chunk-3JCAOTZB.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/server.ts"],"names":[],"mappings":";AAOO,IAAM,EAAA,GAAK;AAAA;AAAA;AAAA;AAAA,EAIhB,IAAA,EAAM,CACJ,IAAA,EACA,KAAA,GAAuB,EAAC,EACxB,QAAA,GAA0B,EAAC,MACZ;AAAA,IACf,IAAA;AAAA,IACA,KAAA;AAAA,IACA;AAAA,GACF,CAAA;AAAA;AAAA;AAAA;AAAA,EAKA,KAAA,EAAO,CAAC,IAAA,MAA2B;AAAA,IACjC,IAAA,EAAM,IAAA;AAAA,IACN,IAAA,EAAM;AAAA,GACR,CAAA;AAAA,EAEA,MAAA,EAAQ,CAAC,KAAA,EAA6B,QAAA,GAAqB,OACzD,EAAA,CAAG,IAAA,CAAK,QAAA,EAAU,KAAA,EAAO,QAAQ,CAAA;AAAA,EAEnC,IAAA,EAAM,CAAC,KAAA,EAAe,KAAA,GAAqC,EAAC,KAC1D,EAAA,CAAG,IAAA,CAAK,MAAA,EAAQ,EAAE,KAAA,EAAO,GAAG,OAAO,CAAA;AAAA,EAErC,QAAA,EAAU,CAAC,KAAA,EAAe,KAAA,GAAyC,EAAC,KAClE,EAAA,CAAG,IAAA,CAAK,UAAA,EAAY,EAAE,KAAA,EAAO,GAAG,OAAO,CAAA;AAAA,EAEzC,SAAS,CAAC,KAAA,EAAe,KAAA,GAAwC,CAAA,EAAG,QAAwC,EAAC,KAC3G,EAAA,CAAG,IAAA,CAAK,WAAW,EAAE,KAAA,EAAO,KAAA,EAAO,GAAG,OAAO,CAAA;AAAA,EAE/C,GAAA,EAAK,CAAC,KAAA,GAA2B,EAAC,EAAG,QAAA,GA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,EAAE,IAAA,EAAM,GAAG,OAAO,CAAA;AAAA,EAEpC,KAAA,EAAO,CAAC,GAAA,EAAa,GAAA,EAAc,QAAsC,EAAC,KACxE,EAAA,CAAG,IAAA,CAAK,SAAS,EAAE,GAAA,EAAK,GAAA,EAAK,GAAG,OAAO,CAAA;AAAA,EAEzC,MAAA,EAAQ,CAAC,KAAA,GAA8B,OACrC,EAAA,CAAG,IAAA,CAAK,UAAU,KAAK,CAAA;AAAA,EAEzB,OAAA,EAAS,CAAC,KAAA,GAA+B,OACvC,EAAA,CAAG,IAAA,CAAK,WAAW,KAAK,CAAA;AAAA,EAE1B,OAAA,EAAS,CAAC,KAAA,GAA+B,EAAC,EAAG,QAAA,GAAqB,EAAC,KACjE,EAAA,CAAG,IAAA,CAAK,SAAA,EAAW,KAAA,EAAO,QAAQ,CAAA;AAAA,EAEpC,KAAA,EAAO,CAAC,KAAA,GAA6B,EAAC,EAAG,QAAA,GAAqB,EAAC,KAC7D,EAAA,CAAG,IAAA,CAAK,OAAA,EAAS,KAAA,EAAO,QAAQ,CAAA;AAAA,EAClC,MAAA,EAAQ,CAAC,KAAA,GAA8B,EAAC,EAAG,QAAA,GAAqB,EAAC,KAC/D,EAAA,CAAG,IAAA,CAAK,QAAA,EAAU,KAAA,EAAO,QAAQ,CAAA;AAAA,EACnC,aAAA,EAAe,CAAC,SAAA,EAAmB,KAAA,GAA8C,EAAC,KAChF,EAAA,CAAG,IAAA,CAAK,eAAA,EAAiB,EAAE,SAAA,EAAW,GAAG,OAAO;AACpD","file":"chunk-3JCAOTZB.js","sourcesContent":["import { UIContract, UINode, UIEvent } from \"./types\";\n\nexport * from \"./types\";\n\n/**\n * Helper to create UI events in Melony actions.\n */\nexport const ui = {\n /**\n * Creates a UI node.\n */\n node: <T extends keyof UIContract>(\n type: T,\n props: UIContract[T] = {} as any,\n children: UINode<any>[] = []\n ): UINode<T> => ({\n type,\n props,\n children,\n }),\n\n /**\n * Wraps a UI node in an event.\n */\n event: (node: UINode): UIEvent => ({\n type: \"ui\",\n data: node,\n }),\n\n button: (props: UIContract[\"button\"], children: UINode[] = []) =>\n ui.node(\"button\", props, children),\n\n text: (value: string, props: Partial<UIContract[\"text\"]> = {}) =>\n ui.node(\"text\", { value, ...props }),\n\n markdown: (value: string, props: Partial<UIContract[\"markdown\"]> = {}) =>\n ui.node(\"markdown\", { value, ...props }),\n\n heading: (value: string, level: UIContract[\"heading\"][\"level\"] = 1, props: Partial<UIContract[\"heading\"]> = {}) =>\n ui.node(\"heading\", { value, level, ...props }),\n\n row: (props: UIContract[\"row\"] = {}, children: UINode[] = []) =>\n ui.node(\"row\", props, children),\n\n col: (props: UIContract[\"col\"] = {}, children: UINode[] = []) =>\n ui.node(\"col\", props, children),\n\n box: (props: UIContract[\"box\"] = {}, children: UINode[] = []) =>\n ui.node(\"box\", props, children),\n\n input: (name: string, label?: string, props: Partial<UIContract[\"input\"]> = {}) =>\n ui.node(\"input\", { name, label, ...props }),\n\n textarea: (name: string, props: Partial<UIContract[\"textarea\"]> = {}) =>\n ui.node(\"textarea\", { name, ...props }),\n\n select: (name: string, options: UIContract[\"select\"][\"options\"], label?: string, props: Partial<UIContract[\"select\"]> = {}) =>\n ui.node(\"select\", { name, options, label, ...props }),\n\n checkbox: (name: string, label?: string, props: Partial<UIContract[\"checkbox\"]> = {}) =>\n ui.node(\"checkbox\", { name, label, ...props }),\n\n form: (props: UIContract[\"form\"] = {}, children: UINode[] = []) =>\n ui.node(\"form\", props, children),\n\n icon: (name: string, props: Partial<UIContract[\"icon\"]> = {}) =>\n ui.node(\"icon\", { name, ...props }),\n\n image: (src: string, alt?: string, props: Partial<UIContract[\"image\"]> = {}) =>\n ui.node(\"image\", { src, alt, ...props }),\n\n spacer: (props: UIContract[\"spacer\"] = {}) =>\n ui.node(\"spacer\", props),\n\n divider: (props: UIContract[\"divider\"] = {}) =>\n ui.node(\"divider\", props),\n\n popover: (props: UIContract[\"popover\"] = {}, children: UINode[] = []) =>\n ui.node(\"popover\", props, children),\n\n float: (props: UIContract[\"float\"] = {}, children: UINode[] = []) =>\n ui.node(\"float\", props, children),\n sticky: (props: UIContract[\"sticky\"] = {}, children: UINode[] = []) =>\n ui.node(\"sticky\", props, children),\n streamingText: (eventType: string, props: Partial<UIContract[\"streamingText\"]> = {}) =>\n ui.node(\"streamingText\", { eventType, ...props }),\n};\n"]}