import { Any } from '@likec4/core/types'; import { AutoLayoutDirection } from '@likec4/core/types'; import { aux } from '@likec4/core/types'; import { BBox } from '@likec4/core/types'; import { BBox as BBox_2 } from '@likec4/core/geometry'; import { BBox as BBox_3 } from '@likec4/core'; import { CamelCasedProperties } from 'type-fest'; import { Color } from '@likec4/core/types'; import { ComputedNodeStyle } from '@likec4/core/types'; import { ComputedNodeStyle as ComputedNodeStyle_2 } from '@likec4/core'; import { Context as Context_4 } from 'react'; import { CSSProperties } from 'react'; import { DependencyList } from 'react'; import { DeploymentFqn } from '@likec4/core/types'; import { DetailedHTMLProps } from 'react'; import { DiagramEdge } from '@likec4/core/types'; import { DiagramNode } from '@likec4/core/types'; import { DiagramNodeDriftReason } from '@likec4/core/types'; import { DiagramView } from '@likec4/core/types'; import { DynamicViewDisplayVariant } from '@likec4/core/types'; import { Edge } from '@xyflow/react'; import { EdgeChange } from '@xyflow/system'; import { EdgeChange as EdgeChange_2 } from '@xyflow/react'; import { EdgeId } from '@likec4/core/types'; import { EdgeId as EdgeId_2 } from '@likec4/core'; import { EdgeProps } from '@xyflow/react'; import { EffectCallback } from 'react'; import { ElementKind } from '@likec4/core/types'; import { ElementProps } from '@mantine/core'; import { ElementShape as ElementShape_2 } from '@likec4/core/types'; import { ElementStyle } from '@likec4/core/types'; import { Except } from 'type-fest'; import { ExclusiveUnion } from '@likec4/core/types'; import { ExclusiveUnion as ExclusiveUnion_2 } from '@likec4/core'; import { FC } from 'react'; import { ForwardRefComponent } from 'motion/react'; import { ForwardRefExoticComponent } from 'react'; import { Fqn } from '@likec4/core/types'; import { Fqn as Fqn_3 } from '@likec4/core'; import { FunctionComponent } from 'react'; import { HTMLAttributes } from 'react'; import { HTMLMotionProps } from 'motion/react'; import { IconUrl } from '@likec4/core/types'; import { JSX } from 'react/jsx-runtime'; import { JsxStyleProps } from '@likec4/styles/types'; import { LayoutedProjectsView } from '@likec4/core/compute-view'; import { LayoutedView } from '@likec4/core/types'; import { LayoutType } from '@likec4/core/types'; import { LikeC4Model } from '@likec4/core/model'; import { LikeC4Project } from '@likec4/core/types'; import { LikeC4Styles } from '@likec4/core/styles'; import { LikeC4ViewModel } from '@likec4/core/model'; import { MarkdownOrString } from '@likec4/core/types'; import { MarkdownOrString as MarkdownOrString_2 } from '@likec4/core'; import { MemoExoticComponent } from 'react'; import { MotionNodeLayoutOptions } from 'motion/react'; import { MotionStyle } from 'motion/react'; import { MouseEvent as MouseEvent_2 } from 'react'; import { NavigationPanelRecipe } from '@likec4/styles/recipes'; import { Node as Node_2 } from '@xyflow/react'; import { NodeChange } from '@xyflow/system'; import { NodeChange as NodeChange_2 } from '@xyflow/react'; import { NodeId } from '@likec4/core/types'; import { NodeId as NodeId_3 } from '@likec4/core'; import { NodeModel } from '@likec4/core/model'; import { NodeNotation } from '@likec4/core/types'; import { NodeProps } from '@xyflow/react'; import { NodeToolbarProps } from '@xyflow/react'; import { NonEmptyArray } from '@likec4/core/types'; import { NonEmptyObject } from 'type-fest'; import { NonEmptyReadonlyArray } from '@likec4/core/types'; import { OptionalKeysOf } from 'type-fest'; import { PartialDeep } from 'type-fest'; import { ProjectId } from '@likec4/core/types'; import { ProjectId as ProjectId_2 } from '@likec4/core'; import { PropsWithChildren } from 'react'; import { ReactFlowInstance } from '@xyflow/react'; import { ReactFlowProps } from '@xyflow/react'; import { ReactFlowState } from '@xyflow/react'; import { ReactNode } from 'react'; import { Rect } from '@xyflow/system'; import { RefAttributes } from 'react'; import { RefObject } from 'react'; import { RelationId as RelationId_2 } from '@likec4/core/types'; import { RelationshipArrowType } from '@likec4/core/types'; import { RelationshipLineType } from '@likec4/core/types'; import { RichTextOrEmpty } from '@likec4/core/types'; import { SetRequired } from 'type-fest'; import { Simplify } from 'type-fest'; import { SimplifyDeep } from 'type-fest'; import { StepEdgeId } from '@likec4/core/types'; import { StyleContextConsumer } from '@likec4/styles/jsx'; import { StyleContextProvider } from '@likec4/styles/jsx'; import type * as t from '@likec4/core/types'; import { UnknownLayouted as UnknownLayouted_2 } from '@likec4/core/types'; import { UnstyledButtonProps } from '@mantine/core'; import { ViewChange } from '@likec4/core/types'; import { ViewId } from '@likec4/core/types'; import { ViewId as ViewId_3 } from '@likec4/core'; import { Viewport } from '@xyflow/system'; import { WhereOperator } from '@likec4/core/types'; import { Without } from 'type-fest/source/merge-exclusive'; import { XYPosition } from '@xyflow/system'; declare type Action = NoRequiredParams | WithDynamicParams | ActionFunction; declare interface ActionArgs extends UnifiedArg { } declare type ActionExecutor = (actionToExecute: ExecutableActionObject) => void; declare type ActionFunction = { (args: ActionArgs, params: TParams): void; _out_TEvent?: TEvent; _out_TActor?: TActor; _out_TAction?: TAction; _out_TGuard?: TGuard; _out_TDelay?: TDelay; _out_TEmitted?: TEmitted; }; declare type ActionFunctionMap = { [K in TAction['type']]?: ActionFunction, TActor, TAction, TGuard, TDelay, TEmitted>; }; declare type Actions = SingleOrArray>; declare interface ActiveMachineSnapshot, TStateValue extends StateValue, TTag extends string, TOutput, TMeta extends MetaObject, TStateSchema extends StateSchema> extends MachineSnapshotBase { status: 'active'; output: undefined; error: undefined; } /** * An Actor is a running process that can receive events, send events and change * its behavior based on the events it receives, which can cause effects outside * of the actor. When you run a state machine, it becomes an actor. */ declare class Actor implements ActorRef, EventFromLogic, EmittedFrom> { logic: TLogic; /** The current internal state of the actor. */ private _snapshot; /** * The clock that is responsible for setting and clearing timeouts, such as * delayed events and transitions. */ clock: Clock; options: Readonly>; /** The unique identifier for this actor relative to its parent. */ id: string; private mailbox; private observers; private eventListeners; private logger; _parent?: AnyActorRef; ref: ActorRef, EventFromLogic, EmittedFrom>; private _actorScope; systemId: string | undefined; /** The globally unique process ID for this invocation. */ sessionId: string; /** The system to which this actor belongs. */ system: AnyActorSystem; private _doneEvent?; src: string | AnyActorLogic; /** * Creates a new actor instance for the given logic with the provided options, * if any. * * @param logic The logic to create an actor from * @param options Actor options */ constructor(logic: TLogic, options?: ActorOptions); private _initState; private _deferred; private update; /** * Subscribe an observer to an actor’s snapshot values. * * @remarks * The observer will receive the actor’s snapshot value when it is emitted. * The observer can be: * * - A plain function that receives the latest snapshot, or * - An observer object whose `.next(snapshot)` method receives the latest * snapshot * * @example * * ```ts * // Observer as a plain function * const subscription = actor.subscribe((snapshot) => { * console.log(snapshot); * }); * ``` * * @example * * ```ts * // Observer as an object * const subscription = actor.subscribe({ * next(snapshot) { * console.log(snapshot); * }, * error(err) { * // ... * }, * complete() { * // ... * } * }); * ``` * * The return value of `actor.subscribe(observer)` is a subscription object * that has an `.unsubscribe()` method. You can call * `subscription.unsubscribe()` to unsubscribe the observer: * * @example * * ```ts * const subscription = actor.subscribe((snapshot) => { * // ... * }); * * // Unsubscribe the observer * subscription.unsubscribe(); * ``` * * When the actor is stopped, all of its observers will automatically be * unsubscribed. * * @param observer - Either a plain function that receives the latest * snapshot, or an observer object whose `.next(snapshot)` method receives * the latest snapshot */ subscribe(observer: Observer>): Subscription; subscribe(nextListener?: (snapshot: SnapshotFrom) => void, errorListener?: (error: any) => void, completeListener?: () => void): Subscription; on['type'] | '*'>(type: TType, handler: (emitted: EmittedFrom & (TType extends '*' ? unknown : { type: TType; })) => void): Subscription; select(selector: (snapshot: SnapshotFrom) => TSelected, equalityFn?: (a: TSelected, b: TSelected) => boolean): Readable; /** Starts the Actor from the initial state */ start(): this; private _process; private _stop; /** Stops the Actor and unsubscribe all listeners. */ stop(): this; private _complete; private _reportError; private _error; private _stopProcedure; /** * Sends an event to the running Actor to trigger a transition. * * @param event The event to send */ send(event: EventFromLogic): void; private attachDevTools; toJSON(): { xstate$$type: number; id: string; }; /** * Obtain the internal state of the actor, which can be persisted. * * @remarks * The internal state can be persisted from any actor, not only machines. * * Note that the persisted state is not the same as the snapshot from * {@link Actor.getSnapshot}. Persisted state represents the internal state of * the actor, while snapshots represent the actor's last emitted value. * * Can be restored with {@link ActorOptions.state} * @see https://stately.ai/docs/persistence */ getPersistedSnapshot(): Snapshot; [symbolObservable](): InteropSubscribable>; /** * Read an actor’s snapshot synchronously. * * @remarks * The snapshot represent an actor's last emitted value. * * When an actor receives an event, its internal state may change. An actor * may emit a snapshot when a state transition occurs. * * Note that some actors, such as callback actors generated with * `fromCallback`, will not emit snapshots. * @see {@link Actor.subscribe} to subscribe to an actor’s snapshot values. * @see {@link Actor.getPersistedSnapshot} to persist the internal state of an actor (which is more than just a snapshot). */ getSnapshot(): SnapshotFrom; } /** * Represents logic which can be used by an actor. * * @template TSnapshot - The type of the snapshot. * @template TEvent - The type of the event object. * @template TInput - The type of the input. * @template TSystem - The type of the actor system. */ declare interface ActorLogic, // it's invariant because it's also part of `ActorScope["self"]["getSnapshot"]` in out TEvent extends EventObject, // it's invariant because it's also part of `ActorScope["self"]["send"]` in TInput = NonReducibleUnknown, TSystem extends AnyActorSystem = AnyActorSystem, in out TEmitted extends EventObject = EventObject> { /** The initial setup/configuration used to create the actor logic. */ config?: unknown; /** * Transition function that processes the current state and an incoming event * to produce a new state. * * @param snapshot - The current state. * @param event - The incoming event. * @param actorScope - The actor scope. * @returns The new state. */ transition: (snapshot: TSnapshot, event: TEvent, actorScope: ActorScope) => TSnapshot; /** * Called to provide the initial state of the actor. * * @param actorScope - The actor scope. * @param input - The input for the initial state. * @returns The initial state. */ getInitialSnapshot: (actorScope: ActorScope, input: TInput) => TSnapshot; /** * Called when Actor is created to restore the internal state of the actor * given a persisted state. The persisted state can be created by * `getPersistedSnapshot`. * * @param persistedState - The persisted state to restore from. * @param actorScope - The actor scope. * @returns The restored state. */ restoreSnapshot?: (persistedState: Snapshot, actorScope: ActorScope) => TSnapshot; /** * Called when the actor is started. * * @param snapshot - The starting state. * @param actorScope - The actor scope. */ start?: (snapshot: TSnapshot, actorScope: ActorScope) => void; /** * Obtains the internal state of the actor in a representation which can be be * persisted. The persisted state can be restored by `restoreSnapshot`. * * @param snapshot - The current state. * @returns The a representation of the internal state to be persisted. */ getPersistedSnapshot: (snapshot: TSnapshot, options?: unknown) => Snapshot; } declare interface ActorOptions { /** * The clock that is responsible for setting and clearing timeouts, such as * delayed events and transitions. * * @remarks * You can create your own “clock”. The clock interface is an object with two * functions/methods: * * - `setTimeout` - same arguments as `window.setTimeout(fn, timeout)` * - `clearTimeout` - same arguments as `window.clearTimeout(id)` * * By default, the native `setTimeout` and `clearTimeout` functions are used. * * For testing, XState provides `SimulatedClock`. * @see {@link Clock} * @see {@link SimulatedClock} */ clock?: Clock; /** * Specifies the logger to be used for `log(...)` actions. Defaults to the * native `console.log(...)` method. */ logger?: (...args: any[]) => void; parent?: AnyActorRef; /** The custom `id` for referencing this service. */ id?: string; /** @deprecated Use `inspect` instead. */ devTools?: never; /** The system ID to register this actor under. */ systemId?: string; /** The input data to pass to the actor. */ input?: InputFrom; /** * Initializes actor logic from a specific persisted internal state. * * @remarks * If the state is compatible with the actor logic, when the actor is started * it will be at that persisted state. Actions from machine actors will not be * re-executed, because they are assumed to have been already executed. * However, invocations will be restarted, and spawned actors will be restored * recursively. * * Can be generated with {@link Actor.getPersistedSnapshot}. * @see https://stately.ai/docs/persistence */ snapshot?: Snapshot; /** @deprecated Use `snapshot` instead. */ state?: Snapshot; /** The source actor logic. */ src?: string | AnyActorLogic; /** * A callback function or observer object which can be used to inspect actor * system updates. * * @remarks * If a callback function is provided, it can accept an inspection event * argument. The types of inspection events that can be observed include: * * - `@xstate.actor` - An actor ref has been created in the system * - `@xstate.event` - An event was sent from a source actor ref to a target * actor ref in the system * - `@xstate.snapshot` - An actor ref emitted a snapshot due to a received * event * * @example * * ```ts * import { createMachine } from 'xstate'; * * const machine = createMachine({ * // ... * }); * * const actor = createActor(machine, { * inspect: (inspectionEvent) => { * if (inspectionEvent.actorRef === actor) { * // This event is for the root actor * } * * if (inspectionEvent.type === '@xstate.actor') { * console.log(inspectionEvent.actorRef); * } * * if (inspectionEvent.type === '@xstate.event') { * console.log(inspectionEvent.sourceRef); * console.log(inspectionEvent.actorRef); * console.log(inspectionEvent.event); * } * * if (inspectionEvent.type === '@xstate.snapshot') { * console.log(inspectionEvent.actorRef); * console.log(inspectionEvent.event); * console.log(inspectionEvent.snapshot); * } * } * }); * ``` * * Alternately, an observer object (`{ next?, error?, complete? }`) can be * provided: * * @example * * ```ts * const actor = createActor(machine, { * inspect: { * next: (inspectionEvent) => { * if (inspectionEvent.actorRef === actor) { * // This event is for the root actor * } * * if (inspectionEvent.type === '@xstate.actor') { * console.log(inspectionEvent.actorRef); * } * * if (inspectionEvent.type === '@xstate.event') { * console.log(inspectionEvent.sourceRef); * console.log(inspectionEvent.actorRef); * console.log(inspectionEvent.event); * } * * if (inspectionEvent.type === '@xstate.snapshot') { * console.log(inspectionEvent.actorRef); * console.log(inspectionEvent.event); * console.log(inspectionEvent.snapshot); * } * } * } * }); * ``` */ inspect?: Observer | ((inspectionEvent: InspectionEvent) => void); } declare interface ActorRef, TEvent extends EventObject, TEmitted extends EventObject = EventObject> extends Subscribable, InteropObservable { /** The unique identifier for this actor relative to its parent. */ id: string; sessionId: string; send: (event: TEvent) => void; start: () => void; getSnapshot: () => TSnapshot; getPersistedSnapshot: () => Snapshot; stop: () => void; toJSON?: () => any; _parent?: AnyActorRef; system: AnyActorSystem; src: string | AnyActorLogic; on: (type: TType, handler: (emitted: TEmitted & (TType extends '*' ? unknown : { type: TType; })) => void) => Subscription; select(selector: (snapshot: TSnapshot) => TSelected, equalityFn?: (a: TSelected, b: TSelected) => boolean): Readable; } declare type ActorRefFromLogic = ActorRef, EventFromLogic, EmittedFrom>; declare type ActorRefLike = Pick; declare interface ActorScope, TEvent extends EventObject, TSystem extends AnyActorSystem = AnyActorSystem, TEmitted extends EventObject = EventObject> { self: ActorRef; id: string; sessionId: string; logger: (...args: any[]) => void; defer: (fn: () => void) => void; emit: (event: TEmitted) => void; system: TSystem; stopChild: (child: AnyActorRef) => void; actionExecutor: ActionExecutor; } declare interface ActorSystem { get: (key: K) => T['actors'][K] | undefined; getAll: () => Partial; inspect: (observer: Observer | ((inspectionEvent: InspectionEvent) => void)) => Subscription; scheduler: Scheduler; getSnapshot: () => { _scheduledEvents: Record; }; start: () => void; _clock: Clock; _logger: (...args: any[]) => void; } declare interface ActorSystemInfo { actors: Record; } declare type AlignmentMode = LinearAlignmentMode | GridAlignmentMode; declare type Any_2 = t.aux.Any; declare type Any_3 = t.aux.Any; declare type Any_4 = t.aux.Any; declare type Any_5 = aux.Any; declare type AnyActorLogic = ActorLogic; declare type AnyActorRef = ActorRef; declare type AnyActorScope = ActorScope; declare type AnyActorSystem = ActorSystem; declare interface AnyEventObject extends EventObject { [key: string]: any; } declare type AnyFunction = (...args: any[]) => any; declare type AnyStateMachine = StateMachine; declare type AnyTransitionDefinition = TransitionDefinition; export declare const Base: { setDimmed: typeof setDimmed; setHovered: typeof setHovered; setData: typeof setData; }; export declare namespace Base { export type Dimmed = 'immediate' | boolean; } export declare interface BaseEdge = Record, EdgeType extends string = string> extends SetRequired, 'type' | 'data'> { } export declare type BaseEdgeData = { /** * Whether the cursor is hovering over the edge */ hovered?: boolean; /** * Whether the edge is active (animated and highlighted) */ active?: boolean; /** * Whether the edge is dimmed * 'immediate' means that the edge is dimmed without delay */ dimmed?: Base.Dimmed; }; /** * ReactFlow Base Edge properties with BaseEdgeData at least */ export declare interface BaseEdgeProps extends EdgeProps { } export declare type BaseEdgePropsWithData> = BaseEdgeProps>; declare interface BaseInspectionEventProperties { rootId: string; /** * The relevant actorRef for the inspection event. * * - For snapshot events, this is the `actorRef` of the snapshot. * - For event events, this is the target `actorRef` (recipient of event). * - For actor events, this is the `actorRef` of the registered actor. */ actorRef: ActorRefLike; } export declare type BaseNode = Record, NodeType extends string = string> = SetRequired, 'type' | 'initialWidth' | 'initialHeight'>; export declare type BaseNodeData = { /** * Whether the cursor is hovering over the node */ hovered?: boolean; /** * Whether the node is dimmed * 'immediate' means that the node is dimmed without delay */ dimmed?: Base.Dimmed; }; /** * ReactFlow Base Node properties with BaseNodeData at least */ export declare interface BaseNodeProps extends NodeProps { } export declare type BaseNodePropsWithData> = BaseNodeProps>; declare interface Clock { setTimeout(fn: (...args: any[]) => void, timeout: number): any; clearTimeout(id: any): void; } export declare function CompoundActionButton({ data: { hovered: isHovered, }, icon, onClick, }: CompoundActionButtonProps): JSX.Element; declare type CompoundActionButtonProps = Simplify void; }>; export declare const CompoundActions: (props: CompoundActionsProps) => JSX.Element | null; declare type CompoundActionsProps = Types.NodeProps<'compound-deployment' | 'compound-element'>; export declare function CompoundDeploymentNode(props: Types.NodeProps<'compound-deployment'>): JSX.Element; /** * Node that will be used to render the compound from the deployment model. * It is a container node, i.e. it has children. * * Custom node renderer receives these props: * - `nodeProps`: props from XYFlow * - `nodeModel`: LikeC4 {@link NodeModel.WithDeploymentElement} * * @see [Default implementation](https://github.com/likec4/likec4/blob/main/packages/diagram/src/likec4diagram/custom/nodes/nodes.tsx) * * @example * ```tsx * import { * compoundDeploymentNode, * CompoundNodeContainer, * CompoundTitle, * CompoundActions, * CompoundDeploymentToolbar, * DefaultHandles, * } from '@likec4/diagram/custom' * * const CustomCompoundDeploymentNode = compoundDeploymentNode(({ nodeProps, nodeModel }) => ( * * * * * * * * * ``` */ export declare function compoundDeploymentNode(component: FC>): Types.NodeRenderer<'compound-deployment'>; export declare type CompoundDeploymentNodeProps = { nodeProps: Types.NodeProps<'compound-deployment'>; nodeModel: NodeModel.WithDeploymentElement; }; export declare function CompoundDeploymentToolbar(props: Types.NodeProps<'compound-deployment'>): JSX.Element; export declare function CompoundDetailsButton({ data: { hovered: isHovered, }, icon, onClick, }: CompoundDetailsButtonProps): JSX.Element; declare type CompoundDetailsButtonProps = Simplify void; }>; export declare function CompoundDetailsButtonWithHandler(props: Types.NodeProps<'compound-deployment' | 'compound-element'>): JSX.Element | null; export declare function CompoundElementNode(props: Types.NodeProps<'compound-element'>): JSX.Element; /** * Node that will be used to render the compound element from the model. * It is a container node, i.e. it has children. * * Custom node renderer receives these props: * - `nodeProps`: props from XYFlow * - `nodeModel`: LikeC4 {@link NodeModel.WithElement} * * @see [Default implementation](https://github.com/likec4/likec4/blob/main/packages/diagram/src/likec4diagram/custom/nodes/nodes.tsx) * * @example * ```tsx * import { * compoundElementNode, * CompoundNodeContainer, * CompoundTitle, * CompoundActions, * CompoundDetailsButtonWithHandler, * IfEnabled, * CompoundElementToolbar, * DefaultHandles, * } from '@likec4/diagram/custom' * * const CustomCompoundElementNode = compoundElementNode(({ nodeProps, nodeModel }) => ( * * * * * * * * * * * * )) * ``` */ export declare function compoundElementNode(component: FC>): Types.NodeRenderer<'compound-element'>; export declare type CompoundElementNodeProps = { nodeProps: Types.NodeProps<'compound-element'>; nodeModel: NodeModel.WithElement; }; export declare function CompoundElementToolbar(props: Types.NodeProps<'compound-element'>): JSX.Element; export declare function CompoundNodeContainer({ nodeProps: { data: { hovered: isHovered, dimmed: isDimmed, ...data }, }, className, children, style, ...rest }: CompoundNodeContainerProps): JSX.Element; declare type CompoundNodeContainerProps = PropsWithChildren & { layout?: boolean | 'position' | 'size' | 'preserve-aspect'; layoutId?: string | undefined; nodeProps: BaseNodeProps>; }>; export declare function CompoundTitle({ data }: CompoundTitleProps): JSX.Element; declare type CompoundTitleProps = { data: RequiredData_2; }; declare type Compute = { [K in keyof A]: A[K]; } & unknown; declare type ConditionalRequired = Condition extends true ? Required : T; declare type Context = { subject: Fqn; currentView: DiagramView; initiatedFrom: { node: NodeId | null; clientRect: Rect | null; }; }; declare interface Context_2 { subject: Fqn_3; viewId: ViewId_3 | null; scope: 'global' | 'view'; closeable: boolean; enableSelectSubject: boolean; enableChangeScope: boolean; xyflow: XYFLowInstance | null; xystore: XYStoreApi_2 | null; layouted: LayoutRelationshipsViewResult | null; navigateFromNode: string | null; xynodes: RelationshipsBrowserTypes.Node[]; xyedges: RelationshipsBrowserTypes.Edge[]; } declare type Context_3 = Readonly<{ subject: Subject; viewId: ViewId_3; xyflow: XYFLowInstance_2 | null; xystore: XYStoreApi_3 | null; initialized: { xydata: boolean; xyflow: boolean; }; xynodes: RelationshipDetailsTypes.Node[]; xyedges: RelationshipDetailsTypes.Edge[]; bounds: BBox_3; }>; declare type ContextFactory = ({ spawn, input, self }: { spawn: Spawner; input: TInput; self: ActorRef, // TODO: this should be replaced with `TChildren` StateValue, string, unknown, TODO, // TMeta TODO>, TEvent, AnyEventObject>; }) => TContext; export declare function createLikeC4Editor(callbacks: LikeC4EditorCallbacks): LikeC4EditorCallbacks; export declare type CurrentViewModel = LikeC4ViewModel>; declare type Data = { tags: readonly string[] | null | undefined; width: number; }; /** * XYFlow requires handles to be defined on nodes. */ export declare function DefaultHandles({ direction }: { direction?: AutoLayoutDirection | undefined; }): JSX.Element; declare type Delay = TDelay | number; declare type DelayConfig = number | DelayExpr; declare interface DelayedTransitionDefinition extends TransitionDefinition { delay: number | string | DelayExpr; } declare type DelayedTransitions = { [K in Delay]?: string | SingleOrArray>; }; declare type DelayExpr = (args: ActionArgs, params: TParams) => number; declare type DelayFunctionMap = Record>; declare type DependenciesComparator = (a: Deps, b: Deps) => boolean; /** * Center-Bottom action bar, includes zoom-in and browse relationships actions, if the features are enabled. * Intended to be used with deployment elements. * * Use generic {@link ElementActionButtons} for custom action buttons. * * @param extraButtons - Add extra action buttons * * @example * ```tsx * , * onClick: (e) => { * e.stopPropagation() * console.log('extra action clicked') * }, * }, * }, * ]} * /> * ``` */ export declare const DeploymentElementActions: ({ extraButtons, ...props }: DeploymentElementActionsProps) => JSX.Element; declare type DeploymentElementActionsProps = SimplifyDeep<{ selected?: boolean; data: Pick & BaseNodeData; }> & WithExtraButtons; export declare function DeploymentElementToolbar(props: Types.NodeProps<'deployment'>): JSX.Element; declare type DeploymentFqn_2 = t.aux.DeploymentFqn; export declare function DeploymentNode(props: Types.NodeProps<'deployment'>): JSX.Element; /** * Node that will be used to render the element from deployment model. * It is a leaf node, i.e. it does not have children. * Can be {@link DeploymentNodeModel} or {@link DeployedInstanceModel}. * * Custom node renderer receives these props: * - `nodeProps`: props from XYFlow * - `nodeModel`: {@link NodeModel.WithDeploymentElement} * * @see [Default implementation](https://github.com/likec4/likec4/blob/main/packages/diagram/src/likec4diagram/custom/nodes/nodes.tsx) * * @example * ```tsx * import { * deploymentNode, * ElementNodeContainer, * ElementShape, * ElementData, * DeploymentElementActions, * ElementDetailsButtonWithHandler, * IfNotReadOnly, * DeploymentElementToolbar, * DefaultHandles, * } from '@likec4/diagram/custom' * * const CustomDeploymentNode = deploymentNode(({ nodeProps, nodeModel }) => ( * * * * , * onClick: () => console.log('extra'), * }, * ]} * /> * * * * * * * )) * ``` */ export declare function deploymentNode(component: FC>): Types.NodeRenderer<'deployment'>; export declare type DeploymentNodeProps = { nodeProps: Types.NodeProps<'deployment'>; nodeModel: NodeModel.WithDeploymentElement; }; export declare interface DiagramActorRef extends DiagramMachineRef { system: System; } export declare type DiagramActorSnapshot = MachineSnapshot; export declare interface DiagramApi { /** * React ref to the diagram actor */ readonly ref: RefObject; /** * @warning Do not use in render phase */ readonly actor: DiagramActorRef; /** * @warning Do not use in render phase */ readonly currentView: t.DiagramView; /** * Editor actor reference * @warning Do not use in render phase */ editorActor(): EditorActorRef; /** * Overlays actor reference * @warning Do not use in render phase */ overlays(): OverlaysActorRef; /** * Search actor reference * @warning Do not use in render phase */ searchActor(): SearchActorRef; /** * Send event to diagram actor */ send(event: DiagramEvents): void; /** * Navigate to view * @param viewId - Target view ID * @param fromNode - Node from which navigation was triggered * @param focusOnElement - Element FQN to focus after navigation (from search) */ navigateTo(viewId: ViewId_4, fromNode?: NodeId_2, focusOnElement?: Fqn_4): void; /** * Navigate back or forward in history */ navigate(direction: 'back' | 'forward'): void; /** * Fit diagram to view */ fitDiagram(duration?: number): void; /** * Open relationships browser */ openRelationshipsBrowser(fqn: Fqn_4): void; /** * If running in editor, trigger opening source file */ openSource(params: OpenSourceParams): void; /** * Open element details card */ openElementDetails(fqn: Fqn_4, fromNode?: NodeId_2): void; openRelationshipDetails(...params: [edgeId: EdgeId_3] | [source: Fqn_4, target: Fqn_4]): void; updateNodeData(nodeId: NodeId_2, data: PartialDeep): void; updateEdgeData(edgeId: EdgeId_3, data: PartialDeep): void; highlightNode(nodeId: NodeId_2): void; highlightEdge(edgeId: EdgeId_3): void; unhighlightAll(): void; /** * Center viewport on a given node */ centerViewportOnNode(target: NodeId_2): void; /** * Center viewport on a given edge (centering on edge means including both source and target nodes in view) */ centerViewportOnEdge(target: EdgeId_3): void; /** * Start editing, either node or edge */ startEditing(subject: 'node' | 'edge'): void; /** * Stop editing * @param wasChanged - whether there were changes made during editing * @default false */ stopEditing(wasChanged?: boolean): void; /** * Undo last editing operation * @returns true if there was something to undo */ undoEditing(): boolean; /** * Align nodes */ align(mode: AlignmentMode): void; /** * Reset edge control points */ resetEdgeControlPoints(): void; /** * Focus node */ focusNode(nodeId: NodeId_2): void; /** * Focus on element by FQN (finds the node and focuses on it). * Used by search to highlight an element on the current view. */ focusOnElement(elementFqn: Fqn_4): void; /** * @warning Do not use in render phase */ getContext(): DiagramContext; /** * @warning Do not use in render phase */ findDiagramNode(xynodeId: string): t.DiagramNode | null; /** * @warning Do not use in render phase */ findEdge(xyedgeId: string): Types.Edge | null; /** * @warning Do not use in render phase */ findDiagramEdge(xyedgeId: string): t.DiagramEdge | null; startWalkthrough(): void; walkthroughStep(direction?: 'next' | 'previous'): void; stopWalkthrough(): void; toggleFeature(feature: FeatureName, forceValue?: boolean): void; highlightNotation(notation: NodeNotation, kind?: string): void; unhighlightNotation(): void; openSearch(searchValue?: string): void; triggerChange(viewChange: ViewChange): void; /** * Switch dynamic view display variant */ switchDynamicViewVariant(variant: DynamicViewDisplayVariant): void; } export declare interface DiagramContext extends Input { xynodes: Types.Node[]; xyedges: Types.Edge[]; features: EnabledFeatures; toggledFeatures: ToggledFeatures; initialized: { xydata: boolean; xyflow: boolean; }; viewport: Viewport; viewportChangedManually: boolean; /** * Viewport before entering focus mode, walkthrough or printing */ viewportBefore: null | { wasChangedManually: boolean; value: Viewport; }; viewportOnManualLayout: null | Viewport; viewportOnAutoLayout: null | Viewport; lastOnNavigate: null | { fromView: ViewId; toView: ViewId; fromNode: NodeId | null; focusOnElement?: Fqn | null; }; navigationHistory: NavigationHistory; lastClickedNode: null | { id: NodeId; clicks: number; timestamp: number; }; focusedNode: NodeId | null; autoUnfocusTimer: boolean; activeElementDetails: null | { fqn: Fqn; fromNode: NodeId | null; nodeRect?: Rect | null; nodeRectScreen?: Rect | null; }; xyflow: XYFlowInstance | null; dynamicViewVariant: DynamicViewDisplayVariant; activeWalkthrough: null | { stepId: StepEdgeId; parallelPrefix: string | null; }; } export declare type DiagramEmittedEvents = { type: 'initialized'; instance: XYFlowInstance; } | { type: 'navigateTo'; viewId: ViewId; } | { type: 'openSource'; params: OpenSourceParams; } | { type: 'paneClick'; } | { type: 'nodeClick'; node: DiagramNode; xynode: Types.Node; } | { type: 'edgeClick'; edge: DiagramEdge; xyedge: Types.Edge; } | { type: 'edgeMouseEnter'; edge: Types.Edge; event: MouseEvent_2; } | { type: 'edgeMouseLeave'; edge: Types.Edge; event: MouseEvent_2; } | { type: 'walkthroughStarted'; edge: Types.Edge; } | { type: 'walkthroughStep'; edge: Types.Edge; } | { type: 'walkthroughStopped'; } | { type: 'onLayoutTypeChange'; layoutType: LayoutType; }; declare type DiagramEventHandlersContext = RequiredOrNull & { handlersRef: DiagramEventHandlersRef; }; declare type DiagramEventHandlersRef = RefObject>; export declare type DiagramEvents = HotKeyEvent | MediaPrintEvent | { type: 'xyflow.init'; instance: XYFlowInstance; } | { type: 'xyflow.applyChanges'; edges?: EdgeChange[]; nodes?: NodeChange[]; } | { type: 'xyflow.viewportMoved'; viewport: Viewport; manually: boolean; } | { type: 'xyflow.nodeClick'; node: Types.Node; } | { type: 'xyflow.edgeClick'; edge: Types.Edge; } | { type: 'xyflow.edgeDoubleClick'; edge: Types.Edge; } | { type: 'xyflow.paneClick'; } | { type: 'xyflow.paneDblClick'; } | { type: 'xyflow.resized'; } | { type: 'xyflow.nodeMouseEnter'; node: Types.Node; } | { type: 'xyflow.nodeMouseLeave'; node: Types.Node; } | { type: 'xyflow.edgeMouseEnter'; edge: Types.Edge; event: MouseEvent_2; } | { type: 'xyflow.edgeMouseLeave'; edge: Types.Edge; event: MouseEvent_2; } | { type: 'xyflow.fitDiagram'; duration?: number; bounds?: BBox_2; } | { type: 'xyflow.setViewport'; duration?: number; viewport: Viewport; } | { type: 'xyflow.centerViewport'; nodeId: NodeId; duration?: number; } | { type: 'xyflow.centerViewport'; edgeId: EdgeId; duration?: number; } | { type: 'update.nodeData'; nodeId: NodeId; data: PartialDeep; } | { type: 'update.edgeData'; edgeId: EdgeId; data: PartialDeep; } | { type: 'update.view'; view: DiagramView; source?: 'editor' | 'external'; } | { type: 'update.view'; view: DiagramView; source?: 'editor' | 'external'; xynodes: Types.Node[]; xyedges: Types.Edge[]; } | { type: 'update.view-bounds'; bounds: BBox_2; } | { type: 'update.inputs'; inputs: Partial>; } | { type: 'update.features'; features: EnabledFeatures; } | ({ type: 'open.source'; } & OpenSourceParams) | { type: 'open.elementDetails'; fqn: Fqn; fromNode?: NodeId | undefined; } | { type: 'open.relationshipDetails'; params: { edgeId: EdgeId; } | { source: Fqn; target: Fqn; }; } | { type: 'open.relationshipsBrowser'; fqn: Fqn; } | { type: 'open.search'; search?: string; } | { type: 'navigate.to'; viewId: ViewId; fromNode?: NodeId | undefined; focusOnElement?: Fqn | undefined; } | { type: 'navigate.back'; } | { type: 'navigate.forward'; } | { type: 'layout.align'; mode: AlignmentMode; } | { type: 'layout.resetEdgeControlPoints'; } | { type: 'layout.resetManualLayout'; } | { type: 'focus.node'; nodeId: NodeId; autoUnfocus?: boolean; } | { type: 'focus.autoUnfocus'; } | { type: 'switch.dynamicViewVariant'; variant: DynamicViewDisplayVariant; } | { type: 'walkthrough.start'; stepId?: StepEdgeId; } | { type: 'walkthrough.step'; direction: 'next' | 'previous'; } | { type: 'walkthrough.end'; } | { type: 'highlight.node'; nodeId: NodeId; } | { type: 'highlight.edge'; edgeId: EdgeId; } | { type: 'unhighlight.all'; } | { type: 'notations.highlight'; notation: NodeNotation; kind?: string; } | { type: 'notations.unhighlight'; } | { type: 'tag.highlight'; tag: string; } | { type: 'tag.unhighlight'; } | { type: 'toggle.feature'; feature: TogglableFeature; forceValue?: boolean; } | { type: 'trigger.change'; change: ViewChange; } | { type: 'emit.onLayoutTypeChange'; layoutType: LayoutType; } | { type: 'destroy'; }; declare interface DiagramMachineRef extends ActorRef { } export declare type DiagramNodeWithNavigate = SetRequired, 'navigateTo'>; declare type DistributeActors = TSpecificActor extends { src: infer TSrc; } ? Compute<{ systemId?: string; /** The source of the machine to be invoked, or the machine itself. */ src: TSrc; /** * The unique identifier for the invoked machine. If not specified, * this will be the machine's own `id`, or the URL (from `src`). */ id?: TSpecificActor['id']; input?: Mapper, TEvent> | InputFrom; /** * The transition to take upon the invoked child machine reaching * its final top-level state. */ onDone?: string | SingleOrArray>, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>>; /** * The transition to take upon the invoked child machine sending an * error event. */ onError?: string | SingleOrArray>; onSnapshot?: string | SingleOrArray>, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>>; } & { [K in RequiredActorOptions]: unknown; }> | { id?: never; systemId?: string; src: AnyActorLogic; input?: Mapper | NonReducibleUnknown; onDone?: string | SingleOrArray, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>>; onError?: string | SingleOrArray>; onSnapshot?: string | SingleOrArray>; } : never; declare interface DoneActorEvent extends EventObject { type: `xstate.done.actor.${TId}`; output: TOutput; actorId: TId; } declare interface DoneMachineSnapshot, TStateValue extends StateValue, TTag extends string, TOutput, TMeta extends MetaObject, TStateSchema extends StateSchema> extends MachineSnapshotBase { status: 'done'; output: TOutput; error: undefined; } declare interface DoneStateEvent extends EventObject { type: `xstate.done.state.${string}`; output: TOutput; } declare type DoNotInfer = [T][T extends any ? 0 : any]; declare type EdgeId_3 = t.aux.EdgeId; declare interface EditorActorContext { viewId: t.ViewId; history: LinkedSnapshot | null; editing: null | { /** * The subject of the edit */ subject: 'node' | 'edge'; /** * The state before editing started */ before: Snapshot_2; }; syncQueue: Array; processing: Exclude | null; } declare type EditorActorEmitedEvent = { type: 'idle'; }; declare type EditorActorEvent = { type: 'change.view'; change: t.ViewChange; } | { type: 'change.semantic-layout'; } | { type: 'change.latest-to-manual'; } | { type: 'change.sync-snapshot'; } | { type: 'view.synched'; } | { type: 'cancel'; } | { type: 'edit.move.start'; subject: 'node' | 'edge'; } | { type: 'edit.move.end'; } | { type: 'edit.move.cancel'; } | HotKeyEvent_2; declare interface EditorActorInput { viewId: t.ViewId; } declare interface EditorActorLogic extends StateMachine { } declare interface EditorActorRef extends ActorRef { } declare type EditorActorSnapshot = SnapshotFrom; declare type EditorActorStateTag = 'pending' | 'busy' | 'ai-semantic-layout'; declare type EffectCallback_2 = (...args: any[]) => any; declare type EffectHook = ((...args: [Callback, Deps, ...RestArgs]) => void) | ((...args: [Callback, Deps]) => void); /** * Center-Bottom bar with action buttons. Intended to be used inside "leaf" nodes. * * @param selected - Whether the node is selected * @param data - Node data * @param buttons - Action buttons * * @example * ```tsx * , * onClick: (e) => { * e.stopPropagation() * console.log('action1 clicked') * }, * }, * //... * ]} * /> * ``` */ export declare function ElementActionButtons({ selected, data: { hovered: isHovered, }, buttons, }: ElementActionButtonsProps): JSX.Element | null; export declare namespace ElementActionButtons { export type Item = { key?: string; icon?: ReactNode; onClick: (e: MouseEvent_2) => void; }; } declare type ElementActionButtonsProps = { selected?: boolean; data: { hovered?: boolean; }; buttons: ElementActionButtons.Item[]; }; /** * Center-Bottom action bar, includes zoom-in and browse relationships actions, if the features are enabled. * Intended to be used with model elements. * * Use generic {@link ElementActionButtons} for custom action buttons. * * @param extraButtons - Add extra action buttons * * @example * ```tsx * , * onClick: (e) => { * e.stopPropagation() * console.log('extra action clicked') * }, * }, * }, * ]} * /> * ``` */ export declare function ElementActions({ extraButtons, ...props }: ElementActionsProps): JSX.Element; declare type ElementActionsProps = SimplifyDeep<{ selected?: boolean; data: Pick & BaseNodeData; }> & WithExtraButtons; /** * Renders an element title, technology, description, and icon. * * @example * ```tsx * * ``` * or * ```tsx * * * * * * * * * ``` */ export declare function ElementData({ data }: ElementDataProps): JSX.Element; export declare namespace ElementData { var Root: ForwardRefExoticComponent & ElementDataProps & RefAttributes>; var Icon: ({ data, ...props }: IconProps) => JSX.Element; var Content: ForwardRefExoticComponent, HTMLDivElement>, "ref"> & RefAttributes>; var Title: ForwardRefExoticComponent>; var Technology: ForwardRefExoticComponent<((Without & { children?: ReactNode | undefined; }) | (Without< { children?: ReactNode | undefined; }, SlotProps> & SlotProps)) & RefAttributes>; var Description: ForwardRefExoticComponent>; } declare type ElementDataProps = { data: RequiredData_3; }; declare interface ElementDetailsActorRef extends ActorRef { } export declare function ElementDetailsButton({ selected, data: { hovered: isHovered, }, icon, onClick, }: ElementDetailsButtonProps): JSX.Element; declare type ElementDetailsButtonProps = { selected?: boolean; data: BaseNodeData; icon?: ReactNode; onClick: (e: MouseEvent_2) => void; }; export declare function ElementDetailsButtonWithHandler(props: { id: string; selected?: boolean; data: BaseNodeData & { modelFqn?: Fqn_3 | null | undefined; }; }): JSX.Element | null; declare interface ElementDetailsLogic extends StateMachine { } declare type ElementDetailsSnapshot = SnapshotFrom; export declare type ElementIconRenderer = (props: ElementIconRendererProps) => ReactNode; export declare type ElementIconRendererProps = { node: { id: string; title: string; icon?: string | null | undefined; }; className?: string; }; /** * Renders an element node. */ export declare function ElementNode(props: Types.NodeProps<'element'>): JSX.Element; /** * Node that will be used to render the element from the model. * It is a leaf node, i.e. it does not have children. * * Custom node renderer receives these props: * - `nodeProps`: props from XYFlow * - `nodeModel`: LikeC4 {@link NodeModel.WithElement} * * @see [Default implementation](https://github.com/likec4/likec4/blob/main/packages/diagram/src/likec4diagram/custom/nodes/nodes.tsx) * * @example * ```tsx * import { * elementNode, * ElementNodeContainer, * ElementShape, * ElementData, * ElementActions, * ElementDetailsButtonWithHandler, * IfEnabled, * IfNotReadOnly, * ElementToolbar, * DefaultHandles, * ElementTags * } from '@likec4/diagram/custom' * * const CustomElementNode = elementNode(({ nodeProps, nodeModel }) => ( * * * * * * * , * onClick: () => console.log('extra'), * }, * ]} * /> * * {nodeModel.element.getMetadata('your-attr') === 'value' && } * * * * * * )) * ``` */ export declare function elementNode(component: FC>): Types.NodeRenderer<'element'>; /** * Top-level primitive to compose leaf nodes renderers. * This container provides the state via data-* attributes */ export declare const ElementNodeContainer: ForwardRefExoticComponent<{ [key: `data-${string}`]: string | undefined; nodeProps: BaseNodePropsWithData; className?: string | undefined; style?: MotionStyle | undefined; } & MotionNodeLayoutOptions & { children?: ReactNode | undefined; } & RefAttributes>; export declare type ElementNodeProps = { nodeProps: Types.NodeProps<'element'>; nodeModel: NodeModel.WithElement; }; export declare function ElementShape({ data, width, height, showSelectionOutline }: ElementShapeProps): JSX.Element; declare type ElementShapeProps = { data: RequiredData_5; width?: number | undefined; height?: number | undefined; /** * @default true */ showSelectionOutline?: boolean | undefined; }; export declare const ElementTag: ForwardRefExoticComponent<{ tag: string; cursor?: "pointer" | "default"; } & Omit, HTMLDivElement>, "ref">, "color" | "children"> & RefAttributes>; export declare const ElementTags: MemoExoticComponent<({ id, data: { tags, width, hovered }, onTagClick, onTagMouseEnter, onTagMouseLeave }: ElementTagsProps) => JSX.Element | null>; declare type ElementTagsProps = BaseNodePropsWithData & { onTagClick?: (tag: `#${string}`) => void; onTagMouseEnter?: (tag: `#${string}`) => void; onTagMouseLeave?: (tag: `#${string}`) => void; }; export declare function ElementToolbar(props: Types.NodeProps<'element' | 'seq-actor'> & { data: { modelFqn: Fqn; }; }): JSX.Element; declare type EmittedFrom = TLogic extends ActorLogic ? TEmitted : never; export declare type EnabledFeatures = { [P in `enable${FeatureName}`]: boolean; }; declare type Equals = (() => A extends A2 ? true : false) extends () => A extends A1 ? true : false ? true : false; declare interface ErrorActorEvent extends EventObject { type: `xstate.error.actor.${TId}`; error: TErrorData; actorId: TId; } declare interface ErrorMachineSnapshot, TStateValue extends StateValue, TTag extends string, TOutput, TMeta extends MetaObject, TStateSchema extends StateSchema> extends MachineSnapshotBase { status: 'error'; output: undefined; error: unknown; } declare type EventDescriptor = TEvent['type'] | PartialEventDescriptor | '*'; declare type EventDescriptorMatches = TEventType extends TNormalizedDescriptor ? true : false; declare type EventFromLogic = TLogic extends ActorLogic ? TEvent : never; /** The full definition of an event, with a string `type`. */ declare type EventObject = { /** The type of event that is sent. */ type: string; }; declare type Events = { type: 'change.subject'; subject: Fqn; } | { type: 'close'; }; declare type Events_2 = { type: 'xyflow.init'; instance: XYFLowInstance; store: XYStoreApi_2; } | { type: 'xyflow.nodeClick'; node: RelationshipsBrowserTypes.Node; } | { type: 'xyflow.edgeClick'; edge: RelationshipsBrowserTypes.Edge; } | { type: 'xyflow.applyNodeChanges'; changes: NodeChange_2[]; } | { type: 'xyflow.applyEdgeChanges'; changes: EdgeChange_2[]; } | { type: 'xyflow.paneClick'; } | { type: 'xyflow.paneDblClick'; } | { type: 'xyflow.resized'; } | { type: 'xyflow.edgeMouseEnter'; edge: RelationshipsBrowserTypes.Edge; } | { type: 'xyflow.edgeMouseLeave'; edge: RelationshipsBrowserTypes.Edge; } | { type: 'xyflow.selectionChange'; nodes: RelationshipsBrowserTypes.Node[]; edges: RelationshipsBrowserTypes.Edge[]; } | { type: 'dim.nonhovered.edges'; } | { type: 'undim.edges'; } | { type: 'xyflow.updateNodeInternals'; } | { type: 'xyflow.unmount'; } | { type: 'fitDiagram'; duration?: number; bounds?: BBox_3; } | { type: 'navigate.to'; subject: Fqn_3; fromNode?: string | undefined; viewId?: ViewId_3 | undefined; } | { type: 'update.xydata'; xynodes: RelationshipsBrowserTypes.Node[]; xyedges: RelationshipsBrowserTypes.Edge[]; } | { type: 'change.scope'; scope: 'global' | 'view'; } | { type: 'update.view'; layouted: LayoutRelationshipsViewResult; } | { type: 'close'; }; declare type Events_3 = { type: 'xyflow.init'; instance: XYFLowInstance_2; store: XYStoreApi_3; } | { type: 'xyflow.nodeClick'; node: RelationshipDetailsTypes.Node; } | { type: 'xyflow.edgeClick'; edge: RelationshipDetailsTypes.Edge; } | { type: 'xyflow.edgeMouseEnter'; edge: RelationshipDetailsTypes.Edge; } | { type: 'xyflow.edgeMouseLeave'; edge: RelationshipDetailsTypes.Edge; } | { type: 'dim.nonhovered.edges'; } | { type: 'undim.edges'; } | { type: 'xyflow.selectionChange'; nodes: RelationshipDetailsTypes.Node[]; edges: RelationshipDetailsTypes.Edge[]; } | { type: 'xyflow.applyNodeChanges'; changes: NodeChange_2[]; } | { type: 'xyflow.applyEdgeChanges'; changes: EdgeChange_2[]; } | { type: 'xyflow.paneClick'; } | { type: 'xyflow.paneDblClick'; } | { type: 'xyflow.resized'; } | { type: 'xyflow.updateNodeInternals'; } | { type: 'update.layoutData'; data: LayoutResult; } | { type: 'fitDiagram'; duration?: number; bounds?: BBox_3; } | { type: 'navigate.to'; params: { edgeId: EdgeId_2; viewId?: ViewId_3; } | { source: Fqn_3; target: Fqn_3; viewId?: ViewId_3; }; } | { type: 'close'; }; declare interface ExecutableActionObject { type: string; info: ActionArgs; params: NonReducibleUnknown; exec: ((info: ActionArgs, params: unknown) => void) | undefined; } declare type ExtractEvent> = string extends TEvent['type'] ? TEvent : NormalizeDescriptor extends infer TNormalizedDescriptor ? TEvent extends any ? true extends EventDescriptorMatches ? TEvent : never : never : never; export declare type FeatureName = typeof FeatureNames[number]; declare const FeatureNames: readonly ["Controls", "Editor", "AISemanticLayout", "ReadOnly", "FocusMode", "NavigateTo", "ElementDetails", "RelationshipDetails", "RelationshipBrowser", "Search", "NavigationButtons", "Notations", "DynamicViewWalkthrough", "FitView", "CompareWithLatest", "Notes", "Vscode", "ElementTags"]; declare type Fqn_2 = t.aux.Fqn; declare type Fqn_4 = t.aux.Fqn; export declare const FramerMotionConfig: ({ reducedMotion, children, }: PropsWithChildren<{ /** * If true, will respect the device prefersReducedMotion setting by switching * transform animations off. */ reducedMotion?: "always" | "never" | "user" | undefined; }>) => JSX.Element; declare type GetConcreteByKey = T & Record; declare type GetParameterizedParams = T extends any ? ('params' extends keyof T ? T['params'] : undefined) : never; declare type GridAlignmentMode = 'Column' | 'Row'; declare type Guard = NoRequiredParams | WithDynamicParams | GuardPredicate; declare interface GuardArgs { context: TContext; event: TExpressionEvent; } declare type GuardMap = { [K in TGuard['type']]?: GuardPredicate, TGuard>; }; declare type GuardPredicate = { (args: GuardArgs, params: TParams): boolean; _out_TGuard?: TGuard; }; declare type HistoryValue = Record>>; declare type HotKeyEvent = { type: 'key.esc' | `key.arrow.${'left' | 'right' | 'up' | 'down'}`; }; declare type HotKeyEvent_2 = { type: 'undo'; }; declare type IconProps = { data: { id: string; title: string; icon?: string | null | undefined; }; className?: string; style?: CSSProperties; }; /** * Provider for custom element icon renderers * * @example * ```tsx * const MyIconRenderer: ElementIconRenderer = ({ node }) => { * return
{node.title}
* } * * * * * ``` */ export declare function IconRendererProvider({ value, children, }: PropsWithChildren<{ value: ElementIconRenderer | null; }>): JSX.Element; /** * Renders children only if the specified feature is enabled * @param feature Feature name * @param and Additional AND condition * @example * * ... * */ export declare function IfEnabled({ feature, children, and, }: PropsWithChildren<{ feature: FeatureName; and?: boolean; }>): JSX.Element | null; export declare function IfNotEnabled({ feature, children }: PropsWithChildren<{ feature: FeatureName; }>): JSX.Element | null; export declare function IfNotReadOnly({ children }: PropsWithChildren): JSX.Element | null; export declare function IfReadOnly({ children }: PropsWithChildren): JSX.Element | null; declare type InitialContext = TContext | ContextFactory; declare interface InitialTransitionConfig extends TransitionConfig { target: string; } declare interface InitialTransitionDefinition extends TransitionDefinition { target: ReadonlyArray>; guard?: never; } declare interface Input { view: DiagramView; xystore: XYStoreApi; zoomable: boolean; pannable: boolean; nodesDraggable: boolean; nodesSelectable: boolean; fitViewPadding: ViewPaddings; where: WhereOperator | null; dynamicViewVariant?: DynamicViewDisplayVariant | undefined; features?: EnabledFeatures; } declare type Input_2 = { subject: Fqn; currentView: DiagramView; initiatedFrom?: { node?: NodeId; clientRect?: Rect; }; }; declare type Input_3 = { subject: Fqn_3; viewId: ViewId_3 | null; scope: 'global' | 'view'; closeable?: boolean; enableSelectSubject?: boolean; enableChangeScope?: boolean; }; declare type Input_4 = ExclusiveUnion_2<{ Edge: { edgeId: EdgeId_2; viewId: ViewId_3; }; Between: { source: Fqn_3; target: Fqn_3; viewId: ViewId_3; }; }>; declare type InputFrom = T extends StateMachine ? TInput : T extends ActorLogic ? TInput : never; declare interface InspectedActionEvent extends BaseInspectionEventProperties { type: '@xstate.action'; action: { type: string; params: unknown; }; } declare interface InspectedActorEvent extends BaseInspectionEventProperties { type: '@xstate.actor'; } declare interface InspectedEventEvent extends BaseInspectionEventProperties { type: '@xstate.event'; sourceRef: ActorRefLike | undefined; event: AnyEventObject; } declare interface InspectedMicrostepEvent extends BaseInspectionEventProperties { type: '@xstate.microstep'; event: AnyEventObject; snapshot: Snapshot; _transitions: AnyTransitionDefinition[]; } declare interface InspectedSnapshotEvent extends BaseInspectionEventProperties { type: '@xstate.snapshot'; event: AnyEventObject; snapshot: Snapshot; } declare type InspectionEvent = InspectedSnapshotEvent | InspectedEventEvent | InspectedActorEvent | InspectedMicrostepEvent | InspectedActionEvent; declare type InternalMachineImplementations = { actions?: MachineImplementationsActions; actors?: MachineImplementationsActors; delays?: MachineImplementationsDelays; guards?: MachineImplementationsGuards; }; declare interface InteropObservable { [Symbol.observable]: () => InteropSubscribable; } declare interface InteropSubscribable { subscribe(observer: Observer): Subscription; } declare type InvokeConfig = IsLiteralString extends true ? DistributeActors : { /** * The unique identifier for the invoked machine. If not specified, this * will be the machine's own `id`, or the URL (from `src`). */ id?: string; systemId?: string; /** The source of the machine to be invoked, or the machine itself. */ src: AnyActorLogic | string; input?: Mapper | NonReducibleUnknown; /** * The transition to take upon the invoked child machine reaching its * final top-level state. */ onDone?: string | SingleOrArray, // TODO: consider replacing with `unknown` TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>>; /** * The transition to take upon the invoked child machine sending an * error event. */ onError?: string | SingleOrArray>; onSnapshot?: string | SingleOrArray>; }; declare interface InvokeDefinition { id: string; systemId: string | undefined; /** The source of the actor logic to be invoked */ src: AnyActorLogic | string; input?: Mapper | NonReducibleUnknown; /** * The transition to take upon the invoked child machine reaching its final * top-level state. */ onDone?: string | SingleOrArray, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TMeta>>; /** * The transition to take upon the invoked child machine sending an error * event. */ onError?: string | SingleOrArray>; onSnapshot?: string | SingleOrArray>; toJSON: () => Omit, 'onDone' | 'onError' | 'toJSON'>; } declare type IsLiteralString = string extends T ? false : true; declare type IsNever = [T] extends [never] ? true : false; declare type IsNotNever = [T] extends [never] ? false : true; declare type LayoutRelationshipsViewResult = { subject: Fqn; subjectExistsInScope: boolean; nodes: LayoutRelationshipsViewResult.Node[]; edges: LayoutRelationshipsViewResult.Edge[]; bounds: DiagramView['bounds']; }; declare namespace LayoutRelationshipsViewResult { const Empty: ElementKind; type Node = Omit & { description: MarkdownOrString | null; column: RelationshipsBrowserTypes.Column; ports: RelationshipsBrowserTypes.Ports; existsInCurrentView: boolean; }; type Edge = Omit & { sourceFqn: Fqn; targetFqn: Fqn; sourceHandle: string; targetHandle: string; existsInCurrentView: boolean; }; } declare type LayoutResult = { nodes: LayoutResult.Node[]; edges: LayoutResult.Edge[]; bounds: DiagramView['bounds']; }; declare namespace LayoutResult { type Node = Except & { description: MarkdownOrString | null; modelRef: Fqn; column: RelationshipDetailsTypes.Column; ports: RelationshipDetailsTypes.Ports; }; type Edge = Except & { relationId: RelationId_2; sourceHandle: string; targetHandle: string; description: MarkdownOrString | null; }; } export declare interface LikeC4BrowserProps { /** * Background pattern for the browser view. * @default 'dots' */ background?: 'dots' | 'lines' | 'cross' | 'transparent' | 'solid' | undefined; /** * Padding around the diagram * @default '16px' */ fitViewPadding?: PaddingWithUnit | undefined; /** * Show/hide panel with top left controls, * * @default true */ controls?: boolean | undefined; /** * Show back/forward navigation buttons * @default true */ showNavigationButtons?: undefined | boolean; /** * Enable search popup for elements and views * @default true */ enableSearch?: boolean | undefined; /** * If double click on a node should enable focus mode * * @default true */ enableFocusMode?: boolean | undefined; /** * If Walkthrough for dynamic views should be enabled * @default true */ enableDynamicViewWalkthrough?: boolean | undefined; /** * Default dynamic view display variant * @default 'diagram' */ dynamicViewVariant?: t.DynamicViewDisplayVariant | undefined; /** * Enable popup with element details * @default true */ enableElementDetails?: boolean | undefined; /** * Experimental feature to browse relationships * * @default true */ enableRelationshipBrowser?: boolean | undefined; /** * Display dropdown with details on relationship's label click * @default enableRelationshipBrowser */ enableRelationshipDetails?: boolean | undefined; /** * Display element tags in the bottom left corner * @default true */ enableElementTags?: boolean | undefined; /** * Display notations of the view * @default true */ enableNotations?: boolean | undefined; /** * Enable "Compare with auto layout" action when view was manually modified and out of sync with latest model * @default true */ enableCompareWithLatest?: boolean | undefined; /** * Display element notes, if they are present in the view * * @default true */ enableNotes?: boolean | undefined; /** * Improve performance by hiding certain elements and reducing visual effects (disable mix-blend, shadows, animations) * * @default 'auto' - will be set to true if view is pannable and has more than 3000 * 2000 pixels */ reduceGraphics?: 'auto' | boolean | undefined; className?: string | undefined; style?: CSSProperties | undefined; /** * Override some react flow props */ reactFlowProps?: OverrideReactFlowProps | undefined; /** * Children to render inside the browser overlay */ children?: ReactNode | undefined; } export declare type LikeC4ColorScheme = 'light' | 'dark'; /** * Low-level component to display LikeC4 view * Expects CSS to be injected * * Use {@link ReactLikeC4} or {@link LikeC4View} for ready-to-use component */ export declare function LikeC4Diagram
({ onCanvasClick, onCanvasContextMenu, onCanvasDblClick, onEdgeClick, onEdgeContextMenu, onNavigateTo, onNodeClick, onNodeContextMenu, onOpenSource, onLogoClick, onLayoutTypeChange, onInitialized, view, className, controls, fitView, fitViewPadding: _fitViewPadding, pannable, zoomable, background, enableElementTags, enableFocusMode, enableElementDetails, enableRelationshipDetails, enableRelationshipBrowser, enableCompareWithLatest, nodesSelectable, enableNotations, showNavigationButtons, enableDynamicViewWalkthrough, dynamicViewVariant, enableSearch, enableNotes, initialWidth, initialHeight, reduceGraphics, renderIcon, where, reactFlowProps, renderNodes, children, }: LikeC4DiagramProps): JSX.Element; export declare interface LikeC4DiagramEventHandlers { onNavigateTo?: OnNavigateTo | null | undefined; onNodeClick?: OnNodeClick | null | undefined; onNodeContextMenu?: OnNodeClick | null | undefined; onCanvasContextMenu?: OnCanvasContextMenu | null | undefined; onEdgeClick?: OnEdgeClick | null | undefined; onEdgeContextMenu?: OnEdgeClick | null | undefined; onCanvasClick?: OnCanvasClick | null | undefined; onCanvasDblClick?: OnCanvasClick | null | undefined; onLogoClick?: null | undefined | (() => void); onOpenSource?: OnOpenSource | null | undefined; onInitialized?: OnInitialized | null | undefined; /** * Triggered when user changes layout type (e.g. from 'manual' to 'auto') * Expected another `view` to be passed to the diagram * * @param layoutType new layout type */ onLayoutTypeChange?: OnLayoutTypeChange | null | undefined; } export declare interface LikeC4DiagramProperties { view: LayoutedView; className?: string | undefined; /** * Enable/disable panning * @default true */ pannable?: boolean | undefined; /** * Enable/disable zooming * @default true */ zoomable?: boolean | undefined; /** * Show/hide panel with top left controls * * @default true */ controls?: boolean | undefined; /** * If set, initial viewport will show all nodes & edges * @default true */ fitView?: boolean | undefined; /** * Padding around the diagram (number - pixels) * @default 16 - 16px * * @see {@link ViewPadding} * * @example * ```tsx * * * * ``` */ fitViewPadding?: ViewPadding | undefined; /** * If not readonly, or `enableFocusMode`, `onNavigateTo` or `onNodeClick` are set - nodes will be selectable * * @default false */ nodesSelectable?: boolean | undefined; /** * Initial width of the diagram * (supposed to be used during SSR) */ initialWidth?: number | undefined; /** * Initial height of the diagram * (supposed to be used during SSR) */ initialHeight?: number | undefined; /** * Background pattern * @default 'dots' */ background?: 'transparent' | 'solid' | 'dots' | 'lines' | 'cross' | undefined; /** * Show back/forward history navigation buttons * @default true if `onNavigateTo` is set */ showNavigationButtons?: undefined | boolean; /** * Display notations in the bottom right corner * (Active if only notations are present) * * @default false */ enableNotations?: boolean | undefined; /** * Display dropdown with details on relationship's label click * @default false */ enableRelationshipDetails?: boolean | undefined; /** * If double click on a node should enable focus mode, i.e. highlight incoming/outgoing edges * @default false */ enableFocusMode?: boolean | undefined; /** * Enable search popup for elements and views * @default true */ enableSearch?: boolean | undefined; /** * Enable modal with element details * @default false */ enableElementDetails?: boolean | undefined; /** * Experimental feature to browse relationships * * @default false */ enableRelationshipBrowser?: boolean | undefined; /** * If Walkthrough for dynamic views should be enabled * @default false */ enableDynamicViewWalkthrough?: boolean | undefined; /** * Enable "Compare with auto layout" action when view was manually modified and out of sync with latest model * @default true if `onLayoutTypeChange` is set, false otherwise */ enableCompareWithLatest?: boolean | undefined; /** * Default dynamic view display variant * @default 'diagram' */ dynamicViewVariant?: DynamicViewDisplayVariant | undefined; /** * Display element tags in the bottom left corner * @default false */ enableElementTags?: boolean | undefined; /** * Display element notes, if they are present in the view * * @default true */ enableNotes?: boolean | undefined; /** * Improve performance by hiding certain elements and reducing visual effects (disable mix-blend, shadows, animations) * Enable it if you have a large or static view * - `auto` - will be `true` if view has more then 3000 * 2000 pixels * * @default 'auto' */ reduceGraphics?: 'auto' | boolean | undefined; /** * Render icon for an element, bundled or remote * By default, if icon is http:// or https://, it will be rendered as an image * * Consider using `IconRendererProvider` */ renderIcon?: ElementIconRenderer | undefined; /** * Override node renderers */ renderNodes?: NodeRenderers | undefined; /** * Dynamic filter, applies both to nodes and edges */ where?: WhereOperator | undefined; /** * Override ReactFlow props */ reactFlowProps?: OverrideReactFlowProps | undefined; } export declare type LikeC4DiagramProps = PropsWithChildren & LikeC4DiagramEventHandlers>; /** * Callbacks from LikeC4 Editor. */ export declare interface LikeC4EditorCallbacks { /** * Apply semantic layout to a view (if AI is available) * See vite-plugin settings for more details */ applySemanticLayout?: undefined | ((viewId: t.ViewId) => Promise); /** * Fetch a view by its ID and layout type. * * @param viewId - The ID of the view to fetch. * @param layout - The layout type to use when fetching the view. */ fetchView(viewId: t.ViewId, layout?: t.LayoutType): t.LayoutedView | Promise; /** * Callback invoked when the view changes. */ handleChange(viewId: t.ViewId, change: t.ViewChange): void | Promise; } /** * Provider for the LikeC4 Editor. * @example * ```tsx * * // Not required to use memo for editor callbacks * const editor = createLikeC4Editor({ * fetchView: async (viewId, layout) => { * // fetch view logic * }, * handleChange: (viewId, change) => { * // handle change logic * } * }) * * * * * ``` */ export declare function LikeC4EditorProvider({ children, editor }: LikeC4EditorProviderProps): JSX.Element; export declare type LikeC4EditorProviderProps = PropsWithChildren<{ editor: LikeC4EditorCallbacks; }>; /** * Ensures LikeC4Model context */ export declare function LikeC4ModelProvider({ children, likec4model, }: PropsWithChildren): JSX.Element; export declare interface LikeC4ModelProviderProps { likec4model: LikeC4Model; } declare type LikeC4ProjectsContext = { projects: ReadonlyArray; onProjectChange: (id: ProjectId) => void; }; export declare function LikeC4ProjectsOverview({ view, className, onNavigateToProject, ...props }: LikeC4ProjectsOverviewProps): JSX.Element; export declare type LikeC4ProjectsOverviewProps = Simplify; /** * Ensures LikeC4Projects context */ export declare function LikeC4ProjectsProvider({ children, projects, onProjectChange: _onProjectChange, }: PropsWithChildren): JSX.Element; export declare interface LikeC4ProjectsProviderProps { /** * Projects to be used in the navigation panel. * Current project is taken from the LikeC4Model */ projects: ReadonlyArray; /** * Optional callback when another project is selected. */ onProjectChange?: (id: ProjectId) => void; } /** * Ready-to-use component to display embedded LikeC4 view, * OnClick allows to browse the model. * * {@link ReactLikeC4} gives you more control. * * Component is wrapped in ShadowRoot to isolate styles. */ export declare function LikeC4View({ viewId, className, pannable, zoomable, keepAspectRatio, colorScheme, injectFontCss, controls, layoutType: initialLayoutType, background, browser, showNavigationButtons, enableNotations, enableFocusMode, enableDynamicViewWalkthrough, enableElementDetails, enableRelationshipDetails, enableRelationshipBrowser, enableNotes, reduceGraphics, mantineTheme, styleNonce, style, reactFlowProps, renderNodes, children, ...props }: LikeC4ViewProps): JSX.Element; export declare interface LikeC4ViewProps { /** * View to display. */ viewId: t.aux.ViewId; /** * Layout to display * - `auto`: auto-layouted from the current sources * - `manual`: manually layouted (if available, falls back to `auto`) * * @default 'manual' */ layoutType?: t.LayoutType | undefined; /** * Enable/disable panning * @default false */ pannable?: boolean | undefined; /** * Enable/disable zooming * @default false */ zoomable?: boolean | undefined; /** * @default true */ keepAspectRatio?: boolean | undefined; /** * Background pattern * @default 'transparent' */ background?: 'dots' | 'lines' | 'cross' | 'transparent' | 'solid' | undefined; /** * Click on the view opens a modal with browser. * You can customize or disable the browser. * * @default true */ browser?: boolean | LikeC4BrowserProps | undefined; /** * @default - determined by the user's system preferences. */ colorScheme?: 'light' | 'dark' | undefined; /** * LikeC4 views are using 'IBM Plex Sans' font. * By default, component injects the CSS to document head. * Set to false if you want to handle the font yourself. * * @default true */ injectFontCss?: boolean | undefined; /** * Show/hide panel with top left controls, * @default false */ controls?: boolean | undefined; /** * If set, initial viewport will show all nodes & edges * @default true */ fitView?: boolean | undefined; /** * Padding around the diagram * @default '16px' * * @see {@link ViewPadding} * * @example * ```tsx * * * * ``` */ fitViewPadding?: ViewPadding | undefined; /** * Show back/forward navigation buttons in controls panel * @default false */ showNavigationButtons?: undefined | boolean; /** * Display notations of the view * @default false */ enableNotations?: boolean | undefined; /** * If double click on a node should enable focus mode, i.e. highlight incoming/outgoing edges * Conflicts with `browser` prop * * @default false */ enableFocusMode?: boolean | undefined; /** * If Walkthrough for dynamic views should be enabled * @default false */ enableDynamicViewWalkthrough?: boolean | undefined; /** * Default dynamic view display variant * @default 'diagram' */ dynamicViewVariant?: t.DynamicViewDisplayVariant | undefined; /** * Enable popup with element details * @default false */ enableElementDetails?: boolean | undefined; /** * Display element tags in the bottom left corner * @default false */ enableElementTags?: boolean | undefined; /** * Display dropdown with details on relationship's label click * @default false */ enableRelationshipDetails?: boolean | undefined; /** * Allow popup to browse relationships * * @default enableRelationshipDetails */ enableRelationshipBrowser?: boolean | undefined; /** * Display element notes, if they are present in the view * * @default false */ enableNotes?: boolean | undefined; /** * Improve performance by hiding certain elements and reducing visual effects (disable mix-blend, shadows, animations) * * @default 'auto' - will be set to true if view is pannable and has more than 3000 * 2000 pixels */ reduceGraphics?: 'auto' | boolean | undefined; where?: t.WhereOperator | undefined; /** * Override some react flow props */ reactFlowProps?: OverrideReactFlowProps | undefined; className?: string | undefined; style?: CSSProperties | undefined; /** * Override Mantine theme */ mantineTheme?: any; /** Function to generate nonce attribute added to all generated `