@particle-academy/fancy-flow 0.9.0 → 0.10.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.
@@ -2,7 +2,7 @@ import { a as NodeKindDefinition, P as PortSpec } from '../types-DKqaUjF_.cjs';
2
2
  export { C as ConfigField, b as CredentialConfigField, D as DocumentConfigField, E as ExpressionConfigField, J as JsonConfigField, K as KeyValueConfigField, N as NodeCategory, c as NumberConfigField, R as RenderBodyContext, d as RepeaterConfigField, e as RepeaterRowField, S as SelectConfigField, f as SwitchConfigField, T as TextConfigField, g as TextareaConfigField } from '../types-DKqaUjF_.cjs';
3
3
  import { F as FlowNode, P as PortDescriptor } from '../types-BS3Gwnkq.cjs';
4
4
  import * as react from 'react';
5
- import { ReactNode } from 'react';
5
+ import { ComponentType, ReactNode } from 'react';
6
6
  import { NodeProps, NodeTypes } from '@xyflow/react';
7
7
 
8
8
  /**
@@ -45,31 +45,30 @@ declare function resolveNodePorts(node: Pick<FlowNode, "data">, kind?: Pick<Node
45
45
  };
46
46
 
47
47
  /**
48
- * Rich user input — the adapter seam.
48
+ * Rich user input — the injection point.
49
49
  *
50
50
  * `rich_user_input` pauses a run on a fully authored page (long-form content,
51
51
  * required reading + confirmation, multi-section forms) rather than a flat
52
- * field list. Authoring and rendering that document needs a document model
53
- * (fancy-cms Stages) and a device frame for the preview (react-fancy's
54
- * FauxClient) — neither of which fancy-flow depends on.
52
+ * field list. That page IS a fancy-cms document fancy-flow defines no
53
+ * document schema of its own and never re-implements one.
55
54
  *
56
- * So the host registers them once, and the node lights up:
55
+ * The wiring ships in the box. Import the subpath once and the node lights up:
57
56
  *
58
- * ```tsx
59
- * import { FauxClient } from "@particle-academy/react-fancy";
60
- * import { StagesViewer } from "@particle-academy/fancy-cms-ui";
61
- * import { registerRichInputAdapter } from "@particle-academy/fancy-flow";
62
- *
63
- * registerRichInputAdapter({
64
- * FauxClient,
65
- * renderDocument: (doc) => <StagesViewer doc={doc} />,
66
- * });
57
+ * ```ts
58
+ * import "@particle-academy/fancy-flow/rich-input";
67
59
  * ```
68
60
  *
69
- * Until then the node still registers and still round-trips its config it
70
- * just renders an "unavailable" body explaining what to install. Keeping the
71
- * dependency optional is deliberate: fancy-cms is an early-release beta, and a
72
- * workflow editor should not hard-require a CMS to draw a canvas.
61
+ * That module registers fancy-cms's `PageDoc` + `CmsPage` renderer + `Editor`
62
+ * against this seam. It lives on a separate entry so `@particle-academy/
63
+ * fancy-cms-ui` and `@particle-academy/react-fancy` stay OPTIONAL peers — most
64
+ * flows never use a rich input, and a workflow editor should not drag a CMS
65
+ * into every install.
66
+ *
67
+ * The seam stays public so a host can substitute a different document engine,
68
+ * but that is the escape hatch, not the expected path.
69
+ *
70
+ * Until something registers, the node still registers and still round-trips
71
+ * its config — it renders a "how to enable" body rather than an empty card.
73
72
  */
