brew-js-react 0.5.3 → 0.5.4

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 (49) hide show
  1. package/app.js +3 -3
  2. package/dialog.js +6 -6
  3. package/dist/brew-js-react.js +182 -445
  4. package/dist/brew-js-react.js.map +1 -1
  5. package/dist/brew-js-react.min.js +2 -2
  6. package/dist/brew-js-react.min.js.map +1 -1
  7. package/entry.js +1 -1
  8. package/hooks.js +2 -2
  9. package/i18n.js +2 -2
  10. package/index.d.ts +1 -1
  11. package/index.js +1 -1
  12. package/mixin.js +1 -1
  13. package/mixins/AnimateMixin.js +1 -1
  14. package/mixins/AnimateSequenceItemMixin.js +1 -1
  15. package/mixins/AnimateSequenceMixin.js +3 -3
  16. package/mixins/ClassNameMixin.js +3 -3
  17. package/mixins/ClassNameToggleMixin.js +2 -2
  18. package/mixins/FlyoutMixin.d.ts +7 -1
  19. package/mixins/FlyoutMixin.js +18 -10
  20. package/mixins/FlyoutToggleMixin.d.ts +2 -1
  21. package/mixins/FlyoutToggleMixin.js +6 -6
  22. package/mixins/FocusStateMixin.js +3 -3
  23. package/mixins/LoadingStateMixin.js +4 -4
  24. package/mixins/Mixin.js +1 -1
  25. package/mixins/ScrollIntoViewMixin.js +2 -2
  26. package/mixins/ScrollableMixin.js +2 -2
  27. package/mixins/StatefulMixin.js +1 -1
  28. package/mixins/StaticAttributeMixin.js +1 -1
  29. package/mixins/UnmanagedClassNameMixin.js +1 -1
  30. package/package.json +4 -8
  31. package/view.js +6 -6
  32. package/include/brew-js/anim.js +0 -1
  33. package/include/brew-js/app.js +0 -3
  34. package/include/brew-js/defaults.js +0 -2
  35. package/include/brew-js/directive.js +0 -1
  36. package/include/brew-js/domAction.js +0 -1
  37. package/include/brew-js/extension/router.js +0 -1
  38. package/include/brew-js/util/path.js +0 -1
  39. package/include/brew-js/var.js +0 -1
  40. package/include/external/jquery.js +0 -3
  41. package/include/external/react-dom-client.js +0 -4
  42. package/include/external/waterpipe.js +0 -3
  43. package/include/zeta-dom/cssUtil.js +0 -1
  44. package/include/zeta-dom/dom.js +0 -3
  45. package/include/zeta-dom/domLock.js +0 -1
  46. package/include/zeta-dom/domUtil.js +0 -1
  47. package/include/zeta-dom/events.js +0 -1
  48. package/include/zeta-dom/observe.js +0 -1
  49. package/include/zeta-dom/util.js +0 -1
@@ -1,6 +1,6 @@
1
- import { definePrototype, each, equal, extend, fill } from "../include/zeta-dom/util.js";
2
- import { setClass } from "../include/zeta-dom/domUtil.js";
3
- import { watchOwnAttributes } from "../include/zeta-dom/observe.js";
1
+ import { definePrototype, each, equal, extend, fill } from "zeta-dom/util";
2
+ import { setClass } from "zeta-dom/domUtil";
3
+ import { watchOwnAttributes } from "zeta-dom/observe";
4
4
  import StatefulMixin from "./StatefulMixin.js";
5
5
 
