├── Screenshots ├── Editor.png ├── Types_1.png ├── Types_2.png └── Code Editor (TS).png ├── src └── FlowScript │ ├── libs │ ├── v8-x64.dll │ └── v8-x86.dll │ ├── wwwroot │ ├── views │ │ ├── Forum.html │ │ └── NewProjectForm.html │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ ├── glyphicons-halflings-regular.woff2 │ │ └── readme.txt │ ├── tests │ │ ├── simple │ │ │ ├── Tests.d.ts │ │ │ └── index.html │ │ └── tsconfig.json │ ├── swagger-ui │ │ ├── swagger-custom.css │ │ └── index.html │ ├── js │ │ ├── flowscriptrt.tsbuildinfo │ │ └── flowscript.tsbuildinfo │ ├── editor.html │ └── css │ │ ├── site.css │ │ └── editor.css │ ├── TypeScript │ ├── System │ │ ├── Google Chrome.lnk │ │ ├── globals.server.ts │ │ ├── Runtime │ │ │ └── tsconfig.json │ │ ├── Thread.ts │ │ ├── tsconfig.json │ │ ├── bootup.ts │ │ ├── _references.ts.txt │ │ ├── Event.ts │ │ ├── components │ │ │ ├── Core.HTTPRequest.ts │ │ │ ├── Core.Binary.ts │ │ │ ├── Core.ControlFlow.ts │ │ │ └── Core.Math.ts │ │ ├── Table.ts │ │ ├── User.ts │ │ ├── Security.ts │ │ ├── Solution.ts │ │ ├── Statement.ts │ │ ├── Message.ts │ │ └── NamedReference.ts │ ├── Client │ │ ├── environments │ │ │ ├── serverlib.d.ts.fs │ │ │ └── empty.ts.fs │ │ ├── app_forum.ts │ │ ├── old │ │ │ ├── System │ │ │ │ ├── bootup.ts.txt │ │ │ │ ├── bootup.js │ │ │ │ ├── Thread.js │ │ │ │ ├── Thread.ts.txt │ │ │ │ ├── TypeDefinition.ts.txt │ │ │ │ ├── Event.ts.txt │ │ │ │ ├── Event.js │ │ │ │ ├── TypeDefinition.js │ │ │ │ ├── Definitions │ │ │ │ │ ├── Core.HTTPRequest.ts.txt │ │ │ │ │ ├── Core.Binary.ts.txt │ │ │ │ │ ├── Core.ControlFlow.ts.txt │ │ │ │ │ └── Core.Math.ts.txt │ │ │ │ ├── Table.ts.txt │ │ │ │ ├── Enum.js │ │ │ │ ├── Table.js │ │ │ │ ├── Projects.js │ │ │ │ ├── Message.ts.txt │ │ │ │ ├── Projects.ts.txt │ │ │ │ └── Message.js │ │ │ └── _references.ts.txt │ │ ├── tsconfig.json │ │ ├── TextEditor.ts │ │ ├── tests │ │ │ └── tests.ts │ │ ├── ProjectUI.ts │ │ ├── Client.ts │ │ └── TreeView.ts │ ├── Server │ │ ├── Server.ts │ │ └── tsconfig.json │ └── Shared.ts │ ├── appsettings.json │ ├── appsettings.Development.json │ ├── Models │ ├── Project.cs │ ├── ProjectInfo.cs │ └── Response.cs │ ├── .JSServer │ ├── IJSServer.cs │ ├── IJSContext.cs │ └── Integrations │ │ ├── VroomIntegration.cs │ │ ├── V8DotNetIntegration.cs │ │ └── ChakraIntegration.cs │ ├── package.json │ ├── tsconfig-base.json │ ├── Dockerfile │ ├── Properties │ └── launchSettings.json │ ├── Program.cs │ ├── API │ ├── TemplateController.cs │ ├── ProjectsController.cs │ └── FileController.cs │ ├── package-lock.json │ ├── ServerScriptManager.cs │ └── FlowScript.xml ├── .dockerignore ├── readme.txt ├── docker-compose.override.yml ├── .github └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── docker-compose.dcproj ├── docker-compose.yml ├── LICENSE ├── .gitattributes ├── FlowScript.sln └── .gitignore /Screenshots/Editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjamesnw/FlowScript/HEAD/Screenshots/Editor.png -------------------------------------------------------------------------------- /Screenshots/Types_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjamesnw/FlowScript/HEAD/Screenshots/Types_1.png -------------------------------------------------------------------------------- /Screenshots/Types_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjamesnw/FlowScript/HEAD/Screenshots/Types_2.png -------------------------------------------------------------------------------- /src/FlowScript/libs/v8-x64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjamesnw/FlowScript/HEAD/src/FlowScript/libs/v8-x64.dll -------------------------------------------------------------------------------- /src/FlowScript/libs/v8-x86.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjamesnw/FlowScript/HEAD/src/FlowScript/libs/v8-x86.dll -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .dockerignore 2 | .env 3 | .git 4 | .gitignore 5 | .vs 6 | .vscode 7 | */bin 8 | */obj 9 | **/.toolstarget -------------------------------------------------------------------------------- /Screenshots/Code Editor (TS).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjamesnw/FlowScript/HEAD/Screenshots/Code Editor (TS).png -------------------------------------------------------------------------------- /src/FlowScript/wwwroot/views/Forum.html: -------------------------------------------------------------------------------- 1 | 2 | @{ 3 | ViewBag.Title = "Forum"; 4 | } 5 | 6 |

Forum goes here. ;)

