qcobjects 2.4.38 → 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 +602 -493
  2. package/VERSION +1 -1
  3. package/package.json +1 -1
package/QCObjects.js CHANGED
@@ -932,6 +932,10 @@
932
932
  return __hierarchy;
933
933
  }
934
934
 
935
+ static getParentClass() {
936
+ return Object.getPrototypeOf(this.prototype.constructor);
937
+ }
938
+
935
939
  constructor() {
936
940
  var _o_;
937
941
  if (arguments.length > 0) {
@@ -1955,66 +1959,98 @@
1955
1959
  return validRoutingWays.includes(routingWay);
1956
1960
  };
1957
1961
 
1958
- _top.__oldpopstate = _top.onpopstate;
1959
- _top._bindroute_ = function () {
1960
- {
1961
- if (isBrowser) {
1962
- if (!_top._bindroute_.__assigned) {
1963
- document.addEventListener("componentsloaded", function (e) {
1964
- e.stopImmediatePropagation();
1965
- e.stopPropagation();
1966
- if (!_top._bindroute_.__assigned) {
1967
-
1968
- _top.onpopstate = function (e) {
1969
- e.stopImmediatePropagation();
1970
- e.stopPropagation();
1971
- ClassFactory("Component").route();
1972
- if (typeof e.target.__oldpopstate !== "undefined" && typeof e.target.__oldpopstate === "function") {
1973
- e.target.__oldpopstate.call(e.target, e);
1974
- }
1975
- };
1976
- Tag("a").map(function (a) {
1977
- a.oldclick = a.onclick;
1978
- a.onclick = function (e) {
1979
- var _ret_ = true;
1980
- if (!_top.global.get("routingPaths")) {
1981
- _top.global.set("routingPaths", []);
1982
- }
1983
- var routingWay = _top.CONFIG.get("routingWay");
1984
- var routingPath = e.target[routingWay];
1985
- if (_top.global.get("routingPaths").includes(routingPath) &&
1986
- e.target[routingWay] !== document.location[routingWay] &&
1987
- e.target.href !== document.location.href
1988
- ) {
1989
- logger.debug("A ROUTING WAS FOUND: " + routingPath);
1990
- window.history.pushState({
1991
- href: e.target.href
1992
- }, e.target.href, e.target.href);
1993
- ClassFactory("Component").route();
1994
- _ret_ = false;
1995
- } else {
1996
- logger.debug("NO ROUTING FOUND FOR: " + routingPath);
1997
- }
1998
- if (typeof e.target.oldclick !== "undefined" && typeof e.target.oldclick === "function") {
1999
- e.target.oldclick.call(e.target, e);
2000
- }
2001
- return _ret_;
2002
- };
2003
- return null;
2004
- });
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
+ }
2005
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);
2006
2029
 
2007
- _top._bindroute_.__assigned = true;
2008
- Object.freeze(_top._bindroute_);
2009
- }
2010
- }, captureFalse);
2030
+ if (_top.CONFIG.get("preserveComponentBodyTag")) {
2031
+ element.append(newComponent);
2011
2032
  }
2012
- } else {
2013
- // not yet implemented.
2014
- }
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");
2015
2049
  }
2050
+ return componentsBuiltWith;
2016
2051
  };
2017
2052
 
2053
+
2018
2054
  Package("com.qcobjects", [
2019
2055
  class Component extends ClassFactory("InheritClass") {
2020
2056
  validRoutingWays= ["pathname", "hash", "search"];
@@ -2026,7 +2062,9 @@
2026
2062
  routingNodes= [];
2027
2063
  routings= [];
2028
2064
  routingPath= "";
2065
+ routingPaths=[];
2029
2066
  _componentHelpers= [];
2067
+ subcomponents=[];
2030
2068
  splashScreenComponent=undefined;
2031
2069
 
2032
2070
  constructor ({
@@ -2045,7 +2083,7 @@
2045
2083
  __shadowRoot,
2046
2084
  body,
2047
2085
  shadowRoot,
2048
- splashScreenComponent,
2086
+ splashScreenComponent
2049
2087
  }){
2050
2088
  super(...arguments);
2051
2089
  var self = this;
@@ -2059,25 +2097,33 @@
2059
2097
  self.processorHandler = New(ClassFactory("Processor"), {
2060
2098
  component: self
2061
2099
  });
2062
-
2063
- if (typeof self.__new__ === "function") {
2064
- self.__new__.call(self, self);
2065
- }
2066
2100
 
2067
- self._generateRoutingPaths(self.body)
2068
- .then(function (){
2069
- self._reroute_()
2070
- .then(function () {
2071
- return self.rebuild()
2072
- .then(function () {
2073
- logger.info(`Component._new_ The component ${self.name} was built successfully!`);
2074
- }).catch(function (standardResponse) {
2075
- logger.warn(`Component._new_ Something went wrong building the component ${self.name}`);
2076
- console.error(standardResponse);
2077
- });
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
+ });
2078
2123
  });
2124
+
2079
2125
  });
2080
-
2126
+
2081
2127
  }
2082
2128
 
2083
2129
  set body(value) {
@@ -2152,6 +2198,122 @@
2152
2198
  return Object.assign(accumulator, colData);
2153
2199
  });
