@neta-art/cohub-cli 10.16.0 → 10.17.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/dist/board-kernel.js +385 -331
- package/dist/commands/spaces.js +5 -2
- package/package.json +3 -3
package/dist/board-kernel.js
CHANGED
|
@@ -11416,8 +11416,6 @@ const SHAPE_KINDS = BOARD_SHAPE_GEOMETRIES$1.filter((kind) => kind !== "path");
|
|
|
11416
11416
|
function isShapeKind(value) {
|
|
11417
11417
|
return typeof value === "string" && SHAPE_KINDS.includes(value);
|
|
11418
11418
|
}
|
|
11419
|
-
//#endregion
|
|
11420
|
-
//#region ../sdk/src/board/model/text-metrics.ts
|
|
11421
11419
|
function boardFontFamily(font, stacks) {
|
|
11422
11420
|
if (font === "sans" || font === "serif" || font === "mono") return stacks[font];
|
|
11423
11421
|
return `"${font.replaceAll("\"", "")}", ${stacks.sans}`;
|
|
@@ -11771,7 +11769,7 @@ function createSessionBoardItem(sessionId, snapshot, x, y, id = createBoardItemI
|
|
|
11771
11769
|
})
|
|
11772
11770
|
};
|
|
11773
11771
|
}
|
|
11774
|
-
function createTextBoardItem(text, x, y, color = DEFAULT_BOARD_TOOL_STYLES.text.color, id = createBoardItemId()) {
|
|
11772
|
+
function createTextBoardItem(text, x, y, color = DEFAULT_BOARD_TOOL_STYLES.text.color, id = createBoardItemId(), width) {
|
|
11775
11773
|
return {
|
|
11776
11774
|
id,
|
|
11777
11775
|
item: item({
|
|
@@ -11781,7 +11779,10 @@ function createTextBoardItem(text, x, y, color = DEFAULT_BOARD_TOOL_STYLES.text.
|
|
|
11781
11779
|
y
|
|
11782
11780
|
},
|
|
11783
11781
|
...color === "neutral" ? {} : { style: { fill: color } },
|
|
11784
|
-
props:
|
|
11782
|
+
props: width ? {
|
|
11783
|
+
text,
|
|
11784
|
+
width
|
|
11785
|
+
} : { text }
|
|
11785
11786
|
})
|
|
11786
11787
|
};
|
|
11787
11788
|
}
|
|
@@ -40894,12 +40895,6 @@ function remapItems(items, idMap, place = (item) => item, resolveEnd = () => nul
|
|
|
40894
40895
|
}
|
|
40895
40896
|
return result;
|
|
40896
40897
|
}
|
|
40897
|
-
function defaultPasteOffset(count = 1) {
|
|
40898
|
-
return {
|
|
40899
|
-
x: 24 * count,
|
|
40900
|
-
y: 24 * count
|
|
40901
|
-
};
|
|
40902
|
-
}
|
|
40903
40898
|
function shiftItem(item, dx, dy) {
|
|
40904
40899
|
return {
|
|
40905
40900
|
...item,
|
|
@@ -41176,6 +41171,328 @@ function diffBoardEdits(from, to, ids) {
|
|
|
41176
41171
|
return patch;
|
|
41177
41172
|
}
|
|
41178
41173
|
//#endregion
|
|
41174
|
+
//#region ../sdk/src/board/editor/input.ts
|
|
41175
|
+
/** Every threshold that turns raw input into a click, drag, hold or camera move. */
|
|
41176
|
+
const BOARD_INPUT = {
|
|
41177
|
+
dragSlop: {
|
|
41178
|
+
mouse: 4,
|
|
41179
|
+
touch: 8,
|
|
41180
|
+
pen: 8
|
|
41181
|
+
},
|
|
41182
|
+
tapMs: 300,
|
|
41183
|
+
longPressMs: 450,
|
|
41184
|
+
doubleTapMs: 300,
|
|
41185
|
+
doubleTapSlop: 24,
|
|
41186
|
+
multiTapMs: 250,
|
|
41187
|
+
touchHitSlop: 8,
|
|
41188
|
+
wheelGapMs: 150,
|
|
41189
|
+
pinchSettleMs: 250,
|
|
41190
|
+
wheelEaseMs: 120,
|
|
41191
|
+
flingSampleMs: 80,
|
|
41192
|
+
flingDecay: .95,
|
|
41193
|
+
flingStop: .02,
|
|
41194
|
+
swipeDistance: .2,
|
|
41195
|
+
swipeVelocity: .4,
|
|
41196
|
+
edgeZone: 32,
|
|
41197
|
+
edgeSpeed: 900,
|
|
41198
|
+
ghostClickMs: 700
|
|
41199
|
+
};
|
|
41200
|
+
function boardDragSlop(pointerType) {
|
|
41201
|
+
return pointerType === "mouse" ? BOARD_INPUT.dragSlop.mouse : pointerType === "pen" ? BOARD_INPUT.dragSlop.pen : BOARD_INPUT.dragSlop.touch;
|
|
41202
|
+
}
|
|
41203
|
+
function isTouchLikePointer(pointerType) {
|
|
41204
|
+
return pointerType === "touch" || pointerType === "pen";
|
|
41205
|
+
}
|
|
41206
|
+
//#endregion
|
|
41207
|
+
//#region ../sdk/src/board/editor/tool.ts
|
|
41208
|
+
function isContinuousBoardTool(tool) {
|
|
41209
|
+
return tool === "draw";
|
|
41210
|
+
}
|
|
41211
|
+
function isCreationBoardTool(tool) {
|
|
41212
|
+
return tool === "text" || tool === "shape" || tool === "draw" || tool === "arrow" || tool === "frame";
|
|
41213
|
+
}
|
|
41214
|
+
//#endregion
|
|
41215
|
+
//#region ../sdk/src/board/editor/creation.ts
|
|
41216
|
+
const TEXT_MIN_WRAP_WIDTH = 48;
|
|
41217
|
+
function boardTextGestureWrap({ start, current, pointerType }, zoom) {
|
|
41218
|
+
const width = Math.abs(current.x - start.x);
|
|
41219
|
+
if (width <= boardDragSlop(pointerType) / Math.max(zoom, 1e-4)) return null;
|
|
41220
|
+
return {
|
|
41221
|
+
at: worldPoint(Math.min(start.x, current.x), start.y),
|
|
41222
|
+
width: Math.max(TEXT_MIN_WRAP_WIDTH, width)
|
|
41223
|
+
};
|
|
41224
|
+
}
|
|
41225
|
+
function createCreationModule(ctx) {
|
|
41226
|
+
const { state, options } = ctx;
|
|
41227
|
+
function placeNew(entries) {
|
|
41228
|
+
const created = new Set(entries.map((entry) => entry.id));
|
|
41229
|
+
const probe = buildBoardScene({
|
|
41230
|
+
...state.base,
|
|
41231
|
+
items: Object.fromEntries(entries.map((entry) => [entry.id, entry.item]))
|
|
41232
|
+
});
|
|
41233
|
+
const nextZ = /* @__PURE__ */ new Map();
|
|
41234
|
+
const changes = /* @__PURE__ */ new Map();
|
|
41235
|
+
for (const { id, item } of entries) {
|
|
41236
|
+
if (item.parent && created.has(item.parent)) {
|
|
41237
|
+
changes.set(id, item);
|
|
41238
|
+
continue;
|
|
41239
|
+
}
|
|
41240
|
+
const shown = probe.get(id);
|
|
41241
|
+
const container = shown && item.type !== "frame" && item.type !== "arrow" ? ctx.query.frameAt(rectCenter(shown.frame), created) : null;
|
|
41242
|
+
const value = container && shown ? ctx.document.reparent(item, shown.frame, container.id, probe.layout.box(id)) : item;
|
|
41243
|
+
const z = nextZ.get(container?.id) ?? ctx.document.topZ(container?.id);
|
|
41244
|
+
nextZ.set(container?.id, z + 1);
|
|
41245
|
+
changes.set(id, {
|
|
41246
|
+
...value,
|
|
41247
|
+
z
|
|
41248
|
+
});
|
|
41249
|
+
}
|
|
41250
|
+
return changes;
|
|
41251
|
+
}
|
|
41252
|
+
function sceneWith(id, item) {
|
|
41253
|
+
const items = { [id]: item };
|
|
41254
|
+
for (let cursor = item.parent; cursor && !items[cursor];) {
|
|
41255
|
+
const ancestor = ctx.document.displayItem(cursor);
|
|
41256
|
+
if (!ancestor) break;
|
|
41257
|
+
items[cursor] = ancestor;
|
|
41258
|
+
cursor = ancestor.parent;
|
|
41259
|
+
}
|
|
41260
|
+
return buildBoardScene({
|
|
41261
|
+
...state.base,
|
|
41262
|
+
items
|
|
41263
|
+
});
|
|
41264
|
+
}
|
|
41265
|
+
function transformKeyed() {
|
|
41266
|
+
const ids = /* @__PURE__ */ new Set();
|
|
41267
|
+
for (const animation of Object.values(state.base.animations)) for (const track of Object.values(animation.tracks)) if (/^(position|rotation|scale)(\.|$)/.test(track.property)) ids.add(track.target);
|
|
41268
|
+
return ids;
|
|
41269
|
+
}
|
|
41270
|
+
/** A new frame nests in the frame around it; a drawn one also adopts the siblings it encloses. */
|
|
41271
|
+
function encloseNew({ id, item }, adopt) {
|
|
41272
|
+
const drawn = sceneWith(id, item);
|
|
41273
|
+
const shown = drawn.get(id);
|
|
41274
|
+
const rect = ctx.query.boundsOf(shown, drawn);
|
|
41275
|
+
const parent = ctx.query.frameAround(rect)?.id;
|
|
41276
|
+
const frame = {
|
|
41277
|
+
...ctx.document.reparent(item, shown.frame, parent, drawn.layout.box(id)),
|
|
41278
|
+
z: ctx.document.topZ(parent)
|
|
41279
|
+
};
|
|
41280
|
+
const changes = /* @__PURE__ */ new Map([[id, frame]]);
|
|
41281
|
+
if (!adopt || state.playhead) return changes;
|
|
41282
|
+
const keyed = transformKeyed();
|
|
41283
|
+
const placed = sceneWith(id, frame);
|
|
41284
|
+
for (const child of ctx.query.enclosedIn(rect, parent)) {
|
|
41285
|
+
const stored = ctx.document.displayItem(child.id);
|
|
41286
|
+
if (!stored || child.type === "arrow" || ctx.query.isLocked(child) || keyed.has(child.id)) continue;
|
|
41287
|
+
const adopted = ctx.document.reparent(stored, child.frame, id, state.scene.layout.box(child.id), placed);
|
|
41288
|
+
changes.set(child.id, {
|
|
41289
|
+
...adopted,
|
|
41290
|
+
z: changes.size
|
|
41291
|
+
});
|
|
41292
|
+
}
|
|
41293
|
+
return changes;
|
|
41294
|
+
}
|
|
41295
|
+
function returnToSelect() {
|
|
41296
|
+
if (!isContinuousBoardTool(state.tool)) state.tool = "select";
|
|
41297
|
+
}
|
|
41298
|
+
function commitNew(ids, changes, { select = !isContinuousBoardTool(state.tool), enter = true }) {
|
|
41299
|
+
if (enter) ctx.document.markAdded(ids);
|
|
41300
|
+
state.selection = select ? ids : [];
|
|
41301
|
+
ctx.document.commitItems(changes);
|
|
41302
|
+
returnToSelect();
|
|
41303
|
+
}
|
|
41304
|
+
function add(entries, behavior = {}) {
|
|
41305
|
+
if (options.readonly || entries.length === 0) return;
|
|
41306
|
+
commitNew(entries.map((entry) => entry.id), placeNew(entries), behavior);
|
|
41307
|
+
}
|
|
41308
|
+
function addOne(entry) {
|
|
41309
|
+
add([entry]);
|
|
41310
|
+
return entry.id;
|
|
41311
|
+
}
|
|
41312
|
+
function addItem(type, input) {
|
|
41313
|
+
if (options.readonly) return null;
|
|
41314
|
+
return addOne(ctx.registry.create(type, input));
|
|
41315
|
+
}
|
|
41316
|
+
function addTaskWithSources(taskRunId, snapshot, at, sources, metadata, aspect) {
|
|
41317
|
+
if (options.readonly) return null;
|
|
41318
|
+
const { arrow } = state.toolStyles;
|
|
41319
|
+
const task = createTaskBoardItem(taskRunId, snapshot, at.x, at.y, metadata, void 0, aspect);
|
|
41320
|
+
add([task, ...sources.filter((source) => source.itemId !== task.id && state.scene.get(source.itemId)).map((source) => {
|
|
41321
|
+
const entry = createArrowBoardItem({
|
|
41322
|
+
x: 0,
|
|
41323
|
+
y: 0
|
|
41324
|
+
}, { item: task.id }, arrow.color, createBoardItemId(), arrow.size, { item: source.itemId });
|
|
41325
|
+
const props = entry.item.props;
|
|
41326
|
+
return {
|
|
41327
|
+
id: entry.id,
|
|
41328
|
+
item: {
|
|
41329
|
+
...entry.item,
|
|
41330
|
+
metadata: { boardFlow: {
|
|
41331
|
+
version: 1,
|
|
41332
|
+
kind: "content",
|
|
41333
|
+
sourcePortId: source.sourcePortId,
|
|
41334
|
+
targetPortId: source.targetPortId
|
|
41335
|
+
} },
|
|
41336
|
+
props: {
|
|
41337
|
+
...props,
|
|
41338
|
+
start: {
|
|
41339
|
+
item: source.itemId,
|
|
41340
|
+
anchor: "auto",
|
|
41341
|
+
port: source.sourcePortId
|
|
41342
|
+
},
|
|
41343
|
+
end: {
|
|
41344
|
+
item: task.id,
|
|
41345
|
+
anchor: "auto",
|
|
41346
|
+
port: source.targetPortId
|
|
41347
|
+
},
|
|
41348
|
+
relation: "input"
|
|
41349
|
+
}
|
|
41350
|
+
}
|
|
41351
|
+
};
|
|
41352
|
+
})], { select: false });
|
|
41353
|
+
state.selection = [task.id];
|
|
41354
|
+
return task.id;
|
|
41355
|
+
}
|
|
41356
|
+
function commitBox(gesture) {
|
|
41357
|
+
if (options.readonly) return;
|
|
41358
|
+
const dx = gesture.current.x - gesture.start.x;
|
|
41359
|
+
const dy = gesture.current.y - gesture.start.y;
|
|
41360
|
+
const click = Math.hypot(dx, dy) <= 6 / Math.max(state.camera.zoom, 1e-4);
|
|
41361
|
+
const minimum = gesture.kind === "frame" ? 48 : 24;
|
|
41362
|
+
const box = click ? void 0 : {
|
|
41363
|
+
x: Math.min(gesture.start.x, gesture.current.x),
|
|
41364
|
+
y: Math.min(gesture.start.y, gesture.current.y),
|
|
41365
|
+
width: Math.max(minimum, Math.abs(dx)),
|
|
41366
|
+
height: Math.max(minimum, Math.abs(dy))
|
|
41367
|
+
};
|
|
41368
|
+
const { x, y } = gesture.start;
|
|
41369
|
+
if (gesture.kind === "frame") {
|
|
41370
|
+
const frame = createFrameBoardItem(x, y, gesture.color, "Frame", gesture.id, box);
|
|
41371
|
+
return commitNew([frame.id], encloseNew(frame, !click), { enter: false });
|
|
41372
|
+
}
|
|
41373
|
+
add([createShapeBoardItem(isShapeKind(gesture.geometry) ? gesture.geometry : "rectangle", x, y, gesture.color, gesture.id, box)], { enter: false });
|
|
41374
|
+
}
|
|
41375
|
+
function commitDraw(id, points, color, size) {
|
|
41376
|
+
if (points.length === 0) return;
|
|
41377
|
+
add([createDrawBoardItem(points, color, size, id)], { enter: false });
|
|
41378
|
+
}
|
|
41379
|
+
function arrowEnd(point, targetItemId, arrowMatrix = IDENTITY_MATRIX) {
|
|
41380
|
+
if (targetItemId) return {
|
|
41381
|
+
item: targetItemId,
|
|
41382
|
+
anchor: "auto"
|
|
41383
|
+
};
|
|
41384
|
+
const local = applyMatrix$1(invertMatrix(arrowMatrix), point);
|
|
41385
|
+
return {
|
|
41386
|
+
x: local.x,
|
|
41387
|
+
y: local.y
|
|
41388
|
+
};
|
|
41389
|
+
}
|
|
41390
|
+
function commitArrow(gesture, cancelled) {
|
|
41391
|
+
const { start, current, startItemId, targetItemId } = gesture;
|
|
41392
|
+
const bound = !cancelled && targetItemId && targetItemId !== startItemId ? targetItemId : null;
|
|
41393
|
+
if (!bound && Math.hypot(current.x - start.x, current.y - start.y) < 2 / state.camera.zoom) return;
|
|
41394
|
+
add([createArrowBoardItem(start, bound ? { item: bound } : current, gesture.color, gesture.id, gesture.size, startItemId ? {
|
|
41395
|
+
item: startItemId,
|
|
41396
|
+
...gesture.startSide ? { anchor: {
|
|
41397
|
+
side: gesture.startSide,
|
|
41398
|
+
offset: .5
|
|
41399
|
+
} } : {}
|
|
41400
|
+
} : void 0)], { enter: false });
|
|
41401
|
+
}
|
|
41402
|
+
function commitTextGesture(gesture) {
|
|
41403
|
+
if (options.readonly) return;
|
|
41404
|
+
const wrap = boardTextGestureWrap(gesture, state.camera.zoom);
|
|
41405
|
+
beginTextDraft(wrap?.at ?? gesture.start, wrap?.width);
|
|
41406
|
+
}
|
|
41407
|
+
function beginTextDraft(at, width) {
|
|
41408
|
+
const entry = createTextBoardItem("", at.x, at.y, state.toolStyles.text.color, void 0, width);
|
|
41409
|
+
ctx.document.writeDraft(placeNew([entry]), true);
|
|
41410
|
+
state.draftTextId = entry.id;
|
|
41411
|
+
state.selection = [entry.id];
|
|
41412
|
+
state.editingId = entry.id;
|
|
41413
|
+
}
|
|
41414
|
+
function previewTextLayout(id, text) {
|
|
41415
|
+
const item = ctx.document.displayItem(id);
|
|
41416
|
+
if (item?.type !== "text" || item.props.text === text) return;
|
|
41417
|
+
ctx.document.writeDraft(/* @__PURE__ */ new Map([[id, {
|
|
41418
|
+
...item,
|
|
41419
|
+
props: {
|
|
41420
|
+
...item.props,
|
|
41421
|
+
text
|
|
41422
|
+
}
|
|
41423
|
+
}]]));
|
|
41424
|
+
}
|
|
41425
|
+
function updateText(id, text, created = false) {
|
|
41426
|
+
const item = ctx.document.displayItem(id);
|
|
41427
|
+
if (!item || item.type !== "text" && item.type !== "shape" && item.type !== "arrow" && item.type !== "frame") return;
|
|
41428
|
+
const next = item.type === "arrow" || item.type === "frame" ? {
|
|
41429
|
+
...item,
|
|
41430
|
+
props: {
|
|
41431
|
+
...item.props,
|
|
41432
|
+
label: text
|
|
41433
|
+
}
|
|
41434
|
+
} : {
|
|
41435
|
+
...item,
|
|
41436
|
+
props: {
|
|
41437
|
+
...item.props,
|
|
41438
|
+
text
|
|
41439
|
+
}
|
|
41440
|
+
};
|
|
41441
|
+
if (!created && sameJson(next, state.base.items[id])) {
|
|
41442
|
+
ctx.document.dropDraftItem(id);
|
|
41443
|
+
ctx.document.rescene([id]);
|
|
41444
|
+
return;
|
|
41445
|
+
}
|
|
41446
|
+
ctx.document.commitItems(/* @__PURE__ */ new Map([[id, next]]));
|
|
41447
|
+
}
|
|
41448
|
+
function commitTextEdit(id, text) {
|
|
41449
|
+
const isDraft = id === state.draftTextId;
|
|
41450
|
+
const target = ctx.document.displayItem(id);
|
|
41451
|
+
const empty = text.trim() === "" && (isDraft || target?.type === "text");
|
|
41452
|
+
state.editingId = null;
|
|
41453
|
+
state.draftTextId = null;
|
|
41454
|
+
if (empty) {
|
|
41455
|
+
if (isDraft) {
|
|
41456
|
+
ctx.document.dropDraftItem(id);
|
|
41457
|
+
ctx.document.rescene();
|
|
41458
|
+
} else ctx.deletion.deleteItem(id);
|
|
41459
|
+
} else updateText(id, text, isDraft);
|
|
41460
|
+
if (state.tool === "text") state.tool = "select";
|
|
41461
|
+
ctx.remote.flushPending();
|
|
41462
|
+
}
|
|
41463
|
+
const styles = () => state.toolStyles;
|
|
41464
|
+
return {
|
|
41465
|
+
placeNew,
|
|
41466
|
+
add,
|
|
41467
|
+
addItem,
|
|
41468
|
+
addApp: (app, at) => addOne(createAppBoardItem(app, at.x, at.y)),
|
|
41469
|
+
addMedia: (src, at, options = {}) => addOne(createMediaBoardItem(src, at.x, at.y, options.snapshot, void 0, options.kind)),
|
|
41470
|
+
addFile: (path, at, snapshot) => addOne(createFileNodeForPath(path, at.x, at.y, snapshot)),
|
|
41471
|
+
addTask: (taskRunId, snapshot, at, metadata, aspect) => addOne(createTaskBoardItem(taskRunId, snapshot, at.x, at.y, metadata, void 0, aspect)),
|
|
41472
|
+
addTaskWithSources,
|
|
41473
|
+
addSession: (sessionId, snapshot, at) => addOne(createSessionBoardItem(sessionId, snapshot, at.x, at.y)),
|
|
41474
|
+
addText: (text, at) => {
|
|
41475
|
+
add([createTextBoardItem(text, at.x, at.y, styles().text.color)]);
|
|
41476
|
+
},
|
|
41477
|
+
addShape: (at, geometry) => {
|
|
41478
|
+
const { shape } = styles();
|
|
41479
|
+
add([createShapeBoardItem(geometry ?? shape.geometry, at.x, at.y, shape.color)]);
|
|
41480
|
+
},
|
|
41481
|
+
addFrame: (at) => {
|
|
41482
|
+
add([createFrameBoardItem(at.x, at.y, styles().frame.color)]);
|
|
41483
|
+
},
|
|
41484
|
+
commitBox,
|
|
41485
|
+
commitDraw,
|
|
41486
|
+
commitArrow,
|
|
41487
|
+
arrowEnd,
|
|
41488
|
+
commitTextGesture,
|
|
41489
|
+
beginTextDraft,
|
|
41490
|
+
previewTextLayout,
|
|
41491
|
+
updateText,
|
|
41492
|
+
commitTextEdit
|
|
41493
|
+
};
|
|
41494
|
+
}
|
|
41495
|
+
//#endregion
|
|
41179
41496
|
//#region ../sdk/src/board/editor/animation.ts
|
|
41180
41497
|
const ms = (value) => Math.max(0, Math.round(value));
|
|
41181
41498
|
function lastAt(tracks) {
|
|
@@ -41564,39 +41881,6 @@ function createAnimationModule(ctx) {
|
|
|
41564
41881
|
};
|
|
41565
41882
|
}
|
|
41566
41883
|
//#endregion
|
|
41567
|
-
//#region ../sdk/src/board/editor/input.ts
|
|
41568
|
-
/** Every threshold that turns raw input into a click, drag, hold or camera move. */
|
|
41569
|
-
const BOARD_INPUT = {
|
|
41570
|
-
dragSlop: {
|
|
41571
|
-
mouse: 4,
|
|
41572
|
-
touch: 8,
|
|
41573
|
-
pen: 8
|
|
41574
|
-
},
|
|
41575
|
-
tapMs: 300,
|
|
41576
|
-
longPressMs: 450,
|
|
41577
|
-
doubleTapMs: 300,
|
|
41578
|
-
doubleTapSlop: 24,
|
|
41579
|
-
multiTapMs: 250,
|
|
41580
|
-
touchHitSlop: 8,
|
|
41581
|
-
wheelGapMs: 150,
|
|
41582
|
-
pinchSettleMs: 250,
|
|
41583
|
-
wheelEaseMs: 120,
|
|
41584
|
-
flingSampleMs: 80,
|
|
41585
|
-
flingDecay: .95,
|
|
41586
|
-
flingStop: .02,
|
|
41587
|
-
swipeDistance: .2,
|
|
41588
|
-
swipeVelocity: .4,
|
|
41589
|
-
edgeZone: 32,
|
|
41590
|
-
edgeSpeed: 900,
|
|
41591
|
-
ghostClickMs: 700
|
|
41592
|
-
};
|
|
41593
|
-
function boardDragSlop(pointerType) {
|
|
41594
|
-
return pointerType === "mouse" ? BOARD_INPUT.dragSlop.mouse : pointerType === "pen" ? BOARD_INPUT.dragSlop.pen : BOARD_INPUT.dragSlop.touch;
|
|
41595
|
-
}
|
|
41596
|
-
function isTouchLikePointer(pointerType) {
|
|
41597
|
-
return pointerType === "touch" || pointerType === "pen";
|
|
41598
|
-
}
|
|
41599
|
-
//#endregion
|
|
41600
41884
|
//#region ../sdk/src/board/editor/camera.ts
|
|
41601
41885
|
const ZOOM_STEP = 1.28;
|
|
41602
41886
|
const CAMERA_ANIMATION_MS = 240;
|
|
@@ -41885,7 +42169,7 @@ const STATE_CHANNELS = {
|
|
|
41885
42169
|
function createCopyModule(ctx) {
|
|
41886
42170
|
const { state, options } = ctx;
|
|
41887
42171
|
let internalClipboard = null;
|
|
41888
|
-
let
|
|
42172
|
+
let lastPaste = null;
|
|
41889
42173
|
function detachedSubtrees(ids, scene) {
|
|
41890
42174
|
const items = {};
|
|
41891
42175
|
for (const root of ctx.query.rootsOf(ids)) {
|
|
@@ -41957,7 +42241,7 @@ function createCopyModule(ctx) {
|
|
|
41957
42241
|
}) : null;
|
|
41958
42242
|
if (payload) {
|
|
41959
42243
|
internalClipboard = payload;
|
|
41960
|
-
|
|
42244
|
+
lastPaste = null;
|
|
41961
42245
|
}
|
|
41962
42246
|
return payload;
|
|
41963
42247
|
}
|
|
@@ -41970,11 +42254,12 @@ function createCopyModule(ctx) {
|
|
|
41970
42254
|
if (options.readonly) return;
|
|
41971
42255
|
const parsed = parseClipboard(raw) ?? (raw == null ? parseClipboard(internalClipboard) : null);
|
|
41972
42256
|
if (!parsed) return;
|
|
41973
|
-
|
|
41974
|
-
|
|
41975
|
-
|
|
41976
|
-
|
|
41977
|
-
}
|
|
42257
|
+
const target = at ?? pasteTarget(parsed);
|
|
42258
|
+
lastPaste = {
|
|
42259
|
+
origin: parsed.origin,
|
|
42260
|
+
at: target
|
|
42261
|
+
};
|
|
42262
|
+
const pasted = materializeClipboard(parsed, target);
|
|
41978
42263
|
const entries = Object.entries(pasted).map(([id, item]) => ({
|
|
41979
42264
|
id,
|
|
41980
42265
|
item
|
|
@@ -41985,6 +42270,31 @@ function createCopyModule(ctx) {
|
|
|
41985
42270
|
state.selection = roots;
|
|
41986
42271
|
ctx.document.commitItems(changes);
|
|
41987
42272
|
}
|
|
42273
|
+
function pasteTarget(payload) {
|
|
42274
|
+
const from = lastPaste?.origin.x === payload.origin.x && lastPaste.origin.y === payload.origin.y ? lastPaste.at : payload.origin;
|
|
42275
|
+
const next = {
|
|
42276
|
+
x: from.x + 24,
|
|
42277
|
+
y: from.y + 24
|
|
42278
|
+
};
|
|
42279
|
+
const view = ctx.camera.visibleRect();
|
|
42280
|
+
if (!view) return next;
|
|
42281
|
+
const probe = buildBoardScene({
|
|
42282
|
+
...state.base,
|
|
42283
|
+
items: payload.items
|
|
42284
|
+
});
|
|
42285
|
+
const bounds = unionRects(probe.items.map((item) => ctx.query.boundsOf(item, probe)));
|
|
42286
|
+
if (!bounds) return next;
|
|
42287
|
+
const middle = rectCenter(bounds);
|
|
42288
|
+
if (rectContainsPoint(view, {
|
|
42289
|
+
x: next.x + middle.x,
|
|
42290
|
+
y: next.y + middle.y
|
|
42291
|
+
})) return next;
|
|
42292
|
+
const center = rectCenter(view);
|
|
42293
|
+
return {
|
|
42294
|
+
x: center.x - middle.x,
|
|
42295
|
+
y: center.y - middle.y
|
|
42296
|
+
};
|
|
42297
|
+
}
|
|
41988
42298
|
return {
|
|
41989
42299
|
duplicates,
|
|
41990
42300
|
rootsOfCopies,
|
|
@@ -41995,280 +42305,6 @@ function createCopyModule(ctx) {
|
|
|
41995
42305
|
};
|
|
41996
42306
|
}
|
|
41997
42307
|
//#endregion
|
|
41998
|
-
//#region ../sdk/src/board/editor/tool.ts
|
|
41999
|
-
function isContinuousBoardTool(tool) {
|
|
42000
|
-
return tool === "draw";
|
|
42001
|
-
}
|
|
42002
|
-
function isCreationBoardTool(tool) {
|
|
42003
|
-
return tool === "text" || tool === "shape" || tool === "draw" || tool === "arrow" || tool === "frame";
|
|
42004
|
-
}
|
|
42005
|
-
//#endregion
|
|
42006
|
-
//#region ../sdk/src/board/editor/creation.ts
|
|
42007
|
-
function createCreationModule(ctx) {
|
|
42008
|
-
const { state, options } = ctx;
|
|
42009
|
-
function placeNew(entries) {
|
|
42010
|
-
const created = new Set(entries.map((entry) => entry.id));
|
|
42011
|
-
const probe = buildBoardScene({
|
|
42012
|
-
...state.base,
|
|
42013
|
-
items: Object.fromEntries(entries.map((entry) => [entry.id, entry.item]))
|
|
42014
|
-
});
|
|
42015
|
-
const nextZ = /* @__PURE__ */ new Map();
|
|
42016
|
-
const changes = /* @__PURE__ */ new Map();
|
|
42017
|
-
for (const { id, item } of entries) {
|
|
42018
|
-
if (item.parent && created.has(item.parent)) {
|
|
42019
|
-
changes.set(id, item);
|
|
42020
|
-
continue;
|
|
42021
|
-
}
|
|
42022
|
-
const shown = probe.get(id);
|
|
42023
|
-
const container = shown && item.type !== "frame" && item.type !== "arrow" ? ctx.query.frameAt(rectCenter(shown.frame), created) : null;
|
|
42024
|
-
const value = container && shown ? ctx.document.reparent(item, shown.frame, container.id, probe.layout.box(id)) : item;
|
|
42025
|
-
const z = nextZ.get(container?.id) ?? ctx.document.topZ(container?.id);
|
|
42026
|
-
nextZ.set(container?.id, z + 1);
|
|
42027
|
-
changes.set(id, {
|
|
42028
|
-
...value,
|
|
42029
|
-
z
|
|
42030
|
-
});
|
|
42031
|
-
}
|
|
42032
|
-
return changes;
|
|
42033
|
-
}
|
|
42034
|
-
function sceneWith(id, item) {
|
|
42035
|
-
const items = { [id]: item };
|
|
42036
|
-
for (let cursor = item.parent; cursor && !items[cursor];) {
|
|
42037
|
-
const ancestor = ctx.document.displayItem(cursor);
|
|
42038
|
-
if (!ancestor) break;
|
|
42039
|
-
items[cursor] = ancestor;
|
|
42040
|
-
cursor = ancestor.parent;
|
|
42041
|
-
}
|
|
42042
|
-
return buildBoardScene({
|
|
42043
|
-
...state.base,
|
|
42044
|
-
items
|
|
42045
|
-
});
|
|
42046
|
-
}
|
|
42047
|
-
function transformKeyed() {
|
|
42048
|
-
const ids = /* @__PURE__ */ new Set();
|
|
42049
|
-
for (const animation of Object.values(state.base.animations)) for (const track of Object.values(animation.tracks)) if (/^(position|rotation|scale)(\.|$)/.test(track.property)) ids.add(track.target);
|
|
42050
|
-
return ids;
|
|
42051
|
-
}
|
|
42052
|
-
/** A new frame nests in the frame around it; a drawn one also adopts the siblings it encloses. */
|
|
42053
|
-
function encloseNew({ id, item }, adopt) {
|
|
42054
|
-
const drawn = sceneWith(id, item);
|
|
42055
|
-
const shown = drawn.get(id);
|
|
42056
|
-
const rect = ctx.query.boundsOf(shown, drawn);
|
|
42057
|
-
const parent = ctx.query.frameAround(rect)?.id;
|
|
42058
|
-
const frame = {
|
|
42059
|
-
...ctx.document.reparent(item, shown.frame, parent, drawn.layout.box(id)),
|
|
42060
|
-
z: ctx.document.topZ(parent)
|
|
42061
|
-
};
|
|
42062
|
-
const changes = /* @__PURE__ */ new Map([[id, frame]]);
|
|
42063
|
-
if (!adopt || state.playhead) return changes;
|
|
42064
|
-
const keyed = transformKeyed();
|
|
42065
|
-
const placed = sceneWith(id, frame);
|
|
42066
|
-
for (const child of ctx.query.enclosedIn(rect, parent)) {
|
|
42067
|
-
const stored = ctx.document.displayItem(child.id);
|
|
42068
|
-
if (!stored || child.type === "arrow" || ctx.query.isLocked(child) || keyed.has(child.id)) continue;
|
|
42069
|
-
const adopted = ctx.document.reparent(stored, child.frame, id, state.scene.layout.box(child.id), placed);
|
|
42070
|
-
changes.set(child.id, {
|
|
42071
|
-
...adopted,
|
|
42072
|
-
z: changes.size
|
|
42073
|
-
});
|
|
42074
|
-
}
|
|
42075
|
-
return changes;
|
|
42076
|
-
}
|
|
42077
|
-
function returnToSelect() {
|
|
42078
|
-
if (!isContinuousBoardTool(state.tool)) state.tool = "select";
|
|
42079
|
-
}
|
|
42080
|
-
function commitNew(ids, changes, { select = !isContinuousBoardTool(state.tool), enter = true }) {
|
|
42081
|
-
if (enter) ctx.document.markAdded(ids);
|
|
42082
|
-
state.selection = select ? ids : [];
|
|
42083
|
-
ctx.document.commitItems(changes);
|
|
42084
|
-
returnToSelect();
|
|
42085
|
-
}
|
|
42086
|
-
function add(entries, behavior = {}) {
|
|
42087
|
-
if (options.readonly || entries.length === 0) return;
|
|
42088
|
-
commitNew(entries.map((entry) => entry.id), placeNew(entries), behavior);
|
|
42089
|
-
}
|
|
42090
|
-
function addOne(entry) {
|
|
42091
|
-
add([entry]);
|
|
42092
|
-
return entry.id;
|
|
42093
|
-
}
|
|
42094
|
-
function addItem(type, input) {
|
|
42095
|
-
if (options.readonly) return null;
|
|
42096
|
-
return addOne(ctx.registry.create(type, input));
|
|
42097
|
-
}
|
|
42098
|
-
function addTaskWithSources(taskRunId, snapshot, at, sources, metadata, aspect) {
|
|
42099
|
-
if (options.readonly) return null;
|
|
42100
|
-
const { arrow } = state.toolStyles;
|
|
42101
|
-
const task = createTaskBoardItem(taskRunId, snapshot, at.x, at.y, metadata, void 0, aspect);
|
|
42102
|
-
add([task, ...sources.filter((source) => source.itemId !== task.id && state.scene.get(source.itemId)).map((source) => {
|
|
42103
|
-
const entry = createArrowBoardItem({
|
|
42104
|
-
x: 0,
|
|
42105
|
-
y: 0
|
|
42106
|
-
}, { item: task.id }, arrow.color, createBoardItemId(), arrow.size, { item: source.itemId });
|
|
42107
|
-
const props = entry.item.props;
|
|
42108
|
-
return {
|
|
42109
|
-
id: entry.id,
|
|
42110
|
-
item: {
|
|
42111
|
-
...entry.item,
|
|
42112
|
-
metadata: { boardFlow: {
|
|
42113
|
-
version: 1,
|
|
42114
|
-
kind: "content",
|
|
42115
|
-
sourcePortId: source.sourcePortId,
|
|
42116
|
-
targetPortId: source.targetPortId
|
|
42117
|
-
} },
|
|
42118
|
-
props: {
|
|
42119
|
-
...props,
|
|
42120
|
-
start: {
|
|
42121
|
-
item: source.itemId,
|
|
42122
|
-
anchor: "auto",
|
|
42123
|
-
port: source.sourcePortId
|
|
42124
|
-
},
|
|
42125
|
-
end: {
|
|
42126
|
-
item: task.id,
|
|
42127
|
-
anchor: "auto",
|
|
42128
|
-
port: source.targetPortId
|
|
42129
|
-
},
|
|
42130
|
-
relation: "input"
|
|
42131
|
-
}
|
|
42132
|
-
}
|
|
42133
|
-
};
|
|
42134
|
-
})], { select: false });
|
|
42135
|
-
state.selection = [task.id];
|
|
42136
|
-
return task.id;
|
|
42137
|
-
}
|
|
42138
|
-
function commitBox(gesture) {
|
|
42139
|
-
if (options.readonly) return;
|
|
42140
|
-
const dx = gesture.current.x - gesture.start.x;
|
|
42141
|
-
const dy = gesture.current.y - gesture.start.y;
|
|
42142
|
-
const click = Math.hypot(dx, dy) <= 6 / Math.max(state.camera.zoom, 1e-4);
|
|
42143
|
-
const minimum = gesture.kind === "frame" ? 48 : 24;
|
|
42144
|
-
const box = click ? void 0 : {
|
|
42145
|
-
x: Math.min(gesture.start.x, gesture.current.x),
|
|
42146
|
-
y: Math.min(gesture.start.y, gesture.current.y),
|
|
42147
|
-
width: Math.max(minimum, Math.abs(dx)),
|
|
42148
|
-
height: Math.max(minimum, Math.abs(dy))
|
|
42149
|
-
};
|
|
42150
|
-
const { x, y } = gesture.start;
|
|
42151
|
-
if (gesture.kind === "frame") {
|
|
42152
|
-
const frame = createFrameBoardItem(x, y, gesture.color, "Frame", gesture.id, box);
|
|
42153
|
-
return commitNew([frame.id], encloseNew(frame, !click), { enter: false });
|
|
42154
|
-
}
|
|
42155
|
-
add([createShapeBoardItem(isShapeKind(gesture.geometry) ? gesture.geometry : "rectangle", x, y, gesture.color, gesture.id, box)], { enter: false });
|
|
42156
|
-
}
|
|
42157
|
-
function commitDraw(id, points, color, size) {
|
|
42158
|
-
if (points.length === 0) return;
|
|
42159
|
-
add([createDrawBoardItem(points, color, size, id)], { enter: false });
|
|
42160
|
-
}
|
|
42161
|
-
function arrowEnd(point, targetItemId, arrowMatrix = IDENTITY_MATRIX) {
|
|
42162
|
-
if (targetItemId) return {
|
|
42163
|
-
item: targetItemId,
|
|
42164
|
-
anchor: "auto"
|
|
42165
|
-
};
|
|
42166
|
-
const local = applyMatrix$1(invertMatrix(arrowMatrix), point);
|
|
42167
|
-
return {
|
|
42168
|
-
x: local.x,
|
|
42169
|
-
y: local.y
|
|
42170
|
-
};
|
|
42171
|
-
}
|
|
42172
|
-
function commitArrow(gesture, cancelled) {
|
|
42173
|
-
const { start, current, startItemId, targetItemId } = gesture;
|
|
42174
|
-
const bound = !cancelled && targetItemId && targetItemId !== startItemId ? targetItemId : null;
|
|
42175
|
-
if (!bound && Math.hypot(current.x - start.x, current.y - start.y) < 2 / state.camera.zoom) return;
|
|
42176
|
-
add([createArrowBoardItem(start, bound ? { item: bound } : current, gesture.color, gesture.id, gesture.size, startItemId ? {
|
|
42177
|
-
item: startItemId,
|
|
42178
|
-
...gesture.startSide ? { anchor: {
|
|
42179
|
-
side: gesture.startSide,
|
|
42180
|
-
offset: .5
|
|
42181
|
-
} } : {}
|
|
42182
|
-
} : void 0)], { enter: false });
|
|
42183
|
-
}
|
|
42184
|
-
function beginTextDraft(at) {
|
|
42185
|
-
const entry = createTextBoardItem("", at.x, at.y, state.toolStyles.text.color);
|
|
42186
|
-
ctx.document.writeDraft(placeNew([entry]), true);
|
|
42187
|
-
state.draftTextId = entry.id;
|
|
42188
|
-
state.selection = [entry.id];
|
|
42189
|
-
state.editingId = entry.id;
|
|
42190
|
-
}
|
|
42191
|
-
function previewTextLayout(id, text) {
|
|
42192
|
-
const item = ctx.document.displayItem(id);
|
|
42193
|
-
if (item?.type !== "text" || item.props.text === text) return;
|
|
42194
|
-
ctx.document.writeDraft(/* @__PURE__ */ new Map([[id, {
|
|
42195
|
-
...item,
|
|
42196
|
-
props: {
|
|
42197
|
-
...item.props,
|
|
42198
|
-
text
|
|
42199
|
-
}
|
|
42200
|
-
}]]));
|
|
42201
|
-
}
|
|
42202
|
-
function updateText(id, text, created = false) {
|
|
42203
|
-
const item = ctx.document.displayItem(id);
|
|
42204
|
-
if (!item || item.type !== "text" && item.type !== "shape" && item.type !== "arrow" && item.type !== "frame") return;
|
|
42205
|
-
const next = item.type === "arrow" || item.type === "frame" ? {
|
|
42206
|
-
...item,
|
|
42207
|
-
props: {
|
|
42208
|
-
...item.props,
|
|
42209
|
-
label: text
|
|
42210
|
-
}
|
|
42211
|
-
} : {
|
|
42212
|
-
...item,
|
|
42213
|
-
props: {
|
|
42214
|
-
...item.props,
|
|
42215
|
-
text
|
|
42216
|
-
}
|
|
42217
|
-
};
|
|
42218
|
-
if (!created && sameJson(next, state.base.items[id])) {
|
|
42219
|
-
ctx.document.dropDraftItem(id);
|
|
42220
|
-
ctx.document.rescene([id]);
|
|
42221
|
-
return;
|
|
42222
|
-
}
|
|
42223
|
-
ctx.document.commitItems(/* @__PURE__ */ new Map([[id, next]]));
|
|
42224
|
-
}
|
|
42225
|
-
function commitTextEdit(id, text) {
|
|
42226
|
-
const isDraft = id === state.draftTextId;
|
|
42227
|
-
const target = ctx.document.displayItem(id);
|
|
42228
|
-
const empty = text.trim() === "" && (isDraft || target?.type === "text");
|
|
42229
|
-
state.editingId = null;
|
|
42230
|
-
state.draftTextId = null;
|
|
42231
|
-
if (empty) {
|
|
42232
|
-
if (isDraft) {
|
|
42233
|
-
ctx.document.dropDraftItem(id);
|
|
42234
|
-
ctx.document.rescene();
|
|
42235
|
-
} else ctx.deletion.deleteItem(id);
|
|
42236
|
-
} else updateText(id, text, isDraft);
|
|
42237
|
-
if (state.tool === "text") state.tool = "select";
|
|
42238
|
-
ctx.remote.flushPending();
|
|
42239
|
-
}
|
|
42240
|
-
const styles = () => state.toolStyles;
|
|
42241
|
-
return {
|
|
42242
|
-
placeNew,
|
|
42243
|
-
add,
|
|
42244
|
-
addItem,
|
|
42245
|
-
addApp: (app, at) => addOne(createAppBoardItem(app, at.x, at.y)),
|
|
42246
|
-
addMedia: (src, at, options = {}) => addOne(createMediaBoardItem(src, at.x, at.y, options.snapshot, void 0, options.kind)),
|
|
42247
|
-
addFile: (path, at, snapshot) => addOne(createFileNodeForPath(path, at.x, at.y, snapshot)),
|
|
42248
|
-
addTask: (taskRunId, snapshot, at, metadata, aspect) => addOne(createTaskBoardItem(taskRunId, snapshot, at.x, at.y, metadata, void 0, aspect)),
|
|
42249
|
-
addTaskWithSources,
|
|
42250
|
-
addSession: (sessionId, snapshot, at) => addOne(createSessionBoardItem(sessionId, snapshot, at.x, at.y)),
|
|
42251
|
-
addText: (text, at) => {
|
|
42252
|
-
add([createTextBoardItem(text, at.x, at.y, styles().text.color)]);
|
|
42253
|
-
},
|
|
42254
|
-
addShape: (at, geometry) => {
|
|
42255
|
-
const { shape } = styles();
|
|
42256
|
-
add([createShapeBoardItem(geometry ?? shape.geometry, at.x, at.y, shape.color)]);
|
|
42257
|
-
},
|
|
42258
|
-
addFrame: (at) => {
|
|
42259
|
-
add([createFrameBoardItem(at.x, at.y, styles().frame.color)]);
|
|
42260
|
-
},
|
|
42261
|
-
commitBox,
|
|
42262
|
-
commitDraw,
|
|
42263
|
-
commitArrow,
|
|
42264
|
-
arrowEnd,
|
|
42265
|
-
beginTextDraft,
|
|
42266
|
-
previewTextLayout,
|
|
42267
|
-
updateText,
|
|
42268
|
-
commitTextEdit
|
|
42269
|
-
};
|
|
42270
|
-
}
|
|
42271
|
-
//#endregion
|
|
42272
42308
|
//#region ../sdk/src/board/editor/deletion.ts
|
|
42273
42309
|
function createDeletionModule(ctx) {
|
|
42274
42310
|
const { state } = ctx;
|
|
@@ -43254,7 +43290,7 @@ function createInteractionModule(ctx) {
|
|
|
43254
43290
|
function pressCard(event) {
|
|
43255
43291
|
if (!plainPrimary(event)) return false;
|
|
43256
43292
|
const item = ctx.query.pickAt(event.world, event.pointerType);
|
|
43257
|
-
if (!item || !options.readonly &&
|
|
43293
|
+
if (!item || !options.readonly && ctx.selection.carries(item.id) || !opensOnTap(item)) return false;
|
|
43258
43294
|
state.interaction = {
|
|
43259
43295
|
type: "pressing",
|
|
43260
43296
|
itemId: item.id,
|
|
@@ -43460,11 +43496,16 @@ function createInteractionModule(ctx) {
|
|
|
43460
43496
|
};
|
|
43461
43497
|
return;
|
|
43462
43498
|
case "text":
|
|
43463
|
-
|
|
43499
|
+
if (!state.editingId) state.interaction = {
|
|
43500
|
+
type: "creatingText",
|
|
43501
|
+
start: event.world,
|
|
43502
|
+
current: event.world,
|
|
43503
|
+
pointerType: event.pointerType
|
|
43504
|
+
};
|
|
43464
43505
|
return;
|
|
43465
43506
|
}
|
|
43466
43507
|
const item = ctx.query.pickAt(event.world, event.pointerType);
|
|
43467
|
-
const port = touch && item !== null &&
|
|
43508
|
+
const port = touch && item !== null && ctx.selection.carries(item.id) ? null : connectionPortAt$1(event.world, event.pointerType);
|
|
43468
43509
|
if (port) {
|
|
43469
43510
|
state.interaction = arrowGesture(port.point, event.world, port.itemId, port.side);
|
|
43470
43511
|
return;
|
|
@@ -43535,12 +43576,12 @@ function createInteractionModule(ctx) {
|
|
|
43535
43576
|
select: selection.filter((id) => id !== item.id)
|
|
43536
43577
|
};
|
|
43537
43578
|
else state.selection = [...selection, item.id];
|
|
43538
|
-
} else if (!
|
|
43539
|
-
else if (selection.length > 1) tap = {
|
|
43579
|
+
} else if (!ctx.selection.carries(item.id)) state.selection = [item.id];
|
|
43580
|
+
else if (!selected || selection.length > 1) tap = {
|
|
43540
43581
|
at,
|
|
43541
43582
|
select: [item.id]
|
|
43542
43583
|
};
|
|
43543
|
-
if (plainPrimary(event) &&
|
|
43584
|
+
if (plainPrimary(event) && opensOnTap(item) && (!selected || selection.length === 1)) tap = {
|
|
43544
43585
|
at,
|
|
43545
43586
|
activate: item.id
|
|
43546
43587
|
};
|
|
@@ -43797,6 +43838,7 @@ function createInteractionModule(ctx) {
|
|
|
43797
43838
|
return;
|
|
43798
43839
|
}
|
|
43799
43840
|
case "creatingBox":
|
|
43841
|
+
case "creatingText":
|
|
43800
43842
|
state.interaction = {
|
|
43801
43843
|
...interaction,
|
|
43802
43844
|
current: event.world
|
|
@@ -43896,7 +43938,10 @@ function createInteractionModule(ctx) {
|
|
|
43896
43938
|
case "creatingArrow":
|
|
43897
43939
|
ctx.creation.commitArrow(gesture, event.cancelled);
|
|
43898
43940
|
break;
|
|
43899
|
-
case "creatingBox":
|
|
43941
|
+
case "creatingBox":
|
|
43942
|
+
ctx.creation.commitBox(gesture);
|
|
43943
|
+
break;
|
|
43944
|
+
case "creatingText": ctx.creation.commitTextGesture(gesture);
|
|
43900
43945
|
}
|
|
43901
43946
|
ctx.remote.flushPending();
|
|
43902
43947
|
}
|
|
@@ -44537,6 +44582,14 @@ function createSelectionModule(ctx) {
|
|
|
44537
44582
|
function movable() {
|
|
44538
44583
|
return ctx.query.rootsOf(ctx.query.unlockedIds(state.selection));
|
|
44539
44584
|
}
|
|
44585
|
+
function carries(id) {
|
|
44586
|
+
const roots = new Set(movable());
|
|
44587
|
+
for (let cursor = id, depth = 0; cursor && depth < 64; depth += 1) {
|
|
44588
|
+
if (roots.has(cursor)) return true;
|
|
44589
|
+
cursor = state.scene.get(cursor)?.parent;
|
|
44590
|
+
}
|
|
44591
|
+
return false;
|
|
44592
|
+
}
|
|
44540
44593
|
function nudge(dx, dy, large) {
|
|
44541
44594
|
const ids = movable();
|
|
44542
44595
|
if (ids.length === 0) return;
|
|
@@ -44671,6 +44724,7 @@ function createSelectionModule(ctx) {
|
|
|
44671
44724
|
framesFor,
|
|
44672
44725
|
placed,
|
|
44673
44726
|
movable,
|
|
44727
|
+
carries,
|
|
44674
44728
|
nudge,
|
|
44675
44729
|
align,
|
|
44676
44730
|
distribute,
|
package/dist/commands/spaces.js
CHANGED
|
@@ -10,7 +10,7 @@ import { resolveSpace } from "../space.js";
|
|
|
10
10
|
import { uploadLocalFiles } from "../space-files/upload.js";
|
|
11
11
|
import { registerDecisionCommand } from "./decision.js";
|
|
12
12
|
import { registerSpaceCommerce } from "./space-commerce.js";
|
|
13
|
-
import { registerSpaceFileTransfer } from "./space-files.js";
|
|
13
|
+
import { formatBytes, registerSpaceFileTransfer } from "./space-files.js";
|
|
14
14
|
import { registerSpaceWallet } from "./space-wallet.js";
|
|
15
15
|
import { registerSpaceActivity } from "./space-activity.js";
|
|
16
16
|
import { registerSpaceDisplays } from "./space-displays.js";
|
|
@@ -602,13 +602,16 @@ export function registerSpaces(program) {
|
|
|
602
602
|
const space = await client.spaces.get(spaceId);
|
|
603
603
|
if (jsonRequested(opts))
|
|
604
604
|
return outJson(space);
|
|
605
|
-
|
|
605
|
+
const usage = space.workspaceUsage;
|
|
606
|
+
const storage = usage ? `${usage.bytes === null ? "-" : formatBytes(usage.bytes)} (${usage.status})` : undefined;
|
|
607
|
+
table([{ ...space, storage }], [
|
|
606
608
|
{ key: "id", label: "ID" },
|
|
607
609
|
{ key: "name", label: "Name" },
|
|
608
610
|
{ key: "slug", label: "Slug" },
|
|
609
611
|
{ key: "description", label: "Description", format: (value) => truncateText(value, SPACE_DESCRIPTION_COLUMN_WIDTH) },
|
|
610
612
|
{ key: "status", label: "Status" },
|
|
611
613
|
{ key: "createdAt", label: "Created" },
|
|
614
|
+
...(storage ? [{ key: "storage", label: "Storage" }] : []),
|
|
612
615
|
]);
|
|
613
616
|
}
|
|
614
617
|
catch (e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neta-art/cohub-cli",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.17.0",
|
|
4
4
|
"description": "CLI for Cohub — spaces, sessions, and agent collaboration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"NOTICE"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@neta-art/cohub": "13.
|
|
22
|
-
"@neta-art/generation": "0.2.
|
|
21
|
+
"@neta-art/cohub": "13.7.0",
|
|
22
|
+
"@neta-art/generation": "0.2.10",
|
|
23
23
|
"commander": "^15.0.0",
|
|
24
24
|
"sharp": "^0.35.4",
|
|
25
25
|
"ws": "^8.21.3"
|