7 | 8 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/System/Google Chrome.lnk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjamesnw/FlowScript/HEAD/src/FlowScript/TypeScript/System/Google Chrome.lnk -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/System/globals.server.ts: -------------------------------------------------------------------------------- 1 | var location: Location; 2 | var navigator: Navigator; 3 | var window: Window; 4 | var document: Document; -------------------------------------------------------------------------------- /src/FlowScript/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Warning" 5 | } 6 | }, 7 | "AllowedHosts": "*" 8 | } 9 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/environments/serverlib.d.ts.fs: -------------------------------------------------------------------------------- 1 | /** 2 | * Back-end server variable - just an idea (testing). 3 | */ 4 | declare var server: { name: string }; -------------------------------------------------------------------------------- /src/FlowScript/wwwroot/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjamesnw/FlowScript/HEAD/src/FlowScript/wwwroot/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /src/FlowScript/wwwroot/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjamesnw/FlowScript/HEAD/src/FlowScript/wwwroot/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /src/FlowScript/wwwroot/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjamesnw/FlowScript/HEAD/src/FlowScript/wwwroot/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /src/FlowScript/wwwroot/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjamesnw/FlowScript/HEAD/src/FlowScript/wwwroot/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /src/FlowScript/wwwroot/fonts/readme.txt: -------------------------------------------------------------------------------- 1 | These fonts are only relevant if `bootstrap.css` (3.0) is loaded from the `wwwroot/css` directory. Boot 2 | If loaded via CDN, then these fonts are ignored. -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Server/Server.ts: -------------------------------------------------------------------------------- 1 | namespace FlowScript { 2 | export class FlowScriptServer extends FlowScriptBase { 3 | y2 = 1; 4 | 5 | main() { 6 | 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /src/FlowScript/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Microsoft": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/FlowScript/wwwroot/tests/simple/Tests.d.ts: -------------------------------------------------------------------------------- 1 | declare namespace FlowScript.Tests { 2 | class Dist2DTest extends Component { 3 | constructor(parent?: NamespaceObject); 4 | onInit(): void; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/environments/empty.ts.fs: -------------------------------------------------------------------------------- 1 | /* 2 | * Enter your TypeScript code here. 3 | * 4 | * Description: 5 | * Create On: 6 | * Created BY: 7 | * Last Updated On: 8 | * Last Updated By: 9 | */ 10 | 11 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Shared.ts: -------------------------------------------------------------------------------- 1 | /** The root namespace for the FlowScript system. */ 2 | namespace FlowScript { 3 | /** The shared base class for both client and server side scripts. */ 4 | export class FlowScriptBase { 5 | } 6 | } -------------------------------------------------------------------------------- /src/FlowScript/wwwroot/views/NewProjectForm.html: -------------------------------------------------------------------------------- 1 | Project Title:
2 | Project Description:
3 | 4 | -------------------------------------------------------------------------------- /src/FlowScript/Models/Project.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.AspNetCore.Mvc; 3 | 4 | namespace FlowScript.API 5 | { 6 | public class Project : APIResponseBase 7 | { 8 | public ProjectInfo Info; 9 | 10 | public string Script; 11 | } 12 | } -------------------------------------------------------------------------------- /src/FlowScript/.JSServer/IJSServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace FlowScript 7 | { 8 | public interface IJSServer 9 | { 10 | string Name { get; set; } 11 | IJSContext CreateContext(string name); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/FlowScript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0.0", 3 | "name": "FlowScript", 4 | "private": true, 5 | "devDependencies": {}, 6 | "dependencies": { 7 | "@types/jquery": "^3.3.29", 8 | "@types/requirejs": "^2.1.31", 9 | "monaco-editor": "^0.15.6", 10 | "requirejs": "^2.3.6", 11 | "typescript": "^3.3.3333" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/FlowScript/.JSServer/IJSContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace FlowScript 7 | { 8 | public interface IJSContext 9 | { 10 | string Name { get; } 11 | object Execute(string js, string scriptName = null); 12 | object RunFile(string filename); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/app_forum.ts: -------------------------------------------------------------------------------- 1 | /** this is called when the user selects to view the forum. */ 2 | function loadForum() { 3 | rootBodyViewContainer.createView("Forum", "/IDE/Forum").onloaded((view, req, ev) => { 4 | view.buildViews(); // (search and parse views, if any) 5 | view.show(); 6 | }).onerror((view, request, ev) => { view.contentElement.innerHTML = "Communication error - please try again."; }).send(); 7 | } -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | export_vscode_extensions.cmd - Run to export your current extensions to an install script. 2 | install_extensions.cmd - Generated by running 'export_vscode_extensions.cmd' to allow quick setup of new VS Code environments. 3 | 4 | Helpful Tools: 5 | Git Credential Manager: https://github.com/Microsoft/Git-Credential-Manager-for-Windows/ 6 | 7 | Pure HTML5/JS Plugins/Widgets: 8 | https://designmodo.com/free-javascript-plugins/ 9 | https://robinparisi.github.io/tingle/ 10 | -------------------------------------------------------------------------------- /src/FlowScript/tsconfig-base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "compilerOptions": { 4 | "noImplicitAny": true, 5 | "noEmitOnError": true, 6 | "removeComments": false, 7 | "sourceMap": true, 8 | "target": "es3", 9 | "rootDir": "TypeScript", 10 | "outDir": "wwwroot/js", 11 | "declaration": true, 12 | "typeRoots": [ "node_modules/@types", "TypeScript/Types" ] 13 | } //, 14 | //"exclude": [ 15 | // "node_modules" 16 | //] 17 | } 18 | -------------------------------------------------------------------------------- /src/FlowScript/Models/ProjectInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.AspNetCore.Mvc; 3 | 4 | namespace FlowScript.API 5 | { 6 | /// Holds information about a project in the 'Projects' folder. 7 | 8 | public class ProjectInfo : APIResponseBase 9 | { 10 | public string Name; 11 | 12 | /// This is a GUID assigned to the project when it gets created. 13 | public string ID; 14 | } 15 | } -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/System/Runtime/tsconfig.json: -------------------------------------------------------------------------------- 1 | // FlowScript Core 2 | { 3 | "extends": "../../../tsconfig-base.json", 4 | "compilerOptions": { 5 | "composite": true, 6 | "target": "es6", // (Makes sure we take advantage of Node's built-in async functionality.) 7 | "outFile": "../../../wwwroot/js/flowscriptrt.js", 8 | "declaration": true 9 | }, 10 | "files": [ 11 | "FlowScriptRT.ts" 12 | ], 13 | "exclude": [ 14 | "node_modules" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /src/FlowScript/wwwroot/tests/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.json", 3 | "references": [ 4 | { "path": "../../TypeScript/System/Runtime" }, 5 | { "path": "../../TypeScript/System" } 6 | ], 7 | "compilerOptions": { 8 | "target": "es6", 9 | "module": "amd", 10 | "rootDir": "", 11 | "outDir": "" 12 | }, 13 | "include": [ 14 | //"../js/flowscript.d.ts", 15 | "**/*.ts", 16 | "../../API/Response.cs" 17 | ], 18 | "exclude": [ "old" ] 19 | } 20 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.json", 3 | "references": [ 4 | { "path": "../System/Runtime" }, 5 | { "path": "../System" } 6 | ], 7 | "compilerOptions": { 8 | "target": "es6", 9 | "module": "none", 10 | "outFile": "./server.js" 11 | }, 12 | "files": [ 13 | "../System/globals.server.ts", 14 | "../Shared.ts", 15 | "Server.ts" 16 | ], 17 | "include": [ 18 | "../../node_modules/typescript/lib/tsserverlibrary.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /docker-compose.override.yml: -------------------------------------------------------------------------------- 1 | version: '3.4' 2 | 3 | services: 4 | flowscript: 5 | environment: 6 | - ASPNETCORE_ENVIRONMENT=Development 7 | - ASPNETCORE_URLS=https://+:443;http://+:80 8 | ports: 9 | - "44300:80" 10 | - "44370:443" 11 | volumes: 12 | - ${APPDATA}/ASP.NET/Https:C:\Users\ContainerUser\AppData\Roaming\ASP.NET\Https:ro 13 | - ${APPDATA}/Microsoft/UserSecrets:C:\Users\ContainerUser\AppData\Roaming\Microsoft\UserSecrets:ro 14 | networks: 15 | default: 16 | external: 17 | name: nat 18 | -------------------------------------------------------------------------------- /src/FlowScript/wwwroot/swagger-ui/swagger-custom.css: -------------------------------------------------------------------------------- 1 | .topbar { 2 | background: #222 !important; 3 | } 4 | 5 | #select { /*Select API Dropdown*/ 6 | background: #666 !important; 7 | } 8 | 9 | .download-url-wrapper { 10 | display: none !important; 11 | } 12 | 13 | .url { 14 | display: none !important; 15 | } 16 | 17 | #info a { 18 | color: #007bff !important; 19 | text-decoration: none !important; 20 | } 21 | 22 | #api_info a:hover, 23 | #api_info a:focus, 24 | #api_info a:active { 25 | color: #0056b3 !important; 26 | text-decoration: underline !important; 27 | } 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /src/FlowScript/wwwroot/tests/simple/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | FlowScript Tests 6 | 11 | 12 | 13 | 14 | 15 | 16 |

FlowScript Tests


17 |
18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/FlowScript/wwwroot/js/flowscriptrt.tsbuildinfo: -------------------------------------------------------------------------------- 1 | { 2 | "bundle": { 3 | "commonSourceDirectory": "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/", 4 | "sourceFiles": [ 5 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Runtime/FlowScriptRT.ts" 6 | ], 7 | "js": { 8 | "sections": [ 9 | { 10 | "pos": 0, 11 | "end": 99351, 12 | "kind": "text" 13 | } 14 | ] 15 | }, 16 | "dts": { 17 | "sections": [ 18 | { 19 | "pos": 0, 20 | "end": 35227, 21 | "kind": "text" 22 | } 23 | ] 24 | } 25 | }, 26 | "version": "3.4.1" 27 | } -------------------------------------------------------------------------------- /docker-compose.dcproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 2.1 5 | Windows 6 | 7466f4f0-9a2c-438b-bab7-476373a703d4 7 | LaunchBrowser 8 | {Scheme}://{ServiceIPAddress}{ServicePort} 9 | flowscript 10 | 11 | 12 | 13 | docker-compose.yml 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/old/System/bootup.ts.txt: -------------------------------------------------------------------------------- 1 | namespace FlowScript { 2 | // ======================================================================================================================== 3 | 4 | NamespaceObject.All = new Core.All(); 5 | NamespaceObject.Inferred = new Core.Inferred(); 6 | 7 | // ======================================================================================================================== 8 | 9 | /** Contains the default core system types expected by the compiler. Since these core types must always exist, a default 10 | * type graph is created here for convenience. 11 | */ 12 | export var System = createNew().System; 13 | 14 | // ======================================================================================================================== 15 | } -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.4' #Example http://www.andreavallotti.tech/en/2017/10/using-ef-cores-migration-with-docker-and-mysql/ 2 | 3 | services: 4 | 5 | #mysql: 6 | # image: mysql:5.7.18 7 | # container_name: flowscript-mysql 8 | # environment: 9 | # MYSQL_ROOT_PASSWORD: "p4ssw0r#" 10 | # MYSQL_DATABASE: "flowscript" 11 | # volumes: 12 | # - ./mysql-data:/var/lib/mysql 13 | # restart: always 14 | # networks: 15 | # - nat 16 | 17 | flowscript: 18 | image: ${DOCKER_REGISTRY-}flowscript 19 | build: 20 | context: . 21 | dockerfile: src\FlowScript\Dockerfile 22 | #depends_on: 23 | # - mysql 24 | #networks: 25 | # - nat 26 | 27 | #volumes: 28 | #mysql-data: 29 | 30 | #network_mode: "bridge" 31 | 32 | #networks: 33 | #nat: 34 | #driver: bridge -------------------------------------------------------------------------------- /src/FlowScript/Dockerfile: -------------------------------------------------------------------------------- 1 | #Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed. 2 | #For more information, please see https://aka.ms/containercompat 3 | 4 | FROM microsoft/dotnet:2.2-aspnetcore-runtime-nanoserver-1803 AS base 5 | WORKDIR /app 6 | EXPOSE 80 7 | EXPOSE 443 8 | 9 | FROM microsoft/dotnet:2.2-sdk-nanoserver-1803 AS build 10 | WORKDIR /src 11 | COPY ["FlowScript/FlowScript.csproj", "FlowScript/"] 12 | RUN dotnet restore "FlowScript/FlowScript.csproj" 13 | COPY . . 14 | WORKDIR "/src/FlowScript" 15 | RUN dotnet build "FlowScript.csproj" -c Release -o /app 16 | 17 | FROM build AS publish 18 | RUN dotnet publish "FlowScript.csproj" -c Release -o /app 19 | 20 | FROM base AS final 21 | WORKDIR /app 22 | COPY --from=publish /app . 23 | ENTRYPOINT ["dotnet", "FlowScript.dll"] -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig-base.json", 3 | "references": [ 4 | { "path": "../System/Runtime" }, 5 | { "path": "../System" } 6 | ], 7 | "compilerOptions": { 8 | "target": "es6", 9 | "module": "amd", 10 | "outFile": "../../wwwroot/js/client.js", 11 | "types": [ 12 | "requirejs", 13 | "jquery", 14 | "bootstrap" 15 | ] 16 | }, 17 | "files": [ 18 | "../Shared.ts", 19 | "TreeView.ts", 20 | "TypeTreeView.ts", 21 | "ProjectUI.ts", 22 | "Menu.ts", 23 | "ListEditor.ts", 24 | "TextEditor.ts", 25 | "TextEditor.Monaco.ts", 26 | "ScriptEditor.ts", 27 | "tests/tests.ts", 28 | "Client.ts" 29 | ], 30 | "include": [ 31 | "../../node_modules/monaco-editor/monaco.d.ts", 32 | "../../node_modules/typescript/lib/typescriptServices.d.ts" 33 | ], 34 | "exclude": [ "old" ] 35 | } 36 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/old/System/bootup.js: -------------------------------------------------------------------------------- 1 | var FlowScript; 2 | (function (FlowScript) { 3 | // ======================================================================================================================== 4 | FlowScript.Type.All = new FlowScript.Core.All(); 5 | FlowScript.Type.Inferred = new FlowScript.Core.Inferred(); 6 | // ======================================================================================================================== 7 | /** Contains the default core system types expected by the compiler. Since these core types must always exist, a default 8 | * type graph is created here for convenience. 9 | */ 10 | FlowScript.System = FlowScript.createNew().System; 11 | // ======================================================================================================================== 12 | })(FlowScript || (FlowScript = {})); 13 | //# sourceMappingURL=bootup.js.map -------------------------------------------------------------------------------- /src/FlowScript/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "https://localhost:44370/", 7 | "sslPort": 44370 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "FlowScript": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "environmentVariables": { 22 | "ASPNETCORE_ENVIRONMENT": "Development" 23 | }, 24 | "applicationUrl": "https://localhost:5001;http://localhost:5000" 25 | }, 26 | "Docker": { 27 | "commandName": "Docker", 28 | "launchBrowser": true, 29 | "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}" 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. Scroll down to '....' 15 | 4. See error 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Desktop (please complete the following information):** 24 | - OS: [e.g. iOS] 25 | - Browser [e.g. chrome, safari] 26 | - Version [e.g. 22] 27 | 28 | **Smartphone (please complete the following information):** 29 | - Device: [e.g. iPhone6] 30 | - OS: [e.g. iOS8.1] 31 | - Browser [e.g. stock browser, safari] 32 | - Version [e.g. 22] 33 | 34 | **Additional context** 35 | Add any other context about the problem here. 36 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/TextEditor.ts: -------------------------------------------------------------------------------- 1 | // A wrapper for the ACE editor for use with editing code on the UI. 2 | 3 | namespace FlowScript.UI { 4 | export class TextEditor { 5 | 6 | /** The view the editor is on, if any. */ 7 | view: View; 8 | 9 | /** The target element to render the editor in (usually a DIV block). */ 10 | target: HTMLElement; 11 | 12 | constructor(view: View, target: string | HTMLElement) { 13 | this.view = view; 14 | 15 | if (!target) 16 | throw "A target is required for the editor UI."; 17 | 18 | this.target = target instanceof HTMLElement ? target : view.getElementById(target); 19 | } 20 | 21 | /** 22 | * Once the text editor is constructed, call this when ready to initialize the editor for the first time before use. 23 | * In some cases, this may trigger loading of other dependencies for derived types. 24 | */ 25 | initialize(ready?: () => void): void { if (ready) ready(); } 26 | } 27 | } -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/old/System/Thread.js: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | var FlowScript; 3 | (function (FlowScript) { 4 | // ======================================================================================================================== 5 | /** A thread wraps a single script block. 6 | * One script can have many threads. 7 | */ 8 | var Thread = /** @class */ (function () { 9 | // -------------------------------------------------------------------------------------------------------------------- 10 | function Thread(parent) { 11 | this._parent = parent; 12 | } 13 | return Thread; 14 | }()); 15 | FlowScript.Thread = Thread; 16 | // ======================================================================================================================== 17 | })(FlowScript || (FlowScript = {})); 18 | // ############################################################################################################################ 19 | //# sourceMappingURL=thread.js.map -------------------------------------------------------------------------------- /src/FlowScript/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.AspNetCore.Server.Kestrel.Core; 9 | using Microsoft.Extensions.Configuration; 10 | using Microsoft.Extensions.Logging; 11 | using VroomJs; 12 | 13 | namespace FlowScript 14 | { 15 | public class Program 16 | { 17 | public static void Main(string[] args) 18 | { 19 | AssemblyLoader.EnsureLoaded(); // windows only 20 | 21 | CreateWebHostBuilder(args).Build().Run(); 22 | } 23 | 24 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 25 | WebHost.CreateDefaultBuilder(args) 26 | //.UseKestrel() // Request Filtering: https://stackoverflow.com/questions/51773340/asp-net-core-api-404-not-found-master 27 | //.UseWebRoot(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot")) 28 | //.UseContentRoot(Directory.GetCurrentDirectory()) 29 | //.UseApplicationInsights() 30 | .UseStartup(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/tests/tests.ts: -------------------------------------------------------------------------------- 1 | namespace FlowScript.Tests { 2 | export function populateProject(project: FlowScript.UI.ProjectUI) { 3 | var fs = project.script; 4 | var appNS = fs.System.add("Tests"); 5 | 6 | fs.Main.defineDefaultReturnVar(); 7 | 8 | fs.Main.defineLocalVar("x", [fs.System.Double]), 9 | fs.Main.defineLocalVar("y", [fs.System.Double]); 10 | 11 | var line = fs.Main.block.newLine(); 12 | var statement = line.addStatement(fs.System.ControlFlow.Loop, { 13 | 0: new Block(fs.Main).newLine().addStatement(fs.System.Assign, { 0: fs.Main.getProperty("x").createExpression(), 1: new Constant(0) }) 14 | .block.newLine().addStatement(fs.System.Assign, { 0: fs.Main.getProperty("y").createExpression(), 1: new Constant(0) }).block.createExpression(), 15 | 1: new ComponentReference(fs.System.Comparison.LessThan, { 0: fs.Main.getProperty("x").createExpression(), 1: new Constant(10) }), 16 | 2: new Block(fs.Main).newLine().addStatement(fs.System.PostDecrement, { 0: fs.Main.getProperty("y").createExpression() }).block.createExpression(), 17 | 3: new Block(fs.Main).newLine().addStatement(fs.System.PreIncrement, { 0: fs.Main.getProperty("x").createExpression() }).block.createExpression(), 18 | }); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/System/Thread.ts: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | 3 | namespace FlowScript { 4 | // ======================================================================================================================== 5 | 6 | /** A thread wraps a single script block. 7 | * One script can have many threads. 8 | */ 9 | export class Thread { 10 | // -------------------------------------------------------------------------------------------------------------------- 11 | 12 | private _parent: IFlowScript; 13 | private _block: Block; 14 | 15 | // -------------------------------------------------------------------------------------------------------------------- 16 | 17 | constructor(parent: IFlowScript) { 18 | this._parent = parent; 19 | } 20 | 21 | // -------------------------------------------------------------------------------------------------------------------- 22 | } 23 | 24 | // ======================================================================================================================== 25 | } 26 | 27 | // ############################################################################################################################ 28 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/old/System/Thread.ts.txt: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | 3 | namespace FlowScript { 4 | // ======================================================================================================================== 5 | 6 | /** A thread wraps a single script block. 7 | * One script can have many threads. 8 | */ 9 | export class Thread { 10 | // -------------------------------------------------------------------------------------------------------------------- 11 | 12 | private _parent: IFlowScript; 13 | private _block: Block; 14 | 15 | // -------------------------------------------------------------------------------------------------------------------- 16 | 17 | constructor(parent: IFlowScript) { 18 | this._parent = parent; 19 | } 20 | 21 | // -------------------------------------------------------------------------------------------------------------------- 22 | } 23 | 24 | // ======================================================================================================================== 25 | } 26 | 27 | // ############################################################################################################################ 28 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/System/tsconfig.json: -------------------------------------------------------------------------------- 1 | // FlowScript Core 2 | { 3 | "extends": "../../tsconfig-base.json", 4 | "references": [ 5 | { "path": "Runtime" } 6 | ], 7 | "compilerOptions": { 8 | "composite": true, 9 | "target": "es6", // (Makes sure we take advantage of Node's built-in async functionality.) 10 | "outFile": "../../wwwroot/js/flowscript.js", 11 | "declaration": true 12 | }, 13 | "files": [ 14 | "EventDispatcher.ts", 15 | "NamespaceObject.ts", 16 | "NamedReference.ts", 17 | "User.ts", 18 | "Security.ts", 19 | "FileManager.ts", 20 | "FlowScriptMain.ts", 21 | "Expressions.ts", 22 | "Property.ts", 23 | "Component.ts", 24 | "Statement.ts", 25 | "Block.ts", 26 | "Line.ts", 27 | "Enum.ts", 28 | "Event.ts", 29 | "Message.ts", 30 | "Table.ts", 31 | "Thread.ts", 32 | "Components/Core.ts", 33 | "Components/Core.HTTPRequest.ts", 34 | "Components/Core.ControlFlow.ts", 35 | "Components/Core.Math.ts", 36 | "Components/Core.Binary.ts", 37 | "Components/Core.Comparison.ts", 38 | "Components/Core.DOM.ts", 39 | "Components/Core.HTML.ts", 40 | "Compiler.ts", 41 | "Simulator.ts", 42 | "Visualtree.ts", 43 | "Views.ts", 44 | "Project.ts", 45 | "Solution.ts", 46 | "System.ts", 47 | "bootup.ts" // This MUST be LAST. 48 | ], 49 | "exclude": [ 50 | "node_modules" 51 | ] 52 | } 53 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/old/System/TypeDefinition.ts.txt: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | 3 | namespace FlowScript { 4 | // ======================================================================================================================== 5 | 6 | export interface ISavedTypeDefinition extends ISavedComponent { } 7 | 8 | // ======================================================================================================================== 9 | 10 | /** Defines a single type within the system. */ 11 | export class TypeDefinition extends Component { 12 | /** Instance variables for this component. */ 13 | get instanceProperties() { return this._instanceProperties; } 14 | protected _instanceProperties = new PropertyCollection(this); // (holds vars that get rendered as object instance-based properties; these are completely separate from parameters and local vars, which are viewed together as one big list) 15 | 16 | constructor(parent: NamespaceObject, componentType: ComponentTypes, typeName: string, signatureTitle: string, script?: IFlowScript) { 17 | super(parent, componentType, typeName, signatureTitle, script); 18 | } 19 | } 20 | 21 | // ======================================================================================================================== 22 | } 23 | 24 | // ############################################################################################################################ 25 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/System/bootup.ts: -------------------------------------------------------------------------------- 1 | namespace FlowScript { 2 | // ======================================================================================================================== 3 | 4 | /** The current FlowScript version. */ 5 | export var version = "0.0.1"; 6 | 7 | NamespaceObject.All = new Core.All(); 8 | NamespaceObject.Inferred = new Core.Inferred(); 9 | 10 | // ======================================================================================================================== 11 | 12 | /** Contains the default core system types expected by the compiler. Since these core types must always exist, a default 13 | * type graph is created here for convenience. 14 | */ 15 | export var System = createNew().System; 16 | 17 | // ============================================================================================================================ 18 | 19 | if (typeof navigator != 'undefined' && navigator.userAgent) 20 | if (navigator.userAgent.indexOf("MSIE") >= 0 || navigator.userAgent.indexOf("Trident") >= 0 || navigator.userAgent.indexOf("Edge") >= 0) 21 | console.log("-=< FlowScript - v" + FlowScript.version + " >=- "); 22 | else 23 | console.log("%c -=< %cFlowScript - v" + FlowScript.version + " %c>=- ", "background: #000; color: lightblue; font-weight:bold", "background: #000; color: yellow; font-style:italic; font-weight:bold", "background: #000; color: lightblue; font-weight:bold"); 24 | 25 | // ======================================================================================================================== 26 | } -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/old/_references.ts.txt: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | /// 8 | /// 9 | /// 10 | /// 11 | /// 12 | /// 13 | /// 14 | /// 15 | /// 16 | /// 17 | /// 18 | /// 19 | /// 20 | /// 21 | /// 22 | /// 23 | /// 24 | /// 25 | /// 26 | /// 27 | /// 28 | // ############################################################################################################################ 29 | -------------------------------------------------------------------------------- /src/FlowScript/API/TemplateController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.AspNetCore.Mvc; 3 | 4 | namespace FlowScript.API 5 | { 6 | ///// DO NOT USE THIS. It is here only to be copied from as a convenient template when creating API controllers. 7 | //[Route("api/[controller]")] 8 | //public class Template_Controller_ : ControllerBase // (ControllerBase instead of Controller for APIs only) 9 | //{ 10 | // // GET api/values 11 | // [HttpGet] 12 | // public APIResponse Get() 13 | // { 14 | // return "Works!"; 15 | // } 16 | 17 | // // GET api/values/5 18 | // [HttpGet("{id}")] 19 | // public APIResponse Get(int id) 20 | // { 21 | // return "Value is " + id; 22 | // } 23 | 24 | // // POST api/values 25 | // [HttpPost] 26 | // public APIResponse Post([FromBody]string value) 27 | // { 28 | // return APIResponse.OK; 29 | // } 30 | 31 | // // PUT api/values/5 32 | // [HttpPut("{id}")] 33 | // public APIResponse Put(int id, [FromBody]string value) 34 | // { 35 | // return APIResponse.OK; 36 | // } 37 | 38 | // // PATCH api/values/5 39 | // [HttpPatch("{id}")] 40 | // public APIResponse Patch(int id, [FromBody]string value) 41 | // { 42 | // return APIResponse.OK; 43 | // } 44 | 45 | // // DELETE api/values/5 46 | // [HttpDelete("{id}")] 47 | // public APIResponse Delete(int id) 48 | // { 49 | // return APIResponse.OK; 50 | // } 51 | //} 52 | } -------------------------------------------------------------------------------- /src/FlowScript/wwwroot/editor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | FlowScript v0.0.1 - Editor 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |
25 |
26 | 27 | -------------------------------------------------------------------------------- /src/FlowScript/API/ProjectsController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.AspNetCore.Mvc; 3 | 4 | namespace FlowScript.API 5 | { 6 | /// A controller for handling projects. 7 | /// 8 | [Route("api/[controller]")] 9 | public class ProjectsController : ControllerBase 10 | { 11 | // Returns a list of project names and IDs. 12 | [HttpGet] 13 | public IEnumerable Get() // Read 14 | { 15 | return new[] { new ProjectInfo { Name = "Test 1", ID = "1" }, new ProjectInfo { Name = "Test 2", ID = "2" } }; 16 | } 17 | 18 | // GET api/values/5 19 | [HttpGet("{id}")] 20 | public ProjectInfo Get(int id) // Read 21 | { 22 | return new ProjectInfo { Name = "Test " + id, ID = "" + id }; 23 | } 24 | 25 | // POST api/values 26 | [HttpPost] 27 | public APIResponse Post([FromBody]string value) // Create 28 | { 29 | return APIResponse.OK; 30 | } 31 | 32 | // PUT api/values/5 33 | [HttpPut("{id}")] 34 | public APIResponse Put(int id, [FromBody]string value) // Update/Replace 35 | { 36 | return APIResponse.OK; 37 | } 38 | 39 | //// PUT api/values/5 40 | //[HttpPatch("{id}")] 41 | //public APIResponse Patch(int id, [FromBody]string value) // Update/Modify 42 | //{ 43 | // return APIResponse.OK; 44 | //} 45 | 46 | // DELETE api/values/5 47 | [HttpDelete("{id}")] 48 | public APIResponse Delete(int id) // Delete 49 | { 50 | return APIResponse.OK; 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/System/_references.ts.txt: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | ///// 3 | /// 4 | /// 5 | /// 6 | /// 7 | /// 8 | /// 9 | /// 10 | /// 11 | /// 12 | /// 13 | /// 14 | /// 15 | /// 16 | /// 17 | /// 18 | /// 19 | /// 20 | /// 21 | /// 22 | /// 23 | /// 24 | /// 25 | /// 26 | /// 27 | /// 28 | /// 29 | /// 30 | /// 31 | /// 32 | // ############################################################################################################################ 33 | // This MUST be LAST. 34 | /// 35 | // ############################################################################################################################ 36 | -------------------------------------------------------------------------------- /src/FlowScript/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "FlowScript", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@types/jquery": { 8 | "version": "3.3.29", 9 | "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.3.29.tgz", 10 | "integrity": "sha512-FhJvBninYD36v3k6c+bVk1DSZwh7B5Dpb/Pyk3HKVsiohn0nhbefZZ+3JXbWQhFyt0MxSl2jRDdGQPHeOHFXrQ==", 11 | "requires": { 12 | "@types/sizzle": "*" 13 | } 14 | }, 15 | "@types/requirejs": { 16 | "version": "2.1.31", 17 | "resolved": "https://registry.npmjs.org/@types/requirejs/-/requirejs-2.1.31.tgz", 18 | "integrity": "sha512-b2soeyuU76rMbcRJ4e0hEl0tbMhFwZeTC0VZnfuWlfGlk6BwWNsev6kFu/twKABPX29wkX84wU2o+cEJoXsiTw==" 19 | }, 20 | "@types/sizzle": { 21 | "version": "2.3.2", 22 | "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.2.tgz", 23 | "integrity": "sha512-7EJYyKTL7tFR8+gDbB6Wwz/arpGa0Mywk1TJbNzKzHtzbwVmY4HR9WqS5VV7dsBUKQmPNr192jHr/VpBluj/hg==" 24 | }, 25 | "monaco-editor": { 26 | "version": "0.15.6", 27 | "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.15.6.tgz", 28 | "integrity": "sha512-JoU9V9k6KqT9R9Tiw1RTU8ohZ+Xnf9DMg6Ktqqw5hILumwmq7xqa/KLXw513uTUsWbhtnHoSJYYR++u3pkyxJg==" 29 | }, 30 | "requirejs": { 31 | "version": "2.3.6", 32 | "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.6.tgz", 33 | "integrity": "sha512-ipEzlWQe6RK3jkzikgCupiTbTvm4S0/CAU5GlgptkN5SO6F3u0UD0K18wy6ErDqiCyP4J4YYe1HuAShvsxePLg==" 34 | }, 35 | "typescript": { 36 | "version": "3.3.3333", 37 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.3.3333.tgz", 38 | "integrity": "sha512-JjSKsAfuHBE/fB2oZ8NxtRTk5iGcg6hkYXMnZ3Wc+b2RSqejEqTaem11mHASMnFilHrax3sLK0GDzcJrekZYLw==" 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/System/Event.ts: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | 3 | namespace FlowScript { 4 | // ======================================================================================================================== 5 | 6 | export interface ISavedEvent extends ISavedComponent { } 7 | 8 | // ======================================================================================================================== 9 | 10 | /** Represents a single component event. 11 | * The premise behind components is that they are built assuming normal code flow; however, things do go wrong at times, 12 | * and when something does go wrong, an event is raised which developers can use to execute a handler block. 13 | */ 14 | export class FSEvent extends Component { 15 | // -------------------------------------------------------------------------------------------------------------------- 16 | 17 | constructor(parent: Component, name: string) { 18 | super(parent, ComponentTypes.Functional, name, name); 19 | } 20 | 21 | // -------------------------------------------------------------------------------------------------------------------- 22 | 23 | save(target?: ISavedEvent): ISavedEvent { 24 | target = target || {}; 25 | 26 | super.save(target); 27 | 28 | return target; 29 | } 30 | 31 | // -------------------------------------------------------------------------------------------------------------------- 32 | } 33 | 34 | // ======================================================================================================================== 35 | } 36 | 37 | // ############################################################################################################################ 38 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/old/System/Event.ts.txt: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | 3 | namespace FlowScript { 4 | // ======================================================================================================================== 5 | 6 | export interface ISavedEvent extends ISavedComponent { } 7 | 8 | // ======================================================================================================================== 9 | 10 | /** Represents a single component event. 11 | * The premise behind components is that they are built assuming normal code flow; however, things do go wrong at times, 12 | * and when something does go wrong, an event is raised which developers can use to execute a handler block. 13 | */ 14 | export class FSEvent extends Component { 15 | // -------------------------------------------------------------------------------------------------------------------- 16 | 17 | constructor(parent: Component, name: string) { 18 | super(parent, ComponentTypes.Functional, name, name); 19 | } 20 | 21 | // -------------------------------------------------------------------------------------------------------------------- 22 | 23 | save(target?: ISavedEvent): ISavedEvent { 24 | target = target || {}; 25 | 26 | super.save(target); 27 | 28 | return target; 29 | } 30 | 31 | // -------------------------------------------------------------------------------------------------------------------- 32 | } 33 | 34 | // ======================================================================================================================== 35 | } 36 | 37 | // ############################################################################################################################ 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019 Inossis 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software (aka IDE, or Integrated Development Environment) and associated documentation files (the "Software"), to copy, modify, merge, distribute, the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | 1. This copyright notice and this permission notice shall be included in all copies or substantial portions of the Software, including any derivative works. 6 | 7 | 2. You must not sub-license and/or sell copies of this software. 8 | 9 | 3. If you make changes to the software you must state that you made the changes and make the source code to the derivative works available for download on-line - or optionally as a pull request to help improve the original work. 10 | 11 | 4. While the software is free to use, you understand that the component market place (not available yet) may have subscription costs by various parties (not free). All core components of the IDE itself will be free all the time. The IDE must always provide the ability to replicate any 3rd-party components by oneself without cost. 12 | 13 | 5. Any 3rd-party components must also be compatible with the original software. 14 | 15 | 6. We reserve the right to update this license as needed. 16 | 17 | The final "compiled" product that is published by the software can be for commercial or non-commercial use. This license only covers the software itself and all related files within the repository. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /src/FlowScript/wwwroot/css/site.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Glyphicons Halflings'; 3 | src: url('../fonts/glyphicons-halflings-regular.eot'); 4 | src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.woff2') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); 5 | } 6 | 7 | body { 8 | font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif; 9 | padding-top: 50px; 10 | padding-bottom: 20px; 11 | background-color: #f8f8f8; 12 | font-size: 13pt; 13 | } 14 | 15 | /* Set padding to keep content from hitting the edges */ 16 | .body-content { 17 | padding-left: 15px; 18 | padding-right: 15px; 19 | } 20 | 21 | h1 { 22 | font-size: 20pt; 23 | } 24 | 25 | h2 { 26 | font-size: 20pt; 27 | } 28 | 29 | h3 { 30 | font-size: 20pt; 31 | } 32 | 33 | /* Set width on the form input elements since they're 100% wide by default */ 34 | /*input, 35 | select, 36 | textarea { 37 | max-width: 280px; 38 | }*/ 39 | 40 | .navbar a:hover { 41 | cursor: pointer; 42 | } 43 | 44 | /*.noselect { 45 | -webkit-touch-callout: none; 46 | -webkit-user-select: none; 47 | -khtml-user-select: none; 48 | -moz-user-select: none; 49 | -ms-user-select: none; 50 | -o-user-select: none; 51 | user-select: none; 52 | cursor: default; 53 | }*/ 54 | 55 | /* Some Bootstrap modifications are needed to allow updating of content hidden behind non-visible panels. */ 56 | 57 | .tab-content > .tab-pane.active { 58 | position: relative; 59 | pointer-events: auto; 60 | left: auto; 61 | /*left: -9999px;*/ 62 | /*-webkit-transition: display 0.15s linear; 63 | transition: display 0.15s linear; 64 | -webkit-transition: display 0.15s linear; 65 | transition: display 0.15s linear;*/ 66 | } 67 | 68 | .tab-content > .tab-pane { 69 | display: block; 70 | position: absolute; 71 | pointer-events: none; 72 | left: -9999px; 73 | } -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/old/System/Event.js: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | var __extends = (this && this.__extends) || (function () { 3 | var extendStatics = Object.setPrototypeOf || 4 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 5 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 6 | return function (d, b) { 7 | extendStatics(d, b); 8 | function __() { this.constructor = d; } 9 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 10 | }; 11 | })(); 12 | var FlowScript; 13 | (function (FlowScript) { 14 | // ======================================================================================================================== 15 | // ======================================================================================================================== 16 | /** Represents a single component event. 17 | * The premise behind components is that they are built assuming normal code flow; however, things do go wrong at times, 18 | * and when something does go wrong, an event is raised which developers can use to execute a handler block. 19 | */ 20 | var FSEvent = /** @class */ (function (_super) { 21 | __extends(FSEvent, _super); 22 | // -------------------------------------------------------------------------------------------------------------------- 23 | function FSEvent(parent, name) { 24 | return _super.call(this, parent, FlowScript.ComponentTypes.Functional, name, name) || this; 25 | } 26 | // -------------------------------------------------------------------------------------------------------------------- 27 | FSEvent.prototype.save = function (target) { 28 | target = target || {}; 29 | _super.prototype.save.call(this, target); 30 | return target; 31 | }; 32 | return FSEvent; 33 | }(FlowScript.Component)); 34 | FlowScript.FSEvent = FSEvent; 35 | // ======================================================================================================================== 36 | })(FlowScript || (FlowScript = {})); 37 | // ############################################################################################################################ 38 | //# sourceMappingURL=Event.js.map -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/old/System/TypeDefinition.js: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | var __extends = (this && this.__extends) || (function () { 3 | var extendStatics = Object.setPrototypeOf || 4 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 5 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 6 | return function (d, b) { 7 | extendStatics(d, b); 8 | function __() { this.constructor = d; } 9 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 10 | }; 11 | })(); 12 | var FlowScript; 13 | (function (FlowScript) { 14 | // ======================================================================================================================== 15 | // ======================================================================================================================== 16 | /** Represents a single component event. 17 | * The premise behind components is that they are built assuming normal code flow; however, things do go wrong at times, 18 | * and when something does go wrong, an event is raised which developers can use to execute a handler block. 19 | */ 20 | var FSEvent = /** @class */ (function (_super) { 21 | __extends(FSEvent, _super); 22 | // -------------------------------------------------------------------------------------------------------------------- 23 | function FSEvent(parent, name) { 24 | return _super.call(this, parent, FlowScript.ComponentTypes.Functional, name, name) || this; 25 | } 26 | // -------------------------------------------------------------------------------------------------------------------- 27 | FSEvent.prototype.save = function (target) { 28 | target = target || {}; 29 | _super.prototype.save.call(this, target); 30 | return target; 31 | }; 32 | return FSEvent; 33 | }(FlowScript.Component)); 34 | FlowScript.FSEvent = FSEvent; 35 | // ======================================================================================================================== 36 | })(FlowScript || (FlowScript = {})); 37 | // ############################################################################################################################ 38 | //# sourceMappingURL=Event.js.map -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/System/components/Core.HTTPRequest.ts: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | 3 | namespace FlowScript.Core.Net.HTTPRequest { 4 | // ======================================================================================================================== 5 | // Message ID Constants 6 | 7 | export var MSG_LOADFAILED = "LoadFailed"; 8 | 9 | // ======================================================================================================================== 10 | 11 | /** A line represents a single execution step in a code component. 12 | */ 13 | export class HTTPRequest extends Component { 14 | constructor(parent: NamespaceObject) { 15 | super(parent, ComponentTypes.Functional, "LoadFromURL", "Load from url: $url, using method: $method"); // Note: '$method' will be preset to the value '(default)' to the developer. 16 | } 17 | 18 | onInit() { 19 | var script = this.script; 20 | 21 | // Register some global types: 22 | 23 | var HTTPRequestMethods = new Enum(script.System, "HTTPRequestMethods").setValue("GET", "GET").setValue("POST", "POST"); 24 | 25 | // Setup the expected parameters: 26 | 27 | this.defineParameter("url", [script.System.String], "", "^(\w+:\/\/)?((?:\w*):(?:\w*)@)?((?:\w+)(?:\.\w+)*)?((?:\/[-_a-zA-Z0-9.~!$&'()*+,;=:@%]+)*\/?)?(\?\w+=.*)?(#.*)?$"); 28 | this.defineLocalVar("method", [HTTPRequestMethods], "GET", undefined, true); 29 | this.defineReturnVar("data", script.System.String); 30 | var evtError = this.registerEvent("error"); 31 | var evtAbort = this.registerEvent("abort"); 32 | var evtError = this.registerEvent("timeout"); 33 | 34 | // Setup some messages 35 | 36 | script.registerMessage("Load failed: $0", MSG_LOADFAILED); 37 | 38 | // Set the component's script: 39 | //?this.addStatement(new CustomJS(this, "Get XHR Object", function HTTPRequest(ctx: RuntimeContext): any { 40 | //?})); 41 | 42 | super.onInit(); 43 | } 44 | } 45 | 46 | // ======================================================================================================================== 47 | } 48 | 49 | // ############################################################################################################################ 50 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/old/System/Definitions/Core.HTTPRequest.ts.txt: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | 3 | namespace FlowScript.Core.Net.HTTPRequest { 4 | // ======================================================================================================================== 5 | // Message ID Constants 6 | 7 | export var MSG_LOADFAILED = "LoadFailed"; 8 | 9 | // ======================================================================================================================== 10 | 11 | /** A line represents a single execution step in a code component. 12 | */ 13 | export class HTTPRequest extends Component { 14 | constructor(parent: TypeDefinition) { 15 | super(parent, ComponentTypes.Functional, "LoadFromURL", "Load from url: $url, using method: $method"); // Note: '$method' will be preset to the value '(default)' to the developer. 16 | } 17 | 18 | init() { 19 | var script = this.script; 20 | 21 | // Register some global types: 22 | 23 | var HTTPRequestMethods = new Enum(script.System, "HTTPRequestMethods").setValue("GET", "GET").setValue("POST", "POST"); 24 | 25 | // Setup the expected parameters: 26 | 27 | this.defineParameter("url", [script.System.String], "", "^(\w+:\/\/)?((?:\w*):(?:\w*)@)?((?:\w+)(?:\.\w+)*)?((?:\/[-_a-zA-Z0-9.~!$&'()*+,;=:@%]+)*\/?)?(\?\w+=.*)?(#.*)?$"); 28 | this.defineLocalVar("method", [HTTPRequestMethods], "GET", undefined, true); 29 | this.defineReturnVar("data", script.System.String); 30 | var evtError = this.registerEvent("error"); 31 | var evtAbort = this.registerEvent("abort"); 32 | var evtError = this.registerEvent("timeout"); 33 | 34 | // Setup some messages 35 | 36 | script.registerMessage("Load failed: $0", MSG_LOADFAILED); 37 | 38 | // Set the component's script: 39 | //?this.addStatement(new CustomJS(this, "Get XHR Object", function HTTPRequest(ctx: RuntimeContext): any { 40 | //?})); 41 | 42 | super.init(); 43 | } 44 | } 45 | 46 | // ======================================================================================================================== 47 | } 48 | 49 | // ############################################################################################################################ 50 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/System/Table.ts: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | // Data Tables 3 | 4 | namespace FlowScript { 5 | // ======================================================================================================================== 6 | 7 | export enum ColumnAccessLevels { 8 | /** The column can be read from, and written to. */ 9 | ReadWrite, 10 | /** The column cannot be updated. */ 11 | ReadOnly, 12 | /** The column is treated as if it doesn't exist. */ 13 | Hidden 14 | } 15 | 16 | export class Column { 17 | get name(): string { return this._name; } 18 | private _name: string; 19 | 20 | get type(): NamespaceObject { return this._type; } 21 | private _type: NamespaceObject; 22 | 23 | get accessLevel(): ColumnAccessLevels { return this._accessLevel; } 24 | private _accessLevel: ColumnAccessLevels = ColumnAccessLevels.ReadWrite; 25 | } 26 | 27 | export class Row { 28 | [index: number]: any; 29 | } 30 | 31 | /** Represents a structure of data, much like a class. 32 | * Tables exist to replace the concept of class instances in many other languages. In most cases, programmers create 33 | * methods/functions to operate on either a data structure (object with properties), or data returned from a database. 34 | * To mimic classes, a table with one row is created, where the columns are the properties. As well, columns can be 35 | * flagged as readonly, 36 | */ 37 | export class Table extends NamespaceObject { 38 | // -------------------------------------------------------------------------------------------------------------------- 39 | 40 | private _super: Table; // (the "super class" table to this table - allows for inheritance) 41 | 42 | private _columns: Column[] = []; 43 | private _rows: Row[] = []; 44 | 45 | // -------------------------------------------------------------------------------------------------------------------- 46 | 47 | constructor(parent: NamespaceObject, tableName: string) { 48 | super(parent, tableName); 49 | } 50 | 51 | // -------------------------------------------------------------------------------------------------------------------- 52 | } 53 | 54 | // ======================================================================================================================== 55 | } 56 | 57 | // ############################################################################################################################ 58 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/old/System/Table.ts.txt: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | // Data Tables 3 | 4 | namespace FlowScript { 5 | // ======================================================================================================================== 6 | 7 | export enum ColumnAccessLevels { 8 | /** The column can be read from, and written to. */ 9 | ReadWrite, 10 | /** The column cannot be updated. */ 11 | ReadOnly, 12 | /** The column is treated as if it doesn't exist. */ 13 | Hidden 14 | } 15 | 16 | export class Column { 17 | get name(): string { return this._name; } 18 | private _name: string; 19 | 20 | get type(): NamespaceObject { return this._type; } 21 | private _type: NamespaceObject; 22 | 23 | get accessLevel(): ColumnAccessLevels { return this._accessLevel; } 24 | private _accessLevel: ColumnAccessLevels = ColumnAccessLevels.ReadWrite; 25 | } 26 | 27 | export class Row { 28 | [index: number]: any; 29 | } 30 | 31 | /** Represents a structure of data, much like a class. 32 | * Tables exist to replace the concept of class instances in many other languages. In most cases, programmers create 33 | * methods/functions to operate on either a data structure (object with properties), or data returned from a database. 34 | * To mimic classes, a table with one row is created, where the columns are the properties. As well, columns can be 35 | * flagged as readonly, 36 | */ 37 | export class Table extends NamespaceObject { 38 | // -------------------------------------------------------------------------------------------------------------------- 39 | 40 | private _super: Table; // (the "super class" table to this table - allows for inheritance) 41 | 42 | private _columns: Column[] = []; 43 | private _rows: Row[] = []; 44 | 45 | // -------------------------------------------------------------------------------------------------------------------- 46 | 47 | constructor(parent: NamespaceObject, tableName: string) { 48 | super(parent, tableName); 49 | } 50 | 51 | // -------------------------------------------------------------------------------------------------------------------- 52 | } 53 | 54 | // ======================================================================================================================== 55 | } 56 | 57 | // ############################################################################################################################ 58 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/System/User.ts: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | // Data Tables 3 | 4 | namespace FlowScript { 5 | // ======================================================================================================================== 6 | 7 | /** The current user of the FlowScript system. 8 | * The user 'id' (a GUID) is used as the root directory for projects. 9 | */ 10 | export class User extends TrackableObject { 11 | 12 | /** Returns the current user object. */ 13 | static get current() { return _currentUser; } 14 | 15 | /** Triggered when the current user is about to change. If any handler returns false then the request is cancelled (such as if the current project is not saved yet). */ 16 | static readonly onCurrentUserChanging = new EventDispatcher boolean>(User); 17 | 18 | /** Triggered when the current user has changed. This event cannot be cancelled - use the 'onCurrentUserChanging' event for that. */ 19 | static readonly onCurrentUserChanged = new EventDispatcher void>(User, false, false); 20 | 21 | /** Starts the process of changing the current user. */ 22 | static async changeCurrentUser(user: User) { 23 | return new Promise((resolve, reject) => { 24 | this.onCurrentUserChanging.triggerAsync(_currentUser, user) 25 | .then(() => this.onCurrentUserChanged.triggerAsync(_currentUser, user), reject) // (any exception in the previous promise will trigger 'reject') 26 | .then(resolve, reject); // (any exception in the previous 'then' will trigger 'reject') 27 | }); 28 | } 29 | 30 | /** Holds a mapping of this user ID to global roles associated with the user. */ 31 | readonly _security = new UserAccess(); 32 | 33 | /** Scripts owned by this user. */ 34 | scripts: IFlowScript[] = []; 35 | 36 | constructor( 37 | public email: string, 38 | public firstname?: string, 39 | public lastname?: string 40 | ) { super(); } 41 | } 42 | 43 | // ======================================================================================================================== 44 | 45 | var _currentUser = new User(""); 46 | 47 | // ======================================================================================================================== 48 | } 49 | 50 | // ############################################################################################################################ 51 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /src/FlowScript/Models/Response.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.AspNetCore.Mvc; 3 | 4 | namespace FlowScript.API 5 | { 6 | // ######################################################################################################################## 7 | 8 | public interface IAPIResponseBase 9 | { 10 | string Type { get; } 11 | bool Success { get; set; } 12 | } 13 | 14 | /// A based class for all responses. 15 | public abstract class APIResponseBase : IAPIResponseBase 16 | { 17 | public string Type { get; set; } 18 | public bool Success { get; set; } 19 | 20 | public APIResponseBase(bool success = true) { Type = GetType().Name; Success = success; } 21 | } 22 | 23 | // ######################################################################################################################## 24 | 25 | public interface IAPIResponse : IAPIResponseBase 26 | { 27 | string Message { get; set; } 28 | } 29 | 30 | public class APIResponse : APIResponseBase, IAPIResponse 31 | { 32 | public static APIResponse OK = new APIResponse(); 33 | 34 | /// A message, usually when there's an error. 35 | public string Message { get; set; } 36 | 37 | public APIResponse(string message = null, bool success = true) : base(success) { Message = message; } 38 | 39 | public static implicit operator APIResponse(string s) => new APIResponse(s); 40 | } 41 | 42 | // ######################################################################################################################## 43 | 44 | public interface IDataResponse : IAPIResponse 45 | { 46 | object Data { get; set; } 47 | } 48 | 49 | public class DataResponse : APIResponse, IDataResponse 50 | { 51 | public T Data; 52 | 53 | object IDataResponse.Data { get => Data; set => Data = (T)value; } 54 | 55 | public DataResponse(T data = default(T), bool success = true, string message = null) : base(message, success) { Data = data; } 56 | public DataResponse(string errorMessage) : base(errorMessage, false) { Success = false; } 57 | 58 | public static implicit operator DataResponse(T d) => new DataResponse(d); 59 | } 60 | 61 | // ######################################################################################################################## 62 | 63 | public static class ResponseExtensions 64 | { 65 | public static DataResponse AsResponse(this T v) => new DataResponse(v); 66 | public static DataResponse AsError(this string msg) => new DataResponse(msg); 67 | } 68 | 69 | // ######################################################################################################################## 70 | } -------------------------------------------------------------------------------- /src/FlowScript/wwwroot/css/editor.css: -------------------------------------------------------------------------------- 1 | .codeContainer .editor-container { 2 | /*position: relative;*/ 3 | padding: 20px; 4 | width: auto; 5 | width: 640px; 6 | height: 480px; 7 | max-width: 100%; 8 | font-family: Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace; 9 | } 10 | 11 | .codeContainer .editor { 12 | position: absolute; 13 | max-height: 10000px; 14 | top: 6px; 15 | right: 0; 16 | bottom: 0; 17 | left: 0; 18 | } 19 | 20 | .codeContainer .output { 21 | position: absolute; 22 | max-height: 10000px; 23 | top: 6px; 24 | right: 0; 25 | bottom: 0; 26 | left: 0; 27 | } 28 | 29 | .codeContainer .editor-area { 30 | height: auto; 31 | padding-bottom: 50px; 32 | height: calc(100% - 220px); 33 | /* margin-bottom:20px; */ 34 | } 35 | 36 | .codeContainer .typescript-ref { 37 | position: absolute; 38 | border: 1px solid white; 39 | opacity: 0.7; 40 | } 41 | 42 | .codeContainer .typescript-error { 43 | position: absolute; 44 | border-bottom: 1px solid red; 45 | } 46 | 47 | .codeContainer .langauge-title h2 { 48 | padding: 5px 10px; 49 | font-size: 14pt; 50 | color: black; 51 | background: #eee; 52 | border: 1px solid black; 53 | display: block; 54 | margin: 0px; 55 | height: 30px; 56 | line-height: 30px; 57 | } 58 | 59 | .codeContainer #javascript-run { 60 | margin: 0px; 61 | margin-top: 10px; 62 | padding: 5px; 63 | background: #999; 64 | color: white; 65 | } 66 | 67 | /*Shermie Added*/ 68 | .codeContainer .active { 69 | font-weight: bold; 70 | color: black; 71 | /*background-color: #ffffd7;*/ 72 | /*border: 2px solid #FFEFEFAF;*/ 73 | } 74 | 75 | /*Shermie added*/ 76 | .codeContainer .label-paramDoc { 77 | padding-left: 15px; 78 | color: #3333ff; 79 | } 80 | 81 | /*Shermie added*/ 82 | .codeContainer .label-paramDoc span, .label-detail, .label-doc { 83 | color: #0066cc; 84 | } 85 | 86 | .codeContainer .label-kind { 87 | background: #666; 88 | color: white; 89 | padding: 0px 3px; 90 | margin-right: 3px; 91 | } 92 | 93 | .codeContainer .label-kind-property { 94 | background: green; 95 | } 96 | 97 | .codeContainer .label-kind-method { 98 | background: blue; 99 | } 100 | 101 | .codeContainer .label-kind-interface { 102 | background: #666; 103 | } 104 | 105 | .codeContainer .label-kind-variable { 106 | background: orangered; 107 | } 108 | 109 | .codeContainer .label-type { 110 | padding-left: 10px; 111 | color: blue; 112 | visibility: hidden; 113 | } 114 | 115 | /*Shermie Added*/ 116 | .codeContainer .label-doc { 117 | /*color: #1a8cff;*/ 118 | padding-left: 15px; 119 | white-space: normal; 120 | } 121 | -------------------------------------------------------------------------------- /FlowScript.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.329 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlowScript", "src\FlowScript\FlowScript.csproj", "{5735AE6B-6166-44D7-BCEC-34A27A6CA186}" 7 | EndProject 8 | Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{7466F4F0-9A2C-438B-BAB7-476373A703D4}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Server", "Server", "{57ABBF01-A357-4BBC-B75C-625CDF1D6D83}" 11 | EndProject 12 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{615BA265-518A-47A7-A4AF-AAB23324D801}" 13 | ProjectSection(SolutionItems) = preProject 14 | LICENSE = LICENSE 15 | README.md = README.md 16 | readme.txt = readme.txt 17 | EndProjectSection 18 | EndProject 19 | Global 20 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 21 | Debug|Any CPU = Debug|Any CPU 22 | Debug|x64 = Debug|x64 23 | Debug|x86 = Debug|x86 24 | Release|Any CPU = Release|Any CPU 25 | Release|x64 = Release|x64 26 | Release|x86 = Release|x86 27 | EndGlobalSection 28 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 29 | {5735AE6B-6166-44D7-BCEC-34A27A6CA186}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 30 | {5735AE6B-6166-44D7-BCEC-34A27A6CA186}.Debug|Any CPU.Build.0 = Debug|Any CPU 31 | {5735AE6B-6166-44D7-BCEC-34A27A6CA186}.Debug|x64.ActiveCfg = Debug|Any CPU 32 | {5735AE6B-6166-44D7-BCEC-34A27A6CA186}.Debug|x86.ActiveCfg = Debug|Any CPU 33 | {5735AE6B-6166-44D7-BCEC-34A27A6CA186}.Release|Any CPU.ActiveCfg = Release|Any CPU 34 | {5735AE6B-6166-44D7-BCEC-34A27A6CA186}.Release|Any CPU.Build.0 = Release|Any CPU 35 | {5735AE6B-6166-44D7-BCEC-34A27A6CA186}.Release|x64.ActiveCfg = Release|Any CPU 36 | {5735AE6B-6166-44D7-BCEC-34A27A6CA186}.Release|x86.ActiveCfg = Release|Any CPU 37 | {7466F4F0-9A2C-438B-BAB7-476373A703D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 38 | {7466F4F0-9A2C-438B-BAB7-476373A703D4}.Debug|Any CPU.Build.0 = Debug|Any CPU 39 | {7466F4F0-9A2C-438B-BAB7-476373A703D4}.Debug|x64.ActiveCfg = Debug|Any CPU 40 | {7466F4F0-9A2C-438B-BAB7-476373A703D4}.Debug|x86.ActiveCfg = Debug|Any CPU 41 | {7466F4F0-9A2C-438B-BAB7-476373A703D4}.Release|Any CPU.ActiveCfg = Release|Any CPU 42 | {7466F4F0-9A2C-438B-BAB7-476373A703D4}.Release|Any CPU.Build.0 = Release|Any CPU 43 | {7466F4F0-9A2C-438B-BAB7-476373A703D4}.Release|x64.ActiveCfg = Release|Any CPU 44 | {7466F4F0-9A2C-438B-BAB7-476373A703D4}.Release|x86.ActiveCfg = Release|Any CPU 45 | EndGlobalSection 46 | GlobalSection(SolutionProperties) = preSolution 47 | HideSolutionNode = FALSE 48 | EndGlobalSection 49 | GlobalSection(NestedProjects) = preSolution 50 | {7466F4F0-9A2C-438B-BAB7-476373A703D4} = {57ABBF01-A357-4BBC-B75C-625CDF1D6D83} 51 | EndGlobalSection 52 | GlobalSection(ExtensibilityGlobals) = postSolution 53 | SolutionGuid = {D0323656-C564-4630-9F0D-F03AD74918DE} 54 | EndGlobalSection 55 | EndGlobal 56 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/old/System/Enum.js: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | var __extends = (this && this.__extends) || (function () { 3 | var extendStatics = Object.setPrototypeOf || 4 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 5 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 6 | return function (d, b) { 7 | extendStatics(d, b); 8 | function __() { this.constructor = d; } 9 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 10 | }; 11 | })(); 12 | var FlowScript; 13 | (function (FlowScript) { 14 | // ======================================================================================================================== 15 | /** Represents an enumeration of names and related constant values. 16 | * Enums can be associated with properties so the developer has to pick from a predefined list of values. 17 | */ 18 | var Enum = /** @class */ (function (_super) { 19 | __extends(Enum, _super); 20 | function Enum(parent, name, values) { 21 | var _this = _super.call(this, parent, name) || this; 22 | _this._counter = 0; 23 | _this.values = {}; 24 | _this.properties = _this.values; 25 | values && _this.addValue(values); 26 | return _this; 27 | } 28 | // -------------------------------------------------------------------------------------------------------------------- 29 | Enum.prototype.setValue = function (name, value) { 30 | if (value === void 0) 31 | value = this._counter++; 32 | if (name in this.values) 33 | throw "Enum error: Cannot add duplicate name '" + name + "'."; 34 | this.values[name] = value; 35 | // ... try to reference the name by value as well ... 36 | var valIndex = typeof value == 'string' ? value : '' + value; 37 | if (valIndex != name) { // (don't overwrite the "name=value" entry!) 38 | if (valIndex in this.values) 39 | throw "Enum error: Name conflict - cannot add reverse lookup for '" + name + "'='" + value + "'."; 40 | this.values[valIndex] = name; 41 | } 42 | return this; 43 | }; 44 | Enum.prototype.addValue = function (values) { 45 | if (values && typeof values == 'object') 46 | for (var p in values) 47 | if (Object.prototype.hasOwnProperty.call(values, p)) 48 | this.values[p] = values[p]; 49 | return this; 50 | }; 51 | return Enum; 52 | }(FlowScript.Type)); 53 | FlowScript.Enum = Enum; 54 | // ======================================================================================================================== 55 | })(FlowScript || (FlowScript = {})); 56 | // ############################################################################################################################ 57 | //# sourceMappingURL=Enum.js.map -------------------------------------------------------------------------------- /src/FlowScript/ServerScriptManager.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Hosting; 2 | using System; 3 | using System.Collections; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Linq; 7 | using System.Threading.Tasks; 8 | using VroomJs; 9 | 10 | namespace FlowScript 11 | { 12 | public class ServerScriptManager : IEnumerable 13 | { 14 | // -------------------------------------------------------------------------------------------------------------------- 15 | 16 | public readonly JsEngine Engine; 17 | 18 | List _Servers = new List(); 19 | Dictionary _ServersByName = new Dictionary(); 20 | 21 | internal IHostingEnvironment _HostingEnvironment; 22 | 23 | public int Count => _Servers.Count; 24 | 25 | // -------------------------------------------------------------------------------------------------------------------- 26 | 27 | public ServerScriptManager(IHostingEnvironment env) 28 | { 29 | _HostingEnvironment = env; 30 | } 31 | 32 | // -------------------------------------------------------------------------------------------------------------------- 33 | 34 | /// Gets a server by name. 35 | /// The name. 36 | /// The server. 37 | public IJSServer GetServer(string name) => _ServersByName.TryGetValue(name, out var server) ? server : null; 38 | 39 | /// Gets a server by index. See to get the number of servers being managed. 40 | /// The name. 41 | /// The server. 42 | public IJSServer GetServer(int index) => _Servers[index]; 43 | 44 | /// 45 | /// Creates a server by the given name. If a server already exists it is returned. If a name is not specific then a 46 | /// GUID is created. 47 | /// 48 | /// The name. 49 | /// The new server. 50 | public IJSServer AddServer(IJSServer server) 51 | { 52 | if (server == null) throw new ArgumentNullException(nameof(server)); 53 | var name = server.Name ?? string.Empty; 54 | if (_ServersByName.TryGetValue(name, out var _server)) 55 | return server; 56 | if (string.IsNullOrWhiteSpace(name)) 57 | server.Name = name = Guid.NewGuid().ToString("N"); 58 | _ServersByName[name] = server; 59 | _Servers.Add(server); 60 | return server; 61 | } 62 | 63 | // -------------------------------------------------------------------------------------------------------------------- 64 | 65 | public IEnumerator GetEnumerator() => _Servers.GetEnumerator(); 66 | 67 | IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable)_Servers).GetEnumerator(); 68 | 69 | // -------------------------------------------------------------------------------------------------------------------- 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/FlowScript/API/FileController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using System.Net; 4 | using Microsoft.AspNetCore.Hosting; 5 | using Microsoft.AspNetCore.Mvc; 6 | 7 | namespace FlowScript.API 8 | { 9 | /// A controller for handling files. 10 | /// 11 | [Route("api/[controller]")] 12 | public class FileController : ControllerBase 13 | { 14 | IHostingEnvironment _HostingEnvironment; 15 | 16 | public FileController(IHostingEnvironment env) 17 | { 18 | _HostingEnvironment = env; 19 | } 20 | 21 | /// Returns a list of files and directories in the root. 22 | /// An enumerator that allows foreach to be used to process the matched items. 23 | [HttpGet] 24 | public IDataResponse Get() // Read 25 | { 26 | return Directory.EnumerateFileSystemEntries(_HostingEnvironment.ContentRootPath).AsResponse(); 27 | } 28 | 29 | /// Returns a list of files and directories in the root based on a pattern. 30 | /// The pattern to get. 31 | /// An enumerator that allows foreach to be used to process the matched items. 32 | [HttpGet("{pattern}")] 33 | public IDataResponse Get(string pattern) // Read 34 | { 35 | return Directory.EnumerateFileSystemEntries(_HostingEnvironment.ContentRootPath, WebUtility.UrlDecode(pattern)).AsResponse(); 36 | } 37 | 38 | /// Returns a list of files and directories in the root based on a sub-path and pattern. 39 | /// Full pathname of the file. 40 | /// The pattern to get. 41 | /// An enumerator that allows foreach to be used to process the matched items. 42 | [HttpGet("{path}/{pattern}")] 43 | public IDataResponse Get(string path, string pattern) // Read 44 | { 45 | path = ("" + WebUtility.UrlDecode(path)).Replace('/', '\\'); 46 | if (path.StartsWith('\\') || path.Contains("..") || path.Contains(':')) 47 | return $"For security reasons, a path cannot contain ':' or '..', and you cannot start a path using '\\' or '/'.\r\nPath given: {path}".AsError(); 48 | var finalPath = Path.Combine(_HostingEnvironment.ContentRootPath, path); 49 | if (!Directory.Exists(finalPath)) return $"The path '{finalPath}' does not exist.".AsError(); 50 | return Directory.EnumerateFileSystemEntries(finalPath, WebUtility.UrlDecode(pattern)).AsResponse(); 51 | } 52 | 53 | // POST api/values 54 | [HttpPost, RequestSizeLimit(100_000_000)] 55 | public IAPIResponse Post([FromBody]string value) // Create 56 | { 57 | return APIResponse.OK; 58 | } 59 | 60 | // PUT api/values/5 61 | [HttpPut("{id}")] 62 | public IAPIResponse Put(int id, [FromBody]string value) // Update/Replace 63 | { 64 | return APIResponse.OK; 65 | } 66 | 67 | // DELETE api/values/5 68 | [HttpDelete("{id}")] 69 | public IAPIResponse Delete(int id) // Delete 70 | { 71 | return APIResponse.OK; 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/System/Security.ts: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | // User Access Security 3 | 4 | namespace FlowScript { 5 | // ======================================================================================================================== 6 | 7 | export enum UserRoles { 8 | /** The user has no access. */ 9 | None, 10 | /** The user has full access as administrator. */ 11 | Admin, 12 | /** The user has read access. */ 13 | Viewer, 14 | /** The user is allowed to make modifications. Implies read access, but does not include creation access. */ 15 | Editor, 16 | /** The user can create and modify. */ 17 | Creator, 18 | /** The user can delete/remove. */ 19 | Purger 20 | } 21 | 22 | export class UserAccessEntry { 23 | constructor(public userID: string, public roles: UserRoles[]) { } 24 | 25 | /** Returns true if the specified role exists in this access entry. */ 26 | hasRole(role: UserRoles) { 27 | if (this.roles) 28 | for (var i = 0, n = this.roles.length; i < n; ++i) 29 | if (this.roles[i] == role) 30 | return true; 31 | return false; 32 | } 33 | } 34 | 35 | export class UserAccess { 36 | private _userIDs: UserAccessEntry[] = []; 37 | 38 | get length() { return this._userIDs.length; } 39 | 40 | /** Assigns a user ID and one or more roles. If roles already exist, the given roles are merged (existing roles are note replaced). */ 41 | add(userID: string, ...roles: UserRoles[]): UserAccessEntry { 42 | var entry = this.getItem(userID); 43 | if (!entry) { 44 | entry = new UserAccessEntry(userID, roles); 45 | this._userIDs.push(entry); 46 | } else { 47 | if (!entry.roles) 48 | entry.roles = roles; 49 | else 50 | entry.roles.push(...roles); 51 | } 52 | return entry; 53 | } 54 | 55 | /** Removes a user's access. */ 56 | revoke(index: number): boolean; 57 | /** Removes a user's access. */ 58 | revoke(id: string): boolean; 59 | revoke(indexOrID: number | string): boolean { 60 | var i = typeof indexOrID == 'number' ? indexOrID : this.indexOf(indexOrID); 61 | return i >= 0 ? (this._userIDs.splice(i, 1), true) : false; 62 | } 63 | 64 | /** Finds the index of the entry with the specific user ID. */ 65 | indexOf(userID: string) { 66 | for (var i = 0, n = this.length; i < n; ++i) 67 | if (this._userIDs[i].userID == userID) 68 | return i; 69 | return -1; 70 | } 71 | 72 | /** Gets a user access entry using an index. */ 73 | getItem(index: number): UserAccessEntry; 74 | /** Gets a user access entry using the user ID. */ 75 | getItem(userID: string): UserAccessEntry; 76 | getItem(indexOrID: number | string): UserAccessEntry { 77 | return this._userIDs[typeof indexOrID == 'number' ? indexOrID : this.indexOf(indexOrID)]; 78 | } 79 | } 80 | 81 | // ======================================================================================================================== 82 | } 83 | 84 | // ############################################################################################################################ 85 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/System/Solution.ts: -------------------------------------------------------------------------------- 1 | namespace FlowScript { 2 | // ======================================================================================================================== 3 | 4 | function _defaultCreateProjectHandler(solution: Solution, project: ISavedProject) { 5 | return new Project(solution, project.name, project.description); 6 | }; 7 | 8 | export interface ISavedSolution extends ISavedTrackableObject { 9 | name: string; 10 | description?: string; 11 | directory?: string; 12 | /** If this is a string, then it represents a GUID that references a project instead. */ 13 | projects?: (ISavedProject | string)[]; 14 | //comments: string[]; 15 | } 16 | 17 | /** 18 | * Holds a collection of projects. 19 | * When a project instance is created, the default 'Solution.onCreateProject' handler is used, which can be overridden for derived project types. 20 | */ 21 | export class Solution extends TrackableObject { 22 | /** The function used to create project instances when a project is created from saved project data. 23 | * Host programs can hook into this to create and return derived types instead (such as ProjectUI.ts). 24 | */ 25 | static get onCreateProject() { return this._onCreateProject || _defaultCreateProjectHandler; } 26 | static set onCreateProject(value) { if (typeof value != 'function') throw "Solution.onCreateProject: Set failed - value is not a function."; this._onCreateProject = value; } 27 | private static _onCreateProject = _defaultCreateProjectHandler; 28 | 29 | get count() { return this._projects.length; } 30 | 31 | /* All projects for the current user. */ 32 | get projects() { return this._projects; } 33 | private _projects: Project[] = []; // (the loaded projects that are currently active) 34 | 35 | /* A list of users, by ID, that are allowed . */ 36 | get userIDs() { return this._userIDs; } 37 | private _userIDs: string[] = []; // (the loaded projects that are currently active) 38 | 39 | //x get unloadedProjects() { return this._unloadedProjects; } 40 | //x private _unloadedProjects: ISavedProject[] = []; // (the unloaded projects) 41 | 42 | /** The file storage directory for all projects. */ 43 | readonly directory: FileSystem.Directory; 44 | 45 | /** A list of user IDs and assigned roles for this project. */ 46 | readonly userSecurity = new UserAccess(); 47 | 48 | constructor() { 49 | super(); 50 | this.directory = FileSystem.fileManager.createDirectory(this._id); 51 | } 52 | 53 | /** 54 | * Creates a new project with the given title and description. 55 | * @param name The project title. 56 | * @param description The project description. 57 | */ 58 | createProject(name: string, description?: string): Project { 59 | var info: ISavedProject = { name, description }; 60 | var project = Solution.onCreateProject(this, info); 61 | this._projects.push(project); 62 | return project; 63 | } 64 | 65 | /** Compiles a list of all projects, both locally and remotely. */ 66 | async refreshProjects() { 67 | return new Promise((ok, err) => { 68 | //var unloadedProjects = this._unloadedProjects; 69 | 70 | }); 71 | } 72 | } 73 | 74 | // ======================================================================================================================== 75 | } -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/old/System/Table.js: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | // Data Tables 3 | var __extends = (this && this.__extends) || (function () { 4 | var extendStatics = Object.setPrototypeOf || 5 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 6 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 7 | return function (d, b) { 8 | extendStatics(d, b); 9 | function __() { this.constructor = d; } 10 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 11 | }; 12 | })(); 13 | var FlowScript; 14 | (function (FlowScript) { 15 | // ======================================================================================================================== 16 | var ColumnAccessLevels; 17 | (function (ColumnAccessLevels) { 18 | /** The column can be read from, and written to. */ 19 | ColumnAccessLevels[ColumnAccessLevels["ReadWrite"] = 0] = "ReadWrite"; 20 | /** The column cannot be updated. */ 21 | ColumnAccessLevels[ColumnAccessLevels["ReadOnly"] = 1] = "ReadOnly"; 22 | /** The column is treated as if it doesn't exist. */ 23 | ColumnAccessLevels[ColumnAccessLevels["Hidden"] = 2] = "Hidden"; 24 | })(ColumnAccessLevels = FlowScript.ColumnAccessLevels || (FlowScript.ColumnAccessLevels = {})); 25 | var Column = /** @class */ (function () { 26 | function Column() { 27 | this._accessLevel = ColumnAccessLevels.ReadWrite; 28 | } 29 | Object.defineProperty(Column.prototype, "name", { 30 | get: function () { return this._name; }, 31 | enumerable: true, 32 | configurable: true 33 | }); 34 | Object.defineProperty(Column.prototype, "type", { 35 | get: function () { return this._type; }, 36 | enumerable: true, 37 | configurable: true 38 | }); 39 | Object.defineProperty(Column.prototype, "accessLevel", { 40 | get: function () { return this._accessLevel; }, 41 | enumerable: true, 42 | configurable: true 43 | }); 44 | return Column; 45 | }()); 46 | FlowScript.Column = Column; 47 | var Row = /** @class */ (function () { 48 | function Row() { 49 | } 50 | return Row; 51 | }()); 52 | FlowScript.Row = Row; 53 | /** Represents a structure of data, much like a class. 54 | * Tables exist to replace the concept of class instances in many other languages. In most cases, programmers create 55 | * methods/functions to operate on either a data structure (object with properties), or data returned from a database. 56 | * To mimic classes, a table with one row is created, where the columns are the properties. As well, columns can be 57 | * flagged as readonly, 58 | */ 59 | var Table = /** @class */ (function (_super_1) { 60 | __extends(Table, _super_1); 61 | // -------------------------------------------------------------------------------------------------------------------- 62 | function Table(parent, tableName) { 63 | var _this = _super_1.call(this, parent, tableName) || this; 64 | _this._columns = []; 65 | _this._rows = []; 66 | return _this; 67 | } 68 | return Table; 69 | }(FlowScript.Type)); 70 | FlowScript.Table = Table; 71 | // ======================================================================================================================== 72 | })(FlowScript || (FlowScript = {})); 73 | // ############################################################################################################################ 74 | //# sourceMappingURL=table.js.map -------------------------------------------------------------------------------- /src/FlowScript/.JSServer/Integrations/VroomIntegration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using VroomJs; 7 | 8 | namespace FlowScript.JSServer.Integrations.VroomJS 9 | { 10 | 11 | public class VroomJSContext : IJSContext 12 | { 13 | public readonly VroomJSServer Server; 14 | public string Name { get; } 15 | JsContext _Context; 16 | 17 | public VroomJSContext(VroomJSServer server, string name) 18 | { 19 | Server = server ?? throw new ArgumentNullException(nameof(server)); 20 | Name = name; 21 | _Context = Server.Engine.CreateContext(); 22 | } 23 | 24 | public object Execute(string js, string scriptName = null) 25 | { 26 | if (string.IsNullOrWhiteSpace(js)) return null; 27 | var trycatchblock = "try { " + js + " } catch(ex) { if (typeof ex == 'object') throw ex.message+'\r\n'+ex.stack; else throw ex; }"; 28 | try 29 | { 30 | return _Context.Execute(trycatchblock, string.IsNullOrWhiteSpace(scriptName) ? "FlowScript: anonymous JS" : scriptName); 31 | } 32 | catch (Exception ex) 33 | { 34 | var script = trycatchblock.Length <= 255 ? trycatchblock : trycatchblock.Substring(0, 256); 35 | throw new JsException("FlowScript: Error executing JS. First 256 characters of script: " + Environment.NewLine + script, ex); 36 | // TODO: detect column and run and show only that part. 37 | // TODO: Consider own exception object for consistency. 38 | } 39 | } 40 | 41 | /// Executes the given file by path and name. 42 | /// 43 | /// Path and filename of the file. If a relative path is given, it is relative to the content root. 44 | /// 45 | /// A JSServer. 46 | public object RunFile(string filename) 47 | { 48 | if (string.IsNullOrWhiteSpace(filename)) 49 | throw new ArgumentNullException(nameof(filename)); 50 | var _filename = filename; 51 | if (!filename.StartsWith("/") && !filename.StartsWith("\\")) 52 | _filename = Path.Combine(Server.Manager._HostingEnvironment.ContentRootPath, filename); 53 | if (!File.Exists(_filename) && File.Exists(filename)) 54 | _filename = filename; 55 | if (!File.Exists(_filename)) 56 | throw new FileNotFoundException("FlowScript: Could not execute the script - file not found: " + _filename, _filename); 57 | string contents; 58 | try 59 | { 60 | contents = File.ReadAllText(_filename); 61 | } 62 | catch (Exception ex) 63 | { 64 | throw new FileLoadException("FlowScript: Could not execute the script - unable to load the script file: " + _filename, _filename, ex); 65 | } 66 | 67 | return Execute(contents, filename); 68 | } 69 | } 70 | 71 | /// Returns the VroomJS JavaScript wrapper integration. 72 | public class VroomJSServer : IJSServer 73 | { 74 | public readonly ServerScriptManager Manager; 75 | public string Name { get; set; } 76 | public readonly JsEngine Engine; 77 | 78 | public VroomJSServer(ServerScriptManager manager, string name) 79 | { 80 | Manager = manager ?? throw new ArgumentNullException(nameof(manager)); 81 | Name = name; 82 | Engine = new JsEngine(); 83 | manager.AddServer(this); 84 | } 85 | 86 | /// Creates a new VroomJS context. 87 | /// The name. 88 | /// The new context. 89 | public IJSContext CreateContext(string name) 90 | { 91 | return new VroomJSContext(this, name); 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/FlowScript/.JSServer/Integrations/V8DotNetIntegration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using V8.Net; 7 | 8 | namespace FlowScript.JSServer.Integrations.V8DotNet 9 | { 10 | 11 | public class V8DotNetContext : IJSContext 12 | { 13 | public readonly V8DotNetServer Server; 14 | public string Name { get; } 15 | Context _Context; // (does not yet support contexts!) 16 | 17 | public V8DotNetContext(V8DotNetServer server, string name) 18 | { 19 | Server = server ?? throw new ArgumentNullException(nameof(server)); 20 | Name = name; 21 | _Context = server.Engine.CreateContext(); // (does not yet support contexts!) 22 | } 23 | 24 | public object Execute(string js, string scriptName = null) 25 | { 26 | if (string.IsNullOrWhiteSpace(js)) return null; 27 | try 28 | { 29 | Server.Engine.SetContext(_Context); // TODO: Make sure the native side doesn't keep setting the same setting when already set. ;) 30 | return Server.Engine.Execute(js, string.IsNullOrWhiteSpace(scriptName) ? "FlowScript: anonymous JS" : scriptName); 31 | } 32 | catch (Exception ex) 33 | { 34 | var script = js.Length <= 255 ? js : js.Substring(0, 256); 35 | throw new InvalidOperationException("FlowScript: Error executing JS. First 256 characters of script: " + Environment.NewLine + script, ex); 36 | // TODO: detect column and run and show only that part. 37 | // TODO: Consider own exception object for consistency. 38 | } 39 | } 40 | 41 | /// Executes the given file by path and name. 42 | /// 43 | /// Path and filename of the file. If a relative path is given, it is relative to the content root. 44 | /// 45 | public object RunFile(string filename) 46 | { 47 | if (string.IsNullOrWhiteSpace(filename)) 48 | throw new ArgumentNullException(nameof(filename)); 49 | var _filename = filename; 50 | if (!filename.StartsWith("/") && !filename.StartsWith("\\")) 51 | _filename = Path.Combine(Server.Manager._HostingEnvironment.ContentRootPath, filename); 52 | if (!File.Exists(_filename) && File.Exists(filename)) 53 | _filename = filename; 54 | if (!File.Exists(_filename)) 55 | throw new FileNotFoundException("FlowScript: Could not execute the script - file not found: " + _filename, _filename); 56 | string contents; 57 | try 58 | { 59 | contents = File.ReadAllText(_filename); 60 | } 61 | catch (Exception ex) 62 | { 63 | throw new FileLoadException("FlowScript: Could not execute the script - unable to load the script file: " + _filename, _filename, ex); 64 | } 65 | 66 | return Execute(contents, filename); 67 | } 68 | } 69 | 70 | /// Returns the V8.NET JavaScript wrapper integration. 71 | public class V8DotNetServer : IJSServer 72 | { 73 | public readonly ServerScriptManager Manager; 74 | public string Name { get; set; } 75 | public readonly V8Engine Engine; 76 | 77 | public V8DotNetServer(ServerScriptManager manager, string name) 78 | { 79 | Manager = manager ?? throw new ArgumentNullException(nameof(manager)); 80 | Name = name; 81 | Engine = new V8Engine(false); 82 | manager.AddServer(this); 83 | } 84 | 85 | /// Creates a new VroomJS context. 86 | /// The name. 87 | /// The new context. 88 | public IJSContext CreateContext(string name) 89 | { 90 | return new V8DotNetContext(this, name); 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/System/Statement.ts: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | 3 | namespace FlowScript { 4 | // ======================================================================================================================== 5 | 6 | export interface ISavedStatement extends ISavedComponentReference { } 7 | 8 | /** The root expression is call a "statement", which is a single stand-alone component call, assignment operation, or flow 9 | * control block. Lines usually reference statements, and other expressions are nested within them. 10 | */ 11 | export class Statement extends ComponentReference { 12 | // -------------------------------------------------------------------------------------------------------------------- 13 | 14 | get script(): IFlowScript { return this._line ? this._line.script : null; } 15 | 16 | /** The line this expression belongs to. */ 17 | get line() { return this._line; } 18 | private _line: Line; 19 | 20 | /** The line number this statement is on. */ 21 | get lineNumer() { return this._line ? this._line.lineNumber : void 0; } 22 | 23 | /** Returns the functional component this expression belongs to. */ 24 | get functionalComponent(): Component { return this.line ? this.line.component : null; } 25 | 26 | get block(): Block { return this._line ? this._line.block : null; } 27 | 28 | // -------------------------------------------------------------------------------------------------------------------- 29 | 30 | constructor(line: Line, action: Component, args?: IExpressionArgs, returnTargets?: IReturnTargetMap[], eventHandlers?: BlockReference[]) { 31 | super(action, args, returnTargets, eventHandlers); // (need to set the line reference first before calling into the base) 32 | this._line = line; 33 | } 34 | 35 | // -------------------------------------------------------------------------------------------------------------------- 36 | 37 | /** Creates a visual tree snapshot for this component and the component's first block. */ 38 | createVisualTree(parent?: VisualNode, visualNodeType?: IVisualNodeType): T { 39 | var node = super.createVisualTree(parent, visualNodeType); 40 | return node; 41 | } 42 | 43 | // -------------------------------------------------------------------------------------------------------------------- 44 | 45 | protected _clone(parent?: Expression): Statement { 46 | return new Statement(this._line, this.component); 47 | } 48 | // -------------------------------------------------------------------------------------------------------------------- 49 | 50 | save(target?: ISavedStatement): ISavedStatement { 51 | target = target || {}; 52 | super.save(target); 53 | return target; 54 | } 55 | 56 | load(target?: ISavedStatement): this { 57 | if (target) { 58 | super.load(target); 59 | } 60 | return this; 61 | } 62 | 63 | // -------------------------------------------------------------------------------------------------------------------- 64 | 65 | /** Removes a child expression from the expression tree. */ 66 | remove(child: Expression): Expression; 67 | /** Removes self from the associated line. */ 68 | remove(): Expression; 69 | remove(child?: Expression): Expression { 70 | if (child) 71 | return super.remove(child); 72 | else { 73 | if (this._line) 74 | return this._line.removeStatement(this); 75 | return void 0; 76 | } 77 | } 78 | 79 | // -------------------------------------------------------------------------------------------------------------------- 80 | } 81 | 82 | // ======================================================================================================================== 83 | } 84 | 85 | // ############################################################################################################################ 86 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/ProjectUI.ts: -------------------------------------------------------------------------------- 1 | // ======================================================================================================================== 2 | // Project UI 3 | 4 | namespace FlowScript.UI { 5 | // ======================================================================================================================== 6 | 7 | function _defaultCreateProjectHandler(solution: Solution, project: ISavedProject) { 8 | return new ProjectUI(solution, project.name, project.description); 9 | }; 10 | 11 | Solution.onCreateProject = _defaultCreateProjectHandler; 12 | 13 | /** 14 | * Extends the 'Projects' class to provide UI integration functions specific to the IDE. 15 | */ 16 | export class ProjectUI extends Project { 17 | 18 | /** The current project focused for editing. */ 19 | static currentProject: ProjectUI; 20 | 21 | get scriptEditor(): ScriptEditor { 22 | if (!this._scriptEditor) 23 | throw "There is no editor set for project '" + this.name + "': You must call 'setEditor()' first to associated an editor."; 24 | return this._scriptEditor; 25 | } 26 | private _scriptEditor: ScriptEditor; 27 | 28 | /** The current component being edited (defaults to 'main'). */ 29 | get currentComponent(): Component { return this._currentComponent; } 30 | set currentComponent(comp: Component) { this._currentComponent = comp; } 31 | private _currentComponent: Component; 32 | 33 | /** Triggered when the project is activated within the parent Views instance. */ 34 | onActivated = new EventDispatcher(this); 35 | 36 | // -------------------------------------------------------------------------------------------------------------------- 37 | 38 | constructor(solution: Solution, title: string, description?: string) { 39 | super(solution, title, description); 40 | 41 | this.onExpressionBinItemAdded.add(this._onExpressionBinItemAdded); 42 | this.onExpressionBinItemRemoved.add(this._onExpressionBinItemRemoved); 43 | } 44 | 45 | /** Sets the editor that this project will render to. */ 46 | setEditor(scriptEditor: ScriptEditor) { 47 | if (!scriptEditor) 48 | throw "'scriptEditor' is required.'"; 49 | if (!(scriptEditor instanceof ScriptEditor)) 50 | throw "'scriptEditor' is not a ScriptEditor type object.'"; 51 | this._scriptEditor = scriptEditor; 52 | } 53 | 54 | // -------------------------------------------------------------------------------------------------------------------- 55 | 56 | /** Active the project and bring it into view. */ 57 | activate() { 58 | ProjectUI.currentProject = this; 59 | this._scriptEditor.currentProject = this; 60 | 61 | // ... if there is no current component as the focus for editing, set one (usually the 'main' component) ... 62 | if (!this._currentComponent) 63 | this._currentComponent = this._script.Main; 64 | 65 | this._onRender(); 66 | 67 | this._scriptEditor.view.show(); 68 | 69 | this.onActivated.trigger(this); 70 | } 71 | 72 | // -------------------------------------------------------------------------------------------------------------------- 73 | 74 | private _onExpressionBinItemAdded(item: Expression) { 75 | this.scriptEditor.refreshScratchSpace(); 76 | } 77 | 78 | private _onExpressionBinItemRemoved(item: Expression) { 79 | this.scriptEditor.refreshScratchSpace(); 80 | } 81 | 82 | private _onRender() { 83 | this.scriptEditor.view.setElementValueById("txtProjTitle", this.name); 84 | this.scriptEditor.view.setElementValueById("txtProjDesc", this.description); 85 | 86 | this.scriptEditor.typeTree.setSource(this.script); // (build the type tree) 87 | this.scriptEditor.typeTree.selectItem(this._currentComponent); // (select the current component in the type tree) 88 | } 89 | 90 | // -------------------------------------------------------------------------------------------------------------------- 91 | } 92 | } 93 | 94 | // ======================================================================================================================== 95 | -------------------------------------------------------------------------------- /src/FlowScript/wwwroot/js/flowscript.tsbuildinfo: -------------------------------------------------------------------------------- 1 | { 2 | "bundle": { 3 | "commonSourceDirectory": "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/", 4 | "sourceFiles": [ 5 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/EventDispatcher.ts", 6 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/NamespaceObject.ts", 7 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/NamedReference.ts", 8 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/User.ts", 9 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Security.ts", 10 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/FileManager.ts", 11 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/FlowScriptMain.ts", 12 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Expressions.ts", 13 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Property.ts", 14 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Component.ts", 15 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Statement.ts", 16 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Block.ts", 17 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Line.ts", 18 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Enum.ts", 19 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Event.ts", 20 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Message.ts", 21 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Table.ts", 22 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Thread.ts", 23 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Components/Core.ts", 24 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Components/Core.HTTPRequest.ts", 25 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Components/Core.ControlFlow.ts", 26 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Components/Core.Math.ts", 27 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Components/Core.Binary.ts", 28 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Components/Core.Comparison.ts", 29 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Components/Core.DOM.ts", 30 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Components/Core.HTML.ts", 31 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Compiler.ts", 32 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Simulator.ts", 33 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Visualtree.ts", 34 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Views.ts", 35 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Project.ts", 36 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/Solution.ts", 37 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/System.ts", 38 | "C:/Data/Visual Studio/Projects/Inossis/FlowScript/src/FlowScript/TypeScript/System/bootup.ts" 39 | ], 40 | "js": { 41 | "sections": [ 42 | { 43 | "pos": 0, 44 | "end": 607, 45 | "kind": "emitHelpers", 46 | "data": "typescript:awaiter" 47 | }, 48 | { 49 | "pos": 609, 50 | "end": 509504, 51 | "kind": "text" 52 | } 53 | ], 54 | "sources": { 55 | "helpers": [ 56 | "typescript:awaiter" 57 | ] 58 | } 59 | }, 60 | "dts": { 61 | "sections": [ 62 | { 63 | "pos": 0, 64 | "end": 165666, 65 | "kind": "text" 66 | } 67 | ] 68 | } 69 | }, 70 | "version": "3.4.1" 71 | } -------------------------------------------------------------------------------- /src/FlowScript/wwwroot/swagger-ui/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | %(DocumentTitle) 7 | 8 | 9 | 10 | 11 | 30 | %(HeadContent) 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 |
70 | 73 |
74 |
75 | 76 | 77 | 78 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/old/System/Definitions/Core.Binary.ts.txt: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | 3 | namespace FlowScript.Core.Binary { 4 | // ======================================================================================================================== 5 | // Core Math Components 6 | // ======================================================================================================================== 7 | 8 | /** Defines the Math namespace type. */ 9 | export class Binary extends TypeDefinition { // (a type that is inferred by the given arguments) 10 | 11 | /** Returns the inverse boolean value of a given expression. */ 12 | Not = new Not(this); 13 | 14 | /** Returns the eXclusive OR of a given expression. */ 15 | XOR = new XOR(this); 16 | 17 | /** Shifts all bits of an integer value to the left a number of times. */ 18 | ShiftLeft = new ShiftLeft(this); 19 | 20 | /** Shifts all bits of an integer value to the right a number of times. */ 21 | ShiftRight = new ShiftRight(this); 22 | 23 | constructor(parent: TypeDefinition) { 24 | super(parent, "Binary"); 25 | } 26 | init() { 27 | super.init(); 28 | } 29 | } 30 | 31 | // ======================================================================================================================== 32 | 33 | /** Returns the inverse of the given boolean value. 34 | */ 35 | export class Not extends Operator { 36 | constructor(parent: TypeDefinition) { 37 | super(parent, "Not", "not $a", true); // 38 | } 39 | init() { 40 | // Setup the expected parameters and return type: 41 | 42 | var sys = this.script.System; 43 | 44 | this.defineParameter("a", [sys.Boolean]); 45 | 46 | this.defineDefaultReturnVar(sys.Boolean); 47 | 48 | super.init(); 49 | } 50 | } 51 | 52 | // ======================================================================================================================== 53 | 54 | /** Returns the eXclusive OR of a given value. 55 | */ 56 | export class XOR extends Operator { 57 | constructor(parent: TypeDefinition) { 58 | super(parent, "XOR", "xor $a", true); // 59 | } 60 | init() { 61 | // Setup the expected parameters and return type: 62 | 63 | var sys = this.script.System; 64 | 65 | this.defineParameter("a", [sys.Integer]); 66 | 67 | this.defineDefaultReturnVar(sys.Integer); 68 | 69 | super.init(); 70 | } 71 | } 72 | 73 | // ======================================================================================================================== 74 | 75 | /** Shifts all bits of an integer value to the left a number of times. 76 | */ 77 | export class ShiftLeft extends Operator { 78 | constructor(parent: TypeDefinition) { 79 | super(parent, "ShiftLeft", "$value << $count"); // 80 | } 81 | init() { 82 | // Setup the expected parameters and return type: 83 | 84 | var sys = this.script.System; 85 | 86 | this.defineParameter("value", [sys.Integer]); 87 | this.defineParameter("count", [sys.Integer]); 88 | 89 | this.defineDefaultReturnVar(sys.Integer); 90 | 91 | super.init(); 92 | } 93 | } 94 | 95 | // ======================================================================================================================== 96 | 97 | /** Shifts all bits of an integer value to the right a number of times. 98 | */ 99 | export class ShiftRight extends Operator { 100 | constructor(parent: TypeDefinition) { 101 | super(parent, "ShiftRight", "$value >> $count"); // 102 | } 103 | init() { 104 | // Setup the expected parameters and return type: 105 | 106 | var sys = this.script.System; 107 | 108 | this.defineParameter("value", [sys.Integer]); 109 | this.defineParameter("count", [sys.Integer]); 110 | 111 | this.defineDefaultReturnVar(sys.Integer); 112 | 113 | super.init(); 114 | } 115 | } 116 | 117 | // ======================================================================================================================== 118 | } 119 | 120 | // ############################################################################################################################ 121 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/System/components/Core.Binary.ts: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | 3 | namespace FlowScript.Core.Binary { 4 | // ======================================================================================================================== 5 | // Core Math Components 6 | // ======================================================================================================================== 7 | 8 | /** Defines the Math namespace type. */ 9 | export class Binary extends NamespaceObject { // (a type that is inferred by the given arguments) 10 | 11 | /** Returns the inverse boolean value of a given expression. */ 12 | Not = new Not(this); 13 | 14 | /** Returns the eXclusive OR of a given expression. */ 15 | XOR = new XOR(this); 16 | 17 | /** Shifts all bits of an integer value to the left a number of times. */ 18 | ShiftLeft = new ShiftLeft(this); 19 | 20 | /** Shifts all bits of an integer value to the right a number of times. */ 21 | ShiftRight = new ShiftRight(this); 22 | 23 | constructor(parent: NamespaceObject) { 24 | super(parent, "Binary"); 25 | } 26 | onInit() { 27 | super.onInit(); 28 | } 29 | } 30 | 31 | // ======================================================================================================================== 32 | 33 | /** Returns the inverse of the given boolean value. 34 | */ 35 | export class Not extends Operator { 36 | constructor(parent: NamespaceObject) { 37 | super(parent, "Not", "not $a", true); // 38 | } 39 | onInit() { 40 | // Setup the expected parameters and return type: 41 | 42 | var sys = this.script.System; 43 | 44 | this.defineParameter("a", [sys.Boolean]); 45 | 46 | this.defineDefaultReturnVar(sys.Boolean); 47 | 48 | super.onInit(); 49 | } 50 | } 51 | 52 | // ======================================================================================================================== 53 | 54 | /** Returns the eXclusive OR of a given value. 55 | */ 56 | export class XOR extends Operator { 57 | constructor(parent: NamespaceObject) { 58 | super(parent, "XOR", "xor $a", true); // 59 | } 60 | onInit() { 61 | // Setup the expected parameters and return type: 62 | 63 | var sys = this.script.System; 64 | 65 | this.defineParameter("a", [sys.Integer]); 66 | 67 | this.defineDefaultReturnVar(sys.Integer); 68 | 69 | super.onInit(); 70 | } 71 | } 72 | 73 | // ======================================================================================================================== 74 | 75 | /** Shifts all bits of an integer value to the left a number of times. 76 | */ 77 | export class ShiftLeft extends Operator { 78 | constructor(parent: NamespaceObject) { 79 | super(parent, "ShiftLeft", "$value << $count"); // 80 | } 81 | onInit() { 82 | // Setup the expected parameters and return type: 83 | 84 | var sys = this.script.System; 85 | 86 | this.defineParameter("value", [sys.Integer]); 87 | this.defineParameter("count", [sys.Integer]); 88 | 89 | this.defineDefaultReturnVar(sys.Integer); 90 | 91 | super.onInit(); 92 | } 93 | } 94 | 95 | // ======================================================================================================================== 96 | 97 | /** Shifts all bits of an integer value to the right a number of times. 98 | */ 99 | export class ShiftRight extends Operator { 100 | constructor(parent: NamespaceObject) { 101 | super(parent, "ShiftRight", "$value >> $count"); // 102 | } 103 | onInit() { 104 | // Setup the expected parameters and return type: 105 | 106 | var sys = this.script.System; 107 | 108 | this.defineParameter("value", [sys.Integer]); 109 | this.defineParameter("count", [sys.Integer]); 110 | 111 | this.defineDefaultReturnVar(sys.Integer); 112 | 113 | super.onInit(); 114 | } 115 | } 116 | 117 | // ======================================================================================================================== 118 | } 119 | 120 | // ############################################################################################################################ 121 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/Client.ts: -------------------------------------------------------------------------------- 1 | namespace FlowScript { 2 | 3 | /** The currently active editor that the user has focused. */ 4 | export var activeEditor: monaco.editor.IStandaloneCodeEditor; 5 | 6 | /** All editor instances created on the page by ID. */ 7 | export var editors: { [index: string]: monaco.editor.IStandaloneCodeEditor } = {}; 8 | 9 | export class FlowScriptClient extends FlowScriptBase { 10 | } 11 | } 12 | 13 | var rootViewContainer = FlowScript.Views.buildViews(); 14 | var rootBodyViewContainer = rootViewContainer.getViewContainer("renderBody"); 15 | var solution = new FlowScript.Solution(); 16 | var rootPath = "/"; 17 | var rootViewsPath = rootPath + "views"; 18 | 19 | function setInput(id: string, newValue = "") { 20 | if (id) { 21 | var el = document.getElementById(id); 22 | if (el) el.value = (newValue === void 0 || newValue === null ? "" : newValue); 23 | } 24 | } 25 | 26 | function getInput(id: string): string { 27 | if (id) { 28 | var el = document.getElementById(id); 29 | if (el) 30 | return el.value; 31 | else 32 | return null; // (not found) 33 | } 34 | else return null; // (no id) 35 | } 36 | 37 | function newProject() { 38 | rootBodyViewContainer.createView("NewProjectForm", rootViewsPath + "/NewProjectForm.html").onloaded((view, req, ev) => { 39 | view.buildViews(); 40 | view.show(); 41 | setInput("projTitle"); 42 | setInput("projDesc"); 43 | }).onerror((view, request, ev) => { view.contentElement.innerHTML = "Communication error - please try again."; }).send(); 44 | } 45 | 46 | function createProject() { 47 | var projectTitle = getInput("projTitle"); 48 | var projectDesc = getInput("projDesc"); 49 | 50 | if (!projectTitle) { 51 | alert("A project title is required."); 52 | return; 53 | } 54 | 55 | var newProject = solution.createProject(projectTitle, projectDesc, FlowScript.UI.ProjectUI); 56 | 57 | if (FlowScript.debugging) 58 | FlowScript.Tests.populateProject(newProject); 59 | 60 | rootBodyViewContainer.createView("ScriptEditor", rootViewsPath + "/ScriptEditor.html").onloaded((view, req, ev) => { 61 | view.buildViews(); 62 | newProject.setEditor(new FlowScript.UI.ScriptEditor(view)); 63 | newProject.activate(); // (this will shows the view automatically) 64 | }).onerror((view, request, ev) => { view.contentElement.innerHTML = "Communication error - please try again."; }).send(); 65 | } 66 | 67 | function openProject() { 68 | var dataList = FlowScript.Storage.getSavedProjectDataList(); 69 | var i = 1; 70 | var selection = (alert("Open which project?\r\n" + dataList.select((d) => (i++) + ". " + d.toString() + "\r\n").join("")), prompt("Which one?")); 71 | alert("You selected " + selection); 72 | } 73 | 74 | function saveProject() { 75 | if (!FlowScript.UI.ProjectUI.currentProject) 76 | alert("No project is currently active."); 77 | else { 78 | FlowScript.UI.ProjectUI.currentProject.saveToStorage(); 79 | alert("Project saved."); 80 | } 81 | } 82 | 83 | function newComponent() { 84 | //if (editorContainer) 85 | // editorContainer.innerHTML = "[click/press here to start]"; 86 | } 87 | 88 | 89 | // ============================================================================================================================ 90 | // Bootstrap mobile-menu fix (see: https://stackoverflow.com/a/46123072/1236397). 91 | 92 | $(".navbar-nav li a:not('.dropdown-toggle')").on('click', function () { 93 | $('.navbar-collapse').collapse('hide'); 94 | if (FlowScript.UI.ProjectUI.currentProject) 95 | FlowScript.UI.ProjectUI.currentProject.scriptEditor.unselectNode(); 96 | }); 97 | 98 | // ============================================================================================================================ 99 | // Capture and show uncaught errors. 100 | 101 | window.onerror = function (event: any, source?: string, row?: number, col?: number): void { 102 | var div = document.createElement("DIV"); 103 | div.className = "alert alert-danger"; 104 | if (typeof event != "object") event = { message: event }; 105 | event.source = source; 106 | event.lineNumber = row; 107 | event.columnNumber = col; 108 | div.innerHTML = "" + FlowScript.getErrorMessage(event).replace(/\r\n/g, "
") + "

"; 109 | document.body.insertBefore(div, document.body.firstChild); 110 | }; 111 | 112 | window.onload = function () { 113 | var btnStart = document.getElementById("btnStart"); 114 | btnStart && (btnStart.onclick = () => { location.href = "editor.html"; }); 115 | }; 116 | 117 | // ============================================================================================================================ 118 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/old/System/Projects.js: -------------------------------------------------------------------------------- 1 | var FlowScript; 2 | (function (FlowScript) { 3 | // ======================================================================================================================== 4 | var Project = /** @class */ (function () { 5 | // -------------------------------------------------------------------------------------------------------------------- 6 | function Project( 7 | /** The title of the project. */ title, 8 | /** The project's description. */ description) { 9 | this.title = title; 10 | this.description = description; 11 | this._expressionBin = []; 12 | this.onExpressionBinItemAdded = new FlowScript.EventDispatcher(this); 13 | this.onExpressionBinItemRemoved = new FlowScript.EventDispatcher(this); 14 | this._script = FlowScript.createNew(); 15 | } 16 | Object.defineProperty(Project.prototype, "script", { 17 | // -------------------------------------------------------------------------------------------------------------------- 18 | /** The script instance for this project. */ 19 | get: function () { return this._script; }, 20 | enumerable: true, 21 | configurable: true 22 | }); 23 | Object.defineProperty(Project.prototype, "expressionBin", { 24 | // -------------------------------------------------------------------------------------------------------------------- 25 | // Create a type of trash-bin to hold expressions so the user can restore them, or delete permanently. 26 | /** Holds a list of expressions the developer has removed from scripts. This renders to a global space, which allows 27 | * developers to move expressions easily between scripts. 28 | * Use 'addExpressionToBin()' and 'removeExpressionFromBin()' to modify this list, which also triggers the UI to update. 29 | */ 30 | get: function () { return this._expressionBin; }, 31 | enumerable: true, 32 | configurable: true 33 | }); 34 | // -------------------------------------------------------------------------------------------------------------------- 35 | Project.prototype.save = function () { 36 | return this.script.saveToStorage(this.title); 37 | }; 38 | // -------------------------------------------------------------------------------------------------------------------- 39 | Project.prototype.addToBin = function (expr, triggerEvent) { 40 | if (triggerEvent === void 0) { triggerEvent = true; } 41 | if (this._expressionBin.indexOf(expr) < 0) { 42 | this._expressionBin.push(expr); 43 | if (triggerEvent) 44 | this.onExpressionBinItemAdded.trigger(expr, this); 45 | } 46 | }; 47 | Project.prototype.removeFromBin = function (expr, triggerEvent) { 48 | if (triggerEvent === void 0) { triggerEvent = true; } 49 | var i = this._expressionBin.indexOf(expr); 50 | if (i >= 0) { 51 | var expr = this._expressionBin.splice(i, 1)[0]; 52 | if (triggerEvent) 53 | this.onExpressionBinItemRemoved.trigger(expr, this); 54 | } 55 | }; 56 | Project.prototype.isInBin = function (expr) { return this._expressionBin.indexOf(expr) >= 0; }; 57 | // -------------------------------------------------------------------------------------------------------------------- 58 | Project.prototype._findChildNode = function (node, fstype) { 59 | if (node) { 60 | for (var i = 0, len = node.childNodes.length; i < len; ++i) 61 | if (node.childNodes[i]["$__fs_type"] == fstype) 62 | return node.childNodes[i]; 63 | } 64 | else 65 | return null; 66 | }; 67 | return Project; 68 | }()); 69 | FlowScript.Project = Project; 70 | // ======================================================================================================================== 71 | /** 72 | * Holds a collection of projects. 73 | */ 74 | var Projects = /** @class */ (function () { 75 | function Projects() { 76 | this._projects = []; 77 | } 78 | Object.defineProperty(Projects.prototype, "count", { 79 | get: function () { return this._projects.length; }, 80 | enumerable: true, 81 | configurable: true 82 | }); 83 | Projects.prototype.createProject = function (title, description, projectType) { 84 | var project = new (projectType || Project)(title, description); 85 | this._projects.push(project); 86 | return project; 87 | }; 88 | return Projects; 89 | }()); 90 | FlowScript.Projects = Projects; 91 | // ======================================================================================================================== 92 | })(FlowScript || (FlowScript = {})); 93 | //# sourceMappingURL=projects.js.map -------------------------------------------------------------------------------- /src/FlowScript/.JSServer/Integrations/ChakraIntegration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using ChakraCore; 7 | using ChakraCore.NET.API; 8 | 9 | namespace FlowScript.JSServer.Integrations.Chakra 10 | { 11 | 12 | public class ChakraContext : IJSContext 13 | { 14 | public readonly ChakraServer Server; 15 | public string Name { get; } 16 | JavaScriptContext _Context; 17 | 18 | public ChakraContext(ChakraServer server, string name) 19 | { 20 | Server = server ?? throw new ArgumentNullException(nameof(server)); 21 | Name = name; 22 | _Context = Server.Runtime.CreateContext(); 23 | } 24 | 25 | public object Execute(string js, string scriptName = null) 26 | { 27 | if (string.IsNullOrWhiteSpace(js)) return null; 28 | JavaScriptContext.Current = _Context; 29 | try 30 | { 31 | return JavaScriptContext.RunScript(js, Server.CurrentSourceContext, string.IsNullOrWhiteSpace(scriptName) ? "FlowScript: anonymous JS" : scriptName); 32 | // TODO: Note: Need a wrapper to make the return type the same on ever integrated JS context. 33 | } 34 | catch (Exception ex) 35 | { 36 | var msg = ""; 37 | if (ex is JavaScriptScriptException jsex) 38 | { 39 | msg = jsex.Error.GetProperty(JavaScriptPropertyId.FromString("message")).ToString() + Environment.NewLine; 40 | msg += " Source: " + jsex.Error.GetProperty(JavaScriptPropertyId.FromString("source")).ToString() + Environment.NewLine; 41 | msg += " on line " + jsex.Error.GetProperty(JavaScriptPropertyId.FromString("line")).ToInt32() 42 | + ", column " + jsex.Error.GetProperty(JavaScriptPropertyId.FromString("line")).ToInt32() + "." 43 | + Environment.NewLine; 44 | } 45 | var script = js.Length <= 255 ? js : js.Substring(0, 256); 46 | throw new InvalidOperationException("FlowScript: Error executing JS." + Environment.NewLine + msg + Environment.NewLine + "First 256 characters of script: " + Environment.NewLine + script, ex); 47 | // TODO: detect column and run and show only that part. 48 | // TODO: Consider own exception object for consistency. 49 | } 50 | } 51 | 52 | /// Executes the given file by path and name. 53 | /// 54 | /// Path and filename of the file. If a relative path is given, it is relative to the content root. 55 | /// 56 | /// A JSServer. 57 | public object RunFile(string filename) 58 | { 59 | if (string.IsNullOrWhiteSpace(filename)) 60 | throw new ArgumentNullException(nameof(filename)); 61 | var _filename = filename; 62 | if (!filename.StartsWith("/") && !filename.StartsWith("\\")) 63 | _filename = Path.Combine(Server.Manager._HostingEnvironment.ContentRootPath, filename); 64 | if (!File.Exists(_filename) && File.Exists(filename)) 65 | _filename = filename; 66 | if (!File.Exists(_filename)) 67 | throw new FileNotFoundException("FlowScript: Could not execute the script - file not found: " + _filename, _filename); 68 | string contents; 69 | try 70 | { 71 | contents = File.ReadAllText(_filename); 72 | } 73 | catch (Exception ex) 74 | { 75 | throw new FileLoadException("FlowScript: Could not execute the script - unable to load the script file: " + _filename, _filename, ex); 76 | } 77 | 78 | return Execute(contents, filename); 79 | } 80 | } 81 | 82 | /// Returns the Chakra JavaScript wrapper integration. 83 | public class ChakraServer : IJSServer 84 | { 85 | public readonly ServerScriptManager Manager; 86 | public string Name { get; set; } 87 | public readonly JavaScriptRuntime Runtime; 88 | public readonly JavaScriptSourceContext CurrentSourceContext; // (a context specific to the JS host [the web server]) 89 | 90 | public ChakraServer(ServerScriptManager manager, string name) 91 | { 92 | Manager = manager ?? throw new ArgumentNullException(nameof(manager)); 93 | Name = name; 94 | CurrentSourceContext = JavaScriptSourceContext.FromIntPtr(IntPtr.Zero); 95 | Runtime = JavaScriptRuntime.Create(); 96 | manager.AddServer(this); 97 | } 98 | 99 | /// Creates a new Chakra context. 100 | /// The name. 101 | /// The new context. 102 | public IJSContext CreateContext(string name) 103 | { 104 | return new ChakraContext(this, name); 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/System/Message.ts: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | 3 | namespace FlowScript { 4 | // ======================================================================================================================== 5 | 6 | /** A text message, which can later have translations applied. 7 | * Messages can have token place holders, such as '$0 $1 $2 ...' (where '$0' is the first argument given - see 'getMessage()'). 8 | * When ready to translate an application's messages, you use the IDE to export a comma separated list of messages and their 9 | * checksum values for later match up. If in a very rare case there is a checksum collision, you just give the message a 10 | * fixed internal ID. Although some may wish to do this anyhow for clarity, using checksums allows focus on development 11 | * of message feedback, without the annoyance of update string tables. If a message will be used in multiple places, it's 12 | * a good idea to give a fixed ID. 13 | */ 14 | export class Message { 15 | // -------------------------------------------------------------------------------------------------------------------- 16 | private _parent: IFlowScript; 17 | 18 | /** By default, the ID of a message is it's checksum. If there are conflicts (very rare), then a unique ID value must be explicitly defined. */ 19 | get id(): string { return this._id || this._checksum.toString(); } 20 | private _id: string; 21 | 22 | /** A simple hash to identify the message. If conflicts occur (very rare), then a unique ID value must be explicitly defined. */ 23 | get checksum(): number { return this._checksum; } 24 | private _checksum: number = 0; 25 | 26 | /** The message pattern is a text message that may contain token place holders for formatting (i.e. "Warning: $1"). */ 27 | get messagePattern(): string { return this._messagePattern; } 28 | set messagePattern(value: string) { 29 | if (typeof value !== 'string') value = '' + value; 30 | if (!value) throw "Error: Message cannot be empty."; 31 | this._messagePattern = value; 32 | this._checksum = getChecksum(this._messagePattern); 33 | } 34 | private _messagePattern: string; 35 | 36 | get translationPattern(): string { return this._translationPattern; } 37 | private _translationPattern: string; 38 | 39 | constructor(parent: IFlowScript, message: string, id?: string) { 40 | if (typeof id !== void 0 && typeof id !== null) 41 | this._id = typeof id != 'string' ? id : '' + id; 42 | this.messagePattern = message; 43 | if (parent) 44 | parent.registerMessage(this); 45 | } 46 | 47 | // -------------------------------------------------------------------------------------------------------------------- 48 | 49 | /** Return a formatted message, replacing any tokens ($#) with the supplied argument values. */ 50 | getMessage(...args: string[]): string { 51 | var pattern = this._translationPattern || this._messagePattern; 52 | var msgParts = pattern.split(/(\$\$|\$[0-9]+)/g); 53 | var tokens = pattern.match(/(\$\$|\$[0-9]+)/g); 54 | // (at this point the pattern is broken into msgParts[0]+tokens[0]+msgParts[1]+tokens[1]+...) 55 | var msg = msgParts.length ? msgParts[0] : ""; 56 | for (var i = 0, n = tokens.length; i < n; ++i) 57 | if (tokens[i] == "$$") // (double symbols escape to a single symbol to allow a single symbol tokenized place holder) 58 | msg += "$"; 59 | else 60 | msg += args[(tokens[i].substring(1) | 0)] + msgParts[i + 1]; 61 | return msg; 62 | } 63 | 64 | // -------------------------------------------------------------------------------------------------------------------- 65 | 66 | /** Sets a translated message pattern. This is a language translation which represents the underlying message text 67 | * pattern. It will act as an override when 'getMessage(...)' is called, and is reset by calling 'clearTranslation()'. */ 68 | setTranslation(translationPattern: string): void { 69 | this._translationPattern = translationPattern; 70 | } 71 | 72 | /** Clears the current translated message pattern. */ 73 | clearTranslation(): void { 74 | this._translationPattern = undefined; 75 | } 76 | 77 | // -------------------------------------------------------------------------------------------------------------------- 78 | 79 | toString() { return this.messagePattern; } 80 | valueOf() { return this.messagePattern; } 81 | 82 | // -------------------------------------------------------------------------------------------------------------------- 83 | } 84 | 85 | // ======================================================================================================================== 86 | } 87 | 88 | // ############################################################################################################################ 89 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/TreeView.ts: -------------------------------------------------------------------------------- 1 | namespace FlowScript.UI { 2 | // ======================================================================================================================== 3 | 4 | export interface ITreeViewItem extends HTMLElement { 5 | $__treeItem: TItem; 6 | } 7 | 8 | export interface ITreeViewGetRootItemHandler { (tv: TreeView): TItem } 9 | export interface ITreeViewRenderHandler { (tv: TreeView, item: TItem, parentContainer: HTMLElement): ITreeViewItem } 10 | //? export interface ITreeViewAddHandler { (tv: TreeView, value: string): void } 11 | export interface ITreeViewRenameHandler { (tv: TreeView, selectedOption: ITreeViewItem, newValue: string): void } 12 | export interface ITreeViewRemoveHandler { (tv: TreeView, selectedOption: ITreeViewItem): void } 13 | 14 | /** A base class for derived TreeView controls, such as 'TypeTreeView'. */ 15 | export class TreeView { 16 | 17 | get scriptEditor(): ScriptEditor { return this._scriptEditor; } 18 | _scriptEditor: ScriptEditor; 19 | 20 | rootItem: TItem; 21 | rootItemNode: ITreeViewItem; 22 | 23 | /** The current node that is selected. */ 24 | get selectedNode() { return this._selectedNode; } 25 | set selectedNode(value: ITreeViewItem) { 26 | if (this._selectedNode) { 27 | this._selectedNode.style.backgroundColor = ""; 28 | } 29 | this._prevSelectedNode = this._selectedNode; 30 | this._selectedNode = value; 31 | if (value) { 32 | value.style.backgroundColor = "#60FF5C"; 33 | } 34 | } 35 | private _selectedNode: ITreeViewItem = null; 36 | 37 | /** The previous node that was selected. */ 38 | get prevSelectedNode() { return this._prevSelectedNode; } 39 | private _prevSelectedNode: ITreeViewItem = null; 40 | 41 | /** The current underlying item represented by the selected node. */ 42 | get selectedItem(): TItem { return this.selectedNode ? this.selectedNode.$__treeItem : null; } 43 | 44 | source: TSource; 45 | 46 | public get view() { return this._view; } 47 | private _view: View; 48 | 49 | //onGetRootItemHandler: ITreeViewGetRootItemHandler; 50 | //onRenderHandler: ITreeViewRenderHandler; 51 | //onRenameHandler: ITreeViewRenameHandler; 52 | //onRemoveHandler: ITreeViewRemoveHandler; 53 | 54 | constructor(scriptEditor: ScriptEditor, view: View) { 55 | if (!scriptEditor) 56 | throw "'scriptEditor' is required.'"; 57 | if (!(scriptEditor instanceof ScriptEditor)) 58 | throw "'scriptEditor' is not a ScriptEditor type object.'"; 59 | 60 | this._scriptEditor = scriptEditor; 61 | 62 | this._view = view; 63 | } 64 | 65 | protected _onGetRootItemHandler(): TItem { 66 | throw "Not Implemented."; 67 | } 68 | 69 | protected _onRenderHandler(item: TItem, parentElement: HTMLElement): ITreeViewItem { 70 | throw "Not Implemented."; 71 | } 72 | 73 | setSource(source: TSource) { 74 | this.source = source; 75 | this.refresh(); 76 | } 77 | 78 | refresh() { 79 | this.rootItem = this._onGetRootItemHandler(); 80 | this._view.clear(); 81 | this.rootItemNode = >document.createElement("ul"); 82 | this._view.contentElement.appendChild(this.rootItemNode); 83 | this._onRenderHandler(this.rootItem, this.rootItemNode); 84 | if (!this._view.attached) 85 | this._view.show(); 86 | } 87 | 88 | private _locateItem(node: ITreeViewItem, item: TItem): ITreeViewItem { 89 | if (node.nodeName == 'SPAN' && node.$__treeItem == item) return node; 90 | // ... check child nodes ... 91 | var child = >node.firstChild; 92 | while (child) { 93 | var result = this._locateItem(child, item); 94 | if (result) return result; 95 | child = child.nextSibling; 96 | } 97 | return null; 98 | } 99 | 100 | selectItem(item: TItem): ITreeViewItem { 101 | if (!this.selectedNode || this.selectedNode.$__treeItem != item) 102 | this.selectedNode = this._locateItem(this.rootItemNode, item); 103 | this._scriptEditor.refreshComponentDetails(); 104 | return this.selectedNode; 105 | } 106 | } 107 | 108 | // ============================================================================================================================ 109 | } 110 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/old/System/Message.ts.txt: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | 3 | namespace FlowScript { 4 | // ======================================================================================================================== 5 | 6 | /** A text message, which can later have translations applied. 7 | * Messages can have token place holders, such as '$0 $1 $2 ...' (where '$0' is the first argument given - see 'getMessage()'). 8 | * When ready to translate an application's messages, you use the IDE to export a comma separated list of messages and their 9 | * checksum values for later match up. If in a very rare case there is a checksum collision, you just give the message a 10 | * fixed internal ID. Although some may wish to do this anyhow for clarity, using checksums allows focus on development 11 | * of message feedback, without the annoyance of update string tables. If a message will be used in multiple places, it's 12 | * a good idea to give a fixed ID. 13 | */ 14 | export class Message { 15 | // -------------------------------------------------------------------------------------------------------------------- 16 | private _parent: IFlowScript; 17 | 18 | /** By default, the ID of a message is it's checksum. If there are conflicts (very rare), then a unique ID value must be explicitly defined. */ 19 | get id(): string { return this._id || this._checksum.toString(); } 20 | private _id: string; 21 | 22 | /** A simple hash to identify the message. If conflicts occur (very rare), then a unique ID value must be explicitly defined. */ 23 | get checksum(): number { return this._checksum; } 24 | private _checksum: number = 0; 25 | 26 | /** The message pattern is a text message that may contain token place holders for formatting (i.e. "Warning: $1"). */ 27 | get messagePattern(): string { return this._messagePattern; } 28 | set messagePattern(value: string) { 29 | if (typeof value !== 'string') value = '' + value; 30 | if (!value) throw "Error: Message cannot be empty."; 31 | this._messagePattern = value; 32 | this._checksum = getChecksum(this._messagePattern); 33 | } 34 | private _messagePattern: string; 35 | 36 | get translationPattern(): string { return this._translationPattern; } 37 | private _translationPattern: string; 38 | 39 | constructor(parent: IFlowScript, message: string, id?: string) { 40 | if (typeof id !== void 0 && typeof id !== null) 41 | this._id = typeof id != 'string' ? id : '' + id; 42 | this.messagePattern = message; 43 | if (parent) 44 | parent.registerMessage(this); 45 | } 46 | 47 | // -------------------------------------------------------------------------------------------------------------------- 48 | 49 | /** Return a formatted message, replacing any tokens ($#) with the supplied argument values. */ 50 | getMessage(...args: string[]): string { 51 | var pattern = this._translationPattern || this._messagePattern; 52 | var msgParts = pattern.split(/(\$\$|\$[0-9]+)/g); 53 | var tokens = pattern.match(/(\$\$|\$[0-9]+)/g); 54 | // (at this point the pattern is broken into msgParts[0]+tokens[0]+msgParts[1]+tokens[1]+...) 55 | var msg = msgParts.length ? msgParts[0] : ""; 56 | for (var i = 0, n = tokens.length; i < n; ++i) 57 | if (tokens[i] == "$$") // (double symbols escape to a single symbol to allow a single symbol tokenized place holder) 58 | msg += "$"; 59 | else 60 | msg += args[(tokens[i].substring(1) | 0)] + msgParts[i + 1]; 61 | return msg; 62 | } 63 | 64 | // -------------------------------------------------------------------------------------------------------------------- 65 | 66 | /** Sets a translated message pattern. This is a language translation which represents the underlying message text 67 | * pattern. It will act as an override when 'getMessage(...)' is called, and is reset by calling 'clearTranslation()'. */ 68 | setTranslation(translationPattern: string): void { 69 | this._translationPattern = translationPattern; 70 | } 71 | 72 | /** Clears the current translated message pattern. */ 73 | clearTranslation(): void { 74 | this._translationPattern = undefined; 75 | } 76 | 77 | // -------------------------------------------------------------------------------------------------------------------- 78 | 79 | toString() { return this.messagePattern; } 80 | valueOf() { return this.messagePattern; } 81 | 82 | // -------------------------------------------------------------------------------------------------------------------- 83 | } 84 | 85 | // ======================================================================================================================== 86 | } 87 | 88 | // ############################################################################################################################ 89 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/old/System/Definitions/Core.ControlFlow.ts.txt: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | 3 | namespace FlowScript.Core.ControlFlow { 4 | // ======================================================================================================================== 5 | // Core Control Flow Components 6 | // ======================================================================================================================== 7 | 8 | /** Defines the Math namespace type. */ 9 | export class ControlFlow extends TypeDefinition { // (a type that is inferred by the given arguments) 10 | 11 | If = new If(this); 12 | IfElse = new IfElse(this); 13 | While = new While(this); 14 | DoWhile = new DoWhile(this); 15 | /** Iterates over a block of code, similar to a "for" loop. */ 16 | Loop = new Loop(this); 17 | 18 | constructor(parent: TypeDefinition) { 19 | super(parent, "ControlFlow"); 20 | } 21 | 22 | init() { 23 | super.init(); 24 | } 25 | } 26 | 27 | // ======================================================================================================================== 28 | 29 | /** Represents the "if" logical statement. 30 | */ 31 | export class If extends Component { 32 | constructor(parent: TypeDefinition) { 33 | super(parent, ComponentTypes.ControlFlow, "If", "if $condition then $block"); 34 | } 35 | 36 | init() { 37 | // Setup the expected parameters: 38 | 39 | var sys = this.script.System; 40 | 41 | this.defineParameter("condition", [sys.Boolean]); 42 | this.defineParameter("block", [sys.CodeBlock]); 43 | 44 | super.init(); 45 | } 46 | } 47 | 48 | // ======================================================================================================================== 49 | 50 | /** Represents the "if..else" logical statement. 51 | */ 52 | export class IfElse extends Component { 53 | constructor(parent: TypeDefinition) { 54 | super(parent, ComponentTypes.ControlFlow, "IfElse", "if $condition then $block1 else $block2"); 55 | } 56 | 57 | init() { 58 | // Setup the expected parameters: 59 | 60 | var sys = this.script.System; 61 | 62 | this.defineParameter("condition", [sys.Boolean]); 63 | this.defineParameter("block1", [sys.CodeBlock]); 64 | this.defineParameter("block2", [sys.CodeBlock]); 65 | 66 | super.init(); 67 | } 68 | } 69 | 70 | // ======================================================================================================================== 71 | 72 | /** Represents the "while..do" loop. 73 | */ 74 | export class While extends Component { 75 | constructor(parent: TypeDefinition) { 76 | super(parent, ComponentTypes.ControlFlow, "While", "while $condition do $block"); 77 | } 78 | 79 | init() { 80 | // Setup the expected parameters: 81 | 82 | var sys = this.script.System; 83 | 84 | this.defineParameter("condition", [sys.Boolean]); 85 | this.defineParameter("block", [sys.CodeBlock]); 86 | 87 | super.init(); 88 | } 89 | } 90 | 91 | // ======================================================================================================================== 92 | 93 | /** Represents the "do..while" loop. 94 | */ 95 | export class DoWhile extends Component { // TODO: Consider a do...while that also can execute update code before the body, and embeds the body in an "if" statement, and fixes to "while(true) until breakout". 96 | constructor(parent: TypeDefinition) { 97 | super(parent, ComponentTypes.ControlFlow, "DoWhile", "do $block while $condition"); 98 | } 99 | 100 | init() { 101 | // Setup the expected parameters: 102 | 103 | var sys = this.script.System; 104 | 105 | this.defineParameter("block", [sys.CodeBlock]); 106 | this.defineParameter("condition", [sys.Boolean]); 107 | 108 | super.init(); 109 | } 110 | } 111 | 112 | // ======================================================================================================================== 113 | 114 | /** Iterates over a block of code, similar to a "for" loop. 115 | */ 116 | export class Loop extends Component { 117 | constructor(parent: TypeDefinition) { 118 | super(parent, ComponentTypes.ControlFlow, "Loop", "for ($init; $condition; $update) $block"); 119 | } 120 | 121 | init() { 122 | // Setup the expected parameters: 123 | 124 | var sys = this.script.System; 125 | 126 | this.defineParameter("init", [sys.CodeBlock]); 127 | this.defineParameter("condition", [sys.Boolean]); 128 | this.defineParameter("block", [sys.CodeBlock]); 129 | this.defineParameter("update", [sys.CodeBlock]); 130 | 131 | super.init(); 132 | } 133 | } 134 | 135 | // ======================================================================================================================== 136 | } 137 | 138 | // ############################################################################################################################ 139 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/old/System/Projects.ts.txt: -------------------------------------------------------------------------------- 1 | namespace FlowScript { 2 | // ======================================================================================================================== 3 | 4 | export class Project { 5 | // -------------------------------------------------------------------------------------------------------------------- 6 | 7 | /** The script instance for this project. */ 8 | get script() { return this._script; } 9 | protected _script: IFlowScript; 10 | 11 | // -------------------------------------------------------------------------------------------------------------------- 12 | // Create a type of trash-bin to hold expressions so the user can restore them, or delete permanently. 13 | 14 | /** Holds a list of expressions the developer has removed from scripts. This renders to a global space, which allows 15 | * developers to move expressions easily between scripts. 16 | * Use 'addExpressionToBin()' and 'removeExpressionFromBin()' to modify this list, which also triggers the UI to update. 17 | */ 18 | get expressionBin() { return this._expressionBin; } 19 | private _expressionBin: Expression[] = []; 20 | onExpressionBinItemAdded = new EventDispatcher(this); 21 | onExpressionBinItemRemoved = new EventDispatcher(this); 22 | 23 | /** Returns the expression that was picked by the user for some operation. In the future this may also be used during drag-n-drop operations. */ 24 | get pickedExpression() { return this._pickedExpression; } 25 | private _pickedExpression: Expression; 26 | 27 | // -------------------------------------------------------------------------------------------------------------------- 28 | 29 | constructor( 30 | /** The title of the project. */ public title: string, 31 | /** The project's description. */ public description?: string 32 | ) { 33 | this._script = FlowScript.createNew(); 34 | } 35 | 36 | // -------------------------------------------------------------------------------------------------------------------- 37 | 38 | save(): string { 39 | return this.script.saveToStorage(this.title); 40 | } 41 | 42 | // -------------------------------------------------------------------------------------------------------------------- 43 | 44 | addToBin(expr: Expression, triggerEvent = true) { 45 | if (this._expressionBin.indexOf(expr) < 0) { 46 | this._expressionBin.push(expr); 47 | if (triggerEvent) 48 | this.onExpressionBinItemAdded.trigger(expr, this); 49 | } 50 | } 51 | 52 | removeFromBin(expr: Expression, triggerEvent = true) { 53 | var i = this._expressionBin.indexOf(expr); 54 | if (i >= 0) { 55 | var expr = this._expressionBin.splice(i, 1)[0]; 56 | if (triggerEvent) 57 | this.onExpressionBinItemRemoved.trigger(expr, this); 58 | } 59 | } 60 | 61 | isInBin(expr: Expression) { return this._expressionBin.indexOf(expr) >= 0; } 62 | 63 | // -------------------------------------------------------------------------------------------------------------------- 64 | 65 | private _findChildNode(node: HTMLElement, fstype: NamespaceObject): HTMLElement { //? 66 | if (node) { 67 | for (var i = 0, len = node.childNodes.length; i < len; ++i) 68 | if ((node.childNodes[i])["$__fs_type"] == fstype) 69 | return node.childNodes[i]; 70 | } 71 | else return null; 72 | } 73 | 74 | // -------------------------------------------------------------------------------------------------------------------- 75 | } 76 | 77 | // ======================================================================================================================== 78 | 79 | /** 80 | * Holds a collection of projects. 81 | */ 82 | export class Projects { 83 | get count() { return this._projects.length; } 84 | 85 | _projects: Project[] = []; 86 | 87 | /** 88 | * Creates a new project with the given title and description. 89 | * @param title The project title. 90 | * @param description The project description. 91 | */ 92 | createProject(title: string, description?: string): Project; 93 | /** 94 | * Creates a new project with the given title and description. 95 | * @param title The project title. 96 | * @param description The project description. 97 | * @param projectType An object of type 'Project' to use to create this project entry. 98 | */ 99 | createProject(title: string, description?: string, projectType?: { new(title: string, description?: string): T }): T; 100 | createProject(title: string, description?: string, projectType?: typeof Project): Project { 101 | var project = new (projectType || Project)(title, description); 102 | this._projects.push(project); 103 | return project; 104 | } 105 | } 106 | 107 | // ======================================================================================================================== 108 | } -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/System/components/Core.ControlFlow.ts: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | 3 | namespace FlowScript.Core.ControlFlow { 4 | // ======================================================================================================================== 5 | // Core Control Flow Components 6 | // ======================================================================================================================== 7 | 8 | /** Defines the Math namespace type. */ 9 | export class ControlFlow extends NamespaceObject { // (a type that is inferred by the given arguments) 10 | 11 | If = new If(this); 12 | IfElse = new IfElse(this); 13 | While = new While(this); 14 | DoWhile = new DoWhile(this); 15 | /** Iterates over a block of code, similar to a "for" loop. */ 16 | Loop = new Loop(this); 17 | 18 | constructor(parent: NamespaceObject) { 19 | super(parent, "ControlFlow"); 20 | } 21 | 22 | onInit() { 23 | super.onInit(); 24 | } 25 | } 26 | 27 | // ======================================================================================================================== 28 | 29 | /** Represents the "if" logical statement. 30 | */ 31 | export class If extends Component { 32 | constructor(parent: NamespaceObject) { 33 | super(parent, ComponentTypes.ControlFlow, "If", "if $condition then $block"); 34 | } 35 | 36 | onInit() { 37 | // Setup the expected parameters: 38 | 39 | var sys = this.script.System; 40 | 41 | this.defineParameter("condition", [sys.Boolean]); 42 | this.defineParameter("block", [sys.CodeBlock]); 43 | 44 | super.onInit(); 45 | } 46 | } 47 | 48 | // ======================================================================================================================== 49 | 50 | /** Represents the "if..else" logical statement. 51 | */ 52 | export class IfElse extends Component { 53 | constructor(parent: NamespaceObject) { 54 | super(parent, ComponentTypes.ControlFlow, "IfElse", "if $condition then $block1 else $block2"); 55 | } 56 | 57 | onInit() { 58 | // Setup the expected parameters: 59 | 60 | var sys = this.script.System; 61 | 62 | this.defineParameter("condition", [sys.Boolean]); 63 | this.defineParameter("block1", [sys.CodeBlock]); 64 | this.defineParameter("block2", [sys.CodeBlock]); 65 | 66 | super.onInit(); 67 | } 68 | } 69 | 70 | // ======================================================================================================================== 71 | 72 | /** Represents the "while..do" loop. 73 | */ 74 | export class While extends Component { 75 | constructor(parent: NamespaceObject) { 76 | super(parent, ComponentTypes.ControlFlow, "While", "while $condition do $block"); 77 | } 78 | 79 | onInit() { 80 | // Setup the expected parameters: 81 | 82 | var sys = this.script.System; 83 | 84 | this.defineParameter("condition", [sys.Boolean]); 85 | this.defineParameter("block", [sys.CodeBlock]); 86 | 87 | super.onInit(); 88 | } 89 | } 90 | 91 | // ======================================================================================================================== 92 | 93 | /** Represents the "do..while" loop. 94 | */ 95 | export class DoWhile extends Component { // TODO: Consider a do...while that also can execute update code before the body, and embeds the body in an "if" statement, and fixes to "while(true) until breakout". 96 | constructor(parent: NamespaceObject) { 97 | super(parent, ComponentTypes.ControlFlow, "DoWhile", "do $block while $condition"); 98 | } 99 | 100 | onInit() { 101 | // Setup the expected parameters: 102 | 103 | var sys = this.script.System; 104 | 105 | this.defineParameter("block", [sys.CodeBlock]); 106 | this.defineParameter("condition", [sys.Boolean]); 107 | 108 | super.onInit(); 109 | } 110 | } 111 | 112 | // ======================================================================================================================== 113 | 114 | /** Iterates over a block of code, similar to a "for" loop. 115 | */ 116 | export class Loop extends Component { 117 | constructor(parent: NamespaceObject) { 118 | super(parent, ComponentTypes.ControlFlow, "Loop", "for ($init; $condition; $update) $block"); 119 | } 120 | 121 | onInit() { 122 | // Setup the expected parameters: 123 | 124 | var sys = this.script.System; 125 | 126 | this.defineParameter("init", [sys.CodeBlock]); 127 | this.defineParameter("condition", [sys.Boolean]); 128 | this.defineParameter("block", [sys.CodeBlock]); 129 | this.defineParameter("update", [sys.CodeBlock]); 130 | 131 | super.onInit(); 132 | } 133 | } 134 | 135 | // ======================================================================================================================== 136 | } 137 | 138 | // ############################################################################################################################ 139 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/System/NamedReference.ts: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | 3 | namespace FlowScript { 4 | // ======================================================================================================================== 5 | 6 | export interface IReferencedObject { 7 | referenceStr: string; 8 | getReference(): NamedReference<{}>; 9 | } 10 | 11 | /** 12 | * References types in the type tree. This is used to track types, instead of pointers, since types can be deleted and 13 | * recreated, invalidating all references to the deleted type object. A named reference uses a dot-delimited root path 14 | * and target path to the referenced object. Only strings are accepted in order to allow saving references during 15 | * serialization. 16 | */ 17 | export class NamedReference { 18 | // private static _references: NamedReference[] = []; 19 | private _rootObj: object; 20 | root: string; 21 | path: string; 22 | 23 | private get _fullPath() { 24 | return this.root && this.path && this.root + "." + this.path || this.root || this.path; 25 | } 26 | 27 | get fullPath() { 28 | if (this._rootObj) 29 | throw "Cannot get the full path for reference '" + this + "' because the root object cannot be resolved from the global scope." 30 | + " This typically means you used 'fromInstance()' to create a reference, and thus an absolute path (from the global scope) cannot be determined."; 31 | return this._fullPath; 32 | } 33 | 34 | /** 35 | * Creates a new reference. 36 | * @param {string} path Dot-delimited identifiers that are the path to the value pointed to by this reference. 37 | * @param {string} root An optional dot-delimited identifiers that resolve to a root object used to resolve the path. 38 | * If not specified, the path is assume to be an absolute path. 39 | */ 40 | constructor(path: string, root?: string) { 41 | if (root) root = '' + root; 42 | if (path) path = '' + path; 43 | if (root && root.charAt) 44 | while (root.length && root.charAt(root.length - 1) == '.') root = path.substr(0, root.length - 1); 45 | if (path && path.charAt) 46 | while (path.length && path.charAt(0) == '.') path = path.substr(1); 47 | this.root = root; 48 | this.path = path; 49 | this.valueOf(); // (test it) 50 | } 51 | 52 | /** Creates a reference from a root object instance. Note that because a direct instance reference is made, the reference cannot be serialized (saved). 53 | * NEVER CALL THIS FUNCTION, except for very special cases. 54 | */ 55 | static fromInstance(rootObject: T, path: string): NamedReference { 56 | var ref = new NamedReference(path, null); 57 | ref._rootObj = rootObject; 58 | return ref; 59 | } 60 | 61 | /** Creates a reference to an object under a specific script. 62 | */ 63 | static fromScriptPath(script: IFlowScript, path: string): NamedReference { 64 | var ref = new NamedReference(path, rootName + ".$('" + script._id + "')"); 65 | return ref; 66 | } 67 | 68 | /** Returns the dot-delimited path represented by this reference. */ 69 | toString() { return this._fullPath; } 70 | valueOf(): T { 71 | try { 72 | var root = this._rootObj; 73 | if (!root && this.root) { 74 | root = eval(this.root); 75 | if (root === null || root === void 0) 76 | throw "Root path resolves to null or undefined."; 77 | } 78 | return root && (this.path ? eval("root." + this.path) : root) || eval(this.path); 79 | } 80 | catch (ex) { 81 | if (this._rootObj) 82 | throw "Failed to resolve path '" + this.path + "' from the root object '" + this._rootObj + "': " + ex; 83 | else 84 | throw "Failed to resolve path '" + this.path + "' from the root path '" + this.root + "': " + ex; 85 | } 86 | } 87 | 88 | /** Returns true if this reference represents a null/empty reference. */ 89 | get isNull(): boolean { return !this.root && !this.path; } 90 | 91 | ///** 92 | // * Checks if the give root + path is valid for this reference. 93 | // */ 94 | //? get isValid(): boolean { 95 | // if (!this.root || typeof this.root != OBJECT) return false; // (path is not valid by default with no root exists) 96 | // if (!this.path) return true; // (an empty path is valid, as it references the root object) 97 | // var names = this.path.split(','); 98 | // var o = this.root; 99 | // for (var i = 0, n = names.length; i < n; ++i) { 100 | // if (typeof o != OBJECT) return false; // (cannot get a property name of a non-object) 101 | // var name = names[i]; 102 | // if (name in o) 103 | // o = o[name]; 104 | // else 105 | // return false; 106 | // } 107 | // return true; 108 | //} 109 | } 110 | 111 | // ======================================================================================================================== 112 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | **/Server/*.d.ts 25 | **/Server/*.js.map 26 | **/wwwroot/js/*.js.map 27 | **/wwwroot/js/*.d.ts 28 | **/wwwroot/js/*.js 29 | node-modules/ 30 | monaco-editor/ 31 | **/libs/V8.NET/ 32 | *.git 33 | 34 | # Visual Studio 2015 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # MSTest test Results 40 | [Tt]est[Rr]esult*/ 41 | [Bb]uild[Ll]og.* 42 | 43 | # NUNIT 44 | *.VisualState.xml 45 | TestResult.xml 46 | 47 | # Build Results of an ATL Project 48 | [Dd]ebugPS/ 49 | [Rr]eleasePS/ 50 | dlldata.c 51 | 52 | # DNX 53 | project.lock.json 54 | project.fragment.lock.json 55 | artifacts/ 56 | 57 | *_i.c 58 | *_p.c 59 | *_i.h 60 | *.ilk 61 | *.meta 62 | *.obj 63 | *.pch 64 | *.pdb 65 | *.pgc 66 | *.pgd 67 | *.rsp 68 | *.sbr 69 | *.tlb 70 | *.tli 71 | *.tlh 72 | *.tmp 73 | *.tmp_proj 74 | *.log 75 | *.vspscc 76 | *.vssscc 77 | .builds 78 | *.pidb 79 | *.svclog 80 | *.scc 81 | 82 | # Chutzpah Test files 83 | _Chutzpah* 84 | 85 | # Visual C++ cache files 86 | ipch/ 87 | *.aps 88 | *.ncb 89 | *.opendb 90 | *.opensdf 91 | *.sdf 92 | *.cachefile 93 | *.VC.db 94 | *.VC.VC.opendb 95 | 96 | # Visual Studio profiler 97 | *.psess 98 | *.vsp 99 | *.vspx 100 | *.sap 101 | 102 | # TFS 2012 Local Workspace 103 | $tf/ 104 | 105 | # Guidance Automation Toolkit 106 | *.gpState 107 | 108 | # ReSharper is a .NET coding add-in 109 | _ReSharper*/ 110 | *.[Rr]e[Ss]harper 111 | *.DotSettings.user 112 | 113 | # JustCode is a .NET coding add-in 114 | .JustCode 115 | 116 | # TeamCity is a build add-in 117 | _TeamCity* 118 | 119 | # DotCover is a Code Coverage Tool 120 | *.dotCover 121 | 122 | # NCrunch 123 | _NCrunch_* 124 | .*crunch*.local.xml 125 | nCrunchTemp_* 126 | 127 | # MightyMoose 128 | *.mm.* 129 | AutoTest.Net/ 130 | 131 | # Web workbench (sass) 132 | .sass-cache/ 133 | 134 | # Installshield output folder 135 | [Ee]xpress/ 136 | 137 | # DocProject is a documentation generator add-in 138 | DocProject/buildhelp/ 139 | DocProject/Help/*.HxT 140 | DocProject/Help/*.HxC 141 | DocProject/Help/*.hhc 142 | DocProject/Help/*.hhk 143 | DocProject/Help/*.hhp 144 | DocProject/Help/Html2 145 | DocProject/Help/html 146 | 147 | # Click-Once directory 148 | publish/ 149 | 150 | # Publish Web Output 151 | *.[Pp]ublish.xml 152 | *.azurePubxml 153 | # TODO: Comment the next line if you want to checkin your web deploy settings 154 | # but database connection strings (with potential passwords) will be unencrypted 155 | #*.pubxml 156 | *.publishproj 157 | 158 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 159 | # checkin your Azure Web App publish settings, but sensitive information contained 160 | # in these scripts will be unencrypted 161 | PublishScripts/ 162 | 163 | # NuGet Packages 164 | *.nupkg 165 | # The packages folder can be ignored because of Package Restore 166 | **/packages/* 167 | # except build/, which is used as an MSBuild target. 168 | !**/packages/build/ 169 | # Uncomment if necessary however generally it will be regenerated when needed 170 | #!**/packages/repositories.config 171 | # NuGet v3's project.json files produces more ignoreable files 172 | *.nuget.props 173 | *.nuget.targets 174 | 175 | # Microsoft Azure Build Output 176 | csx/ 177 | *.build.csdef 178 | 179 | # Microsoft Azure Emulator 180 | ecf/ 181 | rcf/ 182 | 183 | # Windows Store app package directories and files 184 | AppPackages/ 185 | BundleArtifacts/ 186 | Package.StoreAssociation.xml 187 | _pkginfo.txt 188 | 189 | # Visual Studio cache files 190 | # files ending in .cache can be ignored 191 | *.[Cc]ache 192 | # but keep track of directories ending in .cache 193 | !*.[Cc]ache/ 194 | 195 | # Others 196 | ClientBin/ 197 | ~$* 198 | *~ 199 | *.dbmdl 200 | *.dbproj.schemaview 201 | *.jfm 202 | *.pfx 203 | *.publishsettings 204 | node_modules/ 205 | orleans.codegen.cs 206 | 207 | # Since there are multiple workflows, uncomment next line to ignore bower_components 208 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 209 | #bower_components/ 210 | 211 | # RIA/Silverlight projects 212 | Generated_Code/ 213 | 214 | # Backup & report files from converting an old project file 215 | # to a newer Visual Studio version. Backup files are not needed, 216 | # because we have git ;-) 217 | _UpgradeReport_Files/ 218 | Backup*/ 219 | UpgradeLog*.XML 220 | UpgradeLog*.htm 221 | 222 | # SQL Server files 223 | *.mdf 224 | *.ldf 225 | 226 | # Business Intelligence projects 227 | *.rdl.data 228 | *.bim.layout 229 | *.bim_*.settings 230 | 231 | # Microsoft Fakes 232 | FakesAssemblies/ 233 | 234 | # GhostDoc plugin setting file 235 | *.GhostDoc.xml 236 | 237 | # Node.js Tools for Visual Studio 238 | .ntvs_analysis.dat 239 | 240 | # Visual Studio 6 build log 241 | *.plg 242 | 243 | # Visual Studio 6 workspace options file 244 | *.opt 245 | 246 | # Visual Studio LightSwitch build output 247 | **/*.HTMLClient/GeneratedArtifacts 248 | **/*.DesktopClient/GeneratedArtifacts 249 | **/*.DesktopClient/ModelManifest.xml 250 | **/*.Server/GeneratedArtifacts 251 | **/*.Server/ModelManifest.xml 252 | _Pvt_Extensions 253 | 254 | # Paket dependency manager 255 | .paket/paket.exe 256 | paket-files/ 257 | 258 | # FAKE - F# Make 259 | .fake/ 260 | 261 | # JetBrains Rider 262 | .idea/ 263 | *.sln.iml 264 | 265 | # CodeRush 266 | .cr/ 267 | 268 | # Python Tools for Visual Studio (PTVS) 269 | __pycache__/ 270 | *.pyc -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/old/System/Message.js: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | var FlowScript; 3 | (function (FlowScript) { 4 | // ======================================================================================================================== 5 | /** A text message, which can later have translations applied. 6 | * Messages can have token place holders, such as '$0 $1 $2 ...' (where '$0' is the first argument given - see 'getMessage()'). 7 | * When ready to translate an application's messages, you use the IDE to export a comma separated list of messages and their 8 | * checksum values for later match up. If in a very rare case there is a checksum collision, you just give the message a 9 | * fixed internal ID. Although some may wish to do this anyhow for clarity, using checksums allows focus on development 10 | * of message feedback, without the annoyance of update string tables. If a message will be used in multiple places, it's 11 | * a good idea to give a fixed ID. 12 | */ 13 | var Message = /** @class */ (function () { 14 | function Message(parent, message, id) { 15 | this._checksum = 0; 16 | if (typeof id !== void 0 && typeof id !== null) 17 | this._id = typeof id != 'string' ? id : '' + id; 18 | this.messagePattern = message; 19 | if (parent) 20 | parent.registerMessage(this); 21 | } 22 | Object.defineProperty(Message.prototype, "id", { 23 | /** By default, the ID of a message is it's checksum. If there are conflicts (very rare), then a unique ID value must be explicitly defined. */ 24 | get: function () { return this._id || this._checksum.toString(); }, 25 | enumerable: true, 26 | configurable: true 27 | }); 28 | Object.defineProperty(Message.prototype, "checksum", { 29 | /** A simple hash to identify the message. If conflicts occur (very rare), then a unique ID value must be explicitly defined. */ 30 | get: function () { return this._checksum; }, 31 | enumerable: true, 32 | configurable: true 33 | }); 34 | Object.defineProperty(Message.prototype, "messagePattern", { 35 | /** The message pattern is a text message that may contain token place holders for formatting (i.e. "Warning: $1"). */ 36 | get: function () { return this._messagePattern; }, 37 | set: function (value) { 38 | if (typeof value !== 'string') 39 | value = '' + value; 40 | if (!value) 41 | throw "Error: Message cannot be empty."; 42 | this._messagePattern = value; 43 | this._checksum = FlowScript.getChecksum(this._messagePattern); 44 | }, 45 | enumerable: true, 46 | configurable: true 47 | }); 48 | Object.defineProperty(Message.prototype, "translationPattern", { 49 | get: function () { return this._translationPattern; }, 50 | enumerable: true, 51 | configurable: true 52 | }); 53 | // -------------------------------------------------------------------------------------------------------------------- 54 | /** Return a formatted message, replacing any tokens ($#) with the supplied argument values. */ 55 | Message.prototype.getMessage = function () { 56 | var args = []; 57 | for (var _i = 0; _i < arguments.length; _i++) { 58 | args[_i] = arguments[_i]; 59 | } 60 | var pattern = this._translationPattern || this._messagePattern; 61 | var msgParts = pattern.split(/(\$\$|\$[0-9]+)/g); 62 | var tokens = pattern.match(/(\$\$|\$[0-9]+)/g); 63 | // (at this point the pattern is broken into msgParts[0]+tokens[0]+msgParts[1]+tokens[1]+...) 64 | var msg = msgParts.length ? msgParts[0] : ""; 65 | for (var i = 0, n = tokens.length; i < n; ++i) 66 | if (tokens[i] == "$$") // (double symbols escape to a single symbol to allow a single symbol tokenized place holder) 67 | msg += "$"; 68 | else 69 | msg += args[(tokens[i].substring(1) | 0)] + msgParts[i + 1]; 70 | return msg; 71 | }; 72 | // -------------------------------------------------------------------------------------------------------------------- 73 | /** Sets a translated message pattern. This is a language translation which represents the underlying message text 74 | * pattern. It will act as an override when 'getMessage(...)' is called, and is reset by calling 'clearTranslation()'. */ 75 | Message.prototype.setTranslation = function (translationPattern) { 76 | this._translationPattern = translationPattern; 77 | }; 78 | /** Clears the current translated message pattern. */ 79 | Message.prototype.clearTranslation = function () { 80 | this._translationPattern = FlowScript.undefined; 81 | }; 82 | // -------------------------------------------------------------------------------------------------------------------- 83 | Message.prototype.toString = function () { return this.messagePattern; }; 84 | Message.prototype.valueOf = function () { return this.messagePattern; }; 85 | return Message; 86 | }()); 87 | FlowScript.Message = Message; 88 | // ======================================================================================================================== 89 | })(FlowScript || (FlowScript = {})); 90 | // ############################################################################################################################ 91 | //# sourceMappingURL=message.js.map -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/Client/old/System/Definitions/Core.Math.ts.txt: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | 3 | namespace FlowScript.Core.Math { 4 | // ======================================================================================================================== 5 | // Core Math Components 6 | // ======================================================================================================================== 7 | 8 | /** Defines the Math namespace type. */ 9 | export class Math extends TypeDefinition { // (a type that is inferred by the given arguments) 10 | 11 | /** Add numerical values, or concatenate strings. */ 12 | Add = new Add(this); 13 | 14 | /** Multiple two numerical values. */ 15 | Multiply = new Multiply(this); 16 | 17 | SQRT = new SQRT(this); 18 | 19 | constructor(parent: TypeDefinition) { 20 | super(parent, "Math"); 21 | } 22 | 23 | init() { 24 | super.init(); 25 | } 26 | } 27 | 28 | // ======================================================================================================================== 29 | 30 | /** Adds two values. 31 | */ 32 | export class Add extends Operator { 33 | constructor(parent: TypeDefinition) { 34 | super(parent, "Add", "$a + $b"); // (#|$) + (#|$) 35 | } 36 | 37 | init() { 38 | var sys = this.script.System; 39 | 40 | this.addTypeMap(sys.Integer, sys.Boolean, sys.Boolean); 41 | this.addTypeMap(sys.Currency, sys.Boolean, sys.Currency); 42 | this.addTypeMap(sys.DateTime, sys.Boolean, sys.DateTime); 43 | this.addTypeMap(sys.Double, sys.Boolean, sys.Double); 44 | this.addTypeMap(sys.Integer, sys.Boolean, sys.Integer); 45 | 46 | this.addTypeMap(sys.Currency, sys.Currency, sys.Boolean); 47 | this.addTypeMap(sys.Currency, sys.Currency, sys.Currency); 48 | this.addTypeMap(sys.Currency, sys.Currency, sys.Double); 49 | this.addTypeMap(sys.Currency, sys.Currency, sys.Integer); 50 | 51 | this.addTypeMap(sys.DateTime, sys.DateTime, sys.Boolean); 52 | this.addTypeMap(sys.DateTime, sys.DateTime, sys.DateTime); 53 | this.addTypeMap(sys.DateTime, sys.DateTime, sys.Double); 54 | this.addTypeMap(sys.DateTime, sys.DateTime, sys.Integer); 55 | 56 | this.addTypeMap(sys.Integer, sys.Double, sys.Boolean); 57 | this.addTypeMap(sys.Currency, sys.Double, sys.Currency); 58 | this.addTypeMap(sys.DateTime, sys.Double, sys.DateTime); 59 | this.addTypeMap(sys.Double, sys.Double, sys.Double); 60 | this.addTypeMap(sys.Double, sys.Double, sys.Integer); 61 | 62 | this.addTypeMap(sys.Integer, sys.Integer, sys.Boolean); 63 | this.addTypeMap(sys.Currency, sys.Integer, sys.Currency); 64 | this.addTypeMap(sys.DateTime, sys.Integer, sys.DateTime); 65 | this.addTypeMap(sys.Double, sys.Integer, sys.Double); 66 | this.addTypeMap(sys.Integer, sys.Integer, sys.Integer); 67 | 68 | this.addTypeMap(sys.String, sys.String, TypeDefinition.All); 69 | this.addTypeMap(sys.String, TypeDefinition.All, sys.String); 70 | 71 | this.addTypeMap(sys.Any, sys.Any, TypeDefinition.All); 72 | this.addTypeMap(sys.Any, TypeDefinition.All, sys.Any); 73 | 74 | // Setup the expected parameters and return type: 75 | 76 | this.defineParameter("a", [sys.Any]); 77 | this.defineParameter("b", [sys.Any]); 78 | 79 | this.defineDefaultReturnVar(TypeDefinition.Inferred); // ("inferred" means to invoke the type map to determine the resulting type base on supplied arguments) 80 | 81 | super.init(); 82 | } 83 | } 84 | 85 | // ======================================================================================================================== 86 | 87 | /** Multiply two values. 88 | */ 89 | export class Multiply extends Operator { 90 | constructor(parent: TypeDefinition) { 91 | super(parent, "Multiply", "$a * $b"); // (#|$) * (#|$) 92 | } 93 | 94 | init() { 95 | // Setup the expected parameters and return type: 96 | 97 | var sys = this.script.System; 98 | 99 | this.defineParameter("a", [sys.Double, sys.Integer]); 100 | this.defineParameter("b", [sys.Double, sys.Integer]); 101 | 102 | this.defineDefaultReturnVar(TypeDefinition.Inferred); // ("inferred" means to invoke the type map to determine the resulting type base on supplied arguments) 103 | 104 | super.init(); 105 | } 106 | } 107 | 108 | // ======================================================================================================================== 109 | 110 | /** get the square root of a value. 111 | */ 112 | export class SQRT extends Component { 113 | constructor(parent: TypeDefinition) { 114 | super(parent, ComponentTypes.Unary, "SQRT", "√$a"); 115 | } 116 | 117 | init() { 118 | // Setup the expected parameters and return type: 119 | 120 | var sys = this.script.System; 121 | 122 | this.defineParameter("a", [sys.Double, sys.Integer]); 123 | 124 | this.defineDefaultReturnVar(sys.Double); 125 | 126 | super.init(); 127 | } 128 | } 129 | 130 | // ======================================================================================================================== 131 | } 132 | 133 | // ############################################################################################################################ 134 | -------------------------------------------------------------------------------- /src/FlowScript/TypeScript/System/components/Core.Math.ts: -------------------------------------------------------------------------------- 1 | // ############################################################################################################################ 2 | 3 | namespace FlowScript.Core.Math { 4 | // ======================================================================================================================== 5 | // Core Math Components 6 | // ======================================================================================================================== 7 | 8 | /** Defines the Math namespace type. */ 9 | export class Math extends NamespaceObject { // (a type that is inferred by the given arguments) 10 | 11 | /** Add numerical values, or concatenate strings. */ 12 | Add = new Add(this); 13 | 14 | /** Multiple two numerical values. */ 15 | Multiply = new Multiply(this); 16 | 17 | SQRT = new SQRT(this); 18 | 19 | constructor(parent: NamespaceObject) { 20 | super(parent, "Math"); 21 | } 22 | 23 | onInit() { 24 | super.onInit(); 25 | } 26 | } 27 | 28 | // ======================================================================================================================== 29 | 30 | /** Adds two values. 31 | */ 32 | export class Add extends Operator { 33 | constructor(parent: NamespaceObject) { 34 | super(parent, "Add", "$a + $b"); // (#|$) + (#|$) 35 | } 36 | 37 | onInit() { 38 | var sys = this.script.System; 39 | 40 | this.addTypeMap(sys.Integer, sys.Boolean, sys.Boolean); 41 | this.addTypeMap(sys.Currency, sys.Boolean, sys.Currency); 42 | this.addTypeMap(sys.DateTime, sys.Boolean, sys.DateTime); 43 | this.addTypeMap(sys.Double, sys.Boolean, sys.Double); 44 | this.addTypeMap(sys.Integer, sys.Boolean, sys.Integer); 45 | 46 | this.addTypeMap(sys.Currency, sys.Currency, sys.Boolean); 47 | this.addTypeMap(sys.Currency, sys.Currency, sys.Currency); 48 | this.addTypeMap(sys.Currency, sys.Currency, sys.Double); 49 | this.addTypeMap(sys.Currency, sys.Currency, sys.Integer); 50 | 51 | this.addTypeMap(sys.DateTime, sys.DateTime, sys.Boolean); 52 | this.addTypeMap(sys.DateTime, sys.DateTime, sys.DateTime); 53 | this.addTypeMap(sys.DateTime, sys.DateTime, sys.Double); 54 | this.addTypeMap(sys.DateTime, sys.DateTime, sys.Integer); 55 | 56 | this.addTypeMap(sys.Integer, sys.Double, sys.Boolean); 57 | this.addTypeMap(sys.Currency, sys.Double, sys.Currency); 58 | this.addTypeMap(sys.DateTime, sys.Double, sys.DateTime); 59 | this.addTypeMap(sys.Double, sys.Double, sys.Double); 60 | this.addTypeMap(sys.Double, sys.Double, sys.Integer); 61 | 62 | this.addTypeMap(sys.Integer, sys.Integer, sys.Boolean); 63 | this.addTypeMap(sys.Currency, sys.Integer, sys.Currency); 64 | this.addTypeMap(sys.DateTime, sys.Integer, sys.DateTime); 65 | this.addTypeMap(sys.Double, sys.Integer, sys.Double); 66 | this.addTypeMap(sys.Integer, sys.Integer, sys.Integer); 67 | 68 | this.addTypeMap(sys.String, sys.String, NamespaceObject.All); 69 | this.addTypeMap(sys.String, NamespaceObject.All, sys.String); 70 | 71 | this.addTypeMap(sys.Any, sys.Any, NamespaceObject.All); 72 | this.addTypeMap(sys.Any, NamespaceObject.All, sys.Any); 73 | 74 | // Setup the expected parameters and return type: 75 | 76 | this.defineParameter("a", [sys.Any]); 77 | this.defineParameter("b", [sys.Any]); 78 | 79 | this.defineDefaultReturnVar(NamespaceObject.Inferred); // ("inferred" means to invoke the type map to determine the resulting type base on supplied arguments) 80 | 81 | super.onInit(); 82 | } 83 | } 84 | 85 | // ======================================================================================================================== 86 | 87 | /** Multiply two values. 88 | */ 89 | export class Multiply extends Operator { 90 | constructor(parent: NamespaceObject) { 91 | super(parent, "Multiply", "$a * $b"); // (#|$) * (#|$) 92 | } 93 | 94 | onInit() { 95 | // Setup the expected parameters and return type: 96 | 97 | var sys = this.script.System; 98 | 99 | this.defineParameter("a", [sys.Double, sys.Integer]); 100 | this.defineParameter("b", [sys.Double, sys.Integer]); 101 | 102 | this.defineDefaultReturnVar(NamespaceObject.Inferred); // ("inferred" means to invoke the type map to determine the resulting type base on supplied arguments) 103 | 104 | super.onInit(); 105 | } 106 | } 107 | 108 | // ======================================================================================================================== 109 | 110 | /** get the square root of a value. 111 | */ 112 | export class SQRT extends Component { 113 | constructor(parent: NamespaceObject) { 114 | super(parent, ComponentTypes.Unary, "SQRT", "√$a"); 115 | } 116 | 117 | onInit() { 118 | // Setup the expected parameters and return type: 119 | 120 | var sys = this.script.System; 121 | 122 | this.defineParameter("a", [sys.Double, sys.Integer]); 123 | 124 | this.defineDefaultReturnVar(sys.Double); 125 | 126 | super.onInit(); 127 | } 128 | } 129 | 130 | // ======================================================================================================================== 131 | } 132 | 133 | // ############################################################################################################################ 134 | -------------------------------------------------------------------------------- /src/FlowScript/FlowScript.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FlowScript 5 | 6 | 7 | 8 | A controller for handling files. 9 | 10 | 11 | 12 | Returns a list of files and directories in the root. 13 | An enumerator that allows foreach to be used to process the matched items. 14 | 15 | 16 | Returns a list of files and directories in the root based on a pattern. 17 | The pattern to get. 18 | An enumerator that allows foreach to be used to process the matched items. 19 | 20 | 21 | Returns a list of files and directories in the root based on a sub-path and pattern. 22 | Full pathname of the file. 23 | The pattern to get. 24 | An enumerator that allows foreach to be used to process the matched items. 25 | 26 | 27 | A controller for handling projects. 28 | 29 | 30 | 31 | Holds information about a project in the 'Projects' folder. 32 | 33 | 34 | This is a GUID assigned to the project when it gets created. 35 | 36 | 37 | A based class for all responses. 38 | 39 | 40 | A message, usually when there's an error. 41 | 42 | 43 | Gets a server by name. 44 | The name. 45 | The server. 46 | 47 | 48 | Gets a server by index. See to get the number of servers being managed. 49 | The name. 50 | The server. 51 | 52 | 53 | 54 | Creates a server by the given name. If a server already exists it is returned. If a name is not specific then a 55 | GUID is created. 56 | 57 | The name. 58 | The new server. 59 | 60 | 61 | Executes the given file by path and name. 62 | 63 | Path and filename of the file. If a relative path is given, it is relative to the content root. 64 | 65 | A JSServer. 66 | 67 | 68 | Returns the Chakra JavaScript wrapper integration. 69 | 70 | 71 | Creates a new Chakra context. 72 | The name. 73 | The new context. 74 | 75 | 76 | Executes the given file by path and name. 77 | 78 | Path and filename of the file. If a relative path is given, it is relative to the content root. 79 | 80 | 81 | 82 | Returns the V8.NET JavaScript wrapper integration. 83 | 84 | 85 | Creates a new VroomJS context. 86 | The name. 87 | The new context. 88 | 89 | 90 | Executes the given file by path and name. 91 | 92 | Path and filename of the file. If a relative path is given, it is relative to the content root. 93 | 94 | A JSServer. 95 | 96 | 97 | Returns the VroomJS JavaScript wrapper integration. 98 | 99 | 100 | Creates a new VroomJS context. 101 | The name. 102 | The new context. 103 | 104 | 105 | 106 | --------------------------------------------------------------------------------