peryl 1.5.2 → 1.5.3

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 (184) hide show
  1. package/README.md +30 -16
  2. package/demo/hsml-app-form-validation_demo.ts +22 -23
  3. package/demo/hsml-app-form_demo.ts +24 -20
  4. package/demo/hsml-app-test_demo.ts +35 -36
  5. package/demo/hsml-app-tictactoe_demo.ts +16 -15
  6. package/demo/hsml-app_demo.ts +20 -12
  7. package/demo/hsml-appel_demo.html +7 -0
  8. package/demo/hsml-appel_demo.ts +33 -25
  9. package/demo/hsml-appi_demo.ts +9 -9
  10. package/demo/hsml_demo.ts +27 -22
  11. package/demo/js/hsml-app-js-happi_demo.html +16 -8
  12. package/demo/js/hsml-app-js_demo.html +15 -15
  13. package/dist/browser-esmodule/encode.js.map +1 -1
  14. package/dist/browser-esmodule/hsml-app.js +67 -73
  15. package/dist/browser-esmodule/hsml-app.js.map +1 -1
  16. package/dist/browser-esmodule/hsml-convert.js.map +1 -1
  17. package/dist/browser-esmodule/hsml-dom.js +3 -3
  18. package/dist/browser-esmodule/hsml-dom.js.map +1 -1
  19. package/dist/browser-esmodule/hsml-h.js.map +1 -1
  20. package/dist/browser-esmodule/hsml-html.js +2 -2
  21. package/dist/browser-esmodule/hsml-html.js.map +1 -1
  22. package/dist/browser-esmodule/hsml-idom.js +5 -5
  23. package/dist/browser-esmodule/hsml-idom.js.map +1 -1
  24. package/dist/browser-esmodule/hsml.js.map +1 -1
  25. package/dist/browser-esmodule/http.js.map +1 -1
  26. package/dist/browser-esmodule/index.js +71 -77
  27. package/dist/browser-esmodule/index.js.map +1 -1
  28. package/dist/browser-esmodule/router.js.map +1 -1
  29. package/dist/browser-umd/encode.js +1 -1
  30. package/dist/browser-umd/encode.js.map +1 -1
  31. package/dist/browser-umd/hsml-app.js +1 -1
  32. package/dist/browser-umd/hsml-app.js.map +1 -1
  33. package/dist/browser-umd/hsml-convert.js.map +1 -1
  34. package/dist/browser-umd/hsml-dom.js +1 -1
  35. package/dist/browser-umd/hsml-dom.js.map +1 -1
  36. package/dist/browser-umd/hsml-h.js.map +1 -1
  37. package/dist/browser-umd/hsml-html.js +1 -1
  38. package/dist/browser-umd/hsml-html.js.map +1 -1
  39. package/dist/browser-umd/hsml-idom.js +1 -1
  40. package/dist/browser-umd/hsml-idom.js.map +1 -1
  41. package/dist/browser-umd/hsml.js.map +1 -1
  42. package/dist/browser-umd/http.js +1 -1
  43. package/dist/browser-umd/http.js.map +1 -1
  44. package/dist/browser-umd/index.js +1 -1
  45. package/dist/browser-umd/index.js.map +1 -1
  46. package/dist/browser-umd/router.js +1 -1
  47. package/dist/browser-umd/router.js.map +1 -1
  48. package/dist/browser-umd/validators-moment.js +1 -1
  49. package/dist/browser-umd/validators-moment.js.map +1 -1
  50. package/dist/browser-umd/validators-numeral.js.map +1 -1
  51. package/dist/demo/encode_demo.ce182166.js.map +1 -1
  52. package/dist/demo/encode_demo.f40a44eb.js.map +1 -1
  53. package/dist/demo/hsml-app-form-validation_demo.a9e2c583.js +2 -0
  54. package/dist/demo/hsml-app-form-validation_demo.a9e2c583.js.map +1 -0
  55. package/dist/demo/hsml-app-form-validation_demo.bb392ab0.js +2 -0
  56. package/dist/demo/hsml-app-form-validation_demo.bb392ab0.js.map +1 -0
  57. package/dist/demo/hsml-app-form-validation_demo.c6856b02.js +2 -0
  58. package/dist/demo/hsml-app-form-validation_demo.c6856b02.js.map +1 -0
  59. package/dist/demo/hsml-app-form-validation_demo.fdcc0b2d.js +2 -0
  60. package/dist/demo/hsml-app-form-validation_demo.fdcc0b2d.js.map +1 -0
  61. package/dist/demo/hsml-app-form-validation_demo.html +1 -1
  62. package/dist/demo/hsml-app-form_demo.e36ef1e9.js +2 -0
  63. package/dist/demo/hsml-app-form_demo.e36ef1e9.js.map +1 -0
  64. package/dist/demo/hsml-app-form_demo.fd22dfcf.js +2 -0
  65. package/dist/demo/hsml-app-form_demo.fd22dfcf.js.map +1 -0
  66. package/dist/demo/hsml-app-form_demo.html +1 -1
  67. package/dist/demo/hsml-app-test_demo.ba5f166c.js +2 -0
  68. package/dist/demo/hsml-app-test_demo.ba5f166c.js.map +1 -0
  69. package/dist/demo/hsml-app-test_demo.e8b5e4b2.js +2 -0
  70. package/dist/demo/hsml-app-test_demo.e8b5e4b2.js.map +1 -0
  71. package/dist/demo/hsml-app-test_demo.html +1 -1
  72. package/dist/demo/hsml-app-tictactoe_demo.03d8363f.js +2 -0
  73. package/dist/demo/hsml-app-tictactoe_demo.03d8363f.js.map +1 -0
  74. package/dist/demo/hsml-app-tictactoe_demo.399f8e69.js +2 -0
  75. package/dist/demo/hsml-app-tictactoe_demo.399f8e69.js.map +1 -0
  76. package/dist/demo/hsml-app-tictactoe_demo.html +1 -1
  77. package/dist/demo/hsml-app_demo.44aa1072.js +2 -0
  78. package/dist/demo/hsml-app_demo.44aa1072.js.map +1 -0
  79. package/dist/demo/hsml-app_demo.70ef3e7a.js +2 -0
  80. package/dist/demo/hsml-app_demo.70ef3e7a.js.map +1 -0
  81. package/dist/demo/hsml-app_demo.html +1 -1
  82. package/dist/demo/hsml-appel_demo.2a9f7f3f.js +2 -0
  83. package/dist/demo/hsml-appel_demo.2a9f7f3f.js.map +1 -0
  84. package/dist/demo/hsml-appel_demo.bea7849a.js +2 -0
  85. package/dist/demo/hsml-appel_demo.bea7849a.js.map +1 -0
  86. package/dist/demo/hsml-appel_demo.html +1 -1
  87. package/dist/demo/hsml-appi_demo.3dc5de90.js +2 -0
  88. package/dist/demo/hsml-appi_demo.3dc5de90.js.map +1 -0
  89. package/dist/demo/hsml-appi_demo.bfc7056a.js +2 -0
  90. package/dist/demo/hsml-appi_demo.bfc7056a.js.map +1 -0
  91. package/dist/demo/hsml-appi_demo.html +1 -1
  92. package/dist/demo/hsml-convert_demo.0ea1fa3b.js.map +1 -1
  93. package/dist/demo/hsml-convert_demo.63e3e7b5.js.map +1 -1
  94. package/dist/demo/{hsml_demo.ff950ba1.js → hsml_demo.a248689a.js} +2 -2
  95. package/dist/demo/hsml_demo.a248689a.js.map +1 -0
  96. package/dist/demo/hsml_demo.eb3b08be.js +2 -0
  97. package/dist/demo/hsml_demo.eb3b08be.js.map +1 -0
  98. package/dist/demo/hsml_demo.html +1 -1
  99. package/dist/demo/http_demo.3e7da3d8.js.map +1 -1
  100. package/dist/demo/http_demo.8e435f23.js.map +1 -1
  101. package/dist/demo/i18n_demo.html +1 -1
  102. package/dist/demo/router_demo.3cfa03aa.js.map +1 -1
  103. package/dist/demo/router_demo.89ab1681.js.map +1 -1
  104. package/dist/demo/{validators_demo.252e13a6.js → validators_demo.90ff6001.js} +2 -2
  105. package/dist/demo/validators_demo.90ff6001.js.map +1 -0
  106. package/dist/demo/{validators_demo.66893723.js → validators_demo.ef5b2dea.js} +2 -2
  107. package/dist/demo/validators_demo.ef5b2dea.js.map +1 -0
  108. package/dist/demo/validators_demo.html +1 -1
  109. package/dist/encode.js +1 -1
  110. package/dist/encode.js.map +1 -1
  111. package/dist/hsml-app.d.ts +38 -37
  112. package/dist/hsml-app.js +60 -62
  113. package/dist/hsml-app.js.map +1 -1
  114. package/dist/hsml-convert.d.ts +3 -3
  115. package/dist/hsml-convert.js.map +1 -1
  116. package/dist/hsml-dom.d.ts +2 -2
  117. package/dist/hsml-dom.js +3 -3
  118. package/dist/hsml-dom.js.map +1 -1
  119. package/dist/hsml-h.d.ts +8 -8
  120. package/dist/hsml-h.js.map +1 -1
  121. package/dist/hsml-html.d.ts +4 -4
  122. package/dist/hsml-html.js +2 -2
  123. package/dist/hsml-html.js.map +1 -1
  124. package/dist/hsml-idom.d.ts +2 -2
  125. package/dist/hsml-idom.js +5 -5
  126. package/dist/hsml-idom.js.map +1 -1
  127. package/dist/hsml.d.ts +26 -27
  128. package/dist/hsml.js.map +1 -1
  129. package/dist/http.js +1 -1
  130. package/dist/http.js.map +1 -1
  131. package/dist/router.js +1 -1
  132. package/dist/router.js.map +1 -1
  133. package/package.json +8 -8
  134. package/src/hsml-app.ts +209 -144
  135. package/src/hsml-convert.ts +8 -8
  136. package/src/hsml-dom.ts +18 -18
  137. package/src/hsml-h.ts +10 -10
  138. package/src/hsml-html.ts +19 -19
  139. package/src/hsml-idom.ts +25 -25
  140. package/src/hsml.ts +46 -143
  141. package/demo/hsml-appc_demo.html +0 -16
  142. package/demo/hsml-appc_demo.ts +0 -49
  143. package/dist/demo/hsml-app-form-validation_demo.0b03b743.js +0 -2
  144. package/dist/demo/hsml-app-form-validation_demo.0b03b743.js.map +0 -1
  145. package/dist/demo/hsml-app-form-validation_demo.b3a5c810.js +0 -2
  146. package/dist/demo/hsml-app-form-validation_demo.b3a5c810.js.map +0 -1
  147. package/dist/demo/hsml-app-form-validation_demo.d3925067.js +0 -2
  148. package/dist/demo/hsml-app-form-validation_demo.d3925067.js.map +0 -1
  149. package/dist/demo/hsml-app-form-validation_demo.f757d763.js +0 -2
  150. package/dist/demo/hsml-app-form-validation_demo.f757d763.js.map +0 -1
  151. package/dist/demo/hsml-app-form_demo.007ffcaa.js +0 -2
  152. package/dist/demo/hsml-app-form_demo.007ffcaa.js.map +0 -1
  153. package/dist/demo/hsml-app-form_demo.a034239d.js +0 -2
  154. package/dist/demo/hsml-app-form_demo.a034239d.js.map +0 -1
  155. package/dist/demo/hsml-app-test_demo.35c14dc9.js +0 -2
  156. package/dist/demo/hsml-app-test_demo.35c14dc9.js.map +0 -1
  157. package/dist/demo/hsml-app-test_demo.3c7e16ae.js +0 -2
  158. package/dist/demo/hsml-app-test_demo.3c7e16ae.js.map +0 -1
  159. package/dist/demo/hsml-app-tictactoe_demo.5f4861c1.js +0 -2
  160. package/dist/demo/hsml-app-tictactoe_demo.5f4861c1.js.map +0 -1
  161. package/dist/demo/hsml-app-tictactoe_demo.7deeabad.js +0 -2
  162. package/dist/demo/hsml-app-tictactoe_demo.7deeabad.js.map +0 -1
  163. package/dist/demo/hsml-app_demo.87d83c29.js +0 -2
  164. package/dist/demo/hsml-app_demo.87d83c29.js.map +0 -1
  165. package/dist/demo/hsml-app_demo.941a13a6.js +0 -2
  166. package/dist/demo/hsml-app_demo.941a13a6.js.map +0 -1
  167. package/dist/demo/hsml-appc_demo.0234ff15.js +0 -2
  168. package/dist/demo/hsml-appc_demo.0234ff15.js.map +0 -1
  169. package/dist/demo/hsml-appc_demo.f5783031.js +0 -2
  170. package/dist/demo/hsml-appc_demo.f5783031.js.map +0 -1
  171. package/dist/demo/hsml-appc_demo.html +0 -1
  172. package/dist/demo/hsml-appel_demo.0e8a4d4c.js +0 -2
  173. package/dist/demo/hsml-appel_demo.0e8a4d4c.js.map +0 -1
  174. package/dist/demo/hsml-appel_demo.1a5c2c26.js +0 -2
  175. package/dist/demo/hsml-appel_demo.1a5c2c26.js.map +0 -1
  176. package/dist/demo/hsml-appi_demo.2c3fb511.js +0 -2
  177. package/dist/demo/hsml-appi_demo.2c3fb511.js.map +0 -1
  178. package/dist/demo/hsml-appi_demo.427fdebd.js +0 -2
  179. package/dist/demo/hsml-appi_demo.427fdebd.js.map +0 -1
  180. package/dist/demo/hsml_demo.33f28c29.js +0 -2
  181. package/dist/demo/hsml_demo.33f28c29.js.map +0 -1
  182. package/dist/demo/hsml_demo.ff950ba1.js.map +0 -1
  183. package/dist/demo/validators_demo.252e13a6.js.map +0 -1
  184. package/dist/demo/validators_demo.66893723.js.map +0 -1
