@7365admin1/layer-common 4.17.1-staging.336 → 4.17.1-staging.338

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.
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div ref="root" class="vms">
2
+ <div ref="root" class="vms" :class="{ 'vms--full': isFullscreen }">
3
3
  <!-- ------------------------------------------------------------ toolbar -->
4
4
  <div class="vms__bar">
5
5
  <button
@@ -43,10 +43,10 @@
43
43
  <button
44
44
  type="button"
45
45
  class="vms__tool"
46
- title="Fill the screen with the wall"
46
+ :title="isFullscreen ? 'Leave full screen' : 'Fill the screen with the wall — the panel below is hidden while it is on'"
47
47
  @click="toggleFullscreen"
48
48
  >
49
- Full screen
49
+ {{ isFullscreen ? "Leave full screen" : "Full screen" }}
50
50
  </button>
51
51
  </div>
52
52
 
@@ -516,7 +516,6 @@ const layout = computed(() => wallLayout(layoutKey.value));
516
516
  * `camera-wall.ts` (see `wallColumns`) so they stay testable there.
517
517
  */
518
518
  const { smAndDown } = useDisplay();
519
- const columns = computed(() => wallColumns(layoutKey.value, smAndDown.value));
520
519
  const dense = computed(() => isDenseLayout(layoutKey.value, smAndDown.value));
521
520
 
522
521
  const selectedIds = ref<string[]>([]);
@@ -531,6 +530,9 @@ const tiles = computed(() =>
531
530
  wallTiles(cameras.value, selectedIds.value, layoutKey.value, page.value)
532
531
  );
533
532
 
533
+ /** Declared after `tiles`: the columns follow how many tiles are actually shown. */
534
+ const columns = computed(() => wallColumns(layoutKey.value, smAndDown.value, tiles.value.length));
535
+
534
536
  /**
535
537
  * THE GRID PACKS TO WHAT IS ON IT.
536
538
  *
@@ -780,17 +782,38 @@ onMounted(() => {
780
782
  setOnline();
781
783
  window.addEventListener("online", setOnline);
782
784
  window.addEventListener("offline", setOnline);
785
+ document.addEventListener("fullscreenchange", onFullscreenChange);
786
+ // Safari fires its own event name.
787
+ document.addEventListener("webkitfullscreenchange", onFullscreenChange);
783
788
  });
784
789
 
785
790
  onBeforeUnmount(() => {
786
791
  window.removeEventListener("online", setOnline);
787
792
  window.removeEventListener("offline", setOnline);
793
+ document.removeEventListener("fullscreenchange", onFullscreenChange);
794
+ document.removeEventListener("webkitfullscreenchange", onFullscreenChange);
788
795
  });
789
796
 
790
797
  /* ------------------------------------------------------------- fullscreen */
791
798
 
792
799
  const root = ref<HTMLElement | null>(null);
793
800
 
