lineadraw 0.12.0 → 0.13.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/{chunk-7CKYA7RK.js → chunk-42IZLGZG.js} +119 -97
- package/dist/chunk-42IZLGZG.js.map +1 -0
- package/dist/{chunk-LWE26W45.js → chunk-SPTLQMJW.js} +83 -77
- package/dist/chunk-SPTLQMJW.js.map +1 -0
- package/dist/{exportDxf-HWJCUKNQ.js → exportDxf-NLNAJFM6.js} +2 -2
- package/dist/helpers.js +46 -0
- package/dist/helpers.js.map +1 -0
- package/dist/sdk.d.ts +7 -12
- package/dist/sdk.js +7 -3
- package/dist/sdk.js.map +1 -1
- package/dist/tools.d.ts +12 -3
- package/dist/tools.js +147 -140
- package/dist/tools.js.map +1 -1
- package/dist/{types.d-DK_ww49C.d.ts → types.d-BEXwtrOf.d.ts} +45 -22
- package/lineadraw.d.ts +9 -0
- package/package.json +4 -2
- package/dist/chunk-7CKYA7RK.js.map +0 -1
- package/dist/chunk-LWE26W45.js.map +0 -1
- /package/dist/{exportDxf-HWJCUKNQ.js.map → exportDxf-NLNAJFM6.js.map} +0 -0
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
cleanRichText,
|
|
46
46
|
cleanText,
|
|
47
47
|
closestPointOnSegment,
|
|
48
|
+
compiledModules,
|
|
48
49
|
computeHatchLines,
|
|
49
50
|
computePatternGeometry,
|
|
50
51
|
curveTolerance,
|
|
@@ -67,7 +68,6 @@ import {
|
|
|
67
68
|
emitLoopPath,
|
|
68
69
|
ensureScriptTranspiler,
|
|
69
70
|
estimatePatternSegments,
|
|
70
|
-
executeScriptModule,
|
|
71
71
|
expandBlockChildren,
|
|
72
72
|
expandWithBlockDependents,
|
|
73
73
|
findBlockScript,
|
|
@@ -108,12 +108,12 @@ import {
|
|
|
108
108
|
mid,
|
|
109
109
|
migrateDocument,
|
|
110
110
|
mirrorObject,
|
|
111
|
+
moduleMetaResult,
|
|
111
112
|
mtextFontFlags,
|
|
112
113
|
mtextWidthFactor,
|
|
113
114
|
normAngle,
|
|
114
115
|
normalizeSpans,
|
|
115
116
|
nurbsToBeziers,
|
|
116
|
-
onSandboxReset,
|
|
117
117
|
paintArrowhead,
|
|
118
118
|
paramMismatch,
|
|
119
119
|
parseFontFace,
|
|
@@ -122,7 +122,6 @@ import {
|
|
|
122
122
|
perp,
|
|
123
123
|
pointOnArc,
|
|
124
124
|
realFace,
|
|
125
|
-
releaseScriptModule,
|
|
126
125
|
remapBlockInputRefs,
|
|
127
126
|
renderDashes,
|
|
128
127
|
resolveDocumentObject,
|
|
@@ -136,7 +135,6 @@ import {
|
|
|
136
135
|
scale,
|
|
137
136
|
scaleObjectUniform,
|
|
138
137
|
scanScriptId,
|
|
139
|
-
scriptTranspilerReady,
|
|
140
138
|
selectionFits,
|
|
141
139
|
signedArcSweep,
|
|
142
140
|
sub,
|
|
@@ -155,7 +153,7 @@ import {
|
|
|
155
153
|
valueParams,
|
|
156
154
|
verticesToLoop,
|
|
157
155
|
withEmptyLists
|
|
158
|
-
} from "./chunk-
|
|
156
|
+
} from "./chunk-SPTLQMJW.js";
|
|
159
157
|
|
|
160
158
|
// ../core/src/model/scale.ts
|
|
161
159
|
var parseScale = (scale2) => {
|
|
@@ -1712,8 +1710,8 @@ var referenceEntry = (obj, ctx) => {
|
|
|
1712
1710
|
const flip = obj.mirrored ? -1 : 1;
|
|
1713
1711
|
const ang = (t) => normAngle((flip < 0 ? Math.PI - t : t) + obj.rotation);
|
|
1714
1712
|
const linear = (v) => {
|
|
1715
|
-
const o =
|
|
1716
|
-
const p =
|
|
1713
|
+
const o = matApply(m, { x: 0, y: 0 });
|
|
1714
|
+
const p = matApply(m, v);
|
|
1717
1715
|
return { x: p.x - o.x, y: p.y - o.y };
|
|
1718
1716
|
};
|
|
1719
1717
|
const childCtx = {
|
|
@@ -1737,13 +1735,13 @@ var referenceEntry = (obj, ctx) => {
|
|
|
1737
1735
|
const curveInClip = (c, r) => !clip || c.x - r >= clip.minX && c.x + r <= clip.maxX && c.y - r >= clip.minY && c.y + r <= clip.maxY;
|
|
1738
1736
|
const add2 = (e) => {
|
|
1739
1737
|
for (const sp of e.points)
|
|
1740
|
-
if (inClip(sp.p)) points.push({ p:
|
|
1738
|
+
if (inClip(sp.p)) points.push({ p: matApply(m, sp.p), type: sp.type });
|
|
1741
1739
|
for (const seg of e.segments) {
|
|
1742
1740
|
const kept = clip ? clipSegment(seg.a, seg.b, clip) : [seg.a, seg.b];
|
|
1743
1741
|
if (kept)
|
|
1744
1742
|
segments.push({
|
|
1745
|
-
a:
|
|
1746
|
-
b:
|
|
1743
|
+
a: matApply(m, kept[0]),
|
|
1744
|
+
b: matApply(m, kept[1]),
|
|
1747
1745
|
chord: seg.chord,
|
|
1748
1746
|
facet: seg.facet
|
|
1749
1747
|
});
|
|
@@ -1752,7 +1750,7 @@ var referenceEntry = (obj, ctx) => {
|
|
|
1752
1750
|
if (!curveInClip(a.center, a.radius)) continue;
|
|
1753
1751
|
const [start, end] = flip < 0 ? [a.endAngle, a.startAngle] : [a.startAngle, a.endAngle];
|
|
1754
1752
|
arcs.push({
|
|
1755
|
-
center:
|
|
1753
|
+
center: matApply(m, a.center),
|
|
1756
1754
|
radius: a.radius * s,
|
|
1757
1755
|
startAngle: ang(start),
|
|
1758
1756
|
endAngle: ang(end)
|
|
@@ -1763,7 +1761,7 @@ var referenceEntry = (obj, ctx) => {
|
|
|
1763
1761
|
continue;
|
|
1764
1762
|
const [start, end] = flip < 0 ? [-el.endAngle, -el.startAngle] : [el.startAngle, el.endAngle];
|
|
1765
1763
|
ellipses.push({
|
|
1766
|
-
center:
|
|
1764
|
+
center: matApply(m, el.center),
|
|
1767
1765
|
majorAxis: linear(el.majorAxis),
|
|
1768
1766
|
ratio: el.ratio,
|
|
1769
1767
|
startAngle: normAngle(start),
|
|
@@ -2929,6 +2927,17 @@ var parseMlineStyles = (source) => {
|
|
|
2929
2927
|
return { byHandle, byName };
|
|
2930
2928
|
};
|
|
2931
2929
|
|
|
2930
|
+
// ../core/src/reference/formats.ts
|
|
2931
|
+
var referenceFormatOf = (fileName) => {
|
|
2932
|
+
const ext = /\.([^./\\]+)$/.exec(fileName)?.[1]?.toLowerCase();
|
|
2933
|
+
if (ext === "jpeg") return "jpg";
|
|
2934
|
+
if (ext === "lineadraw") return "linea";
|
|
2935
|
+
return REFERENCE_FORMATS.find((f) => f === ext) ?? null;
|
|
2936
|
+
};
|
|
2937
|
+
var REFERENCE_ACCEPT = REFERENCE_FORMATS.flatMap(
|
|
2938
|
+
(f) => f === "jpg" ? [".jpg", ".jpeg"] : f === "linea" ? [".linea", ".lineadraw"] : [`.${f}`]
|
|
2939
|
+
).join(",");
|
|
2940
|
+
|
|
2932
2941
|
// ../core/src/import/dxf/importDxf.ts
|
|
2933
2942
|
var DEG2RAD = Math.PI / 180;
|
|
2934
2943
|
var VIEWPORT_OFF_FLAG = 131072;
|
|
@@ -4727,17 +4736,6 @@ var dxfToModel = (text, input) => {
|
|
|
4727
4736
|
};
|
|
4728
4737
|
};
|
|
4729
4738
|
|
|
4730
|
-
// ../core/src/reference/formats.ts
|
|
4731
|
-
var referenceFormatOf = (fileName) => {
|
|
4732
|
-
const ext = /\.([^./\\]+)$/.exec(fileName)?.[1]?.toLowerCase();
|
|
4733
|
-
if (ext === "jpeg") return "jpg";
|
|
4734
|
-
if (ext === "lineadraw") return "linea";
|
|
4735
|
-
return REFERENCE_FORMATS.find((f) => f === ext) ?? null;
|
|
4736
|
-
};
|
|
4737
|
-
var REFERENCE_ACCEPT = REFERENCE_FORMATS.flatMap(
|
|
4738
|
-
(f) => f === "jpg" ? [".jpg", ".jpeg"] : f === "linea" ? [".linea", ".lineadraw"] : [`.${f}`]
|
|
4739
|
-
).join(",");
|
|
4740
|
-
|
|
4741
4739
|
// ../core/src/reference/reference.ts
|
|
4742
4740
|
var rebaseReferenceSource = (child, parent) => {
|
|
4743
4741
|
if (child.kind !== "path" || parent.kind !== "path") return child;
|
|
@@ -4752,16 +4750,12 @@ var referenceTransform = (ref) => {
|
|
|
4752
4750
|
const n2 = Math.sin(ref.rotation);
|
|
4753
4751
|
return [m * s * c, m * s * n2, -s * n2, s * c, ref.position.x, ref.position.y];
|
|
4754
4752
|
};
|
|
4755
|
-
var applyMat = (m, p) => ({
|
|
4756
|
-
x: m[0] * p.x + m[2] * p.y + m[4],
|
|
4757
|
-
y: m[1] * p.x + m[3] * p.y + m[5]
|
|
4758
|
-
});
|
|
4759
4753
|
var placedCorners = (m, b) => [
|
|
4760
4754
|
{ x: b.minX, y: b.minY },
|
|
4761
4755
|
{ x: b.maxX, y: b.minY },
|
|
4762
4756
|
{ x: b.maxX, y: b.maxY },
|
|
4763
4757
|
{ x: b.minX, y: b.maxY }
|
|
4764
|
-
].map((p) =>
|
|
4758
|
+
].map((p) => matApply(m, p));
|
|
4765
4759
|
var placedBounds = (m, b) => {
|
|
4766
4760
|
const out = emptyBounds();
|
|
4767
4761
|
if (isEmptyBounds(b)) return out;
|
|
@@ -5011,7 +5005,9 @@ var paintReference = (obj, sink, env) => {
|
|
|
5011
5005
|
const b = content.bounds;
|
|
5012
5006
|
const c = isEmptyBounds(b) ? { x: 0, y: 0 } : { x: (b.minX + b.maxX) / 2, y: (b.minY + b.maxY) / 2 };
|
|
5013
5007
|
sink.pushTransform(matMultiply(m, [1, 0, 0, 1, c.x, c.y]));
|
|
5014
|
-
const
|
|
5008
|
+
const tint = obj.color !== void 0 && !env.forceStyle ? mapColor(obj.color) : null;
|
|
5009
|
+
const rebased = rebaseSink(sink, c);
|
|
5010
|
+
const out = tint ? tintSink(rebased, tint) : rebased;
|
|
5015
5011
|
const clip = obj.clip;
|
|
5016
5012
|
if (clip)
|
|
5017
5013
|
out.pushClipRect({
|
|
@@ -5067,6 +5063,30 @@ var paintReference = (obj, sink, env) => {
|
|
|
5067
5063
|
if (clip) sink.popClip();
|
|
5068
5064
|
sink.popTransform();
|
|
5069
5065
|
};
|
|
5066
|
+
var tintSink = (sink, color) => ({
|
|
5067
|
+
beginPath: () => sink.beginPath(),
|
|
5068
|
+
moveTo: (p) => sink.moveTo(p),
|
|
5069
|
+
lineTo: (p) => sink.lineTo(p),
|
|
5070
|
+
bezierTo: (c1, c2, end) => sink.bezierTo(c1, c2, end),
|
|
5071
|
+
arc: (center, r, a0, a1, ccw) => sink.arc(center, r, a0, a1, ccw),
|
|
5072
|
+
ellipse: (center, rx, ry, rot, a0, a1) => sink.ellipse(center, rx, ry, rot, a0, a1),
|
|
5073
|
+
closePath: () => sink.closePath(),
|
|
5074
|
+
stroke: (s) => sink.stroke({ ...s, color }),
|
|
5075
|
+
fill: (f) => sink.fill({
|
|
5076
|
+
...f,
|
|
5077
|
+
color,
|
|
5078
|
+
gradient: f.gradient && { ...f.gradient, color2: color }
|
|
5079
|
+
}),
|
|
5080
|
+
text: (t) => sink.text({ ...t, color }),
|
|
5081
|
+
image: (i) => sink.image(i),
|
|
5082
|
+
measureText: (text, h, font, wf) => sink.measureText(text, h, font, wf),
|
|
5083
|
+
pushTransform: (m) => sink.pushTransform(m),
|
|
5084
|
+
popTransform: () => sink.popTransform(),
|
|
5085
|
+
pushClipRect: (r) => sink.pushClipRect(r),
|
|
5086
|
+
popClip: () => sink.popClip(),
|
|
5087
|
+
beginObject: sink.beginObject ? (id, layer) => sink.beginObject(id, layer) : void 0,
|
|
5088
|
+
endObject: sink.endObject ? () => sink.endObject() : void 0
|
|
5089
|
+
});
|
|
5070
5090
|
var paintReferenceFrame = (obj, sink, env) => {
|
|
5071
5091
|
const s = 5;
|
|
5072
5092
|
const corners = obj.extent ? placedCorners(referenceTransform(obj), obj.extent) : [
|
|
@@ -5129,7 +5149,7 @@ var painters = {
|
|
|
5129
5149
|
}
|
|
5130
5150
|
};
|
|
5131
5151
|
var paintObject = (obj, sink, env) => {
|
|
5132
|
-
painters[obj.type]
|
|
5152
|
+
painters[obj.type](obj, sink, env);
|
|
5133
5153
|
};
|
|
5134
5154
|
|
|
5135
5155
|
// ../core/src/extensions/blockThumbnail.ts
|
|
@@ -5361,48 +5381,18 @@ var extractCommandMeta = (mod) => {
|
|
|
5361
5381
|
...params.length > 0 ? { params } : {}
|
|
5362
5382
|
};
|
|
5363
5383
|
};
|
|
5364
|
-
var compileCache = /* @__PURE__ */ new Map();
|
|
5365
|
-
onSandboxReset(() => compileCache.clear());
|
|
5366
5384
|
var COMPILE_CACHE_MAX = 100;
|
|
5367
|
-
var compileCommand = (
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
return cached;
|
|
5373
|
-
}
|
|
5374
|
-
const mod = executeScriptModule(script, "command");
|
|
5375
|
-
let meta;
|
|
5376
|
-
try {
|
|
5377
|
-
meta = extractCommandMeta(mod);
|
|
5385
|
+
var compileCommand = compiledModules(
|
|
5386
|
+
"command",
|
|
5387
|
+
COMPILE_CACHE_MAX,
|
|
5388
|
+
(mod) => {
|
|
5389
|
+
const meta = extractCommandMeta(mod);
|
|
5378
5390
|
if (typeof mod.run !== "function")
|
|
5379
5391
|
throw new Error("Command script must export a `run` function");
|
|
5380
|
-
|
|
5381
|
-
releaseScriptModule(mod);
|
|
5382
|
-
throw e;
|
|
5383
|
-
}
|
|
5384
|
-
if (compileCache.size >= COMPILE_CACHE_MAX) {
|
|
5385
|
-
const oldest = compileCache.keys().next().value;
|
|
5386
|
-
if (oldest !== void 0) {
|
|
5387
|
-
releaseScriptModule(compileCache.get(oldest).mod);
|
|
5388
|
-
compileCache.delete(oldest);
|
|
5389
|
-
}
|
|
5390
|
-
}
|
|
5391
|
-
const compiled = { mod, meta, run: mod.run };
|
|
5392
|
-
compileCache.set(script, compiled);
|
|
5393
|
-
return compiled;
|
|
5394
|
-
};
|
|
5395
|
-
var getCommandMetaResult = (script) => {
|
|
5396
|
-
try {
|
|
5397
|
-
return { ok: true, meta: compileCommand(script).meta };
|
|
5398
|
-
} catch (e) {
|
|
5399
|
-
return {
|
|
5400
|
-
ok: false,
|
|
5401
|
-
error: e instanceof Error ? e.message : String(e),
|
|
5402
|
-
loading: !scriptTranspilerReady()
|
|
5403
|
-
};
|
|
5392
|
+
return { mod, meta, run: mod.run };
|
|
5404
5393
|
}
|
|
5405
|
-
|
|
5394
|
+
);
|
|
5395
|
+
var getCommandMetaResult = (script) => moduleMetaResult(() => compileCommand(script).meta);
|
|
5406
5396
|
var listCommandMeta = (scripts) => scripts.map(getCommandMetaResult);
|
|
5407
5397
|
var getCommandRun = (script) => compileCommand(script).run;
|
|
5408
5398
|
var commandScriptId = (script) => {
|
|
@@ -6020,21 +6010,29 @@ var diffById = (prev, next) => {
|
|
|
6020
6010
|
const duplicateIds = prevById.size !== prev.length || nextIds.size !== next.length;
|
|
6021
6011
|
return { added, updated, removed, orderChanged, survivorOrder, duplicateIds };
|
|
6022
6012
|
};
|
|
6023
|
-
var
|
|
6013
|
+
var diffIdOps = (prev, next, make) => {
|
|
6024
6014
|
const d = diffById(prev, next);
|
|
6025
|
-
if (d.duplicateIds)
|
|
6026
|
-
|
|
6027
|
-
const
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
}));
|
|
6031
|
-
for (const s of d.removed) ops.push({ type: "remove-text-style", id: s.id });
|
|
6032
|
-
if (d.orderChanged)
|
|
6033
|
-
ops.push({ type: "reorder-text-styles", ids: d.survivorOrder });
|
|
6034
|
-
for (const { item, index } of d.added)
|
|
6035
|
-
ops.push({ type: "add-text-style", style: item, index });
|
|
6015
|
+
if (d.duplicateIds) return [make.set([...next])];
|
|
6016
|
+
const ops = d.updated.map(make.update);
|
|
6017
|
+
for (const x of d.removed) ops.push(make.remove(x.id));
|
|
6018
|
+
if (d.orderChanged) ops.push(make.reorder(d.survivorOrder));
|
|
6019
|
+
for (const { item, index } of d.added) ops.push(make.add(item, index));
|
|
6036
6020
|
return ops;
|
|
6037
6021
|
};
|
|
6022
|
+
var diffTextStyleOps = (prev, next) => diffIdOps(prev, next, {
|
|
6023
|
+
set: (textStyles) => ({ type: "set-text-styles", textStyles }),
|
|
6024
|
+
update: (style) => ({ type: "update-text-style", style }),
|
|
6025
|
+
remove: (id) => ({ type: "remove-text-style", id }),
|
|
6026
|
+
reorder: (ids) => ({ type: "reorder-text-styles", ids }),
|
|
6027
|
+
add: (style, index) => ({ type: "add-text-style", style, index })
|
|
6028
|
+
});
|
|
6029
|
+
var diffDimStyleOps = (prev, next) => diffIdOps(prev, next, {
|
|
6030
|
+
set: (dimStyles) => ({ type: "set-dim-styles", dimStyles }),
|
|
6031
|
+
update: (style) => ({ type: "update-dim-style", style }),
|
|
6032
|
+
remove: (id) => ({ type: "remove-dim-style", id }),
|
|
6033
|
+
reorder: (ids) => ({ type: "reorder-dim-styles", ids }),
|
|
6034
|
+
add: (style, index) => ({ type: "add-dim-style", style, index })
|
|
6035
|
+
});
|
|
6038
6036
|
var diffNamedOps = (prev, next, key, make) => {
|
|
6039
6037
|
const prevByKey = new Map(prev.map((x) => [key(x.name), x]));
|
|
6040
6038
|
const nextKeys = new Set(next.map((x) => key(x.name)));
|
|
@@ -6064,20 +6062,6 @@ var diffHatchPatternOps = (prev, next) => diffNamedOps(prev, next, hatchPatternK
|
|
|
6064
6062
|
}),
|
|
6065
6063
|
remove: (name) => ({ type: "remove-hatch-pattern", name })
|
|
6066
6064
|
});
|
|
6067
|
-
var diffDimStyleOps = (prev, next) => {
|
|
6068
|
-
const d = diffById(prev, next);
|
|
6069
|
-
if (d.duplicateIds) return [{ type: "set-dim-styles", dimStyles: [...next] }];
|
|
6070
|
-
const ops = d.updated.map((style) => ({
|
|
6071
|
-
type: "update-dim-style",
|
|
6072
|
-
style
|
|
6073
|
-
}));
|
|
6074
|
-
for (const s of d.removed) ops.push({ type: "remove-dim-style", id: s.id });
|
|
6075
|
-
if (d.orderChanged)
|
|
6076
|
-
ops.push({ type: "reorder-dim-styles", ids: d.survivorOrder });
|
|
6077
|
-
for (const { item, index } of d.added)
|
|
6078
|
-
ops.push({ type: "add-dim-style", style: item, index });
|
|
6079
|
-
return ops;
|
|
6080
|
-
};
|
|
6081
6065
|
var diffModuleOps = (prev, next, field) => {
|
|
6082
6066
|
const block = field === "blockDefinitions";
|
|
6083
6067
|
const prevSet = new Set(prev);
|
|
@@ -8429,6 +8413,17 @@ var assertNoUnknownKeys = (sent, parsed, context, type) => {
|
|
|
8429
8413
|
`${context}: unknown field(s) ${unknown.map((k) => `"${k}"${hintFor(type, k)}`).join(", ")}`
|
|
8430
8414
|
);
|
|
8431
8415
|
};
|
|
8416
|
+
var assertHatchEdgeLoops = (input, context) => {
|
|
8417
|
+
if (input.type !== "hatch" || !Array.isArray(input.loops)) return;
|
|
8418
|
+
const old = input.loops.some(
|
|
8419
|
+
(l) => l !== null && typeof l === "object" && "points" in l && !("edges" in l)
|
|
8420
|
+
);
|
|
8421
|
+
if (old)
|
|
8422
|
+
throw new DrawingError(
|
|
8423
|
+
"validation",
|
|
8424
|
+
`${context}: hatch loops take \`edges\`, not \`points\` \u2014 loops: [{ edges: [{ kind: "line", a, b }, { kind: "arc", \u2026 }] }]; in a script, hatchLoop(points) from "lineadraw/helpers" builds one`
|
|
8425
|
+
);
|
|
8426
|
+
};
|
|
8432
8427
|
var assertSaneNumbers = (value, context) => {
|
|
8433
8428
|
const walk = (v, path) => {
|
|
8434
8429
|
if (typeof v === "number") {
|
|
@@ -8602,6 +8597,7 @@ var kernelHooks = (doc) => {
|
|
|
8602
8597
|
};
|
|
8603
8598
|
return {
|
|
8604
8599
|
document: () => kernel.document,
|
|
8600
|
+
forkId: () => kernel.load({ ...kernel.document, id: crypto.randomUUID() }),
|
|
8605
8601
|
apply(op) {
|
|
8606
8602
|
const inverse = kernel.apply(op);
|
|
8607
8603
|
rev++;
|
|
@@ -8696,6 +8692,11 @@ var LocalDrawing = class {
|
|
|
8696
8692
|
get id() {
|
|
8697
8693
|
return this.state.id;
|
|
8698
8694
|
}
|
|
8695
|
+
/** A fresh document id: ids stay 1:1 with files, so a copy saved to
|
|
8696
|
+
* another path is its own project. */
|
|
8697
|
+
forkId() {
|
|
8698
|
+
this.hooks.forkId?.();
|
|
8699
|
+
}
|
|
8699
8700
|
get revision() {
|
|
8700
8701
|
return this.hooks.revision();
|
|
8701
8702
|
}
|
|
@@ -9236,6 +9237,22 @@ var LocalDrawing = class {
|
|
|
9236
9237
|
(r) => r.ok ? [r.meta] : []
|
|
9237
9238
|
);
|
|
9238
9239
|
}
|
|
9240
|
+
/** The given objects that are block instances failing to evaluate (a
|
|
9241
|
+
* `draw` that threw or ran out of time, a missing definition or input):
|
|
9242
|
+
* stored, but drawing nothing. Evaluates them now. */
|
|
9243
|
+
blockErrors(ids) {
|
|
9244
|
+
const blocks = blockInstances({
|
|
9245
|
+
...this.state,
|
|
9246
|
+
resolveObject: this.resolveObject()
|
|
9247
|
+
});
|
|
9248
|
+
return ids.flatMap((id) => {
|
|
9249
|
+
const obj = resolveDocumentObject(this.state, id);
|
|
9250
|
+
if (obj?.type !== "block") return [];
|
|
9251
|
+
blocks.children(obj);
|
|
9252
|
+
const error = getBlockError(id);
|
|
9253
|
+
return error ? [{ id, error }] : [];
|
|
9254
|
+
});
|
|
9255
|
+
}
|
|
9239
9256
|
/** Compilable document commands (broken modules are skipped). */
|
|
9240
9257
|
listUserCommands() {
|
|
9241
9258
|
return listCommandMeta(this.state.commands).flatMap(
|
|
@@ -9461,6 +9478,7 @@ var LocalDrawing = class {
|
|
|
9461
9478
|
const { layer, layerId, id, ...rest } = input;
|
|
9462
9479
|
const context = `add(): objects[${index ?? 0}] (${String(input.type ?? "?")})`;
|
|
9463
9480
|
assertKnownStyleOverrideKeys(input, context);
|
|
9481
|
+
assertHatchEdgeLoops(input, context);
|
|
9464
9482
|
const styleRef = this.styleRef(rest, context);
|
|
9465
9483
|
try {
|
|
9466
9484
|
const raw = {
|
|
@@ -9504,6 +9522,10 @@ var LocalDrawing = class {
|
|
|
9504
9522
|
{ type: cur.type, styleOverride: rest.styleOverride },
|
|
9505
9523
|
`update(): "${id}" (${cur.type})`
|
|
9506
9524
|
);
|
|
9525
|
+
assertHatchEdgeLoops(
|
|
9526
|
+
{ type: cur.type, loops: rest.loops },
|
|
9527
|
+
`update(): "${id}" (${cur.type})`
|
|
9528
|
+
);
|
|
9507
9529
|
const resolvedLayerId = layer !== void 0 || layerId !== void 0 ? this.resolveLayerId(layer, layerId) : void 0;
|
|
9508
9530
|
const styleRef = "styleId" in rest ? this.styleRef(
|
|
9509
9531
|
{ type: cur.type, styleId: rest.styleId },
|
|
@@ -9875,7 +9897,7 @@ var LocalDrawing = class {
|
|
|
9875
9897
|
}
|
|
9876
9898
|
/** Export the document to a DXF string. */
|
|
9877
9899
|
async toDxf() {
|
|
9878
|
-
const { buildDxf } = await import("./exportDxf-
|
|
9900
|
+
const { buildDxf } = await import("./exportDxf-NLNAJFM6.js");
|
|
9879
9901
|
return buildDxf(this.state, this.measurer).content;
|
|
9880
9902
|
}
|
|
9881
9903
|
/** Export the document to DWG bytes (the DXF content, wasm-transcoded).
|
|
@@ -9884,7 +9906,7 @@ var LocalDrawing = class {
|
|
|
9884
9906
|
* exploded to plain geometry (DWG_DXF_OPTIONS — the transcoder's DWG
|
|
9885
9907
|
* output for them is not accepted by AutoCAD). */
|
|
9886
9908
|
async toDwg(opts) {
|
|
9887
|
-
const { buildDxf, DWG_DXF_OPTIONS } = await import("./exportDxf-
|
|
9909
|
+
const { buildDxf, DWG_DXF_OPTIONS } = await import("./exportDxf-NLNAJFM6.js");
|
|
9888
9910
|
const dxf = buildDxf(this.state, this.measurer, DWG_DXF_OPTIONS).content;
|
|
9889
9911
|
return dxfToDwg(dxf, opts?.version ?? "AC1027");
|
|
9890
9912
|
}
|
|
@@ -10066,4 +10088,4 @@ export {
|
|
|
10066
10088
|
runCommandModule,
|
|
10067
10089
|
runDocumentCommand
|
|
10068
10090
|
};
|
|
10069
|
-
//# sourceMappingURL=chunk-
|
|
10091
|
+
//# sourceMappingURL=chunk-42IZLGZG.js.map
|