@studiometa/js-toolkit 2.4.4-alpha.3 → 2.4.4-alpha.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 (73) hide show
  1. package/Base/index.cjs +1 -1
  2. package/Base/index.d.ts +16 -18
  3. package/Base/index.js +1 -1
  4. package/Base/managers/AbstractManager.d.ts +2 -2
  5. package/Base/managers/ChildrenManager.cjs +2 -4
  6. package/Base/managers/ChildrenManager.d.ts +2 -10
  7. package/Base/managers/ChildrenManager.js +1 -3
  8. package/Base/managers/EventsManager.cjs +3 -3
  9. package/Base/managers/EventsManager.d.ts +9 -15
  10. package/Base/managers/EventsManager.js +2 -2
  11. package/Base/managers/OptionsManager.d.ts +2 -2
  12. package/Base/managers/ServicesManager.d.ts +1 -1
  13. package/Base/utils.cjs +1 -1
  14. package/Base/utils.d.ts +5 -21
  15. package/decorators/index.cjs +2 -0
  16. package/decorators/index.d.ts +1 -0
  17. package/decorators/index.js +4 -2
  18. package/decorators/withBreakpointManager.cjs +3 -2
  19. package/decorators/withBreakpointManager.d.ts +2 -56
  20. package/decorators/withBreakpointManager.js +3 -2
  21. package/decorators/withBreakpointObserver.cjs +6 -4
  22. package/decorators/withBreakpointObserver.d.ts +71 -16
  23. package/decorators/withBreakpointObserver.js +6 -4
  24. package/decorators/withDrag.cjs +5 -4
  25. package/decorators/withDrag.d.ts +58 -16
  26. package/decorators/withDrag.js +5 -4
  27. package/decorators/withExtraConfig.cjs +4 -3
  28. package/decorators/withExtraConfig.d.ts +60 -17
  29. package/decorators/withExtraConfig.js +4 -3
  30. package/decorators/withFreezedOptions.cjs +3 -2
  31. package/decorators/withFreezedOptions.d.ts +68 -16
  32. package/decorators/withFreezedOptions.js +3 -2
  33. package/decorators/withIntersectionObserver.cjs +6 -4
  34. package/decorators/withIntersectionObserver.d.ts +64 -17
  35. package/decorators/withIntersectionObserver.js +6 -4
  36. package/decorators/withMountWhenInView.cjs +10 -5
  37. package/decorators/withMountWhenInView.d.ts +71 -16
  38. package/decorators/withMountWhenInView.js +10 -5
  39. package/decorators/withResponsiveOptions.cjs +3 -2
  40. package/decorators/withResponsiveOptions.d.ts +65 -17
  41. package/decorators/withResponsiveOptions.js +3 -2
  42. package/decorators/withScrolledInView.cjs +5 -4
  43. package/decorators/withScrolledInView.d.ts +222 -55
  44. package/decorators/withScrolledInView.js +5 -4
  45. package/decorators/withType.cjs +28 -0
  46. package/decorators/withType.d.ts +5 -0
  47. package/decorators/withType.js +6 -0
  48. package/decorators/withVue2.cjs +7 -4
  49. package/decorators/withVue2.d.ts +61 -17
  50. package/decorators/withVue2.js +7 -4
  51. package/helpers/createApp.cjs +1 -1
  52. package/helpers/createApp.d.ts +2 -10
  53. package/helpers/getDirectChildren.cjs +5 -5
  54. package/helpers/getDirectChildren.d.ts +3 -6
  55. package/helpers/getDirectChildren.js +4 -4
  56. package/helpers/getInstanceFromElement.cjs +3 -4
  57. package/helpers/getInstanceFromElement.d.ts +2 -11
  58. package/helpers/getInstanceFromElement.js +2 -3
  59. package/helpers/importOnInteraction.cjs +1 -1
  60. package/helpers/importOnInteraction.d.ts +5 -10
  61. package/helpers/importWhenIdle.cjs +3 -5
  62. package/helpers/importWhenIdle.d.ts +7 -10
  63. package/helpers/importWhenIdle.js +2 -4
  64. package/helpers/importWhenVisible.cjs +1 -1
  65. package/helpers/importWhenVisible.d.ts +2 -7
  66. package/helpers/index.cjs +1 -1
  67. package/helpers/index.d.ts +6 -6
  68. package/helpers/utils.cjs +1 -1
  69. package/helpers/utils.d.ts +1 -1
  70. package/index.cjs +2 -8
  71. package/index.d.ts +1 -1
  72. package/index.js +2 -2
  73. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
