@studiometa/js-toolkit 2.4.4-alpha.4 → 2.4.4-alpha.7

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 (40) hide show
  1. package/Base/types.d.ts +5 -1
  2. package/decorators/index.cjs +11 -34
  3. package/decorators/index.d.ts +10 -11
  4. package/decorators/index.js +10 -24
  5. package/decorators/withBreakpointManager.cjs +6 -12
  6. package/decorators/withBreakpointManager.d.ts +3 -2
  7. package/decorators/withBreakpointManager.js +4 -4
  8. package/decorators/withBreakpointObserver.cjs +5 -11
  9. package/decorators/withBreakpointObserver.d.ts +7 -112
  10. package/decorators/withBreakpointObserver.js +2 -2
  11. package/decorators/withDrag.cjs +5 -11
  12. package/decorators/withDrag.d.ts +8 -93
  13. package/decorators/withDrag.js +4 -4
  14. package/decorators/withExtraConfig.cjs +1 -1
  15. package/decorators/withExtraConfig.d.ts +3 -96
  16. package/decorators/withExtraConfig.js +1 -1
  17. package/decorators/withFreezedOptions.cjs +1 -1
  18. package/decorators/withFreezedOptions.d.ts +6 -105
  19. package/decorators/withFreezedOptions.js +1 -1
  20. package/decorators/withIntersectionObserver.cjs +1 -1
  21. package/decorators/withIntersectionObserver.d.ts +4 -110
  22. package/decorators/withIntersectionObserver.js +1 -1
  23. package/decorators/withMountWhenInView.cjs +1 -1
  24. package/decorators/withMountWhenInView.d.ts +16 -116
  25. package/decorators/withMountWhenInView.js +1 -1
  26. package/decorators/withResponsiveOptions.cjs +1 -1
  27. package/decorators/withResponsiveOptions.d.ts +3 -98
  28. package/decorators/withResponsiveOptions.js +1 -1
  29. package/decorators/withScrolledInView.cjs +21 -15
  30. package/decorators/withScrolledInView.d.ts +29 -307
  31. package/decorators/withScrolledInView.js +21 -9
  32. package/decorators/withVue2.cjs +1 -1
  33. package/decorators/withVue2.d.ts +8 -106
  34. package/decorators/withVue2.js +1 -1
  35. package/helpers/importOnInteraction.d.ts +1 -1
  36. package/index.d.ts +1 -1
  37. package/package.json +1 -1
  38. package/decorators/withType.cjs +0 -28
  39. package/decorators/withType.d.ts +0 -5
  40. package/decorators/withType.js +0 -6
package/Base/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { KeyServiceProps, LoadServiceProps, PointerServiceProps, RafServiceProps, ResizeServiceProps, ScrollServiceProps } from '../services/index.js';
1
+ import type { Base, BaseTypeParameter } from './index.js';
2
+ import type { KeyServiceProps, LoadServiceProps, PointerServiceProps, RafServiceProps, ResizeServiceProps, ScrollServiceProps } from '../services/index.js';
2
3
  export interface BaseInterface {
3
4
  /**
4
5
  * Mounted hook.
@@ -41,3 +42,6 @@ export interface BaseInterface {
41
42
  */
42
43
  scrolled?(props: ScrollServiceProps): void;
43
44
  }
45
+ export declare type BaseDecorator<S extends BaseInterface, T extends Base> = {
46
+ new <W extends BaseTypeParameter = BaseTypeParameter>(...args: unknown[]): S & T & Base<W>;
47
+ } & Partial<Pick<T, keyof T>>;
@@ -1,13 +1,7 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
5
  var __copyProps = (to, from, except, desc) => {
12
6
  if (from && typeof from === "object" || typeof from === "function") {
13
7
  for (let key of __getOwnPropNames(from))
@@ -16,37 +10,20 @@ var __copyProps = (to, from, except, desc) => {
16
10
  }
17
11
  return to;
18
12
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
- mod
22
- ));
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
23
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
15
 
25
16
  // packages/js-toolkit/decorators/index.ts
26
17
  var decorators_exports = {};
