diff --git a/CHANGELOG.md b/CHANGELOG.md index bd3793487..87fcc30bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,42 @@ +#### 3.0.0-beta.3: Beta Release + +Editor + + - Add Right-Click content menu (#3678) @knolleary + - Fix disable junction (#3671) @HiroyasuNishiyama + - Add Japanese translations for v2.2.3 (#3672) @kazuhitoyokoi + - Reset mouse state when switching tabs (#3643) @knolleary + - Fix uncorrect fix of junction to subflow conversion (#3666) @HiroyasuNishiyama + - Fix undoing junction to subflow (#3653) @HiroyasuNishiyama + - Fix conversion of junction to subflow (#3652) @HiroyasuNishiyama + - Fix to include junction to exported nodes (#3650) @HiroyasuNishiyama + - Fix z-index value for shade to cover nodes in palette (#3649) @kazuhitoyokoi + - Fix to extend escaped subflow category characters (#3647) @HiroyasuNishiyama + - Fix to sanitize tab name (#3646) @HiroyasuNishiyama + - Fix selector placement (#3644) @bonanitech + - Add Japanese translations for v3.0-beta.2 (#3622) @kazuhitoyokoi + - Fix new folder menu of save to library dialog (#3633) @HiroyasuNishiyama + - Fix layer of palette node (#3638) @HiroyasuNishiyama + - Fix to place a node dragged from palette within the workspace (#3637) @HiroyasuNishiyama + - Fix typo in CSS (#3628) @bonanitech + - Use the correct variable for the gutter text color (#3615) @bonanitech + + +Runtime + + - Support loading node modules from `nodesdir` (#3676) @Steve-Mcl + - fix buffer parse error message of evaluateNodeProperty (#3624) @HiroyasuNishiyama + +Nodes + + - File: Further simplify file node filename entry UX (v3) (#3677) @Steve-Mcl + - Function: Fix initial cursor position of init/finalize tab of function node (#3674) @HiroyasuNishiyama + - Function: Fix ESM module loading in Function node (#3645) @knolleary + - Inject: Fix JSONata evaluation of inject button (#3632) @HiroyasuNishiyama + - TCP: Dont delete TCP socket twice (#3630) @Steve-Mcl + - MQTT Node: define noproxy variable (#3626) @Steve-Mcl + - Debug: i18n debug sidebar node label (#3623) @HiroyasuNishiyama + #### 3.0.0-beta.2: Beta Release **Migration from 2.x** diff --git a/Gruntfile.js b/Gruntfile.js index af0aa0e95..2f81da923 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -193,6 +193,7 @@ module.exports = function(grunt) { "packages/node_modules/@node-red/editor-client/src/js/ui/library.js", "packages/node_modules/@node-red/editor-client/src/js/ui/notifications.js", "packages/node_modules/@node-red/editor-client/src/js/ui/search.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/contextMenu.js", "packages/node_modules/@node-red/editor-client/src/js/ui/actionList.js", "packages/node_modules/@node-red/editor-client/src/js/ui/typeSearch.js", "packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js", diff --git a/package.json b/package.json index d22cf89dd..1343af50c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red", - "version": "3.0.0-beta.2", + "version": "3.0.0-beta.3", "description": "Low-code programming for event-driven applications", "homepage": "http://nodered.org", "license": "Apache-2.0", @@ -49,7 +49,7 @@ "hash-sum": "2.0.0", "hpagent": "1.0.0", "https-proxy-agent": "5.0.1", - "i18next": "21.8.2", + "i18next": "21.8.10", "iconv-lite": "0.6.3", "is-utf8": "0.2.1", "js-yaml": "4.1.0", @@ -62,7 +62,7 @@ "moment": "2.29.3", "moment-timezone": "0.5.34", "mqtt": "4.3.7", - "multer": "1.4.4", + "multer": "1.4.5-lts.1", "mustache": "4.2.0", "node-red-admin": "^3.0.0", "node-watch": "0.7.3", @@ -76,7 +76,7 @@ "semver": "7.3.7", "tar": "6.1.11", "tough-cookie": "4.0.0", - "uglify-js": "3.15.5", + "uglify-js": "3.16.0", "uuid": "8.3.2", "ws": "7.5.6", "xml2js": "0.4.23" @@ -105,16 +105,16 @@ "grunt-sass": "~3.1.0", "grunt-simple-mocha": "~0.4.1", "grunt-simple-nyc": "^3.0.1", - "i18next-http-backend": "1.4.0", + "i18next-http-backend": "1.4.1", "jquery-i18next": "1.2.1", "jsdoc-nr-template": "github:node-red/jsdoc-nr-template", - "marked": "4.0.15", + "marked": "4.0.17", "minami": "1.2.3", "mocha": "9.2.2", "node-red-node-test-helper": "^0.2.7", "nodemon": "2.0.16", "proxy": "^1.0.2", - "sass": "1.51.0", + "sass": "1.52.3", "should": "13.2.3", "sinon": "11.1.2", "stoppable": "^1.1.0", diff --git a/packages/node_modules/@node-red/editor-api/package.json b/packages/node_modules/@node-red/editor-api/package.json index 793c5e516..874fc2cec 100644 --- a/packages/node_modules/@node-red/editor-api/package.json +++ b/packages/node_modules/@node-red/editor-api/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/editor-api", - "version": "3.0.0-beta.2", + "version": "3.0.0-beta.3", "license": "Apache-2.0", "main": "./lib/index.js", "repository": { @@ -16,8 +16,8 @@ } ], "dependencies": { - "@node-red/util": "3.0.0-beta.2", - "@node-red/editor-client": "3.0.0-beta.2", + "@node-red/util": "3.0.0-beta.3", + "@node-red/editor-client": "3.0.0-beta.3", "bcryptjs": "2.4.3", "body-parser": "1.20.0", "clone": "2.1.2", @@ -26,7 +26,7 @@ "express": "4.18.1", "memorystore": "1.6.7", "mime": "3.0.0", - "multer": "1.4.4", + "multer": "1.4.5-lts.1", "mustache": "4.2.0", "oauth2orize": "1.11.1", "passport-http-bearer": "1.0.1", diff --git a/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json b/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json index 4f3a3b104..e3028272b 100755 --- a/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json @@ -3,7 +3,7 @@ "label": { "name": "Name", "ok": "Ok", - "done":"Done", + "done": "Done", "cancel": "Cancel", "delete": "Delete", "close": "Close", @@ -66,7 +66,7 @@ "listSubflows": "List subflows", "status": "Status", "enabled": "Enabled", - "disabled":"Disabled", + "disabled": "Disabled", "info": "Description", "selectNodes": "Click nodes to select" }, @@ -114,7 +114,7 @@ "keyboardShortcuts": "Keyboard shortcuts", "login": "Login", "logout": "Logout", - "editPalette":"Manage palette", + "editPalette": "Manage palette", "other": "Other", "showTips": "Show tips", "showWelcomeTours": "Show guided tours for new versions", @@ -130,19 +130,19 @@ "ungroupSelection": "Ungroup selection", "groupMergeSelection": "Merge selection", "groupRemoveSelection": "Remove from group", - "arrange":"Arrange", - "alignLeft":"Align to left", - "alignCenter":"Align to center", - "alignRight":"Align to right", - "alignTop":"Align to top", - "alignMiddle":"Align to middle", - "alignBottom":"Align to bottom", - "distributeHorizontally":"Distribute horizontally", - "distributeVertically":"Distribute vertically", - "moveToBack":"Move to back", - "moveToFront":"Move to front", - "moveBackwards":"Move backwards", - "moveForwards":"Move forwards" + "arrange": "Arrange", + "alignLeft": "Align to left", + "alignCenter": "Align to center", + "alignRight": "Align to right", + "alignTop": "Align to top", + "alignMiddle": "Align to middle", + "alignBottom": "Align to bottom", + "distributeHorizontally": "Distribute horizontally", + "distributeVertically": "Distribute vertically", + "moveToBack": "Move to back", + "moveToFront": "Move to front", + "moveBackwards": "Move backwards", + "moveForwards": "Move forwards" } }, "actions": { @@ -176,10 +176,10 @@ "nodeActionDisabledSubflow": "node actions disabled within subflow", "missing-types": "

Flows stopped due to missing node types.

", "missing-modules": "

Flows stopped due to missing modules.

", - "safe-mode":"

Flows stopped in safe mode.

You can modify your flows and deploy the changes to restart.

", + "safe-mode": "

Flows stopped in safe mode.

You can modify your flows and deploy the changes to restart.

", "restartRequired": "Node-RED must be restarted to enable upgraded modules", "credentials_load_failed": "

Flows stopped as the credentials could not be decrypted.

The flow credential file is encrypted, but the project's encryption key is missing or invalid.

", - "credentials_load_failed_reset":"

Credentials could not be decrypted

The flow credential file is encrypted, but the project's encryption key is missing or invalid.

The flow credential file will be reset on the next deployment. Any existing flow credentials will be cleared.

", + "credentials_load_failed_reset": "

Credentials could not be decrypted

The flow credential file is encrypted, but the project's encryption key is missing or invalid.

The flow credential file will be reset on the next deployment. Any existing flow credentials will be cleared.

", "missing_flow_file": "

Project flow file not found.

The project is not configured with a flow file.

", "missing_package_file": "

Project package file not found.

The project is missing a package.json file.

", "project_empty": "

The project is empty.

Do you want to create a default set of project files?
Otherwise, you will have to manually add files to the project outside of the editor.

", @@ -257,11 +257,11 @@ "recoveredNodesInfo": "The nodes on this flow were missing a valid flow id when they were imported. They have been added to this flow so you can either restore or delete them.", "recoveredNodesNotification": "

Imported nodes without a valid flow id

They have been added to a new flow called '__flowName__'.

", "export": { - "selected":"selected nodes", - "current":"current flow", - "all":"all flows", - "compact":"compact", - "formatted":"formatted", + "selected": "selected nodes", + "current": "current flow", + "all": "all flows", + "compact": "compact", + "formatted": "formatted", "copy": "Copy to clipboard", "export": "Export to library", "exportAs": "Export as", @@ -301,10 +301,10 @@ "successfulDeploy": "Successfully deployed", "successfulRestart": "Successfully restarted flows", "deployFailed": "Deploy failed: __message__", - "unusedConfigNodes":"You have some unused configuration nodes.", - "unusedConfigNodesButton":"Search unused config nodes", - "unknownNodesButton":"Search for unknown nodes", - "invalidNodesButton":"Search for invalid nodes", + "unusedConfigNodes": "You have some unused configuration nodes.", + "unusedConfigNodesButton": "Search unused config nodes", + "unknownNodesButton": "Search for unknown nodes", + "invalidNodesButton": "Search for invalid nodes", "errors": { "noResponse": "no response from server" }, @@ -351,8 +351,8 @@ }, "nodeCount": "__count__ node", "nodeCount_plural": "__count__ nodes", - "local":"Local changes", - "remote":"Remote changes", + "local": "Local changes", + "remote": "Remote changes", "reviewChanges": "Review Changes", "noBinaryFileShowed": "Cannot show binary file contents", "viewCommitDiff": "View Commit Changes", @@ -436,7 +436,7 @@ "inputType": "Input type", "selectType": "select types...", "loadCredentials": "Loading node credentials", - "inputs" : { + "inputs": { "input": "input", "select": "select", "checkbox": "checkbox", @@ -617,19 +617,19 @@ }, "confirm": { "install": { - "body":"

Installing '__module__'

Before installing, please read the node's documentation. Some nodes have dependencies that cannot be automatically resolved and can require a restart of Node-RED.

", + "body": "

Installing '__module__'

Before installing, please read the node's documentation. Some nodes have dependencies that cannot be automatically resolved and can require a restart of Node-RED.

", "title": "Install nodes" }, "remove": { - "body":"

Removing '__module__'

Removing the node will uninstall it from Node-RED. The node may continue to use resources until Node-RED is restarted.

", + "body": "

Removing '__module__'

Removing the node will uninstall it from Node-RED. The node may continue to use resources until Node-RED is restarted.

", "title": "Remove nodes" }, "update": { - "body":"

Updating '__module__'

Updating the node will require a restart of Node-RED to complete the update. This must be done manually.

", + "body": "

Updating '__module__'

Updating the node will require a restart of Node-RED to complete the update. This must be done manually.

", "title": "Update nodes" }, "cannotUpdate": { - "body":"An update for this node is available, but it is not installed in a location that the palette manager can update.

Please refer to the documentation for how to update this node." + "body": "An update for this node is available, but it is not installed in a location that the palette manager can update.

Please refer to the documentation for how to update this node." }, "button": { "review": "Open node information", @@ -663,14 +663,14 @@ "showMore": "show more", "showLess": "show less", "flow": "Flow", - "selection":"Selection", - "nodes":"__count__ nodes", + "selection": "Selection", + "nodes": "__count__ nodes", "flowDesc": "Flow Description", "subflowDesc": "Subflow Description", "nodeHelp": "Node Help", - "none":"None", + "none": "None", "arrayItems": "__count__ items", - "showTips":"You can open the tips from the settings panel", + "showTips": "You can open the tips from the settings panel", "outline": "Outline", "empty": "empty", "globalConfig": "Global Configuration Nodes", @@ -701,8 +701,8 @@ "filtered": "__count__ hidden" }, "context": { - "name":"Context Data", - "label":"context", + "name": "Context Data", + "label": "context", "none": "none selected", "refresh": "refresh to load", "empty": "empty", @@ -740,9 +740,9 @@ "files": "Files", "flow": "Flow", "credentials": "Credentials", - "package":"Package", - "packageCreate":"File will be created when changes are saved", - "fileNotExist":"File does not exist", + "package": "Package", + "packageCreate": "File will be created when changes are saved", + "fileNotExist": "File does not exist", "selectFile": "Select File", "invalidEncryptionKey": "Invalid encryption key", "encryptionEnabled": "Encryption enabled", @@ -978,7 +978,7 @@ "title": "Buffer editor", "modeString": "Handle as UTF-8 String", "modeArray": "Handle as JSON array", - "modeDesc":"

Buffer editor

The Buffer type is stored as a JSON array of byte values. The editor will attempt to parse the entered value as a JSON array. If it is not valid JSON, it will be treated as a UTF-8 String and converted to an array of the individual character code points.

For example, a value of Hello World will be converted to the JSON array:

[72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]

" + "modeDesc": "

Buffer editor

The Buffer type is stored as a JSON array of byte values. The editor will attempt to parse the entered value as a JSON array. If it is not valid JSON, it will be treated as a UTF-8 String and converted to an array of the individual character code points.

For example, a value of Hello World will be converted to the JSON array:

[72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]

