Sfoglia il codice sorgente

getBefore & getAfter

sxoinas12 5 anni fa
parent
commit
e993708f2e

+ 11 - 0
App.js

@@ -177,6 +177,17 @@ export default class App extends React.Component {
   }
   render(){
   let currentView2 = CS.render();  
+  /*console.log("TESTING @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ")
+  let view = Object.keys(CS.ViewSystem.views)[1]
+  let testingView = CS.ViewSystem.views[view]
+  let testingNode = testingView.ViewTree.nodes[Object.keys(testingView.ViewTree.nodes)[1]];
+  console.log(Object.keys(testingView.ViewTree.nodes))
+  console.log(testingNode)
+  //console.log(testingNode)
+  let prevNode = testingView.getBefore(testingNode)
+  console.log("prev node is",prevNode)
+ // Object.keys(CS.ViewSystem.views).map((key) => console.log(CS.ViewSystem.views[key]))
+  console.log("TESTING @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")*/
   return (
     <Div>
       <Div>{currentView2}</Div>

File diff suppressed because it is too large
+ 0 - 0
dist/lib/Module.js


File diff suppressed because it is too large
+ 0 - 0
dist/lib/systems/ViewSystem.js


File diff suppressed because it is too large
+ 0 - 0
dist/modules/BaseContainer/index.js


File diff suppressed because it is too large
+ 0 - 0
dist/modules/BaseHolder/index.js


File diff suppressed because it is too large
+ 0 - 0
dist/modules/BlogFeed/index.js


File diff suppressed because it is too large
+ 0 - 0
dist/modules/BlogPost/index.js


File diff suppressed because it is too large
+ 0 - 0
dist/modules/Button/index.js


File diff suppressed because it is too large
+ 0 - 0
dist/modules/Col.js


File diff suppressed because it is too large
+ 0 - 0
dist/modules/DatePicker.js


File diff suppressed because it is too large
+ 0 - 0
dist/modules/Form/index.js


File diff suppressed because it is too large
+ 0 - 0
dist/modules/Icon/index.js


File diff suppressed because it is too large
+ 0 - 0
dist/modules/Image/index.js


File diff suppressed because it is too large
+ 0 - 0
dist/modules/NativeBase/index.js


+ 1 - 1
dist/modules/RootComp/index.js

@@ -1 +1 @@
-var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _react=_interopRequireDefault(require("react"));var _Types=_interopRequireDefault(require("../../lib/Types"));var _Module2=_interopRequireDefault(require("../../lib/Module"));var _reactNative=require("react-native");var _jsxFileName="C:\\Users\\Karteri\\Desktop\\Development\\TrapiLib\\src\\modules\\RootComp\\index.js";var RootComp=function(_Module){(0,_inherits2.default)(RootComp,_Module);function RootComp(props){(0,_classCallCheck2.default)(this,RootComp);return(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(RootComp).call(this,props));}(0,_createClass2.default)(RootComp,[{key:"display",value:function display(){return;_react.default.createElement(_reactNative.Text,{__source:{fileName:_jsxFileName,lineNumber:14}},this.props.text||""," - ",this.props.second);}}]);return RootComp;}(_Module2.default);exports.default=RootComp;RootComp.Inputs={text:new _Types.default.Text().require().default("Sample Text"),second:new _Types.default.Integer().require().default(5)};
+var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _react=_interopRequireDefault(require("react"));var _Types=_interopRequireDefault(require("../../lib/Types"));var _Module2=_interopRequireDefault(require("../../lib/Module"));var _reactNative=require("react-native");var _jsxFileName="C:\\Users\\Konstanitnos\\Development\\TrapiLib\\src\\modules\\RootComp\\index.js";var RootComp=function(_Module){(0,_inherits2.default)(RootComp,_Module);function RootComp(props){(0,_classCallCheck2.default)(this,RootComp);return(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(RootComp).call(this,props));}(0,_createClass2.default)(RootComp,[{key:"display",value:function display(){return;_react.default.createElement(_reactNative.Text,{__source:{fileName:_jsxFileName,lineNumber:14}},this.props.text||""," - ",this.props.second);}}]);return RootComp;}(_Module2.default);exports.default=RootComp;RootComp.Inputs={text:new _Types.default.Text().require().default("Sample Text"),second:new _Types.default.Integer().require().default(5)};

File diff suppressed because it is too large
+ 0 - 0
dist/modules/Row.js


File diff suppressed because it is too large
+ 0 - 0
dist/modules/Text/index.js


+ 1 - 1
dist/modules/View.js

@@ -1 +1 @@
-var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _react=_interopRequireDefault(require("react"));var _Module2=_interopRequireDefault(require("../lib/Module"));var _reactNative=require("react-native");var _jsxFileName="C:\\Users\\Karteri\\Desktop\\Development\\TrapiLib\\src\\modules\\View.js";var ViewComp=function(_Module){(0,_inherits2.default)(ViewComp,_Module);function ViewComp(props){(0,_classCallCheck2.default)(this,ViewComp);return(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(ViewComp).call(this,props));}(0,_createClass2.default)(ViewComp,[{key:"display",value:function display(){return _react.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:16}},this.props.children);}}]);return ViewComp;}(_Module2.default);exports.default=ViewComp;
+var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _react=_interopRequireDefault(require("react"));var _Module2=_interopRequireDefault(require("../lib/Module"));var _reactNative=require("react-native");var _jsxFileName="C:\\Users\\Konstanitnos\\Development\\TrapiLib\\src\\modules\\View.js";var ViewComp=function(_Module){(0,_inherits2.default)(ViewComp,_Module);function ViewComp(props){(0,_classCallCheck2.default)(this,ViewComp);return(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(ViewComp).call(this,props));}(0,_createClass2.default)(ViewComp,[{key:"display",value:function display(){return _react.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:16}},this.props.children);}}]);return ViewComp;}(_Module2.default);exports.default=ViewComp;

