poruqe no puedo acceder al preview desde un ID.preview por ejemplo?




import { app } from "../../scripts/app.js";
import { ComfyWidgets } from "../../scripts/widgets.js";

app.registerExtension({
    name: "AlphaPreview",
    async beforeRegisterNodeDef(nodeType, nodeData, app) {
        const NODES_WITH_PREVIEW = ["AlphaAny", "AlphaTextCalc", "AlphaTextCopy", "AlphaTextSelector"];
        if (!NODES_WITH_PREVIEW.includes(nodeData.name)) return;
        const originalOnNodeCreated = nodeType.prototype.onNodeCreated;
        nodeType.prototype.onNodeCreated = function () {
            if (originalOnNodeCreated) originalOnNodeCreated.apply(this, []);
            this.previewWidget = ComfyWidgets.STRING(this, "preview", ["STRING", { multiline: true }], app).widget;
            this.previewWidget.inputEl.readOnly = true;
            this.previewWidget.inputEl.style.opacity = 0.6;
            this.previewWidget.inputEl.style.fontSize = "0.8em";
            this.previewWidget.value = "";
            this.previewWidget.serializeValue = () => "";
        };
        const originalOnExecuted = nodeType.prototype.onExecuted;
        nodeType.prototype.onExecuted = function (message) {
            if (originalOnExecuted) originalOnExecuted.apply(this, [message]);
            if (message?.text?.[0]) this.previewWidget.value = message.text[0];
        };
    },
});
from datetime import datetime
import re

class ALL(str):
    def __ne__(self, __value: object) -> bool:
        return False

class AlphaTextCopy:
    @classmethod
    def INPUT_TYPES(cls):
        return {
            "required": {"ID": ("STRING", {"default": "", "multiline": False})},
            "hidden": {"UpDate": "PROMPT"}
        }

    RETURN_TYPES = (ALL("*"),)
    RETURN_NAMES = ("Out",)
    FUNCTION = "COPYTEXT"
    CATEGORY = "🔻 AlphaNodes"
    OUTPUT_NODE = True

    def COPYTEXT(self, ID, UpDate=None):
        self.Label = ""
        now = datetime.now()

        def format_date(code):
            map = {
                "Y": now.strftime("%Y"),
                "M": now.strftime("%m"),
                "D": now.strftime("%d"),
                "h": now.strftime("%H"),
                "m": now.strftime("%M"),
                "s": now.strftime("%S")
            }
            return "".join(map.get(c, "") for c in code)

        def get_value(single_id):
            try:
                if single_id.startswith("%") and single_id.endswith("%"):
                    return format_date(single_id[1:-1])
                if "." not in single_id:
                    return single_id if single_id else ""
                Id, Field = single_id.split(".", 1)
                if not UpDate or Id not in UpDate:
                    return "Error ID " + Id + " not found"
                NodeF = UpDate[Id]
                if Field not in NodeF.get("inputs", {}):
                    return "Error Field " + Field + " not found"
                return str(NodeF["inputs"][Field])
            except Exception as e:
                return "Error " + str(e)

        if not ID.strip():
            self.Label = ""
        else:
            parts = re.split(r"[ ,\-_+]+", ID.strip())
            separators = re.findall(r"[ ,\-_+]+", ID.strip()) + [""]
            concat_result = ""
            for i, p in enumerate(parts):
                val = get_value(p)
                sep = separators[i] if i < len(separators) else ""
                if sep == "+": sep = ""
                concat_result += val + sep
            self.Label = concat_result

        return {"ui": {"text": [self.Label + " "]}, "result": (self.Label,)}

    @classmethod
    def IS_CHANGED(cls, *args, **kwargs):
        return float("NaN")