treege 3.0.0-beta.45 → 3.0.0-beta.47
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/DefaultInputs-UkiUaJcf.js +1734 -0
- package/dist/{ThemeContext-O482h1XZ.js → ThemeContext-CNsS53ku.js} +274 -217
- package/dist/editor/constants/nodeTypes.d.ts +1 -1
- package/dist/editor/features/TreegeEditor/nodes/components/NodeGroupBadge.d.ts +5 -0
- package/dist/editor/features/TreegeEditor/nodes/layout/NodeWrapper.d.ts +1 -2
- package/dist/editor/hooks/useHistoryStore.d.ts +26 -0
- package/dist/editor/hooks/useUndoRedo.d.ts +31 -0
- package/dist/editor/utils/dagreLayout.d.ts +5 -2
- package/dist/editor/utils/groupColor.d.ts +14 -0
- package/dist/{editor-DBCMmZtt.js → editor-DrGQB__b.js} +1471 -1305
- package/dist/editor.js +2 -2
- package/dist/main.js +4 -4
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultStep.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/useTreegeRenderer.d.ts +12 -4
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultStep.d.ts +3 -0
- package/dist/renderer/hooks/useRenderNode.d.ts +1 -3
- package/dist/renderer/index.d.ts +1 -1
- package/dist/renderer/index.native.d.ts +1 -1
- package/dist/renderer/types/renderer.d.ts +43 -5
- package/dist/renderer/utils/step.d.ts +27 -0
- package/dist/renderer-native.js +757 -685
- package/dist/renderer.js +3 -3
- package/dist/shared/locales/ar.json.d.ts +6 -1
- package/dist/shared/locales/de.json.d.ts +6 -1
- package/dist/shared/locales/en.json.d.ts +6 -1
- package/dist/shared/locales/es.json.d.ts +6 -1
- package/dist/shared/locales/fr.json.d.ts +6 -1
- package/dist/shared/locales/it.json.d.ts +6 -1
- package/dist/shared/locales/pt.json.d.ts +6 -1
- package/package.json +11 -11
- package/dist/DefaultInputs-DYKtphqY.js +0 -1701
- package/dist/editor/features/TreegeEditor/nodes/GroupNode.d.ts +0 -6
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultGroup.d.ts +0 -7
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultGroup.d.ts +0 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const NODE_TYPES: {
|
|
2
2
|
flow: import('react').MemoExoticComponent<(props: import('../features/TreegeEditor/nodes/TreegeNode').TreegeNodeProps) => import("react/jsx-runtime").JSX.Element>;
|
|
3
|
-
group:
|
|
3
|
+
group: () => null;
|
|
4
4
|
input: import('react').MemoExoticComponent<(props: import('../features/TreegeEditor/nodes/TreegeNode').TreegeNodeProps) => import("react/jsx-runtime").JSX.Element>;
|
|
5
5
|
ui: import('react').MemoExoticComponent<(props: import('../features/TreegeEditor/nodes/TreegeNode').TreegeNodeProps) => import("react/jsx-runtime").JSX.Element>;
|
|
6
6
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
interface NodeWrapperProps extends PropsWithChildren {
|
|
3
|
-
inGroup: boolean;
|
|
4
3
|
isSubmit?: boolean;
|
|
5
4
|
}
|
|
6
|
-
declare const NodeWrapper: ({ children,
|
|
5
|
+
declare const NodeWrapper: ({ children, isSubmit }: NodeWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
6
|
export default NodeWrapper;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Edge, Node } from '@xyflow/react';
|
|
2
|
+
type Snapshot = {
|
|
3
|
+
nodes: Node[];
|
|
4
|
+
edges: Edge[];
|
|
5
|
+
};
|
|
6
|
+
type HistoryStore = {
|
|
7
|
+
past: Snapshot[];
|
|
8
|
+
future: Snapshot[];
|
|
9
|
+
pushPast: (snapshot: Snapshot) => void;
|
|
10
|
+
popPast: () => Snapshot | undefined;
|
|
11
|
+
pushFuture: (snapshot: Snapshot) => void;
|
|
12
|
+
popFuture: () => Snapshot | undefined;
|
|
13
|
+
clearFuture: () => void;
|
|
14
|
+
reset: () => void;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Zustand store backing the editor's undo/redo history.
|
|
18
|
+
*
|
|
19
|
+
* Holds two stacks of `{ nodes, edges }` snapshots: `past` (states to undo into) and
|
|
20
|
+
* `future` (states to redo into). Both are capped at `MAX_HISTORY` to bound memory.
|
|
21
|
+
*
|
|
22
|
+
* Consumed exclusively by `useUndoRedo` — components should not read or mutate this
|
|
23
|
+
* store directly. Call `reset()` when loading a new flow to drop stale history.
|
|
24
|
+
*/
|
|
25
|
+
declare const useHistoryStore: import('zustand').UseBoundStore<import('zustand').StoreApi<HistoryStore>>;
|
|
26
|
+
export default useHistoryStore;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { OnBeforeDelete } from '@xyflow/react';
|
|
2
|
+
type UseUndoRedoOptions = {
|
|
3
|
+
enableShortcuts?: boolean;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Snapshot-based undo/redo for the ReactFlow editor.
|
|
7
|
+
*
|
|
8
|
+
* Maintains `past` / `future` stacks of `{ nodes, edges }` snapshots in `useHistoryStore`.
|
|
9
|
+
* Callers must invoke `takeSnapshot()` before any mutation they want to be undoable
|
|
10
|
+
* (drag start, node/edge creation, deletion, type change, …); the hook itself does
|
|
11
|
+
* not observe ReactFlow state changes.
|
|
12
|
+
*
|
|
13
|
+
* @param enableShortcuts - When true, binds Cmd/Ctrl+Z (undo) and Cmd/Ctrl+Shift+Z /
|
|
14
|
+
* Cmd/Ctrl+Y (redo) to the window. Should be enabled in a single root component
|
|
15
|
+
* (e.g. the editor) to avoid duplicate listeners.
|
|
16
|
+
*
|
|
17
|
+
* @returns
|
|
18
|
+
* - `takeSnapshot`: pushes the current flow onto `past` and clears `future`.
|
|
19
|
+
* - `onBeforeDelete`: adapter typed for ReactFlow's `onBeforeDelete` prop.
|
|
20
|
+
* - `undo` / `redo`: restore the previous / next snapshot.
|
|
21
|
+
* - `canUndo` / `canRedo`: booleans driven by stack length, suitable for disabling UI buttons.
|
|
22
|
+
*/
|
|
23
|
+
declare const useUndoRedo: ({ enableShortcuts }?: UseUndoRedoOptions) => {
|
|
24
|
+
canRedo: boolean;
|
|
25
|
+
canUndo: boolean;
|
|
26
|
+
onBeforeDelete: OnBeforeDelete;
|
|
27
|
+
redo: () => void;
|
|
28
|
+
takeSnapshot: () => void;
|
|
29
|
+
undo: () => void;
|
|
30
|
+
};
|
|
31
|
+
export default useUndoRedo;
|
|
@@ -10,8 +10,11 @@ export interface LayoutOptions {
|
|
|
10
10
|
* `nodes` array with updated `position` fields. Nodes not yet measured by
|
|
11
11
|
* React Flow keep their current position.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Groups are metadata only (rendered as colored badges on each child) and
|
|
14
|
+
* do not influence the layout. They are anchored at the origin (0, 0) and
|
|
15
|
+
* never moved, which means a child's `position` (parent-relative in React
|
|
16
|
+
* Flow) is numerically equal to its absolute canvas position — so we can
|
|
17
|
+
* lay out every non-group node in a single Dagre pass without converting
|
|
15
18
|
* coordinates.
|
|
16
19
|
*/
|
|
17
20
|
export declare const getLayoutedElements: (nodes: Node[], edges: Edge[], options?: LayoutOptions) => Node[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic color for a group, derived from its id.
|
|
3
|
+
*
|
|
4
|
+
* Why HSL + inline style (rather than a Tailwind class):
|
|
5
|
+
* Tailwind purges classes at build time and can't synthesize `bg-{color}`
|
|
6
|
+
* from a runtime hash. Picking from a fixed palette would cap the number of
|
|
7
|
+
* distinguishable groups; HSL with a hashed hue gives effectively unlimited
|
|
8
|
+
* distinct, stable colors with no Tailwind-side configuration.
|
|
9
|
+
*
|
|
10
|
+
* Saturation/lightness are fixed (65% / 45%) so every group lands in the
|
|
11
|
+
* same readable, mid-contrast band on both light and dark themes — only the
|
|
12
|
+
* hue varies between groups.
|
|
13
|
+
*/
|
|
14
|
+
export declare const getGroupColor: (groupId?: string) => string;
|