lineadraw 0.8.0 → 0.10.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/sdk.d.ts CHANGED
@@ -1,17 +1,18 @@
1
1
  import { z } from 'zod';
2
+ export { BridgeError, BridgeOptions, BridgeStatus, DEFAULT_BRIDGE_PORT, EditorHandle, EditorInfo, LineaBridge, bridgeFilePath, connectEditors, createBridge } from './bridge.js';
2
3
 
3
- interface Vec2 {
4
+ interface Vec2$1 {
4
5
  x: number;
5
6
  y: number;
6
7
  }
7
8
 
8
9
  interface Segment {
9
- a: Vec2;
10
- b: Vec2;
10
+ a: Vec2$1;
11
+ b: Vec2$1;
11
12
  }
12
13
 
13
14
  interface ArcGeom {
14
- center: Vec2;
15
+ center: Vec2$1;
15
16
  radius: number;
16
17
  /** Start angle, radians CCW from +X. */
17
18
  startAngle: number;
@@ -20,8 +21,8 @@ interface ArcGeom {
20
21
  }
21
22
 
22
23
  interface EllipseGeom {
23
- center: Vec2;
24
- majorAxis: Vec2;
24
+ center: Vec2$1;
25
+ majorAxis: Vec2$1;
25
26
  /** minor/major in (0, 1]. */
26
27
  ratio: number;
27
28
  startAngle: number;
@@ -59,7 +60,7 @@ declare const TextStyleSchema: z.ZodObject<{
59
60
  }>>;
60
61
  arrowSize: z.ZodDefault<z.ZodNumber>;
61
62
  }, z.core.$strip>;
62
- type TextStyle = z.infer<typeof TextStyleSchema>;
63
+ type TextStyle$1 = z.infer<typeof TextStyleSchema>;
63
64
  /** A named document dimension style; documents carry an ARRAY of these and
64
65
  * dimensions reference one by `styleId` (absent/dangling = the first). */
65
66
  declare const DimStyleSchema: z.ZodObject<{
@@ -87,7 +88,32 @@ declare const DimStyleSchema: z.ZodObject<{
87
88
  extensionOvershoot: z.ZodDefault<z.ZodNumber>;
88
89
  precision: z.ZodDefault<z.ZodNumber>;
89
90
  }, z.core.$strip>;
90
- type DimStyle = z.infer<typeof DimStyleSchema>;
91
+ type DimStyle$1 = z.infer<typeof DimStyleSchema>;
92
+ declare const BlockSchema: z.ZodObject<{
93
+ id: z.ZodString;
94
+ layerId: z.ZodString;
95
+ color: z.ZodOptional<z.ZodString>;
96
+ lineType: z.ZodOptional<z.ZodString>;
97
+ lineTypeScale: z.ZodOptional<z.ZodNumber>;
98
+ lineWidth: z.ZodOptional<z.ZodNumber>;
99
+ opacity: z.ZodOptional<z.ZodNumber>;
100
+ type: z.ZodLiteral<"block">;
101
+ definitionId: z.ZodString;
102
+ rotation: z.ZodDefault<z.ZodNumber>;
103
+ scale: z.ZodDefault<z.ZodNumber>;
104
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodNumber>, z.ZodArray<z.ZodString>, z.ZodJSONSchema]>>>;
105
+ inputs: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
106
+ x: z.ZodNumber;
107
+ y: z.ZodNumber;
108
+ }, z.core.$strip>, unknown>, z.ZodString]>>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
109
+ x: z.ZodNumber;
110
+ y: z.ZodNumber;
111
+ }, z.core.$strip>, unknown>, z.ZodString, z.ZodArray<z.ZodPreprocess<z.ZodObject<{
112
+ x: z.ZodNumber;
113
+ y: z.ZodNumber;
114
+ }, z.core.$strip>, unknown>>, z.ZodArray<z.ZodString>]>>]>>;
115
+ }, z.core.$strip>;
116
+ type Block = z.infer<typeof BlockSchema>;
91
117
  /**
92
118
  * A LINKED file drawn in place (an xref): the document holds this record,
93
119
  * never the file. The file's model space lands with its origin at
@@ -118,6 +144,9 @@ declare const ReferenceSchema: z.ZodObject<{
118
144
  }, z.core.$strip>, z.ZodObject<{
119
145
  kind: z.ZodLiteral<"url">;
120
146
  url: z.ZodString;
147
+ }, z.core.$strip>, z.ZodObject<{
148
+ kind: z.ZodLiteral<"asset">;
149
+ assetId: z.ZodString;
121
150
  }, z.core.$strip>], "kind">;
122
151
  position: z.ZodPreprocess<z.ZodObject<{
123
152
  x: z.ZodNumber;
@@ -147,7 +176,7 @@ declare const ReferenceSchema: z.ZodObject<{
147
176
  maxY: z.ZodNumber;
148
177
  }, z.core.$strip>>;
149
178
  }, z.core.$strip>;
150
- type ReferenceObject = z.infer<typeof ReferenceSchema>;
179
+ type Reference = z.infer<typeof ReferenceSchema>;
151
180
  declare const ModelObjectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
152
181
  id: z.ZodString;
153
182
  layerId: z.ZodString;
@@ -431,28 +460,17 @@ declare const ModelObjectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
431
460
  definitionId: z.ZodString;
432
461
  rotation: z.ZodDefault<z.ZodNumber>;
433
462
  scale: z.ZodDefault<z.ZodNumber>;
434
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodNumber>, z.ZodArray<z.ZodString>]>>>;
435
- inputs: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
463
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodNumber>, z.ZodArray<z.ZodString>, z.ZodJSONSchema]>>>;
464
+ inputs: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
436
465
  x: z.ZodNumber;
437
466
  y: z.ZodNumber;
438
- }, z.core.$strip>, unknown>, z.ZodString]>>>;
439
- }, z.core.$strip>, z.ZodObject<{
440
- id: z.ZodString;
441
- layerId: z.ZodString;
442
- color: z.ZodOptional<z.ZodString>;
443
- lineType: z.ZodOptional<z.ZodString>;
444
- lineTypeScale: z.ZodOptional<z.ZodNumber>;
445
- lineWidth: z.ZodOptional<z.ZodNumber>;
446
- opacity: z.ZodOptional<z.ZodNumber>;
447
- type: z.ZodLiteral<"image">;
448
- assetId: z.ZodString;
449
- origin: z.ZodPreprocess<z.ZodObject<{
467
+ }, z.core.$strip>, unknown>, z.ZodString]>>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
450
468
  x: z.ZodNumber;
451
469
  y: z.ZodNumber;
452
- }, z.core.$strip>, unknown>;
453
- width: z.ZodNumber;
454
- height: z.ZodNumber;
455
- rotation: z.ZodDefault<z.ZodNumber>;
470
+ }, z.core.$strip>, unknown>, z.ZodString, z.ZodArray<z.ZodPreprocess<z.ZodObject<{
471
+ x: z.ZodNumber;
472
+ y: z.ZodNumber;
473
+ }, z.core.$strip>, unknown>>, z.ZodArray<z.ZodString>]>>]>>;
456
474
  }, z.core.$strip>, z.ZodObject<{
457
475
  id: z.ZodString;
458
476
  layerId: z.ZodString;
@@ -606,6 +624,9 @@ declare const ModelObjectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
606
624
  }, z.core.$strip>, z.ZodObject<{
607
625
  kind: z.ZodLiteral<"url">;
608
626
  url: z.ZodString;
627
+ }, z.core.$strip>, z.ZodObject<{
628
+ kind: z.ZodLiteral<"asset">;
629
+ assetId: z.ZodString;
609
630
  }, z.core.$strip>], "kind">;
610
631
  position: z.ZodPreprocess<z.ZodObject<{
611
632
  x: z.ZodNumber;
@@ -676,7 +697,7 @@ type Layer = z.infer<typeof LayerSchema>;
676
697
  declare const LineaDocumentSchema: z.ZodPreprocess<z.ZodObject<{
677
698
  id: z.ZodDefault<z.ZodString>;
678
699
  type: z.ZodDefault<z.ZodLiteral<"lineadraw">>;
679
- version: z.ZodLiteral<22>;
700
+ version: z.ZodLiteral<24>;
680
701
  settings: z.ZodDefault<z.ZodObject<{
681
702
  units: z.ZodDefault<z.ZodEnum<{
682
703
  in: "in";
@@ -978,28 +999,17 @@ declare const LineaDocumentSchema: z.ZodPreprocess<z.ZodObject<{
978
999
  definitionId: z.ZodString;
979
1000
  rotation: z.ZodDefault<z.ZodNumber>;
980
1001
  scale: z.ZodDefault<z.ZodNumber>;
981
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodNumber>, z.ZodArray<z.ZodString>]>>>;
982
- inputs: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
1002
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodNumber>, z.ZodArray<z.ZodString>, z.ZodJSONSchema]>>>;
1003
+ inputs: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
983
1004
  x: z.ZodNumber;
984
1005
  y: z.ZodNumber;
985
- }, z.core.$strip>, unknown>, z.ZodString]>>>;
986
- }, z.core.$strip>, z.ZodObject<{
987
- id: z.ZodString;
988
- layerId: z.ZodString;
989
- color: z.ZodOptional<z.ZodString>;
990
- lineType: z.ZodOptional<z.ZodString>;
991
- lineTypeScale: z.ZodOptional<z.ZodNumber>;
992
- lineWidth: z.ZodOptional<z.ZodNumber>;
993
- opacity: z.ZodOptional<z.ZodNumber>;
994
- type: z.ZodLiteral<"image">;
995
- assetId: z.ZodString;
996
- origin: z.ZodPreprocess<z.ZodObject<{
1006
+ }, z.core.$strip>, unknown>, z.ZodString]>>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
997
1007
  x: z.ZodNumber;
998
1008
  y: z.ZodNumber;
999
- }, z.core.$strip>, unknown>;
1000
- width: z.ZodNumber;
1001
- height: z.ZodNumber;
1002
- rotation: z.ZodDefault<z.ZodNumber>;
1009
+ }, z.core.$strip>, unknown>, z.ZodString, z.ZodArray<z.ZodPreprocess<z.ZodObject<{
1010
+ x: z.ZodNumber;
1011
+ y: z.ZodNumber;
1012
+ }, z.core.$strip>, unknown>>, z.ZodArray<z.ZodString>]>>]>>;
1003
1013
  }, z.core.$strip>, z.ZodObject<{
1004
1014
  id: z.ZodString;
1005
1015
  layerId: z.ZodString;
@@ -1153,6 +1163,9 @@ declare const LineaDocumentSchema: z.ZodPreprocess<z.ZodObject<{
1153
1163
  }, z.core.$strip>, z.ZodObject<{
1154
1164
  kind: z.ZodLiteral<"url">;
1155
1165
  url: z.ZodString;
1166
+ }, z.core.$strip>, z.ZodObject<{
1167
+ kind: z.ZodLiteral<"asset">;
1168
+ assetId: z.ZodString;
1156
1169
  }, z.core.$strip>], "kind">;
1157
1170
  position: z.ZodPreprocess<z.ZodObject<{
1158
1171
  x: z.ZodNumber;
@@ -1477,28 +1490,17 @@ declare const LineaDocumentSchema: z.ZodPreprocess<z.ZodObject<{
1477
1490
  definitionId: z.ZodString;
1478
1491
  rotation: z.ZodDefault<z.ZodNumber>;
1479
1492
  scale: z.ZodDefault<z.ZodNumber>;
1480
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodNumber>, z.ZodArray<z.ZodString>]>>>;
1481
- inputs: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
1493
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodNumber>, z.ZodArray<z.ZodString>, z.ZodJSONSchema]>>>;
1494
+ inputs: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
1482
1495
  x: z.ZodNumber;
1483
1496
  y: z.ZodNumber;
1484
- }, z.core.$strip>, unknown>, z.ZodString]>>>;
1485
- }, z.core.$strip>, z.ZodObject<{
1486
- id: z.ZodString;
1487
- layerId: z.ZodString;
1488
- color: z.ZodOptional<z.ZodString>;
1489
- lineType: z.ZodOptional<z.ZodString>;
1490
- lineTypeScale: z.ZodOptional<z.ZodNumber>;
1491
- lineWidth: z.ZodOptional<z.ZodNumber>;
1492
- opacity: z.ZodOptional<z.ZodNumber>;
1493
- type: z.ZodLiteral<"image">;
1494
- assetId: z.ZodString;
1495
- origin: z.ZodPreprocess<z.ZodObject<{
1497
+ }, z.core.$strip>, unknown>, z.ZodString]>>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
1496
1498
  x: z.ZodNumber;
1497
1499
  y: z.ZodNumber;
1498
- }, z.core.$strip>, unknown>;
1499
- width: z.ZodNumber;
1500
- height: z.ZodNumber;
1501
- rotation: z.ZodDefault<z.ZodNumber>;
1500
+ }, z.core.$strip>, unknown>, z.ZodString, z.ZodArray<z.ZodPreprocess<z.ZodObject<{
1501
+ x: z.ZodNumber;
1502
+ y: z.ZodNumber;
1503
+ }, z.core.$strip>, unknown>>, z.ZodArray<z.ZodString>]>>]>>;
1502
1504
  }, z.core.$strip>, z.ZodObject<{
1503
1505
  id: z.ZodString;
1504
1506
  layerId: z.ZodString;
@@ -1652,6 +1654,9 @@ declare const LineaDocumentSchema: z.ZodPreprocess<z.ZodObject<{
1652
1654
  }, z.core.$strip>, z.ZodObject<{
1653
1655
  kind: z.ZodLiteral<"url">;
1654
1656
  url: z.ZodString;
1657
+ }, z.core.$strip>, z.ZodObject<{
1658
+ kind: z.ZodLiteral<"asset">;
1659
+ assetId: z.ZodString;
1655
1660
  }, z.core.$strip>], "kind">;
1656
1661
  position: z.ZodPreprocess<z.ZodObject<{
1657
1662
  x: z.ZodNumber;
@@ -1749,7 +1754,7 @@ declare const LineaDocumentSchema: z.ZodPreprocess<z.ZodObject<{
1749
1754
  }, z.core.$strip>, unknown>;
1750
1755
  type LineaDocument = z.infer<typeof LineaDocumentSchema>;
1751
1756
 
1752
- declare const BlockParamSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1757
+ declare const ParamDefSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1753
1758
  name: z.ZodString;
1754
1759
  label: z.ZodOptional<z.ZodString>;
1755
1760
  hint: z.ZodOptional<z.ZodString>;
@@ -1851,6 +1856,12 @@ declare const BlockParamSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1851
1856
  hint: z.ZodOptional<z.ZodString>;
1852
1857
  type: z.ZodLiteral<"hatchPattern">;
1853
1858
  default: z.ZodDefault<z.ZodString>;
1859
+ }, z.core.$strip>, z.ZodObject<{
1860
+ name: z.ZodString;
1861
+ label: z.ZodOptional<z.ZodString>;
1862
+ hint: z.ZodOptional<z.ZodString>;
1863
+ type: z.ZodLiteral<"data">;
1864
+ default: z.ZodJSONSchema;
1854
1865
  }, z.core.$strip>, z.ZodObject<{
1855
1866
  name: z.ZodString;
1856
1867
  label: z.ZodOptional<z.ZodString>;
@@ -1947,7 +1958,74 @@ declare const BlockParamSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1947
1958
  default: z.ZodDefault<z.ZodString>;
1948
1959
  }, z.core.$strip>], "type">>;
1949
1960
  }, z.core.$strip>], "type">;
1950
- type BlockParameter = z.infer<typeof BlockParamSchema>;
1961
+ type ParamDef = z.infer<typeof ParamDefSchema>;
1962
+ declare const InputDefSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1963
+ name: z.ZodString;
1964
+ label: z.ZodOptional<z.ZodString>;
1965
+ description: z.ZodOptional<z.ZodString>;
1966
+ type: z.ZodLiteral<"point">;
1967
+ optional: z.ZodOptional<z.ZodBoolean>;
1968
+ }, z.core.$strip>, z.ZodObject<{
1969
+ name: z.ZodString;
1970
+ label: z.ZodOptional<z.ZodString>;
1971
+ description: z.ZodOptional<z.ZodString>;
1972
+ type: z.ZodLiteral<"points">;
1973
+ min: z.ZodDefault<z.ZodNumber>;
1974
+ max: z.ZodOptional<z.ZodNumber>;
1975
+ closed: z.ZodDefault<z.ZodBoolean>;
1976
+ }, z.core.$strip>, z.ZodObject<{
1977
+ name: z.ZodString;
1978
+ label: z.ZodOptional<z.ZodString>;
1979
+ description: z.ZodOptional<z.ZodString>;
1980
+ type: z.ZodLiteral<"object">;
1981
+ types: z.ZodDefault<z.ZodArray<z.ZodEnum<{
1982
+ arc: "arc";
1983
+ block: "block";
1984
+ circle: "circle";
1985
+ comment: "comment";
1986
+ dimension: "dimension";
1987
+ ellipse: "ellipse";
1988
+ hatch: "hatch";
1989
+ line: "line";
1990
+ point: "point";
1991
+ polyline: "polyline";
1992
+ reference: "reference";
1993
+ table: "table";
1994
+ text: "text";
1995
+ viewport: "viewport";
1996
+ }>>>;
1997
+ optional: z.ZodOptional<z.ZodBoolean>;
1998
+ }, z.core.$strip>, z.ZodObject<{
1999
+ name: z.ZodString;
2000
+ label: z.ZodOptional<z.ZodString>;
2001
+ description: z.ZodOptional<z.ZodString>;
2002
+ type: z.ZodLiteral<"objects">;
2003
+ types: z.ZodDefault<z.ZodArray<z.ZodEnum<{
2004
+ arc: "arc";
2005
+ block: "block";
2006
+ circle: "circle";
2007
+ comment: "comment";
2008
+ dimension: "dimension";
2009
+ ellipse: "ellipse";
2010
+ hatch: "hatch";
2011
+ line: "line";
2012
+ point: "point";
2013
+ polyline: "polyline";
2014
+ reference: "reference";
2015
+ table: "table";
2016
+ text: "text";
2017
+ viewport: "viewport";
2018
+ }>>>;
2019
+ min: z.ZodDefault<z.ZodNumber>;
2020
+ max: z.ZodOptional<z.ZodNumber>;
2021
+ }, z.core.$strip>, z.ZodObject<{
2022
+ name: z.ZodString;
2023
+ label: z.ZodOptional<z.ZodString>;
2024
+ description: z.ZodOptional<z.ZodString>;
2025
+ type: z.ZodLiteral<"host">;
2026
+ types: z.ZodDefault<z.ZodArray<z.ZodString>>;
2027
+ }, z.core.$strip>], "type">;
2028
+ type InputDef = z.infer<typeof InputDefSchema>;
1951
2029
 
1952
2030
  /** ISO A-series portrait sizes in mm [width, height]. */
