@mulmochat-plugin/ui-image 0.1.0

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/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # @mulmochat-plugin/ui-image
2
+
3
+ Shared image UI components for MulmoChat plugins.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @mulmochat-plugin/ui-image
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import { ImageView, ImagePreview } from "@mulmochat-plugin/ui-image";
15
+ import type { ImageToolData } from "@mulmochat-plugin/ui-image";
16
+ import "@mulmochat-plugin/ui-image/style.css";
17
+
18
+ export const plugin = {
19
+ // ...
20
+ viewComponent: ImageView,
21
+ previewComponent: ImagePreview,
22
+ };
23
+ ```
24
+
25
+ ## Components
26
+
27
+ ### ImageView
28
+
29
+ Full-size image view component with prompt display.
30
+
31
+ Props:
32
+ - `selectedResult: ToolResult<ImageToolData>` - The tool result containing image data
33
+
34
+ ### ImagePreview
35
+
36
+ Thumbnail preview component for sidebar.
37
+
38
+ Props:
39
+ - `result: ToolResult<ImageToolData>` - The tool result containing image data
40
+
41
+ ## Types
42
+
43
+ ### ImageToolData
44
+
45
+ ```typescript
46
+ interface ImageToolData {
47
+ imageData: string; // Base64 encoded image data URL
48
+ prompt?: string; // Optional prompt used to generate the image
49
+ }
50
+ ```
@@ -0,0 +1,7 @@
1
+ import type { ToolResult, ImageToolData } from "./types";
2
+ type __VLS_Props = {
3
+ result: ToolResult<ImageToolData>;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import type { ToolResult, ImageToolData } from "./types";
2
+ type __VLS_Props = {
3
+ selectedResult: ToolResult<ImageToolData>;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),s={class:"w-full h-full overflow-y-auto"},c={class:"min-h-full flex flex-col items-center justify-center p-4"},n={class:"flex-1 flex items-center justify-center min-h-0"},o=["src"],r={key:0,class:"mt-4 p-3 bg-gray-100 dark:bg-gray-800 rounded-lg max-w-full flex-shrink-0"},i={class:"text-sm text-gray-700 dark:text-gray-300"},m=e.defineComponent({__name:"ImageView",props:{selectedResult:{}},setup(t){return(l,a)=>(e.openBlock(),e.createElementBlock("div",s,[e.createElementVNode("div",c,[e.createElementVNode("div",n,[e.createElementVNode("img",{src:t.selectedResult.data?.imageData,class:"max-w-full max-h-full object-contain rounded",alt:"Current generated image"},null,8,o)]),t.selectedResult.data?.prompt?(e.openBlock(),e.createElementBlock("div",r,[e.createElementVNode("p",i,[a[0]||(a[0]=e.createElementVNode("span",{class:"font-medium"},"Prompt:",-1)),e.createTextVNode(" "+e.toDisplayString(t.selectedResult.data.prompt),1)])])):e.createCommentVNode("",!0)])]))}}),d={class:"min-h-[100px] flex items-center justify-center"},u=["src"],g={key:1,class:"text-gray-400 text-sm"},f=e.defineComponent({__name:"ImagePreview",props:{result:{}},setup(t){return(l,a)=>(e.openBlock(),e.createElementBlock("div",d,[t.result.data?.imageData?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.result.data.imageData,class:"max-w-full h-auto rounded",alt:"Generated image"},null,8,u)):(e.openBlock(),e.createElementBlock("div",g,"No image yet"))]))}});exports.ImagePreview=f;exports.ImageView=m;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @mulmochat-plugin/ui-image
3
+ *
4
+ * Shared image UI components for MulmoChat plugins.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * import { ImageView, ImagePreview } from "@mulmochat-plugin/ui-image";
9
+ * import "@mulmochat-plugin/ui-image/style.css";
10
+ * ```
11
+ */
12
+ export { default as ImageView } from "./ImageView.vue";
13
+ export { default as ImagePreview } from "./ImagePreview.vue";
14
+ export type { ImageToolData, ToolResult } from "./types";
package/dist/index.js ADDED
@@ -0,0 +1,51 @@
1
+ import { defineComponent as r, createElementBlock as s, openBlock as a, createElementVNode as t, createCommentVNode as c, createTextVNode as o, toDisplayString as i } from "vue";
2
+ const m = { class: "w-full h-full overflow-y-auto" }, d = { class: "min-h-full flex flex-col items-center justify-center p-4" }, u = { class: "flex-1 flex items-center justify-center min-h-0" }, f = ["src"], g = {
3
+ key: 0,
4
+ class: "mt-4 p-3 bg-gray-100 dark:bg-gray-800 rounded-lg max-w-full flex-shrink-0"
5
+ }, _ = { class: "text-sm text-gray-700 dark:text-gray-300" }, v = /* @__PURE__ */ r({
6
+ __name: "ImageView",
7
+ props: {
8
+ selectedResult: {}
9
+ },
10
+ setup(e) {
11
+ return (n, l) => (a(), s("div", m, [
12
+ t("div", d, [
13
+ t("div", u, [
14
+ t("img", {
15
+ src: e.selectedResult.data?.imageData,
16
+ class: "max-w-full max-h-full object-contain rounded",
17
+ alt: "Current generated image"
18
+ }, null, 8, f)
19
+ ]),
20
+ e.selectedResult.data?.prompt ? (a(), s("div", g, [
21
+ t("p", _, [
22
+ l[0] || (l[0] = t("span", { class: "font-medium" }, "Prompt:", -1)),
23
+ o(" " + i(e.selectedResult.data.prompt), 1)
24
+ ])
25
+ ])) : c("", !0)
26
+ ])
27
+ ]));
28
+ }
29
+ }), x = { class: "min-h-[100px] flex items-center justify-center" }, h = ["src"], p = {
30
+ key: 1,
31
+ class: "text-gray-400 text-sm"
32
+ }, w = /* @__PURE__ */ r({
33
+ __name: "ImagePreview",
34
+ props: {
35
+ result: {}
36
+ },
37
+ setup(e) {
38
+ return (n, l) => (a(), s("div", x, [
39
+ e.result.data?.imageData ? (a(), s("img", {
40
+ key: 0,
41
+ src: e.result.data.imageData,
42
+ class: "max-w-full h-auto rounded",
43
+ alt: "Generated image"
44
+ }, null, 8, h)) : (a(), s("div", p, "No image yet"))
45
+ ]));
46
+ }
47
+ });
48
+ export {
49
+ w as ImagePreview,
50
+ v as ImageView
51
+ };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Image UI Component Types
3
+ */
4
+ /**
5
+ * Data structure for image tool results
6
+ */
7
+ export interface ImageToolData {
8
+ imageData: string;
9
+ prompt?: string;
10
+ }
11
+ /**
12
+ * Minimal ToolResult interface for view components
13
+ */
14
+ export interface ToolResult<T = unknown> {
15
+ toolName?: string;
16
+ message: string;
17
+ data?: T;
18
+ }
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@mulmochat-plugin/ui-image",
3
+ "version": "0.1.0",
4
+ "description": "Shared image UI components for MulmoChat plugins",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "dev": "vite",
21
+ "build": "vite build && vue-tsc -p tsconfig.build.json --emitDeclarationOnly",
22
+ "typecheck": "vue-tsc --noEmit",
23
+ "lint": "eslint src"
24
+ },
25
+ "peerDependencies": {
26
+ "vue": "^3.5.0"
27
+ },
28
+ "devDependencies": {
29
+ "@tailwindcss/vite": "^4.1.18",
30
+ "@typescript-eslint/eslint-plugin": "^8.53.0",
31
+ "@typescript-eslint/parser": "^8.53.0",
32
+ "@vitejs/plugin-vue": "^6.0.3",
33
+ "eslint": "^9.39.2",
34
+ "eslint-plugin-vue": "^10.6.2",
35
+ "globals": "^17.0.0",
36
+ "tailwindcss": "^4.1.18",
37
+ "typescript": "~5.9.3",
38
+ "vite": "^7.3.1",
39
+ "vue": "^3.5.26",
40
+ "vue-eslint-parser": "^10.2.0",
41
+ "vue-tsc": "^3.2.2"
42
+ },
43
+ "keywords": [
44
+ "mulmochat",
45
+ "plugin",
46
+ "ui",
47
+ "image"
48
+ ],
49
+ "license": "MIT"
50
+ }