27
- __export(decorators_exports, {
28
- withBreakpointManager: () => import_withBreakpointManager.default,
29
- withBreakpointObserver: () => import_withBreakpointObserver.default,
30
- withDrag: () => import_withDrag.default,
31
- withExtraConfig: () => import_withExtraConfig.default,
32
- withFreezedOptions: () => import_withFreezedOptions.default,
33
- withIntersectionObserver: () => import_withIntersectionObserver.default,
34
- withMountWhenInView: () => import_withMountWhenInView.default,
35
- withResponsiveOptions: () => import_withResponsiveOptions.default,
36
- withScrolledInView: () => import_withScrolledInView.default,
37
- withType: () => import_withType.default,
38
- withVue2: () => import_withVue2.default
39
- });
40
18
  module.exports = __toCommonJS(decorators_exports);
41
- var import_withBreakpointManager = __toESM(require("./withBreakpointManager.cjs"), 1);
42
- var import_withBreakpointObserver = __toESM(require("./withBreakpointObserver.cjs"), 1);
43
- var import_withDrag = __toESM(require("./withDrag.cjs"), 1);
44
- var import_withExtraConfig = __toESM(require("./withExtraConfig.cjs"), 1);
45
- var import_withFreezedOptions = __toESM(require("./withFreezedOptions.cjs"), 1);
46
- var import_withIntersectionObserver = __toESM(require("./withIntersectionObserver.cjs"), 1);
47
- var import_withMountWhenInView = __toESM(require("./withMountWhenInView.cjs"), 1);
48
- var import_withResponsiveOptions = __toESM(require("./withResponsiveOptions.cjs"), 1);
49
- var import_withScrolledInView = __toESM(require("./withScrolledInView.cjs"), 1);
50
- var import_withType = __toESM(require("./withType.cjs"), 1);
51
- var import_withVue2 = __toESM(require("./withVue2.cjs"), 1);
19
+ __reExport(decorators_exports, require("./withBreakpointManager.cjs"), module.exports);
20
+ __reExport(decorators_exports, require("./withBreakpointObserver.cjs"), module.exports);
21
+ __reExport(decorators_exports, require("./withDrag.cjs"), module.exports);
22
+ __reExport(decorators_exports, require("./withExtraConfig.cjs"), module.exports);
23
+ __reExport(decorators_exports, require("./withFreezedOptions.cjs"), module.exports);
24
+ __reExport(decorators_exports, require("./withIntersectionObserver.cjs"), module.exports);
25
+ __reExport(decorators_exports, require("./withMountWhenInView.cjs"), module.exports);
26
+ __reExport(decorators_exports, require("./withResponsiveOptions.cjs"), module.exports);
27
+ __reExport(decorators_exports, require("./withScrolledInView.cjs"), module.exports);
28
+ __reExport(decorators_exports, require("./withVue2.cjs"), module.exports);
52
29
  if (module.exports.default) module.exports = module.exports.default;
