pixiboardjs 0.1.0-alpha.0 → 0.1.0-alpha.1

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/CHANGELOG.md CHANGED
@@ -1,7 +1,48 @@
1
1
  # Changelog
2
2
 
3
- All notable changes to `pixiboardjs` will be documented here.
3
+ ## 0.1.0-alpha.1
4
+
5
+ ### Minor Changes
6
+
7
+ - 955e863: Publish `@pixi-board/capabilities` and `@pixi-board/agent-tools`; remove `@pixi-board/mcp-host`.
8
+
9
+ A third-party agent project can now embed the canvas and drive it from its own
10
+ agent layer without taking the renderer: install `@pixi-board/core` +
11
+ `@pixi-board/capabilities` (+ optionally `@pixi-board/agent-tools`) and run
12
+ headless. Both packages externalize their dependencies, so there is exactly one
13
+ `capabilities` implementation on npm.
14
+
15
+ `agent-tools` keeps its `./schemas` subpath so the `canvas.read` / `canvas.write`
16
+ JSON Schemas can be registered directly with an agent framework's tool registry.
17
+
18
+ `mcp-host` is deleted. It only implemented `tools/call` — no `initialize` or
19
+ `tools/list` handshake — so it could not be attached to a real MCP client, and it
20
+ was never published. Transport (MCP, HTTP, in-process) is now explicitly the
21
+ integrator's concern; the SDK ships the tool contract and its schemas.
22
+
23
+ `CapabilityError` now carries a `brand` field, and `isCapabilityError()` is
24
+ exported. `pixiboardjs` inlines capabilities into its bundle, so an error thrown
25
+ by a board is not an `instanceof` the class a separately installed consumer
26
+ imports; the brand makes that identification work across copies. Error mapping in
27
+ `capabilities` and `agent-tools` uses it, which also fixes the pre-existing case
28
+ where such an error was flattened to `INTERNAL_ERROR`.
4
29
 
5
- ## Unreleased
30
+ - 199a6e4: Implement selection resize end to end and connect the previously inert `ResizePolicy`.
6
31
 
