@nvidia-elements/core 2.23.5 → 2.23.6

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 (209) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/accordion/accordion2.js +4 -4
  3. package/dist/alert/alert-group2.js +1 -1
  4. package/dist/alert/alert2.js +1 -1
  5. package/dist/avatar/avatar-group2.js +1 -1
  6. package/dist/avatar/avatar2.js +1 -1
  7. package/dist/badge/badge2.js +1 -1
  8. package/dist/breadcrumb/breadcrumb2.js +1 -1
  9. package/dist/bundles/index.js +7 -7
  10. package/dist/button/button2.js +1 -1
  11. package/dist/button-group/button-group2.js +1 -1
  12. package/dist/card/card2.js +4 -4
  13. package/dist/chat-message/chat-message2.js +1 -1
  14. package/dist/checkbox/checkbox-group2.js +1 -1
  15. package/dist/checkbox/checkbox2.js +1 -1
  16. package/dist/color/color2.js +1 -1
  17. package/dist/combobox/combobox2.js +1 -1
  18. package/dist/copy-button/copy-button2.js +1 -1
  19. package/dist/custom-elements.json +1000 -229
  20. package/dist/date/date2.js +1 -1
  21. package/dist/datetime/datetime2.js +1 -1
  22. package/dist/dialog/dialog-footer2.js +1 -1
  23. package/dist/dialog/dialog-header2.js +1 -1
  24. package/dist/dialog/dialog2.js +1 -1
  25. package/dist/divider/divider2.js +1 -1
  26. package/dist/dot/dot2.js +1 -1
  27. package/dist/drag-handle/drag-handle2.js +1 -1
  28. package/dist/drawer/drawer-content2.js +1 -1
  29. package/dist/drawer/drawer-footer2.js +1 -1
  30. package/dist/drawer/drawer-header2.js +1 -1
  31. package/dist/drawer/drawer2.js +1 -1
  32. package/dist/dropdown/dropdown-footer2.js +1 -1
  33. package/dist/dropdown/dropdown-header2.js +1 -1
  34. package/dist/dropdown/dropdown2.js +1 -1
  35. package/dist/dropdown-group/dropdown-group.js +1 -1
  36. package/dist/dropzone/dropzone2.js +1 -1
  37. package/dist/file/file2.js +1 -1
  38. package/dist/format-bytes/format-bytes2.js +1 -1
  39. package/dist/format-datetime/format-datetime2.js +1 -1
  40. package/dist/format-number/format-number2.js +1 -1
  41. package/dist/format-relative-time/format-relative-time2.js +1 -1
  42. package/dist/format-truncate/format-truncate2.js +1 -1
  43. package/dist/forms/control/control2.js +1 -1
  44. package/dist/forms/control-group/control-group2.js +1 -1
  45. package/dist/forms/control-message/control-message2.js +1 -1
  46. package/dist/gauge/gauge2.js +1 -1
  47. package/dist/ghost/ghost2.js +1 -1
  48. package/dist/grid/cell/cell2.js +1 -1
  49. package/dist/grid/column/column2.js +1 -1
  50. package/dist/grid/footer/footer2.js +1 -1
  51. package/dist/grid/grid2.js +1 -1
  52. package/dist/grid/header/header2.js +1 -1
  53. package/dist/grid/placeholder/placeholder2.js +1 -1
  54. package/dist/grid/row/row2.js +1 -1
  55. package/dist/icon/icon2.js +1 -1
  56. package/dist/icon-button/icon-button2.js +1 -1
  57. package/dist/iframe/iframe2.js +1 -1
  58. package/dist/index.js +1 -1
  59. package/dist/input/input-group2.js +1 -1
  60. package/dist/input/input2.js +1 -1
  61. package/dist/joystick/joystick2.js +1 -1
  62. package/dist/logo/logo2.js +1 -1
  63. package/dist/menu/menu-group2.js +1 -1
  64. package/dist/menu/menu-item2.js +1 -1
  65. package/dist/menu/menu2.js +1 -1
  66. package/dist/month/month2.js +1 -1
  67. package/dist/notification/notification-group2.js +1 -1
  68. package/dist/notification/notification2.js +1 -1
  69. package/dist/page/page-panel/page-panel-content2.js +1 -1
  70. package/dist/page/page-panel/page-panel-footer2.js +1 -1
  71. package/dist/page/page-panel/page-panel-header2.js +1 -1
  72. package/dist/page/page-panel/page-panel2.js +1 -1
  73. package/dist/page/page2.js +1 -1
  74. package/dist/page-header/page-header2.js +1 -1
  75. package/dist/page-loader/page-loader2.js +1 -1
  76. package/dist/pagination/pagination2.js +1 -1
  77. package/dist/panel/panel2.js +4 -4
  78. package/dist/password/password2.js +1 -1
  79. package/dist/preferences-input/preferences-input2.js +1 -1
  80. package/dist/progress-bar/progress-bar2.js +1 -1
  81. package/dist/progress-dot/progress-dot2.js +1 -1
  82. package/dist/progress-ring/progress-ring2.js +1 -1
  83. package/dist/progressive-filter-chip/progressive-filter-chip2.js +1 -1
  84. package/dist/pulse/pulse2.js +1 -1
  85. package/dist/radio/radio-group2.js +1 -1
  86. package/dist/radio/radio2.js +1 -1
  87. package/dist/range/range2.js +1 -1
  88. package/dist/resize-handle/resize-handle2.js +1 -1
  89. package/dist/search/search2.js +1 -1
  90. package/dist/select/select2.js +1 -1
  91. package/dist/skeleton/skeleton2.js +1 -1
  92. package/dist/sort-button/sort-button2.js +1 -1
  93. package/dist/sparkline/sparkline2.js +1 -1
  94. package/dist/star-rating/star-rating2.js +1 -1
  95. package/dist/steps/steps2.js +2 -2
  96. package/dist/switch/switch-group2.js +1 -1
  97. package/dist/switch/switch2.js +1 -1
  98. package/dist/tabs/tabs-group2.js +1 -1
  99. package/dist/tabs/tabs-item-group2.js +1 -1
  100. package/dist/tabs/tabs2.js +2 -2
  101. package/dist/tag/tag2.js +1 -1
  102. package/dist/textarea/textarea2.js +1 -1
  103. package/dist/time/time2.js +1 -1
  104. package/dist/toast/toast2.js +1 -1
  105. package/dist/toggletip/toggletip-footer2.js +1 -1
  106. package/dist/toggletip/toggletip-header2.js +1 -1
  107. package/dist/toggletip/toggletip2.js +1 -1
  108. package/dist/toolbar/toolbar2.js +1 -1
  109. package/dist/tooltip/tooltip2.js +1 -1
  110. package/dist/tree/tree-node2.js +1 -1
  111. package/dist/tree/tree2.js +1 -1
  112. package/dist/week/week2.js +1 -1
  113. package/dist/workspace/controllers/workspace-composition.controller.d.ts +4 -1
  114. package/dist/workspace/controllers/workspace-composition.controller.js +69 -39
  115. package/dist/workspace/controllers/workspace-composition.controller.js.map +1 -1
  116. package/dist/workspace/controllers/workspace-rearrange.controller.js +27 -27
  117. package/dist/workspace/controllers/workspace-rearrange.controller.js.map +1 -1
  118. package/dist/workspace/controllers/workspace-restoration.controller.js +2 -2
  119. package/dist/workspace/controllers/workspace-restoration.controller.js.map +1 -1
  120. package/dist/workspace/panel/panel2.js +2 -2
  121. package/dist/workspace/panel/panel2.js.map +1 -1
  122. package/dist/workspace/panel-content/panel-content2.js +1 -1
  123. package/dist/workspace/panel-footer/panel-footer2.js +1 -1
  124. package/dist/workspace/panel-header/panel-header2.js +1 -1
  125. package/dist/workspace/utils/comparison.utils.d.ts +3 -0
  126. package/dist/workspace/utils/comparison.utils.js +13 -0
  127. package/dist/workspace/utils/comparison.utils.js.map +1 -0
  128. package/dist/workspace/utils/evaluation.utils.d.ts +65 -6
  129. package/dist/workspace/utils/evaluation.utils.js +334 -99
  130. package/dist/workspace/utils/evaluation.utils.js.map +1 -1
  131. package/dist/workspace/utils/geometry/allocation.utils.js +15 -13
  132. package/dist/workspace/utils/geometry/allocation.utils.js.map +1 -1
  133. package/dist/workspace/utils/geometry/sizing.utils.d.ts +2 -0
  134. package/dist/workspace/utils/geometry/sizing.utils.js +37 -17
  135. package/dist/workspace/utils/geometry/sizing.utils.js.map +1 -1
  136. package/dist/workspace/utils/interaction/boundary.utils.d.ts +2 -2
  137. package/dist/workspace/utils/interaction/boundary.utils.js +2 -2
  138. package/dist/workspace/utils/interaction/boundary.utils.js.map +1 -1
  139. package/dist/workspace/utils/interaction/drag-preview.utils.d.ts +3 -3
  140. package/dist/workspace/utils/interaction/drag-preview.utils.js.map +1 -1
  141. package/dist/workspace/utils/interaction/insertion-offers.utils.d.ts +11 -9
  142. package/dist/workspace/utils/interaction/insertion-offers.utils.js +37 -43
  143. package/dist/workspace/utils/interaction/insertion-offers.utils.js.map +1 -1
  144. package/dist/workspace/utils/interaction/placement-decision.utils.d.ts +6 -1
  145. package/dist/workspace/utils/interaction/placement-decision.utils.js +94 -87
  146. package/dist/workspace/utils/interaction/placement-decision.utils.js.map +1 -1
  147. package/dist/workspace/utils/model/layout.utils.d.ts +2 -1
  148. package/dist/workspace/utils/model/layout.utils.js +12 -10
  149. package/dist/workspace/utils/model/layout.utils.js.map +1 -1
  150. package/dist/workspace/utils/model/membership.utils.d.ts +4 -0
  151. package/dist/workspace/utils/model/membership.utils.js +13 -4
  152. package/dist/workspace/utils/model/membership.utils.js.map +1 -1
  153. package/dist/workspace/utils/model/operations.utils.d.ts +1 -0
  154. package/dist/workspace/utils/model/operations.utils.js +51 -46
  155. package/dist/workspace/utils/model/operations.utils.js.map +1 -1
  156. package/dist/workspace/utils/model/projection.utils.d.ts +4 -2
  157. package/dist/workspace/utils/model/projection.utils.js +49 -40
  158. package/dist/workspace/utils/model/projection.utils.js.map +1 -1
  159. package/dist/workspace/utils/model/value.utils.d.ts +4 -3
  160. package/dist/workspace/utils/model/value.utils.js +15 -50
  161. package/dist/workspace/utils/model/value.utils.js.map +1 -1
  162. package/dist/workspace/utils/placement/acquisition-sizing.utils.d.ts +2 -0
  163. package/dist/workspace/utils/placement/acquisition-sizing.utils.js +30 -22
  164. package/dist/workspace/utils/placement/acquisition-sizing.utils.js.map +1 -1
  165. package/dist/workspace/utils/placement/group-insertion.utils.d.ts +19 -13
  166. package/dist/workspace/utils/placement/group-insertion.utils.js +50 -47
  167. package/dist/workspace/utils/placement/group-insertion.utils.js.map +1 -1
  168. package/dist/workspace/utils/placement/planner.utils.d.ts +13 -2
  169. package/dist/workspace/utils/placement/planner.utils.js +79 -73
  170. package/dist/workspace/utils/placement/planner.utils.js.map +1 -1
  171. package/dist/workspace/utils/placement/preparation.utils.d.ts +5 -2
  172. package/dist/workspace/utils/placement/preparation.utils.js +45 -41
  173. package/dist/workspace/utils/placement/preparation.utils.js.map +1 -1
  174. package/dist/workspace/utils/placement/region.utils.js +32 -32
  175. package/dist/workspace/utils/placement/region.utils.js.map +1 -1
  176. package/dist/workspace/utils/placement/scope.utils.d.ts +34 -0
  177. package/dist/workspace/utils/placement/scope.utils.js +155 -0
  178. package/dist/workspace/utils/placement/scope.utils.js.map +1 -0
  179. package/dist/workspace/utils/placement/session.utils.d.ts +11 -0
  180. package/dist/workspace/utils/placement/session.utils.js +78 -0
  181. package/dist/workspace/utils/placement/session.utils.js.map +1 -0
  182. package/dist/workspace/utils/placement/split-sizing.utils.d.ts +2 -2
  183. package/dist/workspace/utils/placement/split-sizing.utils.js +19 -19
  184. package/dist/workspace/utils/placement/split-sizing.utils.js.map +1 -1
  185. package/dist/workspace/utils/presentation/composition.utils.d.ts +1 -1
  186. package/dist/workspace/utils/presentation/composition.utils.js +4 -2
  187. package/dist/workspace/utils/presentation/composition.utils.js.map +1 -1
  188. package/dist/workspace/utils/presentation/groups.utils.d.ts +3 -3
  189. package/dist/workspace/utils/presentation/groups.utils.js +40 -30
  190. package/dist/workspace/utils/presentation/groups.utils.js.map +1 -1
  191. package/dist/workspace/utils/presentation/measurements.utils.d.ts +1 -0
  192. package/dist/workspace/utils/presentation/measurements.utils.js +6 -14
  193. package/dist/workspace/utils/presentation/measurements.utils.js.map +1 -1
  194. package/dist/workspace/utils/presentation/offers.utils.d.ts +1 -1
  195. package/dist/workspace/utils/presentation/offers.utils.js +3 -3
  196. package/dist/workspace/utils/presentation/offers.utils.js.map +1 -1
  197. package/dist/workspace/utils/presentation/preview.utils.d.ts +6 -0
  198. package/dist/workspace/utils/presentation/preview.utils.js +14 -3
  199. package/dist/workspace/utils/presentation/preview.utils.js.map +1 -1
  200. package/dist/workspace/workspace.examples.js.map +1 -1
  201. package/dist/workspace/workspace.examples.json +4 -4
  202. package/dist/workspace/workspace.js +1 -1
  203. package/dist/workspace/workspace.js.map +1 -1
  204. package/dist/workspace/workspace2.js +206 -212
  205. package/dist/workspace/workspace2.js.map +1 -1
  206. package/package.json +1 -1
  207. package/dist/workspace/utils/placement/context.utils.d.ts +0 -36
  208. package/dist/workspace/utils/placement/context.utils.js +0 -135
  209. package/dist/workspace/utils/placement/context.utils.js.map +0 -1