2154
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
+ }
2155
2317
 
2156
2318
  done(standardResponse) {
2157
2319
  var _ret_;
@@ -2161,6 +2323,123 @@
2161
2323
  }
2162
2324
  return _ret_;
2163
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
+ }
2164
2443
 
2165
2444
  fail(standardResponse) {
2166
2445
  var _ret_;
@@ -2227,12 +2506,12 @@
2227
2506
  logger.debug("ADDING Slots to Shadowed COMPONENT {{NAME}} ".replace("{{NAME}}", _component_.name));
2228
2507
  shadowContainer.innerHTML += tmp_shadowContainer.innerHTML;
2229
2508
  logger.debug("APPENDING Shadowed COMPONENT {{NAME}} to Container ".replace("{{NAME}}", _component_.name));
2230
- if (container.subelements(".shadowHost") < 1) {
2509
+ var qs = container.querySelector(".shadowHost");
2510
+ if (!(typeof qs !== "undefined" && qs !== null)) {
2231
2511
  container.appendChild(shadowContainer);
2232
2512
  } else {
2233
2513
  logger.debug("Shadowed Container for COMPONENT {{NAME}} is already present in the tree ".replace("{{NAME}}", _component_.name));
2234
- container.removeChild(container.subelements(".shadowHost").pop());
2235
- container.appendChild(shadowContainer);
2514
+ _component_.shadowRoot.innerHTML = shadowContainer.shadowRoot.innerHTML;
2236
2515
  }
2237
2516
  } else {
2238
2517
  logger.warn("Shadowed COMPONENT {{NAME}} is bad configured".replace("{{NAME}}", _component_.name));
@@ -2283,10 +2562,14 @@
2283
2562
  request: null,
2284
2563
  component: _component
2285
2564
  };
2286
- if (typeof _component.done === "function") {
2287
- _component.done.call(_component, standardResponse);
2288
- }
2289
- 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
+ });
2290
2573
  break;
2291
2574
  case (_component.get("tplsource") === "inline"):
2292
2575
  logger.debug("Component " + _component.name + " has specified template-source=inline, so it is assumed that template is already declared");
@@ -2295,10 +2578,14 @@
2295
2578
  request: null,
2296
2579
  component: _component
2297
2580
  };
2298
- if (typeof _component.done === "function") {
2299
- _component.done.call(_component, standardResponse);
2300
- }
2301
- 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
+ });
2302
2589
  break;
2303
2590
  case (_component.get("tplsource") === "default" &&
2304
2591
  _component.get("templateURI") !== ""):
@@ -2351,10 +2638,9 @@
2351
2638
  }
2352
2639
 
