@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.
@@ -0,0 +1,62 @@
1
+ {
2
+ "controls.label": "Diagrammsteuerung",
3
+ "controls.zoomIn": "Vergrößern",
4
+ "controls.zoomOut": "Verkleinern",
5
+ "controls.fitView": "Ansicht einpassen",
6
+ "controls.toggleInteractive": "Interaktion umschalten",
7
+ "controls.lockInteractive": "Interaktion sperren",
8
+ "controls.unlockInteractive": "Interaktion entsperren",
9
+ "controls.resetPanels": "Bereiche zurücksetzen",
10
+ "controls.toggleFullscreen": "Vollbild umschalten",
11
+ "controls.enterFullscreen": "Vollbild öffnen",
12
+ "controls.exitFullscreen": "Vollbild verlassen",
13
+ "canvas.label": "Flussdiagramm",
14
+ "canvas.loading": "Wird geladen…",
15
+ "canvas.selectionMode": "Auswahlmodus — tippe mit zwei Fingern, um ihn zu verlassen",
16
+ "a11y.nodeLabel": "Knoten: :label",
17
+ "a11y.nodeId": "Knoten :id",
18
+ "a11y.edgeLabel": "Verbindung: :label",
19
+ "a11y.edgeEndpoints": "Verbindung von :source zu :target",
20
+ "a11y.sourceHandle": "Ausgang :id",
21
+ "a11y.targetHandle": "Eingang :id",
22
+ "a11y.addControlPoint": "Doppelklicken, um einen Kontrollpunkt hinzuzufügen",
23
+ "announce.nodeAdded": "Knoten hinzugefügt: :label",
24
+ "announce.nodesAdded_one": ":count Knoten hinzugefügt",
25
+ "announce.nodesAdded_other": ":count Knoten hinzugefügt",
26
+ "announce.nodeRemoved": "Knoten entfernt: :label",
27
+ "announce.nodesRemoved_one": ":count Knoten entfernt",
28
+ "announce.nodesRemoved_other": ":count Knoten entfernt",
29
+ "announce.connected": ":source mit :target verbunden",
30
+ "announce.connectionsAdded_one": ":count Verbindung hinzugefügt",
31
+ "announce.connectionsAdded_other": ":count Verbindungen hinzugefügt",
32
+ "announce.disconnected": "Verbindung von :source zu :target entfernt",
33
+ "announce.connectionsRemoved_one": ":count Verbindung entfernt",
34
+ "announce.connectionsRemoved_other": ":count Verbindungen entfernt",
35
+ "announce.selectionCleared": "Auswahl aufgehoben",
36
+ "announce.nodesSelected_one": ":count Knoten",
37
+ "announce.nodesSelected_other": ":count Knoten",
38
+ "announce.edgesSelected_one": ":count Verbindung",
39
+ "announce.edgesSelected_other": ":count Verbindungen",
40
+ "announce.selectionJoin": ":nodes und :edges",
41
+ "announce.selected": ":items ausgewählt",
42
+ "announce.viewportZoom": "Ansicht: Zoom :percent %",
43
+ "announce.viewFitted": "Ansicht an Inhalt angepasst",
44
+ "announce.node": "Knoten",
45
+ "announce.reparented": ":name nach :parent verschoben",
46
+ "announce.detached": ":name von :parent gelöst",
47
+ "workflow.condition": "Bedingung",
48
+ "workflow.customEvaluator": "[eigene Auswertungsfunktion]",
49
+ "workflow.wait": "Warten",
50
+ "schema.inspector.noNode": "Kein Knoten ausgewählt.",
51
+ "schema.inspector.noEdge": "Keine Verbindung ausgewählt.",
52
+ "schema.inspector.noRow": "Keine Zeile ausgewählt.",
53
+ "schema.inspector.missingRow": "Die ausgewählte Zeile existiert nicht mehr.",
54
+ "schema.inspector.label": "Beschriftung",
55
+ "schema.inspector.name": "Name",
56
+ "schema.inspector.type": "Typ",
57
+ "schema.inspector.required": "Erforderlich",
58
+ "schema.inspector.remove": "Entfernen",
59
+ "schema.inspector.delete": "Löschen",
60
+ "schema.inspector.add": "Hinzufügen",
61
+ "schema.inspector.fieldName": "Feldname"
62
+ }
@@ -0,0 +1,62 @@
1
+ {
2
+ "controls.label": "Flow controls",
3
+ "controls.zoomIn": "Zoom in",
4
+ "controls.zoomOut": "Zoom out",
5
+ "controls.fitView": "Fit view",
6
+ "controls.toggleInteractive": "Toggle interactivity",
7
+ "controls.lockInteractive": "Lock interactivity",
8
+ "controls.unlockInteractive": "Unlock interactivity",
9
+ "controls.resetPanels": "Reset panels",
10
+ "controls.toggleFullscreen": "Toggle fullscreen",
11
+ "controls.enterFullscreen": "Enter fullscreen",
12
+ "controls.exitFullscreen": "Exit fullscreen",
13
+ "canvas.label": "Flow diagram",
14
+ "canvas.loading": "Loading…",
15
+ "canvas.selectionMode": "Selection Mode — tap with two fingers to exit",
16
+ "a11y.nodeLabel": "Node: :label",
17
+ "a11y.nodeId": "Node :id",
18
+ "a11y.edgeLabel": "Edge: :label",
19
+ "a11y.edgeEndpoints": "Edge from :source to :target",
20
+ "a11y.sourceHandle": "source handle :id",
21
+ "a11y.targetHandle": "target handle :id",
22
+ "a11y.addControlPoint": "Double-click to add control point",
23
+ "announce.nodeAdded": "Added node: :label",
24
+ "announce.nodesAdded_one": "Added :count node",
25
+ "announce.nodesAdded_other": "Added :count nodes",
26
+ "announce.nodeRemoved": "Removed node: :label",
27
+ "announce.nodesRemoved_one": "Removed :count node",
28
+ "announce.nodesRemoved_other": "Removed :count nodes",
29
+ "announce.connected": "Connected :source to :target",
30
+ "announce.connectionsAdded_one": "Added :count connection",
31
+ "announce.connectionsAdded_other": "Added :count connections",
32
+ "announce.disconnected": "Removed connection from :source to :target",
33
+ "announce.connectionsRemoved_one": "Removed :count connection",
34
+ "announce.connectionsRemoved_other": "Removed :count connections",
35
+ "announce.selectionCleared": "Selection cleared",
36
+ "announce.nodesSelected_one": ":count node",
37
+ "announce.nodesSelected_other": ":count nodes",
38
+ "announce.edgesSelected_one": ":count edge",
39
+ "announce.edgesSelected_other": ":count edges",
40
+ "announce.selectionJoin": ":nodes and :edges",
41
+ "announce.selected": ":items selected",
42
+ "announce.viewportZoom": "Viewport: zoom :percent%",
43
+ "announce.viewFitted": "Fitted view to content",
44
+ "announce.node": "node",
45
+ "announce.reparented": "Moved :name into :parent",
46
+ "announce.detached": "Detached :name from :parent",
47
+ "workflow.condition": "Condition",
48
+ "workflow.customEvaluator": "[custom evaluator]",
49
+ "workflow.wait": "Wait",
50
+ "schema.inspector.noNode": "No node selected.",
51
+ "schema.inspector.noEdge": "No edge selected.",
52
+ "schema.inspector.noRow": "No row selected.",
53
+ "schema.inspector.missingRow": "Selected row no longer exists.",
54
+ "schema.inspector.label": "label",
55
+ "schema.inspector.name": "name",
56
+ "schema.inspector.type": "type",
57
+ "schema.inspector.required": "required",
58
+ "schema.inspector.remove": "remove",
59
+ "schema.inspector.delete": "delete",
60
+ "schema.inspector.add": "add",
61
+ "schema.inspector.fieldName": "field name"
62
+ }
@@ -4,17 +4,24 @@
4
4
  * Creates a visually-hidden div with aria-live="polite" that announces
