@theoremjs/react 0.3.4-next.405.g57fd3a0 → 0.3.4-next.409.g25ad907

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theoremjs/react",
3
- "version": "0.3.4-next.405.g57fd3a0",
3
+ "version": "0.3.4-next.409.g25ad907",
4
4
  "description": "React bindings for Theorem: headless hooks + transport, an Astryx chat UI, and a Web-standard server handler.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -60,8 +60,8 @@
60
60
  "@stylexjs/stylex": "0.19.0",
61
61
  "react": "^19.0.0",
62
62
  "react-dom": "^19.0.0",
63
- "@theoremjs/agents": "^0.3.4-next.405.g57fd3a0",
64
- "@theoremjs/web": "^0.3.4-next.405.g57fd3a0"
63
+ "@theoremjs/agents": "^0.3.4-next.409.g25ad907",
64
+ "@theoremjs/web": "^0.3.4-next.409.g25ad907"
65
65
  },
66
66
  "peerDependenciesMeta": {
67
67
  "@astryxdesign/core": {
@@ -70,16 +70,24 @@ export declare function ResponseColumn({ label, fill, children, }: {
70
70
  export type ConsoleView = 'fields' | 'json';
71
71
  export type RequestCardProps = {
72
72
  title: string;
73
+ /** Runs on ⌘/Ctrl+Enter anywhere in the card. */
74
+ onRun: () => void;
75
+ children: ReactNode;
76
+ } & ({
73
77
  /** The view shown: fields only while the request parses. */
74
78
  view: ConsoleView;
75
79
  hasFields: boolean;
76
80
  onView: (next: ConsoleView) => void;
77
- /** Runs on ⌘/Ctrl+Enter anywhere in the card. */
78
- onRun: () => void;
79
- children: ReactNode;
80
- };
81
+ actions?: never;
82
+ } | {
83
+ view?: never;
84
+ hasFields?: never;
85
+ onView?: never;
86
+ /** In the Fields/JSON switch's place, for a request that has no JSON of its own. */
87
+ actions?: ReactNode;
88
+ });
81
89
  /** The request's card: its heading with the Fields/JSON switch, then the request and its run bar. */
82
- export declare function RequestCard({ title, view, hasFields, onView, onRun, children }: RequestCardProps): import("react").JSX.Element;
90
+ export declare function RequestCard({ title, onRun, children, ...heading }: RequestCardProps): import("react").JSX.Element;
83
91
  /** The request as JSON text, marked while it doesn't parse. */
84
92
  export declare function JsonRequest({ label, text, isInvalid, onChange, }: {
85
93
  label: string;
@@ -110,12 +110,12 @@ function runShortcut(run) {
110
110
  };
111
111
  }
112
112
  /** The request's card: its heading with the Fields/JSON switch, then the request and its run bar. */
113
- export function RequestCard({ title, view, hasFields, onView, onRun, children }) {
113
+ export function RequestCard({ title, onRun, children, ...heading }) {
114
114
  const t = useLabels();
115
115
  const framed = use(ConsoleChrome);
116
- const body = (_jsxs(VStack, { gap: 3, padding: framed ? undefined : 4, onKeyDown: runShortcut(onRun), children: [_jsxs(HStack, { gap: 2, hAlign: "between", vAlign: "center", children: [_jsx(Text, { type: "supporting", color: "secondary", as: "h3", children: title }), _jsxs(SegmentedControl, { label: t('@theorem.decision.view'), size: "sm", value: view, onChange: (next) => {
117
- onView(next === 'json' ? 'json' : 'fields');
118
- }, children: [_jsx(SegmentedControlItem, { value: "fields", label: t('@theorem.decision.fields'), isDisabled: !hasFields }), _jsx(SegmentedControlItem, { value: "json", label: t('@theorem.data.json') })] })] }), children] }));
116
+ const body = (_jsxs(VStack, { gap: 3, padding: framed ? undefined : 4, onKeyDown: runShortcut(onRun), children: [_jsxs(HStack, { gap: 2, hAlign: "between", vAlign: "center", children: [_jsx(Text, { type: "supporting", color: "secondary", as: "h3", children: title }), heading.onView ? (_jsxs(SegmentedControl, { label: t('@theorem.decision.view'), size: "sm", value: heading.view, onChange: (next) => {
117
+ heading.onView(next === 'json' ? 'json' : 'fields');
118
+ }, children: [_jsx(SegmentedControlItem, { value: "fields", label: t('@theorem.decision.fields'), isDisabled: !heading.hasFields }), _jsx(SegmentedControlItem, { value: "json", label: t('@theorem.data.json') })] })) : (heading.actions)] }), children] }));
119
119
  if (!framed)
120
120
  return body;
121
121
  return (_jsx(Card, { variant: "muted", padding: 4, className: "theorem-console-card", style: CONSOLE_CARD, children: body }));