@septkit/ui 0.0.59 → 0.0.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,56 @@
1
+ //#region lib/diagram-layout/visibility-model.ts
2
+ function e(e, t = (e) => !e.parent?.id) {
3
+ let n = {}, r = [], i = [];
4
+ for (let t of e) n[t.id] = {
5
+ record: t,
6
+ childrenCache: [],
7
+ visibleChildIds: /* @__PURE__ */ new Set()
8
+ };
9
+ for (let e of Object.values(n)) {
10
+ if (t(e.record)) {
11
+ r.push(e.record.id);
12
+ continue;
13
+ }
14
+ let a = e.record.parent?.id, o = a ? n[a] : void 0;
15
+ if (!o) {
16
+ i.push(e.record.id), r.push(e.record.id);
17
+ continue;
18
+ }
19
+ o.childrenCache.push(e);
20
+ }
21
+ return {
22
+ recordMap: n,
23
+ rootIds: r,
24
+ orphanIds: i
25
+ };
26
+ }
27
+ function t(e, t, n) {
28
+ let { expandedNodeIds: r, collapsedNodeIds: i, defaultOpenDepth: a } = n, o = t.map((e) => ({
29
+ id: e,
30
+ depth: 0
31
+ }));
32
+ for (; o.length;) {
33
+ let t = o.shift(), n = e[t.id];
34
+ if (!n) continue;
35
+ let s = r.has(t.id), c = i.has(t.id), l = t.depth < a;
36
+ if (!c && (s || l)) for (let e of n.childrenCache) n.visibleChildIds.add(e.record.id), o.push({
37
+ id: e.record.id,
38
+ depth: t.depth + 1
39
+ });
40
+ }
41
+ }
42
+ function n(e, t) {
43
+ let n = [], r = [...e];
44
+ for (; r.length;) {
45
+ let e = r.shift();
46
+ n.push(e);
47
+ let i = t[e];
48
+ if (i) for (let e of i.visibleChildIds) r.push(e);
49
+ }
50
+ return n;
51
+ }
52
+ function r(e) {
53
+ for (let t of e.childrenCache) e.visibleChildIds.delete(t.record.id), r(t);
54
+ }
55
+ //#endregion
56
+ export { t as applyInitialVisibility, e as buildRecordCache, n as collectVisibleIds, r as hideDescendants };
@@ -0,0 +1,20 @@
1
+ import e from "../createLucideIcon.js";
2
+ //#region node_modules/.pnpm/@lucide+vue@1.23.0_vue@3.5.39_typescript@5.8.3_/node_modules/@lucide/vue/dist/esm/icons/info.mjs
3
+ var t = [
4
+ ["circle", {
5
+ cx: "12",
6
+ cy: "12",
7
+ r: "10",
8
+ key: "1mglay"
9
+ }],
10
+ ["path", {
11
+ d: "M12 16v-4",
12
+ key: "1dtifu"
13
+ }],
14
+ ["path", {
15
+ d: "M12 8h.01",
16
+ key: "e9boi3"
17
+ }]
18
+ ], n = e("info", t);
19
+ //#endregion
20
+ export { t as __iconNode, n as default };
package/dist/index.d.ts CHANGED
@@ -92,6 +92,26 @@ maxSize: number;
92
92
  minSize: number;
93
93
  }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
94
94
 