7
- - Added the P6 publishability workflow and artifact checks.
32
+ - core: `resolveResize()` / `resolveResizeSize()` turn one handle drag into a patch through the node type's policy (`free`, `aspect-ratio`, `fixed`, `custom`), resolving the delta in a rotated node's own frame and anchoring the edges the handle does not own. `nodes.resize()` commits it; a refused resize produces no revision. Policies are now validated at registration instead of failing silently at runtime.
33
+ - core: `TransactionOptions.coalesceKey` merges a per-frame pointer gesture into one history entry, compacting the repeated replace patches so a long drag does not leave thousands of them on a single undo step.
34
+ - pixiboardjs: `board.transform` drives resize gestures for the current selection — handle placement with rotation-aware cursors, single-node and group bounds, and `begin`/`update`/`commit`/`cancel` sessions. Group resize scales the selection as one unit while each node's size still passes through its own policy.
35
+ - pixiboardjs/browser: `attachDomTransformer()` renders the eight control points as real, grabbable DOM elements and drives the gesture from their pointer events.
36
+
37
+ - 955e863: Connect viewport virtualization to the main package and give node renderers level-of-detail tiers.
38
+
39
+ - core: `viewport.visibleWorldBounds(padding?)` projects the current surface back into world coordinates, and `viewport.getScreenSize()` reads it back. Both return/report nothing useful until a host has actually measured the surface — the 1x1 constructor default is a placeholder, and `visibleWorldBounds()` returns `undefined` rather than culling everything against it.
40
+ - pixiboardjs: `createPixiBoard()` now drives the renderer's visible bounds on mount, on `viewport:change`, and on container resize, so live render objects track visible content instead of document size. Previously `PixiBoardRenderer.setVisibleBounds()` existed and was tested but nothing on the facade path ever called it, leaving every SDK consumer fully retained. Configurable through `virtualization: { enabled?, padding? }` (default on, 256 world units of margin); `RuntimeRenderer.setVisibleBounds` is optional, so a renderer that retains everything stays valid.
41
+ - renderer-pixi: `setVisibleBounds(bounds, scale?)` resolves a level-of-detail tier from the viewport scale (`lod: { thresholds }`, default `[0.25, 0.5, 1]`) and exposes it as `context.lod`, which was previously always an empty object. Views retained across a tier change are re-updated once so a node renderer can draw itself more cheaply when zoomed out — the case culling cannot help with, because every node is legitimately on screen. The tier also travels to `acquireTexture` as `lodLevel`/`lodScale` so a host can resolve a lower-resolution asset variant.
42
+
43
+ ### Patch Changes
44
+
45
+ - 7febced: Make selection resizing proportional by default, with Command/Ctrl unlocking freeform resizing in the site transformer.
46
+ - 9415656: Prepare reproducible JavaScript and declaration artifacts, formal package exports, API reporting, and release-size gates for the P6 publishability workflow.
47
+
48
+ All notable changes to `pixiboardjs` will be documented here.
package/dist/browser.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { AssetUnavailableError, BoardDestroyedError, CapabilityError, CapabilityUnavailableError, DocumentValidationError, NodeNotFoundError, NodeTypeNotRegisteredError, NodeValidationError, PermissionDeniedError, RESIZE_HANDLES, TransactionConflictError, createPixiBoard, resizeHandleAxes, resizeHandleCursor } from './index.js';
2
- import { P as PixiBoard, B as BoardNode, J as JsonValue, W as WorldBounds, a as Point, V as ViewportSnapshot, b as BoardDocument, A as AssetRecord } from './types-DnR8yhxj.js';
3
- export { c as BoardCapabilities, d as BoardChangeEvent, e as BoardDocumentUpdate, f as BoardLifecycleState, g as BoardNodeCreateInput, h as BoardNodePatch, i as BoardRuntimePorts, j as BrowserEventPort, C as CaptureInput, k as CaptureResult, l as ChangeOrigin, m as CustomDisplayFactory, n as CustomDisplayObject, o as CustomNodeDataDefinition, p as CustomNodeDefinition, q as CustomNodeRenderer, r as CustomNodeRendererContext, s as CustomNodeRendererRegistry, t as CustomNodeView, u as CustomResizePolicy, v as CustomTextureLease, D as DocumentLoadOptions, w as DocumentPersistence, H as HistoryChangeEvent, N as NodeGeometry, x as NodeHandle, y as NodeHandleEventMap, z as NodeInput, E as NodeListFilter, F as NodePatch, G as NodeQuery, I as NodeResizeRequest, K as NodeTypeDefinition, L as NodeTypeRegistrationDisposer, M as NodeTypeRegistrationOptions, O as PixiBoardOptions, Q as PixiBoardRendererOptions, R as PublicBoardEventMap, S as PublicNodeTypeDefinition, T as PublicRendererOptions, U as RenderCompleteEvent, X as RendererApplyResult, Y as ResizeHandle, Z as ResizeObserverPort, _ as RuntimeRenderer, $ as SelectionChangeEvent, a0 as TickerPort, a1 as TransactionOptions, a2 as TransactionOrigin, a3 as TransformBounds, a4 as TransformHandlePlacement, a5 as TransformSession, a6 as ViewportChangeEvent } from './types-DnR8yhxj.js';
2
+ import { R as ResizeHandle, P as PixiBoard, B as BoardNode, J as JsonValue, W as WorldBounds, a as Point, V as ViewportSnapshot, b as BoardDocument, A as AssetRecord } from './types-DhluAalJ.js';
3
+ export { c as BoardCapabilities, d as BoardChangeEvent, e as BoardDocumentUpdate, f as BoardLifecycleState, g as BoardNodeCreateInput, h as BoardNodePatch, i as BoardRuntimePorts, j as BrowserEventPort, C as CaptureInput, k as CaptureResult, l as ChangeOrigin, m as CustomDisplayFactory, n as CustomDisplayObject, o as CustomNodeDataDefinition, p as CustomNodeDefinition, q as CustomNodeRenderer, r as CustomNodeRendererContext, s as CustomNodeRendererRegistry, t as CustomNodeView, u as CustomResizePolicy, v as CustomTextureLease, D as DocumentLoadOptions, w as DocumentPersistence, H as HistoryChangeEvent, N as NodeGeometry, x as NodeHandle, y as NodeHandleEventMap, z as NodeInput, E as NodeListFilter, F as NodePatch, G as NodeQuery, I as NodeResizeRequest, K as NodeTypeDefinition, L as NodeTypeRegistrationDisposer, M as NodeTypeRegistrationOptions, O as PixiBoardOptions, Q as PixiBoardRendererOptions, S as PublicBoardEventMap, T as PublicNodeTypeDefinition, U as PublicRendererOptions, X as RenderCompleteEvent, Y as RendererApplyResult, Z as ResizeObserverPort, _ as RuntimeRenderer, $ as SelectionChangeEvent, a0 as TickerPort, a1 as TransactionOptions, a2 as TransactionOrigin, a3 as TransformBounds, a4 as TransformHandlePlacement, a5 as TransformSession, a6 as ViewportChangeEvent } from './types-DhluAalJ.js';
4
4
 