@@ -1,11 +1,10 @@
1
- export { default as withBreakpointManager } from './withBreakpointManager.js';
2
- export { default as withBreakpointObserver } from './withBreakpointObserver.js';
3
- export { default as withDrag } from './withDrag.js';
4
- export { default as withExtraConfig } from './withExtraConfig.js';
5
- export { default as withFreezedOptions } from './withFreezedOptions.js';
6
- export { default as withIntersectionObserver } from './withIntersectionObserver.js';
7
- export { default as withMountWhenInView } from './withMountWhenInView.js';
8
- export { default as withResponsiveOptions } from './withResponsiveOptions.js';
9
- export { default as withScrolledInView } from './withScrolledInView.js';
10
- export { default as withType } from './withType.js';
11
- export { default as withVue2 } from './withVue2.js';
1
+ export * from './withBreakpointManager.js';
2
+ export * from './withBreakpointObserver.js';
3
+ export * from './withDrag.js';
4
+ export * from './withExtraConfig.js';
5
+ export * from './withFreezedOptions.js';
6
+ export * from './withIntersectionObserver.js';
7
+ export * from './withMountWhenInView.js';
8
+ export * from './withResponsiveOptions.js';
9
+ export * from './withScrolledInView.js';
10
+ export * from './withVue2.js';
@@ -1,24 +1,10 @@
1
- import { default as default2 } from "./withBreakpointManager.js";
2
- import { default as default3 } from "./withBreakpointObserver.js";
3
- import { default as default4 } from "./withDrag.js";
4
- import { default as default5 } from "./withExtraConfig.js";
5
- import { default as default6 } from "./withFreezedOptions.js";
6
- import { default as default7 } from "./withIntersectionObserver.js";
7
- import { default as default8 } from "./withMountWhenInView.js";
8
- import { default as default9 } from "./withResponsiveOptions.js";
9
- import { default as default10 } from "./withScrolledInView.js";
10
- import { default as default11 } from "./withType.js";
11
- import { default as default12 } from "./withVue2.js";
12
- export {
13
- default2 as withBreakpointManager,
14
- default3 as withBreakpointObserver,
15
- default4 as withDrag,
16
- default5 as withExtraConfig,
17
- default6 as withFreezedOptions,
18
- default7 as withIntersectionObserver,
19
- default8 as withMountWhenInView,
20
- default9 as withResponsiveOptions,
21
- default10 as withScrolledInView,
22
- default11 as withType,
23
- default12 as withVue2
24
- };
1
+ export * from "./withBreakpointManager.js";
2
+ export * from "./withBreakpointObserver.js";
3
+ export * from "./withDrag.js";
4
+ export * from "./withExtraConfig.js";
5
+ export * from "./withFreezedOptions.js";
6
+ export * from "./withIntersectionObserver.js";
7
+ export * from "./withMountWhenInView.js";
8
+ export * from "./withResponsiveOptions.js";
9
+ export * from "./withScrolledInView.js";
10
+ export * from "./withVue2.js";
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __export = (target, all) => {
8
6
  for (var name in all)
@@ -16,22 +14,18 @@ var __copyProps = (to, from, except, desc) => {
16
14
  }
17
15
  return to;
18
16
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
- mod
22
- ));
23
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
18
 
25
19
  // packages/js-toolkit/decorators/withBreakpointManager.ts
26
20
  var withBreakpointManager_exports = {};
27
21
  __export(withBreakpointManager_exports, {
28
- default: () => withBreakpointManager
22
+ withBreakpointManager: () => withBreakpointManager
29
23
  });
30
24
  module.exports = __toCommonJS(withBreakpointManager_exports);
31
- var import_resize = __toESM(require("../services/resize.cjs"), 1);
25
+ var import_services = require("../services/index.cjs");
32
26
  var import_utils = require("../utils/index.cjs");
