@7365admin1/layer-common 4.155.0 → 4.156.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 4.156.0
4
+
5
+ ### Minor Changes
6
+
7
+ - fe3bb03: Vehicle QR stickers: new "Vehicle number on print-out" choice (Show / Hide). Hide leaves the plate number off the preview, print, saved sheet and PNG/JPEG pictures (file names use the sticker number); the serial number moves into the plate's place when it is on the sticker. Blank sticker codes are always printed.
8
+
9
+ ## 4.155.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 9d1c583: Top bar, site switcher and profile menu show the full site and organisation name: long names wrap (the bar grows to fit) instead of being cut with an ellipsis.
14
+
3
15
  ## 4.155.0
4
16
 
5
17
  ### Minor Changes
@@ -3614,11 +3626,11 @@ Monthly report: a month that had patrols opens the list of that month's patrol r
3614
3626
  `utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
3615
3627
  own rule from two endpoints the console already calls, unprojected:
3616
3628
 
3617
- GET /api/members/user/:user/app/admin the Seven365 staff membership
3618
- GET /api/roles/id/:role that membership's role document
3629
+ GET /api/members/user/:user/app/admin the Seven365 staff membership
3630
+ GET /api/roles/id/:role that membership's role document
3619
3631
 
3620
- owner = member.type === "admin" && role.type === "admin" && role.default === true
3621
- staff = member.type === "admin" && role.type === "admin"
3632
+ owner = member.type === "admin" && role.type === "admin" && role.default === true
3633
+ staff = member.type === "admin" && role.type === "admin"
3622
3634
 
3623
3635
  `role.default` is the marker because it is the only property of a platform
3624
3636
  staff role no API caller can set - `role.controller.ts` validates create and
@@ -13,7 +13,7 @@
13
13
  <!-- Seven365 staff view: persistent banner with Exit (only while one is open). -->
14
14
  <StaffViewBanner />
15
15
  <v-app-bar
16
- :height="58"
16
+ :height="barHeight"
17
17
  flat
18
18
  scroll-behavior="elevate"
19
19
  scroll-threshold="200"
@@ -21,7 +21,7 @@
21
21
  >
22
22
  <v-app-bar-nav-icon v-if="!props.hideNavIcon" @click="drawer = !drawer"></v-app-bar-nav-icon>
23
23
 
24
- <div class="app-topbar-shell__crumb">
24
+ <div ref="crumbEl" class="app-topbar-shell__crumb">
25
25
  <span v-if="siteName" class="app-topbar-shell__site">{{ siteName }}</span>
26
26
  <span v-if="siteName && moduleName" class="app-topbar-shell__sep">/</span>
27
27
  <span class="app-topbar-shell__module">{{ moduleName }}</span>
@@ -170,6 +170,25 @@ const siteName = computed(() =>
170
170
 
171
171
  const route = useRoute();
172
172
 
173
+ /**
174
+ * The bar is the design's 58px, and grows when a long site name wraps onto
175
+ * more lines than fit - so the full name is always visible, never clipped.
176
+ */
177
+ const crumbEl = ref<HTMLElement | null>(null);
178
+ const crumbHeight = ref(0);
179
+ const barHeight = computed(() => Math.max(58, crumbHeight.value));
180
+ let crumbObserver: ResizeObserver | null = null;
181
+
182
+ onMounted(() => {
183
+ if (!crumbEl.value || typeof ResizeObserver === "undefined") return;
184
+ crumbObserver = new ResizeObserver(() => {
185
+ crumbHeight.value = crumbEl.value?.offsetHeight ?? 0;
186
+ });
187
+ crumbObserver.observe(crumbEl.value);
188
+ });
189
+
190
+ onBeforeUnmount(() => crumbObserver?.disconnect());
191
+
173
192
  /**
174
193
  * The page's name comes off the route name, which the applications build from
175
194
  * their own folder structure: `org-site-work-orders` is Work Orders. The rule
@@ -238,26 +257,38 @@ const { getNameInitials } = useUtils();
238
257
  flex: 1 1 auto;
239
258
  min-width: 0;
240
259
  display: flex;
260
+ flex-wrap: wrap;
241
261
  align-items: center;
242
- gap: 6px;
262
+ column-gap: 6px;
263
+ padding-block: 6px;
243
264
  font-size: var(--fs-breadcrumb);
244
- /* Truncates rather than wraps: two lines would break a 58px bar, and the
245
- site name is the half worth losing first. */
246
- overflow: hidden;
247
- white-space: nowrap;
265
+ line-height: 1.25;
266
+ /* Owner 2026-10-30: the site name is shown IN FULL - it wraps, the bar grows
267
+ to fit (see `barHeight`), and it is never cut with an ellipsis. */
268
+ white-space: normal;
248
269
  }
249
270
 
250
271
  .app-topbar-shell__site,
251
272
  .app-topbar-shell__sep {
252
273
  color: var(--muted);
253
- overflow: hidden;
254
- text-overflow: ellipsis;
274
+ }
275
+
276
+ .app-topbar-shell__site {
277
+ /* Word boundaries first; only a single unbroken word wider than the bar is
278
+ split, so nothing is ever hidden. */
279
+ overflow-wrap: break-word;
255
280
  }
256
281
 
257
282
  .app-topbar-shell__module {
258
283
  color: var(--text);
259
284
  font-weight: 700;
260
- flex: 0 0 auto;
285
+ }
286
+
287
+ /* Phones: a little smaller, so a long name takes fewer lines. */
288
+ @media (max-width: 599px) {
289
+ .app-topbar-shell__crumb {
290
+ font-size: 12px;
291
+ }
261
292
  }
262
293
 
263
294
  /**
@@ -311,9 +342,7 @@ const { getNameInitials } = useUtils();
311
342
  font-weight: 800;
312
343
  line-height: 1.3;
313
344
  color: var(--text);
314
- overflow: hidden;
315
- white-space: nowrap;
316
- text-overflow: ellipsis;
345
+ overflow-wrap: break-word;
317
346
  }
318
347
 
319
348
  .app-profile-menu__site {
@@ -321,9 +350,7 @@ const { getNameInitials } = useUtils();
321
350
  font-weight: 600;
322
351
  line-height: 1.3;
323
352
  color: var(--muted);
324
- overflow: hidden;
325
- white-space: nowrap;
326
- text-overflow: ellipsis;
353
+ overflow-wrap: break-word;
327
354
  }
328
355
 
329
356
  .app-profile-menu__rows {
@@ -15,10 +15,9 @@
15
15
  :to="props.route"
16
16
  class="switch-context__activator"
17
17
  >
18
- <!-- The design prints the organisation and site names in full, but
19
- mid-word line breaks ("Manageme-nt", "Condominiu-m") are not
20
- acceptable. Wrap at word boundaries onto up to two lines, then
21
- ellipsis; the title attribute keeps the full name on hover. -->
18
+ <!-- Owner 2026-10-30: the organisation and site names are shown IN
19
+ FULL - wrapped at word boundaries onto as many lines as they
20
+ need, never cut with an ellipsis. -->
22
21
  <v-list-item-title
23
22
  class="switch-context__name"
24
23
  :title="name || `Select ${prop.title}`"
@@ -339,18 +338,35 @@ const selectItem = (value: string) => {
339
338
  background: var(--hover);
340
339
  }
341
340
 
342
- /* Wrap the full organisation/site name at word boundaries onto up to two
343
- lines, then ellipsis - never break mid-word. Full name is on the title
344
- attribute for hover. */
345
- .switch-context__name {
346
- display: -webkit-box;
347
- line-clamp: 2;
348
- -webkit-line-clamp: 2;
349
- -webkit-box-orient: vertical;
350
- overflow: hidden;
341
+ /* Owner 2026-10-30: the full organisation/site name, wrapped at word
342
+ boundaries onto as many lines as it needs - never clamped or cut. Only a
343
+ single word wider than the rail is split. The selector carries the Vuetify
344
+ class so it beats `.v-list-item-title`'s nowrap + ellipsis. */
345
+ .v-list-item-title.switch-context__name {
346
+ /* A touch under the rail's 14px, so a long name takes fewer lines. */
347
+ font-size: 13px;
351
348
  white-space: normal;
352
- overflow-wrap: normal;
353
- word-break: normal;
349
+ overflow: visible;
350
+ text-overflow: clip;
351
+ overflow-wrap: break-word;
354
352
  line-height: 1.25;
355
353
  }
354
+
355
+ /* The dropdown rows: same rule, the whole name on every row. */
356
+ .switch-context__row {
357
+ white-space: normal;
358
+ overflow-wrap: break-word;
359
+ line-height: 1.3;
360
+ }
361
+
362
+ /* The icon's gap is the rail rows' 10px, not Vuetify's 32px, so a long name
363
+ gets the width and takes fewer lines. */
364
+ .switch-context__activator :deep(.v-list-item__prepend > .v-icon ~ .v-list-item__spacer) {
365
+ width: 10px;
366
+ }
367
+
368
+ .switch-context__activator :deep(.v-list-item__content),
369
+ .switch-context__row :deep(.v-list-item__content) {
370
+ overflow: visible;
371
+ }
356
372
  </style>
@@ -157,13 +157,18 @@
157
157
  data-test="vehicle-qr-text" />
158
158
  </v-col>
159
159
  <v-col v-if="design.shape === 'square' || design.text !== 'none'" cols="12" sm="6" md="4">
160
- <v-select v-model="design.label" :items="LABEL_OPTIONS" label="Words under the plate" density="compact"
160
+ <v-select v-model="design.label" :items="LABEL_OPTIONS"
161
+ :label="design.plate === 'hide' ? 'Words on the sticker' : 'Words under the plate'" density="compact"
161
162
  hide-details />
162
163
  </v-col>
163
164
  <v-col cols="12" sm="6" md="4">
164
165
  <v-select v-model="design.serial" :items="SERIAL_OPTIONS" label="Serial number (No. 1, 2, 3 ...)" density="compact"
165
166
  hide-details data-test="vehicle-qr-serial" />
166
167
  </v-col>
168
+ <v-col v-if="!isBlank" cols="12" sm="6" md="4">
169
+ <v-select v-model="design.plate" :items="PLATE_OPTIONS" label="Vehicle number on print-out" density="compact"
170
+ hide-details data-test="vehicle-qr-plate" />
171
+ </v-col>
167
172
  </v-row>
168
173
  <div class="d-flex align-center flex-wrap">
169
174
  <v-switch v-model="design.cutLines" label="Show cut lines" color="primary" density="compact" hide-details
@@ -252,6 +257,7 @@ import {
252
257
  stickerSizeInfo,
253
258
  stickerSizeLines,
254
259
  stickerCardSvgs,
260
+ stickerFileLabel,
255
261
  stickerWarning,
256
262
  type StickerItem,
257
263
  type StickerPlateRow,
@@ -262,12 +268,14 @@ import {
262
268
  EYE_OPTIONS,
263
269
  LABEL_OPTIONS,
264
270
  SERIAL_OPTIONS,
271
+ PLATE_OPTIONS,
265
272
  QR_SHAPE_OPTIONS,
266
273
  QR_ECC,
267
274
  STICKER_THEMES,
268
275
  TEXT_OPTIONS,
269
276
  frameOptionsFor,
270
277
  normalizeDesign,
278
+ printedDesign,
271
279
  rememberedDesign,
272
280
  sizeOptionsFor,
273
281
  stickerFaceSvg,
@@ -385,13 +393,13 @@ watch(
385
393
  );
386
394
  const frameItems = computed(() => frameOptionsFor(design.shape));
387
395
  const sizeItems = computed(() => {
388
- const look = normalizeDesign(design);
396
+ const look = printedDesign(design, isBlank.value, siteName.value);
389
397
  return sizeOptionsFor(look, STICKER_QR_MODULES).map((o) => {
390
398
  const info = stickerSizeInfo({ ...look, size: o.value });
391
399
  return { value: o.value, title: `${o.title} - ${Math.round(info.shapeW)} mm wide, QR ${Math.round(info.qrMm)} mm` };
392
400
  });
393
401
  });
394
- const sizeLines = computed(() => stickerSizeLines(normalizeDesign(design)));
402
+ const sizeLines = computed(() => stickerSizeLines(printedDesign(design, isBlank.value, siteName.value)));
395
403
 
396
404
  const onlyWithSticker = ref(false);
397
405
  const shownPlates = computed(() => (onlyWithSticker.value ? plates.value.filter((p) => p.hasSticker) : plates.value));
@@ -504,7 +512,7 @@ function chosenItems() {
504
512
 
505
513
  // The QR content and error correction (Q) are the same on every design.
506
514
  function faceArgs(chosen: StickerItem[]) {
507
- const look = normalizeDesign(design);
515
+ const look = printedDesign(design, isBlank.value, siteName.value);
508
516
  const codes = chosen.map((i) => QRCode.create(i.qr, { errorCorrectionLevel: QR_ECC as QRCode.QRCodeErrorCorrectionLevel }).modules);
509
517
  const faces = chosen.map((i, k) => stickerFaceSvg(codes[k], look, i.qr));
510
518
  return [faces, { design: look, siteName: siteName.value, modules: codes[0].size }] as const;
@@ -533,7 +541,7 @@ async function saveImages(format: ImageFormat, dpi: number) {
533
541
  const [faces, opts] = faceArgs(chosen);
534
542
  const cards = stickerCardSvgs(chosen, faces, { ...opts, dpi });
535
543
  const ext = format === "jpeg" ? "jpg" : "png";
536
- const names = stickerFileNames(chosen.map((i) => i.plateNumber), ext);
544
+ const names = stickerFileNames(chosen.map((i) => stickerFileLabel(i, opts.design)), ext);
537
545
  const files = [];
538
546
  for (const [k, c] of cards.entries()) files.push({ name: names[k], data: await svgToImage(c.svg, c.width, c.height, format, dpi) });
539
547
  if (files.length === 1) saveFile(files[0].name, files[0].data, `image/${format}`);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "4.155.0",
5
+ "version": "4.156.0",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
@@ -48,6 +48,8 @@ export type LabelChoice = "app" | "verify" | "scanme" | "site" | "none";
48
48
  export type TextChoice = "below" | "none";
49
49
  /** Where the sticker's running number ("No. 12") is printed: not at all, on the sticker, on the cut-off strip, or both. */
50
50
  export type SerialChoice = "off" | "sticker" | "strip" | "both";
51
+ /** The vehicle's plate number on the print-out: shown, or left off (a blank sticker's code is always printed). */
52
+ export type PlateChoice = "show" | "hide";
51
53
 
52
54
  export type StickerTheme = { id: string; title: string; ink: string; eye: string; paper: string };
53
55
 
@@ -65,6 +67,7 @@ export type StickerDesign = {
65
67
  /** A thin grey line around each sticker to cut along. */
66
68
  cutLines?: boolean;
67
69
  serial?: SerialChoice;
70
+ plate?: PlateChoice;
68
71
  };
69
72
 
70
73
  export const DOT_OPTIONS: { value: DotShape; title: string }[] = [
@@ -146,6 +149,11 @@ export const SERIAL_OPTIONS: { value: SerialChoice; title: string }[] = [
146
149
  { value: "both", title: "On the sticker and the strip" },
147
150
  ];
148
151
 
152
+ export const PLATE_OPTIONS: { value: PlateChoice; title: string }[] = [
153
+ { value: "show", title: "Show" },
154
+ { value: "hide", title: "Hide (not printed)" },
155
+ ];
156
+
149
157
  export const LABEL_OPTIONS: { value: LabelChoice; title: string }[] = [
150
158
  { value: "app", title: "Scan with iSecure365 / iMA365" },
151
159
  { value: "verify", title: "Scan to verify vehicle" },
@@ -176,6 +184,7 @@ export const DEFAULT_STICKER_DESIGN: StickerDesign = {
176
184
  text: "below",
177
185
  cutLines: true,
178
186
  serial: "sticker",
187
+ plate: "show",
179
188
  };
180
189
 
181
190
  /** A saved or typed-in design with anything unknown replaced by the default. */
@@ -199,6 +208,7 @@ export function normalizeDesign(raw: unknown): StickerDesign {
199
208
  text: pick(r.text, TEXT_OPTIONS, d.text),
200
209
  cutLines: typeof r.cutLines === "boolean" ? r.cutLines : true,
201
210
  serial: pick(r.serial, SERIAL_OPTIONS, d.serial),
211
+ plate: pick(r.plate, PLATE_OPTIONS, d.plate!),
202
212
  };
203
213
  }
204
214
 
@@ -212,6 +222,18 @@ export function rememberedDesign(saved: unknown, savedSerial: unknown): StickerD
212
222
  return normalizeDesign({ ...r, serial: savedSerial });
213
223
  }
214
224
 
225
+ /**
226
+ * The design as printed. With the plate hidden on vehicle stickers, a shaped
227
+ * code whose tab under the shape would be left empty (no serial or words on
228
+ * it) is printed with no tab, so no bare paper tab hangs under the shape.
229
+ * Blank stickers always print their code in the tab, so they keep it.
230
+ */
231
+ export function printedDesign(design: unknown, blank = false, siteName = ""): StickerDesign {
232
+ const d = normalizeDesign(design);
233
+ const tabEmpty = d.serial !== "sticker" && d.serial !== "both" && !stickerLabel(d, siteName);
234
+ return !blank && d.plate === "hide" && isSilhouette(d.shape) && d.text === "below" && tabEmpty ? { ...d, text: "none" } : d;
235
+ }
236
+
215
237
  export function stickerTheme(id: string): StickerTheme {
216
238
  return STICKER_THEMES.find((t) => t.id === id) ?? STICKER_THEMES[0];
217
239
  }
@@ -18,7 +18,7 @@ import {
18
18
  stickerTheme,
19
19
  type StickerDesign,
20
20
  } from "./vehicle-qr-design.ts";
21
- import { BLANK_STRIP_NOTE, plateLines } from "./vehicle-qr-blank.ts";
21
+ import { BLANK_STRIP_NOTE, isBlankCode, plateLines } from "./vehicle-qr-blank.ts";
22
22
 
23
23
  /** The server's most vehicles per request (POST /api/vehicles/qr/stickers). */
24
24
  export const STICKER_MAX_PER_REQUEST = 500;
@@ -203,6 +203,28 @@ export function stickerSerial(item: Pick<StickerItem, "serialNo">): string {
203
203
  return Number.isInteger(n) && n > 0 ? `No. ${n}` : "";
204
204
  }
205
205
 
206
+ /** What a saved picture is named after: the plate - or, with the plate hidden, the sticker's number (the file name must not give the plate away either). */
207
+ export function stickerFileLabel(item: StickerItem, design: Pick<StickerDesign, "plate">): string {
208
+ return shownPlateLines(item, design.plate === "hide").length ? text(item.plateNumber) : stickerSerial(item) || "sticker";
209
+ }
210
+
211
+ /** The plate lines printed on a sticker: none when the plate is hidden - but a blank sticker's code is always printed (it is typed to link it). */
212
+ function shownPlateLines(item: StickerItem, hidePlate: boolean): string[] {
213
+ const plate = text(item.plateNumber);
214
+ return hidePlate && !item.blank && !isBlankCode(plate) ? [] : plateLines(plate);
215
+ }
216
+
217
+ /**
218
+ * The big line(s) on the sticker and the small serial under them. With the
219
+ * plate hidden, the serial (when it is on the sticker) moves up into the
220
+ * plate's place, so the sticker keeps its usual look with no hole in it.
221
+ */
222
+ function headLines(item: StickerItem, c: CardContext): { lines: string[]; serialText: string } {
223
+ const lines = shownPlateLines(item, c.hidePlate);
224
+ const serialText = c.serial ? stickerSerial(item) : "";
225
+ return lines.length || !serialText ? { lines, serialText } : { lines: [serialText], serialText: "" };
226
+ }
227
+
206
228
  const serialOnSticker = (d: StickerDesign) => d.serial === "sticker" || d.serial === "both";
207
229
 
208
230
  /** "Blk 4 #02-01". Tolerates a unit that already carries its level ("02-01"). */
@@ -369,7 +391,7 @@ function plateSizeMm(plate: string, boxW: number, max = 4.6): number {
369
391
  * `items` (each sticker's frame + QR, already drawn for the chosen design).
370
392
  * Every value is HTML-escaped - an owner or site name is typed by a person.
371
393
  */
372
- type CardContext = { cardW: number; ink: string; label: string; layout: SheetLayout; k: number; shaped: boolean; bare: boolean; wordsTop: number; tag: { x: number; y: number; w: number; h: number } | null; serial: boolean };
394
+ type CardContext = { cardW: number; ink: string; label: string; layout: SheetLayout; k: number; shaped: boolean; bare: boolean; wordsTop: number; tag: { x: number; y: number; w: number; h: number } | null; serial: boolean; hidePlate: boolean };
373
395
 
374
396
  function cardContext(design: StickerDesign, siteName: string | undefined, n: number): CardContext {
375
397
  const g = stickerGeometry(design, n);
@@ -387,29 +409,29 @@ function cardContext(design: StickerDesign, siteName: string | undefined, n: num
387
409
  wordsTop: mm(((g.qrTop ?? 0) + QR_MM + 0.8) * k),
388
410
  tag: g.band ? { x: mm(g.band.x * k), y: mm(g.band.y * k), w: mm(g.band.w * k), h: mm(g.band.h * k) } : null,
389
411
  serial: serialOnSticker(design),
412
+ hidePlate: design.plate === "hide",
390
413
  };
391
414
  }
392
415
 
393
416
  /** The sticker itself (frame + QR + plate words) - what goes on the car. */
394
417
  function cardHtml(item: StickerItem, face: string, c: CardContext): string {
395
- const lines = plateLines(text(item.plateNumber));
418
+ const { lines, serialText } = headLines(item, c);
396
419
  const plate = lines.map(escapeHtml).join("<br>");
397
420
  const longest = lines.reduce((a, l) => (l.length > a.length ? l : a), "");
398
421
  // a two-line code has no room for the words under it inside the tag
399
422
  const label = c.label && !(c.tag && lines.length > 1) ? `<div class="hint">${escapeHtml(c.label)}</div>` : "";
400
423
  // the serial takes the words' place inside a shape's tag (no room for both)
401
- const serialText = c.serial ? stickerSerial(item) : "";
402
424
  const serial = serialText ? `<div class="serial">${escapeHtml(serialText)}</div>` : "";
403
425
  const tagWords = serial && c.tag ? (lines.length > 1 ? "" : serial) : label;
404
426
  const words = c.shaped && !c.tag
405
427
  ? ""
406
428
  : c.tag
407
429
  ? `<div class="words band" style="left:${c.tag.x}mm;right:auto;top:${c.tag.y}mm;width:${c.tag.w}mm;height:${c.tag.h}mm">` +
408
- `<div class="plate" style="font-size:${plateSizeMm(longest, c.tag.w, 4.6 * c.k)}mm">${plate}</div>` +
430
+ (lines.length ? `<div class="plate" style="font-size:${plateSizeMm(longest, c.tag.w, 4.6 * c.k)}mm">${plate}</div>` : "") +
409
431
  tagWords +
410
432
  `</div>`
411
- : `<div class="words" style="top:${c.wordsTop}mm">` +
412
- `<div class="plate"${lines.length > 1 ? ` style="font-size:${plateSizeMm(longest, c.cardW - 6, 4.6)}mm"` : ""}>${plate}</div>` +
433
+ : `<div class="words" style="top:${c.wordsTop}mm${!lines.length && !label ? ";justify-content:center" : ""}">` +
434
+ (lines.length ? `<div class="plate"${lines.length > 1 ? ` style="font-size:${plateSizeMm(longest, c.cardW - 6, 4.6)}mm"` : ""}>${plate}</div>` : "") +
413
435
  serial +
414
436
  label +
415
437
  `<div class="brand"><span class="mark" style="background:${c.ink}">7</span>Powered by Seven365</div>` +
@@ -432,7 +454,7 @@ export function buildStickerDocument(
432
454
  const c = cardContext(design, opts.siteName, n);
433
455
  // the strip carries the number when chosen - and when the sticker has no room for it
434
456
  // (a bare shape, or a two-line blank code filling a shape's tag)
435
- const noRoom = (item: StickerItem) => (c.shaped && !c.tag) || (!!c.tag && plateLines(text(item.plateNumber)).length > 1);
457
+ const noRoom = (item: StickerItem) => (c.shaped && !c.tag) || (!!c.tag && shownPlateLines(item, c.hidePlate).length > 1);
436
458
  const stripSerial = (item: StickerItem) => design.serial === "strip" || design.serial === "both" || (c.serial && noRoom(item));
437
459
  const cells = items.map((item, i) => {
438
460
  const { place, owner } = installerLine(item);
@@ -469,24 +491,23 @@ function svgLine(t: string, x: number, baseline: number, size: number, maxW: num
469
491
  */
470
492
  function cardWordsSvg(item: StickerItem, c: CardContext): string {
471
493
  if (c.shaped && !c.tag) return "";
472
- const lines = plateLines(text(item.plateNumber));
494
+ const { lines, serialText } = headLines(item, c);
473
495
  const longest = lines.reduce((a, l) => (l.length > a.length ? l : a), "");
474
- const serialText = c.serial ? stickerSerial(item) : "";
475
496
  const box = c.tag ?? { x: 3, y: c.wordsTop, w: c.cardW - 6, h: c.layout.cardH - 2 - c.wordsTop };
476
497
  const plateSize = c.tag
477
498
  ? plateSizeMm(longest, c.tag.w, 4.6 * c.k)
478
499
  : lines.length > 1 ? plateSizeMm(longest, c.cardW - 6, 4.6) : 13 * PT;
479
500
  const small = 5.8 * PT;
480
501
  type Row = { h: number; draw: (top: number) => string };
481
- const rows: Row[] = [
482
- {
502
+ const rows: Row[] = [];
503
+ if (lines.length)
504
+ rows.push({
483
505
  h: 1.1 * plateSize * lines.length,
484
506
  draw: (top) =>
485
507
  lines
486
508
  .map((l, n) => svgLine(l, box.x + box.w / 2, top + (0.955 + 1.1 * n) * plateSize, plateSize, box.w, `font-weight="800" letter-spacing="0.3"`, 0.7))
487
509
  .join(""),
488
- },
489
- ];
510
+ });
490
511
  const word = (t: string, bold: boolean): Row => ({
491
512
  h: 1.2 * small,
492
513
  draw: (top) => svgLine(t, box.x + box.w / 2, top + small, small, box.w, bold ? `font-weight="700" letter-spacing="0.15"` : `opacity="0.85"`),
@@ -517,7 +538,8 @@ function cardWordsSvg(item: StickerItem, c: CardContext): string {
517
538
  const used = rows.reduce((n, r) => n + r.h, 0);
518
539
  // the card spreads its rows top to bottom; a tag centres them with 0.6 mm between
519
540
  const gap = c.tag ? 0.6 : rows.length > 1 ? Math.max(0, (box.h - used) / (rows.length - 1)) : 0;
520
- let top = c.tag ? box.y + (box.h - used - gap * (rows.length - 1)) / 2 : box.y;
541
+ // (a lone Seven365 line - plate hidden, nothing else - sits in the middle of the card)
542
+ let top = c.tag || rows.length === 1 ? box.y + (box.h - used - gap * (rows.length - 1)) / 2 : box.y;
521
543
  const out = rows.map((r) => {
522
544
  const svg = r.draw(top);
523
545
  top += r.h + gap;