@particle-academy/fancy-flow 0.64.0 → 0.65.0

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,21 @@ 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, and control; it does not mutate the registered schema:
223
+
224
+ ```tsx
225
+ <FlowEditor
226
+ fieldFilter={({ kind, field }) =>
227
+ kind.name !== "@particle-academy/llm_call"
228
+ || !["provider", "model", "credential"].includes(field.key)
229
+ }
230
+ />
231
+ ```
232
+
218
233
  ### Ports that follow config
219
234
 
220
235
  `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
@@ -14006,6 +14007,9 @@ function NodeConfigPanel({
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
14009
  const issues = validateConfig(kind, config);
14010
+ const configFields = (kind.configSchema ?? []).filter(
14011
+ (field) => fieldFilter ? fieldFilter({ node, kind, field }) : true
14012
+ );
14009
14013
  const adapter2 = getRichInputAdapter();
14010
14014
  const documentField = renderDocumentField ?? (adapter2?.renderEditor ? ({ value, onChange: set3 }) => adapter2.renderEditor({ value, onChange: set3 }) : void 0);
14011
14015
  return /* @__PURE__ */ jsxRuntime.jsxs("aside", { className: ["ff-panel", className ?? ""].filter(Boolean).join(" "), style: style2, children: [
@@ -14081,8 +14085,8 @@ function NodeConfigPanel({
14081
14085
  onChange: (next) => onChange({ ...node, data: { ...node.data, config: next } }),
14082
14086
  nodeId: node.id
14083
14087
  }) : /* @__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: [
14088
+ configFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "ff-panel__divider" }),
14089
+ configFields.map((field) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ff-panel__field", children: [
14086
14090
  /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "ff-panel__label", htmlFor: fieldId(field.key), children: [
14087
14091
  field.label,
14088
14092
  field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ff-panel__required", "aria-hidden": true, children: " *" })
@@ -14990,6 +14994,7 @@ function FlowEditorInner({
14990
14994
  showPalette = true,
14991
14995
  showPanel = true,
14992
14996
  fieldRenderers,
14997
+ fieldFilter,
14993
14998
  showFeed = true,
14994
14999
  extraToolbar,
14995
15000
  actions = [],
@@ -15558,6 +15563,7 @@ function FlowEditorInner({
15558
15563
  node: api.selected,
15559
15564
  onChange: api.updateNode,
15560
15565
  fieldRenderers,
15566
+ fieldFilter,
15561
15567
  graph: flow,
15562
15568
  onDelete: builtins.delete === false ? void 0 : (n) => api.deleteNodes([n.id])
15563
15569
  }