Showing
9 changed files
with
145 additions
and
119 deletions
... | @@ -24,7 +24,7 @@ We suppose that npm is already installed. Then, you will have to setup your | ... | @@ -24,7 +24,7 @@ We suppose that npm is already installed. Then, you will have to setup your |
24 | development environment by typing these commands, | 24 | development environment by typing these commands, |
25 | the last one being executed in the local sources repository: | 25 | the last one being executed in the local sources repository: |
26 | 26 | ||
27 | -`npm install -g webpack` | 27 | +`npm install -g webpack-cli` |
28 | 28 | ||
29 | `npm install -g eslint` | 29 | `npm install -g eslint` |
30 | 30 | ... | ... |
1 | -/******/ "use strict"; | ||
2 | /******/ var __webpack_modules__ = ([ | 1 | /******/ var __webpack_modules__ = ([ |
3 | -/* 0 */, | 2 | +/* 0 */ |
3 | +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
4 | + | ||
5 | +__webpack_require__.r(__webpack_exports__); | ||
6 | +/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
7 | +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | ||
8 | +/* harmony export */ }); | ||
9 | +/* harmony import */ var _component_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); | ||
10 | +/* harmony import */ var _statemachine_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2); | ||
11 | +/* harmony import */ var _isinnode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6); | ||
12 | +/* harmony import */ var _context_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7); | ||
13 | +/* harmony import */ var _invocation_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8); | ||
14 | +/* harmony import */ var _connection_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9); | ||
15 | +/* harmony import */ var _sheet_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(10); | ||
16 | +/* harmony import */ var _application_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(11); | ||
17 | +// no longer needed with the use of imports | ||
18 | + | ||
19 | + | ||
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | ||
24 | + | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | +let ARCS = { | ||
29 | + Component: _component_js__WEBPACK_IMPORTED_MODULE_0__.default, | ||
30 | + isInNode : _isinnode_js__WEBPACK_IMPORTED_MODULE_2__.default, | ||
31 | + StateMachine: _statemachine_js__WEBPACK_IMPORTED_MODULE_1__.default, | ||
32 | + Context: _context_js__WEBPACK_IMPORTED_MODULE_3__.default, | ||
33 | + Invocation: _invocation_js__WEBPACK_IMPORTED_MODULE_4__.default, | ||
34 | + Connection: _connection_js__WEBPACK_IMPORTED_MODULE_5__.default, | ||
35 | + Sheet: _sheet_js__WEBPACK_IMPORTED_MODULE_6__.default, | ||
36 | + Application: _application_js__WEBPACK_IMPORTED_MODULE_7__.default | ||
37 | +}; | ||
38 | + | ||
39 | +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ARCS); | ||
40 | + | ||
41 | + | ||
42 | +/***/ }), | ||
4 | /* 1 */ | 43 | /* 1 */ |
5 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | 44 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
6 | 45 | ||
... | @@ -1214,7 +1253,7 @@ __webpack_require__.r(__webpack_exports__); | ... | @@ -1214,7 +1253,7 @@ __webpack_require__.r(__webpack_exports__); |
1214 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | 1253 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
1215 | /* harmony export */ }); | 1254 | /* harmony export */ }); |
1216 | /* harmony import */ var _statemachine_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); | 1255 | /* harmony import */ var _statemachine_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); |
1217 | -/* harmony import */ var _arcs_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); | 1256 | +/* harmony import */ var _arcs_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0); |
1218 | 1257 | ||
1219 | 1258 | ||
1220 | 1259 | ||
... | @@ -2264,46 +2303,11 @@ Application.slot("finish"); | ... | @@ -2264,46 +2303,11 @@ Application.slot("finish"); |
2264 | /******/ })(); | 2303 | /******/ })(); |
2265 | /******/ | 2304 | /******/ |
2266 | /************************************************************************/ | 2305 | /************************************************************************/ |
2267 | -var __webpack_exports__ = {}; | 2306 | +/******/ |
2268 | -// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. | 2307 | +/******/ // startup |
2269 | -(() => { | 2308 | +/******/ // Load entry module and return exports |
2270 | -__webpack_require__.r(__webpack_exports__); | 2309 | +/******/ // This entry module is referenced by other modules so it can't be inlined |
2271 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | 2310 | +/******/ var __webpack_exports__ = __webpack_require__(0); |
2272 | -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | 2311 | +/******/ var __webpack_exports__default = __webpack_exports__.default; |
2273 | -/* harmony export */ }); | 2312 | +/******/ export { __webpack_exports__default as default }; |
2274 | -/* harmony import */ var _component_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); | 2313 | +/******/ |
2275 | -/* harmony import */ var _statemachine_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2); | ||
2276 | -/* harmony import */ var _arcs_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6); | ||
2277 | -/* harmony import */ var _context_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7); | ||
2278 | -/* harmony import */ var _invocation_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8); | ||
2279 | -/* harmony import */ var _connection_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9); | ||
2280 | -/* harmony import */ var _sheet_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(10); | ||
2281 | -/* harmony import */ var _application_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(11); | ||
2282 | -// no longer needed with the use of imports | ||
2283 | - | ||
2284 | - | ||
2285 | - | ||
2286 | - | ||
2287 | - | ||
2288 | - | ||
2289 | - | ||
2290 | - | ||
2291 | - | ||
2292 | - | ||
2293 | -let ARCS = { | ||
2294 | - Component: _component_js__WEBPACK_IMPORTED_MODULE_0__.default, | ||
2295 | - isInNode : _arcs_js__WEBPACK_IMPORTED_MODULE_2__.default, | ||
2296 | - StateMachine: _statemachine_js__WEBPACK_IMPORTED_MODULE_1__.default, | ||
2297 | - Context: _context_js__WEBPACK_IMPORTED_MODULE_3__.default, | ||
2298 | - Invocation: _invocation_js__WEBPACK_IMPORTED_MODULE_4__.default, | ||
2299 | - Connection: _connection_js__WEBPACK_IMPORTED_MODULE_5__.default, | ||
2300 | - Sheet: _sheet_js__WEBPACK_IMPORTED_MODULE_6__.default, | ||
2301 | - Application: _application_js__WEBPACK_IMPORTED_MODULE_7__.default | ||
2302 | -}; | ||
2303 | - | ||
2304 | -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ARCS); | ||
2305 | - | ||
2306 | -})(); | ||
2307 | - | ||
2308 | -var __webpack_exports__default = __webpack_exports__.default; | ||
2309 | -export { __webpack_exports__default as default }; | ... | ... |
1 | /*! For license information please see arcs.min.js.LICENSE.txt */ | 1 | /*! For license information please see arcs.min.js.LICENSE.txt */ |
2 | -var t={d:(n,e)=>{for(var o in e)t.o(e,o)&&!t.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:e[o]})},o:(t,n)=>Object.prototype.hasOwnProperty.call(t,n)},n={};t.d(n,{Z:()=>m});var e={SourceIsNotComponent:{message:"Source is not a component"},UndefinedSignal:{message:"Signal is not defined"},UndefinedSlot:{message:"Slot is not defined"},create:function(t,n,e){return void 0===t.prototype?(console.error("Cannot create such a component"),0):(t.prototype.slots=[],t.prototype.signals={},t.slotList=function(){return t.prototype.slots},t.prototype.slotList=function(){return t.prototype.slots},t.prototype.signalList=function(){var n,e=[];for(n in t.prototype.signals)e.push(n);return e},t.signalList=function(){return t.prototype.signalList()},t.prototype.emit=function(t){var n,e,o,i=Array.prototype.slice.call(arguments,1);for(n in this.signals[t])e=this.signals[t][n].func,o=this.signals[t][n].obj,e.apply(o,i)},t.slot=function(n,e){var o;if(n instanceof Array)for(o=0;o<n.length;o++)t.prototype.slots.push(n[o]);else t.prototype.slots.push(n),void 0!==e&&(t.prototype[n]=e)},t.signal=function(n){var e;if(n instanceof Array)for(e=0;e<n.length;e++)t.prototype.signals[n[e]]=1;else t.prototype.signals[n]=1},void 0!==n&&t.slot(n),void 0!==e&&t.signal(e),t)},check:function(t){return void 0!==t.prototype&&void 0!==t.prototype.signals&&void 0!==t.prototype.slots},connect:function(t,n,o,i){var r,s;if(void 0===t.signals)throw e.SourceIsNotComponent;if(void 0===t.signals[n])throw e.UndefinedSignal;if(void 0===o[i])throw e.UndefinedSlot;if(!t.hasOwnProperty("signals"))for(s in r=t.signals,t.signals={},r)t.signals[s]=[];t.signals[n].push({obj:o,func:o[i]})},disconnect:function(t,n,e,o){var i;for(i=0;i<t.signals[n].length;i++)t.signals[n][i].obj===e&&t.signals[n][i].func===e[o]&&(t.signals[n].splice(i,1),i--)},invoke:function(t,n,o){if(void 0===t[n])throw e.UndefinedSlot;t[n].apply(t,o)},config:function(t,n){"function"==typeof t.config&&t.config(n)}};const o=e,i=function(){var t,n;this.promise=new Promise((function(e,o){t=e,n=o})),this.accept=function(){t()},this.abort=function(){n()}};let r=function(){this.promise={},this.and=function(t){return this.promise=Promise.all([this.promise,t.promise]),this},this.or=function(t){return this.promise=Promise.race([this.promise,t.promise]),this}};r.build=function(t,n){var e,o,s,c;if("string"==typeof t){var a;n.hasOwnProperty(t)?a=n[t]:n[t]=a=new i;var u=new r;return u.promise=a.promise,u}for(e=r.build(t[0],n),c=1;c<t.length;c++)t[c].hasOwnProperty("and")?(s=r.build(t[c].and,n),o=e.and(s)):t[c].hasOwnProperty("or")?(s=r.build(t[c].or,n),o=e.or(s)):console.warn("[ARCS] Illegal tree"),e=o;return e};const s=r,c=function(){function t(t,n,e,o,i,r){this.message=t,this.expected=n,this.found=e,this.offset=o,this.line=i,this.column=r,this.name="SyntaxError"}return function(t,n){function e(){this.constructor=t}e.prototype=n.prototype,t.prototype=new e}(t,Error),{SyntaxError:t,parse:function(n){var e,o=arguments.length>1?arguments[1]:{},i={},r={start:D},s=D,c=i,a=function(t,n){return[t].concat(n)},u=function(t){return{and:t}},f=function(t){return{or:t}},l=function(t){return t},h="(",p={type:"literal",value:"(",description:'"("'},d=")",v={type:"literal",value:")",description:'")"'},g=function(t){return[t]},y={type:"other",description:"id"},m=function(t){return t.trim()},C=/^[_a-zA-Z]/,w={type:"class",value:"[_a-zA-Z]",description:"[_a-zA-Z]"},S=/^[_a-zA-Z0-9]/,P={type:"class",value:"[_a-zA-Z0-9]",description:"[_a-zA-Z0-9]"},A="&",O={type:"literal",value:"&",description:'"&"'},x="|",b={type:"literal",value:"|",description:'"|"'},R=/^[ \r\n\t]/,F={type:"class",value:"[ \\r\\n\\t]",description:"[ \\r\\n\\t]"},N=0,T=0,j={line:1,column:1,seenCR:!1},k=0,L=[],E=0;if("startRule"in o){if(!(o.startRule in r))throw new Error("Can't start parsing from rule \""+o.startRule+'".');s=r[o.startRule]}function _(t){return T!==t&&(T>t&&(T=0,j={line:1,column:1,seenCR:!1}),function(t,e,o){var i,r;for(i=e;i<o;i++)"\n"===(r=n.charAt(i))?(t.seenCR||t.line++,t.column=1,t.seenCR=!1):"\r"===r||"\u2028"===r||"\u2029"===r?(t.line++,t.column=1,t.seenCR=!0):(t.column++,t.seenCR=!1)}(j,T,t),T=t),j}function U(t){N<k||(N>k&&(k=N,L=[]),L.push(t))}function Z(e,o,i){var r=_(i),s=i<n.length?n.charAt(i):null;return null!==o&&function(t){var n=1;for(t.sort((function(t,n){return t.description<n.description?-1:t.description>n.description?1:0}));n<t.length;)t[n-1]===t[n]?t.splice(n,1):n++}(o),new t(null!==e?e:function(t,n){var e,o=new Array(t.length);for(e=0;e<t.length;e++)o[e]=t[e].description;return"Expected "+(t.length>1?o.slice(0,-1).join(", ")+" or "+o[t.length-1]:o[0])+" but "+(n?'"'+function(t){function n(t){return t.charCodeAt(0).toString(16).toUpperCase()}return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,(function(t){return"\\x0"+n(t)})).replace(/[\x10-\x1F\x80-\xFF]/g,(function(t){return"\\x"+n(t)})).replace(/[\u0180-\u0FFF]/g,(function(t){return"\\u0"+n(t)})).replace(/[\u1080-\uFFFF]/g,(function(t){return"\\u"+n(t)}))}(n)+'"':"end of input")+" found."}(o,s),o,s,i,r.line,r.column)}function D(){return I()}function I(){var t,n,e,o;if(t=N,(n=z())!==i){if(e=[],(o=q())!==i)for(;o!==i;)e.push(o),o=q();else e=c;e!==i?t=n=a(n,e):(N=t,t=c)}else N=t,t=c;return t===i&&(t=z()),t}function q(){var t,n;return t=N,M()!==i&&(n=z())!==i?t=u(n):(N=t,t=c),t===i&&(t=N,B()!==i&&(n=z())!==i?t=f(n):(N=t,t=c)),t}function z(){var t,e,o,r;return t=N,(e=V())!==i&&(e=l(e)),(t=e)===i&&(t=N,40===n.charCodeAt(N)?(e=h,N++):(e=i,0===E&&U(p)),e!==i&&(o=I())!==i?(41===n.charCodeAt(N)?(r=d,N++):(r=i,0===E&&U(v)),r!==i?t=e=g(o):(N=t,t=c)):(N=t,t=c)),t}function V(){var t,e,o;return E++,t=N,e=N,(o=J())!==i&&(o=n.substring(e,N)),(e=o)!==i&&(e=m(e)),E--,(t=e)===i&&(e=i,0===E&&U(y)),t}function J(){var t,e,o,r,s;if(t=N,(e=G())!==i)if(C.test(n.charAt(N))?(o=n.charAt(N),N++):(o=i,0===E&&U(w)),o!==i){for(r=[],S.test(n.charAt(N))?(s=n.charAt(N),N++):(s=i,0===E&&U(P));s!==i;)r.push(s),S.test(n.charAt(N))?(s=n.charAt(N),N++):(s=i,0===E&&U(P));r!==i&&(s=G())!==i?t=e=[e,o,r,s]:(N=t,t=c)}else N=t,t=c;else N=t,t=c;return t}function M(){var t,e,o,r;return t=N,(e=G())!==i?(38===n.charCodeAt(N)?(o=A,N++):(o=i,0===E&&U(O)),o!==i&&(r=G())!==i?t=e=[e,o,r]:(N=t,t=c)):(N=t,t=c),t}function B(){var t,e,o,r;return t=N,(e=G())!==i?(124===n.charCodeAt(N)?(o=x,N++):(o=i,0===E&&U(b)),o!==i&&(r=G())!==i?t=e=[e,o,r]:(N=t,t=c)):(N=t,t=c),t}function G(){var t,e;for(t=[],R.test(n.charAt(N))?(e=n.charAt(N),N++):(e=i,0===E&&U(F));e!==i;)t.push(e),R.test(n.charAt(N))?(e=n.charAt(N),N++):(e=i,0===E&&U(F));return t}if((e=s())!==i&&N===n.length)return e;throw e!==i&&N<n.length&&U({type:"end",description:"end of input"}),Z(null,L,k)}}}(),a=o.create((function(t){var n="",e="",o={},i="",r=this,a={},u={},f=function(t){var n;r.slots.indexOf(t)<0&&(r.slots.push(t),r[t]=(n=t,function(){r.setToken(n)}))},l=function(t){var n;if(o.hasOwnProperty(t))for(n in u={},o[t])o[t].hasOwnProperty(n)&&s.build(a[n],u).promise.then((function(){var e;for(e in u)u.hasOwnProperty(e)&&u[e].abort();l(o[t][n])}));i=t,r.emit("requestSheet",i),i===e&&r.emit("requestTermination")};this.setInitialState=function(t){i=n=t},this.setFinalState=function(t){e=t},this.addTransition=function(t,n,e){var i,r=/([A-Za-z_]\w*)/g;try{var s;if("string"==typeof(s=c.parse(n)))f(s);else for(;null!==(i=r.exec(n));)f(i[0]);a[n]=s,void 0===o[t]&&(o[t]={}),o[t][n]=e}catch(t){}},this.setToken=function(t){u.hasOwnProperty(t)&&u[t].accept()},this.setTransitions=function(t){var n,e;for(n in t)if(t.hasOwnProperty(n))for(e in t[n])t[n].hasOwnProperty(e)&&this.addTransition(n,e,t[n][e])},this.start=function(){l(n)},void 0!==t&&(n=t.initial,e=t.final,this.setTransitions(t.transitions),i="")}),["setToken"],["requestSheet","requestTermination"]);function u(){return"undefined"!=typeof process&&-1!==process.release.name.search(/node|io.js/)}let f=function(t){var n={},e={},o={},i=[],r=this;if(o.StateMachine=a,void 0!==t){var s;for(s in i=t.libraries,t.components)t.components.hasOwnProperty(s)&&(n[s]=t.components[s]);if(void 0!==t.constants)for(s in t.constants)t.constants.hasOwnProperty(s)&&(e[s]=t.constants[s])}var c=async function(t){return u()?new Promise((function(n,e){var o=require(t);void 0!==o?n(o):e("[ARCS] File not found")})):(await fetch(t)).json()},l=function(){var t,r=[];for(t in n)if(n.hasOwnProperty(t)){if(void 0===o[n[t].type])return console.error("[ARCS] Factory "+n[t].type+" not found."),void console.error("[ARCS] Context dump follows: ",i,n,e);var s=o[n[t].type];try{void 0!==n[t].value||void 0!==n[t].url||void 0!==n[t].ref?(void 0!==n[t].value&&(n[t].instance=new s(n[t].value)),void 0!==n[t].url&&(console.log("loading data file",n[t].url),r.push(c(n[t].url).then(function(t,e){return function(o){return console.log("instanciating from data file"),n[t].instance=new e(o),Promise.resolve()}}(t,s)))),void 0!==n[t].ref&&void 0!==e[n[t].ref]&&(n[t].instance=new s(e[n[t].ref]))):n[t].instance=new s}catch(n){console.error("[ARCS] Component of type ",t," not instanciated.",n)}}return Promise.all(r)};this.loadLibrary=function(t,n){var e=t,o=t;return f.currentContext=r,"string"!=typeof t&&(o=t.name,e=t.url),i.indexOf(o)<0&&i.push(o),import(e).then((function(t){for(s in t.default)t.default.hasOwnProperty(s)&&f.currentContext.setFactory(s,t.default[s]);void 0!==n&&n()})).catch((function(t){console.error("[ARCS] Trouble loading '",e,"' with reason -",{msg:t})}))},this.getComponentList=function(){var t,e=Object.keys(n);for(t=0;t<e.length;t++)n.hasOwnProperty(e[t])||e.splice(t--,1);return e},this.getConstant=function(t){return e[t]},this.getComponentType=function(t){if(void 0!==n[t])return n[t].type},this.getComponentValue=function(t){if(void 0!==n[t])return n[t].value},this.getComponent=function(t){if(void 0!==n[t])return n[t].instance},this.getComponentName=function(t){var e,o;for(o=n.getComponentList(),e=0;e<o.length;e++)if(n[o[e]].instance===t)return o[e]},this.setFactory=function(t,n){o[t]=n},this.toJSON=function(){var t,e={};for(t in n)n.hasOwnProperty(t)&&(e[t]={type:n[t].type,value:n[t].value});return e},this.setComponentValue=function(t,e){n[t].value=e},this.addComponent=function(t,e,i){var r;n[t]={},n[t].type=e,n[t].value=i;var s=o[e];void 0!==s&&(r=new s(i)),n[t].instance=r},this.removeComponent=function(t){delete n[t]},this.getFactory=function(t){return o[t]},this.getFactoryList=function(){return Object.keys(o)},this.instanciate=function(){return function(){var t;f.currentContext=r;var n=[];for(t=0;t<i.length;t++)n.push(r.loadLibrary(i[t]));return Promise.all(n)}().then(l).catch((function(t){console.error("[ARCS] Trouble instanciating context",t)}))};var h=function(t,n){var e,o=Object.create(n);for(e in t)t.hasOwnProperty(e)&&(o[e]=t[e]);return o};this.chain=function(t,i,r){return[h(t,n),h(i,e),h(r,o)]},this.setParent=function(t){if(void 0!==t){var i=t.chain(n,e,o);n=i[0],e=i[1],o=i[2]}}};f.currentContext=null;const l=f;let h=function(t,n,e){this.getDestination=function(){return t},this.getSlot=function(){return n},this.getValue=function(){return e},this.invoke=function(){var o=t[n];void 0!==o?o.apply(t,e):console.error("Undefined slot %s of component %s",n,t)}};h.cast=function(t,n){if(void 0!==t.value){var e=n.getComponent(t.destination);return void 0===e&&console.error("[ARCS] Destination ",t.destination," is undefined"),new h(e,t.slot,t.value)}if(void 0!==t.ref)return new h(n.getComponent(t.destination),t.slot,n.getConstant(t.ref))},h.PRE_CONNECTION=0,h.POST_CONNECTION=1,h.CLEAN_UP=2;const p=h;let d=function(t,n,e,i){this.connect=function(){try{o.connect(t,n,e,i)}catch(o){console.log(o,t,n,e,i)}},this.disconnect=function(){o.disconnect(t,n,e,i)},this.getSource=function(){return t},this.getDestination=function(){return e},this.getSlot=function(){return i},this.getSignal=function(){return n}};d.cast=function(t,n){return new d(n.getComponent(t.source),t.signal,n.getComponent(t.destination),t.slot)};const v=d,g=function(t){var n,e,o,i,r,s=new l,c=[],a=[],u=[],f=[],h=0,d=0,g=0,y=0;n=function(){var t;for(t=0;t<c.length;t++)c[t].invoke()},e=function(){var t;for(t=0;t<a.length;t++)a[t].invoke()},o=function(){var t;for(t=0;t<u.length;t++)u[t].invoke()},i=function(){var t;for(t=0;t<f.length;t++)f[t].connect()},r=function(){var t;for(t=0;t<f.length;t++)f[t].disconnect()},this.setContext=function(t){s=t},this.activate=function(){s.instanciate().then((function(){n(),i(),e()}))},this.deactivate=function(){r(),o()},this.addPreConnection=function(t){var n=p.cast(t,s);return n.id=h++,c.push(n),n.id},this.addPostConnection=function(t){var n=p.cast(t,s);return n.id=d++,a.push(n),n.id},this.addCleanup=function(t){var n=p.cast(t,s);return n.id=g++,u.push(n),n.id},this.addConnection=function(t){var n=v.cast(t,s);return n.id=y++,f.push(n),n.id};var m=function(t,n){for(var e=n.length;e--&&n[e].id!==t;);e>=0?n.splice(e,1):console.warn("Could not remove data with id",t)};this.removePreConnection=function(t){m(t,c)},this.removePostConnection=function(t){m(t,a)},this.removeCleanup=function(t){m(t,u)};var C=function(t,n,e){for(var o=e.length;o--&&e[o].id!==t;);o>=0&&(e[o].value=n)};this.changePreConnection=function(t,n){C(t,n,c)},this.changePostConnection=function(t,n){C(t,n,a)},this.changeCleanup=function(t,n){C(t,n,u)},this.removeConnection=function(t){m(t,f)};var w=function(t,n,e){for(var o,i=e.length,r=e.length;i--&&e[i].id!==t;);for(;r--&&e[r].id!==n;);i>=0&&r>=0&&(o=e[i],e[i]=e[r],e[r]=o,e[i].id=t,e[r].id=n)};this.swapConnections=function(t,n){w(t,n,f)},this.swapCleanups=function(t,n){w(t,n,u)},this.swapPreConnections=function(t,n){w(t,n,c)},this.swapPostConnections=function(t,n){w(t,n,a)},this.import=function(n){n.hasOwnProperty("context")&&(s=new l(n.context)).setParent(t),s.instanciate().then((function(){!function(t){var n=0,e=p.cast,o=v.cast;for(n=0;n<t.preconnections.length;n++)c.push(e(t.preconnections[n],s));for(n=0;n<t.postconnections.length;n++)a.push(e(t.postconnections[n],s));for(n=0;n<t.cleanups.length;n++)u.push(e(t.cleanups[n],s));for(n=0;n<t.connections.length;n++)f.push(o(t.connections[n],s))}(n)}))};var S=function(t){return{destination:s.getComponentName(t.getDestination()),slot:t.getSlot(),value:t.getValue()}};this.toJSON=function(){var t,n,e=[],o=[],i=[],r=[];for(t=0;t<f.length;t++)i.push((n=f[t],{source:s.getComponentName(n.getSource()),signal:n.getSignal(),destination:s.getComponentName(n.getDestination()),slot:n.getSlot()}));for(t=0;t<c.length;t++)e.push(S(c[t]));for(t=0;t<a.length;t++)o.push(S(a[t]));for(t=0;t<u.length;t++)r.push(S(u[t]));return{preconnections:e,postconnections:o,connections:i,cleanups:r}},s.setParent(t)};let y=function(){var t,n=new l,e={},i={},r=[],s=this,c="";this.export=function(){return{context:n,controller:n.getComponentName(i),sheets:e}},this.getContext=function(){return n},this.getSheetList=function(){return Object.keys(e)},this.getSheet=function(t){return e[t]},this.addSheet=function(t,o){e[t]=o,o.setContext(n)},this.removeSheet=function(t){delete e[t]},t=function(){var t,r,c;for(r=n.getComponent(i),i=r,c=Object.keys(e),t=0;t<c.length;t++)(r=new g(n)).import(e[c[t]],n),e[c[t]]=r;o.connect(i,"requestSheet",s,"setSheet"),o.connect(i,"requestTermination",s,"finish"),i.start()},this.setController=function(t){i=n.getComponent(t)},this.setSheet=function(t){e.hasOwnProperty(t)?(c&&e[c].deactivate(),e[c=t].activate()):console.warn("[ARCS] Tried to activate hollow sheet named: "+t)},this.finish=function(){c&&e[c].deactivate()},this.import=function(t){n=new l(t.context),e=t.sheets,void 0===(i=t.controller)&&console.error("[ARCS] Undefined controller. Cannot start application.")},this.setFactory=function(t,n){factories[t]=n},this.setDependency=function(t){r[t]={}},this.start=function(){console.log("[ARCS] Starting application..."),n.instanciate().then(t)}};y.setDependency=function(t,n){t.setDependency(n)},o.create(y),y.slot("setSheet"),y.slot("finish");const m={Component:o,isInNode:u,StateMachine:a,Context:l,Invocation:p,Connection:v,Sheet:g,Application:y};var C=n.Z;export{C as default}; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
2 | +var t={d:(n,e)=>{for(var o in e)t.o(e,o)&&!t.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:e[o]})},o:(t,n)=>Object.prototype.hasOwnProperty.call(t,n)},n={};t.d(n,{Z:()=>y});var e={SourceIsNotComponent:{message:"Source is not a component"},UndefinedSignal:{message:"Signal is not defined"},UndefinedSlot:{message:"Slot is not defined"},create:function(t,n,e){return void 0===t.prototype?(console.error("Cannot create such a component"),0):(t.prototype.slots=[],t.prototype.signals={},t.slotList=function(){return t.prototype.slots},t.prototype.slotList=function(){return t.prototype.slots},t.prototype.signalList=function(){var n,e=[];for(n in t.prototype.signals)e.push(n);return e},t.signalList=function(){return t.prototype.signalList()},t.prototype.emit=function(t){var n,e,o,i=Array.prototype.slice.call(arguments,1);for(n in this.signals[t])e=this.signals[t][n].func,o=this.signals[t][n].obj,e.apply(o,i)},t.slot=function(n,e){var o;if(n instanceof Array)for(o=0;o<n.length;o++)t.prototype.slots.push(n[o]);else t.prototype.slots.push(n),void 0!==e&&(t.prototype[n]=e)},t.signal=function(n){var e;if(n instanceof Array)for(e=0;e<n.length;e++)t.prototype.signals[n[e]]=1;else t.prototype.signals[n]=1},void 0!==n&&t.slot(n),void 0!==e&&t.signal(e),t)},check:function(t){return void 0!==t.prototype&&void 0!==t.prototype.signals&&void 0!==t.prototype.slots},connect:function(t,n,o,i){var r,s;if(void 0===t.signals)throw e.SourceIsNotComponent;if(void 0===t.signals[n])throw e.UndefinedSignal;if(void 0===o[i])throw e.UndefinedSlot;if(!t.hasOwnProperty("signals"))for(s in r=t.signals,t.signals={},r)t.signals[s]=[];t.signals[n].push({obj:o,func:o[i]})},disconnect:function(t,n,e,o){var i;for(i=0;i<t.signals[n].length;i++)t.signals[n][i].obj===e&&t.signals[n][i].func===e[o]&&(t.signals[n].splice(i,1),i--)},invoke:function(t,n,o){if(void 0===t[n])throw e.UndefinedSlot;t[n].apply(t,o)},config:function(t,n){"function"==typeof t.config&&t.config(n)}};const o=e,i=function(){var t,n;this.promise=new Promise((function(e,o){t=e,n=o})),this.accept=function(){t()},this.abort=function(){n()}};let r=function(){this.promise={},this.and=function(t){return this.promise=Promise.all([this.promise,t.promise]),this},this.or=function(t){return this.promise=Promise.race([this.promise,t.promise]),this}};r.build=function(t,n){var e,o,s,c;if("string"==typeof t){var a;n.hasOwnProperty(t)?a=n[t]:n[t]=a=new i;var u=new r;return u.promise=a.promise,u}for(e=r.build(t[0],n),c=1;c<t.length;c++)t[c].hasOwnProperty("and")?(s=r.build(t[c].and,n),o=e.and(s)):t[c].hasOwnProperty("or")?(s=r.build(t[c].or,n),o=e.or(s)):console.warn("[ARCS] Illegal tree"),e=o;return e};const s=r,c=function(){function t(t,n,e,o,i,r){this.message=t,this.expected=n,this.found=e,this.offset=o,this.line=i,this.column=r,this.name="SyntaxError"}return function(t,n){function e(){this.constructor=t}e.prototype=n.prototype,t.prototype=new e}(t,Error),{SyntaxError:t,parse:function(n){var e,o=arguments.length>1?arguments[1]:{},i={},r={start:D},s=D,c=i,a=function(t,n){return[t].concat(n)},u=function(t){return{and:t}},f=function(t){return{or:t}},l=function(t){return t},h="(",p={type:"literal",value:"(",description:'"("'},d=")",v={type:"literal",value:")",description:'")"'},g=function(t){return[t]},y={type:"other",description:"id"},m=function(t){return t.trim()},C=/^[_a-zA-Z]/,w={type:"class",value:"[_a-zA-Z]",description:"[_a-zA-Z]"},S=/^[_a-zA-Z0-9]/,P={type:"class",value:"[_a-zA-Z0-9]",description:"[_a-zA-Z0-9]"},A="&",O={type:"literal",value:"&",description:'"&"'},x="|",b={type:"literal",value:"|",description:'"|"'},R=/^[ \r\n\t]/,F={type:"class",value:"[ \\r\\n\\t]",description:"[ \\r\\n\\t]"},N=0,T=0,j={line:1,column:1,seenCR:!1},k=0,L=[],E=0;if("startRule"in o){if(!(o.startRule in r))throw new Error("Can't start parsing from rule \""+o.startRule+'".');s=r[o.startRule]}function _(t){return T!==t&&(T>t&&(T=0,j={line:1,column:1,seenCR:!1}),function(t,e,o){var i,r;for(i=e;i<o;i++)"\n"===(r=n.charAt(i))?(t.seenCR||t.line++,t.column=1,t.seenCR=!1):"\r"===r||"\u2028"===r||"\u2029"===r?(t.line++,t.column=1,t.seenCR=!0):(t.column++,t.seenCR=!1)}(j,T,t),T=t),j}function U(t){N<k||(N>k&&(k=N,L=[]),L.push(t))}function Z(e,o,i){var r=_(i),s=i<n.length?n.charAt(i):null;return null!==o&&function(t){var n=1;for(t.sort((function(t,n){return t.description<n.description?-1:t.description>n.description?1:0}));n<t.length;)t[n-1]===t[n]?t.splice(n,1):n++}(o),new t(null!==e?e:function(t,n){var e,o=new Array(t.length);for(e=0;e<t.length;e++)o[e]=t[e].description;return"Expected "+(t.length>1?o.slice(0,-1).join(", ")+" or "+o[t.length-1]:o[0])+" but "+(n?'"'+function(t){function n(t){return t.charCodeAt(0).toString(16).toUpperCase()}return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,(function(t){return"\\x0"+n(t)})).replace(/[\x10-\x1F\x80-\xFF]/g,(function(t){return"\\x"+n(t)})).replace(/[\u0180-\u0FFF]/g,(function(t){return"\\u0"+n(t)})).replace(/[\u1080-\uFFFF]/g,(function(t){return"\\u"+n(t)}))}(n)+'"':"end of input")+" found."}(o,s),o,s,i,r.line,r.column)}function D(){return I()}function I(){var t,n,e,o;if(t=N,(n=z())!==i){if(e=[],(o=q())!==i)for(;o!==i;)e.push(o),o=q();else e=c;e!==i?t=n=a(n,e):(N=t,t=c)}else N=t,t=c;return t===i&&(t=z()),t}function q(){var t,n;return t=N,M()!==i&&(n=z())!==i?t=u(n):(N=t,t=c),t===i&&(t=N,B()!==i&&(n=z())!==i?t=f(n):(N=t,t=c)),t}function z(){var t,e,o,r;return t=N,(e=V())!==i&&(e=l(e)),(t=e)===i&&(t=N,40===n.charCodeAt(N)?(e=h,N++):(e=i,0===E&&U(p)),e!==i&&(o=I())!==i?(41===n.charCodeAt(N)?(r=d,N++):(r=i,0===E&&U(v)),r!==i?t=e=g(o):(N=t,t=c)):(N=t,t=c)),t}function V(){var t,e,o;return E++,t=N,e=N,(o=J())!==i&&(o=n.substring(e,N)),(e=o)!==i&&(e=m(e)),E--,(t=e)===i&&(e=i,0===E&&U(y)),t}function J(){var t,e,o,r,s;if(t=N,(e=G())!==i)if(C.test(n.charAt(N))?(o=n.charAt(N),N++):(o=i,0===E&&U(w)),o!==i){for(r=[],S.test(n.charAt(N))?(s=n.charAt(N),N++):(s=i,0===E&&U(P));s!==i;)r.push(s),S.test(n.charAt(N))?(s=n.charAt(N),N++):(s=i,0===E&&U(P));r!==i&&(s=G())!==i?t=e=[e,o,r,s]:(N=t,t=c)}else N=t,t=c;else N=t,t=c;return t}function M(){var t,e,o,r;return t=N,(e=G())!==i?(38===n.charCodeAt(N)?(o=A,N++):(o=i,0===E&&U(O)),o!==i&&(r=G())!==i?t=e=[e,o,r]:(N=t,t=c)):(N=t,t=c),t}function B(){var t,e,o,r;return t=N,(e=G())!==i?(124===n.charCodeAt(N)?(o=x,N++):(o=i,0===E&&U(b)),o!==i&&(r=G())!==i?t=e=[e,o,r]:(N=t,t=c)):(N=t,t=c),t}function G(){var t,e;for(t=[],R.test(n.charAt(N))?(e=n.charAt(N),N++):(e=i,0===E&&U(F));e!==i;)t.push(e),R.test(n.charAt(N))?(e=n.charAt(N),N++):(e=i,0===E&&U(F));return t}if((e=s())!==i&&N===n.length)return e;throw e!==i&&N<n.length&&U({type:"end",description:"end of input"}),Z(null,L,k)}}}(),a=o.create((function(t){var n="",e="",o={},i="",r=this,a={},u={},f=function(t){var n;r.slots.indexOf(t)<0&&(r.slots.push(t),r[t]=(n=t,function(){r.setToken(n)}))},l=function(t){var n;if(o.hasOwnProperty(t))for(n in u={},o[t])o[t].hasOwnProperty(n)&&s.build(a[n],u).promise.then((function(){var e;for(e in u)u.hasOwnProperty(e)&&u[e].abort();l(o[t][n])}));i=t,r.emit("requestSheet",i),i===e&&r.emit("requestTermination")};this.setInitialState=function(t){i=n=t},this.setFinalState=function(t){e=t},this.addTransition=function(t,n,e){var i,r=/([A-Za-z_]\w*)/g;try{var s;if("string"==typeof(s=c.parse(n)))f(s);else for(;null!==(i=r.exec(n));)f(i[0]);a[n]=s,void 0===o[t]&&(o[t]={}),o[t][n]=e}catch(t){}},this.setToken=function(t){u.hasOwnProperty(t)&&u[t].accept()},this.setTransitions=function(t){var n,e;for(n in t)if(t.hasOwnProperty(n))for(e in t[n])t[n].hasOwnProperty(e)&&this.addTransition(n,e,t[n][e])},this.start=function(){l(n)},void 0!==t&&(n=t.initial,e=t.final,this.setTransitions(t.transitions),i="")}),["setToken"],["requestSheet","requestTermination"]);let u=function(t){var n={},e={},o={},i=[],r=this;if(o.StateMachine=a,void 0!==t){var s;for(s in i=t.libraries,t.components)t.components.hasOwnProperty(s)&&(n[s]=t.components[s]);if(void 0!==t.constants)for(s in t.constants)t.constants.hasOwnProperty(s)&&(e[s]=t.constants[s])}var c=async function(t){return y()?new Promise((function(n,e){var o=require(t);void 0!==o?n(o):e("[ARCS] File not found")})):(await fetch(t)).json()},f=function(){var t,r=[];for(t in n)if(n.hasOwnProperty(t)){if(void 0===o[n[t].type])return console.error("[ARCS] Factory "+n[t].type+" not found."),void console.error("[ARCS] Context dump follows: ",i,n,e);var s=o[n[t].type];try{void 0!==n[t].value||void 0!==n[t].url||void 0!==n[t].ref?(void 0!==n[t].value&&(n[t].instance=new s(n[t].value)),void 0!==n[t].url&&(console.log("loading data file",n[t].url),r.push(c(n[t].url).then(function(t,e){return function(o){return console.log("instanciating from data file"),n[t].instance=new e(o),Promise.resolve()}}(t,s)))),void 0!==n[t].ref&&void 0!==e[n[t].ref]&&(n[t].instance=new s(e[n[t].ref]))):n[t].instance=new s}catch(n){console.error("[ARCS] Component of type ",t," not instanciated.",n)}}return Promise.all(r)};this.loadLibrary=function(t,n){var e=t,o=t;return u.currentContext=r,"string"!=typeof t&&(o=t.name,e=t.url),i.indexOf(o)<0&&i.push(o),import(e).then((function(t){for(s in t.default)t.default.hasOwnProperty(s)&&u.currentContext.setFactory(s,t.default[s]);void 0!==n&&n()})).catch((function(t){console.error("[ARCS] Trouble loading '",e,"' with reason -",{msg:t})}))},this.getComponentList=function(){var t,e=Object.keys(n);for(t=0;t<e.length;t++)n.hasOwnProperty(e[t])||e.splice(t--,1);return e},this.getConstant=function(t){return e[t]},this.getComponentType=function(t){if(void 0!==n[t])return n[t].type},this.getComponentValue=function(t){if(void 0!==n[t])return n[t].value},this.getComponent=function(t){if(void 0!==n[t])return n[t].instance},this.getComponentName=function(t){var e,o;for(o=n.getComponentList(),e=0;e<o.length;e++)if(n[o[e]].instance===t)return o[e]},this.setFactory=function(t,n){o[t]=n},this.toJSON=function(){var t,e={};for(t in n)n.hasOwnProperty(t)&&(e[t]={type:n[t].type,value:n[t].value});return e},this.setComponentValue=function(t,e){n[t].value=e},this.addComponent=function(t,e,i){var r;n[t]={},n[t].type=e,n[t].value=i;var s=o[e];void 0!==s&&(r=new s(i)),n[t].instance=r},this.removeComponent=function(t){delete n[t]},this.getFactory=function(t){return o[t]},this.getFactoryList=function(){return Object.keys(o)},this.instanciate=function(){return function(){var t;u.currentContext=r;var n=[];for(t=0;t<i.length;t++)n.push(r.loadLibrary(i[t]));return Promise.all(n)}().then(f).catch((function(t){console.error("[ARCS] Trouble instanciating context",t)}))};var l=function(t,n){var e,o=Object.create(n);for(e in t)t.hasOwnProperty(e)&&(o[e]=t[e]);return o};this.chain=function(t,i,r){return[l(t,n),l(i,e),l(r,o)]},this.setParent=function(t){if(void 0!==t){var i=t.chain(n,e,o);n=i[0],e=i[1],o=i[2]}}};u.currentContext=null;const f=u;let l=function(t,n,e){this.getDestination=function(){return t},this.getSlot=function(){return n},this.getValue=function(){return e},this.invoke=function(){var o=t[n];void 0!==o?o.apply(t,e):console.error("Undefined slot %s of component %s",n,t)}};l.cast=function(t,n){if(void 0!==t.value){var e=n.getComponent(t.destination);return void 0===e&&console.error("[ARCS] Destination ",t.destination," is undefined"),new l(e,t.slot,t.value)}if(void 0!==t.ref)return new l(n.getComponent(t.destination),t.slot,n.getConstant(t.ref))},l.PRE_CONNECTION=0,l.POST_CONNECTION=1,l.CLEAN_UP=2;const h=l;let p=function(t,n,e,i){this.connect=function(){try{o.connect(t,n,e,i)}catch(o){console.log(o,t,n,e,i)}},this.disconnect=function(){o.disconnect(t,n,e,i)},this.getSource=function(){return t},this.getDestination=function(){return e},this.getSlot=function(){return i},this.getSignal=function(){return n}};p.cast=function(t,n){return new p(n.getComponent(t.source),t.signal,n.getComponent(t.destination),t.slot)};const d=p,v=function(t){var n,e,o,i,r,s=new f,c=[],a=[],u=[],l=[],p=0,v=0,g=0,y=0;n=function(){var t;for(t=0;t<c.length;t++)c[t].invoke()},e=function(){var t;for(t=0;t<a.length;t++)a[t].invoke()},o=function(){var t;for(t=0;t<u.length;t++)u[t].invoke()},i=function(){var t;for(t=0;t<l.length;t++)l[t].connect()},r=function(){var t;for(t=0;t<l.length;t++)l[t].disconnect()},this.setContext=function(t){s=t},this.activate=function(){s.instanciate().then((function(){n(),i(),e()}))},this.deactivate=function(){r(),o()},this.addPreConnection=function(t){var n=h.cast(t,s);return n.id=p++,c.push(n),n.id},this.addPostConnection=function(t){var n=h.cast(t,s);return n.id=v++,a.push(n),n.id},this.addCleanup=function(t){var n=h.cast(t,s);return n.id=g++,u.push(n),n.id},this.addConnection=function(t){var n=d.cast(t,s);return n.id=y++,l.push(n),n.id};var m=function(t,n){for(var e=n.length;e--&&n[e].id!==t;);e>=0?n.splice(e,1):console.warn("Could not remove data with id",t)};this.removePreConnection=function(t){m(t,c)},this.removePostConnection=function(t){m(t,a)},this.removeCleanup=function(t){m(t,u)};var C=function(t,n,e){for(var o=e.length;o--&&e[o].id!==t;);o>=0&&(e[o].value=n)};this.changePreConnection=function(t,n){C(t,n,c)},this.changePostConnection=function(t,n){C(t,n,a)},this.changeCleanup=function(t,n){C(t,n,u)},this.removeConnection=function(t){m(t,l)};var w=function(t,n,e){for(var o,i=e.length,r=e.length;i--&&e[i].id!==t;);for(;r--&&e[r].id!==n;);i>=0&&r>=0&&(o=e[i],e[i]=e[r],e[r]=o,e[i].id=t,e[r].id=n)};this.swapConnections=function(t,n){w(t,n,l)},this.swapCleanups=function(t,n){w(t,n,u)},this.swapPreConnections=function(t,n){w(t,n,c)},this.swapPostConnections=function(t,n){w(t,n,a)},this.import=function(n){n.hasOwnProperty("context")&&(s=new f(n.context)).setParent(t),s.instanciate().then((function(){!function(t){var n=0,e=h.cast,o=d.cast;for(n=0;n<t.preconnections.length;n++)c.push(e(t.preconnections[n],s));for(n=0;n<t.postconnections.length;n++)a.push(e(t.postconnections[n],s));for(n=0;n<t.cleanups.length;n++)u.push(e(t.cleanups[n],s));for(n=0;n<t.connections.length;n++)l.push(o(t.connections[n],s))}(n)}))};var S=function(t){return{destination:s.getComponentName(t.getDestination()),slot:t.getSlot(),value:t.getValue()}};this.toJSON=function(){var t,n,e=[],o=[],i=[],r=[];for(t=0;t<l.length;t++)i.push((n=l[t],{source:s.getComponentName(n.getSource()),signal:n.getSignal(),destination:s.getComponentName(n.getDestination()),slot:n.getSlot()}));for(t=0;t<c.length;t++)e.push(S(c[t]));for(t=0;t<a.length;t++)o.push(S(a[t]));for(t=0;t<u.length;t++)r.push(S(u[t]));return{preconnections:e,postconnections:o,connections:i,cleanups:r}},s.setParent(t)};let g=function(){var t,n=new f,e={},i={},r=[],s=this,c="";this.export=function(){return{context:n,controller:n.getComponentName(i),sheets:e}},this.getContext=function(){return n},this.getSheetList=function(){return Object.keys(e)},this.getSheet=function(t){return e[t]},this.addSheet=function(t,o){e[t]=o,o.setContext(n)},this.removeSheet=function(t){delete e[t]},t=function(){var t,r,c;for(r=n.getComponent(i),i=r,c=Object.keys(e),t=0;t<c.length;t++)(r=new v(n)).import(e[c[t]],n),e[c[t]]=r;o.connect(i,"requestSheet",s,"setSheet"),o.connect(i,"requestTermination",s,"finish"),i.start()},this.setController=function(t){i=n.getComponent(t)},this.setSheet=function(t){e.hasOwnProperty(t)?(c&&e[c].deactivate(),e[c=t].activate()):console.warn("[ARCS] Tried to activate hollow sheet named: "+t)},this.finish=function(){c&&e[c].deactivate()},this.import=function(t){n=new f(t.context),e=t.sheets,void 0===(i=t.controller)&&console.error("[ARCS] Undefined controller. Cannot start application.")},this.setFactory=function(t,n){factories[t]=n},this.setDependency=function(t){r[t]={}},this.start=function(){console.log("[ARCS] Starting application..."),n.instanciate().then(t)}};g.setDependency=function(t,n){t.setDependency(n)},o.create(g),g.slot("setSheet"),g.slot("finish");const y={Component:o,isInNode:function(){return"undefined"!=typeof process&&-1!==process.release.name.search(/node|io.js/)},StateMachine:a,Context:f,Invocation:h,Connection:d,Sheet:v,Application:g};var m=n.Z;export{m as default}; | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
build/arcs_browser.js
0 → 100644
1 | + | ||
2 | +/** | ||
3 | + * Bootstrap for the ARCS engine in a browser environment. | ||
4 | + * It relies on require.js to get the job done. | ||
5 | + * @file | ||
6 | + */ | ||
7 | +"use strict"; | ||
8 | + | ||
9 | +// basically, here we start by importing the module ARCS | ||
10 | +//import ARCS from './exports.js'; | ||
11 | +import ARCS from "./arcs.js"; | ||
12 | + | ||
13 | +console.log("[ARCS] Bootstrapping..."); | ||
14 | + | ||
15 | +var baseUrl, appDescription, requireMarkup, xhr; | ||
16 | + | ||
17 | +requireMarkup = document.querySelector('[data-arcsapp]'); | ||
18 | +if (requireMarkup !== undefined) { | ||
19 | + baseUrl = requireMarkup.dataset.baseUrl ; | ||
20 | + appDescription = requireMarkup.dataset.arcsapp || "arcsapp.json"; | ||
21 | +} | ||
22 | + | ||
23 | + | ||
24 | +(async function toto() { | ||
25 | +var description = await(fetch(appDescription)); | ||
26 | +var applicationObject = await(description.json()); | ||
27 | + | ||
28 | + | ||
29 | +console.log("[ARCS] Application description loaded"); | ||
30 | + | ||
31 | +var aap = new ARCS.Application(); | ||
32 | +aap.import(applicationObject); | ||
33 | +aap.start(); | ||
34 | +})(); |
... | @@ -10,7 +10,7 @@ | ... | @@ -10,7 +10,7 @@ |
10 | "main": "build/arcs.js", | 10 | "main": "build/arcs.js", |
11 | "scripts": { | 11 | "scripts": { |
12 | "test": "echo \"Error: no test specified\" && exit 1" | 12 | "test": "echo \"Error: no test specified\" && exit 1" |
13 | - }, | 13 | + }, |
14 | "keywords": [ | 14 | "keywords": [ |
15 | "Augmented", | 15 | "Augmented", |
16 | "Reality" | 16 | "Reality" |
... | @@ -30,10 +30,12 @@ | ... | @@ -30,10 +30,12 @@ |
30 | "author": "Jean-Yves Didier", | 30 | "author": "Jean-Yves Didier", |
31 | "license": "GPL-3.0-or-later", | 31 | "license": "GPL-3.0-or-later", |
32 | "dependencies": { | 32 | "dependencies": { |
33 | - "tracking": ">=1.1.3", | 33 | + "codemirror": ">=5.62", |
34 | - "three": ">=0.131", | 34 | + "eslint": "^7.32.0", |
35 | "js-aruco": ">=0.1", | 35 | "js-aruco": ">=0.1", |
36 | - "codemirror": ">=5.62" | 36 | + "three": ">=0.131", |
37 | + "tracking": ">=1.1.3", | ||
38 | + "webpack": "^5.51.1" | ||
37 | }, | 39 | }, |
38 | "devDependencies": { | 40 | "devDependencies": { |
39 | "copy-webpack-plugin": "^9.0.1", | 41 | "copy-webpack-plugin": "^9.0.1", | ... | ... |
1 | -// ARCS.js : 27/6/2014 16:00 | 1 | +// no longer needed with the use of imports |
2 | -// handling dependencies | 2 | + |
3 | - | 3 | +import Component from './component.js'; |
4 | - | 4 | +import StateMachine from './statemachine.js'; |
5 | -//"use strict"; | 5 | +import isInNode from './isinnode.js'; |
6 | - | 6 | +import Context from './context.js'; |
7 | - | 7 | +import Invocation from './invocation.js'; |
8 | - | 8 | +import Connection from './connection.js'; |
9 | - | 9 | +import Sheet from './sheet.js'; |
10 | -/** | 10 | +import Application from './application.js'; |
11 | - * Main source: describes all the methods needed by the ARCS engine | 11 | + |
12 | - * @file | 12 | +let ARCS = { |
13 | - */ | 13 | + Component: Component, |
14 | - | 14 | + isInNode : isInNode, |
15 | - | 15 | + StateMachine: StateMachine, |
16 | -/****************************************************************************** | 16 | + Context: Context, |
17 | - * Helper functions to determine environment | 17 | + Invocation: Invocation, |
18 | - * ***************************************************************************/ | 18 | + Connection: Connection, |
19 | - | 19 | + Sheet: Sheet, |
20 | -/** | 20 | + Application: Application |
21 | - * @return {boolean} true if ARCS is run in a node.js environment | ||
22 | - */ | ||
23 | - | ||
24 | -export default function isInNode() { | ||
25 | - return (typeof process !== 'undefined') && | ||
26 | - (process.release.name.search(/node|io.js/) !== -1); | ||
27 | - | ||
28 | - // return (typeof require === 'function' && require.resolve); | ||
29 | }; | 21 | }; |
30 | 22 | ||
23 | +export default ARCS; | ... | ... |
src/exports.js
deleted
100644 → 0
1 | -// no longer needed with the use of imports | ||
2 | - | ||
3 | -import Component from './component.js'; | ||
4 | -import StateMachine from './statemachine.js'; | ||
5 | -import isInNode from './arcs.js'; | ||
6 | -import Context from './context.js'; | ||
7 | -import Invocation from './invocation.js'; | ||
8 | -import Connection from './connection.js'; | ||
9 | -import Sheet from './sheet.js'; | ||
10 | -import Application from './application.js'; | ||
11 | - | ||
12 | -let ARCS = { | ||
13 | - Component: Component, | ||
14 | - isInNode : isInNode, | ||
15 | - StateMachine: StateMachine, | ||
16 | - Context: Context, | ||
17 | - Invocation: Invocation, | ||
18 | - Connection: Connection, | ||
19 | - Sheet: Sheet, | ||
20 | - Application: Application | ||
21 | -}; | ||
22 | - | ||
23 | -export default ARCS; |
src/isinnode.js
0 → 100644
1 | +// ARCS.js : 27/6/2014 16:00 | ||
2 | +// handling dependencies | ||
3 | + | ||
4 | + | ||
5 | +//"use strict"; | ||
6 | + | ||
7 | + | ||
8 | + | ||
9 | + | ||
10 | +/** | ||
11 | + * Main source: describes all the methods needed by the ARCS engine | ||
12 | + * @file | ||
13 | + */ | ||
14 | + | ||
15 | + | ||
16 | +/****************************************************************************** | ||
17 | + * Helper functions to determine environment | ||
18 | + * ***************************************************************************/ | ||
19 | + | ||
20 | +/** | ||
21 | + * @return {boolean} true if ARCS is run in a node.js environment | ||
22 | + */ | ||
23 | + | ||
24 | +export default function isInNode() { | ||
25 | + return (typeof process !== 'undefined') && | ||
26 | + (process.release.name.search(/node|io.js/) !== -1); | ||
27 | + | ||
28 | + // return (typeof require === 'function' && require.resolve); | ||
29 | +}; | ||
30 | + |
... | @@ -11,7 +11,7 @@ module.exports = [ | ... | @@ -11,7 +11,7 @@ module.exports = [ |
11 | }, | 11 | }, |
12 | entry: { | 12 | entry: { |
13 | 'arcs' : { | 13 | 'arcs' : { |
14 | - import : './src/exports.js', | 14 | + import : './src/arcs.js', |
15 | }, | 15 | }, |
16 | }, | 16 | }, |
17 | mode: 'none', | 17 | mode: 'none', |
... | @@ -46,7 +46,7 @@ module.exports = [ | ... | @@ -46,7 +46,7 @@ module.exports = [ |
46 | }, | 46 | }, |
47 | entry: { | 47 | entry: { |
48 | 'arcs' : { | 48 | 'arcs' : { |
49 | - import : './src/exports.js', | 49 | + import : './src/arcs.js', |
50 | }, | 50 | }, |
51 | }, | 51 | }, |
52 | mode: 'production', | 52 | mode: 'production', |
... | @@ -163,20 +163,6 @@ module.exports = [ | ... | @@ -163,20 +163,6 @@ module.exports = [ |
163 | 163 | ||
164 | /*** parts of gruntfile not processed yet | 164 | /*** parts of gruntfile not processed yet |
165 | 165 | ||
166 | - - minification with probably some custom targets | ||
167 | - | ||
168 | - files: { | ||
169 | - 'build/arcs.min.js': [ | ||
170 | - 'build/arcs.js' | ||
171 | - ], | ||
172 | - 'build/arcs_browser.min.js': [ | ||
173 | - 'src/arcs_browser.js' | ||
174 | - ], | ||
175 | - 'build/arcseditor.min.js': [ | ||
176 | - 'build/arcseditor.js' | ||
177 | - ] | ||
178 | - } | ||
179 | - | ||
180 | - editor (to rebuild from scratch) | 166 | - editor (to rebuild from scratch) |
181 | 167 | ||
182 | editor : { | 168 | editor : { | ... | ... |
-
Please register or login to post a comment