@studiometa/js-toolkit 2.4.3 → 2.4.4-alpha.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.
Files changed (49) hide show
  1. package/decorators/index.cjs +1 -1
  2. package/decorators/withBreakpointManager.cjs +2 -3
  3. package/decorators/withBreakpointManager.js +1 -2
  4. package/decorators/withBreakpointObserver.cjs +2 -2
  5. package/decorators/withBreakpointObserver.js +1 -1
  6. package/decorators/withDrag.cjs +1 -1
  7. package/decorators/withExtraConfig.cjs +1 -1
  8. package/decorators/withFreezedOptions.cjs +9 -7
  9. package/decorators/withFreezedOptions.js +8 -6
  10. package/decorators/withIntersectionObserver.cjs +2 -1
  11. package/decorators/withIntersectionObserver.js +1 -0
  12. package/decorators/withMountWhenInView.cjs +1 -1
  13. package/decorators/withResponsiveOptions.cjs +2 -2
  14. package/decorators/withResponsiveOptions.js +1 -1
  15. package/decorators/withScrolledInView.cjs +13 -7
  16. package/decorators/withScrolledInView.js +12 -6
  17. package/decorators/withVue2.cjs +4 -4
  18. package/decorators/withVue2.js +3 -3
  19. package/index.cjs +1 -1
  20. package/package.json +1 -1
  21. package/Base/index.d.ts +0 -349
  22. package/Base/managers/AbstractManager.d.ts +0 -44
  23. package/Base/managers/ChildrenManager.d.ts +0 -41
  24. package/Base/managers/EventsManager.d.ts +0 -112
  25. package/Base/managers/OptionsManager.d.ts +0 -87
  26. package/Base/managers/RefsManager.d.ts +0 -32
  27. package/Base/managers/ResponsiveOptionsManager.d.ts +0 -26
  28. package/Base/managers/ServicesManager.d.ts +0 -109
  29. package/Base/utils.d.ts +0 -40
  30. package/decorators/index.d.ts +0 -10
  31. package/decorators/withBreakpointManager.d.ts +0 -10
  32. package/decorators/withBreakpointObserver.d.ts +0 -17
  33. package/decorators/withDrag.d.ts +0 -30
  34. package/decorators/withExtraConfig.d.ts +0 -18
  35. package/decorators/withFreezedOptions.d.ts +0 -14
  36. package/decorators/withIntersectionObserver.d.ts +0 -23
  37. package/decorators/withMountWhenInView.d.ts +0 -33
  38. package/decorators/withResponsiveOptions.d.ts +0 -8
  39. package/decorators/withScrolledInView.d.ts +0 -40
  40. package/decorators/withVue2.d.ts +0 -7
  41. package/helpers/createApp.d.ts +0 -14
  42. package/helpers/getDirectChildren.d.ts +0 -31
  43. package/helpers/getInstanceFromElement.d.ts +0 -14
  44. package/helpers/importOnInteraction.d.ts +0 -23
  45. package/helpers/importWhenIdle.d.ts +0 -21
  46. package/helpers/importWhenVisible.d.ts +0 -23
  47. package/helpers/index.d.ts +0 -6
  48. package/helpers/utils.d.ts +0 -10
  49. package/index.d.ts +0 -5
@@ -22,7 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  ));
23
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
24
 
25
- // packages/js-toolkit/decorators/index.js
25
+ // packages/js-toolkit/decorators/index.ts
26
26
  var decorators_exports = {};
27
27
  __export(decorators_exports, {
28
28
  withBreakpointManager: () => import_withBreakpointManager.default,
@@ -22,7 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  ));
23
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
24
 
25
- // packages/js-toolkit/decorators/withBreakpointManager.js
25
+ // packages/js-toolkit/decorators/withBreakpointManager.ts
26
26
  var withBreakpointManager_exports = {};