74
73
  type RichInputAdapter = {
75
74
  /**
@@ -77,11 +76,13 @@ type RichInputAdapter = {
77
76
  * frame that mimics a browser window or device and scales its content down
78
77
  * to fit. Used to preview the authored page inside the node card.
79
78
  */
80
- FauxClient?: (props: {
81
- variant?: "browser" | "device" | "bare";
82
- children?: ReactNode;
83
- [key: string]: unknown;
84
- }) => ReactNode;
79
+ FauxClient?: ComponentType<any>;
80
+ /**
81
+ * Props for the frame — e.g. `{ variant: "browser", width: 1280, scale: "fit" }`
82
+ * so a full-width page renders at its real width and scales down into the
83
+ * node card instead of reflowing to a cramped layout that misrepresents it.
84
+ */
85
+ frameProps?: Record<string, unknown>;
85
86
  /** Render the stored document read-only, for the in-node preview. */
86
87
  renderDocument?: (doc: unknown) => ReactNode;
87
88
  /** Editor mounted in the config panel via `renderDocumentField`. */
@@ -2,7 +2,7 @@ import { a as NodeKindDefinition, P as PortSpec } from '../types-BocBFh6l.js';
2
2
  export { C as ConfigField, b as CredentialConfigField, D as DocumentConfigField, E as ExpressionConfigField, J as JsonConfigField, K as KeyValueConfigField, N as NodeCategory, c as NumberConfigField, R as RenderBodyContext, d as RepeaterConfigField, e as RepeaterRowField, S as SelectConfigField, f as SwitchConfigField, T as TextConfigField, g as TextareaConfigField } from '../types-BocBFh6l.js';
3
3
  import { F as FlowNode, P as PortDescriptor } from '../types-BS3Gwnkq.js';
4
4
  import * as react from 'react';
5
- import { ReactNode } from 'react';
5
+ import { ComponentType, ReactNode } from 'react';
6
6
  import { NodeProps, NodeTypes } from '@xyflow/react';
7
7
 
8
8
  /**
@@ -45,31 +45,30 @@ declare function resolveNodePorts(node: Pick<FlowNode, "data">, kind?: Pick<Node
45
45
  };
46
46
 
47
47
  /**
48
- * Rich user input — the adapter seam.
48
+ * Rich user input — the injection point.
49
49
  *
50
50
  * `rich_user_input` pauses a run on a fully authored page (long-form content,
51
51
  * required reading + confirmation, multi-section forms) rather than a flat
52
- * field list. Authoring and rendering that document needs a document model
53
- * (fancy-cms Stages) and a device frame for the preview (react-fancy's
54
- * FauxClient) — neither of which fancy-flow depends on.
52
+ * field list. That page IS a fancy-cms document fancy-flow defines no
53
+ * document schema of its own and never re-implements one.
55
54
  *
56
- * So the host registers them once, and the node lights up:
55
+ * The wiring ships in the box. Import the subpath once and the node lights up:
57
56
  *
58
- * ```tsx
59
- * import { FauxClient } from "@particle-academy/react-fancy";
60
- * import { StagesViewer } from "@particle-academy/fancy-cms-ui";
61
- * import { registerRichInputAdapter } from "@particle-academy/fancy-flow";
62
- *
63
- * registerRichInputAdapter({
64
- * FauxClient,
65
- * renderDocument: (doc) => <StagesViewer doc={doc} />,
66
- * });
57
+ * ```ts
58
+ * import "@particle-academy/fancy-flow/rich-input";
67
59
  * ```
68
60
  *
69
- * Until then the node still registers and still round-trips its config it
70
- * just renders an "unavailable" body explaining what to install. Keeping the
71
- * dependency optional is deliberate: fancy-cms is an early-release beta, and a
72
- * workflow editor should not hard-require a CMS to draw a canvas.
61
+ * That module registers fancy-cms's `PageDoc` + `CmsPage` renderer + `Editor`
62
+ * against this seam. It lives on a separate entry so `@particle-academy/
63
+ * fancy-cms-ui` and `@particle-academy/react-fancy` stay OPTIONAL peers — most
64
+ * flows never use a rich input, and a workflow editor should not drag a CMS
65
+ * into every install.
66
+ *
67
+ * The seam stays public so a host can substitute a different document engine,
68
+ * but that is the escape hatch, not the expected path.
69
+ *
70
+ * Until something registers, the node still registers and still round-trips
71
+ * its config — it renders a "how to enable" body rather than an empty card.
73
72
  */
74
73
  type RichInputAdapter = {
75
74
  /**
@@ -77,11 +76,13 @@ type RichInputAdapter = {
77
76
  * frame that mimics a browser window or device and scales its content down
78
77
  * to fit. Used to preview the authored page inside the node card.
79
78
  */
80
- FauxClient?: (props: {
81
- variant?: "browser" | "device" | "bare";
82
- children?: ReactNode;
83
- [key: string]: unknown;
84
- }) => ReactNode;
79
+ FauxClient?: ComponentType<any>;
80
+ /**
81
+ * Props for the frame — e.g. `{ variant: "browser", width: 1280, scale: "fit" }`
82
+ * so a full-width page renders at its real width and scales down into the
83
+ * node card instead of reflowing to a cramped layout that misrepresents it.
84
+ */
85
+ frameProps?: Record<string, unknown>;
85
86
  /** Render the stored document read-only, for the in-node preview. */
86
87
  renderDocument?: (doc: unknown) => ReactNode;
87
88
  /** Editor mounted in the config panel via `renderDocumentField`. */
package/dist/registry.cjs CHANGED
@@ -60,15 +60,14 @@ function RichInputPreview({ config }) {
60
60
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ff-rich-preview", children: [
61
61
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ff-rich-preview__title", children: title }),
62
62
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ff-rich-preview__unavailable", children: [
63
- "Needs a document adapter. Install",
64
- " ",
63
+ "Add ",
65
64
  /* @__PURE__ */ jsxRuntime.jsx("code", { children: "@particle-academy/fancy-cms-ui" }),
66
65
  " +",
67
66
  " ",
68
67
  /* @__PURE__ */ jsxRuntime.jsx("code", { children: "@particle-academy/react-fancy" }),
69
- ", then call",
68
+ ", then",
70
69
  " ",
71
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: "registerRichInputAdapter()" }),
70
+ /* @__PURE__ */ jsxRuntime.jsx("code", { children: 'import "@particle-academy/fancy-flow/rich-input"' }),
72
71
  "."
73
72
  ] })
74
73
  ] });
@@ -77,7 +76,7 @@ function RichInputPreview({ config }) {
77
76
  const Frame = a.FauxClient;
78
77
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ff-rich-preview", children: [
79
78
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ff-rich-preview__title", children: title }),
80
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ff-rich-preview__frame", children: Frame ? /* @__PURE__ */ jsxRuntime.jsx(Frame, { variant: "browser", children: body }) : body })
79
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ff-rich-preview__frame", children: Frame ? /* @__PURE__ */ jsxRuntime.jsx(Frame, { ...a.frameProps ?? { variant: "browser" }, children: body }) : body })
81
80
  ] });
82
81
  }
83
82