@octaviaflow/core 3.1.0-beta.102 → 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.
- package/dist/components/ExpressionField/ExpressionField.d.ts +18 -7
- package/dist/components/ExpressionField/ExpressionField.d.ts.map +1 -1
- package/dist/components/ExpressionField/parseExpression.d.ts +35 -0
- package/dist/components/ExpressionField/parseExpression.d.ts.map +1 -0
- package/dist/index.cjs +454 -80
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +497 -122
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { type CSSProperties, type ReactNode } from "react";
|
|
2
2
|
/** What the FxPanel puts on the drag, and what a host passes to `insert`. */
|
|
3
3
|
export interface ExpressionInsert {
|
|
4
|
-
/** The raw value: `ods://steps/x/output/at`, or `user.fmt()`. */
|
|
4
|
+
/** The raw value: `ods://steps/x/output/at`, or `{{user.fmt()}}`. */
|
|
5
5
|
value: string;
|
|
6
|
-
/** `variable` becomes a pill; `function` becomes
|
|
6
|
+
/** `variable` becomes a pill; `function` becomes a chip. */
|
|
7
7
|
kind?: "variable" | "function";
|
|
8
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
|
+
}
|
|
9
16
|
export interface ExpressionFieldProps {
|
|
10
17
|
value: string;
|
|
11
18
|
onChange: (next: string) => void;
|
|
@@ -20,13 +27,17 @@ export interface ExpressionFieldProps {
|
|
|
20
27
|
style?: CSSProperties;
|
|
21
28
|
/**
|
|
22
29
|
* Visible text for a reference pill. Defaults to a readable tail of the
|
|
23
|
-
* reference (`steps/x/output/created` → `created`). Pass a STABLE function
|
|
24
|
-
* its identity re-renders the content.
|
|
30
|
+
* reference (`steps/x/output/created` → `created`). Pass a STABLE function.
|
|
25
31
|
*/
|
|
26
32
|
resolveLabel?: (token: string) => string | undefined;
|
|
27
33
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
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.
|
|
30
41
|
*/
|
|
31
42
|
pillEveryToken?: boolean;
|
|
32
43
|
"aria-label"?: string;
|
|
@@ -39,6 +50,6 @@ export declare function shortReferenceLabel(token: string): string;
|
|
|
39
50
|
* not mistaken for a call, and `"a(b"` does not open one.
|
|
40
51
|
*/
|
|
41
52
|
export declare function insideCallArguments(textBeforeCaret: string): boolean;
|
|
42
|
-
export declare function ExpressionField({ value, onChange, label, placeholder, helperText, disabled, rows, id, className, style, resolveLabel, pillEveryToken, "aria-label": ariaLabel, }: ExpressionFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
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;
|
|
43
54
|
export default ExpressionField;
|
|
44
55
|
//# sourceMappingURL=ExpressionField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpressionField.d.ts","sourceRoot":"","sources":["../../../src/components/ExpressionField/ExpressionField.tsx"],"names":[],"mappings":"AA2BA,OAAO,
|
|
1
|
+
{"version":3,"file":"ExpressionField.d.ts","sourceRoot":"","sources":["../../../src/components/ExpressionField/ExpressionField.tsx"],"names":[],"mappings":"AA2BA,OAAO,EAML,KAAK,aAAa,EAIlB,K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,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,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"}
|