27
27
  __export(withBreakpointManager_exports, {
28
28
  default: () => withBreakpointManager
@@ -68,7 +68,7 @@ function withBreakpointManager(BaseClass, breakpoints) {
68
68
  }
69
69
  return BaseClass;
70
70
  }
71
- return class extends BaseClass {
71
+ return class WithBreakpointManager extends BaseClass {
72
72
  constructor(element) {
73
73
  super(element);
74
74
  if (!instances.has(this)) {
@@ -77,7 +77,6 @@ function withBreakpointManager(BaseClass, breakpoints) {
77
77
  add(`BreakpointManager-${this.$id}`, () => {
78
78
  testBreakpoints(instances.get(this));
79
79
  });
80
- this.instances = instances.get(this);
81
80
  }
82
81
  $mount() {
83
82
  super.$mount();
@@ -38,7 +38,7 @@ function withBreakpointManager(BaseClass, breakpoints) {
38
38
  }
39
39
  return BaseClass;
40
40
  }
41
- return class extends BaseClass {
41
+ return class WithBreakpointManager extends BaseClass {
42
42
  constructor(element) {
43
43
  super(element);
44
44
  if (!instances.has(this)) {
@@ -47,7 +47,6 @@ function withBreakpointManager(BaseClass, breakpoints) {
47
47
  add(`BreakpointManager-${this.$id}`, () => {
48
48
  testBreakpoints(instances.get(this));
49
49
  });
50
- this.instances = instances.get(this);
51
50
  }
52
51
  $mount() {
53
52
  super.$mount();
@@ -27,7 +27,7 @@ var __publicField = (obj, key, value) => {
27
27
  return value;
28
28
  };
29
29
 
30
- // packages/js-toolkit/decorators/withBreakpointObserver.js
30
+ // packages/js-toolkit/decorators/withBreakpointObserver.ts
31
31
  var withBreakpointObserver_exports = {};
32
32
  __export(withBreakpointObserver_exports, {
33
33
  default: () => withBreakpointObserver
@@ -62,7 +62,7 @@ function addToResize(key, instance) {
62
62
  }
63
63
  const { add, has } = (0, import_resize.default)();
64
64
  if (!has(key)) {
65
- add(key, function onResize({ breakpoint }) {
65
+ add(key, ({ breakpoint }) => {
66
66
  const action = testBreakpoints(instance, breakpoint);
67
67
  if (action === "$destroy" && instance.$isMounted) {
68
68
  instance[action]();
@@ -33,7 +33,7 @@ function addToResize(key, instance) {
33
33
  }
34
34
  const { add, has } = useResize();
35
35
  if (!has(key)) {
36
- add(key, function onResize({ breakpoint }) {
36
+ add(key, ({ breakpoint }) => {
37
37
  const action = testBreakpoints(instance, breakpoint);
38
38
  if (action === "$destroy" && instance.$isMounted) {
39
39
  instance[action]();
@@ -27,7 +27,7 @@ var __publicField = (obj, key, value) => {
27
27
  return value;
28
28
  };
29
29
 
30
- // packages/js-toolkit/decorators/withDrag.js
30
+ // packages/js-toolkit/decorators/withDrag.ts
31
31
  var withDrag_exports = {};
32
32
  __export(withDrag_exports, {
33
33
  default: () => withDrag
@@ -27,7 +27,7 @@ var __publicField = (obj, key, value) => {
27
27
  return value;
28
28
  };
29
29
 
30
- // packages/js-toolkit/decorators/withExtraConfig.js
30
+ // packages/js-toolkit/decorators/withExtraConfig.ts
31
31
  var withExtraConfig_exports = {};
32
32
  __export(withExtraConfig_exports, {
33
33
  default: () => withExtraConfig
@@ -21,24 +21,26 @@ var __publicField = (obj, key, value) => {
21
21
  return value;
22
22
  };
23
23
 
24
- // packages/js-toolkit/decorators/withFreezedOptions.js
24
+ // packages/js-toolkit/decorators/withFreezedOptions.ts
25
25
  var withFreezedOptions_exports = {};
26
26
  __export(withFreezedOptions_exports, {
27
27
  default: () => withFreezedOptions
28
28
  });
29
29
  module.exports = __toCommonJS(withFreezedOptions_exports);
30
30
  function withFreezedOptions(BaseClass) {
31
- return class extends BaseClass {
31
+ return class WithFreezedOptions extends BaseClass {
32
32
  constructor() {
33
33
  super(...arguments);
34
34
  __publicField(this, "__freezedOptions");
35
35
  }
36
36
  get $options() {
37
- Object.defineProperty(this, "__freezedOptions", {
38
- value: Object.freeze({ ...super.$options }),
39
- enumerable: false,
40
- configurable: true
41
- });
37
+ if (!this.__freezedOptions) {
38
+ Object.defineProperty(this, "__freezedOptions", {
39
+ value: Object.freeze({ ...super.$options }),
40
+ enumerable: false,
41
+ configurable: true
42
+ });
43
+ }
42
44
  return this.__freezedOptions;
43
45
  }
44
46
  };
@@ -5,17 +5,19 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  function withFreezedOptions(BaseClass) {
8
- return class extends BaseClass {
8
+ return class WithFreezedOptions extends BaseClass {
9
9
  constructor() {
10
10
  super(...arguments);
11
11
  __publicField(this, "__freezedOptions");
12
12
  }
13
13
  get $options() {
14
- Object.defineProperty(this, "__freezedOptions", {
15
- value: Object.freeze({ ...super.$options }),
16
- enumerable: false,
17
- configurable: true
18
- });
14
+ if (!this.__freezedOptions) {
15
+ Object.defineProperty(this, "__freezedOptions", {
16
+ value: Object.freeze({ ...super.$options }),
17
+ enumerable: false,
18
+ configurable: true
19
+ });
20
+ }
19
21
  return this.__freezedOptions;
20
22
  }
21
23
  };
@@ -21,7 +21,7 @@ var __publicField = (obj, key, value) => {
21
21
  return value;
22
22
  };
23
23
 
24
- // packages/js-toolkit/decorators/withIntersectionObserver.js
24
+ // packages/js-toolkit/decorators/withIntersectionObserver.ts
25
25
  var withIntersectionObserver_exports = {};
26
26
  __export(withIntersectionObserver_exports, {
27
27
  default: () => withIntersectionObserver
@@ -35,6 +35,7 @@ function withIntersectionObserver(BaseClass, defaultOptions = { threshold: creat
35
35
  return _b = class extends BaseClass {
36
36
  constructor(element) {
37
37
  super(element);
38
+ __publicField(this, "$observer");
38
39
  this.$observer = new IntersectionObserver(
39
40
  (entries) => {
40
41
  this.__callMethod("intersected", entries);
@@ -12,6 +12,7 @@ function withIntersectionObserver(BaseClass, defaultOptions = { threshold: creat
12
12
  return _b = class extends BaseClass {
13
13
  constructor(element) {
14
14
  super(element);
15
+ __publicField(this, "$observer");
15
16
  this.$observer = new IntersectionObserver(
16
17
  (entries) => {
17
18
  this.__callMethod("intersected", entries);
@@ -21,7 +21,7 @@ var __publicField = (obj, key, value) => {
21
21
  return value;
22
22
  };
23
23
 
24
- // packages/js-toolkit/decorators/withMountWhenInView.js
24
+ // packages/js-toolkit/decorators/withMountWhenInView.ts
25
25
  var withMountWhenInView_exports = {};
26
26
  __export(withMountWhenInView_exports, {
27
27
  default: () => withMountWhenInView
@@ -22,7 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  ));
23
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
24
 
25
- // packages/js-toolkit/decorators/withResponsiveOptions.js
25
+ // packages/js-toolkit/decorators/withResponsiveOptions.ts
26
26
  var withResponsiveOptions_exports = {};
27
27
  __export(withResponsiveOptions_exports, {
28
28
  default: () => withResponsiveOptions
@@ -30,7 +30,7 @@ __export(withResponsiveOptions_exports, {
30
30
  module.exports = __toCommonJS(withResponsiveOptions_exports);
31
31
  var import_ResponsiveOptionsManager = __toESM(require("../Base/managers/ResponsiveOptionsManager.cjs"), 1);
32
32
  function withResponsiveOptions(BaseClass) {
33
- return class extends BaseClass {
33
+ return class WithResponsiveOptions extends BaseClass {
34
34
  get __managers() {
35
35
  return {
36
36
  ...super.__managers,
@@ -1,6 +1,6 @@
1
1
  import ResponsiveOptionsManager from "../Base/managers/ResponsiveOptionsManager.js";
2
2
  function withResponsiveOptions(BaseClass) {
3
- return class extends BaseClass {
3
+ return class WithResponsiveOptions extends BaseClass {
4
4
  get __managers() {
5
5
  return {
6
6
  ...super.__managers,
@@ -27,7 +27,7 @@ var __publicField = (obj, key, value) => {
27
27
  return value;
28
28
  };
29
29
 
30
- // packages/js-toolkit/decorators/withScrolledInView.js
30
+ // packages/js-toolkit/decorators/withScrolledInView.ts
31
31
  var withScrolledInView_exports = {};
32
32
  __export(withScrolledInView_exports, {
33
33
  default: () => withScrolledInView
@@ -57,7 +57,8 @@ function updateProps(props, dampFactor, dampPrecision, axis = "x") {
57
57
  }
58
58
  function withScrolledInView(BaseClass, options = {}) {
59
59
  var _a;
60
- return _a = class extends (0, import_withMountWhenInView.default)(BaseClass, options) {
60
+ const WithMountWhenInView = (0, import_withMountWhenInView.default)(BaseClass, options);
61
+ return _a = class extends WithMountWhenInView {
61
62
  constructor(element) {
62
63
  super(element);
63
64
  __publicField(this, "__props", {
@@ -139,24 +140,29 @@ function withScrolledInView(BaseClass, options = {}) {
139
140
  });
140
141
  }
141
142
  mounted() {
142
- if ((0, import_utils.isFunction)(super.mounted))
143
+ if ((0, import_utils.isFunction)(super.mounted)) {
143
144
  super.mounted();
145
+ }
144
146
  }
145
147
  resized(props) {
146
- if ((0, import_utils.isFunction)(super.resized))
148
+ if ((0, import_utils.isFunction)(super.resized)) {
147
149
  super.resized(props);
150
+ }
148
151
  }
149
152
  scrolled(props) {
150
- if ((0, import_utils.isFunction)(super.scrolled))
153
+ if ((0, import_utils.isFunction)(super.scrolled)) {
151
154
  super.scrolled(props);
155
+ }
152
156
  }
153
157
  ticked(props) {
154
- if ((0, import_utils.isFunction)(super.ticked))
158
+ if ((0, import_utils.isFunction)(super.ticked)) {
155
159
  super.ticked(props);
160
+ }
156
161
  }
157
162
  destroyed() {
158
- if ((0, import_utils.isFunction)(super.destroyed))
163
+ if ((0, import_utils.isFunction)(super.destroyed)) {
159
164
  super.destroyed();
165
+ }
160
166
  }
161
167
  __setProps() {
162
168
  const sizes = options.useOffsetSizes ? (0, import_utils.getOffsetSizes)(this.$el) : this.$el.getBoundingClientRect();
@@ -28,7 +28,8 @@ function updateProps(props, dampFactor, dampPrecision, axis = "x") {
28
28
  }
29
29
  function withScrolledInView(BaseClass, options = {}) {
30
30
  var _a;
31
- return _a = class extends withMountWhenInView(BaseClass, options) {
31
+ const WithMountWhenInView = withMountWhenInView(BaseClass, options);
32
+ return _a = class extends WithMountWhenInView {
32
33
  constructor(element) {
33
34
  super(element);
34
35
  __publicField(this, "__props", {
@@ -110,24 +111,29 @@ function withScrolledInView(BaseClass, options = {}) {
110
111
  });
111
112
  }
112
113
  mounted() {
113
- if (isFunction(super.mounted))
114
+ if (isFunction(super.mounted)) {
114
115
  super.mounted();
116
+ }
115
117
  }
116
118
  resized(props) {
117
- if (isFunction(super.resized))
119
+ if (isFunction(super.resized)) {
118
120
  super.resized(props);
121
+ }
119
122
  }
120
123
  scrolled(props) {
121
- if (isFunction(super.scrolled))
124
+ if (isFunction(super.scrolled)) {
122
125
  super.scrolled(props);
126
+ }
123
127
  }
124
128
  ticked(props) {
125
- if (isFunction(super.ticked))
129
+ if (isFunction(super.ticked)) {
126
130
  super.ticked(props);
131
+ }
127
132
  }
128
133
  destroyed() {
129
- if (isFunction(super.destroyed))
134
+ if (isFunction(super.destroyed)) {
130
135
  super.destroyed();
136
+ }
131
137
  }
132
138
  __setProps() {
133
139
  const sizes = options.useOffsetSizes ? getOffsetSizes(this.$el) : this.$el.getBoundingClientRect();
@@ -21,14 +21,14 @@ var __publicField = (obj, key, value) => {
21
21
  return value;
22
22
  };
23
23
 
24
- // packages/js-toolkit/decorators/withVue2.js
24
+ // packages/js-toolkit/decorators/withVue2.ts
25
25
  var withVue2_exports = {};
26
26
  __export(withVue2_exports, {
27
- default: () => withVue2_default
27
+ default: () => withVue2
28
28
  });
29
29
  module.exports = __toCommonJS(withVue2_exports);
30
30
  var import_utils = require("../utils/index.cjs");
31
- var withVue2_default = (BaseClass, Vue) => {
31
+ function withVue2(BaseClass, Vue) {
32
32
  var _a, _b, _c;
33
33
  return _c = class extends BaseClass {
34
34
  constructor(element) {
@@ -64,5 +64,5 @@ var withVue2_default = (BaseClass, Vue) => {
64
64
  name: `${BaseClass.config.name}WithVue`,
65
65
  refs: [...(_b = (_a = BaseClass.config) == null ? void 0 : _a.refs) != null ? _b : [], "vue"]
66
66
  }), __publicField(_c, "vueConfig"), _c;
67
- };
67
+ }
68
68
  if (module.exports.default) module.exports = module.exports.default;
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  import { isDev, isFunction } from "../utils/index.js";
8
- var withVue2_default = (BaseClass, Vue) => {
8
+ function withVue2(BaseClass, Vue) {
9
9
  var _a, _b, _c;
10
10
  return _c = class extends BaseClass {
11
11
  constructor(element) {
@@ -41,7 +41,7 @@ var withVue2_default = (BaseClass, Vue) => {
41
41
  name: `${BaseClass.config.name}WithVue`,
42
42
  refs: [...(_b = (_a = BaseClass.config) == null ? void 0 : _a.refs) != null ? _b : [], "vue"]
43
43
  }), __publicField(_c, "vueConfig"), _c;
44
- };
44
+ }
45
45
  export {
46
- withVue2_default as default
46
+ withVue2 as default
47
47
  };
package/index.cjs CHANGED
@@ -23,7 +23,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  ));
24
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
25
 
26
- // packages/js-toolkit/index.js
26
+ // packages/js-toolkit/index.ts
27
27
  var js_toolkit_exports = {};
28
28
  __export(js_toolkit_exports, {
29
29
  Base: () => import_Base.default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studiometa/js-toolkit",
3
- "version": "2.4.3",
3
+ "version": "2.4.4-alpha.0",
4
4
  "description": "A set of useful little bits of JavaScript to boost your project! 🚀",
5
5
  "publishConfig": {
6
6
  "access": "public"