@getartisanflow/alpineflow 0.2.3-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 +6970 -6855
- package/dist/alpineflow.bundle.esm.js.map +1 -1
- package/dist/alpineflow.esm.js +2 -2
- package/dist/alpineflow.js +1 -1
- package/dist/{index-B8jw3ALY.js → index-CvQXC8Md.js} +6051 -5936
- 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/controls-panel.d.ts +3 -0
- package/dist/types/src/core/translations.d.ts +175 -0
- package/dist/types/src/core/types.d.ts +19 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/plugin/data/canvas-context.d.ts +1 -1
- package/package.json +4 -2
- package/dist/index-B8jw3ALY.js.map +0 -1
|
@@ -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
|
-
|
|
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
|
|
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
|
-
|
|
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;
|
|
@@ -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,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 {};
|
|
@@ -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';
|
|
@@ -1029,6 +1030,13 @@ export type SchemaRowClassResolver = (ctx: SchemaRowClassContext) => SchemaClass
|
|
|
1029
1030
|
*/
|
|
1030
1031
|
export type SchemaNodeClassResolver = (ctx: SchemaNodeClassContext) => SchemaClassValue | SchemaNodeClassMap;
|
|
1031
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;
|
|
1032
1040
|
nodes?: FlowNode[];
|
|
1033
1041
|
edges?: FlowEdge[];
|
|
1034
1042
|
/** Initial viewport state */
|
|
@@ -1254,6 +1262,10 @@ export interface FlowCanvasConfig {
|
|
|
1254
1262
|
* to follow the container watches for a resize and calls `resize()` on the instance.
|
|
1255
1263
|
*/
|
|
1256
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
|
+
*/
|
|
1257
1269
|
minimapHeight?: number;
|
|
1258
1270
|
/**
|
|
1259
1271
|
* Element to enter fullscreen mode, instead of the canvas container.
|
|
@@ -1285,7 +1297,7 @@ export interface FlowCanvasConfig {
|
|
|
1285
1297
|
/** Screen reader announcements. true (default) = on, false = off,
|
|
1286
1298
|
* or object with formatMessage callback for custom messages. */
|
|
1287
1299
|
announcements?: boolean | {
|
|
1288
|
-
formatMessage?: (event: string, detail: Record<string, any
|
|
1300
|
+
formatMessage?: (event: string, detail: Record<string, any>, t: Translator) => string | null;
|
|
1289
1301
|
};
|
|
1290
1302
|
/** Compute mode. 'manual' (default) = explicit $flow.compute() calls,
|
|
1291
1303
|
* 'auto' = re-propagate on node/edge changes (debounced). */
|
|
@@ -2020,6 +2032,12 @@ export interface FlowInstance {
|
|
|
2020
2032
|
clearNodeFilter(): void;
|
|
2021
2033
|
/** Update runtime config options (zoom limits, background, colorMode, etc.). */
|
|
2022
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;
|
|
2023
2041
|
/** Current resolved color mode, or undefined if not managed. */
|
|
2024
2042
|
readonly colorMode?: 'light' | 'dark';
|
|
2025
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';
|
|
@@ -350,12 +350,12 @@ 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
|
-
/** Recompute SVG paths, label positions, and gradients for affected edges */
|
|
354
353
|
/**
|
|
355
354
|
* Repaint one edge's gradient where nothing moved. False where it has no def yet, and the caller
|
|
356
355
|
* falls back to the path refresh — see the implementation for why that is worth avoiding.
|
|
357
356
|
*/
|
|
358
357
|
_restyleEdgeGradient(edgeId: string, gradient: EdgeGradient): boolean;
|
|
358
|
+
/** Recompute SVG paths, label positions, and gradients for affected edges */
|
|
359
359
|
_refreshEdgePaths(movedNodeIds: Set<string>): void;
|
|
360
360
|
/** Hydrate from a pre-rendered static diagram */
|
|
361
361
|
_hydrateFromStatic(): void;
|
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",
|