@studiometa/js-toolkit 2.4.2 → 2.4.4-alpha.1
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.
- package/Base/index.d.ts +90 -49
- package/Base/managers/AbstractManager.d.ts +3 -3
- package/Base/managers/ChildrenManager.d.ts +1 -1
- package/Base/managers/EventsManager.d.ts +3 -3
- package/Base/managers/OptionsManager.d.ts +1 -1
- package/Base/managers/ResponsiveOptionsManager.cjs +1 -1
- package/Base/managers/ResponsiveOptionsManager.d.ts +3 -7
- package/Base/managers/ServicesManager.d.ts +6 -6
- package/Base/utils.d.ts +2 -2
- package/decorators/index.cjs +1 -1
- package/decorators/index.d.ts +10 -10
- package/decorators/withBreakpointManager.cjs +2 -3
- package/decorators/withBreakpointManager.d.ts +84 -7
- package/decorators/withBreakpointManager.js +1 -2
- package/decorators/withBreakpointObserver.cjs +2 -2
- package/decorators/withBreakpointObserver.d.ts +89 -13
- package/decorators/withBreakpointObserver.js +1 -1
- package/decorators/withDrag.cjs +1 -1
- package/decorators/withDrag.d.ts +81 -18
- package/decorators/withExtraConfig.cjs +1 -1
- package/decorators/withExtraConfig.d.ts +77 -10
- package/decorators/withFreezedOptions.cjs +9 -7
- package/decorators/withFreezedOptions.d.ts +81 -11
- package/decorators/withFreezedOptions.js +8 -6
- package/decorators/withIntersectionObserver.cjs +2 -1
- package/decorators/withIntersectionObserver.d.ts +91 -17
- package/decorators/withIntersectionObserver.js +1 -0
- package/decorators/withMountWhenInView.cjs +1 -1
- package/decorators/withMountWhenInView.d.ts +91 -29
- package/decorators/withResponsiveOptions.cjs +2 -2
- package/decorators/withResponsiveOptions.d.ts +78 -5
- package/decorators/withResponsiveOptions.js +1 -1
- package/decorators/withScrolledInView.cjs +13 -7
- package/decorators/withScrolledInView.d.ts +173 -15
- package/decorators/withScrolledInView.js +12 -6
- package/decorators/withVue2.cjs +5 -5
- package/decorators/withVue2.d.ts +97 -6
- package/decorators/withVue2.js +4 -4
- package/helpers/getDirectChildren.d.ts +11 -4
- package/helpers/importOnInteraction.d.ts +2 -2
- package/helpers/importWhenVisible.d.ts +2 -2
- package/index.cjs +1 -1
- package/index.d.ts +5 -4
- package/package.json +1 -1
- package/services/drag.d.ts +1 -1
- package/services/index.cjs +1 -1
- package/services/index.d.ts +33 -25
- package/services/key.d.ts +1 -1
- package/services/load.d.ts +1 -1
- package/services/pointer.d.ts +1 -1
- package/services/raf.d.ts +1 -1
- package/services/resize.d.ts +1 -1
- package/services/scroll.d.ts +1 -1
|
@@ -21,7 +21,7 @@ var __publicField = (obj, key, value) => {
|
|
|
21
21
|
return value;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
// packages/js-toolkit/decorators/withMountWhenInView.
|
|
24
|
+
// packages/js-toolkit/decorators/withMountWhenInView.ts
|
|
25
25
|
var withMountWhenInView_exports = {};
|
|
26
26
|
__export(withMountWhenInView_exports, {
|
|
27
27
|
default: () => withMountWhenInView
|
|
@@ -1,33 +1,95 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* @property {IntersectionObserverInit} intersectionObserver
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* @typedef {Object} WithMountWhenInViewInterface
|
|
12
|
-
* @property {() => void} terminated
|
|
13
|
-
* @property {WithMountWhenInViewOptions & BaseOptions} $options
|
|
14
|
-
*/
|
|
1
|
+
import type { BaseTypeParameter, BaseConfig } from '../Base/index.js';
|
|
2
|
+
import Base from '../Base/index.js';
|
|
3
|
+
declare type WithMountWhenInViewInterface = {
|
|
4
|
+
$options: {
|
|
5
|
+
intersectionObserver: IntersectionObserverInit;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
15
8
|
/**
|
|
16
9
|
* IntersectionObserver decoration.
|
|
17
|
-
*
|
|
18
|
-
* @template {BaseConstructor} T
|
|
19
|
-
* @param {T} BaseClass The Base class to extend.
|
|
20
|
-
* @param {IntersectionObserverInit} [defaultOptions] The options for the IntersectionObserver instance.
|
|
21
|
-
* @returns {T}
|
|
22
10
|
*/
|
|
23
|
-
export default function withMountWhenInView<T extends
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
11
|
+
export default function withMountWhenInView<T extends BaseTypeParameter = BaseTypeParameter>(BaseClass: typeof Base, defaultOptions?: IntersectionObserverInit): {
|
|
12
|
+
new <U extends BaseTypeParameter = BaseTypeParameter>(element: HTMLElement): {
|
|
13
|
+
/**
|
|
14
|
+
* Is the component visible?
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
__isVisible: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The component's observer.
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
__observer: IntersectionObserver;
|
|
23
|
+
/**
|
|
24
|
+
* Override the mounting of the component.
|
|
25
|
+
*/
|
|
26
|
+
$mount(): any;
|
|
27
|
+
$parent: Base<{
|
|
28
|
+
$el: HTMLElement;
|
|
29
|
+
$options: import("../Base/index.js").BaseOptions;
|
|
30
|
+
$refs: import("../Base/index.js").BaseRefs;
|
|
31
|
+
$children: {
|
|
32
|
+
[name: string]: Base<any> | Promise<Base<any>>;
|
|
33
|
+
};
|
|
34
|
+
}>;
|
|
35
|
+
$id: string;
|
|
36
|
+
$el: (WithMountWhenInViewInterface & T & U)["$el"] & HTMLElement & {
|
|
37
|
+
__base__?: WeakMap<typeof Base, Base<{
|
|
38
|
+
$el: HTMLElement;
|
|
39
|
+
$options: import("../Base/index.js").BaseOptions;
|
|
40
|
+
$refs: import("../Base/index.js").BaseRefs;
|
|
41
|
+
$children: {
|
|
42
|
+
[name: string]: Base<any> | Promise<Base<any>>;
|
|
43
|
+
};
|
|
44
|
+
}> | "terminated">;
|
|
45
|
+
};
|
|
46
|
+
$isMounted: boolean;
|
|
47
|
+
__eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
|
|
48
|
+
readonly $root: Base<{
|
|
49
|
+
$el: HTMLElement;
|
|
50
|
+
$options: import("../Base/index.js").BaseOptions;
|
|
51
|
+
$refs: import("../Base/index.js").BaseRefs;
|
|
52
|
+
$children: {
|
|
53
|
+
[name: string]: Base<any> | Promise<Base<any>>;
|
|
54
|
+
};
|
|
55
|
+
}>;
|
|
56
|
+
readonly __config: BaseConfig;
|
|
57
|
+
__services: import("../Base/managers/ServicesManager.js").default;
|
|
58
|
+
readonly $services: import("../Base/managers/ServicesManager.js").default;
|
|
59
|
+
__refs: import("../Base/managers/RefsManager.js").default & (WithMountWhenInViewInterface & T & U)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
60
|
+
readonly $refs: import("../Base/managers/RefsManager.js").default & (WithMountWhenInViewInterface & T & U)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
61
|
+
__options: import("../Base/managers/OptionsManager.js").default & (WithMountWhenInViewInterface & T & U)["$options"] & import("../Base/index.js").BaseOptions;
|
|
62
|
+
readonly $options: import("../Base/managers/OptionsManager.js").default & (WithMountWhenInViewInterface & T & U)["$options"] & import("../Base/index.js").BaseOptions;
|
|
63
|
+
__children: import("../Base/managers/ChildrenManager.js").default & ((WithMountWhenInViewInterface & T & U)["$children"] extends infer T_1 ? { [key in keyof T_1]: (WithMountWhenInViewInterface & T & U)["$children"][key][]; } : never) & import("../Base/index.js").BaseChildren;
|
|
64
|
+
readonly $children: import("../Base/managers/ChildrenManager.js").default & ((WithMountWhenInViewInterface & T & U)["$children"] extends infer T_2 ? { [key_1 in keyof T_2]: (WithMountWhenInViewInterface & T & U)["$children"][key_1][]; } : never) & import("../Base/index.js").BaseChildren;
|
|
65
|
+
__events: import("../Base/managers/EventsManager.js").default;
|
|
66
|
+
readonly $log: (...args: any) => void;
|
|
67
|
+
readonly __debug: (...args: any) => void;
|
|
68
|
+
readonly __managers: import("../Base/index.js").Managers;
|
|
69
|
+
__callMethod(method: string, ...args: any[]): any;
|
|
70
|
+
__hasEvent(event: string): boolean;
|
|
71
|
+
$update(): any;
|
|
72
|
+
$destroy(): any;
|
|
73
|
+
$terminate(): void;
|
|
74
|
+
__addEmits(event: string): void;
|
|
75
|
+
__removeEmits(event: string): void;
|
|
76
|
+
readonly __ctor: typeof Base;
|
|
77
|
+
$on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
78
|
+
$off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
79
|
+
$emit(event: string, ...args: any[]): void;
|
|
80
|
+
addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
81
|
+
dispatchEvent(event: Event): boolean;
|
|
82
|
+
removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
83
|
+
};
|
|
84
|
+
config: BaseConfig;
|
|
85
|
+
readonly $isBase: boolean;
|
|
86
|
+
$factory(nameOrSelector: string): Base<{
|
|
87
|
+
$el: HTMLElement;
|
|
88
|
+
$options: import("../Base/index.js").BaseOptions;
|
|
89
|
+
$refs: import("../Base/index.js").BaseRefs;
|
|
90
|
+
$children: {
|
|
91
|
+
[name: string]: Base<any> | Promise<Base<any>>;
|
|
92
|
+
};
|
|
93
|
+
}>[];
|
|
33
94
|
};
|
|
95
|
+
export {};
|
|
@@ -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.
|
|
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,8 +1,81 @@
|
|
|
1
|
+
import type { BaseTypeParameter, BaseConstructor, Managers } from '../Base/index.js';
|
|
2
|
+
import ResponsiveOptionsManager from '../Base/managers/ResponsiveOptionsManager.js';
|
|
1
3
|
/**
|
|
2
4
|
* Extends the configuration of an existing class.
|
|
3
|
-
*
|
|
4
|
-
* @template {import('../Base').BaseConstructor} T
|
|
5
|
-
* @param {T} BaseClass The Base class to extend.
|
|
6
|
-
* @returns {T}
|
|
7
5
|
*/
|
|
8
|
-
export default function withResponsiveOptions<T extends
|
|
6
|
+
export default function withResponsiveOptions<T extends BaseTypeParameter = BaseTypeParameter>(BaseClass: BaseConstructor): {
|
|
7
|
+
new <U extends BaseTypeParameters = BaseTypeParameter>(element: HTMLElement): {
|
|
8
|
+
/**
|
|
9
|
+
* Get managers.
|
|
10
|
+
*/
|
|
11
|
+
readonly __managers: Managers & {
|
|
12
|
+
OptionsManager: typeof ResponsiveOptionsManager;
|
|
13
|
+
};
|
|
14
|
+
$parent: import("../Base/index.js").default<{
|
|
15
|
+
$el: HTMLElement;
|
|
16
|
+
$options: import("../Base/index.js").BaseOptions;
|
|
17
|
+
$refs: import("../Base/index.js").BaseRefs;
|
|
18
|
+
$children: {
|
|
19
|
+
[name: string]: import("../Base/index.js").default<any> | Promise<import("../Base/index.js").default<any>>;
|
|
20
|
+
};
|
|
21
|
+
}>;
|
|
22
|
+
$id: string;
|
|
23
|
+
$el: (U & T)["$el"] & HTMLElement & {
|
|
24
|
+
__base__?: WeakMap<typeof import("../Base/index.js").default, import("../Base/index.js").default<{
|
|
25
|
+
$el: HTMLElement;
|
|
26
|
+
$options: import("../Base/index.js").BaseOptions;
|
|
27
|
+
$refs: import("../Base/index.js").BaseRefs;
|
|
28
|
+
$children: {
|
|
29
|
+
[name: string]: import("../Base/index.js").default<any> | Promise<import("../Base/index.js").default<any>>;
|
|
30
|
+
};
|
|
31
|
+
}> | "terminated">;
|
|
32
|
+
};
|
|
33
|
+
$isMounted: boolean;
|
|
34
|
+
__eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
|
|
35
|
+
readonly $root: import("../Base/index.js").default<{
|
|
36
|
+
$el: HTMLElement;
|
|
37
|
+
$options: import("../Base/index.js").BaseOptions;
|
|
38
|
+
$refs: import("../Base/index.js").BaseRefs;
|
|
39
|
+
$children: {
|
|
40
|
+
[name: string]: import("../Base/index.js").default<any> | Promise<import("../Base/index.js").default<any>>;
|
|
41
|
+
};
|
|
42
|
+
}>;
|
|
43
|
+
readonly __config: import("../Base/index.js").BaseConfig;
|
|
44
|
+
__services: import("../Base/managers/ServicesManager.js").default;
|
|
45
|
+
readonly $services: import("../Base/managers/ServicesManager.js").default;
|
|
46
|
+
__refs: import("../Base/managers/RefsManager.js").default & (U & T)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
47
|
+
readonly $refs: import("../Base/managers/RefsManager.js").default & (U & T)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
48
|
+
__options: import("../Base/managers/OptionsManager.js").default & (U & T)["$options"] & import("../Base/index.js").BaseOptions;
|
|
49
|
+
readonly $options: import("../Base/managers/OptionsManager.js").default & (U & T)["$options"] & import("../Base/index.js").BaseOptions;
|
|
50
|
+
__children: import("../Base/managers/ChildrenManager.js").default & ((U & T)["$children"] extends infer T_1 ? { [key in keyof T_1]: (U & T)["$children"][key][]; } : never) & import("../Base/index.js").BaseChildren;
|
|
51
|
+
readonly $children: import("../Base/managers/ChildrenManager.js").default & ((U & T)["$children"] extends infer T_2 ? { [key_1 in keyof T_2]: (U & T)["$children"][key_1][]; } : never) & import("../Base/index.js").BaseChildren;
|
|
52
|
+
__events: import("../Base/managers/EventsManager.js").default;
|
|
53
|
+
readonly $log: (...args: any) => void;
|
|
54
|
+
readonly __debug: (...args: any) => void;
|
|
55
|
+
__callMethod(method: string, ...args: any[]): any;
|
|
56
|
+
__hasEvent(event: string): boolean;
|
|
57
|
+
$mount(): any;
|
|
58
|
+
$update(): any;
|
|
59
|
+
$destroy(): any;
|
|
60
|
+
$terminate(): void;
|
|
61
|
+
__addEmits(event: string): void;
|
|
62
|
+
__removeEmits(event: string): void;
|
|
63
|
+
readonly __ctor: typeof import("../Base/index.js").default;
|
|
64
|
+
$on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
65
|
+
$off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
66
|
+
$emit(event: string, ...args: any[]): void;
|
|
67
|
+
addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
68
|
+
dispatchEvent(event: Event): boolean;
|
|
69
|
+
removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
70
|
+
};
|
|
71
|
+
readonly $isBase: boolean;
|
|
72
|
+
config: import("../Base/index.js").BaseConfig;
|
|
73
|
+
$factory(nameOrSelector: string): import("../Base/index.js").default<{
|
|
74
|
+
$el: HTMLElement;
|
|
75
|
+
$options: import("../Base/index.js").BaseOptions;
|
|
76
|
+
$refs: import("../Base/index.js").BaseRefs;
|
|
77
|
+
$children: {
|
|
78
|
+
[name: string]: import("../Base/index.js").default<any> | Promise<import("../Base/index.js").default<any>>;
|
|
79
|
+
};
|
|
80
|
+
}>[];
|
|
81
|
+
};
|
|
@@ -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.
|
|
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
|
-
|
|
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();
|
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* @template {BaseConstructor} T
|
|
5
|
-
* @param {T} BaseClass
|
|
6
|
-
* @param {IntersectionObserverInit & { useOffsetSizes?: boolean }} options
|
|
7
|
-
* @returns {T}
|
|
8
|
-
*/
|
|
9
|
-
export default function withScrolledInView<T extends typeof import("../Base").default>(BaseClass: T, options?: IntersectionObserverInit & {
|
|
10
|
-
useOffsetSizes?: boolean;
|
|
11
|
-
}): T;
|
|
12
|
-
export type Base = import("../Base").default<any>;
|
|
13
|
-
export type BaseConstructor = import('../Base').BaseConstructor;
|
|
14
|
-
export type BaseConfig = import('../Base').BaseConfig;
|
|
15
|
-
export type ScrollInViewProps = {
|
|
1
|
+
import type { BaseTypeParameter, BaseConstructor, BaseConfig } from '../Base/index.js';
|
|
2
|
+
declare type ScrollInViewProps = {
|
|
16
3
|
start: {
|
|
17
4
|
x: number;
|
|
18
5
|
y: number;
|
|
@@ -38,3 +25,174 @@ export type ScrollInViewProps = {
|
|
|
38
25
|
y: number;
|
|
39
26
|
};
|
|
40
27
|
};
|
|
28
|
+
declare type withScrolledInViewOptions = IntersectionObserverInit & {
|
|
29
|
+
useOffsetSizes?: boolean;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Add scrolled in view capabilities to a component.
|
|
33
|
+
*/
|
|
34
|
+
export default function withScrolledInView<T extends BaseTypeParameter = BaseTypeParameter>(BaseClass: BaseConstructor, options?: withScrolledInViewOptions): {
|
|
35
|
+
new <U extends BaseTypeParameter = BaseTypeParameter>(element: any): {
|
|
36
|
+
__props: ScrollInViewProps;
|
|
37
|
+
/**
|
|
38
|
+
* Factor used for the `dampedProgress` props.
|
|
39
|
+
*/
|
|
40
|
+
dampFactor: number;
|
|
41
|
+
/**
|
|
42
|
+
* Precision for the `dampedProgress` props.
|
|
43
|
+
*/
|
|
44
|
+
dampPrecision: number;
|
|
45
|
+
/**
|
|
46
|
+
* Mounted hook.
|
|
47
|
+
*
|
|
48
|
+
* @returns {void}
|
|
49
|
+
*/
|
|
50
|
+
mounted(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Resized hook.
|
|
53
|
+
*
|
|
54
|
+
* @param {import('../services/resize').ResizeServiceProps} props
|
|
55
|
+
* @returns {void}
|
|
56
|
+
*/
|
|
57
|
+
resized(props: any): void;
|
|
58
|
+
/**
|
|
59
|
+
* Scrolled hook.
|
|
60
|
+
*
|
|
61
|
+
* @param {import('../services/scroll').ScrollServiceProps} props
|
|
62
|
+
* @returns {void}
|
|
63
|
+
*/
|
|
64
|
+
scrolled(props: any): void;
|
|
65
|
+
/**
|
|
66
|
+
* Ticked hook.
|
|
67
|
+
*
|
|
68
|
+
* @param {import('../services/raf').RafServiceProps} props
|
|
69
|
+
* @returns {void}
|
|
70
|
+
*/
|
|
71
|
+
ticked(props: any): void;
|
|
72
|
+
/**
|
|
73
|
+
* Destroyed hook.
|
|
74
|
+
*
|
|
75
|
+
* @returns {void}
|
|
76
|
+
*/
|
|
77
|
+
destroyed(): void;
|
|
78
|
+
/**
|
|
79
|
+
* Set the decorator props.
|
|
80
|
+
*
|
|
81
|
+
* @returns {void}
|
|
82
|
+
*/
|
|
83
|
+
__setProps(): void;
|
|
84
|
+
__isVisible: boolean;
|
|
85
|
+
__observer: IntersectionObserver;
|
|
86
|
+
$mount(): any;
|
|
87
|
+
$parent: import("../Base/index.js").default<{
|
|
88
|
+
$el: HTMLElement;
|
|
89
|
+
$options: import("../Base/index.js").BaseOptions;
|
|
90
|
+
$refs: import("../Base/index.js").BaseRefs;
|
|
91
|
+
$children: {
|
|
92
|
+
[name: string]: import("../Base/index.js").default<any> | Promise<import("../Base/index.js").default<any>>;
|
|
93
|
+
};
|
|
94
|
+
}>;
|
|
95
|
+
$id: string;
|
|
96
|
+
$el: ({
|
|
97
|
+
$options: {
|
|
98
|
+
intersectionObserver: IntersectionObserverInit;
|
|
99
|
+
};
|
|
100
|
+
} & T & U)["$el"] & HTMLElement & {
|
|
101
|
+
__base__?: WeakMap<typeof import("../Base/index.js").default, import("../Base/index.js").default<{
|
|
102
|
+
$el: HTMLElement;
|
|
103
|
+
$options: import("../Base/index.js").BaseOptions;
|
|
104
|
+
$refs: import("../Base/index.js").BaseRefs;
|
|
105
|
+
$children: {
|
|
106
|
+
[name: string]: import("../Base/index.js").default<any> | Promise<import("../Base/index.js").default<any>>;
|
|
107
|
+
};
|
|
108
|
+
}> | "terminated">;
|
|
109
|
+
};
|
|
110
|
+
$isMounted: boolean;
|
|
111
|
+
__eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
|
|
112
|
+
readonly $root: import("../Base/index.js").default<{
|
|
113
|
+
$el: HTMLElement;
|
|
114
|
+
$options: import("../Base/index.js").BaseOptions;
|
|
115
|
+
$refs: import("../Base/index.js").BaseRefs;
|
|
116
|
+
$children: {
|
|
117
|
+
[name: string]: import("../Base/index.js").default<any> | Promise<import("../Base/index.js").default<any>>;
|
|
118
|
+
};
|
|
119
|
+
}>;
|
|
120
|
+
readonly __config: BaseConfig;
|
|
121
|
+
__services: import("../Base/managers/ServicesManager.js").default;
|
|
122
|
+
readonly $services: import("../Base/managers/ServicesManager.js").default;
|
|
123
|
+
__refs: import("../Base/managers/RefsManager.js").default & ({
|
|
124
|
+
$options: {
|
|
125
|
+
intersectionObserver: IntersectionObserverInit;
|
|
126
|
+
};
|
|
127
|
+
} & T & U)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
128
|
+
readonly $refs: import("../Base/managers/RefsManager.js").default & ({
|
|
129
|
+
$options: {
|
|
130
|
+
intersectionObserver: IntersectionObserverInit;
|
|
131
|
+
};
|
|
132
|
+
} & T & U)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
133
|
+
__options: import("../Base/managers/OptionsManager.js").default & ({
|
|
134
|
+
$options: {
|
|
135
|
+
intersectionObserver: IntersectionObserverInit;
|
|
136
|
+
};
|
|
137
|
+
} & T & U)["$options"] & import("../Base/index.js").BaseOptions;
|
|
138
|
+
readonly $options: import("../Base/managers/OptionsManager.js").default & ({
|
|
139
|
+
$options: {
|
|
140
|
+
intersectionObserver: IntersectionObserverInit;
|
|
141
|
+
};
|
|
142
|
+
} & T & U)["$options"] & import("../Base/index.js").BaseOptions; /**
|
|
143
|
+
* Set the decorator props.
|
|
144
|
+
*
|
|
145
|
+
* @returns {void}
|
|
146
|
+
*/
|
|
147
|
+
__children: import("../Base/managers/ChildrenManager.js").default & (({
|
|
148
|
+
$options: {
|
|
149
|
+
intersectionObserver: IntersectionObserverInit;
|
|
150
|
+
};
|
|
151
|
+
} & T & U)["$children"] extends infer T_1 ? { [key in keyof T_1]: ({
|
|
152
|
+
$options: {
|
|
153
|
+
intersectionObserver: IntersectionObserverInit;
|
|
154
|
+
};
|
|
155
|
+
} & T & U)["$children"][key][]; } : never) & import("../Base/index.js").BaseChildren;
|
|
156
|
+
readonly $children: import("../Base/managers/ChildrenManager.js").default & (({
|
|
157
|
+
$options: {
|
|
158
|
+
intersectionObserver: IntersectionObserverInit;
|
|
159
|
+
};
|
|
160
|
+
} & T & U)["$children"] extends infer T_2 ? { [key_1 in keyof T_2]: ({
|
|
161
|
+
$options: {
|
|
162
|
+
intersectionObserver: IntersectionObserverInit;
|
|
163
|
+
};
|
|
164
|
+
} & T & U)["$children"][key_1][]; } : never) & import("../Base/index.js").BaseChildren;
|
|
165
|
+
__events: import("../Base/managers/EventsManager.js").default;
|
|
166
|
+
readonly $log: (...args: any) => void;
|
|
167
|
+
readonly __debug: (...args: any) => void;
|
|
168
|
+
readonly __managers: import("../Base/index.js").Managers;
|
|
169
|
+
__callMethod(method: string, ...args: any[]): any;
|
|
170
|
+
__hasEvent(event: string): boolean;
|
|
171
|
+
$update(): any;
|
|
172
|
+
$destroy(): any;
|
|
173
|
+
$terminate(): void;
|
|
174
|
+
__addEmits(event: string): void;
|
|
175
|
+
__removeEmits(event: string): void;
|
|
176
|
+
readonly __ctor: typeof import("../Base/index.js").default;
|
|
177
|
+
$on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
178
|
+
$off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
179
|
+
$emit(event: string, ...args: any[]): void;
|
|
180
|
+
addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
181
|
+
dispatchEvent(event: Event): boolean;
|
|
182
|
+
removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Config.
|
|
186
|
+
*/
|
|
187
|
+
config: BaseConfig;
|
|
188
|
+
readonly $isBase: boolean;
|
|
189
|
+
$factory(nameOrSelector: string): import("../Base/index.js").default<{
|
|
190
|
+
$el: HTMLElement;
|
|
191
|
+
$options: import("../Base/index.js").BaseOptions;
|
|
192
|
+
$refs: import("../Base/index.js").BaseRefs;
|
|
193
|
+
$children: {
|
|
194
|
+
[name: string]: import("../Base/index.js").default<any> | Promise<import("../Base/index.js").default<any>>;
|
|
195
|
+
};
|
|
196
|
+
}>[];
|
|
197
|
+
};
|
|
198
|
+
export {};
|
|
@@ -28,7 +28,8 @@ function updateProps(props, dampFactor, dampPrecision, axis = "x") {
|
|
|
28
28
|
}
|
|
29
29
|
function withScrolledInView(BaseClass, options = {}) {
|
|
30
30
|
var _a;
|
|
31
|
-
|
|
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();
|
package/decorators/withVue2.cjs
CHANGED
|
@@ -21,14 +21,14 @@ var __publicField = (obj, key, value) => {
|
|
|
21
21
|
return value;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
// packages/js-toolkit/decorators/withVue2.
|
|
24
|
+
// packages/js-toolkit/decorators/withVue2.ts
|
|
25
25
|
var withVue2_exports = {};
|
|
26
26
|
__export(withVue2_exports, {
|
|
27
|
-
default: () =>
|
|
27
|
+
default: () => withVue2
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(withVue2_exports);
|
|
30
30
|
var import_utils = require("../utils/index.cjs");
|
|
31
|
-
|
|
31
|
+
function withVue2(BaseClass, VueCtor) {
|
|
32
32
|
var _a, _b, _c;
|
|
33
33
|
return _c = class extends BaseClass {
|
|
34
34
|
constructor(element) {
|
|
@@ -48,7 +48,7 @@ var withVue2_default = (BaseClass, Vue) => {
|
|
|
48
48
|
}
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
|
-
this.$vue = new
|
|
51
|
+
this.$vue = new VueCtor(vueConfig);
|
|
52
52
|
this.$on("mounted", () => {
|
|
53
53
|
if (!(this.$refs.vue instanceof HTMLElement)) {
|
|
54
54
|
throw new Error("[withVue] The `vue` refs must be a single HTMLElement.");
|
|
@@ -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;
|