peryl 1.5.21 → 1.5.23

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 (63) hide show
  1. package/demo/hash_demo.ts +6 -1
  2. package/demo/hsml-appel_demo.html +1 -1
  3. package/demo/hsml-appel_demo.ts +14 -10
  4. package/dist/browser-esmodule/hash.js +2 -2
  5. package/dist/browser-esmodule/hash.js.map +1 -1
  6. package/dist/browser-esmodule/hsml-app.js +24 -25
  7. package/dist/browser-esmodule/hsml-app.js.map +1 -1
  8. package/dist/browser-esmodule/index.js +26 -27
  9. package/dist/browser-esmodule/index.js.map +1 -1
  10. package/dist/browser-umd/hash.js +1 -1
  11. package/dist/browser-umd/hash.js.map +1 -1
  12. package/dist/browser-umd/hsml-app.js +1 -1
  13. package/dist/browser-umd/hsml-app.js.map +1 -1
  14. package/dist/browser-umd/index.js +1 -1
  15. package/dist/browser-umd/index.js.map +1 -1
  16. package/dist/demo/{hash_demo.1cbbc47a.js → hash_demo.57b93f2a.js} +2 -2
  17. package/dist/demo/hash_demo.57b93f2a.js.map +1 -0
  18. package/dist/demo/{hash_demo.80f80384.js → hash_demo.7e0ef005.js} +2 -2
  19. package/dist/demo/hash_demo.7e0ef005.js.map +1 -0
  20. package/dist/demo/hash_demo.html +1 -1
  21. package/dist/demo/hsml-app-bysquare_demo.html +1 -1
  22. package/dist/demo/hsml-app-form-validation_demo.html +1 -1
  23. package/dist/demo/hsml-app-form_demo.html +1 -1
  24. package/dist/demo/hsml-app-test_demo.html +1 -1
  25. package/dist/demo/hsml-app-tictactoe_demo.html +1 -1
  26. package/dist/demo/hsml-app_demo.html +1 -1
  27. package/dist/demo/hsml-appel_demo.39c5c95a.js +2 -0
  28. package/dist/demo/hsml-appel_demo.39c5c95a.js.map +1 -0
  29. package/dist/demo/hsml-appel_demo.fd0c6348.js +2 -0
  30. package/dist/demo/hsml-appel_demo.fd0c6348.js.map +1 -0
  31. package/dist/demo/hsml-appel_demo.html +1 -1
  32. package/dist/demo/hsml-appi_demo.64f70501.js +2 -0
  33. package/dist/demo/hsml-appi_demo.64f70501.js.map +1 -0
  34. package/dist/demo/hsml-appi_demo.9a157181.js +2 -0
  35. package/dist/demo/hsml-appi_demo.9a157181.js.map +1 -0
  36. package/dist/demo/hsml-appi_demo.html +1 -1
  37. package/dist/hash.d.ts +2 -2
  38. package/dist/hash.js +2 -2
  39. package/dist/hash.js.map +1 -1
  40. package/dist/hsml-app.d.ts +8 -8
  41. package/dist/hsml-app.js +44 -37
  42. package/dist/hsml-app.js.map +1 -1
  43. package/package.json +1 -1
  44. package/src/hash.ts +4 -5
  45. package/src/hsml-app.ts +92 -67
  46. package/dist/browser-esmodule/google-analytics.js +0 -50
  47. package/dist/browser-esmodule/google-analytics.js.map +0 -1
  48. package/dist/browser-umd/google-analytics.js +0 -2
  49. package/dist/browser-umd/google-analytics.js.map +0 -1
  50. package/dist/demo/hash_demo.1cbbc47a.js.map +0 -1
  51. package/dist/demo/hash_demo.80f80384.js.map +0 -1
  52. package/dist/demo/hsml-appel_demo.1da052b6.js +0 -2
  53. package/dist/demo/hsml-appel_demo.1da052b6.js.map +0 -1
  54. package/dist/demo/hsml-appel_demo.7fcc74a6.js +0 -2
  55. package/dist/demo/hsml-appel_demo.7fcc74a6.js.map +0 -1
  56. package/dist/demo/hsml-appi_demo.3d3d0e4e.js +0 -2
  57. package/dist/demo/hsml-appi_demo.3d3d0e4e.js.map +0 -1
  58. package/dist/demo/hsml-appi_demo.eac28520.js +0 -2
  59. package/dist/demo/hsml-appi_demo.eac28520.js.map +0 -1
  60. package/dist/google-analytics.d.ts +0 -21
  61. package/dist/google-analytics.js +0 -63
  62. package/dist/google-analytics.js.map +0 -1
  63. package/src/google-analytics.ts +0 -79
