lineadraw 0.8.0 → 0.9.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/README.md +249 -198
- package/bin/lineadraw.mjs +15 -110
- package/dist/bridge.d.ts +102 -0
- package/dist/bridge.js +16 -0
- package/dist/{chunk-VWED6V6F.js → chunk-BQCSFVAF.js} +401 -81
- package/dist/chunk-BQCSFVAF.js.map +1 -0
- package/dist/chunk-L2CWZAKW.js +141 -0
- package/dist/chunk-L2CWZAKW.js.map +1 -0
- package/dist/exportDxf-T2RTSTH5.js +10 -0
- package/dist/exportDxf-T2RTSTH5.js.map +1 -0
- package/dist/sdk.d.ts +469 -234
- package/dist/sdk.js +164 -168
- package/dist/sdk.js.map +1 -1
- package/lineadraw.d.ts +304 -1617
- package/package.json +2 -2
- package/templates/sample.block.ts +2 -2
- package/dist/chunk-VWED6V6F.js.map +0 -1
- package/dist/exportDxf-2VU5475O.js +0 -8
- /package/dist/{exportDxf-2VU5475O.js.map → bridge.js.map} +0 -0
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,7 @@ 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>;
|
|
91
92
|
/**
|
|
92
93
|
* A LINKED file drawn in place (an xref): the document holds this record,
|
|
93
94
|
* never the file. The file's model space lands with its origin at
|
|
@@ -118,6 +119,9 @@ declare const ReferenceSchema: z.ZodObject<{
|
|
|
118
119
|
}, z.core.$strip>, z.ZodObject<{
|
|
119
120
|
kind: z.ZodLiteral<"url">;
|
|
120
121
|
url: z.ZodString;
|
|
122
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
123
|
+
kind: z.ZodLiteral<"asset">;
|
|
124
|
+
assetId: z.ZodString;
|
|
121
125
|
}, z.core.$strip>], "kind">;
|
|
122
126
|
position: z.ZodPreprocess<z.ZodObject<{
|
|
123
127
|
x: z.ZodNumber;
|
|
@@ -147,7 +151,7 @@ declare const ReferenceSchema: z.ZodObject<{
|
|
|
147
151
|
maxY: z.ZodNumber;
|
|
148
152
|
}, z.core.$strip>>;
|
|
149
153
|
}, z.core.$strip>;
|
|
150
|
-
type
|
|
154
|
+
type Reference = z.infer<typeof ReferenceSchema>;
|
|
151
155
|
declare const ModelObjectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
152
156
|
id: z.ZodString;
|
|
153
157
|
layerId: z.ZodString;
|
|
@@ -436,23 +440,6 @@ declare const ModelObjectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
436
440
|
x: z.ZodNumber;
|
|
437
441
|
y: z.ZodNumber;
|
|
438
442
|
}, 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<{
|
|
450
|
-
x: z.ZodNumber;
|
|
451
|
-
y: z.ZodNumber;
|
|
452
|
-
}, z.core.$strip>, unknown>;
|
|
453
|
-
width: z.ZodNumber;
|
|
454
|
-
height: z.ZodNumber;
|
|
455
|
-
rotation: z.ZodDefault<z.ZodNumber>;
|
|
456
443
|
}, z.core.$strip>, z.ZodObject<{
|
|
457
444
|
id: z.ZodString;
|
|
458
445
|
layerId: z.ZodString;
|
|
@@ -606,6 +593,9 @@ declare const ModelObjectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
606
593
|
}, z.core.$strip>, z.ZodObject<{
|
|
607
594
|
kind: z.ZodLiteral<"url">;
|
|
608
595
|
url: z.ZodString;
|
|
596
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
597
|
+
kind: z.ZodLiteral<"asset">;
|
|
598
|
+
assetId: z.ZodString;
|
|
609
599
|
}, z.core.$strip>], "kind">;
|
|
610
600
|
position: z.ZodPreprocess<z.ZodObject<{
|
|
611
601
|
x: z.ZodNumber;
|
|
@@ -676,7 +666,7 @@ type Layer = z.infer<typeof LayerSchema>;
|
|
|
676
666
|
declare const LineaDocumentSchema: z.ZodPreprocess<z.ZodObject<{
|
|
677
667
|
id: z.ZodDefault<z.ZodString>;
|
|
678
668
|
type: z.ZodDefault<z.ZodLiteral<"lineadraw">>;
|
|
679
|
-
version: z.ZodLiteral<
|
|
669
|
+
version: z.ZodLiteral<23>;
|
|
680
670
|
settings: z.ZodDefault<z.ZodObject<{
|
|
681
671
|
units: z.ZodDefault<z.ZodEnum<{
|
|
682
672
|
in: "in";
|
|
@@ -983,23 +973,6 @@ declare const LineaDocumentSchema: z.ZodPreprocess<z.ZodObject<{
|
|
|
983
973
|
x: z.ZodNumber;
|
|
984
974
|
y: z.ZodNumber;
|
|
985
975
|
}, 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<{
|
|
997
|
-
x: z.ZodNumber;
|
|
998
|
-
y: z.ZodNumber;
|
|
999
|
-
}, z.core.$strip>, unknown>;
|
|
1000
|
-
width: z.ZodNumber;
|
|
1001
|
-
height: z.ZodNumber;
|
|
1002
|
-
rotation: z.ZodDefault<z.ZodNumber>;
|
|
1003
976
|
}, z.core.$strip>, z.ZodObject<{
|
|
1004
977
|
id: z.ZodString;
|
|
1005
978
|
layerId: z.ZodString;
|
|
@@ -1153,6 +1126,9 @@ declare const LineaDocumentSchema: z.ZodPreprocess<z.ZodObject<{
|
|
|
1153
1126
|
}, z.core.$strip>, z.ZodObject<{
|
|
1154
1127
|
kind: z.ZodLiteral<"url">;
|
|
1155
1128
|
url: z.ZodString;
|
|
1129
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1130
|
+
kind: z.ZodLiteral<"asset">;
|
|
1131
|
+
assetId: z.ZodString;
|
|
1156
1132
|
}, z.core.$strip>], "kind">;
|
|
1157
1133
|
position: z.ZodPreprocess<z.ZodObject<{
|
|
1158
1134
|
x: z.ZodNumber;
|
|
@@ -1482,23 +1458,6 @@ declare const LineaDocumentSchema: z.ZodPreprocess<z.ZodObject<{
|
|
|
1482
1458
|
x: z.ZodNumber;
|
|
1483
1459
|
y: z.ZodNumber;
|
|
1484
1460
|
}, 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<{
|
|
1496
|
-
x: z.ZodNumber;
|
|
1497
|
-
y: z.ZodNumber;
|
|
1498
|
-
}, z.core.$strip>, unknown>;
|
|
1499
|
-
width: z.ZodNumber;
|
|
1500
|
-
height: z.ZodNumber;
|
|
1501
|
-
rotation: z.ZodDefault<z.ZodNumber>;
|
|
1502
1461
|
}, z.core.$strip>, z.ZodObject<{
|
|
1503
1462
|
id: z.ZodString;
|
|
1504
1463
|
layerId: z.ZodString;
|
|
@@ -1652,6 +1611,9 @@ declare const LineaDocumentSchema: z.ZodPreprocess<z.ZodObject<{
|
|
|
1652
1611
|
}, z.core.$strip>, z.ZodObject<{
|
|
1653
1612
|
kind: z.ZodLiteral<"url">;
|
|
1654
1613
|
url: z.ZodString;
|
|
1614
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1615
|
+
kind: z.ZodLiteral<"asset">;
|
|
1616
|
+
assetId: z.ZodString;
|
|
1655
1617
|
}, z.core.$strip>], "kind">;
|
|
1656
1618
|
position: z.ZodPreprocess<z.ZodObject<{
|
|
1657
1619
|
x: z.ZodNumber;
|
|
@@ -1749,7 +1711,7 @@ declare const LineaDocumentSchema: z.ZodPreprocess<z.ZodObject<{
|
|
|
1749
1711
|
}, z.core.$strip>, unknown>;
|
|
1750
1712
|
type LineaDocument = z.infer<typeof LineaDocumentSchema>;
|
|
1751
1713
|
|
|
1752
|
-
declare const
|
|
1714
|
+
declare const ParamDefSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1753
1715
|
name: z.ZodString;
|
|
1754
1716
|
label: z.ZodOptional<z.ZodString>;
|
|
1755
1717
|
hint: z.ZodOptional<z.ZodString>;
|
|
@@ -1947,7 +1909,7 @@ declare const BlockParamSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1947
1909
|
default: z.ZodDefault<z.ZodString>;
|
|
1948
1910
|
}, z.core.$strip>], "type">>;
|
|
1949
1911
|
}, z.core.$strip>], "type">;
|
|
1950
|
-
type
|
|
1912
|
+
type ParamDef = z.infer<typeof ParamDefSchema>;
|
|
1951
1913
|
|
|
1952
1914
|
/** ISO A-series portrait sizes in mm [width, height]. */
|
|
1953
1915
|
declare const SHEET_PRESETS: {
|
|
@@ -2286,23 +2248,6 @@ declare const PaperLayoutSchema: z.ZodObject<{
|
|
|
2286
2248
|
x: z.ZodNumber;
|
|
2287
2249
|
y: z.ZodNumber;
|
|
2288
2250
|
}, 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<{
|
|
2300
|
-
x: z.ZodNumber;
|
|
2301
|
-
y: z.ZodNumber;
|
|
2302
|
-
}, z.core.$strip>, unknown>;
|
|
2303
|
-
width: z.ZodNumber;
|
|
2304
|
-
height: z.ZodNumber;
|
|
2305
|
-
rotation: z.ZodDefault<z.ZodNumber>;
|
|
2306
2251
|
}, z.core.$strip>, z.ZodObject<{
|
|
2307
2252
|
id: z.ZodString;
|
|
2308
2253
|
layerId: z.ZodString;
|
|
@@ -2456,6 +2401,9 @@ declare const PaperLayoutSchema: z.ZodObject<{
|
|
|
2456
2401
|
}, z.core.$strip>, z.ZodObject<{
|
|
2457
2402
|
kind: z.ZodLiteral<"url">;
|
|
2458
2403
|
url: z.ZodString;
|
|
2404
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2405
|
+
kind: z.ZodLiteral<"asset">;
|
|
2406
|
+
assetId: z.ZodString;
|
|
2459
2407
|
}, z.core.$strip>], "kind">;
|
|
2460
2408
|
position: z.ZodPreprocess<z.ZodObject<{
|
|
2461
2409
|
x: z.ZodNumber;
|
|
@@ -2506,7 +2454,7 @@ declare const ensureScriptTranspiler: () => Promise<ModuleExecutor>;
|
|
|
2506
2454
|
interface BlockMeta {
|
|
2507
2455
|
id: string;
|
|
2508
2456
|
name: string;
|
|
2509
|
-
params:
|
|
2457
|
+
params: ParamDef[];
|
|
2510
2458
|
description?: string;
|
|
2511
2459
|
version?: string;
|
|
2512
2460
|
authors?: string[];
|
|
@@ -2735,7 +2683,7 @@ interface CommandMeta {
|
|
|
2735
2683
|
/** Declared parameters (the blocks' ParamDef table): prompted in the
|
|
2736
2684
|
* editor before `run`, or passed by a headless caller; arrive as
|
|
2737
2685
|
* `ctx.params`. Absent when the command declares none. */
|
|
2738
|
-
params?:
|
|
2686
|
+
params?: ParamDef[];
|
|
2739
2687
|
}
|
|
2740
2688
|
/** Non-throwing meta lookup for list UIs. */
|
|
2741
2689
|
type CommandMetaResult = {
|
|
@@ -2759,7 +2707,7 @@ interface TextMeasurer {
|
|
|
2759
2707
|
|
|
2760
2708
|
type SnapPointType = "endpoint" | "midpoint" | "center" | "quadrant";
|
|
2761
2709
|
interface SnapPoint {
|
|
2762
|
-
p: Vec2;
|
|
2710
|
+
p: Vec2$1;
|
|
2763
2711
|
type: SnapPointType;
|
|
2764
2712
|
}
|
|
2765
2713
|
/** A cached segment; tessellation chords of curves are marked as such. */
|
|
@@ -2794,13 +2742,13 @@ interface SnapCacheEntry {
|
|
|
2794
2742
|
*/
|
|
2795
2743
|
ellipses?: EllipseGeom[];
|
|
2796
2744
|
/** Closed tessellated rings (hatch interiors, for inside hit-testing). */
|
|
2797
|
-
rings?: Vec2[][];
|
|
2745
|
+
rings?: Vec2$1[][];
|
|
2798
2746
|
/**
|
|
2799
2747
|
* Filled regions of NESTED content — a block's hatch children — each its
|
|
2800
2748
|
* own even-odd ring set (so two overlapping fills don't cancel). An
|
|
2801
2749
|
* inside hit on one ranks like a hatch hit: below geometry drawn over it.
|
|
2802
2750
|
*/
|
|
2803
|
-
regions?: Vec2[][][];
|
|
2751
|
+
regions?: Vec2$1[][][];
|
|
2804
2752
|
/**
|
|
2805
2753
|
* Huge entries (a referenced site plan: 10⁵+ segments) answer "what is in
|
|
2806
2754
|
* this box" from a spatial index, so snapping and picking near the cursor
|
|
@@ -2822,9 +2770,9 @@ interface DocumentPaintResources {
|
|
|
2822
2770
|
* it (its color still follows the instance unless it sets one). */
|
|
2823
2771
|
layers: readonly Layer[];
|
|
2824
2772
|
/** Document dimension styles — dimensions pick theirs by styleId. */
|
|
2825
|
-
dimStyles: readonly DimStyle[];
|
|
2773
|
+
dimStyles: readonly DimStyle$1[];
|
|
2826
2774
|
/** Document text styles — texts pick theirs by styleId. */
|
|
2827
|
-
textStyles: readonly TextStyle[];
|
|
2775
|
+
textStyles: readonly TextStyle$1[];
|
|
2828
2776
|
/** Document-defined line types / hatch patterns, resolved by NAME ahead
|
|
2829
2777
|
* of the built-in catalogue (block children and hatch fills). */
|
|
2830
2778
|
lineTypes: readonly LineType[];
|
|
@@ -2842,9 +2790,8 @@ interface DocumentPaintResources {
|
|
|
2842
2790
|
*/
|
|
2843
2791
|
resolveObject?: (id: string) => ModelObject | undefined;
|
|
2844
2792
|
/**
|
|
2845
|
-
* The document's embedded assets (hash → data URL) — the
|
|
2846
|
-
*
|
|
2847
|
-
* images (or documents without any) paint a crossed placeholder frame.
|
|
2793
|
+
* The document's embedded assets (hash → data URL) — the bytes behind
|
|
2794
|
+
* `asset`-source references, which a host's `resolveReference` reads.
|
|
2848
2795
|
*/
|
|
2849
2796
|
assets?: Readonly<Record<string, string>>;
|
|
2850
2797
|
/**
|
|
@@ -2852,7 +2799,7 @@ interface DocumentPaintResources {
|
|
|
2852
2799
|
* loading and caching. Absent, or null for a file not loaded (yet), → the
|
|
2853
2800
|
* reference paints as a dashed frame.
|
|
2854
2801
|
*/
|
|
2855
|
-
resolveReference?: (ref:
|
|
2802
|
+
resolveReference?: (ref: Reference) => ReferenceContent | null;
|
|
2856
2803
|
}
|
|
2857
2804
|
|
|
2858
2805
|
/**
|
|
@@ -2871,6 +2818,8 @@ interface ReferenceContent extends LayoutModelContext {
|
|
|
2871
2818
|
bounds: AABB;
|
|
2872
2819
|
/** PDF: how many pages the file has (the page field's range). */
|
|
2873
2820
|
pageCount?: number;
|
|
2821
|
+
/** A bitmap drawn under `objects` (PNG/JPEG, raster PDF page). */
|
|
2822
|
+
raster?: ReferenceRaster;
|
|
2874
2823
|
/**
|
|
2875
2824
|
* Snap geometry precomputed in FILE coordinates (off the main thread —
|
|
2876
2825
|
* see `referenceSnapOf`); absent → derived from `objects`. A raster PDF
|
|
@@ -2883,13 +2832,13 @@ interface ReferenceContent extends LayoutModelContext {
|
|
|
2883
2832
|
* reference's hidden layers still filter them). */
|
|
2884
2833
|
interface ReferenceSnap {
|
|
2885
2834
|
points: {
|
|
2886
|
-
p: Vec2;
|
|
2835
|
+
p: Vec2$1;
|
|
2887
2836
|
type: SnapPointType;
|
|
2888
2837
|
layer: string;
|
|
2889
2838
|
}[];
|
|
2890
2839
|
segments: {
|
|
2891
|
-
a: Vec2;
|
|
2892
|
-
b: Vec2;
|
|
2840
|
+
a: Vec2$1;
|
|
2841
|
+
b: Vec2$1;
|
|
2893
2842
|
chord?: boolean;
|
|
2894
2843
|
layer: string;
|
|
2895
2844
|
}[];
|
|
@@ -2900,6 +2849,14 @@ interface ReferenceSnap {
|
|
|
2900
2849
|
layer: string;
|
|
2901
2850
|
})[];
|
|
2902
2851
|
}
|
|
2852
|
+
/** Raster content: one bitmap, bottom-left at the file origin, `width` ×
|
|
2853
|
+
* `height` mm — a PNG/JPEG reference or a raster PDF page. */
|
|
2854
|
+
interface ReferenceRaster {
|
|
2855
|
+
/** The bitmap as a data URL (what the sink's `image()` op draws). */
|
|
2856
|
+
data: string;
|
|
2857
|
+
width: number;
|
|
2858
|
+
height: number;
|
|
2859
|
+
}
|
|
2903
2860
|
|
|
2904
2861
|
/**
|
|
2905
2862
|
* Where a reorder places the moved objects: the top/bottom of the space's
|
|
@@ -3204,23 +3161,6 @@ declare const OperationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
3204
3161
|
x: z.ZodNumber;
|
|
3205
3162
|
y: z.ZodNumber;
|
|
3206
3163
|
}, 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<{
|
|
3218
|
-
x: z.ZodNumber;
|
|
3219
|
-
y: z.ZodNumber;
|
|
3220
|
-
}, z.core.$strip>, unknown>;
|
|
3221
|
-
width: z.ZodNumber;
|
|
3222
|
-
height: z.ZodNumber;
|
|
3223
|
-
rotation: z.ZodDefault<z.ZodNumber>;
|
|
3224
3164
|
}, z.core.$strip>, z.ZodObject<{
|
|
3225
3165
|
id: z.ZodString;
|
|
3226
3166
|
layerId: z.ZodString;
|
|
@@ -3374,6 +3314,9 @@ declare const OperationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
3374
3314
|
}, z.core.$strip>, z.ZodObject<{
|
|
3375
3315
|
kind: z.ZodLiteral<"url">;
|
|
3376
3316
|
url: z.ZodString;
|
|
3317
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
3318
|
+
kind: z.ZodLiteral<"asset">;
|
|
3319
|
+
assetId: z.ZodString;
|
|
3377
3320
|
}, z.core.$strip>], "kind">;
|
|
3378
3321
|
position: z.ZodPreprocess<z.ZodObject<{
|
|
3379
3322
|
x: z.ZodNumber;
|
|
@@ -3697,23 +3640,6 @@ declare const OperationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
3697
3640
|
x: z.ZodNumber;
|
|
3698
3641
|
y: z.ZodNumber;
|
|
3699
3642
|
}, 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<{
|
|
3711
|
-
x: z.ZodNumber;
|
|
3712
|
-
y: z.ZodNumber;
|
|
3713
|
-
}, z.core.$strip>, unknown>;
|
|
3714
|
-
width: z.ZodNumber;
|
|
3715
|
-
height: z.ZodNumber;
|
|
3716
|
-
rotation: z.ZodDefault<z.ZodNumber>;
|
|
3717
3643
|
}, z.core.$strip>, z.ZodObject<{
|
|
3718
3644
|
id: z.ZodString;
|
|
3719
3645
|
layerId: z.ZodString;
|
|
@@ -3867,6 +3793,9 @@ declare const OperationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
3867
3793
|
}, z.core.$strip>, z.ZodObject<{
|
|
3868
3794
|
kind: z.ZodLiteral<"url">;
|
|
3869
3795
|
url: z.ZodString;
|
|
3796
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
3797
|
+
kind: z.ZodLiteral<"asset">;
|
|
3798
|
+
assetId: z.ZodString;
|
|
3870
3799
|
}, z.core.$strip>], "kind">;
|
|
3871
3800
|
position: z.ZodPreprocess<z.ZodObject<{
|
|
3872
3801
|
x: z.ZodNumber;
|
|
@@ -4272,23 +4201,6 @@ declare const OperationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
4272
4201
|
x: z.ZodNumber;
|
|
4273
4202
|
y: z.ZodNumber;
|
|
4274
4203
|
}, 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<{
|
|
4286
|
-
x: z.ZodNumber;
|
|
4287
|
-
y: z.ZodNumber;
|
|
4288
|
-
}, z.core.$strip>, unknown>;
|
|
4289
|
-
width: z.ZodNumber;
|
|
4290
|
-
height: z.ZodNumber;
|
|
4291
|
-
rotation: z.ZodDefault<z.ZodNumber>;
|
|
4292
4204
|
}, z.core.$strip>, z.ZodObject<{
|
|
4293
4205
|
id: z.ZodString;
|
|
4294
4206
|
layerId: z.ZodString;
|
|
@@ -4442,6 +4354,9 @@ declare const OperationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
4442
4354
|
}, z.core.$strip>, z.ZodObject<{
|
|
4443
4355
|
kind: z.ZodLiteral<"url">;
|
|
4444
4356
|
url: z.ZodString;
|
|
4357
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
4358
|
+
kind: z.ZodLiteral<"asset">;
|
|
4359
|
+
assetId: z.ZodString;
|
|
4445
4360
|
}, z.core.$strip>], "kind">;
|
|
4446
4361
|
position: z.ZodPreprocess<z.ZodObject<{
|
|
4447
4362
|
x: z.ZodNumber;
|
|
@@ -4794,23 +4709,6 @@ declare const OperationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
4794
4709
|
x: z.ZodNumber;
|
|
4795
4710
|
y: z.ZodNumber;
|
|
4796
4711
|
}, 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<{
|
|
4808
|
-
x: z.ZodNumber;
|
|
4809
|
-
y: z.ZodNumber;
|
|
4810
|
-
}, z.core.$strip>, unknown>;
|
|
4811
|
-
width: z.ZodNumber;
|
|
4812
|
-
height: z.ZodNumber;
|
|
4813
|
-
rotation: z.ZodDefault<z.ZodNumber>;
|
|
4814
4712
|
}, z.core.$strip>, z.ZodObject<{
|
|
4815
4713
|
id: z.ZodString;
|
|
4816
4714
|
layerId: z.ZodString;
|
|
@@ -4964,6 +4862,9 @@ declare const OperationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
4964
4862
|
}, z.core.$strip>, z.ZodObject<{
|
|
4965
4863
|
kind: z.ZodLiteral<"url">;
|
|
4966
4864
|
url: z.ZodString;
|
|
4865
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
4866
|
+
kind: z.ZodLiteral<"asset">;
|
|
4867
|
+
assetId: z.ZodString;
|
|
4967
4868
|
}, z.core.$strip>], "kind">;
|
|
4968
4869
|
position: z.ZodPreprocess<z.ZodObject<{
|
|
4969
4870
|
x: z.ZodNumber;
|
|
@@ -5278,9 +5179,10 @@ interface PdfImportReport {
|
|
|
5278
5179
|
objectIds: string[];
|
|
5279
5180
|
}
|
|
5280
5181
|
interface PdfImportOptions {
|
|
5281
|
-
/** "vectors" (default): lines and text runs. "image":
|
|
5282
|
-
*
|
|
5283
|
-
* capability (`rasterizePdf
|
|
5182
|
+
/** "vectors" (default): lines and text runs. "image": the PDF embedded
|
|
5183
|
+
* and every page placed as a raster reference at true page scale — a host
|
|
5184
|
+
* capability (`rasterizePdf`, for the page sizes), refused where it is
|
|
5185
|
+
* missing. */
|
|
5284
5186
|
as?: "vectors" | "image";
|
|
5285
5187
|
/** Bottom-left corner of the first page (image mode; default 0,0). Pages
|
|
5286
5188
|
* line up to the right. */
|
|
@@ -5299,7 +5201,7 @@ interface AssetInfo {
|
|
|
5299
5201
|
mimeType: string;
|
|
5300
5202
|
/** Decoded size in bytes. */
|
|
5301
5203
|
bytes: number;
|
|
5302
|
-
/**
|
|
5204
|
+
/** References (every space) that embed it. */
|
|
5303
5205
|
users: number;
|
|
5304
5206
|
}
|
|
5305
5207
|
/**
|
|
@@ -5328,7 +5230,7 @@ interface DrawingHooks {
|
|
|
5328
5230
|
/** Document-wide object lookup for block reference inputs. */
|
|
5329
5231
|
resolveObject?: (id: string) => ModelObject | undefined;
|
|
5330
5232
|
/** Loaded reference content (default: the drawing's referenceContent). */
|
|
5331
|
-
resolveReference?: (ref:
|
|
5233
|
+
resolveReference?: (ref: Reference) => ReferenceContent | null;
|
|
5332
5234
|
/** Snap/hit-test geometry, e.g. from a cache (default: built per call). */
|
|
5333
5235
|
snapEntry?: (obj: ModelObject) => SnapCacheEntry;
|
|
5334
5236
|
/** Where the host keeps its marketplace list and how it reaches them
|
|
@@ -5413,11 +5315,12 @@ declare class LocalDrawing implements Drawing$1 {
|
|
|
5413
5315
|
setCurrentLayer(nameOrId: string): void;
|
|
5414
5316
|
updateSettings(patch: Partial<LineaDocument["settings"]>): void;
|
|
5415
5317
|
/**
|
|
5416
|
-
* Embed
|
|
5417
|
-
*
|
|
5318
|
+
* Embed a file (a data URL — PNG, JPEG, PDF…) and return the assetId an
|
|
5319
|
+
* embedded reference's `source: { kind: "asset", assetId }` names.
|
|
5320
|
+
* Content-keyed: the same data reuses one entry.
|
|
5418
5321
|
*/
|
|
5419
5322
|
addAsset(dataUrl: string): string;
|
|
5420
|
-
/** Remove an asset (the kernel refuses while
|
|
5323
|
+
/** Remove an asset (the kernel refuses while a reference embeds it). */
|
|
5421
5324
|
removeAsset(id: string): void;
|
|
5422
5325
|
listAssets(): AssetInfo[];
|
|
5423
5326
|
/** Merge DXF text into the document (new layers, objects, layouts). */
|
|
@@ -5425,7 +5328,8 @@ declare class LocalDrawing implements Drawing$1 {
|
|
|
5425
5328
|
/** Merge DWG bytes into the document (wasm transcode → the DXF path). */
|
|
5426
5329
|
importDwgData(data: Uint8Array, opts?: DxfImportOptions): Promise<DxfImportReport>;
|
|
5427
5330
|
/** Merge a PDF: its vector/text content onto the current layer, or
|
|
5428
|
-
* (`as: "image"`) every page
|
|
5331
|
+
* (`as: "image"`) embedded, every page a raster reference at true page
|
|
5332
|
+
* scale. */
|
|
5429
5333
|
importPdfData(data: ArrayBuffer | Uint8Array, opts?: PdfImportOptions): Promise<PdfImportReport>;
|
|
5430
5334
|
/** Host capability: every PDF page rasterized. Absent → PDF-as-image
|
|
5431
5335
|
* import is refused (headless Node, until it has a rasterizer). */
|
|
@@ -5443,14 +5347,14 @@ declare class LocalDrawing implements Drawing$1 {
|
|
|
5443
5347
|
* unknown value is refused rather than stored dangling — a dangling
|
|
5444
5348
|
* reference renders with the first style and nothing says why. */
|
|
5445
5349
|
private styleRef;
|
|
5446
|
-
listTextStyles(): TextStyle[];
|
|
5447
|
-
listDimStyles(): DimStyle[];
|
|
5350
|
+
listTextStyles(): TextStyle$1[];
|
|
5351
|
+
listDimStyles(): DimStyle$1[];
|
|
5448
5352
|
/** Create a text style (unique name; unset fields take the defaults);
|
|
5449
5353
|
* returns its id. */
|
|
5450
5354
|
addTextStyle(props: {
|
|
5451
5355
|
name: string;
|
|
5452
|
-
} & Partial<Omit<TextStyle, "id">>): string;
|
|
5453
|
-
updateTextStyle(nameOrId: string, patch: Partial<Omit<TextStyle, "id">>): void;
|
|
5356
|
+
} & Partial<Omit<TextStyle$1, "id">>): string;
|
|
5357
|
+
updateTextStyle(nameOrId: string, patch: Partial<Omit<TextStyle$1, "id">>): void;
|
|
5454
5358
|
listLineTypes(): LineType[];
|
|
5455
5359
|
addLineTypes(lineTypes: readonly LineType[]): void;
|
|
5456
5360
|
updateLineType(name: string, patch: Partial<LineType>): void;
|
|
@@ -5465,21 +5369,17 @@ declare class LocalDrawing implements Drawing$1 {
|
|
|
5465
5369
|
* defaults); returns its id. */
|
|
5466
5370
|
addDimStyle(props: {
|
|
5467
5371
|
name: string;
|
|
5468
|
-
} & Partial<Omit<DimStyle, "id">>): string;
|
|
5469
|
-
updateDimStyle(nameOrId: string, patch: Partial<Omit<DimStyle, "id">>): void;
|
|
5372
|
+
} & Partial<Omit<DimStyle$1, "id">>): string;
|
|
5373
|
+
updateDimStyle(nameOrId: string, patch: Partial<Omit<DimStyle$1, "id">>): void;
|
|
5470
5374
|
/** Remove a dimension style no dimension uses (the kernel refuses
|
|
5471
5375
|
* otherwise). */
|
|
5472
5376
|
removeDimStyle(nameOrId: string): void;
|
|
5473
|
-
/** @deprecated Use updateDimStyle (default here: the first style). */
|
|
5474
|
-
setDimStyle(patch: Partial<DimStyle>, styleId?: string): void;
|
|
5475
5377
|
/** Replace the document's dimension styles (min 1; objects reference by
|
|
5476
5378
|
* 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;
|
|
5379
|
+
setDimStyles(styles: DimStyle$1[]): void;
|
|
5480
5380
|
/** Replace the document's text styles (min 1; objects reference by id).
|
|
5481
5381
|
* Diffed into granular per-style ops. */
|
|
5482
|
-
setTextStyles(styles: TextStyle[]): void;
|
|
5382
|
+
setTextStyles(styles: TextStyle$1[]): void;
|
|
5483
5383
|
private assertModuleSources;
|
|
5484
5384
|
/**
|
|
5485
5385
|
* Replace the block library (raw module sources — each exports its own
|
|
@@ -5538,7 +5438,7 @@ declare class LocalDrawing implements Drawing$1 {
|
|
|
5538
5438
|
* Add objects (points may be `[x, y]`; `layer` resolves by name) to model
|
|
5539
5439
|
* space, or to a paper layout's sheet via `{ layout }`. Returns ids.
|
|
5540
5440
|
*/
|
|
5541
|
-
add(objects: readonly
|
|
5441
|
+
add(objects: readonly ModelObjectInput[], opts?: AddOptions): string[];
|
|
5542
5442
|
private patched;
|
|
5543
5443
|
/** Apply one patch to several ids. */
|
|
5544
5444
|
update(ids: readonly string[], patch: Record<string, unknown>): void;
|
|
@@ -5591,12 +5491,12 @@ declare class LocalDrawing implements Drawing$1 {
|
|
|
5591
5491
|
private distanceTo;
|
|
5592
5492
|
/** Query model-space objects — or one paper layout's sheet objects
|
|
5593
5493
|
* (viewports, annotations) via `filter.layout`. */
|
|
5594
|
-
listObjects(filter?:
|
|
5494
|
+
listObjects(filter?: ObjectQuery): ModelObject[];
|
|
5595
5495
|
summary(): DocumentSummary;
|
|
5596
5496
|
protected paintContext(): {
|
|
5597
5497
|
layers: readonly Layer[];
|
|
5598
|
-
dimStyles: readonly DimStyle[];
|
|
5599
|
-
textStyles: readonly TextStyle[];
|
|
5498
|
+
dimStyles: readonly DimStyle$1[];
|
|
5499
|
+
textStyles: readonly TextStyle$1[];
|
|
5600
5500
|
lineTypes: readonly LineType[];
|
|
5601
5501
|
hatchPatterns: readonly DocumentHatchPattern[];
|
|
5602
5502
|
blockDefinitions: readonly string[];
|
|
@@ -5845,23 +5745,6 @@ declare class LocalDrawing implements Drawing$1 {
|
|
|
5845
5745
|
x: number;
|
|
5846
5746
|
y: number;
|
|
5847
5747
|
})[];
|
|
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: {
|
|
5859
|
-
x: number;
|
|
5860
|
-
y: number;
|
|
5861
|
-
};
|
|
5862
|
-
width: number;
|
|
5863
|
-
height: number;
|
|
5864
|
-
rotation: number;
|
|
5865
5748
|
} | {
|
|
5866
5749
|
id: string;
|
|
5867
5750
|
layerId: string;
|
|
@@ -5980,6 +5863,9 @@ declare class LocalDrawing implements Drawing$1 {
|
|
|
5980
5863
|
} | {
|
|
5981
5864
|
kind: "url";
|
|
5982
5865
|
url: string;
|
|
5866
|
+
} | {
|
|
5867
|
+
kind: "asset";
|
|
5868
|
+
assetId: string;
|
|
5983
5869
|
};
|
|
5984
5870
|
position: {
|
|
5985
5871
|
x: number;
|
|
@@ -6007,7 +5893,7 @@ declare class LocalDrawing implements Drawing$1 {
|
|
|
6007
5893
|
} | undefined;
|
|
6008
5894
|
})[];
|
|
6009
5895
|
resolveObject: (id: string) => ModelObject | undefined;
|
|
6010
|
-
resolveReference: (ref:
|
|
5896
|
+
resolveReference: (ref: Reference) => ReferenceContent | null;
|
|
6011
5897
|
};
|
|
6012
5898
|
protected resolveLayout(nameOrId: string): PaperLayout;
|
|
6013
5899
|
/** Render model space (or a paper layout via `layout`) to an SVG string. */
|
|
@@ -6016,23 +5902,374 @@ declare class LocalDrawing implements Drawing$1 {
|
|
|
6016
5902
|
toDxf(): Promise<string>;
|
|
6017
5903
|
/** Export the document to DWG bytes (the DXF content, wasm-transcoded).
|
|
6018
5904
|
* Defaults to AC1027 (AutoCAD 2013) — readable by every current CAD tool.
|
|
6019
|
-
* Dimensions transcode as real DIMENSION objects; leaders
|
|
6020
|
-
* plain geometry (
|
|
6021
|
-
*
|
|
5905
|
+
* Dimensions transcode as real DIMENSION objects; leaders and tables are
|
|
5906
|
+
* exploded to plain geometry (DWG_DXF_OPTIONS — the transcoder's DWG
|
|
5907
|
+
* output for them is not accepted by AutoCAD). */
|
|
6022
5908
|
toDwg(opts?: {
|
|
6023
5909
|
version?: DwgVersion;
|
|
6024
5910
|
}): Promise<Uint8Array>;
|
|
6025
5911
|
toLinea(): string;
|
|
6026
5912
|
}
|
|
6027
5913
|
|
|
5914
|
+
/** A 2D point (mm, y-up). Point-valued fields also accept [x, y]. */
|
|
5915
|
+
type Vec2 = {
|
|
5916
|
+
x: number;
|
|
5917
|
+
y: number;
|
|
5918
|
+
};
|
|
5919
|
+
type Vec2Like = Vec2 | readonly [number, number];
|
|
5920
|
+
/** An axis-aligned box (mm). */
|
|
5921
|
+
type Box = {
|
|
5922
|
+
minX: number;
|
|
5923
|
+
minY: number;
|
|
5924
|
+
maxX: number;
|
|
5925
|
+
maxY: number;
|
|
5926
|
+
};
|
|
5927
|
+
/** Arrowhead styles (leaders, dimensions). */
|
|
5928
|
+
type ArrowType = "filled" | "open" | "tick" | "dot" | "none";
|
|
5929
|
+
/** Polyline vertex; bulge = tan(sweep/4), 0 = straight. Accepts [x, y, bulge?]. */
|
|
5930
|
+
type PolylineVertexInput = {
|
|
5931
|
+
x: number;
|
|
5932
|
+
y: number;
|
|
5933
|
+
bulge?: number;
|
|
5934
|
+
} | readonly [number, number, number?];
|
|
5935
|
+
/** The fields every object input may carry: its layer and the style
|
|
5936
|
+
* overrides (otherwise by layer — or, for a block child, by the instance). */
|
|
5937
|
+
type ObjectInputBase = {
|
|
5938
|
+
/** The layer, by NAME or id. Absent: `document.add` uses the current
|
|
5939
|
+
* layer, a block child the instance's (the portable default; an unknown
|
|
5940
|
+
* name falls back to it too). A child on another layer hides with that
|
|
5941
|
+
* layer, while its color / line type / width still follow the instance
|
|
5942
|
+
* unless it sets its own (ByBlock, as in CAD). */
|
|
5943
|
+
layer?: string;
|
|
5944
|
+
/** The layer by id only — prefer `layer`. */
|
|
5945
|
+
layerId?: string;
|
|
5946
|
+
/** #rrggbb; absent = by layer. */
|
|
5947
|
+
color?: string;
|
|
5948
|
+
/** Line type; absent = by layer. */
|
|
5949
|
+
lineType?: string;
|
|
5950
|
+
/** Dash-pattern length multiplier; absent = 1. */
|
|
5951
|
+
lineTypeScale?: number;
|
|
5952
|
+
/** Line weight in mm; absent = by layer. */
|
|
5953
|
+
lineWidth?: number;
|
|
5954
|
+
/** Paint opacity 0..1; absent = by layer (opaque unless the layer says). */
|
|
5955
|
+
opacity?: number;
|
|
5956
|
+
};
|
|
5957
|
+
/**
|
|
5958
|
+
* T plus the shared input fields, FLATTENED (the homomorphic map forces the
|
|
5959
|
+
* intersection to resolve): hovers then list every member inline instead of
|
|
5960
|
+
* the opaque `ObjectInputBase & { … }` — the block editor has no
|
|
5961
|
+
* expand-type affordance, so the alias display is all a script author gets.
|
|
5962
|
+
*/
|
|
5963
|
+
type ObjectInputShape<T> = {
|
|
5964
|
+
[K in keyof (T & ObjectInputBase)]: (T & ObjectInputBase)[K];
|
|
5965
|
+
} & {};
|
|
5966
|
+
type LineInput = ObjectInputShape<{
|
|
5967
|
+
type: "line";
|
|
5968
|
+
a: Vec2Like;
|
|
5969
|
+
b: Vec2Like;
|
|
5970
|
+
}>;
|
|
5971
|
+
/** A point: paints as a round dot whose diameter is the lineWidth. */
|
|
5972
|
+
type PointInput$1 = ObjectInputShape<{
|
|
5973
|
+
type: "point";
|
|
5974
|
+
p: Vec2Like;
|
|
5975
|
+
}>;
|
|
5976
|
+
type PolylineInput = ObjectInputShape<{
|
|
5977
|
+
type: "polyline";
|
|
5978
|
+
/** At least 2 vertices. */
|
|
5979
|
+
points: readonly PolylineVertexInput[];
|
|
5980
|
+
closed?: boolean;
|
|
5981
|
+
}>;
|
|
5982
|
+
type CircleInput = ObjectInputShape<{
|
|
5983
|
+
type: "circle";
|
|
5984
|
+
center: Vec2Like;
|
|
5985
|
+
radius: number;
|
|
5986
|
+
}>;
|
|
5987
|
+
/** Runs CCW from startAngle to endAngle (radians; DXF ARC convention). */
|
|
5988
|
+
type ArcInput = ObjectInputShape<{
|
|
5989
|
+
type: "arc";
|
|
5990
|
+
center: Vec2Like;
|
|
5991
|
+
radius: number;
|
|
5992
|
+
startAngle: number;
|
|
5993
|
+
endAngle: number;
|
|
5994
|
+
}>;
|
|
5995
|
+
/** majorAxis = endpoint vector from center; ratio = minor/major in (0, 1]. */
|
|
5996
|
+
type EllipseInput = ObjectInputShape<{
|
|
5997
|
+
type: "ellipse";
|
|
5998
|
+
center: Vec2Like;
|
|
5999
|
+
majorAxis: Vec2Like;
|
|
6000
|
+
ratio: number;
|
|
6001
|
+
startAngle?: number;
|
|
6002
|
+
endAngle?: number;
|
|
6003
|
+
}>;
|
|
6004
|
+
type HatchInput = ObjectInputShape<{
|
|
6005
|
+
type: "hatch";
|
|
6006
|
+
/** loops[0] = outer boundary, the rest are holes (even-odd). */
|
|
6007
|
+
loops: readonly {
|
|
6008
|
+
points: readonly PolylineVertexInput[];
|
|
6009
|
+
}[];
|
|
6010
|
+
fill?: {
|
|
6011
|
+
kind: "solid";
|
|
6012
|
+
}
|
|
6013
|
+
/** A named pattern: the built-in catalogue (ANSI31, AR-CONC, …) or one of
|
|
6014
|
+
* the document's own hatch patterns, by name. `angle` radians, `scale`
|
|
6015
|
+
* multiplies the definition's mm; `origin` anchors the pattern frame
|
|
6016
|
+
* (block-local mm; absent = the block origin). */
|
|
6017
|
+
| {
|
|
6018
|
+
kind: "pattern";
|
|
6019
|
+
name: string;
|
|
6020
|
+
angle: number;
|
|
6021
|
+
scale: number;
|
|
6022
|
+
origin?: Vec2Like;
|
|
6023
|
+
} | {
|
|
6024
|
+
kind: "lines";
|
|
6025
|
+
angle: number;
|
|
6026
|
+
spacing: number;
|
|
6027
|
+
} | {
|
|
6028
|
+
kind: "gradient";
|
|
6029
|
+
shape?: "linear" | "radial";
|
|
6030
|
+
color1?: string;
|
|
6031
|
+
color2?: string;
|
|
6032
|
+
angle?: number;
|
|
6033
|
+
};
|
|
6034
|
+
/** Pattern spacing multiplier. */
|
|
6035
|
+
scale?: number;
|
|
6036
|
+
}>;
|
|
6037
|
+
/** Character formatting over [start, end) of a text's `content` (JS string
|
|
6038
|
+
* indices). Absent attributes inherit the text's style; `height` is a ratio
|
|
6039
|
+
* of its cap height. Setting `content` without `spans` drops old spans. */
|
|
6040
|
+
type TextSpan = {
|
|
6041
|
+
start: number;
|
|
6042
|
+
end: number;
|
|
6043
|
+
font?: string;
|
|
6044
|
+
bold?: boolean;
|
|
6045
|
+
italic?: boolean;
|
|
6046
|
+
underline?: boolean;
|
|
6047
|
+
/** "#rrggbb". */
|
|
6048
|
+
color?: string;
|
|
6049
|
+
height?: number;
|
|
6050
|
+
script?: "sub" | "super";
|
|
6051
|
+
};
|
|
6052
|
+
type TextInput = ObjectInputShape<{
|
|
6053
|
+
type: "text";
|
|
6054
|
+
position: Vec2Like;
|
|
6055
|
+
content: string;
|
|
6056
|
+
spans?: readonly TextSpan[];
|
|
6057
|
+
rotation?: number;
|
|
6058
|
+
/** Justification, as in AutoCAD / DXF: which edge sits on the point —
|
|
6059
|
+
* "left" = the text runs right of it, "right" = left of it; vAlign
|
|
6060
|
+
* "bottom" = the text sits above the point, "top" = below it. */
|
|
6061
|
+
hAlign?: "left" | "center" | "right";
|
|
6062
|
+
vAlign?: "bottom" | "center" | "top";
|
|
6063
|
+
/** Word-wrap / frame width in mm (before `scale`); absent = no wrapping. */
|
|
6064
|
+
width?: number;
|
|
6065
|
+
frame?: "none" | "rectangle" | "circle" | "slot" | "bottom" | "firstLine";
|
|
6066
|
+
/** MLEADER-style arrow polylines pointing at the text (arrowhead at [0]). */
|
|
6067
|
+
leaderLines?: readonly (readonly Vec2Like[])[];
|
|
6068
|
+
/** The document text style to follow (name or id); absent = the first. */
|
|
6069
|
+
styleId?: string;
|
|
6070
|
+
/** Style overrides; absent keys inherit the document text style. */
|
|
6071
|
+
styleOverride?: TextStyleOverride;
|
|
6072
|
+
/** Size multiplier for height + arrow size. */
|
|
6073
|
+
scale?: number;
|
|
6074
|
+
}>;
|
|
6075
|
+
type DimensionInput = ObjectInputShape<{
|
|
6076
|
+
type: "dimension";
|
|
6077
|
+
kind?: "linear" | "angular" | "radial" | "diameter";
|
|
6078
|
+
/** linear: 2+ chained points (measured point to point); angular: [vertex, a, b]; radial: [center, p]; diameter: [p1, p2]. */
|
|
6079
|
+
points: readonly Vec2Like[];
|
|
6080
|
+
/** linear only: the measuring direction, radians CCW from +X. Unset =
|
|
6081
|
+
* aligned to the points. */
|
|
6082
|
+
rotation?: number;
|
|
6083
|
+
/** linear: signed distance of the dimension line from points[0], positive
|
|
6084
|
+
* to the LEFT of the measuring direction; angular: signed arc radius
|
|
6085
|
+
* (negative = the complementary arc). Not for radial/diameter. */
|
|
6086
|
+
offset?: number;
|
|
6087
|
+
/** One per measured segment (linear chain: points.length − 1, others: 1).
|
|
6088
|
+
* `along` (mm along the line from the segment origin — radial/diameter:
|
|
6089
|
+
* from the center) and `across` (mm off the line) place the text, unset =
|
|
6090
|
+
* automatic; `content` is the text, `{value}` = the measurement. */
|
|
6091
|
+
labels?: readonly {
|
|
6092
|
+
along?: number;
|
|
6093
|
+
across?: number;
|
|
6094
|
+
content?: string;
|
|
6095
|
+
/** Formatting over `content` (spans covering `{value}` format it). */
|
|
6096
|
+
spans?: readonly TextSpan[];
|
|
6097
|
+
}[];
|
|
6098
|
+
/** The document dimension style to follow (name or id); absent = the first. */
|
|
6099
|
+
styleId?: string;
|
|
6100
|
+
/** Style overrides; absent keys inherit the document dimension style. */
|
|
6101
|
+
styleOverride?: DimStyleOverride;
|
|
6102
|
+
/** Annotation size multiplier (text/arrows/offsets). */
|
|
6103
|
+
scale?: number;
|
|
6104
|
+
}>;
|
|
6105
|
+
/** Nested block instance (inputs may hold points, never object references). */
|
|
6106
|
+
type BlockInput = ObjectInputShape<{
|
|
6107
|
+
type: "block";
|
|
6108
|
+
definitionId: string;
|
|
6109
|
+
/** Applied last, about the pivot (the first input point). */
|
|
6110
|
+
rotation?: number;
|
|
6111
|
+
scale?: number;
|
|
6112
|
+
params?: Record<string, number | string | boolean | readonly number[] | readonly string[]>;
|
|
6113
|
+
/** Input points in the PARENT's local coords; the first is the pivot. */
|
|
6114
|
+
inputs?: readonly Vec2Like[];
|
|
6115
|
+
}>;
|
|
6116
|
+
/** A table cell: plain text, or text with merge / alignment / style. */
|
|
6117
|
+
type TableCellInput = string | {
|
|
6118
|
+
content?: string;
|
|
6119
|
+
/** Character formatting over `content`. */
|
|
6120
|
+
spans?: readonly TextSpan[];
|
|
6121
|
+
/** Merge from this (top-left) cell; covered cells are ignored. */
|
|
6122
|
+
span?: {
|
|
6123
|
+
cols: number;
|
|
6124
|
+
rows: number;
|
|
6125
|
+
};
|
|
6126
|
+
hAlign?: "left" | "center" | "right";
|
|
6127
|
+
vAlign?: "top" | "center" | "bottom";
|
|
6128
|
+
styleId?: string;
|
|
6129
|
+
styleOverride?: TextStyleOverride;
|
|
6130
|
+
color?: string;
|
|
6131
|
+
};
|
|
6132
|
+
/** Grid of text cells hanging right/down from `position` (top-left);
|
|
6133
|
+
* rows grow to fit their wrapped text. */
|
|
6134
|
+
type TableInput = ObjectInputShape<{
|
|
6135
|
+
type: "table";
|
|
6136
|
+
position: Vec2Like;
|
|
6137
|
+
/** Column widths (mm, before `scale`). */
|
|
6138
|
+
columns: readonly number[];
|
|
6139
|
+
/** Row count, or per-row settings (`minHeight` mm floor). */
|
|
6140
|
+
rows: number | readonly {
|
|
6141
|
+
minHeight?: number;
|
|
6142
|
+
}[];
|
|
6143
|
+
/** Row-major `cells[row][column]`, exactly rows × columns. */
|
|
6144
|
+
cells: readonly (readonly TableCellInput[])[];
|
|
6145
|
+
rotation?: number;
|
|
6146
|
+
scale?: number;
|
|
6147
|
+
/** Rows above the heavier header rule. */
|
|
6148
|
+
headerRows?: number;
|
|
6149
|
+
/** Text inset from the cell edges (mm). */
|
|
6150
|
+
cellMargin?: number;
|
|
6151
|
+
borders?: "all" | "outer" | "rows" | "none";
|
|
6152
|
+
styleId?: string;
|
|
6153
|
+
styleOverride?: TextStyleOverride;
|
|
6154
|
+
}>;
|
|
6155
|
+
/** Where a reference's file lives: a path (relative to the drawing's
|
|
6156
|
+
* folder), a url, or EMBEDDED — an asset of the document holding it (add the
|
|
6157
|
+
* file's bytes first with `document.addAsset`). */
|
|
6158
|
+
type ReferenceSource = {
|
|
6159
|
+
kind: "path";
|
|
6160
|
+
path: string;
|
|
6161
|
+
cacheKey?: string;
|
|
6162
|
+
} | {
|
|
6163
|
+
kind: "url";
|
|
6164
|
+
url: string;
|
|
6165
|
+
} | {
|
|
6166
|
+
kind: "asset";
|
|
6167
|
+
assetId: string;
|
|
6168
|
+
};
|
|
6169
|
+
/** A file drawn in place — a .linea, DXF, DWG, PDF page or picture (PNG /
|
|
6170
|
+
* JPEG). The file's origin lands at `position`; a picture draws at its
|
|
6171
|
+
* natural size (96 dpi) times `scale`. */
|
|
6172
|
+
type ReferenceInput = ObjectInputShape<{
|
|
6173
|
+
type: "reference";
|
|
6174
|
+
format: "linea" | "dxf" | "dwg" | "pdf" | "png" | "jpg";
|
|
6175
|
+
name: string;
|
|
6176
|
+
source: ReferenceSource;
|
|
6177
|
+
position: Vec2Like;
|
|
6178
|
+
/** Radians CCW about `position`. */
|
|
6179
|
+
rotation?: number;
|
|
6180
|
+
scale?: number;
|
|
6181
|
+
/** Flipped left-right (x → −x) before the rotation. */
|
|
6182
|
+
mirrored?: boolean;
|
|
6183
|
+
/** PDF: the 1-based page, drawn as vectors or rasterized. */
|
|
6184
|
+
pdfPage?: number;
|
|
6185
|
+
pdfMode?: "vector" | "raster";
|
|
6186
|
+
/** The file's layers not drawn, by name. */
|
|
6187
|
+
hiddenLayers?: readonly string[];
|
|
6188
|
+
hidden?: boolean;
|
|
6189
|
+
locked?: boolean;
|
|
6190
|
+
/** Crop rectangle in file coordinates. */
|
|
6191
|
+
clip?: Box;
|
|
6192
|
+
/** Content bounds in file coordinates (the frame drawn before it loads). */
|
|
6193
|
+
extent?: Box;
|
|
6194
|
+
}>;
|
|
6195
|
+
/** Paper-space window into model space; only in a layout (`document.add`
|
|
6196
|
+
* with `layout`). */
|
|
6197
|
+
type ViewportInput = ObjectInputShape<{
|
|
6198
|
+
type: "viewport";
|
|
6199
|
+
/** The frame on the sheet (mm): bottom-left corner + size. */
|
|
6200
|
+
rect: {
|
|
6201
|
+
x: number;
|
|
6202
|
+
y: number;
|
|
6203
|
+
w: number;
|
|
6204
|
+
h: number;
|
|
6205
|
+
};
|
|
6206
|
+
/** The model point shown at the frame's centre. */
|
|
6207
|
+
modelCenter?: Vec2Like;
|
|
6208
|
+
/** Drawing-scale denominator (model mm per paper mm); 1:50 => 50. */
|
|
6209
|
+
scale?: number;
|
|
6210
|
+
/** Pinned: no pan/zoom-through, no move/resize grips. */
|
|
6211
|
+
locked?: boolean;
|
|
6212
|
+
/** Layer ids hidden in this viewport only. */
|
|
6213
|
+
hiddenLayerIds?: readonly string[];
|
|
6214
|
+
}>;
|
|
6215
|
+
/** Review note pinned to a point; the editor shows a screen-fixed marker. */
|
|
6216
|
+
type CommentInput = ObjectInputShape<{
|
|
6217
|
+
type: "comment";
|
|
6218
|
+
/** Tail tip of the bubble (world/sheet mm). */
|
|
6219
|
+
position: Vec2Like;
|
|
6220
|
+
text?: string;
|
|
6221
|
+
tags?: readonly string[];
|
|
6222
|
+
}>;
|
|
6223
|
+
/** What a script WRITES — the union of the authoring DTOs above (what
|
|
6224
|
+
* `document.add` takes). Reads return `ModelObject`. */
|
|
6225
|
+
type ModelObjectInput$1 = LineInput | PointInput$1 | PolylineInput | CircleInput | ArcInput | EllipseInput | HatchInput | TextInput | DimensionInput | BlockInput | TableInput | ViewportInput | CommentInput | ReferenceInput;
|
|
6226
|
+
/** Text style keys a text, table or table cell may override. */
|
|
6227
|
+
type TextStyleOverride = Partial<Omit<TextStyle, "id" | "name">>;
|
|
6228
|
+
/** Dimension style keys a dimension may override. */
|
|
6229
|
+
type DimStyleOverride = Partial<Omit<DimStyle, "id" | "name">>;
|
|
6230
|
+
/** A document text style (`styles.text(id)` in `draw`,
|
|
6231
|
+
* `document.listTextStyles()`). Heights and arrow sizes are mm before an
|
|
6232
|
+
* object's `scale`. */
|
|
6233
|
+
type TextStyle = {
|
|
6234
|
+
readonly id: string;
|
|
6235
|
+
readonly name: string;
|
|
6236
|
+
readonly font: string;
|
|
6237
|
+
readonly widthFactor: number;
|
|
6238
|
+
readonly bold?: boolean;
|
|
6239
|
+
readonly italic?: boolean;
|
|
6240
|
+
readonly textHeight: number;
|
|
6241
|
+
readonly arrowType: ArrowType;
|
|
6242
|
+
readonly arrowSize: number;
|
|
6243
|
+
};
|
|
6244
|
+
/** A document dimension style (`styles.dim(id)`,
|
|
6245
|
+
* `document.listDimStyles()`). */
|
|
6246
|
+
type DimStyle = {
|
|
6247
|
+
readonly id: string;
|
|
6248
|
+
readonly name: string;
|
|
6249
|
+
readonly font: string;
|
|
6250
|
+
readonly widthFactor: number;
|
|
6251
|
+
readonly bold?: boolean;
|
|
6252
|
+
readonly italic?: boolean;
|
|
6253
|
+
readonly textHeight: number;
|
|
6254
|
+
readonly textOffset: number;
|
|
6255
|
+
readonly arrowType: ArrowType;
|
|
6256
|
+
readonly arrowSize: number;
|
|
6257
|
+
/** "short" = a 2×overshoot tick across the dimension line. */
|
|
6258
|
+
readonly extensionType: "long" | "short";
|
|
6259
|
+
readonly extensionOffset: number;
|
|
6260
|
+
readonly extensionOvershoot: number;
|
|
6261
|
+
readonly precision: number;
|
|
6262
|
+
};
|
|
6263
|
+
|
|
6028
6264
|
/** A world point in mm, as `[x, y]` or `{x, y}`. */
|
|
6029
|
-
type PointInput = Vec2 | readonly [number, number];
|
|
6030
|
-
/**
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6265
|
+
type PointInput = Vec2$1 | readonly [number, number];
|
|
6266
|
+
/** Object input: the typed authoring DTOs (per-type fields, so editors
|
|
6267
|
+
* autocomplete them; `layer` by name or id) + an optional own `id`. */
|
|
6268
|
+
type ModelObjectInput = ModelObjectInput$1 & {
|
|
6269
|
+
id?: string;
|
|
6270
|
+
};
|
|
6034
6271
|
/** Semantic, filtered read over one space's objects (all filters AND). */
|
|
6035
|
-
interface
|
|
6272
|
+
interface ObjectQuery {
|
|
6036
6273
|
ids?: readonly string[];
|
|
6037
6274
|
type?: ModelObjectType;
|
|
6038
6275
|
/** Layer name or id. */
|
|
@@ -6162,7 +6399,7 @@ interface Drawing$1 {
|
|
|
6162
6399
|
readonly document: LineaDocument;
|
|
6163
6400
|
summary(): DocumentSummary;
|
|
6164
6401
|
/** Filtered objects — model space, or one layout via `filter.layout`. */
|
|
6165
|
-
listObjects(filter?:
|
|
6402
|
+
listObjects(filter?: ObjectQuery): ModelObject[];
|
|
6166
6403
|
/** Look up an object in ANY space. */
|
|
6167
6404
|
getObject(id: string): ModelObject | undefined;
|
|
6168
6405
|
/** bbox / curve length / enclosed area of one object (any space). */
|
|
@@ -6190,7 +6427,7 @@ interface Drawing$1 {
|
|
|
6190
6427
|
toLinea(): string;
|
|
6191
6428
|
/** Add objects (points may be `[x, y]`; `layer` resolves by name);
|
|
6192
6429
|
* returns the created ids. */
|
|
6193
|
-
add(objects: readonly
|
|
6430
|
+
add(objects: readonly ModelObjectInput[], opts?: AddOptions): string[];
|
|
6194
6431
|
/** Apply per-object patches (`{id, ...fields}`) in one undo step. */
|
|
6195
6432
|
update(entries: readonly ({
|
|
6196
6433
|
id: string;
|
|
@@ -6228,25 +6465,21 @@ interface Drawing$1 {
|
|
|
6228
6465
|
/** Document-wide settings, merged over the current record (`units` is
|
|
6229
6466
|
* declarative for now: everything is stored in mm). */
|
|
6230
6467
|
updateSettings(patch: Partial<LineaDocument["settings"]>): void;
|
|
6231
|
-
listTextStyles(): TextStyle[];
|
|
6232
|
-
listDimStyles(): DimStyle[];
|
|
6468
|
+
listTextStyles(): TextStyle$1[];
|
|
6469
|
+
listDimStyles(): DimStyle$1[];
|
|
6233
6470
|
/** Create a style (name unique, case-insensitive; unset fields take the
|
|
6234
6471
|
* defaults); returns its id. Styles are addressed by name or id. */
|
|
6235
6472
|
addTextStyle(props: {
|
|
6236
6473
|
name: string;
|
|
6237
|
-
} & Partial<Omit<TextStyle, "id">>): string;
|
|
6238
|
-
updateTextStyle(nameOrId: string, patch: Partial<Omit<TextStyle, "id">>): void;
|
|
6474
|
+
} & Partial<Omit<TextStyle$1, "id">>): string;
|
|
6475
|
+
updateTextStyle(nameOrId: string, patch: Partial<Omit<TextStyle$1, "id">>): void;
|
|
6239
6476
|
/** Remove a style no object resolves to (else refused, with a count). */
|
|
6240
6477
|
removeTextStyle(nameOrId: string): void;
|
|
6241
6478
|
addDimStyle(props: {
|
|
6242
6479
|
name: string;
|
|
6243
|
-
} & Partial<Omit<DimStyle, "id">>): string;
|
|
6244
|
-
updateDimStyle(nameOrId: string, patch: Partial<Omit<DimStyle, "id">>): void;
|
|
6480
|
+
} & Partial<Omit<DimStyle$1, "id">>): string;
|
|
6481
|
+
updateDimStyle(nameOrId: string, patch: Partial<Omit<DimStyle$1, "id">>): void;
|
|
6245
6482
|
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
6483
|
/** The document's own line type definitions (name-keyed; objects and
|
|
6251
6484
|
* layers reference line types by NAME, these ahead of the built-in
|
|
6252
6485
|
* catalogue). */
|
|
@@ -6265,18 +6498,19 @@ interface Drawing$1 {
|
|
|
6265
6498
|
addHatchPatterns(patterns: readonly DocumentHatchPattern[]): void;
|
|
6266
6499
|
updateHatchPattern(name: string, patch: Partial<DocumentHatchPattern>): void;
|
|
6267
6500
|
removeHatchPattern(name: string): void;
|
|
6268
|
-
/** Embed
|
|
6501
|
+
/** Embed a file (a data URL); returns the content-keyed assetId an
|
|
6502
|
+
* embedded reference's `source: { kind: "asset", assetId }` names. */
|
|
6269
6503
|
addAsset(dataUrl: string): string;
|
|
6270
|
-
/** Remove an asset (refused while
|
|
6504
|
+
/** Remove an asset (refused while a reference embeds it). */
|
|
6271
6505
|
removeAsset(id: string): void;
|
|
6272
|
-
/** Embedded
|
|
6506
|
+
/** Embedded files: id, mime type, bytes, how many references embed it. */
|
|
6273
6507
|
listAssets(): AssetInfo[];
|
|
6274
6508
|
/** DXF text → new layers, objects, layouts. */
|
|
6275
6509
|
importDxfText(text: string, opts?: DxfImportOptions): DxfImportReport;
|
|
6276
6510
|
/** DWG bytes (wasm transcode → the DXF path). */
|
|
6277
6511
|
importDwgData(data: Uint8Array, opts?: DxfImportOptions): Promise<DxfImportReport>;
|
|
6278
6512
|
/** PDF vectors/text onto the current layer, or (`as: "image"`, a host
|
|
6279
|
-
* capability) every page
|
|
6513
|
+
* capability) embedded, every page a raster reference at true scale. */
|
|
6280
6514
|
importPdfData(data: ArrayBuffer | Uint8Array, opts?: PdfImportOptions): Promise<PdfImportReport>;
|
|
6281
6515
|
/** Merge block module sources into the document library (verbatim →
|
|
6282
6516
|
* skip, same id → replace in place, name clash → suffix). Async: awaits
|
|
@@ -6324,7 +6558,7 @@ interface EditorSurface {
|
|
|
6324
6558
|
setSelection(ids: readonly string[]): void;
|
|
6325
6559
|
zoom(to: ZoomTarget): void;
|
|
6326
6560
|
/** Await one snapped world point; rejects when the user cancels. */
|
|
6327
|
-
pickPoint(opts?: PickPointOptions): Promise<Vec2>;
|
|
6561
|
+
pickPoint(opts?: PickPointOptions): Promise<Vec2$1>;
|
|
6328
6562
|
/** Await one object click; resolves the object's id. */
|
|
6329
6563
|
pickObject(opts?: {
|
|
6330
6564
|
label?: string;
|
|
@@ -6390,8 +6624,9 @@ declare class Drawing extends LocalDrawing {
|
|
|
6390
6624
|
* that can't be read stays a frame. */
|
|
6391
6625
|
ready(): Promise<void>;
|
|
6392
6626
|
/** One reference's content (null when unreadable); a .linea's own
|
|
6393
|
-
* references load relative to it —
|
|
6394
|
-
* file above in the chain (the
|
|
6627
|
+
* references load relative to it — and its embedded ones from ITS assets —
|
|
6628
|
+
* depth-limited, never re-entering a file above in the chain (the
|
|
6629
|
+
* editor's rules). */
|
|
6395
6630
|
private loadReference;
|
|
6396
6631
|
private readSource;
|
|
6397
6632
|
/** Rasterize model space (or a paper layout via `layout`) to PNG bytes
|
|
@@ -6433,4 +6668,4 @@ declare function drawingFromJson(text: string): Drawing;
|
|
|
6433
6668
|
/** Open a `.linea` file (parse + migrate) into an in-process kernel. */
|
|
6434
6669
|
declare function openDrawing(path: string, options?: DrawingOptions): Promise<Drawing>;
|
|
6435
6670
|
|
|
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
|
|
6671
|
+
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 };
|