2353
2640
  static route() {
2354
- var componentClass = this;
2641
+ var componentClass = this; /* is can be class or object*/
2355
2642
  var _route_promise_;
2356
- var isValidInstance = ((!!componentClass.__instanceID) &&
2357
- Object.hasOwnProperty.call(componentClass, "subcomponents")) ? (true) : (false);
2643
+ var isValidInstance = ( isQCObjects_Object(componentClass) && is_a(componentClass,"Component") ) ? (true) : (false);
2358
2644
  var __route__ = function (componentList) {
2359
2645
  var _componentNames_ = [];
2360
2646
  var _promises_ = componentList.filter(function (rc) {
@@ -2370,19 +2656,22 @@
2370
2656
  if (typeof rc !== "undefined" && !!rc._reroute_) {
2371
2657
  _promise_ = rc._reroute_()
2372
2658
  .then(function () {
2373
- rc.body.innerHTML = "";
2374
- rc.innerHTML = "";
2659
+ rc.reload = true;
2375
2660
  return rc.rebuild();
2376
2661
  })
2377
2662
  .then(function (_rc_) {
2378
- if (Object.hasOwnProperty.call(_rc_, "subcomponents") &&
2379
- typeof _rc_.subcomponents !== "undefined" &&
2380
- _rc_.subcomponents.length > 0
2663
+ if (Object.hasOwnProperty.call(rc, "subcomponents") &&
2664
+ typeof rc.subcomponents !== "undefined" &&
2665
+ rc.subcomponents.length > 0
2381
2666
  ) {
2382
- logger.debug("LOOKING FOR ROUTINGS IN SUBCOMPONENTS FOR: " + _rc_.name);
2383
- return __route__.call(_rc_, _rc_.subcomponents);
2667
+ logger.debug("LOOKING FOR ROUTINGS IN SUBCOMPONENTS FOR: " + rc.name);
2668
+ return __route__.call(rc, rc.subcomponents);
2384
2669
  } else {
2385
- 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);
2386
2675
  }
2387
2676
  });
2388
2677
  } else if (typeof rc !== "undefined") {
@@ -2398,14 +2687,15 @@
2398
2687
  logger.warn("ROUTING FAILED FOR " + _componentNames_.join(", ") + ": " + err);
2399
2688
  });
2400
2689
  };
2401
- if (isValidInstance || Object.hasOwnProperty.call(global, "componentsStack")) {
2402
- if (isValidInstance && is_a(componentClass, "Component")) {
2690
+ if (isValidInstance || !!global.componentsStack) {
2691
+ if (isValidInstance) {
2403
2692
  logger.debug("loading routings for instance " + componentClass.name);
2404
2693
  }
2405
2694
  _route_promise_ = __route__.call(componentClass, (isValidInstance) ? (componentClass.subcomponents) : (global.componentsStack));
2406
2695
  } else {
2407
2696
  logger.debug("An undetermined result expected if load routings. So will not be loaded this time.");
2408
2697
  }
2698
+ return _route_promise_;
2409
2699
  }
2410
2700
 
2411
2701
  fullscreen() {
@@ -2460,6 +2750,12 @@
2460
2750
  routing[attributeNames[a]] = routingNode.getAttribute(attributeNames[a]);
2461
2751
  });
2462
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
+ }
2463
2759
  if (!_top.global.get("routingPaths")) {
2464
2760
  _top.global.set("routingPaths", []);
2465
2761
  }
@@ -2720,12 +3016,18 @@
2720
3016
 
2721
3017
  ]);
2722
3018
 
2723
- _top._bindroute_.__assigned = false;
2724
-
2725
3019
  (_methods_)(ClassFactory("Component")).map(function (__c__) {
2726
3020
  (_protected_code_)(__c__);
2727
3021
  });
2728
3022
 
3023
+ if (isBrowser){
3024
+ window.addEventListener("popstate",function (popStateEvent){
3025
+ popStateEvent.stopImmediatePropagation();
3026
+ popStateEvent.stopPropagation();
3027
+ ClassFactory("Component").route();
3028
+ });
3029
+ }
3030
+
2729
3031
  Package("com.qcobjects.controllers", [
2730
3032
  class Controller extends ClassFactory("InheritClass") {
2731
3033
  constructor ({
@@ -3032,11 +3334,13 @@
3032
3334
  }
3033
3335
  });
3034
3336
  __promise__.then(function (standardResponse) {
3035
- var _ret_;
3036
- if (typeof component.done === "function") {
3037
- _ret_ = component.done.call(component, standardResponse);
3038
- }
3039
- 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
+ });
3040
3344
  }, function (standardResponse) {
3041
3345
  var _ret_;
3042
3346
  if (typeof component.fail === "function") {
@@ -3116,11 +3420,13 @@
3116
3420
  }
3117
3421
  });
