@w6w/ui 0.2.56 → 0.2.58

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/CallTargetForm.d.ts +10 -0
  3. package/dist/{CodeBlock-CymlfyeA.cjs → CodeBlock-BSX1pi6W.cjs} +2 -2
  4. package/dist/{CodeBlock-CymlfyeA.cjs.map → CodeBlock-BSX1pi6W.cjs.map} +1 -1
  5. package/dist/{CodeBlock-C-oIIYfC.js → CodeBlock-CPKXSNEs.js} +7 -3
  6. package/dist/{CodeBlock-C-oIIYfC.js.map → CodeBlock-CPKXSNEs.js.map} +1 -1
  7. package/dist/CodeEditor.d.ts +2 -0
  8. package/dist/JsonEditor.d.ts +1 -3
  9. package/dist/Markdown.d.ts +3 -1
  10. package/dist/StepBuilderModal.d.ts +11 -5
  11. package/dist/TriggerFillForm.d.ts +4 -3
  12. package/dist/TriggerSampleButton.d.ts +11 -0
  13. package/dist/WorkflowFlowEditor.d.ts +54 -0
  14. package/dist/YamlEditor.d.ts +1 -2
  15. package/dist/callable-fields.d.ts +4 -0
  16. package/dist/code.cjs +1 -1
  17. package/dist/code.mjs +1 -1
  18. package/dist/components/ConfirmModal.d.ts +7 -1
  19. package/dist/components/DataEntryList.d.ts +2 -0
  20. package/dist/components/ExpressionOptions.d.ts +2 -0
  21. package/dist/components/ResultViewer.d.ts +1 -2
  22. package/dist/condition-editor.d.ts +3 -1
  23. package/dist/connection-app-meta-CKTmUX08.cjs +24 -0
  24. package/dist/connection-app-meta-CKTmUX08.cjs.map +1 -0
  25. package/dist/{connection-app-meta-ZCPakGjD.js → connection-app-meta-D5hNbJB5.js} +7531 -6994
  26. package/dist/connection-app-meta-D5hNbJB5.js.map +1 -0
  27. package/dist/flow-history.d.ts +8 -0
  28. package/dist/flow.cjs +5 -4
  29. package/dist/flow.cjs.map +1 -1
  30. package/dist/flow.mjs +2216 -2103
  31. package/dist/flow.mjs.map +1 -1
  32. package/dist/index.cjs +2 -2
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.mjs +313 -305
  35. package/dist/index.mjs.map +1 -1
  36. package/dist/provider.d.ts +9 -0
  37. package/dist/state-shape.d.ts +13 -0
  38. package/dist/step-preview-state.d.ts +10 -1
  39. package/dist/types.d.ts +8 -0
  40. package/package.json +4 -1
  41. package/src/code.css +26 -1
  42. package/src/styles/_box-reset.scss +22 -0
  43. package/src/styles/_canvas.scss +1 -4
  44. package/src/styles/_chips.scss +0 -1
  45. package/src/styles/_code-editor.scss +16 -0
  46. package/src/styles/_copyable.scss +25 -1
  47. package/src/styles/_data-stores.scss +15 -5
  48. package/src/styles/_data-table.scss +6 -0
  49. package/src/styles/_data-vars.scss +21 -0
  50. package/src/styles/_execution-log.scss +3 -4
  51. package/src/styles/_fields.scss +57 -25
  52. package/src/styles/_flow.scss +11 -0
  53. package/src/styles/_fx.scss +14 -47
  54. package/src/styles/_host-guard.scss +100 -0
  55. package/src/styles/_step-builder.scss +4 -2
  56. package/src/styles/_step-config.scss +4 -5
  57. package/src/styles.css +226 -95
  58. package/src/styles.scss +2 -0
  59. package/dist/connection-app-meta-BEXlKBgV.cjs +0 -22
  60. package/dist/connection-app-meta-BEXlKBgV.cjs.map +0 -1
  61. package/dist/connection-app-meta-ZCPakGjD.js.map +0 -1
@@ -7,6 +7,8 @@ import { ThemeMode } from './types.ts';
7
7
  */
8
8
  export type ScriptLanguage = "javascript" | "typescript" | "python";
