@grafloria/element 0.3.23 → 0.4.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.
Files changed (69) hide show
  1. package/README.md +7 -7
  2. package/package.json +7 -9
  3. package/src/index.d.ts +16 -16
  4. package/src/index.js +58 -339
  5. package/src/lib/dashboard-kit/dashboard.d.ts +1 -1
  6. package/src/lib/dashboard-kit/dashboard.js +22 -26
  7. package/src/lib/dashboard-kit/grid-binder.d.ts +1 -1
  8. package/src/lib/dashboard-kit/grid-binder.js +62 -65
  9. package/src/lib/dashboard-kit/grid-mapping.js +14 -26
  10. package/src/lib/dashboard-kit/index.d.ts +5 -5
  11. package/src/lib/dashboard-kit/index.js +5 -30
  12. package/src/lib/dashboard-kit/styles.js +4 -8
  13. package/src/lib/dashboard-kit/widgets.d.ts +1 -1
  14. package/src/lib/dashboard-kit/widgets.js +16 -26
  15. package/src/lib/diagram-kit/card.d.ts +2 -2
  16. package/src/lib/diagram-kit/card.js +22 -32
  17. package/src/lib/diagram-kit/editing.js +15 -20
  18. package/src/lib/diagram-kit/er.d.ts +1 -1
  19. package/src/lib/diagram-kit/er.js +15 -18
  20. package/src/lib/diagram-kit/handles.d.ts +4 -4
  21. package/src/lib/diagram-kit/handles.js +16 -29
  22. package/src/lib/diagram-kit/index.d.ts +10 -10
  23. package/src/lib/diagram-kit/index.js +10 -50
  24. package/src/lib/diagram-kit/join-guidance.js +9 -18
  25. package/src/lib/diagram-kit/rows.js +1 -4
  26. package/src/lib/diagram-kit/styles.js +4 -8
  27. package/src/lib/diagram-kit/uml.js +10 -13
  28. package/src/lib/diagram-kit/update.d.ts +1 -1
  29. package/src/lib/diagram-kit/update.js +19 -26
  30. package/src/lib/grafloria-flow-element.js +19 -24
  31. package/src/lib/grafloria.d.ts +4 -4
  32. package/src/lib/grafloria.js +12 -17
  33. package/src/lib/load.d.ts +3 -3
  34. package/src/lib/load.js +19 -22
  35. package/src/lib/node-type-registry.js +6 -14
  36. package/src/lib/stencil-kit/builders.js +4 -10
  37. package/src/lib/stencil-kit/card-builders.js +14 -17
  38. package/src/lib/stencil-kit/index.d.ts +7 -7
  39. package/src/lib/stencil-kit/index.js +6 -16
  40. package/src/lib/stencil-kit/palette.js +14 -17
  41. package/src/lib/stencil-kit/shape-data.js +25 -28
  42. package/src/lib/stencil-kit/styles.js +1 -4
  43. package/esm/src/index.js +0 -295
  44. package/esm/src/lib/dashboard-kit/dashboard.js +0 -590
  45. package/esm/src/lib/dashboard-kit/grid-binder.js +0 -1633
  46. package/esm/src/lib/dashboard-kit/grid-mapping.js +0 -164
  47. package/esm/src/lib/dashboard-kit/index.js +0 -8
  48. package/esm/src/lib/dashboard-kit/styles.js +0 -205
  49. package/esm/src/lib/dashboard-kit/widgets.js +0 -379
  50. package/esm/src/lib/diagram-kit/card.js +0 -199
  51. package/esm/src/lib/diagram-kit/editing.js +0 -448
  52. package/esm/src/lib/diagram-kit/er.js +0 -160
  53. package/esm/src/lib/diagram-kit/handles.js +0 -312
  54. package/esm/src/lib/diagram-kit/index.js +0 -15
  55. package/esm/src/lib/diagram-kit/join-guidance.js +0 -322
  56. package/esm/src/lib/diagram-kit/rows.js +0 -144
  57. package/esm/src/lib/diagram-kit/styles.js +0 -118
  58. package/esm/src/lib/diagram-kit/uml.js +0 -135
  59. package/esm/src/lib/diagram-kit/update.js +0 -244
  60. package/esm/src/lib/grafloria-flow-element.js +0 -266
  61. package/esm/src/lib/grafloria.js +0 -69
  62. package/esm/src/lib/load.js +0 -252
  63. package/esm/src/lib/node-type-registry.js +0 -42
  64. package/esm/src/lib/stencil-kit/builders.js +0 -18
  65. package/esm/src/lib/stencil-kit/card-builders.js +0 -105
  66. package/esm/src/lib/stencil-kit/index.js +0 -9
  67. package/esm/src/lib/stencil-kit/palette.js +0 -427
  68. package/esm/src/lib/stencil-kit/shape-data.js +0 -537
  69. package/esm/src/lib/stencil-kit/styles.js +0 -126