1953
2031
  declare const SHEET_PRESETS: {
@@ -2281,28 +2359,17 @@ declare const PaperLayoutSchema: z.ZodObject<{
2281
2359
  definitionId: z.ZodString;
2282
2360
  rotation: z.ZodDefault<z.ZodNumber>;
2283
2361
  scale: z.ZodDefault<z.ZodNumber>;
2284
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodNumber>, z.ZodArray<z.ZodString>]>>>;
2285
- inputs: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
2362
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodNumber>, z.ZodArray<z.ZodString>, z.ZodJSONSchema]>>>;
2363
+ inputs: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
2286
2364
  x: z.ZodNumber;
2287
2365
  y: z.ZodNumber;
2288
- }, z.core.$strip>, unknown>, z.ZodString]>>>;
2289
- }, z.core.$strip>, z.ZodObject<{
2290
- id: z.ZodString;
2291
- layerId: z.ZodString;
2292
- color: z.ZodOptional<z.ZodString>;
2293
- lineType: z.ZodOptional<z.ZodString>;
2294
- lineTypeScale: z.ZodOptional<z.ZodNumber>;
2295
- lineWidth: z.ZodOptional<z.ZodNumber>;
2296
- opacity: z.ZodOptional<z.ZodNumber>;
2297
- type: z.ZodLiteral<"image">;
2298
- assetId: z.ZodString;
2299
- origin: z.ZodPreprocess<z.ZodObject<{
2366
+ }, z.core.$strip>, unknown>, z.ZodString]>>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
2300
2367
  x: z.ZodNumber;
2301
2368
  y: z.ZodNumber;
2302
- }, z.core.$strip>, unknown>;
2303
- width: z.ZodNumber;
2304
- height: z.ZodNumber;
2305
- rotation: z.ZodDefault<z.ZodNumber>;
2369
+ }, z.core.$strip>, unknown>, z.ZodString, z.ZodArray<z.ZodPreprocess<z.ZodObject<{
2370
+ x: z.ZodNumber;
2371
+ y: z.ZodNumber;
2372
+ }, z.core.$strip>, unknown>>, z.ZodArray<z.ZodString>]>>]>>;
2306
2373
  }, z.core.$strip>, z.ZodObject<{
2307
2374
  id: z.ZodString;
2308
2375
  layerId: z.ZodString;
@@ -2456,6 +2523,9 @@ declare const PaperLayoutSchema: z.ZodObject<{
2456
2523
  }, z.core.$strip>, z.ZodObject<{
2457
2524
  kind: z.ZodLiteral<"url">;
2458
2525
  url: z.ZodString;
2526
+ }, z.core.$strip>, z.ZodObject<{
2527
+ kind: z.ZodLiteral<"asset">;
2528
+ assetId: z.ZodString;
2459
2529
  }, z.core.$strip>], "kind">;