@@ -3,12 +3,12 @@ function $parcel$export(e, n, v, s) {
3
3
  }
4
4
  var $9adf8bc2f1ba310f$exports = {};
5
5
 
6
- $parcel$export($9adf8bc2f1ba310f$exports, "HAppAction", function () { return $9adf8bc2f1ba310f$export$15cfcbba5b21308e; }, function (v) { return $9adf8bc2f1ba310f$export$15cfcbba5b21308e = v; });
6
+ $parcel$export($9adf8bc2f1ba310f$exports, "HAppActions", function () { return $9adf8bc2f1ba310f$export$3dcd9fad60135c2c; }, function (v) { return $9adf8bc2f1ba310f$export$3dcd9fad60135c2c = v; });
7
+ $parcel$export($9adf8bc2f1ba310f$exports, "HDispatchScopes", function () { return $9adf8bc2f1ba310f$export$3d736e925369e0e4; }, function (v) { return $9adf8bc2f1ba310f$export$3d736e925369e0e4 = v; });
7
8
  $parcel$export($9adf8bc2f1ba310f$exports, "happ", function () { return $9adf8bc2f1ba310f$export$eb8950696418f795; }, function (v) { return $9adf8bc2f1ba310f$export$eb8950696418f795 = v; });
8
9
  $parcel$export($9adf8bc2f1ba310f$exports, "HApp", function () { return $9adf8bc2f1ba310f$export$8cfef5dc37c46888; }, function (v) { return $9adf8bc2f1ba310f$export$8cfef5dc37c46888 = v; });
