From 7d871ff9cfd6f5ebb866738c797e0860d05894f4 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Sat, 30 May 2020 00:40:33 +0100 Subject: [PATCH] separate workflow components from routify routes --- .../workflow/SetupPanel/DeleteWorkflowModal.svelte | 0 .../SetupPanel/ParamInputs/ComponentParam.svelte | 0 .../workflow/SetupPanel/ParamInputs/ModelParam.svelte | 0 .../SetupPanel/ParamInputs/NumberParam.svelte | 0 .../SetupPanel/ParamInputs/StringParam.svelte | 0 .../workflow/SetupPanel/SetupPanel.svelte | 0 .../workflow/SetupPanel/WorkflowBlockSetup.svelte | 0 .../workflow/SetupPanel/index.js | 0 .../workflow/WorkflowBuilder/WorkflowBuilder.svelte | 0 .../WorkflowBuilder/svelte-flows/Arrow.svelte | 0 .../WorkflowBuilder/svelte-flows/FlowChart.svelte | 0 .../WorkflowBuilder/svelte-flows/FlowItem.svelte | 0 .../workflow/WorkflowBuilder/svelte-flows/api.js | 0 .../workflow/WorkflowBuilder/svelte-flows/index.js | 0 .../workflow/WorkflowPanel/BlockList/BlockList.svelte | 0 .../WorkflowPanel/BlockList/WorkflowBlock.svelte | 0 .../WorkflowList/CreateWorkflowModal.svelte | 0 .../WorkflowPanel/WorkflowList/WorkflowList.svelte | 0 .../workflow/WorkflowPanel/WorkflowPanel.svelte | 0 .../workflow/WorkflowPanel/blockDefinitions.js | 0 .../workflow/WorkflowPanel/index.js | 0 packages/builder/src/components/workflow/index.js | 3 +++ .../src/pages/[application]/workflow/_layout.svelte | 3 +-- .../src/pages/[application]/workflow/index.svelte | 2 +- packages/client/src/render/attachChildren.js | 4 +--- packages/client/src/state/bbComponentApi.js | 11 +++-------- packages/client/src/state/stateManager.js | 8 ++------ 27 files changed, 11 insertions(+), 20 deletions(-) rename packages/builder/src/{pages/[application] => components}/workflow/SetupPanel/DeleteWorkflowModal.svelte (100%) rename packages/builder/src/{pages/[application] => components}/workflow/SetupPanel/ParamInputs/ComponentParam.svelte (100%) rename packages/builder/src/{pages/[application] => components}/workflow/SetupPanel/ParamInputs/ModelParam.svelte (100%) rename packages/builder/src/{pages/[application] => components}/workflow/SetupPanel/ParamInputs/NumberParam.svelte (100%) rename packages/builder/src/{pages/[application] => components}/workflow/SetupPanel/ParamInputs/StringParam.svelte (100%) rename packages/builder/src/{pages/[application] => components}/workflow/SetupPanel/SetupPanel.svelte (100%) rename packages/builder/src/{pages/[application] => components}/workflow/SetupPanel/WorkflowBlockSetup.svelte (100%) rename packages/builder/src/{pages/[application] => components}/workflow/SetupPanel/index.js (100%) rename packages/builder/src/{pages/[application] => components}/workflow/WorkflowBuilder/WorkflowBuilder.svelte (100%) rename packages/builder/src/{pages/[application] => components}/workflow/WorkflowBuilder/svelte-flows/Arrow.svelte (100%) rename packages/builder/src/{pages/[application] => components}/workflow/WorkflowBuilder/svelte-flows/FlowChart.svelte (100%) rename packages/builder/src/{pages/[application] => components}/workflow/WorkflowBuilder/svelte-flows/FlowItem.svelte (100%) rename packages/builder/src/{pages/[application] => components}/workflow/WorkflowBuilder/svelte-flows/api.js (100%) rename packages/builder/src/{pages/[application] => components}/workflow/WorkflowBuilder/svelte-flows/index.js (100%) rename packages/builder/src/{pages/[application] => components}/workflow/WorkflowPanel/BlockList/BlockList.svelte (100%) rename packages/builder/src/{pages/[application] => components}/workflow/WorkflowPanel/BlockList/WorkflowBlock.svelte (100%) rename packages/builder/src/{pages/[application] => components}/workflow/WorkflowPanel/WorkflowList/CreateWorkflowModal.svelte (100%) rename packages/builder/src/{pages/[application] => components}/workflow/WorkflowPanel/WorkflowList/WorkflowList.svelte (100%) rename packages/builder/src/{pages/[application] => components}/workflow/WorkflowPanel/WorkflowPanel.svelte (100%) rename packages/builder/src/{pages/[application] => components}/workflow/WorkflowPanel/blockDefinitions.js (100%) rename packages/builder/src/{pages/[application] => components}/workflow/WorkflowPanel/index.js (100%) create mode 100644 packages/builder/src/components/workflow/index.js diff --git a/packages/builder/src/pages/[application]/workflow/SetupPanel/DeleteWorkflowModal.svelte b/packages/builder/src/components/workflow/SetupPanel/DeleteWorkflowModal.svelte similarity index 100% rename from packages/builder/src/pages/[application]/workflow/SetupPanel/DeleteWorkflowModal.svelte rename to packages/builder/src/components/workflow/SetupPanel/DeleteWorkflowModal.svelte diff --git a/packages/builder/src/pages/[application]/workflow/SetupPanel/ParamInputs/ComponentParam.svelte b/packages/builder/src/components/workflow/SetupPanel/ParamInputs/ComponentParam.svelte similarity index 100% rename from packages/builder/src/pages/[application]/workflow/SetupPanel/ParamInputs/ComponentParam.svelte rename to packages/builder/src/components/workflow/SetupPanel/ParamInputs/ComponentParam.svelte diff --git a/packages/builder/src/pages/[application]/workflow/SetupPanel/ParamInputs/ModelParam.svelte b/packages/builder/src/components/workflow/SetupPanel/ParamInputs/ModelParam.svelte similarity index 100% rename from packages/builder/src/pages/[application]/workflow/SetupPanel/ParamInputs/ModelParam.svelte rename to packages/builder/src/components/workflow/SetupPanel/ParamInputs/ModelParam.svelte diff --git a/packages/builder/src/pages/[application]/workflow/SetupPanel/ParamInputs/NumberParam.svelte b/packages/builder/src/components/workflow/SetupPanel/ParamInputs/NumberParam.svelte similarity index 100% rename from packages/builder/src/pages/[application]/workflow/SetupPanel/ParamInputs/NumberParam.svelte rename to packages/builder/src/components/workflow/SetupPanel/ParamInputs/NumberParam.svelte diff --git a/packages/builder/src/pages/[application]/workflow/SetupPanel/ParamInputs/StringParam.svelte b/packages/builder/src/components/workflow/SetupPanel/ParamInputs/StringParam.svelte similarity index 100% rename from packages/builder/src/pages/[application]/workflow/SetupPanel/ParamInputs/StringParam.svelte rename to packages/builder/src/components/workflow/SetupPanel/ParamInputs/StringParam.svelte diff --git a/packages/builder/src/pages/[application]/workflow/SetupPanel/SetupPanel.svelte b/packages/builder/src/components/workflow/SetupPanel/SetupPanel.svelte similarity index 100% rename from packages/builder/src/pages/[application]/workflow/SetupPanel/SetupPanel.svelte rename to packages/builder/src/components/workflow/SetupPanel/SetupPanel.svelte diff --git a/packages/builder/src/pages/[application]/workflow/SetupPanel/WorkflowBlockSetup.svelte b/packages/builder/src/components/workflow/SetupPanel/WorkflowBlockSetup.svelte similarity index 100% rename from packages/builder/src/pages/[application]/workflow/SetupPanel/WorkflowBlockSetup.svelte rename to packages/builder/src/components/workflow/SetupPanel/WorkflowBlockSetup.svelte diff --git a/packages/builder/src/pages/[application]/workflow/SetupPanel/index.js b/packages/builder/src/components/workflow/SetupPanel/index.js similarity index 100% rename from packages/builder/src/pages/[application]/workflow/SetupPanel/index.js rename to packages/builder/src/components/workflow/SetupPanel/index.js diff --git a/packages/builder/src/pages/[application]/workflow/WorkflowBuilder/WorkflowBuilder.svelte b/packages/builder/src/components/workflow/WorkflowBuilder/WorkflowBuilder.svelte similarity index 100% rename from packages/builder/src/pages/[application]/workflow/WorkflowBuilder/WorkflowBuilder.svelte rename to packages/builder/src/components/workflow/WorkflowBuilder/WorkflowBuilder.svelte diff --git a/packages/builder/src/pages/[application]/workflow/WorkflowBuilder/svelte-flows/Arrow.svelte b/packages/builder/src/components/workflow/WorkflowBuilder/svelte-flows/Arrow.svelte similarity index 100% rename from packages/builder/src/pages/[application]/workflow/WorkflowBuilder/svelte-flows/Arrow.svelte rename to packages/builder/src/components/workflow/WorkflowBuilder/svelte-flows/Arrow.svelte diff --git a/packages/builder/src/pages/[application]/workflow/WorkflowBuilder/svelte-flows/FlowChart.svelte b/packages/builder/src/components/workflow/WorkflowBuilder/svelte-flows/FlowChart.svelte similarity index 100% rename from packages/builder/src/pages/[application]/workflow/WorkflowBuilder/svelte-flows/FlowChart.svelte rename to packages/builder/src/components/workflow/WorkflowBuilder/svelte-flows/FlowChart.svelte diff --git a/packages/builder/src/pages/[application]/workflow/WorkflowBuilder/svelte-flows/FlowItem.svelte b/packages/builder/src/components/workflow/WorkflowBuilder/svelte-flows/FlowItem.svelte similarity index 100% rename from packages/builder/src/pages/[application]/workflow/WorkflowBuilder/svelte-flows/FlowItem.svelte rename to packages/builder/src/components/workflow/WorkflowBuilder/svelte-flows/FlowItem.svelte diff --git a/packages/builder/src/pages/[application]/workflow/WorkflowBuilder/svelte-flows/api.js b/packages/builder/src/components/workflow/WorkflowBuilder/svelte-flows/api.js similarity index 100% rename from packages/builder/src/pages/[application]/workflow/WorkflowBuilder/svelte-flows/api.js rename to packages/builder/src/components/workflow/WorkflowBuilder/svelte-flows/api.js diff --git a/packages/builder/src/pages/[application]/workflow/WorkflowBuilder/svelte-flows/index.js b/packages/builder/src/components/workflow/WorkflowBuilder/svelte-flows/index.js similarity index 100% rename from packages/builder/src/pages/[application]/workflow/WorkflowBuilder/svelte-flows/index.js rename to packages/builder/src/components/workflow/WorkflowBuilder/svelte-flows/index.js diff --git a/packages/builder/src/pages/[application]/workflow/WorkflowPanel/BlockList/BlockList.svelte b/packages/builder/src/components/workflow/WorkflowPanel/BlockList/BlockList.svelte similarity index 100% rename from packages/builder/src/pages/[application]/workflow/WorkflowPanel/BlockList/BlockList.svelte rename to packages/builder/src/components/workflow/WorkflowPanel/BlockList/BlockList.svelte diff --git a/packages/builder/src/pages/[application]/workflow/WorkflowPanel/BlockList/WorkflowBlock.svelte b/packages/builder/src/components/workflow/WorkflowPanel/BlockList/WorkflowBlock.svelte similarity index 100% rename from packages/builder/src/pages/[application]/workflow/WorkflowPanel/BlockList/WorkflowBlock.svelte rename to packages/builder/src/components/workflow/WorkflowPanel/BlockList/WorkflowBlock.svelte diff --git a/packages/builder/src/pages/[application]/workflow/WorkflowPanel/WorkflowList/CreateWorkflowModal.svelte b/packages/builder/src/components/workflow/WorkflowPanel/WorkflowList/CreateWorkflowModal.svelte similarity index 100% rename from packages/builder/src/pages/[application]/workflow/WorkflowPanel/WorkflowList/CreateWorkflowModal.svelte rename to packages/builder/src/components/workflow/WorkflowPanel/WorkflowList/CreateWorkflowModal.svelte diff --git a/packages/builder/src/pages/[application]/workflow/WorkflowPanel/WorkflowList/WorkflowList.svelte b/packages/builder/src/components/workflow/WorkflowPanel/WorkflowList/WorkflowList.svelte similarity index 100% rename from packages/builder/src/pages/[application]/workflow/WorkflowPanel/WorkflowList/WorkflowList.svelte rename to packages/builder/src/components/workflow/WorkflowPanel/WorkflowList/WorkflowList.svelte diff --git a/packages/builder/src/pages/[application]/workflow/WorkflowPanel/WorkflowPanel.svelte b/packages/builder/src/components/workflow/WorkflowPanel/WorkflowPanel.svelte similarity index 100% rename from packages/builder/src/pages/[application]/workflow/WorkflowPanel/WorkflowPanel.svelte rename to packages/builder/src/components/workflow/WorkflowPanel/WorkflowPanel.svelte diff --git a/packages/builder/src/pages/[application]/workflow/WorkflowPanel/blockDefinitions.js b/packages/builder/src/components/workflow/WorkflowPanel/blockDefinitions.js similarity index 100% rename from packages/builder/src/pages/[application]/workflow/WorkflowPanel/blockDefinitions.js rename to packages/builder/src/components/workflow/WorkflowPanel/blockDefinitions.js diff --git a/packages/builder/src/pages/[application]/workflow/WorkflowPanel/index.js b/packages/builder/src/components/workflow/WorkflowPanel/index.js similarity index 100% rename from packages/builder/src/pages/[application]/workflow/WorkflowPanel/index.js rename to packages/builder/src/components/workflow/WorkflowPanel/index.js diff --git a/packages/builder/src/components/workflow/index.js b/packages/builder/src/components/workflow/index.js new file mode 100644 index 0000000000..2b3d68b5b7 --- /dev/null +++ b/packages/builder/src/components/workflow/index.js @@ -0,0 +1,3 @@ +export { default as WorkflowBuilder } from "./WorkflowBuilder/WorkflowBuilder.svelte"; +export { default as SetupPanel } from "./SetupPanel/SetupPanel.svelte"; +export { default as WorkflowPanel } from "./WorkflowPanel/WorkflowPanel.svelte"; diff --git a/packages/builder/src/pages/[application]/workflow/_layout.svelte b/packages/builder/src/pages/[application]/workflow/_layout.svelte index 6a1a5dcb53..acaf2350ee 100644 --- a/packages/builder/src/pages/[application]/workflow/_layout.svelte +++ b/packages/builder/src/pages/[application]/workflow/_layout.svelte @@ -1,7 +1,6 @@
diff --git a/packages/builder/src/pages/[application]/workflow/index.svelte b/packages/builder/src/pages/[application]/workflow/index.svelte index 88f65b0b18..781e492a0f 100644 --- a/packages/builder/src/pages/[application]/workflow/index.svelte +++ b/packages/builder/src/pages/[application]/workflow/index.svelte @@ -1,5 +1,5 @@ diff --git a/packages/client/src/render/attachChildren.js b/packages/client/src/render/attachChildren.js index 9e0659be82..89ee0cfe4a 100644 --- a/packages/client/src/render/attachChildren.js +++ b/packages/client/src/render/attachChildren.js @@ -9,7 +9,6 @@ export const attachChildren = initialiseOpts => (htmlElement, options) => { treeNode, onScreenSlotRendered, setupState, - getCurrentState, } = initialiseOpts const anchor = options && options.anchor ? options.anchor : null @@ -43,8 +42,7 @@ export const attachChildren = initialiseOpts => (htmlElement, options) => { parentNode: treeNode, ComponentConstructor, htmlElement, - anchor, - getCurrentState, + anchor }) for (let childNode of childNodesThisIteration) { diff --git a/packages/client/src/state/bbComponentApi.js b/packages/client/src/state/bbComponentApi.js index 30925f14df..71235756b3 100644 --- a/packages/client/src/state/bbComponentApi.js +++ b/packages/client/src/state/bbComponentApi.js @@ -1,7 +1,5 @@ -// import { getStateOrValue } from "./getState" -import { setState, setStateFromBinding } from "./setState" -import { trimSlash } from "../common/trimSlash" -import { isBound } from "./parseBinding" +import { setState } from "./setState" +// import { isBound } from "./parseBinding" import { attachChildren } from "../render/attachChildren" import { getContext, setContext } from "./getSetContext" @@ -9,7 +7,6 @@ export const trimSlash = str => str.replace(/^\/+|\/+$/g, "") export const bbFactory = ({ store, - getCurrentState, frontendDefinition, componentLibraries, onScreenSlotRendered, @@ -54,8 +51,7 @@ export const bbFactory = ({ componentLibraries, treeNode, onScreenSlotRendered, - setupState, - getCurrentState, + setupState } return { @@ -69,7 +65,6 @@ export const bbFactory = ({ store: store, relativeUrl, api, - isBound, parent, } } diff --git a/packages/client/src/state/stateManager.js b/packages/client/src/state/stateManager.js index 2ecf882962..c299c51b07 100644 --- a/packages/client/src/state/stateManager.js +++ b/packages/client/src/state/stateManager.js @@ -4,14 +4,10 @@ import { EVENT_TYPE_MEMBER_NAME, } from "./eventHandlers" import { bbFactory } from "./bbComponentApi" -import { createTreeNode } from "../render/prepareRenderComponent" -import { getState } from "./getState" -import { attachChildren } from "../render/attachChildren" import mustache from "mustache" +import { get } from "svelte/store"; import { appStore } from "./store"; -import { parseBinding } from "./parseBinding" - const doNothing = () => {} doNothing.isPlaceholder = true @@ -175,7 +171,7 @@ const _setup = ({ const context = node.context || {} const initialProps = { ...props } // const storeBoundProps = [] - const currentStoreState = getCurrentState() + const currentStoreState = get(appStore) console.log("node", node);