@adea-ai/ui 0.63.4 → 0.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -0
- package/dist/NOTICE +81 -0
- package/dist/components/conversation/busy-send-button.d.ts +28 -0
- package/dist/components/conversation/busy-send-button.d.ts.map +1 -0
- package/dist/components/conversation/busy-send-button.js +184 -0
- package/dist/components/conversation/busy-send-button.js.map +1 -0
- package/dist/components/conversation/index.d.ts +1 -0
- package/dist/components/conversation/index.d.ts.map +1 -1
- package/dist/components/conversation/index.js +2 -1
- package/dist/components/layout/split-layout/drop.d.ts +13 -0
- package/dist/components/layout/split-layout/drop.d.ts.map +1 -0
- package/dist/components/layout/split-layout/drop.js +50 -0
- package/dist/components/layout/split-layout/drop.js.map +1 -0
- package/dist/components/layout/split-layout/geometry.d.ts +14 -0
- package/dist/components/layout/split-layout/geometry.d.ts.map +1 -0
- package/dist/components/layout/split-layout/geometry.js +44 -0
- package/dist/components/layout/split-layout/geometry.js.map +1 -0
- package/dist/components/layout/split-layout/index.d.ts +5 -0
- package/dist/components/layout/split-layout/index.d.ts.map +1 -0
- package/dist/components/layout/split-layout/index.js +4 -0
- package/dist/components/layout/split-layout/model.d.ts +51 -0
- package/dist/components/layout/split-layout/model.d.ts.map +1 -0
- package/dist/components/layout/split-layout/model.js +255 -0
- package/dist/components/layout/split-layout/model.js.map +1 -0
- package/dist/components/layout/split-layout/split-layout.d.ts +30 -0
- package/dist/components/layout/split-layout/split-layout.d.ts.map +1 -0
- package/dist/components/layout/split-layout/split-layout.js +312 -0
- package/dist/components/layout/split-layout/split-layout.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/lib/tokens.d.ts +3 -0
- package/dist/lib/tokens.d.ts.map +1 -1
- package/dist/lib/tokens.js +3 -0
- package/dist/lib/tokens.js.map +1 -1
- package/dist/r/conversation.json +7 -0
- package/dist/r/registry.json +48 -0
- package/dist/r/split-layout.json +41 -0
- package/dist/r/src/components/conversation/busy-send-button.tsx +161 -0
- package/dist/r/src/components/conversation/index.ts +1 -0
- package/dist/r/src/components/layout/split-layout/drop.ts +29 -0
- package/dist/r/src/components/layout/split-layout/geometry.ts +40 -0
- package/dist/r/src/components/layout/split-layout/index.ts +4 -0
- package/dist/r/src/components/layout/split-layout/model.ts +336 -0
- package/dist/r/src/components/layout/split-layout/split-layout.tsx +346 -0
- package/dist/r/src/lib/tokens.ts +3 -0
- package/dist/r/src/styles/theme.css +9 -0
- package/package.json +10 -2
- package/registry.json +48 -0
- package/src/components/conversation/busy-send-button.tsx +161 -0
- package/src/components/conversation/index.ts +1 -0
- package/src/components/layout/split-layout/drop.ts +29 -0
- package/src/components/layout/split-layout/geometry.ts +40 -0
- package/src/components/layout/split-layout/index.ts +4 -0
- package/src/components/layout/split-layout/model.ts +336 -0
- package/src/components/layout/split-layout/split-layout.tsx +346 -0
- package/src/index.ts +1 -0
- package/src/lib/tokens.ts +3 -0
- package/src/styles/theme.css +9 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** A visual identity only. Extend this with host-owned payload; UI never interprets it. */
|
|
2
|
+
export type SplitLayoutLeaf = Readonly<{
|
|
3
|
+
kind: 'leaf';
|
|
4
|
+
id: string;
|
|
5
|
+
}>;
|
|
6
|
+
export type SplitLayoutBranch<L extends SplitLayoutLeaf = SplitLayoutLeaf> = Readonly<{
|
|
7
|
+
kind: 'split';
|
|
8
|
+
id: string;
|
|
9
|
+
direction: 'row' | 'column';
|
|
10
|
+
ratio: number;
|
|
11
|
+
children: readonly [SplitLayoutNode<L>, SplitLayoutNode<L>];
|
|
12
|
+
}>;
|
|
13
|
+
export type SplitLayoutNode<L extends SplitLayoutLeaf = SplitLayoutLeaf> = L | SplitLayoutBranch<L>;
|
|
14
|
+
export declare const MAX_LAYOUT_LEAVES = 8;
|
|
15
|
+
export declare const MAX_LAYOUT_DEPTH = 8;
|
|
16
|
+
export declare const MIN_SPLIT_RATIO = 0.1;
|
|
17
|
+
export declare const MAX_SPLIT_RATIO = 0.9;
|
|
18
|
+
export type SplitLayoutState<L extends SplitLayoutLeaf = SplitLayoutLeaf> = Readonly<{
|
|
19
|
+
center: SplitLayoutNode<L>;
|
|
20
|
+
focusedLeafId: string;
|
|
21
|
+
closed: readonly Readonly<{
|
|
22
|
+
center: SplitLayoutNode<L>;
|
|
23
|
+
leafId: string;
|
|
24
|
+
}>[];
|
|
25
|
+
}>;
|
|
26
|
+
export type SplitPaneInput<L extends SplitLayoutLeaf = SplitLayoutLeaf> = Readonly<{
|
|
27
|
+
direction: SplitLayoutBranch<L>['direction'];
|
|
28
|
+
placement: 'before' | 'after';
|
|
29
|
+
leaf: L;
|
|
30
|
+
splitId: string;
|
|
31
|
+
}>;
|
|
32
|
+
export declare function listLeaves<L extends SplitLayoutLeaf>(node: SplitLayoutNode<L>): readonly L[];
|
|
33
|
+
export declare function countLeaves<L extends SplitLayoutLeaf>(node: SplitLayoutNode<L>): number;
|
|
34
|
+
export declare function layoutDepth<L extends SplitLayoutLeaf>(node: SplitLayoutNode<L>): number;
|
|
35
|
+
export declare function createLayoutState<L extends SplitLayoutLeaf>(center: SplitLayoutNode<L>): SplitLayoutState<L>;
|
|
36
|
+
export declare function splitPane<L extends SplitLayoutLeaf>(state: SplitLayoutState<L>, targetLeafId: string, input: SplitPaneInput<L>): SplitLayoutState<L>;
|
|
37
|
+
export declare function closePane<L extends SplitLayoutLeaf>(state: SplitLayoutState<L>, leafId: string, createPlaceholderLeaf: () => L): SplitLayoutState<L>;
|
|
38
|
+
export declare function undoClosePane<L extends SplitLayoutLeaf>(state: SplitLayoutState<L>): SplitLayoutState<L>;
|
|
39
|
+
export declare function focusPane<L extends SplitLayoutLeaf>(state: SplitLayoutState<L>, leafId: string): SplitLayoutState<L>;
|
|
40
|
+
export declare function swapPanes<L extends SplitLayoutLeaf>(state: SplitLayoutState<L>, firstLeafId: string, secondLeafId: string): SplitLayoutState<L>;
|
|
41
|
+
export declare function movePane<L extends SplitLayoutLeaf>(state: SplitLayoutState<L>, leafId: string, targetLeafId: string, placement: 'before' | 'after', direction: SplitLayoutBranch<L>['direction'], splitId: string): SplitLayoutState<L>;
|
|
42
|
+
export declare function resizeSplit<L extends SplitLayoutLeaf>(state: SplitLayoutState<L>, splitId: string, ratio: number): SplitLayoutState<L>;
|
|
43
|
+
/**
|
|
44
|
+
* Pure repair walk ported from bb's size normalization: every split ratio is
|
|
45
|
+
* clamped into the normative range and a non-finite ratio falls back to an
|
|
46
|
+
* even split. Structure, IDs, and focus are untouched.
|
|
47
|
+
*/
|
|
48
|
+
export declare function normalizeLayout<L extends SplitLayoutLeaf>(state: SplitLayoutState<L>): SplitLayoutState<L>;
|
|
49
|
+
/** The leaf immediately after (`1`) or before (`-1`) the given leaf in reading order. */
|
|
50
|
+
export declare function neighborLeaf<L extends SplitLayoutLeaf>(state: SplitLayoutState<L>, leafId: string, step: 1 | -1): L | undefined;
|
|
51
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/split-layout/model.ts"],"names":[],"mappings":"AAiBA,2FAA2F;AAC3F,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AACpE,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,IAAI,QAAQ,CAAC;IACpF,IAAI,EAAE,OAAO,CAAA;IACb,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,KAAK,GAAG,QAAQ,CAAA;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,CAAA;CAC5D,CAAC,CAAA;A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AW,CAAC,CAAC,SAAS,eAAe,EACnD,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAC1B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACZ,gBAAgB,CAAC,CAAC,CAAC,CAkBrB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,eAAe,EACvD,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,GACzB,gBAAgB,CAAC,CAAC,CAAC,CAgBrB;AAED,yFAAyF;AACzF,wBAAgB,YAAY,CAAC,CAAC,SAAS,eAAe,EACpD,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,GACX,CAAC,GAAG,SAAS,CAKf"}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
//#region src/components/layout/split-layout/model.ts
|
|
2
|
+
var MAX_LAYOUT_LEAVES = 8;
|
|
3
|
+
var MAX_LAYOUT_DEPTH = 8;
|
|
4
|
+
var MIN_SPLIT_RATIO = .1;
|
|
5
|
+
var MAX_SPLIT_RATIO = .9;
|
|
6
|
+
function listLeaves(node) {
|
|
7
|
+
return node.kind === "leaf" ? [node] : [...listLeaves(node.children[0]), ...listLeaves(node.children[1])];
|
|
8
|
+
}
|
|
9
|
+
function countLeaves(node) {
|
|
10
|
+
return node.kind === "leaf" ? 1 : countLeaves(node.children[0]) + countLeaves(node.children[1]);
|
|
11
|
+
}
|
|
12
|
+
function layoutDepth(node) {
|
|
13
|
+
return node.kind === "leaf" ? 1 : 1 + Math.max(layoutDepth(node.children[0]), layoutDepth(node.children[1]));
|
|
14
|
+
}
|
|
15
|
+
function replaceLeaf(node, leafId, replacement) {
|
|
16
|
+
if (node.kind === "leaf") return node.id === leafId ? replacement : node;
|
|
17
|
+
const first = replaceLeaf(node.children[0], leafId, replacement);
|
|
18
|
+
const second = replaceLeaf(node.children[1], leafId, replacement);
|
|
19
|
+
return first === node.children[0] && second === node.children[1] ? node : {
|
|
20
|
+
...node,
|
|
21
|
+
children: [first, second]
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function removeLeaf(node, leafId) {
|
|
25
|
+
if (node.kind === "leaf") return node.id === leafId ? null : node;
|
|
26
|
+
const first = removeLeaf(node.children[0], leafId);
|
|
27
|
+
const second = removeLeaf(node.children[1], leafId);
|
|
28
|
+
if (!first) return second;
|
|
29
|
+
if (!second) return first;
|
|
30
|
+
return first === node.children[0] && second === node.children[1] ? node : {
|
|
31
|
+
...node,
|
|
32
|
+
children: [first, second]
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function containsLeaf(node, leafId) {
|
|
36
|
+
return node.kind === "leaf" ? node.id === leafId : containsLeaf(node.children[0], leafId) || containsLeaf(node.children[1], leafId);
|
|
37
|
+
}
|
|
38
|
+
function assertUniqueInput(state, leaf, splitId) {
|
|
39
|
+
assertLayoutTree(leaf);
|
|
40
|
+
if (typeof splitId !== "string" || splitId.length === 0) throw new Error("invalid_state: split identity must be nonempty");
|
|
41
|
+
const ids = /* @__PURE__ */ new Set();
|
|
42
|
+
const visit = (node) => {
|
|
43
|
+
if (ids.has(node.id)) throw new Error("invalid_state: duplicate pane id");
|
|
44
|
+
ids.add(node.id);
|
|
45
|
+
if (node.kind === "split") node.children.forEach(visit);
|
|
46
|
+
};
|
|
47
|
+
visit(state.center);
|
|
48
|
+
if (ids.has(leaf.id) || ids.has(splitId) || leaf.id === splitId) throw new Error("invalid_state: duplicate pane id");
|
|
49
|
+
}
|
|
50
|
+
/** Visual-tree validation only; applications still decode and scope persisted preferences. */
|
|
51
|
+
function assertLayoutTree(center) {
|
|
52
|
+
const ids = /* @__PURE__ */ new Set();
|
|
53
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
54
|
+
let leaves = 0;
|
|
55
|
+
const visit = (node, depth) => {
|
|
56
|
+
if (depth > 8) throw new Error("limit_exceeded: layout depth exceeds eight");
|
|
57
|
+
if (!node || typeof node !== "object") throw new Error("invalid_state: missing layout node");
|
|
58
|
+
if (seen.has(node)) throw new Error("invalid_state: cyclic or reused layout node");
|
|
59
|
+
seen.add(node);
|
|
60
|
+
if (typeof node.id !== "string" || node.id.length === 0) throw new Error("invalid_state: layout identity must be nonempty");
|
|
61
|
+
if (ids.has(node.id)) throw new Error("invalid_state: duplicate pane id");
|
|
62
|
+
ids.add(node.id);
|
|
63
|
+
if (node.kind === "leaf") {
|
|
64
|
+
leaves += 1;
|
|
65
|
+
if (leaves > 8) throw new Error("limit_exceeded: layout has more than eight leaves");
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (node.kind !== "split" || !Array.isArray(node.children) || node.children.length !== 2 || node.direction !== "row" && node.direction !== "column") throw new Error("invalid_state: layout must be a strict binary row or column tree");
|
|
69
|
+
visit(node.children[0], depth + 1);
|
|
70
|
+
visit(node.children[1], depth + 1);
|
|
71
|
+
};
|
|
72
|
+
visit(center, 1);
|
|
73
|
+
}
|
|
74
|
+
function createLayoutState(center) {
|
|
75
|
+
assertLayoutTree(center);
|
|
76
|
+
const first = listLeaves(center)[0];
|
|
77
|
+
if (!first) throw new Error("invalid_state: layout requires a leaf");
|
|
78
|
+
return {
|
|
79
|
+
center,
|
|
80
|
+
focusedLeafId: first.id,
|
|
81
|
+
closed: []
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function splitPane(state, targetLeafId, input) {
|
|
85
|
+
if (!containsLeaf(state.center, targetLeafId)) return state;
|
|
86
|
+
if (countLeaves(state.center) >= 8) throw new Error("limit_exceeded: center layout has eight leaves");
|
|
87
|
+
assertUniqueInput(state, input.leaf, input.splitId);
|
|
88
|
+
const target = listLeaves(state.center).find((leaf) => leaf.id === targetLeafId);
|
|
89
|
+
if (!target) return state;
|
|
90
|
+
const children = input.placement === "before" ? [input.leaf, target] : [target, input.leaf];
|
|
91
|
+
const center = replaceLeaf(state.center, targetLeafId, {
|
|
92
|
+
kind: "split",
|
|
93
|
+
id: input.splitId,
|
|
94
|
+
direction: input.direction,
|
|
95
|
+
ratio: .5,
|
|
96
|
+
children
|
|
97
|
+
});
|
|
98
|
+
if (layoutDepth(center) > 8) throw new Error("limit_exceeded: center layout depth exceeds eight");
|
|
99
|
+
return {
|
|
100
|
+
...state,
|
|
101
|
+
center,
|
|
102
|
+
focusedLeafId: input.leaf.id,
|
|
103
|
+
closed: []
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function closePane(state, leafId, createPlaceholderLeaf) {
|
|
107
|
+
if (!containsLeaf(state.center, leafId)) return state;
|
|
108
|
+
const before = state.center;
|
|
109
|
+
const closedIndex = listLeaves(before).findIndex((leaf) => leaf.id === leafId);
|
|
110
|
+
const removed = removeLeaf(before, leafId);
|
|
111
|
+
const center = removed ?? createPlaceholderLeaf();
|
|
112
|
+
if (!removed) {
|
|
113
|
+
if (center.kind !== "leaf") throw new Error("invalid_state: placeholder must be a leaf");
|
|
114
|
+
assertLayoutTree(center);
|
|
115
|
+
}
|
|
116
|
+
const leaves = listLeaves(center);
|
|
117
|
+
const fallback = leaves[Math.min(closedIndex, leaves.length - 1)] ?? leaves[0];
|
|
118
|
+
if (!fallback) throw new Error("invalid_state: layout requires a leaf");
|
|
119
|
+
return {
|
|
120
|
+
center,
|
|
121
|
+
focusedLeafId: state.focusedLeafId === leafId ? fallback.id : state.focusedLeafId,
|
|
122
|
+
closed: [...state.closed, {
|
|
123
|
+
center: before,
|
|
124
|
+
leafId
|
|
125
|
+
}]
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function undoClosePane(state) {
|
|
129
|
+
const previous = state.closed.at(-1);
|
|
130
|
+
if (!previous) return state;
|
|
131
|
+
return {
|
|
132
|
+
center: previous.center,
|
|
133
|
+
focusedLeafId: previous.leafId,
|
|
134
|
+
closed: state.closed.slice(0, -1)
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function focusPane(state, leafId) {
|
|
138
|
+
return containsLeaf(state.center, leafId) && state.focusedLeafId !== leafId ? {
|
|
139
|
+
...state,
|
|
140
|
+
focusedLeafId: leafId
|
|
141
|
+
} : state;
|
|
142
|
+
}
|
|
143
|
+
function swapPanes(state, firstLeafId, secondLeafId) {
|
|
144
|
+
if (firstLeafId === secondLeafId) return state;
|
|
145
|
+
const leaves = listLeaves(state.center);
|
|
146
|
+
const first = leaves.find((leaf) => leaf.id === firstLeafId);
|
|
147
|
+
const second = leaves.find((leaf) => leaf.id === secondLeafId);
|
|
148
|
+
if (!first || !second) return state;
|
|
149
|
+
const swap = (node) => {
|
|
150
|
+
if (node.kind === "leaf") {
|
|
151
|
+
if (node.id === firstLeafId) return second;
|
|
152
|
+
if (node.id === secondLeafId) return first;
|
|
153
|
+
return node;
|
|
154
|
+
}
|
|
155
|
+
const left = swap(node.children[0]);
|
|
156
|
+
const right = swap(node.children[1]);
|
|
157
|
+
return left === node.children[0] && right === node.children[1] ? node : {
|
|
158
|
+
...node,
|
|
159
|
+
children: [left, right]
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
return {
|
|
163
|
+
...state,
|
|
164
|
+
center: swap(state.center),
|
|
165
|
+
closed: []
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function movePane(state, leafId, targetLeafId, placement, direction, splitId) {
|
|
169
|
+
if (leafId === targetLeafId) return state;
|
|
170
|
+
const moving = listLeaves(state.center).find((leaf) => leaf.id === leafId);
|
|
171
|
+
if (!moving || !containsLeaf(state.center, targetLeafId)) return state;
|
|
172
|
+
const detached = removeLeaf(state.center, leafId);
|
|
173
|
+
if (!detached) return state;
|
|
174
|
+
return {
|
|
175
|
+
...splitPane({
|
|
176
|
+
center: detached,
|
|
177
|
+
focusedLeafId: state.focusedLeafId,
|
|
178
|
+
closed: state.closed
|
|
179
|
+
}, targetLeafId, {
|
|
180
|
+
direction,
|
|
181
|
+
placement,
|
|
182
|
+
leaf: moving,
|
|
183
|
+
splitId
|
|
184
|
+
}),
|
|
185
|
+
focusedLeafId: leafId
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
function resizeSplit(state, splitId, ratio) {
|
|
189
|
+
if (!Number.isFinite(ratio)) return state;
|
|
190
|
+
const nextRatio = Math.min(MAX_SPLIT_RATIO, Math.max(MIN_SPLIT_RATIO, ratio));
|
|
191
|
+
let found = false;
|
|
192
|
+
const visit = (node) => {
|
|
193
|
+
if (node.kind === "leaf") return node;
|
|
194
|
+
if (node.id === splitId) {
|
|
195
|
+
found = true;
|
|
196
|
+
return node.ratio === nextRatio ? node : {
|
|
197
|
+
...node,
|
|
198
|
+
ratio: nextRatio
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
const first = visit(node.children[0]);
|
|
202
|
+
const second = visit(node.children[1]);
|
|
203
|
+
return first === node.children[0] && second === node.children[1] ? node : {
|
|
204
|
+
...node,
|
|
205
|
+
children: [first, second]
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
const center = visit(state.center);
|
|
209
|
+
return found && center !== state.center ? {
|
|
210
|
+
...state,
|
|
211
|
+
center,
|
|
212
|
+
closed: []
|
|
213
|
+
} : state;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Pure repair walk ported from bb's size normalization: every split ratio is
|
|
217
|
+
* clamped into the normative range and a non-finite ratio falls back to an
|
|
218
|
+
* even split. Structure, IDs, and focus are untouched.
|
|
219
|
+
*/
|
|
220
|
+
function normalizeLayout(state) {
|
|
221
|
+
const visit = (node) => {
|
|
222
|
+
if (node.kind === "leaf") return {
|
|
223
|
+
node,
|
|
224
|
+
changed: false
|
|
225
|
+
};
|
|
226
|
+
const first = visit(node.children[0]);
|
|
227
|
+
const second = visit(node.children[1]);
|
|
228
|
+
const ratio = Number.isFinite(node.ratio) ? Math.min(MAX_SPLIT_RATIO, Math.max(MIN_SPLIT_RATIO, node.ratio)) : 1 / 2;
|
|
229
|
+
const changed = first.changed || second.changed || ratio !== node.ratio;
|
|
230
|
+
return {
|
|
231
|
+
node: changed ? {
|
|
232
|
+
...node,
|
|
233
|
+
ratio,
|
|
234
|
+
children: [first.node, second.node]
|
|
235
|
+
} : node,
|
|
236
|
+
changed
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
const result = visit(state.center);
|
|
240
|
+
return result.changed ? {
|
|
241
|
+
...state,
|
|
242
|
+
center: result.node
|
|
243
|
+
} : state;
|
|
244
|
+
}
|
|
245
|
+
/** The leaf immediately after (`1`) or before (`-1`) the given leaf in reading order. */
|
|
246
|
+
function neighborLeaf(state, leafId, step) {
|
|
247
|
+
const leaves = listLeaves(state.center);
|
|
248
|
+
const index = leaves.findIndex((leaf) => leaf.id === leafId);
|
|
249
|
+
if (index < 0) return void 0;
|
|
250
|
+
return leaves[index + step];
|
|
251
|
+
}
|
|
252
|
+
//#endregion
|
|
253
|
+
export { MAX_LAYOUT_DEPTH, MAX_LAYOUT_LEAVES, MAX_SPLIT_RATIO, MIN_SPLIT_RATIO, closePane, countLeaves, createLayoutState, focusPane, layoutDepth, listLeaves, movePane, neighborLeaf, normalizeLayout, resizeSplit, splitPane, swapPanes, undoClosePane };
|
|
254
|
+
|
|
255
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","names":[],"sources":["../../../../src/components/layout/split-layout/model.ts"],"sourcesContent":["/*\n * Copyright (c) 2026 Michael Yong\n * Copyright (c) 2026 Muxy\n * SPDX-License-Identifier: MIT\n *\n * Portions of the binary split behavior are substantially translated from:\n * - get-bb/bb apps/app/src/lib/split-layout/ops.ts (MIT), revision\n * 52a9256373d4d36f9b60e9e2a7f333464091a2ac.\n * - muxy-app/muxy Muxy/Models/Workspace/SplitNode.swift (MIT), revision\n * 5c5be8697c57a2fe70cda97fdbaf7c912e2e31b6.\n * Adapted first in Adea packages/dev-view/src/layout/operations.ts at\n * 0322ab09ff5e9775bfddc0bf2d81e1df436dbef7. Extracted here with opaque\n * host-owned leaves and an injected final-pane placeholder; immutable strict\n * binary operations, accepted limits and undoable close are preserved.\n * See NOTICE and docs/research/dev-view-donor-audit.md.\n */\n\n/** A visual identity only. Extend this with host-owned payload; UI never interprets it. */\nexport type SplitLayoutLeaf = Readonly<{ kind: 'leaf'; id: string }>\nexport type SplitLayoutBranch<L extends SplitLayoutLeaf = SplitLayoutLeaf> = Readonly<{\n kind: 'split'\n id: string\n direction: 'row' | 'column'\n ratio: number\n children: readonly [SplitLayoutNode<L>, SplitLayoutNode<L>]\n}>\nexport type SplitLayoutNode<L extends SplitLayoutLeaf = SplitLayoutLeaf> = L | SplitLayoutBranch<L>\n\nexport const MAX_LAYOUT_LEAVES = 8\nexport const MAX_LAYOUT_DEPTH = 8\nexport const MIN_SPLIT_RATIO = 0.1\nexport const MAX_SPLIT_RATIO = 0.9\n\nexport type SplitLayoutState<L extends SplitLayoutLeaf = SplitLayoutLeaf> = Readonly<{\n center: SplitLayoutNode<L>\n focusedLeafId: string\n closed: readonly Readonly<{ center: SplitLayoutNode<L>; leafId: string }>[]\n}>\n\nexport type SplitPaneInput<L extends SplitLayoutLeaf = SplitLayoutLeaf> = Readonly<{\n direction: SplitLayoutBranch<L>['direction']\n placement: 'before' | 'after'\n leaf: L\n splitId: string\n}>\n\nexport function listLeaves<L extends SplitLayoutLeaf>(node: SplitLayoutNode<L>): readonly L[] {\n return node.kind === 'leaf'\n ? [node]\n : [...listLeaves(node.children[0]), ...listLeaves(node.children[1])]\n}\n\nexport function countLeaves<L extends SplitLayoutLeaf>(node: SplitLayoutNode<L>): number {\n return node.kind === 'leaf' ? 1 : countLeaves(node.children[0]) + countLeaves(node.children[1])\n}\n\nexport function layoutDepth<L extends SplitLayoutLeaf>(node: SplitLayoutNode<L>): number {\n return node.kind === 'leaf'\n ? 1\n : 1 + Math.max(layoutDepth(node.children[0]), layoutDepth(node.children[1]))\n}\n\nfunction replaceLeaf<L extends SplitLayoutLeaf>(\n node: SplitLayoutNode<L>,\n leafId: string,\n replacement: SplitLayoutNode<L>\n): SplitLayoutNode<L> {\n if (node.kind === 'leaf') return node.id === leafId ? replacement : node\n const first = replaceLeaf(node.children[0], leafId, replacement)\n const second = replaceLeaf(node.children[1], leafId, replacement)\n return first === node.children[0] && second === node.children[1]\n ? node\n : { ...node, children: [first, second] }\n}\n\nfunction removeLeaf<L extends SplitLayoutLeaf>(\n node: SplitLayoutNode<L>,\n leafId: string\n): SplitLayoutNode<L> | null {\n if (node.kind === 'leaf') return node.id === leafId ? null : node\n const first = removeLeaf(node.children[0], leafId)\n const second = removeLeaf(node.children[1], leafId)\n if (!first) return second\n if (!second) return first\n return first === node.children[0] && second === node.children[1]\n ? node\n : { ...node, children: [first, second] }\n}\n\nfunction containsLeaf<L extends SplitLayoutLeaf>(\n node: SplitLayoutNode<L>,\n leafId: string\n): boolean {\n return node.kind === 'leaf'\n ? node.id === leafId\n : containsLeaf(node.children[0], leafId) || containsLeaf(node.children[1], leafId)\n}\n\nfunction assertUniqueInput<L extends SplitLayoutLeaf>(\n state: SplitLayoutState<L>,\n leaf: L,\n splitId: string\n) {\n assertLayoutTree(leaf)\n if (typeof splitId !== 'string' || splitId.length === 0)\n throw new Error('invalid_state: split identity must be nonempty')\n const ids = new Set<string>()\n const visit = (node: SplitLayoutNode<L>) => {\n if (ids.has(node.id)) throw new Error('invalid_state: duplicate pane id')\n ids.add(node.id)\n if (node.kind === 'split') node.children.forEach(visit)\n }\n visit(state.center)\n if (ids.has(leaf.id) || ids.has(splitId) || leaf.id === splitId)\n throw new Error('invalid_state: duplicate pane id')\n}\n\n/** Visual-tree validation only; applications still decode and scope persisted preferences. */\nfunction assertLayoutTree<L extends SplitLayoutLeaf>(center: SplitLayoutNode<L>): void {\n const ids = new Set<string>()\n const seen = new WeakSet<object>()\n let leaves = 0\n const visit = (node: SplitLayoutNode<L>, depth: number) => {\n if (depth > MAX_LAYOUT_DEPTH) throw new Error('limit_exceeded: layout depth exceeds eight')\n if (!node || typeof node !== 'object') throw new Error('invalid_state: missing layout node')\n if (seen.has(node)) throw new Error('invalid_state: cyclic or reused layout node')\n seen.add(node)\n if (typeof node.id !== 'string' || node.id.length === 0)\n throw new Error('invalid_state: layout identity must be nonempty')\n if (ids.has(node.id)) throw new Error('invalid_state: duplicate pane id')\n ids.add(node.id)\n if (node.kind === 'leaf') {\n leaves += 1\n if (leaves > MAX_LAYOUT_LEAVES)\n throw new Error('limit_exceeded: layout has more than eight leaves')\n return\n }\n if (\n node.kind !== 'split' ||\n !Array.isArray(node.children) ||\n node.children.length !== 2 ||\n (node.direction !== 'row' && node.direction !== 'column')\n )\n throw new Error('invalid_state: layout must be a strict binary row or column tree')\n visit(node.children[0], depth + 1)\n visit(node.children[1], depth + 1)\n }\n visit(center, 1)\n}\n\nexport function createLayoutState<L extends SplitLayoutLeaf>(\n center: SplitLayoutNode<L>\n): SplitLayoutState<L> {\n assertLayoutTree(center)\n const first = listLeaves(center)[0]\n if (!first) throw new Error('invalid_state: layout requires a leaf')\n return { center, focusedLeafId: first.id, closed: [] }\n}\n\nexport function splitPane<L extends SplitLayoutLeaf>(\n state: SplitLayoutState<L>,\n targetLeafId: string,\n input: SplitPaneInput<L>\n): SplitLayoutState<L> {\n if (!containsLeaf(state.center, targetLeafId)) return state\n if (countLeaves(state.center) >= MAX_LAYOUT_LEAVES)\n throw new Error('limit_exceeded: center layout has eight leaves')\n assertUniqueInput(state, input.leaf, input.splitId)\n const target = listLeaves(state.center).find((leaf) => leaf.id === targetLeafId)\n if (!target) return state\n const children =\n input.placement === 'before' ? ([input.leaf, target] as const) : ([target, input.leaf] as const)\n const center = replaceLeaf(state.center, targetLeafId, {\n kind: 'split',\n id: input.splitId,\n direction: input.direction,\n ratio: 0.5,\n children,\n })\n if (layoutDepth(center) > MAX_LAYOUT_DEPTH)\n throw new Error('limit_exceeded: center layout depth exceeds eight')\n return { ...state, center, focusedLeafId: input.leaf.id, closed: [] }\n}\n\nexport function closePane<L extends SplitLayoutLeaf>(\n state: SplitLayoutState<L>,\n leafId: string,\n createPlaceholderLeaf: () => L\n): SplitLayoutState<L> {\n if (!containsLeaf(state.center, leafId)) return state\n const before = state.center\n const readingOrder = listLeaves(before)\n const closedIndex = readingOrder.findIndex((leaf) => leaf.id === leafId)\n const removed = removeLeaf(before, leafId)\n const center: SplitLayoutNode<L> = removed ?? createPlaceholderLeaf()\n if (!removed) {\n if (center.kind !== 'leaf') throw new Error('invalid_state: placeholder must be a leaf')\n assertLayoutTree(center)\n }\n const leaves = listLeaves(center)\n const fallback = leaves[Math.min(closedIndex, leaves.length - 1)] ?? leaves[0]\n if (!fallback) throw new Error('invalid_state: layout requires a leaf')\n return {\n center,\n focusedLeafId: state.focusedLeafId === leafId ? fallback.id : state.focusedLeafId,\n closed: [...state.closed, { center: before, leafId }],\n }\n}\n\nexport function undoClosePane<L extends SplitLayoutLeaf>(\n state: SplitLayoutState<L>\n): SplitLayoutState<L> {\n const previous = state.closed.at(-1)\n if (!previous) return state\n return {\n center: previous.center,\n focusedLeafId: previous.leafId,\n closed: state.closed.slice(0, -1),\n }\n}\n\nexport function focusPane<L extends SplitLayoutLeaf>(\n state: SplitLayoutState<L>,\n leafId: string\n): SplitLayoutState<L> {\n return containsLeaf(state.center, leafId) && state.focusedLeafId !== leafId\n ? { ...state, focusedLeafId: leafId }\n : state\n}\n\nexport function swapPanes<L extends SplitLayoutLeaf>(\n state: SplitLayoutState<L>,\n firstLeafId: string,\n secondLeafId: string\n): SplitLayoutState<L> {\n if (firstLeafId === secondLeafId) return state\n const leaves = listLeaves(state.center)\n const first = leaves.find((leaf) => leaf.id === firstLeafId)\n const second = leaves.find((leaf) => leaf.id === secondLeafId)\n if (!first || !second) return state\n const swap = (node: SplitLayoutNode<L>): SplitLayoutNode<L> => {\n if (node.kind === 'leaf') {\n if (node.id === firstLeafId) return second\n if (node.id === secondLeafId) return first\n return node\n }\n const left = swap(node.children[0])\n const right = swap(node.children[1])\n return left === node.children[0] && right === node.children[1]\n ? node\n : { ...node, children: [left, right] }\n }\n return { ...state, center: swap(state.center), closed: [] }\n}\n\nexport function movePane<L extends SplitLayoutLeaf>(\n state: SplitLayoutState<L>,\n leafId: string,\n targetLeafId: string,\n placement: 'before' | 'after',\n direction: SplitLayoutBranch<L>['direction'],\n splitId: string\n): SplitLayoutState<L> {\n if (leafId === targetLeafId) return state\n const moving = listLeaves(state.center).find((leaf) => leaf.id === leafId)\n if (!moving || !containsLeaf(state.center, targetLeafId)) return state\n const detached = removeLeaf(state.center, leafId)\n if (!detached) return state\n const moved = splitPane(\n { center: detached, focusedLeafId: state.focusedLeafId, closed: state.closed },\n targetLeafId,\n { direction, placement, leaf: moving, splitId }\n )\n return { ...moved, focusedLeafId: leafId }\n}\n\nexport function resizeSplit<L extends SplitLayoutLeaf>(\n state: SplitLayoutState<L>,\n splitId: string,\n ratio: number\n): SplitLayoutState<L> {\n if (!Number.isFinite(ratio)) return state\n const nextRatio = Math.min(MAX_SPLIT_RATIO, Math.max(MIN_SPLIT_RATIO, ratio))\n let found = false\n const visit = (node: SplitLayoutNode<L>): SplitLayoutNode<L> => {\n if (node.kind === 'leaf') return node\n if (node.id === splitId) {\n found = true\n return node.ratio === nextRatio ? node : { ...node, ratio: nextRatio }\n }\n const first = visit(node.children[0])\n const second = visit(node.children[1])\n return first === node.children[0] && second === node.children[1]\n ? node\n : { ...node, children: [first, second] }\n }\n const center = visit(state.center)\n return found && center !== state.center ? { ...state, center, closed: [] } : state\n}\n\n/**\n * Pure repair walk ported from bb's size normalization: every split ratio is\n * clamped into the normative range and a non-finite ratio falls back to an\n * even split. Structure, IDs, and focus are untouched.\n */\nexport function normalizeLayout<L extends SplitLayoutLeaf>(\n state: SplitLayoutState<L>\n): SplitLayoutState<L> {\n const visit = (node: SplitLayoutNode<L>): { node: SplitLayoutNode<L>; changed: boolean } => {\n if (node.kind === 'leaf') return { node, changed: false }\n const first = visit(node.children[0])\n const second = visit(node.children[1])\n const ratio = Number.isFinite(node.ratio)\n ? Math.min(MAX_SPLIT_RATIO, Math.max(MIN_SPLIT_RATIO, node.ratio))\n : (MIN_SPLIT_RATIO + MAX_SPLIT_RATIO) / 2\n const changed = first.changed || second.changed || ratio !== node.ratio\n return {\n node: changed ? { ...node, ratio, children: [first.node, second.node] } : node,\n changed,\n }\n }\n const result = visit(state.center)\n return result.changed ? { ...state, center: result.node } : state\n}\n\n/** The leaf immediately after (`1`) or before (`-1`) the given leaf in reading order. */\nexport function neighborLeaf<L extends SplitLayoutLeaf>(\n state: SplitLayoutState<L>,\n leafId: string,\n step: 1 | -1\n): L | undefined {\n const leaves = listLeaves(state.center)\n const index = leaves.findIndex((leaf) => leaf.id === leafId)\n if (index < 0) return undefined\n return leaves[index + step]\n}\n"],"mappings":";AA4BA,IAAa,oBAAoB;AACjC,IAAa,mBAAmB;AAChC,IAAa,kBAAkB;AAC/B,IAAa,kBAAkB;AAe/B,SAAgB,WAAsC,MAAwC;CAC5F,OAAO,KAAK,SAAS,SACjB,CAAC,IAAI,IACL,CAAC,GAAG,WAAW,KAAK,SAAS,EAAE,GAAG,GAAG,WAAW,KAAK,SAAS,EAAE,CAAC;AACvE;AAEA,SAAgB,YAAuC,MAAkC;CACvF,OAAO,KAAK,SAAS,SAAS,IAAI,YAAY,KAAK,SAAS,EAAE,IAAI,YAAY,KAAK,SAAS,EAAE;AAChG;AAEA,SAAgB,YAAuC,MAAkC;CACvF,OAAO,KAAK,SAAS,SACjB,IACA,IAAI,KAAK,IAAI,YAAY,KAAK,SAAS,EAAE,GAAG,YAAY,KAAK,SAAS,EAAE,CAAC;AAC/E;AAEA,SAAS,YACP,MACA,QACA,aACoB;CACpB,IAAI,KAAK,SAAS,QAAQ,OAAO,KAAK,OAAO,SAAS,cAAc;CACpE,MAAM,QAAQ,YAAY,KAAK,SAAS,IAAI,QAAQ,WAAW;CAC/D,MAAM,SAAS,YAAY,KAAK,SAAS,IAAI,QAAQ,WAAW;CAChE,OAAO,UAAU,KAAK,SAAS,MAAM,WAAW,KAAK,SAAS,KAC1D,OACA;EAAE,GAAG;EAAM,UAAU,CAAC,OAAO,MAAM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ACA,MAAM,SAAS,MAAM,MAAM,MAAM;CACjC,OAAO,OAAO,UAAU;EAAE,GAAG;EAAO,QAAQ,OAAO;CAAK,IAAI;AAC9D;;AAGA,SAAgB,aACd,OACA,QACA,MACe;CACf,MAAM,SAAS,WAAW,MAAM,MAAM;CACtC,MAAM,QAAQ,OAAO,WAAW,SAAS,KAAK,OAAO,MAAM;CAC3D,IAAI,QAAQ,GAAG,OAAO,KAAA;CACtB,OAAO,OAAO,QAAQ;AACxB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type Accessor, type JSX } from 'solid-js';
|
|
2
|
+
import { type PaneDropIntent } from './drop';
|
|
3
|
+
export type { PaneDropIntent } from './drop';
|
|
4
|
+
import { type SplitLayoutBranch, type SplitLayoutLeaf, type SplitLayoutState } from './model';
|
|
5
|
+
export type SplitLayoutProps<L extends SplitLayoutLeaf> = {
|
|
6
|
+
state: SplitLayoutState<L>;
|
|
7
|
+
label: string;
|
|
8
|
+
/** Accessible name for a pane region and its close button. */
|
|
9
|
+
labelForLeaf: (leaf: L) => string;
|
|
10
|
+
/** Called once per stable leaf owner; the accessor tracks opaque payload replacement. */
|
|
11
|
+
renderLeaf: (leaf: Accessor<L>) => JSX.Element;
|
|
12
|
+
/** Inline visible header composition, separate from the region and close-button name. */
|
|
13
|
+
renderPaneLabel?: (leaf: Accessor<L>) => JSX.Element;
|
|
14
|
+
/** Whether pane regions participate in sequential keyboard navigation; defaults to programmatic focus only. */
|
|
15
|
+
paneTabIndex?: 0 | -1;
|
|
16
|
+
/** Accessible splitter name; defaults to the current orientation-specific label. */
|
|
17
|
+
labelForSeparator?: (branch: SplitLayoutBranch<L>) => string;
|
|
18
|
+
onResize: (splitId: string, ratio: number) => void;
|
|
19
|
+
onFocus?: (leafId: string) => void;
|
|
20
|
+
/** Host performs the model transition and returns the surviving focus destination. */
|
|
21
|
+
onClose?: (leafId: string) => string | undefined;
|
|
22
|
+
/** Pointer placement only; the host supplies keyboard commands and performs the model transition. */
|
|
23
|
+
onMove?: (leafId: string, targetId: string, intent: PaneDropIntent) => void;
|
|
24
|
+
/** Stable header composition for host-owned keyboard actions/capability feedback. */
|
|
25
|
+
renderPaneActions?: (leaf: Accessor<L>) => JSX.Element;
|
|
26
|
+
class?: string;
|
|
27
|
+
};
|
|
28
|
+
/** Muxy frame geometry keeps leaf owners stable; Corvu owns constrained separator interactions. */
|
|
29
|
+
export declare function SplitLayout<L extends SplitLayoutLeaf>(props: SplitLayoutProps<L>): JSX.Element;
|
|
30
|
+
//# sourceMappingURL=split-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-layout.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/split-layout/split-layout.tsx"],"names":[],"mappings":"AACA,OAAO,EAQL,KAAK,QAAQ,EACb,KAAK,GAAG,EACT,MAAM,UAAU,CAAA;AAKjB,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAA;AAC5D,YAAY,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAE5C,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACtB,MAAM,SAAS,CAAA;AAEhB,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,eAAe,IAAI;IACxD,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAA;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,8DAA8D;IAC9D,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAA;IACjC,yFAAyF;IACzF,UAAU,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,OAAO,CAAA;IAC9C,yFAAyF;IACzF,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,OAAO,CAAA;IACpD,+GAA+G;IAC/G,YAAY,CAAC,EAAE,CAAC,GAAG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