brew-js-react 0.4.7 → 0.5.0

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,27 +1,17 @@
1
- /*! brew-js-react v0.4.7 | (c) misonou | https://hackmd.io/@misonou/brew-js-react */
1
+ /*! brew-js-react v0.5.0 | (c) misonou | https://misonou.github.io */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
- module.exports = factory(require("brew-js"), require("react"), require("react-dom"), (function webpackLoadOptionalExternalModule() { try { return require("react-dom/client"); } catch(e) {} }()), require("zeta-dom"), require("zeta-dom-react"), require("waterpipe"));
4
+ module.exports = factory(require("brew-js"), require("react"), require("react-dom"), require("zeta-dom"), require("zeta-dom-react"), require("waterpipe"), require("jquery"));
5
5
  else if(typeof define === 'function' && define.amd)
6
- define("brew-js-react", ["brew-js", "react", "react-dom", "react-dom/client", "zeta-dom", "zeta-dom-react", "waterpipe"], factory);
6
+ define("brew-js-react", ["brew-js", "react", "react-dom", "zeta-dom", "zeta-dom-react", "waterpipe", "jquery"], factory);
7
7
  else if(typeof exports === 'object')
8
- exports["brew-js-react"] = factory(require("brew-js"), require("react"), require("react-dom"), (function webpackLoadOptionalExternalModule() { try { return require("react-dom/client"); } catch(e) {} }()), require("zeta-dom"), require("zeta-dom-react"), require("waterpipe"));
8
+ exports["brew-js-react"] = factory(require("brew-js"), require("react"), require("react-dom"), require("zeta-dom"), require("zeta-dom-react"), require("waterpipe"), require("jquery"));
9
9
  else