@@ -1,17 +1,18 @@
1
1
  import type { Rect } from '@nvidia-elements/core/internal';
2
- import { describePlacementSlot } from '../placement/group-insertion.utils.js';
3
2
  import type { WorkspacePlacedRegion } from '../geometry/allocation.utils.js';
4
3
  import type { WorkspaceDropIntent } from './drag-preview.utils.js';
5
4
  import type { WorkspaceLayout, WorkspaceNode } from '../model/layout.utils.js';
6
5
  import type { WorkspaceDestination } from '../model/operations.utils.js';
7
6
  import type { WorkspaceLayoutProjector } from '../model/projection.utils.js';
8
- import type { WorkspaceContextRectResolver } from '../placement/context.utils.js';
7
+ import type { GroupInsertion } from '../placement/group-insertion.utils.js';
9
8
  import type { WorkspacePlacementPlan, WorkspacePlacementPlanner } from '../placement/planner.utils.js';
9
+ import type { WorkspaceScopeRectResolver } from '../placement/scope.utils.js';
10
+ import type { WorkspacePlacementSession } from '../placement/session.utils.js';
10
11
  export interface WorkspaceInsertionOffer {
11
12
  kind: 'order' | 'insert';
12
13
  owner: string;
13
14
  boundary?: 'start' | 'end';
14
- scope: NonNullable<ReturnType<typeof describePlacementSlot>>;
15
+ insertion: GroupInsertion;
15
16
  plan: WorkspacePlacementPlan;
16
17
  rect: Rect;
17
18
  hitRect?: Rect;
@@ -21,7 +22,7 @@ export interface WorkspaceInsertionOffer {
21
22
  /** Gives only an explicit peer lane or structural receiving endcap priority over chrome. */
22
23
  export declare function placementOwnsChrome(offer: WorkspaceInsertionOffer): boolean;
23
24
  export declare function findSourcePeerRegionKey(node: WorkspaceNode | null, source: string[], key?: string): string | undefined;
24
- /** Aliases of the same planned insertion share one descriptor. */
25
+ /** Aliases of the same planned insertion share one offer. */
25
26
  export declare function createInsertionOffers(input: {
26
27
  currentLayout: WorkspaceLayout;
27
28
  root: WorkspaceNode | null;
@@ -29,13 +30,14 @@ export declare function createInsertionOffers(input: {
29
30
  available: string[];
30
31
  projectLayout?: WorkspaceLayoutProjector;
31
32
  planPlacement?: WorkspacePlacementPlanner;
32
- contextRect?: WorkspaceContextRectResolver;
33
+ placementSession?: WorkspacePlacementSession;
34
+ resolveScopeRect?: WorkspaceScopeRectResolver;
33
35
  regions: WorkspacePlacedRegion[];
34
36
  explorationRegions?: WorkspacePlacedRegion[];
35
37
  existing: WorkspaceInsertionOffer[];
36
38
  gap: number;
37
39
  }): WorkspaceInsertionOffer[];
38
- /** Shares the painted descriptor's exact operation with input resolution. */
40
+ /** Shares the painted offer's exact operation with input resolution. */
39
41
  export declare function getPlacementOfferIntent(offer: WorkspaceInsertionOffer): WorkspaceDropIntent;
40
42
  /** Locates ordering availability in the computed exploration geometry, not a prospective landing. */
41
43
  export declare function getOrderHintRect(input: {
@@ -44,15 +46,15 @@ export declare function getOrderHintRect(input: {
44
46
  previous?: Rect;
45
47
  axis: 'horizontal' | 'vertical';
46
48
  after: boolean;
47
- sourceSlot?: Rect;
49
+ sourceReservation?: Rect;
48
50
  boundary?: 'start' | 'end';
49
51
  }): Rect | undefined;
50
- /** Orders overlapping scope offers into lanes from outermost to innermost. */
52
+ /** Orders overlapping insertion offers into lanes from outermost to innermost. */
51
53
  export declare function partitionPlacementOffers(offers: WorkspaceInsertionOffer[]): WorkspaceInsertionOffer[];
52
54
  /** Uses current peer geometry for interior insertion cues, before allocating the candidate. */
53
55
  export declare function getCurrentInsertionSeam(offer: WorkspaceInsertionOffer, geometry: {
54
56
  regions: WorkspacePlacedRegion[];
55
57
  source: string[];
56
58
  gap: number;
57
- contextRect?: WorkspaceContextRectResolver;
59
+ resolveScopeRect?: WorkspaceScopeRectResolver;
58
60
  }): Rect | undefined;
@@ -1,11 +1,11 @@
1
1
  import { getPanelIds as e } from "../model/layout.utils.js";
2
- import { getAllocatedContextRect as t } from "../placement/context.utils.js";
3
- import { describePlacementSlot as n } from "../placement/group-insertion.utils.js";
4
- import { planWorkspacePlacement as r } from "../placement/planner.utils.js";
2
+ import { getAllocatedScopeRect as t } from "../placement/scope.utils.js";
3
+ import { getGroupInsertion as n } from "../placement/group-insertion.utils.js";
4
+ import { resolvePlacementPlan as r } from "../placement/planner.utils.js";
5
5
  // src/workspace/utils/interaction/insertion-offers.utils.ts
6
6
  function i(e) {
7
7
  let t = e.destination.region?.slice(0, e.destination.region.lastIndexOf(".")) === e.owner;
8
- return e.kind === "order" || !!e.boundary || t && !!e.scope.previous && !!e.scope.next;
8
+ return e.kind === "order" || !!e.boundary || t && !!e.insertion.previous && !!e.insertion.next;
9
9
  }
10
10
  var a = [
11
11
  "left",
@@ -24,62 +24,56 @@ function o(e, t, n = "root") {
24
24
  }
25
25
  function s(e) {
26
26
  let t = [], n = /* @__PURE__ */ new Set();
27
- for (let r of e.existing) n.add(r.scope.key), t.push(r);
27
+ for (let r of e.existing) n.add(r.insertion.key), t.push(r);
28
28
  let r = p(e.root).flatMap((t) => c(e, t)).sort((e, t) => Number(e.interior) - Number(t.interior));
29
- for (let { offer: e } of r) n.has(e.scope.key) || (n.add(e.scope.key), t.push(e));
29
+ for (let { offer: e } of r) n.has(e.insertion.key) || (n.add(e.insertion.key), t.push(e));
30
30
  return t;
31
31
  }
32
- function c(n, i) {
33
- let a = e(i.node).filter((e) => !n.source.includes(e)), o = (n.contextRect ?? t)({
34
- members: a,
32
+ function c(n, r) {
33
+ let i = e(r.node).filter((e) => !n.source.includes(e)), a = (n.resolveScopeRect ?? t)({
34
+ members: i,
35
35
  allocation: n.regions,
36
36
  source: n.source
37
37
  });
38
- if (!o) return [];
39
- let s = (n.contextRect ?? t)({
40
- members: a,
38
+ if (!a) return [];
39
+ let o = (n.resolveScopeRect ?? t)({
40
+ members: i,
41
41
  allocation: n.explorationRegions ?? n.regions,
42
42
  source: n.source
43
- }), c = {
43
+ }), s = {
44
44
  input: n,
45
- group: i,
46
- rect: o,
47
- planPlacement: n.planPlacement ?? r
48
- }, d = s ? {
49
- ...c,
50
- rect: s
45
+ group: r,
46
+ rect: a
47
+ }, c = o ? {
48
+ ...s,
49
+ rect: o
51
50
  } : void 0;
52
- return u(i).flatMap((e) => {
53
- let t = e.interior ? c : d;
51
+ return u(r).flatMap((e) => {
52
+ let t = e.interior ? s : c;
54
53
  return t ? l(t, e) : [];
55
54
  });
56
55
  }
57
- function l({ input: t, group: r, rect: i, planPlacement: a }, { target: o, key: s, direction: c, interior: l }) {
56
+ function l({ input: t, group: i, rect: a }, { target: o, key: s, direction: c, interior: l }) {
58
57
  let u = {
59
58
  target: e(o).find((e) => !t.source.includes(e)) ?? "",
60
59
  region: s,
61
60
  position: c
62
- }, p = a({
63
- layout: t.currentLayout,
64
- source: t.source,
65
- destination: u,
66
- available: t.available,
67
- projectLayout: t.projectLayout,
68
- operation: "insert"
69
- });
61
+ }, p = r(t, u, "insert");
70
62
  if (!p) return [];
71
63
  let h = n({
72
64
  plan: p,
73
65
  source: t.source,
74
66
  available: t.available,
75
- projectLayout: t.projectLayout
67
+ projectLayout: t.projectLayout,
68
+ placementSession: t.placementSession,
69
+ planPlacement: t.planPlacement
76
70
  });
77
71
  if (!h) return [];
78
- let g = f(t, h) ?? i, _ = m(g, c);
72
+ let g = f(t, h) ?? a, _ = m(g, c);
79
73
  if (!_) return [];
80
74
  let v = {
81
- scope: h,
82
- owner: r.key,
75
+ insertion: h,
76
+ owner: i.key,
83
77
  boundary: h.previous ? h.next ? void 0 : "end" : "start",
84
78
  plan: p,
85
79
  scopeRect: g,
@@ -118,7 +112,7 @@ function d(e, t) {
118
112
  }] : [];
119
113
  }
120
114
  function f(e, n) {
121
- if (!!n.previous != !!n.next) return (e.contextRect ?? t)({
115
+ if (!!n.previous != !!n.next) return (e.resolveScopeRect ?? t)({
122
116
  members: n.members,
123
117
  allocation: e.explorationRegions ?? e.regions,
124
118
  source: e.source
@@ -180,7 +174,7 @@ function _(e, { start: t, extent: n }) {
180
174
  if (e.boundary === "start") return e.owner[t];
181
175
  let r = e.owner[t] + e.owner[n] - 12;
182
176
  if (e.boundary === "end") return r;
183
- let i = e.sourceSlot;
177
+ let i = e.sourceReservation;
184
178
  if (e.after) return i && i[t] >= e.recipient[t] + e.recipient[n] ? (e.recipient[t] + e.recipient[n] + i[t]) / 2 - 6 : r;
185
179
  if (!e.previous) return e.owner[t];
186
180
  let a = e.previous[t] + e.previous[n];
@@ -215,18 +209,18 @@ function x(e, t) {
215
209
  return Math.abs(e.rect[r] - t.rect[r]) < 1 && Math.max(e.rect[i], t.rect[i]) < Math.min(e.rect[i] + e.rect[a], t.rect[i] + t.rect[a]);
216
210
  }
217
211
  function S(e, n) {
218
- if (e.kind !== "insert" || !e.scope.previous || !e.scope.next) return;
219
- let r = (n.contextRect ?? t)({
220
- members: e.scope.previous,
212
+ if (e.kind !== "insert" || !e.insertion.previous || !e.insertion.next) return;
213
+ let r = (n.resolveScopeRect ?? t)({
214
+ members: e.insertion.previous,
221
215
  allocation: n.regions,
222
216
  source: n.source
223
- }), i = (n.contextRect ?? t)({
224
- members: e.scope.next,
217
+ }), i = (n.resolveScopeRect ?? t)({
218
+ members: e.insertion.next,
225
219
  allocation: n.regions,
226
220
  source: n.source
227
221
  });
228
222
  if (!r || !i) return;
229
- let { normal: a, normalExtent: o, tangent: s, tangentSize: c } = C(e.scope.axis), l = i[a] - r[a] - r[o];
223
+ let { normal: a, normalExtent: o, tangent: s, tangentSize: c } = C(e.insertion.axis), l = i[a] - r[a] - r[o];
230
224
  if (Math.abs(l - n.gap) > 1) return;
231
225
  let u = Math.max(r[s], i[s]), d = Math.min(r[s] + r[c], i[s] + i[c]);
232
226
  if (!(d <= u)) return g({
@@ -237,7 +231,7 @@ function S(e, n) {
237
231
  },
238
232
  recipient: i,
239
233
  previous: r,
240
- axis: e.scope.axis,
234
+ axis: e.insertion.axis,
241
235
  after: !1
242
236
  });
243
237
  }
@@ -1 +1 @@
1
- {"version":3,"file":"insertion-offers.utils.js","names":["placementOwnsChrome","childSlot","offer","directions","findSourcePeerRegionKey","node","child","source","id","key","index","owner","createInsertionOffers","offers","seen","input","candidates","splitGroups","groupInsertions","group","a","b","members","getPanelIds","rect","getAllocatedContextRect","explorationRect","context","planWorkspacePlacement","explorationContext","insertionDestinations","receivingContext","destination","createInsertionOffer","target","direction","plan","planPlacement","slot","describePlacementSlot","domain","insertionEndcap","rectArea","edgeArea","interior","interiorInsertion","candidate","destinations","seam","getCurrentInsertionSeam","getPlacementOfferIntent","getOrderHintRect","horizontal","start","extent","normal","orderAnchor","end","previousEnd","partitionPlacementOffers","sorted","tangentExtent","placed","occupied","lane","sameEdge","other","vertical","isVerticalEdge","shift","position","tangent","previous","geometry","next","axisDimensions","gap","normalExtent","from","to","tangentSize","axis"],"sources":["../../../../src/workspace/utils/interaction/insertion-offers.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Rect } from '@nvidia-elements/core/internal';\n\nimport { getPanelIds } from '../model/layout.utils.js';\nimport { getAllocatedContextRect } from '../placement/context.utils.js';\nimport { describePlacementSlot } from '../placement/group-insertion.utils.js';\nimport { planWorkspacePlacement } from '../placement/planner.utils.js';\n\nimport type { WorkspacePlacedRegion } from '../geometry/allocation.utils.js';\nimport type { WorkspaceDropIntent } from './drag-preview.utils.js';\nimport type { WorkspaceLayout, WorkspaceNode } from '../model/layout.utils.js';\nimport type { WorkspaceDestination } from '../model/operations.utils.js';\nimport type { WorkspaceLayoutProjector } from '../model/projection.utils.js';\nimport type { WorkspaceContextRectResolver } from '../placement/context.utils.js';\nimport type { WorkspacePlacementPlan, WorkspacePlacementPlanner } from '../placement/planner.utils.js';\n\nexport interface WorkspaceInsertionOffer {\n kind: 'order' | 'insert';\n owner: string;\n boundary?: 'start' | 'end';\n scope: NonNullable<ReturnType<typeof describePlacementSlot>>;\n plan: WorkspacePlacementPlan;\n rect: Rect;\n hitRect?: Rect;\n scopeRect: Rect;\n destination: WorkspaceDestination;\n}\n\n/** Gives only an explicit peer lane or structural receiving endcap priority over chrome. */\nexport function placementOwnsChrome(offer: WorkspaceInsertionOffer) {\n const childSlot = offer.destination.region?.slice(0, offer.destination.region.lastIndexOf('.')) === offer.owner;\n return offer.kind === 'order' || !!offer.boundary || (childSlot && !!offer.scope.previous && !!offer.scope.next);\n}\n\nconst directions = ['left', 'right', 'top', 'bottom'] as const;\n\nexport function findSourcePeerRegionKey(\n node: WorkspaceNode | null,\n source: string[],\n key = 'root'\n): string | undefined {\n if (node?.type !== 'split') return undefined;\n if (node.children.some(child => child.type === 'group' && child.panels.every(id => source.includes(id)))) return key;\n for (const [index, child] of node.children.entries()) {\n const owner = findSourcePeerRegionKey(child, source, `${key}.${index}`);\n if (owner) return owner;\n }\n return undefined;\n}\n\n/** Aliases of the same planned insertion share one descriptor. */\nexport function createInsertionOffers(input: {\n currentLayout: WorkspaceLayout;\n root: WorkspaceNode | null;\n source: string[];\n available: string[];\n projectLayout?: WorkspaceLayoutProjector;\n planPlacement?: WorkspacePlacementPlanner;\n contextRect?: WorkspaceContextRectResolver;\n regions: WorkspacePlacedRegion[];\n explorationRegions?: WorkspacePlacedRegion[];\n existing: WorkspaceInsertionOffer[];\n gap: number;\n}) {\n const offers: WorkspaceInsertionOffer[] = [];\n const seen = new Set<string>();\n for (const offer of input.existing) {\n seen.add(offer.scope.key);\n offers.push(offer);\n }\n const candidates = splitGroups(input.root)\n .flatMap(group => groupInsertions(input, group))\n .sort((a, b) => Number(a.interior) - Number(b.interior));\n for (const { offer } of candidates) {\n if (seen.has(offer.scope.key)) continue;\n seen.add(offer.scope.key);\n offers.push(offer);\n }\n return offers;\n}\n\nfunction groupInsertions(\n input: Parameters<typeof createInsertionOffers>[0],\n group: { node: WorkspaceNode; key: string }\n): { offer: WorkspaceInsertionOffer; interior: boolean }[] {\n const members = getPanelIds(group.node).filter(id => !input.source.includes(id));\n const rect = (input.contextRect ?? getAllocatedContextRect)({\n members,\n allocation: input.regions,\n source: input.source\n });\n if (!rect) return [];\n const explorationRect = (input.contextRect ?? getAllocatedContextRect)({\n members,\n allocation: input.explorationRegions ?? input.regions,\n source: input.source\n });\n const context = { input, group, rect, planPlacement: input.planPlacement ?? planWorkspacePlacement };\n const explorationContext = explorationRect ? { ...context, rect: explorationRect } : undefined;\n return insertionDestinations(group).flatMap(destination => {\n // Receiving edges cannot depend on their own reservation; peer seams follow allocated neighbors.\n const receivingContext = destination.interior ? context : explorationContext;\n return receivingContext ? createInsertionOffer(receivingContext, destination) : [];\n });\n}\n\nfunction createInsertionOffer(\n {\n input,\n group,\n rect,\n planPlacement\n }: {\n input: Parameters<typeof createInsertionOffers>[0];\n group: { node: WorkspaceNode; key: string };\n rect: Rect;\n planPlacement: WorkspacePlacementPlanner;\n },\n { target, key, direction, interior }: ReturnType<typeof insertionDestinations>[number]\n): { offer: WorkspaceInsertionOffer; interior: boolean }[] {\n const destination: WorkspaceDestination = {\n target: getPanelIds(target).find(id => !input.source.includes(id)) ?? '',\n region: key,\n position: direction\n };\n const plan = planPlacement({\n layout: input.currentLayout,\n source: input.source,\n destination,\n available: input.available,\n projectLayout: input.projectLayout,\n operation: 'insert'\n });\n if (!plan) return [];\n const slot = describePlacementSlot({\n plan,\n source: input.source,\n available: input.available,\n projectLayout: input.projectLayout\n });\n if (!slot) return [];\n const domain = insertionEndcap(input, slot) ?? rect;\n const rectArea = edgeArea(domain, direction);\n if (!rectArea) return [];\n const offer: WorkspaceInsertionOffer = {\n scope: slot,\n owner: group.key,\n boundary: !slot.previous ? 'start' : !slot.next ? 'end' : undefined,\n plan,\n scopeRect: domain,\n rect: rectArea,\n destination,\n kind: plan.kind === 'reorder' ? 'order' : 'insert'\n };\n return (interior ? interiorInsertion(offer, input) : [offer]).map(candidate => ({ offer: candidate, interior }));\n}\n\nfunction insertionDestinations(group: { node: WorkspaceNode; key: string }) {\n const destinations = directions.map(direction => ({\n target: group.node,\n key: group.key,\n direction,\n interior: false\n }));\n if (group.node.type === 'split') {\n const direction = group.node.axis === 'horizontal' ? 'left' : 'top';\n group.node.children.slice(1).forEach((target, index) =>\n destinations.push({\n target,\n key: `${group.key}.${index + 1}`,\n direction,\n interior: true\n })\n );\n }\n return destinations;\n}\n\nfunction interiorInsertion(\n offer: WorkspaceInsertionOffer,\n input: Parameters<typeof createInsertionOffers>[0]\n): WorkspaceInsertionOffer[] {\n const seam = getCurrentInsertionSeam(offer, input);\n return seam ? [{ ...offer, rect: seam }] : [];\n}\n\nfunction insertionEndcap(\n input: Parameters<typeof createInsertionOffers>[0],\n slot: NonNullable<ReturnType<typeof describePlacementSlot>>\n) {\n if (!!slot.previous === !!slot.next) return undefined;\n return (input.contextRect ?? getAllocatedContextRect)({\n members: slot.members,\n allocation: input.explorationRegions ?? input.regions,\n source: input.source\n });\n}\n\nfunction splitGroups(node: WorkspaceNode | null, key = 'root'): { key: string; node: WorkspaceNode }[] {\n return node?.type === 'split'\n ? [{ key, node }, ...node.children.flatMap((child, index) => splitGroups(child, `${key}.${index}`))]\n : [];\n}\n\nfunction edgeArea(rect: Rect, direction: (typeof directions)[number]): Rect | undefined {\n if (direction === 'left' || direction === 'right')\n return 12 <= rect.width\n ? {\n x: direction === 'left' ? rect.x : rect.x + rect.width - 12,\n y: rect.y,\n width: 12,\n height: rect.height\n }\n : undefined;\n return 12 <= rect.height\n ? {\n x: rect.x,\n y: direction === 'top' ? rect.y : rect.y + rect.height - 12,\n width: rect.width,\n height: 12\n }\n : undefined;\n}\n\n/** Shares the painted descriptor's exact operation with input resolution. */\nexport function getPlacementOfferIntent(offer: WorkspaceInsertionOffer): WorkspaceDropIntent {\n if (offer.destination.position === 'tab') return { kind: 'invalid' };\n const destination = { ...offer.destination, position: offer.destination.position };\n return offer.kind === 'insert' ? { kind: 'insert', destination } : { kind: 'order', destination };\n}\n\n/** Locates ordering availability in the computed exploration geometry, not a prospective landing. */\nexport function getOrderHintRect(input: {\n owner: Rect;\n recipient: Rect;\n previous?: Rect;\n axis: 'horizontal' | 'vertical';\n after: boolean;\n sourceSlot?: Rect;\n boundary?: 'start' | 'end';\n}): Rect | undefined {\n const horizontal = input.axis === 'horizontal';\n const start = horizontal ? 'x' : 'y';\n const extent = horizontal ? 'width' : 'height';\n if (input.owner[extent] < 12) return undefined;\n const normal = orderAnchor(input, { start, extent });\n return horizontal\n ? { x: normal, y: input.owner.y, width: 12, height: input.owner.height }\n : { x: input.owner.x, y: normal, width: input.owner.width, height: 12 };\n}\n\nfunction orderAnchor(\n input: Parameters<typeof getOrderHintRect>[0],\n { start, extent }: { start: 'x' | 'y'; extent: 'width' | 'height' }\n) {\n if (input.boundary === 'start') return input.owner[start];\n const end = input.owner[start] + input.owner[extent] - 12;\n if (input.boundary === 'end') return end;\n const slot = input.sourceSlot;\n if (input.after)\n return slot && slot[start] >= input.recipient[start] + input.recipient[extent]\n ? (input.recipient[start] + input.recipient[extent] + slot[start]) / 2 - 6\n : end;\n if (!input.previous) return input.owner[start];\n const previousEnd = input.previous[start] + input.previous[extent];\n const nextStart =\n slot && slot[start] >= previousEnd && slot[start] < input.recipient[start] ? slot[start] : input.recipient[start];\n return (previousEnd + nextStart) / 2 - 6;\n}\n\n/** Orders overlapping scope offers into lanes from outermost to innermost. */\nexport function partitionPlacementOffers(offers: WorkspaceInsertionOffer[]): WorkspaceInsertionOffer[] {\n const sorted = [...offers].sort((a, b) => tangentExtent(b) - tangentExtent(a));\n const placed: WorkspaceInsertionOffer[] = [];\n const occupied: WorkspaceInsertionOffer[] = [];\n for (const offer of sorted) {\n const lane = occupied.filter(other => sameEdge(offer, other)).length;\n occupied.push(offer);\n const vertical = isVerticalEdge(offer.destination.position);\n const shift =\n (offer.destination.position === 'right' || offer.destination.position === 'bottom' ? -1 : 1) * lane * 12;\n const rect = { ...offer.rect, x: offer.rect.x + (vertical ? shift : 0), y: offer.rect.y + (vertical ? 0 : shift) };\n if (\n rect.x < offer.scopeRect.x ||\n rect.y < offer.scopeRect.y ||\n rect.x + rect.width > offer.scopeRect.x + offer.scopeRect.width ||\n rect.y + rect.height > offer.scopeRect.y + offer.scopeRect.height\n ) {\n continue;\n }\n placed.push({ ...offer, rect });\n }\n return placed;\n}\n\nfunction isVerticalEdge(position: WorkspaceDestination['position']) {\n return position === 'left' || position === 'right';\n}\n\nfunction tangentExtent(offer: WorkspaceInsertionOffer) {\n return offer.destination.position === 'left' || offer.destination.position === 'right'\n ? offer.rect.height\n : offer.rect.width;\n}\n\nfunction sameEdge(a: WorkspaceInsertionOffer, b: WorkspaceInsertionOffer) {\n if (a.destination.position !== b.destination.position) return false;\n const vertical = isVerticalEdge(a.destination.position);\n const normal = vertical ? 'x' : 'y';\n const tangent = vertical ? 'y' : 'x';\n const extent = vertical ? 'height' : 'width';\n return (\n Math.abs(a.rect[normal] - b.rect[normal]) < 1 &&\n Math.max(a.rect[tangent], b.rect[tangent]) <\n Math.min(a.rect[tangent] + a.rect[extent], b.rect[tangent] + b.rect[extent])\n );\n}\n\n/** Uses current peer geometry for interior insertion cues, before allocating the candidate. */\nexport function getCurrentInsertionSeam(\n offer: WorkspaceInsertionOffer,\n geometry: {\n regions: WorkspacePlacedRegion[];\n source: string[];\n gap: number;\n contextRect?: WorkspaceContextRectResolver;\n }\n): Rect | undefined {\n if (offer.kind !== 'insert' || !offer.scope.previous || !offer.scope.next) return undefined;\n const previous = (geometry.contextRect ?? getAllocatedContextRect)({\n members: offer.scope.previous,\n allocation: geometry.regions,\n source: geometry.source\n });\n const next = (geometry.contextRect ?? getAllocatedContextRect)({\n members: offer.scope.next,\n allocation: geometry.regions,\n source: geometry.source\n });\n if (!previous || !next) return undefined;\n const { normal, normalExtent, tangent, tangentSize } = axisDimensions(offer.scope.axis);\n const gap = next[normal] - previous[normal] - previous[normalExtent];\n if (Math.abs(gap - geometry.gap) > 1) return undefined;\n const from = Math.max(previous[tangent], next[tangent]);\n const to = Math.min(previous[tangent] + previous[tangentSize], next[tangent] + next[tangentSize]);\n if (to <= from) return undefined;\n const owner = { ...offer.scopeRect, [tangent]: from, [tangentSize]: to - from };\n return getOrderHintRect({ owner, recipient: next, previous, axis: offer.scope.axis, after: false });\n}\n\nfunction axisDimensions(axis: 'horizontal' | 'vertical') {\n return axis === 'horizontal'\n ? ({ normal: 'x', normalExtent: 'width', tangent: 'y', tangentSize: 'height' } as const)\n : ({ normal: 'y', normalExtent: 'height', tangent: 'x', tangentSize: 'width' } as const);\n}\n"],"mappings":";;;;;AA+BA,SAAgBA,EAAoB,GAAg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YuE,EAAS;EACrB,QAAQA,EAAS;CACnB,CAAC;CACD,IAAI,CAACD,KAAY,CAACE,GAAM;CACxB,IAAM,EAAE,WAAQ,iBAAc,YAAS,mBAAgBC,EAAezE,EAAM,MAAM,IAAI,GAChF0E,IAAMF,EAAKnB,KAAUiB,EAASjB,KAAUiB,EAASK;CACvD,IAAI,KAAK,IAAID,IAAMH,EAAS,GAAG,IAAI,GAAG;CACtC,IAAMK,IAAO,KAAK,IAAIN,EAASD,IAAUG,EAAKH,EAAQ,GAChDQ,IAAK,KAAK,IAAIP,EAASD,KAAWC,EAASQ,IAAcN,EAAKH,KAAWG,EAAKM,EAAY;CAChG,IAAI,OAAMF,IAEV,OAAO3B,EAAiB;EAAE,OAAA;GADV,GAAGjD,EAAM;IAAYqE,IAAUO;IAAOE,IAAcD,IAAKD;EAC/C;EAAO,WAAWJ;EAAM;EAAU,MAAMxE,EAAM,MAAM;EAAM,OAAO;CAAM,CAAC;AACpG;AAEA,SAASyE,EAAe,GAAiC;CACvD,OAAOM,MAAS,eACX;EAAE,QAAQ;EAAK,cAAc;EAAS,SAAS;EAAK,aAAa;CAAS,IAC1E;EAAE,QAAQ;EAAK,cAAc;EAAU,SAAS;EAAK,aAAa;CAAQ;AACjF"}
1
+ {"version":3,"file":"insertion-offers.utils.js","names":["placementOwnsChrome","targetsDirectChild","offer","directions","findSourcePeerRegionKey","node","child","source","id","key","index","owner","createInsertionOffers","offers","seen","input","candidates","splitGroups","groupInsertions","group","a","b","members","getPanelIds","rect","getAllocatedScopeRect","explorationRect","context","explorationContext","insertionDestinations","receivingContext","destination","createInsertionOffer","target","direction","plan","resolvePlacementPlan","insertion","getGroupInsertion","domain","insertionEndcap","rectArea","edgeArea","interior","interiorInsertion","candidate","destinations","seam","getCurrentInsertionSeam","getPlacementOfferIntent","getOrderHintRect","horizontal","start","extent","normal","orderAnchor","end","sourceReservation","previousEnd","partitionPlacementOffers","sorted","tangentExtent","placed","occupied","lane","sameEdge","other","vertical","isVerticalEdge","shift","position","tangent","previous","geometry","next","axisDimensions","gap","normalExtent","from","to","tangentSize","axis"],"sources":["../../../../src/workspace/utils/interaction/insertion-offers.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Rect } from '@nvidia-elements/core/internal';\n\nimport { getPanelIds } from '../model/layout.utils.js';\nimport { getGroupInsertion } from '../placement/group-insertion.utils.js';\nimport { resolvePlacementPlan } from '../placement/planner.utils.js';\nimport { getAllocatedScopeRect } from '../placement/scope.utils.js';\n\nimport type { WorkspacePlacedRegion } from '../geometry/allocation.utils.js';\nimport type { WorkspaceDropIntent } from './drag-preview.utils.js';\nimport type { WorkspaceLayout, WorkspaceNode } from '../model/layout.utils.js';\nimport type { WorkspaceDestination } from '../model/operations.utils.js';\nimport type { WorkspaceLayoutProjector } from '../model/projection.utils.js';\nimport type { GroupInsertion } from '../placement/group-insertion.utils.js';\nimport type { WorkspacePlacementPlan, WorkspacePlacementPlanner } from '../placement/planner.utils.js';\nimport type { WorkspaceScopeRectResolver } from '../placement/scope.utils.js';\nimport type { WorkspacePlacementSession } from '../placement/session.utils.js';\n\nexport interface WorkspaceInsertionOffer {\n kind: 'order' | 'insert';\n owner: string;\n boundary?: 'start' | 'end';\n insertion: GroupInsertion;\n plan: WorkspacePlacementPlan;\n rect: Rect;\n hitRect?: Rect;\n scopeRect: Rect;\n destination: WorkspaceDestination;\n}\n\n/** Gives only an explicit peer lane or structural receiving endcap priority over chrome. */\nexport function placementOwnsChrome(offer: WorkspaceInsertionOffer) {\n const targetsDirectChild =\n offer.destination.region?.slice(0, offer.destination.region.lastIndexOf('.')) === offer.owner;\n return (\n offer.kind === 'order' ||\n !!offer.boundary ||\n (targetsDirectChild && !!offer.insertion.previous && !!offer.insertion.next)\n );\n}\n\nconst directions = ['left', 'right', 'top', 'bottom'] as const;\n\nexport function findSourcePeerRegionKey(\n node: WorkspaceNode | null,\n source: string[],\n key = 'root'\n): string | undefined {\n if (node?.type !== 'split') return undefined;\n if (node.children.some(child => child.type === 'group' && child.panels.every(id => source.includes(id)))) return key;\n for (const [index, child] of node.children.entries()) {\n const owner = findSourcePeerRegionKey(child, source, `${key}.${index}`);\n if (owner) return owner;\n }\n return undefined;\n}\n\n/** Aliases of the same planned insertion share one offer. */\nexport function createInsertionOffers(input: {\n currentLayout: WorkspaceLayout;\n root: WorkspaceNode | null;\n source: string[];\n available: string[];\n projectLayout?: WorkspaceLayoutProjector;\n planPlacement?: WorkspacePlacementPlanner;\n placementSession?: WorkspacePlacementSession;\n resolveScopeRect?: WorkspaceScopeRectResolver;\n regions: WorkspacePlacedRegion[];\n explorationRegions?: WorkspacePlacedRegion[];\n existing: WorkspaceInsertionOffer[];\n gap: number;\n}) {\n const offers: WorkspaceInsertionOffer[] = [];\n const seen = new Set<string>();\n for (const offer of input.existing) {\n seen.add(offer.insertion.key);\n offers.push(offer);\n }\n const candidates = splitGroups(input.root)\n .flatMap(group => groupInsertions(input, group))\n .sort((a, b) => Number(a.interior) - Number(b.interior));\n for (const { offer } of candidates) {\n if (seen.has(offer.insertion.key)) continue;\n seen.add(offer.insertion.key);\n offers.push(offer);\n }\n return offers;\n}\n\nfunction groupInsertions(\n input: Parameters<typeof createInsertionOffers>[0],\n group: { node: WorkspaceNode; key: string }\n): { offer: WorkspaceInsertionOffer; interior: boolean }[] {\n const members = getPanelIds(group.node).filter(id => !input.source.includes(id));\n const rect = (input.resolveScopeRect ?? getAllocatedScopeRect)({\n members,\n allocation: input.regions,\n source: input.source\n });\n if (!rect) return [];\n const explorationRect = (input.resolveScopeRect ?? getAllocatedScopeRect)({\n members,\n allocation: input.explorationRegions ?? input.regions,\n source: input.source\n });\n const context = { input, group, rect };\n const explorationContext = explorationRect ? { ...context, rect: explorationRect } : undefined;\n return insertionDestinations(group).flatMap(destination => {\n // Receiving edges cannot depend on their own reservation; peer seams follow allocated neighbors.\n const receivingContext = destination.interior ? context : explorationContext;\n return receivingContext ? createInsertionOffer(receivingContext, destination) : [];\n });\n}\n\nfunction createInsertionOffer(\n {\n input,\n group,\n rect\n }: {\n input: Parameters<typeof createInsertionOffers>[0];\n group: { node: WorkspaceNode; key: string };\n rect: Rect;\n },\n { target, key, direction, interior }: ReturnType<typeof insertionDestinations>[number]\n): { offer: WorkspaceInsertionOffer; interior: boolean }[] {\n const destination: WorkspaceDestination = {\n target: getPanelIds(target).find(id => !input.source.includes(id)) ?? '',\n region: key,\n position: direction\n };\n const plan = resolvePlacementPlan(input, destination, 'insert');\n if (!plan) return [];\n const insertion = getGroupInsertion({\n plan,\n source: input.source,\n available: input.available,\n projectLayout: input.projectLayout,\n placementSession: input.placementSession,\n planPlacement: input.planPlacement\n });\n if (!insertion) return [];\n const domain = insertionEndcap(input, insertion) ?? rect;\n const rectArea = edgeArea(domain, direction);\n if (!rectArea) return [];\n const offer: WorkspaceInsertionOffer = {\n insertion,\n owner: group.key,\n boundary: !insertion.previous ? 'start' : !insertion.next ? 'end' : undefined,\n plan,\n scopeRect: domain,\n rect: rectArea,\n destination,\n kind: plan.kind === 'reorder' ? 'order' : 'insert'\n };\n return (interior ? interiorInsertion(offer, input) : [offer]).map(candidate => ({ offer: candidate, interior }));\n}\n\nfunction insertionDestinations(group: { node: WorkspaceNode; key: string }) {\n const destinations = directions.map(direction => ({\n target: group.node,\n key: group.key,\n direction,\n interior: false\n }));\n if (group.node.type === 'split') {\n const direction = group.node.axis === 'horizontal' ? 'left' : 'top';\n group.node.children.slice(1).forEach((target, index) =>\n destinations.push({\n target,\n key: `${group.key}.${index + 1}`,\n direction,\n interior: true\n })\n );\n }\n return destinations;\n}\n\nfunction interiorInsertion(\n offer: WorkspaceInsertionOffer,\n input: Parameters<typeof createInsertionOffers>[0]\n): WorkspaceInsertionOffer[] {\n const seam = getCurrentInsertionSeam(offer, input);\n return seam ? [{ ...offer, rect: seam }] : [];\n}\n\nfunction insertionEndcap(input: Parameters<typeof createInsertionOffers>[0], insertion: GroupInsertion) {\n if (!!insertion.previous === !!insertion.next) return undefined;\n return (input.resolveScopeRect ?? getAllocatedScopeRect)({\n members: insertion.members,\n allocation: input.explorationRegions ?? input.regions,\n source: input.source\n });\n}\n\nfunction splitGroups(node: WorkspaceNode | null, key = 'root'): { key: string; node: WorkspaceNode }[] {\n return node?.type === 'split'\n ? [{ key, node }, ...node.children.flatMap((child, index) => splitGroups(child, `${key}.${index}`))]\n : [];\n}\n\nfunction edgeArea(rect: Rect, direction: (typeof directions)[number]): Rect | undefined {\n if (direction === 'left' || direction === 'right')\n return 12 <= rect.width\n ? {\n x: direction === 'left' ? rect.x : rect.x + rect.width - 12,\n y: rect.y,\n width: 12,\n height: rect.height\n }\n : undefined;\n return 12 <= rect.height\n ? {\n x: rect.x,\n y: direction === 'top' ? rect.y : rect.y + rect.height - 12,\n width: rect.width,\n height: 12\n }\n : undefined;\n}\n\n/** Shares the painted offer's exact operation with input resolution. */\nexport function getPlacementOfferIntent(offer: WorkspaceInsertionOffer): WorkspaceDropIntent {\n if (offer.destination.position === 'tab') return { kind: 'invalid' };\n const destination = { ...offer.destination, position: offer.destination.position };\n return offer.kind === 'insert' ? { kind: 'insert', destination } : { kind: 'order', destination };\n}\n\n/** Locates ordering availability in the computed exploration geometry, not a prospective landing. */\nexport function getOrderHintRect(input: {\n owner: Rect;\n recipient: Rect;\n previous?: Rect;\n axis: 'horizontal' | 'vertical';\n after: boolean;\n sourceReservation?: Rect;\n boundary?: 'start' | 'end';\n}): Rect | undefined {\n const horizontal = input.axis === 'horizontal';\n const start = horizontal ? 'x' : 'y';\n const extent = horizontal ? 'width' : 'height';\n if (input.owner[extent] < 12) return undefined;\n const normal = orderAnchor(input, { start, extent });\n return horizontal\n ? { x: normal, y: input.owner.y, width: 12, height: input.owner.height }\n : { x: input.owner.x, y: normal, width: input.owner.width, height: 12 };\n}\n\nfunction orderAnchor(\n input: Parameters<typeof getOrderHintRect>[0],\n { start, extent }: { start: 'x' | 'y'; extent: 'width' | 'height' }\n) {\n if (input.boundary === 'start') return input.owner[start];\n const end = input.owner[start] + input.owner[extent] - 12;\n if (input.boundary === 'end') return end;\n const sourceReservation = input.sourceReservation;\n if (input.after)\n return sourceReservation && sourceReservation[start] >= input.recipient[start] + input.recipient[extent]\n ? (input.recipient[start] + input.recipient[extent] + sourceReservation[start]) / 2 - 6\n : end;\n if (!input.previous) return input.owner[start];\n const previousEnd = input.previous[start] + input.previous[extent];\n const nextStart =\n sourceReservation && sourceReservation[start] >= previousEnd && sourceReservation[start] < input.recipient[start]\n ? sourceReservation[start]\n : input.recipient[start];\n return (previousEnd + nextStart) / 2 - 6;\n}\n\n/** Orders overlapping insertion offers into lanes from outermost to innermost. */\nexport function partitionPlacementOffers(offers: WorkspaceInsertionOffer[]): WorkspaceInsertionOffer[] {\n const sorted = [...offers].sort((a, b) => tangentExtent(b) - tangentExtent(a));\n const placed: WorkspaceInsertionOffer[] = [];\n const occupied: WorkspaceInsertionOffer[] = [];\n for (const offer of sorted) {\n const lane = occupied.filter(other => sameEdge(offer, other)).length;\n occupied.push(offer);\n const vertical = isVerticalEdge(offer.destination.position);\n const shift =\n (offer.destination.position === 'right' || offer.destination.position === 'bottom' ? -1 : 1) * lane * 12;\n const rect = { ...offer.rect, x: offer.rect.x + (vertical ? shift : 0), y: offer.rect.y + (vertical ? 0 : shift) };\n if (\n rect.x < offer.scopeRect.x ||\n rect.y < offer.scopeRect.y ||\n rect.x + rect.width > offer.scopeRect.x + offer.scopeRect.width ||\n rect.y + rect.height > offer.scopeRect.y + offer.scopeRect.height\n ) {\n continue;\n }\n placed.push({ ...offer, rect });\n }\n return placed;\n}\n\nfunction isVerticalEdge(position: WorkspaceDestination['position']) {\n return position === 'left' || position === 'right';\n}\n\nfunction tangentExtent(offer: WorkspaceInsertionOffer) {\n return offer.destination.position === 'left' || offer.destination.position === 'right'\n ? offer.rect.height\n : offer.rect.width;\n}\n\nfunction sameEdge(a: WorkspaceInsertionOffer, b: WorkspaceInsertionOffer) {\n if (a.destination.position !== b.destination.position) return false;\n const vertical = isVerticalEdge(a.destination.position);\n const normal = vertical ? 'x' : 'y';\n const tangent = vertical ? 'y' : 'x';\n const extent = vertical ? 'height' : 'width';\n return (\n Math.abs(a.rect[normal] - b.rect[normal]) < 1 &&\n Math.max(a.rect[tangent], b.rect[tangent]) <\n Math.min(a.rect[tangent] + a.rect[extent], b.rect[tangent] + b.rect[extent])\n );\n}\n\n/** Uses current peer geometry for interior insertion cues, before allocating the candidate. */\nexport function getCurrentInsertionSeam(\n offer: WorkspaceInsertionOffer,\n geometry: {\n regions: WorkspacePlacedRegion[];\n source: string[];\n gap: number;\n resolveScopeRect?: WorkspaceScopeRectResolver;\n }\n): Rect | undefined {\n if (offer.kind !== 'insert' || !offer.insertion.previous || !offer.insertion.next) return undefined;\n const previous = (geometry.resolveScopeRect ?? getAllocatedScopeRect)({\n members: offer.insertion.previous,\n allocation: geometry.regions,\n source: geometry.source\n });\n const next = (geometry.resolveScopeRect ?? getAllocatedScopeRect)({\n members: offer.insertion.next,\n allocation: geometry.regions,\n source: geometry.source\n });\n if (!previous || !next) return undefined;\n const { normal, normalExtent, tangent, tangentSize } = axisDimensions(offer.insertion.axis);\n const gap = next[normal] - previous[normal] - previous[normalExtent];\n if (Math.abs(gap - geometry.gap) > 1) return undefined;\n const from = Math.max(previous[tangent], next[tangent]);\n const to = Math.min(previous[tangent] + previous[tangentSize], next[tangent] + next[tangentSize]);\n if (to <= from) return undefined;\n const owner = { ...offer.scopeRect, [tangent]: from, [tangentSize]: to - from };\n return getOrderHintRect({ owner, recipient: next, previous, axis: offer.insertion.axis, after: false });\n}\n\nfunction axisDimensions(axis: 'horizontal' | 'vertical') {\n return axis === 'horizontal'\n ? ({ normal: 'x', normalExtent: 'width', tangent: 'y', tangentSize: 'height' } as const)\n : ({ normal: 'y', normalExtent: 'height', tangent: 'x', tangentSize: 'width' } as const);\n}\n"],"mappings":";;;;;AAiCA,SAAgBA,EAAoB,GAAg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AY,CAACE,GAAM;CACxB,IAAM,EAAE,WAAQ,iBAAc,YAAS,mBAAgBC,EAAezE,EAAM,UAAU,IAAI,GACpF0E,IAAMF,EAAKpB,KAAUkB,EAASlB,KAAUkB,EAASK;CACvD,IAAI,KAAK,IAAID,IAAMH,EAAS,GAAG,IAAI,GAAG;CACtC,IAAMK,IAAO,KAAK,IAAIN,EAASD,IAAUG,EAAKH,EAAQ,GAChDQ,IAAK,KAAK,IAAIP,EAASD,KAAWC,EAASQ,IAAcN,EAAKH,KAAWG,EAAKM,EAAY;CAChG,IAAI,OAAMF,IAEV,OAAO5B,EAAiB;EAAE,OAAA;GADV,GAAGhD,EAAM;IAAYqE,IAAUO;IAAOE,IAAcD,IAAKD;EAC/C;EAAO,WAAWJ;EAAM;EAAU,MAAMxE,EAAM,UAAU;EAAM,OAAO;CAAM,CAAC;AACxG;AAEA,SAASyE,EAAe,GAAiC;CACvD,OAAOM,MAAS,eACX;EAAE,QAAQ;EAAK,cAAc;EAAS,SAAS;EAAK,aAAa;CAAS,IAC1E;EAAE,QAAQ;EAAK,cAAc;EAAU,SAAS;EAAK,aAAa;CAAQ;AACjF"}
@@ -5,14 +5,17 @@ import type { WorkspaceInsertionOffer } from './insertion-offers.utils.js';
5
5
  import type { WorkspaceLayout, WorkspaceNode } from '../model/layout.utils.js';
6
6
  import type { WorkspaceLayoutProjector } from '../model/projection.utils.js';
7
7
  import type { WorkspacePlacementPlanner } from '../placement/planner.utils.js';
8
+ import type { WorkspaceScopeRectResolver } from '../placement/scope.utils.js';
9
+ import type { WorkspacePlacementSession } from '../placement/session.utils.js';
8
10
  import type { WorkspacePlacementCatalog } from '../evaluation.utils.js';
9
11
  interface WorkspacePlacementQuery {
12
+ resolveScopeRect?: WorkspaceScopeRectResolver;
10
13
  gap: number;
11
14
  source: string[];
12
15
  point: Point;
13
16
  regions: WorkspacePlacedRegion[];
14
17
  orderingRegions?: WorkspacePlacedRegion[];
15
- sourceSlot?: Rect;
18
+ sourceReservation?: Rect;
16
19
  headers?: Rect[];
17
20
  preview?: WorkspaceDragPreview;
18
21
  local?: WorkspaceDropIntent;
@@ -24,6 +27,7 @@ type DecisionInput = WorkspacePlacementQuery & {
24
27
  available: string[];
25
28
  projectLayout?: WorkspaceLayoutProjector;
26
29
  planPlacement?: WorkspacePlacementPlanner;
30
+ placementSession?: WorkspacePlacementSession;
27
31
  };
28
32
  export interface WorkspacePlacementDecision {
29
33
  intent: WorkspaceDropIntent | undefined;
@@ -41,6 +45,7 @@ interface PointerPlacementInput {
41
45
  available: string[];
42
46
  projectLayout?: WorkspaceLayoutProjector;
43
47
  planPlacement?: WorkspacePlacementPlanner;
48
+ placementSession?: WorkspacePlacementSession;
44
49
  }
45
50
  export declare function decidePointerPlacement(input: PointerPlacementInput): WorkspacePlacementDecision;
46
51
  /** Chooses input and availability together from the two operation-specific computed projections. */