@particle-academy/fancy-flow 0.64.0 → 0.65.1

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 CHANGED
@@ -215,6 +215,22 @@ rather than dropped:
215
215
  { type: "text", key: "tier", label: "Tier", choices: [{ value: "p1", label: "Priority 1" }] }
216
216
  ```
217
217
 
218
+ A host whose runtime owns selected values can hide those authoring controls
219
+ without replacing the panel or redefining the node kind. `fieldFilter` is
220
+ forwarded by `FlowEditor` and receives the selected node, its resolved kind,
221
+ and each schema field. Returning `false` removes the field's label,
222
+ description, control, and built-in validation messages; it does not mutate the
223
+ registered schema or runtime validation:
224
+
225
+ ```tsx
226
+ <FlowEditor
227
+ fieldFilter={({ kind, field }) =>
228
+ kind.name !== "@particle-academy/llm_call"
229
+ || !["provider", "model", "credential"].includes(field.key)
230
+ }
231
+ />
232
+ ```
233
+
218
234
  ### Ports that follow config
219
235
 
220
236
  `inputs` / `outputs` accept a function of the node's config, for kinds whose
package/dist/index.cjs CHANGED
@@ -13960,6 +13960,7 @@ function NodeConfigPanel({
13960
13960
  renderCredentialField,
13961
13961
  renderDocumentField,
13962
13962
  fieldRenderers,
13963
+ fieldFilter,
13963
13964
  graph,
13964
13965
  className,
13965
13966
  style: style2
@@ -14005,7 +14006,11 @@ function NodeConfigPanel({
14005
14006
  const setDescription = (description) => onChange({ ...node, data: { ...node.data, description } });
14006
14007
  const setStatusMsg = (key, value) => onChange({ ...node, data: { ...node.data, [key]: value } });
14007
14008
  const setConfigValue = (key, value) => onChange({ ...node, data: { ...node.data, config: { ...config, [key]: value } } });
14008
- const issues = validateConfig(kind, config);
14009
+ const configFields = (kind.configSchema ?? []).filter(
14010
+ (field) => fieldFilter ? fieldFilter({ node, kind, field }) : true
14011
+ );
14012
+ const visibleFieldKeys = new Set(configFields.map((field) => field.key));
14013
+ const issues = validateConfig(kind, config).filter((issue) => visibleFieldKeys.has(issue.key));
14009
14014
  const adapter2 = getRichInputAdapter();
14010
14015
  const documentField = renderDocumentField ?? (adapter2?.renderEditor ? ({ value, onChange: set3 }) => adapter2.renderEditor({ value, onChange: set3 }) : void 0);
14011
14016
  return /* @__PURE__ */ jsxRuntime.jsxs("aside", { className: ["ff-panel", className ?? ""].filter(Boolean).join(" "), style: style2, children: [
@@ -14081,8 +14086,8 @@ function NodeConfigPanel({
14081
14086
  onChange: (next) => onChange({ ...node, data: { ...node.data, config: next } }),
14082
14087
  nodeId: node.id
14083
14088
  }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14084
- (kind.configSchema ?? []).length > 0 && /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "ff-panel__divider" }),
14085
- (kind.configSchema ?? []).map((field) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ff-panel__field", children: [
14089
+ configFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "ff-panel__divider" }),
14090
+ configFields.map((field) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ff-panel__field", children: [
14086
14091
  /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "ff-panel__label", htmlFor: fieldId(field.key), children: [
14087
14092
  field.label,
14088
14093
  field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ff-panel__required", "aria-hidden": true, children: " *" })
@@ -14990,6 +14995,7 @@ function FlowEditorInner({
14990
14995
  showPalette = true,
14991
14996
  showPanel = true,
14992
14997
  fieldRenderers,
14998
+ fieldFilter,
14993
14999
  showFeed = true,
14994
15000
  extraToolbar,
14995
15001
  actions = [],
@@ -15558,6 +15564,7 @@ function FlowEditorInner({
15558
15564
  node: api.selected,
15559
15565
  onChange: api.updateNode,
15560
15566
  fieldRenderers,
15567
+ fieldFilter,
15561
15568
  graph: flow,
15562
15569
  onDelete: builtins.delete === false ? void 0 : (n) => api.deleteNodes([n.id])
15563
15570
  }