10
- root["brew-js-react"] = factory(root["brew"], root["React"], root["ReactDOM"], root["react-dom/client"], root["zeta"], root["zeta-dom-react"], root["waterpipe"]);
11
- })(self, function(__WEBPACK_EXTERNAL_MODULE__80__, __WEBPACK_EXTERNAL_MODULE__359__, __WEBPACK_EXTERNAL_MODULE__318__, __WEBPACK_EXTERNAL_MODULE__715__, __WEBPACK_EXTERNAL_MODULE__654__, __WEBPACK_EXTERNAL_MODULE__103__, __WEBPACK_EXTERNAL_MODULE__28__) {
10
+ root["brew-js-react"] = factory(root["brew"], root["React"], root["ReactDOM"], root["zeta"], root["zeta-dom-react"], root["waterpipe"], root["jQuery"]);
11
+ })(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__47__) {
12
12
  return /******/ (() => { // webpackBootstrap
13
13
  /******/ var __webpack_modules__ = ({
14
14
 
15
- /***/ 715:
16
- /***/ ((module) => {
17
-
18
- "use strict";
19
- if(typeof __WEBPACK_EXTERNAL_MODULE__715__ === 'undefined') { var e = new Error("Cannot find module 'react-dom/client'"); e.code = 'MODULE_NOT_FOUND'; throw e; }
20
-
21
- module.exports = __WEBPACK_EXTERNAL_MODULE__715__;
22
-
23
- /***/ }),
24
-
25
15
  /***/ 28:
26
16
  /***/ ((module) => {
27
17
 
@@ -46,6 +36,14 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__80__;
46
36
 
47
37
  /***/ }),
48
38
 
39
+ /***/ 47:
40
+ /***/ ((module) => {
41
+
42
+ "use strict";
43
+ module.exports = __WEBPACK_EXTERNAL_MODULE__47__;
44
+
45
+ /***/ }),
46
+
49
47
  /***/ 359:
50
48
  /***/ ((module) => {
51
49
 
@@ -70,38 +68,33 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__654__;
70
68
 
71
69
  /***/ }),
72
70
 
73
- /***/ 662:
71
+ /***/ 862:
74
72
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
75
73
 
76
- var React = __webpack_require__(318);
74
+ var ReactDOM = __webpack_require__(318);
77
75
  var ReactDOMClient;
78
- try {
79
- ReactDOMClient = __webpack_require__(715);
80
- } catch (e) {
76
+
77
+ if (ReactDOM.createRoot) {
78
+ ReactDOMClient = ReactDOM;
79
+ } else {
81
80
  ReactDOMClient = {
82
81
  createRoot(container, options) {
83
82
  return {
84
83
  render(children) {
85
- React.render(children, container);
84
+ ReactDOM.render(children, container);
86
85
  },
87
86
  unmount() {
88
- React.unmountComponentAtNode(container);
87
+ ReactDOM.unmountComponentAtNode(container);
89
88
  }
90
89
  };
91
90
  },
92
91
  hydrateRoot(container, initialChildren, options) {
93
- React.hydrate(initialChildren, container);
94
- return {
95
- render(children) {
96
- React.render(children, container);
97
- },
98
- unmount() {
99
- React.unmountComponentAtNode(container);
100
- }
101
- };
92
+ ReactDOM.hydrate(initialChildren, container);
93
+ return ReactDOMClient.createRoot(container, options);
102
94
  },
103
95
  };
104
96
  }
97
+
105
98
  /** @type {import("react-dom/client")} */
106
99
  module.exports = ReactDOMClient;
107
100
 
@@ -182,6 +175,7 @@ __webpack_require__.d(src_namespaceObject, {
182
175
  "AnimateSequenceItemMixin": () => (AnimateSequenceItemMixin),
183
176
  "AnimateSequenceMixin": () => (AnimateSequenceMixin),
184
177
  "ClassNameMixin": () => (ClassNameMixin),
178
+ "ClassNameToggleMixin": () => (ClassNameToggleMixin),
185
179
  "Dialog": () => (Dialog),
186
180
  "FlyoutMixin": () => (FlyoutMixin),
187
181
  "FlyoutToggleMixin": () => (FlyoutToggleMixin),
@@ -191,6 +185,7 @@ __webpack_require__.d(src_namespaceObject, {
191
185
  "ScrollIntoViewMixin": () => (ScrollIntoViewMixin),
192
186
  "ScrollableMixin": () => (ScrollableMixin),
193
187
  "StatefulMixin": () => (StatefulMixin),
188
+ "UnmanagedClassNameMixin": () => (UnmanagedClassNameMixin),
194
189
  "ViewStateContainer": () => (ViewStateContainer),
195
190
  "createDialog": () => (createDialog),
196
191
  "default": () => (src),
@@ -208,6 +203,7 @@ __webpack_require__.d(src_namespaceObject, {
208
203
  "useAnimateSequenceMixin": () => (useAnimateSequenceMixin),
209
204
  "useAppReady": () => (useAppReady),
210
205
  "useAppReadyState": () => (useAppReadyState),
206
+ "useClassNameToggleMixin": () => (useClassNameToggleMixin),
211
207
  "useFlyoutMixin": () => (useFlyoutMixin),
212
208
  "useFocusStateMixin": () => (useFocusStateMixin),
213
209
  "useLanguage": () => (useLanguage),
@@ -218,6 +214,7 @@ __webpack_require__.d(src_namespaceObject, {
218
214
  "useRouteState": () => (useRouteState),
219
215
  "useScrollIntoViewMixin": () => (useScrollIntoViewMixin),
220
216
  "useScrollableMixin": () => (useScrollableMixin),
217
+ "useUnmanagedClassNameMixin": () => (useUnmanagedClassNameMixin),
221
218
  "useViewContainerState": () => (useViewContext),
222
219
  "useViewContext": () => (useViewContext)
223
220
  });
@@ -231,6 +228,7 @@ var _defaultExport = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_roo
231
228
  var install = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.install,
232
229
  addExtension = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.addExtension,
233
230
  addDetect = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.addDetect,
231
+ emitAppEvent = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.emitAppEvent,
234
232
  isElementActive = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.isElementActive;
235
233
 
236
234
  ;// CONCATENATED MODULE: ./src/include/brew-js/app.js
@@ -241,14 +239,14 @@ var install = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_
241
239
  var external_commonjs_react_commonjs2_react_amd_react_root_React_ = __webpack_require__(359);
242
240
  // EXTERNAL MODULE: external {"commonjs":"react-dom","commonjs2":"react-dom","amd":"react-dom","root":"ReactDOM"}
243
241
  var external_commonjs_react_dom_commonjs2_react_dom_amd_react_dom_root_ReactDOM_ = __webpack_require__(318);
244
- // EXTERNAL MODULE: ./node_modules/@misonou/react-dom-client/index.js
245
- var react_dom_client = __webpack_require__(662);
242
+ // EXTERNAL MODULE: ./node_modules/@misonou/react-dom-client/fallback.js
243
+ var fallback = __webpack_require__(862);
246
244
  ;// CONCATENATED MODULE: ./src/include/external/react-dom-client.js
247
245
  // @ts-nocheck
248
246
 
249
247
  /** @type {import("react-dom/client")} */
250
248
 
251
- /* harmony default export */ const external_react_dom_client = (react_dom_client);
249
+ /* harmony default export */ const react_dom_client = (fallback);
252
250
  // EXTERNAL MODULE: external {"commonjs":"zeta-dom","commonjs2":"zeta-dom","amd":"zeta-dom","root":"zeta"}
253
251
  var external_commonjs_zeta_dom_commonjs2_zeta_dom_amd_zeta_dom_root_zeta_ = __webpack_require__(654);
254
252
  ;// CONCATENATED MODULE: ./tmp/zeta-dom/util.js
@@ -292,6 +290,7 @@ var _lib$util = external_commonjs_zeta_dom_commonjs2_zeta_dom_amd_zeta_dom_root_
292
290
  setIntervalSafe = _lib$util.setIntervalSafe,
293
291
  setImmediate = _lib$util.setImmediate,
294
292
  setImmediateOnce = _lib$util.setImmediateOnce,
293
+ clearImmediateOnce = _lib$util.clearImmediateOnce,
295
294
  _throws = _lib$util["throws"],
296
295
  throwNotFunction = _lib$util.throwNotFunction,
297
296
  errorWithCode = _lib$util.errorWithCode,
@@ -438,7 +437,7 @@ var addAsyncAction = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_roo
438
437
 
439
438
  function createDialog(props) {
440
439
  var root = document.createElement('div');
441
- var reactRoot = external_react_dom_client.createRoot(root);
440
+ var reactRoot = react_dom_client.createRoot(root);
442
441
 
443
442
  var _closeDialog = closeFlyout.bind(0, root);
444
443
 
@@ -611,6 +610,9 @@ var emitter = new ZetaEventContainer();
611
610
  var rootContext = freeze(extend(new ViewContext(null, null), {
612
611
  container: root
613
612
  }));
613
+
614
+ var rootState = _(rootContext);
615
+
614
616
  var StateContext = /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.createContext(rootContext);
615
617
  var errorView;
616
618
  /** @type {Partial<Zeta.ZetaEventType<"beforepageload", Brew.RouterEventMap, Element>>} */
@@ -618,6 +620,8 @@ var errorView;
618
620
  var view_event = {};
619
621
  onAppInit(function () {
620
622
  app_app.on('beforepageload', function (e) {
623
+ rootState.setPage(app_app.page);
624
+ rootState.setActive(true);
621
625
  view_event = e;
622
626
  e.waitFor(new Promise(function (resolve) {
623
627
  (function updateViewRecursive(next) {
@@ -635,21 +639,20 @@ onAppInit(function () {
635
639
  return v.children;
636
640
  }));
637
641
  });
638
- })(_(rootContext).children);
642
+ })(rootState.children);
639
643
  }));
640
-
641
- _(rootContext).setPage(app_app.page);
642
644
  });
643
645
  });
644
646
 
645
647
  function ViewContext(view, page) {
646
648
  var self = this;
649
+ watch(self, true);
647
650
  defineOwnProperty(self, 'view', view, true);
648
651
 
649
652
  _(self, {
650
653
  children: [],
651
654
  setPage: defineObservableProperty(self, 'page', page, true),
652
- setActive: defineObservableProperty(self, 'active', true, true)
655
+ setActive: defineObservableProperty(self, 'active', !!page, true)
653
656
  });
654
657
 
655
658
  watch(self, 'page', function (page, previousPage) {
@@ -787,7 +790,7 @@ definePrototype(ViewContainer, external_commonjs_react_commonjs2_react_amd_react
787
790
  self.currentElement = element;
788
791
  state.container = element;
789
792
  promise.then(function () {
790
- animateIn(element, 'show');
793
+ animateIn(element, 'show', '[brew-view]', true);
791
794
  app_app.emit('pageenter', element, {
792
795
  pathname: app_app.path
793
796
  }, true);
@@ -804,7 +807,8 @@ definePrototype(ViewContainer, external_commonjs_react_commonjs2_react_amd_react
804
807
  key: routeMap.get(V).id,
805
808
  value: state
806
809
  }, /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement(ViewStateContainer, null, /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement('div', extend({}, self.props.rootProps, {
807
- ref: initElement
810
+ ref: initElement,
811
+ 'brew-view': ''
808
812
  }), /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement(ErrorBoundary, {
809
813
  onComponentLoaded: onComponentLoaded,
810
814
  viewProps: viewProps
@@ -1000,26 +1004,24 @@ function redirectTo(view, params, data) {
1000
1004
 
1001
1005
 
1002
1006
 
1003
-
1004
1007
  var hooks_emitter = new ZetaEventContainer();
1005
1008
 
1006
1009
  function getCurrentStates() {
1007
1010
  return app_app.historyStorage.current;
1008
1011
  }
1009
1012
 
1010
- function ViewState(key, value) {
1013
+ function ViewState(key, dispose) {
1011
1014
  this.key = key;
1012
- this.value = value;
1015
+ this.store = getCurrentStates();
1016
+ this.dispose = dispose;
1013
1017
  }
1014
1018
 
1015
1019
  definePrototype(ViewState, {
1016
1020
  get: function get() {
1017
- return this.value;
1021
+ return this.store.get(this.key);
1018
1022
  },
1019
- set: function set(value) {
1020
- var self = this;
1021
- self.value = value;
1022
- self.store.set(self.key, value);
1023
+ set: function set(value, snapshot) {
1024
+ this.store = updatePersistedValue(this.store, this.key, value, snapshot);
1023
1025
  },
1024
1026
  onPopState: function onPopState(callback) {
1025
1027
  throwNotFunction(callback);
@@ -1028,6 +1030,47 @@ definePrototype(ViewState, {
1028
1030
  });
1029
1031
  }
1030
1032
  });
1033
+
1034
+ function updatePersistedValue(cur, key, value, snapshot) {
1035
+ if (cur.get(key) !== value) {
1036
+ if (snapshot && cur.has(key)) {
1037
+ app_app.snapshot();
1038
+ cur = getCurrentStates();
1039
+ }
1040
+
1041
+ cur.set(key, value);
1042
+ }
1043
+
1044
+ return cur;
1045
+ }
1046
+
1047
+ function updateViewState(state, key, store) {
1048
+ var newValue = state.get();
1049
+
1050
+ if (key !== state.key || store !== state.store && store.has(key)) {
1051
+ newValue = store.get(key);
1052
+ hooks_emitter.emit('popstate', state, {
1053
+ newValue: newValue
1054
+ });
1055
+ }
1056
+
1057
+ state.key = key;
1058
+ state.store = store;
1059
+ store.set(key, newValue);
1060
+ }
1061
+
1062
+ function useViewContextWithEffect(callback, deps) {
1063
+ var container = useViewContext();
1064
+ (0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useEffect)(function () {
1065
+ return app_app.on('beforepageload popstate', function () {
1066
+ if (container.active) {
1067
+ callback(getCurrentStates());
1068
+ }
1069
+ });
1070
+ }, deps);
1071
+ return container;
1072
+ }
1073
+
1031
1074
  function useAppReady() {
1032
1075
  return useAppReadyState().ready;
1033
1076
  }
@@ -1079,57 +1122,42 @@ function useRouteParam(name, defaultValue) {
1079
1122
  return value;
1080
1123
  }
1081
1124
  function useRouteState(key, defaultValue, snapshotOnUpdate) {
1082
- var container = useViewContext();
1083
1125
  var cur = getCurrentStates();
1084
- var state = (0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useState)(cur.has(key) ? cur.get(key) : defaultValue);
1085
-
1086
- if (container.active && cur.get(key) !== state[0]) {
1087
- if (snapshotOnUpdate && cur.has(key)) {
1088
- app_app.snapshot();
1089
- cur = getCurrentStates();
1090
- }
1126
+ var state = (0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useState)(cur && cur.has(key) ? cur.get(key) : defaultValue);
1127
+ var container = useViewContextWithEffect(function (cur) {
1128
+ state[1](function (oldValue) {
1129
+ return cur.has(key) ? cur.get(key) : (cur.set(key, oldValue), oldValue);
1130
+ });
1131
+ }, [key]);
1091
1132
 
1092
- cur.set(key, state[0]);
1133
+ if (!cur) {
1134
+ // delay app ready to ensure that beforepageload event can be caught
1135
+ app_app.beforeInit(delay(1));
1136
+ } else if (container.active) {
1137
+ updatePersistedValue(cur, key, state[0], snapshotOnUpdate);
1093
1138
  }
1094
1139
 
1095
- (0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useEffect)(function () {
1096
- if (snapshotOnUpdate) {
1097
- return bind(window, 'popstate', function () {
1098
- if (container.active) {
1099
- var cur = getCurrentStates();
1100
- state[1](cur.has(key) ? cur.get(key) : defaultValue);
1101
- }
1102
- });
1103
- }
1104
- }, [container, snapshotOnUpdate]);
1105
1140
  return state;
1106
1141
  }
1107
1142
  function ViewStateContainer(props) {
1108
- var container = useViewContext();
1143
+ var cache = (0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useState)({})[0];
1144
+ var container = useViewContextWithEffect(function (cur) {
1145
+ each(cache, function (i, v) {
1146
+ updateViewState(v, v.key, cur);
1147
+ });
1148
+ }, []);
1109
1149
  var provider = (0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useState)(function () {
1110
- var cache = {};
1111
1150
  return {
1112
1151
  getState: function getState(uniqueId, key) {
1113
- var cur = getCurrentStates();
1114
- var value = cur.get(key);
1115
- var state = cache[uniqueId] || (cache[uniqueId] = new ViewState(key, value));
1116
-
1117
- if (container.active) {
1118
- var store = state.store;
1119
-
1120
- if (store && (store !== cur && cur.has(key) || key !== state.key)) {
1121
- hooks_emitter.emit('popstate', state, {
1122
- newValue: value
1123
- });
1124
- state.value = value;
1125
- state.key = key;
1126
- }
1152
+ var state = cache[uniqueId];
1127
1153
 
1128
- state.store = cur;
1129
- cur.set(key, state.value);
1154
+ if (state && container.active) {
1155
+ updateViewState(state, key, getCurrentStates());
1130
1156
  }
1131
1157
 
1132
- return state;
1158
+ return state || (cache[uniqueId] = new ViewState(key, function () {
1159
+ delete cache[uniqueId];
1160
+ }));
1133
1161
  }
1134
1162
  };
1135
1163
  })[0];
@@ -1260,6 +1288,9 @@ definePrototype(StaticAttributeMixin, Mixin, {
1260
1288
 
1261
1289
  function Mixin() {}
1262
1290
  definePrototype(Mixin, {
1291
+ reset: function reset() {
1292
+ return this;
1293
+ },
1263
1294
  next: function next() {},
1264
1295
  getRef: function getRef() {
1265
1296
  return noop;
@@ -1348,54 +1379,59 @@ function StatefulMixin() {
1348
1379
  Mixin.call(this);
1349
1380
 
1350
1381
  StatefulMixin_(this, {
1351
- elements: new WeakSet(),
1382
+ elements: new Set(),
1383
+ states: new WeakMap(),
1352
1384
  flush: watch(this, false),
1353
- dispose: [],
1354
- states: {},
1355
- prefix: '',
1356
- counter: 0
1385
+ dispose: []
1357
1386
  });
1358
1387
  }
1359
1388
  definePrototype(StatefulMixin, Mixin, {
1360
1389
  get ref() {
1361
- var self = this;
1362
- var state = self.state;
1363
- self.next();
1364
- return state.ref || (state.ref = new MixinRefImpl(self.clone()));
1390
+ var state = StatefulMixin_(this);
1391
+
1392
+ return state.ref || (state.ref = new MixinRefImpl(this));
1365
1393
  },
1366
1394
 
1367
1395
  get state() {
1368
- var obj = StatefulMixin_(this);
1369
-
1370
- var key = obj.prefix + obj.counter;
1371
- return obj.states[key] || (obj.states[key] = this.initState());
1396
+ return StatefulMixin_(this).pending;
1372
1397
  },
1373
1398
 
1374
1399
  reset: function reset() {
1375
- StatefulMixin_(this).counter = 0;
1400
+ StatefulMixin_(this).pending = {};
1376
1401
  return this;
1377
1402
  },
1378
1403
  next: function next() {
1379
- StatefulMixin_(this).counter++;
1404
+ StatefulMixin_(this).pending = {};
1380
1405
  return this;
1381
1406
  },
1382
1407
  getRef: function getRef() {
1383
1408
  var self = this;
1384
- var state = self.state;
1409
+
1410
+ var obj = StatefulMixin_(self);
1411
+
1412
+ var newState = obj.pending;
1413
+ var state;
1385
1414
  return function (current) {
1386
- state.element = current;
1415
+ if (current) {
1416
+ state = obj.states.get(current) || extend(self.initState(), newState);
1417
+
1418
+ if (state.element !== current) {
1419
+ state.element = current;
1420
+ self.initElement(current, state);
1421
+ obj.states.set(current, state);
1422
+ } else if (util_keys(newState)[0]) {
1423
+ self.mergeState(current, state, newState);
1424
+ }
1387
1425
 
1388
- if (current && setAdd(StatefulMixin_(self).elements, current)) {
1389
- self.initElement(current, state);
1426
+ self.onLayoutEffect(current, state);
1427
+ obj.elements.add(current);
1428
+ } else {
1429
+ obj.elements["delete"](state.element);
1390
1430
  }
1391
1431
  };
1392
1432
  },
1393
1433
  elements: function elements() {
1394
- return values(StatefulMixin_(this).states).map(function (v) {
1395
- return v.element;
1396
- }).filter(function (v) {
1397
- return v;
1398
- });
1434
+ return map(StatefulMixin_(this).elements, pipe);
1399
1435
  },
1400
1436
  onDispose: function onDispose(callback) {
1401
1437
  StatefulMixin_(this).dispose.push(callback);
@@ -1406,27 +1442,20 @@ definePrototype(StatefulMixin, Mixin, {
1406
1442
  };
1407
1443
  },
1408
1444
  initElement: function initElement(element, state) {},
1445
+ mergeState: function mergeState(element, state, newState) {
1446
+ extend(state, newState);
1447
+ },
1448
+ onLayoutEffect: function onLayoutEffect(element, state) {},
1409
1449
  clone: function clone() {
1410
- var self = this;
1411
- var clone = inherit(Object.getPrototypeOf(self), self);
1412
-
1413
- StatefulMixin_(clone, extend({}, StatefulMixin_(self), {
1414
- prefix: randomId() + '.',
1415
- counter: 0
1416
- }));
1417
-
1418
- return clone;
1450
+ return this;
1419
1451
  },
1420
1452
  dispose: function dispose() {
1421
1453
  var state = StatefulMixin_(this);
1422
1454
 
1423
- var states = state.states;
1424
1455
  combineFn(state.dispose.splice(0))();
1425
1456
  state.flush();
1426
- state.elements = new WeakSet();
1427
- each(states, function (i, v) {
1428
- delete states[i];
1429
- });
1457
+ state.states = {};
1458
+ state.pending = {};
1430
1459
  }
1431
1460
  });
1432
1461
  ;// CONCATENATED MODULE: ./src/mixins/ClassNameMixin.js
@@ -1435,23 +1464,15 @@ definePrototype(StatefulMixin, Mixin, {
1435
1464
 
1436
1465
 
1437
1466
 
1438
- var ClassNameMixinSuper = StatefulMixin.prototype;
1439
-
1440
- function checkState(self, element, state, isAsync) {
1467
+ function checkState(self, element, state, fireEvent) {
1441
1468
  var classNames = state.classNames;
1442
1469
  var prev = extend({}, classNames);
1443
- each(self.classNames, function (i, v) {
1444
- classNames[v] = element.classList.contains(v);
1470
+ each(classNames, function (i) {
1471
+ classNames[i] = element.classList.contains(i);
1445
1472
  });
1446
1473
 
1447
- if (!equal(prev, classNames)) {
1448
- var cb = self.onClassNameUpdated.bind(self, element, prev, extend({}, classNames));
1449
-
1450
- if (isAsync) {
1451
- setImmediate(cb);
1452
- } else {
1453
- cb();
1454
- }
1474
+ if (fireEvent && !equal(prev, classNames)) {
1475
+ self.onClassNameUpdated(element, prev, extend({}, classNames));
1455
1476
  }
1456
1477
  }
1457
1478
 
@@ -1460,31 +1481,22 @@ function ClassNameMixin(classNames) {
1460
1481
  this.classNames = classNames || [];
1461
1482
  }
1462
1483
  definePrototype(ClassNameMixin, StatefulMixin, {
1463
- getClassNames: function getClassNames() {
1464
- return [this.state.classNames];
1465
- },
1466
- getRef: function getRef() {
1467
- var self = this;
1468
- var element = self.state.element;
1469
-
1470
- if (element && containsOrEquals(zeta_dom_dom.root, element)) {
1471
- checkState(self, element, self.state, true);
1472
- }
1473
-
1474
- return ClassNameMixinSuper.getRef.call(this);
1475
- },
1476
1484
  initState: function initState() {
1477
1485
  return {
1478
1486
  element: null,
1479
- classNames: {}
1487
+ classNames: fill(this.classNames, false)
1480
1488
  };
1481
1489
  },
1482
1490
  initElement: function initElement(element, state) {
1483
1491
  var self = this;
1492
+ checkState(self, element, state);
1484
1493
  watchOwnAttributes(element, 'class', function () {
1485
- checkState(self, element, state);
1494
+ checkState(self, element, state, true);
1486
1495
  });
1487
1496
  },
1497
+ onLayoutEffect: function onLayoutEffect(element, state) {
1498
+ setClass(element, state.classNames);
1499
+ },
1488
1500
  onClassNameUpdated: function onClassNameUpdated(element, prevState, state) {}
1489
1501
  });
1490
1502
  ;// CONCATENATED MODULE: ./src/mixins/AnimateMixin.js
@@ -1528,14 +1540,27 @@ function AnimateSequenceItemMixin(className) {
1528
1540
  this.className = className;
1529
1541
  }
1530
1542
  definePrototype(AnimateSequenceItemMixin, ClassNameMixin, {
1543
+ getCustomAttributes: function getCustomAttributes() {
1544
+ return extend({}, AnimateSequenceItemMixinSuper.getCustomAttributes.call(this), {
1545
+ 'is-animate-sequence': ''
1546
+ });
1547
+ },
1531
1548
  getClassNames: function getClassNames() {
1532
1549
  return [this.className].concat(AnimateSequenceItemMixinSuper.getClassNames.call(this));
1533
1550
  }
1534
1551
  });
1552
+ // EXTERNAL MODULE: external {"commonjs":"jquery","commonjs2":"jquery","amd":"jquery","root":"jQuery"}
1553
+ var external_commonjs_jquery_commonjs2_jquery_amd_jquery_root_jQuery_ = __webpack_require__(47);
1554
+ ;// CONCATENATED MODULE: ./src/include/external/jquery.js
1555
+ // @ts-nocheck
1556
+
1557
+ /* harmony default export */ const jquery = (external_commonjs_jquery_commonjs2_jquery_amd_jquery_root_jQuery_);
1535
1558
  ;// CONCATENATED MODULE: ./src/mixins/AnimateSequenceMixin.js
1536
1559
 
1537
1560
 
1538
1561
 
1562
+
1563
+
1539
1564
  var AnimateSequenceMixinSuper = AnimateMixin.prototype;
1540
1565
  var animateSequenceMixinCounter = 0;
1541
1566
  function AnimateSequenceMixin() {
@@ -1549,10 +1574,6 @@ definePrototype(AnimateSequenceMixin, AnimateMixin, {
1549
1574
  this.selector = options;
1550
1575
  return this;
1551
1576
  },
1552
- reset: function reset() {
1553
- this.item.reset();
1554
- return AnimateSequenceMixinSuper.reset.call(this);
1555
- },
1556
1577
  getCustomAttributes: function getCustomAttributes() {
1557
1578
  var self = this;
1558
1579
  return extend({}, AnimateSequenceMixinSuper.getCustomAttributes.call(self), {
@@ -1561,10 +1582,37 @@ definePrototype(AnimateSequenceMixin, AnimateMixin, {
1561
1582
  'animate-sequence': self.selector || '.' + self.className
1562
1583
  });
1563
1584
  },
1564
- clone: function clone() {
1565
- return extend(AnimateSequenceMixinSuper.clone.call(this), {
1566
- item: this.item.ref.getMixin()
1585
+ initElement: function initElement(element, state) {
1586
+ var self = this;
1587
+ AnimateSequenceMixinSuper.initElement.call(self, element, state);
1588
+
1589
+ if (self.selector) {
1590
+ self.onDispose(watchElements(element, self.selector, function (addedNodes) {
1591
+ jquery(addedNodes).attr('is-animate-sequence', '');
1592
+ }));
1593
+ }
1594
+ }
1595
+ });
1596
+ ;// CONCATENATED MODULE: ./src/mixins/ClassNameToggleMixin.js
1597
+
1598
+
1599
+
1600
+ function ClassNameToggleMixin() {
1601
+ StatefulMixin.call(this);
1602
+ }
1603
+ definePrototype(ClassNameToggleMixin, StatefulMixin, {
1604
+ withOptions: function withOptions(classes) {
1605
+ this.classes = extend({}, classes);
1606
+ },
1607
+ getClassNames: function getClassNames() {
1608
+ return this.classes;
1609
+ },
1610
+ set: function set(name, value) {
1611
+ value = isPlainObject(name) || kv(name, value);
1612
+ each(this.elements(), function (i, v) {
1613
+ setClass(v, value);
1567
1614
  });
1615
+ extend(this.classes, value);
1568
1616
  }
1569
1617
  });
1570
1618
  ;// CONCATENATED MODULE: ./src/mixins/FlyoutToggleMixin.js
@@ -1600,7 +1648,6 @@ definePrototype(FlyoutToggleMixin, ClassNameMixin, {
1600
1648
 
1601
1649
  var FlyoutMixinSuper = ClassNameMixin.prototype;
1602
1650
  var valueMap = new WeakMap();
1603
- var aliasProps = 'animating isFlyoutOpened modal tabThrough visible'.split(' ');
1604
1651
  function FlyoutMixin() {
1605
1652
  var self = this;
1606
1653
  ClassNameMixin.call(self, ['open', 'closing', 'visible', 'tweening-in', 'tweening-out']);
@@ -1616,10 +1663,6 @@ function FlyoutMixin() {
1616
1663
  });
1617
1664
  }
1618
1665
  definePrototype(FlyoutMixin, ClassNameMixin, {
1619
- reset: function reset() {
1620
- this.toggle.reset();
1621
- return FlyoutMixinSuper.reset.call(this);
1622
- },
1623
1666
  next: function next() {
1624
1667
  this.effects = undefined;
1625
1668
  return FlyoutMixinSuper.next.call(this);
@@ -1677,16 +1720,6 @@ definePrototype(FlyoutMixin, ClassNameMixin, {
1677
1720
  }
1678
1721
  }, true));
1679
1722
  },
1680
- clone: function clone() {
1681
- var self = this;
1682
- var mixin = extend(FlyoutMixinSuper.clone.call(self), {
1683
- toggle: self.toggle.ref.getMixin()
1684
- });
1685
- each(aliasProps, function (i, v) {
1686
- defineAliasProperty(mixin, v, self);
1687
- });
1688
- return mixin;
1689
- },
1690
1723
  onClassNameUpdated: function onClassNameUpdated(element, prevState, state) {
1691
1724
  var self = this;
1692
1725
  self.visible = state.open;
@@ -1734,16 +1767,8 @@ definePrototype(FocusStateMixin, StatefulMixin, {
1734
1767
  }
1735
1768
  }));
1736
1769
  },
1737
- getClassNames: function getClassNames() {
1738
- var classes = {};
1739
- var focused = this.state.focused;
1740
-
1741
- if (focused) {
1742
- classes.focused = true;
1743
- classes['focused-' + focused] = true;
1744
- }
1745
-
1746
- return [classes];
1770
+ onLayoutEffect: function onLayoutEffect(element, state) {
1771
+ setClass(element, 'focused', state.focused);
1747
1772
  }
1748
1773
  });
1749
1774
  ;// CONCATENATED MODULE: ./src/mixins/LoadingStateMixin.js
@@ -1751,7 +1776,6 @@ definePrototype(FocusStateMixin, StatefulMixin, {
1751
1776
 
1752
1777
 
1753
1778
 
1754
-
1755
1779
  var LoadingStateMixinSuper = StatefulMixin.prototype;
1756
1780
  function LoadingStateMixin() {
1757
1781
  StatefulMixin.call(this);
@@ -1764,10 +1788,8 @@ definePrototype(LoadingStateMixin, StatefulMixin, {
1764
1788
  setClass(element, 'loading', loading);
1765
1789
  }));
1766
1790
  },
1767
- getClassNames: function getClassNames() {
1768
- return [{
1769
- loading: !!this.state.loading
1770
- }];
1791
+ onLayoutEffect: function onLayoutEffect(element, state) {
1792
+ setClass(element, 'loading', state.loading);
1771
1793
  }
1772
1794
  });
1773
1795
  ;// CONCATENATED MODULE: ./tmp/brew-js/directive.js
@@ -1782,7 +1804,6 @@ var getDirectiveComponent = external_commonjs_brew_js_commonjs2_brew_js_amd_brew
1782
1804
 
1783
1805
 
1784
1806
  var ScrollableMixinSuper = ClassNameMixin.prototype;
1785
- var ScrollableMixin_aliasProps = 'pageIndex scrolling'.split(' ');
1786
1807
  function ScrollableMixin() {
1787
1808
  var self = this;
1788
1809
  ClassNameMixin.call(self, ['scrollable-x', 'scrollable-x-l', 'scrollable-x-r', 'scrollable-y', 'scrollable-y-d', 'scrollable-y-u']);
@@ -1811,6 +1832,7 @@ definePrototype(ScrollableMixin, ClassNameMixin, {
1811
1832
  },
1812
1833
  initElement: function initElement(element, state) {
1813
1834
  var self = this;
1835
+ ScrollableMixinSuper.initElement.call(self, element, state);
1814
1836
  self.onDispose(app_app.on(element, {
1815
1837
  scrollIndexChange: function scrollIndexChange(e) {
1816
1838
  self.pageIndex = e.newIndex;
@@ -1822,13 +1844,6 @@ definePrototype(ScrollableMixin, ClassNameMixin, {
1822
1844
  self.scrolling = false;
1823
1845
  }
1824
1846
  }, true));
1825
- },
1826
- clone: function clone() {
1827
- var mixin = ScrollableMixinSuper.clone.call(this);
1828
- each(ScrollableMixin_aliasProps, function (i, v) {
1829
- defineAliasProperty(mixin, v, self);
1830
- });
1831
- return mixin;
1832
1847
  }
1833
1848
  });
1834
1849
  each('destroy enable disable setOptions setStickyPosition refresh scrollPadding stop scrollLeft scrollTop scrollBy scrollTo scrollByPage scrollToPage scrollToElement', function (i, v) {
@@ -1846,17 +1861,31 @@ function ScrollIntoViewMixin() {
1846
1861
  }
1847
1862
  definePrototype(ScrollIntoViewMixin, StatefulMixin, {
1848
1863
  when: function when(deps) {
1849
- var state = this.state;
1864
+ this.state.deps = deps;
1865
+ return this;
1866
+ },
1867
+ initElement: function initElement(element, state) {
1868
+ state.callback = function () {
1869
+ scrollIntoView(element);
1870
+ };
1871
+ },
1872
+ mergeState: function mergeState(element, state, newState) {
1873
+ if (newState.deps && !equal(newState.deps, state.deps)) {
1874
+ setImmediateOnce(state.callback);
1875
+ }
1850
1876
 
1851
- var callback = state.callback || (state.callback = function () {
1852
- scrollIntoView(state.element);
1853
- });
1877
+ extend(state, newState);
1878
+ }
1879
+ });
1880
+ ;// CONCATENATED MODULE: ./src/mixins/UnmanagedClassNameMixin.js
1854
1881
 
1855
- if (state.deps && !equal(deps, state.deps)) {
1856
- setImmediateOnce(callback);
1857
- }
1858
1882
 
1859
- state.deps = makeArray(deps);
1883
+ function UnmanagedClassNameMixin() {
1884
+ ClassNameMixin.call(this);
1885
+ }
1886
+ definePrototype(UnmanagedClassNameMixin, ClassNameMixin, {
1887
+ memorize: function memorize() {
1888
+ this.classNames = makeArray(arguments);
1860
1889
  return this;
1861
1890
  }
1862
1891
  });
@@ -1876,6 +1905,8 @@ definePrototype(ScrollIntoViewMixin, StatefulMixin, {
1876
1905
 
1877
1906
 
1878
1907
 
1908
+
1909
+
1879
1910
  function extendSelf(options) {
1880
1911
  extend(this, options);
1881
1912
  }
@@ -1890,11 +1921,13 @@ function createUseFunction(ctor) {
1890
1921
 
1891
1922
  var useAnimateMixin = createUseFunction(AnimateMixin);
1892
1923
  var useAnimateSequenceMixin = createUseFunction(AnimateSequenceMixin);
1924
+ var useClassNameToggleMixin = createUseFunction(ClassNameToggleMixin);
1893
1925
  var useFlyoutMixin = createUseFunction(FlyoutMixin);
1894
1926
  var useFocusStateMixin = createUseFunction(FocusStateMixin);
1895
1927
  var useLoadingStateMixin = createUseFunction(LoadingStateMixin);
1896
1928
  var useScrollableMixin = createUseFunction(ScrollableMixin);
1897
1929
  var useScrollIntoViewMixin = createUseFunction(ScrollIntoViewMixin);
1930
+ var useUnmanagedClassNameMixin = createUseFunction(UnmanagedClassNameMixin);
1898
1931
  function useMixin(ctor) {
1899
1932
  return (0,external_zeta_dom_react_.useSingleton)(function () {
1900
1933
  return new ctor();