+ 1 - 1
dist/modules/ViewComp.js

@@ -1 +1 @@
-var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _react=_interopRequireDefault(require("react"));var _Module2=_interopRequireDefault(require("../lib/Module"));var _reactNative=require("react-native");var _jsxFileName="C:\\Users\\Karteri\\Desktop\\Development\\TrapiLib\\src\\modules\\ViewComp.js";var ViewComp=function(_Module){(0,_inherits2.default)(ViewComp,_Module);function ViewComp(props){(0,_classCallCheck2.default)(this,ViewComp);return(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(ViewComp).call(this,props));}(0,_createClass2.default)(ViewComp,[{key:"display",value:function display(){return _react.default.createElement(_reactNative.View,{key:Math.random(),__source:{fileName:_jsxFileName,lineNumber:16}});}}]);return ViewComp;}(_Module2.default);exports.default=ViewComp;
+var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _react=_interopRequireDefault(require("react"));var _Module2=_interopRequireDefault(require("../lib/Module"));var _reactNative=require("react-native");var _jsxFileName="C:\\Users\\Konstanitnos\\Development\\TrapiLib\\src\\modules\\ViewComp.js";var ViewComp=function(_Module){(0,_inherits2.default)(ViewComp,_Module);function ViewComp(props){(0,_classCallCheck2.default)(this,ViewComp);return(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(ViewComp).call(this,props));}(0,_createClass2.default)(ViewComp,[{key:"display",value:function display(){return _react.default.createElement(_reactNative.View,{key:Math.random(),__source:{fileName:_jsxFileName,lineNumber:16}});}}]);return ViewComp;}(_Module2.default);exports.default=ViewComp;

+ 10 - 0
dist/rules/Universal.css

@@ -33,4 +33,14 @@ Image > Text {
 Image > * {
 	justifyContent: center;
 	alignSelf: center;
+}
+
+
+Badge - Button {
+	width: 10;
+}
+
+
+Badge + Button {
+	paddingTop: 100; 
 }

+ 25 - 0
src/lib/systems/ViewSystem.js

@@ -252,6 +252,31 @@ export class View {
 		return this.ViewTree.getChildren(node);
 	}
 
+
+	getBefore(node){
+		let DepthNodes = this.ViewTree.levels[node.depth]
+		DepthNodes = Array.from(DepthNodes);
+		let nodeIndex = DepthNodes.indexOf(node.id);
+		if(DepthNodes[nodeIndex - 1]){
+			return this.ViewTree.nodes[DepthNodes[nodeIndex - 1]]
+		}else{
+			return null;
+		}
+	}	
+
+
+	getAfter(node){
+		let DepthNodes = this.ViewTree.levels[node.depth]
+		DepthNodes = Array.from(DepthNodes);
+		let nodeIndex = DepthNodes.indexOf(node.id);
+		if(DepthNodes[nodeIndex + 1]){
+			return this.ViewTree.nodes[DepthNodes[nodeIndex + 1]]
+		}else{
+			return null;
+		}		
+	}
+
+
 	import(data, parentNode) {
 		let { tree, ghosts } = data;
 		if(!parentNode)

+ 10 - 0
src/rules/Universal.css

@@ -33,4 +33,14 @@ Image > Text {
 Image > * {
 	justifyContent: center;
 	alignSelf: center;
+}
+
+
+Badge - Button {
+	width: 10;
+}
+
+
+Badge + Button {
+	paddingTop: 100; 
 }

Some files were not shown because too many files changed in this diff