@7365admin1/layer-common 4.58.0 → 4.58.1

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,12 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 4.58.1
4
+
5
+ ### Patch Changes
6
+
7
+ - e186caf: Robot live view: no more silent reload every ~6 s. PadBot's video URL expiry comes without a time zone ("2026-09-26 16:26:02"); read as local time it was already past, so the panel fetched a new URL every 5 s forever. An expiry that has no zone, or is under a minute away, no longer schedules a re-fetch (the stream's own failure still reconnects, with capped backoff, then Retry). The no-picture and stall watchdogs no longer count while the page is hidden.
8
+ - c4adb97: Robots: a robot's name tag stays inside the plan. Near the right edge it sits to the robot's left, and near the top it goes below: on robot detail (name + status) and on the building map, as the mini-map already did. Before, the S2 docked at the top-right showed only "HERO-OT".
9
+
3
10
  ## 4.58.0
4
11
 
5
12
  ### Minor Changes
@@ -1617,11 +1624,11 @@
1617
1624
  `utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
1618
1625
  own rule from two endpoints the console already calls, unprojected:
1619
1626
 
1620
- GET /api/members/user/:user/app/admin the Seven365 staff membership
1621
- GET /api/roles/id/:role that membership's role document
1627
+ GET /api/members/user/:user/app/admin the Seven365 staff membership
1628
+ GET /api/roles/id/:role that membership's role document
1622
1629
 
1623
- owner = member.type === "admin" && role.type === "admin" && role.default === true
1624
- staff = member.type === "admin" && role.type === "admin"
1630
+ owner = member.type === "admin" && role.type === "admin" && role.default === true
1631
+ staff = member.type === "admin" && role.type === "admin"
1625
1632
 
1626
1633
  `role.default` is the marker because it is the only property of a platform
1627
1634
  staff role no API caller can set - `role.controller.ts` validates create and
@@ -829,6 +829,8 @@
829
829
  .hero-me { position: absolute; width: 0; height: 0; }
830
830
  .hero-me__tag { position: absolute; left: 14px; top: -26px; white-space: nowrap; font-size: 11px; font-weight: 800; padding: 2px 6px; background: var(--hero-text); color: var(--hero-bg); line-height: 1.45; }
831
831
  .hero-me__tag > span { font-weight: 400; opacity: 0.75; }
832
+ .hero-me__tag--left { left: auto; right: 14px; }
833
+ .hero-me__tag--below { top: 14px; }
832
834
  .hero-me__radar {
833
835
  position: absolute;
834
836
  left: -36px;
@@ -1009,6 +1011,8 @@
1009
1011
  box-shadow: var(--hero-shadow-sm);
1010
1012
  cursor: pointer;
1011
1013
  }
1014
+ /* Near the plan's right edge the name sits to the pin's left (nameTagSide) - never clipped. */
1015
+ .hero .hero-bmap__name--left { left: auto; right: 6px; transform-origin: 100% 0; border-left: 0; border-right: 3px solid var(--hero-bot); }
1012
1016
  .hero-bmap__floorlabel { position: absolute; left: -14px; top: 50%; transform-origin: 0 0; font-size: 12px; font-weight: 800; padding: 1px 6px; background: var(--hero-text); color: var(--hero-bg); white-space: nowrap; }
1013
1017
  .hero-bmap__shaft { position: absolute; width: 0; height: 0; transform-style: preserve-3d; transition: opacity 0.6s ease; }
1014
1018
  .hero-bmap__shaftwall { position: absolute; left: 0; top: 0; box-sizing: border-box; transform-origin: top; transform: rotateX(90deg); background: color-mix(in srgb, var(--hero-accent) 28%, transparent); border: 1px solid var(--hero-accent); }
@@ -172,7 +172,14 @@
172
172
  <span class="hero-bmap__body" aria-hidden="true" />
173
173
  <span class="hero-bmap__pin" :style="{ height: `${look.pinH}px` }" aria-hidden="true" />
174
174
  <span class="hero-bmap__pin hero-bmap__pin--y" :style="{ height: `${look.pinH}px` }" aria-hidden="true" />
175
- <button type="button" class="hero-bmap__name" :style="{ transform: `translateZ(${look.pinZ}px) ${unskew}` }" @click.stop="emit('open', r.id)" @mousedown.stop>
175
+ <button
176
+ type="button"
177
+ class="hero-bmap__name"
178
+ :class="{ 'hero-bmap__name--left': nameTagSide(r.left, r.top, r.name, plane.w, plane.h, BUILDING_TAG).flipX }"
179
+ :style="{ transform: `translateZ(${look.pinZ}px) ${unskew}` }"
180
+ @click.stop="emit('open', r.id)"
181
+ @mousedown.stop
182
+ >
176
183
  {{ r.name }}
177
184
  </button>
178
185
  </div>
@@ -236,6 +243,8 @@ import useRobotLive, { siteStatesFeed } from "../../composables/useRobotLive";
236
243
  import { openDoorNames } from "../../utils/robot-fleet-core";
237
244
  import { robotMapViews, robotMapsByFloor, type TRobotMapView } from "../../utils/robot-maps";
238
245
  import {
246
+ BUILDING_TAG,
247
+ nameTagSide,
239
248
  brandName,
240
249
  floorName,
241
250
  mapFloors,
@@ -20,7 +20,7 @@
20
20
  <span class="hero-cross hero-cross--v" :style="{ left: point.left, transition: `left ${tickMs}ms linear` }" aria-hidden="true" />
21
21
  <div v-if="readout" class="hero-readout">{{ readout }}</div>
22
22
  <div class="hero-me" :class="{ 'hero-me--stale': stale }" :style="{ left: point.left, top: point.top, transition: `left ${tickMs}ms linear, top ${tickMs}ms linear` }">
23
- <div class="hero-me__tag">{{ name }} <span>{{ statusLabel }}</span></div>
23
+ <div class="hero-me__tag" :class="tagClass">{{ name }} <span>{{ statusLabel }}</span></div>
24
24
  <div class="hero-me__radar" aria-hidden="true" />
25
25
  <div class="hero-me__ping" aria-hidden="true" />
26
26
  <div class="hero-me__body" :style="{ transform: `rotate(${heading}deg)` }" aria-hidden="true"><div class="hero-me__tick" /></div>
@@ -35,9 +35,10 @@
35
35
  import RobotFloorPlan from "./FloorPlan.vue";
36
36
  import RobotPatrolRoutes from "./PatrolRoutes.vue";
37
37
  import RobotReconnecting from "./Reconnecting.vue";
38
- import { trailDots, type TPatrolRouteView } from "../../utils/robot-display";
38
+ import { computed } from "vue";
39
+ import { DETAIL_TAG, nameTagSide, trailDots, type TPatrolRouteView } from "../../utils/robot-display";
39
40
 
40
- withDefaults(
41
+ const props = withDefaults(
41
42
  defineProps<{
42
43
  name?: string;
43
44
  statusLabel?: string;
@@ -69,4 +70,10 @@ withDefaults(
69
70
  { stale: false, name: "", statusLabel: "", point: null, heading: 0, trail: () => [], readout: "", lost: false, route: null, routes: null, image: null, aspect: null, points: () => [], routeMoving: false, spot: () => [], pick: false, tickMs: 1200 },
70
71
  );
71
72
  const emit = defineEmits<{ pick: [point: { x: number; y: number }] }>();
73
+ // The tag stays inside the plan (flipped left near the right edge, below near the top) - never clipped.
74
+ const tagClass = computed(() => {
75
+ if (!props.point) return {};
76
+ const side = nameTagSide(props.point.left, props.point.top, `${props.name} ${props.statusLabel}`, 320, 240, DETAIL_TAG);
77
+ return { "hero-me__tag--left": side.flipX, "hero-me__tag--below": side.below };
78
+ });
72
79
  </script>
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.58.0",
5
+ "version": "4.58.1",
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.",
@@ -27,11 +27,18 @@ export function liveVideoKind(url: unknown): TVideoKind {
27
27
  return "page";
28
28
  }
29
29
 
30
- /** When to ask for a fresh URL: 30 s before it expires (never sooner than 5 s); null when it does not expire. */
30
+ /**
31
+ * When to ask for a fresh URL: 30 s before it expires. Null (no scheduled
32
+ * re-mint - the stream's own failure re-mints, with capped backoff) when the
33
+ * expiry is missing, has no time zone, or is under a minute away. PadBot sent
34
+ * "2026-09-26 16:26:02" (no zone): read as local time it was already past, so
35
+ * the old 5 s floor re-minted every ~6 s forever, silently (prod 2026-09-26).
36
+ */
31
37
  export function remintDelayMs(expiresAt: unknown, now: number = Date.now()): number | null {
32
- const t = typeof expiresAt === "string" ? Date.parse(expiresAt) : NaN;
33
- if (!Number.isFinite(t)) return null;
34
- return Math.max(5_000, t - now - 30_000);
38
+ if (typeof expiresAt !== "string" || !/(Z|[+-]\d\d:?\d\d)$/i.test(expiresAt.trim())) return null;
39
+ const t = Date.parse(expiresAt);
40
+ if (!Number.isFinite(t) || t - now < 60_000) return null;
41
+ return Math.max(30_000, t - now - 30_000);
35
42
  }
36
43
 
37
44
  export const LIVE_NO_PICTURE =
@@ -199,6 +206,9 @@ export function startLivePlayer(
199
206
  };
200
207
  // ponytail: one 1 s poll instead of juggling media events - videoWidth has no reliable event everywhere.
201
208
  const tick = setInterval(() => {
209
+ // A hidden page gets no frames painted (and Chrome pauses muted background
210
+ // video): not the camera's fault, so the watchdogs don't count it.
211
+ if (typeof document !== "undefined" && document.visibilityState === "hidden") return;
202
212
  waited += tickMs;
203
213
  if (!pictured) {
204
214
  if (video.videoWidth > 0) {
@@ -1609,16 +1609,29 @@ export function credentialPatch(
1609
1609
  }
1610
1610
 
1611
1611
  /**
1612
- * Keep a robot's name tag inside the mini-map plan: flip it to the robot's
1613
- * left near the right edge, and below the robot near the top edge.
1614
- * ponytail: width estimated from the text (10px Archivo 600) against the
1615
- * smallest plan (320px wide, 240 tall); measure if a tag must be exact.
1612
+ * Keep a robot's name tag inside its plan (mini-map, building map, robot
1613
+ * detail): flip it to the robot's left near the right edge, and below the
1614
+ * robot near the top edge.
1615
+ * ponytail: width estimated from the text (default 10px Archivo 600: 6.2 px a
1616
+ * character + 8 px padding; `tag` for bigger tags) against the smallest plan
1617
+ * (320px wide, 240 tall); measure if a tag must be exact.
1616
1618
  */
1617
- export function nameTagSide(left: unknown, top: unknown, name: unknown, planW = 320, planH = 240) {
1619
+ export function nameTagSide(
1620
+ left: unknown,
1621
+ top: unknown,
1622
+ name: unknown,
1623
+ planW = 320,
1624
+ planH = 240,
1625
+ tag: { charW?: number; pad?: number; gap?: number; above?: number } = {},
1626
+ ) {
1618
1627
  const pct = (v: unknown) => (typeof v === "string" ? parseFloat(v) : typeof v === "number" ? v : 0) || 0;
1619
- const width = String(name ?? "").length * 6.2 + 8;
1628
+ const width = String(name ?? "").length * (tag.charW ?? 6.2) + (tag.pad ?? 8);
1620
1629
  return {
1621
- flipX: (pct(left) / 100) * planW + 10 + width > planW,
1622
- below: (pct(top) / 100) * planH < 20,
1630
+ flipX: (pct(left) / 100) * planW + (tag.gap ?? 10) + width > planW,
1631
+ below: (pct(top) / 100) * planH < (tag.above ?? 20),
1623
1632
  };
1624
1633
  }
1634
+
1635
+ /** The bigger tags: robot detail's "name + status" (11px 800, 14px from the dot, 26px above) and the building map's name (11px 800). */
1636
+ export const DETAIL_TAG = { charW: 7.4, pad: 12, gap: 14, above: 30 };
1637
+ export const BUILDING_TAG = { charW: 7.4, pad: 13, gap: 6, above: 0 };