brew-js-react 0.1.5 → 0.1.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,16 +1,24 @@
1
1
  (function webpackUniversalModuleDefinition(root, factory) {
2
2
  if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory(require("brew-js"), require("react"), require("react-dom"), require("zeta-dom"), require("zeta-dom-react"), require("waterpipe"));
3
+ module.exports = factory(require("brew-js"), require("react"), require("react-dom"), require("zeta-dom"), require("zeta-dom-react"), require("waterpipe"), require("jQuery"));
4
4
  else if(typeof define === 'function' && define.amd)
5
- define("brew-js-react", ["brew-js", "react", "react-dom", "zeta-dom", "zeta-dom-react", "waterpipe"], factory);
5
+ define("brew-js-react", ["brew-js", "react", "react-dom", "zeta-dom", "zeta-dom-react", "waterpipe", "jQuery"], factory);
6
6
  else if(typeof exports === 'object')
7
- exports["brew-js-react"] = factory(require("brew-js"), require("react"), require("react-dom"), require("zeta-dom"), require("zeta-dom-react"), require("waterpipe"));
7
+ exports["brew-js-react"] = factory(require("brew-js"), require("react"), require("react-dom"), require("zeta-dom"), require("zeta-dom-react"), require("waterpipe"), require("jQuery"));
8
8
  else
9
- root["brew-js-react"] = factory(root["brew"], root["React"], root["ReactDOM"], root["zeta"], root["zeta-dom-react"], root["waterpipe"]);
10
- })(self, function(__WEBPACK_EXTERNAL_MODULE__80__, __WEBPACK_EXTERNAL_MODULE__359__, __WEBPACK_EXTERNAL_MODULE__318__, __WEBPACK_EXTERNAL_MODULE__654__, __WEBPACK_EXTERNAL_MODULE__103__, __WEBPACK_EXTERNAL_MODULE__28__) {
9
+ root["brew-js-react"] = factory(root["brew"], root["React"], root["ReactDOM"], root["zeta"], root["zeta-dom-react"], root["waterpipe"], root["jQuery"]);
10
+ })(self, function(__WEBPACK_EXTERNAL_MODULE__80__, __WEBPACK_EXTERNAL_MODULE__359__, __WEBPACK_EXTERNAL_MODULE__318__, __WEBPACK_EXTERNAL_MODULE__654__, __WEBPACK_EXTERNAL_MODULE__103__, __WEBPACK_EXTERNAL_MODULE__28__, __WEBPACK_EXTERNAL_MODULE__145__) {
11
11
  return /******/ (() => { // webpackBootstrap
12
12
  /******/ var __webpack_modules__ = ({
13
13
 
14
+ /***/ 145:
15
+ /***/ ((module) => {
16
+
17
+ "use strict";
18
+ module.exports = __WEBPACK_EXTERNAL_MODULE__145__;
19
+
20
+ /***/ }),
21
+
14
22
  /***/ 28:
15
23
  /***/ ((module) => {
16
24
 
@@ -59,6 +67,19 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__654__;
59
67
 
60
68
  /***/ }),
61
69
 
70
+ /***/ 346:
71
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
72
+
73
+ /// <reference types="jq-scrollable" />
74
+ // @ts-nocheck
75
+
76
+ /** @type {JQueryStatic} */
77
+ var jQuery = window.jQuery || __webpack_require__(145);
78
+
79
+ module.exports = jQuery;
80
+
81
+ /***/ }),
82
+
62
83
  /***/ 43:
63
84
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
64
85
 
@@ -148,6 +169,7 @@ __webpack_require__.d(src_namespaceObject, {
148
169
  "Dialog": () => (Dialog),
149
170
  "ErrorHandlerMixin": () => (ErrorHandlerMixin),
150
171
  "FlyoutMixin": () => (FlyoutMixin),
172
+ "FlyoutToggleMixin": () => (FlyoutToggleMixin),
151
173
  "FocusStateMixin": () => (FocusStateMixin),
152
174
  "LoadingStateMixin": () => (LoadingStateMixin),
153
175
  "Mixin": () => (Mixin),
@@ -676,9 +698,10 @@ function StatefulMixin() {
676
698
  }
677
699
  definePrototype(StatefulMixin, Mixin, {
678
700
  get ref() {
679
- var state = this.state;
680
- this.next();
681
- return state.ref || (state.ref = new MixinRefImpl(this.clone()));
701
+ var self = this;
702
+ var state = self.state;
703
+ self.next();
704
+ return state.ref || (state.ref = new MixinRefImpl(self.clone()));
682
705
  },
683
706
 
684
707
  get state() {
@@ -735,7 +758,27 @@ definePrototype(StatefulMixin, Mixin, {
735
758
 
736
759
 
737
760
 
761
+
738
762
  var ClassNameMixinSuper = StatefulMixin.prototype;
763
+
764
+ function checkState(self, element, state, isAsync) {
765
+ var classNames = state.classNames;
766
+ var prev = extend({}, classNames);
767
+ each(self.classNames, function (i, v) {
768
+ classNames[v] = element.classList.contains(v);
769
+ });
770
+
771
+ if (!equal(prev, classNames)) {
772
+ var cb = self.onClassNameUpdated.bind(self, element, prev, extend({}, classNames));
773
+
774
+ if (isAsync) {
775
+ setImmediate(cb);
776
+ } else {
777
+ cb();
778
+ }
779
+ }
780
+ }
781
+
739
782
  function ClassNameMixin(classNames) {
740
783
  StatefulMixin.call(this);
741
784
  this.classNames = classNames || [];
@@ -744,6 +787,16 @@ definePrototype(ClassNameMixin, StatefulMixin, {
744
787
  getClassNames: function getClassNames() {
745
788
  return [this.state.classNames];
746
789
  },
790
+ getRef: function getRef() {
791
+ var self = this;
792
+ var element = self.state.element;
793
+
794
+ if (element && containsOrEquals(root, element)) {
795
+ checkState(self, element, self.state, true);
796
+ }
797
+
798
+ return ClassNameMixinSuper.getRef.call(this);
799
+ },
747
800
  initState: function initState() {
748
801
  return {
749
802
  element: null,
@@ -754,14 +807,7 @@ definePrototype(ClassNameMixin, StatefulMixin, {
754
807
  var self = this;
755
808
  zeta_dom_dom.watchAttributes(element, ['class'], function (nodes) {
756
809
  if (nodes.includes(element)) {
757
- var prev = extend({}, state.classNames);
758
- each(self.classNames, function (i, v) {
759
- state.classNames[v] = element.classList.contains(v);
760
- });
761
-
762
- if (!equal(prev, state.classNames)) {
763
- self.onClassNameUpdated(element, prev, state.classNames);
764
- }
810
+ checkState(self, element, state);
765
811
  }
766
812
  });
767
813
  },
@@ -781,23 +827,26 @@ function AnimateMixin() {
781
827
  }
782
828
  definePrototype(AnimateMixin, ClassNameMixin, {
783
829
  next: function next() {
784
- this.effects = undefined;
785
- this.trigger = undefined;
786
- return AnimateMixinSuper.next.call(this);
830
+ var self = this;
831
+ self.effects = undefined;
832
+ self.trigger = undefined;
833
+ return AnimateMixinSuper.next.call(self);
787
834
  },
788
835
  "with": function _with(props) {
789
- this.effects = props.effects;
790
- this.trigger = props.trigger;
791
- return this;
836
+ var self = this;
837
+ self.effects = props.effects;
838
+ self.trigger = props.trigger;
839
+ return self;
792
840
  },
793
841
  withEffects: function withEffects() {
794
842
  this.effects = makeArray(arguments);
795
843
  return this;
796
844
  },
797
845
  getCustomAttributes: function getCustomAttributes() {
798
- return extend({}, AnimateMixinSuper.getCustomAttributes.call(this), {
799
- 'animate-in': (this.effects || []).join(' '),
800
- 'animate-on': this.trigger || 'show'
846
+ var self = this;
847
+ return extend({}, AnimateMixinSuper.getCustomAttributes.call(self), {
848
+ 'animate-in': (self.effects || []).join(' '),
849
+ 'animate-on': self.trigger || 'show'
801
850
  });
802
851
  }
803
852
  });
@@ -821,9 +870,10 @@ definePrototype(AnimateSequenceItemMixin, ClassNameMixin, {
821
870
  var AnimateSequenceMixinSuper = AnimateMixin.prototype;
822
871
  var animateSequenceMixinCounter = 0;
823
872
  function AnimateSequenceMixin() {
824
- AnimateMixin.call(this);
825
- this.className = 'brew-anim-' + ++animateSequenceMixinCounter;
826
- this.item = new AnimateSequenceItemMixin(this.className);
873
+ var self = this;
874
+ AnimateMixin.call(self);
875
+ self.className = 'brew-anim-' + ++animateSequenceMixinCounter;
876
+ self.item = new AnimateSequenceItemMixin(self.className);
827
877
  }
828
878
  definePrototype(AnimateSequenceMixin, AnimateMixin, {
829
879
  reset: function reset() {
@@ -890,19 +940,42 @@ definePrototype(ErrorHandlerMixin, StatefulMixin, {
890
940
  });
891
941
  }
892
942
  });
943
+ ;// CONCATENATED MODULE: ./src/mixins/FlyoutToggleMixin.js
944
+
945
+
946
+ var FlyoutToggleMixinSuper = ClassNameMixin.prototype;
947
+ function FlyoutToggleMixin(mixin) {
948
+ ClassNameMixin.call(this, ['target-opened']);
949
+ this.flyoutMixin = mixin;
950
+ }
951
+ definePrototype(FlyoutToggleMixin, ClassNameMixin, {
952
+ getCustomAttributes: function getCustomAttributes() {
953
+ var element = this.flyoutMixin.elements()[0];
954
+ return extend({}, FlyoutToggleMixinSuper.getCustomAttributes.call(this), {
955
+ 'toggle': element && '#' + element.id
956
+ });
957
+ },
958
+ clone: function clone() {
959
+ return extend(FlyoutToggleMixinSuper.clone.call(this), {
960
+ flyoutMixin: this.flyoutMixin
961
+ });
962
+ }
963
+ });
893
964
  ;// CONCATENATED MODULE: ./src/mixins/FlyoutMixin.js
894
965
 
895
966
 
896
967
 
968
+
897
969
  var FlyoutMixinSuper = ClassNameMixin.prototype;
898
970
  var flyoutMixinCounter = 0;
899
971
  function FlyoutMixin() {
900
- ClassNameMixin.call(this, ['open', 'closing', 'tweening-in', 'tweening-out']);
901
- this.modal = false;
902
- this.isFlyoutOpened = false;
903
- this.animating = false;
904
- this.visible = false;
905
- this.toggle = new ClassNameMixin(['target-opened']);
972
+ var self = this;
973
+ ClassNameMixin.call(self, ['open', 'closing', 'tweening-in', 'tweening-out']);
974
+ self.modal = false;
975
+ self.isFlyoutOpened = false;
976
+ self.animating = false;
977
+ self.visible = false;
978
+ self.toggle = new FlyoutToggleMixin(self);
906
979
  }
907
980
  definePrototype(FlyoutMixin, ClassNameMixin, {
908
981
  reset: function reset() {
@@ -918,13 +991,15 @@ definePrototype(FlyoutMixin, ClassNameMixin, {
918
991
  return this;
919
992
  },
920
993
  getCustomAttributes: function getCustomAttributes() {
921
- return extend({}, FlyoutMixinSuper.getCustomAttributes.call(this), {
922
- 'is-flyout': ''
923
- }, this.modal && {
994
+ var self = this;
995
+ return extend({}, FlyoutMixinSuper.getCustomAttributes.call(self), {
996
+ 'is-flyout': '',
997
+ 'swipe-dismiss': self.swipeToDismiss
998
+ }, self.modal && {
924
999
  'is-modal': ''
925
- }, this.effects && {
1000
+ }, self.effects && {
926
1001
  'animate-on': 'open',
927
- 'animate-in': this.effects.join(' '),
1002
+ 'animate-in': self.effects.join(' '),
928
1003
  'animate-out': ''
929
1004
  });
930
1005
  },
@@ -964,32 +1039,18 @@ definePrototype(FlyoutMixin, ClassNameMixin, {
964
1039
  });
965
1040
  },
966
1041
  clone: function clone() {
967
- var mixin = extend(FlyoutMixinSuper.clone.call(this), {
968
- toggle: this.toggle.ref.getMixin()
1042
+ var self = this;
1043
+ var mixin = extend(FlyoutMixinSuper.clone.call(self), {
1044
+ toggle: self.toggle.ref.getMixin()
969
1045
  });
970
- defineAliasProperty(mixin, 'isFlyoutOpened', this);
971
- defineAliasProperty(mixin, 'modal', this);
1046
+ defineAliasProperty(mixin, 'isFlyoutOpened', self);
1047
+ defineAliasProperty(mixin, 'modal', self);
972
1048
  return mixin;
973
1049
  },
974
1050
  onClassNameUpdated: function onClassNameUpdated(element, prevState, state) {
975
1051
  var self = this;
976
-
977
- var isAdded = function isAdded(v) {
978
- return prevState[v] !== state[v] && state[v];
979
- };
980
-
981
- var isRemoved = function isRemoved(v) {
982
- return prevState[v] !== state[v] && !state[v];
983
- };
984
-
985
- if (isAdded('open')) {
986
- self.isFlyoutOpened = true;
987
- self.visible = true;
988
- } else if (isAdded('closing') || isAdded('tweening-out')) {
989
- self.isFlyoutOpened = false;
990
- } else if (isRemoved('open')) {
991
- self.visible = false;
992
- }
1052
+ self.visible = state.open;
1053
+ self.isFlyoutOpened = state.open && !state.closing && !state['tweening-out'];
993
1054
  }
994
1055
  });
995
1056
  ;// CONCATENATED MODULE: ./src/mixins/FocusStateMixin.js
@@ -1054,16 +1115,21 @@ definePrototype(LoadingStateMixin, StatefulMixin, {
1054
1115
  }];
1055
1116
  }
1056
1117
  });
1118
+ // EXTERNAL MODULE: ./src/include/external/jquery.js
1119
+ var jquery = __webpack_require__(346);
1057
1120
  ;// CONCATENATED MODULE: ./src/mixins/ScrollableMixin.js
1058
1121
 
1059
1122
 
1060
1123
 
1061
1124
 
1125
+
1062
1126
  var ScrollableMixinSuper = ClassNameMixin.prototype;
1063
1127
  function ScrollableMixin() {
1064
- ClassNameMixin.call(this, ['scrollable-x', 'scrollable-x-l', 'scrollable-x-r', 'scrollable-y', 'scrollable-y-d', 'scrollable-y-u']);
1065
- this.target = Mixin.scrollableTarget;
1066
- this.pageIndex = 0;
1128
+ var self = this;
1129
+ ClassNameMixin.call(self, ['scrollable-x', 'scrollable-x-l', 'scrollable-x-r', 'scrollable-y', 'scrollable-y-d', 'scrollable-y-u']);
1130
+ self.target = Mixin.scrollableTarget;
1131
+ self.pageIndex = 0;
1132
+ self.scrolling = false;
1067
1133
  }
1068
1134
  definePrototype(ScrollableMixin, ClassNameMixin, {
1069
1135
  withOptions: function withOptions(options) {
@@ -1086,11 +1152,19 @@ definePrototype(ScrollableMixin, ClassNameMixin, {
1086
1152
  },
1087
1153
  initElement: function initElement(element, state) {
1088
1154
  var self = this;
1089
- app_app.on(element, 'statechange', function (e) {
1090
- if ('pageIndex' in e.newValues) {
1091
- extend(self, {
1092
- pageIndex: e.newValues.pageIndex
1093
- });
1155
+ app_app.on(element, {
1156
+ statechange: function statechange(e) {
1157
+ if ('pageIndex' in e.newValues) {
1158
+ extend(self, {
1159
+ pageIndex: e.newValues.pageIndex
1160
+ });
1161
+ }
1162
+ },
1163
+ scrollStart: function scrollStart() {
1164
+ self.scrolling = true;
1165
+ },
1166
+ scrollStop: function scrollStop() {
1167
+ self.scrolling = false;
1094
1168
  }
1095
1169
  }, true);
1096
1170
  },
@@ -1100,6 +1174,12 @@ definePrototype(ScrollableMixin, ClassNameMixin, {
1100
1174
  return mixin;
1101
1175
  }
1102
1176
  });
1177
+ each('destroy enable disable setOptions refresh scrollPadding stop scrollLeft scrollTop scrollBy scrollTo scrollByPage scrollToPage scrollToElement', function (i, v) {
1178
+ defineHiddenProperty(ScrollableMixin.prototype, v, function () {
1179
+ var obj = jquery(this.elements());
1180
+ return obj.scrollable.apply(obj, [v].concat(makeArray(arguments)));
1181
+ });
1182
+ });
1103
1183
  ;// CONCATENATED MODULE: ./src/mixin.js
1104
1184
 
1105
1185
 
@@ -1115,6 +1195,7 @@ definePrototype(ScrollableMixin, ClassNameMixin, {
1115
1195
 
1116
1196
 
1117
1197
 
1198
+
1118
1199
  function extendSelf(options) {
1119
1200
  extend(this, options);
1120
1201
  }
@@ -1140,7 +1221,7 @@ function useMixin(ctor) {
1140
1221
  })[0].reset();
1141
1222
  }
1142
1223
  function useMixinRef(mixin) {
1143
- return mixin.getMixin().reset();
1224
+ return mixin && mixin.getMixin().reset();
1144
1225
  }
1145
1226
 
1146
1227
  ;// CONCATENATED MODULE: ./tmp/brew-js/anim.js