6
6
  function checkState(self, element, state, fireEvent) {
@@ -1,5 +1,5 @@
1
- import { definePrototype, each, extend, isPlainObject, kv } from "../include/zeta-dom/util.js";
2
- import { setClass } from "../include/zeta-dom/domUtil.js";
1
+ import { definePrototype, each, extend, isPlainObject, kv } from "zeta-dom/util";
2
+ import { setClass } from "zeta-dom/domUtil";
3
3
  import StatefulMixin from "./StatefulMixin.js";
4
4
 
5
5
  export default function ClassNameToggleMixin() {
@@ -22,6 +22,11 @@ export interface FlyoutMixinOptions {
22
22
  * Default is `true` if source element is not an text input element.
23
23
  */
24
24
  initialFocus?: boolean | string;
25
+ /**
26
+ * Whether the flyout should be closed when flyout, or source element if given, loses focus.
27
+ * Default is `true` if flyout is not dismissible by swipe gesture.
28
+ */
29
+ closeOnBlur?: boolean;
25
30
  }
26
31
 
27
32
  /**
@@ -84,9 +89,10 @@ export default class FlyoutMixin extends ClassNameMixin {
84
89
  /**
85
90
  * Opens the flyout.
86
91
  * @param state Value to be sent to listener added by {@link FlyoutMixin.onOpen}.
92
+ * @param source Source element that triggered the flyout.
87
93
  * @returns A promise that resolves when the flyout is being closed.
88
94
  */
89
- open(state?: any): Promise<any>;
95
+ open(state?: any, source?: Element): Promise<any>;
90
96
  /**
91
97
  * Closes the flyout.
92
98
  * @param state Value to be sent to the promise returned by {@link FlyoutMixin.open}.
@@ -1,5 +1,5 @@
1
- import { definePrototype, extend, makeArray } from "../include/zeta-dom/util.js";
2
- import { closeFlyout, openFlyout } from "../include/brew-js/domAction.js";
1
+ import { definePrototype, extend, makeArray, pick } from "zeta-dom/util";
2
+ import { closeFlyout, isFlyoutOpen, openFlyout } from "brew-js/domAction";
3
3
  import { app } from "../app.js";
4
4
  import ClassNameMixin from "./ClassNameMixin.js";
5
5
  import FlyoutToggleMixin from "./FlyoutToggleMixin.js";
@@ -20,14 +20,16 @@ export default function FlyoutMixin() {
20
20
  self.onDispose(function () {
21
21
  self.isFlyoutOpened = false;
22
22
  self.visible = false;
23
+ self.toggle.dispose();
23
24
  });
24
25
  }
25
26
 
26
27
  definePrototype(FlyoutMixin, ClassNameMixin, {
27
- get flyoutOptions() {
28
- var options = {};
29
- if (this.initialFocus !== undefined) {
30
- options.focus = this.initialFocus;
28
+ getOptions: function () {
29
+ var self = this;
30
+ var options = pick(self, ['closeOnBlur']);
31
+ if (self.initialFocus !== undefined) {
32
+ options.focus = self.initialFocus;
31
33
  }
32
34
  return options;
33
35
  },
@@ -54,10 +56,12 @@ definePrototype(FlyoutMixin, ClassNameMixin, {
54
56
  'animate-out': ''
55
57
  });
56
58
  },
57
- open: function (value) {
59
+ open: function (value, source) {
58
60
  var element = this.elements()[0];
59
- valueMap.set(element, value);
60
- return openFlyout(element, null, this.flyoutOptions);
61
+ if (!isFlyoutOpen(element)) {
62
+ valueMap.set(element, value);
63
+ }
64
+ return openFlyout(element, source, this.getOptions());
61
65
  },
62
66
  close: function (value) {
63
67
  return closeFlyout(this.elements()[0], value);
@@ -90,7 +94,11 @@ definePrototype(FlyoutMixin, ClassNameMixin, {
90
94
  },
91
95
  onClassNameUpdated: function (element, prevState, state) {
92
96
  var self = this;
97
+ var isFlyoutOpened = isFlyoutOpen(element);
98
+ if (!isFlyoutOpened) {
99
+ valueMap.delete(element);
100
+ }
93
101
  self.visible = state.open;
94
- self.isFlyoutOpened = state.open && !state.closing && !state['tweening-out'];
102
+ self.isFlyoutOpened = isFlyoutOpened;
95
103
  }
96
104
  });
@@ -10,9 +10,10 @@ export default class FlyoutToggleMixin extends ClassNameMixin {
10
10
  /**
11
11
  * Opens the associated flyout.
12
12
  * @param state Value to be sent to listener added by {@link FlyoutMixin.onOpen}.
13
+ * @param source Source element that triggered the flyout.
13
14
  * @returns A promise that resolves when the flyout is being closed.
14
15
  */
15
- open(state?: any): Promise<any>;
16
+ open(state?: any, source?: Element): Promise<any>;
16
17
  /**
17
18
  * Closes the associated flyout.
18
19
  * @param state Value to be sent to the promise returned by {@link FlyoutMixin.open}.
@@ -1,6 +1,6 @@
1
- import dom from "../include/zeta-dom/dom.js";
2
- import { definePrototype } from "../include/zeta-dom/util.js";
3
- import { toggleFlyout } from "../include/brew-js/domAction.js";
1
+ import dom from "zeta-dom/dom";
2
+ import { definePrototype } from "zeta-dom/util";
3
+ import { toggleFlyout } from "brew-js/domAction";
4
4
  import ClassNameMixin from "./ClassNameMixin.js";
5
5
 
6
6
  const FlyoutToggleMixinSuper = ClassNameMixin.prototype;
@@ -11,8 +11,8 @@ export default function FlyoutToggleMixin(mixin) {
11
11
  }
12
12
 
13
13
  definePrototype(FlyoutToggleMixin, ClassNameMixin, {
14
- open: function (value) {
15
- return this.flyoutMixin.open(value);
14
+ open: function (value, source) {
15
+ return this.flyoutMixin.open(value, source);
16
16
  },
17
17
  close: function (value) {
18
18
  return this.flyoutMixin.close(value);
@@ -21,7 +21,7 @@ definePrototype(FlyoutToggleMixin, ClassNameMixin, {
21
21
  var self = this;
22
22
  FlyoutToggleMixinSuper.initElement.call(self, element, state);
23
23
  self.onDispose(dom.on(element, 'click', function () {
24
- toggleFlyout(self.flyoutMixin.elements()[0], element, self.flyoutMixin.flyoutOptions);
24
+ toggleFlyout(self.flyoutMixin.elements()[0], element, self.flyoutMixin.getOptions());
25
25
  }));
26
26
  }
27
27
  });
@@ -1,6 +1,6 @@
1
- import { definePrototype } from "../include/zeta-dom/util.js";
2
- import { setClass } from "../include/zeta-dom/domUtil.js";
3
- import dom from "../include/zeta-dom/dom.js";
1
+ import { definePrototype } from "zeta-dom/util";
2
+ import { setClass } from "zeta-dom/domUtil";
3
+ import dom from "zeta-dom/dom";
4
4
  import StatefulMixin from "./StatefulMixin.js";
5
5
 
6
6
  const FocusStateMixinSuper = StatefulMixin.prototype;
@@ -1,7 +1,7 @@
1
- import { any, definePrototype } from "../include/zeta-dom/util.js";
2
- import { getClass } from "../include/zeta-dom/domUtil.js";
3
- import { subscribeAsync } from "../include/zeta-dom/domLock.js";
4
- import { getDirectiveComponent } from "../include/brew-js/directive.js";
1
+ import { any, definePrototype } from "zeta-dom/util";
2
+ import { getClass } from "zeta-dom/domUtil";
3
+ import { subscribeAsync } from "zeta-dom/domLock";
4
+ import { getDirectiveComponent } from "brew-js/directive";
5
5
  import ClassNameMixin from "./ClassNameMixin.js";
6
6
 
7
7
  const LoadingStateMixinSuper = ClassNameMixin.prototype;
package/mixins/Mixin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { classNames } from "zeta-dom-react";
2
- import { combineFn, define, definePrototype, each, extend, makeArray, noop, watchable } from "../include/zeta-dom/util.js";
2
+ import { combineFn, define, definePrototype, each, extend, makeArray, noop, watchable } from "zeta-dom/util";
3
3
  import StaticAttributeMixin from "./StaticAttributeMixin.js";
4
4
 
5
5
  export default function Mixin() {
@@ -1,5 +1,5 @@
1
- import { definePrototype, equal, extend, setImmediateOnce } from "../include/zeta-dom/util.js";
2
- import { scrollIntoView } from "../include/zeta-dom/domUtil.js";
1
+ import { definePrototype, equal, extend, setImmediateOnce } from "zeta-dom/util";
2
+ import { scrollIntoView } from "zeta-dom/domUtil";
3
3
  import StatefulMixin from "./StatefulMixin.js";
4
4
 
5
5
  export default function ScrollIntoViewMixin() {
@@ -1,5 +1,5 @@
1
- import { defineHiddenProperty, definePrototype, each, extend } from "../include/zeta-dom/util.js";
2
- import { getDirectiveComponent } from "../include/brew-js/directive.js";
1
+ import { defineHiddenProperty, definePrototype, each, extend } from "zeta-dom/util";
2
+ import { getDirectiveComponent } from "brew-js/directive";
3
3
  import { app } from "../app.js";
4
4
  import Mixin from "./Mixin.js";
5
5
  import ClassNameMixin from "./ClassNameMixin.js";
@@ -1,4 +1,4 @@
1
- import { combineFn, createPrivateStore, definePrototype, extend, keys, map, pipe, watch } from "../include/zeta-dom/util.js";
1
+ import { combineFn, createPrivateStore, definePrototype, extend, keys, map, pipe, watch } from "zeta-dom/util";
2
2
  import Mixin from "./Mixin.js";
3
3
 
4
4
  const _ = createPrivateStore();
@@ -1,4 +1,4 @@
1
- import { definePrototype, extend, isPlainObject, kv } from "../include/zeta-dom/util.js";
1
+ import { definePrototype, extend, isPlainObject, kv } from "zeta-dom/util";
2
2
  import Mixin from "./Mixin.js";
3
3
 
4
4
  export default function StaticAttributeMixin(name, value) {
@@ -1,4 +1,4 @@
1
- import { definePrototype, makeArray } from "../include/zeta-dom/util.js";
1
+ import { definePrototype, makeArray } from "zeta-dom/util";
2
2
  import ClassNameMixin from "./ClassNameMixin.js";
3
3
 
4
4
  export default function UnmanagedClassNameMixin() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brew-js-react",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -27,21 +27,17 @@
27
27
  "@babel/preset-env": "^7.16.11",
28
28
  "@babel/preset-react": "^7.16.7",
29
29
  "@jest/globals": "^26.6.2",
30
+ "@misonou/build-utils": "^1.1.2",
30
31
  "@misonou/test-utils": "^1.0.3",
31
32
  "@testing-library/dom": "^8.11.3",
32
33
  "@testing-library/react": "^12.1.2",
33
34
  "@testing-library/react-hooks": "^7.0.2",
34
35
  "@types/jest": "^26.0.15",
35
- "babel-loader": "^8.2.1",
36
- "clean-webpack-plugin": "^4.0.0",
36
+ "babel-loader": "^9.1.3",
37
37
  "cross-env": "^7.0.2",
38
- "glob": "^7.2.0",
39
38
  "jest": "^27.0.6",
40
39
  "jest-environment-jsdom": "^27.4.6",
41
- "ncp": "^2.0.0",
42
- "regenerator-runtime": "^0.13.9",
43
- "webpack": "^5.3.0",
44
- "webpack-cli": "^4.1.0"
40
+ "regenerator-runtime": "^0.13.9"
45
41
  },
46
42
  "sideEffects": [
47
43
  "./src/app.js"
package/view.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import React from "react";
2
2
  import { useAsync } from "zeta-dom-react";
3
- import dom from "./include/zeta-dom/dom.js";
4
- import { notifyAsync } from "./include/zeta-dom/domLock.js";
5
- import { ZetaEventContainer } from "./include/zeta-dom/events.js";
6
- import { any, arrRemove, catchAsync, combineFn, createPrivateStore, defineObservableProperty, defineOwnProperty, definePrototype, each, exclude, executeOnce, extend, freeze, grep, isFunction, isThenable, isUndefinedOrNull, keys, makeArray, map, noop, pick, randomId, resolveAll, setImmediate, single, throwNotFunction, watch } from "./include/zeta-dom/util.js";
7
- import { animateIn, animateOut } from "./include/brew-js/anim.js";
8
- import { removeQueryAndHash } from "./include/brew-js/util/path.js";
3
+ import dom from "zeta-dom/dom";
4
+ import { notifyAsync } from "zeta-dom/domLock";
5
+ import { ZetaEventContainer } from "zeta-dom/events";
6
+ import { any, arrRemove, catchAsync, combineFn, createPrivateStore, defineObservableProperty, defineOwnProperty, definePrototype, each, exclude, executeOnce, extend, freeze, grep, isFunction, isThenable, isUndefinedOrNull, keys, makeArray, map, noop, pick, randomId, resolveAll, setImmediate, single, throwNotFunction, watch } from "zeta-dom/util";
7
+ import { animateIn, animateOut } from "brew-js/anim";
8
+ import { removeQueryAndHash } from "brew-js/util/path";
9
9
  import { app, onAppInit } from "./app.js";
10
10
  import { ViewStateContainer } from "./hooks.js";
11
11
 
@@ -1 +0,0 @@
1
- export * from "brew-js/anim";
@@ -1,3 +0,0 @@
1
- import brew from "brew-js/app";
2
- export * from "brew-js/app";
3
- export default brew;
@@ -1,2 +0,0 @@
1
- import defaults from "brew-js/defaults";
2
- export default defaults;
@@ -1 +0,0 @@
1
- export * from "brew-js/directive";
@@ -1 +0,0 @@
1
- export * from "brew-js/domAction";
@@ -1 +0,0 @@
1
- export * from "brew-js/extension/router";
@@ -1 +0,0 @@
1
- export * from "brew-js/util/path";
@@ -1 +0,0 @@
1
- export * from "brew-js/var";
@@ -1,3 +0,0 @@
1
- // @ts-nocheck
2
- import jQuery from "jquery";
3
- export default jQuery;
@@ -1,4 +0,0 @@
1
- // @ts-nocheck
2
- import ReactDOMClient from "@misonou/react-dom-client";
3
- /** @type {import("react-dom/client")} */
4
- export default ReactDOMClient;
@@ -1,3 +0,0 @@
1
- // @ts-nocheck
2
- import waterpipe from "waterpipe";
3
- export default waterpipe;
@@ -1 +0,0 @@
1
- export * from "zeta-dom/cssUtil";
@@ -1,3 +0,0 @@
1
- import dom from "zeta-dom/dom";
2
- export * from "zeta-dom/dom";
3
- export default dom;
@@ -1 +0,0 @@
1
- export * from "zeta-dom/domLock";
@@ -1 +0,0 @@
1
- export * from "zeta-dom/domUtil";
@@ -1 +0,0 @@
1
- export { ZetaEventContainer } from "zeta-dom/events";
@@ -1 +0,0 @@
1
- export * from "zeta-dom/observe";
@@ -1 +0,0 @@
1
- export * from "zeta-dom/util";