lineadraw 0.12.0 → 0.14.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 +2 -1
- package/dist/{chunk-LWE26W45.js → chunk-FBZASM7T.js} +146 -84
- package/dist/chunk-FBZASM7T.js.map +1 -0
- package/dist/{chunk-7CKYA7RK.js → chunk-ZQLBHWCD.js} +264 -152
- package/dist/chunk-ZQLBHWCD.js.map +1 -0
- package/dist/{exportDxf-HWJCUKNQ.js → exportDxf-YBVM7KKS.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 +24 -4
- package/dist/sdk.js.map +1 -1
- package/dist/tools.d.ts +12 -3
- package/dist/tools.js +153 -142
- package/dist/tools.js.map +1 -1
- package/dist/{types.d-DK_ww49C.d.ts → types.d-DMu4ZKhe.d.ts} +66 -25
- package/lineadraw.d.ts +14 -2
- package/package.json +5 -3
- package/dist/chunk-7CKYA7RK.js.map +0 -1
- package/dist/chunk-LWE26W45.js.map +0 -1
- /package/dist/{exportDxf-HWJCUKNQ.js.map → exportDxf-YBVM7KKS.js.map} +0 -0
package/README.md
CHANGED
|
@@ -303,7 +303,8 @@ millimeters, Y-up, angles in radians CCW.
|
|
|
303
303
|
Parameter types (the same rows serve a command's `params`):
|
|
304
304
|
|
|
305
305
|
- `number` — `min`/`max`, `integer`, `step`, `prefix`/`suffix` ("1:",
|
|
306
|
-
"mm"), `presets` (standard values in the field's dropdown)
|
|
306
|
+
"mm"), `presets` (standard values in the field's dropdown),
|
|
307
|
+
`display: "slider"` (a slider beside the field; needs `min` and `max`).
|
|
307
308
|
- `string` — `placeholder`, `multiline`, `presets`.
|
|
308
309
|
- `boolean` (`display: "toggle"` — a toggle button showing the label,
|
|
309
310
|
compact in a row), `enum` (`options`, each optionally with a `swatch:
|
|
@@ -652,6 +652,20 @@ var chainEdges = (loop) => {
|
|
|
652
652
|
}
|
|
653
653
|
return out;
|
|
654
654
|
};
|
|
655
|
+
var loopGap = (loop) => {
|
|
656
|
+
const chain = chainEdges(loop);
|
|
657
|
+
let worst = null;
|
|
658
|
+
chain.forEach(({ edge, reversed }, i) => {
|
|
659
|
+
const next = chain[(i + 1) % chain.length];
|
|
660
|
+
const e = edgeEnds(edge);
|
|
661
|
+
const n = edgeEnds(next.edge);
|
|
662
|
+
const from = reversed ? e.start : e.end;
|
|
663
|
+
const to = next.reversed ? n.end : n.start;
|
|
664
|
+
const gap = dist(from, to);
|
|
665
|
+
if (!worst || gap > worst.gap) worst = { edge: i, gap, from, to };
|
|
666
|
+
});
|
|
667
|
+
return worst;
|
|
668
|
+
};
|
|
655
669
|
var loopPolygon = (loop, tolerance = 0.1) => {
|
|
656
670
|
const ring = [];
|
|
657
671
|
for (const { edge, reversed } of chainEdges(loop)) {
|
|
@@ -830,6 +844,7 @@ var ObjectBaseSchema = z.object({
|
|
|
830
844
|
/** Paint opacity 0..1 across canvas/SVG/PDF. undefined = opaque. */
|
|
831
845
|
opacity: z.number().min(0).max(1).optional()
|
|
832
846
|
});
|
|
847
|
+
var normalizeName = (name) => name.trim().toUpperCase().replace(/[\s.-]+/g, "_");
|
|
833
848
|
|
|
834
849
|
// ../core/src/paint/sink.ts
|
|
835
850
|
var matIdentity = [1, 0, 0, 1, 0, 0];
|
|
@@ -1443,7 +1458,6 @@ var BUILT_IN_PATTERNS = parsePatternDefinitions(
|
|
|
1443
1458
|
BUILTIN_PAT,
|
|
1444
1459
|
1
|
|
1445
1460
|
).filter((p2) => p2.name.toUpperCase() !== "SOLID");
|
|
1446
|
-
var normalizeName = (name) => name.trim().toUpperCase().replace(/[\s.-]+/g, "_");
|
|
1447
1461
|
var BUILT_IN_BY_NAME = new Map(
|
|
1448
1462
|
BUILT_IN_PATTERNS.map((p2) => [normalizeName(p2.name), p2])
|
|
1449
1463
|
);
|
|
@@ -1523,6 +1537,8 @@ var resolveHatchPattern = (name, hatchPatterns) => {
|
|
|
1523
1537
|
}
|
|
1524
1538
|
return getHatchPattern(name);
|
|
1525
1539
|
};
|
|
1540
|
+
var ANSI31_BASE_SPACING = 3.175;
|
|
1541
|
+
var ANSI31_BASE_ANGLE_DEG = 45;
|
|
1526
1542
|
|
|
1527
1543
|
// ../core/src/export/dxf/exportDxf.ts
|
|
1528
1544
|
import {
|
|
@@ -2340,7 +2356,10 @@ var REFERENCE_FORMATS = [
|
|
|
2340
2356
|
"dwg",
|
|
2341
2357
|
"pdf",
|
|
2342
2358
|
"png",
|
|
2343
|
-
"jpg"
|
|
2359
|
+
"jpg",
|
|
2360
|
+
// Linked only: the editor decodes it to PNG (Embed stores that PNG, as
|
|
2361
|
+
// `png`), and headless hosts — which have no decoder — draw its frame.
|
|
2362
|
+
"webp"
|
|
2344
2363
|
];
|
|
2345
2364
|
var ReferenceSourceSchema = z4.discriminatedUnion("kind", [
|
|
2346
2365
|
z4.object({
|
|
@@ -2566,7 +2585,6 @@ var CURATED = [
|
|
|
2566
2585
|
dxfName: "DIVIDE"
|
|
2567
2586
|
}
|
|
2568
2587
|
];
|
|
2569
|
-
var normalizeName2 = (name) => name.trim().toUpperCase().replace(/[\s.-]+/g, "_");
|
|
2570
2588
|
var asciiPreview = (dashesMm) => {
|
|
2571
2589
|
const WIDTH = 15;
|
|
2572
2590
|
if (!dashesMm.length) return "_".repeat(WIDTH * 0.8);
|
|
@@ -2587,9 +2605,9 @@ var withPreview = (p2) => {
|
|
|
2587
2605
|
return { ...p2, label: `${p2.label} ${asciiPreview(p2.dashesMm)}` };
|
|
2588
2606
|
};
|
|
2589
2607
|
var BUILT_IN = CURATED.map(withPreview);
|
|
2590
|
-
var BY_NAME = new Map(BUILT_IN.map((p2) => [
|
|
2608
|
+
var BY_NAME = new Map(BUILT_IN.map((p2) => [normalizeName(p2.name), p2]));
|
|
2591
2609
|
for (const p2 of parseLinDefinitions(BUILTIN_LIN)) {
|
|
2592
|
-
const key =
|
|
2610
|
+
const key = normalizeName(p2.name);
|
|
2593
2611
|
if (BY_NAME.has(key)) continue;
|
|
2594
2612
|
const pattern2 = withPreview({
|
|
2595
2613
|
name: p2.name,
|
|
@@ -2607,14 +2625,14 @@ var scaleVariantBase = (name) => {
|
|
|
2607
2625
|
};
|
|
2608
2626
|
for (const p2 of BUILT_IN) {
|
|
2609
2627
|
const base = scaleVariantBase(p2.name);
|
|
2610
|
-
const target = base ? BY_NAME.get(
|
|
2628
|
+
const target = base ? BY_NAME.get(normalizeName(base)) : void 0;
|
|
2611
2629
|
if (target && target !== p2) p2.hidden = true;
|
|
2612
2630
|
}
|
|
2613
2631
|
var LINE_TYPE_NAMES = BUILT_IN.filter((p2) => !p2.hidden).map(
|
|
2614
2632
|
(p2) => p2.name
|
|
2615
2633
|
);
|
|
2616
2634
|
var LINE_TYPE_DEFS = BUILT_IN;
|
|
2617
|
-
var getLineType = (name) => BY_NAME.get(
|
|
2635
|
+
var getLineType = (name) => BY_NAME.get(normalizeName(name));
|
|
2618
2636
|
var renderDashes = (pattern2) => pattern2.dashesMm.length ? pattern2.dashesMm.map((v2) => v2 === 0 ? 0.1 : Math.abs(v2)) : void 0;
|
|
2619
2637
|
var LineTypeSchema = z5.object({
|
|
2620
2638
|
/** Stored on objects/layers as `lineType`; case-insensitive, unique per
|
|
@@ -2625,7 +2643,7 @@ var LineTypeSchema = z5.object({
|
|
|
2625
2643
|
* Empty = continuous. */
|
|
2626
2644
|
dashesMm: z5.array(z5.number())
|
|
2627
2645
|
});
|
|
2628
|
-
var lineTypeKey = (name) =>
|
|
2646
|
+
var lineTypeKey = (name) => normalizeName(name);
|
|
2629
2647
|
var lineTypeAsPattern = (t) => ({
|
|
2630
2648
|
name: t.name,
|
|
2631
2649
|
label: t.description ?? t.name,
|
|
@@ -2635,8 +2653,8 @@ var lineTypeAsPattern = (t) => ({
|
|
|
2635
2653
|
var resolveLineType = (name, lineTypes) => {
|
|
2636
2654
|
if (!name) return void 0;
|
|
2637
2655
|
if (lineTypes && lineTypes.length > 0) {
|
|
2638
|
-
const key =
|
|
2639
|
-
const own = lineTypes.find((t) =>
|
|
2656
|
+
const key = normalizeName(name);
|
|
2657
|
+
const own = lineTypes.find((t) => normalizeName(t.name) === key);
|
|
2640
2658
|
if (own) return lineTypeAsPattern(own);
|
|
2641
2659
|
}
|
|
2642
2660
|
return getLineType(name);
|
|
@@ -2728,7 +2746,10 @@ var NumberParam = z6.object({
|
|
|
2728
2746
|
prefix: z6.string().optional(),
|
|
2729
2747
|
suffix: z6.string().optional(),
|
|
2730
2748
|
/** Standard values offered in the field's dropdown; typing stays free. */
|
|
2731
|
-
presets: z6.array(z6.number()).optional()
|
|
2749
|
+
presets: z6.array(z6.number()).optional(),
|
|
2750
|
+
/** "slider": a slider beside the field — needs `min` and `max` (else
|
|
2751
|
+
* the plain field); a drag updates live and is one undo step. */
|
|
2752
|
+
display: z6.enum(["field", "slider"]).optional()
|
|
2732
2753
|
});
|
|
2733
2754
|
var StringParam = z6.object({
|
|
2734
2755
|
...paramBase,
|
|
@@ -6721,6 +6742,9 @@ var hatchLoop = (points) => verticesToLoop(
|
|
|
6721
6742
|
)
|
|
6722
6743
|
);
|
|
6723
6744
|
|
|
6745
|
+
// ../core/src/errorText.ts
|
|
6746
|
+
var errorText = (e) => e instanceof Error ? e.message : String(e);
|
|
6747
|
+
|
|
6724
6748
|
// ../core/src/extensions/sandbox.ts
|
|
6725
6749
|
var COMMAND_BUDGET_MS = 5e3;
|
|
6726
6750
|
var BLOCK_BUDGET_MS = 200;
|
|
@@ -6903,7 +6927,7 @@ var ModuleSandbox = class {
|
|
|
6903
6927
|
(e) => {
|
|
6904
6928
|
if (this.dead) return;
|
|
6905
6929
|
this.lastHostError = e;
|
|
6906
|
-
const eh = ctx.newError(
|
|
6930
|
+
const eh = ctx.newError(errorText(e));
|
|
6907
6931
|
d2.reject(eh);
|
|
6908
6932
|
eh.dispose();
|
|
6909
6933
|
}
|
|
@@ -7027,8 +7051,11 @@ var ModuleSandbox = class {
|
|
|
7027
7051
|
const message = field("message") || String(dumped);
|
|
7028
7052
|
if (/out of memory/i.test(message)) {
|
|
7029
7053
|
resetPending = true;
|
|
7030
|
-
return
|
|
7031
|
-
|
|
7054
|
+
return Object.assign(
|
|
7055
|
+
new Error(
|
|
7056
|
+
`Script ran out of memory (${MEMORY_LIMIT / 1024 / 1024} MB for all scripts) and was stopped.`
|
|
7057
|
+
),
|
|
7058
|
+
{ code: "scriptOutOfMemory" }
|
|
7032
7059
|
);
|
|
7033
7060
|
}
|
|
7034
7061
|
const host = this.lastHostError;
|
|
@@ -7181,6 +7208,42 @@ var scanScriptId = (script, specOpener) => {
|
|
|
7181
7208
|
if (call === -1) return void 0;
|
|
7182
7209
|
return /\bid\s*:\s*["']([^"']+)["']/.exec(script.slice(call))?.[1];
|
|
7183
7210
|
};
|
|
7211
|
+
var compiledModules = (kind, max, compile) => {
|
|
7212
|
+
const cache2 = /* @__PURE__ */ new Map();
|
|
7213
|
+
onSandboxReset(() => cache2.clear());
|
|
7214
|
+
return (script) => {
|
|
7215
|
+
const hit = cache2.get(script);
|
|
7216
|
+
if (hit) {
|
|
7217
|
+
cache2.delete(script);
|
|
7218
|
+
cache2.set(script, hit);
|
|
7219
|
+
return hit.compiled;
|
|
7220
|
+
}
|
|
7221
|
+
const raw = executeScriptModule(script, kind);
|
|
7222
|
+
let compiled;
|
|
7223
|
+
try {
|
|
7224
|
+
compiled = compile(raw, script);
|
|
7225
|
+
} catch (e) {
|
|
7226
|
+
releaseScriptModule(raw);
|
|
7227
|
+
throw e;
|
|
7228
|
+
}
|
|
7229
|
+
if (cache2.size >= max) {
|
|
7230
|
+
const oldest = cache2.keys().next().value;
|
|
7231
|
+
if (oldest !== void 0) {
|
|
7232
|
+
releaseScriptModule(cache2.get(oldest).raw);
|
|
7233
|
+
cache2.delete(oldest);
|
|
7234
|
+
}
|
|
7235
|
+
}
|
|
7236
|
+
cache2.set(script, { raw, compiled });
|
|
7237
|
+
return compiled;
|
|
7238
|
+
};
|
|
7239
|
+
};
|
|
7240
|
+
var moduleMetaResult = (meta) => {
|
|
7241
|
+
try {
|
|
7242
|
+
return { ok: true, meta: meta() };
|
|
7243
|
+
} catch (e) {
|
|
7244
|
+
return { ok: false, error: errorText(e), loading: !transpiler };
|
|
7245
|
+
}
|
|
7246
|
+
};
|
|
7184
7247
|
|
|
7185
7248
|
// ../core/src/extensions/evalBlock.ts
|
|
7186
7249
|
var hashString = (s) => {
|
|
@@ -7189,11 +7252,9 @@ var hashString = (s) => {
|
|
|
7189
7252
|
return h;
|
|
7190
7253
|
};
|
|
7191
7254
|
var isLabelArray = (v2) => Array.isArray(v2) && v2.every((s) => typeof s === "string");
|
|
7192
|
-
var
|
|
7193
|
-
onSandboxReset(() => compileCache.clear());
|
|
7194
|
-
var COMPILE_CACHE_MAX = 200;
|
|
7255
|
+
var COMPILE_CACHE_MAX = 2e3;
|
|
7195
7256
|
var resultCache = /* @__PURE__ */ new Map();
|
|
7196
|
-
var RESULT_CACHE_MAX =
|
|
7257
|
+
var RESULT_CACHE_MAX = 2e3;
|
|
7197
7258
|
var instanceMemo = /* @__PURE__ */ new Map();
|
|
7198
7259
|
var instanceDeps = /* @__PURE__ */ new Map();
|
|
7199
7260
|
var expandWithBlockDependents = (ids) => {
|
|
@@ -7216,6 +7277,7 @@ var invalidateBlockCache = (ids) => {
|
|
|
7216
7277
|
handleMemo.clear();
|
|
7217
7278
|
exposeMemo.clear();
|
|
7218
7279
|
evalErrors.clear();
|
|
7280
|
+
evalWarnings.clear();
|
|
7219
7281
|
instanceDeps.clear();
|
|
7220
7282
|
return;
|
|
7221
7283
|
}
|
|
@@ -7224,10 +7286,13 @@ var invalidateBlockCache = (ids) => {
|
|
|
7224
7286
|
handleMemo.delete(id);
|
|
7225
7287
|
exposeMemo.delete(id);
|
|
7226
7288
|
evalErrors.delete(id);
|
|
7289
|
+
evalWarnings.delete(id);
|
|
7227
7290
|
}
|
|
7228
7291
|
};
|
|
7229
7292
|
var evalErrors = /* @__PURE__ */ new Map();
|
|
7230
7293
|
var getBlockError = (instanceId) => evalErrors.get(instanceId);
|
|
7294
|
+
var evalWarnings = /* @__PURE__ */ new Map();
|
|
7295
|
+
var getBlockWarning = (instanceId) => evalWarnings.get(instanceId);
|
|
7231
7296
|
var defaultParams = (meta) => {
|
|
7232
7297
|
const params = /* @__PURE__ */ Object.create(null);
|
|
7233
7298
|
for (const param of valueParams(meta.params))
|
|
@@ -7288,10 +7353,9 @@ var parseParamsExport = (paramsExport) => {
|
|
|
7288
7353
|
try {
|
|
7289
7354
|
paramsExport = paramsExport();
|
|
7290
7355
|
} catch (e) {
|
|
7291
|
-
throw new Error(
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
);
|
|
7356
|
+
throw new Error(`\`params\` function threw \u2014 ${errorText(e)}`, {
|
|
7357
|
+
cause: e
|
|
7358
|
+
});
|
|
7295
7359
|
}
|
|
7296
7360
|
}
|
|
7297
7361
|
if (paramsExport === void 0) return [];
|
|
@@ -7332,61 +7396,37 @@ var extractMeta = (mod) => {
|
|
|
7332
7396
|
name: mod.name,
|
|
7333
7397
|
params,
|
|
7334
7398
|
...optional.data,
|
|
7335
|
-
...inputs2 ? { inputs: inputs2 } : {}
|
|
7399
|
+
...inputs2 ? { inputs: inputs2 } : {},
|
|
7400
|
+
...isLabelArray(mod.place) ? { place: [...mod.place] } : {}
|
|
7336
7401
|
};
|
|
7337
7402
|
};
|
|
7338
|
-
var compileBlock = (
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
const raw = executeScriptModule(script, "block");
|
|
7346
|
-
let mod;
|
|
7347
|
-
let meta;
|
|
7348
|
-
try {
|
|
7349
|
-
mod = toBlockModule(raw);
|
|
7350
|
-
meta = extractMeta(mod);
|
|
7351
|
-
} catch (e) {
|
|
7352
|
-
releaseScriptModule(raw);
|
|
7353
|
-
throw e;
|
|
7354
|
-
}
|
|
7355
|
-
if (compileCache.size >= COMPILE_CACHE_MAX) {
|
|
7356
|
-
const oldest = compileCache.keys().next().value;
|
|
7357
|
-
if (oldest !== void 0) {
|
|
7358
|
-
releaseScriptModule(compileCache.get(oldest).raw);
|
|
7359
|
-
compileCache.delete(oldest);
|
|
7360
|
-
}
|
|
7403
|
+
var compileBlock = compiledModules(
|
|
7404
|
+
"block",
|
|
7405
|
+
COMPILE_CACHE_MAX,
|
|
7406
|
+
(raw, script) => {
|
|
7407
|
+
const mod = toBlockModule(raw);
|
|
7408
|
+
const meta = extractMeta(mod);
|
|
7409
|
+
return { raw, mod, meta, hash: hashString(script) };
|
|
7361
7410
|
}
|
|
7362
|
-
|
|
7363
|
-
compileCache.set(script, compiled);
|
|
7364
|
-
return compiled;
|
|
7365
|
-
};
|
|
7411
|
+
);
|
|
7366
7412
|
var getBlockMeta = (script) => compileBlock(script).meta;
|
|
7367
|
-
var getBlockMetaResult = (script) =>
|
|
7368
|
-
try {
|
|
7369
|
-
return { ok: true, meta: compileBlock(script).meta };
|
|
7370
|
-
} catch (e) {
|
|
7371
|
-
return {
|
|
7372
|
-
ok: false,
|
|
7373
|
-
error: e instanceof Error ? e.message : String(e),
|
|
7374
|
-
loading: !scriptTranspilerReady()
|
|
7375
|
-
};
|
|
7376
|
-
}
|
|
7377
|
-
};
|
|
7413
|
+
var getBlockMetaResult = (script) => moduleMetaResult(() => compileBlock(script).meta);
|
|
7378
7414
|
var listBlockMeta = (scripts) => scripts.map(getBlockMetaResult);
|
|
7379
7415
|
var BLOCK_SPEC_OPENER = /defineBlock\s*\(|export\s+default\s*\{/;
|
|
7416
|
+
var scriptIndex = /* @__PURE__ */ new WeakMap();
|
|
7417
|
+
onSandboxReset(() => scriptIndex = /* @__PURE__ */ new WeakMap());
|
|
7380
7418
|
var findBlockScript = (scripts, id) => {
|
|
7381
7419
|
if (!scriptTranspilerReady()) throw transpilerLoadingError();
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7420
|
+
let index2 = scriptIndex.get(scripts);
|
|
7421
|
+
if (!index2) {
|
|
7422
|
+
index2 = /* @__PURE__ */ new Map();
|
|
7423
|
+
for (const script of scripts) {
|
|
7424
|
+
const sid = blockScriptId(script);
|
|
7425
|
+
if (sid !== void 0 && !index2.has(sid)) index2.set(sid, script);
|
|
7387
7426
|
}
|
|
7427
|
+
scriptIndex.set(scripts, index2);
|
|
7388
7428
|
}
|
|
7389
|
-
return
|
|
7429
|
+
return index2.get(id);
|
|
7390
7430
|
};
|
|
7391
7431
|
var blockScriptId = (script) => {
|
|
7392
7432
|
try {
|
|
@@ -7412,8 +7452,17 @@ var runScript = (script, params, inputs2, styles, hosting = { host: null, hosted
|
|
|
7412
7452
|
styles: stylesResolver(styles)
|
|
7413
7453
|
});
|
|
7414
7454
|
const raw = mod.draw(props);
|
|
7415
|
-
|
|
7416
|
-
|
|
7455
|
+
const children = BlockScriptResultSchema.parse(raw);
|
|
7456
|
+
if (emitsPointsLoop(raw)) pointsLoopResults.add(children);
|
|
7457
|
+
return children;
|
|
7458
|
+
};
|
|
7459
|
+
var emitsPointsLoop = (raw) => Array.isArray(raw) && raw.some((c2) => {
|
|
7460
|
+
if (c2?.type !== "hatch" || !Array.isArray(c2.loops)) return false;
|
|
7461
|
+
return c2.loops.some(
|
|
7462
|
+
(l) => Array.isArray(l?.points)
|
|
7463
|
+
);
|
|
7464
|
+
});
|
|
7465
|
+
var pointsLoopResults = /* @__PURE__ */ new WeakSet();
|
|
7417
7466
|
var DEFAULT_BLOCK_STYLES = {
|
|
7418
7467
|
textStyles: [DEFAULT_TEXT_STYLE],
|
|
7419
7468
|
dimStyles: [DEFAULT_DIM_STYLE]
|
|
@@ -7668,7 +7717,7 @@ var testBlockDefinition = async (script) => {
|
|
|
7668
7717
|
visibilityFlags(mod, def.params);
|
|
7669
7718
|
return { ok: true };
|
|
7670
7719
|
} catch (e) {
|
|
7671
|
-
return { ok: false, error:
|
|
7720
|
+
return { ok: false, error: errorText(e) };
|
|
7672
7721
|
}
|
|
7673
7722
|
};
|
|
7674
7723
|
var childToObject = (child, instance, index2, layers) => {
|
|
@@ -7684,7 +7733,6 @@ var childToObject = (child, instance, index2, layers) => {
|
|
|
7684
7733
|
layerId: named ?? child.layerId ?? instance.layerId
|
|
7685
7734
|
};
|
|
7686
7735
|
};
|
|
7687
|
-
var errorText = (e) => e instanceof Error ? e.message : String(e);
|
|
7688
7736
|
var resolveDefinition = (instance, scripts) => {
|
|
7689
7737
|
try {
|
|
7690
7738
|
if (!scriptTranspilerReady()) throw transpilerLoadingError();
|
|
@@ -7911,6 +7959,12 @@ var getEvaluatedWorldChildren = (instance, scripts, resolveObject, styles = DEFA
|
|
|
7911
7959
|
}
|
|
7912
7960
|
}
|
|
7913
7961
|
evalErrors.delete(instance.id);
|
|
7962
|
+
if (pointsLoopResults.has(children))
|
|
7963
|
+
evalWarnings.set(
|
|
7964
|
+
instance.id,
|
|
7965
|
+
`Block "${meta.id}" draws a hatch with the old \`{ points }\` loop shape \u2014 it still draws, but loops take \`edges\`: use hatchLoop(points) from "lineadraw/helpers"`
|
|
7966
|
+
);
|
|
7967
|
+
else evalWarnings.delete(instance.id);
|
|
7914
7968
|
return children.map((child, i) => {
|
|
7915
7969
|
let obj = childToObject(child, instance, i, styles.layers);
|
|
7916
7970
|
if (pose.scale !== 1) obj = scaleObjectUniform(obj, pose.scale);
|
|
@@ -8027,7 +8081,6 @@ var unchanged = (instance) => ({
|
|
|
8027
8081
|
remap: null
|
|
8028
8082
|
});
|
|
8029
8083
|
var fail = (error) => ({ ok: false, error });
|
|
8030
|
-
var errorText2 = (e) => e instanceof Error ? e.message : String(e);
|
|
8031
8084
|
var applyDeclared = (instance, meta, pose, patch) => {
|
|
8032
8085
|
if (!patch) return unchanged(instance);
|
|
8033
8086
|
const r = applyHandlePatch(instance, meta.params, meta.inputs, patch, pose);
|
|
@@ -8204,7 +8257,7 @@ var editBlockInstance = (instance, edit, ctx) => {
|
|
|
8204
8257
|
return builtInEdit(instance, edit, ctx);
|
|
8205
8258
|
}
|
|
8206
8259
|
} catch (e) {
|
|
8207
|
-
return fail(
|
|
8260
|
+
return fail(errorText(e));
|
|
8208
8261
|
}
|
|
8209
8262
|
};
|
|
8210
8263
|
|
|
@@ -12809,6 +12862,16 @@ var tableLayout = (t, textStyles) => {
|
|
|
12809
12862
|
header
|
|
12810
12863
|
);
|
|
12811
12864
|
}
|
|
12865
|
+
const crossings = [];
|
|
12866
|
+
const E = 1e-9;
|
|
12867
|
+
for (const v2 of rules) {
|
|
12868
|
+
if (v2.a.x !== v2.b.x) continue;
|
|
12869
|
+
for (const h of rules) {
|
|
12870
|
+
if (h.a.y !== h.b.y || h.a.x === h.b.x) continue;
|
|
12871
|
+
if (v2.a.x >= h.a.x - E && v2.a.x <= h.b.x + E && h.a.y >= v2.a.y - E && h.a.y <= v2.b.y + E)
|
|
12872
|
+
crossings.push(toWorld(t, { x: v2.a.x, y: h.a.y }));
|
|
12873
|
+
}
|
|
12874
|
+
}
|
|
12812
12875
|
const children = rules.map((r, k2) => ({
|
|
12813
12876
|
type: "line",
|
|
12814
12877
|
id: `${t.id}:rule:${k2}`,
|
|
@@ -12839,6 +12902,7 @@ var tableLayout = (t, textStyles) => {
|
|
|
12839
12902
|
toWorld(t, { x: w2, y: hTotal }),
|
|
12840
12903
|
toWorld(t, { x: 0, y: hTotal })
|
|
12841
12904
|
],
|
|
12905
|
+
crossings,
|
|
12842
12906
|
children,
|
|
12843
12907
|
anchors
|
|
12844
12908
|
};
|
|
@@ -13874,10 +13938,6 @@ ${name}
|
|
|
13874
13938
|
`).join("")
|
|
13875
13939
|
).join("");
|
|
13876
13940
|
|
|
13877
|
-
// ../core/src/export/dxf/hatchPattern.ts
|
|
13878
|
-
var ANSI31_BASE_SPACING = 3.175;
|
|
13879
|
-
var ANSI31_BASE_ANGLE_DEG = 45;
|
|
13880
|
-
|
|
13881
13941
|
// ../core/src/export/dxf/exportDxf.ts
|
|
13882
13942
|
var RAD2DEG2 = 180 / Math.PI;
|
|
13883
13943
|
var sanitizeLayerName = (name) => name.replace(/[<>/\\":;?*|=,`]/g, "_").trim() || "0";
|
|
@@ -14169,6 +14229,7 @@ ${pat.name.toUpperCase()}
|
|
|
14169
14229
|
` + record.slice(nameAt + name.length + 4);
|
|
14170
14230
|
}
|
|
14171
14231
|
}
|
|
14232
|
+
record = record.replace("\n47\n1\n98\n", "\n98\n");
|
|
14172
14233
|
out.push(content.slice(pos, start), record);
|
|
14173
14234
|
pos = end;
|
|
14174
14235
|
}
|
|
@@ -14274,7 +14335,6 @@ var writeSplineEdge = (dx, curve0) => {
|
|
|
14274
14335
|
dx.point2d(p2);
|
|
14275
14336
|
if (rational) dx.push(42, curve.weights[i]);
|
|
14276
14337
|
});
|
|
14277
|
-
dx.push(97, 0);
|
|
14278
14338
|
};
|
|
14279
14339
|
var writeHatch = (space, obj, opts, ctx) => {
|
|
14280
14340
|
if (obj.type !== "hatch") return;
|
|
@@ -15105,6 +15165,8 @@ export {
|
|
|
15105
15165
|
interpolateClosed,
|
|
15106
15166
|
nurbsToBeziers,
|
|
15107
15167
|
curveTolerance,
|
|
15168
|
+
edgeEnds,
|
|
15169
|
+
loopGap,
|
|
15108
15170
|
loopPolygon,
|
|
15109
15171
|
emitLoopPath,
|
|
15110
15172
|
loopCurves,
|
|
@@ -15178,6 +15240,7 @@ export {
|
|
|
15178
15240
|
HatchPatternSchema,
|
|
15179
15241
|
hatchPatternKey,
|
|
15180
15242
|
resolveHatchPattern,
|
|
15243
|
+
ANSI31_BASE_SPACING,
|
|
15181
15244
|
getLineType,
|
|
15182
15245
|
renderDashes,
|
|
15183
15246
|
LineTypeSchema,
|
|
@@ -15196,12 +15259,11 @@ export {
|
|
|
15196
15259
|
documentObjectResolver,
|
|
15197
15260
|
splineThrough,
|
|
15198
15261
|
hatchLoop,
|
|
15199
|
-
|
|
15200
|
-
releaseScriptModule,
|
|
15262
|
+
helpers,
|
|
15201
15263
|
ensureScriptTranspiler,
|
|
15202
|
-
executeScriptModule,
|
|
15203
|
-
scriptTranspilerReady,
|
|
15204
15264
|
scanScriptId,
|
|
15265
|
+
compiledModules,
|
|
15266
|
+
moduleMetaResult,
|
|
15205
15267
|
BlockChildSchema,
|
|
15206
15268
|
inputLabel,
|
|
15207
15269
|
selectionFits,
|
|
@@ -15212,6 +15274,7 @@ export {
|
|
|
15212
15274
|
expandWithBlockDependents,
|
|
15213
15275
|
invalidateBlockCache,
|
|
15214
15276
|
getBlockError,
|
|
15277
|
+
getBlockWarning,
|
|
15215
15278
|
parseParamsExport,
|
|
15216
15279
|
getBlockMeta,
|
|
15217
15280
|
getBlockMetaResult,
|
|
@@ -15225,7 +15288,6 @@ export {
|
|
|
15225
15288
|
hostedClosure,
|
|
15226
15289
|
expandBlockChildren,
|
|
15227
15290
|
blockInstances,
|
|
15228
|
-
ANSI31_BASE_SPACING,
|
|
15229
15291
|
arrowLineStart,
|
|
15230
15292
|
paintArrowhead,
|
|
15231
15293
|
linearAxis,
|
|
@@ -15242,4 +15304,4 @@ export {
|
|
|
15242
15304
|
DWG_DXF_OPTIONS,
|
|
15243
15305
|
buildDxf
|
|
15244
15306
|
};
|
|
15245
|
-
//# sourceMappingURL=chunk-
|
|
15307
|
+
//# sourceMappingURL=chunk-FBZASM7T.js.map
|