framework7 8.0.0-beta.7 → 8.0.0-beta.8

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Framework7 8.0.0-beta.7
2
+ * Framework7 8.0.0-beta.8
3
3
  * Full featured mobile HTML framework for building iOS & Android apps
4
4
  * https://framework7.io/
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Framework7 8.0.0-beta.7
2
+ * Framework7 8.0.0-beta.8
3
3
  * Full featured mobile HTML framework for building iOS & Android apps
4
4
  * https://framework7.io/
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Framework7 8.0.0-beta.7
2
+ * Framework7 8.0.0-beta.8
3
3
  * Full featured mobile HTML framework for building iOS & Android apps
4
4
  * https://framework7.io/
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Framework7 8.0.0-beta.7
2
+ * Framework7 8.0.0-beta.8
3
3
  * Full featured mobile HTML framework for building iOS & Android apps
4
4
  * https://framework7.io/
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Framework7 8.0.0-beta.7
2
+ * Framework7 8.0.0-beta.8
3
3
  * Full featured mobile HTML framework for building iOS & Android apps
4
4
  * https://framework7.io/
5
5
  *
@@ -10760,6 +10760,118 @@
10760
10760
  };
10761
10761
 
10762
10762
  /* eslint no-underscore-dangle: "off" */
10763
+
10764
+ /* eslint-disable no-shadow */
10765
+ /* eslint-disable no-return-assign */
10766
+ /* eslint-disable no-plusplus */
10767
+ /* eslint-disable no-param-reassign */
10768
+ /* eslint-disable no-sequences */
10769
+ const types = [{
10770
+ name: 'array',
10771
+ init: i => i,
10772
+ type: i => [i].find(Array.isArray),
10773
+ update: (i, o) => [o].filter(Array.isArray).find(() => (i.length = 0, i.push(...o))),
10774
+ insert: function (i, x, o) {
10775
+ if (o === void 0) {
10776
+ o = [];
10777
+ }
10778
+ return i.splice(Math.max(x, 0), 0, ...[o].flat());
10779
+ },
10780
+ replace: function (i, x, o) {
10781
+ if (o === void 0) {
10782
+ o = [];
10783
+ }
10784
+ return i.splice(Math.max(x, 0), Math.min(++x, 1), ...[o].flat());
10785
+ },
10786
+ append: function (i, o) {
10787
+ if (o === void 0) {
10788
+ o = [];
10789
+ }
10790
+ return i.push(...[o].flat());
10791
+ },
10792
+ prepend: function (i, o) {
10793
+ if (o === void 0) {
10794
+ o = [];
10795
+ }
10796
+ return i.unshift(...[o].flat());
10797
+ },
10798
+ swap: (i, a, b) => {
10799
+ [i[a], i[b]] = [i[b], i[a]];
10800
+ },
10801
+ fromTo: function (i, a, b) {
10802
+ if (b === void 0) {
10803
+ b = a;
10804
+ }
10805
+ return i.splice(Math.max(b, 0), 0, ...i.splice(Math.max(a, 0), 1));
10806
+ },
10807
+ remove: function (i, o, a) {
10808
+ if (a === void 0) {
10809
+ a = i.map((_, x) => x);
10810
+ }
10811
+ return [o].flat().filter(i => a.includes(i)).sort((a, b) => b - a).forEach(x => i.splice(x, 1));
10812
+ },
10813
+ clear: i => i.length = 0
10814
+ }, {
10815
+ name: 'object',
10816
+ init: i => i,
10817
+ type: i => [i].filter(i => [i !== null, i !== undefined].every(i => i)).find(i => Object.getPrototypeOf(i) === Object.prototype),
10818
+ update: (i, o) => Object.assign(i, o),
10819
+ insert: () => {},
10820
+ replace: () => {},
10821
+ append: () => {},
10822
+ prepend: () => {},
10823
+ swap: () => ({}),
10824
+ // N/A
10825
+ fromTo: () => ({}),
10826
+ // N/A
10827
+ remove: (i, o) => [o].flat().forEach(k => delete i[k]),
10828
+ clear: i => Object.keys(i).forEach(k => delete i[k])
10829
+ }, {
10830
+ name: 'atoms',
10831
+ type: () => true,
10832
+ init: function (i, o) {
10833
+ if (o === void 0) {
10834
+ o = {};
10835
+ }
10836
+ return Object.defineProperty(o, 'value', {
10837
+ get: () => i,
10838
+ set: v => {
10839
+ // eslint-disable-next-line
10840
+ i = v;
10841
+ }
10842
+ }), o;
10843
+ },
10844
+ update: function (i, v) {
10845
+ if (v === void 0) {
10846
+ v = i.value;
10847
+ }
10848
+ i.value = v;
10849
+ },
10850
+ insert: () => ({}),
10851
+ // N/A
10852
+ replace: () => ({}),
10853
+ // N/A
10854
+ append: () => ({}),
10855
+ // N/A
10856
+ prepend: () => ({}),
10857
+ // N/A
10858
+ swap: () => ({}),
10859
+ // N/A
10860
+ fromTo: () => ({}),
10861
+ // N/A
10862
+ remove: () => ({}),
10863
+ // N/A
10864
+ clear: i => {
10865
+ i.value = undefined;
10866
+ }
10867
+ }];
10868
+
10869
+ /* eslint-enable no-shadow */
10870
+ /* eslint-enable no-return-assign */
10871
+ /* eslint-enable no-plusplus */
10872
+ /* eslint-enable no-param-reassign */
10873
+ /* eslint-enable no-sequences */
10874
+
10763
10875
  class Component {
10764
10876
  constructor(app, component, props, _temp) {
10765
10877
  if (props === void 0) {
@@ -10904,6 +11016,84 @@
10904
11016
  });
10905
11017
  return $store;
10906
11018
  }