9
9
  export interface CodeEditorProps {
10
+ /** Copy the current source. Enabled by default. */
11
+ copyable?: boolean;
10
12
  value: string;
11
13
  onChange: (value: string) => void;
12
14
  /** Placeholder text shown when value is empty. */
@@ -53,9 +53,7 @@ export interface JsonEditorProps {
53
53
  * component's own `.w6w-json-editor` wrapper (sibling to the CodeMirror
54
54
  * mount — no extra DOM node). Copies the current `value` verbatim.
55
55
  *
56
- * Off by default: the other five `<JsonEditor>` mounts in this tree are
57
- * not step-JSON config views and must render byte-identically to before
58
- * this prop existed.
56
+ * On by default; disable only when the containing view supplies its own copy button.
59
57
  */
60
58
  copyable?: boolean;
61
59
  /**
@@ -1,5 +1,7 @@
1
1
  export interface MarkdownProps {
2
2
  content: string;
3
+ /** Copy the full Markdown source, including frontmatter. Enabled by default. */
4
+ copyable?: boolean;
3
5
  className?: string;
4
6
  }
5
7
  /**
@@ -22,4 +24,4 @@ export declare function splitFrontmatter(text: string): {
22
24
  * is dropped (`skipHtml`), images are not rendered, and links are protocol-allowlisted.
23
25
  * A leading YAML frontmatter block becomes a collapsed section above the body.
24
26
  */
25
- export declare function Markdown({ content, className }: MarkdownProps): import("react").JSX.Element;
27
+ export declare function Markdown({ content, className, copyable }: MarkdownProps): import("react").JSX.Element;
@@ -2,7 +2,7 @@ import { NodeConfig } from './NodeConfigForm.tsx';
2
2
  import { ExpressionLoopSource, ExpressionStepSource } from './components/ExpressionOptions.tsx';
3
3
  import { InternalNodeDef } from './flow-types.ts';
4
4
  import { StepStartState, W6WApi } from './provider.tsx';
5
- import { ActionDef, ActionParam, AppSummary, FunctionSummary, ThemeMode, WorkflowDetail, WorkflowSummary } from './types.ts';
5
+ import { ActionDef, ActionParam, AppSummary, FunctionSummary, ThemeMode, WorkflowSummary } from './types.ts';
6
6
  /** The step the builder emits — the editor assigns the final `id` unless `id` carries a
7
7
  * name the user chose in the add flow. `NodeConfig` carries the base settings (retry /
8
8
  * onError / notes) set on the Config view. */
@@ -20,7 +20,13 @@ export interface BuiltStep extends NodeConfig {
20
20
  with?: Record<string, unknown>;
21
21
  }
22
22
  export interface StepBuilderModalProps {
23
+ /** Cancel, × and Esc — and Done when `onDone` is not supplied. */
23
24
  onClose: () => void;
25
+ /**
26
+ * Done: the user finished configuring the added step. Lets a host tell Done from
27
+ * Cancel, so a cancelled add can be rolled back. Defaults to `onClose`.
28
+ */
29
+ onDone?: () => void;
24
30
  /**
25
31
  * Fired once per session, the moment the step first has identity — for an
26
32
  * app step, when Setup completes (action + connection, if needed); for a
@@ -192,7 +198,7 @@ export declare function ConfigViewToggle({ view, onChange, disabled, views, cust
192
198
  *
193
199
  * Data + IO come from `useW6WApi()`, so mount it under `<W6WUIProvider>`.
194
200
  */
195
- export declare function StepBuilderModal({ onClose, onAdd, onDraftChange, theme, appsOnly, callables, initialTab, title, workflowId, stepId, upstreamSteps, loop, initialApp, initialAction, initialConnection, initialWith, appsFilter, appsIds, connectionOnly, onConnected, excludeCallableIds, onOpenStep, stepIds, }: StepBuilderModalProps): import("react").JSX.Element;
201
+ export declare function StepBuilderModal({ onClose, onDone, onAdd, onDraftChange, theme, appsOnly, callables, initialTab, title, workflowId, stepId, upstreamSteps, loop, initialApp, initialAction, initialConnection, initialWith, appsFilter, appsIds, connectionOnly, onConnected, excludeCallableIds, onOpenStep, stepIds, }: StepBuilderModalProps): import("react").JSX.Element;
196
202
  /**
197
203
  * Config form for a chosen internal node — its schema rendered through the same
198
204
  * `ParamsForm` as app actions, seeded with the node's defaults. Emits the built
@@ -214,7 +220,7 @@ export declare function ControlStepConfig({ node: initialNode, onAdd, onClose, o
214
220
  /** See {@link StepBuilderModalProps.loop}. */
215
221
  loop?: ExpressionLoopSource;
216
222
  }): import("react").JSX.Element;