5
5
  * flow diagram changes. Hooks into _emit() via handleEvent().
6
6
  */
7
- export type FormatAnnouncementFn = (event: string, detail: Record<string, any>) => string | null;
7
+ import { type Translator } from './translations';
8
+ /**
9
+ * Custom announcement formatter. Receives the canvas translator as third
10
+ * argument so it can localise its own strings or delegate to
11
+ * {@link defaultFormatAnnouncement} for events it does not handle.
12
+ */
13
+ export type FormatAnnouncementFn = (event: string, detail: Record<string, any>, t: Translator) => string | null;
8
14
  /**
9
15
  * Default event-to-announcement formatter.
10
16
  * Returns null for events that should not be announced.
11
17
  */
12
- export declare function defaultFormatAnnouncement(event: string, detail: Record<string, any>): string | null;
18
+ export declare function defaultFormatAnnouncement(event: string, detail: Record<string, any>, t?: Translator): string | null;
13
19
  export declare class FlowAnnouncer {
14
20
  private _el;
15
21
  private _clearTimer;
16
22
  private _formatMessage;
17
- constructor(container: HTMLElement, formatMessage?: FormatAnnouncementFn);
23
+ private _t;
24
+ constructor(container: HTMLElement, formatMessage?: FormatAnnouncementFn, t?: Translator);
18
25
  announce(message: string): void;
19
26
  handleEvent(event: string, detail: Record<string, any>): void;
20
27
  destroy(): void;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The events the container listens to for pan and zoom.
3
+ *
4
+ * `wheel` and `mousedown`/`pointerdown` reach the pan/zoom behaviour; `dblclick`
5
+ * reaches the double-click zoom, which is bound separately (d3's stepped handler
6
+ * in the default mode, AlpineFlow's own in `'toggle'`) and is the one that used
7
+ * to be left out.
8
+ *
9
+ * `touchstart` is here because d3-zoom binds `touchstart.zoom` DIRECTLY rather
10
+ * than going through pointer events, so stopping `pointerdown` does not reach
11
+ * it: without this, a tap or a drag on any overlay still pans or pinches the
12
+ * canvas underneath it on a phone. The eraser already blocks touch by hand for
13
+ * the same reason.
14
+ */
15
+ export declare const CANVAS_GESTURES: readonly ["mousedown", "pointerdown", "touchstart", "wheel", "dblclick"];
16
+ export type CanvasGesture = (typeof CANVAS_GESTURES)[number];
17
+ /**
18
+ * Keep canvas gestures inside the element they landed on.
19
+ *
20
+ * Stopped on the way OUT of the overlay rather than on the way in, so the
21
+ * buttons inside it keep working: `stopPropagation` ends the bubble, and every
22
+ * listener already reached — including others on this same element — still runs.
23
+ *
24
+ * Pass a subset for an overlay that deliberately lets some gestures through; the
25
+ * minimap does, since a drag on it is its own to interpret and only the
26
+ * double-click zoom is unwanted.
27
+ *
28
+ * Returns a cleanup function that removes the listeners again.
29
+ */
30
+ export declare function isolateCanvasGestures(el: HTMLElement, gestures?: readonly CanvasGesture[]): () => void;
@@ -1,4 +1,7 @@
1
+ import { type Translator } from './translations';
1
2
  export interface ControlsPanelOptions {
3
+ /** Canvas translator for button titles. Defaults to English. */
4
+ t?: Translator;
2
5
  position: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
3
6
  orientation: 'vertical' | 'horizontal';
4
7
  showZoom: boolean;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Minimal edge shape for flag checking — allows partial edge objects
3
+ * from contexts where the full FlowEdge type isn't available.
4
+ */
5
+ interface EdgeLike {
6
+ selectable?: boolean;
7
+ }
8
+ /**
9
+ * Can this edge be selected by a pointer?
10
+ *
11
+ * `defaultValue` carries the canvas-wide `edgesSelectable` config, so an edge that
12
+ * says nothing follows the canvas and one that states a preference keeps it:
13
+ * { selectable: true }, canvas off → selectable (explicit override wins)
14
+ * { }, canvas off → not selectable
15
+ * { selectable: false }, canvas on → not selectable
16
+ * { }, canvas on → selectable
17
+ *
18
+ * Edges have no `locked`, so unlike `isSelectable` for nodes there is nothing else
19
+ * to weigh — this is the whole rule.
20
+ */
21
+ export declare function isEdgeSelectable(edge: EdgeLike, defaultValue?: boolean): boolean;
22
+ export {};
@@ -13,6 +13,18 @@ export declare function getGradientId(flowId: string, edgeId: string): string;
13
13
  * For gradients, returns the `from` color (used as fallback for selection highlight, etc.).
14
14
  */
15
15
  export declare function resolveStrokeColor(color: string | EdgeGradient | undefined): string | null;
16
+ /**
17
+ * Repaint an existing gradient def, without touching where it is.
18
+ *
19
+ * For the case where an edge's colour changed and NOTHING MOVED: the def's x1/y1/x2/y2 were worked
20
+ * out from the endpoints the last time they moved and are still right, so re-deriving them would
21
+ * mean re-pathing the edge — and, through the path refresh, every sibling edge on both of its
22
+ * nodes.
23
+ *
24
+ * Answers false where there is no def yet, which is the one case that genuinely needs the
25
+ * coordinates: an edge given a gradient for the first time has nothing to keep.
26
+ */
27
+ export declare function restyleGradientDef(defsEl: Element, id: string, gradient: EdgeGradient): boolean;
16
28
  /**
17
29
  * Create or update an SVG <linearGradient> element in a <defs> container.
18
30
  * Uses gradientUnits="userSpaceOnUse" so coordinates are in SVG canvas space.
@@ -1,4 +1,6 @@
1
1
  import type { FlowNode, Viewport, FlowCanvasConfig } from './types';
2
+ export declare const MINIMAP_DEFAULT_WIDTH = 200;
3
+ export declare const MINIMAP_DEFAULT_HEIGHT = 150;
2
4
  export interface MiniMapState {
3
5
  nodes: FlowNode[];
4
6
  viewport: Viewport;
@@ -25,6 +27,12 @@ export interface MiniMapOptions {
25
27
  export interface MiniMapInstance {
26
28
  render(): void;
27
29
  updateViewport(): void;
30
+ /**
31
+ * Give it another box. Redraws at the new size; ignores a width or height that is not positive.
32
+ * Returns whether the box actually changed, so a caller can keep config and events in step with
33
+ * what was drawn rather than with what was asked for.
34
+ */
35
+ resize(width: number, height: number): boolean;
28
36
  destroy(): void;
29
37
  }
30
38
  export declare function createMiniMap(container: HTMLElement, options: MiniMapOptions): MiniMapInstance;
@@ -14,6 +14,10 @@ interface NodeLike {
14
14
  export declare function isDraggable(node: NodeLike): boolean;
15
15
  export declare function isDeletable(node: NodeLike): boolean;
16
16
  export declare function isConnectable(node: NodeLike): boolean;
17
- export declare function isSelectable(node: NodeLike): boolean;
17
+ /**
18
+ * `defaultValue` carries the canvas-wide `nodesSelectable` config: a node with no
19
+ * `selectable` of its own follows the canvas, and one that states a preference keeps it.
20
+ */
21
+ export declare function isSelectable(node: NodeLike, defaultValue?: boolean): boolean;
18
22
  export declare function isResizable(node: NodeLike): boolean;
19
23
  export {};
@@ -49,6 +49,24 @@ export interface PanZoomOptions {
49
49
  * zoom-in. Clamped to [minZoom, maxZoom]. Only consulted when
50
50
  * `zoomOnDoubleClick: 'toggle'`. Default: 1.5 */
51
51
  dblClickZoomLevel?: number;
52
+ /** Where a toggle double-click zooms out to when there is no remembered viewport
53
+ * to restore — the user reached this zoom by wheel or `setViewport`, or panned
54
+ * after zooming in and so dropped the memory.
55
+ *
56
+ * - `'min'` (default) — `minZoom`, about the cursor.
57
+ * - `'fit'` — the viewport that frames the whole graph, as `fitView()` computes
58
+ * it. Needs {@link PanZoomOptions.getFitViewport}; falls back to `'min'` when
59
+ * there is nothing to fit.
60
+ * - `number` — a fixed level, about the cursor. Clamped to [minZoom, maxZoom].
61
+ *
62
+ * Only consulted when `zoomOnDoubleClick: 'toggle'`; a remembered viewport always
63
+ * wins over it. Default: `'min'` */
64
+ dblClickZoomOutLevel?: number | 'fit' | 'min';
65
+ /** Viewport that frames the whole graph, or `null` when there is nothing to frame.
66
+ * Called only when a toggle double-click zooms out under
67
+ * `dblClickZoomOutLevel: 'fit'` — pan/zoom does not know about nodes, so the
68
+ * consumer supplies this. */
69
+ getFitViewport?: () => Viewport | null;
52
70
  /** Key code that temporarily enables panning when held. Default: 'Space' */
53
71
  panActivationKeyCode?: string | null;
54
72
  /** Key code that forces zoom (overrides panOnScroll) when held with wheel. Default: 'Control'.
@@ -119,18 +137,27 @@ interface ViewportTransform {
119
137
  * so the next double-click can put it back exactly;
120
138
  * - at or above `level` with a remembered viewport → restore it;
121
139
  * - at or above `level` with nothing remembered (the user got here by wheel or
122
- * `setViewport`) → zoom out to `minZoom` about the cursor, so the gesture always
123
- * does something rather than stalling.
140
+ * `setViewport`, or panned after zooming in and so dropped the memory) → zoom out
141
+ * to `zoomOut`, so the gesture always does something rather than stalling.
142
+ *
143
+ * `zoomOut` is `'min'` by default — `minZoom` about the cursor. `'fit'` puts the
144
+ * whole graph back on screen instead, which is what the second double-click means
145
+ * on a canvas people read rather than survey; a number is a fixed level, again about
146
+ * the cursor. Only this fallback is configurable: with a remembered viewport, going
147
+ * back exactly where you came from beats any level anybody could name.
148
+ *
149
+ * `fit` is a thunk rather than a viewport because measuring every node's bounds is
150
+ * only worth doing on the branch that uses it, and most double-clicks zoom in.
124
151
  *
125
152
  * Pure so the decision can be tested without driving d3-zoom through a real DOM.
126
153
  *
127
- * Precondition: `level` must sit strictly above `minZoom`. A toggle needs somewhere
128
- * to go — when the two coincide, "at or above the level" is also "already at the
129
- * floor", so the zoom-out branch has no room and the gesture cannot move the
130
- * viewport. That configuration is rejected at wiring time (createPanZoom keeps
131
- * d3's native stepped handler instead of installing a toggle that would stall);
132
- * should it reach here anyway, the current viewport is returned unchanged rather
133
- * than a transform that merely looks new.
154
+ * Precondition: `level` must sit strictly above the level zooming out lands on. A
155
+ * toggle needs somewhere to go — when the two coincide, "at or above the level" is
156
+ * also "already at the floor", so the zoom-out branch has no room and the gesture
157
+ * cannot move the viewport. That configuration is rejected at wiring time
158
+ * (createPanZoom keeps d3's native stepped handler instead of installing a toggle
159
+ * that would stall); should it reach here anyway, the current viewport is returned
160
+ * unchanged rather than a transform that merely looks new.
134
161
  */
135
162
  export declare function resolveDblClickZoom(current: ViewportTransform, pointer: {
136
163
  x: number;
@@ -139,6 +166,8 @@ export declare function resolveDblClickZoom(current: ViewportTransform, pointer:
139
166
  level: number;
140
167
  minZoom: number;
141
168
  remembered: ViewportTransform | null;
169
+ zoomOut?: number | 'fit' | 'min';
170
+ fit?: (() => ViewportTransform | null) | null;
142
171
  }): {
143
172
  next: ViewportTransform;
144
173
  remember: ViewportTransform | null;
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Every message the engine ships, keyed as in `locales/en.json`. Messages that
3
+ * carry a `:count` appear in the two plural forms English uses, `_one` and `_other`.
4
+ */
5
+ interface EnglishMessages {
6
+ /** Accessible name of the controls panel. */
7
+ 'controls.label'?: string;
8
+ /** Tooltip / accessible name of the zoom-in button. */
9
+ 'controls.zoomIn'?: string;
10
+ /** Tooltip / accessible name of the zoom-out button. */
11
+ 'controls.zoomOut'?: string;
12
+ /** Tooltip / accessible name of the fit-view button. */
13
+ 'controls.fitView'?: string;
14
+ /** Tooltip of the interactivity toggle before its state is known. */
15
+ 'controls.toggleInteractive'?: string;
16
+ /** Tooltip of the interactivity toggle while the canvas is interactive (click locks it). */
17
+ 'controls.lockInteractive'?: string;
18
+ /** Tooltip of the interactivity toggle while the canvas is locked (click unlocks it). */
19
+ 'controls.unlockInteractive'?: string;
20
+ /** Tooltip / accessible name of the reset-panels button. */
21
+ 'controls.resetPanels'?: string;
22
+ /** Tooltip of the fullscreen toggle before its state is known. */
23
+ 'controls.toggleFullscreen'?: string;
24
+ /** Tooltip of the fullscreen toggle while windowed (click enters fullscreen). */
25
+ 'controls.enterFullscreen'?: string;
26
+ /** Tooltip of the fullscreen toggle while fullscreen (click exits). */
27
+ 'controls.exitFullscreen'?: string;
28
+ /** Default `aria-label` of the canvas container (overridden by `ariaLabel`). */
29
+ 'canvas.label'?: string;
30
+ /** Text shown while the canvas initialises (overridden by `loadingText`). */
31
+ 'canvas.loading'?: string;
32
+ /** Touch hint shown while multi-selection mode is active. */
33
+ 'canvas.selectionMode'?: string;
34
+ /** Accessible name of a node with a label. Placeholder: `:label`. */
35
+ 'a11y.nodeLabel'?: string;
36
+ /** Accessible name of a node without a label. Placeholder: `:id`. */
37
+ 'a11y.nodeId'?: string;
38
+ /** Accessible name of an edge with a label. Placeholder: `:label`. */
39
+ 'a11y.edgeLabel'?: string;
40
+ /** Accessible name of an edge without a label. Placeholders: `:source`, `:target`. */
41
+ 'a11y.edgeEndpoints'?: string;
42
+ /** Accessible name of a source handle. Placeholder: `:id`. */
43
+ 'a11y.sourceHandle'?: string;
44
+ /** Accessible name of a target handle. Placeholder: `:id`. */
45
+ 'a11y.targetHandle'?: string;
46
+ /** Tooltip on an editable edge's midpoint. */
47
+ 'a11y.addControlPoint'?: string;
48
+ /** Announced when one labelled node is added. Placeholder: `:label`. */
49
+ 'announce.nodeAdded'?: string;
50
+ /** Announced when several nodes are added. Placeholder: `:count` (plural, singular form). */
51
+ 'announce.nodesAdded_one'?: string;
52
+ /** Announced when several nodes are added. Placeholder: `:count` (plural, default form). */
53
+ 'announce.nodesAdded_other'?: string;
54
+ /** Announced when one labelled node is removed. Placeholder: `:label`. */
55
+ 'announce.nodeRemoved'?: string;
56
+ /** Announced when several nodes are removed. Placeholder: `:count` (plural, singular form). */
57
+ 'announce.nodesRemoved_one'?: string;
58
+ /** Announced when several nodes are removed. Placeholder: `:count` (plural, default form). */
59
+ 'announce.nodesRemoved_other'?: string;
60
+ /** Announced when one edge is added. Placeholders: `:source`, `:target`. */
61
+ 'announce.connected'?: string;
62
+ /** Announced when several edges are added. Placeholder: `:count` (plural, singular form). */
63
+ 'announce.connectionsAdded_one'?: string;
64
+ /** Announced when several edges are added. Placeholder: `:count` (plural, default form). */
65
+ 'announce.connectionsAdded_other'?: string;
66
+ /** Announced when one edge with known endpoints is removed. Placeholders: `:source`, `:target`. */
67
+ 'announce.disconnected'?: string;
68
+ /** Announced when edges without known endpoints are removed. Placeholder: `:count` (plural, singular form). */
69
+ 'announce.connectionsRemoved_one'?: string;
70
+ /** Announced when edges without known endpoints are removed. Placeholder: `:count` (plural, default form). */
71
+ 'announce.connectionsRemoved_other'?: string;
72
+ /** Announced when the selection becomes empty. */
73
+ 'announce.selectionCleared'?: string;
74
+ /** Node part of a selection announcement. Placeholder: `:count` (plural, singular form). */
75
+ 'announce.nodesSelected_one'?: string;
76
+ /** Node part of a selection announcement. Placeholder: `:count` (plural, default form). */
77
+ 'announce.nodesSelected_other'?: string;
78
+ /** Edge part of a selection announcement. Placeholder: `:count` (plural, singular form). */
79
+ 'announce.edgesSelected_one'?: string;
80
+ /** Edge part of a selection announcement. Placeholder: `:count` (plural, default form). */
81
+ 'announce.edgesSelected_other'?: string;
82
+ /** Joins the node and edge parts of a selection announcement. Placeholders: `:nodes`, `:edges`. */
83
+ 'announce.selectionJoin'?: string;
84
+ /** Wraps the selection summary. Placeholder: `:items`. */
85
+ 'announce.selected'?: string;
86
+ /** Announced when panning or zooming ends. Placeholder: `:percent`. */
87
+ 'announce.viewportZoom'?: string;
88
+ /** Announced after fit-view. */
89
+ 'announce.viewFitted'?: string;
90
+ /** Fallback name for a node without label or id in reparent announcements. */
91
+ 'announce.node'?: string;
92
+ /** Announced when a node is moved into a parent. Placeholders: `:name`, `:parent`. */
93
+ 'announce.reparented'?: string;
94
+ /** Announced when a node leaves its parent. Placeholders: `:name`, `:parent`. */
95
+ 'announce.detached'?: string;
96
+ /** Default label of a condition node without `data.label`. */
97
+ 'workflow.condition'?: string;
98
+ /** Shown instead of an expression when a condition uses a custom evaluator function. */
99
+ 'workflow.customEvaluator'?: string;
100
+ /** Default label of a wait node without `data.label`. */
101
+ 'workflow.wait'?: string;
102
+ /** Node inspector placeholder while nothing is selected. */
103
+ 'schema.inspector.noNode'?: string;
104
+ /** Edge inspector placeholder while nothing is selected. */
105
+ 'schema.inspector.noEdge'?: string;
106
+ /** Row inspector placeholder while nothing is selected. */
107
+ 'schema.inspector.noRow'?: string;
108
+ /** Row inspector message when the selected row was deleted. */
109
+ 'schema.inspector.missingRow'?: string;
110
+ /** Form label of the edge label input. */
111
+ 'schema.inspector.label'?: string;
112
+ /** Form label of the row name input. */
113
+ 'schema.inspector.name'?: string;
114
+ /** Form label and placeholder of the row type input. */
115
+ 'schema.inspector.type'?: string;
116
+ /** Form label of the row "required" checkbox. */
117
+ 'schema.inspector.required'?: string;
118
+ /** Button verb that removes a row. */
119
+ 'schema.inspector.remove'?: string;
120
+ /** Button verb that deletes the selected edge. */
121
+ 'schema.inspector.delete'?: string;
122
+ /** Button verb that adds a row. */
123
+ 'schema.inspector.add'?: string;
124
+ /** Placeholder of the new-row name input. */
125
+ 'schema.inspector.fieldName'?: string;
126
+ }
127
+ type PluralCategory = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
128
+ /** Base keys of the messages with plural forms, e.g. `announce.nodesSelected`. */
129
+ type PluralMessage = keyof EnglishMessages extends infer K ? K extends `${infer Base}_other` ? Base : never : never;
130
+ /**
131
+ * Plural forms other languages need besides `_one` / `_other`: Arabic uses `_zero`
132
+ * and `_two`, Polish and Russian `_few` and `_many`. A language's categories are
133
+ * listed by `new Intl.PluralRules(locale).resolvedOptions().pluralCategories`.
134
+ */
135
+ type AdditionalPluralForms = {
136
+ [K in `${PluralMessage}_${Exclude<PluralCategory, 'one' | 'other'>}`]?: string;
137
+ };
138
+ /**
139
+ * UI messages of a canvas. Every key is optional; missing keys fall back to
140
+ * English. Messages are plain text with literal `:placeholder` substitution.
141
+ * Keys that carry a `:count` exist once per CLDR plural category (`_one`,
142
+ * `_few`, `_other`, …) and are selected with the canvas `locale`.
143
+ */
144
+ export interface FlowTranslations extends EnglishMessages, AdditionalPluralForms {
145
+ }
146
+ type MessageKey = keyof FlowTranslations;
147
+ /** Message keys as callers use them: plural variants collapse onto their base key. */
148
+ export type TranslationKey = MessageKey extends infer K ? K extends `${infer Base}_${PluralCategory}` ? Base : K : never;
149
+ /**
150
+ * Plural rules for a locale tag. Accepts Laravel-style underscores (`pt_BR`),
151
+ * defaults to the document language and falls back to English for invalid tags.
152
+ */
153
+ export declare function resolvePluralRules(locale?: string): Intl.PluralRules;
154
+ /** Translates a message key with optional placeholder values. See {@link createTranslator}. */
155
+ export type Translator = (key: TranslationKey, values?: Record<string, string | number>) => string;
156
+ /**
157
+ * Build a translator for one canvas. The overrides are copied once into a plain
158
+ * object, so later changes to the source dictionary (or Alpine reactivity on it)
159
+ * do not affect the result; recreate the canvas to change its language.
160
+ *
161
+ * Lookup order: the override for the locale's plural category, the override's
162
+ * `_other` form, then the English message selected with English plural rules.
163
+ * Empty strings and non-string values are ignored. Placeholders (`:label`) are
164
+ * substituted literally.
165
+ */
166
+ export declare function createTranslator(translations?: FlowTranslations, locale?: string): Translator;
167
+ /** English messages with English plural rules, shared by call sites that have no canvas. */
168
+ export declare const englishTranslator: Translator;
169
+ /**
170
+ * Translator for a directive's canvas scope: delegates to the canvas `t()` when
171
+ * present, otherwise English. Lets directives and inspectors mount against a
172
+ * plain `x-data` host (tests, custom shells) without a `flowCanvas` instance.
173
+ */
174
+ export declare function canvasTranslator(canvas: unknown): Translator;
175
+ export {};