9
10
  $parcel$export($9adf8bc2f1ba310f$exports, "happi", function () { return $9adf8bc2f1ba310f$export$e905700d74a7763f; }, function (v) { return $9adf8bc2f1ba310f$export$e905700d74a7763f = v; });
10
11
  $parcel$export($9adf8bc2f1ba310f$exports, "happel", function () { return $9adf8bc2f1ba310f$export$1cfc54b3834d3c50; }, function (v) { return $9adf8bc2f1ba310f$export$1cfc54b3834d3c50 = v; });
11
- $parcel$export($9adf8bc2f1ba310f$exports, "controllersDdispatcher", function () { return $9adf8bc2f1ba310f$export$dd8a94d3c5ec9827; }, function (v) { return $9adf8bc2f1ba310f$export$dd8a94d3c5ec9827 = v; });
12
12
  var $32c8c7b45dace799$exports = {};
13
13
 
14
14
  $parcel$export($32c8c7b45dace799$exports, "hsml2idomPatch", function () { return $32c8c7b45dace799$export$c539705c0f97f623; });
@@ -846,9 +846,9 @@ class $32c8c7b45dace799$var$HsmlIDomHandler {
846
846
  case "_id":
847
847
  case "_classes":
848
848
  case "_ref":
849
- case "_key":
850
- case "_skip":
851
849
  case "_hObj":
850
+ case "key":
851
+ case "skip":
852
852
  break;
853
853
  case "id":
854
854
  id = attrs[a];
@@ -898,14 +898,14 @@ class $32c8c7b45dace799$var$HsmlIDomHandler {
898
898
  }
899
899
  if (classes.length) props.unshift("class", classes.join(" "));
900
900
  if (id) props.unshift("id", id);
901
- (0, $820cd2154730c00b$export$c08238b528ee4605)(tag, attrs._key, undefined, ...props);
902
- if (attrs._skip) (0, $f070ae32bf01fca2$export$955fc4a6c4be454d)();
901
+ (0, $820cd2154730c00b$export$c08238b528ee4605)(tag, attrs.key, undefined, ...props);
902
+ if (attrs.skip) (0, $f070ae32bf01fca2$export$955fc4a6c4be454d)();
903
903
  if (ctx && ref) ctx.refs[ref] = (0, $f070ae32bf01fca2$export$910f131cbf8f9c16)();
904
904
  if (hObj && hObj.mount && hObj.mount.constructor === Function) {
905
905
  hObj.mount((0, $f070ae32bf01fca2$export$910f131cbf8f9c16)());
906
906
  (0, $f070ae32bf01fca2$export$955fc4a6c4be454d)();
907
907
  }
908
- return attrs._skip ? true : false;
908
+ return attrs.skip ? true : false;
909
909
  }