11019
+
11020
+ /* eslint-disable no-sequences */
11021
+ getUseState() {
11022
+ var _this = this;
11023
+ return o => [o].reduce(function (t, _i, _x, _a, i) {
11024
+ if (i === void 0) {
11025
+ i = t.init(_i);
11026
+ }
11027
+ return {
11028
+ state: i,
11029
+ update: v => (t.update(i, v), _this.update()),
11030
+ remove: v => (t.remove(i, v), _this.update()),
11031
+ clear: () => (t.clear(i), _this.update()),
11032
+ insert: (x, v) => (t.insert(i, x, v), _this.update()),
11033
+ replace: (x, v) => (t.replace(i, x, v), _this.update()),
11034
+ append: v => (t.append(i, v), _this.update()),
11035
+ prepend: v => (t.prepend(i, v), _this.update()),
11036
+ swap: (a, b) => (t.swap(i, a, b), _this.update()),
11037
+ fromTo: (a, b) => (t.fromTo(i, a, b), _this.update()),
11038
+ method: function (f) {
11039
+ if (f === void 0) {
11040
+ f = () => ({});
11041
+ }
11042
+ return f(i), _this.update();
11043
+ },
11044
+ async: function (f) {
11045
+ if (f === void 0) {
11046
+ f = () => Promise.reject(i);
11047
+ }
11048
+ return f(i).then(() => _this.update());
11049
+ }
11050
+ };
11051
+ }, types.find(i => i.type(o)));
11052
+ }
11053
+ _getUseState() {
11054
+ var _this2 = this;
11055
+ return o => [o].reduce(function (t, _i, _x, _a, i) {
11056
+ if (i === void 0) {
11057
+ i = t.init(_i);
11058
+ }
11059
+ return [i,
11060
+ // state
11061
+ v => (t.update(i, v), _this2.update()),
11062
+ // update
11063
+ v => (t.remove(i, v), _this2.update()),
11064
+ // remove
11065
+ () => (t.clear(i), _this2.update()),
11066
+ // clear
11067
+ (x, v) => (t.insert(i, x, v), _this2.update()),
11068
+ // insert
11069
+ (x, v) => (t.replace(i, x, v), _this2.update()),
11070
+ // replace
11071
+ v => (t.append(i, v), _this2.update()),
11072
+ // append
11073
+ v => (t.prepend(i, v), _this2.update()),
11074
+ // prepend
11075
+ (a, b) => (t.swap(i, a, b), _this2.update()),
11076
+ // swap
11077
+ (a, b) => (t.fromTo(i, a, b), _this2.update()),
11078
+ // fromTo
11079
+ function (f) {
11080
+ if (f === void 0) {
11081
+ f = () => ({});
11082
+ }
11083
+ return f(i), _this2.update();
11084
+ },
11085
+ // method
11086
+ function (f) {
11087
+ if (f === void 0) {
11088
+ f = () => Promise.reject(i);
11089
+ }
11090
+ return f(i).then(() => _this2.update());
11091
+ } // async
11092
+ ];
11093
+ }, types.find(i => i.type(o)));
11094
+ }
11095
+ /* eslint-enable no-sequences */
11096
+
10907
11097
  getComponentContext(includeHooks) {
10908
11098
  const ctx = {
10909
11099
  $f7route: this.context.f7route,
@@ -10919,7 +11109,9 @@
10919
11109
  $emit: this.emit.bind(this),
10920
11110
  $store: this.getComponentStore(),
10921
11111
  $ref: this.getComponentRef(),
10922
- $el: {}
11112
+ $el: {},
11113
+ $useState: this.getUseState(),
11114
+ $_useState: this._getUseState()
10923
11115
  };
10924
11116
  Object.defineProperty(ctx.$el, 'value', {
10925
11117
  get: () => {
@@ -11141,6 +11333,7 @@
11141
11333
  var $update = $$ctx.$update;
11142
11334
  var $store = $$ctx.$store;
11143
11335
  var $ref = $$ctx.$ref;
11336
+ var $useState = $$ctx.$useState;
11144
11337
 
11145
11338
  return $h\`${template}\`
11146
11339
  }