@eightkk/vue-weave 1.0.0 → 1.2.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/CHANGELOG.md +42 -7
- package/CONTRIBUTING.md +13 -20
- package/README.ja.md +51 -37
- package/README.md +50 -36
- package/dist/{core-BH5rTsKp.js → core-C7J4FG_e.js} +5354 -2577
- package/dist/core.js +1 -1
- package/dist/index.js +6093 -3515
- package/dist/style.css +1 -1
- package/dist/types/components/EventCalendar.vue.d.ts +105 -0
- package/dist/types/components/GanttChart.vue.d.ts +15 -1
- package/dist/types/components/GraphPalette.vue.d.ts +38 -0
- package/dist/types/components/NetworkGraph.vue.d.ts +7 -1
- package/dist/types/components/PropertyInspector.vue.d.ts +41 -0
- package/dist/types/components/TaskBoard.vue.d.ts +72 -0
- package/dist/types/components/graphPalette.d.ts +12 -0
- package/dist/types/core/diagramEditor.d.ts +136 -0
- package/dist/types/core/earnedValue.d.ts +165 -0
- package/dist/types/core/eventCalendar.d.ts +214 -0
- package/dist/types/core/exportSvg.d.ts +8 -1
- package/dist/types/core/graph.d.ts +7 -2
- package/dist/types/core/graphCollapse.d.ts +1 -1
- package/dist/types/core/graphSwimlanes.d.ts +47 -0
- package/dist/types/core/index.d.ts +12 -0
- package/dist/types/core/interchange.d.ts +7 -0
- package/dist/types/core/interchangeDrawio.d.ts +60 -0
- package/dist/types/core/interchangeGraph.d.ts +153 -0
- package/dist/types/core/interchangeGraphMl.d.ts +32 -0
- package/dist/types/core/interchangeMermaid.d.ts +48 -0
- package/dist/types/core/sheetEditing.d.ts +36 -0
- package/dist/types/core/taskBoard.d.ts +150 -0
- package/dist/types/core/types.d.ts +49 -2
- package/dist/types/index.d.ts +44 -0
- package/docs/api.md +378 -0
- package/docs/architecture.md +6 -2
- package/docs/integration.md +180 -0
- package/docs/scheduling.md +31 -0
- package/docs/security.md +1 -0
- package/package.json +1 -1
|
@@ -26,6 +26,37 @@ export interface GraphSwimlane extends GraphSwimlaneBand {
|
|
|
26
26
|
export interface GraphSwimlaneLayout extends GraphLayout {
|
|
27
27
|
/** Every lane in the caller's order, empty lanes included. */
|
|
28
28
|
lanes: GraphSwimlane[];
|
|
29
|
+
/** Every pool in display order; only present with the `pools` option. */
|
|
30
|
+
pools?: GraphSwimlanePool[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A pool (BPMN participant) of a swimlane layout: a container around consecutive lanes with a title band at the flow
|
|
34
|
+
* start. `label` defaults to the ID.
|
|
35
|
+
*/
|
|
36
|
+
export interface GraphSwimlanePoolSpec {
|
|
37
|
+
id: string;
|
|
38
|
+
label?: string;
|
|
39
|
+
/** IDs of the pool's lanes. They must be consecutive in the `lanes` order; their order here does not matter. */
|
|
40
|
+
lanes: readonly string[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The drawn geometry of one pool: the rectangle around its lanes (title band included) and the title band, in layout
|
|
44
|
+
* coordinates. NetworkGraph `pools` and `renderGraphSvg` `pools` take this shape. A title band that is taller than it
|
|
45
|
+
* is wide shows its title rotated, reading from bottom to top.
|
|
46
|
+
*/
|
|
47
|
+
export interface GraphSwimlanePoolBand extends GraphRect {
|
|
48
|
+
id: string;
|
|
49
|
+
label: string;
|
|
50
|
+
/** The title band at the flow start of the pool; it lies inside the pool. A zero size draws no title band. */
|
|
51
|
+
header: GraphRect;
|
|
52
|
+
/** IDs of the pool's lanes in display order. NetworkGraph draws these lanes inside the pool's group. */
|
|
53
|
+
laneIds: readonly string[];
|
|
54
|
+
}
|
|
55
|
+
/** A pool of a `layoutSwimlaneGraph` result: its band plus its position in display order. */
|
|
56
|
+
export interface GraphSwimlanePool extends GraphSwimlanePoolBand {
|
|
57
|
+
/** Position in display order, from 0. */
|
|
58
|
+
index: number;
|
|
59
|
+
laneIds: string[];
|
|
29
60
|
}
|
|
30
61
|
/**
|
|
31
62
|
* Options of `layoutSwimlaneGraph`: the shared layout options plus the lanes. `N` is the node type, so a `laneOf`
|
|
@@ -50,7 +81,23 @@ export interface GraphSwimlaneLayoutOptions<N extends IdentifiedNode = Identifie
|
|
|
50
81
|
crossingReduction?: 'none' | 'barycenter';
|
|
51
82
|
/** Maximum number of alternating sweeps of the crossing reduction. Default 8. */
|
|
52
83
|
crossingSweeps?: number;
|
|
84
|
+
/**
|
|
85
|
+
* Pools (BPMN participants) around the lanes, opt-in. With pools, every lane belongs to exactly one pool, the lanes of
|
|
86
|
+
* a pool are consecutive in `lanes`, each pool gets a title band of `poolHeaderSize` before the lane headers, and
|
|
87
|
+
* pools are `poolGap` apart. The lane of a pool with a single lane gets no header of its own (a zero-size header).
|
|
88
|
+
*/
|
|
89
|
+
pools?: readonly GraphSwimlanePoolSpec[];
|
|
90
|
+
/** Thickness of a pool's title band along the flow. Default 32. */
|
|
91
|
+
poolHeaderSize?: number;
|
|
92
|
+
/** Free space between neighbouring pools, in place of `laneGap`. Default 24. */
|
|
93
|
+
poolGap?: number;
|
|
53
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Throws a descriptive error for a pool list that cannot be drawn: an empty or repeated ID, a label that is not a string
|
|
97
|
+
* or a `laneIds` value that is not an array of IDs (Error), or a pool or title band that is not finite or has a
|
|
98
|
+
* negative size (RangeError). `where` names the caller in the message.
|
|
99
|
+
*/
|
|
100
|
+
export declare function assertGraphSwimlanePools(pools: readonly GraphSwimlanePoolBand[], where: string): void;
|
|
54
101
|
/**
|
|
55
102
|
* Throws a descriptive error for a lane list that cannot be drawn: an empty or repeated ID (Error) or a band or header
|
|
56
103
|
* that is not finite or has a negative size (RangeError). `where` names the caller in the message.
|
|
@@ -7,6 +7,7 @@ export type { WorkCalendar, WorkShift, WeeklyShift, WorkWeek } from './workCalen
|
|
|
7
7
|
export * from './scheduling.js';
|
|
8
8
|
export * from './resourceLoad.js';
|
|
9
9
|
export * from './fieldEditing.js';
|
|
10
|
+
export * from './sheetEditing.js';
|
|
10
11
|
export * from './timelineView.js';
|
|
11
12
|
export { intlTimeFormatter, calendarZoomPresets } from './calendarFormat.js';
|
|
12
13
|
export type { IntlTimeFormatterOptions, CalendarZoomLevel, CalendarZoomPresetOptions, CalendarZoomPreset } from './calendarFormat.js';
|
|
@@ -15,6 +16,7 @@ export { layoutTreeGraph, layoutRadialGraph, layoutCircularGraph, layoutGridGrap
|
|
|
15
16
|
export type { GraphTreeLayoutOptions, GraphRadialLayoutOptions, GraphCircularLayoutOptions, GraphGridLayoutOptions, GraphConcentricLayoutOptions } from './graphLayouts.js';
|
|
16
17
|
export { layoutSwimlaneGraph, graphSwimlaneAt } from './graphSwimlanes.js';
|
|
17
18
|
export type { GraphSwimlaneSpec, GraphSwimlaneBand, GraphSwimlane, GraphSwimlaneLayout, GraphSwimlaneLayoutOptions } from './graphSwimlanes.js';
|
|
19
|
+
export type { GraphSwimlanePoolSpec, GraphSwimlanePoolBand, GraphSwimlanePool } from './graphSwimlanes.js';
|
|
18
20
|
export { layoutForceGraph } from './graphForce.js';
|
|
19
21
|
export type { GraphForceLayoutOptions } from './graphForce.js';
|
|
20
22
|
export { layoutFlowGraph, graphFlowBands } from './graphFlow.js';
|
|
@@ -45,6 +47,8 @@ export { rescheduleFromActuals, actualsTimelineBars } from './actuals.js';
|
|
|
45
47
|
export type { TaskActuals, ActualsDiagnostic, ActualsDiagnosticCode, ActualsTask, ActualsTaskState, RescheduleFromActualsResult, RescheduleFromActualsFields, ActualsTimelineBarOptions, } from './actuals.js';
|
|
46
48
|
export { toMsProjectXml, fromMsProjectXml, timelineFromMsProject, workCalendarsFromMsProject, resourceLoadFromMsProject, toICalendar, fromICalendar, timelineFromICalendar, toCsv, timelineCsvTable, parseCsv, timelineFromCsvTable, } from './interchange.js';
|
|
47
49
|
export type { MsProjectTask, MsProjectBaseline, MsProjectDependency, MsProjectInput, MsProjectXmlOptions, MsProjectImport, MsProjectImportTask, MsProjectImportWarning, MsProjectImportWarningCode, MsProjectTimelineOptions, MsProjectTimeline, MsProjectCalendar, MsProjectResource, MsProjectAssignment, MsProjectResourceLoadOptions, MsProjectResourceLoad, ICalendarEvent, ICalendarOptions, ICalendarImport, ICalendarImportEvent, ICalendarImportOptions, ICalendarImportWarning, ICalendarImportWarningCode, ICalendarTimeline, CsvCell, TimelineCsvColumn, TimelineCsvOptions, CsvParseOptions, TimelineCsvImportOptions, TimelineCsvImport, } from './interchange.js';
|
|
50
|
+
export { toMermaid, fromMermaid, toGraphMl, fromGraphMl, toDrawio, fromDrawio, fromDrawioAsync } from './interchange.js';
|
|
51
|
+
export type { GraphInterchangeInput, GraphInterchangeImport, GraphInterchangeImportOptions, GraphInterchangeWarning, GraphInterchangeWarningCode, MermaidDirection, MermaidOptions, GraphMlOptions, DrawioOptions, DrawioImportOptions, DrawioAsyncImportOptions, } from './interchange.js';
|
|
48
52
|
export { scheduleToGraph } from './pert.js';
|
|
49
53
|
export type { ScheduleGraph, ScheduleGraphOptions, ScheduleGraphNodeData, ScheduleGraphEdgeData } from './pert.js';
|
|
50
54
|
export * from './viewBindings.js';
|
|
@@ -73,3 +77,11 @@ export { createGraphExpansion, beginGraphExpansion, cancelGraphExpansion, mergeG
|
|
|
73
77
|
export type { GraphExpansionState, GraphExpansionPage, GraphExpansionView } from './graphExpansion.js';
|
|
74
78
|
export { layoutGraphIncrementally, graphLayoutChangeMetrics } from './graphIncremental.js';
|
|
75
79
|
export type { GraphKnownPosition, GraphIncrementalLayoutOptions, GraphIncrementalLayout, GraphLayoutChangeOptions, GraphLayoutChangeMetrics, } from './graphIncremental.js';
|
|
80
|
+
export { eventCalendarRange, eventCalendarDays, eventCalendarMonthGrid, shiftEventCalendarDate, eventCalendarTimeOfDay, eventCalendarTimeAt, layoutCalendarDayEvents, packCalendarEventLanes, validateCalendarEvents, } from './eventCalendar.js';
|
|
81
|
+
export type { EventCalendarView, CalendarEvent, CalendarResource, EventCalendarOptions, EventCalendarDay, CalendarEventColumn, CalendarEventLane, CalendarEventLaneLayout, EventCalendarEdit, EventCalendarCreate, EventCalendarEditValidator, EventCalendarCreateValidator, EventCalendarEditCancelReason, EventCalendarEditCancel, EventCalendarLabels, } from './eventCalendar.js';
|
|
82
|
+
export { graphPaletteMimeType } from './diagramEditor.js';
|
|
83
|
+
export type { GraphPaletteItem, GraphPaletteLabels, GraphPaletteDrop, InspectorFieldKind, InspectorItem, InspectorField, InspectorChange, InspectorChangeValidator, PropertyInspectorLabels, PropertyInspectorFieldSlot, } from './diagramEditor.js';
|
|
84
|
+
export { groupBoardCards, boardCardPosition, applyBoardCardMove } from './taskBoard.js';
|
|
85
|
+
export type { TaskBoardColumn, TaskBoardLane, TaskBoardCard, TaskBoardPosition, TaskBoardCardMove, TaskBoardCardMoveValidator, TaskBoardMoveCancelReason, TaskBoardMoveCancel, TaskBoardCell, TaskBoardColumnStatus, TaskBoardGroups, TaskBoardLabels, } from './taskBoard.js';
|
|
86
|
+
export { computeEarnedValue, rollupEarnedValue, maxEarnedValuePoints } from './earnedValue.js';
|
|
87
|
+
export type { EarnedValueRecord, EarnedValueTask, EarnedValueEacMethod, EarnedValueSeriesOptions, EarnedValueOptions, EarnedValueAmounts, EarnedValueMetrics, EarnedValueTaskResult, EarnedValuePoint, EarnedValueResult, } from './earnedValue.js';
|
|
@@ -4,3 +4,10 @@ export { toICalendar, fromICalendar, timelineFromICalendar } from './interchange
|
|
|
4
4
|
export type { ICalendarEvent, ICalendarOptions, ICalendarImportEvent, ICalendarImportOptions, ICalendarImportWarningCode, ICalendarImportWarning, ICalendarImport, ICalendarTimeline, } from './interchangeICalendar.js';
|
|
5
5
|
export { toCsv, timelineCsvTable, parseCsv, timelineFromCsvTable } from './interchangeCsv.js';
|
|
6
6
|
export type { CsvCell, TimelineCsvColumn, TimelineCsvOptions, CsvParseOptions, TimelineCsvImportOptions, TimelineCsvImport, } from './interchangeCsv.js';
|
|
7
|
+
export { toMermaid, fromMermaid } from './interchangeMermaid.js';
|
|
8
|
+
export type { MermaidDirection, MermaidOptions } from './interchangeMermaid.js';
|
|
9
|
+
export { toGraphMl, fromGraphMl } from './interchangeGraphMl.js';
|
|
10
|
+
export type { GraphMlOptions } from './interchangeGraphMl.js';
|
|
11
|
+
export { toDrawio, fromDrawio, fromDrawioAsync } from './interchangeDrawio.js';
|
|
12
|
+
export type { DrawioOptions, DrawioImportOptions, DrawioAsyncImportOptions } from './interchangeDrawio.js';
|
|
13
|
+
export type { GraphInterchangeInput, GraphInterchangeImport, GraphInterchangeImportOptions, GraphInterchangeWarning, GraphInterchangeWarningCode, } from './interchangeGraph.js';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { GraphLayoutDirection } from './graph.js';
|
|
2
|
+
import { type GraphInterchangeImport, type GraphInterchangeImportOptions, type GraphInterchangeInput } from './interchangeGraph.js';
|
|
3
|
+
export interface DrawioOptions {
|
|
4
|
+
/** The name of the page. Default `Page-1`. */
|
|
5
|
+
pageName?: string;
|
|
6
|
+
/** The direction of the `layoutLayeredGraph` layout that places nodes without a position. Default `LR`. */
|
|
7
|
+
direction?: GraphLayoutDirection;
|
|
8
|
+
}
|
|
9
|
+
export interface DrawioImportOptions extends GraphInterchangeImportOptions {
|
|
10
|
+
/** The page to read: its zero-based index or its name. Default the first page. */
|
|
11
|
+
page?: number | string;
|
|
12
|
+
}
|
|
13
|
+
export interface DrawioAsyncImportOptions extends DrawioImportOptions {
|
|
14
|
+
/**
|
|
15
|
+
* The largest inflated page, in characters of its URI-encoded text, that `fromDrawioAsync` accepts before it throws a
|
|
16
|
+
* RangeError, so a small compressed file cannot expand without bound. Default 20,000,000.
|
|
17
|
+
*/
|
|
18
|
+
maxInflatedLength?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Write a diagram as an uncompressed draw.io file (`mxfile` with one `diagram` page holding an `mxGraphModel`). Nodes
|
|
22
|
+
* become vertex cells with the node ID, the label (and a line break and the detail) as value, a style for the shape
|
|
23
|
+
* (`rounded=0`, `rounded=1`, `rhombus`, `ellipse`, `shape=hexagon`; other shapes as rectangles) and the tone (fill
|
|
24
|
+
* and stroke colours plus `vwTone`), and the geometry from `positions` and `sizes` (default 144 by 58). Nodes without
|
|
25
|
+
* a position are placed with `layoutLayeredGraph` in `options.direction`. Groups become container cells
|
|
26
|
+
* (`container=1`) framing their members and nested groups, whose geometry is relative to the container as draw.io
|
|
27
|
+
* expects. Edges become edge cells in the layer with `endArrow`/`startArrow` for the markers, the edge style,
|
|
28
|
+
* `flowAnimation=1` for animated edges and the waypoints. Cell IDs are the item IDs; an ID used twice (for example a
|
|
29
|
+
* node and an edge) gets a suffix, and the root and layer cells take `0` and `1` unless a node uses them. Throws the
|
|
30
|
+
* Errors and RangeErrors of NetworkGraph's input checks.
|
|
31
|
+
*/
|
|
32
|
+
export declare function toDrawio(graph: GraphInterchangeInput, options?: DrawioOptions): string;
|
|
33
|
+
/**
|
|
34
|
+
* Read an uncompressed draw.io (diagrams.net) file into NetworkGraph nodes, edges, groups, positions and sizes. Accepts
|
|
35
|
+
* an `mxfile` (the first page, or `options.page` by zero-based index or name) or a bare `mxGraphModel`, as draw.io
|
|
36
|
+
* saves with compression turned off (File, Properties). Uses the DOM-free XML reader of `fromMsProjectXml`: declared
|
|
37
|
+
* entities are never expanded and nothing outside the text is loaded.
|
|
38
|
+
*
|
|
39
|
+
* Vertex cells become nodes: the value (as text; HTML labels with `html=1` lose their markup and keep line breaks) is
|
|
40
|
+
* split into label (first line) and detail, the style gives the shape (`rhombus` diamond, `ellipse` ellipse,
|
|
41
|
+
* `shape=hexagon` hexagon, `rounded=1` rounded; other shapes are boxes with an `unsupported-shape` warning) and the tone
|
|
42
|
+
* (`vwTone`, or a fill colour that `toDrawio` writes), and the geometry the position and size. A vertex that contains
|
|
43
|
+
* other vertices is a group (container, swimlane or `group` cell) and its frame is not kept; child geometry relative to
|
|
44
|
+
* a container is made absolute. `UserObject` and `object` wrappers are read. Edge cells become edges with the cell ID,
|
|
45
|
+
* value (or the text of label cells on the edge) as label, `endArrow` and `startArrow` as markers, the edge style
|
|
46
|
+
* (orthogonal styles, `curved=1`, `edgeStyle=none`), `flowAnimation` and the waypoints. An edge that is not connected at
|
|
47
|
+
* both ends, or connected to a group, is left out with a warning.
|
|
48
|
+
*
|
|
49
|
+
* Throws an Error for malformed XML, a root element other than `mxfile` or `mxGraphModel`, a missing page and a
|
|
50
|
+
* compressed page (read it with `fromDrawioAsync`), and a RangeError for an invalid `page` and past `maxItems`.
|
|
51
|
+
*/
|
|
52
|
+
export declare function fromDrawio(xml: string, options?: DrawioImportOptions): GraphInterchangeImport;
|
|
53
|
+
/**
|
|
54
|
+
* `fromDrawio` that also reads compressed pages (the default of draw.io files): the page text is base64, raw deflate
|
|
55
|
+
* and URI encoding, inflated with the standard `DecompressionStream('deflate-raw')` of browsers, workers and Node.js
|
|
56
|
+
* (an Error where the runtime has none). `options.maxInflatedLength` (default 20,000,000 characters) bounds the
|
|
57
|
+
* inflated text; beyond it the promise rejects with a RangeError. Rejects with the Errors of `fromDrawio` otherwise,
|
|
58
|
+
* and with an Error for text that is not base64, deflate or URI-encoded XML of an `mxGraphModel`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function fromDrawioAsync(xml: string, options?: DrawioAsyncImportOptions): Promise<GraphInterchangeImport>;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import type { GraphEdge, GraphEdgeMarker, GraphLayoutDirection, GraphNodeSize, GraphPoint } from './graph.js';
|
|
2
|
+
import type { GraphEdgeStyle } from './graphRouting.js';
|
|
3
|
+
import type { ChartTone, NetworkGroup, NetworkNode, NetworkNodeShape } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* A NetworkGraph diagram for the graph writers (`toMermaid`, `toGraphMl`, `toDrawio`): the `nodes`, `edges` and
|
|
6
|
+
* `groups` props, plus saved `positions` (top-left corners) and `sizes` where the format can hold them. Every
|
|
7
|
+
* `GraphInterchangeImport` is one, so a read diagram can be written again.
|
|
8
|
+
*/
|
|
9
|
+
export interface GraphInterchangeInput {
|
|
10
|
+
nodes: readonly NetworkNode[];
|
|
11
|
+
edges: readonly GraphEdge[];
|
|
12
|
+
groups?: readonly NetworkGroup[];
|
|
13
|
+
positions?: ReadonlyMap<string, GraphPoint>;
|
|
14
|
+
sizes?: ReadonlyMap<string, GraphNodeSize>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The kind of a problem a graph reader worked around. `unsupported-statement`: a Mermaid statement that is read but
|
|
18
|
+
* ignored (styling, classes, click handlers, directions inside subgraphs, front matter, accessibility text, invisible
|
|
19
|
+
* links). `unsupported-shape`: a node shape NetworkGraph does not draw, read as a rectangle. `unsupported-style`: an
|
|
20
|
+
* edge decoration NetworkGraph does not draw, read as an arrow. `unsupported-element`: a part of the file without a
|
|
21
|
+
* NetworkGraph counterpart (GraphML hyperedges, ports and further top-level graphs, draw.io cells that are neither a
|
|
22
|
+
* vertex nor an edge), left out. `skipped-node`, `skipped-edge`, `skipped-group`: an item with an invalid or repeated
|
|
23
|
+
* ID, an edge whose end is missing, unknown or a group, and a group without any node; left out. `group-member`: a node
|
|
24
|
+
* placed in a second group, which stays in the first. `invalid-value`: an unreadable coordinate or size, left out.
|
|
25
|
+
* `shifted-positions`: coordinates below 0, so every position and waypoint was moved by the same amount (NetworkGraph
|
|
26
|
+
* positions are nonnegative).
|
|
27
|
+
*/
|
|
28
|
+
export type GraphInterchangeWarningCode = 'unsupported-statement' | 'unsupported-shape' | 'unsupported-style' | 'unsupported-element' | 'skipped-node' | 'skipped-edge' | 'skipped-group' | 'group-member' | 'invalid-value' | 'shifted-positions';
|
|
29
|
+
export interface GraphInterchangeWarning {
|
|
30
|
+
code: GraphInterchangeWarningCode;
|
|
31
|
+
/** The ID of the node, edge or group the warning is about, when there is one. */
|
|
32
|
+
id?: string;
|
|
33
|
+
/** The one-based line of Mermaid text the warning is about. */
|
|
34
|
+
line?: number;
|
|
35
|
+
/** An English description for logs; match on `code`. */
|
|
36
|
+
message: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The result of `fromMermaid`, `fromGraphMl`, `fromDrawio` and `fromDrawioAsync`: the props of NetworkGraph. It is a
|
|
40
|
+
* `GraphInterchangeInput`, so the writers accept it.
|
|
41
|
+
*/
|
|
42
|
+
export interface GraphInterchangeImport {
|
|
43
|
+
nodes: NetworkNode[];
|
|
44
|
+
edges: GraphEdge[];
|
|
45
|
+
/** Nested groups, parents before their children. Only groups with at least one node (directly or nested). */
|
|
46
|
+
groups: NetworkGroup[];
|
|
47
|
+
/** Top-left corners of the nodes the file places; empty for Mermaid. Nonnegative (see `shifted-positions`). */
|
|
48
|
+
positions: Map<string, GraphPoint>;
|
|
49
|
+
/** Sizes of the nodes the file gives one; empty for Mermaid. */
|
|
50
|
+
sizes: Map<string, GraphNodeSize>;
|
|
51
|
+
/** The flow direction of a Mermaid flowchart (`TD` is read as `TB`). Not set by the other readers. */
|
|
52
|
+
direction?: GraphLayoutDirection;
|
|
53
|
+
warnings: GraphInterchangeWarning[];
|
|
54
|
+
}
|
|
55
|
+
export interface GraphInterchangeImportOptions {
|
|
56
|
+
/**
|
|
57
|
+
* The largest number of nodes, edges and groups together that the reader accepts before it throws a RangeError, to
|
|
58
|
+
* bound the work done for an untrusted file. Default 100,000.
|
|
59
|
+
*/
|
|
60
|
+
maxItems?: number;
|
|
61
|
+
}
|
|
62
|
+
export interface GraphShapeFormat {
|
|
63
|
+
/** The opening and closing delimiters of a Mermaid node declaration. */
|
|
64
|
+
mermaid: readonly [string, string];
|
|
65
|
+
/** The draw.io style fragment (ends with `;`). */
|
|
66
|
+
drawio: string;
|
|
67
|
+
}
|
|
68
|
+
export declare const graphShapeFormats: Readonly<Partial<Record<NetworkNodeShape, GraphShapeFormat>>>;
|
|
69
|
+
/** The format of a node's shape; unknown and missing shapes are rectangles (`box`). */
|
|
70
|
+
export declare function graphShapeFormat(shape: unknown): GraphShapeFormat;
|
|
71
|
+
/**
|
|
72
|
+
* Format-neutral shape names (lower case) that the readers recognise, from Mermaid, GraphML (yEd) and draw.io, and the
|
|
73
|
+
* NetworkGraph shape of each. A name without an entry is read as a rectangle with an `unsupported-shape` warning.
|
|
74
|
+
*/
|
|
75
|
+
export declare const graphShapeNames: Readonly<Record<string, NetworkNodeShape>>;
|
|
76
|
+
/** Markers by the names the readers recognise (lower case): draw.io arrow names, yEd arrow types and the own names. */
|
|
77
|
+
export declare const graphMarkerNames: Readonly<Record<string, GraphEdgeMarker>>;
|
|
78
|
+
/** How the draw.io writer draws each marker: the arrow name and whether it is filled. */
|
|
79
|
+
export declare const graphDrawioMarkers: Readonly<Record<GraphEdgeMarker, {
|
|
80
|
+
name: string;
|
|
81
|
+
fill?: boolean;
|
|
82
|
+
}>>;
|
|
83
|
+
export declare function isGraphMarker(value: unknown): value is GraphEdgeMarker;
|
|
84
|
+
export declare function isChartTone(value: unknown): value is ChartTone;
|
|
85
|
+
export declare function isGraphEdgeStyle(value: unknown): value is GraphEdgeStyle;
|
|
86
|
+
/** A checked writer input: groups ordered parents first, with their depth, children and direct members. */
|
|
87
|
+
export interface CheckedGraph {
|
|
88
|
+
nodes: readonly NetworkNode[];
|
|
89
|
+
edges: readonly GraphEdge[];
|
|
90
|
+
/** Groups with every ancestor before them. */
|
|
91
|
+
groups: NetworkGroup[];
|
|
92
|
+
depth: Map<string, number>;
|
|
93
|
+
childGroups: Map<string, NetworkGroup[]>;
|
|
94
|
+
memberOf: Map<string, string>;
|
|
95
|
+
positions: ReadonlyMap<string, GraphPoint>;
|
|
96
|
+
sizes: ReadonlyMap<string, GraphNodeSize>;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Check a writer input as NetworkGraph would: node, edge, port and group IDs, edge ends, group members and parents
|
|
100
|
+
* (`indexGraph` and the group checks throw their usual Errors), labels (Error) and positions and sizes (RangeError).
|
|
101
|
+
*/
|
|
102
|
+
export declare function checkGraphInterchangeInput(graph: GraphInterchangeInput, format: string): CheckedGraph;
|
|
103
|
+
/** `base`, or `base` with the first suffix `-2`, `-3`, … that is not in `taken`. Adds the result to `taken`. */
|
|
104
|
+
export declare function uniqueName(base: string, taken: Set<string>): string;
|
|
105
|
+
/** A number for XML output, exact (the shortest text that reads back as the same number), without `-0`. */
|
|
106
|
+
export declare function formatNumber(value: number): string;
|
|
107
|
+
/** XML text for an attribute value: escaped, with tabs and line breaks as character references so they survive. */
|
|
108
|
+
export declare function xmlAttribute(value: string): string;
|
|
109
|
+
/** XML text for element content: escaped, with carriage returns as character references. */
|
|
110
|
+
export declare function xmlText(value: string): string;
|
|
111
|
+
/** A finite number from XML text, or undefined. */
|
|
112
|
+
export declare function readNumber(text: string | undefined): number | undefined;
|
|
113
|
+
/** Split text into the node label (first line) and detail (the remaining lines, when there are any). */
|
|
114
|
+
export declare function splitLabel(text: string): {
|
|
115
|
+
label: string;
|
|
116
|
+
detail?: string;
|
|
117
|
+
};
|
|
118
|
+
interface CollectedGroup {
|
|
119
|
+
id: string;
|
|
120
|
+
label: string;
|
|
121
|
+
parentId?: string;
|
|
122
|
+
nodeIds: string[];
|
|
123
|
+
}
|
|
124
|
+
export type GraphWarn = (code: GraphInterchangeWarningCode, message: string, id?: string, line?: number) => void;
|
|
125
|
+
/**
|
|
126
|
+
* The state a reader fills: nodes, groups and edges in file order, with the ID checks, the item limit and the
|
|
127
|
+
* warnings. `finish` resolves the edges, drops empty groups and makes the positions nonnegative.
|
|
128
|
+
*/
|
|
129
|
+
export declare function createGraphCollector(format: string, options?: GraphInterchangeImportOptions): {
|
|
130
|
+
nodes: Map<string, NetworkNode<unknown>>;
|
|
131
|
+
groups: Map<string, CollectedGroup>;
|
|
132
|
+
memberOf: Map<string, string>;
|
|
133
|
+
positions: Map<string, GraphPoint>;
|
|
134
|
+
sizes: Map<string, GraphNodeSize>;
|
|
135
|
+
warn: GraphWarn;
|
|
136
|
+
addNode: (node: NetworkNode, line?: number) => boolean;
|
|
137
|
+
addGroup: (group: {
|
|
138
|
+
id: string;
|
|
139
|
+
label: string;
|
|
140
|
+
parentId?: string;
|
|
141
|
+
}, line?: number) => boolean;
|
|
142
|
+
addMember: (groupId: string, nodeId: string, line?: number) => void;
|
|
143
|
+
addEdge: (edge: Omit<GraphEdge, "id"> & {
|
|
144
|
+
id?: string;
|
|
145
|
+
}, line?: number) => void;
|
|
146
|
+
finish: (direction?: GraphLayoutDirection) => GraphInterchangeImport;
|
|
147
|
+
};
|
|
148
|
+
export type GraphCollector = ReturnType<typeof createGraphCollector>;
|
|
149
|
+
/** The NetworkGraph shape of a format-neutral name (see `graphShapeNames`), or `box` with an `unsupported-shape` warning. */
|
|
150
|
+
export declare function readGraphShape(name: string, warn: GraphWarn, id: string | undefined, line?: number): NetworkNodeShape;
|
|
151
|
+
/** The marker of a reader name (see `graphMarkerNames`), or `arrow` with an `unsupported-style` warning. */
|
|
152
|
+
export declare function readGraphMarker(name: string, warn: GraphWarn, id: string | undefined): GraphEdgeMarker;
|
|
153
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type GraphInterchangeImport, type GraphInterchangeImportOptions, type GraphInterchangeInput } from './interchangeGraph.js';
|
|
2
|
+
export interface GraphMlOptions {
|
|
3
|
+
/** Write `edgedefault="directed"` (default true) or `undirected`. */
|
|
4
|
+
directed?: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Write a diagram as GraphML. The document declares `<key>`s for the node `label`, `detail`, `shape`, `tone`, `x`,
|
|
8
|
+
* `y`, `width` and `height` (the top-left corner from `positions` and the size from `sizes`) and the edge `label`,
|
|
9
|
+
* `markerStart`, `markerEnd`, `edgeStyle`, `animated`, `dashed` and `points` (waypoints as `x,y x,y …`), and writes the values a
|
|
10
|
+
* node or edge has. Groups become nodes with a nested `<graph>` (ID `<group>:`) that holds their members and nested
|
|
11
|
+
* groups; a group whose ID is also a node's gets a `-2` suffix, since GraphML node IDs share one namespace. Edges are
|
|
12
|
+
* written in the top-level graph after the nodes. Ports and `data` are not written. Throws the Errors and RangeErrors
|
|
13
|
+
* of NetworkGraph's input checks.
|
|
14
|
+
*/
|
|
15
|
+
export declare function toGraphMl(graph: GraphInterchangeInput, options?: GraphMlOptions): string;
|
|
16
|
+
/**
|
|
17
|
+
* Read a GraphML document into NetworkGraph nodes, edges, groups, positions and sizes. Uses the DOM-free XML reader of
|
|
18
|
+
* `fromMsProjectXml`: declared entities are never expanded and nothing outside the text is loaded. Values come from
|
|
19
|
+
* `<data>` whose `<key>` has the `attr.name` `label` (else `name`), `detail`, `shape`, `tone`, `x`, `y`, `width` and
|
|
20
|
+
* `height` for nodes and `label`, `markerStart`, `markerEnd`, `edgeStyle`, `animated`, `dashed` and `points` for edges, as
|
|
21
|
+
* `toGraphMl` writes them; `<default>` values apply. Other keys are ignored. yEd files are read as well: the first
|
|
22
|
+
* `y:NodeLabel` (its first line as label, the rest as detail), `y:Geometry`, `y:Shape` type or `y:GenericNode`
|
|
23
|
+
* configuration, and the `y:EdgeLabel`, `y:Arrows` and `y:Path` points of edges. A node with a nested `<graph>` is a
|
|
24
|
+
* group with the nodes in it as members (nested graphs nest groups). Edges get the IDs `e1`, `e2`, … when they have
|
|
25
|
+
* none; in an undirected graph (`edgedefault="undirected"` or `directed="false"`) an edge without a marker has
|
|
26
|
+
* `markerEnd: 'none'`. Further top-level graphs, hyperedges and ports are reported as `unsupported-element`; see
|
|
27
|
+
* `GraphInterchangeWarningCode` for the rest.
|
|
28
|
+
*
|
|
29
|
+
* Throws an Error for malformed XML (with the line and column), for a root element other than `graphml` and for a
|
|
30
|
+
* document without a graph, and a RangeError past `maxItems`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function fromGraphMl(xml: string, options?: GraphInterchangeImportOptions): GraphInterchangeImport;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type GraphInterchangeImport, type GraphInterchangeImportOptions, type GraphInterchangeInput } from './interchangeGraph.js';
|
|
2
|
+
/** The direction written after `flowchart`. `TD` and `TB` both mean top to bottom. */
|
|
3
|
+
export type MermaidDirection = 'TD' | 'TB' | 'LR' | 'RL' | 'BT';
|
|
4
|
+
export interface MermaidOptions {
|
|
5
|
+
/** The flow direction of the chart. Default `LR`, the NetworkGraph default. */
|
|
6
|
+
direction?: MermaidDirection;
|
|
7
|
+
/**
|
|
8
|
+
* Write edge IDs (`a e1@--> b`), which Mermaid reads from version 11.6. Default false: edges are written without IDs
|
|
9
|
+
* and `fromMermaid` names them `e1`, `e2`, ….
|
|
10
|
+
*/
|
|
11
|
+
edgeIds?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Write a diagram as a Mermaid `flowchart`. Each node is declared once with its shape (`[ ]` box, `( )` rounded, `{ }`
|
|
15
|
+
* diamond, `(( ))` ellipse and circle, `{{ }}` hexagon, `([ ])` stadium, `[( )]` cylinder, `[/ /]` parallelogram; other shapes, such as document and data-object, as boxes) and its quoted label, followed by `<br>` and the
|
|
16
|
+
* detail when it has one. Groups become nested `subgraph … end` blocks with their direct members; edges follow at the
|
|
17
|
+
* end, `-->` for an arrow (and any other end marker without a Mermaid form), `---` for `markerEnd: 'none'`, `--o` for a
|
|
18
|
+
* circle and `--x` for a bar, with a matching start marker (`<-->`, `o--o`, `x--x`) when `markerStart` has the same
|
|
19
|
+
* form, and the label as `|"…"|`. Characters that would end a label (`"`, `|`, `#`, `<`, `>`, `&`, backticks and line
|
|
20
|
+
* breaks) are written as Mermaid entity codes such as `#34;`. IDs that Mermaid cannot hold are encoded (see
|
|
21
|
+
* `fromMermaid`); a group whose encoded ID is also a node's gets a suffix. Positions, sizes, tones, ports, waypoints and
|
|
22
|
+
* edge styles have no Mermaid form and are not written. Throws the Errors and RangeErrors of NetworkGraph's input
|
|
23
|
+
* checks and an Error for an unknown `direction`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function toMermaid(graph: GraphInterchangeInput, options?: MermaidOptions): string;
|
|
26
|
+
/**
|
|
27
|
+
* Read a Mermaid flowchart into NetworkGraph nodes, edges and groups. Pure string parsing without a DOM, done with
|
|
28
|
+
* loops. The text starts with `flowchart` or `graph` and an optional direction (`TD`, `TB`, `LR`, `RL`, `BT`, returned
|
|
29
|
+
* as `direction` with `TD` as `TB`); `%%` comment lines, `%%{…}%%` directives and YAML front matter are skipped.
|
|
30
|
+
* Statements end at a line break or `;`. Read: node declarations with the shapes `[ ]`, `( )`, `{ }`, `(( ))`, `{{ }}`
|
|
31
|
+
* and the other Mermaid delimiters, quoted or unquoted text and `@{ shape: …, label: … }`; chains (`a --> b --> c`)
|
|
32
|
+
* and `&` lists (`a & b --> c`, every pair); the links `-->`, `---`, `-.->`, `-.-`, `==>`, `===` and their longer
|
|
33
|
+
* forms, with `o` and `x` ends, `<` starts, `|label|` or `-- label -->` text and `id@` edge IDs; and nested
|
|
34
|
+
* `subgraph id[title] … end` blocks, which become groups. A node belongs to the first subgraph it appears in (or a
|
|
35
|
+
* nested subgraph of it); a later mention in another subgraph is reported (`group-member`).
|
|
36
|
+
*
|
|
37
|
+
* Text: `"` quotes are removed, entity codes (`#35;`, `#quot;`) are decoded, and `<br>` splits a node's label from its
|
|
38
|
+
* detail. Shapes NetworkGraph does not draw become boxes (`unsupported-shape`); the line style of dotted and thick
|
|
39
|
+
* links is not kept. Ignored with an `unsupported-statement` warning: `classDef`, `class`, `:::class`, `style`, `click`,
|
|
40
|
+
* `linkStyle`, `direction` inside subgraphs, `accTitle`, `accDescr`, front matter and invisible `~~~` links. Edges to a
|
|
41
|
+
* subgraph are left out (`skipped-edge`). IDs written by `toMermaid` in the `vw_` form are decoded. Edges get the IDs
|
|
42
|
+
* `e1`, `e2`, … unless they have an `id@`. Positions and sizes are empty.
|
|
43
|
+
*
|
|
44
|
+
* Throws an Error for a value that is not a string, for another Mermaid diagram type (`sequenceDiagram`, …), for text
|
|
45
|
+
* without a flowchart header and, with the line and column, for syntax it cannot read and for unbalanced
|
|
46
|
+
* `subgraph`/`end`; a RangeError past `maxItems`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function fromMermaid(text: string, options?: GraphInterchangeImportOptions): GraphInterchangeImport;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { TimelineFieldEdit } from './fieldEditing.js';
|
|
2
|
+
import type { TimelineCellEdit, TimelineRow } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Read tab-separated clipboard text into records of cells, the way spreadsheet applications write it.
|
|
5
|
+
*
|
|
6
|
+
* Records end at CRLF, LF or CR; one line break at the end of the text is ignored, so `a\tb\r\n` is one record.
|
|
7
|
+
* A cell that starts with a double quote is read as quoted (doubled quotes inside it become one, and it may span
|
|
8
|
+
* lines) only when its closing quote is followed by a tab, a line break or the end of the text. Otherwise the quote is
|
|
9
|
+
* ordinary text, so `5" bolt` and `"A" grade` read as written. Empty text is one empty cell. Never throws for a string.
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseSheetText(text: string): string[][];
|
|
12
|
+
/**
|
|
13
|
+
* Write records of cells as tab-separated text with CRLF line breaks, as spreadsheet applications read it. A cell that
|
|
14
|
+
* contains a tab, a line break or a double quote is quoted, with inner quotes doubled, so {@link parseSheetText} reads
|
|
15
|
+
* the same records back.
|
|
16
|
+
*/
|
|
17
|
+
export declare function formatSheetText(records: readonly (readonly string[])[]): string;
|
|
18
|
+
/** The edits of a GanttChart `sheet-edit` batch, a `field-edit` or a `cell-edit`, as {@link applyTimelineSheetEdit} reads them. */
|
|
19
|
+
export interface TimelineSheetChanges<R extends TimelineRow = TimelineRow> {
|
|
20
|
+
fieldEdits?: readonly TimelineFieldEdit<R>[];
|
|
21
|
+
cellEdits?: readonly TimelineCellEdit[];
|
|
22
|
+
}
|
|
23
|
+
/** How {@link applyTimelineSheetEdit} writes one edit into a row. Each callback returns a new row and must not mutate it. */
|
|
24
|
+
export interface TimelineSheetAppliers<R extends TimelineRow = TimelineRow> {
|
|
25
|
+
/** Writes a typed value (`edit.after`) of `edit.fieldId`. Required when the change has field edits. */
|
|
26
|
+
field?: (row: R, edit: TimelineFieldEdit<R>) => R;
|
|
27
|
+
/** Writes the text of a plain column (`edit.after`) of `edit.columnId`. Required when the change has cell edits. */
|
|
28
|
+
cell?: (row: R, edit: TimelineCellEdit) => R;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Apply a spreadsheet batch (or single field and cell edits) to rows as one step. Returns a new array in the same
|
|
32
|
+
* order; rows without edits keep their identity, and several edits of one row are applied in order (field edits
|
|
33
|
+
* first). Throws an Error for an invalid or duplicate row ID, an edit of an unknown row, or a change that has edits of
|
|
34
|
+
* a kind without its applier; nothing is applied then. A callback that changes the row ID also throws an Error.
|
|
35
|
+
*/
|
|
36
|
+
export declare function applyTimelineSheetEdit<R extends TimelineRow>(rows: readonly R[], change: TimelineSheetChanges<R>, appliers: TimelineSheetAppliers<R>): R[];
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { ChartTone } from './types.js';
|
|
2
|
+
/** A status column of a task board. `wipLimit` is a work-in-progress limit: the column is over it with more cards. */
|
|
3
|
+
export interface TaskBoardColumn {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
/** Optional second line of the column header. */
|
|
7
|
+
detail?: string;
|
|
8
|
+
/** A non-negative integer. Exceeding it only marks the column; moves are blocked by `validateCardMove` alone. */
|
|
9
|
+
wipLimit?: number;
|
|
10
|
+
}
|
|
11
|
+
/** A horizontal swimlane of a task board, for example a team or a priority. */
|
|
12
|
+
export interface TaskBoardLane {
|
|
13
|
+
id: string;
|
|
14
|
+
label: string;
|
|
15
|
+
detail?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A card of a task board. `D` types the optional `data` payload; it defaults to `unknown`. `laneId` is required when the
|
|
19
|
+
* board has lanes and ignored when it has none.
|
|
20
|
+
*/
|
|
21
|
+
export interface TaskBoardCard<D = unknown> {
|
|
22
|
+
id: string;
|
|
23
|
+
columnId: string;
|
|
24
|
+
laneId?: string;
|
|
25
|
+
label: string;
|
|
26
|
+
detail?: string;
|
|
27
|
+
tone?: ChartTone;
|
|
28
|
+
/** False keeps the card in place: it can be selected and activated but not moved. */
|
|
29
|
+
draggable?: boolean;
|
|
30
|
+
/** Application data. The component passes it through untouched. */
|
|
31
|
+
data?: D;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The place of a card: its column, its lane (only on boards with lanes) and its index among the cards of that cell. In
|
|
35
|
+
* a proposal's `after`, `index` counts the cards of the target cell without the moved card.
|
|
36
|
+
*/
|
|
37
|
+
export interface TaskBoardPosition {
|
|
38
|
+
columnId: string;
|
|
39
|
+
laneId?: string;
|
|
40
|
+
index: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A card move proposal from TaskBoard (`card-move`). Apply it with `applyBoardCardMove(cards, change)`. A proposal
|
|
44
|
+
* without `laneId` comes from a board without lanes.
|
|
45
|
+
*/
|
|
46
|
+
export interface TaskBoardCardMove {
|
|
47
|
+
id: string;
|
|
48
|
+
before: TaskBoardPosition;
|
|
49
|
+
after: TaskBoardPosition;
|
|
50
|
+
source: 'pointer' | 'keyboard';
|
|
51
|
+
}
|
|
52
|
+
/** Synchronous check of a `card-move` proposal. Accept with true or undefined; reject with false or a reason. */
|
|
53
|
+
export type TaskBoardCardMoveValidator = (change: TaskBoardCardMove) => boolean | string | void;
|
|
54
|
+
/** Why TaskBoard ended a pick-up or drag without a proposal (`card-move-cancel`). */
|
|
55
|
+
export type TaskBoardMoveCancelReason = 'escape' | 'pointer-cancel' | 'no-target' | 'blur' | 'data-change';
|
|
56
|
+
/** A cancelled card move: the card, its position when the move started and the reason. */
|
|
57
|
+
export interface TaskBoardMoveCancel {
|
|
58
|
+
id: string;
|
|
59
|
+
before: TaskBoardPosition;
|
|
60
|
+
reason: TaskBoardMoveCancelReason;
|
|
61
|
+
source: 'pointer' | 'keyboard';
|
|
62
|
+
}
|
|
63
|
+
/** The cards of one column in one lane (`laneId` is undefined on a board without lanes), in `cards` order. */
|
|
64
|
+
export interface TaskBoardCell<C extends TaskBoardCard = TaskBoardCard> {
|
|
65
|
+
columnId: string;
|
|
66
|
+
laneId?: string;
|
|
67
|
+
cards: C[];
|
|
68
|
+
}
|
|
69
|
+
/** The card count of a column over all lanes, with its WIP limit. `overLimit` is `count > wipLimit`, `atLimit` `count >= wipLimit`. */
|
|
70
|
+
export interface TaskBoardColumnStatus {
|
|
71
|
+
id: string;
|
|
72
|
+
count: number;
|
|
73
|
+
wipLimit?: number;
|
|
74
|
+
atLimit: boolean;
|
|
75
|
+
overLimit: boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Cards grouped by `groupBoardCards`. `rows` holds one entry per lane in lane order, or a single entry without
|
|
79
|
+
* `laneId` on a board without lanes; each row has one cell per column in column order.
|
|
80
|
+
*/
|
|
81
|
+
export interface TaskBoardGroups<C extends TaskBoardCard = TaskBoardCard> {
|
|
82
|
+
rows: {
|
|
83
|
+
laneId?: string;
|
|
84
|
+
cells: TaskBoardCell<C>[];
|
|
85
|
+
}[];
|
|
86
|
+
columns: TaskBoardColumnStatus[];
|
|
87
|
+
/** Every card's position by card ID. */
|
|
88
|
+
positions: Map<string, TaskBoardPosition>;
|
|
89
|
+
}
|
|
90
|
+
/** The English UI strings and accessible names of TaskBoard; pass a partial object as `labels` to override them. */
|
|
91
|
+
export interface TaskBoardLabels {
|
|
92
|
+
/** Name of the board region. Default "Task board". */
|
|
93
|
+
region: string;
|
|
94
|
+
/** Shown when there are no columns. Default "No columns to display". */
|
|
95
|
+
empty: string;
|
|
96
|
+
/** Shown in a cell without cards. Default "No cards". */
|
|
97
|
+
emptyCell: string;
|
|
98
|
+
/** Text after a card count of one. Default "card". */
|
|
99
|
+
card: string;
|
|
100
|
+
/** Text after any other card count. Default "cards". */
|
|
101
|
+
cards: string;
|
|
102
|
+
/** Words before the WIP limit in the column description. Default "WIP limit". */
|
|
103
|
+
wipLimit: string;
|
|
104
|
+
/** Warning of a column over its WIP limit. Default "Over WIP limit". */
|
|
105
|
+
overLimit: string;
|
|
106
|
+
/** Description of every movable card. */
|
|
107
|
+
moveHint: string;
|
|
108
|
+
/** Announced when `validateCardMove` returns false. Default "This card move was rejected." */
|
|
109
|
+
moveRejected: string;
|
|
110
|
+
/** Start of the pick-up announcement, followed by the card label. Default "Picked up". */
|
|
111
|
+
pickedUp: string;
|
|
112
|
+
/** Start of the drop announcement, followed by the card label. Default "Moved". */
|
|
113
|
+
moved: string;
|
|
114
|
+
/** Announced, after the card label, when a move ends without a proposal. Default "move cancelled". */
|
|
115
|
+
moveCancelled: string;
|
|
116
|
+
/** Word before the position of a card in a cell. Default "position". */
|
|
117
|
+
position: string;
|
|
118
|
+
/** Word between a position and the cell size. Default "of". */
|
|
119
|
+
of: string;
|
|
120
|
+
/** Word before the lane label in announcements. Default "lane". */
|
|
121
|
+
lane: string;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Group cards into cells of columns × lanes. Cards keep their `cards` order inside each cell. Throws an Error for an
|
|
125
|
+
* invalid or duplicate column, lane or card ID and for a card whose column or lane is unknown (or, on a board with
|
|
126
|
+
* lanes, missing), and a RangeError for a WIP limit that is not a non-negative integer. Without `lanes` (or with an
|
|
127
|
+
* empty array) the board has a single row of cells and card `laneId`s are ignored.
|
|
128
|
+
*/
|
|
129
|
+
export declare function groupBoardCards<C extends TaskBoardCard>(cards: readonly C[], columns: readonly TaskBoardColumn[], lanes?: readonly TaskBoardLane[]): TaskBoardGroups<C>;
|
|
130
|
+
/**
|
|
131
|
+
* The position of one card: its column, its lane when `lanes` is true and its index among the cards of the same cell
|
|
132
|
+
* in `cards` order. Throws an Error for an unknown card ID.
|
|
133
|
+
*/
|
|
134
|
+
export declare function boardCardPosition(cards: readonly TaskBoardCard[], id: string, options?: {
|
|
135
|
+
lanes?: boolean;
|
|
136
|
+
}): TaskBoardPosition;
|
|
137
|
+
/**
|
|
138
|
+
* Apply a `card-move` proposal: a new array in which the card has the target column (and lane, when `after.laneId` is
|
|
139
|
+
* set) and sits before the card that had `after.index` in the target cell, or after the last card of that cell. Cards
|
|
140
|
+
* are never mutated; the moved card is a shallow copy. A proposal whose positions have no `laneId` treats each column as
|
|
141
|
+
* one cell and keeps the card's `laneId`.
|
|
142
|
+
*
|
|
143
|
+
* Pass `board` to check the target column and lane against the board. Throws an Error for an unknown card, column or
|
|
144
|
+
* lane and for a stale proposal (the card is no longer at `before`), and a RangeError for an index that is not an
|
|
145
|
+
* integer from 0 to the size of the target cell.
|
|
146
|
+
*/
|
|
147
|
+
export declare function applyBoardCardMove<C extends TaskBoardCard>(cards: readonly C[], move: TaskBoardCardMove, board?: {
|
|
148
|
+
columns?: readonly TaskBoardColumn[];
|
|
149
|
+
lanes?: readonly TaskBoardLane[];
|
|
150
|
+
}): C[];
|