schematex 0.9.8 → 0.9.10

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.
@@ -38352,14 +38352,39 @@ function chairAt(px, cx, cy, deg) {
38352
38352
  const rot = Math.round(deg * 10) / 10;
38353
38353
  return el("g", { transform: `translate(${px(cx)},${px(cy)}) rotate(${rot})` }, [body]);
38354
38354
  }
38355
- function edgeChairs(c, top, bottom) {
38355
+ var SEAT_FS = 0.17;
38356
+ var SEAT_FS_MIN = 0.085;
38357
+ function seatName(c, cx, cy, name, slotW) {
38358
+ if (!name) return "";
38359
+ const unitW = estimateTextWidth(name, 1);
38360
+ let fs = SEAT_FS;
38361
+ if (unitW > 0 && unitW * fs > slotW) fs = Math.max(SEAT_FS_MIN, slotW / unitW);
38362
+ return text(
38363
+ {
38364
+ class: "sx-fp-seat-name",
38365
+ x: c.px(cx),
38366
+ y: c.px(cy),
38367
+ "text-anchor": "middle",
38368
+ "dominant-baseline": "central",
38369
+ "font-size": c.px(fs)
38370
+ },
38371
+ name
38372
+ );
38373
+ }
38374
+ function edgeChairs(c, top, bottom, seats) {
38356
38375
  const n = Math.max(1, Math.round(c.w / 0.65));
38376
+ const slotW = c.w / n * 0.96;
38357
38377
  const out = [];
38358
- for (let i = 0; i < n; i++) {
38359
- const cx = (i + 0.5) / n * c.w;
38360
- if (top) out.push(chairAt(c.px, cx, -CHAIR_GAP, 0));
38361
- out.push(chairAt(c.px, cx, c.h + CHAIR_GAP, 180));
38362
- }
38378
+ let s = 0;
38379
+ const row = (cy, deg) => {
38380
+ for (let i = 0; i < n; i++) {
38381
+ const cx = (i + 0.5) / n * c.w;
38382
+ out.push(chairAt(c.px, cx, cy, deg));
38383
+ if (seats) out.push(seatName(c, cx, cy, seats[s++], slotW));
38384
+ }
38385
+ };
38386
+ if (top) row(-CHAIR_GAP, 0);
38387
+ row(c.h + CHAIR_GAP, 180);
38363
38388
  return out.join("");
38364
38389
  }
38365
38390
  function box(c, cls = "sx-fp-furn", rx = 0) {
@@ -38441,19 +38466,21 @@ function roundTable(seats, diaM) {
38441
38466
  const r7 = half - ring;
38442
38467
  const cx = c.w / 2;
38443
38468
  const cy = c.h / 2;
38469
+ const slotW = 2 * (r7 + ring * 0.55) * Math.sin(Math.PI / seats);
38444
38470
  const parts = [circle({ class: "sx-fp-furn", cx: c.px(cx), cy: c.px(cy), r: c.px(r7) })];
38445
38471
  for (let i = 0; i < seats; i++) {
38446
38472
  const a = i / seats * 2 * Math.PI - Math.PI / 2;
38447
38473
  const px0 = cx + (r7 + ring * 0.55) * Math.cos(a);
38448
38474
  const py0 = cy + (r7 + ring * 0.55) * Math.sin(a);
38449
38475
  parts.push(chairAt(c.px, px0, py0, a * 180 / Math.PI + 90));
38476
+ if (c.seats) parts.push(seatName(c, px0, py0, c.seats[i], slotW));
38450
38477
  }
38451
38478
  return parts.join("");
38452
38479
  }
38453
38480
  };
38454
38481
  }
38455
38482
  function tableDraw(top, bottom) {
38456
- return (c) => box(c) + edgeChairs(c, top);
38483
+ return (c) => box(c) + edgeChairs(c, top, bottom, c.seats);
38457
38484
  }
38458
38485
  var TREAD = 0.28;
38459
38486
  function treadLines(c, vert, fixed0, fixed1, from, to, dashedFrom) {
@@ -38703,7 +38730,7 @@ var FLOORPLAN_SYMBOLS = {
38703
38730
  return parts.join("");
38704
38731
  }
38705
38732
  },