5
5
  type DomTransformerOptions = {
6
6
  /**
@@ -18,6 +18,8 @@ type DomTransformerOptions = {
18
18
  size?: number;
19
19
  /** Prefix for the generated class names; see `attachDomTransformer` docs. */
20
20
  classPrefix?: string;
21
+ /** Control points rendered by this host. Defaults to all eight points. */
22
+ handles?: readonly ResizeHandle[];
21
23
  };
22
24
  type DomTransformer = {
23
25
  /** Re-projects the handles. Call on selection, document and viewport change. */
@@ -237,6 +239,12 @@ type SelectionOverlayOptions = {
237
239
  groupBox?: boolean;
238
240
  /** Padding in CSS pixels between the group box and the selection. */
239
241
  groupBoxPadding?: number;
242
+ /**
243
+ * Draw individual node outlines. Use `"single"` to retain the outline for
244
+ * a single-node selection while a multi-selection only shows its group box.
245
+ * Defaults to true.
246
+ */
247
+ nodeOutlines?: boolean | "single";
240
248
  schedule?(callback: () => void): () => void;
241
249
  };
242
250
  /**
@@ -654,4 +662,4 @@ declare function indexedDbPersistence(options?: {
654
662
  database?: string;
655
663
  }): BrowserPersistenceAdapter;
656
664
 
657
- export { type AdapterOperationOptions, type AssetBinaryVariant, type AssetGcOptions, type AssetGcResult, type AssetGcRoots, type AssetStorageLocation, BoardDocument, BoardNode, type BrowserAdapterCapabilities, type BrowserAdapterContractEvidence, type BrowserAdapterContractHarness, type BrowserAsset, BrowserAssetBinaryMissingError, type BrowserAssetExport, BrowserAssetNotFoundError, type BrowserCleanupError, type BrowserCleanupOperation, type BrowserCommitImportOptions, BrowserDocumentConflictError, type BrowserDocumentMetadata, type BrowserDocumentRecord, type BrowserDownloadRequest, type BrowserExportOptions, type BrowserImportOptions, type BrowserImportResult, type BrowserImportSourceType, BrowserPersistenceAbortError, BrowserPersistenceAdapter, type BrowserPersistenceAdapterOptions, BrowserPersistenceDestroyedError, BrowserPersistenceError, type BrowserPrepareImportOptions, type BrowserPreparedImport, BrowserStorageCapabilityError, BrowserStorageKeyCollisionError, BrowserStorageQuotaError, DEFAULT_OPFS_THRESHOLD_BYTES, type DomTransformer, type DomTransformerOptions, type DownloadPort, type GetAssetOptions, type IndexedDbPort, JsonValue, type LabelOverlayOptions, NativeDownloadPort, type NativeDownloadPortOptions, NativeIndexedDbPort, type NativeIndexedDbPortOptions, NativeObjectUrlPort, NativeOpfsPort, type NativeOpfsPortOptions, type ObjectUrlLease, type ObjectUrlPort, type OpfsPort, type OverlayAnchor, type OverlayBoundsResolver, type OverlayDeclutter, type OverlayItem, type OverlayLayer, type OverlayLayerOptions, type OverlayPlacement, type OverlayRenderContext, type OverlayScaleMode, PixiBoard, Point, type PortLifecycle, type PutAssetOptions, type SaveBrowserDocumentInput, type SaveBrowserDocumentOptions, type SelectionOverlayOptions, type StoredAssetBinary, type StoredAssetEntry, ViewportSnapshot, WorldBounds, anchorRatio, anchorWorldPoint, attachDomTransformer, attachLabelOverlay, attachOverlayLayer, attachSelectionOverlay, indexedDbPersistence, isBrowserQuotaError, projectOverlayItem, resolveOverlayBounds, resolveScale, runBrowserAdapterContract };
665
+ export { type AdapterOperationOptions, type AssetBinaryVariant, type AssetGcOptions, type AssetGcResult, type AssetGcRoots, type AssetStorageLocation, BoardDocument, BoardNode, type BrowserAdapterCapabilities, type BrowserAdapterContractEvidence, type BrowserAdapterContractHarness, type BrowserAsset, BrowserAssetBinaryMissingError, type BrowserAssetExport, BrowserAssetNotFoundError, type BrowserCleanupError, type BrowserCleanupOperation, type BrowserCommitImportOptions, BrowserDocumentConflictError, type BrowserDocumentMetadata, type BrowserDocumentRecord, type BrowserDownloadRequest, type BrowserExportOptions, type BrowserImportOptions, type BrowserImportResult, type BrowserImportSourceType, BrowserPersistenceAbortError, BrowserPersistenceAdapter, type BrowserPersistenceAdapterOptions, BrowserPersistenceDestroyedError, BrowserPersistenceError, type BrowserPrepareImportOptions, type BrowserPreparedImport, BrowserStorageCapabilityError, BrowserStorageKeyCollisionError, BrowserStorageQuotaError, DEFAULT_OPFS_THRESHOLD_BYTES, type DomTransformer, type DomTransformerOptions, type DownloadPort, type GetAssetOptions, type IndexedDbPort, JsonValue, type LabelOverlayOptions, NativeDownloadPort, type NativeDownloadPortOptions, NativeIndexedDbPort, type NativeIndexedDbPortOptions, NativeObjectUrlPort, NativeOpfsPort, type NativeOpfsPortOptions, type ObjectUrlLease, type ObjectUrlPort, type OpfsPort, type OverlayAnchor, type OverlayBoundsResolver, type OverlayDeclutter, type OverlayItem, type OverlayLayer, type OverlayLayerOptions, type OverlayPlacement, type OverlayRenderContext, type OverlayScaleMode, PixiBoard, Point, type PortLifecycle, type PutAssetOptions, ResizeHandle, type SaveBrowserDocumentInput, type SaveBrowserDocumentOptions, type SelectionOverlayOptions, type StoredAssetBinary, type StoredAssetEntry, ViewportSnapshot, WorldBounds, anchorRatio, anchorWorldPoint, attachDomTransformer, attachLabelOverlay, attachOverlayLayer, attachSelectionOverlay, indexedDbPersistence, isBrowserQuotaError, projectOverlayItem, resolveOverlayBounds, resolveScale, runBrowserAdapterContract };
package/dist/browser.js CHANGED
@@ -2907,7 +2907,8 @@ var TransformController = class {
2907
2907
  if (!bounds) return [];
2908
2908
  const cos = Math.cos(bounds.rotation);
2909
2909
  const sin = Math.sin(bounds.rotation);
2910
- return RESIZE_HANDLES.map((handle) => {
2910
+ const allowed = new Set(this.options.handles ?? RESIZE_HANDLES);
2911
+ return RESIZE_HANDLES.filter((handle) => allowed.has(handle)).map((handle) => {
2911
2912
  const local = handleLocalPoint(handle, bounds.width, bounds.height);
2912
2913
  return {
2913
2914
  handle,
@@ -2970,7 +2971,7 @@ var ActiveSession = class {
2970
2971
  onEnd;
2971
2972
  done = false;
2972
2973
  origins;
2973
- update(deltaWorld) {
2974
+ update(deltaWorld, options = {}) {
2974
2975
  if (this.done) return;
2975
2976
  if (!Number.isFinite(deltaWorld.x) || !Number.isFinite(deltaWorld.y)) return;
2976
2977
  this.host.transaction(
@@ -2978,16 +2979,19 @@ var ActiveSession = class {
2978
2979
  () => {
2979
2980
  if (this.origins.length === 1) {
2980
2981
  const [only] = this.origins;
2982
+ const policy = this.host.resizePolicy(only.type);
2983
+ const adjustedDelta = options.preserveAspectRatio ? preserveAspectDelta(deltaWorld, this.handle, only.geometry) : deltaWorld;
2984
+ const limits = options.preserveAspectRatio && (!policy || policy.mode === "free") ? proportionalMinimums(only.geometry, this.limits) : this.limits;
2981
2985
  this.host.resize(only.id, {
2982
2986
  handle: this.handle,
2983
- deltaWorld,
2987
+ deltaWorld: adjustedDelta,
2984
2988
  origin: only.geometry,
2985
- minWidth: this.limits.minWidth,
2986
- minHeight: this.limits.minHeight
2989
+ minWidth: limits.minWidth,
2990
+ minHeight: limits.minHeight
2987
2991
  });
2988
2992
  return;
2989
2993
  }
2990
- this.scaleGroup(deltaWorld);
2994
+ this.scaleGroup(deltaWorld, options.preserveAspectRatio === true);
2991
2995
  },
2992
2996
  { origin: "ui", coalesceKey: this.coalesceKey }
2993
2997
  );
@@ -3027,25 +3031,58 @@ var ActiveSession = class {
3027
3031
  * nodes.resize(), which would re-anchor each node against its own origin
3028
3032
  * and tear the group apart.
3029
3033
  */
3030
- scaleGroup(deltaWorld) {
3034
+ scaleGroup(deltaWorld, preserveAspectRatio) {
3031
3035
  const box = this.groupOrigin;
3032
3036
  const axes = resizeHandleAxes(this.handle);
3033
- const width = Math.max(box.width + axes.horizontal * deltaWorld.x, this.limits.minWidth);
3034
- const height = Math.max(box.height + axes.vertical * deltaWorld.y, this.limits.minHeight);
3035
- const scaleX = box.width > 0 ? width / box.width : 1;
3036
- const scaleY = box.height > 0 ? height / box.height : 1;
3037
+ const gestureDelta = preserveAspectRatio ? preserveAspectDelta(deltaWorld, this.handle, { x: box.x, y: box.y, width: box.width, height: box.height, rotation: 0 }) : deltaWorld;
3038
+ const width = Math.max(box.width + axes.horizontal * gestureDelta.x, this.limits.minWidth);
3039
+ const height = Math.max(box.height + axes.vertical * gestureDelta.y, this.limits.minHeight);
3040
+ let scaleX = box.width > 0 ? width / box.width : 1;
3041
+ let scaleY = box.height > 0 ? height / box.height : 1;
3042
+ if (preserveAspectRatio && axes.horizontal !== 0 && axes.vertical !== 0) {
3043
+ let minimumScale = Math.max(
3044
+ box.width > 0 ? this.limits.minWidth / box.width : 1,
3045
+ box.height > 0 ? this.limits.minHeight / box.height : 1
3046
+ );
3047
+ for (const { type, geometry } of this.origins) {
3048
+ const policy = this.host.resizePolicy(type);
3049
+ if (policy && policy.mode !== "free") continue;
3050
+ if (geometry.width <= 0 || geometry.height <= 0) {
3051
+ minimumScale = Math.max(
3052
+ minimumScale,
3053
+ geometry.width > 0 ? this.limits.minWidth / geometry.width : 0,
3054
+ geometry.height > 0 ? this.limits.minHeight / geometry.height : 0
3055
+ );
3056
+ continue;
3057
+ }
3058
+ const minimums = proportionalMinimums(geometry, this.limits);
3059
+ minimumScale = Math.max(
3060
+ minimumScale,
3061
+ minimums.minWidth / geometry.width,
3062
+ minimums.minHeight / geometry.height
3063
+ );
3064
+ }
3065
+ const scale = Math.max(scaleX, scaleY, minimumScale);
3066
+ scaleX = scale;
3067
+ scaleY = scale;
3068
+ }
3037
3069
  const anchorX = axes.horizontal === -1 ? box.x + box.width : box.x;
3038
3070
  const anchorY = axes.vertical === -1 ? box.y + box.height : box.y;
3039
3071
  for (const { id, type, geometry } of this.origins) {
3040
3072
  const node = this.host.getNode(id);
3041
3073
  if (!node) continue;
3042
- const resolved = resolveResizeSize(node, this.host.resizePolicy(type), {
3074
+ const policy = this.host.resizePolicy(type);
3075
+ const limits = preserveAspectRatio && (!policy || policy.mode === "free") ? geometry.width <= 0 || geometry.height <= 0 ? {
3076
+ minWidth: geometry.width > 0 ? this.limits.minWidth : 0,
3077
+ minHeight: geometry.height > 0 ? this.limits.minHeight : 0
3078
+ } : proportionalMinimums(geometry, this.limits) : this.limits;
3079
+ const resolved = resolveResizeSize(node, policy, {
3043
3080
  handle: this.handle,
3044
3081
  width: geometry.width * scaleX,
3045
3082
  height: geometry.height * scaleY,
3046
3083
  origin: geometry,
3047
- minWidth: this.limits.minWidth,
3048
- minHeight: this.limits.minHeight
3084
+ minWidth: limits.minWidth,
3085
+ minHeight: limits.minHeight
3049
3086
  });
3050
3087
  if (!resolved) continue;
3051
3088
  this.host.update(id, {
@@ -3058,6 +3095,31 @@ var ActiveSession = class {
3058
3095
  }
3059
3096
  }
3060
3097
  };
3098
+ function proportionalMinimums(geometry, limits) {
3099
+ const ratio = geometry.width / geometry.height;
3100
+ if (!Number.isFinite(ratio) || ratio <= 0) return limits;
3101
+ return {
3102
+ minWidth: Math.max(limits.minWidth, limits.minHeight * ratio),
3103
+ minHeight: Math.max(limits.minHeight, limits.minWidth / ratio)
3104
+ };
3105
+ }
3106
+ function preserveAspectDelta(deltaWorld, handle, origin) {
3107
+ const axes = resizeHandleAxes(handle);
3108
+ if (axes.horizontal === 0 || axes.vertical === 0 || origin.width <= 0 || origin.height <= 0) return deltaWorld;
3109
+ const ratio = origin.width / origin.height;
3110
+ const cos = Math.cos(origin.rotation);
3111
+ const sin = Math.sin(origin.rotation);
3112
+ const localDelta = { x: deltaWorld.x * cos + deltaWorld.y * sin, y: -deltaWorld.x * sin + deltaWorld.y * cos };
3113
+ const widthDelta = axes.horizontal * localDelta.x;
3114
+ const heightDelta = axes.vertical * localDelta.y;
3115
+ let localResult;
3116
+ if (Math.abs(widthDelta) >= Math.abs(heightDelta) * ratio) {
3117
+ localResult = { x: localDelta.x, y: axes.vertical * (widthDelta / ratio) };
3118
+ } else {
3119
+ localResult = { x: axes.horizontal * (heightDelta * ratio), y: localDelta.y };
3120
+ }
3121
+ return { x: localResult.x * cos - localResult.y * sin, y: localResult.x * sin + localResult.y * cos };
3122
+ }
3061
3123
  function handleLocalPoint(handle, width, height) {
3062
3124
  const axes = resizeHandleAxes(handle);
3063
3125
  return {
@@ -3820,6 +3882,11 @@ function attachDomTransformer(board, options) {
3820
3882
  let captureElement;
3821
3883
  let startScreen = { x: 0, y: 0 };
3822
3884
  let interactive = true;
3885
+ const allowedHandles = new Set(options.handles ?? ["nw", "n", "ne", "e", "se", "s", "sw", "w"]);
3886
+ let allowFreeResize = false;
3887
+ const hasAspectModifier = (event) => {
3888
+ return event.metaKey || event.ctrlKey || event.getModifierState("Meta") || event.getModifierState("Control");
3889
+ };
3823
3890
  const applyInteractivity = () => {
3824
3891
  for (const element of elements.values()) element.style.pointerEvents = interactive ? "auto" : "none";
3825
3892
  };
@@ -3877,6 +3944,7 @@ function attachDomTransformer(board, options) {
3877
3944
  if (event.button !== 0 || session) return;
3878
3945
  event.preventDefault();
3879
3946
  event.stopPropagation();
3947
+ allowFreeResize = hasAspectModifier(event);
3880
3948
  const started = board.transform.begin(handle);
3881
3949
  if (!started) return;
3882
3950
  session = started;
@@ -3892,7 +3960,10 @@ function attachDomTransformer(board, options) {
3892
3960
  const screen = toSurfacePoint(event);
3893
3961
  const from = board.viewport.toWorld(startScreen);
3894
3962
  const to = board.viewport.toWorld(screen);
3895
- session.update({ x: to.x - from.x, y: to.y - from.y });
3963
+ session.update(
3964
+ { x: to.x - from.x, y: to.y - from.y },
3965
+ { preserveAspectRatio: !(allowFreeResize || hasAspectModifier(event)) }
3966
+ );
3896
3967
  refresh();
3897
3968
  };
3898
3969
  const onPointerUp = (event) => {
@@ -3918,11 +3989,9 @@ function attachDomTransformer(board, options) {
3918
3989
  return element;
3919
3990
  };
3920
3991
  const refresh = () => {
3921
- const placements = board.transform.handles();
3922
- if (placements.length === 0) {
3923
- for (const element of elements.values()) element.style.display = "none";
3924
- return;
3925
- }
3992
+ const placements = board.transform.handles().filter((placement) => allowedHandles.has(placement.handle));
3993
+ for (const element of elements.values()) element.style.display = "none";
3994
+ if (placements.length === 0) return;
3926
3995
  for (const placement of placements) {
3927
3996
  const element = handleFor(placement.handle);
3928
3997
  const screen = board.viewport.toScreen(placement.world);
@@ -3933,13 +4002,24 @@ function attachDomTransformer(board, options) {
3933
4002
  }
3934
4003
  };
3935
4004
  const onKeyDown = (event) => {
4005
+ if (event.key === "Meta" || event.key === "Control" || event.code === "MetaLeft" || event.code === "MetaRight" || event.code === "ControlLeft" || event.code === "ControlRight") allowFreeResize = hasAspectModifier(event);
3936
4006
  if (event.key === "Escape" && session) {
3937
4007
  event.preventDefault();
3938
4008
  endSession("cancel");
3939
4009
  }
3940
4010
  };
4011
+ const onKeyUp = (event) => {
4012
+ if (event.key === "Meta" || event.key === "Control" || event.code === "MetaLeft" || event.code === "MetaRight" || event.code === "ControlLeft" || event.code === "ControlRight") allowFreeResize = hasAspectModifier(event);
4013
+ };
4014
+ const onWindowBlur = () => {
4015
+ allowFreeResize = false;
4016
+ };
3941
4017
  window.addEventListener("keydown", onKeyDown);
4018
+ window.addEventListener("keyup", onKeyUp);
4019
+ window.addEventListener("blur", onWindowBlur);
3942
4020
  disposers.push(() => window.removeEventListener("keydown", onKeyDown));
4021
+ disposers.push(() => window.removeEventListener("keyup", onKeyUp));
4022
+ disposers.push(() => window.removeEventListener("blur", onWindowBlur));
3943
4023
  for (const event of ["selection:change", "change", "viewport:change"]) {
3944
4024
  disposers.push(board.on(event, refresh));
3945
4025
  }
@@ -4174,6 +4254,7 @@ function attachSelectionOverlay(board, options) {
4174
4254
  const prefix = options.classPrefix ?? "pixiboard";
4175
4255
  const padding = options.groupBoxPadding ?? 6;
4176
4256
  const groupBox = options.groupBox ?? true;
4257
+ const nodeOutlines = options.nodeOutlines ?? true;
4177
4258
  const outlineClass = `${prefix}-selection-outline`;
4178
4259
  const groupClass = `${prefix}-selection-bbox`;
4179
4260
  let groupElement;
@@ -4218,7 +4299,10 @@ function attachSelectionOverlay(board, options) {
4218
4299
  // Selection outlines follow the selection, not the viewport: a selected
4219
4300
  // node scrolled just off screen must keep its outline, so this
4220
4301
  // deliberately opts out of visible-set culling.
4221
- candidates: () => board.selection.get(),
4302
+ candidates: () => {
4303
+ const selected = board.selection.get();
4304
+ return nodeOutlines === true || nodeOutlines === "single" && selected.length === 1 ? selected : [];
4305
+ },
4222
4306
  item: () => ({ anchor: "top-left" }),
4223
4307
  render: ({ element, node }) => {
4224
4308
  const size = screenSize(board, node);