html-overlay-node 0.1.10 → 0.1.11

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.
@@ -111,7 +111,7 @@ export class HtmlOverlay {
111
111
  const def = this.registry.types.get(node.type);
112
112
 
113
113
  // render 함수가 있거나, html 설정 객체가 있으면 처리
114
- const hasHtml = !!(def?.html);
114
+ const hasHtml = !!def?.html;
115
115
  if (!hasHtml) continue;
116
116
 
117
117
  const el = this._ensureNodeElement(node, def, graph);
@@ -130,13 +130,16 @@ export class HtmlOverlay {
130
130
  def.html.update(node, el, {
131
131
  selected: selection.has(node.id),
132
132
  header: parts.header,
133
- body: parts.body
133
+ body: parts.body,
134
134
  });
135
135
  }
136
136
 
137
137
  seen.add(node.id);
138
138
  }
139
139
 
140
+ // ── Interactive Stepping Play Button ─────────────────────
141
+ this._drawStepOverlay(graph);
142
+
140
143
  // 없어진 노드 제거
141
144
  for (const [id, el] of this.nodes) {
142
145
  if (!seen.has(id)) {
@@ -146,6 +149,65 @@ export class HtmlOverlay {
146
149
  }
147
150
  }
148
151
 
152
+ _drawStepOverlay(graph) {
153
+ const runner = graph.runner;
154
+ if (!runner || runner.executionMode !== "step" || !runner.activePlan) {
155
+ if (this._stepBtn) {
156
+ this._stepBtn.style.display = "none";
157
+ }
158
+ return;
159
+ }
160
+
161
+ const nextStep = runner.activePlan[runner.activeStepIndex];
162
+ if (!nextStep) {
163
+ if (this._stepBtn) this._stepBtn.style.display = "none";
164
+ return;
165
+ }
166
+
167
+ const node = graph.nodes.get(nextStep.nodeId);
168
+ if (!node) return;
169
+
170
+ if (!this._stepBtn) {
171
+ this._stepBtn = document.createElement("button");
172
+ this._stepBtn.className = "step-play-button";
173
+ this._stepBtn.innerHTML = "▶";
174
+ Object.assign(this._stepBtn.style, {
175
+ position: "absolute",
176
+ zIndex: "100",
177
+ width: "20px",
178
+ height: "20px",
179
+ borderRadius: "4px",
180
+ border: "none",
181
+ background: "transparent",
182
+ color: "white",
183
+ fontSize: "12px",
184
+ cursor: "pointer",
185
+ display: "flex",
186
+ alignItems: "center",
187
+ justifyContent: "center",
188
+ // boxShadow: "0 2px 6px rgba(0,0,0,0.3)",
189
+ pointerEvents: "auto",
190
+ transition: "transform 0.1s, background 0.2s",
191
+ });
192
+ this._stepBtn.addEventListener("mouseover", () => {
193
+ this._stepBtn.style.transform = "scale(1)";
194
+ });
195
+ this._stepBtn.addEventListener("mouseout", () => {
196
+ this._stepBtn.style.transform = "scale(1)";
197
+ });
198
+ this._stepBtn.addEventListener("click", (e) => {
199
+ e.stopPropagation();
200
+ runner.executeNextStep();
201
+ });
202
+ this.container.appendChild(this._stepBtn);
203
+ }
204
+
205
+ // Position the button in the top-right corner of the node (header area)
206
+ this._stepBtn.style.display = "flex";
207
+ this._stepBtn.style.left = `${node.computed.x + node.computed.w - 26}px`;
208
+ this._stepBtn.style.top = `${node.computed.y + 2}px`;
209
+ }
210
+
149
211
  /**
150
212
  * Sync container transform with renderer state (lightweight update)
151
213
  * Called when zoom/pan occurs without needing full redraw
@@ -59,7 +59,7 @@ export class HelpOverlay {
59
59
  // Create Toggle Button
60
60
  this.toggleBtn = document.createElement("div");
61
61
  this.toggleBtn.id = "helpToggle";
62
- this.toggleBtn.title = "Keyboard shortcuts (?)";
62
+ this.toggleBtn.title = "단축키 (?)";
63
63
  this.toggleBtn.textContent = "?";
64
64
  this.container.appendChild(this.toggleBtn);
65
65