From 603223741ac89fda7096898fc8a3bb6b00ae5ee2 Mon Sep 17 00:00:00 2001 From: bennykok Date: Wed, 13 Nov 2024 17:24:11 +0900 Subject: [PATCH] feat: tweak ui styles --- web-plugin/index.js | 57 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/web-plugin/index.js b/web-plugin/index.js index fdeeb44..c27d9e2 100644 --- a/web-plugin/index.js +++ b/web-plugin/index.js @@ -4,6 +4,39 @@ import { ComfyWidgets, LGraphNode } from "./widgets.js"; import { generateDependencyGraph } from "https://esm.sh/comfyui-json@0.1.25"; import { ComfyDeploy } from "https://esm.sh/comfydeploy@0.0.19-beta.30"; +const styles = ` +.comfydeploy-menu-item { + background: linear-gradient(to right, rgba(74, 144, 226, 0.9), rgba(103, 178, 111, 0.9)) !important; + color: white !important; + position: relative !important; + padding-left: 20px !important; +} + +.comfydeploy-menu-item:hover { + filter: brightness(1.1) !important; + cursor: pointer !important; +} + +.comfydeploy-menu-item::before { + content: ''; + position: absolute; + left: 4px; + top: 50%; + transform: translateY(-50%); + width: 12px; + height: 12px; + background-image: url('https://www.comfydeploy.com/icon.svg'); + background-size: contain; + background-repeat: no-repeat; + background-position: center; +} +`; + +// Add stylesheet to document +const styleSheet = document.createElement("style"); +styleSheet.textContent = styles; +document.head.appendChild(styleSheet); + const loadingIcon = ``; function sendEventToCD(event, data) { @@ -188,15 +221,14 @@ function convertToInput(node, widget, config) { console.log(app.graph); app.graph.add(inputNode); - const links = app.graph.links + const links = app.graph.links; console.log(links); - currentOutputsLinks.forEach((link) => { - const llink = links[link] + const llink = links[link]; console.log(links[link]); - inputNode.connect(0, llink.target_id, llink.target_slot) + inputNode.connect(0, llink.target_id, llink.target_slot); // const link = graph.links[link]; // console.log(link); // inputNode.connect(0, ) @@ -398,11 +430,12 @@ const ext = { ]; if (isConvertibleWidget(w, config)) { toInput.push({ - content: `Convert ${w.name} to input`, + content: `Convert ${w.name} to external input`, callback: /* @__PURE__ */ __name( () => convertToInput(this, w, config), "callback", ), + className: "comfydeploy-menu-item", }); } } @@ -417,12 +450,14 @@ const ext = { options.splice( 0, 0, - { - content: "[ComfyDeploy] Convert to External Input", - submenu: { - options: toInput, - }, - }, + // { + // content: "[ComfyDeploy] Convert to External Input", + // submenu: { + // options: toInput, + // }, + // className: "comfydeploy-menu-item" + // }, + ...toInput, null, ); } else {