38706
- "dining-table": { w: 1.6, h: 0.9, envelope: [CHAIR_OVERHANG, 0, CHAIR_OVERHANG, 0], draw: tableDraw(true) },
38733
+ "dining-table": { w: 1.6, h: 0.9, envelope: [CHAIR_OVERHANG, 0, CHAIR_OVERHANG, 0], draw: tableDraw(true, true) },
38707
38734
  sectional: {
38708
38735
  w: 2.6,
38709
38736
  h: 2,
@@ -39135,10 +39162,10 @@ var FLOORPLAN_SYMBOLS = {
39135
39162
  "round-table-6": roundTable(6, 1.52),
39136
39163
  "round-table-8": roundTable(8, 1.52),
39137
39164
  "round-table-10": roundTable(10, 1.83),
39138
- "conference-table": { w: 2.4, h: 1.2, envelope: [CHAIR_OVERHANG, 0, CHAIR_OVERHANG, 0], draw: tableDraw(true) },
39165
+ "conference-table": { w: 2.4, h: 1.2, envelope: [CHAIR_OVERHANG, 0, CHAIR_OVERHANG, 0], draw: tableDraw(true, true) },
39139
39166
  // ── event / banquet ──
39140
- "banquet-table": { w: 2.44, h: 0.76, envelope: [CHAIR_OVERHANG, 0, CHAIR_OVERHANG, 0], draw: tableDraw(true) },
39141
- "head-table": { w: 3.7, h: 0.76, envelope: [0, 0, CHAIR_OVERHANG, 0], draw: tableDraw(false) },
39167
+ "banquet-table": { w: 2.44, h: 0.76, envelope: [CHAIR_OVERHANG, 0, CHAIR_OVERHANG, 0], draw: tableDraw(true, true) },
39168
+ "head-table": { w: 3.7, h: 0.76, envelope: [0, 0, CHAIR_OVERHANG, 0], draw: tableDraw(false, true) },
39142
39169
  stage: {
39143
39170
  w: 4,
39144
39171
  h: 2,
@@ -39388,6 +39415,118 @@ var FLOORPLAN_SYMBOLS = {
39388
39415
  underlay: true,
39389
39416
  draw: (c) => rect({ class: "sx-fp-furn-dash", x: 0, y: 0, width: c.px(c.w), height: c.px(c.h), rx: c.px(0.08) })
39390
39417
  },
39418
+ // ── restaurant / commercial kitchen ──
39419
+ // Restaurant booth: two facing benches (chair fill) with a table between.
39420
+ // Default seats 4 (two per bench); benches are not auto-named seats.
39421
+ booth: {
39422
+ w: 1.4,
39423
+ h: 1.6,
39424
+ envelope: [0, 0, 0, 0],
39425
+ draw: (c) => {
39426
+ const benchH = Math.min(0.45, c.h * 0.28);
39427
+ const inset = c.w * 0.12;
39428
+ return [
39429
+ rect({ class: "sx-fp-chair", x: 0, y: 0, width: c.px(c.w), height: c.px(benchH), rx: c.px(0.06) }),
39430
+ rect({ class: "sx-fp-chair", x: 0, y: c.px(c.h - benchH), width: c.px(c.w), height: c.px(benchH), rx: c.px(0.06) }),
39431
+ rect({
39432
+ class: "sx-fp-furn",
39433
+ x: c.px(inset),
39434
+ y: c.px(benchH + 0.06),
39435
+ width: c.px(c.w - 2 * inset),
39436
+ height: c.px(Math.max(0.1, c.h - 2 * benchH - 0.12)),
39437
+ rx: c.px(0.04)
39438
+ })
39439
+ ].join("");
39440
+ }
39441
+ },
39442
+ // Stainless prep / work table: solid top with a dashed under-shelf outline.
39443
+ "prep-table": {
39444
+ w: 1.5,
39445
+ h: 0.75,
39446
+ draw: (c) => box(c) + rect({
39447
+ class: "sx-fp-furn-dash",
39448
+ x: c.px(0.08),
39449
+ y: c.px(0.08),
39450
+ width: c.px(Math.max(0.1, c.w - 0.16)),
39451
+ height: c.px(Math.max(0.1, c.h - 0.16))
39452
+ })
39453
+ },
39454
+ // Commercial range: 6 burners (2 rows × 3 cols) over an oven (front line).
39455
+ range: {
39456
+ w: 0.9,
39457
+ h: 0.85,
39458
+ draw: (c) => {
39459
+ const parts = [box(c)];
39460
+ const r7 = Math.min(c.w / 6, c.h / 8);
39461
+ for (let row = 0; row < 2; row++) {
39462
+ for (let col = 0; col < 3; col++) {
39463
+ const cx = (col + 0.5) / 3 * c.w;
39464
+ const cy = (row + 0.5) / 4 * c.h;
39465
+ parts.push(circle({ class: "sx-fp-furn-line", cx: c.px(cx), cy: c.px(cy), r: c.px(r7) }));
39466
+ }
39467
+ }
39468
+ parts.push(line({ class: "sx-fp-furn-line", x1: 0, y1: c.px(c.h * 0.62), x2: c.px(c.w), y2: c.px(c.h * 0.62) }));
39469
+ return parts.join("");
39470
+ }
39471
+ },
39472
+ // Walk-in cooler/freezer: insulated double-wall box with a door gap + label.
39473
+ "walk-in": {
39474
+ w: 2.4,
39475
+ h: 2,
39476
+ draw: (c) => {
39477
+ const t = Math.min(0.12, c.w * 0.06);
39478
+ const doorW = Math.min(0.9, c.w * 0.4);
39479
+ const parts = [
39480
+ box(c),
39481
+ rect({
39482
+ class: "sx-fp-furn-line",
39483
+ x: c.px(t),
39484
+ y: c.px(t),
39485
+ width: c.px(Math.max(0.1, c.w - 2 * t)),
39486
+ height: c.px(Math.max(0.1, c.h - 2 * t))
39487
+ }),
39488
+ // door gap on the bottom wall + a hinged leaf
39489
+ rect({ class: "sx-fp-furn-solid", x: c.px((c.w - doorW) / 2), y: c.px(c.h - t), width: c.px(doorW), height: c.px(t) }),
39490
+ line({
39491
+ class: "sx-fp-door-leaf",
39492
+ x1: c.px((c.w - doorW) / 2),
39493
+ y1: c.px(c.h),
39494
+ x2: c.px((c.w - doorW) / 2),
39495
+ y2: c.px(c.h + doorW * 0.6)
39496
+ }),
39497
+ glyphText(c, "WALK-IN")
39498
+ ];
39499
+ return parts.join("");
39500
+ }
39501
+ },
39502
+ // Three-compartment commercial sink: three basins + a faucet dot per basin.
39503
+ "commercial-sink": {
39504
+ w: 1.8,
39505
+ h: 0.6,
39506
+ draw: (c) => {
39507
+ const parts = [box(c)];
39508
+ const gap = c.w * 0.04;
39509
+ const bw = (c.w - 4 * gap) / 3;
39510
+ for (let i = 0; i < 3; i++) {
39511
+ const bx = gap + i * (bw + gap);
39512
+ parts.push(rect({ class: "sx-fp-furn-line", x: c.px(bx), y: c.px(c.h * 0.18), width: c.px(bw), height: c.px(c.h * 0.64), rx: c.px(0.03) }));
39513
+ parts.push(circle({ class: "sx-fp-furn-dot", cx: c.px(bx + bw / 2), cy: c.px(c.h * 0.12), r: c.px(0.04) }));
39514
+ }
39515
+ return parts.join("");
39516
+ }
39517
+ },
39518
+ // Deep fryer: two fry vats with handles.
39519
+ fryer: {
39520
+ w: 0.4,
39521
+ h: 0.8,
39522
+ draw: (c) => {
39523
+ const parts = [box(c)];
39524
+ for (const cy of [c.h * 0.28, c.h * 0.72]) {
39525
+ parts.push(rect({ class: "sx-fp-furn-line", x: c.px(c.w * 0.18), y: c.px(cy - c.h * 0.16), width: c.px(c.w * 0.64), height: c.px(c.h * 0.32), rx: c.px(0.02) }));
39526
+ }
39527
+ return parts.join("");
39528
+ }
39529
+ },
39391
39530
  // ── site / outdoor ──
39392
39531
  // Tree in plan: a canopy disc with a foliage ring and a trunk dot.
39393
39532
  tree: {
@@ -39635,7 +39774,14 @@ function parseFurniture(tok, ast, ln) {
39635
39774
  f.y = c.y;
39636
39775
  } else if (t.word === "size") f.size = parseDims(tok.shift(), "size", ln);
39637
39776
  else if (t.word === "rotate") f.rotate = parseNum2(tok.shift(), "rotate", ln);
39638
- else throw new FloorplanParseError(`furniture: unexpected token "${t.word}"`, ln);
39777
+ else if (t.word === "seats") {
39778
+ const names = [];
39779
+ while (isStr(tok[0])) names.push(tok.shift().str);
39780
+ if (names.length === 0) {
39781
+ throw new FloorplanParseError(`"seats" expects one or more quoted names`, ln);
39782
+ }
39783
+ f.seats = names;
39784
+ } else throw new FloorplanParseError(`furniture: unexpected token "${t.word}"`, ln);
39639
39785
  }
39640
39786
  ast.furniture.push(f);
39641
39787
  }
@@ -40065,11 +40211,11 @@ function layoutFloorplan(ast) {
40065
40211
  }
40066
40212
  const items = [];
40067
40213
  const seqByType = /* @__PURE__ */ new Map();
40068
- const place = (type, roomIdx, localX, localY, w, h, rotate, label) => {
40214
+ const place = (type, roomIdx, localX, localY, w, h, rotate, label, seats) => {
40069
40215
  const room = rooms[roomIdx];
40070
40216
  const seq = (seqByType.get(type) ?? 0) + 1;
40071
40217
  seqByType.set(type, seq);
40072
- items.push({ type, x: room.x + localX, y: room.y + localY, w, h, rotate, label, roomId: room.id, seq });
40218
+ items.push({ type, x: room.x + localX, y: room.y + localY, w, h, rotate, label, seats, roomId: room.id, seq });
40073
40219
  };
40074
40220
  const roomIdxOf = (stmt, roomId, line2) => {
40075
40221
  if (!roomId) {
@@ -40089,7 +40235,7 @@ function layoutFloorplan(ast) {
40089
40235
  if (idx === void 0) continue;
40090
40236
  const w = f.size ? f.size.w * u : def.w;
40091
40237
  const h = f.size ? f.size.h * u : def.h;
40092
- place(f.type, idx, f.x * u, f.y * u, w, h, f.rotate, f.label);
40238
+ place(f.type, idx, f.x * u, f.y * u, w, h, f.rotate, f.label, f.seats);
40093
40239
  }
40094
40240
  for (const a of ast.arrays) {
40095
40241
  const def = FLOORPLAN_SYMBOLS[a.type];
@@ -40410,6 +40556,7 @@ function buildCss13(t) {
40410
40556
  .sx-fp-hatch { fill: none; stroke: ${t.hatchStroke}; stroke-width: 1; }
40411
40557
  .sx-fp-furn-text { font-weight: 600; font-family: sans-serif; fill: ${t.furnLabel}; paint-order: stroke; stroke: ${t.floorFill}; stroke-width: 2.5px; stroke-linejoin: round; }
40412
40558
  .sx-fp-furn-label { font: 11px sans-serif; fill: ${t.furnLabel}; paint-order: stroke; stroke: ${t.floorFill}; stroke-width: 3px; stroke-linejoin: round; }
40559
+ .sx-fp-seat-name { font-family: sans-serif; fill: ${t.furnLabel}; paint-order: stroke; stroke: ${t.floorFill}; stroke-width: 2px; stroke-linejoin: round; }
40413
40560
  .sx-fp-door-leaf { fill: none; stroke: ${t.doorLeaf}; stroke-width: 1.6; }
40414
40561
  .sx-fp-door-arc { fill: none; stroke: ${t.doorArc}; stroke-width: 1; }
40415
40562
  .sx-fp-window { fill: none; stroke: ${t.windowStroke}; stroke-width: 1.3; }
@@ -40695,7 +40842,7 @@ function renderFloorplanLayout(lay, config) {
40695
40842
  const cx = r24(X(it.x) + wpx / 2);
40696
40843
  const cy = r24(Y(it.y) + hpx / 2);
40697
40844
  const rot = Math.round(it.rotate * 10) / 10;
40698
- const children = [def.draw({ w: it.w, h: it.h, px, label: it.label })];
40845
+ const children = [def.draw({ w: it.w, h: it.h, px, label: it.label, seats: it.seats })];
40699
40846
  if (warnSet.has(idx)) {
40700
40847
  children.push(rect({ class: "sx-fp-warn-item", x: -1, y: -1, width: r24(wpx + 2), height: r24(hpx + 2) }));
40701
40848
  }
@@ -42555,5 +42702,5 @@ function renderWithPlugin(prepared, plugin, config) {
42555
42702
  }
42556
42703
 
42557
42704
  export { FLOORPLAN_SYMBOLS, GEOMETRY, bowtie2 as bowtie, causalloop, comparison, decisiontree, drawDeviceIcon, epc, eventtree, faulttree, fmea, gitgraph, iconSize, idef0, markov, network, parse, parseResult, pert, petri, pid, prisma, rbd, render, renderEquip, renderPreview, renderResult, sequence, state, threatmodel, timeline, umlclass, usecase, welding };
42558
- //# sourceMappingURL=chunk-4QLIFOKH.js.map
42559
- //# sourceMappingURL=chunk-4QLIFOKH.js.map
42705
+ //# sourceMappingURL=chunk-T5QOVX2I.js.map
42706
+ //# sourceMappingURL=chunk-T5QOVX2I.js.map