3118
3422
  component.__promise__.then(function (standardResponse) {
3119
- var _ret_;
3120
- if (typeof component.done === "function") {
3121
- _ret_ = component.done.call(component, standardResponse);
3122
- }
3123
- 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
+ });
3124
3430
  }, function (standardResponse) {
3125
3431
  var _ret_;
3126
3432
  if (typeof component.fail === "function") {
@@ -3453,234 +3759,12 @@
3453
3759
  if (isBrowser) {
3454
3760
 
3455
3761
  Element.prototype.buildComponents = function (rebuildObjects = false) {
3456
- var tagFilter = (!rebuildObjects) ? ("component:not([loaded])") : ("component");
3762
+ var tagFilter = ":scope component:not([loaded])";
3457
3763
  var d = this;
3458
- var _buildComponent = function (components, __parent__) {
3459
- var componentsBuiltWith = components.map(function (_component_, _c) {
3460
- _component_ = components[_c];
3461
- var data = {};
3462
- var attributenames = components[_c].getAttributeNames().filter(function (a) {
3463
- return a.startsWith("data-");
3464
- }).map(function (a) {
3465
- return a.split("-")[1];
3466
- });
3467
- attributenames.map(function (_attribute_name_) {
3468
- data[_attribute_name_] = components[_c].getAttribute("data-" + _attribute_name_);
3469
- });
3470
- var componentDone = function () {
3471
- var _component_ = this;
3472
- if (typeof _component_ === "undefined") {
3473
- throw new Error("componentDone() has lost its context");
3474
- }
3475
- if (typeof _component_.body === "undefined") {
3476
- throw new Error("The component has no body");
3477
- }
3478
- var viewName = _component_.body.getAttribute("viewClass");
3479
- var _View = ClassFactory(viewName);
3480
- if (typeof _View !== "undefined") {
3481
- _component_.view = New(_View, {
3482
- component: _component_
3483
- }); // Initializes the main view for the component
3484
- if (Object.hasOwnProperty.call(_component_.view, "done") && typeof _component_.view.done === "function") {
3485
- _component_.view.done.call(_component_.view);
3486
- }
3487
- }
3488
- var controllerName = _component_.body.getAttribute("controllerClass");
3489
- if (!controllerName) {
3490
- controllerName = "Controller";
3491
- }
3492
- var _Controller = ClassFactory(controllerName);
3493
- if (typeof _Controller !== "undefined") {
3494
- _component_.controller = New(_Controller, {
3495
- component: _component_
3496
- }); // Initializes the main controller for the component
3497
- if (typeof _component_.controller.done === "function") {
3498
- _component_.controller.done.call(_component_.controller);
3499
- } else {
3500
- logger.debug(`${controllerName} does not have a done() method.`);
3501
- }
3502
- if (typeof _component_.controller.createRoutingController === "function") {
3503
- _component_.controller.createRoutingController.call(_component_.controller);
3504
- } else {
3505
- logger.debug(`${controllerName} does not have a createRoutingController() method.`);
3506
- }
3507
- }
3508
- var effectClassName = _component_.body.getAttribute("effectClass");
3509
- var applyEffectTo = _component_.body.getAttribute("apply-effect-to");
3510
- applyEffectTo = (applyEffectTo !== null) ? (applyEffectTo) : ("load");
3511
- if (effectClassName !== null && applyEffectTo === "observe") {
3512
- _component_.applyObserveTransitionEffect(effectClassName);
3513
- } else if (effectClassName !== null && applyEffectTo === "load") {
3514
- _component_.applyTransitionEffect(effectClassName);
3515
- }
3516
- if (_component_.shadowed && (typeof _component_.shadowRoot !== "undefined")) {
3517
- _component_.subcomponents = _buildComponent(_component_.shadowRoot.subelements(tagFilter), _component_);
3518
- } else {
3519
- _component_.subcomponents = _buildComponent(_component_.body.subelements(tagFilter), _component_);
3520
- }
3521
-
3522
- if (_top.CONFIG.get("overrideComponentTag")) {
3523
- _component_.body.outerHTML = this.body.innerHTML;
3524
- }
3525
- _component_.body.setAttribute("loaded", true);
3526
-
3527
- logger.debug(`Trying to run component helpers for ${_component_.name}...`);
3528
- try {
3529
- _component_.runComponentHelpers();
3530
- logger.debug(`Component helpers for ${_component_.name} executed.`);
3531
- } catch (e){
3532
- logger.debug(`Component helpers for ${_component_.name} could not be executed.`);
3533
- throw Error(e);
3534
- }
3535
-
3536
- if ((Tag("component[loaded=true]").length * 100 / Tag("component").length) >= 100) {
3537
- d.dispatchEvent(new CustomEvent("componentsloaded", {
3538
- detail: {
3539
- lastComponent: _component_
3540
- }
3541
- }));
3542
- }
3543
- };
3544
-
3545
- var __shadowed_not_set = (components[_c].getAttribute("shadowed") === null) ? (true) : (false);
3546
- var __tplsource_attr_not_set = (components[_c].getAttribute("template-source") === null) ? (true) : (false);
3547
- var shadowed = (components[_c].getAttribute("shadowed") === "true") ? (true) : (false);
3548
- var __cached_not_set = (components[_c].getAttribute("cached") === null) ? (true) : (false);
3549
- var cached = (components[_c].getAttribute("cached") === "true") ? (true) : (false);
3550
- var tplextension = (typeof _top.CONFIG.get("tplextension") !== "undefined") ? (_top.CONFIG.get("tplextension")) : ("html");
3551
- tplextension = (components[_c].getAttribute("tplextension") !== null) ? (components[_c].getAttribute("tplextension")) : (tplextension);
3552
- var _componentName = components[_c].getAttribute("name");
3553
- var _componentClassName = (components[_c].getAttribute("componentClass") !== null) ? (components[_c].getAttribute("componentClass")) : ("Component");
3554
- var _serviceClassName = (components[_c].getAttribute("serviceClass") !== null) ? (components[_c].getAttribute("serviceClass")) : (null);
3555
- /* __enable_service_class__ = true by default */
3556
- var __enable_service_class__ = (
3557
- (Object.hasOwnProperty.call(components[_c], "enableServiceClass") && components[_c].enableServiceClass) ||
3558
- (!Object.hasOwnProperty.call(components[_c], "enableServiceClass"))
3559
- ) ? (true) : (false);
3560
- var _response_to_data_ = (components[_c].getAttribute("response-to") !== null && components[_c].getAttribute("response-to") === "data") ? (true) : (false);
3561
- var _response_to_template_ = (components[_c].getAttribute("response-to") !== null && components[_c].getAttribute("response-to") === "template") ? (true) : (false);
3562
- let __componentClassName = (_top.CONFIG.get("preserveComponentBodyTag")) ? (
3563
- (_componentName !== null) ? ("com.qcobjects.components." + _componentName + ".ComponentBody") : ("com.qcobjects.components.ComponentBody")
3564
- ) : (_componentClassName);
3565
- _componentName = (_componentName !== null) ? (_componentName) : (
3566
- (ClassFactory(__componentClassName) &&
3567
- typeof ClassFactory(__componentClassName).name !== "undefined"
3568
- ) ? (
3569
- ClassFactory(__componentClassName).name
3570
- ) : ("")
3571
- );
3572
- var __classDefinition = ClassFactory(__componentClassName);
3573
- var __tplsource_prop_set = (__componentClassName !== "Component" && ((typeof __classDefinition !== "undefined" && typeof __classDefinition.tplsource === "string") && __classDefinition.tplsource !== "")) ? (true) : (false);
3574
- var tplsource = (__tplsource_attr_not_set && __tplsource_prop_set) ? (__classDefinition.tplsource) : ((__tplsource_attr_not_set) ? ("default") : (components[_c].getAttribute("template-source")));
3575
- logger.debug(`template source for ${_componentName} is ${tplsource} `);
3576
- logger.debug(`type for ${_componentName} is ${__getType__(__classDefinition)} `);
3577
-
3578
- var componentURI;
3579
- componentURI = ComponentURI({
3580
- "COMPONENTS_BASE_PATH": _top.CONFIG.get("componentsBasePath"),
3581
- "COMPONENT_NAME": _componentName,
3582
- "TPLEXTENSION": tplextension,
3583
- "TPL_SOURCE": tplsource
3584
- });
3585
- if (_top.CONFIG.get("preserveComponentBodyTag")) {
3586
- Package((_componentName !== "") ? ("com.qcobjects.components." + _componentName + "") : ("com.qcobjects.components"), [
3587
- Class("ComponentBody", ClassFactory("Component"), {
3588
- name: _componentName,
3589
- tplsource: tplsource,
3590
- tplextension: tplextension,
3591
- reload: true
3592
- })
3593
- ]);
3594
- }
3595
-
3596
- var __serviceClass;
3597
- if (__enable_service_class__ && _serviceClassName !== null) {
3598
- __serviceClass = ClassFactory(_serviceClassName);
3599
- }
3600
- if (!_response_to_data_ && __classDefinition && Object.hasOwnProperty.call(__classDefinition, "responseTo")) {
3601
- _response_to_data_ = (__classDefinition.responseTo === "data") ? (true) : (false);
3602
- } else if (!_response_to_data_ && Object.hasOwnProperty.call(ClassFactory("Component"), "responseTo")) {
3603
- _response_to_data_ = (ClassFactory("Component").responseTo === "data") ? (true) : (false);
3604
- }
3605
- if (!_response_to_template_ && __classDefinition && Object.hasOwnProperty.call(__classDefinition, "responseTo")) {
3606
- _response_to_template_ = (__classDefinition.responseTo === "template") ? (true) : (false);
3607
- } else if (!_response_to_template_ && Object.hasOwnProperty.call(ClassFactory("Component"), "responseTo")) {
3608
- _response_to_template_ = (ClassFactory("Component").responseTo === "template") ? (true) : (false);
3609
- }
3610
-
3611
- var __create_component_instance_ = function (data, serviceResponse) {
3612
- var __shadowed = (__shadowed_not_set) ? ((__classDefinition && __classDefinition.shadowed) || ClassFactory("Component").shadowed) : (shadowed);
3613
- var __definition = {
3614
- __parent__: __parent__,
3615
- name: _componentName,
3616
- data: data,
3617
- cached: (__cached_not_set) ? (ClassFactory("Component").cached) : (cached),
3618
- shadowed: __shadowed,
3619
- tplextension: tplextension,
3620
- body: (_top.CONFIG.get("preserveComponentBodyTag")) ? (_DOMCreateElement("componentBody")) : (components[_c]),
3621
- templateURI: componentURI,
3622
- tplsource: tplsource,
3623
- subcomponents: []
3624
- };
3625
- if (_response_to_template_) {
3626
- __definition.template = serviceResponse;
3627
- }
3628
- if (typeof _componentName === "undefined" || _componentName === "" || _componentName === null) {
3629
- /* this allows to use the original property defined
3630
- in the component definition if it is not present in the tag */
3631
- delete __definition.name;
3632
- }
3633
- if (componentURI === "") {
3634
- /* this allows to use the original property defined
3635
- in the component definition if it is not present in the tag */
3636
- delete __definition.templateURI;
3637
- }
3638
- var newComponent = New(__classDefinition, __definition);
3639
-
3640
- if (_top.CONFIG.get("preserveComponentBodyTag")) {
3641
- components[_c].append(newComponent);
3642
- }
3643
- newComponent.done = componentDone;
3644
- return newComponent;
3645
- };
3646
- var newComponent;
3647
- if (typeof __serviceClass !== "undefined" &&
3648
- (typeof __enable_service_class__ !== "undefined" &&
3649
- __enable_service_class__ === true) &&
3650
- (_response_to_data_ || _response_to_template_)
3651
- ) {
3652
- logger.info("Loading service " + _serviceClassName);
3653
- var serviceInstance = New(__serviceClass, {
3654
- data: data
3655
- });
3656
- serviceLoader(serviceInstance).then(function ({
3657
- request,
3658
- service
3659
- }) {
3660
- var serviceResponse = service.template;
3661
- if (_response_to_data_) {
3662
- if (typeof data === "object" && typeof serviceResponse === "object") {
3663
- data = Object.assign(data, serviceResponse);
3664
- } else {
3665
- data = serviceResponse;
3666
- }
3667
- }
3668
- newComponent = __create_component_instance_.call(this, data, serviceResponse);
3669
- newComponent.serviceInstance = serviceInstance;
3670
- newComponent.serviceData = data;
3671
- }).catch(function (e) {
3672
- logger.debug("Something went wroing while trying to load the service " + _serviceClassName);
3673
- });
3674
- } else {
3675
- newComponent = __create_component_instance_.call(this, data, null);
3676
- }
3677
- return newComponent;
3678
- });
3679
- return componentsBuiltWith;
3680
- };
3681
- var components = d.subelements(tagFilter);
3682
- return _buildComponent(components, null);
3764
+ var elements = d.subelements(tagFilter);
3765
+ return _buildComponentsFromElements_(elements, null);
3683
3766
  };
3767
+
3684
3768
  HTMLDocument.prototype.buildComponents = Element.prototype.buildComponents;
3685
3769
  HTMLElement.prototype.buildComponents = Element.prototype.buildComponents;
3686
3770
  var _ComponentWidget_ = class extends HTMLElement {
@@ -4240,173 +4324,209 @@
4240
4324
  }
4241
4325
  });
4242
4326
 
4243
- Class("Effect", {
4244
- duration: 1000,
4245
- animate({
4246
- timing,
4247
- draw,
4248
- duration
4249
- }) {
4327
+ Package("com.qcobjects.effects.base", [
4328
+ class Effect extends ClassFactory("InheritClass") {
4329
+ duration = 1000;
4250
4330
 
4251
- let start = performance.now();
4331
+ constructor (){
4332
+ super(...arguments);
4333
+ }
4252
4334
 
4253
- requestAnimationFrame(function animate(time) {
4254
- // timeFraction goes from 0 to 1
4255
- let timeFraction = (time - start) / duration;
4256
- 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
+ ]);
4257
4370
 
4258
- // calculate the current animation state
4259
- 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= [];
4260
4388
 
4261
- draw(Math.round(progress * 100)); // draw it
4389
+ constructor (){
4390
+ super(...arguments);
4391
+ logger.info("DECLARING TransitionEffect ");
4392
+ this.component.defaultParams = this.defaultParams;
4393
+ }
4262
4394
 
4263
- if (timeFraction < 1) {
4264
- requestAnimationFrame(animate);
4265
- } else {
4266
- // if this is an object with a done method
4267
- if (typeof this !== "undefined" &&
4268
- this !== null &&
4269
- Object.hasOwnProperty.call(this, "done") &&
4270
- (typeof this.done).toLowerCase() === "function") {
4271
- this.done.call(this);
4272
- }
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;
4273
4409
  }
4274
-
4275
- });
4276
- }
4277
- });
4278
-
4279
- Class("TransitionEffect", ClassFactory("Effect"), {
4280
- duration: 385,
4281
- defaultParams: {
4282
- alphaFrom: 0,
4283
- alphaTo: 1,
4284
- angleFrom: 180,
4285
- angleTo: 0,
4286
- radiusFrom: 0,
4287
- radiusTo: 30,
4288
- scaleFrom: 0,
4289
- scaleTo: 1
4290
- },
4291
- fitToHeight: false,
4292
- fitToWidth: false,
4293
- effects: [],
4294
- _new_(o) {
4295
- logger.info("DECLARING TransitionEffect ");
4296
- this.component.defaultParams = this.defaultParams;
4297
- },
4298
- apply({
4299
- alphaFrom,
4300
- alphaTo,
4301
- angleFrom,
4302
- angleTo,
4303
- radiusFrom,
4304
- radiusTo,
4305
- scaleFrom,
4306
- scaleTo
4307
- }) {
4308
- var _transition_ = this;
4309
- logger.info("EXECUTING TransitionEffect ");
4310
- if (_transition_.fitToHeight) {
4311
- _transition_.component.body.height = _transition_.component.body.offsetParent.scrollHeight;
4312
- }
4313
- if (_transition_.fitToWidth) {
4314
- _transition_.component.body.width = _transition_.component.body.offsetParent.scrollWidth;
4315
- }
4316
- _transition_.component.body.style.display = "block";
4317
- _transition_.effects.map(function (effectClassName, eff) {
4318
- var __effectClass__ = ClassFactory(effectClassName);
4319
- var effectObj = new __effectClass__();
4320
- var effectClassMethod = effectObj.apply;
4321
- var args = [_transition_.component.body].concat(Object.values({
4322
- alphaFrom,
4323
- alphaTo,
4324
- angleFrom,
4325
- angleTo,
4326
- radiusFrom,
4327
- radiusTo,
4328
- scaleFrom,
4329
- scaleTo
4330
- }));
4331
- effectClassMethod.apply(_transition_, args);
4332
- });
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
+
4333
4432
  }
4334
- });
4335
-
4336
- Class("Timer", {
4337
- duration: 1000,
4338
- alive: true,
4339
- thread({
4340
- timing,
4341
- intervalInterceptor,
4342
- duration
4343
- }) {
4344
- var timer = this;
4433
+ ]);
4345
4434
 
4346
- let start = performance.now();
4435
+ Package("com.qcobjects.timing", [
4436
+ class Timer extends ClassFactory("InheritClass") {
4347
4437
 
4348
- requestAnimationFrame(function thread(time) {
4349
- // timeFraction goes from 0 to 1
4350
- let elapsed = (time - start);
4351
- let timeFraction = elapsed / duration;
4352
- if (timeFraction > 1) timeFraction = 1;
4438
+ constructor (){
4439
+ super(...arguments);
4440
+ }
4353
4441
 
4354
- // calculate the current progress state
4355
- 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
+
4356
4471
 
4357
- intervalInterceptor(Math.round(progress * 100)); // draw it
4472
+ }
4473
+ ]);
4358
4474
 
4359
- if ((timeFraction < 1 || duration === -1) && timer.alive) {
4360
- requestAnimationFrame(thread);
4361
- }
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
+ }
4362
4487
 
4363
- });
4364
- }
4365
- });
4488
+ changeToggle() {
4489
+ this._toggle = (this._toggle) ? (false) : (true);
4490
+ }
4366
4491
 
