@drawback/core 0.2.0-rc.20261201121350 → 0.2.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.
Files changed (56) hide show
  1. package/dist/geometry/index.d.mts +1 -1
  2. package/dist/geometry/index.mjs +1 -1
  3. package/dist/{geometry-Brsa66kT.mjs → geometry-B6555wfO.mjs} +2 -8
  4. package/dist/grid/index.d.mts +1 -1
  5. package/dist/grid/index.mjs +1 -1
  6. package/dist/{grid-BR8od5w8.mjs → grid-BjZ79Ib6.mjs} +1 -4
  7. package/dist/{index-CYSqrhal.d.mts → index-BUdcJ8w8.d.mts} +1 -4
  8. package/dist/{index-Bt8yLTLG.d.mts → index-CukXdXbn.d.mts} +1 -4
  9. package/dist/index.d.mts +39 -157
  10. package/dist/index.mjs +48 -129
  11. package/package.json +1 -1
  12. package/src/assets/references.ts +1 -4
  13. package/src/assets/types.ts +1 -5
  14. package/src/assets/url.ts +1 -4
  15. package/src/bindings/bindings.ts +2 -15
  16. package/src/bindings/derive.ts +1 -4
  17. package/src/clipboard/format.ts +1 -4
  18. package/src/clipboard/insert.ts +1 -4
  19. package/src/commands/builtin.ts +13 -0
  20. package/src/editing-host.ts +3 -15
  21. package/src/editor.ts +7 -27
  22. package/src/events.ts +1 -4
  23. package/src/frames/frames.ts +2 -16
  24. package/src/geometry/curves.ts +1 -4
  25. package/src/geometry/simplify.ts +1 -4
  26. package/src/grid/math.ts +1 -4
  27. package/src/groups/cleanup.ts +1 -4
  28. package/src/image/images.ts +1 -4
  29. package/src/input/handle-sessions.ts +2 -7
  30. package/src/input/router.ts +1 -4
  31. package/src/interactions/interactions.ts +1 -4
  32. package/src/linear/elbow.ts +2 -8
  33. package/src/linear/linear.ts +1 -4
  34. package/src/links/links.ts +3 -14
  35. package/src/model/elements.ts +3 -12
  36. package/src/model/frame.ts +2 -9
  37. package/src/model/linear.ts +2 -8
  38. package/src/model/settings.ts +2 -5
  39. package/src/model/style.ts +2 -8
  40. package/src/modes/modes.ts +1 -0
  41. package/src/permissions/capabilities.ts +1 -0
  42. package/src/permissions/permissions.ts +6 -8
  43. package/src/plugins/plugins.ts +1 -6
  44. package/src/presence/presence.ts +1 -4
  45. package/src/scene/scene.ts +1 -5
  46. package/src/selection/selection.ts +1 -4
  47. package/src/snapping/snapping.ts +1 -2
  48. package/src/styles/styles.ts +1 -4
  49. package/src/sync/projection.ts +1 -4
  50. package/src/text/layout.ts +1 -4
  51. package/src/text/measure.ts +2 -8
  52. package/src/text/text.ts +1 -4
  53. package/src/transform/transform.ts +1 -2
  54. package/src/tx/derivation.ts +2 -10
  55. package/src/tx/document-steps.ts +1 -4
  56. package/src/tx/record-writer.ts +1 -4
@@ -1,3 +1,3 @@
1
1
  import { a as PathSubpath, i as PathSegment, n as Box, o as Point, r as Matrix2D, s as Shape, t as BoundsKind } from "../types-lGTlHviS.mjs";
2
- import { $ as boxArea, C as scaleMatrix, S as rotationMatrix, T as viewportMatrix, _ as IDENTITY_MATRIX, a as distanceToPolyline, at as boxUnion, b as invertMatrix, c as rayOutlineIntersections, ct as transformBox, d as containsPoint, et as boxContains, f as distanceToOutline, g as shapeSubpaths, h as shapeBounds, i as closestPointOnOutline, it as boxIntersects, l as roundedPolygonSegments, m as intersectsBox, n as Projection, nt as boxCorners, o as polylineSegments, ot as boxesEqual, p as flattenPath, r as catmullRomSegments, rt as boxFromPoints, s as projectOnPolyline, st as expandBox, t as simplifyPoints, tt as boxContainsPoint, u as containedInBox, v as applyMatrix, w as translationMatrix, x as multiplyMatrix, y as elementMatrix } from "../index-CYSqrhal.mjs";
2
+ import { $ as boxArea, C as scaleMatrix, S as rotationMatrix, T as viewportMatrix, _ as IDENTITY_MATRIX, a as distanceToPolyline, at as boxUnion, b as invertMatrix, c as rayOutlineIntersections, ct as transformBox, d as containsPoint, et as boxContains, f as distanceToOutline, g as shapeSubpaths, h as shapeBounds, i as closestPointOnOutline, it as boxIntersects, l as roundedPolygonSegments, m as intersectsBox, n as Projection, nt as boxCorners, o as polylineSegments, ot as boxesEqual, p as flattenPath, r as catmullRomSegments, rt as boxFromPoints, s as projectOnPolyline, st as expandBox, t as simplifyPoints, tt as boxContainsPoint, u as containedInBox, v as applyMatrix, w as translationMatrix, x as multiplyMatrix, y as elementMatrix } from "../index-BUdcJ8w8.mjs";
3
3
  export { type BoundsKind, type Box, IDENTITY_MATRIX, type Matrix2D, type PathSegment, type PathSubpath, type Point, type Projection, type Shape, applyMatrix, boxArea, boxContains, boxContainsPoint, boxCorners, boxFromPoints, boxIntersects, boxUnion, boxesEqual, catmullRomSegments, closestPointOnOutline, containedInBox, containsPoint, distanceToOutline, distanceToPolyline, elementMatrix, expandBox, flattenPath, intersectsBox, invertMatrix, multiplyMatrix, polylineSegments, projectOnPolyline, rayOutlineIntersections, rotationMatrix, roundedPolygonSegments, scaleMatrix, shapeBounds, shapeSubpaths, simplifyPoints, transformBox, translationMatrix, viewportMatrix };
