signalk-polar-performance-plugin 1.3.1 → 1.3.2

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
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
7
7
  ## [Unreleased]
8
8
 
9
9
  ### Fixed
10
+ - Signal K admin styling now loads from standalone CSS records in current Vite manifests while retaining support for entry-associated CSS and older server fallbacks.
10
11
  - `/live` and `/status` endpoints now return `null` for `tws`/`twa` (and downstream fields) when the wind smoother has no data or is stale, instead of `0`. The guard was checking for the presence of the smoother object rather than its `ready` state.
11
12
  - `computeAndSend`: when the polar table lookup fails (boat outside polar range — in irons or above max TWS), the `performance.polarSpeed`, `performance.polarSpeedRatio`, and `performance.targetSpeed` SK paths are now written with `null` instead of `0`. Writing `0` was misleading because it is a valid-looking value rather than an explicit "no data" signal.
12
13
  - Live input subscriptions are now re-established after prolonged silence for all subscribed inputs, not just true wind. Boat speed and optional true heading use the same recovery path, and the plugin now reports their lifecycle state through the webapp/status endpoints.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signalk-polar-performance-plugin",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Calculates live sailing performance from polar data, with built-in polar management and import tools.",
5
5
  "main": "plugin/index.js",
6
6
  "exports": {
package/public/index.html CHANGED
@@ -16,29 +16,44 @@
16
16
  el.href = href
17
17
  document.head.appendChild(el)
18
18
  }
19
+ let manifestFailure = 'manifest contained no CSS assets'
19
20
  try {
20
21
  const res = await fetch('/admin/.vite/manifest.json')
21
22
  if (res.ok) {
22
23
  const manifest = await res.json()
23
- let found = false
24
+ const stylesheets = new Set()
24
25
  for (const entry of Object.values(manifest)) {
25
- if (!entry.isEntry) continue
26
- for (const css of entry.css ?? []) {
27
- appendStylesheet('/admin/' + css)
28
- found = true
26
+ if (entry.file?.endsWith('.css')) {
27
+ stylesheets.add(entry.file)
29
28
  }
29
+ if (entry.isEntry) {
30
+ for (const css of entry.css ?? []) {
31
+ stylesheets.add(css)
32
+ }
33
+ }
34
+ }
35
+ if (stylesheets.size > 0) {
36
+ for (const css of stylesheets) appendStylesheet('/admin/' + css)
37
+ return
30
38
  }
31
- if (found) return
39
+ } else {
40
+ manifestFailure = `manifest request returned ${res.status}`
32
41
  }
33
- } catch (e) { /* fall through */ }
42
+ } catch (e) {
43
+ manifestFailure = `manifest request failed: ${e.message}`
44
+ }
34
45
  try {
35
46
  const res = await fetch('/')
36
47
  const html = await res.text()
37
48
  const doc = new DOMParser().parseFromString(html, 'text/html')
38
49
  const link = doc.querySelector('link[rel="stylesheet"]')
39
- if (link) appendStylesheet(new URL(link.getAttribute('href'), res.url).href)
50
+ if (link) {
51
+ appendStylesheet(new URL(link.getAttribute('href'), res.url).href)
52
+ return
53
+ }
54
+ console.warn(`[polar] Could not load SignalK admin stylesheet: ${manifestFailure}; legacy admin page contained no stylesheet link.`)
40
55
  } catch (e) {
41
- console.warn('[polar] Could not load SignalK admin stylesheet:', e)
56
+ console.warn(`[polar] Could not load SignalK admin stylesheet: ${manifestFailure}; legacy fallback failed: ${e.message}`)
42
57
  }
43
58
  })()
44
59
  </script>