@@ -757,7 +757,7 @@ const $b951870b67fa90fa$export$baec1e6ad0617c4b = (data)=>{
757
757
  const d = typeof data === "string" ? $b951870b67fa90fa$export$74e860f5d1acb08f(data) : data;
758
758
  const dpath = (_a = d.path) !== null && _a !== void 0 ? _a : [];
759
759
  const dquery = (_b = d.query) !== null && _b !== void 0 ? _b : {};
760
- const path = dpath.map((p)=>encodeURIComponent(p)).join("/");
760
+ const path = dpath.map((p)=>encodeURIComponent(p !== null && p !== void 0 ? p : "")).join("/");
761
761
  const query = Object.entries(dquery).reduce((p, c)=>{
762
762
  if (typeof c[1] === "string") p.append(c[0], c[1]);
763
763
  else if (c[1] && typeof c[1].length === "number") c[1].forEach((v)=>p.append(c[0], v));
@@ -818,7 +818,7 @@ class $b951870b67fa90fa$export$ab85ecd77ce6a5cd {
818
818
  return this._decode(location.hash.slice(1));
819
819
  }
820
820
  write(data) {
821
- location.hash = "#" + this._encode(data);
821
+ location.hash = this._encode(data);
822
822
  if (!this._emitWritten) {
823
823
  this._writtenDataJson = JSON.stringify(data);
824
824
  this._cb && this._cb(data);
@@ -1859,16 +1859,18 @@ const $9adf8bc2f1ba310f$var$msgRender = "render:";
1859
1859
  const $9adf8bc2f1ba310f$var$msgUpdate = "update:";
1860
1860
  const $9adf8bc2f1ba310f$var$HAPP = "happ";
1861
1861
  function $9adf8bc2f1ba310f$export$eb8950696418f795(hAppI) {
1862
- return new $9adf8bc2f1ba310f$export$8cfef5dc37c46888(hAppI.state, hAppI.view, hAppI.dispatcher, hAppI.element, hAppI.debug, hAppI.name);
1862
+ return new $9adf8bc2f1ba310f$export$8cfef5dc37c46888(hAppI.state, hAppI.view, hAppI.dispatcher, hAppI.element, hAppI.debug, hAppI.id);
1863
1863
  }
1864
1864
  function $9adf8bc2f1ba310f$export$1cfc54b3834d3c50(hAppI) {
1865
- customElements.define(`${$9adf8bc2f1ba310f$var$HAPP}-${hAppI.name}`, class HAppElement extends HTMLElement {
1865
+ if (!customElements.get(hAppI.id)) customElements.define(hAppI.id, class HAppElement extends HTMLElement {
1866
1866
  static get observedAttributes() {
1867
- return hAppI.attributes;
1867
+ var _a;
1868
+ const state = hAppI.state();
1869
+ return ((_a = hAppI.attributes) !== null && _a !== void 0 ? _a : typeof state === "object") ? Object.keys(state) : [];
1868
1870
  }
1869
1871
  constructor(){
1870
1872
  super();
1871
- this._happel = new $9adf8bc2f1ba310f$export$8cfef5dc37c46888(hAppI.state, hAppI.view, hAppI.dispatcher, undefined, hAppI.debug, hAppI.name, hAppI.attributes);
1873
+ this._happel = new $9adf8bc2f1ba310f$export$8cfef5dc37c46888(hAppI.state, hAppI.view, hAppI.dispatcher, undefined, hAppI.debug, hAppI.id);
1872
1874
  this._happel.customElement = this;
1873
1875
  }
1874
1876
  connectedCallback() {
@@ -1893,7 +1895,7 @@ function $9adf8bc2f1ba310f$export$1cfc54b3834d3c50(hAppI) {
1893
1895
  });
1894
1896
  }
1895
1897
  class $9adf8bc2f1ba310f$export$8cfef5dc37c46888 {
1896
- constructor(state, view, dispatcher, element, debug, name, attributes){
1898
+ constructor(state, view, dispatcher, element, debug, id){
1897
1899
  this.refs = {};
1898
1900
  this.dispatch = (type, data, scope)=>$9adf8bc2f1ba310f$var$__awaiter(this, void 0, void 0, function*() {
1899
1901
  return this._dispatchAction(type, data, undefined, scope);
@@ -1905,17 +1907,17 @@ class $9adf8bc2f1ba310f$export$8cfef5dc37c46888 {
1905
1907
  try {
1906
1908
  hsmls = this.view(this.state);
1907
1909
  } catch (e) {
1908
- $9adf8bc2f1ba310f$export$8cfef5dc37c46888.error(this.name, $9adf8bc2f1ba310f$var$msgRender, e);
1910
+ $9adf8bc2f1ba310f$export$8cfef5dc37c46888.error(this.id, $9adf8bc2f1ba310f$var$msgRender, e);
1909
1911
  }
1910
1912
  const t1 = performance.now();
1911
- $9adf8bc2f1ba310f$export$8cfef5dc37c46888.log(this.name, $9adf8bc2f1ba310f$var$msgRender, `${t1 - t0} ms`, hsmls);
1913
+ $9adf8bc2f1ba310f$export$8cfef5dc37c46888.log(this.id, $9adf8bc2f1ba310f$var$msgRender, `${t1 - t0} ms`, hsmls);
1912
1914
  return hsmls !== null && hsmls !== void 0 ? hsmls : [];
1913
1915
  } else {
1914
1916
  let hsmls;
1915
1917
  try {
1916
1918
  hsmls = this.view(this.state);
1917
1919
  } catch (e) {
1918
- $9adf8bc2f1ba310f$export$8cfef5dc37c46888.error(this.name, $9adf8bc2f1ba310f$var$msgRender, e);
1920
+ $9adf8bc2f1ba310f$export$8cfef5dc37c46888.error(this.id, $9adf8bc2f1ba310f$var$msgRender, e);
1919
1921
  }
1920
1922
  return hsmls !== null && hsmls !== void 0 ? hsmls : [];
1921
1923
  }
@@ -1997,20 +1999,19 @@ class $9adf8bc2f1ba310f$export$8cfef5dc37c46888 {
1997
1999
  this.toHtml = ()=>{
1998
2000
  return this.element ? this.element.outerHTML : "";
1999
2001
  };
2002
+ this.id = id !== null && id !== void 0 ? id : $9adf8bc2f1ba310f$var$HAPP;
2000
2003
  this.debug = debug !== null && debug !== void 0 ? debug : false;
2001
- this.name = name !== null && name !== void 0 ? name : $9adf8bc2f1ba310f$var$HAPP;
2002
- this.attributes = attributes !== null && attributes !== void 0 ? attributes : [];
2003
2004
  this.state = state();
2004
2005
  this.view = view;
2005
2006
  this.dispatcher = dispatcher !== null && dispatcher !== void 0 ? dispatcher : (a)=>$9adf8bc2f1ba310f$var$__awaiter(this, void 0, void 0, function*() {
2006
- return $9adf8bc2f1ba310f$export$8cfef5dc37c46888.log(this.name, $9adf8bc2f1ba310f$var$msgAction, a.type, a.data);
2007
+ return $9adf8bc2f1ba310f$export$8cfef5dc37c46888.log(this.id, $9adf8bc2f1ba310f$var$msgAction, a.type, a.data);
2007
2008
  });
2008
2009
  this._dispatchAction($9adf8bc2f1ba310f$export$3dcd9fad60135c2c.init, this).then(()=>element && this.mount(element));
2009
2010
  }
2010
2011
  _dispatchAction(type, data, event, scope) {
2011
2012
  return $9adf8bc2f1ba310f$var$__awaiter(this, void 0, void 0, function*() {
2012
2013
  if (this.debug) {
2013
- $9adf8bc2f1ba310f$export$8cfef5dc37c46888.log(this.name, $9adf8bc2f1ba310f$var$msgAction, {
2014
+ $9adf8bc2f1ba310f$export$8cfef5dc37c46888.log(this.id, $9adf8bc2f1ba310f$var$msgAction, {
2014
2015
  type: type,
2015
2016
  data: data,
2016
2017
  event: event
@@ -2018,23 +2019,21 @@ class $9adf8bc2f1ba310f$export$8cfef5dc37c46888 {
2018
2019
  const t0 = performance.now();
2019
2020
  yield this._dispatch(type, data, event, scope);
2020
2021
  const t1 = performance.now();
2021
- $9adf8bc2f1ba310f$export$8cfef5dc37c46888.log(this.name, $9adf8bc2f1ba310f$var$msgDispatch, `${t1 - t0} ms`, this.state);
2022
+ $9adf8bc2f1ba310f$export$8cfef5dc37c46888.log(this.id, $9adf8bc2f1ba310f$var$msgDispatch, `${t1 - t0} ms`, this.state);
2022
2023
  } else yield this._dispatch(type, data, event, scope);
2023
2024
  });
2024
2025
  }
2025
2026
  _dispatch(type, data, event, scope) {
2026
2027
  return $9adf8bc2f1ba310f$var$__awaiter(this, void 0, void 0, function*() {
2027
- if (!scope) {
2028
- try {
2029
- yield this.dispatcher({
2030
- type: type,
2031
- data: data,
2032
- event: event
2033
- }, this.state, this.dispatch);
2034
- } catch (e) {
2035
- $9adf8bc2f1ba310f$export$8cfef5dc37c46888.error(this.name, $9adf8bc2f1ba310f$var$msgDispatch, e);
2036
- }
2037
- this.update();
2028
+ if (!scope) try {
2029
+ const skipUpdate = yield this.dispatcher({
2030
+ type: type,
2031
+ data: data,
2032
+ event: event
2033
+ }, this.state, this.dispatch);
2034
+ if (!skipUpdate) this.update();
2035
+ } catch (e) {
2036
+ $9adf8bc2f1ba310f$export$8cfef5dc37c46888.error(this.id, $9adf8bc2f1ba310f$var$msgDispatch, e);
2038
2037
  }
2039
2038
  scope === "element" && this._dispatchElement(type, data);
2040
2039
  scope === "window" && this._dispatchWindow(type, data);
@@ -2076,7 +2075,7 @@ class $9adf8bc2f1ba310f$export$8cfef5dc37c46888 {
2076
2075
  const t0 = performance.now();
2077
2076
  (0, $32c8c7b45dace799$export$ccb3a8beff05eea9)(el, hsml, ctx);
2078
2077
  const t1 = performance.now();
2079
- $9adf8bc2f1ba310f$export$8cfef5dc37c46888.log(this.name, $9adf8bc2f1ba310f$var$msgUpdate, `${t1 - t0} ms`, el);
2078
+ $9adf8bc2f1ba310f$export$8cfef5dc37c46888.log(this.id, $9adf8bc2f1ba310f$var$msgUpdate, `${t1 - t0} ms`, el);
2080
2079
  } else (0, $32c8c7b45dace799$export$ccb3a8beff05eea9)(el, hsml, ctx);
2081
2080
  }
2082
2081
  }