4367
- Class("Toggle", ClassFactory("InheritClass"), {
4368
- _toggle: false,
4369
- _inverse: true,
4370
- _positive: null,
4371
- _negative: null,
4372
- _dispatched: null,
4373
- _args: {},
4374
- changeToggle() {
4375
- this._toggle = (this._toggle) ? (false) : (true);
4376
- },
4377
- _new_({
4378
- positive,
4379
- negative,
4380
- args
4381
- }) {
4382
- this._positive = positive;
4383
- this._negative = negative;
4384
- this._args = args;
4385
- },
4386
- fire() {
4387
- var toggle = this;
4388
- 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
+ }
4389
4501
 
4390
- if (typeof toggle._positive === "function" && typeof toggle._negative === "function") {
4391
- if (toggle._inverse) {
4392
- 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);
4393
4514
  } else {
4394
- 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);
4395
4517
  }
4396
- toggle._dispatched.call(toggle, toggle._args);
4397
- resolve.call(_promise, toggle);
4398
- } else {
4399
- logger.debug("Toggle functions are not declared");
4400
- reject.call(_promise, toggle);
4401
- }
4402
- }).then(function (toggle) {
4403
- toggle.changeToggle();
4404
- }).catch(function (e) {
4405
- logger.debug(e.toString());
4406
- });
4407
- 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
+
4408
4527
  }
