@getartisanflow/alpineflow 0.2.2-alpha → 0.2.4-alpha
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/README.md +1 -0
- package/dist/alpineflow-schema.esm.js +785 -679
- package/dist/alpineflow-schema.esm.js.map +1 -1
- package/dist/alpineflow.bundle.esm.js +6727 -6436
- package/dist/alpineflow.bundle.esm.js.map +1 -1
- package/dist/alpineflow.css +12 -7
- package/dist/alpineflow.esm.js +2 -2
- package/dist/alpineflow.js +1 -1
- package/dist/{index-e86gWLvT.js → index-CvQXC8Md.js} +6406 -6115
- package/dist/index-CvQXC8Md.js.map +1 -0
- package/dist/locales/de.json +62 -0
- package/dist/locales/en.json +62 -0
- package/dist/types/src/core/announcer.d.ts +10 -3
- package/dist/types/src/core/canvas-gestures.d.ts +30 -0
- package/dist/types/src/core/controls-panel.d.ts +3 -0
- package/dist/types/src/core/edge-flags.d.ts +22 -0
- package/dist/types/src/core/gradients.d.ts +12 -0
- package/dist/types/src/core/minimap.d.ts +8 -0
- package/dist/types/src/core/node-flags.d.ts +5 -1
- package/dist/types/src/core/pan-zoom.d.ts +38 -9
- package/dist/types/src/core/translations.d.ts +175 -0
- package/dist/types/src/core/types.d.ts +124 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/plugin/data/canvas-context.d.ts +8 -1
- package/dist/types/src/plugin/data/canvas-dom.d.ts +14 -0
- package/dist/types/src/plugin/data/canvas-layout.d.ts +9 -0
- package/dist/types/src/plugin/data/canvas-viewport.d.ts +15 -0
- package/dist/types/src/plugin/directives/flow-handle.d.ts +16 -1
- package/package.json +4 -2
- package/dist/index-e86gWLvT.js.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FlowTranslations, TranslationKey, Translator } from './translations';
|
|
1
2
|
import type { EasingName } from '../animate/easing';
|
|
2
3
|
import type { PathFunction } from '../animate/paths';
|
|
3
4
|
import type { CollabConfig, CollabInstance } from '../collab/types';
|
|
@@ -242,6 +243,8 @@ export interface FlowEdge<T = Record<string, any>> {
|
|
|
242
243
|
deletable?: boolean;
|
|
243
244
|
/** Can this edge receive keyboard focus? Default: follows `edgesFocusable` config (true). */
|
|
244
245
|
focusable?: boolean;
|
|
246
|
+
/** Can this edge be selected? Default: follows `edgesSelectable` config (true). */
|
|
247
|
+
selectable?: boolean;
|
|
245
248
|
/** Override the ARIA role for this edge. Default: 'group' */
|
|
246
249
|
ariaRole?: string;
|
|
247
250
|
/** Override the auto-generated aria-label for this edge. */
|
|
@@ -255,6 +258,17 @@ export interface FlowEdge<T = Record<string, any>> {
|
|
|
255
258
|
labelVisibility?: 'always' | 'hover' | 'selected';
|
|
256
259
|
/** Optional label displayed on the edge */
|
|
257
260
|
label?: string;
|
|
261
|
+
/**
|
|
262
|
+
* Render the labels as HTML instead of text.
|
|
263
|
+
*
|
|
264
|
+
* Labels are written with `textContent` by default, so markup in them shows as the tags
|
|
265
|
+
* themselves. Set this to render `label`, `labelStart` and `labelEnd` as HTML — for a label that
|
|
266
|
+
* needs a line break, an icon or a piece of emphasis.
|
|
267
|
+
*
|
|
268
|
+
* The value goes to `innerHTML` unchanged. Like any HTML you hand a framework, it is trusted:
|
|
269
|
+
* pass user input through your own escaping or sanitiser first.
|
|
270
|
+
*/
|
|
271
|
+
labelHtml?: boolean;
|
|
258
272
|
/** Position of the center label along the path (0 = source, 1 = target). Default: 0.5 */
|
|
259
273
|
labelPosition?: number;
|
|
260
274
|
/** Optional label displayed near the source end of the edge */
|
|
@@ -487,6 +501,7 @@ export interface FlowEvents {
|
|
|
487
501
|
};
|
|
488
502
|
'selection-context-menu': {
|
|
489
503
|
nodes: FlowNode[];
|
|
504
|
+
edges: FlowEdge[];
|
|
490
505
|
event: MouseEvent;
|
|
491
506
|
};
|
|
492
507
|
'selection-change': {
|
|
@@ -539,6 +554,10 @@ export interface FlowEvents {
|
|
|
539
554
|
horizontal: number[];
|
|
540
555
|
vertical: number[];
|
|
541
556
|
};
|
|
557
|
+
'minimap-resize': {
|
|
558
|
+
width: number;
|
|
559
|
+
height: number;
|
|
560
|
+
};
|
|
542
561
|
'nodes-patch': {
|
|
543
562
|
patches: Record<string, DeepPartial<FlowNode>>;
|
|
544
563
|
};
|
|
@@ -551,9 +570,44 @@ export interface FlowEvents {
|
|
|
551
570
|
viewport?: Partial<Viewport>;
|
|
552
571
|
origin: 'undo' | 'redo' | 'load';
|
|
553
572
|
};
|
|
573
|
+
'layout': LayoutEventPayload;
|
|
574
|
+
'layout-end': LayoutEventPayload;
|
|
554
575
|
'init': undefined;
|
|
555
576
|
'destroy': undefined;
|
|
556
577
|
}
|
|
578
|
+
/**
|
|
579
|
+
* Where a layout decided each node goes, keyed by node id.
|
|
580
|
+
*
|
|
581
|
+
* A plain object rather than the `Map` the layout functions return: this travels in a DOM event,
|
|
582
|
+
* and a `Map` survives neither `JSON.stringify` nor structured clone — which is exactly the road
|
|
583
|
+
* this payload exists for, since persisting a layout means sending it somewhere.
|
|
584
|
+
*/
|
|
585
|
+
export type LayoutPositions = Record<string, XYPosition>;
|
|
586
|
+
/**
|
|
587
|
+
* What a layout announces — carried by both `layout` (when the positions are computed) and
|
|
588
|
+
* `layout-end` (when the nodes have settled there). Discriminated on `type`, so the settings each
|
|
589
|
+
* engine reports are the ones it actually has.
|
|
590
|
+
*/
|
|
591
|
+
export type LayoutEventPayload = {
|
|
592
|
+
type: 'dagre';
|
|
593
|
+
direction: string;
|
|
594
|
+
positions: LayoutPositions;
|
|
595
|
+
} | {
|
|
596
|
+
type: 'force';
|
|
597
|
+
charge: number;
|
|
598
|
+
distance: number;
|
|
599
|
+
positions: LayoutPositions;
|
|
600
|
+
} | {
|
|
601
|
+
type: 'tree';
|
|
602
|
+
layoutType: string;
|
|
603
|
+
direction: string;
|
|
604
|
+
positions: LayoutPositions;
|
|
605
|
+
} | {
|
|
606
|
+
type: 'elk';
|
|
607
|
+
algorithm: string;
|
|
608
|
+
direction: string;
|
|
609
|
+
positions: LayoutPositions;
|
|
610
|
+
};
|
|
557
611
|
/** Per-overlay visibility options for toImage(). All default to false (excluded). */
|
|
558
612
|
export interface ToImageOverlays {
|
|
559
613
|
/** Include toolbar and other .canvas-overlay elements. Default: false */
|
|
@@ -653,6 +707,8 @@ export interface PatchableConfig {
|
|
|
653
707
|
minimapMaskColor?: string;
|
|
654
708
|
minimapPannable?: boolean;
|
|
655
709
|
minimapZoomable?: boolean;
|
|
710
|
+
minimapWidth?: number;
|
|
711
|
+
minimapHeight?: number;
|
|
656
712
|
defaultInteractionWidth?: number;
|
|
657
713
|
preventOverlap?: boolean | number;
|
|
658
714
|
reconnectOnDelete?: boolean;
|
|
@@ -974,6 +1030,13 @@ export type SchemaRowClassResolver = (ctx: SchemaRowClassContext) => SchemaClass
|
|
|
974
1030
|
*/
|
|
975
1031
|
export type SchemaNodeClassResolver = (ctx: SchemaNodeClassContext) => SchemaClassValue | SchemaNodeClassMap;
|
|
976
1032
|
export interface FlowCanvasConfig {
|
|
1033
|
+
/** UI message overrides for this canvas. Missing keys fall back to English. */
|
|
1034
|
+
translations?: FlowTranslations;
|
|
1035
|
+
/**
|
|
1036
|
+
* BCP 47 locale used to pick plural forms (`_one`, `_few`, …) from `translations`.
|
|
1037
|
+
* Laravel-style `pt_BR` is accepted. Default: `document.documentElement.lang`, then `en`.
|
|
1038
|
+
*/
|
|
1039
|
+
locale?: string;
|
|
977
1040
|
nodes?: FlowNode[];
|
|
978
1041
|
edges?: FlowEdge[];
|
|
979
1042
|
/** Initial viewport state */
|
|
@@ -1182,6 +1245,28 @@ export interface FlowCanvasConfig {
|
|
|
1182
1245
|
controlsShowResetPanels?: boolean;
|
|
1183
1246
|
/** CSS selector for external container. When set, panel renders there instead of inside the canvas. */
|
|
1184
1247
|
controlsContainer?: string;
|
|
1248
|
+
/**
|
|
1249
|
+
* How long the viewport takes to answer a control, in ms. Default: 0 (instant).
|
|
1250
|
+
*
|
|
1251
|
+
* Zoom in, zoom out and fit view all take a `duration` and animate when given one — the panel
|
|
1252
|
+
* simply never passed one, so its buttons jumped while a double-click zoom (300ms) and a layout
|
|
1253
|
+
* glided. Set this and the three buttons move the same way everything else on the canvas does.
|
|
1254
|
+
*/
|
|
1255
|
+
controlsDuration?: number;
|
|
1256
|
+
/**
|
|
1257
|
+
* How big the minimap is drawn, in pixels. Defaults: 200 by 150.
|
|
1258
|
+
*
|
|
1259
|
+
* Not only how big the picture is — the scale that fits the graph into it and the rectangle that
|
|
1260
|
+
* marks the viewport are both computed against these, so a minimap whose ratio does not match the
|
|
1261
|
+
* canvas draws a viewport marker that is not the shape of the viewport. A consumer that wants it
|
|
1262
|
+
* to follow the container watches for a resize and calls `resize()` on the instance.
|
|
1263
|
+
*/
|
|
1264
|
+
minimapWidth?: number;
|
|
1265
|
+
/**
|
|
1266
|
+
* The minimap's height in pixels (default 150). Pairs with `minimapWidth` — see there for how the
|
|
1267
|
+
* two together drive the fit scale and the shape of the viewport marker.
|
|
1268
|
+
*/
|
|
1269
|
+
minimapHeight?: number;
|
|
1185
1270
|
/**
|
|
1186
1271
|
* Element to enter fullscreen mode, instead of the canvas container.
|
|
1187
1272
|
* Useful when the page wraps the canvas + ancillary UI (inspectors,
|
|
@@ -1200,12 +1285,19 @@ export interface FlowCanvasConfig {
|
|
|
1200
1285
|
nodesFocusable?: boolean;
|
|
1201
1286
|
/** Allow edges to receive keyboard focus via Tab. Default: true */
|
|
1202
1287
|
edgesFocusable?: boolean;
|
|
1288
|
+
/** Allow nodes to be selected by clicking, dragging or a selection box. Default: true.
|
|
1289
|
+
* A node's own `selectable` overrides this. Programmatic selection is unaffected —
|
|
1290
|
+
* this governs what a POINTER may do, not what the host may ask for. */
|
|
1291
|
+
nodesSelectable?: boolean;
|
|
1292
|
+
/** Allow edges to be selected by clicking or a selection box. Default: true.
|
|
1293
|
+
* An edge's own `selectable` overrides this. Programmatic selection is unaffected. */
|
|
1294
|
+
edgesSelectable?: boolean;
|
|
1203
1295
|
/** Disable arrow-key movement for selected nodes (Tab/Enter still work). Default: false */
|
|
1204
1296
|
disableKeyboardA11y?: boolean;
|
|
1205
1297
|
/** Screen reader announcements. true (default) = on, false = off,
|
|
1206
1298
|
* or object with formatMessage callback for custom messages. */
|
|
1207
1299
|
announcements?: boolean | {
|
|
1208
|
-
formatMessage?: (event: string, detail: Record<string, any
|
|
1300
|
+
formatMessage?: (event: string, detail: Record<string, any>, t: Translator) => string | null;
|
|
1209
1301
|
};
|
|
1210
1302
|
/** Compute mode. 'manual' (default) = explicit $flow.compute() calls,
|
|
1211
1303
|
* 'auto' = re-propagate on node/edge changes (debounced). */
|
|
@@ -1449,6 +1541,8 @@ export interface FlowCanvasConfig {
|
|
|
1449
1541
|
onViewportMove?: (detail: FlowEvents['viewport-move'], ctx?: CanvasContext) => void;
|
|
1450
1542
|
/** Called when a user gesture (pan/zoom) ends */
|
|
1451
1543
|
onViewportMoveEnd?: (detail: FlowEvents['viewport-move-end'], ctx?: CanvasContext) => void;
|
|
1544
|
+
/** Called when the minimap is drawn at a new size — a host that persists the size listens here */
|
|
1545
|
+
onMinimapResize?: (detail: FlowEvents['minimap-resize'], ctx?: CanvasContext) => void;
|
|
1452
1546
|
/** Called when the canvas background is clicked */
|
|
1453
1547
|
onPaneClick?: (detail: FlowEvents['pane-click'], ctx?: CanvasContext) => void;
|
|
1454
1548
|
/** Called when a node is right-clicked */
|
|
@@ -1571,6 +1665,17 @@ export interface FlowCanvasConfig {
|
|
|
1571
1665
|
* have room to return to. Only consulted when `zoomOnDoubleClick: 'toggle'`.
|
|
1572
1666
|
* Default: 1.5 */
|
|
1573
1667
|
dblClickZoomLevel?: number;
|
|
1668
|
+
/** Where a toggle double-click zooms out to when it has no remembered viewport to
|
|
1669
|
+
* restore — the user reached this zoom by wheel or `setViewport`, or panned after
|
|
1670
|
+
* zooming in, which drops the memory.
|
|
1671
|
+
*
|
|
1672
|
+
* - `'min'` (default) — `minZoom`, about the cursor.
|
|
1673
|
+
* - `'fit'` — the whole graph back on screen, the viewport `fitView()` computes.
|
|
1674
|
+
* - `number` — a fixed level, about the cursor. Clamped to [minZoom, maxZoom].
|
|
1675
|
+
*
|
|
1676
|
+
* A remembered viewport always wins over this. Only consulted when
|
|
1677
|
+
* `zoomOnDoubleClick: 'toggle'`. Default: `'min'` */
|
|
1678
|
+
dblClickZoomOutLevel?: number | 'fit' | 'min';
|
|
1574
1679
|
/** Automatically select nodes when they start being dragged. Default: true */
|
|
1575
1680
|
selectNodesOnDrag?: boolean;
|
|
1576
1681
|
}
|
|
@@ -1608,6 +1713,16 @@ export type AnimateEdgeTarget = {
|
|
|
1608
1713
|
strokeWidth?: number;
|
|
1609
1714
|
animated?: boolean;
|
|
1610
1715
|
class?: string;
|
|
1716
|
+
/**
|
|
1717
|
+
* Which path generator draws this edge — the same set `FlowEdge.type` accepts:
|
|
1718
|
+
* `'bezier'`, `'smoothstep'`, `'straight'`, `'floating'`, `'orthogonal'`,
|
|
1719
|
+
* `'avoidant'`, `'editable'`, or a type registered in `edgeTypes`.
|
|
1720
|
+
*
|
|
1721
|
+
* Applied instantly whatever the duration: a path type is a choice of generator,
|
|
1722
|
+
* not a value with a midpoint, so there is nothing to interpolate between a curve
|
|
1723
|
+
* and a set of right angles.
|
|
1724
|
+
*/
|
|
1725
|
+
type?: EdgeType | (string & {});
|
|
1611
1726
|
} & ElementTimingOverrides;
|
|
1612
1727
|
/** Viewport animation target. */
|
|
1613
1728
|
export type AnimateViewportTarget = {
|
|
@@ -1773,6 +1888,8 @@ export interface FlowInstance {
|
|
|
1773
1888
|
}): void;
|
|
1774
1889
|
/** Toggle interactivity (pannable + zoomable + node dragging) */
|
|
1775
1890
|
toggleInteractive(): void;
|
|
1891
|
+
/** Draw the minimap at another size. Ignores a width or height that is not positive. */
|
|
1892
|
+
resizeMinimap(width: number, height: number): void;
|
|
1776
1893
|
/** Whether interactivity is currently enabled */
|
|
1777
1894
|
isInteractive: boolean;
|
|
1778
1895
|
/** Get the absolute position of a node (resolves parentId chain) */
|
|
@@ -1915,6 +2032,12 @@ export interface FlowInstance {
|
|
|
1915
2032
|
clearNodeFilter(): void;
|
|
1916
2033
|
/** Update runtime config options (zoom limits, background, colorMode, etc.). */
|
|
1917
2034
|
patchConfig(changes: Partial<PatchableConfig>): void;
|
|
2035
|
+
/**
|
|
2036
|
+
* Translate a UI message of this canvas (`$flow.t('controls.zoomIn')` in templates).
|
|
2037
|
+
* Resolved once at creation from `translations` + `locale`; a numeric `count`
|
|
2038
|
+
* selects the plural form. Unknown or missing keys fall back to English.
|
|
2039
|
+
*/
|
|
2040
|
+
t(key: TranslationKey, values?: Record<string, string | number>): string;
|
|
1918
2041
|
/** Current resolved color mode, or undefined if not managed. */
|
|
1919
2042
|
readonly colorMode?: 'light' | 'dark';
|
|
1920
2043
|
/** Return all nodes whose bounding rect overlaps the given node.
|
|
@@ -27,6 +27,7 @@ export type { HierarchyLayoutType, HierarchyDirection, HierarchyLayoutOptions }
|
|
|
27
27
|
export { buildNodeMap, getAbsolutePosition, toAbsoluteNode, toAbsoluteNodes, getDescendantIds, sortNodesTopological, computeZIndex, clampToExtent, clampToParent, expandParentToFitChild, } from './core/sub-flow';
|
|
28
28
|
export type { PathFunction, OrbitConfig, WaveConfig, AlongConfig, PendulumConfig, DriftConfig } from './animate/paths';
|
|
29
29
|
export { orbit, wave, along, pendulum, drift, stagger } from './animate/paths';
|
|
30
|
+
export type { FlowTranslations, TranslationKey, Translator } from './core/translations';
|
|
30
31
|
export { FlowHistory, type HistorySnapshot } from './core/history';
|
|
31
32
|
export type { ResizeDirection, ResizeConstraints } from './core/resize';
|
|
32
33
|
export type { ControlsPanelInstance } from './core/controls-panel';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FlowNode, FlowEdge, Viewport, XYPosition, Dimensions, FlowCanvasConfig, PendingReconnection, PendingKeyboardConnect, AnimateTargets, AnimateOptions, FlowAnimationHandle, FollowOptions, BurstOptions, ParticleBurstHandle, ConvergingOptions, ConvergingHandle, ParticleHandle, ParticleOptions, ParticleRenderer, PatchableConfig, ChildValidation, RowFilter, FlowNodeRunState, ShapeDefinition, ToImageOptions, StopOptions, SchemaMetrics, EndpointSpreadGrouping, ChangeOrigin } from '../../core/types';
|
|
1
|
+
import type { FlowNode, FlowEdge, EdgeGradient, Viewport, XYPosition, Dimensions, FlowCanvasConfig, PendingReconnection, PendingKeyboardConnect, AnimateTargets, AnimateOptions, FlowAnimationHandle, FollowOptions, BurstOptions, ParticleBurstHandle, ConvergingOptions, ConvergingHandle, ParticleHandle, ParticleOptions, ParticleRenderer, PatchableConfig, ChildValidation, RowFilter, FlowNodeRunState, ShapeDefinition, ToImageOptions, StopOptions, SchemaMetrics, EndpointSpreadGrouping, ChangeOrigin } from '../../core/types';
|
|
2
2
|
import type { FlowGroup } from '../../animate/flow-group';
|
|
3
3
|
import type { Transaction } from '../../animate/transaction';
|
|
4
4
|
import type { Recording, RecordOptions, ReplayOptions, ReplayHandle } from '../../animate/recording';
|
|
@@ -350,6 +350,11 @@ export interface CanvasContext {
|
|
|
350
350
|
_flushEdgeStyles(edgeIds: Set<string>): void;
|
|
351
351
|
/** Push current viewport state to the DOM (transform, background, culling) */
|
|
352
352
|
_flushViewport(): void;
|
|
353
|
+
/**
|
|
354
|
+
* Repaint one edge's gradient where nothing moved. False where it has no def yet, and the caller
|
|
355
|
+
* falls back to the path refresh — see the implementation for why that is worth avoiding.
|
|
356
|
+
*/
|
|
357
|
+
_restyleEdgeGradient(edgeId: string, gradient: EdgeGradient): boolean;
|
|
353
358
|
/** Recompute SVG paths, label positions, and gradients for affected edges */
|
|
354
359
|
_refreshEdgePaths(movedNodeIds: Set<string>): void;
|
|
355
360
|
/** Hydrate from a pre-rendered static diagram */
|
|
@@ -590,6 +595,8 @@ export interface CanvasContext {
|
|
|
590
595
|
}): void;
|
|
591
596
|
/** Toggle interactivity */
|
|
592
597
|
toggleInteractive(): void;
|
|
598
|
+
/** Draw the minimap at another size */
|
|
599
|
+
resizeMinimap(width: number, height: number): void;
|
|
593
600
|
/** Toggle fullscreen on the canvas container */
|
|
594
601
|
toggleFullscreen(): void;
|
|
595
602
|
/** Close the context menu */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CanvasContext } from './canvas-context';
|
|
2
|
+
import type { EdgeGradient } from '../../core/types';
|
|
2
3
|
export declare function createDomMixin(ctx: CanvasContext, Alpine: any): {
|
|
3
4
|
/** Write node positions directly to DOM elements (bypassing Alpine effects). */
|
|
4
5
|
_flushNodePositions(nodeIds: Set<string>): void;
|
|
@@ -8,6 +9,19 @@ export declare function createDomMixin(ctx: CanvasContext, Alpine: any): {
|
|
|
8
9
|
_flushEdgeStyles(edgeIds: Set<string>): void;
|
|
9
10
|
/** Push current viewport state to the DOM (transform, background, culling). */
|
|
10
11
|
_flushViewport(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Repaint one edge's gradient, for a colour change that moved nothing.
|
|
14
|
+
*
|
|
15
|
+
* Answers false where the edge has no def yet — an edge given a gradient for the first time —
|
|
16
|
+
* and the caller falls back to the path refresh, which is what works the coordinates out.
|
|
17
|
+
*
|
|
18
|
+
* Its own entry point because the refresh is driven by which NODES moved: routing a colour
|
|
19
|
+
* change through it re-paths every sibling edge on both endpoints, and re-paths them the way a
|
|
20
|
+
* drag does, without obstacle avoidance, until the layout settles. On a plain graph that is
|
|
21
|
+
* invisible; on an obstacle-routed one it straightens neighbours through the nodes they were
|
|
22
|
+
* drawn around.
|
|
23
|
+
*/
|
|
24
|
+
_restyleEdgeGradient(edgeId: string, gradient: EdgeGradient): boolean;
|
|
11
25
|
/** Recompute SVG paths, label positions, and gradients for edges connected to the given node IDs. */
|
|
12
26
|
_refreshEdgePaths(movedNodeIds: Set<string>): void;
|
|
13
27
|
/** Return the registered DOM element for a node by ID, or undefined if not mounted. */
|
|
@@ -33,6 +33,15 @@ export declare function createLayoutMixin(ctx: CanvasContext): {
|
|
|
33
33
|
handleDirection?: string;
|
|
34
34
|
fitView?: boolean;
|
|
35
35
|
duration?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Called once the positions are ON the model, which is a different moment in each
|
|
38
|
+
* branch: after the animation in the animated one, straight after the write in the
|
|
39
|
+
* instant one. The point of it is that a caller does not have to know which branch it
|
|
40
|
+
* took — "the nodes are where the layout put them" means the same thing either way.
|
|
41
|
+
*
|
|
42
|
+
* Not called when the animation never completes: an interrupted layout did not settle.
|
|
43
|
+
*/
|
|
44
|
+
onApplied?: () => void;
|
|
36
45
|
}): void;
|
|
37
46
|
/**
|
|
38
47
|
* Update handle positions on nodes and DOM elements to match a layout
|
|
@@ -63,6 +63,21 @@ export declare function createViewportMixin(ctx: CanvasContext): {
|
|
|
63
63
|
width: number;
|
|
64
64
|
height: number;
|
|
65
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* The viewport that frames the whole graph right now, or null when there is no
|
|
68
|
+
* honest answer.
|
|
69
|
+
*
|
|
70
|
+
* For callers that cannot wait: `fitView()` defers through `_whenMeasured()` until
|
|
71
|
+
* every node has been laid out, and a double-click has to answer within the
|
|
72
|
+
* gesture. So this asks the same question and, where `fitView()` would wait, says
|
|
73
|
+
* null instead and leaves the fallback to the caller.
|
|
74
|
+
*
|
|
75
|
+
* Null on two counts. Nothing visible to frame — and nothing MEASURED to frame it
|
|
76
|
+
* by: an unmeasured node still has bounds, because `getNodesBounds` fills in the
|
|
77
|
+
* 150×50 default, so framing it would frame a row of placeholder boxes at the
|
|
78
|
+
* positions they were declared with rather than the graph anybody can see.
|
|
79
|
+
*/
|
|
80
|
+
_fitViewport(): Viewport | null;
|
|
66
81
|
/**
|
|
67
82
|
* Compute the viewport (pan + zoom) that frames the given bounds
|
|
68
83
|
* within the container, respecting min/max zoom and padding.
|
|
@@ -22,6 +22,18 @@ export declare function checkHandleLimits(containerEl: HTMLElement, connection:
|
|
|
22
22
|
* in the container based on the validation chain for a hypothetical connection
|
|
23
23
|
* from the given source.
|
|
24
24
|
*
|
|
25
|
+
* Also raises `.flow-connecting` on the container, because that is the selector
|
|
26
|
+
* the stylesheet reveals those classes through:
|
|
27
|
+
*
|
|
28
|
+
* .flow-connecting .flow-handle-target { outline: 2px solid … }
|
|
29
|
+
* .flow-connecting .flow-handle-target.flow-handle-invalid { outline-color: … }
|
|
30
|
+
*
|
|
31
|
+
* The flag used to be set by the click-to-connect branch alone, so the three
|
|
32
|
+
* DRAG gestures computed a full valid/invalid verdict for every target handle
|
|
33
|
+
* and then painted none of it. Setting it here — and clearing it in
|
|
34
|
+
* `clearValidationClasses` — is what keeps the two halves of one statement from
|
|
35
|
+
* being raised in different places.
|
|
36
|
+
*
|
|
25
37
|
* When `index` is provided (connect-drag / reconnect gestures build one on
|
|
26
38
|
* pointerdown), validation runs O(1) per handle off a precomputed context with
|
|
27
39
|
* ZERO further DOM queries or measurements. Without an index (one-shot callers:
|
|
@@ -39,7 +51,10 @@ export declare function applyValidationClasses(containerEl: HTMLElement, sourceN
|
|
|
39
51
|
*/
|
|
40
52
|
export declare function legacyApplyValidationClasses(containerEl: HTMLElement, sourceNodeId: string, sourceHandleId: string, canvas: any, excludeEdgeId?: string): void;
|
|
41
53
|
/**
|
|
42
|
-
* Remove .flow-handle-valid / .flow-handle-invalid from all target handles
|
|
54
|
+
* Remove .flow-handle-valid / .flow-handle-invalid from all target handles, and
|
|
55
|
+
* `.flow-connecting` from the container that revealed them. Every path that ends
|
|
56
|
+
* a connect gesture already calls this, which is what makes it the one place the
|
|
57
|
+
* flag can be dropped from.
|
|
43
58
|
*/
|
|
44
59
|
export declare function clearValidationClasses(containerEl: HTMLElement): void;
|
|
45
60
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://www.schemastore.org/package.json",
|
|
3
3
|
"name": "@getartisanflow/alpineflow",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.4-alpha",
|
|
5
5
|
"description": "Interactive flowchart and node-graph engine for Alpine.js — drag-and-drop nodes, edges, animations, collaboration, and layout algorithms.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"alpinejs",
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"import": "./dist/alpineflow-schema.esm.js",
|
|
77
77
|
"default": "./dist/alpineflow-schema.js"
|
|
78
78
|
},
|
|
79
|
+
"./locales/*.json": "./dist/locales/*.json",
|
|
79
80
|
"./css": "./dist/alpineflow.css",
|
|
80
81
|
"./theme": "./dist/alpineflow-theme.css"
|
|
81
82
|
},
|
|
@@ -83,7 +84,8 @@
|
|
|
83
84
|
"dist/"
|
|
84
85
|
],
|
|
85
86
|
"scripts": {
|
|
86
|
-
"build": "vite build && tsc && npm run build:css && npm run build:bundle && npm run build:addons",
|
|
87
|
+
"build": "vite build && tsc && npm run build:locales && npm run build:css && npm run build:bundle && npm run build:addons",
|
|
88
|
+
"build:locales": "mkdir -p dist/locales && cp locales/*.json dist/locales/",
|
|
87
89
|
"build:css": "cp css/structural.css dist/alpineflow.css && cp css/theme-default.css dist/alpineflow-theme.css",
|
|
88
90
|
"build:bundle": "vite build --config vite.bundle.config.ts",
|
|
89
91
|
"build:addons": "ADDON_NAME=alpineflow-whiteboard.esm ADDON_ENTRY=lib/whiteboard.ts vite build --config vite.addons.config.ts && ADDON_NAME=alpineflow-dagre.esm ADDON_ENTRY=lib/dagre.ts vite build --config vite.addons.config.ts && ADDON_NAME=alpineflow-force.esm ADDON_ENTRY=lib/force.ts vite build --config vite.addons.config.ts && ADDON_NAME=alpineflow-hierarchy.esm ADDON_ENTRY=lib/hierarchy.ts vite build --config vite.addons.config.ts && ADDON_NAME=alpineflow-elk.esm ADDON_ENTRY=lib/elk.ts vite build --config vite.addons.config.ts && ADDON_NAME=alpineflow-collab.esm ADDON_ENTRY=lib/collab.ts vite build --config vite.addons.config.ts && ADDON_NAME=alpineflow-workflow.esm ADDON_ENTRY=lib/workflow.ts vite build --config vite.addons.config.ts && ADDON_NAME=alpineflow-schema.esm ADDON_ENTRY=lib/schema.ts vite build --config vite.addons.config.ts",
|