@flowfuse/nr-theme 1.8.1-f1b879d-202312012119.0 → 1.9.1-6e36168-202404181140.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.
@@ -5,6 +5,27 @@
5
5
  document.head = (document.head || document.getElementsByTagName('head')[0]);
6
6
  // eslint-disable-next-line
7
7
  const monitorInsertion = (function () { 'use strict'; let m = 100; let t = !1; let u = 'animationName'; let d = ''; const n = 'Webkit Moz O ms Khtml'.split(' '); let e = ''; const i = document.createElement('div'); const s = { strictlyNew: !0, timeout: 20, addImportant: !1 }; if (i.style.animationName && (t = !0), !1 === t) for (let o = 0; o < n.length; o++) if (void 0 !== i.style[n[o] + 'AnimationName']) { e = n[o], u = e + 'AnimationName', d = '-' + e.toLowerCase() + '-', t = !0; break } function c (t) { return s.strictlyNew && !0 === t.QinsQ } function r (t, n) { function e (t) { t.animationName !== o && t[u] !== o || c(t.target) || n(t.target) } let i; var o = 'insQ_' + m++; const r = s.addImportant ? ' !important' : ''; (i = document.createElement('style')).innerHTML = '@' + d + 'keyframes ' + o + ' { from { outline: 1px solid transparent } to { outline: 0px solid transparent } }\n' + t + ' { animation-duration: 0.001s' + r + '; animation-name: ' + o + r + '; ' + d + 'animation-duration: 0.001s' + r + '; ' + d + 'animation-name: ' + o + r + '; } ', document.head.appendChild(i); const a = setTimeout(function () { document.addEventListener('animationstart', e, !1), document.addEventListener('MSAnimationStart', e, !1), document.addEventListener('webkitAnimationStart', e, !1) }, s.timeout); return { destroy: function () { clearTimeout(a), i && (document.head.removeChild(i), i = null), document.removeEventListener('animationstart', e), document.removeEventListener('MSAnimationStart', e), document.removeEventListener('webkitAnimationStart', e) } } } function a (t) { t.QinsQ = !0 } function f (t) { if (t) for (a(t), t = t.firstChild; t; t = t.nextSibling) void 0 !== t && t.nodeType === 1 && f(t) } function l (t, n) { let e; let i = []; const o = function () { clearTimeout(e), e = setTimeout(function () { i.forEach(f), n(i), i = [] }, 10) }; return r(t, function (t) { if (!c(t)) { a(t); const n = (function t (n) { return c(n.parentNode) || n.nodeName === 'BODY' ? n : t(n.parentNode) }(t)); i.indexOf(n) < 0 && i.push(n), o() } }) } function v (n) { return !(!t || !n.match(/[^{}]/)) && (s.strictlyNew && f(document.body), { every: function (t) { return r(n, t) }, summary: function (t) { return l(n, t) } }) } return v.config = function (t) { for (const n in t)t.hasOwnProperty(n) && (s[n] = t[n]) }, v }()); typeof module !== 'undefined' && void 0 !== module.exports && (module.exports = monitorInsertion)
8
+ const context = {
9
+ isEmbedded: window.parent !== window.self,
10
+ shouldEmitInsteadOfRedirect: false
11
+ }
12
+ const navigateTo = (url) => {
13
+ if (context.shouldEmitInsteadOfRedirect) {
14
+ window.parent.postMessage({
15
+ type: 'navigate',
16
+ payload: url
17
+ }, '*')
18
+ } else {
19
+ window.location = url
20
+ }
21
+ }
22
+ const interceptLogoClick = (url) => {
23
+ document.querySelector('#red-ui-header > span > a')
24
+ .addEventListener('click', (e) => {
25
+ e.preventDefault()
26
+ navigateTo(url)
27
+ })
28
+ }
8
29
 
9
30
  function changeFavicon (src) {
10
31
  const link = document.createElement('link')
@@ -18,6 +39,17 @@
18
39
  document.head.appendChild(link)
19
40
  }
20
41
 
42
+ function handleMessage (event) {
43
+ if (event.data.type === 'prevent-redirect') {
44
+ context.shouldEmitInsteadOfRedirect = event.data.payload
45
+ }
46
+ }
47
+
48
+ if (context.isEmbedded) {
49
+ window.parent.postMessage({ type: 'load', payload: true }, '*')
50
+ window.addEventListener('message', handleMessage)
51
+ }
52
+
21
53
  window.addEventListener('load', (_event) => {
22
54
  // set favicon
23
55
  // eslint-disable-next-line quotes
@@ -34,7 +66,7 @@
34
66
  id: 'usermenu-item-ffsite',
35
67
  label: 'About FlowFuse',
36
68
  onselect: function () {
37
- window.location = 'https://flowfuse.com/'
69
+ navigateTo('https://flowfuse.com/')
38
70
  }
39
71
  })
40
72
  // gather info from settings and page - prep for next 2 menu items
@@ -56,7 +88,7 @@
56
88
  id: 'usermenu-item-ffmain',
57
89
  label: 'FlowFuse Application',
58
90
  onselect: function () {
59
- window.location = projectURL
91
+ navigateTo(projectURL)
60
92
  }
61
93
  })
62
94
  }
@@ -70,6 +102,8 @@
70
102
  }
71
103
  })
72
104
  }
105
+
106
+ interceptLogoClick(projectURL)
73
107
  })
74
108
  })
75
109
  })()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowfuse/nr-theme",
3
- "version": "1.8.1-f1b879d-202312012119.0",
3
+ "version": "1.9.1-6e36168-202404181140.0",
4
4
  "description": "FlowFuse themes for Node-RED",
5
5
  "scripts": {
6
6
  "prepack": "node scripts/prepack.mjs",