@valerypopoff/rivet2-core 2.0.9 → 2.0.10

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.
@@ -1,9 +1,10 @@
1
1
  import { nanoid } from 'nanoid/non-secure';
2
- import { dedent } from 'ts-dedent';
3
2
  import {} from '../NodeBase.js';
4
3
  import { NodeImpl } from '../NodeImpl.js';
5
4
  import { nodeDefinition } from '../NodeDefinition.js';
6
5
  import {} from '../GraphProcessor.js';
6
+ import {} from '../EditorDefinition.js';
7
+ const DID_RUN_EXPLANATION = 'Outputs true when all connected inputs have run. Falsy or empty values still count as having run, so this is useful for adapting "did this branch run at all?" into a boolean If port.';
7
8
  export class DidRunNodeImpl extends NodeImpl {
8
9
  static create() {
9
10
  return {
@@ -14,7 +15,7 @@ export class DidRunNodeImpl extends NodeImpl {
14
15
  visualData: {
15
16
  x: 0,
16
17
  y: 0,
17
- width: 250,
18
+ width: 167,
18
19
  },
19
20
  };
20
21
  }
@@ -41,16 +42,20 @@ export class DidRunNodeImpl extends NodeImpl {
41
42
  }
42
43
  static getUIData() {
43
44
  return {
44
- infoBoxBody: dedent `
45
- Outputs true when all connected inputs have run. Falsy or empty values still count as having run, so this is useful for adapting "did this branch run at all?" into a boolean If port.
46
- `,
45
+ infoBoxBody: DID_RUN_EXPLANATION,
47
46
  infoBoxTitle: 'Did Run Node',
48
47
  contextMenuTitle: 'Did Run',
49
48
  group: ['Logic'],
50
49
  };
51
50
  }
52
- getBody() {
53
- return 'Outputs true when all connected inputs have run. Falsy or empty values still count';
51
+ getEditors() {
52
+ return [
53
+ {
54
+ type: 'info',
55
+ label: 'Behavior',
56
+ helperMessage: DID_RUN_EXPLANATION,
57
+ },
58
+ ];
54
59
  }
55
60
  #getInputPortCount(connections) {
56
61
  const inputNodeId = this.chartNode.id;
@@ -15,6 +15,10 @@ export type SharedEditorDefinitionProps<T extends ChartNode> = {
15
15
  hideIf?: (data: T['data']) => boolean;
16
16
  disableIf?: (data: T['data']) => boolean;
17
17
  };
18
+ export type InfoEditorDefinition<T extends ChartNode> = SharedEditorDefinitionProps<T> & {
19
+ type: 'info';
20
+ useInputToggleDataKey?: never;
21
+ };
18
22
  export type StringEditorDefinition<T extends ChartNode> = SharedEditorDefinitionProps<T> & {
19
23
  type: 'string';
20
24
  dataKey: DataOfType<T, string>;
@@ -177,5 +181,5 @@ export type DynamicEditorDefinition<T extends ChartNode> = SharedEditorDefinitio
177
181
  dataType: DataType;
178
182
  editor: DynamicEditorEditor;
179
183
  };
180
- export type EditorDefinition<T extends ChartNode> = StringEditorDefinition<T> | ToggleEditorDefinition<T> | DataTypeSelectorEditorDefinition<T> | AnyDataEditorDefinition<T> | DropdownEditorDefinition<T> | SegmentedEditorDefinition<T> | NumberEditorDefinition<T> | CodeEditorDefinition<T> | GraphSelectorEditorDefinition<T> | ColorEditorDefinition<T> | GraphSelectorEditorDefinition<T> | FileBrowserEditorDefinition<T> | ImageBrowserEditorDefinition<T> | DatasetSelectorEditorDefinition<T> | KeyValuePairEditorDefinition<T> | EditorDefinitionGroup<T> | StringListEditorDefinition<T> | CustomEditorDefinition<T> | DynamicEditorDefinition<T> | FilePathBrowserEditorDefinition<T> | DirectoryBrowserEditorDefinition<T>;
184
+ export type EditorDefinition<T extends ChartNode> = InfoEditorDefinition<T> | StringEditorDefinition<T> | ToggleEditorDefinition<T> | DataTypeSelectorEditorDefinition<T> | AnyDataEditorDefinition<T> | DropdownEditorDefinition<T> | SegmentedEditorDefinition<T> | NumberEditorDefinition<T> | CodeEditorDefinition<T> | GraphSelectorEditorDefinition<T> | ColorEditorDefinition<T> | GraphSelectorEditorDefinition<T> | FileBrowserEditorDefinition<T> | ImageBrowserEditorDefinition<T> | DatasetSelectorEditorDefinition<T> | KeyValuePairEditorDefinition<T> | EditorDefinitionGroup<T> | StringListEditorDefinition<T> | CustomEditorDefinition<T> | DynamicEditorDefinition<T> | FilePathBrowserEditorDefinition<T> | DirectoryBrowserEditorDefinition<T>;
181
185
  export {};
@@ -1,6 +1,7 @@
1
1
  import { type ChartNode, type NodeConnection, type NodeInputDefinition, type NodeOutputDefinition } from '../NodeBase.js';
2
2
  import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
3
3
  import { type Inputs, type Outputs } from '../GraphProcessor.js';
4
+ import { type EditorDefinition } from '../EditorDefinition.js';
4
5
  export type DidRunNode = ChartNode<'didRun', DidRunNodeData>;
5
6
  export type DidRunNodeData = {};
6
7
  export declare class DidRunNodeImpl extends NodeImpl<DidRunNode> {
@@ -9,7 +10,7 @@ export declare class DidRunNodeImpl extends NodeImpl<DidRunNode> {
9
10
  getInputDefinitions(connections: NodeConnection[]): NodeInputDefinition[];
10
11
  getOutputDefinitions(): NodeOutputDefinition[];
11
12
  static getUIData(): NodeUIData;
12
- getBody(): string;
13
+ getEditors(): EditorDefinition<DidRunNode>[];
13
14
  process(inputData: Inputs): Promise<Outputs>;
14
15
  }
15
16
  export declare const didRunNode: import("../NodeDefinition.js").NodeDefinition<DidRunNode>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valerypopoff/rivet2-core",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
4
4
  "license": "MIT",
5
5
  "main": "dist/cjs/bundle.cjs",
6
6
  "module": "dist/esm/index.js",