@@ -1,7 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ER_HEAD_H = exports.ER_ROW_H = exports.erRowCenterY = void 0;
4
- exports.erDiagram = erDiagram;
5
1
  /**
6
2
  * ER diagram kit — typed builders for database entity-relationship diagrams.
7
3
  *
@@ -24,13 +20,14 @@ exports.erDiagram = erDiagram;
24
20
  * render(spec, container);
25
21
  * ```
26
22
  */
27
- const styles_1 = require("./styles");
28
- const rows_1 = require("./rows");
29
- const card_1 = require("./card");
30
- Object.defineProperty(exports, "erRowCenterY", { enumerable: true, get: function () { return card_1.erRowCenterY; } });
31
- Object.defineProperty(exports, "ER_ROW_H", { enumerable: true, get: function () { return card_1.ER_ROW_H; } });
32
- Object.defineProperty(exports, "ER_HEAD_H", { enumerable: true, get: function () { return card_1.ER_HEAD_H; } });
33
- const editing_1 = require("./editing");
23
+ import { ensureDiagramKitStyles } from './styles.js';
24
+ import { bindRowInteractions } from './rows.js';
25
+ import { entityCardContent, entityAutoHeight, erRowCenterY, ER_ROW_H, ER_HEAD_H } from './card.js';
26
+ import { bindCardEditing } from './editing.js';
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.js'`
29
+ // keeps working.
30
+ export { erRowCenterY, ER_ROW_H, ER_HEAD_H };
34
31
  const DEFAULT_WIDTH = 190;