910
910
  close(tag, children, ctx) {
911
911
  (0, $820cd2154730c00b$export$5a9f50133313a819)(tag);
@@ -973,13 +973,19 @@ var $9adf8bc2f1ba310f$var$__awaiter = undefined && undefined.__awaiter || functi
973
973
  const $9adf8bc2f1ba310f$var$log = console.log;
974
974
  const $9adf8bc2f1ba310f$var$error = console.error;
975
975
  const $9adf8bc2f1ba310f$var$warn = console.warn;
976
- var $9adf8bc2f1ba310f$export$15cfcbba5b21308e;
977
- (function(HAppAction) {
978
- HAppAction["_init"] = "_init";
979
- HAppAction["_mount"] = "_mount";
980
- HAppAction["_umount"] = "_umount";
981
- HAppAction["_element"] = "_element";
982
- })($9adf8bc2f1ba310f$export$15cfcbba5b21308e || ($9adf8bc2f1ba310f$export$15cfcbba5b21308e = {}));
976
+ var $9adf8bc2f1ba310f$export$3dcd9fad60135c2c;
977
+ (function(HAppActions) {
978
+ HAppActions["init"] = "init";
979
+ HAppActions["mount"] = "mount";
980
+ HAppActions["umount"] = "umount";
981
+ HAppActions["action"] = "action";
982
+ HAppActions["elementAttr"] = "elementAttr";
983
+ })($9adf8bc2f1ba310f$export$3dcd9fad60135c2c || ($9adf8bc2f1ba310f$export$3dcd9fad60135c2c = {}));
984
+ var $9adf8bc2f1ba310f$export$3d736e925369e0e4;
985
+ (function(HDispatchScopes) {
986
+ HDispatchScopes["element"] = "element";
987
+ HDispatchScopes["window"] = "window";
988
+ })($9adf8bc2f1ba310f$export$3d736e925369e0e4 || ($9adf8bc2f1ba310f$export$3d736e925369e0e4 = {}));
983
989
  const $9adf8bc2f1ba310f$var$schedule = window.requestAnimationFrame || function(callback) {
984
990
  window.setTimeout(callback, 1000 / 60);
985
991
  };
@@ -993,9 +999,9 @@ const $9adf8bc2f1ba310f$var$msgUpdate = "HApp update:";
993
999
  function $9adf8bc2f1ba310f$export$eb8950696418f795(state, view, dispatcher, element = document.body) {
994
1000
  return new $9adf8bc2f1ba310f$export$8cfef5dc37c46888(state, view, dispatcher, element);
995
1001
  }
996
- function $9adf8bc2f1ba310f$export$e905700d74a7763f(hAppI, e = document.body) {
1002
+ function $9adf8bc2f1ba310f$export$e905700d74a7763f(hAppI, element = document.body) {
997
1003
  const hapi = new hAppI();
998
- return new $9adf8bc2f1ba310f$export$8cfef5dc37c46888(hapi.state, hapi.view, hapi.dispatcher, e);
1004
+ return new $9adf8bc2f1ba310f$export$8cfef5dc37c46888(hapi.state, hapi.view, hapi.dispatcher, element);
999
1005
  }
1000
1006
  function $9adf8bc2f1ba310f$export$1cfc54b3834d3c50(elementName, elementAttrs, state, view, dispatcher) {
1001
1007
  customElements.define(elementName, class HAppElement extends HTMLElement {
@@ -1015,7 +1021,7 @@ function $9adf8bc2f1ba310f$export$1cfc54b3834d3c50(elementName, elementAttrs, st
1015
1021
  this._happel.update();
1016
1022
  }
1017
1023
  attributeChangedCallback(attrName, oldVal, newVal) {
1018
- this._happel.dispatch($9adf8bc2f1ba310f$export$15cfcbba5b21308e._element, {
1024
+ this._happel.dispatch("elementAttr", {
1019
1025
  attrName: attrName,
1020
1026
  oldVal: oldVal,
1021
1027
  newVal: newVal
@@ -1028,42 +1034,34 @@ function $9adf8bc2f1ba310f$export$1cfc54b3834d3c50(elementName, elementAttrs, st
1028
1034
  }
1029
1035
  });
1030
1036
  }
1031
- function $9adf8bc2f1ba310f$export$dd8a94d3c5ec9827(controllers) {
1032
- return function(action) {
1033
- return $9adf8bc2f1ba310f$var$__awaiter(this, void 0, void 0, function*() {
1034
- const controller = controllers[action.type];
1035
- if (controller) controller.apply(this, [
1036
- action.data,
1037
- action.event
1038
- ]);
1039
- else $9adf8bc2f1ba310f$var$warn("no controller for action", action);
1040
- });
1041
- };
1042
- }
1043
1037
  const $9adf8bc2f1ba310f$var$HAPP = "happ";
1044
1038
  class $9adf8bc2f1ba310f$export$8cfef5dc37c46888 {
1045
- _dispatch(type, data, event) {
1046
- var _a;
1039
+ _dispatchAction(type, data, event, scope) {
1047
1040
  return $9adf8bc2f1ba310f$var$__awaiter(this, void 0, void 0, function*() {
1048
- try {
1049
- yield this.dispatcher({
1041
+ if ($9adf8bc2f1ba310f$export$8cfef5dc37c46888.debug) {
1042
+ $9adf8bc2f1ba310f$var$log($9adf8bc2f1ba310f$var$msgAction, {
1050
1043
  type: type,
1051
1044
  data: data,
1052
1045
  event: event
1053
- }, this.state, this.dispatch);
1054
- (_a = this._onDispatch) === null || _a === void 0 || _a.call(this, {
1046
+ });
1047
+ const t0 = performance.now();
1048
+ yield this._dispatch(type, data, event, scope);
1049
+ const t1 = performance.now();
1050
+ $9adf8bc2f1ba310f$var$log($9adf8bc2f1ba310f$var$msgDispatch, `${t1 - t0} ms`, this.state);
1051
+ } else yield this._dispatch(type, data, event, scope);
1052
+ });
1053
+ }
1054
+ _dispatch(type, data, event, scope) {
1055
+ return $9adf8bc2f1ba310f$var$__awaiter(this, void 0, void 0, function*() {
1056
+ try {
1057
+ yield this.dispatcher({
1055
1058
  type: type,
1056
1059
  data: data,
1057
1060
  event: event
1058
1061
  }, this.state, this.dispatch);
1059
- this.dom && $9adf8bc2f1ba310f$var$elementDispatchCustomEvent(this.dom, $9adf8bc2f1ba310f$var$HAPP, {
1060
- type: type,
1061
- data: data,
1062
- event: event
1063
- });
1064
- this.customElement && $9adf8bc2f1ba310f$var$elementDispatchCustomEvent(this.customElement, type, data);
1065
- !this.customElement && this.dom && $9adf8bc2f1ba310f$var$elementDispatchCustomEvent(this.dom, type, data);
1066
1062
  this.update();
1063
+ scope === "element" && this._dispatchElement(type, data);
1064
+ scope === "window" && this._dispatchWindow(type, data);
1067
1065
  } catch (e) {
1068
1066
  $9adf8bc2f1ba310f$var$error($9adf8bc2f1ba310f$var$msgDispatch, e);
1069
1067
  }
@@ -1073,35 +1071,31 @@ class $9adf8bc2f1ba310f$export$8cfef5dc37c46888 {
1073
1071
  if (!this._windowEventListener) {
1074
1072
  this._windowEventListener = (event)=>{
1075
1073
  const action = event.detail;
1076
- this.dispatch(action.type, action.data, event);
1074
+ this._dispatchAction(action.type, action.data);
1077
1075
  };
1078
- window.addEventListener($9adf8bc2f1ba310f$var$HAPP, this._windowEventListener);
1076
+ window.addEventListener("action", this._windowEventListener);
1079
1077
  } else $9adf8bc2f1ba310f$var$warn("windowEventListener olready setted");
1080
1078
  }
1081
1079
  windowDispatchOff() {
1082
- if (this._windowEventListener) window.removeEventListener($9adf8bc2f1ba310f$var$HAPP, this._windowEventListener);
1080
+ if (this._windowEventListener) window.removeEventListener("action", this._windowEventListener);
1083
1081
  }
1084
- constructor(state, view, dispatcher, e = document.body){
1082
+ constructor(state, view, dispatcher, element = document.body){
1085
1083
  this.refs = {};
1086
- this.onDispatch = (dispatcher)=>{
1087
- this._onDispatch = dispatcher;
1088
- return this;
1089
- };
1090
- this.dispatch = (type, data, event)=>$9adf8bc2f1ba310f$var$__awaiter(this, void 0, void 0, function*() {
1091
- if ($9adf8bc2f1ba310f$export$8cfef5dc37c46888.debug) {
1092
- $9adf8bc2f1ba310f$var$log($9adf8bc2f1ba310f$var$msgAction, {
1093
- type: type,
1094
- data: data,
1095
- event: event
1096
- });
1097
- const t0 = performance.now();
1098
- yield this._dispatch(type, data, event);
1099
- const t1 = performance.now();
1100
- $9adf8bc2f1ba310f$var$log($9adf8bc2f1ba310f$var$msgDispatch, `${t1 - t0} ms`, this.state);
1101
- } else yield this._dispatch(type, data, event);
1084
+ this.dispatch = (type, data, scope)=>$9adf8bc2f1ba310f$var$__awaiter(this, void 0, void 0, function*() {
1085
+ return this._dispatchAction(type, data, undefined, scope);
1086
+ });
1087
+ this._dispatchElement = (type, data)=>$9adf8bc2f1ba310f$var$__awaiter(this, void 0, void 0, function*() {
1088
+ this.customElement && $9adf8bc2f1ba310f$var$elementDispatchCustomEvent(this.customElement, "action", {
1089
+ type: type,
1090
+ data: data
1091
+ });
1092
+ !this.customElement && this.dom && $9adf8bc2f1ba310f$var$elementDispatchCustomEvent(this.dom, "action", {
1093
+ type: type,
1094
+ data: data
1095
+ });
1102
1096
  });
1103
- this.windowDispatch = (type, data, event)=>$9adf8bc2f1ba310f$var$__awaiter(this, void 0, void 0, function*() {
1104
- window.dispatchEvent(new CustomEvent($9adf8bc2f1ba310f$var$HAPP, {
1097
+ this._dispatchWindow = (type, data)=>$9adf8bc2f1ba310f$var$__awaiter(this, void 0, void 0, function*() {
1098
+ window.dispatchEvent(new CustomEvent("action", {
1105
1099
  detail: {
1106
1100
  type: type,
1107
1101
  data: data
@@ -1130,13 +1124,13 @@ class $9adf8bc2f1ba310f$export$8cfef5dc37c46888 {
1130
1124
  return hsmls !== null && hsmls !== void 0 ? hsmls : [];
1131
1125
  }
1132
1126
  };
1133
- this.actionCb = (action, data, event)=>{
1127
+ this.actionCb = (actionType, data, event)=>{
1134
1128
  data = (data === null || data === void 0 ? void 0 : data.constructor) === Function ? data(event) : data;
1135
1129
  if (data === undefined && event) {
1136
1130
  if (event instanceof CustomEvent) data = event.detail;
1137
1131
  else data = $9adf8bc2f1ba310f$var$formData(event);
1138
1132
  }
1139
- this.dispatch(action, data, event);
1133
+ this._dispatchAction(actionType, data, event);
1140
1134
  };
1141
1135
  this.mount = (e = document.body)=>{
1142
1136
  var _a;
@@ -1150,13 +1144,13 @@ class $9adf8bc2f1ba310f$export$8cfef5dc37c46888 {
1150
1144
  el[$9adf8bc2f1ba310f$var$HAPP] = this;
1151
1145
  const hsmls = this.render();
1152
1146
  $9adf8bc2f1ba310f$var$updateDom(el, hsmls, this);
1153
- this.dispatch($9adf8bc2f1ba310f$export$15cfcbba5b21308e._mount, this.dom);
1147
+ this._dispatchAction("mount", this.dom);
1154
1148
  }
1155
1149
  return this;
1156
1150
  };
1157
1151
  this.umount = ()=>{
1158
1152
  if (this.dom) {
1159
- this.dispatch($9adf8bc2f1ba310f$export$15cfcbba5b21308e._umount, this.dom);
1153
+ this._dispatchAction("umount", this.dom);
1160
1154
  if (this.dom.hasAttribute($9adf8bc2f1ba310f$var$HAPP)) this.dom.removeAttribute($9adf8bc2f1ba310f$var$HAPP);
1161
1155
  const aNodes = this.dom.querySelectorAll(`[${$9adf8bc2f1ba310f$var$HAPP}]`);
1162
1156
  for(let i = 0; i < aNodes.length; i++){
@@ -1187,7 +1181,7 @@ class $9adf8bc2f1ba310f$export$8cfef5dc37c46888 {
1187
1181
  } else return [
1188
1182
  "div",
1189
1183
  {
1190
- _skip: true
1184
+ skip: true
1191
1185
  }
1192
1186
  ];
1193
1187
  }
@@ -1196,7 +1190,7 @@ class $9adf8bc2f1ba310f$export$8cfef5dc37c46888 {
1196
1190
  if (!this.dom) {
1197
1191
  this.dom = e;
1198
1192
  e.happ = this;
1199
- this.dispatch($9adf8bc2f1ba310f$export$15cfcbba5b21308e._mount, this.dom);
1193
+ this._dispatchAction("mount", this.dom);
1200
1194
  }
1201
1195
  });
1202
1196
  return [
@@ -1212,7 +1206,7 @@ class $9adf8bc2f1ba310f$export$8cfef5dc37c46888 {
1212
1206
  this.dispatcher = dispatcher !== null && dispatcher !== void 0 ? dispatcher : (a)=>$9adf8bc2f1ba310f$var$__awaiter(this, void 0, void 0, function*() {
1213
1207
  return $9adf8bc2f1ba310f$var$log($9adf8bc2f1ba310f$var$msgAction, a.type, a.data);
1214
1208
  });
1215
- this.dispatch($9adf8bc2f1ba310f$export$15cfcbba5b21308e._init, this).then(()=>this.mount(e));
1209
+ this._dispatchAction("init", this).then(()=>this.mount(element));
1216
1210
  }
1217
1211
  }
1218
1212
  $9adf8bc2f1ba310f$export$8cfef5dc37c46888.debug = false;
@@ -1229,7 +1223,7 @@ function $9adf8bc2f1ba310f$var$elementDispatchCustomEvent(el, type, data) {
1229
1223
  el === null || el === void 0 || el.dispatchEvent(new CustomEvent(type, {
1230
1224
  detail: data
1231
1225
  }));
1232
- (_b = (_a = el)[`on${type.toLowerCase()}`]) === null || _b === void 0 || _b.call(_a, new CustomEvent(type, {
1226
+ (_b = (_a = el)[`on${type}`]) === null || _b === void 0 || _b.call(_a, new CustomEvent(type, {
1233
1227
  detail: data
1234
1228
  }));
1235
1229
  }
@@ -1359,5 +1353,5 @@ function $9adf8bc2f1ba310f$var$formInputData(el) {
1359
1353
  }
1360
1354
 
1361
1355
 
1362
- export {$9adf8bc2f1ba310f$export$15cfcbba5b21308e as HAppAction, $9adf8bc2f1ba310f$export$eb8950696418f795 as happ, $9adf8bc2f1ba310f$export$8cfef5dc37c46888 as HApp, $9adf8bc2f1ba310f$export$e905700d74a7763f as happi, $9adf8bc2f1ba310f$export$1cfc54b3834d3c50 as happel, $9adf8bc2f1ba310f$export$dd8a94d3c5ec9827 as controllersDdispatcher, $9adf8bc2f1ba310f$exports as default};
1356
+ export {$9adf8bc2f1ba310f$export$3dcd9fad60135c2c as HAppActions, $9adf8bc2f1ba310f$export$3d736e925369e0e4 as HDispatchScopes, $9adf8bc2f1ba310f$export$eb8950696418f795 as happ, $9adf8bc2f1ba310f$export$8cfef5dc37c46888 as HApp, $9adf8bc2f1ba310f$export$e905700d74a7763f as happi, $9adf8bc2f1ba310f$export$1cfc54b3834d3c50 as happel, $9adf8bc2f1ba310f$exports as default};
1363
1357
  //# sourceMappingURL=hsml-app.js.map