@studiometa/js-toolkit 2.4.4-alpha.3 → 2.4.4-alpha.6
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.cjs +1 -1
- package/Base/index.d.ts +16 -18
- package/Base/index.js +1 -1
- package/Base/managers/AbstractManager.d.ts +2 -2
- package/Base/managers/ChildrenManager.cjs +2 -4
- package/Base/managers/ChildrenManager.d.ts +2 -10
- package/Base/managers/ChildrenManager.js +1 -3
- package/Base/managers/EventsManager.cjs +3 -3
- package/Base/managers/EventsManager.d.ts +9 -15
- package/Base/managers/EventsManager.js +2 -2
- package/Base/managers/OptionsManager.d.ts +2 -2
- package/Base/managers/ServicesManager.d.ts +1 -1
- package/Base/types.d.ts +5 -1
- package/Base/utils.cjs +1 -1
- package/Base/utils.d.ts +5 -21
- package/decorators/index.cjs +11 -32
- package/decorators/index.d.ts +10 -10
- package/decorators/index.js +10 -22
- package/decorators/withBreakpointManager.cjs +9 -14
- package/decorators/withBreakpointManager.d.ts +3 -56
- package/decorators/withBreakpointManager.js +7 -6
- package/decorators/withBreakpointObserver.cjs +11 -15
- package/decorators/withBreakpointObserver.d.ts +12 -62
- package/decorators/withBreakpointObserver.js +8 -6
- package/decorators/withDrag.cjs +10 -15
- package/decorators/withDrag.d.ts +8 -51
- package/decorators/withDrag.js +9 -8
- package/decorators/withExtraConfig.cjs +5 -4
- package/decorators/withExtraConfig.d.ts +3 -53
- package/decorators/withExtraConfig.js +5 -4
- package/decorators/withFreezedOptions.cjs +4 -3
- package/decorators/withFreezedOptions.d.ts +6 -53
- package/decorators/withFreezedOptions.js +4 -3
- package/decorators/withIntersectionObserver.cjs +7 -5
- package/decorators/withIntersectionObserver.d.ts +4 -63
- package/decorators/withIntersectionObserver.js +7 -5
- package/decorators/withMountWhenInView.cjs +11 -6
- package/decorators/withMountWhenInView.d.ts +16 -61
- package/decorators/withMountWhenInView.js +11 -6
- package/decorators/withResponsiveOptions.cjs +4 -3
- package/decorators/withResponsiveOptions.d.ts +3 -50
- package/decorators/withResponsiveOptions.js +4 -3
- package/decorators/withScrolledInView.cjs +25 -18
- package/decorators/withScrolledInView.d.ts +30 -141
- package/decorators/withScrolledInView.js +25 -12
- package/decorators/withVue2.cjs +8 -5
- package/decorators/withVue2.d.ts +8 -62
- package/decorators/withVue2.js +8 -5
- package/helpers/createApp.cjs +1 -1
- package/helpers/createApp.d.ts +2 -10
- package/helpers/getDirectChildren.cjs +5 -5
- package/helpers/getDirectChildren.d.ts +3 -6
- package/helpers/getDirectChildren.js +4 -4
- package/helpers/getInstanceFromElement.cjs +3 -4
- package/helpers/getInstanceFromElement.d.ts +2 -11
- package/helpers/getInstanceFromElement.js +2 -3
- package/helpers/importOnInteraction.cjs +1 -1
- package/helpers/importOnInteraction.d.ts +4 -9
- package/helpers/importWhenIdle.cjs +3 -5
- package/helpers/importWhenIdle.d.ts +7 -10
- package/helpers/importWhenIdle.js +2 -4
- package/helpers/importWhenVisible.cjs +1 -1
- package/helpers/importWhenVisible.d.ts +2 -7
- package/helpers/index.cjs +1 -1
- package/helpers/index.d.ts +6 -6
- package/helpers/utils.cjs +1 -1
- package/helpers/utils.d.ts +1 -1
- package/index.cjs +2 -8
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +1 -1
|
@@ -1,69 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
intersectionObserver: IntersectionObserverInit;
|
|
5
|
-
};
|
|
1
|
+
import type { BaseDecorator, BaseInterface } from '../Base/types.js';
|
|
2
|
+
import type { Base } from '../Base/index.js';
|
|
3
|
+
interface WithIntersectionObserverInterface extends BaseInterface {
|
|
6
4
|
$observer: IntersectionObserver;
|
|
7
|
-
intersected(entries: IntersectionObserverEntry[]): void;
|
|
8
5
|
}
|
|
9
6
|
/**
|
|
10
7
|
* IntersectionObserver decoration.
|
|
11
8
|
*/
|
|
12
|
-
export
|
|
13
|
-
new <U extends BaseTypeParameter = BaseTypeParameter>(element: HTMLElement): {
|
|
14
|
-
/**
|
|
15
|
-
* Intersection observer instance.
|
|
16
|
-
*/
|
|
17
|
-
$observer: IntersectionObserver;
|
|
18
|
-
$parent: import("../Base/index.js").default<BaseTypeParameter>;
|
|
19
|
-
$id: string;
|
|
20
|
-
$el: (WithIntersectionObserverInterface & T & U)["$el"] & HTMLElement & {
|
|
21
|
-
__base__?: WeakMap<typeof import("../Base/index.js").default, import("../Base/index.js").default<BaseTypeParameter> | "terminated">;
|
|
22
|
-
};
|
|
23
|
-
$isMounted: boolean;
|
|
24
|
-
__eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
|
|
25
|
-
readonly $root: import("../Base/index.js").default<BaseTypeParameter>;
|
|
26
|
-
readonly __config: import("../Base/index.js").BaseConfig;
|
|
27
|
-
__services: import("../Base/managers/ServicesManager.js").default;
|
|
28
|
-
readonly $services: import("../Base/managers/ServicesManager.js").default;
|
|
29
|
-
__refs: import("../Base/managers/RefsManager.js").default & (WithIntersectionObserverInterface & T & U)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
30
|
-
readonly $refs: import("../Base/managers/RefsManager.js").default & (WithIntersectionObserverInterface & T & U)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
31
|
-
__options: import("../Base/managers/OptionsManager.js").default & (WithIntersectionObserverInterface & T & U)["$options"] & import("../Base/index.js").BaseOptions;
|
|
32
|
-
readonly $options: import("../Base/managers/OptionsManager.js").default & (WithIntersectionObserverInterface & T & U)["$options"] & import("../Base/index.js").BaseOptions;
|
|
33
|
-
__children: import("../Base/managers/ChildrenManager.js").default & ((WithIntersectionObserverInterface & T & U)["$children"] extends infer T_1 ? { [key in keyof T_1]: (WithIntersectionObserverInterface & T & U)["$children"][key][]; } : never) & import("../Base/index.js").BaseChildren;
|
|
34
|
-
readonly $children: import("../Base/managers/ChildrenManager.js").default & ((WithIntersectionObserverInterface & T & U)["$children"] extends infer T_2 ? { [key_1 in keyof T_2]: (WithIntersectionObserverInterface & T & U)["$children"][key_1][]; } : never) & import("../Base/index.js").BaseChildren;
|
|
35
|
-
__events: import("../Base/managers/EventsManager.js").default;
|
|
36
|
-
readonly $log: (...args: any) => void;
|
|
37
|
-
readonly __debug: (...args: any) => void;
|
|
38
|
-
readonly __managers: import("../Base/index.js").Managers;
|
|
39
|
-
__callMethod(method: string, ...args: unknown[]): unknown;
|
|
40
|
-
__hasEvent(event: string): boolean;
|
|
41
|
-
$mount(): any;
|
|
42
|
-
$update(): any;
|
|
43
|
-
$destroy(): any;
|
|
44
|
-
$terminate(): void;
|
|
45
|
-
__addEmits(event: string): void;
|
|
46
|
-
__removeEmits(event: string): void;
|
|
47
|
-
readonly __ctor: typeof import("../Base/index.js").default;
|
|
48
|
-
$on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
49
|
-
$off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
50
|
-
$emit(event: string, ...args: unknown[]): void;
|
|
51
|
-
addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
52
|
-
dispatchEvent(event: Event): boolean;
|
|
53
|
-
removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
54
|
-
};
|
|
55
|
-
config: {
|
|
56
|
-
name: string;
|
|
57
|
-
options: {
|
|
58
|
-
intersectionObserver: ObjectConstructor;
|
|
59
|
-
};
|
|
60
|
-
emits: string[];
|
|
61
|
-
debug?: boolean;
|
|
62
|
-
log?: boolean;
|
|
63
|
-
refs?: string[];
|
|
64
|
-
components?: import("../Base/index.js").BaseConfigComponents;
|
|
65
|
-
};
|
|
66
|
-
readonly $isBase: true;
|
|
67
|
-
$factory(nameOrSelector: string): import("../Base/index.js").default<BaseTypeParameter>[];
|
|
68
|
-
};
|
|
9
|
+
export declare function withIntersectionObserver<S extends Base>(BaseClass: typeof Base, defaultOptions?: IntersectionObserverInit): BaseDecorator<WithIntersectionObserverInterface, S>;
|
|
69
10
|
export {};
|
|
@@ -8,8 +8,8 @@ function createArrayOfNumber(length) {
|
|
|
8
8
|
return [...new Array(length + 1)].map((val, index) => index / length);
|
|
9
9
|
}
|
|
10
10
|
function withIntersectionObserver(BaseClass, defaultOptions = { threshold: createArrayOfNumber(100) }) {
|
|
11
|
-
var _a
|
|
12
|
-
|
|
11
|
+
var _a;
|
|
12
|
+
class WithIntersectionObserver extends BaseClass {
|
|
13
13
|
constructor(element) {
|
|
14
14
|
super(element);
|
|
15
15
|
__publicField(this, "$observer");
|
|
@@ -29,7 +29,8 @@ function withIntersectionObserver(BaseClass, defaultOptions = { threshold: creat
|
|
|
29
29
|
this.$observer.unobserve(this.$el);
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
}
|
|
32
|
+
}
|
|
33
|
+
__publicField(WithIntersectionObserver, "config", {
|
|
33
34
|
...BaseClass.config,
|
|
34
35
|
name: `${BaseClass.config.name}WithIntersectionObserver`,
|
|
35
36
|
options: {
|
|
@@ -37,8 +38,9 @@ function withIntersectionObserver(BaseClass, defaultOptions = { threshold: creat
|
|
|
37
38
|
intersectionObserver: Object
|
|
38
39
|
},
|
|
39
40
|
emits: ["intersected"]
|
|
40
|
-
})
|
|
41
|
+
});
|
|
42
|
+
return WithIntersectionObserver;
|
|
41
43
|
}
|
|
42
44
|
export {
|
|
43
|
-
withIntersectionObserver
|
|
45
|
+
withIntersectionObserver
|
|
44
46
|
};
|
|
@@ -24,12 +24,12 @@ var __publicField = (obj, key, value) => {
|
|
|
24
24
|
// packages/js-toolkit/decorators/withMountWhenInView.ts
|
|
25
25
|
var withMountWhenInView_exports = {};
|
|
26
26
|
__export(withMountWhenInView_exports, {
|
|
27
|
-
|
|
27
|
+
withMountWhenInView: () => withMountWhenInView
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(withMountWhenInView_exports);
|
|
30
30
|
function withMountWhenInView(BaseClass, defaultOptions = { threshold: [0, 1] }) {
|
|
31
|
-
var _a
|
|
32
|
-
|
|
31
|
+
var _a;
|
|
32
|
+
class WithMountWhenInView extends BaseClass {
|
|
33
33
|
constructor(element) {
|
|
34
34
|
super(element);
|
|
35
35
|
__publicField(this, "__isVisible", false);
|
|
@@ -46,7 +46,10 @@ function withMountWhenInView(BaseClass, defaultOptions = { threshold: [0, 1] })
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
|
-
{
|
|
49
|
+
{
|
|
50
|
+
...defaultOptions,
|
|
51
|
+
...this.$options.intersectionObserver
|
|
52
|
+
}
|
|
50
53
|
);
|
|
51
54
|
this.__observer.observe(this.$el);
|
|
52
55
|
this.$on("terminated", () => {
|
|
@@ -59,13 +62,15 @@ function withMountWhenInView(BaseClass, defaultOptions = { threshold: [0, 1] })
|
|
|
59
62
|
}
|
|
60
63
|
return this;
|
|
61
64
|
}
|
|
62
|
-
}
|
|
65
|
+
}
|
|
66
|
+
__publicField(WithMountWhenInView, "config", {
|
|
63
67
|
...BaseClass.config,
|
|
64
68
|
name: `${BaseClass.config.name}WithMountWhenInView`,
|
|
65
69
|
options: {
|
|
66
70
|
...((_a = BaseClass.config) == null ? void 0 : _a.options) || {},
|
|
67
71
|
intersectionObserver: Object
|
|
68
72
|
}
|
|
69
|
-
})
|
|
73
|
+
});
|
|
74
|
+
return WithMountWhenInView;
|
|
70
75
|
}
|
|
71
76
|
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -1,67 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Base from '../Base/index.js';
|
|
3
|
-
|
|
1
|
+
import { BaseInterface, BaseDecorator } from '../Base/types.js';
|
|
2
|
+
import type { Base, BaseTypeParameter } from '../Base/index.js';
|
|
3
|
+
export interface WithMountWhenInViewTypeParameter extends BaseTypeParameter {
|
|
4
4
|
$options: {
|
|
5
5
|
intersectionObserver: IntersectionObserverInit;
|
|
6
6
|
};
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
|
+
export interface WithMountWhenInViewInterface extends BaseInterface {
|
|
9
|
+
/**
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
__isVisible: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
__observer: IntersectionObserver;
|
|
17
|
+
$mount(): this;
|
|
18
|
+
}
|
|
8
19
|
/**
|
|
9
20
|
* IntersectionObserver decoration.
|
|
10
21
|
*/
|
|
11
|
-
export
|
|
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<BaseTypeParameter>;
|
|
28
|
-
$id: string;
|
|
29
|
-
$el: (WithMountWhenInViewInterface & T & U)["$el"] & HTMLElement & {
|
|
30
|
-
__base__?: WeakMap<typeof Base, Base<BaseTypeParameter> | "terminated">;
|
|
31
|
-
};
|
|
32
|
-
$isMounted: boolean;
|
|
33
|
-
__eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
|
|
34
|
-
readonly $root: Base<BaseTypeParameter>;
|
|
35
|
-
readonly __config: BaseConfig;
|
|
36
|
-
__services: import("../Base/managers/ServicesManager.js").default;
|
|
37
|
-
readonly $services: import("../Base/managers/ServicesManager.js").default;
|
|
38
|
-
__refs: import("../Base/managers/RefsManager.js").default & (WithMountWhenInViewInterface & T & U)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
39
|
-
readonly $refs: import("../Base/managers/RefsManager.js").default & (WithMountWhenInViewInterface & T & U)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
40
|
-
__options: import("../Base/managers/OptionsManager.js").default & (WithMountWhenInViewInterface & T & U)["$options"] & import("../Base/index.js").BaseOptions;
|
|
41
|
-
readonly $options: import("../Base/managers/OptionsManager.js").default & (WithMountWhenInViewInterface & T & U)["$options"] & import("../Base/index.js").BaseOptions;
|
|
42
|
-
__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;
|
|
43
|
-
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;
|
|
44
|
-
__events: import("../Base/managers/EventsManager.js").default;
|
|
45
|
-
readonly $log: (...args: any) => void;
|
|
46
|
-
readonly __debug: (...args: any) => void;
|
|
47
|
-
readonly __managers: import("../Base/index.js").Managers;
|
|
48
|
-
__callMethod(method: string, ...args: unknown[]): unknown;
|
|
49
|
-
__hasEvent(event: string): boolean;
|
|
50
|
-
$update(): any;
|
|
51
|
-
$destroy(): any;
|
|
52
|
-
$terminate(): void;
|
|
53
|
-
__addEmits(event: string): void;
|
|
54
|
-
__removeEmits(event: string): void;
|
|
55
|
-
readonly __ctor: typeof Base;
|
|
56
|
-
$on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
57
|
-
$off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
58
|
-
$emit(event: string, ...args: unknown[]): void;
|
|
59
|
-
addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
60
|
-
dispatchEvent(event: Event): boolean;
|
|
61
|
-
removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
62
|
-
};
|
|
63
|
-
config: BaseConfig;
|
|
64
|
-
readonly $isBase: true;
|
|
65
|
-
$factory(nameOrSelector: string): Base<BaseTypeParameter>[];
|
|
66
|
-
};
|
|
67
|
-
export {};
|
|
22
|
+
export declare function withMountWhenInView<S extends Base = Base>(BaseClass: typeof Base, defaultOptions?: IntersectionObserverInit): BaseDecorator<WithMountWhenInViewInterface, S>;
|
|
@@ -5,8 +5,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
function withMountWhenInView(BaseClass, defaultOptions = { threshold: [0, 1] }) {
|
|
8
|
-
var _a
|
|
9
|
-
|
|
8
|
+
var _a;
|
|
9
|
+
class WithMountWhenInView extends BaseClass {
|
|
10
10
|
constructor(element) {
|
|
11
11
|
super(element);
|
|
12
12
|
__publicField(this, "__isVisible", false);
|
|
@@ -23,7 +23,10 @@ function withMountWhenInView(BaseClass, defaultOptions = { threshold: [0, 1] })
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
|
-
{
|
|
26
|
+
{
|
|
27
|
+
...defaultOptions,
|
|
28
|
+
...this.$options.intersectionObserver
|
|
29
|
+
}
|
|
27
30
|
);
|
|
28
31
|
this.__observer.observe(this.$el);
|
|
29
32
|
this.$on("terminated", () => {
|
|
@@ -36,15 +39,17 @@ function withMountWhenInView(BaseClass, defaultOptions = { threshold: [0, 1] })
|
|
|
36
39
|
}
|
|
37
40
|
return this;
|
|
38
41
|
}
|
|
39
|
-
}
|
|
42
|
+
}
|
|
43
|
+
__publicField(WithMountWhenInView, "config", {
|
|
40
44
|
...BaseClass.config,
|
|
41
45
|
name: `${BaseClass.config.name}WithMountWhenInView`,
|
|
42
46
|
options: {
|
|
43
47
|
...((_a = BaseClass.config) == null ? void 0 : _a.options) || {},
|
|
44
48
|
intersectionObserver: Object
|
|
45
49
|
}
|
|
46
|
-
})
|
|
50
|
+
});
|
|
51
|
+
return WithMountWhenInView;
|
|
47
52
|
}
|
|
48
53
|
export {
|
|
49
|
-
withMountWhenInView
|
|
54
|
+
withMountWhenInView
|
|
50
55
|
};
|
|
@@ -25,18 +25,19 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
25
25
|
// packages/js-toolkit/decorators/withResponsiveOptions.ts
|
|
26
26
|
var withResponsiveOptions_exports = {};
|
|
27
27
|
__export(withResponsiveOptions_exports, {
|
|
28
|
-
|
|
28
|
+
withResponsiveOptions: () => withResponsiveOptions
|
|
29
29
|
});
|
|
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
|
-
|
|
33
|
+
class WithResponsiveOptions extends BaseClass {
|
|
34
34
|
get __managers() {
|
|
35
35
|
return {
|
|
36
36
|
...super.__managers,
|
|
37
37
|
OptionsManager: import_ResponsiveOptionsManager.default
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
}
|
|
40
|
+
}
|
|
41
|
+
return WithResponsiveOptions;
|
|
41
42
|
}
|
|
42
43
|
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -1,53 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
1
|
+
import type { BaseInterface, BaseDecorator } from '../Base/types.js';
|
|
2
|
+
import type { Base } from '../Base/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Extends the configuration of an existing class.
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
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<BaseTypeParameter>;
|
|
15
|
-
$id: string;
|
|
16
|
-
$el: (U & T)["$el"] & HTMLElement & {
|
|
17
|
-
__base__?: WeakMap<typeof import("../Base/index.js").default, import("../Base/index.js").default<BaseTypeParameter> | "terminated">;
|
|
18
|
-
};
|
|
19
|
-
$isMounted: boolean;
|
|
20
|
-
__eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
|
|
21
|
-
readonly $root: import("../Base/index.js").default<BaseTypeParameter>;
|
|
22
|
-
readonly __config: import("../Base/index.js").BaseConfig;
|
|
23
|
-
__services: import("../Base/managers/ServicesManager.js").default;
|
|
24
|
-
readonly $services: import("../Base/managers/ServicesManager.js").default;
|
|
25
|
-
__refs: import("../Base/managers/RefsManager.js").default & (U & T)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
26
|
-
readonly $refs: import("../Base/managers/RefsManager.js").default & (U & T)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
27
|
-
__options: import("../Base/managers/OptionsManager.js").default & (U & T)["$options"] & import("../Base/index.js").BaseOptions;
|
|
28
|
-
readonly $options: import("../Base/managers/OptionsManager.js").default & (U & T)["$options"] & import("../Base/index.js").BaseOptions;
|
|
29
|
-
__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;
|
|
30
|
-
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;
|
|
31
|
-
__events: import("../Base/managers/EventsManager.js").default;
|
|
32
|
-
readonly $log: (...args: any) => void;
|
|
33
|
-
readonly __debug: (...args: any) => void;
|
|
34
|
-
__callMethod(method: string, ...args: unknown[]): unknown;
|
|
35
|
-
__hasEvent(event: string): boolean;
|
|
36
|
-
$mount(): any;
|
|
37
|
-
$update(): any;
|
|
38
|
-
$destroy(): any;
|
|
39
|
-
$terminate(): void;
|
|
40
|
-
__addEmits(event: string): void;
|
|
41
|
-
__removeEmits(event: string): void;
|
|
42
|
-
readonly __ctor: typeof import("../Base/index.js").default;
|
|
43
|
-
$on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
44
|
-
$off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
45
|
-
$emit(event: string, ...args: unknown[]): void;
|
|
46
|
-
addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
47
|
-
dispatchEvent(event: Event): boolean;
|
|
48
|
-
removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
49
|
-
};
|
|
50
|
-
readonly $isBase: true;
|
|
51
|
-
config: import("../Base/index.js").BaseConfig;
|
|
52
|
-
$factory(nameOrSelector: string): import("../Base/index.js").default<BaseTypeParameter>[];
|
|
53
|
-
};
|
|
6
|
+
export declare function withResponsiveOptions<S extends Base>(BaseClass: typeof Base): BaseDecorator<BaseInterface, S>;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import ResponsiveOptionsManager from "../Base/managers/ResponsiveOptionsManager.js";
|
|
2
2
|
function withResponsiveOptions(BaseClass) {
|
|
3
|
-
|
|
3
|
+
class WithResponsiveOptions extends BaseClass {
|
|
4
4
|
get __managers() {
|
|
5
5
|
return {
|
|
6
6
|
...super.__managers,
|
|
7
7
|
OptionsManager: ResponsiveOptionsManager
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
|
-
}
|
|
10
|
+
}
|
|
11
|
+
return WithResponsiveOptions;
|
|
11
12
|
}
|
|
12
13
|
export {
|
|
13
|
-
withResponsiveOptions
|
|
14
|
+
withResponsiveOptions
|
|
14
15
|
};
|
|
@@ -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,10 +24,10 @@ var __publicField = (obj, key, value) => {
|
|
|
30
24
|
// packages/js-toolkit/decorators/withScrolledInView.ts
|
|
31
25
|
var withScrolledInView_exports = {};
|
|
32
26
|
__export(withScrolledInView_exports, {
|
|
33
|
-
|
|
27
|
+
withScrolledInView: () => withScrolledInView
|
|
34
28
|
});
|
|
35
29
|
module.exports = __toCommonJS(withScrolledInView_exports);
|
|
36
|
-
var import_withMountWhenInView =
|
|
30
|
+
var import_withMountWhenInView = require("./withMountWhenInView.cjs");
|
|
37
31
|
var import_utils = require("../utils/index.cjs");
|
|
38
32
|
var scheduler = (0, import_utils.useScheduler)(["update", "render"]);
|
|
39
33
|
function updateProps(props, dampFactor, dampPrecision, axis = "x") {
|
|
@@ -56,9 +50,7 @@ function updateProps(props, dampFactor, dampPrecision, axis = "x") {
|
|
|
56
50
|
);
|
|
57
51
|
}
|
|
58
52
|
function withScrolledInView(BaseClass, options = {}) {
|
|
59
|
-
|
|
60
|
-
const WithMountWhenInView = (0, import_withMountWhenInView.default)(BaseClass, options);
|
|
61
|
-
return _a = class extends WithMountWhenInView {
|
|
53
|
+
class WithScrolledInView extends (0, import_withMountWhenInView.withMountWhenInView)(BaseClass, options) {
|
|
62
54
|
constructor(element) {
|
|
63
55
|
super(element);
|
|
64
56
|
__publicField(this, "__props", {
|
|
@@ -87,8 +79,8 @@ function withScrolledInView(BaseClass, options = {}) {
|
|
|
87
79
|
y: 0
|
|
88
80
|
}
|
|
89
81
|
});
|
|
90
|
-
__publicField(this, "dampFactor",
|
|
91
|
-
__publicField(this, "dampPrecision",
|
|
82
|
+
__publicField(this, "dampFactor", null);
|
|
83
|
+
__publicField(this, "dampPrecision", null);
|
|
92
84
|
const render = () => {
|
|
93
85
|
scheduler.update(() => {
|
|
94
86
|
const renderFn = this.__callMethod("scrolledInView", this.__props);
|
|
@@ -112,8 +104,11 @@ function withScrolledInView(BaseClass, options = {}) {
|
|
|
112
104
|
}
|
|
113
105
|
},
|
|
114
106
|
ticked: () => {
|
|
115
|
-
|
|
116
|
-
|
|
107
|
+
var _a, _b;
|
|
108
|
+
const dampFactor = (_a = this.dampFactor) != null ? _a : this.$options.dampFactor;
|
|
109
|
+
const dampPrecision = (_b = this.dampFactor) != null ? _b : this.$options.dampFactor;
|
|
110
|
+
updateProps(this.__props, dampFactor, dampPrecision, "x");
|
|
111
|
+
updateProps(this.__props, dampFactor, dampPrecision, "y");
|
|
117
112
|
if (this.__props.dampedCurrent.x === this.__props.current.x && this.__props.dampedCurrent.y === this.__props.current.y) {
|
|
118
113
|
this.$services.disable("ticked");
|
|
119
114
|
}
|
|
@@ -201,9 +196,21 @@ function withScrolledInView(BaseClass, options = {}) {
|
|
|
201
196
|
(this.__props.dampedCurrent.y - yStart) / (yEnd - yStart)
|
|
202
197
|
);
|
|
203
198
|
}
|
|
204
|
-
}
|
|
199
|
+
}
|
|
200
|
+
__publicField(WithScrolledInView, "config", {
|
|
205
201
|
name: `${BaseClass.config.name}WithMountWhenInView`,
|
|
206
|
-
emits: ["scrolledInView"]
|
|
207
|
-
|
|
202
|
+
emits: ["scrolledInView"],
|
|
203
|
+
options: {
|
|
204
|
+
dampFactor: {
|
|
205
|
+
type: Number,
|
|
206
|
+
default: 0.1
|
|
207
|
+
},
|
|
208
|
+
dampPrecision: {
|
|
209
|
+
type: Number,
|
|
210
|
+
default: 1e-3
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
return WithScrolledInView;
|
|
208
215
|
}
|
|
209
216
|
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { BaseInterface, BaseDecorator } from '../Base/types.js';
|
|
2
|
+
import type { Base, BaseTypeParameter } from '../Base/index.js';
|
|
3
|
+
import type { RafServiceProps, ScrollServiceProps, ResizeServiceProps } from '../services/index.js';
|
|
4
|
+
export interface WithScrolledInViewTypeParameter extends BaseTypeParameter {
|
|
5
|
+
$options: {
|
|
6
|
+
dampFactor: number;
|
|
7
|
+
dampPrecision: number;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export declare type ScrollInViewProps = {
|
|
3
11
|
start: {
|
|
4
12
|
x: number;
|
|
5
13
|
y: number;
|
|
@@ -25,147 +33,28 @@ declare type ScrollInViewProps = {
|
|
|
25
33
|
y: number;
|
|
26
34
|
};
|
|
27
35
|
};
|
|
28
|
-
declare type
|
|
36
|
+
export declare type WithScrolledInViewOptions = IntersectionObserverInit & {
|
|
29
37
|
useOffsetSizes?: boolean;
|
|
30
38
|
};
|
|
39
|
+
export interface WithScrolledInViewInterface extends BaseInterface {
|
|
40
|
+
/**
|
|
41
|
+
* @private
|
|
42
|
+
* @type {ScrollInViewProps}
|
|
43
|
+
*/
|
|
44
|
+
__props: ScrollInViewProps;
|
|
45
|
+
dampFactor?: number;
|
|
46
|
+
dampPrecision?: number;
|
|
47
|
+
mounted(): void;
|
|
48
|
+
resized(props: ResizeServiceProps): void;
|
|
49
|
+
scrolled(props: ScrollServiceProps): void;
|
|
50
|
+
ticked(props: RafServiceProps): void;
|
|
51
|
+
destroyed(): void;
|
|
52
|
+
/**
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
__setProps(): void;
|
|
56
|
+
}
|
|
31
57
|
/**
|
|
32
58
|
* Add scrolled in view capabilities to a component.
|
|
33
59
|
*/
|
|
34
|
-
export
|
|
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<BaseTypeParameter>;
|
|
88
|
-
$id: string;
|
|
89
|
-
$el: ({
|
|
90
|
-
$options: {
|
|
91
|
-
intersectionObserver: IntersectionObserverInit;
|
|
92
|
-
};
|
|
93
|
-
} & T & U)["$el"] & HTMLElement & {
|
|
94
|
-
__base__?: WeakMap<typeof import("../Base/index.js").default, import("../Base/index.js").default<BaseTypeParameter> | "terminated">;
|
|
95
|
-
};
|
|
96
|
-
$isMounted: boolean;
|
|
97
|
-
__eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
|
|
98
|
-
readonly $root: import("../Base/index.js").default<BaseTypeParameter>;
|
|
99
|
-
readonly __config: BaseConfig;
|
|
100
|
-
__services: import("../Base/managers/ServicesManager.js").default;
|
|
101
|
-
readonly $services: import("../Base/managers/ServicesManager.js").default;
|
|
102
|
-
__refs: import("../Base/managers/RefsManager.js").default & ({
|
|
103
|
-
$options: {
|
|
104
|
-
intersectionObserver: IntersectionObserverInit;
|
|
105
|
-
};
|
|
106
|
-
} & T & U)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
107
|
-
readonly $refs: import("../Base/managers/RefsManager.js").default & ({
|
|
108
|
-
$options: {
|
|
109
|
-
intersectionObserver: IntersectionObserverInit;
|
|
110
|
-
};
|
|
111
|
-
} & T & U)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
112
|
-
__options: import("../Base/managers/OptionsManager.js").default & ({
|
|
113
|
-
$options: {
|
|
114
|
-
intersectionObserver: IntersectionObserverInit;
|
|
115
|
-
};
|
|
116
|
-
} & T & U)["$options"] & import("../Base/index.js").BaseOptions;
|
|
117
|
-
readonly $options: import("../Base/managers/OptionsManager.js").default & ({
|
|
118
|
-
$options: {
|
|
119
|
-
intersectionObserver: IntersectionObserverInit;
|
|
120
|
-
};
|
|
121
|
-
} & T & U)["$options"] & import("../Base/index.js").BaseOptions;
|
|
122
|
-
__children: import("../Base/managers/ChildrenManager.js").default & (({
|
|
123
|
-
$options: {
|
|
124
|
-
intersectionObserver: IntersectionObserverInit;
|
|
125
|
-
};
|
|
126
|
-
} & T & U)["$children"] extends infer T_1 ? { [key in keyof T_1]: ({
|
|
127
|
-
$options: {
|
|
128
|
-
intersectionObserver: IntersectionObserverInit;
|
|
129
|
-
};
|
|
130
|
-
} & T & U)["$children"][key][]; } : never) & import("../Base/index.js").BaseChildren;
|
|
131
|
-
readonly $children: import("../Base/managers/ChildrenManager.js").default & (({
|
|
132
|
-
$options: {
|
|
133
|
-
intersectionObserver: IntersectionObserverInit;
|
|
134
|
-
};
|
|
135
|
-
} & T & U)["$children"] extends infer T_2 ? { [key_1 in keyof T_2]: ({
|
|
136
|
-
$options: {
|
|
137
|
-
intersectionObserver: IntersectionObserverInit;
|
|
138
|
-
};
|
|
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;
|
|
148
|
-
readonly __managers: import("../Base/index.js").Managers;
|
|
149
|
-
__callMethod(method: string, ...args: unknown[]): unknown;
|
|
150
|
-
__hasEvent(event: string): boolean;
|
|
151
|
-
$update(): any;
|
|
152
|
-
$destroy(): any;
|
|
153
|
-
$terminate(): void;
|
|
154
|
-
__addEmits(event: string): void;
|
|
155
|
-
__removeEmits(event: string): void;
|
|
156
|
-
readonly __ctor: typeof import("../Base/index.js").default;
|
|
157
|
-
$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;
|
|
160
|
-
addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
161
|
-
dispatchEvent(event: Event): boolean;
|
|
162
|
-
removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
163
|
-
};
|
|
164
|
-
/**
|
|
165
|
-
* Config.
|
|
166
|
-
*/
|
|
167
|
-
config: BaseConfig;
|
|
168
|
-
readonly $isBase: true;
|
|
169
|
-
$factory(nameOrSelector: string): import("../Base/index.js").default<BaseTypeParameter>[];
|
|
170
|
-
};
|
|
171
|
-
export {};
|
|
60
|
+
export declare function withScrolledInView<S extends Base = Base>(BaseClass: typeof Base, options?: WithScrolledInViewOptions): BaseDecorator<WithScrolledInViewInterface, S>;
|