" }, "projects": { "config-git": "Configure Git client", @@ -1140,7 +1140,7 @@ "no-empty": "Cannot create default file set on a non-empty project", "git-error": "git error" }, - "errors" : { + "errors": { "no-username-email": "Your Git client is not configured with a username/email.", "unexpected": "An unexpected error occurred", "code": "code" @@ -1163,7 +1163,7 @@ "diagnostics": { "title": "System Info" }, - "languages" : { + "languages": { "de": "German", "en-US": "English", "ja": "Japanese", @@ -1174,18 +1174,24 @@ }, "validator": { "errors": { - "invalid-json": "Invalid JSON data: __error__", - "invalid-json-prop": "__prop__: invalid JSON data: __error__", - "invalid-prop": "Invalid property expression", - "invalid-prop-prop": "__prop__: invalid property expression", - "invalid-num": "Invalid number", - "invalid-num-prop": "__prop__: invalid number", - "invalid-regexp": "Invalid input pattern", - "invalid-regex-prop": "__prop__: invalid input pattern", - "missing-required-prop": "__prop__: property value missing", - "invalid-config": "__prop__: invalid configuration node", - "missing-config": "__prop__: missing configuration node", - "validation-error": "__prop__: validation error: __node__, __id__: __error__" - } + "invalid-json": "Invalid JSON data: __error__", + "invalid-json-prop": "__prop__: invalid JSON data: __error__", + "invalid-prop": "Invalid property expression", + "invalid-prop-prop": "__prop__: invalid property expression", + "invalid-num": "Invalid number", + "invalid-num-prop": "__prop__: invalid number", + "invalid-regexp": "Invalid input pattern", + "invalid-regex-prop": "__prop__: invalid input pattern", + "missing-required-prop": "__prop__: property value missing", + "invalid-config": "__prop__: invalid configuration node", + "missing-config": "__prop__: missing configuration node", + "validation-error": "__prop__: validation error: __node__, __id__: __error__" + } + }, + "contextMenu": { + "insert": "Insert", + "node": "Node", + "junction": "Junction", + "linkNodes": "Link Nodes" } } diff --git a/packages/node_modules/@node-red/editor-client/locales/en-US/infotips.json b/packages/node_modules/@node-red/editor-client/locales/en-US/infotips.json index 21a7e735f..a958868ee 100755 --- a/packages/node_modules/@node-red/editor-client/locales/en-US/infotips.json +++ b/packages/node_modules/@node-red/editor-client/locales/en-US/infotips.json @@ -1,23 +1,23 @@ { "info": { - "tip0" : "You can remove the selected nodes or links with {{core:delete-selection}}", - "tip1" : "Search for nodes using {{core:search}}", - "tip2" : "{{core:toggle-sidebar}} will toggle the view of this sidebar", - "tip3" : "You can manage your palette of nodes with {{core:manage-palette}}", - "tip4" : "Your flow configuration nodes are listed in the sidebar panel. It can be accessed from the menu or with {{core:show-config-tab}}", - "tip5" : "Enable or disable these tips from the option in the settings", - "tip6" : "Move the selected nodes using the [left] [up] [down] and [right] keys. Hold [shift] to nudge them further", - "tip7" : "Dragging a node onto a wire will splice it into the link", - "tip8" : "Export the selected nodes, or the current tab with {{core:show-export-dialog}}", - "tip9" : "Import a flow by dragging its JSON into the editor, or with {{core:show-import-dialog}}", - "tip10" : "[shift] [click] and drag on a node port to move all of the attached wires or just the selected one", - "tip11" : "Show the Info tab with {{core:show-info-tab}} or the Debug tab with {{core:show-debug-tab}}", - "tip12" : "[ctrl] [click] in the workspace to open the quick-add dialog", - "tip13" : "Hold down [ctrl] when you [click] on a node port to enable quick-wiring", - "tip14" : "Hold down [shift] when you [click] on a node to also select all of its connected nodes", - "tip15" : "Hold down [ctrl] when you [click] on a node to add or remove it from the current selection", - "tip16" : "Switch flow tabs with {{core:show-previous-tab}} and {{core:show-next-tab}}", - "tip17" : "You can confirm your changes in the node edit tray with {{core:confirm-edit-tray}} or cancel them with {{core:cancel-edit-tray}}", - "tip18" : "Pressing {{core:edit-selected-node}} will edit the first node in the current selection" + "tip0": "You can remove the selected nodes or links with {{core:delete-selection}}", + "tip1": "Search for nodes using {{core:search}}", + "tip2": "{{core:toggle-sidebar}} will toggle the view of this sidebar", + "tip3": "You can manage your palette of nodes with {{core:manage-palette}}", + "tip4": "Your flow configuration nodes are listed in the sidebar panel. It can be accessed from the menu or with {{core:show-config-tab}}", + "tip5": "Enable or disable these tips from the option in the settings", + "tip6": "Move the selected nodes using the [left] [up] [down] and [right] keys. Hold [shift] to nudge them further", + "tip7": "Dragging a node onto a wire will splice it into the link", + "tip8": "Export the selected nodes, or the current tab with {{core:show-export-dialog}}", + "tip9": "Import a flow by dragging its JSON into the editor, or with {{core:show-import-dialog}}", + "tip10": "[shift] [click] and drag on a node port to move all of the attached wires or just the selected one", + "tip11": "Show the Info tab with {{core:show-info-tab}} or the Debug tab with {{core:show-debug-tab}}", + "tip12": "[ctrl] [click] in the workspace to open the quick-add dialog", + "tip13": "Hold down [ctrl] when you [click] on a node port to enable quick-wiring", + "tip14": "Hold down [shift] when you [click] on a node to also select all of its connected nodes", + "tip15": "Hold down [ctrl] when you [click] on a node to add or remove it from the current selection", + "tip16": "Switch flow tabs with {{core:show-previous-tab}} and {{core:show-next-tab}}", + "tip17": "You can confirm your changes in the node edit tray with {{core:confirm-edit-tray}} or cancel them with {{core:cancel-edit-tray}}", + "tip18": "Pressing {{core:edit-selected-node}} will edit the first node in the current selection" } } diff --git a/packages/node_modules/@node-red/editor-client/locales/en-US/jsonata.json b/packages/node_modules/@node-red/editor-client/locales/en-US/jsonata.json index 6a00a3c09..b24a898b7 100755 --- a/packages/node_modules/@node-red/editor-client/locales/en-US/jsonata.json +++ b/packages/node_modules/@node-red/editor-client/locales/en-US/jsonata.json @@ -52,52 +52,52 @@ "desc": "Finds occurrences of `pattern` within `str` and replaces them with `replacement`.\n\nThe optional `limit` parameter is the maximum number of replacements." }, "$now": { - "args":"$[picture [, timezone]]", - "desc":"Generates a timestamp in ISO 8601 compatible format and returns it as a string. If the optional picture and timezone parameters are supplied, then the current timestamp is formatted as described by the `$fromMillis()` function" + "args": "$[picture [, timezone]]", + "desc": "Generates a timestamp in ISO 8601 compatible format and returns it as a string. If the optional picture and timezone parameters are supplied, then the current timestamp is formatted as described by the `$fromMillis()` function" }, "$base64encode": { - "args":"string", - "desc":"Converts an ASCII string to a base 64 representation. Each character in the string is treated as a byte of binary data. This requires that all characters in the string are in the 0x00 to 0xFF range, which includes all characters in URI encoded strings. Unicode characters outside of that range are not supported." + "args": "string", + "desc": "Converts an ASCII string to a base 64 representation. Each character in the string is treated as a byte of binary data. This requires that all characters in the string are in the 0x00 to 0xFF range, which includes all characters in URI encoded strings. Unicode characters outside of that range are not supported." }, "$base64decode": { - "args":"string", - "desc":"Converts base 64 encoded bytes to a string, using a UTF-8 Unicode codepage." + "args": "string", + "desc": "Converts base 64 encoded bytes to a string, using a UTF-8 Unicode codepage." }, "$number": { "args": "arg", "desc": "Casts the `arg` parameter to a number using the following casting rules:\n\n - Numbers are unchanged\n - Strings that contain a sequence of characters that represent a legal JSON number are converted to that number\n - All other values cause an error to be thrown." }, "$abs": { - "args":"number", - "desc":"Returns the absolute value of the `number` parameter." + "args": "number", + "desc": "Returns the absolute value of the `number` parameter." }, "$floor": { - "args":"number", - "desc":"Returns the value of `number` rounded down to the nearest integer that is smaller or equal to `number`." + "args": "number", + "desc": "Returns the value of `number` rounded down to the nearest integer that is smaller or equal to `number`." }, "$ceil": { - "args":"number", - "desc":"Returns the value of `number` rounded up to the nearest integer that is greater than or equal to `number`." + "args": "number", + "desc": "Returns the value of `number` rounded up to the nearest integer that is greater than or equal to `number`." }, "$round": { - "args":"number [, precision]", - "desc":"Returns the value of the `number` parameter rounded to the number of decimal places specified by the optional `precision` parameter." + "args": "number [, precision]", + "desc": "Returns the value of the `number` parameter rounded to the number of decimal places specified by the optional `precision` parameter." }, "$power": { - "args":"base, exponent", - "desc":"Returns the value of `base` raised to the power of `exponent`." + "args": "base, exponent", + "desc": "Returns the value of `base` raised to the power of `exponent`." }, "$sqrt": { - "args":"number", - "desc":"Returns the square root of the value of the `number` parameter." + "args": "number", + "desc": "Returns the square root of the value of the `number` parameter." }, "$random": { - "args":"", - "desc":"Returns a pseudo random number greater than or equal to zero and less than one." + "args": "", + "desc": "Returns a pseudo random number greater than or equal to zero and less than one." }, "$millis": { - "args":"", - "desc":"Returns the number of milliseconds since the Unix Epoch (1 January, 1970 UTC) as a number. All invocations of `$millis()` within an evaluation of an expression will all return the same value." + "args": "", + "desc": "Returns the number of milliseconds since the Unix Epoch (1 January, 1970 UTC) as a number. All invocations of `$millis()` within an evaluation of an expression will all return the same value." }, "$sum": { "args": "array", @@ -136,20 +136,20 @@ "desc": "Appends two arrays" }, "$sort": { - "args":"array [, function]", - "desc":"Returns an array containing all the values in the `array` parameter, but sorted into order.\n\nIf a comparator `function` is supplied, then it must be a function that takes two parameters:\n\n`function(left, right)`\n\nThis function gets invoked by the sorting algorithm to compare two values left and right. If the value of left should be placed after the value of right in the desired sort order, then the function must return Boolean `true` to indicate a swap. Otherwise it must return `false`." + "args": "array [, function]", + "desc": "Returns an array containing all the values in the `array` parameter, but sorted into order.\n\nIf a comparator `function` is supplied, then it must be a function that takes two parameters:\n\n`function(left, right)`\n\nThis function gets invoked by the sorting algorithm to compare two values left and right. If the value of left should be placed after the value of right in the desired sort order, then the function must return Boolean `true` to indicate a swap. Otherwise it must return `false`." }, "$reverse": { - "args":"array", - "desc":"Returns an array containing all the values from the `array` parameter, but in reverse order." + "args": "array", + "desc": "Returns an array containing all the values from the `array` parameter, but in reverse order." }, "$shuffle": { - "args":"array", - "desc":"Returns an array containing all the values from the `array` parameter, but shuffled into random order." + "args": "array", + "desc": "Returns an array containing all the values from the `array` parameter, but shuffled into random order." }, "$zip": { - "args":"array, ...", - "desc":"Returns a convolved (zipped) array containing grouped arrays of values from the `array1` … `arrayN` arguments from index 0, 1, 2...." + "args": "array, ...", + "desc": "Returns a convolved (zipped) array containing grouped arrays of values from the `array1` … `arrayN` arguments from index 0, 1, 2...." }, "$keys": { "args": "object", @@ -168,24 +168,24 @@ "desc": "Merges an array of `objects` into a single `object` containing all the key/value pairs from each of the objects in the input array. If any of the input objects contain the same key, then the returned `object` will contain the value of the last one in the array. It is an error if the input array contains an item that is not an object." }, "$sift": { - "args":"object, function", - "desc":"Returns an object that contains only the key/value pairs from the `object` parameter that satisfy the predicate `function` passed in as the second parameter.\n\nThe `function` that is supplied as the second parameter must have the following signature:\n\n`function(value [, key [, object]])`" + "args": "object, function", + "desc": "Returns an object that contains only the key/value pairs from the `object` parameter that satisfy the predicate `function` passed in as the second parameter.\n\nThe `function` that is supplied as the second parameter must have the following signature:\n\n`function(value [, key [, object]])`" }, "$each": { - "args":"object, function", - "desc":"Returns an array containing the values return by the `function` when applied to each key/value pair in the `object`." + "args": "object, function", + "desc": "Returns an array containing the values return by the `function` when applied to each key/value pair in the `object`." }, "$map": { - "args":"array, function", - "desc":"Returns an array containing the results of applying the `function` parameter to each value in the `array` parameter.\n\nThe `function` that is supplied as the second parameter must have the following signature:\n\n`function(value [, index [, array]])`" + "args": "array, function", + "desc": "Returns an array containing the results of applying the `function` parameter to each value in the `array` parameter.\n\nThe `function` that is supplied as the second parameter must have the following signature:\n\n`function(value [, index [, array]])`" }, "$filter": { - "args":"array, function", - "desc":"Returns an array containing only the values in the `array` parameter that satisfy the `function` predicate.\n\nThe `function` that is supplied as the second parameter must have the following signature:\n\n`function(value [, index [, array]])`" + "args": "array, function", + "desc": "Returns an array containing only the values in the `array` parameter that satisfy the `function` predicate.\n\nThe `function` that is supplied as the second parameter must have the following signature:\n\n`function(value [, index [, array]])`" }, "$reduce": { - "args":"array, function [, init]", - "desc":"Returns an aggregated value derived from applying the `function` parameter successively to each value in `array` in combination with the result of the previous application of the function.\n\nThe function must accept two arguments, and behaves like an infix operator between each value within the `array`. The signature of `function` must be of the form: `myfunc($accumulator, $value[, $index[, $array]])`\n\nThe optional `init` parameter is used as the initial value in the aggregation." + "args": "array, function [, init]", + "desc": "Returns an aggregated value derived from applying the `function` parameter successively to each value in `array` in combination with the result of the previous application of the function.\n\nThe function must accept two arguments, and behaves like an infix operator between each value within the `array`. The signature of `function` must be of the form: `myfunc($accumulator, $value[, $index[, $array]])`\n\nThe optional `init` parameter is used as the initial value in the aggregation." }, "$flowContext": { "args": "string[, string]", diff --git a/packages/node_modules/@node-red/editor-client/locales/ja/editor.json b/packages/node_modules/@node-red/editor-client/locales/ja/editor.json index 9713e2bab..2849070bf 100644 --- a/packages/node_modules/@node-red/editor-client/locales/ja/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/ja/editor.json @@ -907,7 +907,8 @@ "uknownNodes": "未知のノード", "unusedSubflows": "未使用のサブフロー", "hiddenFlows": "非表示のフロー", - "modifiedNodes": "修正したノードやフロー" + "modifiedNodes": "修正したノードやフロー", + "thisFlow": "現在のフロー" } }, "expressionEditor": { @@ -1187,6 +1188,12 @@ "validation-error": "__prop__: チェックエラー: __node__, __id__: __error__" } }, + "contextMenu": { + "insert": "挿入", + "node": "ノード", + "junction": "分岐点", + "linkNodes": "Linkノード" + }, "action-list": { "toggle-show-tips": "ヒント表示切替", "show-about": "Node-REDの説明を表示", @@ -1301,7 +1308,7 @@ "search": "検索", "search-previous": "前を検索", "search-next": "次を検索", - "show-action-list": "アクション一覧を表示", + "show-action-list": "動作一覧を表示", "confirm-edit-tray": "編集を完了", "cancel-edit-tray": "編集をキャンセル", "show-remote-diff": "リモートとの変更差分を表示", @@ -1323,6 +1330,11 @@ "zoom-out": "ズームアウト", "zoom-reset": "ズームリセット", "toggle-navigator": "ナビゲータ表示切替", - "show-system-info": "システムインフォメーション" + "show-system-info": "システム情報", + "split-wires-with-junctions": "分岐点によりワイヤーを分割", + "new-project": "新しいプロジェクト", + "open-project": "プロジェクトを開く", + "show-project-settings": "プロジェクト設定を表示", + "show-version-control-tab": "バージョンコントロールタブを表示" } } diff --git a/packages/node_modules/@node-red/editor-client/locales/ja/infotips.json b/packages/node_modules/@node-red/editor-client/locales/ja/infotips.json index 45ba8450e..14459fa10 100644 --- a/packages/node_modules/@node-red/editor-client/locales/ja/infotips.json +++ b/packages/node_modules/@node-red/editor-client/locales/ja/infotips.json @@ -17,7 +17,7 @@ "tip14": "[shift] を押しながらノードを [click] すると、接続された全てのノードを選択できます。", "tip15": "[ctrl] を押しながらノードを [click] すると、選択/非選択を切り替えできます。", "tip16": "{{core:show-previous-tab}} や {{core:show-next-tab}} で、タブの切り替えができます。", - "tip17": "ノードのプロバティ設定画面にて {{core:confirm-edit-tray}} を押すと、変更を確定できます。また、 {{core:cancel-edit-tray}} を押すと、変更を取り消せます。", + "tip17": "ノードのプロパティ設定画面にて {{core:confirm-edit-tray}} を押すと、変更を確定できます。また、 {{core:cancel-edit-tray}} を押すと、変更を取り消せます。", "tip18": "ノードを選択し、 {{core:edit-selected-node}} を押すとプロパティ設定画面が表示されます。" } } diff --git a/packages/node_modules/@node-red/editor-client/package.json b/packages/node_modules/@node-red/editor-client/package.json index 4380f5170..2a32cbded 100644 --- a/packages/node_modules/@node-red/editor-client/package.json +++ b/packages/node_modules/@node-red/editor-client/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/editor-client", - "version": "3.0.0-beta.2", + "version": "3.0.0-beta.3", "license": "Apache-2.0", "repository": { "type": "git", diff --git a/packages/node_modules/@node-red/editor-client/src/js/history.js b/packages/node_modules/@node-red/editor-client/src/js/history.js index f900276a0..b23071239 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/history.js +++ b/packages/node_modules/@node-red/editor-client/src/js/history.js @@ -22,6 +22,14 @@ RED.history = (function() { var undoHistory = []; var redoHistory = []; + function nodeOrJunction(id) { + var node = RED.nodes.node(id); + if (node) { + return node; + } + return RED.nodes.junction(id); + } + function undoEvent(ev) { var i; var len; @@ -514,6 +522,7 @@ RED.history = (function() { var z = ev.activeWorkspace; var fullNodeList = RED.nodes.filterNodes({z:ev.subflow.subflow.id}); fullNodeList = fullNodeList.concat(RED.nodes.groups(ev.subflow.subflow.id)) + fullNodeList = fullNodeList.concat(RED.nodes.junctions(ev.subflow.subflow.id)) fullNodeList.forEach(function(n) { n.x += ev.subflow.offsetX; n.y += ev.subflow.offsetY; @@ -523,7 +532,7 @@ RED.history = (function() { }); inverseEv.subflows = []; for (i=0;i'); } else { item = $('
  • '); - + if (!opt.id) { + opt.id = 'red-ui-menu-item-'+(menuItemCount++) + } if (opt.group) { item.addClass("red-ui-menu-group-"+opt.group); - } var linkContent = ''; if (opt.toggle) { - linkContent += ''; - linkContent += ''; + linkContent += ''; + linkContent += ''; } if (opt.icon !== undefined) { @@ -77,12 +79,15 @@ RED.menu = (function() { linkContent += ' '; } } - + let label = opt.label + if (!opt.label && typeof opt.onselect === 'string') { + label = RED.actions.getLabel(opt.onselect) + } if (opt.sublabel) { - linkContent += ''+opt.label+''+ + linkContent += ''+label+''+ ''+opt.sublabel+'' } else { - linkContent += ''+opt.label+'' + linkContent += ''+label+'' } linkContent += ''; @@ -126,15 +131,38 @@ RED.menu = (function() { }); } if (opt.options) { - item.addClass("red-ui-menu-dropdown-submenu pull-left"); + item.addClass("red-ui-menu-dropdown-submenu"+(opt.direction!=='right'?" pull-left":"")); var submenu = $('').appendTo(item); + var hasIcons = false + var hasSubmenus = false for (var i=0;i",{class:"red-ui-menu red-ui-menu-dropdown pull-right"}); - + if (options.direction) { + topMenu.addClass("red-ui-menu-dropdown-direction-"+options.direction) + } if (options.id) { topMenu.attr({id:options.id+"-submenu"}); var menuParent = $("#"+options.id); @@ -176,9 +206,22 @@ RED.menu = (function() { } var lastAddedSeparator = false; + var hasSubmenus = false; + var hasIcons = false; for (var i=0;i 0); + const hasMultipleSelection = hasSelection && selection.nodes.length > 1; + const hasLinks = selection.links && selection.links.length > 0; + const isSingleLink = !hasSelection && hasLinks && selection.links.length === 1 + const isMultipleLinks = !hasSelection && hasLinks && selection.links.length > 1 + const canDelete = hasSelection || hasLinks + const isGroup = hasSelection && selection.nodes.length === 1 && selection.nodes[0].type === 'group' + + const canRemoveFromGroup = hasSelection && !!selection.nodes[0].g + + + const menuItems = [ + { onselect: 'core:show-action-list', onpostselect: function() {} }, + { + label: RED._("contextMenu.insert"), + options: [ + { + label: RED._("contextMenu.node"), + onselect: function() { + RED.view.showQuickAddDialog({ + position: [ options.x - offset.left, options.y - offset.top ], + touchTrigger: true, + splice: isSingleLink?selection.links[0]:undefined, + // spliceMultiple: isMultipleLinks + }) + } + }, + { + label: RED._("contextMenu.junction"), + onselect: 'core:split-wires-with-junctions', + disabled: hasSelection || !hasLinks + }, + { + label: RED._("contextMenu.linkNodes"), + onselect: 'core:split-wire-with-link-nodes', + disabled: hasSelection || !hasLinks + } + ] + + + + } + ] + // menuItems.push( + // { + // label: (isSingleLink || isMultipleLinks)?'Insert into wire...':'Add node...', + // onselect: function() { + // RED.view.showQuickAddDialog({ + // position: [ options.x - offset.left, options.y - offset.top ], + // touchTrigger: true, + // splice: isSingleLink?selection.links[0]:undefined, + // spliceMultiple: isMultipleLinks + // }) + // } + // }, + // ) + // if (hasLinks && !hasSelection) { + // menuItems.push({ onselect: 'core:split-wires-with-junctions', label: 'Insert junction'}) + // } + menuItems.push( + null, + { onselect: 'core:undo', disabled: RED.history.list().length === 0 }, + { onselect: 'core:redo', disabled: RED.history.listRedo().length === 0 }, + null, + { onselect: 'core:cut-selection-to-internal-clipboard', label: RED._("keyboard.cutNode"), disabled: !hasSelection}, + { onselect: 'core:copy-selection-to-internal-clipboard', label: RED._("keyboard.copyNode"), disabled: !hasSelection }, + { onselect: 'core:paste-from-internal-clipboard', label: RED._("keyboard.pasteNode"), disabled: !RED.view.clipboard() }, + { onselect: 'core:delete-selection', disabled: !canDelete }, + { onselect: 'core:show-export-dialog', label: RED._("menu.label.export") }, + { onselect: 'core:select-all-nodes' } + ) + + if (hasSelection) { + menuItems.push( + null, + isGroup ? + { onselect: 'core:ungroup-selection', disabled: !isGroup } + : { onselect: 'core:group-selection', disabled: !hasSelection } + ) + if (canRemoveFromGroup) { + menuItems.push({ onselect: 'core:remove-selection-from-group', label: RED._("menu.label.groupRemoveSelection") }) + } + + } + const offset = $("#red-ui-workspace-chart").offset() + menu = RED.menu.init({ + direction: 'right', + onpreselect: function() { + disposeMenu() + }, + onpostselect: function() { + RED.view.focus() + }, + options: menuItems + }); + + menu.attr("id","red-ui-workspace-context-menu"); + menu.css({ + position: "absolute" + }) + menu.appendTo("body"); + + // TODO: prevent the menu from overflowing the window. + + var top = options.y + var left = options.x + + if (top+menu.height()-$(document).scrollTop() > $(window).height()) { + top -= (top+menu.height())-$(window).height() + 22; + } + if (left+menu.width()-$(document).scrollLeft() > $(window).width()) { + left -= (left+menu.width())-$(window).width() + 18; + } + menu.css({ + top: top+"px", + left: left+"px" + }) + $(".red-ui-menu.red-ui-menu-dropdown").hide(); + $(document).on("mousedown.red-ui-workspace-context-menu", function(evt) { + if (menu && menu[0].contains(evt.target)) { + return + } + disposeMenu() + }); + menu.show(); + + // menu.show({ + // target: $('#red-ui-main-container'), + // x: options.x, + // y: options.y + // }) + + + } + + return { + show: show, + hide: disposeMenu + } +})() diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/editors/code-editor.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/code-editor.js index 13ed25611..7cee2026b 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/editors/code-editor.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/code-editor.js @@ -21,7 +21,7 @@ const MONACO = "monaco"; const ACE = "ace"; - const defaultEditor = ACE; + const defaultEditor = MONACO; const DEFAULT_SETTINGS = { lib: defaultEditor, options: {} }; var selectedCodeEditor = null; var initialised = false; @@ -48,12 +48,12 @@ } function create(options) { - //TODO: (quandry - for consideration) + //TODO: (quandry - for consideration) // Below, I had to create a hidden element if options.id || options.element is not in the DOM - // I have seen 1 node calling `this.editor = RED.editor.createEditor()` with an + // I have seen 1 node calling `this.editor = RED.editor.createEditor()` with an // invalid (non existing html element selector) (e.g. node-red-contrib-components does this) - // This causes monaco to throw an error when attempting to hook up its events to the dom & the rest of the 'oneditperapre' - // code is thus skipped. + // This causes monaco to throw an error when attempting to hook up its events to the dom & the rest of the 'oneditperapre' + // code is thus skipped. // In ACE mode, creating an ACE editor (with an invalid ID) allows the editor to be created (but obviously there is no UI) // Because one (or more) contrib nodes have left this bad code in place, how would we handle this? // For compatibility, I have decided to create a hidden element so that at least an editor is created & errors do not occur. @@ -79,7 +79,7 @@ return this.editor.create(options);//fallback to ACE } } - + return { init: init, /** @@ -91,7 +91,7 @@ }, /** * Get user selected code editor - * @return {string} Returns + * @return {string} Returns * @memberof RED.editor.codeEditor */ get editor() { @@ -104,4 +104,4 @@ */ create: create } -})(); \ No newline at end of file +})(); diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/editors/json.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/json.js index 8531ba2c5..394350f26 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/editors/json.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/json.js @@ -534,6 +534,7 @@ var container = $("#red-ui-editor-type-json-tab-ui-container").css({"height":"100%"}); var filterDepth = Infinity; var list = $('
    ').appendTo(container).treeList({ + selectable: false, rootSortable: false, sortable: ".red-ui-editor-type-json-editor-item-handle", }).on("treelistchangeparent", function(event, evt) { diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/library.js b/packages/node_modules/@node-red/editor-client/src/js/ui/library.js index ee176dee2..d276b1572 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/library.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/library.js @@ -363,106 +363,112 @@ RED.library = (function() { options.onconfirm(item); } }); - var itemTools = $("
    ").css({position: "absolute",bottom:"6px",right:"8px"}); - var menuButton = $('') - .on("click", function(evt) { - evt.preventDefault(); - evt.stopPropagation(); - var elementPos = menuButton.offset(); - - var menuOptionMenu = RED.menu.init({id:"red-ui-library-browser-menu", - options: [ - {id:"red-ui-library-browser-menu-addFolder",label:RED._("library.newFolder"), onselect: function() { - var defaultFolderName = "new-folder"; - var defaultFolderNameMatches = {}; - - var selected = dirList.treeList('selected'); - if (!selected.children) { - selected = selected.parent; - } - var complete = function() { - selected.children.forEach(function(c) { - if (/^new-folder/.test(c.label)) { - defaultFolderNameMatches[c.label] = true - } - }); - var folderIndex = 2; - while(defaultFolderNameMatches[defaultFolderName]) { - defaultFolderName = "new-folder-"+(folderIndex++) - } - - selected.treeList.expand(); - var input = $('').val(defaultFolderName); - var newItem = { - icon: "fa fa-folder-o", - children:[], - path: selected.path, - element: input - } - var confirmAdd = function() { - var val = input.val().trim(); - if (val === "") { - cancelAdd(); - return; - } else { - for (var i=0;i").css({position: "absolute",bottom:"6px",right:"8px"}); + var menuButton = $('') + .on("click", function(evt) { + evt.preventDefault(); + evt.stopPropagation(); + var elementPos = menuButton.offset(); + + var menuOptionMenu + = RED.menu.init({id:"red-ui-library-browser-menu", + options: [ + {id:"red-ui-library-browser-menu-addFolder",label:RED._("library.newFolder"), onselect: function() { + var defaultFolderName = "new-folder"; + var defaultFolderNameMatches = {}; + + var selected = dirList.treeList('selected'); + if (!selected.children) { + selected = selected.parent; + } + var complete = function() { + selected.children.forEach(function(c) { + if (/^new-folder/.test(c.label)) { + defaultFolderNameMatches[c.label] = true + } + }); + var folderIndex = 2; + while(defaultFolderNameMatches[defaultFolderName]) { + defaultFolderName = "new-folder-"+(folderIndex++) + } + + selected.treeList.expand(); + var input = $('').val(defaultFolderName); + var newItem = { + icon: "fa fa-folder-o", + children:[], + path: selected.path, + element: input + } + var confirmAdd = function() { + var val = input.val().trim(); + if (val === "") { + cancelAdd(); + return; + } else { + for (var i=0;i -1) { @@ -831,7 +840,6 @@ RED.subflow = (function() { RED.nodes.moveNodeToTab(n, subflow.id); } - var historyEvent = { t:'createSubflow', nodes:[subflowInstance.id], diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/typeSearch.js b/packages/node_modules/@node-red/editor-client/src/js/ui/typeSearch.js index 0fc633071..fc5b8e99e 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/typeSearch.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/typeSearch.js @@ -104,7 +104,9 @@ RED.typeSearch = (function() { var index = Math.max(0,selected); if (index < children.length) { var n = $(children[index]).find(".red-ui-editableList-item-content").data('data'); - typesUsed[n.type] = Date.now(); + if (!/^_action_:/.test(n.type)) { + typesUsed[n.type] = Date.now(); + } if (n.def.outputs === 0) { confirm(n); } else { @@ -173,6 +175,8 @@ RED.typeSearch = (function() { var nodeDiv = $('
    ',{class:"red-ui-search-result-node"}).appendTo(div); if (object.type === "junction") { nodeDiv.addClass("red-ui-palette-icon-junction"); + } else if (/^_action_:/.test(object.type)) { + nodeDiv.addClass("red-ui-palette-icon-junction") } else { var colour = RED.utils.getNodeColor(object.type,def); nodeDiv.css('backgroundColor',colour); @@ -182,11 +186,14 @@ RED.typeSearch = (function() { var iconContainer = $('
    ',{class:"red-ui-palette-icon-container"}).appendTo(nodeDiv); RED.utils.createIconElement(icon_url, iconContainer, false); - if (object.type !== "junction" && def.inputs > 0) { - $('
    ',{class:"red-ui-search-result-node-port"}).appendTo(nodeDiv); - } - if (object.type !== "junction" && def.outputs > 0) { - $('
    ',{class:"red-ui-search-result-node-port red-ui-search-result-node-output"}).appendTo(nodeDiv); + + if (!/^_action_:/.test(object.type) && object.type !== "junction") { + if (def.inputs > 0) { + $('
    ',{class:"red-ui-search-result-node-port"}).appendTo(nodeDiv); + } + if (def.outputs > 0) { + $('
    ',{class:"red-ui-search-result-node-port red-ui-search-result-node-output"}).appendTo(nodeDiv); + } } var contentDiv = $('
    ',{class:"red-ui-search-result-description"}).appendTo(div); @@ -207,7 +214,9 @@ RED.typeSearch = (function() { } function confirm(def) { hide(); - typesUsed[def.type] = Date.now(); + if (!/^_action_:/.test(def.type)) { + typesUsed[def.type] = Date.now(); + } addCallback(def.type); } @@ -316,6 +325,7 @@ RED.typeSearch = (function() { function applyFilter(filter,type,def) { return !filter || ( + (!filter.spliceMultiple) && (!filter.type || type === filter.type) && (!filter.input || type === 'junction' || def.inputs > 0) && (!filter.output || type === 'junction' || def.outputs > 0) @@ -330,6 +340,13 @@ RED.typeSearch = (function() { 'inject','debug','function','change','switch','junction' ].filter(function(t) { return applyFilter(opts.filter,t,RED.nodes.getType(t)); }); + // if (opts.filter && opts.filter.input && opts.filter.output && !opts.filter.type) { + // if (opts.filter.spliceMultiple) { + // common.push('_action_:core:split-wires-with-junctions') + // } + // common.push('_action_:core:split-wire-with-link-nodes') + // } + var recentlyUsed = Object.keys(typesUsed); recentlyUsed.sort(function(a,b) { return typesUsed[b]-typesUsed[a]; @@ -354,6 +371,8 @@ RED.typeSearch = (function() { var itemDef = RED.nodes.getType(common[i]); if (common[i] === 'junction') { itemDef = { inputs:1, outputs: 1, label: 'junction', type: 'junction'} + } else if (/^_action_:/.test(common[i]) ) { + itemDef = { inputs:1, outputs: 1, label: common[i], type: common[i]} } if (itemDef) { item = { diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js b/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js index c3ea0ddd1..2c4cdca6b 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js @@ -1032,6 +1032,8 @@ RED.utils = (function() { return "font-awesome/fa-circle-o" } else if (def.category === 'config') { return RED.settings.apiRootUrl+"icons/node-red/cog.svg" + } else if ((node && /^_action_:/.test(node.type)) || /^_action_:/.test(def.type)) { + return "font-awesome/fa-cogs" } else if (node && node.type === 'tab') { return "red-ui-icons/red-ui-icons-flow" // return RED.settings.apiRootUrl+"images/subflow_tab.svg" diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/view-tools.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view-tools.js index 699e5f222..888fb4d7f 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/view-tools.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/view-tools.js @@ -336,17 +336,17 @@ RED.view.tools = (function() { } - function addNode() { - var selection = RED.view.selection(); - if (selection.nodes && selection.nodes.length === 1 && selection.nodes[0].outputs > 0) { - var selectedNode = selection.nodes[0]; - RED.view.showQuickAddDialog([ - selectedNode.x + selectedNode.w + 50,selectedNode.y - ]) - } else { - RED.view.showQuickAddDialog(); - } - } + // function addNode() { + // var selection = RED.view.selection(); + // if (selection.nodes && selection.nodes.length === 1 && selection.nodes[0].outputs > 0) { + // var selectedNode = selection.nodes[0]; + // RED.view.showQuickAddDialog([ + // selectedNode.x + selectedNode.w + 50,selectedNode.y + // ]) + // } else { + // RED.view.showQuickAddDialog(); + // } + // } function gotoNearestNode(direction) { @@ -815,6 +815,9 @@ RED.view.tools = (function() { */ function splitWiresWithLinkNodes(wires) { let wiresToSplit = wires || RED.view.selection().links; + if (!wiresToSplit) { + return + } if (!Array.isArray(wiresToSplit)) { wiresToSplit = [wiresToSplit]; } @@ -1047,6 +1050,135 @@ RED.view.tools = (function() { } } + function addJunctionsToWires(wires) { + let wiresToSplit = wires || RED.view.selection().links; + if (!wiresToSplit) { + return + } + if (!Array.isArray(wiresToSplit)) { + wiresToSplit = [wiresToSplit]; + } + if (wiresToSplit.length === 0) { + return; + } + + var removedLinks = new Set() + var addedLinks = [] + var addedJunctions = [] + + var groupedLinks = {} + wiresToSplit.forEach(function(l) { + var sourceId = l.source.id+":"+l.sourcePort + groupedLinks[sourceId] = groupedLinks[sourceId] || [] + groupedLinks[sourceId].push(l) + + groupedLinks[l.target.id] = groupedLinks[l.target.id] || [] + groupedLinks[l.target.id].push(l) + }); + var linkGroups = Object.keys(groupedLinks) + linkGroups.sort(function(A,B) { + return groupedLinks[B].length - groupedLinks[A].length + }) + linkGroups.forEach(function(gid) { + var links = groupedLinks[gid] + var junction = { + _def: {defaults:{}}, + type: 'junction', + z: RED.workspaces.active(), + id: RED.nodes.id(), + x: 0, + y: 0, + w: 0, h: 0, + outputs: 1, + inputs: 1, + dirty: true + } + links = links.filter(function(l) { return !removedLinks.has(l) }) + if (links.length === 0) { + return + } + let pointCount = 0 + links.forEach(function(l) { + if (l._sliceLocation) { + junction.x += l._sliceLocation.x + junction.y += l._sliceLocation.y + delete l._sliceLocation + pointCount++ + } else { + junction.x += l.source.x + l.source.w/2 + l.target.x - l.target.w/2 + junction.y += l.source.y + l.target.y + pointCount += 2 + } + }) + junction.x = Math.round(junction.x/pointCount) + junction.y = Math.round(junction.y/pointCount) + if (RED.view.snapGrid) { + let gridSize = RED.view.gridSize() + junction.x = (gridSize*Math.round(junction.x/gridSize)); + junction.y = (gridSize*Math.round(junction.y/gridSize)); + } + + var nodeGroups = new Set() + + RED.nodes.addJunction(junction) + addedJunctions.push(junction) + let newLink + if (gid === links[0].source.id+":"+links[0].sourcePort) { + newLink = { + source: links[0].source, + sourcePort: links[0].sourcePort, + target: junction + } + } else { + newLink = { + source: junction, + sourcePort: 0, + target: links[0].target + } + } + addedLinks.push(newLink) + RED.nodes.addLink(newLink) + links.forEach(function(l) { + removedLinks.add(l) + RED.nodes.removeLink(l) + let newLink + if (gid === l.target.id) { + newLink = { + source: l.source, + sourcePort: l.sourcePort, + target: junction + } + } else { + newLink = { + source: junction, + sourcePort: 0, + target: l.target + } + } + addedLinks.push(newLink) + RED.nodes.addLink(newLink) + nodeGroups.add(l.source.g || "__NONE__") + nodeGroups.add(l.target.g || "__NONE__") + }) + if (nodeGroups.size === 1) { + var group = nodeGroups.values().next().value + if (group !== "__NONE__") { + RED.group.addToGroup(RED.nodes.group(group), junction) + } + } + }) + if (addedJunctions.length > 0) { + RED.history.push({ + t: 'add', + links: addedLinks, + junctions: addedJunctions, + removedLinks: Array.from(removedLinks) + }) + RED.nodes.dirty(true) + } + RED.view.redraw(true); + } + return { init: function() { RED.actions.add("core:show-selected-node-labels", function() { setSelectedNodeLabelState(true); }) @@ -1109,6 +1241,7 @@ RED.view.tools = (function() { RED.actions.add("core:wire-node-to-multiple", function() { wireNodeToMultiple() }) RED.actions.add("core:split-wire-with-link-nodes", function () { splitWiresWithLinkNodes() }); + RED.actions.add("core:split-wires-with-junctions", function () { addJunctionsToWires() }); RED.actions.add("core:generate-node-names", generateNodeNames ) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js index 59aa3fe6e..18d1d132b 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js @@ -206,7 +206,15 @@ RED.view = (function() { function init() { chart = $("#red-ui-workspace-chart"); - + chart.on('contextmenu', function(evt) { + evt.preventDefault() + evt.stopPropagation() + RED.contextMenu.show({ + x:evt.clientX-5, + y:evt.clientY-5 + }) + return false + }) outer = d3.select("#red-ui-workspace-chart") .append("svg:svg") .attr("width", space_width) @@ -230,6 +238,7 @@ RED.view = (function() { .on("mousedown", canvasMouseDown) .on("mouseup", canvasMouseUp) .on("mouseenter", function() { + d3.select(document).on('mouseup.red-ui-workspace-tracker', null) if (lasso) { if (d3.event.buttons !== 1) { lasso.remove(); @@ -245,6 +254,7 @@ RED.view = (function() { } } }) + .on("mouseleave", canvasMouseLeave) .on("touchend", function() { d3.event.preventDefault(); clearTimeout(touchStartTime); @@ -385,6 +395,9 @@ RED.view = (function() { drag_lines = []; RED.events.on("workspace:change",function(event) { + // Just in case the mouse left the workspace whilst doing an action, + // put us back into default mode so the refresh works + mouse_mode = 0 if (event.old !== 0) { workspaceScrollPositions[event.old] = { left:chart.scrollLeft(), @@ -526,6 +539,23 @@ RED.view = (function() { nn.x = mousePos[0]; nn.y = mousePos[1]; + var minX = nn.w/2 -5; + if (nn.x < minX) { + nn.x = minX; + } + var minY = nn.h/2 -5; + if (nn.y < minY) { + nn.y = minY; + } + var maxX = space_width -nn.w/2 +5; + if (nn.x > maxX) { + nn.x = maxX; + } + var maxY = space_height -nn.h +5; + if (nn.y > maxY) { + nn.y = maxY; + } + if (snapGrid) { var gridOffset = RED.view.tools.calculateGridSnapOffsets(nn); nn.x -= gridOffset.x; @@ -955,9 +985,10 @@ RED.view = (function() { } function canvasMouseDown() { - if (RED.view.DEBUG) { + if (RED.view.DEBUG) { console.warn("canvasMouseDown", { mouse_mode, point: d3.mouse(this), event: d3.event }); } + RED.contextMenu.hide(); if (mouse_mode === RED.state.SELECTING_NODE) { d3.event.stopPropagation(); return; @@ -970,7 +1001,10 @@ RED.view = (function() { scroll_position = [chart.scrollLeft(),chart.scrollTop()]; return; } - if (!mousedown_node && !mousedown_link && !mousedown_group) { + if (d3.event.button === 2) { + return + } + if (!mousedown_node && !mousedown_link && !mousedown_group && !d3.event.shiftKey) { selectedLinks.clear(); updateSelection(); } @@ -1024,6 +1058,7 @@ RED.view = (function() { options = options || {}; var point = options.position || lastClickPosition; var spliceLink = options.splice; + var spliceMultipleLinks = options.spliceMultiple var targetGroup = options.group; var touchTrigger = options.touchTrigger; @@ -1036,6 +1071,10 @@ RED.view = (function() { var ox = point[0]; var oy = point[1]; + const offset = $("#red-ui-workspace-chart").offset() + var clientX = ox + offset.left - $("#red-ui-workspace-chart").scrollLeft() + var clientY = oy + offset.top - $("#red-ui-workspace-chart").scrollTop() + if (RED.settings.get("editor").view['view-snap-grid']) { // eventLayer.append("circle").attr("cx",point[0]).attr("cy",point[1]).attr("r","2").attr('fill','red') point[0] = Math.round(point[0] / gridSize) * gridSize; @@ -1087,8 +1126,12 @@ RED.view = (function() { } hideDragLines(); } - if (spliceLink) { - filter = {input:true, output:true} + if (spliceLink || spliceMultipleLinks) { + filter = { + input:true, + output:true, + spliceMultiple: spliceMultipleLinks + } } var rebuildQuickAddLink = function() { @@ -1113,8 +1156,8 @@ RED.view = (function() { var lastAddedWidth; RED.typeSearch.show({ - x:d3.event.clientX-mainPos.left-node_width/2 - (ox-point[0]), - y:d3.event.clientY-mainPos.top+ node_height/2 + 5 - (oy-point[1]), + x:clientX-mainPos.left-node_width/2 - (ox-point[0]), + y:clientY-mainPos.top+ node_height/2 + 5 - (oy-point[1]), disableFocus: touchTrigger, filter: filter, move: function(dx,dy) { @@ -1142,7 +1185,7 @@ RED.view = (function() { hideDragLines(); redraw(); }, - add: function(type,keepAdding) { + add: function(type, keepAdding) { if (touchTrigger) { keepAdding = false; resetMouseVars(); @@ -1150,7 +1193,13 @@ RED.view = (function() { var nn; var historyEvent; - if (type === 'junction') { + if (/^_action_:/.test(type)) { + const actionName = type.substring(9) + quickAddActive = false; + ghostNode.remove(); + RED.actions.invoke(actionName) + return + } else if (type === 'junction') { nn = { _def: {defaults:{}}, type: 'junction', @@ -1716,14 +1765,24 @@ RED.view = (function() { redraw(); } } - + function canvasMouseLeave() { + if (mouse_mode !== 0 && d3.event.buttons !== 0) { + d3.select(document).on('mouseup.red-ui-workspace-tracker', function() { + d3.select(document).on('mouseup.red-ui-workspace-tracker', null) + canvasMouseUp.call(this) + }) + } + } function canvasMouseUp() { lastClickPosition = [d3.event.offsetX/scaleFactor,d3.event.offsetY/scaleFactor]; - if (RED.view.DEBUG) { + if (RED.view.DEBUG) { console.warn("canvasMouseUp", { mouse_mode, point: d3.mouse(this), event: d3.event }); } var i; var historyEvent; + if (d3.event.button === 2) { + return + } if (mouse_mode === RED.state.PANNING) { resetMouseVars(); return @@ -1815,8 +1874,20 @@ RED.view = (function() { } } }) - - + activeLinks.forEach(function(link) { + if (!link.selected) { + var sourceY = link.source.y + var targetY = link.target.y + var sourceX = link.source.x+(link.source.w/2) + 10 + var targetX = link.target.x-(link.target.w/2) - 10 + if ( + sourceX > x && sourceX < x2 && sourceY > y && sourceY < y2 && + targetX > x && targetX < x2 && targetY > y && targetY < y2 + ) { + selectedLinks.add(link); + } + } + }) // var selectionChanged = false; // do { @@ -1864,114 +1935,118 @@ RED.view = (function() { slicePath = null; RED.view.redraw(true); } else if (mouse_mode == RED.state.SLICING_JUNCTION) { - var removedLinks = new Set() - var addedLinks = [] - var addedJunctions = [] - - var groupedLinks = {} - selectedLinks.forEach(function(l) { - var sourceId = l.source.id+":"+l.sourcePort - groupedLinks[sourceId] = groupedLinks[sourceId] || [] - groupedLinks[sourceId].push(l) - - groupedLinks[l.target.id] = groupedLinks[l.target.id] || [] - groupedLinks[l.target.id].push(l) - }); - var linkGroups = Object.keys(groupedLinks) - linkGroups.sort(function(A,B) { - return groupedLinks[B].length - groupedLinks[A].length - }) - linkGroups.forEach(function(gid) { - var links = groupedLinks[gid] - var junction = { - _def: {defaults:{}}, - type: 'junction', - z: RED.workspaces.active(), - id: RED.nodes.id(), - x: 0, - y: 0, - w: 0, h: 0, - outputs: 1, - inputs: 1, - dirty: true - } - links = links.filter(function(l) { return !removedLinks.has(l) }) - if (links.length === 0) { - return - } - links.forEach(function(l) { - junction.x += l._sliceLocation.x - junction.y += l._sliceLocation.y - }) - junction.x = Math.round(junction.x/links.length) - junction.y = Math.round(junction.y/links.length) - if (snapGrid) { - junction.x = (gridSize*Math.round(junction.x/gridSize)); - junction.y = (gridSize*Math.round(junction.y/gridSize)); - } - - var nodeGroups = new Set() - - RED.nodes.addJunction(junction) - addedJunctions.push(junction) - let newLink - if (gid === links[0].source.id+":"+links[0].sourcePort) { - newLink = { - source: links[0].source, - sourcePort: links[0].sourcePort, - target: junction - } - } else { - newLink = { - source: junction, - sourcePort: 0, - target: links[0].target - } - } - addedLinks.push(newLink) - RED.nodes.addLink(newLink) - links.forEach(function(l) { - removedLinks.add(l) - RED.nodes.removeLink(l) - let newLink - if (gid === l.target.id) { - newLink = { - source: l.source, - sourcePort: l.sourcePort, - target: junction - } - } else { - newLink = { - source: junction, - sourcePort: 0, - target: l.target - } - } - addedLinks.push(newLink) - RED.nodes.addLink(newLink) - nodeGroups.add(l.source.g || "__NONE__") - nodeGroups.add(l.target.g || "__NONE__") - }) - if (nodeGroups.size === 1) { - var group = nodeGroups.values().next().value - if (group !== "__NONE__") { - RED.group.addToGroup(RED.nodes.group(group), junction) - } - } - }) + RED.actions.invoke("core:split-wires-with-junctions") slicePath.remove(); slicePath = null; - if (addedJunctions.length > 0) { - RED.history.push({ - t: 'add', - links: addedLinks, - junctions: addedJunctions, - removedLinks: Array.from(removedLinks) - }) - RED.nodes.dirty(true) - } - RED.view.redraw(true); + // var removedLinks = new Set() + // var addedLinks = [] + // var addedJunctions = [] + // + // var groupedLinks = {} + // selectedLinks.forEach(function(l) { + // var sourceId = l.source.id+":"+l.sourcePort + // groupedLinks[sourceId] = groupedLinks[sourceId] || [] + // groupedLinks[sourceId].push(l) + // + // groupedLinks[l.target.id] = groupedLinks[l.target.id] || [] + // groupedLinks[l.target.id].push(l) + // }); + // var linkGroups = Object.keys(groupedLinks) + // linkGroups.sort(function(A,B) { + // return groupedLinks[B].length - groupedLinks[A].length + // }) + // linkGroups.forEach(function(gid) { + // var links = groupedLinks[gid] + // var junction = { + // _def: {defaults:{}}, + // type: 'junction', + // z: RED.workspaces.active(), + // id: RED.nodes.id(), + // x: 0, + // y: 0, + // w: 0, h: 0, + // outputs: 1, + // inputs: 1, + // dirty: true + // } + // links = links.filter(function(l) { return !removedLinks.has(l) }) + // if (links.length === 0) { + // return + // } + // links.forEach(function(l) { + // junction.x += l._sliceLocation.x + // junction.y += l._sliceLocation.y + // }) + // junction.x = Math.round(junction.x/links.length) + // junction.y = Math.round(junction.y/links.length) + // if (snapGrid) { + // junction.x = (gridSize*Math.round(junction.x/gridSize)); + // junction.y = (gridSize*Math.round(junction.y/gridSize)); + // } + // + // var nodeGroups = new Set() + // + // RED.nodes.addJunction(junction) + // addedJunctions.push(junction) + // let newLink + // if (gid === links[0].source.id+":"+links[0].sourcePort) { + // newLink = { + // source: links[0].source, + // sourcePort: links[0].sourcePort, + // target: junction + // } + // } else { + // newLink = { + // source: junction, + // sourcePort: 0, + // target: links[0].target + // } + // } + // addedLinks.push(newLink) + // RED.nodes.addLink(newLink) + // links.forEach(function(l) { + // removedLinks.add(l) + // RED.nodes.removeLink(l) + // let newLink + // if (gid === l.target.id) { + // newLink = { + // source: l.source, + // sourcePort: l.sourcePort, + // target: junction + // } + // } else { + // newLink = { + // source: junction, + // sourcePort: 0, + // target: l.target + // } + // } + // addedLinks.push(newLink) + // RED.nodes.addLink(newLink) + // nodeGroups.add(l.source.g || "__NONE__") + // nodeGroups.add(l.target.g || "__NONE__") + // }) + // if (nodeGroups.size === 1) { + // var group = nodeGroups.values().next().value + // if (group !== "__NONE__") { + // RED.group.addToGroup(RED.nodes.group(group), junction) + // } + // } + // }) + // slicePath.remove(); + // slicePath = null; + // + // if (addedJunctions.length > 0) { + // RED.history.push({ + // t: 'add', + // links: addedLinks, + // junctions: addedJunctions, + // removedLinks: Array.from(removedLinks) + // }) + // RED.nodes.dirty(true) + // } + // RED.view.redraw(true); } if (mouse_mode == RED.state.MOVING_ACTIVE) { if (movingSet.length() > 0) { @@ -2832,6 +2907,7 @@ RED.view = (function() { function portMouseDown(d,portType,portIndex, evt) { if (RED.view.DEBUG) { console.warn("portMouseDown", mouse_mode,d,portType,portIndex); } + RED.contextMenu.hide(); evt = evt || d3.event; if (evt === 1) { return; @@ -3340,6 +3416,7 @@ RED.view = (function() { function nodeMouseDown(d) { if (RED.view.DEBUG) { console.warn("nodeMouseDown", mouse_mode,d); } focusView(); + RED.contextMenu.hide(); if (d3.event.button === 1) { return; } @@ -3719,9 +3796,10 @@ RED.view = (function() { function junctionMouseOutProxy(e) { junctionMouseOut(d3.select(this), this.__data__) } function linkMouseDown(d) { - if (RED.view.DEBUG) { + if (RED.view.DEBUG) { console.warn("linkMouseDown", { mouse_mode, point: d3.mouse(this), event: d3.event }); } + RED.contextMenu.hide(); if (mouse_mode === RED.state.SELECTING_NODE) { d3.event.stopPropagation(); return; @@ -3781,6 +3859,9 @@ RED.view = (function() { } function groupMouseUp(g) { + if (RED.view.DEBUG) { + console.warn("groupMouseUp", { mouse_mode, event: d3.event }); + } if (dblClickPrimed && mousedown_group == g && clickElapsed > 0 && clickElapsed < dblClickInterval) { mouse_mode = RED.state.DEFAULT; RED.editor.editGroup(g); @@ -3796,6 +3877,10 @@ RED.view = (function() { // return // } + if (RED.view.DEBUG) { + console.warn("groupMouseDown", { mouse_mode, point: mouse, event: d3.event }); + } + RED.contextMenu.hide(); focusView(); if (d3.event.button === 1) { return; @@ -5722,7 +5807,12 @@ RED.view = (function() { node.dirty = true; node.dirtyStatus = true; node.changed = true; - RED.events.emit("nodes:change",node); + if (node.type === "junction") { + RED.events.emit("junctions:change",node); + } + else { + RED.events.emit("nodes:change",node); + } } } } diff --git a/packages/node_modules/@node-red/editor-client/src/sass/base.scss b/packages/node_modules/@node-red/editor-client/src/sass/base.scss index c22a1d606..a08e752d4 100644 --- a/packages/node_modules/@node-red/editor-client/src/sass/base.scss +++ b/packages/node_modules/@node-red/editor-client/src/sass/base.scss @@ -44,7 +44,7 @@ body { #red-ui-palette-shade, #red-ui-editor-shade, #red-ui-header-shade, #red-ui-sidebar-shade { @include shade; - z-index: 2; + z-index: 5; } #red-ui-sidebar-shade { left: -8px; diff --git a/packages/node_modules/@node-red/editor-client/src/sass/dropdownMenu.scss b/packages/node_modules/@node-red/editor-client/src/sass/dropdownMenu.scss index 98ab3bd3b..4cfc1884e 100644 --- a/packages/node_modules/@node-red/editor-client/src/sass/dropdownMenu.scss +++ b/packages/node_modules/@node-red/editor-client/src/sass/dropdownMenu.scss @@ -54,6 +54,21 @@ white-space: normal !important; outline: none; } + & > li.pull-left > a, + & > li.pull-left > a:focus { + padding: 4px 12px 4px 32px; + } + &.red-ui-menu-dropdown-noicons > li > a, + &.red-ui-menu-dropdown-noicons > li > a:focus { + padding: 4px 12px 4px 12px; + } + + &.red-ui-menu-dropdown-submenus > li > a, + &.red-ui-menu-dropdown-submenus > li > a:focus { + padding-right: 20px; + } + + & > .active > a, & > .active > a:hover, @@ -145,8 +160,8 @@ position: relative; & > .red-ui-menu-dropdown { top: 0; - left: 100%; - margin-top: -6px; + left: calc(100% - 5px); + margin-top: 0; margin-left: -1px; } &.open > .red-ui-menu-dropdown, @@ -175,10 +190,10 @@ } } -.red-ui-menu-dropdown-submenu>a:after { +.red-ui-menu-dropdown-submenu.pull-left>a:after { display: none; } -.red-ui-menu-dropdown-submenu>a:before { +.red-ui-menu-dropdown-submenu.pull-left>a:before { display: block; float: left; width: 0; @@ -192,7 +207,25 @@ border-width: 5px 5px 5px 0; content: " "; } - +.red-ui-menu-dropdown-direction-right { + .red-ui-menu-dropdown-submenu>a:after { + display: none; + } + .red-ui-menu-dropdown-submenu>a:before { + display: block; + float: right; + width: 0; + height: 0; + margin-top: 5px; + margin-right: -15px; + /* Caret Arrow */ + border-color: transparent; + border-left-color: $menuCaret; + border-style: solid; + border-width: 5px 0 5px 5px; + content: " "; + } +} .red-ui-menu-dropdown-submenu.disabled > a:before { border-right-color: $menuCaret; } diff --git a/packages/node_modules/@node-red/editor-client/src/sass/jquery.scss b/packages/node_modules/@node-red/editor-client/src/sass/jquery.scss index a884d6641..b7278b332 100644 --- a/packages/node_modules/@node-red/editor-client/src/sass/jquery.scss +++ b/packages/node_modules/@node-red/editor-client/src/sass/jquery.scss @@ -27,10 +27,10 @@ } .ui-widget.ui-widget-content { - border: 1px solid $tertiary-border-color; + border: 1px solid $tertiary-border-color; } .ui-widget-content { - border: 1px solid $secondary-border-color; + border: 1px solid $secondary-border-color; } .ui-widget-header { diff --git a/packages/node_modules/@node-red/editor-client/src/sass/palette.scss b/packages/node_modules/@node-red/editor-client/src/sass/palette.scss index 397dd4765..800f34079 100644 --- a/packages/node_modules/@node-red/editor-client/src/sass/palette.scss +++ b/packages/node_modules/@node-red/editor-client/src/sass/palette.scss @@ -131,6 +131,7 @@ width: 120px; background-size: contain; position: relative; + z-index: 4; &:not(.red-ui-palette-node-config):not(.red-ui-palette-node-small):first-child { margin-top: 15px; } diff --git a/packages/node_modules/@node-red/editor-client/src/sass/panels.scss b/packages/node_modules/@node-red/editor-client/src/sass/panels.scss index 95d9210f4..e820992b4 100644 --- a/packages/node_modules/@node-red/editor-client/src/sass/panels.scss +++ b/packages/node_modules/@node-red/editor-client/src/sass/panels.scss @@ -87,8 +87,7 @@ display: inline-block; cursor: ew-resize; background-color: $primary-background; - } - + &:before { content: ''; display: block; @@ -104,4 +103,5 @@ mask-repeat: no-repeat; background-color: $grip-color; } + } } diff --git a/packages/node_modules/@node-red/editor-client/src/tours/images/context-menu.png b/packages/node_modules/@node-red/editor-client/src/tours/images/context-menu.png new file mode 100644 index 000000000..1acaab48b Binary files /dev/null and b/packages/node_modules/@node-red/editor-client/src/tours/images/context-menu.png differ diff --git a/packages/node_modules/@node-red/editor-client/src/tours/welcome.js b/packages/node_modules/@node-red/editor-client/src/tours/welcome.js index 219aaec7b..98d83c7e5 100644 --- a/packages/node_modules/@node-red/editor-client/src/tours/welcome.js +++ b/packages/node_modules/@node-red/editor-client/src/tours/welcome.js @@ -1,15 +1,30 @@ export default { - version: "3.0.0-beta.1", + version: "3.0.0-beta.3", steps: [ { titleIcon: "fa fa-map-o", title: { - "en-US": "Welcome to Node-RED 3.0 Beta 1!", - "ja": "Node-RED 3.0 ベータ1へようこそ!" + "en-US": "Welcome to Node-RED 3.0 Beta 3!", + "ja": "Node-RED 3.0 ベータ3へようこそ!" }, description: { - "en-US": "

    This is the first Beta release of Node-RED 3.0. It contains just about everything we have planned for the final release.

    Let's take a moment to discover the new features in this release.

    ", - "ja": "

    これはNode-RED 3.0の最初のベータリリースです。これには、最終リリースで計画しているほぼ全ての機能が含まれています。

    本リリースの新機能を見つけてみましょう。

    " + "en-US": "

    This is the final beta release of Node-RED 3.0.

    Let's take a moment to discover the new features in this release.

    ", + "ja": "

    これはNode-RED 3.0の最後のベータリリースです。

    本リリースの新機能を見つけてみましょう。

    " + } + }, + { + title: { + "en-US": "Context Menu", + "ja": "コンテキストメニュー" + }, + image: 'images/context-menu.png', + description: { + "en-US": `

    The editor now has its own context menu when you + right-click in the workspace.

    +

    This makes many of the built-in actions much easier + to access.

    `, + "ja": `

    ワークスペースで右クリックすると、エディタに独自のコンテキストメニューが表示されるようになりました。

    +

    これによって多くの組み込み動作を、より簡単に利用できます。

    ` } }, { @@ -19,12 +34,13 @@ export default { }, image: 'images/junction-slice.gif', description: { - "en-US": `

    To make it easier to route wires around your flows, it is now possible to - add junction nodes that give you more control.

    -

    Junctions can be added to wires by holding the Shift key, then click and drag with - the right-hand mouse button across the wires.

    `, + "en-US": `

    To make it easier to route wires around your flows, + it is now possible to add junction nodes that give + you more control.

    +

    Junctions can be added to wires by holding both the Alt key and the Shift key + then click and drag the mouse across the wires.

    `, "ja": `

    フローのワイヤーの経路をより制御しやすくするために、分岐点ノードを追加できるようになりました。

    -

    シフトキーを押しながら、マウスの右ボタンをクリックし、ワイヤーを横切るようにドラッグすることで、分岐点を追加できます。

    ` +

    Altキーとシフトキーを押しながらマウスをクリックし、ワイヤーを横切るようにドラッグすることで、分岐点を追加できます。

    ` }, }, { diff --git a/packages/node_modules/@node-red/nodes/core/common/20-inject.js b/packages/node_modules/@node-red/nodes/core/common/20-inject.js index 92b8122df..734bce765 100644 --- a/packages/node_modules/@node-red/nodes/core/common/20-inject.js +++ b/packages/node_modules/@node-red/nodes/core/common/20-inject.js @@ -109,9 +109,10 @@ module.exports = function(RED) { if (!property) return; if (valueType === "jsonata") { - if (p.exp) { + if (p.v) { try { - var val = RED.util.evaluateJSONataExpression(p.exp, msg); + var exp = RED.util.prepareJSONataExpression(p.v, node); + var val = RED.util.evaluateJSONataExpression(exp, msg); RED.util.setMessageProperty(msg, property, val, true); } catch (err) { diff --git a/packages/node_modules/@node-red/nodes/core/common/21-debug.html b/packages/node_modules/@node-red/nodes/core/common/21-debug.html index 51e47e2f2..62da1b259 100644 --- a/packages/node_modules/@node-red/nodes/core/common/21-debug.html +++ b/packages/node_modules/@node-red/nodes/core/common/21-debug.html @@ -499,7 +499,7 @@ types:['msg', fullType, "jsonata"], typeField: $("#node-input-targetType") }); - if (this.targetType === "jsonata") { + if (this.targetType === "jsonata") { var property = this.complete || ""; $("#node-input-typed-complete").typedInput('type','jsonata'); $("#node-input-typed-complete").typedInput('value',property); diff --git a/packages/node_modules/@node-red/nodes/core/function/10-function.html b/packages/node_modules/@node-red/nodes/core/function/10-function.html index 6309ae9ad..156abd29d 100644 --- a/packages/node_modules/@node-red/nodes/core/function/10-function.html +++ b/packages/node_modules/@node-red/nodes/core/function/10-function.html @@ -460,7 +460,7 @@ } }); - var buildEditor = function(id, stateId, focus, value, defaultValue, extraLibs) { + var buildEditor = function(id, stateId, focus, value, defaultValue, extraLibs, offset) { var editor = RED.editor.createEditor({ id: id, mode: 'ace/mode/nrjavascript', @@ -484,14 +484,14 @@ extraLibs: extraLibs }); if (defaultValue && value === "") { - editor.moveCursorTo(defaultValue.split("\n").length - 1, 0); + editor.moveCursorTo(defaultValue.split("\n").length +offset, 0); } editor.__stateId = stateId; return editor; } - this.initEditor = buildEditor('node-input-init-editor', this.id + "/" + "initEditor", false, $("#node-input-initialize").val(), RED._("node-red:function.text.initialize")) - this.editor = buildEditor('node-input-func-editor', this.id + "/" + "editor", true, $("#node-input-func").val(), undefined, that.libs || []) - this.finalizeEditor = buildEditor('node-input-finalize-editor', this.id + "/" + "finalizeEditor", false, $("#node-input-finalize").val(), RED._("node-red:function.text.finalize")) + this.initEditor = buildEditor('node-input-init-editor', this.id + "/" + "initEditor", false, $("#node-input-initialize").val(), RED._("node-red:function.text.initialize"), undefined, 0); + this.editor = buildEditor('node-input-func-editor', this.id + "/" + "editor", true, $("#node-input-func").val(), undefined, that.libs || [], undefined, -1); + this.finalizeEditor = buildEditor('node-input-finalize-editor', this.id + "/" + "finalizeEditor", false, $("#node-input-finalize").val(), RED._("node-red:function.text.finalize"), undefined, 0); RED.library.create({ url:"functions", // where to get the data from diff --git a/packages/node_modules/@node-red/nodes/core/storage/10-file.html b/packages/node_modules/@node-red/nodes/core/storage/10-file.html index ddddcb687..6b19ebaa8 100755 --- a/packages/node_modules/@node-red/nodes/core/storage/10-file.html +++ b/packages/node_modules/@node-red/nodes/core/storage/10-file.html @@ -198,8 +198,8 @@ category: 'storage', defaults: { name: {value:""}, - filename: {value:"filename"}, - filenameType: {value:"msg"}, + filename: {value:""}, + filenameType: {value:"str"}, appendNewline: {value:true}, createDir: {value:false}, overwriteFile: {value:"false"}, @@ -236,8 +236,8 @@ label: node._("file.encoding.setbymsg") }).text(label).appendTo(encSel); $("#node-input-filename").typedInput({ - default: "msg", - types:[{ value: "str", label:"", icon:"red/images/typedInput/az.svg"}, "msg", "jsonata", "env"], + default: "str", + types: [{label:RED._("node-red:file.label.path"), value:"str", icon:""}, "msg", "jsonata", "env"], typeField: $("#node-input-filenameType") }); if(typeof node.filenameType == 'undefined') { @@ -297,8 +297,8 @@ category: 'storage', defaults: { name: {value:""}, - filename: {value:"filename"}, - filenameType: {value:"msg"}, + filename: {value:""}, + filenameType: {value:"str"}, format: {value:"utf8"}, chunk: {value:false}, sendError: {value: false}, @@ -341,8 +341,8 @@ label: label }).text(label).appendTo(encSel); $("#node-input-filename").typedInput({ - default: "msg", - types:[{ value: "str", label:"", icon:"red/images/typedInput/az.svg"}, "msg", "jsonata", "env"], + default: "str", + types: [{label:RED._("node-red:file.label.path"), value:"str", icon:""}, "msg", "jsonata", "env"], typeField: $("#node-input-filenameType") }); if(typeof node.filenameType == 'undefined') { diff --git a/packages/node_modules/@node-red/nodes/locales/en-US/messages.json b/packages/node_modules/@node-red/nodes/locales/en-US/messages.json old mode 100755 new mode 100644 index 1c3f2b946..62d5f351f --- a/packages/node_modules/@node-red/nodes/locales/en-US/messages.json +++ b/packages/node_modules/@node-red/nodes/locales/en-US/messages.json @@ -137,7 +137,7 @@ "toConsole": "system console", "toStatus": "node status (32 characters)", "severity": "Level", - "node": "node", + "node": "node", "notification": { "activated": "Successfully activated: __label__", "deactivated": "Successfully deactivated: __label__" @@ -194,22 +194,22 @@ "key": "Private Key", "passphrase": "Passphrase", "ca": "CA Certificate", - "verify-server-cert":"Verify server certificate", + "verify-server-cert": "Verify server certificate", "servername": "Server Name", "alpnprotocol": "ALPN Protocol" }, "placeholder": { - "cert":"path to certificate (PEM format)", - "key":"path to private key (PEM format)", - "ca":"path to CA certificate (PEM format)", - "passphrase":"private key passphrase (optional)", - "servername":"for use with SNI", - "alpnprotocol":"for use with ALPN" + "cert": "path to certificate (PEM format)", + "key": "path to private key (PEM format)", + "ca": "path to CA certificate (PEM format)", + "passphrase": "private key passphrase (optional)", + "servername": "for use with SNI", + "alpnprotocol": "for use with ALPN" }, "error": { "missing-file": "No certificate/key file provided", - "invalid-cert": "Certificate not specified", - "invalid-key": "Private key not specified" + "invalid-cert": "Certificate not specified", + "invalid-key": "Private key not specified" } }, "exec": { @@ -263,10 +263,10 @@ "moduleLoadError": "Failed to load module __module__: __error__", "moduleNameError": "Invalid module variable name: __name__", "moduleNameReserved": "Reserved variable name: __name__", - "inputListener":"Cannot add listener to 'input' event within Function", - "non-message-returned":"Function tried to send a message of type __type__", - "invalid-js": "Error in JavaScript code", - "missing-module": "Module __module__ missing" + "inputListener": "Cannot add listener to 'input' event within Function", + "non-message-returned": "Function tried to send a message of type __type__", + "invalid-js": "Error in JavaScript code", + "missing-module": "Module __module__ missing" } }, "template": { @@ -320,35 +320,35 @@ "limit": "limit", "limitTopic": "limit topic", "random": "random", - "rate": "rate", - "random-first": "first random value", - "random-last": "last random value", - "units" : { + "rate": "rate", + "random-first": "first random value", + "random-last": "last random value", + "units": { "second": { - "plural" : "Seconds", + "plural": "Seconds", "singular": "Second" }, "minute": { - "plural" : "Minutes", + "plural": "Minutes", "singular": "Minute" }, "hour": { - "plural" : "Hours", + "plural": "Hours", "singular": "Hour" }, "day": { - "plural" : "Days", + "plural": "Days", "singular": "Day" } } }, "errors": { - "too-many" : "too many pending messages in delay node", - "invalid-timeout": "Invalid delay value", - "invalid-rate": "Invalid rate value", - "invalid-rate-unit": "Invalid rate unit value", - "invalid-random-first": "Invalid first random value", - "invalid-random-last": "Invalid last random value" + "too-many": "too many pending messages in delay node", + "invalid-timeout": "Invalid delay value", + "invalid-rate": "Invalid rate value", + "invalid-rate-unit": "Invalid rate unit value", + "invalid-random-first": "Invalid first random value", + "invalid-random-last": "Invalid last random value" } }, "trigger": { @@ -383,11 +383,11 @@ "trigger-block": "trigger & block", "trigger-loop": "resend every", "reset": "Reset the trigger if:", - "resetMessage":"msg.reset is set", - "resetPayload":"msg.payload equals", + "resetMessage": "msg.reset is set", + "resetPayload": "msg.payload equals", "resetprompt": "optional", - "duration": "duration", - "topic": "topic" + "duration": "duration", + "topic": "topic" } }, "comment": { @@ -412,8 +412,8 @@ "cleansession": "Use clean session", "cleanstart": "Use clean start", "use-tls": "Use TLS", - "tls-config":"TLS Configuration", - "verify-server-cert":"Verify server certificate", + "tls-config": "TLS Configuration", + "verify-server-cert": "Verify server certificate", "compatmode": "Use legacy MQTT 3.1 support", "userProperties": "User Properties", "subscriptionIdentifier": "Subscription ID", @@ -448,10 +448,10 @@ "auto-connect": "Connect automatically", "auto-mode-depreciated": "This option is depreciated. Please use the new auto-detect mode." }, - "sections-label":{ + "sections-label": { "birth-message": "Message sent on connection (birth message)", - "will-message":"Message sent on an unexpected disconnection (will message)", - "close-message":"Message sent before disconnecting (close message)" + "will-message": "Message sent on an unexpected disconnection (will message)", + "close-message": "Message sent before disconnecting (close message)" }, "tabs-label": { "connection": "Connection", @@ -460,7 +460,7 @@ }, "placeholder": { "clientid": "Leave blank for auto generated", - "clientid-nonclean":"Must be set for non-clean sessions", + "clientid-nonclean": "Must be set for non-clean sessions", "will-topic": "Leave blank to disable will message", "birth-topic": "Leave blank to disable birth message", "close-topic": "Leave blank to disable close message" @@ -493,8 +493,7 @@ "invalid-action-action": "Invalid action specified", "invalid-action-alreadyconnected": "Disconnect from broker before connecting", "invalid-action-badsubscription": "msg.topic is missing or invalid", - "invalid-client-id": "Missing Client ID" - + "invalid-client-id": "Missing Client ID" } }, "httpin": { @@ -507,7 +506,7 @@ "status": "Status code", "headers": "Headers", "other": "other", - "paytoqs" : { + "paytoqs": { "ignore": "Ignore", "query": "Append to query-string parameters", "body": "Send as request body" @@ -521,7 +520,7 @@ "setby": "- set by msg.method -", "basicauth": "Use authentication", "use-tls": "Enable secure (SSL/TLS) connection", - "tls-config":"TLS Configuration", + "tls-config": "TLS Configuration", "basic": "basic authentication", "digest": "digest authentication", "bearer": "bearer authentication", @@ -546,8 +545,8 @@ "no-response": "No response object", "json-error": "JSON parse error", "no-url": "No url specified", - "deprecated-call":"Deprecated call to __method__", - "invalid-transport":"non-http transport requested", + "deprecated-call": "Deprecated call to __method__", + "invalid-transport": "non-http transport requested", "timeout-isnan": "Timeout value is not a valid number, ignoring", "timeout-isnegative": "Timeout value is negative, ignoring", "invalid-payload": "Invalid payload", @@ -585,8 +584,8 @@ "send-error": "An error occurred while sending: ", "missing-conf": "Missing server configuration", "duplicate-path": "Cannot have two WebSocket listeners on the same path: __path__", - "missing-server": "Missing server configuration", - "missing-client": "Missing client configuration" + "missing-server": "Missing server configuration", + "missing-client": "Missing client configuration" } }, "watch": { @@ -646,7 +645,6 @@ "connection-closed": "connection closed from __host__:__port__", "connections": "__count__ connection", "connections_plural": "__count__ connections" - }, "errors": { "connection-lost": "connection lost to __host__:__port__", @@ -658,8 +656,8 @@ "connect-timeout": "connect timeout", "connect-fail": "connect failed", "bad-string": "failed to convert to string", - "invalid-host": "Invalid host", - "invalid-port": "Invalid port" + "invalid-host": "Invalid host", + "invalid-port": "Invalid port" } }, "udp": { @@ -674,7 +672,7 @@ "toport": "to port", "address": "Address", "decode-base64": "Decode Base64 encoded payload?", - "port": "port" + "port": "port" }, "placeholder": { "interface": "(optional) local interface or address to bind to", @@ -722,7 +720,7 @@ "port-invalid": "udp: port number not valid", "alreadyused": "udp: port __port__ already in use", "ifnotfound": "udp: interface __iface__ not found", - "invalid-group": "invalid multicast group" + "invalid-group": "invalid multicast group" } }, "switch": { @@ -731,8 +729,8 @@ "property": "Property", "rule": "rule", "repair": "recreate message sequences", - "value-rules": "value rules", - "sequence-rules": "sequence rules" + "value-rules": "value rules", + "sequence-rules": "sequence rules" }, "previous": "previous value", "and": "and", @@ -789,8 +787,8 @@ "invalid-json": "Invalid 'to' JSON property", "invalid-expr": "Invalid JSONata expression: __error__", "no-override": "Cannot set property of non-object type: __property__", - "invalid-prop": "Invalid property expression: __property__", - "invalid-json-data": "Invalid JSON data: __error__" + "invalid-prop": "Invalid property expression: __property__", + "invalid-json-data": "Invalid JSON data: __error__" } }, "range": { @@ -802,10 +800,10 @@ "from": "from", "to": "to", "roundresult": "Round result to the nearest integer?", - "minin": "input from", - "maxin": "input to", - "minout": "target from", - "maxout": "target to" + "minin": "input from", + "maxin": "input to", + "minout": "target from", + "maxout": "target to" }, "placeholder": { "min": "e.g. 0", @@ -902,8 +900,8 @@ "property": "Property", "actions": { "toggle": "Convert between JSON String & Object", - "str":"Always convert to JSON String", - "obj":"Always convert to JavaScript Object" + "str": "Always convert to JSON String", + "obj": "Always convert to JavaScript Object" } } }, @@ -930,6 +928,7 @@ "write": "write file", "read": "read file", "filename": "Filename", + "path": "path", "action": "Action", "addnewline": "Add newline (\\n) to each payload?", "createdir": "Create directory if it doesn't exist?", @@ -989,15 +988,15 @@ }, "split": { "split": "split", - "intro":"Split msg.payload based on type:", - "object":"Object", - "objectSend":"Send a message for each key/value pair", - "strBuff":"String / Buffer", - "array":"Array", - "splitUsing":"Split using", - "splitLength":"Fixed length of", - "stream":"Handle as a stream of messages", - "addname":" Copy key to " + "intro": "Split msg.payload based on type:", + "object": "Object", + "objectSend": "Send a message for each key/value pair", + "strBuff": "String / Buffer", + "array": "Array", + "splitUsing": "Split using", + "splitLength": "Fixed length of", + "stream": "Handle as a stream of messages", + "addname": " Copy key to " }, "join": { "join": "join", @@ -1030,7 +1029,7 @@ "complete": "After a message with the msg.complete property set", "tip": "This mode assumes this node is either paired with a split node or the received messages will have a properly configured msg.parts property.", "too-many": "too many pending messages in join node", - "message-prop": "message property", + "message-prop": "message property", "merge": { "topics-label": "Merged Topics", "topics": "topics", @@ -1049,51 +1048,51 @@ "invalid-type": "Cannot join __error__ to buffer" } }, - "sort" : { + "sort": { "sort": "sort", - "target" : "Sort", - "seq" : "message sequence", - "key" : "Key", - "elem" : "element value", - "order" : "Order", - "ascending" : "ascending", - "descending" : "descending", - "as-number" : "as number", - "invalid-exp" : "Invalid JSONata expression in sort node: __message__", - "too-many" : "Too many pending messages in sort node", - "clear" : "clear pending message in sort node" + "target": "Sort", + "seq": "message sequence", + "key": "Key", + "elem": "element value", + "order": "Order", + "ascending": "ascending", + "descending": "descending", + "as-number": "as number", + "invalid-exp": "Invalid JSONata expression in sort node: __message__", + "too-many": "Too many pending messages in sort node", + "clear": "clear pending message in sort node" }, - "batch" : { + "batch": { "batch": "batch", "mode": { - "label" : "Mode", - "num-msgs" : "Group by number of messages", - "interval" : "Group by time interval", - "concat" : "Concatenate sequences" + "label": "Mode", + "num-msgs": "Group by number of messages", + "interval": "Group by time interval", + "concat": "Concatenate sequences" }, "count": { - "label" : "Number of messages", - "overlap" : "Overlap", - "count" : "count", - "invalid" : "Invalid count and overlap" + "label": "Number of messages", + "overlap": "Overlap", + "count": "count", + "invalid": "Invalid count and overlap" }, "interval": { - "label" : "Interval", - "seconds" : "seconds", - "empty" : "send empty message when no message arrives" + "label": "Interval", + "seconds": "seconds", + "empty": "send empty message when no message arrives" }, "concat": { "topics-label": "Topics", - "topic" : "topic" + "topic": "topic" }, - "too-many" : "too many pending messages in batch node", - "unexpected" : "unexpected mode", - "no-parts" : "no parts property in message", - "error": { - "invalid-count": "Invalid count", - "invalid-overlap": "Invalid overlap", - "invalid-interval": "Invalid interval" - } + "too-many": "too many pending messages in batch node", + "unexpected": "unexpected mode", + "no-parts": "no parts property in message", + "error": { + "invalid-count": "Invalid count", + "invalid-overlap": "Invalid overlap", + "invalid-interval": "Invalid interval" + } }, "rbe": { "rbe": "filter", @@ -1103,11 +1102,11 @@ "start": "Start value", "name": "Name", "septopics": "Apply mode separately for each ", - "gap": "value change", - "property": "property", - "topic": "topic" + "gap": "value change", + "property": "property", + "topic": "topic" }, - "placeholder":{ + "placeholder": { "bandgap": "e.g. 10 or 5%", "start": "leave blank to use first data received" }, diff --git a/packages/node_modules/@node-red/nodes/locales/ja/function/10-function.html b/packages/node_modules/@node-red/nodes/locales/ja/function/10-function.html index a18e5e8a8..960b755f6 100644 --- a/packages/node_modules/@node-red/nodes/locales/ja/function/10-function.html +++ b/packages/node_modules/@node-red/nodes/locales/ja/function/10-function.html @@ -28,7 +28,7 @@

    返却/sendの対象は次のとおりです:

    • 単一メッセージオブジェクト - 最初の出力に接続されたノードに渡されます
    • -
    • メッセージオブジェクトの配列 - 対応する出力に接続されたノードに渡されます
    • +
    • メッセージオブジェクトの配列 - 対応する出力に接続されたノードに渡されます

    注: 初期化処理の実行はノードの初期化中に行われます。そのため、初期化処理タブにsendを記述した場合に後続ノードでメッセージを受け取れないことがあります。

    配列要素が配列の場合には、複数のメッセージを対応する出力に送出します。

    diff --git a/packages/node_modules/@node-red/nodes/locales/ja/messages.json b/packages/node_modules/@node-red/nodes/locales/ja/messages.json index c331f5912..6e16daa6f 100644 --- a/packages/node_modules/@node-red/nodes/locales/ja/messages.json +++ b/packages/node_modules/@node-red/nodes/locales/ja/messages.json @@ -137,7 +137,7 @@ "toConsole": "システムコンソール", "toStatus": "ノードステータス(32 文字)", "severity": "Level", - "node": "ノード", + "node": "ノード", "notification": { "activated": "有効化しました: __label__", "deactivated": "無効化しました: __label__" @@ -729,8 +729,8 @@ "property": "プロパティ", "rule": "条件", "repair": "メッセージ列の補正", - "value-rules": "値ルール", - "sequence-rules": "列ルール" + "value-rules": "値ルール", + "sequence-rules": "列ルール" }, "previous": "前回の値", "and": "~", @@ -928,6 +928,7 @@ "write": "write file", "read": "read file", "filename": "ファイル名", + "path": "パス", "action": "動作", "addnewline": "メッセージの入力のたびに改行を追加", "createdir": "ディレクトリが存在しない場合は作成", diff --git a/packages/node_modules/@node-red/nodes/locales/ja/network/10-mqtt.html b/packages/node_modules/@node-red/nodes/locales/ja/network/10-mqtt.html index 1b43ea097..435829e1e 100644 --- a/packages/node_modules/@node-red/nodes/locales/ja/network/10-mqtt.html +++ b/packages/node_modules/@node-red/nodes/locales/ja/network/10-mqtt.html @@ -89,7 +89,7 @@
    userProperties オブジェクト
    MQTTv5: メッセージのユーザプロパティ
    messageExpiryInterval 数値
    -
    MQTTv5: 秒単位のメッセージの有効期限
    +
    MQTTv5: 秒単位のメッセージの有効期限
    topicAlias 数値
    MQTTv5: 使用するMQTTトピックエイリアス
    diff --git a/packages/node_modules/@node-red/nodes/package.json b/packages/node_modules/@node-red/nodes/package.json index 2a0d7e7c1..5df2fd503 100644 --- a/packages/node_modules/@node-red/nodes/package.json +++ b/packages/node_modules/@node-red/nodes/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/nodes", - "version": "3.0.0-beta.2", + "version": "3.0.0-beta.3", "license": "Apache-2.0", "repository": { "type": "git", @@ -36,7 +36,7 @@ "js-yaml": "4.1.0", "media-typer": "1.1.0", "mqtt": "4.3.7", - "multer": "1.4.4", + "multer": "1.4.5-lts.1", "mustache": "4.2.0", "node-watch": "0.7.3", "on-headers": "1.0.2", diff --git a/packages/node_modules/@node-red/registry/lib/externalModules.js b/packages/node_modules/@node-red/registry/lib/externalModules.js index ca1e4bfd8..b61392d9b 100644 --- a/packages/node_modules/@node-red/registry/lib/externalModules.js +++ b/packages/node_modules/@node-red/registry/lib/externalModules.js @@ -11,6 +11,7 @@ const exec = require("@node-red/util").exec; const log = require("@node-red/util").log; const hooks = require("@node-red/util").hooks; const url = require("url"); +const { createRequire } = require("module"); const BUILTIN_MODULES = require('module').builtinModules; @@ -139,10 +140,15 @@ function importModule(module) { } const externalModuleDir = getInstallDir(); const moduleDir = path.join(externalModuleDir,"node_modules",module); + // To handle both CJS and ESM we need to resolve the module to the + // specific file that is loaded when the module is required/imported + // As this won't be on the natural module search path, we use createRequire + // to access the module + const modulePath = createRequire(moduleDir).resolve(module) // Import needs the full path to the module's main .js file // It also needs to be a file:// url for Windows - const moduleFile = url.pathToFileURL(require.resolve(moduleDir)); - return import(moduleFile); + const moduleUrl = url.pathToFileURL(modulePath); + return import(moduleUrl); } function parseModuleName(module) { diff --git a/packages/node_modules/@node-red/registry/lib/localfilesystem.js b/packages/node_modules/@node-red/registry/lib/localfilesystem.js index 62080b4a8..da4006ecc 100644 --- a/packages/node_modules/@node-red/registry/lib/localfilesystem.js +++ b/packages/node_modules/@node-red/registry/lib/localfilesystem.js @@ -88,9 +88,10 @@ function getLocalFile(file) { /** * Synchronously walks the directory looking for node files. * @param dir the directory to search + * @param skipValidNodeRedModules a flag to skip lading icons & files if the directory a valid node-red module * @return an array of fully-qualified paths to .js files */ -function getLocalNodeFiles(dir) { +function getLocalNodeFiles(dir, skipValidNodeRedModules) { dir = path.resolve(dir); var result = []; @@ -102,6 +103,14 @@ function getLocalNodeFiles(dir) { return {files: [], icons: []}; } files.sort(); + // when loading local files, if the path is a valid node-red module + // dont include it (will be picked up in scanTreeForNodesModules) + if(skipValidNodeRedModules && files.indexOf("package.json") >= 0) { + const package = getPackageDetails(dir) + if(package.isNodeRedModule) { + return {files: [], icons: []}; + } + } files.forEach(function(fn) { var stats = fs.statSync(path.join(dir,fn)); if (stats.isFile()) { @@ -114,7 +123,7 @@ function getLocalNodeFiles(dir) { } else if (stats.isDirectory()) { // Ignore /.dirs/, /lib/ /node_modules/ if (!/^(\..*|lib|icons|node_modules|test|locales)$/.test(fn)) { - var subDirResults = getLocalNodeFiles(path.join(dir,fn)); + var subDirResults = getLocalNodeFiles(path.join(dir,fn), skipValidNodeRedModules); result = result.concat(subDirResults.files); icons = icons.concat(subDirResults.icons); } else if (fn === "icons") { @@ -126,21 +135,30 @@ function getLocalNodeFiles(dir) { return {files: result, icons: icons} } -function scanDirForNodesModules(dir,moduleName) { - var results = []; - var scopeName; +function scanDirForNodesModules(dir,moduleName,package) { + let results = []; + let scopeName; + let files try { - var files = fs.readdirSync(dir); - if (moduleName) { - var m = /^(?:(@[^/]+)[/])?([^@/]+)/.exec(moduleName); - if (m) { - scopeName = m[1]; - moduleName = m[2]; + let isNodeRedModule = false + if(package) { + dir = path.join(package.moduleDir,'..') + files = [path.basename(package.moduleDir)] + moduleName = (package.package ? package.package.name : null) || moduleName + isNodeRedModule = package.isNodeRedModule + } else { + files = fs.readdirSync(dir); + if (moduleName) { + var m = /^(?:(@[^/]+)[/])?([^@/]+)/.exec(moduleName); + if (m) { + scopeName = m[1]; + moduleName = m[2]; + } } } - for (var i=0;i look for node_modules + 2. exist(package.json) && package.json.has(node-red) => load this only + 3. in original scan of nodesDir, ignore if:(exist(package.json) && package.json.has(node-red)) + */ + if (nodesDir) { + for (let dirIndex = 0; dirIndex < nodesDir.length; dirIndex++) { + const nodeDir = nodesDir[dirIndex]; + const packageDetails = getPackageDetails(nodeDir) + if(packageDetails.isNodeRedModule) { + //we have found a node-red module, scan it + const nrModules = scanDirForNodesModules(nodeDir, packageDetails.package.name, packageDetails); + results = results.concat(nrModules); + + } else if (packageDetails.has_node_modules) { + //If this dir has a `node_modues` dir, scan it + const nodeModulesDir = path.join(nodeDir, 'node_modules') + const nrModules = scanDirForNodesModules(nodeModulesDir, moduleName ); + results = results.concat(nrModules); + + } else { + //If this is not a node-red module AND it does NOT have a node_modules dir, + //it may be a directory of project directories or a node_modules dir? + //scan this instead + const nrModules = scanDirForNodesModules(nodeDir, moduleName); + results = results.concat(nrModules); + } } } return results; @@ -274,24 +328,26 @@ function getModuleNodeFiles(module) { } function getNodeFiles(disableNodePathScan) { - var dir; // Find all of the nodes to load - var nodeFiles = []; - var results; - - var dir; - var iconList = []; + let results; + let nodesDir; + if(settings.nodesDir) { + nodesDir = Array.isArray(settings.nodesDir) ? settings.nodesDir : [settings.nodesDir] + } + let dir; + let nodeFiles = []; + let iconList = []; if (settings.coreNodesDir) { results = getLocalNodeFiles(path.resolve(settings.coreNodesDir)); nodeFiles = nodeFiles.concat(results.files); iconList = iconList.concat(results.icons); - var defaultLocalesPath = path.join(settings.coreNodesDir,"locales"); + let defaultLocalesPath = path.join(settings.coreNodesDir,"locales"); i18n.registerMessageCatalog("node-red",defaultLocalesPath,"messages.json"); } if (settings.userDir) { dir = path.join(settings.userDir,"lib","icons"); - var icons = scanIconDir(dir); + let icons = scanIconDir(dir); if (icons.length > 0) { iconList.push({path:dir,icons:icons}); } @@ -301,13 +357,9 @@ function getNodeFiles(disableNodePathScan) { nodeFiles = nodeFiles.concat(results.files); iconList = iconList.concat(results.icons); } - if (settings.nodesDir) { - dir = settings.nodesDir; - if (typeof settings.nodesDir == "string") { - dir = [dir]; - } - for (var i=0;i diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/loose1.html b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose1.html new file mode 100644 index 000000000..8f392056c --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose1.html @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/loose1.js b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose1.js new file mode 100644 index 000000000..624cfe6d8 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose1.js @@ -0,0 +1,4 @@ + + (function() { + console.log("hello from loose1.js") + })() diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/icons/loose2.svg b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/icons/loose2.svg new file mode 100644 index 000000000..04bebc370 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/icons/loose2.svg @@ -0,0 +1 @@ + diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/icons/loose2b.svg b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/icons/loose2b.svg new file mode 100644 index 000000000..250348861 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/icons/loose2b.svg @@ -0,0 +1 @@ + diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/loose2.html b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/loose2.html new file mode 100644 index 000000000..e23e2880a --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/loose2.html @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/loose2.js b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/loose2.js new file mode 100644 index 000000000..e1cde2a82 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/loose2/loose2.js @@ -0,0 +1,4 @@ + + (function() { + console.log("hello from loose2.js") + })() diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/node-red-node-testnode/icons/test.svg b/test/unit/@node-red/registry/lib/resources/nodesDir1/node-red-node-testnode/icons/test.svg new file mode 100644 index 000000000..04bebc370 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/node-red-node-testnode/icons/test.svg @@ -0,0 +1 @@ + diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/node-red-node-testnode/main.js b/test/unit/@node-red/registry/lib/resources/nodesDir1/node-red-node-testnode/main.js new file mode 100644 index 000000000..e2e0781d1 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/node-red-node-testnode/main.js @@ -0,0 +1,4 @@ + + (function() { + console.log("hello from regular module main.js") + })() diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/node-red-node-testnode/package.json b/test/unit/@node-red/registry/lib/resources/nodesDir1/node-red-node-testnode/package.json new file mode 100644 index 000000000..26d4151fb --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/node-red-node-testnode/package.json @@ -0,0 +1,19 @@ +{ + "name": "node-red-node-testnode", + "version": "1.0.0", + "description": "A node-red node that does nothing other than exist", + "main": "main.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [ + "node-red" + ], + "node-red": { + "nodes": { + "testnode": "index.js" + } + }, + "author": "@testyMcTersterson", + "license": "MIT" +} diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/regular_module/icons/test.svg b/test/unit/@node-red/registry/lib/resources/nodesDir1/regular_module/icons/test.svg new file mode 100644 index 000000000..04bebc370 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/regular_module/icons/test.svg @@ -0,0 +1 @@ + diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/regular_module/main.js b/test/unit/@node-red/registry/lib/resources/nodesDir1/regular_module/main.js new file mode 100644 index 000000000..e2e0781d1 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/regular_module/main.js @@ -0,0 +1,4 @@ + + (function() { + console.log("hello from regular module main.js") + })() diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir1/regular_module/package.json b/test/unit/@node-red/registry/lib/resources/nodesDir1/regular_module/package.json new file mode 100644 index 000000000..23cfd7e86 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir1/regular_module/package.json @@ -0,0 +1,14 @@ +{ + "name": "regular_node", + "version": "1.0.0", + "description": "A regular node that does nothing other than exist", + "main": "main.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [ + "test" + ], + "author": "@testyMcTersterson", + "license": "MIT" +} diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir2/@test/testnode/index.html b/test/unit/@node-red/registry/lib/resources/nodesDir2/@test/testnode/index.html new file mode 100644 index 000000000..0e45b3007 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir2/@test/testnode/index.html @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir2/@test/testnode/index.js b/test/unit/@node-red/registry/lib/resources/nodesDir2/@test/testnode/index.js new file mode 100644 index 000000000..1fe9d89a3 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir2/@test/testnode/index.js @@ -0,0 +1,4 @@ + + (function() { + console.log("hello from @test/testnode index.js") + })() diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir2/@test/testnode/package.json b/test/unit/@node-red/registry/lib/resources/nodesDir2/@test/testnode/package.json new file mode 100644 index 000000000..a32462631 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir2/@test/testnode/package.json @@ -0,0 +1,20 @@ +{ + "name": "@test/testnode", + "version": "1.0.0", + "description": "A test node that does nothing other than exist", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [ + "node-red", + "test" + ], + "node-red": { + "nodes": { + "testnode": "index.js" + } + }, + "author": "@testyMcTersterson", + "license": "MIT" +} diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir2/testnode2/index.html b/test/unit/@node-red/registry/lib/resources/nodesDir2/testnode2/index.html new file mode 100644 index 000000000..5d9f2b0ec --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir2/testnode2/index.html @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir2/testnode2/index.js b/test/unit/@node-red/registry/lib/resources/nodesDir2/testnode2/index.js new file mode 100644 index 000000000..0f0eba392 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir2/testnode2/index.js @@ -0,0 +1,4 @@ + + (function() { + console.log("hello from testnode2 index.js") + })() diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir2/testnode2/package.json b/test/unit/@node-red/registry/lib/resources/nodesDir2/testnode2/package.json new file mode 100644 index 000000000..f9e8aecbe --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir2/testnode2/package.json @@ -0,0 +1,20 @@ +{ + "name": "testnode2", + "version": "1.0.0", + "description": "A test node that does nothing other than exist", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [ + "node-red", + "test" + ], + "node-red": { + "nodes": { + "testnode2": "index.js" + } + }, + "author": "@testyMcTersterson", + "license": "MIT" +} diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/files/clientside.js b/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/files/clientside.js new file mode 100644 index 000000000..fb2e22289 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/files/clientside.js @@ -0,0 +1,3 @@ +(function() { + console.log("Hi from test plugin client side") +})() diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/files/plugin.js b/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/files/plugin.js new file mode 100644 index 000000000..3202aeb8b --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/files/plugin.js @@ -0,0 +1,14 @@ +module.exports = function (RED) { + RED.plugins.registerPlugin('test-theme', { + type: 'node-red-theme', + scripts: [ + 'files/clientside.js' + ], + css: [ + 'files/theme.css', + ], + monacoOptions: { + theme: "vs" + } + }) +} diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/files/theme.css b/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/files/theme.css new file mode 100644 index 000000000..872c93e10 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/files/theme.css @@ -0,0 +1 @@ +:root{--red-ui-primary-background: #f2f3fb;} \ No newline at end of file diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/package.json b/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/package.json new file mode 100644 index 000000000..b8608c175 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir2/theme-plugin2/package.json @@ -0,0 +1,24 @@ +{ + "name": "test-theme2", + "version": "0.0.1", + "description": "test theme for Node-RED", + + "keywords": [ + "node-red", + "plugin", + "theme" + ], + "author": { + "name": "testy-McTesterson" + }, + "license": "MIT", + "node-red": { + "version": ">=2.2.0", + "plugins": { + "test-theme2": "files/plugin.js" + } + }, + "engines": { + "node": ">=12.x" + } +} diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/testnode/index.html b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/testnode/index.html new file mode 100644 index 000000000..0e45b3007 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/testnode/index.html @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/testnode/index.js b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/testnode/index.js new file mode 100644 index 000000000..1fe9d89a3 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/testnode/index.js @@ -0,0 +1,4 @@ + + (function() { + console.log("hello from @test/testnode index.js") + })() diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/testnode/package.json b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/testnode/package.json new file mode 100644 index 000000000..a32462631 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/testnode/package.json @@ -0,0 +1,20 @@ +{ + "name": "@test/testnode", + "version": "1.0.0", + "description": "A test node that does nothing other than exist", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [ + "node-red", + "test" + ], + "node-red": { + "nodes": { + "testnode": "index.js" + } + }, + "author": "@testyMcTersterson", + "license": "MIT" +} diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/files/clientside.js b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/files/clientside.js new file mode 100644 index 000000000..fb2e22289 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/files/clientside.js @@ -0,0 +1,3 @@ +(function() { + console.log("Hi from test plugin client side") +})() diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/files/plugin.js b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/files/plugin.js new file mode 100644 index 000000000..3202aeb8b --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/files/plugin.js @@ -0,0 +1,14 @@ +module.exports = function (RED) { + RED.plugins.registerPlugin('test-theme', { + type: 'node-red-theme', + scripts: [ + 'files/clientside.js' + ], + css: [ + 'files/theme.css', + ], + monacoOptions: { + theme: "vs" + } + }) +} diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/files/theme.css b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/files/theme.css new file mode 100644 index 000000000..872c93e10 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/files/theme.css @@ -0,0 +1 @@ +:root{--red-ui-primary-background: #f2f3fb;} \ No newline at end of file diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/package.json b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/package.json new file mode 100644 index 000000000..56b1bfb6d --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/@test/theme-plugin3/package.json @@ -0,0 +1,24 @@ +{ + "name": "@test/test-theme3", + "version": "0.0.1", + "description": "test theme for Node-RED", + + "keywords": [ + "node-red", + "plugin", + "theme" + ], + "author": { + "name": "testy-McTesterson" + }, + "license": "MIT", + "node-red": { + "version": ">=2.2.0", + "plugins": { + "test-theme3": "files/plugin.js" + } + }, + "engines": { + "node": ">=12.x" + } +} diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/testnode3/index.html b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/testnode3/index.html new file mode 100644 index 000000000..a4034f340 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/testnode3/index.html @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/testnode3/index.js b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/testnode3/index.js new file mode 100644 index 000000000..855768ad8 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/testnode3/index.js @@ -0,0 +1,4 @@ + + (function() { + console.log("hello from testnode3 index.js") + })() diff --git a/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/testnode3/package.json b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/testnode3/package.json new file mode 100644 index 000000000..41e9bb8f8 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/nodesDir3/node_modules/testnode3/package.json @@ -0,0 +1,20 @@ +{ + "name": "testnode3", + "version": "1.0.0", + "description": "A test node that does nothing other than exist", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [ + "node-red", + "test" + ], + "node-red": { + "nodes": { + "testnode3": "index.js" + } + }, + "author": "@testyMcTersterson", + "license": "MIT" +} diff --git a/test/unit/@node-red/util/lib/util_spec.js b/test/unit/@node-red/util/lib/util_spec.js index 2013f143e..3bab2739a 100644 --- a/test/unit/@node-red/util/lib/util_spec.js +++ b/test/unit/@node-red/util/lib/util_spec.js @@ -388,6 +388,19 @@ describe("@node-red/util/util", function() { result[0].should.eql(1); result[1].should.eql(2); }); + it('throws an error if buffer data is not array or string', function (done) { + try { + var result = util.evaluateNodeProperty('12','bin'); + done("should throw an error"); + } catch (err) { + if (err.code === "INVALID_BUFFER_DATA") { + done(); + } + else { + done("should throw an error"); + } + } + }); it('returns msg property',function() { var result = util.evaluateNodeProperty('foo.bar','msg',{},{foo:{bar:"123"}}); result.should.eql("123");