From 338a488ec7b018e821130b1eac4ec5c5007e4007 Mon Sep 17 00:00:00 2001 From: Martin Karkowski Date: Tue, 5 Jul 2022 08:32:11 +0200 Subject: [PATCH] updating to version 1.2.1 --- CHANGELOG.md | 9 +++++ contribute/VERSION | 2 +- lib/types/ui/editor/INodes.ts | 10 +++-- .../{IEditPage.ts => IServiceEditPage.ts} | 4 +- lib/types/ui/editor/index.ts | 2 +- lib/types/ui/editor/render.callbacks.ts | 8 ++-- lib/types/ui/helpers.interface.ts | 38 +++++++++++++++++++ lib/types/ui/layout.interface.ts | 11 ++---- lib/types/ui/render.callbacks.ts | 14 +++++-- package-lock.json | 4 +- package.json | 2 +- 11 files changed, 78 insertions(+), 26 deletions(-) rename lib/types/ui/editor/{IEditPage.ts => IServiceEditPage.ts} (91%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90a7f28..a003481 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -132,3 +132,12 @@ Inital commit, which is working with the browser - `lib/types/index`: Exporting `ui` elements - Fixes: - `types/nope/nopeInstanceManager.interface`: Fixing Type of createInstance. Now the Type `I` extends `INopeModule` instead of being set to `IGenericNopeModule` + +# 1.2.1 +- Added: + - `types/ui/helpers.interface`: Added the ui section in `IRenderData`. This contains the following props: `fullscreen` (INopeObservable) to controll the fullscreen / ge the state. Additionally the functions `openFullscreen`, `closeFullScreen` and `getTheme` have been added. Added type `IUiTheme` +- Modified: + - Renamed `IEditPage` to `IServiceEditPage` + - Renamed `NODE_TYPE_COMPOSED` to `NODE_TYPE_GROUP` + - Adapted `TRenderConfigureServicePage`, `TRenderInstancePage` and `TInstanceManagerPage` by adding `Extension`-Type + - Adapted `TRenderFunction` removing the args setting. \ No newline at end of file diff --git a/contribute/VERSION b/contribute/VERSION index 867e524..cb174d5 100644 --- a/contribute/VERSION +++ b/contribute/VERSION @@ -1 +1 @@ -1.2.0 \ No newline at end of file +1.2.1 \ No newline at end of file diff --git a/lib/types/ui/editor/INodes.ts b/lib/types/ui/editor/INodes.ts index aaa8cdd..56c3435 100644 --- a/lib/types/ui/editor/INodes.ts +++ b/lib/types/ui/editor/INodes.ts @@ -22,7 +22,7 @@ export type VALID_PORTS = | PORT_PRODUCE_TOKEN | PORT_REQUIRE_TOKEN; -export type NODE_TYPE_COMPOSED = "node:composed"; +export type NODE_TYPE_GROUP = "node:group"; export type NODE_TYPE_CONSTANT = "data:constant"; export type NODE_TYPE_DATA_TO_TOKEN = "logic:data-to-token"; export type NODE_TYPE_FLOW_OPERATION = "logic:flow"; @@ -32,7 +32,7 @@ export type NODE_TYPE_TRANSITION = "logic:transition"; export type NODE_TYPE_VAR = "data:constant"; export type VALID_NODES = - | NODE_TYPE_COMPOSED + | NODE_TYPE_GROUP | NODE_TYPE_CONSTANT | NODE_TYPE_DATA_TO_TOKEN | NODE_TYPE_FLOW_OPERATION @@ -62,7 +62,7 @@ export const VALID_PORTS: Array = [ PORT_REQUIRE_TOKEN, ]; -export const NODE_TYPE_COMPOSED: NODE_TYPE_COMPOSED = "node:composed"; +export const NODE_TYPE_GROUP: NODE_TYPE_GROUP = "node:group"; export const NODE_TYPE_CONSTANT: NODE_TYPE_CONSTANT = "data:constant"; export const NODE_TYPE_DATA_TO_TOKEN: NODE_TYPE_DATA_TO_TOKEN = "logic:data-to-token"; @@ -74,7 +74,7 @@ export const NODE_TYPE_TRANSITION: NODE_TYPE_TRANSITION = "logic:transition"; export const NODE_TYPE_VAR: NODE_TYPE_VAR = "data:constant"; export const VALID_NODES: Array = [ - NODE_TYPE_COMPOSED, + NODE_TYPE_GROUP, NODE_TYPE_CONSTANT, NODE_TYPE_DATA_TO_TOKEN, NODE_TYPE_FLOW_OPERATION, @@ -96,6 +96,8 @@ export interface IBaseNode { width: number; height: number; }; + group?: number | string; + isGroup?: boolean; } export interface IPort { diff --git a/lib/types/ui/editor/IEditPage.ts b/lib/types/ui/editor/IServiceEditPage.ts similarity index 91% rename from lib/types/ui/editor/IEditPage.ts rename to lib/types/ui/editor/IServiceEditPage.ts index 43b1d6e..efc5db1 100644 --- a/lib/types/ui/editor/IEditPage.ts +++ b/lib/types/ui/editor/IServiceEditPage.ts @@ -6,7 +6,7 @@ import { TRenderFunctionResult } from "../layout.interface"; import { IPort } from "./INodes"; -export interface IEditPage extends TRenderFunctionResult { +export interface IServiceEditPage extends TRenderFunctionResult { /** * Function, which must return the current service-data. * @@ -14,7 +14,7 @@ export interface IEditPage extends TRenderFunctionResult { * @return {boolean} * @memberof IEditPage */ - getData(): any; + getData(): T; /** * Function which must return true, if the Entered- diff --git a/lib/types/ui/editor/index.ts b/lib/types/ui/editor/index.ts index 2280971..48c8d77 100644 --- a/lib/types/ui/editor/index.ts +++ b/lib/types/ui/editor/index.ts @@ -5,7 +5,7 @@ */ export * from "./IEdges"; -export * from "./IEditPage"; +export * from "./IServiceEditPage"; export * from "./IEdges"; // export * from "./INetwork"; export * from "./INodes"; diff --git a/lib/types/ui/editor/render.callbacks.ts b/lib/types/ui/editor/render.callbacks.ts index b2b7095..bd565df 100644 --- a/lib/types/ui/editor/render.callbacks.ts +++ b/lib/types/ui/editor/render.callbacks.ts @@ -4,13 +4,13 @@ */ import { IRenderData } from "../helpers.interface"; -import { IEditPage } from "./IEditPage"; +import { IServiceEditPage } from "./IServiceEditPage"; import { PN } from "./INodes"; /** Helper to configurate a service */ -export type TRenderConfigureServicePage = ( +export type TRenderConfigureServicePage = ( div: HTMLDivElement, options: IRenderData & { input: T; - } -) => IEditPage; + } & Extension +) => IServiceEditPage; diff --git a/lib/types/ui/helpers.interface.ts b/lib/types/ui/helpers.interface.ts index 139dc12..5d4d211 100644 --- a/lib/types/ui/helpers.interface.ts +++ b/lib/types/ui/helpers.interface.ts @@ -142,6 +142,25 @@ export type TcreateLayoutOptions = { colors?: any; }; +export type IUiTheme = { + colors: { + primary: string; + secondary: string; + success: string; + info: string; + warning: string; + danger: string; + light: string; + dark: string; + }; + font: { + size: number; + type: string; + color: string; + computedFont: string; + }; +}; + /** Helper for the provided data: */ export interface IRenderData { helpers: { @@ -400,6 +419,25 @@ export interface IRenderData { }): void; }; }; + ui: { + /** + * Contains a Flag to toggle the ui into fullscreen or not. + */ + readonly fullscreen: INopeObservable; + /** + * Function, used to set the system to Fullscreen + */ + openFullscreen(): void; + /** + * Function, used to close the fullscreen. + */ + closeFullscreen(): void; + + /** + * Returns a defintion of the currently used colors. + */ + getTheme(): IUiTheme; + }; }; logger: ILogger; dispatcher: INopeDispatcher; diff --git a/lib/types/ui/layout.interface.ts b/lib/types/ui/layout.interface.ts index 6619521..152913e 100644 --- a/lib/types/ui/layout.interface.ts +++ b/lib/types/ui/layout.interface.ts @@ -944,16 +944,14 @@ export type TRenderFunctionResult = { export type TRenderFunction< I, O extends TRenderFunctionResult = TRenderFunctionResult, - D extends IMinProvidedDataSet = IMinProvidedDataSet, - A = any + D extends IMinProvidedDataSet = IMinProvidedDataSet > = ( - div: HTMLElement, + div: HTMLDivElement, options: { input: I; setVisibilityOfPanel: (value: boolean) => void; layout: IBasicLayoutComponent; - }, - args: A + } ) => O; /** @@ -1092,13 +1090,12 @@ export interface IBasicLayoutComponent< */ openDynamicW2UiPanel< I = any, - A = any, O extends TRenderFunctionResult = TRenderFunctionResult >(options: { /** Input which is fowarded to the render Function "render" */ input?: I; /** Callback which will be called to create the element */ - render: TRenderFunction; + render: TRenderFunction; /** Appends the Panel or replaces it. */ append?: boolean; /** Show the Panel on creating */ diff --git a/lib/types/ui/render.callbacks.ts b/lib/types/ui/render.callbacks.ts index 66d92a8..2c1a418 100644 --- a/lib/types/ui/render.callbacks.ts +++ b/lib/types/ui/render.callbacks.ts @@ -15,18 +15,24 @@ import { IRenderData } from "./helpers.interface"; import { TRenderFunctionResult } from "./layout.interface"; /** Helper used, to render the instance details */ -export type TRenderInstancePage = ( +export type TRenderInstancePage< + T extends INopeModule = INopeModule, + Extension = {} +> = ( /** The DIV Element */ div: HTMLDivElement, /** The Provided Options used by the function to create the ui */ options: IRenderData & { /** The Instance to Render. */ input: T & IGenericNopeModule; - } + } & Extension ) => TRenderFunctionResult; /** UI to define an instance. */ -export type TInstanceManagerPage = ( +export type TInstanceManagerPage< + T extends INopeModule = INopeModule, + Extension = {} +> = ( /** The DIV Element */ div: HTMLDivElement, /** The Provided Options used by the function to create the ui */ @@ -42,5 +48,5 @@ export type TInstanceManagerPage = ( } ) => Promise; instances: Array; - } + } & Extension ) => void; diff --git a/package-lock.json b/package-lock.json index 3cc9946..f1a5383 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "nope", - "version": "1.1.1", + "version": "1.2.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "nope", - "version": "1.1.1", + "version": "1.2.0", "license": "MIT", "dependencies": { "argparse": "^2.0.1", diff --git a/package.json b/package.json index e254c12..73f847b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nope", - "version": "1.2.0", + "version": "1.2.1", "description": "NoPE Runtime for Nodejs. For Browser-Support please use nope-browser", "files": [ "dist-nodejs/**/*",