qcobjects 2.4.39 → 2.4.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/QCObjects.js +596 -494
  2. package/VERSION +1 -1
  3. package/package.json +1 -1
package/QCObjects.js CHANGED
@@ -1959,66 +1959,98 @@
1959
1959
  return validRoutingWays.includes(routingWay);
1960
1960
  };
1961
1961
 
1962
- _top.__oldpopstate = _top.onpopstate;
1963
- _top._bindroute_ = function () {
1964
- {
1965
- if (isBrowser) {
1966
- if (!_top._bindroute_.__assigned) {
1967
- document.addEventListener("componentsloaded", function (e) {
1968
- e.stopImmediatePropagation();
1969
- e.stopPropagation();
1970
- if (!_top._bindroute_.__assigned) {
1971
-
1972
- _top.onpopstate = function (e) {
1973
- e.stopImmediatePropagation();
1974
- e.stopPropagation();
1975
- ClassFactory("Component").route();
1976
- if (typeof e.target.__oldpopstate !== "undefined" && typeof e.target.__oldpopstate === "function") {
1977
- e.target.__oldpopstate.call(e.target, e);
1978
- }
1979
- };
1980
- Tag("a").map(function (a) {
1981
- a.oldclick = a.onclick;
1982
- a.onclick = function (e) {
1983
- var _ret_ = true;
1984
- if (!_top.global.get("routingPaths")) {
1985
- _top.global.set("routingPaths", []);
1986
- }
1987
- var routingWay = _top.CONFIG.get("routingWay");
1988
- var routingPath = e.target[routingWay];
1989
- if (_top.global.get("routingPaths").includes(routingPath) &&
1990
- e.target[routingWay] !== document.location[routingWay] &&
1991
- e.target.href !== document.location.href
1992
- ) {
1993
- logger.debug("A ROUTING WAS FOUND: " + routingPath);
1994
- window.history.pushState({
1995
- href: e.target.href
1996
- }, e.target.href, e.target.href);
1997
- ClassFactory("Component").route();
1998
- _ret_ = false;
1999
- } else {
2000
- logger.debug("NO ROUTING FOUND FOR: " + routingPath);
2001
- }
2002
- if (typeof e.target.oldclick !== "undefined" && typeof e.target.oldclick === "function") {
2003
- e.target.oldclick.call(e.target, e);
2004
- }
2005
- return _ret_;
2006
- };
2007
- return null;
2008
- });
1962
+ var _buildComponentFromElement_ = function (element, __parent__){
1963
+ var __shadowed_not_set = (element.getAttribute("shadowed") === null) ? (true) : (false);
1964
+ var __tplsource_attr_not_set = (element.getAttribute("template-source") === null) ? (true) : (false);
1965
+ var shadowed = (element.getAttribute("shadowed") === "true") ? (true) : (false);
1966
+ var __cached_not_set = (element.getAttribute("cached") === null) ? (true) : (false);
1967
+ var cached = (element.getAttribute("cached") === "true") ? (true) : (false);
1968
+ var tplextension = (typeof _top.CONFIG.get("tplextension") !== "undefined") ? (_top.CONFIG.get("tplextension")) : ("html");
1969
+ tplextension = (element.getAttribute("tplextension") !== null) ? (element.getAttribute("tplextension")) : (tplextension);
1970
+ var _componentName = element.getAttribute("name");
1971
+ var _componentClassName = (element.getAttribute("componentClass") !== null) ? (element.getAttribute("componentClass")) : ("Component");
1972
+ let __componentClassName = (_top.CONFIG.get("preserveComponentBodyTag")) ? (
1973
+ (_componentName !== null) ? ("com.qcobjects.components." + _componentName + ".ComponentBody") : ("com.qcobjects.components.ComponentBody")
1974
+ ) : (_componentClassName);
1975
+ _componentName = (_componentName !== null) ? (_componentName) : (
1976
+ (ClassFactory(__componentClassName) &&
1977
+ typeof ClassFactory(__componentClassName).name !== "undefined"
1978
+ ) ? (
1979
+ ClassFactory(__componentClassName).name
1980
+ ) : ("")
1981
+ );
1982
+ var __classDefinition = ClassFactory(__componentClassName);
1983
+ var __tplsource_prop_set = (__componentClassName !== "Component" && ((typeof __classDefinition !== "undefined" && typeof __classDefinition.tplsource === "string") && __classDefinition.tplsource !== "")) ? (true) : (false);
1984
+ var tplsource = (__tplsource_attr_not_set && __tplsource_prop_set) ? (__classDefinition.tplsource) : ((__tplsource_attr_not_set) ? ("default") : (element.getAttribute("template-source")));
1985
+ logger.debug(`template source for ${_componentName} is ${tplsource} `);
1986
+ logger.debug(`type for ${_componentName} is ${__getType__(__classDefinition)} `);
1987
+
1988
+ var componentURI;
1989
+ componentURI = ComponentURI({
1990
+ "COMPONENTS_BASE_PATH": _top.CONFIG.get("componentsBasePath"),
1991
+ "COMPONENT_NAME": _componentName,
1992
+ "TPLEXTENSION": tplextension,
1993
+ "TPL_SOURCE": tplsource
1994
+ });
1995
+ if (_top.CONFIG.get("preserveComponentBodyTag")) {
1996
+ Package((_componentName !== "") ? ("com.qcobjects.components." + _componentName + "") : ("com.qcobjects.components"), [
1997
+ Class("ComponentBody", ClassFactory("Component"), {
1998
+ name: _componentName,
1999
+ tplsource: tplsource,
2000
+ tplextension: tplextension,
2001
+ reload: true
2002
+ })
2003
+ ]);
2004
+ }
2009
2005
 
2006
+ var __create_component_instance_ = function () {
2007
+ var __shadowed = (__shadowed_not_set) ? ((__classDefinition && __classDefinition.shadowed) || ClassFactory("Component").shadowed) : (shadowed);
2008
+ var __definition = {
2009
+ __parent__: __parent__,
2010
+ name: _componentName,
2011
+ cached: (__cached_not_set) ? (ClassFactory("Component").cached) : (cached),
2012
+ shadowed: __shadowed,
2013
+ tplextension: tplextension,
2014
+ body: (_top.CONFIG.get("preserveComponentBodyTag")) ? (_DOMCreateElement("componentBody")) : (element),
2015
+ templateURI: componentURI,
2016
+ tplsource: tplsource
2017
+ };
2018
+ if (typeof _componentName === "undefined" || _componentName === "" || _componentName === null) {
2019
+ /* this allows to use the original property defined
2020
+ in the component definition if it is not present in the tag */
2021
+ delete __definition.name;
2022
+ }
2023
+ if (componentURI === "") {
2024
+ /* this allows to use the original property defined
2025
+ in the component definition if it is not present in the tag */
2026
+ delete __definition.templateURI;
2027
+ }
2028
+ var newComponent = New(__classDefinition, __definition);
2010
2029
 
2011
- _top._bindroute_.__assigned = true;
2012
- Object.freeze(_top._bindroute_);
2013
- }
2014
- }, captureFalse);
2030
+ if (_top.CONFIG.get("preserveComponentBodyTag")) {
2031
+ element.append(newComponent);
2015
2032
  }
2016
- } else {
2017
- // not yet implemented.
2018
- }
2033
+ return newComponent;
2034
+ };
2035
+ var newComponent = __create_component_instance_.call(this);
2036
+ return newComponent;
2037
+ };
2038
+
2039
+ var _buildComponentsFromElements_ = function (elements, __parent__) {
2040
+ var componentsBuiltWith = [];
2041
+ if (isBrowser){
2042
+ componentsBuiltWith = elements.map(
2043
+ function(element){
2044
+ return _buildComponentFromElement_(element, __parent__);
2045
+ }
2046
+ );
2047
+ } else {
2048
+ logger.debug("[_buildComponentsFromElements_] not implemented for Non-Browser environments");
2019
2049
  }
2050
+ return componentsBuiltWith;
2020
2051
  };
2021
2052
 
2053
+
2022
2054
  Package("com.qcobjects", [
2023
2055
  class Component extends ClassFactory("InheritClass") {
2024
2056
  validRoutingWays= ["pathname", "hash", "search"];
@@ -2030,6 +2062,7 @@
2030
2062
  routingNodes= [];
2031
2063
  routings= [];
2032
2064
  routingPath= "";
2065
+ routingPaths=[];
2033
2066
  _componentHelpers= [];
2034
2067
  subcomponents=[];
2035
2068
  splashScreenComponent=undefined;
@@ -2050,8 +2083,7 @@
2050
2083
  __shadowRoot,
2051
2084
  body,
2052
2085
  shadowRoot,
2053
- splashScreenComponent,
2054
- subcomponents
2086
+ splashScreenComponent
2055
2087
  }){
2056
2088
  super(...arguments);
2057
2089
  var self = this;
@@ -2065,25 +2097,33 @@
2065
2097
  self.processorHandler = New(ClassFactory("Processor"), {
2066
2098
  component: self
2067
2099
  });
2068
-
2069
- if (typeof self.__new__ === "function") {
2070
- self.__new__.call(self, self);
2071
- }
2072
2100
 
2073
- self._generateRoutingPaths(self.body)
2074
- .then(function (){
2075
- self._reroute_()
2076
- .then(function () {
2077
- return self.rebuild()
2078
- .then(function () {
2079
- logger.info(`Component._new_ The component ${self.name} was built successfully!`);
2080
- }).catch(function (standardResponse) {
2081
- logger.warn(`Component._new_ Something went wrong building the component ${self.name}`);
2082
- console.error(standardResponse);
2083
- });
2101
+ /* assign body data attributes to data */
2102
+ self.data = (typeof self.data === "undefined" || self.data === null)?({}):(self.data);
2103
+ self.data = Object.assign(self.data, self.dataAttributes);
2104
+
2105
+ self.createServiceInstance()
2106
+ .then(function (serviceResponse){
2107
+ if (typeof self.__new__ === "function") {
2108
+ self.__new__.call(self, self);
2109
+ }
2110
+
2111
+ self._generateRoutingPaths(self.body)
2112
+ .then(function (){
2113
+ self._reroute_()
2114
+ .then(function () {
2115
+ return self.rebuild()
2116
+ .then(function () {
2117
+ logger.info(`Component._new_ The component ${self.name} was built successfully!`);
2118
+ }).catch(function (standardResponse) {
2119
+ logger.warn(`Component._new_ Something went wrong building the component ${self.name}`);
2120
+ console.error(standardResponse);
2121
+ });
2122
+ });
2084
2123
  });
2124
+
2085
2125
  });
2086
-
2126
+
2087
2127
  }
2088
2128
 
2089
2129
  set body(value) {
@@ -2158,6 +2198,122 @@
2158
2198
  return Object.assign(accumulator, colData);
2159
2199
  });
2160
2200
  }
2201
+
2202
+ createServiceInstance (){
2203
+ var component = this;
2204
+ var body = component.body;
2205
+ var data = this.data;
2206
+ var __serviceClass;
2207
+ var __classDefinition = component.getClass().__definition;
2208
+ var _serviceClassName = (body.getAttribute("serviceClass") !== null) ? (body.getAttribute("serviceClass")) : (null);
2209
+
2210
+ return new Promise (function (resolve, reject){
2211
+ /* __enable_service_class__ = true by default */
2212
+ var __enable_service_class__ = (
2213
+ (Object.hasOwnProperty.call(body, "enableServiceClass") && body.enableServiceClass) ||
2214
+ (!Object.hasOwnProperty.call(body, "enableServiceClass"))
2215
+ ) ? (true) : (false);
2216
+ var _response_to_data_ = (body.getAttribute("response-to") !== null && body.getAttribute("response-to") === "data") ? (true) : (false);
2217
+ var _response_to_template_ = (body.getAttribute("response-to") !== null && body.getAttribute("response-to") === "template") ? (true) : (false);
2218
+
2219
+ if (__enable_service_class__ && _serviceClassName !== null) {
2220
+ __serviceClass = ClassFactory(_serviceClassName);
2221
+ }
2222
+ if (!_response_to_data_ && __classDefinition && Object.hasOwnProperty.call(__classDefinition, "responseTo")) {
2223
+ _response_to_data_ = (__classDefinition.responseTo === "data") ? (true) : (false);
2224
+ } else if (!_response_to_data_ && Object.hasOwnProperty.call(ClassFactory("Component"), "responseTo")) {
2225
+ _response_to_data_ = (ClassFactory("Component").responseTo === "data") ? (true) : (false);
2226
+ }
2227
+ if (!_response_to_template_ && __classDefinition && Object.hasOwnProperty.call(__classDefinition, "responseTo")) {
2228
+ _response_to_template_ = (__classDefinition.responseTo === "template") ? (true) : (false);
2229
+ } else if (!_response_to_template_ && Object.hasOwnProperty.call(ClassFactory("Component"), "responseTo")) {
2230
+ _response_to_template_ = (ClassFactory("Component").responseTo === "template") ? (true) : (false);
2231
+ }
2232
+
2233
+ if (typeof __serviceClass !== "undefined" &&
2234
+ (typeof __enable_service_class__ !== "undefined" &&
2235
+ __enable_service_class__ === true) &&
2236
+ (_response_to_data_ || _response_to_template_)
2237
+ ) {
2238
+ logger.info("Loading service " + _serviceClassName);
2239
+ var serviceInstance = New(__serviceClass, {
2240
+ data: data
2241
+ });
2242
+ serviceLoader(serviceInstance).then(function ({
2243
+ request,
2244
+ service
2245
+ }) {
2246
+ var serviceResponse = service.template;
2247
+ if (_response_to_data_) {
2248
+ if (typeof data === "object" && typeof serviceResponse === "object") {
2249
+ data = Object.assign(data, serviceResponse);
2250
+ } else {
2251
+ data = serviceResponse;
2252
+ }
2253
+ }
2254
+ component.serviceInstance = serviceInstance;
2255
+ component.serviceData = data;
2256
+
2257
+ if (_response_to_template_) {
2258
+ component.template = serviceResponse;
2259
+ }
2260
+ resolve (serviceResponse);
2261
+ }, function (rejectedResponse){
2262
+ reject (rejectedResponse);
2263
+ } ).catch(function (e) {
2264
+ logger.debug("Something went wroing while trying to load the service " + _serviceClassName);
2265
+ throw Error (`Error loading ${_serviceClassName} for ${component.name}. Detail: ${e}`);
2266
+ });
2267
+ } else {
2268
+ resolve(null);
2269
+ }
2270
+ });
2271
+ }
2272
+
2273
+ _bindroute_ () {
2274
+ var _component_ = this;
2275
+ if (!_component_._bindroute_.loaded){
2276
+ if (isBrowser) {
2277
+
2278
+ _component_.hostElements("a").map(function (a) {
2279
+ a.oldclick = a.onclick;
2280
+ a.onclick = function (e) {
2281
+ var _ret_ = true;
2282
+ if (!_top.global.get("routingPaths")) {
2283
+ _top.global.set("routingPaths", []);
2284
+ }
2285
+ var routingWay = _top.CONFIG.get("routingWay");
2286
+ var routingPath = e.target[routingWay];
2287
+ if (_top.global.get("routingPaths").includes(routingPath) &&
2288
+ e.target[routingWay] !== document.location[routingWay] &&
2289
+ e.target.href !== document.location.href
2290
+ ) {
2291
+ logger.debug("A ROUTING WAS FOUND: " + routingPath);
2292
+ window.history.pushState({
2293
+ href: e.target.href
2294
+ }, e.target.href, e.target.href);
2295
+ ClassFactory("Component").route();
2296
+ _ret_ = false;
2297
+ } else {
2298
+ logger.debug("NO ROUTING FOUND FOR: " + routingPath);
2299
+ }
2300
+ if (typeof e.target.oldclick !== "undefined" && typeof e.target.oldclick === "function") {
2301
+ e.target.oldclick.call(e.target, e);
2302
+ }
2303
+ return _ret_;
2304
+ };
2305
+ return null;
2306
+ });
2307
+
2308
+ } else {
2309
+ // not yet implemented.
2310
+ }
2311
+ this._bindroute_.loaded = true;
2312
+ } else {
2313
+ logger.debug(`Routes already bound to popstate events for ${_component_.name}`);
2314
+ }
2315
+
2316
+ }
2161
2317
 
2162
2318
  done(standardResponse) {
2163
2319
  var _ret_;
@@ -2167,6 +2323,123 @@
2167
2323
  }
2168
2324
  return _ret_;
2169
2325
  }
2326
+
2327
+ __done__ () {
2328
+ var _component_ = this;
2329
+ var componentDone = function () {
2330
+ if (typeof _component_ === "undefined") {
2331
+ throw new Error("componentDone() has lost its context");
2332
+ }
2333
+ if (typeof _component_.body === "undefined") {
2334
+ throw new Error("The component has no body");
2335
+ }
2336
+ var viewName = _component_.body.getAttribute("viewClass");
2337
+ var _View = ClassFactory(viewName);
2338
+ if (typeof _View !== "undefined") {
2339
+ _component_.view = New(_View, {
2340
+ component: _component_
2341
+ }); // Initializes the main view for the component
2342
+ if (Object.hasOwnProperty.call(_component_.view, "done") && typeof _component_.view.done === "function") {
2343
+ _component_.view.done.call(_component_.view);
2344
+ }
2345
+ }
2346
+ var controllerName = _component_.body.getAttribute("controllerClass");
2347
+ if (!controllerName) {
2348
+ controllerName = "Controller";
2349
+ }
2350
+ var _Controller = ClassFactory(controllerName);
2351
+ if (typeof _Controller !== "undefined") {
2352
+ _component_.controller = New(_Controller, {
2353
+ component: _component_
2354
+ }); // Initializes the main controller for the component
2355
+ if (typeof _component_.controller.done === "function") {
2356
+ _component_.controller.done.call(_component_.controller);
2357
+ } else {
2358
+ logger.debug(`${controllerName} does not have a done() method.`);
2359
+ }
2360
+ if (typeof _component_.controller.createRoutingController === "function") {
2361
+ _component_.controller.createRoutingController.call(_component_.controller);
2362
+ } else {
2363
+ logger.debug(`${controllerName} does not have a createRoutingController() method.`);
2364
+ }
2365
+ }
2366
+ var effectClassName = _component_.body.getAttribute("effectClass");
2367
+ var applyEffectTo = _component_.body.getAttribute("apply-effect-to");
2368
+ applyEffectTo = (applyEffectTo !== null) ? (applyEffectTo) : ("load");
2369
+ if (effectClassName !== null && applyEffectTo === "observe") {
2370
+ _component_.applyObserveTransitionEffect(effectClassName);
2371
+ } else if (effectClassName !== null && applyEffectTo === "load") {
2372
+ _component_.applyTransitionEffect(effectClassName);
2373
+ }
2374
+
2375
+ if (_top.CONFIG.get("overrideComponentTag")) {
2376
+ _component_.body.outerHTML = this.body.innerHTML;
2377
+ }
2378
+ _component_.body.setAttribute("loaded", true);
2379
+
2380
+ logger.debug(`Trying to run component helpers for ${_component_.name}...`);
2381
+ try {
2382
+ _component_.runComponentHelpers();
2383
+ logger.debug(`Component helpers for ${_component_.name} executed.`);
2384
+ } catch (e){
2385
+ logger.debug(`Component helpers for ${_component_.name} could not be executed.`);
2386
+ throw Error(e);
2387
+ }
2388
+
2389
+ _component_.subcomponents = _component_.__buildSubComponents__();
2390
+
2391
+ _component_._bindroute_();
2392
+ };
2393
+
2394
+ return new Promise (function (resolve, reject){
2395
+ try {
2396
+ Promise.resolve(componentDone.call(_component_));
2397
+ } catch (e){
2398
+ reject(e);
2399
+ }
2400
+ });
2401
+
2402
+ }
2403
+
2404
+ hostElements(tagFilter){
2405
+ var _component_ = this;
2406
+ var elementList = (_component_.shadowed && (typeof _component_.shadowRoot !== "undefined"))?(
2407
+ _component_.shadowRoot.subelements(tagFilter)
2408
+ ):(
2409
+ _component_.body.subelements(tagFilter)
2410
+ );
2411
+ return elementList;
2412
+ }
2413
+
2414
+ get subtags(){
2415
+ var _component_ = this;
2416
+ var tagFilter = ":scope component:not([loaded])";
2417
+ return _component_.hostElements(tagFilter);
2418
+ }
2419
+
2420
+ get bodyAttributes() {
2421
+ var _component_ = this;
2422
+ var c = _component_.body;
2423
+ return [...c.getAttributeNames()].map (a => {return {[a]:c.getAttribute(a)};}).reduce ((accumulator,colData, index) => {return Object.assign(accumulator, colData);} );
2424
+ }
2425
+
2426
+ get dataAttributes(){
2427
+ var _component_ = this;
2428
+ var c = _component_.body;
2429
+ return [{}].concat([...c.getAttributeNames()].filter(n=>n.startsWith("data-")).map (a => {return {[a.split("-")[1]]:c.getAttribute(a)};})).reduce ((accumulator,colData, index) => {return Object.assign(accumulator, colData);} );
2430
+ }
2431
+
2432
+ __buildSubComponents__ (rebuildObjects = false) {
2433
+ var _component_ = this;
2434
+ var elementList = _component_.subtags;
2435
+ if (!rebuildObjects){
2436
+ elementList = elementList.filter(t=>t.getAttribute("loaded") !== "true");
2437
+ }
2438
+ if ((typeof _component_ !== "undefined") || _component_.subcomponents.length<1){
2439
+ _component_.subcomponents = _buildComponentsFromElements_(elementList, _component_);
2440
+ }
2441
+ return _component_.subcomponents;
2442
+ }
2170
2443
 
2171
2444
  fail(standardResponse) {
2172
2445
  var _ret_;
@@ -2233,12 +2506,12 @@
2233
2506
  logger.debug("ADDING Slots to Shadowed COMPONENT {{NAME}} ".replace("{{NAME}}", _component_.name));
2234
2507
  shadowContainer.innerHTML += tmp_shadowContainer.innerHTML;
2235
2508
  logger.debug("APPENDING Shadowed COMPONENT {{NAME}} to Container ".replace("{{NAME}}", _component_.name));
2236
- if (container.subelements(".shadowHost") < 1) {
2509
+ var qs = container.querySelector(".shadowHost");
2510
+ if (!(typeof qs !== "undefined" && qs !== null)) {
2237
2511
  container.appendChild(shadowContainer);
2238
2512
  } else {
2239
2513
  logger.debug("Shadowed Container for COMPONENT {{NAME}} is already present in the tree ".replace("{{NAME}}", _component_.name));
2240
- container.removeChild(container.subelements(".shadowHost").pop());
2241
- container.appendChild(shadowContainer);
2514
+ _component_.shadowRoot.innerHTML = shadowContainer.shadowRoot.innerHTML;
2242
2515
  }
2243
2516
  } else {
2244
2517
  logger.warn("Shadowed COMPONENT {{NAME}} is bad configured".replace("{{NAME}}", _component_.name));
@@ -2289,10 +2562,14 @@
2289
2562
  request: null,
2290
2563
  component: _component
2291
2564
  };
2292
- if (typeof _component.done === "function") {
2293
- _component.done.call(_component, standardResponse);
2294
- }
2295
- resolve.call(_promise, standardResponse);
2565
+ _component.__done__().then(function (){
2566
+ if (typeof _component.done === "function") {
2567
+ _component.done.call(_component, standardResponse);
2568
+ }
2569
+ resolve.call(_promise, standardResponse);
2570
+ }, function (){
2571
+ reject.call(_promise, standardResponse);
2572
+ });
2296
2573
  break;
2297
2574
  case (_component.get("tplsource") === "inline"):
2298
2575
  logger.debug("Component " + _component.name + " has specified template-source=inline, so it is assumed that template is already declared");
@@ -2301,10 +2578,14 @@
2301
2578
  request: null,
2302
2579
  component: _component
2303
2580
  };
2304
- if (typeof _component.done === "function") {
2305
- _component.done.call(_component, standardResponse);
2306
- }
2307
- resolve.call(_promise, standardResponse);
2581
+ _component.__done__().then(function (){
2582
+ if (typeof _component.done === "function") {
2583
+ _component.done.call(_component, standardResponse);
2584
+ }
2585
+ resolve.call(_promise, standardResponse);
2586
+ }, function (){
2587
+ reject.call(_promise, standardResponse);
2588
+ });
2308
2589
  break;
2309
2590
  case (_component.get("tplsource") === "default" &&
2310
2591
  _component.get("templateURI") !== ""):
@@ -2357,10 +2638,9 @@
2357
2638
  }
2358
2639
 
2359
2640
  static route() {
2360
- var componentClass = this;
2641
+ var componentClass = this; /* is can be class or object*/
2361
2642
  var _route_promise_;
2362
- var isValidInstance = ((!!componentClass.__instanceID) &&
2363
- Object.hasOwnProperty.call(componentClass, "subcomponents")) ? (true) : (false);
2643
+ var isValidInstance = ( isQCObjects_Object(componentClass) && is_a(componentClass,"Component") ) ? (true) : (false);
2364
2644
  var __route__ = function (componentList) {
2365
2645
  var _componentNames_ = [];
2366
2646
  var _promises_ = componentList.filter(function (rc) {
@@ -2376,19 +2656,22 @@
2376
2656
  if (typeof rc !== "undefined" && !!rc._reroute_) {
2377
2657
  _promise_ = rc._reroute_()
2378
2658
  .then(function () {
2379
- rc.body.innerHTML = "";
2380
- rc.innerHTML = "";
2659
+ rc.reload = true;
2381
2660
  return rc.rebuild();
2382
2661
  })
2383
2662
  .then(function (_rc_) {
2384
- if (Object.hasOwnProperty.call(_rc_, "subcomponents") &&
2385
- typeof _rc_.subcomponents !== "undefined" &&
2386
- _rc_.subcomponents.length > 0
2663
+ if (Object.hasOwnProperty.call(rc, "subcomponents") &&
2664
+ typeof rc.subcomponents !== "undefined" &&
2665
+ rc.subcomponents.length > 0
2387
2666
  ) {
2388
- logger.debug("LOOKING FOR ROUTINGS IN SUBCOMPONENTS FOR: " + _rc_.name);
2389
- return __route__.call(_rc_, _rc_.subcomponents);
2667
+ logger.debug("LOOKING FOR ROUTINGS IN SUBCOMPONENTS FOR: " + rc.name);
2668
+ return __route__.call(rc, rc.subcomponents);
2390
2669
  } else {
2391
- resolve(_rc_);
2670
+ logger.debug("No subcomponents to look for routings in: " + rc.name);
2671
+ if (rc.subtags.length>0){
2672
+ rc.subcomponents = rc.__buildSubComponents__(true);
2673
+ }
2674
+ resolve(rc);
2392
2675
  }
2393
2676
  });
2394
2677
  } else if (typeof rc !== "undefined") {
@@ -2404,8 +2687,8 @@
2404
2687
  logger.warn("ROUTING FAILED FOR " + _componentNames_.join(", ") + ": " + err);
2405
2688
  });
2406
2689
  };
2407
- if (isValidInstance || Object.hasOwnProperty.call(global, "componentsStack")) {
2408
- if (isValidInstance && is_a(componentClass, "Component")) {
2690
+ if (isValidInstance || !!global.componentsStack) {
2691
+ if (isValidInstance) {
2409
2692
  logger.debug("loading routings for instance " + componentClass.name);
2410
2693
  }
2411
2694
  _route_promise_ = __route__.call(componentClass, (isValidInstance) ? (componentClass.subcomponents) : (global.componentsStack));
@@ -2467,6 +2750,12 @@
2467
2750
  routing[attributeNames[a]] = routingNode.getAttribute(attributeNames[a]);
2468
2751
  });
2469
2752
  component.routings.push(routing);
2753
+ if (!component.routingPaths) {
2754
+ component.routingPaths = [];
2755
+ }
2756
+ if (!component.routingPaths.includes(routing.path)) {
2757
+ component.routingPaths.push(routing.path);
2758
+ }
2470
2759
  if (!_top.global.get("routingPaths")) {
2471
2760
  _top.global.set("routingPaths", []);
2472
2761
  }
@@ -2727,12 +3016,18 @@
2727
3016
 
2728
3017
  ]);
2729
3018
 
2730
- _top._bindroute_.__assigned = false;
2731
-
2732
3019
  (_methods_)(ClassFactory("Component")).map(function (__c__) {
2733
3020
  (_protected_code_)(__c__);
2734
3021
  });
2735
3022
 
3023
+ if (isBrowser){
3024
+ window.addEventListener("popstate",function (popStateEvent){
3025
+ popStateEvent.stopImmediatePropagation();
3026
+ popStateEvent.stopPropagation();
3027
+ ClassFactory("Component").route();
3028
+ });
3029
+ }
3030
+
2736
3031
  Package("com.qcobjects.controllers", [
2737
3032
  class Controller extends ClassFactory("InheritClass") {
2738
3033
  constructor ({
@@ -3039,11 +3334,13 @@
3039
3334
  }
3040
3335
  });
3041
3336
  __promise__.then(function (standardResponse) {
3042
- var _ret_;
3043
- if (typeof component.done === "function") {
3044
- _ret_ = component.done.call(component, standardResponse);
3045
- }
3046
- return Promise.resolve(_ret_);
3337
+ return component.__done__().then (function (){
3338
+ var _ret_;
3339
+ if (typeof component.done === "function") {
3340
+ _ret_ = component.done.call(component, standardResponse);
3341
+ }
3342
+ return Promise.resolve(_ret_);
3343
+ });
3047
3344
  }, function (standardResponse) {
3048
3345
  var _ret_;
3049
3346
  if (typeof component.fail === "function") {
@@ -3123,11 +3420,13 @@
3123
3420
  }
3124
3421
  });
3125
3422
  component.__promise__.then(function (standardResponse) {
3126
- var _ret_;
3127
- if (typeof component.done === "function") {
3128
- _ret_ = component.done.call(component, standardResponse);
3129
- }
3130
- return Promise.resolve(_ret_);
3423
+ return component.__done__().then (function (){
3424
+ var _ret_;
3425
+ if (typeof component.done === "function") {
3426
+ _ret_ = component.done.call(component, standardResponse);
3427
+ }
3428
+ return Promise.resolve(_ret_);
3429
+ });
3131
3430
  }, function (standardResponse) {
3132
3431
  var _ret_;
3133
3432
  if (typeof component.fail === "function") {
@@ -3460,234 +3759,12 @@
3460
3759
  if (isBrowser) {
3461
3760
 
3462
3761
  Element.prototype.buildComponents = function (rebuildObjects = false) {
3463
- var tagFilter = (!rebuildObjects) ? ("component:not([loaded])") : ("component");
3762
+ var tagFilter = ":scope component:not([loaded])";
3464
3763
  var d = this;
3465
- var _buildComponent = function (components, __parent__) {
3466
- var componentsBuiltWith = components.map(function (_component_, _c) {
3467
- _component_ = components[_c];
3468
- var data = {};
3469
- var attributenames = components[_c].getAttributeNames().filter(function (a) {
3470
- return a.startsWith("data-");
3471
- }).map(function (a) {
3472
- return a.split("-")[1];
3473
- });
3474
- attributenames.map(function (_attribute_name_) {
3475
- data[_attribute_name_] = components[_c].getAttribute("data-" + _attribute_name_);
3476
- });
3477
- var componentDone = function () {
3478
- var _component_ = this;
3479
- if (typeof _component_ === "undefined") {
3480
- throw new Error("componentDone() has lost its context");
3481
- }
3482
- if (typeof _component_.body === "undefined") {
3483
- throw new Error("The component has no body");
3484
- }
3485
- var viewName = _component_.body.getAttribute("viewClass");
3486
- var _View = ClassFactory(viewName);
3487
- if (typeof _View !== "undefined") {
3488
- _component_.view = New(_View, {
3489
- component: _component_
3490
- }); // Initializes the main view for the component
3491
- if (Object.hasOwnProperty.call(_component_.view, "done") && typeof _component_.view.done === "function") {
3492
- _component_.view.done.call(_component_.view);
3493
- }
3494
- }
3495
- var controllerName = _component_.body.getAttribute("controllerClass");
3496
- if (!controllerName) {
3497
- controllerName = "Controller";
3498
- }
3499
- var _Controller = ClassFactory(controllerName);
3500
- if (typeof _Controller !== "undefined") {
3501
- _component_.controller = New(_Controller, {
3502
- component: _component_
3503
- }); // Initializes the main controller for the component
3504
- if (typeof _component_.controller.done === "function") {
3505
- _component_.controller.done.call(_component_.controller);
3506
- } else {
3507
- logger.debug(`${controllerName} does not have a done() method.`);
3508
- }
3509
- if (typeof _component_.controller.createRoutingController === "function") {
3510
- _component_.controller.createRoutingController.call(_component_.controller);
3511
- } else {
3512
- logger.debug(`${controllerName} does not have a createRoutingController() method.`);
3513
- }
3514
- }
3515
- var effectClassName = _component_.body.getAttribute("effectClass");
3516
- var applyEffectTo = _component_.body.getAttribute("apply-effect-to");
3517
- applyEffectTo = (applyEffectTo !== null) ? (applyEffectTo) : ("load");
3518
- if (effectClassName !== null && applyEffectTo === "observe") {
3519
- _component_.applyObserveTransitionEffect(effectClassName);
3520
- } else if (effectClassName !== null && applyEffectTo === "load") {
3521
- _component_.applyTransitionEffect(effectClassName);
3522
- }
3523
- if (_component_.shadowed && (typeof _component_.shadowRoot !== "undefined")) {
3524
- _component_.subcomponents = _buildComponent(_component_.shadowRoot.subelements(tagFilter), _component_);
3525
- } else {
3526
- _component_.subcomponents = _buildComponent(_component_.body.subelements(tagFilter), _component_);
3527
- }
3528
-
3529
- if (_top.CONFIG.get("overrideComponentTag")) {
3530
- _component_.body.outerHTML = this.body.innerHTML;
3531
- }
3532
- _component_.body.setAttribute("loaded", true);
3533
-
3534
- logger.debug(`Trying to run component helpers for ${_component_.name}...`);
3535
- try {
3536
- _component_.runComponentHelpers();
3537
- logger.debug(`Component helpers for ${_component_.name} executed.`);
3538
- } catch (e){
3539
- logger.debug(`Component helpers for ${_component_.name} could not be executed.`);
3540
- throw Error(e);
3541
- }
3542
-
3543
- if ((Tag("component[loaded=true]").length * 100 / Tag("component").length) >= 100) {
3544
- d.dispatchEvent(new CustomEvent("componentsloaded", {
3545
- detail: {
3546
- lastComponent: _component_
3547
- }
3548
- }));
3549
- }
3550
- };
3551
-
3552
- var __shadowed_not_set = (components[_c].getAttribute("shadowed") === null) ? (true) : (false);
3553
- var __tplsource_attr_not_set = (components[_c].getAttribute("template-source") === null) ? (true) : (false);
3554
- var shadowed = (components[_c].getAttribute("shadowed") === "true") ? (true) : (false);
3555
- var __cached_not_set = (components[_c].getAttribute("cached") === null) ? (true) : (false);
3556
- var cached = (components[_c].getAttribute("cached") === "true") ? (true) : (false);
3557
- var tplextension = (typeof _top.CONFIG.get("tplextension") !== "undefined") ? (_top.CONFIG.get("tplextension")) : ("html");
3558
- tplextension = (components[_c].getAttribute("tplextension") !== null) ? (components[_c].getAttribute("tplextension")) : (tplextension);
3559
- var _componentName = components[_c].getAttribute("name");
3560
- var _componentClassName = (components[_c].getAttribute("componentClass") !== null) ? (components[_c].getAttribute("componentClass")) : ("Component");
3561
- var _serviceClassName = (components[_c].getAttribute("serviceClass") !== null) ? (components[_c].getAttribute("serviceClass")) : (null);
3562
- /* __enable_service_class__ = true by default */
3563
- var __enable_service_class__ = (
3564
- (Object.hasOwnProperty.call(components[_c], "enableServiceClass") && components[_c].enableServiceClass) ||
3565
- (!Object.hasOwnProperty.call(components[_c], "enableServiceClass"))
3566
- ) ? (true) : (false);
3567
- var _response_to_data_ = (components[_c].getAttribute("response-to") !== null && components[_c].getAttribute("response-to") === "data") ? (true) : (false);
3568
- var _response_to_template_ = (components[_c].getAttribute("response-to") !== null && components[_c].getAttribute("response-to") === "template") ? (true) : (false);
3569
- let __componentClassName = (_top.CONFIG.get("preserveComponentBodyTag")) ? (
3570
- (_componentName !== null) ? ("com.qcobjects.components." + _componentName + ".ComponentBody") : ("com.qcobjects.components.ComponentBody")
3571
- ) : (_componentClassName);
3572
- _componentName = (_componentName !== null) ? (_componentName) : (
3573
- (ClassFactory(__componentClassName) &&
3574
- typeof ClassFactory(__componentClassName).name !== "undefined"
3575
- ) ? (
3576
- ClassFactory(__componentClassName).name
3577
- ) : ("")
3578
- );
3579
- var __classDefinition = ClassFactory(__componentClassName);
3580
- var __tplsource_prop_set = (__componentClassName !== "Component" && ((typeof __classDefinition !== "undefined" && typeof __classDefinition.tplsource === "string") && __classDefinition.tplsource !== "")) ? (true) : (false);
3581
- var tplsource = (__tplsource_attr_not_set && __tplsource_prop_set) ? (__classDefinition.tplsource) : ((__tplsource_attr_not_set) ? ("default") : (components[_c].getAttribute("template-source")));
3582
- logger.debug(`template source for ${_componentName} is ${tplsource} `);
3583
- logger.debug(`type for ${_componentName} is ${__getType__(__classDefinition)} `);
3584
-
3585
- var componentURI;
3586
- componentURI = ComponentURI({
3587
- "COMPONENTS_BASE_PATH": _top.CONFIG.get("componentsBasePath"),
3588
- "COMPONENT_NAME": _componentName,
3589
- "TPLEXTENSION": tplextension,
3590
- "TPL_SOURCE": tplsource
3591
- });
3592
- if (_top.CONFIG.get("preserveComponentBodyTag")) {
3593
- Package((_componentName !== "") ? ("com.qcobjects.components." + _componentName + "") : ("com.qcobjects.components"), [
3594
- Class("ComponentBody", ClassFactory("Component"), {
3595
- name: _componentName,
3596
- tplsource: tplsource,
3597
- tplextension: tplextension,
3598
- reload: true
3599
- })
3600
- ]);
3601
- }
3602
-
3603
- var __serviceClass;
3604
- if (__enable_service_class__ && _serviceClassName !== null) {
3605
- __serviceClass = ClassFactory(_serviceClassName);
3606
- }
3607
- if (!_response_to_data_ && __classDefinition && Object.hasOwnProperty.call(__classDefinition, "responseTo")) {
3608
- _response_to_data_ = (__classDefinition.responseTo === "data") ? (true) : (false);
3609
- } else if (!_response_to_data_ && Object.hasOwnProperty.call(ClassFactory("Component"), "responseTo")) {
3610
- _response_to_data_ = (ClassFactory("Component").responseTo === "data") ? (true) : (false);
3611
- }
3612
- if (!_response_to_template_ && __classDefinition && Object.hasOwnProperty.call(__classDefinition, "responseTo")) {
3613
- _response_to_template_ = (__classDefinition.responseTo === "template") ? (true) : (false);
3614
- } else if (!_response_to_template_ && Object.hasOwnProperty.call(ClassFactory("Component"), "responseTo")) {
3615
- _response_to_template_ = (ClassFactory("Component").responseTo === "template") ? (true) : (false);
3616
- }
3617
-
3618
- var __create_component_instance_ = function (data, serviceResponse) {
3619
- var __shadowed = (__shadowed_not_set) ? ((__classDefinition && __classDefinition.shadowed) || ClassFactory("Component").shadowed) : (shadowed);
3620
- var __definition = {
3621
- __parent__: __parent__,
3622
- name: _componentName,
3623
- data: data,
3624
- cached: (__cached_not_set) ? (ClassFactory("Component").cached) : (cached),
3625
- shadowed: __shadowed,
3626
- tplextension: tplextension,
3627
- body: (_top.CONFIG.get("preserveComponentBodyTag")) ? (_DOMCreateElement("componentBody")) : (components[_c]),
3628
- templateURI: componentURI,
3629
- tplsource: tplsource,
3630
- subcomponents: []
3631
- };
3632
- if (_response_to_template_) {
3633
- __definition.template = serviceResponse;
3634
- }
3635
- if (typeof _componentName === "undefined" || _componentName === "" || _componentName === null) {
3636
- /* this allows to use the original property defined
3637
- in the component definition if it is not present in the tag */
3638
- delete __definition.name;
3639
- }
3640
- if (componentURI === "") {
3641
- /* this allows to use the original property defined
3642
- in the component definition if it is not present in the tag */
3643
- delete __definition.templateURI;
3644
- }
3645
- var newComponent = New(__classDefinition, __definition);
3646
-
3647
- if (_top.CONFIG.get("preserveComponentBodyTag")) {
3648
- components[_c].append(newComponent);
3649
- }
3650
- newComponent.done = componentDone;
3651
- return newComponent;
3652
- };
3653
- var newComponent;
3654
- if (typeof __serviceClass !== "undefined" &&
3655
- (typeof __enable_service_class__ !== "undefined" &&
3656
- __enable_service_class__ === true) &&
3657
- (_response_to_data_ || _response_to_template_)
3658
- ) {
3659
- logger.info("Loading service " + _serviceClassName);
3660
- var serviceInstance = New(__serviceClass, {
3661
- data: data
3662
- });
3663
- serviceLoader(serviceInstance).then(function ({
3664
- request,
3665
- service
3666
- }) {
3667
- var serviceResponse = service.template;
3668
- if (_response_to_data_) {
3669
- if (typeof data === "object" && typeof serviceResponse === "object") {
3670
- data = Object.assign(data, serviceResponse);
3671
- } else {
3672
- data = serviceResponse;
3673
- }
3674
- }
3675
- newComponent = __create_component_instance_.call(this, data, serviceResponse);
3676
- newComponent.serviceInstance = serviceInstance;
3677
- newComponent.serviceData = data;
3678
- }).catch(function (e) {
3679
- logger.debug("Something went wroing while trying to load the service " + _serviceClassName);
3680
- });
3681
- } else {
3682
- newComponent = __create_component_instance_.call(this, data, null);
3683
- }
3684
- return newComponent;
3685
- });
3686
- return componentsBuiltWith;
3687
- };
3688
- var components = d.subelements(tagFilter);
3689
- return _buildComponent(components, null);
3764
+ var elements = d.subelements(tagFilter);
3765
+ return _buildComponentsFromElements_(elements, null);
3690
3766
  };
3767
+
3691
3768
  HTMLDocument.prototype.buildComponents = Element.prototype.buildComponents;
3692
3769
  HTMLElement.prototype.buildComponents = Element.prototype.buildComponents;
3693
3770
  var _ComponentWidget_ = class extends HTMLElement {
@@ -4247,173 +4324,209 @@
4247
4324
  }
4248
4325
  });
4249
4326
 
4250
- Class("Effect", {
4251
- duration: 1000,
4252
- animate({
4253
- timing,
4254
- draw,
4255
- duration
4256
- }) {
4327
+ Package("com.qcobjects.effects.base", [
4328
+ class Effect extends ClassFactory("InheritClass") {
4329
+ duration = 1000;
4257
4330
 
4258
- let start = performance.now();
4331
+ constructor (){
4332
+ super(...arguments);
4333
+ }
4259
4334
 
4260
- requestAnimationFrame(function animate(time) {
4261
- // timeFraction goes from 0 to 1
4262
- let timeFraction = (time - start) / duration;
4263
- if (timeFraction > 1) timeFraction = 1;
4335
+ animate({
4336
+ timing,
4337
+ draw,
4338
+ duration
4339
+ }) {
4340
+
4341
+ let start = performance.now();
4342
+
4343
+ requestAnimationFrame(function animate(time) {
4344
+ // timeFraction goes from 0 to 1
4345
+ let timeFraction = (time - start) / duration;
4346
+ if (timeFraction > 1) timeFraction = 1;
4347
+
4348
+ // calculate the current animation state
4349
+ let progress = timing(timeFraction);
4350
+
4351
+ draw(Math.round(progress * 100)); // draw it
4352
+
4353
+ if (timeFraction < 1) {
4354
+ requestAnimationFrame(animate);
4355
+ } else {
4356
+ // if this is an object with a done method
4357
+ if (typeof this !== "undefined" &&
4358
+ this !== null &&
4359
+ Object.hasOwnProperty.call(this, "done") &&
4360
+ (typeof this.done).toLowerCase() === "function") {
4361
+ this.done.call(this);
4362
+ }
4363
+ }
4364
+
4365
+ });
4366
+ }
4367
+
4368
+ }
4369
+ ]);
4264
4370
 
4265
- // calculate the current animation state
4266
- let progress = timing(timeFraction);
4371
+ Package("com.qcobjects.effects.transitions.base", [
4372
+
4373
+ class TransitionEffect extends ClassFactory("Effect") {
4374
+ duration= 385;
4375
+ defaultParams= {
4376
+ alphaFrom: 0,
4377
+ alphaTo: 1,
4378
+ angleFrom: 180,
4379
+ angleTo: 0,
4380
+ radiusFrom: 0,
4381
+ radiusTo: 30,
4382
+ scaleFrom: 0,
4383
+ scaleTo: 1
4384
+ };
4385
+ fitToHeight= false;
4386
+ fitToWidth= false;
4387
+ effects= [];
4267
4388
 
4268
- draw(Math.round(progress * 100)); // draw it
4389
+ constructor (){
4390
+ super(...arguments);
4391
+ logger.info("DECLARING TransitionEffect ");
4392
+ this.component.defaultParams = this.defaultParams;
4393
+ }
4269
4394
 
4270
- if (timeFraction < 1) {
4271
- requestAnimationFrame(animate);
4272
- } else {
4273
- // if this is an object with a done method
4274
- if (typeof this !== "undefined" &&
4275
- this !== null &&
4276
- Object.hasOwnProperty.call(this, "done") &&
4277
- (typeof this.done).toLowerCase() === "function") {
4278
- this.done.call(this);
4279
- }
4395
+ apply({
4396
+ alphaFrom,
4397
+ alphaTo,
4398
+ angleFrom,
4399
+ angleTo,
4400
+ radiusFrom,
4401
+ radiusTo,
4402
+ scaleFrom,
4403
+ scaleTo
4404
+ }) {
4405
+ var _transition_ = this;
4406
+ logger.info("EXECUTING TransitionEffect ");
4407
+ if (_transition_.fitToHeight) {
4408
+ _transition_.component.body.height = _transition_.component.body.offsetParent.scrollHeight;
4280
4409
  }
4281
-
4282
- });
4283
- }
4284
- });
4285
-
4286
- Class("TransitionEffect", ClassFactory("Effect"), {
4287
- duration: 385,
4288
- defaultParams: {
4289
- alphaFrom: 0,
4290
- alphaTo: 1,
4291
- angleFrom: 180,
4292
- angleTo: 0,
4293
- radiusFrom: 0,
4294
- radiusTo: 30,
4295
- scaleFrom: 0,
4296
- scaleTo: 1
4297
- },
4298
- fitToHeight: false,
4299
- fitToWidth: false,
4300
- effects: [],
4301
- _new_(o) {
4302
- logger.info("DECLARING TransitionEffect ");
4303
- this.component.defaultParams = this.defaultParams;
4304
- },
4305
- apply({
4306
- alphaFrom,
4307
- alphaTo,
4308
- angleFrom,
4309
- angleTo,
4310
- radiusFrom,
4311
- radiusTo,
4312
- scaleFrom,
4313
- scaleTo
4314
- }) {
4315
- var _transition_ = this;
4316
- logger.info("EXECUTING TransitionEffect ");
4317
- if (_transition_.fitToHeight) {
4318
- _transition_.component.body.height = _transition_.component.body.offsetParent.scrollHeight;
4319
- }
4320
- if (_transition_.fitToWidth) {
4321
- _transition_.component.body.width = _transition_.component.body.offsetParent.scrollWidth;
4322
- }
4323
- _transition_.component.body.style.display = "block";
4324
- _transition_.effects.map(function (effectClassName, eff) {
4325
- var __effectClass__ = ClassFactory(effectClassName);
4326
- var effectObj = new __effectClass__();
4327
- var effectClassMethod = effectObj.apply;
4328
- var args = [_transition_.component.body].concat(Object.values({
4329
- alphaFrom,
4330
- alphaTo,
4331
- angleFrom,
4332
- angleTo,
4333
- radiusFrom,
4334
- radiusTo,
4335
- scaleFrom,
4336
- scaleTo
4337
- }));
4338
- effectClassMethod.apply(_transition_, args);
4339
- });
4410
+ if (_transition_.fitToWidth) {
4411
+ _transition_.component.body.width = _transition_.component.body.offsetParent.scrollWidth;
4412
+ }
4413
+ _transition_.component.body.style.display = "block";
4414
+ _transition_.effects.map(function (effectClassName, eff) {
4415
+ var __effectClass__ = ClassFactory(effectClassName);
4416
+ var effectObj = new __effectClass__();
4417
+ var effectClassMethod = effectObj.apply;
4418
+ var args = [_transition_.component.body].concat(Object.values({
4419
+ alphaFrom,
4420
+ alphaTo,
4421
+ angleFrom,
4422
+ angleTo,
4423
+ radiusFrom,
4424
+ radiusTo,
4425
+ scaleFrom,
4426
+ scaleTo
4427
+ }));
4428
+ effectClassMethod.apply(_transition_, args);
4429
+ });
4430
+ }
4431
+
4340
4432
  }
4341
- });
4342
-
4343
- Class("Timer", {
4344
- duration: 1000,
4345
- alive: true,
4346
- thread({
4347
- timing,
4348
- intervalInterceptor,
4349
- duration
4350
- }) {
4351
- var timer = this;
4433
+ ]);
4352
4434
 
4353
- let start = performance.now();
4435
+ Package("com.qcobjects.timing", [
4436
+ class Timer extends ClassFactory("InheritClass") {
4354
4437
 
4355
- requestAnimationFrame(function thread(time) {
4356
- // timeFraction goes from 0 to 1
4357
- let elapsed = (time - start);
4358
- let timeFraction = elapsed / duration;
4359
- if (timeFraction > 1) timeFraction = 1;
4438
+ constructor (){
4439
+ super(...arguments);
4440
+ }
4360
4441
 
4361
- // calculate the current progress state
4362
- let progress = timing(timeFraction, elapsed);
4442
+ duration= 1000;
4443
+ alive= true;
4444
+ thread({
4445
+ timing,
4446
+ intervalInterceptor,
4447
+ duration
4448
+ }) {
4449
+ var timer = this;
4450
+
4451
+ let start = performance.now();
4452
+
4453
+ requestAnimationFrame(function thread(time) {
4454
+ // timeFraction goes from 0 to 1
4455
+ let elapsed = (time - start);
4456
+ let timeFraction = elapsed / duration;
4457
+ if (timeFraction > 1) timeFraction = 1;
4458
+
4459
+ // calculate the current progress state
4460
+ let progress = timing(timeFraction, elapsed);
4461
+
4462
+ intervalInterceptor(Math.round(progress * 100)); // draw it
4463
+
4464
+ if ((timeFraction < 1 || duration === -1) && timer.alive) {
4465
+ requestAnimationFrame(thread);
4466
+ }
4467
+
4468
+ });
4469
+ }
4470
+
4363
4471
 
4364
- intervalInterceptor(Math.round(progress * 100)); // draw it
4472
+ }
4473
+ ]);
4365
4474
 
4366
- if ((timeFraction < 1 || duration === -1) && timer.alive) {
4367
- requestAnimationFrame(thread);
4368
- }
4475
+ Package("com.qcobjects.tools.essentials", [
4476
+ class Toggle extends ClassFactory("InheritClass") {
4477
+ _toggle= false;
4478
+ _inverse= true;
4479
+ _positive= null;
4480
+ _negative= null;
4481
+ _dispatched= null;
4482
+ _args= {};
4483
+
4484
+ constructor (){
4485
+ super(...arguments);
4486
+ }
4369
4487
 
4370
- });
4371
- }
4372
- });
4488
+ changeToggle() {
4489
+ this._toggle = (this._toggle) ? (false) : (true);
4490
+ }
4373
4491
 
4374
- Class("Toggle", ClassFactory("InheritClass"), {
4375
- _toggle: false,
4376
- _inverse: true,
4377
- _positive: null,
4378
- _negative: null,
4379
- _dispatched: null,
4380
- _args: {},
4381
- changeToggle() {
4382
- this._toggle = (this._toggle) ? (false) : (true);
4383
- },
4384
- _new_({
4385
- positive,
4386
- negative,
4387
- args
4388
- }) {
4389
- this._positive = positive;
4390
- this._negative = negative;
4391
- this._args = args;
4392
- },
4393
- fire() {
4394
- var toggle = this;
4395
- var _promise = new Promise(function (resolve, reject) {
4492
+ _new_({
4493
+ positive,
4494
+ negative,
4495
+ args
4496
+ }) {
4497
+ this._positive = positive;
4498
+ this._negative = negative;
4499
+ this._args = args;
4500
+ }
4396
4501
 
4397
- if (typeof toggle._positive === "function" && typeof toggle._negative === "function") {
4398
- if (toggle._inverse) {
4399
- toggle._dispatched = (toggle._toggle) ? (toggle._negative.bind(toggle)) : (toggle._positive.bind(toggle));
4502
+ fire() {
4503
+ var toggle = this;
4504
+ var _promise = new Promise(function (resolve, reject) {
4505
+
4506
+ if (typeof toggle._positive === "function" && typeof toggle._negative === "function") {
4507
+ if (toggle._inverse) {
4508
+ toggle._dispatched = (toggle._toggle) ? (toggle._negative.bind(toggle)) : (toggle._positive.bind(toggle));
4509
+ } else {
4510
+ toggle._dispatched = (toggle._toggle) ? (toggle._positive.bind(toggle)) : (toggle._negative.bind(toggle));
4511
+ }
4512
+ toggle._dispatched.call(toggle, toggle._args);
4513
+ resolve.call(_promise, toggle);
4400
4514
  } else {
4401
- toggle._dispatched = (toggle._toggle) ? (toggle._positive.bind(toggle)) : (toggle._negative.bind(toggle));
4515
+ logger.debug("Toggle functions are not declared");
4516
+ reject.call(_promise, toggle);
4402
4517
  }
4403
- toggle._dispatched.call(toggle, toggle._args);
4404
- resolve.call(_promise, toggle);
4405
- } else {
4406
- logger.debug("Toggle functions are not declared");
4407
- reject.call(_promise, toggle);
4408
- }
4409
- }).then(function (toggle) {
4410
- toggle.changeToggle();
4411
- }).catch(function (e) {
4412
- logger.debug(e.toString());
4413
- });
4414
- return _promise;
4518
+ }).then(function (toggle) {
4519
+ toggle.changeToggle();
4520
+ }).catch(function (e) {
4521
+ logger.debug(e.toString());
4522
+ });
4523
+ return _promise;
4524
+ }
4525
+
4526
+
4415
4527
  }
4416
- });
4528
+
4529
+ ]);
4417
4530
 
4418
4531
  // Set Processors
4419
4532
  (function (_top) {
@@ -4597,8 +4710,6 @@
4597
4710
  };
4598
4711
  var _buildComponents = function () {
4599
4712
  if (isBrowser) {
4600
- logger.debug("Starting to bind routes");
4601
- _top._bindroute_.call(ClassFactory("Component"));
4602
4713
  logger.debug("Starting to building components");
4603
4714
  global.componentsStack = document.buildComponents.call(document);
4604
4715
  logger.debug("Initializing the service worker");
@@ -4760,15 +4871,6 @@
4760
4871
  if (isBrowser) {
4761
4872
  asyncLoad(function () {
4762
4873
  Ready(function () {
4763
- window.onpopstate = function (event) {
4764
- event.stopImmediatePropagation();
4765
- event.stopPropagation();
4766
- if (ClassFactory("CONFIG").get("rebuildObjects", true)){
4767
- global.componentsStack = document.buildComponents.call(document, true);
4768
- } else {
4769
- ClassFactory("Component").route();
4770
- }
4771
- };
4772
4874
 
4773
4875
  /*
4774
4876
  * scroll management custom events
package/VERSION CHANGED
@@ -1 +1 @@
1
- 2.4.39
1
+ 2.4.40
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qcobjects",
3
- "version": "2.4.39",
3
+ "version": "2.4.40",
4
4
  "description": "QCObjects is an Open-source framework that empowers full-stack developers to make micro-services and micro-frontends into an N-Tier architecture.",
5
5
  "main": "QCObjects.js",
6
6
  "license": "LGPL-3.0",