@cat-factory/app 0.79.1 → 0.79.2
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/app/components/board/BoardCanvas.vue +7 -1
- package/app/components/bootstrap/BootstrapModal.vue +18 -0
- package/app/components/github/AddServiceFromRepoModal.vue +6 -0
- package/app/composables/useFramePlacement.ts +91 -0
- package/app/stores/board.ts +7 -1
- package/app/utils/framePlacement.spec.ts +73 -0
- package/app/utils/framePlacement.ts +103 -0
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ import { BOARD_FLOW_ID } from '~/composables/useBoardFlow'
|
|
|
10
10
|
import { useTaskExpansion } from '~/composables/useTaskExpansion'
|
|
11
11
|
import { useBlockDrag } from '~/composables/useBlockDrag'
|
|
12
12
|
import { useFrameStacking } from '~/composables/useFrameStacking'
|
|
13
|
+
import { useFramePlacement } from '~/composables/useFramePlacement'
|
|
13
14
|
import { useViewport } from '~/composables/useViewport'
|
|
14
15
|
import { boardPanMode } from '~/utils/boardPanMode'
|
|
15
16
|
|
|
@@ -24,6 +25,7 @@ const { t } = useI18n()
|
|
|
24
25
|
const { onNodeDragStop, onViewportChange, screenToFlowCoordinate } = useVueFlow(BOARD_FLOW_ID)
|
|
25
26
|
const { draggingId } = useBlockDrag()
|
|
26
27
|
const { hoveredFrameId } = useFrameStacking()
|
|
28
|
+
const { freeFramePosition, focusFrame } = useFramePlacement()
|
|
27
29
|
// Touch drives the canvas gestures: a touch-capable surface needs one-finger pan.
|
|
28
30
|
// We gate on `hasTouch` (any-pointer: coarse), not `isTouch` (the *primary* pointer),
|
|
29
31
|
// so a touchscreen laptop / 2-in-1 — whose primary pointer is the trackpad — still
|
|
@@ -121,10 +123,14 @@ async function onDrop(event: DragEvent) {
|
|
|
121
123
|
if (!payload) return
|
|
122
124
|
|
|
123
125
|
if (payload.kind === 'block') {
|
|
124
|
-
|
|
126
|
+
// Drop where the cursor is, but nudge off any existing frame it lands on so a new
|
|
127
|
+
// frame never overlaps a neighbour; then centre the camera on it.
|
|
128
|
+
const dropped = screenToFlowCoordinate({ x: event.clientX, y: event.clientY })
|
|
129
|
+
const position = freeFramePosition({ near: dropped })
|
|
125
130
|
try {
|
|
126
131
|
const block = await board.addBlock(payload.blockType, position)
|
|
127
132
|
ui.select(block.id)
|
|
133
|
+
await focusFrame(block.id)
|
|
128
134
|
} catch {
|
|
129
135
|
toast.add({
|
|
130
136
|
title: t('board.canvas.addBlockFailedTitle'),
|
|
@@ -13,7 +13,9 @@ const ui = useUiStore()
|
|
|
13
13
|
const bootstrap = useBootstrapStore()
|
|
14
14
|
const agentRuns = useAgentRunsStore()
|
|
15
15
|
const github = useGitHubStore()
|
|
16
|
+
const board = useBoardStore()
|
|
16
17
|
const toast = useToast()
|
|
18
|
+
const { freeFramePosition, focusFrame } = useFramePlacement()
|
|
17
19
|
const { t } = useI18n()
|
|
18
20
|
const { confirmAction, toastDone } = useConfirmAction()
|
|
19
21
|
|
|
@@ -242,6 +244,22 @@ async function launch() {
|
|
|
242
244
|
instructions.value = ''
|
|
243
245
|
// Reset the repo role too, so a later bootstrap doesn't silently inherit this one's type.
|
|
244
246
|
selectedType.value = 'service'
|
|
247
|
+
// The provisional frame arrived (bootstrap() refreshed the board). Re-home it to
|
|
248
|
+
// free space so it never overlaps an existing service — the backend places it on a
|
|
249
|
+
// fixed diagonal stagger that can land on top of a large neighbour — then centre the
|
|
250
|
+
// camera on it. Best-effort: the run has already started, so a placement hiccup must
|
|
251
|
+
// NOT surface a bootstrap-failed toast or leave the dialog open — swallow it here
|
|
252
|
+
// rather than letting it reach the outer catch.
|
|
253
|
+
if (job.blockId && board.getBlock(job.blockId)) {
|
|
254
|
+
const id = job.blockId
|
|
255
|
+
try {
|
|
256
|
+
const position = freeFramePosition({ size: board.containerSize(id), exclude: id })
|
|
257
|
+
await board.moveBlock(id, position)
|
|
258
|
+
await focusFrame(id)
|
|
259
|
+
} catch {
|
|
260
|
+
// Placement is cosmetic; the run is tracked on the board regardless.
|
|
261
|
+
}
|
|
262
|
+
}
|
|
245
263
|
// The run is now tracked on the board, so get out of the way: close the
|
|
246
264
|
// dialog as soon as bootstrapping has actually started.
|
|
247
265
|
ui.closeBootstrap()
|
|
@@ -28,6 +28,7 @@ const ui = useUiStore()
|
|
|
28
28
|
const github = useGitHubStore()
|
|
29
29
|
const board = useBoardStore()
|
|
30
30
|
const toast = useToast()
|
|
31
|
+
const { freeFramePosition, focusFrame } = useFramePlacement()
|
|
31
32
|
|
|
32
33
|
const open = computed({
|
|
33
34
|
get: () => ui.addServiceOpen,
|
|
@@ -218,9 +219,14 @@ async function add() {
|
|
|
218
219
|
directory: isMonorepo.value ? selectedDirectory.value : undefined,
|
|
219
220
|
isMonorepo: isMonorepo.value,
|
|
220
221
|
type: selectedType.value,
|
|
222
|
+
// Place the imported frame in free space (centred in view) instead of the
|
|
223
|
+
// backend's default stagger, so it never overlaps an existing service.
|
|
224
|
+
position: freeFramePosition(),
|
|
221
225
|
})
|
|
222
226
|
// Refresh the projection so the new repo↔block link is reflected locally.
|
|
223
227
|
await github.load()
|
|
228
|
+
// Centre the camera on the newly imported service.
|
|
229
|
+
await focusFrame(block.id)
|
|
224
230
|
configuredBlockId.value = block.id
|
|
225
231
|
configuredDirectory.value = isMonorepo.value ? selectedDirectory.value : undefined
|
|
226
232
|
toast.add({
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { nextTick } from 'vue'
|
|
2
|
+
import { useVueFlow } from '@vue-flow/core'
|
|
3
|
+
import { BOARD_FLOW_ID } from '~/composables/useBoardFlow'
|
|
4
|
+
import {
|
|
5
|
+
EMPTY_FRAME_SIZE,
|
|
6
|
+
EPIC_NODE_SIZE,
|
|
7
|
+
findFreeFramePosition,
|
|
8
|
+
type Point,
|
|
9
|
+
type FrameRect,
|
|
10
|
+
} from '~/utils/framePlacement'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Placement + camera helpers for adding a service frame to the board, honouring the
|
|
14
|
+
* house rule: a new frame never overlaps an existing one and the camera centres on it.
|
|
15
|
+
*
|
|
16
|
+
* The board (Vue Flow) is the single source of truth for the camera, so this lives in a
|
|
17
|
+
* composable rather than the board store — every "add a frame" call site (palette drop,
|
|
18
|
+
* repo import, repo bootstrap) runs it right after the block exists.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The floor we snap the camera zoom up to when centring a new frame, so one added while
|
|
23
|
+
* the board is zoomed far out still lands legibly on screen. We only ever zoom the user
|
|
24
|
+
* *in* to this floor — a closer zoom is left alone (`Math.max`).
|
|
25
|
+
*/
|
|
26
|
+
const MIN_FOCUS_ZOOM = 0.6
|
|
27
|
+
|
|
28
|
+
export function useFramePlacement() {
|
|
29
|
+
const board = useBoardStore()
|
|
30
|
+
const { viewport, setCenter, screenToFlowCoordinate } = useVueFlow(BOARD_FLOW_ID)
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Every existing top-level board node's rect in flow-space — both service frames
|
|
34
|
+
* (stored position + rendered size) and epic grouping cards — so a placed frame
|
|
35
|
+
* clears epics as well as frames (both are drawn as Vue Flow nodes; see `BoardCanvas`).
|
|
36
|
+
*/
|
|
37
|
+
function existingNodeRects(exclude?: string): FrameRect[] {
|
|
38
|
+
const frames = board.frames
|
|
39
|
+
.filter((f) => f.id !== exclude)
|
|
40
|
+
.map((f) => {
|
|
41
|
+
const s = board.containerSize(f.id)
|
|
42
|
+
return { x: f.position.x, y: f.position.y, w: s.w, h: s.h }
|
|
43
|
+
})
|
|
44
|
+
const epics = board.epics
|
|
45
|
+
.filter((e) => e.id !== exclude)
|
|
46
|
+
.map((e) => ({ x: e.position.x, y: e.position.y, w: EPIC_NODE_SIZE.w, h: EPIC_NODE_SIZE.h }))
|
|
47
|
+
return [...frames, ...epics]
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The flow-space top-left at which a frame of `size` would sit centred in the
|
|
52
|
+
* current view — the natural anchor for a frame added without a specific drop point
|
|
53
|
+
* (repo import / bootstrap), so it appears where the user is already looking.
|
|
54
|
+
*/
|
|
55
|
+
function viewportCenteredAnchor(size: { w: number; h: number }): Point {
|
|
56
|
+
const c = screenToFlowCoordinate({ x: window.innerWidth / 2, y: window.innerHeight / 2 })
|
|
57
|
+
return { x: c.x - size.w / 2, y: c.y - size.h / 2 }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* A non-overlapping top-left for a new frame. `near` is the preferred spot (a drop
|
|
62
|
+
* cursor's flow coords); omitted, the frame is anchored to the centre of the current
|
|
63
|
+
* view. `exclude` skips a frame's own rect when re-placing one that already exists
|
|
64
|
+
* (bootstrap re-homes its provisional frame).
|
|
65
|
+
*/
|
|
66
|
+
function freeFramePosition(opts?: {
|
|
67
|
+
near?: Point
|
|
68
|
+
size?: { w: number; h: number }
|
|
69
|
+
exclude?: string
|
|
70
|
+
}): Point {
|
|
71
|
+
const size = opts?.size ?? EMPTY_FRAME_SIZE
|
|
72
|
+
const desired = opts?.near ?? viewportCenteredAnchor(size)
|
|
73
|
+
return findFreeFramePosition(existingNodeRects(opts?.exclude), size, desired)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Pan (and, if zoomed far out, gently zoom in) the camera to centre on a frame. */
|
|
77
|
+
async function focusFrame(id: string, opts?: { duration?: number }): Promise<void> {
|
|
78
|
+
const frame = board.getBlock(id)
|
|
79
|
+
if (!frame) return
|
|
80
|
+
const s = board.containerSize(id)
|
|
81
|
+
const cx = frame.position.x + s.w / 2
|
|
82
|
+
const cy = frame.position.y + s.h / 2
|
|
83
|
+
const zoom = Math.max(viewport.value.zoom, MIN_FOCUS_ZOOM)
|
|
84
|
+
// Let any layout the caller just triggered (e.g. the inspector opening on select)
|
|
85
|
+
// settle so the centre is computed against the real pane size.
|
|
86
|
+
await nextTick()
|
|
87
|
+
setCenter(cx, cy, { zoom, duration: opts?.duration ?? 400 })
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return { freeFramePosition, focusFrame }
|
|
91
|
+
}
|
package/app/stores/board.ts
CHANGED
|
@@ -90,13 +90,19 @@ export const useBoardStore = defineStore('board', () => {
|
|
|
90
90
|
*/
|
|
91
91
|
async function addServiceFromRepo(
|
|
92
92
|
repoGithubId: number,
|
|
93
|
-
opts?: {
|
|
93
|
+
opts?: {
|
|
94
|
+
directory?: string
|
|
95
|
+
isMonorepo?: boolean
|
|
96
|
+
type?: FrameRepoType
|
|
97
|
+
position?: { x: number; y: number }
|
|
98
|
+
},
|
|
94
99
|
): Promise<Block> {
|
|
95
100
|
const block = await api.addServiceFromRepo(useWorkspaceStore().requireId(), {
|
|
96
101
|
repoGithubId,
|
|
97
102
|
...(opts?.directory ? { directory: opts.directory } : {}),
|
|
98
103
|
...(opts?.isMonorepo !== undefined ? { isMonorepo: opts.isMonorepo } : {}),
|
|
99
104
|
...(opts?.type ? { type: opts.type } : {}),
|
|
105
|
+
...(opts?.position ? { position: opts.position } : {}),
|
|
100
106
|
})
|
|
101
107
|
upsert(block)
|
|
102
108
|
return block
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import { findFreeFramePosition, framesCollide, FRAME_GAP, type FrameRect } from './framePlacement'
|
|
3
|
+
|
|
4
|
+
const size = { w: 360, h: 220 }
|
|
5
|
+
|
|
6
|
+
describe('framesCollide', () => {
|
|
7
|
+
it('reports overlapping rects as colliding', () => {
|
|
8
|
+
const a: FrameRect = { x: 0, y: 0, w: 100, h: 100 }
|
|
9
|
+
const b: FrameRect = { x: 50, y: 50, w: 100, h: 100 }
|
|
10
|
+
expect(framesCollide(a, b)).toBe(true)
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
it('treats rects separated by a clear channel as not colliding', () => {
|
|
14
|
+
const a: FrameRect = { x: 0, y: 0, w: 100, h: 100 }
|
|
15
|
+
const b: FrameRect = { x: 200, y: 0, w: 100, h: 100 }
|
|
16
|
+
expect(framesCollide(a, b)).toBe(false)
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it('honours the gap margin: touching-but-clear rects collide once a gap is required', () => {
|
|
20
|
+
const a: FrameRect = { x: 0, y: 0, w: 100, h: 100 }
|
|
21
|
+
const b: FrameRect = { x: 100, y: 0, w: 100, h: 100 } // flush against `a`
|
|
22
|
+
expect(framesCollide(a, b)).toBe(false) // no gap: exactly touching clears
|
|
23
|
+
expect(framesCollide(a, b, 1)).toBe(true) // any required gap is violated
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
describe('findFreeFramePosition', () => {
|
|
28
|
+
it('returns the desired spot verbatim when it is already free', () => {
|
|
29
|
+
const desired = { x: 500, y: 500 }
|
|
30
|
+
expect(findFreeFramePosition([], size, desired)).toEqual(desired)
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
it('keeps a deliberate drop that clears every existing frame', () => {
|
|
34
|
+
const existing: FrameRect[] = [{ x: 0, y: 0, ...size }]
|
|
35
|
+
const desired = { x: 900, y: 0 }
|
|
36
|
+
expect(findFreeFramePosition(existing, size, desired)).toEqual(desired)
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('moves off a spot that overlaps an existing frame, and the result clears it', () => {
|
|
40
|
+
const existing: FrameRect[] = [{ x: 0, y: 0, ...size }]
|
|
41
|
+
const desired = { x: 40, y: 20 } // squarely on top of the existing frame
|
|
42
|
+
const placed = findFreeFramePosition(existing, size, desired)
|
|
43
|
+
const placedRect: FrameRect = { ...placed, ...size }
|
|
44
|
+
expect(framesCollide(placedRect, existing[0]!, FRAME_GAP)).toBe(false)
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it('finds a free cell even when the desired spot is boxed in by neighbours', () => {
|
|
48
|
+
// Frames all around the origin; the desired centre cell is taken and crowded.
|
|
49
|
+
const step = size.w + FRAME_GAP
|
|
50
|
+
const existing: FrameRect[] = [
|
|
51
|
+
{ x: 0, y: 0, ...size },
|
|
52
|
+
{ x: step, y: 0, ...size },
|
|
53
|
+
{ x: -step, y: 0, ...size },
|
|
54
|
+
{ x: 0, y: size.h + FRAME_GAP, ...size },
|
|
55
|
+
]
|
|
56
|
+
const placed = findFreeFramePosition(existing, size, { x: 0, y: 0 })
|
|
57
|
+
const placedRect: FrameRect = { ...placed, ...size }
|
|
58
|
+
for (const r of existing) {
|
|
59
|
+
expect(framesCollide(placedRect, r, FRAME_GAP)).toBe(false)
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
it('places the nearest free cell to the desired point', () => {
|
|
64
|
+
// Only the desired cell is occupied; the closest free cell is one step away.
|
|
65
|
+
const existing: FrameRect[] = [{ x: 0, y: 0, ...size }]
|
|
66
|
+
const placed = findFreeFramePosition(existing, size, { x: 0, y: 0 })
|
|
67
|
+
const step = size.w + FRAME_GAP
|
|
68
|
+
// The nearest ring cell is a single frame-step away on one axis.
|
|
69
|
+
const dist = Math.hypot(placed.x, placed.y)
|
|
70
|
+
expect(dist).toBeLessThanOrEqual(Math.hypot(step, step) + 1)
|
|
71
|
+
expect(dist).toBeGreaterThan(0)
|
|
72
|
+
})
|
|
73
|
+
})
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure geometry for placing a new service frame on the board without overlapping
|
|
3
|
+
* the ones already there. Split out from the composable that reads the live board
|
|
4
|
+
* so the placement decision is a plain, deterministically testable function.
|
|
5
|
+
*
|
|
6
|
+
* Everything here is flow-space (the absolute `{ x, y }` a block stores), with the
|
|
7
|
+
* origin at a frame's top-left corner — the same coordinate system Vue Flow renders
|
|
8
|
+
* nodes in. Sizes are the frame's rendered pixel footprint (see
|
|
9
|
+
* {@link useBlockQueries.containerSize}).
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export interface Point {
|
|
13
|
+
x: number
|
|
14
|
+
y: number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface FrameRect extends Point {
|
|
18
|
+
w: number
|
|
19
|
+
h: number
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Spacing kept between frames so a placed frame never sits flush against a neighbour. */
|
|
23
|
+
export const FRAME_GAP = 48
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Footprint of a freshly-added, empty service frame in flow-space. Mirrors the
|
|
27
|
+
* empty-frame floor in {@link useBlockQueries.contentSize} (w 360, inner h 220) so a
|
|
28
|
+
* placement decision made BEFORE the block exists matches how it will actually render.
|
|
29
|
+
*/
|
|
30
|
+
export const EMPTY_FRAME_SIZE = { w: 360, h: 220 }
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Footprint of an epic grouping node in flow-space. Epics are top-level board nodes
|
|
34
|
+
* drawn alongside frames (see `BoardCanvas`), so a placed frame must clear them too.
|
|
35
|
+
* Mirrors the compact `EpicNode` card (`w-56` = 224px, ~96px tall); a slight
|
|
36
|
+
* over-estimate is harmless — it only widens the clearance around an epic.
|
|
37
|
+
*/
|
|
38
|
+
export const EPIC_NODE_SIZE = { w: 224, h: 96 }
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Do rects `a` and `b` come within `gap` px of each other — i.e. fail to clear? Two
|
|
42
|
+
* rects clear when a full `gap`-wide channel separates them on any axis; if none does,
|
|
43
|
+
* they collide.
|
|
44
|
+
*/
|
|
45
|
+
export function framesCollide(a: FrameRect, b: FrameRect, gap = 0): boolean {
|
|
46
|
+
return !(
|
|
47
|
+
a.x + a.w + gap <= b.x ||
|
|
48
|
+
b.x + b.w + gap <= a.x ||
|
|
49
|
+
a.y + a.h + gap <= b.y ||
|
|
50
|
+
b.y + b.h + gap <= a.y
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function fits(candidate: FrameRect, existing: FrameRect[], gap: number): boolean {
|
|
55
|
+
return existing.every((r) => !framesCollide(candidate, r, gap))
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function dist2(a: Point, b: Point): number {
|
|
59
|
+
const dx = a.x - b.x
|
|
60
|
+
const dy = a.y - b.y
|
|
61
|
+
return dx * dx + dy * dy
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Find a top-left position for a new frame of `size` that clears every rect in
|
|
66
|
+
* `existing` by at least `gap`, staying as close as possible to `desired`.
|
|
67
|
+
*
|
|
68
|
+
* `desired` is used verbatim when it's already free, so a deliberate drop lands where
|
|
69
|
+
* the user aimed. Otherwise we spiral outward on a grid of frame-sized steps and take
|
|
70
|
+
* the nearest free cell. The ring search is bounded, so as a guaranteed last resort we
|
|
71
|
+
* drop the frame in a fresh column to the right of everything — a board can't have a
|
|
72
|
+
* position that never clears.
|
|
73
|
+
*/
|
|
74
|
+
export function findFreeFramePosition(
|
|
75
|
+
existing: FrameRect[],
|
|
76
|
+
size: { w: number; h: number },
|
|
77
|
+
desired: Point,
|
|
78
|
+
gap = FRAME_GAP,
|
|
79
|
+
): Point {
|
|
80
|
+
const rectAt = (p: Point): FrameRect => ({ x: p.x, y: p.y, w: size.w, h: size.h })
|
|
81
|
+
if (fits(rectAt(desired), existing, gap)) return desired
|
|
82
|
+
|
|
83
|
+
const stepX = size.w + gap
|
|
84
|
+
const stepY = size.h + gap
|
|
85
|
+
const MAX_RADIUS = 12
|
|
86
|
+
for (let radius = 1; radius <= MAX_RADIUS; radius++) {
|
|
87
|
+
// The candidates on this square ring, nearest-to-`desired` first, so the chosen
|
|
88
|
+
// free cell is the closest one at this radius (a ring is scanned whole before we
|
|
89
|
+
// widen, so overall we still take the nearest free cell on the board).
|
|
90
|
+
const ring: Point[] = []
|
|
91
|
+
for (let dy = -radius; dy <= radius; dy++) {
|
|
92
|
+
for (let dx = -radius; dx <= radius; dx++) {
|
|
93
|
+
if (Math.max(Math.abs(dx), Math.abs(dy)) !== radius) continue
|
|
94
|
+
ring.push({ x: desired.x + dx * stepX, y: desired.y + dy * stepY })
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
ring.sort((p, q) => dist2(p, desired) - dist2(q, desired))
|
|
98
|
+
for (const c of ring) if (fits(rectAt(c), existing, gap)) return c
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const rightmost = existing.reduce((m, r) => Math.max(m, r.x + r.w), desired.x)
|
|
102
|
+
return { x: rightmost + gap, y: desired.y }
|
|
103
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cat-factory/app",
|
|
3
|
-
"version": "0.79.
|
|
3
|
+
"version": "0.79.2",
|
|
4
4
|
"description": "Reusable Nuxt layer for the Agent Architecture Board SPA (components, stores, composables, pages). Consume it from a thin deployment app via `extends: ['@cat-factory/app']` and point it at your backend with NUXT_PUBLIC_API_BASE. See deploy/frontend for an example.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|