@almadar/ui 4.50.21 → 4.51.0
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/avl/index.cjs +222 -182
- package/dist/avl/index.d.cts +146 -2
- package/dist/avl/index.d.ts +1 -0
- package/dist/avl/index.js +221 -184
- package/dist/components/index.cjs +31 -21
- package/dist/components/index.js +33 -23
- package/dist/components/molecules/avl/useCanvasDnd.d.ts +144 -0
- package/dist/components/organisms/Form.d.ts +2 -0
- package/dist/hooks/useAlmadarDndCollision.d.ts +34 -0
- package/dist/providers/index.cjs +31 -21
- package/dist/providers/index.js +33 -23
- package/dist/runtime/index.cjs +31 -21
- package/dist/runtime/index.js +33 -23
- package/package.json +1 -1
package/dist/avl/index.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
-
import { OrbitalSchema, UISlot, Expression, EntityPersistence, EventPayloadField, ThemeDefinition } from '@almadar/core';
|
|
3
|
+
import { OrbitalSchema, UISlot, Expression, EntityPersistence, EventPayloadField, EventPayload, ThemeDefinition } from '@almadar/core';
|
|
4
4
|
import { Node, Edge, NodeProps, EdgeProps } from '@xyflow/react';
|
|
5
|
+
import { useDraggable } from '@dnd-kit/core';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Almadar Visual Language (AVL) shared types.
|
|
@@ -1176,6 +1177,149 @@ interface BehaviorRegistryRecord {
|
|
|
1176
1177
|
*/
|
|
1177
1178
|
declare function registryEntryToCanvasEntry(entry: BehaviorRegistryRecord, orbitalNames: string[]): BehaviorCanvasEntry;
|
|
1178
1179
|
|
|
1180
|
+
/**
|
|
1181
|
+
* useCanvasDnd — drag/drop primitives for the AVL canvas surface.
|
|
1182
|
+
*
|
|
1183
|
+
* Shares the sensor stack + collision waterfall with `useDataDnd` (both
|
|
1184
|
+
* import from `hooks/useAlmadarDndCollision`); diverges on drop semantics
|
|
1185
|
+
* because palette → canvas is a cursor-resolved tree insert, not a
|
|
1186
|
+
* sortable-list reorder.
|
|
1187
|
+
*
|
|
1188
|
+
* Pointer-sensor based so it works inside React Flow nodes (the native
|
|
1189
|
+
* HTML5 DnD path was swallowed by React Flow's pan/zoom handlers).
|
|
1190
|
+
*
|
|
1191
|
+
* Event contract (defaults — overridable via `CanvasDndProvider.onDrop`):
|
|
1192
|
+
* - On drag start: emits `UI:DRAG_START` { kind, data }
|
|
1193
|
+
* - On drag end: emits `UI:DRAG_END` { kind, data }
|
|
1194
|
+
* - On 'pattern' drop: emits `UI:PATTERN_DROP` { patternType, containerNode, parentPath?, index? }
|
|
1195
|
+
* - On 'behavior' drop: emits `UI:BEHAVIOR_DROP` { behaviorName, containerNode }
|
|
1196
|
+
*
|
|
1197
|
+
* The `onDrop` callback lets consumers route OTHER payload kinds (e.g.
|
|
1198
|
+
* `'pattern-instance'` for in-canvas reorder of an existing pattern) to
|
|
1199
|
+
* their own bus events or schema mutations. Reorder semantics belong in
|
|
1200
|
+
* the consumer because they touch the SExpr tree directly — this primitive
|
|
1201
|
+
* only resolves payload + target + cursor and hands them off.
|
|
1202
|
+
*/
|
|
1203
|
+
|
|
1204
|
+
/**
|
|
1205
|
+
* Drag kinds the canvas understands. Open-ended `string` so consumers can
|
|
1206
|
+
* introduce new kinds (e.g. `'pattern-instance'` for in-canvas reorder of an
|
|
1207
|
+
* existing pattern) without touching this file — the provider's defaults
|
|
1208
|
+
* cover `'pattern'` and `'behavior'`; everything else routes through the
|
|
1209
|
+
* consumer's `onDrop`.
|
|
1210
|
+
*/
|
|
1211
|
+
type CanvasDragKind = 'pattern' | 'behavior' | (string & {});
|
|
1212
|
+
/**
|
|
1213
|
+
* Payload carried by a draggable. For `'pattern'` tiles `data` is
|
|
1214
|
+
* `{ type: string }`, for `'behavior'` tiles `{ name: string }`. For consumer
|
|
1215
|
+
* kinds (e.g. `'pattern-instance'`) the shape is whatever the consumer
|
|
1216
|
+
* agrees on with its own `onDrop`.
|
|
1217
|
+
*/
|
|
1218
|
+
interface CanvasDragPayload {
|
|
1219
|
+
kind: CanvasDragKind;
|
|
1220
|
+
data: EventPayload;
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Orbital/trait/transition context a drop will mutate.
|
|
1224
|
+
*
|
|
1225
|
+
* Has an explicit `[key: string]: string | undefined` index signature so it
|
|
1226
|
+
* structurally matches `EventPayload` — required because we pass the whole
|
|
1227
|
+
* object as a field on the `UI:PATTERN_DROP` payload.
|
|
1228
|
+
*/
|
|
1229
|
+
interface CanvasContainerNode {
|
|
1230
|
+
orbitalName?: string;
|
|
1231
|
+
traitName?: string;
|
|
1232
|
+
transitionEvent?: string;
|
|
1233
|
+
[key: string]: string | undefined;
|
|
1234
|
+
}
|
|
1235
|
+
/** Drop-target metadata stored on each droppable's `data` field. */
|
|
1236
|
+
interface CanvasDropTarget {
|
|
1237
|
+
/**
|
|
1238
|
+
* `l1` = outer orbital frame (overview level).
|
|
1239
|
+
* `l2` = render-ui slot inside an expanded orbital.
|
|
1240
|
+
* `wrapper` = page-level catch-all fired when nothing inner caught the drop.
|
|
1241
|
+
*/
|
|
1242
|
+
level: 'l1' | 'l2' | 'wrapper' | (string & {});
|
|
1243
|
+
/** Full or partial container context this drop will mutate. */
|
|
1244
|
+
containerNode: CanvasContainerNode;
|
|
1245
|
+
/**
|
|
1246
|
+
* Optional resolver called at drop time to derive `parentPath` + `index`
|
|
1247
|
+
* from the pointer's final client position. L2 slots use this to walk the
|
|
1248
|
+
* DOM under their `contentRef` and find the nearest `data-accepts-children`
|
|
1249
|
+
* container plus the cursor-relative insertion index.
|
|
1250
|
+
*/
|
|
1251
|
+
resolvePath?: (cursor: {
|
|
1252
|
+
x: number;
|
|
1253
|
+
y: number;
|
|
1254
|
+
}) => {
|
|
1255
|
+
parentPath: string;
|
|
1256
|
+
index: number;
|
|
1257
|
+
} | null;
|
|
1258
|
+
}
|
|
1259
|
+
interface CanvasDropEvent {
|
|
1260
|
+
payload: CanvasDragPayload;
|
|
1261
|
+
target: CanvasDropTarget;
|
|
1262
|
+
/** Final pointer client position, when dnd-kit could compute it. */
|
|
1263
|
+
cursor: {
|
|
1264
|
+
x: number;
|
|
1265
|
+
y: number;
|
|
1266
|
+
} | null;
|
|
1267
|
+
/**
|
|
1268
|
+
* Resolved insertion path/index from `target.resolvePath(cursor)`. Null
|
|
1269
|
+
* when the target has no resolver or the cursor was unavailable.
|
|
1270
|
+
*/
|
|
1271
|
+
resolved: {
|
|
1272
|
+
parentPath: string;
|
|
1273
|
+
index: number;
|
|
1274
|
+
} | null;
|
|
1275
|
+
}
|
|
1276
|
+
interface UseCanvasDraggableArgs {
|
|
1277
|
+
/** Unique id (per-tile). dnd-kit uses this to track the active drag. */
|
|
1278
|
+
id: string;
|
|
1279
|
+
payload: CanvasDragPayload;
|
|
1280
|
+
disabled?: boolean;
|
|
1281
|
+
}
|
|
1282
|
+
interface UseCanvasDraggableResult {
|
|
1283
|
+
setNodeRef: (node: HTMLElement | null) => void;
|
|
1284
|
+
attributes: ReturnType<typeof useDraggable>['attributes'];
|
|
1285
|
+
listeners: ReturnType<typeof useDraggable>['listeners'];
|
|
1286
|
+
isDragging: boolean;
|
|
1287
|
+
/** Spread on the tile — live transform + grab cursor + touch-action. */
|
|
1288
|
+
style: React__default.CSSProperties;
|
|
1289
|
+
}
|
|
1290
|
+
declare function useCanvasDraggable({ id, payload, disabled, }: UseCanvasDraggableArgs): UseCanvasDraggableResult;
|
|
1291
|
+
interface UseCanvasDroppableArgs {
|
|
1292
|
+
id: string;
|
|
1293
|
+
target: CanvasDropTarget;
|
|
1294
|
+
/** Which drag kinds this zone accepts. Defaults to ['pattern','behavior']. */
|
|
1295
|
+
accepts?: readonly CanvasDragKind[];
|
|
1296
|
+
disabled?: boolean;
|
|
1297
|
+
}
|
|
1298
|
+
interface UseCanvasDroppableResult {
|
|
1299
|
+
setNodeRef: (node: HTMLElement | null) => void;
|
|
1300
|
+
isOver: boolean;
|
|
1301
|
+
}
|
|
1302
|
+
declare function useCanvasDroppable({ id, target, accepts, disabled, }: UseCanvasDroppableArgs): UseCanvasDroppableResult;
|
|
1303
|
+
interface CanvasDndProviderProps {
|
|
1304
|
+
children: React__default.ReactNode;
|
|
1305
|
+
/**
|
|
1306
|
+
* Override the default drop behavior. The default emits `UI:PATTERN_DROP`
|
|
1307
|
+
* / `UI:BEHAVIOR_DROP` based on payload kind. Pass an `onDrop` to route
|
|
1308
|
+
* additional kinds (e.g. `'pattern-instance'` reorder) elsewhere, or to
|
|
1309
|
+
* mutate schema directly without going through the bus.
|
|
1310
|
+
*
|
|
1311
|
+
* Return `true` from `onDrop` to suppress the default emit; return
|
|
1312
|
+
* `false`/`undefined` to fall through to defaults after running your code.
|
|
1313
|
+
*/
|
|
1314
|
+
onDrop?: (drop: CanvasDropEvent) => boolean | void;
|
|
1315
|
+
}
|
|
1316
|
+
/**
|
|
1317
|
+
* Wraps a canvas subtree in one DndContext + sensors + collision waterfall.
|
|
1318
|
+
* Every `useCanvasDraggable` / `useCanvasDroppable` inside this provider
|
|
1319
|
+
* participates in the same drag session.
|
|
1320
|
+
*/
|
|
1321
|
+
declare function CanvasDndProvider({ children, onDrop }: CanvasDndProviderProps): React__default.ReactElement;
|
|
1322
|
+
|
|
1179
1323
|
/**
|
|
1180
1324
|
* OrbInspector
|
|
1181
1325
|
*
|
|
@@ -1544,4 +1688,4 @@ interface AvlClickTargetProps {
|
|
|
1544
1688
|
}
|
|
1545
1689
|
declare const AvlClickTarget: React__default.FC<AvlClickTargetProps>;
|
|
1546
1690
|
|
|
1547
|
-
export { AVL_FIELD_TYPE_SHAPES, AVL_OPERATOR_COLORS, type ApplicationLevelData, AvlApplication, type AvlApplicationProps, AvlBackwardEdge, type AvlBaseProps, AvlBehaviorGlyph, type AvlBehaviorGlyphProps, AvlBinding, AvlBindingEdge, type AvlBindingProps, AvlBindingRef, type AvlBindingRefProps, AvlClickTarget, type AvlClickTargetProps, AvlClosedCircuit, type AvlClosedCircuitProps, type AvlClosedCircuitState, type AvlClosedCircuitTransition, AvlCosmicZoom, type AvlCosmicZoomProps, type AvlEdgeData, AvlEffect, type AvlEffectProps, type AvlEffectType, AvlEmitListen, type AvlEmitListenProps, AvlEntity, type AvlEntityProps, AvlEvent, type AvlEventProps, AvlEventWireEdge, type AvlEventWireEdgeData, AvlExprTree, type AvlExprTreeNode, type AvlExprTreeProps, AvlField, type AvlFieldProps, AvlFieldType, type AvlFieldTypeKind, type AvlFieldTypeProps, AvlGuard, type AvlGuardProps, AvlLiteral, type AvlLiteralProps, type AvlNodeData, AvlOperator, type AvlOperatorNamespace, type AvlOperatorProps, AvlOrbital, AvlOrbitalNode, type AvlOrbitalProps, AvlOrbitalUnit, type AvlOrbitalUnitPage, type AvlOrbitalUnitProps, type AvlOrbitalUnitTrait, AvlOrbitalsCosmicZoom, type AvlOrbitalsCosmicZoomProps, AvlPage, AvlPageEdge, type AvlPageProps, AvlPersistence, type AvlPersistenceKind, type AvlPersistenceProps, AvlSExpr, type AvlSExprProps, AvlSlotMap, type AvlSlotMapProps, type AvlSlotMapSlot, AvlState, AvlStateMachine, type AvlStateMachineProps, type AvlStateMachineState, type AvlStateMachineTransition, type AvlStateProps, AvlSwimLane, type AvlSwimLaneProps, AvlTrait, type AvlTraitProps, AvlTraitScene, type AvlTraitSceneProps, AvlTransition, AvlTransitionEdge, type AvlTransitionEdgeData, AvlTransitionLane, type AvlTransitionLaneProps, type AvlTransitionProps, AvlTransitionScene, type AvlTransitionSceneProps, type BehaviorCanvasEntry, BehaviorComposeNode, type BehaviorComposeNodeData, type BehaviorGlyphChild, type BehaviorGlyphConnection, type BehaviorLevel, type BehaviorRegistryRecord, BehaviorView, type BehaviorWireEdgeData, CONNECTION_COLORS, type ComposeViewLevel, type ConnectableEvent, type CrossLink, DOMAIN_COLORS, DetailView, EFFECT_CATEGORY_COLORS, EFFECT_TYPE_TO_CATEGORY, type EffectCategory, type ElkLayout, type EventEdgeData, EventFlowEdge, FlowCanvas, type FlowCanvasProps, type GlyphSize, type LayoutEdge, type LayoutNode, MiniStateMachine, ModuleCard, OrbInspector, type OrbInspectorProps, OrbPreviewNode, type OrbitalLevelData, type PatternEventSource, type PreviewNodeData, type RenderUIEntry, STATE_COLORS, type StateRole, SystemNode, type TraitLevelData, type TransitionLevelData, type ViewLevel, ZOOM_BAND_THRESHOLDS, type ZoomBand, ZoomBandContext, ZoomBreadcrumb, type ZoomBreadcrumbProps, ZoomLegend, type ZoomLegendProps, type ZoomLevel, arcPath, behaviorsToComposeGraph, computeTraitLayout, computeZoomBand, curveControlPoint, edgePath, getStateRole, gridPositions, orbitalToExpandedGraph, parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, parseTransitionLevel, radialPositions, registryEntryToCanvasEntry, ringPositions, schemaToFlowGraph, schemaToOverviewGraph, useZoomBand, zoomProgress };
|
|
1691
|
+
export { AVL_FIELD_TYPE_SHAPES, AVL_OPERATOR_COLORS, type ApplicationLevelData, AvlApplication, type AvlApplicationProps, AvlBackwardEdge, type AvlBaseProps, AvlBehaviorGlyph, type AvlBehaviorGlyphProps, AvlBinding, AvlBindingEdge, type AvlBindingProps, AvlBindingRef, type AvlBindingRefProps, AvlClickTarget, type AvlClickTargetProps, AvlClosedCircuit, type AvlClosedCircuitProps, type AvlClosedCircuitState, type AvlClosedCircuitTransition, AvlCosmicZoom, type AvlCosmicZoomProps, type AvlEdgeData, AvlEffect, type AvlEffectProps, type AvlEffectType, AvlEmitListen, type AvlEmitListenProps, AvlEntity, type AvlEntityProps, AvlEvent, type AvlEventProps, AvlEventWireEdge, type AvlEventWireEdgeData, AvlExprTree, type AvlExprTreeNode, type AvlExprTreeProps, AvlField, type AvlFieldProps, AvlFieldType, type AvlFieldTypeKind, type AvlFieldTypeProps, AvlGuard, type AvlGuardProps, AvlLiteral, type AvlLiteralProps, type AvlNodeData, AvlOperator, type AvlOperatorNamespace, type AvlOperatorProps, AvlOrbital, AvlOrbitalNode, type AvlOrbitalProps, AvlOrbitalUnit, type AvlOrbitalUnitPage, type AvlOrbitalUnitProps, type AvlOrbitalUnitTrait, AvlOrbitalsCosmicZoom, type AvlOrbitalsCosmicZoomProps, AvlPage, AvlPageEdge, type AvlPageProps, AvlPersistence, type AvlPersistenceKind, type AvlPersistenceProps, AvlSExpr, type AvlSExprProps, AvlSlotMap, type AvlSlotMapProps, type AvlSlotMapSlot, AvlState, AvlStateMachine, type AvlStateMachineProps, type AvlStateMachineState, type AvlStateMachineTransition, type AvlStateProps, AvlSwimLane, type AvlSwimLaneProps, AvlTrait, type AvlTraitProps, AvlTraitScene, type AvlTraitSceneProps, AvlTransition, AvlTransitionEdge, type AvlTransitionEdgeData, AvlTransitionLane, type AvlTransitionLaneProps, type AvlTransitionProps, AvlTransitionScene, type AvlTransitionSceneProps, type BehaviorCanvasEntry, BehaviorComposeNode, type BehaviorComposeNodeData, type BehaviorGlyphChild, type BehaviorGlyphConnection, type BehaviorLevel, type BehaviorRegistryRecord, BehaviorView, type BehaviorWireEdgeData, CONNECTION_COLORS, type CanvasContainerNode, CanvasDndProvider, type CanvasDndProviderProps, type CanvasDragKind, type CanvasDragPayload, type CanvasDropEvent, type CanvasDropTarget, type ComposeViewLevel, type ConnectableEvent, type CrossLink, DOMAIN_COLORS, DetailView, EFFECT_CATEGORY_COLORS, EFFECT_TYPE_TO_CATEGORY, type EffectCategory, type ElkLayout, type EventEdgeData, EventFlowEdge, FlowCanvas, type FlowCanvasProps, type GlyphSize, type LayoutEdge, type LayoutNode, MiniStateMachine, ModuleCard, OrbInspector, type OrbInspectorProps, OrbPreviewNode, type OrbitalLevelData, type PatternEventSource, type PreviewNodeData, type RenderUIEntry, STATE_COLORS, type StateRole, SystemNode, type TraitLevelData, type TransitionLevelData, type UseCanvasDraggableArgs, type UseCanvasDraggableResult, type UseCanvasDroppableArgs, type UseCanvasDroppableResult, type ViewLevel, ZOOM_BAND_THRESHOLDS, type ZoomBand, ZoomBandContext, ZoomBreadcrumb, type ZoomBreadcrumbProps, ZoomLegend, type ZoomLegendProps, type ZoomLevel, arcPath, behaviorsToComposeGraph, computeTraitLayout, computeZoomBand, curveControlPoint, edgePath, getStateRole, gridPositions, orbitalToExpandedGraph, parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, parseTransitionLevel, radialPositions, registryEntryToCanvasEntry, ringPositions, schemaToFlowGraph, schemaToOverviewGraph, useCanvasDraggable, useCanvasDroppable, useZoomBand, zoomProgress };
|
package/dist/avl/index.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ export { type ViewLevel, type PreviewNodeData, type EventEdgeData, type PatternE
|
|
|
55
55
|
export { schemaToOverviewGraph, orbitalToExpandedGraph } from '../components/molecules/avl/avl-preview-converter';
|
|
56
56
|
export { OrbPreviewNode } from '../components/molecules/avl/OrbPreviewNode';
|
|
57
57
|
export { EventFlowEdge } from '../components/molecules/avl/EventFlowEdge';
|
|
58
|
+
export { CanvasDndProvider, useCanvasDraggable, useCanvasDroppable, type CanvasDragKind, type CanvasDragPayload, type CanvasContainerNode, type CanvasDropTarget, type CanvasDropEvent, type CanvasDndProviderProps, type UseCanvasDraggableArgs, type UseCanvasDraggableResult, type UseCanvasDroppableArgs, type UseCanvasDroppableResult, } from '../components/molecules/avl/useCanvasDnd';
|
|
58
59
|
export { type ComposeViewLevel, type BehaviorComposeNodeData, type BehaviorWireEdgeData, type BehaviorCanvasEntry, type ConnectableEvent } from '../components/molecules/avl/avl-behavior-compose-types';
|
|
59
60
|
export { BehaviorComposeNode } from '../components/molecules/avl/BehaviorComposeNode';
|
|
60
61
|
export { behaviorsToComposeGraph, registryEntryToCanvasEntry, type BehaviorRegistryRecord } from '../components/molecules/avl/avl-behavior-compose-converter';
|