@bian-womp/spark-workbench 0.3.44 → 0.3.46

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Inspector.d.ts","sourceRoot":"","sources":["../../../../src/misc/Inspector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAYhE,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EACrB,QAAQ,EACR,YAAY,EACZ,QAAQ,GACT,EAAE;IACD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1C,qBAAqB,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,KAAK,MAAM,CAAC;IACvD,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CACxE,2CAwwBA"}
1
+ {"version":3,"file":"Inspector.d.ts","sourceRoot":"","sources":["../../../../src/misc/Inspector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAehE,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EACrB,QAAQ,EACR,YAAY,EACZ,QAAQ,GACT,EAAE;IACD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1C,qBAAqB,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,KAAK,MAAM,CAAC;IACvD,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CACxE,2CA+xBA"}
package/lib/esm/index.js CHANGED
@@ -5329,6 +5329,13 @@ function Inspector({ debug, autoScroll, hideWorkbench, onAutoScrollChange, onHid
5329
5329
  return String(value ?? "");
5330
5330
  }
5331
5331
  };
5332
+ const unwrapForDisplay = (declaredTypeId, value) => {
5333
+ if (isTyped(value)) {
5334
+ const t = unwrapTypeId(value) ?? declaredTypeId;
5335
+ return { typeId: t, value: unwrapValue(value) };
5336
+ }
5337
+ return { typeId: declaredTypeId, value };
5338
+ };
5332
5339
  const { wb, registryVersion, selectedNodeId, selectedEdgeId, inputsMap, inputDefaultsMap, outputsMap, outputTypesMap, nodeStatus, edgeStatus, validationByNode, validationByEdge, validationGlobal, valuesTick, updateEdgeType, systemErrors, registryErrors, inputValidationErrors, clearSystemErrors, clearRegistryErrors, clearInputValidationErrors, removeSystemError, removeRegistryError, removeInputValidationError, handlesMap, } = useWorkbenchContext();
5333
5340
  const nodeValidationIssues = validationByNode.issues;
5334
5341
  const edgeValidationIssues = validationByEdge.issues;
@@ -5458,7 +5465,8 @@ function Inspector({ debug, autoScroll, hideWorkbench, onAutoScrollChange, onHid
5458
5465
  for (const h of handles) {
5459
5466
  const typeId = getInputTypeId(effectiveHandles.inputs, h);
5460
5467
  const current = nodeInputs[h];
5461
- const display = safeToString(typeId, current);
5468
+ const { typeId: displayTypeId, value: displayValue } = unwrapForDisplay(typeId, current);
5469
+ const display = safeToString(displayTypeId, displayValue);
5462
5470
  const wasOriginal = originals[h];
5463
5471
  const isDirty = drafts[h] !== undefined &&
5464
5472
  wasOriginal !== undefined &&
@@ -5510,18 +5518,19 @@ function Inspector({ debug, autoScroll, hideWorkbench, onAutoScrollChange, onHid
5510
5518
  .filter((e) => e.target.nodeId === selectedNodeId &&
5511
5519
  e.target.handle === h)
5512
5520
  .map((e) => e.target.handle));
5521
+ const { typeId: defaultTypeId, value: defaultValue } = unwrapForDisplay(typeId, nodeInputsDefaults[h]);
5513
5522
  const hasDefault = !inbound.has(h) && nodeInputsDefaults[h] !== undefined;
5514
5523
  const defaultStr = hasDefault
5515
- ? safeToString(typeId, nodeInputsDefaults[h])
5524
+ ? safeToString(defaultTypeId, defaultValue)
5516
5525
  : undefined;
5517
5526
  const commonProps = {
5518
5527
  style: { flex: 1 },
5519
5528
  disabled: isLinked,
5520
5529
  };
5521
5530
  const current = nodeInputs[h];
5522
- const hasValue = current !== undefined && current !== null;
5523
- const value = drafts[h] ?? safeToString(typeId, current);
5524
- const displayValue = value;
5531
+ const { typeId: displayTypeId, value: displayValue } = unwrapForDisplay(typeId, current);
5532
+ const hasValue = displayValue !== undefined && displayValue !== null;
5533
+ const value = drafts[h] ?? safeToString(displayTypeId, displayValue);
5525
5534
  const placeholder = hasDefault ? defaultStr : undefined;
5526
5535
  const onChangeText = (text) => setDrafts((d) => ({ ...d, [h]: text }));
5527
5536
  const commit = () => {
@@ -5547,7 +5556,7 @@ function Inspector({ debug, autoScroll, hideWorkbench, onAutoScrollChange, onHid
5547
5556
  setDrafts((d) => ({ ...d, [h]: "" }));
5548
5557
  setOriginals((o) => ({ ...o, [h]: "" }));
5549
5558
  };
5550
- const isEnum = typeId?.startsWith("enum:");
5559
+ const isEnum = displayTypeId?.startsWith("enum:");
5551
5560
  const inIssues = selectedNodeHandleValidation.inputs.filter((m) => m.handle === h);
5552
5561
  const hasValidation = inIssues.length > 0;
5553
5562
  const hasErr = inIssues.some((m) => m.level === "error");
@@ -5568,9 +5577,9 @@ function Inspector({ debug, autoScroll, hideWorkbench, onAutoScrollChange, onHid
5568
5577
  ? `Default: ${placeholder}`
5569
5578
  : "(select)" }), wb.registry.enums
5570
5579
  .get(typeId)
5571
- ?.options.map((opt) => (jsx("option", { value: String(opt.value), children: opt.label }, opt.value)))] }), hasValue && !isLinked && (jsx("button", { className: "flex-shrink-0 p-1 hover:bg-gray-100 rounded text-gray-500 hover:text-gray-700", onClick: clearInput, title: "Clear input value", children: jsx(XCircleIcon, { size: 16 }) }))] })) : isLinked ? (jsx("div", { className: "flex items-center gap-1 flex-1", children: jsx("div", { className: "flex-1 min-w-0", children: renderLinkedInputDisplay(typeId, current) }) })) : (jsxs("div", { className: "flex items-center gap-1 flex-1", children: [jsx("input", { className: "border border-gray-300 rounded px-2 py-1 focus:outline-none focus:ring-2 focus:ring-blue-500 flex-1 select-text", placeholder: placeholder
5580
+ ?.options.map((opt) => (jsx("option", { value: String(opt.value), children: opt.label }, opt.value)))] }), hasValue && !isLinked && (jsx("button", { className: "flex-shrink-0 p-1 hover:bg-gray-100 rounded text-gray-500 hover:text-gray-700", onClick: clearInput, title: "Clear input value", children: jsx(XCircleIcon, { size: 16 }) }))] })) : isLinked ? (jsx("div", { className: "flex items-center gap-1 flex-1", children: jsx("div", { className: "flex-1 min-w-0", children: renderLinkedInputDisplay(displayTypeId, displayValue) }) })) : (jsxs("div", { className: "flex items-center gap-1 flex-1", children: [jsx("input", { className: "border border-gray-300 rounded px-2 py-1 focus:outline-none focus:ring-2 focus:ring-blue-500 flex-1 select-text", placeholder: placeholder
5572
5581
  ? `Default: ${placeholder}`
5573
- : undefined, value: displayValue, onChange: (e) => onChangeText(e.target.value), onBlur: commit, onKeyDown: (e) => {
5582
+ : undefined, value: value, onChange: (e) => onChangeText(e.target.value), onBlur: commit, onKeyDown: (e) => {
5574
5583
  if (e.key === "Enter")
5575
5584
  commit();
5576
5585
  if (e.key === "Escape")