@@ -1 +1 @@
1
- export { O as IDENTITY_MATRIX, k as applyMatrix, v as boxArea, y as boxContains, b as boxContainsPoint, x as boxCorners, S as boxFromPoints, C as boxIntersects, w as boxUnion, T as boxesEqual, r as catmullRomSegments, i as closestPointOnOutline, d as containedInBox, f as containsPoint, p as distanceToOutline, a as distanceToPolyline, A as elementMatrix, E as expandBox, m as flattenPath, h as intersectsBox, j as invertMatrix, M as multiplyMatrix, o as polylineSegments, s as projectOnPolyline, l as rayOutlineIntersections, N as rotationMatrix, u as roundedPolygonSegments, P as scaleMatrix, g as shapeBounds, _ as shapeSubpaths, n as simplifyPoints, D as transformBox, F as translationMatrix, I as viewportMatrix } from "../geometry-Brsa66kT.mjs";
1
+ export { O as IDENTITY_MATRIX, k as applyMatrix, v as boxArea, y as boxContains, b as boxContainsPoint, x as boxCorners, S as boxFromPoints, C as boxIntersects, w as boxUnion, T as boxesEqual, r as catmullRomSegments, i as closestPointOnOutline, d as containedInBox, f as containsPoint, p as distanceToOutline, a as distanceToPolyline, A as elementMatrix, E as expandBox, m as flattenPath, h as intersectsBox, j as invertMatrix, M as multiplyMatrix, o as polylineSegments, s as projectOnPolyline, l as rayOutlineIntersections, N as rotationMatrix, u as roundedPolygonSegments, P as scaleMatrix, g as shapeBounds, _ as shapeSubpaths, n as simplifyPoints, D as transformBox, F as translationMatrix, I as viewportMatrix } from "../geometry-B6555wfO.mjs";
@@ -697,10 +697,7 @@ function containedInBox(shape, matrix, worldBox, tolerance = DEFAULT_CURVE_TOLER
697
697
  return boxContains(worldBox, shapeBounds(shape, matrix, tolerance));
698
698
  }
699
699
  // src/geometry/curves.ts