4409
- });
4528
+
4529
+ ]);
4410
4530
 
4411
4531
  // Set Processors
4412
4532
  (function (_top) {
@@ -4590,8 +4710,6 @@
4590
4710
  };
4591
4711
  var _buildComponents = function () {
4592
4712
  if (isBrowser) {
4593
- logger.debug("Starting to bind routes");
4594
- _top._bindroute_.call(ClassFactory("Component"));
4595
4713
  logger.debug("Starting to building components");
4596
4714
  global.componentsStack = document.buildComponents.call(document);
4597
4715
  logger.debug("Initializing the service worker");
@@ -4753,15 +4871,6 @@
4753
4871
  if (isBrowser) {
4754
4872
  asyncLoad(function () {
4755
4873
  Ready(function () {
4756
- window.onpopstate = function (event) {
4757
- event.stopImmediatePropagation();
4758
- event.stopPropagation();
4759
- if (ClassFactory("CONFIG").get("rebuildObjects", true)){
4760
- global.componentsStack = document.buildComponents.call(document, true);
4761
- } else {
4762
- ClassFactory("Component").route();
4763
- }
4764
- };
4765
4874
 
4766
4875
  /*
4767
4876
  * scroll management custom events
package/VERSION CHANGED
@@ -1 +1 @@
1
- 2.4.38
1
+ 2.4.40
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qcobjects",
3
- "version": "2.4.38",
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",