@octaviaflow/core 3.1.0-beta.101 → 3.1.0-beta.103

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.
@@ -0,0 +1,55 @@
1
+ import { type CSSProperties, type ReactNode } from "react";
2
+ /** What the FxPanel puts on the drag, and what a host passes to `insert`. */
3
+ export interface ExpressionInsert {
4
+ /** The raw value: `ods://steps/x/output/at`, or `{{user.fmt()}}`. */
5
+ value: string;
6
+ /** `variable` becomes a pill; `function` becomes a chip. */
7
+ kind?: "variable" | "function";
8
+ }
9
+ /** What a host knows about a call, for labelling its argument rows. */
10
+ export interface CallSignature {
11
+ /** Display name. Defaults to the name as written, minus `user.`. */
12
+ label?: string;
13
+ /** Argument names, in order — used as the row labels. */
14
+ args?: string[];
15
+ }
16
+ export interface ExpressionFieldProps {
17
+ value: string;
18
+ onChange: (next: string) => void;
19
+ label?: ReactNode;
20
+ placeholder?: string;
21
+ helperText?: ReactNode;
22
+ disabled?: boolean;
23
+ /** Visible rows at rest. The field grows with its content. */
24
+ rows?: number;
25
+ id?: string;
26
+ className?: string;
27
+ style?: CSSProperties;
28
+ /**
29
+ * Visible text for a reference pill. Defaults to a readable tail of the
30
+ * reference (`steps/x/output/created` → `created`). Pass a STABLE function.
31
+ */
32
+ resolveLabel?: (token: string) => string | undefined;
33
+ /**
34
+ * What a call's arguments are called, so the editor can label its rows.
35
+ * Pass a STABLE function.
36
+ */
37
+ resolveCall?: (name: string) => CallSignature | undefined;
38
+ /**
39
+ * Treat every `{{…}}` that is not a call as a reference, not just
40
+ * `{{ods://…}}`. For hosts whose tokens are their own short form.
41
+ */
42
+ pillEveryToken?: boolean;
43
+ "aria-label"?: string;
44
+ }
45
+ /** A short, human tail for a reference: the last path segments. */
46
+ export declare function shortReferenceLabel(token: string): string;
47
+ /**
48
+ * Is the caret inside the parentheses of a call? Counts unclosed `(` in the
49
+ * text before it, ignoring anything inside quotes — so a `(` in a message is
50
+ * not mistaken for a call, and `"a(b"` does not open one.
51
+ */
52
+ export declare function insideCallArguments(textBeforeCaret: string): boolean;
53
+ export declare function ExpressionField({ value, onChange, label, placeholder, helperText, disabled, rows, id, className, style, resolveLabel, resolveCall, pillEveryToken, "aria-label": ariaLabel, }: ExpressionFieldProps): import("react/jsx-runtime").JSX.Element;
54
+ export default ExpressionField;
55
+ //# sourceMappingURL=ExpressionField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpressionField.d.ts","sourceRoot":"","sources":["../../../src/components/ExpressionField/ExpressionField.tsx"],"names":[],"mappings":"AA2BA,OAAO,EAML,KAAK,aAAa,EAIlB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAUf,6EAA6E;AAC7E,MAAM,WAAW,gBAAgB;IAC/B,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;CAChC;AAED,uEAAuE;AACvE,MAAM,WAAW,aAAa;IAC5B,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACrD;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,aAAa,GAAG,SAAS,CAAC;IAC1D;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAMD,mEAAmE;AACnE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAWzD;AAyBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAiBpE;AAWD,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,QAAQ,EACR,KAAK,EACL,WAAW,EACX,UAAU,EACV,QAAgB,EAChB,IAAQ,EACR,EAAE,EACF,SAAS,EACT,KAAK,EACL,YAAY,EACZ,WAAW,EACX,cAAsB,EACtB,YAAY,EAAE,SAAS,GACxB,EAAE,oBAAoB,2CA+XtB;AA0HD,eAAe,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { ExpressionField, shortReferenceLabel, insideCallArguments } from "./ExpressionField";
2
+ export type { ExpressionFieldProps, ExpressionInsert } from "./ExpressionField";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ExpressionField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC9F,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,35 @@
1
+ /** A call's name: a built-in (`CONCAT`) or a user function (`user.fmt`). */
2
+ export declare const CALL_NAME_SOURCE = "(?:[A-Z_][A-Z0-9_]*|user\\.[A-Za-z_][A-Za-z0-9_]*)";
3
+ export type Segment = {
4
+ kind: "text";
5
+ raw: string;
6
+ } | {
7
+ kind: "ref";
8
+ raw: string;
9
+ } | {
10
+ kind: "call";
11
+ raw: string;
12
+ name: string;
13
+ args: string[];
14
+ };
15
+ /**
16
+ * Split a call's argument list at top-level commas, leaving nested calls,
17
+ * quoted strings and wrapped references intact.
18
+ */
19
+ export declare function splitArguments(argsText: string): string[];
20
+ /** `{{user.fmt(a, b)}}` → its name and arguments; `undefined` if not a call. */
21
+ export declare function parseCall(raw: string): {
22
+ name: string;
23
+ args: string[];
24
+ } | undefined;
25
+ /** Rebuild a call from its parts, in the wrapped form a field stores. */
26
+ export declare function formatCall(name: string, args: string[]): string;
27
+ /**
28
+ * Break a field's value into what the reader sees: plain text, references
29
+ * (pills) and calls (chips).
30
+ *
31
+ * `pillEveryToken` widens what counts as a reference to any `{{…}}` that is
32
+ * not a call, for hosts whose tokens are their own short form.
33
+ */
34
+ export declare function parseExpression(value: string, pillEveryToken?: boolean): Segment[];
35
+ //# sourceMappingURL=parseExpression.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseExpression.d.ts","sourceRoot":"","sources":["../../../src/components/ExpressionField/parseExpression.ts"],"names":[],"mappings":"AASA,4EAA4E;AAC5E,eAAO,MAAM,gBAAgB,uDAAuD,CAAC;AAGrF,MAAM,MAAM,OAAO,GACf;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC7B;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC5B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AA2ChE;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CA2CzD;AAED,gFAAgF;AAChF,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,SAAS,CAQnF;AAED,yEAAyE;AACzE,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAE/D;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,UAAQ,GAAG,OAAO,EAAE,CA8BhF"}