700
- /**
701
- * Converts a Catmull-Rom spline through `points` (uniform, tension 0.5) into cubic Bézier
702
- * segments. The curve passes through every point.
703
- */
700
+ /** Catmull-Rom spline (uniform, tension 0.5) through `points` as cubic Bézier segments. */
704
701
  function catmullRomSegments(points, closed = false) {
705
702
  const first = points[0];
706
703
  if (first === void 0) return [];
@@ -896,10 +893,7 @@ function rayOutlineIntersections(shape, origin, direction, tolerance = DEFAULT_C
896
893
  return hits.sort((left, right) => left - right);
897
894
  }
898
895
  // src/geometry/simplify.ts
899
- /**
900
- * Ramer–Douglas–Peucker simplification. Keeps the first and last point; every removed point
901
- * lies within `tolerance` of the simplified polyline. Returns indices of kept points.
902
- */
896
+ /** Ramer–Douglas–Peucker; returns indices of kept points (first and last always kept). */
903
897
  function simplifyIndices(points, tolerance) {
904
898
  const count = points.length;
905
899
  if (count <= 2) return points.map((_, index) => index);
@@ -1,2 +1,2 @@
1
- import { C as gridToWorld, D as snapPoint, E as neighbors, O as worldToGrid, S as cellsInBox, T as isHexGrid, _ as cellAt, a as OffsetLayout, b as cellSpacing, c as axialToOffset, d as cubeToAxial, f as offsetToAxial, g as GridType, h as GridSnapMode, i as Offset, l as cubeRound, m as GridGeometry, n as Cube, o as axialRound, p as Cell, r as HEX_DIRECTIONS, s as axialToCube, t as Axial, u as cubeSteps, v as cellBounds, w as intersectionsNear, x as cellVertices, y as cellCenter } from "../index-Bt8yLTLG.mjs";
1
+ import { C as gridToWorld, D as snapPoint, E as neighbors, O as worldToGrid, S as cellsInBox, T as isHexGrid, _ as cellAt, a as OffsetLayout, b as cellSpacing, c as axialToOffset, d as cubeToAxial, f as offsetToAxial, g as GridType, h as GridSnapMode, i as Offset, l as cubeRound, m as GridGeometry, n as Cube, o as axialRound, p as Cell, r as HEX_DIRECTIONS, s as axialToCube, t as Axial, u as cubeSteps, v as cellBounds, w as intersectionsNear, x as cellVertices, y as cellCenter } from "../index-CukXdXbn.mjs";
2
2
  export { type Axial, type Cell, type Cube, type GridGeometry, type GridSnapMode, type GridType, HEX_DIRECTIONS, type Offset, type OffsetLayout, axialRound, axialToCube, axialToOffset, cellAt, cellBounds, cellCenter, cellSpacing, cellVertices, cellsInBox, cubeRound, cubeSteps, cubeToAxial, gridToWorld, intersectionsNear, isHexGrid, neighbors, offsetToAxial, snapPoint, worldToGrid };
@@ -1 +1 @@
1
- export { p as HEX_DIRECTIONS, m as axialRound, h as axialToCube, g as axialToOffset, t as cellAt, n as cellBounds, r as cellCenter, i as cellSpacing, a as cellVertices, o as cellsInBox, _ as cubeRound, v as cubeSteps, y as cubeToAxial, s as gridToWorld, c as intersectionsNear, l as isHexGrid, u as neighbors, b as offsetToAxial, d as snapPoint, f as worldToGrid } from "../grid-BR8od5w8.mjs";
1
+ export { p as HEX_DIRECTIONS, m as axialRound, h as axialToCube, g as axialToOffset, t as cellAt, n as cellBounds, r as cellCenter, i as cellSpacing, a as cellVertices, o as cellsInBox, _ as cubeRound, v as cubeSteps, y as cubeToAxial, s as gridToWorld, c as intersectionsNear, l as isHexGrid, u as neighbors, b as offsetToAxial, d as snapPoint, f as worldToGrid } from "../grid-BjZ79Ib6.mjs";
@@ -142,10 +142,7 @@ function hexLocal(grid, q, r) {
142
142
  y: size * (SQRT3 / 2 * q + SQRT3 * r)
143
143
  };
144
144
  }
145
- /**
146
- * Fractional grid coordinates of a world point. Square/dot: cell units with (0, 0) at
147
- * the origin corner. Hex: fractional axial coordinates with hex (0, 0) centered on the origin.
148
- */
145
+ /** Fractional grid coordinates: cells from the origin corner, or axial for hex. */
149
146
  function worldToGrid(grid, point) {
150
147
  const local = toLocal(grid, point);
151
148
  if (!isHexGrid(grid)) return {
@@ -143,10 +143,7 @@ declare function containsPoint(shape: Shape, point: Point): boolean;
143
143
  declare function distanceToOutline(shape: Shape, point: Point, tolerance?: number): number;
144
144
  declare function intersectsBox(shape: Shape, matrix: Matrix2D, worldBox: Box, tolerance?: number): boolean;
145
145
  declare function containedInBox(shape: Shape, matrix: Matrix2D, worldBox: Box, tolerance?: number): boolean;
146
- /**
147
- * Converts a Catmull-Rom spline through `points` (uniform, tension 0.5) into cubic Bézier
148
- * segments. The curve passes through every point.
149
- */
146
+ /** Catmull-Rom spline (uniform, tension 0.5) through `points` as cubic Bézier segments. */
150
147
  declare function catmullRomSegments(points: readonly Point[], closed?: boolean): PathSegment[];
151
148
  declare function polylineSegments(points: readonly Point[], closed?: boolean): PathSegment[];
152
149
  /** Path segments for a polygon with rounded corners (quadratic corners). */
@@ -16,10 +16,7 @@ interface Cell {
16
16
  }
17
17
  type GridSnapMode = 'center' | 'intersection' | 'nearest';
18
18
  declare function isHexGrid(grid: Pick<GridGeometry, 'type'>): boolean;
19
- /**
20
- * Fractional grid coordinates of a world point. Square/dot: cell units with (0, 0) at
21
- * the origin corner. Hex: fractional axial coordinates with hex (0, 0) centered on the origin.
22
- */
19
+ /** Fractional grid coordinates: cells from the origin corner, or axial for hex. */
23
20
  declare function worldToGrid(grid: GridGeometry, point: Point): Point;
24
21
  /** World point of fractional grid coordinates (inverse of {@link worldToGrid}). */
25
22
  declare function gridToWorld(grid: GridGeometry, coordinates: Point): Point;
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { $ as boxArea, A as GroupRecord, B as BrandedId, C as scaleMatrix, D as DocumentRecord, E as AssetRecord, F as OrderKey, G as IdKind, H as ElementId, I as RecordKind, J as asDocumentId, K as LayerId, L as SettingsRecord, M as JsonPrimitive, N as JsonValue, O as DocumentSnapshot, P as LayerRecord, Q as createRandomId, R as UnknownElement, S as rotationMatrix, T as viewportMatrix, U as GroupId, V as DocumentId, W as IdGenerator, X as asGroupId, Y as asElementId, Z as asLayerId, _ as IDENTITY_MATRIX, a as distanceToPolyline, at as boxUnion, b as invertMatrix, c as rayOutlineIntersections, ct as transformBox, d as containsPoint, et as boxContains, f as distanceToOutline, g as shapeSubpaths, h as shapeBounds, i as closestPointOnOutline, it as boxIntersects, j as JsonObject, k as ElementRecord, l as roundedPolygonSegments, m as intersectsBox, nt as boxCorners, o as polylineSegments, ot as boxesEqual, p as flattenPath, q as asAssetId, r as catmullRomSegments, rt as boxFromPoints, s as projectOnPolyline, st as expandBox, t as simplifyPoints, tt as boxContainsPoint, u as containedInBox, v as applyMatrix, w as translationMatrix, x as multiplyMatrix, y as elementMatrix, z as AssetId } from "./index-CYSqrhal.mjs";
1
+ import { $ as boxArea, A as GroupRecord, B as BrandedId, C as scaleMatrix, D as DocumentRecord, E as AssetRecord, F as OrderKey, G as IdKind, H as ElementId, I as RecordKind, J as asDocumentId, K as LayerId, L as SettingsRecord, M as JsonPrimitive, N as JsonValue, O as DocumentSnapshot, P as LayerRecord, Q as createRandomId, R as UnknownElement, S as rotationMatrix, T as viewportMatrix, U as GroupId, V as DocumentId, W as IdGenerator, X as asGroupId, Y as asElementId, Z as asLayerId, _ as IDENTITY_MATRIX, a as distanceToPolyline, at as boxUnion, b as invertMatrix, c as rayOutlineIntersections, ct as transformBox, d as containsPoint, et as boxContains, f as distanceToOutline, g as shapeSubpaths, h as shapeBounds, i as closestPointOnOutline, it as boxIntersects, j as JsonObject, k as ElementRecord, l as roundedPolygonSegments, m as intersectsBox, nt as boxCorners, o as polylineSegments, ot as boxesEqual, p as flattenPath, q as asAssetId, r as catmullRomSegments, rt as boxFromPoints, s as projectOnPolyline, st as expandBox, t as simplifyPoints, tt as boxContainsPoint, u as containedInBox, v as applyMatrix, w as translationMatrix, x as multiplyMatrix, y as elementMatrix, z as AssetId } from "./index-BUdcJ8w8.mjs";
2
2
  import { a as PathSubpath, i as PathSegment$1, n as Box, o as Point, r as Matrix2D, s as Shape, t as BoundsKind } from "./types-lGTlHviS.mjs";
3
- import { C as gridToWorld, D as snapPoint, E as neighbors, O as worldToGrid, S as cellsInBox, T as isHexGrid, _ as cellAt, a as OffsetLayout, b as cellSpacing, c as axialToOffset, d as cubeToAxial, f as offsetToAxial, g as GridType, h as GridSnapMode, i as Offset, l as cubeRound, m as GridGeometry, n as Cube, o as axialRound, p as Cell, r as HEX_DIRECTIONS, s as axialToCube, t as Axial, u as cubeSteps, v as cellBounds, w as intersectionsNear, x as cellVertices, y as cellCenter } from "./index-Bt8yLTLG.mjs";
3
+ import { C as gridToWorld, D as snapPoint, E as neighbors, O as worldToGrid, S as cellsInBox, T as isHexGrid, _ as cellAt, a as OffsetLayout, b as cellSpacing, c as axialToOffset, d as cubeToAxial, f as offsetToAxial, g as GridType, h as GridSnapMode, i as Offset, l as cubeRound, m as GridGeometry, n as Cube, o as axialRound, p as Cell, r as HEX_DIRECTIONS, s as axialToCube, t as Axial, u as cubeSteps, v as cellBounds, w as intersectionsNear, x as cellVertices, y as cellCenter } from "./index-CukXdXbn.mjs";
4
4
  type Platform = 'mac' | 'windows' | 'linux' | 'other';
5
5
  interface Modifiers {
6
6
  readonly shift: boolean;
@@ -229,17 +229,10 @@ interface FrameScheduler {
229
229
  cancel(handle: unknown): void;
230
230
  now(): number;
231
231
  }
232
- /**
233
- * What a controller gets from the editor that owns it. `Editor` is the part of the editor API
234
- * the controller itself calls, an {@link EditorSlice}.
235
- */
232
+ /** What a controller gets from its editor; `Editor` is the {@link EditorSlice} it calls. */
236
233
  interface EditingHost<Editor = AnyEditor, ExtensionEditor = unknown> {
237
234
  readonly editor: Editor;
238
- /**
239
- * The full editor, only for handing to public extension points (tool contexts, element
240
- * hooks, permission resolvers, paste hooks, link handlers, snap strategies). Modules that run
241
- * extensions declare it as `AnyEditor`; for everyone else it is `unknown`.
242
- */
235
+ /** The full editor, only for public extension points; `unknown` unless declared `AnyEditor`. */
243
236
  readonly extensionEditor: ExtensionEditor;
244
237
  readonly scheduler: FrameScheduler;
245
238
  readonly platform: Platform;
@@ -271,21 +264,14 @@ interface ElementLinkFormat {
271
264
  /** The element id a URL points at, or `undefined` when it is not an element link. */
272
265
  parse(url: string): string | undefined;
273
266
  }
274
- /**
275
- * Default element links, like Excalidraw's "Copy link to object": the current page with
276
- * `?element=<id>` (other query parameters and the hash are kept). A URL counts as an element
277
- * link when it has the same origin and path as the current page and an `element` parameter.
278
- */
267
+ /** Default element links, like Excalidraw: the current page with `?element=<id>`. */
279
268
  export declare const pageElementLinks: ElementLinkFormat;
280
269
  interface LinksApi {
281
270
  /** The element's link when it is a string. */
282
271
  get(id: ElementId): string | undefined;
283
272
  /** Sets or clears a link in an ordinary transaction (needs `core.edit.content`). */
284
273
  set(id: ElementId, url: string | undefined, options?: TransactionOptions): void;
285
- /**
286
- * Handles a URL scheme (without `:`), and allows it. `''` handles scheme-less (relative) links.
287
- * Replaces the default `http`/`https`/`mailto` opener when registered for those schemes.
288
- */
274
+ /** Handles and allows a scheme (no `:`; `''` = relative), overriding the default openers. */
289
275
  registerScheme(scheme: string, handler: LinkSchemeHandler): () => void;
290
276
  setAllowedSchemes(schemes: readonly string[]): void;
291
277
  allowedSchemes(): readonly string[];
@@ -296,11 +282,7 @@ interface LinksApi {
296
282
  canOpen(url: string, options?: {
297
283
  readonly elementId?: ElementId;
298
284
  }): boolean;
299
- /**
300
- * Opens an element's link or a URL through its scheme handler; `false` when blocked. A link
301
- * to an element of this document (see `elementOf`) centers the view on that element (without selecting it)
302
- * on it instead.
303
- */
285
+ /** Opens a link via its scheme handler (`false` if blocked); element links center the view. */
304
286
  open(target: ElementId | {
305
287
  readonly url: string;
306
288
  }, options?: {
@@ -515,10 +497,7 @@ export declare function isFontId(value: unknown): value is FontId;
515
497
  export declare function isValidStyleValue<Key extends StyleKey>(key: Key, value: unknown): value is ElementStyle[Key];
516
498
  /** Merges a defaults chain (lowest precedence first) over the built-in defaults. */
517
499
  export declare function mergeStyleDefaults(...levels: readonly (ElementStyleDefaults | undefined)[]): ElementStyle;
518
- /**
519
- * The element's style over `defaults`, with every key present. Results are cached per
520
- * (defaults, style) object pair and frozen, so callers must not mutate them.
521
- */
500
+ /** Full style over `defaults`, cached per (defaults, style) pair and frozen: never mutate. */
522
501
  export declare function resolveStyle(element: Pick<ElementRecord, 'style'>, defaults?: ElementStyleDefaults): ElementStyle;
523
502
  type ResizeCapability = 'free' | 'uniform' | 'none';
524
503
  interface ElementCapabilities {
@@ -578,20 +557,14 @@ interface ConnectorHooks<Record extends ElementRecord = ElementRecord> {
578
557
  endpoints(element: Record): ConnectorBindings;
579
558
  /** Path points in element-local space (at least two). */
580
559
  path(element: Record): readonly Point[];
581
- /**
582
- * Returns an update that moves the given endpoints to world positions. `startTarget` and
583
- * `endTarget` are the world bounds of the bound targets.
584
- */
560
+ /** Update moving the given endpoints to world positions; targets are world bounds. */
585
561
  withEndpoints(element: Record, resolved: {
586
562
  readonly start?: Point;
587
563
  readonly end?: Point;
588
564
  readonly startTarget?: Box;
589
565
  readonly endTarget?: Box;
590
566
  }): ElementUpdate;
591
- /**
592
- * Connectors whose whole path derives from their ends and targets (e.g. elbow routes). They are
593
- * re-derived whenever they or their targets change, not only when an end moves.
594
- */
567
+ /** Connectors whose path derives from ends and targets, re-derived when either changes. */
595
568
  routed?(element: Record): boolean;
596
569
  /** Returns an update that replaces the given bindings. */
597
570
  withBindings(element: Record, bindings: {
@@ -656,10 +629,7 @@ interface ElementDescription {
656
629
  readonly label: string;
657
630
  readonly icon: string;
658
631
  }
659
- /**
660
- * Display name and icon id: the record's `name`, then the definition's `describe`, then a
661
- * built-in label (text elements use their first line), then a label derived from the type.
662
- */
632
+ /** Display name and icon: `name`, then `describe`, then a built-in label, then the type. */
663
633
  export declare function describeElement(element: ElementRecord, definition: ElementDefinition | undefined): ElementDescription;
664
634
  export declare const DEFAULT_CAPABILITIES: ElementCapabilities;
665
635
  export declare const UNKNOWN_ELEMENT_CAPABILITIES: ElementCapabilities;
@@ -961,11 +931,7 @@ interface AssetsApi {
961
931
  /** Asset ids an element references through its definition's `assets` hook. */
962
932
  assetsOf(element: ElementRecord): readonly AssetId[];
963
933
  setLoader(loader: AssetLoader | undefined): () => void;
964
- /**
965
- * Where an asset's pixels can be read from on this client: its local file while pending,
966
- * otherwise the resolver's result or the record's `src`. `undefined` without a source.
967
- * `purpose` (default `display`) is passed to the resolver.
968
- */
934
+ /** Where an asset's pixels come from: local file while pending, else resolver or `src`. */
969
935
  source(id: AssetId, options?: {
970
936
  readonly signal?: AbortSignalLike;
971
937
  readonly purpose?: AssetResolvePurpose;
@@ -1193,12 +1159,9 @@ interface GridConfig {
1193
1159
  readonly opacity: number;
1194
1160
  /** Screen pixels. */
1195
1161
  readonly lineWidth: number;
1196
- /** Square/dot: every N cells is drawn as a major line. */
1162
+ /** Major line every N cells; hex: super-hexes of radius N - 1. 1 = none. */
1197
1163
  readonly majorEvery?: number;
1198
- /**
1199
- * Major lines' color; defaults to `color`. Lines between majors use `color` at reduced opacity,
1200
- * so `color` alone styles the whole grid.
1201
- */
1164
+ /** Major line color (defaults to `color`); minor lines use `color` at reduced opacity. */
1202
1165
  readonly majorColor?: string;
1203
1166
  }
1204
1167
  export declare const DEFAULT_GRID: GridConfig;
@@ -1461,10 +1424,7 @@ interface PermissionResolverTarget {
1461
1424
  interface PermissionResolverContext {
1462
1425
  readonly editor: AnyEditor;
1463
1426
  readonly actor: JsonValue | undefined;
1464
- /**
1465
- * Reads records in the state being evaluated: the committed document, a staged commit, or the
1466
- * state before a projected change. Prefer it over `editor.document` inside resolvers.
1467
- */
1427
+ /** Records in the state being evaluated; prefer it over `editor.document` in resolvers. */
1468
1428
  readonly get: (kind: RecordKind, id: string) => DocumentRecord | undefined;
1469
1429
  }
1470
1430
  type PermissionResolver = (target: PermissionResolverTarget, computed: CapabilitySet, context: PermissionResolverContext) => CapabilitySet | undefined;
@@ -1483,10 +1443,7 @@ interface PermissionsChangeEvent {
1483
1443
  }
1484
1444
  interface PermissionsApi {
1485
1445
  can(capability: string, target?: PermissionTarget): boolean;
1486
- /**
1487
- * Evaluates a capability for another actor (e.g. a remote client) through the same
1488
- * defaults, overrides and resolver, ignoring local mode restrictions and caches.
1489
- */
1446
+ /** Evaluates a capability for another actor, ignoring local mode restrictions and caches. */
1490
1447
  canAs(actor: JsonValue | undefined, capability: string, target?: PermissionTarget): boolean;
1491
1448
  effective(target?: PermissionTarget): CapabilitySet;
1492
1449
  explain(capability: string, target?: PermissionTarget): PermissionExplanation;
@@ -1502,10 +1459,7 @@ interface PermissionsApi {
1502
1459
  subscribe(listener: (event: PermissionsChangeEvent) => void): () => void;
1503
1460
  }
1504
1461
  type RecordLookup = (kind: RecordKind, id: string) => DocumentRecord | undefined;
1505
- /**
1506
- * Rewrites a record before it reaches a viewer. Returning `undefined` hides the record from
1507
- * that viewer as if it lacked `core.view`.
1508
- */
1462
+ /** Rewrites a record for a viewer; `undefined` hides it as if it lacked `core.view`. */
1509
1463
  type ProjectionTransform = (record: DocumentRecord, actor: JsonValue | undefined) => DocumentRecord | undefined;
1510
1464
  interface ProjectionOptions {
1511
1465
  readonly transform?: ProjectionTransform;
@@ -1583,10 +1537,7 @@ interface InteractionsApi {
1583
1537
  cancel(): boolean;
1584
1538
  onConflict(handler: ((conflict: InteractionConflict) => ConflictResolution) | undefined): void;
1585
1539
  applyRemotePreview(peerId: string, preview: InteractionPreviewEvent | unknown): void;
1586
- /**
1587
- * What `actor` may see of a preview: patches and creations of elements the actor cannot view
1588
- * are dropped. `undefined` when nothing is left to send (unless the preview is `done`).
1589
- */
1540
+ /** What `actor` may see of a preview; `undefined` when nothing is left (unless `done`). */
1590
1541
  project(preview: InteractionPreviewEvent, actor: JsonValue | undefined, options?: ProjectionOptions): InteractionPreviewEvent | undefined;
1591
1542
  clearRemote(peerId?: string): void;
1592
1543
  remotePreviews(): readonly {
@@ -1625,10 +1576,7 @@ interface SelectionHandle {
1625
1576
  readonly index?: number;
1626
1577
  /** Set on `point` handles whose point is selected in edit mode. */
1627
1578
  readonly selected?: boolean;
1628
- /**
1629
- * Side resize handles cover their whole side: the pointer hits anywhere along this segment,
1630
- * and renderers draw no knob for them (`position` is the side's midpoint).
1631
- */
1579
+ /** Side handles cover the whole side; `position` is its midpoint and no knob is drawn. */
1632
1580
  readonly span?: readonly [Point, Point];
1633
1581
  }
1634
1582
  interface SelectionOptions {
@@ -1744,16 +1692,10 @@ interface FontMetrics {
1744
1692
  readonly avgAdvance?: number;
1745
1693
  }
1746
1694
  export declare function graphemeSegments(text: string): string[];
1747
- /**
1748
- * Deterministic measurer for headless editors: widths come from per-script em
1749
- * advances, so results are identical on every machine.
1750
- */
1695
+ /** Headless measurer from per-script em advances: identical results on every machine. */
1751
1696
  export declare function createApproximateMeasurer(metricsOf?: (family: FontId) => FontMetrics | undefined): TextMeasurer;
1752
1697
  export declare function fontSpecKey(font: FontSpec): string;
1753
- /**
1754
- * Wraps a measurer with a two-generation width cache keyed by font and string: entries
1755
- * used since the last rotation survive, so the hot set stays cached in O(1) per lookup.
1756
- */
1698
+ /** Two-generation width cache by font and string: O(1) lookups that keep the hot set. */
1757
1699
  export declare function cachedMeasurer(measurer: TextMeasurer, capacity?: number): TextMeasurer & {
1758
1700
  clear(): void;
1759
1701
  readonly stats: {
@@ -1861,10 +1803,7 @@ export declare function expandTabs(text: string): string;
1861
1803
  export declare function textDirection(text: string): 'ltr' | 'rtl';
1862
1804
  /** Break units: words keep trailing punctuation; wide (CJK) runs break per grapheme. */
1863
1805
  export declare function breakUnits(paragraph: string): string[];
1864
- /**
1865
- * Lays out plain text. Break decisions use unit widths; final line widths are
1866
- * measured on whole lines so they match what the renderer draws.
1867
- */
1806
+ /** Lays out plain text; widths are measured per whole line to match the renderer. */
1868
1807
  export declare function layoutText(text: string, options: TextLayoutOptions, measurer: TextMeasurer): TextLayout;
1869
1808
  type TextTarget = 'text' | 'label';
1870
1809
  /** Layout of an element's text (standalone text or label) in element-local space. */
@@ -1978,22 +1917,12 @@ export declare const FRAME_LABEL: Readonly<{
1978
1917
  export declare const DEFAULT_FRAME_NAME = "Frame";
1979
1918
  export declare function isFrame(element: Pick<ElementRecord, 'type'> | undefined): boolean;
1980
1919
  export declare function frameName(element: Pick<ElementRecord, 'name'>): string;
1981
- /**
1982
- * Frame-local box of the name label at `zoom` (the label keeps its screen size). The width is
1983
- * estimated from the name length and never exceeds the frame width.
1984
- */
1920
+ /** Frame-local name label box at `zoom`, estimated from the name, capped to the frame width. */
1985
1921
  export declare function frameLabelBox(element: ElementRecord, zoom: number): Box;
1986
- /**
1987
- * A frame groups the elements inside it: it clips them, moves them along and is deleted and
1988
- * duplicated with them. Children store the frame in `frameId`. Frames are hit on their border
1989
- * and name label only, so clicks inside reach the canvas and the children.
1990
- */
1922
+ /** Frames clip, move and delete with their children; hit only on border and name label. */
1991
1923
  export declare const frameElement: ElementDefinition<"core.frame", import("valibot").ObjectSchema<{}, undefined>>;
1992
1924
  interface FrameSettings {
1993
- /**
1994
- * Local edits put an element into the smallest frame that fully contains it, and take it out
1995
- * when it no longer overlaps its frame (default true). Remote changes are never adjusted.
1996
- */
1925
+ /** Auto-assign elements to the smallest containing frame on local edits (default true). */
1997
1926
  readonly autoAssign: boolean;
1998
1927
  }
1999
1928
  interface FrameEditingEvent {
@@ -2111,12 +2040,7 @@ interface ToolsApi {
2111
2040
  }
2112
2041
  export declare const SELECT_TOOL_ID = "core.select";
2113
2042
  export declare function defineTool(tool: ToolDefinition): ToolDefinition;
2114
- /**
2115
- * Parts of a plugin that other packages install: `@drawback/canvas` adds `canvas`
2116
- * (renderers, overlays) and `@drawback/ui` adds `ui` (toolbar, menus, property editors,
2117
- * icons) through declaration merging. A view or UI mounted on an editor installs the facets
2118
- * of the editor's plugins.
2119
- */
2043
+ /** Plugin facets other packages add via declaration merging (`canvas`, `ui`). */
2120
2044
  interface PluginFacets {}
2121
2045
  /** A feature packaged as one unit: everything it registers is installed and removed together. */
2122
2046
  interface EditorPlugin extends Partial<PluginFacets> {
@@ -2370,10 +2294,7 @@ interface PresenceRemoteOptions {
2370
2294
  readonly showSelections: boolean;
2371
2295
  readonly showViewports: boolean;
2372
2296
  readonly showLasers: boolean;
2373
- /**
2374
- * Milliseconds remote cursors glide to each new position (0 jumps). Matches the default remote
2375
- * preview interpolation, so a dragged element and its peer's cursor move together.
2376
- */
2297
+ /** Ms remote cursors glide to a new position (0 jumps); matches remote preview easing. */
2377
2298
  readonly cursorInterpolation: number;
2378
2299
  /** Milliseconds after its last move a remote cursor hides (`undefined` keeps it shown). */
2379
2300
  readonly cursorIdleTimeout: number | undefined;
@@ -2420,10 +2341,7 @@ interface StyleSummary {
2420
2341
  readonly total: number;
2421
2342
  readonly keys: Readonly<Record<StyleKey, StyleValueSummary>>;
2422
2343
  }
2423
- /**
2424
- * Known keys take a valid value or `null` (reset to the defaults chain); namespaced
2425
- * extension keys take any JSON value or `null` (delete).
2426
- */
2344
+ /** Known keys take a valid value or `null` (reset); namespaced keys any JSON or `null`. */
2427
2345
  type StyleApplyPatch = {
2428
2346
  readonly [key: string]: JsonValue | null;
2429
2347
  };
@@ -2553,10 +2471,7 @@ interface LinearApi {
2553
2471
  removePoints(id: ElementId, indices: readonly number[], options?: TransactionOptions): void;
2554
2472
  movePoints(id: ElementId, indices: readonly number[], delta: Point, options?: LinearMoveOptions): void;
2555
2473
  setCurved(ids: ElementId | readonly ElementId[], curved: boolean, options?: TransactionOptions): void;
2556
- /**
2557
- * Sets how arrows are drawn: straight segments, a curve through the points, or an elbow route.
2558
- * Switching resets pinned elbow segments; leaving the elbow type keeps only the end points.
2559
- */
2474
+ /** Sets the arrow type; resets pinned elbow segments, and leaving elbow keeps only the ends. */
2560
2475
  setArrowType(ids: ElementId | readonly ElementId[], type: ArrowType, options?: TransactionOptions): void;
2561
2476
  /** Closes lines into polygons (or opens them); lines with fewer than three points are skipped. */
2562
2477
  setClosed(ids: ElementId | readonly ElementId[], closed: boolean, options?: TransactionOptions): void;
@@ -2688,10 +2603,7 @@ type EditorEventName = keyof EditorEventMap;
2688
2603
  type EditorEventListener<EventName extends EditorEventName> = (event: EditorEventMap[EventName]) => void;
2689
2604
  interface EventApi {
2690
2605
  on<EventName extends EditorEventName>(name: EventName, listener: EditorEventListener<EventName>): () => void;
2691
- /**
2692
- * Called for every dispatched event after its specific listeners. Per-element events
2693
- * (`element.create/update/delete`) are only produced when something listens to them by name.
2694
- */
2606
+ /** Called for every event; per-element events only fire when someone listens by name. */
2695
2607
  onAny(listener: AnyEventListener): () => void;
2696
2608
  onError(listener: (event: EditorErrorEvent) => void): () => void;
2697
2609
  reportError(error: Error, context: string): void;
@@ -2829,10 +2741,7 @@ export declare function headingFromBox(point: Point, box: Box): ElbowHeading;
2829
2741
  export declare function headingToward(point: Point, other: Point): ElbowHeading;
2830
2742
  /** Drops repeated and collinear points. */
2831
2743
  export declare function simplifyOrthogonal(points: readonly Point[]): Point[];
2832
- /**
2833
- * Orthogonal route between two ends. Bound ends leave their target along `heading`, the route
2834
- * avoids the padded targets and passes through pinned segments in order. Deterministic.
2835
- */
2744
+ /** Deterministic orthogonal route around padded targets, through pinned segments. */
2836
2745
  export declare function routeElbow(start: ElbowEnd, end: ElbowEnd, options?: ElbowRouteOptions): Point[];
2837
2746
  type LocalPoint = readonly [x: number, y: number];
2838
2747
  export declare const MAX_LINEAR_POINTS = 4096;
@@ -2871,10 +2780,7 @@ export declare function isLinearCurved(element: ElementRecord): boolean;
2871
2780
  export declare function isArrowElbowed(element: ElementRecord): boolean;
2872
2781
  /** Pinned segments of an elbow arrow in world space. */
2873
2782
  export declare function elbowFixedSegmentsWorld(element: ElementRecord): ElbowSegment[];
2874
- /**
2875
- * Re-routes an elbow arrow between world end points, keeping its pinned segments. `targets` are
2876
- * the world bounds of bound targets.
2877
- */
2783
+ /** Re-routes an elbow arrow between world ends, keeping pinned segments. */
2878
2784
  export declare function elbowArrowUpdate(element: ElementRecord, ends: {
2879
2785
  readonly start: Point;
2880
2786
  readonly end: Point;
@@ -2890,10 +2796,7 @@ interface LinearPlacement {
2890
2796
  readonly h: number;
2891
2797
  readonly points: readonly LocalPoint[];
2892
2798
  }
2893
- /**
2894
- * Computes box and normalized local points for world-space points, keeping the element's
2895
- * rotation and flips. `quantum` rounds local points (e.g. `0.01`).
2896
- */
2799
+ /** Box and normalized local points for world points, keeping rotation and flips. */
2897
2800
  export declare function linearFromWorldPoints(element: Pick<ElementRecord, 'rotation' | 'flipX' | 'flipY'>, world: readonly Point[], quantum?: number): LinearPlacement;
2898
2801
  /** Builds an update that moves a linear element's points to the given world positions. */
2899
2802
  export declare function linearUpdateFromWorld(element: ElementRecord, world: readonly Point[], quantum?: number): ElementUpdate;
@@ -3218,10 +3121,7 @@ interface DocumentQuery {
3218
3121
  interface ElementApi<Definitions extends readonly ElementDefinition[]> {
3219
3122
  create<Type extends string>(input: ElementCreateInput<Type, PropsFor<Definitions, Type>>): ElementId;
3220
3123
  createMany(inputs: readonly ElementCreateInput[]): readonly ElementId[];
3221
- /**
3222
- * Fields merged over the `data` of every element this editor creates (tools, paste,
3223
- * duplicate and API), e.g. the creating user's id. `undefined` stops stamping.
3224
- */
3124
+ /** Fields merged into new elements' `data` (e.g. the creator's id); `undefined` stops it. */
3225
3125
  setCreateData(data: JsonObject | undefined): void;
3226
3126
  update(id: ElementId, patch: ElementUpdate, options?: TransactionOptions): void;
3227
3127
  delete(id: ElementId): void;
@@ -3269,10 +3169,7 @@ interface TransactionApi<Definitions extends readonly ElementDefinition[]> {
3269
3169
  readonly assets: TransactionAssetsApi;
3270
3170
  readonly settings: TransactionSettingsApi;
3271
3171
  }
3272
- /**
3273
- * `amend` folds a patch into the history entries that created the patched records (e.g. the
3274
- * upload result of a pending asset), so undo and redo use the amended records.
3275
- */
3172
+ /** Folds a patch into the history entries that created the records, so undo/redo use it. */
3276
3173
  type HistoryMode = 'record' | 'skip' | 'merge' | 'amend';
3277
3174
  interface TransactionOptions {
3278
3175
  readonly origin?: ChangeOrigin;
@@ -3319,10 +3216,7 @@ interface ApplyChangesOptions {
3319
3216
  readonly partial?: boolean;
3320
3217
  readonly onMissing?: 'skip' | 'reject';
3321
3218
  readonly trust?: 'authoritative' | 'checked';
3322
- /**
3323
- * With `trust: 'checked'`, enforces permissions for this actor (through `canAs`) instead of
3324
- * the editor's local actor and mode. Pass `undefined` explicitly to check an anonymous actor.
3325
- */
3219
+ /** With `trust: 'checked'`, checks permissions as this actor; pass `undefined` for anonymous. */
3326
3220
  readonly actor?: JsonValue | undefined;
3327
3221
  }
3328
3222
  type ApplyChangesResult = {
@@ -3359,12 +3253,7 @@ interface SyncApi {
3359
3253
  validate(changeSet: unknown, options?: ApplyChangesOptions): ChangeSetValidationResult;
3360
3254
  changesSince(revision: number): readonly ChangeSet[];
3361
3255
  stripPreviousValues(changeSet: ChangeSet): ChangeSet;
3362
- /**
3363
- * What `actor` may see of a change set that was just committed (call it inside
3364
- * `document.onChange` or right after `applyChanges`, before the next commit). Records the actor
3365
- * cannot view are dropped, visibility changes become `put`/`delete` operations, and assets
3366
- * follow the visibility of the elements that reference them.
3367
- */
3256
+ /** What `actor` may see of the just-committed change set; call it before the next commit. */
3368
3257
  project(changeSet: ChangeSet, actor: JsonValue | undefined, options?: ProjectionOptions): ChangeSet;
3369
3258
  }
3370
3259
  interface CommitContext {
@@ -3381,11 +3270,7 @@ type CommitHookResult = void | {
3381
3270
  };
3382
3271
  type CommitHook = (changeSet: ChangeSet, context: CommitContext) => CommitHookResult;
3383
3272
  interface CommitHookOptions {
3384
- /**
3385
- * Also run for remote changes applied with `trust: 'checked'`. Hooks always run for local
3386
- * origins (`local-user`, `local-api`, `plugin`, `history`) and never for `load` or
3387
- * authoritative remote changes.
3388
- */
3273
+ /** Also run for checked remote changes; never for `load` or authoritative remote changes. */
3389
3274
  readonly trusted?: boolean;
3390
3275
  }
3391
3276
  interface TransactionsApi {
@@ -3535,10 +3420,7 @@ export declare const MAX_ASSET_DIMENSION = 65535;
3535
3420
  export declare const MAX_ASSET_BYTES: number;
3536
3421
  /** Scheme of a URL, lower-cased, or `undefined` for relative URLs. */
3537
3422
  export declare function urlScheme(url: string): string | undefined;
3538
- /**
3539
- * Durable asset sources: http(s), relative URLs and host schemes. Runtime-only
3540
- * (`blob:`, `data:`) and script URLs are rejected.
3541
- */
3423
+ /** Durable asset sources only: http(s), relative and host schemes; no `blob:`/`data:`/script. */
3542
3424
  export declare function validateAssetSource(src: unknown, context: string, hostSchemes?: ReadonlySet<string>): string;
3543
3425
  export declare const MAX_TEXT_LENGTH = 100000;
3544
3426
  /** A label owned by its element: text inside shapes, or along a connector path. */