2460
2530
  position: z.ZodPreprocess<z.ZodObject<{
2461
2531
  x: z.ZodNumber;
@@ -2500,13 +2570,22 @@ type ModuleExecutor = (script: string) => Record<string, unknown>;
2500
2570
  * Shared by block AND command modules. */
2501
2571
  declare const ensureScriptTranspiler: () => Promise<ModuleExecutor>;
2502
2572
 
2573
+ /**
2574
+ * Looks up a referenced object by id — supplied by whoever owns the
2575
+ * document (ids are document-unique, so a document-wide lookup is correct).
2576
+ */
2577
+ type BlockObjectResolver = ((id: string) => ModelObject | undefined) & {
2578
+ /** Every block instance in the document (all spaces) — how a host finds
2579
+ * what lives on it (hostedOf). Absent → hosts see no `hosted`. */
2580
+ blocks?: () => readonly Block[];
2581
+ };
2503
2582
  /** Identity + metadata derived from a block module's exports. The optional
2504
2583
  * fields are marketplace/listing metadata (docs/block-marketplace.md) —
2505
2584
  * absent ones change nothing about evaluation. */
2506
2585
  interface BlockMeta {
2507
2586
  id: string;
2508
2587
  name: string;
2509
- params: BlockParameter[];
2588
+ params: ParamDef[];
2510
2589
  description?: string;
2511
2590
  version?: string;
2512
2591
  authors?: string[];
@@ -2515,6 +2594,10 @@ interface BlockMeta {
2515
2594
  * Declared (a param-dependent path may emit only sometimes), but the
2516
2595
  * save-time dry run REJECTS emitted instances that are not declared. */
2517
2596
  dependencies?: string[];
2597
+ /** The declared input table (`inputs` member) — instances of a module
2598
+ * with one store their inputs as a record by name. Absent for the
2599
+ * positional forms (`place` labels / function, or no `place`). */
2600
+ inputs?: InputDef[];
2518
2601
  }
2519
2602
  /** Non-throwing meta lookup for list UIs. */
2520
2603
  type BlockMetaResult = {
@@ -2729,14 +2812,23 @@ interface CommandMeta {
2729
2812
  version?: string;
2730
2813
  authors?: string[];
2731
2814
  tags?: string[];
2732
- /** Declared point inputs (labels): picked one by one in the editor before
2733
- * `run`, or supplied up front by a headless/remote caller. */
2734
- inputs?: string[];
2815
+ /** Declared inputs, as declared: point LABELS (positional — `ctx.inputs`
2816
+ * is an array) or an input TABLE (named — `ctx.inputs` is a record;
2817
+ * object inputs take the selection first). Acquired before `run`: picked
2818
+ * in the editor, or supplied up front by a headless/remote caller. */
2819
+ inputs?: string[] | CommandInputDef[];
2820
+ /** Asks during the run (editor.pickPoint / prompt / ask), so it can't
2821
+ * run headless: headless runners refuse it up front. */
2822
+ requiresEditor?: boolean;
2735
2823
  /** Declared parameters (the blocks' ParamDef table): prompted in the
2736
2824
  * editor before `run`, or passed by a headless caller; arrive as
2737
2825
  * `ctx.params`. Absent when the command declares none. */
2738
- params?: BlockParameter[];
2826
+ params?: ParamDef[];
2739
2827
  }
2828
+ /** A command input: any input kind but `host` (block-only). */
2829
+ type CommandInputDef = Exclude<InputDef, {
2830
+ type: "host";
2831
+ }>;
2740
2832
  /** Non-throwing meta lookup for list UIs. */
2741
2833
  type CommandMetaResult = {
2742
2834
  ok: true;
@@ -2759,7 +2851,7 @@ interface TextMeasurer {
2759
2851
 
2760
2852
  type SnapPointType = "endpoint" | "midpoint" | "center" | "quadrant";
2761
2853
  interface SnapPoint {
2762
- p: Vec2;
2854
+ p: Vec2$1;
2763
2855
  type: SnapPointType;
2764
2856
  }
2765
2857
  /** A cached segment; tessellation chords of curves are marked as such. */
@@ -2794,13 +2886,13 @@ interface SnapCacheEntry {
2794
2886
  */
2795
2887
  ellipses?: EllipseGeom[];
2796
2888
  /** Closed tessellated rings (hatch interiors, for inside hit-testing). */
2797
- rings?: Vec2[][];
2889
+ rings?: Vec2$1[][];
2798
2890
  /**
2799
2891
  * Filled regions of NESTED content — a block's hatch children — each its
2800
2892
  * own even-odd ring set (so two overlapping fills don't cancel). An
2801
2893
  * inside hit on one ranks like a hatch hit: below geometry drawn over it.
2802
2894
  */
2803
- regions?: Vec2[][][];
2895
+ regions?: Vec2$1[][][];
2804
2896
  /**
2805
2897
  * Huge entries (a referenced site plan: 10⁵+ segments) answer "what is in
2806
2898
  * this box" from a spatial index, so snapping and picking near the cursor
@@ -2822,9 +2914,9 @@ interface DocumentPaintResources {
2822
2914
  * it (its color still follows the instance unless it sets one). */
2823
2915
  layers: readonly Layer[];
2824
2916
  /** Document dimension styles — dimensions pick theirs by styleId. */
2825
- dimStyles: readonly DimStyle[];
2917
+ dimStyles: readonly DimStyle$1[];
2826
2918
  /** Document text styles — texts pick theirs by styleId. */
2827
- textStyles: readonly TextStyle[];
2919
+ textStyles: readonly TextStyle$1[];
2828
2920
  /** Document-defined line types / hatch patterns, resolved by NAME ahead
2829
2921
  * of the built-in catalogue (block children and hatch fills). */
2830
2922
  lineTypes: readonly LineType[];
@@ -2842,9 +2934,8 @@ interface DocumentPaintResources {
2842
2934
  */
2843
2935
  resolveObject?: (id: string) => ModelObject | undefined;
2844
2936
  /**
2845
- * The document's embedded assets (hash → data URL) — the image painter
2846
- * resolves `assetId` against these. Optional: consumers that can't show
2847
- * images (or documents without any) paint a crossed placeholder frame.
2937
+ * The document's embedded assets (hash → data URL) — the bytes behind
2938
+ * `asset`-source references, which a host's `resolveReference` reads.
2848
2939
  */
2849
2940
  assets?: Readonly<Record<string, string>>;
2850
2941
  /**
@@ -2852,7 +2943,7 @@ interface DocumentPaintResources {
2852
2943
  * loading and caching. Absent, or null for a file not loaded (yet), → the
2853
2944
  * reference paints as a dashed frame.
2854
2945
  */
2855
- resolveReference?: (ref: ReferenceObject) => ReferenceContent | null;
2946
+ resolveReference?: (ref: Reference) => ReferenceContent | null;
2856
2947
  }
2857
2948
 
2858
2949
  /**
@@ -2871,6 +2962,8 @@ interface ReferenceContent extends LayoutModelContext {
2871
2962
  bounds: AABB;
2872
2963
  /** PDF: how many pages the file has (the page field's range). */
2873
2964
  pageCount?: number;
2965
+ /** A bitmap drawn under `objects` (PNG/JPEG, raster PDF page). */
2966
+ raster?: ReferenceRaster;
2874
2967
  /**
2875
2968
  * Snap geometry precomputed in FILE coordinates (off the main thread —
2876
2969
  * see `referenceSnapOf`); absent → derived from `objects`. A raster PDF
@@ -2883,13 +2976,13 @@ interface ReferenceContent extends LayoutModelContext {
2883
2976
  * reference's hidden layers still filter them). */
2884
2977
  interface ReferenceSnap {
2885
2978
  points: {
2886
- p: Vec2;
2979
+ p: Vec2$1;
2887
2980
  type: SnapPointType;
2888
2981
  layer: string;
2889
2982
  }[];
2890
2983
  segments: {
2891
- a: Vec2;
2892
- b: Vec2;
2984
+ a: Vec2$1;
2985
+ b: Vec2$1;
2893
2986
  chord?: boolean;
2894
2987
  layer: string;
2895
2988
  }[];
@@ -2900,6 +2993,14 @@ interface ReferenceSnap {
2900
2993
  layer: string;
2901
2994
  })[];
2902
2995
  }
2996
+ /** Raster content: one bitmap, bottom-left at the file origin, `width` ×
2997
+ * `height` mm — a PNG/JPEG reference or a raster PDF page. */
2998
+ interface ReferenceRaster {
2999
+ /** The bitmap as a data URL (what the sink's `image()` op draws). */
3000
+ data: string;
3001
+ width: number;
3002
+ height: number;
3003
+ }
2903
3004
 
2904
3005
  /**
2905
3006
  * Where a reorder places the moved objects: the top/bottom of the space's
@@ -3199,28 +3300,17 @@ declare const OperationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3199
3300
  definitionId: z.ZodString;
3200
3301
  rotation: z.ZodDefault<z.ZodNumber>;
3201
3302
  scale: z.ZodDefault<z.ZodNumber>;
3202
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodNumber>, z.ZodArray<z.ZodString>]>>>;
3203
- inputs: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
3303
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodNumber>, z.ZodArray<z.ZodString>, z.ZodJSONSchema]>>>;
3304
+ inputs: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
3204
3305
  x: z.ZodNumber;
3205
3306
  y: z.ZodNumber;
3206
- }, z.core.$strip>, unknown>, z.ZodString]>>>;
3207
- }, z.core.$strip>, z.ZodObject<{
3208
- id: z.ZodString;
3209
- layerId: z.ZodString;
3210
- color: z.ZodOptional<z.ZodString>;
3211
- lineType: z.ZodOptional<z.ZodString>;
3212
- lineTypeScale: z.ZodOptional<z.ZodNumber>;
3213
- lineWidth: z.ZodOptional<z.ZodNumber>;
3214
- opacity: z.ZodOptional<z.ZodNumber>;
3215
- type: z.ZodLiteral<"image">;
3216
- assetId: z.ZodString;
3217
- origin: z.ZodPreprocess<z.ZodObject<{
3307
+ }, z.core.$strip>, unknown>, z.ZodString]>>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
3218
3308
  x: z.ZodNumber;
3219
3309
  y: z.ZodNumber;
3220
- }, z.core.$strip>, unknown>;
3221
- width: z.ZodNumber;
3222
- height: z.ZodNumber;
3223
- rotation: z.ZodDefault<z.ZodNumber>;
3310
+ }, z.core.$strip>, unknown>, z.ZodString, z.ZodArray<z.ZodPreprocess<z.ZodObject<{
3311
+ x: z.ZodNumber;
3312
+ y: z.ZodNumber;
3313
+ }, z.core.$strip>, unknown>>, z.ZodArray<z.ZodString>]>>]>>;
3224
3314
  }, z.core.$strip>, z.ZodObject<{
3225
3315
  id: z.ZodString;
3226
3316
  layerId: z.ZodString;
@@ -3374,6 +3464,9 @@ declare const OperationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3374
3464
  }, z.core.$strip>, z.ZodObject<{
3375
3465
  kind: z.ZodLiteral<"url">;
3376
3466
  url: z.ZodString;
3467
+ }, z.core.$strip>, z.ZodObject<{
3468
+ kind: z.ZodLiteral<"asset">;
3469
+ assetId: z.ZodString;
3377
3470
  }, z.core.$strip>], "kind">;
3378
3471
  position: z.ZodPreprocess<z.ZodObject<{
3379
3472
  x: z.ZodNumber;
@@ -3692,28 +3785,17 @@ declare const OperationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3692
3785
  definitionId: z.ZodString;
3693
3786
  rotation: z.ZodDefault<z.ZodNumber>;
3694
3787
  scale: z.ZodDefault<z.ZodNumber>;
3695
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodNumber>, z.ZodArray<z.ZodString>]>>>;
3696
- inputs: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
3788
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodNumber>, z.ZodArray<z.ZodString>, z.ZodJSONSchema]>>>;
3789
+ inputs: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
3697
3790
  x: z.ZodNumber;
3698
3791
  y: z.ZodNumber;
3699
- }, z.core.$strip>, unknown>, z.ZodString]>>>;
3700
- }, z.core.$strip>, z.ZodObject<{
3701
- id: z.ZodString;
3702
- layerId: z.ZodString;
3703
- color: z.ZodOptional<z.ZodString>;
3704
- lineType: z.ZodOptional<z.ZodString>;
3705
- lineTypeScale: z.ZodOptional<z.ZodNumber>;
3706
- lineWidth: z.ZodOptional<z.ZodNumber>;
3707
- opacity: z.ZodOptional<z.ZodNumber>;
3708
- type: z.ZodLiteral<"image">;
3709
- assetId: z.ZodString;
3710
- origin: z.ZodPreprocess<z.ZodObject<{
3792
+ }, z.core.$strip>, unknown>, z.ZodString]>>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
3711
3793
  x: z.ZodNumber;
3712
3794
  y: z.ZodNumber;
3713
- }, z.core.$strip>, unknown>;
3714
- width: z.ZodNumber;
3715
- height: z.ZodNumber;
3716
- rotation: z.ZodDefault<z.ZodNumber>;
3795
+ }, z.core.$strip>, unknown>, z.ZodString, z.ZodArray<z.ZodPreprocess<z.ZodObject<{
3796
+ x: z.ZodNumber;
3797
+ y: z.ZodNumber;
3798
+ }, z.core.$strip>, unknown>>, z.ZodArray<z.ZodString>]>>]>>;
3717
3799
  }, z.core.$strip>, z.ZodObject<{
3718
3800
  id: z.ZodString;
3719
3801
  layerId: z.ZodString;
@@ -3867,6 +3949,9 @@ declare const OperationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3867
3949
  }, z.core.$strip>, z.ZodObject<{
3868
3950
  kind: z.ZodLiteral<"url">;
3869
3951
  url: z.ZodString;
3952
+ }, z.core.$strip>, z.ZodObject<{
3953
+ kind: z.ZodLiteral<"asset">;
3954
+ assetId: z.ZodString;
3870
3955
  }, z.core.$strip>], "kind">;
3871
3956
  position: z.ZodPreprocess<z.ZodObject<{
3872
3957
  x: z.ZodNumber;
@@ -4267,28 +4352,17 @@ declare const OperationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
4267
4352
  definitionId: z.ZodString;
4268
4353
  rotation: z.ZodDefault<z.ZodNumber>;
4269
4354
  scale: z.ZodDefault<z.ZodNumber>;
4270
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodNumber>, z.ZodArray<z.ZodString>]>>>;
4271
- inputs: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
4355
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodNumber>, z.ZodArray<z.ZodString>, z.ZodJSONSchema]>>>;
4356
+ inputs: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
4272
4357
  x: z.ZodNumber;
4273
4358
  y: z.ZodNumber;
4274
- }, z.core.$strip>, unknown>, z.ZodString]>>>;
4275
- }, z.core.$strip>, z.ZodObject<{
4276
- id: z.ZodString;
4277
- layerId: z.ZodString;
4278
- color: z.ZodOptional<z.ZodString>;
4279
- lineType: z.ZodOptional<z.ZodString>;
4280
- lineTypeScale: z.ZodOptional<z.ZodNumber>;
4281
- lineWidth: z.ZodOptional<z.ZodNumber>;
4282
- opacity: z.ZodOptional<z.ZodNumber>;
4283
- type: z.ZodLiteral<"image">;
4284
- assetId: z.ZodString;
4285
- origin: z.ZodPreprocess<z.ZodObject<{
4359
+ }, z.core.$strip>, unknown>, z.ZodString]>>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
4286
4360
  x: z.ZodNumber;
4287
4361
  y: z.ZodNumber;
4288
- }, z.core.$strip>, unknown>;
4289
- width: z.ZodNumber;
4290
- height: z.ZodNumber;
4291
- rotation: z.ZodDefault<z.ZodNumber>;
4362
+ }, z.core.$strip>, unknown>, z.ZodString, z.ZodArray<z.ZodPreprocess<z.ZodObject<{
4363
+ x: z.ZodNumber;
4364
+ y: z.ZodNumber;
4365
+ }, z.core.$strip>, unknown>>, z.ZodArray<z.ZodString>]>>]>>;
4292
4366
  }, z.core.$strip>, z.ZodObject<{
4293
4367
  id: z.ZodString;
4294
4368
  layerId: z.ZodString;
@@ -4442,6 +4516,9 @@ declare const OperationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
4442
4516
  }, z.core.$strip>, z.ZodObject<{
4443
4517
  kind: z.ZodLiteral<"url">;
4444
4518
  url: z.ZodString;
4519
+ }, z.core.$strip>, z.ZodObject<{
4520
+ kind: z.ZodLiteral<"asset">;
4521
+ assetId: z.ZodString;
4445
4522
  }, z.core.$strip>], "kind">;
4446
4523
  position: z.ZodPreprocess<z.ZodObject<{
4447
4524
  x: z.ZodNumber;
@@ -4789,28 +4866,17 @@ declare const OperationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
4789
4866
  definitionId: z.ZodString;
4790
4867
  rotation: z.ZodDefault<z.ZodNumber>;
4791
4868
  scale: z.ZodDefault<z.ZodNumber>;
4792
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodNumber>, z.ZodArray<z.ZodString>]>>>;
4793
- inputs: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
4869
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodNumber>, z.ZodArray<z.ZodString>, z.ZodJSONSchema]>>>;
4870
+ inputs: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
4794
4871
  x: z.ZodNumber;
4795
4872
  y: z.ZodNumber;
4796
- }, z.core.$strip>, unknown>, z.ZodString]>>>;
4797
- }, z.core.$strip>, z.ZodObject<{
4798
- id: z.ZodString;
4799
- layerId: z.ZodString;
4800
- color: z.ZodOptional<z.ZodString>;
4801
- lineType: z.ZodOptional<z.ZodString>;
4802
- lineTypeScale: z.ZodOptional<z.ZodNumber>;
4803
- lineWidth: z.ZodOptional<z.ZodNumber>;
4804
- opacity: z.ZodOptional<z.ZodNumber>;
4805
- type: z.ZodLiteral<"image">;
4806
- assetId: z.ZodString;
4807
- origin: z.ZodPreprocess<z.ZodObject<{
4873
+ }, z.core.$strip>, unknown>, z.ZodString]>>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodPreprocess<z.ZodObject<{
4808
4874
  x: z.ZodNumber;
4809
4875
  y: z.ZodNumber;
4810
- }, z.core.$strip>, unknown>;
4811
- width: z.ZodNumber;
4812
- height: z.ZodNumber;
4813
- rotation: z.ZodDefault<z.ZodNumber>;
4876
+ }, z.core.$strip>, unknown>, z.ZodString, z.ZodArray<z.ZodPreprocess<z.ZodObject<{
4877
+ x: z.ZodNumber;
4878
+ y: z.ZodNumber;
4879
+ }, z.core.$strip>, unknown>>, z.ZodArray<z.ZodString>]>>]>>;
4814
4880
  }, z.core.$strip>, z.ZodObject<{
4815
4881
  id: z.ZodString;
4816
4882
  layerId: z.ZodString;
@@ -4964,6 +5030,9 @@ declare const OperationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
4964
5030
  }, z.core.$strip>, z.ZodObject<{
4965
5031
  kind: z.ZodLiteral<"url">;
4966
5032
  url: z.ZodString;
5033
+ }, z.core.$strip>, z.ZodObject<{
5034
+ kind: z.ZodLiteral<"asset">;
5035
+ assetId: z.ZodString;
4967
5036
  }, z.core.$strip>], "kind">;
4968
5037
  position: z.ZodPreprocess<z.ZodObject<{
4969
5038
  x: z.ZodNumber;
@@ -5278,9 +5347,10 @@ interface PdfImportReport {
5278
5347
  objectIds: string[];
5279
5348
  }
5280
5349
  interface PdfImportOptions {
5281
- /** "vectors" (default): lines and text runs. "image": every page
5282
- * rasterized and placed as an image at true page scale — a host
5283
- * capability (`rasterizePdf`), refused where it is missing. */
5350
+ /** "vectors" (default): lines and text runs. "image": the PDF embedded
5351
+ * and every page placed as a raster reference at true page scale — a host
5352
+ * capability (`rasterizePdf`, for the page sizes), refused where it is
5353
+ * missing. */
5284
5354
  as?: "vectors" | "image";
5285
5355
  /** Bottom-left corner of the first page (image mode; default 0,0). Pages
5286
5356
  * line up to the right. */
@@ -5299,7 +5369,7 @@ interface AssetInfo {
5299
5369
  mimeType: string;
5300
5370
  /** Decoded size in bytes. */
5301
5371
  bytes: number;
5302
- /** Image objects (every space) that show it. */
5372
+ /** References (every space) that embed it. */
5303
5373
  users: number;
5304
5374
  }
5305
5375
  /**
@@ -5325,10 +5395,11 @@ interface DrawingHooks {
5325
5395
  revision(): number;
5326
5396
  /** Text metrics for bounds and DXF (default: approximate font metrics). */
5327
5397
  measure?: TextMeasurer;
5328
- /** Document-wide object lookup for block reference inputs. */
5329
- resolveObject?: (id: string) => ModelObject | undefined;
5398
+ /** Document-wide object lookup for block reference inputs (and the
5399
+ * document's block list, for hosted blocks). */
5400
+ resolveObject?: BlockObjectResolver;
5330
5401
  /** Loaded reference content (default: the drawing's referenceContent). */
5331
- resolveReference?: (ref: ReferenceObject) => ReferenceContent | null;
5402
+ resolveReference?: (ref: Reference) => ReferenceContent | null;
5332
5403
  /** Snap/hit-test geometry, e.g. from a cache (default: built per call). */
5333
5404
  snapEntry?: (obj: ModelObject) => SnapCacheEntry;
5334
5405
  /** Where the host keeps its marketplace list and how it reaches them
@@ -5413,11 +5484,12 @@ declare class LocalDrawing implements Drawing$1 {
5413
5484
  setCurrentLayer(nameOrId: string): void;
5414
5485
  updateSettings(patch: Partial<LineaDocument["settings"]>): void;
5415
5486
  /**
5416
- * Embed image pixels (a data URL) and return the assetId that `image`
5417
- * objects reference. Content-keyed: the same data reuses one entry.
5487
+ * Embed a file (a data URL — PNG, JPEG, PDF…) and return the assetId an
5488
+ * embedded reference's `source: { kind: "asset", assetId }` names.
5489
+ * Content-keyed: the same data reuses one entry.
5418
5490
  */
5419
5491
  addAsset(dataUrl: string): string;
5420
- /** Remove an asset (the kernel refuses while an image references it). */
5492
+ /** Remove an asset (the kernel refuses while a reference embeds it). */
5421
5493
  removeAsset(id: string): void;
5422
5494
  listAssets(): AssetInfo[];
5423
5495
  /** Merge DXF text into the document (new layers, objects, layouts). */
@@ -5425,7 +5497,8 @@ declare class LocalDrawing implements Drawing$1 {
5425
5497
  /** Merge DWG bytes into the document (wasm transcode → the DXF path). */
5426
5498
  importDwgData(data: Uint8Array, opts?: DxfImportOptions): Promise<DxfImportReport>;
5427
5499
  /** Merge a PDF: its vector/text content onto the current layer, or
5428
- * (`as: "image"`) every page as an image at true page scale. */
5500
+ * (`as: "image"`) embedded, every page a raster reference at true page
5501
+ * scale. */
5429
5502
  importPdfData(data: ArrayBuffer | Uint8Array, opts?: PdfImportOptions): Promise<PdfImportReport>;
5430
5503
  /** Host capability: every PDF page rasterized. Absent → PDF-as-image
5431
5504
  * import is refused (headless Node, until it has a rasterizer). */
@@ -5443,14 +5516,14 @@ declare class LocalDrawing implements Drawing$1 {
5443
5516
  * unknown value is refused rather than stored dangling — a dangling
5444
5517
  * reference renders with the first style and nothing says why. */
5445
5518
  private styleRef;
5446
- listTextStyles(): TextStyle[];
5447
- listDimStyles(): DimStyle[];
5519
+ listTextStyles(): TextStyle$1[];
5520
+ listDimStyles(): DimStyle$1[];
5448
5521
  /** Create a text style (unique name; unset fields take the defaults);
5449
5522
  * returns its id. */
5450
5523
  addTextStyle(props: {
5451
5524
  name: string;
5452
- } & Partial<Omit<TextStyle, "id">>): string;
5453
- updateTextStyle(nameOrId: string, patch: Partial<Omit<TextStyle, "id">>): void;
5525
+ } & Partial<Omit<TextStyle$1, "id">>): string;
5526
+ updateTextStyle(nameOrId: string, patch: Partial<Omit<TextStyle$1, "id">>): void;
5454
5527
  listLineTypes(): LineType[];
5455
5528
  addLineTypes(lineTypes: readonly LineType[]): void;
5456
5529
  updateLineType(name: string, patch: Partial<LineType>): void;
@@ -5465,21 +5538,17 @@ declare class LocalDrawing implements Drawing$1 {
5465
5538
  * defaults); returns its id. */
5466
5539
  addDimStyle(props: {
5467
5540
  name: string;
5468
- } & Partial<Omit<DimStyle, "id">>): string;
5469
- updateDimStyle(nameOrId: string, patch: Partial<Omit<DimStyle, "id">>): void;
5541
+ } & Partial<Omit<DimStyle$1, "id">>): string;
5542
+ updateDimStyle(nameOrId: string, patch: Partial<Omit<DimStyle$1, "id">>): void;
5470
5543
  /** Remove a dimension style no dimension uses (the kernel refuses
5471
5544
  * otherwise). */
5472
5545
  removeDimStyle(nameOrId: string): void;
5473
- /** @deprecated Use updateDimStyle (default here: the first style). */
5474
- setDimStyle(patch: Partial<DimStyle>, styleId?: string): void;
5475
5546
  /** Replace the document's dimension styles (min 1; objects reference by
5476
5547
  * id). Diffed into granular per-style ops. */
5477
- setDimStyles(styles: DimStyle[]): void;
5478
- /** @deprecated Use updateTextStyle (default here: the first style). */
5479
- setTextStyle(patch: Partial<TextStyle>, styleId?: string): void;
5548
+ setDimStyles(styles: DimStyle$1[]): void;
5480
5549
  /** Replace the document's text styles (min 1; objects reference by id).
5481
5550
  * Diffed into granular per-style ops. */
5482
- setTextStyles(styles: TextStyle[]): void;
5551
+ setTextStyles(styles: TextStyle$1[]): void;
5483
5552
  private assertModuleSources;
5484
5553
  /**
5485
5554
  * Replace the block library (raw module sources — each exports its own
@@ -5538,7 +5607,7 @@ declare class LocalDrawing implements Drawing$1 {
5538
5607
  * Add objects (points may be `[x, y]`; `layer` resolves by name) to model
5539
5608
  * space, or to a paper layout's sheet via `{ layout }`. Returns ids.
5540
5609
  */
5541
- add(objects: readonly ObjectInput[], opts?: AddOptions): string[];
5610
+ add(objects: readonly ModelObjectInput[], opts?: AddOptions): string[];
5542
5611
  private patched;
5543
5612
  /** Apply one patch to several ids. */
5544
5613
  update(ids: readonly string[], patch: Record<string, unknown>): void;
@@ -5591,12 +5660,12 @@ declare class LocalDrawing implements Drawing$1 {
5591
5660
  private distanceTo;
5592
5661
  /** Query model-space objects — or one paper layout's sheet objects
5593
5662
  * (viewports, annotations) via `filter.layout`. */
5594
- listObjects(filter?: QueryFilter): ModelObject[];
5663
+ listObjects(filter?: ObjectQuery): ModelObject[];
5595
5664
  summary(): DocumentSummary;
5596
5665
  protected paintContext(): {
5597
5666
  layers: readonly Layer[];
5598
- dimStyles: readonly DimStyle[];
5599
- textStyles: readonly TextStyle[];
5667
+ dimStyles: readonly DimStyle$1[];
5668
+ textStyles: readonly TextStyle$1[];
5600
5669
  lineTypes: readonly LineType[];
5601
5670
  hatchPatterns: readonly DocumentHatchPattern[];
5602
5671
  blockDefinitions: readonly string[];
@@ -5840,28 +5909,17 @@ declare class LocalDrawing implements Drawing$1 {
5840
5909
  definitionId: string;
5841
5910
  rotation: number;
5842
5911
  scale: number;
5843
- params: Record<string, string | number | boolean | string[] | number[]>;
5912
+ params: Record<string, string[] | number[] | z.JSONType>;
5844
5913
  inputs: (string | {
5845
5914
  x: number;
5846
5915
  y: number;
5847
- })[];
5848
- } | {
5849
- id: string;
5850
- layerId: string;
5851
- color?: string | undefined;
5852
- lineType?: string | undefined;
5853
- lineTypeScale?: number | undefined;
5854
- lineWidth?: number | undefined;
5855
- opacity?: number | undefined;
5856
- type: "image";
5857
- assetId: string;
5858
- origin: {
5916
+ })[] | Record<string, string | string[] | {
5859
5917
  x: number;
5860
5918
  y: number;
5861
- };
5862
- width: number;
5863
- height: number;
5864
- rotation: number;
5919
+ }[] | {
5920
+ x: number;
5921
+ y: number;
5922
+ }>;
5865
5923
  } | {
5866
5924
  id: string;
5867
5925
  layerId: string;
@@ -5980,6 +6038,9 @@ declare class LocalDrawing implements Drawing$1 {
5980
6038
  } | {
5981
6039
  kind: "url";
5982
6040
  url: string;
6041
+ } | {
6042
+ kind: "asset";
6043
+ assetId: string;
5983
6044
  };
5984
6045
  position: {
5985
6046
  x: number;
@@ -6006,8 +6067,8 @@ declare class LocalDrawing implements Drawing$1 {
6006
6067
  maxY: number;
6007
6068
  } | undefined;
6008
6069
  })[];
6009
- resolveObject: (id: string) => ModelObject | undefined;
6010
- resolveReference: (ref: ReferenceObject) => ReferenceContent | null;
6070
+ resolveObject: BlockObjectResolver;
6071
+ resolveReference: (ref: Reference) => ReferenceContent | null;
6011
6072
  };
6012
6073
  protected resolveLayout(nameOrId: string): PaperLayout;
6013
6074
  /** Render model space (or a paper layout via `layout`) to an SVG string. */
@@ -6016,23 +6077,381 @@ declare class LocalDrawing implements Drawing$1 {
6016
6077
  toDxf(): Promise<string>;
6017
6078
  /** Export the document to DWG bytes (the DXF content, wasm-transcoded).
6018
6079
  * Defaults to AC1027 (AutoCAD 2013) — readable by every current CAD tool.
6019
- * Dimensions transcode as real DIMENSION objects; leaders are exploded to
6020
- * plain geometry (acadrust's MULTILEADER DWG output is unproven in real
6021
- * CADs — exploded geometry always displays). */
6080
+ * Dimensions transcode as real DIMENSION objects; leaders and tables are
6081
+ * exploded to plain geometry (DWG_DXF_OPTIONS — the transcoder's DWG
6082
+ * output for them is not accepted by AutoCAD). */
6022
6083
  toDwg(opts?: {
6023
6084
  version?: DwgVersion;
6024
6085
  }): Promise<Uint8Array>;
6025
6086
  toLinea(): string;
6026
6087
  }
6027
6088
 
6089
+ /** A 2D point (mm, y-up). Point-valued fields also accept [x, y]. */
6090
+ type Vec2 = {
6091
+ x: number;
6092
+ y: number;
6093
+ };
6094
+ type Vec2Like = Vec2 | readonly [number, number];
6095
+ /** An axis-aligned box (mm). */
6096
+ type Box = {
6097
+ minX: number;
6098
+ minY: number;
6099
+ maxX: number;
6100
+ maxY: number;
6101
+ };
6102
+ /** Arrowhead styles (leaders, dimensions). */
6103
+ type ArrowType = "filled" | "open" | "tick" | "dot" | "none";
6104
+ /** Polyline vertex; bulge = tan(sweep/4), 0 = straight. Accepts [x, y, bulge?]. */
6105
+ type PolylineVertexInput = {
6106
+ x: number;
6107
+ y: number;
6108
+ bulge?: number;
6109
+ } | readonly [number, number, number?];
6110
+ /** The fields every object input may carry: its layer and the style
6111
+ * overrides (otherwise by layer — or, for a block child, by the instance). */
6112
+ type ObjectInputBase = {
6113
+ /** The layer, by NAME or id. Absent: `document.add` uses the current
6114
+ * layer, a block child the instance's (the portable default; an unknown
6115
+ * name falls back to it too). A child on another layer hides with that
6116
+ * layer, while its color / line type / width still follow the instance
6117
+ * unless it sets its own (ByBlock, as in CAD). */
6118
+ layer?: string;
6119
+ /** The layer by id only — prefer `layer`. */
6120
+ layerId?: string;
6121
+ /** #rrggbb; absent = by layer. */
6122
+ color?: string;
6123
+ /** Line type; absent = by layer. */
6124
+ lineType?: string;
6125
+ /** Dash-pattern length multiplier; absent = 1. */
6126
+ lineTypeScale?: number;
6127
+ /** Line weight in mm; absent = by layer. */
6128
+ lineWidth?: number;
6129
+ /** Paint opacity 0..1; absent = by layer (opaque unless the layer says). */
6130
+ opacity?: number;
6131
+ };
6132
+ /**
6133
+ * T plus the shared input fields, FLATTENED (the homomorphic map forces the
6134
+ * intersection to resolve): hovers then list every member inline instead of
6135
+ * the opaque `ObjectInputBase & { … }` — the block editor has no
6136
+ * expand-type affordance, so the alias display is all a script author gets.
6137
+ */
6138
+ type ObjectInputShape<T> = {
6139
+ [K in keyof (T & ObjectInputBase)]: (T & ObjectInputBase)[K];
6140
+ } & {};
6141
+ type LineInput = ObjectInputShape<{
6142
+ type: "line";
6143
+ a: Vec2Like;
6144
+ b: Vec2Like;
6145
+ }>;
6146
+ /** A point: paints as a round dot whose diameter is the lineWidth. */
6147
+ type PointInput$1 = ObjectInputShape<{
6148
+ type: "point";
6149
+ p: Vec2Like;
6150
+ }>;
6151
+ type PolylineInput = ObjectInputShape<{
6152
+ type: "polyline";
6153
+ /** At least 2 vertices. */
6154
+ points: readonly PolylineVertexInput[];
6155
+ closed?: boolean;
6156
+ }>;
6157
+ type CircleInput = ObjectInputShape<{
6158
+ type: "circle";
6159
+ center: Vec2Like;
6160
+ radius: number;
6161
+ }>;
6162
+ /** Runs CCW from startAngle to endAngle (radians; DXF ARC convention). */
6163
+ type ArcInput = ObjectInputShape<{
6164
+ type: "arc";
6165
+ center: Vec2Like;
6166
+ radius: number;
6167
+ startAngle: number;
6168
+ endAngle: number;
6169
+ }>;
6170
+ /** majorAxis = endpoint vector from center; ratio = minor/major in (0, 1]. */
6171
+ type EllipseInput = ObjectInputShape<{
6172
+ type: "ellipse";
6173
+ center: Vec2Like;
6174
+ majorAxis: Vec2Like;
6175
+ ratio: number;
6176
+ startAngle?: number;
6177
+ endAngle?: number;
6178
+ }>;
6179
+ type HatchInput = ObjectInputShape<{
6180
+ type: "hatch";
6181
+ /** loops[0] = outer boundary, the rest are holes (even-odd). */
6182
+ loops: readonly {
6183
+ points: readonly PolylineVertexInput[];
6184
+ }[];
6185
+ fill?: {
6186
+ kind: "solid";
6187
+ }
6188
+ /** A named pattern: the built-in catalogue (ANSI31, AR-CONC, …) or one of
6189
+ * the document's own hatch patterns, by name. `angle` radians, `scale`
6190
+ * multiplies the definition's mm; `origin` anchors the pattern frame
6191
+ * (block-local mm; absent = the block origin). */
6192
+ | {
6193
+ kind: "pattern";
6194
+ name: string;
6195
+ angle: number;
6196
+ scale: number;
6197
+ origin?: Vec2Like;
6198
+ } | {
6199
+ kind: "lines";
6200
+ angle: number;
6201
+ spacing: number;
6202
+ } | {
6203
+ kind: "gradient";
6204
+ shape?: "linear" | "radial";
6205
+ color1?: string;
6206
+ color2?: string;
6207
+ angle?: number;
6208
+ };
6209
+ /** Pattern spacing multiplier. */
6210
+ scale?: number;
6211
+ }>;
6212
+ /** Character formatting over [start, end) of a text's `content` (JS string
6213
+ * indices). Absent attributes inherit the text's style; `height` is a ratio
6214
+ * of its cap height. Setting `content` without `spans` drops old spans. */
6215
+ type TextSpan = {
6216
+ start: number;
6217
+ end: number;
6218
+ font?: string;
6219
+ bold?: boolean;
6220
+ italic?: boolean;
6221
+ underline?: boolean;
6222
+ /** "#rrggbb". */
6223
+ color?: string;
6224
+ height?: number;
6225
+ script?: "sub" | "super";
6226
+ };
6227
+ type TextInput = ObjectInputShape<{
6228
+ type: "text";
6229
+ position: Vec2Like;
6230
+ content: string;
6231
+ spans?: readonly TextSpan[];
6232
+ rotation?: number;
6233
+ /** Justification, as in AutoCAD / DXF: which edge sits on the point —
6234
+ * "left" = the text runs right of it, "right" = left of it; vAlign
6235
+ * "bottom" = the text sits above the point, "top" = below it. */
6236
+ hAlign?: "left" | "center" | "right";
6237
+ vAlign?: "bottom" | "center" | "top";
6238
+ /** Word-wrap / frame width in mm (before `scale`); absent = no wrapping. */
6239
+ width?: number;
6240
+ frame?: "none" | "rectangle" | "circle" | "slot" | "bottom" | "firstLine";
6241
+ /** MLEADER-style arrow polylines pointing at the text (arrowhead at [0]). */
6242
+ leaderLines?: readonly (readonly Vec2Like[])[];
6243
+ /** The document text style to follow (name or id); absent = the first. */
6244
+ styleId?: string;
6245
+ /** Style overrides; absent keys inherit the document text style. */
6246
+ styleOverride?: TextStyleOverride;
6247
+ /** Size multiplier for height + arrow size. */
6248
+ scale?: number;
6249
+ }>;
6250
+ type DimensionInput = ObjectInputShape<{
6251
+ type: "dimension";
6252
+ kind?: "linear" | "angular" | "radial" | "diameter";
6253
+ /** linear: 2+ chained points (measured point to point); angular: [vertex, a, b]; radial: [center, p]; diameter: [p1, p2]. */
6254
+ points: readonly Vec2Like[];
6255
+ /** linear only: the measuring direction, radians CCW from +X. Unset =
6256
+ * aligned to the points. */
6257
+ rotation?: number;
6258
+ /** linear: signed distance of the dimension line from points[0], positive
6259
+ * to the LEFT of the measuring direction; angular: signed arc radius
6260
+ * (negative = the complementary arc). Not for radial/diameter. */
6261
+ offset?: number;
6262
+ /** One per measured segment (linear chain: points.length − 1, others: 1).
6263
+ * `along` (mm along the line from the segment origin — radial/diameter:
6264
+ * from the center) and `across` (mm off the line) place the text, unset =
6265
+ * automatic; `content` is the text, `{value}` = the measurement. */
6266
+ labels?: readonly {
6267
+ along?: number;
6268
+ across?: number;
6269
+ content?: string;
6270
+ /** Formatting over `content` (spans covering `{value}` format it). */
6271
+ spans?: readonly TextSpan[];
6272
+ }[];
6273
+ /** The document dimension style to follow (name or id); absent = the first. */
6274
+ styleId?: string;
6275
+ /** Style overrides; absent keys inherit the document dimension style. */
6276
+ styleOverride?: DimStyleOverride;
6277
+ /** Annotation size multiplier (text/arrows/offsets). */
6278
+ scale?: number;
6279
+ }>;
6280
+ /** Nested block instance (inputs may hold points, never object references). */
6281
+ type BlockInput = ObjectInputShape<{
6282
+ type: "block";
6283
+ definitionId: string;
6284
+ /** Applied last, about the pivot (the first input point). */
6285
+ rotation?: number;
6286
+ scale?: number;
6287
+ params?: Record<string, number | string | boolean | readonly number[] | readonly string[] | JsonValue>;
6288
+ /** Input points in the PARENT's local coords (the first is the pivot):
6289
+ * in pick order, or by input name for a block declaring an `inputs`
6290
+ * table. Object ids (a `host`, picked objects) only on instances a
6291
+ * script ADDS to the document — a block's own children can't reference. */
6292
+ inputs?: readonly Vec2Like[] | Readonly<Record<string, Vec2Like | readonly Vec2Like[] | string | readonly string[]>>;
6293
+ }>;
6294
+ /** A table cell: plain text, or text with merge / alignment / style. */
6295
+ type TableCellInput = string | {
6296
+ content?: string;
6297
+ /** Character formatting over `content`. */
6298
+ spans?: readonly TextSpan[];
6299
+ /** Merge from this (top-left) cell; covered cells are ignored. */
6300
+ span?: {
6301
+ cols: number;
6302
+ rows: number;
6303
+ };
6304
+ hAlign?: "left" | "center" | "right";
6305
+ vAlign?: "top" | "center" | "bottom";
6306
+ styleId?: string;
6307
+ styleOverride?: TextStyleOverride;
6308
+ color?: string;
6309
+ };
6310
+ /** Grid of text cells hanging right/down from `position` (top-left);
6311
+ * rows grow to fit their wrapped text. */
6312
+ type TableInput = ObjectInputShape<{
6313
+ type: "table";
6314
+ position: Vec2Like;
6315
+ /** Column widths (mm, before `scale`). */
6316
+ columns: readonly number[];
6317
+ /** Row count, or per-row settings (`minHeight` mm floor). */
6318
+ rows: number | readonly {
6319
+ minHeight?: number;
6320
+ }[];
6321
+ /** Row-major `cells[row][column]`, exactly rows × columns. */
6322
+ cells: readonly (readonly TableCellInput[])[];
6323
+ rotation?: number;
6324
+ scale?: number;
6325
+ /** Rows above the heavier header rule. */
6326
+ headerRows?: number;
6327
+ /** Text inset from the cell edges (mm). */
6328
+ cellMargin?: number;
6329
+ borders?: "all" | "outer" | "rows" | "none";
6330
+ styleId?: string;
6331
+ styleOverride?: TextStyleOverride;
6332
+ }>;
6333
+ /** Where a reference's file lives: a path (relative to the drawing's
6334
+ * folder), a url, or EMBEDDED — an asset of the document holding it (add the
6335
+ * file's bytes first with `document.addAsset`). */
6336
+ type ReferenceSource = {
6337
+ kind: "path";
6338
+ path: string;
6339
+ cacheKey?: string;
6340
+ } | {
6341
+ kind: "url";
6342
+ url: string;
6343
+ } | {
6344
+ kind: "asset";
6345
+ assetId: string;
6346
+ };
6347
+ /** A file drawn in place — a .linea, DXF, DWG, PDF page or picture (PNG /
6348
+ * JPEG). The file's origin lands at `position`; a picture draws at its
6349
+ * natural size (96 dpi) times `scale`. */
6350
+ type ReferenceInput = ObjectInputShape<{
6351
+ type: "reference";
6352
+ format: "linea" | "dxf" | "dwg" | "pdf" | "png" | "jpg";
6353
+ name: string;
6354
+ source: ReferenceSource;
6355
+ position: Vec2Like;
6356
+ /** Radians CCW about `position`. */
6357
+ rotation?: number;
6358
+ scale?: number;
6359
+ /** Flipped left-right (x → −x) before the rotation. */
6360
+ mirrored?: boolean;
6361
+ /** PDF: the 1-based page, drawn as vectors or rasterized. */
6362
+ pdfPage?: number;
6363
+ pdfMode?: "vector" | "raster";
6364
+ /** The file's layers not drawn, by name. */
6365
+ hiddenLayers?: readonly string[];
6366
+ hidden?: boolean;
6367
+ locked?: boolean;
6368
+ /** Crop rectangle in file coordinates. */
6369
+ clip?: Box;
6370
+ /** Content bounds in file coordinates (the frame drawn before it loads). */
6371
+ extent?: Box;
6372
+ }>;
6373
+ /** Paper-space window into model space; only in a layout (`document.add`
6374
+ * with `layout`). */
6375
+ type ViewportInput = ObjectInputShape<{
6376
+ type: "viewport";
6377
+ /** The frame on the sheet (mm): bottom-left corner + size. */
6378
+ rect: {
6379
+ x: number;
6380
+ y: number;
6381
+ w: number;
6382
+ h: number;
6383
+ };
6384
+ /** The model point shown at the frame's centre. */
6385
+ modelCenter?: Vec2Like;
6386
+ /** Drawing-scale denominator (model mm per paper mm); 1:50 => 50. */
6387
+ scale?: number;
6388
+ /** Pinned: no pan/zoom-through, no move/resize handles. */
6389
+ locked?: boolean;
6390
+ /** Layer ids hidden in this viewport only. */
6391
+ hiddenLayerIds?: readonly string[];
6392
+ }>;
6393
+ /** Review note pinned to a point; the editor shows a screen-fixed marker. */
6394
+ type CommentInput = ObjectInputShape<{
6395
+ type: "comment";
6396
+ /** Tail tip of the bubble (world/sheet mm). */
6397
+ position: Vec2Like;
6398
+ text?: string;
6399
+ tags?: readonly string[];
6400
+ }>;
6401
+ /** What a script WRITES — the union of the authoring DTOs above (what
6402
+ * `document.add` takes). Reads return `ModelObject`. */
6403
+ type ModelObjectInput$1 = LineInput | PointInput$1 | PolylineInput | CircleInput | ArcInput | EllipseInput | HatchInput | TextInput | DimensionInput | BlockInput | TableInput | ViewportInput | CommentInput | ReferenceInput;
6404
+ /** Text style keys a text, table or table cell may override. */
6405
+ type TextStyleOverride = Partial<Omit<TextStyle, "id" | "name">>;
6406
+ /** Dimension style keys a dimension may override. */
6407
+ type DimStyleOverride = Partial<Omit<DimStyle, "id" | "name">>;
6408
+ /** A document text style (`styles.text(id)` in `draw`,
6409
+ * `document.listTextStyles()`). Heights and arrow sizes are mm before an
6410
+ * object's `scale`. */
6411
+ type TextStyle = {
6412
+ readonly id: string;
6413
+ readonly name: string;
6414
+ readonly font: string;
6415
+ readonly widthFactor: number;
6416
+ readonly bold?: boolean;
6417
+ readonly italic?: boolean;
6418
+ readonly textHeight: number;
6419
+ readonly arrowType: ArrowType;
6420
+ readonly arrowSize: number;
6421
+ };
6422
+ /** A document dimension style (`styles.dim(id)`,
6423
+ * `document.listDimStyles()`). */
6424
+ type DimStyle = {
6425
+ readonly id: string;
6426
+ readonly name: string;
6427
+ readonly font: string;
6428
+ readonly widthFactor: number;
6429
+ readonly bold?: boolean;
6430
+ readonly italic?: boolean;
6431
+ readonly textHeight: number;
6432
+ readonly textOffset: number;
6433
+ readonly arrowType: ArrowType;
6434
+ readonly arrowSize: number;
6435
+ /** "short" = a 2×overshoot tick across the dimension line. */
6436
+ readonly extensionType: "long" | "short";
6437
+ readonly extensionOffset: number;
6438
+ readonly extensionOvershoot: number;
6439
+ readonly precision: number;
6440
+ };
6441
+ /** Any JSON value — what a `data` param holds. */
6442
+ type JsonValue = string | number | boolean | null | readonly JsonValue[] | {
6443
+ readonly [key: string]: JsonValue;
6444
+ };
6445
+
6028
6446
  /** A world point in mm, as `[x, y]` or `{x, y}`. */
6029
- type PointInput = Vec2 | readonly [number, number];
6030
- /** Loose object input: model fields + `layer` (name) / `layerId` / `id`. */
6031
- type ObjectInput = {
6032
- type: ModelObjectType;
6033
- } & Record<string, unknown>;
6447
+ type PointInput = Vec2$1 | readonly [number, number];
6448
+ /** Object input: the typed authoring DTOs (per-type fields, so editors
6449
+ * autocomplete them; `layer` by name or id) + an optional own `id`. */
6450
+ type ModelObjectInput = ModelObjectInput$1 & {
6451
+ id?: string;
6452
+ };
6034
6453
  /** Semantic, filtered read over one space's objects (all filters AND). */
6035
- interface QueryFilter {
6454
+ interface ObjectQuery {
6036
6455
  ids?: readonly string[];
6037
6456
  type?: ModelObjectType;
6038
6457
  /** Layer name or id. */
@@ -6162,7 +6581,7 @@ interface Drawing$1 {
6162
6581
  readonly document: LineaDocument;
6163
6582
  summary(): DocumentSummary;
6164
6583
  /** Filtered objects — model space, or one layout via `filter.layout`. */
6165
- listObjects(filter?: QueryFilter): ModelObject[];
6584
+ listObjects(filter?: ObjectQuery): ModelObject[];
6166
6585
  /** Look up an object in ANY space. */
6167
6586
  getObject(id: string): ModelObject | undefined;
6168
6587
  /** bbox / curve length / enclosed area of one object (any space). */
@@ -6190,7 +6609,7 @@ interface Drawing$1 {
6190
6609
  toLinea(): string;
6191
6610
  /** Add objects (points may be `[x, y]`; `layer` resolves by name);
6192
6611
  * returns the created ids. */
6193
- add(objects: readonly ObjectInput[], opts?: AddOptions): string[];
6612
+ add(objects: readonly ModelObjectInput[], opts?: AddOptions): string[];
6194
6613
  /** Apply per-object patches (`{id, ...fields}`) in one undo step. */
6195
6614
  update(entries: readonly ({
6196
6615
  id: string;
@@ -6228,25 +6647,21 @@ interface Drawing$1 {
6228
6647
  /** Document-wide settings, merged over the current record (`units` is
6229
6648
  * declarative for now: everything is stored in mm). */
6230
6649
  updateSettings(patch: Partial<LineaDocument["settings"]>): void;
6231
- listTextStyles(): TextStyle[];
6232
- listDimStyles(): DimStyle[];
6650
+ listTextStyles(): TextStyle$1[];
6651
+ listDimStyles(): DimStyle$1[];
6233
6652
  /** Create a style (name unique, case-insensitive; unset fields take the
6234
6653
  * defaults); returns its id. Styles are addressed by name or id. */
6235
6654
  addTextStyle(props: {
6236
6655
  name: string;
6237
- } & Partial<Omit<TextStyle, "id">>): string;
6238
- updateTextStyle(nameOrId: string, patch: Partial<Omit<TextStyle, "id">>): void;
6656
+ } & Partial<Omit<TextStyle$1, "id">>): string;
6657
+ updateTextStyle(nameOrId: string, patch: Partial<Omit<TextStyle$1, "id">>): void;
6239
6658
  /** Remove a style no object resolves to (else refused, with a count). */
6240
6659
  removeTextStyle(nameOrId: string): void;
6241
6660
  addDimStyle(props: {
6242
6661
  name: string;
6243
- } & Partial<Omit<DimStyle, "id">>): string;
6244
- updateDimStyle(nameOrId: string, patch: Partial<Omit<DimStyle, "id">>): void;
6662
+ } & Partial<Omit<DimStyle$1, "id">>): string;
6663
+ updateDimStyle(nameOrId: string, patch: Partial<Omit<DimStyle$1, "id">>): void;
6245
6664
  removeDimStyle(nameOrId: string): void;
6246
- /** @deprecated Use updateDimStyle (default here: the first style). */
6247
- setDimStyle(patch: Partial<DimStyle>, styleId?: string): void;
6248
- /** @deprecated Use updateTextStyle (default here: the first style). */
6249
- setTextStyle(patch: Partial<TextStyle>, styleId?: string): void;
6250
6665
  /** The document's own line type definitions (name-keyed; objects and
6251
6666
  * layers reference line types by NAME, these ahead of the built-in
6252
6667
  * catalogue). */
@@ -6265,18 +6680,19 @@ interface Drawing$1 {
6265
6680
  addHatchPatterns(patterns: readonly DocumentHatchPattern[]): void;
6266
6681
  updateHatchPattern(name: string, patch: Partial<DocumentHatchPattern>): void;
6267
6682
  removeHatchPattern(name: string): void;
6268
- /** Embed image pixels (a data URL); returns the content-keyed assetId. */
6683
+ /** Embed a file (a data URL); returns the content-keyed assetId an
6684
+ * embedded reference's `source: { kind: "asset", assetId }` names. */
6269
6685
  addAsset(dataUrl: string): string;
6270
- /** Remove an asset (refused while an image references it). */
6686
+ /** Remove an asset (refused while a reference embeds it). */
6271
6687
  removeAsset(id: string): void;
6272
- /** Embedded image assets: id, mime type, bytes, how many images use it. */
6688
+ /** Embedded files: id, mime type, bytes, how many references embed it. */
6273
6689
  listAssets(): AssetInfo[];
6274
6690
  /** DXF text → new layers, objects, layouts. */
6275
6691
  importDxfText(text: string, opts?: DxfImportOptions): DxfImportReport;
6276
6692
  /** DWG bytes (wasm transcode → the DXF path). */
6277
6693
  importDwgData(data: Uint8Array, opts?: DxfImportOptions): Promise<DxfImportReport>;
6278
6694
  /** PDF vectors/text onto the current layer, or (`as: "image"`, a host
6279
- * capability) every page as an image at true scale. */
6695
+ * capability) embedded, every page a raster reference at true scale. */
6280
6696
  importPdfData(data: ArrayBuffer | Uint8Array, opts?: PdfImportOptions): Promise<PdfImportReport>;
6281
6697
  /** Merge block module sources into the document library (verbatim →
6282
6698
  * skip, same id → replace in place, name clash → suffix). Async: awaits
@@ -6324,11 +6740,31 @@ interface EditorSurface {
6324
6740
  setSelection(ids: readonly string[]): void;
6325
6741
  zoom(to: ZoomTarget): void;
6326
6742
  /** Await one snapped world point; rejects when the user cancels. */
6327
- pickPoint(opts?: PickPointOptions): Promise<Vec2>;
6328
- /** Await one object click; resolves the object's id. */
6743
+ pickPoint(opts?: PickPointOptions): Promise<Vec2$1>;
6744
+ /** Await one object click; resolves the object's id. `types` limits what
6745
+ * can be picked (ModelObject types; empty/absent = any). */
6329
6746
  pickObject(opts?: {
6330
6747
  label?: string;
6748
+ types?: readonly string[];
6331
6749
  }): Promise<string>;
6750
+ /** Await a chain of snapped points (rubber band from the previous);
6751
+ * Enter/Esc finishes once `min` (default 1) is met, `max` ends it.
6752
+ * Rejects when the user cancels below `min`. */
6753
+ pickPoints(opts?: PickPointsOptions): Promise<Vec2$1[]>;
6754
+ /** Await several object picks (each once); Enter/Esc finishes once
6755
+ * `min` (default 1) is met. Rejects when the user cancels below `min`. */
6756
+ pickObjects(opts?: {
6757
+ label?: string;
6758
+ types?: readonly string[];
6759
+ min?: number;
6760
+ max?: number;
6761
+ }): Promise<string[]>;
6762
+ /** Ask several values in one dialog — the command params form, from a
6763
+ * ParamDef table; resolves the values by name, rejects on cancel. */
6764
+ ask(params: readonly ParamDef[], opts?: {
6765
+ title?: string;
6766
+ description?: string;
6767
+ }): Promise<Record<string, unknown>>;
6332
6768
  /** Await a typed value from a small input dialog; rejects on cancel. */
6333
6769
  prompt(message: string, opts?: {
6334
6770
  initial?: string;
@@ -6340,7 +6776,21 @@ interface EditorSurface {
6340
6776
  /** Trigger a command by id (interactive tools start and wait for the
6341
6777
  * user; macros with declared inputs / params accept them up front —
6342
6778
  * params passed skip the params dialog). */
6343
- runCommand(id: string, inputs?: readonly PointInput[], params?: Readonly<Record<string, unknown>>): Promise<void>;
6779
+ runCommand(id: string, inputs?: CommandInputsArg, params?: Readonly<Record<string, unknown>>): Promise<void>;
6780
+ }
6781
+ /** Inputs a caller supplies to a command: positional points (a command
6782
+ * declaring labels) or a record by input name (a command declaring a
6783
+ * table — points as [x, y], objects as ids). */
6784
+ type CommandInputsArg = readonly PointInput[] | Readonly<Record<string, PointInput | readonly PointInput[] | string | readonly string[]>>;
6785
+ interface PickPointsOptions {
6786
+ label?: string;
6787
+ /** Default 1. */
6788
+ min?: number;
6789
+ max?: number;
6790
+ /** Preview the closing segment (a polygon). */
6791
+ closed?: boolean;
6792
+ /** Rubber band from here to the first pick. */
6793
+ referencePoint?: PointInput;
6344
6794
  }
6345
6795
  /** Where `EditorSurface.zoom` moves the camera: everything in the active
6346
6796
  * space, the selection, some objects' extents, or a window (world mm; sheet
@@ -6390,8 +6840,9 @@ declare class Drawing extends LocalDrawing {
6390
6840
  * that can't be read stays a frame. */
6391
6841
  ready(): Promise<void>;
6392
6842
  /** One reference's content (null when unreadable); a .linea's own
6393
- * references load relative to it — depth-limited, never re-entering a
6394
- * file above in the chain (the editor's rules). */
6843
+ * references load relative to it — and its embedded ones from ITS assets —
6844
+ * depth-limited, never re-entering a file above in the chain (the
6845
+ * editor's rules). */
6395
6846
  private loadReference;
6396
6847
  private readSource;
6397
6848
  /** Rasterize model space (or a paper layout via `layout`) to PNG bytes
@@ -6412,12 +6863,13 @@ declare class Drawing extends LocalDrawing {
6412
6863
  importDwg(path: string, opts?: DxfImportOptions): Promise<DxfImportReport>;
6413
6864
  importPdf(path: string, opts?: PdfImportOptions): Promise<PdfImportReport>;
6414
6865
  /** Run a command module source (`defineCommand`) against this drawing as
6415
- * ONE undo step, headlessly: declared `inputs` must be supplied; declared
6866
+ * ONE undo step, headlessly: declared `inputs` must be supplied (points
6867
+ * in label order, or a record by name for an inputs table); declared
6416
6868
  * `params` take their defaults unless given by name (unknown names and
6417
6869
  * wrong types throw). Resolves with the script's return value. */
6418
- runScript(source: string, inputs?: readonly PointInput[], params?: Readonly<Record<string, unknown>>): Promise<unknown>;
6870
+ runScript(source: string, inputs?: CommandInputsArg, params?: Readonly<Record<string, unknown>>): Promise<unknown>;
6419
6871
  /** Run one of the document's own commands (by exported id). */
6420
- runUserCommand(id: string, inputs?: readonly PointInput[], params?: Readonly<Record<string, unknown>>): Promise<unknown>;
6872
+ runUserCommand(id: string, inputs?: CommandInputsArg, params?: Readonly<Record<string, unknown>>): Promise<unknown>;
6421
6873
  }
6422
6874
  /** A fresh empty document, optionally named (until saved to a file, whose
6423
6875
  * name then takes over). */
@@ -6433,4 +6885,4 @@ declare function drawingFromJson(text: string): Drawing;
6433
6885
  /** Open a `.linea` file (parse + migrate) into an in-process kernel. */
6434
6886
  declare function openDrawing(path: string, options?: DrawingOptions): Promise<Drawing>;
6435
6887
 
6436
- export { type AABB, type AddOptions, type BlockMeta, type CommandMeta, type DimStyle, type DocumentSummary, Drawing, type Drawing$1 as DrawingApi, type DrawingOptions, type DxfImportOptions, type DxfImportReport, type EditorSurface, type Layer, type LayerInfo, type LayoutOptions, type LayoutPatch, type LineaDocument, type MarketplaceConfig, type MarketplaceHit, type MarketplaceInfo, type MarketplaceQuery, type Measurement, type MergeReport, type ModelObject, type ModelObjectType, type ObjectInput, type Operation, type PaperLayout, type PdfImportReport, type RenderPdfOptions as PdfOptions, type RenderPngOptions as PngOptions, type PointInput, type PrintPalette, type QueryFilter, type SheetName, type RenderSvgOptions as SvgOptions, type TextMeasurer, type TextStyle, type Vec2, type ViewportOptions, drawingFromJson, ensureScriptTranspiler, getBlockMetaResult, getCommandMetaResult, newDrawing, openDrawing, parseScale, renderBlockThumbnailSvg, testBlockDefinition };
6888
+ export { type AABB, type AddOptions, type BlockMeta, type CommandMeta, type DimStyle$1 as DimStyle, type DocumentSummary, Drawing, type Drawing$1 as DrawingApi, type DrawingOptions, type DxfImportOptions, type DxfImportReport, type EditorSurface, type Layer, type LayerInfo, type LayoutOptions, type LayoutPatch, type LineaDocument, type MarketplaceConfig, type MarketplaceHit, type MarketplaceInfo, type MarketplaceQuery, type Measurement, type MergeReport, type ModelObject, type ModelObjectInput, type ModelObjectType, type ObjectQuery, type Operation, type PaperLayout, type PdfImportReport, type RenderPdfOptions as PdfOptions, type RenderPngOptions as PngOptions, type PointInput, type PrintPalette, type SheetName, type RenderSvgOptions as SvgOptions, type TextMeasurer, type TextStyle$1 as TextStyle, type Vec2$1 as Vec2, type ViewportOptions, drawingFromJson, ensureScriptTranspiler, getBlockMetaResult, getCommandMetaResult, newDrawing, openDrawing, parseScale, renderBlockThumbnailSvg, testBlockDefinition };