Skip to content

Commit

Permalink
general cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewJSchoen committed May 31, 2022
1 parent 86acf1e commit 6add077
Show file tree
Hide file tree
Showing 16 changed files with 52 additions and 54 deletions.
8 changes: 5 additions & 3 deletions dist/components/Block/VisualBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,17 @@ var VisualBlock = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
align: "center",
direction: "row",
gap: "xsmall"
}, /*#__PURE__*/_react.default.createElement(Icon, Object.assign({}, stopPropArgs, {
}, /*#__PURE__*/_react.default.createElement("div", Object.assign({}, stopPropArgs, {
style: {
backgroundColor: "#22222299",
color: "white",
padding: 9,
borderRadius: 5,
boxShadow: "0 0 0 1px #222222"
boxShadow: "0 0 0 1px #222222",
height: 17,
width: 17
}
})), /*#__PURE__*/_react.default.createElement(_grommet.Box, {
}), /*#__PURE__*/_react.default.createElement(Icon, null)), /*#__PURE__*/_react.default.createElement(_grommet.Box, {
flex: true
}, /*#__PURE__*/_react.default.createElement(_Utility.Input, {
className: canDragBlockRFR ? null : "nodrag",
Expand Down
2 changes: 1 addition & 1 deletion dist/components/Canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ var Canvas = function Canvas(_ref2) {
return {
canvasNode: CanvasNode
};
}, [CanvasNode]),
}, []),
nodes: nodes,
onConnect: function onConnect(_) {},
onNodesChange: moveNodes,
Expand Down
20 changes: 8 additions & 12 deletions dist/components/defaultStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,14 @@ function deleteFromChildren(state, idsToDelete, parentData) {
parentData.properties[propName].forEach(function (child) {
state = deleteFromChildren(state, idsToDelete, state.programData[child]);
});

var _loop = function _loop(_i) {
(0, _lodash.remove)(state.programData[parentData.id].properties[propName], function (field) {
idsToDelete.forEach(function (idToDelete) {
var newList = state.programData[parentData.id].properties[propName].filter(function (field) {
var _state$programData$fi;

return ((_state$programData$fi = state.programData[field]) === null || _state$programData$fi === void 0 ? void 0 : _state$programData$fi.ref) === idsToDelete[_i];
return ((_state$programData$fi = state.programData[field]) === null || _state$programData$fi === void 0 ? void 0 : _state$programData$fi.ref) !== idToDelete;
});
};

for (var _i = 0; _i < idsToDelete.length; _i++) {
_loop(_i);
}
state.programData[parentData.id].properties[propName] = newList;
});
} else if (property && parentData.properties[propName] && idsToDelete.includes((_state$programData$pa2 = state.programData[parentData.properties[propName]]) === null || _state$programData$pa2 === void 0 ? void 0 : _state$programData$pa2.ref)) {
// Delete Reference to Child
delete state.programData[parentData.properties[propName]]; // entry.properties[propName] = null;
Expand Down Expand Up @@ -178,7 +174,7 @@ function deleteSelfBlock(state, data, parentId, fieldInfo) {

if (property && (property.type || property.type === _.TYPES.OBJECT)) {// Ignore SIMPLE types.
} else if (property && property.isList) {
var _loop2 = function _loop2(i) {
var _loop = function _loop(i) {
var _entry$properties$pro;

if ((_entry$properties$pro = entry.properties[propName]) !== null && _entry$properties$pro !== void 0 && _entry$properties$pro.includes(callIds[i])) {
Expand All @@ -190,7 +186,7 @@ function deleteSelfBlock(state, data, parentId, fieldInfo) {

// Iterate through property list and remove all applicable references
for (var i = 0; i < callIds.length; i++) {
_loop2(i);
_loop(i);
}
} else if (property && entry.properties[propName]) {
// Delete reference from property
Expand Down Expand Up @@ -339,7 +335,7 @@ var ProgrammingSlice = function ProgrammingSlice(set, get) {
moveBlocks: function moveBlocks(changes) {
return set(function (state) {
changes.forEach(function (change) {
if (change.type === "position" && state.programData[change.id]) {
if (change.type === "position" && state.programData[change.id] && change.position) {
state.programData[change.id].position = change.position;
}
});
Expand Down
12 changes: 6 additions & 6 deletions dist/stories/SOBORO.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ var Template = function Template(args) {
})));
};

var STATE_EXPRESSIONS = ['notStateExprType', 'allStateExprType', 'anyStateExprType'];
var EVENT_EXPRESSIONS = [];
var RETURNS_EVENT = [];
var RETURNS_STATE = ['stateType'].concat(STATE_EXPRESSIONS);
var RETURNS_ACTION = [];
var RETURNS_CONTROLLER = [];
var STATE_EXPRESSIONS = ['notStateExprType', 'allStateExprType', 'anyStateExprType']; // const EVENT_EXPRESSIONS = [];
// const RETURNS_EVENT = [];

var RETURNS_STATE = ['stateType'].concat(STATE_EXPRESSIONS); // const RETURNS_ACTION = [];
// const RETURNS_CONTROLLER = [];

var SOBORO = Template.bind({}); // More on args: https://storybook.js.org/docs/react/writing-stories/args

exports.SOBORO = SOBORO;
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -361,4 +361,4 @@



window['STORIES'] = [{"titlePrefix":"","directory":"./src","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(js|jsx|ts|tsx))$"}];</script><script src="runtime~main.e7cc04ef.iframe.bundle.js"></script><script src="239.398b31f1.iframe.bundle.js"></script><script src="main.8f25b57e.iframe.bundle.js"></script></body></html>
window['STORIES'] = [{"titlePrefix":"","directory":"./src","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./src","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(js|jsx|ts|tsx))$"}];</script><script src="runtime~main.e7cc04ef.iframe.bundle.js"></script><script src="395.d54509b7.iframe.bundle.js"></script><script src="main.1f773daa.iframe.bundle.js"></script></body></html>

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/project.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"generatedAt":1653494219665,"builder":{"name":"webpack5"},"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":false,"hasStorybookEslint":false,"refCount":0,"metaFramework":{"name":"CRA","packageName":"react-scripts","version":"5.0.0"},"packageManager":{"type":"yarn","version":"1.22.18"},"storybookVersion":"^6.5.0-beta.5","language":"javascript","storybookPackages":{"@storybook/addon-actions":{"version":"6.5.0-beta.8"},"@storybook/builder-webpack5":{"version":"6.5.0-beta.8"},"@storybook/manager-webpack5":{"version":"6.5.0-beta.8"},"@storybook/node-logger":{"version":"6.5.0-beta.8"},"@storybook/react":{"version":"6.5.0-beta.8"}},"framework":{"name":"react"},"addons":{"@storybook/addon-links":{"version":"6.5.0-beta.8"},"@storybook/addon-essentials":{"version":"6.5.0-beta.8"},"@storybook/preset-create-react-app":{"version":"4.1.0"}}}
{"generatedAt":1654025405150,"builder":{"name":"webpack5"},"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":false,"hasStorybookEslint":false,"refCount":0,"metaFramework":{"name":"CRA","packageName":"react-scripts","version":"5.0.0"},"packageManager":{"type":"yarn","version":"1.22.18"},"storybookVersion":"^6.5.0-beta.5","language":"javascript","storybookPackages":{"@storybook/addon-actions":{"version":"6.5.0-beta.8"},"@storybook/builder-webpack5":{"version":"6.5.0-beta.8"},"@storybook/manager-webpack5":{"version":"6.5.0-beta.8"},"@storybook/node-logger":{"version":"6.5.0-beta.8"},"@storybook/react":{"version":"6.5.0-beta.8"}},"framework":{"name":"react"},"addons":{"@storybook/addon-links":{"version":"6.5.0-beta.8"},"@storybook/addon-essentials":{"version":"6.5.0-beta.8"},"@storybook/preset-create-react-app":{"version":"4.1.0"}}}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple-vp",
"version": "0.4.4",
"version": "0.4.5",
"main": "dist/index.js",
"private": false,
"files": [
Expand Down Expand Up @@ -43,7 +43,7 @@
"react-dnd-html5-backend": "^14.1.0",
"react-dnd-multi-backend": "^7.0.0-alpha.4",
"react-dom": "^18.1.0",
"react-flow-renderer": "^10.3.0",
"react-flow-renderer": "^10.3.4",
"react-icons": "^4.3.1",
"react-scripts": "5.0.0",
"react-spring": "^9.4.2",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Block/DropRegion.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {memo} from 'react';
import React from 'react';
import { useProgrammingStore } from "../ProgrammingContext";
import { useDrop } from "react-dnd";
import { Block, PreviewBlock } from "./index";
Expand Down
13 changes: 8 additions & 5 deletions src/components/Block/VisualBlock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { List } from "./List";
import { forwardRef } from "react";
import { DATA_TYPES, TYPES, SIMPLE_PROPERTY_TYPES } from "../Constants";
import { FiCheck, FiSquare } from "react-icons/fi";
import { TextInput, Box, Button, Text, RadioButtonGroup } from "grommet";
import { Box, Button, Text, RadioButtonGroup } from "grommet";
import { useProgrammingStore } from "../ProgrammingContext";
import { ExtraBar, RightClickMenu } from "./ExtraBar";
import { Selectable } from "./Selectable";
Expand Down Expand Up @@ -162,16 +162,19 @@ export const VisualBlock = memo(
{/* The header, includes the name/text field and the extra bar */}
{!minified && (
<Box flex align="center" direction="row" gap="xsmall">
<Icon
{...stopPropArgs}
<div {...stopPropArgs}
style={{
backgroundColor: "#22222299",
color: "white",
padding: 9,
borderRadius: 5,
boxShadow: `0 0 0 1px #222222`,
}}
/>
height: 17,
width: 17
}}>
<Icon/>
</div>


<Box flex>
<Input
Expand Down
4 changes: 2 additions & 2 deletions src/components/Canvas.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {memo} from 'react';
import React from 'react';
import ReactFlow, {
MiniMap,
Controls,
Expand Down Expand Up @@ -94,7 +94,7 @@ export const Canvas = ({ highlightColor, snapToGrid }) => {
// panOnDrag={!locked}
nodesConnectable={false}
elementsSelectable={false}
nodeTypes={useMemo(() => ({ canvasNode: CanvasNode }), [CanvasNode])}
nodeTypes={useMemo(() => ({ canvasNode: CanvasNode }),[])}
nodes={nodes}
onConnect={(_) => { }}
onNodesChange={moveNodes}
Expand Down
13 changes: 5 additions & 8 deletions src/components/defaultStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,10 @@ export function deleteFromChildren(state, idsToDelete, parentData) {
state.programData[child]
);
});

for (let i = 0; i < idsToDelete.length; i++) {
remove(
state.programData[parentData.id].properties[propName],
(field) => state.programData[field]?.ref === idsToDelete[i]
);
}
idsToDelete.forEach(idToDelete=>{
const newList = state.programData[parentData.id].properties[propName].filter((field) => state.programData[field]?.ref !== idToDelete)
state.programData[parentData.id].properties[propName] = newList
})
} else if (
property &&
parentData.properties[propName] &&
Expand Down Expand Up @@ -389,7 +386,7 @@ export const ProgrammingSlice = (set, get) => ({
moveBlocks: (changes) =>
set((state) => {
changes.forEach((change) => {
if (change.type === "position" && state.programData[change.id]) {
if (change.type === "position" && state.programData[change.id] && change.position) {
state.programData[change.id].position = change.position;
}
});
Expand Down
8 changes: 4 additions & 4 deletions src/stories/SOBORO.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ const Template = (args) => {
};

const STATE_EXPRESSIONS = ['notStateExprType','allStateExprType','anyStateExprType'];
const EVENT_EXPRESSIONS = [];
const RETURNS_EVENT = [];
// const EVENT_EXPRESSIONS = [];
// const RETURNS_EVENT = [];
const RETURNS_STATE = ['stateType',...STATE_EXPRESSIONS];
const RETURNS_ACTION = [];
const RETURNS_CONTROLLER = [];
// const RETURNS_ACTION = [];
// const RETURNS_CONTROLLER = [];

export const SOBORO = Template.bind({});
// More on args: https://storybook.js.org/docs/react/writing-stories/args
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6070,7 +6070,7 @@ css-loader@^5.0.1:
schema-utils "^3.0.0"
semver "^7.3.5"

css-loader@^6.5.1, css-loader@^6.7.1:
css-loader@^6.5.1:
version "6.7.1"
resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-6.7.1.tgz#e98106f154f6e1baf3fc3bc455cb9981c1d5fd2e"
integrity sha512-yB5CNFa14MbPJcomwNh3wLThtkZgcNyI2bNMRt8iE5Z8Vwl7f8vQXFAzn2HDOJvtDq2NTZBUGMSUNNyrv3/+cw==
Expand Down Expand Up @@ -12326,10 +12326,10 @@ react-error-overlay@^6.0.11:
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.11.tgz#92835de5841c5cf08ba00ddd2d677b6d17ff9adb"
integrity sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==

react-flow-renderer@^10.3.0:
version "10.3.0"
resolved "https://registry.yarnpkg.com/react-flow-renderer/-/react-flow-renderer-10.3.0.tgz#4ce415c7039ace4f92ba1f0ec281f4c6049724ff"
integrity sha512-LdjFpiyG6Dbf7rsCLzYvY6/XV9IpfIy9sM3RC7BpMdcUmMPOsQ4JRXKHgNz+NepYDVxUmiBlkHUPYUax7CKqSA==
react-flow-renderer@^10.3.4:
version "10.3.4"
resolved "https://registry.yarnpkg.com/react-flow-renderer/-/react-flow-renderer-10.3.4.tgz#b4be43252501234bac3633fe7f418de976889354"
integrity sha512-unuHgPs9ibXXl7JxGSCte2Ni/9/HAoQFLQM2EjgIr4q8bn3jZ34ph6UiLbVFqhcyvA+KppLi/yZBgxxhVXlGCw==
dependencies:
"@babel/runtime" "^7.18.0"
classcat "^5.0.3"
Expand Down

0 comments on commit 6add077

Please sign in to comment.