33
27
  function testBreakpoints(breakpoints) {
34
- const { breakpoint } = (0, import_resize.default)().props();
28
+ const { breakpoint } = (0, import_services.useResize)().props();
35
29
  breakpoints.forEach(([breakpointKeys, instance]) => {
36
30
  if (breakpointKeys.includes(breakpoint) && !instance.$isMounted) {
37
31
  setTimeout(() => instance.$mount(), 0);
@@ -44,7 +38,7 @@ function mountComponents(instance, breakpoints) {
44
38
  return breakpoints.map(([bk, ComponentClass]) => {
45
39
  const child = new ComponentClass(instance.$el);
46
40
  Object.defineProperty(child, "$parent", { get: () => instance.$parent });
47
- return [bk, child];
41
+ return [bk.split(" "), child];
48
42
  });
49
43
  }
50
44
  var instances = /* @__PURE__ */ new WeakMap();
@@ -61,10 +55,10 @@ function withBreakpointManager(BaseClass, breakpoints) {
61
55
  }
62
56
  return BaseClass;
63
57
  }
64
- const { add, props } = (0, import_resize.default)();
58
+ const { add, props } = (0, import_services.useResize)();
65
59
  if (!props().breakpoint) {
66
60
  if (import_utils.isDev) {
67
- throw new Error(`The \`BreakpointManager\` class requires breakpoints to be defined.`);
61
+ throw new Error("The `BreakpointManager` class requires breakpoints to be defined.");
68
62
  }
69
63
  return BaseClass;
70
64
  }
@@ -1,5 +1,6 @@
1
- import type { Base, BaseConstructor, BaseTypeParameter } from '../Base/index.js';
1
+ import type { BaseDecorator, BaseInterface } from '../Base/types.js';
2
+ import type { Base, BaseConstructor } from '../Base/index.js';
2
3
  /**
3
4
  * BreakpointManager class.
4
5
  */
5
- export default function withBreakpointManager<S extends BaseConstructor<Base>, T extends BaseTypeParameter = BaseTypeParameter>(BaseClass: S, breakpoints: Array<[string, BaseConstructor<Base>]>): S;
6
+ export declare function withBreakpointManager<S extends Base>(BaseClass: typeof Base, breakpoints: Array<[string, BaseConstructor<Base>]>): BaseDecorator<BaseInterface, S>;
@@ -1,4 +1,4 @@
1
- import useResize from "../services/resize.js";
1
+ import { useResize } from "../services/index.js";
2
2
  import { isDev, isArray } from "../utils/index.js";
3
3
  function testBreakpoints(breakpoints) {
4
4
  const { breakpoint } = useResize().props();
@@ -14,7 +14,7 @@ function mountComponents(instance, breakpoints) {
14
14
  return breakpoints.map(([bk, ComponentClass]) => {
15
15
  const child = new ComponentClass(instance.$el);
16
16
  Object.defineProperty(child, "$parent", { get: () => instance.$parent });
17
- return [bk, child];
17
+ return [bk.split(" "), child];
18
18
  });
19
19
  }
20
20
  const instances = /* @__PURE__ */ new WeakMap();
@@ -34,7 +34,7 @@ function withBreakpointManager(BaseClass, breakpoints) {
34
34
  const { add, props } = useResize();
35
35
  if (!props().breakpoint) {
36
36
  if (isDev) {
37
- throw new Error(`The \`BreakpointManager\` class requires breakpoints to be defined.`);
37
+ throw new Error("The `BreakpointManager` class requires breakpoints to be defined.");
38
38
  }
39
39
  return BaseClass;
40
40
  }
@@ -65,5 +65,5 @@ function withBreakpointManager(BaseClass, breakpoints) {
65
65
  return WithBreakpointManager;
66
66
  }
67
67
  export {
68
- withBreakpointManager as default
68
+ withBreakpointManager
69
69
  };
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
6
  var __export = (target, all) => {
@@ -17,10 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
19
  var __publicField = (obj, key, value) => {
26
20
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -30,12 +24,12 @@ var __publicField = (obj, key, value) => {
30
24
  // packages/js-toolkit/decorators/withBreakpointObserver.ts
31
25
  var withBreakpointObserver_exports = {};
32
26
  __export(withBreakpointObserver_exports, {
33
- default: () => withBreakpointObserver
27
+ withBreakpointObserver: () => withBreakpointObserver
34
28
  });
35
29
  module.exports = __toCommonJS(withBreakpointObserver_exports);
36
- var import_resize = __toESM(require("../services/resize.cjs"), 1);
30
+ var import_services = require("../services/index.cjs");
37
31
  var import_utils = require("../utils/index.cjs");
38
- function testBreakpoints(instance, breakpoint = (0, import_resize.default)().props().breakpoint) {
32
+ function testBreakpoints(instance, breakpoint = (0, import_services.useResize)().props().breakpoint) {
39
33
  const { activeBreakpoints, inactiveBreakpoints } = instance.$options;
40
34
  const isInActiveBreakpoint = activeBreakpoints && activeBreakpoints.split(" ").includes(breakpoint);
41
35
  const isInInactiveBreakpoint = inactiveBreakpoints && inactiveBreakpoints.split(" ").includes(breakpoint);
@@ -60,7 +54,7 @@ function addToResize(key, instance) {
60
54
  if (import_utils.isDev) {
61
55
  testConflictingBreakpointConfiguration(instance);
62
56
  }
63
- const { add, has } = (0, import_resize.default)();
57
+ const { add, has } = (0, import_services.useResize)();
64
58
  if (!has(key)) {
65
59
  add(key, ({ breakpoint }) => {
66
60
  const action = testBreakpoints(instance, breakpoint);
@@ -77,7 +71,7 @@ function withBreakpointObserver(BaseClass) {
77
71
  class WithBreakpointObserver extends BaseClass {
78
72
  constructor(element) {
79
73
  super(element);
80
- const { remove, props } = (0, import_resize.default)();
74
+ const { remove, props } = (0, import_services.useResize)();
81
75
  const { name } = this.$options;
82
76
  if (!props().breakpoint) {
83
77
  if (import_utils.isDev) {
@@ -1,120 +1,15 @@
1
- import type { Base, BaseConstructor, BaseTypeParameter } from '../Base/index.js';
2
- interface WithBreakpointObserverInterface {
1
+ import type { BaseDecorator, BaseInterface } from '../Base/types.js';
2
+ import type { Base, BaseTypeParameter } from '../Base/index.js';
3
+ export interface WithBreakpointObserverTypeParameter extends BaseTypeParameter {
3
4
  $options: {
4
5
  activeBreakpoints?: string;
5
6
  inactiveBreakpoints?: string;
6
7
  };
7
8
  }
9
+ export interface WithBreakpointObserverInterface extends BaseInterface {
10
+ $mount(): this;
11
+ }
8
12
  /**
9
13
  * BreakpointObserver class.
10
14
  */
11
- export default function withBreakpointObserver<S extends BaseConstructor<Base>, T extends BaseTypeParameter = BaseTypeParameter>(BaseClass: S): {
12
- new (...args: any[]): {
13
- /**
14
- * Override the default $mount method to prevent component's from being
15
- * mounted when they should not.
16
- *
17
- * @returns {this}
18
- */
19
- $mount(): any;
20
- $parent: Base<BaseTypeParameter>;
21
- $id: string;
22
- $el: HTMLElement & {
23
- __base__?: WeakMap<BaseConstructor<Base<BaseTypeParameter>>, Base<BaseTypeParameter> | "terminated">;
24
- };
25
- $isMounted: boolean;
26
- __eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
27
- readonly $root: Base<BaseTypeParameter>;
28
- readonly __config: import("../Base/index.js").BaseConfig;
29
- __services: import("../Base/managers/ServicesManager.js").default;
30
- readonly $services: import("../Base/managers/ServicesManager.js").default;
31
- __refs: import("../Base/managers/RefsManager.js").default & import("../Base/index.js").BaseRefs;
32
- readonly $refs: import("../Base/managers/RefsManager.js").default & import("../Base/index.js").BaseRefs;
33
- __options: import("../Base/managers/OptionsManager.js").default & import("../Base/index.js").BaseOptions;
34
- readonly $options: import("../Base/managers/OptionsManager.js").default & import("../Base/index.js").BaseOptions;
35
- __children: import("../Base/managers/ChildrenManager.js").default & import("../Base/index.js").BaseChildren;
36
- readonly $children: import("../Base/managers/ChildrenManager.js").default & import("../Base/index.js").BaseChildren;
37
- __events: import("../Base/managers/EventsManager.js").default;
38
- readonly $log: (...args: unknown[]) => void;
39
- readonly __debug: (...args: unknown[]) => void;
40
- readonly __managers: import("../Base/index.js").Managers;
41
- __callMethod(method: string, ...args: unknown[]): unknown;
42
- __hasEvent(event: string): boolean;
43
- $update(): any;
44
- $destroy(): any;
45
- $terminate(): void;
46
- __addEmits(event: string): void;
47
- __removeEmits(event: string): void;
48
- readonly __ctor: BaseConstructor<Base<BaseTypeParameter>>;
49
- $on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
50
- $off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
51
- $emit(event: string, ...args: unknown[]): void;
52
- addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
53
- dispatchEvent(event: Event): boolean;
54
- removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
55
- };
56
- prototype: Base<BaseTypeParameter>;
57
- } & Pick<typeof Base, "prototype" | "$isBase" | "config" | "$factory"> & Pick<{
58
- new (element: any): {
59
- /**
60
- * Override the default $mount method to prevent component's from being
61
- * mounted when they should not.
62
- *
63
- * @returns {this}
64
- */
65
- $mount(): any;
66
- $parent: Base<BaseTypeParameter>;
67
- $id: string;
68
- $el: HTMLElement & {
69
- __base__?: WeakMap<BaseConstructor<Base<BaseTypeParameter>>, Base<BaseTypeParameter> | "terminated">;
70
- };
71
- $isMounted: boolean;
72
- __eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
73
- readonly $root: Base<BaseTypeParameter>;
74
- readonly __config: import("../Base/index.js").BaseConfig;
75
- __services: import("../Base/managers/ServicesManager.js").default;
76
- readonly $services: import("../Base/managers/ServicesManager.js").default;
77
- __refs: import("../Base/managers/RefsManager.js").default & import("../Base/index.js").BaseRefs;
78
- readonly $refs: import("../Base/managers/RefsManager.js").default & import("../Base/index.js").BaseRefs;
79
- __options: import("../Base/managers/OptionsManager.js").default & import("../Base/index.js").BaseOptions;
80
- readonly $options: import("../Base/managers/OptionsManager.js").default & import("../Base/index.js").BaseOptions;
81
- __children: import("../Base/managers/ChildrenManager.js").default & import("../Base/index.js").BaseChildren;
82
- readonly $children: import("../Base/managers/ChildrenManager.js").default & import("../Base/index.js").BaseChildren;
83
- __events: import("../Base/managers/EventsManager.js").default;
84
- readonly $log: (...args: unknown[]) => void;
85
- readonly __debug: (...args: unknown[]) => void;
86
- readonly __managers: import("../Base/index.js").Managers;
87
- __callMethod(method: string, ...args: unknown[]): unknown;
88
- __hasEvent(event: string): boolean;
89
- $update(): any;
90
- $destroy(): any;
91
- $terminate(): void;
92
- __addEmits(event: string): void;
93
- __removeEmits(event: string): void;
94
- readonly __ctor: BaseConstructor<Base<BaseTypeParameter>>;
95
- $on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
96
- $off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
97
- $emit(event: string, ...args: unknown[]): void;
98
- addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
99
- dispatchEvent(event: Event): boolean;
100
- removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
101
- };
102
- config: {
103
- name: string;
104
- options: {
105
- activeBreakpoints: StringConstructor;
106
- inactiveBreakpoints: StringConstructor;
107
- };
108
- debug?: boolean;
109
- log?: boolean;
110
- refs?: string[];
111
- emits?: string[];
112
- components?: import("../Base/index.js").BaseConfigComponents;
113
- };
114
- readonly $isBase: true;
115
- $factory: typeof Base.$factory;
116
- } & S, "prototype" | "$isBase" | "config" | "$factory" | keyof S> & S & {
117
- new (...args: any[]): Base<T & WithBreakpointObserverInterface>;
118
- prototype: Base<BaseTypeParameter>;
119
- };
120
- export {};
15
+ export declare function withBreakpointObserver<S extends Base>(BaseClass: typeof Base): BaseDecorator<WithBreakpointObserverInterface, S>;
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import useResize from "../services/resize.js";
7
+ import { useResize } from "../services/index.js";
8
8
  import { isDev } from "../utils/index.js";
9
9
  function testBreakpoints(instance, breakpoint = useResize().props().breakpoint) {
10
10
  const { activeBreakpoints, inactiveBreakpoints } = instance.$options;
@@ -98,5 +98,5 @@ function withBreakpointObserver(BaseClass) {
98
98
  return WithBreakpointObserver;
99
99
  }
100
100
  export {
101
- withBreakpointObserver as default
101
+ withBreakpointObserver
102
102
  };
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
6
  var __export = (target, all) => {
@@ -17,10 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
19
  var __publicField = (obj, key, value) => {
26
20
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -30,18 +24,18 @@ var __publicField = (obj, key, value) => {
30
24
  // packages/js-toolkit/decorators/withDrag.ts
31
25
  var withDrag_exports = {};
32
26
  __export(withDrag_exports, {
33
- default: () => withDrag
27
+ withDrag: () => withDrag
34
28
  });
35
29
  module.exports = __toCommonJS(withDrag_exports);
36
- var import_drag = __toESM(require("../services/drag.cjs"), 1);
30
+ var import_services = require("../services/index.cjs");
37
31
  function withDrag(BaseClass, { target = (instance) => instance.$el, ...options } = {}) {
38
32
  class WithDrag extends BaseClass {
39
- constructor(el) {
40
- super(el);
33
+ constructor(element) {
34
+ super(element);
41
35
  this.$on("mounted", () => {
42
36
  this.$services.register(
43
37
  "dragged",
44
- import_drag.default.bind(void 0, target.call(this, this), options)
38
+ import_services.useDrag.bind(void 0, target.call(this, this), options)
45
39
  );
46
40
  this.$services.enable("dragged");
47
41
  });
@@ -1,98 +1,13 @@
1
- import type { Base, BaseTypeParameter, BaseConstructor } from '../Base/index.js';
2
- import type { DragServiceOptions } from '../services/drag.js';
3
- declare type DragDecoratorOptions = DragServiceOptions & {
1
+ import type { BaseDecorator, BaseInterface } from '../Base/types.js';
2
+ import type { Base } from '../Base/index.js';
3
+ import type { DragServiceOptions, DragServiceProps } from '../services/drag.js';
4
+ export declare type DragDecoratorOptions = DragServiceOptions & {
4
5
  target?: (this: Base, instance: Base) => HTMLElement;
5
6
  };
7
+ export interface WithDragInterfacd extends BaseInterface {
8
+ dragged?(props: DragServiceProps): void;
9
+ }
6
10
  /**
7
11
  * Add dragging capabilities to a component.
8
12
  */
9
- export default function withDrag<S extends BaseConstructor<Base>, T extends BaseTypeParameter = BaseTypeParameter>(BaseClass: S, { target, ...options }?: DragDecoratorOptions): {
10
- new (...args: any[]): {
11
- $parent: Base<BaseTypeParameter>;
12
- $id: string;
13
- $el: HTMLElement & {
14
- __base__?: WeakMap<BaseConstructor<Base<BaseTypeParameter>>, Base<BaseTypeParameter> | "terminated">;
15
- };
16
- $isMounted: boolean;
17
- __eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
18
- readonly $root: Base<BaseTypeParameter>;
19
- readonly __config: import("../Base/index.js").BaseConfig;
20
- __services: import("../Base/managers/ServicesManager.js").default;
21
- readonly $services: import("../Base/managers/ServicesManager.js").default;
22
- __refs: import("../Base/managers/RefsManager.js").default & import("../Base/index.js").BaseRefs;
23
- readonly $refs: import("../Base/managers/RefsManager.js").default & import("../Base/index.js").BaseRefs;
24
- __options: import("../Base/managers/OptionsManager.js").default & import("../Base/index.js").BaseOptions;
25
- readonly $options: import("../Base/managers/OptionsManager.js").default & import("../Base/index.js").BaseOptions;
26
- __children: import("../Base/managers/ChildrenManager.js").default & import("../Base/index.js").BaseChildren;
27
- readonly $children: import("../Base/managers/ChildrenManager.js").default & import("../Base/index.js").BaseChildren;
28
- __events: import("../Base/managers/EventsManager.js").default;
29
- readonly $log: (...args: unknown[]) => void;
30
- readonly __debug: (...args: unknown[]) => void;
31
- readonly __managers: import("../Base/index.js").Managers;
32
- __callMethod(method: string, ...args: unknown[]): unknown;
33
- __hasEvent(event: string): boolean;
34
- $mount(): any;
35
- $update(): any;
36
- $destroy(): any;
37
- $terminate(): void;
38
- __addEmits(event: string): void;
39
- __removeEmits(event: string): void;
40
- readonly __ctor: BaseConstructor<Base<BaseTypeParameter>>;
41
- $on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
42
- $off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
43
- $emit(event: string, ...args: unknown[]): void;
44
- addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
45
- dispatchEvent(event: Event): boolean;
46
- removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
47
- };
48
- prototype: Base<BaseTypeParameter>;
49
- } & Pick<typeof Base, "prototype" | "$isBase" | "config" | "$factory"> & Pick<{
50
- new (el: any): {
51
- $parent: Base<BaseTypeParameter>;
52
- $id: string;
53
- $el: HTMLElement & {
54
- __base__?: WeakMap<BaseConstructor<Base<BaseTypeParameter>>, Base<BaseTypeParameter> | "terminated">;
55
- };
56
- $isMounted: boolean;
57
- __eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
58
- readonly $root: Base<BaseTypeParameter>;
59
- readonly __config: import("../Base/index.js").BaseConfig;
60
- __services: import("../Base/managers/ServicesManager.js").default;
61
- readonly $services: import("../Base/managers/ServicesManager.js").default;
62
- __refs: import("../Base/managers/RefsManager.js").default & import("../Base/index.js").BaseRefs;
63
- readonly $refs: import("../Base/managers/RefsManager.js").default & import("../Base/index.js").BaseRefs;
64
- __options: import("../Base/managers/OptionsManager.js").default & import("../Base/index.js").BaseOptions;
65
- readonly $options: import("../Base/managers/OptionsManager.js").default & import("../Base/index.js").BaseOptions;
66
- __children: import("../Base/managers/ChildrenManager.js").default & import("../Base/index.js").BaseChildren;
67
- readonly $children: import("../Base/managers/ChildrenManager.js").default & import("../Base/index.js").BaseChildren;
68
- __events: import("../Base/managers/EventsManager.js").default;
69
- readonly $log: (...args: unknown[]) => void;
70
- readonly __debug: (...args: unknown[]) => void;
71
- readonly __managers: import("../Base/index.js").Managers;
72
- __callMethod(method: string, ...args: unknown[]): unknown;
73
- __hasEvent(event: string): boolean;
74
- $mount(): any;
75
- $update(): any;
76
- $destroy(): any;
77
- $terminate(): void;
78
- __addEmits(event: string): void;
79
- __removeEmits(event: string): void;
80
- readonly __ctor: BaseConstructor<Base<BaseTypeParameter>>;
81
- $on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
82
- $off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
83
- $emit(event: string, ...args: unknown[]): void;
84
- addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
85
- dispatchEvent(event: Event): boolean;
86
- removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
87
- };
88
- config: {
89
- name: string;
90
- emits: string[];
91
- };
92
- readonly $isBase: true;
93
- $factory: typeof Base.$factory;
94
- } & S, "prototype" | "$isBase" | "config" | "$factory" | keyof S> & S & {
95
- new (...args: any[]): Base<T>;
96
- prototype: Base<BaseTypeParameter>;
97
- };
98
- export {};
13
+ export declare function withDrag<S extends Base>(BaseClass: typeof Base, { target, ...options }?: DragDecoratorOptions): BaseDecorator<BaseInterface, S>;
@@ -4,11 +4,11 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import useDrag from "../services/drag.js";
7
+ import { useDrag } from "../services/index.js";
8
8
  function withDrag(BaseClass, { target = (instance) => instance.$el, ...options } = {}) {
9
9
  class WithDrag extends BaseClass {
10
- constructor(el) {
11
- super(el);
10
+ constructor(element) {
11
+ super(element);
12
12
  this.$on("mounted", () => {
13
13
  this.$services.register(
14
14
  "dragged",
@@ -29,5 +29,5 @@ function withDrag(BaseClass, { target = (instance) => instance.$el, ...options }
29
29
  return WithDrag;
30
30
  }
31
31
  export {
32
- withDrag as default
32
+ withDrag
33
33
  };
@@ -30,7 +30,7 @@ var __publicField = (obj, key, value) => {
30
30
  // packages/js-toolkit/decorators/withExtraConfig.ts
31
31
  var withExtraConfig_exports = {};
32
32
  __export(withExtraConfig_exports, {
33
- default: () => withExtraConfig
33
+ withExtraConfig: () => withExtraConfig
34
34
  });
35
35
  module.exports = __toCommonJS(withExtraConfig_exports);
36
36
  var import_deepmerge = __toESM(require("deepmerge"), 1);