@gregoriusrippenstein/node-red-contrib-introspection 0.0.9 → 0.1.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/README.md CHANGED
@@ -53,13 +53,25 @@ Since version 0.0.5 the Screenshot node takes one input. That input will trigger
53
53
 
54
54
  There is an example [flow](/examples/trigger-and-save-screenshot.json) that demonstrates this feature. The author is aware that this is dangerously close to enabling spyware for flow modification, please see the [LICENSE](/LICENSE) and behaviour.
55
55
 
56
+ ### IsMobile
57
+
58
+ Is a palette-only node meaning that it should not be included in any flows. It's single purpose is to remove the palette and sidebars on devices which have a screen width less that 890px. Node-RED has both bars open by default, that makes the mobile experience not so nice. This node is a simple hack that uses `onpaletteadd` callback to close both bars if the device is detected to have "small" width.
59
+
60
+ If this functionality is not desired, then disable this node in the palette manager.
61
+
62
+ ### Navigator
63
+
64
+ Is a palette-only node meaning that it should not be included in any flows. What it does is to highlight nodes if they are referenced in the URL. This node will check the hash value of the URL and if it contains a node id, it will jump to the workspace and focus on the node in question. The node id should be given in the form of `/n/<node id>`, for example: [`.../#flow/878170e6f86c502b/n/b3baf3ca092064a9`](https://demo.openmindmap.org/omm/#flow/878170e6f86c502b/n/b3baf3ca092064a9). Any flow id that is given will be ignored and instead the flow of the node will be shown.
65
+
66
+ This is a hack that uses the `onpaletteadd` callback to do its magic. If this functionality is not desired, then disable this node in the palette manager.
67
+
56
68
  ## Examples
57
69
 
58
70
  There are some example flow contained in the package. There are also examples to be found online:
59
71
 
60
- - [Orphans](https://demo.openmindmap.org/omm/#flow/3ebb65fdbecb182e) - node is top left of flow or search for `type:Orphans`
61
- - [Seeker](https://demo.openmindmap.org/omm/#flow/40ea5f2aea6592ae) - top left and the [Sink](https://demo.openmindmap.org/omm/#flow/459c271a96458c7c) - top right
62
- - [Screenshot](https://demo.openmindmap.org/omm/#flow/4e2d8c13066b705e) - top left
72
+ - [Orphans](https://demo.openmindmap.org/omm/#flow/3ebb65fdbecb182e/n/2be3f8794979d47b) - node is top left of flow or search for `type:Orphans`
73
+ - [Seeker](https://demo.openmindmap.org/omm/#flow/40ea5f2aea6592ae/n/b5f189a78d829197) - top left and the [Sink](https://demo.openmindmap.org/omm/#flow/459c271a96458c7c/n/e3262d9d2791ab78) - top right
74
+ - [Screenshot](https://demo.openmindmap.org/omm/#flow/4e2d8c13066b705e/n/499b1383580831aa) - top left
63
75
 
64
76
  Example screenshot:
65
77
 
@@ -115,7 +115,8 @@
115
115
  var origElem = origElems[idx];
116
116
 
117
117
  ["font-family", "font-size", "font-size-adjust", "font-stretch",
118
- "font-style", "font-variant", "font-weight", "text-anchor"
118
+ "font-style", "font-variant", "font-weight", "text-anchor",
119
+ "dominant-baseline"
119
120
  ].forEach( function(attrname) {
120
121
  elem.setAttribute(attrname,
121
122
  $(origElem).attr(attrname) ||
@@ -0,0 +1,51 @@
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType('IsMobile',{
3
+ color: '#e5e4ef',
4
+ icon: "font-awesome/fa-mobile",
5
+ category: 'introspection',
6
+ defaults: {
7
+ name: {
8
+ value:"",
9
+ },
10
+ },
11
+ inputs:0,
12
+ outputs:0,
13
+
14
+ label: function() {
15
+ return (this.name || this._def.paletteLabel);
16
+ },
17
+
18
+ labelStyle: function() {
19
+ return this.name?"node_label_italic":"";
20
+ },
21
+
22
+ onpaletteadd: () => {
23
+ setTimeout( function() {
24
+ RED.sidebar.info.show()
25
+ }, 1000);
26
+
27
+ // a random value of 890px to indicate mobile, is very arbitrary.
28
+ if ( window.matchMedia('only screen and (max-width: 890px)').matches ) {
29
+ setTimeout( function() {
30
+ // taken from https://discourse.nodered.org/t/togglepalette-v-togglesidebar/78169/3
31
+ RED.actions.invoke("core:toggle-palette", false)
32
+ RED.actions.invoke("core:toggle-sidebar", false)
33
+ }, 1400);
34
+ }
35
+ },
36
+
37
+ onpaletteremove: () => {
38
+ },
39
+ });
40
+ </script>
41
+
42
+ <script type="text/html" data-template-name="IsMobile">
43
+ <div class="form-row">
44
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
45
+ <input type="text" id="node-input-name" placeholder="Name">
46
+ </div>
47
+ </script>
48
+
49
+ <script type="text/html" data-help-name="IsMobile">
50
+ <p>A palette-only node, this does not get included in any flow. This node hides the palette bar and the sidebar on mobile devices. If not required, disable the node in the palette manager.</p>
51
+ </script>
@@ -0,0 +1,17 @@
1
+ module.exports = function(RED) {
2
+ function IsMobileFunctionality(config) {
3
+ RED.nodes.createNode(this,config);
4
+
5
+ var node = this;
6
+ var cfg = config;
7
+
8
+ node.on('close', function() {
9
+ node.status({});
10
+ });
11
+
12
+ node.on("input",function(msg, send, done) {
13
+ send(msg);
14
+ });
15
+ }
16
+ RED.nodes.registerType("IsMobile", IsMobileFunctionality);
17
+ }
@@ -0,0 +1,53 @@
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType('Navigator',{
3
+ color: '#e5e4ef',
4
+ icon: "font-awesome/fa-crosshairs",
5
+ category: 'introspection',
6
+ defaults: {
7
+ name: {
8
+ value:"",
9
+ },
10
+ },
11
+ inputs:0,
12
+ outputs:0,
13
+
14
+ label: function() {
15
+ return (this.name || this._def.paletteLabel);
16
+ },
17
+
18
+ labelStyle: function() {
19
+ return this.name?"node_label_italic":"";
20
+ },
21
+
22
+ onpaletteadd: () => {
23
+ var nodeId = window.location.hash.match(/\/n\/(.{16})/);
24
+
25
+ // RED.nodes is not initialised at this point, so there is no way to
26
+ // check whether the nodeId really does exist, so we assume that nodeId
27
+ // will be eventually addded to a workspace.
28
+ if ( nodeId ) {
29
+ var hndlr = (node) => {
30
+ if ( node.id == nodeId[1] ) {
31
+ setTimeout( function() {
32
+ RED.workspaces.show(RED.nodes.node(nodeId[1]).z,false,false,true);
33
+ RED.view.reveal(nodeId[1],true)
34
+ }, 1234);
35
+ RED.events.off("nodes:add", hndlr);
36
+ }
37
+ };
38
+ RED.events.on("nodes:add", hndlr);
39
+ }
40
+ },
41
+ });
42
+ </script>
43
+
44
+ <script type="text/html" data-template-name="Navigator">
45
+ <div class="form-row">
46
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
47
+ <input type="text" id="node-input-name" placeholder="Name">
48
+ </div>
49
+ </script>
50
+
51
+ <script type="text/html" data-help-name="Navigator">
52
+ <p>A palette-only node, this does not get included in any flow. This node ensures that nodes are focused on when the url contains `/n/[nodeid]`. If not required, disable the node in the palette manager.</p>
53
+ </script>
@@ -0,0 +1,17 @@
1
+ module.exports = function(RED) {
2
+ function NavigatorFunctionality(config) {
3
+ RED.nodes.createNode(this,config);
4
+
5
+ var node = this;
6
+ var cfg = config;
7
+
8
+ node.on('close', function() {
9
+ node.status({});
10
+ });
11
+
12
+ node.on("input",function(msg, send, done) {
13
+ send(msg);
14
+ });
15
+ }
16
+ RED.nodes.registerType("Navigator", NavigatorFunctionality);
17
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gregoriusrippenstein/node-red-contrib-introspection",
3
- "version": "0.0.9",
3
+ "version": "0.1.0",
4
4
  "keywords": [
5
5
  "node-red"
6
6
  ],
@@ -8,7 +8,7 @@
8
8
  "license": "SEE LICENSE IN https://github.com/gorenje/node-red-contrib-introspection/blob/main/LICENSE",
9
9
  "author": "Gerrit Riessen <nodered@spreads-the.love> (https://spread-the.love)",
10
10
  "engines": {
11
- "node": ">=6"
11
+ "node": ">=8"
12
12
  },
13
13
  "node-red": {
14
14
  "version": ">=2.0.0",
@@ -16,7 +16,9 @@
16
16
  "seeker": "nodes/05-seeker.js",
17
17
  "sink": "nodes/10-sink.js",
18
18
  "screenshot": "nodes/15-screenshot.js",
19
- "orphans": "nodes/20-orphans.js"
19
+ "orphans": "nodes/20-orphans.js",
20
+ "ismobile": "nodes/25-ismobile.js",
21
+ "navigator": "nodes/30-navigator.js"
20
22
  }
21
23
  },
22
24
  "description": "Node-RED Editor-only nodes for introspecting flows.",