801
+ /**
802
+ * In full screen the wall takes the whole screen.
803
+ *
804
+ * It did not: `.vms__body` is 68vh whatever the window is, so the picture kept
805
+ * two thirds of the screen and the capabilities panel below took the rest —
806
+ * the owner's "it squeezes the CCTV view". While full screen is on, the body
807
+ * takes the space that is left and the panel is not drawn; the toolbar and the
808
+ * pager stay, so the layout and the page can still be changed.
809
+ */
810
+ const isFullscreen = ref(false);
811
+
812
+ function onFullscreenChange() {
813
+ const el = document.fullscreenElement;
814
+ isFullscreen.value = Boolean(el && root.value && (el === root.value || root.value.contains(el)));
815
+ }
816
+
794
817
  async function toggleFullscreen() {
795
818
  const el = root.value;
796
819
  if (!el) return;
@@ -913,6 +936,22 @@ async function toggleFullscreen() {
913
936
  height: 68vh;
914
937
  }
915
938
 
939
+ /* Full screen: the wall gets the screen, the capabilities panel stands down. */
940
+ .vms--full {
941
+ display: flex;
942
+ flex-direction: column;
943
+ height: 100vh;
944
+ }
945
+
946
+ .vms--full .vms__body {
947
+ flex: 1 1 auto;
948
+ height: auto;
949
+ }
950
+
951
+ .vms--full .vms__caps {
952
+ display: none;
953
+ }
954
+
916
955
  .vms__picker {
917
956
  width: 220px;
918
957
  flex: none;
@@ -157,6 +157,7 @@ import {
157
157
  liveSource,
158
158
  LIVE_CONNECT_TIMEOUT_MS,
159
159
  LIVE_FRAME_TIMEOUT_MS,
160
+ stateAfterFrameSilence,
160
161
  playerOrigin,
161
162
  playerSignal,
162
163
  tileView,
@@ -218,6 +219,8 @@ const frameEl = ref<HTMLIFrameElement | null>(null);
218
219
  const player = ref<TPlayerState>("loading");
219
220
  let timer: ReturnType<typeof setTimeout> | null = null;
220
221
  let frameTimer: ReturnType<typeof setTimeout> | null = null;
222
+ /** How many frame reports this address has produced — see `stateAfterFrameSilence`. */
223
+ let frameReports = 0;
221
224
 
222
225
  const view = computed(() =>
223
226
  tileView(props.camera, { online: props.online, player: player.value })
@@ -407,6 +410,7 @@ function onPlayerMessage(event: MessageEvent) {
407
410
 
408
411
  clearTimer();
409
412
  if (signal === "playing") {
413
+ frameReports += 1;
410
414
  player.value = "playing";
411
415
  // A picture that arrived once and stopped must not stay green. This is the
412
416
  // mobile app's "Live over a nine-second-old still" defect, and the clock is
@@ -435,7 +439,7 @@ function clearFrameTimer() {
435
439
  function restartFrameClock() {
436
440
  clearFrameTimer();
437
441
  frameTimer = setTimeout(() => {
438
- if (player.value === "playing") player.value = "stalled";
442
+ if (player.value === "playing") player.value = stateAfterFrameSilence(frameReports);
439
443
  }, LIVE_FRAME_TIMEOUT_MS);
440
444
  }
441
445
 
@@ -454,6 +458,7 @@ watch(
454
458
  (host) => {
455
459
  clearTimer();
456
460
  clearFrameTimer();
461
+ frameReports = 0;
457
462
  player.value = "loading";
458
463
  if (!host) return;
459
464
  timer = setTimeout(() => {
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.17.1-staging.336",
5
+ "version": "4.17.1-staging.338",
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.",
@@ -126,8 +126,20 @@ export function wallLayout(key: string | undefined) {
126
126
  * are untouched — `isPhone` is the caller's own `smAndDown` (or equivalent),
127
127
  * this file has no notion of viewport width itself.
128
128
  */
129
- export function wallColumns(key: string | undefined, isPhone = false): number {
130
- return isPhone ? 1 : wallLayout(key).columns;
129
+ export function wallColumns(
130
+ key: string | undefined,
131
+ isPhone = false,
132
+ /** How many tiles are actually on screen. Fewer tiles than the layout holds means fewer columns. */
133
+ count?: number
134
+ ): number {
135
+ const base = isPhone ? 1 : wallLayout(key).columns;
136
+ if (!Number.isFinite(count as number)) return base;
137
+ const shown = Math.max(0, Math.floor(count as number));
138
+ // One camera on a four-tile wall used to keep two columns, so the picture
139
+ // took half the width and the rest of the screen was black. The layout
140
+ // button is a MAXIMUM ("up to this many tiles"), not a promise to leave
141
+ // empty cells: the grid never draws more columns than it has tiles to fill.
142
+ return shown > 0 ? Math.min(base, shown) : base;
131
143
  }
132
144
 
133
145
  /**
@@ -340,8 +352,8 @@ export function wallRows(
340
352
  isPhone = false
341
353
  ): number {
342
354
  const { tiles } = wallLayout(layoutKey);
343
- const columns = wallColumns(layoutKey, isPhone);
344
355
  const capped = Math.min(Math.max(0, Math.floor(count)), tiles);
356
+ const columns = wallColumns(layoutKey, isPhone, capped);
345
357
  return Math.min(Math.ceil(tiles / columns), Math.max(1, Math.ceil(capped / columns)));
346
358
  }
347
359
 
@@ -613,6 +625,26 @@ export const LIVE_CONNECT_TIMEOUT_MS = 15_000;
613
625
  */
614
626
  export const LIVE_FRAME_TIMEOUT_MS = 12_000;
615
627
 
628
+ /**
629
+ * What silence after a frame report MEANS — and it depends on how many reports
630
+ * there have ever been.
631
+ *
632
+ * The relay reports the FIRST decoded frame and nothing after it (measured
633
+ * 2026-09-21 against the live relay: one `{event:"frame",state:"live"}` in 25
634
+ * seconds while the websocket carried 410 video frames). Treating that silence
635
+ * as a stall put "The picture stopped arriving" over four tiles that were
636
+ * playing perfectly — the same lie as a green badge over a frozen picture,
637
+ * pointed the other way.
638
+ *
639
+ * So: two or more reports mean the service does report frames, and silence
640
+ * after that is a real stall. A single report proves the picture STARTED and
641
+ * proves nothing about now, which is "Not confirmed" — the tile keeps showing
642
+ * the stream and says plainly that it cannot vouch for it.
643
+ */
644
+ export function stateAfterFrameSilence(frameReports: number): "stalled" | "page-up" {
645
+ return frameReports >= 2 ? "stalled" : "page-up";
646
+ }
647
+
616
648
  export type TTileState =
617
649
  | "live"
618
650
  | "unverified"