217
- export declare function triggerFieldsOf(wf: WorkflowDetail): ActionParam[];
223
+ export { triggerFieldsOf } from './callable-fields.ts';
218
224
  /**
219
225
  * Config → test → add flow for a picked Function/Workflow target (D-12,
220
226
  * D-15). Mints a single `@w6w/call` step — `family` only decides which
@@ -277,7 +283,8 @@ export declare function isTestRequired(surface: unknown): boolean;
277
283
  * fixture (`saveStepTest`) and records the run's outcome (`recordStepTestRun`)
278
284
  * against the given workflow step after each invoke. `input` is the resolved
279
285
  * incoming state captured alongside the params (`values` → `with`). Absent in
280
- * the add-step builder (the step isn't in a workflow yet).
286
+ * the add-step builder until the step is on the canvas: an app step lands on
287
+ * "Add", but a built-in node is committed the moment it is picked, so its Test saves.
281
288
  */
282
289
  export interface StepTestPersist {
283
290
  workflowId: string;
@@ -460,4 +467,3 @@ export declare function AppConnectionOnlyConfig({ appId, app, onClose, onChangeA
460
467
  /** Fired once, on the footer button — never on a state change (D-sbm-2). */
461
468
  onConnected: (connectionId: string, app: AppSummary) => void;
462
469
  }): import("react").JSX.Element;
463
- export {};
@@ -52,9 +52,10 @@ export declare function TriggerFillForm({ app, action, fields, persist, listen,
52
52
  /** The trigger's `fields` param value (an array of field definitions). */
53
53
  fields: unknown;
54
54
  /**
55
- * Where to remember the entered values. Absent in the add-step builder — that
56
- * step is not in a workflow yet, so there is no `(workflowId, stepId)` to key
57
- * a fixture by and this form neither reads nor writes one.
55
+ * Where to remember the entered values. Absent only where the trigger has no
56
+ * `(workflowId, stepId)` to key a fixture by (a builder with no canvas behind
57
+ * it); there this form neither reads nor writes one. The add-step builder
58
+ * passes it once the picked trigger is committed to the canvas.
58
59
  */
59
60
  persist?: StepTestPersist;
60
61
  /** Offer "Listen for test event" (webhook triggers in a saved workflow). */
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Fills the Run node payload with the sample event the app declares for this trigger, so the
3
+ * operator does not have to work out what the app will send. Renders nothing while the
4
+ * definition loads, when the fetch fails, and when the trigger declares no usable sample.
5
+ */
6
+ export declare function TriggerSampleButton({ app, trigger, onUse, }: {
7
+ app: string;
8
+ /** The trigger's key (`uses.action`). */
9
+ trigger: string;
10
+ onUse: (sample: Record<string, unknown>) => void;
11
+ }): import("react").JSX.Element | null;
@@ -153,6 +153,54 @@ type EditView = "props" | "json" | "settings";
153
153
  * History is local to the open workflow and excludes tests, samples and viewport changes.
154
154
  */
155
155
  export declare function WorkflowFlowEditor(props: WorkflowFlowEditorProps): import("react").JSX.Element;
156
+ /**
157
+ * Phase 1 of the canvas ▶ run: **collect the run's incoming state**, then hand
158
+ * it to the host to invoke. Rendered inside the run modal, which is the chrome.
159
+ *
160
+ * Two shapes, because the two kinds of step start from different things:
161
+ * - a **trigger** has no incoming state — it *is* the start — so it projects
162
+ * its configured `fields` *definitions* into params (`fieldsToParams`), seeds
163
+ * from their declared defaults (`seedValues`) and renders them through
164
+ * {@link PropertyEntryForm} (chrome-less by contract, so it is mounted bare
165
+ * here). The filled values become the run's starting state (`{ input }`), and
166
+ * the step's **last saved values** come back pre-filled on top (T4.1.3).
167
+ * - **everything else** is already configured, and what changes between two
168
+ * runs is the data arriving at it. So it collects exactly what the Test tab
169
+ * collects — {@link IncomingStateField}, the same component — and runs the
170
+ * step with its **stored** `with` underneath. The configuration is not
171
+ * re-collected here and is never rewritten by a run (R-I-1: the ▶ modal used
172
+ * to render the Configure form).
173
+ *
174
+ * The trigger check comes first on purpose: a trigger *is* an internal node, and
175
+ * its internal schema is the `fields` **editor**, not the fields themselves.
176
+ *
177
+ * `params` is fetched on **both** paths — a trigger renders them, and a
178
+ * non-trigger needs them for the same required-params gate the Test tab applies
179
+ * to `{...step.with, ...state}`. An app action fetches its action definition
180
+ * exactly as `StepEditModal` does, showing "Loading parameters…" until it lands.
181
+ */
182
+ export declare function StepRunCollect({ workflowId, step, upstreamSteps, loop, onRun, onCancel, continues, }: {
183
+ /** Fixture key, with `step.id` — where the remembered values are read from. */
184
+ workflowId: string;
185
+ step: FlowStep;
186
+ /** Graph ancestors of this step; their saved tests are offered as seeds. */
187
+ upstreamSteps: ExpressionStepSource[];
188
+ /** The enclosing For each when this step is in its body (from the same projection call). */
189
+ loop?: ExpressionLoopSource;
190
+ /**
191
+ * Fired when the user presses Run — with the trigger's filled values, or (for
192
+ * every other step) the incoming-state override alone, plus the start state
193
+ * seeded from the upstream steps' saved outputs (so the step's own
194
+ * `{{ steps.<id>.output.<field> }}` references resolve). The two are
195
+ * different things and stay separate: `values` are params, `state` is scope.
196
+ */
197
+ onRun: (values: Record<string, unknown>, state?: StepStartState) => void;
198
+ onCancel: () => void;
199
+ /** Present when Run continues downstream (`onRunFromNode`): the paused ids it stops before. */
200
+ continues?: {
201
+ stopAt: string[];
202
+ };
203
+ }): import("react").JSX.Element;
156
204
  /**
157
205
  * The state the Test tab PREVIEWS its resolved params against: the seeded `testStartState`
158
206
  * (what the test will actually send) with, for each upstream `nodes.<id>.output` and the
@@ -172,7 +220,13 @@ interface StepEditModalProps {
172
220
  /** The enclosing For each when this step is in its body: seeds `state.foreach` on Test. */
173
221
  loop?: ExpressionLoopSource;
174
222
  onChange: (next: FlowStep) => void;
223
+ /** Done: close, keeping the edits (they apply live). Also ×/Esc when `onCancel` is absent. */
175
224
  onClose: () => void;
225
+ /**
226
+ * Cancel, × and Esc: close and discard this dialog's edits. Without it, no Cancel button
227
+ * shows and × / Esc keep the edits.
228
+ */
229
+ onCancel?: () => void;
176
230
  readOnly?: boolean;
177
231
  initialView?: EditView;
178
232
  /** Most outgoing edges this node has in one lane; "Run next nodes" needs >= 2. */
@@ -29,8 +29,7 @@ export interface YamlEditorProps {
29
29
  * component's own `.w6w-yaml-editor` wrapper (sibling to the CodeMirror
30
30
  * mount — no extra DOM node). Copies the current `value` verbatim.
31
31
  *
32
- * Off by default: the other mounts of this component must render byte-
33
- * identically to before this prop existed.
32
+ * On by default; disable only when the containing view supplies its own copy button.
34
33
  */
35
34
  copyable?: boolean;
36
35
  }
@@ -0,0 +1,4 @@
1
+ import { ActionParam, WorkflowDetail } from './types.ts';
2
+ /** Manual entry points can be called with an explicit input payload. */
3
+ export declare function callableTriggers(wf: WorkflowDetail): import('./types.ts').WorkflowStepSummary[];
4
+ export declare function triggerFieldsOf(wf: WorkflowDetail, entry?: string): ActionParam[];
package/dist/code.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./CodeBlock-CymlfyeA.cjs");exports.CodeBlock=e.CodeBlock;exports.Copyable=e.Copyable;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./CodeBlock-BSX1pi6W.cjs");exports.CodeBlock=e.CodeBlock;exports.Copyable=e.Copyable;
2
2
  //# sourceMappingURL=code.cjs.map
package/dist/code.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { C as a, a as l } from "./CodeBlock-C-oIIYfC.js";
2
+ import { C as a, a as l } from "./CodeBlock-CPKXSNEs.js";
3
3
  export {
4
4
  a as CodeBlock,
5
5
  l as Copyable
@@ -12,6 +12,12 @@ export interface ConfirmModalProps {
12
12
  pending?: boolean;
13
13
  /** Style the confirm button as destructive (default true — this dialog gates dangerous actions). */
14
14
  destructive?: boolean;
15
+ /**
16
+ * Open with focus on the confirm button, so Enter approves. Without it `showModal()` focuses
17
+ * the first button, Cancel, and Enter dismisses — the safe default. Only for an action the
18
+ * user can undo.
19
+ */
20
+ autoFocusConfirm?: boolean;
15
21
  /** Extra consequence copy under the message (e.g. a warning line) that a string cannot carry. */
16
22
  children?: ReactNode;
17
23
  }
@@ -32,4 +38,4 @@ export interface ConfirmModalProps {
32
38
  * Confirmations are `{pending}` state + a rendered sibling modal, never a blocking
33
39
  * call: a caller reachable from a keydown handler cannot swap in a boolean.
34
40
  */
35
- export declare function ConfirmModal({ title, message, onConfirm, onClose, confirmLabel, cancelLabel, destructive, pending, children, }: ConfirmModalProps): import("react").JSX.Element;
41
+ export declare function ConfirmModal({ title, message, onConfirm, onClose, confirmLabel, cancelLabel, destructive, pending, autoFocusConfirm, children, }: ConfirmModalProps): import("react").JSX.Element;
@@ -5,6 +5,8 @@ export interface DataEntryListRow {
5
5
  version: number;
6
6
  /** The short text shown in the Value column. */
7
7
  preview: string;
8
+ /** Full value to copy; never use a truncated preview as the clipboard payload. */
9
+ copyText?: string;
8
10
  }
9
11
  export interface DataEntryListProps {
10
12
  rows: readonly DataEntryListRow[];
@@ -161,6 +161,8 @@ export interface ExpressionOptions {
161
161
  */
162
162
  stateShape?: {
163
163
  fields: ExpressionStateField[];
164
+ /** Upstream state writes from real outputs — what a step Test sends as `state` (`state-shape.ts`). */
165
+ written?: Record<string, unknown>;
164
166
  };
165
167
  /** Whether a trigger event is in scope (`trigger.event`). */
166
168
  hasTrigger?: boolean;
@@ -23,8 +23,7 @@ export interface ResultViewerProps {
23
23
  *
24
24
  * Read-only means read-only: nothing here takes an `onChange`, and the one
25
25
  * interactive affordance besides the collapsers and the Rendered/Source
26
- * toggle is `Copyable`'s button, overlaying the top-right corner and revealed
27
- * on hover (`w6w-copyable--hover`).
26
+ * toggle is `Copyable`'s button, always visible at the top-right corner.
28
27
  *
29
28
  * **Vendor HTML never touches this document.** The `html` format renders only
30
29
  * through `HtmlPreview` — an `<iframe sandbox="">` whose `srcdoc` opens with a
@@ -1,8 +1,10 @@
1
1
  import { ExprValue, SecretValue } from './types.ts';
2
2
  /** The comparisons the condition builder offers, in menu order, with their labels. */
3
- export declare const CONDITION_OPERATORS: readonly [readonly ["is-true", "is true"], readonly ["is-false", "is false"], readonly ["===", "equals"], readonly ["!==", "does not equal"], readonly [">", "greater than"], readonly [">=", "at least"], readonly ["<", "less than"], readonly ["<=", "at most"], readonly ["in", "in"], readonly ["includes", "includes value"], readonly ["include-any", "includes any of (list)"], readonly ["include-all", "includes all of (list)"]];
3
+ export declare const CONDITION_OPERATORS: readonly [readonly ["is-true", "is true"], readonly ["is-false", "is false"], readonly ["has-value", "has a value"], readonly ["is-empty", "is empty"], readonly ["===", "equals"], readonly ["!==", "does not equal"], readonly [">", "greater than"], readonly [">=", "at least"], readonly ["<", "less than"], readonly ["<=", "at most"], readonly ["in", "in"], readonly ["includes", "includes value"], readonly ["include-any", "includes any of (list)"], readonly ["include-all", "includes all of (list)"]];
4
4
  /** Operand order for membership comparisons; shown on the selected operator and its options. */
5
5
  export declare const CONDITION_OPERATOR_HINTS: Record<string, string>;
6
+ /** True when `operator` takes no right-hand value (is true / is false / has a value / is empty). */
7
+ export declare function isUnaryConditionOperator(operator: string): boolean;
6
8
  /** A comparison operator as the builder names it (`===` → "equals"); unknown ones as written. */
7
9
  export declare function conditionOperatorLabel(op: string): string;
8
10
  /** One comparison row of the builder: `left <operator> right`. */