35
32
  const CARDINALITY = {
36
33
  'one-to-many': { tail: 'one', head: 'crow-foot' },
@@ -62,9 +59,9 @@ function parseEnd(ref, byId) {
62
59
  * an absolute-layout port (the FK→PK look). Two edges landing on the same
63
60
  * column are automatically spread apart.
64
61
  */
65
- function erDiagram(options) {
62
+ export function erDiagram(options) {
66
63
  var _a;
67
- (0, styles_1.ensureDiagramKitStyles)();
64
+ ensureDiagramKitStyles();
68
65
  const byId = new Map(options.entities.map((e) => [e.id, e]));
69
66
  // Field-level ports are accumulated per entity while walking relationships.
70
67
  const portsByEntity = new Map();
@@ -91,7 +88,7 @@ function erDiagram(options) {
91
88
  args: {
92
89
  units: 'px',
93
90
  x: side === 'right' ? w : side === 'left' ? 0 : w / 2,
94
- y: (0, card_1.erRowCenterY)(end.rowIndex),
91
+ y: erRowCenterY(end.rowIndex),
95
92
  dy,
96
93
  },
97
94
  },
@@ -129,10 +126,10 @@ function erDiagram(options) {
129
126
  const editable = options.editable === true;
130
127
  const nodes = options.entities.map((entity, i) => {
131
128
  var _a;
132
- return (Object.assign({ id: entity.id, position: (_a = entity.position) !== null && _a !== void 0 ? _a : { x: 60 + (i % 3) * 340, y: 60 + Math.floor(i / 3) * 280 }, size: { width: width(entity), height: (0, card_1.entityAutoHeight)(entity, editable) },
129
+ return (Object.assign({ id: entity.id, position: (_a = entity.position) !== null && _a !== void 0 ? _a : { x: 60 + (i % 3) * 340, y: 60 + Math.floor(i / 3) * 280 }, size: { width: width(entity), height: entityAutoHeight(entity, editable) },
133
130
  // interactive: rows are real DOM targets (hover, row selection, inline
134
131
  // editing) — node drag/select stay geometric in the binder.
135
- metadata: Object.assign({ html: { content: (0, card_1.entityCardContent)(entity, editable), interactive: true }, kitEntity: entity, kitEditable: editable }, (options.rowSelection === false ? { kitRowSelection: false } : {})),
132
+ metadata: Object.assign({ html: { content: entityCardContent(entity, editable), interactive: true }, kitEntity: entity, kitEditable: editable }, (options.rowSelection === false ? { kitRowSelection: false } : {})),
136
133
  // The card draws its own border — the node's default rectangle is hidden
137
134
  // (and re-suppressed on selection by the kit stylesheet).
138
135
  shape: { type: 'rect', fill: 'none', stroke: 'none' }, style: { fill: 'transparent', stroke: 'transparent', strokeWidth: 0 } }, (portsByEntity.has(entity.id) ? { ports: portsByEntity.get(entity.id) } : {})));
@@ -151,12 +148,12 @@ function erDiagram(options) {
151
148
  for (const e of options.entities)
152
149
  (_d = (_c = (_b = model.getNode) === null || _b === void 0 ? void 0 : _b.call(model, e.id)) === null || _c === void 0 ? void 0 : _c.setBehavior) === null || _d === void 0 ? void 0 : _d.call(_c, { resizable: false });
153
150
  if (options.rowSelection !== false && (a === null || a === void 0 ? void 0 : a.container))
154
- (0, rows_1.bindRowInteractions)(a);
151
+ bindRowInteractions(a);
155
152
  // Editing chrome (dbl-click rename, add/delete column) — opt-in, and safe
156
153
  // to run alongside row selection (it claims control clicks in the capture
157
154
  // phase before the selection handler sees them).
158
155
  if (editable && (a === null || a === void 0 ? void 0 : a.container))
159
- (0, editing_1.bindCardEditing)(a);
156
+ bindCardEditing(a);
160
157
  },
161
158
  };
162
159
  }
@@ -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,17 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UmlClass = exports.UmlMemberList = exports.ErTable = exports.ErColumnList = exports.ErField = exports.CardHandle = void 0;
4
- exports.erTable = erTable;
5
- exports.umlClass = umlClass;
6
- exports.erTables = erTables;
7
- exports.umlClasses = umlClasses;
8
- const tslib_1 = require("tslib");
9
- const update_1 = require("./update");
1
+ import { __awaiter } from "tslib";
2
+ import { updateEntity, updateClass } from './update.js';
10
3
  const deep = (v) => JSON.parse(JSON.stringify(v));
11
4
  // ---------------------------------------------------------------------------
12
5
  // Base
13
6
  // ---------------------------------------------------------------------------
14
- class CardHandle {
7
+ export class CardHandle {
15
8
  constructor(api, id) {
16
9
  this.api = api;
17
10
  this.id = id;
@@ -44,14 +37,14 @@ class CardHandle {
44
37
  (_c = (_b = this.api).renderNow) === null || _c === void 0 ? void 0 : _c.call(_b);
45
38
  }
46
39
  undo() {
47
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
40
+ return __awaiter(this, void 0, void 0, function* () {
48
41
  var _a, _b, _c, _d, _e;
49
42
  yield ((_c = (_b = (_a = this.api).getEngine) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c.undo());
50
43
  (_e = (_d = this.api).renderNow) === null || _e === void 0 ? void 0 : _e.call(_d);
51
44
  });
52
45
  }
53
46
  redo() {
54
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
47
+ return __awaiter(this, void 0, void 0, function* () {
55
48
  var _a, _b, _c, _d, _e;
56
49
  yield ((_c = (_b = (_a = this.api).getEngine) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c.redo());
57
50
  (_e = (_d = this.api).renderNow) === null || _e === void 0 ? void 0 : _e.call(_d);
@@ -81,12 +74,11 @@ class CardHandle {
81
74
  return () => this.api.container.removeEventListener('axk:row-select', handler);
82
75
  }
83
76
  }
84
- exports.CardHandle = CardHandle;
85
77
  // ---------------------------------------------------------------------------
86
78
  // ER
87
79
  // ---------------------------------------------------------------------------
88
80
  /** A column of an {@link ErTable} — itself just (table, name): stateless. */
89
- class ErField {
81
+ export class ErField {
90
82
  constructor(table, columnName) {
91
83
  this.table = table;
92
84
  this.columnName = columnName;
@@ -130,9 +122,8 @@ class ErField {
130
122
  return this.table.columns.removeAt(this.index);
131
123
  }
132
124
  }
133
- exports.ErField = ErField;
134
125
  /** The columns collection of an {@link ErTable}. Iterable of {@link ErField}. */
135
- class ErColumnList {
126
+ export class ErColumnList {
136
127
  constructor(table) {
137
128
  this.table = table;
138
129
  }
@@ -180,8 +171,7 @@ class ErColumnList {
180
171
  return this.table.update({ columns: next });
181
172
  }
182
173
  }
183
- exports.ErColumnList = ErColumnList;
184
- class ErTable extends CardHandle {
174
+ export class ErTable extends CardHandle {
185
175
  constructor() {
186
176
  super(...arguments);
187
177
  this.columns = new ErColumnList(this);
@@ -206,15 +196,14 @@ class ErTable extends CardHandle {
206
196
  }
207
197
  /** The raw delta path — everything above funnels through here. */
208
198
  update(delta) {
209
- return (0, update_1.updateEntity)(this.api, this.id, delta);
199
+ return updateEntity(this.api, this.id, delta);
210
200
  }
211
201
  }
212
- exports.ErTable = ErTable;
213
202
  // ---------------------------------------------------------------------------
214
203
  // UML
215
204
  // ---------------------------------------------------------------------------
216
205
  /** attributes / methods of a {@link UmlClass} (members are plain strings). */
217
- class UmlMemberList {
206
+ export class UmlMemberList {
218
207
  constructor(cls, kind) {
219
208
  this.cls = cls;
220
209
  this.kind = kind;
@@ -242,8 +231,7 @@ class UmlMemberList {
242
231
  return this.cls.update({ [this.kind]: this.list().map((m, i) => (i === index ? member : m)) });
243
232
  }
244
233
  }
245
- exports.UmlMemberList = UmlMemberList;
246
- class UmlClass extends CardHandle {
234
+ export class UmlClass extends CardHandle {
247
235
  constructor() {
248
236
  super(...arguments);
249
237
  this.attributes = new UmlMemberList(this, 'attributes');
@@ -280,10 +268,9 @@ class UmlClass extends CardHandle {
280
268
  return this.update({ stereotype });
281
269
  }
282
270
  update(delta) {
283
- return (0, update_1.updateClass)(this.api, this.id, delta);
271
+ return updateClass(this.api, this.id, delta);
284
272
  }
285
273
  }
286
- exports.UmlClass = UmlClass;
287
274
  // ---------------------------------------------------------------------------
288
275
  // Factories
289
276
  // ---------------------------------------------------------------------------
@@ -297,17 +284,17 @@ function requireKit(api, id, key, what) {
297
284
  }
298
285
  }
299
286
  /** Typed handle for a kit ER table. Throws for unknown ids / non-kit nodes. */
300
- function erTable(api, id) {
287
+ export function erTable(api, id) {
301
288
  requireKit(api, id, 'kitEntity', 'erTable');
302
289
  return new ErTable(api, id);
303
290
  }
304
291
  /** Typed handle for a kit UML class. Throws for unknown ids / non-kit nodes. */
305
- function umlClass(api, id) {
292
+ export function umlClass(api, id) {
306
293
  requireKit(api, id, 'kitClass', 'umlClass');
307
294
  return new UmlClass(api, id);
308
295
  }
309
296
  /** Every kit ER table in the diagram, as handles. */
310
- function erTables(api) {
297
+ export function erTables(api) {
311
298
  var _a, _b;
312
299
  const model = api.getModel();
313
300
  return ((_b = (_a = model.getNodes) === null || _a === void 0 ? void 0 : _a.call(model)) !== null && _b !== void 0 ? _b : [])
@@ -315,7 +302,7 @@ function erTables(api) {
315
302
  .map((n) => new ErTable(api, n.id));
316
303
  }
317
304
  /** Every kit UML class in the diagram, as handles. */
318
- function umlClasses(api) {
305
+ export function umlClasses(api) {
319
306
  var _a, _b;
320
307
  const model = api.getModel();
321
308
  return ((_b = (_a = model.getNodes) === null || _a === void 0 ? void 0 : _a.call(model)) !== null && _b !== void 0 ? _b : [])
@@ -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,55 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UmlMemberList = exports.UmlClass = exports.ErColumnList = exports.ErField = exports.ErTable = exports.CardHandle = exports.umlClasses = exports.erTables = exports.umlClass = exports.erTable = exports.JOIN_GUIDANCE_STYLE_ID = exports.ensureJoinGuidanceStyles = exports.bindJoinGuidance = exports.singularize = exports.assignTiers = exports.matchTier = exports.scoreMatch = exports.classAutoHeight = exports.classCardContent = exports.entityAutoHeight = exports.entityCardContent = exports.rowIndexFromY = exports.matchColumns = exports.bindCardEditing = exports.renameColumnAt = exports.removeColumnAt = exports.addColumnAt = exports.updateClass = exports.updateEntity = exports.bindRowInteractions = exports.DIAGRAM_KIT_STYLE_ID = exports.ensureDiagramKitStyles = exports.umlDiagram = exports.ER_HEAD_H = exports.ER_ROW_H = exports.erRowCenterY = exports.erDiagram = void 0;
4
- var er_1 = require("./er");
5
- Object.defineProperty(exports, "erDiagram", { enumerable: true, get: function () { return er_1.erDiagram; } });
6
- Object.defineProperty(exports, "erRowCenterY", { enumerable: true, get: function () { return er_1.erRowCenterY; } });
7
- Object.defineProperty(exports, "ER_ROW_H", { enumerable: true, get: function () { return er_1.ER_ROW_H; } });
8
- Object.defineProperty(exports, "ER_HEAD_H", { enumerable: true, get: function () { return er_1.ER_HEAD_H; } });
9
- var uml_1 = require("./uml");
10
- Object.defineProperty(exports, "umlDiagram", { enumerable: true, get: function () { return uml_1.umlDiagram; } });
11
- var styles_1 = require("./styles");
12
- Object.defineProperty(exports, "ensureDiagramKitStyles", { enumerable: true, get: function () { return styles_1.ensureDiagramKitStyles; } });
13
- Object.defineProperty(exports, "DIAGRAM_KIT_STYLE_ID", { enumerable: true, get: function () { return styles_1.DIAGRAM_KIT_STYLE_ID; } });
14
- var rows_1 = require("./rows");
15
- Object.defineProperty(exports, "bindRowInteractions", { enumerable: true, get: function () { return rows_1.bindRowInteractions; } });
16
- var update_1 = require("./update");
17
- Object.defineProperty(exports, "updateEntity", { enumerable: true, get: function () { return update_1.updateEntity; } });
18
- Object.defineProperty(exports, "updateClass", { enumerable: true, get: function () { return update_1.updateClass; } });
19
- Object.defineProperty(exports, "addColumnAt", { enumerable: true, get: function () { return update_1.addColumnAt; } });
20
- Object.defineProperty(exports, "removeColumnAt", { enumerable: true, get: function () { return update_1.removeColumnAt; } });
21
- Object.defineProperty(exports, "renameColumnAt", { enumerable: true, get: function () { return update_1.renameColumnAt; } });
22
- var editing_1 = require("./editing");
23
- Object.defineProperty(exports, "bindCardEditing", { enumerable: true, get: function () { return editing_1.bindCardEditing; } });
24
- var card_1 = require("./card");
25
- Object.defineProperty(exports, "matchColumns", { enumerable: true, get: function () { return card_1.matchColumns; } });
26
- Object.defineProperty(exports, "rowIndexFromY", { enumerable: true, get: function () { return card_1.rowIndexFromY; } });
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';
27
8
  // The card CONTENT builders — shared with the stencil palette so a dropped
28
9
  // "Entity"/"Class" is the identical card erDiagram()/umlDiagram() produce.
29
- var card_2 = require("./card");
30
- Object.defineProperty(exports, "entityCardContent", { enumerable: true, get: function () { return card_2.entityCardContent; } });
31
- Object.defineProperty(exports, "entityAutoHeight", { enumerable: true, get: function () { return card_2.entityAutoHeight; } });
32
- Object.defineProperty(exports, "classCardContent", { enumerable: true, get: function () { return card_2.classCardContent; } });
33
- Object.defineProperty(exports, "classAutoHeight", { enumerable: true, get: function () { return card_2.classAutoHeight; } });
10
+ export { entityCardContent, entityAutoHeight, classCardContent, classAutoHeight } from './card.js';
34
11
  // Live join guidance — score every other table's columns against a connection
35
12
  // drag's source column and tint the kit rows by fit (the query-builder story).
36
- var join_guidance_1 = require("./join-guidance");
37
- Object.defineProperty(exports, "scoreMatch", { enumerable: true, get: function () { return join_guidance_1.scoreMatch; } });
38
- Object.defineProperty(exports, "matchTier", { enumerable: true, get: function () { return join_guidance_1.matchTier; } });
39
- Object.defineProperty(exports, "assignTiers", { enumerable: true, get: function () { return join_guidance_1.assignTiers; } });
40
- Object.defineProperty(exports, "singularize", { enumerable: true, get: function () { return join_guidance_1.singularize; } });
41
- Object.defineProperty(exports, "bindJoinGuidance", { enumerable: true, get: function () { return join_guidance_1.bindJoinGuidance; } });
42
- Object.defineProperty(exports, "ensureJoinGuidanceStyles", { enumerable: true, get: function () { return join_guidance_1.ensureJoinGuidanceStyles; } });
43
- Object.defineProperty(exports, "JOIN_GUIDANCE_STYLE_ID", { enumerable: true, get: function () { return join_guidance_1.JOIN_GUIDANCE_STYLE_ID; } });
44
- var handles_1 = require("./handles");
45
- Object.defineProperty(exports, "erTable", { enumerable: true, get: function () { return handles_1.erTable; } });
46
- Object.defineProperty(exports, "umlClass", { enumerable: true, get: function () { return handles_1.umlClass; } });
47
- Object.defineProperty(exports, "erTables", { enumerable: true, get: function () { return handles_1.erTables; } });
48
- Object.defineProperty(exports, "umlClasses", { enumerable: true, get: function () { return handles_1.umlClasses; } });
49
- Object.defineProperty(exports, "CardHandle", { enumerable: true, get: function () { return handles_1.CardHandle; } });
50
- Object.defineProperty(exports, "ErTable", { enumerable: true, get: function () { return handles_1.ErTable; } });
51
- Object.defineProperty(exports, "ErField", { enumerable: true, get: function () { return handles_1.ErField; } });
52
- Object.defineProperty(exports, "ErColumnList", { enumerable: true, get: function () { return handles_1.ErColumnList; } });
53
- Object.defineProperty(exports, "UmlClass", { enumerable: true, get: function () { return handles_1.UmlClass; } });
54
- Object.defineProperty(exports, "UmlMemberList", { enumerable: true, get: function () { return handles_1.UmlMemberList; } });
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';
55
15
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /**
3
2
  * Join guidance — live "which column should I join to?" scoring + tinting for
4
3
  * kit table cards, the feature a visual query builder is actually about.
@@ -33,16 +32,8 @@
33
32
  * ARE re-patched every frame, so a class added to the SVG element would be
34
33
  * wiped mid-drag, while a stylesheet wins the cascade and survives.
35
34
  */
36
- Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.JOIN_GUIDANCE_STYLE_ID = void 0;
38
- exports.singularize = singularize;
39
- exports.scoreMatch = scoreMatch;
40
- exports.matchTier = matchTier;
41
- exports.assignTiers = assignTiers;
42
- exports.ensureJoinGuidanceStyles = ensureJoinGuidanceStyles;
43
- exports.bindJoinGuidance = bindJoinGuidance;
44
35
  /** Naive English singular — enough for schema names (orders, categories, statuses). */
45
- function singularize(word) {
36
+ export function singularize(word) {
46
37
  const w = word.toLowerCase();
47
38
  if (w.endsWith('ies') && w.length > 3)
48
39
  return w.slice(0, -3) + 'y';
@@ -61,7 +52,7 @@ function conventionMatch(a, b) {
61
52
  * Score a candidate join between two columns. Pure; the exact production
62
53
  * logic. Higher is better; 0 means "no reason to join these".
63
54
  */
64
- function scoreMatch(a, b) {
55
+ export function scoreMatch(a, b) {
65
56
  if (!a || !b || a.table === b.table)
66
57
  return 0;
67
58
  const an = a.column.name.toLowerCase();
@@ -82,7 +73,7 @@ function scoreMatch(a, b) {
82
73
  return 0;
83
74
  }
84
75
  /** Per-score tier (rank-free half; `assignTiers` promotes the single best to `top`). */
85
- function matchTier(score) {
76
+ export function matchTier(score) {
86
77
  if (score >= 2)
87
78
  return 'good';
88
79
  if (score >= 1)
@@ -93,7 +84,7 @@ function matchTier(score) {
93
84
  * Tier every candidate score at once: the FIRST candidate holding the maximum
94
85
  * score is `top` when that maximum is >= 2 — exactly one gold row per drag.
95
86
  */
96
- function assignTiers(scores) {
87
+ export function assignTiers(scores) {
97
88
  const max = scores.reduce((m, s) => (s > m ? s : m), 0);
98
89
  let topIndex = -1;
99
90
  if (max >= 2)
@@ -111,7 +102,7 @@ const TIER_CLASS = {
111
102
  };
112
103
  const CHIP_CLASS = 'axk-match-chip';
113
104
  const PORT_STYLE_ID = 'grafloria-join-guidance-ports';
114
- exports.JOIN_GUIDANCE_STYLE_ID = 'grafloria-join-guidance-styles';
105
+ export const JOIN_GUIDANCE_STYLE_ID = 'grafloria-join-guidance-styles';
115
106
  /** The tier tints — the production palette, verbatim. */
116
107
  const GUIDANCE_CSS = `
117
108
  .axk-row.axk-match-top { background: #fffbeb;
@@ -126,13 +117,13 @@ const GUIDANCE_CSS = `
126
117
  margin-left: 4px; flex: 0 0 auto; letter-spacing: .3px; }
127
118
  `;
128
119
  /** Inject the guidance tint stylesheet once. Safe to call repeatedly / in SSR. */
129
- function ensureJoinGuidanceStyles(doc = typeof document !== 'undefined' ? document : undefined) {
120
+ export function ensureJoinGuidanceStyles(doc = typeof document !== 'undefined' ? document : undefined) {
130
121
  if (!doc)
131
122
  return;
132
- if (doc.getElementById(exports.JOIN_GUIDANCE_STYLE_ID))
123
+ if (doc.getElementById(JOIN_GUIDANCE_STYLE_ID))
133
124
  return;
134
125
  const style = doc.createElement('style');
135
- style.id = exports.JOIN_GUIDANCE_STYLE_ID;
126
+ style.id = JOIN_GUIDANCE_STYLE_ID;
136
127
  style.textContent = GUIDANCE_CSS;
137
128
  doc.head.appendChild(style);
138
129
  }
@@ -157,7 +148,7 @@ function defaultPortCss(tier, selector) {
157
148
  * the matching port glyphs glow via a generated stylesheet. Everything clears
158
149
  * when the drag ends, however it ends.
159
150
  */
160
- function bindJoinGuidance(api, options = {}) {
151
+ export function bindJoinGuidance(api, options = {}) {
161
152
  var _a, _b, _c, _d, _e;
162
153
  ensureJoinGuidanceStyles(api.container.ownerDocument);
163
154
  const chipText = (_a = options.chipText) !== null && _a !== void 0 ? _a : '★ BEST';
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /**
3
2
  * Row interactions — "select a column / field" on kit cards (P1 of the
4
3
  * ER/UML editing track).
@@ -24,8 +23,6 @@
24
23
  * kit stored in node metadata (`kitEntity` / `kitClass`), falling back to the
25
24
  * row's text.
26
25
  */
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.bindRowInteractions = bindRowInteractions;
29
26
  const ROW_SELECTOR = '.axk-row, .axk-member';
30
27
  const SELECTED_CLASS = 'axk-row-selected';
31
28
  /** One binding per container — rebinding disposes the previous one. */
@@ -65,7 +62,7 @@ function countFirstCompartment(rowEl) {
65
62
  const firstComp = card === null || card === void 0 ? void 0 : card.querySelector('.axk-uml-comp');
66
63
  return firstComp ? firstComp.querySelectorAll('.axk-member').length : Number.MAX_SAFE_INTEGER;
67
64
  }
68
- function bindRowInteractions(api) {
65
+ export function bindRowInteractions(api) {
69
66
  var _a;
70
67
  const container = api.container;
71
68
  (_a = bindings.get(container)) === null || _a === void 0 ? void 0 : _a.dispose();
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /**
3
2
  * Diagram-kit stylesheet — injected once, on first use of any kit builder.
4
3
  *
@@ -14,10 +13,7 @@
14
13
  * OUTSIDE the node) reads as a second floating box around a bordered card —
15
14
  * the kit hides it and rings the card itself instead.
16
15
  */
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.DIAGRAM_KIT_STYLE_ID = void 0;
19
- exports.ensureDiagramKitStyles = ensureDiagramKitStyles;
20
- exports.DIAGRAM_KIT_STYLE_ID = 'grafloria-diagram-kit-styles';
16
+ export const DIAGRAM_KIT_STYLE_ID = 'grafloria-diagram-kit-styles';
21
17
  const CSS = `
22
18
  /* ===== ER entity (table) cards ===== */
23
19
  .axk-entity { font: 12px/1.5 system-ui, sans-serif; border: 1px solid #64748b;
@@ -109,13 +105,13 @@ g.node-group[data-selected="true"]:has(.axk-uml) rect.diagram-node {
109
105
  }
110
106
  `;
111
107
  /** Inject the kit stylesheet once. Safe to call repeatedly and in SSR. */
112
- function ensureDiagramKitStyles(doc = typeof document !== 'undefined' ? document : undefined) {
108
+ export function ensureDiagramKitStyles(doc = typeof document !== 'undefined' ? document : undefined) {
113
109
  if (!doc)
114
110
  return;
115
- if (doc.getElementById(exports.DIAGRAM_KIT_STYLE_ID))
111
+ if (doc.getElementById(DIAGRAM_KIT_STYLE_ID))
116
112
  return;
117
113
  const style = doc.createElement('style');
118
- style.id = exports.DIAGRAM_KIT_STYLE_ID;
114
+ style.id = DIAGRAM_KIT_STYLE_ID;
119
115
  style.textContent = CSS;
120
116
  doc.head.appendChild(style);
121
117
  }
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.umlDiagram = umlDiagram;
4
1
  /**
5
2
  * UML class-diagram kit — typed builders for the full relationship vocabulary.
6
3
  *
@@ -25,10 +22,10 @@ exports.umlDiagram = umlDiagram;
25
22
  * spec.finalize(api); // attaches multiplicity chips (needs the live model)
26
23
  * ```
27
24
  */
28
- const styles_1 = require("./styles");
29
- const rows_1 = require("./rows");
30
- const card_1 = require("./card");
31
- const editing_1 = require("./editing");
25
+ import { ensureDiagramKitStyles } from './styles.js';
26
+ import { bindRowInteractions } from './rows.js';
27
+ import { classCardContent, classAutoHeight } from './card.js';
28
+ import { bindCardEditing } from './editing.js';
32
29
  const DEFAULT_WIDTH = 200;
33
30
  const STROKE = '#475569';
34
31
  const DASH = '6,4';
@@ -68,19 +65,19 @@ const chip = (text, slot) => ({
68
65
  * after render() — multiplicity chips are positioned labels, which only the
69
66
  * live model's `link.addLabel` can express.
70
67
  */
71
- function umlDiagram(options) {
68
+ export function umlDiagram(options) {
72
69
  var _a;
73
- (0, styles_1.ensureDiagramKitStyles)();
70
+ ensureDiagramKitStyles();
74
71
  const editable = options.editable === true;
75
72
  const nodes = options.classes.map((cls, i) => {
76
73
  var _a, _b;
77
74
  return {
78
75
  id: cls.id,
79
76
  position: (_a = cls.position) !== null && _a !== void 0 ? _a : { x: 80 + (i % 3) * 320, y: 60 + Math.floor(i / 3) * 260 },
80
- size: { width: (_b = cls.width) !== null && _b !== void 0 ? _b : DEFAULT_WIDTH, height: (0, card_1.classAutoHeight)(cls, editable) },
77
+ size: { width: (_b = cls.width) !== null && _b !== void 0 ? _b : DEFAULT_WIDTH, height: classAutoHeight(cls, editable) },
81
78
  // interactive: members are real DOM targets (hover, row selection, inline
82
79
  // editing); node drag/select stay geometric in the binder.
83
- metadata: Object.assign({ html: { content: (0, card_1.classCardContent)(cls, editable), interactive: true }, kitClass: cls, kitEditable: editable }, (options.rowSelection === false ? { kitRowSelection: false } : {})),
80
+ metadata: Object.assign({ html: { content: classCardContent(cls, editable), interactive: true }, kitClass: cls, kitEditable: editable }, (options.rowSelection === false ? { kitRowSelection: false } : {})),
84
81
  shape: { type: 'rect', fill: 'none', stroke: 'none' },
85
82
  style: { fill: 'transparent', stroke: 'transparent', strokeWidth: 0 },
86
83
  };
@@ -107,10 +104,10 @@ function umlDiagram(options) {
107
104
  // bindRowInteractions disposes any prior binding for the container, so it
108
105
  // is safe to run twice.
109
106
  if (a === null || a === void 0 ? void 0 : a.container)
110
- (0, rows_1.bindRowInteractions)(a);
107
+ bindRowInteractions(a);
111
108
  }
112
109
  if (editable && (a0 === null || a0 === void 0 ? void 0 : a0.container))
113
- (0, editing_1.bindCardEditing)(a0);
110
+ bindCardEditing(a0);
114
111
  if (api && typeof api === 'object') {
115
112
  if (finalized.has(api))
116
113
  return;
@@ -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;