@grafloria/element 0.4.10 → 0.4.12
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/package.json +1 -1
- package/src/index.d.ts +16 -16
- package/src/index.js +9 -9
- package/src/lib/dashboard-kit/dashboard.d.ts +11 -3
- package/src/lib/dashboard-kit/dashboard.js +27 -24
- package/src/lib/dashboard-kit/grid-binder.d.ts +15 -1
- package/src/lib/dashboard-kit/grid-binder.js +58 -9
- package/src/lib/dashboard-kit/index.d.ts +7 -7
- package/src/lib/dashboard-kit/index.js +7 -7
- package/src/lib/dashboard-kit/split-binder.d.ts +3 -3
- package/src/lib/dashboard-kit/split-binder.js +34 -8
- package/src/lib/dashboard-kit/split-layout.d.ts +1 -1
- package/src/lib/dashboard-kit/styles.js +11 -4
- package/src/lib/dashboard-kit/widgets.d.ts +1 -1
- package/src/lib/dashboard-kit/widgets.js +1 -1
- package/src/lib/diagram-kit/card.d.ts +2 -2
- package/src/lib/diagram-kit/editing.js +1 -1
- package/src/lib/diagram-kit/er.d.ts +1 -1
- package/src/lib/diagram-kit/er.js +5 -5
- package/src/lib/diagram-kit/handles.d.ts +4 -4
- package/src/lib/diagram-kit/handles.js +1 -1
- package/src/lib/diagram-kit/index.d.ts +10 -10
- package/src/lib/diagram-kit/index.js +10 -10
- package/src/lib/diagram-kit/uml.js +4 -4
- package/src/lib/diagram-kit/update.d.ts +1 -1
- package/src/lib/diagram-kit/update.js +1 -1
- package/src/lib/grafloria-flow-element.js +1 -1
- package/src/lib/grafloria.d.ts +4 -4
- package/src/lib/grafloria.js +2 -2
- package/src/lib/load.d.ts +3 -3
- package/src/lib/load.js +11 -11
- package/src/lib/stencil-kit/card-builders.js +2 -2
- package/src/lib/stencil-kit/index.d.ts +7 -7
- package/src/lib/stencil-kit/index.js +5 -5
- package/src/lib/stencil-kit/palette.js +2 -2
- package/src/lib/stencil-kit/shape-data.js +2 -2
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
* on the server, where `customElements` does not exist). Call
|
|
13
13
|
* `Grafloria.define('my-flow')` yourself if you want a different tag name.
|
|
14
14
|
*/
|
|
15
|
-
export { GrafloriaFlowElement, defineGrafloriaFlow, GRAFLORIA_EVENTS } from './lib/grafloria-flow-element';
|
|
16
|
-
export { Grafloria, render, renderStatic } from './lib/grafloria';
|
|
17
|
-
export type { DiagramSpec, RenderSpec, RenderOptions } from './lib/grafloria';
|
|
18
|
-
export { fromDocument } from './lib/load';
|
|
19
|
-
export type { SavedDiagram, FromDocumentOptions, LoadedDiagramSpec } from './lib/load';
|
|
20
|
-
export { registerNodeType, unregisterNodeType, registeredNodeTypes, getNodeType, hasNodeType, renderFromTemplate, } from './lib/node-type-registry';
|
|
21
|
-
export type { NodeTypeRenderer } from './lib/node-type-registry';
|
|
15
|
+
export { GrafloriaFlowElement, defineGrafloriaFlow, GRAFLORIA_EVENTS } from './lib/grafloria-flow-element.js';
|
|
16
|
+
export { Grafloria, render, renderStatic } from './lib/grafloria.js';
|
|
17
|
+
export type { DiagramSpec, RenderSpec, RenderOptions } from './lib/grafloria.js';
|
|
18
|
+
export { fromDocument } from './lib/load.js';
|
|
19
|
+
export type { SavedDiagram, FromDocumentOptions, LoadedDiagramSpec } from './lib/load.js';
|
|
20
|
+
export { registerNodeType, unregisterNodeType, registeredNodeTypes, getNodeType, hasNodeType, renderFromTemplate, } from './lib/node-type-registry.js';
|
|
21
|
+
export type { NodeTypeRenderer } from './lib/node-type-registry.js';
|
|
22
22
|
export type { DiagramInstance, CreateDiagramOptions, NodeSpec, EdgeSpec, PortSpec, HydrationSnapshot, StaticRenderOptions, StaticRenderResult, Theme, } from '@grafloria/renderer';
|
|
23
23
|
export { renderToStaticSVG, LIGHT_THEME, DARK_THEME } from '@grafloria/renderer';
|
|
24
24
|
export { createDiagramApi } from '@grafloria/renderer';
|
|
@@ -74,15 +74,15 @@ export { GroupModel } from '@grafloria/engine';
|
|
|
74
74
|
export { GroupCollapseService, PROXY_NODE_GROUP_KEY, PROXY_LINK_GROUP_KEY } from '@grafloria/engine';
|
|
75
75
|
export { serveLayout } from '@grafloria/engine';
|
|
76
76
|
export type { LayoutPort, LayoutServePort, LayoutProgress } from '@grafloria/engine';
|
|
77
|
-
export { erDiagram, erRowCenterY, ER_ROW_H, ER_HEAD_H, umlDiagram, ensureDiagramKitStyles, DIAGRAM_KIT_STYLE_ID, updateEntity, updateClass, addColumnAt, removeColumnAt, renameColumnAt, bindCardEditing, matchColumns, rowIndexFromY, scoreMatch, matchTier, assignTiers, singularize, bindJoinGuidance, ensureJoinGuidanceStyles, JOIN_GUIDANCE_STYLE_ID, } from './lib/diagram-kit';
|
|
78
|
-
export type { JoinColumn, JoinEnd, MatchTier, JoinGuidanceApi, JoinGuidanceOptions, JoinGuidanceHandle, } from './lib/diagram-kit';
|
|
79
|
-
export type { ErColumn, ErEntitySpec, ErRelationshipSpec, ErCardinality, ErSide, ErDiagramOptions, UmlClassSpec, UmlRelationshipSpec, UmlRelationKind, UmlSide, UmlDiagramOptions, ErEntityDelta, UmlClassDelta, CardEditingHandle, } from './lib/diagram-kit';
|
|
80
|
-
export { erTable, umlClass, erTables, umlClasses, CardHandle, ErTable, ErField, ErColumnList, UmlClass, UmlMemberList, } from './lib/diagram-kit';
|
|
81
|
-
export type { HandleApi } from './lib/diagram-kit';
|
|
82
|
-
export { bindDashboardGrid, rowHeightFor, boardHeightFor, columnUnitFor, cellToRect, pointToCell, sizeToSpan, gridItemFromCell, cellFromGridItem, buildCommitCommands, ensureDashboardKitStyles, DASHBOARD_KIT_STYLE_ID, dashboard, defaultWidgetRenderer, renderKpiWidget, renderLineWidget, renderBarWidget, renderDonutWidget, renderFunnelWidget, renderTableWidget, BUILT_IN_WIDGET_KINDS, } from './lib/dashboard-kit';
|
|
83
|
-
export type { DashboardGridApi, DashboardGridOptions, DashboardGridHandle, CellRect, WorldRect, DashboardGridGeometry, TileDelta, DashboardOptions, DashboardSpec, DashboardSnapshot, DragHandleOption, DragGripOptions, DashboardHandle, DashboardViewSpec, DashboardWidgetSpec, WidgetHandle, WidgetRenderer, KpiWidgetData, LineWidgetData, LineSeries, BarWidgetData, DonutWidgetData, FunnelWidgetData, TableWidgetData, } from './lib/dashboard-kit';
|
|
84
|
-
export { bindStencilPalette, bindShapeDataPanel, ensureStencilKitStyles } from './lib/stencil-kit';
|
|
85
|
-
export type { StencilPaletteApi, StencilPaletteOptions, StencilPaletteHandle, ShapeDataPanelApi, ShapeDataPanelOptions, ShapeDataPanelHandle, } from './lib/stencil-kit';
|
|
77
|
+
export { erDiagram, erRowCenterY, ER_ROW_H, ER_HEAD_H, umlDiagram, ensureDiagramKitStyles, DIAGRAM_KIT_STYLE_ID, updateEntity, updateClass, addColumnAt, removeColumnAt, renameColumnAt, bindCardEditing, matchColumns, rowIndexFromY, scoreMatch, matchTier, assignTiers, singularize, bindJoinGuidance, ensureJoinGuidanceStyles, JOIN_GUIDANCE_STYLE_ID, } from './lib/diagram-kit/index.js';
|
|
78
|
+
export type { JoinColumn, JoinEnd, MatchTier, JoinGuidanceApi, JoinGuidanceOptions, JoinGuidanceHandle, } from './lib/diagram-kit/index.js';
|
|
79
|
+
export type { ErColumn, ErEntitySpec, ErRelationshipSpec, ErCardinality, ErSide, ErDiagramOptions, UmlClassSpec, UmlRelationshipSpec, UmlRelationKind, UmlSide, UmlDiagramOptions, ErEntityDelta, UmlClassDelta, CardEditingHandle, } from './lib/diagram-kit/index.js';
|
|
80
|
+
export { erTable, umlClass, erTables, umlClasses, CardHandle, ErTable, ErField, ErColumnList, UmlClass, UmlMemberList, } from './lib/diagram-kit/index.js';
|
|
81
|
+
export type { HandleApi } from './lib/diagram-kit/index.js';
|
|
82
|
+
export { bindDashboardGrid, rowHeightFor, boardHeightFor, columnUnitFor, cellToRect, pointToCell, sizeToSpan, gridItemFromCell, cellFromGridItem, buildCommitCommands, ensureDashboardKitStyles, DASHBOARD_KIT_STYLE_ID, dashboard, defaultWidgetRenderer, renderKpiWidget, renderLineWidget, renderBarWidget, renderDonutWidget, renderFunnelWidget, renderTableWidget, BUILT_IN_WIDGET_KINDS, } from './lib/dashboard-kit/index.js';
|
|
83
|
+
export type { DashboardGridApi, DashboardGridOptions, DashboardGridHandle, CellRect, WorldRect, DashboardGridGeometry, TileDelta, DashboardOptions, DashboardSpec, DashboardSnapshot, DragHandleOption, DragGripOptions, DashboardHandle, DashboardViewSpec, DashboardWidgetSpec, WidgetHandle, WidgetRenderer, KpiWidgetData, LineWidgetData, LineSeries, BarWidgetData, DonutWidgetData, FunnelWidgetData, TableWidgetData, } from './lib/dashboard-kit/index.js';
|
|
84
|
+
export { bindStencilPalette, bindShapeDataPanel, ensureStencilKitStyles } from './lib/stencil-kit/index.js';
|
|
85
|
+
export type { StencilPaletteApi, StencilPaletteOptions, StencilPaletteHandle, ShapeDataPanelApi, ShapeDataPanelOptions, ShapeDataPanelHandle, } from './lib/stencil-kit/index.js';
|
|
86
86
|
export * from '@grafloria/engine';
|
|
87
87
|
export * from '@grafloria/renderer';
|
|
88
88
|
export { NodeModel, PortModel, distanceToSegment, rotatePoint, coalesce, } from '@grafloria/engine';
|
package/src/index.js
CHANGED
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
* on the server, where `customElements` does not exist). Call
|
|
13
13
|
* `Grafloria.define('my-flow')` yourself if you want a different tag name.
|
|
14
14
|
*/
|
|
15
|
-
import { defineGrafloriaFlow } from './lib/grafloria-flow-element';
|
|
16
|
-
export { GrafloriaFlowElement, defineGrafloriaFlow, GRAFLORIA_EVENTS } from './lib/grafloria-flow-element';
|
|
17
|
-
export { Grafloria, render, renderStatic } from './lib/grafloria';
|
|
15
|
+
import { defineGrafloriaFlow } from './lib/grafloria-flow-element.js';
|
|
16
|
+
export { GrafloriaFlowElement, defineGrafloriaFlow, GRAFLORIA_EVENTS } from './lib/grafloria-flow-element.js';
|
|
17
|
+
export { Grafloria, render, renderStatic } from './lib/grafloria.js';
|
|
18
18
|
// The LOAD front door — the other half of `DiagramSerializer.serialize()`.
|
|
19
19
|
// `render(fromDocument(json), host)` is the one-liner; see lib/load.ts for why
|
|
20
20
|
// the loaded models go back in as models rather than being re-specced.
|
|
21
|
-
export { fromDocument } from './lib/load';
|
|
22
|
-
export { registerNodeType, unregisterNodeType, registeredNodeTypes, getNodeType, hasNodeType, renderFromTemplate, } from './lib/node-type-registry';
|
|
21
|
+
export { fromDocument } from './lib/load.js';
|
|
22
|
+
export { registerNodeType, unregisterNodeType, registeredNodeTypes, getNodeType, hasNodeType, renderFromTemplate, } from './lib/node-type-registry.js';
|
|
23
23
|
export { renderToStaticSVG, LIGHT_THEME, DARK_THEME } from '@grafloria/renderer';
|
|
24
24
|
// React Flow-parity helper surface (getIntersectingNodes & friends) — an embed
|
|
25
25
|
// gets the same convenience wrapper the frameworks get, from the same import.
|
|
@@ -215,10 +215,10 @@ export { erDiagram, erRowCenterY, ER_ROW_H, ER_HEAD_H, umlDiagram, ensureDiagram
|
|
|
215
215
|
updateEntity, updateClass, addColumnAt, removeColumnAt, renameColumnAt, bindCardEditing, matchColumns, rowIndexFromY,
|
|
216
216
|
// Live join guidance (query-builder): score every other table's columns
|
|
217
217
|
// against a connection drag's source column and tint the kit rows by fit.
|
|
218
|
-
scoreMatch, matchTier, assignTiers, singularize, bindJoinGuidance, ensureJoinGuidanceStyles, JOIN_GUIDANCE_STYLE_ID, } from './lib/diagram-kit';
|
|
218
|
+
scoreMatch, matchTier, assignTiers, singularize, bindJoinGuidance, ensureJoinGuidanceStyles, JOIN_GUIDANCE_STYLE_ID, } from './lib/diagram-kit/index.js';
|
|
219
219
|
// Typed façade handles (domain-API decision, Option B): the OO surface —
|
|
220
220
|
// CardHandle → ErTable/UmlClass, ErField — over the data-first kit.
|
|
221
|
-
export { erTable, umlClass, erTables, umlClasses, CardHandle, ErTable, ErField, ErColumnList, UmlClass, UmlMemberList, } from './lib/diagram-kit';
|
|
221
|
+
export { erTable, umlClass, erTables, umlClasses, CardHandle, ErTable, ErField, ErColumnList, UmlClass, UmlMemberList, } from './lib/diagram-kit/index.js';
|
|
222
222
|
// ===========================================================================
|
|
223
223
|
// THE DASHBOARD KIT — Phase 2 of the dashboard-grid plan.
|
|
224
224
|
//
|
|
@@ -236,10 +236,10 @@ dashboard,
|
|
|
236
236
|
// …and the built-in renderers behind `kind`, so a dashboard is useful with
|
|
237
237
|
// no renderWidget at all. Composable: call defaultWidgetRenderer first, then
|
|
238
238
|
// decorate the host.
|
|
239
|
-
defaultWidgetRenderer, renderKpiWidget, renderLineWidget, renderBarWidget, renderDonutWidget, renderFunnelWidget, renderTableWidget, BUILT_IN_WIDGET_KINDS, } from './lib/dashboard-kit';
|
|
239
|
+
defaultWidgetRenderer, renderKpiWidget, renderLineWidget, renderBarWidget, renderDonutWidget, renderFunnelWidget, renderTableWidget, BUILT_IN_WIDGET_KINDS, } from './lib/dashboard-kit/index.js';
|
|
240
240
|
// The stencil kit — a Visio-style palette that drags shape masters onto the
|
|
241
241
|
// canvas (T6/T7). Pairs with listStencils()/registerStencils() above.
|
|
242
|
-
export { bindStencilPalette, bindShapeDataPanel, ensureStencilKitStyles } from './lib/stencil-kit';
|
|
242
|
+
export { bindStencilPalette, bindShapeDataPanel, ensureStencilKitStyles } from './lib/stencil-kit/index.js';
|
|
243
243
|
/* ==========================================================================
|
|
244
244
|
* PHASE 0 — THE INVERSION.
|
|
245
245
|
*
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
* round-trips with no extra work — same as every other kit.
|
|
44
44
|
*/
|
|
45
45
|
import { GroupModel, NodeModel, type GridColumnLayout } from '@grafloria/engine';
|
|
46
|
-
import { type DashboardGridHandle, type DashboardGridOptions, type DashboardResponsiveOptions } from './grid-binder';
|
|
47
|
-
import type { DragHandleOption } from './grid-binder';
|
|
48
|
-
import type { SplitNode } from './split-layout';
|
|
46
|
+
import { type DashboardGridHandle, type DashboardGridOptions, type DashboardResponsiveOptions } from './grid-binder.js';
|
|
47
|
+
import type { DragHandleOption } from './grid-binder.js';
|
|
48
|
+
import type { SplitNode } from './split-layout.js';
|
|
49
49
|
/** A widget, declared as data. */
|
|
50
50
|
export interface DashboardWidgetSpec {
|
|
51
51
|
id: string;
|
|
@@ -199,6 +199,14 @@ export interface DashboardOptions {
|
|
|
199
199
|
* interactive. Live: `handle.setDragHandle()`.
|
|
200
200
|
*/
|
|
201
201
|
dragHandle?: DragHandleOption;
|
|
202
|
+
/**
|
|
203
|
+
* FIT AND THE ROW FLOOR. `true` (default): a bounded fit board squeezes its
|
|
204
|
+
* rows toward `minRowHeight` before refusing growth. `false`: rows freeze at
|
|
205
|
+
* the height they have now — a gesture that needs a row the frame does not
|
|
206
|
+
* hold is refused outright and no other tile shrinks. See the grid binder's
|
|
207
|
+
* `squeeze` for the exact rule.
|
|
208
|
+
*/
|
|
209
|
+
squeeze?: boolean;
|
|
202
210
|
/**
|
|
203
211
|
* RIGHT-TO-LEFT boards: column x=0 renders at the RIGHT edge and columns run
|
|
204
212
|
* leftwards. Cells are untouched — the same `widgets` array describes the
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
*/
|
|
45
45
|
import { __awaiter } from "tslib";
|
|
46
46
|
import { BatchCommand, BringNodeToFrontCommand, Command, GroupModel, NodeModel, RemoveFromGroupCommand, RemoveGroupCommand, RemoveNodeCommand, SendNodeToBackCommand, } from '@grafloria/engine';
|
|
47
|
-
import { bindDashboardGrid, } from './grid-binder';
|
|
48
|
-
import { bindDashboardSplit, SPLIT_TREE_KEY } from './split-binder';
|
|
49
|
-
import { gridItemFromCell } from './grid-mapping';
|
|
50
|
-
import { ensureDashboardKitStyles } from './styles';
|
|
51
|
-
import { defaultWidgetRenderer } from './widgets';
|
|
47
|
+
import { bindDashboardGrid, } from './grid-binder.js';
|
|
48
|
+
import { bindDashboardSplit, SPLIT_TREE_KEY } from './split-binder.js';
|
|
49
|
+
import { gridItemFromCell } from './grid-mapping.js';
|
|
50
|
+
import { ensureDashboardKitStyles } from './styles.js';
|
|
51
|
+
import { defaultWidgetRenderer } from './widgets.js';
|
|
52
52
|
/**
|
|
53
53
|
* Add a widget node AND its board membership as ONE undoable step.
|
|
54
54
|
*
|
|
@@ -505,9 +505,20 @@ export function createDashboardHandle(ctx) {
|
|
|
505
505
|
return makeWidgetHandle(id);
|
|
506
506
|
},
|
|
507
507
|
focusWidget(id) {
|
|
508
|
-
var _a
|
|
508
|
+
var _a;
|
|
509
509
|
const b = binders.get((_a = viewOfWidget.get(id)) !== null && _a !== void 0 ? _a : '');
|
|
510
|
-
|
|
510
|
+
if (!b)
|
|
511
|
+
return false;
|
|
512
|
+
if (b.focusWidget(id))
|
|
513
|
+
return true;
|
|
514
|
+
// A widget added in this same tick is not a member yet (adds commit
|
|
515
|
+
// asynchronously): the spec knows it, so select it once the commit lands.
|
|
516
|
+
if (!specById.has(id))
|
|
517
|
+
return false;
|
|
518
|
+
const retry = (n) => { if (!b.focusWidget(id) && n > 0)
|
|
519
|
+
setTimeout(() => retry(n - 1), 16); };
|
|
520
|
+
queueMicrotask(() => retry(4));
|
|
521
|
+
return true;
|
|
511
522
|
},
|
|
512
523
|
widgetsOf(viewId) {
|
|
513
524
|
var _a;
|
|
@@ -1032,7 +1043,7 @@ export function dashboard(options) {
|
|
|
1032
1043
|
// its tree from exactly those, so any stale tree is cleared first;
|
|
1033
1044
|
// split → grid rebuilds from them, so the column cache goes too.
|
|
1034
1045
|
ctx.rebindView = (viewId, next) => {
|
|
1035
|
-
var _a;
|
|
1046
|
+
var _a, _b;
|
|
1036
1047
|
const v = views.find((x) => x.id === viewId);
|
|
1037
1048
|
const g = groups.get(viewId);
|
|
1038
1049
|
const b = binders.get(viewId);
|
|
@@ -1040,6 +1051,7 @@ export function dashboard(options) {
|
|
|
1040
1051
|
return;
|
|
1041
1052
|
const cells = b.saveLayout().cells;
|
|
1042
1053
|
const live = { rtl: b.getRtl(), static: b.getStatic(), dragHandle: b.getDragHandle() };
|
|
1054
|
+
const focused = b.getFocusedWidget();
|
|
1043
1055
|
b.dispose();
|
|
1044
1056
|
const write = (fn) => (model.runSystemWrite ? model.runSystemWrite(fn) : fn());
|
|
1045
1057
|
write(() => {
|
|
@@ -1059,6 +1071,10 @@ export function dashboard(options) {
|
|
|
1059
1071
|
ctx.layoutOf.set(viewId, next);
|
|
1060
1072
|
binders.set(viewId, bindView(v, g, next, live));
|
|
1061
1073
|
(_a = binders.get(viewId)) === null || _a === void 0 ? void 0 : _a.sync();
|
|
1074
|
+
// The selected widget (and its grip) survives the switch, as it does in
|
|
1075
|
+
// the DevExpress designer — the host used to have to restate it.
|
|
1076
|
+
if (focused)
|
|
1077
|
+
(_b = binders.get(viewId)) === null || _b === void 0 ? void 0 : _b.focusWidget(focused);
|
|
1062
1078
|
};
|
|
1063
1079
|
handle.showView(ctx.active);
|
|
1064
1080
|
ctx.rebindContainer = (id) => {
|
|
@@ -1153,7 +1169,7 @@ export function dashboard(options) {
|
|
|
1153
1169
|
*/
|
|
1154
1170
|
function bindView(v, g, viewLayout, live) {
|
|
1155
1171
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1156
|
-
const common = Object.assign(Object.assign({ gap, padding: gap, rtl: (_b = (_a = live === null || live === void 0 ? void 0 : live.rtl) !== null && _a !== void 0 ? _a : options.rtl) !== null && _b !== void 0 ? _b : false, fluid: mode === 'fluid', static: (_d = (_c = live === null || live === void 0 ? void 0 : live.static) !== null && _c !== void 0 ? _c : options.static) !== null && _d !== void 0 ? _d : false, dragHandle: (_f = (_e = live === null || live === void 0 ? void 0 : live.dragHandle) !== null && _e !== void 0 ? _e : options.dragHandle) !== null && _f !== void 0 ? _f : false }, ((_g = options.binder) !== null && _g !== void 0 ? _g : {})), { onGesture: (e) => {
|
|
1172
|
+
const common = Object.assign(Object.assign(Object.assign({ gap, padding: gap, rtl: (_b = (_a = live === null || live === void 0 ? void 0 : live.rtl) !== null && _a !== void 0 ? _a : options.rtl) !== null && _b !== void 0 ? _b : false, fluid: mode === 'fluid', static: (_d = (_c = live === null || live === void 0 ? void 0 : live.static) !== null && _c !== void 0 ? _c : options.static) !== null && _d !== void 0 ? _d : false, dragHandle: (_f = (_e = live === null || live === void 0 ? void 0 : live.dragHandle) !== null && _e !== void 0 ? _e : options.dragHandle) !== null && _f !== void 0 ? _f : false }, (options.squeeze !== undefined ? { squeeze: options.squeeze } : {})), ((_g = options.binder) !== null && _g !== void 0 ? _g : {})), { onGesture: (e) => {
|
|
1157
1173
|
var _a, _b;
|
|
1158
1174
|
if (e.type === 'commit')
|
|
1159
1175
|
reportChanged();
|
|
@@ -1167,25 +1183,12 @@ export function dashboard(options) {
|
|
|
1167
1183
|
/** Bind (or re-bind) a container's inner grid on its group. */
|
|
1168
1184
|
function bindContainer(cg, w, viewId) {
|
|
1169
1185
|
var _a, _b, _c, _d, _e;
|
|
1170
|
-
binders.set(w.id, bindDashboardGrid(a, cg, {
|
|
1171
|
-
columns: innerColumnsOf(w),
|
|
1172
|
-
gap,
|
|
1173
|
-
padding: 0,
|
|
1174
|
-
sizing: 'fit',
|
|
1175
|
-
baseRowHeight: rowHeight,
|
|
1176
|
-
designHeight: 0,
|
|
1177
|
-
maxRows: (_a = w.maxRows) !== null && _a !== void 0 ? _a : rowExtentOf((_b = w.widgets) !== null && _b !== void 0 ? _b : []),
|
|
1178
|
-
float: false,
|
|
1179
|
-
rtl: (_c = options.rtl) !== null && _c !== void 0 ? _c : false,
|
|
1180
|
-
static: (_d = options.static) !== null && _d !== void 0 ? _d : false,
|
|
1181
|
-
dragHandle: (_e = options.dragHandle) !== null && _e !== void 0 ? _e : false,
|
|
1182
|
-
onGesture: (e) => {
|
|
1186
|
+
binders.set(w.id, bindDashboardGrid(a, cg, Object.assign(Object.assign({ columns: innerColumnsOf(w), gap, padding: 0, sizing: 'fit', baseRowHeight: rowHeight, designHeight: 0, maxRows: (_a = w.maxRows) !== null && _a !== void 0 ? _a : rowExtentOf((_b = w.widgets) !== null && _b !== void 0 ? _b : []), float: false, rtl: (_c = options.rtl) !== null && _c !== void 0 ? _c : false, static: (_d = options.static) !== null && _d !== void 0 ? _d : false, dragHandle: (_e = options.dragHandle) !== null && _e !== void 0 ? _e : false }, (options.squeeze !== undefined ? { squeeze: options.squeeze } : {})), { onGesture: (e) => {
|
|
1183
1187
|
var _a, _b;
|
|
1184
1188
|
if (e.type === 'commit')
|
|
1185
1189
|
reportChanged();
|
|
1186
1190
|
(_b = (_a = options.binder) === null || _a === void 0 ? void 0 : _a.onGesture) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
1187
|
-
}
|
|
1188
|
-
}));
|
|
1191
|
+
} })));
|
|
1189
1192
|
}
|
|
1190
1193
|
/**
|
|
1191
1194
|
* One reporter for every binder on a view — the view's own and each
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
* second `bindDashboardGrid` on the section for a nested pack grid.
|
|
51
51
|
*/
|
|
52
52
|
import { Command, type DiagramModel, type GridColumnLayout, type GroupModel, type NodeModel } from '@grafloria/engine';
|
|
53
|
-
import { type CellRect, type WorldRect } from './grid-mapping';
|
|
53
|
+
import { type CellRect, type WorldRect } from './grid-mapping.js';
|
|
54
54
|
/** The slice of a DiagramInstance the binder needs (structural, test-friendly). */
|
|
55
55
|
export interface DashboardGridApi {
|
|
56
56
|
getModel(): DiagramModel;
|
|
@@ -223,6 +223,18 @@ export interface DashboardGridOptions {
|
|
|
223
223
|
* interactive (scroll a table, click a legend). Live: `setDragHandle`.
|
|
224
224
|
*/
|
|
225
225
|
dragHandle?: DragHandleOption;
|
|
226
|
+
/**
|
|
227
|
+
* FIT AND THE ROW FLOOR. `true` (default): a bounded fit board holds as many
|
|
228
|
+
* rows as fit at `minRowHeight` — a gesture that needs another row SQUEEZES
|
|
229
|
+
* every row toward the floor, and is refused only when even that is not
|
|
230
|
+
* enough. `false`: rows FREEZE at the height they have now — the capacity is
|
|
231
|
+
* what the frame holds at the current row height, so a resize, move or add
|
|
232
|
+
* that needs a row the frame does not have is refused outright (placeholder
|
|
233
|
+
* stays, `onGesture` reports `changed: false`) and no other tile shrinks. A
|
|
234
|
+
* board loaded with more rows than fit still squeezes to the frame (fit never
|
|
235
|
+
* scrolls); it just cannot be pushed further by a gesture.
|
|
236
|
+
*/
|
|
237
|
+
squeeze?: boolean;
|
|
226
238
|
}
|
|
227
239
|
/** A painted grip: the only drag zone, placed along the card's top edge. */
|
|
228
240
|
export interface DragGripOptions {
|
|
@@ -257,6 +269,8 @@ export declare function gripHostOf(target: Element | null): HTMLElement | null;
|
|
|
257
269
|
* included — so the pointer need not hit the header's text to grab the tile.
|
|
258
270
|
*/
|
|
259
271
|
export declare function pressOnDragHandle(sel: string, target: Element | null, hostEl: HTMLElement | null, clientX: number, clientY: number): boolean;
|
|
272
|
+
/** The caption strip of a host with no kit header, px from the card's top. */
|
|
273
|
+
export declare const CAPTION_BAND = 28;
|
|
260
274
|
export interface DashboardGridHandle {
|
|
261
275
|
/** Rebuild the engine from the group's members + their cells, re-project pixels. */
|
|
262
276
|
sync(): void;
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
import { __awaiter } from "tslib";
|
|
53
53
|
import { AddToGroupCommand, BatchCommand, Command, GridPackEngine, RemoveFromGroupCommand, } from '@grafloria/engine';
|
|
54
54
|
import { LiveRegionController, registerTool } from '@grafloria/renderer';
|
|
55
|
-
import { buildCommitCommands, cellFromGridItem, cellToRect, columnUnitFor, gridItemFromCell, pointToCell, rowHeightFor, sizeToSpan, } from './grid-mapping';
|
|
56
|
-
import { ensureDashboardKitStyles } from './styles';
|
|
55
|
+
import { buildCommitCommands, cellFromGridItem, cellToRect, columnUnitFor, gridItemFromCell, pointToCell, rowHeightFor, sizeToSpan, } from './grid-mapping.js';
|
|
56
|
+
import { ensureDashboardKitStyles } from './styles.js';
|
|
57
57
|
/** The class of the painted grip element (a child of the node host). */
|
|
58
58
|
export const GRIP_CLASS = 'axdb-grip';
|
|
59
59
|
/** The container class that turns the caption strip's grip dots on. */
|
|
@@ -110,13 +110,15 @@ export function pressOnDragHandle(sel, target, hostEl, clientX, clientY) {
|
|
|
110
110
|
return true;
|
|
111
111
|
if (sel !== '.axdb-widget-h' || !hostEl)
|
|
112
112
|
return false;
|
|
113
|
-
const header = hostEl.querySelector('.axdb-widget-h');
|
|
114
|
-
if (!header)
|
|
115
|
-
return false;
|
|
116
113
|
const hr = hostEl.getBoundingClientRect();
|
|
117
|
-
const
|
|
118
|
-
|
|
114
|
+
const header = hostEl.querySelector('.axdb-widget-h');
|
|
115
|
+
// A host painting its own content has no kit header: its caption is the top
|
|
116
|
+
// band of the card, so `dragHandle: true` still means something there.
|
|
117
|
+
const bottom = header ? header.getBoundingClientRect().bottom : hr.top + CAPTION_BAND;
|
|
118
|
+
return clientX >= hr.left && clientX <= hr.right && clientY >= hr.top && clientY <= bottom;
|
|
119
119
|
}
|
|
120
|
+
/** The caption strip of a host with no kit header, px from the card's top. */
|
|
121
|
+
export const CAPTION_BAND = 28;
|
|
120
122
|
/**
|
|
121
123
|
* Binders on the same canvas find each other here. A WeakMap: a canvas that
|
|
122
124
|
* is gone takes its (empty) peer set with it — the strong Map it replaced kept
|
|
@@ -237,6 +239,7 @@ export function bindDashboardGrid(api, group, options = {}) {
|
|
|
237
239
|
const padding = (_c = options.padding) !== null && _c !== void 0 ? _c : gap;
|
|
238
240
|
const baseRowHeight = (_d = options.baseRowHeight) !== null && _d !== void 0 ? _d : 110;
|
|
239
241
|
const minRowHeight = (_e = options.minRowHeight) !== null && _e !== void 0 ? _e : 28;
|
|
242
|
+
const squeeze = options.squeeze !== false;
|
|
240
243
|
let float = (_f = options.float) !== null && _f !== void 0 ? _f : false;
|
|
241
244
|
/** The AUTHORED bound — a nested strip's design (row-first push, escalation). */
|
|
242
245
|
const maxRows = options.maxRows;
|
|
@@ -285,7 +288,10 @@ export function bindDashboardGrid(api, group, options = {}) {
|
|
|
285
288
|
const fitCapacity = () => {
|
|
286
289
|
if (maxRows !== undefined || sizing !== 'fit' || overflow === 'scroll' || designH <= 0)
|
|
287
290
|
return undefined;
|
|
288
|
-
|
|
291
|
+
// Elastic (default): rows at the floor. Frozen (`squeeze: false`): rows at
|
|
292
|
+
// the height they have NOW, so a gesture never shrinks a neighbour.
|
|
293
|
+
const floor = squeeze ? minRowHeight : Math.max(minRowHeight, rowHeightFor(geom(), rows()));
|
|
294
|
+
const rowsThatFit = Math.floor((designH - 2 * padding + gap) / (floor + gap));
|
|
289
295
|
return Math.max(1, rowsThatFit, engine.rows());
|
|
290
296
|
};
|
|
291
297
|
/** Re-derive the capacity; true when the engine must be rebuilt to carry it. */
|
|
@@ -664,6 +670,7 @@ export function bindDashboardGrid(api, group, options = {}) {
|
|
|
664
670
|
syncA11y(only);
|
|
665
671
|
if (disposed)
|
|
666
672
|
return;
|
|
673
|
+
ensureStaticGuard();
|
|
667
674
|
const grip = gripOf(dragHandle);
|
|
668
675
|
for (const id of (_a = group.members) !== null && _a !== void 0 ? _a : []) {
|
|
669
676
|
if (only && !only.has(id))
|
|
@@ -1828,9 +1835,50 @@ export function bindDashboardGrid(api, group, options = {}) {
|
|
|
1828
1835
|
return;
|
|
1829
1836
|
const node = diagram.getNode(id);
|
|
1830
1837
|
const resizable = !!node && !isStatic && ((_f = node.state) === null || _f === void 0 ? void 0 : _f.locked) !== true && ((_g = node.getMetadata) === null || _g === void 0 ? void 0 : _g.call(node, 'widgetResizable')) !== false;
|
|
1831
|
-
|
|
1838
|
+
const cursor = resizable ? cursorFor(edgesNear(host, e.clientX, e.clientY)) : '';
|
|
1839
|
+
// The affordance rides on an ATTRIBUTE, not the inline style: a repaint
|
|
1840
|
+
// rewrites the host's style and used to clear the cursor mid-hover, and
|
|
1841
|
+
// content that sets its own cursor (a chart canvas) hid it — the
|
|
1842
|
+
// stylesheet applies the attribute's cursor to the host and everything in it.
|
|
1843
|
+
if (cursor)
|
|
1844
|
+
host.setAttribute('data-axdb-edge', cursor);
|
|
1845
|
+
else
|
|
1846
|
+
host.removeAttribute('data-axdb-edge');
|
|
1832
1847
|
};
|
|
1833
1848
|
api.container.addEventListener('pointermove', onHover, { passive: true });
|
|
1849
|
+
/**
|
|
1850
|
+
* STATIC BOARDS LET CONTENT BE CLICKED. The renderer prevents the default of
|
|
1851
|
+
* every press a tool claims, which cancels the compatibility mouse events —
|
|
1852
|
+
* a chart inside a read-only board could not be clicked. So under `static`
|
|
1853
|
+
* a press inside a member's CONTENT (not on kit chrome) is stopped on the
|
|
1854
|
+
* HTML layer, in the bubble phase: the content has already received it, the
|
|
1855
|
+
* renderer never does, nothing is prevented.
|
|
1856
|
+
*/
|
|
1857
|
+
const staticGuard = (e) => {
|
|
1858
|
+
var _a, _b, _c, _d;
|
|
1859
|
+
if (!isStatic || disposed)
|
|
1860
|
+
return;
|
|
1861
|
+
const t = e.target;
|
|
1862
|
+
const host = (_a = t === null || t === void 0 ? void 0 : t.closest) === null || _a === void 0 ? void 0 : _a.call(t, '.grafloria-node-host');
|
|
1863
|
+
if (!host || !((_b = group.members) !== null && _b !== void 0 ? _b : new Set()).has((_c = host.getAttribute('data-node-id')) !== null && _c !== void 0 ? _c : ''))
|
|
1864
|
+
return;
|
|
1865
|
+
if ((_d = t === null || t === void 0 ? void 0 : t.closest) === null || _d === void 0 ? void 0 : _d.call(t, '.axdb-rs, .axdb-grip, .axdb-div'))
|
|
1866
|
+
return;
|
|
1867
|
+
e.stopPropagation();
|
|
1868
|
+
};
|
|
1869
|
+
let guardedLayer = null;
|
|
1870
|
+
const ensureStaticGuard = () => {
|
|
1871
|
+
// One lookup, ever: the host observer budgets container lookups per
|
|
1872
|
+
// repaint, and the layer element lives as long as the instance.
|
|
1873
|
+
if (guardedLayer === null || guardedLayer === void 0 ? void 0 : guardedLayer.isConnected)
|
|
1874
|
+
return;
|
|
1875
|
+
const layer = htmlLayer();
|
|
1876
|
+
if (!layer)
|
|
1877
|
+
return;
|
|
1878
|
+
guardedLayer === null || guardedLayer === void 0 ? void 0 : guardedLayer.removeEventListener('pointerdown', staticGuard);
|
|
1879
|
+
guardedLayer = layer;
|
|
1880
|
+
layer.addEventListener('pointerdown', staticGuard);
|
|
1881
|
+
};
|
|
1834
1882
|
/**
|
|
1835
1883
|
* KEYBOARD OPERATION (WCAG 2.1.1, and the non-drag alternative 2.5.7 asks
|
|
1836
1884
|
* for): on a focused member, arrows move it one cell, Shift+arrows resize it
|
|
@@ -2349,6 +2397,7 @@ export function bindDashboardGrid(api, group, options = {}) {
|
|
|
2349
2397
|
peersOnCanvas().delete(selfPeer);
|
|
2350
2398
|
unregisterTool();
|
|
2351
2399
|
api.container.removeEventListener('pointermove', onHover);
|
|
2400
|
+
guardedLayer === null || guardedLayer === void 0 ? void 0 : guardedLayer.removeEventListener('pointerdown', staticGuard);
|
|
2352
2401
|
api.container.removeEventListener('focusin', onFocusIn);
|
|
2353
2402
|
api.container.removeEventListener('keydown', onKey);
|
|
2354
2403
|
hostObserver.disconnect();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { bindDashboardGrid, type DashboardGridApi, type DashboardGridOptions, type DashboardGridHandle, type DashboardResponsiveOptions, type DragHandleOption, type DragGripOptions, normalizeDragHandle, } from './grid-binder';
|
|
2
|
-
export { bindDashboardSplit, SetSplitTreeCommand, SPLIT_TREE_KEY, type DashboardSplitOptions, type DashboardSplitHandle, } from './split-binder';
|
|
3
|
-
export { projectSplit, dividersOf, addSplitLeaf, removeSplitLeaf, insertSplitLeaf, moveSplitDivider, splitFromCells, cellsFromSplit, splitLeaves, type SplitNode, type SplitGroup, type SplitLeaf, type SplitDir, type SplitSide, type SplitDivider, } from './split-layout';
|
|
4
|
-
export { rowHeightFor, boardHeightFor, columnUnitFor, cellToRect, pointToCell, sizeToSpan, spanWidthPx, gridItemFromCell, cellFromGridItem, buildCommitCommands, type CellRect, type WorldRect, type DashboardGridGeometry, type TileDelta, } from './grid-mapping';
|
|
5
|
-
export { ensureDashboardKitStyles, DASHBOARD_KIT_STYLE_ID } from './styles';
|
|
6
|
-
export { dashboard, type DashboardOptions, type DashboardSpec, type DashboardSnapshot, type DashboardHandle, type DashboardViewSpec, type DashboardWidgetSpec, type WidgetHandle, } from './dashboard';
|
|
7
|
-
export { defaultWidgetRenderer, renderKpiWidget, renderLineWidget, renderBarWidget, renderDonutWidget, renderFunnelWidget, renderTableWidget, BUILT_IN_WIDGET_KINDS, type WidgetRenderer, type KpiWidgetData, type LineWidgetData, type LineSeries, type BarWidgetData, type DonutWidgetData, type FunnelWidgetData, type TableWidgetData, } from './widgets';
|
|
1
|
+
export { bindDashboardGrid, type DashboardGridApi, type DashboardGridOptions, type DashboardGridHandle, type DashboardResponsiveOptions, type DragHandleOption, type DragGripOptions, normalizeDragHandle, } from './grid-binder.js';
|
|
2
|
+
export { bindDashboardSplit, SetSplitTreeCommand, SPLIT_TREE_KEY, type DashboardSplitOptions, type DashboardSplitHandle, } from './split-binder.js';
|
|
3
|
+
export { projectSplit, dividersOf, addSplitLeaf, removeSplitLeaf, insertSplitLeaf, moveSplitDivider, splitFromCells, cellsFromSplit, splitLeaves, type SplitNode, type SplitGroup, type SplitLeaf, type SplitDir, type SplitSide, type SplitDivider, } from './split-layout.js';
|
|
4
|
+
export { rowHeightFor, boardHeightFor, columnUnitFor, cellToRect, pointToCell, sizeToSpan, spanWidthPx, gridItemFromCell, cellFromGridItem, buildCommitCommands, type CellRect, type WorldRect, type DashboardGridGeometry, type TileDelta, } from './grid-mapping.js';
|
|
5
|
+
export { ensureDashboardKitStyles, DASHBOARD_KIT_STYLE_ID } from './styles.js';
|
|
6
|
+
export { dashboard, type DashboardOptions, type DashboardSpec, type DashboardSnapshot, type DashboardHandle, type DashboardViewSpec, type DashboardWidgetSpec, type WidgetHandle, } from './dashboard.js';
|
|
7
|
+
export { defaultWidgetRenderer, renderKpiWidget, renderLineWidget, renderBarWidget, renderDonutWidget, renderFunnelWidget, renderTableWidget, BUILT_IN_WIDGET_KINDS, type WidgetRenderer, type KpiWidgetData, type LineWidgetData, type LineSeries, type BarWidgetData, type DonutWidgetData, type FunnelWidgetData, type TableWidgetData, } from './widgets.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { bindDashboardGrid, normalizeDragHandle, } from './grid-binder';
|
|
2
|
-
export { bindDashboardSplit, SetSplitTreeCommand, SPLIT_TREE_KEY, } from './split-binder';
|
|
3
|
-
export { projectSplit, dividersOf, addSplitLeaf, removeSplitLeaf, insertSplitLeaf, moveSplitDivider, splitFromCells, cellsFromSplit, splitLeaves, } from './split-layout';
|
|
4
|
-
export { rowHeightFor, boardHeightFor, columnUnitFor, cellToRect, pointToCell, sizeToSpan, spanWidthPx, gridItemFromCell, cellFromGridItem, buildCommitCommands, } from './grid-mapping';
|
|
5
|
-
export { ensureDashboardKitStyles, DASHBOARD_KIT_STYLE_ID } from './styles';
|
|
1
|
+
export { bindDashboardGrid, normalizeDragHandle, } from './grid-binder.js';
|
|
2
|
+
export { bindDashboardSplit, SetSplitTreeCommand, SPLIT_TREE_KEY, } from './split-binder.js';
|
|
3
|
+
export { projectSplit, dividersOf, addSplitLeaf, removeSplitLeaf, insertSplitLeaf, moveSplitDivider, splitFromCells, cellsFromSplit, splitLeaves, } from './split-layout.js';
|
|
4
|
+
export { rowHeightFor, boardHeightFor, columnUnitFor, cellToRect, pointToCell, sizeToSpan, spanWidthPx, gridItemFromCell, cellFromGridItem, buildCommitCommands, } from './grid-mapping.js';
|
|
5
|
+
export { ensureDashboardKitStyles, DASHBOARD_KIT_STYLE_ID } from './styles.js';
|
|
6
6
|
// The DATA-FIRST authoring API (the erDiagram/umlDiagram equivalent).
|
|
7
|
-
export { dashboard, } from './dashboard';
|
|
7
|
+
export { dashboard, } from './dashboard.js';
|
|
8
8
|
// The built-in renderers behind `kind` — dashboard()'s default renderWidget.
|
|
9
|
-
export { defaultWidgetRenderer, renderKpiWidget, renderLineWidget, renderBarWidget, renderDonutWidget, renderFunnelWidget, renderTableWidget, BUILT_IN_WIDGET_KINDS, } from './widgets';
|
|
9
|
+
export { defaultWidgetRenderer, renderKpiWidget, renderLineWidget, renderBarWidget, renderDonutWidget, renderFunnelWidget, renderTableWidget, BUILT_IN_WIDGET_KINDS, } from './widgets.js';
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
* the authored size.
|
|
24
24
|
*/
|
|
25
25
|
import { Command, type GroupModel } from '@grafloria/engine';
|
|
26
|
-
import type { DashboardGridApi, DashboardGridHandle, DashboardGridOptions } from './grid-binder';
|
|
27
|
-
import { type SplitNode } from './split-layout';
|
|
26
|
+
import type { DashboardGridApi, DashboardGridHandle, DashboardGridOptions } from './grid-binder.js';
|
|
27
|
+
import { type SplitNode } from './split-layout.js';
|
|
28
28
|
/** Group metadata key the tree persists under. */
|
|
29
29
|
export declare const SPLIT_TREE_KEY = "dashboardTree";
|
|
30
|
-
export interface DashboardSplitOptions extends Pick<DashboardGridOptions, 'columns' | 'gap' | 'padding' | 'rtl' | 'fluid' | 'static' | 'dragHandle' | 'designHeight' | 'baseRowHeight' | 'dragOut' | 'removeZone' | 'onRemoveRequest' | 'onDropIn' | 'onGesture'> {
|
|
30
|
+
export interface DashboardSplitOptions extends Pick<DashboardGridOptions, 'columns' | 'gap' | 'padding' | 'rtl' | 'fluid' | 'static' | 'dragHandle' | 'squeeze' | 'designHeight' | 'baseRowHeight' | 'dragOut' | 'removeZone' | 'onRemoveRequest' | 'onDropIn' | 'onGesture'> {
|
|
31
31
|
/** An authored tree. Default: the persisted one, else derived from the members' cells. */
|
|
32
32
|
tree?: SplitNode | null;
|
|
33
33
|
}
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
import { __awaiter } from "tslib";
|
|
26
26
|
import { Command } from '@grafloria/engine';
|
|
27
27
|
import { LiveRegionController, registerTool } from '@grafloria/renderer';
|
|
28
|
-
import { dragHandleSelector, gripHostOf, gripOf, normalizeDragHandle, pressOnDragHandle, syncGrip, DRAG_HANDLE_CLASS } from './grid-binder';
|
|
29
|
-
import { cellFromGridItem } from './grid-mapping';
|
|
30
|
-
import { addSplitLeaf, cellsFromSplit, cloneSplit, dividersOf, groupRectsOf, insertSplitLeaf, moveSplitDivider, normalizeSplit, pathToLeaf, projectSplit, removeSplitLeaf, splitFromCells, splitLeaves, } from './split-layout';
|
|
31
|
-
import { ensureDashboardKitStyles } from './styles';
|
|
28
|
+
import { dragHandleSelector, gripHostOf, gripOf, normalizeDragHandle, pressOnDragHandle, syncGrip, DRAG_HANDLE_CLASS } from './grid-binder.js';
|
|
29
|
+
import { cellFromGridItem } from './grid-mapping.js';
|
|
30
|
+
import { addSplitLeaf, cellsFromSplit, cloneSplit, dividersOf, groupRectsOf, insertSplitLeaf, moveSplitDivider, normalizeSplit, pathToLeaf, projectSplit, removeSplitLeaf, splitFromCells, splitLeaves, } from './split-layout.js';
|
|
31
|
+
import { ensureDashboardKitStyles } from './styles.js';
|
|
32
32
|
/** Group metadata key the tree persists under. */
|
|
33
33
|
export const SPLIT_TREE_KEY = 'dashboardTree';
|
|
34
34
|
/**
|
|
@@ -377,23 +377,48 @@ export function bindDashboardSplit(api, group, options = {}) {
|
|
|
377
377
|
selectedId = id;
|
|
378
378
|
syncA11y();
|
|
379
379
|
};
|
|
380
|
-
|
|
380
|
+
// Static boards let content be clicked — see grid-binder's staticGuard.
|
|
381
|
+
const staticGuard = (e) => {
|
|
381
382
|
var _a, _b, _c, _d;
|
|
383
|
+
if (!isStatic || disposed)
|
|
384
|
+
return;
|
|
385
|
+
const t = e.target;
|
|
386
|
+
const host = (_a = t === null || t === void 0 ? void 0 : t.closest) === null || _a === void 0 ? void 0 : _a.call(t, '.grafloria-node-host');
|
|
387
|
+
if (!host || !((_b = group.members) !== null && _b !== void 0 ? _b : new Set()).has((_c = host.getAttribute('data-node-id')) !== null && _c !== void 0 ? _c : ''))
|
|
388
|
+
return;
|
|
389
|
+
if ((_d = t === null || t === void 0 ? void 0 : t.closest) === null || _d === void 0 ? void 0 : _d.call(t, '.axdb-rs, .axdb-grip, .axdb-div'))
|
|
390
|
+
return;
|
|
391
|
+
e.stopPropagation();
|
|
392
|
+
};
|
|
393
|
+
let guardedLayer = null;
|
|
394
|
+
const ensureStaticGuard = () => {
|
|
395
|
+
if (guardedLayer === null || guardedLayer === void 0 ? void 0 : guardedLayer.isConnected)
|
|
396
|
+
return;
|
|
397
|
+
const layer = api.container.querySelector('.grafloria-html-layer');
|
|
398
|
+
if (!layer)
|
|
399
|
+
return;
|
|
400
|
+
guardedLayer === null || guardedLayer === void 0 ? void 0 : guardedLayer.removeEventListener('pointerdown', staticGuard);
|
|
401
|
+
guardedLayer = layer;
|
|
402
|
+
layer.addEventListener('pointerdown', staticGuard);
|
|
403
|
+
};
|
|
404
|
+
const syncA11y = () => {
|
|
405
|
+
var _a, _b, _c, _d, _e;
|
|
382
406
|
if (disposed)
|
|
383
407
|
return;
|
|
408
|
+
ensureStaticGuard();
|
|
384
409
|
const order = splitLeaves(paintedTree()).filter((id) => !!diagram.getNode(id));
|
|
385
410
|
if (selectedId && !order.includes(selectedId))
|
|
386
411
|
selectedId = undefined;
|
|
387
412
|
// No corner handles on a split board: size comes from the dividers. A host
|
|
388
413
|
// that carried the grid's handle (a board switched live) sheds it here.
|
|
389
|
-
for (const id of
|
|
390
|
-
(
|
|
414
|
+
for (const id of (_a = group.members) !== null && _a !== void 0 ? _a : [])
|
|
415
|
+
(_c = (_b = hostOf(id)) === null || _b === void 0 ? void 0 : _b.querySelector(':scope > .axdb-rs')) === null || _c === void 0 ? void 0 : _c.remove();
|
|
391
416
|
// The painted grip (or none), on every leaf host.
|
|
392
417
|
for (const id of order) {
|
|
393
418
|
const host = hostOf(id);
|
|
394
419
|
const node = diagram.getNode(id);
|
|
395
420
|
if (host && node)
|
|
396
|
-
syncGrip(host, gripOf(dragHandle), ((
|
|
421
|
+
syncGrip(host, gripOf(dragHandle), ((_d = node.state) === null || _d === void 0 ? void 0 : _d.locked) !== true && !isStatic && ((_e = node.getMetadata) === null || _e === void 0 ? void 0 : _e.call(node, 'widgetMovable')) !== false);
|
|
397
422
|
}
|
|
398
423
|
if (focusedId && !order.includes(focusedId))
|
|
399
424
|
focusedId = undefined;
|
|
@@ -1103,6 +1128,7 @@ export function bindDashboardSplit(api, group, options = {}) {
|
|
|
1103
1128
|
});
|
|
1104
1129
|
},
|
|
1105
1130
|
dispose() {
|
|
1131
|
+
guardedLayer === null || guardedLayer === void 0 ? void 0 : guardedLayer.removeEventListener('pointerdown', staticGuard);
|
|
1106
1132
|
if (disposed)
|
|
1107
1133
|
return;
|
|
1108
1134
|
cancelActiveGesture();
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* tree as plain JSON (`dashboardTree` on the board's group). One tree write
|
|
17
17
|
* per gesture is the whole undo story.
|
|
18
18
|
*/
|
|
19
|
-
import type { CellRect, WorldRect } from './grid-mapping';
|
|
19
|
+
import type { CellRect, WorldRect } from './grid-mapping.js';
|
|
20
20
|
export type SplitDir = 'row' | 'column';
|
|
21
21
|
export interface SplitLeaf {
|
|
22
22
|
id: string;
|
|
@@ -35,7 +35,7 @@ const CSS = `
|
|
|
35
35
|
|
|
36
36
|
/* ===== keyboard focus: the roving tab stop shows where it is (WCAG 2.4.7) ===== */
|
|
37
37
|
.grafloria-html-layer > .grafloria-node-host:focus-visible {
|
|
38
|
-
outline: 2px solid #3b52d9;
|
|
38
|
+
outline: 2px solid var(--axdb-accent, #3b52d9);
|
|
39
39
|
outline-offset: 2px;
|
|
40
40
|
border-radius: var(--axdb-rs-radius, 3px);
|
|
41
41
|
}
|
|
@@ -203,9 +203,16 @@ const CSS = `
|
|
|
203
203
|
content: ''; position: absolute; left: 5px; top: 2px; width: 12px; height: 6px;
|
|
204
204
|
background: radial-gradient(circle, currentColor 1px, transparent 1.4px) 0 0 / 4px 3px;
|
|
205
205
|
}
|
|
206
|
-
.grafloria-node-host > .axdb-grip:hover { border-color: #3b52d9; color: #3b52d9; }
|
|
207
|
-
/* The selected card says so, quietly.
|
|
208
|
-
|
|
206
|
+
.grafloria-node-host > .axdb-grip:hover { border-color: var(--axdb-accent, #3b52d9); color: var(--axdb-accent, #3b52d9); }
|
|
207
|
+
/* The selected card says so, quietly. --axdb-accent themes the grip's hover, the
|
|
208
|
+
ring and the focus outline together; --axdb-accent-ring the ring alone. */
|
|
209
|
+
.grafloria-node-host.axdb-selected > .axdb-widget { box-shadow: 0 0 0 1.5px var(--axdb-accent-ring, rgba(59, 82, 217, .55)), 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .05); }
|
|
210
|
+
/* While a resize edge is near, the host and everything in it (a chart canvas
|
|
211
|
+
with its own cursor included) show the edge's cursor. */
|
|
212
|
+
.grafloria-node-host[data-axdb-edge="ns-resize"], .grafloria-node-host[data-axdb-edge="ns-resize"] * { cursor: ns-resize !important; }
|
|
213
|
+
.grafloria-node-host[data-axdb-edge="ew-resize"], .grafloria-node-host[data-axdb-edge="ew-resize"] * { cursor: ew-resize !important; }
|
|
214
|
+
.grafloria-node-host[data-axdb-edge="nwse-resize"], .grafloria-node-host[data-axdb-edge="nwse-resize"] * { cursor: nwse-resize !important; }
|
|
215
|
+
.grafloria-node-host[data-axdb-edge="nesw-resize"], .grafloria-node-host[data-axdb-edge="nesw-resize"] * { cursor: nesw-resize !important; }
|
|
209
216
|
/* INSIDE: centred on the header's text line and flush with the card padding,
|
|
210
217
|
per size tier (padding 13/15, then 8/14, 4/12, 2/12). */
|
|
211
218
|
.grafloria-node-host > .axdb-grip--inside { top: 14px; }
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* (that is exactly what demos/dashboard/dashboard-builder.html does for its
|
|
29
29
|
* focus ring and pin marker).
|
|
30
30
|
*/
|
|
31
|
-
import type { DashboardWidgetSpec } from './dashboard';
|
|
31
|
+
import type { DashboardWidgetSpec } from './dashboard.js';
|
|
32
32
|
/** The signature every renderer here (and `renderWidget`) satisfies. */
|
|
33
33
|
export type WidgetRenderer = (widget: DashboardWidgetSpec, host: HTMLElement) => void;
|
|
34
34
|
/** `kind: 'kpi'` — one headline number, an optional change, an optional trend. */
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* (that is exactly what demos/dashboard/dashboard-builder.html does for its
|
|
29
29
|
* focus ring and pin marker).
|
|
30
30
|
*/
|
|
31
|
-
import { ensureDashboardKitStyles } from './styles';
|
|
31
|
+
import { ensureDashboardKitStyles } from './styles.js';
|
|
32
32
|
/** The kinds `defaultWidgetRenderer` knows; anything else gets the placeholder. */
|
|
33
33
|
export const BUILT_IN_WIDGET_KINDS = ['kpi', 'line', 'bar', 'donut', 'funnel', 'table'];
|
|
34
34
|
/**
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* port-reconciliation code count those, and the affordance is neither a column
|
|
15
15
|
* nor a member.
|
|
16
16
|
*/
|
|
17
|
-
import type { ErColumn, ErEntitySpec } from './er';
|
|
18
|
-
import type { UmlClassSpec } from './uml';
|
|
17
|
+
import type { ErColumn, ErEntitySpec } from './er.js';
|
|
18
|
+
import type { UmlClassSpec } from './uml.js';
|
|
19
19
|
/** Row height / header height of the entity card — sizing is derived from these. */
|
|
20
20
|
export declare const ER_ROW_H = 25;
|
|
21
21
|
export declare const ER_HEAD_H = 28;
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* row-selection handler and the binder's node/waypoint double-click never also
|
|
27
27
|
* fire for the same gesture.
|
|
28
28
|
*/
|
|
29
|
-
import { updateEntity, updateClass, addColumnAt, removeColumnAt, renameColumnAt } from './update';
|
|
29
|
+
import { updateEntity, updateClass, addColumnAt, removeColumnAt, renameColumnAt } from './update.js';
|
|
30
30
|
const bindings = new WeakMap();
|
|
31
31
|
const ROW_SELECTOR = '.axk-row, .axk-member';
|
|
32
32
|
/** Resolve the node id + the clicked row's global index (among selectable rows). */
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
* render(spec, container);
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
import { ensureDiagramKitStyles } from './styles';
|
|
24
|
-
import { bindRowInteractions } from './rows';
|
|
25
|
-
import { entityCardContent, entityAutoHeight, entityAutoWidth, erRowCenterY, ER_ROW_H, ER_HEAD_H, } from './card';
|
|
26
|
-
import { bindCardEditing } from './editing';
|
|
23
|
+
import { ensureDiagramKitStyles } from './styles.js';
|
|
24
|
+
import { bindRowInteractions } from './rows.js';
|
|
25
|
+
import { entityCardContent, entityAutoHeight, entityAutoWidth, erRowCenterY, ER_ROW_H, ER_HEAD_H, } from './card.js';
|
|
26
|
+
import { bindCardEditing } from './editing.js';
|
|
27
27
|
// Layout constants + the row-centre helper live in card.ts now (the ONE source
|
|
28
|
-
// of truth shared with update.ts). Re-exported here so `import … from './er'`
|
|
28
|
+
// of truth shared with update.ts). Re-exported here so `import … from './er.js'`
|
|
29
29
|
// keeps working.
|
|
30
30
|
export { erRowCenterY, ER_ROW_H, ER_HEAD_H };
|
|
31
31
|
const CARDINALITY = {
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
* where it is safe, never on the stored NodeModel (which the engine
|
|
21
21
|
* reconstructs from data on undo/paste/collab; see the decision doc).
|
|
22
22
|
*/
|
|
23
|
-
import type { ErColumn, ErEntitySpec } from './er';
|
|
24
|
-
import type { UmlClassSpec } from './uml';
|
|
25
|
-
import { updateEntity, updateClass } from './update';
|
|
26
|
-
import type { RowRef } from './rows';
|
|
23
|
+
import type { ErColumn, ErEntitySpec } from './er.js';
|
|
24
|
+
import type { UmlClassSpec } from './uml.js';
|
|
25
|
+
import { updateEntity, updateClass } from './update.js';
|
|
26
|
+
import type { RowRef } from './rows.js';
|
|
27
27
|
/** The slice of DiagramInstance the handles need (same shape update.ts uses). */
|
|
28
28
|
export interface HandleApi {
|
|
29
29
|
container: HTMLElement;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
|
-
import { updateEntity, updateClass } from './update';
|
|
2
|
+
import { updateEntity, updateClass } from './update.js';
|
|
3
3
|
const deep = (v) => JSON.parse(JSON.stringify(v));
|
|
4
4
|
// ---------------------------------------------------------------------------
|
|
5
5
|
// Base
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { erDiagram, erRowCenterY, ER_ROW_H, ER_HEAD_H, type ErColumn, type ErEntitySpec, type ErRelationshipSpec, type ErCardinality, type ErSide, type ErDiagramOptions, } from './er';
|
|
2
|
-
export { umlDiagram, type UmlClassSpec, type UmlRelationshipSpec, type UmlRelationKind, type UmlSide, type UmlDiagramOptions, } from './uml';
|
|
3
|
-
export { ensureDiagramKitStyles, DIAGRAM_KIT_STYLE_ID } from './styles';
|
|
4
|
-
export { bindRowInteractions, type RowRef, type RowInteractionsHandle } from './rows';
|
|
5
|
-
export { updateEntity, updateClass, addColumnAt, removeColumnAt, renameColumnAt, type ErEntityDelta, type UmlClassDelta, } from './update';
|
|
6
|
-
export { bindCardEditing, type CardEditingHandle } from './editing';
|
|
7
|
-
export { matchColumns, rowIndexFromY } from './card';
|
|
8
|
-
export { entityCardContent, entityAutoHeight, classCardContent, classAutoHeight } from './card';
|
|
9
|
-
export { scoreMatch, matchTier, assignTiers, singularize, bindJoinGuidance, ensureJoinGuidanceStyles, JOIN_GUIDANCE_STYLE_ID, type JoinColumn, type JoinEnd, type MatchTier, type JoinGuidanceApi, type JoinGuidanceOptions, type JoinGuidanceHandle, } from './join-guidance';
|
|
10
|
-
export { erTable, umlClass, erTables, umlClasses, CardHandle, ErTable, ErField, ErColumnList, UmlClass, UmlMemberList, type HandleApi, } from './handles';
|
|
1
|
+
export { erDiagram, erRowCenterY, ER_ROW_H, ER_HEAD_H, type ErColumn, type ErEntitySpec, type ErRelationshipSpec, type ErCardinality, type ErSide, type ErDiagramOptions, } from './er.js';
|
|
2
|
+
export { umlDiagram, type UmlClassSpec, type UmlRelationshipSpec, type UmlRelationKind, type UmlSide, type UmlDiagramOptions, } from './uml.js';
|
|
3
|
+
export { ensureDiagramKitStyles, DIAGRAM_KIT_STYLE_ID } from './styles.js';
|
|
4
|
+
export { bindRowInteractions, type RowRef, type RowInteractionsHandle } from './rows.js';
|
|
5
|
+
export { updateEntity, updateClass, addColumnAt, removeColumnAt, renameColumnAt, type ErEntityDelta, type UmlClassDelta, } from './update.js';
|
|
6
|
+
export { bindCardEditing, type CardEditingHandle } from './editing.js';
|
|
7
|
+
export { matchColumns, rowIndexFromY } from './card.js';
|
|
8
|
+
export { entityCardContent, entityAutoHeight, classCardContent, classAutoHeight } from './card.js';
|
|
9
|
+
export { scoreMatch, matchTier, assignTiers, singularize, bindJoinGuidance, ensureJoinGuidanceStyles, JOIN_GUIDANCE_STYLE_ID, type JoinColumn, type JoinEnd, type MatchTier, type JoinGuidanceApi, type JoinGuidanceOptions, type JoinGuidanceHandle, } from './join-guidance.js';
|
|
10
|
+
export { erTable, umlClass, erTables, umlClasses, CardHandle, ErTable, ErField, ErColumnList, UmlClass, UmlMemberList, type HandleApi, } from './handles.js';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export { erDiagram, erRowCenterY, ER_ROW_H, ER_HEAD_H, } from './er';
|
|
2
|
-
export { umlDiagram, } from './uml';
|
|
3
|
-
export { ensureDiagramKitStyles, DIAGRAM_KIT_STYLE_ID } from './styles';
|
|
4
|
-
export { bindRowInteractions } from './rows';
|
|
5
|
-
export { updateEntity, updateClass, addColumnAt, removeColumnAt, renameColumnAt, } from './update';
|
|
6
|
-
export { bindCardEditing } from './editing';
|
|
7
|
-
export { matchColumns, rowIndexFromY } from './card';
|
|
1
|
+
export { erDiagram, erRowCenterY, ER_ROW_H, ER_HEAD_H, } from './er.js';
|
|
2
|
+
export { umlDiagram, } from './uml.js';
|
|
3
|
+
export { ensureDiagramKitStyles, DIAGRAM_KIT_STYLE_ID } from './styles.js';
|
|
4
|
+
export { bindRowInteractions } from './rows.js';
|
|
5
|
+
export { updateEntity, updateClass, addColumnAt, removeColumnAt, renameColumnAt, } from './update.js';
|
|
6
|
+
export { bindCardEditing } from './editing.js';
|
|
7
|
+
export { matchColumns, rowIndexFromY } from './card.js';
|
|
8
8
|
// The card CONTENT builders — shared with the stencil palette so a dropped
|
|
9
9
|
// "Entity"/"Class" is the identical card erDiagram()/umlDiagram() produce.
|
|
10
|
-
export { entityCardContent, entityAutoHeight, classCardContent, classAutoHeight } from './card';
|
|
10
|
+
export { entityCardContent, entityAutoHeight, classCardContent, classAutoHeight } from './card.js';
|
|
11
11
|
// Live join guidance — score every other table's columns against a connection
|
|
12
12
|
// drag's source column and tint the kit rows by fit (the query-builder story).
|
|
13
|
-
export { scoreMatch, matchTier, assignTiers, singularize, bindJoinGuidance, ensureJoinGuidanceStyles, JOIN_GUIDANCE_STYLE_ID, } from './join-guidance';
|
|
14
|
-
export { erTable, umlClass, erTables, umlClasses, CardHandle, ErTable, ErField, ErColumnList, UmlClass, UmlMemberList, } from './handles';
|
|
13
|
+
export { scoreMatch, matchTier, assignTiers, singularize, bindJoinGuidance, ensureJoinGuidanceStyles, JOIN_GUIDANCE_STYLE_ID, } from './join-guidance.js';
|
|
14
|
+
export { erTable, umlClass, erTables, umlClasses, CardHandle, ErTable, ErField, ErColumnList, UmlClass, UmlMemberList, } from './handles.js';
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
* spec.finalize(api); // attaches multiplicity chips (needs the live model)
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
|
-
import { ensureDiagramKitStyles } from './styles';
|
|
26
|
-
import { bindRowInteractions } from './rows';
|
|
27
|
-
import { classCardContent, classAutoHeight, classAutoWidth } from './card';
|
|
28
|
-
import { bindCardEditing } from './editing';
|
|
25
|
+
import { ensureDiagramKitStyles } from './styles.js';
|
|
26
|
+
import { bindRowInteractions } from './rows.js';
|
|
27
|
+
import { classCardContent, classAutoHeight, classAutoWidth } from './card.js';
|
|
28
|
+
import { bindCardEditing } from './editing.js';
|
|
29
29
|
const STROKE = '#475569';
|
|
30
30
|
const DASH = '6,4';
|
|
31
31
|
/**
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* intended extension point — every basic command does it). When no engine is
|
|
28
28
|
* present the edit still applies, just non-undoably.
|
|
29
29
|
*/
|
|
30
|
-
import type { ErColumn } from './er';
|
|
30
|
+
import type { ErColumn } from './er.js';
|
|
31
31
|
/** What an ER table edit can change. Omitted fields are left as they were. */
|
|
32
32
|
export interface ErEntityDelta {
|
|
33
33
|
name?: string;
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
*/
|
|
30
30
|
import { __awaiter } from "tslib";
|
|
31
31
|
import { Command, PortModel, LinkModel } from '@grafloria/engine';
|
|
32
|
-
import { entityCardContent, entityAutoHeight, entityAutoWidth, classCardContent, classAutoHeight, classAutoWidth, erRowCenterY, rowIndexFromY, matchColumns, } from './card';
|
|
32
|
+
import { entityCardContent, entityAutoHeight, entityAutoWidth, classCardContent, classAutoHeight, classAutoWidth, erRowCenterY, rowIndexFromY, matchColumns, } from './card.js';
|
|
33
33
|
/**
|
|
34
34
|
* The single undoable edit. Captures the card's whole before-state on first
|
|
35
35
|
* execute and restores it on undo, so an edit — however many rows and edges it
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createDiagram, DARK_THEME, LIGHT_THEME } from '@grafloria/renderer';
|
|
2
|
-
import { getNodeType, renderFromTemplate } from './node-type-registry';
|
|
2
|
+
import { getNodeType, renderFromTemplate } from './node-type-registry.js';
|
|
3
3
|
/**
|
|
4
4
|
* `<grafloria-flow>` — the universal embed.
|
|
5
5
|
*
|
package/src/lib/grafloria.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { CreateDiagramOptions, DiagramInstance, EdgeSpec, NodeSpec, StaticRenderOptions, StaticRenderResult } from '@grafloria/renderer';
|
|
2
|
-
import { defineGrafloriaFlow } from './grafloria-flow-element';
|
|
3
|
-
import type { DashboardSpec } from './dashboard-kit';
|
|
4
|
-
import { registerNodeType, registeredNodeTypes } from './node-type-registry';
|
|
5
|
-
import type { NodeTypeRenderer } from './node-type-registry';
|
|
2
|
+
import { defineGrafloriaFlow } from './grafloria-flow-element.js';
|
|
3
|
+
import type { DashboardSpec } from './dashboard-kit/index.js';
|
|
4
|
+
import { registerNodeType, registeredNodeTypes } from './node-type-registry.js';
|
|
5
|
+
import type { NodeTypeRenderer } from './node-type-registry.js';
|
|
6
6
|
/**
|
|
7
7
|
* `Grafloria` — the Mermaid-shaped top-level API.
|
|
8
8
|
*
|
package/src/lib/grafloria.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createDiagram, renderToStaticSVG } from '@grafloria/renderer';
|
|
2
|
-
import { defineGrafloriaFlow } from './grafloria-flow-element';
|
|
3
|
-
import { registerNodeType, registeredNodeTypes, getNodeType } from './node-type-registry';
|
|
2
|
+
import { defineGrafloriaFlow } from './grafloria-flow-element.js';
|
|
3
|
+
import { registerNodeType, registeredNodeTypes, getNodeType } from './node-type-registry.js';
|
|
4
4
|
/**
|
|
5
5
|
* Mount `spec` into `target` and return the live instance.
|
|
6
6
|
*
|
package/src/lib/load.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DiagramDocumentEnvelope, DiagramModel, LinkModel, NodeModel, SerializedDiagramData } from '@grafloria/engine';
|
|
2
|
-
import { type DashboardGridHandle } from './dashboard-kit/grid-binder';
|
|
3
|
-
import { type WidgetRenderer } from './dashboard-kit/widgets';
|
|
4
|
-
import { type DashboardHandle } from './dashboard-kit/dashboard';
|
|
2
|
+
import { type DashboardGridHandle } from './dashboard-kit/grid-binder.js';
|
|
3
|
+
import { type WidgetRenderer } from './dashboard-kit/widgets.js';
|
|
4
|
+
import { type DashboardHandle } from './dashboard-kit/dashboard.js';
|
|
5
5
|
/** Anything `DiagramSerializer.deserialize()` accepts, or the JSON string of it. */
|
|
6
6
|
export type SavedDiagram = SerializedDiagramData | DiagramDocumentEnvelope | Record<string, unknown> | string;
|
|
7
7
|
export interface FromDocumentOptions {
|
package/src/lib/load.js
CHANGED
|
@@ -62,17 +62,17 @@
|
|
|
62
62
|
* itself wrote keeps the registry the general seam it is meant to be.
|
|
63
63
|
*/
|
|
64
64
|
import { DiagramSerializer } from '@grafloria/engine';
|
|
65
|
-
import { getNodeType } from './node-type-registry';
|
|
66
|
-
import { bindRowInteractions } from './diagram-kit/rows';
|
|
67
|
-
import { bindCardEditing } from './diagram-kit/editing';
|
|
68
|
-
import { ensureDiagramKitStyles } from './diagram-kit/styles';
|
|
69
|
-
import { bindDashboardGrid } from './dashboard-kit/grid-binder';
|
|
70
|
-
import { bindDashboardSplit, SPLIT_TREE_KEY } from './dashboard-kit/split-binder';
|
|
71
|
-
import { gridItemFromCell } from './dashboard-kit/grid-mapping';
|
|
72
|
-
import { cellFromGridItem } from './dashboard-kit/grid-mapping';
|
|
73
|
-
import { ensureDashboardKitStyles } from './dashboard-kit/styles';
|
|
74
|
-
import { defaultWidgetRenderer } from './dashboard-kit/widgets';
|
|
75
|
-
import { createDashboardHandle, } from './dashboard-kit/dashboard';
|
|
65
|
+
import { getNodeType } from './node-type-registry.js';
|
|
66
|
+
import { bindRowInteractions } from './diagram-kit/rows.js';
|
|
67
|
+
import { bindCardEditing } from './diagram-kit/editing.js';
|
|
68
|
+
import { ensureDiagramKitStyles } from './diagram-kit/styles.js';
|
|
69
|
+
import { bindDashboardGrid } from './dashboard-kit/grid-binder.js';
|
|
70
|
+
import { bindDashboardSplit, SPLIT_TREE_KEY } from './dashboard-kit/split-binder.js';
|
|
71
|
+
import { gridItemFromCell } from './dashboard-kit/grid-mapping.js';
|
|
72
|
+
import { cellFromGridItem } from './dashboard-kit/grid-mapping.js';
|
|
73
|
+
import { ensureDashboardKitStyles } from './dashboard-kit/styles.js';
|
|
74
|
+
import { defaultWidgetRenderer } from './dashboard-kit/widgets.js';
|
|
75
|
+
import { createDashboardHandle, } from './dashboard-kit/dashboard.js';
|
|
76
76
|
/** True when the node is an ER entity card or a UML class card. */
|
|
77
77
|
function isDiagramKitCard(node) {
|
|
78
78
|
return node.getMetadata('kitEntity') !== undefined || node.getMetadata('kitClass') !== undefined;
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* a canvas that was never built by a kit.
|
|
14
14
|
*/
|
|
15
15
|
import { NodeModel } from '@grafloria/engine';
|
|
16
|
-
import { entityCardContent, entityAutoHeight, classCardContent, classAutoHeight, bindRowInteractions, bindCardEditing, ensureDiagramKitStyles, } from '../diagram-kit';
|
|
17
|
-
import { registerStencilBuilder } from './builders';
|
|
16
|
+
import { entityCardContent, entityAutoHeight, classCardContent, classAutoHeight, bindRowInteractions, bindCardEditing, ensureDiagramKitStyles, } from '../diagram-kit/index.js';
|
|
17
|
+
import { registerStencilBuilder } from './builders.js';
|
|
18
18
|
/** Cards are transparent: the HTML body IS the card, the shape must not paint. */
|
|
19
19
|
const CARD_SHAPE = { type: 'rect', fill: 'none', stroke: 'none' };
|
|
20
20
|
const CARD_STYLE = { fill: 'transparent', stroke: 'transparent', strokeWidth: 0 };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { bindStencilPalette } from './palette';
|
|
2
|
-
export type { StencilPaletteApi, StencilPaletteOptions, StencilPaletteHandle, } from './palette';
|
|
3
|
-
export { bindShapeDataPanel } from './shape-data';
|
|
4
|
-
export type { ShapeDataPanelApi, ShapeDataPanelOptions, ShapeDataPanelHandle } from './shape-data';
|
|
5
|
-
export { ensureStencilKitStyles } from './styles';
|
|
6
|
-
export { registerStencilBuilder, getStencilBuilder, unregisterStencilBuilder, registeredStencilBuilders, } from './builders';
|
|
7
|
-
export type { StencilBuilder, StencilBuildContext } from './builders';
|
|
1
|
+
export { bindStencilPalette } from './palette.js';
|
|
2
|
+
export type { StencilPaletteApi, StencilPaletteOptions, StencilPaletteHandle, } from './palette.js';
|
|
3
|
+
export { bindShapeDataPanel } from './shape-data.js';
|
|
4
|
+
export type { ShapeDataPanelApi, ShapeDataPanelOptions, ShapeDataPanelHandle } from './shape-data.js';
|
|
5
|
+
export { ensureStencilKitStyles } from './styles.js';
|
|
6
|
+
export { registerStencilBuilder, getStencilBuilder, unregisterStencilBuilder, registeredStencilBuilders, } from './builders.js';
|
|
7
|
+
export type { StencilBuilder, StencilBuildContext } from './builders.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { bindStencilPalette } from './palette';
|
|
2
|
-
export { bindShapeDataPanel } from './shape-data';
|
|
3
|
-
export { ensureStencilKitStyles } from './styles';
|
|
4
|
-
export { registerStencilBuilder, getStencilBuilder, unregisterStencilBuilder, registeredStencilBuilders, } from './builders';
|
|
5
|
-
import { registerCardBuilders } from './card-builders';
|
|
1
|
+
export { bindStencilPalette } from './palette.js';
|
|
2
|
+
export { bindShapeDataPanel } from './shape-data.js';
|
|
3
|
+
export { ensureStencilKitStyles } from './styles.js';
|
|
4
|
+
export { registerStencilBuilder, getStencilBuilder, unregisterStencilBuilder, registeredStencilBuilders, } from './builders.js';
|
|
5
|
+
import { registerCardBuilders } from './card-builders.js';
|
|
6
6
|
// The ER/UML card builders ship registered — dropping "Entity" gives a real,
|
|
7
7
|
// editable table out of the box.
|
|
8
8
|
registerCardBuilders();
|
|
@@ -16,8 +16,8 @@ import { __awaiter } from "tslib";
|
|
|
16
16
|
*/
|
|
17
17
|
import { listStencils, NodeFactory, AddNodeCommand, BatchCommand, } from '@grafloria/engine';
|
|
18
18
|
import { getShape } from '@grafloria/renderer';
|
|
19
|
-
import { ensureStencilKitStyles } from './styles';
|
|
20
|
-
import { getStencilBuilder } from './builders';
|
|
19
|
+
import { ensureStencilKitStyles } from './styles.js';
|
|
20
|
+
import { getStencilBuilder } from './builders.js';
|
|
21
21
|
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
22
22
|
/** The MIME the palette drags with — namespaced so a page's other DnD is untouched. */
|
|
23
23
|
const DND_TYPE = 'application/x-grafloria-master';
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
* kit card's Name rows) is load-bearing for existing demos and gates.
|
|
28
28
|
*/
|
|
29
29
|
import { BatchCommand, MoveNodeCommand, ResizeNodeCommand, SetLinkDisplayLabelCommand, SetLinkPathTypeCommand, SetNodeDataCommand, SetNodeLabelCommand, SetNodeShapeConfigCommand, SetNodeStyleCommand, UpdateLinkStyleCommand, } from '@grafloria/engine';
|
|
30
|
-
import { erTable, umlClass } from '../diagram-kit';
|
|
31
|
-
import { ensureStencilKitStyles } from './styles';
|
|
30
|
+
import { erTable, umlClass } from '../diagram-kit/index.js';
|
|
31
|
+
import { ensureStencilKitStyles } from './styles.js';
|
|
32
32
|
/** The schema a node's shape data follows, via the master it was stamped from. */
|
|
33
33
|
function schemaFor(engine, node) {
|
|
34
34
|
var _a, _b, _c, _d;
|