- import type { BaseTypeParameter, BaseConstructor, BaseConfig } from '../Base/index.js';
1
+ import type { Base, BaseTypeParameter, BaseConstructor, BaseConfig } from '../Base/index.js';
2
+ import type { RafServiceProps, ScrollServiceProps, ResizeServiceProps } from '../services/index.js';
2
3
  declare type ScrollInViewProps = {
3
4
  start: {
4
5
  x: number;
@@ -31,8 +32,8 @@ declare type withScrolledInViewOptions = IntersectionObserverInit & {
31
32
  /**
32
33
  * Add scrolled in view capabilities to a component.
33
34
  */
34
- export default function withScrolledInView<T extends BaseTypeParameter = BaseTypeParameter>(BaseClass: BaseConstructor, options?: withScrolledInViewOptions): {
35
- new <U extends BaseTypeParameter = BaseTypeParameter>(element: any): {
35
+ export default function withScrolledInView<S extends BaseConstructor<Base>, T extends BaseTypeParameter = BaseTypeParameter>(BaseClass: S, options?: withScrolledInViewOptions): {
36
+ new (...args: any[]): {
36
37
  __props: ScrollInViewProps;
37
38
  /**
38
39
  * Factor used for the `dampedProgress` props.
@@ -44,107 +45,182 @@ export default function withScrolledInView<T extends BaseTypeParameter = BaseTyp
44
45
  dampPrecision: number;
45
46
  /**
46
47
  * Mounted hook.
47
- *
48
- * @returns {void}
49
48
  */
50
49
  mounted(): void;
51
50
  /**
52
51
  * Resized hook.
53
- *
54
- * @param {import('../services/resize').ResizeServiceProps} props
55
- * @returns {void}
56
52
  */
57
- resized(props: any): void;
53
+ resized(props: ResizeServiceProps): void;
58
54
  /**
59
55
  * Scrolled hook.
60
- *
61
- * @param {import('../services/scroll').ScrollServiceProps} props
62
- * @returns {void}
63
56
  */
64
- scrolled(props: any): void;
57
+ scrolled(props: ScrollServiceProps): void;
65
58
  /**
66
59
  * Ticked hook.
67
- *
68
- * @param {import('../services/raf').RafServiceProps} props
69
- * @returns {void}
70
60
  */
71
- ticked(props: any): void;
61
+ ticked(props: RafServiceProps): void;
72
62
  /**
73
63
  * Destroyed hook.
74
- *
75
- * @returns {void}
76
64
  */
77
65
  destroyed(): void;
78
66
  /**
79
67
  * Set the decorator props.
80
- *
81
- * @returns {void}
82
68
  */
83
69
  __setProps(): void;
84
70
  __isVisible: boolean;
85
71
  __observer: IntersectionObserver;
86
- $mount(): any;
87
- $parent: import("../Base/index.js").default<BaseTypeParameter>;
72
+ $mount: (() => any) & (() => any);
73
+ $parent: Base<BaseTypeParameter>;
88
74
  $id: string;
89
- $el: ({
75
+ $el: HTMLElement & {
76
+ __base__?: WeakMap<BaseConstructor<Base<BaseTypeParameter>>, Base<BaseTypeParameter> | "terminated">;
77
+ } & (T & {
90
78
  $options: {
91
79
  intersectionObserver: IntersectionObserverInit;
92
80
  };
93
- } & T & U)["$el"] & HTMLElement & {
94
- __base__?: WeakMap<typeof import("../Base/index.js").default, import("../Base/index.js").default<BaseTypeParameter> | "terminated">;
95
- };
81
+ })["$el"];
96
82
  $isMounted: boolean;
97
83
  __eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
98
- readonly $root: import("../Base/index.js").default<BaseTypeParameter>;
84
+ readonly $root: Base<BaseTypeParameter>;
99
85
  readonly __config: BaseConfig;
100
86
  __services: import("../Base/managers/ServicesManager.js").default;
101
87
  readonly $services: import("../Base/managers/ServicesManager.js").default;
102
- __refs: import("../Base/managers/RefsManager.js").default & ({
88
+ __refs: import("../Base/managers/RefsManager.js").default & import("../Base/index.js").BaseRefs & (T & {
103
89
  $options: {
104
90
  intersectionObserver: IntersectionObserverInit;
105
91
  };
106
- } & T & U)["$refs"] & import("../Base/index.js").BaseRefs;
107
- readonly $refs: import("../Base/managers/RefsManager.js").default & ({
92
+ })["$refs"];
93
+ readonly $refs: import("../Base/managers/RefsManager.js").default & import("../Base/index.js").BaseRefs & (T & {
108
94
  $options: {
109
95
  intersectionObserver: IntersectionObserverInit;
110
96
  };
111
- } & T & U)["$refs"] & import("../Base/index.js").BaseRefs;
112
- __options: import("../Base/managers/OptionsManager.js").default & ({
97
+ })["$refs"];
98
+ __options: import("../Base/managers/OptionsManager.js").default & import("../Base/index.js").BaseOptions & (T & {
113
99
  $options: {
114
100
  intersectionObserver: IntersectionObserverInit;
115
101
  };
116
- } & T & U)["$options"] & import("../Base/index.js").BaseOptions;
117
- readonly $options: import("../Base/managers/OptionsManager.js").default & ({
102
+ })["$options"];
103
+ readonly $options: import("../Base/managers/OptionsManager.js").default & import("../Base/index.js").BaseOptions & (T & {
118
104
  $options: {
119
105
  intersectionObserver: IntersectionObserverInit;
120
106
  };
121
- } & T & U)["$options"] & import("../Base/index.js").BaseOptions;
122
- __children: import("../Base/managers/ChildrenManager.js").default & (({
107
+ })["$options"];
108
+ __children: import("../Base/managers/ChildrenManager.js").default & import("../Base/index.js").BaseChildren & (T & {
123
109
  $options: {
124
110
  intersectionObserver: IntersectionObserverInit;
125
111
  };
126
- } & T & U)["$children"] extends infer T_1 ? { [key in keyof T_1]: ({
112
+ })["$children"];
113
+ readonly $children: import("../Base/managers/ChildrenManager.js").default & import("../Base/index.js").BaseChildren & (T & {
127
114
  $options: {
128
115
  intersectionObserver: IntersectionObserverInit;
129
116
  };
130
- } & T & U)["$children"][key][]; } : never) & import("../Base/index.js").BaseChildren;
131
- readonly $children: import("../Base/managers/ChildrenManager.js").default & (({
117
+ })["$children"];
118
+ __events: import("../Base/managers/EventsManager.js").default;
119
+ readonly $log: (...args: unknown[]) => void;
120
+ readonly __debug: (...args: unknown[]) => void;
121
+ readonly __managers: import("../Base/index.js").Managers;
122
+ __callMethod(method: string, ...args: unknown[]): unknown;
123
+ __hasEvent(event: string): boolean;
124
+ $update(): any;
125
+ $destroy(): any;
126
+ $terminate(): void;
127
+ __addEmits(event: string): void;
128
+ __removeEmits(event: string): void;
129
+ readonly __ctor: BaseConstructor<Base<BaseTypeParameter>>;
130
+ $on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
131
+ $off: ((event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions) => void) & ((event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions) => void);
132
+ $emit: ((event: string, ...args: unknown[]) => void) & ((event: string, ...args: unknown[]) => void);
133
+ addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
134
+ dispatchEvent(event: Event): boolean;
135
+ removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
136
+ };
137
+ prototype: Base<BaseTypeParameter>;
138
+ } & Pick<typeof Base, "prototype" | "$isBase" | "config" | "$factory"> & Pick<{
139
+ new (element: HTMLElement): {
140
+ __props: ScrollInViewProps;
141
+ /**
142
+ * Factor used for the `dampedProgress` props.
143
+ */
144
+ dampFactor: number;
145
+ /**
146
+ * Precision for the `dampedProgress` props.
147
+ */
148
+ dampPrecision: number;
149
+ /**
150
+ * Mounted hook.
151
+ */
152
+ mounted(): void;
153
+ /**
154
+ * Resized hook.
155
+ */
156
+ resized(props: ResizeServiceProps): void;
157
+ /**
158
+ * Scrolled hook.
159
+ */
160
+ scrolled(props: ScrollServiceProps): void;
161
+ /**
162
+ * Ticked hook.
163
+ */
164
+ ticked(props: RafServiceProps): void;
165
+ /**
166
+ * Destroyed hook.
167
+ */
168
+ destroyed(): void;
169
+ /**
170
+ * Set the decorator props.
171
+ */
172
+ __setProps(): void;
173
+ __isVisible: boolean;
174
+ __observer: IntersectionObserver;
175
+ $mount: (() => any) & (() => any);
176
+ $parent: Base<BaseTypeParameter>;
177
+ $id: string;
178
+ $el: HTMLElement & {
179
+ __base__?: WeakMap<BaseConstructor<Base<BaseTypeParameter>>, Base<BaseTypeParameter> | "terminated">;
180
+ } & (T & {
132
181
  $options: {
133
182
  intersectionObserver: IntersectionObserverInit;
134
183
  };
135
- } & T & U)["$children"] extends infer T_2 ? { [key_1 in keyof T_2]: ({
184
+ })["$el"];
185
+ $isMounted: boolean;
186
+ __eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
187
+ readonly $root: Base<BaseTypeParameter>;
188
+ readonly __config: BaseConfig;
189
+ __services: import("../Base/managers/ServicesManager.js").default;
190
+ readonly $services: import("../Base/managers/ServicesManager.js").default;
191
+ __refs: import("../Base/managers/RefsManager.js").default & import("../Base/index.js").BaseRefs & (T & {
136
192
  $options: {
137
193
  intersectionObserver: IntersectionObserverInit;
138
194
  };
139
- } & T & U)["$children"][key_1][]; } : never) & import("../Base/index.js").BaseChildren;
140
- __events: import("../Base/managers/EventsManager.js").default; /**
141
- * Ticked hook.
142
- *
143
- * @param {import('../services/raf').RafServiceProps} props
144
- * @returns {void}
145
- */
146
- readonly $log: (...args: any) => void;
147
- readonly __debug: (...args: any) => void;
195
+ })["$refs"];
196
+ readonly $refs: import("../Base/managers/RefsManager.js").default & import("../Base/index.js").BaseRefs & (T & {
197
+ $options: {
198
+ intersectionObserver: IntersectionObserverInit;
199
+ };
200
+ })["$refs"];
201
+ __options: import("../Base/managers/OptionsManager.js").default & import("../Base/index.js").BaseOptions & (T & {
202
+ $options: {
203
+ intersectionObserver: IntersectionObserverInit;
204
+ };
205
+ })["$options"];
206
+ readonly $options: import("../Base/managers/OptionsManager.js").default & import("../Base/index.js").BaseOptions & (T & {
207
+ $options: {
208
+ intersectionObserver: IntersectionObserverInit;
209
+ };
210
+ })["$options"];
211
+ __children: import("../Base/managers/ChildrenManager.js").default & import("../Base/index.js").BaseChildren & (T & {
212
+ $options: {
213
+ intersectionObserver: IntersectionObserverInit;
214
+ };
215
+ })["$children"];
216
+ readonly $children: import("../Base/managers/ChildrenManager.js").default & import("../Base/index.js").BaseChildren & (T & {
217
+ $options: {
218
+ intersectionObserver: IntersectionObserverInit;
219
+ };
220
+ })["$children"];
221
+ __events: import("../Base/managers/EventsManager.js").default;
222
+ readonly $log: (...args: unknown[]) => void;
223
+ readonly __debug: (...args: unknown[]) => void;
148
224
  readonly __managers: import("../Base/index.js").Managers;
149
225
  __callMethod(method: string, ...args: unknown[]): unknown;
150
226
  __hasEvent(event: string): boolean;
@@ -153,10 +229,10 @@ export default function withScrolledInView<T extends BaseTypeParameter = BaseTyp
153
229
  $terminate(): void;
154
230
  __addEmits(event: string): void;
155
231
  __removeEmits(event: string): void;
156
- readonly __ctor: typeof import("../Base/index.js").default;
232
+ readonly __ctor: BaseConstructor<Base<BaseTypeParameter>>;
157
233
  $on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
158
- $off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
159
- $emit(event: string, ...args: unknown[]): void;
234
+ $off: ((event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions) => void) & ((event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions) => void);
235
+ $emit: ((event: string, ...args: unknown[]) => void) & ((event: string, ...args: unknown[]) => void);
160
236
  addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
161
237
  dispatchEvent(event: Event): boolean;
162
238
  removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
@@ -165,7 +241,98 @@ export default function withScrolledInView<T extends BaseTypeParameter = BaseTyp
165
241
  * Config.
166
242
  */
167
243
  config: BaseConfig;
168
- readonly $isBase: true;
169
- $factory(nameOrSelector: string): import("../Base/index.js").default<BaseTypeParameter>[];
244
+ readonly $isBase: true & ({
245
+ new (element: HTMLElement): {
246
+ __isVisible: boolean;
247
+ __observer: IntersectionObserver;
248
+ $mount(): any;
249
+ $parent: Base<BaseTypeParameter>;
250
+ $id: string;
251
+ $el: HTMLElement & {
252
+ __base__?: WeakMap<BaseConstructor<Base<BaseTypeParameter>>, Base<BaseTypeParameter> | "terminated">;
253
+ };
254
+ $isMounted: boolean;
255
+ __eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
256
+ readonly $root: Base<BaseTypeParameter>;
257
+ readonly __config: BaseConfig;
258
+ __services: import("../Base/managers/ServicesManager.js").default;
259
+ readonly $services: import("../Base/managers/ServicesManager.js").default;
260
+ __refs: import("../Base/managers/RefsManager.js").default & import("../Base/index.js").BaseRefs;
261
+ readonly $refs: import("../Base/managers/RefsManager.js").default & import("../Base/index.js").BaseRefs;
262
+ __options: import("../Base/managers/OptionsManager.js").default & import("../Base/index.js").BaseOptions;
263
+ readonly $options: import("../Base/managers/OptionsManager.js").default & import("../Base/index.js").BaseOptions;
264
+ __children: import("../Base/managers/ChildrenManager.js").default & import("../Base/index.js").BaseChildren;
265
+ readonly $children: import("../Base/managers/ChildrenManager.js").default & import("../Base/index.js").BaseChildren;
266
+ __events: import("../Base/managers/EventsManager.js").default;
267
+ readonly $log: (...args: unknown[]) => void;
268
+ readonly __debug: (...args: unknown[]) => void;
269
+ readonly __managers: import("../Base/index.js").Managers;
270
+ __callMethod(method: string, ...args: unknown[]): unknown;
271
+ __hasEvent(event: string): boolean;
272
+ $update(): any;
273
+ $destroy(): any;
274
+ $terminate(): void;
275
+ __addEmits(event: string): void;
276
+ __removeEmits(event: string): void;
277
+ readonly __ctor: BaseConstructor<Base<BaseTypeParameter>>;
278
+ $on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
279
+ $off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
280
+ $emit(event: string, ...args: unknown[]): void;
281
+ addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
282
+ dispatchEvent(event: Event): boolean;
283
+ removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
284
+ };
285
+ config: BaseConfig;
286
+ readonly $isBase: true;
287
+ $factory: typeof Base.$factory;
288
+ } & S)["$isBase"];
289
+ $factory: typeof Base.$factory & ({
290
+ new (element: HTMLElement): {
291
+ __isVisible: boolean;
292
+ __observer: IntersectionObserver;
293
+ $mount(): any;
294
+ $parent: Base<BaseTypeParameter>;
295
+ $id: string;
296
+ $el: HTMLElement & {
297
+ __base__?: WeakMap<BaseConstructor<Base<BaseTypeParameter>>, Base<BaseTypeParameter> | "terminated">;
298
+ };
299
+ $isMounted: boolean;
300
+ __eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
301
+ readonly $root: Base<BaseTypeParameter>;
302
+ readonly __config: BaseConfig;
303
+ __services: import("../Base/managers/ServicesManager.js").default;
304
+ readonly $services: import("../Base/managers/ServicesManager.js").default;
305
+ __refs: import("../Base/managers/RefsManager.js").default & import("../Base/index.js").BaseRefs;
306
+ readonly $refs: import("../Base/managers/RefsManager.js").default & import("../Base/index.js").BaseRefs;
307
+ __options: import("../Base/managers/OptionsManager.js").default & import("../Base/index.js").BaseOptions;
308
+ readonly $options: import("../Base/managers/OptionsManager.js").default & import("../Base/index.js").BaseOptions;
309
+ __children: import("../Base/managers/ChildrenManager.js").default & import("../Base/index.js").BaseChildren;
310
+ readonly $children: import("../Base/managers/ChildrenManager.js").default & import("../Base/index.js").BaseChildren;
311
+ __events: import("../Base/managers/EventsManager.js").default;
312
+ readonly $log: (...args: unknown[]) => void;
313
+ readonly __debug: (...args: unknown[]) => void;
314
+ readonly __managers: import("../Base/index.js").Managers;
315
+ __callMethod(method: string, ...args: unknown[]): unknown;
316
+ __hasEvent(event: string): boolean;
317
+ $update(): any;
318
+ $destroy(): any;
319
+ $terminate(): void;
320
+ __addEmits(event: string): void;
321
+ __removeEmits(event: string): void;
322
+ readonly __ctor: BaseConstructor<Base<BaseTypeParameter>>;
323
+ $on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
324
+ $off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
325
+ $emit(event: string, ...args: unknown[]): void;
326
+ addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
327
+ dispatchEvent(event: Event): boolean;
328
+ removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
329
+ };
330
+ config: BaseConfig;
331
+ readonly $isBase: true;
332
+ $factory: typeof Base.$factory;
333
+ } & S)["$factory"];
334
+ } & S, "prototype" | "$isBase" | "config" | "$factory" | keyof S> & S & {
335
+ new (...args: any[]): Base<T>;
336
+ prototype: Base<BaseTypeParameter>;
170
337
  };
171
338
  export {};
@@ -27,9 +27,8 @@ function updateProps(props, dampFactor, dampPrecision, axis = "x") {
27
27
  );
28
28
  }
29
29
  function withScrolledInView(BaseClass, options = {}) {
30
- var _a;
31
30
  const WithMountWhenInView = withMountWhenInView(BaseClass, options);
32
- return _a = class extends WithMountWhenInView {
31
+ class WithScrolledInView extends WithMountWhenInView {
33
32
  constructor(element) {
34
33
  super(element);
35
34
  __publicField(this, "__props", {
@@ -172,10 +171,12 @@ function withScrolledInView(BaseClass, options = {}) {
172
171
  (this.__props.dampedCurrent.y - yStart) / (yEnd - yStart)
173
172
  );
174
173
  }
175
- }, __publicField(_a, "config", {
174
+ }
175
+ __publicField(WithScrolledInView, "config", {
176
176
  name: `${BaseClass.config.name}WithMountWhenInView`,
177
177
  emits: ["scrolledInView"]
178
- }), _a;
178
+ });
179
+ return WithScrolledInView;
179
180
  }
180
181
  export {
181
182
  withScrolledInView as default
@@ -0,0 +1,28 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // packages/js-toolkit/decorators/withType.ts
20
+ var withType_exports = {};
21
+ __export(withType_exports, {
22
+ default: () => withType
23
+ });
24
+ module.exports = __toCommonJS(withType_exports);
25
+ function withType(BaseClass) {
26
+ return BaseClass;
27
+ }
28
+ if (module.exports.default) module.exports = module.exports.default;
@@ -0,0 +1,5 @@
1
+ import type { Base, BaseTypeParameter, BaseConstructor } from '../Base/index.js';
2
+ export default function withType<T extends BaseConstructor<Base>, U extends BaseTypeParameter = BaseTypeParameter>(BaseClass: T): T & {
3
+ new (...args: any[]): Base<U>;
4
+ prototype: Base<BaseTypeParameter>;
5
+ } & Pick<typeof Base, "prototype" | "$isBase" | "config" | "$factory">;
@@ -0,0 +1,6 @@
1
+ function withType(BaseClass) {
2
+ return BaseClass;
3
+ }
4
+ export {
5
+ withType as default
6
+ };
@@ -29,8 +29,8 @@ __export(withVue2_exports, {
29
29
  module.exports = __toCommonJS(withVue2_exports);
30
30
  var import_utils = require("../utils/index.cjs");
31
31
  function withVue2(BaseClass, VueCtor) {
32
- var _a, _b, _c;
33
- return _c = class extends BaseClass {
32
+ var _a, _b;
33
+ class WithVue2 extends BaseClass {
34
34
  constructor(element) {
35
35
  var _a2;
36
36
  super(element);
@@ -59,10 +59,13 @@ function withVue2(BaseClass, VueCtor) {
59
59
  this.$vue.$destroy();
60
60
  });
61
61
  }
62
- }, __publicField(_c, "config", {
62
+ }
63
+ __publicField(WithVue2, "config", {
63
64
  ...BaseClass.config,
64
65
  name: `${BaseClass.config.name}WithVue`,
65
66
  refs: [...(_b = (_a = BaseClass.config) == null ? void 0 : _a.refs) != null ? _b : [], "vue"]
66
- }), __publicField(_c, "vueConfig"), _c;
67
+ });
68
+ __publicField(WithVue2, "vueConfig");
69
+ return WithVue2;
67
70
  }
68
71
  if (module.exports.default) module.exports = module.exports.default;
@@ -1,6 +1,6 @@
1
1
  import type Vue from 'vue';
2
2
  import type { ComponentOptions, VueConstructor } from 'vue';
3
- import type { BaseConstructor, BaseTypeParameter } from '../Base/index.js';
3
+ import type { Base, BaseConstructor, BaseTypeParameter } from '../Base/index.js';
4
4
  interface WithVue2Interface {
5
5
  $refs: {
6
6
  vue: HTMLElement;
@@ -9,29 +9,29 @@ interface WithVue2Interface {
9
9
  /**
10
10
  * withVue decorator.
11
11
  */
12
- export default function withVue2<T extends BaseTypeParameter = BaseTypeParameter, VueTypeParameter extends Vue = Vue>(BaseClass: BaseConstructor, VueCtor: VueConstructor): {
13
- new <U extends BaseTypeParameter = BaseTypeParameter>(element: HTMLElement): {
12
+ export default function withVue2<S extends BaseConstructor<Base>, T extends BaseTypeParameter = BaseTypeParameter, VueTypeParameter extends Vue = Vue>(BaseClass: S, VueCtor: VueConstructor): {
13
+ new (...args: any[]): {
14
14
  $vue: Vue;
15
- $parent: import("../Base/index.js").default<BaseTypeParameter>;
15
+ $parent: Base<BaseTypeParameter>;
16
16
  $id: string;
17
- $el: (WithVue2Interface & T & U)["$el"] & HTMLElement & {
18
- __base__?: WeakMap<typeof import("../Base/index.js").default, import("../Base/index.js").default<BaseTypeParameter> | "terminated">;
17
+ $el: HTMLElement & {
18
+ __base__?: WeakMap<BaseConstructor<Base<BaseTypeParameter>>, Base<BaseTypeParameter> | "terminated">;
19
19
  };
20
20
  $isMounted: boolean;
21
21
  __eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
22
- readonly $root: import("../Base/index.js").default<BaseTypeParameter>;
22
+ readonly $root: Base<BaseTypeParameter>;
23
23
  readonly __config: import("../Base/index.js").BaseConfig;
24
24
  __services: import("../Base/managers/ServicesManager.js").default;
25
25
  readonly $services: import("../Base/managers/ServicesManager.js").default;
26
- __refs: import("../Base/managers/RefsManager.js").default & (WithVue2Interface & T & U)["$refs"] & import("../Base/index.js").BaseRefs;
27
- readonly $refs: import("../Base/managers/RefsManager.js").default & (WithVue2Interface & T & U)["$refs"] & import("../Base/index.js").BaseRefs;
28
- __options: import("../Base/managers/OptionsManager.js").default & (WithVue2Interface & T & U)["$options"] & import("../Base/index.js").BaseOptions;
29
- readonly $options: import("../Base/managers/OptionsManager.js").default & (WithVue2Interface & T & U)["$options"] & import("../Base/index.js").BaseOptions;
30
- __children: import("../Base/managers/ChildrenManager.js").default & ((WithVue2Interface & T & U)["$children"] extends infer T_1 ? { [key in keyof T_1]: (WithVue2Interface & T & U)["$children"][key][]; } : never) & import("../Base/index.js").BaseChildren;
31
- readonly $children: import("../Base/managers/ChildrenManager.js").default & ((WithVue2Interface & T & U)["$children"] extends infer T_2 ? { [key_1 in keyof T_2]: (WithVue2Interface & T & U)["$children"][key_1][]; } : never) & import("../Base/index.js").BaseChildren;
26
+ __refs: import("../Base/managers/RefsManager.js").default & import("../Base/index.js").BaseRefs;
27
+ readonly $refs: import("../Base/managers/RefsManager.js").default & import("../Base/index.js").BaseRefs;
28
+ __options: import("../Base/managers/OptionsManager.js").default & import("../Base/index.js").BaseOptions;
29
+ readonly $options: import("../Base/managers/OptionsManager.js").default & import("../Base/index.js").BaseOptions;
30
+ __children: import("../Base/managers/ChildrenManager.js").default & import("../Base/index.js").BaseChildren;
31
+ readonly $children: import("../Base/managers/ChildrenManager.js").default & import("../Base/index.js").BaseChildren;
32
32
  __events: import("../Base/managers/EventsManager.js").default;
33
- readonly $log: (...args: any) => void;
34
- readonly __debug: (...args: any) => void;
33
+ readonly $log: (...args: unknown[]) => void;
34
+ readonly __debug: (...args: unknown[]) => void;
35
35
  readonly __managers: import("../Base/index.js").Managers;
36
36
  __callMethod(method: string, ...args: unknown[]): unknown;
37
37
  __hasEvent(event: string): boolean;
@@ -41,7 +41,48 @@ export default function withVue2<T extends BaseTypeParameter = BaseTypeParameter
41
41
  $terminate(): void;
42
42
  __addEmits(event: string): void;
43
43
  __removeEmits(event: string): void;
44
- readonly __ctor: typeof import("../Base/index.js").default;
44
+ readonly __ctor: BaseConstructor<Base<BaseTypeParameter>>;
45
+ $on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
46
+ $off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
47
+ $emit(event: string, ...args: unknown[]): void;
48
+ addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
49
+ dispatchEvent(event: Event): boolean;
50
+ removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
51
+ };
52
+ prototype: Base<BaseTypeParameter>;
53
+ } & Pick<typeof Base, "prototype" | "$isBase" | "config" | "$factory"> & Pick<{
54
+ new (element: HTMLElement): {
55
+ $vue: Vue;
56
+ $parent: Base<BaseTypeParameter>;
57
+ $id: string;
58
+ $el: HTMLElement & {
59
+ __base__?: WeakMap<BaseConstructor<Base<BaseTypeParameter>>, Base<BaseTypeParameter> | "terminated">;
60
+ };
61
+ $isMounted: boolean;
62
+ __eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
63
+ readonly $root: Base<BaseTypeParameter>;
64
+ readonly __config: import("../Base/index.js").BaseConfig;
65
+ __services: import("../Base/managers/ServicesManager.js").default;
66
+ readonly $services: import("../Base/managers/ServicesManager.js").default;
67
+ __refs: import("../Base/managers/RefsManager.js").default & import("../Base/index.js").BaseRefs;
68
+ readonly $refs: import("../Base/managers/RefsManager.js").default & import("../Base/index.js").BaseRefs;
69
+ __options: import("../Base/managers/OptionsManager.js").default & import("../Base/index.js").BaseOptions;
70
+ readonly $options: import("../Base/managers/OptionsManager.js").default & import("../Base/index.js").BaseOptions;
71
+ __children: import("../Base/managers/ChildrenManager.js").default & import("../Base/index.js").BaseChildren;
72
+ readonly $children: import("../Base/managers/ChildrenManager.js").default & import("../Base/index.js").BaseChildren;
73
+ __events: import("../Base/managers/EventsManager.js").default;
74
+ readonly $log: (...args: unknown[]) => void;
75
+ readonly __debug: (...args: unknown[]) => void;
76
+ readonly __managers: import("../Base/index.js").Managers;
77
+ __callMethod(method: string, ...args: unknown[]): unknown;
78
+ __hasEvent(event: string): boolean;
79
+ $mount(): any;
80
+ $update(): any;
81
+ $destroy(): any;
82
+ $terminate(): void;
83
+ __addEmits(event: string): void;
84
+ __removeEmits(event: string): void;
85
+ readonly __ctor: BaseConstructor<Base<BaseTypeParameter>>;
45
86
  $on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
46
87
  $off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
47
88
  $emit(event: string, ...args: unknown[]): void;
@@ -65,6 +106,9 @@ export default function withVue2<T extends BaseTypeParameter = BaseTypeParameter
65
106
  render: ComponentOptions<VueTypeParameter>['render'];
66
107
  };
67
108
  readonly $isBase: true;
68
- $factory(nameOrSelector: string): import("../Base/index.js").default<BaseTypeParameter>[];
109
+ $factory: typeof Base.$factory;
110
+ } & S, "prototype" | "$isBase" | "config" | "$factory" | "vueConfig" | keyof S> & S & {
111
+ new (...args: any[]): Base<T & WithVue2Interface>;
112
+ prototype: Base<BaseTypeParameter>;
69
113
  };
70
114
  export {};
@@ -6,8 +6,8 @@ var __publicField = (obj, key, value) => {
6
6
  };
7
7
  import { isDev, isFunction } from "../utils/index.js";
8
8
  function withVue2(BaseClass, VueCtor) {
9
- var _a, _b, _c;
10
- return _c = class extends BaseClass {
9
+ var _a, _b;
10
+ class WithVue2 extends BaseClass {
11
11
  constructor(element) {
12
12
  var _a2;
13
13
  super(element);
@@ -36,11 +36,14 @@ function withVue2(BaseClass, VueCtor) {
36
36
  this.$vue.$destroy();
37
37
  });
38
38
  }
39
- }, __publicField(_c, "config", {
39
+ }
40
+ __publicField(WithVue2, "config", {
40
41
  ...BaseClass.config,
41
42
  name: `${BaseClass.config.name}WithVue`,
42
43
  refs: [...(_b = (_a = BaseClass.config) == null ? void 0 : _a.refs) != null ? _b : [], "vue"]
43
- }), __publicField(_c, "vueConfig"), _c;
44
+ });
45
+ __publicField(WithVue2, "vueConfig");
46
+ return WithVue2;
44
47
  }
45
48
  export {
46
49
  withVue2 as default
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
18
 
19
- // packages/js-toolkit/helpers/createApp.js
19
+ // packages/js-toolkit/helpers/createApp.ts
20
20
  var createApp_exports = {};
21
21
  __export(createApp_exports, {
22
22
  default: () => createApp
@@ -1,14 +1,6 @@
1
- /**
2
- * @typedef {import('../Base/index.js').BaseConstructor} BaseConstructor
3
- */
1
+ import type { Base, BaseConstructor, BaseTypeParameter } from '../Base/index.js';
4
2
  /**
5
3
  * Instantiate and mount the given component on the given root element when the page has been loaded
6
4
  * and return a function to use the app instance when it is ready.
7
- *
8
- * @template {BaseConstructor} T
9
- * @param {T} App
10
- * @param {HTMLElement} [rootElement]
11
- * @returns {() => Promise<InstanceType<T>>}
12
5
  */
13
- export default function createApp<T extends typeof import("../Base/index.js").default>(App: T, rootElement?: HTMLElement): () => Promise<InstanceType<T>>;
14
- export type BaseConstructor = import('../Base/index.js').BaseConstructor;
6
+ export default function createApp<S extends BaseConstructor<Base>, T extends BaseTypeParameter = BaseTypeParameter>(App: S, rootElement?: HTMLElement): () => Promise<S & Base<T>>;