95
+ declare const __VLS_component_7: DefineComponent<__VLS_Props_19, {
96
+ focus: () => void | undefined;
97
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
98
+ toggle: (groupId: string) => any;
99
+ keydown: (event: KeyboardEvent) => any;
100
+ }, string, PublicProps, Readonly<__VLS_Props_19> & Readonly<{
101
+ onToggle?: ((groupId: string) => any) | undefined;
102
+ onKeydown?: ((event: KeyboardEvent) => any) | undefined;
103
+ }>, {
104
+ expanded: boolean;
105
+ testId: string;
106
+ tabbable: boolean;
107
+ treeMeta: TreeItemMeta;
108
+ members: GroupMember[];
109
+ expandable: boolean;
110
+ toggleTestId: string;
111
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {
112
+ headerEl: HTMLDivElement;
113
+ }, HTMLDivElement>;
114
+
95
115
  declare type __VLS_Props = {
96
116
  color?: 'neutral' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error';
97
117
  variant?: 'outline' | 'dash' | 'soft' | 'ghost' | 'link';
@@ -165,6 +185,41 @@ declare type __VLS_Props_17 = {
165
185
  maxSize?: number;
166
186
  };
167
187
 
188
+ declare type __VLS_Props_18 = {
189
+ nodeId: string;
190
+ tagName: string;
191
+ label: string;
192
+ hasChildren: boolean;
193
+ isExpanded: boolean;
194
+ width: number;
195
+ height?: number;
196
+ compact?: boolean;
197
+ selected?: boolean;
198
+ childCounts?: NodeChildCount[];
199
+ testId?: string;
200
+ detailsTestId?: string;
201
+ tabbable?: boolean;
202
+ treeMeta?: TreeItemMeta;
203
+ };
204
+
205
+ declare type __VLS_Props_19 = {
206
+ groupId: string;
207
+ tagName: string;
208
+ label: string;
209
+ count: number;
210
+ width: number;
211
+ collapsedMembersHeight: number;
212
+ members?: GroupMember[];
213
+ expanded?: boolean;
214
+ expandable?: boolean;
215
+ testId?: string;
216
+ toggleTestId?: string;
217
+ /** undefined = consumer does not manage focus; no tabindex is rendered.
218
+ * true/false = consumer manages a roving tabindex (tabindex 0 / -1). */
219
+ tabbable?: boolean;
220
+ treeMeta?: TreeItemMeta;
221
+ };
222
+
168
223
  declare type __VLS_Props_2 = {
169
224
  /** Trigger color */
170
225
  color?: 'neutral' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error';
@@ -352,6 +407,19 @@ declare function __VLS_template_6(): {
352
407
  rootEl: any;
353
408
  };
354
409
 
410
+ declare function __VLS_template_7(): {
411
+ attrs: Partial<{}>;
412
+ slots: {
413
+ member?(_: {
414
+ member: GroupMember;
415
+ }): any;
416
+ };
417
+ refs: {
418
+ headerEl: HTMLDivElement;
419
+ };
420
+ rootEl: HTMLDivElement;
421
+ };
422
+
355
423
  declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
356
424
 
357
425
  declare type __VLS_TemplateResult_2 = ReturnType<typeof __VLS_template_2>;
@@ -364,6 +432,8 @@ declare type __VLS_TemplateResult_5 = ReturnType<typeof __VLS_template_5>;
364
432
 
365
433
  declare type __VLS_TemplateResult_6 = ReturnType<typeof __VLS_template_6>;
366
434
 
435
+ declare type __VLS_TemplateResult_7 = ReturnType<typeof __VLS_template_7>;
436
+
367
437
  declare type __VLS_WithTemplateSlots<T, S> = T & {
368
438
  new (): {
369
439
  $slots: S;
@@ -400,6 +470,12 @@ declare type __VLS_WithTemplateSlots_6<T, S> = T & {
400
470
  };
401
471
  };
402
472
 
473
+ declare type __VLS_WithTemplateSlots_7<T, S> = T & {
474
+ new (): {
475
+ $slots: S;
476
+ };
477
+ };
478
+
403
479
  export declare type ActionFn = () => void;
404
480
 
405
481
  /** The component + props + options currently mounted in the host (the "root"). */
@@ -459,6 +535,13 @@ declare type AfterApplyContext = {
459
535
  result: ApplyResult;
460
536
  };
461
537
 
538
+ /**
539
+ * Seed `visibleChildIds` from the initial expand/collapse options: BFS from the
540
+ * roots, expanding a node when it is explicitly expanded or within
541
+ * `defaultOpenDepth` (unless explicitly collapsed). Mutates `recordMap`.
542
+ */
543
+ export declare function applyInitialVisibility<TRecord extends LayoutTreeRecord>(recordMap: RecordMapById<TRecord>, rootIds: string[], options: VisibilityOptions): void;
544
+
462
545
  /**
463
546
  * A fixed prefix/suffix wrapped around an editable attribute value. The user edits only
464
547
  * the "core" between them; the affix is rendered as inert adornment and re-applied on
@@ -470,6 +553,21 @@ export declare type AttributeAffix = {
470
553
  suffix?: string;
471
554
  };
472
555
 
556
+ /**
557
+ * Build the parent→child `RecordWithCache` map and the list of root ids from a
558
+ * flat record set. Pure: `record.parent` is never mutated — root status is
559
+ * derived from the relationship (no parent by default) or from the caller's
560
+ * `isRoot` predicate, so domain rules stay outside this module.
561
+ *
562
+ * Records whose parent id resolves to nothing are returned as `orphanIds` and
563
+ * treated as roots.
564
+ */
565
+ export declare function buildRecordCache<TRecord extends LayoutTreeRecord>(records: TRecord[], isRoot?: (record: TRecord) => boolean): {
566
+ recordMap: RecordMapById<TRecord>;
567
+ rootIds: string[];
568
+ orphanIds: string[];
569
+ };
570
+
473
571
  export declare const Button: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
474
572
 
475
573
  export declare const CATEGORY_ELEMENTS: Record<string, string[]>;
@@ -487,8 +585,29 @@ export declare const CodeBlock: DefineComponent<__VLS_Props_9, {}, {}, {}, {}, C
487
585
  */
488
586
  export declare function collectExpandableNodeIds(items: ExplorerNode[]): string[];
489
587
 
588
+ /** Collect all currently visible node ids (roots + recursively expanded children). */
589
+ export declare function collectVisibleIds<TRecord extends LayoutTreeRecord>(rootIds: string[], recordMap: RecordMapById<TRecord>): string[];
590
+
490
591
  export declare const Combobox: __VLS_WithTemplateSlots_3<typeof __VLS_component_3, __VLS_TemplateResult_3["slots"]>;
491
592
 
593
+ /**
594
+ * Compute synthetic group nodes for visible children.
595
+ *
596
+ * For each parent, ALL collapsed children of the same tagName (2+) form ONE
597
+ * group — a fixed "collapsed area" for that kind. Combined with the emission
598
+ * logic (which anchors the group at the kind's document position and appends
599
+ * opened siblings after it in stable expansion order), this keeps every kind's
600
+ * area in the same spot: opening or closing a member in any order moves only
601
+ * that member between the tile and the opened-area, never reshuffling the rest.
602
+ */
603
+ export declare function computeGroups<TRecord extends LayoutTreeRecord>(visibleIds: string[], recordMap: RecordMapById<TRecord>): GroupNode[];
604
+
605
+ export declare type Connection = {
606
+ id: string;
607
+ source: string;
608
+ target: string;
609
+ };
610
+
492
611
  export declare const ContextMenu: DefineComponent<__VLS_Props_16, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
493
612
  close: () => any;
494
613
  }, string, PublicProps, Readonly<__VLS_Props_16> & Readonly<{
@@ -574,6 +693,50 @@ export declare type DetailAttribute = {
574
693
  conflict?: boolean;
575
694
  };
576
695
 
696
+ export declare type DiagramLayoutOptions<TRecord extends LayoutTreeRecord, TNode, TEdge> = {
697
+ engine?: LayoutEngine;
698
+ layoutOptions?: LayoutOptions;
699
+ measuredHeightFeedback?: boolean;
700
+ /**
701
+ * Decide which records are diagram roots. Defaults to "has no parent".
702
+ * Consumers whose record set is rooted under a domain element (for example an
703
+ * SCL document root that is not itself a record) override this.
704
+ */
705
+ isRoot?: (record: TRecord) => boolean;
706
+ nodeSize: (record: TRecord, measuredHeight?: number) => LayoutSize;
707
+ groupLayout: (group: GroupNode, members: Array<RecordWithCache<TRecord>>, expanded: boolean) => GroupLayout;
708
+ toNode: (context: NodeMapperContext<TRecord>) => TNode;
709
+ toGroupNode: (context: GroupMapperContext<TRecord>) => TNode;
710
+ toEdge: (context: EdgeMapperContext) => TEdge;
711
+ };
712
+
713
+ export declare const DiagramNodeCard: DefineComponent<__VLS_Props_18, {
714
+ focus: () => void | undefined;
715
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
716
+ select: (nodeId: string) => any;
717
+ "toggle-expand": (nodeId: string) => any;
718
+ "show-details": (nodeId: string) => any;
719
+ keydown: (event: KeyboardEvent) => any;
720
+ }, string, PublicProps, Readonly<__VLS_Props_18> & Readonly<{
721
+ onSelect?: ((nodeId: string) => any) | undefined;
722
+ "onToggle-expand"?: ((nodeId: string) => any) | undefined;
723
+ "onShow-details"?: ((nodeId: string) => any) | undefined;
724
+ onKeydown?: ((event: KeyboardEvent) => any) | undefined;
725
+ }>, {
726
+ height: number;
727
+ compact: boolean;
728
+ selected: boolean;
729
+ childCounts: NodeChildCount[];
730
+ testId: string;
731
+ detailsTestId: string;
732
+ tabbable: boolean;
733
+ treeMeta: TreeItemMeta;
734
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {
735
+ rootEl: HTMLDivElement;
736
+ }, HTMLDivElement>;
737
+
738
+ export declare const DiagramNodeGroup: __VLS_WithTemplateSlots_7<typeof __VLS_component_7, __VLS_TemplateResult_7["slots"]>;
739
+
577
740
  /**
578
741
  * Message shapes posted on a dialecte project's BroadcastChannel — the public
579
742
  * event contract of @dialecte/core. Alias of core's `ProjectChannelMessage`
@@ -650,6 +813,12 @@ export declare type DocumentProgressBarProps = {
650
813
 
651
814
  export declare const Dropdown: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
652
815
 
816
+ export declare type EdgeMapperContext = {
817
+ edge: LayoutEdge;
818
+ route: LayoutPoint[];
819
+ singleChild: boolean;
820
+ };
821
+
653
822
  /** How the UI may edit an attribute (schema-derived classifier). */
654
823
  export declare type EditableMode = 'rename' | 'free';
655
824
 
@@ -739,6 +908,94 @@ export declare type FileMeta = {
739
908
  revision: string;
740
909
  };
741
910
 
911
+ /**
912
+ * Collapsed members viewport: tall enough to show at least two member cards
913
+ * fully; extra members overflow (scroll) - a partial card at the bottom is fine.
914
+ */
915
+ export declare const GROUP_COLLAPSED_MEMBERS_HEIGHT: number;
916
+
917
+ /** Group header bar height. Matches the `.group-header` rule in `DiagramNodeGroup`. */
918
+ export declare const GROUP_HEADER_HEIGHT = 34;
919
+
920
+ /** Vertical gap between two member cards. */
921
+ export declare const GROUP_MEMBER_GAP = 12;
922
+
923
+ /** Member card height when it shows child capsules. */
924
+ export declare const GROUP_MEMBER_HEIGHT = 72;
925
+
926
+ /** Member card height with no capsules (icon + title only). */
927
+ export declare const GROUP_MEMBER_HEIGHT_COMPACT = 48;
928
+
929
+ export declare type GroupLayout = LayoutSize & {
930
+ expandable: boolean;
931
+ };
932
+
933
+ export declare type GroupMapperContext<TRecord extends LayoutTreeRecord> = {
934
+ group: GroupNode;
935
+ members: Array<RecordWithCache<TRecord>>;
936
+ position: LayoutPoint;
937
+ size: LayoutSize;
938
+ expanded: boolean;
939
+ expandable: boolean;
940
+ };
941
+
942
+ /** A member rendered inside a group container (see `DiagramNodeGroup`). */
943
+ export declare type GroupMember = {
944
+ id: string;
945
+ tagName: string;
946
+ label: string;
947
+ hasChildren: boolean;
948
+ /** Rendered card height (members without child badges are shorter). */
949
+ height: number;
950
+ /** Child tally rendered as capsules on the member card. */
951
+ childCounts?: NodeChildCount[];
952
+ };
953
+
954
+ export declare type GroupNode = {
955
+ id: string;
956
+ parentId: string;
957
+ tagName: string;
958
+ memberIds: string[];
959
+ };
960
+
961
+ /** Geometry of a group tile whose members stack in a single column. */
962
+ export declare type GroupStackInput = {
963
+ /** Height of each member card, in stacking order. */
964
+ memberHeights: number[];
965
+ /** Vertical gap between two member cards. */
966
+ gap: number;
967
+ /** Height of the members viewport while the tile is collapsed. */
968
+ collapsedHeight: number;
969
+ };
970
+
971
+ export declare type GroupStackMetrics = {
972
+ /** Height of all members plus the gaps between them. */
973
+ contentHeight: number;
974
+ /** Members viewport height while collapsed: the content, clamped. */
975
+ collapsedShownHeight: number;
976
+ /** Whether expanding reveals anything the collapsed viewport hides. */
977
+ expandable: boolean;
978
+ /** Whether the collapsed viewport overflows and therefore scrolls. */
979
+ scrolls: boolean;
980
+ /** Members viewport height in the requested state. */
981
+ shownHeight: number;
982
+ };
983
+
984
+ /**
985
+ * Deterministic footprint of a group tile's member stack. Shared so consumers
986
+ * cannot disagree on when a tile is expandable: the members are a single
987
+ * column, so the height is a pure function of the member heights, and a tile is
988
+ * expandable exactly when its content does not fit the collapsed viewport.
989
+ *
990
+ * Padding, header height and scrollbar gutters stay with the consumer - this
991
+ * owns the stacking rule only. Member card heights live in `group-geometry`,
992
+ * next to the card component that dictates them.
993
+ */
994
+ export declare function groupStackMetrics(input: GroupStackInput, expanded: boolean): GroupStackMetrics;
995
+
996
+ /** Recursively hide all descendants of an entry. Mutates the entry subtree. */
997
+ export declare function hideDescendants<TRecord extends LayoutTreeRecord>(entry: RecordWithCache<TRecord>): void;
998
+
742
999
  /**
743
1000
  * Render code to syntax-highlighted HTML using Shiki's VSCode grammars/themes.
744
1001
  * The JavaScript RegExp engine is used (not the WASM/oniguruma engine) so the
@@ -752,6 +1009,8 @@ export declare function highlightCode(code: string, options?: {
752
1009
  lineStatuses?: readonly LineStatus[];
753
1010
  }): Promise<string>;
754
1011
 
1012
+ export declare function isGroupId(id: string): boolean;
1013
+
755
1014
  export declare type LayoutDirection = 'UP' | 'DOWN' | 'LEFT' | 'RIGHT';
756
1015
 
757
1016
  /** A connection between nodes. Arrays mirror ELK's hyperedge model, so a
@@ -823,6 +1082,26 @@ export declare type LayoutPoint = {
823
1082
  y: number;
824
1083
  };
825
1084
 
1085
+ export declare type LayoutSize = {
1086
+ width: number;
1087
+ height: number;
1088
+ };
1089
+
1090
+ export declare type LayoutTreeRecord = {
1091
+ id: string;
1092
+ tagName: string;
1093
+ parent?: LayoutTreeRelation | null;
1094
+ children: Array<{
1095
+ id: string;
1096
+ tagName?: string;
1097
+ }>;
1098
+ };
1099
+
1100
+ export declare type LayoutTreeRelation = {
1101
+ id: string;
1102
+ tagName: string;
1103
+ };
1104
+
826
1105
  export declare type LineStatus = 'added' | 'removed' | 'unchanged';
827
1106
 
828
1107
  /**
@@ -835,6 +1114,16 @@ export declare type LiveDataDocument = {
835
1114
  channelName: string;
836
1115
  };
837
1116
 
1117
+ export declare function makeGroupId(parentId: string, tagName: string): string;
1118
+
1119
+ /**
1120
+ * Height of a single member card. Capsule presence - not the record's child
1121
+ * relationship - decides it, because capsules are the only thing the taller
1122
+ * card has room for. Keeping the two in step stops a record whose children are
1123
+ * all filtered out from reserving an empty 72px row.
1124
+ */
1125
+ export declare function memberCardHeight(hasChildCounts: boolean): number;
1126
+
838
1127
  /**
839
1128
  * Per-node metadata the merge tree overlays on an `ExplorerNode` (keyed by node id).
840
1129
  * The tree itself is a plain `ExplorerNode[]`; this side map drives change colour, the
@@ -910,6 +1199,26 @@ color: "neutral" | "primary" | "secondary" | "accent" | "info" | "success" | "wa
910
1199
  size: "xs" | "sm" | "md" | "lg" | "xl";
911
1200
  }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
912
1201
 
1202
+ export declare type NavNode = {
1203
+ id: string;
1204
+ x: number;
1205
+ y: number;
1206
+ parentId: string | null;
1207
+ };
1208
+
1209
+ /** Child-element tally rendered as capsules on a `DiagramNodeCard`. */
1210
+ export declare type NodeChildCount = {
1211
+ tagName: string;
1212
+ count: number;
1213
+ /** Optional label shown instead of the count (e.g. a single child's name). */
1214
+ label?: string;
1215
+ };
1216
+
1217
+ export declare type NodeMapperContext<TRecord extends LayoutTreeRecord> = {
1218
+ entry: RecordWithCache<TRecord>;
1219
+ position: LayoutPoint;
1220
+ };
1221
+
913
1222
  /** Presentation progress: a held monotonic fraction in `[0, 1]` and its caption. */
914
1223
  export declare type ProgressDisplay = {
915
1224
  fraction: number;
@@ -934,6 +1243,14 @@ export declare type ReactiveDocument = {
934
1243
  subscribe(callback: (terminal: boolean) => void): () => void;
935
1244
  };
936
1245
 
1246
+ export declare type RecordMapById<TRecord extends LayoutTreeRecord = LayoutTreeRecord> = Record<string, RecordWithCache<TRecord>>;
1247
+
1248
+ export declare type RecordWithCache<TRecord extends LayoutTreeRecord = LayoutTreeRecord> = {
1249
+ record: TRecord;
1250
+ childrenCache: Array<RecordWithCache<TRecord>>;
1251
+ visibleChildIds: Set<string>;
1252
+ };
1253
+
937
1254
  export declare const SclExplorer: __VLS_WithTemplateSlots_5<typeof __VLS_component_5, __VLS_TemplateResult_5["slots"]>;
938
1255
 
939
1256
  export declare const SplitLayout: __VLS_WithTemplateSlots_6<typeof __VLS_component_6, __VLS_TemplateResult_6["slots"]>;
@@ -957,6 +1274,13 @@ declare type StructuralTree = {
957
1274
  expanded: string[];
958
1275
  };
959
1276
 
1277
+ /** ARIA tree position, supplied by the consumer's navigation model. */
1278
+ export declare type TreeItemMeta = {
1279
+ level?: number;
1280
+ setsize?: number;
1281
+ posinset?: number;
1282
+ };
1283
+
960
1284
  export declare const TypeNameAuthority: DefineComponent<__VLS_PublicProps_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
961
1285
  "update:modelValue": (value: KeepNameTypesFrom) => any;
962
1286
  }, string, PublicProps, Readonly<__VLS_PublicProps_4> & Readonly<{
@@ -1003,6 +1327,29 @@ export declare function useActiveDocument<GenericDocument>(params: {
1003
1327
  stop: () => void;
1004
1328
  };
1005
1329
 
1330
+ export declare function useDiagramLayout<TRecord extends LayoutTreeRecord, TNode, TEdge>(options: DiagramLayoutOptions<TRecord, TNode, TEdge>): {
1331
+ flowNodes: ShallowRef<TNode[], TNode[]>;
1332
+ flowEdges: ShallowRef<TEdge[], TEdge[]>;
1333
+ navNodes: ShallowRef<NavNode[], NavNode[]>;
1334
+ groupMembersById: ShallowRef<Map<string, string[]>, Map<string, string[]>>;
1335
+ expandedGroupIds: ShallowRef<Set<string>, Set<string>>;
1336
+ orphanIds: ShallowRef<string[], string[]>;
1337
+ setRecords: (newRecords: TRecord[]) => void;
1338
+ setConnections: (newConnections: Connection[]) => void;
1339
+ reset: () => void;
1340
+ calcLayout: (visibilityOptions: VisibilityOptions) => Promise<void>;
1341
+ reCalcLayout: () => Promise<void>;
1342
+ applyMeasuredHeights: (heights: Record<string, number>) => Promise<boolean>;
1343
+ expandNode: (nodeId: string) => Promise<void>;
1344
+ collapseNode: (nodeId: string) => Promise<void>;
1345
+ toggleNode: (nodeId: string) => Promise<void>;
1346
+ toggleGroup: (groupId: string) => Promise<void>;
1347
+ hasNodeLoadedChildren: (nodeId: string) => boolean;
1348
+ addChildren: (nodeId: string, children: TRecord[]) => void;
1349
+ getRecordEntry: (id: string) => RecordWithCache<TRecord> | undefined;
1350
+ updateRecord: (id: string, patch: Partial<TRecord>) => void;
1351
+ };
1352
+
1006
1353
  /**
1007
1354
  * Listen to a dialecte project's BroadcastChannel.
1008
1355
  *
@@ -1130,6 +1477,13 @@ export declare function useProjectLiveData<T>(params: {
1130
1477
  refresh: (delay?: number) => Promise<T | undefined>;
1131
1478
  };
1132
1479
 
1480
+ /** Options that drive which nodes are initially visible. */
1481
+ export declare type VisibilityOptions = {
1482
+ expandedNodeIds: Set<string>;
1483
+ collapsedNodeIds: Set<string>;
1484
+ defaultOpenDepth: number;
1485
+ };
1486
+
1133
1487
  export declare const XmlDiff: DefineComponent<__VLS_Props_10, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_10> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
1134
1488
 
1135
1489
  export { }
package/dist/index.js CHANGED
@@ -37,6 +37,13 @@ import P from "./context-menu/context-menu.js";
37
37
  import "./context-menu/index.js";
38
38
  import F from "./split-layout/split-layout.js";
39
39
  import "./split-layout/index.js";
40
- import { createElkLayoutEngine as I } from "./diagram-layout/elk-layout-engine.js";
40
+ import { applyInitialVisibility as I, buildRecordCache as L, collectVisibleIds as R, hideDescendants as z } from "./diagram-layout/visibility-model.js";
41
+ import { groupStackMetrics as B } from "./diagram-layout/group-stack.js";
42
+ import { GROUP_COLLAPSED_MEMBERS_HEIGHT as V, GROUP_HEADER_HEIGHT as H, GROUP_MEMBER_GAP as U, GROUP_MEMBER_HEIGHT as W, GROUP_MEMBER_HEIGHT_COMPACT as G, memberCardHeight as K } from "./diagram-layout/group-geometry.js";
43
+ import { computeGroups as q, isGroupId as J, makeGroupId as Y } from "./diagram-layout/grouping.js";
44
+ import { createElkLayoutEngine as X } from "./diagram-layout/elk-layout-engine.js";
45
+ import { useDiagramLayout as Z } from "./diagram-layout/use-diagram-layout.js";
46
+ import Q from "./diagram-layout/diagram-node-card.js";
47
+ import $ from "./diagram-layout/diagram-node-group.js";
41
48
  import "./diagram-layout/index.js";
42
- export { s as Button, y as CATEGORY_ELEMENTS, T as CodeBlock, l as Combobox, P as ContextMenu, O as DecisionToggle, d as Dialog, _ as DialogHost, v as DocumentProgressBar, c as Dropdown, b as ELEMENT_TO_COLOR, x as ELEMENT_TO_ICON, k as ElementDetail, f as FeedbackDialog, N as MergeReview, A as MergeTree, u as MultiSelect, C as SclExplorer, F as SplitLayout, j as TypeNameAuthority, D as XmlDiff, S as collectExpandableNodeIds, p as createDialogHost, e as createDocumentStore, I as createElkLayoutEngine, m as dialogHostKey, E as diffLines, w as highlightCode, h as provideDialogHost, i as useActiveDocument, t as useDialecteChannel, g as useDialog, a as useDocumentProgress, o as useDocumentState, n as useLiveData, M as useMergeSession, r as useProjectLiveData };
49
+ export { s as Button, y as CATEGORY_ELEMENTS, T as CodeBlock, l as Combobox, P as ContextMenu, O as DecisionToggle, Q as DiagramNodeCard, $ as DiagramNodeGroup, d as Dialog, _ as DialogHost, v as DocumentProgressBar, c as Dropdown, b as ELEMENT_TO_COLOR, x as ELEMENT_TO_ICON, k as ElementDetail, f as FeedbackDialog, V as GROUP_COLLAPSED_MEMBERS_HEIGHT, H as GROUP_HEADER_HEIGHT, U as GROUP_MEMBER_GAP, W as GROUP_MEMBER_HEIGHT, G as GROUP_MEMBER_HEIGHT_COMPACT, N as MergeReview, A as MergeTree, u as MultiSelect, C as SclExplorer, F as SplitLayout, j as TypeNameAuthority, D as XmlDiff, I as applyInitialVisibility, L as buildRecordCache, S as collectExpandableNodeIds, R as collectVisibleIds, q as computeGroups, p as createDialogHost, e as createDocumentStore, X as createElkLayoutEngine, m as dialogHostKey, E as diffLines, B as groupStackMetrics, z as hideDescendants, w as highlightCode, J as isGroupId, Y as makeGroupId, K as memberCardHeight, h as provideDialogHost, i as useActiveDocument, Z as useDiagramLayout, t as useDialecteChannel, g as useDialog, a as useDocumentProgress, o as useDocumentState, n as useLiveData, M as useMergeSession, r as useProjectLiveData };